@richard.fadiora/liveness-detection 4.1.0 → 4.2.1
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/dist/index.cjs.js +22 -15
- package/dist/index.d.ts +15 -29
- package/dist/index.es.js +486 -3735
- package/dist/index.umd.js +22 -15
- package/package.json +4 -2
package/dist/index.umd.js
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
(function(Pt,mt){typeof exports=="object"&&typeof module<"u"?mt(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],mt):(Pt=typeof globalThis<"u"?globalThis:Pt||self,mt(Pt.LivenessSDK={},Pt.React))})(this,function(Pt,mt){"use strict";const fs=async(t,e,n)=>{const r=new FormData;e.forEach((o,a)=>{r.append("files",o,`frame_${a}.jpg`)}),r.append("challenge",n);const s=await fetch(`${t}/v1/verify`,{method:"POST",body:r});if(!s.ok)throw new Error("Network response was not ok");return await s.json()},va=Object.freeze(Object.defineProperty({__proto__:null,verifyLiveness:fs},Symbol.toStringTag,{value:"Module"}));var oe=typeof self<"u"?self:{};function Ce(t,e){t:{for(var n=["CLOSURE_FLAGS"],r=oe,s=0;s<n.length;s++)if((r=r[n[s]])==null){n=null;break t}n=r}return(t=n&&n[t])!=null?t:e}function Kt(){throw Error("Invalid UTF8")}function ds(t,e){return e=String.fromCharCode.apply(null,e),t==null?e:t+e}let rn,jn;const wa=typeof TextDecoder<"u";let ba;const Aa=typeof TextEncoder<"u";function ps(t){if(Aa)t=(ba||(ba=new TextEncoder)).encode(t);else{let n=0;const r=new Uint8Array(3*t.length);for(let s=0;s<t.length;s++){var e=t.charCodeAt(s);if(e<128)r[n++]=e;else{if(e<2048)r[n++]=e>>6|192;else{if(e>=55296&&e<=57343){if(e<=56319&&s<t.length){const i=t.charCodeAt(++s);if(i>=56320&&i<=57343){e=1024*(e-55296)+i-56320+65536,r[n++]=e>>18|240,r[n++]=e>>12&63|128,r[n++]=e>>6&63|128,r[n++]=63&e|128;continue}s--}e=65533}r[n++]=e>>12|224,r[n++]=e>>6&63|128}r[n++]=63&e|128}}t=n===r.length?r:r.subarray(0,n)}return t}function gs(t){oe.setTimeout(()=>{throw t},0)}var Gn,Ea=Ce(610401301,!1),ms=Ce(748402147,!0),Vn=Ce(824648567,!0),Hn=Ce(824656860,Ce(1,!0));function ys(){var t=oe.navigator;return t&&(t=t.userAgent)?t:""}const _s=oe.navigator;function sn(t){return sn[" "](t),t}Gn=_s&&_s.userAgentData||null,sn[" "]=function(){};const vs={};let Be=null;function ka(t){const e=t.length;let n=3*e/4;n%3?n=Math.floor(n):"=.".indexOf(t[e-1])!=-1&&(n="=.".indexOf(t[e-2])!=-1?n-2:n-1);const r=new Uint8Array(n);let s=0;return function(i,o){function a(u){for(;c<i.length;){const h=i.charAt(c++),f=Be[h];if(f!=null)return f;if(!/^[\s\xa0]*$/.test(h))throw Error("Unknown base64 encoding at char: "+h)}return u}ws();let c=0;for(;;){const u=a(-1),h=a(0),f=a(64),_=a(64);if(_===64&&u===-1)break;o(u<<2|h>>4),f!=64&&(o(h<<4&240|f>>2),_!=64&&o(f<<6&192|_))}}(t,function(i){r[s++]=i}),s!==n?r.subarray(0,s):r}function ws(){if(!Be){Be={};var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),e=["+/=","+/","-_=","-_.","-_"];for(let n=0;n<5;n++){const r=t.concat(e[n].split(""));vs[n]=r;for(let s=0;s<r.length;s++){const i=r[s];Be[i]===void 0&&(Be[i]=s)}}}}var Sa=typeof Uint8Array<"u",bs=!(!(Ea&&Gn&&Gn.brands.length>0)&&(ys().indexOf("Trident")!=-1||ys().indexOf("MSIE")!=-1))&&typeof btoa=="function";const As=/[-_.]/g,Ta={"-":"+",_:"/",".":"="};function La(t){return Ta[t]||""}function Es(t){if(!bs)return ka(t);t=As.test(t)?t.replace(As,La):t,t=atob(t);const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}function Wn(t){return Sa&&t!=null&&t instanceof Uint8Array}var ae={};function zt(){return Fa||(Fa=new bt(null,ae))}function Kn(t){ks(ae);var e=t.g;return(e=e==null||Wn(e)?e:typeof e=="string"?Es(e):null)==null?e:t.g=e}var bt=class{h(){return new Uint8Array(Kn(this)||0)}constructor(t,e){if(ks(e),this.g=t,t!=null&&t.length===0)throw Error("ByteString should be constructed with non-empty values")}};let Fa,Ma;function ks(t){if(t!==ae)throw Error("illegal external caller")}function Ss(t,e){t.__closure__error__context__984382||(t.__closure__error__context__984382={}),t.__closure__error__context__984382.severity=e}function zn(t){return Ss(t=Error(t),"warning"),t}function ce(t,e){if(t!=null){var n=Ma??(Ma={}),r=n[t]||0;r>=e||(n[t]=r+1,Ss(t=Error(),"incident"),gs(t))}}function he(){return typeof BigInt=="function"}var ue=typeof Symbol=="function"&&typeof Symbol()=="symbol";function At(t,e,n=!1){return typeof Symbol=="function"&&typeof Symbol()=="symbol"?n&&Symbol.for&&t?Symbol.for(t):t!=null?Symbol(t):Symbol():e}var Pa=At("jas",void 0,!0),Ts=At(void 0,"0di"),De=At(void 0,"1oa"),Q=At(void 0,Symbol()),Oa=At(void 0,"0ub"),Ia=At(void 0,"0ubs"),qn=At(void 0,"0ubsb"),xa=At(void 0,"0actk"),le=At("m_m","Pa",!0),Ls=At();const Fs={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},Ms=Object.defineProperties,d=ue?Pa:"Ga";var qt;const Ps=[];function Ue(t,e){ue||d in t||Ms(t,Fs),t[d]|=e}function j(t,e){ue||d in t||Ms(t,Fs),t[d]=e}function je(t){return Ue(t,34),t}function Ge(t){return Ue(t,8192),t}j(Ps,7),qt=Object.freeze(Ps);var fe={};function tt(t,e){return e===void 0?t.h!==Xt&&!!(2&(0|t.v[d])):!!(2&e)&&t.h!==Xt}const Xt={};function Xn(t,e){if(t!=null){if(typeof t=="string")t=t?new bt(t,ae):zt();else if(t.constructor!==bt)if(Wn(t))t=t.length?new bt(new Uint8Array(t),ae):zt();else{if(!e)throw Error();t=void 0}}return t}class Os{constructor(e,n,r){this.g=e,this.h=n,this.l=r}next(){const e=this.g.next();return e.done||(e.value=this.h.call(this.l,e.value)),e}[Symbol.iterator](){return this}}var Na=Object.freeze({});function Is(t,e,n){const r=128&e?0:-1,s=t.length;var i;(i=!!s)&&(i=(i=t[s-1])!=null&&typeof i=="object"&&i.constructor===Object);const o=s+(i?-1:0);for(e=128&e?1:0;e<o;e++)n(e-r,t[e]);if(i){t=t[s-1];for(const a in t)!isNaN(a)&&n(+a,t[a])}}var xs={};function de(t){return 128&t?xs:void 0}function on(t){return t.Na=!0,t}var Ra=on(t=>typeof t=="number"),Ns=on(t=>typeof t=="string"),Ca=on(t=>typeof t=="boolean"),an=typeof oe.BigInt=="function"&&typeof oe.BigInt(0)=="bigint";function et(t){var e=t;if(Ns(e)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(e))throw Error(String(e))}else if(Ra(e)&&!Number.isSafeInteger(e))throw Error(String(e));return an?BigInt(t):t=Ca(t)?t?"1":"0":Ns(t)?t.trim()||"0":String(t)}var Yn=on(t=>an?t>=Da&&t<=ja:t[0]==="-"?Rs(t,Ba):Rs(t,Ua));const Ba=Number.MIN_SAFE_INTEGER.toString(),Da=an?BigInt(Number.MIN_SAFE_INTEGER):void 0,Ua=Number.MAX_SAFE_INTEGER.toString(),ja=an?BigInt(Number.MAX_SAFE_INTEGER):void 0;function Rs(t,e){if(t.length>e.length)return!1;if(t.length<e.length||t===e)return!0;for(let n=0;n<t.length;n++){const r=t[n],s=e[n];if(r>s)return!1;if(r<s)return!0}}const Ga=typeof Uint8Array.prototype.slice=="function";let Va,M=0,B=0;function Cs(t){const e=t>>>0;M=e,B=(t-e)/4294967296>>>0}function pe(t){if(t<0){Cs(-t);const[e,n]=tr(M,B);M=e>>>0,B=n>>>0}else Cs(t)}function $n(t){const e=Va||(Va=new DataView(new ArrayBuffer(8)));e.setFloat32(0,+t,!0),B=0,M=e.getUint32(0,!0)}function Jn(t,e){const n=4294967296*e+(t>>>0);return Number.isSafeInteger(n)?n:Ve(t,e)}function Ha(t,e){return et(he()?BigInt.asUintN(64,(BigInt(e>>>0)<<BigInt(32))+BigInt(t>>>0)):Ve(t,e))}function Zn(t,e){const n=2147483648&e;return n&&(e=~e>>>0,(t=1+~t>>>0)==0&&(e=e+1>>>0)),typeof(t=Jn(t,e))=="number"?n?-t:t:n?"-"+t:t}function Bs(t,e){return he()?et(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(e))<<BigInt(32))+BigInt.asUintN(32,BigInt(t)))):et(Qn(t,e))}function Ve(t,e){if(t>>>=0,(e>>>=0)<=2097151)var n=""+(4294967296*e+t);else he()?n=""+(BigInt(e)<<BigInt(32)|BigInt(t)):(t=(16777215&t)+6777216*(n=16777215&(t>>>24|e<<8))+6710656*(e=e>>16&65535),n+=8147497*e,e*=2,t>=1e7&&(n+=t/1e7>>>0,t%=1e7),n>=1e7&&(e+=n/1e7>>>0,n%=1e7),n=e+Ds(n)+Ds(t));return n}function Ds(t){return t=String(t),"0000000".slice(t.length)+t}function Qn(t,e){if(2147483648&e)if(he())t=""+(BigInt(0|e)<<BigInt(32)|BigInt(t>>>0));else{const[n,r]=tr(t,e);t="-"+Ve(n,r)}else t=Ve(t,e);return t}function cn(t){if(t.length<16)pe(Number(t));else if(he())t=BigInt(t),M=Number(t&BigInt(4294967295))>>>0,B=Number(t>>BigInt(32)&BigInt(4294967295));else{const e=+(t[0]==="-");B=M=0;const n=t.length;for(let r=e,s=(n-e)%6+e;s<=n;r=s,s+=6){const i=Number(t.slice(r,s));B*=1e6,M=1e6*M+i,M>=4294967296&&(B+=Math.trunc(M/4294967296),B>>>=0,M>>>=0)}if(e){const[r,s]=tr(M,B);M=r,B=s}}}function tr(t,e){return e=~e,t?t=1+~t:e+=1,[t,e]}function yt(t){return Array.prototype.slice.call(t)}const He=typeof BigInt=="function"?BigInt.asIntN:void 0,Wa=typeof BigInt=="function"?BigInt.asUintN:void 0,Yt=Number.isSafeInteger,hn=Number.isFinite,ge=Math.trunc,Ka=et(0);function We(t){if(t!=null&&typeof t!="number")throw Error(`Value of float/double field must be a number, found ${typeof t}: ${t}`);return t}function Et(t){return t==null||typeof t=="number"?t:t==="NaN"||t==="Infinity"||t==="-Infinity"?Number(t):void 0}function Ke(t){if(t!=null&&typeof t!="boolean"){var e=typeof t;throw Error(`Expected boolean but got ${e!="object"?e:t?Array.isArray(t)?"array":e:"null"}: ${t}`)}return t}function Us(t){return t==null||typeof t=="boolean"?t:typeof t=="number"?!!t:void 0}const za=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function ze(t){switch(typeof t){case"bigint":return!0;case"number":return hn(t);case"string":return za.test(t);default:return!1}}function me(t){if(t==null)return t;if(typeof t=="string"&&t)t=+t;else if(typeof t!="number")return;return hn(t)?0|t:void 0}function js(t){if(t==null)return t;if(typeof t=="string"&&t)t=+t;else if(typeof t!="number")return;return hn(t)?t>>>0:void 0}function Gs(t){const e=t.length;return(t[0]==="-"?e<20||e===20&&t<="-9223372036854775808":e<19||e===19&&t<="9223372036854775807")?t:(cn(t),Qn(M,B))}function er(t){return t=ge(t),Yt(t)||(pe(t),t=Zn(M,B)),t}function Vs(t){var e=ge(Number(t));return Yt(e)?String(e):((e=t.indexOf("."))!==-1&&(t=t.substring(0,e)),Gs(t))}function Hs(t){var e=ge(Number(t));return Yt(e)?et(e):((e=t.indexOf("."))!==-1&&(t=t.substring(0,e)),he()?et(He(64,BigInt(t))):et(Gs(t)))}function Ws(t){return Yt(t)?t=et(er(t)):(t=ge(t),Yt(t)?t=String(t):(pe(t),t=Qn(M,B)),t=et(t)),t}function qa(t){return t==null?t:typeof t=="bigint"?(Yn(t)?t=Number(t):(t=He(64,t),t=Yn(t)?Number(t):String(t)),t):ze(t)?typeof t=="number"?er(t):Vs(t):void 0}function un(t){const e=typeof t;return t==null?t:e==="bigint"?et(He(64,t)):ze(t)?e==="string"?Hs(t):Ws(t):void 0}function Ks(t){if(typeof t!="string")throw Error();return t}function qe(t){if(t!=null&&typeof t!="string")throw Error();return t}function q(t){return t==null||typeof t=="string"?t:void 0}function nr(t,e,n,r){return t!=null&&t[le]===fe?t:Array.isArray(t)?((r=(n=0|t[d])|32&r|2&r)!==n&&j(t,r),new e(t)):(n?2&r?((t=e[Ts])||(je((t=new e).v),t=e[Ts]=t),e=t):e=new e:e=void 0,e)}function Xa(t,e,n){if(e)t:{if(!ze(e=t))throw zn("int64");switch(typeof e){case"string":e=Hs(e);break t;case"bigint":e=et(He(64,e));break t;default:e=Ws(e)}}else e=un(t);return(t=e)==null?n?Ka:void 0:t}const Ya={};let $a=function(){try{return sn(new class extends Map{constructor(){super()}}),!1}catch{return!0}}();class rr{constructor(){this.g=new Map}get(e){return this.g.get(e)}set(e,n){return this.g.set(e,n),this.size=this.g.size,this}delete(e){return e=this.g.delete(e),this.size=this.g.size,e}clear(){this.g.clear(),this.size=this.g.size}has(e){return this.g.has(e)}entries(){return this.g.entries()}keys(){return this.g.keys()}values(){return this.g.values()}forEach(e,n){return this.g.forEach(e,n)}[Symbol.iterator](){return this.entries()}}const Ja=$a?(Object.setPrototypeOf(rr.prototype,Map.prototype),Object.defineProperties(rr.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),rr):class extends Map{constructor(){super()}};function zs(t){return t}function sr(t){if(2&t.J)throw Error("Cannot mutate an immutable Map")}var Ot=class extends Ja{constructor(t,e,n=zs,r=zs){super(),this.J=0|t[d],this.K=e,this.S=n,this.fa=this.K?Za:r;for(let s=0;s<t.length;s++){const i=t[s],o=n(i[0],!1,!0);let a=i[1];e?a===void 0&&(a=null):a=r(i[1],!1,!0,void 0,void 0,this.J),super.set(o,a)}}V(t){return Ge(Array.from(super.entries(),t))}clear(){sr(this),super.clear()}delete(t){return sr(this),super.delete(this.S(t,!0,!1))}entries(){if(this.K){var t=super.keys();t=new Os(t,Qa,this)}else t=super.entries();return t}values(){if(this.K){var t=super.keys();t=new Os(t,Ot.prototype.get,this)}else t=super.values();return t}forEach(t,e){this.K?super.forEach((n,r,s)=>{t.call(e,s.get(r),r,s)}):super.forEach(t,e)}set(t,e){return sr(this),(t=this.S(t,!0,!1))==null?this:e==null?(super.delete(t),this):super.set(t,this.fa(e,!0,!0,this.K,!1,this.J))}Ma(t){const e=this.S(t[0],!1,!0);t=t[1],t=this.K?t===void 0?null:t:this.fa(t,!1,!0,void 0,!1,this.J),super.set(e,t)}has(t){return super.has(this.S(t,!1,!1))}get(t){t=this.S(t,!1,!1);const e=super.get(t);if(e!==void 0){var n=this.K;return n?((n=this.fa(e,!1,!0,n,this.ra,this.J))!==e&&super.set(t,n),n):e}}[Symbol.iterator](){return this.entries()}};function Za(t,e,n,r,s,i){return t=nr(t,r,n,i),s&&(t=ar(t)),t}function Qa(t){return[t,this.get(t)]}let t2;function qs(){return t2||(t2=new Ot(je([]),void 0,void 0,void 0,Ya))}function ln(t){return Q?t[Q]:void 0}function fn(t,e){for(const n in t)!isNaN(n)&&e(t,+n,t[n])}Ot.prototype.toJSON=void 0;var ir=class{};const e2={Ka:!0};function n2(t,e){e<100||ce(Ia,1)}function dn(t,e,n,r){const s=r!==void 0;r=!!r;var i,o=Q;!s&&ue&&o&&(i=t[o])&&fn(i,n2),o=[];var a=t.length;let c;i=4294967295;let u=!1;const h=!!(64&e),f=h?128&e?0:-1:void 0;1&e||(c=a&&t[a-1],c!=null&&typeof c=="object"&&c.constructor===Object?i=--a:c=void 0,!h||128&e||s||(u=!0,i=i-f+f)),e=void 0;for(var _=0;_<a;_++){let v=t[_];if(v!=null&&(v=n(v,r))!=null)if(h&&_>=i){const x=_-f;(e??(e={}))[x]=v}else o[_]=v}if(c)for(let v in c){if((a=c[v])==null||(a=n(a,r))==null)continue;let x;_=+v,h&&!Number.isNaN(_)&&(x=_+f)<i?o[x]=a:(e??(e={}))[v]=a}return e&&(u?o.push(e):o[i]=e),s&&Q&&(t=ln(t))&&t instanceof ir&&(o[Q]=function(v){const x=new ir;return fn(v,(us,Re,nn)=>{x[Re]=yt(nn)}),x.da=v.da,x}(t)),o}function r2(t){return t[0]=Xe(t[0]),t[1]=Xe(t[1]),t}function Xe(t){switch(typeof t){case"number":return Number.isFinite(t)?t:""+t;case"bigint":return Yn(t)?Number(t):""+t;case"boolean":return t?1:0;case"object":if(Array.isArray(t)){var e=0|t[d];return t.length===0&&1&e?void 0:dn(t,e,Xe)}if(t!=null&&t[le]===fe)return Xs(t);if(t instanceof bt){if((e=t.g)==null)t="";else if(typeof e=="string")t=e;else{if(bs){for(var n="",r=0,s=e.length-10240;r<s;)n+=String.fromCharCode.apply(null,e.subarray(r,r+=10240));n+=String.fromCharCode.apply(null,r?e.subarray(r):e),e=btoa(n)}else{n===void 0&&(n=0),ws(),n=vs[n],r=Array(Math.floor(e.length/3)),s=n[64]||"";let u=0,h=0;for(;u<e.length-2;u+=3){var i=e[u],o=e[u+1],a=e[u+2],c=n[i>>2];i=n[(3&i)<<4|o>>4],o=n[(15&o)<<2|a>>6],a=n[63&a],r[h++]=c+i+o+a}switch(c=0,a=s,e.length-u){case 2:a=n[(15&(c=e[u+1]))<<2]||s;case 1:e=e[u],r[h]=n[e>>2]+n[(3&e)<<4|c>>4]+a+s}e=r.join("")}t=t.g=e}return t}return t instanceof Ot?t=t.size!==0?t.V(r2):void 0:void 0}return t}function Xs(t){return dn(t=t.v,0|t[d],Xe)}let s2,i2;function $t(t,e){return Ys(t,e[0],e[1])}function Ys(t,e,n,r=0){if(t==null){var s=32;n?(t=[n],s|=128):t=[],e&&(s=-16760833&s|(1023&e)<<14)}else{if(!Array.isArray(t))throw Error("narr");if(s=0|t[d],ms&&1&s)throw Error("rfarr");if(2048&s&&!(2&s)&&function(){if(ms)throw Error("carr");ce(xa,5)}(),256&s)throw Error("farr");if(64&s)return(s|r)!==s&&j(t,s|r),t;if(n&&(s|=128,n!==t[0]))throw Error("mid");t:{s|=64;var i=(n=t).length;if(i){var o=i-1;const c=n[o];if(c!=null&&typeof c=="object"&&c.constructor===Object){if((o-=e=128&s?0:-1)>=1024)throw Error("pvtlmt");for(var a in c)(i=+a)<o&&(n[i+e]=c[a],delete c[a]);s=-16760833&s|(1023&o)<<14;break t}}if(e){if((a=Math.max(e,i-(128&s?0:-1)))>1024)throw Error("spvt");s=-16760833&s|(1023&a)<<14}}}return j(t,64|s|r),t}function o2(t,e){if(typeof t!="object")return t;if(Array.isArray(t)){var n=0|t[d];return t.length===0&&1&n?void 0:$s(t,n,e)}if(t!=null&&t[le]===fe)return Js(t);if(t instanceof Ot){if(2&(e=t.J))return t;if(!t.size)return;if(n=je(t.V()),t.K)for(t=0;t<n.length;t++){const r=n[t];let s=r[1];s=s==null||typeof s!="object"?void 0:s!=null&&s[le]===fe?Js(s):Array.isArray(s)?$s(s,0|s[d],!!(32&e)):void 0,r[1]=s}return n}return t instanceof bt?t:void 0}function $s(t,e,n){return 2&e||(!n||4096&e||16&e?t=ye(t,e,!1,n&&!(16&e)):(Ue(t,34),4&e&&Object.freeze(t))),t}function or(t,e,n){return t=new t.constructor(e),n&&(t.h=Xt),t.m=Xt,t}function Js(t){const e=t.v,n=0|e[d];return tt(t,n)?t:cr(t,e,n)?or(t,e):ye(e,n)}function ye(t,e,n,r){return r??(r=!!(34&e)),t=dn(t,e,o2,r),r=32,n&&(r|=2),j(t,e=16769217&e|r),t}function ar(t){const e=t.v,n=0|e[d];return tt(t,n)?cr(t,e,n)?or(t,e,!0):new t.constructor(ye(e,n,!1)):t}function _e(t){if(t.h!==Xt)return!1;var e=t.v;return Ue(e=ye(e,0|e[d]),2048),t.v=e,t.h=void 0,t.m=void 0,!0}function ve(t){if(!_e(t)&&tt(t,0|t.v[d]))throw Error()}function Jt(t,e){e===void 0&&(e=0|t[d]),32&e&&!(4096&e)&&j(t,4096|e)}function cr(t,e,n){return!!(2&n)||!(!(32&n)||4096&n)&&(j(e,2|n),t.h=Xt,!0)}const a2=et(0),Bt={};function T(t,e,n,r,s){if((e=It(t.v,e,n,s))!==null||r&&t.m!==Xt)return e}function It(t,e,n,r){if(e===-1)return null;const s=e+(n?0:-1),i=t.length-1;let o,a;if(!(i<1+(n?0:-1))){if(s>=i)if(o=t[i],o!=null&&typeof o=="object"&&o.constructor===Object)n=o[e],a=!0;else{if(s!==i)return;n=o}else n=t[s];if(r&&n!=null){if((r=r(n))==null)return r;if(!Object.is(r,n))return a?o[e]=r:t[s]=r,r}return n}}function k(t,e,n,r){ve(t),G(t=t.v,0|t[d],e,n,r)}function G(t,e,n,r,s){const i=n+(s?0:-1);var o=t.length-1;if(o>=1+(s?0:-1)&&i>=o){const a=t[o];if(a!=null&&typeof a=="object"&&a.constructor===Object)return a[n]=r,e}return i<=o?(t[i]=r,e):(r!==void 0&&(n>=(o=(e??(e=0|t[d]))>>14&1023||536870912)?r!=null&&(t[o+(s?0:-1)]={[n]:r}):t[i]=r),e)}function Zt(){return Na===void 0?2:4}function Qt(t,e,n,r,s){let i=t.v,o=0|i[d];r=tt(t,o)?1:r,s=!!s||r===3,r===2&&_e(t)&&(i=t.v,o=0|i[d]);let a=(t=hr(i,e))===qt?7:0|t[d],c=ur(a,o);var u=!(4&c);if(u){4&c&&(t=yt(t),a=0,c=ee(c,o),o=G(i,o,e,t));let h=0,f=0;for(;h<t.length;h++){const _=n(t[h]);_!=null&&(t[f++]=_)}f<h&&(t.length=f),n=-513&(4|c),c=n&=-1025,c&=-4097}return c!==a&&(j(t,c),2&c&&Object.freeze(t)),Zs(t,c,i,o,e,r,u,s)}function Zs(t,e,n,r,s,i,o,a){let c=e;return i===1||i===4&&(2&e||!(16&e)&&32&r)?te(e)||((e|=!t.length||o&&!(4096&e)||32&r&&!(4096&e||16&e)?2:256)!==c&&j(t,e),Object.freeze(t)):(i===2&&te(e)&&(t=yt(t),c=0,e=ee(e,r),r=G(n,r,s,t)),te(e)||(a||(e|=16),e!==c&&j(t,e))),2&e||!(4096&e||16&e)||Jt(n,r),t}function hr(t,e,n){return t=It(t,e,n),Array.isArray(t)?t:qt}function ur(t,e){return 2&e&&(t|=2),1|t}function te(t){return!!(2&t)&&!!(4&t)||!!(256&t)}function Qs(t){return Xn(t,!0)}function ti(t){t=yt(t);for(let e=0;e<t.length;e++){const n=t[e]=yt(t[e]);Array.isArray(n[1])&&(n[1]=je(n[1]))}return Ge(t)}function Dt(t,e,n,r){ve(t),G(t=t.v,0|t[d],e,(r==="0"?Number(n)===0:n===r)?void 0:n)}function we(t,e,n){if(2&e)throw Error();const r=de(e);let s=hr(t,n,r),i=s===qt?7:0|s[d],o=ur(i,e);return(2&o||te(o)||16&o)&&(o===i||te(o)||j(s,o),s=yt(s),i=0,o=ee(o,e),G(t,e,n,s,r)),o&=-13,o!==i&&j(s,o),s}function lr(t,e){var n=oo;return dr(fr(t=t.v),t,void 0,n)===e?e:-1}function fr(t){if(ue)return t[De]??(t[De]=new Map);if(De in t)return t[De];const e=new Map;return Object.defineProperty(t,De,{value:e}),e}function ei(t,e,n,r,s){const i=fr(t),o=dr(i,t,e,n,s);return o!==r&&(o&&(e=G(t,e,o,void 0,s)),i.set(n,r)),e}function dr(t,e,n,r,s){let i=t.get(r);if(i!=null)return i;i=0;for(let o=0;o<r.length;o++){const a=r[o];It(e,a,s)!=null&&(i!==0&&(n=G(e,n,i,void 0,s)),i=a)}return t.set(r,i),i}function pr(t,e,n){let r=0|t[d];const s=de(r),i=It(t,n,s);let o;if(i!=null&&i[le]===fe){if(!tt(i))return _e(i),i.v;o=i.v}else Array.isArray(i)&&(o=i);if(o){const a=0|o[d];2&a&&(o=ye(o,a))}return o=$t(o,e),o!==i&&G(t,r,n,o,s),o}function ni(t,e,n,r,s){let i=!1;if((r=It(t,r,s,o=>{const a=nr(o,n,!1,e);return i=a!==o&&a!=null,a}))!=null)return i&&!tt(r)&&Jt(t,e),r}function A(t,e,n,r){let s=t.v,i=0|s[d];if((e=ni(s,i,e,n,r))==null)return e;if(i=0|s[d],!tt(t,i)){const o=ar(e);o!==e&&(_e(t)&&(s=t.v,i=0|s[d]),i=G(s,i,n,e=o,r),Jt(s,i))}return e}function ri(t,e,n,r,s,i,o,a){var c=tt(t,n);i=c?1:i,o=!!o||i===3,c=a&&!c,(i===2||c)&&_e(t)&&(n=0|(e=t.v)[d]);var u=(t=hr(e,s))===qt?7:0|t[d],h=ur(u,n);if(a=!(4&h)){var f=t,_=n;const v=!!(2&h);v&&(_|=2);let x=!v,us=!0,Re=0,nn=0;for(;Re<f.length;Re++){const ls=nr(f[Re],r,!1,_);if(ls instanceof r){if(!v){const _a=tt(ls);x&&(x=!_a),us&&(us=_a)}f[nn++]=ls}}nn<Re&&(f.length=nn),h|=4,h=us?-4097&h:4096|h,h=x?8|h:-9&h}if(h!==u&&(j(t,h),2&h&&Object.freeze(t)),c&&!(8&h||!t.length&&(i===1||i===4&&(2&h||!(16&h)&&32&n)))){for(te(h)&&(t=yt(t),h=ee(h,n),n=G(e,n,s,t)),r=t,c=h,u=0;u<r.length;u++)(f=r[u])!==(h=ar(f))&&(r[u]=h);c|=8,j(t,h=c=r.length?4096|c:-4097&c)}return Zs(t,h,e,n,s,i,a,o)}function xt(t,e,n){const r=t.v;return ri(t,r,0|r[d],e,n,Zt(),!1,!0)}function si(t){return t==null&&(t=void 0),t}function y(t,e,n,r,s){return k(t,n,r=si(r),s),r&&!tt(r)&&Jt(t.v),t}function Ye(t,e,n,r){t:{var s=r=si(r);ve(t);const i=t.v;let o=0|i[d];if(s==null){const a=fr(i);if(dr(a,i,o,n)!==e)break t;a.set(n,0)}else o=ei(i,o,n,e);G(i,o,e,s)}r&&!tt(r)&&Jt(t.v)}function ee(t,e){return-273&(2&e?2|t:-3&t)}function gr(t,e,n,r){var s=r;ve(t),t=ri(t,r=t.v,0|r[d],n,e,2,!0),s=s??new n,t.push(s),e=n=t===qt?7:0|t[d],(s=tt(s))?(n&=-9,t.length===1&&(n&=-4097)):n|=4096,n!==e&&j(t,n),s||Jt(r)}function ut(t,e,n){return me(T(t,e,void 0,n))}function ii(t){return(Hn?T(t,2,void 0,void 0,un):un(T(t,2)))??a2}function N(t,e){return T(t,e,void 0,void 0,Et)??0}function Nt(t,e,n){if(n!=null){if(typeof n!="number"||!hn(n))throw zn("int32");n|=0}k(t,e,n)}function m(t,e,n){k(t,e,We(n))}function nt(t,e,n){Dt(t,e,qe(n),"")}function pn(t,e,n){{ve(t);const o=t.v;let a=0|o[d];if(n==null)G(o,a,e);else{var r=t=n===qt?7:0|n[d],s=te(t),i=s||Object.isFrozen(n);for(s||(t=0),i||(n=yt(n),r=0,t=ee(t,a),i=!1),t|=5,t|=(4&t?512&t?512:1024&t?1024:0:void 0)??(Hn?1024:0),s=0;s<n.length;s++){const c=n[s],u=Ks(c);Object.is(c,u)||(i&&(n=yt(n),r=0,t=ee(t,a),i=!1),n[s]=u)}t!==r&&(i&&(n=yt(n),t=ee(t,a)),j(n,t)),G(o,a,e,n)}}}function gn(t,e,n){ve(t),Qt(t,e,q,2,!0).push(Ks(n))}var be=class{constructor(t,e,n){if(this.buffer=t,n&&!e)throw Error();this.g=e}};function mr(t,e){if(typeof t=="string")return new be(Es(t),e);if(Array.isArray(t))return new be(new Uint8Array(t),e);if(t.constructor===Uint8Array)return new be(t,!1);if(t.constructor===ArrayBuffer)return t=new Uint8Array(t),new be(t,!1);if(t.constructor===bt)return e=Kn(t)||new Uint8Array(0),new be(e,!0,t);if(t instanceof Uint8Array)return t=t.constructor===Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new be(t,!1);throw Error()}function Ae(t,e){let n,r=0,s=0,i=0;const o=t.h;let a=t.g;do n=o[a++],r|=(127&n)<<i,i+=7;while(i<32&&128&n);if(i>32)for(s|=(127&n)>>4,i=3;i<32&&128&n;i+=7)n=o[a++],s|=(127&n)<<i;if(ne(t,a),!(128&n))return e(r>>>0,s>>>0);throw Error()}function yr(t){let e=0,n=t.g;const r=n+10,s=t.h;for(;n<r;){const i=s[n++];if(e|=i,(128&i)==0)return ne(t,n),!!(127&e)}throw Error()}function Ut(t){const e=t.h;let n=t.g,r=e[n++],s=127&r;if(128&r&&(r=e[n++],s|=(127&r)<<7,128&r&&(r=e[n++],s|=(127&r)<<14,128&r&&(r=e[n++],s|=(127&r)<<21,128&r&&(r=e[n++],s|=r<<28,128&r&&128&e[n++]&&128&e[n++]&&128&e[n++]&&128&e[n++]&&128&e[n++])))))throw Error();return ne(t,n),s}function Rt(t){return Ut(t)>>>0}function mn(t){var e=t.h;const n=t.g;var r=e[n],s=e[n+1];const i=e[n+2];return e=e[n+3],ne(t,t.g+4),t=2*((s=(r<<0|s<<8|i<<16|e<<24)>>>0)>>31)+1,r=s>>>23&255,s&=8388607,r==255?s?NaN:t*(1/0):r==0?1401298464324817e-60*t*s:t*Math.pow(2,r-150)*(s+8388608)}function c2(t){return Ut(t)}function ne(t,e){if(t.g=e,e>t.l)throw Error()}function oi(t,e){if(e<0)throw Error();const n=t.g;if((e=n+e)>t.l)throw Error();return t.g=e,n}function ai(t,e){if(e==0)return zt();var n=oi(t,e);return t.Y&&t.j?n=t.h.subarray(n,n+e):(t=t.h,n=n===(e=n+e)?new Uint8Array(0):Ga?t.slice(n,e):new Uint8Array(t.subarray(n,e))),n.length==0?zt():new bt(n,ae)}var ci=[];function hi(t,e,n,r){if(vn.length){const s=vn.pop();return s.o(r),s.g.init(t,e,n,r),s}return new h2(t,e,n,r)}function ui(t){t.g.clear(),t.l=-1,t.h=-1,vn.length<100&&vn.push(t)}function li(t){var e=t.g;if(e.g==e.l)return!1;t.m=t.g.g;var n=Rt(t.g);if(e=n>>>3,!((n&=7)>=0&&n<=5)||e<1)throw Error();return t.l=e,t.h=n,!0}function yn(t){switch(t.h){case 0:t.h!=0?yn(t):yr(t.g);break;case 1:ne(t=t.g,t.g+8);break;case 2:if(t.h!=2)yn(t);else{var e=Rt(t.g);ne(t=t.g,t.g+e)}break;case 5:ne(t=t.g,t.g+4);break;case 3:for(e=t.l;;){if(!li(t))throw Error();if(t.h==4){if(t.l!=e)throw Error();break}yn(t)}break;default:throw Error()}}function $e(t,e,n){const r=t.g.l;var s=Rt(t.g);let i=(s=t.g.g+s)-r;if(i<=0&&(t.g.l=s,n(e,t,void 0,void 0,void 0),i=s-t.g.g),i)throw Error();return t.g.g=s,t.g.l=r,e}function _r(t){var e=Rt(t.g),n=oi(t=t.g,e);if(t=t.h,wa){var r,s=t;(r=jn)||(r=jn=new TextDecoder("utf-8",{fatal:!0})),e=n+e,s=n===0&&e===s.length?s:s.subarray(n,e);try{var i=r.decode(s)}catch(a){if(rn===void 0){try{r.decode(new Uint8Array([128]))}catch{}try{r.decode(new Uint8Array([97])),rn=!0}catch{rn=!1}}throw!rn&&(jn=void 0),a}}else{e=(i=n)+e,n=[];let a,c=null;for(;i<e;){var o=t[i++];o<128?n.push(o):o<224?i>=e?Kt():(a=t[i++],o<194||(192&a)!=128?(i--,Kt()):n.push((31&o)<<6|63&a)):o<240?i>=e-1?Kt():(a=t[i++],(192&a)!=128||o===224&&a<160||o===237&&a>=160||(192&(r=t[i++]))!=128?(i--,Kt()):n.push((15&o)<<12|(63&a)<<6|63&r)):o<=244?i>=e-2?Kt():(a=t[i++],(192&a)!=128||a-144+(o<<28)>>30||(192&(r=t[i++]))!=128||(192&(s=t[i++]))!=128?(i--,Kt()):(o=(7&o)<<18|(63&a)<<12|(63&r)<<6|63&s,o-=65536,n.push(55296+(o>>10&1023),56320+(1023&o)))):Kt(),n.length>=8192&&(c=ds(c,n),n.length=0)}i=ds(c,n)}return i}function fi(t){const e=Rt(t.g);return ai(t.g,e)}function _n(t,e,n){var r=Rt(t.g);for(r=t.g.g+r;t.g.g<r;)n.push(e(t.g))}var h2=class{constructor(t,e,n,r){if(ci.length){const s=ci.pop();s.init(t,e,n,r),t=s}else t=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=mr(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}}(t,e,n,r);this.g=t,this.m=this.g.g,this.h=this.l=-1,this.o(r)}o({ha:t=!1}={}){this.ha=t}},vn=[];function di(t){return t?/^\d+$/.test(t)?(cn(t),new vr(M,B)):null:u2||(u2=new vr(0,0))}var vr=class{constructor(t,e){this.h=t>>>0,this.g=e>>>0}};let u2;function pi(t){return t?/^-?\d+$/.test(t)?(cn(t),new wr(M,B)):null:l2||(l2=new wr(0,0))}var wr=class{constructor(t,e){this.h=t>>>0,this.g=e>>>0}};let l2;function Ee(t,e,n){for(;n>0||e>127;)t.g.push(127&e|128),e=(e>>>7|n<<25)>>>0,n>>>=7;t.g.push(e)}function ke(t,e){for(;e>127;)t.g.push(127&e|128),e>>>=7;t.g.push(e)}function wn(t,e){if(e>=0)ke(t,e);else{for(let n=0;n<9;n++)t.g.push(127&e|128),e>>=7;t.g.push(1)}}function br(t){var e=M;t.g.push(e>>>0&255),t.g.push(e>>>8&255),t.g.push(e>>>16&255),t.g.push(e>>>24&255)}function Se(t,e){e.length!==0&&(t.l.push(e),t.h+=e.length)}function lt(t,e,n){ke(t.g,8*e+n)}function Ar(t,e){return lt(t,e,2),e=t.g.end(),Se(t,e),e.push(t.h),e}function Er(t,e){var n=e.pop();for(n=t.h+t.g.length()-n;n>127;)e.push(127&n|128),n>>>=7,t.h++;e.push(n),t.h++}function bn(t,e,n){lt(t,e,2),ke(t.g,n.length),Se(t,t.g.end()),Se(t,n)}function An(t,e,n,r){n!=null&&(e=Ar(t,e),r(n,t),Er(t,e))}function kt(){const t=class{constructor(){throw Error()}};return Object.setPrototypeOf(t,t.prototype),t}var kr=kt(),gi=kt(),Sr=kt(),Tr=kt(),mi=kt(),yi=kt(),f2=kt(),En=kt(),_i=kt(),vi=kt();function St(t,e,n){var r=t.v;Q&&Q in r&&(r=r[Q])&&delete r[e.g],e.h?e.j(t,e.h,e.g,n,e.l):e.j(t,e.g,n,e.l)}var p=class{constructor(t,e){this.v=Ys(t,e,void 0,2048)}toJSON(){return Xs(this)}j(){var s;var t=X2,e=this.v,n=t.g,r=Q;if(ue&&r&&((s=e[r])==null?void 0:s[n])!=null&&ce(Oa,3),e=t.g,Ls&&Q&&Ls===void 0&&(r=(n=this.v)[Q])&&(r=r.da))try{r(n,e,e2)}catch(i){gs(i)}return t.h?t.m(this,t.h,t.g,t.l):t.m(this,t.g,t.defaultValue,t.l)}clone(){const t=this.v,e=0|t[d];return cr(this,t,e)?or(this,t,!0):new this.constructor(ye(t,e,!1))}};p.prototype[le]=fe,p.prototype.toString=function(){return this.v.toString()};var Te=class{constructor(t,e,n){this.g=t,this.h=e,t=kr,this.l=!!t&&n===t||!1}};function kn(t,e){return new Te(t,e,kr)}function wi(t,e,n,r,s){An(t,n,Ti(e,r),s)}const d2=kn(function(t,e,n,r,s){return t.h===2&&($e(t,pr(e,r,n),s),!0)},wi),p2=kn(function(t,e,n,r,s){return t.h===2&&($e(t,pr(e,r,n),s),!0)},wi);var Sn=Symbol(),Tn=Symbol(),Lr=Symbol(),bi=Symbol(),Ai=Symbol();let Ei,ki;function re(t,e,n,r){var s=r[t];if(s)return s;(s={}).qa=r,s.T=function(f){switch(typeof f){case"boolean":return s2||(s2=[0,void 0,!0]);case"number":return f>0?void 0:f===0?i2||(i2=[0,void 0]):[-f,void 0];case"string":return[0,f];case"object":return f}}(r[0]);var i=r[1];let o=1;i&&i.constructor===Object&&(s.ba=i,typeof(i=r[++o])=="function"&&(s.ma=!0,Ei??(Ei=i),ki??(ki=r[o+1]),i=r[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=r[++o]}for(c=1;i!==void 0;){let f;typeof i=="number"&&(c+=i,i=r[++o]);var u=void 0;if(i instanceof Te?f=i:(f=d2,o--),f==null?void 0:f.l){i=r[++o],u=r;var h=o;typeof i=="function"&&(i=i(),u[h]=i),u=i}for(h=c+1,typeof(i=r[++o])=="number"&&i<0&&(h-=i,i=r[++o]);c<h;c++){const _=a[c];u?n(s,c,f,u,_):e(s,c,f,_)}}return r[t]=s}function Si(t){return Array.isArray(t)?t[0]instanceof Te?t:[p2,t]:[t,void 0]}function Ti(t,e){return t instanceof p?t.v:Array.isArray(t)?$t(t,e):void 0}function Fr(t,e,n,r){const s=n.g;t[e]=r?(i,o,a)=>s(i,o,a,r):s}function Mr(t,e,n,r,s){const i=n.g;let o,a;t[e]=(c,u,h)=>i(c,u,h,a||(a=re(Tn,Fr,Mr,r).T),o||(o=Pr(r)),s)}function Pr(t){let e=t[Lr];if(e!=null)return e;const n=re(Tn,Fr,Mr,t);return e=n.ma?(r,s)=>Ei(r,s,n):(r,s)=>{for(;li(s)&&s.h!=4;){var i=s.l,o=n[i];if(o==null){var a=n.ba;a&&(a=a[i])&&(a=m2(a))!=null&&(o=n[i]=a)}if(o==null||!o(s,r,i)){if(o=(a=s).m,yn(a),a.ha)var c=void 0;else c=a.g.g-o,a.g.g=o,c=ai(a.g,c);o=void 0,a=r,c&&((o=a[Q]??(a[Q]=new ir))[i]??(o[i]=[])).push(c)}}return(r=ln(r))&&(r.da=n.qa[Ai]),!0},t[Lr]=e,t[Ai]=g2.bind(t),e}function g2(t,e,n,r){var s=this[Tn];const i=this[Lr],o=$t(void 0,s.T),a=ln(t);if(a){var c=!1,u=s.ba;if(u){if(s=(h,f,_)=>{if(_.length!==0)if(u[f])for(const v of _){h=hi(v);try{c=!0,i(o,h)}finally{ui(h)}}else r==null||r(t,f,_)},e==null)fn(a,s);else if(a!=null){const h=a[e];h&&s(a,e,h)}if(c){let h=0|t[d];if(2&h&&2048&h&&!(n!=null&&n.Ka))throw Error();const f=de(h),_=(v,x)=>{if(It(t,v,f)!=null){if((n==null?void 0:n.Qa)===1)return;throw Error()}x!=null&&(h=G(t,h,v,x,f)),delete a[v]};e==null?Is(o,0|o[d],(v,x)=>{_(v,x)}):_(e,It(o,e,f))}}}}function m2(t){const e=(t=Si(t))[0].g;if(t=t[1]){const n=Pr(t),r=re(Tn,Fr,Mr,t).T;return(s,i,o)=>e(s,i,o,r,n)}return e}function Ln(t,e,n){t[e]=n.h}function Fn(t,e,n,r){let s,i;const o=n.h;t[e]=(a,c,u)=>o(a,c,u,i||(i=re(Sn,Ln,Fn,r).T),s||(s=Li(r)))}function Li(t){let e=t[bi];if(!e){const n=re(Sn,Ln,Fn,t);e=(r,s)=>Fi(r,s,n),t[bi]=e}return e}function Fi(t,e,n){Is(t,0|t[d],(r,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 u=(c=Si(c))[0].h;if(c=c[1]){const h=Li(c),f=re(Sn,Ln,Fn,c).T;c=o.ma?ki(f,h):(_,v,x)=>u(_,v,x,f,h)}else c=u;return o[a]=c}}(n,r);i?i(e,s,r):r<500||ce(qn,3)}}),(t=ln(t))&&fn(t,(r,s,i)=>{for(Se(e,e.g.end()),r=0;r<i.length;r++)Se(e,Kn(i[r])||new Uint8Array(0))})}const y2=et(0);function Le(t,e){if(Array.isArray(e)){var n=0|e[d];if(4&n)return e;for(var r=0,s=0;r<e.length;r++){const i=t(e[r]);i!=null&&(e[s++]=i)}return s<r&&(e.length=s),(t=-1537&(5|n))!==n&&j(e,t),2&t&&Object.freeze(e),e}}function Y(t,e,n){return new Te(t,e,n)}function Fe(t,e,n){return new Te(t,e,n)}function H(t,e,n){G(t,0|t[d],e,n,de(0|t[d]))}var _2=kn(function(t,e,n,r,s){if(t.h!==2)return!1;if(t=yt(t=$e(t,$t([void 0,void 0],r),s)),s=de(r=0|e[d]),2&r)throw Error();let i=It(e,n,s);if(i instanceof Ot)2&i.J?(i=i.V(),i.push(t),G(e,r,n,i,s)):i.Ma(t);else if(Array.isArray(i)){var o=0|i[d];8192&o||j(i,o|=8192),2&o&&(i=ti(i),G(e,r,n,i,s)),i.push(t)}else G(e,r,n,Ge([t]),s);return!0},function(t,e,n,r,s){if(e instanceof Ot)e.forEach((i,o)=>{An(t,n,$t([o,i],r),s)});else if(Array.isArray(e)){for(let i=0;i<e.length;i++){const o=e[i];Array.isArray(o)&&An(t,n,$t(o,r),s)}Ge(e)}});function Mi(t,e,n){(e=Et(e))!=null&&(lt(t,n,5),t=t.g,$n(e),br(t))}function Pi(t,e,n){if(e=function(r){if(r==null)return r;const s=typeof r;if(s==="bigint")return String(He(64,r));if(ze(r)){if(s==="string")return Vs(r);if(s==="number")return er(r)}}(e),e!=null&&(typeof e=="string"&&pi(e),e!=null))switch(lt(t,n,0),typeof e){case"number":t=t.g,pe(e),Ee(t,M,B);break;case"bigint":n=BigInt.asUintN(64,e),n=new wr(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),Ee(t.g,n.h,n.g);break;default:n=pi(e),Ee(t.g,n.h,n.g)}}function Oi(t,e,n){(e=me(e))!=null&&e!=null&&(lt(t,n,0),wn(t.g,e))}function Ii(t,e,n){(e=Us(e))!=null&&(lt(t,n,0),t.g.g.push(e?1:0))}function xi(t,e,n){(e=q(e))!=null&&bn(t,n,ps(e))}function Ni(t,e,n,r,s){An(t,n,Ti(e,r),s)}function Ri(t,e,n){(e=e==null||typeof e=="string"||e instanceof bt?e:void 0)!=null&&bn(t,n,mr(e,!0).buffer)}function Ci(t,e,n){return(t.h===5||t.h===2)&&(e=we(e,0|e[d],n),t.h==2?_n(t,mn,e):e.push(mn(t.g)),!0)}var D=Y(function(t,e,n){return t.h===5&&(H(e,n,mn(t.g)),!0)},Mi,En),v2=Fe(Ci,function(t,e,n){if((e=Le(Et,e))!=null)for(let o=0;o<e.length;o++){var r=t,s=n,i=e[o];i!=null&&(lt(r,s,5),r=r.g,$n(i),br(r))}},En),Or=Fe(Ci,function(t,e,n){if((e=Le(Et,e))!=null&&e.length){lt(t,n,2),ke(t.g,4*e.length);for(let r=0;r<e.length;r++)n=t.g,$n(e[r]),br(n)}},En),w2=Y(function(t,e,n){return t.h===5&&(H(e,n,(t=mn(t.g))===0?void 0:t),!0)},Mi,En),jt=Y(function(t,e,n){return Vn?(t.h!==0?t=!1:(H(e,n,Ae(t.g,Bs)),t=!0),t):t.h===0&&(H(e,n,Ae(t.g,Zn)),!0)},Pi,yi),Ir=Y(function(t,e,n){return Vn?(t.h!==0?e=!1:(H(e,n,(t=Ae(t.g,Bs))===y2?void 0:t),e=!0),e):t.h===0&&(H(e,n,(t=Ae(t.g,Zn))===0?void 0:t),!0)},Pi,yi),b2=Y(function(t,e,n){return Vn?(t.h!==0?t=!1:(H(e,n,Ae(t.g,Ha)),t=!0),t):t.h===0&&(H(e,n,Ae(t.g,Jn)),!0)},function(t,e,n){if(e=function(r){if(r==null)return r;var s=typeof r;if(s==="bigint")return String(Wa(64,r));if(ze(r)){if(s==="string")return s=ge(Number(r)),Yt(s)&&s>=0?r=String(s):((s=r.indexOf("."))!==-1&&(r=r.substring(0,s)),(s=r[0]!=="-"&&((s=r.length)<20||s===20&&r<="18446744073709551615"))||(cn(r),r=Ve(M,B))),r;if(s==="number")return(r=ge(r))>=0&&Yt(r)||(pe(r),r=Jn(M,B)),r}}(e),e!=null&&(typeof e=="string"&&di(e),e!=null))switch(lt(t,n,0),typeof e){case"number":t=t.g,pe(e),Ee(t,M,B);break;case"bigint":n=BigInt.asUintN(64,e),n=new vr(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),Ee(t.g,n.h,n.g);break;default:n=di(e),Ee(t.g,n.h,n.g)}},f2),W=Y(function(t,e,n){return t.h===0&&(H(e,n,Ut(t.g)),!0)},Oi,Tr),Je=Fe(function(t,e,n){return(t.h===0||t.h===2)&&(e=we(e,0|e[d],n),t.h==2?_n(t,Ut,e):e.push(Ut(t.g)),!0)},function(t,e,n){if((e=Le(me,e))!=null&&e.length){n=Ar(t,n);for(let r=0;r<e.length;r++)wn(t.g,e[r]);Er(t,n)}},Tr),Me=Y(function(t,e,n){return t.h===0&&(H(e,n,(t=Ut(t.g))===0?void 0:t),!0)},Oi,Tr),R=Y(function(t,e,n){return t.h===0&&(H(e,n,yr(t.g)),!0)},Ii,gi),se=Y(function(t,e,n){return t.h===0&&(H(e,n,(t=yr(t.g))===!1?void 0:t),!0)},Ii,gi),X=Fe(function(t,e,n){return t.h===2&&(t=_r(t),we(e,0|e[d],n).push(t),!0)},function(t,e,n){if((e=Le(q,e))!=null)for(let o=0;o<e.length;o++){var r=t,s=n,i=e[o];i!=null&&bn(r,s,ps(i))}},Sr),Gt=Y(function(t,e,n){return t.h===2&&(H(e,n,(t=_r(t))===""?void 0:t),!0)},xi,Sr),S=Y(function(t,e,n){return t.h===2&&(H(e,n,_r(t)),!0)},xi,Sr),K=function(t,e,n=kr){return new Te(t,e,n)}(function(t,e,n,r,s){return t.h===2&&(r=$t(void 0,r),we(e,0|e[d],n).push(r),$e(t,r,s),!0)},function(t,e,n,r,s){if(Array.isArray(e)){for(let i=0;i<e.length;i++)Ni(t,e[i],n,r,s);1&(t=0|e[d])||j(e,1|t)}}),C=kn(function(t,e,n,r,s,i){if(t.h!==2)return!1;let o=0|e[d];return ei(e,o,i,n,de(o)),$e(t,e=pr(e,r,n),s),!0},Ni),Bi=Y(function(t,e,n){return t.h===2&&(H(e,n,fi(t)),!0)},Ri,_i),A2=Fe(function(t,e,n){return(t.h===0||t.h===2)&&(e=we(e,0|e[d],n),t.h==2?_n(t,Rt,e):e.push(Rt(t.g)),!0)},function(t,e,n){if((e=Le(js,e))!=null)for(let o=0;o<e.length;o++){var r=t,s=n,i=e[o];i!=null&&(lt(r,s,0),ke(r.g,i))}},mi),E2=Y(function(t,e,n){return t.h===0&&(H(e,n,(t=Rt(t.g))===0?void 0:t),!0)},function(t,e,n){(e=js(e))!=null&&e!=null&&(lt(t,n,0),ke(t.g,e))},mi),rt=Y(function(t,e,n){return t.h===0&&(H(e,n,Ut(t.g)),!0)},function(t,e,n){(e=me(e))!=null&&(e=parseInt(e,10),lt(t,n,0),wn(t.g,e))},vi);class k2{constructor(e,n){var r=st;this.g=e,this.h=n,this.m=A,this.j=y,this.defaultValue=void 0,this.l=r.Oa!=null?xs:void 0}register(){sn(this)}}function Tt(t,e){return new k2(t,e)}function Vt(t,e){return(n,r)=>{{const i={ea:!0};r&&Object.assign(i,r),n=hi(n,void 0,void 0,i);try{const o=new t,a=o.v;Pr(e)(a,n);var s=o}finally{ui(n)}}return s}}function Mn(t){return function(){const e=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}}}};Fi(this.v,e,re(Sn,Ln,Fn,t)),Se(e,e.g.end());const n=new Uint8Array(e.h),r=e.l,s=r.length;let i=0;for(let o=0;o<s;o++){const a=r[o];n.set(a,i),i+=a.length}return e.l=[n],n}}var Di=class extends p{constructor(t){super(t)}},Ui=[0,Gt,Y(function(t,e,n){return t.h===2&&(H(e,n,(t=fi(t))===zt()?void 0:t),!0)},function(t,e,n){if(e!=null){if(e instanceof p){const r=e.Ra;return void(r?(e=r(e),e!=null&&bn(t,n,mr(e,!0).buffer)):ce(qn,3))}if(Array.isArray(e))return void ce(qn,3)}Ri(t,e,n)},_i)];let xr,ji=globalThis.trustedTypes;function Gi(t){var e;return xr===void 0&&(xr=function(){let n=null;if(!ji)return n;try{const r=s=>s;n=ji.createPolicy("goog#html",{createHTML:r,createScript:r,createScriptURL:r})}catch{}return n}()),t=(e=xr)?e.createScriptURL(t):t,new class{constructor(n){this.g=n}toString(){return this.g+""}}(t)}function S2(t,...e){if(e.length===0)return Gi(t[0]);let n=t[0];for(let r=0;r<e.length;r++)n+=encodeURIComponent(e[r])+t[r+1];return Gi(n)}var Vi=[0,W,rt,R,-1,Je,rt,-1,R],T2=class extends p{constructor(t){super(t)}},Hi=[0,R,S,R,rt,-1,Fe(function(t,e,n){return(t.h===0||t.h===2)&&(e=we(e,0|e[d],n),t.h==2?_n(t,c2,e):e.push(Ut(t.g)),!0)},function(t,e,n){if((e=Le(me,e))!=null&&e.length){n=Ar(t,n);for(let r=0;r<e.length;r++)wn(t.g,e[r]);Er(t,n)}},vi),S,-1,[0,R,-1],rt,R,-1],Wi=[0,3,R,-1,2,[0,W],[0,rt,R],[0,S,-1],[0]],Ki=[0,S,-2],zi=class extends p{constructor(t){super(t)}},qi=[0],Xi=[0,W,R,1,R,-4],st=class extends p{constructor(t){super(t,2)}},V={};V[336783863]=[0,S,R,-1,W,[0,[1,2,3,4,5,6,7,8,9],C,qi,C,Hi,C,Ki,C,Xi,C,Vi,C,[0,S,-2],C,[0,S,rt],C,Wi,C,[0,rt,-1,R]],[0,S],R,[0,[1,3],[2,4],C,[0,Je],-1,C,[0,X],-1,K,[0,S,-1]],S];var Yi=[0,Ir,-1,se,-3,Ir,Je,Gt,Me,Ir,-1,se,Me,se,-2,Gt];function L(t,e){gn(t,3,e)}function w(t,e){gn(t,4,e)}var $=class extends p{constructor(t){super(t,500)}o(t){return y(this,0,7,t)}},Ze=[-1,{}],$i=[0,S,1,Ze],Ji=[0,S,X,Ze];function ft(t,e){gr(t,1,$,e)}function P(t,e){gn(t,10,e)}function E(t,e){gn(t,15,e)}var it=class extends p{constructor(t){super(t,500)}o(t){return y(this,0,1001,t)}},Zi=[-500,K,[-500,Gt,-1,X,-3,[-2,V,R],K,Ui,Me,-1,$i,Ji,K,[0,Gt,se],Gt,Yi,Me,X,987,X],4,K,[-500,S,-1,[-1,{}],998,S],K,[-500,S,X,-1,[-2,{},R],997,X,-1],Me,K,[-500,S,X,Ze,998,X],X,Me,$i,Ji,K,[0,Gt,-1,Ze],X,-2,Yi,Gt,-1,se,[0,se,E2],978,Ze,K,Ui];it.prototype.g=Mn(Zi);var L2=Vt(it,Zi),F2=class extends p{constructor(t){super(t)}},Qi=class extends p{constructor(t){super(t)}g(){return xt(this,F2,1)}},to=[0,K,[0,W,D,S,-1]],Pn=Vt(Qi,to),M2=class extends p{constructor(t){super(t)}},P2=class extends p{constructor(t){super(t)}},Nr=class extends p{constructor(t){super(t)}l(){return A(this,M2,2)}g(){return xt(this,P2,5)}},eo=Vt(class extends p{constructor(t){super(t)}},[0,X,Je,Or,[0,rt,[0,W,-3],[0,D,-3],[0,W,-1,[0,K,[0,W,-2]]],K,[0,D,-1,S,D]],S,-1,jt,K,[0,W,D],X,jt]),no=class extends p{constructor(t){super(t)}},Pe=Vt(class extends p{constructor(t){super(t)}},[0,K,[0,D,-4]]),ro=class extends p{constructor(t){super(t)}},Qe=Vt(class extends p{constructor(t){super(t)}},[0,K,[0,D,-4]]),O2=class extends p{constructor(t){super(t)}},I2=[0,W,-1,Or,rt],so=class extends p{constructor(t){super(t)}};so.prototype.g=Mn([0,D,-4,jt]);var x2=class extends p{constructor(t){super(t)}},N2=Vt(class extends p{constructor(t){super(t)}},[0,K,[0,1,W,S,to],jt]),io=class extends p{constructor(t){super(t)}},R2=class extends p{constructor(t){super(t)}na(){const t=T(this,1,void 0,void 0,Qs);return t??zt()}},C2=class extends p{constructor(t){super(t)}},oo=[1,2],B2=Vt(class extends p{constructor(t){super(t)}},[0,K,[0,oo,C,[0,Or],C,[0,Bi],W,S],jt]),Rr=class extends p{constructor(t){super(t)}},ao=[0,S,W,D,X,-1],co=class extends p{constructor(t){super(t)}},D2=[0,R,-1],ho=class extends p{constructor(t){super(t)}},On=[1,2,3,4,5,6],In=class extends p{constructor(t){super(t)}g(){return T(this,1,void 0,void 0,Qs)!=null}l(){return q(T(this,2))!=null}},I=class extends p{constructor(t){super(t)}g(){return Us(T(this,2))??!1}},uo=[0,Bi,S,[0,W,jt,-1],[0,b2,jt]],U=[0,uo,R,[0,On,C,Xi,C,Hi,C,Vi,C,qi,C,Ki,C,Wi],rt],xn=class extends p{constructor(t){super(t)}},Cr=[0,U,D,-1,W],U2=Tt(502141897,xn);V[502141897]=Cr;var j2=Vt(class extends p{constructor(t){super(t)}},[0,[0,rt,-1,v2,A2],I2]),lo=class extends p{constructor(t){super(t)}},fo=class extends p{constructor(t){super(t)}},Br=[0,U,D,[0,U],R],G2=Tt(508968150,fo);V[508968150]=[0,U,Cr,Br,D,[0,[0,uo]]],V[508968149]=Br;var Oe=class extends p{constructor(t){super(t)}l(){return A(this,Rr,2)}g(){k(this,2)}},po=[0,U,ao];V[478825465]=po;var V2=class extends p{constructor(t){super(t)}},go=class extends p{constructor(t){super(t)}},Dr=class extends p{constructor(t){super(t)}},Ur=class extends p{constructor(t){super(t)}},mo=class extends p{constructor(t){super(t)}},yo=[0,U,[0,U],po,-1],_o=[0,U,D,W],jr=[0,U,D],vo=[0,U,_o,jr,D],H2=Tt(479097054,mo);V[479097054]=[0,U,vo,yo],V[463370452]=yo,V[464864288]=_o;var W2=Tt(462713202,Ur);V[462713202]=vo,V[474472470]=jr;var K2=class extends p{constructor(t){super(t)}},wo=class extends p{constructor(t){super(t)}},bo=class extends p{constructor(t){super(t)}},Ao=class extends p{constructor(t){super(t)}},Gr=[0,U,D,-1,W],Vr=[0,U,D,R];Ao.prototype.g=Mn([0,U,jr,[0,U],Cr,Br,Gr,Vr]);var Eo=class extends p{constructor(t){super(t)}},z2=Tt(456383383,Eo);V[456383383]=[0,U,ao];var ko=class extends p{constructor(t){super(t)}},q2=Tt(476348187,ko);V[476348187]=[0,U,D2];var So=class extends p{constructor(t){super(t)}},To=class extends p{constructor(t){super(t)}},Lo=[0,rt,-1],X2=Tt(458105876,class extends p{constructor(t){super(t)}g(){let t;var e=this.v;const n=0|e[d];return t=tt(this,n),e=function(r,s,i,o){var a=To;!o&&_e(r)&&(i=0|(s=r.v)[d]);var c=It(s,2);if(r=!1,c==null){if(o)return qs();c=[]}else if(c.constructor===Ot){if(!(2&c.J)||o)return c;c=c.V()}else Array.isArray(c)?r=!!(2&(0|c[d])):c=[];if(o){if(!c.length)return qs();r||(r=!0,je(c))}else r&&(r=!1,Ge(c),c=ti(c));return!r&&32&i&&Ue(c,32),i=G(s,i,2,o=new Ot(c,a,Xa,void 0)),r||Jt(s,i),o}(this,e,n,t),!t&&To&&(e.ra=!0),e}});V[458105876]=[0,Lo,_2,[!0,jt,[0,S,-1,X]],[0,Je,R,rt]];var Hr=class extends p{constructor(t){super(t)}},Fo=Tt(458105758,Hr);V[458105758]=[0,U,S,Lo];var Wr=class extends p{constructor(t){super(t)}},Mo=[0,w2,-1,se],Y2=class extends p{constructor(t){super(t)}},Po=class extends p{constructor(t){super(t)}},Kr=[1,2];Po.prototype.g=Mn([0,Kr,C,Mo,C,[0,K,Mo]]);var Oo=class extends p{constructor(t){super(t)}},$2=Tt(443442058,Oo);V[443442058]=[0,U,S,W,D,X,-1,R,D],V[514774813]=Gr;var Io=class extends p{constructor(t){super(t)}},J2=Tt(516587230,Io);function zr(t,e){return e=e?e.clone():new Rr,t.displayNamesLocale!==void 0?k(e,1,qe(t.displayNamesLocale)):t.displayNamesLocale===void 0&&k(e,1),t.maxResults!==void 0?Nt(e,2,t.maxResults):"maxResults"in t&&k(e,2),t.scoreThreshold!==void 0?m(e,3,t.scoreThreshold):"scoreThreshold"in t&&k(e,3),t.categoryAllowlist!==void 0?pn(e,4,t.categoryAllowlist):"categoryAllowlist"in t&&k(e,4),t.categoryDenylist!==void 0?pn(e,5,t.categoryDenylist):"categoryDenylist"in t&&k(e,5),e}function xo(t){const e=Number(t);return Number.isSafeInteger(e)?e:String(t)}function qr(t,e=-1,n=""){return{categories:t.map(r=>({index:ut(r,1)??0??-1,score:N(r,2)??0,categoryName:q(T(r,3))??""??"",displayName:q(T(r,4))??""??""})),headIndex:e,headName:n}}function Z2(t){const e={classifications:xt(t,x2,1).map(n=>{var r;return qr(((r=A(n,Qi,4))==null?void 0:r.g())??[],ut(n,2)??0,q(T(n,3))??"")})};return function(n){return qa(Hn?T(n,2,void 0,void 0,un):T(n,2))}(t)!=null&&(e.timestampMs=xo(ii(t))),e}function No(t){var o,a;var e=Qt(t,3,Et,Zt()),n=Qt(t,2,me,Zt()),r=Qt(t,1,q,Zt()),s=Qt(t,9,q,Zt());const i={categories:[],keypoints:[]};for(let c=0;c<e.length;c++)i.categories.push({score:e[c],index:n[c]??-1,categoryName:r[c]??"",displayName:s[c]??""});if((e=(o=A(t,Nr,4))==null?void 0:o.l())&&(i.boundingBox={originX:ut(e,1,Bt)??0,originY:ut(e,2,Bt)??0,width:ut(e,3,Bt)??0,height:ut(e,4,Bt)??0,angle:0}),(a=A(t,Nr,4))==null?void 0:a.g().length)for(const c of A(t,Nr,4).g())i.keypoints.push({x:T(c,1,void 0,Bt,Et)??0,y:T(c,2,void 0,Bt,Et)??0,score:T(c,4,void 0,Bt,Et)??0,label:q(T(c,3,void 0,Bt))??""});return i}function Nn(t){const e=[];for(const n of xt(t,ro,1))e.push({x:N(n,1)??0,y:N(n,2)??0,z:N(n,3)??0,visibility:N(n,4)??0});return e}function tn(t){const e=[];for(const n of xt(t,no,1))e.push({x:N(n,1)??0,y:N(n,2)??0,z:N(n,3)??0,visibility:N(n,4)??0});return e}function Ro(t){return Array.from(t,e=>e>127?e-256:e)}function Co(t,e){if(t.length!==e.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${t.length} vs. ${e.length}).`);let n=0,r=0,s=0;for(let i=0;i<t.length;i++)n+=t[i]*e[i],r+=t[i]*t[i],s+=e[i]*e[i];if(r<=0||s<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return n/Math.sqrt(r*s)}let Rn;V[516587230]=[0,U,Gr,Vr,D],V[518928384]=Vr;const Q2=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 Bo(){if(Rn===void 0)try{await WebAssembly.instantiate(Q2),Rn=!0}catch{Rn=!1}return Rn}async function en(t,e=S2``){const n=await Bo()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${e}/${t}_${n}.js`,wasmBinaryPath:`${e}/${t}_${n}.wasm`}}var ie=class{};function Do(){var t=navigator;return typeof OffscreenCanvas<"u"&&(!function(e=navigator){return(e=e.userAgent).includes("Safari")&&!e.includes("Chrome")}(t)||!!((t=t.userAgent.match(/Version\/([\d]+).*Safari/))&&t.length>=1&&Number(t[1])>=17))}async function Uo(t){if(typeof importScripts!="function"){const e=document.createElement("script");return e.src=t.toString(),e.crossOrigin="anonymous",new Promise((n,r)=>{e.addEventListener("load",()=>{n()},!1),e.addEventListener("error",s=>{r(s)},!1),document.body.appendChild(e)})}try{importScripts(t.toString())}catch(e){if(!(e instanceof TypeError))throw e;await self.import(t.toString())}}function jo(t){return t.videoWidth!==void 0?[t.videoWidth,t.videoHeight]:t.naturalWidth!==void 0?[t.naturalWidth,t.naturalHeight]:t.displayWidth!==void 0?[t.displayWidth,t.displayHeight]:[t.width,t.height]}function g(t,e,n){t.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),n(e=t.i.stringToNewUTF8(e)),t.i._free(e)}function Go(t,e,n){if(!t.i.canvas)throw Error("No OpenGL canvas configured.");if(n?t.i._bindTextureToStream(n):t.i._bindTextureToCanvas(),!(n=t.i.canvas.getContext("webgl2")||t.i.canvas.getContext("webgl")))throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");t.i.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!0),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,e),t.i.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1);const[r,s]=jo(e);return!t.l||r===t.i.canvas.width&&s===t.i.canvas.height||(t.i.canvas.width=r,t.i.canvas.height=s),[r,s]}function Vo(t,e,n){t.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const r=new Uint32Array(e.length);for(let s=0;s<e.length;s++)r[s]=t.i.stringToNewUTF8(e[s]);e=t.i._malloc(4*r.length),t.i.HEAPU32.set(r,e>>2),n(e);for(const s of r)t.i._free(s);t.i._free(e)}function Lt(t,e,n){t.i.simpleListeners=t.i.simpleListeners||{},t.i.simpleListeners[e]=n}function Ht(t,e,n){let r=[];t.i.simpleListeners=t.i.simpleListeners||{},t.i.simpleListeners[e]=(s,i,o)=>{i?(n(r,o),r=[]):r.push(s)}}ie.forVisionTasks=function(t){return en("vision",t)},ie.forTextTasks=function(t){return en("text",t)},ie.forGenAiExperimentalTasks=function(t){return en("genai_experimental",t)},ie.forGenAiTasks=function(t){return en("genai",t)},ie.forAudioTasks=function(t){return en("audio",t)},ie.isSimdSupported=function(){return Bo()};async function t1(t,e,n,r){return t=await(async(s,i,o,a,c)=>{if(i&&await Uo(i),!self.ModuleFactory||o&&(await Uo(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)})(t,n.wasmLoaderPath,n.assetLoaderPath,e,{locateFile:s=>s.endsWith(".wasm")?n.wasmBinaryPath.toString():n.assetBinaryPath&&s.endsWith(".data")?n.assetBinaryPath.toString():s}),await t.o(r),t}function Xr(t,e){const n=A(t.baseOptions,In,1)||new In;typeof e=="string"?(k(n,2,qe(e)),k(n,1)):e instanceof Uint8Array&&(k(n,1,Xn(e,!1)),k(n,2)),y(t.baseOptions,0,1,n)}function Ho(t){try{const e=t.H.length;if(e===1)throw Error(t.H[0].message);if(e>1)throw Error("Encountered multiple errors: "+t.H.map(n=>n.message).join(", "))}finally{t.H=[]}}function l(t,e){t.C=Math.max(t.C,e)}function Cn(t,e){t.B=new $,nt(t.B,2,"PassThroughCalculator"),L(t.B,"free_memory"),w(t.B,"free_memory_unused_out"),P(e,"free_memory"),ft(e,t.B)}function Ie(t,e){L(t.B,e),w(t.B,e+"_unused_out")}function Bn(t){t.g.addBoolToStream(!0,"free_memory",t.C)}var Yr=class{constructor(t){this.g=t,this.H=[],this.C=0,this.g.setAutoRenderToScreen(!1)}l(t,e=!0){var n,r,s,i,o,a;if(e){const c=t.baseOptions||{};if((n=t.baseOptions)!=null&&n.modelAssetBuffer&&((r=t.baseOptions)!=null&&r.modelAssetPath))throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!((s=A(this.baseOptions,In,1))!=null&&s.g()||(i=A(this.baseOptions,In,1))!=null&&i.l()||(o=t.baseOptions)!=null&&o.modelAssetBuffer||(a=t.baseOptions)!=null&&a.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if(function(u,h){let f=A(u.baseOptions,ho,3);if(!f){var _=f=new ho,v=new zi;Ye(_,4,On,v)}"delegate"in h&&(h.delegate==="GPU"?(h=f,_=new T2,Ye(h,2,On,_)):(h=f,_=new zi,Ye(h,4,On,_))),y(u.baseOptions,0,3,f)}(this,c),c.modelAssetPath)return fetch(c.modelAssetPath.toString()).then(u=>{if(u.ok)return u.arrayBuffer();throw Error(`Failed to fetch model: ${c.modelAssetPath} (${u.status})`)}).then(u=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(u),!0,!1,!1),Xr(this,"/model.dat"),this.m(),this.L()});if(c.modelAssetBuffer instanceof Uint8Array)Xr(this,c.modelAssetBuffer);else if(c.modelAssetBuffer)return async function(u){const h=[];for(var f=0;;){const{done:_,value:v}=await u.read();if(_)break;h.push(v),f+=v.length}if(h.length===0)return new Uint8Array(0);if(h.length===1)return h[0];u=new Uint8Array(f),f=0;for(const _ of h)u.set(_,f),f+=_.length;return u}(c.modelAssetBuffer).then(u=>{Xr(this,u),this.m(),this.L()})}return this.m(),this.L(),Promise.resolve()}L(){}ca(){let t;if(this.g.ca(e=>{t=L2(e)}),!t)throw Error("Failed to retrieve CalculatorGraphConfig");return t}setGraph(t,e){this.g.attachErrorListener((n,r)=>{this.H.push(Error(r))}),this.g.Ja(),this.g.setGraph(t,e),this.B=void 0,Ho(this)}finishProcessing(){this.g.finishProcessing(),Ho(this)}close(){this.B=void 0,this.g.closeGraph()}};function Wt(t,e){if(!t)throw Error(`Unable to obtain required WebGL resource: ${e}`);return t}Yr.prototype.close=Yr.prototype.close;class e1{constructor(e,n,r,s){this.g=e,this.h=n,this.m=r,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 Wo(t,e,n){const r=t.g;if(n=Wt(r.createShader(n),"Failed to create WebGL shader"),r.shaderSource(n,e),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${r.getShaderInfoLog(n)}`);return r.attachShader(t.h,n),n}function Ko(t,e){const n=t.g,r=Wt(n.createVertexArray(),"Failed to create vertex array");n.bindVertexArray(r);const s=Wt(n.createBuffer(),"Failed to create buffer");n.bindBuffer(n.ARRAY_BUFFER,s),n.enableVertexAttribArray(t.O),n.vertexAttribPointer(t.O,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),n.STATIC_DRAW);const i=Wt(n.createBuffer(),"Failed to create buffer");return n.bindBuffer(n.ARRAY_BUFFER,i),n.enableVertexAttribArray(t.L),n.vertexAttribPointer(t.L,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array(e?[0,1,0,0,1,0,1,1]:[0,0,0,1,1,1,1,0]),n.STATIC_DRAW),n.bindBuffer(n.ARRAY_BUFFER,null),n.bindVertexArray(null),new e1(n,r,s,i)}function $r(t,e){if(t.g){if(e!==t.g)throw Error("Cannot change GL context once initialized")}else t.g=e}function n1(t,e,n,r){return $r(t,e),t.h||(t.m(),t.D()),n?(t.u||(t.u=Ko(t,!0)),n=t.u):(t.A||(t.A=Ko(t,!1)),n=t.A),e.useProgram(t.h),n.bind(),t.l(),t=r(),n.g.bindVertexArray(null),t}function zo(t,e,n){return $r(t,e),t=Wt(e.createTexture(),"Failed to create texture"),e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,n??e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,n??e.LINEAR),e.bindTexture(e.TEXTURE_2D,null),t}function qo(t,e,n){$r(t,e),t.B||(t.B=Wt(e.createFramebuffer(),"Failed to create framebuffe.")),e.bindFramebuffer(e.FRAMEBUFFER,t.B),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0)}function r1(t){var e;(e=t.g)==null||e.bindFramebuffer(t.g.FRAMEBUFFER,null)}var Xo=class{H(){return`
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}`,t.VERTEX_SHADER),this.W=Wo(this,this.H(),t.FRAGMENT_SHADER),t.linkProgram(this.h),!t.getProgramParameter(this.h,t.LINK_STATUS))throw Error(`Error during program linking: ${t.getProgramInfoLog(this.h)}`);this.O=t.getAttribLocation(this.h,"aVertex"),this.L=t.getAttribLocation(this.h,"aTex")}D(){}l(){}close(){if(this.h){const t=this.g;t.deleteProgram(this.h),t.deleteShader(this.X),t.deleteShader(this.W)}this.B&&this.g.deleteFramebuffer(this.B),this.A&&this.A.close(),this.u&&this.u.close()}};function Ct(t,e){switch(e){case 0:return t.g.find(n=>n instanceof Uint8Array);case 1:return t.g.find(n=>n instanceof Float32Array);case 2:return t.g.find(n=>typeof WebGLTexture<"u"&&n instanceof WebGLTexture);default:throw Error(`Type is not supported: ${e}`)}}function Jr(t){var e=Ct(t,1);if(!e){if(e=Ct(t,0))e=new Float32Array(e).map(r=>r/255);else{e=new Float32Array(t.width*t.height);const r=xe(t);var n=Zr(t);if(qo(n,r,Yo(t)),"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";").includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"document"in self&&"ontouchend"in self.document){n=new Float32Array(t.width*t.height*4),r.readPixels(0,0,t.width,t.height,r.RGBA,r.FLOAT,n);for(let s=0,i=0;s<e.length;++s,i+=4)e[s]=n[i]}else r.readPixels(0,0,t.width,t.height,r.RED,r.FLOAT,e)}t.g.push(e)}return e}function Yo(t){let e=Ct(t,2);if(!e){const n=xe(t);e=Jo(t);const r=Jr(t),s=$o(t);n.texImage2D(n.TEXTURE_2D,0,s,t.width,t.height,0,n.RED,n.FLOAT,r),Qr(t)}return e}function xe(t){if(!t.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return t.h||(t.h=Wt(t.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),t.h}function $o(t){if(t=xe(t),!Dn)if(t.getExtension("EXT_color_buffer_float")&&t.getExtension("OES_texture_float_linear")&&t.getExtension("EXT_float_blend"))Dn=t.R32F;else{if(!t.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");Dn=t.R16F}return Dn}function Zr(t){return t.l||(t.l=new Xo),t.l}function Jo(t){const e=xe(t);e.viewport(0,0,t.width,t.height),e.activeTexture(e.TEXTURE0);let n=Ct(t,2);return n||(n=zo(Zr(t),e,t.m?e.LINEAR:e.NEAREST),t.g.push(n),t.j=!0),e.bindTexture(e.TEXTURE_2D,n),n}function Qr(t){t.h.bindTexture(t.h.TEXTURE_2D,null)}var Dn,z=class{constructor(t,e,n,r,s,i,o){this.g=t,this.m=e,this.j=n,this.canvas=r,this.l=s,this.width=i,this.height=o,this.j&&--Zo===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Fa(){return!!Ct(this,0)}ka(){return!!Ct(this,1)}R(){return!!Ct(this,2)}ja(){return(e=Ct(t=this,0))||(e=Jr(t),e=new Uint8Array(e.map(n=>Math.round(255*n))),t.g.push(e)),e;var t,e}ia(){return Jr(this)}N(){return Yo(this)}clone(){const t=[];for(const e of this.g){let n;if(e instanceof Uint8Array)n=new Uint8Array(e);else if(e instanceof Float32Array)n=new Float32Array(e);else{if(!(e instanceof WebGLTexture))throw Error(`Type is not supported: ${e}`);{const r=xe(this),s=Zr(this);r.activeTexture(r.TEXTURE1),n=zo(s,r,this.m?r.LINEAR:r.NEAREST),r.bindTexture(r.TEXTURE_2D,n);const i=$o(this);r.texImage2D(r.TEXTURE_2D,0,i,this.width,this.height,0,r.RED,r.FLOAT,null),r.bindTexture(r.TEXTURE_2D,null),qo(s,r,n),n1(s,r,!1,()=>{Jo(this),r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT),r.drawArrays(r.TRIANGLE_FAN,0,4),Qr(this)}),r1(s),Qr(this)}}t.push(n)}return new z(t,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&xe(this).deleteTexture(Ct(this,2)),Zo=-1}};z.prototype.close=z.prototype.close,z.prototype.clone=z.prototype.clone,z.prototype.getAsWebGLTexture=z.prototype.N,z.prototype.getAsFloat32Array=z.prototype.ia,z.prototype.getAsUint8Array=z.prototype.ja,z.prototype.hasWebGLTexture=z.prototype.R,z.prototype.hasFloat32Array=z.prototype.ka,z.prototype.hasUint8Array=z.prototype.Fa;var Zo=250;function _t(...t){return t.map(([e,n])=>({start:e,end:n}))}const s1=function(t){return class extends t{Ja(){this.i._registerModelResourcesGraphService()}}}((Qo=class{constructor(t,e){this.l=!0,this.i=t,this.g=null,this.h=0,this.m=typeof this.i._addIntToInputStream=="function",e!==void 0?this.i.canvas=e:Do()?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(t){const e=await(await fetch(t)).arrayBuffer();t=!(t.endsWith(".pbtxt")||t.endsWith(".textproto")),this.setGraph(new Uint8Array(e),t)}setGraphFromString(t){this.setGraph(new TextEncoder().encode(t),!1)}setGraph(t,e){const n=t.length,r=this.i._malloc(n);this.i.HEAPU8.set(t,r),e?this.i._changeBinaryGraph(n,r):this.i._changeTextGraph(n,r),this.i._free(r)}configureAudio(t,e,n,r,s){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),g(this,r||"input_audio",i=>{g(this,s=s||"audio_header",o=>{this.i._configureAudio(i,o,t,e??0,n)})})}setAutoResizeCanvas(t){this.l=t}setAutoRenderToScreen(t){this.i._setAutoRenderToScreen(t)}setGpuBufferVerticalFlip(t){this.i.gpuOriginForWebTexturesIsBottomLeft=t}ca(t){Lt(this,"__graph_config__",e=>{t(e)}),g(this,"__graph_config__",e=>{this.i._getGraphConfig(e,void 0)}),delete this.i.simpleListeners.__graph_config__}attachErrorListener(t){this.i.errorListener=t}attachEmptyPacketListener(t,e){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[t]=e}addAudioToStream(t,e,n){this.addAudioToStreamWithShape(t,0,0,e,n)}addAudioToStreamWithShape(t,e,n,r,s){const i=4*t.length;this.h!==i&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(i),this.h=i),this.i.HEAPF32.set(t,this.g/4),g(this,r,o=>{this.i._addAudioToInputStream(this.g,e,n,o,s)})}addGpuBufferToStream(t,e,n){g(this,e,r=>{const[s,i]=Go(this,t,r);this.i._addBoundTextureToStream(r,s,i,n)})}addBoolToStream(t,e,n){g(this,e,r=>{this.i._addBoolToInputStream(t,r,n)})}addDoubleToStream(t,e,n){g(this,e,r=>{this.i._addDoubleToInputStream(t,r,n)})}addFloatToStream(t,e,n){g(this,e,r=>{this.i._addFloatToInputStream(t,r,n)})}addIntToStream(t,e,n){g(this,e,r=>{this.i._addIntToInputStream(t,r,n)})}addUintToStream(t,e,n){g(this,e,r=>{this.i._addUintToInputStream(t,r,n)})}addStringToStream(t,e,n){g(this,e,r=>{g(this,t,s=>{this.i._addStringToInputStream(s,r,n)})})}addStringRecordToStream(t,e,n){g(this,e,r=>{Vo(this,Object.keys(t),s=>{Vo(this,Object.values(t),i=>{this.i._addFlatHashMapToInputStream(s,i,Object.keys(t).length,r,n)})})})}addProtoToStream(t,e,n,r){g(this,n,s=>{g(this,e,i=>{const o=this.i._malloc(t.length);this.i.HEAPU8.set(t,o),this.i._addProtoToInputStream(o,t.length,i,s,r),this.i._free(o)})})}addEmptyPacketToStream(t,e){g(this,t,n=>{this.i._addEmptyPacketToInputStream(n,e)})}addBoolVectorToStream(t,e,n){g(this,e,r=>{const s=this.i._allocateBoolVector(t.length);if(!s)throw Error("Unable to allocate new bool vector on heap.");for(const i of t)this.i._addBoolVectorEntry(s,i);this.i._addBoolVectorToInputStream(s,r,n)})}addDoubleVectorToStream(t,e,n){g(this,e,r=>{const s=this.i._allocateDoubleVector(t.length);if(!s)throw Error("Unable to allocate new double vector on heap.");for(const i of t)this.i._addDoubleVectorEntry(s,i);this.i._addDoubleVectorToInputStream(s,r,n)})}addFloatVectorToStream(t,e,n){g(this,e,r=>{const s=this.i._allocateFloatVector(t.length);if(!s)throw Error("Unable to allocate new float vector on heap.");for(const i of t)this.i._addFloatVectorEntry(s,i);this.i._addFloatVectorToInputStream(s,r,n)})}addIntVectorToStream(t,e,n){g(this,e,r=>{const s=this.i._allocateIntVector(t.length);if(!s)throw Error("Unable to allocate new int vector on heap.");for(const i of t)this.i._addIntVectorEntry(s,i);this.i._addIntVectorToInputStream(s,r,n)})}addUintVectorToStream(t,e,n){g(this,e,r=>{const s=this.i._allocateUintVector(t.length);if(!s)throw Error("Unable to allocate new unsigned int vector on heap.");for(const i of t)this.i._addUintVectorEntry(s,i);this.i._addUintVectorToInputStream(s,r,n)})}addStringVectorToStream(t,e,n){g(this,e,r=>{const s=this.i._allocateStringVector(t.length);if(!s)throw Error("Unable to allocate new string vector on heap.");for(const i of t)g(this,i,o=>{this.i._addStringVectorEntry(s,o)});this.i._addStringVectorToInputStream(s,r,n)})}addBoolToInputSidePacket(t,e){g(this,e,n=>{this.i._addBoolToInputSidePacket(t,n)})}addDoubleToInputSidePacket(t,e){g(this,e,n=>{this.i._addDoubleToInputSidePacket(t,n)})}addFloatToInputSidePacket(t,e){g(this,e,n=>{this.i._addFloatToInputSidePacket(t,n)})}addIntToInputSidePacket(t,e){g(this,e,n=>{this.i._addIntToInputSidePacket(t,n)})}addUintToInputSidePacket(t,e){g(this,e,n=>{this.i._addUintToInputSidePacket(t,n)})}addStringToInputSidePacket(t,e){g(this,e,n=>{g(this,t,r=>{this.i._addStringToInputSidePacket(r,n)})})}addProtoToInputSidePacket(t,e,n){g(this,n,r=>{g(this,e,s=>{const i=this.i._malloc(t.length);this.i.HEAPU8.set(t,i),this.i._addProtoToInputSidePacket(i,t.length,s,r),this.i._free(i)})})}addBoolVectorToInputSidePacket(t,e){g(this,e,n=>{const r=this.i._allocateBoolVector(t.length);if(!r)throw Error("Unable to allocate new bool vector on heap.");for(const s of t)this.i._addBoolVectorEntry(r,s);this.i._addBoolVectorToInputSidePacket(r,n)})}addDoubleVectorToInputSidePacket(t,e){g(this,e,n=>{const r=this.i._allocateDoubleVector(t.length);if(!r)throw Error("Unable to allocate new double vector on heap.");for(const s of t)this.i._addDoubleVectorEntry(r,s);this.i._addDoubleVectorToInputSidePacket(r,n)})}addFloatVectorToInputSidePacket(t,e){g(this,e,n=>{const r=this.i._allocateFloatVector(t.length);if(!r)throw Error("Unable to allocate new float vector on heap.");for(const s of t)this.i._addFloatVectorEntry(r,s);this.i._addFloatVectorToInputSidePacket(r,n)})}addIntVectorToInputSidePacket(t,e){g(this,e,n=>{const r=this.i._allocateIntVector(t.length);if(!r)throw Error("Unable to allocate new int vector on heap.");for(const s of t)this.i._addIntVectorEntry(r,s);this.i._addIntVectorToInputSidePacket(r,n)})}addUintVectorToInputSidePacket(t,e){g(this,e,n=>{const r=this.i._allocateUintVector(t.length);if(!r)throw Error("Unable to allocate new unsigned int vector on heap.");for(const s of t)this.i._addUintVectorEntry(r,s);this.i._addUintVectorToInputSidePacket(r,n)})}addStringVectorToInputSidePacket(t,e){g(this,e,n=>{const r=this.i._allocateStringVector(t.length);if(!r)throw Error("Unable to allocate new string vector on heap.");for(const s of t)g(this,s,i=>{this.i._addStringVectorEntry(r,i)});this.i._addStringVectorToInputSidePacket(r,n)})}attachBoolListener(t,e){Lt(this,t,e),g(this,t,n=>{this.i._attachBoolListener(n)})}attachBoolVectorListener(t,e){Ht(this,t,e),g(this,t,n=>{this.i._attachBoolVectorListener(n)})}attachIntListener(t,e){Lt(this,t,e),g(this,t,n=>{this.i._attachIntListener(n)})}attachIntVectorListener(t,e){Ht(this,t,e),g(this,t,n=>{this.i._attachIntVectorListener(n)})}attachUintListener(t,e){Lt(this,t,e),g(this,t,n=>{this.i._attachUintListener(n)})}attachUintVectorListener(t,e){Ht(this,t,e),g(this,t,n=>{this.i._attachUintVectorListener(n)})}attachDoubleListener(t,e){Lt(this,t,e),g(this,t,n=>{this.i._attachDoubleListener(n)})}attachDoubleVectorListener(t,e){Ht(this,t,e),g(this,t,n=>{this.i._attachDoubleVectorListener(n)})}attachFloatListener(t,e){Lt(this,t,e),g(this,t,n=>{this.i._attachFloatListener(n)})}attachFloatVectorListener(t,e){Ht(this,t,e),g(this,t,n=>{this.i._attachFloatVectorListener(n)})}attachStringListener(t,e){Lt(this,t,e),g(this,t,n=>{this.i._attachStringListener(n)})}attachStringVectorListener(t,e){Ht(this,t,e),g(this,t,n=>{this.i._attachStringVectorListener(n)})}attachProtoListener(t,e,n){Lt(this,t,e),g(this,t,r=>{this.i._attachProtoListener(r,n||!1)})}attachProtoVectorListener(t,e,n){Ht(this,t,e),g(this,t,r=>{this.i._attachProtoVectorListener(r,n||!1)})}attachAudioListener(t,e,n){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),Lt(this,t,(r,s)=>{r=new Float32Array(r.buffer,r.byteOffset,r.length/4),e(r,s)}),g(this,t,r=>{this.i._attachAudioListener(r,n||!1)})}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends Qo{get ga(){return this.i}pa(t,e,n){g(this,e,r=>{const[s,i]=Go(this,t,r);this.ga._addBoundTextureAsImageToStream(r,s,i,n)})}Z(t,e){Lt(this,t,e),g(this,t,n=>{this.ga._attachImageListener(n)})}aa(t,e){Ht(this,t,e),g(this,t,n=>{this.ga._attachImageVectorListener(n)})}}));var Qo,vt=class extends s1{};async function b(t,e,n){return async function(r,s,i,o){return t1(r,s,i,o)}(t,n.canvas??(Do()?void 0:document.createElement("canvas")),e,n)}function ta(t,e,n,r){if(t.U){const i=new so;if(n!=null&&n.regionOfInterest){if(!t.oa)throw Error("This task doesn't support region-of-interest.");var s=n.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].");m(i,1,(s.left+s.right)/2),m(i,2,(s.top+s.bottom)/2),m(i,4,s.right-s.left),m(i,3,s.bottom-s.top)}else m(i,1,.5),m(i,2,.5),m(i,4,1),m(i,3,1);if(n!=null&&n.rotationDegrees){if((n==null?void 0:n.rotationDegrees)%90!=0)throw Error("Expected rotation to be a multiple of 90°.");if(m(i,5,-Math.PI*n.rotationDegrees/180),(n==null?void 0:n.rotationDegrees)%180!=0){const[o,a]=jo(e);n=N(i,3)*a/o,s=N(i,4)*o/a,m(i,4,n),m(i,3,s)}}t.g.addProtoToStream(i.g(),"mediapipe.NormalizedRect",t.U,r)}t.g.pa(e,t.X,r??performance.now()),t.finishProcessing()}function wt(t,e,n){var r;if((r=t.baseOptions)!=null&&r.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");ta(t,e,n,t.C+1)}function Ft(t,e,n,r){var s;if(!((s=t.baseOptions)!=null&&s.g()))throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");ta(t,e,n,r)}function Ne(t,e,n,r){var s=e.data;const i=e.width,o=i*(e=e.height);if((s instanceof Uint8Array||s instanceof Float32Array)&&s.length!==o)throw Error("Unsupported channel count: "+s.length/o);return t=new z([s],n,!1,t.g.i.canvas,t.P,i,e),r?t.clone():t}var ot=class extends Yr{constructor(t,e,n,r){super(t),this.g=t,this.X=e,this.U=n,this.oa=r,this.P=new Xo}l(t,e=!0){if("runningMode"in t&&k(this.baseOptions,2,Ke(!!t.runningMode&&t.runningMode!=="IMAGE")),t.canvas!==void 0&&this.g.i.canvas!==t.canvas)throw Error("You must create a new task to reset the canvas.");return super.l(t,e)}close(){this.P.close(),super.close()}};ot.prototype.close=ot.prototype.close;var dt=class extends ot{constructor(t,e){super(new vt(t,e),"image_in","norm_rect_in",!1),this.j={detections:[]},y(t=this.h=new xn,0,1,e=new I),m(this.h,2,.5),m(this.h,3,.3)}get baseOptions(){return A(this.h,I,1)}set baseOptions(t){y(this.h,0,1,t)}o(t){return"minDetectionConfidence"in t&&m(this.h,2,t.minDetectionConfidence??.5),"minSuppressionThreshold"in t&&m(this.h,3,t.minSuppressionThreshold??.3),this.l(t)}F(t,e){return this.j={detections:[]},wt(this,t,e),this.j}G(t,e,n){return this.j={detections:[]},Ft(this,t,n,e),this.j}m(){var t=new it;P(t,"image_in"),P(t,"norm_rect_in"),E(t,"detections");const e=new st;St(e,U2,this.h);const n=new $;nt(n,2,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),L(n,"IMAGE:image_in"),L(n,"NORM_RECT:norm_rect_in"),w(n,"DETECTIONS:detections"),n.o(e),ft(t,n),this.g.attachProtoVectorListener("detections",(r,s)=>{for(const i of r)r=eo(i),this.j.detections.push(No(r));l(this,s)}),this.g.attachEmptyPacketListener("detections",r=>{l(this,r)}),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};dt.prototype.detectForVideo=dt.prototype.G,dt.prototype.detect=dt.prototype.F,dt.prototype.setOptions=dt.prototype.o,dt.createFromModelPath=async function(t,e){return b(dt,t,{baseOptions:{modelAssetPath:e}})},dt.createFromModelBuffer=function(t,e){return b(dt,t,{baseOptions:{modelAssetBuffer:e}})},dt.createFromOptions=function(t,e){return b(dt,t,e)};var ts=_t([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=_t([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]),ns=_t([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),ea=_t([474,475],[475,476],[476,477],[477,474]),rs=_t([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=_t([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),na=_t([469,470],[470,471],[471,472],[472,469]),is=_t([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]),ra=[...ts,...es,...ns,...rs,...ss,...is],sa=_t([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 ia(t){t.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var O=class extends ot{constructor(t,e){super(new vt(t,e),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,y(t=this.h=new fo,0,1,e=new I),this.A=new lo,y(this.h,0,3,this.A),this.u=new xn,y(this.h,0,2,this.u),Nt(this.u,4,1),m(this.u,2,.5),m(this.A,2,.5),m(this.h,4,.5)}get baseOptions(){return A(this.h,I,1)}set baseOptions(t){y(this.h,0,1,t)}o(t){return"numFaces"in t&&Nt(this.u,4,t.numFaces??1),"minFaceDetectionConfidence"in t&&m(this.u,2,t.minFaceDetectionConfidence??.5),"minTrackingConfidence"in t&&m(this.h,4,t.minTrackingConfidence??.5),"minFacePresenceConfidence"in t&&m(this.A,2,t.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in t&&(this.outputFaceBlendshapes=!!t.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in t&&(this.outputFacialTransformationMatrixes=!!t.outputFacialTransformationMatrixes),this.l(t)}F(t,e){return ia(this),wt(this,t,e),this.j}G(t,e,n){return ia(this),Ft(this,t,n,e),this.j}m(){var t=new it;P(t,"image_in"),P(t,"norm_rect"),E(t,"face_landmarks");const e=new st;St(e,G2,this.h);const n=new $;nt(n,2,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),L(n,"IMAGE:image_in"),L(n,"NORM_RECT:norm_rect"),w(n,"NORM_LANDMARKS:face_landmarks"),n.o(e),ft(t,n),this.g.attachProtoVectorListener("face_landmarks",(r,s)=>{for(const i of r)r=Qe(i),this.j.faceLandmarks.push(Nn(r));l(this,s)}),this.g.attachEmptyPacketListener("face_landmarks",r=>{l(this,r)}),this.outputFaceBlendshapes&&(E(t,"blendshapes"),w(n,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",(r,s)=>{if(this.outputFaceBlendshapes)for(const i of r)r=Pn(i),this.j.faceBlendshapes.push(qr(r.g()??[]));l(this,s)}),this.g.attachEmptyPacketListener("blendshapes",r=>{l(this,r)})),this.outputFacialTransformationMatrixes&&(E(t,"face_geometry"),w(n,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",(r,s)=>{if(this.outputFacialTransformationMatrixes)for(const i of r)(r=A(r=j2(i),O2,2))&&this.j.facialTransformationMatrixes.push({rows:ut(r,1)??0??0,columns:ut(r,2)??0??0,data:Qt(r,3,Et,Zt()).slice()??[]});l(this,s)}),this.g.attachEmptyPacketListener("face_geometry",r=>{l(this,r)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};O.prototype.detectForVideo=O.prototype.G,O.prototype.detect=O.prototype.F,O.prototype.setOptions=O.prototype.o,O.createFromModelPath=function(t,e){return b(O,t,{baseOptions:{modelAssetPath:e}})},O.createFromModelBuffer=function(t,e){return b(O,t,{baseOptions:{modelAssetBuffer:e}})},O.createFromOptions=function(t,e){return b(O,t,e)},O.FACE_LANDMARKS_LIPS=ts,O.FACE_LANDMARKS_LEFT_EYE=es,O.FACE_LANDMARKS_LEFT_EYEBROW=ns,O.FACE_LANDMARKS_LEFT_IRIS=ea,O.FACE_LANDMARKS_RIGHT_EYE=rs,O.FACE_LANDMARKS_RIGHT_EYEBROW=ss,O.FACE_LANDMARKS_RIGHT_IRIS=na,O.FACE_LANDMARKS_FACE_OVAL=is,O.FACE_LANDMARKS_CONTOURS=ra,O.FACE_LANDMARKS_TESSELATION=sa;var os=_t([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 oa(t){t.gestures=[],t.landmarks=[],t.worldLandmarks=[],t.handedness=[]}function aa(t){return t.gestures.length===0?{gestures:[],landmarks:[],worldLandmarks:[],handedness:[],handednesses:[]}:{gestures:t.gestures,landmarks:t.landmarks,worldLandmarks:t.worldLandmarks,handedness:t.handedness,handednesses:t.handedness}}function ca(t,e=!0){const n=[];for(const s of t){var r=Pn(s);t=[];for(const i of r.g())r=e&&ut(i,1)!=null?ut(i,1)??0:-1,t.push({score:N(i,2)??0,index:r,categoryName:q(T(i,3))??""??"",displayName:q(T(i,4))??""??""});n.push(t)}return n}var at=class extends ot{constructor(t,e){super(new vt(t,e),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],y(t=this.j=new mo,0,1,e=new I),this.u=new Ur,y(this.j,0,2,this.u),this.D=new Dr,y(this.u,0,3,this.D),this.A=new go,y(this.u,0,2,this.A),this.h=new V2,y(this.j,0,3,this.h),m(this.A,2,.5),m(this.u,4,.5),m(this.D,2,.5)}get baseOptions(){return A(this.j,I,1)}set baseOptions(t){y(this.j,0,1,t)}o(t){var s,i,o,a;if(Nt(this.A,3,t.numHands??1),"minHandDetectionConfidence"in t&&m(this.A,2,t.minHandDetectionConfidence??.5),"minTrackingConfidence"in t&&m(this.u,4,t.minTrackingConfidence??.5),"minHandPresenceConfidence"in t&&m(this.D,2,t.minHandPresenceConfidence??.5),t.cannedGesturesClassifierOptions){var e=new Oe,n=e,r=zr(t.cannedGesturesClassifierOptions,(s=A(this.h,Oe,3))==null?void 0:s.l());y(n,0,2,r),y(this.h,0,3,e)}else t.cannedGesturesClassifierOptions===void 0&&((i=A(this.h,Oe,3))==null||i.g());return t.customGesturesClassifierOptions?(y(n=e=new Oe,0,2,r=zr(t.customGesturesClassifierOptions,(o=A(this.h,Oe,4))==null?void 0:o.l())),y(this.h,0,4,e)):t.customGesturesClassifierOptions===void 0&&((a=A(this.h,Oe,4))==null||a.g()),this.l(t)}Ha(t,e){return oa(this),wt(this,t,e),aa(this)}Ia(t,e,n){return oa(this),Ft(this,t,n,e),aa(this)}m(){var t=new it;P(t,"image_in"),P(t,"norm_rect"),E(t,"hand_gestures"),E(t,"hand_landmarks"),E(t,"world_hand_landmarks"),E(t,"handedness");const e=new st;St(e,H2,this.j);const n=new $;nt(n,2,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),L(n,"IMAGE:image_in"),L(n,"NORM_RECT:norm_rect"),w(n,"HAND_GESTURES:hand_gestures"),w(n,"LANDMARKS:hand_landmarks"),w(n,"WORLD_LANDMARKS:world_hand_landmarks"),w(n,"HANDEDNESS:handedness"),n.o(e),ft(t,n),this.g.attachProtoVectorListener("hand_landmarks",(r,s)=>{for(const i of r){r=Qe(i);const o=[];for(const a of xt(r,ro,1))o.push({x:N(a,1)??0,y:N(a,2)??0,z:N(a,3)??0,visibility:N(a,4)??0});this.landmarks.push(o)}l(this,s)}),this.g.attachEmptyPacketListener("hand_landmarks",r=>{l(this,r)}),this.g.attachProtoVectorListener("world_hand_landmarks",(r,s)=>{for(const i of r){r=Pe(i);const o=[];for(const a of xt(r,no,1))o.push({x:N(a,1)??0,y:N(a,2)??0,z:N(a,3)??0,visibility:N(a,4)??0});this.worldLandmarks.push(o)}l(this,s)}),this.g.attachEmptyPacketListener("world_hand_landmarks",r=>{l(this,r)}),this.g.attachProtoVectorListener("hand_gestures",(r,s)=>{this.gestures.push(...ca(r,!1)),l(this,s)}),this.g.attachEmptyPacketListener("hand_gestures",r=>{l(this,r)}),this.g.attachProtoVectorListener("handedness",(r,s)=>{this.handedness.push(...ca(r)),l(this,s)}),this.g.attachEmptyPacketListener("handedness",r=>{l(this,r)}),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};function ha(t){return{landmarks:t.landmarks,worldLandmarks:t.worldLandmarks,handednesses:t.handedness,handedness:t.handedness}}at.prototype.recognizeForVideo=at.prototype.Ia,at.prototype.recognize=at.prototype.Ha,at.prototype.setOptions=at.prototype.o,at.createFromModelPath=function(t,e){return b(at,t,{baseOptions:{modelAssetPath:e}})},at.createFromModelBuffer=function(t,e){return b(at,t,{baseOptions:{modelAssetBuffer:e}})},at.createFromOptions=function(t,e){return b(at,t,e)},at.HAND_CONNECTIONS=os;var J=class extends ot{constructor(t,e){super(new vt(t,e),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],y(t=this.h=new Ur,0,1,e=new I),this.u=new Dr,y(this.h,0,3,this.u),this.j=new go,y(this.h,0,2,this.j),Nt(this.j,3,1),m(this.j,2,.5),m(this.u,2,.5),m(this.h,4,.5)}get baseOptions(){return A(this.h,I,1)}set baseOptions(t){y(this.h,0,1,t)}o(t){return"numHands"in t&&Nt(this.j,3,t.numHands??1),"minHandDetectionConfidence"in t&&m(this.j,2,t.minHandDetectionConfidence??.5),"minTrackingConfidence"in t&&m(this.h,4,t.minTrackingConfidence??.5),"minHandPresenceConfidence"in t&&m(this.u,2,t.minHandPresenceConfidence??.5),this.l(t)}F(t,e){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],wt(this,t,e),ha(this)}G(t,e,n){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Ft(this,t,n,e),ha(this)}m(){var t=new it;P(t,"image_in"),P(t,"norm_rect"),E(t,"hand_landmarks"),E(t,"world_hand_landmarks"),E(t,"handedness");const e=new st;St(e,W2,this.h);const n=new $;nt(n,2,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),L(n,"IMAGE:image_in"),L(n,"NORM_RECT:norm_rect"),w(n,"LANDMARKS:hand_landmarks"),w(n,"WORLD_LANDMARKS:world_hand_landmarks"),w(n,"HANDEDNESS:handedness"),n.o(e),ft(t,n),this.g.attachProtoVectorListener("hand_landmarks",(r,s)=>{for(const i of r)r=Qe(i),this.landmarks.push(Nn(r));l(this,s)}),this.g.attachEmptyPacketListener("hand_landmarks",r=>{l(this,r)}),this.g.attachProtoVectorListener("world_hand_landmarks",(r,s)=>{for(const i of r)r=Pe(i),this.worldLandmarks.push(tn(r));l(this,s)}),this.g.attachEmptyPacketListener("world_hand_landmarks",r=>{l(this,r)}),this.g.attachProtoVectorListener("handedness",(r,s)=>{var i=this.handedness,o=i.push;const a=[];for(const c of r){r=Pn(c);const u=[];for(const h of r.g())u.push({score:N(h,2)??0,index:ut(h,1)??0??-1,categoryName:q(T(h,3))??""??"",displayName:q(T(h,4))??""??""});a.push(u)}o.call(i,...a),l(this,s)}),this.g.attachEmptyPacketListener("handedness",r=>{l(this,r)}),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};J.prototype.detectForVideo=J.prototype.G,J.prototype.detect=J.prototype.F,J.prototype.setOptions=J.prototype.o,J.createFromModelPath=function(t,e){return b(J,t,{baseOptions:{modelAssetPath:e}})},J.createFromModelBuffer=function(t,e){return b(J,t,{baseOptions:{modelAssetBuffer:e}})},J.createFromOptions=function(t,e){return b(J,t,e)},J.HAND_CONNECTIONS=os;var ua=_t([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 la(t){t.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function fa(t){try{if(!t.D)return t.h;t.D(t.h)}finally{Bn(t)}}function Un(t,e){t=Qe(t),e.push(Nn(t))}var F=class extends ot{constructor(t,e){super(new vt(t,e),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,y(t=this.j=new Ao,0,1,e=new I),this.I=new Dr,y(this.j,0,2,this.I),this.W=new K2,y(this.j,0,3,this.W),this.u=new xn,y(this.j,0,4,this.u),this.O=new lo,y(this.j,0,5,this.O),this.A=new wo,y(this.j,0,6,this.A),this.M=new bo,y(this.j,0,7,this.M),m(this.u,2,.5),m(this.u,3,.3),m(this.O,2,.5),m(this.A,2,.5),m(this.A,3,.3),m(this.M,2,.5),m(this.I,2,.5)}get baseOptions(){return A(this.j,I,1)}set baseOptions(t){y(this.j,0,1,t)}o(t){return"minFaceDetectionConfidence"in t&&m(this.u,2,t.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in t&&m(this.u,3,t.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in t&&m(this.O,2,t.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in t&&(this.outputFaceBlendshapes=!!t.outputFaceBlendshapes),"minPoseDetectionConfidence"in t&&m(this.A,2,t.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in t&&m(this.A,3,t.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in t&&m(this.M,2,t.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in t&&(this.outputPoseSegmentationMasks=!!t.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in t&&m(this.I,2,t.minHandLandmarksConfidence??.5),this.l(t)}F(t,e,n){const r=typeof e!="function"?e:{};return this.D=typeof e=="function"?e:n,la(this),wt(this,t,r),fa(this)}G(t,e,n,r){const s=typeof n!="function"?n:{};return this.D=typeof n=="function"?n:r,la(this),Ft(this,t,s,e),fa(this)}m(){var t=new it;P(t,"input_frames_image"),E(t,"pose_landmarks"),E(t,"pose_world_landmarks"),E(t,"face_landmarks"),E(t,"left_hand_landmarks"),E(t,"left_hand_world_landmarks"),E(t,"right_hand_landmarks"),E(t,"right_hand_world_landmarks");const e=new st,n=new Di;nt(n,1,"type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),function(s,i){if(i!=null)if(Array.isArray(i))k(s,2,dn(i,0,Xe));else{if(!(typeof i=="string"||i instanceof bt||Wn(i)))throw Error("invalid value in Any.value field: "+i+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");Dt(s,2,Xn(i,!1),zt())}}(n,this.j.g());const r=new $;nt(r,2,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),gr(r,8,Di,n),L(r,"IMAGE:input_frames_image"),w(r,"POSE_LANDMARKS:pose_landmarks"),w(r,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),w(r,"FACE_LANDMARKS:face_landmarks"),w(r,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),w(r,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),w(r,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),w(r,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),r.o(e),ft(t,r),Cn(this,t),this.g.attachProtoListener("pose_landmarks",(s,i)=>{Un(s,this.h.poseLandmarks),l(this,i)}),this.g.attachEmptyPacketListener("pose_landmarks",s=>{l(this,s)}),this.g.attachProtoListener("pose_world_landmarks",(s,i)=>{var o=this.h.poseWorldLandmarks;s=Pe(s),o.push(tn(s)),l(this,i)}),this.g.attachEmptyPacketListener("pose_world_landmarks",s=>{l(this,s)}),this.outputPoseSegmentationMasks&&(w(r,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),Ie(this,"pose_segmentation_mask"),this.g.Z("pose_segmentation_mask",(s,i)=>{this.h.poseSegmentationMasks=[Ne(this,s,!0,!this.D)],l(this,i)}),this.g.attachEmptyPacketListener("pose_segmentation_mask",s=>{this.h.poseSegmentationMasks=[],l(this,s)})),this.g.attachProtoListener("face_landmarks",(s,i)=>{Un(s,this.h.faceLandmarks),l(this,i)}),this.g.attachEmptyPacketListener("face_landmarks",s=>{l(this,s)}),this.outputFaceBlendshapes&&(E(t,"extra_blendshapes"),w(r,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",(s,i)=>{var o=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(s=Pn(s),o.push(qr(s.g()??[]))),l(this,i)}),this.g.attachEmptyPacketListener("extra_blendshapes",s=>{l(this,s)})),this.g.attachProtoListener("left_hand_landmarks",(s,i)=>{Un(s,this.h.leftHandLandmarks),l(this,i)}),this.g.attachEmptyPacketListener("left_hand_landmarks",s=>{l(this,s)}),this.g.attachProtoListener("left_hand_world_landmarks",(s,i)=>{var o=this.h.leftHandWorldLandmarks;s=Pe(s),o.push(tn(s)),l(this,i)}),this.g.attachEmptyPacketListener("left_hand_world_landmarks",s=>{l(this,s)}),this.g.attachProtoListener("right_hand_landmarks",(s,i)=>{Un(s,this.h.rightHandLandmarks),l(this,i)}),this.g.attachEmptyPacketListener("right_hand_landmarks",s=>{l(this,s)}),this.g.attachProtoListener("right_hand_world_landmarks",(s,i)=>{var o=this.h.rightHandWorldLandmarks;s=Pe(s),o.push(tn(s)),l(this,i)}),this.g.attachEmptyPacketListener("right_hand_world_landmarks",s=>{l(this,s)}),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};F.prototype.detectForVideo=F.prototype.G,F.prototype.detect=F.prototype.F,F.prototype.setOptions=F.prototype.o,F.createFromModelPath=function(t,e){return b(F,t,{baseOptions:{modelAssetPath:e}})},F.createFromModelBuffer=function(t,e){return b(F,t,{baseOptions:{modelAssetBuffer:e}})},F.createFromOptions=function(t,e){return b(F,t,e)},F.HAND_CONNECTIONS=os,F.POSE_CONNECTIONS=ua,F.FACE_LANDMARKS_LIPS=ts,F.FACE_LANDMARKS_LEFT_EYE=es,F.FACE_LANDMARKS_LEFT_EYEBROW=ns,F.FACE_LANDMARKS_LEFT_IRIS=ea,F.FACE_LANDMARKS_RIGHT_EYE=rs,F.FACE_LANDMARKS_RIGHT_EYEBROW=ss,F.FACE_LANDMARKS_RIGHT_IRIS=na,F.FACE_LANDMARKS_FACE_OVAL=is,F.FACE_LANDMARKS_CONTOURS=ra,F.FACE_LANDMARKS_TESSELATION=sa;var pt=class extends ot{constructor(t,e){super(new vt(t,e),"input_image","norm_rect",!0),this.j={classifications:[]},y(t=this.h=new Eo,0,1,e=new I)}get baseOptions(){return A(this.h,I,1)}set baseOptions(t){y(this.h,0,1,t)}o(t){return y(this.h,0,2,zr(t,A(this.h,Rr,2))),this.l(t)}sa(t,e){return this.j={classifications:[]},wt(this,t,e),this.j}ta(t,e,n){return this.j={classifications:[]},Ft(this,t,n,e),this.j}m(){var t=new it;P(t,"input_image"),P(t,"norm_rect"),E(t,"classifications");const e=new st;St(e,z2,this.h);const n=new $;nt(n,2,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),L(n,"IMAGE:input_image"),L(n,"NORM_RECT:norm_rect"),w(n,"CLASSIFICATIONS:classifications"),n.o(e),ft(t,n),this.g.attachProtoListener("classifications",(r,s)=>{this.j=Z2(N2(r)),l(this,s)}),this.g.attachEmptyPacketListener("classifications",r=>{l(this,r)}),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};pt.prototype.classifyForVideo=pt.prototype.ta,pt.prototype.classify=pt.prototype.sa,pt.prototype.setOptions=pt.prototype.o,pt.createFromModelPath=function(t,e){return b(pt,t,{baseOptions:{modelAssetPath:e}})},pt.createFromModelBuffer=function(t,e){return b(pt,t,{baseOptions:{modelAssetBuffer:e}})},pt.createFromOptions=function(t,e){return b(pt,t,e)};var ct=class extends ot{constructor(t,e){super(new vt(t,e),"image_in","norm_rect",!0),this.h=new ko,this.embeddings={embeddings:[]},y(t=this.h,0,1,e=new I)}get baseOptions(){return A(this.h,I,1)}set baseOptions(t){y(this.h,0,1,t)}o(t){var e=this.h,n=A(this.h,co,2);return n=n?n.clone():new co,t.l2Normalize!==void 0?k(n,1,Ke(t.l2Normalize)):"l2Normalize"in t&&k(n,1),t.quantize!==void 0?k(n,2,Ke(t.quantize)):"quantize"in t&&k(n,2),y(e,0,2,n),this.l(t)}za(t,e){return wt(this,t,e),this.embeddings}Aa(t,e,n){return Ft(this,t,n,e),this.embeddings}m(){var t=new it;P(t,"image_in"),P(t,"norm_rect"),E(t,"embeddings_out");const e=new st;St(e,q2,this.h);const n=new $;nt(n,2,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),L(n,"IMAGE:image_in"),L(n,"NORM_RECT:norm_rect"),w(n,"EMBEDDINGS:embeddings_out"),n.o(e),ft(t,n),this.g.attachProtoListener("embeddings_out",(r,s)=>{r=B2(r),this.embeddings=function(i){return{embeddings:xt(i,C2,1).map(o=>{var u,h;const a={headIndex:ut(o,3)??0??-1,headName:q(T(o,4))??""??""};var c=o.v;return ni(c,0|c[d],io,lr(o,1))!==void 0?(o=Qt(o=A(o,io,lr(o,1),void 0),1,Et,Zt()),a.floatEmbedding=o.slice()):(c=new Uint8Array(0),a.quantizedEmbedding=((h=(u=A(o,R2,lr(o,2),void 0))==null?void 0:u.na())==null?void 0:h.h())??c),a}),timestampMs:xo(ii(i))}}(r),l(this,s)}),this.g.attachEmptyPacketListener("embeddings_out",r=>{l(this,r)}),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};ct.cosineSimilarity=function(t,e){if(t.floatEmbedding&&e.floatEmbedding)t=Co(t.floatEmbedding,e.floatEmbedding);else{if(!t.quantizedEmbedding||!e.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");t=Co(Ro(t.quantizedEmbedding),Ro(e.quantizedEmbedding))}return t},ct.prototype.embedForVideo=ct.prototype.Aa,ct.prototype.embed=ct.prototype.za,ct.prototype.setOptions=ct.prototype.o,ct.createFromModelPath=function(t,e){return b(ct,t,{baseOptions:{modelAssetPath:e}})},ct.createFromModelBuffer=function(t,e){return b(ct,t,{baseOptions:{modelAssetBuffer:e}})},ct.createFromOptions=function(t,e){return b(ct,t,e)};var as=class{constructor(t,e,n){this.confidenceMasks=t,this.categoryMask=e,this.qualityScores=n}close(){var t,e;(t=this.confidenceMasks)==null||t.forEach(n=>{n.close()}),(e=this.categoryMask)==null||e.close()}};function i1(t){var n,r;const e=function(s){return xt(s,$,1)}(t.ca()).filter(s=>(q(T(s,1))??"").includes("mediapipe.tasks.TensorsToSegmentationCalculator"));if(t.u=[],e.length>1)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");e.length===1&&(((r=(n=A(e[0],st,7))==null?void 0:n.j())==null?void 0:r.g())??new Map).forEach((s,i)=>{t.u[Number(i)]=q(T(s,1))??""})}function da(t){t.categoryMask=void 0,t.confidenceMasks=void 0,t.qualityScores=void 0}function pa(t){try{const e=new as(t.confidenceMasks,t.categoryMask,t.qualityScores);if(!t.j)return e;t.j(e)}finally{Bn(t)}}as.prototype.close=as.prototype.close;var Z=class extends ot{constructor(t,e){super(new vt(t,e),"image_in","norm_rect",!1),this.u=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Hr,this.A=new So,y(this.h,0,3,this.A),y(t=this.h,0,1,e=new I)}get baseOptions(){return A(this.h,I,1)}set baseOptions(t){y(this.h,0,1,t)}o(t){return t.displayNamesLocale!==void 0?k(this.h,2,qe(t.displayNamesLocale)):"displayNamesLocale"in t&&k(this.h,2),"outputCategoryMask"in t&&(this.outputCategoryMask=t.outputCategoryMask??!1),"outputConfidenceMasks"in t&&(this.outputConfidenceMasks=t.outputConfidenceMasks??!0),super.l(t)}L(){i1(this)}segment(t,e,n){const r=typeof e!="function"?e:{};return this.j=typeof e=="function"?e:n,da(this),wt(this,t,r),pa(this)}La(t,e,n,r){const s=typeof n!="function"?n:{};return this.j=typeof n=="function"?n:r,da(this),Ft(this,t,s,e),pa(this)}Da(){return this.u}m(){var t=new it;P(t,"image_in"),P(t,"norm_rect");const e=new st;St(e,Fo,this.h);const n=new $;nt(n,2,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),L(n,"IMAGE:image_in"),L(n,"NORM_RECT:norm_rect"),n.o(e),ft(t,n),Cn(this,t),this.outputConfidenceMasks&&(E(t,"confidence_masks"),w(n,"CONFIDENCE_MASKS:confidence_masks"),Ie(this,"confidence_masks"),this.g.aa("confidence_masks",(r,s)=>{this.confidenceMasks=r.map(i=>Ne(this,i,!0,!this.j)),l(this,s)}),this.g.attachEmptyPacketListener("confidence_masks",r=>{this.confidenceMasks=[],l(this,r)})),this.outputCategoryMask&&(E(t,"category_mask"),w(n,"CATEGORY_MASK:category_mask"),Ie(this,"category_mask"),this.g.Z("category_mask",(r,s)=>{this.categoryMask=Ne(this,r,!1,!this.j),l(this,s)}),this.g.attachEmptyPacketListener("category_mask",r=>{this.categoryMask=void 0,l(this,r)})),E(t,"quality_scores"),w(n,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(r,s)=>{this.qualityScores=r,l(this,s)}),this.g.attachEmptyPacketListener("quality_scores",r=>{this.categoryMask=void 0,l(this,r)}),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Z.prototype.getLabels=Z.prototype.Da,Z.prototype.segmentForVideo=Z.prototype.La,Z.prototype.segment=Z.prototype.segment,Z.prototype.setOptions=Z.prototype.o,Z.createFromModelPath=function(t,e){return b(Z,t,{baseOptions:{modelAssetPath:e}})},Z.createFromModelBuffer=function(t,e){return b(Z,t,{baseOptions:{modelAssetBuffer:e}})},Z.createFromOptions=function(t,e){return b(Z,t,e)};var cs=class{constructor(t,e,n){this.confidenceMasks=t,this.categoryMask=e,this.qualityScores=n}close(){var t,e;(t=this.confidenceMasks)==null||t.forEach(n=>{n.close()}),(e=this.categoryMask)==null||e.close()}};cs.prototype.close=cs.prototype.close;var Mt=class extends ot{constructor(t,e){super(new vt(t,e),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Hr,this.u=new So,y(this.h,0,3,this.u),y(t=this.h,0,1,e=new I)}get baseOptions(){return A(this.h,I,1)}set baseOptions(t){y(this.h,0,1,t)}o(t){return"outputCategoryMask"in t&&(this.outputCategoryMask=t.outputCategoryMask??!1),"outputConfidenceMasks"in t&&(this.outputConfidenceMasks=t.outputConfidenceMasks??!0),super.l(t)}segment(t,e,n,r){const s=typeof n!="function"?n:{};if(this.j=typeof n=="function"?n:r,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,n=this.C+1,r=new Po,e.keypoint&&e.scribble)throw Error("Cannot provide both keypoint and scribble.");if(e.keypoint){var i=new Wr;Dt(i,3,Ke(!0),!1),Dt(i,1,We(e.keypoint.x),0),Dt(i,2,We(e.keypoint.y),0),Ye(r,1,Kr,i)}else{if(!e.scribble)throw Error("Must provide either a keypoint or a scribble.");{const a=new Y2;for(i of e.scribble)Dt(e=new Wr,3,Ke(!0),!1),Dt(e,1,We(i.x),0),Dt(e,2,We(i.y),0),gr(a,1,Wr,e);Ye(r,2,Kr,a)}}this.g.addProtoToStream(r.g(),"mediapipe.tasks.vision.interactive_segmenter.proto.RegionOfInterest","roi_in",n),wt(this,t,s);t:{try{const a=new cs(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var o=a;break t}this.j(a)}finally{Bn(this)}o=void 0}return o}m(){var t=new it;P(t,"image_in"),P(t,"roi_in"),P(t,"norm_rect_in");const e=new st;St(e,Fo,this.h);const n=new $;nt(n,2,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraphV2"),L(n,"IMAGE:image_in"),L(n,"ROI:roi_in"),L(n,"NORM_RECT:norm_rect_in"),n.o(e),ft(t,n),Cn(this,t),this.outputConfidenceMasks&&(E(t,"confidence_masks"),w(n,"CONFIDENCE_MASKS:confidence_masks"),Ie(this,"confidence_masks"),this.g.aa("confidence_masks",(r,s)=>{this.confidenceMasks=r.map(i=>Ne(this,i,!0,!this.j)),l(this,s)}),this.g.attachEmptyPacketListener("confidence_masks",r=>{this.confidenceMasks=[],l(this,r)})),this.outputCategoryMask&&(E(t,"category_mask"),w(n,"CATEGORY_MASK:category_mask"),Ie(this,"category_mask"),this.g.Z("category_mask",(r,s)=>{this.categoryMask=Ne(this,r,!1,!this.j),l(this,s)}),this.g.attachEmptyPacketListener("category_mask",r=>{this.categoryMask=void 0,l(this,r)})),E(t,"quality_scores"),w(n,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(r,s)=>{this.qualityScores=r,l(this,s)}),this.g.attachEmptyPacketListener("quality_scores",r=>{this.categoryMask=void 0,l(this,r)}),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Mt.prototype.segment=Mt.prototype.segment,Mt.prototype.setOptions=Mt.prototype.o,Mt.createFromModelPath=function(t,e){return b(Mt,t,{baseOptions:{modelAssetPath:e}})},Mt.createFromModelBuffer=function(t,e){return b(Mt,t,{baseOptions:{modelAssetBuffer:e}})},Mt.createFromOptions=function(t,e){return b(Mt,t,e)};var gt=class extends ot{constructor(t,e){super(new vt(t,e),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},y(t=this.h=new Oo,0,1,e=new I)}get baseOptions(){return A(this.h,I,1)}set baseOptions(t){y(this.h,0,1,t)}o(t){return t.displayNamesLocale!==void 0?k(this.h,2,qe(t.displayNamesLocale)):"displayNamesLocale"in t&&k(this.h,2),t.maxResults!==void 0?Nt(this.h,3,t.maxResults):"maxResults"in t&&k(this.h,3),t.scoreThreshold!==void 0?m(this.h,4,t.scoreThreshold):"scoreThreshold"in t&&k(this.h,4),t.categoryAllowlist!==void 0?pn(this.h,5,t.categoryAllowlist):"categoryAllowlist"in t&&k(this.h,5),t.categoryDenylist!==void 0?pn(this.h,6,t.categoryDenylist):"categoryDenylist"in t&&k(this.h,6),this.l(t)}F(t,e){return this.j={detections:[]},wt(this,t,e),this.j}G(t,e,n){return this.j={detections:[]},Ft(this,t,n,e),this.j}m(){var t=new it;P(t,"input_frame_gpu"),P(t,"norm_rect"),E(t,"detections");const e=new st;St(e,$2,this.h);const n=new $;nt(n,2,"mediapipe.tasks.vision.ObjectDetectorGraph"),L(n,"IMAGE:input_frame_gpu"),L(n,"NORM_RECT:norm_rect"),w(n,"DETECTIONS:detections"),n.o(e),ft(t,n),this.g.attachProtoVectorListener("detections",(r,s)=>{for(const i of r)r=eo(i),this.j.detections.push(No(r));l(this,s)}),this.g.attachEmptyPacketListener("detections",r=>{l(this,r)}),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};gt.prototype.detectForVideo=gt.prototype.G,gt.prototype.detect=gt.prototype.F,gt.prototype.setOptions=gt.prototype.o,gt.createFromModelPath=async function(t,e){return b(gt,t,{baseOptions:{modelAssetPath:e}})},gt.createFromModelBuffer=function(t,e){return b(gt,t,{baseOptions:{modelAssetBuffer:e}})},gt.createFromOptions=function(t,e){return b(gt,t,e)};var hs=class{constructor(t,e,n){this.landmarks=t,this.worldLandmarks=e,this.segmentationMasks=n}close(){var t;(t=this.segmentationMasks)==null||t.forEach(e=>{e.close()})}};function ga(t){t.landmarks=[],t.worldLandmarks=[],t.segmentationMasks=void 0}function ma(t){try{const e=new hs(t.landmarks,t.worldLandmarks,t.segmentationMasks);if(!t.u)return e;t.u(e)}finally{Bn(t)}}hs.prototype.close=hs.prototype.close;var ht=class extends ot{constructor(t,e){super(new vt(t,e),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,y(t=this.h=new Io,0,1,e=new I),this.A=new bo,y(this.h,0,3,this.A),this.j=new wo,y(this.h,0,2,this.j),Nt(this.j,4,1),m(this.j,2,.5),m(this.A,2,.5),m(this.h,4,.5)}get baseOptions(){return A(this.h,I,1)}set baseOptions(t){y(this.h,0,1,t)}o(t){return"numPoses"in t&&Nt(this.j,4,t.numPoses??1),"minPoseDetectionConfidence"in t&&m(this.j,2,t.minPoseDetectionConfidence??.5),"minTrackingConfidence"in t&&m(this.h,4,t.minTrackingConfidence??.5),"minPosePresenceConfidence"in t&&m(this.A,2,t.minPosePresenceConfidence??.5),"outputSegmentationMasks"in t&&(this.outputSegmentationMasks=t.outputSegmentationMasks??!1),this.l(t)}F(t,e,n){const r=typeof e!="function"?e:{};return this.u=typeof e=="function"?e:n,ga(this),wt(this,t,r),ma(this)}G(t,e,n,r){const s=typeof n!="function"?n:{};return this.u=typeof n=="function"?n:r,ga(this),Ft(this,t,s,e),ma(this)}m(){var t=new it;P(t,"image_in"),P(t,"norm_rect"),E(t,"normalized_landmarks"),E(t,"world_landmarks"),E(t,"segmentation_masks");const e=new st;St(e,J2,this.h);const n=new $;nt(n,2,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),L(n,"IMAGE:image_in"),L(n,"NORM_RECT:norm_rect"),w(n,"NORM_LANDMARKS:normalized_landmarks"),w(n,"WORLD_LANDMARKS:world_landmarks"),n.o(e),ft(t,n),Cn(this,t),this.g.attachProtoVectorListener("normalized_landmarks",(r,s)=>{this.landmarks=[];for(const i of r)r=Qe(i),this.landmarks.push(Nn(r));l(this,s)}),this.g.attachEmptyPacketListener("normalized_landmarks",r=>{this.landmarks=[],l(this,r)}),this.g.attachProtoVectorListener("world_landmarks",(r,s)=>{this.worldLandmarks=[];for(const i of r)r=Pe(i),this.worldLandmarks.push(tn(r));l(this,s)}),this.g.attachEmptyPacketListener("world_landmarks",r=>{this.worldLandmarks=[],l(this,r)}),this.outputSegmentationMasks&&(w(n,"SEGMENTATION_MASK:segmentation_masks"),Ie(this,"segmentation_masks"),this.g.aa("segmentation_masks",(r,s)=>{this.segmentationMasks=r.map(i=>Ne(this,i,!0,!this.u)),l(this,s)}),this.g.attachEmptyPacketListener("segmentation_masks",r=>{this.segmentationMasks=[],l(this,r)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};ht.prototype.detectForVideo=ht.prototype.G,ht.prototype.detect=ht.prototype.F,ht.prototype.setOptions=ht.prototype.o,ht.createFromModelPath=function(t,e){return b(ht,t,{baseOptions:{modelAssetPath:e}})},ht.createFromModelBuffer=function(t,e){return b(ht,t,{baseOptions:{modelAssetBuffer:e}})},ht.createFromOptions=function(t,e){return b(ht,t,e)},ht.POSE_CONNECTIONS=ua;class ya{constructor(e){this.models={face:null,hand:null},this.timerId=null,this.requestId=null,this.CHALLENGE_POOL=["Smile","Blink","Turn_Head","Thumbs_Up"],this.detectLoop=()=>{var o,a;if(this.state.status!=="capturing"||!this.webcam||!this.models.face)return;const n=this.webcam,r=performance.now(),s=(o=this.models.face)==null?void 0:o.detectForVideo(n,r),i=(a=this.models.hand)==null?void 0:a.detectForVideo(n,r);this.checkAction(s,i,this.state.sequence[this.currentStepRef])&&(this.isStepTransitioningRef||(this.isStepTransitioningRef=!0,this.updateState({isStepTransitioning:!0}),setTimeout(()=>{this.currentStepRef<this.state.sequence.length-1?(this.currentStepRef++,this.updateState({currentStep:this.currentStepRef,isStepTransitioning:!1}),this.isStepTransitioningRef=!1):this.sendFinalProof()},1500))),this.requestId=requestAnimationFrame(this.detectLoop)},this.apiUrl=e.apiUrl,this.duration=e.duration||60,this.smileThreshold=e.smileThreshold??.2,this.blinkThreshold=e.blinkThreshold??.01,this.minturnHeadThreshold=e.minturnHeadThreshold??.15,this.maxturnHeadThreshold=e.maxturnHeadThreshold??.85,this.onStateChange=e.onStateChange,this.onComplete=e.onComplete,this.onError=e.onError,this.state={status:"loading",sequence:[],currentStep:0,timeLeft:this.duration,isStepTransitioning:!1,errorMsg:""},this.currentStepRef=0,this.isStepTransitioningRef=!1}async init(e){this.webcam=e,await this.loadModels(),this.generateSequence(),this.updateState({status:"ready"})}start(){this.state.status==="ready"&&(this.updateState({status:"capturing"}),this.startTimer(),this.detectLoop())}stop(){this.timerId&&clearInterval(this.timerId),this.requestId&&cancelAnimationFrame(this.requestId)}reset(){this.timerId&&clearInterval(this.timerId),this.state={status:"ready",sequence:this.generateSequence(),currentStep:0,timeLeft:this.duration,isStepTransitioning:!1,errorMsg:""},this.currentStepRef=0,this.isStepTransitioningRef=!1,this.updateState(this.state)}updateState(e){var n;this.state={...this.state,...e},(n=this.onStateChange)==null||n.call(this,this.state)}generateSequence(){const e=[...this.CHALLENGE_POOL].sort(()=>.5-Math.random()).slice(0,3);return this.state.sequence=e,e}async loadModels(){try{const e=await ie.forVisionTasks("https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.3/wasm"),n=await O.createFromOptions(e,{baseOptions:{modelAssetPath:"https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/1/face_landmarker.task",delegate:"GPU"},outputFaceBlendshapes:!0,runningMode:"VIDEO"}),r=await J.createFromOptions(e,{baseOptions:{modelAssetPath:"https://storage.googleapis.com/mediapipe-models/hand_landmarker/hand_landmarker/float16/1/hand_landmarker.task",delegate:"GPU"},runningMode:"VIDEO",numHands:1});this.models={face:n,hand:r}}catch{this.updateState({status:"error",errorMsg:"Failed to load security assets."})}}startTimer(){this.timerId=setInterval(()=>{this.state.timeLeft>0?this.updateState({timeLeft:this.state.timeLeft-1}):(this.updateState({status:"expired"}),this.timerId&&clearInterval(this.timerId))},1e3)}checkAction(e,n,r){var s,i;if(this.isStepTransitioningRef)return!1;if(r==="Thumbs_Up"&&((s=n==null?void 0:n.landmarks)==null?void 0:s.length)>0){const o=n.landmarks[0];return o[4].y<o[2].y&&[8,12,16,20].every(a=>o[a].y>o[a-2].y)}if(((i=e==null?void 0:e.faceLandmarks)==null?void 0:i.length)>0){const o=e.faceLandmarks[0];switch(r){case"Smile":return o[291].x-o[61].x>this.smileThreshold;case"Blink":return(Math.abs(o[159].y-o[145].y)+Math.abs(o[386].y-o[374].y))/2<this.blinkThreshold;case"Turn_Head":const c=(o[1].x-o[33].x)/(o[263].x-o[33].x);return c<this.minturnHeadThreshold||c>this.maxturnHeadThreshold;default:return!1}}return!1}async sendFinalProof(){var n,r,s,i;if(!this.webcam)return;this.updateState({status:"verifying"});const e=[];for(let o=0;o<5;o++){const a=performance.now(),c=(n=this.models.face)==null?void 0:n.detectForVideo(this.webcam,a);(r=c==null?void 0:c.faceLandmarks)!=null&&r[0]&&e.push(this.getFaceCrop(this.webcam,c.faceLandmarks[0]).toDataURL("image/jpeg",.95)),await new Promise(u=>setTimeout(u,60))}try{const{verifyLiveness:o}=await Promise.resolve().then(()=>va),a=await o(this.apiUrl,e.map(c=>this.dataURLtoBlob(c)),this.state.sequence[this.currentStepRef]);a.is_live?(this.updateState({status:"success"}),(s=this.onComplete)==null||s.call(this,{success:!0,image:e[e.length-1],skinConfidence:a.skin_confidence})):(this.updateState({status:"error",errorMsg:a.reason||"Spoof detected"}),(i=this.onError)==null||i.call(this,{success:!1,reason:a.reason||"Spoof detected",skinConfidence:a.skin_confidence}))}catch{this.updateState({status:"error",errorMsg:"Server unreachable"})}}getFaceCrop(e,n){const r=document.createElement("canvas"),s=r.getContext("2d"),i=n.map(x=>x.x*e.videoWidth),o=n.map(x=>x.y*e.videoHeight),a=Math.min(...i),c=Math.max(...i),u=Math.min(...o),h=Math.max(...o),f=c-a,_=h-u,v=f*.25;return r.width=224,r.height=224,s.drawImage(e,a-v,u-v,f+v*2,_+v*2,0,0,224,224),r}dataURLtoBlob(e){const n=e.split(","),r=n[0].match(/:(.*?);/),s=r?r[1]:"",i=atob(n[1]);let o=i.length;const a=new Uint8Array(o);for(;o--;)a[o]=i.charCodeAt(o);return new Blob([a],{type:s})}}const o1=t=>{var a;const[e,n]=mt.useState({status:"loading",sequence:[],currentStep:0,timeLeft:t.duration||60,isStepTransitioning:!1,errorMsg:""}),r=mt.useRef(null),s=mt.useRef(null);mt.useEffect(()=>(r.current=new ya({...t,onStateChange:c=>n(c)}),()=>{var c;return(c=r.current)==null?void 0:c.stop()}),[t]),mt.useEffect(()=>{var u,h;const c=(u=s.current)==null?void 0:u.video;c&&e.status==="loading"&&((h=r.current)==null||h.init(c))},[(a=s.current)==null?void 0:a.video,e.status]);const i=mt.useCallback(()=>{var c;return(c=r.current)==null?void 0:c.start()},[]),o=mt.useCallback(()=>{var c;return(c=r.current)==null?void 0:c.reset()},[]);return{...e,webcamRef:s,start:i,reset:o}};Pt.LivenessEngine=ya,Pt.useLiveness=o1,Pt.verifyLiveness=fs,Object.defineProperty(Pt,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(v,_){typeof exports=="object"&&typeof module<"u"?_(exports,require("@mediapipe/tasks-vision"),require("react"),require("react-webcam")):typeof define=="function"&&define.amd?define(["exports","@mediapipe/tasks-vision","react","react-webcam"],_):(v=typeof globalThis<"u"?globalThis:v||self,_(v.LivenessSDK={},v.mediapipe,v.React,v.ReactWebcam))})(this,function(v,_,T,z){"use strict";const I=async(p,t,c)=>{const i=new FormData;t.forEach((n,a)=>{i.append("files",n,`frame_${a}.jpg`)}),i.append("challenge",JSON.stringify(c));const r=await fetch(`${p}/v1/verify`,{method:"POST",body:i});if(!r.ok)throw new Error("Network response was not ok");return await r.json()},B=Object.freeze(Object.defineProperty({__proto__:null,verifyLiveness:I},Symbol.toStringTag,{value:"Module"}));class N{constructor(t){this.models={face:null,hand:null},this.webcam=null,this.currentStepRef=0,this.isStepTransitioningRef=!1,this.timerId=null,this.requestId=null,this.offscreenCanvas=document.createElement("canvas"),this.CHALLENGE_POOL=["Smile","Blink","Turn_Head","Thumbs_Up"],this.attachVideo=c=>{this.webcam=c,console.log("[LivenessEngine] Video stream attached.")},this.start=()=>{if(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.requestId&&cancelAnimationFrame(this.requestId),this.timerId=null,this.requestId=null},this.reset=()=>{this.stop(),this.currentStepRef=0,this.isStepTransitioningRef=!1,this.generateSequence(),this.updateState({status:"ready",currentStep:0,timeLeft:this.config.duration,isStepTransitioning:!1,errorMsg:""})},this.detectLoop=()=>{var i;if(this.state.status!=="capturing"||!this.webcam||!this.models.face)return;const c=performance.now();try{const r=this.models.face.detectForVideo(this.webcam,c),l=(i=this.models.hand)==null?void 0:i.detectForVideo(this.webcam,c),n=this.state.sequence[this.currentStepRef];if(this.checkAction(r,l,n)){this.handleStepSuccess();return}}catch(r){console.error("[LivenessEngine] Loop detection error:",r)}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:""},this.offscreenCanvas.width=224,this.offscreenCanvas.height=224}async loadModels(){console.log("[LivenessEngine] Loading AI Models...");try{const t=await _.FilesetResolver.forVisionTasks("https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.3/wasm");this.models.face=await _.FaceLandmarker.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 _.HandLandmarker.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."})}}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.state.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)}handleStepSuccess(){this.isStepTransitioningRef||(this.isStepTransitioningRef=!0,this.updateState({isStepTransitioning:!0}),setTimeout(()=>{this.currentStepRef<this.state.sequence.length-1?(this.currentStepRef++,this.isStepTransitioningRef=!1,this.updateState({currentStep:this.currentStepRef,isStepTransitioning:!1}),this.requestId=requestAnimationFrame(this.detectLoop)):this.sendFinalProof()},1500))}checkAction(t,c,i){var r,l;if(this.isStepTransitioningRef)return!1;if(i==="Thumbs_Up"&&((r=c==null?void 0:c.landmarks)==null?void 0:r.length)>0){const n=c.landmarks[0];return n[4].y<n[2].y&&[8,12,16,20].every(a=>n[a].y>n[a-2].y)}if(((l=t==null?void 0:t.faceLandmarks)==null?void 0:l.length)>0){const n=t.faceLandmarks[0];switch(i){case"Smile":return n[291].x-n[61].x>this.config.smileThreshold;case"Blink":const a=Math.abs(n[159].y-n[145].y),h=Math.abs(n[386].y-n[374].y);return(a+h)/2<this.config.blinkThreshold;case"Turn_Head":const m=(n[1].x-n[33].x)/(n[263].x-n[33].x);return m<this.config.minturnHeadThreshold||m>this.config.maxturnHeadThreshold;default:return!1}}return!1}async sendFinalProof(){var t,c;this.stop(),this.updateState({status:"verifying"});try{const i=[];let r="";for(let a=0;a<5&&this.webcam;a++){const h=(t=this.models.face)==null?void 0:t.detectForVideo(this.webcam,performance.now());if((c=h==null?void 0:h.faceLandmarks)!=null&&c[0]){const m=this.getFaceCrop(this.webcam,h.faceLandmarks[0]),o=await new Promise(g=>m.toBlob(g,"image/jpeg",.9));o&&i.push(o),a===4&&(r=m.toDataURL("image/jpeg"))}await new Promise(m=>setTimeout(m,100))}const{verifyLiveness:l}=await Promise.resolve().then(()=>B),n=await l(this.config.apiUrl,i,this.state.sequence);if(n.is_live)this.updateState({status:"success"}),this.config.onComplete({success:!0,image:r,skinConfidence:n.skin_confidence});else{const a=n.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"})}}getFaceCrop(t,c){const i=this.offscreenCanvas.getContext("2d"),r=c.map(E=>E.x*t.videoWidth),l=c.map(E=>E.y*t.videoHeight),n=Math.min(...r),a=Math.max(...r),h=Math.min(...l),m=Math.max(...l),o=a-n,g=m-h,b=o*.3;return i.clearRect(0,0,224,224),i.drawImage(t,n-b,h-b,o+b*2,g+b*2,0,0,224,224),this.offscreenCanvas}}const F=p=>{const[t,c]=T.useState({status:"loading",sequence:[],currentStep:0,timeLeft:p.duration||60,isStepTransitioning:!1,errorMsg:""}),i=T.useRef(null),r=T.useRef(null);T.useEffect(()=>{const a=new N({...p,onStateChange:h=>c({...h})});return i.current=a,a.loadModels(),()=>a.stop()},[]),T.useEffect(()=>{var a,h;if(t.status!=="loading"&&t.status!=="error"){const m=(a=r.current)==null?void 0:a.video;if(m&&m.readyState>=2)(h=i.current)==null||h.attachVideo(m);else{const o=setInterval(()=>{var b,E;const g=(b=r.current)==null?void 0:b.video;g&&g.readyState>=2&&((E=i.current)==null||E.attachVideo(g),clearInterval(o))},100);return()=>clearInterval(o)}}},[t.status]);const l=T.useCallback(()=>{var a;console.log("[Hook] Start Clicked"),(a=i.current)==null||a.start()},[]),n=T.useCallback(()=>{var a;console.log("[Hook] Reset Clicked"),(a=i.current)==null||a.reset()},[]);return{...t,webcamRef:r,start:l,reset:n}};var x={exports:{}},y={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var M;function J(){if(M)return y;M=1;var p=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function c(i,r,l){var n=null;if(l!==void 0&&(n=""+l),r.key!==void 0&&(n=""+r.key),"key"in r){l={};for(var a in r)a!=="key"&&(l[a]=r[a])}else l=r;return r=l.ref,{$$typeof:p,type:i,key:n,ref:r!==void 0?r:null,props:l}}return y.Fragment=t,y.jsx=c,y.jsxs=c,y}var R={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.development.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var D;function X(){return D||(D=1,process.env.NODE_ENV!=="production"&&function(){function p(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===oe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case O:return"Fragment";case Q:return"Profiler";case K:return"StrictMode";case se:return"Suspense";case ne:return"SuspenseList";case ie:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case Z:return"Portal";case te:return e.displayName||"Context";case ee:return(e._context.displayName||"Context")+".Consumer";case re:var s=e.render;return e=e.displayName,e||(e=s.displayName||s.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ae:return s=e.displayName||null,s!==null?s:p(e.type)||"Memo";case L:s=e._payload,e=e._init;try{return p(e(s))}catch{}}return null}function t(e){return""+e}function c(e){try{t(e);var s=!1}catch{s=!0}if(s){s=console;var u=s.error,d=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return u.call(s,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",d),t(e)}}function i(e){if(e===O)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===L)return"<...>";try{var s=p(e);return s?"<"+s+">":"<...>"}catch{return"<...>"}}function r(){var e=j.A;return e===null?null:e.getOwner()}function l(){return Error("react-stack-top-frame")}function n(e){if(q.call(e,"key")){var s=Object.getOwnPropertyDescriptor(e,"key").get;if(s&&s.isReactWarning)return!1}return e.key!==void 0}function a(e,s){function u(){V||(V=!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)",s))}u.isReactWarning=!0,Object.defineProperty(e,"key",{get:u,configurable:!0})}function h(){var e=p(this.type);return U[e]||(U[e]=!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.")),e=this.props.ref,e!==void 0?e:null}function m(e,s,u,d,w,A){var f=u.ref;return e={$$typeof:Y,type:e,key:s,props:u,_owner:d},(f!==void 0?f:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:h}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:w}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:A}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function o(e,s,u,d,w,A){var f=s.children;if(f!==void 0)if(d)if(ce(f)){for(d=0;d<f.length;d++)g(f[d]);Object.freeze&&Object.freeze(f)}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 g(f);if(q.call(s,"key")){f=p(e);var k=Object.keys(s).filter(function(le){return le!=="key"});d=0<k.length?"{key: someKey, "+k.join(": ..., ")+": ...}":"{key: someKey}",G[f+d]||(k=0<k.length?"{"+k.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
|
+
let props = %s;
|
|
19
|
+
<%s {...props} />
|
|
20
|
+
React keys must be passed directly to JSX without using spread:
|
|
21
|
+
let props = %s;
|
|
22
|
+
<%s key={someKey} {...props} />`,d,f,k,f),G[f+d]=!0)}if(f=null,u!==void 0&&(c(u),f=""+u),n(s)&&(c(s.key),f=""+s.key),"key"in s){u={};for(var C in s)C!=="key"&&(u[C]=s[C])}else u=s;return f&&a(u,typeof e=="function"?e.displayName||e.name||"Unknown":e),m(e,f,u,r(),w,A)}function g(e){b(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===L&&(e._payload.status==="fulfilled"?b(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function b(e){return typeof e=="object"&&e!==null&&e.$$typeof===Y}var E=T,Y=Symbol.for("react.transitional.element"),Z=Symbol.for("react.portal"),O=Symbol.for("react.fragment"),K=Symbol.for("react.strict_mode"),Q=Symbol.for("react.profiler"),ee=Symbol.for("react.consumer"),te=Symbol.for("react.context"),re=Symbol.for("react.forward_ref"),se=Symbol.for("react.suspense"),ne=Symbol.for("react.suspense_list"),ae=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),ie=Symbol.for("react.activity"),oe=Symbol.for("react.client.reference"),j=E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=Object.prototype.hasOwnProperty,ce=Array.isArray,P=console.createTask?console.createTask:function(){return null};E={react_stack_bottom_frame:function(e){return e()}};var V,U={},H=E.react_stack_bottom_frame.bind(E,l)(),W=P(i(l)),G={};R.Fragment=O,R.jsx=function(e,s,u){var d=1e4>j.recentlyCreatedOwnerStacks++;return o(e,s,u,!1,d?Error("react-stack-top-frame"):H,d?P(i(e)):W)},R.jsxs=function(e,s,u){var d=1e4>j.recentlyCreatedOwnerStacks++;return o(e,s,u,!0,d?Error("react-stack-top-frame"):H,d?P(i(e)):W)}}()),R}process.env.NODE_ENV==="production"?x.exports=J():x.exports=X();var S=x.exports;const $=({apiUrl:p,duration:t,onComplete:c,onError:i,classNames:r={},render:l,smileThreshold:n,blinkThreshold:a,minturnHeadThreshold:h,maxturnHeadThreshold:m})=>{var g;const o=F({apiUrl:p,duration:t,smileThreshold:n,blinkThreshold:a,minturnHeadThreshold:h,maxturnHeadThreshold:m,onComplete:c,onError:i});return l?l(o):S.jsxs("div",{className:r.container,children:[o.status==="loading"&&S.jsx("div",{children:"Initializing..."}),["ready","capturing","verifying"].includes(o.status)&&S.jsxs(S.Fragment,{children:[S.jsx(z,{ref:o.webcamRef,mirrored:!0,screenshotFormat:"image/jpeg",className:r.webcam}),o.status==="capturing"&&S.jsx("div",{className:"liveness-challenge",children:o.isStepTransitioning?"Step verified! Get ready for the next...":`Do this: ${(g=o.sequence[o.currentStep])==null?void 0:g.replace("_"," ")}`}),["capturing","ready"].includes(o.status)&&S.jsxs("div",{className:r.timer,children:[o.timeLeft,"s"]}),o.status==="ready"&&S.jsx("button",{onClick:o.start,className:r.button,children:"Start Challenge"}),o.status==="verifying"&&S.jsx("div",{children:"Analyzing..."})]}),o.status==="error"&&S.jsxs("div",{className:r.error,children:[o.errorMsg,S.jsx("button",{onClick:o.reset,className:r.button,children:"Retry"})]}),o.status==="success"&&S.jsx("div",{className:r.success,children:"Verification Complete"})]})};v.LivenessEngine=N,v.LivenessSDK=$,v.useLiveness=F,v.verifyLiveness=I,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@richard.fadiora/liveness-detection",
|
|
3
|
-
"version": "4.1
|
|
3
|
+
"version": "4.2.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -25,7 +25,9 @@
|
|
|
25
25
|
"react": ">=18.0.0 <20.0",
|
|
26
26
|
"react-dom": ">=18.0.0 <20.0",
|
|
27
27
|
"react-webcam": "^7.2.0",
|
|
28
|
-
"@angular/core": ">=
|
|
28
|
+
"@angular/core": ">=21.0.0",
|
|
29
|
+
"@angular/common": ">=21.0.0",
|
|
30
|
+
"@mediapipe/tasks-vision": "^0.10.0"
|
|
29
31
|
},
|
|
30
32
|
"dependencies": {
|
|
31
33
|
"@mediapipe/tasks-vision": "^0.10.32",
|