aframe-vartiste-toolkit
Version:
Toolkit to create GUI similar to VARTISTE
2 lines • 108 kB
JavaScript
/*! For license information please see 577.vartiste-toolkit.js.LICENSE.txt */
(self.webpackChunkvartiste=self.webpackChunkvartiste||[]).push([[577],{4577:function(e,t,i){e.exports=function(){"use strict";class t{constructor(e,t){this.handsfree=e,this.config=t,this.data={},this.dependenciesLoaded=!1,this.enabled=t.enabled,this.plugins=[],this.gestures=[],this.gestureEstimator=null,setTimeout((()=>{const e=this.getData;this.getData=async()=>{let t=await e.apply(this,arguments)||{};return t.gesture=this.getGesture(),this.runPlugins(),t};let t=this.getGesture;this.getGesture=()=>(t||(t=function(){}),t.apply(this,arguments))}),0)}loadDependencies(){}updateData(){}updateGestureEstimator(){}enable(e=!0){this.handsfree.config[this.name]=this.config,this.handsfree.config[this.name].enabled=this.enabled=!0,document.body.classList.add(`handsfree-model-${this.name}`),e&&!this.dependenciesLoaded&&this.loadDependencies(),"weboji"===this.name&&(this.handsfree.debug.$canvas.weboji.style.display="block")}disable(){this.handsfree.config[this.name]=this.config,this.handsfree.config[this.name].enabled=this.enabled=!1,document.body.classList.remove(`handsfree-model-${this.name}`),setTimeout((()=>{var e;"weboji"===this.name?this.handsfree.debug.$canvas.weboji.style.display="none":(null===(e=this.handsfree.debug.context[this.name])||void 0===e?void 0:e.clearRect)&&this.handsfree.debug.context[this.name].clearRect(0,0,this.handsfree.debug.$canvas[this.name].width,this.handsfree.debug.$canvas[this.name].height),Object.keys(this.handsfree.model).some((e=>this.handsfree.model[e].enabled))||this.handsfree.stop()}),0)}loadDependency(e,t,i=!1){if(i)return void(t&&t());const n=document.createElement("script");n.async=!0,n.onload=()=>{t&&t()},n.onerror=()=>{this.handsfree.emit("modelError",`Error loading ${e}`)},n.src=e,document.body.appendChild(n)}runPlugins(){this.data&&("handpose"!==this.name||this.data.annotations)&&Object.keys(this.data).length&&this.plugins.forEach((e=>{var t;this.handsfree.plugin[e].enabled&&(null===(t=this.handsfree.plugin[e])||void 0===t||t.onFrame(this.handsfree.data))}))}}var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==i.g?i.g:"undefined"!=typeof self?self:{};function s(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function r(e,t,i){return e(i={path:t,exports:{},require:function(e,t){return a(e,null==t?i.path:t)}},i.exports),i.exports}function a(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var o=r((function(e,t){var i;"undefined"!=typeof self&&self,i=function(){return function(e){var t={};function i(n){if(t[n])return t[n].exports;var s=t[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)i.d(n,s,function(t){return e[t]}.bind(null,s));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=0)}([function(e,t,i){i.r(t);var n={};function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}i.r(n),i.d(n,"VictoryGesture",(function(){return x})),i.d(n,"ThumbsUpGesture",(function(){return C}));var r={Thumb:0,Index:1,Middle:2,Ring:3,Pinky:4,all:[0,1,2,3,4],nameMapping:{0:"Thumb",1:"Index",2:"Middle",3:"Ring",4:"Pinky"},pointsMapping:{0:[[0,1],[1,2],[2,3],[3,4]],1:[[0,5],[5,6],[6,7],[7,8]],2:[[0,9],[9,10],[10,11],[11,12]],3:[[0,13],[13,14],[14,15],[15,16]],4:[[0,17],[17,18],[18,19],[19,20]]},getName:function(e){return void 0!==s(this.nameMapping[e])&&this.nameMapping[e]},getPoints:function(e){return void 0!==s(this.pointsMapping[e])&&this.pointsMapping[e]}},a={NoCurl:0,HalfCurl:1,FullCurl:2,nameMapping:{0:"No Curl",1:"Half Curl",2:"Full Curl"},getName:function(e){return void 0!==s(this.nameMapping[e])&&this.nameMapping[e]}},o={VerticalUp:0,VerticalDown:1,HorizontalLeft:2,HorizontalRight:3,DiagonalUpRight:4,DiagonalUpLeft:5,DiagonalDownRight:6,DiagonalDownLeft:7,nameMapping:{0:"Vertical Up",1:"Vertical Down",2:"Horizontal Left",3:"Horizontal Right",4:"Diagonal Up Right",5:"Diagonal Up Left",6:"Diagonal Down Right",7:"Diagonal Down Left"},getName:function(e){return void 0!==s(this.nameMapping[e])&&this.nameMapping[e]}};function h(e){if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,t){if(e){if("string"==typeof e)return l(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?l(e,t):void 0}}(e))){var t=0,i=function(){};return{s:i,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,s,r=!0,a=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return r=e.done,e},e:function(e){a=!0,s=e},f:function(){try{r||null==n.return||n.return()}finally{if(a)throw s}}}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function d(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function c(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function u(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var f=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.options=function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?d(Object(i),!0).forEach((function(t){c(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):d(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}({},{HALF_CURL_START_LIMIT:60,NO_CURL_START_LIMIT:130,DISTANCE_VOTE_POWER:1.1,SINGLE_ANGLE_VOTE_POWER:.9,TOTAL_ANGLE_VOTE_POWER:1.6},{},t)}var t;return(t=[{key:"estimate",value:function(e){var t,i=[],n=[],s=h(r.all);try{for(s.s();!(t=s.n()).done;){var a,o=t.value,l=r.getPoints(o),d=[],c=[],u=h(l);try{for(u.s();!(a=u.n()).done;){var f=a.value,p=e[f[0]],m=e[f[1]],g=this.getSlopes(p,m),_=g[0],v=g[1];d.push(_),c.push(v)}}catch(e){u.e(e)}finally{u.f()}i.push(d),n.push(c)}}catch(e){s.e(e)}finally{s.f()}var y,b=[],w=[],T=h(r.all);try{for(T.s();!(y=T.n()).done;){var P=y.value,E=P==r.Thumb?1:0,S=r.getPoints(P),x=e[S[E][0]],D=e[S[E+1][1]],k=e[S[3][1]],R=this.estimateFingerCurl(x,D,k),j=this.calculateFingerDirection(x,D,k,i[P].slice(E));b[P]=R,w[P]=j}}catch(e){T.e(e)}finally{T.f()}return{curls:b,directions:w}}},{key:"getSlopes",value:function(e,t){var i=this.calculateSlope(e[0],e[1],t[0],t[1]);return 2==e.length?i:[i,this.calculateSlope(e[1],e[2],t[1],t[2])]}},{key:"angleOrientationAt",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=0,n=0,s=0;return e>=75&&e<=105?i=1*t:e>=25&&e<=155?n=1*t:s=1*t,[i,n,s]}},{key:"estimateFingerCurl",value:function(e,t,i){var n=e[0]-t[0],s=e[0]-i[0],r=t[0]-i[0],o=e[1]-t[1],h=e[1]-i[1],l=t[1]-i[1],d=e[2]-t[2],c=e[2]-i[2],u=t[2]-i[2],f=Math.sqrt(n*n+o*o+d*d),p=Math.sqrt(s*s+h*h+c*c),m=Math.sqrt(r*r+l*l+u*u),g=(m*m+f*f-p*p)/(2*m*f);g>1?g=1:g<-1&&(g=-1);var _=Math.acos(g);return(_=57.2958*_%180)>this.options.NO_CURL_START_LIMIT?a.NoCurl:_>this.options.HALF_CURL_START_LIMIT?a.HalfCurl:a.FullCurl}},{key:"estimateHorizontalDirection",value:function(e,t,i,n){return n==Math.abs(e)?e>0?o.HorizontalLeft:o.HorizontalRight:n==Math.abs(t)?t>0?o.HorizontalLeft:o.HorizontalRight:i>0?o.HorizontalLeft:o.HorizontalRight}},{key:"estimateVerticalDirection",value:function(e,t,i,n){return n==Math.abs(e)?e<0?o.VerticalDown:o.VerticalUp:n==Math.abs(t)?t<0?o.VerticalDown:o.VerticalUp:i<0?o.VerticalDown:o.VerticalUp}},{key:"estimateDiagonalDirection",value:function(e,t,i,n,s,r,a,h){var l=this.estimateVerticalDirection(e,t,i,n),d=this.estimateHorizontalDirection(s,r,a,h);return l==o.VerticalUp?d==o.HorizontalLeft?o.DiagonalUpLeft:o.DiagonalUpRight:d==o.HorizontalLeft?o.DiagonalDownLeft:o.DiagonalDownRight}},{key:"calculateFingerDirection",value:function(e,t,i,n){var s=e[0]-t[0],r=e[0]-i[0],a=t[0]-i[0],o=e[1]-t[1],l=e[1]-i[1],d=t[1]-i[1],c=Math.max(Math.abs(s),Math.abs(r),Math.abs(a)),u=Math.max(Math.abs(o),Math.abs(l),Math.abs(d)),f=0,p=0,m=0,g=u/(c+1e-5);g>1.5?f+=this.options.DISTANCE_VOTE_POWER:g>.66?p+=this.options.DISTANCE_VOTE_POWER:m+=this.options.DISTANCE_VOTE_POWER;var _=Math.sqrt(s*s+o*o),v=Math.sqrt(r*r+l*l),y=Math.sqrt(a*a+d*d),b=Math.max(_,v,y),w=e[0],T=e[1],P=i[0],E=i[1];b==_?(P=i[0],E=i[1]):b==y&&(w=t[0],T=t[1]);var S=[w,T],x=[P,E],D=this.getSlopes(S,x),k=this.angleOrientationAt(D,this.options.TOTAL_ANGLE_VOTE_POWER);f+=k[0],p+=k[1],m+=k[2];var R,j=h(n);try{for(j.s();!(R=j.n()).done;){var C=R.value,$=this.angleOrientationAt(C,this.options.SINGLE_ANGLE_VOTE_POWER);f+=$[0],p+=$[1],m+=$[2]}}catch(e){j.e(e)}finally{j.f()}return f==Math.max(f,p,m)?this.estimateVerticalDirection(l,o,d,u):m==Math.max(p,m)?this.estimateHorizontalDirection(r,s,a,c):this.estimateDiagonalDirection(l,o,d,u,r,s,a,c)}},{key:"calculateSlope",value:function(e,t,i,n){var s=(t-n)/(e-i),r=180*Math.atan(s)/Math.PI;return r<=0?r=-r:r>0&&(r=180-r),r}}])&&u(e.prototype,t),e}();function p(e){if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,t){if(e){if("string"==typeof e)return m(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?m(e,t):void 0}}(e))){var t=0,i=function(){};return{s:i,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,s,r=!0,a=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return r=e.done,e},e:function(e){a=!0,s=e},f:function(){try{r||null==n.return||n.return()}finally{if(a)throw s}}}}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function g(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var v=function(){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};g(this,e),this.estimator=new f(i),this.gestures=t}var t;return(t=[{key:"estimate",value:function(e,t){var i,n=[],s=this.estimator.estimate(e),h=[],l=p(r.all);try{for(l.s();!(i=l.n()).done;){var d=i.value;h.push([r.getName(d),a.getName(s.curls[d]),o.getName(s.directions[d])])}}catch(e){l.e(e)}finally{l.f()}var c,u=p(this.gestures);try{for(u.s();!(c=u.n()).done;){var f=c.value,m=f.matchAgainst(s.curls,s.directions);m>=t&&n.push({name:f.name,confidence:m})}}catch(e){u.e(e)}finally{u.f()}return{poseData:h,gestures:n}}}])&&_(e.prototype,t),e}();function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var i=[],n=!0,s=!1,r=void 0;try{for(var a,o=e[Symbol.iterator]();!(n=(a=o.next()).done)&&(i.push(a.value),!t||i.length!==t);n=!0);}catch(e){s=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(s)throw r}}return i}}(e,t)||w(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e){if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=w(e))){var t=0,i=function(){};return{s:i,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,s,r=!0,a=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return r=e.done,e},e:function(e){a=!0,s=e},f:function(){try{r||null==n.return||n.return()}finally{if(a)throw s}}}}function w(e,t){if(e){if("string"==typeof e)return T(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?T(e,t):void 0}}function T(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function P(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var E=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.name=t,this.curls={},this.directions={},this.weights=[1,1,1,1,1],this.weightsRelative=[1,1,1,1,1]}var t;return(t=[{key:"addCurl",value:function(e,t,i){void 0===this.curls[e]&&(this.curls[e]=[]),this.curls[e].push([t,i])}},{key:"addDirection",value:function(e,t,i){void 0===this.directions[e]&&(this.directions[e]=[]),this.directions[e].push([t,i])}},{key:"setWeight",value:function(e,t){this.weights[e]=t;var i=this.weights.reduce((function(e,t){return e+t}),0);this.weightsRelative=this.weights.map((function(e){return 5*e/i}))}},{key:"matchAgainst",value:function(e,t){var i=0;for(var n in e){var s=e[n],r=this.curls[n];if(void 0!==r){var a,o=b(r);try{for(o.s();!(a=o.n()).done;){var h=y(a.value,2),l=h[0],d=h[1];if(s==l){i+=d*this.weightsRelative[n];break}}}catch(e){o.e(e)}finally{o.f()}}else i+=this.weightsRelative[n]}for(var c in t){var u=t[c],f=this.directions[c];if(void 0!==f){var p,m=b(f);try{for(m.s();!(p=m.n()).done;){var g=y(p.value,2),_=g[0],v=g[1];if(u==_){i+=v*this.weightsRelative[c];break}}}catch(e){m.e(e)}finally{m.f()}}else i+=this.weightsRelative[c]}return i}}])&&P(e.prototype,t),e}(),S=new E("victory");S.addCurl(r.Thumb,a.HalfCurl,.5),S.addCurl(r.Thumb,a.NoCurl,.5),S.addDirection(r.Thumb,o.VerticalUp,1),S.addDirection(r.Thumb,o.DiagonalUpLeft,1),S.addCurl(r.Index,a.NoCurl,1),S.addDirection(r.Index,o.VerticalUp,.75),S.addDirection(r.Index,o.DiagonalUpLeft,1),S.addCurl(r.Middle,a.NoCurl,1),S.addDirection(r.Middle,o.VerticalUp,1),S.addDirection(r.Middle,o.DiagonalUpLeft,.75),S.addCurl(r.Ring,a.FullCurl,1),S.addDirection(r.Ring,o.VerticalUp,.2),S.addDirection(r.Ring,o.DiagonalUpLeft,1),S.addDirection(r.Ring,o.HorizontalLeft,.2),S.addCurl(r.Pinky,a.FullCurl,1),S.addDirection(r.Pinky,o.VerticalUp,.2),S.addDirection(r.Pinky,o.DiagonalUpLeft,1),S.addDirection(r.Pinky,o.HorizontalLeft,.2),S.setWeight(r.Index,2),S.setWeight(r.Middle,2);var x=S,D=new E("thumbs_up");D.addCurl(r.Thumb,a.NoCurl,1),D.addDirection(r.Thumb,o.VerticalUp,1),D.addDirection(r.Thumb,o.DiagonalUpLeft,.25),D.addDirection(r.Thumb,o.DiagonalUpRight,.25);for(var k=0,R=[r.Index,r.Middle,r.Ring,r.Pinky];k<R.length;k++){var j=R[k];D.addCurl(j,a.FullCurl,1),D.addDirection(j,o.HorizontalLeft,1),D.addDirection(j,o.HorizontalRight,1)}var C=D;t.default={GestureEstimator:v,GestureDescription:E,Finger:r,FingerCurl:a,FingerDirection:o,Gestures:n}}]).default},e.exports=i()})),h=s(o);class l extends t{constructor(e,t){super(e,t),this.name="hands",this.palmPoints=[0,5,9,13,17],this.gestureEstimator=new h.GestureEstimator([])}loadDependencies(e){this.handsfree.config.isClient?this.loadDependency(`${this.handsfree.config.assetsPath}/@mediapipe/drawing_utils.js`,(()=>{this.onWarmUp(e)}),!!window.drawConnectors):this.loadDependency(`${this.handsfree.config.assetsPath}/@mediapipe/hands/hands.js`,(()=>{this.api=new window.Hands({locateFile:e=>`${this.handsfree.config.assetsPath}/@mediapipe/hands/${e}`}),this.api.setOptions(this.handsfree.config.hands),this.api.onResults((e=>this.dataReceived(e))),this.handsfree.getUserMedia((()=>{this.handsfree.mediapipeWarmups.isWarmingUp?this.handsfree.on("mediapipeWarmedUp",(()=>{this.handsfree.mediapipeWarmups.isWarmingUp||this.handsfree.mediapipeWarmups[this.name]||this.warmUp(e)})):this.warmUp(e)})),this.loadDependency(`${this.handsfree.config.assetsPath}/@mediapipe/drawing_utils.js`,null,!!window.drawConnectors)}))}warmUp(e){this.handsfree.mediapipeWarmups[this.name]=!0,this.handsfree.mediapipeWarmups.isWarmingUp=!0,this.api.send({image:this.handsfree.debug.$video}).then((()=>{this.handsfree.mediapipeWarmups.isWarmingUp=!1,this.onWarmUp(e)}))}onWarmUp(e){this.dependenciesLoaded=!0,document.body.classList.add("handsfree-model-hands"),this.handsfree.emit("modelReady",this),this.handsfree.emit("handsModelReady",this),this.handsfree.emit("mediapipeWarmedUp",this),e&&e(this)}async getData(){return this.dependenciesLoaded&&await this.api.send({image:this.handsfree.debug.$video}),this.data}dataReceived(e){e.multiHandLandmarks&&(e=this.getCenterOfPalm(e)),e=this.forceHandedness(e),this.data=e,this.handsfree.data.hands=e,this.handsfree.isDebugging&&this.debug(e)}forceHandedness(e){return e.landmarks=[[],[],[],[]],e.landmarksVisible=[!1,!1,!1,!1],e.multiHandLandmarks?(e.multiHandLandmarks.forEach(((t,i)=>{let n;n=i<2?"Right"===e.multiHandedness[i].label?0:1:"Right"===e.multiHandedness[i].label?2:3,e.landmarks[n]=t,e.landmarksVisible[n]=!0})),e):e}getCenterOfPalm(e){return e.multiHandLandmarks.forEach(((t,i)=>{let n=0,s=0;this.palmPoints.forEach((e=>{n+=t[e].x,s+=t[e].y})),n/=this.palmPoints.length,s/=this.palmPoints.length,e.multiHandLandmarks[i][21]={x:n,y:s}})),e}debug(e){if("undefined"!=typeof drawConnectors&&(this.handsfree.debug.context.hands.clearRect(0,0,this.handsfree.debug.$canvas.hands.width,this.handsfree.debug.$canvas.hands.height),e.multiHandLandmarks))for(const t of e.multiHandLandmarks)drawConnectors(this.handsfree.debug.context.hands,t,HAND_CONNECTIONS,{color:"#00FF00",lineWidth:5}),drawLandmarks(this.handsfree.debug.context.hands,t,{color:"#FF0000",lineWidth:2})}updateGestureEstimator(){const e=[],t=[];this.gestures.forEach((t=>{if(this.handsfree.gesture[t].enabled&&(e.push(t),!this.handsfree.gesture[t].compiledDescription&&this.handsfree.gesture[t].enabled)){const e=new h.GestureDescription(t);this.handsfree.gesture[t].description.forEach((t=>{switch(t[0]){case"addCurl":e[t[0]](h.Finger[t[1]],h.FingerCurl[t[2]],t[3]);break;case"addDirection":e[t[0]](h.Finger[t[1]],h.FingerDirection[t[2]],t[3]);break;case"setWeight":e[t[0]](h.Finger[t[1]],t[2])}})),this.handsfree.gesture[t].compiledDescription=e}})),e.forEach((e=>{t.push(this.handsfree.gesture[e].compiledDescription)})),e.length&&(this.gestureEstimator=new h.GestureEstimator(t))}getGesture(){let e=[null,null,null,null];return this.data.landmarks.forEach(((t,i)=>{if(this.data.landmarksVisible[i]){const n=[];for(let e=0;e<21;e++)n.push([t[e].x*window.outerWidth,t[e].y*window.outerHeight,0]);const s=this.gestureEstimator.estimate(n,7.5);if(s.gestures.length?e[i]=s.gestures.reduce(((e,t)=>{const i=this.handsfree.gesture[t.name].confidence;return t.confidence>=i&&t.confidence>e.confidence?t:e})):e[i]={name:"",confidence:0},e[i].name){const t=this.handsfree.gesture[e[i].name].confidence;e[i].confidence<t&&(e[i]={name:"",confidence:0})}e[i].pose=s.poseData}})),e}}class d extends t{constructor(e,t){super(e,t),this.name="facemesh",this.isWarmedUp=!1}loadDependencies(e){this.handsfree.config.isClient?this.loadDependency(`${this.handsfree.config.assetsPath}/@mediapipe/drawing_utils.js`,(()=>{this.onWarmUp(e)}),!!window.drawConnectors):this.loadDependency(`${this.handsfree.config.assetsPath}/@mediapipe/face_mesh/face_mesh.js`,(()=>{this.api=new window.FaceMesh({locateFile:e=>`${this.handsfree.config.assetsPath}/@mediapipe/face_mesh/${e}`}),this.api.setOptions(this.handsfree.config.facemesh),this.api.onResults((e=>this.dataReceived(e))),this.handsfree.getUserMedia((()=>{this.handsfree.mediapipeWarmups.isWarmingUp?this.handsfree.on("mediapipeWarmedUp",(()=>{this.handsfree.mediapipeWarmups.isWarmingUp||this.handsfree.mediapipeWarmups[this.name]||this.warmUp(e)})):this.warmUp(e)})),this.loadDependency(`${this.handsfree.config.assetsPath}/@mediapipe/drawing_utils.js`,null,!!window.drawConnectors)}))}warmUp(e){this.handsfree.mediapipeWarmups[this.name]=!0,this.handsfree.mediapipeWarmups.isWarmingUp=!0,this.api.send({image:this.handsfree.debug.$video}).then((()=>{this.handsfree.mediapipeWarmups.isWarmingUp=!1,this.onWarmUp(e)}))}onWarmUp(e){this.dependenciesLoaded=!0,document.body.classList.add("handsfree-model-facemesh"),this.handsfree.emit("modelReady",this),this.handsfree.emit("facemeshModelReady",this),this.handsfree.emit("mediapipeWarmedUp",this),e&&e(this)}async getData(){this.dependenciesLoaded&&await this.api.send({image:this.handsfree.debug.$video})}dataReceived(e){this.data=e,this.handsfree.data.facemesh=e,this.handsfree.isDebugging&&this.debug(e)}debug(e){if("undefined"!=typeof drawConnectors&&(this.handsfree.debug.context.facemesh.clearRect(0,0,this.handsfree.debug.$canvas.facemesh.width,this.handsfree.debug.$canvas.facemesh.height),e.multiFaceLandmarks))for(const t of e.multiFaceLandmarks)drawConnectors(this.handsfree.debug.context.facemesh,t,FACEMESH_TESSELATION,{color:"#C0C0C070",lineWidth:1}),drawConnectors(this.handsfree.debug.context.facemesh,t,FACEMESH_RIGHT_EYE,{color:"#FF3030"}),drawConnectors(this.handsfree.debug.context.facemesh,t,FACEMESH_RIGHT_EYEBROW,{color:"#FF3030"}),drawConnectors(this.handsfree.debug.context.facemesh,t,FACEMESH_LEFT_EYE,{color:"#30FF30"}),drawConnectors(this.handsfree.debug.context.facemesh,t,FACEMESH_LEFT_EYEBROW,{color:"#30FF30"}),drawConnectors(this.handsfree.debug.context.facemesh,t,FACEMESH_FACE_OVAL,{color:"#E0E0E0"}),drawConnectors(this.handsfree.debug.context.facemesh,t,FACEMESH_LIPS,{color:"#E0E0E0"})}}class c extends t{constructor(e,t){super(e,t),this.name="pose",this.hasLoadedAndRun=!1,this.palmPoints=[0,1,2,5,9,13,17]}loadDependencies(e){this.handsfree.config.isClient?this.loadDependency(`${this.handsfree.config.assetsPath}/@mediapipe/drawing_utils.js`,(()=>{this.onWarmUp(e)}),!!window.drawConnectors):this.loadDependency(`${this.handsfree.config.assetsPath}/@mediapipe/pose/pose.js`,(()=>{this.api=new window.Pose({locateFile:e=>`${this.handsfree.config.assetsPath}/@mediapipe/pose/${e}`}),this.api.setOptions(this.handsfree.config.pose),this.api.onResults((e=>this.dataReceived(e))),this.handsfree.getUserMedia((()=>{this.handsfree.mediapipeWarmups.isWarmingUp?this.handsfree.on("mediapipeWarmedUp",(()=>{this.handsfree.mediapipeWarmups.isWarmingUp||this.handsfree.mediapipeWarmups[this.name]||this.warmUp(e)})):this.warmUp(e)})),this.loadDependency(`${this.handsfree.config.assetsPath}/@mediapipe/drawing_utils.js`,null,!!window.drawConnectors)}))}warmUp(e){this.handsfree.mediapipeWarmups[this.name]=!0,this.handsfree.mediapipeWarmups.isWarmingUp=!0,this.api.send({image:this.handsfree.debug.$video}).then((()=>{this.handsfree.mediapipeWarmups.isWarmingUp=!1,this.onWarmUp(e)}))}onWarmUp(e){this.dependenciesLoaded=!0,document.body.classList.add("handsfree-model-pose"),this.handsfree.emit("modelReady",this),this.handsfree.emit("poseModelReady",this),this.handsfree.emit("mediapipeWarmedUp",this),e&&e(this)}async getData(){this.dependenciesLoaded&&await this.api.send({image:this.handsfree.debug.$video})}dataReceived(e){this.data=e,this.handsfree.data.pose=e,this.handsfree.isDebugging&&this.debug(e)}debug(e){this.handsfree.debug.context.pose.clearRect(0,0,this.handsfree.debug.$canvas.pose.width,this.handsfree.debug.$canvas.pose.height),e.poseLandmarks&&(drawConnectors(this.handsfree.debug.context.pose,e.poseLandmarks,POSE_CONNECTIONS,{color:"#00FF00",lineWidth:4}),drawLandmarks(this.handsfree.debug.context.pose,e.poseLandmarks,{color:"#FF0000",lineWidth:2}))}}class u extends t{constructor(e,t){super(e,t),this.name="handpose",this.three={scene:null,camera:null,renderer:null,meshes:[]},this.normalized=[],this.palmPoints=[0,1,2,5,9,13,17],this.gestureEstimator=new h.GestureEstimator([])}loadDependencies(e){this.loadDependency(`${this.handsfree.config.assetsPath}/three/three.min.js`,(()=>{this.loadDependency(`${this.handsfree.config.assetsPath}/@tensorflow/tf-core.js`,(()=>{this.loadDependency(`${this.handsfree.config.assetsPath}/@tensorflow/tf-converter.js`,(()=>{this.loadDependency(`${this.handsfree.config.assetsPath}/@tensorflow/tf-backend-${this.handsfree.config.handpose.backend}.js`,(()=>{this.loadDependency(`${this.handsfree.config.assetsPath}/@tensorflow-models/handpose/handpose.js`,(()=>{this.handsfree.getUserMedia((async()=>{await window.tf.setBackend(this.handsfree.config.handpose.backend),this.api=await handpose.load(this.handsfree.config.handpose.model),this.setup3D(),e&&e(this),this.dependenciesLoaded=!0,this.handsfree.emit("modelReady",this),this.handsfree.emit("handposeModelReady",this),document.body.classList.add("handsfree-model-handpose")}))}))}))}))}),!!window.tf)}),!!window.THREE)}async getData(){if(!this.handsfree.debug.$video)return;const e=await this.api.estimateHands(this.handsfree.debug.$video);return this.handsfree.data.handpose=this.data={...e[0],normalized:this.normalized,meshes:this.three.meshes},e[0]&&this.updateMeshes(this.data),this.three.renderer.render(this.three.scene,this.three.camera),this.data}setup3D(){this.three={scene:new window.THREE.Scene,camera:new window.THREE.PerspectiveCamera(90,window.outerWidth/window.outerHeight,.1,1e3),renderer:new THREE.WebGLRenderer({alpha:!0,canvas:this.handsfree.debug.$canvas.handpose}),meshes:[]},this.three.renderer.setSize(window.outerWidth,window.outerHeight),this.three.camera.position.z=this.handsfree.debug.$video.videoWidth/4,this.three.camera.lookAt(new window.THREE.Vector3(0,0,0)),this.three.screen=new window.THREE.Mesh(new window.THREE.BoxGeometry(window.outerWidth,window.outerHeight,1),new window.THREE.MeshNormalMaterial),this.three.screen.position.z=300,this.three.scene.add(this.three.screen),this.three.raycaster=new window.THREE.Raycaster,this.three.arrow=new window.THREE.ArrowHelper(this.three.raycaster.ray.direction,this.three.raycaster.ray.origin,300,16711680),this.three.scene.add(this.three.arrow);for(let e=0;e<21;e++){const{isPalm:t}=this.getLandmarkProperty(e),i=new window.THREE.Object3D,n=new window.THREE.CylinderGeometry(t?5:10,5,1);let s=new window.THREE.MeshNormalMaterial;const r=new window.THREE.Mesh(n,s);r.rotation.x=Math.PI/2,i.add(r),this.three.scene.add(i),this.three.meshes.push(i)}const e=new window.THREE.Object3D,t=new window.THREE.CylinderGeometry(5,5,1);let i=new window.THREE.MeshNormalMaterial;const n=new window.THREE.Mesh(t,i);n.rotation.x=Math.PI/2,this.three.centerPalmObj=e,e.add(n),this.three.scene.add(e),this.three.meshes.push(e),this.three.screen.visible=!1}getLandmarkProperty(e){const t=[0,1,2,5,9,13,17],i=t.indexOf(e),n=-1!=i;let s;return s=n?t[(i+1)%t.length]:e-1,{isPalm:n,next:s}}updateMeshes(e){for(let t=0;t<this.three.meshes.length-1;t++){const{next:i}=this.getLandmarkProperty(t),n=this.webcam2space(...e.landmarks[t]),s=this.webcam2space(...e.landmarks[i]),r=n.clone().lerp(s,.5);if(this.three.meshes[t].position.set(r.x,r.y,r.z),this.normalized[t]=[this.handsfree.normalize(n.x,this.handsfree.debug.$video.videoWidth/-2,this.handsfree.debug.$video.videoWidth/2),this.handsfree.normalize(n.y,this.handsfree.debug.$video.videoHeight/-2,this.handsfree.debug.$video.videoHeight/2),this.three.meshes[t].position.z],this.three.meshes[t].scale.z=n.distanceTo(s),this.three.meshes[t].lookAt(s),8===t){this.three.arrow.position.set(r.x,r.y,r.z);const e=(new window.THREE.Vector3).subVectors(n,r);this.three.arrow.setDirection(e.normalize()),this.three.arrow.setLength(800),this.three.arrow.direction=e}}this.updateCenterPalmMesh(e)}updateCenterPalmMesh(e){let t=[],i={x:0,y:0,z:0};this.palmPoints.forEach(((n,s)=>{t.push(this.webcam2space(...e.landmarks[n])),i.x+=t[s].x,i.y+=t[s].y,i.z+=t[s].z})),i.x=i.x/this.palmPoints.length,i.y=i.y/this.palmPoints.length,i.z=i.z/this.palmPoints.length,this.three.centerPalmObj.position.set(i.x,i.y,i.z),this.three.centerPalmObj.scale.z=10,this.three.centerPalmObj.rotation.x=this.three.meshes[12].rotation.x-Math.PI/2,this.three.centerPalmObj.rotation.y=-this.three.meshes[12].rotation.y,this.three.centerPalmObj.rotation.z=this.three.meshes[12].rotation.z}webcam2space(e,t,i){return new window.THREE.Vector3(e-this.handsfree.debug.$video.videoWidth/2,-(t-this.handsfree.debug.$video.videoHeight/2),-i)}updateGestureEstimator(){const e=[],t=[];this.gestures.forEach((t=>{if(this.handsfree.gesture[t].enabled&&e.push(t),!this.handsfree.gesture[t].compiledDescription&&this.handsfree.gesture[t].enabled){const e=new h.GestureDescription(t);this.handsfree.gesture[t].description.forEach((t=>{switch(t[0]){case"addCurl":e[t[0]](h.Finger[t[1]],h.FingerCurl[t[2]],t[3]);break;case"addDirection":e[t[0]](h.Finger[t[1]],h.FingerDirection[t[2]],t[3]);break;case"setWeight":e[t[0]](h.Finger[t[1]],t[2])}})),this.handsfree.gesture[t].compiledDescription=e}})),e.forEach((e=>{t.push(this.handsfree.gesture[e].compiledDescription)})),e.length&&(this.gestureEstimator=new h.GestureEstimator(t))}getGesture(){let e=null;if(this.data.landmarks&&this.gestureEstimator){const t=this.gestureEstimator.estimate(this.data.landmarks,7.5);t.gestures.length&&(e=t.gestures.reduce(((e,t)=>e.confidence>t.confidence?e:t)))}return e}}class f extends t{constructor(e,t){super(e,t),this.name="weboji"}loadDependencies(e){this.handsfree.config.isClient?this.onReady(e):this.loadDependency(`${this.handsfree.config.assetsPath}/jeeliz/jeelizFaceTransfer.js`,(()=>{const t=this.handsfree.config.assetsPath+"/jeeliz/jeelizFaceTransferNNC.json";this.api=window.JEEFACETRANSFERAPI,fetch(t).then((e=>e.json())).then((t=>{this.api.init({canvasId:`handsfree-canvas-weboji-${this.handsfree.id}`,NNC:JSON.stringify(t),videoSettings:this.handsfree.config.weboji.videoSettings,callbackReady:()=>this.onReady(e)})})).catch((e=>{console.log(e),console.error(`Couldn't load weboji tracking model at ${t}`),this.handsfree.emit("modelError",e)}))}))}onReady(e){this.dependenciesLoaded=!0,this.handsfree.emit("modelReady",this),this.handsfree.emit("webojiModelReady",this),document.body.classList.add("handsfree-model-weboji"),e&&e(this)}getData(){return this.data.rotation=this.api.get_rotationStabilized(),this.data.translation=this.api.get_positionScale(),this.data.morphs=this.api.get_morphTargetInfluencesStabilized(),this.data.state=this.getStates(),this.data.degree=this.getDegrees(),this.data.isDetected=this.api.is_detected(),this.handsfree.data.weboji=this.data,this.data}getDegrees(){return[180*this.data.rotation[0]/Math.PI,180*this.data.rotation[1]/Math.PI,180*this.data.rotation[2]/Math.PI]}getStates(){const e=this.data.morphs,t=this.data.state||{};return t.smileRight=e[0]>this.handsfree.config.weboji.morphs.threshold.smileRight,t.smileLeft=e[1]>this.handsfree.config.weboji.morphs.threshold.smileLeft,t.smile=t.smileRight&&t.smileLeft,t.smirk=t.smileRight&&!t.smileLeft||!t.smileRight&&t.smileLeft,t.pursed=e[7]>this.handsfree.config.weboji.morphs.threshold.mouthRound,t.browLeftUp=e[4]>this.handsfree.config.weboji.morphs.threshold.browLeftUp,t.browRightUp=e[5]>this.handsfree.config.weboji.morphs.threshold.browRightUp,t.browsUp=e[4]>this.handsfree.config.weboji.morphs.threshold.browLeftUp&&e[5]>this.handsfree.config.weboji.morphs.threshold.browLeftUp,t.browLeftDown=e[2]>this.handsfree.config.weboji.morphs.threshold.browLeftDown,t.browRightDown=e[3]>this.handsfree.config.weboji.morphs.threshold.browRightDown,t.browsDown=e[2]>this.handsfree.config.weboji.morphs.threshold.browLeftDown&&e[3]>this.handsfree.config.weboji.morphs.threshold.browLeftDown,t.browsUpDown=t.browLeftDown&&t.browRightUp||t.browRightDown&&t.browLeftUp,t.eyeLeftClosed=e[8]>this.handsfree.config.weboji.morphs.threshold.eyeLeftClosed,t.eyeRightClosed=e[9]>this.handsfree.config.weboji.morphs.threshold.eyeRightClosed,t.eyesClosed=t.eyeLeftClosed&&t.eyeRightClosed,t.mouthClosed=0===e[6],t.mouthOpen=e[6]>this.handsfree.config.weboji.morphs.threshold.mouthOpen,t}}function p(){this.__data__=[],this.size=0}var m=p;function g(e,t){return e===t||e!=e&&t!=t}var _=g;function v(e,t){for(var i=e.length;i--;)if(_(e[i][0],t))return i;return-1}var y=v,b=Array.prototype.splice;function w(e){var t=this.__data__,i=y(t,e);return!(i<0||(i==t.length-1?t.pop():b.call(t,i,1),--this.size,0))}var T=w;function P(e){var t=this.__data__,i=y(t,e);return i<0?void 0:t[i][1]}var E=P;function S(e){return y(this.__data__,e)>-1}var x=S;function D(e,t){var i=this.__data__,n=y(i,e);return n<0?(++this.size,i.push([e,t])):i[n][1]=t,this}var k=D;function R(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}R.prototype.clear=m,R.prototype.delete=T,R.prototype.get=E,R.prototype.has=x,R.prototype.set=k;var j=R;function C(){this.__data__=new j,this.size=0}var $=C;function O(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i}var L=O;function A(e){return this.__data__.get(e)}var F=A;function M(e){return this.__data__.has(e)}var U=M,H="object"==typeof n&&n&&n.Object===Object&&n,z="object"==typeof self&&self&&self.Object===Object&&self,W=H||z||Function("return this")(),I=W.Symbol,N=Object.prototype,G=N.hasOwnProperty,V=N.toString,B=I?I.toStringTag:void 0;function q(e){var t=G.call(e,B),i=e[B];try{e[B]=void 0;var n=!0}catch(e){}var s=V.call(e);return n&&(t?e[B]=i:delete e[B]),s}var Y=q,Q=Object.prototype.toString;function X(e){return Q.call(e)}var Z=X,J="[object Null]",K="[object Undefined]",ee=I?I.toStringTag:void 0;function te(e){return null==e?void 0===e?K:J:ee&&ee in Object(e)?Y(e):Z(e)}var ie=te;function ne(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var se=ne,re="[object AsyncFunction]",ae="[object Function]",oe="[object GeneratorFunction]",he="[object Proxy]";function le(e){if(!se(e))return!1;var t=ie(e);return t==ae||t==oe||t==re||t==he}var de,ce=le,ue=W["__core-js_shared__"],fe=(de=/[^.]+$/.exec(ue&&ue.keys&&ue.keys.IE_PROTO||""))?"Symbol(src)_1."+de:"";function pe(e){return!!fe&&fe in e}var me=pe,ge=Function.prototype.toString;function _e(e){if(null!=e){try{return ge.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var ve=_e,ye=/[\\^$.*+?()[\]{}|]/g,be=/^\[object .+?Constructor\]$/,we=Function.prototype,Te=Object.prototype,Pe=we.toString,Ee=Te.hasOwnProperty,Se=RegExp("^"+Pe.call(Ee).replace(ye,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function xe(e){return!(!se(e)||me(e))&&(ce(e)?Se:be).test(ve(e))}var De=xe;function ke(e,t){return null==e?void 0:e[t]}var Re=ke;function je(e,t){var i=Re(e,t);return De(i)?i:void 0}var Ce=je,$e=Ce(W,"Map"),Oe=Ce(Object,"create");function Le(){this.__data__=Oe?Oe(null):{},this.size=0}var Ae=Le;function Fe(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Me=Fe,Ue="__lodash_hash_undefined__",He=Object.prototype.hasOwnProperty;function ze(e){var t=this.__data__;if(Oe){var i=t[e];return i===Ue?void 0:i}return He.call(t,e)?t[e]:void 0}var We=ze,Ie=Object.prototype.hasOwnProperty;function Ne(e){var t=this.__data__;return Oe?void 0!==t[e]:Ie.call(t,e)}var Ge=Ne,Ve="__lodash_hash_undefined__";function Be(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=Oe&&void 0===t?Ve:t,this}var qe=Be;function Ye(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}Ye.prototype.clear=Ae,Ye.prototype.delete=Me,Ye.prototype.get=We,Ye.prototype.has=Ge,Ye.prototype.set=qe;var Qe=Ye;function Xe(){this.size=0,this.__data__={hash:new Qe,map:new($e||j),string:new Qe}}var Ze=Xe;function Je(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}var Ke=Je;function et(e,t){var i=e.__data__;return Ke(t)?i["string"==typeof t?"string":"hash"]:i.map}var tt=et;function it(e){var t=tt(this,e).delete(e);return this.size-=t?1:0,t}var nt=it;function st(e){return tt(this,e).get(e)}var rt=st;function at(e){return tt(this,e).has(e)}var ot=at;function ht(e,t){var i=tt(this,e),n=i.size;return i.set(e,t),this.size+=i.size==n?0:1,this}var lt=ht;function dt(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}dt.prototype.clear=Ze,dt.prototype.delete=nt,dt.prototype.get=rt,dt.prototype.has=ot,dt.prototype.set=lt;var ct=dt,ut=200;function ft(e,t){var i=this.__data__;if(i instanceof j){var n=i.__data__;if(!$e||n.length<ut-1)return n.push([e,t]),this.size=++i.size,this;i=this.__data__=new ct(n)}return i.set(e,t),this.size=i.size,this}var pt=ft;function mt(e){var t=this.__data__=new j(e);this.size=t.size}mt.prototype.clear=$,mt.prototype.delete=L,mt.prototype.get=F,mt.prototype.has=U,mt.prototype.set=pt;var gt=mt,_t=function(){try{var e=Ce(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();function vt(e,t,i){"__proto__"==t&&_t?_t(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i}var yt=vt;function bt(e,t,i){(void 0!==i&&!_(e[t],i)||void 0===i&&!(t in e))&&yt(e,t,i)}var wt=bt;function Tt(e){return function(t,i,n){for(var s=-1,r=Object(t),a=n(t),o=a.length;o--;){var h=a[e?o:++s];if(!1===i(r[h],h,r))break}return t}}var Pt=Tt(),Et=r((function(e,t){var i=t&&!t.nodeType&&t,n=i&&e&&!e.nodeType&&e,s=n&&n.exports===i?W.Buffer:void 0,r=s?s.allocUnsafe:void 0;function a(e,t){if(t)return e.slice();var i=e.length,n=r?r(i):new e.constructor(i);return e.copy(n),n}e.exports=a})),St=W.Uint8Array;function xt(e){var t=new e.constructor(e.byteLength);return new St(t).set(new St(e)),t}var Dt=xt;function kt(e,t){var i=t?Dt(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}var Rt=kt;function jt(e,t){var i=-1,n=e.length;for(t||(t=Array(n));++i<n;)t[i]=e[i];return t}var Ct=jt,$t=Object.create,Ot=function(){function e(){}return function(t){if(!se(t))return{};if($t)return $t(t);e.prototype=t;var i=new e;return e.prototype=void 0,i}}();function Lt(e,t){return function(i){return e(t(i))}}var At=Lt(Object.getPrototypeOf,Object),Ft=Object.prototype;function Mt(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ft)}var Ut=Mt;function Ht(e){return"function"!=typeof e.constructor||Ut(e)?{}:Ot(At(e))}var zt=Ht;function Wt(e){return null!=e&&"object"==typeof e}var It=Wt,Nt="[object Arguments]";function Gt(e){return It(e)&&ie(e)==Nt}var Vt=Gt,Bt=Object.prototype,qt=Bt.hasOwnProperty,Yt=Bt.propertyIsEnumerable,Qt=Vt(function(){return arguments}())?Vt:function(e){return It(e)&&qt.call(e,"callee")&&!Yt.call(e,"callee")},Xt=Qt,Zt=Array.isArray,Jt=9007199254740991;function Kt(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=Jt}var ei=Kt;function ti(e){return null!=e&&ei(e.length)&&!ce(e)}var ii=ti;function ni(e){return It(e)&&ii(e)}var si=ni;function ri(){return!1}var ai=ri,oi=r((function(e,t){var i=t&&!t.nodeType&&t,n=i&&e&&!e.nodeType&&e,s=n&&n.exports===i?W.Buffer:void 0,r=(s?s.isBuffer:void 0)||ai;e.exports=r})),hi="[object Object]",li=Function.prototype,di=Object.prototype,ci=li.toString,ui=di.hasOwnProperty,fi=ci.call(Object);function pi(e){if(!It(e)||ie(e)!=hi)return!1;var t=At(e);if(null===t)return!0;var i=ui.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i instanceof i&&ci.call(i)==fi}var mi=pi,gi="[object Arguments]",_i="[object Array]",vi="[object Boolean]",yi="[object Date]",bi="[object Error]",wi="[object Function]",Ti="[object Map]",Pi="[object Number]",Ei="[object Object]",Si="[object RegExp]",xi="[object Set]",Di="[object String]",ki="[object WeakMap]",Ri="[object ArrayBuffer]",ji="[object DataView]",Ci="[object Float64Array]",$i="[object Int8Array]",Oi="[object Int16Array]",Li="[object Int32Array]",Ai="[object Uint8Array]",Fi="[object Uint8ClampedArray]",Mi="[object Uint16Array]",Ui="[object Uint32Array]",Hi={};function zi(e){return It(e)&&ei(e.length)&&!!Hi[ie(e)]}Hi["[object Float32Array]"]=Hi[Ci]=Hi[$i]=Hi[Oi]=Hi[Li]=Hi[Ai]=Hi[Fi]=Hi[Mi]=Hi[Ui]=!0,Hi[gi]=Hi[_i]=Hi[Ri]=Hi[vi]=Hi[ji]=Hi[yi]=Hi[bi]=Hi[wi]=Hi[Ti]=Hi[Pi]=Hi[Ei]=Hi[Si]=Hi[xi]=Hi[Di]=Hi[ki]=!1;var Wi=zi;function Ii(e){return function(t){return e(t)}}var Ni=Ii,Gi=r((function(e,t){var i=t&&!t.nodeType&&t,n=i&&e&&!e.nodeType&&e,s=n&&n.exports===i&&H.process,r=function(){try{var e=n&&n.require&&n.require("util").types;return e||s&&s.binding&&s.binding("util")}catch(e){}}();e.exports=r})),Vi=Gi&&Gi.isTypedArray,Bi=Vi?Ni(Vi):Wi;function qi(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Yi=qi,Qi=Object.prototype.hasOwnProperty;function Xi(e,t,i){var n=e[t];Qi.call(e,t)&&_(n,i)&&(void 0!==i||t in e)||yt(e,t,i)}var Zi=Xi;function Ji(e,t,i,n){var s=!i;i||(i={});for(var r=-1,a=t.length;++r<a;){var o=t[r],h=n?n(i[o],e[o],o,i,e):void 0;void 0===h&&(h=e[o]),s?yt(i,o,h):Zi(i,o,h)}return i}var Ki=Ji;function en(e,t){for(var i=-1,n=Array(e);++i<e;)n[i]=t(i);return n}var tn=en,nn=9007199254740991,sn=/^(?:0|[1-9]\d*)$/;function rn(e,t){var i=typeof e;return!!(t=null==t?nn:t)&&("number"==i||"symbol"!=i&&sn.test(e))&&e>-1&&e%1==0&&e<t}var an=rn,on=Object.prototype.hasOwnProperty;function hn(e,t){var i=Zt(e),n=!i&&Xt(e),s=!i&&!n&&oi(e),r=!i&&!n&&!s&&Bi(e),a=i||n||s||r,o=a?tn(e.length,String):[],h=o.length;for(var l in e)!t&&!on.call(e,l)||a&&("length"==l||s&&("offset"==l||"parent"==l)||r&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||an(l,h))||o.push(l);return o}var ln=hn;function dn(e){var t=[];if(null!=e)for(var i in Object(e))t.push(i);return t}var cn=dn,un=Object.prototype.hasOwnProperty;function fn(e){if(!se(e))return cn(e);var t=Ut(e),i=[];for(var n in e)("constructor"!=n||!t&&un.call(e,n))&&i.push(n);return i}var pn=fn;function mn(e){return ii(e)?ln(e,!0):pn(e)}var gn=mn;function _n(e){return Ki(e,gn(e))}var vn=_n;function yn(e,t,i,n,s,r,a){var o=Yi(e,i),h=Yi(t,i),l=a.get(h);if(l)wt(e,i,l);else{var d=r?r(o,h,i+"",e,t,a):void 0,c=void 0===d;if(c){var u=Zt(h),f=!u&&oi(h),p=!u&&!f&&Bi(h);d=h,u||f||p?Zt(o)?d=o:si(o)?d=Ct(o):f?(c=!1,d=Et(h,!0)):p?(c=!1,d=Rt(h,!0)):d=[]:mi(h)||Xt(h)?(d=o,Xt(o)?d=vn(o):se(o)&&!ce(o)||(d=zt(h))):c=!1}c&&(a.set(h,d),s(d,h,n,r,a),a.delete(h)),wt(e,i,d)}}var bn=yn;function wn(e,t,i,n,s){e!==t&&Pt(t,(function(r,a){if(s||(s=new gt),se(r))bn(e,t,a,i,wn,n,s);else{var o=n?n(Yi(e,a),r,a+"",e,t,s):void 0;void 0===o&&(o=r),wt(e,a,o)}}),gn)}var Tn=wn;function Pn(e){return e}var En=Pn;function Sn(e,t,i){switch(i.length){case 0:return e.call(t);case 1:return e.call(t,i[0]);case 2:return e.call(t,i[0],i[1]);case 3:return e.call(t,i[0],i[1],i[2])}return e.apply(t,i)}var xn=Sn,Dn=Math.max;function kn(e,t,i){return t=Dn(void 0===t?e.length-1:t,0),function(){for(var n=arguments,s=-1,r=Dn(n.length-t,0),a=Array(r);++s<r;)a[s]=n[t+s];s=-1;for(var o=Array(t+1);++s<t;)o[s]=n[s];return o[t]=i(a),xn(e,this,o)}}var Rn=kn;function jn(e){return function(){return e}}var Cn=jn,$n=_t?function(e,t){return _t(e,"toString",{configurable:!0,enumerable:!1,value:Cn(t),writable:!0})}:En,On=800,Ln=16,An=Date.now;function Fn(e){var t=0,i=0;return function(){var n=An(),s=Ln-(n-i);if(i=n,s>0){if(++t>=On)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Mn=Fn($n);function Un(e,t){return Mn(Rn(e,t,En),e+"")}var Hn=Un;function zn(e,t,i){if(!se(i))return!1;var n=typeof t;return!!("number"==n?ii(i)&&an(t,i.length):"string"==n&&t in i)&&_(i[t],e)}var Wn=zn;function In(e){return Hn((function(t,i){var n=-1,s=i.length,r=s>1?i[s-1]:void 0,a=s>2?i[2]:void 0;for(r=e.length>3&&"function"==typeof r?(s--,r):void 0,a&&Wn(i[0],i[1],a)&&(r=s<3?void 0:r,s=1),t=Object(t);++n<s;){var o=i[n];o&&e(t,o,n,r)}return t}))}var Nn=In((function(e,t,i){Tn(e,t,i)}));class Gn{constructor(e,t){var i,n;this.plugin=e,this.handsfree=t,Object.keys(e).forEach((t=>{this[t]=e[t]}));let s=null===(i=t.config)||void 0===i||null===(n=i.plugin)||void 0===n?void 0:n[e.name];"boolean"==typeof s&&(s={enabled:s}),"object"==typeof s&&(Nn(this.config,s),"boolean"==typeof s.enabled&&(this.enabled=s.enabled))}enable(){!this.enabled&&this.onEnable&&this.onEnable(this.handsfree),this.enabled=!0}disable(){this.enabled&&this.onDisable&&this.onDisable(this.handsfree),this.enabled=!1}}class Vn{constructor(e,t){var i,n;this.handsfree=t,Object.keys(e).forEach((t=>{this[t]=e[t]}));let s=null===(i=t.config)||void 0===i||null===(n=i.gesture)||void 0===n?void 0:n[e.name];"boolean"==typeof s&&(s={enabled:s}),"object"==typeof s&&(Nn(this.config,s),"boolean"==typeof s.enabled&&(this.enabled=s.enabled))}enable(){this.enabled=!0,this.updateGestureEstimator()}disable(){this.enabled=!1,this.updateGestureEstimator()}updateGestureEstimator(){this.models.forEach((e=>{this.handsfree.model[e].updateGestureEstimator()}))}}class Bn extends Vn{constructor(e,t){super(e,t),this.algorithm="fingerpose",this.compiledDescription=null}}var qn={autostart:!1,assetsPath:"https://unpkg.com/handsfree@8.5.1/build/lib/assets",isClient:!1,gesture:{},setup:{canvas:{weboji:{$el:null,width:1280,height:720},hands:{$el:null,width:1280,height:720},handpose:{$el:null,width:1280,height:720},pose:{$el:null,width:1280,height:720},facemesh:{$el:null,width:1280,height:720}},video:{$el:null,width:1280,height:720},wrap:{$el:null,$parent:null}},weboji:{enabled:!1,throttle:0,videoSettings:{videoElement:null,deviceId:null,facingMode:"user",idealWidth:320,idealHeight:240,minWidth:240,maxWidth:1280,minHeight:240,maxHeight:1280},morphs:{threshold:{smileRight:.7,smileLeft:.7,browLeftDown:.8,browRightDown:.8,browLeftUp:.8,browRightUp:.8,eyeLeftClosed:.4,eyeRightClosed:.4,mouthOpen:.3,mouthRound:.8,upperLip:.5}}},hands:{enabled:!1,maxNumHands:2,minDetectionConfidence:.5,minTrackingConfidence:.5},facemesh:{enabled:!1,maxNumFaces:1,minDetectionConfidence:.5,minTrackingConfidence:.5},pose:{enabled:!1,upperBodyOnly:!1,smoothLandmarks:!0,minDetectionConfidence:.5,minTrackingConfidence:.5},handpose:{enabled:!1,backend:"webgl",maxContinuousChecks:1/0,detectionConfidence:.8,iouThreshold:.3,scoreThreshold:.75},plugin:{}},Yn=function(){return W.Date.now()},Qn="[object Symbol]";function Xn(e){return"symbol"==typeof e||It(e)&&ie(e)==Qn}var Zn=Xn,Jn=NaN,Kn=/^\s+|\s+$/g,es=/^[-+]0x[0-9a-f]+$/i,ts=/^0b[01]+$/i,is=/^0o[0-7]+$/i,ns=parseInt;function ss(e){if("number"==typeof e)return e;if(Zn(e))return Jn;if(se(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=se(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(Kn,"");var i=ts.test(e);return i||is.test(e)?ns(e.slice(2),i?2:8):es.test(e)?Jn:+e}var rs=ss,as="Expected a function",os=Math.max,hs=Math.min;function ls(e,t,i){var n,s,r,a,o,h,l=0,d=!1,c=!1,u=!0;if("function"!=typeof e)throw new TypeError(as);function f(t){var i=n,r=s;return n=s=void 0,l=t,a=e.apply(r,i)}function p(e){return l=e,o=setTimeout(_,t),d?f(e):a}function m(e){var i=t-(e-h);return c?hs(i,r-(e-l)):i}function g(e){var i=e-h;return void 0===h||i>=t||i<0||c&&e-l>=r}function _(){var e=Yn();if(g(e))return v(e);o=setTimeout(_,m(e))}function v(e){return o=void 0,u&&n?f(e):(n=s=void 0,a)}function y(){void 0!==o&&clearTimeout(o),l=0,n=h=s=o=void 0}function b(){return void 0===o?a:v(Yn())}function w(){var e=Yn(),i=g(e);if(n=arguments,s=this,h=e,i){if(void 0===o)return p(h);if(c)return clearTimeout(o),o=setTimeout(_,t),f(h)}return void 0===o&&(o=setTimeout(_,t)),a}return t=rs(t)||0,se(i)&&(d=!!i.leading,r=(c="maxWait"in i)?os(rs(i.maxWait)||0,t):r,u="trailing"in i?!!i.trailing:u),w.cancel=y,w.flush=b,w}var ds=ls,cs="Expected a function";function us(e,t,i){var n=!0,s=!0;if("function"!=typeof e)throw new TypeError(cs);return se(i)&&(n="leading"in i?!!i.leading:n,s="trailing"in i?!!i.trailing:s),ds(e,t,{leading:n,maxWait:t,trailing:s})}var fs=us,ps="undefined"!=typeof window?window:e.exports&&void 0!==i.g?i.g:window||{},ms=function(e){var t={},i=e.document,n=e.GreenSockGlobals=e.GreenSockGlobals||e;if(n.TweenLite)return n.TweenLite;var s,r,a,o,h,l,d,c=function(e){var t,i=e.split("."),s=n;for(t=0;t<i.length;t++)s[i[t]]=s=s[i[t]]||{};return s},u=c("com.greensock"),f=1e-8,p=function(e){var t,i=[],n=e.length;for(t=0;t!==n;i.push(e[t++]));return i},m=function(){},g=(l=Object.prototype.toString,d=l.call([]),function(e){return null!=e&&(e instanceof Array||"object"==typeof e&&!!e.push&&l.call(e)===d)}),_={},v=function(e,i,s,r){this.sc=_[e]?_[e].sc:[],_[e]=this,this.gsClass=null,this.func=s;var a=[];this.check=function(o){for(var h,l,d,u,f=i.length,p=f;--f>-1;)(h=_[i[f]]||new v(i[f],[])).gsClass?(a[f]=h.gsClass,p--):o&&h.sc.push(this);if(0===p&&s)for(d=(l=("com.greensock."+e).split(".")).pop(),u=c(l.join("."))[d]=this.gsClass=s.apply(s,a),r&&(n[d]=t[d]=u),f=0;f<this.sc.length;f++)this.sc[f].check()},this.check(!0)},y=e._gsDefine=function(e,t,i,n){return new v(e,t,i,n)},b=u._class=function(e,t,i){return t=t||function(){},y(e,[],(function(){return t}),i),t};y.globals=n;var w=[0,0,1,1],T=b("easing.Ease",(function(e,t,i,n){this._func=e,this._type=i||0,this._power=n||0,this._params=t?w.concat(t):w}),!0),P=T.map={},E=T.register=function(e,t,i,n){for(var s,r,a,o,h=t.split(","),l=h.length,d=(i||"easeIn