UNPKG

webgazer

Version:

> **Note:** As of February 24, 2026, WebGazer is fully functional and works as intended, but updates are no longer guaranteed. Official maintenance has ended, but community support continues via [GitHub Issues](https://github.com/brownhci/WebGazer/issues)

7 lines 1.9 MB
/*! * * WebGazer.js: Democratizing Webcam Eye Tracking on the Browser * Copyright (c) 2016, Brown WebGazer Team * Licensed under GPLv3. Companies with a valuation of less than $1M can use WebGazer.js under LGPLv3. * */(()=>{var e={726(e,t,n){(function(){"use strict";var e;function t(e){var t=0;return function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}}var r="function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,n){return e==Array.prototype||e==Object.prototype||(e[t]=n.value),e};var s=function(e){e=["object"==typeof globalThis&&globalThis,e,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof n.g&&n.g];for(var t=0;t<e.length;++t){var r=e[t];if(r&&r.Math==Math)return r}throw Error("Cannot find global object")}(this);function a(e,t){if(t)e:{var n=s;e=e.split(".");for(var a=0;a<e.length-1;a++){var i=e[a];if(!(i in n))break e;n=n[i]}(t=t(a=n[e=e[e.length-1]]))!=a&&null!=t&&r(n,e,{configurable:!0,writable:!0,value:t})}}function i(e){return(e={next:e})[Symbol.iterator]=function(){return this},e}function o(e){var n="undefined"!=typeof Symbol&&Symbol.iterator&&e[Symbol.iterator];return n?n.call(e):{next:t(e)}}function u(e){if(!(e instanceof Array)){e=o(e);for(var t,n=[];!(t=e.next()).done;)n.push(t.value);e=n}return e}a("Symbol",function(e){function t(e,t){this.g=e,r(this,"description",{configurable:!0,writable:!0,value:t})}if(e)return e;t.prototype.toString=function(){return this.g};var n="jscomp_symbol_"+(1e9*Math.random()>>>0)+"_",s=0;return function e(r){if(this instanceof e)throw new TypeError("Symbol is not a constructor");return new t(n+(r||"")+"_"+s++,r)}}),a("Symbol.iterator",function(e){if(e)return e;e=Symbol("Symbol.iterator");for(var n="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),a=0;a<n.length;a++){var o=s[n[a]];"function"==typeof o&&"function"!=typeof o.prototype[e]&&r(o.prototype,e,{configurable:!0,writable:!0,value:function(){return i(t(this))}})}return e});var l,c="function"==typeof Object.create?Object.create:function(e){function t(){}return t.prototype=e,new t};if("function"==typeof Object.setPrototypeOf)l=Object.setPrototypeOf;else{var h;e:{var d={};try{d.__proto__={a:!0},h=d.a;break e}catch(e){}h=!1}l=h?function(e,t){if(e.__proto__=t,e.__proto__!==t)throw new TypeError(e+" is not extensible");return e}:null}var p=l;function f(e,t){if(e.prototype=c(t.prototype),e.prototype.constructor=e,p)p(e,t);else for(var n in t)if("prototype"!=n)if(Object.defineProperties){var r=Object.getOwnPropertyDescriptor(t,n);r&&Object.defineProperty(e,n,r)}else e[n]=t[n];e.ea=t.prototype}function m(){this.l=!1,this.i=null,this.h=void 0,this.g=1,this.s=this.m=0,this.j=null}function g(e){if(e.l)throw new TypeError("Generator is already running");e.l=!0}function y(e,t){e.j={U:t,V:!0},e.g=e.m||e.s}function b(e,t,n){return e.g=n,{value:t}}function x(e){this.g=new m,this.h=e}function v(e,t,n,r){try{var s=t.call(e.g.i,n);if(!(s instanceof Object))throw new TypeError("Iterator result "+s+" is not an object");if(!s.done)return e.g.l=!1,s;var a=s.value}catch(t){return e.g.i=null,y(e.g,t),w(e)}return e.g.i=null,r.call(e.g,a),w(e)}function w(e){for(;e.g.g;)try{var t=e.h(e.g);if(t)return e.g.l=!1,{value:t.value,done:!1}}catch(t){e.g.h=void 0,y(e.g,t)}if(e.g.l=!1,e.g.j){if(t=e.g.j,e.g.j=null,t.V)throw t.U;return{value:t.return,done:!0}}return{value:void 0,done:!0}}function k(e){this.next=function(t){return g(e.g),e.g.i?t=v(e,e.g.i.next,t,e.g.o):(e.g.o(t),t=w(e)),t},this.throw=function(t){return g(e.g),e.g.i?t=v(e,e.g.i.throw,t,e.g.o):(y(e.g,t),t=w(e)),t},this.return=function(t){return function(e,t){g(e.g);var n=e.g.i;return n?v(e,"return"in n?n.return:function(e){return{value:e,done:!0}},t,e.g.return):(e.g.return(t),w(e))}(e,t)},this[Symbol.iterator]=function(){return this}}function I(e,t){return t=new k(new x(t)),p&&e.prototype&&p(t,e.prototype),t}m.prototype.o=function(e){this.h=e},m.prototype.return=function(e){this.j={return:e},this.g=this.s};var N="function"==typeof Object.assign?Object.assign:function(e,t){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(r)for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e};a("Object.assign",function(e){return e||N}),a("Promise",function(e){function t(e){this.h=0,this.i=void 0,this.g=[],this.o=!1;var t=this.j();try{e(t.resolve,t.reject)}catch(e){t.reject(e)}}function n(){this.g=null}function r(e){return e instanceof t?e:new t(function(t){t(e)})}if(e)return e;n.prototype.h=function(e){if(null==this.g){this.g=[];var t=this;this.i(function(){t.l()})}this.g.push(e)};var a=s.setTimeout;n.prototype.i=function(e){a(e,0)},n.prototype.l=function(){for(;this.g&&this.g.length;){var e=this.g;this.g=[];for(var t=0;t<e.length;++t){var n=e[t];e[t]=null;try{n()}catch(e){this.j(e)}}}this.g=null},n.prototype.j=function(e){this.i(function(){throw e})},t.prototype.j=function(){function e(e){return function(r){n||(n=!0,e.call(t,r))}}var t=this,n=!1;return{resolve:e(this.C),reject:e(this.l)}},t.prototype.C=function(e){if(e===this)this.l(new TypeError("A Promise cannot resolve to itself"));else if(e instanceof t)this.F(e);else{e:switch(typeof e){case"object":var n=null!=e;break e;case"function":n=!0;break e;default:n=!1}n?this.u(e):this.m(e)}},t.prototype.u=function(e){var t=void 0;try{t=e.then}catch(e){return void this.l(e)}"function"==typeof t?this.G(t,e):this.m(e)},t.prototype.l=function(e){this.s(2,e)},t.prototype.m=function(e){this.s(1,e)},t.prototype.s=function(e,t){if(0!=this.h)throw Error("Cannot settle("+e+", "+t+"): Promise already settled in state"+this.h);this.h=e,this.i=t,2===this.h&&this.D(),this.A()},t.prototype.D=function(){var e=this;a(function(){if(e.B()){var t=s.console;void 0!==t&&t.error(e.i)}},1)},t.prototype.B=function(){if(this.o)return!1;var e=s.CustomEvent,t=s.Event,n=s.dispatchEvent;return void 0===n||("function"==typeof e?e=new e("unhandledrejection",{cancelable:!0}):"function"==typeof t?e=new t("unhandledrejection",{cancelable:!0}):(e=s.document.createEvent("CustomEvent")).initCustomEvent("unhandledrejection",!1,!0,e),e.promise=this,e.reason=this.i,n(e))},t.prototype.A=function(){if(null!=this.g){for(var e=0;e<this.g.length;++e)i.h(this.g[e]);this.g=null}};var i=new n;return t.prototype.F=function(e){var t=this.j();e.J(t.resolve,t.reject)},t.prototype.G=function(e,t){var n=this.j();try{e.call(t,n.resolve,n.reject)}catch(e){n.reject(e)}},t.prototype.then=function(e,n){function r(e,t){return"function"==typeof e?function(t){try{s(e(t))}catch(e){a(e)}}:t}var s,a,i=new t(function(e,t){s=e,a=t});return this.J(r(e,s),r(n,a)),i},t.prototype.catch=function(e){return this.then(void 0,e)},t.prototype.J=function(e,t){function n(){switch(r.h){case 1:e(r.i);break;case 2:t(r.i);break;default:throw Error("Unexpected state: "+r.h)}}var r=this;null==this.g?i.h(n):this.g.push(n),this.o=!0},t.resolve=r,t.reject=function(e){return new t(function(t,n){n(e)})},t.race=function(e){return new t(function(t,n){for(var s=o(e),a=s.next();!a.done;a=s.next())r(a.value).J(t,n)})},t.all=function(e){var n=o(e),s=n.next();return s.done?r([]):new t(function(e,t){function a(t){return function(n){i[t]=n,0==--o&&e(i)}}var i=[],o=0;do{i.push(void 0),o++,r(s.value).J(a(i.length-1),t),s=n.next()}while(!s.done)})},t}),a("Object.is",function(e){return e||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}}),a("Array.prototype.includes",function(e){return e||function(e,t){var n=this;n instanceof String&&(n=String(n));var r=n.length;for(0>(t=t||0)&&(t=Math.max(t+r,0));t<r;t++){var s=n[t];if(s===e||Object.is(s,e))return!0}return!1}}),a("String.prototype.includes",function(e){return e||function(e,t){if(null==this)throw new TypeError("The 'this' value for String.prototype.includes must not be null or undefined");if(e instanceof RegExp)throw new TypeError("First argument to String.prototype.includes must not be a regular expression");return-1!==this.indexOf(e,t||0)}}),a("Array.prototype.keys",function(e){return e||function(){return function(e,t){e instanceof String&&(e+="");var n=0,r=!1,s={next:function(){if(!r&&n<e.length){var s=n++;return{value:t(s,e[s]),done:!1}}return r=!0,{done:!0,value:void 0}}};return s[Symbol.iterator]=function(){return s},s}(this,function(e){return e})}});var S=this||self;function T(e,t){e=e.split(".");var n,r=S;e[0]in r||void 0===r.execScript||r.execScript("var "+e[0]);for(;e.length&&(n=e.shift());)e.length||void 0===t?r=r[n]&&r[n]!==Object.prototype[n]?r[n]:r[n]={}:r[n]=t}function C(e,t){return t=String.fromCharCode.apply(null,t),null==e?t:e+t}var E,$,A="undefined"!=typeof TextDecoder,R="undefined"!=typeof TextEncoder;function _(e){if(R)e=($||($=new TextEncoder)).encode(e);else{var t=void 0;t=void 0!==t&&t;for(var n=0,r=new Uint8Array(3*e.length),s=0;s<e.length;s++){var a=e.charCodeAt(s);if(128>a)r[n++]=a;else{if(2048>a)r[n++]=a>>6|192;else{if(55296<=a&&57343>=a){if(56319>=a&&s<e.length){var i=e.charCodeAt(++s);if(56320<=i&&57343>=i){a=1024*(a-55296)+i-56320+65536,r[n++]=a>>18|240,r[n++]=a>>12&63|128,r[n++]=a>>6&63|128,r[n++]=63&a|128;continue}s--}if(t)throw Error("Found an unpaired surrogate");a=65533}r[n++]=a>>12|224,r[n++]=a>>6&63|128}r[n++]=63&a|128}}e=r.subarray(0,n)}return e}var F={},O=null;function D(e,t){void 0===t&&(t=0),L(),t=F[t];for(var n=Array(Math.floor(e.length/3)),r=t[64]||"",s=0,a=0;s<e.length-2;s+=3){var i=e[s],o=e[s+1],u=e[s+2],l=t[i>>2];i=t[(3&i)<<4|o>>4],o=t[(15&o)<<2|u>>6],u=t[63&u],n[a++]=l+i+o+u}switch(l=0,u=r,e.length-s){case 2:u=t[(15&(l=e[s+1]))<<2]||r;case 1:e=e[s],n[a]=t[e>>2]+t[(3&e)<<4|l>>4]+u+r}return n.join("")}function M(e){var t=e.length,n=3*t/4;n%3?n=Math.floor(n):-1!="=.".indexOf(e[t-1])&&(n=-1!="=.".indexOf(e[t-2])?n-2:n-1);var r=new Uint8Array(n),s=0;return function(e,t){function n(t){for(;r<e.length;){var n=e.charAt(r++),s=O[n];if(null!=s)return s;if(!/^[\s\xa0]*$/.test(n))throw Error("Unknown base64 encoding at char: "+n)}return t}L();for(var r=0;;){var s=n(-1),a=n(0),i=n(64),o=n(64);if(64===o&&-1===s)break;t(s<<2|a>>4),64!=i&&(t(a<<4&240|i>>2),64!=o&&t(i<<6&192|o))}}(e,function(e){r[s++]=e}),r.subarray(0,s)}function L(){if(!O){O={};for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"],n=0;5>n;n++){var r=e.concat(t[n].split(""));F[n]=r;for(var s=0;s<r.length;s++){var a=r[s];void 0===O[a]&&(O[a]=s)}}}}var z,P="function"==typeof Uint8Array.prototype.slice;function B(e,t,n){return t===n?z||(z=new Uint8Array(0)):P?e.slice(t,n):new Uint8Array(e.subarray(t,n))}var W=0;function V(e,t){t=void 0!==(t=void 0===t?{}:t).v&&t.v,this.h=null,this.g=this.j=this.l=0,this.m=!1,this.v=t,e&&U(this,e)}function U(e,t){t=t.constructor===Uint8Array?t:t.constructor===ArrayBuffer||t.constructor===Array?new Uint8Array(t):t.constructor===String?M(t):t instanceof Uint8Array?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(0),e.h=t,e.l=0,e.j=e.h.length,e.g=e.l}function G(e){for(var t=128,n=0,r=0,s=0;4>s&&128<=t;s++)n|=(127&(t=e.h[e.g++]))<<7*s;if(128<=t&&(n|=(127&(t=e.h[e.g++]))<<28,r|=(127&t)>>4),128<=t)for(s=0;5>s&&128<=t;s++)r|=(127&(t=e.h[e.g++]))<<7*s+3;if(128>t)return e=n>>>0,(r=2147483648&(t=r>>>0))&&(t=~t>>>0,0==(e=1+~e>>>0)&&(t=t+1>>>0)),e=4294967296*t+(e>>>0),r?-e:e;e.m=!0}V.prototype.reset=function(){this.g=this.l},V.prototype.i=function(){var e=this.h,t=e[this.g],n=127&t;return 128>t?(this.g+=1,n):(n|=(127&(t=e[this.g+1]))<<7,128>t?(this.g+=2,n):(n|=(127&(t=e[this.g+2]))<<14,128>t?(this.g+=3,n):(n|=(127&(t=e[this.g+3]))<<21,128>t?(this.g+=4,n):(n|=(15&(t=e[this.g+4]))<<28,128>t?(this.g+=5,n>>>0):(this.g+=5,128<=e[this.g++]&&128<=e[this.g++]&&128<=e[this.g++]&&128<=e[this.g++]&&this.g++,n)))))},V.prototype.o=function(){var e=this.h[this.g],t=this.h[this.g+1],n=this.h[this.g+2],r=this.h[this.g+3];return this.g+=4,e=2*((n=(e|t<<8|n<<16|r<<24)>>>0)>>31)+1,t=n>>>23&255,n&=8388607,255==t?n?NaN:1/0*e:0==t?e*Math.pow(2,-149)*n:e*Math.pow(2,t-150)*(n+Math.pow(2,23))};var j=[];function H(){this.g=new Uint8Array(64),this.h=0}function q(e,t){for(;127<t;)e.push(127&t|128),t>>>=7;e.push(t)}function K(e){var t={},n=void 0!==t.N&&t.N;this.o={v:void 0!==t.v&&t.v},this.N=n,t=this.o,j.length?(n=j.pop(),t&&(n.v=t.v),e&&U(n,e),e=n):e=new V(e,t),this.g=e,this.m=this.g.g,this.h=this.i=this.l=-1,this.j=!1}function X(e){var t=e.g;if((t=t.g==t.j)||(t=e.j)||(t=(t=e.g).m||0>t.g||t.g>t.j),t)return!1;e.m=e.g.g;var n=7&(t=e.g.i());return 0!=n&&5!=n&&1!=n&&2!=n&&3!=n&&4!=n?(e.j=!0,!1):(e.i=t,e.l=t>>>3,e.h=n,!0)}function Y(e){switch(e.h){case 0:if(0!=e.h)Y(e);else{for(e=e.g;128&e.h[e.g];)e.g++;e.g++}break;case 1:1!=e.h?Y(e):(e=e.g).g+=8;break;case 2:if(2!=e.h)Y(e);else{var t=e.g.i();(e=e.g).g+=t}break;case 5:5!=e.h?Y(e):(e=e.g).g+=4;break;case 3:for(t=e.l;;){if(!X(e)){e.j=!0;break}if(4==e.h){e.l!=t&&(e.j=!0);break}Y(e)}break;default:e.j=!0}}function J(e,t,n){var r=e.g.j,s=e.g.i(),a=e.g.g+s;if(e.g.j=a,n(t,e),0!==(n=a-e.g.g))throw Error("Message parsing ended unexpectedly. Expected to read "+s+" bytes, instead read "+(s-n)+" bytes, either the data ended unexpectedly or the message misreported its own length");return e.g.g=a,e.g.j=r,t}function Z(e){return e.g.o()}function Q(e){var t,n=e.g.i(),r=(e=e.g).g;if(e.g+=n,e=e.h,A)(t=E)||(t=E=new TextDecoder("utf-8",{fatal:!1})),t=t.decode(e.subarray(r,r+n));else{n=r+n;for(var s,a,i,o=[],u=null;r<n;)128>(s=e[r++])?o.push(s):224>s?r>=n?o.push(65533):(a=e[r++],194>s||128!=(192&a)?(r--,o.push(65533)):o.push((31&s)<<6|63&a)):240>s?r>=n-1?o.push(65533):128!=(192&(a=e[r++]))||224===s&&160>a||237===s&&160<=a||128!=(192&(t=e[r++]))?(r--,o.push(65533)):o.push((15&s)<<12|(63&a)<<6|63&t):244>=s?r>=n-2?o.push(65533):128!=(192&(a=e[r++]))||a-144+(s<<28)>>30||128!=(192&(t=e[r++]))||128!=(192&(i=e[r++]))?(r--,o.push(65533)):(s=(7&s)<<18|(63&a)<<12|(63&t)<<6|63&i,s-=65536,o.push(55296+(s>>10&1023),56320+(1023&s))):o.push(65533),8192<=o.length&&(u=C(u,o),o.length=0);t=C(u,o)}return t}function ee(e,t,n){var r=e.g.i();for(r=e.g.g+r;e.g.g<r;)n.push(t.call(e.g))}function te(e,t){2==e.h?ee(e,V.prototype.o,t):t.push(Z(e))}function ne(){this.h=[],this.i=0,this.g=new H}function re(e,t){0!==t.length&&(e.h.push(t),e.i+=t.length)}function se(e){var t=e.i+e.g.length();if(0===t)return new Uint8Array(0);t=new Uint8Array(t);for(var n=e.h,r=n.length,s=0,a=0;a<r;a++){var i=n[a];0!==i.length&&(t.set(i,s),s+=i.length)}return 0!==(r=(n=e.g).h)&&(t.set(n.g.subarray(0,r),s),n.h=0),e.h=[t],t}function ae(e,t,n){if(null!=n){q(e.g,8*t+5),e=e.g;var r=n;0===(r=(n=0>r?1:0)?-r:r)?0<1/r?W=0:W=2147483648:isNaN(r)?W=2147483647:34028234663852886e22<r?W=(n<<31|2139095040)>>>0:11754943508222875e-54>r?(r=Math.round(r/Math.pow(2,-149)),W=(n<<31|r)>>>0):(t=Math.floor(Math.log(r)/Math.LN2),r*=Math.pow(2,-t),16777216<=(r=Math.round(8388608*r))&&++t,W=(n<<31|t+127<<23|8388607&r)>>>0),n=W,e.push(n>>>0&255),e.push(n>>>8&255),e.push(n>>>16&255),e.push(n>>>24&255)}}H.prototype.push=function(e){if(!(this.h+1<this.g.length)){var t=this.g;this.g=new Uint8Array(Math.ceil(1+2*this.g.length)),this.g.set(t)}this.g[this.h++]=e},H.prototype.length=function(){return this.h},H.prototype.end=function(){var e=this.g,t=this.h;return this.h=0,B(e,0,t)},K.prototype.reset=function(){this.g.reset(),this.h=this.l=-1};var ie="function"==typeof Uint8Array;function oe(e,t,n){if(null!=e)return"object"==typeof e?ie&&e instanceof Uint8Array?n(e):ue(e,t,n):t(e)}function ue(e,t,n){if(Array.isArray(e)){for(var r=Array(e.length),s=0;s<e.length;s++)r[s]=oe(e[s],t,n);return Array.isArray(e)&&e.W&&de(r),r}for(s in r={},e)r[s]=oe(e[s],t,n);return r}function le(e){return"number"==typeof e?isFinite(e)?e:String(e):e}var ce,he={W:{value:!0,configurable:!0}};function de(e){return Array.isArray(e)&&!Object.isFrozen(e)&&Object.defineProperties(e,he),e}function pe(e,t,n){var r=ce;if(ce=null,e||(e=r),r=this.constructor.ca,e||(e=r?[r]:[]),this.j=r?0:-1,this.m=this.g=null,this.h=e,e=(r=this.h.length)-1,!r||(null===(r=this.h[e])||"object"!=typeof r||Array.isArray(r)||ie&&r instanceof Uint8Array)?void 0!==t&&-1<t?(this.l=Math.max(t,e+1-this.j),this.i=null):this.l=Number.MAX_VALUE:(this.l=e-this.j,this.i=r),n)for(t=0;t<n.length;t++)(e=n[t])<this.l?(e+=this.j,(r=this.h[e])?de(r):this.h[e]=fe):(me(this),(r=this.i[e])?de(r):this.i[e]=fe)}var fe=Object.freeze(de([]));function me(e){var t=e.l+e.j;e.h[t]||(e.i=e.h[t]={})}function ge(e,t,n){return-1===t?null:void 0!==n&&n||t>=e.l?e.i?e.i[t]:void 0:e.h[t+e.j]}function ye(e,t){var n=void 0!==n&&n,r=ge(e,t,n);return null==r&&(r=fe),r===fe&&we(e,t,r=de([]),n),r}function be(e){var t=ye(e,3);if(e.m||(e.m={}),!e.m[3]){for(var n=0;n<t.length;n++)t[n]=+t[n];e.m[3]=!0}return t}function xe(e,t,n){return null==(e=ge(e,t))?n:e}function ve(e,t,n){return null==(e=null==(e=ge(e,t))?e:+e)?void 0===n?0:n:e}function we(e,t,n,r){void 0!==r&&r||t>=e.l?(me(e),e.i[t]=n):e.h[t+e.j]=n}function ke(e,t,n){if(-1===n)return null;if(e.g||(e.g={}),!e.g[n]){var r=ge(e,n,!1);r&&(e.g[n]=new t(r))}return e.g[n]}function Ie(e,t){e.g||(e.g={});var n=e.g[1];if(!n){var r=ye(e,1);n=[];for(var s=0;s<r.length;s++)n[s]=new t(r[s]);e.g[1]=n}return n}function Ne(e,t,n){var r=void 0!==r&&r;e.g||(e.g={});var s=n?Te(n,!1):n;e.g[t]=n,we(e,t,s,r)}function Se(e,t,n,r){var s=Ie(e,n);t=t||new n,e=ye(e,1),null!=r?(s.splice(r,0,t),e.splice(r,0,Te(t,!1))):(s.push(t),e.push(Te(t,!1)))}function Te(e,t){if(e.g)for(var n in e.g){var r=e.g[n];if(Array.isArray(r))for(var s=0;s<r.length;s++)r[s]&&Te(r[s],t);else r&&Te(r,t)}return e.h}function Ce(e,t){if(e=e.o){re(t,t.g.end());for(var n=0;n<e.length;n++)re(t,e[n])}}function Ee(e,t){if(4==t.h)return!1;var n=t.m;return Y(t),t.N||(t=B(t.g.h,n,t.g.g),(n=e.o)?n.push(t):e.o=[t]),!0}function $e(e){pe.call(this,e,-1,Re)}function Ae(e,t){for(;X(t);)switch(t.i){case 8:var n=t.g.i();we(e,1,n);break;case 16:we(e,2,n=t.g.i());break;case 29:case 26:te(t,e.getPackedDataList());break;case 32:we(e,4,n=G(t.g));break;default:if(!Ee(e,t))return e}return e}pe.prototype.toJSON=function(){return ue(Te(this,!1),le,D)},pe.prototype.toString=function(){return Te(this,!1).toString()},f($e,pe),$e.prototype.getRows=function(){return ge(this,1)},$e.prototype.getCols=function(){return ge(this,2)},$e.prototype.getPackedDataList=function(){return be(this)},$e.prototype.getLayout=function(){return xe(this,4,0)};var Re=[3];function _e(e,t){var n=void 0;return new(n||(n=Promise))(function(r,s){function a(e){try{o(t.next(e))}catch(e){s(e)}}function i(e){try{o(t.throw(e))}catch(e){s(e)}}function o(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(a,i)}o((t=t.apply(e,void 0)).next())})}function Fe(e){pe.call(this,e)}function Oe(e,t){for(;X(t);)switch(t.i){case 8:var n=t.g.i();we(e,1,n);break;case 21:we(e,2,n=Z(t));break;case 26:we(e,3,n=Q(t));break;case 34:we(e,4,n=Q(t));break;default:if(!Ee(e,t))return e}return e}function De(e){pe.call(this,e,-1,Me)}f(Fe,pe),f(De,pe),De.prototype.addClassification=function(e,t){return Se(this,e,Fe,t),this};var Me=[1];function Le(e){pe.call(this,e)}function ze(e,t){for(;X(t);)switch(t.i){case 13:var n=Z(t);we(e,1,n);break;case 21:we(e,2,n=Z(t));break;case 29:we(e,3,n=Z(t));break;case 37:we(e,4,n=Z(t));break;case 45:we(e,5,n=Z(t));break;default:if(!Ee(e,t))return e}return e}function Pe(e){pe.call(this,e,-1,We)}function Be(e){e:{var t=new Pe;for(e=new K(e);X(e);)if(10===e.i){Se(t,J(e,new Le,ze),Le,void 0)}else if(!Ee(t,e))break e}return t}f(Le,pe),f(Pe,pe);var We=[1];function Ve(e){pe.call(this,e)}function Ue(e){pe.call(this,e,-1,je)}function Ge(e,t){for(;X(t);)switch(t.i){case 8:var n=G(t.g);we(e,1,n);break;case 16:we(e,2,n=G(t.g));break;case 29:case 26:te(t,e.getVertexBufferList());break;case 32:case 34:n=t;var r=e.getIndexBufferList();2==n.h?ee(n,V.prototype.i,r):r.push(n.g.i());break;default:if(!Ee(e,t))return e}return e}f(Ve,pe),f(Ue,pe),Ue.prototype.getVertexType=function(){return xe(this,1,0)},Ue.prototype.getPrimitiveType=function(){return xe(this,2,0)},Ue.prototype.getVertexBufferList=function(){return be(this)},Ue.prototype.getIndexBufferList=function(){return ye(this,4)};var je=[3,4];function He(e){pe.call(this,e)}function qe(e,t,n){if(n=e.createShader(0===n?e.VERTEX_SHADER:e.FRAGMENT_SHADER),e.shaderSource(n,t),e.compileShader(n),!e.getShaderParameter(n,e.COMPILE_STATUS))throw Error("Could not compile WebGL shader.\n\n"+e.getShaderInfoLog(n));return n}function Ke(e){return Ie(e,Fe).map(function(e){return{index:xe(e,1,0),Y:ve(e,2),label:null!=ge(e,3)?xe(e,3,""):void 0,displayName:null!=ge(e,4)?xe(e,4,""):void 0}})}function Xe(e){return{x:ve(e,1),y:ve(e,2),z:ve(e,3),visibility:null!=ge(e,4)?ve(e,4):void 0}}function Ye(e,t){this.h=e,this.g=t,this.l=0}function Je(e,t,n){return function(e,t){var n=e.g;if(void 0===e.m){var r=qe(n,"\n attribute vec2 aVertex;\n attribute vec2 aTex;\n varying vec2 vTex;\n void main(void) {\n gl_Position = vec4(aVertex, 0.0, 1.0);\n vTex = aTex;\n }",0),s=qe(n,"\n precision mediump float;\n varying vec2 vTex;\n uniform sampler2D sampler0;\n void main(){\n gl_FragColor = texture2D(sampler0, vTex);\n }",1),a=n.createProgram();if(n.attachShader(a,r),n.attachShader(a,s),n.linkProgram(a),!n.getProgramParameter(a,n.LINK_STATUS))throw Error("Could not compile WebGL program.\n\n"+n.getProgramInfoLog(a));r=e.m=a,n.useProgram(r),s=n.getUniformLocation(r,"sampler0"),e.j={I:n.getAttribLocation(r,"aVertex"),H:n.getAttribLocation(r,"aTex"),da:s},e.s=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,e.s),n.enableVertexAttribArray(e.j.I),n.vertexAttribPointer(e.j.I,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),n.STATIC_DRAW),n.bindBuffer(n.ARRAY_BUFFER,null),e.o=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,e.o),n.enableVertexAttribArray(e.j.H),n.vertexAttribPointer(e.j.H,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array([0,1,0,0,1,0,1,1]),n.STATIC_DRAW),n.bindBuffer(n.ARRAY_BUFFER,null),n.uniform1i(s,0)}r=e.j,n.useProgram(e.m),n.canvas.width=t.width,n.canvas.height=t.height,n.viewport(0,0,t.width,t.height),n.activeTexture(n.TEXTURE0),e.h.bindTexture2d(t.glName),n.enableVertexAttribArray(r.I),n.bindBuffer(n.ARRAY_BUFFER,e.s),n.vertexAttribPointer(r.I,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(r.H),n.bindBuffer(n.ARRAY_BUFFER,e.o),n.vertexAttribPointer(r.H,2,n.FLOAT,!1,0,0),n.bindFramebuffer(n.DRAW_FRAMEBUFFER?n.DRAW_FRAMEBUFFER:n.FRAMEBUFFER,null),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.colorMask(!0,!0,!0,!0),n.drawArrays(n.TRIANGLE_FAN,0,4),n.disableVertexAttribArray(r.I),n.disableVertexAttribArray(r.H),n.bindBuffer(n.ARRAY_BUFFER,null),e.h.bindTexture2d(0)}(e,t),"function"==typeof e.g.canvas.transferToImageBitmap?Promise.resolve(e.g.canvas.transferToImageBitmap()):n?Promise.resolve(e.g.canvas):"function"==typeof createImageBitmap?createImageBitmap(e.g.canvas):(void 0===e.i&&(e.i=document.createElement("canvas")),new Promise(function(t){e.i.height=e.g.canvas.height,e.i.width=e.g.canvas.width,e.i.getContext("2d",{}).drawImage(e.g.canvas,0,0,e.g.canvas.width,e.g.canvas.height),t(e.i)}))}function Ze(e){this.g=e}f(He,pe),He.prototype.getMesh=function(){return ke(this,Ue,1)},He.prototype.getPoseTransformMatrix=function(){return ke(this,$e,2)};var Qe=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,9,1,7,0,65,0,253,15,26,11]);function et(e,t){return t+e}function tt(e,t){window[e]=t}function nt(e){if(this.g=e,this.listeners={},this.j={},this.F={},this.m={},this.s={},this.G=this.o=this.R=!0,this.C=Promise.resolve(),this.P="",this.B={},this.locateFile=e&&e.locateFile||et,"object"==typeof window)var t=window.location.pathname.toString().substring(0,window.location.pathname.toString().lastIndexOf("/"))+"/";else{if("undefined"==typeof location)throw Error("solutions can only be loaded on a web page or in a web worker");t=location.pathname.toString().substring(0,location.pathname.toString().lastIndexOf("/"))+"/"}if(this.S=t,e.options)for(var n=(t=o(Object.keys(e.options))).next();!n.done;n=t.next()){n=n.value;var r=e.options[n].default;void 0!==r&&(this.j[n]="function"==typeof r?r():r)}}function rt(e){return _e(e,function e(){var t,n,r,s,a,i,o,l,c,h,d,p=this;return I(e,function(e){switch(e.g){case 1:return t=p,p.R?(n=function(e,t){return void 0===e.g.files?[]:"function"==typeof e.g.files?e.g.files(t):e.g.files}(p,p.j),b(e,function(){return _e(this,function e(){return I(e,function(e){switch(e.g){case 1:return e.m=2,b(e,WebAssembly.instantiate(Qe),4);case 4:e.g=3,e.m=0;break;case 2:return e.m=0,e.j=null,e.return(!1);case 3:return e.return(!0)}})})}(),2)):e.return();case 2:if(r=e.h,"object"==typeof window)return tt("createMediapipeSolutionsWasm",{locateFile:p.locateFile}),tt("createMediapipeSolutionsPackedAssets",{locateFile:p.locateFile}),i=n.filter(function(e){return void 0!==e.data}),o=n.filter(function(e){return void 0===e.data}),l=Promise.all(i.map(function(e){var n=st(t,e.url);if(void 0!==e.path){var r=e.path;n=n.then(function(e){return t.overrideFile(r,e),Promise.resolve(e)})}return n})),c=Promise.all(o.map(function(e){return void 0===e.simd||e.simd&&r||!e.simd&&!r?function(e){var t=document.createElement("script");return t.setAttribute("src",e),t.setAttribute("crossorigin","anonymous"),new Promise(function(e){t.addEventListener("load",function(){e()},!1),t.addEventListener("error",function(){e()},!1),document.body.appendChild(t)})}(t.locateFile(e.url,t.S)):Promise.resolve()})).then(function(){return _e(t,function e(){var t,n,r=this;return I(e,function(e){if(1==e.g)return t=window.createMediapipeSolutionsWasm,n=window.createMediapipeSolutionsPackedAssets,b(e,t(n),2);r.h=e.h,e.g=0})})}),h=_e(t,function e(){var t=this;return I(e,function(e){return t.g.graph&&t.g.graph.url?e=b(e,st(t,t.g.graph.url),0):(e.g=0,e=void 0),e})}),b(e,Promise.all([c,l,h]),7);if("function"!=typeof importScripts)throw Error("solutions can only be loaded on a web page or in a web worker");return s=n.filter(function(e){return void 0===e.simd||e.simd&&r||!e.simd&&!r}).map(function(e){return t.locateFile(e.url,t.S)}),importScripts.apply(null,u(s)),b(e,createMediapipeSolutionsWasm(Module),6);case 6:p.h=e.h,p.l=new OffscreenCanvas(1,1),p.h.canvas=p.l,a=p.h.GL.createContext(p.l,{antialias:!1,alpha:!1,ba:"undefined"!=typeof WebGL2RenderingContext?2:1}),p.h.GL.makeContextCurrent(a),e.g=4;break;case 7:if(p.l=document.createElement("canvas"),!(d=p.l.getContext("webgl2",{}))&&!(d=p.l.getContext("webgl",{})))return alert("Failed to create WebGL canvas context when passing video frame."),e.return();p.D=d,p.h.canvas=p.l,p.h.createContext(p.l,!0,!0,{});case 4:p.i=new p.h.SolutionWasm,p.R=!1,e.g=0}})})}function st(e,t){return _e(e,function e(){var n,r,s=this;return I(e,function(e){return t in s.F?e.return(s.F[t]):(n=s.locateFile(t,""),r=fetch(n).then(function(e){return e.arrayBuffer()}),s.F[t]=r,e.return(r))})})}function at(e,t,n){return _e(e,function e(){var r,s,a,i,u,l,c,h,d,p,f,m,g,y,x=this;return I(e,function(e){switch(e.g){case 1:if(!n)return e.return(t);for(r={},s=0,a=o(Object.keys(n)),i=a.next();!i.done;i=a.next())u=i.value,"string"!=typeof(l=n[u])&&"texture"===l.type&&void 0!==t[l.stream]&&++s;1<s&&(x.G=!1),c=o(Object.keys(n)),i=c.next();case 2:if(i.done){e.g=4;break}if(h=i.value,"string"==typeof(d=n[h]))return g=r,y=h,b(e,function(e,t,n){return _e(e,function e(){var r,s=this;return I(e,function(e){return"number"==typeof n||n instanceof Uint8Array||n instanceof s.h.Uint8BlobList?e.return(n):n instanceof s.h.Texture2dDataOut?((r=s.s[t])||(r=new Ye(s.h,s.D),s.s[t]=r),e.return(Je(r,n,s.G))):e.return(void 0)})})}(x,h,t[d]),14);if(p=t[d.stream],"detection_list"===d.type){if(p){for(var v=p.getRectList(),w=p.getLandmarksList(),k=p.getClassificationsList(),N=[],S=0;S<v.size();++S){var T=v.get(S);e:{var C=new Ve;for(T=new K(T);X(T);)switch(T.i){case 13:var E=Z(T);we(C,1,E);break;case 21:we(C,2,E=Z(T));break;case 29:we(C,3,E=Z(T));break;case 37:we(C,4,E=Z(T));break;case 45:we(C,5,E=Z(T));break;case 48:we(C,6,E=G(T.g));break;default:if(!Ee(C,T))break e}}C={Z:ve(C,1),$:ve(C,2),height:ve(C,3),width:ve(C,4),rotation:ve(C,5,0),X:xe(C,6,0)},T=Ie(Be(w.get(S)),Le).map(Xe);var $=k.get(S);e:for(E=new De,$=new K($);X($);)if(10===$.i)E.addClassification(J($,new Fe,Oe));else if(!Ee(E,$))break e;C={T:C,O:T,M:Ke(E)},N.push(C)}v=N}else v=[];r[h]=v,e.g=7;break}if("proto_list"===d.type){if(p){for(v=Array(p.size()),w=0;w<p.size();w++)v[w]=p.get(w);p.delete()}else v=[];r[h]=v,e.g=7;break}if(void 0===p){e.g=3;break}if("float_list"===d.type){r[h]=p,e.g=7;break}if("proto"===d.type){r[h]=p,e.g=7;break}if("texture"!==d.type)throw Error("Unknown output config type: '"+d.type+"'");return(f=x.s[h])||(f=new Ye(x.h,x.D),x.s[h]=f),b(e,Je(f,p,x.G),13);case 13:m=e.h,r[h]=m;case 7:d.transform&&r[h]&&(r[h]=d.transform(r[h])),e.g=3;break;case 14:g[y]=e.h;case 3:i=c.next(),e.g=2;break;case 4:return e.return(r)}})})}function it(e,t){for(var n=t.name||"$",r=[].concat(u(t.wants)),s=new e.h.StringList,a=o(t.wants),i=a.next();!i.done;i=a.next())s.push_back(i.value);a=e.h.PacketListener.implement({onResults:function(s){for(var a={},i=0;i<t.wants.length;++i)a[r[i]]=s.get(i);var o=e.listeners[n];o&&(e.C=at(e,a,t.outs).then(function(n){n=o(n);for(var s=0;s<t.wants.length;++s){var i=a[r[s]];"object"==typeof i&&i.hasOwnProperty&&i.hasOwnProperty("delete")&&i.delete()}n&&(e.C=n)}))}}),e.i.attachMultiListener(s,a),s.delete()}function ot(e){e=function(e){e:{var t=new He;for(e=new K(e);X(e);)switch(e.i){case 10:var n=J(e,new Ue,Ge);Ne(t,1,n);break;case 18:Ne(t,2,n=J(e,new $e,Ae));break;default:if(!Ee(t,e))break e}}return t}(e);var t=e.getMesh();if(!t)return e;var n=new Float32Array(t.getVertexBufferList());t.getVertexBufferList=function(){return n};var r=new Uint32Array(t.getIndexBufferList());return t.getIndexBufferList=function(){return r},e}(e=nt.prototype).close=function(){return this.i&&this.i.delete(),Promise.resolve()},e.reset=function(){return _e(this,function e(){var t=this;return I(e,function(e){t.i&&(t.i.reset(),t.m={},t.s={}),e.g=0})})},e.setOptions=function(e,t){var n=this;if(t=t||this.g.options){for(var r=[],s=[],a={},i=o(Object.keys(e)),u=i.next();!u.done;a={K:a.K,L:a.L},u=i.next()){var l=u.value;l in this.j&&this.j[l]===e[l]||(this.j[l]=e[l],void 0!==(u=t[l])&&(u.onChange&&(a.K=u.onChange,a.L=e[l],r.push(function(e){return function(){return _e(n,function t(){var n=this;return I(t,function(t){if(1==t.g)return b(t,e.K(e.L),2);!0===t.h&&(n.o=!0),t.g=0})})}}(a))),u.graphOptionXref&&(l={valueNumber:1===u.type?e[l]:0,valueBoolean:0===u.type&&e[l],valueString:2===u.type?e[l]:""},u=Object.assign(Object.assign(Object.assign({},{calculatorName:"",calculatorIndex:0}),u.graphOptionXref),l),s.push(u))))}0===r.length&&0===s.length||(this.o=!0,this.A=(void 0===this.A?[]:this.A).concat(s),this.u=(void 0===this.u?[]:this.u).concat(r))}},e.initialize=function(){return _e(this,function e(){var t=this;return I(e,function(e){return 1==e.g?b(e,rt(t),2):3!=e.g?b(e,_e(t,function e(){var t,n,r,s,a,i,u,l,c=this;return I(e,function(e){if(1==e.g)return c.g.graph&&c.g.graph.url&&c.P===c.g.graph.url?e.return():(c.o=!0,c.g.graph&&c.g.graph.url?(c.P=c.g.graph.url,b(e,st(c,c.g.graph.url),3)):void(e.g=2));for(2!=e.g&&(t=e.h,c.i.loadGraph(t)),n=o(Object.keys(c.B)),r=n.next();!r.done;r=n.next())s=r.value,c.i.overrideFile(s,c.B[s]);if(c.B={},c.g.listeners)for(a=o(c.g.listeners),i=a.next();!i.done;i=a.next())u=i.value,it(c,u);l=c.j,c.j={},c.setOptions(l),e.g=0})}),3):b(e,function(e){return _e(e,function e(){var t,n,r,s,a,i,u=this;return I(e,function(e){switch(e.g){case 1:if(!u.o)return e.return();if(!u.u){e.g=2;break}t=o(u.u),n=t.next();case 3:if(n.done){e.g=5;break}return b(e,(0,n.value)(),4);case 4:n=t.next(),e.g=3;break;case 5:u.u=void 0;case 2:if(u.A){for(r=new u.h.GraphOptionChangeRequestList,s=o(u.A),a=s.next();!a.done;a=s.next())i=a.value,r.push_back(i);u.i.changeOptions(r),r.delete(),u.A=void 0}u.o=!1,e.g=0}})})}(t),0)})})},e.overrideFile=function(e,t){this.i?this.i.overrideFile(e,t):this.B[e]=t},e.clearOverriddenFiles=function(){this.B={},this.i&&this.i.clearOverriddenFiles()},e.send=function(e,t){return _e(this,function n(){var r,s,a,i,u,l,c,h,d,p=this;return I(n,function(n){switch(n.g){case 1:return p.g.inputs?(r=1e3*(null==t?performance.now():t),b(n,p.C,2)):n.return();case 2:return b(n,p.initialize(),3);case 3:for(s=new p.h.PacketDataList,a=o(Object.keys(e)),i=a.next();!i.done;i=a.next())if(u=i.value,l=p.g.inputs[u]){e:{var f=p,m=e[u];switch(l.type){case"video":var g=f.m[l.stream];if(g||(g=new Ye(f.h,f.D),f.m[l.stream]=g),0===(f=g).l&&(f.l=f.h.createTexture()),"undefined"!=typeof HTMLVideoElement&&m instanceof HTMLVideoElement){var y=m.videoWidth;g=m.videoHeight}else"undefined"!=typeof HTMLImageElement&&m instanceof HTMLImageElement?(y=m.naturalWidth,g=m.naturalHeight):(y=m.width,g=m.height);g={glName:f.l,width:y,height:g},(y=f.g).canvas.width=g.width,y.canvas.height=g.height,y.activeTexture(y.TEXTURE0),f.h.bindTexture2d(f.l),y.texImage2D(y.TEXTURE_2D,0,y.RGBA,y.RGBA,y.UNSIGNED_BYTE,m),f.h.bindTexture2d(0),f=g;break e;case"detections":for((g=f.m[l.stream])||(g=new Ze(f.h),f.m[l.stream]=g),(f=g).data||(f.data=new f.g.DetectionListData),f.data.reset(m.length),g=0;g<m.length;++g){y=m[g];var x=f.data,v=x.setBoundingBox,w=g,k=y.T,I=new Ve;we(I,1,k.Z),we(I,2,k.$),we(I,3,k.height),we(I,4,k.width),we(I,5,k.rotation),we(I,6,k.X);var N=k=new ne;ae(N,1,ge(I,1)),ae(N,2,ge(I,2)),ae(N,3,ge(I,3)),ae(N,4,ge(I,4)),ae(N,5,ge(I,5));var S=ge(I,6);if(null!=S&&null!=S){q(N.g,48);var T=N.g,C=S;S=0>C;var E=(C=Math.abs(C))>>>0;for(C=Math.floor((C-E)/4294967296),C>>>=0,S&&(C=~C>>>0,4294967295<(E=(~E>>>0)+1)&&(E=0,4294967295<++C&&(C=0))),S=W=E,E=C;0<E||127<S;)T.push(127&S|128),S=(S>>>7|E<<25)>>>0,E>>>=7;T.push(S)}if(Ce(I,N),k=se(k),v.call(x,w,k),y.O)for(x=0;x<y.O.length;++x)N=!!(I=y.O[x]).visibility,w=(v=f.data).addNormalizedLandmark,k=g,I=Object.assign(Object.assign({},I),{visibility:N?I.visibility:0}),we(N=new Le,1,I.x),we(N,2,I.y),we(N,3,I.z),I.visibility&&we(N,4,I.visibility),ae(T=I=new ne,1,ge(N,1)),ae(T,2,ge(N,2)),ae(T,3,ge(N,3)),ae(T,4,ge(N,4)),ae(T,5,ge(N,5)),Ce(N,T),I=se(I),w.call(v,k,I);if(y.M)for(x=0;x<y.M.length;++x){if(w=(v=f.data).addClassification,k=g,I=y.M[x],we(N=new Fe,2,I.Y),I.index&&we(N,1,I.index),I.label&&we(N,3,I.label),I.displayName&&we(N,4,I.displayName),T=I=new ne,null!=(E=ge(N,1))&&null!=E)if(q(T.g,8),S=T.g,0<=E)q(S,E);else{for(C=0;9>C;C++)S.push(127&E|128),E>>=7;S.push(1)}ae(T,2,ge(N,2)),null!=(S=ge(N,3))&&(S=_(S),q(T.g,26),q(T.g,S.length),re(T,T.g.end()),re(T,S)),null!=(S=ge(N,4))&&(S=_(S),q(T.g,34),q(T.g,S.length),re(T,T.g.end()),re(T,S)),Ce(N,T),I=se(I),w.call(v,k,I)}}f=f.data;break e;default:f={}}}switch(c=f,h=l.stream,l.type){case"video":s.pushTexture2d(Object.assign(Object.assign({},c),{stream:h,timestamp:r}));break;case"detections":(d=c).stream=h,d.timestamp=r,s.pushDetectionList(d);break;default:throw Error("Unknown input config type: '"+l.type+"'")}}return p.i.send(s),b(n,p.C,4);case 4:s.delete(),n.g=0}})})},e.onResults=function(e,t){this.listeners[t||"$"]=e},T("Solution",nt),T("OptionType",{BOOL:0,NUMBER:1,aa:2,0:"BOOL",1:"NUMBER",2:"STRING"});var ut={files:[{url:"face_mesh_solution_packed_assets_loader.js"},{simd:!0,url:"face_mesh_solution_simd_wasm_bin.js"},{simd:!1,url:"face_mesh_solution_wasm_bin.js"}],graph:{url:"face_mesh.binarypb"},listeners:[{wants:["multi_face_geometry","image_transformed","multi_face_landmarks"],outs:{image:"image_transformed",multiFaceGeometry:{type:"proto_list",stream:"multi_face_geometry",transform:function(e){return e.map(ot)}},multiFaceLandmarks:{type:"proto_list",stream:"multi_face_landmarks",transform:function(e){return e.map(function(e){return Ie(Be(e),Le).map(Xe)})}}}}],inputs:{image:{type:"video",stream:"input_frames_gpu"}},options:{useCpuInference:{type:0,graphOptionXref:{calculatorType:"InferenceCalculator",fieldName:"use_cpu_inference"},default:"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";").includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document},enableFaceGeometry:{type:0,graphOptionXref:{calculatorName:"EnableFaceGeometryConstant",calculatorType:"ConstantSidePacketCalculator",fieldName:"bool_value"}},selfieMode:{type:0,graphOptionXref:{calculatorType:"GlScalerCalculator",calculatorIndex:1,fieldName:"flip_horizontal"}},maxNumFaces:{type:1,graphOptionXref:{calculatorType:"ConstantSidePacketCalculator",calculatorName:"ConstantSidePacketCalculatorNumFaces",fieldName:"int_value"}},refineLandmarks:{type:0,graphOptionXref:{calculatorType:"ConstantSidePacketCalculator",calculatorName:"ConstantSidePacketCalculatorRefineLandmarks",fieldName:"bool_value"}},minDetectionConfidence:{type:1,graphOptionXref:{calculatorType:"TensorsToDetectionsCalculator",calculatorName:"facelandmarkfrontgpu__facedetectionshortrangegpu__facedetectionshortrangecommon__TensorsToDetectionsCalculator",fieldName:"min_score_thresh"}},minTrackingConfidence:{type:1,graphOptionXref:{calculatorType:"ThresholdingCalculator",calculatorName:"facelandmarkfrontgpu__facelandmarkgpu__ThresholdingCalculator",fieldName:"threshold"}},cameraNear:{type:1,graphOptionXref:{calculatorType:"FaceGeometryEnvGeneratorCalculator",fieldName:"near"}},cameraFar:{type:1,graphOptionXref:{calculatorType:"FaceGeometryEnvGeneratorCalculator",fieldName:"far"}},cameraVerticalFovDegrees:{type:1,graphOptionXref:{calculatorType:"FaceGeometryEnvGeneratorCalculator",fieldName:"vertical_fov_degrees"}}}},lt=[[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]],ct=[[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]],ht=[[276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]],dt=[[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]],pt=[[46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]],ft=[[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]],mt=[].concat(u(lt),u(ct),u(ht),u(dt),u(pt),u(ft));function gt(e){e=e||{},e=Object.assign(Object.assign({},ut),e),this.g=new nt(e)}(e=gt.prototype).close=function(){return this.g.close(),Promise.resolve()},e.onResults=function(e){this.g.onResults(e)},e.initialize=function(){return _e(this,function e(){var t=this;return I(e,function(e){return b(e,t.g.initialize(),0)})})},e.reset=function(){this.g.reset()},e.send=function(e){return _e(this,function t(){var n=this;return I(t,function(t){return b(t,n.g.send(e),0)})})},e.setOptions=function(e){this.g.setOptions(e)},T("FACE_GEOMETRY",{Layout:{COLUMN_MAJOR:0,ROW_MAJOR:1,0:"COLUMN_MAJOR",1:"ROW_MAJOR"},PrimitiveType:{TRIANGLE:0,0:"TRIANGLE"},VertexType:{VERTEX_PT:0,0:"VERTEX_PT"},DEFAULT_CAMERA_PARAMS:{verticalFovDegrees:63,near:1,far:1e4}}),T("FaceMesh",gt),T("FACEMESH_LIPS",lt),T("FACEMESH_LEFT_EYE",ct),T("FACEMESH_LEFT_EYEBROW",ht),T("FACEMESH_LEFT_IRIS",[[474,475],[475,476],[476,477],[477,474]]),T("FACEMESH_RIGHT_EYE",dt),T("FACEMESH_RIGHT_EYEBROW",pt),T("FACEMESH_RIGHT_IRIS",[[469,470],[470,471],[471,472],[472,469]]),T("FACEMESH_FACE_OVAL",ft),T("FACEMESH_CONTOURS",mt),T("FACEMESH_TESSELATION",[[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],[44