@richard.fadiora/liveness-detection 5.0.3 → 5.1.0

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/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # Liveness Detection SDK v5.0.2
1
+ # Liveness Detection SDK v5.1.0
2
2
 
3
- A high-security, cross-framework **Liveness Detection SDK** designed for financial services. v5.0.2 introduces **Temporal Identity Locking** to prevent identity switching during the verification process.
3
+ A high-security, cross-framework **Liveness Detection SDK** designed for financial services. v5.1.0 introduces **Temporal Identity Locking** to prevent identity switching during the verification process.
4
4
 
5
- ## 🔒 New Security Protocols (v5.0.2)
5
+ ## 🔒 New Security Protocols (v5.1.0)
6
6
 
7
7
  This version introduces a "Zero-Trust" frontend architecture:
8
8
 
@@ -118,7 +118,7 @@ TypeScript
118
118
 
119
119
  * * *
120
120
 
121
- ## 🚨 Updated Error Reference (v4.4.0)
121
+ ## 🚨 Updated Error Reference (v5.1.0)
122
122
 
123
123
  The following codes are now emitted by the frontend engine **instantly**, without hitting the backend:
124
124
 
@@ -129,6 +129,20 @@ The following codes are now emitted by the frontend engine **instantly**, withou
129
129
  | Security violation: Identity mismatch. | Biometric ratios shifted significantly mid-session. | Prevents mid-stream person-swapping. |
130
130
  | Another session is active. | User has the verification open in another tab. | Prevents multi-device brute forcing. |
131
131
 
132
+ * * *
133
+ ### ⚠️ Security Warnings & Temporary Interruption
134
+
135
+ Version 5.0.2 implements a non-fatal warning system for non-critical security events (e.g., fleeting obscuration).
136
+
137
+ * **Temporary Interruption**: If a security violation occurs (e.g., face obscured), the `LivenessEngine` will pause detection for **2 seconds** to allow the user to adjust their position.
138
+
139
+ * **Warning Counter**: The engine tracks these events using `warningCount`. If the violations exceed `MAX_WARNINGS` (default: 3), the session will trigger a `failInstantly` event.
140
+
141
+ * **State Feedback**: During the 2-second pause, the `errorMsg` property in `LivenessState` will be populated with a temporary notification (e.g., _"Please ensure both ears are fully visible. (Warning 1/3)"_).
142
+
143
+
144
+ **Best Practice:** Always subscribe to `onStateChange` in your UI layer to ensure your user-facing components react to the `errorMsg` text.
145
+
132
146
  * * *
133
147
 
134
148
  ## 🏗️ Architectural Flow
@@ -148,7 +162,7 @@ These images are cropped to **224x224px** focusing on the face, making them opti
148
162
 
149
163
  * * *
150
164
 
151
- ## 🔧 Integration Notes for v5.0.2
165
+ ## 🔧 Integration Notes for v5.1.0
152
166
 
153
167
  * **WASM Path**: Ensure your server allows cross-origin requests for the MediaPipe `.wasm` files hosted on JSDelivr.
154
168
 
