@simprints/simface-sdk 0.16.1 → 0.17.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.
@@ -1,44 +1,44 @@
1
- (function(_,Qe){typeof exports=="object"&&typeof module<"u"?Qe(exports):typeof define=="function"&&define.amd?define(["exports"],Qe):(_=typeof globalThis<"u"?globalThis:_||self,Qe(_.SimFaceSDK={}))})(this,(function(_){"use strict";var Xc;async function Qe(e,t){try{const r=await e.json();if(typeof r.error=="string"&&r.error.trim())return r.error.trim()}catch{}return`${t} (HTTP ${e.status})`}class ds{constructor(t){this.apiUrl=t.apiUrl.replace(/\/$/,""),this.projectId=t.projectId,this.apiKey=t.apiKey}async validateAPIKey(){const t=await fetch(`${this.apiUrl}/api/v1/auth/validate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:this.projectId,apiKey:this.apiKey})});if(!t.ok)throw new Error(await Qe(t,"API key validation failed"));return t.json()}async enroll(t,r){const s=new FormData;s.append("projectId",this.projectId),s.append("apiKey",this.apiKey),s.append("clientId",t),s.append("image",r,"face.jpg");const n=await fetch(`${this.apiUrl}/api/v1/enroll`,{method:"POST",body:s});if(n.status===409)return{success:!1,clientId:t,alreadyEnrolled:!0,message:"User already enrolled"};if(!n.ok)throw new Error(await Qe(n,"Enrollment failed"));return n.json()}async verify(t,r){const s=new FormData;s.append("projectId",this.projectId),s.append("apiKey",this.apiKey),s.append("clientId",t),s.append("image",r,"face.jpg");const n=await fetch(`${this.apiUrl}/api/v1/verify`,{method:"POST",body:s});if(n.status===404)return{match:!1,score:0,threshold:0,notEnrolled:!0,message:"User not enrolled"};if(!n.ok)throw new Error(await Qe(n,"Verification failed"));return n.json()}}var bt=typeof self<"u"?self:{};function Qt(e,t){e:{for(var r=["CLOSURE_FLAGS"],s=bt,n=0;n<r.length;n++)if((s=s[r[n]])==null){r=null;break e}r=s}return(e=r&&r[e])!=null?e:t}function Je(){throw Error("Invalid UTF8")}function ri(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}let Cr,fs;const Qc=typeof TextDecoder<"u";let Jc;const Zc=typeof TextEncoder<"u";function si(e){if(Zc)e=(Jc||(Jc=new TextEncoder)).encode(e);else{let r=0;const s=new Uint8Array(3*e.length);for(let n=0;n<e.length;n++){var t=e.charCodeAt(n);if(t<128)s[r++]=t;else{if(t<2048)s[r++]=t>>6|192;else{if(t>=55296&&t<=57343){if(t<=56319&&n<e.length){const i=e.charCodeAt(++n);if(i>=56320&&i<=57343){t=1024*(t-55296)+i-56320+65536,s[r++]=t>>18|240,s[r++]=t>>12&63|128,s[r++]=t>>6&63|128,s[r++]=63&t|128;continue}n--}t=65533}s[r++]=t>>12|224,s[r++]=t>>6&63|128}s[r++]=63&t|128}}e=r===s.length?s:s.subarray(0,r)}return e}function ni(e){bt.setTimeout((()=>{throw e}),0)}var ps,eh=Qt(610401301,!1),ii=Qt(748402147,!0),ms=Qt(824648567,!0),gs=Qt(824656860,Qt(1,!0));function oi(){var e=bt.navigator;return e&&(e=e.userAgent)?e:""}const ai=bt.navigator;function Tr(e){return Tr[" "](e),e}ps=ai&&ai.userAgentData||null,Tr[" "]=function(){};const ci={};let Jt=null;function th(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 s=new Uint8Array(r);let n=0;return(function(i,o){function a(u){for(;c<i.length;){const h=i.charAt(c++),l=Jt[h];if(l!=null)return l;if(!/^[\s\xa0]*$/.test(h))throw Error("Unknown base64 encoding at char: "+h)}return u}hi();let c=0;for(;;){const u=a(-1),h=a(0),l=a(64),d=a(64);if(d===64&&u===-1)break;o(u<<2|h>>4),l!=64&&(o(h<<4&240|l>>2),d!=64&&o(l<<6&192|d))}})(e,(function(i){s[n++]=i})),n!==r?s.subarray(0,n):s}function hi(){if(!Jt){Jt={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){const s=e.concat(t[r].split(""));ci[r]=s;for(let n=0;n<s.length;n++){const i=s[n];Jt[i]===void 0&&(Jt[i]=n)}}}}var rh=typeof Uint8Array<"u",ui=!(!(eh&&ps&&ps.brands.length>0)&&(oi().indexOf("Trident")!=-1||oi().indexOf("MSIE")!=-1))&&typeof btoa=="function";const li=/[-_.]/g,sh={"-":"+",_:"/",".":"="};function nh(e){return sh[e]||""}function di(e){if(!ui)return th(e);e=li.test(e)?e.replace(li,nh):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 ys(e){return rh&&e!=null&&e instanceof Uint8Array}var vt={};function Ze(){return ih||(ih=new ke(null,vt))}function bs(e){fi(vt);var t=e.g;return(t=t==null||ys(t)?t:typeof t=="string"?di(t):null)==null?t:e.g=t}var ke=class{h(){return new Uint8Array(bs(this)||0)}constructor(t,r){if(fi(r),this.g=t,t!=null&&t.length===0)throw Error("ByteString should be constructed with non-empty values")}};let ih,oh;function fi(e){if(e!==vt)throw Error("illegal external caller")}function pi(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function vs(e){return pi(e=Error(e),"warning"),e}function _t(e,t){if(e!=null){var r=oh??(oh={}),s=r[e]||0;s>=t||(r[e]=s+1,pi(e=Error(),"incident"),ni(e))}}function wt(){return typeof BigInt=="function"}var At=typeof Symbol=="function"&&typeof Symbol()=="symbol";function Se(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 ah=Se("jas",void 0,!0),mi=Se(void 0,"0di"),Zt=Se(void 0,"1oa"),te=Se(void 0,Symbol()),ch=Se(void 0,"0ub"),hh=Se(void 0,"0ubs"),_s=Se(void 0,"0ubsb"),uh=Se(void 0,"0actk"),Et=Se("m_m","Pa",!0),gi=Se();const yi={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},bi=Object.defineProperties,p=At?ah:"Ga";var et;const vi=[];function er(e,t){At||p in e||bi(e,yi),e[p]|=t}function V(e,t){At||p in e||bi(e,yi),e[p]=t}function tr(e){return er(e,34),e}function rr(e){return er(e,8192),e}V(vi,7),et=Object.freeze(vi);var kt={};function re(e,t){return t===void 0?e.h!==tt&&!!(2&(0|e.v[p])):!!(2&t)&&e.h!==tt}const tt={};function ws(e,t){if(e!=null){if(typeof e=="string")e=e?new ke(e,vt):Ze();else if(e.constructor!==ke)if(ys(e))e=e.length?new ke(new Uint8Array(e),vt):Ze();else{if(!t)throw Error();e=void 0}}return e}class _i{constructor(t,r,s){this.g=t,this.h=r,this.l=s}next(){const t=this.g.next();return t.done||(t.value=this.h.call(this.l,t.value)),t}[Symbol.iterator](){return this}}var lh=Object.freeze({});function wi(e,t,r){const s=128&t?0:-1,n=e.length;var i;(i=!!n)&&(i=(i=e[n-1])!=null&&typeof i=="object"&&i.constructor===Object);const o=n+(i?-1:0);for(t=128&t?1:0;t<o;t++)r(t-s,e[t]);if(i){e=e[n-1];for(const a in e)!isNaN(a)&&r(+a,e[a])}}var Ai={};function St(e){return 128&e?Ai:void 0}function Lr(e){return e.Na=!0,e}var dh=Lr((e=>typeof e=="number")),Ei=Lr((e=>typeof e=="string")),fh=Lr((e=>typeof e=="boolean")),Pr=typeof bt.BigInt=="function"&&typeof bt.BigInt(0)=="bigint";function se(e){var t=e;if(Ei(t)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(t))throw Error(String(t))}else if(dh(t)&&!Number.isSafeInteger(t))throw Error(String(t));return Pr?BigInt(e):e=fh(e)?e?"1":"0":Ei(e)?e.trim()||"0":String(e)}var As=Lr((e=>Pr?e>=mh&&e<=yh:e[0]==="-"?ki(e,ph):ki(e,gh)));const ph=Number.MIN_SAFE_INTEGER.toString(),mh=Pr?BigInt(Number.MIN_SAFE_INTEGER):void 0,gh=Number.MAX_SAFE_INTEGER.toString(),yh=Pr?BigInt(Number.MAX_SAFE_INTEGER):void 0;function ki(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 s=e[r],n=t[r];if(s>n)return!1;if(s<n)return!0}}const bh=typeof Uint8Array.prototype.slice=="function";let vh,F=0,B=0;function Si(e){const t=e>>>0;F=t,B=(e-t)/4294967296>>>0}function Ct(e){if(e<0){Si(-e);const[t,r]=Ts(F,B);F=t>>>0,B=r>>>0}else Si(e)}function Es(e){const t=vh||(vh=new DataView(new ArrayBuffer(8)));t.setFloat32(0,+e,!0),B=0,F=t.getUint32(0,!0)}function ks(e,t){const r=4294967296*t+(e>>>0);return Number.isSafeInteger(r)?r:sr(e,t)}function _h(e,t){return se(wt()?BigInt.asUintN(64,(BigInt(t>>>0)<<BigInt(32))+BigInt(e>>>0)):sr(e,t))}function Ss(e,t){const r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=ks(e,t))=="number"?r?-e:e:r?"-"+e:e}function Ci(e,t){return wt()?se(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(t))<<BigInt(32))+BigInt.asUintN(32,BigInt(e)))):se(Cs(e,t))}function sr(e,t){if(e>>>=0,(t>>>=0)<=2097151)var r=""+(4294967296*t+e);else wt()?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+Ti(r)+Ti(e));return r}function Ti(e){return e=String(e),"0000000".slice(e.length)+e}function Cs(e,t){if(2147483648&t)if(wt())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{const[r,s]=Ts(e,t);e="-"+sr(r,s)}else e=sr(e,t);return e}function Mr(e){if(e.length<16)Ct(Number(e));else if(wt())e=BigInt(e),F=Number(e&BigInt(4294967295))>>>0,B=Number(e>>BigInt(32)&BigInt(4294967295));else{const t=+(e[0]==="-");B=F=0;const r=e.length;for(let s=t,n=(r-t)%6+t;n<=r;s=n,n+=6){const i=Number(e.slice(s,n));B*=1e6,F=1e6*F+i,F>=4294967296&&(B+=Math.trunc(F/4294967296),B>>>=0,F>>>=0)}if(t){const[s,n]=Ts(F,B);F=s,B=n}}}function Ts(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}function ve(e){return Array.prototype.slice.call(e)}const nr=typeof BigInt=="function"?BigInt.asIntN:void 0,wh=typeof BigInt=="function"?BigInt.asUintN:void 0,rt=Number.isSafeInteger,Fr=Number.isFinite,Tt=Math.trunc,Ah=se(0);function ir(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 Ce(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function or(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 Li(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}const Eh=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function ar(e){switch(typeof e){case"bigint":return!0;case"number":return Fr(e);case"string":return Eh.test(e);default:return!1}}function Lt(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return Fr(e)?0|e:void 0}function Pi(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return Fr(e)?e>>>0:void 0}function Mi(e){const t=e.length;return(e[0]==="-"?t<20||t===20&&e<="-9223372036854775808":t<19||t===19&&e<="9223372036854775807")?e:(Mr(e),Cs(F,B))}function Ls(e){return e=Tt(e),rt(e)||(Ct(e),e=Ss(F,B)),e}function Fi(e){var t=Tt(Number(e));return rt(t)?String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Mi(e))}function xi(e){var t=Tt(Number(e));return rt(t)?se(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),wt()?se(nr(64,BigInt(e))):se(Mi(e)))}function $i(e){return rt(e)?e=se(Ls(e)):(e=Tt(e),rt(e)?e=String(e):(Ct(e),e=Cs(F,B)),e=se(e)),e}function kh(e){return e==null?e:typeof e=="bigint"?(As(e)?e=Number(e):(e=nr(64,e),e=As(e)?Number(e):String(e)),e):ar(e)?typeof e=="number"?Ls(e):Fi(e):void 0}function xr(e){const t=typeof e;return e==null?e:t==="bigint"?se(nr(64,e)):ar(e)?t==="string"?xi(e):$i(e):void 0}function Oi(e){if(typeof e!="string")throw Error();return e}function cr(e){if(e!=null&&typeof e!="string")throw Error();return e}function Y(e){return e==null||typeof e=="string"?e:void 0}function Ps(e,t,r,s){return e!=null&&e[Et]===kt?e:Array.isArray(e)?((s=(r=0|e[p])|32&s|2&s)!==r&&V(e,s),new t(e)):(r?2&s?((e=t[mi])||(tr((e=new t).v),e=t[mi]=e),t=e):t=new t:t=void 0,t)}function Sh(e,t,r){if(t)e:{if(!ar(t=e))throw vs("int64");switch(typeof t){case"string":t=xi(t);break e;case"bigint":t=se(nr(64,t));break e;default:t=$i(t)}}else t=xr(e);return(e=t)==null?r?Ah:void 0:e}const Ch={};let Th=(function(){try{return Tr(new class extends Map{constructor(){super()}}),!1}catch{return!0}})();class Ms{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 Lh=Th?(Object.setPrototypeOf(Ms.prototype,Map.prototype),Object.defineProperties(Ms.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),Ms):class extends Map{constructor(){super()}};function Ri(e){return e}function Fs(e){if(2&e.J)throw Error("Cannot mutate an immutable Map")}var $e=class extends Lh{constructor(e,t,r=Ri,s=Ri){super(),this.J=0|e[p],this.K=t,this.S=r,this.fa=this.K?Ph:s;for(let n=0;n<e.length;n++){const i=e[n],o=r(i[0],!1,!0);let a=i[1];t?a===void 0&&(a=null):a=s(i[1],!1,!0,void 0,void 0,this.J),super.set(o,a)}}V(e){return rr(Array.from(super.entries(),e))}clear(){Fs(this),super.clear()}delete(e){return Fs(this),super.delete(this.S(e,!0,!1))}entries(){if(this.K){var e=super.keys();e=new _i(e,Mh,this)}else e=super.entries();return e}values(){if(this.K){var e=super.keys();e=new _i(e,$e.prototype.get,this)}else e=super.values();return e}forEach(e,t){this.K?super.forEach(((r,s,n)=>{e.call(t,n.get(s),s,n)})):super.forEach(e,t)}set(e,t){return Fs(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 Ph(e,t,r,s,n,i){return e=Ps(e,s,r,i),n&&(e=Os(e)),e}function Mh(e){return[e,this.get(e)]}let Fh;function Ii(){return Fh||(Fh=new $e(tr([]),void 0,void 0,void 0,Ch))}function $r(e){return te?e[te]:void 0}function Or(e,t){for(const r in e)!isNaN(r)&&t(e,+r,e[r])}$e.prototype.toJSON=void 0;var xs=class{};const xh={Ka:!0};function $h(e,t){t<100||_t(hh,1)}function Rr(e,t,r,s){const n=s!==void 0;s=!!s;var i,o=te;!n&&At&&o&&(i=e[o])&&Or(i,$h),o=[];var a=e.length;let c;i=4294967295;let u=!1;const h=!!(64&t),l=h?128&t?0:-1:void 0;1&t||(c=a&&e[a-1],c!=null&&typeof c=="object"&&c.constructor===Object?i=--a:c=void 0,!h||128&t||n||(u=!0,i=i-l+l)),t=void 0;for(var d=0;d<a;d++){let b=e[d];if(b!=null&&(b=r(b,s))!=null)if(h&&d>=i){const C=d-l;(t??(t={}))[C]=b}else o[d]=b}if(c)for(let b in c){if((a=c[b])==null||(a=r(a,s))==null)continue;let C;d=+b,h&&!Number.isNaN(d)&&(C=d+l)<i?o[C]=a:(t??(t={}))[b]=a}return t&&(u?o.push(t):o[i]=t),n&&te&&(e=$r(e))&&e instanceof xs&&(o[te]=(function(b){const C=new xs;return Or(b,((ei,Yt,Sr)=>{C[Yt]=ve(Sr)})),C.da=b.da,C})(e)),o}function Oh(e){return e[0]=hr(e[0]),e[1]=hr(e[1]),e}function hr(e){switch(typeof e){case"number":return Number.isFinite(e)?e:""+e;case"bigint":return As(e)?Number(e):""+e;case"boolean":return e?1:0;case"object":if(Array.isArray(e)){var t=0|e[p];return e.length===0&&1&t?void 0:Rr(e,t,hr)}if(e!=null&&e[Et]===kt)return Ni(e);if(e instanceof ke){if((t=e.g)==null)e="";else if(typeof t=="string")e=t;else{if(ui){for(var r="",s=0,n=t.length-10240;s<n;)r+=String.fromCharCode.apply(null,t.subarray(s,s+=10240));r+=String.fromCharCode.apply(null,s?t.subarray(s):t),t=btoa(r)}else{r===void 0&&(r=0),hi(),r=ci[r],s=Array(Math.floor(t.length/3)),n=r[64]||"";let u=0,h=0;for(;u<t.length-2;u+=3){var i=t[u],o=t[u+1],a=t[u+2],c=r[i>>2];i=r[(3&i)<<4|o>>4],o=r[(15&o)<<2|a>>6],a=r[63&a],s[h++]=c+i+o+a}switch(c=0,a=n,t.length-u){case 2:a=r[(15&(c=t[u+1]))<<2]||n;case 1:t=t[u],s[h]=r[t>>2]+r[(3&t)<<4|c>>4]+a+n}t=s.join("")}e=e.g=t}return e}return e instanceof $e?e=e.size!==0?e.V(Oh):void 0:void 0}return e}function Ni(e){return Rr(e=e.v,0|e[p],hr)}let Rh,Ih;function st(e,t){return Bi(e,t[0],t[1])}function Bi(e,t,r,s=0){if(e==null){var n=32;r?(e=[r],n|=128):e=[],t&&(n=-16760833&n|(1023&t)<<14)}else{if(!Array.isArray(e))throw Error("narr");if(n=0|e[p],ii&&1&n)throw Error("rfarr");if(2048&n&&!(2&n)&&(function(){if(ii)throw Error("carr");_t(uh,5)})(),256&n)throw Error("farr");if(64&n)return(n|s)!==n&&V(e,n|s),e;if(r&&(n|=128,r!==e[0]))throw Error("mid");e:{n|=64;var i=(r=e).length;if(i){var o=i-1;const c=r[o];if(c!=null&&typeof c=="object"&&c.constructor===Object){if((o-=t=128&n?0:-1)>=1024)throw Error("pvtlmt");for(var a in c)(i=+a)<o&&(r[i+t]=c[a],delete c[a]);n=-16760833&n|(1023&o)<<14;break e}}if(t){if((a=Math.max(t,i-(128&n?0:-1)))>1024)throw Error("spvt");n=-16760833&n|(1023&a)<<14}}}return V(e,64|n|s),e}function Nh(e,t){if(typeof e!="object")return e;if(Array.isArray(e)){var r=0|e[p];return e.length===0&&1&r?void 0:Ui(e,r,t)}if(e!=null&&e[Et]===kt)return Di(e);if(e instanceof $e){if(2&(t=e.J))return e;if(!e.size)return;if(r=tr(e.V()),e.K)for(e=0;e<r.length;e++){const s=r[e];let n=s[1];n=n==null||typeof n!="object"?void 0:n!=null&&n[Et]===kt?Di(n):Array.isArray(n)?Ui(n,0|n[p],!!(32&t)):void 0,s[1]=n}return r}return e instanceof ke?e:void 0}function Ui(e,t,r){return 2&t||(!r||4096&t||16&t?e=Pt(e,t,!1,r&&!(16&t)):(er(e,34),4&t&&Object.freeze(e))),e}function $s(e,t,r){return e=new e.constructor(t),r&&(e.h=tt),e.m=tt,e}function Di(e){const t=e.v,r=0|t[p];return re(e,r)?e:Rs(e,t,r)?$s(e,t):Pt(t,r)}function Pt(e,t,r,s){return s??(s=!!(34&t)),e=Rr(e,t,Nh,s),s=32,r&&(s|=2),V(e,t=16769217&t|s),e}function Os(e){const t=e.v,r=0|t[p];return re(e,r)?Rs(e,t,r)?$s(e,t,!0):new e.constructor(Pt(t,r,!1)):e}function Mt(e){if(e.h!==tt)return!1;var t=e.v;return er(t=Pt(t,0|t[p]),2048),e.v=t,e.h=void 0,e.m=void 0,!0}function Ft(e){if(!Mt(e)&&re(e,0|e.v[p]))throw Error()}function nt(e,t){t===void 0&&(t=0|e[p]),32&t&&!(4096&t)&&V(e,4096|t)}function Rs(e,t,r){return!!(2&r)||!(!(32&r)||4096&r)&&(V(t,2|r),e.h=tt,!0)}const Bh=se(0),De={};function L(e,t,r,s,n){if((t=Oe(e.v,t,r,n))!==null||s&&e.m!==tt)return t}function Oe(e,t,r,s){if(t===-1)return null;const n=t+(r?0:-1),i=e.length-1;let o,a;if(!(i<1+(r?0:-1))){if(n>=i)if(o=e[i],o!=null&&typeof o=="object"&&o.constructor===Object)r=o[t],a=!0;else{if(n!==i)return;r=o}else r=e[n];if(s&&r!=null){if((s=s(r))==null)return s;if(!Object.is(s,r))return a?o[t]=s:e[n]=s,s}return r}}function S(e,t,r,s){Ft(e),G(e=e.v,0|e[p],t,r,s)}function G(e,t,r,s,n){const i=r+(n?0:-1);var o=e.length-1;if(o>=1+(n?0:-1)&&i>=o){const a=e[o];if(a!=null&&typeof a=="object"&&a.constructor===Object)return a[r]=s,t}return i<=o?(e[i]=s,t):(s!==void 0&&(r>=(o=(t??(t=0|e[p]))>>14&1023||536870912)?s!=null&&(e[o+(n?0:-1)]={[r]:s}):e[i]=s),t)}function it(){return lh===void 0?2:4}function ot(e,t,r,s,n){let i=e.v,o=0|i[p];s=re(e,o)?1:s,n=!!n||s===3,s===2&&Mt(e)&&(i=e.v,o=0|i[p]);let a=(e=Is(i,t))===et?7:0|e[p],c=Ns(a,o);var u=!(4&c);if(u){4&c&&(e=ve(e),a=0,c=ct(c,o),o=G(i,o,t,e));let h=0,l=0;for(;h<e.length;h++){const d=r(e[h]);d!=null&&(e[l++]=d)}l<h&&(e.length=l),r=-513&(4|c),c=r&=-1025,c&=-4097}return c!==a&&(V(e,c),2&c&&Object.freeze(e)),ji(e,c,i,o,t,s,u,n)}function ji(e,t,r,s,n,i,o,a){let c=t;return i===1||i===4&&(2&t||!(16&t)&&32&s)?at(t)||((t|=!e.length||o&&!(4096&t)||32&s&&!(4096&t||16&t)?2:256)!==c&&V(e,t),Object.freeze(e)):(i===2&&at(t)&&(e=ve(e),c=0,t=ct(t,s),s=G(r,s,n,e)),at(t)||(a||(t|=16),t!==c&&V(e,t))),2&t||!(4096&t||16&t)||nt(r,s),e}function Is(e,t,r){return e=Oe(e,t,r),Array.isArray(e)?e:et}function Ns(e,t){return 2&t&&(e|=2),1|e}function at(e){return!!(2&e)&&!!(4&e)||!!(256&e)}function Vi(e){return ws(e,!0)}function Gi(e){e=ve(e);for(let t=0;t<e.length;t++){const r=e[t]=ve(e[t]);Array.isArray(r[1])&&(r[1]=tr(r[1]))}return rr(e)}function je(e,t,r,s){Ft(e),G(e=e.v,0|e[p],t,(s==="0"?Number(r)===0:r===s)?void 0:r)}function xt(e,t,r){if(2&t)throw Error();const s=St(t);let n=Is(e,r,s),i=n===et?7:0|n[p],o=Ns(i,t);return(2&o||at(o)||16&o)&&(o===i||at(o)||V(n,o),n=ve(n),i=0,o=ct(o,t),G(e,t,r,n,s)),o&=-13,o!==i&&V(n,o),n}function Bs(e,t){var r=Yo;return Ds(Us(e=e.v),e,void 0,r)===t?t:-1}function Us(e){if(At)return e[Zt]??(e[Zt]=new Map);if(Zt in e)return e[Zt];const t=new Map;return Object.defineProperty(e,Zt,{value:t}),t}function Hi(e,t,r,s,n){const i=Us(e),o=Ds(i,e,t,r,n);return o!==s&&(o&&(t=G(e,t,o,void 0,n)),i.set(r,s)),t}function Ds(e,t,r,s,n){let i=e.get(s);if(i!=null)return i;i=0;for(let o=0;o<s.length;o++){const a=s[o];Oe(t,a,n)!=null&&(i!==0&&(r=G(t,r,i,void 0,n)),i=a)}return e.set(s,i),i}function js(e,t,r){let s=0|e[p];const n=St(s),i=Oe(e,r,n);let o;if(i!=null&&i[Et]===kt){if(!re(i))return Mt(i),i.v;o=i.v}else Array.isArray(i)&&(o=i);if(o){const a=0|o[p];2&a&&(o=Pt(o,a))}return o=st(o,t),o!==i&&G(e,s,r,o,n),o}function zi(e,t,r,s,n){let i=!1;if((s=Oe(e,s,n,(o=>{const a=Ps(o,r,!1,t);return i=a!==o&&a!=null,a})))!=null)return i&&!re(s)&&nt(e,t),s}function E(e,t,r,s){let n=e.v,i=0|n[p];if((t=zi(n,i,t,r,s))==null)return t;if(i=0|n[p],!re(e,i)){const o=Os(t);o!==t&&(Mt(e)&&(n=e.v,i=0|n[p]),i=G(n,i,r,t=o,s),nt(n,i))}return t}function Wi(e,t,r,s,n,i,o,a){var c=re(e,r);i=c?1:i,o=!!o||i===3,c=a&&!c,(i===2||c)&&Mt(e)&&(r=0|(t=e.v)[p]);var u=(e=Is(t,n))===et?7:0|e[p],h=Ns(u,r);if(a=!(4&h)){var l=e,d=r;const b=!!(2&h);b&&(d|=2);let C=!b,ei=!0,Yt=0,Sr=0;for(;Yt<l.length;Yt++){const ti=Ps(l[Yt],s,!1,d);if(ti instanceof s){if(!b){const Yc=re(ti);C&&(C=!Yc),ei&&(ei=Yc)}l[Sr++]=ti}}Sr<Yt&&(l.length=Sr),h|=4,h=ei?-4097&h:4096|h,h=C?8|h:-9&h}if(h!==u&&(V(e,h),2&h&&Object.freeze(e)),c&&!(8&h||!e.length&&(i===1||i===4&&(2&h||!(16&h)&&32&r)))){for(at(h)&&(e=ve(e),h=ct(h,r),r=G(t,r,n,e)),s=e,c=h,u=0;u<s.length;u++)(l=s[u])!==(h=Os(l))&&(s[u]=h);c|=8,V(e,h=c=s.length?4096|c:-4097&c)}return ji(e,h,t,r,n,i,a,o)}function Re(e,t,r){const s=e.v;return Wi(e,s,0|s[p],t,r,it(),!1,!0)}function Ki(e){return e==null&&(e=void 0),e}function v(e,t,r,s,n){return S(e,r,s=Ki(s),n),s&&!re(s)&&nt(e.v),e}function ur(e,t,r,s){e:{var n=s=Ki(s);Ft(e);const i=e.v;let o=0|i[p];if(n==null){const a=Us(i);if(Ds(a,i,o,r)!==t)break e;a.set(r,0)}else o=Hi(i,o,r,t);G(i,o,t,n)}s&&!re(s)&&nt(e.v)}function ct(e,t){return-273&(2&t?2|e:-3&e)}function Vs(e,t,r,s){var n=s;Ft(e),e=Wi(e,s=e.v,0|s[p],r,t,2,!0),n=n??new r,e.push(n),t=r=e===et?7:0|e[p],(n=re(n))?(r&=-9,e.length===1&&(r&=-4097)):r|=4096,r!==t&&V(e,r),n||nt(s)}function pe(e,t,r){return Lt(L(e,t,void 0,r))}function qi(e){return(gs?L(e,2,void 0,void 0,xr):xr(L(e,2)))??Bh}function R(e,t){return L(e,t,void 0,void 0,Ce)??0}function Ie(e,t,r){if(r!=null){if(typeof r!="number"||!Fr(r))throw vs("int32");r|=0}S(e,t,r)}function y(e,t,r){S(e,t,ir(r))}function ne(e,t,r){je(e,t,cr(r),"")}function Ir(e,t,r){{Ft(e);const o=e.v;let a=0|o[p];if(r==null)G(o,a,t);else{var s=e=r===et?7:0|r[p],n=at(e),i=n||Object.isFrozen(r);for(n||(e=0),i||(r=ve(r),s=0,e=ct(e,a),i=!1),e|=5,e|=(4&e?512&e?512:1024&e?1024:0:void 0)??(gs?1024:0),n=0;n<r.length;n++){const c=r[n],u=Oi(c);Object.is(c,u)||(i&&(r=ve(r),s=0,e=ct(e,a),i=!1),r[n]=u)}e!==s&&(i&&(r=ve(r),e=ct(e,a)),V(r,e)),G(o,a,t,r)}}}function Nr(e,t,r){Ft(e),ot(e,t,Y,2,!0).push(Oi(r))}var $t=class{constructor(e,t,r){if(this.buffer=e,r&&!t)throw Error();this.g=t}};function Gs(e,t){if(typeof e=="string")return new $t(di(e),t);if(Array.isArray(e))return new $t(new Uint8Array(e),t);if(e.constructor===Uint8Array)return new $t(e,!1);if(e.constructor===ArrayBuffer)return e=new Uint8Array(e),new $t(e,!1);if(e.constructor===ke)return t=bs(e)||new Uint8Array(0),new $t(t,!0,e);if(e instanceof Uint8Array)return e=e.constructor===Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new $t(e,!1);throw Error()}function Ot(e,t){let r,s=0,n=0,i=0;const o=e.h;let a=e.g;do r=o[a++],s|=(127&r)<<i,i+=7;while(i<32&&128&r);if(i>32)for(n|=(127&r)>>4,i=3;i<32&&128&r;i+=7)r=o[a++],n|=(127&r)<<i;if(ht(e,a),!(128&r))return t(s>>>0,n>>>0);throw Error()}function Hs(e){let t=0,r=e.g;const s=r+10,n=e.h;for(;r<s;){const i=n[r++];if(t|=i,(128&i)==0)return ht(e,r),!!(127&t)}throw Error()}function Ve(e){const t=e.h;let r=e.g,s=t[r++],n=127&s;if(128&s&&(s=t[r++],n|=(127&s)<<7,128&s&&(s=t[r++],n|=(127&s)<<14,128&s&&(s=t[r++],n|=(127&s)<<21,128&s&&(s=t[r++],n|=s<<28,128&s&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++])))))throw Error();return ht(e,r),n}function Ne(e){return Ve(e)>>>0}function Br(e){var t=e.h;const r=e.g;var s=t[r],n=t[r+1];const i=t[r+2];return t=t[r+3],ht(e,e.g+4),e=2*((n=(s<<0|n<<8|i<<16|t<<24)>>>0)>>31)+1,s=n>>>23&255,n&=8388607,s==255?n?NaN:e*(1/0):s==0?1401298464324817e-60*e*n:e*Math.pow(2,s-150)*(n+8388608)}function Uh(e){return Ve(e)}function ht(e,t){if(e.g=t,t>e.l)throw Error()}function Xi(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 Yi(e,t){if(t==0)return Ze();var r=Xi(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):bh?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?Ze():new ke(r,vt)}var Qi=[];function Ji(e,t,r,s){if(jr.length){const n=jr.pop();return n.o(s),n.g.init(e,t,r,s),n}return new Dh(e,t,r,s)}function Zi(e){e.g.clear(),e.l=-1,e.h=-1,jr.length<100&&jr.push(e)}function eo(e){var t=e.g;if(t.g==t.l)return!1;e.m=e.g.g;var r=Ne(e.g);if(t=r>>>3,!((r&=7)>=0&&r<=5)||t<1)throw Error();return e.l=t,e.h=r,!0}function Ur(e){switch(e.h){case 0:e.h!=0?Ur(e):Hs(e.g);break;case 1:ht(e=e.g,e.g+8);break;case 2:if(e.h!=2)Ur(e);else{var t=Ne(e.g);ht(e=e.g,e.g+t)}break;case 5:ht(e=e.g,e.g+4);break;case 3:for(t=e.l;;){if(!eo(e))throw Error();if(e.h==4){if(e.l!=t)throw Error();break}Ur(e)}break;default:throw Error()}}function lr(e,t,r){const s=e.g.l;var n=Ne(e.g);let i=(n=e.g.g+n)-s;if(i<=0&&(e.g.l=n,r(t,e,void 0,void 0,void 0),i=n-e.g.g),i)throw Error();return e.g.g=n,e.g.l=s,t}function zs(e){var t=Ne(e.g),r=Xi(e=e.g,t);if(e=e.h,Qc){var s,n=e;(s=fs)||(s=fs=new TextDecoder("utf-8",{fatal:!0})),t=r+t,n=r===0&&t===n.length?n:n.subarray(r,t);try{var i=s.decode(n)}catch(a){if(Cr===void 0){try{s.decode(new Uint8Array([128]))}catch{}try{s.decode(new Uint8Array([97])),Cr=!0}catch{Cr=!1}}throw!Cr&&(fs=void 0),a}}else{t=(i=r)+t,r=[];let a,c=null;for(;i<t;){var o=e[i++];o<128?r.push(o):o<224?i>=t?Je():(a=e[i++],o<194||(192&a)!=128?(i--,Je()):r.push((31&o)<<6|63&a)):o<240?i>=t-1?Je():(a=e[i++],(192&a)!=128||o===224&&a<160||o===237&&a>=160||(192&(s=e[i++]))!=128?(i--,Je()):r.push((15&o)<<12|(63&a)<<6|63&s)):o<=244?i>=t-2?Je():(a=e[i++],(192&a)!=128||a-144+(o<<28)>>30!=0||(192&(s=e[i++]))!=128||(192&(n=e[i++]))!=128?(i--,Je()):(o=(7&o)<<18|(63&a)<<12|(63&s)<<6|63&n,o-=65536,r.push(55296+(o>>10&1023),56320+(1023&o)))):Je(),r.length>=8192&&(c=ri(c,r),r.length=0)}i=ri(c,r)}return i}function to(e){const t=Ne(e.g);return Yi(e.g,t)}function Dr(e,t,r){var s=Ne(e.g);for(s=e.g.g+s;e.g.g<s;)r.push(t(e.g))}var Dh=class{constructor(e,t,r,s){if(Qi.length){const n=Qi.pop();n.init(e,t,r,s),e=n}else e=new class{constructor(n,i,o,a){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.init(n,i,o,a)}init(n,i,o,{Y:a=!1,ea:c=!1}={}){this.Y=a,this.ea=c,n&&(n=Gs(n,this.ea),this.h=n.buffer,this.j=n.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,s);this.g=e,this.m=this.g.g,this.h=this.l=-1,this.o(s)}o({ha:e=!1}={}){this.ha=e}},jr=[];function ro(e){return e?/^\d+$/.test(e)?(Mr(e),new Ws(F,B)):null:jh||(jh=new Ws(0,0))}var Ws=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let jh;function so(e){return e?/^-?\d+$/.test(e)?(Mr(e),new Ks(F,B)):null:Vh||(Vh=new Ks(0,0))}var Ks=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let Vh;function Rt(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 It(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function Vr(e,t){if(t>=0)It(e,t);else{for(let r=0;r<9;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function qs(e){var t=F;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 Nt(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function me(e,t,r){It(e.g,8*t+r)}function Xs(e,t){return me(e,t,2),t=e.g.end(),Nt(e,t),t.push(e.h),t}function Ys(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 Gr(e,t,r){me(e,t,2),It(e.g,r.length),Nt(e,e.g.end()),Nt(e,r)}function Hr(e,t,r,s){r!=null&&(t=Xs(e,t),s(r,e),Ys(e,t))}function Te(){const e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var Qs=Te(),no=Te(),Js=Te(),Zs=Te(),io=Te(),oo=Te(),Gh=Te(),zr=Te(),ao=Te(),co=Te();function Le(e,t,r){var s=e.v;te&&te in s&&(s=s[te])&&delete s[t.g],t.h?t.j(e,t.h,t.g,r,t.l):t.j(e,t.g,r,t.l)}var m=class{constructor(e,t){this.v=Bi(e,t,void 0,2048)}toJSON(){return Ni(this)}j(){var n;var e=Su,t=this.v,r=e.g,s=te;if(At&&s&&((n=t[s])==null?void 0:n[r])!=null&&_t(ch,3),t=e.g,gi&&te&&gi===void 0&&(s=(r=this.v)[te])&&(s=s.da))try{s(r,t,xh)}catch(i){ni(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[p];return Rs(this,e,t)?$s(this,e,!0):new this.constructor(Pt(e,t,!1))}};m.prototype[Et]=kt,m.prototype.toString=function(){return this.v.toString()};var Bt=class{constructor(e,t,r){this.g=e,this.h=t,e=Qs,this.l=!!e&&r===e||!1}};function Wr(e,t){return new Bt(e,t,Qs)}function ho(e,t,r,s,n){Hr(e,r,go(t,s),n)}const Hh=Wr((function(e,t,r,s,n){return e.h===2&&(lr(e,js(t,s,r),n),!0)}),ho),zh=Wr((function(e,t,r,s,n){return e.h===2&&(lr(e,js(t,s,r),n),!0)}),ho);var Kr=Symbol(),qr=Symbol(),en=Symbol(),uo=Symbol(),lo=Symbol();let fo,po;function ut(e,t,r,s){var n=s[e];if(n)return n;(n={}).qa=s,n.T=(function(l){switch(typeof l){case"boolean":return Rh||(Rh=[0,void 0,!0]);case"number":return l>0?void 0:l===0?Ih||(Ih=[0,void 0]):[-l,void 0];case"string":return[0,l];case"object":return l}})(s[0]);var i=s[1];let o=1;i&&i.constructor===Object&&(n.ba=i,typeof(i=s[++o])=="function"&&(n.ma=!0,fo??(fo=i),po??(po=s[o+1]),i=s[o+=2]));const a={};for(;i&&Array.isArray(i)&&i.length&&typeof i[0]=="number"&&i[0]>0;){for(var c=0;c<i.length;c++)a[i[c]]=i;i=s[++o]}for(c=1;i!==void 0;){let l;typeof i=="number"&&(c+=i,i=s[++o]);var u=void 0;if(i instanceof Bt?l=i:(l=Hh,o--),l==null?void 0:l.l){i=s[++o],u=s;var h=o;typeof i=="function"&&(i=i(),u[h]=i),u=i}for(h=c+1,typeof(i=s[++o])=="number"&&i<0&&(h-=i,i=s[++o]);c<h;c++){const d=a[c];u?r(n,c,l,u,d):t(n,c,l,d)}}return s[e]=n}function mo(e){return Array.isArray(e)?e[0]instanceof Bt?e:[zh,e]:[e,void 0]}function go(e,t){return e instanceof m?e.v:Array.isArray(e)?st(e,t):void 0}function tn(e,t,r,s){const n=r.g;e[t]=s?(i,o,a)=>n(i,o,a,s):n}function rn(e,t,r,s,n){const i=r.g;let o,a;e[t]=(c,u,h)=>i(c,u,h,a||(a=ut(qr,tn,rn,s).T),o||(o=sn(s)),n)}function sn(e){let t=e[en];if(t!=null)return t;const r=ut(qr,tn,rn,e);return t=r.ma?(s,n)=>fo(s,n,r):(s,n)=>{for(;eo(n)&&n.h!=4;){var i=n.l,o=r[i];if(o==null){var a=r.ba;a&&(a=a[i])&&(a=Kh(a))!=null&&(o=r[i]=a)}if(o==null||!o(n,s,i)){if(o=(a=n).m,Ur(a),a.ha)var c=void 0;else c=a.g.g-o,a.g.g=o,c=Yi(a.g,c);o=void 0,a=s,c&&((o=a[te]??(a[te]=new xs))[i]??(o[i]=[])).push(c)}}return(s=$r(s))&&(s.da=r.qa[lo]),!0},e[en]=t,e[lo]=Wh.bind(e),t}function Wh(e,t,r,s){var n=this[qr];const i=this[en],o=st(void 0,n.T),a=$r(e);if(a){var c=!1,u=n.ba;if(u){if(n=(h,l,d)=>{if(d.length!==0)if(u[l])for(const b of d){h=Ji(b);try{c=!0,i(o,h)}finally{Zi(h)}}else s==null||s(e,l,d)},t==null)Or(a,n);else if(a!=null){const h=a[t];h&&n(a,t,h)}if(c){let h=0|e[p];if(2&h&&2048&h&&!(r!=null&&r.Ka))throw Error();const l=St(h),d=(b,C)=>{if(Oe(e,b,l)!=null){if((r==null?void 0:r.Qa)===1)return;throw Error()}C!=null&&(h=G(e,h,b,C,l)),delete a[b]};t==null?wi(o,0|o[p],((b,C)=>{d(b,C)})):d(t,Oe(o,t,l))}}}}function Kh(e){const t=(e=mo(e))[0].g;if(e=e[1]){const r=sn(e),s=ut(qr,tn,rn,e).T;return(n,i,o)=>t(n,i,o,s,r)}return t}function Xr(e,t,r){e[t]=r.h}function Yr(e,t,r,s){let n,i;const o=r.h;e[t]=(a,c,u)=>o(a,c,u,i||(i=ut(Kr,Xr,Yr,s).T),n||(n=yo(s)))}function yo(e){let t=e[uo];if(!t){const r=ut(Kr,Xr,Yr,e);t=(s,n)=>bo(s,n,r),e[uo]=t}return t}function bo(e,t,r){wi(e,0|e[p],((s,n)=>{if(n!=null){var i=(function(o,a){var c=o[a];if(c)return c;if((c=o.ba)&&(c=c[a])){var u=(c=mo(c))[0].h;if(c=c[1]){const h=yo(c),l=ut(Kr,Xr,Yr,c).T;c=o.ma?po(l,h):(d,b,C)=>u(d,b,C,l,h)}else c=u;return o[a]=c}})(r,s);i?i(t,n,s):s<500||_t(_s,3)}})),(e=$r(e))&&Or(e,((s,n,i)=>{for(Nt(t,t.g.end()),s=0;s<i.length;s++)Nt(t,bs(i[s])||new Uint8Array(0))}))}const qh=se(0);function Ut(e,t){if(Array.isArray(t)){var r=0|t[p];if(4&r)return t;for(var s=0,n=0;s<t.length;s++){const i=e(t[s]);i!=null&&(t[n++]=i)}return n<s&&(t.length=n),(e=-1537&(5|r))!==r&&V(t,e),2&e&&Object.freeze(t),t}}function J(e,t,r){return new Bt(e,t,r)}function Dt(e,t,r){return new Bt(e,t,r)}function z(e,t,r){G(e,0|e[p],t,r,St(0|e[p]))}var Xh=Wr((function(e,t,r,s,n){if(e.h!==2)return!1;if(e=ve(e=lr(e,st([void 0,void 0],s),n)),n=St(s=0|t[p]),2&s)throw Error();let i=Oe(t,r,n);if(i instanceof $e)(2&i.J)!=0?(i=i.V(),i.push(e),G(t,s,r,i,n)):i.Ma(e);else if(Array.isArray(i)){var o=0|i[p];8192&o||V(i,o|=8192),2&o&&(i=Gi(i),G(t,s,r,i,n)),i.push(e)}else G(t,s,r,rr([e]),n);return!0}),(function(e,t,r,s,n){if(t instanceof $e)t.forEach(((i,o)=>{Hr(e,r,st([o,i],s),n)}));else if(Array.isArray(t)){for(let i=0;i<t.length;i++){const o=t[i];Array.isArray(o)&&Hr(e,r,st(o,s),n)}rr(t)}}));function vo(e,t,r){(t=Ce(t))!=null&&(me(e,r,5),e=e.g,Es(t),qs(e))}function _o(e,t,r){if(t=(function(s){if(s==null)return s;const n=typeof s;if(n==="bigint")return String(nr(64,s));if(ar(s)){if(n==="string")return Fi(s);if(n==="number")return Ls(s)}})(t),t!=null&&(typeof t=="string"&&so(t),t!=null))switch(me(e,r,0),typeof t){case"number":e=e.g,Ct(t),Rt(e,F,B);break;case"bigint":r=BigInt.asUintN(64,t),r=new Ks(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),Rt(e.g,r.h,r.g);break;default:r=so(t),Rt(e.g,r.h,r.g)}}function wo(e,t,r){(t=Lt(t))!=null&&t!=null&&(me(e,r,0),Vr(e.g,t))}function Ao(e,t,r){(t=Li(t))!=null&&(me(e,r,0),e.g.g.push(t?1:0))}function Eo(e,t,r){(t=Y(t))!=null&&Gr(e,r,si(t))}function ko(e,t,r,s,n){Hr(e,r,go(t,s),n)}function So(e,t,r){(t=t==null||typeof t=="string"||t instanceof ke?t:void 0)!=null&&Gr(e,r,Gs(t,!0).buffer)}function Co(e,t,r){return(e.h===5||e.h===2)&&(t=xt(t,0|t[p],r),e.h==2?Dr(e,Br,t):t.push(Br(e.g)),!0)}var U=J((function(e,t,r){return e.h===5&&(z(t,r,Br(e.g)),!0)}),vo,zr),Yh=Dt(Co,(function(e,t,r){if((t=Ut(Ce,t))!=null)for(let o=0;o<t.length;o++){var s=e,n=r,i=t[o];i!=null&&(me(s,n,5),s=s.g,Es(i),qs(s))}}),zr),nn=Dt(Co,(function(e,t,r){if((t=Ut(Ce,t))!=null&&t.length){me(e,r,2),It(e.g,4*t.length);for(let s=0;s<t.length;s++)r=e.g,Es(t[s]),qs(r)}}),zr),Qh=J((function(e,t,r){return e.h===5&&(z(t,r,(e=Br(e.g))===0?void 0:e),!0)}),vo,zr),Ge=J((function(e,t,r){return ms?(e.h!==0?e=!1:(z(t,r,Ot(e.g,Ci)),e=!0),e):e.h===0&&(z(t,r,Ot(e.g,Ss)),!0)}),_o,oo),on=J((function(e,t,r){return ms?(e.h!==0?t=!1:(z(t,r,(e=Ot(e.g,Ci))===qh?void 0:e),t=!0),t):e.h===0&&(z(t,r,(e=Ot(e.g,Ss))===0?void 0:e),!0)}),_o,oo),Jh=J((function(e,t,r){return ms?(e.h!==0?e=!1:(z(t,r,Ot(e.g,_h)),e=!0),e):e.h===0&&(z(t,r,Ot(e.g,ks)),!0)}),(function(e,t,r){if(t=(function(s){if(s==null)return s;var n=typeof s;if(n==="bigint")return String(wh(64,s));if(ar(s)){if(n==="string")return n=Tt(Number(s)),rt(n)&&n>=0?s=String(n):((n=s.indexOf("."))!==-1&&(s=s.substring(0,n)),(n=s[0]!=="-"&&((n=s.length)<20||n===20&&s<="18446744073709551615"))||(Mr(s),s=sr(F,B))),s;if(n==="number")return(s=Tt(s))>=0&&rt(s)||(Ct(s),s=ks(F,B)),s}})(t),t!=null&&(typeof t=="string"&&ro(t),t!=null))switch(me(e,r,0),typeof t){case"number":e=e.g,Ct(t),Rt(e,F,B);break;case"bigint":r=BigInt.asUintN(64,t),r=new Ws(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),Rt(e.g,r.h,r.g);break;default:r=ro(t),Rt(e.g,r.h,r.g)}}),Gh),W=J((function(e,t,r){return e.h===0&&(z(t,r,Ve(e.g)),!0)}),wo,Zs),dr=Dt((function(e,t,r){return(e.h===0||e.h===2)&&(t=xt(t,0|t[p],r),e.h==2?Dr(e,Ve,t):t.push(Ve(e.g)),!0)}),(function(e,t,r){if((t=Ut(Lt,t))!=null&&t.length){r=Xs(e,r);for(let s=0;s<t.length;s++)Vr(e.g,t[s]);Ys(e,r)}}),Zs),jt=J((function(e,t,r){return e.h===0&&(z(t,r,(e=Ve(e.g))===0?void 0:e),!0)}),wo,Zs),I=J((function(e,t,r){return e.h===0&&(z(t,r,Hs(e.g)),!0)}),Ao,no),lt=J((function(e,t,r){return e.h===0&&(z(t,r,(e=Hs(e.g))===!1?void 0:e),!0)}),Ao,no),Q=Dt((function(e,t,r){return e.h===2&&(e=zs(e),xt(t,0|t[p],r).push(e),!0)}),(function(e,t,r){if((t=Ut(Y,t))!=null)for(let o=0;o<t.length;o++){var s=e,n=r,i=t[o];i!=null&&Gr(s,n,si(i))}}),Js),He=J((function(e,t,r){return e.h===2&&(z(t,r,(e=zs(e))===""?void 0:e),!0)}),Eo,Js),T=J((function(e,t,r){return e.h===2&&(z(t,r,zs(e)),!0)}),Eo,Js),K=(function(e,t,r=Qs){return new Bt(e,t,r)})((function(e,t,r,s,n){return e.h===2&&(s=st(void 0,s),xt(t,0|t[p],r).push(s),lr(e,s,n),!0)}),(function(e,t,r,s,n){if(Array.isArray(t)){for(let i=0;i<t.length;i++)ko(e,t[i],r,s,n);1&(e=0|t[p])||V(t,1|e)}})),N=Wr((function(e,t,r,s,n,i){if(e.h!==2)return!1;let o=0|t[p];return Hi(t,o,i,r,St(o)),lr(e,t=js(t,s,r),n),!0}),ko),To=J((function(e,t,r){return e.h===2&&(z(t,r,to(e)),!0)}),So,ao),Zh=Dt((function(e,t,r){return(e.h===0||e.h===2)&&(t=xt(t,0|t[p],r),e.h==2?Dr(e,Ne,t):t.push(Ne(e.g)),!0)}),(function(e,t,r){if((t=Ut(Pi,t))!=null)for(let o=0;o<t.length;o++){var s=e,n=r,i=t[o];i!=null&&(me(s,n,0),It(s.g,i))}}),io),eu=J((function(e,t,r){return e.h===0&&(z(t,r,(e=Ne(e.g))===0?void 0:e),!0)}),(function(e,t,r){(t=Pi(t))!=null&&t!=null&&(me(e,r,0),It(e.g,t))}),io),ie=J((function(e,t,r){return e.h===0&&(z(t,r,Ve(e.g)),!0)}),(function(e,t,r){(t=Lt(t))!=null&&(t=parseInt(t,10),me(e,r,0),Vr(e.g,t))}),co);class tu{constructor(t,r){var s=oe;this.g=t,this.h=r,this.m=E,this.j=v,this.defaultValue=void 0,this.l=s.Oa!=null?Ai:void 0}register(){Tr(this)}}function Pe(e,t){return new tu(e,t)}function ze(e,t){return(r,s)=>{{const i={ea:!0};s&&Object.assign(i,s),r=Ji(r,void 0,void 0,i);try{const o=new e,a=o.v;sn(t)(a,r);var n=o}finally{Zi(r)}}return n}}function Qr(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}}}};bo(this.v,t,ut(Kr,Xr,Yr,e)),Nt(t,t.g.end());const r=new Uint8Array(t.h),s=t.l,n=s.length;let i=0;for(let o=0;o<n;o++){const a=s[o];r.set(a,i),i+=a.length}return t.l=[r],r}}var Lo=class extends m{constructor(e){super(e)}},Po=[0,He,J((function(e,t,r){return e.h===2&&(z(t,r,(e=to(e))===Ze()?void 0:e),!0)}),(function(e,t,r){if(t!=null){if(t instanceof m){const s=t.Ra;return void(s?(t=s(t),t!=null&&Gr(e,r,Gs(t,!0).buffer)):_t(_s,3))}if(Array.isArray(t))return void _t(_s,3)}So(e,t,r)}),ao)];let an,Mo=globalThis.trustedTypes;function Fo(e){var t;return an===void 0&&(an=(function(){let r=null;if(!Mo)return r;try{const s=n=>n;r=Mo.createPolicy("goog#html",{createHTML:s,createScript:s,createScriptURL:s})}catch{}return r})()),e=(t=an)?t.createScriptURL(e):e,new class{constructor(r){this.g=r}toString(){return this.g+""}}(e)}function ru(e,...t){if(t.length===0)return Fo(e[0]);let r=e[0];for(let s=0;s<t.length;s++)r+=encodeURIComponent(t[s])+e[s+1];return Fo(r)}var xo=[0,W,ie,I,-1,dr,ie,-1,I],su=class extends m{constructor(e){super(e)}},$o=[0,I,T,I,ie,-1,Dt((function(e,t,r){return(e.h===0||e.h===2)&&(t=xt(t,0|t[p],r),e.h==2?Dr(e,Uh,t):t.push(Ve(e.g)),!0)}),(function(e,t,r){if((t=Ut(Lt,t))!=null&&t.length){r=Xs(e,r);for(let s=0;s<t.length;s++)Vr(e.g,t[s]);Ys(e,r)}}),co),T,-1,[0,I,-1],ie,I,-1],Oo=[0,3,I,-1,2,[0,W],[0,ie,I],[0,T,-1],[0]],Ro=[0,T,-2],Io=class extends m{constructor(e){super(e)}},No=[0],Bo=[0,W,I,1,I,-4],oe=class extends m{constructor(e){super(e,2)}},H={};H[336783863]=[0,T,I,-1,W,[0,[1,2,3,4,5,6,7,8,9],N,No,N,$o,N,Ro,N,Bo,N,xo,N,[0,T,-2],N,[0,T,ie],N,Oo,N,[0,ie,-1,I]],[0,T],I,[0,[1,3],[2,4],N,[0,dr],-1,N,[0,Q],-1,K,[0,T,-1]],T];var Uo=[0,on,-1,lt,-3,on,dr,He,jt,on,-1,lt,jt,lt,-2,He];function P(e,t){Nr(e,3,t)}function w(e,t){Nr(e,4,t)}var Z=class extends m{constructor(e){super(e,500)}o(e){return v(this,0,7,e)}},fr=[-1,{}],Do=[0,T,1,fr],jo=[0,T,Q,fr];function ge(e,t){Vs(e,1,Z,t)}function x(e,t){Nr(e,10,t)}function k(e,t){Nr(e,15,t)}var ae=class extends m{constructor(e){super(e,500)}o(e){return v(this,0,1001,e)}},Vo=[-500,K,[-500,He,-1,Q,-3,[-2,H,I],K,Po,jt,-1,Do,jo,K,[0,He,lt],He,Uo,jt,Q,987,Q],4,K,[-500,T,-1,[-1,{}],998,T],K,[-500,T,Q,-1,[-2,{},I],997,Q,-1],jt,K,[-500,T,Q,fr,998,Q],Q,jt,Do,jo,K,[0,He,-1,fr],Q,-2,Uo,He,-1,lt,[0,lt,eu],978,fr,K,Po];ae.prototype.g=Qr(Vo);var nu=ze(ae,Vo),iu=class extends m{constructor(e){super(e)}},Go=class extends m{constructor(e){super(e)}g(){return Re(this,iu,1)}},Ho=[0,K,[0,W,U,T,-1]],Jr=ze(Go,Ho),ou=class extends m{constructor(e){super(e)}},au=class extends m{constructor(e){super(e)}},cn=class extends m{constructor(e){super(e)}l(){return E(this,ou,2)}g(){return Re(this,au,5)}},zo=ze(class extends m{constructor(e){super(e)}},[0,Q,dr,nn,[0,ie,[0,W,-3],[0,U,-3],[0,W,-1,[0,K,[0,W,-2]]],K,[0,U,-1,T,U]],T,-1,Ge,K,[0,W,U],Q,Ge]),Wo=class extends m{constructor(e){super(e)}},Vt=ze(class extends m{constructor(e){super(e)}},[0,K,[0,U,-4]]),Ko=class extends m{constructor(e){super(e)}},pr=ze(class extends m{constructor(e){super(e)}},[0,K,[0,U,-4]]),cu=class extends m{constructor(e){super(e)}},hu=[0,W,-1,nn,ie],qo=class extends m{constructor(e){super(e)}};qo.prototype.g=Qr([0,U,-4,Ge]);var uu=class extends m{constructor(e){super(e)}},lu=ze(class extends m{constructor(e){super(e)}},[0,K,[0,1,W,T,Ho],Ge]),Xo=class extends m{constructor(e){super(e)}},du=class extends m{constructor(e){super(e)}na(){const e=L(this,1,void 0,void 0,Vi);return e??Ze()}},fu=class extends m{constructor(e){super(e)}},Yo=[1,2],pu=ze(class extends m{constructor(e){super(e)}},[0,K,[0,Yo,N,[0,nn],N,[0,To],W,T],Ge]),hn=class extends m{constructor(e){super(e)}},Qo=[0,T,W,U,Q,-1],Jo=class extends m{constructor(e){super(e)}},mu=[0,I,-1],Zo=class extends m{constructor(e){super(e)}},Zr=[1,2,3,4,5,6],es=class extends m{constructor(e){super(e)}g(){return L(this,1,void 0,void 0,Vi)!=null}l(){return Y(L(this,2))!=null}},$=class extends m{constructor(e){super(e)}g(){return Li(L(this,2))??!1}},ea=[0,To,T,[0,W,Ge,-1],[0,Jh,Ge]],D=[0,ea,I,[0,Zr,N,Bo,N,$o,N,xo,N,No,N,Ro,N,Oo],ie],ts=class extends m{constructor(e){super(e)}},un=[0,D,U,-1,W],gu=Pe(502141897,ts);H[502141897]=un;var yu=ze(class extends m{constructor(e){super(e)}},[0,[0,ie,-1,Yh,Zh],hu]),ta=class extends m{constructor(e){super(e)}},ra=class extends m{constructor(e){super(e)}},ln=[0,D,U,[0,D],I],bu=Pe(508968150,ra);H[508968150]=[0,D,un,ln,U,[0,[0,ea]]],H[508968149]=ln;var Gt=class extends m{constructor(e){super(e)}l(){return E(this,hn,2)}g(){S(this,2)}},sa=[0,D,Qo];H[478825465]=sa;var vu=class extends m{constructor(e){super(e)}},na=class extends m{constructor(e){super(e)}},dn=class extends m{constructor(e){super(e)}},fn=class extends m{constructor(e){super(e)}},ia=class extends m{constructor(e){super(e)}},oa=[0,D,[0,D],sa,-1],aa=[0,D,U,W],pn=[0,D,U],ca=[0,D,aa,pn,U],_u=Pe(479097054,ia);H[479097054]=[0,D,ca,oa],H[463370452]=oa,H[464864288]=aa;var wu=Pe(462713202,fn);H[462713202]=ca,H[474472470]=pn;var Au=class extends m{constructor(e){super(e)}},ha=class extends m{constructor(e){super(e)}},ua=class extends m{constructor(e){super(e)}},la=class extends m{constructor(e){super(e)}},mn=[0,D,U,-1,W],gn=[0,D,U,I];la.prototype.g=Qr([0,D,pn,[0,D],un,ln,mn,gn]);var da=class extends m{constructor(e){super(e)}},Eu=Pe(456383383,da);H[456383383]=[0,D,Qo];var fa=class extends m{constructor(e){super(e)}},ku=Pe(476348187,fa);H[476348187]=[0,D,mu];var pa=class extends m{constructor(e){super(e)}},ma=class extends m{constructor(e){super(e)}},ga=[0,ie,-1],Su=Pe(458105876,class extends m{constructor(e){super(e)}g(){let e;var t=this.v;const r=0|t[p];return e=re(this,r),t=(function(s,n,i,o){var a=ma;!o&&Mt(s)&&(i=0|(n=s.v)[p]);var c=Oe(n,2);if(s=!1,c==null){if(o)return Ii();c=[]}else if(c.constructor===$e){if(!(2&c.J)||o)return c;c=c.V()}else Array.isArray(c)?s=!!(2&(0|c[p])):c=[];if(o){if(!c.length)return Ii();s||(s=!0,tr(c))}else s&&(s=!1,rr(c),c=Gi(c));return!s&&32&i&&er(c,32),i=G(n,i,2,o=new $e(c,a,Sh,void 0)),s||nt(n,i),o})(this,t,r,e),!e&&ma&&(t.ra=!0),t}});H[458105876]=[0,ga,Xh,[!0,Ge,[0,T,-1,Q]],[0,dr,I,ie]];var yn=class extends m{constructor(e){super(e)}},ya=Pe(458105758,yn);H[458105758]=[0,D,T,ga];var bn=class extends m{constructor(e){super(e)}},ba=[0,Qh,-1,lt],Cu=class extends m{constructor(e){super(e)}},va=class extends m{constructor(e){super(e)}},vn=[1,2];va.prototype.g=Qr([0,vn,N,ba,N,[0,K,ba]]);var _a=class extends m{constructor(e){super(e)}},Tu=Pe(443442058,_a);H[443442058]=[0,D,T,W,U,Q,-1,I,U],H[514774813]=mn;var wa=class extends m{constructor(e){super(e)}},Lu=Pe(516587230,wa);function _n(e,t){return t=t?t.clone():new hn,e.displayNamesLocale!==void 0?S(t,1,cr(e.displayNamesLocale)):e.displayNamesLocale===void 0&&S(t,1),e.maxResults!==void 0?Ie(t,2,e.maxResults):"maxResults"in e&&S(t,2),e.scoreThreshold!==void 0?y(t,3,e.scoreThreshold):"scoreThreshold"in e&&S(t,3),e.categoryAllowlist!==void 0?Ir(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&S(t,4),e.categoryDenylist!==void 0?Ir(t,5,e.categoryDenylist):"categoryDenylist"in e&&S(t,5),t}function Aa(e){const t=Number(e);return Number.isSafeInteger(t)?t:String(e)}function wn(e,t=-1,r=""){return{categories:e.map((s=>({index:pe(s,1)??0??-1,score:R(s,2)??0,categoryName:Y(L(s,3))??""??"",displayName:Y(L(s,4))??""??""}))),headIndex:t,headName:r}}function Pu(e){const t={classifications:Re(e,uu,1).map((r=>{var s;return wn(((s=E(r,Go,4))==null?void 0:s.g())??[],pe(r,2)??0,Y(L(r,3))??"")}))};return(function(r){return kh(gs?L(r,2,void 0,void 0,xr):L(r,2))})(e)!=null&&(t.timestampMs=Aa(qi(e))),t}function Ea(e){var o,a;var t=ot(e,3,Ce,it()),r=ot(e,2,Lt,it()),s=ot(e,1,Y,it()),n=ot(e,9,Y,it());const i={categories:[],keypoints:[]};for(let c=0;c<t.length;c++)i.categories.push({score:t[c],index:r[c]??-1,categoryName:s[c]??"",displayName:n[c]??""});if((t=(o=E(e,cn,4))==null?void 0:o.l())&&(i.boundingBox={originX:pe(t,1,De)??0,originY:pe(t,2,De)??0,width:pe(t,3,De)??0,height:pe(t,4,De)??0,angle:0}),(a=E(e,cn,4))==null?void 0:a.g().length)for(const c of E(e,cn,4).g())i.keypoints.push({x:L(c,1,void 0,De,Ce)??0,y:L(c,2,void 0,De,Ce)??0,score:L(c,4,void 0,De,Ce)??0,label:Y(L(c,3,void 0,De))??""});return i}function rs(e){const t=[];for(const r of Re(e,Ko,1))t.push({x:R(r,1)??0,y:R(r,2)??0,z:R(r,3)??0,visibility:R(r,4)??0});return t}function mr(e){const t=[];for(const r of Re(e,Wo,1))t.push({x:R(r,1)??0,y:R(r,2)??0,z:R(r,3)??0,visibility:R(r,4)??0});return t}function ka(e){return Array.from(e,(t=>t>127?t-256:t))}function Sa(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,s=0,n=0;for(let i=0;i<e.length;i++)r+=e[i]*t[i],s+=e[i]*e[i],n+=t[i]*t[i];if(s<=0||n<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return r/Math.sqrt(s*n)}let ss;H[516587230]=[0,D,mn,gn,U],H[518928384]=gn;const Mu=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 Ca(){if(ss===void 0)try{await WebAssembly.instantiate(Mu),ss=!0}catch{ss=!1}return ss}async function gr(e,t=ru``){const r=await Ca()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var dt=class{};function Ta(){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 La(e){if(typeof importScripts!="function"){const t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise(((r,s)=>{t.addEventListener("load",(()=>{r()}),!1),t.addEventListener("error",(n=>{s(n)}),!1),document.body.appendChild(t)}))}try{importScripts(e.toString())}catch(t){if(!(t instanceof TypeError))throw t;await self.import(e.toString())}}function Pa(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 g(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 Ma(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[s,n]=Pa(t);return!e.l||s===e.i.canvas.width&&n===e.i.canvas.height||(e.i.canvas.width=s,e.i.canvas.height=n),[s,n]}function Fa(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const s=new Uint32Array(t.length);for(let n=0;n<t.length;n++)s[n]=e.i.stringToNewUTF8(t[n]);t=e.i._malloc(4*s.length),e.i.HEAPU32.set(s,t>>2),r(t);for(const n of s)e.i._free(n);e.i._free(t)}function Me(e,t,r){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=r}function We(e,t,r){let s=[];e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=(n,i,o)=>{i?(r(s,o),s=[]):s.push(n)}}dt.forVisionTasks=function(e){return gr("vision",e)},dt.forTextTasks=function(e){return gr("text",e)},dt.forGenAiExperimentalTasks=function(e){return gr("genai_experimental",e)},dt.forGenAiTasks=function(e){return gr("genai",e)},dt.forAudioTasks=function(e){return gr("audio",e)},dt.isSimdSupported=function(){return Ca()};async function Fu(e,t,r,s){return e=await(async(n,i,o,a,c)=>{if(i&&await La(i),!self.ModuleFactory||o&&(await La(o),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&c&&((i=self.Module).locateFile=c.locateFile,c.mainScriptUrlOrBlob&&(i.mainScriptUrlOrBlob=c.mainScriptUrlOrBlob)),c=await self.ModuleFactory(self.Module||c),self.ModuleFactory=self.Module=void 0,new n(c,a)})(e,r.wasmLoaderPath,r.assetLoaderPath,t,{locateFile:n=>n.endsWith(".wasm")?r.wasmBinaryPath.toString():r.assetBinaryPath&&n.endsWith(".data")?r.assetBinaryPath.toString():n}),await e.o(s),e}function An(e,t){const r=E(e.baseOptions,es,1)||new es;typeof t=="string"?(S(r,2,cr(t)),S(r,1)):t instanceof Uint8Array&&(S(r,1,ws(t,!1)),S(r,2)),v(e.baseOptions,0,1,r)}function xa(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 f(e,t){e.C=Math.max(e.C,t)}function ns(e,t){e.B=new Z,ne(e.B,2,"PassThroughCalculator"),P(e.B,"free_memory"),w(e.B,"free_memory_unused_out"),x(t,"free_memory"),ge(t,e.B)}function Ht(e,t){P(e.B,t),w(e.B,t+"_unused_out")}function is(e){e.g.addBoolToStream(!0,"free_memory",e.C)}var En=class{constructor(e){this.g=e,this.H=[],this.C=0,this.g.setAutoRenderToScreen(!1)}l(e,t=!0){var r,s,n,i,o,a;if(t){const c=e.baseOptions||{};if((r=e.baseOptions)!=null&&r.modelAssetBuffer&&((s=e.baseOptions)!=null&&s.modelAssetPath))throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!((n=E(this.baseOptions,es,1))!=null&&n.g()||(i=E(this.baseOptions,es,1))!=null&&i.l()||(o=e.baseOptions)!=null&&o.modelAssetBuffer||(a=e.baseOptions)!=null&&a.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if((function(u,h){let l=E(u.baseOptions,Zo,3);if(!l){var d=l=new Zo,b=new Io;ur(d,4,Zr,b)}"delegate"in h&&(h.delegate==="GPU"?(h=l,d=new su,ur(h,2,Zr,d)):(h=l,d=new Io,ur(h,4,Zr,d))),v(u.baseOptions,0,3,l)})(this,c),c.modelAssetPath)return fetch(c.modelAssetPath.toString()).then((u=>{if(u.ok)return u.arrayBuffer();throw Error(`Failed to fetch model: ${c.modelAssetPath} (${u.status})`)})).then((u=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(u),!0,!1,!1),An(this,"/model.dat"),this.m(),this.L()}));if(c.modelAssetBuffer instanceof Uint8Array)An(this,c.modelAssetBuffer);else if(c.modelAssetBuffer)return(async function(u){const h=[];for(var l=0;;){const{done:d,value:b}=await u.read();if(d)break;h.push(b),l+=b.length}if(h.length===0)return new Uint8Array(0);if(h.length===1)return h[0];u=new Uint8Array(l),l=0;for(const d of h)u.set(d,l),l+=d.length;return u})(c.modelAssetBuffer).then((u=>{An(this,u),this.m(),this.L()}))}return this.m(),this.L(),Promise.resolve()}L(){}ca(){let e;if(this.g.ca((t=>{e=nu(t)})),!e)throw Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.g.attachErrorListener(((r,s)=>{this.H.push(Error(s))})),this.g.Ja(),this.g.setGraph(e,t),this.B=void 0,xa(this)}finishProcessing(){this.g.finishProcessing(),xa(this)}close(){this.B=void 0,this.g.closeGraph()}};function Ke(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}En.prototype.close=En.prototype.close;class xu{constructor(t,r,s,n){this.g=t,this.h=r,this.m=s,this.l=n}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}}function $a(e,t,r){const s=e.g;if(r=Ke(s.createShader(r),"Failed to create WebGL shader"),s.shaderSource(r,t),s.compileShader(r),!s.getShaderParameter(r,s.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${s.getShaderInfoLog(r)}`);return s.attachShader(e.h,r),r}function Oa(e,t){const r=e.g,s=Ke(r.createVertexArray(),"Failed to create vertex array");r.bindVertexArray(s);const n=Ke(r.createBuffer(),"Failed to create buffer");r.bindBuffer(r.ARRAY_BUFFER,n),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=Ke(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 xu(r,s,n,i)}function kn(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function $u(e,t,r,s){return kn(e,t),e.h||(e.m(),e.D()),r?(e.u||(e.u=Oa(e,!0)),r=e.u):(e.A||(e.A=Oa(e,!1)),r=e.A),t.useProgram(e.h),r.bind(),e.l(),e=s(),r.g.bindVertexArray(null),e}function Ra(e,t,r){return kn(e,t),e=Ke(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 Ia(e,t,r){kn(e,t),e.B||(e.B=Ke(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 Ou(e){var t;(t=e.g)==null||t.bindFramebuffer(e.g.FRAMEBUFFER,null)}var Na=class{H(){return`
1
+ (function(_,yt){typeof exports=="object"&&typeof module<"u"?yt(exports):typeof define=="function"&&define.amd?define(["exports"],yt):(_=typeof globalThis<"u"?globalThis:_||self,yt(_.SimFaceSDK={}))})(this,(function(_){"use strict";var Yc;const yt="https://simface-api-85584555549.europe-west1.run.app";function Jc(e){return typeof e!="string"?yt:e.trim().replace(/\/$/,"")||yt}async function ds(e,t){try{const r=await e.json();if(typeof r.error=="string"&&r.error.trim())return r.error.trim()}catch{}return`${t} (HTTP ${e.status})`}class fs{constructor(t){this.apiUrl=Jc(t.apiUrl),this.projectId=t.projectId,this.apiKey=t.apiKey}async validateAPIKey(){const t=await fetch(`${this.apiUrl}/api/v1/auth/validate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:this.projectId,apiKey:this.apiKey})});if(!t.ok)throw new Error(await ds(t,"API key validation failed"));return t.json()}async enroll(t,r){const s=new FormData;s.append("projectId",this.projectId),s.append("apiKey",this.apiKey),s.append("clientId",t),s.append("image",r,"face.jpg");const n=await fetch(`${this.apiUrl}/api/v1/enroll`,{method:"POST",body:s});if(n.status===409)return{success:!1,clientId:t,alreadyEnrolled:!0,message:"User already enrolled"};if(!n.ok)throw new Error(await ds(n,"Enrollment failed"));return n.json()}async verify(t,r){const s=new FormData;s.append("projectId",this.projectId),s.append("apiKey",this.apiKey),s.append("clientId",t),s.append("image",r,"face.jpg");const n=await fetch(`${this.apiUrl}/api/v1/verify`,{method:"POST",body:s});if(n.status===404)return{match:!1,score:0,threshold:0,notEnrolled:!0,message:"User not enrolled"};if(!n.ok)throw new Error(await ds(n,"Verification failed"));return n.json()}}var bt=typeof self<"u"?self:{};function Qt(e,t){e:{for(var r=["CLOSURE_FLAGS"],s=bt,n=0;n<r.length;n++)if((s=s[r[n]])==null){r=null;break e}r=s}return(e=r&&r[e])!=null?e:t}function Qe(){throw Error("Invalid UTF8")}function si(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}let Cr,ps;const Zc=typeof TextDecoder<"u";let eh;const th=typeof TextEncoder<"u";function ni(e){if(th)e=(eh||(eh=new TextEncoder)).encode(e);else{let r=0;const s=new Uint8Array(3*e.length);for(let n=0;n<e.length;n++){var t=e.charCodeAt(n);if(t<128)s[r++]=t;else{if(t<2048)s[r++]=t>>6|192;else{if(t>=55296&&t<=57343){if(t<=56319&&n<e.length){const i=e.charCodeAt(++n);if(i>=56320&&i<=57343){t=1024*(t-55296)+i-56320+65536,s[r++]=t>>18|240,s[r++]=t>>12&63|128,s[r++]=t>>6&63|128,s[r++]=63&t|128;continue}n--}t=65533}s[r++]=t>>12|224,s[r++]=t>>6&63|128}s[r++]=63&t|128}}e=r===s.length?s:s.subarray(0,r)}return e}function ii(e){bt.setTimeout((()=>{throw e}),0)}var ms,rh=Qt(610401301,!1),oi=Qt(748402147,!0),gs=Qt(824648567,!0),ys=Qt(824656860,Qt(1,!0));function ai(){var e=bt.navigator;return e&&(e=e.userAgent)?e:""}const ci=bt.navigator;function Tr(e){return Tr[" "](e),e}ms=ci&&ci.userAgentData||null,Tr[" "]=function(){};const hi={};let Jt=null;function sh(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 s=new Uint8Array(r);let n=0;return(function(i,o){function a(u){for(;c<i.length;){const h=i.charAt(c++),l=Jt[h];if(l!=null)return l;if(!/^[\s\xa0]*$/.test(h))throw Error("Unknown base64 encoding at char: "+h)}return u}ui();let c=0;for(;;){const u=a(-1),h=a(0),l=a(64),d=a(64);if(d===64&&u===-1)break;o(u<<2|h>>4),l!=64&&(o(h<<4&240|l>>2),d!=64&&o(l<<6&192|d))}})(e,(function(i){s[n++]=i})),n!==r?s.subarray(0,n):s}function ui(){if(!Jt){Jt={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){const s=e.concat(t[r].split(""));hi[r]=s;for(let n=0;n<s.length;n++){const i=s[n];Jt[i]===void 0&&(Jt[i]=n)}}}}var nh=typeof Uint8Array<"u",li=!(!(rh&&ms&&ms.brands.length>0)&&(ai().indexOf("Trident")!=-1||ai().indexOf("MSIE")!=-1))&&typeof btoa=="function";const di=/[-_.]/g,ih={"-":"+",_:"/",".":"="};function oh(e){return ih[e]||""}function fi(e){if(!li)return sh(e);e=di.test(e)?e.replace(di,oh):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 bs(e){return nh&&e!=null&&e instanceof Uint8Array}var vt={};function Je(){return ah||(ah=new ke(null,vt))}function vs(e){pi(vt);var t=e.g;return(t=t==null||bs(t)?t:typeof t=="string"?fi(t):null)==null?t:e.g=t}var ke=class{h(){return new Uint8Array(vs(this)||0)}constructor(t,r){if(pi(r),this.g=t,t!=null&&t.length===0)throw Error("ByteString should be constructed with non-empty values")}};let ah,ch;function pi(e){if(e!==vt)throw Error("illegal external caller")}function mi(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function _s(e){return mi(e=Error(e),"warning"),e}function _t(e,t){if(e!=null){var r=ch??(ch={}),s=r[e]||0;s>=t||(r[e]=s+1,mi(e=Error(),"incident"),ii(e))}}function wt(){return typeof BigInt=="function"}var At=typeof Symbol=="function"&&typeof Symbol()=="symbol";function Se(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 hh=Se("jas",void 0,!0),gi=Se(void 0,"0di"),Zt=Se(void 0,"1oa"),te=Se(void 0,Symbol()),uh=Se(void 0,"0ub"),lh=Se(void 0,"0ubs"),ws=Se(void 0,"0ubsb"),dh=Se(void 0,"0actk"),Et=Se("m_m","Pa",!0),yi=Se();const bi={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},vi=Object.defineProperties,p=At?hh:"Ga";var Ze;const _i=[];function er(e,t){At||p in e||vi(e,bi),e[p]|=t}function V(e,t){At||p in e||vi(e,bi),e[p]=t}function tr(e){return er(e,34),e}function rr(e){return er(e,8192),e}V(_i,7),Ze=Object.freeze(_i);var kt={};function re(e,t){return t===void 0?e.h!==et&&!!(2&(0|e.v[p])):!!(2&t)&&e.h!==et}const et={};function As(e,t){if(e!=null){if(typeof e=="string")e=e?new ke(e,vt):Je();else if(e.constructor!==ke)if(bs(e))e=e.length?new ke(new Uint8Array(e),vt):Je();else{if(!t)throw Error();e=void 0}}return e}class wi{constructor(t,r,s){this.g=t,this.h=r,this.l=s}next(){const t=this.g.next();return t.done||(t.value=this.h.call(this.l,t.value)),t}[Symbol.iterator](){return this}}var fh=Object.freeze({});function Ai(e,t,r){const s=128&t?0:-1,n=e.length;var i;(i=!!n)&&(i=(i=e[n-1])!=null&&typeof i=="object"&&i.constructor===Object);const o=n+(i?-1:0);for(t=128&t?1:0;t<o;t++)r(t-s,e[t]);if(i){e=e[n-1];for(const a in e)!isNaN(a)&&r(+a,e[a])}}var Ei={};function St(e){return 128&e?Ei:void 0}function Lr(e){return e.Na=!0,e}var ph=Lr((e=>typeof e=="number")),ki=Lr((e=>typeof e=="string")),mh=Lr((e=>typeof e=="boolean")),Pr=typeof bt.BigInt=="function"&&typeof bt.BigInt(0)=="bigint";function se(e){var t=e;if(ki(t)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(t))throw Error(String(t))}else if(ph(t)&&!Number.isSafeInteger(t))throw Error(String(t));return Pr?BigInt(e):e=mh(e)?e?"1":"0":ki(e)?e.trim()||"0":String(e)}var Es=Lr((e=>Pr?e>=yh&&e<=vh:e[0]==="-"?Si(e,gh):Si(e,bh)));const gh=Number.MIN_SAFE_INTEGER.toString(),yh=Pr?BigInt(Number.MIN_SAFE_INTEGER):void 0,bh=Number.MAX_SAFE_INTEGER.toString(),vh=Pr?BigInt(Number.MAX_SAFE_INTEGER):void 0;function Si(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 s=e[r],n=t[r];if(s>n)return!1;if(s<n)return!0}}const _h=typeof Uint8Array.prototype.slice=="function";let wh,F=0,U=0;function Ci(e){const t=e>>>0;F=t,U=(e-t)/4294967296>>>0}function Ct(e){if(e<0){Ci(-e);const[t,r]=Ls(F,U);F=t>>>0,U=r>>>0}else Ci(e)}function ks(e){const t=wh||(wh=new DataView(new ArrayBuffer(8)));t.setFloat32(0,+e,!0),U=0,F=t.getUint32(0,!0)}function Ss(e,t){const r=4294967296*t+(e>>>0);return Number.isSafeInteger(r)?r:sr(e,t)}function Ah(e,t){return se(wt()?BigInt.asUintN(64,(BigInt(t>>>0)<<BigInt(32))+BigInt(e>>>0)):sr(e,t))}function Cs(e,t){const r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=Ss(e,t))=="number"?r?-e:e:r?"-"+e:e}function Ti(e,t){return wt()?se(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(t))<<BigInt(32))+BigInt.asUintN(32,BigInt(e)))):se(Ts(e,t))}function sr(e,t){if(e>>>=0,(t>>>=0)<=2097151)var r=""+(4294967296*t+e);else wt()?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+Li(r)+Li(e));return r}function Li(e){return e=String(e),"0000000".slice(e.length)+e}function Ts(e,t){if(2147483648&t)if(wt())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{const[r,s]=Ls(e,t);e="-"+sr(r,s)}else e=sr(e,t);return e}function Mr(e){if(e.length<16)Ct(Number(e));else if(wt())e=BigInt(e),F=Number(e&BigInt(4294967295))>>>0,U=Number(e>>BigInt(32)&BigInt(4294967295));else{const t=+(e[0]==="-");U=F=0;const r=e.length;for(let s=t,n=(r-t)%6+t;n<=r;s=n,n+=6){const i=Number(e.slice(s,n));U*=1e6,F=1e6*F+i,F>=4294967296&&(U+=Math.trunc(F/4294967296),U>>>=0,F>>>=0)}if(t){const[s,n]=Ls(F,U);F=s,U=n}}}function Ls(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}function ve(e){return Array.prototype.slice.call(e)}const nr=typeof BigInt=="function"?BigInt.asIntN:void 0,Eh=typeof BigInt=="function"?BigInt.asUintN:void 0,tt=Number.isSafeInteger,Fr=Number.isFinite,Tt=Math.trunc,kh=se(0);function ir(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 Ce(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function or(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 Pi(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}const Sh=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function ar(e){switch(typeof e){case"bigint":return!0;case"number":return Fr(e);case"string":return Sh.test(e);default:return!1}}function Lt(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return Fr(e)?0|e:void 0}function Mi(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return Fr(e)?e>>>0:void 0}function Fi(e){const t=e.length;return(e[0]==="-"?t<20||t===20&&e<="-9223372036854775808":t<19||t===19&&e<="9223372036854775807")?e:(Mr(e),Ts(F,U))}function Ps(e){return e=Tt(e),tt(e)||(Ct(e),e=Cs(F,U)),e}function xi(e){var t=Tt(Number(e));return tt(t)?String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Fi(e))}function $i(e){var t=Tt(Number(e));return tt(t)?se(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),wt()?se(nr(64,BigInt(e))):se(Fi(e)))}function Oi(e){return tt(e)?e=se(Ps(e)):(e=Tt(e),tt(e)?e=String(e):(Ct(e),e=Ts(F,U)),e=se(e)),e}function Ch(e){return e==null?e:typeof e=="bigint"?(Es(e)?e=Number(e):(e=nr(64,e),e=Es(e)?Number(e):String(e)),e):ar(e)?typeof e=="number"?Ps(e):xi(e):void 0}function xr(e){const t=typeof e;return e==null?e:t==="bigint"?se(nr(64,e)):ar(e)?t==="string"?$i(e):Oi(e):void 0}function Ri(e){if(typeof e!="string")throw Error();return e}function cr(e){if(e!=null&&typeof e!="string")throw Error();return e}function Y(e){return e==null||typeof e=="string"?e:void 0}function Ms(e,t,r,s){return e!=null&&e[Et]===kt?e:Array.isArray(e)?((s=(r=0|e[p])|32&s|2&s)!==r&&V(e,s),new t(e)):(r?2&s?((e=t[gi])||(tr((e=new t).v),e=t[gi]=e),t=e):t=new t:t=void 0,t)}function Th(e,t,r){if(t)e:{if(!ar(t=e))throw _s("int64");switch(typeof t){case"string":t=$i(t);break e;case"bigint":t=se(nr(64,t));break e;default:t=Oi(t)}}else t=xr(e);return(e=t)==null?r?kh:void 0:e}const Lh={};let Ph=(function(){try{return Tr(new class extends Map{constructor(){super()}}),!1}catch{return!0}})();class Fs{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 Mh=Ph?(Object.setPrototypeOf(Fs.prototype,Map.prototype),Object.defineProperties(Fs.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),Fs):class extends Map{constructor(){super()}};function Ii(e){return e}function xs(e){if(2&e.J)throw Error("Cannot mutate an immutable Map")}var $e=class extends Mh{constructor(e,t,r=Ii,s=Ii){super(),this.J=0|e[p],this.K=t,this.S=r,this.fa=this.K?Fh:s;for(let n=0;n<e.length;n++){const i=e[n],o=r(i[0],!1,!0);let a=i[1];t?a===void 0&&(a=null):a=s(i[1],!1,!0,void 0,void 0,this.J),super.set(o,a)}}V(e){return rr(Array.from(super.entries(),e))}clear(){xs(this),super.clear()}delete(e){return xs(this),super.delete(this.S(e,!0,!1))}entries(){if(this.K){var e=super.keys();e=new wi(e,xh,this)}else e=super.entries();return e}values(){if(this.K){var e=super.keys();e=new wi(e,$e.prototype.get,this)}else e=super.values();return e}forEach(e,t){this.K?super.forEach(((r,s,n)=>{e.call(t,n.get(s),s,n)})):super.forEach(e,t)}set(e,t){return xs(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 Fh(e,t,r,s,n,i){return e=Ms(e,s,r,i),n&&(e=Rs(e)),e}function xh(e){return[e,this.get(e)]}let $h;function Ni(){return $h||($h=new $e(tr([]),void 0,void 0,void 0,Lh))}function $r(e){return te?e[te]:void 0}function Or(e,t){for(const r in e)!isNaN(r)&&t(e,+r,e[r])}$e.prototype.toJSON=void 0;var $s=class{};const Oh={Ka:!0};function Rh(e,t){t<100||_t(lh,1)}function Rr(e,t,r,s){const n=s!==void 0;s=!!s;var i,o=te;!n&&At&&o&&(i=e[o])&&Or(i,Rh),o=[];var a=e.length;let c;i=4294967295;let u=!1;const h=!!(64&t),l=h?128&t?0:-1:void 0;1&t||(c=a&&e[a-1],c!=null&&typeof c=="object"&&c.constructor===Object?i=--a:c=void 0,!h||128&t||n||(u=!0,i=i-l+l)),t=void 0;for(var d=0;d<a;d++){let b=e[d];if(b!=null&&(b=r(b,s))!=null)if(h&&d>=i){const C=d-l;(t??(t={}))[C]=b}else o[d]=b}if(c)for(let b in c){if((a=c[b])==null||(a=r(a,s))==null)continue;let C;d=+b,h&&!Number.isNaN(d)&&(C=d+l)<i?o[C]=a:(t??(t={}))[b]=a}return t&&(u?o.push(t):o[i]=t),n&&te&&(e=$r(e))&&e instanceof $s&&(o[te]=(function(b){const C=new $s;return Or(b,((ti,Yt,Sr)=>{C[Yt]=ve(Sr)})),C.da=b.da,C})(e)),o}function Ih(e){return e[0]=hr(e[0]),e[1]=hr(e[1]),e}function hr(e){switch(typeof e){case"number":return Number.isFinite(e)?e:""+e;case"bigint":return Es(e)?Number(e):""+e;case"boolean":return e?1:0;case"object":if(Array.isArray(e)){var t=0|e[p];return e.length===0&&1&t?void 0:Rr(e,t,hr)}if(e!=null&&e[Et]===kt)return Ui(e);if(e instanceof ke){if((t=e.g)==null)e="";else if(typeof t=="string")e=t;else{if(li){for(var r="",s=0,n=t.length-10240;s<n;)r+=String.fromCharCode.apply(null,t.subarray(s,s+=10240));r+=String.fromCharCode.apply(null,s?t.subarray(s):t),t=btoa(r)}else{r===void 0&&(r=0),ui(),r=hi[r],s=Array(Math.floor(t.length/3)),n=r[64]||"";let u=0,h=0;for(;u<t.length-2;u+=3){var i=t[u],o=t[u+1],a=t[u+2],c=r[i>>2];i=r[(3&i)<<4|o>>4],o=r[(15&o)<<2|a>>6],a=r[63&a],s[h++]=c+i+o+a}switch(c=0,a=n,t.length-u){case 2:a=r[(15&(c=t[u+1]))<<2]||n;case 1:t=t[u],s[h]=r[t>>2]+r[(3&t)<<4|c>>4]+a+n}t=s.join("")}e=e.g=t}return e}return e instanceof $e?e=e.size!==0?e.V(Ih):void 0:void 0}return e}function Ui(e){return Rr(e=e.v,0|e[p],hr)}let Nh,Uh;function rt(e,t){return Bi(e,t[0],t[1])}function Bi(e,t,r,s=0){if(e==null){var n=32;r?(e=[r],n|=128):e=[],t&&(n=-16760833&n|(1023&t)<<14)}else{if(!Array.isArray(e))throw Error("narr");if(n=0|e[p],oi&&1&n)throw Error("rfarr");if(2048&n&&!(2&n)&&(function(){if(oi)throw Error("carr");_t(dh,5)})(),256&n)throw Error("farr");if(64&n)return(n|s)!==n&&V(e,n|s),e;if(r&&(n|=128,r!==e[0]))throw Error("mid");e:{n|=64;var i=(r=e).length;if(i){var o=i-1;const c=r[o];if(c!=null&&typeof c=="object"&&c.constructor===Object){if((o-=t=128&n?0:-1)>=1024)throw Error("pvtlmt");for(var a in c)(i=+a)<o&&(r[i+t]=c[a],delete c[a]);n=-16760833&n|(1023&o)<<14;break e}}if(t){if((a=Math.max(t,i-(128&n?0:-1)))>1024)throw Error("spvt");n=-16760833&n|(1023&a)<<14}}}return V(e,64|n|s),e}function Bh(e,t){if(typeof e!="object")return e;if(Array.isArray(e)){var r=0|e[p];return e.length===0&&1&r?void 0:Di(e,r,t)}if(e!=null&&e[Et]===kt)return ji(e);if(e instanceof $e){if(2&(t=e.J))return e;if(!e.size)return;if(r=tr(e.V()),e.K)for(e=0;e<r.length;e++){const s=r[e];let n=s[1];n=n==null||typeof n!="object"?void 0:n!=null&&n[Et]===kt?ji(n):Array.isArray(n)?Di(n,0|n[p],!!(32&t)):void 0,s[1]=n}return r}return e instanceof ke?e:void 0}function Di(e,t,r){return 2&t||(!r||4096&t||16&t?e=Pt(e,t,!1,r&&!(16&t)):(er(e,34),4&t&&Object.freeze(e))),e}function Os(e,t,r){return e=new e.constructor(t),r&&(e.h=et),e.m=et,e}function ji(e){const t=e.v,r=0|t[p];return re(e,r)?e:Is(e,t,r)?Os(e,t):Pt(t,r)}function Pt(e,t,r,s){return s??(s=!!(34&t)),e=Rr(e,t,Bh,s),s=32,r&&(s|=2),V(e,t=16769217&t|s),e}function Rs(e){const t=e.v,r=0|t[p];return re(e,r)?Is(e,t,r)?Os(e,t,!0):new e.constructor(Pt(t,r,!1)):e}function Mt(e){if(e.h!==et)return!1;var t=e.v;return er(t=Pt(t,0|t[p]),2048),e.v=t,e.h=void 0,e.m=void 0,!0}function Ft(e){if(!Mt(e)&&re(e,0|e.v[p]))throw Error()}function st(e,t){t===void 0&&(t=0|e[p]),32&t&&!(4096&t)&&V(e,4096|t)}function Is(e,t,r){return!!(2&r)||!(!(32&r)||4096&r)&&(V(t,2|r),e.h=et,!0)}const Dh=se(0),De={};function L(e,t,r,s,n){if((t=Oe(e.v,t,r,n))!==null||s&&e.m!==et)return t}function Oe(e,t,r,s){if(t===-1)return null;const n=t+(r?0:-1),i=e.length-1;let o,a;if(!(i<1+(r?0:-1))){if(n>=i)if(o=e[i],o!=null&&typeof o=="object"&&o.constructor===Object)r=o[t],a=!0;else{if(n!==i)return;r=o}else r=e[n];if(s&&r!=null){if((s=s(r))==null)return s;if(!Object.is(s,r))return a?o[t]=s:e[n]=s,s}return r}}function S(e,t,r,s){Ft(e),G(e=e.v,0|e[p],t,r,s)}function G(e,t,r,s,n){const i=r+(n?0:-1);var o=e.length-1;if(o>=1+(n?0:-1)&&i>=o){const a=e[o];if(a!=null&&typeof a=="object"&&a.constructor===Object)return a[r]=s,t}return i<=o?(e[i]=s,t):(s!==void 0&&(r>=(o=(t??(t=0|e[p]))>>14&1023||536870912)?s!=null&&(e[o+(n?0:-1)]={[r]:s}):e[i]=s),t)}function nt(){return fh===void 0?2:4}function it(e,t,r,s,n){let i=e.v,o=0|i[p];s=re(e,o)?1:s,n=!!n||s===3,s===2&&Mt(e)&&(i=e.v,o=0|i[p]);let a=(e=Ns(i,t))===Ze?7:0|e[p],c=Us(a,o);var u=!(4&c);if(u){4&c&&(e=ve(e),a=0,c=at(c,o),o=G(i,o,t,e));let h=0,l=0;for(;h<e.length;h++){const d=r(e[h]);d!=null&&(e[l++]=d)}l<h&&(e.length=l),r=-513&(4|c),c=r&=-1025,c&=-4097}return c!==a&&(V(e,c),2&c&&Object.freeze(e)),Vi(e,c,i,o,t,s,u,n)}function Vi(e,t,r,s,n,i,o,a){let c=t;return i===1||i===4&&(2&t||!(16&t)&&32&s)?ot(t)||((t|=!e.length||o&&!(4096&t)||32&s&&!(4096&t||16&t)?2:256)!==c&&V(e,t),Object.freeze(e)):(i===2&&ot(t)&&(e=ve(e),c=0,t=at(t,s),s=G(r,s,n,e)),ot(t)||(a||(t|=16),t!==c&&V(e,t))),2&t||!(4096&t||16&t)||st(r,s),e}function Ns(e,t,r){return e=Oe(e,t,r),Array.isArray(e)?e:Ze}function Us(e,t){return 2&t&&(e|=2),1|e}function ot(e){return!!(2&e)&&!!(4&e)||!!(256&e)}function Gi(e){return As(e,!0)}function Hi(e){e=ve(e);for(let t=0;t<e.length;t++){const r=e[t]=ve(e[t]);Array.isArray(r[1])&&(r[1]=tr(r[1]))}return rr(e)}function je(e,t,r,s){Ft(e),G(e=e.v,0|e[p],t,(s==="0"?Number(r)===0:r===s)?void 0:r)}function xt(e,t,r){if(2&t)throw Error();const s=St(t);let n=Ns(e,r,s),i=n===Ze?7:0|n[p],o=Us(i,t);return(2&o||ot(o)||16&o)&&(o===i||ot(o)||V(n,o),n=ve(n),i=0,o=at(o,t),G(e,t,r,n,s)),o&=-13,o!==i&&V(n,o),n}function Bs(e,t){var r=Qo;return js(Ds(e=e.v),e,void 0,r)===t?t:-1}function Ds(e){if(At)return e[Zt]??(e[Zt]=new Map);if(Zt in e)return e[Zt];const t=new Map;return Object.defineProperty(e,Zt,{value:t}),t}function zi(e,t,r,s,n){const i=Ds(e),o=js(i,e,t,r,n);return o!==s&&(o&&(t=G(e,t,o,void 0,n)),i.set(r,s)),t}function js(e,t,r,s,n){let i=e.get(s);if(i!=null)return i;i=0;for(let o=0;o<s.length;o++){const a=s[o];Oe(t,a,n)!=null&&(i!==0&&(r=G(t,r,i,void 0,n)),i=a)}return e.set(s,i),i}function Vs(e,t,r){let s=0|e[p];const n=St(s),i=Oe(e,r,n);let o;if(i!=null&&i[Et]===kt){if(!re(i))return Mt(i),i.v;o=i.v}else Array.isArray(i)&&(o=i);if(o){const a=0|o[p];2&a&&(o=Pt(o,a))}return o=rt(o,t),o!==i&&G(e,s,r,o,n),o}function Wi(e,t,r,s,n){let i=!1;if((s=Oe(e,s,n,(o=>{const a=Ms(o,r,!1,t);return i=a!==o&&a!=null,a})))!=null)return i&&!re(s)&&st(e,t),s}function E(e,t,r,s){let n=e.v,i=0|n[p];if((t=Wi(n,i,t,r,s))==null)return t;if(i=0|n[p],!re(e,i)){const o=Rs(t);o!==t&&(Mt(e)&&(n=e.v,i=0|n[p]),i=G(n,i,r,t=o,s),st(n,i))}return t}function Ki(e,t,r,s,n,i,o,a){var c=re(e,r);i=c?1:i,o=!!o||i===3,c=a&&!c,(i===2||c)&&Mt(e)&&(r=0|(t=e.v)[p]);var u=(e=Ns(t,n))===Ze?7:0|e[p],h=Us(u,r);if(a=!(4&h)){var l=e,d=r;const b=!!(2&h);b&&(d|=2);let C=!b,ti=!0,Yt=0,Sr=0;for(;Yt<l.length;Yt++){const ri=Ms(l[Yt],s,!1,d);if(ri instanceof s){if(!b){const Qc=re(ri);C&&(C=!Qc),ti&&(ti=Qc)}l[Sr++]=ri}}Sr<Yt&&(l.length=Sr),h|=4,h=ti?-4097&h:4096|h,h=C?8|h:-9&h}if(h!==u&&(V(e,h),2&h&&Object.freeze(e)),c&&!(8&h||!e.length&&(i===1||i===4&&(2&h||!(16&h)&&32&r)))){for(ot(h)&&(e=ve(e),h=at(h,r),r=G(t,r,n,e)),s=e,c=h,u=0;u<s.length;u++)(l=s[u])!==(h=Rs(l))&&(s[u]=h);c|=8,V(e,h=c=s.length?4096|c:-4097&c)}return Vi(e,h,t,r,n,i,a,o)}function Re(e,t,r){const s=e.v;return Ki(e,s,0|s[p],t,r,nt(),!1,!0)}function qi(e){return e==null&&(e=void 0),e}function v(e,t,r,s,n){return S(e,r,s=qi(s),n),s&&!re(s)&&st(e.v),e}function ur(e,t,r,s){e:{var n=s=qi(s);Ft(e);const i=e.v;let o=0|i[p];if(n==null){const a=Ds(i);if(js(a,i,o,r)!==t)break e;a.set(r,0)}else o=zi(i,o,r,t);G(i,o,t,n)}s&&!re(s)&&st(e.v)}function at(e,t){return-273&(2&t?2|e:-3&e)}function Gs(e,t,r,s){var n=s;Ft(e),e=Ki(e,s=e.v,0|s[p],r,t,2,!0),n=n??new r,e.push(n),t=r=e===Ze?7:0|e[p],(n=re(n))?(r&=-9,e.length===1&&(r&=-4097)):r|=4096,r!==t&&V(e,r),n||st(s)}function pe(e,t,r){return Lt(L(e,t,void 0,r))}function Xi(e){return(ys?L(e,2,void 0,void 0,xr):xr(L(e,2)))??Dh}function R(e,t){return L(e,t,void 0,void 0,Ce)??0}function Ie(e,t,r){if(r!=null){if(typeof r!="number"||!Fr(r))throw _s("int32");r|=0}S(e,t,r)}function y(e,t,r){S(e,t,ir(r))}function ne(e,t,r){je(e,t,cr(r),"")}function Ir(e,t,r){{Ft(e);const o=e.v;let a=0|o[p];if(r==null)G(o,a,t);else{var s=e=r===Ze?7:0|r[p],n=ot(e),i=n||Object.isFrozen(r);for(n||(e=0),i||(r=ve(r),s=0,e=at(e,a),i=!1),e|=5,e|=(4&e?512&e?512:1024&e?1024:0:void 0)??(ys?1024:0),n=0;n<r.length;n++){const c=r[n],u=Ri(c);Object.is(c,u)||(i&&(r=ve(r),s=0,e=at(e,a),i=!1),r[n]=u)}e!==s&&(i&&(r=ve(r),e=at(e,a)),V(r,e)),G(o,a,t,r)}}}function Nr(e,t,r){Ft(e),it(e,t,Y,2,!0).push(Ri(r))}var $t=class{constructor(e,t,r){if(this.buffer=e,r&&!t)throw Error();this.g=t}};function Hs(e,t){if(typeof e=="string")return new $t(fi(e),t);if(Array.isArray(e))return new $t(new Uint8Array(e),t);if(e.constructor===Uint8Array)return new $t(e,!1);if(e.constructor===ArrayBuffer)return e=new Uint8Array(e),new $t(e,!1);if(e.constructor===ke)return t=vs(e)||new Uint8Array(0),new $t(t,!0,e);if(e instanceof Uint8Array)return e=e.constructor===Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new $t(e,!1);throw Error()}function Ot(e,t){let r,s=0,n=0,i=0;const o=e.h;let a=e.g;do r=o[a++],s|=(127&r)<<i,i+=7;while(i<32&&128&r);if(i>32)for(n|=(127&r)>>4,i=3;i<32&&128&r;i+=7)r=o[a++],n|=(127&r)<<i;if(ct(e,a),!(128&r))return t(s>>>0,n>>>0);throw Error()}function zs(e){let t=0,r=e.g;const s=r+10,n=e.h;for(;r<s;){const i=n[r++];if(t|=i,(128&i)==0)return ct(e,r),!!(127&t)}throw Error()}function Ve(e){const t=e.h;let r=e.g,s=t[r++],n=127&s;if(128&s&&(s=t[r++],n|=(127&s)<<7,128&s&&(s=t[r++],n|=(127&s)<<14,128&s&&(s=t[r++],n|=(127&s)<<21,128&s&&(s=t[r++],n|=s<<28,128&s&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++])))))throw Error();return ct(e,r),n}function Ne(e){return Ve(e)>>>0}function Ur(e){var t=e.h;const r=e.g;var s=t[r],n=t[r+1];const i=t[r+2];return t=t[r+3],ct(e,e.g+4),e=2*((n=(s<<0|n<<8|i<<16|t<<24)>>>0)>>31)+1,s=n>>>23&255,n&=8388607,s==255?n?NaN:e*(1/0):s==0?1401298464324817e-60*e*n:e*Math.pow(2,s-150)*(n+8388608)}function jh(e){return Ve(e)}function ct(e,t){if(e.g=t,t>e.l)throw Error()}function Yi(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 Qi(e,t){if(t==0)return Je();var r=Yi(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):_h?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?Je():new ke(r,vt)}var Ji=[];function Zi(e,t,r,s){if(jr.length){const n=jr.pop();return n.o(s),n.g.init(e,t,r,s),n}return new Vh(e,t,r,s)}function eo(e){e.g.clear(),e.l=-1,e.h=-1,jr.length<100&&jr.push(e)}function to(e){var t=e.g;if(t.g==t.l)return!1;e.m=e.g.g;var r=Ne(e.g);if(t=r>>>3,!((r&=7)>=0&&r<=5)||t<1)throw Error();return e.l=t,e.h=r,!0}function Br(e){switch(e.h){case 0:e.h!=0?Br(e):zs(e.g);break;case 1:ct(e=e.g,e.g+8);break;case 2:if(e.h!=2)Br(e);else{var t=Ne(e.g);ct(e=e.g,e.g+t)}break;case 5:ct(e=e.g,e.g+4);break;case 3:for(t=e.l;;){if(!to(e))throw Error();if(e.h==4){if(e.l!=t)throw Error();break}Br(e)}break;default:throw Error()}}function lr(e,t,r){const s=e.g.l;var n=Ne(e.g);let i=(n=e.g.g+n)-s;if(i<=0&&(e.g.l=n,r(t,e,void 0,void 0,void 0),i=n-e.g.g),i)throw Error();return e.g.g=n,e.g.l=s,t}function Ws(e){var t=Ne(e.g),r=Yi(e=e.g,t);if(e=e.h,Zc){var s,n=e;(s=ps)||(s=ps=new TextDecoder("utf-8",{fatal:!0})),t=r+t,n=r===0&&t===n.length?n:n.subarray(r,t);try{var i=s.decode(n)}catch(a){if(Cr===void 0){try{s.decode(new Uint8Array([128]))}catch{}try{s.decode(new Uint8Array([97])),Cr=!0}catch{Cr=!1}}throw!Cr&&(ps=void 0),a}}else{t=(i=r)+t,r=[];let a,c=null;for(;i<t;){var o=e[i++];o<128?r.push(o):o<224?i>=t?Qe():(a=e[i++],o<194||(192&a)!=128?(i--,Qe()):r.push((31&o)<<6|63&a)):o<240?i>=t-1?Qe():(a=e[i++],(192&a)!=128||o===224&&a<160||o===237&&a>=160||(192&(s=e[i++]))!=128?(i--,Qe()):r.push((15&o)<<12|(63&a)<<6|63&s)):o<=244?i>=t-2?Qe():(a=e[i++],(192&a)!=128||a-144+(o<<28)>>30!=0||(192&(s=e[i++]))!=128||(192&(n=e[i++]))!=128?(i--,Qe()):(o=(7&o)<<18|(63&a)<<12|(63&s)<<6|63&n,o-=65536,r.push(55296+(o>>10&1023),56320+(1023&o)))):Qe(),r.length>=8192&&(c=si(c,r),r.length=0)}i=si(c,r)}return i}function ro(e){const t=Ne(e.g);return Qi(e.g,t)}function Dr(e,t,r){var s=Ne(e.g);for(s=e.g.g+s;e.g.g<s;)r.push(t(e.g))}var Vh=class{constructor(e,t,r,s){if(Ji.length){const n=Ji.pop();n.init(e,t,r,s),e=n}else e=new class{constructor(n,i,o,a){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.init(n,i,o,a)}init(n,i,o,{Y:a=!1,ea:c=!1}={}){this.Y=a,this.ea=c,n&&(n=Hs(n,this.ea),this.h=n.buffer,this.j=n.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,s);this.g=e,this.m=this.g.g,this.h=this.l=-1,this.o(s)}o({ha:e=!1}={}){this.ha=e}},jr=[];function so(e){return e?/^\d+$/.test(e)?(Mr(e),new Ks(F,U)):null:Gh||(Gh=new Ks(0,0))}var Ks=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let Gh;function no(e){return e?/^-?\d+$/.test(e)?(Mr(e),new qs(F,U)):null:Hh||(Hh=new qs(0,0))}var qs=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let Hh;function Rt(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 It(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function Vr(e,t){if(t>=0)It(e,t);else{for(let r=0;r<9;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function Xs(e){var t=F;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 Nt(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function me(e,t,r){It(e.g,8*t+r)}function Ys(e,t){return me(e,t,2),t=e.g.end(),Nt(e,t),t.push(e.h),t}function Qs(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 Gr(e,t,r){me(e,t,2),It(e.g,r.length),Nt(e,e.g.end()),Nt(e,r)}function Hr(e,t,r,s){r!=null&&(t=Ys(e,t),s(r,e),Qs(e,t))}function Te(){const e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var Js=Te(),io=Te(),Zs=Te(),en=Te(),oo=Te(),ao=Te(),zh=Te(),zr=Te(),co=Te(),ho=Te();function Le(e,t,r){var s=e.v;te&&te in s&&(s=s[te])&&delete s[t.g],t.h?t.j(e,t.h,t.g,r,t.l):t.j(e,t.g,r,t.l)}var m=class{constructor(e,t){this.v=Bi(e,t,void 0,2048)}toJSON(){return Ui(this)}j(){var n;var e=Tu,t=this.v,r=e.g,s=te;if(At&&s&&((n=t[s])==null?void 0:n[r])!=null&&_t(uh,3),t=e.g,yi&&te&&yi===void 0&&(s=(r=this.v)[te])&&(s=s.da))try{s(r,t,Oh)}catch(i){ii(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[p];return Is(this,e,t)?Os(this,e,!0):new this.constructor(Pt(e,t,!1))}};m.prototype[Et]=kt,m.prototype.toString=function(){return this.v.toString()};var Ut=class{constructor(e,t,r){this.g=e,this.h=t,e=Js,this.l=!!e&&r===e||!1}};function Wr(e,t){return new Ut(e,t,Js)}function uo(e,t,r,s,n){Hr(e,r,yo(t,s),n)}const Wh=Wr((function(e,t,r,s,n){return e.h===2&&(lr(e,Vs(t,s,r),n),!0)}),uo),Kh=Wr((function(e,t,r,s,n){return e.h===2&&(lr(e,Vs(t,s,r),n),!0)}),uo);var Kr=Symbol(),qr=Symbol(),tn=Symbol(),lo=Symbol(),fo=Symbol();let po,mo;function ht(e,t,r,s){var n=s[e];if(n)return n;(n={}).qa=s,n.T=(function(l){switch(typeof l){case"boolean":return Nh||(Nh=[0,void 0,!0]);case"number":return l>0?void 0:l===0?Uh||(Uh=[0,void 0]):[-l,void 0];case"string":return[0,l];case"object":return l}})(s[0]);var i=s[1];let o=1;i&&i.constructor===Object&&(n.ba=i,typeof(i=s[++o])=="function"&&(n.ma=!0,po??(po=i),mo??(mo=s[o+1]),i=s[o+=2]));const a={};for(;i&&Array.isArray(i)&&i.length&&typeof i[0]=="number"&&i[0]>0;){for(var c=0;c<i.length;c++)a[i[c]]=i;i=s[++o]}for(c=1;i!==void 0;){let l;typeof i=="number"&&(c+=i,i=s[++o]);var u=void 0;if(i instanceof Ut?l=i:(l=Wh,o--),l==null?void 0:l.l){i=s[++o],u=s;var h=o;typeof i=="function"&&(i=i(),u[h]=i),u=i}for(h=c+1,typeof(i=s[++o])=="number"&&i<0&&(h-=i,i=s[++o]);c<h;c++){const d=a[c];u?r(n,c,l,u,d):t(n,c,l,d)}}return s[e]=n}function go(e){return Array.isArray(e)?e[0]instanceof Ut?e:[Kh,e]:[e,void 0]}function yo(e,t){return e instanceof m?e.v:Array.isArray(e)?rt(e,t):void 0}function rn(e,t,r,s){const n=r.g;e[t]=s?(i,o,a)=>n(i,o,a,s):n}function sn(e,t,r,s,n){const i=r.g;let o,a;e[t]=(c,u,h)=>i(c,u,h,a||(a=ht(qr,rn,sn,s).T),o||(o=nn(s)),n)}function nn(e){let t=e[tn];if(t!=null)return t;const r=ht(qr,rn,sn,e);return t=r.ma?(s,n)=>po(s,n,r):(s,n)=>{for(;to(n)&&n.h!=4;){var i=n.l,o=r[i];if(o==null){var a=r.ba;a&&(a=a[i])&&(a=Xh(a))!=null&&(o=r[i]=a)}if(o==null||!o(n,s,i)){if(o=(a=n).m,Br(a),a.ha)var c=void 0;else c=a.g.g-o,a.g.g=o,c=Qi(a.g,c);o=void 0,a=s,c&&((o=a[te]??(a[te]=new $s))[i]??(o[i]=[])).push(c)}}return(s=$r(s))&&(s.da=r.qa[fo]),!0},e[tn]=t,e[fo]=qh.bind(e),t}function qh(e,t,r,s){var n=this[qr];const i=this[tn],o=rt(void 0,n.T),a=$r(e);if(a){var c=!1,u=n.ba;if(u){if(n=(h,l,d)=>{if(d.length!==0)if(u[l])for(const b of d){h=Zi(b);try{c=!0,i(o,h)}finally{eo(h)}}else s==null||s(e,l,d)},t==null)Or(a,n);else if(a!=null){const h=a[t];h&&n(a,t,h)}if(c){let h=0|e[p];if(2&h&&2048&h&&!(r!=null&&r.Ka))throw Error();const l=St(h),d=(b,C)=>{if(Oe(e,b,l)!=null){if((r==null?void 0:r.Qa)===1)return;throw Error()}C!=null&&(h=G(e,h,b,C,l)),delete a[b]};t==null?Ai(o,0|o[p],((b,C)=>{d(b,C)})):d(t,Oe(o,t,l))}}}}function Xh(e){const t=(e=go(e))[0].g;if(e=e[1]){const r=nn(e),s=ht(qr,rn,sn,e).T;return(n,i,o)=>t(n,i,o,s,r)}return t}function Xr(e,t,r){e[t]=r.h}function Yr(e,t,r,s){let n,i;const o=r.h;e[t]=(a,c,u)=>o(a,c,u,i||(i=ht(Kr,Xr,Yr,s).T),n||(n=bo(s)))}function bo(e){let t=e[lo];if(!t){const r=ht(Kr,Xr,Yr,e);t=(s,n)=>vo(s,n,r),e[lo]=t}return t}function vo(e,t,r){Ai(e,0|e[p],((s,n)=>{if(n!=null){var i=(function(o,a){var c=o[a];if(c)return c;if((c=o.ba)&&(c=c[a])){var u=(c=go(c))[0].h;if(c=c[1]){const h=bo(c),l=ht(Kr,Xr,Yr,c).T;c=o.ma?mo(l,h):(d,b,C)=>u(d,b,C,l,h)}else c=u;return o[a]=c}})(r,s);i?i(t,n,s):s<500||_t(ws,3)}})),(e=$r(e))&&Or(e,((s,n,i)=>{for(Nt(t,t.g.end()),s=0;s<i.length;s++)Nt(t,vs(i[s])||new Uint8Array(0))}))}const Yh=se(0);function Bt(e,t){if(Array.isArray(t)){var r=0|t[p];if(4&r)return t;for(var s=0,n=0;s<t.length;s++){const i=e(t[s]);i!=null&&(t[n++]=i)}return n<s&&(t.length=n),(e=-1537&(5|r))!==r&&V(t,e),2&e&&Object.freeze(t),t}}function J(e,t,r){return new Ut(e,t,r)}function Dt(e,t,r){return new Ut(e,t,r)}function z(e,t,r){G(e,0|e[p],t,r,St(0|e[p]))}var Qh=Wr((function(e,t,r,s,n){if(e.h!==2)return!1;if(e=ve(e=lr(e,rt([void 0,void 0],s),n)),n=St(s=0|t[p]),2&s)throw Error();let i=Oe(t,r,n);if(i instanceof $e)(2&i.J)!=0?(i=i.V(),i.push(e),G(t,s,r,i,n)):i.Ma(e);else if(Array.isArray(i)){var o=0|i[p];8192&o||V(i,o|=8192),2&o&&(i=Hi(i),G(t,s,r,i,n)),i.push(e)}else G(t,s,r,rr([e]),n);return!0}),(function(e,t,r,s,n){if(t instanceof $e)t.forEach(((i,o)=>{Hr(e,r,rt([o,i],s),n)}));else if(Array.isArray(t)){for(let i=0;i<t.length;i++){const o=t[i];Array.isArray(o)&&Hr(e,r,rt(o,s),n)}rr(t)}}));function _o(e,t,r){(t=Ce(t))!=null&&(me(e,r,5),e=e.g,ks(t),Xs(e))}function wo(e,t,r){if(t=(function(s){if(s==null)return s;const n=typeof s;if(n==="bigint")return String(nr(64,s));if(ar(s)){if(n==="string")return xi(s);if(n==="number")return Ps(s)}})(t),t!=null&&(typeof t=="string"&&no(t),t!=null))switch(me(e,r,0),typeof t){case"number":e=e.g,Ct(t),Rt(e,F,U);break;case"bigint":r=BigInt.asUintN(64,t),r=new qs(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),Rt(e.g,r.h,r.g);break;default:r=no(t),Rt(e.g,r.h,r.g)}}function Ao(e,t,r){(t=Lt(t))!=null&&t!=null&&(me(e,r,0),Vr(e.g,t))}function Eo(e,t,r){(t=Pi(t))!=null&&(me(e,r,0),e.g.g.push(t?1:0))}function ko(e,t,r){(t=Y(t))!=null&&Gr(e,r,ni(t))}function So(e,t,r,s,n){Hr(e,r,yo(t,s),n)}function Co(e,t,r){(t=t==null||typeof t=="string"||t instanceof ke?t:void 0)!=null&&Gr(e,r,Hs(t,!0).buffer)}function To(e,t,r){return(e.h===5||e.h===2)&&(t=xt(t,0|t[p],r),e.h==2?Dr(e,Ur,t):t.push(Ur(e.g)),!0)}var B=J((function(e,t,r){return e.h===5&&(z(t,r,Ur(e.g)),!0)}),_o,zr),Jh=Dt(To,(function(e,t,r){if((t=Bt(Ce,t))!=null)for(let o=0;o<t.length;o++){var s=e,n=r,i=t[o];i!=null&&(me(s,n,5),s=s.g,ks(i),Xs(s))}}),zr),on=Dt(To,(function(e,t,r){if((t=Bt(Ce,t))!=null&&t.length){me(e,r,2),It(e.g,4*t.length);for(let s=0;s<t.length;s++)r=e.g,ks(t[s]),Xs(r)}}),zr),Zh=J((function(e,t,r){return e.h===5&&(z(t,r,(e=Ur(e.g))===0?void 0:e),!0)}),_o,zr),Ge=J((function(e,t,r){return gs?(e.h!==0?e=!1:(z(t,r,Ot(e.g,Ti)),e=!0),e):e.h===0&&(z(t,r,Ot(e.g,Cs)),!0)}),wo,ao),an=J((function(e,t,r){return gs?(e.h!==0?t=!1:(z(t,r,(e=Ot(e.g,Ti))===Yh?void 0:e),t=!0),t):e.h===0&&(z(t,r,(e=Ot(e.g,Cs))===0?void 0:e),!0)}),wo,ao),eu=J((function(e,t,r){return gs?(e.h!==0?e=!1:(z(t,r,Ot(e.g,Ah)),e=!0),e):e.h===0&&(z(t,r,Ot(e.g,Ss)),!0)}),(function(e,t,r){if(t=(function(s){if(s==null)return s;var n=typeof s;if(n==="bigint")return String(Eh(64,s));if(ar(s)){if(n==="string")return n=Tt(Number(s)),tt(n)&&n>=0?s=String(n):((n=s.indexOf("."))!==-1&&(s=s.substring(0,n)),(n=s[0]!=="-"&&((n=s.length)<20||n===20&&s<="18446744073709551615"))||(Mr(s),s=sr(F,U))),s;if(n==="number")return(s=Tt(s))>=0&&tt(s)||(Ct(s),s=Ss(F,U)),s}})(t),t!=null&&(typeof t=="string"&&so(t),t!=null))switch(me(e,r,0),typeof t){case"number":e=e.g,Ct(t),Rt(e,F,U);break;case"bigint":r=BigInt.asUintN(64,t),r=new Ks(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),Rt(e.g,r.h,r.g);break;default:r=so(t),Rt(e.g,r.h,r.g)}}),zh),W=J((function(e,t,r){return e.h===0&&(z(t,r,Ve(e.g)),!0)}),Ao,en),dr=Dt((function(e,t,r){return(e.h===0||e.h===2)&&(t=xt(t,0|t[p],r),e.h==2?Dr(e,Ve,t):t.push(Ve(e.g)),!0)}),(function(e,t,r){if((t=Bt(Lt,t))!=null&&t.length){r=Ys(e,r);for(let s=0;s<t.length;s++)Vr(e.g,t[s]);Qs(e,r)}}),en),jt=J((function(e,t,r){return e.h===0&&(z(t,r,(e=Ve(e.g))===0?void 0:e),!0)}),Ao,en),I=J((function(e,t,r){return e.h===0&&(z(t,r,zs(e.g)),!0)}),Eo,io),ut=J((function(e,t,r){return e.h===0&&(z(t,r,(e=zs(e.g))===!1?void 0:e),!0)}),Eo,io),Q=Dt((function(e,t,r){return e.h===2&&(e=Ws(e),xt(t,0|t[p],r).push(e),!0)}),(function(e,t,r){if((t=Bt(Y,t))!=null)for(let o=0;o<t.length;o++){var s=e,n=r,i=t[o];i!=null&&Gr(s,n,ni(i))}}),Zs),He=J((function(e,t,r){return e.h===2&&(z(t,r,(e=Ws(e))===""?void 0:e),!0)}),ko,Zs),T=J((function(e,t,r){return e.h===2&&(z(t,r,Ws(e)),!0)}),ko,Zs),K=(function(e,t,r=Js){return new Ut(e,t,r)})((function(e,t,r,s,n){return e.h===2&&(s=rt(void 0,s),xt(t,0|t[p],r).push(s),lr(e,s,n),!0)}),(function(e,t,r,s,n){if(Array.isArray(t)){for(let i=0;i<t.length;i++)So(e,t[i],r,s,n);1&(e=0|t[p])||V(t,1|e)}})),N=Wr((function(e,t,r,s,n,i){if(e.h!==2)return!1;let o=0|t[p];return zi(t,o,i,r,St(o)),lr(e,t=Vs(t,s,r),n),!0}),So),Lo=J((function(e,t,r){return e.h===2&&(z(t,r,ro(e)),!0)}),Co,co),tu=Dt((function(e,t,r){return(e.h===0||e.h===2)&&(t=xt(t,0|t[p],r),e.h==2?Dr(e,Ne,t):t.push(Ne(e.g)),!0)}),(function(e,t,r){if((t=Bt(Mi,t))!=null)for(let o=0;o<t.length;o++){var s=e,n=r,i=t[o];i!=null&&(me(s,n,0),It(s.g,i))}}),oo),ru=J((function(e,t,r){return e.h===0&&(z(t,r,(e=Ne(e.g))===0?void 0:e),!0)}),(function(e,t,r){(t=Mi(t))!=null&&t!=null&&(me(e,r,0),It(e.g,t))}),oo),ie=J((function(e,t,r){return e.h===0&&(z(t,r,Ve(e.g)),!0)}),(function(e,t,r){(t=Lt(t))!=null&&(t=parseInt(t,10),me(e,r,0),Vr(e.g,t))}),ho);class su{constructor(t,r){var s=oe;this.g=t,this.h=r,this.m=E,this.j=v,this.defaultValue=void 0,this.l=s.Oa!=null?Ei:void 0}register(){Tr(this)}}function Pe(e,t){return new su(e,t)}function ze(e,t){return(r,s)=>{{const i={ea:!0};s&&Object.assign(i,s),r=Zi(r,void 0,void 0,i);try{const o=new e,a=o.v;nn(t)(a,r);var n=o}finally{eo(r)}}return n}}function Qr(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}}}};vo(this.v,t,ht(Kr,Xr,Yr,e)),Nt(t,t.g.end());const r=new Uint8Array(t.h),s=t.l,n=s.length;let i=0;for(let o=0;o<n;o++){const a=s[o];r.set(a,i),i+=a.length}return t.l=[r],r}}var Po=class extends m{constructor(e){super(e)}},Mo=[0,He,J((function(e,t,r){return e.h===2&&(z(t,r,(e=ro(e))===Je()?void 0:e),!0)}),(function(e,t,r){if(t!=null){if(t instanceof m){const s=t.Ra;return void(s?(t=s(t),t!=null&&Gr(e,r,Hs(t,!0).buffer)):_t(ws,3))}if(Array.isArray(t))return void _t(ws,3)}Co(e,t,r)}),co)];let cn,Fo=globalThis.trustedTypes;function xo(e){var t;return cn===void 0&&(cn=(function(){let r=null;if(!Fo)return r;try{const s=n=>n;r=Fo.createPolicy("goog#html",{createHTML:s,createScript:s,createScriptURL:s})}catch{}return r})()),e=(t=cn)?t.createScriptURL(e):e,new class{constructor(r){this.g=r}toString(){return this.g+""}}(e)}function nu(e,...t){if(t.length===0)return xo(e[0]);let r=e[0];for(let s=0;s<t.length;s++)r+=encodeURIComponent(t[s])+e[s+1];return xo(r)}var $o=[0,W,ie,I,-1,dr,ie,-1,I],iu=class extends m{constructor(e){super(e)}},Oo=[0,I,T,I,ie,-1,Dt((function(e,t,r){return(e.h===0||e.h===2)&&(t=xt(t,0|t[p],r),e.h==2?Dr(e,jh,t):t.push(Ve(e.g)),!0)}),(function(e,t,r){if((t=Bt(Lt,t))!=null&&t.length){r=Ys(e,r);for(let s=0;s<t.length;s++)Vr(e.g,t[s]);Qs(e,r)}}),ho),T,-1,[0,I,-1],ie,I,-1],Ro=[0,3,I,-1,2,[0,W],[0,ie,I],[0,T,-1],[0]],Io=[0,T,-2],No=class extends m{constructor(e){super(e)}},Uo=[0],Bo=[0,W,I,1,I,-4],oe=class extends m{constructor(e){super(e,2)}},H={};H[336783863]=[0,T,I,-1,W,[0,[1,2,3,4,5,6,7,8,9],N,Uo,N,Oo,N,Io,N,Bo,N,$o,N,[0,T,-2],N,[0,T,ie],N,Ro,N,[0,ie,-1,I]],[0,T],I,[0,[1,3],[2,4],N,[0,dr],-1,N,[0,Q],-1,K,[0,T,-1]],T];var Do=[0,an,-1,ut,-3,an,dr,He,jt,an,-1,ut,jt,ut,-2,He];function P(e,t){Nr(e,3,t)}function w(e,t){Nr(e,4,t)}var Z=class extends m{constructor(e){super(e,500)}o(e){return v(this,0,7,e)}},fr=[-1,{}],jo=[0,T,1,fr],Vo=[0,T,Q,fr];function ge(e,t){Gs(e,1,Z,t)}function x(e,t){Nr(e,10,t)}function k(e,t){Nr(e,15,t)}var ae=class extends m{constructor(e){super(e,500)}o(e){return v(this,0,1001,e)}},Go=[-500,K,[-500,He,-1,Q,-3,[-2,H,I],K,Mo,jt,-1,jo,Vo,K,[0,He,ut],He,Do,jt,Q,987,Q],4,K,[-500,T,-1,[-1,{}],998,T],K,[-500,T,Q,-1,[-2,{},I],997,Q,-1],jt,K,[-500,T,Q,fr,998,Q],Q,jt,jo,Vo,K,[0,He,-1,fr],Q,-2,Do,He,-1,ut,[0,ut,ru],978,fr,K,Mo];ae.prototype.g=Qr(Go);var ou=ze(ae,Go),au=class extends m{constructor(e){super(e)}},Ho=class extends m{constructor(e){super(e)}g(){return Re(this,au,1)}},zo=[0,K,[0,W,B,T,-1]],Jr=ze(Ho,zo),cu=class extends m{constructor(e){super(e)}},hu=class extends m{constructor(e){super(e)}},hn=class extends m{constructor(e){super(e)}l(){return E(this,cu,2)}g(){return Re(this,hu,5)}},Wo=ze(class extends m{constructor(e){super(e)}},[0,Q,dr,on,[0,ie,[0,W,-3],[0,B,-3],[0,W,-1,[0,K,[0,W,-2]]],K,[0,B,-1,T,B]],T,-1,Ge,K,[0,W,B],Q,Ge]),Ko=class extends m{constructor(e){super(e)}},Vt=ze(class extends m{constructor(e){super(e)}},[0,K,[0,B,-4]]),qo=class extends m{constructor(e){super(e)}},pr=ze(class extends m{constructor(e){super(e)}},[0,K,[0,B,-4]]),uu=class extends m{constructor(e){super(e)}},lu=[0,W,-1,on,ie],Xo=class extends m{constructor(e){super(e)}};Xo.prototype.g=Qr([0,B,-4,Ge]);var du=class extends m{constructor(e){super(e)}},fu=ze(class extends m{constructor(e){super(e)}},[0,K,[0,1,W,T,zo],Ge]),Yo=class extends m{constructor(e){super(e)}},pu=class extends m{constructor(e){super(e)}na(){const e=L(this,1,void 0,void 0,Gi);return e??Je()}},mu=class extends m{constructor(e){super(e)}},Qo=[1,2],gu=ze(class extends m{constructor(e){super(e)}},[0,K,[0,Qo,N,[0,on],N,[0,Lo],W,T],Ge]),un=class extends m{constructor(e){super(e)}},Jo=[0,T,W,B,Q,-1],Zo=class extends m{constructor(e){super(e)}},yu=[0,I,-1],ea=class extends m{constructor(e){super(e)}},Zr=[1,2,3,4,5,6],es=class extends m{constructor(e){super(e)}g(){return L(this,1,void 0,void 0,Gi)!=null}l(){return Y(L(this,2))!=null}},$=class extends m{constructor(e){super(e)}g(){return Pi(L(this,2))??!1}},ta=[0,Lo,T,[0,W,Ge,-1],[0,eu,Ge]],D=[0,ta,I,[0,Zr,N,Bo,N,Oo,N,$o,N,Uo,N,Io,N,Ro],ie],ts=class extends m{constructor(e){super(e)}},ln=[0,D,B,-1,W],bu=Pe(502141897,ts);H[502141897]=ln;var vu=ze(class extends m{constructor(e){super(e)}},[0,[0,ie,-1,Jh,tu],lu]),ra=class extends m{constructor(e){super(e)}},sa=class extends m{constructor(e){super(e)}},dn=[0,D,B,[0,D],I],_u=Pe(508968150,sa);H[508968150]=[0,D,ln,dn,B,[0,[0,ta]]],H[508968149]=dn;var Gt=class extends m{constructor(e){super(e)}l(){return E(this,un,2)}g(){S(this,2)}},na=[0,D,Jo];H[478825465]=na;var wu=class extends m{constructor(e){super(e)}},ia=class extends m{constructor(e){super(e)}},fn=class extends m{constructor(e){super(e)}},pn=class extends m{constructor(e){super(e)}},oa=class extends m{constructor(e){super(e)}},aa=[0,D,[0,D],na,-1],ca=[0,D,B,W],mn=[0,D,B],ha=[0,D,ca,mn,B],Au=Pe(479097054,oa);H[479097054]=[0,D,ha,aa],H[463370452]=aa,H[464864288]=ca;var Eu=Pe(462713202,pn);H[462713202]=ha,H[474472470]=mn;var ku=class extends m{constructor(e){super(e)}},ua=class extends m{constructor(e){super(e)}},la=class extends m{constructor(e){super(e)}},da=class extends m{constructor(e){super(e)}},gn=[0,D,B,-1,W],yn=[0,D,B,I];da.prototype.g=Qr([0,D,mn,[0,D],ln,dn,gn,yn]);var fa=class extends m{constructor(e){super(e)}},Su=Pe(456383383,fa);H[456383383]=[0,D,Jo];var pa=class extends m{constructor(e){super(e)}},Cu=Pe(476348187,pa);H[476348187]=[0,D,yu];var ma=class extends m{constructor(e){super(e)}},ga=class extends m{constructor(e){super(e)}},ya=[0,ie,-1],Tu=Pe(458105876,class extends m{constructor(e){super(e)}g(){let e;var t=this.v;const r=0|t[p];return e=re(this,r),t=(function(s,n,i,o){var a=ga;!o&&Mt(s)&&(i=0|(n=s.v)[p]);var c=Oe(n,2);if(s=!1,c==null){if(o)return Ni();c=[]}else if(c.constructor===$e){if(!(2&c.J)||o)return c;c=c.V()}else Array.isArray(c)?s=!!(2&(0|c[p])):c=[];if(o){if(!c.length)return Ni();s||(s=!0,tr(c))}else s&&(s=!1,rr(c),c=Hi(c));return!s&&32&i&&er(c,32),i=G(n,i,2,o=new $e(c,a,Th,void 0)),s||st(n,i),o})(this,t,r,e),!e&&ga&&(t.ra=!0),t}});H[458105876]=[0,ya,Qh,[!0,Ge,[0,T,-1,Q]],[0,dr,I,ie]];var bn=class extends m{constructor(e){super(e)}},ba=Pe(458105758,bn);H[458105758]=[0,D,T,ya];var vn=class extends m{constructor(e){super(e)}},va=[0,Zh,-1,ut],Lu=class extends m{constructor(e){super(e)}},_a=class extends m{constructor(e){super(e)}},_n=[1,2];_a.prototype.g=Qr([0,_n,N,va,N,[0,K,va]]);var wa=class extends m{constructor(e){super(e)}},Pu=Pe(443442058,wa);H[443442058]=[0,D,T,W,B,Q,-1,I,B],H[514774813]=gn;var Aa=class extends m{constructor(e){super(e)}},Mu=Pe(516587230,Aa);function wn(e,t){return t=t?t.clone():new un,e.displayNamesLocale!==void 0?S(t,1,cr(e.displayNamesLocale)):e.displayNamesLocale===void 0&&S(t,1),e.maxResults!==void 0?Ie(t,2,e.maxResults):"maxResults"in e&&S(t,2),e.scoreThreshold!==void 0?y(t,3,e.scoreThreshold):"scoreThreshold"in e&&S(t,3),e.categoryAllowlist!==void 0?Ir(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&S(t,4),e.categoryDenylist!==void 0?Ir(t,5,e.categoryDenylist):"categoryDenylist"in e&&S(t,5),t}function Ea(e){const t=Number(e);return Number.isSafeInteger(t)?t:String(e)}function An(e,t=-1,r=""){return{categories:e.map((s=>({index:pe(s,1)??0??-1,score:R(s,2)??0,categoryName:Y(L(s,3))??""??"",displayName:Y(L(s,4))??""??""}))),headIndex:t,headName:r}}function Fu(e){const t={classifications:Re(e,du,1).map((r=>{var s;return An(((s=E(r,Ho,4))==null?void 0:s.g())??[],pe(r,2)??0,Y(L(r,3))??"")}))};return(function(r){return Ch(ys?L(r,2,void 0,void 0,xr):L(r,2))})(e)!=null&&(t.timestampMs=Ea(Xi(e))),t}function ka(e){var o,a;var t=it(e,3,Ce,nt()),r=it(e,2,Lt,nt()),s=it(e,1,Y,nt()),n=it(e,9,Y,nt());const i={categories:[],keypoints:[]};for(let c=0;c<t.length;c++)i.categories.push({score:t[c],index:r[c]??-1,categoryName:s[c]??"",displayName:n[c]??""});if((t=(o=E(e,hn,4))==null?void 0:o.l())&&(i.boundingBox={originX:pe(t,1,De)??0,originY:pe(t,2,De)??0,width:pe(t,3,De)??0,height:pe(t,4,De)??0,angle:0}),(a=E(e,hn,4))==null?void 0:a.g().length)for(const c of E(e,hn,4).g())i.keypoints.push({x:L(c,1,void 0,De,Ce)??0,y:L(c,2,void 0,De,Ce)??0,score:L(c,4,void 0,De,Ce)??0,label:Y(L(c,3,void 0,De))??""});return i}function rs(e){const t=[];for(const r of Re(e,qo,1))t.push({x:R(r,1)??0,y:R(r,2)??0,z:R(r,3)??0,visibility:R(r,4)??0});return t}function mr(e){const t=[];for(const r of Re(e,Ko,1))t.push({x:R(r,1)??0,y:R(r,2)??0,z:R(r,3)??0,visibility:R(r,4)??0});return t}function Sa(e){return Array.from(e,(t=>t>127?t-256:t))}function Ca(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,s=0,n=0;for(let i=0;i<e.length;i++)r+=e[i]*t[i],s+=e[i]*e[i],n+=t[i]*t[i];if(s<=0||n<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return r/Math.sqrt(s*n)}let ss;H[516587230]=[0,D,gn,yn,B],H[518928384]=yn;const xu=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);async function Ta(){if(ss===void 0)try{await WebAssembly.instantiate(xu),ss=!0}catch{ss=!1}return ss}async function gr(e,t=nu``){const r=await Ta()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var lt=class{};function La(){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 Pa(e){if(typeof importScripts!="function"){const t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise(((r,s)=>{t.addEventListener("load",(()=>{r()}),!1),t.addEventListener("error",(n=>{s(n)}),!1),document.body.appendChild(t)}))}try{importScripts(e.toString())}catch(t){if(!(t instanceof TypeError))throw t;await self.import(e.toString())}}function Ma(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 g(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 Fa(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[s,n]=Ma(t);return!e.l||s===e.i.canvas.width&&n===e.i.canvas.height||(e.i.canvas.width=s,e.i.canvas.height=n),[s,n]}function xa(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const s=new Uint32Array(t.length);for(let n=0;n<t.length;n++)s[n]=e.i.stringToNewUTF8(t[n]);t=e.i._malloc(4*s.length),e.i.HEAPU32.set(s,t>>2),r(t);for(const n of s)e.i._free(n);e.i._free(t)}function Me(e,t,r){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=r}function We(e,t,r){let s=[];e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=(n,i,o)=>{i?(r(s,o),s=[]):s.push(n)}}lt.forVisionTasks=function(e){return gr("vision",e)},lt.forTextTasks=function(e){return gr("text",e)},lt.forGenAiExperimentalTasks=function(e){return gr("genai_experimental",e)},lt.forGenAiTasks=function(e){return gr("genai",e)},lt.forAudioTasks=function(e){return gr("audio",e)},lt.isSimdSupported=function(){return Ta()};async function $u(e,t,r,s){return e=await(async(n,i,o,a,c)=>{if(i&&await Pa(i),!self.ModuleFactory||o&&(await Pa(o),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&c&&((i=self.Module).locateFile=c.locateFile,c.mainScriptUrlOrBlob&&(i.mainScriptUrlOrBlob=c.mainScriptUrlOrBlob)),c=await self.ModuleFactory(self.Module||c),self.ModuleFactory=self.Module=void 0,new n(c,a)})(e,r.wasmLoaderPath,r.assetLoaderPath,t,{locateFile:n=>n.endsWith(".wasm")?r.wasmBinaryPath.toString():r.assetBinaryPath&&n.endsWith(".data")?r.assetBinaryPath.toString():n}),await e.o(s),e}function En(e,t){const r=E(e.baseOptions,es,1)||new es;typeof t=="string"?(S(r,2,cr(t)),S(r,1)):t instanceof Uint8Array&&(S(r,1,As(t,!1)),S(r,2)),v(e.baseOptions,0,1,r)}function $a(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 f(e,t){e.C=Math.max(e.C,t)}function ns(e,t){e.B=new Z,ne(e.B,2,"PassThroughCalculator"),P(e.B,"free_memory"),w(e.B,"free_memory_unused_out"),x(t,"free_memory"),ge(t,e.B)}function Ht(e,t){P(e.B,t),w(e.B,t+"_unused_out")}function is(e){e.g.addBoolToStream(!0,"free_memory",e.C)}var kn=class{constructor(e){this.g=e,this.H=[],this.C=0,this.g.setAutoRenderToScreen(!1)}l(e,t=!0){var r,s,n,i,o,a;if(t){const c=e.baseOptions||{};if((r=e.baseOptions)!=null&&r.modelAssetBuffer&&((s=e.baseOptions)!=null&&s.modelAssetPath))throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!((n=E(this.baseOptions,es,1))!=null&&n.g()||(i=E(this.baseOptions,es,1))!=null&&i.l()||(o=e.baseOptions)!=null&&o.modelAssetBuffer||(a=e.baseOptions)!=null&&a.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if((function(u,h){let l=E(u.baseOptions,ea,3);if(!l){var d=l=new ea,b=new No;ur(d,4,Zr,b)}"delegate"in h&&(h.delegate==="GPU"?(h=l,d=new iu,ur(h,2,Zr,d)):(h=l,d=new No,ur(h,4,Zr,d))),v(u.baseOptions,0,3,l)})(this,c),c.modelAssetPath)return fetch(c.modelAssetPath.toString()).then((u=>{if(u.ok)return u.arrayBuffer();throw Error(`Failed to fetch model: ${c.modelAssetPath} (${u.status})`)})).then((u=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(u),!0,!1,!1),En(this,"/model.dat"),this.m(),this.L()}));if(c.modelAssetBuffer instanceof Uint8Array)En(this,c.modelAssetBuffer);else if(c.modelAssetBuffer)return(async function(u){const h=[];for(var l=0;;){const{done:d,value:b}=await u.read();if(d)break;h.push(b),l+=b.length}if(h.length===0)return new Uint8Array(0);if(h.length===1)return h[0];u=new Uint8Array(l),l=0;for(const d of h)u.set(d,l),l+=d.length;return u})(c.modelAssetBuffer).then((u=>{En(this,u),this.m(),this.L()}))}return this.m(),this.L(),Promise.resolve()}L(){}ca(){let e;if(this.g.ca((t=>{e=ou(t)})),!e)throw Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.g.attachErrorListener(((r,s)=>{this.H.push(Error(s))})),this.g.Ja(),this.g.setGraph(e,t),this.B=void 0,$a(this)}finishProcessing(){this.g.finishProcessing(),$a(this)}close(){this.B=void 0,this.g.closeGraph()}};function Ke(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}kn.prototype.close=kn.prototype.close;class Ou{constructor(t,r,s,n){this.g=t,this.h=r,this.m=s,this.l=n}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}}function Oa(e,t,r){const s=e.g;if(r=Ke(s.createShader(r),"Failed to create WebGL shader"),s.shaderSource(r,t),s.compileShader(r),!s.getShaderParameter(r,s.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${s.getShaderInfoLog(r)}`);return s.attachShader(e.h,r),r}function Ra(e,t){const r=e.g,s=Ke(r.createVertexArray(),"Failed to create vertex array");r.bindVertexArray(s);const n=Ke(r.createBuffer(),"Failed to create buffer");r.bindBuffer(r.ARRAY_BUFFER,n),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=Ke(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 Ou(r,s,n,i)}function Sn(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function Ru(e,t,r,s){return Sn(e,t),e.h||(e.m(),e.D()),r?(e.u||(e.u=Ra(e,!0)),r=e.u):(e.A||(e.A=Ra(e,!1)),r=e.A),t.useProgram(e.h),r.bind(),e.l(),e=s(),r.g.bindVertexArray(null),e}function Ia(e,t,r){return Sn(e,t),e=Ke(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 Na(e,t,r){Sn(e,t),e.B||(e.B=Ke(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 Iu(e){var t;(t=e.g)==null||t.bindFramebuffer(e.g.FRAMEBUFFER,null)}var Ua=class{H(){return`
2
2
  precision mediump float;
3
3
  varying vec2 vTex;
4
4
  uniform sampler2D inputTexture;
5
5
  void main() {
6
6
  gl_FragColor = texture2D(inputTexture, vTex);
7
7
  }
8
- `}m(){const e=this.g;if(this.h=Ke(e.createProgram(),"Failed to create WebGL program"),this.X=$a(this,`
8
+ `}m(){const e=this.g;if(this.h=Ke(e.createProgram(),"Failed to create WebGL program"),this.X=Oa(this,`
9
9
  attribute vec2 aVertex;
10
10
  attribute vec2 aTex;
11
11
  varying vec2 vTex;
12
12
  void main(void) {
13
13
  gl_Position = vec4(aVertex, 0.0, 1.0);
14
14
  vTex = aTex;
15
- }`,e.VERTEX_SHADER),this.W=$a(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 Be(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 Sn(e){var t=Be(e,1);if(!t){if(t=Be(e,0))t=new Float32Array(t).map((s=>s/255));else{t=new Float32Array(e.width*e.height);const s=zt(e);var r=Cn(e);if(Ia(r,s,Ba(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),s.readPixels(0,0,e.width,e.height,s.RGBA,s.FLOAT,r);for(let n=0,i=0;n<t.length;++n,i+=4)t[n]=r[i]}else s.readPixels(0,0,e.width,e.height,s.RED,s.FLOAT,t)}e.g.push(t)}return t}function Ba(e){let t=Be(e,2);if(!t){const r=zt(e);t=Da(e);const s=Sn(e),n=Ua(e);r.texImage2D(r.TEXTURE_2D,0,n,e.width,e.height,0,r.RED,r.FLOAT,s),Tn(e)}return t}function zt(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=Ke(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Ua(e){if(e=zt(e),!os)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))os=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");os=e.R16F}return os}function Cn(e){return e.l||(e.l=new Na),e.l}function Da(e){const t=zt(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=Be(e,2);return r||(r=Ra(Cn(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(r),e.j=!0),t.bindTexture(t.TEXTURE_2D,r),r}function Tn(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var os,q=class{constructor(e,t,r,s,n,i,o){this.g=e,this.m=t,this.j=r,this.canvas=s,this.l=n,this.width=i,this.height=o,this.j&&--ja===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Fa(){return!!Be(this,0)}ka(){return!!Be(this,1)}R(){return!!Be(this,2)}ja(){return(t=Be(e=this,0))||(t=Sn(e),t=new Uint8Array(t.map((r=>Math.round(255*r)))),e.g.push(t)),t;var e,t}ia(){return Sn(this)}N(){return Ba(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 s=zt(this),n=Cn(this);s.activeTexture(s.TEXTURE1),r=Ra(n,s,this.m?s.LINEAR:s.NEAREST),s.bindTexture(s.TEXTURE_2D,r);const i=Ua(this);s.texImage2D(s.TEXTURE_2D,0,i,this.width,this.height,0,s.RED,s.FLOAT,null),s.bindTexture(s.TEXTURE_2D,null),Ia(n,s,r),$u(n,s,!1,(()=>{Da(this),s.clearColor(0,0,0,0),s.clear(s.COLOR_BUFFER_BIT),s.drawArrays(s.TRIANGLE_FAN,0,4),Tn(this)})),Ou(n),Tn(this)}}e.push(r)}return new q(e,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&zt(this).deleteTexture(Be(this,2)),ja=-1}};q.prototype.close=q.prototype.close,q.prototype.clone=q.prototype.clone,q.prototype.getAsWebGLTexture=q.prototype.N,q.prototype.getAsFloat32Array=q.prototype.ia,q.prototype.getAsUint8Array=q.prototype.ja,q.prototype.hasWebGLTexture=q.prototype.R,q.prototype.hasFloat32Array=q.prototype.ka,q.prototype.hasUint8Array=q.prototype.Fa;var ja=250;function _e(...e){return e.map((([t,r])=>({start:t,end:r})))}const Ru=(function(e){return class extends e{Ja(){this.i._registerModelResourcesGraphService()}}})((Va=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:Ta()?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,s=this.i._malloc(r);this.i.HEAPU8.set(e,s),t?this.i._changeBinaryGraph(r,s):this.i._changeTextGraph(r,s),this.i._free(s)}configureAudio(e,t,r,s,n){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),g(this,s||"input_audio",(i=>{g(this,n=n||"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){Me(this,"__graph_config__",(t=>{e(t)})),g(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,s,n){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),g(this,s,(o=>{this.i._addAudioToInputStream(this.g,t,r,o,n)}))}addGpuBufferToStream(e,t,r){g(this,t,(s=>{const[n,i]=Ma(this,e,s);this.i._addBoundTextureToStream(s,n,i,r)}))}addBoolToStream(e,t,r){g(this,t,(s=>{this.i._addBoolToInputStream(e,s,r)}))}addDoubleToStream(e,t,r){g(this,t,(s=>{this.i._addDoubleToInputStream(e,s,r)}))}addFloatToStream(e,t,r){g(this,t,(s=>{this.i._addFloatToInputStream(e,s,r)}))}addIntToStream(e,t,r){g(this,t,(s=>{this.i._addIntToInputStream(e,s,r)}))}addUintToStream(e,t,r){g(this,t,(s=>{this.i._addUintToInputStream(e,s,r)}))}addStringToStream(e,t,r){g(this,t,(s=>{g(this,e,(n=>{this.i._addStringToInputStream(n,s,r)}))}))}addStringRecordToStream(e,t,r){g(this,t,(s=>{Fa(this,Object.keys(e),(n=>{Fa(this,Object.values(e),(i=>{this.i._addFlatHashMapToInputStream(n,i,Object.keys(e).length,s,r)}))}))}))}addProtoToStream(e,t,r,s){g(this,r,(n=>{g(this,t,(i=>{const o=this.i._malloc(e.length);this.i.HEAPU8.set(e,o),this.i._addProtoToInputStream(o,e.length,i,n,s),this.i._free(o)}))}))}addEmptyPacketToStream(e,t){g(this,e,(r=>{this.i._addEmptyPacketToInputStream(r,t)}))}addBoolVectorToStream(e,t,r){g(this,t,(s=>{const n=this.i._allocateBoolVector(e.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(const i of e)this.i._addBoolVectorEntry(n,i);this.i._addBoolVectorToInputStream(n,s,r)}))}addDoubleVectorToStream(e,t,r){g(this,t,(s=>{const n=this.i._allocateDoubleVector(e.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(const i of e)this.i._addDoubleVectorEntry(n,i);this.i._addDoubleVectorToInputStream(n,s,r)}))}addFloatVectorToStream(e,t,r){g(this,t,(s=>{const n=this.i._allocateFloatVector(e.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(const i of e)this.i._addFloatVectorEntry(n,i);this.i._addFloatVectorToInputStream(n,s,r)}))}addIntVectorToStream(e,t,r){g(this,t,(s=>{const n=this.i._allocateIntVector(e.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(const i of e)this.i._addIntVectorEntry(n,i);this.i._addIntVectorToInputStream(n,s,r)}))}addUintVectorToStream(e,t,r){g(this,t,(s=>{const n=this.i._allocateUintVector(e.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(const i of e)this.i._addUintVectorEntry(n,i);this.i._addUintVectorToInputStream(n,s,r)}))}addStringVectorToStream(e,t,r){g(this,t,(s=>{const n=this.i._allocateStringVector(e.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(const i of e)g(this,i,(o=>{this.i._addStringVectorEntry(n,o)}));this.i._addStringVectorToInputStream(n,s,r)}))}addBoolToInputSidePacket(e,t){g(this,t,(r=>{this.i._addBoolToInputSidePacket(e,r)}))}addDoubleToInputSidePacket(e,t){g(this,t,(r=>{this.i._addDoubleToInputSidePacket(e,r)}))}addFloatToInputSidePacket(e,t){g(this,t,(r=>{this.i._addFloatToInputSidePacket(e,r)}))}addIntToInputSidePacket(e,t){g(this,t,(r=>{this.i._addIntToInputSidePacket(e,r)}))}addUintToInputSidePacket(e,t){g(this,t,(r=>{this.i._addUintToInputSidePacket(e,r)}))}addStringToInputSidePacket(e,t){g(this,t,(r=>{g(this,e,(s=>{this.i._addStringToInputSidePacket(s,r)}))}))}addProtoToInputSidePacket(e,t,r){g(this,r,(s=>{g(this,t,(n=>{const i=this.i._malloc(e.length);this.i.HEAPU8.set(e,i),this.i._addProtoToInputSidePacket(i,e.length,n,s),this.i._free(i)}))}))}addBoolVectorToInputSidePacket(e,t){g(this,t,(r=>{const s=this.i._allocateBoolVector(e.length);if(!s)throw Error("Unable to allocate new bool vector on heap.");for(const n of e)this.i._addBoolVectorEntry(s,n);this.i._addBoolVectorToInputSidePacket(s,r)}))}addDoubleVectorToInputSidePacket(e,t){g(this,t,(r=>{const s=this.i._allocateDoubleVector(e.length);if(!s)throw Error("Unable to allocate new double vector on heap.");for(const n of e)this.i._addDoubleVectorEntry(s,n);this.i._addDoubleVectorToInputSidePacket(s,r)}))}addFloatVectorToInputSidePacket(e,t){g(this,t,(r=>{const s=this.i._allocateFloatVector(e.length);if(!s)throw Error("Unable to allocate new float vector on heap.");for(const n of e)this.i._addFloatVectorEntry(s,n);this.i._addFloatVectorToInputSidePacket(s,r)}))}addIntVectorToInputSidePacket(e,t){g(this,t,(r=>{const s=this.i._allocateIntVector(e.length);if(!s)throw Error("Unable to allocate new int vector on heap.");for(const n of e)this.i._addIntVectorEntry(s,n);this.i._addIntVectorToInputSidePacket(s,r)}))}addUintVectorToInputSidePacket(e,t){g(this,t,(r=>{const s=this.i._allocateUintVector(e.length);if(!s)throw Error("Unable to allocate new unsigned int vector on heap.");for(const n of e)this.i._addUintVectorEntry(s,n);this.i._addUintVectorToInputSidePacket(s,r)}))}addStringVectorToInputSidePacket(e,t){g(this,t,(r=>{const s=this.i._allocateStringVector(e.length);if(!s)throw Error("Unable to allocate new string vector on heap.");for(const n of e)g(this,n,(i=>{this.i._addStringVectorEntry(s,i)}));this.i._addStringVectorToInputSidePacket(s,r)}))}attachBoolListener(e,t){Me(this,e,t),g(this,e,(r=>{this.i._attachBoolListener(r)}))}attachBoolVectorListener(e,t){We(this,e,t),g(this,e,(r=>{this.i._attachBoolVectorListener(r)}))}attachIntListener(e,t){Me(this,e,t),g(this,e,(r=>{this.i._attachIntListener(r)}))}attachIntVectorListener(e,t){We(this,e,t),g(this,e,(r=>{this.i._attachIntVectorListener(r)}))}attachUintListener(e,t){Me(this,e,t),g(this,e,(r=>{this.i._attachUintListener(r)}))}attachUintVectorListener(e,t){We(this,e,t),g(this,e,(r=>{this.i._attachUintVectorListener(r)}))}attachDoubleListener(e,t){Me(this,e,t),g(this,e,(r=>{this.i._attachDoubleListener(r)}))}attachDoubleVectorListener(e,t){We(this,e,t),g(this,e,(r=>{this.i._attachDoubleVectorListener(r)}))}attachFloatListener(e,t){Me(this,e,t),g(this,e,(r=>{this.i._attachFloatListener(r)}))}attachFloatVectorListener(e,t){We(this,e,t),g(this,e,(r=>{this.i._attachFloatVectorListener(r)}))}attachStringListener(e,t){Me(this,e,t),g(this,e,(r=>{this.i._attachStringListener(r)}))}attachStringVectorListener(e,t){We(this,e,t),g(this,e,(r=>{this.i._attachStringVectorListener(r)}))}attachProtoListener(e,t,r){Me(this,e,t),g(this,e,(s=>{this.i._attachProtoListener(s,r||!1)}))}attachProtoVectorListener(e,t,r){We(this,e,t),g(this,e,(s=>{this.i._attachProtoVectorListener(s,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?'),Me(this,e,((s,n)=>{s=new Float32Array(s.buffer,s.byteOffset,s.length/4),t(s,n)})),g(this,e,(s=>{this.i._attachAudioListener(s,r||!1)}))}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends Va{get ga(){return this.i}pa(e,t,r){g(this,t,(s=>{const[n,i]=Ma(this,e,s);this.ga._addBoundTextureAsImageToStream(s,n,i,r)}))}Z(e,t){Me(this,e,t),g(this,e,(r=>{this.ga._attachImageListener(r)}))}aa(e,t){We(this,e,t),g(this,e,(r=>{this.ga._attachImageVectorListener(r)}))}}));var Va,we=class extends Ru{};async function A(e,t,r){return(async function(s,n,i,o){return Fu(s,n,i,o)})(e,r.canvas??(Ta()?void 0:document.createElement("canvas")),t,r)}function Ga(e,t,r,s){if(e.U){const i=new qo;if(r!=null&&r.regionOfInterest){if(!e.oa)throw Error("This task doesn't support region-of-interest.");var n=r.regionOfInterest;if(n.left>=n.right||n.top>=n.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(n.left<0||n.top<0||n.right>1||n.bottom>1)throw Error("Expected RectF values to be in [0,1].");y(i,1,(n.left+n.right)/2),y(i,2,(n.top+n.bottom)/2),y(i,4,n.right-n.left),y(i,3,n.bottom-n.top)}else y(i,1,.5),y(i,2,.5),y(i,4,1),y(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(y(i,5,-Math.PI*r.rotationDegrees/180),(r==null?void 0:r.rotationDegrees)%180!=0){const[o,a]=Pa(t);r=R(i,3)*a/o,n=R(i,4)*o/a,y(i,4,r),y(i,3,n)}}e.g.addProtoToStream(i.g(),"mediapipe.NormalizedRect",e.U,s)}e.g.pa(t,e.X,s??performance.now()),e.finishProcessing()}function Ae(e,t,r){var s;if((s=e.baseOptions)!=null&&s.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");Ga(e,t,r,e.C+1)}function Fe(e,t,r,s){var n;if(!((n=e.baseOptions)!=null&&n.g()))throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");Ga(e,t,r,s)}function Wt(e,t,r,s){var n=t.data;const i=t.width,o=i*(t=t.height);if((n instanceof Uint8Array||n instanceof Float32Array)&&n.length!==o)throw Error("Unsupported channel count: "+n.length/o);return e=new q([n],r,!1,e.g.i.canvas,e.P,i,t),s?e.clone():e}var ce=class extends En{constructor(e,t,r,s){super(e),this.g=e,this.X=t,this.U=r,this.oa=s,this.P=new Na}l(e,t=!0){if("runningMode"in e&&S(this.baseOptions,2,or(!!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()}};ce.prototype.close=ce.prototype.close;var he=class extends ce{constructor(e,t){super(new we(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},v(e=this.h=new ts,0,1,t=new $),y(this.h,2,.5),y(this.h,3,.3)}get baseOptions(){return E(this.h,$,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){return"minDetectionConfidence"in e&&y(this.h,2,e.minDetectionConfidence??.5),"minSuppressionThreshold"in e&&y(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}F(e,t){return this.j={detections:[]},Ae(this,e,t),this.j}G(e,t,r){return this.j={detections:[]},Fe(this,e,r,t),this.j}m(){var e=new ae;x(e,"image_in"),x(e,"norm_rect_in"),k(e,"detections");const t=new oe;Le(t,gu,this.h);const r=new Z;ne(r,2,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),P(r,"IMAGE:image_in"),P(r,"NORM_RECT:norm_rect_in"),w(r,"DETECTIONS:detections"),r.o(t),ge(e,r),this.g.attachProtoVectorListener("detections",((s,n)=>{for(const i of s)s=zo(i),this.j.detections.push(Ea(s));f(this,n)})),this.g.attachEmptyPacketListener("detections",(s=>{f(this,s)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};he.prototype.detectForVideo=he.prototype.G,he.prototype.detect=he.prototype.F,he.prototype.setOptions=he.prototype.o,he.createFromModelPath=async function(e,t){return A(he,e,{baseOptions:{modelAssetPath:t}})},he.createFromModelBuffer=function(e,t){return A(he,e,{baseOptions:{modelAssetBuffer:t}})},he.createFromOptions=function(e,t){return A(he,e,t)};var Ln=_e([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]),Pn=_e([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]),Mn=_e([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),Ha=_e([474,475],[475,476],[476,477],[477,474]),Fn=_e([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]),xn=_e([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),za=_e([469,470],[470,471],[471,472],[472,469]),$n=_e([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]),Wa=[...Ln,...Pn,...Mn,...Fn,...xn,...$n],Ka=_e([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 qa(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var O=class extends ce{constructor(e,t){super(new we(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,v(e=this.h=new ra,0,1,t=new $),this.A=new ta,v(this.h,0,3,this.A),this.u=new ts,v(this.h,0,2,this.u),Ie(this.u,4,1),y(this.u,2,.5),y(this.A,2,.5),y(this.h,4,.5)}get baseOptions(){return E(this.h,$,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){return"numFaces"in e&&Ie(this.u,4,e.numFaces??1),"minFaceDetectionConfidence"in e&&y(this.u,2,e.minFaceDetectionConfidence??.5),"minTrackingConfidence"in e&&y(this.h,4,e.minTrackingConfidence??.5),"minFacePresenceConfidence"in e&&y(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 qa(this),Ae(this,e,t),this.j}G(e,t,r){return qa(this),Fe(this,e,r,t),this.j}m(){var e=new ae;x(e,"image_in"),x(e,"norm_rect"),k(e,"face_landmarks");const t=new oe;Le(t,bu,this.h);const r=new Z;ne(r,2,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),P(r,"IMAGE:image_in"),P(r,"NORM_RECT:norm_rect"),w(r,"NORM_LANDMARKS:face_landmarks"),r.o(t),ge(e,r),this.g.attachProtoVectorListener("face_landmarks",((s,n)=>{for(const i of s)s=pr(i),this.j.faceLandmarks.push(rs(s));f(this,n)})),this.g.attachEmptyPacketListener("face_landmarks",(s=>{f(this,s)})),this.outputFaceBlendshapes&&(k(e,"blendshapes"),w(r,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",((s,n)=>{if(this.outputFaceBlendshapes)for(const i of s)s=Jr(i),this.j.faceBlendshapes.push(wn(s.g()??[]));f(this,n)})),this.g.attachEmptyPacketListener("blendshapes",(s=>{f(this,s)}))),this.outputFacialTransformationMatrixes&&(k(e,"face_geometry"),w(r,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",((s,n)=>{if(this.outputFacialTransformationMatrixes)for(const i of s)(s=E(s=yu(i),cu,2))&&this.j.facialTransformationMatrixes.push({rows:pe(s,1)??0??0,columns:pe(s,2)??0??0,data:ot(s,3,Ce,it()).slice()??[]});f(this,n)})),this.g.attachEmptyPacketListener("face_geometry",(s=>{f(this,s)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};O.prototype.detectForVideo=O.prototype.G,O.prototype.detect=O.prototype.F,O.prototype.setOptions=O.prototype.o,O.createFromModelPath=function(e,t){return A(O,e,{baseOptions:{modelAssetPath:t}})},O.createFromModelBuffer=function(e,t){return A(O,e,{baseOptions:{modelAssetBuffer:t}})},O.createFromOptions=function(e,t){return A(O,e,t)},O.FACE_LANDMARKS_LIPS=Ln,O.FACE_LANDMARKS_LEFT_EYE=Pn,O.FACE_LANDMARKS_LEFT_EYEBROW=Mn,O.FACE_LANDMARKS_LEFT_IRIS=Ha,O.FACE_LANDMARKS_RIGHT_EYE=Fn,O.FACE_LANDMARKS_RIGHT_EYEBROW=xn,O.FACE_LANDMARKS_RIGHT_IRIS=za,O.FACE_LANDMARKS_FACE_OVAL=$n,O.FACE_LANDMARKS_CONTOURS=Wa,O.FACE_LANDMARKS_TESSELATION=Ka;var On=_e([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 Xa(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function Ya(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 Qa(e,t=!0){const r=[];for(const n of e){var s=Jr(n);e=[];for(const i of s.g())s=t&&pe(i,1)!=null?pe(i,1)??0:-1,e.push({score:R(i,2)??0,index:s,categoryName:Y(L(i,3))??""??"",displayName:Y(L(i,4))??""??""});r.push(e)}return r}var ue=class extends ce{constructor(e,t){super(new we(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],v(e=this.j=new ia,0,1,t=new $),this.u=new fn,v(this.j,0,2,this.u),this.D=new dn,v(this.u,0,3,this.D),this.A=new na,v(this.u,0,2,this.A),this.h=new vu,v(this.j,0,3,this.h),y(this.A,2,.5),y(this.u,4,.5),y(this.D,2,.5)}get baseOptions(){return E(this.j,$,1)}set baseOptions(e){v(this.j,0,1,e)}o(e){var n,i,o,a;if(Ie(this.A,3,e.numHands??1),"minHandDetectionConfidence"in e&&y(this.A,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&y(this.u,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&y(this.D,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new Gt,r=t,s=_n(e.cannedGesturesClassifierOptions,(n=E(this.h,Gt,3))==null?void 0:n.l());v(r,0,2,s),v(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&((i=E(this.h,Gt,3))==null||i.g());return e.customGesturesClassifierOptions?(v(r=t=new Gt,0,2,s=_n(e.customGesturesClassifierOptions,(o=E(this.h,Gt,4))==null?void 0:o.l())),v(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&((a=E(this.h,Gt,4))==null||a.g()),this.l(e)}Ha(e,t){return Xa(this),Ae(this,e,t),Ya(this)}Ia(e,t,r){return Xa(this),Fe(this,e,r,t),Ya(this)}m(){var e=new ae;x(e,"image_in"),x(e,"norm_rect"),k(e,"hand_gestures"),k(e,"hand_landmarks"),k(e,"world_hand_landmarks"),k(e,"handedness");const t=new oe;Le(t,_u,this.j);const r=new Z;ne(r,2,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),P(r,"IMAGE:image_in"),P(r,"NORM_RECT:norm_rect"),w(r,"HAND_GESTURES:hand_gestures"),w(r,"LANDMARKS:hand_landmarks"),w(r,"WORLD_LANDMARKS:world_hand_landmarks"),w(r,"HANDEDNESS:handedness"),r.o(t),ge(e,r),this.g.attachProtoVectorListener("hand_landmarks",((s,n)=>{for(const i of s){s=pr(i);const o=[];for(const a of Re(s,Ko,1))o.push({x:R(a,1)??0,y:R(a,2)??0,z:R(a,3)??0,visibility:R(a,4)??0});this.landmarks.push(o)}f(this,n)})),this.g.attachEmptyPacketListener("hand_landmarks",(s=>{f(this,s)})),this.g.attachProtoVectorListener("world_hand_landmarks",((s,n)=>{for(const i of s){s=Vt(i);const o=[];for(const a of Re(s,Wo,1))o.push({x:R(a,1)??0,y:R(a,2)??0,z:R(a,3)??0,visibility:R(a,4)??0});this.worldLandmarks.push(o)}f(this,n)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(s=>{f(this,s)})),this.g.attachProtoVectorListener("hand_gestures",((s,n)=>{this.gestures.push(...Qa(s,!1)),f(this,n)})),this.g.attachEmptyPacketListener("hand_gestures",(s=>{f(this,s)})),this.g.attachProtoVectorListener("handedness",((s,n)=>{this.handedness.push(...Qa(s)),f(this,n)})),this.g.attachEmptyPacketListener("handedness",(s=>{f(this,s)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function Ja(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}ue.prototype.recognizeForVideo=ue.prototype.Ia,ue.prototype.recognize=ue.prototype.Ha,ue.prototype.setOptions=ue.prototype.o,ue.createFromModelPath=function(e,t){return A(ue,e,{baseOptions:{modelAssetPath:t}})},ue.createFromModelBuffer=function(e,t){return A(ue,e,{baseOptions:{modelAssetBuffer:t}})},ue.createFromOptions=function(e,t){return A(ue,e,t)},ue.HAND_CONNECTIONS=On;var le=class extends ce{constructor(e,t){super(new we(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],v(e=this.h=new fn,0,1,t=new $),this.u=new dn,v(this.h,0,3,this.u),this.j=new na,v(this.h,0,2,this.j),Ie(this.j,3,1),y(this.j,2,.5),y(this.u,2,.5),y(this.h,4,.5)}get baseOptions(){return E(this.h,$,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){return"numHands"in e&&Ie(this.j,3,e.numHands??1),"minHandDetectionConfidence"in e&&y(this.j,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&y(this.h,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&y(this.u,2,e.minHandPresenceConfidence??.5),this.l(e)}F(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Ae(this,e,t),Ja(this)}G(e,t,r){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Fe(this,e,r,t),Ja(this)}m(){var e=new ae;x(e,"image_in"),x(e,"norm_rect"),k(e,"hand_landmarks"),k(e,"world_hand_landmarks"),k(e,"handedness");const t=new oe;Le(t,wu,this.h);const r=new Z;ne(r,2,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),P(r,"IMAGE:image_in"),P(r,"NORM_RECT:norm_rect"),w(r,"LANDMARKS:hand_landmarks"),w(r,"WORLD_LANDMARKS:world_hand_landmarks"),w(r,"HANDEDNESS:handedness"),r.o(t),ge(e,r),this.g.attachProtoVectorListener("hand_landmarks",((s,n)=>{for(const i of s)s=pr(i),this.landmarks.push(rs(s));f(this,n)})),this.g.attachEmptyPacketListener("hand_landmarks",(s=>{f(this,s)})),this.g.attachProtoVectorListener("world_hand_landmarks",((s,n)=>{for(const i of s)s=Vt(i),this.worldLandmarks.push(mr(s));f(this,n)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(s=>{f(this,s)})),this.g.attachProtoVectorListener("handedness",((s,n)=>{var i=this.handedness,o=i.push;const a=[];for(const c of s){s=Jr(c);const u=[];for(const h of s.g())u.push({score:R(h,2)??0,index:pe(h,1)??0??-1,categoryName:Y(L(h,3))??""??"",displayName:Y(L(h,4))??""??""});a.push(u)}o.call(i,...a),f(this,n)})),this.g.attachEmptyPacketListener("handedness",(s=>{f(this,s)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};le.prototype.detectForVideo=le.prototype.G,le.prototype.detect=le.prototype.F,le.prototype.setOptions=le.prototype.o,le.createFromModelPath=function(e,t){return A(le,e,{baseOptions:{modelAssetPath:t}})},le.createFromModelBuffer=function(e,t){return A(le,e,{baseOptions:{modelAssetBuffer:t}})},le.createFromOptions=function(e,t){return A(le,e,t)},le.HAND_CONNECTIONS=On;var Za=_e([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 ec(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function tc(e){try{if(!e.D)return e.h;e.D(e.h)}finally{is(e)}}function as(e,t){e=pr(e),t.push(rs(e))}var M=class extends ce{constructor(e,t){super(new we(e,t),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,v(e=this.j=new la,0,1,t=new $),this.I=new dn,v(this.j,0,2,this.I),this.W=new Au,v(this.j,0,3,this.W),this.u=new ts,v(this.j,0,4,this.u),this.O=new ta,v(this.j,0,5,this.O),this.A=new ha,v(this.j,0,6,this.A),this.M=new ua,v(this.j,0,7,this.M),y(this.u,2,.5),y(this.u,3,.3),y(this.O,2,.5),y(this.A,2,.5),y(this.A,3,.3),y(this.M,2,.5),y(this.I,2,.5)}get baseOptions(){return E(this.j,$,1)}set baseOptions(e){v(this.j,0,1,e)}o(e){return"minFaceDetectionConfidence"in e&&y(this.u,2,e.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in e&&y(this.u,3,e.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in e&&y(this.O,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"minPoseDetectionConfidence"in e&&y(this.A,2,e.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in e&&y(this.A,3,e.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in e&&y(this.M,2,e.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in e&&y(this.I,2,e.minHandLandmarksConfidence??.5),this.l(e)}F(e,t,r){const s=typeof t!="function"?t:{};return this.D=typeof t=="function"?t:r,ec(this),Ae(this,e,s),tc(this)}G(e,t,r,s){const n=typeof r!="function"?r:{};return this.D=typeof r=="function"?r:s,ec(this),Fe(this,e,n,t),tc(this)}m(){var e=new ae;x(e,"input_frames_image"),k(e,"pose_landmarks"),k(e,"pose_world_landmarks"),k(e,"face_landmarks"),k(e,"left_hand_landmarks"),k(e,"left_hand_world_landmarks"),k(e,"right_hand_landmarks"),k(e,"right_hand_world_landmarks");const t=new oe,r=new Lo;ne(r,1,"type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),(function(n,i){if(i!=null)if(Array.isArray(i))S(n,2,Rr(i,0,hr));else{if(!(typeof i=="string"||i instanceof ke||ys(i)))throw Error("invalid value in Any.value field: "+i+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");je(n,2,ws(i,!1),Ze())}})(r,this.j.g());const s=new Z;ne(s,2,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),Vs(s,8,Lo,r),P(s,"IMAGE:input_frames_image"),w(s,"POSE_LANDMARKS:pose_landmarks"),w(s,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),w(s,"FACE_LANDMARKS:face_landmarks"),w(s,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),w(s,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),w(s,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),w(s,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),s.o(t),ge(e,s),ns(this,e),this.g.attachProtoListener("pose_landmarks",((n,i)=>{as(n,this.h.poseLandmarks),f(this,i)})),this.g.attachEmptyPacketListener("pose_landmarks",(n=>{f(this,n)})),this.g.attachProtoListener("pose_world_landmarks",((n,i)=>{var o=this.h.poseWorldLandmarks;n=Vt(n),o.push(mr(n)),f(this,i)})),this.g.attachEmptyPacketListener("pose_world_landmarks",(n=>{f(this,n)})),this.outputPoseSegmentationMasks&&(w(s,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),Ht(this,"pose_segmentation_mask"),this.g.Z("pose_segmentation_mask",((n,i)=>{this.h.poseSegmentationMasks=[Wt(this,n,!0,!this.D)],f(this,i)})),this.g.attachEmptyPacketListener("pose_segmentation_mask",(n=>{this.h.poseSegmentationMasks=[],f(this,n)}))),this.g.attachProtoListener("face_landmarks",((n,i)=>{as(n,this.h.faceLandmarks),f(this,i)})),this.g.attachEmptyPacketListener("face_landmarks",(n=>{f(this,n)})),this.outputFaceBlendshapes&&(k(e,"extra_blendshapes"),w(s,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",((n,i)=>{var o=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(n=Jr(n),o.push(wn(n.g()??[]))),f(this,i)})),this.g.attachEmptyPacketListener("extra_blendshapes",(n=>{f(this,n)}))),this.g.attachProtoListener("left_hand_landmarks",((n,i)=>{as(n,this.h.leftHandLandmarks),f(this,i)})),this.g.attachEmptyPacketListener("left_hand_landmarks",(n=>{f(this,n)})),this.g.attachProtoListener("left_hand_world_landmarks",((n,i)=>{var o=this.h.leftHandWorldLandmarks;n=Vt(n),o.push(mr(n)),f(this,i)})),this.g.attachEmptyPacketListener("left_hand_world_landmarks",(n=>{f(this,n)})),this.g.attachProtoListener("right_hand_landmarks",((n,i)=>{as(n,this.h.rightHandLandmarks),f(this,i)})),this.g.attachEmptyPacketListener("right_hand_landmarks",(n=>{f(this,n)})),this.g.attachProtoListener("right_hand_world_landmarks",((n,i)=>{var o=this.h.rightHandWorldLandmarks;n=Vt(n),o.push(mr(n)),f(this,i)})),this.g.attachEmptyPacketListener("right_hand_world_landmarks",(n=>{f(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};M.prototype.detectForVideo=M.prototype.G,M.prototype.detect=M.prototype.F,M.prototype.setOptions=M.prototype.o,M.createFromModelPath=function(e,t){return A(M,e,{baseOptions:{modelAssetPath:t}})},M.createFromModelBuffer=function(e,t){return A(M,e,{baseOptions:{modelAssetBuffer:t}})},M.createFromOptions=function(e,t){return A(M,e,t)},M.HAND_CONNECTIONS=On,M.POSE_CONNECTIONS=Za,M.FACE_LANDMARKS_LIPS=Ln,M.FACE_LANDMARKS_LEFT_EYE=Pn,M.FACE_LANDMARKS_LEFT_EYEBROW=Mn,M.FACE_LANDMARKS_LEFT_IRIS=Ha,M.FACE_LANDMARKS_RIGHT_EYE=Fn,M.FACE_LANDMARKS_RIGHT_EYEBROW=xn,M.FACE_LANDMARKS_RIGHT_IRIS=za,M.FACE_LANDMARKS_FACE_OVAL=$n,M.FACE_LANDMARKS_CONTOURS=Wa,M.FACE_LANDMARKS_TESSELATION=Ka;var ye=class extends ce{constructor(e,t){super(new we(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},v(e=this.h=new da,0,1,t=new $)}get baseOptions(){return E(this.h,$,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){return v(this.h,0,2,_n(e,E(this.h,hn,2))),this.l(e)}sa(e,t){return this.j={classifications:[]},Ae(this,e,t),this.j}ta(e,t,r){return this.j={classifications:[]},Fe(this,e,r,t),this.j}m(){var e=new ae;x(e,"input_image"),x(e,"norm_rect"),k(e,"classifications");const t=new oe;Le(t,Eu,this.h);const r=new Z;ne(r,2,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),P(r,"IMAGE:input_image"),P(r,"NORM_RECT:norm_rect"),w(r,"CLASSIFICATIONS:classifications"),r.o(t),ge(e,r),this.g.attachProtoListener("classifications",((s,n)=>{this.j=Pu(lu(s)),f(this,n)})),this.g.attachEmptyPacketListener("classifications",(s=>{f(this,s)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ye.prototype.classifyForVideo=ye.prototype.ta,ye.prototype.classify=ye.prototype.sa,ye.prototype.setOptions=ye.prototype.o,ye.createFromModelPath=function(e,t){return A(ye,e,{baseOptions:{modelAssetPath:t}})},ye.createFromModelBuffer=function(e,t){return A(ye,e,{baseOptions:{modelAssetBuffer:t}})},ye.createFromOptions=function(e,t){return A(ye,e,t)};var de=class extends ce{constructor(e,t){super(new we(e,t),"image_in","norm_rect",!0),this.h=new fa,this.embeddings={embeddings:[]},v(e=this.h,0,1,t=new $)}get baseOptions(){return E(this.h,$,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){var t=this.h,r=E(this.h,Jo,2);return r=r?r.clone():new Jo,e.l2Normalize!==void 0?S(r,1,or(e.l2Normalize)):"l2Normalize"in e&&S(r,1),e.quantize!==void 0?S(r,2,or(e.quantize)):"quantize"in e&&S(r,2),v(t,0,2,r),this.l(e)}za(e,t){return Ae(this,e,t),this.embeddings}Aa(e,t,r){return Fe(this,e,r,t),this.embeddings}m(){var e=new ae;x(e,"image_in"),x(e,"norm_rect"),k(e,"embeddings_out");const t=new oe;Le(t,ku,this.h);const r=new Z;ne(r,2,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),P(r,"IMAGE:image_in"),P(r,"NORM_RECT:norm_rect"),w(r,"EMBEDDINGS:embeddings_out"),r.o(t),ge(e,r),this.g.attachProtoListener("embeddings_out",((s,n)=>{s=pu(s),this.embeddings=(function(i){return{embeddings:Re(i,fu,1).map((o=>{var u,h;const a={headIndex:pe(o,3)??0??-1,headName:Y(L(o,4))??""??""};var c=o.v;return zi(c,0|c[p],Xo,Bs(o,1))!==void 0?(o=ot(o=E(o,Xo,Bs(o,1),void 0),1,Ce,it()),a.floatEmbedding=o.slice()):(c=new Uint8Array(0),a.quantizedEmbedding=((h=(u=E(o,du,Bs(o,2),void 0))==null?void 0:u.na())==null?void 0:h.h())??c),a})),timestampMs:Aa(qi(i))}})(s),f(this,n)})),this.g.attachEmptyPacketListener("embeddings_out",(s=>{f(this,s)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};de.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=Sa(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=Sa(ka(e.quantizedEmbedding),ka(t.quantizedEmbedding))}return e},de.prototype.embedForVideo=de.prototype.Aa,de.prototype.embed=de.prototype.za,de.prototype.setOptions=de.prototype.o,de.createFromModelPath=function(e,t){return A(de,e,{baseOptions:{modelAssetPath:t}})},de.createFromModelBuffer=function(e,t){return A(de,e,{baseOptions:{modelAssetBuffer:t}})},de.createFromOptions=function(e,t){return A(de,e,t)};var Rn=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 Iu(e){var r,s;const t=(function(n){return Re(n,Z,1)})(e.ca()).filter((n=>(Y(L(n,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&&(((s=(r=E(t[0],oe,7))==null?void 0:r.j())==null?void 0:s.g())??new Map).forEach(((n,i)=>{e.u[Number(i)]=Y(L(n,1))??""}))}function rc(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function sc(e){try{const t=new Rn(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{is(e)}}Rn.prototype.close=Rn.prototype.close;var ee=class extends ce{constructor(e,t){super(new we(e,t),"image_in","norm_rect",!1),this.u=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new yn,this.A=new pa,v(this.h,0,3,this.A),v(e=this.h,0,1,t=new $)}get baseOptions(){return E(this.h,$,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?S(this.h,2,cr(e.displayNamesLocale)):"displayNamesLocale"in e&&S(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}L(){Iu(this)}segment(e,t,r){const s=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:r,rc(this),Ae(this,e,s),sc(this)}La(e,t,r,s){const n=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:s,rc(this),Fe(this,e,n,t),sc(this)}Da(){return this.u}m(){var e=new ae;x(e,"image_in"),x(e,"norm_rect");const t=new oe;Le(t,ya,this.h);const r=new Z;ne(r,2,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),P(r,"IMAGE:image_in"),P(r,"NORM_RECT:norm_rect"),r.o(t),ge(e,r),ns(this,e),this.outputConfidenceMasks&&(k(e,"confidence_masks"),w(r,"CONFIDENCE_MASKS:confidence_masks"),Ht(this,"confidence_masks"),this.g.aa("confidence_masks",((s,n)=>{this.confidenceMasks=s.map((i=>Wt(this,i,!0,!this.j))),f(this,n)})),this.g.attachEmptyPacketListener("confidence_masks",(s=>{this.confidenceMasks=[],f(this,s)}))),this.outputCategoryMask&&(k(e,"category_mask"),w(r,"CATEGORY_MASK:category_mask"),Ht(this,"category_mask"),this.g.Z("category_mask",((s,n)=>{this.categoryMask=Wt(this,s,!1,!this.j),f(this,n)})),this.g.attachEmptyPacketListener("category_mask",(s=>{this.categoryMask=void 0,f(this,s)}))),k(e,"quality_scores"),w(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((s,n)=>{this.qualityScores=s,f(this,n)})),this.g.attachEmptyPacketListener("quality_scores",(s=>{this.categoryMask=void 0,f(this,s)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ee.prototype.getLabels=ee.prototype.Da,ee.prototype.segmentForVideo=ee.prototype.La,ee.prototype.segment=ee.prototype.segment,ee.prototype.setOptions=ee.prototype.o,ee.createFromModelPath=function(e,t){return A(ee,e,{baseOptions:{modelAssetPath:t}})},ee.createFromModelBuffer=function(e,t){return A(ee,e,{baseOptions:{modelAssetBuffer:t}})},ee.createFromOptions=function(e,t){return A(ee,e,t)};var In=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()}};In.prototype.close=In.prototype.close;var xe=class extends ce{constructor(e,t){super(new we(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new yn,this.u=new pa,v(this.h,0,3,this.u),v(e=this.h,0,1,t=new $)}get baseOptions(){return E(this.h,$,1)}set baseOptions(e){v(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,s){const n=typeof r!="function"?r:{};if(this.j=typeof r=="function"?r:s,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,r=this.C+1,s=new va,t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var i=new bn;je(i,3,or(!0),!1),je(i,1,ir(t.keypoint.x),0),je(i,2,ir(t.keypoint.y),0),ur(s,1,vn,i)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");{const a=new Cu;for(i of t.scribble)je(t=new bn,3,or(!0),!1),je(t,1,ir(i.x),0),je(t,2,ir(i.y),0),Vs(a,1,bn,t);ur(s,2,vn,a)}}this.g.addProtoToStream(s.g(),"mediapipe.tasks.vision.interactive_segmenter.proto.RegionOfInterest","roi_in",r),Ae(this,e,n);e:{try{const a=new In(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var o=a;break e}this.j(a)}finally{is(this)}o=void 0}return o}m(){var e=new ae;x(e,"image_in"),x(e,"roi_in"),x(e,"norm_rect_in");const t=new oe;Le(t,ya,this.h);const r=new Z;ne(r,2,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraphV2"),P(r,"IMAGE:image_in"),P(r,"ROI:roi_in"),P(r,"NORM_RECT:norm_rect_in"),r.o(t),ge(e,r),ns(this,e),this.outputConfidenceMasks&&(k(e,"confidence_masks"),w(r,"CONFIDENCE_MASKS:confidence_masks"),Ht(this,"confidence_masks"),this.g.aa("confidence_masks",((s,n)=>{this.confidenceMasks=s.map((i=>Wt(this,i,!0,!this.j))),f(this,n)})),this.g.attachEmptyPacketListener("confidence_masks",(s=>{this.confidenceMasks=[],f(this,s)}))),this.outputCategoryMask&&(k(e,"category_mask"),w(r,"CATEGORY_MASK:category_mask"),Ht(this,"category_mask"),this.g.Z("category_mask",((s,n)=>{this.categoryMask=Wt(this,s,!1,!this.j),f(this,n)})),this.g.attachEmptyPacketListener("category_mask",(s=>{this.categoryMask=void 0,f(this,s)}))),k(e,"quality_scores"),w(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((s,n)=>{this.qualityScores=s,f(this,n)})),this.g.attachEmptyPacketListener("quality_scores",(s=>{this.categoryMask=void 0,f(this,s)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};xe.prototype.segment=xe.prototype.segment,xe.prototype.setOptions=xe.prototype.o,xe.createFromModelPath=function(e,t){return A(xe,e,{baseOptions:{modelAssetPath:t}})},xe.createFromModelBuffer=function(e,t){return A(xe,e,{baseOptions:{modelAssetBuffer:t}})},xe.createFromOptions=function(e,t){return A(xe,e,t)};var be=class extends ce{constructor(e,t){super(new we(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},v(e=this.h=new _a,0,1,t=new $)}get baseOptions(){return E(this.h,$,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?S(this.h,2,cr(e.displayNamesLocale)):"displayNamesLocale"in e&&S(this.h,2),e.maxResults!==void 0?Ie(this.h,3,e.maxResults):"maxResults"in e&&S(this.h,3),e.scoreThreshold!==void 0?y(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&S(this.h,4),e.categoryAllowlist!==void 0?Ir(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&S(this.h,5),e.categoryDenylist!==void 0?Ir(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&S(this.h,6),this.l(e)}F(e,t){return this.j={detections:[]},Ae(this,e,t),this.j}G(e,t,r){return this.j={detections:[]},Fe(this,e,r,t),this.j}m(){var e=new ae;x(e,"input_frame_gpu"),x(e,"norm_rect"),k(e,"detections");const t=new oe;Le(t,Tu,this.h);const r=new Z;ne(r,2,"mediapipe.tasks.vision.ObjectDetectorGraph"),P(r,"IMAGE:input_frame_gpu"),P(r,"NORM_RECT:norm_rect"),w(r,"DETECTIONS:detections"),r.o(t),ge(e,r),this.g.attachProtoVectorListener("detections",((s,n)=>{for(const i of s)s=zo(i),this.j.detections.push(Ea(s));f(this,n)})),this.g.attachEmptyPacketListener("detections",(s=>{f(this,s)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};be.prototype.detectForVideo=be.prototype.G,be.prototype.detect=be.prototype.F,be.prototype.setOptions=be.prototype.o,be.createFromModelPath=async function(e,t){return A(be,e,{baseOptions:{modelAssetPath:t}})},be.createFromModelBuffer=function(e,t){return A(be,e,{baseOptions:{modelAssetBuffer:t}})},be.createFromOptions=function(e,t){return A(be,e,t)};var Nn=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 nc(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function ic(e){try{const t=new Nn(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.u)return t;e.u(t)}finally{is(e)}}Nn.prototype.close=Nn.prototype.close;var fe=class extends ce{constructor(e,t){super(new we(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,v(e=this.h=new wa,0,1,t=new $),this.A=new ua,v(this.h,0,3,this.A),this.j=new ha,v(this.h,0,2,this.j),Ie(this.j,4,1),y(this.j,2,.5),y(this.A,2,.5),y(this.h,4,.5)}get baseOptions(){return E(this.h,$,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){return"numPoses"in e&&Ie(this.j,4,e.numPoses??1),"minPoseDetectionConfidence"in e&&y(this.j,2,e.minPoseDetectionConfidence??.5),"minTrackingConfidence"in e&&y(this.h,4,e.minTrackingConfidence??.5),"minPosePresenceConfidence"in e&&y(this.A,2,e.minPosePresenceConfidence??.5),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}F(e,t,r){const s=typeof t!="function"?t:{};return this.u=typeof t=="function"?t:r,nc(this),Ae(this,e,s),ic(this)}G(e,t,r,s){const n=typeof r!="function"?r:{};return this.u=typeof r=="function"?r:s,nc(this),Fe(this,e,n,t),ic(this)}m(){var e=new ae;x(e,"image_in"),x(e,"norm_rect"),k(e,"normalized_landmarks"),k(e,"world_landmarks"),k(e,"segmentation_masks");const t=new oe;Le(t,Lu,this.h);const r=new Z;ne(r,2,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),P(r,"IMAGE:image_in"),P(r,"NORM_RECT:norm_rect"),w(r,"NORM_LANDMARKS:normalized_landmarks"),w(r,"WORLD_LANDMARKS:world_landmarks"),r.o(t),ge(e,r),ns(this,e),this.g.attachProtoVectorListener("normalized_landmarks",((s,n)=>{this.landmarks=[];for(const i of s)s=pr(i),this.landmarks.push(rs(s));f(this,n)})),this.g.attachEmptyPacketListener("normalized_landmarks",(s=>{this.landmarks=[],f(this,s)})),this.g.attachProtoVectorListener("world_landmarks",((s,n)=>{this.worldLandmarks=[];for(const i of s)s=Vt(i),this.worldLandmarks.push(mr(s));f(this,n)})),this.g.attachEmptyPacketListener("world_landmarks",(s=>{this.worldLandmarks=[],f(this,s)})),this.outputSegmentationMasks&&(w(r,"SEGMENTATION_MASK:segmentation_masks"),Ht(this,"segmentation_masks"),this.g.aa("segmentation_masks",((s,n)=>{this.segmentationMasks=s.map((i=>Wt(this,i,!0,!this.u))),f(this,n)})),this.g.attachEmptyPacketListener("segmentation_masks",(s=>{this.segmentationMasks=[],f(this,s)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};fe.prototype.detectForVideo=fe.prototype.G,fe.prototype.detect=fe.prototype.F,fe.prototype.setOptions=fe.prototype.o,fe.createFromModelPath=function(e,t){return A(fe,e,{baseOptions:{modelAssetPath:t}})},fe.createFromModelBuffer=function(e,t){return A(fe,e,{baseOptions:{modelAssetBuffer:t}})},fe.createFromOptions=function(e,t){return A(fe,e,t)},fe.POSE_CONNECTIONS=Za;const Nu=800,Bu=1.5,Uu=.15,oc=new WeakMap;function Du(e,t,r){const s=r??document.createElement("canvas");s.width=t.width,s.height=t.height;const n=s.getContext("2d");if(!n)return 0;n.drawImage(e,t.x,t.y,t.width,t.height,0,0,t.width,t.height);const i=n.getImageData(0,0,t.width,t.height),o=r?Vu(r,t.width*t.height):void 0,a=Math.max(ju(i,o),0);return Math.min(Math.max(a/Nu,0),1)}function ju(e,t){const{data:r,width:s,height:n}=e,i=s*n,o=t&&t.length>=i?t:new Float32Array(i);for(let l=0;l<i;l++){const d=l*4;o[l]=r[d]*.299+r[d+1]*.587+r[d+2]*.114}const a=(s-2)*(n-2);if(a<=0)return 0;let c=0,u=0;for(let l=1;l<n-1;l++)for(let d=1;d<s-1;d++){const b=l*s+d,C=o[b-s]+o[b-1]+-4*o[b]+o[b+1]+o[b+s];c+=C,u+=C*C}const h=c/a;return Math.max(u/a-h*h,0)}function Vu(e,t){const r=oc.get(e);if(r&&r.length>=t)return r;const s=r?Math.max(t,Math.ceil(r.length*Bu)):t,n=new Float32Array(s);return oc.set(e,n),n}const ac=.1,cc=.42,Bn=.24,Un=.14,Dn=.18,hc=.12,uc=.2,Gu=.95,Hu=.2,zu=1,Wu=0,Ku=1,qu=2;function lc(e){var b;const{detections:t,width:r,height:s,sharpnessScore:n,resolveSharpnessScore:i}=e;if(t.length===0)return{hasFace:!1,faceCount:0,confidence:0,captureScore:0,sharpnessScore:0,isCentered:!1,passesQualityChecks:!1,feedback:"no-face",message:"No face detected. Center your face in the oval and look at the camera."};if(t.length>1)return{hasFace:!0,faceCount:t.length,confidence:((b=t[0])==null?void 0:b.confidence)??0,captureScore:0,sharpnessScore:0,isCentered:!1,passesQualityChecks:!1,feedback:"multiple-faces",message:"Multiple faces detected. Make sure only one person is in view."};const o=t[0],a=o.boundingBox;if(!a)return{hasFace:!0,faceCount:1,confidence:o.confidence,captureScore:0,sharpnessScore:0,isCentered:!1,passesQualityChecks:!1,feedback:"face-unclear",message:"Face detected, but the frame is unclear. Hold still and try again."};const c=a.width*a.height/(r*s);if(c<ac)return ft(o.confidence,"too-far","Move closer to the camera.");if(c>cc)return ft(o.confidence,"too-close","Move slightly farther away.");const u=(a.originX+a.width/2)/r,h=(a.originY+a.height/2)/s;if(u<.5-Un)return ft(o.confidence,"move-left","Move your face a little to the left.");if(u>.5+Un)return ft(o.confidence,"move-right","Move your face a little to the right.");if(h<.5-Dn)return ft(o.confidence,"move-down","Move your face slightly down.");if(h>.5+Dn)return ft(o.confidence,"move-up","Move your face slightly up.");const l=Xu(o.keypoints);if(l)return ft(o.confidence,l.feedback,l.message);const d=n??(i==null?void 0:i())??zu;return d<Uu?{hasFace:!0,faceCount:1,confidence:o.confidence,captureScore:dc(o.confidence,u,h,c,d),sharpnessScore:d,isCentered:!0,passesQualityChecks:!1,feedback:"too-blurry",message:"Hold still so the image is not blurry."}:{hasFace:!0,faceCount:1,confidence:o.confidence,captureScore:dc(o.confidence,u,h,c,d),sharpnessScore:d,isCentered:!0,passesQualityChecks:!0,feedback:"good",message:"Hold still. Capturing automatically..."}}function Xu(e){const t=e[Wu],r=e[Ku],s=e[qu];if(!t||!r||!s)return null;const n=Math.abs(r.x-t.x);if(n===0)return null;const i=(t.x+r.x)/2,o=(s.x-i)/n;if(o<=-hc)return{feedback:"turn-left",message:"Turn slightly left so your face points at the camera."};if(o>=hc)return{feedback:"turn-right",message:"Turn slightly right so your face points at the camera."};const a=(t.y-r.y)/n;if(a>=uc)return{feedback:"tilt-left",message:"Straighten your head — it is tilting to the right."};if(a<=-uc)return{feedback:"tilt-right",message:"Straighten your head — it is tilting to the left."};const c=(t.y+r.y)/2,u=(s.y-c)/n;return u>=Gu?{feedback:"look-up",message:"Raise your chin slightly so your face points at the camera."}:u<=Hu?{feedback:"look-down",message:"Lower your chin slightly so your face points at the camera."}:null}function ft(e,t,r){return{hasFace:!0,faceCount:1,confidence:e,captureScore:0,sharpnessScore:0,isCentered:!1,passesQualityChecks:!1,feedback:t,message:r}}function Yl(e){return e}function dc(e,t,r,s,n){const i=Math.abs(t-.5)/Un,o=Math.abs(r-.5)/Dn,a=1-Math.min((i+o)/2,1),c=Math.max(Math.abs(Bn-ac),Math.abs(cc-Bn)),u=1-Math.min(Math.abs(s-Bn)/c,1);return Number((e*.4+a*.25+u*.1+n*.25).toFixed(4))}const Yu="https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision/wasm",Qu="https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/1/blaze_face_short_range.tflite",Ju=.7;let fc=null,pc=null,mc=null;function Zu(){return fc??(fc=dt.forVisionTasks(Yu)),fc}function el(){return pc??(pc=yc("IMAGE")),pc}function gc(){return mc??(mc=yc("VIDEO")),mc}async function yc(e){const t=await Zu();return he.createFromOptions(t,{baseOptions:{modelAssetPath:Qu},runningMode:e,minDetectionConfidence:Ju})}async function jn(e){const r=(await el()).detect(e);return lc({detections:_c(r.detections),width:e.naturalWidth,height:e.naturalHeight})}let bc=null;async function vc(e,t){const s=(await gc()).detectForVideo(e,t),n=_c(s.detections);return lc({detections:n,width:e.videoWidth,height:e.videoHeight,resolveSharpnessScore:n.length===1&&n[0].boundingBox?()=>{const i=n[0].boundingBox;return bc??(bc=document.createElement("canvas")),Du(e,{x:i.originX,y:i.originY,width:i.width,height:i.height},bc)}:void 0})}function _c(e){return e.map(t=>{var r;return{boundingBox:t.boundingBox?{originX:t.boundingBox.originX,originY:t.boundingBox.originY,width:t.boundingBox.width,height:t.boundingBox.height}:void 0,confidence:((r=t.categories[0])==null?void 0:r.score)??0,keypoints:t.keypoints.map(s=>({x:s.x,y:s.y}))}})}const wc="Capturing Face",Ac="Accept",Ec="Take photo",kc="Retake",Sc="Try again",Vn="Start a capture to see camera guidance here.";function Cc(e,t){return{capturePreference:(e==null?void 0:e.capturePreference)??"auto-preferred",allowMediaPickerFallback:(e==null?void 0:e.allowMediaPickerFallback)??!0,component:t,label:wc,idleFeedbackLabel:Vn,confirmLabel:Ac,captureLabel:Ec,retakeLabel:kc,retryLabel:Sc}}async function tl(e){var n,i;const t=/WhatsApp/i.test(e.userAgent??navigator.userAgent),r=e.hasMediaDevices??typeof((n=navigator.mediaDevices)==null?void 0:n.getUserMedia)=="function";let s=!1;return!t&&r&&e.capturePreference==="auto-preferred"&&(s=await(((i=e.probeAutoCapture)==null?void 0:i.call(e))??sl())),{prefersMediaPicker:t,supportsMediaDevices:r,supportsAutoCapture:s}}function rl(e,t){const r=[];return t.supportsMediaDevices&&(e.capturePreference==="auto-preferred"&&t.supportsAutoCapture&&r.push("auto-camera"),r.push("manual-camera")),e.allowMediaPickerFallback&&(r.length===0||r[r.length-1]!=="media-picker")&&r.push("media-picker"),{steps:r,capabilities:t}}async function sl(){if(typeof window.requestAnimationFrame!="function"||typeof window.cancelAnimationFrame!="function"||!document.createElement("canvas").getContext("2d"))return!1;try{return await gc(),!0}catch{return!1}}class Gn extends Error{constructor(t,r){super(t),this.name="CameraAccessError",(r==null?void 0:r.cause)!==void 0&&Object.defineProperty(this,"cause",{configurable:!0,value:r.cause})}}async function nl(){var e;if(!((e=navigator.mediaDevices)!=null&&e.getUserMedia))throw new Gn("In-browser camera capture is not supported in this browser.");try{return await navigator.mediaDevices.getUserMedia({video:{facingMode:{ideal:"user"}},audio:!1})}catch(t){throw new Gn(hl(t),{cause:t})}}async function il(e,t="Failed to start the camera preview."){if(e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA){await e.play();return}await new Promise((r,s)=>{const n=()=>{o(),r()},i=()=>{o(),s(new Error(t))},o=()=>{e.removeEventListener("loadedmetadata",n),e.removeEventListener("error",i)};e.addEventListener("loadedmetadata",n,{once:!0}),e.addEventListener("error",i,{once:!0})}),await e.play()}function ol(e){e.play().catch(()=>{})}function al(){const e=document.createElement("canvas"),t=document.createElement("canvas");let r=!1;const s=i=>{const o=i.getContext("2d");if(!o)throw new Error("Failed to initialize camera capture.");return o},n=(i,o)=>{if(!i.videoWidth||!i.videoHeight)throw new Error("Camera preview is not ready yet.");(o.width!==i.videoWidth||o.height!==i.videoHeight)&&(o.width=i.videoWidth,o.height=i.videoHeight),s(o).drawImage(i,0,0,o.width,o.height)};return{async captureBlob(i){return n(i,e),Lc(e)},captureWorkingFrame(i){n(i,e)},promoteWorkingToBest(){if(!e.width||!e.height)throw new Error("No working frame to promote.");t.width=e.width,t.height=e.height,s(t).drawImage(e,0,0),r=!0},storeBestFrame(i){n(i,t),r=!0},hasStoredBestFrame(){return r},async storedBestFrameToBlob(){if(!r)throw new Error("No best frame is available.");return Lc(t)},resetStoredBestFrame(){r=!1,t.width=0,t.height=0}}}function Tc(){return new Promise(e=>{const t=document.createElement("input");t.type="file",t.accept="image/*",t.capture="user",t.style.display="none",t.addEventListener("change",()=>{var i;const n=((i=t.files)==null?void 0:i[0])??null;s(),e(n)});const r=()=>{setTimeout(()=>{var n;(n=t.files)!=null&&n.length||(s(),e(null))},500)};window.addEventListener("focus",r,{once:!0});function s(){window.removeEventListener("focus",r),t.remove()}document.body.appendChild(t),t.click()})}function Hn(e){return new Promise((t,r)=>{const s=URL.createObjectURL(e),n=new Image;n.onload=()=>{URL.revokeObjectURL(s),t(n)},n.onerror=()=>{URL.revokeObjectURL(s),r(new Error("Failed to load captured image"))},n.src=s})}function cl(e){return new Promise((t,r)=>{const s=new FileReader;s.onload=()=>t(s.result),s.onerror=()=>r(new Error("Failed to read image")),s.readAsDataURL(e)})}function hl(e){if(e instanceof DOMException)switch(e.name){case"NotAllowedError":case"SecurityError":return"Camera access was denied. Allow camera access and try again.";case"NotFoundError":return"No camera was found on this device.";case"NotReadableError":return"The camera is already in use by another application.";default:return e.message||"Failed to access the camera."}return e instanceof Error?e.message:"Failed to access the camera."}function Lc(e){return new Promise((t,r)=>{e.toBlob(s=>{if(!s){r(new Error("Failed to capture an image."));return}t(s)},"image/jpeg",.92)})}const ul="2147483647";async function Pc(e,t){var n;const r=Cc(e,t);if(t)return ll(r);if(!(typeof((n=navigator.mediaDevices)==null?void 0:n.getUserMedia)=="function")){if(r.allowMediaPickerFallback)return Tc();throw new Error("No supported capture strategy is available in this environment.")}return fl(r)}async function ll(e){await Promise.resolve().then(()=>Kc);const t=dl(e.component);return t.embedded=!0,t.capturePreference=e.capturePreference,t.allowMediaPickerFallback=e.allowMediaPickerFallback,new Promise((r,s)=>{const n=()=>{t.removeEventListener("simface-captured",i),t.removeEventListener("simface-cancelled",o),t.removeEventListener("simface-error",a),t.active=!1},i=c=>{n(),r(c.detail.imageBlob)},o=()=>{n(),r(null)},a=c=>{n(),s(new Error(c.detail.error))};t.addEventListener("simface-captured",i),t.addEventListener("simface-cancelled",o),t.addEventListener("simface-error",a),t.startCapture().catch(c=>{n(),s(c instanceof Error?c:new Error("Embedded capture failed."))})})}function dl(e){if(!e)throw new Error("Embedded capture requires a simface-capture component.");if(e.tagName.toLowerCase()!=="simface-capture")throw new Error("Embedded capture requires a simface-capture component.");return e}async function fl(e){return await Promise.resolve().then(()=>Kc),new Promise((t,r)=>{let s=!1,n=null;const i=document.createElement("div");i.setAttribute("data-simface-camera-overlay","true"),i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true"),pl(i,{position:"fixed",inset:"0",zIndex:ul,display:"flex",alignItems:"center",justifyContent:"center",padding:"24px",background:"rgba(15, 23, 42, 0.82)",colorScheme:"light"});const o=document.createElement("simface-capture");o.label=e.label,o.confirmLabel=e.confirmLabel,o.captureLabel=e.captureLabel,o.retakeLabel=e.retakeLabel,o.retryLabel=e.retryLabel,o.capturePreference=e.capturePreference,o.allowMediaPickerFallback=e.allowMediaPickerFallback,i.appendChild(o),document.body.appendChild(i);const a=()=>{n&&window.removeEventListener("keydown",n),o.removeEventListener("simface-captured",u),o.removeEventListener("simface-cancelled",h),o.removeEventListener("simface-error",l),o.active=!1,i.remove()},c=(d,b)=>{if(!s){if(s=!0,a(),b){r(b);return}t(d)}},u=d=>{c(d.detail.imageBlob)},h=()=>{c(null)},l=d=>{c(null,new Error(d.detail.error))};n=d=>{d.key==="Escape"&&c(null)},o.addEventListener("simface-captured",u),o.addEventListener("simface-cancelled",h),o.addEventListener("simface-error",l),window.addEventListener("keydown",n),o.startCapture().catch(d=>{c(null,d instanceof Error?d:new Error("Popup capture failed."))})})}function pl(e,t){Object.assign(e.style,t)}/**
15
+ }`,e.VERTEX_SHADER),this.W=Oa(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 Ue(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 Cn(e){var t=Ue(e,1);if(!t){if(t=Ue(e,0))t=new Float32Array(t).map((s=>s/255));else{t=new Float32Array(e.width*e.height);const s=zt(e);var r=Tn(e);if(Na(r,s,Ba(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),s.readPixels(0,0,e.width,e.height,s.RGBA,s.FLOAT,r);for(let n=0,i=0;n<t.length;++n,i+=4)t[n]=r[i]}else s.readPixels(0,0,e.width,e.height,s.RED,s.FLOAT,t)}e.g.push(t)}return t}function Ba(e){let t=Ue(e,2);if(!t){const r=zt(e);t=ja(e);const s=Cn(e),n=Da(e);r.texImage2D(r.TEXTURE_2D,0,n,e.width,e.height,0,r.RED,r.FLOAT,s),Ln(e)}return t}function zt(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=Ke(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Da(e){if(e=zt(e),!os)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))os=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");os=e.R16F}return os}function Tn(e){return e.l||(e.l=new Ua),e.l}function ja(e){const t=zt(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=Ue(e,2);return r||(r=Ia(Tn(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(r),e.j=!0),t.bindTexture(t.TEXTURE_2D,r),r}function Ln(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var os,q=class{constructor(e,t,r,s,n,i,o){this.g=e,this.m=t,this.j=r,this.canvas=s,this.l=n,this.width=i,this.height=o,this.j&&--Va===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Fa(){return!!Ue(this,0)}ka(){return!!Ue(this,1)}R(){return!!Ue(this,2)}ja(){return(t=Ue(e=this,0))||(t=Cn(e),t=new Uint8Array(t.map((r=>Math.round(255*r)))),e.g.push(t)),t;var e,t}ia(){return Cn(this)}N(){return Ba(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 s=zt(this),n=Tn(this);s.activeTexture(s.TEXTURE1),r=Ia(n,s,this.m?s.LINEAR:s.NEAREST),s.bindTexture(s.TEXTURE_2D,r);const i=Da(this);s.texImage2D(s.TEXTURE_2D,0,i,this.width,this.height,0,s.RED,s.FLOAT,null),s.bindTexture(s.TEXTURE_2D,null),Na(n,s,r),Ru(n,s,!1,(()=>{ja(this),s.clearColor(0,0,0,0),s.clear(s.COLOR_BUFFER_BIT),s.drawArrays(s.TRIANGLE_FAN,0,4),Ln(this)})),Iu(n),Ln(this)}}e.push(r)}return new q(e,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&zt(this).deleteTexture(Ue(this,2)),Va=-1}};q.prototype.close=q.prototype.close,q.prototype.clone=q.prototype.clone,q.prototype.getAsWebGLTexture=q.prototype.N,q.prototype.getAsFloat32Array=q.prototype.ia,q.prototype.getAsUint8Array=q.prototype.ja,q.prototype.hasWebGLTexture=q.prototype.R,q.prototype.hasFloat32Array=q.prototype.ka,q.prototype.hasUint8Array=q.prototype.Fa;var Va=250;function _e(...e){return e.map((([t,r])=>({start:t,end:r})))}const Nu=(function(e){return class extends e{Ja(){this.i._registerModelResourcesGraphService()}}})((Ga=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:La()?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,s=this.i._malloc(r);this.i.HEAPU8.set(e,s),t?this.i._changeBinaryGraph(r,s):this.i._changeTextGraph(r,s),this.i._free(s)}configureAudio(e,t,r,s,n){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),g(this,s||"input_audio",(i=>{g(this,n=n||"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){Me(this,"__graph_config__",(t=>{e(t)})),g(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,s,n){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),g(this,s,(o=>{this.i._addAudioToInputStream(this.g,t,r,o,n)}))}addGpuBufferToStream(e,t,r){g(this,t,(s=>{const[n,i]=Fa(this,e,s);this.i._addBoundTextureToStream(s,n,i,r)}))}addBoolToStream(e,t,r){g(this,t,(s=>{this.i._addBoolToInputStream(e,s,r)}))}addDoubleToStream(e,t,r){g(this,t,(s=>{this.i._addDoubleToInputStream(e,s,r)}))}addFloatToStream(e,t,r){g(this,t,(s=>{this.i._addFloatToInputStream(e,s,r)}))}addIntToStream(e,t,r){g(this,t,(s=>{this.i._addIntToInputStream(e,s,r)}))}addUintToStream(e,t,r){g(this,t,(s=>{this.i._addUintToInputStream(e,s,r)}))}addStringToStream(e,t,r){g(this,t,(s=>{g(this,e,(n=>{this.i._addStringToInputStream(n,s,r)}))}))}addStringRecordToStream(e,t,r){g(this,t,(s=>{xa(this,Object.keys(e),(n=>{xa(this,Object.values(e),(i=>{this.i._addFlatHashMapToInputStream(n,i,Object.keys(e).length,s,r)}))}))}))}addProtoToStream(e,t,r,s){g(this,r,(n=>{g(this,t,(i=>{const o=this.i._malloc(e.length);this.i.HEAPU8.set(e,o),this.i._addProtoToInputStream(o,e.length,i,n,s),this.i._free(o)}))}))}addEmptyPacketToStream(e,t){g(this,e,(r=>{this.i._addEmptyPacketToInputStream(r,t)}))}addBoolVectorToStream(e,t,r){g(this,t,(s=>{const n=this.i._allocateBoolVector(e.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(const i of e)this.i._addBoolVectorEntry(n,i);this.i._addBoolVectorToInputStream(n,s,r)}))}addDoubleVectorToStream(e,t,r){g(this,t,(s=>{const n=this.i._allocateDoubleVector(e.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(const i of e)this.i._addDoubleVectorEntry(n,i);this.i._addDoubleVectorToInputStream(n,s,r)}))}addFloatVectorToStream(e,t,r){g(this,t,(s=>{const n=this.i._allocateFloatVector(e.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(const i of e)this.i._addFloatVectorEntry(n,i);this.i._addFloatVectorToInputStream(n,s,r)}))}addIntVectorToStream(e,t,r){g(this,t,(s=>{const n=this.i._allocateIntVector(e.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(const i of e)this.i._addIntVectorEntry(n,i);this.i._addIntVectorToInputStream(n,s,r)}))}addUintVectorToStream(e,t,r){g(this,t,(s=>{const n=this.i._allocateUintVector(e.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(const i of e)this.i._addUintVectorEntry(n,i);this.i._addUintVectorToInputStream(n,s,r)}))}addStringVectorToStream(e,t,r){g(this,t,(s=>{const n=this.i._allocateStringVector(e.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(const i of e)g(this,i,(o=>{this.i._addStringVectorEntry(n,o)}));this.i._addStringVectorToInputStream(n,s,r)}))}addBoolToInputSidePacket(e,t){g(this,t,(r=>{this.i._addBoolToInputSidePacket(e,r)}))}addDoubleToInputSidePacket(e,t){g(this,t,(r=>{this.i._addDoubleToInputSidePacket(e,r)}))}addFloatToInputSidePacket(e,t){g(this,t,(r=>{this.i._addFloatToInputSidePacket(e,r)}))}addIntToInputSidePacket(e,t){g(this,t,(r=>{this.i._addIntToInputSidePacket(e,r)}))}addUintToInputSidePacket(e,t){g(this,t,(r=>{this.i._addUintToInputSidePacket(e,r)}))}addStringToInputSidePacket(e,t){g(this,t,(r=>{g(this,e,(s=>{this.i._addStringToInputSidePacket(s,r)}))}))}addProtoToInputSidePacket(e,t,r){g(this,r,(s=>{g(this,t,(n=>{const i=this.i._malloc(e.length);this.i.HEAPU8.set(e,i),this.i._addProtoToInputSidePacket(i,e.length,n,s),this.i._free(i)}))}))}addBoolVectorToInputSidePacket(e,t){g(this,t,(r=>{const s=this.i._allocateBoolVector(e.length);if(!s)throw Error("Unable to allocate new bool vector on heap.");for(const n of e)this.i._addBoolVectorEntry(s,n);this.i._addBoolVectorToInputSidePacket(s,r)}))}addDoubleVectorToInputSidePacket(e,t){g(this,t,(r=>{const s=this.i._allocateDoubleVector(e.length);if(!s)throw Error("Unable to allocate new double vector on heap.");for(const n of e)this.i._addDoubleVectorEntry(s,n);this.i._addDoubleVectorToInputSidePacket(s,r)}))}addFloatVectorToInputSidePacket(e,t){g(this,t,(r=>{const s=this.i._allocateFloatVector(e.length);if(!s)throw Error("Unable to allocate new float vector on heap.");for(const n of e)this.i._addFloatVectorEntry(s,n);this.i._addFloatVectorToInputSidePacket(s,r)}))}addIntVectorToInputSidePacket(e,t){g(this,t,(r=>{const s=this.i._allocateIntVector(e.length);if(!s)throw Error("Unable to allocate new int vector on heap.");for(const n of e)this.i._addIntVectorEntry(s,n);this.i._addIntVectorToInputSidePacket(s,r)}))}addUintVectorToInputSidePacket(e,t){g(this,t,(r=>{const s=this.i._allocateUintVector(e.length);if(!s)throw Error("Unable to allocate new unsigned int vector on heap.");for(const n of e)this.i._addUintVectorEntry(s,n);this.i._addUintVectorToInputSidePacket(s,r)}))}addStringVectorToInputSidePacket(e,t){g(this,t,(r=>{const s=this.i._allocateStringVector(e.length);if(!s)throw Error("Unable to allocate new string vector on heap.");for(const n of e)g(this,n,(i=>{this.i._addStringVectorEntry(s,i)}));this.i._addStringVectorToInputSidePacket(s,r)}))}attachBoolListener(e,t){Me(this,e,t),g(this,e,(r=>{this.i._attachBoolListener(r)}))}attachBoolVectorListener(e,t){We(this,e,t),g(this,e,(r=>{this.i._attachBoolVectorListener(r)}))}attachIntListener(e,t){Me(this,e,t),g(this,e,(r=>{this.i._attachIntListener(r)}))}attachIntVectorListener(e,t){We(this,e,t),g(this,e,(r=>{this.i._attachIntVectorListener(r)}))}attachUintListener(e,t){Me(this,e,t),g(this,e,(r=>{this.i._attachUintListener(r)}))}attachUintVectorListener(e,t){We(this,e,t),g(this,e,(r=>{this.i._attachUintVectorListener(r)}))}attachDoubleListener(e,t){Me(this,e,t),g(this,e,(r=>{this.i._attachDoubleListener(r)}))}attachDoubleVectorListener(e,t){We(this,e,t),g(this,e,(r=>{this.i._attachDoubleVectorListener(r)}))}attachFloatListener(e,t){Me(this,e,t),g(this,e,(r=>{this.i._attachFloatListener(r)}))}attachFloatVectorListener(e,t){We(this,e,t),g(this,e,(r=>{this.i._attachFloatVectorListener(r)}))}attachStringListener(e,t){Me(this,e,t),g(this,e,(r=>{this.i._attachStringListener(r)}))}attachStringVectorListener(e,t){We(this,e,t),g(this,e,(r=>{this.i._attachStringVectorListener(r)}))}attachProtoListener(e,t,r){Me(this,e,t),g(this,e,(s=>{this.i._attachProtoListener(s,r||!1)}))}attachProtoVectorListener(e,t,r){We(this,e,t),g(this,e,(s=>{this.i._attachProtoVectorListener(s,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?'),Me(this,e,((s,n)=>{s=new Float32Array(s.buffer,s.byteOffset,s.length/4),t(s,n)})),g(this,e,(s=>{this.i._attachAudioListener(s,r||!1)}))}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends Ga{get ga(){return this.i}pa(e,t,r){g(this,t,(s=>{const[n,i]=Fa(this,e,s);this.ga._addBoundTextureAsImageToStream(s,n,i,r)}))}Z(e,t){Me(this,e,t),g(this,e,(r=>{this.ga._attachImageListener(r)}))}aa(e,t){We(this,e,t),g(this,e,(r=>{this.ga._attachImageVectorListener(r)}))}}));var Ga,we=class extends Nu{};async function A(e,t,r){return(async function(s,n,i,o){return $u(s,n,i,o)})(e,r.canvas??(La()?void 0:document.createElement("canvas")),t,r)}function Ha(e,t,r,s){if(e.U){const i=new Xo;if(r!=null&&r.regionOfInterest){if(!e.oa)throw Error("This task doesn't support region-of-interest.");var n=r.regionOfInterest;if(n.left>=n.right||n.top>=n.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(n.left<0||n.top<0||n.right>1||n.bottom>1)throw Error("Expected RectF values to be in [0,1].");y(i,1,(n.left+n.right)/2),y(i,2,(n.top+n.bottom)/2),y(i,4,n.right-n.left),y(i,3,n.bottom-n.top)}else y(i,1,.5),y(i,2,.5),y(i,4,1),y(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(y(i,5,-Math.PI*r.rotationDegrees/180),(r==null?void 0:r.rotationDegrees)%180!=0){const[o,a]=Ma(t);r=R(i,3)*a/o,n=R(i,4)*o/a,y(i,4,r),y(i,3,n)}}e.g.addProtoToStream(i.g(),"mediapipe.NormalizedRect",e.U,s)}e.g.pa(t,e.X,s??performance.now()),e.finishProcessing()}function Ae(e,t,r){var s;if((s=e.baseOptions)!=null&&s.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");Ha(e,t,r,e.C+1)}function Fe(e,t,r,s){var n;if(!((n=e.baseOptions)!=null&&n.g()))throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");Ha(e,t,r,s)}function Wt(e,t,r,s){var n=t.data;const i=t.width,o=i*(t=t.height);if((n instanceof Uint8Array||n instanceof Float32Array)&&n.length!==o)throw Error("Unsupported channel count: "+n.length/o);return e=new q([n],r,!1,e.g.i.canvas,e.P,i,t),s?e.clone():e}var ce=class extends kn{constructor(e,t,r,s){super(e),this.g=e,this.X=t,this.U=r,this.oa=s,this.P=new Ua}l(e,t=!0){if("runningMode"in e&&S(this.baseOptions,2,or(!!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()}};ce.prototype.close=ce.prototype.close;var he=class extends ce{constructor(e,t){super(new we(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},v(e=this.h=new ts,0,1,t=new $),y(this.h,2,.5),y(this.h,3,.3)}get baseOptions(){return E(this.h,$,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){return"minDetectionConfidence"in e&&y(this.h,2,e.minDetectionConfidence??.5),"minSuppressionThreshold"in e&&y(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}F(e,t){return this.j={detections:[]},Ae(this,e,t),this.j}G(e,t,r){return this.j={detections:[]},Fe(this,e,r,t),this.j}m(){var e=new ae;x(e,"image_in"),x(e,"norm_rect_in"),k(e,"detections");const t=new oe;Le(t,bu,this.h);const r=new Z;ne(r,2,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),P(r,"IMAGE:image_in"),P(r,"NORM_RECT:norm_rect_in"),w(r,"DETECTIONS:detections"),r.o(t),ge(e,r),this.g.attachProtoVectorListener("detections",((s,n)=>{for(const i of s)s=Wo(i),this.j.detections.push(ka(s));f(this,n)})),this.g.attachEmptyPacketListener("detections",(s=>{f(this,s)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};he.prototype.detectForVideo=he.prototype.G,he.prototype.detect=he.prototype.F,he.prototype.setOptions=he.prototype.o,he.createFromModelPath=async function(e,t){return A(he,e,{baseOptions:{modelAssetPath:t}})},he.createFromModelBuffer=function(e,t){return A(he,e,{baseOptions:{modelAssetBuffer:t}})},he.createFromOptions=function(e,t){return A(he,e,t)};var Pn=_e([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]),Mn=_e([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]),Fn=_e([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),za=_e([474,475],[475,476],[476,477],[477,474]),xn=_e([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]),$n=_e([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),Wa=_e([469,470],[470,471],[471,472],[472,469]),On=_e([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]),Ka=[...Pn,...Mn,...Fn,...xn,...$n,...On],qa=_e([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 Xa(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var O=class extends ce{constructor(e,t){super(new we(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,v(e=this.h=new sa,0,1,t=new $),this.A=new ra,v(this.h,0,3,this.A),this.u=new ts,v(this.h,0,2,this.u),Ie(this.u,4,1),y(this.u,2,.5),y(this.A,2,.5),y(this.h,4,.5)}get baseOptions(){return E(this.h,$,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){return"numFaces"in e&&Ie(this.u,4,e.numFaces??1),"minFaceDetectionConfidence"in e&&y(this.u,2,e.minFaceDetectionConfidence??.5),"minTrackingConfidence"in e&&y(this.h,4,e.minTrackingConfidence??.5),"minFacePresenceConfidence"in e&&y(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 Xa(this),Ae(this,e,t),this.j}G(e,t,r){return Xa(this),Fe(this,e,r,t),this.j}m(){var e=new ae;x(e,"image_in"),x(e,"norm_rect"),k(e,"face_landmarks");const t=new oe;Le(t,_u,this.h);const r=new Z;ne(r,2,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),P(r,"IMAGE:image_in"),P(r,"NORM_RECT:norm_rect"),w(r,"NORM_LANDMARKS:face_landmarks"),r.o(t),ge(e,r),this.g.attachProtoVectorListener("face_landmarks",((s,n)=>{for(const i of s)s=pr(i),this.j.faceLandmarks.push(rs(s));f(this,n)})),this.g.attachEmptyPacketListener("face_landmarks",(s=>{f(this,s)})),this.outputFaceBlendshapes&&(k(e,"blendshapes"),w(r,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",((s,n)=>{if(this.outputFaceBlendshapes)for(const i of s)s=Jr(i),this.j.faceBlendshapes.push(An(s.g()??[]));f(this,n)})),this.g.attachEmptyPacketListener("blendshapes",(s=>{f(this,s)}))),this.outputFacialTransformationMatrixes&&(k(e,"face_geometry"),w(r,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",((s,n)=>{if(this.outputFacialTransformationMatrixes)for(const i of s)(s=E(s=vu(i),uu,2))&&this.j.facialTransformationMatrixes.push({rows:pe(s,1)??0??0,columns:pe(s,2)??0??0,data:it(s,3,Ce,nt()).slice()??[]});f(this,n)})),this.g.attachEmptyPacketListener("face_geometry",(s=>{f(this,s)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};O.prototype.detectForVideo=O.prototype.G,O.prototype.detect=O.prototype.F,O.prototype.setOptions=O.prototype.o,O.createFromModelPath=function(e,t){return A(O,e,{baseOptions:{modelAssetPath:t}})},O.createFromModelBuffer=function(e,t){return A(O,e,{baseOptions:{modelAssetBuffer:t}})},O.createFromOptions=function(e,t){return A(O,e,t)},O.FACE_LANDMARKS_LIPS=Pn,O.FACE_LANDMARKS_LEFT_EYE=Mn,O.FACE_LANDMARKS_LEFT_EYEBROW=Fn,O.FACE_LANDMARKS_LEFT_IRIS=za,O.FACE_LANDMARKS_RIGHT_EYE=xn,O.FACE_LANDMARKS_RIGHT_EYEBROW=$n,O.FACE_LANDMARKS_RIGHT_IRIS=Wa,O.FACE_LANDMARKS_FACE_OVAL=On,O.FACE_LANDMARKS_CONTOURS=Ka,O.FACE_LANDMARKS_TESSELATION=qa;var Rn=_e([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 Ya(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function Qa(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 Ja(e,t=!0){const r=[];for(const n of e){var s=Jr(n);e=[];for(const i of s.g())s=t&&pe(i,1)!=null?pe(i,1)??0:-1,e.push({score:R(i,2)??0,index:s,categoryName:Y(L(i,3))??""??"",displayName:Y(L(i,4))??""??""});r.push(e)}return r}var ue=class extends ce{constructor(e,t){super(new we(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],v(e=this.j=new oa,0,1,t=new $),this.u=new pn,v(this.j,0,2,this.u),this.D=new fn,v(this.u,0,3,this.D),this.A=new ia,v(this.u,0,2,this.A),this.h=new wu,v(this.j,0,3,this.h),y(this.A,2,.5),y(this.u,4,.5),y(this.D,2,.5)}get baseOptions(){return E(this.j,$,1)}set baseOptions(e){v(this.j,0,1,e)}o(e){var n,i,o,a;if(Ie(this.A,3,e.numHands??1),"minHandDetectionConfidence"in e&&y(this.A,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&y(this.u,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&y(this.D,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new Gt,r=t,s=wn(e.cannedGesturesClassifierOptions,(n=E(this.h,Gt,3))==null?void 0:n.l());v(r,0,2,s),v(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&((i=E(this.h,Gt,3))==null||i.g());return e.customGesturesClassifierOptions?(v(r=t=new Gt,0,2,s=wn(e.customGesturesClassifierOptions,(o=E(this.h,Gt,4))==null?void 0:o.l())),v(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&((a=E(this.h,Gt,4))==null||a.g()),this.l(e)}Ha(e,t){return Ya(this),Ae(this,e,t),Qa(this)}Ia(e,t,r){return Ya(this),Fe(this,e,r,t),Qa(this)}m(){var e=new ae;x(e,"image_in"),x(e,"norm_rect"),k(e,"hand_gestures"),k(e,"hand_landmarks"),k(e,"world_hand_landmarks"),k(e,"handedness");const t=new oe;Le(t,Au,this.j);const r=new Z;ne(r,2,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),P(r,"IMAGE:image_in"),P(r,"NORM_RECT:norm_rect"),w(r,"HAND_GESTURES:hand_gestures"),w(r,"LANDMARKS:hand_landmarks"),w(r,"WORLD_LANDMARKS:world_hand_landmarks"),w(r,"HANDEDNESS:handedness"),r.o(t),ge(e,r),this.g.attachProtoVectorListener("hand_landmarks",((s,n)=>{for(const i of s){s=pr(i);const o=[];for(const a of Re(s,qo,1))o.push({x:R(a,1)??0,y:R(a,2)??0,z:R(a,3)??0,visibility:R(a,4)??0});this.landmarks.push(o)}f(this,n)})),this.g.attachEmptyPacketListener("hand_landmarks",(s=>{f(this,s)})),this.g.attachProtoVectorListener("world_hand_landmarks",((s,n)=>{for(const i of s){s=Vt(i);const o=[];for(const a of Re(s,Ko,1))o.push({x:R(a,1)??0,y:R(a,2)??0,z:R(a,3)??0,visibility:R(a,4)??0});this.worldLandmarks.push(o)}f(this,n)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(s=>{f(this,s)})),this.g.attachProtoVectorListener("hand_gestures",((s,n)=>{this.gestures.push(...Ja(s,!1)),f(this,n)})),this.g.attachEmptyPacketListener("hand_gestures",(s=>{f(this,s)})),this.g.attachProtoVectorListener("handedness",((s,n)=>{this.handedness.push(...Ja(s)),f(this,n)})),this.g.attachEmptyPacketListener("handedness",(s=>{f(this,s)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function Za(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}ue.prototype.recognizeForVideo=ue.prototype.Ia,ue.prototype.recognize=ue.prototype.Ha,ue.prototype.setOptions=ue.prototype.o,ue.createFromModelPath=function(e,t){return A(ue,e,{baseOptions:{modelAssetPath:t}})},ue.createFromModelBuffer=function(e,t){return A(ue,e,{baseOptions:{modelAssetBuffer:t}})},ue.createFromOptions=function(e,t){return A(ue,e,t)},ue.HAND_CONNECTIONS=Rn;var le=class extends ce{constructor(e,t){super(new we(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],v(e=this.h=new pn,0,1,t=new $),this.u=new fn,v(this.h,0,3,this.u),this.j=new ia,v(this.h,0,2,this.j),Ie(this.j,3,1),y(this.j,2,.5),y(this.u,2,.5),y(this.h,4,.5)}get baseOptions(){return E(this.h,$,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){return"numHands"in e&&Ie(this.j,3,e.numHands??1),"minHandDetectionConfidence"in e&&y(this.j,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&y(this.h,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&y(this.u,2,e.minHandPresenceConfidence??.5),this.l(e)}F(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Ae(this,e,t),Za(this)}G(e,t,r){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Fe(this,e,r,t),Za(this)}m(){var e=new ae;x(e,"image_in"),x(e,"norm_rect"),k(e,"hand_landmarks"),k(e,"world_hand_landmarks"),k(e,"handedness");const t=new oe;Le(t,Eu,this.h);const r=new Z;ne(r,2,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),P(r,"IMAGE:image_in"),P(r,"NORM_RECT:norm_rect"),w(r,"LANDMARKS:hand_landmarks"),w(r,"WORLD_LANDMARKS:world_hand_landmarks"),w(r,"HANDEDNESS:handedness"),r.o(t),ge(e,r),this.g.attachProtoVectorListener("hand_landmarks",((s,n)=>{for(const i of s)s=pr(i),this.landmarks.push(rs(s));f(this,n)})),this.g.attachEmptyPacketListener("hand_landmarks",(s=>{f(this,s)})),this.g.attachProtoVectorListener("world_hand_landmarks",((s,n)=>{for(const i of s)s=Vt(i),this.worldLandmarks.push(mr(s));f(this,n)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(s=>{f(this,s)})),this.g.attachProtoVectorListener("handedness",((s,n)=>{var i=this.handedness,o=i.push;const a=[];for(const c of s){s=Jr(c);const u=[];for(const h of s.g())u.push({score:R(h,2)??0,index:pe(h,1)??0??-1,categoryName:Y(L(h,3))??""??"",displayName:Y(L(h,4))??""??""});a.push(u)}o.call(i,...a),f(this,n)})),this.g.attachEmptyPacketListener("handedness",(s=>{f(this,s)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};le.prototype.detectForVideo=le.prototype.G,le.prototype.detect=le.prototype.F,le.prototype.setOptions=le.prototype.o,le.createFromModelPath=function(e,t){return A(le,e,{baseOptions:{modelAssetPath:t}})},le.createFromModelBuffer=function(e,t){return A(le,e,{baseOptions:{modelAssetBuffer:t}})},le.createFromOptions=function(e,t){return A(le,e,t)},le.HAND_CONNECTIONS=Rn;var ec=_e([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 tc(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function rc(e){try{if(!e.D)return e.h;e.D(e.h)}finally{is(e)}}function as(e,t){e=pr(e),t.push(rs(e))}var M=class extends ce{constructor(e,t){super(new we(e,t),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,v(e=this.j=new da,0,1,t=new $),this.I=new fn,v(this.j,0,2,this.I),this.W=new ku,v(this.j,0,3,this.W),this.u=new ts,v(this.j,0,4,this.u),this.O=new ra,v(this.j,0,5,this.O),this.A=new ua,v(this.j,0,6,this.A),this.M=new la,v(this.j,0,7,this.M),y(this.u,2,.5),y(this.u,3,.3),y(this.O,2,.5),y(this.A,2,.5),y(this.A,3,.3),y(this.M,2,.5),y(this.I,2,.5)}get baseOptions(){return E(this.j,$,1)}set baseOptions(e){v(this.j,0,1,e)}o(e){return"minFaceDetectionConfidence"in e&&y(this.u,2,e.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in e&&y(this.u,3,e.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in e&&y(this.O,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"minPoseDetectionConfidence"in e&&y(this.A,2,e.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in e&&y(this.A,3,e.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in e&&y(this.M,2,e.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in e&&y(this.I,2,e.minHandLandmarksConfidence??.5),this.l(e)}F(e,t,r){const s=typeof t!="function"?t:{};return this.D=typeof t=="function"?t:r,tc(this),Ae(this,e,s),rc(this)}G(e,t,r,s){const n=typeof r!="function"?r:{};return this.D=typeof r=="function"?r:s,tc(this),Fe(this,e,n,t),rc(this)}m(){var e=new ae;x(e,"input_frames_image"),k(e,"pose_landmarks"),k(e,"pose_world_landmarks"),k(e,"face_landmarks"),k(e,"left_hand_landmarks"),k(e,"left_hand_world_landmarks"),k(e,"right_hand_landmarks"),k(e,"right_hand_world_landmarks");const t=new oe,r=new Po;ne(r,1,"type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),(function(n,i){if(i!=null)if(Array.isArray(i))S(n,2,Rr(i,0,hr));else{if(!(typeof i=="string"||i instanceof ke||bs(i)))throw Error("invalid value in Any.value field: "+i+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");je(n,2,As(i,!1),Je())}})(r,this.j.g());const s=new Z;ne(s,2,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),Gs(s,8,Po,r),P(s,"IMAGE:input_frames_image"),w(s,"POSE_LANDMARKS:pose_landmarks"),w(s,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),w(s,"FACE_LANDMARKS:face_landmarks"),w(s,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),w(s,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),w(s,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),w(s,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),s.o(t),ge(e,s),ns(this,e),this.g.attachProtoListener("pose_landmarks",((n,i)=>{as(n,this.h.poseLandmarks),f(this,i)})),this.g.attachEmptyPacketListener("pose_landmarks",(n=>{f(this,n)})),this.g.attachProtoListener("pose_world_landmarks",((n,i)=>{var o=this.h.poseWorldLandmarks;n=Vt(n),o.push(mr(n)),f(this,i)})),this.g.attachEmptyPacketListener("pose_world_landmarks",(n=>{f(this,n)})),this.outputPoseSegmentationMasks&&(w(s,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),Ht(this,"pose_segmentation_mask"),this.g.Z("pose_segmentation_mask",((n,i)=>{this.h.poseSegmentationMasks=[Wt(this,n,!0,!this.D)],f(this,i)})),this.g.attachEmptyPacketListener("pose_segmentation_mask",(n=>{this.h.poseSegmentationMasks=[],f(this,n)}))),this.g.attachProtoListener("face_landmarks",((n,i)=>{as(n,this.h.faceLandmarks),f(this,i)})),this.g.attachEmptyPacketListener("face_landmarks",(n=>{f(this,n)})),this.outputFaceBlendshapes&&(k(e,"extra_blendshapes"),w(s,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",((n,i)=>{var o=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(n=Jr(n),o.push(An(n.g()??[]))),f(this,i)})),this.g.attachEmptyPacketListener("extra_blendshapes",(n=>{f(this,n)}))),this.g.attachProtoListener("left_hand_landmarks",((n,i)=>{as(n,this.h.leftHandLandmarks),f(this,i)})),this.g.attachEmptyPacketListener("left_hand_landmarks",(n=>{f(this,n)})),this.g.attachProtoListener("left_hand_world_landmarks",((n,i)=>{var o=this.h.leftHandWorldLandmarks;n=Vt(n),o.push(mr(n)),f(this,i)})),this.g.attachEmptyPacketListener("left_hand_world_landmarks",(n=>{f(this,n)})),this.g.attachProtoListener("right_hand_landmarks",((n,i)=>{as(n,this.h.rightHandLandmarks),f(this,i)})),this.g.attachEmptyPacketListener("right_hand_landmarks",(n=>{f(this,n)})),this.g.attachProtoListener("right_hand_world_landmarks",((n,i)=>{var o=this.h.rightHandWorldLandmarks;n=Vt(n),o.push(mr(n)),f(this,i)})),this.g.attachEmptyPacketListener("right_hand_world_landmarks",(n=>{f(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};M.prototype.detectForVideo=M.prototype.G,M.prototype.detect=M.prototype.F,M.prototype.setOptions=M.prototype.o,M.createFromModelPath=function(e,t){return A(M,e,{baseOptions:{modelAssetPath:t}})},M.createFromModelBuffer=function(e,t){return A(M,e,{baseOptions:{modelAssetBuffer:t}})},M.createFromOptions=function(e,t){return A(M,e,t)},M.HAND_CONNECTIONS=Rn,M.POSE_CONNECTIONS=ec,M.FACE_LANDMARKS_LIPS=Pn,M.FACE_LANDMARKS_LEFT_EYE=Mn,M.FACE_LANDMARKS_LEFT_EYEBROW=Fn,M.FACE_LANDMARKS_LEFT_IRIS=za,M.FACE_LANDMARKS_RIGHT_EYE=xn,M.FACE_LANDMARKS_RIGHT_EYEBROW=$n,M.FACE_LANDMARKS_RIGHT_IRIS=Wa,M.FACE_LANDMARKS_FACE_OVAL=On,M.FACE_LANDMARKS_CONTOURS=Ka,M.FACE_LANDMARKS_TESSELATION=qa;var ye=class extends ce{constructor(e,t){super(new we(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},v(e=this.h=new fa,0,1,t=new $)}get baseOptions(){return E(this.h,$,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){return v(this.h,0,2,wn(e,E(this.h,un,2))),this.l(e)}sa(e,t){return this.j={classifications:[]},Ae(this,e,t),this.j}ta(e,t,r){return this.j={classifications:[]},Fe(this,e,r,t),this.j}m(){var e=new ae;x(e,"input_image"),x(e,"norm_rect"),k(e,"classifications");const t=new oe;Le(t,Su,this.h);const r=new Z;ne(r,2,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),P(r,"IMAGE:input_image"),P(r,"NORM_RECT:norm_rect"),w(r,"CLASSIFICATIONS:classifications"),r.o(t),ge(e,r),this.g.attachProtoListener("classifications",((s,n)=>{this.j=Fu(fu(s)),f(this,n)})),this.g.attachEmptyPacketListener("classifications",(s=>{f(this,s)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ye.prototype.classifyForVideo=ye.prototype.ta,ye.prototype.classify=ye.prototype.sa,ye.prototype.setOptions=ye.prototype.o,ye.createFromModelPath=function(e,t){return A(ye,e,{baseOptions:{modelAssetPath:t}})},ye.createFromModelBuffer=function(e,t){return A(ye,e,{baseOptions:{modelAssetBuffer:t}})},ye.createFromOptions=function(e,t){return A(ye,e,t)};var de=class extends ce{constructor(e,t){super(new we(e,t),"image_in","norm_rect",!0),this.h=new pa,this.embeddings={embeddings:[]},v(e=this.h,0,1,t=new $)}get baseOptions(){return E(this.h,$,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){var t=this.h,r=E(this.h,Zo,2);return r=r?r.clone():new Zo,e.l2Normalize!==void 0?S(r,1,or(e.l2Normalize)):"l2Normalize"in e&&S(r,1),e.quantize!==void 0?S(r,2,or(e.quantize)):"quantize"in e&&S(r,2),v(t,0,2,r),this.l(e)}za(e,t){return Ae(this,e,t),this.embeddings}Aa(e,t,r){return Fe(this,e,r,t),this.embeddings}m(){var e=new ae;x(e,"image_in"),x(e,"norm_rect"),k(e,"embeddings_out");const t=new oe;Le(t,Cu,this.h);const r=new Z;ne(r,2,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),P(r,"IMAGE:image_in"),P(r,"NORM_RECT:norm_rect"),w(r,"EMBEDDINGS:embeddings_out"),r.o(t),ge(e,r),this.g.attachProtoListener("embeddings_out",((s,n)=>{s=gu(s),this.embeddings=(function(i){return{embeddings:Re(i,mu,1).map((o=>{var u,h;const a={headIndex:pe(o,3)??0??-1,headName:Y(L(o,4))??""??""};var c=o.v;return Wi(c,0|c[p],Yo,Bs(o,1))!==void 0?(o=it(o=E(o,Yo,Bs(o,1),void 0),1,Ce,nt()),a.floatEmbedding=o.slice()):(c=new Uint8Array(0),a.quantizedEmbedding=((h=(u=E(o,pu,Bs(o,2),void 0))==null?void 0:u.na())==null?void 0:h.h())??c),a})),timestampMs:Ea(Xi(i))}})(s),f(this,n)})),this.g.attachEmptyPacketListener("embeddings_out",(s=>{f(this,s)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};de.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=Ca(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=Ca(Sa(e.quantizedEmbedding),Sa(t.quantizedEmbedding))}return e},de.prototype.embedForVideo=de.prototype.Aa,de.prototype.embed=de.prototype.za,de.prototype.setOptions=de.prototype.o,de.createFromModelPath=function(e,t){return A(de,e,{baseOptions:{modelAssetPath:t}})},de.createFromModelBuffer=function(e,t){return A(de,e,{baseOptions:{modelAssetBuffer:t}})},de.createFromOptions=function(e,t){return A(de,e,t)};var In=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 Uu(e){var r,s;const t=(function(n){return Re(n,Z,1)})(e.ca()).filter((n=>(Y(L(n,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&&(((s=(r=E(t[0],oe,7))==null?void 0:r.j())==null?void 0:s.g())??new Map).forEach(((n,i)=>{e.u[Number(i)]=Y(L(n,1))??""}))}function sc(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function nc(e){try{const t=new In(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{is(e)}}In.prototype.close=In.prototype.close;var ee=class extends ce{constructor(e,t){super(new we(e,t),"image_in","norm_rect",!1),this.u=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new bn,this.A=new ma,v(this.h,0,3,this.A),v(e=this.h,0,1,t=new $)}get baseOptions(){return E(this.h,$,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?S(this.h,2,cr(e.displayNamesLocale)):"displayNamesLocale"in e&&S(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}L(){Uu(this)}segment(e,t,r){const s=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:r,sc(this),Ae(this,e,s),nc(this)}La(e,t,r,s){const n=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:s,sc(this),Fe(this,e,n,t),nc(this)}Da(){return this.u}m(){var e=new ae;x(e,"image_in"),x(e,"norm_rect");const t=new oe;Le(t,ba,this.h);const r=new Z;ne(r,2,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),P(r,"IMAGE:image_in"),P(r,"NORM_RECT:norm_rect"),r.o(t),ge(e,r),ns(this,e),this.outputConfidenceMasks&&(k(e,"confidence_masks"),w(r,"CONFIDENCE_MASKS:confidence_masks"),Ht(this,"confidence_masks"),this.g.aa("confidence_masks",((s,n)=>{this.confidenceMasks=s.map((i=>Wt(this,i,!0,!this.j))),f(this,n)})),this.g.attachEmptyPacketListener("confidence_masks",(s=>{this.confidenceMasks=[],f(this,s)}))),this.outputCategoryMask&&(k(e,"category_mask"),w(r,"CATEGORY_MASK:category_mask"),Ht(this,"category_mask"),this.g.Z("category_mask",((s,n)=>{this.categoryMask=Wt(this,s,!1,!this.j),f(this,n)})),this.g.attachEmptyPacketListener("category_mask",(s=>{this.categoryMask=void 0,f(this,s)}))),k(e,"quality_scores"),w(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((s,n)=>{this.qualityScores=s,f(this,n)})),this.g.attachEmptyPacketListener("quality_scores",(s=>{this.categoryMask=void 0,f(this,s)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ee.prototype.getLabels=ee.prototype.Da,ee.prototype.segmentForVideo=ee.prototype.La,ee.prototype.segment=ee.prototype.segment,ee.prototype.setOptions=ee.prototype.o,ee.createFromModelPath=function(e,t){return A(ee,e,{baseOptions:{modelAssetPath:t}})},ee.createFromModelBuffer=function(e,t){return A(ee,e,{baseOptions:{modelAssetBuffer:t}})},ee.createFromOptions=function(e,t){return A(ee,e,t)};var Nn=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()}};Nn.prototype.close=Nn.prototype.close;var xe=class extends ce{constructor(e,t){super(new we(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new bn,this.u=new ma,v(this.h,0,3,this.u),v(e=this.h,0,1,t=new $)}get baseOptions(){return E(this.h,$,1)}set baseOptions(e){v(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,s){const n=typeof r!="function"?r:{};if(this.j=typeof r=="function"?r:s,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,r=this.C+1,s=new _a,t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var i=new vn;je(i,3,or(!0),!1),je(i,1,ir(t.keypoint.x),0),je(i,2,ir(t.keypoint.y),0),ur(s,1,_n,i)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");{const a=new Lu;for(i of t.scribble)je(t=new vn,3,or(!0),!1),je(t,1,ir(i.x),0),je(t,2,ir(i.y),0),Gs(a,1,vn,t);ur(s,2,_n,a)}}this.g.addProtoToStream(s.g(),"mediapipe.tasks.vision.interactive_segmenter.proto.RegionOfInterest","roi_in",r),Ae(this,e,n);e:{try{const a=new Nn(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var o=a;break e}this.j(a)}finally{is(this)}o=void 0}return o}m(){var e=new ae;x(e,"image_in"),x(e,"roi_in"),x(e,"norm_rect_in");const t=new oe;Le(t,ba,this.h);const r=new Z;ne(r,2,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraphV2"),P(r,"IMAGE:image_in"),P(r,"ROI:roi_in"),P(r,"NORM_RECT:norm_rect_in"),r.o(t),ge(e,r),ns(this,e),this.outputConfidenceMasks&&(k(e,"confidence_masks"),w(r,"CONFIDENCE_MASKS:confidence_masks"),Ht(this,"confidence_masks"),this.g.aa("confidence_masks",((s,n)=>{this.confidenceMasks=s.map((i=>Wt(this,i,!0,!this.j))),f(this,n)})),this.g.attachEmptyPacketListener("confidence_masks",(s=>{this.confidenceMasks=[],f(this,s)}))),this.outputCategoryMask&&(k(e,"category_mask"),w(r,"CATEGORY_MASK:category_mask"),Ht(this,"category_mask"),this.g.Z("category_mask",((s,n)=>{this.categoryMask=Wt(this,s,!1,!this.j),f(this,n)})),this.g.attachEmptyPacketListener("category_mask",(s=>{this.categoryMask=void 0,f(this,s)}))),k(e,"quality_scores"),w(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((s,n)=>{this.qualityScores=s,f(this,n)})),this.g.attachEmptyPacketListener("quality_scores",(s=>{this.categoryMask=void 0,f(this,s)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};xe.prototype.segment=xe.prototype.segment,xe.prototype.setOptions=xe.prototype.o,xe.createFromModelPath=function(e,t){return A(xe,e,{baseOptions:{modelAssetPath:t}})},xe.createFromModelBuffer=function(e,t){return A(xe,e,{baseOptions:{modelAssetBuffer:t}})},xe.createFromOptions=function(e,t){return A(xe,e,t)};var be=class extends ce{constructor(e,t){super(new we(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},v(e=this.h=new wa,0,1,t=new $)}get baseOptions(){return E(this.h,$,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?S(this.h,2,cr(e.displayNamesLocale)):"displayNamesLocale"in e&&S(this.h,2),e.maxResults!==void 0?Ie(this.h,3,e.maxResults):"maxResults"in e&&S(this.h,3),e.scoreThreshold!==void 0?y(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&S(this.h,4),e.categoryAllowlist!==void 0?Ir(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&S(this.h,5),e.categoryDenylist!==void 0?Ir(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&S(this.h,6),this.l(e)}F(e,t){return this.j={detections:[]},Ae(this,e,t),this.j}G(e,t,r){return this.j={detections:[]},Fe(this,e,r,t),this.j}m(){var e=new ae;x(e,"input_frame_gpu"),x(e,"norm_rect"),k(e,"detections");const t=new oe;Le(t,Pu,this.h);const r=new Z;ne(r,2,"mediapipe.tasks.vision.ObjectDetectorGraph"),P(r,"IMAGE:input_frame_gpu"),P(r,"NORM_RECT:norm_rect"),w(r,"DETECTIONS:detections"),r.o(t),ge(e,r),this.g.attachProtoVectorListener("detections",((s,n)=>{for(const i of s)s=Wo(i),this.j.detections.push(ka(s));f(this,n)})),this.g.attachEmptyPacketListener("detections",(s=>{f(this,s)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};be.prototype.detectForVideo=be.prototype.G,be.prototype.detect=be.prototype.F,be.prototype.setOptions=be.prototype.o,be.createFromModelPath=async function(e,t){return A(be,e,{baseOptions:{modelAssetPath:t}})},be.createFromModelBuffer=function(e,t){return A(be,e,{baseOptions:{modelAssetBuffer:t}})},be.createFromOptions=function(e,t){return A(be,e,t)};var Un=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 ic(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function oc(e){try{const t=new Un(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.u)return t;e.u(t)}finally{is(e)}}Un.prototype.close=Un.prototype.close;var fe=class extends ce{constructor(e,t){super(new we(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,v(e=this.h=new Aa,0,1,t=new $),this.A=new la,v(this.h,0,3,this.A),this.j=new ua,v(this.h,0,2,this.j),Ie(this.j,4,1),y(this.j,2,.5),y(this.A,2,.5),y(this.h,4,.5)}get baseOptions(){return E(this.h,$,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){return"numPoses"in e&&Ie(this.j,4,e.numPoses??1),"minPoseDetectionConfidence"in e&&y(this.j,2,e.minPoseDetectionConfidence??.5),"minTrackingConfidence"in e&&y(this.h,4,e.minTrackingConfidence??.5),"minPosePresenceConfidence"in e&&y(this.A,2,e.minPosePresenceConfidence??.5),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}F(e,t,r){const s=typeof t!="function"?t:{};return this.u=typeof t=="function"?t:r,ic(this),Ae(this,e,s),oc(this)}G(e,t,r,s){const n=typeof r!="function"?r:{};return this.u=typeof r=="function"?r:s,ic(this),Fe(this,e,n,t),oc(this)}m(){var e=new ae;x(e,"image_in"),x(e,"norm_rect"),k(e,"normalized_landmarks"),k(e,"world_landmarks"),k(e,"segmentation_masks");const t=new oe;Le(t,Mu,this.h);const r=new Z;ne(r,2,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),P(r,"IMAGE:image_in"),P(r,"NORM_RECT:norm_rect"),w(r,"NORM_LANDMARKS:normalized_landmarks"),w(r,"WORLD_LANDMARKS:world_landmarks"),r.o(t),ge(e,r),ns(this,e),this.g.attachProtoVectorListener("normalized_landmarks",((s,n)=>{this.landmarks=[];for(const i of s)s=pr(i),this.landmarks.push(rs(s));f(this,n)})),this.g.attachEmptyPacketListener("normalized_landmarks",(s=>{this.landmarks=[],f(this,s)})),this.g.attachProtoVectorListener("world_landmarks",((s,n)=>{this.worldLandmarks=[];for(const i of s)s=Vt(i),this.worldLandmarks.push(mr(s));f(this,n)})),this.g.attachEmptyPacketListener("world_landmarks",(s=>{this.worldLandmarks=[],f(this,s)})),this.outputSegmentationMasks&&(w(r,"SEGMENTATION_MASK:segmentation_masks"),Ht(this,"segmentation_masks"),this.g.aa("segmentation_masks",((s,n)=>{this.segmentationMasks=s.map((i=>Wt(this,i,!0,!this.u))),f(this,n)})),this.g.attachEmptyPacketListener("segmentation_masks",(s=>{this.segmentationMasks=[],f(this,s)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};fe.prototype.detectForVideo=fe.prototype.G,fe.prototype.detect=fe.prototype.F,fe.prototype.setOptions=fe.prototype.o,fe.createFromModelPath=function(e,t){return A(fe,e,{baseOptions:{modelAssetPath:t}})},fe.createFromModelBuffer=function(e,t){return A(fe,e,{baseOptions:{modelAssetBuffer:t}})},fe.createFromOptions=function(e,t){return A(fe,e,t)},fe.POSE_CONNECTIONS=ec;const Bu=800,Du=1.5,ju=.15,ac=new WeakMap;function Vu(e,t,r){const s=r??document.createElement("canvas");s.width=t.width,s.height=t.height;const n=s.getContext("2d");if(!n)return 0;n.drawImage(e,t.x,t.y,t.width,t.height,0,0,t.width,t.height);const i=n.getImageData(0,0,t.width,t.height),o=r?Hu(r,t.width*t.height):void 0,a=Math.max(Gu(i,o),0);return Math.min(Math.max(a/Bu,0),1)}function Gu(e,t){const{data:r,width:s,height:n}=e,i=s*n,o=t&&t.length>=i?t:new Float32Array(i);for(let l=0;l<i;l++){const d=l*4;o[l]=r[d]*.299+r[d+1]*.587+r[d+2]*.114}const a=(s-2)*(n-2);if(a<=0)return 0;let c=0,u=0;for(let l=1;l<n-1;l++)for(let d=1;d<s-1;d++){const b=l*s+d,C=o[b-s]+o[b-1]+-4*o[b]+o[b+1]+o[b+s];c+=C,u+=C*C}const h=c/a;return Math.max(u/a-h*h,0)}function Hu(e,t){const r=ac.get(e);if(r&&r.length>=t)return r;const s=r?Math.max(t,Math.ceil(r.length*Du)):t,n=new Float32Array(s);return ac.set(e,n),n}const cc=.1,hc=.42,Bn=.24,Dn=.14,jn=.18,uc=.12,lc=.2,zu=.95,Wu=.2,Ku=1,qu=0,Xu=1,Yu=2;function dc(e){var b;const{detections:t,width:r,height:s,sharpnessScore:n,resolveSharpnessScore:i}=e;if(t.length===0)return{hasFace:!1,faceCount:0,confidence:0,captureScore:0,sharpnessScore:0,isCentered:!1,passesQualityChecks:!1,feedback:"no-face",message:"No face detected. Center your face in the oval and look at the camera."};if(t.length>1)return{hasFace:!0,faceCount:t.length,confidence:((b=t[0])==null?void 0:b.confidence)??0,captureScore:0,sharpnessScore:0,isCentered:!1,passesQualityChecks:!1,feedback:"multiple-faces",message:"Multiple faces detected. Make sure only one person is in view."};const o=t[0],a=o.boundingBox;if(!a)return{hasFace:!0,faceCount:1,confidence:o.confidence,captureScore:0,sharpnessScore:0,isCentered:!1,passesQualityChecks:!1,feedback:"face-unclear",message:"Face detected, but the frame is unclear. Hold still and try again."};const c=a.width*a.height/(r*s);if(c<cc)return dt(o.confidence,"too-far","Move closer to the camera.");if(c>hc)return dt(o.confidence,"too-close","Move slightly farther away.");const u=(a.originX+a.width/2)/r,h=(a.originY+a.height/2)/s;if(u<.5-Dn)return dt(o.confidence,"move-left","Move your face a little to the left.");if(u>.5+Dn)return dt(o.confidence,"move-right","Move your face a little to the right.");if(h<.5-jn)return dt(o.confidence,"move-down","Move your face slightly down.");if(h>.5+jn)return dt(o.confidence,"move-up","Move your face slightly up.");const l=Qu(o.keypoints);if(l)return dt(o.confidence,l.feedback,l.message);const d=n??(i==null?void 0:i())??Ku;return d<ju?{hasFace:!0,faceCount:1,confidence:o.confidence,captureScore:fc(o.confidence,u,h,c,d),sharpnessScore:d,isCentered:!0,passesQualityChecks:!1,feedback:"too-blurry",message:"Hold still so the image is not blurry."}:{hasFace:!0,faceCount:1,confidence:o.confidence,captureScore:fc(o.confidence,u,h,c,d),sharpnessScore:d,isCentered:!0,passesQualityChecks:!0,feedback:"good",message:"Hold still. Capturing automatically..."}}function Qu(e){const t=e[qu],r=e[Xu],s=e[Yu];if(!t||!r||!s)return null;const n=Math.abs(r.x-t.x);if(n===0)return null;const i=(t.x+r.x)/2,o=(s.x-i)/n;if(o<=-uc)return{feedback:"turn-left",message:"Turn slightly left so your face points at the camera."};if(o>=uc)return{feedback:"turn-right",message:"Turn slightly right so your face points at the camera."};const a=(t.y-r.y)/n;if(a>=lc)return{feedback:"tilt-left",message:"Straighten your head — it is tilting to the right."};if(a<=-lc)return{feedback:"tilt-right",message:"Straighten your head — it is tilting to the left."};const c=(t.y+r.y)/2,u=(s.y-c)/n;return u>=zu?{feedback:"look-up",message:"Raise your chin slightly so your face points at the camera."}:u<=Wu?{feedback:"look-down",message:"Lower your chin slightly so your face points at the camera."}:null}function dt(e,t,r){return{hasFace:!0,faceCount:1,confidence:e,captureScore:0,sharpnessScore:0,isCentered:!1,passesQualityChecks:!1,feedback:t,message:r}}function Jl(e){return e}function fc(e,t,r,s,n){const i=Math.abs(t-.5)/Dn,o=Math.abs(r-.5)/jn,a=1-Math.min((i+o)/2,1),c=Math.max(Math.abs(Bn-cc),Math.abs(hc-Bn)),u=1-Math.min(Math.abs(s-Bn)/c,1);return Number((e*.4+a*.25+u*.1+n*.25).toFixed(4))}const Ju="https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision/wasm",Zu="https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/1/blaze_face_short_range.tflite",el=.7;let pc=null,mc=null,gc=null;function tl(){return pc??(pc=lt.forVisionTasks(Ju)),pc}function rl(){return mc??(mc=bc("IMAGE")),mc}function yc(){return gc??(gc=bc("VIDEO")),gc}async function bc(e){const t=await tl();return he.createFromOptions(t,{baseOptions:{modelAssetPath:Zu},runningMode:e,minDetectionConfidence:el})}async function Vn(e){const r=(await rl()).detect(e);return dc({detections:wc(r.detections),width:e.naturalWidth,height:e.naturalHeight})}let vc=null;async function _c(e,t){const s=(await yc()).detectForVideo(e,t),n=wc(s.detections);return dc({detections:n,width:e.videoWidth,height:e.videoHeight,resolveSharpnessScore:n.length===1&&n[0].boundingBox?()=>{const i=n[0].boundingBox;return vc??(vc=document.createElement("canvas")),Vu(e,{x:i.originX,y:i.originY,width:i.width,height:i.height},vc)}:void 0})}function wc(e){return e.map(t=>{var r;return{boundingBox:t.boundingBox?{originX:t.boundingBox.originX,originY:t.boundingBox.originY,width:t.boundingBox.width,height:t.boundingBox.height}:void 0,confidence:((r=t.categories[0])==null?void 0:r.score)??0,keypoints:t.keypoints.map(s=>({x:s.x,y:s.y}))}})}const Ac="Capturing Face",Ec="Accept",kc="Take photo",Sc="Retake",Cc="Try again",Gn="Start a capture to see camera guidance here.";function Tc(e,t){return{capturePreference:(e==null?void 0:e.capturePreference)??"auto-preferred",allowMediaPickerFallback:(e==null?void 0:e.allowMediaPickerFallback)??!0,component:t,label:Ac,idleFeedbackLabel:Gn,confirmLabel:Ec,captureLabel:kc,retakeLabel:Sc,retryLabel:Cc}}async function sl(e){var n,i;const t=/WhatsApp/i.test(e.userAgent??navigator.userAgent),r=e.hasMediaDevices??typeof((n=navigator.mediaDevices)==null?void 0:n.getUserMedia)=="function";let s=!1;return!t&&r&&e.capturePreference==="auto-preferred"&&(s=await(((i=e.probeAutoCapture)==null?void 0:i.call(e))??il())),{prefersMediaPicker:t,supportsMediaDevices:r,supportsAutoCapture:s}}function nl(e,t){const r=[];return t.supportsMediaDevices&&(e.capturePreference==="auto-preferred"&&t.supportsAutoCapture&&r.push("auto-camera"),r.push("manual-camera")),e.allowMediaPickerFallback&&(r.length===0||r[r.length-1]!=="media-picker")&&r.push("media-picker"),{steps:r,capabilities:t}}async function il(){if(typeof window.requestAnimationFrame!="function"||typeof window.cancelAnimationFrame!="function"||!document.createElement("canvas").getContext("2d"))return!1;try{return await yc(),!0}catch{return!1}}class Hn extends Error{constructor(t,r){super(t),this.name="CameraAccessError",(r==null?void 0:r.cause)!==void 0&&Object.defineProperty(this,"cause",{configurable:!0,value:r.cause})}}async function ol(){var e;if(!((e=navigator.mediaDevices)!=null&&e.getUserMedia))throw new Hn("In-browser camera capture is not supported in this browser.");try{return await navigator.mediaDevices.getUserMedia({video:{facingMode:{ideal:"user"}},audio:!1})}catch(t){throw new Hn(ll(t),{cause:t})}}async function al(e,t="Failed to start the camera preview."){if(e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA){await e.play();return}await new Promise((r,s)=>{const n=()=>{o(),r()},i=()=>{o(),s(new Error(t))},o=()=>{e.removeEventListener("loadedmetadata",n),e.removeEventListener("error",i)};e.addEventListener("loadedmetadata",n,{once:!0}),e.addEventListener("error",i,{once:!0})}),await e.play()}function cl(e){e.play().catch(()=>{})}function hl(){const e=document.createElement("canvas"),t=document.createElement("canvas");let r=!1;const s=i=>{const o=i.getContext("2d");if(!o)throw new Error("Failed to initialize camera capture.");return o},n=(i,o)=>{if(!i.videoWidth||!i.videoHeight)throw new Error("Camera preview is not ready yet.");(o.width!==i.videoWidth||o.height!==i.videoHeight)&&(o.width=i.videoWidth,o.height=i.videoHeight),s(o).drawImage(i,0,0,o.width,o.height)};return{async captureBlob(i){return n(i,e),Pc(e)},captureWorkingFrame(i){n(i,e)},promoteWorkingToBest(){if(!e.width||!e.height)throw new Error("No working frame to promote.");t.width=e.width,t.height=e.height,s(t).drawImage(e,0,0),r=!0},storeBestFrame(i){n(i,t),r=!0},hasStoredBestFrame(){return r},async storedBestFrameToBlob(){if(!r)throw new Error("No best frame is available.");return Pc(t)},resetStoredBestFrame(){r=!1,t.width=0,t.height=0}}}function Lc(){return new Promise(e=>{const t=document.createElement("input");t.type="file",t.accept="image/*",t.capture="user",t.style.display="none",t.addEventListener("change",()=>{var i;const n=((i=t.files)==null?void 0:i[0])??null;s(),e(n)});const r=()=>{setTimeout(()=>{var n;(n=t.files)!=null&&n.length||(s(),e(null))},500)};window.addEventListener("focus",r,{once:!0});function s(){window.removeEventListener("focus",r),t.remove()}document.body.appendChild(t),t.click()})}function zn(e){return new Promise((t,r)=>{const s=URL.createObjectURL(e),n=new Image;n.onload=()=>{URL.revokeObjectURL(s),t(n)},n.onerror=()=>{URL.revokeObjectURL(s),r(new Error("Failed to load captured image"))},n.src=s})}function ul(e){return new Promise((t,r)=>{const s=new FileReader;s.onload=()=>t(s.result),s.onerror=()=>r(new Error("Failed to read image")),s.readAsDataURL(e)})}function ll(e){if(e instanceof DOMException)switch(e.name){case"NotAllowedError":case"SecurityError":return"Camera access was denied. Allow camera access and try again.";case"NotFoundError":return"No camera was found on this device.";case"NotReadableError":return"The camera is already in use by another application.";default:return e.message||"Failed to access the camera."}return e instanceof Error?e.message:"Failed to access the camera."}function Pc(e){return new Promise((t,r)=>{e.toBlob(s=>{if(!s){r(new Error("Failed to capture an image."));return}t(s)},"image/jpeg",.92)})}const dl="2147483647";async function Mc(e,t){var n;const r=Tc(e,t);if(t)return fl(r);if(!(typeof((n=navigator.mediaDevices)==null?void 0:n.getUserMedia)=="function")){if(r.allowMediaPickerFallback)return Lc();throw new Error("No supported capture strategy is available in this environment.")}return ml(r)}async function fl(e){await Promise.resolve().then(()=>qc);const t=pl(e.component);return t.embedded=!0,t.capturePreference=e.capturePreference,t.allowMediaPickerFallback=e.allowMediaPickerFallback,new Promise((r,s)=>{const n=()=>{t.removeEventListener("simface-captured",i),t.removeEventListener("simface-cancelled",o),t.removeEventListener("simface-error",a),t.active=!1},i=c=>{n(),r(c.detail.imageBlob)},o=()=>{n(),r(null)},a=c=>{n(),s(new Error(c.detail.error))};t.addEventListener("simface-captured",i),t.addEventListener("simface-cancelled",o),t.addEventListener("simface-error",a),t.startCapture().catch(c=>{n(),s(c instanceof Error?c:new Error("Embedded capture failed."))})})}function pl(e){if(!e)throw new Error("Embedded capture requires a simface-capture component.");if(e.tagName.toLowerCase()!=="simface-capture")throw new Error("Embedded capture requires a simface-capture component.");return e}async function ml(e){return await Promise.resolve().then(()=>qc),new Promise((t,r)=>{let s=!1,n=null;const i=document.createElement("div");i.setAttribute("data-simface-camera-overlay","true"),i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true"),gl(i,{position:"fixed",inset:"0",zIndex:dl,display:"flex",alignItems:"center",justifyContent:"center",padding:"24px",background:"rgba(15, 23, 42, 0.82)",colorScheme:"light"});const o=document.createElement("simface-capture");o.label=e.label,o.confirmLabel=e.confirmLabel,o.captureLabel=e.captureLabel,o.retakeLabel=e.retakeLabel,o.retryLabel=e.retryLabel,o.capturePreference=e.capturePreference,o.allowMediaPickerFallback=e.allowMediaPickerFallback,i.appendChild(o),document.body.appendChild(i);const a=()=>{n&&window.removeEventListener("keydown",n),o.removeEventListener("simface-captured",u),o.removeEventListener("simface-cancelled",h),o.removeEventListener("simface-error",l),o.active=!1,i.remove()},c=(d,b)=>{if(!s){if(s=!0,a(),b){r(b);return}t(d)}},u=d=>{c(d.detail.imageBlob)},h=()=>{c(null)},l=d=>{c(null,new Error(d.detail.error))};n=d=>{d.key==="Escape"&&c(null)},o.addEventListener("simface-captured",u),o.addEventListener("simface-cancelled",h),o.addEventListener("simface-error",l),window.addEventListener("keydown",n),o.startCapture().catch(d=>{c(null,d instanceof Error?d:new Error("Popup capture failed."))})})}function gl(e,t){Object.assign(e.style,t)}/**
16
16
  * @license
17
17
  * Copyright 2019 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
19
- */const cs=globalThis,zn=cs.ShadowRoot&&(cs.ShadyCSS===void 0||cs.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Wn=Symbol(),Mc=new WeakMap;let Fc=class{constructor(t,r,s){if(this._$cssResult$=!0,s!==Wn)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=r}get styleSheet(){let t=this.o;const r=this.t;if(zn&&t===void 0){const s=r!==void 0&&r.length===1;s&&(t=Mc.get(r)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&Mc.set(r,t))}return t}toString(){return this.cssText}};const ml=e=>new Fc(typeof e=="string"?e:e+"",void 0,Wn),gl=(e,...t)=>{const r=e.length===1?e[0]:t.reduce((s,n,i)=>s+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[i+1],e[0]);return new Fc(r,e,Wn)},yl=(e,t)=>{if(zn)e.adoptedStyleSheets=t.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet);else for(const r of t){const s=document.createElement("style"),n=cs.litNonce;n!==void 0&&s.setAttribute("nonce",n),s.textContent=r.cssText,e.appendChild(s)}},xc=zn?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let r="";for(const s of t.cssRules)r+=s.cssText;return ml(r)})(e):e;/**
19
+ */const cs=globalThis,Wn=cs.ShadowRoot&&(cs.ShadyCSS===void 0||cs.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Kn=Symbol(),Fc=new WeakMap;let xc=class{constructor(t,r,s){if(this._$cssResult$=!0,s!==Kn)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=r}get styleSheet(){let t=this.o;const r=this.t;if(Wn&&t===void 0){const s=r!==void 0&&r.length===1;s&&(t=Fc.get(r)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&Fc.set(r,t))}return t}toString(){return this.cssText}};const yl=e=>new xc(typeof e=="string"?e:e+"",void 0,Kn),bl=(e,...t)=>{const r=e.length===1?e[0]:t.reduce((s,n,i)=>s+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[i+1],e[0]);return new xc(r,e,Kn)},vl=(e,t)=>{if(Wn)e.adoptedStyleSheets=t.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet);else for(const r of t){const s=document.createElement("style"),n=cs.litNonce;n!==void 0&&s.setAttribute("nonce",n),s.textContent=r.cssText,e.appendChild(s)}},$c=Wn?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let r="";for(const s of t.cssRules)r+=s.cssText;return yl(r)})(e):e;/**
20
20
  * @license
21
21
  * Copyright 2017 Google LLC
22
22
  * SPDX-License-Identifier: BSD-3-Clause
23
- */const{is:bl,defineProperty:vl,getOwnPropertyDescriptor:_l,getOwnPropertyNames:wl,getOwnPropertySymbols:Al,getPrototypeOf:El}=Object,qe=globalThis,$c=qe.trustedTypes,kl=$c?$c.emptyScript:"",Kn=qe.reactiveElementPolyfillSupport,yr=(e,t)=>e,hs={toAttribute(e,t){switch(t){case Boolean:e=e?kl:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=e!==null;break;case Number:r=e===null?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch{r=null}}return r}},qn=(e,t)=>!bl(e,t),Oc={attribute:!0,type:String,converter:hs,reflect:!1,useDefault:!1,hasChanged:qn};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),qe.litPropertyMetadata??(qe.litPropertyMetadata=new WeakMap);let Kt=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,r=Oc){if(r.state&&(r.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((r=Object.create(r)).wrapped=!0),this.elementProperties.set(t,r),!r.noAccessor){const s=Symbol(),n=this.getPropertyDescriptor(t,s,r);n!==void 0&&vl(this.prototype,t,n)}}static getPropertyDescriptor(t,r,s){const{get:n,set:i}=_l(this.prototype,t)??{get(){return this[r]},set(o){this[r]=o}};return{get:n,set(o){const a=n==null?void 0:n.call(this);i==null||i.call(this,o),this.requestUpdate(t,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Oc}static _$Ei(){if(this.hasOwnProperty(yr("elementProperties")))return;const t=El(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(yr("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(yr("properties"))){const r=this.properties,s=[...wl(r),...Al(r)];for(const n of s)this.createProperty(n,r[n])}const t=this[Symbol.metadata];if(t!==null){const r=litPropertyMetadata.get(t);if(r!==void 0)for(const[s,n]of r)this.elementProperties.set(s,n)}this._$Eh=new Map;for(const[r,s]of this.elementProperties){const n=this._$Eu(r,s);n!==void 0&&this._$Eh.set(n,r)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const r=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const n of s)r.unshift(xc(n))}else t!==void 0&&r.push(xc(t));return r}static _$Eu(t,r){const s=r.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise(r=>this.enableUpdating=r),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(r=>r(this))}addController(t){var r;(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((r=t.hostConnected)==null||r.call(t))}removeController(t){var r;(r=this._$EO)==null||r.delete(t)}_$E_(){const t=new Map,r=this.constructor.elementProperties;for(const s of r.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return yl(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(r=>{var s;return(s=r.hostConnected)==null?void 0:s.call(r)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(r=>{var s;return(s=r.hostDisconnected)==null?void 0:s.call(r)})}attributeChangedCallback(t,r,s){this._$AK(t,s)}_$ET(t,r){var i;const s=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,s);if(n!==void 0&&s.reflect===!0){const o=(((i=s.converter)==null?void 0:i.toAttribute)!==void 0?s.converter:hs).toAttribute(r,s.type);this._$Em=t,o==null?this.removeAttribute(n):this.setAttribute(n,o),this._$Em=null}}_$AK(t,r){var i,o;const s=this.constructor,n=s._$Eh.get(t);if(n!==void 0&&this._$Em!==n){const a=s.getPropertyOptions(n),c=typeof a.converter=="function"?{fromAttribute:a.converter}:((i=a.converter)==null?void 0:i.fromAttribute)!==void 0?a.converter:hs;this._$Em=n;const u=c.fromAttribute(r,a.type);this[n]=u??((o=this._$Ej)==null?void 0:o.get(n))??u,this._$Em=null}}requestUpdate(t,r,s,n=!1,i){var o;if(t!==void 0){const a=this.constructor;if(n===!1&&(i=this[t]),s??(s=a.getPropertyOptions(t)),!((s.hasChanged??qn)(i,r)||s.useDefault&&s.reflect&&i===((o=this._$Ej)==null?void 0:o.get(t))&&!this.hasAttribute(a._$Eu(t,s))))return;this.C(t,r,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,r,{useDefault:s,reflect:n,wrapped:i},o){s&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,o??r??this[t]),i!==!0||o!==void 0)||(this._$AL.has(t)||(this.hasUpdated||s||(r=void 0),this._$AL.set(t,r)),n===!0&&this._$Em!==t&&(this._$Eq??(this._$Eq=new Set)).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(r){Promise.reject(r)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var s;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}const n=this.constructor.elementProperties;if(n.size>0)for(const[i,o]of n){const{wrapped:a}=o,c=this[i];a!==!0||this._$AL.has(i)||c===void 0||this.C(i,void 0,o,c)}}let t=!1;const r=this._$AL;try{t=this.shouldUpdate(r),t?(this.willUpdate(r),(s=this._$EO)==null||s.forEach(n=>{var i;return(i=n.hostUpdate)==null?void 0:i.call(n)}),this.update(r)):this._$EM()}catch(n){throw t=!1,this._$EM(),n}t&&this._$AE(r)}willUpdate(t){}_$AE(t){var r;(r=this._$EO)==null||r.forEach(s=>{var n;return(n=s.hostUpdated)==null?void 0:n.call(s)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&(this._$Eq=this._$Eq.forEach(r=>this._$ET(r,this[r]))),this._$EM()}updated(t){}firstUpdated(t){}};Kt.elementStyles=[],Kt.shadowRootOptions={mode:"open"},Kt[yr("elementProperties")]=new Map,Kt[yr("finalized")]=new Map,Kn==null||Kn({ReactiveElement:Kt}),(qe.reactiveElementVersions??(qe.reactiveElementVersions=[])).push("2.1.2");/**
23
+ */const{is:_l,defineProperty:wl,getOwnPropertyDescriptor:Al,getOwnPropertyNames:El,getOwnPropertySymbols:kl,getPrototypeOf:Sl}=Object,qe=globalThis,Oc=qe.trustedTypes,Cl=Oc?Oc.emptyScript:"",qn=qe.reactiveElementPolyfillSupport,yr=(e,t)=>e,hs={toAttribute(e,t){switch(t){case Boolean:e=e?Cl:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=e!==null;break;case Number:r=e===null?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch{r=null}}return r}},Xn=(e,t)=>!_l(e,t),Rc={attribute:!0,type:String,converter:hs,reflect:!1,useDefault:!1,hasChanged:Xn};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),qe.litPropertyMetadata??(qe.litPropertyMetadata=new WeakMap);let Kt=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,r=Rc){if(r.state&&(r.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((r=Object.create(r)).wrapped=!0),this.elementProperties.set(t,r),!r.noAccessor){const s=Symbol(),n=this.getPropertyDescriptor(t,s,r);n!==void 0&&wl(this.prototype,t,n)}}static getPropertyDescriptor(t,r,s){const{get:n,set:i}=Al(this.prototype,t)??{get(){return this[r]},set(o){this[r]=o}};return{get:n,set(o){const a=n==null?void 0:n.call(this);i==null||i.call(this,o),this.requestUpdate(t,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Rc}static _$Ei(){if(this.hasOwnProperty(yr("elementProperties")))return;const t=Sl(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(yr("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(yr("properties"))){const r=this.properties,s=[...El(r),...kl(r)];for(const n of s)this.createProperty(n,r[n])}const t=this[Symbol.metadata];if(t!==null){const r=litPropertyMetadata.get(t);if(r!==void 0)for(const[s,n]of r)this.elementProperties.set(s,n)}this._$Eh=new Map;for(const[r,s]of this.elementProperties){const n=this._$Eu(r,s);n!==void 0&&this._$Eh.set(n,r)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const r=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const n of s)r.unshift($c(n))}else t!==void 0&&r.push($c(t));return r}static _$Eu(t,r){const s=r.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise(r=>this.enableUpdating=r),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(r=>r(this))}addController(t){var r;(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((r=t.hostConnected)==null||r.call(t))}removeController(t){var r;(r=this._$EO)==null||r.delete(t)}_$E_(){const t=new Map,r=this.constructor.elementProperties;for(const s of r.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return vl(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(r=>{var s;return(s=r.hostConnected)==null?void 0:s.call(r)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(r=>{var s;return(s=r.hostDisconnected)==null?void 0:s.call(r)})}attributeChangedCallback(t,r,s){this._$AK(t,s)}_$ET(t,r){var i;const s=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,s);if(n!==void 0&&s.reflect===!0){const o=(((i=s.converter)==null?void 0:i.toAttribute)!==void 0?s.converter:hs).toAttribute(r,s.type);this._$Em=t,o==null?this.removeAttribute(n):this.setAttribute(n,o),this._$Em=null}}_$AK(t,r){var i,o;const s=this.constructor,n=s._$Eh.get(t);if(n!==void 0&&this._$Em!==n){const a=s.getPropertyOptions(n),c=typeof a.converter=="function"?{fromAttribute:a.converter}:((i=a.converter)==null?void 0:i.fromAttribute)!==void 0?a.converter:hs;this._$Em=n;const u=c.fromAttribute(r,a.type);this[n]=u??((o=this._$Ej)==null?void 0:o.get(n))??u,this._$Em=null}}requestUpdate(t,r,s,n=!1,i){var o;if(t!==void 0){const a=this.constructor;if(n===!1&&(i=this[t]),s??(s=a.getPropertyOptions(t)),!((s.hasChanged??Xn)(i,r)||s.useDefault&&s.reflect&&i===((o=this._$Ej)==null?void 0:o.get(t))&&!this.hasAttribute(a._$Eu(t,s))))return;this.C(t,r,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,r,{useDefault:s,reflect:n,wrapped:i},o){s&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,o??r??this[t]),i!==!0||o!==void 0)||(this._$AL.has(t)||(this.hasUpdated||s||(r=void 0),this._$AL.set(t,r)),n===!0&&this._$Em!==t&&(this._$Eq??(this._$Eq=new Set)).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(r){Promise.reject(r)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var s;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}const n=this.constructor.elementProperties;if(n.size>0)for(const[i,o]of n){const{wrapped:a}=o,c=this[i];a!==!0||this._$AL.has(i)||c===void 0||this.C(i,void 0,o,c)}}let t=!1;const r=this._$AL;try{t=this.shouldUpdate(r),t?(this.willUpdate(r),(s=this._$EO)==null||s.forEach(n=>{var i;return(i=n.hostUpdate)==null?void 0:i.call(n)}),this.update(r)):this._$EM()}catch(n){throw t=!1,this._$EM(),n}t&&this._$AE(r)}willUpdate(t){}_$AE(t){var r;(r=this._$EO)==null||r.forEach(s=>{var n;return(n=s.hostUpdated)==null?void 0:n.call(s)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&(this._$Eq=this._$Eq.forEach(r=>this._$ET(r,this[r]))),this._$EM()}updated(t){}firstUpdated(t){}};Kt.elementStyles=[],Kt.shadowRootOptions={mode:"open"},Kt[yr("elementProperties")]=new Map,Kt[yr("finalized")]=new Map,qn==null||qn({ReactiveElement:Kt}),(qe.reactiveElementVersions??(qe.reactiveElementVersions=[])).push("2.1.2");/**
24
24
  * @license
25
25
  * Copyright 2017 Google LLC
26
26
  * SPDX-License-Identifier: BSD-3-Clause
27
- */const br=globalThis,Rc=e=>e,us=br.trustedTypes,Ic=us?us.createPolicy("lit-html",{createHTML:e=>e}):void 0,Nc="$lit$",Xe=`lit$${Math.random().toFixed(9).slice(2)}$`,Bc="?"+Xe,Sl=`<${Bc}>`,pt=document,vr=()=>pt.createComment(""),_r=e=>e===null||typeof e!="object"&&typeof e!="function",Xn=Array.isArray,Cl=e=>Xn(e)||typeof(e==null?void 0:e[Symbol.iterator])=="function",Yn=`[
28
- \f\r]`,wr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Uc=/-->/g,Dc=/>/g,mt=RegExp(`>|${Yn}(?:([^\\s"'>=/]+)(${Yn}*=${Yn}*(?:[^
29
- \f\r"'\`<>=]|("|')|))|$)`,"g"),jc=/'/g,Vc=/"/g,Gc=/^(?:script|style|textarea|title)$/i,Tl=e=>(t,...r)=>({_$litType$:e,strings:t,values:r}),Ue=Tl(1),qt=Symbol.for("lit-noChange"),X=Symbol.for("lit-nothing"),Hc=new WeakMap,gt=pt.createTreeWalker(pt,129);function zc(e,t){if(!Xn(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ic!==void 0?Ic.createHTML(t):t}const Ll=(e,t)=>{const r=e.length-1,s=[];let n,i=t===2?"<svg>":t===3?"<math>":"",o=wr;for(let a=0;a<r;a++){const c=e[a];let u,h,l=-1,d=0;for(;d<c.length&&(o.lastIndex=d,h=o.exec(c),h!==null);)d=o.lastIndex,o===wr?h[1]==="!--"?o=Uc:h[1]!==void 0?o=Dc:h[2]!==void 0?(Gc.test(h[2])&&(n=RegExp("</"+h[2],"g")),o=mt):h[3]!==void 0&&(o=mt):o===mt?h[0]===">"?(o=n??wr,l=-1):h[1]===void 0?l=-2:(l=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?mt:h[3]==='"'?Vc:jc):o===Vc||o===jc?o=mt:o===Uc||o===Dc?o=wr:(o=mt,n=void 0);const b=o===mt&&e[a+1].startsWith("/>")?" ":"";i+=o===wr?c+Sl:l>=0?(s.push(u),c.slice(0,l)+Nc+c.slice(l)+Xe+b):c+Xe+(l===-2?a:b)}return[zc(e,i+(e[r]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};class Ar{constructor({strings:t,_$litType$:r},s){let n;this.parts=[];let i=0,o=0;const a=t.length-1,c=this.parts,[u,h]=Ll(t,r);if(this.el=Ar.createElement(u,s),gt.currentNode=this.el.content,r===2||r===3){const l=this.el.content.firstChild;l.replaceWith(...l.childNodes)}for(;(n=gt.nextNode())!==null&&c.length<a;){if(n.nodeType===1){if(n.hasAttributes())for(const l of n.getAttributeNames())if(l.endsWith(Nc)){const d=h[o++],b=n.getAttribute(l).split(Xe),C=/([.?@])?(.*)/.exec(d);c.push({type:1,index:i,name:C[2],strings:b,ctor:C[1]==="."?Ml:C[1]==="?"?Fl:C[1]==="@"?xl:ls}),n.removeAttribute(l)}else l.startsWith(Xe)&&(c.push({type:6,index:i}),n.removeAttribute(l));if(Gc.test(n.tagName)){const l=n.textContent.split(Xe),d=l.length-1;if(d>0){n.textContent=us?us.emptyScript:"";for(let b=0;b<d;b++)n.append(l[b],vr()),gt.nextNode(),c.push({type:2,index:++i});n.append(l[d],vr())}}}else if(n.nodeType===8)if(n.data===Bc)c.push({type:2,index:i});else{let l=-1;for(;(l=n.data.indexOf(Xe,l+1))!==-1;)c.push({type:7,index:i}),l+=Xe.length-1}i++}}static createElement(t,r){const s=pt.createElement("template");return s.innerHTML=t,s}}function Xt(e,t,r=e,s){var o,a;if(t===qt)return t;let n=s!==void 0?(o=r._$Co)==null?void 0:o[s]:r._$Cl;const i=_r(t)?void 0:t._$litDirective$;return(n==null?void 0:n.constructor)!==i&&((a=n==null?void 0:n._$AO)==null||a.call(n,!1),i===void 0?n=void 0:(n=new i(e),n._$AT(e,r,s)),s!==void 0?(r._$Co??(r._$Co=[]))[s]=n:r._$Cl=n),n!==void 0&&(t=Xt(e,n._$AS(e,t.values),n,s)),t}class Pl{constructor(t,r){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=r}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:r},parts:s}=this._$AD,n=((t==null?void 0:t.creationScope)??pt).importNode(r,!0);gt.currentNode=n;let i=gt.nextNode(),o=0,a=0,c=s[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new Er(i,i.nextSibling,this,t):c.type===1?u=new c.ctor(i,c.name,c.strings,this,t):c.type===6&&(u=new $l(i,this,t)),this._$AV.push(u),c=s[++a]}o!==(c==null?void 0:c.index)&&(i=gt.nextNode(),o++)}return gt.currentNode=pt,n}p(t){let r=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,r),r+=s.strings.length-2):s._$AI(t[r])),r++}}class Er{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,r,s,n){this.type=2,this._$AH=X,this._$AN=void 0,this._$AA=t,this._$AB=r,this._$AM=s,this.options=n,this._$Cv=(n==null?void 0:n.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const r=this._$AM;return r!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=r.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,r=this){t=Xt(this,t,r),_r(t)?t===X||t==null||t===""?(this._$AH!==X&&this._$AR(),this._$AH=X):t!==this._$AH&&t!==qt&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Cl(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==X&&_r(this._$AH)?this._$AA.nextSibling.data=t:this.T(pt.createTextNode(t)),this._$AH=t}$(t){var i;const{values:r,_$litType$:s}=t,n=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=Ar.createElement(zc(s.h,s.h[0]),this.options)),s);if(((i=this._$AH)==null?void 0:i._$AD)===n)this._$AH.p(r);else{const o=new Pl(n,this),a=o.u(this.options);o.p(r),this.T(a),this._$AH=o}}_$AC(t){let r=Hc.get(t.strings);return r===void 0&&Hc.set(t.strings,r=new Ar(t)),r}k(t){Xn(this._$AH)||(this._$AH=[],this._$AR());const r=this._$AH;let s,n=0;for(const i of t)n===r.length?r.push(s=new Er(this.O(vr()),this.O(vr()),this,this.options)):s=r[n],s._$AI(i),n++;n<r.length&&(this._$AR(s&&s._$AB.nextSibling,n),r.length=n)}_$AR(t=this._$AA.nextSibling,r){var s;for((s=this._$AP)==null?void 0:s.call(this,!1,!0,r);t!==this._$AB;){const n=Rc(t).nextSibling;Rc(t).remove(),t=n}}setConnected(t){var r;this._$AM===void 0&&(this._$Cv=t,(r=this._$AP)==null||r.call(this,t))}}class ls{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,r,s,n,i){this.type=1,this._$AH=X,this._$AN=void 0,this.element=t,this.name=r,this._$AM=n,this.options=i,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=X}_$AI(t,r=this,s,n){const i=this.strings;let o=!1;if(i===void 0)t=Xt(this,t,r,0),o=!_r(t)||t!==this._$AH&&t!==qt,o&&(this._$AH=t);else{const a=t;let c,u;for(t=i[0],c=0;c<i.length-1;c++)u=Xt(this,a[s+c],r,c),u===qt&&(u=this._$AH[c]),o||(o=!_r(u)||u!==this._$AH[c]),u===X?t=X:t!==X&&(t+=(u??"")+i[c+1]),this._$AH[c]=u}o&&!n&&this.j(t)}j(t){t===X?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Ml extends ls{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===X?void 0:t}}class Fl extends ls{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==X)}}class xl extends ls{constructor(t,r,s,n,i){super(t,r,s,n,i),this.type=5}_$AI(t,r=this){if((t=Xt(this,t,r,0)??X)===qt)return;const s=this._$AH,n=t===X&&s!==X||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,i=t!==X&&(s===X||n);n&&this.element.removeEventListener(this.name,this,s),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var r;typeof this._$AH=="function"?this._$AH.call(((r=this.options)==null?void 0:r.host)??this.element,t):this._$AH.handleEvent(t)}}class $l{constructor(t,r,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=r,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){Xt(this,t)}}const Qn=br.litHtmlPolyfillSupport;Qn==null||Qn(Ar,Er),(br.litHtmlVersions??(br.litHtmlVersions=[])).push("3.3.2");const Ol=(e,t,r)=>{const s=(r==null?void 0:r.renderBefore)??t;let n=s._$litPart$;if(n===void 0){const i=(r==null?void 0:r.renderBefore)??null;s._$litPart$=n=new Er(t.insertBefore(vr(),i),i,void 0,r??{})}return n._$AI(e),n};/**
27
+ */const br=globalThis,Ic=e=>e,us=br.trustedTypes,Nc=us?us.createPolicy("lit-html",{createHTML:e=>e}):void 0,Uc="$lit$",Xe=`lit$${Math.random().toFixed(9).slice(2)}$`,Bc="?"+Xe,Tl=`<${Bc}>`,ft=document,vr=()=>ft.createComment(""),_r=e=>e===null||typeof e!="object"&&typeof e!="function",Yn=Array.isArray,Ll=e=>Yn(e)||typeof(e==null?void 0:e[Symbol.iterator])=="function",Qn=`[
28
+ \f\r]`,wr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Dc=/-->/g,jc=/>/g,pt=RegExp(`>|${Qn}(?:([^\\s"'>=/]+)(${Qn}*=${Qn}*(?:[^
29
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Vc=/'/g,Gc=/"/g,Hc=/^(?:script|style|textarea|title)$/i,Pl=e=>(t,...r)=>({_$litType$:e,strings:t,values:r}),Be=Pl(1),qt=Symbol.for("lit-noChange"),X=Symbol.for("lit-nothing"),zc=new WeakMap,mt=ft.createTreeWalker(ft,129);function Wc(e,t){if(!Yn(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Nc!==void 0?Nc.createHTML(t):t}const Ml=(e,t)=>{const r=e.length-1,s=[];let n,i=t===2?"<svg>":t===3?"<math>":"",o=wr;for(let a=0;a<r;a++){const c=e[a];let u,h,l=-1,d=0;for(;d<c.length&&(o.lastIndex=d,h=o.exec(c),h!==null);)d=o.lastIndex,o===wr?h[1]==="!--"?o=Dc:h[1]!==void 0?o=jc:h[2]!==void 0?(Hc.test(h[2])&&(n=RegExp("</"+h[2],"g")),o=pt):h[3]!==void 0&&(o=pt):o===pt?h[0]===">"?(o=n??wr,l=-1):h[1]===void 0?l=-2:(l=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?pt:h[3]==='"'?Gc:Vc):o===Gc||o===Vc?o=pt:o===Dc||o===jc?o=wr:(o=pt,n=void 0);const b=o===pt&&e[a+1].startsWith("/>")?" ":"";i+=o===wr?c+Tl:l>=0?(s.push(u),c.slice(0,l)+Uc+c.slice(l)+Xe+b):c+Xe+(l===-2?a:b)}return[Wc(e,i+(e[r]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};class Ar{constructor({strings:t,_$litType$:r},s){let n;this.parts=[];let i=0,o=0;const a=t.length-1,c=this.parts,[u,h]=Ml(t,r);if(this.el=Ar.createElement(u,s),mt.currentNode=this.el.content,r===2||r===3){const l=this.el.content.firstChild;l.replaceWith(...l.childNodes)}for(;(n=mt.nextNode())!==null&&c.length<a;){if(n.nodeType===1){if(n.hasAttributes())for(const l of n.getAttributeNames())if(l.endsWith(Uc)){const d=h[o++],b=n.getAttribute(l).split(Xe),C=/([.?@])?(.*)/.exec(d);c.push({type:1,index:i,name:C[2],strings:b,ctor:C[1]==="."?xl:C[1]==="?"?$l:C[1]==="@"?Ol:ls}),n.removeAttribute(l)}else l.startsWith(Xe)&&(c.push({type:6,index:i}),n.removeAttribute(l));if(Hc.test(n.tagName)){const l=n.textContent.split(Xe),d=l.length-1;if(d>0){n.textContent=us?us.emptyScript:"";for(let b=0;b<d;b++)n.append(l[b],vr()),mt.nextNode(),c.push({type:2,index:++i});n.append(l[d],vr())}}}else if(n.nodeType===8)if(n.data===Bc)c.push({type:2,index:i});else{let l=-1;for(;(l=n.data.indexOf(Xe,l+1))!==-1;)c.push({type:7,index:i}),l+=Xe.length-1}i++}}static createElement(t,r){const s=ft.createElement("template");return s.innerHTML=t,s}}function Xt(e,t,r=e,s){var o,a;if(t===qt)return t;let n=s!==void 0?(o=r._$Co)==null?void 0:o[s]:r._$Cl;const i=_r(t)?void 0:t._$litDirective$;return(n==null?void 0:n.constructor)!==i&&((a=n==null?void 0:n._$AO)==null||a.call(n,!1),i===void 0?n=void 0:(n=new i(e),n._$AT(e,r,s)),s!==void 0?(r._$Co??(r._$Co=[]))[s]=n:r._$Cl=n),n!==void 0&&(t=Xt(e,n._$AS(e,t.values),n,s)),t}class Fl{constructor(t,r){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=r}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:r},parts:s}=this._$AD,n=((t==null?void 0:t.creationScope)??ft).importNode(r,!0);mt.currentNode=n;let i=mt.nextNode(),o=0,a=0,c=s[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new Er(i,i.nextSibling,this,t):c.type===1?u=new c.ctor(i,c.name,c.strings,this,t):c.type===6&&(u=new Rl(i,this,t)),this._$AV.push(u),c=s[++a]}o!==(c==null?void 0:c.index)&&(i=mt.nextNode(),o++)}return mt.currentNode=ft,n}p(t){let r=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,r),r+=s.strings.length-2):s._$AI(t[r])),r++}}class Er{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,r,s,n){this.type=2,this._$AH=X,this._$AN=void 0,this._$AA=t,this._$AB=r,this._$AM=s,this.options=n,this._$Cv=(n==null?void 0:n.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const r=this._$AM;return r!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=r.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,r=this){t=Xt(this,t,r),_r(t)?t===X||t==null||t===""?(this._$AH!==X&&this._$AR(),this._$AH=X):t!==this._$AH&&t!==qt&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Ll(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==X&&_r(this._$AH)?this._$AA.nextSibling.data=t:this.T(ft.createTextNode(t)),this._$AH=t}$(t){var i;const{values:r,_$litType$:s}=t,n=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=Ar.createElement(Wc(s.h,s.h[0]),this.options)),s);if(((i=this._$AH)==null?void 0:i._$AD)===n)this._$AH.p(r);else{const o=new Fl(n,this),a=o.u(this.options);o.p(r),this.T(a),this._$AH=o}}_$AC(t){let r=zc.get(t.strings);return r===void 0&&zc.set(t.strings,r=new Ar(t)),r}k(t){Yn(this._$AH)||(this._$AH=[],this._$AR());const r=this._$AH;let s,n=0;for(const i of t)n===r.length?r.push(s=new Er(this.O(vr()),this.O(vr()),this,this.options)):s=r[n],s._$AI(i),n++;n<r.length&&(this._$AR(s&&s._$AB.nextSibling,n),r.length=n)}_$AR(t=this._$AA.nextSibling,r){var s;for((s=this._$AP)==null?void 0:s.call(this,!1,!0,r);t!==this._$AB;){const n=Ic(t).nextSibling;Ic(t).remove(),t=n}}setConnected(t){var r;this._$AM===void 0&&(this._$Cv=t,(r=this._$AP)==null||r.call(this,t))}}class ls{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,r,s,n,i){this.type=1,this._$AH=X,this._$AN=void 0,this.element=t,this.name=r,this._$AM=n,this.options=i,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=X}_$AI(t,r=this,s,n){const i=this.strings;let o=!1;if(i===void 0)t=Xt(this,t,r,0),o=!_r(t)||t!==this._$AH&&t!==qt,o&&(this._$AH=t);else{const a=t;let c,u;for(t=i[0],c=0;c<i.length-1;c++)u=Xt(this,a[s+c],r,c),u===qt&&(u=this._$AH[c]),o||(o=!_r(u)||u!==this._$AH[c]),u===X?t=X:t!==X&&(t+=(u??"")+i[c+1]),this._$AH[c]=u}o&&!n&&this.j(t)}j(t){t===X?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class xl extends ls{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===X?void 0:t}}class $l extends ls{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==X)}}class Ol extends ls{constructor(t,r,s,n,i){super(t,r,s,n,i),this.type=5}_$AI(t,r=this){if((t=Xt(this,t,r,0)??X)===qt)return;const s=this._$AH,n=t===X&&s!==X||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,i=t!==X&&(s===X||n);n&&this.element.removeEventListener(this.name,this,s),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var r;typeof this._$AH=="function"?this._$AH.call(((r=this.options)==null?void 0:r.host)??this.element,t):this._$AH.handleEvent(t)}}class Rl{constructor(t,r,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=r,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){Xt(this,t)}}const Jn=br.litHtmlPolyfillSupport;Jn==null||Jn(Ar,Er),(br.litHtmlVersions??(br.litHtmlVersions=[])).push("3.3.2");const Il=(e,t,r)=>{const s=(r==null?void 0:r.renderBefore)??t;let n=s._$litPart$;if(n===void 0){const i=(r==null?void 0:r.renderBefore)??null;s._$litPart$=n=new Er(t.insertBefore(vr(),i),i,void 0,r??{})}return n._$AI(e),n};/**
30
30
  * @license
31
31
  * Copyright 2017 Google LLC
32
32
  * SPDX-License-Identifier: BSD-3-Clause
33
- */const yt=globalThis;class kr extends Kt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var r;const t=super.createRenderRoot();return(r=this.renderOptions).renderBefore??(r.renderBefore=t.firstChild),t}update(t){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Ol(r,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return qt}}kr._$litElement$=!0,kr.finalized=!0,(Xc=yt.litElementHydrateSupport)==null||Xc.call(yt,{LitElement:kr});const Jn=yt.litElementPolyfillSupport;Jn==null||Jn({LitElement:kr}),(yt.litElementVersions??(yt.litElementVersions=[])).push("4.2.2");/**
33
+ */const gt=globalThis;class kr extends Kt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var r;const t=super.createRenderRoot();return(r=this.renderOptions).renderBefore??(r.renderBefore=t.firstChild),t}update(t){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Il(r,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return qt}}kr._$litElement$=!0,kr.finalized=!0,(Yc=gt.litElementHydrateSupport)==null||Yc.call(gt,{LitElement:kr});const Zn=gt.litElementPolyfillSupport;Zn==null||Zn({LitElement:kr}),(gt.litElementVersions??(gt.litElementVersions=[])).push("4.2.2");/**
34
34
  * @license
35
35
  * Copyright 2017 Google LLC
36
36
  * SPDX-License-Identifier: BSD-3-Clause
37
- */const Rl=e=>(t,r)=>{r!==void 0?r.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};/**
37
+ */const Nl=e=>(t,r)=>{r!==void 0?r.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};/**
38
38
  * @license
39
39
  * Copyright 2017 Google LLC
40
40
  * SPDX-License-Identifier: BSD-3-Clause
41
- */const Il={attribute:!0,type:String,converter:hs,reflect:!1,hasChanged:qn},Nl=(e=Il,t,r)=>{const{kind:s,metadata:n}=r;let i=globalThis.litPropertyMetadata.get(n);if(i===void 0&&globalThis.litPropertyMetadata.set(n,i=new Map),s==="setter"&&((e=Object.create(e)).wrapped=!0),i.set(r.name,e),s==="accessor"){const{name:o}=r;return{set(a){const c=t.get.call(this);t.set.call(this,a),this.requestUpdate(o,c,e,!0,a)},init(a){return a!==void 0&&this.C(o,void 0,e,a),a}}}if(s==="setter"){const{name:o}=r;return function(a){const c=this[o];t.call(this,a),this.requestUpdate(o,c,e,!0,a)}}throw Error("Unsupported decorator location: "+s)};function Ee(e){return(t,r)=>typeof r=="object"?Nl(e,t,r):((s,n,i)=>{const o=n.hasOwnProperty(i);return n.constructor.createProperty(i,s),o?Object.getOwnPropertyDescriptor(n,i):void 0})(e,t,r)}/**
41
+ */const Ul={attribute:!0,type:String,converter:hs,reflect:!1,hasChanged:Xn},Bl=(e=Ul,t,r)=>{const{kind:s,metadata:n}=r;let i=globalThis.litPropertyMetadata.get(n);if(i===void 0&&globalThis.litPropertyMetadata.set(n,i=new Map),s==="setter"&&((e=Object.create(e)).wrapped=!0),i.set(r.name,e),s==="accessor"){const{name:o}=r;return{set(a){const c=t.get.call(this);t.set.call(this,a),this.requestUpdate(o,c,e,!0,a)},init(a){return a!==void 0&&this.C(o,void 0,e,a),a}}}if(s==="setter"){const{name:o}=r;return function(a){const c=this[o];t.call(this,a),this.requestUpdate(o,c,e,!0,a)}}throw Error("Unsupported decorator location: "+s)};function Ee(e){return(t,r)=>typeof r=="object"?Bl(e,t,r):((s,n,i)=>{const o=n.hasOwnProperty(i);return n.constructor.createProperty(i,s),o?Object.getOwnPropertyDescriptor(n,i):void 0})(e,t,r)}/**
42
42
  * @license
43
43
  * Copyright 2017 Google LLC
44
44
  * SPDX-License-Identifier: BSD-3-Clause
@@ -46,16 +46,16 @@
46
46
  * @license
47
47
  * Copyright 2017 Google LLC
48
48
  * SPDX-License-Identifier: BSD-3-Clause
49
- */const Bl=(e,t,r)=>(r.configurable=!0,r.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(e,t,r),r);/**
49
+ */const Dl=(e,t,r)=>(r.configurable=!0,r.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(e,t,r),r);/**
50
50
  * @license
51
51
  * Copyright 2017 Google LLC
52
52
  * SPDX-License-Identifier: BSD-3-Clause
53
- */function Ul(e,t){return(r,s,n)=>{const i=o=>{var a;return((a=o.renderRoot)==null?void 0:a.querySelector(e))??null};return Bl(r,s,{get(){return i(this)}})}}const Dl=180,Wc=5e3,Zn="M 50 17 C 60 17 68 19.5 74 25 C 79 29.5 81.5 36.5 81.5 46.5 V 54.5 C 81.5 63.5 78.5 71 71.5 76.5 C 65 81.5 57.5 84 50 84 C 42.5 84 35 81.5 28.5 76.5 C 21.5 71 18.5 63.5 18.5 54.5 V 46.5 C 18.5 36.5 21 29.5 26 25 C 32 19.5 40 17 50 17 Z",jl=`M 0 0 H 100 V 100 H 0 Z ${Zn}`;function Vl(e,t,r){if(t===null)return"Center your face in the oval. We will capture automatically when framing looks good.";const s=Math.max(Wc-(e-t),0),n=Math.max(Math.ceil(s/1e3),0);return r.passesQualityChecks?`Hold steady. Capturing the best frame in ${n}s.`:`${r.message} Best frame selection finishes in ${n}s.`}function Gl(e){const t=e==null?void 0:e.captureScore;return typeof t=="number"&&t>0?"Best frame captured. Review and confirm this photo.":"Capture complete. Review and confirm this photo."}class Hl{constructor(t){this.frameCapture=al(),this.stopped=!1,this.animationFrameId=null,this.analysisTimerId=null,this.analysisInFlight=!1,this.lastAnalysisTimestamp=0,this.countdownStartedAt=null,this.bestCaptureScore=-1,this.bestQualityResult=null,this.videoElement=t.videoElement,this.copy=t.copy,this.onStateChange=t.onStateChange,this.waitForReady=t.waitForReady??(r=>il(r)),this.assessLiveQuality=t.assessLiveQuality??vc,this.assessPreviewBlob=t.assessPreviewBlob??zl,this.mode=t.initialMode,this.state=this.createStartingState(),this.emit(this.state)}getState(){return this.state}async start(){this.stopped||(this.emit(this.createStartingState()),await this.waitForReady(this.videoElement),!this.stopped&&(this.emit(this.createLiveState({feedbackMessage:this.mode==="auto"?this.copy.autoReadyMessage:this.copy.manualReadyMessage,feedbackTone:this.mode==="auto"?"neutral":"manual"})),this.mode==="auto"&&this.scheduleAutoAnalysis()))}async takePhotoNow(){if(this.stopped||this.state.phase!=="live")return;this.mode==="auto"&&(this.mode="manual",this.cancelScheduledAnalysis());const t=await this.frameCapture.captureBlob(this.videoElement);if(this.stopped)return;const r=await this.assessPreviewBlob(t);this.stopped||this.emit(this.createPreviewState(t,r))}async retake(){this.stopped||this.state.phase!=="preview"||(this.resetAutoState(),ol(this.videoElement),this.emit(this.createLiveState({feedbackMessage:this.mode==="auto"?this.copy.autoReadyMessage:this.copy.retakeReadyMessage??this.copy.manualReadyMessage,feedbackTone:this.mode==="auto"?"neutral":"manual"})),this.mode==="auto"&&this.scheduleAutoAnalysis())}confirm(){if(this.state.phase!=="preview")throw new Error("Failed to confirm the photo.");return this.state.previewBlob}stop(){this.stopped=!0,this.cancelScheduledAnalysis()}createStartingState(){return{phase:"starting",mode:this.mode,feedbackMessage:"",feedbackTone:"neutral",countdownProgress:0,qualityResult:null,fallbackReason:null,previewBlob:null,errorMessage:"",canConfirm:!1,canTakePhoto:!1}}createLiveState(t){return{phase:"live",mode:this.mode,feedbackMessage:t.feedbackMessage,feedbackTone:t.feedbackTone,countdownProgress:t.countdownProgress??0,qualityResult:t.qualityResult??null,fallbackReason:t.fallbackReason??null,previewBlob:null,errorMessage:"",canConfirm:!1,canTakePhoto:this.mode!=="auto"||this.countdownStartedAt===null}}createPreviewState(t,r,s){return{phase:"preview",mode:this.mode,feedbackMessage:(s==null?void 0:s.feedbackMessage)??(r==null?void 0:r.message)??"Review the captured image before continuing.",feedbackTone:(s==null?void 0:s.feedbackTone)??(r?r.passesQualityChecks?"success":"error":"manual"),countdownProgress:r?1:0,qualityResult:r,fallbackReason:null,previewBlob:t,errorMessage:"",canConfirm:(r==null?void 0:r.passesQualityChecks)!==!1,canTakePhoto:!1}}emitError(t){this.stopped||(this.cancelScheduledAnalysis(),this.emit({phase:"error",mode:this.mode,feedbackMessage:t,feedbackTone:"error",countdownProgress:0,qualityResult:null,fallbackReason:null,previewBlob:null,errorMessage:t,canConfirm:!1,canTakePhoto:!1}))}emit(t){this.stopped||(this.state=t,this.onStateChange(t))}scheduleAutoAnalysis(){if(this.stopped||this.mode!=="auto"||this.state.phase!=="live")return;const t=performance.now(),r=Math.max(Dl-(t-this.lastAnalysisTimestamp),0);this.cancelScheduledAnalysis(),this.analysisTimerId=window.setTimeout(()=>{this.analysisTimerId=null,this.animationFrameId=window.requestAnimationFrame(s=>{this.runAutoAnalysis(s)})},r)}async runAutoAnalysis(t){if(!this.stopped){if(this.mode!=="auto"||this.state.phase!=="live"||this.analysisInFlight){this.scheduleAutoAnalysis();return}this.analysisInFlight=!0,this.lastAnalysisTimestamp=t;try{this.frameCapture.captureWorkingFrame(this.videoElement);const r=await this.assessLiveQuality(this.videoElement,t);if(this.stopped||this.mode!=="auto"||this.state.phase!=="live")return;if(r.passesQualityChecks&&(this.countdownStartedAt===null&&(this.countdownStartedAt=t),r.captureScore>this.bestCaptureScore&&(this.frameCapture.promoteWorkingToBest(),this.bestCaptureScore=r.captureScore,this.bestQualityResult=r)),this.countdownStartedAt!==null){const s=Math.min((t-this.countdownStartedAt)/Wc,1);if(s>=1){await this.finishAutoCapture();return}this.emit(this.createLiveState({feedbackMessage:Vl(t,this.countdownStartedAt,r),feedbackTone:r.passesQualityChecks?"success":"neutral",countdownProgress:s,qualityResult:r}))}else this.emit(this.createLiveState({feedbackMessage:r.message,feedbackTone:r.passesQualityChecks?"success":"neutral",qualityResult:r}))}catch{!this.stopped&&this.mode==="auto"&&this.state.phase==="live"&&this.switchToManual();return}finally{this.analysisInFlight=!1}this.scheduleAutoAnalysis()}}async finishAutoCapture(){const t=this.frameCapture.hasStoredBestFrame()?await this.frameCapture.storedBestFrameToBlob():await this.frameCapture.captureBlob(this.videoElement);if(this.stopped||this.mode!=="auto"||this.state.phase!=="live")return;const r=this.bestQualityResult??await this.assessPreviewBlob(t);this.stopped||this.mode!=="auto"||this.state.phase!=="live"||this.emit(this.createPreviewState(t,r,{feedbackMessage:Gl(r),feedbackTone:(r==null?void 0:r.passesQualityChecks)===!1?"error":"success"}))}switchToManual(){this.mode="manual",this.resetAutoState(),this.emit(this.createLiveState({feedbackMessage:this.copy.autoUnavailableMessage,feedbackTone:"manual",fallbackReason:"auto-capture-unavailable"}))}cancelScheduledAnalysis(){this.analysisTimerId!==null&&(window.clearTimeout(this.analysisTimerId),this.analysisTimerId=null),this.animationFrameId!==null&&(window.cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}resetAutoState(){this.cancelScheduledAnalysis(),this.countdownStartedAt=null,this.bestCaptureScore=-1,this.bestQualityResult=null,this.frameCapture.resetStoredBestFrame()}}async function zl(e){try{const t=await Hn(e);return await jn(t)}catch{return null}}var Wl=Object.defineProperty,Kl=Object.getOwnPropertyDescriptor,j=(e,t,r,s)=>{for(var n=s>1?void 0:s?Kl(t,r):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(n=(s?o(t,r,n):o(n))||n);return s&&n&&Wl(t,r,n),n};_.SimFaceCapture=class extends kr{constructor(){super(...arguments),this.label=wc,this.idleFeedbackLabel=Vn,this.embedded=!1,this.active=!1,this.confirmLabel=Ac,this.captureLabel=Ec,this.retakeLabel=kc,this.retryLabel=Sc,this.capturePreference="auto-preferred",this.allowMediaPickerFallback=!0,this.captureState="idle",this.errorMessage="",this.feedbackMessage=Vn,this.feedbackTone="neutral",this.previewUrl="",this.qualityResult=null,this.canTakePhoto=!0,this.captureMode="auto",this.stream=null,this.sessionController=null,this.currentCaptureStep=null,this.capturedBlob=null,this.pendingActiveSync=!1}disconnectedCallback(){super.disconnectedCallback(),this.stopSession()}willUpdate(t){t.has("idleFeedbackLabel")&&this.captureState==="idle"&&(this.feedbackMessage=this.idleFeedbackLabel)}updated(t){!t.has("active")||this.pendingActiveSync||(this.pendingActiveSync=!0,queueMicrotask(()=>{if(this.pendingActiveSync=!1,!!this.isConnected){if(this.active){this.captureState==="idle"&&this.beginCapture();return}this.endCapture()}}))}render(){return Ue`
53
+ */function jl(e,t){return(r,s,n)=>{const i=o=>{var a;return((a=o.renderRoot)==null?void 0:a.querySelector(e))??null};return Dl(r,s,{get(){return i(this)}})}}const Vl=180,Kc=5e3,ei="M 50 17 C 60 17 68 19.5 74 25 C 79 29.5 81.5 36.5 81.5 46.5 V 54.5 C 81.5 63.5 78.5 71 71.5 76.5 C 65 81.5 57.5 84 50 84 C 42.5 84 35 81.5 28.5 76.5 C 21.5 71 18.5 63.5 18.5 54.5 V 46.5 C 18.5 36.5 21 29.5 26 25 C 32 19.5 40 17 50 17 Z",Gl=`M 0 0 H 100 V 100 H 0 Z ${ei}`;function Hl(e,t,r){if(t===null)return"Center your face in the oval. We will capture automatically when framing looks good.";const s=Math.max(Kc-(e-t),0),n=Math.max(Math.ceil(s/1e3),0);return r.passesQualityChecks?`Hold steady. Capturing the best frame in ${n}s.`:`${r.message} Best frame selection finishes in ${n}s.`}function zl(e){const t=e==null?void 0:e.captureScore;return typeof t=="number"&&t>0?"Best frame captured. Review and confirm this photo.":"Capture complete. Review and confirm this photo."}class Wl{constructor(t){this.frameCapture=hl(),this.stopped=!1,this.animationFrameId=null,this.analysisTimerId=null,this.analysisInFlight=!1,this.lastAnalysisTimestamp=0,this.countdownStartedAt=null,this.bestCaptureScore=-1,this.bestQualityResult=null,this.videoElement=t.videoElement,this.copy=t.copy,this.onStateChange=t.onStateChange,this.waitForReady=t.waitForReady??(r=>al(r)),this.assessLiveQuality=t.assessLiveQuality??_c,this.assessPreviewBlob=t.assessPreviewBlob??Kl,this.mode=t.initialMode,this.state=this.createStartingState(),this.emit(this.state)}getState(){return this.state}async start(){this.stopped||(this.emit(this.createStartingState()),await this.waitForReady(this.videoElement),!this.stopped&&(this.emit(this.createLiveState({feedbackMessage:this.mode==="auto"?this.copy.autoReadyMessage:this.copy.manualReadyMessage,feedbackTone:this.mode==="auto"?"neutral":"manual"})),this.mode==="auto"&&this.scheduleAutoAnalysis()))}async takePhotoNow(){if(this.stopped||this.state.phase!=="live")return;this.mode==="auto"&&(this.mode="manual",this.cancelScheduledAnalysis());const t=await this.frameCapture.captureBlob(this.videoElement);if(this.stopped)return;const r=await this.assessPreviewBlob(t);this.stopped||this.emit(this.createPreviewState(t,r))}async retake(){this.stopped||this.state.phase!=="preview"||(this.resetAutoState(),cl(this.videoElement),this.emit(this.createLiveState({feedbackMessage:this.mode==="auto"?this.copy.autoReadyMessage:this.copy.retakeReadyMessage??this.copy.manualReadyMessage,feedbackTone:this.mode==="auto"?"neutral":"manual"})),this.mode==="auto"&&this.scheduleAutoAnalysis())}confirm(){if(this.state.phase!=="preview")throw new Error("Failed to confirm the photo.");return this.state.previewBlob}stop(){this.stopped=!0,this.cancelScheduledAnalysis()}createStartingState(){return{phase:"starting",mode:this.mode,feedbackMessage:"",feedbackTone:"neutral",countdownProgress:0,qualityResult:null,fallbackReason:null,previewBlob:null,errorMessage:"",canConfirm:!1,canTakePhoto:!1}}createLiveState(t){return{phase:"live",mode:this.mode,feedbackMessage:t.feedbackMessage,feedbackTone:t.feedbackTone,countdownProgress:t.countdownProgress??0,qualityResult:t.qualityResult??null,fallbackReason:t.fallbackReason??null,previewBlob:null,errorMessage:"",canConfirm:!1,canTakePhoto:this.mode!=="auto"||this.countdownStartedAt===null}}createPreviewState(t,r,s){return{phase:"preview",mode:this.mode,feedbackMessage:(s==null?void 0:s.feedbackMessage)??(r==null?void 0:r.message)??"Review the captured image before continuing.",feedbackTone:(s==null?void 0:s.feedbackTone)??(r?r.passesQualityChecks?"success":"error":"manual"),countdownProgress:r?1:0,qualityResult:r,fallbackReason:null,previewBlob:t,errorMessage:"",canConfirm:(r==null?void 0:r.passesQualityChecks)!==!1,canTakePhoto:!1}}emitError(t){this.stopped||(this.cancelScheduledAnalysis(),this.emit({phase:"error",mode:this.mode,feedbackMessage:t,feedbackTone:"error",countdownProgress:0,qualityResult:null,fallbackReason:null,previewBlob:null,errorMessage:t,canConfirm:!1,canTakePhoto:!1}))}emit(t){this.stopped||(this.state=t,this.onStateChange(t))}scheduleAutoAnalysis(){if(this.stopped||this.mode!=="auto"||this.state.phase!=="live")return;const t=performance.now(),r=Math.max(Vl-(t-this.lastAnalysisTimestamp),0);this.cancelScheduledAnalysis(),this.analysisTimerId=window.setTimeout(()=>{this.analysisTimerId=null,this.animationFrameId=window.requestAnimationFrame(s=>{this.runAutoAnalysis(s)})},r)}async runAutoAnalysis(t){if(!this.stopped){if(this.mode!=="auto"||this.state.phase!=="live"||this.analysisInFlight){this.scheduleAutoAnalysis();return}this.analysisInFlight=!0,this.lastAnalysisTimestamp=t;try{this.frameCapture.captureWorkingFrame(this.videoElement);const r=await this.assessLiveQuality(this.videoElement,t);if(this.stopped||this.mode!=="auto"||this.state.phase!=="live")return;if(r.passesQualityChecks&&(this.countdownStartedAt===null&&(this.countdownStartedAt=t),r.captureScore>this.bestCaptureScore&&(this.frameCapture.promoteWorkingToBest(),this.bestCaptureScore=r.captureScore,this.bestQualityResult=r)),this.countdownStartedAt!==null){const s=Math.min((t-this.countdownStartedAt)/Kc,1);if(s>=1){await this.finishAutoCapture();return}this.emit(this.createLiveState({feedbackMessage:Hl(t,this.countdownStartedAt,r),feedbackTone:r.passesQualityChecks?"success":"neutral",countdownProgress:s,qualityResult:r}))}else this.emit(this.createLiveState({feedbackMessage:r.message,feedbackTone:r.passesQualityChecks?"success":"neutral",qualityResult:r}))}catch{!this.stopped&&this.mode==="auto"&&this.state.phase==="live"&&this.switchToManual();return}finally{this.analysisInFlight=!1}this.scheduleAutoAnalysis()}}async finishAutoCapture(){const t=this.frameCapture.hasStoredBestFrame()?await this.frameCapture.storedBestFrameToBlob():await this.frameCapture.captureBlob(this.videoElement);if(this.stopped||this.mode!=="auto"||this.state.phase!=="live")return;const r=this.bestQualityResult??await this.assessPreviewBlob(t);this.stopped||this.mode!=="auto"||this.state.phase!=="live"||this.emit(this.createPreviewState(t,r,{feedbackMessage:zl(r),feedbackTone:(r==null?void 0:r.passesQualityChecks)===!1?"error":"success"}))}switchToManual(){this.mode="manual",this.resetAutoState(),this.emit(this.createLiveState({feedbackMessage:this.copy.autoUnavailableMessage,feedbackTone:"manual",fallbackReason:"auto-capture-unavailable"}))}cancelScheduledAnalysis(){this.analysisTimerId!==null&&(window.clearTimeout(this.analysisTimerId),this.analysisTimerId=null),this.animationFrameId!==null&&(window.cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}resetAutoState(){this.cancelScheduledAnalysis(),this.countdownStartedAt=null,this.bestCaptureScore=-1,this.bestQualityResult=null,this.frameCapture.resetStoredBestFrame()}}async function Kl(e){try{const t=await zn(e);return await Vn(t)}catch{return null}}var ql=Object.defineProperty,Xl=Object.getOwnPropertyDescriptor,j=(e,t,r,s)=>{for(var n=s>1?void 0:s?Xl(t,r):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(n=(s?o(t,r,n):o(n))||n);return s&&n&&ql(t,r,n),n};_.SimFaceCapture=class extends kr{constructor(){super(...arguments),this.label=Ac,this.idleFeedbackLabel=Gn,this.embedded=!1,this.active=!1,this.confirmLabel=Ec,this.captureLabel=kc,this.retakeLabel=Sc,this.retryLabel=Cc,this.capturePreference="auto-preferred",this.allowMediaPickerFallback=!0,this.captureState="idle",this.errorMessage="",this.feedbackMessage=Gn,this.feedbackTone="neutral",this.previewUrl="",this.qualityResult=null,this.canTakePhoto=!0,this.captureMode="auto",this.stream=null,this.sessionController=null,this.currentCaptureStep=null,this.capturedBlob=null,this.pendingActiveSync=!1}disconnectedCallback(){super.disconnectedCallback(),this.stopSession()}willUpdate(t){t.has("idleFeedbackLabel")&&this.captureState==="idle"&&(this.feedbackMessage=this.idleFeedbackLabel)}updated(t){!t.has("active")||this.pendingActiveSync||(this.pendingActiveSync=!0,queueMicrotask(()=>{if(this.pendingActiveSync=!1,!!this.isConnected){if(this.active){this.captureState==="idle"&&this.beginCapture();return}this.endCapture()}}))}render(){return Be`
54
54
  <div class="container capture-shell">
55
55
  ${this.renderCaptureState()}
56
56
  </div>
57
- `}async startCapture(){this.active=!0,await this.updateComplete,await this.beginCapture()}renderCaptureState(){var r;const t=this.captureState!=="idle";return Ue`
58
- ${t?Ue`<button class="close-btn" data-simface-action="cancel" @click=${this.handleCancel} aria-label="Close">
57
+ `}async startCapture(){this.active=!0,await this.updateComplete,await this.beginCapture()}renderCaptureState(){var r;const t=this.captureState!=="idle";return Be`
58
+ ${t?Be`<button class="close-btn" data-simface-action="cancel" @click=${this.handleCancel} aria-label="Close">
59
59
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
60
60
  <line x1="18" y1="6" x2="6" y2="18"></line>
61
61
  <line x1="6" y1="6" x2="18" y2="18"></line>
@@ -63,7 +63,7 @@
63
63
  </button>`:""}
64
64
 
65
65
  <p class="capture-copy">${this.label}</p>
66
- ${this.captureState==="idle"?"":Ue`
66
+ ${this.captureState==="idle"?"":Be`
67
67
  <div class="stage">
68
68
  <video
69
69
  id="embedded-video"
@@ -81,9 +81,9 @@
81
81
  class="guide-overlay ${this.captureState==="live"||this.captureState==="starting"?"":"hidden"}"
82
82
  >
83
83
  <svg viewBox="0 0 100 100" preserveAspectRatio="none" aria-hidden="true">
84
- <path class="guide-mask" d=${jl}></path>
85
- <path class="ring-outline" d=${Zn}></path>
86
- <path class="ring-progress" d=${Zn} pathLength="100"></path>
84
+ <path class="guide-mask" d=${Gl}></path>
85
+ <path class="ring-outline" d=${ei}></path>
86
+ <path class="ring-progress" d=${ei} pathLength="100"></path>
87
87
  </svg>
88
88
  </div>
89
89
  </div>
@@ -94,18 +94,18 @@
94
94
  </div>
95
95
 
96
96
  <div class="btn-row">
97
- ${this.captureState==="live"?Ue`
98
- ${this.captureMode==="manual"?Ue`<button class="btn btn-primary" data-simface-action="capture" ?disabled=${!this.canTakePhoto} @click=${this.handleManualCapture}>${this.captureLabel}</button>`:""}
97
+ ${this.captureState==="live"?Be`
98
+ ${this.captureMode==="manual"?Be`<button class="btn btn-primary" data-simface-action="capture" ?disabled=${!this.canTakePhoto} @click=${this.handleManualCapture}>${this.captureLabel}</button>`:""}
99
99
  `:""}
100
- ${this.captureState==="preview"?Ue`
100
+ ${this.captureState==="preview"?Be`
101
101
  <button class="btn btn-retake" data-simface-action="retake" @click=${this.handleRetake}>${this.retakeLabel}</button>
102
- ${((r=this.qualityResult)==null?void 0:r.passesQualityChecks)===!1?"":Ue`<button class="btn btn-confirm" data-simface-action="confirm" @click=${this.handleConfirm}>${this.confirmLabel}</button>`}
102
+ ${((r=this.qualityResult)==null?void 0:r.passesQualityChecks)===!1?"":Be`<button class="btn btn-confirm" data-simface-action="confirm" @click=${this.handleConfirm}>${this.confirmLabel}</button>`}
103
103
  `:""}
104
- ${this.captureState==="error"?Ue`
104
+ ${this.captureState==="error"?Be`
105
105
  <button class="btn btn-primary" data-simface-action="retry" @click=${this.beginCapture}>${this.retryLabel}</button>
106
106
  `:""}
107
107
  </div>
108
- `}async beginCapture(){if(!this.active||this.captureState==="starting"||this.captureState==="live")return;this.stopSession(),this.resetState(),this.captureState="starting",this.feedbackMessage="Requesting camera access...",this.feedbackTone="neutral";const t=Cc({capturePreference:this.capturePreference,allowMediaPickerFallback:this.allowMediaPickerFallback},this);t.label=this.label,t.idleFeedbackLabel=this.idleFeedbackLabel,t.confirmLabel=this.confirmLabel,t.captureLabel=this.captureLabel,t.retakeLabel=this.retakeLabel,t.retryLabel=this.retryLabel;const r=await tl({capturePreference:t.capturePreference}),s=rl(t,r),n=s.steps.find(a=>a==="auto-camera"||a==="manual-camera")??null,i=s.steps.includes("media-picker");if(!n){await this.startMediaPicker();return}try{this.stream=await nl()}catch(a){if(a instanceof Gn&&i){await this.startMediaPicker();return}this.handleCaptureError(a);return}if(await this.updateComplete,!this.active){this.stopSession();return}const o=this.embeddedVideoElement;if(!o||!this.stream){this.handleCaptureError(new Error("Inline camera preview could not be created."));return}o.srcObject=this.stream,this.currentCaptureStep=n,this.sessionController=new Hl({videoElement:o,initialMode:n==="auto-camera"?"auto":"manual",copy:{autoReadyMessage:"Center your face in the oval. We will capture automatically when framing looks good.",manualReadyMessage:"When you are ready, press Take photo.",autoUnavailableMessage:"Automatic capture is unavailable. Press Take photo instead.",retakeReadyMessage:"When you are ready, press Take photo."},onStateChange:a=>this.applySessionState(a)});try{await this.sessionController.start()}catch(a){this.handleCaptureError(a)}}async startMediaPicker(){this.stopSession(),this.currentCaptureStep="media-picker",this.captureState="starting",this.feedbackMessage="Opening media picker...",this.feedbackTone="neutral";try{const t=await Tc();if(!t){this.handleCancel();return}await this.showPickedPreview(t)}catch(t){this.handleCaptureError(t)}}applySessionState(t){if(this.captureState=t.phase,this.feedbackMessage=t.feedbackMessage,this.feedbackTone=t.feedbackTone,this.syncProgress(t.countdownProgress),this.qualityResult=t.qualityResult,this.errorMessage=t.phase==="error"?t.errorMessage:"",this.canTakePhoto=t.canTakePhoto,this.captureMode=t.mode,t.phase==="preview"){this.capturedBlob=t.previewBlob,this.setPreviewBlob(t.previewBlob);return}this.capturedBlob=null,this.clearPreviewUrl()}async showPickedPreview(t){const r=await this.assessPickedBlob(t);this.capturedBlob=t,this.qualityResult=r,this.captureState="preview",this.feedbackMessage=(r==null?void 0:r.message)??"Review this capture before continuing.",this.feedbackTone=r?r.passesQualityChecks?"success":"error":"neutral",this.syncProgress(r?1:0),this.setPreviewBlob(t)}handleManualCapture(){var t;(t=this.sessionController)==null||t.takePhotoNow().catch(r=>{this.handleCaptureError(r)})}handleRetake(){var t;if(this.capturedBlob=null,this.qualityResult=null,this.clearPreviewUrl(),this.currentCaptureStep==="media-picker"){this.active&&this.beginCapture();return}(t=this.sessionController)==null||t.retake().catch(r=>{this.handleCaptureError(r)})}handleConfirm(){if(!this.capturedBlob)return;const t=this.capturedBlob;this.active=!1,this.stopSession(),this.resetState(),this.dispatchCaptured(t)}handleCancel(){this.active=!1,this.stopSession(),this.resetState(),this.dispatchCancelled()}handleCaptureError(t){this.stopSession(),this.errorMessage=t instanceof Error?t.message:"Capture failed",this.captureState="error",this.feedbackMessage=this.errorMessage,this.feedbackTone="error",this.dispatchError(this.errorMessage)}endCapture(){this.stopSession(),this.resetState()}stopSession(){var r;(r=this.sessionController)==null||r.stop(),this.sessionController=null,this.currentCaptureStep=null,this.stream&&(this.stream.getTracks().forEach(s=>s.stop()),this.stream=null);const t=this.embeddedVideoElement;t&&(t.srcObject=null),this.syncProgress(0)}resetState(){this.clearPreviewUrl(),this.captureState="idle",this.errorMessage="",this.feedbackMessage=this.idleFeedbackLabel,this.feedbackTone="neutral",this.syncProgress(0),this.qualityResult=null,this.capturedBlob=null,this.captureMode="auto"}syncProgress(t){this.style.setProperty("--capture-progress",String(t))}setPreviewBlob(t){this.clearPreviewUrl(),this.previewUrl=URL.createObjectURL(t)}clearPreviewUrl(){this.previewUrl&&(URL.revokeObjectURL(this.previewUrl),this.previewUrl="")}dispatchCaptured(t){this.dispatchEvent(new CustomEvent("simface-captured",{detail:{imageBlob:t},bubbles:!0,composed:!0}))}dispatchCancelled(){this.dispatchEvent(new CustomEvent("simface-cancelled",{bubbles:!0,composed:!0}))}dispatchError(t){this.dispatchEvent(new CustomEvent("simface-error",{detail:{error:t},bubbles:!0,composed:!0}))}feedbackClass(){return this.feedbackTone==="success"?"quality-good":this.feedbackTone==="error"?"quality-bad":this.feedbackTone==="manual"?"quality-manual":"quality-neutral"}async assessPickedBlob(t){try{const r=await Hn(t);return await jn(r)}catch{return null}}},_.SimFaceCapture.styles=gl`
108
+ `}async beginCapture(){if(!this.active||this.captureState==="starting"||this.captureState==="live")return;this.stopSession(),this.resetState(),this.captureState="starting",this.feedbackMessage="Requesting camera access...",this.feedbackTone="neutral";const t=Tc({capturePreference:this.capturePreference,allowMediaPickerFallback:this.allowMediaPickerFallback},this);t.label=this.label,t.idleFeedbackLabel=this.idleFeedbackLabel,t.confirmLabel=this.confirmLabel,t.captureLabel=this.captureLabel,t.retakeLabel=this.retakeLabel,t.retryLabel=this.retryLabel;const r=await sl({capturePreference:t.capturePreference}),s=nl(t,r),n=s.steps.find(a=>a==="auto-camera"||a==="manual-camera")??null,i=s.steps.includes("media-picker");if(!n){await this.startMediaPicker();return}try{this.stream=await ol()}catch(a){if(a instanceof Hn&&i){await this.startMediaPicker();return}this.handleCaptureError(a);return}if(await this.updateComplete,!this.active){this.stopSession();return}const o=this.embeddedVideoElement;if(!o||!this.stream){this.handleCaptureError(new Error("Inline camera preview could not be created."));return}o.srcObject=this.stream,this.currentCaptureStep=n,this.sessionController=new Wl({videoElement:o,initialMode:n==="auto-camera"?"auto":"manual",copy:{autoReadyMessage:"Center your face in the oval. We will capture automatically when framing looks good.",manualReadyMessage:"When you are ready, press Take photo.",autoUnavailableMessage:"Automatic capture is unavailable. Press Take photo instead.",retakeReadyMessage:"When you are ready, press Take photo."},onStateChange:a=>this.applySessionState(a)});try{await this.sessionController.start()}catch(a){this.handleCaptureError(a)}}async startMediaPicker(){this.stopSession(),this.currentCaptureStep="media-picker",this.captureState="starting",this.feedbackMessage="Opening media picker...",this.feedbackTone="neutral";try{const t=await Lc();if(!t){this.handleCancel();return}await this.showPickedPreview(t)}catch(t){this.handleCaptureError(t)}}applySessionState(t){if(this.captureState=t.phase,this.feedbackMessage=t.feedbackMessage,this.feedbackTone=t.feedbackTone,this.syncProgress(t.countdownProgress),this.qualityResult=t.qualityResult,this.errorMessage=t.phase==="error"?t.errorMessage:"",this.canTakePhoto=t.canTakePhoto,this.captureMode=t.mode,t.phase==="preview"){this.capturedBlob=t.previewBlob,this.setPreviewBlob(t.previewBlob);return}this.capturedBlob=null,this.clearPreviewUrl()}async showPickedPreview(t){const r=await this.assessPickedBlob(t);this.capturedBlob=t,this.qualityResult=r,this.captureState="preview",this.feedbackMessage=(r==null?void 0:r.message)??"Review this capture before continuing.",this.feedbackTone=r?r.passesQualityChecks?"success":"error":"neutral",this.syncProgress(r?1:0),this.setPreviewBlob(t)}handleManualCapture(){var t;(t=this.sessionController)==null||t.takePhotoNow().catch(r=>{this.handleCaptureError(r)})}handleRetake(){var t;if(this.capturedBlob=null,this.qualityResult=null,this.clearPreviewUrl(),this.currentCaptureStep==="media-picker"){this.active&&this.beginCapture();return}(t=this.sessionController)==null||t.retake().catch(r=>{this.handleCaptureError(r)})}handleConfirm(){if(!this.capturedBlob)return;const t=this.capturedBlob;this.active=!1,this.stopSession(),this.resetState(),this.dispatchCaptured(t)}handleCancel(){this.active=!1,this.stopSession(),this.resetState(),this.dispatchCancelled()}handleCaptureError(t){this.stopSession(),this.errorMessage=t instanceof Error?t.message:"Capture failed",this.captureState="error",this.feedbackMessage=this.errorMessage,this.feedbackTone="error",this.dispatchError(this.errorMessage)}endCapture(){this.stopSession(),this.resetState()}stopSession(){var r;(r=this.sessionController)==null||r.stop(),this.sessionController=null,this.currentCaptureStep=null,this.stream&&(this.stream.getTracks().forEach(s=>s.stop()),this.stream=null);const t=this.embeddedVideoElement;t&&(t.srcObject=null),this.syncProgress(0)}resetState(){this.clearPreviewUrl(),this.captureState="idle",this.errorMessage="",this.feedbackMessage=this.idleFeedbackLabel,this.feedbackTone="neutral",this.syncProgress(0),this.qualityResult=null,this.capturedBlob=null,this.captureMode="auto"}syncProgress(t){this.style.setProperty("--capture-progress",String(t))}setPreviewBlob(t){this.clearPreviewUrl(),this.previewUrl=URL.createObjectURL(t)}clearPreviewUrl(){this.previewUrl&&(URL.revokeObjectURL(this.previewUrl),this.previewUrl="")}dispatchCaptured(t){this.dispatchEvent(new CustomEvent("simface-captured",{detail:{imageBlob:t},bubbles:!0,composed:!0}))}dispatchCancelled(){this.dispatchEvent(new CustomEvent("simface-cancelled",{bubbles:!0,composed:!0}))}dispatchError(t){this.dispatchEvent(new CustomEvent("simface-error",{detail:{error:t},bubbles:!0,composed:!0}))}feedbackClass(){return this.feedbackTone==="success"?"quality-good":this.feedbackTone==="error"?"quality-bad":this.feedbackTone==="manual"?"quality-manual":"quality-neutral"}async assessPickedBlob(t){try{const r=await zn(t);return await Vn(r)}catch{return null}}},_.SimFaceCapture.styles=bl`
109
109
  :host {
110
110
  display: block;
111
111
  font-family: 'Mulish', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
@@ -354,4 +354,4 @@
354
354
  transform: rotate(360deg);
355
355
  }
356
356
  }
357
- `,j([Ee({type:String})],_.SimFaceCapture.prototype,"label",2),j([Ee({type:String,attribute:"idle-feedback-label"})],_.SimFaceCapture.prototype,"idleFeedbackLabel",2),j([Ee({type:Boolean,reflect:!0})],_.SimFaceCapture.prototype,"embedded",2),j([Ee({type:Boolean,reflect:!0})],_.SimFaceCapture.prototype,"active",2),j([Ee({type:String,attribute:"confirm-label"})],_.SimFaceCapture.prototype,"confirmLabel",2),j([Ee({type:String,attribute:"capture-label"})],_.SimFaceCapture.prototype,"captureLabel",2),j([Ee({type:String,attribute:"retake-label"})],_.SimFaceCapture.prototype,"retakeLabel",2),j([Ee({type:String,attribute:"retry-label"})],_.SimFaceCapture.prototype,"retryLabel",2),j([Ee({type:String,attribute:"capture-preference"})],_.SimFaceCapture.prototype,"capturePreference",2),j([Ee({type:Boolean,attribute:"allow-media-picker-fallback"})],_.SimFaceCapture.prototype,"allowMediaPickerFallback",2),j([Ye()],_.SimFaceCapture.prototype,"captureState",2),j([Ye()],_.SimFaceCapture.prototype,"errorMessage",2),j([Ye()],_.SimFaceCapture.prototype,"feedbackMessage",2),j([Ye()],_.SimFaceCapture.prototype,"feedbackTone",2),j([Ye()],_.SimFaceCapture.prototype,"previewUrl",2),j([Ye()],_.SimFaceCapture.prototype,"qualityResult",2),j([Ye()],_.SimFaceCapture.prototype,"canTakePhoto",2),j([Ye()],_.SimFaceCapture.prototype,"captureMode",2),j([Ul("#embedded-video")],_.SimFaceCapture.prototype,"embeddedVideoElement",2),_.SimFaceCapture=j([Rl("simface-capture")],_.SimFaceCapture);const Kc=Object.freeze(Object.defineProperty({__proto__:null,get SimFaceCapture(){return _.SimFaceCapture}},Symbol.toStringTag,{value:"Module"}));async function ql(e,t,r,s){const n=new ds(e);await n.validateAPIKey();const i=await qc(r,s);if(!i)return{success:!1,clientId:t,message:"Capture cancelled by user"};const o=await n.enroll(t,i);return o.alreadyEnrolled,o}async function Xl(e,t,r,s){const n=new ds(e);await n.validateAPIKey();const i=await qc(r,s);return i?n.verify(t,i):{match:!1,score:0,threshold:0,message:"Capture cancelled by user"}}async function qc(e,t){return Pc(e,t)}_.SimFaceAPIClient=ds,_.assessFaceQuality=jn,_.assessFaceQualityForVideo=vc,_.blobToDataURL=cl,_.blobToImage=Hn,_.captureFromCamera=Pc,_.enroll=ql,_.verify=Xl,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})}));
357
+ `,j([Ee({type:String})],_.SimFaceCapture.prototype,"label",2),j([Ee({type:String,attribute:"idle-feedback-label"})],_.SimFaceCapture.prototype,"idleFeedbackLabel",2),j([Ee({type:Boolean,reflect:!0})],_.SimFaceCapture.prototype,"embedded",2),j([Ee({type:Boolean,reflect:!0})],_.SimFaceCapture.prototype,"active",2),j([Ee({type:String,attribute:"confirm-label"})],_.SimFaceCapture.prototype,"confirmLabel",2),j([Ee({type:String,attribute:"capture-label"})],_.SimFaceCapture.prototype,"captureLabel",2),j([Ee({type:String,attribute:"retake-label"})],_.SimFaceCapture.prototype,"retakeLabel",2),j([Ee({type:String,attribute:"retry-label"})],_.SimFaceCapture.prototype,"retryLabel",2),j([Ee({type:String,attribute:"capture-preference"})],_.SimFaceCapture.prototype,"capturePreference",2),j([Ee({type:Boolean,attribute:"allow-media-picker-fallback"})],_.SimFaceCapture.prototype,"allowMediaPickerFallback",2),j([Ye()],_.SimFaceCapture.prototype,"captureState",2),j([Ye()],_.SimFaceCapture.prototype,"errorMessage",2),j([Ye()],_.SimFaceCapture.prototype,"feedbackMessage",2),j([Ye()],_.SimFaceCapture.prototype,"feedbackTone",2),j([Ye()],_.SimFaceCapture.prototype,"previewUrl",2),j([Ye()],_.SimFaceCapture.prototype,"qualityResult",2),j([Ye()],_.SimFaceCapture.prototype,"canTakePhoto",2),j([Ye()],_.SimFaceCapture.prototype,"captureMode",2),j([jl("#embedded-video")],_.SimFaceCapture.prototype,"embeddedVideoElement",2),_.SimFaceCapture=j([Nl("simface-capture")],_.SimFaceCapture);const qc=Object.freeze(Object.defineProperty({__proto__:null,get SimFaceCapture(){return _.SimFaceCapture}},Symbol.toStringTag,{value:"Module"}));async function Yl(e,t,r,s){const n=new fs(e);await n.validateAPIKey();const i=await Xc(r,s);if(!i)return{success:!1,clientId:t,message:"Capture cancelled by user"};const o=await n.enroll(t,i);return o.alreadyEnrolled,o}async function Ql(e,t,r,s){const n=new fs(e);await n.validateAPIKey();const i=await Xc(r,s);return i?n.verify(t,i):{match:!1,score:0,threshold:0,message:"Capture cancelled by user"}}async function Xc(e,t){return Mc(e,t)}_.SimFaceAPIClient=fs,_.assessFaceQuality=Vn,_.assessFaceQualityForVideo=_c,_.blobToDataURL=ul,_.blobToImage=zn,_.captureFromCamera=Mc,_.enroll=Yl,_.verify=Ql,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})}));