@richard.fadiora/liveness-detection 5.0.2 → 5.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/LivenessCheck-CjVP-81C.cjs +36 -0
- package/dist/LivenessCheck-uEzmlOY8.js +4178 -0
- package/dist/angular/fesm2022/richard.fadiora-liveness-detection.mjs +25 -6
- package/dist/angular/fesm2022/richard.fadiora-liveness-detection.mjs.map +1 -1
- package/dist/core/LivenessEngine.d.ts.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.js +10 -7
- package/dist/react.cjs +1 -22
- package/dist/react.js +3 -365
- package/package.json +1 -1
- package/dist/LivenessEngine-B1aNyAdi.js +0 -3815
- package/dist/LivenessEngine-BqatmbVS.cjs +0 -15
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";var ue=typeof self<"u"?self:{};function je(t,e){t:{for(var n=["CLOSURE_FLAGS"],s=ue,r=0;r<n.length;r++)if((s=s[n[r]])==null){n=null;break t}n=s}return(t=n&&n[t])!=null?t:e}function Ht(){throw Error("Invalid UTF8")}function lr(t,e){return e=String.fromCharCode.apply(null,e),t==null?e:t+e}let en,Vn;const ga=typeof TextDecoder<"u";let ma;const ya=typeof TextEncoder<"u";function pi(t){if(ya)t=(ma||(ma=new TextEncoder)).encode(t);else{let n=0;const s=new Uint8Array(3*t.length);for(let r=0;r<t.length;r++){var e=t.charCodeAt(r);if(e<128)s[n++]=e;else{if(e<2048)s[n++]=e>>6|192;else{if(e>=55296&&e<=57343){if(e<=56319&&r<t.length){const i=t.charCodeAt(++r);if(i>=56320&&i<=57343){e=1024*(e-55296)+i-56320+65536,s[n++]=e>>18|240,s[n++]=e>>12&63|128,s[n++]=e>>6&63|128,s[n++]=63&e|128;continue}r--}e=65533}s[n++]=e>>12|224,s[n++]=e>>6&63|128}s[n++]=63&e|128}}t=n===s.length?s:s.subarray(0,n)}return t}function gi(t){ue.setTimeout(()=>{throw t},0)}var Xn,_a=je(610401301,!1),fr=je(748402147,!0),ps=je(824648567,!0),gs=je(824656860,je(1,!0));function dr(){var t=ue.navigator;return t&&(t=t.userAgent)?t:""}const pr=ue.navigator;function gn(t){return gn[" "](t),t}Xn=pr&&pr.userAgentData||null,gn[" "]=function(){};const mi={};let Be=null;function va(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 s=new Uint8Array(n);let r=0;return function(i,o){function a(u){for(;c<i.length;){const h=i.charAt(c++),f=Be[h];if(f!=null)return f;if(!/^[\s\xa0]*$/.test(h))throw Error("Unknown base64 encoding at char: "+h)}return u}yi();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){s[r++]=i}),r!==n?s.subarray(0,r):s}function yi(){if(!Be){Be={};var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),e=["+/=","+/","-_=","-_.","-_"];for(let n=0;n<5;n++){const s=t.concat(e[n].split(""));mi[n]=s;for(let r=0;r<s.length;r++){const i=s[r];Be[i]===void 0&&(Be[i]=r)}}}}var wa=typeof Uint8Array<"u",_i=!(!(_a&&Xn&&Xn.brands.length>0)&&(dr().indexOf("Trident")!=-1||dr().indexOf("MSIE")!=-1))&&typeof btoa=="function";const gr=/[-_.]/g,ba={"-":"+",_:"/",".":"="};function Aa(t){return ba[t]||""}function vi(t){if(!_i)return va(t);t=gr.test(t)?t.replace(gr,Aa):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 ms(t){return wa&&t!=null&&t instanceof Uint8Array}var le={};function Qt(){return Ea||(Ea=new Et(null,le))}function ys(t){wi(le);var e=t.g;return(e=e==null||ms(e)?e:typeof e=="string"?vi(e):null)==null?e:t.g=e}var Et=class{h(){return new Uint8Array(ys(this)||0)}constructor(t,e){if(wi(e),this.g=t,t!=null&&t.length===0)throw Error("ByteString should be constructed with non-empty values")}};let Ea,ka;function wi(t){if(t!==le)throw Error("illegal external caller")}function bi(t,e){t.__closure__error__context__984382||(t.__closure__error__context__984382={}),t.__closure__error__context__984382.severity=e}function $n(t){return bi(t=Error(t),"warning"),t}function fe(t,e){if(t!=null){var n=ka??(ka={}),s=n[t]||0;s>=e||(n[t]=s+1,bi(t=Error(),"incident"),gi(t))}}function Ae(){return typeof BigInt=="function"}var Ee=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 Sa=kt("jas",void 0,!0),mr=kt(void 0,"0di"),Re=kt(void 0,"1oa"),nt=kt(void 0,Symbol()),La=kt(void 0,"0ub"),Ta=kt(void 0,"0ubs"),Jn=kt(void 0,"0ubsb"),Ma=kt(void 0,"0actk"),de=kt("m_m","Pa",!0),yr=kt();const Ai={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},Ei=Object.defineProperties,d=Ee?Sa:"Ga";var ee;const _r=[];function ze(t,e){Ee||d in t||Ei(t,Ai),t[d]|=e}function G(t,e){Ee||d in t||Ei(t,Ai),t[d]=e}function Ye(t){return ze(t,34),t}function He(t){return ze(t,8192),t}G(_r,7),ee=Object.freeze(_r);var pe={};function rt(t,e){return e===void 0?t.h!==Zt&&!!(2&(0|t.v[d])):!!(2&e)&&t.h!==Zt}const Zt={};function _s(t,e){if(t!=null){if(typeof t=="string")t=t?new Et(t,le):Qt();else if(t.constructor!==Et)if(ms(t))t=t.length?new Et(new Uint8Array(t),le):Qt();else{if(!e)throw Error();t=void 0}}return t}class vr{constructor(e,n,s){this.g=e,this.h=n,this.l=s}next(){const e=this.g.next();return e.done||(e.value=this.h.call(this.l,e.value)),e}[Symbol.iterator](){return this}}var Fa=Object.freeze({});function ki(t,e,n){const s=128&e?0:-1,r=t.length;var i;(i=!!r)&&(i=(i=t[r-1])!=null&&typeof i=="object"&&i.constructor===Object);const o=r+(i?-1:0);for(e=128&e?1:0;e<o;e++)n(e-s,t[e]);if(i){t=t[r-1];for(const a in t)!isNaN(a)&&n(+a,t[a])}}var Si={};function ke(t){return 128&t?Si:void 0}function mn(t){return t.Na=!0,t}var Ia=mn(t=>typeof t=="number"),wr=mn(t=>typeof t=="string"),Pa=mn(t=>typeof t=="boolean"),yn=typeof ue.BigInt=="function"&&typeof ue.BigInt(0)=="bigint";function st(t){var e=t;if(wr(e)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(e))throw Error(String(e))}else if(Ia(e)&&!Number.isSafeInteger(e))throw Error(String(e));return yn?BigInt(t):t=Pa(t)?t?"1":"0":wr(t)?t.trim()||"0":String(t)}var Qn=mn(t=>yn?t>=xa&&t<=Ra:t[0]==="-"?br(t,Oa):br(t,Na));const Oa=Number.MIN_SAFE_INTEGER.toString(),xa=yn?BigInt(Number.MIN_SAFE_INTEGER):void 0,Na=Number.MAX_SAFE_INTEGER.toString(),Ra=yn?BigInt(Number.MAX_SAFE_INTEGER):void 0;function br(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 s=t[n],r=e[n];if(s>r)return!1;if(s<r)return!0}}const Ca=typeof Uint8Array.prototype.slice=="function";let Ba,I=0,C=0;function Ar(t){const e=t>>>0;I=e,C=(t-e)/4294967296>>>0}function ge(t){if(t<0){Ar(-t);const[e,n]=As(I,C);I=e>>>0,C=n>>>0}else Ar(t)}function vs(t){const e=Ba||(Ba=new DataView(new ArrayBuffer(8)));e.setFloat32(0,+t,!0),C=0,I=e.getUint32(0,!0)}function Zn(t,e){const n=4294967296*e+(t>>>0);return Number.isSafeInteger(n)?n:Ke(t,e)}function Da(t,e){return st(Ae()?BigInt.asUintN(64,(BigInt(e>>>0)<<BigInt(32))+BigInt(t>>>0)):Ke(t,e))}function ws(t,e){const n=2147483648&e;return n&&(e=~e>>>0,(t=1+~t>>>0)==0&&(e=e+1>>>0)),typeof(t=Zn(t,e))=="number"?n?-t:t:n?"-"+t:t}function Li(t,e){return Ae()?st(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(e))<<BigInt(32))+BigInt.asUintN(32,BigInt(t)))):st(bs(t,e))}function Ke(t,e){if(t>>>=0,(e>>>=0)<=2097151)var n=""+(4294967296*e+t);else Ae()?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+Er(n)+Er(t));return n}function Er(t){return t=String(t),"0000000".slice(t.length)+t}function bs(t,e){if(2147483648&e)if(Ae())t=""+(BigInt(0|e)<<BigInt(32)|BigInt(t>>>0));else{const[n,s]=As(t,e);t="-"+Ke(n,s)}else t=Ke(t,e);return t}function _n(t){if(t.length<16)ge(Number(t));else if(Ae())t=BigInt(t),I=Number(t&BigInt(4294967295))>>>0,C=Number(t>>BigInt(32)&BigInt(4294967295));else{const e=+(t[0]==="-");C=I=0;const n=t.length;for(let s=e,r=(n-e)%6+e;r<=n;s=r,r+=6){const i=Number(t.slice(s,r));C*=1e6,I=1e6*I+i,I>=4294967296&&(C+=Math.trunc(I/4294967296),C>>>=0,I>>>=0)}if(e){const[s,r]=As(I,C);I=s,C=r}}}function As(t,e){return e=~e,t?t=1+~t:e+=1,[t,e]}function mt(t){return Array.prototype.slice.call(t)}const Xe=typeof BigInt=="function"?BigInt.asIntN:void 0,Ua=typeof BigInt=="function"?BigInt.asUintN:void 0,te=Number.isSafeInteger,vn=Number.isFinite,me=Math.trunc,Va=st(0);function De(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 We(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 Ti(t){return t==null||typeof t=="boolean"?t:typeof t=="number"?!!t:void 0}const Ga=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function $e(t){switch(typeof t){case"bigint":return!0;case"number":return vn(t);case"string":return Ga.test(t);default:return!1}}function Se(t){if(t==null)return t;if(typeof t=="string"&&t)t=+t;else if(typeof t!="number")return;return vn(t)?0|t:void 0}function Mi(t){if(t==null)return t;if(typeof t=="string"&&t)t=+t;else if(typeof t!="number")return;return vn(t)?t>>>0:void 0}function Fi(t){const e=t.length;return(t[0]==="-"?e<20||e===20&&t<="-9223372036854775808":e<19||e===19&&t<="9223372036854775807")?t:(_n(t),bs(I,C))}function Es(t){return t=me(t),te(t)||(ge(t),t=ws(I,C)),t}function Ii(t){var e=me(Number(t));return te(e)?String(e):((e=t.indexOf("."))!==-1&&(t=t.substring(0,e)),Fi(t))}function Pi(t){var e=me(Number(t));return te(e)?st(e):((e=t.indexOf("."))!==-1&&(t=t.substring(0,e)),Ae()?st(Xe(64,BigInt(t))):st(Fi(t)))}function Oi(t){return te(t)?t=st(Es(t)):(t=me(t),te(t)?t=String(t):(ge(t),t=bs(I,C)),t=st(t)),t}function ja(t){return t==null?t:typeof t=="bigint"?(Qn(t)?t=Number(t):(t=Xe(64,t),t=Qn(t)?Number(t):String(t)),t):$e(t)?typeof t=="number"?Es(t):Ii(t):void 0}function cn(t){const e=typeof t;return t==null?t:e==="bigint"?st(Xe(64,t)):$e(t)?e==="string"?Pi(t):Oi(t):void 0}function xi(t){if(typeof t!="string")throw Error();return t}function Je(t){if(t!=null&&typeof t!="string")throw Error();return t}function z(t){return t==null||typeof t=="string"?t:void 0}function ks(t,e,n,s){return t!=null&&t[de]===pe?t:Array.isArray(t)?((s=(n=0|t[d])|32&s|2&s)!==n&&G(t,s),new e(t)):(n?2&s?((t=e[mr])||(Ye((t=new e).v),t=e[mr]=t),e=t):e=new e:e=void 0,e)}function Ha(t,e,n){if(e)t:{if(!$e(e=t))throw $n("int64");switch(typeof e){case"string":e=Pi(e);break t;case"bigint":e=st(Xe(64,e));break t;default:e=Oi(e)}}else e=cn(t);return(t=e)==null?n?Va:void 0:t}const Ka={};let Wa=function(){try{return gn(new class extends Map{constructor(){super()}}),!1}catch{return!0}}();class Gn{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 qa=Wa?(Object.setPrototypeOf(Gn.prototype,Map.prototype),Object.defineProperties(Gn.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),Gn):class extends Map{constructor(){super()}};function kr(t){return t}function jn(t){if(2&t.J)throw Error("Cannot mutate an immutable Map")}var It=class extends qa{constructor(t,e,n=kr,s=kr){super(),this.J=0|t[d],this.K=e,this.S=n,this.fa=this.K?za:s;for(let r=0;r<t.length;r++){const i=t[r],o=n(i[0],!1,!0);let a=i[1];e?a===void 0&&(a=null):a=s(i[1],!1,!0,void 0,void 0,this.J),super.set(o,a)}}V(t){return He(Array.from(super.entries(),t))}clear(){jn(this),super.clear()}delete(t){return jn(this),super.delete(this.S(t,!0,!1))}entries(){if(this.K){var t=super.keys();t=new vr(t,Ya,this)}else t=super.entries();return t}values(){if(this.K){var t=super.keys();t=new vr(t,It.prototype.get,this)}else t=super.values();return t}forEach(t,e){this.K?super.forEach((n,s,r)=>{t.call(e,r.get(s),s,r)}):super.forEach(t,e)}set(t,e){return jn(this),(t=this.S(t,!0,!1))==null?this:e==null?(super.delete(t),this):super.set(t,this.fa(e,!0,!0,this.K,!1,this.J))}Ma(t){const e=this.S(t[0],!1,!0);t=t[1],t=this.K?t===void 0?null:t:this.fa(t,!1,!0,void 0,!1,this.J),super.set(e,t)}has(t){return super.has(this.S(t,!1,!1))}get(t){t=this.S(t,!1,!1);const e=super.get(t);if(e!==void 0){var n=this.K;return n?((n=this.fa(e,!1,!0,n,this.ra,this.J))!==e&&super.set(t,n),n):e}}[Symbol.iterator](){return this.entries()}};function za(t,e,n,s,r,i){return t=ks(t,s,n,i),r&&(t=Ls(t)),t}function Ya(t){return[t,this.get(t)]}let Xa;function Sr(){return Xa||(Xa=new It(Ye([]),void 0,void 0,void 0,Ka))}function wn(t){return nt?t[nt]:void 0}function hn(t,e){for(const n in t)!isNaN(n)&&e(t,+n,t[n])}It.prototype.toJSON=void 0;var ts=class{};const $a={Ka:!0};function Ja(t,e){e<100||fe(Ta,1)}function bn(t,e,n,s){const r=s!==void 0;s=!!s;var i,o=nt;!r&&Ee&&o&&(i=t[o])&&hn(i,Ja),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||r||(u=!0,i=i-f+f)),e=void 0;for(var _=0;_<a;_++){let v=t[_];if(v!=null&&(v=n(v,s))!=null)if(h&&_>=i){const j=_-f;(e??(e={}))[j]=v}else o[_]=v}if(c)for(let v in c){if((a=c[v])==null||(a=n(a,s))==null)continue;let j;_=+v,h&&!Number.isNaN(_)&&(j=_+f)<i?o[j]=a:(e??(e={}))[v]=a}return e&&(u?o.push(e):o[i]=e),r&&nt&&(t=wn(t))&&t instanceof ts&&(o[nt]=function(v){const j=new ts;return hn(v,(Dn,re,Ne)=>{j[re]=mt(Ne)}),j.da=v.da,j}(t)),o}function Qa(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:bn(t,e,qe)}if(t!=null&&t[de]===pe)return Ni(t);if(t instanceof Et){if((e=t.g)==null)t="";else if(typeof e=="string")t=e;else{if(_i){for(var n="",s=0,r=e.length-10240;s<r;)n+=String.fromCharCode.apply(null,e.subarray(s,s+=10240));n+=String.fromCharCode.apply(null,s?e.subarray(s):e),e=btoa(n)}else{n===void 0&&(n=0),yi(),n=mi[n],s=Array(Math.floor(e.length/3)),r=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],s[h++]=c+i+o+a}switch(c=0,a=r,e.length-u){case 2:a=n[(15&(c=e[u+1]))<<2]||r;case 1:e=e[u],s[h]=n[e>>2]+n[(3&e)<<4|c>>4]+a+r}e=s.join("")}t=t.g=e}return t}return t instanceof It?t=t.size!==0?t.V(Qa):void 0:void 0}return t}function Ni(t){return bn(t=t.v,0|t[d],qe)}let Za,t2;function zt(t,e){return Ri(t,e[0],e[1])}function Ri(t,e,n,s=0){if(t==null){var r=32;n?(t=[n],r|=128):t=[],e&&(r=-16760833&r|(1023&e)<<14)}else{if(!Array.isArray(t))throw Error("narr");if(r=0|t[d],fr&&1&r)throw Error("rfarr");if(2048&r&&!(2&r)&&function(){if(fr)throw Error("carr");fe(Ma,5)}(),256&r)throw Error("farr");if(64&r)return(r|s)!==r&&G(t,r|s),t;if(n&&(r|=128,n!==t[0]))throw Error("mid");t:{r|=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&r?0:-1)>=1024)throw Error("pvtlmt");for(var a in c)(i=+a)<o&&(n[i+e]=c[a],delete c[a]);r=-16760833&r|(1023&o)<<14;break t}}if(e){if((a=Math.max(e,i-(128&r?0:-1)))>1024)throw Error("spvt");r=-16760833&r|(1023&a)<<14}}}return G(t,64|r|s),t}function e2(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:Lr(t,n,e)}if(t!=null&&t[de]===pe)return Tr(t);if(t instanceof It){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 s=n[t];let r=s[1];r=r==null||typeof r!="object"?void 0:r!=null&&r[de]===pe?Tr(r):Array.isArray(r)?Lr(r,0|r[d],!!(32&e)):void 0,s[1]=r}return n}return t instanceof Et?t:void 0}function Lr(t,e,n){return 2&e||(!n||4096&e||16&e?t=Le(t,e,!1,n&&!(16&e)):(ze(t,34),4&e&&Object.freeze(t))),t}function Ss(t,e,n){return t=new t.constructor(e),n&&(t.h=Zt),t.m=Zt,t}function Tr(t){const e=t.v,n=0|e[d];return rt(t,n)?t:Ts(t,e,n)?Ss(t,e):Le(e,n)}function Le(t,e,n,s){return s??(s=!!(34&e)),t=bn(t,e,e2,s),s=32,n&&(s|=2),G(t,e=16769217&e|s),t}function Ls(t){const e=t.v,n=0|e[d];return rt(t,n)?Ts(t,e,n)?Ss(t,e,!0):new t.constructor(Le(e,n,!1)):t}function Te(t){if(t.h!==Zt)return!1;var e=t.v;return ze(e=Le(e,0|e[d]),2048),t.v=e,t.h=void 0,t.m=void 0,!0}function Me(t){if(!Te(t)&&rt(t,0|t.v[d]))throw Error()}function ne(t,e){e===void 0&&(e=0|t[d]),32&e&&!(4096&e)&&G(t,4096|e)}function Ts(t,e,n){return!!(2&n)||!(!(32&n)||4096&n)&&(G(e,2|n),t.h=Zt,!0)}const n2=st(0),Rt={};function T(t,e,n,s,r){if((e=Pt(t.v,e,n,r))!==null||s&&t.m!==Zt)return e}function Pt(t,e,n,s){if(e===-1)return null;const r=e+(n?0:-1),i=t.length-1;let o,a;if(!(i<1+(n?0:-1))){if(r>=i)if(o=t[i],o!=null&&typeof o=="object"&&o.constructor===Object)n=o[e],a=!0;else{if(r!==i)return;n=o}else n=t[r];if(s&&n!=null){if((s=s(n))==null)return s;if(!Object.is(s,n))return a?o[e]=s:t[r]=s,s}return n}}function k(t,e,n,s){Me(t),U(t=t.v,0|t[d],e,n,s)}function U(t,e,n,s,r){const i=n+(r?0:-1);var o=t.length-1;if(o>=1+(r?0:-1)&&i>=o){const a=t[o];if(a!=null&&typeof a=="object"&&a.constructor===Object)return a[n]=s,e}return i<=o?(t[i]=s,e):(s!==void 0&&(n>=(o=(e??(e=0|t[d]))>>14&1023||536870912)?s!=null&&(t[o+(r?0:-1)]={[n]:s}):t[i]=s),e)}function Wt(){return Fa===void 0?2:4}function qt(t,e,n,s,r){let i=t.v,o=0|i[d];s=rt(t,o)?1:s,r=!!r||s===3,s===2&&Te(t)&&(i=t.v,o=0|i[d]);let a=(t=Ms(i,e))===ee?7:0|t[d],c=Fs(a,o);var u=!(4&c);if(u){4&c&&(t=mt(t),a=0,c=Xt(c,o),o=U(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&&(G(t,c),2&c&&Object.freeze(t)),Ci(t,c,i,o,e,s,u,r)}function Ci(t,e,n,s,r,i,o,a){let c=e;return i===1||i===4&&(2&e||!(16&e)&&32&s)?Yt(e)||((e|=!t.length||o&&!(4096&e)||32&s&&!(4096&e||16&e)?2:256)!==c&&G(t,e),Object.freeze(t)):(i===2&&Yt(e)&&(t=mt(t),c=0,e=Xt(e,s),s=U(n,s,r,t)),Yt(e)||(a||(e|=16),e!==c&&G(t,e))),2&e||!(4096&e||16&e)||ne(n,s),t}function Ms(t,e,n){return t=Pt(t,e,n),Array.isArray(t)?t:ee}function Fs(t,e){return 2&e&&(t|=2),1|t}function Yt(t){return!!(2&t)&&!!(4&t)||!!(256&t)}function Bi(t){return _s(t,!0)}function Di(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 He(t)}function Bt(t,e,n,s){Me(t),U(t=t.v,0|t[d],e,(s==="0"?Number(n)===0:n===s)?void 0:n)}function Fe(t,e,n){if(2&e)throw Error();const s=ke(e);let r=Ms(t,n,s),i=r===ee?7:0|r[d],o=Fs(i,e);return(2&o||Yt(o)||16&o)&&(o===i||Yt(o)||G(r,o),r=mt(r),i=0,o=Xt(o,e),U(t,e,n,r,s)),o&=-13,o!==i&&G(r,o),r}function Hn(t,e){var n=Po;return Ps(Is(t=t.v),t,void 0,n)===e?e:-1}function Is(t){if(Ee)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 Ui(t,e,n,s,r){const i=Is(t),o=Ps(i,t,e,n,r);return o!==s&&(o&&(e=U(t,e,o,void 0,r)),i.set(n,s)),e}function Ps(t,e,n,s,r){let i=t.get(s);if(i!=null)return i;i=0;for(let o=0;o<s.length;o++){const a=s[o];Pt(e,a,r)!=null&&(i!==0&&(n=U(e,n,i,void 0,r)),i=a)}return t.set(s,i),i}function Os(t,e,n){let s=0|t[d];const r=ke(s),i=Pt(t,n,r);let o;if(i!=null&&i[de]===pe){if(!rt(i))return Te(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=zt(o,e),o!==i&&U(t,s,n,o,r),o}function Vi(t,e,n,s,r){let i=!1;if((s=Pt(t,s,r,o=>{const a=ks(o,n,!1,e);return i=a!==o&&a!=null,a}))!=null)return i&&!rt(s)&&ne(t,e),s}function A(t,e,n,s){let r=t.v,i=0|r[d];if((e=Vi(r,i,e,n,s))==null)return e;if(i=0|r[d],!rt(t,i)){const o=Ls(e);o!==e&&(Te(t)&&(r=t.v,i=0|r[d]),i=U(r,i,n,e=o,s),ne(r,i))}return e}function Gi(t,e,n,s,r,i,o,a){var c=rt(t,n);i=c?1:i,o=!!o||i===3,c=a&&!c,(i===2||c)&&Te(t)&&(n=0|(e=t.v)[d]);var u=(t=Ms(e,r))===ee?7:0|t[d],h=Fs(u,n);if(a=!(4&h)){var f=t,_=n;const v=!!(2&h);v&&(_|=2);let j=!v,Dn=!0,re=0,Ne=0;for(;re<f.length;re++){const Un=ks(f[re],s,!1,_);if(Un instanceof s){if(!v){const ur=rt(Un);j&&(j=!ur),Dn&&(Dn=ur)}f[Ne++]=Un}}Ne<re&&(f.length=Ne),h|=4,h=Dn?-4097&h:4096|h,h=j?8|h:-9&h}if(h!==u&&(G(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=Xt(h,n),n=U(e,n,r,t)),s=t,c=h,u=0;u<s.length;u++)(f=s[u])!==(h=Ls(f))&&(s[u]=h);c|=8,G(t,h=c=s.length?4096|c:-4097&c)}return Ci(t,h,e,n,r,i,a,o)}function Ot(t,e,n){const s=t.v;return Gi(t,s,0|s[d],e,n,Wt(),!1,!0)}function ji(t){return t==null&&(t=void 0),t}function y(t,e,n,s,r){return k(t,n,s=ji(s),r),s&&!rt(s)&&ne(t.v),t}function Ue(t,e,n,s){t:{var r=s=ji(s);Me(t);const i=t.v;let o=0|i[d];if(r==null){const a=Is(i);if(Ps(a,i,o,n)!==e)break t;a.set(n,0)}else o=Ui(i,o,n,e);U(i,o,e,r)}s&&!rt(s)&&ne(t.v)}function Xt(t,e){return-273&(2&e?2|t:-3&t)}function xs(t,e,n,s){var r=s;Me(t),t=Gi(t,s=t.v,0|s[d],n,e,2,!0),r=r??new n,t.push(r),e=n=t===ee?7:0|t[d],(r=rt(r))?(n&=-9,t.length===1&&(n&=-4097)):n|=4096,n!==e&&G(t,n),r||ne(s)}function dt(t,e,n){return Se(T(t,e,void 0,n))}function Hi(t){return(gs?T(t,2,void 0,void 0,cn):cn(T(t,2)))??n2}function N(t,e){return T(t,e,void 0,void 0,At)??0}function xt(t,e,n){if(n!=null){if(typeof n!="number"||!vn(n))throw $n("int32");n|=0}k(t,e,n)}function m(t,e,n){k(t,e,De(n))}function it(t,e,n){Bt(t,e,Je(n),"")}function un(t,e,n){{Me(t);const o=t.v;let a=0|o[d];if(n==null)U(o,a,e);else{var s=t=n===ee?7:0|n[d],r=Yt(t),i=r||Object.isFrozen(n);for(r||(t=0),i||(n=mt(n),s=0,t=Xt(t,a),i=!1),t|=5,t|=(4&t?512&t?512:1024&t?1024:0:void 0)??(gs?1024:0),r=0;r<n.length;r++){const c=n[r],u=xi(c);Object.is(c,u)||(i&&(n=mt(n),s=0,t=Xt(t,a),i=!1),n[r]=u)}t!==s&&(i&&(n=mt(n),t=Xt(t,a)),G(n,t)),U(o,a,e,n)}}}function An(t,e,n){Me(t),qt(t,e,z,2,!0).push(xi(n))}var ie=class{constructor(t,e,n){if(this.buffer=t,n&&!e)throw Error();this.g=e}};function Ns(t,e){if(typeof t=="string")return new ie(vi(t),e);if(Array.isArray(t))return new ie(new Uint8Array(t),e);if(t.constructor===Uint8Array)return new ie(t,!1);if(t.constructor===ArrayBuffer)return t=new Uint8Array(t),new ie(t,!1);if(t.constructor===Et)return e=ys(t)||new Uint8Array(0),new ie(e,!0,t);if(t instanceof Uint8Array)return t=t.constructor===Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new ie(t,!1);throw Error()}function ye(t,e){let n,s=0,r=0,i=0;const o=t.h;let a=t.g;do n=o[a++],s|=(127&n)<<i,i+=7;while(i<32&&128&n);if(i>32)for(r|=(127&n)>>4,i=3;i<32&&128&n;i+=7)n=o[a++],r|=(127&n)<<i;if($t(t,a),!(128&n))return e(s>>>0,r>>>0);throw Error()}function Rs(t){let e=0,n=t.g;const s=n+10,r=t.h;for(;n<s;){const i=r[n++];if(e|=i,(128&i)==0)return $t(t,n),!!(127&e)}throw Error()}function Vt(t){const e=t.h;let n=t.g,s=e[n++],r=127&s;if(128&s&&(s=e[n++],r|=(127&s)<<7,128&s&&(s=e[n++],r|=(127&s)<<14,128&s&&(s=e[n++],r|=(127&s)<<21,128&s&&(s=e[n++],r|=s<<28,128&s&&128&e[n++]&&128&e[n++]&&128&e[n++]&&128&e[n++]&&128&e[n++])))))throw Error();return $t(t,n),r}function Nt(t){return Vt(t)>>>0}function ln(t){var e=t.h;const n=t.g;var s=e[n],r=e[n+1];const i=e[n+2];return e=e[n+3],$t(t,t.g+4),t=2*((r=(s<<0|r<<8|i<<16|e<<24)>>>0)>>31)+1,s=r>>>23&255,r&=8388607,s==255?r?NaN:t*(1/0):s==0?1401298464324817e-60*t*r:t*Math.pow(2,s-150)*(r+8388608)}function s2(t){return Vt(t)}function $t(t,e){if(t.g=e,e>t.l)throw Error()}function Ki(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 Wi(t,e){if(e==0)return Qt();var n=Ki(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):Ca?t.slice(n,e):new Uint8Array(t.subarray(n,e))),n.length==0?Qt():new Et(n,le)}var Mr=[];function qi(t,e,n,s){if(fn.length){const r=fn.pop();return r.o(s),r.g.init(t,e,n,s),r}return new r2(t,e,n,s)}function zi(t){t.g.clear(),t.l=-1,t.h=-1,fn.length<100&&fn.push(t)}function Yi(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 on(t){switch(t.h){case 0:t.h!=0?on(t):Rs(t.g);break;case 1:$t(t=t.g,t.g+8);break;case 2:if(t.h!=2)on(t);else{var e=Nt(t.g);$t(t=t.g,t.g+e)}break;case 5:$t(t=t.g,t.g+4);break;case 3:for(e=t.l;;){if(!Yi(t))throw Error();if(t.h==4){if(t.l!=e)throw Error();break}on(t)}break;default:throw Error()}}function Qe(t,e,n){const s=t.g.l;var r=Nt(t.g);let i=(r=t.g.g+r)-s;if(i<=0&&(t.g.l=r,n(e,t,void 0,void 0,void 0),i=r-t.g.g),i)throw Error();return t.g.g=r,t.g.l=s,e}function Cs(t){var e=Nt(t.g),n=Ki(t=t.g,e);if(t=t.h,ga){var s,r=t;(s=Vn)||(s=Vn=new TextDecoder("utf-8",{fatal:!0})),e=n+e,r=n===0&&e===r.length?r:r.subarray(n,e);try{var i=s.decode(r)}catch(a){if(en===void 0){try{s.decode(new Uint8Array([128]))}catch{}try{s.decode(new Uint8Array([97])),en=!0}catch{en=!1}}throw!en&&(Vn=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?Ht():(a=t[i++],o<194||(192&a)!=128?(i--,Ht()):n.push((31&o)<<6|63&a)):o<240?i>=e-1?Ht():(a=t[i++],(192&a)!=128||o===224&&a<160||o===237&&a>=160||(192&(s=t[i++]))!=128?(i--,Ht()):n.push((15&o)<<12|(63&a)<<6|63&s)):o<=244?i>=e-2?Ht():(a=t[i++],(192&a)!=128||a-144+(o<<28)>>30||(192&(s=t[i++]))!=128||(192&(r=t[i++]))!=128?(i--,Ht()):(o=(7&o)<<18|(63&a)<<12|(63&s)<<6|63&r,o-=65536,n.push(55296+(o>>10&1023),56320+(1023&o)))):Ht(),n.length>=8192&&(c=lr(c,n),n.length=0)}i=lr(c,n)}return i}function Xi(t){const e=Nt(t.g);return Wi(t.g,e)}function En(t,e,n){var s=Nt(t.g);for(s=t.g.g+s;t.g.g<s;)n.push(e(t.g))}var r2=class{constructor(t,e,n,s){if(Mr.length){const r=Mr.pop();r.init(t,e,n,s),t=r}else t=new class{constructor(r,i,o,a){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.init(r,i,o,a)}init(r,i,o,{Y:a=!1,ea:c=!1}={}){this.Y=a,this.ea=c,r&&(r=Ns(r,this.ea),this.h=r.buffer,this.j=r.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,s);this.g=t,this.m=this.g.g,this.h=this.l=-1,this.o(s)}o({ha:t=!1}={}){this.ha=t}},fn=[];function Fr(t){return t?/^\d+$/.test(t)?(_n(t),new es(I,C)):null:i2||(i2=new es(0,0))}var es=class{constructor(t,e){this.h=t>>>0,this.g=e>>>0}};let i2;function Ir(t){return t?/^-?\d+$/.test(t)?(_n(t),new ns(I,C)):null:o2||(o2=new ns(0,0))}var ns=class{constructor(t,e){this.h=t>>>0,this.g=e>>>0}};let o2;function ce(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 Ie(t,e){for(;e>127;)t.g.push(127&e|128),e>>>=7;t.g.push(e)}function kn(t,e){if(e>=0)Ie(t,e);else{for(let n=0;n<9;n++)t.g.push(127&e|128),e>>=7;t.g.push(1)}}function Bs(t){var e=I;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 _e(t,e){e.length!==0&&(t.l.push(e),t.h+=e.length)}function pt(t,e,n){Ie(t.g,8*e+n)}function Ds(t,e){return pt(t,e,2),e=t.g.end(),_e(t,e),e.push(t.h),e}function Us(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 Sn(t,e,n){pt(t,e,2),Ie(t.g,n.length),_e(t,t.g.end()),_e(t,n)}function dn(t,e,n,s){n!=null&&(e=Ds(t,e),s(n,t),Us(t,e))}function St(){const t=class{constructor(){throw Error()}};return Object.setPrototypeOf(t,t.prototype),t}var Vs=St(),$i=St(),Gs=St(),js=St(),Ji=St(),Qi=St(),a2=St(),Ln=St(),Zi=St(),to=St();function Lt(t,e,n){var s=t.v;nt&&nt in s&&(s=s[nt])&&delete s[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=Ri(t,e,void 0,2048)}toJSON(){return Ni(this)}j(){var r;var t=H2,e=this.v,n=t.g,s=nt;if(Ee&&s&&((r=e[s])==null?void 0:r[n])!=null&&fe(La,3),e=t.g,yr&&nt&&yr===void 0&&(s=(n=this.v)[nt])&&(s=s.da))try{s(n,e,$a)}catch(i){gi(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 Ts(this,t,e)?Ss(this,t,!0):new this.constructor(Le(t,e,!1))}};p.prototype[de]=pe,p.prototype.toString=function(){return this.v.toString()};var Pe=class{constructor(t,e,n){this.g=t,this.h=e,t=Vs,this.l=!!t&&n===t||!1}};function Tn(t,e){return new Pe(t,e,Vs)}function eo(t,e,n,s,r){dn(t,n,io(e,s),r)}const c2=Tn(function(t,e,n,s,r){return t.h===2&&(Qe(t,Os(e,s,n),r),!0)},eo),h2=Tn(function(t,e,n,s,r){return t.h===2&&(Qe(t,Os(e,s,n),r),!0)},eo);var Mn=Symbol(),Fn=Symbol(),ss=Symbol(),Pr=Symbol(),Or=Symbol();let no,so;function se(t,e,n,s){var r=s[t];if(r)return r;(r={}).qa=s,r.T=function(f){switch(typeof f){case"boolean":return Za||(Za=[0,void 0,!0]);case"number":return f>0?void 0:f===0?t2||(t2=[0,void 0]):[-f,void 0];case"string":return[0,f];case"object":return f}}(s[0]);var i=s[1];let o=1;i&&i.constructor===Object&&(r.ba=i,typeof(i=s[++o])=="function"&&(r.ma=!0,no??(no=i),so??(so=s[o+1]),i=s[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=s[++o]}for(c=1;i!==void 0;){let f;typeof i=="number"&&(c+=i,i=s[++o]);var u=void 0;if(i instanceof Pe?f=i:(f=c2,o--),f==null?void 0:f.l){i=s[++o],u=s;var h=o;typeof i=="function"&&(i=i(),u[h]=i),u=i}for(h=c+1,typeof(i=s[++o])=="number"&&i<0&&(h-=i,i=s[++o]);c<h;c++){const _=a[c];u?n(r,c,f,u,_):e(r,c,f,_)}}return s[t]=r}function ro(t){return Array.isArray(t)?t[0]instanceof Pe?t:[h2,t]:[t,void 0]}function io(t,e){return t instanceof p?t.v:Array.isArray(t)?zt(t,e):void 0}function Hs(t,e,n,s){const r=n.g;t[e]=s?(i,o,a)=>r(i,o,a,s):r}function Ks(t,e,n,s,r){const i=n.g;let o,a;t[e]=(c,u,h)=>i(c,u,h,a||(a=se(Fn,Hs,Ks,s).T),o||(o=Ws(s)),r)}function Ws(t){let e=t[ss];if(e!=null)return e;const n=se(Fn,Hs,Ks,t);return e=n.ma?(s,r)=>no(s,r,n):(s,r)=>{for(;Yi(r)&&r.h!=4;){var i=r.l,o=n[i];if(o==null){var a=n.ba;a&&(a=a[i])&&(a=l2(a))!=null&&(o=n[i]=a)}if(o==null||!o(r,s,i)){if(o=(a=r).m,on(a),a.ha)var c=void 0;else c=a.g.g-o,a.g.g=o,c=Wi(a.g,c);o=void 0,a=s,c&&((o=a[nt]??(a[nt]=new ts))[i]??(o[i]=[])).push(c)}}return(s=wn(s))&&(s.da=n.qa[Or]),!0},t[ss]=e,t[Or]=u2.bind(t),e}function u2(t,e,n,s){var r=this[Fn];const i=this[ss],o=zt(void 0,r.T),a=wn(t);if(a){var c=!1,u=r.ba;if(u){if(r=(h,f,_)=>{if(_.length!==0)if(u[f])for(const v of _){h=qi(v);try{c=!0,i(o,h)}finally{zi(h)}}else s==null||s(t,f,_)},e==null)hn(a,r);else if(a!=null){const h=a[e];h&&r(a,e,h)}if(c){let h=0|t[d];if(2&h&&2048&h&&!(n!=null&&n.Ka))throw Error();const f=ke(h),_=(v,j)=>{if(Pt(t,v,f)!=null){if((n==null?void 0:n.Qa)===1)return;throw Error()}j!=null&&(h=U(t,h,v,j,f)),delete a[v]};e==null?ki(o,0|o[d],(v,j)=>{_(v,j)}):_(e,Pt(o,e,f))}}}}function l2(t){const e=(t=ro(t))[0].g;if(t=t[1]){const n=Ws(t),s=se(Fn,Hs,Ks,t).T;return(r,i,o)=>e(r,i,o,s,n)}return e}function In(t,e,n){t[e]=n.h}function Pn(t,e,n,s){let r,i;const o=n.h;t[e]=(a,c,u)=>o(a,c,u,i||(i=se(Mn,In,Pn,s).T),r||(r=oo(s)))}function oo(t){let e=t[Pr];if(!e){const n=se(Mn,In,Pn,t);e=(s,r)=>ao(s,r,n),t[Pr]=e}return e}function ao(t,e,n){ki(t,0|t[d],(s,r)=>{if(r!=null){var i=function(o,a){var c=o[a];if(c)return c;if((c=o.ba)&&(c=c[a])){var u=(c=ro(c))[0].h;if(c=c[1]){const h=oo(c),f=se(Mn,In,Pn,c).T;c=o.ma?so(f,h):(_,v,j)=>u(_,v,j,f,h)}else c=u;return o[a]=c}}(n,s);i?i(e,r,s):s<500||fe(Jn,3)}}),(t=wn(t))&&hn(t,(s,r,i)=>{for(_e(e,e.g.end()),s=0;s<i.length;s++)_e(e,ys(i[s])||new Uint8Array(0))})}const f2=st(0);function Oe(t,e){if(Array.isArray(e)){var n=0|e[d];if(4&n)return e;for(var s=0,r=0;s<e.length;s++){const i=t(e[s]);i!=null&&(e[r++]=i)}return r<s&&(e.length=r),(t=-1537&(5|n))!==n&&G(e,t),2&t&&Object.freeze(e),e}}function X(t,e,n){return new Pe(t,e,n)}function xe(t,e,n){return new Pe(t,e,n)}function q(t,e,n){U(t,0|t[d],e,n,ke(0|t[d]))}var d2=Tn(function(t,e,n,s,r){if(t.h!==2)return!1;if(t=mt(t=Qe(t,zt([void 0,void 0],s),r)),r=ke(s=0|e[d]),2&s)throw Error();let i=Pt(e,n,r);if(i instanceof It)2&i.J?(i=i.V(),i.push(t),U(e,s,n,i,r)):i.Ma(t);else if(Array.isArray(i)){var o=0|i[d];8192&o||G(i,o|=8192),2&o&&(i=Di(i),U(e,s,n,i,r)),i.push(t)}else U(e,s,n,He([t]),r);return!0},function(t,e,n,s,r){if(e instanceof It)e.forEach((i,o)=>{dn(t,n,zt([o,i],s),r)});else if(Array.isArray(e)){for(let i=0;i<e.length;i++){const o=e[i];Array.isArray(o)&&dn(t,n,zt(o,s),r)}He(e)}});function co(t,e,n){(e=At(e))!=null&&(pt(t,n,5),t=t.g,vs(e),Bs(t))}function ho(t,e,n){if(e=function(s){if(s==null)return s;const r=typeof s;if(r==="bigint")return String(Xe(64,s));if($e(s)){if(r==="string")return Ii(s);if(r==="number")return Es(s)}}(e),e!=null&&(typeof e=="string"&&Ir(e),e!=null))switch(pt(t,n,0),typeof e){case"number":t=t.g,ge(e),ce(t,I,C);break;case"bigint":n=BigInt.asUintN(64,e),n=new ns(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),ce(t.g,n.h,n.g);break;default:n=Ir(e),ce(t.g,n.h,n.g)}}function uo(t,e,n){(e=Se(e))!=null&&e!=null&&(pt(t,n,0),kn(t.g,e))}function lo(t,e,n){(e=Ti(e))!=null&&(pt(t,n,0),t.g.g.push(e?1:0))}function fo(t,e,n){(e=z(e))!=null&&Sn(t,n,pi(e))}function po(t,e,n,s,r){dn(t,n,io(e,s),r)}function go(t,e,n){(e=e==null||typeof e=="string"||e instanceof Et?e:void 0)!=null&&Sn(t,n,Ns(e,!0).buffer)}function mo(t,e,n){return(t.h===5||t.h===2)&&(e=Fe(e,0|e[d],n),t.h==2?En(t,ln,e):e.push(ln(t.g)),!0)}var B=X(function(t,e,n){return t.h===5&&(q(e,n,ln(t.g)),!0)},co,Ln),p2=xe(mo,function(t,e,n){if((e=Oe(At,e))!=null)for(let o=0;o<e.length;o++){var s=t,r=n,i=e[o];i!=null&&(pt(s,r,5),s=s.g,vs(i),Bs(s))}},Ln),qs=xe(mo,function(t,e,n){if((e=Oe(At,e))!=null&&e.length){pt(t,n,2),Ie(t.g,4*e.length);for(let s=0;s<e.length;s++)n=t.g,vs(e[s]),Bs(n)}},Ln),g2=X(function(t,e,n){return t.h===5&&(q(e,n,(t=ln(t.g))===0?void 0:t),!0)},co,Ln),Gt=X(function(t,e,n){return ps?(t.h!==0?t=!1:(q(e,n,ye(t.g,Li)),t=!0),t):t.h===0&&(q(e,n,ye(t.g,ws)),!0)},ho,Qi),Kn=X(function(t,e,n){return ps?(t.h!==0?e=!1:(q(e,n,(t=ye(t.g,Li))===f2?void 0:t),e=!0),e):t.h===0&&(q(e,n,(t=ye(t.g,ws))===0?void 0:t),!0)},ho,Qi),m2=X(function(t,e,n){return ps?(t.h!==0?t=!1:(q(e,n,ye(t.g,Da)),t=!0),t):t.h===0&&(q(e,n,ye(t.g,Zn)),!0)},function(t,e,n){if(e=function(s){if(s==null)return s;var r=typeof s;if(r==="bigint")return String(Ua(64,s));if($e(s)){if(r==="string")return r=me(Number(s)),te(r)&&r>=0?s=String(r):((r=s.indexOf("."))!==-1&&(s=s.substring(0,r)),(r=s[0]!=="-"&&((r=s.length)<20||r===20&&s<="18446744073709551615"))||(_n(s),s=Ke(I,C))),s;if(r==="number")return(s=me(s))>=0&&te(s)||(ge(s),s=Zn(I,C)),s}}(e),e!=null&&(typeof e=="string"&&Fr(e),e!=null))switch(pt(t,n,0),typeof e){case"number":t=t.g,ge(e),ce(t,I,C);break;case"bigint":n=BigInt.asUintN(64,e),n=new es(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),ce(t.g,n.h,n.g);break;default:n=Fr(e),ce(t.g,n.h,n.g)}},a2),W=X(function(t,e,n){return t.h===0&&(q(e,n,Vt(t.g)),!0)},uo,js),Ze=xe(function(t,e,n){return(t.h===0||t.h===2)&&(e=Fe(e,0|e[d],n),t.h==2?En(t,Vt,e):e.push(Vt(t.g)),!0)},function(t,e,n){if((e=Oe(Se,e))!=null&&e.length){n=Ds(t,n);for(let s=0;s<e.length;s++)kn(t.g,e[s]);Us(t,n)}},js),ae=X(function(t,e,n){return t.h===0&&(q(e,n,(t=Vt(t.g))===0?void 0:t),!0)},uo,js),R=X(function(t,e,n){return t.h===0&&(q(e,n,Rs(t.g)),!0)},lo,$i),Jt=X(function(t,e,n){return t.h===0&&(q(e,n,(t=Rs(t.g))===!1?void 0:t),!0)},lo,$i),Y=xe(function(t,e,n){return t.h===2&&(t=Cs(t),Fe(e,0|e[d],n).push(t),!0)},function(t,e,n){if((e=Oe(z,e))!=null)for(let o=0;o<e.length;o++){var s=t,r=n,i=e[o];i!=null&&Sn(s,r,pi(i))}},Gs),Dt=X(function(t,e,n){return t.h===2&&(q(e,n,(t=Cs(t))===""?void 0:t),!0)},fo,Gs),S=X(function(t,e,n){return t.h===2&&(q(e,n,Cs(t)),!0)},fo,Gs),K=function(t,e,n=Vs){return new Pe(t,e,n)}(function(t,e,n,s,r){return t.h===2&&(s=zt(void 0,s),Fe(e,0|e[d],n).push(s),Qe(t,s,r),!0)},function(t,e,n,s,r){if(Array.isArray(e)){for(let i=0;i<e.length;i++)po(t,e[i],n,s,r);1&(t=0|e[d])||G(e,1|t)}}),x=Tn(function(t,e,n,s,r,i){if(t.h!==2)return!1;let o=0|e[d];return Ui(e,o,i,n,ke(o)),Qe(t,e=Os(e,s,n),r),!0},po),yo=X(function(t,e,n){return t.h===2&&(q(e,n,Xi(t)),!0)},go,Zi),y2=xe(function(t,e,n){return(t.h===0||t.h===2)&&(e=Fe(e,0|e[d],n),t.h==2?En(t,Nt,e):e.push(Nt(t.g)),!0)},function(t,e,n){if((e=Oe(Mi,e))!=null)for(let o=0;o<e.length;o++){var s=t,r=n,i=e[o];i!=null&&(pt(s,r,0),Ie(s.g,i))}},Ji),_2=X(function(t,e,n){return t.h===0&&(q(e,n,(t=Nt(t.g))===0?void 0:t),!0)},function(t,e,n){(e=Mi(e))!=null&&e!=null&&(pt(t,n,0),Ie(t.g,e))},Ji),ot=X(function(t,e,n){return t.h===0&&(q(e,n,Vt(t.g)),!0)},function(t,e,n){(e=Se(e))!=null&&(e=parseInt(e,10),pt(t,n,0),kn(t.g,e))},to);class v2{constructor(e,n){var s=ct;this.g=e,this.h=n,this.m=A,this.j=y,this.defaultValue=void 0,this.l=s.Oa!=null?Si:void 0}register(){gn(this)}}function Tt(t,e){return new v2(t,e)}function jt(t,e){return(n,s)=>{{const i={ea:!0};s&&Object.assign(i,s),n=qi(n,void 0,void 0,i);try{const o=new t,a=o.v;Ws(e)(a,n);var r=o}finally{zi(n)}}return r}}function On(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}}}};ao(this.v,e,se(Mn,In,Pn,t)),_e(e,e.g.end());const n=new Uint8Array(e.h),s=e.l,r=s.length;let i=0;for(let o=0;o<r;o++){const a=s[o];n.set(a,i),i+=a.length}return e.l=[n],n}}var xr=class extends p{constructor(t){super(t)}},Nr=[0,Dt,X(function(t,e,n){return t.h===2&&(q(e,n,(t=Xi(t))===Qt()?void 0:t),!0)},function(t,e,n){if(e!=null){if(e instanceof p){const s=e.Ra;return void(s?(e=s(e),e!=null&&Sn(t,n,Ns(e,!0).buffer)):fe(Jn,3))}if(Array.isArray(e))return void fe(Jn,3)}go(t,e,n)},Zi)];let Wn,Rr=globalThis.trustedTypes;function Cr(t){var e;return Wn===void 0&&(Wn=function(){let n=null;if(!Rr)return n;try{const s=r=>r;n=Rr.createPolicy("goog#html",{createHTML:s,createScript:s,createScriptURL:s})}catch{}return n}()),t=(e=Wn)?e.createScriptURL(t):t,new class{constructor(n){this.g=n}toString(){return this.g+""}}(t)}function w2(t,...e){if(e.length===0)return Cr(t[0]);let n=t[0];for(let s=0;s<e.length;s++)n+=encodeURIComponent(e[s])+t[s+1];return Cr(n)}var _o=[0,W,ot,R,-1,Ze,ot,-1,R],b2=class extends p{constructor(t){super(t)}},vo=[0,R,S,R,ot,-1,xe(function(t,e,n){return(t.h===0||t.h===2)&&(e=Fe(e,0|e[d],n),t.h==2?En(t,s2,e):e.push(Vt(t.g)),!0)},function(t,e,n){if((e=Oe(Se,e))!=null&&e.length){n=Ds(t,n);for(let s=0;s<e.length;s++)kn(t.g,e[s]);Us(t,n)}},to),S,-1,[0,R,-1],ot,R,-1],wo=[0,3,R,-1,2,[0,W],[0,ot,R],[0,S,-1],[0]],bo=[0,S,-2],Br=class extends p{constructor(t){super(t)}},Ao=[0],Eo=[0,W,R,1,R,-4],ct=class extends p{constructor(t){super(t,2)}},V={};V[336783863]=[0,S,R,-1,W,[0,[1,2,3,4,5,6,7,8,9],x,Ao,x,vo,x,bo,x,Eo,x,_o,x,[0,S,-2],x,[0,S,ot],x,wo,x,[0,ot,-1,R]],[0,S],R,[0,[1,3],[2,4],x,[0,Ze],-1,x,[0,Y],-1,K,[0,S,-1]],S];var Dr=[0,Kn,-1,Jt,-3,Kn,Ze,Dt,ae,Kn,-1,Jt,ae,Jt,-2,Dt];function M(t,e){An(t,3,e)}function w(t,e){An(t,4,e)}var Q=class extends p{constructor(t){super(t,500)}o(t){return y(this,0,7,t)}},Ve=[-1,{}],Ur=[0,S,1,Ve],Vr=[0,S,Y,Ve];function gt(t,e){xs(t,1,Q,e)}function P(t,e){An(t,10,e)}function E(t,e){An(t,15,e)}var ht=class extends p{constructor(t){super(t,500)}o(t){return y(this,0,1001,t)}},ko=[-500,K,[-500,Dt,-1,Y,-3,[-2,V,R],K,Nr,ae,-1,Ur,Vr,K,[0,Dt,Jt],Dt,Dr,ae,Y,987,Y],4,K,[-500,S,-1,[-1,{}],998,S],K,[-500,S,Y,-1,[-2,{},R],997,Y,-1],ae,K,[-500,S,Y,Ve,998,Y],Y,ae,Ur,Vr,K,[0,Dt,-1,Ve],Y,-2,Dr,Dt,-1,Jt,[0,Jt,_2],978,Ve,K,Nr];ht.prototype.g=On(ko);var A2=jt(ht,ko),E2=class extends p{constructor(t){super(t)}},So=class extends p{constructor(t){super(t)}g(){return Ot(this,E2,1)}},Lo=[0,K,[0,W,B,S,-1]],xn=jt(So,Lo),k2=class extends p{constructor(t){super(t)}},S2=class extends p{constructor(t){super(t)}},qn=class extends p{constructor(t){super(t)}l(){return A(this,k2,2)}g(){return Ot(this,S2,5)}},To=jt(class extends p{constructor(t){super(t)}},[0,Y,Ze,qs,[0,ot,[0,W,-3],[0,B,-3],[0,W,-1,[0,K,[0,W,-2]]],K,[0,B,-1,S,B]],S,-1,Gt,K,[0,W,B],Y,Gt]),Mo=class extends p{constructor(t){super(t)}},he=jt(class extends p{constructor(t){super(t)}},[0,K,[0,B,-4]]),Fo=class extends p{constructor(t){super(t)}},tn=jt(class extends p{constructor(t){super(t)}},[0,K,[0,B,-4]]),L2=class extends p{constructor(t){super(t)}},T2=[0,W,-1,qs,ot],Io=class extends p{constructor(t){super(t)}};Io.prototype.g=On([0,B,-4,Gt]);var M2=class extends p{constructor(t){super(t)}},F2=jt(class extends p{constructor(t){super(t)}},[0,K,[0,1,W,S,Lo],Gt]),Gr=class extends p{constructor(t){super(t)}},I2=class extends p{constructor(t){super(t)}na(){const t=T(this,1,void 0,void 0,Bi);return t??Qt()}},P2=class extends p{constructor(t){super(t)}},Po=[1,2],O2=jt(class extends p{constructor(t){super(t)}},[0,K,[0,Po,x,[0,qs],x,[0,yo],W,S],Gt]),zs=class extends p{constructor(t){super(t)}},Oo=[0,S,W,B,Y,-1],jr=class extends p{constructor(t){super(t)}},x2=[0,R,-1],Hr=class extends p{constructor(t){super(t)}},an=[1,2,3,4,5,6],pn=class extends p{constructor(t){super(t)}g(){return T(this,1,void 0,void 0,Bi)!=null}l(){return z(T(this,2))!=null}},O=class extends p{constructor(t){super(t)}g(){return Ti(T(this,2))??!1}},xo=[0,yo,S,[0,W,Gt,-1],[0,m2,Gt]],D=[0,xo,R,[0,an,x,Eo,x,vo,x,_o,x,Ao,x,bo,x,wo],ot],Nn=class extends p{constructor(t){super(t)}},Ys=[0,D,B,-1,W],N2=Tt(502141897,Nn);V[502141897]=Ys;var R2=jt(class extends p{constructor(t){super(t)}},[0,[0,ot,-1,p2,y2],T2]),No=class extends p{constructor(t){super(t)}},Ro=class extends p{constructor(t){super(t)}},rs=[0,D,B,[0,D],R],C2=Tt(508968150,Ro);V[508968150]=[0,D,Ys,rs,B,[0,[0,xo]]],V[508968149]=rs;var oe=class extends p{constructor(t){super(t)}l(){return A(this,zs,2)}g(){k(this,2)}},Co=[0,D,Oo];V[478825465]=Co;var B2=class extends p{constructor(t){super(t)}},Bo=class extends p{constructor(t){super(t)}},Xs=class extends p{constructor(t){super(t)}},$s=class extends p{constructor(t){super(t)}},Do=class extends p{constructor(t){super(t)}},Kr=[0,D,[0,D],Co,-1],Uo=[0,D,B,W],Js=[0,D,B],Vo=[0,D,Uo,Js,B],D2=Tt(479097054,Do);V[479097054]=[0,D,Vo,Kr],V[463370452]=Kr,V[464864288]=Uo;var U2=Tt(462713202,$s);V[462713202]=Vo,V[474472470]=Js;var V2=class extends p{constructor(t){super(t)}},Go=class extends p{constructor(t){super(t)}},jo=class extends p{constructor(t){super(t)}},Ho=class extends p{constructor(t){super(t)}},Qs=[0,D,B,-1,W],is=[0,D,B,R];Ho.prototype.g=On([0,D,Js,[0,D],Ys,rs,Qs,is]);var Ko=class extends p{constructor(t){super(t)}},G2=Tt(456383383,Ko);V[456383383]=[0,D,Oo];var Wo=class extends p{constructor(t){super(t)}},j2=Tt(476348187,Wo);V[476348187]=[0,D,x2];var qo=class extends p{constructor(t){super(t)}},Wr=class extends p{constructor(t){super(t)}},zo=[0,ot,-1],H2=Tt(458105876,class extends p{constructor(t){super(t)}g(){let t;var e=this.v;const n=0|e[d];return t=rt(this,n),e=function(s,r,i,o){var a=Wr;!o&&Te(s)&&(i=0|(r=s.v)[d]);var c=Pt(r,2);if(s=!1,c==null){if(o)return Sr();c=[]}else if(c.constructor===It){if(!(2&c.J)||o)return c;c=c.V()}else Array.isArray(c)?s=!!(2&(0|c[d])):c=[];if(o){if(!c.length)return Sr();s||(s=!0,Ye(c))}else s&&(s=!1,He(c),c=Di(c));return!s&&32&i&&ze(c,32),i=U(r,i,2,o=new It(c,a,Ha,void 0)),s||ne(r,i),o}(this,e,n,t),!t&&Wr&&(e.ra=!0),e}});V[458105876]=[0,zo,d2,[!0,Gt,[0,S,-1,Y]],[0,Ze,R,ot]];var Zs=class extends p{constructor(t){super(t)}},Yo=Tt(458105758,Zs);V[458105758]=[0,D,S,zo];var zn=class extends p{constructor(t){super(t)}},qr=[0,g2,-1,Jt],K2=class extends p{constructor(t){super(t)}},Xo=class extends p{constructor(t){super(t)}},os=[1,2];Xo.prototype.g=On([0,os,x,qr,x,[0,K,qr]]);var $o=class extends p{constructor(t){super(t)}},W2=Tt(443442058,$o);V[443442058]=[0,D,S,W,B,Y,-1,R,B],V[514774813]=Qs;var Jo=class extends p{constructor(t){super(t)}},q2=Tt(516587230,Jo);function as(t,e){return e=e?e.clone():new zs,t.displayNamesLocale!==void 0?k(e,1,Je(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?un(e,4,t.categoryAllowlist):"categoryAllowlist"in t&&k(e,4),t.categoryDenylist!==void 0?un(e,5,t.categoryDenylist):"categoryDenylist"in t&&k(e,5),e}function Qo(t){const e=Number(t);return Number.isSafeInteger(e)?e:String(t)}function tr(t,e=-1,n=""){return{categories:t.map(s=>({index:dt(s,1)??0??-1,score:N(s,2)??0,categoryName:z(T(s,3))??""??"",displayName:z(T(s,4))??""??""})),headIndex:e,headName:n}}function z2(t){const e={classifications:Ot(t,M2,1).map(n=>{var s;return tr(((s=A(n,So,4))==null?void 0:s.g())??[],dt(n,2)??0,z(T(n,3))??"")})};return function(n){return ja(gs?T(n,2,void 0,void 0,cn):T(n,2))}(t)!=null&&(e.timestampMs=Qo(Hi(t))),e}function Zo(t){var o,a;var e=qt(t,3,At,Wt()),n=qt(t,2,Se,Wt()),s=qt(t,1,z,Wt()),r=qt(t,9,z,Wt());const i={categories:[],keypoints:[]};for(let c=0;c<e.length;c++)i.categories.push({score:e[c],index:n[c]??-1,categoryName:s[c]??"",displayName:r[c]??""});if((e=(o=A(t,qn,4))==null?void 0:o.l())&&(i.boundingBox={originX:dt(e,1,Rt)??0,originY:dt(e,2,Rt)??0,width:dt(e,3,Rt)??0,height:dt(e,4,Rt)??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:T(c,1,void 0,Rt,At)??0,y:T(c,2,void 0,Rt,At)??0,score:T(c,4,void 0,Rt,At)??0,label:z(T(c,3,void 0,Rt))??""});return i}function Rn(t){const e=[];for(const n of Ot(t,Fo,1))e.push({x:N(n,1)??0,y:N(n,2)??0,z:N(n,3)??0,visibility:N(n,4)??0});return e}function Ge(t){const e=[];for(const n of Ot(t,Mo,1))e.push({x:N(n,1)??0,y:N(n,2)??0,z:N(n,3)??0,visibility:N(n,4)??0});return e}function zr(t){return Array.from(t,e=>e>127?e-256:e)}function Yr(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,s=0,r=0;for(let i=0;i<t.length;i++)n+=t[i]*e[i],s+=t[i]*t[i],r+=e[i]*e[i];if(s<=0||r<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return n/Math.sqrt(s*r)}let nn;V[516587230]=[0,D,Qs,is,B],V[518928384]=is;const Y2=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 ta(){if(nn===void 0)try{await WebAssembly.instantiate(Y2),nn=!0}catch{nn=!1}return nn}async function Ce(t,e=w2``){const n=await ta()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${e}/${t}_${n}.js`,wasmBinaryPath:`${e}/${t}_${n}.wasm`}}var Kt=class{};function ea(){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 Xr(t){if(typeof importScripts!="function"){const e=document.createElement("script");return e.src=t.toString(),e.crossOrigin="anonymous",new Promise((n,s)=>{e.addEventListener("load",()=>{n()},!1),e.addEventListener("error",r=>{s(r)},!1),document.body.appendChild(e)})}try{importScripts(t.toString())}catch(e){if(!(e instanceof TypeError))throw e;await self.import(t.toString())}}function na(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 $r(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[s,r]=na(e);return!t.l||s===t.i.canvas.width&&r===t.i.canvas.height||(t.i.canvas.width=s,t.i.canvas.height=r),[s,r]}function Jr(t,e,n){t.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const s=new Uint32Array(e.length);for(let r=0;r<e.length;r++)s[r]=t.i.stringToNewUTF8(e[r]);e=t.i._malloc(4*s.length),t.i.HEAPU32.set(s,e>>2),n(e);for(const r of s)t.i._free(r);t.i._free(e)}function wt(t,e,n){t.i.simpleListeners=t.i.simpleListeners||{},t.i.simpleListeners[e]=n}function Ct(t,e,n){let s=[];t.i.simpleListeners=t.i.simpleListeners||{},t.i.simpleListeners[e]=(r,i,o)=>{i?(n(s,o),s=[]):s.push(r)}}Kt.forVisionTasks=function(t){return Ce("vision",t)},Kt.forTextTasks=function(t){return Ce("text",t)},Kt.forGenAiExperimentalTasks=function(t){return Ce("genai_experimental",t)},Kt.forGenAiTasks=function(t){return Ce("genai",t)},Kt.forAudioTasks=function(t){return Ce("audio",t)},Kt.isSimdSupported=function(){return ta()};async function X2(t,e,n,s){return t=await(async(r,i,o,a,c)=>{if(i&&await Xr(i),!self.ModuleFactory||o&&(await Xr(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 r(c,a)})(t,n.wasmLoaderPath,n.assetLoaderPath,e,{locateFile:r=>r.endsWith(".wasm")?n.wasmBinaryPath.toString():n.assetBinaryPath&&r.endsWith(".data")?n.assetBinaryPath.toString():r}),await t.o(s),t}function Yn(t,e){const n=A(t.baseOptions,pn,1)||new pn;typeof e=="string"?(k(n,2,Je(e)),k(n,1)):e instanceof Uint8Array&&(k(n,1,_s(e,!1)),k(n,2)),y(t.baseOptions,0,1,n)}function Qr(t){try{const e=t.H.length;if(e===1)throw Error(t.H[0].message);if(e>1)throw Error("Encountered multiple errors: "+t.H.map(n=>n.message).join(", "))}finally{t.H=[]}}function l(t,e){t.C=Math.max(t.C,e)}function Cn(t,e){t.B=new Q,it(t.B,2,"PassThroughCalculator"),M(t.B,"free_memory"),w(t.B,"free_memory_unused_out"),P(e,"free_memory"),gt(e,t.B)}function ve(t,e){M(t.B,e),w(t.B,e+"_unused_out")}function Bn(t){t.g.addBoolToStream(!0,"free_memory",t.C)}var cs=class{constructor(t){this.g=t,this.H=[],this.C=0,this.g.setAutoRenderToScreen(!1)}l(t,e=!0){var n,s,r,i,o,a;if(e){const c=t.baseOptions||{};if((n=t.baseOptions)!=null&&n.modelAssetBuffer&&((s=t.baseOptions)!=null&&s.modelAssetPath))throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!((r=A(this.baseOptions,pn,1))!=null&&r.g()||(i=A(this.baseOptions,pn,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,Hr,3);if(!f){var _=f=new Hr,v=new Br;Ue(_,4,an,v)}"delegate"in h&&(h.delegate==="GPU"?(h=f,_=new b2,Ue(h,2,an,_)):(h=f,_=new Br,Ue(h,4,an,_))),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=A2(e)}),!t)throw Error("Failed to retrieve CalculatorGraphConfig");return t}setGraph(t,e){this.g.attachErrorListener((n,s)=>{this.H.push(Error(s))}),this.g.Ja(),this.g.setGraph(t,e),this.B=void 0,Qr(this)}finishProcessing(){this.g.finishProcessing(),Qr(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}cs.prototype.close=cs.prototype.close;class $2{constructor(e,n,s,r){this.g=e,this.h=n,this.m=s,this.l=r}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}}function Zr(t,e,n){const s=t.g;if(n=Ut(s.createShader(n),"Failed to create WebGL shader"),s.shaderSource(n,e),s.compileShader(n),!s.getShaderParameter(n,s.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${s.getShaderInfoLog(n)}`);return s.attachShader(t.h,n),n}function ti(t,e){const n=t.g,s=Ut(n.createVertexArray(),"Failed to create vertex array");n.bindVertexArray(s);const r=Ut(n.createBuffer(),"Failed to create buffer");n.bindBuffer(n.ARRAY_BUFFER,r),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 $2(n,s,r,i)}function er(t,e){if(t.g){if(e!==t.g)throw Error("Cannot change GL context once initialized")}else t.g=e}function J2(t,e,n,s){return er(t,e),t.h||(t.m(),t.D()),n?(t.u||(t.u=ti(t,!0)),n=t.u):(t.A||(t.A=ti(t,!1)),n=t.A),e.useProgram(t.h),n.bind(),t.l(),t=s(),n.g.bindVertexArray(null),t}function sa(t,e,n){return er(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 ra(t,e,n){er(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 Q2(t){var e;(e=t.g)==null||e.bindFramebuffer(t.g.FRAMEBUFFER,null)}var ia=class{H(){return`
|
|
2
|
-
precision mediump float;
|
|
3
|
-
varying vec2 vTex;
|
|
4
|
-
uniform sampler2D inputTexture;
|
|
5
|
-
void main() {
|
|
6
|
-
gl_FragColor = texture2D(inputTexture, vTex);
|
|
7
|
-
}
|
|
8
|
-
`}m(){const t=this.g;if(this.h=Ut(t.createProgram(),"Failed to create WebGL program"),this.X=Zr(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=Zr(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 Ft(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 hs(t){var e=Ft(t,1);if(!e){if(e=Ft(t,0))e=new Float32Array(e).map(s=>s/255);else{e=new Float32Array(t.width*t.height);const s=we(t);var n=nr(t);if(ra(n,s,oa(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),s.readPixels(0,0,t.width,t.height,s.RGBA,s.FLOAT,n);for(let r=0,i=0;r<e.length;++r,i+=4)e[r]=n[i]}else s.readPixels(0,0,t.width,t.height,s.RED,s.FLOAT,e)}t.g.push(e)}return e}function oa(t){let e=Ft(t,2);if(!e){const n=we(t);e=ca(t);const s=hs(t),r=aa(t);n.texImage2D(n.TEXTURE_2D,0,r,t.width,t.height,0,n.RED,n.FLOAT,s),us(t)}return e}function we(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 aa(t){if(t=we(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 nr(t){return t.l||(t.l=new ia),t.l}function ca(t){const e=we(t);e.viewport(0,0,t.width,t.height),e.activeTexture(e.TEXTURE0);let n=Ft(t,2);return n||(n=sa(nr(t),e,t.m?e.LINEAR:e.NEAREST),t.g.push(n),t.j=!0),e.bindTexture(e.TEXTURE_2D,n),n}function us(t){t.h.bindTexture(t.h.TEXTURE_2D,null)}var sn,H=class{constructor(t,e,n,s,r,i,o){this.g=t,this.m=e,this.j=n,this.canvas=s,this.l=r,this.width=i,this.height=o,this.j&&--ei===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Fa(){return!!Ft(this,0)}ka(){return!!Ft(this,1)}R(){return!!Ft(this,2)}ja(){return(e=Ft(t=this,0))||(e=hs(t),e=new Uint8Array(e.map(n=>Math.round(255*n))),t.g.push(e)),e;var t,e}ia(){return hs(this)}N(){return oa(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 s=we(this),r=nr(this);s.activeTexture(s.TEXTURE1),n=sa(r,s,this.m?s.LINEAR:s.NEAREST),s.bindTexture(s.TEXTURE_2D,n);const i=aa(this);s.texImage2D(s.TEXTURE_2D,0,i,this.width,this.height,0,s.RED,s.FLOAT,null),s.bindTexture(s.TEXTURE_2D,null),ra(r,s,n),J2(r,s,!1,()=>{ca(this),s.clearColor(0,0,0,0),s.clear(s.COLOR_BUFFER_BIT),s.drawArrays(s.TRIANGLE_FAN,0,4),us(this)}),Q2(r),us(this)}}t.push(n)}return new H(t,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&we(this).deleteTexture(Ft(this,2)),ei=-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 ei=250;function yt(...t){return t.map(([e,n])=>({start:e,end:n}))}const Z2=function(t){return class extends t{Ja(){this.i._registerModelResourcesGraphService()}}}((ni=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:ea()?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,s=this.i._malloc(n);this.i.HEAPU8.set(t,s),e?this.i._changeBinaryGraph(n,s):this.i._changeTextGraph(n,s),this.i._free(s)}configureAudio(t,e,n,s,r){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),g(this,s||"input_audio",i=>{g(this,r=r||"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,s,r){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,s,o=>{this.i._addAudioToInputStream(this.g,e,n,o,r)})}addGpuBufferToStream(t,e,n){g(this,e,s=>{const[r,i]=$r(this,t,s);this.i._addBoundTextureToStream(s,r,i,n)})}addBoolToStream(t,e,n){g(this,e,s=>{this.i._addBoolToInputStream(t,s,n)})}addDoubleToStream(t,e,n){g(this,e,s=>{this.i._addDoubleToInputStream(t,s,n)})}addFloatToStream(t,e,n){g(this,e,s=>{this.i._addFloatToInputStream(t,s,n)})}addIntToStream(t,e,n){g(this,e,s=>{this.i._addIntToInputStream(t,s,n)})}addUintToStream(t,e,n){g(this,e,s=>{this.i._addUintToInputStream(t,s,n)})}addStringToStream(t,e,n){g(this,e,s=>{g(this,t,r=>{this.i._addStringToInputStream(r,s,n)})})}addStringRecordToStream(t,e,n){g(this,e,s=>{Jr(this,Object.keys(t),r=>{Jr(this,Object.values(t),i=>{this.i._addFlatHashMapToInputStream(r,i,Object.keys(t).length,s,n)})})})}addProtoToStream(t,e,n,s){g(this,n,r=>{g(this,e,i=>{const o=this.i._malloc(t.length);this.i.HEAPU8.set(t,o),this.i._addProtoToInputStream(o,t.length,i,r,s),this.i._free(o)})})}addEmptyPacketToStream(t,e){g(this,t,n=>{this.i._addEmptyPacketToInputStream(n,e)})}addBoolVectorToStream(t,e,n){g(this,e,s=>{const r=this.i._allocateBoolVector(t.length);if(!r)throw Error("Unable to allocate new bool vector on heap.");for(const i of t)this.i._addBoolVectorEntry(r,i);this.i._addBoolVectorToInputStream(r,s,n)})}addDoubleVectorToStream(t,e,n){g(this,e,s=>{const r=this.i._allocateDoubleVector(t.length);if(!r)throw Error("Unable to allocate new double vector on heap.");for(const i of t)this.i._addDoubleVectorEntry(r,i);this.i._addDoubleVectorToInputStream(r,s,n)})}addFloatVectorToStream(t,e,n){g(this,e,s=>{const r=this.i._allocateFloatVector(t.length);if(!r)throw Error("Unable to allocate new float vector on heap.");for(const i of t)this.i._addFloatVectorEntry(r,i);this.i._addFloatVectorToInputStream(r,s,n)})}addIntVectorToStream(t,e,n){g(this,e,s=>{const r=this.i._allocateIntVector(t.length);if(!r)throw Error("Unable to allocate new int vector on heap.");for(const i of t)this.i._addIntVectorEntry(r,i);this.i._addIntVectorToInputStream(r,s,n)})}addUintVectorToStream(t,e,n){g(this,e,s=>{const r=this.i._allocateUintVector(t.length);if(!r)throw Error("Unable to allocate new unsigned int vector on heap.");for(const i of t)this.i._addUintVectorEntry(r,i);this.i._addUintVectorToInputStream(r,s,n)})}addStringVectorToStream(t,e,n){g(this,e,s=>{const r=this.i._allocateStringVector(t.length);if(!r)throw Error("Unable to allocate new string vector on heap.");for(const i of t)g(this,i,o=>{this.i._addStringVectorEntry(r,o)});this.i._addStringVectorToInputStream(r,s,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,s=>{this.i._addStringToInputSidePacket(s,n)})})}addProtoToInputSidePacket(t,e,n){g(this,n,s=>{g(this,e,r=>{const i=this.i._malloc(t.length);this.i.HEAPU8.set(t,i),this.i._addProtoToInputSidePacket(i,t.length,r,s),this.i._free(i)})})}addBoolVectorToInputSidePacket(t,e){g(this,e,n=>{const s=this.i._allocateBoolVector(t.length);if(!s)throw Error("Unable to allocate new bool vector on heap.");for(const r of t)this.i._addBoolVectorEntry(s,r);this.i._addBoolVectorToInputSidePacket(s,n)})}addDoubleVectorToInputSidePacket(t,e){g(this,e,n=>{const s=this.i._allocateDoubleVector(t.length);if(!s)throw Error("Unable to allocate new double vector on heap.");for(const r of t)this.i._addDoubleVectorEntry(s,r);this.i._addDoubleVectorToInputSidePacket(s,n)})}addFloatVectorToInputSidePacket(t,e){g(this,e,n=>{const s=this.i._allocateFloatVector(t.length);if(!s)throw Error("Unable to allocate new float vector on heap.");for(const r of t)this.i._addFloatVectorEntry(s,r);this.i._addFloatVectorToInputSidePacket(s,n)})}addIntVectorToInputSidePacket(t,e){g(this,e,n=>{const s=this.i._allocateIntVector(t.length);if(!s)throw Error("Unable to allocate new int vector on heap.");for(const r of t)this.i._addIntVectorEntry(s,r);this.i._addIntVectorToInputSidePacket(s,n)})}addUintVectorToInputSidePacket(t,e){g(this,e,n=>{const s=this.i._allocateUintVector(t.length);if(!s)throw Error("Unable to allocate new unsigned int vector on heap.");for(const r of t)this.i._addUintVectorEntry(s,r);this.i._addUintVectorToInputSidePacket(s,n)})}addStringVectorToInputSidePacket(t,e){g(this,e,n=>{const s=this.i._allocateStringVector(t.length);if(!s)throw Error("Unable to allocate new string vector on heap.");for(const r of t)g(this,r,i=>{this.i._addStringVectorEntry(s,i)});this.i._addStringVectorToInputSidePacket(s,n)})}attachBoolListener(t,e){wt(this,t,e),g(this,t,n=>{this.i._attachBoolListener(n)})}attachBoolVectorListener(t,e){Ct(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){Ct(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){Ct(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){Ct(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){Ct(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){Ct(this,t,e),g(this,t,n=>{this.i._attachStringVectorListener(n)})}attachProtoListener(t,e,n){wt(this,t,e),g(this,t,s=>{this.i._attachProtoListener(s,n||!1)})}attachProtoVectorListener(t,e,n){Ct(this,t,e),g(this,t,s=>{this.i._attachProtoVectorListener(s,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,(s,r)=>{s=new Float32Array(s.buffer,s.byteOffset,s.length/4),e(s,r)}),g(this,t,s=>{this.i._attachAudioListener(s,n||!1)})}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends ni{get ga(){return this.i}pa(t,e,n){g(this,e,s=>{const[r,i]=$r(this,t,s);this.ga._addBoundTextureAsImageToStream(s,r,i,n)})}Z(t,e){wt(this,t,e),g(this,t,n=>{this.ga._attachImageListener(n)})}aa(t,e){Ct(this,t,e),g(this,t,n=>{this.ga._attachImageVectorListener(n)})}}));var ni,_t=class extends Z2{};async function b(t,e,n){return async function(s,r,i,o){return X2(s,r,i,o)}(t,n.canvas??(ea()?void 0:document.createElement("canvas")),e,n)}function ha(t,e,n,s){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 r=n.regionOfInterest;if(r.left>=r.right||r.top>=r.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(r.left<0||r.top<0||r.right>1||r.bottom>1)throw Error("Expected RectF values to be in [0,1].");m(i,1,(r.left+r.right)/2),m(i,2,(r.top+r.bottom)/2),m(i,4,r.right-r.left),m(i,3,r.bottom-r.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]=na(e);n=N(i,3)*a/o,r=N(i,4)*o/a,m(i,4,n),m(i,3,r)}}t.g.addProtoToStream(i.g(),"mediapipe.NormalizedRect",t.U,s)}t.g.pa(e,t.X,s??performance.now()),t.finishProcessing()}function vt(t,e,n){var s;if((s=t.baseOptions)!=null&&s.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");ha(t,e,n,t.C+1)}function Mt(t,e,n,s){var r;if(!((r=t.baseOptions)!=null&&r.g()))throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");ha(t,e,n,s)}function be(t,e,n,s){var r=e.data;const i=e.width,o=i*(e=e.height);if((r instanceof Uint8Array||r instanceof Float32Array)&&r.length!==o)throw Error("Unsupported channel count: "+r.length/o);return t=new H([r],n,!1,t.g.i.canvas,t.P,i,e),s?t.clone():t}var at=class extends cs{constructor(t,e,n,s){super(t),this.g=t,this.X=e,this.U=n,this.oa=s,this.P=new ia}l(t,e=!0){if("runningMode"in t&&k(this.baseOptions,2,We(!!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 Nn,0,1,e=new O),m(this.h,2,.5),m(this.h,3,.3)}get baseOptions(){return A(this.h,O,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:[]},Mt(this,t,n,e),this.j}m(){var t=new ht;P(t,"image_in"),P(t,"norm_rect_in"),E(t,"detections");const e=new ct;Lt(e,N2,this.h);const n=new Q;it(n,2,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),M(n,"IMAGE:image_in"),M(n,"NORM_RECT:norm_rect_in"),w(n,"DETECTIONS:detections"),n.o(e),gt(t,n),this.g.attachProtoVectorListener("detections",(s,r)=>{for(const i of s)s=To(i),this.j.detections.push(Zo(s));l(this,r)}),this.g.attachEmptyPacketListener("detections",s=>{l(this,s)}),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 sr=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]),rr=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]),ir=yt([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),ua=yt([474,475],[475,476],[476,477],[477,474]),or=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]),ar=yt([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),la=yt([469,470],[470,471],[471,472],[472,469]),cr=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]),fa=[...sr,...rr,...ir,...or,...ar,...cr],da=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 F=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 Ro,0,1,e=new O),this.A=new No,y(this.h,0,3,this.A),this.u=new Nn,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,O,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),Mt(this,t,n,e),this.j}m(){var t=new ht;P(t,"image_in"),P(t,"norm_rect"),E(t,"face_landmarks");const e=new ct;Lt(e,C2,this.h);const n=new Q;it(n,2,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),M(n,"IMAGE:image_in"),M(n,"NORM_RECT:norm_rect"),w(n,"NORM_LANDMARKS:face_landmarks"),n.o(e),gt(t,n),this.g.attachProtoVectorListener("face_landmarks",(s,r)=>{for(const i of s)s=tn(i),this.j.faceLandmarks.push(Rn(s));l(this,r)}),this.g.attachEmptyPacketListener("face_landmarks",s=>{l(this,s)}),this.outputFaceBlendshapes&&(E(t,"blendshapes"),w(n,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",(s,r)=>{if(this.outputFaceBlendshapes)for(const i of s)s=xn(i),this.j.faceBlendshapes.push(tr(s.g()??[]));l(this,r)}),this.g.attachEmptyPacketListener("blendshapes",s=>{l(this,s)})),this.outputFacialTransformationMatrixes&&(E(t,"face_geometry"),w(n,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",(s,r)=>{if(this.outputFacialTransformationMatrixes)for(const i of s)(s=A(s=R2(i),L2,2))&&this.j.facialTransformationMatrixes.push({rows:dt(s,1)??0??0,columns:dt(s,2)??0??0,data:qt(s,3,At,Wt()).slice()??[]});l(this,r)}),this.g.attachEmptyPacketListener("face_geometry",s=>{l(this,s)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};F.prototype.detectForVideo=F.prototype.G,F.prototype.detect=F.prototype.F,F.prototype.setOptions=F.prototype.o,F.createFromModelPath=function(t,e){return b(F,t,{baseOptions:{modelAssetPath:e}})},F.createFromModelBuffer=function(t,e){return b(F,t,{baseOptions:{modelAssetBuffer:e}})},F.createFromOptions=function(t,e){return b(F,t,e)},F.FACE_LANDMARKS_LIPS=sr,F.FACE_LANDMARKS_LEFT_EYE=rr,F.FACE_LANDMARKS_LEFT_EYEBROW=ir,F.FACE_LANDMARKS_LEFT_IRIS=ua,F.FACE_LANDMARKS_RIGHT_EYE=or,F.FACE_LANDMARKS_RIGHT_EYEBROW=ar,F.FACE_LANDMARKS_RIGHT_IRIS=la,F.FACE_LANDMARKS_FACE_OVAL=cr,F.FACE_LANDMARKS_CONTOURS=fa,F.FACE_LANDMARKS_TESSELATION=da;var hr=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 ri(t){t.gestures=[],t.landmarks=[],t.worldLandmarks=[],t.handedness=[]}function ii(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 oi(t,e=!0){const n=[];for(const r of t){var s=xn(r);t=[];for(const i of s.g())s=e&&dt(i,1)!=null?dt(i,1)??0:-1,t.push({score:N(i,2)??0,index:s,categoryName:z(T(i,3))??""??"",displayName:z(T(i,4))??""??""});n.push(t)}return n}var Z=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 Do,0,1,e=new O),this.u=new $s,y(this.j,0,2,this.u),this.D=new Xs,y(this.u,0,3,this.D),this.A=new Bo,y(this.u,0,2,this.A),this.h=new B2,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,O,1)}set baseOptions(t){y(this.j,0,1,t)}o(t){var r,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 oe,n=e,s=as(t.cannedGesturesClassifierOptions,(r=A(this.h,oe,3))==null?void 0:r.l());y(n,0,2,s),y(this.h,0,3,e)}else t.cannedGesturesClassifierOptions===void 0&&((i=A(this.h,oe,3))==null||i.g());return t.customGesturesClassifierOptions?(y(n=e=new oe,0,2,s=as(t.customGesturesClassifierOptions,(o=A(this.h,oe,4))==null?void 0:o.l())),y(this.h,0,4,e)):t.customGesturesClassifierOptions===void 0&&((a=A(this.h,oe,4))==null||a.g()),this.l(t)}Ha(t,e){return ri(this),vt(this,t,e),ii(this)}Ia(t,e,n){return ri(this),Mt(this,t,n,e),ii(this)}m(){var t=new ht;P(t,"image_in"),P(t,"norm_rect"),E(t,"hand_gestures"),E(t,"hand_landmarks"),E(t,"world_hand_landmarks"),E(t,"handedness");const e=new ct;Lt(e,D2,this.j);const n=new Q;it(n,2,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),M(n,"IMAGE:image_in"),M(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",(s,r)=>{for(const i of s){s=tn(i);const o=[];for(const a of Ot(s,Fo,1))o.push({x:N(a,1)??0,y:N(a,2)??0,z:N(a,3)??0,visibility:N(a,4)??0});this.landmarks.push(o)}l(this,r)}),this.g.attachEmptyPacketListener("hand_landmarks",s=>{l(this,s)}),this.g.attachProtoVectorListener("world_hand_landmarks",(s,r)=>{for(const i of s){s=he(i);const o=[];for(const a of Ot(s,Mo,1))o.push({x:N(a,1)??0,y:N(a,2)??0,z:N(a,3)??0,visibility:N(a,4)??0});this.worldLandmarks.push(o)}l(this,r)}),this.g.attachEmptyPacketListener("world_hand_landmarks",s=>{l(this,s)}),this.g.attachProtoVectorListener("hand_gestures",(s,r)=>{this.gestures.push(...oi(s,!1)),l(this,r)}),this.g.attachEmptyPacketListener("hand_gestures",s=>{l(this,s)}),this.g.attachProtoVectorListener("handedness",(s,r)=>{this.handedness.push(...oi(s)),l(this,r)}),this.g.attachEmptyPacketListener("handedness",s=>{l(this,s)}),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};function ai(t){return{landmarks:t.landmarks,worldLandmarks:t.worldLandmarks,handednesses:t.handedness,handedness:t.handedness}}Z.prototype.recognizeForVideo=Z.prototype.Ia,Z.prototype.recognize=Z.prototype.Ha,Z.prototype.setOptions=Z.prototype.o,Z.createFromModelPath=function(t,e){return b(Z,t,{baseOptions:{modelAssetPath:e}})},Z.createFromModelBuffer=function(t,e){return b(Z,t,{baseOptions:{modelAssetBuffer:e}})},Z.createFromOptions=function(t,e){return b(Z,t,e)},Z.HAND_CONNECTIONS=hr;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 $s,0,1,e=new O),this.u=new Xs,y(this.h,0,3,this.u),this.j=new Bo,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,O,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),ai(this)}G(t,e,n){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Mt(this,t,n,e),ai(this)}m(){var t=new ht;P(t,"image_in"),P(t,"norm_rect"),E(t,"hand_landmarks"),E(t,"world_hand_landmarks"),E(t,"handedness");const e=new ct;Lt(e,U2,this.h);const n=new Q;it(n,2,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),M(n,"IMAGE:image_in"),M(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",(s,r)=>{for(const i of s)s=tn(i),this.landmarks.push(Rn(s));l(this,r)}),this.g.attachEmptyPacketListener("hand_landmarks",s=>{l(this,s)}),this.g.attachProtoVectorListener("world_hand_landmarks",(s,r)=>{for(const i of s)s=he(i),this.worldLandmarks.push(Ge(s));l(this,r)}),this.g.attachEmptyPacketListener("world_hand_landmarks",s=>{l(this,s)}),this.g.attachProtoVectorListener("handedness",(s,r)=>{var i=this.handedness,o=i.push;const a=[];for(const c of s){s=xn(c);const u=[];for(const h of s.g())u.push({score:N(h,2)??0,index:dt(h,1)??0??-1,categoryName:z(T(h,3))??""??"",displayName:z(T(h,4))??""??""});a.push(u)}o.call(i,...a),l(this,r)}),this.g.attachEmptyPacketListener("handedness",s=>{l(this,s)}),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=hr;var pa=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 ci(t){t.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function hi(t){try{if(!t.D)return t.h;t.D(t.h)}finally{Bn(t)}}function rn(t,e){t=tn(t),e.push(Rn(t))}var L=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 Ho,0,1,e=new O),this.I=new Xs,y(this.j,0,2,this.I),this.W=new V2,y(this.j,0,3,this.W),this.u=new Nn,y(this.j,0,4,this.u),this.O=new No,y(this.j,0,5,this.O),this.A=new Go,y(this.j,0,6,this.A),this.M=new jo,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,O,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 s=typeof e!="function"?e:{};return this.D=typeof e=="function"?e:n,ci(this),vt(this,t,s),hi(this)}G(t,e,n,s){const r=typeof n!="function"?n:{};return this.D=typeof n=="function"?n:s,ci(this),Mt(this,t,r,e),hi(this)}m(){var t=new ht;P(t,"input_frames_image"),E(t,"pose_landmarks"),E(t,"pose_world_landmarks"),E(t,"face_landmarks"),E(t,"left_hand_landmarks"),E(t,"left_hand_world_landmarks"),E(t,"right_hand_landmarks"),E(t,"right_hand_world_landmarks");const e=new ct,n=new xr;it(n,1,"type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),function(r,i){if(i!=null)if(Array.isArray(i))k(r,2,bn(i,0,qe));else{if(!(typeof i=="string"||i instanceof Et||ms(i)))throw Error("invalid value in Any.value field: "+i+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");Bt(r,2,_s(i,!1),Qt())}}(n,this.j.g());const s=new Q;it(s,2,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),xs(s,8,xr,n),M(s,"IMAGE:input_frames_image"),w(s,"POSE_LANDMARKS:pose_landmarks"),w(s,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),w(s,"FACE_LANDMARKS:face_landmarks"),w(s,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),w(s,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),w(s,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),w(s,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),s.o(e),gt(t,s),Cn(this,t),this.g.attachProtoListener("pose_landmarks",(r,i)=>{rn(r,this.h.poseLandmarks),l(this,i)}),this.g.attachEmptyPacketListener("pose_landmarks",r=>{l(this,r)}),this.g.attachProtoListener("pose_world_landmarks",(r,i)=>{var o=this.h.poseWorldLandmarks;r=he(r),o.push(Ge(r)),l(this,i)}),this.g.attachEmptyPacketListener("pose_world_landmarks",r=>{l(this,r)}),this.outputPoseSegmentationMasks&&(w(s,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),ve(this,"pose_segmentation_mask"),this.g.Z("pose_segmentation_mask",(r,i)=>{this.h.poseSegmentationMasks=[be(this,r,!0,!this.D)],l(this,i)}),this.g.attachEmptyPacketListener("pose_segmentation_mask",r=>{this.h.poseSegmentationMasks=[],l(this,r)})),this.g.attachProtoListener("face_landmarks",(r,i)=>{rn(r,this.h.faceLandmarks),l(this,i)}),this.g.attachEmptyPacketListener("face_landmarks",r=>{l(this,r)}),this.outputFaceBlendshapes&&(E(t,"extra_blendshapes"),w(s,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",(r,i)=>{var o=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(r=xn(r),o.push(tr(r.g()??[]))),l(this,i)}),this.g.attachEmptyPacketListener("extra_blendshapes",r=>{l(this,r)})),this.g.attachProtoListener("left_hand_landmarks",(r,i)=>{rn(r,this.h.leftHandLandmarks),l(this,i)}),this.g.attachEmptyPacketListener("left_hand_landmarks",r=>{l(this,r)}),this.g.attachProtoListener("left_hand_world_landmarks",(r,i)=>{var o=this.h.leftHandWorldLandmarks;r=he(r),o.push(Ge(r)),l(this,i)}),this.g.attachEmptyPacketListener("left_hand_world_landmarks",r=>{l(this,r)}),this.g.attachProtoListener("right_hand_landmarks",(r,i)=>{rn(r,this.h.rightHandLandmarks),l(this,i)}),this.g.attachEmptyPacketListener("right_hand_landmarks",r=>{l(this,r)}),this.g.attachProtoListener("right_hand_world_landmarks",(r,i)=>{var o=this.h.rightHandWorldLandmarks;r=he(r),o.push(Ge(r)),l(this,i)}),this.g.attachEmptyPacketListener("right_hand_world_landmarks",r=>{l(this,r)}),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};L.prototype.detectForVideo=L.prototype.G,L.prototype.detect=L.prototype.F,L.prototype.setOptions=L.prototype.o,L.createFromModelPath=function(t,e){return b(L,t,{baseOptions:{modelAssetPath:e}})},L.createFromModelBuffer=function(t,e){return b(L,t,{baseOptions:{modelAssetBuffer:e}})},L.createFromOptions=function(t,e){return b(L,t,e)},L.HAND_CONNECTIONS=hr,L.POSE_CONNECTIONS=pa,L.FACE_LANDMARKS_LIPS=sr,L.FACE_LANDMARKS_LEFT_EYE=rr,L.FACE_LANDMARKS_LEFT_EYEBROW=ir,L.FACE_LANDMARKS_LEFT_IRIS=ua,L.FACE_LANDMARKS_RIGHT_EYE=or,L.FACE_LANDMARKS_RIGHT_EYEBROW=ar,L.FACE_LANDMARKS_RIGHT_IRIS=la,L.FACE_LANDMARKS_FACE_OVAL=cr,L.FACE_LANDMARKS_CONTOURS=fa,L.FACE_LANDMARKS_TESSELATION=da;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 Ko,0,1,e=new O)}get baseOptions(){return A(this.h,O,1)}set baseOptions(t){y(this.h,0,1,t)}o(t){return y(this.h,0,2,as(t,A(this.h,zs,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:[]},Mt(this,t,n,e),this.j}m(){var t=new ht;P(t,"input_image"),P(t,"norm_rect"),E(t,"classifications");const e=new ct;Lt(e,G2,this.h);const n=new Q;it(n,2,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),M(n,"IMAGE:input_image"),M(n,"NORM_RECT:norm_rect"),w(n,"CLASSIFICATIONS:classifications"),n.o(e),gt(t,n),this.g.attachProtoListener("classifications",(s,r)=>{this.j=z2(F2(s)),l(this,r)}),this.g.attachEmptyPacketListener("classifications",s=>{l(this,s)}),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 Wo,this.embeddings={embeddings:[]},y(t=this.h,0,1,e=new O)}get baseOptions(){return A(this.h,O,1)}set baseOptions(t){y(this.h,0,1,t)}o(t){var e=this.h,n=A(this.h,jr,2);return n=n?n.clone():new jr,t.l2Normalize!==void 0?k(n,1,We(t.l2Normalize)):"l2Normalize"in t&&k(n,1),t.quantize!==void 0?k(n,2,We(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 Mt(this,t,n,e),this.embeddings}m(){var t=new ht;P(t,"image_in"),P(t,"norm_rect"),E(t,"embeddings_out");const e=new ct;Lt(e,j2,this.h);const n=new Q;it(n,2,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),M(n,"IMAGE:image_in"),M(n,"NORM_RECT:norm_rect"),w(n,"EMBEDDINGS:embeddings_out"),n.o(e),gt(t,n),this.g.attachProtoListener("embeddings_out",(s,r)=>{s=O2(s),this.embeddings=function(i){return{embeddings:Ot(i,P2,1).map(o=>{var u,h;const a={headIndex:dt(o,3)??0??-1,headName:z(T(o,4))??""??""};var c=o.v;return Vi(c,0|c[d],Gr,Hn(o,1))!==void 0?(o=qt(o=A(o,Gr,Hn(o,1),void 0),1,At,Wt()),a.floatEmbedding=o.slice()):(c=new Uint8Array(0),a.quantizedEmbedding=((h=(u=A(o,I2,Hn(o,2),void 0))==null?void 0:u.na())==null?void 0:h.h())??c),a}),timestampMs:Qo(Hi(i))}}(s),l(this,r)}),this.g.attachEmptyPacketListener("embeddings_out",s=>{l(this,s)}),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};tt.cosineSimilarity=function(t,e){if(t.floatEmbedding&&e.floatEmbedding)t=Yr(t.floatEmbedding,e.floatEmbedding);else{if(!t.quantizedEmbedding||!e.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");t=Yr(zr(t.quantizedEmbedding),zr(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 ls=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 t1(t){var n,s;const e=function(r){return Ot(r,Q,1)}(t.ca()).filter(r=>(z(T(r,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&&(((s=(n=A(e[0],ct,7))==null?void 0:n.j())==null?void 0:s.g())??new Map).forEach((r,i)=>{t.u[Number(i)]=z(T(r,1))??""})}function ui(t){t.categoryMask=void 0,t.confidenceMasks=void 0,t.qualityScores=void 0}function li(t){try{const e=new ls(t.confidenceMasks,t.categoryMask,t.qualityScores);if(!t.j)return e;t.j(e)}finally{Bn(t)}}ls.prototype.close=ls.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 Zs,this.A=new qo,y(this.h,0,3,this.A),y(t=this.h,0,1,e=new O)}get baseOptions(){return A(this.h,O,1)}set baseOptions(t){y(this.h,0,1,t)}o(t){return t.displayNamesLocale!==void 0?k(this.h,2,Je(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(){t1(this)}segment(t,e,n){const s=typeof e!="function"?e:{};return this.j=typeof e=="function"?e:n,ui(this),vt(this,t,s),li(this)}La(t,e,n,s){const r=typeof n!="function"?n:{};return this.j=typeof n=="function"?n:s,ui(this),Mt(this,t,r,e),li(this)}Da(){return this.u}m(){var t=new ht;P(t,"image_in"),P(t,"norm_rect");const e=new ct;Lt(e,Yo,this.h);const n=new Q;it(n,2,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),M(n,"IMAGE:image_in"),M(n,"NORM_RECT:norm_rect"),n.o(e),gt(t,n),Cn(this,t),this.outputConfidenceMasks&&(E(t,"confidence_masks"),w(n,"CONFIDENCE_MASKS:confidence_masks"),ve(this,"confidence_masks"),this.g.aa("confidence_masks",(s,r)=>{this.confidenceMasks=s.map(i=>be(this,i,!0,!this.j)),l(this,r)}),this.g.attachEmptyPacketListener("confidence_masks",s=>{this.confidenceMasks=[],l(this,s)})),this.outputCategoryMask&&(E(t,"category_mask"),w(n,"CATEGORY_MASK:category_mask"),ve(this,"category_mask"),this.g.Z("category_mask",(s,r)=>{this.categoryMask=be(this,s,!1,!this.j),l(this,r)}),this.g.attachEmptyPacketListener("category_mask",s=>{this.categoryMask=void 0,l(this,s)})),E(t,"quality_scores"),w(n,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(s,r)=>{this.qualityScores=s,l(this,r)}),this.g.attachEmptyPacketListener("quality_scores",s=>{this.categoryMask=void 0,l(this,s)}),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 fs=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()}};fs.prototype.close=fs.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 Zs,this.u=new qo,y(this.h,0,3,this.u),y(t=this.h,0,1,e=new O)}get baseOptions(){return A(this.h,O,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,s){const r=typeof n!="function"?n:{};if(this.j=typeof n=="function"?n:s,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,n=this.C+1,s=new Xo,e.keypoint&&e.scribble)throw Error("Cannot provide both keypoint and scribble.");if(e.keypoint){var i=new zn;Bt(i,3,We(!0),!1),Bt(i,1,De(e.keypoint.x),0),Bt(i,2,De(e.keypoint.y),0),Ue(s,1,os,i)}else{if(!e.scribble)throw Error("Must provide either a keypoint or a scribble.");{const a=new K2;for(i of e.scribble)Bt(e=new zn,3,We(!0),!1),Bt(e,1,De(i.x),0),Bt(e,2,De(i.y),0),xs(a,1,zn,e);Ue(s,2,os,a)}}this.g.addProtoToStream(s.g(),"mediapipe.tasks.vision.interactive_segmenter.proto.RegionOfInterest","roi_in",n),vt(this,t,r);t:{try{const a=new fs(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var o=a;break t}this.j(a)}finally{Bn(this)}o=void 0}return o}m(){var t=new ht;P(t,"image_in"),P(t,"roi_in"),P(t,"norm_rect_in");const e=new ct;Lt(e,Yo,this.h);const n=new Q;it(n,2,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraphV2"),M(n,"IMAGE:image_in"),M(n,"ROI:roi_in"),M(n,"NORM_RECT:norm_rect_in"),n.o(e),gt(t,n),Cn(this,t),this.outputConfidenceMasks&&(E(t,"confidence_masks"),w(n,"CONFIDENCE_MASKS:confidence_masks"),ve(this,"confidence_masks"),this.g.aa("confidence_masks",(s,r)=>{this.confidenceMasks=s.map(i=>be(this,i,!0,!this.j)),l(this,r)}),this.g.attachEmptyPacketListener("confidence_masks",s=>{this.confidenceMasks=[],l(this,s)})),this.outputCategoryMask&&(E(t,"category_mask"),w(n,"CATEGORY_MASK:category_mask"),ve(this,"category_mask"),this.g.Z("category_mask",(s,r)=>{this.categoryMask=be(this,s,!1,!this.j),l(this,r)}),this.g.attachEmptyPacketListener("category_mask",s=>{this.categoryMask=void 0,l(this,s)})),E(t,"quality_scores"),w(n,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(s,r)=>{this.qualityScores=s,l(this,r)}),this.g.attachEmptyPacketListener("quality_scores",s=>{this.categoryMask=void 0,l(this,s)}),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 $o,0,1,e=new O)}get baseOptions(){return A(this.h,O,1)}set baseOptions(t){y(this.h,0,1,t)}o(t){return t.displayNamesLocale!==void 0?k(this.h,2,Je(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?un(this.h,5,t.categoryAllowlist):"categoryAllowlist"in t&&k(this.h,5),t.categoryDenylist!==void 0?un(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:[]},Mt(this,t,n,e),this.j}m(){var t=new ht;P(t,"input_frame_gpu"),P(t,"norm_rect"),E(t,"detections");const e=new ct;Lt(e,W2,this.h);const n=new Q;it(n,2,"mediapipe.tasks.vision.ObjectDetectorGraph"),M(n,"IMAGE:input_frame_gpu"),M(n,"NORM_RECT:norm_rect"),w(n,"DETECTIONS:detections"),n.o(e),gt(t,n),this.g.attachProtoVectorListener("detections",(s,r)=>{for(const i of s)s=To(i),this.j.detections.push(Zo(s));l(this,r)}),this.g.attachEmptyPacketListener("detections",s=>{l(this,s)}),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 ds=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 fi(t){t.landmarks=[],t.worldLandmarks=[],t.segmentationMasks=void 0}function di(t){try{const e=new ds(t.landmarks,t.worldLandmarks,t.segmentationMasks);if(!t.u)return e;t.u(e)}finally{Bn(t)}}ds.prototype.close=ds.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 Jo,0,1,e=new O),this.A=new jo,y(this.h,0,3,this.A),this.j=new Go,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,O,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 s=typeof e!="function"?e:{};return this.u=typeof e=="function"?e:n,fi(this),vt(this,t,s),di(this)}G(t,e,n,s){const r=typeof n!="function"?n:{};return this.u=typeof n=="function"?n:s,fi(this),Mt(this,t,r,e),di(this)}m(){var t=new ht;P(t,"image_in"),P(t,"norm_rect"),E(t,"normalized_landmarks"),E(t,"world_landmarks"),E(t,"segmentation_masks");const e=new ct;Lt(e,q2,this.h);const n=new Q;it(n,2,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),M(n,"IMAGE:image_in"),M(n,"NORM_RECT:norm_rect"),w(n,"NORM_LANDMARKS:normalized_landmarks"),w(n,"WORLD_LANDMARKS:world_landmarks"),n.o(e),gt(t,n),Cn(this,t),this.g.attachProtoVectorListener("normalized_landmarks",(s,r)=>{this.landmarks=[];for(const i of s)s=tn(i),this.landmarks.push(Rn(s));l(this,r)}),this.g.attachEmptyPacketListener("normalized_landmarks",s=>{this.landmarks=[],l(this,s)}),this.g.attachProtoVectorListener("world_landmarks",(s,r)=>{this.worldLandmarks=[];for(const i of s)s=he(i),this.worldLandmarks.push(Ge(s));l(this,r)}),this.g.attachEmptyPacketListener("world_landmarks",s=>{this.worldLandmarks=[],l(this,s)}),this.outputSegmentationMasks&&(w(n,"SEGMENTATION_MASK:segmentation_masks"),ve(this,"segmentation_masks"),this.g.aa("segmentation_masks",(s,r)=>{this.segmentationMasks=s.map(i=>be(this,i,!0,!this.u)),l(this,r)}),this.g.attachEmptyPacketListener("segmentation_masks",s=>{this.segmentationMasks=[],l(this,s)})),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=pa;class e1{constructor(e){this.models={face:null,hand:null},this.webcam=null,this.currentStepRef=0,this.isStepTransitioningRef=!1,this.timerId=null,this.requestId=null,this.heartbeatId=null,this.anchorRatios=null,this.lastNosePos=null,this.consecutiveMissingFrames=0,this.MAX_GAP=15,this.LIVENESS_LOCK_KEY="liveness_active_session",this.stabilityFrames=0,this.REQUIRED_STABILITY=10,this.offscreenCanvas=document.createElement("canvas"),this.CHALLENGE_POOL=["Smile","Blink","Turn_Head","Thumbs_Up"],this.attachVideo=n=>{this.webcam=n,console.log("[LivenessEngine] Video stream attached.")},this.start=()=>{const n=localStorage.getItem(this.LIVENESS_LOCK_KEY);if(n&&Date.now()-parseInt(n)<5e3){this.failInstantly("Another session is active.");return}if(this.heartbeatId=setInterval(()=>{localStorage.setItem(this.LIVENESS_LOCK_KEY,Date.now().toString())},1e3),this.state.status!=="ready"||!this.webcam){console.warn("[LivenessEngine] Engine not ready or video missing.");return}console.log("[LivenessEngine] Session Starting..."),this.state.status="capturing",this.updateState({status:"capturing"}),this.startTimer(),this.detectLoop()},this.stop=()=>{this.timerId&&clearInterval(this.timerId),this.heartbeatId&&clearInterval(this.heartbeatId),this.requestId&&cancelAnimationFrame(this.requestId),localStorage.removeItem(this.LIVENESS_LOCK_KEY),this.timerId=null,this.heartbeatId=null,this.requestId=null},this.reset=()=>{this.stop(),this.currentStepRef=0,this.isStepTransitioningRef=!1,this.anchorRatios=null,this.lastNosePos=null,this.consecutiveMissingFrames=0,this.stabilityFrames=0,this.generateSequence(),this.updateState({status:"ready",currentStep:0,timeLeft:this.config.duration,isStepTransitioning:!1,errorMsg:"",snapshots:[]})},this.detectLoop=()=>{var s,r;if(this.state.status!=="capturing"||!this.webcam||!this.models.face)return;const n=performance.now();try{const i=this.models.face.detectForVideo(this.webcam,n);if(i.faceLandmarks&&i.faceLandmarks.length>1){console.warn("[LivenessEngine] Security Alert: Multiple faces detected!"),this.failInstantly("Multiple faces detected. Please ensure only one person is in frame.");return}const o=(s=i.faceLandmarks)==null?void 0:s[0];if(o){if(this.consecutiveMissingFrames=0,this.anchorRatios===null)this.stabilityFrames++,this.stabilityFrames>=this.REQUIRED_STABILITY&&this.verifyIdentity(o);else if(!this.verifyIdentity(o)||!this.checkMovement(o)){this.failInstantly("Security violation: Identity mismatch.");return}const a=this.state.sequence[this.currentStepRef],c=(r=this.models.hand)==null?void 0:r.detectForVideo(this.webcam,n);if(this.checkAction(i,c,a)){this.handleStepSuccess(o);return}}else if(this.consecutiveMissingFrames++,this.consecutiveMissingFrames>this.MAX_GAP)return this.failInstantly("Face lost. Session reset.");this.requestId=requestAnimationFrame(this.detectLoop)}catch(i){console.error("[LivenessEngine] Loop detection error:",i),this.requestId=requestAnimationFrame(this.detectLoop)}},this.config={apiUrl:e.apiUrl,duration:e.duration??60,smileThreshold:e.smileThreshold??.2,blinkThreshold:e.blinkThreshold??.012,minturnHeadThreshold:e.minturnHeadThreshold??.15,maxturnHeadThreshold:e.maxturnHeadThreshold??.85,onStateChange:e.onStateChange||(()=>{}),onComplete:e.onComplete||(()=>{}),onError:e.onError||(()=>{})},this.state={status:"loading",sequence:[],currentStep:0,timeLeft:this.config.duration,isStepTransitioning:!1,errorMsg:"",snapshots:[]},this.offscreenCanvas.width=224,this.offscreenCanvas.height=224}async loadModels(){console.log("[LivenessEngine] Loading AI Models...");try{const e=await Kt.forVisionTasks("https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.3/wasm");this.models.face=await F.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"}),this.models.hand=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.generateSequence(),this.updateState({status:"ready"}),console.log("[LivenessEngine] Models Loaded.")}catch(e){console.error("[LivenessEngine] Init Error:",e),this.updateState({status:"error",errorMsg:"Failed to load security assets."})}}verifyIdentity(e){const n=Math.sqrt(Math.pow(e[33].x-e[263].x,2)+Math.pow(e[33].y-e[263].y,2)),s=Math.abs(e[1].y-e[13].y),r=n/(s||1);return this.anchorRatios===null?(this.anchorRatios=r,!0):Math.abs(this.anchorRatios-r)/this.anchorRatios<.5}checkMovement(e){const n={x:e[1].x,y:e[1].y};return this.lastNosePos&&Math.sqrt(Math.pow(n.x-this.lastNosePos.x,2)+Math.pow(n.y-this.lastNosePos.y,2))>.3?!1:(this.lastNosePos=n,!0)}failInstantly(e){this.stop(),this.updateState({status:"error",errorMsg:e,isStepTransitioning:!1}),this.config.onError({success:!1,reason:e})}updateState(e){this.state={...this.state,...e},this.config.onStateChange(this.state)}generateSequence(){const e=[...this.CHALLENGE_POOL].sort(()=>.5-Math.random()).slice(0,3);return this.state.sequence=e,e}startTimer(){this.timerId&&clearInterval(this.timerId),this.timerId=setInterval(()=>{this.state.timeLeft>0?this.updateState({timeLeft:this.state.timeLeft-1}):(this.stop(),this.updateState({status:"expired"}))},1e3)}handleStepSuccess(e){if(this.isStepTransitioningRef)return;this.isStepTransitioningRef=!0;const n=this.getFaceCrop(this.webcam,e),s={challenge:this.state.sequence[this.currentStepRef],image:n.toDataURL("image/jpeg",.7),timestamp:Date.now()},r=[...this.state.snapshots,s];this.updateState({isStepTransitioning:!0,snapshots:r}),setTimeout(()=>{this.state.status==="capturing"&&(this.currentStepRef<this.state.sequence.length-1?(this.currentStepRef++,this.isStepTransitioningRef=!1,this.updateState({currentStep:this.currentStepRef,isStepTransitioning:!1,snapshots:r}),this.requestId=requestAnimationFrame(this.detectLoop)):(this.updateState({snapshots:r}),this.sendFinalProof()))},1500)}checkAction(e,n,s){var r,i;if(this.isStepTransitioningRef)return!1;if(s==="Thumbs_Up"&&((r=n==null?void 0:n.landmarks)==null?void 0:r.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(s){case"Smile":return o[291].x-o[61].x>this.config.smileThreshold;case"Blink":const a=Math.abs(o[159].y-o[145].y),c=Math.abs(o[386].y-o[374].y);return(a+c)/2<this.config.blinkThreshold;case"Turn_Head":const u=(o[1].x-o[33].x)/(o[263].x-o[33].x);return u<this.config.minturnHeadThreshold||u>this.config.maxturnHeadThreshold;default:return!1}}return!1}async sendFinalProof(){var e,n;this.stop(),this.updateState({status:"verifying"});try{const s=[];let r="";for(let a=0;a<5&&this.webcam;a++){const c=(e=this.models.face)==null?void 0:e.detectForVideo(this.webcam,performance.now());if((n=c==null?void 0:c.faceLandmarks)!=null&&n[0]){const u=this.getFaceCrop(this.webcam,c.faceLandmarks[0]),h=await new Promise(f=>u.toBlob(f,"image/jpeg",.9));h&&s.push(h),a===4&&(r=u.toDataURL("image/jpeg"))}await new Promise(u=>setTimeout(u,100))}const{verifyLiveness:i}=await Promise.resolve().then(()=>require("./api-CWu5ff9j.cjs")),o=await i(this.config.apiUrl,s,this.state.sequence);if(o.is_live)this.updateState({status:"success"}),this.config.onComplete({success:!0,image:r,skinConfidence:o.skin_confidence});else{const a=o.reason||"Liveness check failed";this.updateState({status:"error",errorMsg:a}),this.config.onError({success:!1,reason:a})}}catch{this.updateState({status:"error",errorMsg:"Verification failed."}),this.config.onError({success:!1,reason:"Network error"})}}getFaceCrop(e,n){const s=this.offscreenCanvas.getContext("2d"),r=n.map(v=>v.x*e.videoWidth),i=n.map(v=>v.y*e.videoHeight),o=Math.min(...r),a=Math.max(...r),c=Math.min(...i),u=Math.max(...i),h=a-o,f=u-c,_=h*.3;return s.clearRect(0,0,224,224),s.drawImage(e,o-_,c-_,h+_*2,f+_*2,0,0,224,224),this.offscreenCanvas}}exports.LivenessEngine=e1;
|