@@ -0,0 +1,36 @@
1
+ "use strict";const Ke=require("react"),Ja=require("react-webcam");var wt=typeof self<"u"?self:{};function er(e,t){e:{for(var r=["CLOSURE_FLAGS"],n=wt,s=0;s<r.length;s++)if((n=n[r[s]])==null){r=null;break e}r=n}return(e=r&&r[e])!=null?e:t}function Ze(){throw Error("Invalid UTF8")}function Rs(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}let gr,rn;const Qa=typeof TextDecoder<"u";let Za;const e2=typeof TextEncoder<"u";function ji(e){if(e2)e=(Za||(Za=new TextEncoder)).encode(e);else{let r=0;const n=new Uint8Array(3*e.length);for(let s=0;s<e.length;s++){var t=e.charCodeAt(s);if(t<128)n[r++]=t;else{if(t<2048)n[r++]=t>>6|192;else{if(t>=55296&&t<=57343){if(t<=56319&&s<e.length){const i=e.charCodeAt(++s);if(i>=56320&&i<=57343){t=1024*(t-55296)+i-56320+65536,n[r++]=t>>18|240,n[r++]=t>>12&63|128,n[r++]=t>>6&63|128,n[r++]=63&t|128;continue}s--}t=65533}n[r++]=t>>12|224,n[r++]=t>>6&63|128}n[r++]=63&t|128}}e=r===n.length?n:n.subarray(0,r)}return e}function Ui(e){wt.setTimeout(()=>{throw e},0)}var fn,t2=er(610401301,!1),Ns=er(748402147,!0),On=er(824648567,!0),Fn=er(824656860,er(1,!0));function Cs(){var e=wt.navigator;return e&&(e=e.userAgent)?e:""}const Ds=wt.navigator;function Pr(e){return Pr[" "](e),e}fn=Ds&&Ds.userAgentData||null,Pr[" "]=function(){};const Vi={};let Xt=null;function r2(e){const t=e.length;let r=3*t/4;r%3?r=Math.floor(r):"=.".indexOf(e[t-1])!=-1&&(r="=.".indexOf(e[t-2])!=-1?r-2:r-1);const n=new Uint8Array(r);let s=0;return function(i,o){function a(l){for(;c<i.length;){const u=i.charAt(c++),f=Xt[u];if(f!=null)return f;if(!/^[\s\xa0]*$/.test(u))throw Error("Unknown base64 encoding at char: "+u)}return l}Gi();let c=0;for(;;){const l=a(-1),u=a(0),f=a(64),_=a(64);if(_===64&&l===-1)break;o(l<<2|u>>4),f!=64&&(o(u<<4&240|f>>2),_!=64&&o(f<<6&192|_))}}(e,function(i){n[s++]=i}),s!==r?n.subarray(0,s):n}function Gi(){if(!Xt){Xt={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){const n=e.concat(t[r].split(""));Vi[r]=n;for(let s=0;s<n.length;s++){const i=n[s];Xt[i]===void 0&&(Xt[i]=s)}}}}var n2=typeof Uint8Array<"u",Hi=!(!(t2&&fn&&fn.brands.length>0)&&(Cs().indexOf("Trident")!=-1||Cs().indexOf("MSIE")!=-1))&&typeof btoa=="function";const Bs=/[-_.]/g,s2={"-":"+",_:"/",".":"="};function i2(e){return s2[e]||""}function Wi(e){if(!Hi)return r2(e);e=Bs.test(e)?e.replace(Bs,i2):e,e=atob(e);const t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function Rn(e){return n2&&e!=null&&e instanceof Uint8Array}var Et={};function ct(){return o2||(o2=new xe(null,Et))}function Nn(e){qi(Et);var t=e.g;return(t=t==null||Rn(t)?t:typeof t=="string"?Wi(t):null)==null?t:e.g=t}var xe=class{h(){return new Uint8Array(Nn(this)||0)}constructor(e,t){if(qi(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}};let o2,a2;function qi(e){if(e!==Et)throw Error("illegal external caller")}function Ki(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function dn(e){return Ki(e=Error(e),"warning"),e}function At(e,t){if(e!=null){var r=a2??(a2={}),n=r[e]||0;n>=t||(r[e]=n+1,Ki(e=Error(),"incident"),Ui(e))}}function Ft(){return typeof BigInt=="function"}var Rt=typeof Symbol=="function"&&typeof Symbol()=="symbol";function Oe(e,t,r=!1){return typeof Symbol=="function"&&typeof Symbol()=="symbol"?r&&Symbol.for&&e?Symbol.for(e):e!=null?Symbol(e):Symbol():t}var c2=Oe("jas",void 0,!0),js=Oe(void 0,"0di"),qt=Oe(void 0,"1oa"),ue=Oe(void 0,Symbol()),u2=Oe(void 0,"0ub"),h2=Oe(void 0,"0ubs"),pn=Oe(void 0,"0ubsb"),l2=Oe(void 0,"0actk"),kt=Oe("m_m","Pa",!0),Us=Oe();const zi={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},Yi=Object.defineProperties,p=Rt?c2:"Ga";var lt;const Vs=[];function ir(e,t){Rt||p in e||Yi(e,zi),e[p]|=t}function z(e,t){Rt||p in e||Yi(e,zi),e[p]=t}function or(e){return ir(e,34),e}function tr(e){return ir(e,8192),e}z(Vs,7),lt=Object.freeze(Vs);var St={};function le(e,t){return t===void 0?e.h!==ut&&!!(2&(0|e.v[p])):!!(2&t)&&e.h!==ut}const ut={};function Cn(e,t){if(e!=null){if(typeof e=="string")e=e?new xe(e,Et):ct();else if(e.constructor!==xe)if(Rn(e))e=e.length?new xe(new Uint8Array(e),Et):ct();else{if(!t)throw Error();e=void 0}}return e}class Gs{constructor(t,r,n){this.g=t,this.h=r,this.l=n}next(){const t=this.g.next();return t.done||(t.value=this.h.call(this.l,t.value)),t}[Symbol.iterator](){return this}}var f2=Object.freeze({});function Xi(e,t,r){const n=128&t?0:-1,s=e.length;var i;(i=!!s)&&(i=(i=e[s-1])!=null&&typeof i=="object"&&i.constructor===Object);const o=s+(i?-1:0);for(t=128&t?1:0;t<o;t++)r(t-n,e[t]);if(i){e=e[s-1];for(const a in e)!isNaN(a)&&r(+a,e[a])}}var $i={};function Nt(e){return 128&e?$i:void 0}function Mr(e){return e.Na=!0,e}var d2=Mr(e=>typeof e=="number"),Hs=Mr(e=>typeof e=="string"),p2=Mr(e=>typeof e=="boolean"),Ir=typeof wt.BigInt=="function"&&typeof wt.BigInt(0)=="bigint";function he(e){var t=e;if(Hs(t)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(t))throw Error(String(t))}else if(d2(t)&&!Number.isSafeInteger(t))throw Error(String(t));return Ir?BigInt(e):e=p2(e)?e?"1":"0":Hs(e)?e.trim()||"0":String(e)}var gn=Mr(e=>Ir?e>=m2&&e<=_2:e[0]==="-"?Ws(e,g2):Ws(e,y2));const g2=Number.MIN_SAFE_INTEGER.toString(),m2=Ir?BigInt(Number.MIN_SAFE_INTEGER):void 0,y2=Number.MAX_SAFE_INTEGER.toString(),_2=Ir?BigInt(Number.MAX_SAFE_INTEGER):void 0;function Ws(e,t){if(e.length>t.length)return!1;if(e.length<t.length||e===t)return!0;for(let r=0;r<e.length;r++){const n=e[r],s=t[r];if(n>s)return!1;if(n<s)return!0}}const v2=typeof Uint8Array.prototype.slice=="function";let b2,F=0,U=0;function qs(e){const t=e>>>0;F=t,U=(e-t)/4294967296>>>0}function Tt(e){if(e<0){qs(-e);const[t,r]=Un(F,U);F=t>>>0,U=r>>>0}else qs(e)}function Dn(e){const t=b2||(b2=new DataView(new ArrayBuffer(8)));t.setFloat32(0,+e,!0),U=0,F=t.getUint32(0,!0)}function mn(e,t){const r=4294967296*t+(e>>>0);return Number.isSafeInteger(r)?r:rr(e,t)}function w2(e,t){return he(Ft()?BigInt.asUintN(64,(BigInt(t>>>0)<<BigInt(32))+BigInt(e>>>0)):rr(e,t))}function Bn(e,t){const r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=mn(e,t))=="number"?r?-e:e:r?"-"+e:e}function Ji(e,t){return Ft()?he(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(t))<<BigInt(32))+BigInt.asUintN(32,BigInt(e)))):he(jn(e,t))}function rr(e,t){if(e>>>=0,(t>>>=0)<=2097151)var r=""+(4294967296*t+e);else Ft()?r=""+(BigInt(t)<<BigInt(32)|BigInt(e)):(e=(16777215&e)+6777216*(r=16777215&(e>>>24|t<<8))+6710656*(t=t>>16&65535),r+=8147497*t,t*=2,e>=1e7&&(r+=e/1e7>>>0,e%=1e7),r>=1e7&&(t+=r/1e7>>>0,r%=1e7),r=t+Ks(r)+Ks(e));return r}function Ks(e){return e=String(e),"0000000".slice(e.length)+e}function jn(e,t){if(2147483648&t)if(Ft())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{const[r,n]=Un(e,t);e="-"+rr(r,n)}else e=rr(e,t);return e}function xr(e){if(e.length<16)Tt(Number(e));else if(Ft())e=BigInt(e),F=Number(e&BigInt(4294967295))>>>0,U=Number(e>>BigInt(32)&BigInt(4294967295));else{const t=+(e[0]==="-");U=F=0;const r=e.length;for(let n=t,s=(r-t)%6+t;s<=r;n=s,s+=6){const i=Number(e.slice(n,s));U*=1e6,F=1e6*F+i,F>=4294967296&&(U+=Math.trunc(F/4294967296),U>>>=0,F>>>=0)}if(t){const[n,s]=Un(F,U);F=n,U=s}}}function Un(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}function ke(e){return Array.prototype.slice.call(e)}const ar=typeof BigInt=="function"?BigInt.asIntN:void 0,E2=typeof BigInt=="function"?BigInt.asUintN:void 0,ht=Number.isSafeInteger,Or=Number.isFinite,Lt=Math.trunc,A2=he(0);function $t(e){if(e!=null&&typeof e!="number")throw Error(`Value of float/double field must be a number, found ${typeof e}: ${e}`);return e}function Ie(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function nr(e){if(e!=null&&typeof e!="boolean"){var t=typeof e;throw Error(`Expected boolean but got ${t!="object"?t:e?Array.isArray(e)?"array":t:"null"}: ${e}`)}return e}function Qi(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}const k2=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function cr(e){switch(typeof e){case"bigint":return!0;case"number":return Or(e);case"string":return k2.test(e);default:return!1}}function Ct(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return Or(e)?0|e:void 0}function Zi(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return Or(e)?e>>>0:void 0}function eo(e){const t=e.length;return(e[0]==="-"?t<20||t===20&&e<="-9223372036854775808":t<19||t===19&&e<="9223372036854775807")?e:(xr(e),jn(F,U))}function Vn(e){return e=Lt(e),ht(e)||(Tt(e),e=Bn(F,U)),e}function to(e){var t=Lt(Number(e));return ht(t)?String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),eo(e))}function ro(e){var t=Lt(Number(e));return ht(t)?he(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Ft()?he(ar(64,BigInt(e))):he(eo(e)))}function no(e){return ht(e)?e=he(Vn(e)):(e=Lt(e),ht(e)?e=String(e):(Tt(e),e=jn(F,U)),e=he(e)),e}function S2(e){return e==null?e:typeof e=="bigint"?(gn(e)?e=Number(e):(e=ar(64,e),e=gn(e)?Number(e):String(e)),e):cr(e)?typeof e=="number"?Vn(e):to(e):void 0}function wr(e){const t=typeof e;return e==null?e:t==="bigint"?he(ar(64,e)):cr(e)?t==="string"?ro(e):no(e):void 0}function so(e){if(typeof e!="string")throw Error();return e}function ur(e){if(e!=null&&typeof e!="string")throw Error();return e}function Q(e){return e==null||typeof e=="string"?e:void 0}function Gn(e,t,r,n){return e!=null&&e[kt]===St?e:Array.isArray(e)?((n=(r=0|e[p])|32&n|2&n)!==r&&z(e,n),new t(e)):(r?2&n?((e=t[js])||(or((e=new t).v),e=t[js]=e),t=e):t=new t:t=void 0,t)}function T2(e,t,r){if(t)e:{if(!cr(t=e))throw dn("int64");switch(typeof t){case"string":t=ro(t);break e;case"bigint":t=he(ar(64,t));break e;default:t=no(t)}}else t=wr(e);return(e=t)==null?r?A2:void 0:e}const L2={};let P2=function(){try{return Pr(new class extends Map{constructor(){super()}}),!1}catch{return!0}}();class nn{constructor(){this.g=new Map}get(t){return this.g.get(t)}set(t,r){return this.g.set(t,r),this.size=this.g.size,this}delete(t){return t=this.g.delete(t),this.size=this.g.size,t}clear(){this.g.clear(),this.size=this.g.size}has(t){return this.g.has(t)}entries(){return this.g.entries()}keys(){return this.g.keys()}values(){return this.g.values()}forEach(t,r){return this.g.forEach(t,r)}[Symbol.iterator](){return this.entries()}}const M2=P2?(Object.setPrototypeOf(nn.prototype,Map.prototype),Object.defineProperties(nn.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),nn):class extends Map{constructor(){super()}};function zs(e){return e}function sn(e){if(2&e.J)throw Error("Cannot mutate an immutable Map")}var Be=class extends M2{constructor(e,t,r=zs,n=zs){super(),this.J=0|e[p],this.K=t,this.S=r,this.fa=this.K?I2:n;for(let s=0;s<e.length;s++){const i=e[s],o=r(i[0],!1,!0);let a=i[1];t?a===void 0&&(a=null):a=n(i[1],!1,!0,void 0,void 0,this.J),super.set(o,a)}}V(e){return tr(Array.from(super.entries(),e))}clear(){sn(this),super.clear()}delete(e){return sn(this),super.delete(this.S(e,!0,!1))}entries(){if(this.K){var e=super.keys();e=new Gs(e,x2,this)}else e=super.entries();return e}values(){if(this.K){var e=super.keys();e=new Gs(e,Be.prototype.get,this)}else e=super.values();return e}forEach(e,t){this.K?super.forEach((r,n,s)=>{e.call(t,s.get(n),n,s)}):super.forEach(e,t)}set(e,t){return sn(this),(e=this.S(e,!0,!1))==null?this:t==null?(super.delete(e),this):super.set(e,this.fa(t,!0,!0,this.K,!1,this.J))}Ma(e){const t=this.S(e[0],!1,!0);e=e[1],e=this.K?e===void 0?null:e:this.fa(e,!1,!0,void 0,!1,this.J),super.set(t,e)}has(e){return super.has(this.S(e,!1,!1))}get(e){e=this.S(e,!1,!1);const t=super.get(e);if(t!==void 0){var r=this.K;return r?((r=this.fa(t,!1,!0,r,this.ra,this.J))!==t&&super.set(e,r),r):t}}[Symbol.iterator](){return this.entries()}};function I2(e,t,r,n,s,i){return e=Gn(e,n,r,i),s&&(e=Wn(e)),e}function x2(e){return[e,this.get(e)]}let O2;function Ys(){return O2||(O2=new Be(or([]),void 0,void 0,void 0,L2))}function Fr(e){return ue?e[ue]:void 0}function Er(e,t){for(const r in e)!isNaN(r)&&t(e,+r,e[r])}Be.prototype.toJSON=void 0;var yn=class{};const F2={Ka:!0};function R2(e,t){t<100||At(h2,1)}function Rr(e,t,r,n){const s=n!==void 0;n=!!n;var i,o=ue;!s&&Rt&&o&&(i=e[o])&&Er(i,R2),o=[];var a=e.length;let c;i=4294967295;let l=!1;const u=!!(64&t),f=u?128&t?0:-1:void 0;1&t||(c=a&&e[a-1],c!=null&&typeof c=="object"&&c.constructor===Object?i=--a:c=void 0,!u||128&t||s||(l=!0,i=i-f+f)),t=void 0;for(var _=0;_<a;_++){let b=e[_];if(b!=null&&(b=r(b,n))!=null)if(u&&_>=i){const P=_-f;(t??(t={}))[P]=b}else o[_]=b}if(c)for(let b in c){if((a=c[b])==null||(a=r(a,n))==null)continue;let P;_=+b,u&&!Number.isNaN(_)&&(P=_+f)<i?o[P]=a:(t??(t={}))[b]=a}return t&&(l?o.push(t):o[i]=t),s&&ue&&(e=Fr(e))&&e instanceof yn&&(o[ue]=function(b){const P=new yn;return Er(b,(He,ie,Z)=>{P[ie]=ke(Z)}),P.da=b.da,P}(e)),o}function N2(e){return e[0]=sr(e[0]),e[1]=sr(e[1]),e}function sr(e){switch(typeof e){case"number":return Number.isFinite(e)?e:""+e;case"bigint":return gn(e)?Number(e):""+e;case"boolean":return e?1:0;case"object":if(Array.isArray(e)){var t=0|e[p];return e.length===0&&1&t?void 0:Rr(e,t,sr)}if(e!=null&&e[kt]===St)return io(e);if(e instanceof xe){if((t=e.g)==null)e="";else if(typeof t=="string")e=t;else{if(Hi){for(var r="",n=0,s=t.length-10240;n<s;)r+=String.fromCharCode.apply(null,t.subarray(n,n+=10240));r+=String.fromCharCode.apply(null,n?t.subarray(n):t),t=btoa(r)}else{r===void 0&&(r=0),Gi(),r=Vi[r],n=Array(Math.floor(t.length/3)),s=r[64]||"";let l=0,u=0;for(;l<t.length-2;l+=3){var i=t[l],o=t[l+1],a=t[l+2],c=r[i>>2];i=r[(3&i)<<4|o>>4],o=r[(15&o)<<2|a>>6],a=r[63&a],n[u++]=c+i+o+a}switch(c=0,a=s,t.length-l){case 2:a=r[(15&(c=t[l+1]))<<2]||s;case 1:t=t[l],n[u]=r[t>>2]+r[(3&t)<<4|c>>4]+a+s}t=n.join("")}e=e.g=t}return e}return e instanceof Be?e=e.size!==0?e.V(N2):void 0:void 0}return e}function io(e){return Rr(e=e.v,0|e[p],sr)}let C2,D2;function nt(e,t){return oo(e,t[0],t[1])}function oo(e,t,r,n=0){if(e==null){var s=32;r?(e=[r],s|=128):e=[],t&&(s=-16760833&s|(1023&t)<<14)}else{if(!Array.isArray(e))throw Error("narr");if(s=0|e[p],Ns&&1&s)throw Error("rfarr");if(2048&s&&!(2&s)&&function(){if(Ns)throw Error("carr");At(l2,5)}(),256&s)throw Error("farr");if(64&s)return(s|n)!==s&&z(e,s|n),e;if(r&&(s|=128,r!==e[0]))throw Error("mid");e:{s|=64;var i=(r=e).length;if(i){var o=i-1;const c=r[o];if(c!=null&&typeof c=="object"&&c.constructor===Object){if((o-=t=128&s?0:-1)>=1024)throw Error("pvtlmt");for(var a in c)(i=+a)<o&&(r[i+t]=c[a],delete c[a]);s=-16760833&s|(1023&o)<<14;break e}}if(t){if((a=Math.max(t,i-(128&s?0:-1)))>1024)throw Error("spvt");s=-16760833&s|(1023&a)<<14}}}return z(e,64|s|n),e}function B2(e,t){if(typeof e!="object")return e;if(Array.isArray(e)){var r=0|e[p];return e.length===0&&1&r?void 0:Xs(e,r,t)}if(e!=null&&e[kt]===St)return $s(e);if(e instanceof Be){if(2&(t=e.J))return e;if(!e.size)return;if(r=or(e.V()),e.K)for(e=0;e<r.length;e++){const n=r[e];let s=n[1];s=s==null||typeof s!="object"?void 0:s!=null&&s[kt]===St?$s(s):Array.isArray(s)?Xs(s,0|s[p],!!(32&t)):void 0,n[1]=s}return r}return e instanceof xe?e:void 0}function Xs(e,t,r){return 2&t||(!r||4096&t||16&t?e=Dt(e,t,!1,r&&!(16&t)):(ir(e,34),4&t&&Object.freeze(e))),e}function Hn(e,t,r){return e=new e.constructor(t),r&&(e.h=ut),e.m=ut,e}function $s(e){const t=e.v,r=0|t[p];return le(e,r)?e:qn(e,t,r)?Hn(e,t):Dt(t,r)}function Dt(e,t,r,n){return n??(n=!!(34&t)),e=Rr(e,t,B2,n),n=32,r&&(n|=2),z(e,t=16769217&t|n),e}function Wn(e){const t=e.v,r=0|t[p];return le(e,r)?qn(e,t,r)?Hn(e,t,!0):new e.constructor(Dt(t,r,!1)):e}function Bt(e){if(e.h!==ut)return!1;var t=e.v;return ir(t=Dt(t,0|t[p]),2048),e.v=t,e.h=void 0,e.m=void 0,!0}function jt(e){if(!Bt(e)&&le(e,0|e.v[p]))throw Error()}function ft(e,t){t===void 0&&(t=0|e[p]),32&t&&!(4096&t)&&z(e,4096|t)}function qn(e,t,r){return!!(2&r)||!(!(32&r)||4096&r)&&(z(t,2|r),e.h=ut,!0)}const j2=he(0),We={};function I(e,t,r,n,s){if((t=je(e.v,t,r,s))!==null||n&&e.m!==ut)return t}function je(e,t,r,n){if(t===-1)return null;const s=t+(r?0:-1),i=e.length-1;let o,a;if(!(i<1+(r?0:-1))){if(s>=i)if(o=e[i],o!=null&&typeof o=="object"&&o.constructor===Object)r=o[t],a=!0;else{if(s!==i)return;r=o}else r=e[s];if(n&&r!=null){if((n=n(r))==null)return n;if(!Object.is(n,r))return a?o[t]=n:e[s]=n,n}return r}}function T(e,t,r,n){jt(e),q(e=e.v,0|e[p],t,r,n)}function q(e,t,r,n,s){const i=r+(s?0:-1);var o=e.length-1;if(o>=1+(s?0:-1)&&i>=o){const a=e[o];if(a!=null&&typeof a=="object"&&a.constructor===Object)return a[r]=n,t}return i<=o?(e[i]=n,t):(n!==void 0&&(r>=(o=(t??(t=0|e[p]))>>14&1023||536870912)?n!=null&&(e[o+(s?0:-1)]={[r]:n}):e[i]=n),t)}function tt(){return f2===void 0?2:4}function rt(e,t,r,n,s){let i=e.v,o=0|i[p];n=le(e,o)?1:n,s=!!s||n===3,n===2&&Bt(e)&&(i=e.v,o=0|i[p]);let a=(e=Kn(i,t))===lt?7:0|e[p],c=zn(a,o);var l=!(4&c);if(l){4&c&&(e=ke(e),a=0,c=it(c,o),o=q(i,o,t,e));let u=0,f=0;for(;u<e.length;u++){const _=r(e[u]);_!=null&&(e[f++]=_)}f<u&&(e.length=f),r=-513&(4|c),c=r&=-1025,c&=-4097}return c!==a&&(z(e,c),2&c&&Object.freeze(e)),ao(e,c,i,o,t,n,l,s)}function ao(e,t,r,n,s,i,o,a){let c=t;return i===1||i===4&&(2&t||!(16&t)&&32&n)?st(t)||((t|=!e.length||o&&!(4096&t)||32&n&&!(4096&t||16&t)?2:256)!==c&&z(e,t),Object.freeze(e)):(i===2&&st(t)&&(e=ke(e),c=0,t=it(t,n),n=q(r,n,s,e)),st(t)||(a||(t|=16),t!==c&&z(e,t))),2&t||!(4096&t||16&t)||ft(r,n),e}function Kn(e,t,r){return e=je(e,t,r),Array.isArray(e)?e:lt}function zn(e,t){return 2&t&&(e|=2),1|e}function st(e){return!!(2&e)&&!!(4&e)||!!(256&e)}function co(e){return Cn(e,!0)}function uo(e){e=ke(e);for(let t=0;t<e.length;t++){const r=e[t]=ke(e[t]);Array.isArray(r[1])&&(r[1]=or(r[1]))}return tr(e)}function ze(e,t,r,n){jt(e),q(e=e.v,0|e[p],t,(n==="0"?Number(r)===0:r===n)?void 0:r)}function Ut(e,t,r){if(2&t)throw Error();const n=Nt(t);let s=Kn(e,r,n),i=s===lt?7:0|s[p],o=zn(i,t);return(2&o||st(o)||16&o)&&(o===i||st(o)||z(s,o),s=ke(s),i=0,o=it(o,t),q(e,t,r,s,n)),o&=-13,o!==i&&z(s,o),s}function on(e,t){var r=ra;return Xn(Yn(e=e.v),e,void 0,r)===t?t:-1}function Yn(e){if(Rt)return e[qt]??(e[qt]=new Map);if(qt in e)return e[qt];const t=new Map;return Object.defineProperty(e,qt,{value:t}),t}function ho(e,t,r,n,s){const i=Yn(e),o=Xn(i,e,t,r,s);return o!==n&&(o&&(t=q(e,t,o,void 0,s)),i.set(r,n)),t}function Xn(e,t,r,n,s){let i=e.get(n);if(i!=null)return i;i=0;for(let o=0;o<n.length;o++){const a=n[o];je(t,a,s)!=null&&(i!==0&&(r=q(t,r,i,void 0,s)),i=a)}return e.set(n,i),i}function $n(e,t,r){let n=0|e[p];const s=Nt(n),i=je(e,r,s);let o;if(i!=null&&i[kt]===St){if(!le(i))return Bt(i),i.v;o=i.v}else Array.isArray(i)&&(o=i);if(o){const a=0|o[p];2&a&&(o=Dt(o,a))}return o=nt(o,t),o!==i&&q(e,n,r,o,s),o}function lo(e,t,r,n,s){let i=!1;if((n=je(e,n,s,o=>{const a=Gn(o,r,!1,t);return i=a!==o&&a!=null,a}))!=null)return i&&!le(n)&&ft(e,t),n}function k(e,t,r,n){let s=e.v,i=0|s[p];if((t=lo(s,i,t,r,n))==null)return t;if(i=0|s[p],!le(e,i)){const o=Wn(t);o!==t&&(Bt(e)&&(s=e.v,i=0|s[p]),i=q(s,i,r,t=o,n),ft(s,i))}return t}function fo(e,t,r,n,s,i,o,a){var c=le(e,r);i=c?1:i,o=!!o||i===3,c=a&&!c,(i===2||c)&&Bt(e)&&(r=0|(t=e.v)[p]);var l=(e=Kn(t,s))===lt?7:0|e[p],u=zn(l,r);if(a=!(4&u)){var f=e,_=r;const b=!!(2&u);b&&(_|=2);let P=!b,He=!0,ie=0,Z=0;for(;ie<f.length;ie++){const pt=Gn(f[ie],n,!1,_);if(pt instanceof n){if(!b){const dr=le(pt);P&&(P=!dr),He&&(He=dr)}f[Z++]=pt}}Z<ie&&(f.length=Z),u|=4,u=He?-4097&u:4096|u,u=P?8|u:-9&u}if(u!==l&&(z(e,u),2&u&&Object.freeze(e)),c&&!(8&u||!e.length&&(i===1||i===4&&(2&u||!(16&u)&&32&r)))){for(st(u)&&(e=ke(e),u=it(u,r),r=q(t,r,s,e)),n=e,c=u,l=0;l<n.length;l++)(f=n[l])!==(u=Wn(f))&&(n[l]=u);c|=8,z(e,u=c=n.length?4096|c:-4097&c)}return ao(e,u,t,r,s,i,a,o)}function Ue(e,t,r){const n=e.v;return fo(e,n,0|n[p],t,r,tt(),!1,!0)}function po(e){return e==null&&(e=void 0),e}function v(e,t,r,n,s){return T(e,r,n=po(n),s),n&&!le(n)&&ft(e.v),e}function Jt(e,t,r,n){e:{var s=n=po(n);jt(e);const i=e.v;let o=0|i[p];if(s==null){const a=Yn(i);if(Xn(a,i,o,r)!==t)break e;a.set(r,0)}else o=ho(i,o,r,t);q(i,o,t,s)}n&&!le(n)&&ft(e.v)}function it(e,t){return-273&(2&t?2|e:-3&e)}function Jn(e,t,r,n){var s=n;jt(e),e=fo(e,n=e.v,0|n[p],r,t,2,!0),s=s??new r,e.push(s),t=r=e===lt?7:0|e[p],(s=le(s))?(r&=-9,e.length===1&&(r&=-4097)):r|=4096,r!==t&&z(e,r),s||ft(n)}function we(e,t,r){return Ct(I(e,t,void 0,r))}function go(e){return(Fn?I(e,2,void 0,void 0,wr):wr(I(e,2)))??j2}function B(e,t){return I(e,t,void 0,void 0,Ie)??0}function Ve(e,t,r){if(r!=null){if(typeof r!="number"||!Or(r))throw dn("int32");r|=0}T(e,t,r)}function y(e,t,r){T(e,t,$t(r))}function fe(e,t,r){ze(e,t,ur(r),"")}function Ar(e,t,r){{jt(e);const o=e.v;let a=0|o[p];if(r==null)q(o,a,t);else{var n=e=r===lt?7:0|r[p],s=st(e),i=s||Object.isFrozen(r);for(s||(e=0),i||(r=ke(r),n=0,e=it(e,a),i=!1),e|=5,e|=(4&e?512&e?512:1024&e?1024:0:void 0)??(Fn?1024:0),s=0;s<r.length;s++){const c=r[s],l=so(c);Object.is(c,l)||(i&&(r=ke(r),n=0,e=it(e,a),i=!1),r[s]=l)}e!==n&&(i&&(r=ke(r),e=it(e,a)),z(r,e)),q(o,a,t,r)}}}function Nr(e,t,r){jt(e),rt(e,t,Q,2,!0).push(so(r))}var mt=class{constructor(e,t,r){if(this.buffer=e,r&&!t)throw Error();this.g=t}};function Qn(e,t){if(typeof e=="string")return new mt(Wi(e),t);if(Array.isArray(e))return new mt(new Uint8Array(e),t);if(e.constructor===Uint8Array)return new mt(e,!1);if(e.constructor===ArrayBuffer)return e=new Uint8Array(e),new mt(e,!1);if(e.constructor===xe)return t=Nn(e)||new Uint8Array(0),new mt(t,!0,e);if(e instanceof Uint8Array)return e=e.constructor===Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new mt(e,!1);throw Error()}function Pt(e,t){let r,n=0,s=0,i=0;const o=e.h;let a=e.g;do r=o[a++],n|=(127&r)<<i,i+=7;while(i<32&&128&r);if(i>32)for(s|=(127&r)>>4,i=3;i<32&&128&r;i+=7)r=o[a++],s|=(127&r)<<i;if(ot(e,a),!(128&r))return t(n>>>0,s>>>0);throw Error()}function Zn(e){let t=0,r=e.g;const n=r+10,s=e.h;for(;r<n;){const i=s[r++];if(t|=i,(128&i)==0)return ot(e,r),!!(127&t)}throw Error()}function $e(e){const t=e.h;let r=e.g,n=t[r++],s=127&n;if(128&n&&(n=t[r++],s|=(127&n)<<7,128&n&&(n=t[r++],s|=(127&n)<<14,128&n&&(n=t[r++],s|=(127&n)<<21,128&n&&(n=t[r++],s|=n<<28,128&n&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++])))))throw Error();return ot(e,r),s}function Ge(e){return $e(e)>>>0}function kr(e){var t=e.h;const r=e.g;var n=t[r],s=t[r+1];const i=t[r+2];return t=t[r+3],ot(e,e.g+4),e=2*((s=(n<<0|s<<8|i<<16|t<<24)>>>0)>>31)+1,n=s>>>23&255,s&=8388607,n==255?s?NaN:e*(1/0):n==0?1401298464324817e-60*e*s:e*Math.pow(2,n-150)*(s+8388608)}function U2(e){return $e(e)}function ot(e,t){if(e.g=t,t>e.l)throw Error()}function mo(e,t){if(t<0)throw Error();const r=e.g;if((t=r+t)>e.l)throw Error();return e.g=t,r}function yo(e,t){if(t==0)return ct();var r=mo(e,t);return e.Y&&e.j?r=e.h.subarray(r,r+t):(e=e.h,r=r===(t=r+t)?new Uint8Array(0):v2?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?ct():new xe(r,Et)}var Js=[];function _o(e,t,r,n){if(Sr.length){const s=Sr.pop();return s.o(n),s.g.init(e,t,r,n),s}return new V2(e,t,r,n)}function vo(e){e.g.clear(),e.l=-1,e.h=-1,Sr.length<100&&Sr.push(e)}function bo(e){var t=e.g;if(t.g==t.l)return!1;e.m=e.g.g;var r=Ge(e.g);if(t=r>>>3,!((r&=7)>=0&&r<=5)||t<1)throw Error();return e.l=t,e.h=r,!0}function vr(e){switch(e.h){case 0:e.h!=0?vr(e):Zn(e.g);break;case 1:ot(e=e.g,e.g+8);break;case 2:if(e.h!=2)vr(e);else{var t=Ge(e.g);ot(e=e.g,e.g+t)}break;case 5:ot(e=e.g,e.g+4);break;case 3:for(t=e.l;;){if(!bo(e))throw Error();if(e.h==4){if(e.l!=t)throw Error();break}vr(e)}break;default:throw Error()}}function hr(e,t,r){const n=e.g.l;var s=Ge(e.g);let i=(s=e.g.g+s)-n;if(i<=0&&(e.g.l=s,r(t,e,void 0,void 0,void 0),i=s-e.g.g),i)throw Error();return e.g.g=s,e.g.l=n,t}function es(e){var t=Ge(e.g),r=mo(e=e.g,t);if(e=e.h,Qa){var n,s=e;(n=rn)||(n=rn=new TextDecoder("utf-8",{fatal:!0})),t=r+t,s=r===0&&t===s.length?s:s.subarray(r,t);try{var i=n.decode(s)}catch(a){if(gr===void 0){try{n.decode(new Uint8Array([128]))}catch{}try{n.decode(new Uint8Array([97])),gr=!0}catch{gr=!1}}throw!gr&&(rn=void 0),a}}else{t=(i=r)+t,r=[];let a,c=null;for(;i<t;){var o=e[i++];o<128?r.push(o):o<224?i>=t?Ze():(a=e[i++],o<194||(192&a)!=128?(i--,Ze()):r.push((31&o)<<6|63&a)):o<240?i>=t-1?Ze():(a=e[i++],(192&a)!=128||o===224&&a<160||o===237&&a>=160||(192&(n=e[i++]))!=128?(i--,Ze()):r.push((15&o)<<12|(63&a)<<6|63&n)):o<=244?i>=t-2?Ze():(a=e[i++],(192&a)!=128||a-144+(o<<28)>>30||(192&(n=e[i++]))!=128||(192&(s=e[i++]))!=128?(i--,Ze()):(o=(7&o)<<18|(63&a)<<12|(63&n)<<6|63&s,o-=65536,r.push(55296+(o>>10&1023),56320+(1023&o)))):Ze(),r.length>=8192&&(c=Rs(c,r),r.length=0)}i=Rs(c,r)}return i}function wo(e){const t=Ge(e.g);return yo(e.g,t)}function Cr(e,t,r){var n=Ge(e.g);for(n=e.g.g+n;e.g.g<n;)r.push(t(e.g))}var V2=class{constructor(e,t,r,n){if(Js.length){const s=Js.pop();s.init(e,t,r,n),e=s}else e=new class{constructor(s,i,o,a){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.init(s,i,o,a)}init(s,i,o,{Y:a=!1,ea:c=!1}={}){this.Y=a,this.ea=c,s&&(s=Qn(s,this.ea),this.h=s.buffer,this.j=s.g,this.m=i||0,this.l=o!==void 0?this.m+o:this.h.length,this.g=this.m)}clear(){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.Y=!1}}(e,t,r,n);this.g=e,this.m=this.g.g,this.h=this.l=-1,this.o(n)}o({ha:e=!1}={}){this.ha=e}},Sr=[];function Qs(e){return e?/^\d+$/.test(e)?(xr(e),new _n(F,U)):null:G2||(G2=new _n(0,0))}var _n=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let G2;function Zs(e){return e?/^-?\d+$/.test(e)?(xr(e),new vn(F,U)):null:H2||(H2=new vn(0,0))}var vn=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let H2;function vt(e,t,r){for(;r>0||t>127;)e.g.push(127&t|128),t=(t>>>7|r<<25)>>>0,r>>>=7;e.g.push(t)}function Vt(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function Dr(e,t){if(t>=0)Vt(e,t);else{for(let r=0;r<9;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function ts(e){var t=F;e.g.push(t>>>0&255),e.g.push(t>>>8&255),e.g.push(t>>>16&255),e.g.push(t>>>24&255)}function Mt(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function Ee(e,t,r){Vt(e.g,8*t+r)}function rs(e,t){return Ee(e,t,2),t=e.g.end(),Mt(e,t),t.push(e.h),t}function ns(e,t){var r=t.pop();for(r=e.h+e.g.length()-r;r>127;)t.push(127&r|128),r>>>=7,e.h++;t.push(r),e.h++}function Br(e,t,r){Ee(e,t,2),Vt(e.g,r.length),Mt(e,e.g.end()),Mt(e,r)}function Tr(e,t,r,n){r!=null&&(t=rs(e,t),n(r,e),ns(e,t))}function Fe(){const e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var ss=Fe(),Eo=Fe(),is=Fe(),os=Fe(),Ao=Fe(),ko=Fe(),W2=Fe(),jr=Fe(),So=Fe(),To=Fe();function Re(e,t,r){var n=e.v;ue&&ue in n&&(n=n[ue])&&delete n[t.g],t.h?t.j(e,t.h,t.g,r,t.l):t.j(e,t.g,r,t.l)}var g=class{constructor(e,t){this.v=oo(e,t,void 0,2048)}toJSON(){return io(this)}j(){var s;var e=T1,t=this.v,r=e.g,n=ue;if(Rt&&n&&((s=t[n])==null?void 0:s[r])!=null&&At(u2,3),t=e.g,Us&&ue&&Us===void 0&&(n=(r=this.v)[ue])&&(n=n.da))try{n(r,t,F2)}catch(i){Ui(i)}return e.h?e.m(this,e.h,e.g,e.l):e.m(this,e.g,e.defaultValue,e.l)}clone(){const e=this.v,t=0|e[p];return qn(this,e,t)?Hn(this,e,!0):new this.constructor(Dt(e,t,!1))}};g.prototype[kt]=St,g.prototype.toString=function(){return this.v.toString()};var Gt=class{constructor(e,t,r){this.g=e,this.h=t,e=ss,this.l=!!e&&r===e||!1}};function Ur(e,t){return new Gt(e,t,ss)}function Lo(e,t,r,n,s){Tr(e,r,xo(t,n),s)}const q2=Ur(function(e,t,r,n,s){return e.h===2&&(hr(e,$n(t,n,r),s),!0)},Lo),K2=Ur(function(e,t,r,n,s){return e.h===2&&(hr(e,$n(t,n,r),s),!0)},Lo);var Vr=Symbol(),Gr=Symbol(),bn=Symbol(),ei=Symbol(),ti=Symbol();let Po,Mo;function dt(e,t,r,n){var s=n[e];if(s)return s;(s={}).qa=n,s.T=function(f){switch(typeof f){case"boolean":return C2||(C2=[0,void 0,!0]);case"number":return f>0?void 0:f===0?D2||(D2=[0,void 0]):[-f,void 0];case"string":return[0,f];case"object":return f}}(n[0]);var i=n[1];let o=1;i&&i.constructor===Object&&(s.ba=i,typeof(i=n[++o])=="function"&&(s.ma=!0,Po??(Po=i),Mo??(Mo=n[o+1]),i=n[o+=2]));const a={};for(;i&&Array.isArray(i)&&i.length&&typeof i[0]=="number"&&i[0]>0;){for(var c=0;c<i.length;c++)a[i[c]]=i;i=n[++o]}for(c=1;i!==void 0;){let f;typeof i=="number"&&(c+=i,i=n[++o]);var l=void 0;if(i instanceof Gt?f=i:(f=q2,o--),f==null?void 0:f.l){i=n[++o],l=n;var u=o;typeof i=="function"&&(i=i(),l[u]=i),l=i}for(u=c+1,typeof(i=n[++o])=="number"&&i<0&&(u-=i,i=n[++o]);c<u;c++){const _=a[c];l?r(s,c,f,l,_):t(s,c,f,_)}}return n[e]=s}function Io(e){return Array.isArray(e)?e[0]instanceof Gt?e:[K2,e]:[e,void 0]}function xo(e,t){return e instanceof g?e.v:Array.isArray(e)?nt(e,t):void 0}function as(e,t,r,n){const s=r.g;e[t]=n?(i,o,a)=>s(i,o,a,n):s}function cs(e,t,r,n,s){const i=r.g;let o,a;e[t]=(c,l,u)=>i(c,l,u,a||(a=dt(Gr,as,cs,n).T),o||(o=us(n)),s)}function us(e){let t=e[bn];if(t!=null)return t;const r=dt(Gr,as,cs,e);return t=r.ma?(n,s)=>Po(n,s,r):(n,s)=>{for(;bo(s)&&s.h!=4;){var i=s.l,o=r[i];if(o==null){var a=r.ba;a&&(a=a[i])&&(a=Y2(a))!=null&&(o=r[i]=a)}if(o==null||!o(s,n,i)){if(o=(a=s).m,vr(a),a.ha)var c=void 0;else c=a.g.g-o,a.g.g=o,c=yo(a.g,c);o=void 0,a=n,c&&((o=a[ue]??(a[ue]=new yn))[i]??(o[i]=[])).push(c)}}return(n=Fr(n))&&(n.da=r.qa[ti]),!0},e[bn]=t,e[ti]=z2.bind(e),t}function z2(e,t,r,n){var s=this[Gr];const i=this[bn],o=nt(void 0,s.T),a=Fr(e);if(a){var c=!1,l=s.ba;if(l){if(s=(u,f,_)=>{if(_.length!==0)if(l[f])for(const b of _){u=_o(b);try{c=!0,i(o,u)}finally{vo(u)}}else n==null||n(e,f,_)},t==null)Er(a,s);else if(a!=null){const u=a[t];u&&s(a,t,u)}if(c){let u=0|e[p];if(2&u&&2048&u&&!(r!=null&&r.Ka))throw Error();const f=Nt(u),_=(b,P)=>{if(je(e,b,f)!=null){if((r==null?void 0:r.Qa)===1)return;throw Error()}P!=null&&(u=q(e,u,b,P,f)),delete a[b]};t==null?Xi(o,0|o[p],(b,P)=>{_(b,P)}):_(t,je(o,t,f))}}}}function Y2(e){const t=(e=Io(e))[0].g;if(e=e[1]){const r=us(e),n=dt(Gr,as,cs,e).T;return(s,i,o)=>t(s,i,o,n,r)}return t}function Hr(e,t,r){e[t]=r.h}function Wr(e,t,r,n){let s,i;const o=r.h;e[t]=(a,c,l)=>o(a,c,l,i||(i=dt(Vr,Hr,Wr,n).T),s||(s=Oo(n)))}function Oo(e){let t=e[ei];if(!t){const r=dt(Vr,Hr,Wr,e);t=(n,s)=>Fo(n,s,r),e[ei]=t}return t}function Fo(e,t,r){Xi(e,0|e[p],(n,s)=>{if(s!=null){var i=function(o,a){var c=o[a];if(c)return c;if((c=o.ba)&&(c=c[a])){var l=(c=Io(c))[0].h;if(c=c[1]){const u=Oo(c),f=dt(Vr,Hr,Wr,c).T;c=o.ma?Mo(f,u):(_,b,P)=>l(_,b,P,f,u)}else c=l;return o[a]=c}}(r,n);i?i(t,s,n):n<500||At(pn,3)}}),(e=Fr(e))&&Er(e,(n,s,i)=>{for(Mt(t,t.g.end()),n=0;n<i.length;n++)Mt(t,Nn(i[n])||new Uint8Array(0))})}const X2=he(0);function Ht(e,t){if(Array.isArray(t)){var r=0|t[p];if(4&r)return t;for(var n=0,s=0;n<t.length;n++){const i=e(t[n]);i!=null&&(t[s++]=i)}return s<n&&(t.length=s),(e=-1537&(5|r))!==r&&z(t,e),2&e&&Object.freeze(t),t}}function te(e,t,r){return new Gt(e,t,r)}function Wt(e,t,r){return new Gt(e,t,r)}function J(e,t,r){q(e,0|e[p],t,r,Nt(0|e[p]))}var $2=Ur(function(e,t,r,n,s){if(e.h!==2)return!1;if(e=ke(e=hr(e,nt([void 0,void 0],n),s)),s=Nt(n=0|t[p]),2&n)throw Error();let i=je(t,r,s);if(i instanceof Be)2&i.J?(i=i.V(),i.push(e),q(t,n,r,i,s)):i.Ma(e);else if(Array.isArray(i)){var o=0|i[p];8192&o||z(i,o|=8192),2&o&&(i=uo(i),q(t,n,r,i,s)),i.push(e)}else q(t,n,r,tr([e]),s);return!0},function(e,t,r,n,s){if(t instanceof Be)t.forEach((i,o)=>{Tr(e,r,nt([o,i],n),s)});else if(Array.isArray(t)){for(let i=0;i<t.length;i++){const o=t[i];Array.isArray(o)&&Tr(e,r,nt(o,n),s)}tr(t)}});function Ro(e,t,r){(t=Ie(t))!=null&&(Ee(e,r,5),e=e.g,Dn(t),ts(e))}function No(e,t,r){if(t=function(n){if(n==null)return n;const s=typeof n;if(s==="bigint")return String(ar(64,n));if(cr(n)){if(s==="string")return to(n);if(s==="number")return Vn(n)}}(t),t!=null&&(typeof t=="string"&&Zs(t),t!=null))switch(Ee(e,r,0),typeof t){case"number":e=e.g,Tt(t),vt(e,F,U);break;case"bigint":r=BigInt.asUintN(64,t),r=new vn(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),vt(e.g,r.h,r.g);break;default:r=Zs(t),vt(e.g,r.h,r.g)}}function Co(e,t,r){(t=Ct(t))!=null&&t!=null&&(Ee(e,r,0),Dr(e.g,t))}function Do(e,t,r){(t=Qi(t))!=null&&(Ee(e,r,0),e.g.g.push(t?1:0))}function Bo(e,t,r){(t=Q(t))!=null&&Br(e,r,ji(t))}function jo(e,t,r,n,s){Tr(e,r,xo(t,n),s)}function Uo(e,t,r){(t=t==null||typeof t=="string"||t instanceof xe?t:void 0)!=null&&Br(e,r,Qn(t,!0).buffer)}function Vo(e,t,r){return(e.h===5||e.h===2)&&(t=Ut(t,0|t[p],r),e.h==2?Cr(e,kr,t):t.push(kr(e.g)),!0)}var V=te(function(e,t,r){return e.h===5&&(J(t,r,kr(e.g)),!0)},Ro,jr),J2=Wt(Vo,function(e,t,r){if((t=Ht(Ie,t))!=null)for(let o=0;o<t.length;o++){var n=e,s=r,i=t[o];i!=null&&(Ee(n,s,5),n=n.g,Dn(i),ts(n))}},jr),hs=Wt(Vo,function(e,t,r){if((t=Ht(Ie,t))!=null&&t.length){Ee(e,r,2),Vt(e.g,4*t.length);for(let n=0;n<t.length;n++)r=e.g,Dn(t[n]),ts(r)}},jr),Q2=te(function(e,t,r){return e.h===5&&(J(t,r,(e=kr(e.g))===0?void 0:e),!0)},Ro,jr),Je=te(function(e,t,r){return On?(e.h!==0?e=!1:(J(t,r,Pt(e.g,Ji)),e=!0),e):e.h===0&&(J(t,r,Pt(e.g,Bn)),!0)},No,ko),an=te(function(e,t,r){return On?(e.h!==0?t=!1:(J(t,r,(e=Pt(e.g,Ji))===X2?void 0:e),t=!0),t):e.h===0&&(J(t,r,(e=Pt(e.g,Bn))===0?void 0:e),!0)},No,ko),Z2=te(function(e,t,r){return On?(e.h!==0?e=!1:(J(t,r,Pt(e.g,w2)),e=!0),e):e.h===0&&(J(t,r,Pt(e.g,mn)),!0)},function(e,t,r){if(t=function(n){if(n==null)return n;var s=typeof n;if(s==="bigint")return String(E2(64,n));if(cr(n)){if(s==="string")return s=Lt(Number(n)),ht(s)&&s>=0?n=String(s):((s=n.indexOf("."))!==-1&&(n=n.substring(0,s)),(s=n[0]!=="-"&&((s=n.length)<20||s===20&&n<="18446744073709551615"))||(xr(n),n=rr(F,U))),n;if(s==="number")return(n=Lt(n))>=0&&ht(n)||(Tt(n),n=mn(F,U)),n}}(t),t!=null&&(typeof t=="string"&&Qs(t),t!=null))switch(Ee(e,r,0),typeof t){case"number":e=e.g,Tt(t),vt(e,F,U);break;case"bigint":r=BigInt.asUintN(64,t),r=new _n(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),vt(e.g,r.h,r.g);break;default:r=Qs(t),vt(e.g,r.h,r.g)}},W2),$=te(function(e,t,r){return e.h===0&&(J(t,r,$e(e.g)),!0)},Co,os),lr=Wt(function(e,t,r){return(e.h===0||e.h===2)&&(t=Ut(t,0|t[p],r),e.h==2?Cr(e,$e,t):t.push($e(e.g)),!0)},function(e,t,r){if((t=Ht(Ct,t))!=null&&t.length){r=rs(e,r);for(let n=0;n<t.length;n++)Dr(e.g,t[n]);ns(e,r)}},os),_t=te(function(e,t,r){return e.h===0&&(J(t,r,(e=$e(e.g))===0?void 0:e),!0)},Co,os),j=te(function(e,t,r){return e.h===0&&(J(t,r,Zn(e.g)),!0)},Do,Eo),at=te(function(e,t,r){return e.h===0&&(J(t,r,(e=Zn(e.g))===!1?void 0:e),!0)},Do,Eo),ee=Wt(function(e,t,r){return e.h===2&&(e=es(e),Ut(t,0|t[p],r).push(e),!0)},function(e,t,r){if((t=Ht(Q,t))!=null)for(let o=0;o<t.length;o++){var n=e,s=r,i=t[o];i!=null&&Br(n,s,ji(i))}},is),Ye=te(function(e,t,r){return e.h===2&&(J(t,r,(e=es(e))===""?void 0:e),!0)},Bo,is),L=te(function(e,t,r){return e.h===2&&(J(t,r,es(e)),!0)},Bo,is),X=function(e,t,r=ss){return new Gt(e,t,r)}(function(e,t,r,n,s){return e.h===2&&(n=nt(void 0,n),Ut(t,0|t[p],r).push(n),hr(e,n,s),!0)},function(e,t,r,n,s){if(Array.isArray(t)){for(let i=0;i<t.length;i++)jo(e,t[i],r,n,s);1&(e=0|t[p])||z(t,1|e)}}),D=Ur(function(e,t,r,n,s,i){if(e.h!==2)return!1;let o=0|t[p];return ho(t,o,i,r,Nt(o)),hr(e,t=$n(t,n,r),s),!0},jo),Go=te(function(e,t,r){return e.h===2&&(J(t,r,wo(e)),!0)},Uo,So),e1=Wt(function(e,t,r){return(e.h===0||e.h===2)&&(t=Ut(t,0|t[p],r),e.h==2?Cr(e,Ge,t):t.push(Ge(e.g)),!0)},function(e,t,r){if((t=Ht(Zi,t))!=null)for(let o=0;o<t.length;o++){var n=e,s=r,i=t[o];i!=null&&(Ee(n,s,0),Vt(n.g,i))}},Ao),t1=te(function(e,t,r){return e.h===0&&(J(t,r,(e=Ge(e.g))===0?void 0:e),!0)},function(e,t,r){(t=Zi(t))!=null&&t!=null&&(Ee(e,r,0),Vt(e.g,t))},Ao),de=te(function(e,t,r){return e.h===0&&(J(t,r,$e(e.g)),!0)},function(e,t,r){(t=Ct(t))!=null&&(t=parseInt(t,10),Ee(e,r,0),Dr(e.g,t))},To);class r1{constructor(t,r){var n=ge;this.g=t,this.h=r,this.m=k,this.j=v,this.defaultValue=void 0,this.l=n.Oa!=null?$i:void 0}register(){Pr(this)}}function Ne(e,t){return new r1(e,t)}function Qe(e,t){return(r,n)=>{{const i={ea:!0};n&&Object.assign(i,n),r=_o(r,void 0,void 0,i);try{const o=new e,a=o.v;us(t)(a,r);var s=o}finally{vo(r)}}return s}}function qr(e){return function(){const t=new class{constructor(){this.l=[],this.h=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){const o=this.g;return this.g=[],o}}}};Fo(this.v,t,dt(Vr,Hr,Wr,e)),Mt(t,t.g.end());const r=new Uint8Array(t.h),n=t.l,s=n.length;let i=0;for(let o=0;o<s;o++){const a=n[o];r.set(a,i),i+=a.length}return t.l=[r],r}}var ri=class extends g{constructor(e){super(e)}},ni=[0,Ye,te(function(e,t,r){return e.h===2&&(J(t,r,(e=wo(e))===ct()?void 0:e),!0)},function(e,t,r){if(t!=null){if(t instanceof g){const n=t.Ra;return void(n?(t=n(t),t!=null&&Br(e,r,Qn(t,!0).buffer)):At(pn,3))}if(Array.isArray(t))return void At(pn,3)}Uo(e,t,r)},So)];let cn,si=globalThis.trustedTypes;function ii(e){var t;return cn===void 0&&(cn=function(){let r=null;if(!si)return r;try{const n=s=>s;r=si.createPolicy("goog#html",{createHTML:n,createScript:n,createScriptURL:n})}catch{}return r}()),e=(t=cn)?t.createScriptURL(e):e,new class{constructor(r){this.g=r}toString(){return this.g+""}}(e)}function n1(e,...t){if(t.length===0)return ii(e[0]);let r=e[0];for(let n=0;n<t.length;n++)r+=encodeURIComponent(t[n])+e[n+1];return ii(r)}var Ho=[0,$,de,j,-1,lr,de,-1,j],s1=class extends g{constructor(e){super(e)}},Wo=[0,j,L,j,de,-1,Wt(function(e,t,r){return(e.h===0||e.h===2)&&(t=Ut(t,0|t[p],r),e.h==2?Cr(e,U2,t):t.push($e(e.g)),!0)},function(e,t,r){if((t=Ht(Ct,t))!=null&&t.length){r=rs(e,r);for(let n=0;n<t.length;n++)Dr(e.g,t[n]);ns(e,r)}},To),L,-1,[0,j,-1],de,j,-1],qo=[0,3,j,-1,2,[0,$],[0,de,j],[0,L,-1],[0]],Ko=[0,L,-2],oi=class extends g{constructor(e){super(e)}},zo=[0],Yo=[0,$,j,1,j,-4],ge=class extends g{constructor(e){super(e,2)}},K={};K[336783863]=[0,L,j,-1,$,[0,[1,2,3,4,5,6,7,8,9],D,zo,D,Wo,D,Ko,D,Yo,D,Ho,D,[0,L,-2],D,[0,L,de],D,qo,D,[0,de,-1,j]],[0,L],j,[0,[1,3],[2,4],D,[0,lr],-1,D,[0,ee],-1,X,[0,L,-1]],L];var ai=[0,an,-1,at,-3,an,lr,Ye,_t,an,-1,at,_t,at,-2,Ye];function x(e,t){Nr(e,3,t)}function E(e,t){Nr(e,4,t)}var se=class extends g{constructor(e){super(e,500)}o(e){return v(this,0,7,e)}},Qt=[-1,{}],ci=[0,L,1,Qt],ui=[0,L,ee,Qt];function Ae(e,t){Jn(e,1,se,t)}function R(e,t){Nr(e,10,t)}function S(e,t){Nr(e,15,t)}var me=class extends g{constructor(e){super(e,500)}o(e){return v(this,0,1001,e)}},Xo=[-500,X,[-500,Ye,-1,ee,-3,[-2,K,j],X,ni,_t,-1,ci,ui,X,[0,Ye,at],Ye,ai,_t,ee,987,ee],4,X,[-500,L,-1,[-1,{}],998,L],X,[-500,L,ee,-1,[-2,{},j],997,ee,-1],_t,X,[-500,L,ee,Qt,998,ee],ee,_t,ci,ui,X,[0,Ye,-1,Qt],ee,-2,ai,Ye,-1,at,[0,at,t1],978,Qt,X,ni];me.prototype.g=qr(Xo);var i1=Qe(me,Xo),o1=class extends g{constructor(e){super(e)}},$o=class extends g{constructor(e){super(e)}g(){return Ue(this,o1,1)}},Jo=[0,X,[0,$,V,L,-1]],Kr=Qe($o,Jo),a1=class extends g{constructor(e){super(e)}},c1=class extends g{constructor(e){super(e)}},un=class extends g{constructor(e){super(e)}l(){return k(this,a1,2)}g(){return Ue(this,c1,5)}},Qo=Qe(class extends g{constructor(e){super(e)}},[0,ee,lr,hs,[0,de,[0,$,-3],[0,V,-3],[0,$,-1,[0,X,[0,$,-2]]],X,[0,V,-1,L,V]],L,-1,Je,X,[0,$,V],ee,Je]),Zo=class extends g{constructor(e){super(e)}},bt=Qe(class extends g{constructor(e){super(e)}},[0,X,[0,V,-4]]),ea=class extends g{constructor(e){super(e)}},fr=Qe(class extends g{constructor(e){super(e)}},[0,X,[0,V,-4]]),u1=class extends g{constructor(e){super(e)}},h1=[0,$,-1,hs,de],ta=class extends g{constructor(e){super(e)}};ta.prototype.g=qr([0,V,-4,Je]);var l1=class extends g{constructor(e){super(e)}},f1=Qe(class extends g{constructor(e){super(e)}},[0,X,[0,1,$,L,Jo],Je]),hi=class extends g{constructor(e){super(e)}},d1=class extends g{constructor(e){super(e)}na(){const e=I(this,1,void 0,void 0,co);return e??ct()}},p1=class extends g{constructor(e){super(e)}},ra=[1,2],g1=Qe(class extends g{constructor(e){super(e)}},[0,X,[0,ra,D,[0,hs],D,[0,Go],$,L],Je]),ls=class extends g{constructor(e){super(e)}},na=[0,L,$,V,ee,-1],li=class extends g{constructor(e){super(e)}},m1=[0,j,-1],fi=class extends g{constructor(e){super(e)}},br=[1,2,3,4,5,6],Lr=class extends g{constructor(e){super(e)}g(){return I(this,1,void 0,void 0,co)!=null}l(){return Q(I(this,2))!=null}},C=class extends g{constructor(e){super(e)}g(){return Qi(I(this,2))??!1}},sa=[0,Go,L,[0,$,Je,-1],[0,Z2,Je]],G=[0,sa,j,[0,br,D,Yo,D,Wo,D,Ho,D,zo,D,Ko,D,qo],de],zr=class extends g{constructor(e){super(e)}},fs=[0,G,V,-1,$],y1=Ne(502141897,zr);K[502141897]=fs;var _1=Qe(class extends g{constructor(e){super(e)}},[0,[0,de,-1,J2,e1],h1]),ia=class extends g{constructor(e){super(e)}},oa=class extends g{constructor(e){super(e)}},wn=[0,G,V,[0,G],j],v1=Ne(508968150,oa);K[508968150]=[0,G,fs,wn,V,[0,[0,sa]]],K[508968149]=wn;var yt=class extends g{constructor(e){super(e)}l(){return k(this,ls,2)}g(){T(this,2)}},aa=[0,G,na];K[478825465]=aa;var b1=class extends g{constructor(e){super(e)}},ca=class extends g{constructor(e){super(e)}},ds=class extends g{constructor(e){super(e)}},ps=class extends g{constructor(e){super(e)}},ua=class extends g{constructor(e){super(e)}},di=[0,G,[0,G],aa,-1],ha=[0,G,V,$],gs=[0,G,V],la=[0,G,ha,gs,V],w1=Ne(479097054,ua);K[479097054]=[0,G,la,di],K[463370452]=di,K[464864288]=ha;var E1=Ne(462713202,ps);K[462713202]=la,K[474472470]=gs;var A1=class extends g{constructor(e){super(e)}},fa=class extends g{constructor(e){super(e)}},da=class extends g{constructor(e){super(e)}},pa=class extends g{constructor(e){super(e)}},ms=[0,G,V,-1,$],En=[0,G,V,j];pa.prototype.g=qr([0,G,gs,[0,G],fs,wn,ms,En]);var ga=class extends g{constructor(e){super(e)}},k1=Ne(456383383,ga);K[456383383]=[0,G,na];var ma=class extends g{constructor(e){super(e)}},S1=Ne(476348187,ma);K[476348187]=[0,G,m1];var ya=class extends g{constructor(e){super(e)}},pi=class extends g{constructor(e){super(e)}},_a=[0,de,-1],T1=Ne(458105876,class extends g{constructor(e){super(e)}g(){let e;var t=this.v;const r=0|t[p];return e=le(this,r),t=function(n,s,i,o){var a=pi;!o&&Bt(n)&&(i=0|(s=n.v)[p]);var c=je(s,2);if(n=!1,c==null){if(o)return Ys();c=[]}else if(c.constructor===Be){if(!(2&c.J)||o)return c;c=c.V()}else Array.isArray(c)?n=!!(2&(0|c[p])):c=[];if(o){if(!c.length)return Ys();n||(n=!0,or(c))}else n&&(n=!1,tr(c),c=uo(c));return!n&&32&i&&ir(c,32),i=q(s,i,2,o=new Be(c,a,T2,void 0)),n||ft(s,i),o}(this,t,r,e),!e&&pi&&(t.ra=!0),t}});K[458105876]=[0,_a,$2,[!0,Je,[0,L,-1,ee]],[0,lr,j,de]];var ys=class extends g{constructor(e){super(e)}},va=Ne(458105758,ys);K[458105758]=[0,G,L,_a];var hn=class extends g{constructor(e){super(e)}},gi=[0,Q2,-1,at],L1=class extends g{constructor(e){super(e)}},ba=class extends g{constructor(e){super(e)}},An=[1,2];ba.prototype.g=qr([0,An,D,gi,D,[0,X,gi]]);var wa=class extends g{constructor(e){super(e)}},P1=Ne(443442058,wa);K[443442058]=[0,G,L,$,V,ee,-1,j,V],K[514774813]=ms;var Ea=class extends g{constructor(e){super(e)}},M1=Ne(516587230,Ea);function kn(e,t){return t=t?t.clone():new ls,e.displayNamesLocale!==void 0?T(t,1,ur(e.displayNamesLocale)):e.displayNamesLocale===void 0&&T(t,1),e.maxResults!==void 0?Ve(t,2,e.maxResults):"maxResults"in e&&T(t,2),e.scoreThreshold!==void 0?y(t,3,e.scoreThreshold):"scoreThreshold"in e&&T(t,3),e.categoryAllowlist!==void 0?Ar(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&T(t,4),e.categoryDenylist!==void 0?Ar(t,5,e.categoryDenylist):"categoryDenylist"in e&&T(t,5),t}function Aa(e){const t=Number(e);return Number.isSafeInteger(t)?t:String(e)}function _s(e,t=-1,r=""){return{categories:e.map(n=>({index:we(n,1)??0??-1,score:B(n,2)??0,categoryName:Q(I(n,3))??""??"",displayName:Q(I(n,4))??""??""})),headIndex:t,headName:r}}function I1(e){const t={classifications:Ue(e,l1,1).map(r=>{var n;return _s(((n=k(r,$o,4))==null?void 0:n.g())??[],we(r,2)??0,Q(I(r,3))??"")})};return function(r){return S2(Fn?I(r,2,void 0,void 0,wr):I(r,2))}(e)!=null&&(t.timestampMs=Aa(go(e))),t}function ka(e){var o,a;var t=rt(e,3,Ie,tt()),r=rt(e,2,Ct,tt()),n=rt(e,1,Q,tt()),s=rt(e,9,Q,tt());const i={categories:[],keypoints:[]};for(let c=0;c<t.length;c++)i.categories.push({score:t[c],index:r[c]??-1,categoryName:n[c]??"",displayName:s[c]??""});if((t=(o=k(e,un,4))==null?void 0:o.l())&&(i.boundingBox={originX:we(t,1,We)??0,originY:we(t,2,We)??0,width:we(t,3,We)??0,height:we(t,4,We)??0,angle:0}),(a=k(e,un,4))==null?void 0:a.g().length)for(const c of k(e,un,4).g())i.keypoints.push({x:I(c,1,void 0,We,Ie)??0,y:I(c,2,void 0,We,Ie)??0,score:I(c,4,void 0,We,Ie)??0,label:Q(I(c,3,void 0,We))??""});return i}function Yr(e){const t=[];for(const r of Ue(e,ea,1))t.push({x:B(r,1)??0,y:B(r,2)??0,z:B(r,3)??0,visibility:B(r,4)??0});return t}function Zt(e){const t=[];for(const r of Ue(e,Zo,1))t.push({x:B(r,1)??0,y:B(r,2)??0,z:B(r,3)??0,visibility:B(r,4)??0});return t}function mi(e){return Array.from(e,t=>t>127?t-256:t)}function yi(e,t){if(e.length!==t.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${e.length} vs. ${t.length}).`);let r=0,n=0,s=0;for(let i=0;i<e.length;i++)r+=e[i]*t[i],n+=e[i]*e[i],s+=t[i]*t[i];if(n<=0||s<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return r/Math.sqrt(n*s)}let mr;K[516587230]=[0,G,ms,En,V],K[518928384]=En;const x1=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);async function Sa(){if(mr===void 0)try{await WebAssembly.instantiate(x1),mr=!0}catch{mr=!1}return mr}async function Kt(e,t=n1``){const r=await Sa()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var et=class{};function Ta(){var e=navigator;return typeof OffscreenCanvas<"u"&&(!function(t=navigator){return(t=t.userAgent).includes("Safari")&&!t.includes("Chrome")}(e)||!!((e=e.userAgent.match(/Version\/([\d]+).*Safari/))&&e.length>=1&&Number(e[1])>=17))}async function _i(e){if(typeof importScripts!="function"){const t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise((r,n)=>{t.addEventListener("load",()=>{r()},!1),t.addEventListener("error",s=>{n(s)},!1),document.body.appendChild(t)})}try{importScripts(e.toString())}catch(t){if(!(t instanceof TypeError))throw t;await self.import(e.toString())}}function La(e){return e.videoWidth!==void 0?[e.videoWidth,e.videoHeight]:e.naturalWidth!==void 0?[e.naturalWidth,e.naturalHeight]:e.displayWidth!==void 0?[e.displayWidth,e.displayHeight]:[e.width,e.height]}function m(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),r(t=e.i.stringToNewUTF8(t)),e.i._free(t)}function vi(e,t,r){if(!e.i.canvas)throw Error("No OpenGL canvas configured.");if(r?e.i._bindTextureToStream(r):e.i._bindTextureToCanvas(),!(r=e.i.canvas.getContext("webgl2")||e.i.canvas.getContext("webgl")))throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");e.i.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!0),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t),e.i.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1);const[n,s]=La(t);return!e.l||n===e.i.canvas.width&&s===e.i.canvas.height||(e.i.canvas.width=n,e.i.canvas.height=s),[n,s]}function bi(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const n=new Uint32Array(t.length);for(let s=0;s<t.length;s++)n[s]=e.i.stringToNewUTF8(t[s]);t=e.i._malloc(4*n.length),e.i.HEAPU32.set(n,t>>2),r(t);for(const s of n)e.i._free(s);e.i._free(t)}function Pe(e,t,r){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=r}function qe(e,t,r){let n=[];e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=(s,i,o)=>{i?(r(n,o),n=[]):n.push(s)}}et.forVisionTasks=function(e){return Kt("vision",e)},et.forTextTasks=function(e){return Kt("text",e)},et.forGenAiExperimentalTasks=function(e){return Kt("genai_experimental",e)},et.forGenAiTasks=function(e){return Kt("genai",e)},et.forAudioTasks=function(e){return Kt("audio",e)},et.isSimdSupported=function(){return Sa()};async function O1(e,t,r,n){return e=await(async(s,i,o,a,c)=>{if(i&&await _i(i),!self.ModuleFactory||o&&(await _i(o),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&c&&((i=self.Module).locateFile=c.locateFile,c.mainScriptUrlOrBlob&&(i.mainScriptUrlOrBlob=c.mainScriptUrlOrBlob)),c=await self.ModuleFactory(self.Module||c),self.ModuleFactory=self.Module=void 0,new s(c,a)})(e,r.wasmLoaderPath,r.assetLoaderPath,t,{locateFile:s=>s.endsWith(".wasm")?r.wasmBinaryPath.toString():r.assetBinaryPath&&s.endsWith(".data")?r.assetBinaryPath.toString():s}),await e.o(n),e}function ln(e,t){const r=k(e.baseOptions,Lr,1)||new Lr;typeof t=="string"?(T(r,2,ur(t)),T(r,1)):t instanceof Uint8Array&&(T(r,1,Cn(t,!1)),T(r,2)),v(e.baseOptions,0,1,r)}function wi(e){try{const t=e.H.length;if(t===1)throw Error(e.H[0].message);if(t>1)throw Error("Encountered multiple errors: "+e.H.map(r=>r.message).join(", "))}finally{e.H=[]}}function d(e,t){e.C=Math.max(e.C,t)}function Xr(e,t){e.B=new se,fe(e.B,2,"PassThroughCalculator"),x(e.B,"free_memory"),E(e.B,"free_memory_unused_out"),R(t,"free_memory"),Ae(t,e.B)}function It(e,t){x(e.B,t),E(e.B,t+"_unused_out")}function $r(e){e.g.addBoolToStream(!0,"free_memory",e.C)}var Sn=class{constructor(e){this.g=e,this.H=[],this.C=0,this.g.setAutoRenderToScreen(!1)}l(e,t=!0){var r,n,s,i,o,a;if(t){const c=e.baseOptions||{};if((r=e.baseOptions)!=null&&r.modelAssetBuffer&&((n=e.baseOptions)!=null&&n.modelAssetPath))throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!((s=k(this.baseOptions,Lr,1))!=null&&s.g()||(i=k(this.baseOptions,Lr,1))!=null&&i.l()||(o=e.baseOptions)!=null&&o.modelAssetBuffer||(a=e.baseOptions)!=null&&a.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if(function(l,u){let f=k(l.baseOptions,fi,3);if(!f){var _=f=new fi,b=new oi;Jt(_,4,br,b)}"delegate"in u&&(u.delegate==="GPU"?(u=f,_=new s1,Jt(u,2,br,_)):(u=f,_=new oi,Jt(u,4,br,_))),v(l.baseOptions,0,3,f)}(this,c),c.modelAssetPath)return fetch(c.modelAssetPath.toString()).then(l=>{if(l.ok)return l.arrayBuffer();throw Error(`Failed to fetch model: ${c.modelAssetPath} (${l.status})`)}).then(l=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(l),!0,!1,!1),ln(this,"/model.dat"),this.m(),this.L()});if(c.modelAssetBuffer instanceof Uint8Array)ln(this,c.modelAssetBuffer);else if(c.modelAssetBuffer)return async function(l){const u=[];for(var f=0;;){const{done:_,value:b}=await l.read();if(_)break;u.push(b),f+=b.length}if(u.length===0)return new Uint8Array(0);if(u.length===1)return u[0];l=new Uint8Array(f),f=0;for(const _ of u)l.set(_,f),f+=_.length;return l}(c.modelAssetBuffer).then(l=>{ln(this,l),this.m(),this.L()})}return this.m(),this.L(),Promise.resolve()}L(){}ca(){let e;if(this.g.ca(t=>{e=i1(t)}),!e)throw Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.g.attachErrorListener((r,n)=>{this.H.push(Error(n))}),this.g.Ja(),this.g.setGraph(e,t),this.B=void 0,wi(this)}finishProcessing(){this.g.finishProcessing(),wi(this)}close(){this.B=void 0,this.g.closeGraph()}};function Xe(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}Sn.prototype.close=Sn.prototype.close;class F1{constructor(t,r,n,s){this.g=t,this.h=r,this.m=n,this.l=s}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}}function Ei(e,t,r){const n=e.g;if(r=Xe(n.createShader(r),"Failed to create WebGL shader"),n.shaderSource(r,t),n.compileShader(r),!n.getShaderParameter(r,n.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${n.getShaderInfoLog(r)}`);return n.attachShader(e.h,r),r}function Ai(e,t){const r=e.g,n=Xe(r.createVertexArray(),"Failed to create vertex array");r.bindVertexArray(n);const s=Xe(r.createBuffer(),"Failed to create buffer");r.bindBuffer(r.ARRAY_BUFFER,s),r.enableVertexAttribArray(e.O),r.vertexAttribPointer(e.O,2,r.FLOAT,!1,0,0),r.bufferData(r.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),r.STATIC_DRAW);const i=Xe(r.createBuffer(),"Failed to create buffer");return r.bindBuffer(r.ARRAY_BUFFER,i),r.enableVertexAttribArray(e.L),r.vertexAttribPointer(e.L,2,r.FLOAT,!1,0,0),r.bufferData(r.ARRAY_BUFFER,new Float32Array(t?[0,1,0,0,1,0,1,1]:[0,0,0,1,1,1,1,0]),r.STATIC_DRAW),r.bindBuffer(r.ARRAY_BUFFER,null),r.bindVertexArray(null),new F1(r,n,s,i)}function vs(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function R1(e,t,r,n){return vs(e,t),e.h||(e.m(),e.D()),r?(e.u||(e.u=Ai(e,!0)),r=e.u):(e.A||(e.A=Ai(e,!1)),r=e.A),t.useProgram(e.h),r.bind(),e.l(),e=n(),r.g.bindVertexArray(null),e}function Pa(e,t,r){return vs(e,t),e=Xe(t.createTexture(),"Failed to create texture"),t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,r??t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,r??t.LINEAR),t.bindTexture(t.TEXTURE_2D,null),e}function Ma(e,t,r){vs(e,t),e.B||(e.B=Xe(t.createFramebuffer(),"Failed to create framebuffe.")),t.bindFramebuffer(t.FRAMEBUFFER,e.B),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0)}function N1(e){var t;(t=e.g)==null||t.bindFramebuffer(e.g.FRAMEBUFFER,null)}var Ia=class{H(){return`
2
+ precision mediump float;
3
+ varying vec2 vTex;
4
+ uniform sampler2D inputTexture;
5
+ void main() {
6
+ gl_FragColor = texture2D(inputTexture, vTex);
7
+ }
8
+ `}m(){const e=this.g;if(this.h=Xe(e.createProgram(),"Failed to create WebGL program"),this.X=Ei(this,`
9
+ attribute vec2 aVertex;
10
+ attribute vec2 aTex;
11
+ varying vec2 vTex;
12
+ void main(void) {
13
+ gl_Position = vec4(aVertex, 0.0, 1.0);
14
+ vTex = aTex;
15
+ }`,e.VERTEX_SHADER),this.W=Ei(this,this.H(),e.FRAGMENT_SHADER),e.linkProgram(this.h),!e.getProgramParameter(this.h,e.LINK_STATUS))throw Error(`Error during program linking: ${e.getProgramInfoLog(this.h)}`);this.O=e.getAttribLocation(this.h,"aVertex"),this.L=e.getAttribLocation(this.h,"aTex")}D(){}l(){}close(){if(this.h){const e=this.g;e.deleteProgram(this.h),e.deleteShader(this.X),e.deleteShader(this.W)}this.B&&this.g.deleteFramebuffer(this.B),this.A&&this.A.close(),this.u&&this.u.close()}};function De(e,t){switch(t){case 0:return e.g.find(r=>r instanceof Uint8Array);case 1:return e.g.find(r=>r instanceof Float32Array);case 2:return e.g.find(r=>typeof WebGLTexture<"u"&&r instanceof WebGLTexture);default:throw Error(`Type is not supported: ${t}`)}}function Tn(e){var t=De(e,1);if(!t){if(t=De(e,0))t=new Float32Array(t).map(n=>n/255);else{t=new Float32Array(e.width*e.height);const n=xt(e);var r=bs(e);if(Ma(r,n,xa(e)),"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";").includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"document"in self&&"ontouchend"in self.document){r=new Float32Array(e.width*e.height*4),n.readPixels(0,0,e.width,e.height,n.RGBA,n.FLOAT,r);for(let s=0,i=0;s<t.length;++s,i+=4)t[s]=r[i]}else n.readPixels(0,0,e.width,e.height,n.RED,n.FLOAT,t)}e.g.push(t)}return t}function xa(e){let t=De(e,2);if(!t){const r=xt(e);t=Fa(e);const n=Tn(e),s=Oa(e);r.texImage2D(r.TEXTURE_2D,0,s,e.width,e.height,0,r.RED,r.FLOAT,n),Ln(e)}return t}function xt(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return e.h||(e.h=Xe(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Oa(e){if(e=xt(e),!yr)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))yr=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");yr=e.R16F}return yr}function bs(e){return e.l||(e.l=new Ia),e.l}function Fa(e){const t=xt(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=De(e,2);return r||(r=Pa(bs(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(r),e.j=!0),t.bindTexture(t.TEXTURE_2D,r),r}function Ln(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var yr,Y=class{constructor(e,t,r,n,s,i,o){this.g=e,this.m=t,this.j=r,this.canvas=n,this.l=s,this.width=i,this.height=o,this.j&&--ki===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Fa(){return!!De(this,0)}ka(){return!!De(this,1)}R(){return!!De(this,2)}ja(){return(t=De(e=this,0))||(t=Tn(e),t=new Uint8Array(t.map(r=>Math.round(255*r))),e.g.push(t)),t;var e,t}ia(){return Tn(this)}N(){return xa(this)}clone(){const e=[];for(const t of this.g){let r;if(t instanceof Uint8Array)r=new Uint8Array(t);else if(t instanceof Float32Array)r=new Float32Array(t);else{if(!(t instanceof WebGLTexture))throw Error(`Type is not supported: ${t}`);{const n=xt(this),s=bs(this);n.activeTexture(n.TEXTURE1),r=Pa(s,n,this.m?n.LINEAR:n.NEAREST),n.bindTexture(n.TEXTURE_2D,r);const i=Oa(this);n.texImage2D(n.TEXTURE_2D,0,i,this.width,this.height,0,n.RED,n.FLOAT,null),n.bindTexture(n.TEXTURE_2D,null),Ma(s,n,r),R1(s,n,!1,()=>{Fa(this),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLE_FAN,0,4),Ln(this)}),N1(s),Ln(this)}}e.push(r)}return new Y(e,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&xt(this).deleteTexture(De(this,2)),ki=-1}};Y.prototype.close=Y.prototype.close,Y.prototype.clone=Y.prototype.clone,Y.prototype.getAsWebGLTexture=Y.prototype.N,Y.prototype.getAsFloat32Array=Y.prototype.ia,Y.prototype.getAsUint8Array=Y.prototype.ja,Y.prototype.hasWebGLTexture=Y.prototype.R,Y.prototype.hasFloat32Array=Y.prototype.ka,Y.prototype.hasUint8Array=Y.prototype.Fa;var ki=250;function Se(...e){return e.map(([t,r])=>({start:t,end:r}))}const C1=function(e){return class extends e{Ja(){this.i._registerModelResourcesGraphService()}}}((Si=class{constructor(e,t){this.l=!0,this.i=e,this.g=null,this.h=0,this.m=typeof this.i._addIntToInputStream=="function",t!==void 0?this.i.canvas=t:Ta()?this.i.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.i.canvas=document.createElement("canvas"))}async initializeGraph(e){const t=await(await fetch(e)).arrayBuffer();e=!(e.endsWith(".pbtxt")||e.endsWith(".textproto")),this.setGraph(new Uint8Array(t),e)}setGraphFromString(e){this.setGraph(new TextEncoder().encode(e),!1)}setGraph(e,t){const r=e.length,n=this.i._malloc(r);this.i.HEAPU8.set(e,n),t?this.i._changeBinaryGraph(r,n):this.i._changeTextGraph(r,n),this.i._free(n)}configureAudio(e,t,r,n,s){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),m(this,n||"input_audio",i=>{m(this,s=s||"audio_header",o=>{this.i._configureAudio(i,o,e,t??0,r)})})}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}ca(e){Pe(this,"__graph_config__",t=>{e(t)}),m(this,"__graph_config__",t=>{this.i._getGraphConfig(t,void 0)}),delete this.i.simpleListeners.__graph_config__}attachErrorListener(e){this.i.errorListener=e}attachEmptyPacketListener(e,t){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[e]=t}addAudioToStream(e,t,r){this.addAudioToStreamWithShape(e,0,0,t,r)}addAudioToStreamWithShape(e,t,r,n,s){const i=4*e.length;this.h!==i&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(i),this.h=i),this.i.HEAPF32.set(e,this.g/4),m(this,n,o=>{this.i._addAudioToInputStream(this.g,t,r,o,s)})}addGpuBufferToStream(e,t,r){m(this,t,n=>{const[s,i]=vi(this,e,n);this.i._addBoundTextureToStream(n,s,i,r)})}addBoolToStream(e,t,r){m(this,t,n=>{this.i._addBoolToInputStream(e,n,r)})}addDoubleToStream(e,t,r){m(this,t,n=>{this.i._addDoubleToInputStream(e,n,r)})}addFloatToStream(e,t,r){m(this,t,n=>{this.i._addFloatToInputStream(e,n,r)})}addIntToStream(e,t,r){m(this,t,n=>{this.i._addIntToInputStream(e,n,r)})}addUintToStream(e,t,r){m(this,t,n=>{this.i._addUintToInputStream(e,n,r)})}addStringToStream(e,t,r){m(this,t,n=>{m(this,e,s=>{this.i._addStringToInputStream(s,n,r)})})}addStringRecordToStream(e,t,r){m(this,t,n=>{bi(this,Object.keys(e),s=>{bi(this,Object.values(e),i=>{this.i._addFlatHashMapToInputStream(s,i,Object.keys(e).length,n,r)})})})}addProtoToStream(e,t,r,n){m(this,r,s=>{m(this,t,i=>{const o=this.i._malloc(e.length);this.i.HEAPU8.set(e,o),this.i._addProtoToInputStream(o,e.length,i,s,n),this.i._free(o)})})}addEmptyPacketToStream(e,t){m(this,e,r=>{this.i._addEmptyPacketToInputStream(r,t)})}addBoolVectorToStream(e,t,r){m(this,t,n=>{const s=this.i._allocateBoolVector(e.length);if(!s)throw Error("Unable to allocate new bool vector on heap.");for(const i of e)this.i._addBoolVectorEntry(s,i);this.i._addBoolVectorToInputStream(s,n,r)})}addDoubleVectorToStream(e,t,r){m(this,t,n=>{const s=this.i._allocateDoubleVector(e.length);if(!s)throw Error("Unable to allocate new double vector on heap.");for(const i of e)this.i._addDoubleVectorEntry(s,i);this.i._addDoubleVectorToInputStream(s,n,r)})}addFloatVectorToStream(e,t,r){m(this,t,n=>{const s=this.i._allocateFloatVector(e.length);if(!s)throw Error("Unable to allocate new float vector on heap.");for(const i of e)this.i._addFloatVectorEntry(s,i);this.i._addFloatVectorToInputStream(s,n,r)})}addIntVectorToStream(e,t,r){m(this,t,n=>{const s=this.i._allocateIntVector(e.length);if(!s)throw Error("Unable to allocate new int vector on heap.");for(const i of e)this.i._addIntVectorEntry(s,i);this.i._addIntVectorToInputStream(s,n,r)})}addUintVectorToStream(e,t,r){m(this,t,n=>{const s=this.i._allocateUintVector(e.length);if(!s)throw Error("Unable to allocate new unsigned int vector on heap.");for(const i of e)this.i._addUintVectorEntry(s,i);this.i._addUintVectorToInputStream(s,n,r)})}addStringVectorToStream(e,t,r){m(this,t,n=>{const s=this.i._allocateStringVector(e.length);if(!s)throw Error("Unable to allocate new string vector on heap.");for(const i of e)m(this,i,o=>{this.i._addStringVectorEntry(s,o)});this.i._addStringVectorToInputStream(s,n,r)})}addBoolToInputSidePacket(e,t){m(this,t,r=>{this.i._addBoolToInputSidePacket(e,r)})}addDoubleToInputSidePacket(e,t){m(this,t,r=>{this.i._addDoubleToInputSidePacket(e,r)})}addFloatToInputSidePacket(e,t){m(this,t,r=>{this.i._addFloatToInputSidePacket(e,r)})}addIntToInputSidePacket(e,t){m(this,t,r=>{this.i._addIntToInputSidePacket(e,r)})}addUintToInputSidePacket(e,t){m(this,t,r=>{this.i._addUintToInputSidePacket(e,r)})}addStringToInputSidePacket(e,t){m(this,t,r=>{m(this,e,n=>{this.i._addStringToInputSidePacket(n,r)})})}addProtoToInputSidePacket(e,t,r){m(this,r,n=>{m(this,t,s=>{const i=this.i._malloc(e.length);this.i.HEAPU8.set(e,i),this.i._addProtoToInputSidePacket(i,e.length,s,n),this.i._free(i)})})}addBoolVectorToInputSidePacket(e,t){m(this,t,r=>{const n=this.i._allocateBoolVector(e.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(const s of e)this.i._addBoolVectorEntry(n,s);this.i._addBoolVectorToInputSidePacket(n,r)})}addDoubleVectorToInputSidePacket(e,t){m(this,t,r=>{const n=this.i._allocateDoubleVector(e.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(const s of e)this.i._addDoubleVectorEntry(n,s);this.i._addDoubleVectorToInputSidePacket(n,r)})}addFloatVectorToInputSidePacket(e,t){m(this,t,r=>{const n=this.i._allocateFloatVector(e.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(const s of e)this.i._addFloatVectorEntry(n,s);this.i._addFloatVectorToInputSidePacket(n,r)})}addIntVectorToInputSidePacket(e,t){m(this,t,r=>{const n=this.i._allocateIntVector(e.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(const s of e)this.i._addIntVectorEntry(n,s);this.i._addIntVectorToInputSidePacket(n,r)})}addUintVectorToInputSidePacket(e,t){m(this,t,r=>{const n=this.i._allocateUintVector(e.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(const s of e)this.i._addUintVectorEntry(n,s);this.i._addUintVectorToInputSidePacket(n,r)})}addStringVectorToInputSidePacket(e,t){m(this,t,r=>{const n=this.i._allocateStringVector(e.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(const s of e)m(this,s,i=>{this.i._addStringVectorEntry(n,i)});this.i._addStringVectorToInputSidePacket(n,r)})}attachBoolListener(e,t){Pe(this,e,t),m(this,e,r=>{this.i._attachBoolListener(r)})}attachBoolVectorListener(e,t){qe(this,e,t),m(this,e,r=>{this.i._attachBoolVectorListener(r)})}attachIntListener(e,t){Pe(this,e,t),m(this,e,r=>{this.i._attachIntListener(r)})}attachIntVectorListener(e,t){qe(this,e,t),m(this,e,r=>{this.i._attachIntVectorListener(r)})}attachUintListener(e,t){Pe(this,e,t),m(this,e,r=>{this.i._attachUintListener(r)})}attachUintVectorListener(e,t){qe(this,e,t),m(this,e,r=>{this.i._attachUintVectorListener(r)})}attachDoubleListener(e,t){Pe(this,e,t),m(this,e,r=>{this.i._attachDoubleListener(r)})}attachDoubleVectorListener(e,t){qe(this,e,t),m(this,e,r=>{this.i._attachDoubleVectorListener(r)})}attachFloatListener(e,t){Pe(this,e,t),m(this,e,r=>{this.i._attachFloatListener(r)})}attachFloatVectorListener(e,t){qe(this,e,t),m(this,e,r=>{this.i._attachFloatVectorListener(r)})}attachStringListener(e,t){Pe(this,e,t),m(this,e,r=>{this.i._attachStringListener(r)})}attachStringVectorListener(e,t){qe(this,e,t),m(this,e,r=>{this.i._attachStringVectorListener(r)})}attachProtoListener(e,t,r){Pe(this,e,t),m(this,e,n=>{this.i._attachProtoListener(n,r||!1)})}attachProtoVectorListener(e,t,r){qe(this,e,t),m(this,e,n=>{this.i._attachProtoVectorListener(n,r||!1)})}attachAudioListener(e,t,r){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),Pe(this,e,(n,s)=>{n=new Float32Array(n.buffer,n.byteOffset,n.length/4),t(n,s)}),m(this,e,n=>{this.i._attachAudioListener(n,r||!1)})}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends Si{get ga(){return this.i}pa(e,t,r){m(this,t,n=>{const[s,i]=vi(this,e,n);this.ga._addBoundTextureAsImageToStream(n,s,i,r)})}Z(e,t){Pe(this,e,t),m(this,e,r=>{this.ga._attachImageListener(r)})}aa(e,t){qe(this,e,t),m(this,e,r=>{this.ga._attachImageVectorListener(r)})}}));var Si,Te=class extends C1{};async function A(e,t,r){return async function(n,s,i,o){return O1(n,s,i,o)}(e,r.canvas??(Ta()?void 0:document.createElement("canvas")),t,r)}function Ra(e,t,r,n){if(e.U){const i=new ta;if(r!=null&&r.regionOfInterest){if(!e.oa)throw Error("This task doesn't support region-of-interest.");var s=r.regionOfInterest;if(s.left>=s.right||s.top>=s.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(s.left<0||s.top<0||s.right>1||s.bottom>1)throw Error("Expected RectF values to be in [0,1].");y(i,1,(s.left+s.right)/2),y(i,2,(s.top+s.bottom)/2),y(i,4,s.right-s.left),y(i,3,s.bottom-s.top)}else y(i,1,.5),y(i,2,.5),y(i,4,1),y(i,3,1);if(r!=null&&r.rotationDegrees){if((r==null?void 0:r.rotationDegrees)%90!=0)throw Error("Expected rotation to be a multiple of 90°.");if(y(i,5,-Math.PI*r.rotationDegrees/180),(r==null?void 0:r.rotationDegrees)%180!=0){const[o,a]=La(t);r=B(i,3)*a/o,s=B(i,4)*o/a,y(i,4,r),y(i,3,s)}}e.g.addProtoToStream(i.g(),"mediapipe.NormalizedRect",e.U,n)}e.g.pa(t,e.X,n??performance.now()),e.finishProcessing()}function Le(e,t,r){var n;if((n=e.baseOptions)!=null&&n.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");Ra(e,t,r,e.C+1)}function Ce(e,t,r,n){var s;if(!((s=e.baseOptions)!=null&&s.g()))throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");Ra(e,t,r,n)}function Ot(e,t,r,n){var s=t.data;const i=t.width,o=i*(t=t.height);if((s instanceof Uint8Array||s instanceof Float32Array)&&s.length!==o)throw Error("Unsupported channel count: "+s.length/o);return e=new Y([s],r,!1,e.g.i.canvas,e.P,i,t),n?e.clone():e}var pe=class extends Sn{constructor(e,t,r,n){super(e),this.g=e,this.X=t,this.U=r,this.oa=n,this.P=new Ia}l(e,t=!0){if("runningMode"in e&&T(this.baseOptions,2,nr(!!e.runningMode&&e.runningMode!=="IMAGE")),e.canvas!==void 0&&this.g.i.canvas!==e.canvas)throw Error("You must create a new task to reset the canvas.");return super.l(e,t)}close(){this.P.close(),super.close()}};pe.prototype.close=pe.prototype.close;var ye=class extends pe{constructor(e,t){super(new Te(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},v(e=this.h=new zr,0,1,t=new C),y(this.h,2,.5),y(this.h,3,.3)}get baseOptions(){return k(this.h,C,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){return"minDetectionConfidence"in e&&y(this.h,2,e.minDetectionConfidence??.5),"minSuppressionThreshold"in e&&y(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}F(e,t){return this.j={detections:[]},Le(this,e,t),this.j}G(e,t,r){return this.j={detections:[]},Ce(this,e,r,t),this.j}m(){var e=new me;R(e,"image_in"),R(e,"norm_rect_in"),S(e,"detections");const t=new ge;Re(t,y1,this.h);const r=new se;fe(r,2,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),x(r,"IMAGE:image_in"),x(r,"NORM_RECT:norm_rect_in"),E(r,"DETECTIONS:detections"),r.o(t),Ae(e,r),this.g.attachProtoVectorListener("detections",(n,s)=>{for(const i of n)n=Qo(i),this.j.detections.push(ka(n));d(this,s)}),this.g.attachEmptyPacketListener("detections",n=>{d(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ye.prototype.detectForVideo=ye.prototype.G,ye.prototype.detect=ye.prototype.F,ye.prototype.setOptions=ye.prototype.o,ye.createFromModelPath=async function(e,t){return A(ye,e,{baseOptions:{modelAssetPath:t}})},ye.createFromModelBuffer=function(e,t){return A(ye,e,{baseOptions:{modelAssetBuffer:t}})},ye.createFromOptions=function(e,t){return A(ye,e,t)};var ws=Se([61,146],[146,91],[91,181],[181,84],[84,17],[17,314],[314,405],[405,321],[321,375],[375,291],[61,185],[185,40],[40,39],[39,37],[37,0],[0,267],[267,269],[269,270],[270,409],[409,291],[78,95],[95,88],[88,178],[178,87],[87,14],[14,317],[317,402],[402,318],[318,324],[324,308],[78,191],[191,80],[80,81],[81,82],[82,13],[13,312],[312,311],[311,310],[310,415],[415,308]),Es=Se([263,249],[249,390],[390,373],[373,374],[374,380],[380,381],[381,382],[382,362],[263,466],[466,388],[388,387],[387,386],[386,385],[385,384],[384,398],[398,362]),As=Se([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),Na=Se([474,475],[475,476],[476,477],[477,474]),ks=Se([33,7],[7,163],[163,144],[144,145],[145,153],[153,154],[154,155],[155,133],[33,246],[246,161],[161,160],[160,159],[159,158],[158,157],[157,173],[173,133]),Ss=Se([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),Ca=Se([469,470],[470,471],[471,472],[472,469]),Ts=Se([10,338],[338,297],[297,332],[332,284],[284,251],[251,389],[389,356],[356,454],[454,323],[323,361],[361,288],[288,397],[397,365],[365,379],[379,378],[378,400],[400,377],[377,152],[152,148],[148,176],[176,149],[149,150],[150,136],[136,172],[172,58],[58,132],[132,93],[93,234],[234,127],[127,162],[162,21],[21,54],[54,103],[103,67],[67,109],[109,10]),Da=[...ws,...Es,...As,...ks,...Ss,...Ts],Ba=Se([127,34],[34,139],[139,127],[11,0],[0,37],[37,11],[232,231],[231,120],[120,232],[72,37],[37,39],[39,72],[128,121],[121,47],[47,128],[232,121],[121,128],[128,232],[104,69],[69,67],[67,104],[175,171],[171,148],[148,175],[118,50],[50,101],[101,118],[73,39],[39,40],[40,73],[9,151],[151,108],[108,9],[48,115],[115,131],[131,48],[194,204],[204,211],[211,194],[74,40],[40,185],[185,74],[80,42],[42,183],[183,80],[40,92],[92,186],[186,40],[230,229],[229,118],[118,230],[202,212],[212,214],[214,202],[83,18],[18,17],[17,83],[76,61],[61,146],[146,76],[160,29],[29,30],[30,160],[56,157],[157,173],[173,56],[106,204],[204,194],[194,106],[135,214],[214,192],[192,135],[203,165],[165,98],[98,203],[21,71],[71,68],[68,21],[51,45],[45,4],[4,51],[144,24],[24,23],[23,144],[77,146],[146,91],[91,77],[205,50],[50,187],[187,205],[201,200],[200,18],[18,201],[91,106],[106,182],[182,91],[90,91],[91,181],[181,90],[85,84],[84,17],[17,85],[206,203],[203,36],[36,206],[148,171],[171,140],[140,148],[92,40],[40,39],[39,92],[193,189],[189,244],[244,193],[159,158],[158,28],[28,159],[247,246],[246,161],[161,247],[236,3],[3,196],[196,236],[54,68],[68,104],[104,54],[193,168],[168,8],[8,193],[117,228],[228,31],[31,117],[189,193],[193,55],[55,189],[98,97],[97,99],[99,98],[126,47],[47,100],[100,126],[166,79],[79,218],[218,166],[155,154],[154,26],[26,155],[209,49],[49,131],[131,209],[135,136],[136,150],[150,135],[47,126],[126,217],[217,47],[223,52],[52,53],[53,223],[45,51],[51,134],[134,45],[211,170],[170,140],[140,211],[67,69],[69,108],[108,67],[43,106],[106,91],[91,43],[230,119],[119,120],[120,230],[226,130],[130,247],[247,226],[63,53],[53,52],[52,63],[238,20],[20,242],[242,238],[46,70],[70,156],[156,46],[78,62],[62,96],[96,78],[46,53],[53,63],[63,46],[143,34],[34,227],[227,143],[123,117],[117,111],[111,123],[44,125],[125,19],[19,44],[236,134],[134,51],[51,236],[216,206],[206,205],[205,216],[154,153],[153,22],[22,154],[39,37],[37,167],[167,39],[200,201],[201,208],[208,200],[36,142],[142,100],[100,36],[57,212],[212,202],[202,57],[20,60],[60,99],[99,20],[28,158],[158,157],[157,28],[35,226],[226,113],[113,35],[160,159],[159,27],[27,160],[204,202],[202,210],[210,204],[113,225],[225,46],[46,113],[43,202],[202,204],[204,43],[62,76],[76,77],[77,62],[137,123],[123,116],[116,137],[41,38],[38,72],[72,41],[203,129],[129,142],[142,203],[64,98],[98,240],[240,64],[49,102],[102,64],[64,49],[41,73],[73,74],[74,41],[212,216],[216,207],[207,212],[42,74],[74,184],[184,42],[169,170],[170,211],[211,169],[170,149],[149,176],[176,170],[105,66],[66,69],[69,105],[122,6],[6,168],[168,122],[123,147],[147,187],[187,123],[96,77],[77,90],[90,96],[65,55],[55,107],[107,65],[89,90],[90,180],[180,89],[101,100],[100,120],[120,101],[63,105],[105,104],[104,63],[93,137],[137,227],[227,93],[15,86],[86,85],[85,15],[129,102],[102,49],[49,129],[14,87],[87,86],[86,14],[55,8],[8,9],[9,55],[100,47],[47,121],[121,100],[145,23],[23,22],[22,145],[88,89],[89,179],[179,88],[6,122],[122,196],[196,6],[88,95],[95,96],[96,88],[138,172],[172,136],[136,138],[215,58],[58,172],[172,215],[115,48],[48,219],[219,115],[42,80],[80,81],[81,42],[195,3],[3,51],[51,195],[43,146],[146,61],[61,43],[171,175],[175,199],[199,171],[81,82],[82,38],[38,81],[53,46],[46,225],[225,53],[144,163],[163,110],[110,144],[52,65],[65,66],[66,52],[229,228],[228,117],[117,229],[34,127],[127,234],[234,34],[107,108],[108,69],[69,107],[109,108],[108,151],[151,109],[48,64],[64,235],[235,48],[62,78],[78,191],[191,62],[129,209],[209,126],[126,129],[111,35],[35,143],[143,111],[117,123],[123,50],[50,117],[222,65],[65,52],[52,222],[19,125],[125,141],[141,19],[221,55],[55,65],[65,221],[3,195],[195,197],[197,3],[25,7],[7,33],[33,25],[220,237],[237,44],[44,220],[70,71],[71,139],[139,70],[122,193],[193,245],[245,122],[247,130],[130,33],[33,247],[71,21],[21,162],[162,71],[170,169],[169,150],[150,170],[188,174],[174,196],[196,188],[216,186],[186,92],[92,216],[2,97],[97,167],[167,2],[141,125],[125,241],[241,141],[164,167],[167,37],[37,164],[72,38],[38,12],[12,72],[38,82],[82,13],[13,38],[63,68],[68,71],[71,63],[226,35],[35,111],[111,226],[101,50],[50,205],[205,101],[206,92],[92,165],[165,206],[209,198],[198,217],[217,209],[165,167],[167,97],[97,165],[220,115],[115,218],[218,220],[133,112],[112,243],[243,133],[239,238],[238,241],[241,239],[214,135],[135,169],[169,214],[190,173],[173,133],[133,190],[171,208],[208,32],[32,171],[125,44],[44,237],[237,125],[86,87],[87,178],[178,86],[85,86],[86,179],[179,85],[84,85],[85,180],[180,84],[83,84],[84,181],[181,83],[201,83],[83,182],[182,201],[137,93],[93,132],[132,137],[76,62],[62,183],[183,76],[61,76],[76,184],[184,61],[57,61],[61,185],[185,57],[212,57],[57,186],[186,212],[214,207],[207,187],[187,214],[34,143],[143,156],[156,34],[79,239],[239,237],[237,79],[123,137],[137,177],[177,123],[44,1],[1,4],[4,44],[201,194],[194,32],[32,201],[64,102],[102,129],[129,64],[213,215],[215,138],[138,213],[59,166],[166,219],[219,59],[242,99],[99,97],[97,242],[2,94],[94,141],[141,2],[75,59],[59,235],[235,75],[24,110],[110,228],[228,24],[25,130],[130,226],[226,25],[23,24],[24,229],[229,23],[22,23],[23,230],[230,22],[26,22],[22,231],[231,26],[112,26],[26,232],[232,112],[189,190],[190,243],[243,189],[221,56],[56,190],[190,221],[28,56],[56,221],[221,28],[27,28],[28,222],[222,27],[29,27],[27,223],[223,29],[30,29],[29,224],[224,30],[247,30],[30,225],[225,247],[238,79],[79,20],[20,238],[166,59],[59,75],[75,166],[60,75],[75,240],[240,60],[147,177],[177,215],[215,147],[20,79],[79,166],[166,20],[187,147],[147,213],[213,187],[112,233],[233,244],[244,112],[233,128],[128,245],[245,233],[128,114],[114,188],[188,128],[114,217],[217,174],[174,114],[131,115],[115,220],[220,131],[217,198],[198,236],[236,217],[198,131],[131,134],[134,198],[177,132],[132,58],[58,177],[143,35],[35,124],[124,143],[110,163],[163,7],[7,110],[228,110],[110,25],[25,228],[356,389],[389,368],[368,356],[11,302],[302,267],[267,11],[452,350],[350,349],[349,452],[302,303],[303,269],[269,302],[357,343],[343,277],[277,357],[452,453],[453,357],[357,452],[333,332],[332,297],[297,333],[175,152],[152,377],[377,175],[347,348],[348,330],[330,347],[303,304],[304,270],[270,303],[9,336],[336,337],[337,9],[278,279],[279,360],[360,278],[418,262],[262,431],[431,418],[304,408],[408,409],[409,304],[310,415],[415,407],[407,310],[270,409],[409,410],[410,270],[450,348],[348,347],[347,450],[422,430],[430,434],[434,422],[313,314],[314,17],[17,313],[306,307],[307,375],[375,306],[387,388],[388,260],[260,387],[286,414],[414,398],[398,286],[335,406],[406,418],[418,335],[364,367],[367,416],[416,364],[423,358],[358,327],[327,423],[251,284],[284,298],[298,251],[281,5],[5,4],[4,281],[373,374],[374,253],[253,373],[307,320],[320,321],[321,307],[425,427],[427,411],[411,425],[421,313],[313,18],[18,421],[321,405],[405,406],[406,321],[320,404],[404,405],[405,320],[315,16],[16,17],[17,315],[426,425],[425,266],[266,426],[377,400],[400,369],[369,377],[322,391],[391,269],[269,322],[417,465],[465,464],[464,417],[386,257],[257,258],[258,386],[466,260],[260,388],[388,466],[456,399],[399,419],[419,456],[284,332],[332,333],[333,284],[417,285],[285,8],[8,417],[346,340],[340,261],[261,346],[413,441],[441,285],[285,413],[327,460],[460,328],[328,327],[355,371],[371,329],[329,355],[392,439],[439,438],[438,392],[382,341],[341,256],[256,382],[429,420],[420,360],[360,429],[364,394],[394,379],[379,364],[277,343],[343,437],[437,277],[443,444],[444,283],[283,443],[275,440],[440,363],[363,275],[431,262],[262,369],[369,431],[297,338],[338,337],[337,297],[273,375],[375,321],[321,273],[450,451],[451,349],[349,450],[446,342],[342,467],[467,446],[293,334],[334,282],[282,293],[458,461],[461,462],[462,458],[276,353],[353,383],[383,276],[308,324],[324,325],[325,308],[276,300],[300,293],[293,276],[372,345],[345,447],[447,372],[352,345],[345,340],[340,352],[274,1],[1,19],[19,274],[456,248],[248,281],[281,456],[436,427],[427,425],[425,436],[381,256],[256,252],[252,381],[269,391],[391,393],[393,269],[200,199],[199,428],[428,200],[266,330],[330,329],[329,266],[287,273],[273,422],[422,287],[250,462],[462,328],[328,250],[258,286],[286,384],[384,258],[265,353],[353,342],[342,265],[387,259],[259,257],[257,387],[424,431],[431,430],[430,424],[342,353],[353,276],[276,342],[273,335],[335,424],[424,273],[292,325],[325,307],[307,292],[366,447],[447,345],[345,366],[271,303],[303,302],[302,271],[423,266],[266,371],[371,423],[294,455],[455,460],[460,294],[279,278],[278,294],[294,279],[271,272],[272,304],[304,271],[432,434],[434,427],[427,432],[272,407],[407,408],[408,272],[394,430],[430,431],[431,394],[395,369],[369,400],[400,395],[334,333],[333,299],[299,334],[351,417],[417,168],[168,351],[352,280],[280,411],[411,352],[325,319],[319,320],[320,325],[295,296],[296,336],[336,295],[319,403],[403,404],[404,319],[330,348],[348,349],[349,330],[293,298],[298,333],[333,293],[323,454],[454,447],[447,323],[15,16],[16,315],[315,15],[358,429],[429,279],[279,358],[14,15],[15,316],[316,14],[285,336],[336,9],[9,285],[329,349],[349,350],[350,329],[374,380],[380,252],[252,374],[318,402],[402,403],[403,318],[6,197],[197,419],[419,6],[318,319],[319,325],[325,318],[367,364],[364,365],[365,367],[435,367],[367,397],[397,435],[344,438],[438,439],[439,344],[272,271],[271,311],[311,272],[195,5],[5,281],[281,195],[273,287],[287,291],[291,273],[396,428],[428,199],[199,396],[311,271],[271,268],[268,311],[283,444],[444,445],[445,283],[373,254],[254,339],[339,373],[282,334],[334,296],[296,282],[449,347],[347,346],[346,449],[264,447],[447,454],[454,264],[336,296],[296,299],[299,336],[338,10],[10,151],[151,338],[278,439],[439,455],[455,278],[292,407],[407,415],[415,292],[358,371],[371,355],[355,358],[340,345],[345,372],[372,340],[346,347],[347,280],[280,346],[442,443],[443,282],[282,442],[19,94],[94,370],[370,19],[441,442],[442,295],[295,441],[248,419],[419,197],[197,248],[263,255],[255,359],[359,263],[440,275],[275,274],[274,440],[300,383],[383,368],[368,300],[351,412],[412,465],[465,351],[263,467],[467,466],[466,263],[301,368],[368,389],[389,301],[395,378],[378,379],[379,395],[412,351],[351,419],[419,412],[436,426],[426,322],[322,436],[2,164],[164,393],[393,2],[370,462],[462,461],[461,370],[164,0],[0,267],[267,164],[302,11],[11,12],[12,302],[268,12],[12,13],[13,268],[293,300],[300,301],[301,293],[446,261],[261,340],[340,446],[330,266],[266,425],[425,330],[426,423],[423,391],[391,426],[429,355],[355,437],[437,429],[391,327],[327,326],[326,391],[440,457],[457,438],[438,440],[341,382],[382,362],[362,341],[459,457],[457,461],[461,459],[434,430],[430,394],[394,434],[414,463],[463,362],[362,414],[396,369],[369,262],[262,396],[354,461],[461,457],[457,354],[316,403],[403,402],[402,316],[315,404],[404,403],[403,315],[314,405],[405,404],[404,314],[313,406],[406,405],[405,313],[421,418],[418,406],[406,421],[366,401],[401,361],[361,366],[306,408],[408,407],[407,306],[291,409],[409,408],[408,291],[287,410],[410,409],[409,287],[432,436],[436,410],[410,432],[434,416],[416,411],[411,434],[264,368],[368,383],[383,264],[309,438],[438,457],[457,309],[352,376],[376,401],[401,352],[274,275],[275,4],[4,274],[421,428],[428,262],[262,421],[294,327],[327,358],[358,294],[433,416],[416,367],[367,433],[289,455],[455,439],[439,289],[462,370],[370,326],[326,462],[2,326],[326,370],[370,2],[305,460],[460,455],[455,305],[254,449],[449,448],[448,254],[255,261],[261,446],[446,255],[253,450],[450,449],[449,253],[252,451],[451,450],[450,252],[256,452],[452,451],[451,256],[341,453],[453,452],[452,341],[413,464],[464,463],[463,413],[441,413],[413,414],[414,441],[258,442],[442,441],[441,258],[257,443],[443,442],[442,257],[259,444],[444,443],[443,259],[260,445],[445,444],[444,260],[467,342],[342,445],[445,467],[459,458],[458,250],[250,459],[289,392],[392,290],[290,289],[290,328],[328,460],[460,290],[376,433],[433,435],[435,376],[250,290],[290,392],[392,250],[411,416],[416,433],[433,411],[341,463],[463,464],[464,341],[453,464],[464,465],[465,453],[357,465],[465,412],[412,357],[343,412],[412,399],[399,343],[360,363],[363,440],[440,360],[437,399],[399,456],[456,437],[420,456],[456,363],[363,420],[401,435],[435,288],[288,401],[372,383],[383,353],[353,372],[339,255],[255,249],[249,339],[448,261],[261,255],[255,448],[133,243],[243,190],[190,133],[133,155],[155,112],[112,133],[33,246],[246,247],[247,33],[33,130],[130,25],[25,33],[398,384],[384,286],[286,398],[362,398],[398,414],[414,362],[362,463],[463,341],[341,362],[263,359],[359,467],[467,263],[263,249],[249,255],[255,263],[466,467],[467,260],[260,466],[75,60],[60,166],[166,75],[238,239],[239,79],[79,238],[162,127],[127,139],[139,162],[72,11],[11,37],[37,72],[121,232],[232,120],[120,121],[73,72],[72,39],[39,73],[114,128],[128,47],[47,114],[233,232],[232,128],[128,233],[103,104],[104,67],[67,103],[152,175],[175,148],[148,152],[119,118],[118,101],[101,119],[74,73],[73,40],[40,74],[107,9],[9,108],[108,107],[49,48],[48,131],[131,49],[32,194],[194,211],[211,32],[184,74],[74,185],[185,184],[191,80],[80,183],[183,191],[185,40],[40,186],[186,185],[119,230],[230,118],[118,119],[210,202],[202,214],[214,210],[84,83],[83,17],[17,84],[77,76],[76,146],[146,77],[161,160],[160,30],[30,161],[190,56],[56,173],[173,190],[182,106],[106,194],[194,182],[138,135],[135,192],[192,138],[129,203],[203,98],[98,129],[54,21],[21,68],[68,54],[5,51],[51,4],[4,5],[145,144],[144,23],[23,145],[90,77],[77,91],[91,90],[207,205],[205,187],[187,207],[83,201],[201,18],[18,83],[181,91],[91,182],[182,181],[180,90],[90,181],[181,180],[16,85],[85,17],[17,16],[205,206],[206,36],[36,205],[176,148],[148,140],[140,176],[165,92],[92,39],[39,165],[245,193],[193,244],[244,245],[27,159],[159,28],[28,27],[30,247],[247,161],[161,30],[174,236],[236,196],[196,174],[103,54],[54,104],[104,103],[55,193],[193,8],[8,55],[111,117],[117,31],[31,111],[221,189],[189,55],[55,221],[240,98],[98,99],[99,240],[142,126],[126,100],[100,142],[219,166],[166,218],[218,219],[112,155],[155,26],[26,112],[198,209],[209,131],[131,198],[169,135],[135,150],[150,169],[114,47],[47,217],[217,114],[224,223],[223,53],[53,224],[220,45],[45,134],[134,220],[32,211],[211,140],[140,32],[109,67],[67,108],[108,109],[146,43],[43,91],[91,146],[231,230],[230,120],[120,231],[113,226],[226,247],[247,113],[105,63],[63,52],[52,105],[241,238],[238,242],[242,241],[124,46],[46,156],[156,124],[95,78],[78,96],[96,95],[70,46],[46,63],[63,70],[116,143],[143,227],[227,116],[116,123],[123,111],[111,116],[1,44],[44,19],[19,1],[3,236],[236,51],[51,3],[207,216],[216,205],[205,207],[26,154],[154,22],[22,26],[165,39],[39,167],[167,165],[199,200],[200,208],[208,199],[101,36],[36,100],[100,101],[43,57],[57,202],[202,43],[242,20],[20,99],[99,242],[56,28],[28,157],[157,56],[124,35],[35,113],[113,124],[29,160],[160,27],[27,29],[211,204],[204,210],[210,211],[124,113],[113,46],[46,124],[106,43],[43,204],[204,106],[96,62],[62,77],[77,96],[227,137],[137,116],[116,227],[73,41],[41,72],[72,73],[36,203],[203,142],[142,36],[235,64],[64,240],[240,235],[48,49],[49,64],[64,48],[42,41],[41,74],[74,42],[214,212],[212,207],[207,214],[183,42],[42,184],[184,183],[210,169],[169,211],[211,210],[140,170],[170,176],[176,140],[104,105],[105,69],[69,104],[193,122],[122,168],[168,193],[50,123],[123,187],[187,50],[89,96],[96,90],[90,89],[66,65],[65,107],[107,66],[179,89],[89,180],[180,179],[119,101],[101,120],[120,119],[68,63],[63,104],[104,68],[234,93],[93,227],[227,234],[16,15],[15,85],[85,16],[209,129],[129,49],[49,209],[15,14],[14,86],[86,15],[107,55],[55,9],[9,107],[120,100],[100,121],[121,120],[153,145],[145,22],[22,153],[178,88],[88,179],[179,178],[197,6],[6,196],[196,197],[89,88],[88,96],[96,89],[135,138],[138,136],[136,135],[138,215],[215,172],[172,138],[218,115],[115,219],[219,218],[41,42],[42,81],[81,41],[5,195],[195,51],[51,5],[57,43],[43,61],[61,57],[208,171],[171,199],[199,208],[41,81],[81,38],[38,41],[224,53],[53,225],[225,224],[24,144],[144,110],[110,24],[105,52],[52,66],[66,105],[118,229],[229,117],[117,118],[227,34],[34,234],[234,227],[66,107],[107,69],[69,66],[10,109],[109,151],[151,10],[219,48],[48,235],[235,219],[183,62],[62,191],[191,183],[142,129],[129,126],[126,142],[116,111],[111,143],[143,116],[118,117],[117,50],[50,118],[223,222],[222,52],[52,223],[94,19],[19,141],[141,94],[222,221],[221,65],[65,222],[196,3],[3,197],[197,196],[45,220],[220,44],[44,45],[156,70],[70,139],[139,156],[188,122],[122,245],[245,188],[139,71],[71,162],[162,139],[149,170],[170,150],[150,149],[122,188],[188,196],[196,122],[206,216],[216,92],[92,206],[164,2],[2,167],[167,164],[242,141],[141,241],[241,242],[0,164],[164,37],[37,0],[11,72],[72,12],[12,11],[12,38],[38,13],[13,12],[70,63],[63,71],[71,70],[31,226],[226,111],[111,31],[36,101],[101,205],[205,36],[203,206],[206,165],[165,203],[126,209],[209,217],[217,126],[98,165],[165,97],[97,98],[237,220],[220,218],[218,237],[237,239],[239,241],[241,237],[210,214],[214,169],[169,210],[140,171],[171,32],[32,140],[241,125],[125,237],[237,241],[179,86],[86,178],[178,179],[180,85],[85,179],[179,180],[181,84],[84,180],[180,181],[182,83],[83,181],[181,182],[194,201],[201,182],[182,194],[177,137],[137,132],[132,177],[184,76],[76,183],[183,184],[185,61],[61,184],[184,185],[186,57],[57,185],[185,186],[216,212],[212,186],[186,216],[192,214],[214,187],[187,192],[139,34],[34,156],[156,139],[218,79],[79,237],[237,218],[147,123],[123,177],[177,147],[45,44],[44,4],[4,45],[208,201],[201,32],[32,208],[98,64],[64,129],[129,98],[192,213],[213,138],[138,192],[235,59],[59,219],[219,235],[141,242],[242,97],[97,141],[97,2],[2,141],[141,97],[240,75],[75,235],[235,240],[229,24],[24,228],[228,229],[31,25],[25,226],[226,31],[230,23],[23,229],[229,230],[231,22],[22,230],[230,231],[232,26],[26,231],[231,232],[233,112],[112,232],[232,233],[244,189],[189,243],[243,244],[189,221],[221,190],[190,189],[222,28],[28,221],[221,222],[223,27],[27,222],[222,223],[224,29],[29,223],[223,224],[225,30],[30,224],[224,225],[113,247],[247,225],[225,113],[99,60],[60,240],[240,99],[213,147],[147,215],[215,213],[60,20],[20,166],[166,60],[192,187],[187,213],[213,192],[243,112],[112,244],[244,243],[244,233],[233,245],[245,244],[245,128],[128,188],[188,245],[188,114],[114,174],[174,188],[134,131],[131,220],[220,134],[174,217],[217,236],[236,174],[236,198],[198,134],[134,236],[215,177],[177,58],[58,215],[156,143],[143,124],[124,156],[25,110],[110,7],[7,25],[31,228],[228,25],[25,31],[264,356],[356,368],[368,264],[0,11],[11,267],[267,0],[451,452],[452,349],[349,451],[267,302],[302,269],[269,267],[350,357],[357,277],[277,350],[350,452],[452,357],[357,350],[299,333],[333,297],[297,299],[396,175],[175,377],[377,396],[280,347],[347,330],[330,280],[269,303],[303,270],[270,269],[151,9],[9,337],[337,151],[344,278],[278,360],[360,344],[424,418],[418,431],[431,424],[270,304],[304,409],[409,270],[272,310],[310,407],[407,272],[322,270],[270,410],[410,322],[449,450],[450,347],[347,449],[432,422],[422,434],[434,432],[18,313],[313,17],[17,18],[291,306],[306,375],[375,291],[259,387],[387,260],[260,259],[424,335],[335,418],[418,424],[434,364],[364,416],[416,434],[391,423],[423,327],[327,391],[301,251],[251,298],[298,301],[275,281],[281,4],[4,275],[254,373],[373,253],[253,254],[375,307],[307,321],[321,375],[280,425],[425,411],[411,280],[200,421],[421,18],[18,200],[335,321],[321,406],[406,335],[321,320],[320,405],[405,321],[314,315],[315,17],[17,314],[423,426],[426,266],[266,423],[396,377],[377,369],[369,396],[270,322],[322,269],[269,270],[413,417],[417,464],[464,413],[385,386],[386,258],[258,385],[248,456],[456,419],[419,248],[298,284],[284,333],[333,298],[168,417],[417,8],[8,168],[448,346],[346,261],[261,448],[417,413],[413,285],[285,417],[326,327],[327,328],[328,326],[277,355],[355,329],[329,277],[309,392],[392,438],[438,309],[381,382],[382,256],[256,381],[279,429],[429,360],[360,279],[365,364],[364,379],[379,365],[355,277],[277,437],[437,355],[282,443],[443,283],[283,282],[281,275],[275,363],[363,281],[395,431],[431,369],[369,395],[299,297],[297,337],[337,299],[335,273],[273,321],[321,335],[348,450],[450,349],[349,348],[359,446],[446,467],[467,359],[283,293],[293,282],[282,283],[250,458],[458,462],[462,250],[300,276],[276,383],[383,300],[292,308],[308,325],[325,292],[283,276],[276,293],[293,283],[264,372],[372,447],[447,264],[346,352],[352,340],[340,346],[354,274],[274,19],[19,354],[363,456],[456,281],[281,363],[426,436],[436,425],[425,426],[380,381],[381,252],[252,380],[267,269],[269,393],[393,267],[421,200],[200,428],[428,421],[371,266],[266,329],[329,371],[432,287],[287,422],[422,432],[290,250],[250,328],[328,290],[385,258],[258,384],[384,385],[446,265],[265,342],[342,446],[386,387],[387,257],[257,386],[422,424],[424,430],[430,422],[445,342],[342,276],[276,445],[422,273],[273,424],[424,422],[306,292],[292,307],[307,306],[352,366],[366,345],[345,352],[268,271],[271,302],[302,268],[358,423],[423,371],[371,358],[327,294],[294,460],[460,327],[331,279],[279,294],[294,331],[303,271],[271,304],[304,303],[436,432],[432,427],[427,436],[304,272],[272,408],[408,304],[395,394],[394,431],[431,395],[378,395],[395,400],[400,378],[296,334],[334,299],[299,296],[6,351],[351,168],[168,6],[376,352],[352,411],[411,376],[307,325],[325,320],[320,307],[285,295],[295,336],[336,285],[320,319],[319,404],[404,320],[329,330],[330,349],[349,329],[334,293],[293,333],[333,334],[366,323],[323,447],[447,366],[316,15],[15,315],[315,316],[331,358],[358,279],[279,331],[317,14],[14,316],[316,317],[8,285],[285,9],[9,8],[277,329],[329,350],[350,277],[253,374],[374,252],[252,253],[319,318],[318,403],[403,319],[351,6],[6,419],[419,351],[324,318],[318,325],[325,324],[397,367],[367,365],[365,397],[288,435],[435,397],[397,288],[278,344],[344,439],[439,278],[310,272],[272,311],[311,310],[248,195],[195,281],[281,248],[375,273],[273,291],[291,375],[175,396],[396,199],[199,175],[312,311],[311,268],[268,312],[276,283],[283,445],[445,276],[390,373],[373,339],[339,390],[295,282],[282,296],[296,295],[448,449],[449,346],[346,448],[356,264],[264,454],[454,356],[337,336],[336,299],[299,337],[337,338],[338,151],[151,337],[294,278],[278,455],[455,294],[308,292],[292,415],[415,308],[429,358],[358,355],[355,429],[265,340],[340,372],[372,265],[352,346],[346,280],[280,352],[295,442],[442,282],[282,295],[354,19],[19,370],[370,354],[285,441],[441,295],[295,285],[195,248],[248,197],[197,195],[457,440],[440,274],[274,457],[301,300],[300,368],[368,301],[417,351],[351,465],[465,417],[251,301],[301,389],[389,251],[394,395],[395,379],[379,394],[399,412],[412,419],[419,399],[410,436],[436,322],[322,410],[326,2],[2,393],[393,326],[354,370],[370,461],[461,354],[393,164],[164,267],[267,393],[268,302],[302,12],[12,268],[312,268],[268,13],[13,312],[298,293],[293,301],[301,298],[265,446],[446,340],[340,265],[280,330],[330,425],[425,280],[322,426],[426,391],[391,322],[420,429],[429,437],[437,420],[393,391],[391,326],[326,393],[344,440],[440,438],[438,344],[458,459],[459,461],[461,458],[364,434],[434,394],[394,364],[428,396],[396,262],[262,428],[274,354],[354,457],[457,274],[317,316],[316,402],[402,317],[316,315],[315,403],[403,316],[315,314],[314,404],[404,315],[314,313],[313,405],[405,314],[313,421],[421,406],[406,313],[323,366],[366,361],[361,323],[292,306],[306,407],[407,292],[306,291],[291,408],[408,306],[291,287],[287,409],[409,291],[287,432],[432,410],[410,287],[427,434],[434,411],[411,427],[372,264],[264,383],[383,372],[459,309],[309,457],[457,459],[366,352],[352,401],[401,366],[1,274],[274,4],[4,1],[418,421],[421,262],[262,418],[331,294],[294,358],[358,331],[435,433],[433,367],[367,435],[392,289],[289,439],[439,392],[328,462],[462,326],[326,328],[94,2],[2,370],[370,94],[289,305],[305,455],[455,289],[339,254],[254,448],[448,339],[359,255],[255,446],[446,359],[254,253],[253,449],[449,254],[253,252],[252,450],[450,253],[252,256],[256,451],[451,252],[256,341],[341,452],[452,256],[414,413],[413,463],[463,414],[286,441],[441,414],[414,286],[286,258],[258,441],[441,286],[258,257],[257,442],[442,258],[257,259],[259,443],[443,257],[259,260],[260,444],[444,259],[260,467],[467,445],[445,260],[309,459],[459,250],[250,309],[305,289],[289,290],[290,305],[305,290],[290,460],[460,305],[401,376],[376,435],[435,401],[309,250],[250,392],[392,309],[376,411],[411,433],[433,376],[453,341],[341,464],[464,453],[357,453],[453,465],[465,357],[343,357],[357,412],[412,343],[437,343],[343,399],[399,437],[344,360],[360,440],[440,344],[420,437],[437,456],[456,420],[360,420],[420,363],[363,360],[361,401],[401,288],[288,361],[265,372],[372,353],[353,265],[390,339],[339,249],[249,390],[339,448],[448,255],[255,339]);function Ti(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var O=class extends pe{constructor(e,t){super(new Te(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,v(e=this.h=new oa,0,1,t=new C),this.A=new ia,v(this.h,0,3,this.A),this.u=new zr,v(this.h,0,2,this.u),Ve(this.u,4,1),y(this.u,2,.5),y(this.A,2,.5),y(this.h,4,.5)}get baseOptions(){return k(this.h,C,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){return"numFaces"in e&&Ve(this.u,4,e.numFaces??1),"minFaceDetectionConfidence"in e&&y(this.u,2,e.minFaceDetectionConfidence??.5),"minTrackingConfidence"in e&&y(this.h,4,e.minTrackingConfidence??.5),"minFacePresenceConfidence"in e&&y(this.A,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.l(e)}F(e,t){return Ti(this),Le(this,e,t),this.j}G(e,t,r){return Ti(this),Ce(this,e,r,t),this.j}m(){var e=new me;R(e,"image_in"),R(e,"norm_rect"),S(e,"face_landmarks");const t=new ge;Re(t,v1,this.h);const r=new se;fe(r,2,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),x(r,"IMAGE:image_in"),x(r,"NORM_RECT:norm_rect"),E(r,"NORM_LANDMARKS:face_landmarks"),r.o(t),Ae(e,r),this.g.attachProtoVectorListener("face_landmarks",(n,s)=>{for(const i of n)n=fr(i),this.j.faceLandmarks.push(Yr(n));d(this,s)}),this.g.attachEmptyPacketListener("face_landmarks",n=>{d(this,n)}),this.outputFaceBlendshapes&&(S(e,"blendshapes"),E(r,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",(n,s)=>{if(this.outputFaceBlendshapes)for(const i of n)n=Kr(i),this.j.faceBlendshapes.push(_s(n.g()??[]));d(this,s)}),this.g.attachEmptyPacketListener("blendshapes",n=>{d(this,n)})),this.outputFacialTransformationMatrixes&&(S(e,"face_geometry"),E(r,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",(n,s)=>{if(this.outputFacialTransformationMatrixes)for(const i of n)(n=k(n=_1(i),u1,2))&&this.j.facialTransformationMatrixes.push({rows:we(n,1)??0??0,columns:we(n,2)??0??0,data:rt(n,3,Ie,tt()).slice()??[]});d(this,s)}),this.g.attachEmptyPacketListener("face_geometry",n=>{d(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};O.prototype.detectForVideo=O.prototype.G,O.prototype.detect=O.prototype.F,O.prototype.setOptions=O.prototype.o,O.createFromModelPath=function(e,t){return A(O,e,{baseOptions:{modelAssetPath:t}})},O.createFromModelBuffer=function(e,t){return A(O,e,{baseOptions:{modelAssetBuffer:t}})},O.createFromOptions=function(e,t){return A(O,e,t)},O.FACE_LANDMARKS_LIPS=ws,O.FACE_LANDMARKS_LEFT_EYE=Es,O.FACE_LANDMARKS_LEFT_EYEBROW=As,O.FACE_LANDMARKS_LEFT_IRIS=Na,O.FACE_LANDMARKS_RIGHT_EYE=ks,O.FACE_LANDMARKS_RIGHT_EYEBROW=Ss,O.FACE_LANDMARKS_RIGHT_IRIS=Ca,O.FACE_LANDMARKS_FACE_OVAL=Ts,O.FACE_LANDMARKS_CONTOURS=Da,O.FACE_LANDMARKS_TESSELATION=Ba;var Ls=Se([0,1],[1,2],[2,3],[3,4],[0,5],[5,6],[6,7],[7,8],[5,9],[9,10],[10,11],[11,12],[9,13],[13,14],[14,15],[15,16],[13,17],[0,17],[17,18],[18,19],[19,20]);function Li(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function Pi(e){return e.gestures.length===0?{gestures:[],landmarks:[],worldLandmarks:[],handedness:[],handednesses:[]}:{gestures:e.gestures,landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handedness:e.handedness,handednesses:e.handedness}}function Mi(e,t=!0){const r=[];for(const s of e){var n=Kr(s);e=[];for(const i of n.g())n=t&&we(i,1)!=null?we(i,1)??0:-1,e.push({score:B(i,2)??0,index:n,categoryName:Q(I(i,3))??""??"",displayName:Q(I(i,4))??""??""});r.push(e)}return r}var oe=class extends pe{constructor(e,t){super(new Te(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],v(e=this.j=new ua,0,1,t=new C),this.u=new ps,v(this.j,0,2,this.u),this.D=new ds,v(this.u,0,3,this.D),this.A=new ca,v(this.u,0,2,this.A),this.h=new b1,v(this.j,0,3,this.h),y(this.A,2,.5),y(this.u,4,.5),y(this.D,2,.5)}get baseOptions(){return k(this.j,C,1)}set baseOptions(e){v(this.j,0,1,e)}o(e){var s,i,o,a;if(Ve(this.A,3,e.numHands??1),"minHandDetectionConfidence"in e&&y(this.A,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&y(this.u,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&y(this.D,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new yt,r=t,n=kn(e.cannedGesturesClassifierOptions,(s=k(this.h,yt,3))==null?void 0:s.l());v(r,0,2,n),v(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&((i=k(this.h,yt,3))==null||i.g());return e.customGesturesClassifierOptions?(v(r=t=new yt,0,2,n=kn(e.customGesturesClassifierOptions,(o=k(this.h,yt,4))==null?void 0:o.l())),v(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&((a=k(this.h,yt,4))==null||a.g()),this.l(e)}Ha(e,t){return Li(this),Le(this,e,t),Pi(this)}Ia(e,t,r){return Li(this),Ce(this,e,r,t),Pi(this)}m(){var e=new me;R(e,"image_in"),R(e,"norm_rect"),S(e,"hand_gestures"),S(e,"hand_landmarks"),S(e,"world_hand_landmarks"),S(e,"handedness");const t=new ge;Re(t,w1,this.j);const r=new se;fe(r,2,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),x(r,"IMAGE:image_in"),x(r,"NORM_RECT:norm_rect"),E(r,"HAND_GESTURES:hand_gestures"),E(r,"LANDMARKS:hand_landmarks"),E(r,"WORLD_LANDMARKS:world_hand_landmarks"),E(r,"HANDEDNESS:handedness"),r.o(t),Ae(e,r),this.g.attachProtoVectorListener("hand_landmarks",(n,s)=>{for(const i of n){n=fr(i);const o=[];for(const a of Ue(n,ea,1))o.push({x:B(a,1)??0,y:B(a,2)??0,z:B(a,3)??0,visibility:B(a,4)??0});this.landmarks.push(o)}d(this,s)}),this.g.attachEmptyPacketListener("hand_landmarks",n=>{d(this,n)}),this.g.attachProtoVectorListener("world_hand_landmarks",(n,s)=>{for(const i of n){n=bt(i);const o=[];for(const a of Ue(n,Zo,1))o.push({x:B(a,1)??0,y:B(a,2)??0,z:B(a,3)??0,visibility:B(a,4)??0});this.worldLandmarks.push(o)}d(this,s)}),this.g.attachEmptyPacketListener("world_hand_landmarks",n=>{d(this,n)}),this.g.attachProtoVectorListener("hand_gestures",(n,s)=>{this.gestures.push(...Mi(n,!1)),d(this,s)}),this.g.attachEmptyPacketListener("hand_gestures",n=>{d(this,n)}),this.g.attachProtoVectorListener("handedness",(n,s)=>{this.handedness.push(...Mi(n)),d(this,s)}),this.g.attachEmptyPacketListener("handedness",n=>{d(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function Ii(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}oe.prototype.recognizeForVideo=oe.prototype.Ia,oe.prototype.recognize=oe.prototype.Ha,oe.prototype.setOptions=oe.prototype.o,oe.createFromModelPath=function(e,t){return A(oe,e,{baseOptions:{modelAssetPath:t}})},oe.createFromModelBuffer=function(e,t){return A(oe,e,{baseOptions:{modelAssetBuffer:t}})},oe.createFromOptions=function(e,t){return A(oe,e,t)},oe.HAND_CONNECTIONS=Ls;var ne=class extends pe{constructor(e,t){super(new Te(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],v(e=this.h=new ps,0,1,t=new C),this.u=new ds,v(this.h,0,3,this.u),this.j=new ca,v(this.h,0,2,this.j),Ve(this.j,3,1),y(this.j,2,.5),y(this.u,2,.5),y(this.h,4,.5)}get baseOptions(){return k(this.h,C,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){return"numHands"in e&&Ve(this.j,3,e.numHands??1),"minHandDetectionConfidence"in e&&y(this.j,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&y(this.h,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&y(this.u,2,e.minHandPresenceConfidence??.5),this.l(e)}F(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Le(this,e,t),Ii(this)}G(e,t,r){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Ce(this,e,r,t),Ii(this)}m(){var e=new me;R(e,"image_in"),R(e,"norm_rect"),S(e,"hand_landmarks"),S(e,"world_hand_landmarks"),S(e,"handedness");const t=new ge;Re(t,E1,this.h);const r=new se;fe(r,2,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),x(r,"IMAGE:image_in"),x(r,"NORM_RECT:norm_rect"),E(r,"LANDMARKS:hand_landmarks"),E(r,"WORLD_LANDMARKS:world_hand_landmarks"),E(r,"HANDEDNESS:handedness"),r.o(t),Ae(e,r),this.g.attachProtoVectorListener("hand_landmarks",(n,s)=>{for(const i of n)n=fr(i),this.landmarks.push(Yr(n));d(this,s)}),this.g.attachEmptyPacketListener("hand_landmarks",n=>{d(this,n)}),this.g.attachProtoVectorListener("world_hand_landmarks",(n,s)=>{for(const i of n)n=bt(i),this.worldLandmarks.push(Zt(n));d(this,s)}),this.g.attachEmptyPacketListener("world_hand_landmarks",n=>{d(this,n)}),this.g.attachProtoVectorListener("handedness",(n,s)=>{var i=this.handedness,o=i.push;const a=[];for(const c of n){n=Kr(c);const l=[];for(const u of n.g())l.push({score:B(u,2)??0,index:we(u,1)??0??-1,categoryName:Q(I(u,3))??""??"",displayName:Q(I(u,4))??""??""});a.push(l)}o.call(i,...a),d(this,s)}),this.g.attachEmptyPacketListener("handedness",n=>{d(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ne.prototype.detectForVideo=ne.prototype.G,ne.prototype.detect=ne.prototype.F,ne.prototype.setOptions=ne.prototype.o,ne.createFromModelPath=function(e,t){return A(ne,e,{baseOptions:{modelAssetPath:t}})},ne.createFromModelBuffer=function(e,t){return A(ne,e,{baseOptions:{modelAssetBuffer:t}})},ne.createFromOptions=function(e,t){return A(ne,e,t)},ne.HAND_CONNECTIONS=Ls;var ja=Se([0,1],[1,2],[2,3],[3,7],[0,4],[4,5],[5,6],[6,8],[9,10],[11,12],[11,13],[13,15],[15,17],[15,19],[15,21],[17,19],[12,14],[14,16],[16,18],[16,20],[16,22],[18,20],[11,23],[12,24],[23,24],[23,25],[24,26],[25,27],[26,28],[27,29],[28,30],[29,31],[30,32],[27,31],[28,32]);function xi(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function Oi(e){try{if(!e.D)return e.h;e.D(e.h)}finally{$r(e)}}function _r(e,t){e=fr(e),t.push(Yr(e))}var M=class extends pe{constructor(e,t){super(new Te(e,t),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,v(e=this.j=new pa,0,1,t=new C),this.I=new ds,v(this.j,0,2,this.I),this.W=new A1,v(this.j,0,3,this.W),this.u=new zr,v(this.j,0,4,this.u),this.O=new ia,v(this.j,0,5,this.O),this.A=new fa,v(this.j,0,6,this.A),this.M=new da,v(this.j,0,7,this.M),y(this.u,2,.5),y(this.u,3,.3),y(this.O,2,.5),y(this.A,2,.5),y(this.A,3,.3),y(this.M,2,.5),y(this.I,2,.5)}get baseOptions(){return k(this.j,C,1)}set baseOptions(e){v(this.j,0,1,e)}o(e){return"minFaceDetectionConfidence"in e&&y(this.u,2,e.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in e&&y(this.u,3,e.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in e&&y(this.O,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"minPoseDetectionConfidence"in e&&y(this.A,2,e.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in e&&y(this.A,3,e.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in e&&y(this.M,2,e.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in e&&y(this.I,2,e.minHandLandmarksConfidence??.5),this.l(e)}F(e,t,r){const n=typeof t!="function"?t:{};return this.D=typeof t=="function"?t:r,xi(this),Le(this,e,n),Oi(this)}G(e,t,r,n){const s=typeof r!="function"?r:{};return this.D=typeof r=="function"?r:n,xi(this),Ce(this,e,s,t),Oi(this)}m(){var e=new me;R(e,"input_frames_image"),S(e,"pose_landmarks"),S(e,"pose_world_landmarks"),S(e,"face_landmarks"),S(e,"left_hand_landmarks"),S(e,"left_hand_world_landmarks"),S(e,"right_hand_landmarks"),S(e,"right_hand_world_landmarks");const t=new ge,r=new ri;fe(r,1,"type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),function(s,i){if(i!=null)if(Array.isArray(i))T(s,2,Rr(i,0,sr));else{if(!(typeof i=="string"||i instanceof xe||Rn(i)))throw Error("invalid value in Any.value field: "+i+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");ze(s,2,Cn(i,!1),ct())}}(r,this.j.g());const n=new se;fe(n,2,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),Jn(n,8,ri,r),x(n,"IMAGE:input_frames_image"),E(n,"POSE_LANDMARKS:pose_landmarks"),E(n,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),E(n,"FACE_LANDMARKS:face_landmarks"),E(n,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),E(n,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),E(n,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),E(n,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),n.o(t),Ae(e,n),Xr(this,e),this.g.attachProtoListener("pose_landmarks",(s,i)=>{_r(s,this.h.poseLandmarks),d(this,i)}),this.g.attachEmptyPacketListener("pose_landmarks",s=>{d(this,s)}),this.g.attachProtoListener("pose_world_landmarks",(s,i)=>{var o=this.h.poseWorldLandmarks;s=bt(s),o.push(Zt(s)),d(this,i)}),this.g.attachEmptyPacketListener("pose_world_landmarks",s=>{d(this,s)}),this.outputPoseSegmentationMasks&&(E(n,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),It(this,"pose_segmentation_mask"),this.g.Z("pose_segmentation_mask",(s,i)=>{this.h.poseSegmentationMasks=[Ot(this,s,!0,!this.D)],d(this,i)}),this.g.attachEmptyPacketListener("pose_segmentation_mask",s=>{this.h.poseSegmentationMasks=[],d(this,s)})),this.g.attachProtoListener("face_landmarks",(s,i)=>{_r(s,this.h.faceLandmarks),d(this,i)}),this.g.attachEmptyPacketListener("face_landmarks",s=>{d(this,s)}),this.outputFaceBlendshapes&&(S(e,"extra_blendshapes"),E(n,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",(s,i)=>{var o=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(s=Kr(s),o.push(_s(s.g()??[]))),d(this,i)}),this.g.attachEmptyPacketListener("extra_blendshapes",s=>{d(this,s)})),this.g.attachProtoListener("left_hand_landmarks",(s,i)=>{_r(s,this.h.leftHandLandmarks),d(this,i)}),this.g.attachEmptyPacketListener("left_hand_landmarks",s=>{d(this,s)}),this.g.attachProtoListener("left_hand_world_landmarks",(s,i)=>{var o=this.h.leftHandWorldLandmarks;s=bt(s),o.push(Zt(s)),d(this,i)}),this.g.attachEmptyPacketListener("left_hand_world_landmarks",s=>{d(this,s)}),this.g.attachProtoListener("right_hand_landmarks",(s,i)=>{_r(s,this.h.rightHandLandmarks),d(this,i)}),this.g.attachEmptyPacketListener("right_hand_landmarks",s=>{d(this,s)}),this.g.attachProtoListener("right_hand_world_landmarks",(s,i)=>{var o=this.h.rightHandWorldLandmarks;s=bt(s),o.push(Zt(s)),d(this,i)}),this.g.attachEmptyPacketListener("right_hand_world_landmarks",s=>{d(this,s)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};M.prototype.detectForVideo=M.prototype.G,M.prototype.detect=M.prototype.F,M.prototype.setOptions=M.prototype.o,M.createFromModelPath=function(e,t){return A(M,e,{baseOptions:{modelAssetPath:t}})},M.createFromModelBuffer=function(e,t){return A(M,e,{baseOptions:{modelAssetBuffer:t}})},M.createFromOptions=function(e,t){return A(M,e,t)},M.HAND_CONNECTIONS=Ls,M.POSE_CONNECTIONS=ja,M.FACE_LANDMARKS_LIPS=ws,M.FACE_LANDMARKS_LEFT_EYE=Es,M.FACE_LANDMARKS_LEFT_EYEBROW=As,M.FACE_LANDMARKS_LEFT_IRIS=Na,M.FACE_LANDMARKS_RIGHT_EYE=ks,M.FACE_LANDMARKS_RIGHT_EYEBROW=Ss,M.FACE_LANDMARKS_RIGHT_IRIS=Ca,M.FACE_LANDMARKS_FACE_OVAL=Ts,M.FACE_LANDMARKS_CONTOURS=Da,M.FACE_LANDMARKS_TESSELATION=Ba;var _e=class extends pe{constructor(e,t){super(new Te(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},v(e=this.h=new ga,0,1,t=new C)}get baseOptions(){return k(this.h,C,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){return v(this.h,0,2,kn(e,k(this.h,ls,2))),this.l(e)}sa(e,t){return this.j={classifications:[]},Le(this,e,t),this.j}ta(e,t,r){return this.j={classifications:[]},Ce(this,e,r,t),this.j}m(){var e=new me;R(e,"input_image"),R(e,"norm_rect"),S(e,"classifications");const t=new ge;Re(t,k1,this.h);const r=new se;fe(r,2,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),x(r,"IMAGE:input_image"),x(r,"NORM_RECT:norm_rect"),E(r,"CLASSIFICATIONS:classifications"),r.o(t),Ae(e,r),this.g.attachProtoListener("classifications",(n,s)=>{this.j=I1(f1(n)),d(this,s)}),this.g.attachEmptyPacketListener("classifications",n=>{d(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};_e.prototype.classifyForVideo=_e.prototype.ta,_e.prototype.classify=_e.prototype.sa,_e.prototype.setOptions=_e.prototype.o,_e.createFromModelPath=function(e,t){return A(_e,e,{baseOptions:{modelAssetPath:t}})},_e.createFromModelBuffer=function(e,t){return A(_e,e,{baseOptions:{modelAssetBuffer:t}})},_e.createFromOptions=function(e,t){return A(_e,e,t)};var ae=class extends pe{constructor(e,t){super(new Te(e,t),"image_in","norm_rect",!0),this.h=new ma,this.embeddings={embeddings:[]},v(e=this.h,0,1,t=new C)}get baseOptions(){return k(this.h,C,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){var t=this.h,r=k(this.h,li,2);return r=r?r.clone():new li,e.l2Normalize!==void 0?T(r,1,nr(e.l2Normalize)):"l2Normalize"in e&&T(r,1),e.quantize!==void 0?T(r,2,nr(e.quantize)):"quantize"in e&&T(r,2),v(t,0,2,r),this.l(e)}za(e,t){return Le(this,e,t),this.embeddings}Aa(e,t,r){return Ce(this,e,r,t),this.embeddings}m(){var e=new me;R(e,"image_in"),R(e,"norm_rect"),S(e,"embeddings_out");const t=new ge;Re(t,S1,this.h);const r=new se;fe(r,2,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),x(r,"IMAGE:image_in"),x(r,"NORM_RECT:norm_rect"),E(r,"EMBEDDINGS:embeddings_out"),r.o(t),Ae(e,r),this.g.attachProtoListener("embeddings_out",(n,s)=>{n=g1(n),this.embeddings=function(i){return{embeddings:Ue(i,p1,1).map(o=>{var l,u;const a={headIndex:we(o,3)??0??-1,headName:Q(I(o,4))??""??""};var c=o.v;return lo(c,0|c[p],hi,on(o,1))!==void 0?(o=rt(o=k(o,hi,on(o,1),void 0),1,Ie,tt()),a.floatEmbedding=o.slice()):(c=new Uint8Array(0),a.quantizedEmbedding=((u=(l=k(o,d1,on(o,2),void 0))==null?void 0:l.na())==null?void 0:u.h())??c),a}),timestampMs:Aa(go(i))}}(n),d(this,s)}),this.g.attachEmptyPacketListener("embeddings_out",n=>{d(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ae.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=yi(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=yi(mi(e.quantizedEmbedding),mi(t.quantizedEmbedding))}return e},ae.prototype.embedForVideo=ae.prototype.Aa,ae.prototype.embed=ae.prototype.za,ae.prototype.setOptions=ae.prototype.o,ae.createFromModelPath=function(e,t){return A(ae,e,{baseOptions:{modelAssetPath:t}})},ae.createFromModelBuffer=function(e,t){return A(ae,e,{baseOptions:{modelAssetBuffer:t}})},ae.createFromOptions=function(e,t){return A(ae,e,t)};var Pn=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){var e,t;(e=this.confidenceMasks)==null||e.forEach(r=>{r.close()}),(t=this.categoryMask)==null||t.close()}};function D1(e){var r,n;const t=function(s){return Ue(s,se,1)}(e.ca()).filter(s=>(Q(I(s,1))??"").includes("mediapipe.tasks.TensorsToSegmentationCalculator"));if(e.u=[],t.length>1)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");t.length===1&&(((n=(r=k(t[0],ge,7))==null?void 0:r.j())==null?void 0:n.g())??new Map).forEach((s,i)=>{e.u[Number(i)]=Q(I(s,1))??""})}function Fi(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function Ri(e){try{const t=new Pn(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{$r(e)}}Pn.prototype.close=Pn.prototype.close;var re=class extends pe{constructor(e,t){super(new Te(e,t),"image_in","norm_rect",!1),this.u=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new ys,this.A=new ya,v(this.h,0,3,this.A),v(e=this.h,0,1,t=new C)}get baseOptions(){return k(this.h,C,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?T(this.h,2,ur(e.displayNamesLocale)):"displayNamesLocale"in e&&T(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}L(){D1(this)}segment(e,t,r){const n=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:r,Fi(this),Le(this,e,n),Ri(this)}La(e,t,r,n){const s=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:n,Fi(this),Ce(this,e,s,t),Ri(this)}Da(){return this.u}m(){var e=new me;R(e,"image_in"),R(e,"norm_rect");const t=new ge;Re(t,va,this.h);const r=new se;fe(r,2,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),x(r,"IMAGE:image_in"),x(r,"NORM_RECT:norm_rect"),r.o(t),Ae(e,r),Xr(this,e),this.outputConfidenceMasks&&(S(e,"confidence_masks"),E(r,"CONFIDENCE_MASKS:confidence_masks"),It(this,"confidence_masks"),this.g.aa("confidence_masks",(n,s)=>{this.confidenceMasks=n.map(i=>Ot(this,i,!0,!this.j)),d(this,s)}),this.g.attachEmptyPacketListener("confidence_masks",n=>{this.confidenceMasks=[],d(this,n)})),this.outputCategoryMask&&(S(e,"category_mask"),E(r,"CATEGORY_MASK:category_mask"),It(this,"category_mask"),this.g.Z("category_mask",(n,s)=>{this.categoryMask=Ot(this,n,!1,!this.j),d(this,s)}),this.g.attachEmptyPacketListener("category_mask",n=>{this.categoryMask=void 0,d(this,n)})),S(e,"quality_scores"),E(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(n,s)=>{this.qualityScores=n,d(this,s)}),this.g.attachEmptyPacketListener("quality_scores",n=>{this.categoryMask=void 0,d(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};re.prototype.getLabels=re.prototype.Da,re.prototype.segmentForVideo=re.prototype.La,re.prototype.segment=re.prototype.segment,re.prototype.setOptions=re.prototype.o,re.createFromModelPath=function(e,t){return A(re,e,{baseOptions:{modelAssetPath:t}})},re.createFromModelBuffer=function(e,t){return A(re,e,{baseOptions:{modelAssetBuffer:t}})},re.createFromOptions=function(e,t){return A(re,e,t)};var Mn=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){var e,t;(e=this.confidenceMasks)==null||e.forEach(r=>{r.close()}),(t=this.categoryMask)==null||t.close()}};Mn.prototype.close=Mn.prototype.close;var Me=class extends pe{constructor(e,t){super(new Te(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new ys,this.u=new ya,v(this.h,0,3,this.u),v(e=this.h,0,1,t=new C)}get baseOptions(){return k(this.h,C,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){return"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}segment(e,t,r,n){const s=typeof r!="function"?r:{};if(this.j=typeof r=="function"?r:n,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,r=this.C+1,n=new ba,t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var i=new hn;ze(i,3,nr(!0),!1),ze(i,1,$t(t.keypoint.x),0),ze(i,2,$t(t.keypoint.y),0),Jt(n,1,An,i)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");{const a=new L1;for(i of t.scribble)ze(t=new hn,3,nr(!0),!1),ze(t,1,$t(i.x),0),ze(t,2,$t(i.y),0),Jn(a,1,hn,t);Jt(n,2,An,a)}}this.g.addProtoToStream(n.g(),"mediapipe.tasks.vision.interactive_segmenter.proto.RegionOfInterest","roi_in",r),Le(this,e,s);e:{try{const a=new Mn(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var o=a;break e}this.j(a)}finally{$r(this)}o=void 0}return o}m(){var e=new me;R(e,"image_in"),R(e,"roi_in"),R(e,"norm_rect_in");const t=new ge;Re(t,va,this.h);const r=new se;fe(r,2,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraphV2"),x(r,"IMAGE:image_in"),x(r,"ROI:roi_in"),x(r,"NORM_RECT:norm_rect_in"),r.o(t),Ae(e,r),Xr(this,e),this.outputConfidenceMasks&&(S(e,"confidence_masks"),E(r,"CONFIDENCE_MASKS:confidence_masks"),It(this,"confidence_masks"),this.g.aa("confidence_masks",(n,s)=>{this.confidenceMasks=n.map(i=>Ot(this,i,!0,!this.j)),d(this,s)}),this.g.attachEmptyPacketListener("confidence_masks",n=>{this.confidenceMasks=[],d(this,n)})),this.outputCategoryMask&&(S(e,"category_mask"),E(r,"CATEGORY_MASK:category_mask"),It(this,"category_mask"),this.g.Z("category_mask",(n,s)=>{this.categoryMask=Ot(this,n,!1,!this.j),d(this,s)}),this.g.attachEmptyPacketListener("category_mask",n=>{this.categoryMask=void 0,d(this,n)})),S(e,"quality_scores"),E(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(n,s)=>{this.qualityScores=n,d(this,s)}),this.g.attachEmptyPacketListener("quality_scores",n=>{this.categoryMask=void 0,d(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Me.prototype.segment=Me.prototype.segment,Me.prototype.setOptions=Me.prototype.o,Me.createFromModelPath=function(e,t){return A(Me,e,{baseOptions:{modelAssetPath:t}})},Me.createFromModelBuffer=function(e,t){return A(Me,e,{baseOptions:{modelAssetBuffer:t}})},Me.createFromOptions=function(e,t){return A(Me,e,t)};var ve=class extends pe{constructor(e,t){super(new Te(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},v(e=this.h=new wa,0,1,t=new C)}get baseOptions(){return k(this.h,C,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?T(this.h,2,ur(e.displayNamesLocale)):"displayNamesLocale"in e&&T(this.h,2),e.maxResults!==void 0?Ve(this.h,3,e.maxResults):"maxResults"in e&&T(this.h,3),e.scoreThreshold!==void 0?y(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&T(this.h,4),e.categoryAllowlist!==void 0?Ar(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&T(this.h,5),e.categoryDenylist!==void 0?Ar(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&T(this.h,6),this.l(e)}F(e,t){return this.j={detections:[]},Le(this,e,t),this.j}G(e,t,r){return this.j={detections:[]},Ce(this,e,r,t),this.j}m(){var e=new me;R(e,"input_frame_gpu"),R(e,"norm_rect"),S(e,"detections");const t=new ge;Re(t,P1,this.h);const r=new se;fe(r,2,"mediapipe.tasks.vision.ObjectDetectorGraph"),x(r,"IMAGE:input_frame_gpu"),x(r,"NORM_RECT:norm_rect"),E(r,"DETECTIONS:detections"),r.o(t),Ae(e,r),this.g.attachProtoVectorListener("detections",(n,s)=>{for(const i of n)n=Qo(i),this.j.detections.push(ka(n));d(this,s)}),this.g.attachEmptyPacketListener("detections",n=>{d(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ve.prototype.detectForVideo=ve.prototype.G,ve.prototype.detect=ve.prototype.F,ve.prototype.setOptions=ve.prototype.o,ve.createFromModelPath=async function(e,t){return A(ve,e,{baseOptions:{modelAssetPath:t}})},ve.createFromModelBuffer=function(e,t){return A(ve,e,{baseOptions:{modelAssetBuffer:t}})},ve.createFromOptions=function(e,t){return A(ve,e,t)};var In=class{constructor(e,t,r){this.landmarks=e,this.worldLandmarks=t,this.segmentationMasks=r}close(){var e;(e=this.segmentationMasks)==null||e.forEach(t=>{t.close()})}};function Ni(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function Ci(e){try{const t=new In(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.u)return t;e.u(t)}finally{$r(e)}}In.prototype.close=In.prototype.close;var ce=class extends pe{constructor(e,t){super(new Te(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,v(e=this.h=new Ea,0,1,t=new C),this.A=new da,v(this.h,0,3,this.A),this.j=new fa,v(this.h,0,2,this.j),Ve(this.j,4,1),y(this.j,2,.5),y(this.A,2,.5),y(this.h,4,.5)}get baseOptions(){return k(this.h,C,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){return"numPoses"in e&&Ve(this.j,4,e.numPoses??1),"minPoseDetectionConfidence"in e&&y(this.j,2,e.minPoseDetectionConfidence??.5),"minTrackingConfidence"in e&&y(this.h,4,e.minTrackingConfidence??.5),"minPosePresenceConfidence"in e&&y(this.A,2,e.minPosePresenceConfidence??.5),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}F(e,t,r){const n=typeof t!="function"?t:{};return this.u=typeof t=="function"?t:r,Ni(this),Le(this,e,n),Ci(this)}G(e,t,r,n){const s=typeof r!="function"?r:{};return this.u=typeof r=="function"?r:n,Ni(this),Ce(this,e,s,t),Ci(this)}m(){var e=new me;R(e,"image_in"),R(e,"norm_rect"),S(e,"normalized_landmarks"),S(e,"world_landmarks"),S(e,"segmentation_masks");const t=new ge;Re(t,M1,this.h);const r=new se;fe(r,2,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),x(r,"IMAGE:image_in"),x(r,"NORM_RECT:norm_rect"),E(r,"NORM_LANDMARKS:normalized_landmarks"),E(r,"WORLD_LANDMARKS:world_landmarks"),r.o(t),Ae(e,r),Xr(this,e),this.g.attachProtoVectorListener("normalized_landmarks",(n,s)=>{this.landmarks=[];for(const i of n)n=fr(i),this.landmarks.push(Yr(n));d(this,s)}),this.g.attachEmptyPacketListener("normalized_landmarks",n=>{this.landmarks=[],d(this,n)}),this.g.attachProtoVectorListener("world_landmarks",(n,s)=>{this.worldLandmarks=[];for(const i of n)n=bt(i),this.worldLandmarks.push(Zt(n));d(this,s)}),this.g.attachEmptyPacketListener("world_landmarks",n=>{this.worldLandmarks=[],d(this,n)}),this.outputSegmentationMasks&&(E(r,"SEGMENTATION_MASK:segmentation_masks"),It(this,"segmentation_masks"),this.g.aa("segmentation_masks",(n,s)=>{this.segmentationMasks=n.map(i=>Ot(this,i,!0,!this.u)),d(this,s)}),this.g.attachEmptyPacketListener("segmentation_masks",n=>{this.segmentationMasks=[],d(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ce.prototype.detectForVideo=ce.prototype.G,ce.prototype.detect=ce.prototype.F,ce.prototype.setOptions=ce.prototype.o,ce.createFromModelPath=function(e,t){return A(ce,e,{baseOptions:{modelAssetPath:t}})},ce.createFromModelBuffer=function(e,t){return A(ce,e,{baseOptions:{modelAssetBuffer:t}})},ce.createFromOptions=function(e,t){return A(ce,e,t)},ce.POSE_CONNECTIONS=ja;class Ua{constructor(t){this.models={face:null,hand:null},this.webcam=null,this.currentStepRef=0,this.isStepTransitioningRef=!1,this.timerId=null,this.requestId=null,this.heartbeatId=null,this.warningCount=0,this.MAX_WARNINGS=3,this.lastWarningMsg="",this.isDetectionPaused=!1,this.anchorRatios=null,this.lastNosePos=null,this.consecutiveMissingFrames=0,this.MAX_GAP=15,this.LIVENESS_LOCK_KEY="liveness_active_session",this.stabilityFrames=0,this.REQUIRED_STABILITY=10,this.offscreenCanvas=document.createElement("canvas"),this.CHALLENGE_POOL=["Smile","Blink","Turn_Head","Thumbs_Up"],this.attachVideo=r=>{r.setAttribute("crossorigin","anonymous"),this.webcam=r,console.log("[LivenessEngine] Video stream attached.")},this.start=()=>{const r=localStorage.getItem(this.LIVENESS_LOCK_KEY);if(r&&Date.now()-parseInt(r)<5e3){this.failInstantly("Another session is active.");return}if(this.heartbeatId=setInterval(()=>{localStorage.setItem(this.LIVENESS_LOCK_KEY,Date.now().toString())},1e3),this.state.status!=="ready"||!this.webcam){console.warn("[LivenessEngine] Engine not ready or video missing.");return}console.log("[LivenessEngine] Session Starting..."),this.state.status="capturing",this.updateState({status:"capturing"}),this.startTimer(),this.detectLoop()},this.stop=()=>{this.timerId&&clearInterval(this.timerId),this.heartbeatId&&clearInterval(this.heartbeatId),this.requestId&&cancelAnimationFrame(this.requestId),localStorage.removeItem(this.LIVENESS_LOCK_KEY),this.timerId=null,this.heartbeatId=null,this.requestId=null},this.reset=()=>{this.stop(),this.currentStepRef=0,this.isStepTransitioningRef=!1,this.anchorRatios=null,this.lastNosePos=null,this.consecutiveMissingFrames=0,this.stabilityFrames=0,this.warningCount=0,this.isDetectionPaused=!1,this.generateSequence(),this.updateState({status:"ready",currentStep:0,timeLeft:this.config.duration,isStepTransitioning:!1,errorMsg:"",snapshots:[]})},this.detectLoop=()=>{var n,s;if(this.state.status!=="capturing"||!this.webcam||!this.models.face||this.isDetectionPaused)return;const r=performance.now();try{const i=this.models.face.detectForVideo(this.webcam,r);if(i.faceLandmarks&&i.faceLandmarks.length>1){console.warn("[LivenessEngine] Security Alert: Multiple faces detected!"),this.handleViolation("Multiple faces detected. Please ensure only one person is in frame.");return}const o=(n=i.faceLandmarks)==null?void 0:n[0];if(o){if(this.consecutiveMissingFrames=0,this.anchorRatios===null)this.stabilityFrames++,this.stabilityFrames>=this.REQUIRED_STABILITY&&this.verifyIdentity(o);else if(!this.verifyIdentity(o)||!this.checkMovement(o)){this.handleViolation("Security violation: Identity mismatch.");return}this.state.errorMsg&&this.updateState({errorMsg:""});const a=this.state.sequence[this.currentStepRef],c=(s=this.models.hand)==null?void 0:s.detectForVideo(this.webcam,r);if(this.checkAction(i,c,a)){this.handleStepSuccess(o);return}}else if(this.consecutiveMissingFrames++,this.consecutiveMissingFrames>this.MAX_GAP)return this.handleViolation("Face lost. Session reset.");this.requestId=requestAnimationFrame(this.detectLoop)}catch(i){console.error("[LivenessEngine] Loop detection error:",i),this.requestId=requestAnimationFrame(this.detectLoop)}},this.config={apiUrl:t.apiUrl,duration:t.duration??60,smileThreshold:t.smileThreshold??.2,blinkThreshold:t.blinkThreshold??.012,minturnHeadThreshold:t.minturnHeadThreshold??.15,maxturnHeadThreshold:t.maxturnHeadThreshold??.85,onStateChange:t.onStateChange||(()=>{}),onComplete:t.onComplete||(()=>{}),onError:t.onError||(()=>{})},this.state={status:"loading",sequence:[],currentStep:0,timeLeft:this.config.duration,isStepTransitioning:!1,errorMsg:"",snapshots:[]},this.offscreenCanvas.width=224,this.offscreenCanvas.height=224}async loadModels(){console.log("[LivenessEngine] Loading AI Models...");try{const t=await et.forVisionTasks("https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.3/wasm");this.models.face=await O.createFromOptions(t,{baseOptions:{modelAssetPath:"https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/1/face_landmarker.task",delegate:"GPU"},outputFaceBlendshapes:!0,runningMode:"VIDEO"}),this.models.hand=await ne.createFromOptions(t,{baseOptions:{modelAssetPath:"https://storage.googleapis.com/mediapipe-models/hand_landmarker/hand_landmarker/float16/1/hand_landmarker.task",delegate:"GPU"},runningMode:"VIDEO",numHands:1}),this.generateSequence(),this.updateState({status:"ready"}),console.log("[LivenessEngine] Models Loaded.")}catch(t){console.error("[LivenessEngine] Init Error:",t),this.updateState({status:"error",errorMsg:"Failed to load security assets."})}}verifyIdentity(t){const r=Math.sqrt(Math.pow(t[33].x-t[263].x,2)+Math.pow(t[33].y-t[263].y,2)),n=Math.abs(t[1].y-t[13].y),s=r/(n||1);return this.anchorRatios===null?(this.anchorRatios=s,!0):Math.abs(this.anchorRatios-s)/this.anchorRatios<.7}checkMovement(t){const r={x:t[1].x,y:t[1].y};return this.lastNosePos&&Math.sqrt(Math.pow(r.x-this.lastNosePos.x,2)+Math.pow(r.y-this.lastNosePos.y,2))>.5?!1:(this.lastNosePos=r,!0)}handleViolation(t){this.warningCount++,this.warningCount>=this.MAX_WARNINGS?this.failInstantly(t):(this.isDetectionPaused=!0,this.requestId&&(cancelAnimationFrame(this.requestId),this.requestId=null),this.updateState({errorMsg:`${t} (Warning ${this.warningCount}/${this.MAX_WARNINGS})`}),setTimeout(()=>{this.state.status==="capturing"&&(this.isDetectionPaused=!1,this.updateState({errorMsg:""}),this.detectLoop())},2e3))}failInstantly(t){this.stop(),this.updateState({status:"error",errorMsg:t,isStepTransitioning:!1}),this.config.onError({success:!1,reason:t})}updateState(t){this.state={...this.state,...t},this.config.onStateChange(this.state)}generateSequence(){const t=[...this.CHALLENGE_POOL].sort(()=>.5-Math.random()).slice(0,3);return this.updateState({sequence:t}),t}startTimer(){this.timerId&&clearInterval(this.timerId),this.timerId=setInterval(()=>{this.state.timeLeft>0?this.updateState({timeLeft:this.state.timeLeft-1}):(this.stop(),this.updateState({status:"expired"}))},1e3)}async handleStepSuccess(t){if(this.isStepTransitioningRef)return;this.isStepTransitioningRef=!0;const r=await this.getFaceCrop(this.webcam,t),n={challenge:this.state.sequence[this.currentStepRef],image:r.toDataURL("image/jpeg",.7),timestamp:Date.now()},s=[...this.state.snapshots,n];this.updateState({isStepTransitioning:!0,snapshots:s}),setTimeout(()=>{this.state.status==="capturing"&&(this.currentStepRef<this.state.sequence.length-1?(this.currentStepRef++,this.isStepTransitioningRef=!1,this.updateState({currentStep:this.currentStepRef,isStepTransitioning:!1,snapshots:s}),this.requestId=requestAnimationFrame(this.detectLoop)):(this.updateState({snapshots:s}),this.sendFinalProof()))},1500)}checkAction(t,r,n){var s,i;if(this.isStepTransitioningRef)return!1;if(n==="Thumbs_Up"&&((s=r==null?void 0:r.landmarks)==null?void 0:s.length)>0){const o=r.landmarks[0];return o[4].y<o[2].y&&[8,12,16,20].every(a=>o[a].y>o[a-2].y)}if(((i=t==null?void 0:t.faceLandmarks)==null?void 0:i.length)>0){const o=t.faceLandmarks[0];switch(n){case"Smile":return o[291].x-o[61].x>this.config.smileThreshold;case"Blink":const a=Math.abs(o[159].y-o[145].y),c=Math.abs(o[386].y-o[374].y);return(a+c)/2<this.config.blinkThreshold;case"Turn_Head":const l=(o[1].x-o[33].x)/(o[263].x-o[33].x);return l<this.config.minturnHeadThreshold||l>this.config.maxturnHeadThreshold;default:return!1}}return!1}async sendFinalProof(){var t,r;this.stop(),this.updateState({status:"verifying"});try{const n=[];let s="";for(let a=0;a<5&&!(!this.webcam||!this.models.face);a++){const c=(t=this.models.face)==null?void 0:t.detectForVideo(this.webcam,performance.now());if((r=c==null?void 0:c.faceLandmarks)!=null&&r[0]){const l=await this.getFaceCrop(this.webcam,c.faceLandmarks[0]),u=await new Promise(f=>l.toBlob(f,"image/jpeg",.9));u&&n.push(u),a===4&&(s=l.toDataURL("image/jpeg"))}await new Promise(l=>setTimeout(l,100))}const{verifyLiveness:i}=await Promise.resolve().then(()=>require("./api-CWu5ff9j.cjs")),o=await i(this.config.apiUrl,n,this.state.sequence);if(o.is_live)this.updateState({status:"success"}),this.config.onComplete({success:!0,image:s,skinConfidence:o.skin_confidence});else{const a=o.reason||"Liveness check failed";this.updateState({status:"error",errorMsg:a}),this.config.onError({success:!1,reason:a})}}catch{this.updateState({status:"error",errorMsg:"Verification failed."}),this.config.onError({success:!1,reason:"Network error"})}}async getFaceCrop(t,r){const n=r.map(Z=>Z.x*t.videoWidth),s=r.map(Z=>Z.y*t.videoHeight),i=Math.min(...n),o=Math.max(...n),a=Math.min(...s),c=Math.max(...s),l=o-i,u=c-a,f=l*.3,_=Math.max(0,i-f),b=Math.max(0,a-f),P=Math.min(t.videoWidth-_,l+f*2),He=Math.min(t.videoHeight-b,u+f*2),ie=this.offscreenCanvas.getContext("2d");try{const Z=await createImageBitmap(t,_,b,P,He);ie.clearRect(0,0,224,224),ie.drawImage(Z,0,0,224,224),Z.close()}catch(Z){console.error("[LivenessEngine] Bitmap extraction failed, falling back to direct draw",Z),this.offscreenCanvas.getContext("2d").drawImage(t,_,b,P,He,0,0,224,224)}return this.offscreenCanvas}}const Va=e=>{const[t,r]=Ke.useState({status:"loading",sequence:[],currentStep:0,timeLeft:e.duration||60,isStepTransitioning:!1,errorMsg:"",snapshots:[]}),n=Ke.useRef(null),s=Ke.useRef(null);Ke.useEffect(()=>{const a=new Ua({...e,onStateChange:c=>r({...c})});return n.current=a,a.loadModels(),()=>a.stop()},[]),Ke.useEffect(()=>{var a,c;if(t.status!=="loading"&&t.status!=="error"){const l=(a=s.current)==null?void 0:a.video;if(l&&l.readyState>=2)(c=n.current)==null||c.attachVideo(l);else{const u=setInterval(()=>{var _,b;const f=(_=s.current)==null?void 0:_.video;f&&f.readyState>=2&&((b=n.current)==null||b.attachVideo(f),clearInterval(u))},100);return()=>clearInterval(u)}}},[t.status]);const i=Ke.useCallback(()=>{var a;console.log("[Hook] Start Clicked"),(a=n.current)==null||a.start()},[]),o=Ke.useCallback(()=>{var a;console.log("[Hook] Reset Clicked"),(a=n.current)==null||a.reset()},[]);return{...t,webcamRef:s,start:i,reset:o}};var xn={exports:{}},zt={};/**
16
+ * @license React
17
+ * react-jsx-runtime.production.js
18
+ *
19
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
20
+ *
21
+ * This source code is licensed under the MIT license found in the
22
+ * LICENSE file in the root directory of this source tree.
23
+ */var Di;function B1(){if(Di)return zt;Di=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(n,s,i){var o=null;if(i!==void 0&&(o=""+i),s.key!==void 0&&(o=""+s.key),"key"in s){i={};for(var a in s)a!=="key"&&(i[a]=s[a])}else i=s;return s=i.ref,{$$typeof:e,type:n,key:o,ref:s!==void 0?s:null,props:i}}return zt.Fragment=t,zt.jsx=r,zt.jsxs=r,zt}var Yt={};/**
24
+ * @license React
25
+ * react-jsx-runtime.development.js
26
+ *
27
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
28
+ *
29
+ * This source code is licensed under the MIT license found in the
30
+ * LICENSE file in the root directory of this source tree.
31
+ */var Bi;function j1(){return Bi||(Bi=1,process.env.NODE_ENV!=="production"&&function(){function e(h){if(h==null)return null;if(typeof h=="function")return h.$$typeof===Ya?null:h.displayName||h.name||null;if(typeof h=="string")return h;switch(h){case ie:return"Fragment";case pt:return"Profiler";case Z:return"StrictMode";case Wa:return"Suspense";case qa:return"SuspenseList";case za:return"Activity"}if(typeof h=="object")switch(typeof h.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),h.$$typeof){case He:return"Portal";case Ga:return h.displayName||"Context";case dr:return(h._context.displayName||"Context")+".Consumer";case Ha:var w=h.render;return h=h.displayName,h||(h=w.displayName||w.name||"",h=h!==""?"ForwardRef("+h+")":"ForwardRef"),h;case Ka:return w=h.displayName||null,w!==null?w:e(h.type)||"Memo";case Jr:w=h._payload,h=h._init;try{return e(h(w))}catch{}}return null}function t(h){return""+h}function r(h){try{t(h);var w=!1}catch{w=!0}if(w){w=console;var N=w.error,H=typeof Symbol=="function"&&Symbol.toStringTag&&h[Symbol.toStringTag]||h.constructor.name||"Object";return N.call(w,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",H),t(h)}}function n(h){if(h===ie)return"<>";if(typeof h=="object"&&h!==null&&h.$$typeof===Jr)return"<...>";try{var w=e(h);return w?"<"+w+">":"<...>"}catch{return"<...>"}}function s(){var h=Qr.A;return h===null?null:h.getOwner()}function i(){return Error("react-stack-top-frame")}function o(h){if(Ps.call(h,"key")){var w=Object.getOwnPropertyDescriptor(h,"key").get;if(w&&w.isReactWarning)return!1}return h.key!==void 0}function a(h,w){function N(){Ms||(Ms=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",w))}N.isReactWarning=!0,Object.defineProperty(h,"key",{get:N,configurable:!0})}function c(){var h=e(this.type);return Is[h]||(Is[h]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),h=this.props.ref,h!==void 0?h:null}function l(h,w,N,H,pr,en){var W=N.ref;return h={$$typeof:P,type:h,key:w,props:N,_owner:H},(W!==void 0?W:null)!==null?Object.defineProperty(h,"ref",{enumerable:!1,get:c}):Object.defineProperty(h,"ref",{enumerable:!1,value:null}),h._store={},Object.defineProperty(h._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(h,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(h,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:pr}),Object.defineProperty(h,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:en}),Object.freeze&&(Object.freeze(h.props),Object.freeze(h)),h}function u(h,w,N,H,pr,en){var W=w.children;if(W!==void 0)if(H)if(Xa(W)){for(H=0;H<W.length;H++)f(W[H]);Object.freeze&&Object.freeze(W)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else f(W);if(Ps.call(w,"key")){W=e(h);var gt=Object.keys(w).filter(function($a){return $a!=="key"});H=0<gt.length?"{key: someKey, "+gt.join(": ..., ")+": ...}":"{key: someKey}",Fs[W+H]||(gt=0<gt.length?"{"+gt.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
32
+ let props = %s;
33
+ <%s {...props} />
34
+ React keys must be passed directly to JSX without using spread:
35
+ let props = %s;
36
+ <%s key={someKey} {...props} />`,H,W,gt,W),Fs[W+H]=!0)}if(W=null,N!==void 0&&(r(N),W=""+N),o(w)&&(r(w.key),W=""+w.key),"key"in w){N={};for(var tn in w)tn!=="key"&&(N[tn]=w[tn])}else N=w;return W&&a(N,typeof h=="function"?h.displayName||h.name||"Unknown":h),l(h,W,N,s(),pr,en)}function f(h){_(h)?h._store&&(h._store.validated=1):typeof h=="object"&&h!==null&&h.$$typeof===Jr&&(h._payload.status==="fulfilled"?_(h._payload.value)&&h._payload.value._store&&(h._payload.value._store.validated=1):h._store&&(h._store.validated=1))}function _(h){return typeof h=="object"&&h!==null&&h.$$typeof===P}var b=Ke,P=Symbol.for("react.transitional.element"),He=Symbol.for("react.portal"),ie=Symbol.for("react.fragment"),Z=Symbol.for("react.strict_mode"),pt=Symbol.for("react.profiler"),dr=Symbol.for("react.consumer"),Ga=Symbol.for("react.context"),Ha=Symbol.for("react.forward_ref"),Wa=Symbol.for("react.suspense"),qa=Symbol.for("react.suspense_list"),Ka=Symbol.for("react.memo"),Jr=Symbol.for("react.lazy"),za=Symbol.for("react.activity"),Ya=Symbol.for("react.client.reference"),Qr=b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ps=Object.prototype.hasOwnProperty,Xa=Array.isArray,Zr=console.createTask?console.createTask:function(){return null};b={react_stack_bottom_frame:function(h){return h()}};var Ms,Is={},xs=b.react_stack_bottom_frame.bind(b,i)(),Os=Zr(n(i)),Fs={};Yt.Fragment=ie,Yt.jsx=function(h,w,N){var H=1e4>Qr.recentlyCreatedOwnerStacks++;return u(h,w,N,!1,H?Error("react-stack-top-frame"):xs,H?Zr(n(h)):Os)},Yt.jsxs=function(h,w,N){var H=1e4>Qr.recentlyCreatedOwnerStacks++;return u(h,w,N,!0,H?Error("react-stack-top-frame"):xs,H?Zr(n(h)):Os)}}()),Yt}process.env.NODE_ENV==="production"?xn.exports=B1():xn.exports=j1();var be=xn.exports;const U1=({apiUrl:e,duration:t,onComplete:r,onError:n,classNames:s={},render:i,smileThreshold:o,blinkThreshold:a,minturnHeadThreshold:c,maxturnHeadThreshold:l})=>{var f;const u=Va({apiUrl:e,duration:t,smileThreshold:o,blinkThreshold:a,minturnHeadThreshold:c,maxturnHeadThreshold:l,onComplete:r,onError:n});return i?i(u):be.jsxs("div",{className:s.container,children:[u.status==="loading"&&be.jsx("div",{children:"Initializing..."}),["ready","capturing","verifying"].includes(u.status)&&be.jsxs(be.Fragment,{children:[be.jsx(Ja,{ref:u.webcamRef,mirrored:!0,screenshotFormat:"image/jpeg",className:s.webcam}),u.status==="capturing"&&be.jsx("div",{className:"liveness-challenge",children:u.isStepTransitioning?"Step verified! Get ready for the next...":`Do this: ${(f=u.sequence[u.currentStep])==null?void 0:f.replace("_"," ")}`}),["capturing","ready"].includes(u.status)&&be.jsxs("div",{className:s.timer,children:[u.timeLeft,"s"]}),u.status==="ready"&&be.jsx("button",{onClick:u.start,className:s.button,children:"Start Challenge"}),u.status==="verifying"&&be.jsx("div",{children:"Analyzing..."})]}),u.status==="error"&&be.jsxs("div",{className:s.error,children:[u.errorMsg,be.jsx("button",{onClick:u.reset,className:s.button,children:"Retry"})]}),u.status==="success"&&be.jsx("div",{className:s.success,children:"Verification Complete"})]})};exports.LivenessEngine=Ua;exports.LivenessSDK=U1;exports.useLiveness=Va;