@richard.fadiora/liveness-detection 1.0.5 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +192 -0
- package/dist/index.es.js +4316 -452
- package/dist/index.umd.js +29 -7
- package/package.json +2 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,22 +1,44 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(rt,$){typeof exports=="object"&&typeof module<"u"?$(exports,require("react"),require("react-webcam")):typeof define=="function"&&define.amd?define(["exports","react","react-webcam"],$):(rt=typeof globalThis<"u"?globalThis:rt||self,$(rt.LivenessSDK={},rt.React,rt.Webcam))})(this,function(rt,$,D2){"use strict";var On={exports:{}},pr={};/**
|
|
2
2
|
* @license React
|
|
3
|
-
* react-jsx-runtime.production.js
|
|
3
|
+
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
5
|
-
* Copyright (c)
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var pi;function B2(){if(pi)return pr;pi=1;var e=$,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,s=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function o(c,u,f){var l,d={},b=null,A=null;f!==void 0&&(b=""+f),u.key!==void 0&&(b=""+u.key),u.ref!==void 0&&(A=u.ref);for(l in u)n.call(u,l)&&!i.hasOwnProperty(l)&&(d[l]=u[l]);if(c&&c.defaultProps)for(l in u=c.defaultProps,u)d[l]===void 0&&(d[l]=u[l]);return{$$typeof:t,type:c,key:b,ref:A,props:d,_owner:s.current}}return pr.Fragment=r,pr.jsx=o,pr.jsxs=o,pr}var gr={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
13
|
-
* Copyright (c)
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var gi;function U2(){return gi||(gi=1,process.env.NODE_ENV!=="production"&&function(){var e=$,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),A=Symbol.for("react.offscreen"),B=Symbol.iterator,He="@@iterator";function ze(a){if(a===null||typeof a!="object")return null;var h=B&&a[B]||a[He];return typeof h=="function"?h:null}var te=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function H(a){{for(var h=arguments.length,p=new Array(h>1?h-1:0),E=1;E<h;E++)p[E-1]=arguments[E];Ct("error",a,p)}}function Ct(a,h,p){{var E=te.ReactDebugCurrentFrame,O=E.getStackAddendum();O!==""&&(h+="%s",p=p.concat([O]));var C=p.map(function(T){return String(T)});C.unshift("Warning: "+h),Function.prototype.apply.call(console[a],console,C)}}var ri=!1,ni=!1,si=!1,jr=!1,ii=!1,An;An=Symbol.for("react.module.reference");function kn(a){return!!(typeof a=="string"||typeof a=="function"||a===n||a===i||ii||a===s||a===f||a===l||jr||a===A||ri||ni||si||typeof a=="object"&&a!==null&&(a.$$typeof===b||a.$$typeof===d||a.$$typeof===o||a.$$typeof===c||a.$$typeof===u||a.$$typeof===An||a.getModuleId!==void 0))}function ae(a,h,p){var E=a.displayName;if(E)return E;var O=h.displayName||h.name||"";return O!==""?p+"("+O+")":p}function K(a){return a.displayName||"Context"}function M(a){if(a==null)return null;if(typeof a.tag=="number"&&H("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case n:return"Fragment";case r:return"Portal";case i:return"Profiler";case s:return"StrictMode";case f:return"Suspense";case l:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case c:var h=a;return K(h)+".Consumer";case o:var p=a;return K(p._context)+".Provider";case u:return ae(a,a.render,"ForwardRef");case d:var E=a.displayName||null;return E!==null?E:M(a.type)||"Memo";case b:{var O=a,C=O._payload,T=O._init;try{return M(T(C))}catch{return null}}}return null}var re=Object.assign,be=0,U,ce,Ke,yt,vt,Nr,Sn;function It(){}It.__reactDisabledLog=!0;function Dr(){{if(be===0){U=console.log,ce=console.info,Ke=console.warn,yt=console.error,vt=console.group,Nr=console.groupCollapsed,Sn=console.groupEnd;var a={configurable:!0,enumerable:!0,value:It,writable:!0};Object.defineProperties(console,{info:a,log:a,warn:a,error:a,group:a,groupCollapsed:a,groupEnd:a})}be++}}function Cc(){{if(be--,be===0){var a={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:re({},a,{value:U}),info:re({},a,{value:ce}),warn:re({},a,{value:Ke}),error:re({},a,{value:yt}),group:re({},a,{value:vt}),groupCollapsed:re({},a,{value:Nr}),groupEnd:re({},a,{value:Sn})})}be<0&&H("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var oi=te.ReactCurrentDispatcher,ai;function Tn(a,h,p){{if(ai===void 0)try{throw Error()}catch(O){var E=O.stack.trim().match(/\n( *(at )?)/);ai=E&&E[1]||""}return`
|
|
18
|
+
`+ai+a}}var ci=!1,xn;{var Ic=typeof WeakMap=="function"?WeakMap:Map;xn=new Ic}function A2(a,h){if(!a||ci)return"";{var p=xn.get(a);if(p!==void 0)return p}var E;ci=!0;var O=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var C;C=oi.current,oi.current=null,Dr();try{if(h){var T=function(){throw Error()};if(Object.defineProperty(T.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(T,[])}catch(we){E=we}Reflect.construct(a,[],T)}else{try{T.call()}catch(we){E=we}a.call(T.prototype)}}else{try{throw Error()}catch(we){E=we}a()}}catch(we){if(we&&E&&typeof we.stack=="string"){for(var k=we.stack.split(`
|
|
19
|
+
`),me=E.stack.split(`
|
|
20
|
+
`),J=k.length-1,ne=me.length-1;J>=1&&ne>=0&&k[J]!==me[ne];)ne--;for(;J>=1&&ne>=0;J--,ne--)if(k[J]!==me[ne]){if(J!==1||ne!==1)do if(J--,ne--,ne<0||k[J]!==me[ne]){var Be=`
|
|
21
|
+
`+k[J].replace(" at new "," at ");return a.displayName&&Be.includes("<anonymous>")&&(Be=Be.replace("<anonymous>",a.displayName)),typeof a=="function"&&xn.set(a,Be),Be}while(J>=1&&ne>=0);break}}}finally{ci=!1,oi.current=C,Cc(),Error.prepareStackTrace=O}var dr=a?a.displayName||a.name:"",jt=dr?Tn(dr):"";return typeof a=="function"&&xn.set(a,jt),jt}function jc(a,h,p){return A2(a,!1)}function Nc(a){var h=a.prototype;return!!(h&&h.isReactComponent)}function Ln(a,h,p){if(a==null)return"";if(typeof a=="function")return A2(a,Nc(a));if(typeof a=="string")return Tn(a);switch(a){case f:return Tn("Suspense");case l:return Tn("SuspenseList")}if(typeof a=="object")switch(a.$$typeof){case u:return jc(a.render);case d:return Ln(a.type,h,p);case b:{var E=a,O=E._payload,C=E._init;try{return Ln(C(O),h,p)}catch{}}}return""}var Br=Object.prototype.hasOwnProperty,k2={},S2=te.ReactDebugCurrentFrame;function Pn(a){if(a){var h=a._owner,p=Ln(a.type,a._source,h?h.type:null);S2.setExtraStackFrame(p)}else S2.setExtraStackFrame(null)}function Dc(a,h,p,E,O){{var C=Function.call.bind(Br);for(var T in a)if(C(a,T)){var k=void 0;try{if(typeof a[T]!="function"){var me=Error((E||"React class")+": "+p+" type `"+T+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof a[T]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw me.name="Invariant Violation",me}k=a[T](h,T,E,p,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(J){k=J}k&&!(k instanceof Error)&&(Pn(O),H("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",E||"React class",p,T,typeof k),Pn(null)),k instanceof Error&&!(k.message in k2)&&(k2[k.message]=!0,Pn(O),H("Failed %s type: %s",p,k.message),Pn(null))}}}var Bc=Array.isArray;function ui(a){return Bc(a)}function Uc(a){{var h=typeof Symbol=="function"&&Symbol.toStringTag,p=h&&a[Symbol.toStringTag]||a.constructor.name||"Object";return p}}function Vc(a){try{return T2(a),!1}catch{return!0}}function T2(a){return""+a}function x2(a){if(Vc(a))return H("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Uc(a)),T2(a)}var L2=te.ReactCurrentOwner,Gc={key:!0,ref:!0,__self:!0,__source:!0},P2,O2;function Wc(a){if(Br.call(a,"ref")){var h=Object.getOwnPropertyDescriptor(a,"ref").get;if(h&&h.isReactWarning)return!1}return a.ref!==void 0}function Hc(a){if(Br.call(a,"key")){var h=Object.getOwnPropertyDescriptor(a,"key").get;if(h&&h.isReactWarning)return!1}return a.key!==void 0}function zc(a,h){typeof a.ref=="string"&&L2.current}function Kc(a,h){{var p=function(){P2||(P2=!0,H("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",h))};p.isReactWarning=!0,Object.defineProperty(a,"key",{get:p,configurable:!0})}}function Yc(a,h){{var p=function(){O2||(O2=!0,H("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",h))};p.isReactWarning=!0,Object.defineProperty(a,"ref",{get:p,configurable:!0})}}var Xc=function(a,h,p,E,O,C,T){var k={$$typeof:t,type:a,key:h,ref:p,props:T,_owner:C};return k._store={},Object.defineProperty(k._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(k,"_self",{configurable:!1,enumerable:!1,writable:!1,value:E}),Object.defineProperty(k,"_source",{configurable:!1,enumerable:!1,writable:!1,value:O}),Object.freeze&&(Object.freeze(k.props),Object.freeze(k)),k};function qc(a,h,p,E,O){{var C,T={},k=null,me=null;p!==void 0&&(x2(p),k=""+p),Hc(h)&&(x2(h.key),k=""+h.key),Wc(h)&&(me=h.ref,zc(h,O));for(C in h)Br.call(h,C)&&!Gc.hasOwnProperty(C)&&(T[C]=h[C]);if(a&&a.defaultProps){var J=a.defaultProps;for(C in J)T[C]===void 0&&(T[C]=J[C])}if(k||me){var ne=typeof a=="function"?a.displayName||a.name||"Unknown":a;k&&Kc(T,ne),me&&Yc(T,ne)}return Xc(a,k,me,O,E,L2.current,T)}}var li=te.ReactCurrentOwner,F2=te.ReactDebugCurrentFrame;function fr(a){if(a){var h=a._owner,p=Ln(a.type,a._source,h?h.type:null);F2.setExtraStackFrame(p)}else F2.setExtraStackFrame(null)}var hi;hi=!1;function fi(a){return typeof a=="object"&&a!==null&&a.$$typeof===t}function R2(){{if(li.current){var a=M(li.current.type);if(a)return`
|
|
22
|
+
|
|
23
|
+
Check the render method of \``+a+"`."}return""}}function Jc(a){return""}var M2={};function $c(a){{var h=R2();if(!h){var p=typeof a=="string"?a:a.displayName||a.name;p&&(h=`
|
|
24
|
+
|
|
25
|
+
Check the top-level render call using <`+p+">.")}return h}}function C2(a,h){{if(!a._store||a._store.validated||a.key!=null)return;a._store.validated=!0;var p=$c(h);if(M2[p])return;M2[p]=!0;var E="";a&&a._owner&&a._owner!==li.current&&(E=" It was passed a child from "+M(a._owner.type)+"."),fr(a),H('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',p,E),fr(null)}}function I2(a,h){{if(typeof a!="object")return;if(ui(a))for(var p=0;p<a.length;p++){var E=a[p];fi(E)&&C2(E,h)}else if(fi(a))a._store&&(a._store.validated=!0);else if(a){var O=ze(a);if(typeof O=="function"&&O!==a.entries)for(var C=O.call(a),T;!(T=C.next()).done;)fi(T.value)&&C2(T.value,h)}}}function Zc(a){{var h=a.type;if(h==null||typeof h=="string")return;var p;if(typeof h=="function")p=h.propTypes;else if(typeof h=="object"&&(h.$$typeof===u||h.$$typeof===d))p=h.propTypes;else return;if(p){var E=M(h);Dc(p,a.props,"prop",E,a)}else if(h.PropTypes!==void 0&&!hi){hi=!0;var O=M(h);H("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",O||"Unknown")}typeof h.getDefaultProps=="function"&&!h.getDefaultProps.isReactClassApproved&&H("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Qc(a){{for(var h=Object.keys(a.props),p=0;p<h.length;p++){var E=h[p];if(E!=="children"&&E!=="key"){fr(a),H("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",E),fr(null);break}}a.ref!==null&&(fr(a),H("Invalid attribute `ref` supplied to `React.Fragment`."),fr(null))}}var j2={};function N2(a,h,p,E,O,C){{var T=kn(a);if(!T){var k="";(a===void 0||typeof a=="object"&&a!==null&&Object.keys(a).length===0)&&(k+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var me=Jc();me?k+=me:k+=R2();var J;a===null?J="null":ui(a)?J="array":a!==void 0&&a.$$typeof===t?(J="<"+(M(a.type)||"Unknown")+" />",k=" Did you accidentally export a JSX literal instead of a component?"):J=typeof a,H("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",J,k)}var ne=qc(a,h,p,O,C);if(ne==null)return ne;if(T){var Be=h.children;if(Be!==void 0)if(E)if(ui(Be)){for(var dr=0;dr<Be.length;dr++)I2(Be[dr],a);Object.freeze&&Object.freeze(Be)}else H("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else I2(Be,a)}if(Br.call(h,"key")){var jt=M(a),we=Object.keys(h).filter(function(iu){return iu!=="key"}),di=we.length>0?"{key: someKey, "+we.join(": ..., ")+": ...}":"{key: someKey}";if(!j2[jt+di]){var su=we.length>0?"{"+we.join(": ..., ")+": ...}":"{}";H(`A props object containing a "key" prop is being spread into JSX:
|
|
18
26
|
let props = %s;
|
|
19
27
|
<%s {...props} />
|
|
20
28
|
React keys must be passed directly to JSX without using spread:
|
|
21
29
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,l,c,O,c),re[c+l]=!0)}if(c=null,o!==void 0&&(d(o),c=""+o),R(t)&&(d(t.key),c=""+t.key),"key"in t){o={};for(var K in t)K!=="key"&&(o[K]=t[K])}else o=t;return c&&g(o,typeof e=="function"?e.displayName||e.name||"Unknown":e),a(e,c,o,n(),W,X)}function Y(e){T(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===L&&(e._payload.status==="fulfilled"?T(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function T(e){return typeof e=="object"&&e!==null&&e.$$typeof===N}var y=i,N=Symbol.for("react.transitional.element"),A=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),B=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),G=Symbol.for("react.suspense"),U=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),J=Symbol.for("react.activity"),f=Symbol.for("react.client.reference"),S=y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,_=Object.prototype.hasOwnProperty,b=Array.isArray,k=console.createTask?console.createTask:function(){return null};y={react_stack_bottom_frame:function(e){return e()}};var v,$={},ee=y.react_stack_bottom_frame.bind(y,u)(),te=k(s(u)),re={};C.Fragment=E,C.jsx=function(e,t,o){var l=1e4>S.recentlyCreatedOwnerStacks++;return h(e,t,o,!1,l?Error("react-stack-top-frame"):ee,l?k(s(e)):te)},C.jsxs=function(e,t,o){var l=1e4>S.recentlyCreatedOwnerStacks++;return h(e,t,o,!0,l?Error("react-stack-top-frame"):ee,l?k(s(e)):te)}}()),C}process.env.NODE_ENV==="production"?z.exports=oe():z.exports=se();var r=z.exports;const ae=["Smile","Blink","Turn_Head","Thumbs_Up"],q=60,ie=p=>{if(!p)return null;const m=p.split(","),d=m[0].match(/:(.*?);/)[1],s=atob(m[1]);let n=s.length;const u=new Uint8Array(n);for(;n--;)u[n]=s.charCodeAt(n);return new Blob([u],{type:d})},le=({apiUrl:p,onComplete:m})=>{const d=i.useRef(null),s=i.useRef(null),n=i.useRef(null),[u,R]=i.useState([]),[g,F]=i.useState(0),[a,h]=i.useState("idle"),[Y,T]=i.useState(3),[y,N]=i.useState(q),[A,E]=i.useState(!1),[w,j]=i.useState(!1),[M,B]=i.useState(null),I=()=>{const f=[...ae].sort(()=>.5-Math.random()).slice(0,3);R(f),F(0),h("idle"),T(3),N(q),E(!1),j(!1)};i.useEffect(()=>{I()},[]);const G=()=>{I()};i.useEffect(()=>()=>{n.current&&clearInterval(n.current),s.current&&s.current.abort()},[]),i.useEffect(()=>{let f;return A&&y>0?f=setInterval(()=>{N(S=>S-1)},1e3):y===0&&a!=="success"&&(n.current&&(clearInterval(n.current),n.current=null),s.current&&s.current.abort(),h("timeout"),E(!1),j(!1),m&&m(!1)),()=>clearInterval(f)},[A,y,a]);const U=async()=>{if(a==="capturing"||a==="verifying")return;n.current&&clearInterval(n.current),A||E(!0),h("counting");let f=3;n.current=setInterval(()=>{f-=1,T(f),f===0&&(clearInterval(n.current),n.current=null,H())},1e3)},H=async()=>{if(!d.current)return;h("capturing");const f=[],S=20;for(let _=0;_<S;_++){if(!d.current||y<=0)return;try{const b=d.current.getScreenshot();b&&f.push(b)}catch{break}await new Promise(b=>setTimeout(b,100))}f.length>0&&a!=="timeout"&&L(f)},L=async f=>{if(a==="verifying"||a==="timeout")return;h("verifying"),s.current=new AbortController;const{signal:S}=s.current,_=new FormData;f.forEach((b,k)=>{const v=ie(b);v&&_.append("files",v,`frame_${k}.jpg`)}),_.append("challenge",u[g]);try{const b=await fetch(`${p}/v1/verify`,{method:"POST",body:_,signal:S});f=[];const k=await b.json();if(a==="timeout")return;if(k.is_live)if(g<2)F(v=>v+1),T(3),h("idle");else{const v=d.current.getScreenshot();v&&B(v),h("success"),E(!1),m&&m({success:!0,image:v})}else E(!1),j(!0),h("idle"),T(3)}catch{j(!0),h("idle")}finally{s.current=null}},J={Smile:"Show us a big SMILE! 😁",Blink:"BLINK your eyes rapidly! 👁️",Turn_Head:"Slowly TURN your head left or right! ↔️",Thumbs_Up:"Give a THUMBS UP! 👍"};return r.jsxs("div",{style:{textAlign:"center",padding:"20px",fontFamily:"sans-serif"},children:[A&&a!=="success"&&r.jsxs("div",{style:{fontSize:"20px",fontWeight:"bold",color:y<10?"red":"black"},children:["Time Remaining: ",y,"s"]}),w&&r.jsx("div",{style:ce,children:r.jsxs("div",{style:ue,children:[r.jsx("h3",{style:{color:"#dc3545"},children:"Action Not Detected"}),r.jsx("p",{children:"We couldn't verify that move. Please try again before time runs out!"}),r.jsx("button",{onClick:()=>{j(!1),U()},style:D,children:"Try Again"})]})}),a==="success"&&r.jsxs("div",{children:[r.jsx("h2",{children:"✅ Verification Passed!"}),M&&r.jsxs("div",{style:{margin:"20px auto",width:"200px"},children:[r.jsx("p",{children:"Verified Photo:"}),r.jsx("img",{src:M,alt:"Verified",style:{width:"100%",borderRadius:"10px",border:"3px solid #28a745"}})]}),r.jsx("button",{onClick:G,style:{...D,backgroundColor:"#6c757d"},children:"Verify Again"})]}),a==="timeout"&&r.jsxs("div",{children:[r.jsx("h2",{style:{color:"#dc3545"},children:"⏰ Session Expired"}),r.jsx("p",{children:"You didn't complete the challenges in time."}),r.jsx("p",{children:"Please ensure you follow the instructions and perform the tasks within the time limit. (60 seconds)"}),r.jsx("button",{onClick:I,style:D,children:"🔄 Try Again"})]}),["idle","counting","capturing","verifying"].includes(a)&&r.jsxs(r.Fragment,{children:[r.jsx("h2",{children:"Please be in a well-lit room where your face can be well seen."}),r.jsxs("h3",{children:["Challenge ",g+1," of 3"]}),r.jsx("h2",{style:{color:"#007bff"},children:J[u[g]]}),r.jsxs("div",{style:{position:"relative",width:"fit-content",margin:"auto",overflow:"hidden",borderRadius:"10px"},children:[r.jsx(ne,{audio:!1,ref:d,screenshotFormat:"image/jpeg",style:{borderRadius:"10px",width:"100%",maxWidth:"400px",transform:"scaleX(-1)"}}),r.jsx("div",{style:{...fe,borderColor:a==="capturing"?"#28a745":"rgba(255, 255, 255, 0.6)",borderStyle:a==="capturing"?"solid":"dashed"},children:r.jsx("div",{style:de})}),a==="counting"&&r.jsx("div",{style:V,children:Y}),a==="verifying"&&r.jsx("div",{style:V,children:"Analyzing..."}),a==="capturing"&&r.jsx("div",{style:{...V,background:"rgba(40, 167, 69, 0.3)"},children:"Recording..."})]}),r.jsx("div",{style:{marginTop:"20px"},children:a==="idle"&&r.jsx("button",{onClick:U,disabled:w,style:{...D,filter:w?"grayscale(1)":"none",cursor:w?"not-allowed":"pointer",opacity:w?.6:1},children:"I'm Ready"})})]})]})},V={position:"absolute",top:0,left:0,right:0,bottom:0,background:"rgba(0,0,0,0.5)",color:"white",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"48px",borderRadius:"10px"},D={padding:"10px 30px",fontSize:"18px",cursor:"pointer",backgroundColor:"#28a745",color:"white",border:"none",borderRadius:"5px"},ce={position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0,0,0,0.7)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100,borderRadius:"10px"},ue={backgroundColor:"white",padding:"30px",borderRadius:"15px",maxWidth:"300px",boxShadow:"0 4px 15px rgba(0,0,0,0.3)",color:"#000"},fe={position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"260px",height:"240px",borderRadius:"50%",border:"2px dashed rgba(255, 255, 255, 0.6)",boxShadow:"0 0 0 9999px rgba(0, 0, 0, 0.5)",pointerEvents:"none",zIndex:10},de={position:"absolute",top:0,left:0,right:0,bottom:0,borderRadius:"50%",boxShadow:"inset 0 0 30px rgba(255, 255, 255, 0.2)"},pe=async(p,m,d)=>{const s=new FormData;m.forEach((u,R)=>{s.append("files",u,`frame_${R}.jpg`)}),s.append("challenge",d);const n=await fetch(`${p}/v1/verify`,{method:"POST",body:s});if(!n.ok)throw new Error("Network response was not ok");return await n.json()};x.LivenessSDK=le,x.verifyLiveness=pe,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})});
|
|
30
|
+
<%s key={someKey} {...props} />`,di,jt,su,jt),j2[jt+di]=!0}}return a===n?Qc(ne):Zc(ne),ne}}function eu(a,h,p){return N2(a,h,p,!0)}function tu(a,h,p){return N2(a,h,p,!1)}var ru=tu,nu=eu;gr.Fragment=n,gr.jsx=ru,gr.jsxs=nu}()),gr}process.env.NODE_ENV==="production"?On.exports=B2():On.exports=U2();var R=On.exports,Nt=typeof self<"u"?self:{};function mr(e,t){e:{for(var r=["CLOSURE_FLAGS"],n=Nt,s=0;s<r.length;s++)if((n=n[r[s]])==null){r=null;break e}r=n}return(e=r&&r[e])!=null?e:t}function _t(){throw Error("Invalid UTF8")}function mi(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}let Ur,Fn;const V2=typeof TextDecoder<"u";let G2;const W2=typeof TextEncoder<"u";function yi(e){if(W2)e=(G2||(G2=new TextEncoder)).encode(e);else{let r=0;const n=new Uint8Array(3*e.length);for(let s=0;s<e.length;s++){var t=e.charCodeAt(s);if(t<128)n[r++]=t;else{if(t<2048)n[r++]=t>>6|192;else{if(t>=55296&&t<=57343){if(t<=56319&&s<e.length){const i=e.charCodeAt(++s);if(i>=56320&&i<=57343){t=1024*(t-55296)+i-56320+65536,n[r++]=t>>18|240,n[r++]=t>>12&63|128,n[r++]=t>>6&63|128,n[r++]=63&t|128;continue}s--}t=65533}n[r++]=t>>12|224,n[r++]=t>>6&63|128}n[r++]=63&t|128}}e=r===n.length?n:n.subarray(0,r)}return e}function vi(e){Nt.setTimeout(()=>{throw e},0)}var Rn,H2=mr(610401301,!1),_i=mr(748402147,!0),Mn=mr(824648567,!0),Cn=mr(824656860,mr(1,!0));function bi(){var e=Nt.navigator;return e&&(e=e.userAgent)?e:""}const wi=Nt.navigator;function Vr(e){return Vr[" "](e),e}Rn=wi&&wi.userAgentData||null,Vr[" "]=function(){};const Ei={};let yr=null;function z2(e){const t=e.length;let r=3*t/4;r%3?r=Math.floor(r):"=.".indexOf(e[t-1])!=-1&&(r="=.".indexOf(e[t-2])!=-1?r-2:r-1);const n=new Uint8Array(r);let s=0;return function(i,o){function c(f){for(;u<i.length;){const l=i.charAt(u++),d=yr[l];if(d!=null)return d;if(!/^[\s\xa0]*$/.test(l))throw Error("Unknown base64 encoding at char: "+l)}return f}Ai();let u=0;for(;;){const f=c(-1),l=c(0),d=c(64),b=c(64);if(b===64&&f===-1)break;o(f<<2|l>>4),d!=64&&(o(l<<4&240|d>>2),b!=64&&o(d<<6&192|b))}}(e,function(i){n[s++]=i}),s!==r?n.subarray(0,s):n}function Ai(){if(!yr){yr={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){const n=e.concat(t[r].split(""));Ei[r]=n;for(let s=0;s<n.length;s++){const i=n[s];yr[i]===void 0&&(yr[i]=s)}}}}var K2=typeof Uint8Array<"u",ki=!(!(H2&&Rn&&Rn.brands.length>0)&&(bi().indexOf("Trident")!=-1||bi().indexOf("MSIE")!=-1))&&typeof btoa=="function";const Si=/[-_.]/g,Y2={"-":"+",_:"/",".":"="};function X2(e){return Y2[e]||""}function Ti(e){if(!ki)return z2(e);e=Si.test(e)?e.replace(Si,X2):e,e=atob(e);const t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function In(e){return K2&&e!=null&&e instanceof Uint8Array}var Dt={};function bt(){return q2||(q2=new Ye(null,Dt))}function jn(e){xi(Dt);var t=e.g;return(t=t==null||In(t)?t:typeof t=="string"?Ti(t):null)==null?t:e.g=t}var Ye=class{h(){return new Uint8Array(jn(this)||0)}constructor(e,t){if(xi(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}};let q2,J2;function xi(e){if(e!==Dt)throw Error("illegal external caller")}function Li(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function Nn(e){return Li(e=Error(e),"warning"),e}function Bt(e,t){if(e!=null){var r=J2??(J2={}),n=r[e]||0;n>=t||(r[e]=n+1,Li(e=Error(),"incident"),vi(e))}}function Ut(){return typeof BigInt=="function"}var Vt=typeof Symbol=="function"&&typeof Symbol()=="symbol";function Xe(e,t,r=!1){return typeof Symbol=="function"&&typeof Symbol()=="symbol"?r&&Symbol.for&&e?Symbol.for(e):e!=null?Symbol(e):Symbol():t}var $2=Xe("jas",void 0,!0),Pi=Xe(void 0,"0di"),vr=Xe(void 0,"1oa"),Ee=Xe(void 0,Symbol()),Z2=Xe(void 0,"0ub"),Q2=Xe(void 0,"0ubs"),Dn=Xe(void 0,"0ubsb"),e1=Xe(void 0,"0actk"),Gt=Xe("m_m","Pa",!0),Oi=Xe();const Fi={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},Ri=Object.defineProperties,m=Vt?$2:"Ga";var wt;const Mi=[];function _r(e,t){Vt||m in e||Ri(e,Fi),e[m]|=t}function se(e,t){Vt||m in e||Ri(e,Fi),e[m]=t}function br(e){return _r(e,34),e}function wr(e){return _r(e,8192),e}se(Mi,7),wt=Object.freeze(Mi);var Wt={};function Ae(e,t){return t===void 0?e.h!==Et&&!!(2&(0|e.v[m])):!!(2&t)&&e.h!==Et}const Et={};function Bn(e,t){if(e!=null){if(typeof e=="string")e=e?new Ye(e,Dt):bt();else if(e.constructor!==Ye)if(In(e))e=e.length?new Ye(new Uint8Array(e),Dt):bt();else{if(!t)throw Error();e=void 0}}return e}class Ci{constructor(t,r,n){this.g=t,this.h=r,this.l=n}next(){const t=this.g.next();return t.done||(t.value=this.h.call(this.l,t.value)),t}[Symbol.iterator](){return this}}var t1=Object.freeze({});function Ii(e,t,r){const n=128&t?0:-1,s=e.length;var i;(i=!!s)&&(i=(i=e[s-1])!=null&&typeof i=="object"&&i.constructor===Object);const o=s+(i?-1:0);for(t=128&t?1:0;t<o;t++)r(t-n,e[t]);if(i){e=e[s-1];for(const c in e)!isNaN(c)&&r(+c,e[c])}}var ji={};function Ht(e){return 128&e?ji:void 0}function Gr(e){return e.Na=!0,e}var r1=Gr(e=>typeof e=="number"),Ni=Gr(e=>typeof e=="string"),n1=Gr(e=>typeof e=="boolean"),Wr=typeof Nt.BigInt=="function"&&typeof Nt.BigInt(0)=="bigint";function ke(e){var t=e;if(Ni(t)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(t))throw Error(String(t))}else if(r1(t)&&!Number.isSafeInteger(t))throw Error(String(t));return Wr?BigInt(e):e=n1(e)?e?"1":"0":Ni(e)?e.trim()||"0":String(e)}var Un=Gr(e=>Wr?e>=i1&&e<=a1:e[0]==="-"?Di(e,s1):Di(e,o1));const s1=Number.MIN_SAFE_INTEGER.toString(),i1=Wr?BigInt(Number.MIN_SAFE_INTEGER):void 0,o1=Number.MAX_SAFE_INTEGER.toString(),a1=Wr?BigInt(Number.MAX_SAFE_INTEGER):void 0;function Di(e,t){if(e.length>t.length)return!1;if(e.length<t.length||e===t)return!0;for(let r=0;r<e.length;r++){const n=e[r],s=t[r];if(n>s)return!1;if(n<s)return!0}}const c1=typeof Uint8Array.prototype.slice=="function";let u1,V=0,Z=0;function Bi(e){const t=e>>>0;V=t,Z=(e-t)/4294967296>>>0}function zt(e){if(e<0){Bi(-e);const[t,r]=zn(V,Z);V=t>>>0,Z=r>>>0}else Bi(e)}function Vn(e){const t=u1||(u1=new DataView(new ArrayBuffer(8)));t.setFloat32(0,+e,!0),Z=0,V=t.getUint32(0,!0)}function Gn(e,t){const r=4294967296*t+(e>>>0);return Number.isSafeInteger(r)?r:Er(e,t)}function l1(e,t){return ke(Ut()?BigInt.asUintN(64,(BigInt(t>>>0)<<BigInt(32))+BigInt(e>>>0)):Er(e,t))}function Wn(e,t){const r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=Gn(e,t))=="number"?r?-e:e:r?"-"+e:e}function Ui(e,t){return Ut()?ke(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(t))<<BigInt(32))+BigInt.asUintN(32,BigInt(e)))):ke(Hn(e,t))}function Er(e,t){if(e>>>=0,(t>>>=0)<=2097151)var r=""+(4294967296*t+e);else Ut()?r=""+(BigInt(t)<<BigInt(32)|BigInt(e)):(e=(16777215&e)+6777216*(r=16777215&(e>>>24|t<<8))+6710656*(t=t>>16&65535),r+=8147497*t,t*=2,e>=1e7&&(r+=e/1e7>>>0,e%=1e7),r>=1e7&&(t+=r/1e7>>>0,r%=1e7),r=t+Vi(r)+Vi(e));return r}function Vi(e){return e=String(e),"0000000".slice(e.length)+e}function Hn(e,t){if(2147483648&t)if(Ut())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{const[r,n]=zn(e,t);e="-"+Er(r,n)}else e=Er(e,t);return e}function Hr(e){if(e.length<16)zt(Number(e));else if(Ut())e=BigInt(e),V=Number(e&BigInt(4294967295))>>>0,Z=Number(e>>BigInt(32)&BigInt(4294967295));else{const t=+(e[0]==="-");Z=V=0;const r=e.length;for(let n=t,s=(r-t)%6+t;s<=r;n=s,s+=6){const i=Number(e.slice(n,s));Z*=1e6,V=1e6*V+i,V>=4294967296&&(Z+=Math.trunc(V/4294967296),Z>>>=0,V>>>=0)}if(t){const[n,s]=zn(V,Z);V=n,Z=s}}}function zn(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}function Ue(e){return Array.prototype.slice.call(e)}const Ar=typeof BigInt=="function"?BigInt.asIntN:void 0,h1=typeof BigInt=="function"?BigInt.asUintN:void 0,At=Number.isSafeInteger,zr=Number.isFinite,Kt=Math.trunc,f1=ke(0);function kr(e){if(e!=null&&typeof e!="number")throw Error(`Value of float/double field must be a number, found ${typeof e}: ${e}`);return e}function qe(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function Sr(e){if(e!=null&&typeof e!="boolean"){var t=typeof e;throw Error(`Expected boolean but got ${t!="object"?t:e?Array.isArray(e)?"array":t:"null"}: ${e}`)}return e}function Gi(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}const d1=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Tr(e){switch(typeof e){case"bigint":return!0;case"number":return zr(e);case"string":return d1.test(e);default:return!1}}function Yt(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return zr(e)?0|e:void 0}function Wi(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return zr(e)?e>>>0:void 0}function Hi(e){const t=e.length;return(e[0]==="-"?t<20||t===20&&e<="-9223372036854775808":t<19||t===19&&e<="9223372036854775807")?e:(Hr(e),Hn(V,Z))}function Kn(e){return e=Kt(e),At(e)||(zt(e),e=Wn(V,Z)),e}function zi(e){var t=Kt(Number(e));return At(t)?String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Hi(e))}function Ki(e){var t=Kt(Number(e));return At(t)?ke(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Ut()?ke(Ar(64,BigInt(e))):ke(Hi(e)))}function Yi(e){return At(e)?e=ke(Kn(e)):(e=Kt(e),At(e)?e=String(e):(zt(e),e=Hn(V,Z)),e=ke(e)),e}function p1(e){return e==null?e:typeof e=="bigint"?(Un(e)?e=Number(e):(e=Ar(64,e),e=Un(e)?Number(e):String(e)),e):Tr(e)?typeof e=="number"?Kn(e):zi(e):void 0}function Kr(e){const t=typeof e;return e==null?e:t==="bigint"?ke(Ar(64,e)):Tr(e)?t==="string"?Ki(e):Yi(e):void 0}function Xi(e){if(typeof e!="string")throw Error();return e}function xr(e){if(e!=null&&typeof e!="string")throw Error();return e}function de(e){return e==null||typeof e=="string"?e:void 0}function Yn(e,t,r,n){return e!=null&&e[Gt]===Wt?e:Array.isArray(e)?((n=(r=0|e[m])|32&n|2&n)!==r&&se(e,n),new t(e)):(r?2&n?((e=t[Pi])||(br((e=new t).v),e=t[Pi]=e),t=e):t=new t:t=void 0,t)}function g1(e,t,r){if(t)e:{if(!Tr(t=e))throw Nn("int64");switch(typeof t){case"string":t=Ki(t);break e;case"bigint":t=ke(Ar(64,t));break e;default:t=Yi(t)}}else t=Kr(e);return(e=t)==null?r?f1:void 0:e}const m1={};let y1=function(){try{return Vr(new class extends Map{constructor(){super()}}),!1}catch{return!0}}();class Xn{constructor(){this.g=new Map}get(t){return this.g.get(t)}set(t,r){return this.g.set(t,r),this.size=this.g.size,this}delete(t){return t=this.g.delete(t),this.size=this.g.size,t}clear(){this.g.clear(),this.size=this.g.size}has(t){return this.g.has(t)}entries(){return this.g.entries()}keys(){return this.g.keys()}values(){return this.g.values()}forEach(t,r){return this.g.forEach(t,r)}[Symbol.iterator](){return this.entries()}}const v1=y1?(Object.setPrototypeOf(Xn.prototype,Map.prototype),Object.defineProperties(Xn.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),Xn):class extends Map{constructor(){super()}};function qi(e){return e}function qn(e){if(2&e.J)throw Error("Cannot mutate an immutable Map")}var nt=class extends v1{constructor(e,t,r=qi,n=qi){super(),this.J=0|e[m],this.K=t,this.S=r,this.fa=this.K?_1:n;for(let s=0;s<e.length;s++){const i=e[s],o=r(i[0],!1,!0);let c=i[1];t?c===void 0&&(c=null):c=n(i[1],!1,!0,void 0,void 0,this.J),super.set(o,c)}}V(e){return wr(Array.from(super.entries(),e))}clear(){qn(this),super.clear()}delete(e){return qn(this),super.delete(this.S(e,!0,!1))}entries(){if(this.K){var e=super.keys();e=new Ci(e,b1,this)}else e=super.entries();return e}values(){if(this.K){var e=super.keys();e=new Ci(e,nt.prototype.get,this)}else e=super.values();return e}forEach(e,t){this.K?super.forEach((r,n,s)=>{e.call(t,s.get(n),n,s)}):super.forEach(e,t)}set(e,t){return qn(this),(e=this.S(e,!0,!1))==null?this:t==null?(super.delete(e),this):super.set(e,this.fa(t,!0,!0,this.K,!1,this.J))}Ma(e){const t=this.S(e[0],!1,!0);e=e[1],e=this.K?e===void 0?null:e:this.fa(e,!1,!0,void 0,!1,this.J),super.set(t,e)}has(e){return super.has(this.S(e,!1,!1))}get(e){e=this.S(e,!1,!1);const t=super.get(e);if(t!==void 0){var r=this.K;return r?((r=this.fa(t,!1,!0,r,this.ra,this.J))!==t&&super.set(e,r),r):t}}[Symbol.iterator](){return this.entries()}};function _1(e,t,r,n,s,i){return e=Yn(e,n,r,i),s&&(e=Zn(e)),e}function b1(e){return[e,this.get(e)]}let w1;function Ji(){return w1||(w1=new nt(br([]),void 0,void 0,void 0,m1))}function Yr(e){return Ee?e[Ee]:void 0}function Xr(e,t){for(const r in e)!isNaN(r)&&t(e,+r,e[r])}nt.prototype.toJSON=void 0;var Jn=class{};const E1={Ka:!0};function A1(e,t){t<100||Bt(Q2,1)}function qr(e,t,r,n){const s=n!==void 0;n=!!n;var i,o=Ee;!s&&Vt&&o&&(i=e[o])&&Xr(i,A1),o=[];var c=e.length;let u;i=4294967295;let f=!1;const l=!!(64&t),d=l?128&t?0:-1:void 0;1&t||(u=c&&e[c-1],u!=null&&typeof u=="object"&&u.constructor===Object?i=--c:u=void 0,!l||128&t||s||(f=!0,i=i-d+d)),t=void 0;for(var b=0;b<c;b++){let A=e[b];if(A!=null&&(A=r(A,n))!=null)if(l&&b>=i){const B=b-d;(t??(t={}))[B]=A}else o[b]=A}if(u)for(let A in u){if((c=u[A])==null||(c=r(c,n))==null)continue;let B;b=+A,l&&!Number.isNaN(b)&&(B=b+d)<i?o[B]=c:(t??(t={}))[A]=c}return t&&(f?o.push(t):o[i]=t),s&&Ee&&(e=Yr(e))&&e instanceof Jn&&(o[Ee]=function(A){const B=new Jn;return Xr(A,(He,ze,te)=>{B[ze]=Ue(te)}),B.da=A.da,B}(e)),o}function k1(e){return e[0]=Lr(e[0]),e[1]=Lr(e[1]),e}function Lr(e){switch(typeof e){case"number":return Number.isFinite(e)?e:""+e;case"bigint":return Un(e)?Number(e):""+e;case"boolean":return e?1:0;case"object":if(Array.isArray(e)){var t=0|e[m];return e.length===0&&1&t?void 0:qr(e,t,Lr)}if(e!=null&&e[Gt]===Wt)return $i(e);if(e instanceof Ye){if((t=e.g)==null)e="";else if(typeof t=="string")e=t;else{if(ki){for(var r="",n=0,s=t.length-10240;n<s;)r+=String.fromCharCode.apply(null,t.subarray(n,n+=10240));r+=String.fromCharCode.apply(null,n?t.subarray(n):t),t=btoa(r)}else{r===void 0&&(r=0),Ai(),r=Ei[r],n=Array(Math.floor(t.length/3)),s=r[64]||"";let f=0,l=0;for(;f<t.length-2;f+=3){var i=t[f],o=t[f+1],c=t[f+2],u=r[i>>2];i=r[(3&i)<<4|o>>4],o=r[(15&o)<<2|c>>6],c=r[63&c],n[l++]=u+i+o+c}switch(u=0,c=s,t.length-f){case 2:c=r[(15&(u=t[f+1]))<<2]||s;case 1:t=t[f],n[l]=r[t>>2]+r[(3&t)<<4|u>>4]+c+s}t=n.join("")}e=e.g=t}return e}return e instanceof nt?e=e.size!==0?e.V(k1):void 0:void 0}return e}function $i(e){return qr(e=e.v,0|e[m],Lr)}let S1,T1;function kt(e,t){return Zi(e,t[0],t[1])}function Zi(e,t,r,n=0){if(e==null){var s=32;r?(e=[r],s|=128):e=[],t&&(s=-16760833&s|(1023&t)<<14)}else{if(!Array.isArray(e))throw Error("narr");if(s=0|e[m],_i&&1&s)throw Error("rfarr");if(2048&s&&!(2&s)&&function(){if(_i)throw Error("carr");Bt(e1,5)}(),256&s)throw Error("farr");if(64&s)return(s|n)!==s&&se(e,s|n),e;if(r&&(s|=128,r!==e[0]))throw Error("mid");e:{s|=64;var i=(r=e).length;if(i){var o=i-1;const u=r[o];if(u!=null&&typeof u=="object"&&u.constructor===Object){if((o-=t=128&s?0:-1)>=1024)throw Error("pvtlmt");for(var c in u)(i=+c)<o&&(r[i+t]=u[c],delete u[c]);s=-16760833&s|(1023&o)<<14;break e}}if(t){if((c=Math.max(t,i-(128&s?0:-1)))>1024)throw Error("spvt");s=-16760833&s|(1023&c)<<14}}}return se(e,64|s|n),e}function x1(e,t){if(typeof e!="object")return e;if(Array.isArray(e)){var r=0|e[m];return e.length===0&&1&r?void 0:Qi(e,r,t)}if(e!=null&&e[Gt]===Wt)return eo(e);if(e instanceof nt){if(2&(t=e.J))return e;if(!e.size)return;if(r=br(e.V()),e.K)for(e=0;e<r.length;e++){const n=r[e];let s=n[1];s=s==null||typeof s!="object"?void 0:s!=null&&s[Gt]===Wt?eo(s):Array.isArray(s)?Qi(s,0|s[m],!!(32&t)):void 0,n[1]=s}return r}return e instanceof Ye?e:void 0}function Qi(e,t,r){return 2&t||(!r||4096&t||16&t?e=Xt(e,t,!1,r&&!(16&t)):(_r(e,34),4&t&&Object.freeze(e))),e}function $n(e,t,r){return e=new e.constructor(t),r&&(e.h=Et),e.m=Et,e}function eo(e){const t=e.v,r=0|t[m];return Ae(e,r)?e:Qn(e,t,r)?$n(e,t):Xt(t,r)}function Xt(e,t,r,n){return n??(n=!!(34&t)),e=qr(e,t,x1,n),n=32,r&&(n|=2),se(e,t=16769217&t|n),e}function Zn(e){const t=e.v,r=0|t[m];return Ae(e,r)?Qn(e,t,r)?$n(e,t,!0):new e.constructor(Xt(t,r,!1)):e}function qt(e){if(e.h!==Et)return!1;var t=e.v;return _r(t=Xt(t,0|t[m]),2048),e.v=t,e.h=void 0,e.m=void 0,!0}function Jt(e){if(!qt(e)&&Ae(e,0|e.v[m]))throw Error()}function St(e,t){t===void 0&&(t=0|e[m]),32&t&&!(4096&t)&&se(e,4096|t)}function Qn(e,t,r){return!!(2&r)||!(!(32&r)||4096&r)&&(se(t,2|r),e.h=Et,!0)}const L1=ke(0),ut={};function j(e,t,r,n,s){if((t=st(e.v,t,r,s))!==null||n&&e.m!==Et)return t}function st(e,t,r,n){if(t===-1)return null;const s=t+(r?0:-1),i=e.length-1;let o,c;if(!(i<1+(r?0:-1))){if(s>=i)if(o=e[i],o!=null&&typeof o=="object"&&o.constructor===Object)r=o[t],c=!0;else{if(s!==i)return;r=o}else r=e[s];if(n&&r!=null){if((n=n(r))==null)return n;if(!Object.is(n,r))return c?o[t]=n:e[s]=n,n}return r}}function F(e,t,r,n){Jt(e),ie(e=e.v,0|e[m],t,r,n)}function ie(e,t,r,n,s){const i=r+(s?0:-1);var o=e.length-1;if(o>=1+(s?0:-1)&&i>=o){const c=e[o];if(c!=null&&typeof c=="object"&&c.constructor===Object)return c[r]=n,t}return i<=o?(e[i]=n,t):(n!==void 0&&(r>=(o=(t??(t=0|e[m]))>>14&1023||536870912)?n!=null&&(e[o+(s?0:-1)]={[r]:n}):e[i]=n),t)}function Tt(){return t1===void 0?2:4}function xt(e,t,r,n,s){let i=e.v,o=0|i[m];n=Ae(e,o)?1:n,s=!!s||n===3,n===2&&qt(e)&&(i=e.v,o=0|i[m]);let c=(e=es(i,t))===wt?7:0|e[m],u=ts(c,o);var f=!(4&u);if(f){4&u&&(e=Ue(e),c=0,u=Pt(u,o),o=ie(i,o,t,e));let l=0,d=0;for(;l<e.length;l++){const b=r(e[l]);b!=null&&(e[d++]=b)}d<l&&(e.length=d),r=-513&(4|u),u=r&=-1025,u&=-4097}return u!==c&&(se(e,u),2&u&&Object.freeze(e)),to(e,u,i,o,t,n,f,s)}function to(e,t,r,n,s,i,o,c){let u=t;return i===1||i===4&&(2&t||!(16&t)&&32&n)?Lt(t)||((t|=!e.length||o&&!(4096&t)||32&n&&!(4096&t||16&t)?2:256)!==u&&se(e,t),Object.freeze(e)):(i===2&&Lt(t)&&(e=Ue(e),u=0,t=Pt(t,n),n=ie(r,n,s,e)),Lt(t)||(c||(t|=16),t!==u&&se(e,t))),2&t||!(4096&t||16&t)||St(r,n),e}function es(e,t,r){return e=st(e,t,r),Array.isArray(e)?e:wt}function ts(e,t){return 2&t&&(e|=2),1|e}function Lt(e){return!!(2&e)&&!!(4&e)||!!(256&e)}function ro(e){return Bn(e,!0)}function no(e){e=Ue(e);for(let t=0;t<e.length;t++){const r=e[t]=Ue(e[t]);Array.isArray(r[1])&&(r[1]=br(r[1]))}return wr(e)}function lt(e,t,r,n){Jt(e),ie(e=e.v,0|e[m],t,(n==="0"?Number(r)===0:r===n)?void 0:r)}function $t(e,t,r){if(2&t)throw Error();const n=Ht(t);let s=es(e,r,n),i=s===wt?7:0|s[m],o=ts(i,t);return(2&o||Lt(o)||16&o)&&(o===i||Lt(o)||se(s,o),s=Ue(s),i=0,o=Pt(o,t),ie(e,t,r,s,n)),o&=-13,o!==i&&se(s,o),s}function rs(e,t){var r=la;return ss(ns(e=e.v),e,void 0,r)===t?t:-1}function ns(e){if(Vt)return e[vr]??(e[vr]=new Map);if(vr in e)return e[vr];const t=new Map;return Object.defineProperty(e,vr,{value:t}),t}function so(e,t,r,n,s){const i=ns(e),o=ss(i,e,t,r,s);return o!==n&&(o&&(t=ie(e,t,o,void 0,s)),i.set(r,n)),t}function ss(e,t,r,n,s){let i=e.get(n);if(i!=null)return i;i=0;for(let o=0;o<n.length;o++){const c=n[o];st(t,c,s)!=null&&(i!==0&&(r=ie(t,r,i,void 0,s)),i=c)}return e.set(n,i),i}function is(e,t,r){let n=0|e[m];const s=Ht(n),i=st(e,r,s);let o;if(i!=null&&i[Gt]===Wt){if(!Ae(i))return qt(i),i.v;o=i.v}else Array.isArray(i)&&(o=i);if(o){const c=0|o[m];2&c&&(o=Xt(o,c))}return o=kt(o,t),o!==i&&ie(e,n,r,o,s),o}function io(e,t,r,n,s){let i=!1;if((n=st(e,n,s,o=>{const c=Yn(o,r,!1,t);return i=c!==o&&c!=null,c}))!=null)return i&&!Ae(n)&&St(e,t),n}function L(e,t,r,n){let s=e.v,i=0|s[m];if((t=io(s,i,t,r,n))==null)return t;if(i=0|s[m],!Ae(e,i)){const o=Zn(t);o!==t&&(qt(e)&&(s=e.v,i=0|s[m]),i=ie(s,i,r,t=o,n),St(s,i))}return t}function oo(e,t,r,n,s,i,o,c){var u=Ae(e,r);i=u?1:i,o=!!o||i===3,u=c&&!u,(i===2||u)&&qt(e)&&(r=0|(t=e.v)[m]);var f=(e=es(t,s))===wt?7:0|e[m],l=ts(f,r);if(c=!(4&l)){var d=e,b=r;const A=!!(2&l);A&&(b|=2);let B=!A,He=!0,ze=0,te=0;for(;ze<d.length;ze++){const H=Yn(d[ze],n,!1,b);if(H instanceof n){if(!A){const Ct=Ae(H);B&&(B=!Ct),He&&(He=Ct)}d[te++]=H}}te<ze&&(d.length=te),l|=4,l=He?-4097&l:4096|l,l=B?8|l:-9&l}if(l!==f&&(se(e,l),2&l&&Object.freeze(e)),u&&!(8&l||!e.length&&(i===1||i===4&&(2&l||!(16&l)&&32&r)))){for(Lt(l)&&(e=Ue(e),l=Pt(l,r),r=ie(t,r,s,e)),n=e,u=l,f=0;f<n.length;f++)(d=n[f])!==(l=Zn(d))&&(n[f]=l);u|=8,se(e,l=u=n.length?4096|u:-4097&u)}return to(e,l,t,r,s,i,c,o)}function it(e,t,r){const n=e.v;return oo(e,n,0|n[m],t,r,Tt(),!1,!0)}function ao(e){return e==null&&(e=void 0),e}function w(e,t,r,n,s){return F(e,r,n=ao(n),s),n&&!Ae(n)&&St(e.v),e}function Pr(e,t,r,n){e:{var s=n=ao(n);Jt(e);const i=e.v;let o=0|i[m];if(s==null){const c=ns(i);if(ss(c,i,o,r)!==t)break e;c.set(r,0)}else o=so(i,o,r,t);ie(i,o,t,s)}n&&!Ae(n)&&St(e.v)}function Pt(e,t){return-273&(2&t?2|e:-3&e)}function os(e,t,r,n){var s=n;Jt(e),e=oo(e,n=e.v,0|n[m],r,t,2,!0),s=s??new r,e.push(s),t=r=e===wt?7:0|e[m],(s=Ae(s))?(r&=-9,e.length===1&&(r&=-4097)):r|=4096,r!==t&&se(e,r),s||St(n)}function Me(e,t,r){return Yt(j(e,t,void 0,r))}function co(e){return(Cn?j(e,2,void 0,void 0,Kr):Kr(j(e,2)))??L1}function Y(e,t){return j(e,t,void 0,void 0,qe)??0}function ot(e,t,r){if(r!=null){if(typeof r!="number"||!zr(r))throw Nn("int32");r|=0}F(e,t,r)}function _(e,t,r){F(e,t,kr(r))}function Se(e,t,r){lt(e,t,xr(r),"")}function Jr(e,t,r){{Jt(e);const o=e.v;let c=0|o[m];if(r==null)ie(o,c,t);else{var n=e=r===wt?7:0|r[m],s=Lt(e),i=s||Object.isFrozen(r);for(s||(e=0),i||(r=Ue(r),n=0,e=Pt(e,c),i=!1),e|=5,e|=(4&e?512&e?512:1024&e?1024:0:void 0)??(Cn?1024:0),s=0;s<r.length;s++){const u=r[s],f=Xi(u);Object.is(u,f)||(i&&(r=Ue(r),n=0,e=Pt(e,c),i=!1),r[s]=f)}e!==n&&(i&&(r=Ue(r),e=Pt(e,c)),se(r,e)),ie(o,c,t,r)}}}function $r(e,t,r){Jt(e),xt(e,t,de,2,!0).push(Xi(r))}var Zt=class{constructor(e,t,r){if(this.buffer=e,r&&!t)throw Error();this.g=t}};function as(e,t){if(typeof e=="string")return new Zt(Ti(e),t);if(Array.isArray(e))return new Zt(new Uint8Array(e),t);if(e.constructor===Uint8Array)return new Zt(e,!1);if(e.constructor===ArrayBuffer)return e=new Uint8Array(e),new Zt(e,!1);if(e.constructor===Ye)return t=jn(e)||new Uint8Array(0),new Zt(t,!0,e);if(e instanceof Uint8Array)return e=e.constructor===Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Zt(e,!1);throw Error()}function Qt(e,t){let r,n=0,s=0,i=0;const o=e.h;let c=e.g;do r=o[c++],n|=(127&r)<<i,i+=7;while(i<32&&128&r);if(i>32)for(s|=(127&r)>>4,i=3;i<32&&128&r;i+=7)r=o[c++],s|=(127&r)<<i;if(Ot(e,c),!(128&r))return t(n>>>0,s>>>0);throw Error()}function cs(e){let t=0,r=e.g;const n=r+10,s=e.h;for(;r<n;){const i=s[r++];if(t|=i,(128&i)==0)return Ot(e,r),!!(127&t)}throw Error()}function ht(e){const t=e.h;let r=e.g,n=t[r++],s=127&n;if(128&n&&(n=t[r++],s|=(127&n)<<7,128&n&&(n=t[r++],s|=(127&n)<<14,128&n&&(n=t[r++],s|=(127&n)<<21,128&n&&(n=t[r++],s|=n<<28,128&n&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++])))))throw Error();return Ot(e,r),s}function at(e){return ht(e)>>>0}function Zr(e){var t=e.h;const r=e.g;var n=t[r],s=t[r+1];const i=t[r+2];return t=t[r+3],Ot(e,e.g+4),e=2*((s=(n<<0|s<<8|i<<16|t<<24)>>>0)>>31)+1,n=s>>>23&255,s&=8388607,n==255?s?NaN:e*(1/0):n==0?1401298464324817e-60*e*s:e*Math.pow(2,n-150)*(s+8388608)}function P1(e){return ht(e)}function Ot(e,t){if(e.g=t,t>e.l)throw Error()}function uo(e,t){if(t<0)throw Error();const r=e.g;if((t=r+t)>e.l)throw Error();return e.g=t,r}function lo(e,t){if(t==0)return bt();var r=uo(e,t);return e.Y&&e.j?r=e.h.subarray(r,r+t):(e=e.h,r=r===(t=r+t)?new Uint8Array(0):c1?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?bt():new Ye(r,Dt)}var ho=[];function fo(e,t,r,n){if(tn.length){const s=tn.pop();return s.o(n),s.g.init(e,t,r,n),s}return new O1(e,t,r,n)}function po(e){e.g.clear(),e.l=-1,e.h=-1,tn.length<100&&tn.push(e)}function go(e){var t=e.g;if(t.g==t.l)return!1;e.m=e.g.g;var r=at(e.g);if(t=r>>>3,!((r&=7)>=0&&r<=5)||t<1)throw Error();return e.l=t,e.h=r,!0}function Qr(e){switch(e.h){case 0:e.h!=0?Qr(e):cs(e.g);break;case 1:Ot(e=e.g,e.g+8);break;case 2:if(e.h!=2)Qr(e);else{var t=at(e.g);Ot(e=e.g,e.g+t)}break;case 5:Ot(e=e.g,e.g+4);break;case 3:for(t=e.l;;){if(!go(e))throw Error();if(e.h==4){if(e.l!=t)throw Error();break}Qr(e)}break;default:throw Error()}}function Or(e,t,r){const n=e.g.l;var s=at(e.g);let i=(s=e.g.g+s)-n;if(i<=0&&(e.g.l=s,r(t,e,void 0,void 0,void 0),i=s-e.g.g),i)throw Error();return e.g.g=s,e.g.l=n,t}function us(e){var t=at(e.g),r=uo(e=e.g,t);if(e=e.h,V2){var n,s=e;(n=Fn)||(n=Fn=new TextDecoder("utf-8",{fatal:!0})),t=r+t,s=r===0&&t===s.length?s:s.subarray(r,t);try{var i=n.decode(s)}catch(c){if(Ur===void 0){try{n.decode(new Uint8Array([128]))}catch{}try{n.decode(new Uint8Array([97])),Ur=!0}catch{Ur=!1}}throw!Ur&&(Fn=void 0),c}}else{t=(i=r)+t,r=[];let c,u=null;for(;i<t;){var o=e[i++];o<128?r.push(o):o<224?i>=t?_t():(c=e[i++],o<194||(192&c)!=128?(i--,_t()):r.push((31&o)<<6|63&c)):o<240?i>=t-1?_t():(c=e[i++],(192&c)!=128||o===224&&c<160||o===237&&c>=160||(192&(n=e[i++]))!=128?(i--,_t()):r.push((15&o)<<12|(63&c)<<6|63&n)):o<=244?i>=t-2?_t():(c=e[i++],(192&c)!=128||c-144+(o<<28)>>30||(192&(n=e[i++]))!=128||(192&(s=e[i++]))!=128?(i--,_t()):(o=(7&o)<<18|(63&c)<<12|(63&n)<<6|63&s,o-=65536,r.push(55296+(o>>10&1023),56320+(1023&o)))):_t(),r.length>=8192&&(u=mi(u,r),r.length=0)}i=mi(u,r)}return i}function mo(e){const t=at(e.g);return lo(e.g,t)}function en(e,t,r){var n=at(e.g);for(n=e.g.g+n;e.g.g<n;)r.push(t(e.g))}var O1=class{constructor(e,t,r,n){if(ho.length){const s=ho.pop();s.init(e,t,r,n),e=s}else e=new class{constructor(s,i,o,c){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.init(s,i,o,c)}init(s,i,o,{Y:c=!1,ea:u=!1}={}){this.Y=c,this.ea=u,s&&(s=as(s,this.ea),this.h=s.buffer,this.j=s.g,this.m=i||0,this.l=o!==void 0?this.m+o:this.h.length,this.g=this.m)}clear(){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.Y=!1}}(e,t,r,n);this.g=e,this.m=this.g.g,this.h=this.l=-1,this.o(n)}o({ha:e=!1}={}){this.ha=e}},tn=[];function yo(e){return e?/^\d+$/.test(e)?(Hr(e),new ls(V,Z)):null:F1||(F1=new ls(0,0))}var ls=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let F1;function vo(e){return e?/^-?\d+$/.test(e)?(Hr(e),new hs(V,Z)):null:R1||(R1=new hs(0,0))}var hs=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let R1;function er(e,t,r){for(;r>0||t>127;)e.g.push(127&t|128),t=(t>>>7|r<<25)>>>0,r>>>=7;e.g.push(t)}function tr(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function rn(e,t){if(t>=0)tr(e,t);else{for(let r=0;r<9;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function fs(e){var t=V;e.g.push(t>>>0&255),e.g.push(t>>>8&255),e.g.push(t>>>16&255),e.g.push(t>>>24&255)}function rr(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function Ce(e,t,r){tr(e.g,8*t+r)}function ds(e,t){return Ce(e,t,2),t=e.g.end(),rr(e,t),t.push(e.h),t}function ps(e,t){var r=t.pop();for(r=e.h+e.g.length()-r;r>127;)t.push(127&r|128),r>>>=7,e.h++;t.push(r),e.h++}function nn(e,t,r){Ce(e,t,2),tr(e.g,r.length),rr(e,e.g.end()),rr(e,r)}function sn(e,t,r,n){r!=null&&(t=ds(e,t),n(r,e),ps(e,t))}function Je(){const e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var gs=Je(),_o=Je(),ms=Je(),ys=Je(),bo=Je(),wo=Je(),M1=Je(),on=Je(),Eo=Je(),Ao=Je();function $e(e,t,r){var n=e.v;Ee&&Ee in n&&(n=n[Ee])&&delete n[t.g],t.h?t.j(e,t.h,t.g,r,t.l):t.j(e,t.g,r,t.l)}var y=class{constructor(e,t){this.v=Zi(e,t,void 0,2048)}toJSON(){return $i(this)}j(){var s;var e=gc,t=this.v,r=e.g,n=Ee;if(Vt&&n&&((s=t[n])==null?void 0:s[r])!=null&&Bt(Z2,3),t=e.g,Oi&&Ee&&Oi===void 0&&(n=(r=this.v)[Ee])&&(n=n.da))try{n(r,t,E1)}catch(i){vi(i)}return e.h?e.m(this,e.h,e.g,e.l):e.m(this,e.g,e.defaultValue,e.l)}clone(){const e=this.v,t=0|e[m];return Qn(this,e,t)?$n(this,e,!0):new this.constructor(Xt(e,t,!1))}};y.prototype[Gt]=Wt,y.prototype.toString=function(){return this.v.toString()};var nr=class{constructor(e,t,r){this.g=e,this.h=t,e=gs,this.l=!!e&&r===e||!1}};function an(e,t){return new nr(e,t,gs)}function ko(e,t,r,n,s){sn(e,r,Oo(t,n),s)}const C1=an(function(e,t,r,n,s){return e.h===2&&(Or(e,is(t,n,r),s),!0)},ko),I1=an(function(e,t,r,n,s){return e.h===2&&(Or(e,is(t,n,r),s),!0)},ko);var cn=Symbol(),un=Symbol(),vs=Symbol(),So=Symbol(),To=Symbol();let xo,Lo;function Ft(e,t,r,n){var s=n[e];if(s)return s;(s={}).qa=n,s.T=function(d){switch(typeof d){case"boolean":return S1||(S1=[0,void 0,!0]);case"number":return d>0?void 0:d===0?T1||(T1=[0,void 0]):[-d,void 0];case"string":return[0,d];case"object":return d}}(n[0]);var i=n[1];let o=1;i&&i.constructor===Object&&(s.ba=i,typeof(i=n[++o])=="function"&&(s.ma=!0,xo??(xo=i),Lo??(Lo=n[o+1]),i=n[o+=2]));const c={};for(;i&&Array.isArray(i)&&i.length&&typeof i[0]=="number"&&i[0]>0;){for(var u=0;u<i.length;u++)c[i[u]]=i;i=n[++o]}for(u=1;i!==void 0;){let d;typeof i=="number"&&(u+=i,i=n[++o]);var f=void 0;if(i instanceof nr?d=i:(d=C1,o--),d==null?void 0:d.l){i=n[++o],f=n;var l=o;typeof i=="function"&&(i=i(),f[l]=i),f=i}for(l=u+1,typeof(i=n[++o])=="number"&&i<0&&(l-=i,i=n[++o]);u<l;u++){const b=c[u];f?r(s,u,d,f,b):t(s,u,d,b)}}return n[e]=s}function Po(e){return Array.isArray(e)?e[0]instanceof nr?e:[I1,e]:[e,void 0]}function Oo(e,t){return e instanceof y?e.v:Array.isArray(e)?kt(e,t):void 0}function _s(e,t,r,n){const s=r.g;e[t]=n?(i,o,c)=>s(i,o,c,n):s}function bs(e,t,r,n,s){const i=r.g;let o,c;e[t]=(u,f,l)=>i(u,f,l,c||(c=Ft(un,_s,bs,n).T),o||(o=ws(n)),s)}function ws(e){let t=e[vs];if(t!=null)return t;const r=Ft(un,_s,bs,e);return t=r.ma?(n,s)=>xo(n,s,r):(n,s)=>{for(;go(s)&&s.h!=4;){var i=s.l,o=r[i];if(o==null){var c=r.ba;c&&(c=c[i])&&(c=N1(c))!=null&&(o=r[i]=c)}if(o==null||!o(s,n,i)){if(o=(c=s).m,Qr(c),c.ha)var u=void 0;else u=c.g.g-o,c.g.g=o,u=lo(c.g,u);o=void 0,c=n,u&&((o=c[Ee]??(c[Ee]=new Jn))[i]??(o[i]=[])).push(u)}}return(n=Yr(n))&&(n.da=r.qa[To]),!0},e[vs]=t,e[To]=j1.bind(e),t}function j1(e,t,r,n){var s=this[un];const i=this[vs],o=kt(void 0,s.T),c=Yr(e);if(c){var u=!1,f=s.ba;if(f){if(s=(l,d,b)=>{if(b.length!==0)if(f[d])for(const A of b){l=fo(A);try{u=!0,i(o,l)}finally{po(l)}}else n==null||n(e,d,b)},t==null)Xr(c,s);else if(c!=null){const l=c[t];l&&s(c,t,l)}if(u){let l=0|e[m];if(2&l&&2048&l&&!(r!=null&&r.Ka))throw Error();const d=Ht(l),b=(A,B)=>{if(st(e,A,d)!=null){if((r==null?void 0:r.Qa)===1)return;throw Error()}B!=null&&(l=ie(e,l,A,B,d)),delete c[A]};t==null?Ii(o,0|o[m],(A,B)=>{b(A,B)}):b(t,st(o,t,d))}}}}function N1(e){const t=(e=Po(e))[0].g;if(e=e[1]){const r=ws(e),n=Ft(un,_s,bs,e).T;return(s,i,o)=>t(s,i,o,n,r)}return t}function ln(e,t,r){e[t]=r.h}function hn(e,t,r,n){let s,i;const o=r.h;e[t]=(c,u,f)=>o(c,u,f,i||(i=Ft(cn,ln,hn,n).T),s||(s=Fo(n)))}function Fo(e){let t=e[So];if(!t){const r=Ft(cn,ln,hn,e);t=(n,s)=>Ro(n,s,r),e[So]=t}return t}function Ro(e,t,r){Ii(e,0|e[m],(n,s)=>{if(s!=null){var i=function(o,c){var u=o[c];if(u)return u;if((u=o.ba)&&(u=u[c])){var f=(u=Po(u))[0].h;if(u=u[1]){const l=Fo(u),d=Ft(cn,ln,hn,u).T;u=o.ma?Lo(d,l):(b,A,B)=>f(b,A,B,d,l)}else u=f;return o[c]=u}}(r,n);i?i(t,s,n):n<500||Bt(Dn,3)}}),(e=Yr(e))&&Xr(e,(n,s,i)=>{for(rr(t,t.g.end()),n=0;n<i.length;n++)rr(t,jn(i[n])||new Uint8Array(0))})}const D1=ke(0);function sr(e,t){if(Array.isArray(t)){var r=0|t[m];if(4&r)return t;for(var n=0,s=0;n<t.length;n++){const i=e(t[n]);i!=null&&(t[s++]=i)}return s<n&&(t.length=s),(e=-1537&(5|r))!==r&&se(t,e),2&e&&Object.freeze(t),t}}function ge(e,t,r){return new nr(e,t,r)}function ir(e,t,r){return new nr(e,t,r)}function ue(e,t,r){ie(e,0|e[m],t,r,Ht(0|e[m]))}var B1=an(function(e,t,r,n,s){if(e.h!==2)return!1;if(e=Ue(e=Or(e,kt([void 0,void 0],n),s)),s=Ht(n=0|t[m]),2&n)throw Error();let i=st(t,r,s);if(i instanceof nt)2&i.J?(i=i.V(),i.push(e),ie(t,n,r,i,s)):i.Ma(e);else if(Array.isArray(i)){var o=0|i[m];8192&o||se(i,o|=8192),2&o&&(i=no(i),ie(t,n,r,i,s)),i.push(e)}else ie(t,n,r,wr([e]),s);return!0},function(e,t,r,n,s){if(t instanceof nt)t.forEach((i,o)=>{sn(e,r,kt([o,i],n),s)});else if(Array.isArray(t)){for(let i=0;i<t.length;i++){const o=t[i];Array.isArray(o)&&sn(e,r,kt(o,n),s)}wr(t)}});function Mo(e,t,r){(t=qe(t))!=null&&(Ce(e,r,5),e=e.g,Vn(t),fs(e))}function Co(e,t,r){if(t=function(n){if(n==null)return n;const s=typeof n;if(s==="bigint")return String(Ar(64,n));if(Tr(n)){if(s==="string")return zi(n);if(s==="number")return Kn(n)}}(t),t!=null&&(typeof t=="string"&&vo(t),t!=null))switch(Ce(e,r,0),typeof t){case"number":e=e.g,zt(t),er(e,V,Z);break;case"bigint":r=BigInt.asUintN(64,t),r=new hs(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),er(e.g,r.h,r.g);break;default:r=vo(t),er(e.g,r.h,r.g)}}function Io(e,t,r){(t=Yt(t))!=null&&t!=null&&(Ce(e,r,0),rn(e.g,t))}function jo(e,t,r){(t=Gi(t))!=null&&(Ce(e,r,0),e.g.g.push(t?1:0))}function No(e,t,r){(t=de(t))!=null&&nn(e,r,yi(t))}function Do(e,t,r,n,s){sn(e,r,Oo(t,n),s)}function Bo(e,t,r){(t=t==null||typeof t=="string"||t instanceof Ye?t:void 0)!=null&&nn(e,r,as(t,!0).buffer)}function Uo(e,t,r){return(e.h===5||e.h===2)&&(t=$t(t,0|t[m],r),e.h==2?en(e,Zr,t):t.push(Zr(e.g)),!0)}var Q=ge(function(e,t,r){return e.h===5&&(ue(t,r,Zr(e.g)),!0)},Mo,on),U1=ir(Uo,function(e,t,r){if((t=sr(qe,t))!=null)for(let o=0;o<t.length;o++){var n=e,s=r,i=t[o];i!=null&&(Ce(n,s,5),n=n.g,Vn(i),fs(n))}},on),Es=ir(Uo,function(e,t,r){if((t=sr(qe,t))!=null&&t.length){Ce(e,r,2),tr(e.g,4*t.length);for(let n=0;n<t.length;n++)r=e.g,Vn(t[n]),fs(r)}},on),V1=ge(function(e,t,r){return e.h===5&&(ue(t,r,(e=Zr(e.g))===0?void 0:e),!0)},Mo,on),ft=ge(function(e,t,r){return Mn?(e.h!==0?e=!1:(ue(t,r,Qt(e.g,Ui)),e=!0),e):e.h===0&&(ue(t,r,Qt(e.g,Wn)),!0)},Co,wo),As=ge(function(e,t,r){return Mn?(e.h!==0?t=!1:(ue(t,r,(e=Qt(e.g,Ui))===D1?void 0:e),t=!0),t):e.h===0&&(ue(t,r,(e=Qt(e.g,Wn))===0?void 0:e),!0)},Co,wo),G1=ge(function(e,t,r){return Mn?(e.h!==0?e=!1:(ue(t,r,Qt(e.g,l1)),e=!0),e):e.h===0&&(ue(t,r,Qt(e.g,Gn)),!0)},function(e,t,r){if(t=function(n){if(n==null)return n;var s=typeof n;if(s==="bigint")return String(h1(64,n));if(Tr(n)){if(s==="string")return s=Kt(Number(n)),At(s)&&s>=0?n=String(s):((s=n.indexOf("."))!==-1&&(n=n.substring(0,s)),(s=n[0]!=="-"&&((s=n.length)<20||s===20&&n<="18446744073709551615"))||(Hr(n),n=Er(V,Z))),n;if(s==="number")return(n=Kt(n))>=0&&At(n)||(zt(n),n=Gn(V,Z)),n}}(t),t!=null&&(typeof t=="string"&&yo(t),t!=null))switch(Ce(e,r,0),typeof t){case"number":e=e.g,zt(t),er(e,V,Z);break;case"bigint":r=BigInt.asUintN(64,t),r=new ls(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),er(e.g,r.h,r.g);break;default:r=yo(t),er(e.g,r.h,r.g)}},M1),le=ge(function(e,t,r){return e.h===0&&(ue(t,r,ht(e.g)),!0)},Io,ys),Fr=ir(function(e,t,r){return(e.h===0||e.h===2)&&(t=$t(t,0|t[m],r),e.h==2?en(e,ht,t):t.push(ht(e.g)),!0)},function(e,t,r){if((t=sr(Yt,t))!=null&&t.length){r=ds(e,r);for(let n=0;n<t.length;n++)rn(e.g,t[n]);ps(e,r)}},ys),or=ge(function(e,t,r){return e.h===0&&(ue(t,r,(e=ht(e.g))===0?void 0:e),!0)},Io,ys),X=ge(function(e,t,r){return e.h===0&&(ue(t,r,cs(e.g)),!0)},jo,_o),Rt=ge(function(e,t,r){return e.h===0&&(ue(t,r,(e=cs(e.g))===!1?void 0:e),!0)},jo,_o),pe=ir(function(e,t,r){return e.h===2&&(e=us(e),$t(t,0|t[m],r).push(e),!0)},function(e,t,r){if((t=sr(de,t))!=null)for(let o=0;o<t.length;o++){var n=e,s=r,i=t[o];i!=null&&nn(n,s,yi(i))}},ms),dt=ge(function(e,t,r){return e.h===2&&(ue(t,r,(e=us(e))===""?void 0:e),!0)},No,ms),I=ge(function(e,t,r){return e.h===2&&(ue(t,r,us(e)),!0)},No,ms),he=function(e,t,r=gs){return new nr(e,t,r)}(function(e,t,r,n,s){return e.h===2&&(n=kt(void 0,n),$t(t,0|t[m],r).push(n),Or(e,n,s),!0)},function(e,t,r,n,s){if(Array.isArray(t)){for(let i=0;i<t.length;i++)Do(e,t[i],r,n,s);1&(e=0|t[m])||se(t,1|e)}}),q=an(function(e,t,r,n,s,i){if(e.h!==2)return!1;let o=0|t[m];return so(t,o,i,r,Ht(o)),Or(e,t=is(t,n,r),s),!0},Do),Vo=ge(function(e,t,r){return e.h===2&&(ue(t,r,mo(e)),!0)},Bo,Eo),W1=ir(function(e,t,r){return(e.h===0||e.h===2)&&(t=$t(t,0|t[m],r),e.h==2?en(e,at,t):t.push(at(e.g)),!0)},function(e,t,r){if((t=sr(Wi,t))!=null)for(let o=0;o<t.length;o++){var n=e,s=r,i=t[o];i!=null&&(Ce(n,s,0),tr(n.g,i))}},bo),H1=ge(function(e,t,r){return e.h===0&&(ue(t,r,(e=at(e.g))===0?void 0:e),!0)},function(e,t,r){(t=Wi(t))!=null&&t!=null&&(Ce(e,r,0),tr(e.g,t))},bo),Te=ge(function(e,t,r){return e.h===0&&(ue(t,r,ht(e.g)),!0)},function(e,t,r){(t=Yt(t))!=null&&(t=parseInt(t,10),Ce(e,r,0),rn(e.g,t))},Ao);class z1{constructor(t,r){var n=xe;this.g=t,this.h=r,this.m=L,this.j=w,this.defaultValue=void 0,this.l=n.Oa!=null?ji:void 0}register(){Vr(this)}}function Ze(e,t){return new z1(e,t)}function pt(e,t){return(r,n)=>{{const i={ea:!0};n&&Object.assign(i,n),r=fo(r,void 0,void 0,i);try{const o=new e,c=o.v;ws(t)(c,r);var s=o}finally{po(r)}}return s}}function fn(e){return function(){const t=new class{constructor(){this.l=[],this.h=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){const o=this.g;return this.g=[],o}}}};Ro(this.v,t,Ft(cn,ln,hn,e)),rr(t,t.g.end());const r=new Uint8Array(t.h),n=t.l,s=n.length;let i=0;for(let o=0;o<s;o++){const c=n[o];r.set(c,i),i+=c.length}return t.l=[r],r}}var Go=class extends y{constructor(e){super(e)}},Wo=[0,dt,ge(function(e,t,r){return e.h===2&&(ue(t,r,(e=mo(e))===bt()?void 0:e),!0)},function(e,t,r){if(t!=null){if(t instanceof y){const n=t.Ra;return void(n?(t=n(t),t!=null&&nn(e,r,as(t,!0).buffer)):Bt(Dn,3))}if(Array.isArray(t))return void Bt(Dn,3)}Bo(e,t,r)},Eo)];let ks,Ho=globalThis.trustedTypes;function zo(e){var t;return ks===void 0&&(ks=function(){let r=null;if(!Ho)return r;try{const n=s=>s;r=Ho.createPolicy("goog#html",{createHTML:n,createScript:n,createScriptURL:n})}catch{}return r}()),e=(t=ks)?t.createScriptURL(e):e,new class{constructor(r){this.g=r}toString(){return this.g+""}}(e)}function K1(e,...t){if(t.length===0)return zo(e[0]);let r=e[0];for(let n=0;n<t.length;n++)r+=encodeURIComponent(t[n])+e[n+1];return zo(r)}var Ko=[0,le,Te,X,-1,Fr,Te,-1,X],Y1=class extends y{constructor(e){super(e)}},Yo=[0,X,I,X,Te,-1,ir(function(e,t,r){return(e.h===0||e.h===2)&&(t=$t(t,0|t[m],r),e.h==2?en(e,P1,t):t.push(ht(e.g)),!0)},function(e,t,r){if((t=sr(Yt,t))!=null&&t.length){r=ds(e,r);for(let n=0;n<t.length;n++)rn(e.g,t[n]);ps(e,r)}},Ao),I,-1,[0,X,-1],Te,X,-1],Xo=[0,3,X,-1,2,[0,le],[0,Te,X],[0,I,-1],[0]],qo=[0,I,-2],Jo=class extends y{constructor(e){super(e)}},$o=[0],Zo=[0,le,X,1,X,-4],xe=class extends y{constructor(e){super(e,2)}},oe={};oe[336783863]=[0,I,X,-1,le,[0,[1,2,3,4,5,6,7,8,9],q,$o,q,Yo,q,qo,q,Zo,q,Ko,q,[0,I,-2],q,[0,I,Te],q,Xo,q,[0,Te,-1,X]],[0,I],X,[0,[1,3],[2,4],q,[0,Fr],-1,q,[0,pe],-1,he,[0,I,-1]],I];var Qo=[0,As,-1,Rt,-3,As,Fr,dt,or,As,-1,Rt,or,Rt,-2,dt];function N(e,t){$r(e,3,t)}function S(e,t){$r(e,4,t)}var ye=class extends y{constructor(e){super(e,500)}o(e){return w(this,0,7,e)}},Rr=[-1,{}],ea=[0,I,1,Rr],ta=[0,I,pe,Rr];function Ie(e,t){os(e,1,ye,t)}function G(e,t){$r(e,10,t)}function P(e,t){$r(e,15,t)}var Le=class extends y{constructor(e){super(e,500)}o(e){return w(this,0,1001,e)}},ra=[-500,he,[-500,dt,-1,pe,-3,[-2,oe,X],he,Wo,or,-1,ea,ta,he,[0,dt,Rt],dt,Qo,or,pe,987,pe],4,he,[-500,I,-1,[-1,{}],998,I],he,[-500,I,pe,-1,[-2,{},X],997,pe,-1],or,he,[-500,I,pe,Rr,998,pe],pe,or,ea,ta,he,[0,dt,-1,Rr],pe,-2,Qo,dt,-1,Rt,[0,Rt,H1],978,Rr,he,Wo];Le.prototype.g=fn(ra);var X1=pt(Le,ra),q1=class extends y{constructor(e){super(e)}},na=class extends y{constructor(e){super(e)}g(){return it(this,q1,1)}},sa=[0,he,[0,le,Q,I,-1]],dn=pt(na,sa),J1=class extends y{constructor(e){super(e)}},$1=class extends y{constructor(e){super(e)}},Ss=class extends y{constructor(e){super(e)}l(){return L(this,J1,2)}g(){return it(this,$1,5)}},ia=pt(class extends y{constructor(e){super(e)}},[0,pe,Fr,Es,[0,Te,[0,le,-3],[0,Q,-3],[0,le,-1,[0,he,[0,le,-2]]],he,[0,Q,-1,I,Q]],I,-1,ft,he,[0,le,Q],pe,ft]),oa=class extends y{constructor(e){super(e)}},ar=pt(class extends y{constructor(e){super(e)}},[0,he,[0,Q,-4]]),aa=class extends y{constructor(e){super(e)}},Mr=pt(class extends y{constructor(e){super(e)}},[0,he,[0,Q,-4]]),Z1=class extends y{constructor(e){super(e)}},Q1=[0,le,-1,Es,Te],ca=class extends y{constructor(e){super(e)}};ca.prototype.g=fn([0,Q,-4,ft]);var ec=class extends y{constructor(e){super(e)}},tc=pt(class extends y{constructor(e){super(e)}},[0,he,[0,1,le,I,sa],ft]),ua=class extends y{constructor(e){super(e)}},rc=class extends y{constructor(e){super(e)}na(){const e=j(this,1,void 0,void 0,ro);return e??bt()}},nc=class extends y{constructor(e){super(e)}},la=[1,2],sc=pt(class extends y{constructor(e){super(e)}},[0,he,[0,la,q,[0,Es],q,[0,Vo],le,I],ft]),Ts=class extends y{constructor(e){super(e)}},ha=[0,I,le,Q,pe,-1],fa=class extends y{constructor(e){super(e)}},ic=[0,X,-1],da=class extends y{constructor(e){super(e)}},pn=[1,2,3,4,5,6],gn=class extends y{constructor(e){super(e)}g(){return j(this,1,void 0,void 0,ro)!=null}l(){return de(j(this,2))!=null}},z=class extends y{constructor(e){super(e)}g(){return Gi(j(this,2))??!1}},pa=[0,Vo,I,[0,le,ft,-1],[0,G1,ft]],ee=[0,pa,X,[0,pn,q,Zo,q,Yo,q,Ko,q,$o,q,qo,q,Xo],Te],mn=class extends y{constructor(e){super(e)}},xs=[0,ee,Q,-1,le],oc=Ze(502141897,mn);oe[502141897]=xs;var ac=pt(class extends y{constructor(e){super(e)}},[0,[0,Te,-1,U1,W1],Q1]),ga=class extends y{constructor(e){super(e)}},ma=class extends y{constructor(e){super(e)}},Ls=[0,ee,Q,[0,ee],X],cc=Ze(508968150,ma);oe[508968150]=[0,ee,xs,Ls,Q,[0,[0,pa]]],oe[508968149]=Ls;var cr=class extends y{constructor(e){super(e)}l(){return L(this,Ts,2)}g(){F(this,2)}},ya=[0,ee,ha];oe[478825465]=ya;var uc=class extends y{constructor(e){super(e)}},va=class extends y{constructor(e){super(e)}},Ps=class extends y{constructor(e){super(e)}},Os=class extends y{constructor(e){super(e)}},_a=class extends y{constructor(e){super(e)}},ba=[0,ee,[0,ee],ya,-1],wa=[0,ee,Q,le],Fs=[0,ee,Q],Ea=[0,ee,wa,Fs,Q],lc=Ze(479097054,_a);oe[479097054]=[0,ee,Ea,ba],oe[463370452]=ba,oe[464864288]=wa;var hc=Ze(462713202,Os);oe[462713202]=Ea,oe[474472470]=Fs;var fc=class extends y{constructor(e){super(e)}},Aa=class extends y{constructor(e){super(e)}},ka=class extends y{constructor(e){super(e)}},Sa=class extends y{constructor(e){super(e)}},Rs=[0,ee,Q,-1,le],Ms=[0,ee,Q,X];Sa.prototype.g=fn([0,ee,Fs,[0,ee],xs,Ls,Rs,Ms]);var Ta=class extends y{constructor(e){super(e)}},dc=Ze(456383383,Ta);oe[456383383]=[0,ee,ha];var xa=class extends y{constructor(e){super(e)}},pc=Ze(476348187,xa);oe[476348187]=[0,ee,ic];var La=class extends y{constructor(e){super(e)}},Pa=class extends y{constructor(e){super(e)}},Oa=[0,Te,-1],gc=Ze(458105876,class extends y{constructor(e){super(e)}g(){let e;var t=this.v;const r=0|t[m];return e=Ae(this,r),t=function(n,s,i,o){var c=Pa;!o&&qt(n)&&(i=0|(s=n.v)[m]);var u=st(s,2);if(n=!1,u==null){if(o)return Ji();u=[]}else if(u.constructor===nt){if(!(2&u.J)||o)return u;u=u.V()}else Array.isArray(u)?n=!!(2&(0|u[m])):u=[];if(o){if(!u.length)return Ji();n||(n=!0,br(u))}else n&&(n=!1,wr(u),u=no(u));return!n&&32&i&&_r(u,32),i=ie(s,i,2,o=new nt(u,c,g1,void 0)),n||St(s,i),o}(this,t,r,e),!e&&Pa&&(t.ra=!0),t}});oe[458105876]=[0,Oa,B1,[!0,ft,[0,I,-1,pe]],[0,Fr,X,Te]];var Cs=class extends y{constructor(e){super(e)}},Fa=Ze(458105758,Cs);oe[458105758]=[0,ee,I,Oa];var Is=class extends y{constructor(e){super(e)}},Ra=[0,V1,-1,Rt],mc=class extends y{constructor(e){super(e)}},Ma=class extends y{constructor(e){super(e)}},js=[1,2];Ma.prototype.g=fn([0,js,q,Ra,q,[0,he,Ra]]);var Ca=class extends y{constructor(e){super(e)}},yc=Ze(443442058,Ca);oe[443442058]=[0,ee,I,le,Q,pe,-1,X,Q],oe[514774813]=Rs;var Ia=class extends y{constructor(e){super(e)}},vc=Ze(516587230,Ia);function Ns(e,t){return t=t?t.clone():new Ts,e.displayNamesLocale!==void 0?F(t,1,xr(e.displayNamesLocale)):e.displayNamesLocale===void 0&&F(t,1),e.maxResults!==void 0?ot(t,2,e.maxResults):"maxResults"in e&&F(t,2),e.scoreThreshold!==void 0?_(t,3,e.scoreThreshold):"scoreThreshold"in e&&F(t,3),e.categoryAllowlist!==void 0?Jr(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&F(t,4),e.categoryDenylist!==void 0?Jr(t,5,e.categoryDenylist):"categoryDenylist"in e&&F(t,5),t}function ja(e){const t=Number(e);return Number.isSafeInteger(t)?t:String(e)}function Ds(e,t=-1,r=""){return{categories:e.map(n=>({index:Me(n,1)??0??-1,score:Y(n,2)??0,categoryName:de(j(n,3))??""??"",displayName:de(j(n,4))??""??""})),headIndex:t,headName:r}}function _c(e){const t={classifications:it(e,ec,1).map(r=>{var n;return Ds(((n=L(r,na,4))==null?void 0:n.g())??[],Me(r,2)??0,de(j(r,3))??"")})};return function(r){return p1(Cn?j(r,2,void 0,void 0,Kr):j(r,2))}(e)!=null&&(t.timestampMs=ja(co(e))),t}function Na(e){var o,c;var t=xt(e,3,qe,Tt()),r=xt(e,2,Yt,Tt()),n=xt(e,1,de,Tt()),s=xt(e,9,de,Tt());const i={categories:[],keypoints:[]};for(let u=0;u<t.length;u++)i.categories.push({score:t[u],index:r[u]??-1,categoryName:n[u]??"",displayName:s[u]??""});if((t=(o=L(e,Ss,4))==null?void 0:o.l())&&(i.boundingBox={originX:Me(t,1,ut)??0,originY:Me(t,2,ut)??0,width:Me(t,3,ut)??0,height:Me(t,4,ut)??0,angle:0}),(c=L(e,Ss,4))==null?void 0:c.g().length)for(const u of L(e,Ss,4).g())i.keypoints.push({x:j(u,1,void 0,ut,qe)??0,y:j(u,2,void 0,ut,qe)??0,score:j(u,4,void 0,ut,qe)??0,label:de(j(u,3,void 0,ut))??""});return i}function yn(e){const t=[];for(const r of it(e,aa,1))t.push({x:Y(r,1)??0,y:Y(r,2)??0,z:Y(r,3)??0,visibility:Y(r,4)??0});return t}function Cr(e){const t=[];for(const r of it(e,oa,1))t.push({x:Y(r,1)??0,y:Y(r,2)??0,z:Y(r,3)??0,visibility:Y(r,4)??0});return t}function Da(e){return Array.from(e,t=>t>127?t-256:t)}function Ba(e,t){if(e.length!==t.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${e.length} vs. ${t.length}).`);let r=0,n=0,s=0;for(let i=0;i<e.length;i++)r+=e[i]*t[i],n+=e[i]*e[i],s+=t[i]*t[i];if(n<=0||s<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return r/Math.sqrt(n*s)}let vn;oe[516587230]=[0,ee,Rs,Ms,Q],oe[518928384]=Ms;const bc=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);async function Ua(){if(vn===void 0)try{await WebAssembly.instantiate(bc),vn=!0}catch{vn=!1}return vn}async function Ir(e,t=K1``){const r=await Ua()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var Mt=class{};function Va(){var e=navigator;return typeof OffscreenCanvas<"u"&&(!function(t=navigator){return(t=t.userAgent).includes("Safari")&&!t.includes("Chrome")}(e)||!!((e=e.userAgent.match(/Version\/([\d]+).*Safari/))&&e.length>=1&&Number(e[1])>=17))}async function Ga(e){if(typeof importScripts!="function"){const t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise((r,n)=>{t.addEventListener("load",()=>{r()},!1),t.addEventListener("error",s=>{n(s)},!1),document.body.appendChild(t)})}try{importScripts(e.toString())}catch(t){if(!(t instanceof TypeError))throw t;await self.import(e.toString())}}function Wa(e){return e.videoWidth!==void 0?[e.videoWidth,e.videoHeight]:e.naturalWidth!==void 0?[e.naturalWidth,e.naturalHeight]:e.displayWidth!==void 0?[e.displayWidth,e.displayHeight]:[e.width,e.height]}function v(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),r(t=e.i.stringToNewUTF8(t)),e.i._free(t)}function Ha(e,t,r){if(!e.i.canvas)throw Error("No OpenGL canvas configured.");if(r?e.i._bindTextureToStream(r):e.i._bindTextureToCanvas(),!(r=e.i.canvas.getContext("webgl2")||e.i.canvas.getContext("webgl")))throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");e.i.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!0),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t),e.i.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1);const[n,s]=Wa(t);return!e.l||n===e.i.canvas.width&&s===e.i.canvas.height||(e.i.canvas.width=n,e.i.canvas.height=s),[n,s]}function za(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const n=new Uint32Array(t.length);for(let s=0;s<t.length;s++)n[s]=e.i.stringToNewUTF8(t[s]);t=e.i._malloc(4*n.length),e.i.HEAPU32.set(n,t>>2),r(t);for(const s of n)e.i._free(s);e.i._free(t)}function Qe(e,t,r){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=r}function gt(e,t,r){let n=[];e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=(s,i,o)=>{i?(r(n,o),n=[]):n.push(s)}}Mt.forVisionTasks=function(e){return Ir("vision",e)},Mt.forTextTasks=function(e){return Ir("text",e)},Mt.forGenAiExperimentalTasks=function(e){return Ir("genai_experimental",e)},Mt.forGenAiTasks=function(e){return Ir("genai",e)},Mt.forAudioTasks=function(e){return Ir("audio",e)},Mt.isSimdSupported=function(){return Ua()};async function wc(e,t,r,n){return e=await(async(s,i,o,c,u)=>{if(i&&await Ga(i),!self.ModuleFactory||o&&(await Ga(o),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&u&&((i=self.Module).locateFile=u.locateFile,u.mainScriptUrlOrBlob&&(i.mainScriptUrlOrBlob=u.mainScriptUrlOrBlob)),u=await self.ModuleFactory(self.Module||u),self.ModuleFactory=self.Module=void 0,new s(u,c)})(e,r.wasmLoaderPath,r.assetLoaderPath,t,{locateFile:s=>s.endsWith(".wasm")?r.wasmBinaryPath.toString():r.assetBinaryPath&&s.endsWith(".data")?r.assetBinaryPath.toString():s}),await e.o(n),e}function Bs(e,t){const r=L(e.baseOptions,gn,1)||new gn;typeof t=="string"?(F(r,2,xr(t)),F(r,1)):t instanceof Uint8Array&&(F(r,1,Bn(t,!1)),F(r,2)),w(e.baseOptions,0,1,r)}function Ka(e){try{const t=e.H.length;if(t===1)throw Error(e.H[0].message);if(t>1)throw Error("Encountered multiple errors: "+e.H.map(r=>r.message).join(", "))}finally{e.H=[]}}function g(e,t){e.C=Math.max(e.C,t)}function _n(e,t){e.B=new ye,Se(e.B,2,"PassThroughCalculator"),N(e.B,"free_memory"),S(e.B,"free_memory_unused_out"),G(t,"free_memory"),Ie(t,e.B)}function ur(e,t){N(e.B,t),S(e.B,t+"_unused_out")}function bn(e){e.g.addBoolToStream(!0,"free_memory",e.C)}var Us=class{constructor(e){this.g=e,this.H=[],this.C=0,this.g.setAutoRenderToScreen(!1)}l(e,t=!0){var r,n,s,i,o,c;if(t){const u=e.baseOptions||{};if((r=e.baseOptions)!=null&&r.modelAssetBuffer&&((n=e.baseOptions)!=null&&n.modelAssetPath))throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!((s=L(this.baseOptions,gn,1))!=null&&s.g()||(i=L(this.baseOptions,gn,1))!=null&&i.l()||(o=e.baseOptions)!=null&&o.modelAssetBuffer||(c=e.baseOptions)!=null&&c.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if(function(f,l){let d=L(f.baseOptions,da,3);if(!d){var b=d=new da,A=new Jo;Pr(b,4,pn,A)}"delegate"in l&&(l.delegate==="GPU"?(l=d,b=new Y1,Pr(l,2,pn,b)):(l=d,b=new Jo,Pr(l,4,pn,b))),w(f.baseOptions,0,3,d)}(this,u),u.modelAssetPath)return fetch(u.modelAssetPath.toString()).then(f=>{if(f.ok)return f.arrayBuffer();throw Error(`Failed to fetch model: ${u.modelAssetPath} (${f.status})`)}).then(f=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(f),!0,!1,!1),Bs(this,"/model.dat"),this.m(),this.L()});if(u.modelAssetBuffer instanceof Uint8Array)Bs(this,u.modelAssetBuffer);else if(u.modelAssetBuffer)return async function(f){const l=[];for(var d=0;;){const{done:b,value:A}=await f.read();if(b)break;l.push(A),d+=A.length}if(l.length===0)return new Uint8Array(0);if(l.length===1)return l[0];f=new Uint8Array(d),d=0;for(const b of l)f.set(b,d),d+=b.length;return f}(u.modelAssetBuffer).then(f=>{Bs(this,f),this.m(),this.L()})}return this.m(),this.L(),Promise.resolve()}L(){}ca(){let e;if(this.g.ca(t=>{e=X1(t)}),!e)throw Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.g.attachErrorListener((r,n)=>{this.H.push(Error(n))}),this.g.Ja(),this.g.setGraph(e,t),this.B=void 0,Ka(this)}finishProcessing(){this.g.finishProcessing(),Ka(this)}close(){this.B=void 0,this.g.closeGraph()}};function mt(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}Us.prototype.close=Us.prototype.close;class Ec{constructor(t,r,n,s){this.g=t,this.h=r,this.m=n,this.l=s}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}}function Ya(e,t,r){const n=e.g;if(r=mt(n.createShader(r),"Failed to create WebGL shader"),n.shaderSource(r,t),n.compileShader(r),!n.getShaderParameter(r,n.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${n.getShaderInfoLog(r)}`);return n.attachShader(e.h,r),r}function Xa(e,t){const r=e.g,n=mt(r.createVertexArray(),"Failed to create vertex array");r.bindVertexArray(n);const s=mt(r.createBuffer(),"Failed to create buffer");r.bindBuffer(r.ARRAY_BUFFER,s),r.enableVertexAttribArray(e.O),r.vertexAttribPointer(e.O,2,r.FLOAT,!1,0,0),r.bufferData(r.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),r.STATIC_DRAW);const i=mt(r.createBuffer(),"Failed to create buffer");return r.bindBuffer(r.ARRAY_BUFFER,i),r.enableVertexAttribArray(e.L),r.vertexAttribPointer(e.L,2,r.FLOAT,!1,0,0),r.bufferData(r.ARRAY_BUFFER,new Float32Array(t?[0,1,0,0,1,0,1,1]:[0,0,0,1,1,1,1,0]),r.STATIC_DRAW),r.bindBuffer(r.ARRAY_BUFFER,null),r.bindVertexArray(null),new Ec(r,n,s,i)}function Vs(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function Ac(e,t,r,n){return Vs(e,t),e.h||(e.m(),e.D()),r?(e.u||(e.u=Xa(e,!0)),r=e.u):(e.A||(e.A=Xa(e,!1)),r=e.A),t.useProgram(e.h),r.bind(),e.l(),e=n(),r.g.bindVertexArray(null),e}function qa(e,t,r){return Vs(e,t),e=mt(t.createTexture(),"Failed to create texture"),t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,r??t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,r??t.LINEAR),t.bindTexture(t.TEXTURE_2D,null),e}function Ja(e,t,r){Vs(e,t),e.B||(e.B=mt(t.createFramebuffer(),"Failed to create framebuffe.")),t.bindFramebuffer(t.FRAMEBUFFER,e.B),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0)}function kc(e){var t;(t=e.g)==null||t.bindFramebuffer(e.g.FRAMEBUFFER,null)}var $a=class{H(){return`
|
|
31
|
+
precision mediump float;
|
|
32
|
+
varying vec2 vTex;
|
|
33
|
+
uniform sampler2D inputTexture;
|
|
34
|
+
void main() {
|
|
35
|
+
gl_FragColor = texture2D(inputTexture, vTex);
|
|
36
|
+
}
|
|
37
|
+
`}m(){const e=this.g;if(this.h=mt(e.createProgram(),"Failed to create WebGL program"),this.X=Ya(this,`
|
|
38
|
+
attribute vec2 aVertex;
|
|
39
|
+
attribute vec2 aTex;
|
|
40
|
+
varying vec2 vTex;
|
|
41
|
+
void main(void) {
|
|
42
|
+
gl_Position = vec4(aVertex, 0.0, 1.0);
|
|
43
|
+
vTex = aTex;
|
|
44
|
+
}`,e.VERTEX_SHADER),this.W=Ya(this,this.H(),e.FRAGMENT_SHADER),e.linkProgram(this.h),!e.getProgramParameter(this.h,e.LINK_STATUS))throw Error(`Error during program linking: ${e.getProgramInfoLog(this.h)}`);this.O=e.getAttribLocation(this.h,"aVertex"),this.L=e.getAttribLocation(this.h,"aTex")}D(){}l(){}close(){if(this.h){const e=this.g;e.deleteProgram(this.h),e.deleteShader(this.X),e.deleteShader(this.W)}this.B&&this.g.deleteFramebuffer(this.B),this.A&&this.A.close(),this.u&&this.u.close()}};function ct(e,t){switch(t){case 0:return e.g.find(r=>r instanceof Uint8Array);case 1:return e.g.find(r=>r instanceof Float32Array);case 2:return e.g.find(r=>typeof WebGLTexture<"u"&&r instanceof WebGLTexture);default:throw Error(`Type is not supported: ${t}`)}}function Gs(e){var t=ct(e,1);if(!t){if(t=ct(e,0))t=new Float32Array(t).map(n=>n/255);else{t=new Float32Array(e.width*e.height);const n=lr(e);var r=Ws(e);if(Ja(r,n,Za(e)),"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";").includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"document"in self&&"ontouchend"in self.document){r=new Float32Array(e.width*e.height*4),n.readPixels(0,0,e.width,e.height,n.RGBA,n.FLOAT,r);for(let s=0,i=0;s<t.length;++s,i+=4)t[s]=r[i]}else n.readPixels(0,0,e.width,e.height,n.RED,n.FLOAT,t)}e.g.push(t)}return t}function Za(e){let t=ct(e,2);if(!t){const r=lr(e);t=e2(e);const n=Gs(e),s=Qa(e);r.texImage2D(r.TEXTURE_2D,0,s,e.width,e.height,0,r.RED,r.FLOAT,n),Hs(e)}return t}function lr(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return e.h||(e.h=mt(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Qa(e){if(e=lr(e),!wn)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))wn=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");wn=e.R16F}return wn}function Ws(e){return e.l||(e.l=new $a),e.l}function e2(e){const t=lr(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=ct(e,2);return r||(r=qa(Ws(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(r),e.j=!0),t.bindTexture(t.TEXTURE_2D,r),r}function Hs(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var wn,fe=class{constructor(e,t,r,n,s,i,o){this.g=e,this.m=t,this.j=r,this.canvas=n,this.l=s,this.width=i,this.height=o,this.j&&--t2===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Fa(){return!!ct(this,0)}ka(){return!!ct(this,1)}R(){return!!ct(this,2)}ja(){return(t=ct(e=this,0))||(t=Gs(e),t=new Uint8Array(t.map(r=>Math.round(255*r))),e.g.push(t)),t;var e,t}ia(){return Gs(this)}N(){return Za(this)}clone(){const e=[];for(const t of this.g){let r;if(t instanceof Uint8Array)r=new Uint8Array(t);else if(t instanceof Float32Array)r=new Float32Array(t);else{if(!(t instanceof WebGLTexture))throw Error(`Type is not supported: ${t}`);{const n=lr(this),s=Ws(this);n.activeTexture(n.TEXTURE1),r=qa(s,n,this.m?n.LINEAR:n.NEAREST),n.bindTexture(n.TEXTURE_2D,r);const i=Qa(this);n.texImage2D(n.TEXTURE_2D,0,i,this.width,this.height,0,n.RED,n.FLOAT,null),n.bindTexture(n.TEXTURE_2D,null),Ja(s,n,r),Ac(s,n,!1,()=>{e2(this),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLE_FAN,0,4),Hs(this)}),kc(s),Hs(this)}}e.push(r)}return new fe(e,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&lr(this).deleteTexture(ct(this,2)),t2=-1}};fe.prototype.close=fe.prototype.close,fe.prototype.clone=fe.prototype.clone,fe.prototype.getAsWebGLTexture=fe.prototype.N,fe.prototype.getAsFloat32Array=fe.prototype.ia,fe.prototype.getAsUint8Array=fe.prototype.ja,fe.prototype.hasWebGLTexture=fe.prototype.R,fe.prototype.hasFloat32Array=fe.prototype.ka,fe.prototype.hasUint8Array=fe.prototype.Fa;var t2=250;function Ve(...e){return e.map(([t,r])=>({start:t,end:r}))}const Sc=function(e){return class extends e{Ja(){this.i._registerModelResourcesGraphService()}}}((r2=class{constructor(e,t){this.l=!0,this.i=e,this.g=null,this.h=0,this.m=typeof this.i._addIntToInputStream=="function",t!==void 0?this.i.canvas=t:Va()?this.i.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.i.canvas=document.createElement("canvas"))}async initializeGraph(e){const t=await(await fetch(e)).arrayBuffer();e=!(e.endsWith(".pbtxt")||e.endsWith(".textproto")),this.setGraph(new Uint8Array(t),e)}setGraphFromString(e){this.setGraph(new TextEncoder().encode(e),!1)}setGraph(e,t){const r=e.length,n=this.i._malloc(r);this.i.HEAPU8.set(e,n),t?this.i._changeBinaryGraph(r,n):this.i._changeTextGraph(r,n),this.i._free(n)}configureAudio(e,t,r,n,s){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),v(this,n||"input_audio",i=>{v(this,s=s||"audio_header",o=>{this.i._configureAudio(i,o,e,t??0,r)})})}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}ca(e){Qe(this,"__graph_config__",t=>{e(t)}),v(this,"__graph_config__",t=>{this.i._getGraphConfig(t,void 0)}),delete this.i.simpleListeners.__graph_config__}attachErrorListener(e){this.i.errorListener=e}attachEmptyPacketListener(e,t){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[e]=t}addAudioToStream(e,t,r){this.addAudioToStreamWithShape(e,0,0,t,r)}addAudioToStreamWithShape(e,t,r,n,s){const i=4*e.length;this.h!==i&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(i),this.h=i),this.i.HEAPF32.set(e,this.g/4),v(this,n,o=>{this.i._addAudioToInputStream(this.g,t,r,o,s)})}addGpuBufferToStream(e,t,r){v(this,t,n=>{const[s,i]=Ha(this,e,n);this.i._addBoundTextureToStream(n,s,i,r)})}addBoolToStream(e,t,r){v(this,t,n=>{this.i._addBoolToInputStream(e,n,r)})}addDoubleToStream(e,t,r){v(this,t,n=>{this.i._addDoubleToInputStream(e,n,r)})}addFloatToStream(e,t,r){v(this,t,n=>{this.i._addFloatToInputStream(e,n,r)})}addIntToStream(e,t,r){v(this,t,n=>{this.i._addIntToInputStream(e,n,r)})}addUintToStream(e,t,r){v(this,t,n=>{this.i._addUintToInputStream(e,n,r)})}addStringToStream(e,t,r){v(this,t,n=>{v(this,e,s=>{this.i._addStringToInputStream(s,n,r)})})}addStringRecordToStream(e,t,r){v(this,t,n=>{za(this,Object.keys(e),s=>{za(this,Object.values(e),i=>{this.i._addFlatHashMapToInputStream(s,i,Object.keys(e).length,n,r)})})})}addProtoToStream(e,t,r,n){v(this,r,s=>{v(this,t,i=>{const o=this.i._malloc(e.length);this.i.HEAPU8.set(e,o),this.i._addProtoToInputStream(o,e.length,i,s,n),this.i._free(o)})})}addEmptyPacketToStream(e,t){v(this,e,r=>{this.i._addEmptyPacketToInputStream(r,t)})}addBoolVectorToStream(e,t,r){v(this,t,n=>{const s=this.i._allocateBoolVector(e.length);if(!s)throw Error("Unable to allocate new bool vector on heap.");for(const i of e)this.i._addBoolVectorEntry(s,i);this.i._addBoolVectorToInputStream(s,n,r)})}addDoubleVectorToStream(e,t,r){v(this,t,n=>{const s=this.i._allocateDoubleVector(e.length);if(!s)throw Error("Unable to allocate new double vector on heap.");for(const i of e)this.i._addDoubleVectorEntry(s,i);this.i._addDoubleVectorToInputStream(s,n,r)})}addFloatVectorToStream(e,t,r){v(this,t,n=>{const s=this.i._allocateFloatVector(e.length);if(!s)throw Error("Unable to allocate new float vector on heap.");for(const i of e)this.i._addFloatVectorEntry(s,i);this.i._addFloatVectorToInputStream(s,n,r)})}addIntVectorToStream(e,t,r){v(this,t,n=>{const s=this.i._allocateIntVector(e.length);if(!s)throw Error("Unable to allocate new int vector on heap.");for(const i of e)this.i._addIntVectorEntry(s,i);this.i._addIntVectorToInputStream(s,n,r)})}addUintVectorToStream(e,t,r){v(this,t,n=>{const s=this.i._allocateUintVector(e.length);if(!s)throw Error("Unable to allocate new unsigned int vector on heap.");for(const i of e)this.i._addUintVectorEntry(s,i);this.i._addUintVectorToInputStream(s,n,r)})}addStringVectorToStream(e,t,r){v(this,t,n=>{const s=this.i._allocateStringVector(e.length);if(!s)throw Error("Unable to allocate new string vector on heap.");for(const i of e)v(this,i,o=>{this.i._addStringVectorEntry(s,o)});this.i._addStringVectorToInputStream(s,n,r)})}addBoolToInputSidePacket(e,t){v(this,t,r=>{this.i._addBoolToInputSidePacket(e,r)})}addDoubleToInputSidePacket(e,t){v(this,t,r=>{this.i._addDoubleToInputSidePacket(e,r)})}addFloatToInputSidePacket(e,t){v(this,t,r=>{this.i._addFloatToInputSidePacket(e,r)})}addIntToInputSidePacket(e,t){v(this,t,r=>{this.i._addIntToInputSidePacket(e,r)})}addUintToInputSidePacket(e,t){v(this,t,r=>{this.i._addUintToInputSidePacket(e,r)})}addStringToInputSidePacket(e,t){v(this,t,r=>{v(this,e,n=>{this.i._addStringToInputSidePacket(n,r)})})}addProtoToInputSidePacket(e,t,r){v(this,r,n=>{v(this,t,s=>{const i=this.i._malloc(e.length);this.i.HEAPU8.set(e,i),this.i._addProtoToInputSidePacket(i,e.length,s,n),this.i._free(i)})})}addBoolVectorToInputSidePacket(e,t){v(this,t,r=>{const n=this.i._allocateBoolVector(e.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(const s of e)this.i._addBoolVectorEntry(n,s);this.i._addBoolVectorToInputSidePacket(n,r)})}addDoubleVectorToInputSidePacket(e,t){v(this,t,r=>{const n=this.i._allocateDoubleVector(e.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(const s of e)this.i._addDoubleVectorEntry(n,s);this.i._addDoubleVectorToInputSidePacket(n,r)})}addFloatVectorToInputSidePacket(e,t){v(this,t,r=>{const n=this.i._allocateFloatVector(e.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(const s of e)this.i._addFloatVectorEntry(n,s);this.i._addFloatVectorToInputSidePacket(n,r)})}addIntVectorToInputSidePacket(e,t){v(this,t,r=>{const n=this.i._allocateIntVector(e.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(const s of e)this.i._addIntVectorEntry(n,s);this.i._addIntVectorToInputSidePacket(n,r)})}addUintVectorToInputSidePacket(e,t){v(this,t,r=>{const n=this.i._allocateUintVector(e.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(const s of e)this.i._addUintVectorEntry(n,s);this.i._addUintVectorToInputSidePacket(n,r)})}addStringVectorToInputSidePacket(e,t){v(this,t,r=>{const n=this.i._allocateStringVector(e.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(const s of e)v(this,s,i=>{this.i._addStringVectorEntry(n,i)});this.i._addStringVectorToInputSidePacket(n,r)})}attachBoolListener(e,t){Qe(this,e,t),v(this,e,r=>{this.i._attachBoolListener(r)})}attachBoolVectorListener(e,t){gt(this,e,t),v(this,e,r=>{this.i._attachBoolVectorListener(r)})}attachIntListener(e,t){Qe(this,e,t),v(this,e,r=>{this.i._attachIntListener(r)})}attachIntVectorListener(e,t){gt(this,e,t),v(this,e,r=>{this.i._attachIntVectorListener(r)})}attachUintListener(e,t){Qe(this,e,t),v(this,e,r=>{this.i._attachUintListener(r)})}attachUintVectorListener(e,t){gt(this,e,t),v(this,e,r=>{this.i._attachUintVectorListener(r)})}attachDoubleListener(e,t){Qe(this,e,t),v(this,e,r=>{this.i._attachDoubleListener(r)})}attachDoubleVectorListener(e,t){gt(this,e,t),v(this,e,r=>{this.i._attachDoubleVectorListener(r)})}attachFloatListener(e,t){Qe(this,e,t),v(this,e,r=>{this.i._attachFloatListener(r)})}attachFloatVectorListener(e,t){gt(this,e,t),v(this,e,r=>{this.i._attachFloatVectorListener(r)})}attachStringListener(e,t){Qe(this,e,t),v(this,e,r=>{this.i._attachStringListener(r)})}attachStringVectorListener(e,t){gt(this,e,t),v(this,e,r=>{this.i._attachStringVectorListener(r)})}attachProtoListener(e,t,r){Qe(this,e,t),v(this,e,n=>{this.i._attachProtoListener(n,r||!1)})}attachProtoVectorListener(e,t,r){gt(this,e,t),v(this,e,n=>{this.i._attachProtoVectorListener(n,r||!1)})}attachAudioListener(e,t,r){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),Qe(this,e,(n,s)=>{n=new Float32Array(n.buffer,n.byteOffset,n.length/4),t(n,s)}),v(this,e,n=>{this.i._attachAudioListener(n,r||!1)})}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends r2{get ga(){return this.i}pa(e,t,r){v(this,t,n=>{const[s,i]=Ha(this,e,n);this.ga._addBoundTextureAsImageToStream(n,s,i,r)})}Z(e,t){Qe(this,e,t),v(this,e,r=>{this.ga._attachImageListener(r)})}aa(e,t){gt(this,e,t),v(this,e,r=>{this.ga._attachImageVectorListener(r)})}}));var r2,Ge=class extends Sc{};async function x(e,t,r){return async function(n,s,i,o){return wc(n,s,i,o)}(e,r.canvas??(Va()?void 0:document.createElement("canvas")),t,r)}function n2(e,t,r,n){if(e.U){const i=new ca;if(r!=null&&r.regionOfInterest){if(!e.oa)throw Error("This task doesn't support region-of-interest.");var s=r.regionOfInterest;if(s.left>=s.right||s.top>=s.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(s.left<0||s.top<0||s.right>1||s.bottom>1)throw Error("Expected RectF values to be in [0,1].");_(i,1,(s.left+s.right)/2),_(i,2,(s.top+s.bottom)/2),_(i,4,s.right-s.left),_(i,3,s.bottom-s.top)}else _(i,1,.5),_(i,2,.5),_(i,4,1),_(i,3,1);if(r!=null&&r.rotationDegrees){if((r==null?void 0:r.rotationDegrees)%90!=0)throw Error("Expected rotation to be a multiple of 90°.");if(_(i,5,-Math.PI*r.rotationDegrees/180),(r==null?void 0:r.rotationDegrees)%180!=0){const[o,c]=Wa(t);r=Y(i,3)*c/o,s=Y(i,4)*o/c,_(i,4,r),_(i,3,s)}}e.g.addProtoToStream(i.g(),"mediapipe.NormalizedRect",e.U,n)}e.g.pa(t,e.X,n??performance.now()),e.finishProcessing()}function We(e,t,r){var n;if((n=e.baseOptions)!=null&&n.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");n2(e,t,r,e.C+1)}function et(e,t,r,n){var s;if(!((s=e.baseOptions)!=null&&s.g()))throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");n2(e,t,r,n)}function hr(e,t,r,n){var s=t.data;const i=t.width,o=i*(t=t.height);if((s instanceof Uint8Array||s instanceof Float32Array)&&s.length!==o)throw Error("Unsupported channel count: "+s.length/o);return e=new fe([s],r,!1,e.g.i.canvas,e.P,i,t),n?e.clone():e}var Pe=class extends Us{constructor(e,t,r,n){super(e),this.g=e,this.X=t,this.U=r,this.oa=n,this.P=new $a}l(e,t=!0){if("runningMode"in e&&F(this.baseOptions,2,Sr(!!e.runningMode&&e.runningMode!=="IMAGE")),e.canvas!==void 0&&this.g.i.canvas!==e.canvas)throw Error("You must create a new task to reset the canvas.");return super.l(e,t)}close(){this.P.close(),super.close()}};Pe.prototype.close=Pe.prototype.close;var je=class extends Pe{constructor(e,t){super(new Ge(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},w(e=this.h=new mn,0,1,t=new z),_(this.h,2,.5),_(this.h,3,.3)}get baseOptions(){return L(this.h,z,1)}set baseOptions(e){w(this.h,0,1,e)}o(e){return"minDetectionConfidence"in e&&_(this.h,2,e.minDetectionConfidence??.5),"minSuppressionThreshold"in e&&_(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}F(e,t){return this.j={detections:[]},We(this,e,t),this.j}G(e,t,r){return this.j={detections:[]},et(this,e,r,t),this.j}m(){var e=new Le;G(e,"image_in"),G(e,"norm_rect_in"),P(e,"detections");const t=new xe;$e(t,oc,this.h);const r=new ye;Se(r,2,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),N(r,"IMAGE:image_in"),N(r,"NORM_RECT:norm_rect_in"),S(r,"DETECTIONS:detections"),r.o(t),Ie(e,r),this.g.attachProtoVectorListener("detections",(n,s)=>{for(const i of n)n=ia(i),this.j.detections.push(Na(n));g(this,s)}),this.g.attachEmptyPacketListener("detections",n=>{g(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};je.prototype.detectForVideo=je.prototype.G,je.prototype.detect=je.prototype.F,je.prototype.setOptions=je.prototype.o,je.createFromModelPath=async function(e,t){return x(je,e,{baseOptions:{modelAssetPath:t}})},je.createFromModelBuffer=function(e,t){return x(je,e,{baseOptions:{modelAssetBuffer:t}})},je.createFromOptions=function(e,t){return x(je,e,t)};var zs=Ve([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]),Ks=Ve([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]),Ys=Ve([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),s2=Ve([474,475],[475,476],[476,477],[477,474]),Xs=Ve([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]),qs=Ve([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),i2=Ve([469,470],[470,471],[471,472],[472,469]),Js=Ve([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]),o2=[...zs,...Ks,...Ys,...Xs,...qs,...Js],a2=Ve([127,34],[34,139],[139,127],[11,0],[0,37],[37,11],[232,231],[231,120],[120,232],[72,37],[37,39],[39,72],[128,121],[121,47],[47,128],[232,121],[121,128],[128,232],[104,69],[69,67],[67,104],[175,171],[171,148],[148,175],[118,50],[50,101],[101,118],[73,39],[39,40],[40,73],[9,151],[151,108],[108,9],[48,115],[115,131],[131,48],[194,204],[204,211],[211,194],[74,40],[40,185],[185,74],[80,42],[42,183],[183,80],[40,92],[92,186],[186,40],[230,229],[229,118],[118,230],[202,212],[212,214],[214,202],[83,18],[18,17],[17,83],[76,61],[61,146],[146,76],[160,29],[29,30],[30,160],[56,157],[157,173],[173,56],[106,204],[204,194],[194,106],[135,214],[214,192],[192,135],[203,165],[165,98],[98,203],[21,71],[71,68],[68,21],[51,45],[45,4],[4,51],[144,24],[24,23],[23,144],[77,146],[146,91],[91,77],[205,50],[50,187],[187,205],[201,200],[200,18],[18,201],[91,106],[106,182],[182,91],[90,91],[91,181],[181,90],[85,84],[84,17],[17,85],[206,203],[203,36],[36,206],[148,171],[171,140],[140,148],[92,40],[40,39],[39,92],[193,189],[189,244],[244,193],[159,158],[158,28],[28,159],[247,246],[246,161],[161,247],[236,3],[3,196],[196,236],[54,68],[68,104],[104,54],[193,168],[168,8],[8,193],[117,228],[228,31],[31,117],[189,193],[193,55],[55,189],[98,97],[97,99],[99,98],[126,47],[47,100],[100,126],[166,79],[79,218],[218,166],[155,154],[154,26],[26,155],[209,49],[49,131],[131,209],[135,136],[136,150],[150,135],[47,126],[126,217],[217,47],[223,52],[52,53],[53,223],[45,51],[51,134],[134,45],[211,170],[170,140],[140,211],[67,69],[69,108],[108,67],[43,106],[106,91],[91,43],[230,119],[119,120],[120,230],[226,130],[130,247],[247,226],[63,53],[53,52],[52,63],[238,20],[20,242],[242,238],[46,70],[70,156],[156,46],[78,62],[62,96],[96,78],[46,53],[53,63],[63,46],[143,34],[34,227],[227,143],[123,117],[117,111],[111,123],[44,125],[125,19],[19,44],[236,134],[134,51],[51,236],[216,206],[206,205],[205,216],[154,153],[153,22],[22,154],[39,37],[37,167],[167,39],[200,201],[201,208],[208,200],[36,142],[142,100],[100,36],[57,212],[212,202],[202,57],[20,60],[60,99],[99,20],[28,158],[158,157],[157,28],[35,226],[226,113],[113,35],[160,159],[159,27],[27,160],[204,202],[202,210],[210,204],[113,225],[225,46],[46,113],[43,202],[202,204],[204,43],[62,76],[76,77],[77,62],[137,123],[123,116],[116,137],[41,38],[38,72],[72,41],[203,129],[129,142],[142,203],[64,98],[98,240],[240,64],[49,102],[102,64],[64,49],[41,73],[73,74],[74,41],[212,216],[216,207],[207,212],[42,74],[74,184],[184,42],[169,170],[170,211],[211,169],[170,149],[149,176],[176,170],[105,66],[66,69],[69,105],[122,6],[6,168],[168,122],[123,147],[147,187],[187,123],[96,77],[77,90],[90,96],[65,55],[55,107],[107,65],[89,90],[90,180],[180,89],[101,100],[100,120],[120,101],[63,105],[105,104],[104,63],[93,137],[137,227],[227,93],[15,86],[86,85],[85,15],[129,102],[102,49],[49,129],[14,87],[87,86],[86,14],[55,8],[8,9],[9,55],[100,47],[47,121],[121,100],[145,23],[23,22],[22,145],[88,89],[89,179],[179,88],[6,122],[122,196],[196,6],[88,95],[95,96],[96,88],[138,172],[172,136],[136,138],[215,58],[58,172],[172,215],[115,48],[48,219],[219,115],[42,80],[80,81],[81,42],[195,3],[3,51],[51,195],[43,146],[146,61],[61,43],[171,175],[175,199],[199,171],[81,82],[82,38],[38,81],[53,46],[46,225],[225,53],[144,163],[163,110],[110,144],[52,65],[65,66],[66,52],[229,228],[228,117],[117,229],[34,127],[127,234],[234,34],[107,108],[108,69],[69,107],[109,108],[108,151],[151,109],[48,64],[64,235],[235,48],[62,78],[78,191],[191,62],[129,209],[209,126],[126,129],[111,35],[35,143],[143,111],[117,123],[123,50],[50,117],[222,65],[65,52],[52,222],[19,125],[125,141],[141,19],[221,55],[55,65],[65,221],[3,195],[195,197],[197,3],[25,7],[7,33],[33,25],[220,237],[237,44],[44,220],[70,71],[71,139],[139,70],[122,193],[193,245],[245,122],[247,130],[130,33],[33,247],[71,21],[21,162],[162,71],[170,169],[169,150],[150,170],[188,174],[174,196],[196,188],[216,186],[186,92],[92,216],[2,97],[97,167],[167,2],[141,125],[125,241],[241,141],[164,167],[167,37],[37,164],[72,38],[38,12],[12,72],[38,82],[82,13],[13,38],[63,68],[68,71],[71,63],[226,35],[35,111],[111,226],[101,50],[50,205],[205,101],[206,92],[92,165],[165,206],[209,198],[198,217],[217,209],[165,167],[167,97],[97,165],[220,115],[115,218],[218,220],[133,112],[112,243],[243,133],[239,238],[238,241],[241,239],[214,135],[135,169],[169,214],[190,173],[173,133],[133,190],[171,208],[208,32],[32,171],[125,44],[44,237],[237,125],[86,87],[87,178],[178,86],[85,86],[86,179],[179,85],[84,85],[85,180],[180,84],[83,84],[84,181],[181,83],[201,83],[83,182],[182,201],[137,93],[93,132],[132,137],[76,62],[62,183],[183,76],[61,76],[76,184],[184,61],[57,61],[61,185],[185,57],[212,57],[57,186],[186,212],[214,207],[207,187],[187,214],[34,143],[143,156],[156,34],[79,239],[239,237],[237,79],[123,137],[137,177],[177,123],[44,1],[1,4],[4,44],[201,194],[194,32],[32,201],[64,102],[102,129],[129,64],[213,215],[215,138],[138,213],[59,166],[166,219],[219,59],[242,99],[99,97],[97,242],[2,94],[94,141],[141,2],[75,59],[59,235],[235,75],[24,110],[110,228],[228,24],[25,130],[130,226],[226,25],[23,24],[24,229],[229,23],[22,23],[23,230],[230,22],[26,22],[22,231],[231,26],[112,26],[26,232],[232,112],[189,190],[190,243],[243,189],[221,56],[56,190],[190,221],[28,56],[56,221],[221,28],[27,28],[28,222],[222,27],[29,27],[27,223],[223,29],[30,29],[29,224],[224,30],[247,30],[30,225],[225,247],[238,79],[79,20],[20,238],[166,59],[59,75],[75,166],[60,75],[75,240],[240,60],[147,177],[177,215],[215,147],[20,79],[79,166],[166,20],[187,147],[147,213],[213,187],[112,233],[233,244],[244,112],[233,128],[128,245],[245,233],[128,114],[114,188],[188,128],[114,217],[217,174],[174,114],[131,115],[115,220],[220,131],[217,198],[198,236],[236,217],[198,131],[131,134],[134,198],[177,132],[132,58],[58,177],[143,35],[35,124],[124,143],[110,163],[163,7],[7,110],[228,110],[110,25],[25,228],[356,389],[389,368],[368,356],[11,302],[302,267],[267,11],[452,350],[350,349],[349,452],[302,303],[303,269],[269,302],[357,343],[343,277],[277,357],[452,453],[453,357],[357,452],[333,332],[332,297],[297,333],[175,152],[152,377],[377,175],[347,348],[348,330],[330,347],[303,304],[304,270],[270,303],[9,336],[336,337],[337,9],[278,279],[279,360],[360,278],[418,262],[262,431],[431,418],[304,408],[408,409],[409,304],[310,415],[415,407],[407,310],[270,409],[409,410],[410,270],[450,348],[348,347],[347,450],[422,430],[430,434],[434,422],[313,314],[314,17],[17,313],[306,307],[307,375],[375,306],[387,388],[388,260],[260,387],[286,414],[414,398],[398,286],[335,406],[406,418],[418,335],[364,367],[367,416],[416,364],[423,358],[358,327],[327,423],[251,284],[284,298],[298,251],[281,5],[5,4],[4,281],[373,374],[374,253],[253,373],[307,320],[320,321],[321,307],[425,427],[427,411],[411,425],[421,313],[313,18],[18,421],[321,405],[405,406],[406,321],[320,404],[404,405],[405,320],[315,16],[16,17],[17,315],[426,425],[425,266],[266,426],[377,400],[400,369],[369,377],[322,391],[391,269],[269,322],[417,465],[465,464],[464,417],[386,257],[257,258],[258,386],[466,260],[260,388],[388,466],[456,399],[399,419],[419,456],[284,332],[332,333],[333,284],[417,285],[285,8],[8,417],[346,340],[340,261],[261,346],[413,441],[441,285],[285,413],[327,460],[460,328],[328,327],[355,371],[371,329],[329,355],[392,439],[439,438],[438,392],[382,341],[341,256],[256,382],[429,420],[420,360],[360,429],[364,394],[394,379],[379,364],[277,343],[343,437],[437,277],[443,444],[444,283],[283,443],[275,440],[440,363],[363,275],[431,262],[262,369],[369,431],[297,338],[338,337],[337,297],[273,375],[375,321],[321,273],[450,451],[451,349],[349,450],[446,342],[342,467],[467,446],[293,334],[334,282],[282,293],[458,461],[461,462],[462,458],[276,353],[353,383],[383,276],[308,324],[324,325],[325,308],[276,300],[300,293],[293,276],[372,345],[345,447],[447,372],[352,345],[345,340],[340,352],[274,1],[1,19],[19,274],[456,248],[248,281],[281,456],[436,427],[427,425],[425,436],[381,256],[256,252],[252,381],[269,391],[391,393],[393,269],[200,199],[199,428],[428,200],[266,330],[330,329],[329,266],[287,273],[273,422],[422,287],[250,462],[462,328],[328,250],[258,286],[286,384],[384,258],[265,353],[353,342],[342,265],[387,259],[259,257],[257,387],[424,431],[431,430],[430,424],[342,353],[353,276],[276,342],[273,335],[335,424],[424,273],[292,325],[325,307],[307,292],[366,447],[447,345],[345,366],[271,303],[303,302],[302,271],[423,266],[266,371],[371,423],[294,455],[455,460],[460,294],[279,278],[278,294],[294,279],[271,272],[272,304],[304,271],[432,434],[434,427],[427,432],[272,407],[407,408],[408,272],[394,430],[430,431],[431,394],[395,369],[369,400],[400,395],[334,333],[333,299],[299,334],[351,417],[417,168],[168,351],[352,280],[280,411],[411,352],[325,319],[319,320],[320,325],[295,296],[296,336],[336,295],[319,403],[403,404],[404,319],[330,348],[348,349],[349,330],[293,298],[298,333],[333,293],[323,454],[454,447],[447,323],[15,16],[16,315],[315,15],[358,429],[429,279],[279,358],[14,15],[15,316],[316,14],[285,336],[336,9],[9,285],[329,349],[349,350],[350,329],[374,380],[380,252],[252,374],[318,402],[402,403],[403,318],[6,197],[197,419],[419,6],[318,319],[319,325],[325,318],[367,364],[364,365],[365,367],[435,367],[367,397],[397,435],[344,438],[438,439],[439,344],[272,271],[271,311],[311,272],[195,5],[5,281],[281,195],[273,287],[287,291],[291,273],[396,428],[428,199],[199,396],[311,271],[271,268],[268,311],[283,444],[444,445],[445,283],[373,254],[254,339],[339,373],[282,334],[334,296],[296,282],[449,347],[347,346],[346,449],[264,447],[447,454],[454,264],[336,296],[296,299],[299,336],[338,10],[10,151],[151,338],[278,439],[439,455],[455,278],[292,407],[407,415],[415,292],[358,371],[371,355],[355,358],[340,345],[345,372],[372,340],[346,347],[347,280],[280,346],[442,443],[443,282],[282,442],[19,94],[94,370],[370,19],[441,442],[442,295],[295,441],[248,419],[419,197],[197,248],[263,255],[255,359],[359,263],[440,275],[275,274],[274,440],[300,383],[383,368],[368,300],[351,412],[412,465],[465,351],[263,467],[467,466],[466,263],[301,368],[368,389],[389,301],[395,378],[378,379],[379,395],[412,351],[351,419],[419,412],[436,426],[426,322],[322,436],[2,164],[164,393],[393,2],[370,462],[462,461],[461,370],[164,0],[0,267],[267,164],[302,11],[11,12],[12,302],[268,12],[12,13],[13,268],[293,300],[300,301],[301,293],[446,261],[261,340],[340,446],[330,266],[266,425],[425,330],[426,423],[423,391],[391,426],[429,355],[355,437],[437,429],[391,327],[327,326],[326,391],[440,457],[457,438],[438,440],[341,382],[382,362],[362,341],[459,457],[457,461],[461,459],[434,430],[430,394],[394,434],[414,463],[463,362],[362,414],[396,369],[369,262],[262,396],[354,461],[461,457],[457,354],[316,403],[403,402],[402,316],[315,404],[404,403],[403,315],[314,405],[405,404],[404,314],[313,406],[406,405],[405,313],[421,418],[418,406],[406,421],[366,401],[401,361],[361,366],[306,408],[408,407],[407,306],[291,409],[409,408],[408,291],[287,410],[410,409],[409,287],[432,436],[436,410],[410,432],[434,416],[416,411],[411,434],[264,368],[368,383],[383,264],[309,438],[438,457],[457,309],[352,376],[376,401],[401,352],[274,275],[275,4],[4,274],[421,428],[428,262],[262,421],[294,327],[327,358],[358,294],[433,416],[416,367],[367,433],[289,455],[455,439],[439,289],[462,370],[370,326],[326,462],[2,326],[326,370],[370,2],[305,460],[460,455],[455,305],[254,449],[449,448],[448,254],[255,261],[261,446],[446,255],[253,450],[450,449],[449,253],[252,451],[451,450],[450,252],[256,452],[452,451],[451,256],[341,453],[453,452],[452,341],[413,464],[464,463],[463,413],[441,413],[413,414],[414,441],[258,442],[442,441],[441,258],[257,443],[443,442],[442,257],[259,444],[444,443],[443,259],[260,445],[445,444],[444,260],[467,342],[342,445],[445,467],[459,458],[458,250],[250,459],[289,392],[392,290],[290,289],[290,328],[328,460],[460,290],[376,433],[433,435],[435,376],[250,290],[290,392],[392,250],[411,416],[416,433],[433,411],[341,463],[463,464],[464,341],[453,464],[464,465],[465,453],[357,465],[465,412],[412,357],[343,412],[412,399],[399,343],[360,363],[363,440],[440,360],[437,399],[399,456],[456,437],[420,456],[456,363],[363,420],[401,435],[435,288],[288,401],[372,383],[383,353],[353,372],[339,255],[255,249],[249,339],[448,261],[261,255],[255,448],[133,243],[243,190],[190,133],[133,155],[155,112],[112,133],[33,246],[246,247],[247,33],[33,130],[130,25],[25,33],[398,384],[384,286],[286,398],[362,398],[398,414],[414,362],[362,463],[463,341],[341,362],[263,359],[359,467],[467,263],[263,249],[249,255],[255,263],[466,467],[467,260],[260,466],[75,60],[60,166],[166,75],[238,239],[239,79],[79,238],[162,127],[127,139],[139,162],[72,11],[11,37],[37,72],[121,232],[232,120],[120,121],[73,72],[72,39],[39,73],[114,128],[128,47],[47,114],[233,232],[232,128],[128,233],[103,104],[104,67],[67,103],[152,175],[175,148],[148,152],[119,118],[118,101],[101,119],[74,73],[73,40],[40,74],[107,9],[9,108],[108,107],[49,48],[48,131],[131,49],[32,194],[194,211],[211,32],[184,74],[74,185],[185,184],[191,80],[80,183],[183,191],[185,40],[40,186],[186,185],[119,230],[230,118],[118,119],[210,202],[202,214],[214,210],[84,83],[83,17],[17,84],[77,76],[76,146],[146,77],[161,160],[160,30],[30,161],[190,56],[56,173],[173,190],[182,106],[106,194],[194,182],[138,135],[135,192],[192,138],[129,203],[203,98],[98,129],[54,21],[21,68],[68,54],[5,51],[51,4],[4,5],[145,144],[144,23],[23,145],[90,77],[77,91],[91,90],[207,205],[205,187],[187,207],[83,201],[201,18],[18,83],[181,91],[91,182],[182,181],[180,90],[90,181],[181,180],[16,85],[85,17],[17,16],[205,206],[206,36],[36,205],[176,148],[148,140],[140,176],[165,92],[92,39],[39,165],[245,193],[193,244],[244,245],[27,159],[159,28],[28,27],[30,247],[247,161],[161,30],[174,236],[236,196],[196,174],[103,54],[54,104],[104,103],[55,193],[193,8],[8,55],[111,117],[117,31],[31,111],[221,189],[189,55],[55,221],[240,98],[98,99],[99,240],[142,126],[126,100],[100,142],[219,166],[166,218],[218,219],[112,155],[155,26],[26,112],[198,209],[209,131],[131,198],[169,135],[135,150],[150,169],[114,47],[47,217],[217,114],[224,223],[223,53],[53,224],[220,45],[45,134],[134,220],[32,211],[211,140],[140,32],[109,67],[67,108],[108,109],[146,43],[43,91],[91,146],[231,230],[230,120],[120,231],[113,226],[226,247],[247,113],[105,63],[63,52],[52,105],[241,238],[238,242],[242,241],[124,46],[46,156],[156,124],[95,78],[78,96],[96,95],[70,46],[46,63],[63,70],[116,143],[143,227],[227,116],[116,123],[123,111],[111,116],[1,44],[44,19],[19,1],[3,236],[236,51],[51,3],[207,216],[216,205],[205,207],[26,154],[154,22],[22,26],[165,39],[39,167],[167,165],[199,200],[200,208],[208,199],[101,36],[36,100],[100,101],[43,57],[57,202],[202,43],[242,20],[20,99],[99,242],[56,28],[28,157],[157,56],[124,35],[35,113],[113,124],[29,160],[160,27],[27,29],[211,204],[204,210],[210,211],[124,113],[113,46],[46,124],[106,43],[43,204],[204,106],[96,62],[62,77],[77,96],[227,137],[137,116],[116,227],[73,41],[41,72],[72,73],[36,203],[203,142],[142,36],[235,64],[64,240],[240,235],[48,49],[49,64],[64,48],[42,41],[41,74],[74,42],[214,212],[212,207],[207,214],[183,42],[42,184],[184,183],[210,169],[169,211],[211,210],[140,170],[170,176],[176,140],[104,105],[105,69],[69,104],[193,122],[122,168],[168,193],[50,123],[123,187],[187,50],[89,96],[96,90],[90,89],[66,65],[65,107],[107,66],[179,89],[89,180],[180,179],[119,101],[101,120],[120,119],[68,63],[63,104],[104,68],[234,93],[93,227],[227,234],[16,15],[15,85],[85,16],[209,129],[129,49],[49,209],[15,14],[14,86],[86,15],[107,55],[55,9],[9,107],[120,100],[100,121],[121,120],[153,145],[145,22],[22,153],[178,88],[88,179],[179,178],[197,6],[6,196],[196,197],[89,88],[88,96],[96,89],[135,138],[138,136],[136,135],[138,215],[215,172],[172,138],[218,115],[115,219],[219,218],[41,42],[42,81],[81,41],[5,195],[195,51],[51,5],[57,43],[43,61],[61,57],[208,171],[171,199],[199,208],[41,81],[81,38],[38,41],[224,53],[53,225],[225,224],[24,144],[144,110],[110,24],[105,52],[52,66],[66,105],[118,229],[229,117],[117,118],[227,34],[34,234],[234,227],[66,107],[107,69],[69,66],[10,109],[109,151],[151,10],[219,48],[48,235],[235,219],[183,62],[62,191],[191,183],[142,129],[129,126],[126,142],[116,111],[111,143],[143,116],[118,117],[117,50],[50,118],[223,222],[222,52],[52,223],[94,19],[19,141],[141,94],[222,221],[221,65],[65,222],[196,3],[3,197],[197,196],[45,220],[220,44],[44,45],[156,70],[70,139],[139,156],[188,122],[122,245],[245,188],[139,71],[71,162],[162,139],[149,170],[170,150],[150,149],[122,188],[188,196],[196,122],[206,216],[216,92],[92,206],[164,2],[2,167],[167,164],[242,141],[141,241],[241,242],[0,164],[164,37],[37,0],[11,72],[72,12],[12,11],[12,38],[38,13],[13,12],[70,63],[63,71],[71,70],[31,226],[226,111],[111,31],[36,101],[101,205],[205,36],[203,206],[206,165],[165,203],[126,209],[209,217],[217,126],[98,165],[165,97],[97,98],[237,220],[220,218],[218,237],[237,239],[239,241],[241,237],[210,214],[214,169],[169,210],[140,171],[171,32],[32,140],[241,125],[125,237],[237,241],[179,86],[86,178],[178,179],[180,85],[85,179],[179,180],[181,84],[84,180],[180,181],[182,83],[83,181],[181,182],[194,201],[201,182],[182,194],[177,137],[137,132],[132,177],[184,76],[76,183],[183,184],[185,61],[61,184],[184,185],[186,57],[57,185],[185,186],[216,212],[212,186],[186,216],[192,214],[214,187],[187,192],[139,34],[34,156],[156,139],[218,79],[79,237],[237,218],[147,123],[123,177],[177,147],[45,44],[44,4],[4,45],[208,201],[201,32],[32,208],[98,64],[64,129],[129,98],[192,213],[213,138],[138,192],[235,59],[59,219],[219,235],[141,242],[242,97],[97,141],[97,2],[2,141],[141,97],[240,75],[75,235],[235,240],[229,24],[24,228],[228,229],[31,25],[25,226],[226,31],[230,23],[23,229],[229,230],[231,22],[22,230],[230,231],[232,26],[26,231],[231,232],[233,112],[112,232],[232,233],[244,189],[189,243],[243,244],[189,221],[221,190],[190,189],[222,28],[28,221],[221,222],[223,27],[27,222],[222,223],[224,29],[29,223],[223,224],[225,30],[30,224],[224,225],[113,247],[247,225],[225,113],[99,60],[60,240],[240,99],[213,147],[147,215],[215,213],[60,20],[20,166],[166,60],[192,187],[187,213],[213,192],[243,112],[112,244],[244,243],[244,233],[233,245],[245,244],[245,128],[128,188],[188,245],[188,114],[114,174],[174,188],[134,131],[131,220],[220,134],[174,217],[217,236],[236,174],[236,198],[198,134],[134,236],[215,177],[177,58],[58,215],[156,143],[143,124],[124,156],[25,110],[110,7],[7,25],[31,228],[228,25],[25,31],[264,356],[356,368],[368,264],[0,11],[11,267],[267,0],[451,452],[452,349],[349,451],[267,302],[302,269],[269,267],[350,357],[357,277],[277,350],[350,452],[452,357],[357,350],[299,333],[333,297],[297,299],[396,175],[175,377],[377,396],[280,347],[347,330],[330,280],[269,303],[303,270],[270,269],[151,9],[9,337],[337,151],[344,278],[278,360],[360,344],[424,418],[418,431],[431,424],[270,304],[304,409],[409,270],[272,310],[310,407],[407,272],[322,270],[270,410],[410,322],[449,450],[450,347],[347,449],[432,422],[422,434],[434,432],[18,313],[313,17],[17,18],[291,306],[306,375],[375,291],[259,387],[387,260],[260,259],[424,335],[335,418],[418,424],[434,364],[364,416],[416,434],[391,423],[423,327],[327,391],[301,251],[251,298],[298,301],[275,281],[281,4],[4,275],[254,373],[373,253],[253,254],[375,307],[307,321],[321,375],[280,425],[425,411],[411,280],[200,421],[421,18],[18,200],[335,321],[321,406],[406,335],[321,320],[320,405],[405,321],[314,315],[315,17],[17,314],[423,426],[426,266],[266,423],[396,377],[377,369],[369,396],[270,322],[322,269],[269,270],[413,417],[417,464],[464,413],[385,386],[386,258],[258,385],[248,456],[456,419],[419,248],[298,284],[284,333],[333,298],[168,417],[417,8],[8,168],[448,346],[346,261],[261,448],[417,413],[413,285],[285,417],[326,327],[327,328],[328,326],[277,355],[355,329],[329,277],[309,392],[392,438],[438,309],[381,382],[382,256],[256,381],[279,429],[429,360],[360,279],[365,364],[364,379],[379,365],[355,277],[277,437],[437,355],[282,443],[443,283],[283,282],[281,275],[275,363],[363,281],[395,431],[431,369],[369,395],[299,297],[297,337],[337,299],[335,273],[273,321],[321,335],[348,450],[450,349],[349,348],[359,446],[446,467],[467,359],[283,293],[293,282],[282,283],[250,458],[458,462],[462,250],[300,276],[276,383],[383,300],[292,308],[308,325],[325,292],[283,276],[276,293],[293,283],[264,372],[372,447],[447,264],[346,352],[352,340],[340,346],[354,274],[274,19],[19,354],[363,456],[456,281],[281,363],[426,436],[436,425],[425,426],[380,381],[381,252],[252,380],[267,269],[269,393],[393,267],[421,200],[200,428],[428,421],[371,266],[266,329],[329,371],[432,287],[287,422],[422,432],[290,250],[250,328],[328,290],[385,258],[258,384],[384,385],[446,265],[265,342],[342,446],[386,387],[387,257],[257,386],[422,424],[424,430],[430,422],[445,342],[342,276],[276,445],[422,273],[273,424],[424,422],[306,292],[292,307],[307,306],[352,366],[366,345],[345,352],[268,271],[271,302],[302,268],[358,423],[423,371],[371,358],[327,294],[294,460],[460,327],[331,279],[279,294],[294,331],[303,271],[271,304],[304,303],[436,432],[432,427],[427,436],[304,272],[272,408],[408,304],[395,394],[394,431],[431,395],[378,395],[395,400],[400,378],[296,334],[334,299],[299,296],[6,351],[351,168],[168,6],[376,352],[352,411],[411,376],[307,325],[325,320],[320,307],[285,295],[295,336],[336,285],[320,319],[319,404],[404,320],[329,330],[330,349],[349,329],[334,293],[293,333],[333,334],[366,323],[323,447],[447,366],[316,15],[15,315],[315,316],[331,358],[358,279],[279,331],[317,14],[14,316],[316,317],[8,285],[285,9],[9,8],[277,329],[329,350],[350,277],[253,374],[374,252],[252,253],[319,318],[318,403],[403,319],[351,6],[6,419],[419,351],[324,318],[318,325],[325,324],[397,367],[367,365],[365,397],[288,435],[435,397],[397,288],[278,344],[344,439],[439,278],[310,272],[272,311],[311,310],[248,195],[195,281],[281,248],[375,273],[273,291],[291,375],[175,396],[396,199],[199,175],[312,311],[311,268],[268,312],[276,283],[283,445],[445,276],[390,373],[373,339],[339,390],[295,282],[282,296],[296,295],[448,449],[449,346],[346,448],[356,264],[264,454],[454,356],[337,336],[336,299],[299,337],[337,338],[338,151],[151,337],[294,278],[278,455],[455,294],[308,292],[292,415],[415,308],[429,358],[358,355],[355,429],[265,340],[340,372],[372,265],[352,346],[346,280],[280,352],[295,442],[442,282],[282,295],[354,19],[19,370],[370,354],[285,441],[441,295],[295,285],[195,248],[248,197],[197,195],[457,440],[440,274],[274,457],[301,300],[300,368],[368,301],[417,351],[351,465],[465,417],[251,301],[301,389],[389,251],[394,395],[395,379],[379,394],[399,412],[412,419],[419,399],[410,436],[436,322],[322,410],[326,2],[2,393],[393,326],[354,370],[370,461],[461,354],[393,164],[164,267],[267,393],[268,302],[302,12],[12,268],[312,268],[268,13],[13,312],[298,293],[293,301],[301,298],[265,446],[446,340],[340,265],[280,330],[330,425],[425,280],[322,426],[426,391],[391,322],[420,429],[429,437],[437,420],[393,391],[391,326],[326,393],[344,440],[440,438],[438,344],[458,459],[459,461],[461,458],[364,434],[434,394],[394,364],[428,396],[396,262],[262,428],[274,354],[354,457],[457,274],[317,316],[316,402],[402,317],[316,315],[315,403],[403,316],[315,314],[314,404],[404,315],[314,313],[313,405],[405,314],[313,421],[421,406],[406,313],[323,366],[366,361],[361,323],[292,306],[306,407],[407,292],[306,291],[291,408],[408,306],[291,287],[287,409],[409,291],[287,432],[432,410],[410,287],[427,434],[434,411],[411,427],[372,264],[264,383],[383,372],[459,309],[309,457],[457,459],[366,352],[352,401],[401,366],[1,274],[274,4],[4,1],[418,421],[421,262],[262,418],[331,294],[294,358],[358,331],[435,433],[433,367],[367,435],[392,289],[289,439],[439,392],[328,462],[462,326],[326,328],[94,2],[2,370],[370,94],[289,305],[305,455],[455,289],[339,254],[254,448],[448,339],[359,255],[255,446],[446,359],[254,253],[253,449],[449,254],[253,252],[252,450],[450,253],[252,256],[256,451],[451,252],[256,341],[341,452],[452,256],[414,413],[413,463],[463,414],[286,441],[441,414],[414,286],[286,258],[258,441],[441,286],[258,257],[257,442],[442,258],[257,259],[259,443],[443,257],[259,260],[260,444],[444,259],[260,467],[467,445],[445,260],[309,459],[459,250],[250,309],[305,289],[289,290],[290,305],[305,290],[290,460],[460,305],[401,376],[376,435],[435,401],[309,250],[250,392],[392,309],[376,411],[411,433],[433,376],[453,341],[341,464],[464,453],[357,453],[453,465],[465,357],[343,357],[357,412],[412,343],[437,343],[343,399],[399,437],[344,360],[360,440],[440,344],[420,437],[437,456],[456,420],[360,420],[420,363],[363,360],[361,401],[401,288],[288,361],[265,372],[372,353],[353,265],[390,339],[339,249],[249,390],[339,448],[448,255],[255,339]);function c2(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var W=class extends Pe{constructor(e,t){super(new Ge(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,w(e=this.h=new ma,0,1,t=new z),this.A=new ga,w(this.h,0,3,this.A),this.u=new mn,w(this.h,0,2,this.u),ot(this.u,4,1),_(this.u,2,.5),_(this.A,2,.5),_(this.h,4,.5)}get baseOptions(){return L(this.h,z,1)}set baseOptions(e){w(this.h,0,1,e)}o(e){return"numFaces"in e&&ot(this.u,4,e.numFaces??1),"minFaceDetectionConfidence"in e&&_(this.u,2,e.minFaceDetectionConfidence??.5),"minTrackingConfidence"in e&&_(this.h,4,e.minTrackingConfidence??.5),"minFacePresenceConfidence"in e&&_(this.A,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.l(e)}F(e,t){return c2(this),We(this,e,t),this.j}G(e,t,r){return c2(this),et(this,e,r,t),this.j}m(){var e=new Le;G(e,"image_in"),G(e,"norm_rect"),P(e,"face_landmarks");const t=new xe;$e(t,cc,this.h);const r=new ye;Se(r,2,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),N(r,"IMAGE:image_in"),N(r,"NORM_RECT:norm_rect"),S(r,"NORM_LANDMARKS:face_landmarks"),r.o(t),Ie(e,r),this.g.attachProtoVectorListener("face_landmarks",(n,s)=>{for(const i of n)n=Mr(i),this.j.faceLandmarks.push(yn(n));g(this,s)}),this.g.attachEmptyPacketListener("face_landmarks",n=>{g(this,n)}),this.outputFaceBlendshapes&&(P(e,"blendshapes"),S(r,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",(n,s)=>{if(this.outputFaceBlendshapes)for(const i of n)n=dn(i),this.j.faceBlendshapes.push(Ds(n.g()??[]));g(this,s)}),this.g.attachEmptyPacketListener("blendshapes",n=>{g(this,n)})),this.outputFacialTransformationMatrixes&&(P(e,"face_geometry"),S(r,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",(n,s)=>{if(this.outputFacialTransformationMatrixes)for(const i of n)(n=L(n=ac(i),Z1,2))&&this.j.facialTransformationMatrixes.push({rows:Me(n,1)??0??0,columns:Me(n,2)??0??0,data:xt(n,3,qe,Tt()).slice()??[]});g(this,s)}),this.g.attachEmptyPacketListener("face_geometry",n=>{g(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};W.prototype.detectForVideo=W.prototype.G,W.prototype.detect=W.prototype.F,W.prototype.setOptions=W.prototype.o,W.createFromModelPath=function(e,t){return x(W,e,{baseOptions:{modelAssetPath:t}})},W.createFromModelBuffer=function(e,t){return x(W,e,{baseOptions:{modelAssetBuffer:t}})},W.createFromOptions=function(e,t){return x(W,e,t)},W.FACE_LANDMARKS_LIPS=zs,W.FACE_LANDMARKS_LEFT_EYE=Ks,W.FACE_LANDMARKS_LEFT_EYEBROW=Ys,W.FACE_LANDMARKS_LEFT_IRIS=s2,W.FACE_LANDMARKS_RIGHT_EYE=Xs,W.FACE_LANDMARKS_RIGHT_EYEBROW=qs,W.FACE_LANDMARKS_RIGHT_IRIS=i2,W.FACE_LANDMARKS_FACE_OVAL=Js,W.FACE_LANDMARKS_CONTOURS=o2,W.FACE_LANDMARKS_TESSELATION=a2;var $s=Ve([0,1],[1,2],[2,3],[3,4],[0,5],[5,6],[6,7],[7,8],[5,9],[9,10],[10,11],[11,12],[9,13],[13,14],[14,15],[15,16],[13,17],[0,17],[17,18],[18,19],[19,20]);function u2(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function l2(e){return e.gestures.length===0?{gestures:[],landmarks:[],worldLandmarks:[],handedness:[],handednesses:[]}:{gestures:e.gestures,landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handedness:e.handedness,handednesses:e.handedness}}function h2(e,t=!0){const r=[];for(const s of e){var n=dn(s);e=[];for(const i of n.g())n=t&&Me(i,1)!=null?Me(i,1)??0:-1,e.push({score:Y(i,2)??0,index:n,categoryName:de(j(i,3))??""??"",displayName:de(j(i,4))??""??""});r.push(e)}return r}var Oe=class extends Pe{constructor(e,t){super(new Ge(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],w(e=this.j=new _a,0,1,t=new z),this.u=new Os,w(this.j,0,2,this.u),this.D=new Ps,w(this.u,0,3,this.D),this.A=new va,w(this.u,0,2,this.A),this.h=new uc,w(this.j,0,3,this.h),_(this.A,2,.5),_(this.u,4,.5),_(this.D,2,.5)}get baseOptions(){return L(this.j,z,1)}set baseOptions(e){w(this.j,0,1,e)}o(e){var s,i,o,c;if(ot(this.A,3,e.numHands??1),"minHandDetectionConfidence"in e&&_(this.A,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&_(this.u,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&_(this.D,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new cr,r=t,n=Ns(e.cannedGesturesClassifierOptions,(s=L(this.h,cr,3))==null?void 0:s.l());w(r,0,2,n),w(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&((i=L(this.h,cr,3))==null||i.g());return e.customGesturesClassifierOptions?(w(r=t=new cr,0,2,n=Ns(e.customGesturesClassifierOptions,(o=L(this.h,cr,4))==null?void 0:o.l())),w(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&((c=L(this.h,cr,4))==null||c.g()),this.l(e)}Ha(e,t){return u2(this),We(this,e,t),l2(this)}Ia(e,t,r){return u2(this),et(this,e,r,t),l2(this)}m(){var e=new Le;G(e,"image_in"),G(e,"norm_rect"),P(e,"hand_gestures"),P(e,"hand_landmarks"),P(e,"world_hand_landmarks"),P(e,"handedness");const t=new xe;$e(t,lc,this.j);const r=new ye;Se(r,2,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),N(r,"IMAGE:image_in"),N(r,"NORM_RECT:norm_rect"),S(r,"HAND_GESTURES:hand_gestures"),S(r,"LANDMARKS:hand_landmarks"),S(r,"WORLD_LANDMARKS:world_hand_landmarks"),S(r,"HANDEDNESS:handedness"),r.o(t),Ie(e,r),this.g.attachProtoVectorListener("hand_landmarks",(n,s)=>{for(const i of n){n=Mr(i);const o=[];for(const c of it(n,aa,1))o.push({x:Y(c,1)??0,y:Y(c,2)??0,z:Y(c,3)??0,visibility:Y(c,4)??0});this.landmarks.push(o)}g(this,s)}),this.g.attachEmptyPacketListener("hand_landmarks",n=>{g(this,n)}),this.g.attachProtoVectorListener("world_hand_landmarks",(n,s)=>{for(const i of n){n=ar(i);const o=[];for(const c of it(n,oa,1))o.push({x:Y(c,1)??0,y:Y(c,2)??0,z:Y(c,3)??0,visibility:Y(c,4)??0});this.worldLandmarks.push(o)}g(this,s)}),this.g.attachEmptyPacketListener("world_hand_landmarks",n=>{g(this,n)}),this.g.attachProtoVectorListener("hand_gestures",(n,s)=>{this.gestures.push(...h2(n,!1)),g(this,s)}),this.g.attachEmptyPacketListener("hand_gestures",n=>{g(this,n)}),this.g.attachProtoVectorListener("handedness",(n,s)=>{this.handedness.push(...h2(n)),g(this,s)}),this.g.attachEmptyPacketListener("handedness",n=>{g(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function f2(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}Oe.prototype.recognizeForVideo=Oe.prototype.Ia,Oe.prototype.recognize=Oe.prototype.Ha,Oe.prototype.setOptions=Oe.prototype.o,Oe.createFromModelPath=function(e,t){return x(Oe,e,{baseOptions:{modelAssetPath:t}})},Oe.createFromModelBuffer=function(e,t){return x(Oe,e,{baseOptions:{modelAssetBuffer:t}})},Oe.createFromOptions=function(e,t){return x(Oe,e,t)},Oe.HAND_CONNECTIONS=$s;var ve=class extends Pe{constructor(e,t){super(new Ge(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],w(e=this.h=new Os,0,1,t=new z),this.u=new Ps,w(this.h,0,3,this.u),this.j=new va,w(this.h,0,2,this.j),ot(this.j,3,1),_(this.j,2,.5),_(this.u,2,.5),_(this.h,4,.5)}get baseOptions(){return L(this.h,z,1)}set baseOptions(e){w(this.h,0,1,e)}o(e){return"numHands"in e&&ot(this.j,3,e.numHands??1),"minHandDetectionConfidence"in e&&_(this.j,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&_(this.h,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&_(this.u,2,e.minHandPresenceConfidence??.5),this.l(e)}F(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],We(this,e,t),f2(this)}G(e,t,r){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],et(this,e,r,t),f2(this)}m(){var e=new Le;G(e,"image_in"),G(e,"norm_rect"),P(e,"hand_landmarks"),P(e,"world_hand_landmarks"),P(e,"handedness");const t=new xe;$e(t,hc,this.h);const r=new ye;Se(r,2,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),N(r,"IMAGE:image_in"),N(r,"NORM_RECT:norm_rect"),S(r,"LANDMARKS:hand_landmarks"),S(r,"WORLD_LANDMARKS:world_hand_landmarks"),S(r,"HANDEDNESS:handedness"),r.o(t),Ie(e,r),this.g.attachProtoVectorListener("hand_landmarks",(n,s)=>{for(const i of n)n=Mr(i),this.landmarks.push(yn(n));g(this,s)}),this.g.attachEmptyPacketListener("hand_landmarks",n=>{g(this,n)}),this.g.attachProtoVectorListener("world_hand_landmarks",(n,s)=>{for(const i of n)n=ar(i),this.worldLandmarks.push(Cr(n));g(this,s)}),this.g.attachEmptyPacketListener("world_hand_landmarks",n=>{g(this,n)}),this.g.attachProtoVectorListener("handedness",(n,s)=>{var i=this.handedness,o=i.push;const c=[];for(const u of n){n=dn(u);const f=[];for(const l of n.g())f.push({score:Y(l,2)??0,index:Me(l,1)??0??-1,categoryName:de(j(l,3))??""??"",displayName:de(j(l,4))??""??""});c.push(f)}o.call(i,...c),g(this,s)}),this.g.attachEmptyPacketListener("handedness",n=>{g(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ve.prototype.detectForVideo=ve.prototype.G,ve.prototype.detect=ve.prototype.F,ve.prototype.setOptions=ve.prototype.o,ve.createFromModelPath=function(e,t){return x(ve,e,{baseOptions:{modelAssetPath:t}})},ve.createFromModelBuffer=function(e,t){return x(ve,e,{baseOptions:{modelAssetBuffer:t}})},ve.createFromOptions=function(e,t){return x(ve,e,t)},ve.HAND_CONNECTIONS=$s;var d2=Ve([0,1],[1,2],[2,3],[3,7],[0,4],[4,5],[5,6],[6,8],[9,10],[11,12],[11,13],[13,15],[15,17],[15,19],[15,21],[17,19],[12,14],[14,16],[16,18],[16,20],[16,22],[18,20],[11,23],[12,24],[23,24],[23,25],[24,26],[25,27],[26,28],[27,29],[28,30],[29,31],[30,32],[27,31],[28,32]);function p2(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function g2(e){try{if(!e.D)return e.h;e.D(e.h)}finally{bn(e)}}function En(e,t){e=Mr(e),t.push(yn(e))}var D=class extends Pe{constructor(e,t){super(new Ge(e,t),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,w(e=this.j=new Sa,0,1,t=new z),this.I=new Ps,w(this.j,0,2,this.I),this.W=new fc,w(this.j,0,3,this.W),this.u=new mn,w(this.j,0,4,this.u),this.O=new ga,w(this.j,0,5,this.O),this.A=new Aa,w(this.j,0,6,this.A),this.M=new ka,w(this.j,0,7,this.M),_(this.u,2,.5),_(this.u,3,.3),_(this.O,2,.5),_(this.A,2,.5),_(this.A,3,.3),_(this.M,2,.5),_(this.I,2,.5)}get baseOptions(){return L(this.j,z,1)}set baseOptions(e){w(this.j,0,1,e)}o(e){return"minFaceDetectionConfidence"in e&&_(this.u,2,e.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in e&&_(this.u,3,e.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in e&&_(this.O,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"minPoseDetectionConfidence"in e&&_(this.A,2,e.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in e&&_(this.A,3,e.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in e&&_(this.M,2,e.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in e&&_(this.I,2,e.minHandLandmarksConfidence??.5),this.l(e)}F(e,t,r){const n=typeof t!="function"?t:{};return this.D=typeof t=="function"?t:r,p2(this),We(this,e,n),g2(this)}G(e,t,r,n){const s=typeof r!="function"?r:{};return this.D=typeof r=="function"?r:n,p2(this),et(this,e,s,t),g2(this)}m(){var e=new Le;G(e,"input_frames_image"),P(e,"pose_landmarks"),P(e,"pose_world_landmarks"),P(e,"face_landmarks"),P(e,"left_hand_landmarks"),P(e,"left_hand_world_landmarks"),P(e,"right_hand_landmarks"),P(e,"right_hand_world_landmarks");const t=new xe,r=new Go;Se(r,1,"type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),function(s,i){if(i!=null)if(Array.isArray(i))F(s,2,qr(i,0,Lr));else{if(!(typeof i=="string"||i instanceof Ye||In(i)))throw Error("invalid value in Any.value field: "+i+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");lt(s,2,Bn(i,!1),bt())}}(r,this.j.g());const n=new ye;Se(n,2,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),os(n,8,Go,r),N(n,"IMAGE:input_frames_image"),S(n,"POSE_LANDMARKS:pose_landmarks"),S(n,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),S(n,"FACE_LANDMARKS:face_landmarks"),S(n,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),S(n,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),S(n,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),S(n,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),n.o(t),Ie(e,n),_n(this,e),this.g.attachProtoListener("pose_landmarks",(s,i)=>{En(s,this.h.poseLandmarks),g(this,i)}),this.g.attachEmptyPacketListener("pose_landmarks",s=>{g(this,s)}),this.g.attachProtoListener("pose_world_landmarks",(s,i)=>{var o=this.h.poseWorldLandmarks;s=ar(s),o.push(Cr(s)),g(this,i)}),this.g.attachEmptyPacketListener("pose_world_landmarks",s=>{g(this,s)}),this.outputPoseSegmentationMasks&&(S(n,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),ur(this,"pose_segmentation_mask"),this.g.Z("pose_segmentation_mask",(s,i)=>{this.h.poseSegmentationMasks=[hr(this,s,!0,!this.D)],g(this,i)}),this.g.attachEmptyPacketListener("pose_segmentation_mask",s=>{this.h.poseSegmentationMasks=[],g(this,s)})),this.g.attachProtoListener("face_landmarks",(s,i)=>{En(s,this.h.faceLandmarks),g(this,i)}),this.g.attachEmptyPacketListener("face_landmarks",s=>{g(this,s)}),this.outputFaceBlendshapes&&(P(e,"extra_blendshapes"),S(n,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",(s,i)=>{var o=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(s=dn(s),o.push(Ds(s.g()??[]))),g(this,i)}),this.g.attachEmptyPacketListener("extra_blendshapes",s=>{g(this,s)})),this.g.attachProtoListener("left_hand_landmarks",(s,i)=>{En(s,this.h.leftHandLandmarks),g(this,i)}),this.g.attachEmptyPacketListener("left_hand_landmarks",s=>{g(this,s)}),this.g.attachProtoListener("left_hand_world_landmarks",(s,i)=>{var o=this.h.leftHandWorldLandmarks;s=ar(s),o.push(Cr(s)),g(this,i)}),this.g.attachEmptyPacketListener("left_hand_world_landmarks",s=>{g(this,s)}),this.g.attachProtoListener("right_hand_landmarks",(s,i)=>{En(s,this.h.rightHandLandmarks),g(this,i)}),this.g.attachEmptyPacketListener("right_hand_landmarks",s=>{g(this,s)}),this.g.attachProtoListener("right_hand_world_landmarks",(s,i)=>{var o=this.h.rightHandWorldLandmarks;s=ar(s),o.push(Cr(s)),g(this,i)}),this.g.attachEmptyPacketListener("right_hand_world_landmarks",s=>{g(this,s)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};D.prototype.detectForVideo=D.prototype.G,D.prototype.detect=D.prototype.F,D.prototype.setOptions=D.prototype.o,D.createFromModelPath=function(e,t){return x(D,e,{baseOptions:{modelAssetPath:t}})},D.createFromModelBuffer=function(e,t){return x(D,e,{baseOptions:{modelAssetBuffer:t}})},D.createFromOptions=function(e,t){return x(D,e,t)},D.HAND_CONNECTIONS=$s,D.POSE_CONNECTIONS=d2,D.FACE_LANDMARKS_LIPS=zs,D.FACE_LANDMARKS_LEFT_EYE=Ks,D.FACE_LANDMARKS_LEFT_EYEBROW=Ys,D.FACE_LANDMARKS_LEFT_IRIS=s2,D.FACE_LANDMARKS_RIGHT_EYE=Xs,D.FACE_LANDMARKS_RIGHT_EYEBROW=qs,D.FACE_LANDMARKS_RIGHT_IRIS=i2,D.FACE_LANDMARKS_FACE_OVAL=Js,D.FACE_LANDMARKS_CONTOURS=o2,D.FACE_LANDMARKS_TESSELATION=a2;var Ne=class extends Pe{constructor(e,t){super(new Ge(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},w(e=this.h=new Ta,0,1,t=new z)}get baseOptions(){return L(this.h,z,1)}set baseOptions(e){w(this.h,0,1,e)}o(e){return w(this.h,0,2,Ns(e,L(this.h,Ts,2))),this.l(e)}sa(e,t){return this.j={classifications:[]},We(this,e,t),this.j}ta(e,t,r){return this.j={classifications:[]},et(this,e,r,t),this.j}m(){var e=new Le;G(e,"input_image"),G(e,"norm_rect"),P(e,"classifications");const t=new xe;$e(t,dc,this.h);const r=new ye;Se(r,2,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),N(r,"IMAGE:input_image"),N(r,"NORM_RECT:norm_rect"),S(r,"CLASSIFICATIONS:classifications"),r.o(t),Ie(e,r),this.g.attachProtoListener("classifications",(n,s)=>{this.j=_c(tc(n)),g(this,s)}),this.g.attachEmptyPacketListener("classifications",n=>{g(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ne.prototype.classifyForVideo=Ne.prototype.ta,Ne.prototype.classify=Ne.prototype.sa,Ne.prototype.setOptions=Ne.prototype.o,Ne.createFromModelPath=function(e,t){return x(Ne,e,{baseOptions:{modelAssetPath:t}})},Ne.createFromModelBuffer=function(e,t){return x(Ne,e,{baseOptions:{modelAssetBuffer:t}})},Ne.createFromOptions=function(e,t){return x(Ne,e,t)};var Fe=class extends Pe{constructor(e,t){super(new Ge(e,t),"image_in","norm_rect",!0),this.h=new xa,this.embeddings={embeddings:[]},w(e=this.h,0,1,t=new z)}get baseOptions(){return L(this.h,z,1)}set baseOptions(e){w(this.h,0,1,e)}o(e){var t=this.h,r=L(this.h,fa,2);return r=r?r.clone():new fa,e.l2Normalize!==void 0?F(r,1,Sr(e.l2Normalize)):"l2Normalize"in e&&F(r,1),e.quantize!==void 0?F(r,2,Sr(e.quantize)):"quantize"in e&&F(r,2),w(t,0,2,r),this.l(e)}za(e,t){return We(this,e,t),this.embeddings}Aa(e,t,r){return et(this,e,r,t),this.embeddings}m(){var e=new Le;G(e,"image_in"),G(e,"norm_rect"),P(e,"embeddings_out");const t=new xe;$e(t,pc,this.h);const r=new ye;Se(r,2,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),N(r,"IMAGE:image_in"),N(r,"NORM_RECT:norm_rect"),S(r,"EMBEDDINGS:embeddings_out"),r.o(t),Ie(e,r),this.g.attachProtoListener("embeddings_out",(n,s)=>{n=sc(n),this.embeddings=function(i){return{embeddings:it(i,nc,1).map(o=>{var f,l;const c={headIndex:Me(o,3)??0??-1,headName:de(j(o,4))??""??""};var u=o.v;return io(u,0|u[m],ua,rs(o,1))!==void 0?(o=xt(o=L(o,ua,rs(o,1),void 0),1,qe,Tt()),c.floatEmbedding=o.slice()):(u=new Uint8Array(0),c.quantizedEmbedding=((l=(f=L(o,rc,rs(o,2),void 0))==null?void 0:f.na())==null?void 0:l.h())??u),c}),timestampMs:ja(co(i))}}(n),g(this,s)}),this.g.attachEmptyPacketListener("embeddings_out",n=>{g(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Fe.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=Ba(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=Ba(Da(e.quantizedEmbedding),Da(t.quantizedEmbedding))}return e},Fe.prototype.embedForVideo=Fe.prototype.Aa,Fe.prototype.embed=Fe.prototype.za,Fe.prototype.setOptions=Fe.prototype.o,Fe.createFromModelPath=function(e,t){return x(Fe,e,{baseOptions:{modelAssetPath:t}})},Fe.createFromModelBuffer=function(e,t){return x(Fe,e,{baseOptions:{modelAssetBuffer:t}})},Fe.createFromOptions=function(e,t){return x(Fe,e,t)};var Zs=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){var e,t;(e=this.confidenceMasks)==null||e.forEach(r=>{r.close()}),(t=this.categoryMask)==null||t.close()}};function Tc(e){var r,n;const t=function(s){return it(s,ye,1)}(e.ca()).filter(s=>(de(j(s,1))??"").includes("mediapipe.tasks.TensorsToSegmentationCalculator"));if(e.u=[],t.length>1)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");t.length===1&&(((n=(r=L(t[0],xe,7))==null?void 0:r.j())==null?void 0:n.g())??new Map).forEach((s,i)=>{e.u[Number(i)]=de(j(s,1))??""})}function m2(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function y2(e){try{const t=new Zs(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{bn(e)}}Zs.prototype.close=Zs.prototype.close;var _e=class extends Pe{constructor(e,t){super(new Ge(e,t),"image_in","norm_rect",!1),this.u=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Cs,this.A=new La,w(this.h,0,3,this.A),w(e=this.h,0,1,t=new z)}get baseOptions(){return L(this.h,z,1)}set baseOptions(e){w(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?F(this.h,2,xr(e.displayNamesLocale)):"displayNamesLocale"in e&&F(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}L(){Tc(this)}segment(e,t,r){const n=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:r,m2(this),We(this,e,n),y2(this)}La(e,t,r,n){const s=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:n,m2(this),et(this,e,s,t),y2(this)}Da(){return this.u}m(){var e=new Le;G(e,"image_in"),G(e,"norm_rect");const t=new xe;$e(t,Fa,this.h);const r=new ye;Se(r,2,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),N(r,"IMAGE:image_in"),N(r,"NORM_RECT:norm_rect"),r.o(t),Ie(e,r),_n(this,e),this.outputConfidenceMasks&&(P(e,"confidence_masks"),S(r,"CONFIDENCE_MASKS:confidence_masks"),ur(this,"confidence_masks"),this.g.aa("confidence_masks",(n,s)=>{this.confidenceMasks=n.map(i=>hr(this,i,!0,!this.j)),g(this,s)}),this.g.attachEmptyPacketListener("confidence_masks",n=>{this.confidenceMasks=[],g(this,n)})),this.outputCategoryMask&&(P(e,"category_mask"),S(r,"CATEGORY_MASK:category_mask"),ur(this,"category_mask"),this.g.Z("category_mask",(n,s)=>{this.categoryMask=hr(this,n,!1,!this.j),g(this,s)}),this.g.attachEmptyPacketListener("category_mask",n=>{this.categoryMask=void 0,g(this,n)})),P(e,"quality_scores"),S(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(n,s)=>{this.qualityScores=n,g(this,s)}),this.g.attachEmptyPacketListener("quality_scores",n=>{this.categoryMask=void 0,g(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};_e.prototype.getLabels=_e.prototype.Da,_e.prototype.segmentForVideo=_e.prototype.La,_e.prototype.segment=_e.prototype.segment,_e.prototype.setOptions=_e.prototype.o,_e.createFromModelPath=function(e,t){return x(_e,e,{baseOptions:{modelAssetPath:t}})},_e.createFromModelBuffer=function(e,t){return x(_e,e,{baseOptions:{modelAssetBuffer:t}})},_e.createFromOptions=function(e,t){return x(_e,e,t)};var Qs=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){var e,t;(e=this.confidenceMasks)==null||e.forEach(r=>{r.close()}),(t=this.categoryMask)==null||t.close()}};Qs.prototype.close=Qs.prototype.close;var tt=class extends Pe{constructor(e,t){super(new Ge(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Cs,this.u=new La,w(this.h,0,3,this.u),w(e=this.h,0,1,t=new z)}get baseOptions(){return L(this.h,z,1)}set baseOptions(e){w(this.h,0,1,e)}o(e){return"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}segment(e,t,r,n){const s=typeof r!="function"?r:{};if(this.j=typeof r=="function"?r:n,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,r=this.C+1,n=new Ma,t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var i=new Is;lt(i,3,Sr(!0),!1),lt(i,1,kr(t.keypoint.x),0),lt(i,2,kr(t.keypoint.y),0),Pr(n,1,js,i)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");{const c=new mc;for(i of t.scribble)lt(t=new Is,3,Sr(!0),!1),lt(t,1,kr(i.x),0),lt(t,2,kr(i.y),0),os(c,1,Is,t);Pr(n,2,js,c)}}this.g.addProtoToStream(n.g(),"mediapipe.tasks.vision.interactive_segmenter.proto.RegionOfInterest","roi_in",r),We(this,e,s);e:{try{const c=new Qs(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var o=c;break e}this.j(c)}finally{bn(this)}o=void 0}return o}m(){var e=new Le;G(e,"image_in"),G(e,"roi_in"),G(e,"norm_rect_in");const t=new xe;$e(t,Fa,this.h);const r=new ye;Se(r,2,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraphV2"),N(r,"IMAGE:image_in"),N(r,"ROI:roi_in"),N(r,"NORM_RECT:norm_rect_in"),r.o(t),Ie(e,r),_n(this,e),this.outputConfidenceMasks&&(P(e,"confidence_masks"),S(r,"CONFIDENCE_MASKS:confidence_masks"),ur(this,"confidence_masks"),this.g.aa("confidence_masks",(n,s)=>{this.confidenceMasks=n.map(i=>hr(this,i,!0,!this.j)),g(this,s)}),this.g.attachEmptyPacketListener("confidence_masks",n=>{this.confidenceMasks=[],g(this,n)})),this.outputCategoryMask&&(P(e,"category_mask"),S(r,"CATEGORY_MASK:category_mask"),ur(this,"category_mask"),this.g.Z("category_mask",(n,s)=>{this.categoryMask=hr(this,n,!1,!this.j),g(this,s)}),this.g.attachEmptyPacketListener("category_mask",n=>{this.categoryMask=void 0,g(this,n)})),P(e,"quality_scores"),S(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(n,s)=>{this.qualityScores=n,g(this,s)}),this.g.attachEmptyPacketListener("quality_scores",n=>{this.categoryMask=void 0,g(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};tt.prototype.segment=tt.prototype.segment,tt.prototype.setOptions=tt.prototype.o,tt.createFromModelPath=function(e,t){return x(tt,e,{baseOptions:{modelAssetPath:t}})},tt.createFromModelBuffer=function(e,t){return x(tt,e,{baseOptions:{modelAssetBuffer:t}})},tt.createFromOptions=function(e,t){return x(tt,e,t)};var De=class extends Pe{constructor(e,t){super(new Ge(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},w(e=this.h=new Ca,0,1,t=new z)}get baseOptions(){return L(this.h,z,1)}set baseOptions(e){w(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?F(this.h,2,xr(e.displayNamesLocale)):"displayNamesLocale"in e&&F(this.h,2),e.maxResults!==void 0?ot(this.h,3,e.maxResults):"maxResults"in e&&F(this.h,3),e.scoreThreshold!==void 0?_(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&F(this.h,4),e.categoryAllowlist!==void 0?Jr(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&F(this.h,5),e.categoryDenylist!==void 0?Jr(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&F(this.h,6),this.l(e)}F(e,t){return this.j={detections:[]},We(this,e,t),this.j}G(e,t,r){return this.j={detections:[]},et(this,e,r,t),this.j}m(){var e=new Le;G(e,"input_frame_gpu"),G(e,"norm_rect"),P(e,"detections");const t=new xe;$e(t,yc,this.h);const r=new ye;Se(r,2,"mediapipe.tasks.vision.ObjectDetectorGraph"),N(r,"IMAGE:input_frame_gpu"),N(r,"NORM_RECT:norm_rect"),S(r,"DETECTIONS:detections"),r.o(t),Ie(e,r),this.g.attachProtoVectorListener("detections",(n,s)=>{for(const i of n)n=ia(i),this.j.detections.push(Na(n));g(this,s)}),this.g.attachEmptyPacketListener("detections",n=>{g(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};De.prototype.detectForVideo=De.prototype.G,De.prototype.detect=De.prototype.F,De.prototype.setOptions=De.prototype.o,De.createFromModelPath=async function(e,t){return x(De,e,{baseOptions:{modelAssetPath:t}})},De.createFromModelBuffer=function(e,t){return x(De,e,{baseOptions:{modelAssetBuffer:t}})},De.createFromOptions=function(e,t){return x(De,e,t)};var ei=class{constructor(e,t,r){this.landmarks=e,this.worldLandmarks=t,this.segmentationMasks=r}close(){var e;(e=this.segmentationMasks)==null||e.forEach(t=>{t.close()})}};function v2(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function _2(e){try{const t=new ei(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.u)return t;e.u(t)}finally{bn(e)}}ei.prototype.close=ei.prototype.close;var Re=class extends Pe{constructor(e,t){super(new Ge(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,w(e=this.h=new Ia,0,1,t=new z),this.A=new ka,w(this.h,0,3,this.A),this.j=new Aa,w(this.h,0,2,this.j),ot(this.j,4,1),_(this.j,2,.5),_(this.A,2,.5),_(this.h,4,.5)}get baseOptions(){return L(this.h,z,1)}set baseOptions(e){w(this.h,0,1,e)}o(e){return"numPoses"in e&&ot(this.j,4,e.numPoses??1),"minPoseDetectionConfidence"in e&&_(this.j,2,e.minPoseDetectionConfidence??.5),"minTrackingConfidence"in e&&_(this.h,4,e.minTrackingConfidence??.5),"minPosePresenceConfidence"in e&&_(this.A,2,e.minPosePresenceConfidence??.5),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}F(e,t,r){const n=typeof t!="function"?t:{};return this.u=typeof t=="function"?t:r,v2(this),We(this,e,n),_2(this)}G(e,t,r,n){const s=typeof r!="function"?r:{};return this.u=typeof r=="function"?r:n,v2(this),et(this,e,s,t),_2(this)}m(){var e=new Le;G(e,"image_in"),G(e,"norm_rect"),P(e,"normalized_landmarks"),P(e,"world_landmarks"),P(e,"segmentation_masks");const t=new xe;$e(t,vc,this.h);const r=new ye;Se(r,2,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),N(r,"IMAGE:image_in"),N(r,"NORM_RECT:norm_rect"),S(r,"NORM_LANDMARKS:normalized_landmarks"),S(r,"WORLD_LANDMARKS:world_landmarks"),r.o(t),Ie(e,r),_n(this,e),this.g.attachProtoVectorListener("normalized_landmarks",(n,s)=>{this.landmarks=[];for(const i of n)n=Mr(i),this.landmarks.push(yn(n));g(this,s)}),this.g.attachEmptyPacketListener("normalized_landmarks",n=>{this.landmarks=[],g(this,n)}),this.g.attachProtoVectorListener("world_landmarks",(n,s)=>{this.worldLandmarks=[];for(const i of n)n=ar(i),this.worldLandmarks.push(Cr(n));g(this,s)}),this.g.attachEmptyPacketListener("world_landmarks",n=>{this.worldLandmarks=[],g(this,n)}),this.outputSegmentationMasks&&(S(r,"SEGMENTATION_MASK:segmentation_masks"),ur(this,"segmentation_masks"),this.g.aa("segmentation_masks",(n,s)=>{this.segmentationMasks=n.map(i=>hr(this,i,!0,!this.u)),g(this,s)}),this.g.attachEmptyPacketListener("segmentation_masks",n=>{this.segmentationMasks=[],g(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Re.prototype.detectForVideo=Re.prototype.G,Re.prototype.detect=Re.prototype.F,Re.prototype.setOptions=Re.prototype.o,Re.createFromModelPath=function(e,t){return x(Re,e,{baseOptions:{modelAssetPath:t}})},Re.createFromModelBuffer=function(e,t){return x(Re,e,{baseOptions:{modelAssetBuffer:t}})},Re.createFromOptions=function(e,t){return x(Re,e,t)},Re.POSE_CONNECTIONS=d2;const xc=["Smile","Blink","Turn_Head","Thumbs_Up"],b2=60,Lc=({apiUrl:e,onComplete:t})=>{var kn;const r=$.useRef(null),n=$.useRef(),s=$.useRef(null),[i,o]=$.useState({face:null,hand:null}),[c,u]=$.useState("loading"),[f,l]=$.useState(""),[d,b]=$.useState([]),[A,B]=$.useState(0),[He,ze]=$.useState(b2),[te,H]=$.useState(!1);$.useEffect(()=>{(async()=>{try{const K=await Mt.forVisionTasks("https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.3/wasm"),M=await W.createFromOptions(K,{baseOptions:{modelAssetPath:"https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/1/face_landmarker.task",delegate:"GPU"},outputFaceBlendshapes:!0,runningMode:"VIDEO"}),re=await ve.createFromOptions(K,{baseOptions:{modelAssetPath:"https://storage.googleapis.com/mediapipe-models/hand_landmarker/hand_landmarker/float16/1/hand_landmarker.task",delegate:"GPU"},runningMode:"VIDEO",numHands:1});o({face:M,hand:re}),Ct(),u("ready")}catch{l("Failed to load security assets. Please check your connection."),u("error")}})()},[]),$.useEffect(()=>(c==="capturing"&&He>0?s.current=setInterval(()=>ze(ae=>ae-1),1e3):He===0&&c==="capturing"&&(u("expired"),clearInterval(s.current)),()=>clearInterval(s.current)),[c,He]);const Ct=()=>{b([...xc].sort(()=>.5-Math.random()).slice(0,3))},ri=()=>{u("capturing")},ni=()=>{B(0),ze(b2),H(!1),l(""),Ct(),u("ready")},si=(ae,K,M)=>{var re,be;if(te)return!1;if(M==="Thumbs_Up"&&((re=K==null?void 0:K.landmarks)==null?void 0:re.length)>0){const U=K.landmarks[0];return U[4].y<U[2].y&&[8,12,16,20].every(ce=>U[ce].y>U[ce-2].y)}if(((be=ae==null?void 0:ae.faceLandmarks)==null?void 0:be.length)>0){const U=ae.faceLandmarks[0];switch(M){case"Smile":return U[291].x-U[61].x>.175;case"Blink":return(Math.abs(U[159].y-U[145].y)+Math.abs(U[386].y-U[374].y))/2<.01;case"Turn_Head":const Ke=(U[1].x-U[33].x)/(U[263].x-U[33].x);return Ke<.2||Ke>.8;default:return!1}}return!1},jr=$.useCallback(async()=>{var ae,K;if(c==="capturing"&&((K=(ae=r.current)==null?void 0:ae.video)==null?void 0:K.readyState)===4){const M=r.current.video,re=performance.now(),be=i.face.detectForVideo(M,re),U=i.hand.detectForVideo(M,re);if(si(be,U,d[A])){A<2?(H(!0),setTimeout(()=>{B(ce=>ce+1),H(!1)},800)):ii();return}}n.current=requestAnimationFrame(jr)},[c,A,i,d,te]);$.useEffect(()=>(c==="capturing"&&(n.current=requestAnimationFrame(jr)),()=>cancelAnimationFrame(n.current)),[c,jr]);const ii=async()=>{var ae;clearInterval(s.current),u("verifying");try{const K=r.current.video,M=[];for(let ce=0;ce<5;ce++){const Ke=performance.now(),yt=i.face.detectForVideo(K,Ke);if((ae=yt.faceLandmarks)!=null&&ae[0]){const vt=An(K,yt.faceLandmarks[0]);M.push(vt.toDataURL("image/jpeg",.95))}await new Promise(vt=>setTimeout(vt,60))}const re=new FormData;for(let ce=0;ce<M.length;ce++){const Ke=await(await fetch(M[ce])).blob();re.append("files",Ke,`frame_${ce}.jpg`)}(await(await fetch(`${e}/v1/verify`,{method:"POST",body:re})).json()).is_live?(u("success"),setTimeout(()=>t({success:!0,image:M[M.length-1]}),2e3)):(l("Security Check Failed. Low skin confidence score."),u("error"))}catch(K){console.log(K),l("Unable to reach verification server. "),u("error")}},An=(ae,K)=>{const M=document.createElement("canvas"),re=M.getContext("2d"),be=K.map(Dr=>Dr.x*ae.videoWidth),U=K.map(Dr=>Dr.y*ae.videoHeight),ce=Math.min(...be),Ke=Math.max(...be),yt=Math.min(...U),vt=Math.max(...U),Nr=Ke-ce,Sn=vt-yt,It=Nr*.25;return M.width=224,M.height=224,re.drawImage(ae,ce-It,yt-It,Nr+It*2,Sn+It*2,0,0,224,224),M};return c==="loading"?R.jsx("div",{style:w2,children:"Initializing Security Assets..."}):R.jsxs("div",{style:w2,children:[c==="success"&&R.jsxs("div",{style:{padding:"40px 20px"},children:[R.jsx("div",{style:{fontSize:"50px",marginBottom:"20px"},children:"✅"}),R.jsx("h2",{style:{color:"#4CAF50"},children:"Verification Complete"}),R.jsx("p",{children:"Identity confirmed."})]}),(c==="expired"||c==="error")&&R.jsx("div",{style:ti,children:R.jsxs("div",{style:Rc,children:[R.jsx("div",{style:{fontSize:"40px"},children:c==="expired"?"⏰":"❌"}),R.jsx("h3",{style:{margin:"10px 0"},children:c==="expired"?"Time Expired":"Verification Failed"}),R.jsx("p",{style:{color:"#ccc",fontSize:"14px"},children:f||"The process was interrupted or timed out."}),R.jsx("button",{onClick:ni,style:E2,children:"Try Again"})]})}),["ready","capturing","verifying"].includes(c)&&R.jsxs(R.Fragment,{children:[R.jsxs("div",{style:Pc,children:[R.jsxs("h2",{style:{margin:0,fontSize:"1.2rem"},children:[c==="ready"&&"Identity Verification",c==="verifying"&&"Analyzing...",c==="capturing"&&R.jsx("span",{style:{color:te?"#4CAF50":"white"},children:te?"Great!":`${(kn=d[A])==null?void 0:kn.replace("_"," ")}`})]}),c==="capturing"&&R.jsxs("div",{style:{...Oc,color:He<=10?"#ff4d4d":"white"},children:[He,"s"]})]}),R.jsxs("div",{style:Fc,children:[R.jsx(D2,{ref:r,mirrored:!0,screenshotFormat:"image/jpeg",style:{width:"100%",borderRadius:"12px",border:c==="capturing"?"2px solid #007bff":"2px solid #333",opacity:c==="ready"?.4:1,transition:"all 0.4s ease"}}),c==="ready"&&R.jsxs("div",{style:ti,children:[R.jsx("button",{onClick:ri,style:E2,children:"Start Challenge"}),R.jsx("p",{style:{marginTop:"12px",fontSize:"13px",color:"#aaa"},children:"3 steps • 60 seconds"})]}),c==="verifying"&&R.jsx("div",{style:ti,children:R.jsx("p",{style:{marginTop:"15px",fontWeight:"bold"},children:"Securing Session..."})})]}),R.jsx("div",{style:{marginTop:"15px",minHeight:"20px"},children:R.jsxs("p",{style:{color:te?"#4CAF50":"#888",margin:0,fontSize:"14px"},children:[c==="capturing"&&!te&&"Please perform the action above.",te&&"Step verified! Get ready..."]})})]})]})},w2={textAlign:"center",color:"white",background:"#121212",padding:"24px",borderRadius:"20px",width:"100%",maxWidth:"450px",margin:"0 auto",boxShadow:"0 10px 30px rgba(0,0,0,0.5)"},Pc={display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px",minHeight:"40px"},Oc={fontSize:"18px",fontWeight:"800",background:"rgba(255,255,255,0.1)",padding:"4px 12px",borderRadius:"20px"},Fc={position:"relative",overflow:"hidden",borderRadius:"12px"},ti={position:"absolute",top:0,left:0,right:0,bottom:0,background:"rgba(0,0,0,0.75)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",zIndex:10,borderRadius:"12px"},Rc={background:"#1e1e1e",padding:"30px",borderRadius:"15px",border:"1px solid #333",maxWidth:"80%",textAlign:"center"},E2={padding:"12px 30px",fontSize:"16px",fontWeight:"bold",background:"#007bff",border:"none",color:"white",borderRadius:"10px",cursor:"pointer",transition:"transform 0.2s"},Mc=async(e,t,r)=>{const n=new FormData;t.forEach((i,o)=>{n.append("files",i,`frame_${o}.jpg`)}),n.append("challenge",r);const s=await fetch(`${e}/v1/verify`,{method:"POST",body:n});if(!s.ok)throw new Error("Network response was not ok");return await s.json()};rt.LivenessSDK=Lc,rt.verifyLiveness=Mc,Object.defineProperty(rt,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@richard.fadiora/liveness-detection",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"react-webcam": "^7.2.0"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
+
"@mediapipe/tasks-vision": "^0.10.32",
|
|
28
29
|
"react-webcam": "^7.2.0"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|