@richard.fadiora/liveness-detection 4.0.1 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,15 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ht=require("react"),gi=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()},_a=Object.freeze(Object.defineProperty({__proto__:null,verifyLiveness:gi},Symbol.toStringTag,{value:"Module"}));var le=typeof self<"u"?self:{};function He(t,e){t:{for(var n=["CLOSURE_FLAGS"],r=le,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 Wt(){throw Error("Invalid UTF8")}function fs(t,e){return e=String.fromCharCode.apply(null,e),t==null?e:t+e}let nn,Gn;const va=typeof TextDecoder<"u";let wa;const ba=typeof TextEncoder<"u";function mi(t){if(ba)t=(wa||(wa=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 yi(t){le.setTimeout(()=>{throw t},0)}var $n,Aa=He(610401301,!1),ds=He(748402147,!0),gr=He(824648567,!0),mr=He(824656860,He(1,!0));function ps(){var t=le.navigator;return t&&(t=t.userAgent)?t:""}const gs=le.navigator;function mn(t){return mn[" "](t),t}$n=gs&&gs.userAgentData||null,mn[" "]=function(){};const _i={};let De=null;function Ea(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=De[h];if(f!=null)return f;if(!/^[\s\xa0]*$/.test(h))throw Error("Unknown base64 encoding at char: "+h)}return u}vi();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 vi(){if(!De){De={};var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),e=["+/=","+/","-_=","-_.","-_"];for(let n=0;n<5;n++){const r=t.concat(e[n].split(""));_i[n]=r;for(let s=0;s<r.length;s++){const i=r[s];De[i]===void 0&&(De[i]=s)}}}}var ka=typeof Uint8Array<"u",wi=!(!(Aa&&$n&&$n.brands.length>0)&&(ps().indexOf("Trident")!=-1||ps().indexOf("MSIE")!=-1))&&typeof btoa=="function";const ms=/[-_.]/g,Sa={"-":"+",_:"/",".":"="};function Ta(t){return Sa[t]||""}function bi(t){if(!wi)return Ea(t);t=ms.test(t)?t.replace(ms,Ta):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 yr(t){return ka&&t!=null&&t instanceof Uint8Array}var fe={};function Qt(){return La||(La=new Et(null,fe))}function _r(t){Ai(fe);var e=t.g;return(e=e==null||yr(e)?e:typeof e=="string"?bi(e):null)==null?e:t.g=e}var Et=class{h(){return new Uint8Array(_r(this)||0)}constructor(t,e){if(Ai(e),this.g=t,t!=null&&t.length===0)throw Error("ByteString should be constructed with non-empty values")}};let La,Fa;function Ai(t){if(t!==fe)throw Error("illegal external caller")}function Ei(t,e){t.__closure__error__context__984382||(t.__closure__error__context__984382={}),t.__closure__error__context__984382.severity=e}function Jn(t){return Ei(t=Error(t),"warning"),t}function de(t,e){if(t!=null){var n=Fa??(Fa={}),r=n[t]||0;r>=e||(n[t]=r+1,Ei(t=Error(),"incident"),yi(t))}}function Ee(){return typeof BigInt=="function"}var ke=typeof Symbol=="function"&&typeof Symbol()=="symbol";function kt(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 Ma=kt("jas",void 0,!0),ys=kt(void 0,"0di"),Re=kt(void 0,"1oa"),nt=kt(void 0,Symbol()),Pa=kt(void 0,"0ub"),Oa=kt(void 0,"0ubs"),Zn=kt(void 0,"0ubsb"),Ia=kt(void 0,"0actk"),pe=kt("m_m","Pa",!0),_s=kt();const ki={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},Si=Object.defineProperties,d=ke?Ma:"Ga";var ne;const vs=[];function Xe(t,e){ke||d in t||Si(t,ki),t[d]|=e}function V(t,e){ke||d in t||Si(t,ki),t[d]=e}function Ye(t){return Xe(t,34),t}function We(t){return Xe(t,8192),t}V(vs,7),ne=Object.freeze(vs);var ge={};function st(t,e){return e===void 0?t.h!==te&&!!(2&(0|t.v[d])):!!(2&e)&&t.h!==te}const te={};function vr(t,e){if(t!=null){if(typeof t=="string")t=t?new Et(t,fe):Qt();else if(t.constructor!==Et)if(yr(t))t=t.length?new Et(new Uint8Array(t),fe):Qt();else{if(!e)throw Error();t=void 0}}return t}class ws{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 xa=Object.freeze({});function Ti(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 Li={};function Se(t){return 128&t?Li:void 0}function yn(t){return t.Na=!0,t}var Na=yn(t=>typeof t=="number"),bs=yn(t=>typeof t=="string"),Ca=yn(t=>typeof t=="boolean"),_n=typeof le.BigInt=="function"&&typeof le.BigInt(0)=="bigint";function rt(t){var e=t;if(bs(e)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(e))throw Error(String(e))}else if(Na(e)&&!Number.isSafeInteger(e))throw Error(String(e));return _n?BigInt(t):t=Ca(t)?t?"1":"0":bs(t)?t.trim()||"0":String(t)}var Qn=yn(t=>_n?t>=Ba&&t<=Ua:t[0]==="-"?As(t,Ra):As(t,Da));const Ra=Number.MIN_SAFE_INTEGER.toString(),Ba=_n?BigInt(Number.MIN_SAFE_INTEGER):void 0,Da=Number.MAX_SAFE_INTEGER.toString(),Ua=_n?BigInt(Number.MAX_SAFE_INTEGER):void 0;function As(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 ja=typeof Uint8Array.prototype.slice=="function";let Ga,P=0,B=0;function Es(t){const e=t>>>0;P=e,B=(t-e)/4294967296>>>0}function me(t){if(t<0){Es(-t);const[e,n]=Er(P,B);P=e>>>0,B=n>>>0}else Es(t)}function wr(t){const e=Ga||(Ga=new DataView(new ArrayBuffer(8)));e.setFloat32(0,+t,!0),B=0,P=e.getUint32(0,!0)}function tr(t,e){const n=4294967296*e+(t>>>0);return Number.isSafeInteger(n)?n:Ke(t,e)}function Va(t,e){return rt(Ee()?BigInt.asUintN(64,(BigInt(e>>>0)<<BigInt(32))+BigInt(t>>>0)):Ke(t,e))}function br(t,e){const n=2147483648&e;return n&&(e=~e>>>0,(t=1+~t>>>0)==0&&(e=e+1>>>0)),typeof(t=tr(t,e))=="number"?n?-t:t:n?"-"+t:t}function Fi(t,e){return Ee()?rt(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(e))<<BigInt(32))+BigInt.asUintN(32,BigInt(t)))):rt(Ar(t,e))}function Ke(t,e){if(t>>>=0,(e>>>=0)<=2097151)var n=""+(4294967296*e+t);else Ee()?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+ks(n)+ks(t));return n}function ks(t){return t=String(t),"0000000".slice(t.length)+t}function Ar(t,e){if(2147483648&e)if(Ee())t=""+(BigInt(0|e)<<BigInt(32)|BigInt(t>>>0));else{const[n,r]=Er(t,e);t="-"+Ke(n,r)}else t=Ke(t,e);return t}function vn(t){if(t.length<16)me(Number(t));else if(Ee())t=BigInt(t),P=Number(t&BigInt(4294967295))>>>0,B=Number(t>>BigInt(32)&BigInt(4294967295));else{const e=+(t[0]==="-");B=P=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,P=1e6*P+i,P>=4294967296&&(B+=Math.trunc(P/4294967296),B>>>=0,P>>>=0)}if(e){const[r,s]=Er(P,B);P=r,B=s}}}function Er(t,e){return e=~e,t?t=1+~t:e+=1,[t,e]}function mt(t){return Array.prototype.slice.call(t)}const $e=typeof BigInt=="function"?BigInt.asIntN:void 0,Ha=typeof BigInt=="function"?BigInt.asUintN:void 0,ee=Number.isSafeInteger,wn=Number.isFinite,ye=Math.trunc,Wa=rt(0);function Ue(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 At(t){return t==null||typeof t=="number"?t:t==="NaN"||t==="Infinity"||t==="-Infinity"?Number(t):void 0}function ze(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 Mi(t){return t==null||typeof t=="boolean"?t:typeof t=="number"?!!t:void 0}const Ka=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Je(t){switch(typeof t){case"bigint":return!0;case"number":return wn(t);case"string":return Ka.test(t);default:return!1}}function Te(t){if(t==null)return t;if(typeof t=="string"&&t)t=+t;else if(typeof t!="number")return;return wn(t)?0|t:void 0}function Pi(t){if(t==null)return t;if(typeof t=="string"&&t)t=+t;else if(typeof t!="number")return;return wn(t)?t>>>0:void 0}function Oi(t){const e=t.length;return(t[0]==="-"?e<20||e===20&&t<="-9223372036854775808":e<19||e===19&&t<="9223372036854775807")?t:(vn(t),Ar(P,B))}function kr(t){return t=ye(t),ee(t)||(me(t),t=br(P,B)),t}function Ii(t){var e=ye(Number(t));return ee(e)?String(e):((e=t.indexOf("."))!==-1&&(t=t.substring(0,e)),Oi(t))}function xi(t){var e=ye(Number(t));return ee(e)?rt(e):((e=t.indexOf("."))!==-1&&(t=t.substring(0,e)),Ee()?rt($e(64,BigInt(t))):rt(Oi(t)))}function Ni(t){return ee(t)?t=rt(kr(t)):(t=ye(t),ee(t)?t=String(t):(me(t),t=Ar(P,B)),t=rt(t)),t}function za(t){return t==null?t:typeof t=="bigint"?(Qn(t)?t=Number(t):(t=$e(64,t),t=Qn(t)?Number(t):String(t)),t):Je(t)?typeof t=="number"?kr(t):Ii(t):void 0}function hn(t){const e=typeof t;return t==null?t:e==="bigint"?rt($e(64,t)):Je(t)?e==="string"?xi(t):Ni(t):void 0}function Ci(t){if(typeof t!="string")throw Error();return t}function Ze(t){if(t!=null&&typeof t!="string")throw Error();return t}function q(t){return t==null||typeof t=="string"?t:void 0}function Sr(t,e,n,r){return t!=null&&t[pe]===ge?t:Array.isArray(t)?((r=(n=0|t[d])|32&r|2&r)!==n&&V(t,r),new e(t)):(n?2&r?((t=e[ys])||(Ye((t=new e).v),t=e[ys]=t),e=t):e=new e:e=void 0,e)}function qa(t,e,n){if(e)t:{if(!Je(e=t))throw Jn("int64");switch(typeof e){case"string":e=xi(e);break t;case"bigint":e=rt($e(64,e));break t;default:e=Ni(e)}}else e=hn(t);return(t=e)==null?n?Wa:void 0:t}const Xa={};let Ya=function(){try{return mn(new class extends Map{constructor(){super()}}),!1}catch{return!0}}();class Vn{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 $a=Ya?(Object.setPrototypeOf(Vn.prototype,Map.prototype),Object.defineProperties(Vn.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),Vn):class extends Map{constructor(){super()}};function Ss(t){return t}function Hn(t){if(2&t.J)throw Error("Cannot mutate an immutable Map")}var Pt=class extends $a{constructor(t,e,n=Ss,r=Ss){super(),this.J=0|t[d],this.K=e,this.S=n,this.fa=this.K?Ja: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 We(Array.from(super.entries(),t))}clear(){Hn(this),super.clear()}delete(t){return Hn(this),super.delete(this.S(t,!0,!1))}entries(){if(this.K){var t=super.keys();t=new ws(t,Za,this)}else t=super.entries();return t}values(){if(this.K){var t=super.keys();t=new ws(t,Pt.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 Hn(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 Ja(t,e,n,r,s,i){return t=Sr(t,r,n,i),s&&(t=Lr(t)),t}function Za(t){return[t,this.get(t)]}let Qa;function Ts(){return Qa||(Qa=new Pt(Ye([]),void 0,void 0,void 0,Xa))}function bn(t){return nt?t[nt]:void 0}function un(t,e){for(const n in t)!isNaN(n)&&e(t,+n,t[n])}Pt.prototype.toJSON=void 0;var er=class{};const t2={Ka:!0};function e2(t,e){e<100||de(Oa,1)}function An(t,e,n,r){const s=r!==void 0;r=!!r;var i,o=nt;!s&&ke&&o&&(i=t[o])&&un(i,e2),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 I=_-f;(e??(e={}))[I]=v}else o[_]=v}if(c)for(let v in c){if((a=c[v])==null||(a=n(a,r))==null)continue;let I;_=+v,h&&!Number.isNaN(_)&&(I=_+f)<i?o[I]=a:(e??(e={}))[v]=a}return e&&(u?o.push(e):o[i]=e),s&&nt&&(t=bn(t))&&t instanceof er&&(o[nt]=function(v){const I=new er;return un(v,(Un,ie,Ce)=>{I[ie]=mt(Ce)}),I.da=v.da,I}(t)),o}function n2(t){return t[0]=qe(t[0]),t[1]=qe(t[1]),t}function qe(t){switch(typeof t){case"number":return Number.isFinite(t)?t:""+t;case"bigint":return Qn(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:An(t,e,qe)}if(t!=null&&t[pe]===ge)return Ri(t);if(t instanceof Et){if((e=t.g)==null)t="";else if(typeof e=="string")t=e;else{if(wi){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),vi(),n=_i[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 Pt?t=t.size!==0?t.V(n2):void 0:void 0}return t}function Ri(t){return An(t=t.v,0|t[d],qe)}let r2,s2;function Xt(t,e){return Bi(t,e[0],e[1])}function Bi(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],ds&&1&s)throw Error("rfarr");if(2048&s&&!(2&s)&&function(){if(ds)throw Error("carr");de(Ia,5)}(),256&s)throw Error("farr");if(64&s)return(s|r)!==s&&V(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 V(t,64|s|r),t}function i2(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:Ls(t,n,e)}if(t!=null&&t[pe]===ge)return Fs(t);if(t instanceof Pt){if(2&(e=t.J))return t;if(!t.size)return;if(n=Ye(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[pe]===ge?Fs(s):Array.isArray(s)?Ls(s,0|s[d],!!(32&e)):void 0,r[1]=s}return n}return t instanceof Et?t:void 0}function Ls(t,e,n){return 2&e||(!n||4096&e||16&e?t=Le(t,e,!1,n&&!(16&e)):(Xe(t,34),4&e&&Object.freeze(t))),t}function Tr(t,e,n){return t=new t.constructor(e),n&&(t.h=te),t.m=te,t}function Fs(t){const e=t.v,n=0|e[d];return st(t,n)?t:Fr(t,e,n)?Tr(t,e):Le(e,n)}function Le(t,e,n,r){return r??(r=!!(34&e)),t=An(t,e,i2,r),r=32,n&&(r|=2),V(t,e=16769217&e|r),t}function Lr(t){const e=t.v,n=0|e[d];return st(t,n)?Fr(t,e,n)?Tr(t,e,!0):new t.constructor(Le(e,n,!1)):t}function Fe(t){if(t.h!==te)return!1;var e=t.v;return Xe(e=Le(e,0|e[d]),2048),t.v=e,t.h=void 0,t.m=void 0,!0}function Me(t){if(!Fe(t)&&st(t,0|t.v[d]))throw Error()}function re(t,e){e===void 0&&(e=0|t[d]),32&e&&!(4096&e)&&V(t,4096|e)}function Fr(t,e,n){return!!(2&n)||!(!(32&n)||4096&n)&&(V(e,2|n),t.h=te,!0)}const o2=rt(0),Ct={};function L(t,e,n,r,s){if((e=Ot(t.v,e,n,s))!==null||r&&t.m!==te)return e}function Ot(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){Me(t),j(t=t.v,0|t[d],e,n,r)}function j(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 xa===void 0?2:4}function qt(t,e,n,r,s){let i=t.v,o=0|i[d];r=st(t,o)?1:r,s=!!s||r===3,r===2&&Fe(t)&&(i=t.v,o=0|i[d]);let a=(t=Mr(i,e))===ne?7:0|t[d],c=Pr(a,o);var u=!(4&c);if(u){4&c&&(t=mt(t),a=0,c=$t(c,o),o=j(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&&(V(t,c),2&c&&Object.freeze(t)),Di(t,c,i,o,e,r,u,s)}function Di(t,e,n,r,s,i,o,a){let c=e;return i===1||i===4&&(2&e||!(16&e)&&32&r)?Yt(e)||((e|=!t.length||o&&!(4096&e)||32&r&&!(4096&e||16&e)?2:256)!==c&&V(t,e),Object.freeze(t)):(i===2&&Yt(e)&&(t=mt(t),c=0,e=$t(e,r),r=j(n,r,s,t)),Yt(e)||(a||(e|=16),e!==c&&V(t,e))),2&e||!(4096&e||16&e)||re(n,r),t}function Mr(t,e,n){return t=Ot(t,e,n),Array.isArray(t)?t:ne}function Pr(t,e){return 2&e&&(t|=2),1|t}function Yt(t){return!!(2&t)&&!!(4&t)||!!(256&t)}function Ui(t){return vr(t,!0)}function ji(t){t=mt(t);for(let e=0;e<t.length;e++){const n=t[e]=mt(t[e]);Array.isArray(n[1])&&(n[1]=Ye(n[1]))}return We(t)}function Bt(t,e,n,r){Me(t),j(t=t.v,0|t[d],e,(r==="0"?Number(n)===0:n===r)?void 0:n)}function Pe(t,e,n){if(2&e)throw Error();const r=Se(e);let s=Mr(t,n,r),i=s===ne?7:0|s[d],o=Pr(i,e);return(2&o||Yt(o)||16&o)&&(o===i||Yt(o)||V(s,o),s=mt(s),i=0,o=$t(o,e),j(t,e,n,s,r)),o&=-13,o!==i&&V(s,o),s}function Wn(t,e){var n=xo;return Ir(Or(t=t.v),t,void 0,n)===e?e:-1}function Or(t){if(ke)return t[Re]??(t[Re]=new Map);if(Re in t)return t[Re];const e=new Map;return Object.defineProperty(t,Re,{value:e}),e}function Gi(t,e,n,r,s){const i=Or(t),o=Ir(i,t,e,n,s);return o!==r&&(o&&(e=j(t,e,o,void 0,s)),i.set(n,r)),e}function Ir(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];Ot(e,a,s)!=null&&(i!==0&&(n=j(e,n,i,void 0,s)),i=a)}return t.set(r,i),i}function xr(t,e,n){let r=0|t[d];const s=Se(r),i=Ot(t,n,s);let o;if(i!=null&&i[pe]===ge){if(!st(i))return Fe(i),i.v;o=i.v}else Array.isArray(i)&&(o=i);if(o){const a=0|o[d];2&a&&(o=Le(o,a))}return o=Xt(o,e),o!==i&&j(t,r,n,o,s),o}function Vi(t,e,n,r,s){let i=!1;if((r=Ot(t,r,s,o=>{const a=Sr(o,n,!1,e);return i=a!==o&&a!=null,a}))!=null)return i&&!st(r)&&re(t,e),r}function A(t,e,n,r){let s=t.v,i=0|s[d];if((e=Vi(s,i,e,n,r))==null)return e;if(i=0|s[d],!st(t,i)){const o=Lr(e);o!==e&&(Fe(t)&&(s=t.v,i=0|s[d]),i=j(s,i,n,e=o,r),re(s,i))}return e}function Hi(t,e,n,r,s,i,o,a){var c=st(t,n);i=c?1:i,o=!!o||i===3,c=a&&!c,(i===2||c)&&Fe(t)&&(n=0|(e=t.v)[d]);var u=(t=Mr(e,s))===ne?7:0|t[d],h=Pr(u,n);if(a=!(4&h)){var f=t,_=n;const v=!!(2&h);v&&(_|=2);let I=!v,Un=!0,ie=0,Ce=0;for(;ie<f.length;ie++){const jn=Sr(f[ie],r,!1,_);if(jn instanceof r){if(!v){const ls=st(jn);I&&(I=!ls),Un&&(Un=ls)}f[Ce++]=jn}}Ce<ie&&(f.length=Ce),h|=4,h=Un?-4097&h:4096|h,h=I?8|h:-9&h}if(h!==u&&(V(t,h),2&h&&Object.freeze(t)),c&&!(8&h||!t.length&&(i===1||i===4&&(2&h||!(16&h)&&32&n)))){for(Yt(h)&&(t=mt(t),h=$t(h,n),n=j(e,n,s,t)),r=t,c=h,u=0;u<r.length;u++)(f=r[u])!==(h=Lr(f))&&(r[u]=h);c|=8,V(t,h=c=r.length?4096|c:-4097&c)}return Di(t,h,e,n,s,i,a,o)}function It(t,e,n){const r=t.v;return Hi(t,r,0|r[d],e,n,zt(),!1,!0)}function Wi(t){return t==null&&(t=void 0),t}function y(t,e,n,r,s){return k(t,n,r=Wi(r),s),r&&!st(r)&&re(t.v),t}function je(t,e,n,r){t:{var s=r=Wi(r);Me(t);const i=t.v;let o=0|i[d];if(s==null){const a=Or(i);if(Ir(a,i,o,n)!==e)break t;a.set(n,0)}else o=Gi(i,o,n,e);j(i,o,e,s)}r&&!st(r)&&re(t.v)}function $t(t,e){return-273&(2&e?2|t:-3&t)}function Nr(t,e,n,r){var s=r;Me(t),t=Hi(t,r=t.v,0|r[d],n,e,2,!0),s=s??new n,t.push(s),e=n=t===ne?7:0|t[d],(s=st(s))?(n&=-9,t.length===1&&(n&=-4097)):n|=4096,n!==e&&V(t,n),s||re(r)}function dt(t,e,n){return Te(L(t,e,void 0,n))}function Ki(t){return(mr?L(t,2,void 0,void 0,hn):hn(L(t,2)))??o2}function C(t,e){return L(t,e,void 0,void 0,At)??0}function xt(t,e,n){if(n!=null){if(typeof n!="number"||!wn(n))throw Jn("int32");n|=0}k(t,e,n)}function m(t,e,n){k(t,e,Ue(n))}function it(t,e,n){Bt(t,e,Ze(n),"")}function ln(t,e,n){{Me(t);const o=t.v;let a=0|o[d];if(n==null)j(o,a,e);else{var r=t=n===ne?7:0|n[d],s=Yt(t),i=s||Object.isFrozen(n);for(s||(t=0),i||(n=mt(n),r=0,t=$t(t,a),i=!1),t|=5,t|=(4&t?512&t?512:1024&t?1024:0:void 0)??(mr?1024:0),s=0;s<n.length;s++){const c=n[s],u=Ci(c);Object.is(c,u)||(i&&(n=mt(n),r=0,t=$t(t,a),i=!1),n[s]=u)}t!==r&&(i&&(n=mt(n),t=$t(t,a)),V(n,t)),j(o,a,e,n)}}}function En(t,e,n){Me(t),qt(t,e,q,2,!0).push(Ci(n))}var oe=class{constructor(t,e,n){if(this.buffer=t,n&&!e)throw Error();this.g=e}};function Cr(t,e){if(typeof t=="string")return new oe(bi(t),e);if(Array.isArray(t))return new oe(new Uint8Array(t),e);if(t.constructor===Uint8Array)return new oe(t,!1);if(t.constructor===ArrayBuffer)return t=new Uint8Array(t),new oe(t,!1);if(t.constructor===Et)return e=_r(t)||new Uint8Array(0),new oe(e,!0,t);if(t instanceof Uint8Array)return t=t.constructor===Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new oe(t,!1);throw Error()}function _e(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(Jt(t,a),!(128&n))return e(r>>>0,s>>>0);throw Error()}function Rr(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 Jt(t,n),!!(127&e)}throw Error()}function jt(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 Jt(t,n),s}function Nt(t){return jt(t)>>>0}function fn(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],Jt(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 a2(t){return jt(t)}function Jt(t,e){if(t.g=e,e>t.l)throw Error()}function zi(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 qi(t,e){if(e==0)return Qt();var n=zi(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):ja?t.slice(n,e):new Uint8Array(t.subarray(n,e))),n.length==0?Qt():new Et(n,fe)}var Ms=[];function Xi(t,e,n,r){if(dn.length){const s=dn.pop();return s.o(r),s.g.init(t,e,n,r),s}return new c2(t,e,n,r)}function Yi(t){t.g.clear(),t.l=-1,t.h=-1,dn.length<100&&dn.push(t)}function $i(t){var e=t.g;if(e.g==e.l)return!1;t.m=t.g.g;var n=Nt(t.g);if(e=n>>>3,!((n&=7)>=0&&n<=5)||e<1)throw Error();return t.l=e,t.h=n,!0}function an(t){switch(t.h){case 0:t.h!=0?an(t):Rr(t.g);break;case 1:Jt(t=t.g,t.g+8);break;case 2:if(t.h!=2)an(t);else{var e=Nt(t.g);Jt(t=t.g,t.g+e)}break;case 5:Jt(t=t.g,t.g+4);break;case 3:for(e=t.l;;){if(!$i(t))throw Error();if(t.h==4){if(t.l!=e)throw Error();break}an(t)}break;default:throw Error()}}function Qe(t,e,n){const r=t.g.l;var s=Nt(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 Br(t){var e=Nt(t.g),n=zi(t=t.g,e);if(t=t.h,va){var r,s=t;(r=Gn)||(r=Gn=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(nn===void 0){try{r.decode(new Uint8Array([128]))}catch{}try{r.decode(new Uint8Array([97])),nn=!0}catch{nn=!1}}throw!nn&&(Gn=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?Wt():(a=t[i++],o<194||(192&a)!=128?(i--,Wt()):n.push((31&o)<<6|63&a)):o<240?i>=e-1?Wt():(a=t[i++],(192&a)!=128||o===224&&a<160||o===237&&a>=160||(192&(r=t[i++]))!=128?(i--,Wt()):n.push((15&o)<<12|(63&a)<<6|63&r)):o<=244?i>=e-2?Wt():(a=t[i++],(192&a)!=128||a-144+(o<<28)>>30||(192&(r=t[i++]))!=128||(192&(s=t[i++]))!=128?(i--,Wt()):(o=(7&o)<<18|(63&a)<<12|(63&r)<<6|63&s,o-=65536,n.push(55296+(o>>10&1023),56320+(1023&o)))):Wt(),n.length>=8192&&(c=fs(c,n),n.length=0)}i=fs(c,n)}return i}function Ji(t){const e=Nt(t.g);return qi(t.g,e)}function kn(t,e,n){var r=Nt(t.g);for(r=t.g.g+r;t.g.g<r;)n.push(e(t.g))}var c2=class{constructor(t,e,n,r){if(Ms.length){const s=Ms.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=Cr(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}},dn=[];function Ps(t){return t?/^\d+$/.test(t)?(vn(t),new nr(P,B)):null:h2||(h2=new nr(0,0))}var nr=class{constructor(t,e){this.h=t>>>0,this.g=e>>>0}};let h2;function Os(t){return t?/^-?\d+$/.test(t)?(vn(t),new rr(P,B)):null:u2||(u2=new rr(0,0))}var rr=class{constructor(t,e){this.h=t>>>0,this.g=e>>>0}};let u2;function he(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 Oe(t,e){for(;e>127;)t.g.push(127&e|128),e>>>=7;t.g.push(e)}function Sn(t,e){if(e>=0)Oe(t,e);else{for(let n=0;n<9;n++)t.g.push(127&e|128),e>>=7;t.g.push(1)}}function Dr(t){var e=P;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 ve(t,e){e.length!==0&&(t.l.push(e),t.h+=e.length)}function pt(t,e,n){Oe(t.g,8*e+n)}function Ur(t,e){return pt(t,e,2),e=t.g.end(),ve(t,e),e.push(t.h),e}function jr(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 Tn(t,e,n){pt(t,e,2),Oe(t.g,n.length),ve(t,t.g.end()),ve(t,n)}function pn(t,e,n,r){n!=null&&(e=Ur(t,e),r(n,t),jr(t,e))}function St(){const t=class{constructor(){throw Error()}};return Object.setPrototypeOf(t,t.prototype),t}var Gr=St(),Zi=St(),Vr=St(),Hr=St(),Qi=St(),to=St(),l2=St(),Ln=St(),eo=St(),no=St();function Tt(t,e,n){var r=t.v;nt&&nt in r&&(r=r[nt])&&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=Bi(t,e,void 0,2048)}toJSON(){return Ri(this)}j(){var s;var t=q2,e=this.v,n=t.g,r=nt;if(ke&&r&&((s=e[r])==null?void 0:s[n])!=null&&de(Pa,3),e=t.g,_s&&nt&&_s===void 0&&(r=(n=this.v)[nt])&&(r=r.da))try{r(n,e,t2)}catch(i){yi(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 Fr(this,t,e)?Tr(this,t,!0):new this.constructor(Le(t,e,!1))}};p.prototype[pe]=ge,p.prototype.toString=function(){return this.v.toString()};var Ie=class{constructor(t,e,n){this.g=t,this.h=e,t=Gr,this.l=!!t&&n===t||!1}};function Fn(t,e){return new Ie(t,e,Gr)}function ro(t,e,n,r,s){pn(t,n,ao(e,r),s)}const f2=Fn(function(t,e,n,r,s){return t.h===2&&(Qe(t,xr(e,r,n),s),!0)},ro),d2=Fn(function(t,e,n,r,s){return t.h===2&&(Qe(t,xr(e,r,n),s),!0)},ro);var Mn=Symbol(),Pn=Symbol(),sr=Symbol(),Is=Symbol(),xs=Symbol();let so,io;function se(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 r2||(r2=[0,void 0,!0]);case"number":return f>0?void 0:f===0?s2||(s2=[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,so??(so=i),io??(io=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 Ie?f=i:(f=f2,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 oo(t){return Array.isArray(t)?t[0]instanceof Ie?t:[d2,t]:[t,void 0]}function ao(t,e){return t instanceof p?t.v:Array.isArray(t)?Xt(t,e):void 0}function Wr(t,e,n,r){const s=n.g;t[e]=r?(i,o,a)=>s(i,o,a,r):s}function Kr(t,e,n,r,s){const i=n.g;let o,a;t[e]=(c,u,h)=>i(c,u,h,a||(a=se(Pn,Wr,Kr,r).T),o||(o=zr(r)),s)}function zr(t){let e=t[sr];if(e!=null)return e;const n=se(Pn,Wr,Kr,t);return e=n.ma?(r,s)=>so(r,s,n):(r,s)=>{for(;$i(s)&&s.h!=4;){var i=s.l,o=n[i];if(o==null){var a=n.ba;a&&(a=a[i])&&(a=g2(a))!=null&&(o=n[i]=a)}if(o==null||!o(s,r,i)){if(o=(a=s).m,an(a),a.ha)var c=void 0;else c=a.g.g-o,a.g.g=o,c=qi(a.g,c);o=void 0,a=r,c&&((o=a[nt]??(a[nt]=new er))[i]??(o[i]=[])).push(c)}}return(r=bn(r))&&(r.da=n.qa[xs]),!0},t[sr]=e,t[xs]=p2.bind(t),e}function p2(t,e,n,r){var s=this[Pn];const i=this[sr],o=Xt(void 0,s.T),a=bn(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=Xi(v);try{c=!0,i(o,h)}finally{Yi(h)}}else r==null||r(t,f,_)},e==null)un(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=Se(h),_=(v,I)=>{if(Ot(t,v,f)!=null){if((n==null?void 0:n.Qa)===1)return;throw Error()}I!=null&&(h=j(t,h,v,I,f)),delete a[v]};e==null?Ti(o,0|o[d],(v,I)=>{_(v,I)}):_(e,Ot(o,e,f))}}}}function g2(t){const e=(t=oo(t))[0].g;if(t=t[1]){const n=zr(t),r=se(Pn,Wr,Kr,t).T;return(s,i,o)=>e(s,i,o,r,n)}return e}function On(t,e,n){t[e]=n.h}function In(t,e,n,r){let s,i;const o=n.h;t[e]=(a,c,u)=>o(a,c,u,i||(i=se(Mn,On,In,r).T),s||(s=co(r)))}function co(t){let e=t[Is];if(!e){const n=se(Mn,On,In,t);e=(r,s)=>ho(r,s,n),t[Is]=e}return e}function ho(t,e,n){Ti(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=oo(c))[0].h;if(c=c[1]){const h=co(c),f=se(Mn,On,In,c).T;c=o.ma?io(f,h):(_,v,I)=>u(_,v,I,f,h)}else c=u;return o[a]=c}}(n,r);i?i(e,s,r):r<500||de(Zn,3)}}),(t=bn(t))&&un(t,(r,s,i)=>{for(ve(e,e.g.end()),r=0;r<i.length;r++)ve(e,_r(i[r])||new Uint8Array(0))})}const m2=rt(0);function xe(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&&V(e,t),2&t&&Object.freeze(e),e}}function Y(t,e,n){return new Ie(t,e,n)}function Ne(t,e,n){return new Ie(t,e,n)}function z(t,e,n){j(t,0|t[d],e,n,Se(0|t[d]))}var y2=Fn(function(t,e,n,r,s){if(t.h!==2)return!1;if(t=mt(t=Qe(t,Xt([void 0,void 0],r),s)),s=Se(r=0|e[d]),2&r)throw Error();let i=Ot(e,n,s);if(i instanceof Pt)2&i.J?(i=i.V(),i.push(t),j(e,r,n,i,s)):i.Ma(t);else if(Array.isArray(i)){var o=0|i[d];8192&o||V(i,o|=8192),2&o&&(i=ji(i),j(e,r,n,i,s)),i.push(t)}else j(e,r,n,We([t]),s);return!0},function(t,e,n,r,s){if(e instanceof Pt)e.forEach((i,o)=>{pn(t,n,Xt([o,i],r),s)});else if(Array.isArray(e)){for(let i=0;i<e.length;i++){const o=e[i];Array.isArray(o)&&pn(t,n,Xt(o,r),s)}We(e)}});function uo(t,e,n){(e=At(e))!=null&&(pt(t,n,5),t=t.g,wr(e),Dr(t))}function lo(t,e,n){if(e=function(r){if(r==null)return r;const s=typeof r;if(s==="bigint")return String($e(64,r));if(Je(r)){if(s==="string")return Ii(r);if(s==="number")return kr(r)}}(e),e!=null&&(typeof e=="string"&&Os(e),e!=null))switch(pt(t,n,0),typeof e){case"number":t=t.g,me(e),he(t,P,B);break;case"bigint":n=BigInt.asUintN(64,e),n=new rr(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),he(t.g,n.h,n.g);break;default:n=Os(e),he(t.g,n.h,n.g)}}function fo(t,e,n){(e=Te(e))!=null&&e!=null&&(pt(t,n,0),Sn(t.g,e))}function po(t,e,n){(e=Mi(e))!=null&&(pt(t,n,0),t.g.g.push(e?1:0))}function go(t,e,n){(e=q(e))!=null&&Tn(t,n,mi(e))}function mo(t,e,n,r,s){pn(t,n,ao(e,r),s)}function yo(t,e,n){(e=e==null||typeof e=="string"||e instanceof Et?e:void 0)!=null&&Tn(t,n,Cr(e,!0).buffer)}function _o(t,e,n){return(t.h===5||t.h===2)&&(e=Pe(e,0|e[d],n),t.h==2?kn(t,fn,e):e.push(fn(t.g)),!0)}var D=Y(function(t,e,n){return t.h===5&&(z(e,n,fn(t.g)),!0)},uo,Ln),_2=Ne(_o,function(t,e,n){if((e=xe(At,e))!=null)for(let o=0;o<e.length;o++){var r=t,s=n,i=e[o];i!=null&&(pt(r,s,5),r=r.g,wr(i),Dr(r))}},Ln),qr=Ne(_o,function(t,e,n){if((e=xe(At,e))!=null&&e.length){pt(t,n,2),Oe(t.g,4*e.length);for(let r=0;r<e.length;r++)n=t.g,wr(e[r]),Dr(n)}},Ln),v2=Y(function(t,e,n){return t.h===5&&(z(e,n,(t=fn(t.g))===0?void 0:t),!0)},uo,Ln),Gt=Y(function(t,e,n){return gr?(t.h!==0?t=!1:(z(e,n,_e(t.g,Fi)),t=!0),t):t.h===0&&(z(e,n,_e(t.g,br)),!0)},lo,to),Kn=Y(function(t,e,n){return gr?(t.h!==0?e=!1:(z(e,n,(t=_e(t.g,Fi))===m2?void 0:t),e=!0),e):t.h===0&&(z(e,n,(t=_e(t.g,br))===0?void 0:t),!0)},lo,to),w2=Y(function(t,e,n){return gr?(t.h!==0?t=!1:(z(e,n,_e(t.g,Va)),t=!0),t):t.h===0&&(z(e,n,_e(t.g,tr)),!0)},function(t,e,n){if(e=function(r){if(r==null)return r;var s=typeof r;if(s==="bigint")return String(Ha(64,r));if(Je(r)){if(s==="string")return s=ye(Number(r)),ee(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"))||(vn(r),r=Ke(P,B))),r;if(s==="number")return(r=ye(r))>=0&&ee(r)||(me(r),r=tr(P,B)),r}}(e),e!=null&&(typeof e=="string"&&Ps(e),e!=null))switch(pt(t,n,0),typeof e){case"number":t=t.g,me(e),he(t,P,B);break;case"bigint":n=BigInt.asUintN(64,e),n=new nr(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),he(t.g,n.h,n.g);break;default:n=Ps(e),he(t.g,n.h,n.g)}},l2),K=Y(function(t,e,n){return t.h===0&&(z(e,n,jt(t.g)),!0)},fo,Hr),tn=Ne(function(t,e,n){return(t.h===0||t.h===2)&&(e=Pe(e,0|e[d],n),t.h==2?kn(t,jt,e):e.push(jt(t.g)),!0)},function(t,e,n){if((e=xe(Te,e))!=null&&e.length){n=Ur(t,n);for(let r=0;r<e.length;r++)Sn(t.g,e[r]);jr(t,n)}},Hr),ce=Y(function(t,e,n){return t.h===0&&(z(e,n,(t=jt(t.g))===0?void 0:t),!0)},fo,Hr),R=Y(function(t,e,n){return t.h===0&&(z(e,n,Rr(t.g)),!0)},po,Zi),Zt=Y(function(t,e,n){return t.h===0&&(z(e,n,(t=Rr(t.g))===!1?void 0:t),!0)},po,Zi),X=Ne(function(t,e,n){return t.h===2&&(t=Br(t),Pe(e,0|e[d],n).push(t),!0)},function(t,e,n){if((e=xe(q,e))!=null)for(let o=0;o<e.length;o++){var r=t,s=n,i=e[o];i!=null&&Tn(r,s,mi(i))}},Vr),Dt=Y(function(t,e,n){return t.h===2&&(z(e,n,(t=Br(t))===""?void 0:t),!0)},go,Vr),S=Y(function(t,e,n){return t.h===2&&(z(e,n,Br(t)),!0)},go,Vr),W=function(t,e,n=Gr){return new Ie(t,e,n)}(function(t,e,n,r,s){return t.h===2&&(r=Xt(void 0,r),Pe(e,0|e[d],n).push(r),Qe(t,r,s),!0)},function(t,e,n,r,s){if(Array.isArray(e)){for(let i=0;i<e.length;i++)mo(t,e[i],n,r,s);1&(t=0|e[d])||V(e,1|t)}}),N=Fn(function(t,e,n,r,s,i){if(t.h!==2)return!1;let o=0|e[d];return Gi(e,o,i,n,Se(o)),Qe(t,e=xr(e,r,n),s),!0},mo),vo=Y(function(t,e,n){return t.h===2&&(z(e,n,Ji(t)),!0)},yo,eo),b2=Ne(function(t,e,n){return(t.h===0||t.h===2)&&(e=Pe(e,0|e[d],n),t.h==2?kn(t,Nt,e):e.push(Nt(t.g)),!0)},function(t,e,n){if((e=xe(Pi,e))!=null)for(let o=0;o<e.length;o++){var r=t,s=n,i=e[o];i!=null&&(pt(r,s,0),Oe(r.g,i))}},Qi),A2=Y(function(t,e,n){return t.h===0&&(z(e,n,(t=Nt(t.g))===0?void 0:t),!0)},function(t,e,n){(e=Pi(e))!=null&&e!=null&&(pt(t,n,0),Oe(t.g,e))},Qi),ot=Y(function(t,e,n){return t.h===0&&(z(e,n,jt(t.g)),!0)},function(t,e,n){(e=Te(e))!=null&&(e=parseInt(e,10),pt(t,n,0),Sn(t.g,e))},no);class E2{constructor(e,n){var r=ct;this.g=e,this.h=n,this.m=A,this.j=y,this.defaultValue=void 0,this.l=r.Oa!=null?Li:void 0}register(){mn(this)}}function Lt(t,e){return new E2(t,e)}function Vt(t,e){return(n,r)=>{{const i={ea:!0};r&&Object.assign(i,r),n=Xi(n,void 0,void 0,i);try{const o=new t,a=o.v;zr(e)(a,n);var s=o}finally{Yi(n)}}return s}}function xn(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}}}};ho(this.v,e,se(Mn,On,In,t)),ve(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 Ns=class extends p{constructor(t){super(t)}},Cs=[0,Dt,Y(function(t,e,n){return t.h===2&&(z(e,n,(t=Ji(t))===Qt()?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&&Tn(t,n,Cr(e,!0).buffer)):de(Zn,3))}if(Array.isArray(e))return void de(Zn,3)}yo(t,e,n)},eo)];let zn,Rs=globalThis.trustedTypes;function Bs(t){var e;return zn===void 0&&(zn=function(){let n=null;if(!Rs)return n;try{const r=s=>s;n=Rs.createPolicy("goog#html",{createHTML:r,createScript:r,createScriptURL:r})}catch{}return n}()),t=(e=zn)?e.createScriptURL(t):t,new class{constructor(n){this.g=n}toString(){return this.g+""}}(t)}function k2(t,...e){if(e.length===0)return Bs(t[0]);let n=t[0];for(let r=0;r<e.length;r++)n+=encodeURIComponent(e[r])+t[r+1];return Bs(n)}var wo=[0,K,ot,R,-1,tn,ot,-1,R],S2=class extends p{constructor(t){super(t)}},bo=[0,R,S,R,ot,-1,Ne(function(t,e,n){return(t.h===0||t.h===2)&&(e=Pe(e,0|e[d],n),t.h==2?kn(t,a2,e):e.push(jt(t.g)),!0)},function(t,e,n){if((e=xe(Te,e))!=null&&e.length){n=Ur(t,n);for(let r=0;r<e.length;r++)Sn(t.g,e[r]);jr(t,n)}},no),S,-1,[0,R,-1],ot,R,-1],Ao=[0,3,R,-1,2,[0,K],[0,ot,R],[0,S,-1],[0]],Eo=[0,S,-2],Ds=class extends p{constructor(t){super(t)}},ko=[0],So=[0,K,R,1,R,-4],ct=class extends p{constructor(t){super(t,2)}},G={};G[336783863]=[0,S,R,-1,K,[0,[1,2,3,4,5,6,7,8,9],N,ko,N,bo,N,Eo,N,So,N,wo,N,[0,S,-2],N,[0,S,ot],N,Ao,N,[0,ot,-1,R]],[0,S],R,[0,[1,3],[2,4],N,[0,tn],-1,N,[0,X],-1,W,[0,S,-1]],S];var Us=[0,Kn,-1,Zt,-3,Kn,tn,Dt,ce,Kn,-1,Zt,ce,Zt,-2,Dt];function F(t,e){En(t,3,e)}function w(t,e){En(t,4,e)}var Z=class extends p{constructor(t){super(t,500)}o(t){return y(this,0,7,t)}},Ge=[-1,{}],js=[0,S,1,Ge],Gs=[0,S,X,Ge];function gt(t,e){Nr(t,1,Z,e)}function O(t,e){En(t,10,e)}function E(t,e){En(t,15,e)}var ht=class extends p{constructor(t){super(t,500)}o(t){return y(this,0,1001,t)}},To=[-500,W,[-500,Dt,-1,X,-3,[-2,G,R],W,Cs,ce,-1,js,Gs,W,[0,Dt,Zt],Dt,Us,ce,X,987,X],4,W,[-500,S,-1,[-1,{}],998,S],W,[-500,S,X,-1,[-2,{},R],997,X,-1],ce,W,[-500,S,X,Ge,998,X],X,ce,js,Gs,W,[0,Dt,-1,Ge],X,-2,Us,Dt,-1,Zt,[0,Zt,A2],978,Ge,W,Cs];ht.prototype.g=xn(To);var T2=Vt(ht,To),L2=class extends p{constructor(t){super(t)}},Lo=class extends p{constructor(t){super(t)}g(){return It(this,L2,1)}},Fo=[0,W,[0,K,D,S,-1]],Nn=Vt(Lo,Fo),F2=class extends p{constructor(t){super(t)}},M2=class extends p{constructor(t){super(t)}},qn=class extends p{constructor(t){super(t)}l(){return A(this,F2,2)}g(){return It(this,M2,5)}},Mo=Vt(class extends p{constructor(t){super(t)}},[0,X,tn,qr,[0,ot,[0,K,-3],[0,D,-3],[0,K,-1,[0,W,[0,K,-2]]],W,[0,D,-1,S,D]],S,-1,Gt,W,[0,K,D],X,Gt]),Po=class extends p{constructor(t){super(t)}},ue=Vt(class extends p{constructor(t){super(t)}},[0,W,[0,D,-4]]),Oo=class extends p{constructor(t){super(t)}},en=Vt(class extends p{constructor(t){super(t)}},[0,W,[0,D,-4]]),P2=class extends p{constructor(t){super(t)}},O2=[0,K,-1,qr,ot],Io=class extends p{constructor(t){super(t)}};Io.prototype.g=xn([0,D,-4,Gt]);var I2=class extends p{constructor(t){super(t)}},x2=Vt(class extends p{constructor(t){super(t)}},[0,W,[0,1,K,S,Fo],Gt]),Vs=class extends p{constructor(t){super(t)}},N2=class extends p{constructor(t){super(t)}na(){const t=L(this,1,void 0,void 0,Ui);return t??Qt()}},C2=class extends p{constructor(t){super(t)}},xo=[1,2],R2=Vt(class extends p{constructor(t){super(t)}},[0,W,[0,xo,N,[0,qr],N,[0,vo],K,S],Gt]),Xr=class extends p{constructor(t){super(t)}},No=[0,S,K,D,X,-1],Hs=class extends p{constructor(t){super(t)}},B2=[0,R,-1],Ws=class extends p{constructor(t){super(t)}},cn=[1,2,3,4,5,6],gn=class extends p{constructor(t){super(t)}g(){return L(this,1,void 0,void 0,Ui)!=null}l(){return q(L(this,2))!=null}},x=class extends p{constructor(t){super(t)}g(){return Mi(L(this,2))??!1}},Co=[0,vo,S,[0,K,Gt,-1],[0,w2,Gt]],U=[0,Co,R,[0,cn,N,So,N,bo,N,wo,N,ko,N,Eo,N,Ao],ot],Cn=class extends p{constructor(t){super(t)}},Yr=[0,U,D,-1,K],D2=Lt(502141897,Cn);G[502141897]=Yr;var U2=Vt(class extends p{constructor(t){super(t)}},[0,[0,ot,-1,_2,b2],O2]),Ro=class extends p{constructor(t){super(t)}},Bo=class extends p{constructor(t){super(t)}},ir=[0,U,D,[0,U],R],j2=Lt(508968150,Bo);G[508968150]=[0,U,Yr,ir,D,[0,[0,Co]]],G[508968149]=ir;var ae=class extends p{constructor(t){super(t)}l(){return A(this,Xr,2)}g(){k(this,2)}},Do=[0,U,No];G[478825465]=Do;var G2=class extends p{constructor(t){super(t)}},Uo=class extends p{constructor(t){super(t)}},$r=class extends p{constructor(t){super(t)}},Jr=class extends p{constructor(t){super(t)}},jo=class extends p{constructor(t){super(t)}},Ks=[0,U,[0,U],Do,-1],Go=[0,U,D,K],Zr=[0,U,D],Vo=[0,U,Go,Zr,D],V2=Lt(479097054,jo);G[479097054]=[0,U,Vo,Ks],G[463370452]=Ks,G[464864288]=Go;var H2=Lt(462713202,Jr);G[462713202]=Vo,G[474472470]=Zr;var W2=class extends p{constructor(t){super(t)}},Ho=class extends p{constructor(t){super(t)}},Wo=class extends p{constructor(t){super(t)}},Ko=class extends p{constructor(t){super(t)}},Qr=[0,U,D,-1,K],or=[0,U,D,R];Ko.prototype.g=xn([0,U,Zr,[0,U],Yr,ir,Qr,or]);var zo=class extends p{constructor(t){super(t)}},K2=Lt(456383383,zo);G[456383383]=[0,U,No];var qo=class extends p{constructor(t){super(t)}},z2=Lt(476348187,qo);G[476348187]=[0,U,B2];var Xo=class extends p{constructor(t){super(t)}},zs=class extends p{constructor(t){super(t)}},Yo=[0,ot,-1],q2=Lt(458105876,class extends p{constructor(t){super(t)}g(){let t;var e=this.v;const n=0|e[d];return t=st(this,n),e=function(r,s,i,o){var a=zs;!o&&Fe(r)&&(i=0|(s=r.v)[d]);var c=Ot(s,2);if(r=!1,c==null){if(o)return Ts();c=[]}else if(c.constructor===Pt){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 Ts();r||(r=!0,Ye(c))}else r&&(r=!1,We(c),c=ji(c));return!r&&32&i&&Xe(c,32),i=j(s,i,2,o=new Pt(c,a,qa,void 0)),r||re(s,i),o}(this,e,n,t),!t&&zs&&(e.ra=!0),e}});G[458105876]=[0,Yo,y2,[!0,Gt,[0,S,-1,X]],[0,tn,R,ot]];var ts=class extends p{constructor(t){super(t)}},$o=Lt(458105758,ts);G[458105758]=[0,U,S,Yo];var Xn=class extends p{constructor(t){super(t)}},qs=[0,v2,-1,Zt],X2=class extends p{constructor(t){super(t)}},Jo=class extends p{constructor(t){super(t)}},ar=[1,2];Jo.prototype.g=xn([0,ar,N,qs,N,[0,W,qs]]);var Zo=class extends p{constructor(t){super(t)}},Y2=Lt(443442058,Zo);G[443442058]=[0,U,S,K,D,X,-1,R,D],G[514774813]=Qr;var Qo=class extends p{constructor(t){super(t)}},$2=Lt(516587230,Qo);function cr(t,e){return e=e?e.clone():new Xr,t.displayNamesLocale!==void 0?k(e,1,Ze(t.displayNamesLocale)):t.displayNamesLocale===void 0&&k(e,1),t.maxResults!==void 0?xt(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?ln(e,4,t.categoryAllowlist):"categoryAllowlist"in t&&k(e,4),t.categoryDenylist!==void 0?ln(e,5,t.categoryDenylist):"categoryDenylist"in t&&k(e,5),e}function ta(t){const e=Number(t);return Number.isSafeInteger(e)?e:String(t)}function es(t,e=-1,n=""){return{categories:t.map(r=>({index:dt(r,1)??0??-1,score:C(r,2)??0,categoryName:q(L(r,3))??""??"",displayName:q(L(r,4))??""??""})),headIndex:e,headName:n}}function J2(t){const e={classifications:It(t,I2,1).map(n=>{var r;return es(((r=A(n,Lo,4))==null?void 0:r.g())??[],dt(n,2)??0,q(L(n,3))??"")})};return function(n){return za(mr?L(n,2,void 0,void 0,hn):L(n,2))}(t)!=null&&(e.timestampMs=ta(Ki(t))),e}function ea(t){var o,a;var e=qt(t,3,At,zt()),n=qt(t,2,Te,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,qn,4))==null?void 0:o.l())&&(i.boundingBox={originX:dt(e,1,Ct)??0,originY:dt(e,2,Ct)??0,width:dt(e,3,Ct)??0,height:dt(e,4,Ct)??0,angle:0}),(a=A(t,qn,4))==null?void 0:a.g().length)for(const c of A(t,qn,4).g())i.keypoints.push({x:L(c,1,void 0,Ct,At)??0,y:L(c,2,void 0,Ct,At)??0,score:L(c,4,void 0,Ct,At)??0,label:q(L(c,3,void 0,Ct))??""});return i}function Rn(t){const e=[];for(const n of It(t,Oo,1))e.push({x:C(n,1)??0,y:C(n,2)??0,z:C(n,3)??0,visibility:C(n,4)??0});return e}function Ve(t){const e=[];for(const n of It(t,Po,1))e.push({x:C(n,1)??0,y:C(n,2)??0,z:C(n,3)??0,visibility:C(n,4)??0});return e}function Xs(t){return Array.from(t,e=>e>127?e-256:e)}function Ys(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;G[516587230]=[0,U,Qr,or,D],G[518928384]=or;const Z2=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 na(){if(rn===void 0)try{await WebAssembly.instantiate(Z2),rn=!0}catch{rn=!1}return rn}async function Be(t,e=k2``){const n=await na()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${e}/${t}_${n}.js`,wasmBinaryPath:`${e}/${t}_${n}.wasm`}}var Kt=class{};function ra(){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 $s(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 sa(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 Js(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]=sa(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 Zs(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 wt(t,e,n){t.i.simpleListeners=t.i.simpleListeners||{},t.i.simpleListeners[e]=n}function Rt(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)}}Kt.forVisionTasks=function(t){return Be("vision",t)},Kt.forTextTasks=function(t){return Be("text",t)},Kt.forGenAiExperimentalTasks=function(t){return Be("genai_experimental",t)},Kt.forGenAiTasks=function(t){return Be("genai",t)},Kt.forAudioTasks=function(t){return Be("audio",t)},Kt.isSimdSupported=function(){return na()};async function Q2(t,e,n,r){return t=await(async(s,i,o,a,c)=>{if(i&&await $s(i),!self.ModuleFactory||o&&(await $s(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 Yn(t,e){const n=A(t.baseOptions,gn,1)||new gn;typeof e=="string"?(k(n,2,Ze(e)),k(n,1)):e instanceof Uint8Array&&(k(n,1,vr(e,!1)),k(n,2)),y(t.baseOptions,0,1,n)}function Qs(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 Bn(t,e){t.B=new Z,it(t.B,2,"PassThroughCalculator"),F(t.B,"free_memory"),w(t.B,"free_memory_unused_out"),O(e,"free_memory"),gt(e,t.B)}function we(t,e){F(t.B,e),w(t.B,e+"_unused_out")}function Dn(t){t.g.addBoolToStream(!0,"free_memory",t.C)}var hr=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,gn,1))!=null&&s.g()||(i=A(this.baseOptions,gn,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,Ws,3);if(!f){var _=f=new Ws,v=new Ds;je(_,4,cn,v)}"delegate"in h&&(h.delegate==="GPU"?(h=f,_=new S2,je(h,2,cn,_)):(h=f,_=new Ds,je(h,4,cn,_))),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),Yn(this,"/model.dat"),this.m(),this.L()});if(c.modelAssetBuffer instanceof Uint8Array)Yn(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=>{Yn(this,u),this.m(),this.L()})}return this.m(),this.L(),Promise.resolve()}L(){}ca(){let t;if(this.g.ca(e=>{t=T2(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,Qs(this)}finishProcessing(){this.g.finishProcessing(),Qs(this)}close(){this.B=void 0,this.g.closeGraph()}};function Ut(t,e){if(!t)throw Error(`Unable to obtain required WebGL resource: ${e}`);return t}hr.prototype.close=hr.prototype.close;class t1{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 ti(t,e,n){const r=t.g;if(n=Ut(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 ei(t,e){const n=t.g,r=Ut(n.createVertexArray(),"Failed to create vertex array");n.bindVertexArray(r);const s=Ut(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=Ut(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 t1(n,r,s,i)}function ns(t,e){if(t.g){if(e!==t.g)throw Error("Cannot change GL context once initialized")}else t.g=e}function e1(t,e,n,r){return ns(t,e),t.h||(t.m(),t.D()),n?(t.u||(t.u=ei(t,!0)),n=t.u):(t.A||(t.A=ei(t,!1)),n=t.A),e.useProgram(t.h),n.bind(),t.l(),t=r(),n.g.bindVertexArray(null),t}function ia(t,e,n){return ns(t,e),t=Ut(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 oa(t,e,n){ns(t,e),t.B||(t.B=Ut(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 n1(t){var e;(e=t.g)==null||e.bindFramebuffer(t.g.FRAMEBUFFER,null)}var aa=class{H(){return`
2
+ precision mediump float;
3
+ varying vec2 vTex;
4
+ uniform sampler2D inputTexture;
5
+ void main() {
6
+ gl_FragColor = texture2D(inputTexture, vTex);
7
+ }
8
+ `}m(){const t=this.g;if(this.h=Ut(t.createProgram(),"Failed to create WebGL program"),this.X=ti(this,`
9
+ attribute vec2 aVertex;
10
+ attribute vec2 aTex;
11
+ varying vec2 vTex;
12
+ void main(void) {
13
+ gl_Position = vec4(aVertex, 0.0, 1.0);
14
+ vTex = aTex;
15
+ }`,t.VERTEX_SHADER),this.W=ti(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 Mt(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 ur(t){var e=Mt(t,1);if(!e){if(e=Mt(t,0))e=new Float32Array(e).map(r=>r/255);else{e=new Float32Array(t.width*t.height);const r=be(t);var n=rs(t);if(oa(n,r,ca(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 ca(t){let e=Mt(t,2);if(!e){const n=be(t);e=ua(t);const r=ur(t),s=ha(t);n.texImage2D(n.TEXTURE_2D,0,s,t.width,t.height,0,n.RED,n.FLOAT,r),lr(t)}return e}function be(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=Ut(t.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),t.h}function ha(t){if(t=be(t),!sn)if(t.getExtension("EXT_color_buffer_float")&&t.getExtension("OES_texture_float_linear")&&t.getExtension("EXT_float_blend"))sn=t.R32F;else{if(!t.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");sn=t.R16F}return sn}function rs(t){return t.l||(t.l=new aa),t.l}function ua(t){const e=be(t);e.viewport(0,0,t.width,t.height),e.activeTexture(e.TEXTURE0);let n=Mt(t,2);return n||(n=ia(rs(t),e,t.m?e.LINEAR:e.NEAREST),t.g.push(n),t.j=!0),e.bindTexture(e.TEXTURE_2D,n),n}function lr(t){t.h.bindTexture(t.h.TEXTURE_2D,null)}var sn,H=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&&--ni===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Fa(){return!!Mt(this,0)}ka(){return!!Mt(this,1)}R(){return!!Mt(this,2)}ja(){return(e=Mt(t=this,0))||(e=ur(t),e=new Uint8Array(e.map(n=>Math.round(255*n))),t.g.push(e)),e;var t,e}ia(){return ur(this)}N(){return ca(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=be(this),s=rs(this);r.activeTexture(r.TEXTURE1),n=ia(s,r,this.m?r.LINEAR:r.NEAREST),r.bindTexture(r.TEXTURE_2D,n);const i=ha(this);r.texImage2D(r.TEXTURE_2D,0,i,this.width,this.height,0,r.RED,r.FLOAT,null),r.bindTexture(r.TEXTURE_2D,null),oa(s,r,n),e1(s,r,!1,()=>{ua(this),r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT),r.drawArrays(r.TRIANGLE_FAN,0,4),lr(this)}),n1(s),lr(this)}}t.push(n)}return new H(t,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&be(this).deleteTexture(Mt(this,2)),ni=-1}};H.prototype.close=H.prototype.close,H.prototype.clone=H.prototype.clone,H.prototype.getAsWebGLTexture=H.prototype.N,H.prototype.getAsFloat32Array=H.prototype.ia,H.prototype.getAsUint8Array=H.prototype.ja,H.prototype.hasWebGLTexture=H.prototype.R,H.prototype.hasFloat32Array=H.prototype.ka,H.prototype.hasUint8Array=H.prototype.Fa;var ni=250;function yt(...t){return t.map(([e,n])=>({start:e,end:n}))}const r1=function(t){return class extends t{Ja(){this.i._registerModelResourcesGraphService()}}}((ri=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:ra()?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){wt(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]=Js(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=>{Zs(this,Object.keys(t),s=>{Zs(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){wt(this,t,e),g(this,t,n=>{this.i._attachBoolListener(n)})}attachBoolVectorListener(t,e){Rt(this,t,e),g(this,t,n=>{this.i._attachBoolVectorListener(n)})}attachIntListener(t,e){wt(this,t,e),g(this,t,n=>{this.i._attachIntListener(n)})}attachIntVectorListener(t,e){Rt(this,t,e),g(this,t,n=>{this.i._attachIntVectorListener(n)})}attachUintListener(t,e){wt(this,t,e),g(this,t,n=>{this.i._attachUintListener(n)})}attachUintVectorListener(t,e){Rt(this,t,e),g(this,t,n=>{this.i._attachUintVectorListener(n)})}attachDoubleListener(t,e){wt(this,t,e),g(this,t,n=>{this.i._attachDoubleListener(n)})}attachDoubleVectorListener(t,e){Rt(this,t,e),g(this,t,n=>{this.i._attachDoubleVectorListener(n)})}attachFloatListener(t,e){wt(this,t,e),g(this,t,n=>{this.i._attachFloatListener(n)})}attachFloatVectorListener(t,e){Rt(this,t,e),g(this,t,n=>{this.i._attachFloatVectorListener(n)})}attachStringListener(t,e){wt(this,t,e),g(this,t,n=>{this.i._attachStringListener(n)})}attachStringVectorListener(t,e){Rt(this,t,e),g(this,t,n=>{this.i._attachStringVectorListener(n)})}attachProtoListener(t,e,n){wt(this,t,e),g(this,t,r=>{this.i._attachProtoListener(r,n||!1)})}attachProtoVectorListener(t,e,n){Rt(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?'),wt(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 ri{get ga(){return this.i}pa(t,e,n){g(this,e,r=>{const[s,i]=Js(this,t,r);this.ga._addBoundTextureAsImageToStream(r,s,i,n)})}Z(t,e){wt(this,t,e),g(this,t,n=>{this.ga._attachImageListener(n)})}aa(t,e){Rt(this,t,e),g(this,t,n=>{this.ga._attachImageVectorListener(n)})}}));var ri,_t=class extends r1{};async function b(t,e,n){return async function(r,s,i,o){return Q2(r,s,i,o)}(t,n.canvas??(ra()?void 0:document.createElement("canvas")),e,n)}function la(t,e,n,r){if(t.U){const i=new Io;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]=sa(e);n=C(i,3)*a/o,s=C(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 vt(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'.");la(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'.");la(t,e,n,r)}function Ae(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 H([s],n,!1,t.g.i.canvas,t.P,i,e),r?t.clone():t}var at=class extends hr{constructor(t,e,n,r){super(t),this.g=t,this.X=e,this.U=n,this.oa=r,this.P=new aa}l(t,e=!0){if("runningMode"in t&&k(this.baseOptions,2,ze(!!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()}};at.prototype.close=at.prototype.close;var ut=class extends at{constructor(t,e){super(new _t(t,e),"image_in","norm_rect_in",!1),this.j={detections:[]},y(t=this.h=new Cn,0,1,e=new x),m(this.h,2,.5),m(this.h,3,.3)}get baseOptions(){return A(this.h,x,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:[]},vt(this,t,e),this.j}G(t,e,n){return this.j={detections:[]},Ft(this,t,n,e),this.j}m(){var t=new ht;O(t,"image_in"),O(t,"norm_rect_in"),E(t,"detections");const e=new ct;Tt(e,D2,this.h);const n=new Z;it(n,2,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),F(n,"IMAGE:image_in"),F(n,"NORM_RECT:norm_rect_in"),w(n,"DETECTIONS:detections"),n.o(e),gt(t,n),this.g.attachProtoVectorListener("detections",(r,s)=>{for(const i of r)r=Mo(i),this.j.detections.push(ea(r));l(this,s)}),this.g.attachEmptyPacketListener("detections",r=>{l(this,r)}),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};ut.prototype.detectForVideo=ut.prototype.G,ut.prototype.detect=ut.prototype.F,ut.prototype.setOptions=ut.prototype.o,ut.createFromModelPath=async function(t,e){return b(ut,t,{baseOptions:{modelAssetPath:e}})},ut.createFromModelBuffer=function(t,e){return b(ut,t,{baseOptions:{modelAssetBuffer:e}})},ut.createFromOptions=function(t,e){return b(ut,t,e)};var ss=yt([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]),is=yt([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]),os=yt([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),fa=yt([474,475],[475,476],[476,477],[477,474]),as=yt([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]),cs=yt([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),da=yt([469,470],[470,471],[471,472],[472,469]),hs=yt([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]),pa=[...ss,...is,...os,...as,...cs,...hs],ga=yt([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 si(t){t.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var M=class extends at{constructor(t,e){super(new _t(t,e),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,y(t=this.h=new Bo,0,1,e=new x),this.A=new Ro,y(this.h,0,3,this.A),this.u=new Cn,y(this.h,0,2,this.u),xt(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,x,1)}set baseOptions(t){y(this.h,0,1,t)}o(t){return"numFaces"in t&&xt(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 si(this),vt(this,t,e),this.j}G(t,e,n){return si(this),Ft(this,t,n,e),this.j}m(){var t=new ht;O(t,"image_in"),O(t,"norm_rect"),E(t,"face_landmarks");const e=new ct;Tt(e,j2,this.h);const n=new Z;it(n,2,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),F(n,"IMAGE:image_in"),F(n,"NORM_RECT:norm_rect"),w(n,"NORM_LANDMARKS:face_landmarks"),n.o(e),gt(t,n),this.g.attachProtoVectorListener("face_landmarks",(r,s)=>{for(const i of r)r=en(i),this.j.faceLandmarks.push(Rn(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=Nn(i),this.j.faceBlendshapes.push(es(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=U2(i),P2,2))&&this.j.facialTransformationMatrixes.push({rows:dt(r,1)??0??0,columns:dt(r,2)??0??0,data:qt(r,3,At,zt()).slice()??[]});l(this,s)}),this.g.attachEmptyPacketListener("face_geometry",r=>{l(this,r)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};M.prototype.detectForVideo=M.prototype.G,M.prototype.detect=M.prototype.F,M.prototype.setOptions=M.prototype.o,M.createFromModelPath=function(t,e){return b(M,t,{baseOptions:{modelAssetPath:e}})},M.createFromModelBuffer=function(t,e){return b(M,t,{baseOptions:{modelAssetBuffer:e}})},M.createFromOptions=function(t,e){return b(M,t,e)},M.FACE_LANDMARKS_LIPS=ss,M.FACE_LANDMARKS_LEFT_EYE=is,M.FACE_LANDMARKS_LEFT_EYEBROW=os,M.FACE_LANDMARKS_LEFT_IRIS=fa,M.FACE_LANDMARKS_RIGHT_EYE=as,M.FACE_LANDMARKS_RIGHT_EYEBROW=cs,M.FACE_LANDMARKS_RIGHT_IRIS=da,M.FACE_LANDMARKS_FACE_OVAL=hs,M.FACE_LANDMARKS_CONTOURS=pa,M.FACE_LANDMARKS_TESSELATION=ga;var us=yt([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 ii(t){t.gestures=[],t.landmarks=[],t.worldLandmarks=[],t.handedness=[]}function oi(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 ai(t,e=!0){const n=[];for(const s of t){var r=Nn(s);t=[];for(const i of r.g())r=e&&dt(i,1)!=null?dt(i,1)??0:-1,t.push({score:C(i,2)??0,index:r,categoryName:q(L(i,3))??""??"",displayName:q(L(i,4))??""??""});n.push(t)}return n}var Q=class extends at{constructor(t,e){super(new _t(t,e),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],y(t=this.j=new jo,0,1,e=new x),this.u=new Jr,y(this.j,0,2,this.u),this.D=new $r,y(this.u,0,3,this.D),this.A=new Uo,y(this.u,0,2,this.A),this.h=new G2,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,x,1)}set baseOptions(t){y(this.j,0,1,t)}o(t){var s,i,o,a;if(xt(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 ae,n=e,r=cr(t.cannedGesturesClassifierOptions,(s=A(this.h,ae,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,ae,3))==null||i.g());return t.customGesturesClassifierOptions?(y(n=e=new ae,0,2,r=cr(t.customGesturesClassifierOptions,(o=A(this.h,ae,4))==null?void 0:o.l())),y(this.h,0,4,e)):t.customGesturesClassifierOptions===void 0&&((a=A(this.h,ae,4))==null||a.g()),this.l(t)}Ha(t,e){return ii(this),vt(this,t,e),oi(this)}Ia(t,e,n){return ii(this),Ft(this,t,n,e),oi(this)}m(){var t=new ht;O(t,"image_in"),O(t,"norm_rect"),E(t,"hand_gestures"),E(t,"hand_landmarks"),E(t,"world_hand_landmarks"),E(t,"handedness");const e=new ct;Tt(e,V2,this.j);const n=new Z;it(n,2,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),F(n,"IMAGE:image_in"),F(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),gt(t,n),this.g.attachProtoVectorListener("hand_landmarks",(r,s)=>{for(const i of r){r=en(i);const o=[];for(const a of It(r,Oo,1))o.push({x:C(a,1)??0,y:C(a,2)??0,z:C(a,3)??0,visibility:C(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=ue(i);const o=[];for(const a of It(r,Po,1))o.push({x:C(a,1)??0,y:C(a,2)??0,z:C(a,3)??0,visibility:C(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(...ai(r,!1)),l(this,s)}),this.g.attachEmptyPacketListener("hand_gestures",r=>{l(this,r)}),this.g.attachProtoVectorListener("handedness",(r,s)=>{this.handedness.push(...ai(r)),l(this,s)}),this.g.attachEmptyPacketListener("handedness",r=>{l(this,r)}),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};function ci(t){return{landmarks:t.landmarks,worldLandmarks:t.worldLandmarks,handednesses:t.handedness,handedness:t.handedness}}Q.prototype.recognizeForVideo=Q.prototype.Ia,Q.prototype.recognize=Q.prototype.Ha,Q.prototype.setOptions=Q.prototype.o,Q.createFromModelPath=function(t,e){return b(Q,t,{baseOptions:{modelAssetPath:e}})},Q.createFromModelBuffer=function(t,e){return b(Q,t,{baseOptions:{modelAssetBuffer:e}})},Q.createFromOptions=function(t,e){return b(Q,t,e)},Q.HAND_CONNECTIONS=us;var J=class extends at{constructor(t,e){super(new _t(t,e),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],y(t=this.h=new Jr,0,1,e=new x),this.u=new $r,y(this.h,0,3,this.u),this.j=new Uo,y(this.h,0,2,this.j),xt(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,x,1)}set baseOptions(t){y(this.h,0,1,t)}o(t){return"numHands"in t&&xt(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=[],vt(this,t,e),ci(this)}G(t,e,n){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Ft(this,t,n,e),ci(this)}m(){var t=new ht;O(t,"image_in"),O(t,"norm_rect"),E(t,"hand_landmarks"),E(t,"world_hand_landmarks"),E(t,"handedness");const e=new ct;Tt(e,H2,this.h);const n=new Z;it(n,2,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),F(n,"IMAGE:image_in"),F(n,"NORM_RECT:norm_rect"),w(n,"LANDMARKS:hand_landmarks"),w(n,"WORLD_LANDMARKS:world_hand_landmarks"),w(n,"HANDEDNESS:handedness"),n.o(e),gt(t,n),this.g.attachProtoVectorListener("hand_landmarks",(r,s)=>{for(const i of r)r=en(i),this.landmarks.push(Rn(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=ue(i),this.worldLandmarks.push(Ve(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=Nn(c);const u=[];for(const h of r.g())u.push({score:C(h,2)??0,index:dt(h,1)??0??-1,categoryName:q(L(h,3))??""??"",displayName:q(L(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=us;var ma=yt([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 hi(t){t.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function ui(t){try{if(!t.D)return t.h;t.D(t.h)}finally{Dn(t)}}function on(t,e){t=en(t),e.push(Rn(t))}var T=class extends at{constructor(t,e){super(new _t(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 Ko,0,1,e=new x),this.I=new $r,y(this.j,0,2,this.I),this.W=new W2,y(this.j,0,3,this.W),this.u=new Cn,y(this.j,0,4,this.u),this.O=new Ro,y(this.j,0,5,this.O),this.A=new Ho,y(this.j,0,6,this.A),this.M=new Wo,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,x,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,hi(this),vt(this,t,r),ui(this)}G(t,e,n,r){const s=typeof n!="function"?n:{};return this.D=typeof n=="function"?n:r,hi(this),Ft(this,t,s,e),ui(this)}m(){var t=new ht;O(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 ct,n=new Ns;it(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,An(i,0,qe));else{if(!(typeof i=="string"||i instanceof Et||yr(i)))throw Error("invalid value in Any.value field: "+i+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");Bt(s,2,vr(i,!1),Qt())}}(n,this.j.g());const r=new Z;it(r,2,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),Nr(r,8,Ns,n),F(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),gt(t,r),Bn(this,t),this.g.attachProtoListener("pose_landmarks",(s,i)=>{on(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=ue(s),o.push(Ve(s)),l(this,i)}),this.g.attachEmptyPacketListener("pose_world_landmarks",s=>{l(this,s)}),this.outputPoseSegmentationMasks&&(w(r,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),we(this,"pose_segmentation_mask"),this.g.Z("pose_segmentation_mask",(s,i)=>{this.h.poseSegmentationMasks=[Ae(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)=>{on(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=Nn(s),o.push(es(s.g()??[]))),l(this,i)}),this.g.attachEmptyPacketListener("extra_blendshapes",s=>{l(this,s)})),this.g.attachProtoListener("left_hand_landmarks",(s,i)=>{on(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=ue(s),o.push(Ve(s)),l(this,i)}),this.g.attachEmptyPacketListener("left_hand_world_landmarks",s=>{l(this,s)}),this.g.attachProtoListener("right_hand_landmarks",(s,i)=>{on(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=ue(s),o.push(Ve(s)),l(this,i)}),this.g.attachEmptyPacketListener("right_hand_world_landmarks",s=>{l(this,s)}),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};T.prototype.detectForVideo=T.prototype.G,T.prototype.detect=T.prototype.F,T.prototype.setOptions=T.prototype.o,T.createFromModelPath=function(t,e){return b(T,t,{baseOptions:{modelAssetPath:e}})},T.createFromModelBuffer=function(t,e){return b(T,t,{baseOptions:{modelAssetBuffer:e}})},T.createFromOptions=function(t,e){return b(T,t,e)},T.HAND_CONNECTIONS=us,T.POSE_CONNECTIONS=ma,T.FACE_LANDMARKS_LIPS=ss,T.FACE_LANDMARKS_LEFT_EYE=is,T.FACE_LANDMARKS_LEFT_EYEBROW=os,T.FACE_LANDMARKS_LEFT_IRIS=fa,T.FACE_LANDMARKS_RIGHT_EYE=as,T.FACE_LANDMARKS_RIGHT_EYEBROW=cs,T.FACE_LANDMARKS_RIGHT_IRIS=da,T.FACE_LANDMARKS_FACE_OVAL=hs,T.FACE_LANDMARKS_CONTOURS=pa,T.FACE_LANDMARKS_TESSELATION=ga;var lt=class extends at{constructor(t,e){super(new _t(t,e),"input_image","norm_rect",!0),this.j={classifications:[]},y(t=this.h=new zo,0,1,e=new x)}get baseOptions(){return A(this.h,x,1)}set baseOptions(t){y(this.h,0,1,t)}o(t){return y(this.h,0,2,cr(t,A(this.h,Xr,2))),this.l(t)}sa(t,e){return this.j={classifications:[]},vt(this,t,e),this.j}ta(t,e,n){return this.j={classifications:[]},Ft(this,t,n,e),this.j}m(){var t=new ht;O(t,"input_image"),O(t,"norm_rect"),E(t,"classifications");const e=new ct;Tt(e,K2,this.h);const n=new Z;it(n,2,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),F(n,"IMAGE:input_image"),F(n,"NORM_RECT:norm_rect"),w(n,"CLASSIFICATIONS:classifications"),n.o(e),gt(t,n),this.g.attachProtoListener("classifications",(r,s)=>{this.j=J2(x2(r)),l(this,s)}),this.g.attachEmptyPacketListener("classifications",r=>{l(this,r)}),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};lt.prototype.classifyForVideo=lt.prototype.ta,lt.prototype.classify=lt.prototype.sa,lt.prototype.setOptions=lt.prototype.o,lt.createFromModelPath=function(t,e){return b(lt,t,{baseOptions:{modelAssetPath:e}})},lt.createFromModelBuffer=function(t,e){return b(lt,t,{baseOptions:{modelAssetBuffer:e}})},lt.createFromOptions=function(t,e){return b(lt,t,e)};var tt=class extends at{constructor(t,e){super(new _t(t,e),"image_in","norm_rect",!0),this.h=new qo,this.embeddings={embeddings:[]},y(t=this.h,0,1,e=new x)}get baseOptions(){return A(this.h,x,1)}set baseOptions(t){y(this.h,0,1,t)}o(t){var e=this.h,n=A(this.h,Hs,2);return n=n?n.clone():new Hs,t.l2Normalize!==void 0?k(n,1,ze(t.l2Normalize)):"l2Normalize"in t&&k(n,1),t.quantize!==void 0?k(n,2,ze(t.quantize)):"quantize"in t&&k(n,2),y(e,0,2,n),this.l(t)}za(t,e){return vt(this,t,e),this.embeddings}Aa(t,e,n){return Ft(this,t,n,e),this.embeddings}m(){var t=new ht;O(t,"image_in"),O(t,"norm_rect"),E(t,"embeddings_out");const e=new ct;Tt(e,z2,this.h);const n=new Z;it(n,2,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),F(n,"IMAGE:image_in"),F(n,"NORM_RECT:norm_rect"),w(n,"EMBEDDINGS:embeddings_out"),n.o(e),gt(t,n),this.g.attachProtoListener("embeddings_out",(r,s)=>{r=R2(r),this.embeddings=function(i){return{embeddings:It(i,C2,1).map(o=>{var u,h;const a={headIndex:dt(o,3)??0??-1,headName:q(L(o,4))??""??""};var c=o.v;return Vi(c,0|c[d],Vs,Wn(o,1))!==void 0?(o=qt(o=A(o,Vs,Wn(o,1),void 0),1,At,zt()),a.floatEmbedding=o.slice()):(c=new Uint8Array(0),a.quantizedEmbedding=((h=(u=A(o,N2,Wn(o,2),void 0))==null?void 0:u.na())==null?void 0:h.h())??c),a}),timestampMs:ta(Ki(i))}}(r),l(this,s)}),this.g.attachEmptyPacketListener("embeddings_out",r=>{l(this,r)}),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};tt.cosineSimilarity=function(t,e){if(t.floatEmbedding&&e.floatEmbedding)t=Ys(t.floatEmbedding,e.floatEmbedding);else{if(!t.quantizedEmbedding||!e.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");t=Ys(Xs(t.quantizedEmbedding),Xs(e.quantizedEmbedding))}return t},tt.prototype.embedForVideo=tt.prototype.Aa,tt.prototype.embed=tt.prototype.za,tt.prototype.setOptions=tt.prototype.o,tt.createFromModelPath=function(t,e){return b(tt,t,{baseOptions:{modelAssetPath:e}})},tt.createFromModelBuffer=function(t,e){return b(tt,t,{baseOptions:{modelAssetBuffer:e}})},tt.createFromOptions=function(t,e){return b(tt,t,e)};var fr=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 s1(t){var n,r;const e=function(s){return It(s,Z,1)}(t.ca()).filter(s=>(q(L(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],ct,7))==null?void 0:n.j())==null?void 0:r.g())??new Map).forEach((s,i)=>{t.u[Number(i)]=q(L(s,1))??""})}function li(t){t.categoryMask=void 0,t.confidenceMasks=void 0,t.qualityScores=void 0}function fi(t){try{const e=new fr(t.confidenceMasks,t.categoryMask,t.qualityScores);if(!t.j)return e;t.j(e)}finally{Dn(t)}}fr.prototype.close=fr.prototype.close;var $=class extends at{constructor(t,e){super(new _t(t,e),"image_in","norm_rect",!1),this.u=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new ts,this.A=new Xo,y(this.h,0,3,this.A),y(t=this.h,0,1,e=new x)}get baseOptions(){return A(this.h,x,1)}set baseOptions(t){y(this.h,0,1,t)}o(t){return t.displayNamesLocale!==void 0?k(this.h,2,Ze(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(){s1(this)}segment(t,e,n){const r=typeof e!="function"?e:{};return this.j=typeof e=="function"?e:n,li(this),vt(this,t,r),fi(this)}La(t,e,n,r){const s=typeof n!="function"?n:{};return this.j=typeof n=="function"?n:r,li(this),Ft(this,t,s,e),fi(this)}Da(){return this.u}m(){var t=new ht;O(t,"image_in"),O(t,"norm_rect");const e=new ct;Tt(e,$o,this.h);const n=new Z;it(n,2,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),F(n,"IMAGE:image_in"),F(n,"NORM_RECT:norm_rect"),n.o(e),gt(t,n),Bn(this,t),this.outputConfidenceMasks&&(E(t,"confidence_masks"),w(n,"CONFIDENCE_MASKS:confidence_masks"),we(this,"confidence_masks"),this.g.aa("confidence_masks",(r,s)=>{this.confidenceMasks=r.map(i=>Ae(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"),we(this,"category_mask"),this.g.Z("category_mask",(r,s)=>{this.categoryMask=Ae(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)}};$.prototype.getLabels=$.prototype.Da,$.prototype.segmentForVideo=$.prototype.La,$.prototype.segment=$.prototype.segment,$.prototype.setOptions=$.prototype.o,$.createFromModelPath=function(t,e){return b($,t,{baseOptions:{modelAssetPath:e}})},$.createFromModelBuffer=function(t,e){return b($,t,{baseOptions:{modelAssetBuffer:e}})},$.createFromOptions=function(t,e){return b($,t,e)};var dr=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()}};dr.prototype.close=dr.prototype.close;var bt=class extends at{constructor(t,e){super(new _t(t,e),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new ts,this.u=new Xo,y(this.h,0,3,this.u),y(t=this.h,0,1,e=new x)}get baseOptions(){return A(this.h,x,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 Jo,e.keypoint&&e.scribble)throw Error("Cannot provide both keypoint and scribble.");if(e.keypoint){var i=new Xn;Bt(i,3,ze(!0),!1),Bt(i,1,Ue(e.keypoint.x),0),Bt(i,2,Ue(e.keypoint.y),0),je(r,1,ar,i)}else{if(!e.scribble)throw Error("Must provide either a keypoint or a scribble.");{const a=new X2;for(i of e.scribble)Bt(e=new Xn,3,ze(!0),!1),Bt(e,1,Ue(i.x),0),Bt(e,2,Ue(i.y),0),Nr(a,1,Xn,e);je(r,2,ar,a)}}this.g.addProtoToStream(r.g(),"mediapipe.tasks.vision.interactive_segmenter.proto.RegionOfInterest","roi_in",n),vt(this,t,s);t:{try{const a=new dr(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var o=a;break t}this.j(a)}finally{Dn(this)}o=void 0}return o}m(){var t=new ht;O(t,"image_in"),O(t,"roi_in"),O(t,"norm_rect_in");const e=new ct;Tt(e,$o,this.h);const n=new Z;it(n,2,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraphV2"),F(n,"IMAGE:image_in"),F(n,"ROI:roi_in"),F(n,"NORM_RECT:norm_rect_in"),n.o(e),gt(t,n),Bn(this,t),this.outputConfidenceMasks&&(E(t,"confidence_masks"),w(n,"CONFIDENCE_MASKS:confidence_masks"),we(this,"confidence_masks"),this.g.aa("confidence_masks",(r,s)=>{this.confidenceMasks=r.map(i=>Ae(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"),we(this,"category_mask"),this.g.Z("category_mask",(r,s)=>{this.categoryMask=Ae(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)}};bt.prototype.segment=bt.prototype.segment,bt.prototype.setOptions=bt.prototype.o,bt.createFromModelPath=function(t,e){return b(bt,t,{baseOptions:{modelAssetPath:e}})},bt.createFromModelBuffer=function(t,e){return b(bt,t,{baseOptions:{modelAssetBuffer:e}})},bt.createFromOptions=function(t,e){return b(bt,t,e)};var ft=class extends at{constructor(t,e){super(new _t(t,e),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},y(t=this.h=new Zo,0,1,e=new x)}get baseOptions(){return A(this.h,x,1)}set baseOptions(t){y(this.h,0,1,t)}o(t){return t.displayNamesLocale!==void 0?k(this.h,2,Ze(t.displayNamesLocale)):"displayNamesLocale"in t&&k(this.h,2),t.maxResults!==void 0?xt(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?ln(this.h,5,t.categoryAllowlist):"categoryAllowlist"in t&&k(this.h,5),t.categoryDenylist!==void 0?ln(this.h,6,t.categoryDenylist):"categoryDenylist"in t&&k(this.h,6),this.l(t)}F(t,e){return this.j={detections:[]},vt(this,t,e),this.j}G(t,e,n){return this.j={detections:[]},Ft(this,t,n,e),this.j}m(){var t=new ht;O(t,"input_frame_gpu"),O(t,"norm_rect"),E(t,"detections");const e=new ct;Tt(e,Y2,this.h);const n=new Z;it(n,2,"mediapipe.tasks.vision.ObjectDetectorGraph"),F(n,"IMAGE:input_frame_gpu"),F(n,"NORM_RECT:norm_rect"),w(n,"DETECTIONS:detections"),n.o(e),gt(t,n),this.g.attachProtoVectorListener("detections",(r,s)=>{for(const i of r)r=Mo(i),this.j.detections.push(ea(r));l(this,s)}),this.g.attachEmptyPacketListener("detections",r=>{l(this,r)}),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};ft.prototype.detectForVideo=ft.prototype.G,ft.prototype.detect=ft.prototype.F,ft.prototype.setOptions=ft.prototype.o,ft.createFromModelPath=async function(t,e){return b(ft,t,{baseOptions:{modelAssetPath:e}})},ft.createFromModelBuffer=function(t,e){return b(ft,t,{baseOptions:{modelAssetBuffer:e}})},ft.createFromOptions=function(t,e){return b(ft,t,e)};var pr=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 di(t){t.landmarks=[],t.worldLandmarks=[],t.segmentationMasks=void 0}function pi(t){try{const e=new pr(t.landmarks,t.worldLandmarks,t.segmentationMasks);if(!t.u)return e;t.u(e)}finally{Dn(t)}}pr.prototype.close=pr.prototype.close;var et=class extends at{constructor(t,e){super(new _t(t,e),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,y(t=this.h=new Qo,0,1,e=new x),this.A=new Wo,y(this.h,0,3,this.A),this.j=new Ho,y(this.h,0,2,this.j),xt(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,x,1)}set baseOptions(t){y(this.h,0,1,t)}o(t){return"numPoses"in t&&xt(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,di(this),vt(this,t,r),pi(this)}G(t,e,n,r){const s=typeof n!="function"?n:{};return this.u=typeof n=="function"?n:r,di(this),Ft(this,t,s,e),pi(this)}m(){var t=new ht;O(t,"image_in"),O(t,"norm_rect"),E(t,"normalized_landmarks"),E(t,"world_landmarks"),E(t,"segmentation_masks");const e=new ct;Tt(e,$2,this.h);const n=new Z;it(n,2,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),F(n,"IMAGE:image_in"),F(n,"NORM_RECT:norm_rect"),w(n,"NORM_LANDMARKS:normalized_landmarks"),w(n,"WORLD_LANDMARKS:world_landmarks"),n.o(e),gt(t,n),Bn(this,t),this.g.attachProtoVectorListener("normalized_landmarks",(r,s)=>{this.landmarks=[];for(const i of r)r=en(i),this.landmarks.push(Rn(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=ue(i),this.worldLandmarks.push(Ve(r));l(this,s)}),this.g.attachEmptyPacketListener("world_landmarks",r=>{this.worldLandmarks=[],l(this,r)}),this.outputSegmentationMasks&&(w(n,"SEGMENTATION_MASK:segmentation_masks"),we(this,"segmentation_masks"),this.g.aa("segmentation_masks",(r,s)=>{this.segmentationMasks=r.map(i=>Ae(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)}};et.prototype.detectForVideo=et.prototype.G,et.prototype.detect=et.prototype.F,et.prototype.setOptions=et.prototype.o,et.createFromModelPath=function(t,e){return b(et,t,{baseOptions:{modelAssetPath:e}})},et.createFromModelBuffer=function(t,e){return b(et,t,{baseOptions:{modelAssetBuffer:e}})},et.createFromOptions=function(t,e){return b(et,t,e)},et.POSE_CONNECTIONS=ma;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 Kt.forVisionTasks("https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.3/wasm"),n=await M.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(()=>_a),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(I=>I.x*e.videoWidth),o=n.map(I=>I.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 i1=t=>{var a;const[e,n]=Ht.useState({status:"loading",sequence:[],currentStep:0,timeLeft:t.duration||60,isStepTransitioning:!1,errorMsg:""}),r=Ht.useRef(null),s=Ht.useRef(null);Ht.useEffect(()=>(r.current=new ya({...t,onStateChange:c=>n(c)}),()=>{var c;return(c=r.current)==null?void 0:c.stop()}),[t]),Ht.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=Ht.useCallback(()=>{var c;return(c=r.current)==null?void 0:c.start()},[]),o=Ht.useCallback(()=>{var c;return(c=r.current)==null?void 0:c.reset()},[]);return{...e,webcamRef:s,start:i,reset:o}};exports.LivenessEngine=ya;exports.useLiveness=i1;exports.verifyLiveness=gi;
@@ -0,0 +1,104 @@
1
+ import { default as default_2 } from 'react-webcam';
2
+
3
+ declare type Challenge = "Smile" | "Blink" | "Turn_Head" | "Thumbs_Up";
4
+
5
+ export declare class LivenessEngine {
6
+ private apiUrl;
7
+ private duration;
8
+ private smileThreshold;
9
+ private blinkThreshold;
10
+ private minturnHeadThreshold;
11
+ private maxturnHeadThreshold;
12
+ private onStateChange?;
13
+ private onComplete?;
14
+ private onError?;
15
+ private models;
16
+ private webcam;
17
+ private state;
18
+ private currentStepRef;
19
+ private isStepTransitioningRef;
20
+ private timerId;
21
+ private requestId;
22
+ private CHALLENGE_POOL;
23
+ constructor(config: LivenessEngineConfig);
24
+ /** Initialize the engine with the video element */
25
+ init(video: HTMLVideoElement): Promise<void>;
26
+ /** Start the liveness session */
27
+ start(): void;
28
+ /** Stop the engine and cleanup */
29
+ stop(): void;
30
+ /** Reset the session */
31
+ reset(): void;
32
+ /** Internal: Update state and notify consumer */
33
+ private updateState;
34
+ /** Internal: Generate random challenge sequence */
35
+ private generateSequence;
36
+ /** Internal: Load MediaPipe models */
37
+ private loadModels;
38
+ /** Internal: Timer logic */
39
+ private startTimer;
40
+ /** Internal: Detection loop */
41
+ private detectLoop;
42
+ /** Internal: Verify if user completed current challenge */
43
+ private checkAction;
44
+ /** Internal: Capture final frames and send to backend */
45
+ private sendFinalProof;
46
+ /** Internal: Crop face from video for backend submission */
47
+ private getFaceCrop;
48
+ /** Internal: Convert DataURL to Blob */
49
+ private dataURLtoBlob;
50
+ }
51
+
52
+ export declare interface LivenessEngineConfig {
53
+ apiUrl: string;
54
+ duration?: number;
55
+ smileThreshold?: number;
56
+ blinkThreshold?: number;
57
+ minturnHeadThreshold?: number;
58
+ maxturnHeadThreshold?: number;
59
+ onStateChange?: (state: LivenessState) => void;
60
+ onComplete?: (result: LivenessSDKResult) => void;
61
+ onError?: (error: LivenessSDKResult) => void;
62
+ }
63
+
64
+ export declare interface LivenessResponse {
65
+ is_live: boolean;
66
+ reason?: string;
67
+ skin_confidence?: number;
68
+ [key: string]: any;
69
+ }
70
+
71
+ export declare interface LivenessSDKResult {
72
+ success: boolean;
73
+ image?: string;
74
+ reason?: string;
75
+ skinConfidence?: number;
76
+ }
77
+
78
+ export declare interface LivenessState {
79
+ status: "loading" | "ready" | "capturing" | "verifying" | "success" | "error" | "expired";
80
+ sequence: Challenge[];
81
+ currentStep: number;
82
+ timeLeft: number;
83
+ isStepTransitioning: boolean;
84
+ errorMsg: string;
85
+ }
86
+
87
+ export declare const useLiveness: (config: LivenessEngineConfig) => UseLivenessHook;
88
+
89
+ export declare interface UseLivenessHook extends LivenessState {
90
+ webcamRef: React.RefObject<default_2>;
91
+ start: () => void;
92
+ reset: () => void;
93
+ }
94
+
95
+ /**
96
+ * Sends captured frames to the backend API for liveness verification.
97
+ * @param apiUrl - Base URL of the liveness backend
98
+ * @param frameBlobs - Array of Blob objects representing captured frames
99
+ * @param challenge - The current challenge string
100
+ * @returns LivenessResponse from backend
101
+ */
102
+ export declare const verifyLiveness: (apiUrl: string, frameBlobs: Blob[], challenge: string) => Promise<LivenessResponse>;
103
+
104
+ export { }