(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=typeof self<`u`?self:{};function t(t,n){t:{for(var r=[`CLOSURE_FLAGS`],i=e,a=0;a>6|192;else{if(t>=55296&&t<=57343){if(t<=56319&&i=56320&&a<=57343){t=1024*(t-55296)+a-56320+65536,r[n++]=t>>18|240,r[n++]=t>>12&63|128,r[n++]=t>>6&63|128,r[n++]=63&t|128;continue}i--}t=65533}r[n++]=t>>12|224,r[n++]=t>>6&63|128}r[n++]=63&t|128}}e=n===r.length?r:r.subarray(0,n)}return e}function u(t){e.setTimeout((()=>{throw t}),0)}var d,ee=t(610401301,!1),te=t(748402147,!0);function ne(){var t=e.navigator;return(t&&=t.userAgent)?t:``}var re=e.navigator;function ie(e){return ie[` `](e),e}d=re&&re.userAgentData||null,ie[` `]=function(){};var ae={},oe=null;function se(e){let t=e.length,n=3*t/4;n%3?n=Math.floor(n):`=.`.indexOf(e[t-1])!=-1&&(n=`=.`.indexOf(e[t-2])==-1?n-1:n-2);let r=new Uint8Array(n),i=0;return function(e,t){function n(t){for(;r>4),i!=64&&(t(r<<4&240|i>>2),a!=64&&t(i<<6&192|a))}}(e,(function(e){r[i++]=e})),i===n?r:r.subarray(0,i)}function ce(){if(!oe){oe={};var e=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`.split(``),t=[`+/=`,`+/`,`-_=`,`-_.`,`-_`];for(let n=0;n<5;n++){let r=e.concat(t[n].split(``));ae[n]=r;for(let e=0;e0)&&(ne().indexOf(`Trident`)!=-1||ne().indexOf(`MSIE`)!=-1))&&typeof btoa==`function`,de=/[-_.]/g,fe={"-":`+`,_:`/`,".":`=`};function pe(e){return fe[e]||``}function me(e){if(!ue)return se(e);e=de.test(e)?e.replace(de,pe):e,e=atob(e);let t=new Uint8Array(e.length);for(let n=0;n=t||(n[e]=r+1,Ce(e=Error(),`incident`),u(e))}}function Ee(){return typeof BigInt==`function`}var De=typeof Symbol==`function`&&typeof Symbol()==`symbol`;function Oe(e,t,n=!1){return typeof Symbol==`function`&&typeof Symbol()==`symbol`?n&&Symbol.for&&e?Symbol.for(e):e==null?Symbol():Symbol(e):t}var ke=Oe(`jas`,void 0,!0),Ae=Oe(void 0,`0di`),je=Oe(void 0,`1oa`),Me=Oe(void 0,Symbol()),Ne=Oe(void 0,`0ub`),Pe=Oe(void 0,`0ubs`),Fe=Oe(void 0,`0ubsb`),Ie=Oe(void 0,`0actk`),Le=Oe(`m_m`,`Pa`,!0),Re=Oe(),ze={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},Be=Object.defineProperties,f=De?ke:`Ga`,Ve,He=[];function Ue(e,t){De||f in e||Be(e,ze),e[f]|=t}function p(e,t){De||f in e||Be(e,ze),e[f]=t}function We(e){return Ue(e,34),e}function Ge(e){return Ue(e,8192),e}p(He,7),Ve=Object.freeze(He);var Ke={};function qe(e,t){return t===void 0?e.h!==Je&&!!(2&(0|e.v[f])):!!(2&t)&&e.h!==Je}var Je={};function Ye(e,t){if(e!=null){if(typeof e==`string`)e=e?new ye(e,ge):_e();else if(e.constructor!==ye)if(he(e))e=e.length?new ye(new Uint8Array(e),ge):_e();else{if(!t)throw Error();e=void 0}}return e}var Xe=class{constructor(e,t,n){this.g=e,this.h=t,this.l=n}next(){let e=this.g.next();return e.done||(e.value=this.h.call(this.l,e.value)),e}[Symbol.iterator](){return this}},Ze=Object.freeze({});function Qe(e,t,n){let r=128&t?0:-1,i=e.length;var a;(a=!!i)&&(a=(a=e[i-1])!=null&&typeof a==`object`&&a.constructor===Object);let o=i+(a?-1:0);for(t=128&t?1:0;ttypeof e==`number`)),rt=tt((e=>typeof e==`string`)),it=tt((e=>typeof e==`boolean`)),at=typeof e.BigInt==`function`&&typeof e.BigInt(0)==`bigint`;function ot(e){var t=e;if(rt(t)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(t))throw Error(String(t))}else if(nt(t)&&!Number.isSafeInteger(t))throw Error(String(t));return at?BigInt(e):e=it(e)?e?`1`:`0`:rt(e)?e.trim()||`0`:String(e)}var st=tt((e=>at?e>=lt&&e<=dt:e[0]===`-`?ft(e,ct):ft(e,ut))),ct=(-(2**53-1)).toString(),lt=at?BigInt(-(2**53-1)):void 0,ut=(2**53-1).toString(),dt=at?BigInt(2**53-1):void 0;function ft(e,t){if(e.length>t.length)return!1;if(e.lengthi)return!1;if(r>>0;m=t,h=(e-t)/4294967296>>>0}function gt(e){if(e<0){ht(-e);let[t,n]=Tt(m,h);m=t>>>0,h=n>>>0}else ht(e)}function _t(e){let t=mt||=new DataView(new ArrayBuffer(8));t.setFloat32(0,+e,!0),h=0,m=t.getUint32(0,!0)}function vt(e,t){let n=4294967296*t+(e>>>0);return Number.isSafeInteger(n)?n:xt(e,t)}function yt(e,t){return ot(Ee()?BigInt.asUintN(64,(BigInt(t>>>0)<>>0)):xt(e,t))}function bt(e,t){return Ee()?ot(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(t))<>>=0,(t>>>=0)<=2097151)var n=``+(4294967296*t+e);else Ee()?n=``+(BigInt(t)<>>24|t<<8))+6710656*(t=t>>16&65535),n+=8147497*t,t*=2,e>=1e7&&(n+=e/1e7>>>0,e%=1e7),n>=1e7&&(t+=n/1e7>>>0,n%=1e7),n=t+St(n)+St(e));return n}function St(e){return e=String(e),`0000000`.slice(e.length)+e}function Ct(e,t){if(2147483648&t)if(Ee())e=``+(BigInt(0|t)<>>0));else{let[n,r]=Tt(e,t);e=`-`+xt(n,r)}else e=xt(e,t);return e}function wt(e){if(e.length<16)gt(Number(e));else if(Ee())e=BigInt(e),m=Number(e&BigInt(4294967295))>>>0,h=Number(e>>BigInt(32)&BigInt(4294967295));else{let t=+(e[0]===`-`);h=m=0;let n=e.length;for(let r=t,i=(n-t)%6+t;i<=n;r=i,i+=6){let t=Number(e.slice(r,i));h*=1e6,m=1e6*m+t,m>=4294967296&&(h+=Math.trunc(m/4294967296),h>>>=0,m>>>=0)}if(t){let[e,t]=Tt(m,h);m=e,h=t}}}function Tt(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}function Et(e){return Array.prototype.slice.call(e)}var Dt=typeof BigInt==`function`?BigInt.asIntN:void 0,Ot=typeof BigInt==`function`?BigInt.asUintN:void 0,kt=Number.isSafeInteger,At=Number.isFinite,jt=Math.trunc,Mt=ot(0);function Nt(e){if(e!=null&&typeof e!=`number`)throw Error(`Value of float/double field must be a number, found ${typeof e}: ${e}`);return e}function Pt(e){return e==null||typeof e==`number`?e:e===`NaN`||e===`Infinity`||e===`-Infinity`?Number(e):void 0}function Ft(e){if(e!=null&&typeof e!=`boolean`){var t=typeof e;throw Error(`Expected boolean but got ${t==`object`?e?Array.isArray(e)?`array`:t:`null`:t}: ${e}`)}return e}function It(e){return e==null||typeof e==`boolean`?e:typeof e==`number`?!!e:void 0}var Lt=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Rt(e){switch(typeof e){case`bigint`:return!0;case`number`:return At(e);case`string`:return Lt.test(e);default:return!1}}function zt(e){if(e==null)return e;if(typeof e==`string`&&e)e=+e;else if(typeof e!=`number`)return;return At(e)?0|e:void 0}function Bt(e){if(e==null)return e;if(typeof e==`string`&&e)e=+e;else if(typeof e!=`number`)return;return At(e)?e>>>0:void 0}function Vt(e){let t=e.length;return(e[0]===`-`?t<20||t===20&&e<=`-9223372036854775808`:t<19||t===19&&e<=`9223372036854775807`)?e:(wt(e),Ct(m,h))}function Ht(e){if(e=jt(e),!kt(e)){gt(e);var t=m,n=h;(e=2147483648&n)&&(n=~n>>>0,(t=1+~t>>>0)==0&&(n=n+1>>>0)),e=typeof(t=vt(t,n))==`number`?e?-t:t:e?`-`+t:t}return e}function Ut(e){var t=jt(Number(e));return kt(t)?String(t):((t=e.indexOf(`.`))!==-1&&(e=e.substring(0,t)),Vt(e))}function Wt(e){var t=jt(Number(e));return kt(t)?ot(t):((t=e.indexOf(`.`))!==-1&&(e=e.substring(0,t)),Ee()?ot(Dt(64,BigInt(e))):ot(Vt(e)))}function Gt(e){return kt(e)?e=ot(Ht(e)):(e=jt(e),kt(e)?e=String(e):(gt(e),e=Ct(m,h)),e=ot(e)),e}function Kt(e){let t=typeof e;return e==null?e:t===`bigint`?ot(Dt(64,e)):Rt(e)?t===`string`?Wt(e):Gt(e):void 0}function qt(e){if(typeof e!=`string`)throw Error();return e}function Jt(e){if(e!=null&&typeof e!=`string`)throw Error();return e}function g(e){return e==null||typeof e==`string`?e:void 0}function Yt(e,t,n,r){return e!=null&&e[Le]===Ke?e:Array.isArray(e)?((r=(n=0|e[f])|32&r|2&r)!==n&&p(e,r),new t(e)):(n?2&r?((e=t[Ae])||(We((e=new t).v),e=t[Ae]=e),t=e):t=new t:t=void 0,t)}function Xt(e,t,n){if(t)t:{if(!Rt(t=e))throw we(`int64`);switch(typeof t){case`string`:t=Wt(t);break t;case`bigint`:t=ot(Dt(64,t));break t;default:t=Gt(t)}}else t=Kt(e);return(e=t)??(n?Mt:void 0)}var Zt={},Qt=function(){try{return ie(new class extends Map{constructor(){super()}}),!1}catch{return!0}}(),$t=class{constructor(){this.g=new Map}get(e){return this.g.get(e)}set(e,t){return this.g.set(e,t),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,t){return this.g.forEach(e,t)}[Symbol.iterator](){return this.entries()}},en=Qt?(Object.setPrototypeOf($t.prototype,Map.prototype),Object.defineProperties($t.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),$t):class extends Map{constructor(){super()}};function tn(e){return e}function nn(e){if(2&e.J)throw Error(`Cannot mutate an immutable Map`)}var rn=class extends en{constructor(e,t,n=tn,r=tn){super(),this.J=0|e[f],this.K=t,this.S=n,this.fa=this.K?an:r;for(let i=0;i{e.call(t,i.get(r),r,i)})):super.forEach(e,t)}set(e,t){return nn(this),(e=this.S(e,!0,!1))==null?this:t==null?(super.delete(e),this):super.set(e,this.fa(t,!0,!0,this.K,!1,this.J))}Ma(e){let t=this.S(e[0],!1,!0);e=e[1],e=this.K?e===void 0?null:e:this.fa(e,!1,!0,void 0,!1,this.J),super.set(t,e)}has(e){return super.has(this.S(e,!1,!1))}get(e){e=this.S(e,!1,!1);let t=super.get(e);if(t!==void 0){var n=this.K;return n?((n=this.fa(t,!1,!0,n,this.ra,this.J))!==t&&super.set(e,n),n):t}}[Symbol.iterator](){return this.entries()}};function an(e,t,n,r,i,a){return e=Yt(e,r,n,a),i&&(e=Dn(e)),e}function on(e){return[e,this.get(e)]}var sn;function cn(){return sn||=new rn(We([]),void 0,void 0,void 0,Zt)}function ln(e){return Me?e[Me]:void 0}function un(e,t){for(let n in e)!isNaN(n)&&t(e,+n,e[n])}rn.prototype.toJSON=void 0;var dn=class{},fn={Ka:!0};function pn(e,t){t<100||Te(Pe,1)}function mn(e,t,n,r){let i=r!==void 0;r=!!r;var a,o=Me;!i&&De&&o&&(a=e[o])&&un(a,pn),o=[];var s=e.length;let c;a=4294967295;let l=!1,u=!!(64&t),d=u?128&t?0:-1:void 0;1&t||(c=s&&e[s-1],typeof c==`object`&&c&&c.constructor===Object?a=--s:c=void 0,!u||128&t||i||(l=!0,a=a-d+d)),t=void 0;for(var ee=0;ee=a){let e=ee-d;(t??={})[e]=i}else o[ee]=i}if(c)for(let e in c){if((s=c[e])==null||(s=n(s,r))==null)continue;let i;ee=+e,u&&!Number.isNaN(ee)&&(i=ee+d){t[n]=Et(r)})),t.da=e.da,t}(e)),o}function hn(e){return e[0]=gn(e[0]),e[1]=gn(e[1]),e}function gn(e){switch(typeof e){case`number`:return Number.isFinite(e)?e:``+e;case`bigint`:return st(e)?Number(e):``+e;case`boolean`:return e?1:0;case`object`:if(Array.isArray(e)){var t=0|e[f];return e.length===0&&1&t?void 0:mn(e,t,gn)}if(e!=null&&e[Le]===Ke)return yn(e);if(e instanceof ye){if((t=e.g)==null)e=``;else if(typeof t==`string`)e=t;else{if(ue){for(var n=``,r=0,i=t.length-10240;r>2];a=n[(3&a)<<4|o>>4],o=n[(15&o)<<2|s>>6],s=n[63&s],r[l++]=c+a+o+s}switch(c=0,s=i,t.length-e){case 2:s=n[(15&(c=t[e+1]))<<2]||i;case 1:t=t[e],r[l]=n[t>>2]+n[(3&t)<<4|c>>4]+s+i}t=r.join(``)}e=e.g=t}return e}return e instanceof rn?e=e.size===0?void 0:e.V(hn):void 0}return e}var _n,vn;function yn(e){return mn(e=e.v,0|e[f],gn)}function bn(e,t){return xn(e,t[0],t[1])}function xn(e,t,n,r=0){if(e==null){var i=32;n?(e=[n],i|=128):e=[],t&&(i=-16760833&i|(1023&t)<<14)}else{if(!Array.isArray(e))throw Error(`narr`);if(i=0|e[f],te&&1&i)throw Error(`rfarr`);if(2048&i&&!(2&i)&&function(){if(te)throw Error(`carr`);Te(Ie,5)}(),256&i)throw Error(`farr`);if(64&i)return(i|r)!==i&&p(e,i|r),e;if(n&&(i|=128,n!==e[0]))throw Error(`mid`);t:{i|=64;var a=(n=e).length;if(a){var o=a-1;let e=n[o];if(typeof e==`object`&&e&&e.constructor===Object){if((o-=t=128&i?0:-1)>=1024)throw Error(`pvtlmt`);for(var s in e)(a=+s)1024)throw Error(`spvt`);i=-16760833&i|(1023&s)<<14}}}return p(e,64|i|r),e}function Sn(e,t){if(typeof e!=`object`)return e;if(Array.isArray(e)){var n=0|e[f];return e.length===0&&1&n?void 0:Cn(e,n,t)}if(e!=null&&e[Le]===Ke)return Tn(e);if(e instanceof rn){if(2&(t=e.J))return e;if(!e.size)return;if(n=We(e.V()),e.K)for(e=0;e=a)if(o=e[a],typeof o==`object`&&o&&o.constructor===Object)n=o[t],s=!0;else{if(i!==a)return;n=o}else n=e[i];if(r&&n!=null){if((r=r(n))==null)return r;if(!Object.is(r,n))return s?o[t]=r:e[i]=r,r}return n}}function v(e,t,n,r){kn(e),y(e=e.v,0|e[f],t,n,r)}function y(e,t,n,r,i){let a=n+(i?0:-1);var o=e.length-1;if(o>=1+(i?0:-1)&&a>=o){let i=e[o];if(typeof i==`object`&&i&&i.constructor===Object)return i[n]=r,t}return a<=o?(e[a]=r,t):(r!==void 0&&(n>=(o=(t??=0|e[f])>>14&1023||536870912)?r!=null&&(e[o+(i?0:-1)]={[n]:r}):e[a]=r),t)}function Fn(){return Ze===void 0?2:4}function In(e,t,n,r,i){let a=e.v,o=0|a[f];r=qe(e,o)?1:r,i=!!i||r===3,r===2&&On(e)&&(a=e.v,o=0|a[f]);let s=(e=Rn(a,t))===Ve?7:0|e[f],c=zn(s,o);var l=!(4&c);if(l){4&c&&(e=Et(e),s=0,c=tr(c,o),o=y(a,o,t,e));let r=0,i=0;for(;r{let r=Yt(e,n,!1,t);return a=r!==e&&r!=null,r})))!=null)return a&&!qe(r)&&An(e,t),r}function b(e,t,n,r){let i=e.v,a=0|i[f];if((t=Xn(i,a,t,n,r))==null)return t;if(a=0|i[f],!qe(e,a)){let o=Dn(t);o!==t&&(On(e)&&(i=e.v,a=0|i[f]),a=y(i,a,n,t=o,r),An(i,a))}return t}function Zn(e,t,n,r,i,a,o,s){var c=qe(e,n);a=c?1:a,o=!!o||a===3,c=s&&!c,(a===2||c)&&On(e)&&(n=0|(t=e.v)[f]);var l=(e=Rn(t,i))===Ve?7:0|e[f],u=zn(l,n);if(s=!(4&u)){var d=e,ee=n;let t=!!(2&u);t&&(ee|=2);let i=!t,a=!0,o=0,s=0;for(;o32)for(i|=(127&n)>>4,a=3;a<32&&128&n;a+=7)n=o[s++],i|=(127&n)<>>0,i>>>0);throw Error()}function dr(e){let t=0,n=e.g,r=n+10,i=e.h;for(;n>>0}function mr(e){var t=e.h;let n=e.g;var r=t[n],i=t[n+1];let a=t[n+2];return t=t[n+3],gr(e,e.g+4),e=2*((i=(r<<0|i<<8|a<<16|t<<24)>>>0)>>31)+1,r=i>>>23&255,i&=8388607,r==255?i?NaN:e*(1/0):r==0?1401298464324817e-60*e*i:e*2**(r-150)*(i+8388608)}function hr(e){return fr(e)}function gr(e,t){if(e.g=t,t>e.l)throw Error()}function _r(e,t){if(t<0)throw Error();let n=e.g;if((t=n+t)>e.l)throw Error();return e.g=t,n}function vr(e,t){if(t==0)return _e();var n=_r(e,t);return e.Y&&e.j?n=e.h.subarray(n,n+t):(e=e.h,n=n===(t=n+t)?new Uint8Array:pt?e.slice(n,t):new Uint8Array(e.subarray(n,t))),n.length==0?_e():new ye(n,ge)}var yr=[];function br(e,t,n,r){if(kr.length){let i=kr.pop();return i.o(r),i.g.init(e,t,n,r),i}return new Or(e,t,n,r)}function xr(e){e.g.clear(),e.l=-1,e.h=-1,kr.length<100&&kr.push(e)}function Sr(e){var t=e.g;if(t.g==t.l)return!1;e.m=e.g.g;var n=pr(e.g);if(t=n>>>3,!((n&=7)>=0&&n<=5)||t<1)throw Error();return e.l=t,e.h=n,!0}function Cr(e){switch(e.h){case 0:e.h==0?dr(e.g):Cr(e);break;case 1:gr(e=e.g,e.g+8);break;case 2:if(e.h!=2)Cr(e);else{var t=pr(e.g);gr(e=e.g,e.g+t)}break;case 5:gr(e=e.g,e.g+4);break;case 3:for(t=e.l;;){if(!Sr(e))throw Error();if(e.h==4){if(e.l!=t)throw Error();break}Cr(e)}break;default:throw Error()}}function wr(e,t,n){let r=e.g.l;var i=pr(e.g);let a=(i=e.g.g+i)-r;if(a<=0&&(e.g.l=i,n(t,e,void 0,void 0,void 0),a=i-e.g.g),a)throw Error();return e.g.g=i,e.g.l=r,t}function Tr(e){var t=pr(e.g),s=_r(e=e.g,t);if(e=e.h,o){var c,l=e;(c=a)||(c=a=new TextDecoder(`utf-8`,{fatal:!0})),t=s+t,l=s===0&&t===l.length?l:l.subarray(s,t);try{var u=c.decode(l)}catch(e){if(i===void 0){try{c.decode(new Uint8Array([128]))}catch{}try{c.decode(new Uint8Array([97])),i=!0}catch{i=!1}}throw!i&&(a=void 0),e}}else{t=(u=s)+t,s=[];let i,a=null;for(;u=t?n():(i=e[u++],d<194||(192&i)!=128?(u--,n()):s.push((31&d)<<6|63&i)):d<240?u>=t-1?n():(i=e[u++],(192&i)!=128||d===224&&i<160||d===237&&i>=160||(192&(c=e[u++]))!=128?(u--,n()):s.push((15&d)<<12|(63&i)<<6|63&c)):d<=244?u>=t-2?n():(i=e[u++],(192&i)!=128||i-144+(d<<28)>>30||(192&(c=e[u++]))!=128||(192&(l=e[u++]))!=128?(u--,n()):(d=(7&d)<<18|(63&i)<<12|(63&c)<<6|63&l,d-=65536,s.push(55296+(d>>10&1023),56320+(1023&d)))):n(),s.length>=8192&&(a=r(a,s),s.length=0)}u=r(a,s)}return u}function Er(e){let t=pr(e.g);return vr(e.g,t)}function Dr(e,t,n){var r=pr(e.g);for(r=e.g.g+r;e.g.g>>0,this.g=t>>>0}},Mr;function Nr(e){return e?/^-?\d+$/.test(e)?(wt(e),new Pr(m,h)):null:Fr||=new Pr(0,0)}var Pr=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}},Fr;function Ir(e,t,n){for(;n>0||t>127;)e.g.push(127&t|128),t=(t>>>7|n<<25)>>>0,n>>>=7;e.g.push(t)}function Lr(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function Rr(e,t){if(t>=0)Lr(e,t);else{for(let n=0;n<9;n++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function zr(e){var t=m;e.g.push(t>>>0&255),e.g.push(t>>>8&255),e.g.push(t>>>16&255),e.g.push(t>>>24&255)}function Br(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function Vr(e,t,n){Lr(e.g,8*t+n)}function Hr(e,t){return Vr(e,t,2),t=e.g.end(),Br(e,t),t.push(e.h),t}function Ur(e,t){var n=t.pop();for(n=e.h+e.g.length()-n;n>127;)t.push(127&n|128),n>>>=7,e.h++;t.push(n),e.h++}function Wr(e,t,n){Vr(e,t,2),Lr(e.g,n.length),Br(e,e.g.end()),Br(e,n)}function Gr(e,t,n,r){n!=null&&(t=Hr(e,t),r(n,e),Ur(e,t))}function Kr(){let e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var qr=Kr(),Jr=Kr(),Yr=Kr(),Xr=Kr(),Zr=Kr(),Qr=Kr(),$r=Kr(),ei=Kr(),ti=Kr(),ni=Kr();function ri(e,t,n){var r=e.v;Me&&Me in r&&(r=r[Me])&&delete r[t.g],t.h?t.j(e,t.h,t.g,n,t.l):t.j(e,t.g,n,t.l)}var w=class{constructor(e,t){this.v=xn(e,t,void 0,2048)}toJSON(){return yn(this)}j(){var e=Ro,t=this.v,n=e.g,r=Me;if(De&&r&&t[r]?.[n]!=null&&Te(Ne,3),t=e.g,Re&&Me&&Re===void 0&&(r=(n=this.v)[Me])&&(r=r.da))try{r(n,t,fn)}catch(e){u(e)}return e.h?e.m(this,e.h,e.g,e.l):e.m(this,e.g,e.defaultValue,e.l)}clone(){let e=this.v,t=0|e[f];return jn(this,e,t)?wn(this,e,!0):new this.constructor(En(e,t,!1))}};w.prototype[Le]=Ke,w.prototype.toString=function(){return this.v.toString()};var ii=class{constructor(e,t,n){this.g=e,this.h=t,e=qr,this.l=!!e&&n===e||!1}};function ai(e,t){return new ii(e,t,qr)}function oi(e,t,n,r,i){Gr(e,n,vi(t,r),i)}var si=ai((function(e,t,n,r,i){return e.h===2&&(wr(e,Yn(t,r,n),i),!0)}),oi),ci=ai((function(e,t,n,r,i){return e.h===2&&(wr(e,Yn(t,r,n),i),!0)}),oi),li=Symbol(),ui=Symbol(),di=Symbol(),fi=Symbol(),pi=Symbol(),mi,hi;function gi(e,t,n,r){var i=r[e];if(i)return i;(i={}).qa=r,i.T=function(e){switch(typeof e){case`boolean`:return _n||=[0,void 0,!0];case`number`:return e>0?void 0:e===0?vn||=[0,void 0]:[-e,void 0];case`string`:return[0,e];case`object`:return e}}(r[0]);var a=r[1];let o=1;a&&a.constructor===Object&&(i.ba=a,typeof(a=r[++o])==`function`&&(i.ma=!0,mi??=a,hi??=r[o+1],a=r[o+=2]));let s={};for(;a&&Array.isArray(a)&&a.length&&typeof a[0]==`number`&&a[0]>0;){for(var c=0;ci(e,t,n,r):i}function bi(e,t,n,r,i){let a=n.g,o,s;e[t]=(e,t,n)=>a(e,t,n,s||=gi(ui,yi,bi,r).T,o||=xi(r),i)}function xi(e){let t=e[di];if(t!=null)return t;let n=gi(ui,yi,bi,e);return t=n.ma?(e,t)=>mi(e,t,n):(e,t)=>{for(;Sr(t)&&t.h!=4;){var r=t.l,i=n[r];if(i==null){var a=n.ba;(a&&=a[r])&&(a=Ci(a))!=null&&(i=n[r]=a)}if(i==null||!i(t,e,r)){if(i=(a=t).m,Cr(a),a.ha)var o=void 0;else o=a.g.g-i,a.g.g=i,o=vr(a.g,o);i=void 0,a=e,o&&((i=a[Me]??(a[Me]=new dn))[r]??(i[r]=[])).push(o)}}return(e=ln(e))&&(e.da=n.qa[pi]),!0},e[di]=t,e[pi]=Si.bind(e),t}function Si(e,t,n,r){var i=this[ui];let a=this[di],o=bn(void 0,i.T),s=ln(e);if(s){var c=!1,l=i.ba;if(l){if(i=(t,n,i)=>{if(i.length!==0)if(l[n])for(let e of i){t=br(e);try{c=!0,a(o,t)}finally{xr(t)}}else r?.(e,n,i)},t==null)un(s,i);else if(s!=null){let e=s[t];e&&i(s,t,e)}if(c){let r=0|e[f];if(2&r&&2048&r&&!n?.Ka)throw Error();let i=et(r),a=(t,a)=>{if(Pn(e,t,i)!=null){if(n?.Qa===1)return;throw Error()}a!=null&&(r=y(e,r,t,a,i)),delete s[t]};t==null?Qe(o,0|o[f],((e,t)=>{a(e,t)})):a(t,Pn(o,t,i))}}}}function Ci(e){let t=(e=_i(e))[0].g;if(e=e[1]){let n=xi(e),r=gi(ui,yi,bi,e).T;return(e,i,a)=>t(e,i,a,r,n)}return t}function wi(e,t,n){e[t]=n.h}function Ti(e,t,n,r){let i,a,o=n.h;e[t]=(e,t,n)=>o(e,t,n,a||=gi(li,wi,Ti,r).T,i||=Ei(r))}function Ei(e){let t=e[fi];if(!t){let n=gi(li,wi,Ti,e);t=(e,t)=>Di(e,t,n),e[fi]=t}return t}function Di(e,t,n){Qe(e,0|e[f],((e,r)=>{if(r!=null){var i=function(e,t){var n=e[t];if(n)return n;if((n=e.ba)&&(n=n[t])){var r=(n=_i(n))[0].h;if(n=n[1]){let t=Ei(n),i=gi(li,wi,Ti,n).T;n=e.ma?hi(i,t):(e,n,a)=>r(e,n,a,i,t)}else n=r;return e[t]=n}}(n,e);i?i(t,r,e):e<500||Te(Fe,3)}})),(e=ln(e))&&un(e,((e,n,r)=>{for(Br(t,t.g.end()),e=0;e{Gr(e,n,bn([a,t],r),i)}));else if(Array.isArray(t)){for(let a=0;a>BigInt(32))),Ir(e.g,n.h,n.g);break;default:n=Nr(t),Ir(e.g,n.h,n.g)}}function Pi(e,t,n){(t=zt(t))!=null&&t!=null&&(Vr(e,n,0),Rr(e.g,t))}function Fi(e,t,n){(t=It(t))!=null&&(Vr(e,n,0),e.g.g.push(t?1:0))}function Ii(e,t,n){(t=g(t))!=null&&Wr(e,n,l(t))}function Li(e,t,n,r,i){Gr(e,n,vi(t,r),i)}function Ri(e,t,n){(t=t==null||typeof t==`string`||t instanceof ye?t:void 0)!=null&&Wr(e,n,lr(t,!0).buffer)}function zi(e,t,n){(t=Bt(t))!=null&&t!=null&&(Vr(e,n,0),Lr(e.g,t))}function Bi(e,t,n){return(e.h===5||e.h===2)&&(t=Wn(t,0|t[f],n),e.h==2?Dr(e,mr,t):t.push(mr(e.g)),!0)}var D=T((function(e,t,n){return e.h===5&&(E(t,n,mr(e.g)),!0)}),Mi,ei),Vi=Ai(Bi,(function(e,t,n){if((t=ki(Pt,t))!=null)for(let o=0;o=0?e=String(t):((t=e.indexOf(`.`))!==-1&&(e=e.substring(0,t)),(t=e[0]!==`-`&&((t=e.length)<20||t===20&&e<=`18446744073709551615`))||(wt(e),e=xt(m,h))),e;if(t===`number`)return(e=jt(e))>=0&&kt(e)||(gt(e),e=vt(m,h)),e}}(t),t!=null&&(typeof t==`string`&&Ar(t),t!=null))switch(Vr(e,n,0),typeof t){case`number`:e=e.g,gt(t),Ir(e,m,h);break;case`bigint`:n=BigInt.asUintN(64,t),n=new jr(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),Ir(e.g,n.h,n.g);break;default:n=Ar(t),Ir(e.g,n.h,n.g)}}),$r),O=T((function(e,t,n){return e.h===0&&(E(t,n,fr(e.g)),!0)}),Pi,Xr),qi=Ai((function(e,t,n){return(e.h===0||e.h===2)&&(t=Wn(t,0|t[f],n),e.h==2?Dr(e,fr,t):t.push(fr(e.g)),!0)}),(function(e,t,n){if((t=ki(zt,t))!=null&&t.length){n=Hr(e,n);for(let n=0;n{{let a={ea:!0};r&&Object.assign(a,r),n=br(n,void 0,void 0,a);try{let r=new e,a=r.v;xi(t)(a,n);var i=r}finally{xr(n)}}return i}}function ra(e){return function(){let t=new class{constructor(){this.l=[],this.h=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){let e=this.g;return this.g=[],e}}}};Di(this.v,t,gi(li,wi,Ti,e)),Br(t,t.g.end());let n=new Uint8Array(t.h),r=t.l,i=r.length,a=0;for(let e=0;ee;e=sa.createPolicy(`goog#html`,{createHTML:t,createScript:t,createScriptURL:t})}catch{}return e}()),e=(t=oa)?t.createScriptURL(e):e,new class{constructor(e){this.g=e}toString(){return this.g+``}}(e)}function la(e,...t){if(t.length===0)return ca(e[0]);let n=e[0];for(let r=0;r({index:rr(e,1)??0??-1,score:S(e,2)??0,categoryName:g(_(e,3))??``??``,displayName:g(_(e,4))??``??``}))),headIndex:t,headName:n}}function $o(e){let t={classifications:Qn(e,Ha,1).map((e=>Qo(b(e,Oa,4)?.g()??[],rr(e,2)??0,g(_(e,3))??``)))};return function(e){return e==null?e:typeof e==`bigint`?(st(e)?e=Number(e):(e=Dt(64,e),e=st(e)?Number(e):String(e)),e):Rt(e)?typeof e==`number`?Ht(e):Ut(e):void 0}(_(e,2,void 0,void 0,Kt))!=null&&(t.timestampMs=Zo(_(e,2,void 0,void 0,Kt)??Mn)),t}function es(e){var t=In(e,3,Pt,Fn()),n=In(e,2,zt,Fn()),r=In(e,1,g,Fn()),i=In(e,9,g,Fn());let a={categories:[],keypoints:[]};for(let e=0;ee>127?e-256:e))}function is(e,t){if(e.length!==t.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${e.length} vs. ${t.length}).`);let n=0,r=0,i=0;for(let a=0;a=1&&Number(e[1])>=17))}async function ds(e){if(typeof importScripts!=`function`){let t=document.createElement(`script`);return t.src=e.toString(),t.crossOrigin=`anonymous`,new Promise(((e,n)=>{t.addEventListener(`load`,(()=>{e()}),!1),t.addEventListener(`error`,(e=>{n(e)}),!1),document.body.appendChild(t)}))}try{importScripts(e.toString())}catch(t){if(!(t instanceof TypeError))throw t;await self.import(e.toString())}}function fs(e){return e.videoWidth===void 0?e.naturalWidth===void 0?e.displayWidth===void 0?[e.width,e.height]:[e.displayWidth,e.displayHeight]:[e.naturalWidth,e.naturalHeight]:[e.videoWidth,e.videoHeight]}function U(e,t,n){e.m||console.error(`No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target`),n(t=e.i.stringToNewUTF8(t)),e.i._free(t)}function ps(e,t,n){if(!e.i.canvas)throw Error(`No OpenGL canvas configured.`);if(n?e.i._bindTextureToStream(n):e.i._bindTextureToCanvas(),!(n=e.i.canvas.getContext(`webgl2`)||e.i.canvas.getContext(`webgl`)))throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");e.i.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!0),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t),e.i.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1);let[r,i]=fs(t);return!e.l||r===e.i.canvas.width&&i===e.i.canvas.height||(e.i.canvas.width=r,e.i.canvas.height=i),[r,i]}function ms(e,t,n){e.m||console.error(`No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target`);let r=new Uint32Array(t.length);for(let n=0;n>2),n(t);for(let t of r)e.i._free(t);e.i._free(t)}function hs(e,t,n){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=n}function gs(e,t,n){let r=[];e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=(e,t,i)=>{t?(n(r,i),r=[]):r.push(e)}}ls.forVisionTasks=function(e,t=!1){return cs(`vision`,e??la``,t)},ls.forTextTasks=function(e,t=!1){return cs(`text`,e??la``,t)},ls.forGenAiTasks=function(e,t=!1){return cs(`genai`,e??la``,t)},ls.forAudioTasks=function(e,t=!1){return cs(`audio`,e??la``,t)},ls.isSimdSupported=function(e=!1){return ss(e)};async function _s(e,t,n,r){return e=await(async(e,t,n,r,i)=>{if(t&&await ds(t),!self.ModuleFactory||n&&(await ds(n),!self.ModuleFactory))throw Error(`ModuleFactory not set.`);return self.Module&&i&&((t=self.Module).locateFile=i.locateFile,i.mainScriptUrlOrBlob&&(t.mainScriptUrlOrBlob=i.mainScriptUrlOrBlob)),i=await self.ModuleFactory(self.Module||i),self.ModuleFactory=self.Module=void 0,new e(i,r)})(e,n.wasmLoaderPath,n.assetLoaderPath,t,{locateFile:e=>e.endsWith(`.wasm`)?n.wasmBinaryPath.toString():n.assetBinaryPath&&e.endsWith(`.data`)?n.assetBinaryPath.toString():e}),await e.o(r),e}function vs(e,t){let n=b(e.baseOptions,to,1)||new to;typeof t==`string`?(v(n,2,Jt(t)),v(n,1)):t instanceof Uint8Array&&(v(n,1,Ye(t,!1)),v(n,2)),x(e.baseOptions,0,1,n)}function ys(e){try{let t=e.H.length;if(t===1)throw Error(e.H[0].message);if(t>1)throw Error(`Encountered multiple errors: `+e.H.map((e=>e.message)).join(`, `))}finally{e.H=[]}}function W(e,t){e.C=Math.max(e.C,t)}function bs(e,t){e.B=new R,ar(e.B,2,`PassThroughCalculator`),I(e.B,`free_memory`),L(e.B,`free_memory_unused_out`),z(t,`free_memory`),Ca(t,e.B)}function xs(e,t){I(e.B,t),L(e.B,t+`_unused_out`)}function Ss(e){e.g.addBoolToStream(!0,`free_memory`,e.C)}var Cs=class{constructor(e){this.g=e,this.H=[],this.C=0,this.g.setAutoRenderToScreen(!1)}l(e,t=!0){if(t){let t=e.baseOptions||{};if(e.baseOptions?.modelAssetBuffer&&e.baseOptions?.modelAssetPath)throw Error(`Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer`);if(!(b(this.baseOptions,to,1)?.g()||b(this.baseOptions,to,1)?.l()||e.baseOptions?.modelAssetBuffer||e.baseOptions?.modelAssetPath))throw Error(`Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set`);if(function(e,t){let n=b(e.baseOptions,$a,3);if(!n){var r=n=new $a,i=new ha;er(r,4,eo,i)}`delegate`in t&&(t.delegate===`GPU`?(t=n,r=new da,er(t,2,eo,r)):(t=n,r=new ha,er(t,4,eo,r))),x(e.baseOptions,0,3,n)}(this,t),t.modelAssetPath)return fetch(t.modelAssetPath.toString()).then((e=>{if(e.ok)return e.arrayBuffer();throw Error(`Failed to fetch model: ${t.modelAssetPath} (${e.status})`)})).then((e=>{try{this.g.i.FS_unlink(`/model.dat`)}catch{}this.g.i.FS_createDataFile(`/`,`model.dat`,new Uint8Array(e),!0,!1,!1),vs(this,`/model.dat`),this.m(),this.L()}));if(t.modelAssetBuffer instanceof Uint8Array)vs(this,t.modelAssetBuffer);else if(t.modelAssetBuffer)return async function(e){let t=[];for(var n=0;;){let{done:r,value:i}=await e.read();if(r)break;t.push(i),n+=i.length}if(t.length===0)return new Uint8Array;if(t.length===1)return t[0];e=new Uint8Array(n),n=0;for(let r of t)e.set(r,n),n+=r.length;return e}(t.modelAssetBuffer).then((e=>{vs(this,e),this.m(),this.L()}))}return this.m(),this.L(),Promise.resolve()}L(){}ca(){let e;if(this.g.ca((t=>{e=Ea(t)})),!e)throw Error(`Failed to retrieve CalculatorGraphConfig`);return e}setGraph(e,t){this.g.attachErrorListener(((e,t)=>{this.H.push(Error(t))})),this.g.Ja(),this.g.setGraph(e,t),this.B=void 0,ys(this)}finishProcessing(){this.g.finishProcessing(),ys(this)}close(){this.B=void 0,this.g.closeGraph()}};function G(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}Cs.prototype.close=Cs.prototype.close;var ws=class{constructor(e,t,n,r){this.g=e,this.h=t,this.m=n,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 Ts(e,t,n){let r=e.g;if(n=G(r.createShader(n),`Failed to create WebGL shader`),r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${r.getShaderInfoLog(n)}`);return r.attachShader(e.h,n),n}function Es(e,t){let n=e.g,r=G(n.createVertexArray(),`Failed to create vertex array`);n.bindVertexArray(r);let i=G(n.createBuffer(),`Failed to create buffer`);n.bindBuffer(n.ARRAY_BUFFER,i),n.enableVertexAttribArray(e.O),n.vertexAttribPointer(e.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);let a=G(n.createBuffer(),`Failed to create buffer`);return n.bindBuffer(n.ARRAY_BUFFER,a),n.enableVertexAttribArray(e.L),n.vertexAttribPointer(e.L,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array(t?[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 ws(n,r,i,a)}function Ds(e,t){if(e.g){if(t!==e.g)throw Error(`Cannot change GL context once initialized`)}else e.g=t}function Os(e,t,n,r){return Ds(e,t),e.h||(e.m(),e.D()),n?(e.u||=Es(e,!0),n=e.u):(e.A||=Es(e,!1),n=e.A),t.useProgram(e.h),n.bind(),e.l(),e=r(),n.g.bindVertexArray(null),e}function ks(e,t,n){return Ds(e,t),e=G(t.createTexture(),`Failed to create texture`),t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,n??t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,n??t.LINEAR),t.bindTexture(t.TEXTURE_2D,null),e}function As(e,t,n){Ds(e,t),e.B||=G(t.createFramebuffer(),`Failed to create framebuffe.`),t.bindFramebuffer(t.FRAMEBUFFER,e.B),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0)}function js(e){e.g?.bindFramebuffer(e.g.FRAMEBUFFER,null)}var Ms=class{H(){return` precision mediump float; varying vec2 vTex; uniform sampler2D inputTexture; void main() { gl_FragColor = texture2D(inputTexture, vTex); } `}m(){let e=this.g;if(this.h=G(e.createProgram(),`Failed to create WebGL program`),this.X=Ts(this,` attribute vec2 aVertex; attribute vec2 aTex; varying vec2 vTex; void main(void) { gl_Position = vec4(aVertex, 0.0, 1.0); vTex = aTex; }`,e.VERTEX_SHADER),this.W=Ts(this,this.H(),e.FRAGMENT_SHADER),e.linkProgram(this.h),!e.getProgramParameter(this.h,e.LINK_STATUS))throw Error(`Error during program linking: ${e.getProgramInfoLog(this.h)}`);this.O=e.getAttribLocation(this.h,`aVertex`),this.L=e.getAttribLocation(this.h,`aTex`)}D(){}l(){}close(){if(this.h){let e=this.g;e.deleteProgram(this.h),e.deleteShader(this.X),e.deleteShader(this.W)}this.B&&this.g.deleteFramebuffer(this.B),this.A&&this.A.close(),this.u&&this.u.close()}},Ns=class extends Ms{H(){return` precision mediump float; uniform sampler2D backgroundTexture; uniform sampler2D maskTexture; uniform sampler2D colorMappingTexture; varying vec2 vTex; void main() { vec4 backgroundColor = texture2D(backgroundTexture, vTex); float category = texture2D(maskTexture, vTex).r; vec4 categoryColor = texture2D(colorMappingTexture, vec2(category, 0.0)); gl_FragColor = mix(backgroundColor, categoryColor, categoryColor.a); } `}D(){let e=this.g;e.activeTexture(e.TEXTURE1),this.C=ks(this,e,e.LINEAR),e.activeTexture(e.TEXTURE2),this.j=ks(this,e,e.NEAREST)}m(){super.m();let e=this.g;this.P=G(e.getUniformLocation(this.h,`backgroundTexture`),`Uniform location`),this.U=G(e.getUniformLocation(this.h,`colorMappingTexture`),`Uniform location`),this.M=G(e.getUniformLocation(this.h,`maskTexture`),`Uniform location`)}l(){super.l();let e=this.g;e.uniform1i(this.M,0),e.uniform1i(this.P,1),e.uniform1i(this.U,2)}close(){this.C&&this.g.deleteTexture(this.C),this.j&&this.g.deleteTexture(this.j),super.close()}},Ps=class extends Ms{H(){return` precision mediump float; uniform sampler2D maskTexture; uniform sampler2D defaultTexture; uniform sampler2D overlayTexture; varying vec2 vTex; void main() { float confidence = texture2D(maskTexture, vTex).r; vec4 defaultColor = texture2D(defaultTexture, vTex); vec4 overlayColor = texture2D(overlayTexture, vTex); // Apply the alpha from the overlay and merge in the default color overlayColor = mix(defaultColor, overlayColor, overlayColor.a); gl_FragColor = mix(defaultColor, overlayColor, confidence); } `}D(){let e=this.g;e.activeTexture(e.TEXTURE1),this.j=ks(this,e),e.activeTexture(e.TEXTURE2),this.C=ks(this,e)}m(){super.m();let e=this.g;this.M=G(e.getUniformLocation(this.h,`defaultTexture`),`Uniform location`),this.P=G(e.getUniformLocation(this.h,`overlayTexture`),`Uniform location`),this.I=G(e.getUniformLocation(this.h,`maskTexture`),`Uniform location`)}l(){super.l();let e=this.g;e.uniform1i(this.I,0),e.uniform1i(this.M,1),e.uniform1i(this.P,2)}close(){this.j&&this.g.deleteTexture(this.j),this.C&&this.g.deleteTexture(this.C),super.close()}};function Fs(e,t){switch(t){case 0:return e.g.find((e=>e instanceof Uint8Array));case 1:return e.g.find((e=>e instanceof Float32Array));case 2:return e.g.find((e=>typeof WebGLTexture<`u`&&e instanceof WebGLTexture));default:throw Error(`Type is not supported: ${t}`)}}function Is(e){var t=Fs(e,1);if(!t){if(t=Fs(e,0))t=new Float32Array(t).map((e=>e/255));else{t=new Float32Array(e.width*e.height);let r=Rs(e);var n=Bs(e);if(As(n,r,Ls(e)),`iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod`.split(`;`).includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&`document`in self&&`ontouchend`in self.document){n=new Float32Array(e.width*e.height*4),r.readPixels(0,0,e.width,e.height,r.RGBA,r.FLOAT,n);for(let e=0,r=0;eMath.round(255*e)))),e.g.push(t)),t;var e,t}ia(){return Is(this)}N(){return Ls(this)}clone(){let e=[];for(let t of this.g){let n;if(t instanceof Uint8Array)n=new Uint8Array(t);else if(t instanceof Float32Array)n=new Float32Array(t);else{if(!(t instanceof WebGLTexture))throw Error(`Type is not supported: ${t}`);{let e=Rs(this),t=Bs(this);e.activeTexture(e.TEXTURE1),n=ks(t,e,this.m?e.LINEAR:e.NEAREST),e.bindTexture(e.TEXTURE_2D,n);let r=zs(this);e.texImage2D(e.TEXTURE_2D,0,r,this.width,this.height,0,e.RED,e.FLOAT,null),e.bindTexture(e.TEXTURE_2D,null),As(t,e,n),Os(t,e,!1,(()=>{Vs(this),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),Hs(this)})),js(t),Hs(this)}}e.push(n)}return new K(e,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Rs(this).deleteTexture(Fs(this,2)),Ws=-1}};K.prototype.close=K.prototype.close,K.prototype.clone=K.prototype.clone,K.prototype.getAsWebGLTexture=K.prototype.N,K.prototype.getAsFloat32Array=K.prototype.ia,K.prototype.getAsUint8Array=K.prototype.ja,K.prototype.hasWebGLTexture=K.prototype.R,K.prototype.hasFloat32Array=K.prototype.ka,K.prototype.hasUint8Array=K.prototype.Fa;var Ws=250,Gs={color:`white`,lineWidth:4,radius:6};function Ks(e){return{...Gs,fillColor:(e||={}).color,...e}}function qs(e,t){return e instanceof Function?e(t):e}function Js(e,t,n){return Math.max(Math.min(t,n),Math.min(Math.max(t,n),e))}function Ys(e){if(!e.l)throw Error(`CPU rendering requested but CanvasRenderingContext2D not provided.`);return e.l}function Xs(e){if(!e.j)throw Error(`GPU rendering requested but WebGL2RenderingContext not provided.`);return e.j}function Zs(e,t,n){if(t.R())n(t.N());else{let r=t.ka()?t.ia():t.ja();e.m=e.m??new Ms;let i=Xs(e);n((e=new K([r],t.m,!1,i.canvas,e.m,t.width,t.height)).N()),e.close()}}function Qs(e,t,n,r){let i=function(e){return e.g||=new Ns,e.g}(e),a=Xs(e),o=Array.isArray(n)?new ImageData(new Uint8ClampedArray(n),1,1):n;Os(i,a,!0,(()=>{(function(e,t,n,r){let i=e.g;if(i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,t),i.activeTexture(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,e.C),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,n),e.I&&function(e,t){if(e!==t)return!1;e=e.entries(),t=t.entries();for(let[r,i]of e){e=r;let a=i;var n=t.next();if(n.done)return!1;let[o,s]=n.value;if(n=s,e!==o||a[0]!==n[0]||a[1]!==n[1]||a[2]!==n[2]||a[3]!==n[3])return!1}return!!t.next().done}(e.I,r))i.activeTexture(i.TEXTURE2),i.bindTexture(i.TEXTURE_2D,e.j);else{e.I=r;let t=Array(1024).fill(0);r.forEach(((e,n)=>{if(e.length!==4)throw Error(`Color at index ${n} is not a four-channel value.`);t[4*n]=e[0],t[4*n+1]=e[1],t[4*n+2]=e[2],t[4*n+3]=e[3]})),i.activeTexture(i.TEXTURE2),i.bindTexture(i.TEXTURE_2D,e.j),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,256,1,0,i.RGBA,i.UNSIGNED_BYTE,new Uint8Array(t))}})(i,t,o,r),a.clearColor(0,0,0,0),a.clear(a.COLOR_BUFFER_BIT),a.drawArrays(a.TRIANGLE_FAN,0,4);let e=i.g;e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,null),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,null),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,null)}))}function $s(e,t,n,r){let i=Xs(e),a=function(e){return e.h||=new Ps,e.h}(e),o=Array.isArray(n)?new ImageData(new Uint8ClampedArray(n),1,1):n,s=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r;Os(a,i,!0,(()=>{var e=a.g;e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,t),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,a.j),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,o),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,a.C),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,s),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),i.bindTexture(i.TEXTURE_2D,null),(e=a.g).activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,null),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,null),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,null)}))}var q=class{constructor(e,t){typeof CanvasRenderingContext2D<`u`&&e instanceof CanvasRenderingContext2D||e instanceof OffscreenCanvasRenderingContext2D?(this.l=e,this.j=t):this.j=e}ya(e,t){if(e){var n=Ys(this);t=Ks(t),n.save();var r=n.canvas,i=0;for(let a of e)n.fillStyle=qs(t.fillColor,{index:i,from:a}),n.strokeStyle=qs(t.color,{index:i,from:a}),n.lineWidth=qs(t.lineWidth,{index:i,from:a}),(e=new Path2D).arc(a.x*r.width,a.y*r.height,qs(t.radius,{index:i,from:a}),0,2*Math.PI),n.fill(e),n.stroke(e),++i;n.restore()}}xa(e,t,n){if(e&&t){var r=Ys(this);n=Ks(n),r.save();var i=r.canvas,a=0;for(let o of t){r.beginPath(),t=e[o.start];let s=e[o.end];t&&s&&(r.strokeStyle=qs(n.color,{index:a,from:t,to:s}),r.lineWidth=qs(n.lineWidth,{index:a,from:t,to:s}),r.moveTo(t.x*i.width,t.y*i.height),r.lineTo(s.x*i.width,s.y*i.height)),++a,r.stroke()}r.restore()}}ua(e,t){let n=Ys(this);t=Ks(t),n.save(),n.beginPath(),n.lineWidth=qs(t.lineWidth,{}),n.strokeStyle=qs(t.color,{}),n.fillStyle=qs(t.fillColor,{}),n.moveTo(e.originX,e.originY),n.lineTo(e.originX+e.width,e.originY),n.lineTo(e.originX+e.width,e.originY+e.height),n.lineTo(e.originX,e.originY+e.height),n.lineTo(e.originX,e.originY),n.stroke(),n.fill(),n.restore()}va(e,t,n=[0,0,0,255]){this.l?function(e,t,n,r){let i=Xs(e);Zs(e,t,(t=>{Qs(e,t,n,r),(t=Ys(e)).drawImage(i.canvas,0,0,t.canvas.width,t.canvas.height)}))}(this,e,n,t):Qs(this,e.N(),n,t)}wa(e,t,n){this.l?function(e,t,n,r){let i=Xs(e);Zs(e,t,(t=>{$s(e,t,n,r),(t=Ys(e)).drawImage(i.canvas,0,0,t.canvas.width,t.canvas.height)}))}(this,e,t,n):$s(this,e.N(),t,n)}close(){this.g?.close(),this.g=void 0,this.h?.close(),this.h=void 0,this.m?.close(),this.m=void 0}};function ec(e,t){switch(t){case 0:return e.g.find((e=>e instanceof ImageData));case 1:return e.g.find((e=>typeof ImageBitmap<`u`&&e instanceof ImageBitmap));case 2:return e.g.find((e=>typeof WebGLTexture<`u`&&e instanceof WebGLTexture));default:throw Error(`Type is not supported: ${t}`)}}function tc(e){var t=ec(e,0);if(!t){t=rc(e);let n=ic(e),r=new Uint8Array(e.width*e.height*4);As(n,t,nc(e)),t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,r),js(n),t=new ImageData(new Uint8ClampedArray(r.buffer),e.width,e.height),e.g.push(t)}return t}function nc(e){let t=ec(e,2);if(!t){let n=rc(e);t=ac(e);let r=ec(e,1)||tc(e);n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,r),oc(e)}return t}function rc(e){if(!e.canvas)throw Error(`Conversion to different image formats require that a canvas is passed when initializing the image.`);return e.h||=G(e.canvas.getContext(`webgl2`),`You cannot use a canvas that is already bound to a different type of rendering context.`),e.h}function ic(e){return e.l||=new Ms,e.l}function ac(e){let t=rc(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let n=ec(e,2);return n||(n=ks(ic(e),t),e.g.push(n),e.m=!0),t.bindTexture(t.TEXTURE_2D,n),n}function oc(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}function sc(e){let t=rc(e);return Os(ic(e),t,!0,(()=>function(e,t){let n=e.canvas;if(n.width===e.width&&n.height===e.height)return t();let r=n.width,i=n.height;return n.width=e.width,n.height=e.height,e=t(),n.width=r,n.height=i,e}(e,(()=>{if(t.bindFramebuffer(t.FRAMEBUFFER,null),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),!(e.canvas instanceof OffscreenCanvas))throw Error(`Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas`);return e.canvas.transferToImageBitmap()}))))}q.prototype.close=q.prototype.close,q.prototype.drawConfidenceMask=q.prototype.wa,q.prototype.drawCategoryMask=q.prototype.va,q.prototype.drawBoundingBox=q.prototype.ua,q.prototype.drawConnectors=q.prototype.xa,q.prototype.drawLandmarks=q.prototype.ya,q.lerp=function(e,t,n,r,i){return Js(r*(1-(e-t)/(n-t))+i*(1-(n-e)/(n-t)),r,i)},q.clamp=Js;var J=class{constructor(e,t,n,r,i,a,o){this.g=e,this.j=t,this.m=n,this.canvas=r,this.l=i,this.width=a,this.height=o,(this.j||this.m)&&--cc===0&&console.error(`You seem to be creating MPImage instances without invoking .close(). This leaks resources.`)}Ea(){return!!ec(this,0)}la(){return!!ec(this,1)}R(){return!!ec(this,2)}Ca(){return tc(this)}Ba(){var e=ec(this,1);return e||(nc(this),ac(this),e=sc(this),oc(this),this.g.push(e),this.j=!0),e}N(){return nc(this)}clone(){let e=[];for(let t of this.g){let n;if(t instanceof ImageData)n=new ImageData(t.data,this.width,this.height);else if(t instanceof WebGLTexture){let e=rc(this),t=ic(this);e.activeTexture(e.TEXTURE1),n=ks(t,e),e.bindTexture(e.TEXTURE_2D,n),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,this.width,this.height,0,e.RGBA,e.UNSIGNED_BYTE,null),e.bindTexture(e.TEXTURE_2D,null),As(t,e,n),Os(t,e,!1,(()=>{ac(this),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),oc(this)})),js(t),oc(this)}else{if(!(t instanceof ImageBitmap))throw Error(`Type is not supported: ${t}`);nc(this),ac(this),n=sc(this),oc(this)}e.push(n)}return new J(e,this.la(),this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&ec(this,1).close(),this.m&&rc(this).deleteTexture(ec(this,2)),cc=-1}};J.prototype.close=J.prototype.close,J.prototype.clone=J.prototype.clone,J.prototype.getAsWebGLTexture=J.prototype.N,J.prototype.getAsImageBitmap=J.prototype.Ba,J.prototype.getAsImageData=J.prototype.Ca,J.prototype.hasWebGLTexture=J.prototype.R,J.prototype.hasImageBitmap=J.prototype.la,J.prototype.hasImageData=J.prototype.Ea;var cc=250;function lc(...e){return e.map((([e,t])=>({start:e,end:t})))}var uc=function(e){return class extends e{Ja(){this.i._registerModelResourcesGraphService()}}}((dc=class{constructor(e,t){this.l=!0,this.i=e,this.g=null,this.h=0,this.m=typeof this.i._addIntToInputStream==`function`,t===void 0?us()?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`)):this.i.canvas=t}async initializeGraph(e){let t=await(await fetch(e)).arrayBuffer();e=!(e.endsWith(`.pbtxt`)||e.endsWith(`.textproto`)),this.setGraph(new Uint8Array(t),e)}setGraphFromString(e){this.setGraph(new TextEncoder().encode(e),!1)}setGraph(e,t){let n=e.length,r=this.i._malloc(n);this.i.HEAPU8.set(e,r),t?this.i._changeBinaryGraph(n,r):this.i._changeTextGraph(n,r),this.i._free(r)}configureAudio(e,t,n,r,i){this.i._configureAudio||console.warn(`Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?`),U(this,r||`input_audio`,(r=>{U(this,i||=`audio_header`,(i=>{this.i._configureAudio(r,i,e,t??0,n)}))}))}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}ca(e){hs(this,`__graph_config__`,(t=>{e(t)})),U(this,`__graph_config__`,(e=>{this.i._getGraphConfig(e,void 0)})),delete this.i.simpleListeners.__graph_config__}attachErrorListener(e){this.i.errorListener=e}attachEmptyPacketListener(e,t){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[e]=t}addAudioToStream(e,t,n){this.addAudioToStreamWithShape(e,0,0,t,n)}addAudioToStreamWithShape(e,t,n,r,i){let a=4*e.length;this.h!==a&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(a),this.h=a),this.i.HEAPF32.set(e,this.g/4),U(this,r,(e=>{this.i._addAudioToInputStream(this.g,t,n,e,i)}))}addGpuBufferToStream(e,t,n){U(this,t,(t=>{let[r,i]=ps(this,e,t);this.i._addBoundTextureToStream(t,r,i,n)}))}addBoolToStream(e,t,n){U(this,t,(t=>{this.i._addBoolToInputStream(e,t,n)}))}addDoubleToStream(e,t,n){U(this,t,(t=>{this.i._addDoubleToInputStream(e,t,n)}))}addFloatToStream(e,t,n){U(this,t,(t=>{this.i._addFloatToInputStream(e,t,n)}))}addIntToStream(e,t,n){U(this,t,(t=>{this.i._addIntToInputStream(e,t,n)}))}addUintToStream(e,t,n){U(this,t,(t=>{this.i._addUintToInputStream(e,t,n)}))}addStringToStream(e,t,n){U(this,t,(t=>{U(this,e,(e=>{this.i._addStringToInputStream(e,t,n)}))}))}addStringRecordToStream(e,t,n){U(this,t,(t=>{ms(this,Object.keys(e),(r=>{ms(this,Object.values(e),(i=>{this.i._addFlatHashMapToInputStream(r,i,Object.keys(e).length,t,n)}))}))}))}addProtoToStream(e,t,n,r){U(this,n,(n=>{U(this,t,(t=>{let i=this.i._malloc(e.length);this.i.HEAPU8.set(e,i),this.i._addProtoToInputStream(i,e.length,t,n,r),this.i._free(i)}))}))}addEmptyPacketToStream(e,t){U(this,e,(e=>{this.i._addEmptyPacketToInputStream(e,t)}))}addBoolVectorToStream(e,t,n){U(this,t,(t=>{let r=this.i._allocateBoolVector(e.length);if(!r)throw Error(`Unable to allocate new bool vector on heap.`);for(let t of e)this.i._addBoolVectorEntry(r,t);this.i._addBoolVectorToInputStream(r,t,n)}))}addDoubleVectorToStream(e,t,n){U(this,t,(t=>{let r=this.i._allocateDoubleVector(e.length);if(!r)throw Error(`Unable to allocate new double vector on heap.`);for(let t of e)this.i._addDoubleVectorEntry(r,t);this.i._addDoubleVectorToInputStream(r,t,n)}))}addFloatVectorToStream(e,t,n){U(this,t,(t=>{let r=this.i._allocateFloatVector(e.length);if(!r)throw Error(`Unable to allocate new float vector on heap.`);for(let t of e)this.i._addFloatVectorEntry(r,t);this.i._addFloatVectorToInputStream(r,t,n)}))}addIntVectorToStream(e,t,n){U(this,t,(t=>{let r=this.i._allocateIntVector(e.length);if(!r)throw Error(`Unable to allocate new int vector on heap.`);for(let t of e)this.i._addIntVectorEntry(r,t);this.i._addIntVectorToInputStream(r,t,n)}))}addUintVectorToStream(e,t,n){U(this,t,(t=>{let r=this.i._allocateUintVector(e.length);if(!r)throw Error(`Unable to allocate new unsigned int vector on heap.`);for(let t of e)this.i._addUintVectorEntry(r,t);this.i._addUintVectorToInputStream(r,t,n)}))}addStringVectorToStream(e,t,n){U(this,t,(t=>{let r=this.i._allocateStringVector(e.length);if(!r)throw Error(`Unable to allocate new string vector on heap.`);for(let t of e)U(this,t,(e=>{this.i._addStringVectorEntry(r,e)}));this.i._addStringVectorToInputStream(r,t,n)}))}addBoolToInputSidePacket(e,t){U(this,t,(t=>{this.i._addBoolToInputSidePacket(e,t)}))}addDoubleToInputSidePacket(e,t){U(this,t,(t=>{this.i._addDoubleToInputSidePacket(e,t)}))}addFloatToInputSidePacket(e,t){U(this,t,(t=>{this.i._addFloatToInputSidePacket(e,t)}))}addIntToInputSidePacket(e,t){U(this,t,(t=>{this.i._addIntToInputSidePacket(e,t)}))}addUintToInputSidePacket(e,t){U(this,t,(t=>{this.i._addUintToInputSidePacket(e,t)}))}addStringToInputSidePacket(e,t){U(this,t,(t=>{U(this,e,(e=>{this.i._addStringToInputSidePacket(e,t)}))}))}addProtoToInputSidePacket(e,t,n){U(this,n,(n=>{U(this,t,(t=>{let r=this.i._malloc(e.length);this.i.HEAPU8.set(e,r),this.i._addProtoToInputSidePacket(r,e.length,t,n),this.i._free(r)}))}))}addBoolVectorToInputSidePacket(e,t){U(this,t,(t=>{let n=this.i._allocateBoolVector(e.length);if(!n)throw Error(`Unable to allocate new bool vector on heap.`);for(let t of e)this.i._addBoolVectorEntry(n,t);this.i._addBoolVectorToInputSidePacket(n,t)}))}addDoubleVectorToInputSidePacket(e,t){U(this,t,(t=>{let n=this.i._allocateDoubleVector(e.length);if(!n)throw Error(`Unable to allocate new double vector on heap.`);for(let t of e)this.i._addDoubleVectorEntry(n,t);this.i._addDoubleVectorToInputSidePacket(n,t)}))}addFloatVectorToInputSidePacket(e,t){U(this,t,(t=>{let n=this.i._allocateFloatVector(e.length);if(!n)throw Error(`Unable to allocate new float vector on heap.`);for(let t of e)this.i._addFloatVectorEntry(n,t);this.i._addFloatVectorToInputSidePacket(n,t)}))}addIntVectorToInputSidePacket(e,t){U(this,t,(t=>{let n=this.i._allocateIntVector(e.length);if(!n)throw Error(`Unable to allocate new int vector on heap.`);for(let t of e)this.i._addIntVectorEntry(n,t);this.i._addIntVectorToInputSidePacket(n,t)}))}addUintVectorToInputSidePacket(e,t){U(this,t,(t=>{let n=this.i._allocateUintVector(e.length);if(!n)throw Error(`Unable to allocate new unsigned int vector on heap.`);for(let t of e)this.i._addUintVectorEntry(n,t);this.i._addUintVectorToInputSidePacket(n,t)}))}addStringVectorToInputSidePacket(e,t){U(this,t,(t=>{let n=this.i._allocateStringVector(e.length);if(!n)throw Error(`Unable to allocate new string vector on heap.`);for(let t of e)U(this,t,(e=>{this.i._addStringVectorEntry(n,e)}));this.i._addStringVectorToInputSidePacket(n,t)}))}attachBoolListener(e,t){hs(this,e,t),U(this,e,(e=>{this.i._attachBoolListener(e)}))}attachBoolVectorListener(e,t){gs(this,e,t),U(this,e,(e=>{this.i._attachBoolVectorListener(e)}))}attachIntListener(e,t){hs(this,e,t),U(this,e,(e=>{this.i._attachIntListener(e)}))}attachIntVectorListener(e,t){gs(this,e,t),U(this,e,(e=>{this.i._attachIntVectorListener(e)}))}attachUintListener(e,t){hs(this,e,t),U(this,e,(e=>{this.i._attachUintListener(e)}))}attachUintVectorListener(e,t){gs(this,e,t),U(this,e,(e=>{this.i._attachUintVectorListener(e)}))}attachDoubleListener(e,t){hs(this,e,t),U(this,e,(e=>{this.i._attachDoubleListener(e)}))}attachDoubleVectorListener(e,t){gs(this,e,t),U(this,e,(e=>{this.i._attachDoubleVectorListener(e)}))}attachFloatListener(e,t){hs(this,e,t),U(this,e,(e=>{this.i._attachFloatListener(e)}))}attachFloatVectorListener(e,t){gs(this,e,t),U(this,e,(e=>{this.i._attachFloatVectorListener(e)}))}attachStringListener(e,t){hs(this,e,t),U(this,e,(e=>{this.i._attachStringListener(e)}))}attachStringVectorListener(e,t){gs(this,e,t),U(this,e,(e=>{this.i._attachStringVectorListener(e)}))}attachProtoListener(e,t,n){hs(this,e,t),U(this,e,(e=>{this.i._attachProtoListener(e,n||!1)}))}attachProtoVectorListener(e,t,n){gs(this,e,t),U(this,e,(e=>{this.i._attachProtoVectorListener(e,n||!1)}))}attachAudioListener(e,t,n){this.i._attachAudioListener||console.warn(`Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?`),hs(this,e,((e,n)=>{e=new Float32Array(e.buffer,e.byteOffset,e.length/4),t(e,n)})),U(this,e,(e=>{this.i._attachAudioListener(e,n||!1)}))}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends dc{get ga(){return this.i}pa(e,t,n){U(this,t,(t=>{let[r,i]=ps(this,e,t);this.ga._addBoundTextureAsImageToStream(t,r,i,n)}))}Z(e,t){hs(this,e,t),U(this,e,(e=>{this.ga._attachImageListener(e)}))}aa(e,t){gs(this,e,t),U(this,e,(e=>{this.ga._attachImageVectorListener(e)}))}})),dc,fc=class extends uc{};async function Y(e,t,n){return async function(e,t,n,r){return _s(e,t,n,r)}(e,n.canvas??(us()?void 0:document.createElement(`canvas`)),t,n)}function pc(e,t,n,r){if(e.U){let a=new Va;if(n?.regionOfInterest){if(!e.oa)throw Error(`This task doesn't support region-of-interest.`);var i=n.regionOfInterest;if(i.left>=i.right||i.top>=i.bottom)throw Error(`Expected RectF with left < right and top < bottom.`);if(i.left<0||i.top<0||i.right>1||i.bottom>1)throw Error(`Expected RectF values to be in [0,1].`);C(a,1,(i.left+i.right)/2),C(a,2,(i.top+i.bottom)/2),C(a,4,i.right-i.left),C(a,3,i.bottom-i.top)}else C(a,1,.5),C(a,2,.5),C(a,4,1),C(a,3,1);if(n?.rotationDegrees){if(n?.rotationDegrees%90!=0)throw Error(`Expected rotation to be a multiple of 90°.`);if(C(a,5,-Math.PI*n.rotationDegrees/180),n?.rotationDegrees%180!=0){let[e,r]=fs(t);n=S(a,3)*r/e,i=S(a,4)*e/r,C(a,4,n),C(a,3,i)}}e.g.addProtoToStream(a.g(),`mediapipe.NormalizedRect`,e.U,r)}e.g.pa(t,e.X,r??performance.now()),e.finishProcessing()}function mc(e,t,n){if(e.baseOptions?.g())throw Error(`Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.`);pc(e,t,n,e.C+1)}function hc(e,t,n,r){if(!e.baseOptions?.g())throw Error(`Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.`);pc(e,t,n,r)}function gc(e,t,n,r){var i=t.data;let a=t.width,o=a*(t=t.height);if((i instanceof Uint8Array||i instanceof Float32Array)&&i.length!==o)throw Error(`Unsupported channel count: `+i.length/o);return e=new K([i],n,!1,e.g.i.canvas,e.P,a,t),r?e.clone():e}var _c=class extends Cs{constructor(e,t,n,r){super(e),this.g=e,this.X=t,this.U=n,this.oa=r,this.P=new Ms}l(e,t=!0){if(`runningMode`in e&&v(this.baseOptions,2,Ft(!!e.runningMode&&e.runningMode!==`IMAGE`)),e.canvas!==void 0&&this.g.i.canvas!==e.canvas)throw Error(`You must create a new task to reset the canvas.`);return super.l(e,t)}close(){this.P.close(),super.close()}};_c.prototype.close=_c.prototype.close;var vc=class extends _c{constructor(e,t){super(new fc(e,t),`image_in`,`norm_rect_in`,!1),this.j={detections:[]},x(e=this.h=new ro,0,1,t=new V),C(this.h,2,.5),C(this.h,3,.3)}get baseOptions(){return b(this.h,V,1)}set baseOptions(e){x(this.h,0,1,e)}o(e){return`minDetectionConfidence`in e&&C(this.h,2,e.minDetectionConfidence??.5),`minSuppressionThreshold`in e&&C(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}F(e,t){return this.j={detections:[]},mc(this,e,t),this.j}G(e,t,n){return this.j={detections:[]},hc(this,e,n,t),this.j}m(){var e=new wa;z(e,`image_in`),z(e,`norm_rect_in`),B(e,`detections`);let t=new va;ri(t,ao,this.h);let n=new R;ar(n,2,`mediapipe.tasks.vision.face_detector.FaceDetectorGraph`),I(n,`IMAGE:image_in`),I(n,`NORM_RECT:norm_rect_in`),L(n,`DETECTIONS:detections`),n.o(t),Ca(e,n),this.g.attachProtoVectorListener(`detections`,((e,t)=>{for(let t of e)e=Pa(t),this.j.detections.push(es(e));W(this,t)})),this.g.attachEmptyPacketListener(`detections`,(e=>{W(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};vc.prototype.detectForVideo=vc.prototype.G,vc.prototype.detect=vc.prototype.F,vc.prototype.setOptions=vc.prototype.o,vc.createFromModelPath=async function(e,t){return Y(vc,e,{baseOptions:{modelAssetPath:t}})},vc.createFromModelBuffer=function(e,t){return Y(vc,e,{baseOptions:{modelAssetBuffer:t}})},vc.createFromOptions=function(e,t){return Y(vc,e,t)};var yc=lc([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]),bc=lc([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]),xc=lc([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),Sc=lc([474,475],[475,476],[476,477],[477,474]),Cc=lc([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]),wc=lc([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),Tc=lc([469,470],[470,471],[471,472],[472,469]),Ec=lc([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]),Dc=[...yc,...bc,...xc,...Cc,...wc,...Ec],Oc=lc([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 kc(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var X=class extends _c{constructor(e,t){super(new fc(e,t),`image_in`,`norm_rect`,!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,x(e=this.h=new co,0,1,t=new V),this.A=new so,x(this.h,0,3,this.A),this.u=new ro,x(this.h,0,2,this.u),ir(this.u,4,1),C(this.u,2,.5),C(this.A,2,.5),C(this.h,4,.5)}get baseOptions(){return b(this.h,V,1)}set baseOptions(e){x(this.h,0,1,e)}o(e){return`numFaces`in e&&ir(this.u,4,e.numFaces??1),`minFaceDetectionConfidence`in e&&C(this.u,2,e.minFaceDetectionConfidence??.5),`minTrackingConfidence`in e&&C(this.h,4,e.minTrackingConfidence??.5),`minFacePresenceConfidence`in e&&C(this.A,2,e.minFacePresenceConfidence??.5),`outputFaceBlendshapes`in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),`outputFacialTransformationMatrixes`in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.l(e)}F(e,t){return kc(this),mc(this,e,t),this.j}G(e,t,n){return kc(this),hc(this,e,n,t),this.j}m(){var e=new wa;z(e,`image_in`),z(e,`norm_rect`),B(e,`face_landmarks`);let t=new va;ri(t,uo,this.h);let n=new R;ar(n,2,`mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph`),I(n,`IMAGE:image_in`),I(n,`NORM_RECT:norm_rect`),L(n,`NORM_LANDMARKS:face_landmarks`),n.o(t),Ca(e,n),this.g.attachProtoVectorListener(`face_landmarks`,((e,t)=>{for(let t of e)e=Ra(t),this.j.faceLandmarks.push(ts(e));W(this,t)})),this.g.attachEmptyPacketListener(`face_landmarks`,(e=>{W(this,e)})),this.outputFaceBlendshapes&&(B(e,`blendshapes`),L(n,`BLENDSHAPES:blendshapes`),this.g.attachProtoVectorListener(`blendshapes`,((e,t)=>{if(this.outputFaceBlendshapes)for(let t of e)e=Aa(t),this.j.faceBlendshapes.push(Qo(e.g()??[]));W(this,t)})),this.g.attachEmptyPacketListener(`blendshapes`,(e=>{W(this,e)}))),this.outputFacialTransformationMatrixes&&(B(e,`face_geometry`),L(n,`FACE_GEOMETRY:face_geometry`),this.g.attachProtoVectorListener(`face_geometry`,((e,t)=>{if(this.outputFacialTransformationMatrixes)for(let t of e)(e=b(e=oo(t),za,2))&&this.j.facialTransformationMatrixes.push({rows:rr(e,1)??0??0,columns:rr(e,2)??0??0,data:In(e,3,Pt,Fn()).slice()??[]});W(this,t)})),this.g.attachEmptyPacketListener(`face_geometry`,(e=>{W(this,e)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};X.prototype.detectForVideo=X.prototype.G,X.prototype.detect=X.prototype.F,X.prototype.setOptions=X.prototype.o,X.createFromModelPath=function(e,t){return Y(X,e,{baseOptions:{modelAssetPath:t}})},X.createFromModelBuffer=function(e,t){return Y(X,e,{baseOptions:{modelAssetBuffer:t}})},X.createFromOptions=function(e,t){return Y(X,e,t)},X.FACE_LANDMARKS_LIPS=yc,X.FACE_LANDMARKS_LEFT_EYE=bc,X.FACE_LANDMARKS_LEFT_EYEBROW=xc,X.FACE_LANDMARKS_LEFT_IRIS=Sc,X.FACE_LANDMARKS_RIGHT_EYE=Cc,X.FACE_LANDMARKS_RIGHT_EYEBROW=wc,X.FACE_LANDMARKS_RIGHT_IRIS=Tc,X.FACE_LANDMARKS_FACE_OVAL=Ec,X.FACE_LANDMARKS_CONTOURS=Dc,X.FACE_LANDMARKS_TESSELATION=Oc;var Ac=lc([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 jc(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function Mc(e){return e.gestures.length===0?{gestures:[],landmarks:[],worldLandmarks:[],handedness:[],handednesses:[]}:{gestures:e.gestures,landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handedness:e.handedness,handednesses:e.handedness}}function Nc(e,t=!0){let n=[];for(let i of e){var r=Aa(i);e=[];for(let n of r.g())r=t&&rr(n,1)!=null?rr(n,1)??0:-1,e.push({score:S(n,2)??0,index:r,categoryName:g(_(n,3))??``??``,displayName:g(_(n,4))??``??``});n.push(e)}return n}var Pc=class extends _c{constructor(e,t){super(new fc(e,t),`image_in`,`norm_rect`,!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],x(e=this.j=new vo,0,1,t=new V),this.u=new _o,x(this.j,0,2,this.u),this.D=new go,x(this.u,0,3,this.D),this.A=new ho,x(this.u,0,2,this.A),this.h=new mo,x(this.j,0,3,this.h),C(this.A,2,.5),C(this.u,4,.5),C(this.D,2,.5)}get baseOptions(){return b(this.j,V,1)}set baseOptions(e){x(this.j,0,1,e)}o(e){if(ir(this.A,3,e.numHands??1),`minHandDetectionConfidence`in e&&C(this.A,2,e.minHandDetectionConfidence??.5),`minTrackingConfidence`in e&&C(this.u,4,e.minTrackingConfidence??.5),`minHandPresenceConfidence`in e&&C(this.D,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new fo,n=t,r=Xo(e.cannedGesturesClassifierOptions,b(this.h,fo,3)?.l());x(n,0,2,r),x(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&b(this.h,fo,3)?.g();return e.customGesturesClassifierOptions?(x(n=t=new fo,0,2,r=Xo(e.customGesturesClassifierOptions,b(this.h,fo,4)?.l())),x(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&b(this.h,fo,4)?.g(),this.l(e)}Ha(e,t){return jc(this),mc(this,e,t),Mc(this)}Ia(e,t,n){return jc(this),hc(this,e,n,t),Mc(this)}m(){var e=new wa;z(e,`image_in`),z(e,`norm_rect`),B(e,`hand_gestures`),B(e,`hand_landmarks`),B(e,`world_hand_landmarks`),B(e,`handedness`);let t=new va;ri(t,Co,this.j);let n=new R;ar(n,2,`mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph`),I(n,`IMAGE:image_in`),I(n,`NORM_RECT:norm_rect`),L(n,`HAND_GESTURES:hand_gestures`),L(n,`LANDMARKS:hand_landmarks`),L(n,`WORLD_LANDMARKS:world_hand_landmarks`),L(n,`HANDEDNESS:handedness`),n.o(t),Ca(e,n),this.g.attachProtoVectorListener(`hand_landmarks`,((e,t)=>{for(let t of e){e=Ra(t);let n=[];for(let t of Qn(e,La,1))n.push({x:S(t,1)??0,y:S(t,2)??0,z:S(t,3)??0,visibility:S(t,4)??0});this.landmarks.push(n)}W(this,t)})),this.g.attachEmptyPacketListener(`hand_landmarks`,(e=>{W(this,e)})),this.g.attachProtoVectorListener(`world_hand_landmarks`,((e,t)=>{for(let t of e){e=Ia(t);let n=[];for(let t of Qn(e,Fa,1))n.push({x:S(t,1)??0,y:S(t,2)??0,z:S(t,3)??0,visibility:S(t,4)??0});this.worldLandmarks.push(n)}W(this,t)})),this.g.attachEmptyPacketListener(`world_hand_landmarks`,(e=>{W(this,e)})),this.g.attachProtoVectorListener(`hand_gestures`,((e,t)=>{this.gestures.push(...Nc(e,!1)),W(this,t)})),this.g.attachEmptyPacketListener(`hand_gestures`,(e=>{W(this,e)})),this.g.attachProtoVectorListener(`handedness`,((e,t)=>{this.handedness.push(...Nc(e)),W(this,t)})),this.g.attachEmptyPacketListener(`handedness`,(e=>{W(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function Fc(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}Pc.prototype.recognizeForVideo=Pc.prototype.Ia,Pc.prototype.recognize=Pc.prototype.Ha,Pc.prototype.setOptions=Pc.prototype.o,Pc.createFromModelPath=function(e,t){return Y(Pc,e,{baseOptions:{modelAssetPath:t}})},Pc.createFromModelBuffer=function(e,t){return Y(Pc,e,{baseOptions:{modelAssetBuffer:t}})},Pc.createFromOptions=function(e,t){return Y(Pc,e,t)},Pc.HAND_CONNECTIONS=Ac;var Ic=class extends _c{constructor(e,t){super(new fc(e,t),`image_in`,`norm_rect`,!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],x(e=this.h=new _o,0,1,t=new V),this.u=new go,x(this.h,0,3,this.u),this.j=new ho,x(this.h,0,2,this.j),ir(this.j,3,1),C(this.j,2,.5),C(this.u,2,.5),C(this.h,4,.5)}get baseOptions(){return b(this.h,V,1)}set baseOptions(e){x(this.h,0,1,e)}o(e){return`numHands`in e&&ir(this.j,3,e.numHands??1),`minHandDetectionConfidence`in e&&C(this.j,2,e.minHandDetectionConfidence??.5),`minTrackingConfidence`in e&&C(this.h,4,e.minTrackingConfidence??.5),`minHandPresenceConfidence`in e&&C(this.u,2,e.minHandPresenceConfidence??.5),this.l(e)}F(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],mc(this,e,t),Fc(this)}G(e,t,n){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],hc(this,e,n,t),Fc(this)}m(){var e=new wa;z(e,`image_in`),z(e,`norm_rect`),B(e,`hand_landmarks`),B(e,`world_hand_landmarks`),B(e,`handedness`);let t=new va;ri(t,wo,this.h);let n=new R;ar(n,2,`mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph`),I(n,`IMAGE:image_in`),I(n,`NORM_RECT:norm_rect`),L(n,`LANDMARKS:hand_landmarks`),L(n,`WORLD_LANDMARKS:world_hand_landmarks`),L(n,`HANDEDNESS:handedness`),n.o(t),Ca(e,n),this.g.attachProtoVectorListener(`hand_landmarks`,((e,t)=>{for(let t of e)e=Ra(t),this.landmarks.push(ts(e));W(this,t)})),this.g.attachEmptyPacketListener(`hand_landmarks`,(e=>{W(this,e)})),this.g.attachProtoVectorListener(`world_hand_landmarks`,((e,t)=>{for(let t of e)e=Ia(t),this.worldLandmarks.push(ns(e));W(this,t)})),this.g.attachEmptyPacketListener(`world_hand_landmarks`,(e=>{W(this,e)})),this.g.attachProtoVectorListener(`handedness`,((e,t)=>{var n=this.handedness,r=n.push;let i=[];for(let t of e){e=Aa(t);let n=[];for(let t of e.g())n.push({score:S(t,2)??0,index:rr(t,1)??0??-1,categoryName:g(_(t,3))??``??``,displayName:g(_(t,4))??``??``});i.push(n)}r.call(n,...i),W(this,t)})),this.g.attachEmptyPacketListener(`handedness`,(e=>{W(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ic.prototype.detectForVideo=Ic.prototype.G,Ic.prototype.detect=Ic.prototype.F,Ic.prototype.setOptions=Ic.prototype.o,Ic.createFromModelPath=function(e,t){return Y(Ic,e,{baseOptions:{modelAssetPath:t}})},Ic.createFromModelBuffer=function(e,t){return Y(Ic,e,{baseOptions:{modelAssetBuffer:t}})},Ic.createFromOptions=function(e,t){return Y(Ic,e,t)},Ic.HAND_CONNECTIONS=Ac;var Lc=lc([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 Rc(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function zc(e){try{if(!e.D)return e.h;e.D(e.h)}finally{Ss(e)}}function Bc(e,t){e=Ra(e),t.push(ts(e))}var Z=class extends _c{constructor(e,t){super(new fc(e,t),`input_frames_image`,null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,x(e=this.j=new Oo,0,1,t=new V),this.I=new go,x(this.j,0,2,this.I),this.W=new To,x(this.j,0,3,this.W),this.u=new ro,x(this.j,0,4,this.u),this.O=new so,x(this.j,0,5,this.O),this.A=new Eo,x(this.j,0,6,this.A),this.M=new Do,x(this.j,0,7,this.M),C(this.u,2,.5),C(this.u,3,.3),C(this.O,2,.5),C(this.A,2,.5),C(this.A,3,.3),C(this.M,2,.5),C(this.I,2,.5)}get baseOptions(){return b(this.j,V,1)}set baseOptions(e){x(this.j,0,1,e)}o(e){return`minFaceDetectionConfidence`in e&&C(this.u,2,e.minFaceDetectionConfidence??.5),`minFaceSuppressionThreshold`in e&&C(this.u,3,e.minFaceSuppressionThreshold??.3),`minFacePresenceConfidence`in e&&C(this.O,2,e.minFacePresenceConfidence??.5),`outputFaceBlendshapes`in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),`minPoseDetectionConfidence`in e&&C(this.A,2,e.minPoseDetectionConfidence??.5),`minPoseSuppressionThreshold`in e&&C(this.A,3,e.minPoseSuppressionThreshold??.3),`minPosePresenceConfidence`in e&&C(this.M,2,e.minPosePresenceConfidence??.5),`outputPoseSegmentationMasks`in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),`minHandLandmarksConfidence`in e&&C(this.I,2,e.minHandLandmarksConfidence??.5),this.l(e)}F(e,t,n){let r=typeof t==`function`?{}:t;return this.D=typeof t==`function`?t:n,Rc(this),mc(this,e,r),zc(this)}G(e,t,n,r){let i=typeof n==`function`?{}:n;return this.D=typeof n==`function`?n:r,Rc(this),hc(this,e,i,t),zc(this)}m(){var e=new wa;z(e,`input_frames_image`),B(e,`pose_landmarks`),B(e,`pose_world_landmarks`),B(e,`face_landmarks`),B(e,`left_hand_landmarks`),B(e,`left_hand_world_landmarks`),B(e,`right_hand_landmarks`),B(e,`right_hand_world_landmarks`);let t=new va,n=new ia;ar(n,1,`type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions`),function(e,t){if(t!=null)if(Array.isArray(t))v(e,2,mn(t,0,gn));else{if(!(typeof t==`string`||t instanceof ye||he(t)))throw Error(`invalid value in Any.value field: `+t+` expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array`);Un(e,2,Ye(t,!1),_e())}}(n,this.j.g());let r=new R;ar(r,2,`mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph`),nr(r,8,ia,n),I(r,`IMAGE:input_frames_image`),L(r,`POSE_LANDMARKS:pose_landmarks`),L(r,`POSE_WORLD_LANDMARKS:pose_world_landmarks`),L(r,`FACE_LANDMARKS:face_landmarks`),L(r,`LEFT_HAND_LANDMARKS:left_hand_landmarks`),L(r,`LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks`),L(r,`RIGHT_HAND_LANDMARKS:right_hand_landmarks`),L(r,`RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks`),r.o(t),Ca(e,r),bs(this,e),this.g.attachProtoListener(`pose_landmarks`,((e,t)=>{Bc(e,this.h.poseLandmarks),W(this,t)})),this.g.attachEmptyPacketListener(`pose_landmarks`,(e=>{W(this,e)})),this.g.attachProtoListener(`pose_world_landmarks`,((e,t)=>{var n=this.h.poseWorldLandmarks;e=Ia(e),n.push(ns(e)),W(this,t)})),this.g.attachEmptyPacketListener(`pose_world_landmarks`,(e=>{W(this,e)})),this.outputPoseSegmentationMasks&&(L(r,`POSE_SEGMENTATION_MASK:pose_segmentation_mask`),xs(this,`pose_segmentation_mask`),this.g.Z(`pose_segmentation_mask`,((e,t)=>{this.h.poseSegmentationMasks=[gc(this,e,!0,!this.D)],W(this,t)})),this.g.attachEmptyPacketListener(`pose_segmentation_mask`,(e=>{this.h.poseSegmentationMasks=[],W(this,e)}))),this.g.attachProtoListener(`face_landmarks`,((e,t)=>{Bc(e,this.h.faceLandmarks),W(this,t)})),this.g.attachEmptyPacketListener(`face_landmarks`,(e=>{W(this,e)})),this.outputFaceBlendshapes&&(B(e,`extra_blendshapes`),L(r,`FACE_BLENDSHAPES:extra_blendshapes`),this.g.attachProtoListener(`extra_blendshapes`,((e,t)=>{var n=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(e=Aa(e),n.push(Qo(e.g()??[]))),W(this,t)})),this.g.attachEmptyPacketListener(`extra_blendshapes`,(e=>{W(this,e)}))),this.g.attachProtoListener(`left_hand_landmarks`,((e,t)=>{Bc(e,this.h.leftHandLandmarks),W(this,t)})),this.g.attachEmptyPacketListener(`left_hand_landmarks`,(e=>{W(this,e)})),this.g.attachProtoListener(`left_hand_world_landmarks`,((e,t)=>{var n=this.h.leftHandWorldLandmarks;e=Ia(e),n.push(ns(e)),W(this,t)})),this.g.attachEmptyPacketListener(`left_hand_world_landmarks`,(e=>{W(this,e)})),this.g.attachProtoListener(`right_hand_landmarks`,((e,t)=>{Bc(e,this.h.rightHandLandmarks),W(this,t)})),this.g.attachEmptyPacketListener(`right_hand_landmarks`,(e=>{W(this,e)})),this.g.attachProtoListener(`right_hand_world_landmarks`,((e,t)=>{var n=this.h.rightHandWorldLandmarks;e=Ia(e),n.push(ns(e)),W(this,t)})),this.g.attachEmptyPacketListener(`right_hand_world_landmarks`,(e=>{W(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Z.prototype.detectForVideo=Z.prototype.G,Z.prototype.detect=Z.prototype.F,Z.prototype.setOptions=Z.prototype.o,Z.createFromModelPath=function(e,t){return Y(Z,e,{baseOptions:{modelAssetPath:t}})},Z.createFromModelBuffer=function(e,t){return Y(Z,e,{baseOptions:{modelAssetBuffer:t}})},Z.createFromOptions=function(e,t){return Y(Z,e,t)},Z.HAND_CONNECTIONS=Ac,Z.POSE_CONNECTIONS=Lc,Z.FACE_LANDMARKS_LIPS=yc,Z.FACE_LANDMARKS_LEFT_EYE=bc,Z.FACE_LANDMARKS_LEFT_EYEBROW=xc,Z.FACE_LANDMARKS_LEFT_IRIS=Sc,Z.FACE_LANDMARKS_RIGHT_EYE=Cc,Z.FACE_LANDMARKS_RIGHT_EYEBROW=wc,Z.FACE_LANDMARKS_RIGHT_IRIS=Tc,Z.FACE_LANDMARKS_FACE_OVAL=Ec,Z.FACE_LANDMARKS_CONTOURS=Dc,Z.FACE_LANDMARKS_TESSELATION=Oc;var Vc=class extends _c{constructor(e,t){super(new fc(e,t),`input_image`,`norm_rect`,!0),this.j={classifications:[]},x(e=this.h=new jo,0,1,t=new V)}get baseOptions(){return b(this.h,V,1)}set baseOptions(e){x(this.h,0,1,e)}o(e){return x(this.h,0,2,Xo(e,b(this.h,Ya,2))),this.l(e)}sa(e,t){return this.j={classifications:[]},mc(this,e,t),this.j}ta(e,t,n){return this.j={classifications:[]},hc(this,e,n,t),this.j}m(){var e=new wa;z(e,`input_image`),z(e,`norm_rect`),B(e,`classifications`);let t=new va;ri(t,Mo,this.h);let n=new R;ar(n,2,`mediapipe.tasks.vision.image_classifier.ImageClassifierGraph`),I(n,`IMAGE:input_image`),I(n,`NORM_RECT:norm_rect`),L(n,`CLASSIFICATIONS:classifications`),n.o(t),Ca(e,n),this.g.attachProtoListener(`classifications`,((e,t)=>{this.j=$o(Ua(e)),W(this,t)})),this.g.attachEmptyPacketListener(`classifications`,(e=>{W(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Vc.prototype.classifyForVideo=Vc.prototype.ta,Vc.prototype.classify=Vc.prototype.sa,Vc.prototype.setOptions=Vc.prototype.o,Vc.createFromModelPath=function(e,t){return Y(Vc,e,{baseOptions:{modelAssetPath:t}})},Vc.createFromModelBuffer=function(e,t){return Y(Vc,e,{baseOptions:{modelAssetBuffer:t}})},Vc.createFromOptions=function(e,t){return Y(Vc,e,t)};var Hc=class extends _c{constructor(e,t){super(new fc(e,t),`image_in`,`norm_rect`,!0),this.h=new No,this.embeddings={embeddings:[]},x(e=this.h,0,1,t=new V)}get baseOptions(){return b(this.h,V,1)}set baseOptions(e){x(this.h,0,1,e)}o(e){var t=this.h,n=b(this.h,Za,2);return n=n?n.clone():new Za,e.l2Normalize===void 0?`l2Normalize`in e&&v(n,1):v(n,1,Ft(e.l2Normalize)),e.quantize===void 0?`quantize`in e&&v(n,2):v(n,2,Ft(e.quantize)),x(t,0,2,n),this.l(e)}za(e,t){return mc(this,e,t),this.embeddings}Aa(e,t,n){return hc(this,e,n,t),this.embeddings}m(){var e=new wa;z(e,`image_in`),z(e,`norm_rect`),B(e,`embeddings_out`);let t=new va;ri(t,Po,this.h);let n=new R;ar(n,2,`mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph`),I(n,`IMAGE:image_in`),I(n,`NORM_RECT:norm_rect`),L(n,`EMBEDDINGS:embeddings_out`),n.o(t),Ca(e,n),this.g.attachProtoListener(`embeddings_out`,((e,t)=>{e=Ja(e),this.embeddings=function(e){return{embeddings:Qn(e,Ka,1).map((e=>{let t={headIndex:rr(e,3)??0??-1,headName:g(_(e,4))??``??``};var n=e.v;return Xn(n,0|n[f],Wa,Gn(e,1))===void 0?(n=new Uint8Array,t.quantizedEmbedding=b(e,Ga,Gn(e,2),void 0)?.na()?.h()??n):(e=In(e=b(e,Wa,Gn(e,1),void 0),1,Pt,Fn()),t.floatEmbedding=e.slice()),t})),timestampMs:Zo(_(e,2,void 0,void 0,Kt)??Mn)}}(e),W(this,t)})),this.g.attachEmptyPacketListener(`embeddings_out`,(e=>{W(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Hc.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=is(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error(`Cannot compute cosine similarity between quantized and float embeddings.`);e=is(rs(e.quantizedEmbedding),rs(t.quantizedEmbedding))}return e},Hc.prototype.embedForVideo=Hc.prototype.Aa,Hc.prototype.embed=Hc.prototype.za,Hc.prototype.setOptions=Hc.prototype.o,Hc.createFromModelPath=function(e,t){return Y(Hc,e,{baseOptions:{modelAssetPath:t}})},Hc.createFromModelBuffer=function(e,t){return Y(Hc,e,{baseOptions:{modelAssetBuffer:t}})},Hc.createFromOptions=function(e,t){return Y(Hc,e,t)};var Uc=class{constructor(e,t,n){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=n}close(){this.confidenceMasks?.forEach((e=>{e.close()})),this.categoryMask?.close()}};function Wc(e){let t=function(e){return Qn(e,R,1)}(e.ca()).filter((e=>(g(_(e,1))??``).includes(`mediapipe.tasks.TensorsToSegmentationCalculator`)));if(e.u=[],t.length>1)throw Error(`The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.`);t.length===1&&(b(t[0],va,7)?.j()?.g()??new Map).forEach(((t,n)=>{e.u[Number(n)]=g(_(t,1))??``}))}function Gc(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function Kc(e){try{let t=new Uc(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{Ss(e)}}Uc.prototype.close=Uc.prototype.close;var Q=class extends _c{constructor(e,t){super(new fc(e,t),`image_in`,`norm_rect`,!1),this.u=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new zo,this.A=new Fo,x(this.h,0,3,this.A),x(e=this.h,0,1,t=new V)}get baseOptions(){return b(this.h,V,1)}set baseOptions(e){x(this.h,0,1,e)}o(e){return e.displayNamesLocale===void 0?`displayNamesLocale`in e&&v(this.h,2):v(this.h,2,Jt(e.displayNamesLocale)),`outputCategoryMask`in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),`outputConfidenceMasks`in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}L(){Wc(this)}segment(e,t,n){let r=typeof t==`function`?{}:t;return this.j=typeof t==`function`?t:n,Gc(this),mc(this,e,r),Kc(this)}La(e,t,n,r){let i=typeof n==`function`?{}:n;return this.j=typeof n==`function`?n:r,Gc(this),hc(this,e,i,t),Kc(this)}Da(){return this.u}m(){var e=new wa;z(e,`image_in`),z(e,`norm_rect`);let t=new va;ri(t,Bo,this.h);let n=new R;ar(n,2,`mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph`),I(n,`IMAGE:image_in`),I(n,`NORM_RECT:norm_rect`),n.o(t),Ca(e,n),bs(this,e),this.outputConfidenceMasks&&(B(e,`confidence_masks`),L(n,`CONFIDENCE_MASKS:confidence_masks`),xs(this,`confidence_masks`),this.g.aa(`confidence_masks`,((e,t)=>{this.confidenceMasks=e.map((e=>gc(this,e,!0,!this.j))),W(this,t)})),this.g.attachEmptyPacketListener(`confidence_masks`,(e=>{this.confidenceMasks=[],W(this,e)}))),this.outputCategoryMask&&(B(e,`category_mask`),L(n,`CATEGORY_MASK:category_mask`),xs(this,`category_mask`),this.g.Z(`category_mask`,((e,t)=>{this.categoryMask=gc(this,e,!1,!this.j),W(this,t)})),this.g.attachEmptyPacketListener(`category_mask`,(e=>{this.categoryMask=void 0,W(this,e)}))),B(e,`quality_scores`),L(n,`QUALITY_SCORES:quality_scores`),this.g.attachFloatVectorListener(`quality_scores`,((e,t)=>{this.qualityScores=e,W(this,t)})),this.g.attachEmptyPacketListener(`quality_scores`,(e=>{this.categoryMask=void 0,W(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Q.prototype.getLabels=Q.prototype.Da,Q.prototype.segmentForVideo=Q.prototype.La,Q.prototype.segment=Q.prototype.segment,Q.prototype.setOptions=Q.prototype.o,Q.createFromModelPath=function(e,t){return Y(Q,e,{baseOptions:{modelAssetPath:t}})},Q.createFromModelBuffer=function(e,t){return Y(Q,e,{baseOptions:{modelAssetBuffer:t}})},Q.createFromOptions=function(e,t){return Y(Q,e,t)};var qc=class{constructor(e,t,n){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=n}close(){this.confidenceMasks?.forEach((e=>{e.close()})),this.categoryMask?.close()}};qc.prototype.close=qc.prototype.close;var Jc=class extends _c{constructor(e,t){super(new fc(e,t),`image_in`,`norm_rect_in`,!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new zo,this.u=new Fo,x(this.h,0,3,this.u),x(e=this.h,0,1,t=new V)}get baseOptions(){return b(this.h,V,1)}set baseOptions(e){x(this.h,0,1,e)}o(e){return`outputCategoryMask`in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),`outputConfidenceMasks`in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}segment(e,t,n,r){let i=typeof n==`function`?{}:n;if(this.j=typeof n==`function`?n:r,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,n=this.C+1,r=new Wo,t.keypoint&&t.scribble)throw Error(`Cannot provide both keypoint and scribble.`);if(t.keypoint){var a=new Vo;Un(a,3,Ft(!0),!1),Un(a,1,Nt(t.keypoint.x),0),Un(a,2,Nt(t.keypoint.y),0),er(r,1,Go,a)}else{if(!t.scribble)throw Error(`Must provide either a keypoint or a scribble.`);{let e=new Uo;for(a of t.scribble)Un(t=new Vo,3,Ft(!0),!1),Un(t,1,Nt(a.x),0),Un(t,2,Nt(a.y),0),nr(e,1,Vo,t);er(r,2,Go,e)}}this.g.addProtoToStream(r.g(),`mediapipe.tasks.vision.interactive_segmenter.proto.RegionOfInterest`,`roi_in`,n),mc(this,e,i);t:{try{let e=new qc(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var o=e;break t}this.j(e)}finally{Ss(this)}o=void 0}return o}m(){var e=new wa;z(e,`image_in`),z(e,`roi_in`),z(e,`norm_rect_in`);let t=new va;ri(t,Bo,this.h);let n=new R;ar(n,2,`mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraphV2`),I(n,`IMAGE:image_in`),I(n,`ROI:roi_in`),I(n,`NORM_RECT:norm_rect_in`),n.o(t),Ca(e,n),bs(this,e),this.outputConfidenceMasks&&(B(e,`confidence_masks`),L(n,`CONFIDENCE_MASKS:confidence_masks`),xs(this,`confidence_masks`),this.g.aa(`confidence_masks`,((e,t)=>{this.confidenceMasks=e.map((e=>gc(this,e,!0,!this.j))),W(this,t)})),this.g.attachEmptyPacketListener(`confidence_masks`,(e=>{this.confidenceMasks=[],W(this,e)}))),this.outputCategoryMask&&(B(e,`category_mask`),L(n,`CATEGORY_MASK:category_mask`),xs(this,`category_mask`),this.g.Z(`category_mask`,((e,t)=>{this.categoryMask=gc(this,e,!1,!this.j),W(this,t)})),this.g.attachEmptyPacketListener(`category_mask`,(e=>{this.categoryMask=void 0,W(this,e)}))),B(e,`quality_scores`),L(n,`QUALITY_SCORES:quality_scores`),this.g.attachFloatVectorListener(`quality_scores`,((e,t)=>{this.qualityScores=e,W(this,t)})),this.g.attachEmptyPacketListener(`quality_scores`,(e=>{this.categoryMask=void 0,W(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Jc.prototype.segment=Jc.prototype.segment,Jc.prototype.setOptions=Jc.prototype.o,Jc.createFromModelPath=function(e,t){return Y(Jc,e,{baseOptions:{modelAssetPath:t}})},Jc.createFromModelBuffer=function(e,t){return Y(Jc,e,{baseOptions:{modelAssetBuffer:t}})},Jc.createFromOptions=function(e,t){return Y(Jc,e,t)};var Yc=class extends _c{constructor(e,t){super(new fc(e,t),`input_frame_gpu`,`norm_rect`,!1),this.j={detections:[]},x(e=this.h=new Ko,0,1,t=new V)}get baseOptions(){return b(this.h,V,1)}set baseOptions(e){x(this.h,0,1,e)}o(e){return e.displayNamesLocale===void 0?`displayNamesLocale`in e&&v(this.h,2):v(this.h,2,Jt(e.displayNamesLocale)),e.maxResults===void 0?`maxResults`in e&&v(this.h,3):ir(this.h,3,e.maxResults),e.scoreThreshold===void 0?`scoreThreshold`in e&&v(this.h,4):C(this.h,4,e.scoreThreshold),e.categoryAllowlist===void 0?`categoryAllowlist`in e&&v(this.h,5):or(this.h,5,e.categoryAllowlist),e.categoryDenylist===void 0?`categoryDenylist`in e&&v(this.h,6):or(this.h,6,e.categoryDenylist),this.l(e)}F(e,t){return this.j={detections:[]},mc(this,e,t),this.j}G(e,t,n){return this.j={detections:[]},hc(this,e,n,t),this.j}m(){var e=new wa;z(e,`input_frame_gpu`),z(e,`norm_rect`),B(e,`detections`);let t=new va;ri(t,qo,this.h);let n=new R;ar(n,2,`mediapipe.tasks.vision.ObjectDetectorGraph`),I(n,`IMAGE:input_frame_gpu`),I(n,`NORM_RECT:norm_rect`),L(n,`DETECTIONS:detections`),n.o(t),Ca(e,n),this.g.attachProtoVectorListener(`detections`,((e,t)=>{for(let t of e)e=Pa(t),this.j.detections.push(es(e));W(this,t)})),this.g.attachEmptyPacketListener(`detections`,(e=>{W(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Yc.prototype.detectForVideo=Yc.prototype.G,Yc.prototype.detect=Yc.prototype.F,Yc.prototype.setOptions=Yc.prototype.o,Yc.createFromModelPath=async function(e,t){return Y(Yc,e,{baseOptions:{modelAssetPath:t}})},Yc.createFromModelBuffer=function(e,t){return Y(Yc,e,{baseOptions:{modelAssetBuffer:t}})},Yc.createFromOptions=function(e,t){return Y(Yc,e,t)};var Xc=class{constructor(e,t,n){this.landmarks=e,this.worldLandmarks=t,this.segmentationMasks=n}close(){this.segmentationMasks?.forEach((e=>{e.close()}))}};function Zc(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function Qc(e){try{let t=new Xc(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.u)return t;e.u(t)}finally{Ss(e)}}Xc.prototype.close=Xc.prototype.close;var $c=class extends _c{constructor(e,t){super(new fc(e,t),`image_in`,`norm_rect`,!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,x(e=this.h=new Jo,0,1,t=new V),this.A=new Do,x(this.h,0,3,this.A),this.j=new Eo,x(this.h,0,2,this.j),ir(this.j,4,1),C(this.j,2,.5),C(this.A,2,.5),C(this.h,4,.5)}get baseOptions(){return b(this.h,V,1)}set baseOptions(e){x(this.h,0,1,e)}o(e){return`numPoses`in e&&ir(this.j,4,e.numPoses??1),`minPoseDetectionConfidence`in e&&C(this.j,2,e.minPoseDetectionConfidence??.5),`minTrackingConfidence`in e&&C(this.h,4,e.minTrackingConfidence??.5),`minPosePresenceConfidence`in e&&C(this.A,2,e.minPosePresenceConfidence??.5),`outputSegmentationMasks`in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}F(e,t,n){let r=typeof t==`function`?{}:t;return this.u=typeof t==`function`?t:n,Zc(this),mc(this,e,r),Qc(this)}G(e,t,n,r){let i=typeof n==`function`?{}:n;return this.u=typeof n==`function`?n:r,Zc(this),hc(this,e,i,t),Qc(this)}m(){var e=new wa;z(e,`image_in`),z(e,`norm_rect`),B(e,`normalized_landmarks`),B(e,`world_landmarks`),B(e,`segmentation_masks`);let t=new va;ri(t,Yo,this.h);let n=new R;ar(n,2,`mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph`),I(n,`IMAGE:image_in`),I(n,`NORM_RECT:norm_rect`),L(n,`NORM_LANDMARKS:normalized_landmarks`),L(n,`WORLD_LANDMARKS:world_landmarks`),n.o(t),Ca(e,n),bs(this,e),this.g.attachProtoVectorListener(`normalized_landmarks`,((e,t)=>{this.landmarks=[];for(let t of e)e=Ra(t),this.landmarks.push(ts(e));W(this,t)})),this.g.attachEmptyPacketListener(`normalized_landmarks`,(e=>{this.landmarks=[],W(this,e)})),this.g.attachProtoVectorListener(`world_landmarks`,((e,t)=>{this.worldLandmarks=[];for(let t of e)e=Ia(t),this.worldLandmarks.push(ns(e));W(this,t)})),this.g.attachEmptyPacketListener(`world_landmarks`,(e=>{this.worldLandmarks=[],W(this,e)})),this.outputSegmentationMasks&&(L(n,`SEGMENTATION_MASK:segmentation_masks`),xs(this,`segmentation_masks`),this.g.aa(`segmentation_masks`,((e,t)=>{this.segmentationMasks=e.map((e=>gc(this,e,!0,!this.u))),W(this,t)})),this.g.attachEmptyPacketListener(`segmentation_masks`,(e=>{this.segmentationMasks=[],W(this,e)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};$c.prototype.detectForVideo=$c.prototype.G,$c.prototype.detect=$c.prototype.F,$c.prototype.setOptions=$c.prototype.o,$c.createFromModelPath=function(e,t){return Y($c,e,{baseOptions:{modelAssetPath:t}})},$c.createFromModelBuffer=function(e,t){return Y($c,e,{baseOptions:{modelAssetBuffer:t}})},$c.createFromOptions=function(e,t){return Y($c,e,t)},$c.POSE_CONNECTIONS=Lc;var el,$,tl=0,nl=500,rl,il=468,al=234,ol=454,sl=168,cl=(e,t,n)=>Math.max(0,Math.min(1,(e-n)/(t-n))),ll=(e,t)=>{let n=e[al],r=e[ol],i=e[sl],a=t-n.x*t,o=t-r.x*t,s=t-i.x*t,c=s-a,l=o-s,u=l-c;return c5?!0:c>l&&Math.abs(u)>5};function ul(){let e=el.detectForVideo($,performance.now());if(e.faceLandmarks.length>0){let t=e.faceLandmarks[0],n=t[il].x*$.width,r=t[il].y*$.height,i=t.map(e=>e.x*$.width),a=t.map(e=>e.y*$.height),o=Math.min(...i),s=Math.max(...i),c=Math.min(...a),l=Math.max(...a),u=$.width-s,d=l,ee=$.width-o,te=c;if(u>0&&!ll(t,$.width)){let e=cl($.width-n,ee,u);e>.355?rl=`RIGHT`:e<.315?rl=`LEFT`:(tl++,tl>8&&(rl=`STRAIGHT`,tl=0)),cl(r,te,d)>.62&&(rl=`TOP`)}}return rl}var dl={loadModel:async()=>{let e=await ls.forVisionTasks(`https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@latest/wasm`);el=await X.createFromOptions(e,{baseOptions:{modelAssetPath:`https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/1/face_landmarker.task`,delegate:`GPU`},runningMode:`VIDEO`,numFaces:1,outputFaceBlendshapes:!1,outputFacialTransformationMatrixes:!1})},setUpCamera:async(e,t=void 0)=>{$=e;let n=(await navigator.mediaDevices.enumerateDevices()).find(e=>e.kind===`videoinput`&&e.label.includes(`Built-in`)),r=n?n.deviceId:t,i=await navigator.mediaDevices.getUserMedia({audio:!1,video:{facingMode:`user`,deviceId:r,width:nl,height:nl}});return $.srcObject=i,$.play(),$.width=500,$.height=500,new Promise(e=>{$.onloadedmetadata=()=>{e($)}})},getGazePrediction:ul,_normalize:cl,_isFaceRotated:ll},fl=`A.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y.Z.Delete.space.Enter`.split(`.`);(()=>{let e=/Android/i.test(navigator.userAgent),t=/iPhone|iPad|iPod/i.test(navigator.userAgent);return e||t})();var pl=fl,ml=document.querySelector(`.section-left`),hl=document.querySelector(`.section-right`),gl=(e,t)=>{if(ml.hasChildNodes()&&t&&(ml.innerHTML=``),hl.hasChildNodes()&&t&&(hl.innerHTML=``),e.length===1){let t=document.querySelector(`.output`);e[0]===`Delete`?t.value=t.value.slice(0,-1):e[0]===`space`?t.value+=` `:e[0]===`Enter`?t.value=`${t.value}\n`:t.value+=e[0],gl(fl,!1),_l();return}else e.map((t,n)=>{let r=document.createElement(`p`);r.innerHTML=t,npl=fl,vl,yl=()=>{let e=document.querySelector(`.model-status`);e&&(e.innerHTML=`🤖 Model loaded and tracking 👀!`,e.classList.add(`fade-out`),e.classList.remove(`model-status`))},bl=document.querySelector(`video`);(async()=>{await dl.loadModel(),await dl.setUpCamera(bl);let e=async()=>{let t=await dl.getGazePrediction();yl(),t===`RIGHT`?vl!==t&&(pl=pl.slice(Math.round(pl.length/2),pl.length),gl(pl,!0),vl=t):t===`LEFT`?vl!==t&&(pl=pl.slice(0,Math.round(pl.length/2)),gl(pl.slice(pl),!0),vl=t):t===`STRAIGHT`&&(vl=t),requestAnimationFrame(e)};e()})();