@simprints/simface-sdk 0.5.1 → 0.7.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,79 +1,79 @@
1
- (function(k,dt){typeof exports=="object"&&typeof module<"u"?dt(exports):typeof define=="function"&&define.amd?define(["exports"],dt):(k=typeof globalThis<"u"?globalThis:k||self,dt(k.SimFaceSDK={}))})(this,(function(k){"use strict";var Zc;class dt{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){const r=await t.json();throw new Error(r.error||"API key validation failed")}return t.json()}async enroll(t,r){const n=new FormData;n.append("projectId",this.projectId),n.append("apiKey",this.apiKey),n.append("clientId",t),n.append("image",r,"face.jpg");const s=await fetch(`${this.apiUrl}/api/v1/enroll`,{method:"POST",body:n});if(s.status===409)return{success:!1,clientId:t,alreadyEnrolled:!0,message:"User already enrolled"};if(!s.ok){const i=await s.json();throw new Error(i.error||"Enrollment failed")}return s.json()}async verify(t,r){const n=new FormData;n.append("projectId",this.projectId),n.append("apiKey",this.apiKey),n.append("clientId",t),n.append("image",r,"face.jpg");const s=await fetch(`${this.apiUrl}/api/v1/verify`,{method:"POST",body:n});if(s.status===404)return{match:!1,score:0,threshold:0,notEnrolled:!0,message:"User not enrolled"};if(!s.ok){const i=await s.json();throw new Error(i.error||"Verification failed")}return s.json()}}var It=typeof self<"u"?self:{};function pr(e,t){e:{for(var r=["CLOSURE_FLAGS"],n=It,s=0;s<r.length;s++)if((n=n[r[s]])==null){r=null;break e}r=n}return(e=r&&r[e])!=null?e:t}function ft(){throw Error("Invalid UTF8")}function vi(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}let Hr,$n;const t2=typeof TextDecoder<"u";let r2;const n2=typeof TextEncoder<"u";function wi(e){if(n2)e=(r2||(r2=new TextEncoder)).encode(e);else{let r=0;const n=new Uint8Array(3*e.length);for(let s=0;s<e.length;s++){var t=e.charCodeAt(s);if(t<128)n[r++]=t;else{if(t<2048)n[r++]=t>>6|192;else{if(t>=55296&&t<=57343){if(t<=56319&&s<e.length){const i=e.charCodeAt(++s);if(i>=56320&&i<=57343){t=1024*(t-55296)+i-56320+65536,n[r++]=t>>18|240,n[r++]=t>>12&63|128,n[r++]=t>>6&63|128,n[r++]=63&t|128;continue}s--}t=65533}n[r++]=t>>12|224,n[r++]=t>>6&63|128}n[r++]=63&t|128}}e=r===n.length?n:n.subarray(0,r)}return e}function Ei(e){It.setTimeout((()=>{throw e}),0)}var On,s2=pr(610401301,!1),Ai=pr(748402147,!0),Rn=pr(824648567,!0),In=pr(824656860,pr(1,!0));function ki(){var e=It.navigator;return e&&(e=e.userAgent)?e:""}const Si=It.navigator;function zr(e){return zr[" "](e),e}On=Si&&Si.userAgentData||null,zr[" "]=function(){};const Ci={};let mr=null;function i2(e){const t=e.length;let r=3*t/4;r%3?r=Math.floor(r):"=.".indexOf(e[t-1])!=-1&&(r="=.".indexOf(e[t-2])!=-1?r-2:r-1);const n=new Uint8Array(r);let s=0;return(function(i,o){function a(u){for(;c<i.length;){const h=i.charAt(c++),l=mr[h];if(l!=null)return l;if(!/^[\s\xa0]*$/.test(h))throw Error("Unknown base64 encoding at char: "+h)}return u}Ti();let c=0;for(;;){const u=a(-1),h=a(0),l=a(64),g=a(64);if(g===64&&u===-1)break;o(u<<2|h>>4),l!=64&&(o(h<<4&240|l>>2),g!=64&&o(l<<6&192|g))}})(e,(function(i){n[s++]=i})),s!==r?n.subarray(0,s):n}function Ti(){if(!mr){mr={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){const n=e.concat(t[r].split(""));Ci[r]=n;for(let s=0;s<n.length;s++){const i=n[s];mr[i]===void 0&&(mr[i]=s)}}}}var o2=typeof Uint8Array<"u",Li=!(!(s2&&On&&On.brands.length>0)&&(ki().indexOf("Trident")!=-1||ki().indexOf("MSIE")!=-1))&&typeof btoa=="function";const Pi=/[-_.]/g,a2={"-":"+",_:"/",".":"="};function c2(e){return a2[e]||""}function Mi(e){if(!Li)return i2(e);e=Pi.test(e)?e.replace(Pi,c2):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 Un(e){return o2&&e!=null&&e instanceof Uint8Array}var Ut={};function pt(){return h2||(h2=new Ie(null,Ut))}function Nn(e){Fi(Ut);var t=e.g;return(t=t==null||Un(t)?t:typeof t=="string"?Mi(t):null)==null?t:e.g=t}var Ie=class{h(){return new Uint8Array(Nn(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 h2,u2;function Fi(e){if(e!==Ut)throw Error("illegal external caller")}function xi(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function Bn(e){return xi(e=Error(e),"warning"),e}function Nt(e,t){if(e!=null){var r=u2??(u2={}),n=r[e]||0;n>=t||(r[e]=n+1,xi(e=Error(),"incident"),Ei(e))}}function Bt(){return typeof BigInt=="function"}var Dt=typeof Symbol=="function"&&typeof Symbol()=="symbol";function Ue(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 l2=Ue("jas",void 0,!0),$i=Ue(void 0,"0di"),gr=Ue(void 0,"1oa"),oe=Ue(void 0,Symbol()),d2=Ue(void 0,"0ub"),f2=Ue(void 0,"0ubs"),Dn=Ue(void 0,"0ubsb"),p2=Ue(void 0,"0actk"),jt=Ue("m_m","Pa",!0),Oi=Ue();const Ri={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},Ii=Object.defineProperties,f=Dt?l2:"Ga";var mt;const Ui=[];function yr(e,t){Dt||f in e||Ii(e,Ri),e[f]|=t}function j(e,t){Dt||f in e||Ii(e,Ri),e[f]=t}function br(e){return yr(e,34),e}function _r(e){return yr(e,8192),e}j(Ui,7),mt=Object.freeze(Ui);var Vt={};function ae(e,t){return t===void 0?e.h!==gt&&!!(2&(0|e.v[f])):!!(2&t)&&e.h!==gt}const gt={};function jn(e,t){if(e!=null){if(typeof e=="string")e=e?new Ie(e,Ut):pt();else if(e.constructor!==Ie)if(Un(e))e=e.length?new Ie(new Uint8Array(e),Ut):pt();else{if(!t)throw Error();e=void 0}}return e}class Ni{constructor(t,r,n){this.g=t,this.h=r,this.l=n}next(){const t=this.g.next();return t.done||(t.value=this.h.call(this.l,t.value)),t}[Symbol.iterator](){return this}}var m2=Object.freeze({});function Bi(e,t,r){const n=128&t?0:-1,s=e.length;var i;(i=!!s)&&(i=(i=e[s-1])!=null&&typeof i=="object"&&i.constructor===Object);const o=s+(i?-1:0);for(t=128&t?1:0;t<o;t++)r(t-n,e[t]);if(i){e=e[s-1];for(const a in e)!isNaN(a)&&r(+a,e[a])}}var Di={};function Gt(e){return 128&e?Di:void 0}function Wr(e){return e.Na=!0,e}var g2=Wr((e=>typeof e=="number")),ji=Wr((e=>typeof e=="string")),y2=Wr((e=>typeof e=="boolean")),Kr=typeof It.BigInt=="function"&&typeof It.BigInt(0)=="bigint";function ce(e){var t=e;if(ji(t)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(t))throw Error(String(t))}else if(g2(t)&&!Number.isSafeInteger(t))throw Error(String(t));return Kr?BigInt(e):e=y2(e)?e?"1":"0":ji(e)?e.trim()||"0":String(e)}var Vn=Wr((e=>Kr?e>=_2&&e<=w2:e[0]==="-"?Vi(e,b2):Vi(e,v2)));const b2=Number.MIN_SAFE_INTEGER.toString(),_2=Kr?BigInt(Number.MIN_SAFE_INTEGER):void 0,v2=Number.MAX_SAFE_INTEGER.toString(),w2=Kr?BigInt(Number.MAX_SAFE_INTEGER):void 0;function Vi(e,t){if(e.length>t.length)return!1;if(e.length<t.length||e===t)return!0;for(let r=0;r<e.length;r++){const n=e[r],s=t[r];if(n>s)return!1;if(n<s)return!0}}const E2=typeof Uint8Array.prototype.slice=="function";let A2,F=0,N=0;function Gi(e){const t=e>>>0;F=t,N=(e-t)/4294967296>>>0}function Ht(e){if(e<0){Gi(-e);const[t,r]=Kn(F,N);F=t>>>0,N=r>>>0}else Gi(e)}function Gn(e){const t=A2||(A2=new DataView(new ArrayBuffer(8)));t.setFloat32(0,+e,!0),N=0,F=t.getUint32(0,!0)}function Hn(e,t){const r=4294967296*t+(e>>>0);return Number.isSafeInteger(r)?r:vr(e,t)}function k2(e,t){return ce(Bt()?BigInt.asUintN(64,(BigInt(t>>>0)<<BigInt(32))+BigInt(e>>>0)):vr(e,t))}function zn(e,t){const r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=Hn(e,t))=="number"?r?-e:e:r?"-"+e:e}function Hi(e,t){return Bt()?ce(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(t))<<BigInt(32))+BigInt.asUintN(32,BigInt(e)))):ce(Wn(e,t))}function vr(e,t){if(e>>>=0,(t>>>=0)<=2097151)var r=""+(4294967296*t+e);else Bt()?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+zi(r)+zi(e));return r}function zi(e){return e=String(e),"0000000".slice(e.length)+e}function Wn(e,t){if(2147483648&t)if(Bt())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{const[r,n]=Kn(e,t);e="-"+vr(r,n)}else e=vr(e,t);return e}function qr(e){if(e.length<16)Ht(Number(e));else if(Bt())e=BigInt(e),F=Number(e&BigInt(4294967295))>>>0,N=Number(e>>BigInt(32)&BigInt(4294967295));else{const t=+(e[0]==="-");N=F=0;const r=e.length;for(let n=t,s=(r-t)%6+t;s<=r;n=s,s+=6){const i=Number(e.slice(n,s));N*=1e6,F=1e6*F+i,F>=4294967296&&(N+=Math.trunc(F/4294967296),N>>>=0,F>>>=0)}if(t){const[n,s]=Kn(F,N);F=n,N=s}}}function Kn(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}function Me(e){return Array.prototype.slice.call(e)}const wr=typeof BigInt=="function"?BigInt.asIntN:void 0,S2=typeof BigInt=="function"?BigInt.asUintN:void 0,yt=Number.isSafeInteger,Yr=Number.isFinite,zt=Math.trunc,C2=ce(0);function Er(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 Ne(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function Ar(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 Wi(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}const T2=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function kr(e){switch(typeof e){case"bigint":return!0;case"number":return Yr(e);case"string":return T2.test(e);default:return!1}}function Wt(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return Yr(e)?0|e:void 0}function Ki(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return Yr(e)?e>>>0:void 0}function qi(e){const t=e.length;return(e[0]==="-"?t<20||t===20&&e<="-9223372036854775808":t<19||t===19&&e<="9223372036854775807")?e:(qr(e),Wn(F,N))}function qn(e){return e=zt(e),yt(e)||(Ht(e),e=zn(F,N)),e}function Yi(e){var t=zt(Number(e));return yt(t)?String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),qi(e))}function Xi(e){var t=zt(Number(e));return yt(t)?ce(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Bt()?ce(wr(64,BigInt(e))):ce(qi(e)))}function Qi(e){return yt(e)?e=ce(qn(e)):(e=zt(e),yt(e)?e=String(e):(Ht(e),e=Wn(F,N)),e=ce(e)),e}function L2(e){return e==null?e:typeof e=="bigint"?(Vn(e)?e=Number(e):(e=wr(64,e),e=Vn(e)?Number(e):String(e)),e):kr(e)?typeof e=="number"?qn(e):Yi(e):void 0}function Xr(e){const t=typeof e;return e==null?e:t==="bigint"?ce(wr(64,e)):kr(e)?t==="string"?Xi(e):Qi(e):void 0}function Ji(e){if(typeof e!="string")throw Error();return e}function Sr(e){if(e!=null&&typeof e!="string")throw Error();return e}function X(e){return e==null||typeof e=="string"?e:void 0}function Yn(e,t,r,n){return e!=null&&e[jt]===Vt?e:Array.isArray(e)?((n=(r=0|e[f])|32&n|2&n)!==r&&j(e,n),new t(e)):(r?2&n?((e=t[$i])||(br((e=new t).v),e=t[$i]=e),t=e):t=new t:t=void 0,t)}function P2(e,t,r){if(t)e:{if(!kr(t=e))throw Bn("int64");switch(typeof t){case"string":t=Xi(t);break e;case"bigint":t=ce(wr(64,t));break e;default:t=Qi(t)}}else t=Xr(e);return(e=t)==null?r?C2:void 0:e}const M2={};let F2=(function(){try{return zr(new class extends Map{constructor(){super()}}),!1}catch{return!0}})();class Xn{constructor(){this.g=new Map}get(t){return this.g.get(t)}set(t,r){return this.g.set(t,r),this.size=this.g.size,this}delete(t){return t=this.g.delete(t),this.size=this.g.size,t}clear(){this.g.clear(),this.size=this.g.size}has(t){return this.g.has(t)}entries(){return this.g.entries()}keys(){return this.g.keys()}values(){return this.g.values()}forEach(t,r){return this.g.forEach(t,r)}[Symbol.iterator](){return this.entries()}}const x2=F2?(Object.setPrototypeOf(Xn.prototype,Map.prototype),Object.defineProperties(Xn.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),Xn):class extends Map{constructor(){super()}};function Zi(e){return e}function Qn(e){if(2&e.J)throw Error("Cannot mutate an immutable Map")}var Ke=class extends x2{constructor(e,t,r=Zi,n=Zi){super(),this.J=0|e[f],this.K=t,this.S=r,this.fa=this.K?$2:n;for(let s=0;s<e.length;s++){const i=e[s],o=r(i[0],!1,!0);let a=i[1];t?a===void 0&&(a=null):a=n(i[1],!1,!0,void 0,void 0,this.J),super.set(o,a)}}V(e){return _r(Array.from(super.entries(),e))}clear(){Qn(this),super.clear()}delete(e){return Qn(this),super.delete(this.S(e,!0,!1))}entries(){if(this.K){var e=super.keys();e=new Ni(e,O2,this)}else e=super.entries();return e}values(){if(this.K){var e=super.keys();e=new Ni(e,Ke.prototype.get,this)}else e=super.values();return e}forEach(e,t){this.K?super.forEach(((r,n,s)=>{e.call(t,s.get(n),n,s)})):super.forEach(e,t)}set(e,t){return Qn(this),(e=this.S(e,!0,!1))==null?this:t==null?(super.delete(e),this):super.set(e,this.fa(t,!0,!0,this.K,!1,this.J))}Ma(e){const t=this.S(e[0],!1,!0);e=e[1],e=this.K?e===void 0?null:e:this.fa(e,!1,!0,void 0,!1,this.J),super.set(t,e)}has(e){return super.has(this.S(e,!1,!1))}get(e){e=this.S(e,!1,!1);const t=super.get(e);if(t!==void 0){var r=this.K;return r?((r=this.fa(t,!1,!0,r,this.ra,this.J))!==t&&super.set(e,r),r):t}}[Symbol.iterator](){return this.entries()}};function $2(e,t,r,n,s,i){return e=Yn(e,n,r,i),s&&(e=es(e)),e}function O2(e){return[e,this.get(e)]}let R2;function eo(){return R2||(R2=new Ke(br([]),void 0,void 0,void 0,M2))}function Qr(e){return oe?e[oe]:void 0}function Jr(e,t){for(const r in e)!isNaN(r)&&t(e,+r,e[r])}Ke.prototype.toJSON=void 0;var Jn=class{};const I2={Ka:!0};function U2(e,t){t<100||Nt(f2,1)}function Zr(e,t,r,n){const s=n!==void 0;n=!!n;var i,o=oe;!s&&Dt&&o&&(i=e[o])&&Jr(i,U2),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||s||(u=!0,i=i-l+l)),t=void 0;for(var g=0;g<a;g++){let _=e[g];if(_!=null&&(_=r(_,n))!=null)if(h&&g>=i){const S=g-l;(t??(t={}))[S]=_}else o[g]=_}if(c)for(let _ in c){if((a=c[_])==null||(a=r(a,n))==null)continue;let S;g=+_,h&&!Number.isNaN(g)&&(S=g+l)<i?o[S]=a:(t??(t={}))[_]=a}return t&&(u?o.push(t):o[i]=t),s&&oe&&(e=Qr(e))&&e instanceof Jn&&(o[oe]=(function(_){const S=new Jn;return Jr(_,((Ot,Pe,Ze)=>{S[Pe]=Me(Ze)})),S.da=_.da,S})(e)),o}function N2(e){return e[0]=Cr(e[0]),e[1]=Cr(e[1]),e}function Cr(e){switch(typeof e){case"number":return Number.isFinite(e)?e:""+e;case"bigint":return Vn(e)?Number(e):""+e;case"boolean":return e?1:0;case"object":if(Array.isArray(e)){var t=0|e[f];return e.length===0&&1&t?void 0:Zr(e,t,Cr)}if(e!=null&&e[jt]===Vt)return to(e);if(e instanceof Ie){if((t=e.g)==null)e="";else if(typeof t=="string")e=t;else{if(Li){for(var r="",n=0,s=t.length-10240;n<s;)r+=String.fromCharCode.apply(null,t.subarray(n,n+=10240));r+=String.fromCharCode.apply(null,n?t.subarray(n):t),t=btoa(r)}else{r===void 0&&(r=0),Ti(),r=Ci[r],n=Array(Math.floor(t.length/3)),s=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],n[h++]=c+i+o+a}switch(c=0,a=s,t.length-u){case 2:a=r[(15&(c=t[u+1]))<<2]||s;case 1:t=t[u],n[h]=r[t>>2]+r[(3&t)<<4|c>>4]+a+s}t=n.join("")}e=e.g=t}return e}return e instanceof Ke?e=e.size!==0?e.V(N2):void 0:void 0}return e}function to(e){return Zr(e=e.v,0|e[f],Cr)}let B2,D2;function bt(e,t){return ro(e,t[0],t[1])}function ro(e,t,r,n=0){if(e==null){var s=32;r?(e=[r],s|=128):e=[],t&&(s=-16760833&s|(1023&t)<<14)}else{if(!Array.isArray(e))throw Error("narr");if(s=0|e[f],Ai&&1&s)throw Error("rfarr");if(2048&s&&!(2&s)&&(function(){if(Ai)throw Error("carr");Nt(p2,5)})(),256&s)throw Error("farr");if(64&s)return(s|n)!==s&&j(e,s|n),e;if(r&&(s|=128,r!==e[0]))throw Error("mid");e:{s|=64;var i=(r=e).length;if(i){var o=i-1;const c=r[o];if(c!=null&&typeof c=="object"&&c.constructor===Object){if((o-=t=128&s?0:-1)>=1024)throw Error("pvtlmt");for(var a in c)(i=+a)<o&&(r[i+t]=c[a],delete c[a]);s=-16760833&s|(1023&o)<<14;break e}}if(t){if((a=Math.max(t,i-(128&s?0:-1)))>1024)throw Error("spvt");s=-16760833&s|(1023&a)<<14}}}return j(e,64|s|n),e}function j2(e,t){if(typeof e!="object")return e;if(Array.isArray(e)){var r=0|e[f];return e.length===0&&1&r?void 0:no(e,r,t)}if(e!=null&&e[jt]===Vt)return so(e);if(e instanceof Ke){if(2&(t=e.J))return e;if(!e.size)return;if(r=br(e.V()),e.K)for(e=0;e<r.length;e++){const n=r[e];let s=n[1];s=s==null||typeof s!="object"?void 0:s!=null&&s[jt]===Vt?so(s):Array.isArray(s)?no(s,0|s[f],!!(32&t)):void 0,n[1]=s}return r}return e instanceof Ie?e:void 0}function no(e,t,r){return 2&t||(!r||4096&t||16&t?e=Kt(e,t,!1,r&&!(16&t)):(yr(e,34),4&t&&Object.freeze(e))),e}function Zn(e,t,r){return e=new e.constructor(t),r&&(e.h=gt),e.m=gt,e}function so(e){const t=e.v,r=0|t[f];return ae(e,r)?e:ts(e,t,r)?Zn(e,t):Kt(t,r)}function Kt(e,t,r,n){return n??(n=!!(34&t)),e=Zr(e,t,j2,n),n=32,r&&(n|=2),j(e,t=16769217&t|n),e}function es(e){const t=e.v,r=0|t[f];return ae(e,r)?ts(e,t,r)?Zn(e,t,!0):new e.constructor(Kt(t,r,!1)):e}function qt(e){if(e.h!==gt)return!1;var t=e.v;return yr(t=Kt(t,0|t[f]),2048),e.v=t,e.h=void 0,e.m=void 0,!0}function Yt(e){if(!qt(e)&&ae(e,0|e.v[f]))throw Error()}function _t(e,t){t===void 0&&(t=0|e[f]),32&t&&!(4096&t)&&j(e,4096|t)}function ts(e,t,r){return!!(2&r)||!(!(32&r)||4096&r)&&(j(t,2|r),e.h=gt,!0)}const V2=ce(0),rt={};function L(e,t,r,n,s){if((t=qe(e.v,t,r,s))!==null||n&&e.m!==gt)return t}function qe(e,t,r,n){if(t===-1)return null;const s=t+(r?0:-1),i=e.length-1;let o,a;if(!(i<1+(r?0:-1))){if(s>=i)if(o=e[i],o!=null&&typeof o=="object"&&o.constructor===Object)r=o[t],a=!0;else{if(s!==i)return;r=o}else r=e[s];if(n&&r!=null){if((n=n(r))==null)return n;if(!Object.is(n,r))return a?o[t]=n:e[s]=n,n}return r}}function C(e,t,r,n){Yt(e),V(e=e.v,0|e[f],t,r,n)}function V(e,t,r,n,s){const i=r+(s?0:-1);var o=e.length-1;if(o>=1+(s?0:-1)&&i>=o){const a=e[o];if(a!=null&&typeof a=="object"&&a.constructor===Object)return a[r]=n,t}return i<=o?(e[i]=n,t):(n!==void 0&&(r>=(o=(t??(t=0|e[f]))>>14&1023||536870912)?n!=null&&(e[o+(s?0:-1)]={[r]:n}):e[i]=n),t)}function vt(){return m2===void 0?2:4}function wt(e,t,r,n,s){let i=e.v,o=0|i[f];n=ae(e,o)?1:n,s=!!s||n===3,n===2&&qt(e)&&(i=e.v,o=0|i[f]);let a=(e=rs(i,t))===mt?7:0|e[f],c=ns(a,o);var u=!(4&c);if(u){4&c&&(e=Me(e),a=0,c=At(c,o),o=V(i,o,t,e));let h=0,l=0;for(;h<e.length;h++){const g=r(e[h]);g!=null&&(e[l++]=g)}l<h&&(e.length=l),r=-513&(4|c),c=r&=-1025,c&=-4097}return c!==a&&(j(e,c),2&c&&Object.freeze(e)),io(e,c,i,o,t,n,u,s)}function io(e,t,r,n,s,i,o,a){let c=t;return i===1||i===4&&(2&t||!(16&t)&&32&n)?Et(t)||((t|=!e.length||o&&!(4096&t)||32&n&&!(4096&t||16&t)?2:256)!==c&&j(e,t),Object.freeze(e)):(i===2&&Et(t)&&(e=Me(e),c=0,t=At(t,n),n=V(r,n,s,e)),Et(t)||(a||(t|=16),t!==c&&j(e,t))),2&t||!(4096&t||16&t)||_t(r,n),e}function rs(e,t,r){return e=qe(e,t,r),Array.isArray(e)?e:mt}function ns(e,t){return 2&t&&(e|=2),1|e}function Et(e){return!!(2&e)&&!!(4&e)||!!(256&e)}function oo(e){return jn(e,!0)}function ao(e){e=Me(e);for(let t=0;t<e.length;t++){const r=e[t]=Me(e[t]);Array.isArray(r[1])&&(r[1]=br(r[1]))}return _r(e)}function nt(e,t,r,n){Yt(e),V(e=e.v,0|e[f],t,(n==="0"?Number(r)===0:r===n)?void 0:r)}function Xt(e,t,r){if(2&t)throw Error();const n=Gt(t);let s=rs(e,r,n),i=s===mt?7:0|s[f],o=ns(i,t);return(2&o||Et(o)||16&o)&&(o===i||Et(o)||j(s,o),s=Me(s),i=0,o=At(o,t),V(e,t,r,s,n)),o&=-13,o!==i&&j(s,o),s}function ss(e,t){var r=pa;return os(is(e=e.v),e,void 0,r)===t?t:-1}function is(e){if(Dt)return e[gr]??(e[gr]=new Map);if(gr in e)return e[gr];const t=new Map;return Object.defineProperty(e,gr,{value:t}),t}function co(e,t,r,n,s){const i=is(e),o=os(i,e,t,r,s);return o!==n&&(o&&(t=V(e,t,o,void 0,s)),i.set(r,n)),t}function os(e,t,r,n,s){let i=e.get(n);if(i!=null)return i;i=0;for(let o=0;o<n.length;o++){const a=n[o];qe(t,a,s)!=null&&(i!==0&&(r=V(t,r,i,void 0,s)),i=a)}return e.set(n,i),i}function as(e,t,r){let n=0|e[f];const s=Gt(n),i=qe(e,r,s);let o;if(i!=null&&i[jt]===Vt){if(!ae(i))return qt(i),i.v;o=i.v}else Array.isArray(i)&&(o=i);if(o){const a=0|o[f];2&a&&(o=Kt(o,a))}return o=bt(o,t),o!==i&&V(e,n,r,o,s),o}function ho(e,t,r,n,s){let i=!1;if((n=qe(e,n,s,(o=>{const a=Yn(o,r,!1,t);return i=a!==o&&a!=null,a})))!=null)return i&&!ae(n)&&_t(e,t),n}function E(e,t,r,n){let s=e.v,i=0|s[f];if((t=ho(s,i,t,r,n))==null)return t;if(i=0|s[f],!ae(e,i)){const o=es(t);o!==t&&(qt(e)&&(s=e.v,i=0|s[f]),i=V(s,i,r,t=o,n),_t(s,i))}return t}function uo(e,t,r,n,s,i,o,a){var c=ae(e,r);i=c?1:i,o=!!o||i===3,c=a&&!c,(i===2||c)&&qt(e)&&(r=0|(t=e.v)[f]);var u=(e=rs(t,s))===mt?7:0|e[f],h=ns(u,r);if(a=!(4&h)){var l=e,g=r;const _=!!(2&h);_&&(g|=2);let S=!_,Ot=!0,Pe=0,Ze=0;for(;Pe<l.length;Pe++){const Gr=Yn(l[Pe],n,!1,g);if(Gr instanceof n){if(!_){const ze=ae(Gr);S&&(S=!ze),Ot&&(Ot=ze)}l[Ze++]=Gr}}Ze<Pe&&(l.length=Ze),h|=4,h=Ot?-4097&h:4096|h,h=S?8|h:-9&h}if(h!==u&&(j(e,h),2&h&&Object.freeze(e)),c&&!(8&h||!e.length&&(i===1||i===4&&(2&h||!(16&h)&&32&r)))){for(Et(h)&&(e=Me(e),h=At(h,r),r=V(t,r,s,e)),n=e,c=h,u=0;u<n.length;u++)(l=n[u])!==(h=es(l))&&(n[u]=h);c|=8,j(e,h=c=n.length?4096|c:-4097&c)}return io(e,h,t,r,s,i,a,o)}function Ye(e,t,r){const n=e.v;return uo(e,n,0|n[f],t,r,vt(),!1,!0)}function lo(e){return e==null&&(e=void 0),e}function b(e,t,r,n,s){return C(e,r,n=lo(n),s),n&&!ae(n)&&_t(e.v),e}function Tr(e,t,r,n){e:{var s=n=lo(n);Yt(e);const i=e.v;let o=0|i[f];if(s==null){const a=is(i);if(os(a,i,o,r)!==t)break e;a.set(r,0)}else o=co(i,o,r,t);V(i,o,t,s)}n&&!ae(n)&&_t(e.v)}function At(e,t){return-273&(2&t?2|e:-3&e)}function cs(e,t,r,n){var s=n;Yt(e),e=uo(e,n=e.v,0|n[f],r,t,2,!0),s=s??new r,e.push(s),t=r=e===mt?7:0|e[f],(s=ae(s))?(r&=-9,e.length===1&&(r&=-4097)):r|=4096,r!==t&&j(e,r),s||_t(n)}function ke(e,t,r){return Wt(L(e,t,void 0,r))}function fo(e){return(In?L(e,2,void 0,void 0,Xr):Xr(L(e,2)))??V2}function R(e,t){return L(e,t,void 0,void 0,Ne)??0}function Xe(e,t,r){if(r!=null){if(typeof r!="number"||!Yr(r))throw Bn("int32");r|=0}C(e,t,r)}function y(e,t,r){C(e,t,Er(r))}function he(e,t,r){nt(e,t,Sr(r),"")}function en(e,t,r){{Yt(e);const o=e.v;let a=0|o[f];if(r==null)V(o,a,t);else{var n=e=r===mt?7:0|r[f],s=Et(e),i=s||Object.isFrozen(r);for(s||(e=0),i||(r=Me(r),n=0,e=At(e,a),i=!1),e|=5,e|=(4&e?512&e?512:1024&e?1024:0:void 0)??(In?1024:0),s=0;s<r.length;s++){const c=r[s],u=Ji(c);Object.is(c,u)||(i&&(r=Me(r),n=0,e=At(e,a),i=!1),r[s]=u)}e!==n&&(i&&(r=Me(r),e=At(e,a)),j(r,e)),V(o,a,t,r)}}}function tn(e,t,r){Yt(e),wt(e,t,X,2,!0).push(Ji(r))}var Qt=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 Qt(Mi(e),t);if(Array.isArray(e))return new Qt(new Uint8Array(e),t);if(e.constructor===Uint8Array)return new Qt(e,!1);if(e.constructor===ArrayBuffer)return e=new Uint8Array(e),new Qt(e,!1);if(e.constructor===Ie)return t=Nn(e)||new Uint8Array(0),new Qt(t,!0,e);if(e instanceof Uint8Array)return e=e.constructor===Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Qt(e,!1);throw Error()}function Jt(e,t){let r,n=0,s=0,i=0;const o=e.h;let a=e.g;do r=o[a++],n|=(127&r)<<i,i+=7;while(i<32&&128&r);if(i>32)for(s|=(127&r)>>4,i=3;i<32&&128&r;i+=7)r=o[a++],s|=(127&r)<<i;if(kt(e,a),!(128&r))return t(n>>>0,s>>>0);throw Error()}function us(e){let t=0,r=e.g;const n=r+10,s=e.h;for(;r<n;){const i=s[r++];if(t|=i,(128&i)==0)return kt(e,r),!!(127&t)}throw Error()}function st(e){const t=e.h;let r=e.g,n=t[r++],s=127&n;if(128&n&&(n=t[r++],s|=(127&n)<<7,128&n&&(n=t[r++],s|=(127&n)<<14,128&n&&(n=t[r++],s|=(127&n)<<21,128&n&&(n=t[r++],s|=n<<28,128&n&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++])))))throw Error();return kt(e,r),s}function Qe(e){return st(e)>>>0}function rn(e){var t=e.h;const r=e.g;var n=t[r],s=t[r+1];const i=t[r+2];return t=t[r+3],kt(e,e.g+4),e=2*((s=(n<<0|s<<8|i<<16|t<<24)>>>0)>>31)+1,n=s>>>23&255,s&=8388607,n==255?s?NaN:e*(1/0):n==0?1401298464324817e-60*e*s:e*Math.pow(2,n-150)*(s+8388608)}function G2(e){return st(e)}function kt(e,t){if(e.g=t,t>e.l)throw Error()}function po(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 mo(e,t){if(t==0)return pt();var r=po(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):E2?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?pt():new Ie(r,Ut)}var go=[];function yo(e,t,r,n){if(on.length){const s=on.pop();return s.o(n),s.g.init(e,t,r,n),s}return new H2(e,t,r,n)}function bo(e){e.g.clear(),e.l=-1,e.h=-1,on.length<100&&on.push(e)}function _o(e){var t=e.g;if(t.g==t.l)return!1;e.m=e.g.g;var r=Qe(e.g);if(t=r>>>3,!((r&=7)>=0&&r<=5)||t<1)throw Error();return e.l=t,e.h=r,!0}function nn(e){switch(e.h){case 0:e.h!=0?nn(e):us(e.g);break;case 1:kt(e=e.g,e.g+8);break;case 2:if(e.h!=2)nn(e);else{var t=Qe(e.g);kt(e=e.g,e.g+t)}break;case 5:kt(e=e.g,e.g+4);break;case 3:for(t=e.l;;){if(!_o(e))throw Error();if(e.h==4){if(e.l!=t)throw Error();break}nn(e)}break;default:throw Error()}}function Lr(e,t,r){const n=e.g.l;var s=Qe(e.g);let i=(s=e.g.g+s)-n;if(i<=0&&(e.g.l=s,r(t,e,void 0,void 0,void 0),i=s-e.g.g),i)throw Error();return e.g.g=s,e.g.l=n,t}function ls(e){var t=Qe(e.g),r=po(e=e.g,t);if(e=e.h,t2){var n,s=e;(n=$n)||(n=$n=new TextDecoder("utf-8",{fatal:!0})),t=r+t,s=r===0&&t===s.length?s:s.subarray(r,t);try{var i=n.decode(s)}catch(a){if(Hr===void 0){try{n.decode(new Uint8Array([128]))}catch{}try{n.decode(new Uint8Array([97])),Hr=!0}catch{Hr=!1}}throw!Hr&&($n=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?ft():(a=e[i++],o<194||(192&a)!=128?(i--,ft()):r.push((31&o)<<6|63&a)):o<240?i>=t-1?ft():(a=e[i++],(192&a)!=128||o===224&&a<160||o===237&&a>=160||(192&(n=e[i++]))!=128?(i--,ft()):r.push((15&o)<<12|(63&a)<<6|63&n)):o<=244?i>=t-2?ft():(a=e[i++],(192&a)!=128||a-144+(o<<28)>>30!=0||(192&(n=e[i++]))!=128||(192&(s=e[i++]))!=128?(i--,ft()):(o=(7&o)<<18|(63&a)<<12|(63&n)<<6|63&s,o-=65536,r.push(55296+(o>>10&1023),56320+(1023&o)))):ft(),r.length>=8192&&(c=vi(c,r),r.length=0)}i=vi(c,r)}return i}function vo(e){const t=Qe(e.g);return mo(e.g,t)}function sn(e,t,r){var n=Qe(e.g);for(n=e.g.g+n;e.g.g<n;)r.push(t(e.g))}var H2=class{constructor(e,t,r,n){if(go.length){const s=go.pop();s.init(e,t,r,n),e=s}else e=new class{constructor(s,i,o,a){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.init(s,i,o,a)}init(s,i,o,{Y:a=!1,ea:c=!1}={}){this.Y=a,this.ea=c,s&&(s=hs(s,this.ea),this.h=s.buffer,this.j=s.g,this.m=i||0,this.l=o!==void 0?this.m+o:this.h.length,this.g=this.m)}clear(){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.Y=!1}}(e,t,r,n);this.g=e,this.m=this.g.g,this.h=this.l=-1,this.o(n)}o({ha:e=!1}={}){this.ha=e}},on=[];function wo(e){return e?/^\d+$/.test(e)?(qr(e),new ds(F,N)):null:z2||(z2=new ds(0,0))}var ds=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let z2;function Eo(e){return e?/^-?\d+$/.test(e)?(qr(e),new fs(F,N)):null:W2||(W2=new fs(0,0))}var fs=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let W2;function Zt(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 er(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function an(e,t){if(t>=0)er(e,t);else{for(let r=0;r<9;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function ps(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 tr(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function Se(e,t,r){er(e.g,8*t+r)}function ms(e,t){return Se(e,t,2),t=e.g.end(),tr(e,t),t.push(e.h),t}function gs(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 cn(e,t,r){Se(e,t,2),er(e.g,r.length),tr(e,e.g.end()),tr(e,r)}function hn(e,t,r,n){r!=null&&(t=ms(e,t),n(r,e),gs(e,t))}function Be(){const e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var ys=Be(),Ao=Be(),bs=Be(),_s=Be(),ko=Be(),So=Be(),K2=Be(),un=Be(),Co=Be(),To=Be();function De(e,t,r){var n=e.v;oe&&oe in n&&(n=n[oe])&&delete n[t.g],t.h?t.j(e,t.h,t.g,r,t.l):t.j(e,t.g,r,t.l)}var p=class{constructor(e,t){this.v=ro(e,t,void 0,2048)}toJSON(){return to(this)}j(){var s;var e=Ph,t=this.v,r=e.g,n=oe;if(Dt&&n&&((s=t[n])==null?void 0:s[r])!=null&&Nt(d2,3),t=e.g,Oi&&oe&&Oi===void 0&&(n=(r=this.v)[oe])&&(n=n.da))try{n(r,t,I2)}catch(i){Ei(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[f];return ts(this,e,t)?Zn(this,e,!0):new this.constructor(Kt(e,t,!1))}};p.prototype[jt]=Vt,p.prototype.toString=function(){return this.v.toString()};var rr=class{constructor(e,t,r){this.g=e,this.h=t,e=ys,this.l=!!e&&r===e||!1}};function ln(e,t){return new rr(e,t,ys)}function Lo(e,t,r,n,s){hn(e,r,Oo(t,n),s)}const q2=ln((function(e,t,r,n,s){return e.h===2&&(Lr(e,as(t,n,r),s),!0)}),Lo),Y2=ln((function(e,t,r,n,s){return e.h===2&&(Lr(e,as(t,n,r),s),!0)}),Lo);var dn=Symbol(),fn=Symbol(),vs=Symbol(),Po=Symbol(),Mo=Symbol();let Fo,xo;function St(e,t,r,n){var s=n[e];if(s)return s;(s={}).qa=n,s.T=(function(l){switch(typeof l){case"boolean":return B2||(B2=[0,void 0,!0]);case"number":return l>0?void 0:l===0?D2||(D2=[0,void 0]):[-l,void 0];case"string":return[0,l];case"object":return l}})(n[0]);var i=n[1];let o=1;i&&i.constructor===Object&&(s.ba=i,typeof(i=n[++o])=="function"&&(s.ma=!0,Fo??(Fo=i),xo??(xo=n[o+1]),i=n[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=n[++o]}for(c=1;i!==void 0;){let l;typeof i=="number"&&(c+=i,i=n[++o]);var u=void 0;if(i instanceof rr?l=i:(l=q2,o--),l==null?void 0:l.l){i=n[++o],u=n;var h=o;typeof i=="function"&&(i=i(),u[h]=i),u=i}for(h=c+1,typeof(i=n[++o])=="number"&&i<0&&(h-=i,i=n[++o]);c<h;c++){const g=a[c];u?r(s,c,l,u,g):t(s,c,l,g)}}return n[e]=s}function $o(e){return Array.isArray(e)?e[0]instanceof rr?e:[Y2,e]:[e,void 0]}function Oo(e,t){return e instanceof p?e.v:Array.isArray(e)?bt(e,t):void 0}function ws(e,t,r,n){const s=r.g;e[t]=n?(i,o,a)=>s(i,o,a,n):s}function Es(e,t,r,n,s){const i=r.g;let o,a;e[t]=(c,u,h)=>i(c,u,h,a||(a=St(fn,ws,Es,n).T),o||(o=As(n)),s)}function As(e){let t=e[vs];if(t!=null)return t;const r=St(fn,ws,Es,e);return t=r.ma?(n,s)=>Fo(n,s,r):(n,s)=>{for(;_o(s)&&s.h!=4;){var i=s.l,o=r[i];if(o==null){var a=r.ba;a&&(a=a[i])&&(a=Q2(a))!=null&&(o=r[i]=a)}if(o==null||!o(s,n,i)){if(o=(a=s).m,nn(a),a.ha)var c=void 0;else c=a.g.g-o,a.g.g=o,c=mo(a.g,c);o=void 0,a=n,c&&((o=a[oe]??(a[oe]=new Jn))[i]??(o[i]=[])).push(c)}}return(n=Qr(n))&&(n.da=r.qa[Mo]),!0},e[vs]=t,e[Mo]=X2.bind(e),t}function X2(e,t,r,n){var s=this[fn];const i=this[vs],o=bt(void 0,s.T),a=Qr(e);if(a){var c=!1,u=s.ba;if(u){if(s=(h,l,g)=>{if(g.length!==0)if(u[l])for(const _ of g){h=yo(_);try{c=!0,i(o,h)}finally{bo(h)}}else n==null||n(e,l,g)},t==null)Jr(a,s);else if(a!=null){const h=a[t];h&&s(a,t,h)}if(c){let h=0|e[f];if(2&h&&2048&h&&!(r!=null&&r.Ka))throw Error();const l=Gt(h),g=(_,S)=>{if(qe(e,_,l)!=null){if((r==null?void 0:r.Qa)===1)return;throw Error()}S!=null&&(h=V(e,h,_,S,l)),delete a[_]};t==null?Bi(o,0|o[f],((_,S)=>{g(_,S)})):g(t,qe(o,t,l))}}}}function Q2(e){const t=(e=$o(e))[0].g;if(e=e[1]){const r=As(e),n=St(fn,ws,Es,e).T;return(s,i,o)=>t(s,i,o,n,r)}return t}function pn(e,t,r){e[t]=r.h}function mn(e,t,r,n){let s,i;const o=r.h;e[t]=(a,c,u)=>o(a,c,u,i||(i=St(dn,pn,mn,n).T),s||(s=Ro(n)))}function Ro(e){let t=e[Po];if(!t){const r=St(dn,pn,mn,e);t=(n,s)=>Io(n,s,r),e[Po]=t}return t}function Io(e,t,r){Bi(e,0|e[f],((n,s)=>{if(s!=null){var i=(function(o,a){var c=o[a];if(c)return c;if((c=o.ba)&&(c=c[a])){var u=(c=$o(c))[0].h;if(c=c[1]){const h=Ro(c),l=St(dn,pn,mn,c).T;c=o.ma?xo(l,h):(g,_,S)=>u(g,_,S,l,h)}else c=u;return o[a]=c}})(r,n);i?i(t,s,n):n<500||Nt(Dn,3)}})),(e=Qr(e))&&Jr(e,((n,s,i)=>{for(tr(t,t.g.end()),n=0;n<i.length;n++)tr(t,Nn(i[n])||new Uint8Array(0))}))}const J2=ce(0);function nr(e,t){if(Array.isArray(t)){var r=0|t[f];if(4&r)return t;for(var n=0,s=0;n<t.length;n++){const i=e(t[n]);i!=null&&(t[s++]=i)}return s<n&&(t.length=s),(e=-1537&(5|r))!==r&&j(t,e),2&e&&Object.freeze(t),t}}function ee(e,t,r){return new rr(e,t,r)}function sr(e,t,r){return new rr(e,t,r)}function z(e,t,r){V(e,0|e[f],t,r,Gt(0|e[f]))}var Z2=ln((function(e,t,r,n,s){if(e.h!==2)return!1;if(e=Me(e=Lr(e,bt([void 0,void 0],n),s)),s=Gt(n=0|t[f]),2&n)throw Error();let i=qe(t,r,s);if(i instanceof Ke)(2&i.J)!=0?(i=i.V(),i.push(e),V(t,n,r,i,s)):i.Ma(e);else if(Array.isArray(i)){var o=0|i[f];8192&o||j(i,o|=8192),2&o&&(i=ao(i),V(t,n,r,i,s)),i.push(e)}else V(t,n,r,_r([e]),s);return!0}),(function(e,t,r,n,s){if(t instanceof Ke)t.forEach(((i,o)=>{hn(e,r,bt([o,i],n),s)}));else if(Array.isArray(t)){for(let i=0;i<t.length;i++){const o=t[i];Array.isArray(o)&&hn(e,r,bt(o,n),s)}_r(t)}}));function Uo(e,t,r){(t=Ne(t))!=null&&(Se(e,r,5),e=e.g,Gn(t),ps(e))}function No(e,t,r){if(t=(function(n){if(n==null)return n;const s=typeof n;if(s==="bigint")return String(wr(64,n));if(kr(n)){if(s==="string")return Yi(n);if(s==="number")return qn(n)}})(t),t!=null&&(typeof t=="string"&&Eo(t),t!=null))switch(Se(e,r,0),typeof t){case"number":e=e.g,Ht(t),Zt(e,F,N);break;case"bigint":r=BigInt.asUintN(64,t),r=new fs(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),Zt(e.g,r.h,r.g);break;default:r=Eo(t),Zt(e.g,r.h,r.g)}}function Bo(e,t,r){(t=Wt(t))!=null&&t!=null&&(Se(e,r,0),an(e.g,t))}function Do(e,t,r){(t=Wi(t))!=null&&(Se(e,r,0),e.g.g.push(t?1:0))}function jo(e,t,r){(t=X(t))!=null&&cn(e,r,wi(t))}function Vo(e,t,r,n,s){hn(e,r,Oo(t,n),s)}function Go(e,t,r){(t=t==null||typeof t=="string"||t instanceof Ie?t:void 0)!=null&&cn(e,r,hs(t,!0).buffer)}function Ho(e,t,r){return(e.h===5||e.h===2)&&(t=Xt(t,0|t[f],r),e.h==2?sn(e,rn,t):t.push(rn(e.g)),!0)}var B=ee((function(e,t,r){return e.h===5&&(z(t,r,rn(e.g)),!0)}),Uo,un),eh=sr(Ho,(function(e,t,r){if((t=nr(Ne,t))!=null)for(let o=0;o<t.length;o++){var n=e,s=r,i=t[o];i!=null&&(Se(n,s,5),n=n.g,Gn(i),ps(n))}}),un),ks=sr(Ho,(function(e,t,r){if((t=nr(Ne,t))!=null&&t.length){Se(e,r,2),er(e.g,4*t.length);for(let n=0;n<t.length;n++)r=e.g,Gn(t[n]),ps(r)}}),un),th=ee((function(e,t,r){return e.h===5&&(z(t,r,(e=rn(e.g))===0?void 0:e),!0)}),Uo,un),it=ee((function(e,t,r){return Rn?(e.h!==0?e=!1:(z(t,r,Jt(e.g,Hi)),e=!0),e):e.h===0&&(z(t,r,Jt(e.g,zn)),!0)}),No,So),Ss=ee((function(e,t,r){return Rn?(e.h!==0?t=!1:(z(t,r,(e=Jt(e.g,Hi))===J2?void 0:e),t=!0),t):e.h===0&&(z(t,r,(e=Jt(e.g,zn))===0?void 0:e),!0)}),No,So),rh=ee((function(e,t,r){return Rn?(e.h!==0?e=!1:(z(t,r,Jt(e.g,k2)),e=!0),e):e.h===0&&(z(t,r,Jt(e.g,Hn)),!0)}),(function(e,t,r){if(t=(function(n){if(n==null)return n;var s=typeof n;if(s==="bigint")return String(S2(64,n));if(kr(n)){if(s==="string")return s=zt(Number(n)),yt(s)&&s>=0?n=String(s):((s=n.indexOf("."))!==-1&&(n=n.substring(0,s)),(s=n[0]!=="-"&&((s=n.length)<20||s===20&&n<="18446744073709551615"))||(qr(n),n=vr(F,N))),n;if(s==="number")return(n=zt(n))>=0&&yt(n)||(Ht(n),n=Hn(F,N)),n}})(t),t!=null&&(typeof t=="string"&&wo(t),t!=null))switch(Se(e,r,0),typeof t){case"number":e=e.g,Ht(t),Zt(e,F,N);break;case"bigint":r=BigInt.asUintN(64,t),r=new ds(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),Zt(e.g,r.h,r.g);break;default:r=wo(t),Zt(e.g,r.h,r.g)}}),K2),W=ee((function(e,t,r){return e.h===0&&(z(t,r,st(e.g)),!0)}),Bo,_s),Pr=sr((function(e,t,r){return(e.h===0||e.h===2)&&(t=Xt(t,0|t[f],r),e.h==2?sn(e,st,t):t.push(st(e.g)),!0)}),(function(e,t,r){if((t=nr(Wt,t))!=null&&t.length){r=ms(e,r);for(let n=0;n<t.length;n++)an(e.g,t[n]);gs(e,r)}}),_s),ir=ee((function(e,t,r){return e.h===0&&(z(t,r,(e=st(e.g))===0?void 0:e),!0)}),Bo,_s),I=ee((function(e,t,r){return e.h===0&&(z(t,r,us(e.g)),!0)}),Do,Ao),Ct=ee((function(e,t,r){return e.h===0&&(z(t,r,(e=us(e.g))===!1?void 0:e),!0)}),Do,Ao),Q=sr((function(e,t,r){return e.h===2&&(e=ls(e),Xt(t,0|t[f],r).push(e),!0)}),(function(e,t,r){if((t=nr(X,t))!=null)for(let o=0;o<t.length;o++){var n=e,s=r,i=t[o];i!=null&&cn(n,s,wi(i))}}),bs),ot=ee((function(e,t,r){return e.h===2&&(z(t,r,(e=ls(e))===""?void 0:e),!0)}),jo,bs),T=ee((function(e,t,r){return e.h===2&&(z(t,r,ls(e)),!0)}),jo,bs),K=(function(e,t,r=ys){return new rr(e,t,r)})((function(e,t,r,n,s){return e.h===2&&(n=bt(void 0,n),Xt(t,0|t[f],r).push(n),Lr(e,n,s),!0)}),(function(e,t,r,n,s){if(Array.isArray(t)){for(let i=0;i<t.length;i++)Vo(e,t[i],r,n,s);1&(e=0|t[f])||j(t,1|e)}})),U=ln((function(e,t,r,n,s,i){if(e.h!==2)return!1;let o=0|t[f];return co(t,o,i,r,Gt(o)),Lr(e,t=as(t,n,r),s),!0}),Vo),zo=ee((function(e,t,r){return e.h===2&&(z(t,r,vo(e)),!0)}),Go,Co),nh=sr((function(e,t,r){return(e.h===0||e.h===2)&&(t=Xt(t,0|t[f],r),e.h==2?sn(e,Qe,t):t.push(Qe(e.g)),!0)}),(function(e,t,r){if((t=nr(Ki,t))!=null)for(let o=0;o<t.length;o++){var n=e,s=r,i=t[o];i!=null&&(Se(n,s,0),er(n.g,i))}}),ko),sh=ee((function(e,t,r){return e.h===0&&(z(t,r,(e=Qe(e.g))===0?void 0:e),!0)}),(function(e,t,r){(t=Ki(t))!=null&&t!=null&&(Se(e,r,0),er(e.g,t))}),ko),ue=ee((function(e,t,r){return e.h===0&&(z(t,r,st(e.g)),!0)}),(function(e,t,r){(t=Wt(t))!=null&&(t=parseInt(t,10),Se(e,r,0),an(e.g,t))}),To);class ih{constructor(t,r){var n=le;this.g=t,this.h=r,this.m=E,this.j=b,this.defaultValue=void 0,this.l=n.Oa!=null?Di:void 0}register(){zr(this)}}function je(e,t){return new ih(e,t)}function at(e,t){return(r,n)=>{{const i={ea:!0};n&&Object.assign(i,n),r=yo(r,void 0,void 0,i);try{const o=new e,a=o.v;As(t)(a,r);var s=o}finally{bo(r)}}return s}}function gn(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}}}};Io(this.v,t,St(dn,pn,mn,e)),tr(t,t.g.end());const r=new Uint8Array(t.h),n=t.l,s=n.length;let i=0;for(let o=0;o<s;o++){const a=n[o];r.set(a,i),i+=a.length}return t.l=[r],r}}var Wo=class extends p{constructor(e){super(e)}},Ko=[0,ot,ee((function(e,t,r){return e.h===2&&(z(t,r,(e=vo(e))===pt()?void 0:e),!0)}),(function(e,t,r){if(t!=null){if(t instanceof p){const n=t.Ra;return void(n?(t=n(t),t!=null&&cn(e,r,hs(t,!0).buffer)):Nt(Dn,3))}if(Array.isArray(t))return void Nt(Dn,3)}Go(e,t,r)}),Co)];let Cs,qo=globalThis.trustedTypes;function Yo(e){var t;return Cs===void 0&&(Cs=(function(){let r=null;if(!qo)return r;try{const n=s=>s;r=qo.createPolicy("goog#html",{createHTML:n,createScript:n,createScriptURL:n})}catch{}return r})()),e=(t=Cs)?t.createScriptURL(e):e,new class{constructor(r){this.g=r}toString(){return this.g+""}}(e)}function oh(e,...t){if(t.length===0)return Yo(e[0]);let r=e[0];for(let n=0;n<t.length;n++)r+=encodeURIComponent(t[n])+e[n+1];return Yo(r)}var Xo=[0,W,ue,I,-1,Pr,ue,-1,I],ah=class extends p{constructor(e){super(e)}},Qo=[0,I,T,I,ue,-1,sr((function(e,t,r){return(e.h===0||e.h===2)&&(t=Xt(t,0|t[f],r),e.h==2?sn(e,G2,t):t.push(st(e.g)),!0)}),(function(e,t,r){if((t=nr(Wt,t))!=null&&t.length){r=ms(e,r);for(let n=0;n<t.length;n++)an(e.g,t[n]);gs(e,r)}}),To),T,-1,[0,I,-1],ue,I,-1],Jo=[0,3,I,-1,2,[0,W],[0,ue,I],[0,T,-1],[0]],Zo=[0,T,-2],ea=class extends p{constructor(e){super(e)}},ta=[0],ra=[0,W,I,1,I,-4],le=class extends p{constructor(e){super(e,2)}},G={};G[336783863]=[0,T,I,-1,W,[0,[1,2,3,4,5,6,7,8,9],U,ta,U,Qo,U,Zo,U,ra,U,Xo,U,[0,T,-2],U,[0,T,ue],U,Jo,U,[0,ue,-1,I]],[0,T],I,[0,[1,3],[2,4],U,[0,Pr],-1,U,[0,Q],-1,K,[0,T,-1]],T];var na=[0,Ss,-1,Ct,-3,Ss,Pr,ot,ir,Ss,-1,Ct,ir,Ct,-2,ot];function P(e,t){tn(e,3,t)}function v(e,t){tn(e,4,t)}var re=class extends p{constructor(e){super(e,500)}o(e){return b(this,0,7,e)}},Mr=[-1,{}],sa=[0,T,1,Mr],ia=[0,T,Q,Mr];function Ce(e,t){cs(e,1,re,t)}function x(e,t){tn(e,10,t)}function A(e,t){tn(e,15,t)}var de=class extends p{constructor(e){super(e,500)}o(e){return b(this,0,1001,e)}},oa=[-500,K,[-500,ot,-1,Q,-3,[-2,G,I],K,Ko,ir,-1,sa,ia,K,[0,ot,Ct],ot,na,ir,Q,987,Q],4,K,[-500,T,-1,[-1,{}],998,T],K,[-500,T,Q,-1,[-2,{},I],997,Q,-1],ir,K,[-500,T,Q,Mr,998,Q],Q,ir,sa,ia,K,[0,ot,-1,Mr],Q,-2,na,ot,-1,Ct,[0,Ct,sh],978,Mr,K,Ko];de.prototype.g=gn(oa);var ch=at(de,oa),hh=class extends p{constructor(e){super(e)}},aa=class extends p{constructor(e){super(e)}g(){return Ye(this,hh,1)}},ca=[0,K,[0,W,B,T,-1]],yn=at(aa,ca),uh=class extends p{constructor(e){super(e)}},lh=class extends p{constructor(e){super(e)}},Ts=class extends p{constructor(e){super(e)}l(){return E(this,uh,2)}g(){return Ye(this,lh,5)}},ha=at(class extends p{constructor(e){super(e)}},[0,Q,Pr,ks,[0,ue,[0,W,-3],[0,B,-3],[0,W,-1,[0,K,[0,W,-2]]],K,[0,B,-1,T,B]],T,-1,it,K,[0,W,B],Q,it]),ua=class extends p{constructor(e){super(e)}},or=at(class extends p{constructor(e){super(e)}},[0,K,[0,B,-4]]),la=class extends p{constructor(e){super(e)}},Fr=at(class extends p{constructor(e){super(e)}},[0,K,[0,B,-4]]),dh=class extends p{constructor(e){super(e)}},fh=[0,W,-1,ks,ue],da=class extends p{constructor(e){super(e)}};da.prototype.g=gn([0,B,-4,it]);var ph=class extends p{constructor(e){super(e)}},mh=at(class extends p{constructor(e){super(e)}},[0,K,[0,1,W,T,ca],it]),fa=class extends p{constructor(e){super(e)}},gh=class extends p{constructor(e){super(e)}na(){const e=L(this,1,void 0,void 0,oo);return e??pt()}},yh=class extends p{constructor(e){super(e)}},pa=[1,2],bh=at(class extends p{constructor(e){super(e)}},[0,K,[0,pa,U,[0,ks],U,[0,zo],W,T],it]),Ls=class extends p{constructor(e){super(e)}},ma=[0,T,W,B,Q,-1],ga=class extends p{constructor(e){super(e)}},_h=[0,I,-1],ya=class extends p{constructor(e){super(e)}},bn=[1,2,3,4,5,6],_n=class extends p{constructor(e){super(e)}g(){return L(this,1,void 0,void 0,oo)!=null}l(){return X(L(this,2))!=null}},$=class extends p{constructor(e){super(e)}g(){return Wi(L(this,2))??!1}},ba=[0,zo,T,[0,W,it,-1],[0,rh,it]],D=[0,ba,I,[0,bn,U,ra,U,Qo,U,Xo,U,ta,U,Zo,U,Jo],ue],vn=class extends p{constructor(e){super(e)}},Ps=[0,D,B,-1,W],vh=je(502141897,vn);G[502141897]=Ps;var wh=at(class extends p{constructor(e){super(e)}},[0,[0,ue,-1,eh,nh],fh]),_a=class extends p{constructor(e){super(e)}},va=class extends p{constructor(e){super(e)}},Ms=[0,D,B,[0,D],I],Eh=je(508968150,va);G[508968150]=[0,D,Ps,Ms,B,[0,[0,ba]]],G[508968149]=Ms;var ar=class extends p{constructor(e){super(e)}l(){return E(this,Ls,2)}g(){C(this,2)}},wa=[0,D,ma];G[478825465]=wa;var Ah=class extends p{constructor(e){super(e)}},Ea=class extends p{constructor(e){super(e)}},Fs=class extends p{constructor(e){super(e)}},xs=class extends p{constructor(e){super(e)}},Aa=class extends p{constructor(e){super(e)}},ka=[0,D,[0,D],wa,-1],Sa=[0,D,B,W],$s=[0,D,B],Ca=[0,D,Sa,$s,B],kh=je(479097054,Aa);G[479097054]=[0,D,Ca,ka],G[463370452]=ka,G[464864288]=Sa;var Sh=je(462713202,xs);G[462713202]=Ca,G[474472470]=$s;var Ch=class extends p{constructor(e){super(e)}},Ta=class extends p{constructor(e){super(e)}},La=class extends p{constructor(e){super(e)}},Pa=class extends p{constructor(e){super(e)}},Os=[0,D,B,-1,W],Rs=[0,D,B,I];Pa.prototype.g=gn([0,D,$s,[0,D],Ps,Ms,Os,Rs]);var Ma=class extends p{constructor(e){super(e)}},Th=je(456383383,Ma);G[456383383]=[0,D,ma];var Fa=class extends p{constructor(e){super(e)}},Lh=je(476348187,Fa);G[476348187]=[0,D,_h];var xa=class extends p{constructor(e){super(e)}},$a=class extends p{constructor(e){super(e)}},Oa=[0,ue,-1],Ph=je(458105876,class extends p{constructor(e){super(e)}g(){let e;var t=this.v;const r=0|t[f];return e=ae(this,r),t=(function(n,s,i,o){var a=$a;!o&&qt(n)&&(i=0|(s=n.v)[f]);var c=qe(s,2);if(n=!1,c==null){if(o)return eo();c=[]}else if(c.constructor===Ke){if(!(2&c.J)||o)return c;c=c.V()}else Array.isArray(c)?n=!!(2&(0|c[f])):c=[];if(o){if(!c.length)return eo();n||(n=!0,br(c))}else n&&(n=!1,_r(c),c=ao(c));return!n&&32&i&&yr(c,32),i=V(s,i,2,o=new Ke(c,a,P2,void 0)),n||_t(s,i),o})(this,t,r,e),!e&&$a&&(t.ra=!0),t}});G[458105876]=[0,Oa,Z2,[!0,it,[0,T,-1,Q]],[0,Pr,I,ue]];var Is=class extends p{constructor(e){super(e)}},Ra=je(458105758,Is);G[458105758]=[0,D,T,Oa];var Us=class extends p{constructor(e){super(e)}},Ia=[0,th,-1,Ct],Mh=class extends p{constructor(e){super(e)}},Ua=class extends p{constructor(e){super(e)}},Ns=[1,2];Ua.prototype.g=gn([0,Ns,U,Ia,U,[0,K,Ia]]);var Na=class extends p{constructor(e){super(e)}},Fh=je(443442058,Na);G[443442058]=[0,D,T,W,B,Q,-1,I,B],G[514774813]=Os;var Ba=class extends p{constructor(e){super(e)}},xh=je(516587230,Ba);function Bs(e,t){return t=t?t.clone():new Ls,e.displayNamesLocale!==void 0?C(t,1,Sr(e.displayNamesLocale)):e.displayNamesLocale===void 0&&C(t,1),e.maxResults!==void 0?Xe(t,2,e.maxResults):"maxResults"in e&&C(t,2),e.scoreThreshold!==void 0?y(t,3,e.scoreThreshold):"scoreThreshold"in e&&C(t,3),e.categoryAllowlist!==void 0?en(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&C(t,4),e.categoryDenylist!==void 0?en(t,5,e.categoryDenylist):"categoryDenylist"in e&&C(t,5),t}function Da(e){const t=Number(e);return Number.isSafeInteger(t)?t:String(e)}function Ds(e,t=-1,r=""){return{categories:e.map((n=>({index:ke(n,1)??0??-1,score:R(n,2)??0,categoryName:X(L(n,3))??""??"",displayName:X(L(n,4))??""??""}))),headIndex:t,headName:r}}function $h(e){const t={classifications:Ye(e,ph,1).map((r=>{var n;return Ds(((n=E(r,aa,4))==null?void 0:n.g())??[],ke(r,2)??0,X(L(r,3))??"")}))};return(function(r){return L2(In?L(r,2,void 0,void 0,Xr):L(r,2))})(e)!=null&&(t.timestampMs=Da(fo(e))),t}function ja(e){var o,a;var t=wt(e,3,Ne,vt()),r=wt(e,2,Wt,vt()),n=wt(e,1,X,vt()),s=wt(e,9,X,vt());const i={categories:[],keypoints:[]};for(let c=0;c<t.length;c++)i.categories.push({score:t[c],index:r[c]??-1,categoryName:n[c]??"",displayName:s[c]??""});if((t=(o=E(e,Ts,4))==null?void 0:o.l())&&(i.boundingBox={originX:ke(t,1,rt)??0,originY:ke(t,2,rt)??0,width:ke(t,3,rt)??0,height:ke(t,4,rt)??0,angle:0}),(a=E(e,Ts,4))==null?void 0:a.g().length)for(const c of E(e,Ts,4).g())i.keypoints.push({x:L(c,1,void 0,rt,Ne)??0,y:L(c,2,void 0,rt,Ne)??0,score:L(c,4,void 0,rt,Ne)??0,label:X(L(c,3,void 0,rt))??""});return i}function wn(e){const t=[];for(const r of Ye(e,la,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 xr(e){const t=[];for(const r of Ye(e,ua,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 Va(e){return Array.from(e,(t=>t>127?t-256:t))}function Ga(e,t){if(e.length!==t.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${e.length} vs. ${t.length}).`);let r=0,n=0,s=0;for(let i=0;i<e.length;i++)r+=e[i]*t[i],n+=e[i]*e[i],s+=t[i]*t[i];if(n<=0||s<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return r/Math.sqrt(n*s)}let En;G[516587230]=[0,D,Os,Rs,B],G[518928384]=Rs;const Oh=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 Ha(){if(En===void 0)try{await WebAssembly.instantiate(Oh),En=!0}catch{En=!1}return En}async function $r(e,t=oh``){const r=await Ha()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var Tt=class{};function za(){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 Wa(e){if(typeof importScripts!="function"){const t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise(((r,n)=>{t.addEventListener("load",(()=>{r()}),!1),t.addEventListener("error",(s=>{n(s)}),!1),document.body.appendChild(t)}))}try{importScripts(e.toString())}catch(t){if(!(t instanceof TypeError))throw t;await self.import(e.toString())}}function Ka(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 m(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 qa(e,t,r){if(!e.i.canvas)throw Error("No OpenGL canvas configured.");if(r?e.i._bindTextureToStream(r):e.i._bindTextureToCanvas(),!(r=e.i.canvas.getContext("webgl2")||e.i.canvas.getContext("webgl")))throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");e.i.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!0),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t),e.i.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1);const[n,s]=Ka(t);return!e.l||n===e.i.canvas.width&&s===e.i.canvas.height||(e.i.canvas.width=n,e.i.canvas.height=s),[n,s]}function Ya(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const n=new Uint32Array(t.length);for(let s=0;s<t.length;s++)n[s]=e.i.stringToNewUTF8(t[s]);t=e.i._malloc(4*n.length),e.i.HEAPU32.set(n,t>>2),r(t);for(const s of n)e.i._free(s);e.i._free(t)}function Ve(e,t,r){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=r}function ct(e,t,r){let n=[];e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=(s,i,o)=>{i?(r(n,o),n=[]):n.push(s)}}Tt.forVisionTasks=function(e){return $r("vision",e)},Tt.forTextTasks=function(e){return $r("text",e)},Tt.forGenAiExperimentalTasks=function(e){return $r("genai_experimental",e)},Tt.forGenAiTasks=function(e){return $r("genai",e)},Tt.forAudioTasks=function(e){return $r("audio",e)},Tt.isSimdSupported=function(){return Ha()};async function Rh(e,t,r,n){return e=await(async(s,i,o,a,c)=>{if(i&&await Wa(i),!self.ModuleFactory||o&&(await Wa(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 s(c,a)})(e,r.wasmLoaderPath,r.assetLoaderPath,t,{locateFile:s=>s.endsWith(".wasm")?r.wasmBinaryPath.toString():r.assetBinaryPath&&s.endsWith(".data")?r.assetBinaryPath.toString():s}),await e.o(n),e}function js(e,t){const r=E(e.baseOptions,_n,1)||new _n;typeof t=="string"?(C(r,2,Sr(t)),C(r,1)):t instanceof Uint8Array&&(C(r,1,jn(t,!1)),C(r,2)),b(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 d(e,t){e.C=Math.max(e.C,t)}function An(e,t){e.B=new re,he(e.B,2,"PassThroughCalculator"),P(e.B,"free_memory"),v(e.B,"free_memory_unused_out"),x(t,"free_memory"),Ce(t,e.B)}function cr(e,t){P(e.B,t),v(e.B,t+"_unused_out")}function kn(e){e.g.addBoolToStream(!0,"free_memory",e.C)}var Vs=class{constructor(e){this.g=e,this.H=[],this.C=0,this.g.setAutoRenderToScreen(!1)}l(e,t=!0){var r,n,s,i,o,a;if(t){const c=e.baseOptions||{};if((r=e.baseOptions)!=null&&r.modelAssetBuffer&&((n=e.baseOptions)!=null&&n.modelAssetPath))throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!((s=E(this.baseOptions,_n,1))!=null&&s.g()||(i=E(this.baseOptions,_n,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,ya,3);if(!l){var g=l=new ya,_=new ea;Tr(g,4,bn,_)}"delegate"in h&&(h.delegate==="GPU"?(h=l,g=new ah,Tr(h,2,bn,g)):(h=l,g=new ea,Tr(h,4,bn,g))),b(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),js(this,"/model.dat"),this.m(),this.L()}));if(c.modelAssetBuffer instanceof Uint8Array)js(this,c.modelAssetBuffer);else if(c.modelAssetBuffer)return(async function(u){const h=[];for(var l=0;;){const{done:g,value:_}=await u.read();if(g)break;h.push(_),l+=_.length}if(h.length===0)return new Uint8Array(0);if(h.length===1)return h[0];u=new Uint8Array(l),l=0;for(const g of h)u.set(g,l),l+=g.length;return u})(c.modelAssetBuffer).then((u=>{js(this,u),this.m(),this.L()}))}return this.m(),this.L(),Promise.resolve()}L(){}ca(){let e;if(this.g.ca((t=>{e=ch(t)})),!e)throw Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.g.attachErrorListener(((r,n)=>{this.H.push(Error(n))})),this.g.Ja(),this.g.setGraph(e,t),this.B=void 0,Xa(this)}finishProcessing(){this.g.finishProcessing(),Xa(this)}close(){this.B=void 0,this.g.closeGraph()}};function ht(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}Vs.prototype.close=Vs.prototype.close;class Ih{constructor(t,r,n,s){this.g=t,this.h=r,this.m=n,this.l=s}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}}function Qa(e,t,r){const n=e.g;if(r=ht(n.createShader(r),"Failed to create WebGL shader"),n.shaderSource(r,t),n.compileShader(r),!n.getShaderParameter(r,n.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${n.getShaderInfoLog(r)}`);return n.attachShader(e.h,r),r}function Ja(e,t){const r=e.g,n=ht(r.createVertexArray(),"Failed to create vertex array");r.bindVertexArray(n);const s=ht(r.createBuffer(),"Failed to create buffer");r.bindBuffer(r.ARRAY_BUFFER,s),r.enableVertexAttribArray(e.O),r.vertexAttribPointer(e.O,2,r.FLOAT,!1,0,0),r.bufferData(r.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),r.STATIC_DRAW);const i=ht(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 Ih(r,n,s,i)}function Gs(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function Uh(e,t,r,n){return Gs(e,t),e.h||(e.m(),e.D()),r?(e.u||(e.u=Ja(e,!0)),r=e.u):(e.A||(e.A=Ja(e,!1)),r=e.A),t.useProgram(e.h),r.bind(),e.l(),e=n(),r.g.bindVertexArray(null),e}function Za(e,t,r){return Gs(e,t),e=ht(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 ec(e,t,r){Gs(e,t),e.B||(e.B=ht(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 Nh(e){var t;(t=e.g)==null||t.bindFramebuffer(e.g.FRAMEBUFFER,null)}var tc=class{H(){return`
1
+ (function(w,tt){typeof exports=="object"&&typeof module<"u"?tt(exports):typeof define=="function"&&define.amd?define(["exports"],tt):(w=typeof globalThis<"u"?globalThis:w||self,tt(w.SimFaceSDK={}))})(this,(function(w){"use strict";var Yc;class tt{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){const r=await t.json();throw new Error(r.error||"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){const i=await n.json();throw new Error(i.error||"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){const i=await n.json();throw new Error(i.error||"Verification failed")}return n.json()}}const Qc=180,hi=5e3,sr="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",ui=`M 0 0 H 100 V 100 H 0 Z ${sr}`;function Jc(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(hi-(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 Zc(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."}var kt=typeof self<"u"?self:{};function nr(e,t){e:{for(var r=["CLOSURE_FLAGS"],s=kt,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 rt(){throw Error("Invalid UTF8")}function li(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}let xr,ws;const eh=typeof TextDecoder<"u";let th;const rh=typeof TextEncoder<"u";function di(e){if(rh)e=(th||(th=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 fi(e){kt.setTimeout((()=>{throw e}),0)}var Es,sh=nr(610401301,!1),pi=nr(748402147,!0),As=nr(824648567,!0),ks=nr(824656860,nr(1,!0));function mi(){var e=kt.navigator;return e&&(e=e.userAgent)?e:""}const gi=kt.navigator;function Or(e){return Or[" "](e),e}Es=gi&&gi.userAgentData||null,Or[" "]=function(){};const yi={};let ir=null;function nh(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=ir[h];if(l!=null)return l;if(!/^[\s\xa0]*$/.test(h))throw Error("Unknown base64 encoding at char: "+h)}return u}bi();let c=0;for(;;){const u=a(-1),h=a(0),l=a(64),f=a(64);if(f===64&&u===-1)break;o(u<<2|h>>4),l!=64&&(o(h<<4&240|l>>2),f!=64&&o(l<<6&192|f))}})(e,(function(i){s[n++]=i})),n!==r?s.subarray(0,n):s}function bi(){if(!ir){ir={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){const s=e.concat(t[r].split(""));yi[r]=s;for(let n=0;n<s.length;n++){const i=s[n];ir[i]===void 0&&(ir[i]=n)}}}}var ih=typeof Uint8Array<"u",vi=!(!(sh&&Es&&Es.brands.length>0)&&(mi().indexOf("Trident")!=-1||mi().indexOf("MSIE")!=-1))&&typeof btoa=="function";const _i=/[-_.]/g,oh={"-":"+",_:"/",".":"="};function ah(e){return oh[e]||""}function wi(e){if(!vi)return nh(e);e=_i.test(e)?e.replace(_i,ah):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 Ss(e){return ih&&e!=null&&e instanceof Uint8Array}var St={};function st(){return ch||(ch=new Pe(null,St))}function Cs(e){Ei(St);var t=e.g;return(t=t==null||Ss(t)?t:typeof t=="string"?wi(t):null)==null?t:e.g=t}var Pe=class{h(){return new Uint8Array(Cs(this)||0)}constructor(t,r){if(Ei(r),this.g=t,t!=null&&t.length===0)throw Error("ByteString should be constructed with non-empty values")}};let ch,hh;function Ei(e){if(e!==St)throw Error("illegal external caller")}function Ai(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function Ts(e){return Ai(e=Error(e),"warning"),e}function Ct(e,t){if(e!=null){var r=hh??(hh={}),s=r[e]||0;s>=t||(r[e]=s+1,Ai(e=Error(),"incident"),fi(e))}}function Tt(){return typeof BigInt=="function"}var Pt=typeof Symbol=="function"&&typeof Symbol()=="symbol";function Me(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 uh=Me("jas",void 0,!0),ki=Me(void 0,"0di"),or=Me(void 0,"1oa"),ie=Me(void 0,Symbol()),lh=Me(void 0,"0ub"),dh=Me(void 0,"0ubs"),Ps=Me(void 0,"0ubsb"),fh=Me(void 0,"0actk"),Mt=Me("m_m","Pa",!0),Si=Me();const Ci={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},Ti=Object.defineProperties,p=Pt?uh:"Ga";var nt;const Pi=[];function ar(e,t){Pt||p in e||Ti(e,Ci),e[p]|=t}function j(e,t){Pt||p in e||Ti(e,Ci),e[p]=t}function cr(e){return ar(e,34),e}function hr(e){return ar(e,8192),e}j(Pi,7),nt=Object.freeze(Pi);var Lt={};function oe(e,t){return t===void 0?e.h!==it&&!!(2&(0|e.v[p])):!!(2&t)&&e.h!==it}const it={};function Ms(e,t){if(e!=null){if(typeof e=="string")e=e?new Pe(e,St):st();else if(e.constructor!==Pe)if(Ss(e))e=e.length?new Pe(new Uint8Array(e),St):st();else{if(!t)throw Error();e=void 0}}return e}class Mi{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 ph=Object.freeze({});function Li(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 Fi={};function Ft(e){return 128&e?Fi:void 0}function $r(e){return e.Na=!0,e}var mh=$r((e=>typeof e=="number")),xi=$r((e=>typeof e=="string")),gh=$r((e=>typeof e=="boolean")),Rr=typeof kt.BigInt=="function"&&typeof kt.BigInt(0)=="bigint";function ae(e){var t=e;if(xi(t)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(t))throw Error(String(t))}else if(mh(t)&&!Number.isSafeInteger(t))throw Error(String(t));return Rr?BigInt(e):e=gh(e)?e?"1":"0":xi(e)?e.trim()||"0":String(e)}var Ls=$r((e=>Rr?e>=bh&&e<=_h:e[0]==="-"?Oi(e,yh):Oi(e,vh)));const yh=Number.MIN_SAFE_INTEGER.toString(),bh=Rr?BigInt(Number.MIN_SAFE_INTEGER):void 0,vh=Number.MAX_SAFE_INTEGER.toString(),_h=Rr?BigInt(Number.MAX_SAFE_INTEGER):void 0;function Oi(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 wh=typeof Uint8Array.prototype.slice=="function";let Eh,F=0,N=0;function $i(e){const t=e>>>0;F=t,N=(e-t)/4294967296>>>0}function xt(e){if(e<0){$i(-e);const[t,r]=Rs(F,N);F=t>>>0,N=r>>>0}else $i(e)}function Fs(e){const t=Eh||(Eh=new DataView(new ArrayBuffer(8)));t.setFloat32(0,+e,!0),N=0,F=t.getUint32(0,!0)}function xs(e,t){const r=4294967296*t+(e>>>0);return Number.isSafeInteger(r)?r:ur(e,t)}function Ah(e,t){return ae(Tt()?BigInt.asUintN(64,(BigInt(t>>>0)<<BigInt(32))+BigInt(e>>>0)):ur(e,t))}function Os(e,t){const r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=xs(e,t))=="number"?r?-e:e:r?"-"+e:e}function Ri(e,t){return Tt()?ae(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(t))<<BigInt(32))+BigInt.asUintN(32,BigInt(e)))):ae($s(e,t))}function ur(e,t){if(e>>>=0,(t>>>=0)<=2097151)var r=""+(4294967296*t+e);else Tt()?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+Ii(r)+Ii(e));return r}function Ii(e){return e=String(e),"0000000".slice(e.length)+e}function $s(e,t){if(2147483648&t)if(Tt())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{const[r,s]=Rs(e,t);e="-"+ur(r,s)}else e=ur(e,t);return e}function Ir(e){if(e.length<16)xt(Number(e));else if(Tt())e=BigInt(e),F=Number(e&BigInt(4294967295))>>>0,N=Number(e>>BigInt(32)&BigInt(4294967295));else{const t=+(e[0]==="-");N=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));N*=1e6,F=1e6*F+i,F>=4294967296&&(N+=Math.trunc(F/4294967296),N>>>=0,F>>>=0)}if(t){const[s,n]=Rs(F,N);F=s,N=n}}}function Rs(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}function ke(e){return Array.prototype.slice.call(e)}const lr=typeof BigInt=="function"?BigInt.asIntN:void 0,kh=typeof BigInt=="function"?BigInt.asUintN:void 0,ot=Number.isSafeInteger,Ur=Number.isFinite,Ot=Math.trunc,Sh=ae(0);function dr(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 Le(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function fr(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 Ui(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}const Ch=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function pr(e){switch(typeof e){case"bigint":return!0;case"number":return Ur(e);case"string":return Ch.test(e);default:return!1}}function $t(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return Ur(e)?0|e:void 0}function Ni(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return Ur(e)?e>>>0:void 0}function Bi(e){const t=e.length;return(e[0]==="-"?t<20||t===20&&e<="-9223372036854775808":t<19||t===19&&e<="9223372036854775807")?e:(Ir(e),$s(F,N))}function Is(e){return e=Ot(e),ot(e)||(xt(e),e=Os(F,N)),e}function Di(e){var t=Ot(Number(e));return ot(t)?String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Bi(e))}function ji(e){var t=Ot(Number(e));return ot(t)?ae(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Tt()?ae(lr(64,BigInt(e))):ae(Bi(e)))}function Vi(e){return ot(e)?e=ae(Is(e)):(e=Ot(e),ot(e)?e=String(e):(xt(e),e=$s(F,N)),e=ae(e)),e}function Th(e){return e==null?e:typeof e=="bigint"?(Ls(e)?e=Number(e):(e=lr(64,e),e=Ls(e)?Number(e):String(e)),e):pr(e)?typeof e=="number"?Is(e):Di(e):void 0}function Nr(e){const t=typeof e;return e==null?e:t==="bigint"?ae(lr(64,e)):pr(e)?t==="string"?ji(e):Vi(e):void 0}function Gi(e){if(typeof e!="string")throw Error();return e}function mr(e){if(e!=null&&typeof e!="string")throw Error();return e}function Y(e){return e==null||typeof e=="string"?e:void 0}function Us(e,t,r,s){return e!=null&&e[Mt]===Lt?e:Array.isArray(e)?((s=(r=0|e[p])|32&s|2&s)!==r&&j(e,s),new t(e)):(r?2&s?((e=t[ki])||(cr((e=new t).v),e=t[ki]=e),t=e):t=new t:t=void 0,t)}function Ph(e,t,r){if(t)e:{if(!pr(t=e))throw Ts("int64");switch(typeof t){case"string":t=ji(t);break e;case"bigint":t=ae(lr(64,t));break e;default:t=Vi(t)}}else t=Nr(e);return(e=t)==null?r?Sh:void 0:e}const Mh={};let Lh=(function(){try{return Or(new class extends Map{constructor(){super()}}),!1}catch{return!0}})();class Ns{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 Fh=Lh?(Object.setPrototypeOf(Ns.prototype,Map.prototype),Object.defineProperties(Ns.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),Ns):class extends Map{constructor(){super()}};function Hi(e){return e}function Bs(e){if(2&e.J)throw Error("Cannot mutate an immutable Map")}var Ue=class extends Fh{constructor(e,t,r=Hi,s=Hi){super(),this.J=0|e[p],this.K=t,this.S=r,this.fa=this.K?xh: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 hr(Array.from(super.entries(),e))}clear(){Bs(this),super.clear()}delete(e){return Bs(this),super.delete(this.S(e,!0,!1))}entries(){if(this.K){var e=super.keys();e=new Mi(e,Oh,this)}else e=super.entries();return e}values(){if(this.K){var e=super.keys();e=new Mi(e,Ue.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 Bs(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 xh(e,t,r,s,n,i){return e=Us(e,s,r,i),n&&(e=Vs(e)),e}function Oh(e){return[e,this.get(e)]}let $h;function zi(){return $h||($h=new Ue(cr([]),void 0,void 0,void 0,Mh))}function Br(e){return ie?e[ie]:void 0}function Dr(e,t){for(const r in e)!isNaN(r)&&t(e,+r,e[r])}Ue.prototype.toJSON=void 0;var Ds=class{};const Rh={Ka:!0};function Ih(e,t){t<100||Ct(dh,1)}function jr(e,t,r,s){const n=s!==void 0;s=!!s;var i,o=ie;!n&&Pt&&o&&(i=e[o])&&Dr(i,Ih),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 f=0;f<a;f++){let v=e[f];if(v!=null&&(v=r(v,s))!=null)if(h&&f>=i){const S=f-l;(t??(t={}))[S]=v}else o[f]=v}if(c)for(let v in c){if((a=c[v])==null||(a=r(a,s))==null)continue;let S;f=+v,h&&!Number.isNaN(f)&&(S=f+l)<i?o[S]=a:(t??(t={}))[v]=a}return t&&(u?o.push(t):o[i]=t),n&&ie&&(e=Br(e))&&e instanceof Ds&&(o[ie]=(function(v){const S=new Ds;return Dr(v,((ne,te,Ge)=>{S[te]=ke(Ge)})),S.da=v.da,S})(e)),o}function Uh(e){return e[0]=gr(e[0]),e[1]=gr(e[1]),e}function gr(e){switch(typeof e){case"number":return Number.isFinite(e)?e:""+e;case"bigint":return Ls(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:jr(e,t,gr)}if(e!=null&&e[Mt]===Lt)return Wi(e);if(e instanceof Pe){if((t=e.g)==null)e="";else if(typeof t=="string")e=t;else{if(vi){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),bi(),r=yi[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 Ue?e=e.size!==0?e.V(Uh):void 0:void 0}return e}function Wi(e){return jr(e=e.v,0|e[p],gr)}let Nh,Bh;function at(e,t){return Ki(e,t[0],t[1])}function Ki(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],pi&&1&n)throw Error("rfarr");if(2048&n&&!(2&n)&&(function(){if(pi)throw Error("carr");Ct(fh,5)})(),256&n)throw Error("farr");if(64&n)return(n|s)!==n&&j(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 j(e,64|n|s),e}function Dh(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:qi(e,r,t)}if(e!=null&&e[Mt]===Lt)return Xi(e);if(e instanceof Ue){if(2&(t=e.J))return e;if(!e.size)return;if(r=cr(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[Mt]===Lt?Xi(n):Array.isArray(n)?qi(n,0|n[p],!!(32&t)):void 0,s[1]=n}return r}return e instanceof Pe?e:void 0}function qi(e,t,r){return 2&t||(!r||4096&t||16&t?e=Rt(e,t,!1,r&&!(16&t)):(ar(e,34),4&t&&Object.freeze(e))),e}function js(e,t,r){return e=new e.constructor(t),r&&(e.h=it),e.m=it,e}function Xi(e){const t=e.v,r=0|t[p];return oe(e,r)?e:Gs(e,t,r)?js(e,t):Rt(t,r)}function Rt(e,t,r,s){return s??(s=!!(34&t)),e=jr(e,t,Dh,s),s=32,r&&(s|=2),j(e,t=16769217&t|s),e}function Vs(e){const t=e.v,r=0|t[p];return oe(e,r)?Gs(e,t,r)?js(e,t,!0):new e.constructor(Rt(t,r,!1)):e}function It(e){if(e.h!==it)return!1;var t=e.v;return ar(t=Rt(t,0|t[p]),2048),e.v=t,e.h=void 0,e.m=void 0,!0}function Ut(e){if(!It(e)&&oe(e,0|e.v[p]))throw Error()}function ct(e,t){t===void 0&&(t=0|e[p]),32&t&&!(4096&t)&&j(e,4096|t)}function Gs(e,t,r){return!!(2&r)||!(!(32&r)||4096&r)&&(j(t,2|r),e.h=it,!0)}const jh=ae(0),He={};function P(e,t,r,s,n){if((t=Ne(e.v,t,r,n))!==null||s&&e.m!==it)return t}function Ne(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 C(e,t,r,s){Ut(e),V(e=e.v,0|e[p],t,r,s)}function V(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 ht(){return ph===void 0?2:4}function ut(e,t,r,s,n){let i=e.v,o=0|i[p];s=oe(e,o)?1:s,n=!!n||s===3,s===2&&It(e)&&(i=e.v,o=0|i[p]);let a=(e=Hs(i,t))===nt?7:0|e[p],c=zs(a,o);var u=!(4&c);if(u){4&c&&(e=ke(e),a=0,c=dt(c,o),o=V(i,o,t,e));let h=0,l=0;for(;h<e.length;h++){const f=r(e[h]);f!=null&&(e[l++]=f)}l<h&&(e.length=l),r=-513&(4|c),c=r&=-1025,c&=-4097}return c!==a&&(j(e,c),2&c&&Object.freeze(e)),Yi(e,c,i,o,t,s,u,n)}function Yi(e,t,r,s,n,i,o,a){let c=t;return i===1||i===4&&(2&t||!(16&t)&&32&s)?lt(t)||((t|=!e.length||o&&!(4096&t)||32&s&&!(4096&t||16&t)?2:256)!==c&&j(e,t),Object.freeze(e)):(i===2&&lt(t)&&(e=ke(e),c=0,t=dt(t,s),s=V(r,s,n,e)),lt(t)||(a||(t|=16),t!==c&&j(e,t))),2&t||!(4096&t||16&t)||ct(r,s),e}function Hs(e,t,r){return e=Ne(e,t,r),Array.isArray(e)?e:nt}function zs(e,t){return 2&t&&(e|=2),1|e}function lt(e){return!!(2&e)&&!!(4&e)||!!(256&e)}function Qi(e){return Ms(e,!0)}function Ji(e){e=ke(e);for(let t=0;t<e.length;t++){const r=e[t]=ke(e[t]);Array.isArray(r[1])&&(r[1]=cr(r[1]))}return hr(e)}function ze(e,t,r,s){Ut(e),V(e=e.v,0|e[p],t,(s==="0"?Number(r)===0:r===s)?void 0:r)}function Nt(e,t,r){if(2&t)throw Error();const s=Ft(t);let n=Hs(e,r,s),i=n===nt?7:0|n[p],o=zs(i,t);return(2&o||lt(o)||16&o)&&(o===i||lt(o)||j(n,o),n=ke(n),i=0,o=dt(o,t),V(e,t,r,n,s)),o&=-13,o!==i&&j(n,o),n}function Ws(e,t){var r=ia;return qs(Ks(e=e.v),e,void 0,r)===t?t:-1}function Ks(e){if(Pt)return e[or]??(e[or]=new Map);if(or in e)return e[or];const t=new Map;return Object.defineProperty(e,or,{value:t}),t}function Zi(e,t,r,s,n){const i=Ks(e),o=qs(i,e,t,r,n);return o!==s&&(o&&(t=V(e,t,o,void 0,n)),i.set(r,s)),t}function qs(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];Ne(t,a,n)!=null&&(i!==0&&(r=V(t,r,i,void 0,n)),i=a)}return e.set(s,i),i}function Xs(e,t,r){let s=0|e[p];const n=Ft(s),i=Ne(e,r,n);let o;if(i!=null&&i[Mt]===Lt){if(!oe(i))return It(i),i.v;o=i.v}else Array.isArray(i)&&(o=i);if(o){const a=0|o[p];2&a&&(o=Rt(o,a))}return o=at(o,t),o!==i&&V(e,s,r,o,n),o}function eo(e,t,r,s,n){let i=!1;if((s=Ne(e,s,n,(o=>{const a=Us(o,r,!1,t);return i=a!==o&&a!=null,a})))!=null)return i&&!oe(s)&&ct(e,t),s}function A(e,t,r,s){let n=e.v,i=0|n[p];if((t=eo(n,i,t,r,s))==null)return t;if(i=0|n[p],!oe(e,i)){const o=Vs(t);o!==t&&(It(e)&&(n=e.v,i=0|n[p]),i=V(n,i,r,t=o,s),ct(n,i))}return t}function to(e,t,r,s,n,i,o,a){var c=oe(e,r);i=c?1:i,o=!!o||i===3,c=a&&!c,(i===2||c)&&It(e)&&(r=0|(t=e.v)[p]);var u=(e=Hs(t,n))===nt?7:0|e[p],h=zs(u,r);if(a=!(4&h)){var l=e,f=r;const v=!!(2&h);v&&(f|=2);let S=!v,ne=!0,te=0,Ge=0;for(;te<l.length;te++){const At=Us(l[te],s,!1,f);if(At instanceof s){if(!v){const rr=oe(At);S&&(S=!rr),ne&&(ne=rr)}l[Ge++]=At}}Ge<te&&(l.length=Ge),h|=4,h=ne?-4097&h:4096|h,h=S?8|h:-9&h}if(h!==u&&(j(e,h),2&h&&Object.freeze(e)),c&&!(8&h||!e.length&&(i===1||i===4&&(2&h||!(16&h)&&32&r)))){for(lt(h)&&(e=ke(e),h=dt(h,r),r=V(t,r,n,e)),s=e,c=h,u=0;u<s.length;u++)(l=s[u])!==(h=Vs(l))&&(s[u]=h);c|=8,j(e,h=c=s.length?4096|c:-4097&c)}return Yi(e,h,t,r,n,i,a,o)}function Be(e,t,r){const s=e.v;return to(e,s,0|s[p],t,r,ht(),!1,!0)}function ro(e){return e==null&&(e=void 0),e}function b(e,t,r,s,n){return C(e,r,s=ro(s),n),s&&!oe(s)&&ct(e.v),e}function yr(e,t,r,s){e:{var n=s=ro(s);Ut(e);const i=e.v;let o=0|i[p];if(n==null){const a=Ks(i);if(qs(a,i,o,r)!==t)break e;a.set(r,0)}else o=Zi(i,o,r,t);V(i,o,t,n)}s&&!oe(s)&&ct(e.v)}function dt(e,t){return-273&(2&t?2|e:-3&e)}function Ys(e,t,r,s){var n=s;Ut(e),e=to(e,s=e.v,0|s[p],r,t,2,!0),n=n??new r,e.push(n),t=r=e===nt?7:0|e[p],(n=oe(n))?(r&=-9,e.length===1&&(r&=-4097)):r|=4096,r!==t&&j(e,r),n||ct(s)}function ve(e,t,r){return $t(P(e,t,void 0,r))}function so(e){return(ks?P(e,2,void 0,void 0,Nr):Nr(P(e,2)))??jh}function R(e,t){return P(e,t,void 0,void 0,Le)??0}function De(e,t,r){if(r!=null){if(typeof r!="number"||!Ur(r))throw Ts("int32");r|=0}C(e,t,r)}function y(e,t,r){C(e,t,dr(r))}function ce(e,t,r){ze(e,t,mr(r),"")}function Vr(e,t,r){{Ut(e);const o=e.v;let a=0|o[p];if(r==null)V(o,a,t);else{var s=e=r===nt?7:0|r[p],n=lt(e),i=n||Object.isFrozen(r);for(n||(e=0),i||(r=ke(r),s=0,e=dt(e,a),i=!1),e|=5,e|=(4&e?512&e?512:1024&e?1024:0:void 0)??(ks?1024:0),n=0;n<r.length;n++){const c=r[n],u=Gi(c);Object.is(c,u)||(i&&(r=ke(r),s=0,e=dt(e,a),i=!1),r[n]=u)}e!==s&&(i&&(r=ke(r),e=dt(e,a)),j(r,e)),V(o,a,t,r)}}}function Gr(e,t,r){Ut(e),ut(e,t,Y,2,!0).push(Gi(r))}var Bt=class{constructor(e,t,r){if(this.buffer=e,r&&!t)throw Error();this.g=t}};function Qs(e,t){if(typeof e=="string")return new Bt(wi(e),t);if(Array.isArray(e))return new Bt(new Uint8Array(e),t);if(e.constructor===Uint8Array)return new Bt(e,!1);if(e.constructor===ArrayBuffer)return e=new Uint8Array(e),new Bt(e,!1);if(e.constructor===Pe)return t=Cs(e)||new Uint8Array(0),new Bt(t,!0,e);if(e instanceof Uint8Array)return e=e.constructor===Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Bt(e,!1);throw Error()}function Dt(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(ft(e,a),!(128&r))return t(s>>>0,n>>>0);throw Error()}function Js(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 ft(e,r),!!(127&t)}throw Error()}function We(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 ft(e,r),n}function je(e){return We(e)>>>0}function Hr(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],ft(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 Vh(e){return We(e)}function ft(e,t){if(e.g=t,t>e.l)throw Error()}function no(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 io(e,t){if(t==0)return st();var r=no(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):wh?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?st():new Pe(r,St)}var oo=[];function ao(e,t,r,s){if(Kr.length){const n=Kr.pop();return n.o(s),n.g.init(e,t,r,s),n}return new Gh(e,t,r,s)}function co(e){e.g.clear(),e.l=-1,e.h=-1,Kr.length<100&&Kr.push(e)}function ho(e){var t=e.g;if(t.g==t.l)return!1;e.m=e.g.g;var r=je(e.g);if(t=r>>>3,!((r&=7)>=0&&r<=5)||t<1)throw Error();return e.l=t,e.h=r,!0}function zr(e){switch(e.h){case 0:e.h!=0?zr(e):Js(e.g);break;case 1:ft(e=e.g,e.g+8);break;case 2:if(e.h!=2)zr(e);else{var t=je(e.g);ft(e=e.g,e.g+t)}break;case 5:ft(e=e.g,e.g+4);break;case 3:for(t=e.l;;){if(!ho(e))throw Error();if(e.h==4){if(e.l!=t)throw Error();break}zr(e)}break;default:throw Error()}}function br(e,t,r){const s=e.g.l;var n=je(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=je(e.g),r=no(e=e.g,t);if(e=e.h,eh){var s,n=e;(s=ws)||(s=ws=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(xr===void 0){try{s.decode(new Uint8Array([128]))}catch{}try{s.decode(new Uint8Array([97])),xr=!0}catch{xr=!1}}throw!xr&&(ws=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?rt():(a=e[i++],o<194||(192&a)!=128?(i--,rt()):r.push((31&o)<<6|63&a)):o<240?i>=t-1?rt():(a=e[i++],(192&a)!=128||o===224&&a<160||o===237&&a>=160||(192&(s=e[i++]))!=128?(i--,rt()):r.push((15&o)<<12|(63&a)<<6|63&s)):o<=244?i>=t-2?rt():(a=e[i++],(192&a)!=128||a-144+(o<<28)>>30!=0||(192&(s=e[i++]))!=128||(192&(n=e[i++]))!=128?(i--,rt()):(o=(7&o)<<18|(63&a)<<12|(63&s)<<6|63&n,o-=65536,r.push(55296+(o>>10&1023),56320+(1023&o)))):rt(),r.length>=8192&&(c=li(c,r),r.length=0)}i=li(c,r)}return i}function uo(e){const t=je(e.g);return io(e.g,t)}function Wr(e,t,r){var s=je(e.g);for(s=e.g.g+s;e.g.g<s;)r.push(t(e.g))}var Gh=class{constructor(e,t,r,s){if(oo.length){const n=oo.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=Qs(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}},Kr=[];function lo(e){return e?/^\d+$/.test(e)?(Ir(e),new en(F,N)):null:Hh||(Hh=new en(0,0))}var en=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let Hh;function fo(e){return e?/^-?\d+$/.test(e)?(Ir(e),new tn(F,N)):null:zh||(zh=new tn(0,0))}var tn=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let zh;function jt(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 Vt(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function qr(e,t){if(t>=0)Vt(e,t);else{for(let r=0;r<9;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function rn(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 Gt(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function _e(e,t,r){Vt(e.g,8*t+r)}function sn(e,t){return _e(e,t,2),t=e.g.end(),Gt(e,t),t.push(e.h),t}function nn(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 Xr(e,t,r){_e(e,t,2),Vt(e.g,r.length),Gt(e,e.g.end()),Gt(e,r)}function Yr(e,t,r,s){r!=null&&(t=sn(e,t),s(r,e),nn(e,t))}function Fe(){const e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var on=Fe(),po=Fe(),an=Fe(),cn=Fe(),mo=Fe(),go=Fe(),Wh=Fe(),Qr=Fe(),yo=Fe(),bo=Fe();function xe(e,t,r){var s=e.v;ie&&ie in s&&(s=s[ie])&&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=Ki(e,t,void 0,2048)}toJSON(){return Wi(this)}j(){var n;var e=Pu,t=this.v,r=e.g,s=ie;if(Pt&&s&&((n=t[s])==null?void 0:n[r])!=null&&Ct(lh,3),t=e.g,Si&&ie&&Si===void 0&&(s=(r=this.v)[ie])&&(s=s.da))try{s(r,t,Rh)}catch(i){fi(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 Gs(this,e,t)?js(this,e,!0):new this.constructor(Rt(e,t,!1))}};m.prototype[Mt]=Lt,m.prototype.toString=function(){return this.v.toString()};var Ht=class{constructor(e,t,r){this.g=e,this.h=t,e=on,this.l=!!e&&r===e||!1}};function Jr(e,t){return new Ht(e,t,on)}function vo(e,t,r,s,n){Yr(e,r,So(t,s),n)}const Kh=Jr((function(e,t,r,s,n){return e.h===2&&(br(e,Xs(t,s,r),n),!0)}),vo),qh=Jr((function(e,t,r,s,n){return e.h===2&&(br(e,Xs(t,s,r),n),!0)}),vo);var Zr=Symbol(),es=Symbol(),hn=Symbol(),_o=Symbol(),wo=Symbol();let Eo,Ao;function pt(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?Bh||(Bh=[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,Eo??(Eo=i),Ao??(Ao=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 Ht?l=i:(l=Kh,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 f=a[c];u?r(n,c,l,u,f):t(n,c,l,f)}}return s[e]=n}function ko(e){return Array.isArray(e)?e[0]instanceof Ht?e:[qh,e]:[e,void 0]}function So(e,t){return e instanceof m?e.v:Array.isArray(e)?at(e,t):void 0}function un(e,t,r,s){const n=r.g;e[t]=s?(i,o,a)=>n(i,o,a,s):n}function ln(e,t,r,s,n){const i=r.g;let o,a;e[t]=(c,u,h)=>i(c,u,h,a||(a=pt(es,un,ln,s).T),o||(o=dn(s)),n)}function dn(e){let t=e[hn];if(t!=null)return t;const r=pt(es,un,ln,e);return t=r.ma?(s,n)=>Eo(s,n,r):(s,n)=>{for(;ho(n)&&n.h!=4;){var i=n.l,o=r[i];if(o==null){var a=r.ba;a&&(a=a[i])&&(a=Yh(a))!=null&&(o=r[i]=a)}if(o==null||!o(n,s,i)){if(o=(a=n).m,zr(a),a.ha)var c=void 0;else c=a.g.g-o,a.g.g=o,c=io(a.g,c);o=void 0,a=s,c&&((o=a[ie]??(a[ie]=new Ds))[i]??(o[i]=[])).push(c)}}return(s=Br(s))&&(s.da=r.qa[wo]),!0},e[hn]=t,e[wo]=Xh.bind(e),t}function Xh(e,t,r,s){var n=this[es];const i=this[hn],o=at(void 0,n.T),a=Br(e);if(a){var c=!1,u=n.ba;if(u){if(n=(h,l,f)=>{if(f.length!==0)if(u[l])for(const v of f){h=ao(v);try{c=!0,i(o,h)}finally{co(h)}}else s==null||s(e,l,f)},t==null)Dr(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=Ft(h),f=(v,S)=>{if(Ne(e,v,l)!=null){if((r==null?void 0:r.Qa)===1)return;throw Error()}S!=null&&(h=V(e,h,v,S,l)),delete a[v]};t==null?Li(o,0|o[p],((v,S)=>{f(v,S)})):f(t,Ne(o,t,l))}}}}function Yh(e){const t=(e=ko(e))[0].g;if(e=e[1]){const r=dn(e),s=pt(es,un,ln,e).T;return(n,i,o)=>t(n,i,o,s,r)}return t}function ts(e,t,r){e[t]=r.h}function rs(e,t,r,s){let n,i;const o=r.h;e[t]=(a,c,u)=>o(a,c,u,i||(i=pt(Zr,ts,rs,s).T),n||(n=Co(s)))}function Co(e){let t=e[_o];if(!t){const r=pt(Zr,ts,rs,e);t=(s,n)=>To(s,n,r),e[_o]=t}return t}function To(e,t,r){Li(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=ko(c))[0].h;if(c=c[1]){const h=Co(c),l=pt(Zr,ts,rs,c).T;c=o.ma?Ao(l,h):(f,v,S)=>u(f,v,S,l,h)}else c=u;return o[a]=c}})(r,s);i?i(t,n,s):s<500||Ct(Ps,3)}})),(e=Br(e))&&Dr(e,((s,n,i)=>{for(Gt(t,t.g.end()),s=0;s<i.length;s++)Gt(t,Cs(i[s])||new Uint8Array(0))}))}const Qh=ae(0);function zt(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&&j(t,e),2&e&&Object.freeze(t),t}}function ee(e,t,r){return new Ht(e,t,r)}function Wt(e,t,r){return new Ht(e,t,r)}function z(e,t,r){V(e,0|e[p],t,r,Ft(0|e[p]))}var Jh=Jr((function(e,t,r,s,n){if(e.h!==2)return!1;if(e=ke(e=br(e,at([void 0,void 0],s),n)),n=Ft(s=0|t[p]),2&s)throw Error();let i=Ne(t,r,n);if(i instanceof Ue)(2&i.J)!=0?(i=i.V(),i.push(e),V(t,s,r,i,n)):i.Ma(e);else if(Array.isArray(i)){var o=0|i[p];8192&o||j(i,o|=8192),2&o&&(i=Ji(i),V(t,s,r,i,n)),i.push(e)}else V(t,s,r,hr([e]),n);return!0}),(function(e,t,r,s,n){if(t instanceof Ue)t.forEach(((i,o)=>{Yr(e,r,at([o,i],s),n)}));else if(Array.isArray(t)){for(let i=0;i<t.length;i++){const o=t[i];Array.isArray(o)&&Yr(e,r,at(o,s),n)}hr(t)}}));function Po(e,t,r){(t=Le(t))!=null&&(_e(e,r,5),e=e.g,Fs(t),rn(e))}function Mo(e,t,r){if(t=(function(s){if(s==null)return s;const n=typeof s;if(n==="bigint")return String(lr(64,s));if(pr(s)){if(n==="string")return Di(s);if(n==="number")return Is(s)}})(t),t!=null&&(typeof t=="string"&&fo(t),t!=null))switch(_e(e,r,0),typeof t){case"number":e=e.g,xt(t),jt(e,F,N);break;case"bigint":r=BigInt.asUintN(64,t),r=new tn(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),jt(e.g,r.h,r.g);break;default:r=fo(t),jt(e.g,r.h,r.g)}}function Lo(e,t,r){(t=$t(t))!=null&&t!=null&&(_e(e,r,0),qr(e.g,t))}function Fo(e,t,r){(t=Ui(t))!=null&&(_e(e,r,0),e.g.g.push(t?1:0))}function xo(e,t,r){(t=Y(t))!=null&&Xr(e,r,di(t))}function Oo(e,t,r,s,n){Yr(e,r,So(t,s),n)}function $o(e,t,r){(t=t==null||typeof t=="string"||t instanceof Pe?t:void 0)!=null&&Xr(e,r,Qs(t,!0).buffer)}function Ro(e,t,r){return(e.h===5||e.h===2)&&(t=Nt(t,0|t[p],r),e.h==2?Wr(e,Hr,t):t.push(Hr(e.g)),!0)}var B=ee((function(e,t,r){return e.h===5&&(z(t,r,Hr(e.g)),!0)}),Po,Qr),Zh=Wt(Ro,(function(e,t,r){if((t=zt(Le,t))!=null)for(let o=0;o<t.length;o++){var s=e,n=r,i=t[o];i!=null&&(_e(s,n,5),s=s.g,Fs(i),rn(s))}}),Qr),fn=Wt(Ro,(function(e,t,r){if((t=zt(Le,t))!=null&&t.length){_e(e,r,2),Vt(e.g,4*t.length);for(let s=0;s<t.length;s++)r=e.g,Fs(t[s]),rn(r)}}),Qr),eu=ee((function(e,t,r){return e.h===5&&(z(t,r,(e=Hr(e.g))===0?void 0:e),!0)}),Po,Qr),Ke=ee((function(e,t,r){return As?(e.h!==0?e=!1:(z(t,r,Dt(e.g,Ri)),e=!0),e):e.h===0&&(z(t,r,Dt(e.g,Os)),!0)}),Mo,go),pn=ee((function(e,t,r){return As?(e.h!==0?t=!1:(z(t,r,(e=Dt(e.g,Ri))===Qh?void 0:e),t=!0),t):e.h===0&&(z(t,r,(e=Dt(e.g,Os))===0?void 0:e),!0)}),Mo,go),tu=ee((function(e,t,r){return As?(e.h!==0?e=!1:(z(t,r,Dt(e.g,Ah)),e=!0),e):e.h===0&&(z(t,r,Dt(e.g,xs)),!0)}),(function(e,t,r){if(t=(function(s){if(s==null)return s;var n=typeof s;if(n==="bigint")return String(kh(64,s));if(pr(s)){if(n==="string")return n=Ot(Number(s)),ot(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"))||(Ir(s),s=ur(F,N))),s;if(n==="number")return(s=Ot(s))>=0&&ot(s)||(xt(s),s=xs(F,N)),s}})(t),t!=null&&(typeof t=="string"&&lo(t),t!=null))switch(_e(e,r,0),typeof t){case"number":e=e.g,xt(t),jt(e,F,N);break;case"bigint":r=BigInt.asUintN(64,t),r=new en(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),jt(e.g,r.h,r.g);break;default:r=lo(t),jt(e.g,r.h,r.g)}}),Wh),W=ee((function(e,t,r){return e.h===0&&(z(t,r,We(e.g)),!0)}),Lo,cn),vr=Wt((function(e,t,r){return(e.h===0||e.h===2)&&(t=Nt(t,0|t[p],r),e.h==2?Wr(e,We,t):t.push(We(e.g)),!0)}),(function(e,t,r){if((t=zt($t,t))!=null&&t.length){r=sn(e,r);for(let s=0;s<t.length;s++)qr(e.g,t[s]);nn(e,r)}}),cn),Kt=ee((function(e,t,r){return e.h===0&&(z(t,r,(e=We(e.g))===0?void 0:e),!0)}),Lo,cn),I=ee((function(e,t,r){return e.h===0&&(z(t,r,Js(e.g)),!0)}),Fo,po),mt=ee((function(e,t,r){return e.h===0&&(z(t,r,(e=Js(e.g))===!1?void 0:e),!0)}),Fo,po),Q=Wt((function(e,t,r){return e.h===2&&(e=Zs(e),Nt(t,0|t[p],r).push(e),!0)}),(function(e,t,r){if((t=zt(Y,t))!=null)for(let o=0;o<t.length;o++){var s=e,n=r,i=t[o];i!=null&&Xr(s,n,di(i))}}),an),qe=ee((function(e,t,r){return e.h===2&&(z(t,r,(e=Zs(e))===""?void 0:e),!0)}),xo,an),T=ee((function(e,t,r){return e.h===2&&(z(t,r,Zs(e)),!0)}),xo,an),K=(function(e,t,r=on){return new Ht(e,t,r)})((function(e,t,r,s,n){return e.h===2&&(s=at(void 0,s),Nt(t,0|t[p],r).push(s),br(e,s,n),!0)}),(function(e,t,r,s,n){if(Array.isArray(t)){for(let i=0;i<t.length;i++)Oo(e,t[i],r,s,n);1&(e=0|t[p])||j(t,1|e)}})),U=Jr((function(e,t,r,s,n,i){if(e.h!==2)return!1;let o=0|t[p];return Zi(t,o,i,r,Ft(o)),br(e,t=Xs(t,s,r),n),!0}),Oo),Io=ee((function(e,t,r){return e.h===2&&(z(t,r,uo(e)),!0)}),$o,yo),ru=Wt((function(e,t,r){return(e.h===0||e.h===2)&&(t=Nt(t,0|t[p],r),e.h==2?Wr(e,je,t):t.push(je(e.g)),!0)}),(function(e,t,r){if((t=zt(Ni,t))!=null)for(let o=0;o<t.length;o++){var s=e,n=r,i=t[o];i!=null&&(_e(s,n,0),Vt(s.g,i))}}),mo),su=ee((function(e,t,r){return e.h===0&&(z(t,r,(e=je(e.g))===0?void 0:e),!0)}),(function(e,t,r){(t=Ni(t))!=null&&t!=null&&(_e(e,r,0),Vt(e.g,t))}),mo),he=ee((function(e,t,r){return e.h===0&&(z(t,r,We(e.g)),!0)}),(function(e,t,r){(t=$t(t))!=null&&(t=parseInt(t,10),_e(e,r,0),qr(e.g,t))}),bo);class nu{constructor(t,r){var s=ue;this.g=t,this.h=r,this.m=A,this.j=b,this.defaultValue=void 0,this.l=s.Oa!=null?Fi:void 0}register(){Or(this)}}function Oe(e,t){return new nu(e,t)}function Xe(e,t){return(r,s)=>{{const i={ea:!0};s&&Object.assign(i,s),r=ao(r,void 0,void 0,i);try{const o=new e,a=o.v;dn(t)(a,r);var n=o}finally{co(r)}}return n}}function ss(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}}}};To(this.v,t,pt(Zr,ts,rs,e)),Gt(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 Uo=class extends m{constructor(e){super(e)}},No=[0,qe,ee((function(e,t,r){return e.h===2&&(z(t,r,(e=uo(e))===st()?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&&Xr(e,r,Qs(t,!0).buffer)):Ct(Ps,3))}if(Array.isArray(t))return void Ct(Ps,3)}$o(e,t,r)}),yo)];let mn,Bo=globalThis.trustedTypes;function Do(e){var t;return mn===void 0&&(mn=(function(){let r=null;if(!Bo)return r;try{const s=n=>n;r=Bo.createPolicy("goog#html",{createHTML:s,createScript:s,createScriptURL:s})}catch{}return r})()),e=(t=mn)?t.createScriptURL(e):e,new class{constructor(r){this.g=r}toString(){return this.g+""}}(e)}function iu(e,...t){if(t.length===0)return Do(e[0]);let r=e[0];for(let s=0;s<t.length;s++)r+=encodeURIComponent(t[s])+e[s+1];return Do(r)}var jo=[0,W,he,I,-1,vr,he,-1,I],ou=class extends m{constructor(e){super(e)}},Vo=[0,I,T,I,he,-1,Wt((function(e,t,r){return(e.h===0||e.h===2)&&(t=Nt(t,0|t[p],r),e.h==2?Wr(e,Vh,t):t.push(We(e.g)),!0)}),(function(e,t,r){if((t=zt($t,t))!=null&&t.length){r=sn(e,r);for(let s=0;s<t.length;s++)qr(e.g,t[s]);nn(e,r)}}),bo),T,-1,[0,I,-1],he,I,-1],Go=[0,3,I,-1,2,[0,W],[0,he,I],[0,T,-1],[0]],Ho=[0,T,-2],zo=class extends m{constructor(e){super(e)}},Wo=[0],Ko=[0,W,I,1,I,-4],ue=class extends m{constructor(e){super(e,2)}},G={};G[336783863]=[0,T,I,-1,W,[0,[1,2,3,4,5,6,7,8,9],U,Wo,U,Vo,U,Ho,U,Ko,U,jo,U,[0,T,-2],U,[0,T,he],U,Go,U,[0,he,-1,I]],[0,T],I,[0,[1,3],[2,4],U,[0,vr],-1,U,[0,Q],-1,K,[0,T,-1]],T];var qo=[0,pn,-1,mt,-3,pn,vr,qe,Kt,pn,-1,mt,Kt,mt,-2,qe];function M(e,t){Gr(e,3,t)}function _(e,t){Gr(e,4,t)}var re=class extends m{constructor(e){super(e,500)}o(e){return b(this,0,7,e)}},_r=[-1,{}],Xo=[0,T,1,_r],Yo=[0,T,Q,_r];function we(e,t){Ys(e,1,re,t)}function x(e,t){Gr(e,10,t)}function k(e,t){Gr(e,15,t)}var le=class extends m{constructor(e){super(e,500)}o(e){return b(this,0,1001,e)}},Qo=[-500,K,[-500,qe,-1,Q,-3,[-2,G,I],K,No,Kt,-1,Xo,Yo,K,[0,qe,mt],qe,qo,Kt,Q,987,Q],4,K,[-500,T,-1,[-1,{}],998,T],K,[-500,T,Q,-1,[-2,{},I],997,Q,-1],Kt,K,[-500,T,Q,_r,998,Q],Q,Kt,Xo,Yo,K,[0,qe,-1,_r],Q,-2,qo,qe,-1,mt,[0,mt,su],978,_r,K,No];le.prototype.g=ss(Qo);var au=Xe(le,Qo),cu=class extends m{constructor(e){super(e)}},Jo=class extends m{constructor(e){super(e)}g(){return Be(this,cu,1)}},Zo=[0,K,[0,W,B,T,-1]],ns=Xe(Jo,Zo),hu=class extends m{constructor(e){super(e)}},uu=class extends m{constructor(e){super(e)}},gn=class extends m{constructor(e){super(e)}l(){return A(this,hu,2)}g(){return Be(this,uu,5)}},ea=Xe(class extends m{constructor(e){super(e)}},[0,Q,vr,fn,[0,he,[0,W,-3],[0,B,-3],[0,W,-1,[0,K,[0,W,-2]]],K,[0,B,-1,T,B]],T,-1,Ke,K,[0,W,B],Q,Ke]),ta=class extends m{constructor(e){super(e)}},qt=Xe(class extends m{constructor(e){super(e)}},[0,K,[0,B,-4]]),ra=class extends m{constructor(e){super(e)}},wr=Xe(class extends m{constructor(e){super(e)}},[0,K,[0,B,-4]]),lu=class extends m{constructor(e){super(e)}},du=[0,W,-1,fn,he],sa=class extends m{constructor(e){super(e)}};sa.prototype.g=ss([0,B,-4,Ke]);var fu=class extends m{constructor(e){super(e)}},pu=Xe(class extends m{constructor(e){super(e)}},[0,K,[0,1,W,T,Zo],Ke]),na=class extends m{constructor(e){super(e)}},mu=class extends m{constructor(e){super(e)}na(){const e=P(this,1,void 0,void 0,Qi);return e??st()}},gu=class extends m{constructor(e){super(e)}},ia=[1,2],yu=Xe(class extends m{constructor(e){super(e)}},[0,K,[0,ia,U,[0,fn],U,[0,Io],W,T],Ke]),yn=class extends m{constructor(e){super(e)}},oa=[0,T,W,B,Q,-1],aa=class extends m{constructor(e){super(e)}},bu=[0,I,-1],ca=class extends m{constructor(e){super(e)}},is=[1,2,3,4,5,6],os=class extends m{constructor(e){super(e)}g(){return P(this,1,void 0,void 0,Qi)!=null}l(){return Y(P(this,2))!=null}},O=class extends m{constructor(e){super(e)}g(){return Ui(P(this,2))??!1}},ha=[0,Io,T,[0,W,Ke,-1],[0,tu,Ke]],D=[0,ha,I,[0,is,U,Ko,U,Vo,U,jo,U,Wo,U,Ho,U,Go],he],as=class extends m{constructor(e){super(e)}},bn=[0,D,B,-1,W],vu=Oe(502141897,as);G[502141897]=bn;var _u=Xe(class extends m{constructor(e){super(e)}},[0,[0,he,-1,Zh,ru],du]),ua=class extends m{constructor(e){super(e)}},la=class extends m{constructor(e){super(e)}},vn=[0,D,B,[0,D],I],wu=Oe(508968150,la);G[508968150]=[0,D,bn,vn,B,[0,[0,ha]]],G[508968149]=vn;var Xt=class extends m{constructor(e){super(e)}l(){return A(this,yn,2)}g(){C(this,2)}},da=[0,D,oa];G[478825465]=da;var Eu=class extends m{constructor(e){super(e)}},fa=class extends m{constructor(e){super(e)}},_n=class extends m{constructor(e){super(e)}},wn=class extends m{constructor(e){super(e)}},pa=class extends m{constructor(e){super(e)}},ma=[0,D,[0,D],da,-1],ga=[0,D,B,W],En=[0,D,B],ya=[0,D,ga,En,B],Au=Oe(479097054,pa);G[479097054]=[0,D,ya,ma],G[463370452]=ma,G[464864288]=ga;var ku=Oe(462713202,wn);G[462713202]=ya,G[474472470]=En;var Su=class extends m{constructor(e){super(e)}},ba=class extends m{constructor(e){super(e)}},va=class extends m{constructor(e){super(e)}},_a=class extends m{constructor(e){super(e)}},An=[0,D,B,-1,W],kn=[0,D,B,I];_a.prototype.g=ss([0,D,En,[0,D],bn,vn,An,kn]);var wa=class extends m{constructor(e){super(e)}},Cu=Oe(456383383,wa);G[456383383]=[0,D,oa];var Ea=class extends m{constructor(e){super(e)}},Tu=Oe(476348187,Ea);G[476348187]=[0,D,bu];var Aa=class extends m{constructor(e){super(e)}},ka=class extends m{constructor(e){super(e)}},Sa=[0,he,-1],Pu=Oe(458105876,class extends m{constructor(e){super(e)}g(){let e;var t=this.v;const r=0|t[p];return e=oe(this,r),t=(function(s,n,i,o){var a=ka;!o&&It(s)&&(i=0|(n=s.v)[p]);var c=Ne(n,2);if(s=!1,c==null){if(o)return zi();c=[]}else if(c.constructor===Ue){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 zi();s||(s=!0,cr(c))}else s&&(s=!1,hr(c),c=Ji(c));return!s&&32&i&&ar(c,32),i=V(n,i,2,o=new Ue(c,a,Ph,void 0)),s||ct(n,i),o})(this,t,r,e),!e&&ka&&(t.ra=!0),t}});G[458105876]=[0,Sa,Jh,[!0,Ke,[0,T,-1,Q]],[0,vr,I,he]];var Sn=class extends m{constructor(e){super(e)}},Ca=Oe(458105758,Sn);G[458105758]=[0,D,T,Sa];var Cn=class extends m{constructor(e){super(e)}},Ta=[0,eu,-1,mt],Mu=class extends m{constructor(e){super(e)}},Pa=class extends m{constructor(e){super(e)}},Tn=[1,2];Pa.prototype.g=ss([0,Tn,U,Ta,U,[0,K,Ta]]);var Ma=class extends m{constructor(e){super(e)}},Lu=Oe(443442058,Ma);G[443442058]=[0,D,T,W,B,Q,-1,I,B],G[514774813]=An;var La=class extends m{constructor(e){super(e)}},Fu=Oe(516587230,La);function Pn(e,t){return t=t?t.clone():new yn,e.displayNamesLocale!==void 0?C(t,1,mr(e.displayNamesLocale)):e.displayNamesLocale===void 0&&C(t,1),e.maxResults!==void 0?De(t,2,e.maxResults):"maxResults"in e&&C(t,2),e.scoreThreshold!==void 0?y(t,3,e.scoreThreshold):"scoreThreshold"in e&&C(t,3),e.categoryAllowlist!==void 0?Vr(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&C(t,4),e.categoryDenylist!==void 0?Vr(t,5,e.categoryDenylist):"categoryDenylist"in e&&C(t,5),t}function Fa(e){const t=Number(e);return Number.isSafeInteger(t)?t:String(e)}function Mn(e,t=-1,r=""){return{categories:e.map((s=>({index:ve(s,1)??0??-1,score:R(s,2)??0,categoryName:Y(P(s,3))??""??"",displayName:Y(P(s,4))??""??""}))),headIndex:t,headName:r}}function xu(e){const t={classifications:Be(e,fu,1).map((r=>{var s;return Mn(((s=A(r,Jo,4))==null?void 0:s.g())??[],ve(r,2)??0,Y(P(r,3))??"")}))};return(function(r){return Th(ks?P(r,2,void 0,void 0,Nr):P(r,2))})(e)!=null&&(t.timestampMs=Fa(so(e))),t}function xa(e){var o,a;var t=ut(e,3,Le,ht()),r=ut(e,2,$t,ht()),s=ut(e,1,Y,ht()),n=ut(e,9,Y,ht());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=A(e,gn,4))==null?void 0:o.l())&&(i.boundingBox={originX:ve(t,1,He)??0,originY:ve(t,2,He)??0,width:ve(t,3,He)??0,height:ve(t,4,He)??0,angle:0}),(a=A(e,gn,4))==null?void 0:a.g().length)for(const c of A(e,gn,4).g())i.keypoints.push({x:P(c,1,void 0,He,Le)??0,y:P(c,2,void 0,He,Le)??0,score:P(c,4,void 0,He,Le)??0,label:Y(P(c,3,void 0,He))??""});return i}function cs(e){const t=[];for(const r of Be(e,ra,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 Er(e){const t=[];for(const r of Be(e,ta,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 Oa(e){return Array.from(e,(t=>t>127?t-256:t))}function $a(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 hs;G[516587230]=[0,D,An,kn,B],G[518928384]=kn;const Ou=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 Ra(){if(hs===void 0)try{await WebAssembly.instantiate(Ou),hs=!0}catch{hs=!1}return hs}async function Ar(e,t=iu``){const r=await Ra()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var gt=class{};function Ia(){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 Ua(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 Na(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 Ba(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]=Na(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 Da(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 $e(e,t,r){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=r}function Ye(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)}}gt.forVisionTasks=function(e){return Ar("vision",e)},gt.forTextTasks=function(e){return Ar("text",e)},gt.forGenAiExperimentalTasks=function(e){return Ar("genai_experimental",e)},gt.forGenAiTasks=function(e){return Ar("genai",e)},gt.forAudioTasks=function(e){return Ar("audio",e)},gt.isSimdSupported=function(){return Ra()};async function $u(e,t,r,s){return e=await(async(n,i,o,a,c)=>{if(i&&await Ua(i),!self.ModuleFactory||o&&(await Ua(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 Ln(e,t){const r=A(e.baseOptions,os,1)||new os;typeof t=="string"?(C(r,2,mr(t)),C(r,1)):t instanceof Uint8Array&&(C(r,1,Ms(t,!1)),C(r,2)),b(e.baseOptions,0,1,r)}function ja(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 d(e,t){e.C=Math.max(e.C,t)}function us(e,t){e.B=new re,ce(e.B,2,"PassThroughCalculator"),M(e.B,"free_memory"),_(e.B,"free_memory_unused_out"),x(t,"free_memory"),we(t,e.B)}function Yt(e,t){M(e.B,t),_(e.B,t+"_unused_out")}function ls(e){e.g.addBoolToStream(!0,"free_memory",e.C)}var Fn=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=A(this.baseOptions,os,1))!=null&&n.g()||(i=A(this.baseOptions,os,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=A(u.baseOptions,ca,3);if(!l){var f=l=new ca,v=new zo;yr(f,4,is,v)}"delegate"in h&&(h.delegate==="GPU"?(h=l,f=new ou,yr(h,2,is,f)):(h=l,f=new zo,yr(h,4,is,f))),b(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),Ln(this,"/model.dat"),this.m(),this.L()}));if(c.modelAssetBuffer instanceof Uint8Array)Ln(this,c.modelAssetBuffer);else if(c.modelAssetBuffer)return(async function(u){const h=[];for(var l=0;;){const{done:f,value:v}=await u.read();if(f)break;h.push(v),l+=v.length}if(h.length===0)return new Uint8Array(0);if(h.length===1)return h[0];u=new Uint8Array(l),l=0;for(const f of h)u.set(f,l),l+=f.length;return u})(c.modelAssetBuffer).then((u=>{Ln(this,u),this.m(),this.L()}))}return this.m(),this.L(),Promise.resolve()}L(){}ca(){let e;if(this.g.ca((t=>{e=au(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,ja(this)}finishProcessing(){this.g.finishProcessing(),ja(this)}close(){this.B=void 0,this.g.closeGraph()}};function Qe(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}Fn.prototype.close=Fn.prototype.close;class Ru{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 Va(e,t,r){const s=e.g;if(r=Qe(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 Ga(e,t){const r=e.g,s=Qe(r.createVertexArray(),"Failed to create vertex array");r.bindVertexArray(s);const n=Qe(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=Qe(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 Ru(r,s,n,i)}function xn(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function Iu(e,t,r,s){return xn(e,t),e.h||(e.m(),e.D()),r?(e.u||(e.u=Ga(e,!0)),r=e.u):(e.A||(e.A=Ga(e,!1)),r=e.A),t.useProgram(e.h),r.bind(),e.l(),e=s(),r.g.bindVertexArray(null),e}function Ha(e,t,r){return xn(e,t),e=Qe(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 za(e,t,r){xn(e,t),e.B||(e.B=Qe(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 Uu(e){var t;(t=e.g)==null||t.bindFramebuffer(e.g.FRAMEBUFFER,null)}var Wa=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=ht(e.createProgram(),"Failed to create WebGL program"),this.X=Qa(this,`
8
+ `}m(){const e=this.g;if(this.h=Qe(e.createProgram(),"Failed to create WebGL program"),this.X=Va(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=Qa(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 Je(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 Hs(e){var t=Je(e,1);if(!t){if(t=Je(e,0))t=new Float32Array(t).map((n=>n/255));else{t=new Float32Array(e.width*e.height);const n=hr(e);var r=zs(e);if(ec(r,n,rc(e)),"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";").includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"document"in self&&"ontouchend"in self.document){r=new Float32Array(e.width*e.height*4),n.readPixels(0,0,e.width,e.height,n.RGBA,n.FLOAT,r);for(let s=0,i=0;s<t.length;++s,i+=4)t[s]=r[i]}else n.readPixels(0,0,e.width,e.height,n.RED,n.FLOAT,t)}e.g.push(t)}return t}function rc(e){let t=Je(e,2);if(!t){const r=hr(e);t=sc(e);const n=Hs(e),s=nc(e);r.texImage2D(r.TEXTURE_2D,0,s,e.width,e.height,0,r.RED,r.FLOAT,n),Ws(e)}return t}function hr(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=ht(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function nc(e){if(e=hr(e),!Sn)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))Sn=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");Sn=e.R16F}return Sn}function zs(e){return e.l||(e.l=new tc),e.l}function sc(e){const t=hr(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=Je(e,2);return r||(r=Za(zs(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(r),e.j=!0),t.bindTexture(t.TEXTURE_2D,r),r}function Ws(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var Sn,q=class{constructor(e,t,r,n,s,i,o){this.g=e,this.m=t,this.j=r,this.canvas=n,this.l=s,this.width=i,this.height=o,this.j&&--ic===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Fa(){return!!Je(this,0)}ka(){return!!Je(this,1)}R(){return!!Je(this,2)}ja(){return(t=Je(e=this,0))||(t=Hs(e),t=new Uint8Array(t.map((r=>Math.round(255*r)))),e.g.push(t)),t;var e,t}ia(){return Hs(this)}N(){return rc(this)}clone(){const e=[];for(const t of this.g){let r;if(t instanceof Uint8Array)r=new Uint8Array(t);else if(t instanceof Float32Array)r=new Float32Array(t);else{if(!(t instanceof WebGLTexture))throw Error(`Type is not supported: ${t}`);{const n=hr(this),s=zs(this);n.activeTexture(n.TEXTURE1),r=Za(s,n,this.m?n.LINEAR:n.NEAREST),n.bindTexture(n.TEXTURE_2D,r);const i=nc(this);n.texImage2D(n.TEXTURE_2D,0,i,this.width,this.height,0,n.RED,n.FLOAT,null),n.bindTexture(n.TEXTURE_2D,null),ec(s,n,r),Uh(s,n,!1,(()=>{sc(this),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLE_FAN,0,4),Ws(this)})),Nh(s),Ws(this)}}e.push(r)}return new q(e,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&hr(this).deleteTexture(Je(this,2)),ic=-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 ic=250;function Fe(...e){return e.map((([t,r])=>({start:t,end:r})))}const Bh=(function(e){return class extends e{Ja(){this.i._registerModelResourcesGraphService()}}})((oc=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:za()?this.i.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.i.canvas=document.createElement("canvas"))}async initializeGraph(e){const t=await(await fetch(e)).arrayBuffer();e=!(e.endsWith(".pbtxt")||e.endsWith(".textproto")),this.setGraph(new Uint8Array(t),e)}setGraphFromString(e){this.setGraph(new TextEncoder().encode(e),!1)}setGraph(e,t){const r=e.length,n=this.i._malloc(r);this.i.HEAPU8.set(e,n),t?this.i._changeBinaryGraph(r,n):this.i._changeTextGraph(r,n),this.i._free(n)}configureAudio(e,t,r,n,s){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),m(this,n||"input_audio",(i=>{m(this,s=s||"audio_header",(o=>{this.i._configureAudio(i,o,e,t??0,r)}))}))}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}ca(e){Ve(this,"__graph_config__",(t=>{e(t)})),m(this,"__graph_config__",(t=>{this.i._getGraphConfig(t,void 0)})),delete this.i.simpleListeners.__graph_config__}attachErrorListener(e){this.i.errorListener=e}attachEmptyPacketListener(e,t){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[e]=t}addAudioToStream(e,t,r){this.addAudioToStreamWithShape(e,0,0,t,r)}addAudioToStreamWithShape(e,t,r,n,s){const i=4*e.length;this.h!==i&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(i),this.h=i),this.i.HEAPF32.set(e,this.g/4),m(this,n,(o=>{this.i._addAudioToInputStream(this.g,t,r,o,s)}))}addGpuBufferToStream(e,t,r){m(this,t,(n=>{const[s,i]=qa(this,e,n);this.i._addBoundTextureToStream(n,s,i,r)}))}addBoolToStream(e,t,r){m(this,t,(n=>{this.i._addBoolToInputStream(e,n,r)}))}addDoubleToStream(e,t,r){m(this,t,(n=>{this.i._addDoubleToInputStream(e,n,r)}))}addFloatToStream(e,t,r){m(this,t,(n=>{this.i._addFloatToInputStream(e,n,r)}))}addIntToStream(e,t,r){m(this,t,(n=>{this.i._addIntToInputStream(e,n,r)}))}addUintToStream(e,t,r){m(this,t,(n=>{this.i._addUintToInputStream(e,n,r)}))}addStringToStream(e,t,r){m(this,t,(n=>{m(this,e,(s=>{this.i._addStringToInputStream(s,n,r)}))}))}addStringRecordToStream(e,t,r){m(this,t,(n=>{Ya(this,Object.keys(e),(s=>{Ya(this,Object.values(e),(i=>{this.i._addFlatHashMapToInputStream(s,i,Object.keys(e).length,n,r)}))}))}))}addProtoToStream(e,t,r,n){m(this,r,(s=>{m(this,t,(i=>{const o=this.i._malloc(e.length);this.i.HEAPU8.set(e,o),this.i._addProtoToInputStream(o,e.length,i,s,n),this.i._free(o)}))}))}addEmptyPacketToStream(e,t){m(this,e,(r=>{this.i._addEmptyPacketToInputStream(r,t)}))}addBoolVectorToStream(e,t,r){m(this,t,(n=>{const s=this.i._allocateBoolVector(e.length);if(!s)throw Error("Unable to allocate new bool vector on heap.");for(const i of e)this.i._addBoolVectorEntry(s,i);this.i._addBoolVectorToInputStream(s,n,r)}))}addDoubleVectorToStream(e,t,r){m(this,t,(n=>{const s=this.i._allocateDoubleVector(e.length);if(!s)throw Error("Unable to allocate new double vector on heap.");for(const i of e)this.i._addDoubleVectorEntry(s,i);this.i._addDoubleVectorToInputStream(s,n,r)}))}addFloatVectorToStream(e,t,r){m(this,t,(n=>{const s=this.i._allocateFloatVector(e.length);if(!s)throw Error("Unable to allocate new float vector on heap.");for(const i of e)this.i._addFloatVectorEntry(s,i);this.i._addFloatVectorToInputStream(s,n,r)}))}addIntVectorToStream(e,t,r){m(this,t,(n=>{const s=this.i._allocateIntVector(e.length);if(!s)throw Error("Unable to allocate new int vector on heap.");for(const i of e)this.i._addIntVectorEntry(s,i);this.i._addIntVectorToInputStream(s,n,r)}))}addUintVectorToStream(e,t,r){m(this,t,(n=>{const s=this.i._allocateUintVector(e.length);if(!s)throw Error("Unable to allocate new unsigned int vector on heap.");for(const i of e)this.i._addUintVectorEntry(s,i);this.i._addUintVectorToInputStream(s,n,r)}))}addStringVectorToStream(e,t,r){m(this,t,(n=>{const s=this.i._allocateStringVector(e.length);if(!s)throw Error("Unable to allocate new string vector on heap.");for(const i of e)m(this,i,(o=>{this.i._addStringVectorEntry(s,o)}));this.i._addStringVectorToInputStream(s,n,r)}))}addBoolToInputSidePacket(e,t){m(this,t,(r=>{this.i._addBoolToInputSidePacket(e,r)}))}addDoubleToInputSidePacket(e,t){m(this,t,(r=>{this.i._addDoubleToInputSidePacket(e,r)}))}addFloatToInputSidePacket(e,t){m(this,t,(r=>{this.i._addFloatToInputSidePacket(e,r)}))}addIntToInputSidePacket(e,t){m(this,t,(r=>{this.i._addIntToInputSidePacket(e,r)}))}addUintToInputSidePacket(e,t){m(this,t,(r=>{this.i._addUintToInputSidePacket(e,r)}))}addStringToInputSidePacket(e,t){m(this,t,(r=>{m(this,e,(n=>{this.i._addStringToInputSidePacket(n,r)}))}))}addProtoToInputSidePacket(e,t,r){m(this,r,(n=>{m(this,t,(s=>{const i=this.i._malloc(e.length);this.i.HEAPU8.set(e,i),this.i._addProtoToInputSidePacket(i,e.length,s,n),this.i._free(i)}))}))}addBoolVectorToInputSidePacket(e,t){m(this,t,(r=>{const n=this.i._allocateBoolVector(e.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(const s of e)this.i._addBoolVectorEntry(n,s);this.i._addBoolVectorToInputSidePacket(n,r)}))}addDoubleVectorToInputSidePacket(e,t){m(this,t,(r=>{const n=this.i._allocateDoubleVector(e.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(const s of e)this.i._addDoubleVectorEntry(n,s);this.i._addDoubleVectorToInputSidePacket(n,r)}))}addFloatVectorToInputSidePacket(e,t){m(this,t,(r=>{const n=this.i._allocateFloatVector(e.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(const s of e)this.i._addFloatVectorEntry(n,s);this.i._addFloatVectorToInputSidePacket(n,r)}))}addIntVectorToInputSidePacket(e,t){m(this,t,(r=>{const n=this.i._allocateIntVector(e.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(const s of e)this.i._addIntVectorEntry(n,s);this.i._addIntVectorToInputSidePacket(n,r)}))}addUintVectorToInputSidePacket(e,t){m(this,t,(r=>{const n=this.i._allocateUintVector(e.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(const s of e)this.i._addUintVectorEntry(n,s);this.i._addUintVectorToInputSidePacket(n,r)}))}addStringVectorToInputSidePacket(e,t){m(this,t,(r=>{const n=this.i._allocateStringVector(e.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(const s of e)m(this,s,(i=>{this.i._addStringVectorEntry(n,i)}));this.i._addStringVectorToInputSidePacket(n,r)}))}attachBoolListener(e,t){Ve(this,e,t),m(this,e,(r=>{this.i._attachBoolListener(r)}))}attachBoolVectorListener(e,t){ct(this,e,t),m(this,e,(r=>{this.i._attachBoolVectorListener(r)}))}attachIntListener(e,t){Ve(this,e,t),m(this,e,(r=>{this.i._attachIntListener(r)}))}attachIntVectorListener(e,t){ct(this,e,t),m(this,e,(r=>{this.i._attachIntVectorListener(r)}))}attachUintListener(e,t){Ve(this,e,t),m(this,e,(r=>{this.i._attachUintListener(r)}))}attachUintVectorListener(e,t){ct(this,e,t),m(this,e,(r=>{this.i._attachUintVectorListener(r)}))}attachDoubleListener(e,t){Ve(this,e,t),m(this,e,(r=>{this.i._attachDoubleListener(r)}))}attachDoubleVectorListener(e,t){ct(this,e,t),m(this,e,(r=>{this.i._attachDoubleVectorListener(r)}))}attachFloatListener(e,t){Ve(this,e,t),m(this,e,(r=>{this.i._attachFloatListener(r)}))}attachFloatVectorListener(e,t){ct(this,e,t),m(this,e,(r=>{this.i._attachFloatVectorListener(r)}))}attachStringListener(e,t){Ve(this,e,t),m(this,e,(r=>{this.i._attachStringListener(r)}))}attachStringVectorListener(e,t){ct(this,e,t),m(this,e,(r=>{this.i._attachStringVectorListener(r)}))}attachProtoListener(e,t,r){Ve(this,e,t),m(this,e,(n=>{this.i._attachProtoListener(n,r||!1)}))}attachProtoVectorListener(e,t,r){ct(this,e,t),m(this,e,(n=>{this.i._attachProtoVectorListener(n,r||!1)}))}attachAudioListener(e,t,r){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),Ve(this,e,((n,s)=>{n=new Float32Array(n.buffer,n.byteOffset,n.length/4),t(n,s)})),m(this,e,(n=>{this.i._attachAudioListener(n,r||!1)}))}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends oc{get ga(){return this.i}pa(e,t,r){m(this,t,(n=>{const[s,i]=qa(this,e,n);this.ga._addBoundTextureAsImageToStream(n,s,i,r)}))}Z(e,t){Ve(this,e,t),m(this,e,(r=>{this.ga._attachImageListener(r)}))}aa(e,t){ct(this,e,t),m(this,e,(r=>{this.ga._attachImageVectorListener(r)}))}}));var oc,xe=class extends Bh{};async function w(e,t,r){return(async function(n,s,i,o){return Rh(n,s,i,o)})(e,r.canvas??(za()?void 0:document.createElement("canvas")),t,r)}function ac(e,t,r,n){if(e.U){const i=new da;if(r!=null&&r.regionOfInterest){if(!e.oa)throw Error("This task doesn't support region-of-interest.");var s=r.regionOfInterest;if(s.left>=s.right||s.top>=s.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(s.left<0||s.top<0||s.right>1||s.bottom>1)throw Error("Expected RectF values to be in [0,1].");y(i,1,(s.left+s.right)/2),y(i,2,(s.top+s.bottom)/2),y(i,4,s.right-s.left),y(i,3,s.bottom-s.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]=Ka(t);r=R(i,3)*a/o,s=R(i,4)*o/a,y(i,4,r),y(i,3,s)}}e.g.addProtoToStream(i.g(),"mediapipe.NormalizedRect",e.U,n)}e.g.pa(t,e.X,n??performance.now()),e.finishProcessing()}function $e(e,t,r){var n;if((n=e.baseOptions)!=null&&n.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");ac(e,t,r,e.C+1)}function Ge(e,t,r,n){var s;if(!((s=e.baseOptions)!=null&&s.g()))throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");ac(e,t,r,n)}function ur(e,t,r,n){var s=t.data;const i=t.width,o=i*(t=t.height);if((s instanceof Uint8Array||s instanceof Float32Array)&&s.length!==o)throw Error("Unsupported channel count: "+s.length/o);return e=new q([s],r,!1,e.g.i.canvas,e.P,i,t),n?e.clone():e}var fe=class extends Vs{constructor(e,t,r,n){super(e),this.g=e,this.X=t,this.U=r,this.oa=n,this.P=new tc}l(e,t=!0){if("runningMode"in e&&C(this.baseOptions,2,Ar(!!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()}};fe.prototype.close=fe.prototype.close;var pe=class extends fe{constructor(e,t){super(new xe(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},b(e=this.h=new vn,0,1,t=new $),y(this.h,2,.5),y(this.h,3,.3)}get baseOptions(){return E(this.h,$,1)}set baseOptions(e){b(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:[]},$e(this,e,t),this.j}G(e,t,r){return this.j={detections:[]},Ge(this,e,r,t),this.j}m(){var e=new de;x(e,"image_in"),x(e,"norm_rect_in"),A(e,"detections");const t=new le;De(t,vh,this.h);const r=new re;he(r,2,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),P(r,"IMAGE:image_in"),P(r,"NORM_RECT:norm_rect_in"),v(r,"DETECTIONS:detections"),r.o(t),Ce(e,r),this.g.attachProtoVectorListener("detections",((n,s)=>{for(const i of n)n=ha(i),this.j.detections.push(ja(n));d(this,s)})),this.g.attachEmptyPacketListener("detections",(n=>{d(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};pe.prototype.detectForVideo=pe.prototype.G,pe.prototype.detect=pe.prototype.F,pe.prototype.setOptions=pe.prototype.o,pe.createFromModelPath=async function(e,t){return w(pe,e,{baseOptions:{modelAssetPath:t}})},pe.createFromModelBuffer=function(e,t){return w(pe,e,{baseOptions:{modelAssetBuffer:t}})},pe.createFromOptions=function(e,t){return w(pe,e,t)};var Ks=Fe([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]),qs=Fe([263,249],[249,390],[390,373],[373,374],[374,380],[380,381],[381,382],[382,362],[263,466],[466,388],[388,387],[387,386],[386,385],[385,384],[384,398],[398,362]),Ys=Fe([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),cc=Fe([474,475],[475,476],[476,477],[477,474]),Xs=Fe([33,7],[7,163],[163,144],[144,145],[145,153],[153,154],[154,155],[155,133],[33,246],[246,161],[161,160],[160,159],[159,158],[158,157],[157,173],[173,133]),Qs=Fe([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),hc=Fe([469,470],[470,471],[471,472],[472,469]),Js=Fe([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]),uc=[...Ks,...qs,...Ys,...Xs,...Qs,...Js],lc=Fe([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 dc(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var O=class extends fe{constructor(e,t){super(new xe(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,b(e=this.h=new va,0,1,t=new $),this.A=new _a,b(this.h,0,3,this.A),this.u=new vn,b(this.h,0,2,this.u),Xe(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){b(this.h,0,1,e)}o(e){return"numFaces"in e&&Xe(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 dc(this),$e(this,e,t),this.j}G(e,t,r){return dc(this),Ge(this,e,r,t),this.j}m(){var e=new de;x(e,"image_in"),x(e,"norm_rect"),A(e,"face_landmarks");const t=new le;De(t,Eh,this.h);const r=new re;he(r,2,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),P(r,"IMAGE:image_in"),P(r,"NORM_RECT:norm_rect"),v(r,"NORM_LANDMARKS:face_landmarks"),r.o(t),Ce(e,r),this.g.attachProtoVectorListener("face_landmarks",((n,s)=>{for(const i of n)n=Fr(i),this.j.faceLandmarks.push(wn(n));d(this,s)})),this.g.attachEmptyPacketListener("face_landmarks",(n=>{d(this,n)})),this.outputFaceBlendshapes&&(A(e,"blendshapes"),v(r,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",((n,s)=>{if(this.outputFaceBlendshapes)for(const i of n)n=yn(i),this.j.faceBlendshapes.push(Ds(n.g()??[]));d(this,s)})),this.g.attachEmptyPacketListener("blendshapes",(n=>{d(this,n)}))),this.outputFacialTransformationMatrixes&&(A(e,"face_geometry"),v(r,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",((n,s)=>{if(this.outputFacialTransformationMatrixes)for(const i of n)(n=E(n=wh(i),dh,2))&&this.j.facialTransformationMatrixes.push({rows:ke(n,1)??0??0,columns:ke(n,2)??0??0,data:wt(n,3,Ne,vt()).slice()??[]});d(this,s)})),this.g.attachEmptyPacketListener("face_geometry",(n=>{d(this,n)}))),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 w(O,e,{baseOptions:{modelAssetPath:t}})},O.createFromModelBuffer=function(e,t){return w(O,e,{baseOptions:{modelAssetBuffer:t}})},O.createFromOptions=function(e,t){return w(O,e,t)},O.FACE_LANDMARKS_LIPS=Ks,O.FACE_LANDMARKS_LEFT_EYE=qs,O.FACE_LANDMARKS_LEFT_EYEBROW=Ys,O.FACE_LANDMARKS_LEFT_IRIS=cc,O.FACE_LANDMARKS_RIGHT_EYE=Xs,O.FACE_LANDMARKS_RIGHT_EYEBROW=Qs,O.FACE_LANDMARKS_RIGHT_IRIS=hc,O.FACE_LANDMARKS_FACE_OVAL=Js,O.FACE_LANDMARKS_CONTOURS=uc,O.FACE_LANDMARKS_TESSELATION=lc;var Zs=Fe([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 fc(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function pc(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 mc(e,t=!0){const r=[];for(const s of e){var n=yn(s);e=[];for(const i of n.g())n=t&&ke(i,1)!=null?ke(i,1)??0:-1,e.push({score:R(i,2)??0,index:n,categoryName:X(L(i,3))??""??"",displayName:X(L(i,4))??""??""});r.push(e)}return r}var me=class extends fe{constructor(e,t){super(new xe(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],b(e=this.j=new Aa,0,1,t=new $),this.u=new xs,b(this.j,0,2,this.u),this.D=new Fs,b(this.u,0,3,this.D),this.A=new Ea,b(this.u,0,2,this.A),this.h=new Ah,b(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){b(this.j,0,1,e)}o(e){var s,i,o,a;if(Xe(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 ar,r=t,n=Bs(e.cannedGesturesClassifierOptions,(s=E(this.h,ar,3))==null?void 0:s.l());b(r,0,2,n),b(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&((i=E(this.h,ar,3))==null||i.g());return e.customGesturesClassifierOptions?(b(r=t=new ar,0,2,n=Bs(e.customGesturesClassifierOptions,(o=E(this.h,ar,4))==null?void 0:o.l())),b(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&((a=E(this.h,ar,4))==null||a.g()),this.l(e)}Ha(e,t){return fc(this),$e(this,e,t),pc(this)}Ia(e,t,r){return fc(this),Ge(this,e,r,t),pc(this)}m(){var e=new de;x(e,"image_in"),x(e,"norm_rect"),A(e,"hand_gestures"),A(e,"hand_landmarks"),A(e,"world_hand_landmarks"),A(e,"handedness");const t=new le;De(t,kh,this.j);const r=new re;he(r,2,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),P(r,"IMAGE:image_in"),P(r,"NORM_RECT:norm_rect"),v(r,"HAND_GESTURES:hand_gestures"),v(r,"LANDMARKS:hand_landmarks"),v(r,"WORLD_LANDMARKS:world_hand_landmarks"),v(r,"HANDEDNESS:handedness"),r.o(t),Ce(e,r),this.g.attachProtoVectorListener("hand_landmarks",((n,s)=>{for(const i of n){n=Fr(i);const o=[];for(const a of Ye(n,la,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)}d(this,s)})),this.g.attachEmptyPacketListener("hand_landmarks",(n=>{d(this,n)})),this.g.attachProtoVectorListener("world_hand_landmarks",((n,s)=>{for(const i of n){n=or(i);const o=[];for(const a of Ye(n,ua,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)}d(this,s)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(n=>{d(this,n)})),this.g.attachProtoVectorListener("hand_gestures",((n,s)=>{this.gestures.push(...mc(n,!1)),d(this,s)})),this.g.attachEmptyPacketListener("hand_gestures",(n=>{d(this,n)})),this.g.attachProtoVectorListener("handedness",((n,s)=>{this.handedness.push(...mc(n)),d(this,s)})),this.g.attachEmptyPacketListener("handedness",(n=>{d(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function gc(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}me.prototype.recognizeForVideo=me.prototype.Ia,me.prototype.recognize=me.prototype.Ha,me.prototype.setOptions=me.prototype.o,me.createFromModelPath=function(e,t){return w(me,e,{baseOptions:{modelAssetPath:t}})},me.createFromModelBuffer=function(e,t){return w(me,e,{baseOptions:{modelAssetBuffer:t}})},me.createFromOptions=function(e,t){return w(me,e,t)},me.HAND_CONNECTIONS=Zs;var ge=class extends fe{constructor(e,t){super(new xe(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],b(e=this.h=new xs,0,1,t=new $),this.u=new Fs,b(this.h,0,3,this.u),this.j=new Ea,b(this.h,0,2,this.j),Xe(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){b(this.h,0,1,e)}o(e){return"numHands"in e&&Xe(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=[],$e(this,e,t),gc(this)}G(e,t,r){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Ge(this,e,r,t),gc(this)}m(){var e=new de;x(e,"image_in"),x(e,"norm_rect"),A(e,"hand_landmarks"),A(e,"world_hand_landmarks"),A(e,"handedness");const t=new le;De(t,Sh,this.h);const r=new re;he(r,2,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),P(r,"IMAGE:image_in"),P(r,"NORM_RECT:norm_rect"),v(r,"LANDMARKS:hand_landmarks"),v(r,"WORLD_LANDMARKS:world_hand_landmarks"),v(r,"HANDEDNESS:handedness"),r.o(t),Ce(e,r),this.g.attachProtoVectorListener("hand_landmarks",((n,s)=>{for(const i of n)n=Fr(i),this.landmarks.push(wn(n));d(this,s)})),this.g.attachEmptyPacketListener("hand_landmarks",(n=>{d(this,n)})),this.g.attachProtoVectorListener("world_hand_landmarks",((n,s)=>{for(const i of n)n=or(i),this.worldLandmarks.push(xr(n));d(this,s)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(n=>{d(this,n)})),this.g.attachProtoVectorListener("handedness",((n,s)=>{var i=this.handedness,o=i.push;const a=[];for(const c of n){n=yn(c);const u=[];for(const h of n.g())u.push({score:R(h,2)??0,index:ke(h,1)??0??-1,categoryName:X(L(h,3))??""??"",displayName:X(L(h,4))??""??""});a.push(u)}o.call(i,...a),d(this,s)})),this.g.attachEmptyPacketListener("handedness",(n=>{d(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ge.prototype.detectForVideo=ge.prototype.G,ge.prototype.detect=ge.prototype.F,ge.prototype.setOptions=ge.prototype.o,ge.createFromModelPath=function(e,t){return w(ge,e,{baseOptions:{modelAssetPath:t}})},ge.createFromModelBuffer=function(e,t){return w(ge,e,{baseOptions:{modelAssetBuffer:t}})},ge.createFromOptions=function(e,t){return w(ge,e,t)},ge.HAND_CONNECTIONS=Zs;var yc=Fe([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 bc(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function _c(e){try{if(!e.D)return e.h;e.D(e.h)}finally{kn(e)}}function Cn(e,t){e=Fr(e),t.push(wn(e))}var M=class extends fe{constructor(e,t){super(new xe(e,t),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,b(e=this.j=new Pa,0,1,t=new $),this.I=new Fs,b(this.j,0,2,this.I),this.W=new Ch,b(this.j,0,3,this.W),this.u=new vn,b(this.j,0,4,this.u),this.O=new _a,b(this.j,0,5,this.O),this.A=new Ta,b(this.j,0,6,this.A),this.M=new La,b(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){b(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 n=typeof t!="function"?t:{};return this.D=typeof t=="function"?t:r,bc(this),$e(this,e,n),_c(this)}G(e,t,r,n){const s=typeof r!="function"?r:{};return this.D=typeof r=="function"?r:n,bc(this),Ge(this,e,s,t),_c(this)}m(){var e=new de;x(e,"input_frames_image"),A(e,"pose_landmarks"),A(e,"pose_world_landmarks"),A(e,"face_landmarks"),A(e,"left_hand_landmarks"),A(e,"left_hand_world_landmarks"),A(e,"right_hand_landmarks"),A(e,"right_hand_world_landmarks");const t=new le,r=new Wo;he(r,1,"type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),(function(s,i){if(i!=null)if(Array.isArray(i))C(s,2,Zr(i,0,Cr));else{if(!(typeof i=="string"||i instanceof Ie||Un(i)))throw Error("invalid value in Any.value field: "+i+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");nt(s,2,jn(i,!1),pt())}})(r,this.j.g());const n=new re;he(n,2,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),cs(n,8,Wo,r),P(n,"IMAGE:input_frames_image"),v(n,"POSE_LANDMARKS:pose_landmarks"),v(n,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),v(n,"FACE_LANDMARKS:face_landmarks"),v(n,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),v(n,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),v(n,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),v(n,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),n.o(t),Ce(e,n),An(this,e),this.g.attachProtoListener("pose_landmarks",((s,i)=>{Cn(s,this.h.poseLandmarks),d(this,i)})),this.g.attachEmptyPacketListener("pose_landmarks",(s=>{d(this,s)})),this.g.attachProtoListener("pose_world_landmarks",((s,i)=>{var o=this.h.poseWorldLandmarks;s=or(s),o.push(xr(s)),d(this,i)})),this.g.attachEmptyPacketListener("pose_world_landmarks",(s=>{d(this,s)})),this.outputPoseSegmentationMasks&&(v(n,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),cr(this,"pose_segmentation_mask"),this.g.Z("pose_segmentation_mask",((s,i)=>{this.h.poseSegmentationMasks=[ur(this,s,!0,!this.D)],d(this,i)})),this.g.attachEmptyPacketListener("pose_segmentation_mask",(s=>{this.h.poseSegmentationMasks=[],d(this,s)}))),this.g.attachProtoListener("face_landmarks",((s,i)=>{Cn(s,this.h.faceLandmarks),d(this,i)})),this.g.attachEmptyPacketListener("face_landmarks",(s=>{d(this,s)})),this.outputFaceBlendshapes&&(A(e,"extra_blendshapes"),v(n,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",((s,i)=>{var o=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(s=yn(s),o.push(Ds(s.g()??[]))),d(this,i)})),this.g.attachEmptyPacketListener("extra_blendshapes",(s=>{d(this,s)}))),this.g.attachProtoListener("left_hand_landmarks",((s,i)=>{Cn(s,this.h.leftHandLandmarks),d(this,i)})),this.g.attachEmptyPacketListener("left_hand_landmarks",(s=>{d(this,s)})),this.g.attachProtoListener("left_hand_world_landmarks",((s,i)=>{var o=this.h.leftHandWorldLandmarks;s=or(s),o.push(xr(s)),d(this,i)})),this.g.attachEmptyPacketListener("left_hand_world_landmarks",(s=>{d(this,s)})),this.g.attachProtoListener("right_hand_landmarks",((s,i)=>{Cn(s,this.h.rightHandLandmarks),d(this,i)})),this.g.attachEmptyPacketListener("right_hand_landmarks",(s=>{d(this,s)})),this.g.attachProtoListener("right_hand_world_landmarks",((s,i)=>{var o=this.h.rightHandWorldLandmarks;s=or(s),o.push(xr(s)),d(this,i)})),this.g.attachEmptyPacketListener("right_hand_world_landmarks",(s=>{d(this,s)})),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 w(M,e,{baseOptions:{modelAssetPath:t}})},M.createFromModelBuffer=function(e,t){return w(M,e,{baseOptions:{modelAssetBuffer:t}})},M.createFromOptions=function(e,t){return w(M,e,t)},M.HAND_CONNECTIONS=Zs,M.POSE_CONNECTIONS=yc,M.FACE_LANDMARKS_LIPS=Ks,M.FACE_LANDMARKS_LEFT_EYE=qs,M.FACE_LANDMARKS_LEFT_EYEBROW=Ys,M.FACE_LANDMARKS_LEFT_IRIS=cc,M.FACE_LANDMARKS_RIGHT_EYE=Xs,M.FACE_LANDMARKS_RIGHT_EYEBROW=Qs,M.FACE_LANDMARKS_RIGHT_IRIS=hc,M.FACE_LANDMARKS_FACE_OVAL=Js,M.FACE_LANDMARKS_CONTOURS=uc,M.FACE_LANDMARKS_TESSELATION=lc;var Te=class extends fe{constructor(e,t){super(new xe(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},b(e=this.h=new Ma,0,1,t=new $)}get baseOptions(){return E(this.h,$,1)}set baseOptions(e){b(this.h,0,1,e)}o(e){return b(this.h,0,2,Bs(e,E(this.h,Ls,2))),this.l(e)}sa(e,t){return this.j={classifications:[]},$e(this,e,t),this.j}ta(e,t,r){return this.j={classifications:[]},Ge(this,e,r,t),this.j}m(){var e=new de;x(e,"input_image"),x(e,"norm_rect"),A(e,"classifications");const t=new le;De(t,Th,this.h);const r=new re;he(r,2,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),P(r,"IMAGE:input_image"),P(r,"NORM_RECT:norm_rect"),v(r,"CLASSIFICATIONS:classifications"),r.o(t),Ce(e,r),this.g.attachProtoListener("classifications",((n,s)=>{this.j=$h(mh(n)),d(this,s)})),this.g.attachEmptyPacketListener("classifications",(n=>{d(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Te.prototype.classifyForVideo=Te.prototype.ta,Te.prototype.classify=Te.prototype.sa,Te.prototype.setOptions=Te.prototype.o,Te.createFromModelPath=function(e,t){return w(Te,e,{baseOptions:{modelAssetPath:t}})},Te.createFromModelBuffer=function(e,t){return w(Te,e,{baseOptions:{modelAssetBuffer:t}})},Te.createFromOptions=function(e,t){return w(Te,e,t)};var ye=class extends fe{constructor(e,t){super(new xe(e,t),"image_in","norm_rect",!0),this.h=new Fa,this.embeddings={embeddings:[]},b(e=this.h,0,1,t=new $)}get baseOptions(){return E(this.h,$,1)}set baseOptions(e){b(this.h,0,1,e)}o(e){var t=this.h,r=E(this.h,ga,2);return r=r?r.clone():new ga,e.l2Normalize!==void 0?C(r,1,Ar(e.l2Normalize)):"l2Normalize"in e&&C(r,1),e.quantize!==void 0?C(r,2,Ar(e.quantize)):"quantize"in e&&C(r,2),b(t,0,2,r),this.l(e)}za(e,t){return $e(this,e,t),this.embeddings}Aa(e,t,r){return Ge(this,e,r,t),this.embeddings}m(){var e=new de;x(e,"image_in"),x(e,"norm_rect"),A(e,"embeddings_out");const t=new le;De(t,Lh,this.h);const r=new re;he(r,2,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),P(r,"IMAGE:image_in"),P(r,"NORM_RECT:norm_rect"),v(r,"EMBEDDINGS:embeddings_out"),r.o(t),Ce(e,r),this.g.attachProtoListener("embeddings_out",((n,s)=>{n=bh(n),this.embeddings=(function(i){return{embeddings:Ye(i,yh,1).map((o=>{var u,h;const a={headIndex:ke(o,3)??0??-1,headName:X(L(o,4))??""??""};var c=o.v;return ho(c,0|c[f],fa,ss(o,1))!==void 0?(o=wt(o=E(o,fa,ss(o,1),void 0),1,Ne,vt()),a.floatEmbedding=o.slice()):(c=new Uint8Array(0),a.quantizedEmbedding=((h=(u=E(o,gh,ss(o,2),void 0))==null?void 0:u.na())==null?void 0:h.h())??c),a})),timestampMs:Da(fo(i))}})(n),d(this,s)})),this.g.attachEmptyPacketListener("embeddings_out",(n=>{d(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ye.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=Ga(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=Ga(Va(e.quantizedEmbedding),Va(t.quantizedEmbedding))}return e},ye.prototype.embedForVideo=ye.prototype.Aa,ye.prototype.embed=ye.prototype.za,ye.prototype.setOptions=ye.prototype.o,ye.createFromModelPath=function(e,t){return w(ye,e,{baseOptions:{modelAssetPath:t}})},ye.createFromModelBuffer=function(e,t){return w(ye,e,{baseOptions:{modelAssetBuffer:t}})},ye.createFromOptions=function(e,t){return w(ye,e,t)};var ei=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 Dh(e){var r,n;const t=(function(s){return Ye(s,re,1)})(e.ca()).filter((s=>(X(L(s,1))??"").includes("mediapipe.tasks.TensorsToSegmentationCalculator")));if(e.u=[],t.length>1)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");t.length===1&&(((n=(r=E(t[0],le,7))==null?void 0:r.j())==null?void 0:n.g())??new Map).forEach(((s,i)=>{e.u[Number(i)]=X(L(s,1))??""}))}function vc(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function wc(e){try{const t=new ei(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{kn(e)}}ei.prototype.close=ei.prototype.close;var ne=class extends fe{constructor(e,t){super(new xe(e,t),"image_in","norm_rect",!1),this.u=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Is,this.A=new xa,b(this.h,0,3,this.A),b(e=this.h,0,1,t=new $)}get baseOptions(){return E(this.h,$,1)}set baseOptions(e){b(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?C(this.h,2,Sr(e.displayNamesLocale)):"displayNamesLocale"in e&&C(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}L(){Dh(this)}segment(e,t,r){const n=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:r,vc(this),$e(this,e,n),wc(this)}La(e,t,r,n){const s=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:n,vc(this),Ge(this,e,s,t),wc(this)}Da(){return this.u}m(){var e=new de;x(e,"image_in"),x(e,"norm_rect");const t=new le;De(t,Ra,this.h);const r=new re;he(r,2,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),P(r,"IMAGE:image_in"),P(r,"NORM_RECT:norm_rect"),r.o(t),Ce(e,r),An(this,e),this.outputConfidenceMasks&&(A(e,"confidence_masks"),v(r,"CONFIDENCE_MASKS:confidence_masks"),cr(this,"confidence_masks"),this.g.aa("confidence_masks",((n,s)=>{this.confidenceMasks=n.map((i=>ur(this,i,!0,!this.j))),d(this,s)})),this.g.attachEmptyPacketListener("confidence_masks",(n=>{this.confidenceMasks=[],d(this,n)}))),this.outputCategoryMask&&(A(e,"category_mask"),v(r,"CATEGORY_MASK:category_mask"),cr(this,"category_mask"),this.g.Z("category_mask",((n,s)=>{this.categoryMask=ur(this,n,!1,!this.j),d(this,s)})),this.g.attachEmptyPacketListener("category_mask",(n=>{this.categoryMask=void 0,d(this,n)}))),A(e,"quality_scores"),v(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((n,s)=>{this.qualityScores=n,d(this,s)})),this.g.attachEmptyPacketListener("quality_scores",(n=>{this.categoryMask=void 0,d(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ne.prototype.getLabels=ne.prototype.Da,ne.prototype.segmentForVideo=ne.prototype.La,ne.prototype.segment=ne.prototype.segment,ne.prototype.setOptions=ne.prototype.o,ne.createFromModelPath=function(e,t){return w(ne,e,{baseOptions:{modelAssetPath:t}})},ne.createFromModelBuffer=function(e,t){return w(ne,e,{baseOptions:{modelAssetBuffer:t}})},ne.createFromOptions=function(e,t){return w(ne,e,t)};var ti=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()}};ti.prototype.close=ti.prototype.close;var He=class extends fe{constructor(e,t){super(new xe(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Is,this.u=new xa,b(this.h,0,3,this.u),b(e=this.h,0,1,t=new $)}get baseOptions(){return E(this.h,$,1)}set baseOptions(e){b(this.h,0,1,e)}o(e){return"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}segment(e,t,r,n){const s=typeof r!="function"?r:{};if(this.j=typeof r=="function"?r:n,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,r=this.C+1,n=new Ua,t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var i=new Us;nt(i,3,Ar(!0),!1),nt(i,1,Er(t.keypoint.x),0),nt(i,2,Er(t.keypoint.y),0),Tr(n,1,Ns,i)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");{const a=new Mh;for(i of t.scribble)nt(t=new Us,3,Ar(!0),!1),nt(t,1,Er(i.x),0),nt(t,2,Er(i.y),0),cs(a,1,Us,t);Tr(n,2,Ns,a)}}this.g.addProtoToStream(n.g(),"mediapipe.tasks.vision.interactive_segmenter.proto.RegionOfInterest","roi_in",r),$e(this,e,s);e:{try{const a=new ti(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var o=a;break e}this.j(a)}finally{kn(this)}o=void 0}return o}m(){var e=new de;x(e,"image_in"),x(e,"roi_in"),x(e,"norm_rect_in");const t=new le;De(t,Ra,this.h);const r=new re;he(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),Ce(e,r),An(this,e),this.outputConfidenceMasks&&(A(e,"confidence_masks"),v(r,"CONFIDENCE_MASKS:confidence_masks"),cr(this,"confidence_masks"),this.g.aa("confidence_masks",((n,s)=>{this.confidenceMasks=n.map((i=>ur(this,i,!0,!this.j))),d(this,s)})),this.g.attachEmptyPacketListener("confidence_masks",(n=>{this.confidenceMasks=[],d(this,n)}))),this.outputCategoryMask&&(A(e,"category_mask"),v(r,"CATEGORY_MASK:category_mask"),cr(this,"category_mask"),this.g.Z("category_mask",((n,s)=>{this.categoryMask=ur(this,n,!1,!this.j),d(this,s)})),this.g.attachEmptyPacketListener("category_mask",(n=>{this.categoryMask=void 0,d(this,n)}))),A(e,"quality_scores"),v(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((n,s)=>{this.qualityScores=n,d(this,s)})),this.g.attachEmptyPacketListener("quality_scores",(n=>{this.categoryMask=void 0,d(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};He.prototype.segment=He.prototype.segment,He.prototype.setOptions=He.prototype.o,He.createFromModelPath=function(e,t){return w(He,e,{baseOptions:{modelAssetPath:t}})},He.createFromModelBuffer=function(e,t){return w(He,e,{baseOptions:{modelAssetBuffer:t}})},He.createFromOptions=function(e,t){return w(He,e,t)};var Le=class extends fe{constructor(e,t){super(new xe(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},b(e=this.h=new Na,0,1,t=new $)}get baseOptions(){return E(this.h,$,1)}set baseOptions(e){b(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?C(this.h,2,Sr(e.displayNamesLocale)):"displayNamesLocale"in e&&C(this.h,2),e.maxResults!==void 0?Xe(this.h,3,e.maxResults):"maxResults"in e&&C(this.h,3),e.scoreThreshold!==void 0?y(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&C(this.h,4),e.categoryAllowlist!==void 0?en(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&C(this.h,5),e.categoryDenylist!==void 0?en(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&C(this.h,6),this.l(e)}F(e,t){return this.j={detections:[]},$e(this,e,t),this.j}G(e,t,r){return this.j={detections:[]},Ge(this,e,r,t),this.j}m(){var e=new de;x(e,"input_frame_gpu"),x(e,"norm_rect"),A(e,"detections");const t=new le;De(t,Fh,this.h);const r=new re;he(r,2,"mediapipe.tasks.vision.ObjectDetectorGraph"),P(r,"IMAGE:input_frame_gpu"),P(r,"NORM_RECT:norm_rect"),v(r,"DETECTIONS:detections"),r.o(t),Ce(e,r),this.g.attachProtoVectorListener("detections",((n,s)=>{for(const i of n)n=ha(i),this.j.detections.push(ja(n));d(this,s)})),this.g.attachEmptyPacketListener("detections",(n=>{d(this,n)})),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=async function(e,t){return w(Le,e,{baseOptions:{modelAssetPath:t}})},Le.createFromModelBuffer=function(e,t){return w(Le,e,{baseOptions:{modelAssetBuffer:t}})},Le.createFromOptions=function(e,t){return w(Le,e,t)};var ri=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 Ec(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function Ac(e){try{const t=new ri(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.u)return t;e.u(t)}finally{kn(e)}}ri.prototype.close=ri.prototype.close;var be=class extends fe{constructor(e,t){super(new xe(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,b(e=this.h=new Ba,0,1,t=new $),this.A=new La,b(this.h,0,3,this.A),this.j=new Ta,b(this.h,0,2,this.j),Xe(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){b(this.h,0,1,e)}o(e){return"numPoses"in e&&Xe(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 n=typeof t!="function"?t:{};return this.u=typeof t=="function"?t:r,Ec(this),$e(this,e,n),Ac(this)}G(e,t,r,n){const s=typeof r!="function"?r:{};return this.u=typeof r=="function"?r:n,Ec(this),Ge(this,e,s,t),Ac(this)}m(){var e=new de;x(e,"image_in"),x(e,"norm_rect"),A(e,"normalized_landmarks"),A(e,"world_landmarks"),A(e,"segmentation_masks");const t=new le;De(t,xh,this.h);const r=new re;he(r,2,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),P(r,"IMAGE:image_in"),P(r,"NORM_RECT:norm_rect"),v(r,"NORM_LANDMARKS:normalized_landmarks"),v(r,"WORLD_LANDMARKS:world_landmarks"),r.o(t),Ce(e,r),An(this,e),this.g.attachProtoVectorListener("normalized_landmarks",((n,s)=>{this.landmarks=[];for(const i of n)n=Fr(i),this.landmarks.push(wn(n));d(this,s)})),this.g.attachEmptyPacketListener("normalized_landmarks",(n=>{this.landmarks=[],d(this,n)})),this.g.attachProtoVectorListener("world_landmarks",((n,s)=>{this.worldLandmarks=[];for(const i of n)n=or(i),this.worldLandmarks.push(xr(n));d(this,s)})),this.g.attachEmptyPacketListener("world_landmarks",(n=>{this.worldLandmarks=[],d(this,n)})),this.outputSegmentationMasks&&(v(r,"SEGMENTATION_MASK:segmentation_masks"),cr(this,"segmentation_masks"),this.g.aa("segmentation_masks",((n,s)=>{this.segmentationMasks=n.map((i=>ur(this,i,!0,!this.u))),d(this,s)})),this.g.attachEmptyPacketListener("segmentation_masks",(n=>{this.segmentationMasks=[],d(this,n)}))),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=function(e,t){return w(be,e,{baseOptions:{modelAssetPath:t}})},be.createFromModelBuffer=function(e,t){return w(be,e,{baseOptions:{modelAssetBuffer:t}})},be.createFromOptions=function(e,t){return w(be,e,t)},be.POSE_CONNECTIONS=yc;const kc=.1,Sc=.42,ni=.24,si=.14,ii=.18,Cc=.12,jh=0,Vh=1,Gh=2;function Tc(e){var h;const{detections:t,width:r,height:n}=e;if(t.length===0)return{hasFace:!1,faceCount:0,confidence:0,captureScore: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:((h=t[0])==null?void 0:h.confidence)??0,captureScore:0,isCentered:!1,passesQualityChecks:!1,feedback:"multiple-faces",message:"Multiple faces detected. Make sure only one person is in view."};const s=t[0],i=s.boundingBox;if(!i)return{hasFace:!0,faceCount:1,confidence:s.confidence,captureScore:0,isCentered:!1,passesQualityChecks:!1,feedback:"face-unclear",message:"Face detected, but the frame is unclear. Hold still and try again."};const o=i.width*i.height/(r*n);if(o<kc)return Lt(s.confidence,"too-far","Move closer to the camera.");if(o>Sc)return Lt(s.confidence,"too-close","Move slightly farther away.");const a=(i.originX+i.width/2)/r,c=(i.originY+i.height/2)/n;if(a<.5-si)return Lt(s.confidence,"move-right","Move your face a little to the right.");if(a>.5+si)return Lt(s.confidence,"move-left","Move your face a little to the left.");if(c<.5-ii)return Lt(s.confidence,"move-down","Move your face slightly down.");if(c>.5+ii)return Lt(s.confidence,"move-up","Move your face slightly up.");const u=Hh(s.keypoints);return u?Lt(s.confidence,u.feedback,u.message):{hasFace:!0,faceCount:1,confidence:s.confidence,captureScore:zh(s.confidence,a,c,o),isCentered:!0,passesQualityChecks:!0,feedback:"good",message:"Hold still. Capturing automatically..."}}function Hh(e){const t=e[jh],r=e[Vh],n=e[Gh];if(!t||!r||!n)return null;const s=(t.x+r.x)/2,i=Math.abs(r.x-t.x);if(i===0)return null;const o=(n.x-s)/i;return o<=-Cc?{feedback:"turn-right",message:"Turn slightly right so your face points at the camera."}:o>=Cc?{feedback:"turn-left",message:"Turn slightly left so your face points at the camera."}:null}function Lt(e,t,r){return{hasFace:!0,faceCount:1,confidence:e,captureScore:0,isCentered:!1,passesQualityChecks:!1,feedback:t,message:r}}function V1(e){return e}function zh(e,t,r,n){const s=Math.abs(t-.5)/si,i=Math.abs(r-.5)/ii,o=1-Math.min((s+i)/2,1),a=Math.max(Math.abs(ni-kc),Math.abs(Sc-ni)),c=1-Math.min(Math.abs(n-ni)/a,1);return Number((e*.55+o*.3+c*.15).toFixed(4))}const Wh="https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision/wasm",Kh="https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/1/blaze_face_short_range.tflite",qh=.7;let Lc=null,Pc=null,Mc=null;function Yh(){return Lc??(Lc=Tt.forVisionTasks(Wh)),Lc}function Xh(){return Pc??(Pc=xc("IMAGE")),Pc}function Fc(){return Mc??(Mc=xc("VIDEO")),Mc}async function xc(e){const t=await Yh();return pe.createFromOptions(t,{baseOptions:{modelAssetPath:Kh},runningMode:e,minDetectionConfidence:qh})}async function oi(e){const r=(await Xh()).detect(e);return Tc({detections:$c(r.detections),width:e.naturalWidth,height:e.naturalHeight})}async function ai(e,t){const n=(await Fc()).detectForVideo(e,t);return Tc({detections:$c(n.detections),width:e.videoWidth,height:e.videoHeight})}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(n=>({x:n.x,y:n.y}))}})}const Qh="2147483647",Jh=180,Zh=3;async function ci(){var t;if(n1())return r1();if(!((t=navigator.mediaDevices)!=null&&t.getUserMedia))throw new Error("In-browser camera capture is not supported in this browser.");const e=await e1()?"auto":"manual";return t1(e)}async function e1(){if(typeof window.requestAnimationFrame!="function"||typeof window.cancelAnimationFrame!="function"||!document.createElement("canvas").getContext("2d"))return!1;try{return await Fc(),!0}catch{return!1}}async function t1(e){let t;try{t=await navigator.mediaDevices.getUserMedia({video:{facingMode:{ideal:"user"}},audio:!1})}catch(s){throw new Error(c1(s))}let r=!1;const n=()=>{r||(r=!0,t.getTracks().forEach(s=>s.stop()))};return new Promise((s,i)=>{let o=!1,a=e,c=null,u="",h=null,l=null,g=null,_=0,S=0,Ot=!1,Pe=!1,Ze=!1;const Gr=()=>{l!==null&&window.cancelAnimationFrame(l),g&&window.removeEventListener("keydown",g),u&&URL.revokeObjectURL(u),n(),c==null||c.remove()},ze=(se,We)=>{if(!o){if(o=!0,Gr(),We){i(We);return}s(se)}},_i=(se,We,Oe,Re,we,H,te,Ee)=>{Pe=!1,S=0,u&&(URL.revokeObjectURL(u),u=""),h=null,We.replaceChildren(se,a1()),Ze&&i1(se),Oe.textContent=a==="auto"?"Center your face":"Take a face photo",Re.textContent=a==="auto"?"Keep your face inside the oval. We will capture automatically when the framing looks good.":"Line up your face in the oval, then take a photo manually.",we.textContent=a==="auto"?"Looking for a single face in frame...":"When you are ready, press Take photo.",Ln(we,a==="auto"?"neutral":"manual"),Ee.style.display=a==="manual"?"inline-flex":"none",Ee.disabled=!0,H.replaceChildren(te,Ee)},e2=(se,We,Oe,Re,we,H,te,Ee,et,Ae,Z)=>{Pe=!0,S=0,u&&URL.revokeObjectURL(u),u=URL.createObjectURL(Ae),h=Ae;const tt=document.createElement("img");tt.alt="Captured face preview",tt.src=u,J(tt,{position:"absolute",inset:"0",zIndex:"1",width:"100%",height:"100%",objectFit:"cover"}),We.replaceChildren(se,tt),Oe.textContent="Review your photo",Re.textContent=(Z==null?void 0:Z.passesQualityChecks)===!1?"The capture did not pass the checks. Retake the photo.":"Confirm this photo or retake it.",we.textContent=(Z==null?void 0:Z.message)??"Review the captured image before continuing.",Ln(we,Z?Z.passesQualityChecks?"success":"error":"manual"),H.replaceChildren(te,et),(Z==null?void 0:Z.passesQualityChecks)!==!1&&H.append(Ee)};try{let se=function(){o||Pe||a!=="auto"||(l=window.requestAnimationFrame(async ie=>{if(Pe||Ot||ie-_<Jh){se();return}_=ie,Ot=!0;try{const Rt=await ai(H,ie);if(te.textContent=Rt.message,Ln(te,Rt.passesQualityChecks?"success":"neutral"),Rt.passesQualityChecks?S+=1:S=0,S>=Zh){const j1=await Oc(H);e2(H,we,Oe,Re,te,Ee,et,Z,tt,j1,Rt);return}}catch{a="manual",_i(H,we,Oe,Re,te,Ee,et,Ae),Ae.disabled=!1,te.textContent="Automatic capture is unavailable in this browser. Use Take photo instead.",Ln(te,"manual")}finally{Ot=!1}se()}))};c=document.createElement("div"),c.setAttribute("data-simface-camera-overlay","true"),c.setAttribute("role","dialog"),c.setAttribute("aria-modal","true"),J(c,{position:"fixed",inset:"0",zIndex:Qh,display:"flex",alignItems:"center",justifyContent:"center",padding:"24px",background:"rgba(15, 23, 42, 0.82)"});const We=document.createElement("div");J(We,{width:"min(100%, 560px)",display:"flex",flexDirection:"column",gap:"16px",padding:"20px",borderRadius:"20px",background:"#020617",color:"#e2e8f0",boxShadow:"0 24px 60px rgba(15, 23, 42, 0.35)"});const Oe=document.createElement("h2");J(Oe,{margin:"0",fontSize:"1.25rem",fontWeight:"700"});const Re=document.createElement("p");J(Re,{margin:"0",color:"#cbd5e1",fontSize:"0.95rem",lineHeight:"1.5"});const we=document.createElement("div");J(we,{position:"relative",overflow:"hidden",width:"100%",aspectRatio:"3 / 4",minHeight:"320px",borderRadius:"18px",background:"#000"});const H=document.createElement("video");H.autoplay=!0,H.muted=!0,H.playsInline=!0,H.srcObject=t,J(H,{width:"100%",height:"100%",objectFit:"cover"});const te=document.createElement("div");J(te,{borderRadius:"14px",padding:"12px 14px",font:'600 14px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'});const Ee=document.createElement("div");J(Ee,{display:"flex",flexWrap:"wrap",gap:"12px",justifyContent:"flex-end"});const et=Tn("Cancel","secondary");et.dataset.simfaceAction="cancel";const Ae=Tn("Take photo","primary");Ae.dataset.simfaceAction="capture",Ae.style.display=a==="manual"?"inline-flex":"none",Ae.disabled=!0;const Z=Tn("Use photo","primary");Z.dataset.simfaceAction="confirm";const tt=Tn("Retake","secondary");tt.dataset.simfaceAction="retake",We.append(Oe,Re,we,te,Ee),c.append(We),document.body.appendChild(c),_i(H,we,Oe,Re,te,Ee,et,Ae),g=ie=>{ie.key==="Escape"&&ze(null)},et.addEventListener("click",()=>ze(null)),Z.addEventListener("click",async()=>{if(!h){ze(null,new Error("Failed to confirm the photo."));return}ze(h)}),tt.addEventListener("click",()=>{_i(H,we,Oe,Re,te,Ee,et,Ae),a==="manual"&&Ze&&(Ae.disabled=!1),a==="auto"&&se()}),Ae.addEventListener("click",async()=>{if(!Pe)try{const ie=await Oc(H),Rt=await o1(ie);e2(H,we,Oe,Re,te,Ee,et,Z,tt,ie,Rt)}catch(ie){ze(null,ie instanceof Error?ie:new Error("Failed to capture an image."))}}),window.addEventListener("keydown",g),s1(H).then(()=>{if(Ze=!0,a==="manual"){Ae.disabled=!1;return}se()}).catch(ie=>{ze(null,ie instanceof Error?ie:new Error("Failed to start the camera preview."))})}catch(se){ze(null,se instanceof Error?se:new Error("Failed to open the camera capture UI."))}})}function r1(){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 s=((i=t.files)==null?void 0:i[0])??null;n(),e(s)});const r=()=>{setTimeout(()=>{var s;(s=t.files)!=null&&s.length||(n(),e(null))},500)};window.addEventListener("focus",r,{once:!0});function n(){window.removeEventListener("focus",r),t.remove()}document.body.appendChild(t),t.click()})}function n1(){return/WhatsApp/i.test(navigator.userAgent)}async function s1(e){if(e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA){await e.play();return}await new Promise((t,r)=>{const n=()=>{i(),t()},s=()=>{i(),r(new Error("Failed to start the camera preview."))},i=()=>{e.removeEventListener("loadedmetadata",n),e.removeEventListener("error",s)};e.addEventListener("loadedmetadata",n,{once:!0}),e.addEventListener("error",s,{once:!0})}),await e.play()}function Oc(e){if(!e.videoWidth||!e.videoHeight)return Promise.reject(new Error("Camera preview is not ready yet."));const t=document.createElement("canvas");t.width=e.videoWidth,t.height=e.videoHeight;const r=t.getContext("2d");return r?(r.drawImage(e,0,0,t.width,t.height),new Promise((n,s)=>{t.toBlob(i=>{if(!i){s(new Error("Failed to capture an image."));return}n(i)},"image/jpeg",.92)})):Promise.reject(new Error("Failed to initialize camera capture."))}function i1(e){e.play().catch(()=>{})}async function o1(e){try{const t=await hi(e);return await oi(t)}catch{return null}}function Tn(e,t){const r=document.createElement("button");return r.type="button",r.textContent=e,J(r,{display:"inline-flex",alignItems:"center",justifyContent:"center",border:"none",borderRadius:"999px",padding:"12px 18px",font:'600 15px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',cursor:"pointer",color:t==="primary"?"#fff":"#0f172a",background:t==="primary"?"#2563eb":"#e2e8f0"}),r}function a1(){const e=document.createElement("div");J(e,{position:"absolute",inset:"0",pointerEvents:"none"});const t=document.createElement("div");return J(t,{position:"absolute",left:"50%",top:"50%",width:"64%",height:"76%",transform:"translate(-50%, -50%)",borderRadius:"999px",border:"3px solid rgba(255, 255, 255, 0.9)",boxShadow:"0 0 0 9999px rgba(2, 6, 23, 0.34)"}),e.append(t),e}function Ln(e,t){switch(t){case"success":J(e,{background:"#dcfce7",color:"#166534"});return;case"error":J(e,{background:"#fee2e2",color:"#991b1b"});return;case"manual":J(e,{background:"#e0f2fe",color:"#0f172a"});return;default:J(e,{background:"#e2e8f0",color:"#0f172a"})}}function J(e,t){Object.assign(e.style,t)}function c1(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 hi(e){return new Promise((t,r)=>{const n=URL.createObjectURL(e),s=new Image;s.onload=()=>{URL.revokeObjectURL(n),t(s)},s.onerror=()=>{URL.revokeObjectURL(n),r(new Error("Failed to load captured image"))},s.src=n})}function h1(e){return new Promise((t,r)=>{const n=new FileReader;n.onload=()=>t(n.result),n.onerror=()=>r(new Error("Failed to read image")),n.readAsDataURL(e)})}/**
15
+ }`,e.VERTEX_SHADER),this.W=Va(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 Ve(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 On(e){var t=Ve(e,1);if(!t){if(t=Ve(e,0))t=new Float32Array(t).map((s=>s/255));else{t=new Float32Array(e.width*e.height);const s=Qt(e);var r=$n(e);if(za(r,s,Ka(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 Ka(e){let t=Ve(e,2);if(!t){const r=Qt(e);t=Xa(e);const s=On(e),n=qa(e);r.texImage2D(r.TEXTURE_2D,0,n,e.width,e.height,0,r.RED,r.FLOAT,s),Rn(e)}return t}function Qt(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=Qe(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function qa(e){if(e=Qt(e),!ds)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))ds=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");ds=e.R16F}return ds}function $n(e){return e.l||(e.l=new Wa),e.l}function Xa(e){const t=Qt(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=Ve(e,2);return r||(r=Ha($n(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(r),e.j=!0),t.bindTexture(t.TEXTURE_2D,r),r}function Rn(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var ds,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&&--Ya===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Fa(){return!!Ve(this,0)}ka(){return!!Ve(this,1)}R(){return!!Ve(this,2)}ja(){return(t=Ve(e=this,0))||(t=On(e),t=new Uint8Array(t.map((r=>Math.round(255*r)))),e.g.push(t)),t;var e,t}ia(){return On(this)}N(){return Ka(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=Qt(this),n=$n(this);s.activeTexture(s.TEXTURE1),r=Ha(n,s,this.m?s.LINEAR:s.NEAREST),s.bindTexture(s.TEXTURE_2D,r);const i=qa(this);s.texImage2D(s.TEXTURE_2D,0,i,this.width,this.height,0,s.RED,s.FLOAT,null),s.bindTexture(s.TEXTURE_2D,null),za(n,s,r),Iu(n,s,!1,(()=>{Xa(this),s.clearColor(0,0,0,0),s.clear(s.COLOR_BUFFER_BIT),s.drawArrays(s.TRIANGLE_FAN,0,4),Rn(this)})),Uu(n),Rn(this)}}e.push(r)}return new q(e,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Qt(this).deleteTexture(Ve(this,2)),Ya=-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 Ya=250;function Se(...e){return e.map((([t,r])=>({start:t,end:r})))}const Nu=(function(e){return class extends e{Ja(){this.i._registerModelResourcesGraphService()}}})((Qa=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:Ia()?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){$e(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]=Ba(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=>{Da(this,Object.keys(e),(n=>{Da(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){$e(this,e,t),g(this,e,(r=>{this.i._attachBoolListener(r)}))}attachBoolVectorListener(e,t){Ye(this,e,t),g(this,e,(r=>{this.i._attachBoolVectorListener(r)}))}attachIntListener(e,t){$e(this,e,t),g(this,e,(r=>{this.i._attachIntListener(r)}))}attachIntVectorListener(e,t){Ye(this,e,t),g(this,e,(r=>{this.i._attachIntVectorListener(r)}))}attachUintListener(e,t){$e(this,e,t),g(this,e,(r=>{this.i._attachUintListener(r)}))}attachUintVectorListener(e,t){Ye(this,e,t),g(this,e,(r=>{this.i._attachUintVectorListener(r)}))}attachDoubleListener(e,t){$e(this,e,t),g(this,e,(r=>{this.i._attachDoubleListener(r)}))}attachDoubleVectorListener(e,t){Ye(this,e,t),g(this,e,(r=>{this.i._attachDoubleVectorListener(r)}))}attachFloatListener(e,t){$e(this,e,t),g(this,e,(r=>{this.i._attachFloatListener(r)}))}attachFloatVectorListener(e,t){Ye(this,e,t),g(this,e,(r=>{this.i._attachFloatVectorListener(r)}))}attachStringListener(e,t){$e(this,e,t),g(this,e,(r=>{this.i._attachStringListener(r)}))}attachStringVectorListener(e,t){Ye(this,e,t),g(this,e,(r=>{this.i._attachStringVectorListener(r)}))}attachProtoListener(e,t,r){$e(this,e,t),g(this,e,(s=>{this.i._attachProtoListener(s,r||!1)}))}attachProtoVectorListener(e,t,r){Ye(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?'),$e(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 Qa{get ga(){return this.i}pa(e,t,r){g(this,t,(s=>{const[n,i]=Ba(this,e,s);this.ga._addBoundTextureAsImageToStream(s,n,i,r)}))}Z(e,t){$e(this,e,t),g(this,e,(r=>{this.ga._attachImageListener(r)}))}aa(e,t){Ye(this,e,t),g(this,e,(r=>{this.ga._attachImageVectorListener(r)}))}}));var Qa,Ce=class extends Nu{};async function E(e,t,r){return(async function(s,n,i,o){return $u(s,n,i,o)})(e,r.canvas??(Ia()?void 0:document.createElement("canvas")),t,r)}function Ja(e,t,r,s){if(e.U){const i=new sa;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]=Na(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 Te(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'.");Ja(e,t,r,e.C+1)}function Re(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'.");Ja(e,t,r,s)}function Jt(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 de=class extends Fn{constructor(e,t,r,s){super(e),this.g=e,this.X=t,this.U=r,this.oa=s,this.P=new Wa}l(e,t=!0){if("runningMode"in e&&C(this.baseOptions,2,fr(!!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()}};de.prototype.close=de.prototype.close;var fe=class extends de{constructor(e,t){super(new Ce(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},b(e=this.h=new as,0,1,t=new O),y(this.h,2,.5),y(this.h,3,.3)}get baseOptions(){return A(this.h,O,1)}set baseOptions(e){b(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:[]},Te(this,e,t),this.j}G(e,t,r){return this.j={detections:[]},Re(this,e,r,t),this.j}m(){var e=new le;x(e,"image_in"),x(e,"norm_rect_in"),k(e,"detections");const t=new ue;xe(t,vu,this.h);const r=new re;ce(r,2,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),M(r,"IMAGE:image_in"),M(r,"NORM_RECT:norm_rect_in"),_(r,"DETECTIONS:detections"),r.o(t),we(e,r),this.g.attachProtoVectorListener("detections",((s,n)=>{for(const i of s)s=ea(i),this.j.detections.push(xa(s));d(this,n)})),this.g.attachEmptyPacketListener("detections",(s=>{d(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=async function(e,t){return E(fe,e,{baseOptions:{modelAssetPath:t}})},fe.createFromModelBuffer=function(e,t){return E(fe,e,{baseOptions:{modelAssetBuffer:t}})},fe.createFromOptions=function(e,t){return E(fe,e,t)};var In=Se([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]),Un=Se([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]),Nn=Se([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),Za=Se([474,475],[475,476],[476,477],[477,474]),Bn=Se([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]),Dn=Se([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),ec=Se([469,470],[470,471],[471,472],[472,469]),jn=Se([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]),tc=[...In,...Un,...Nn,...Bn,...Dn,...jn],rc=Se([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 sc(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var $=class extends de{constructor(e,t){super(new Ce(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,b(e=this.h=new la,0,1,t=new O),this.A=new ua,b(this.h,0,3,this.A),this.u=new as,b(this.h,0,2,this.u),De(this.u,4,1),y(this.u,2,.5),y(this.A,2,.5),y(this.h,4,.5)}get baseOptions(){return A(this.h,O,1)}set baseOptions(e){b(this.h,0,1,e)}o(e){return"numFaces"in e&&De(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 sc(this),Te(this,e,t),this.j}G(e,t,r){return sc(this),Re(this,e,r,t),this.j}m(){var e=new le;x(e,"image_in"),x(e,"norm_rect"),k(e,"face_landmarks");const t=new ue;xe(t,wu,this.h);const r=new re;ce(r,2,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),M(r,"IMAGE:image_in"),M(r,"NORM_RECT:norm_rect"),_(r,"NORM_LANDMARKS:face_landmarks"),r.o(t),we(e,r),this.g.attachProtoVectorListener("face_landmarks",((s,n)=>{for(const i of s)s=wr(i),this.j.faceLandmarks.push(cs(s));d(this,n)})),this.g.attachEmptyPacketListener("face_landmarks",(s=>{d(this,s)})),this.outputFaceBlendshapes&&(k(e,"blendshapes"),_(r,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",((s,n)=>{if(this.outputFaceBlendshapes)for(const i of s)s=ns(i),this.j.faceBlendshapes.push(Mn(s.g()??[]));d(this,n)})),this.g.attachEmptyPacketListener("blendshapes",(s=>{d(this,s)}))),this.outputFacialTransformationMatrixes&&(k(e,"face_geometry"),_(r,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",((s,n)=>{if(this.outputFacialTransformationMatrixes)for(const i of s)(s=A(s=_u(i),lu,2))&&this.j.facialTransformationMatrixes.push({rows:ve(s,1)??0??0,columns:ve(s,2)??0??0,data:ut(s,3,Le,ht()).slice()??[]});d(this,n)})),this.g.attachEmptyPacketListener("face_geometry",(s=>{d(this,s)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};$.prototype.detectForVideo=$.prototype.G,$.prototype.detect=$.prototype.F,$.prototype.setOptions=$.prototype.o,$.createFromModelPath=function(e,t){return E($,e,{baseOptions:{modelAssetPath:t}})},$.createFromModelBuffer=function(e,t){return E($,e,{baseOptions:{modelAssetBuffer:t}})},$.createFromOptions=function(e,t){return E($,e,t)},$.FACE_LANDMARKS_LIPS=In,$.FACE_LANDMARKS_LEFT_EYE=Un,$.FACE_LANDMARKS_LEFT_EYEBROW=Nn,$.FACE_LANDMARKS_LEFT_IRIS=Za,$.FACE_LANDMARKS_RIGHT_EYE=Bn,$.FACE_LANDMARKS_RIGHT_EYEBROW=Dn,$.FACE_LANDMARKS_RIGHT_IRIS=ec,$.FACE_LANDMARKS_FACE_OVAL=jn,$.FACE_LANDMARKS_CONTOURS=tc,$.FACE_LANDMARKS_TESSELATION=rc;var Vn=Se([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 nc(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function ic(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 oc(e,t=!0){const r=[];for(const n of e){var s=ns(n);e=[];for(const i of s.g())s=t&&ve(i,1)!=null?ve(i,1)??0:-1,e.push({score:R(i,2)??0,index:s,categoryName:Y(P(i,3))??""??"",displayName:Y(P(i,4))??""??""});r.push(e)}return r}var pe=class extends de{constructor(e,t){super(new Ce(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],b(e=this.j=new pa,0,1,t=new O),this.u=new wn,b(this.j,0,2,this.u),this.D=new _n,b(this.u,0,3,this.D),this.A=new fa,b(this.u,0,2,this.A),this.h=new Eu,b(this.j,0,3,this.h),y(this.A,2,.5),y(this.u,4,.5),y(this.D,2,.5)}get baseOptions(){return A(this.j,O,1)}set baseOptions(e){b(this.j,0,1,e)}o(e){var n,i,o,a;if(De(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 Xt,r=t,s=Pn(e.cannedGesturesClassifierOptions,(n=A(this.h,Xt,3))==null?void 0:n.l());b(r,0,2,s),b(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&((i=A(this.h,Xt,3))==null||i.g());return e.customGesturesClassifierOptions?(b(r=t=new Xt,0,2,s=Pn(e.customGesturesClassifierOptions,(o=A(this.h,Xt,4))==null?void 0:o.l())),b(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&((a=A(this.h,Xt,4))==null||a.g()),this.l(e)}Ha(e,t){return nc(this),Te(this,e,t),ic(this)}Ia(e,t,r){return nc(this),Re(this,e,r,t),ic(this)}m(){var e=new le;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 ue;xe(t,Au,this.j);const r=new re;ce(r,2,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),M(r,"IMAGE:image_in"),M(r,"NORM_RECT:norm_rect"),_(r,"HAND_GESTURES:hand_gestures"),_(r,"LANDMARKS:hand_landmarks"),_(r,"WORLD_LANDMARKS:world_hand_landmarks"),_(r,"HANDEDNESS:handedness"),r.o(t),we(e,r),this.g.attachProtoVectorListener("hand_landmarks",((s,n)=>{for(const i of s){s=wr(i);const o=[];for(const a of Be(s,ra,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)}d(this,n)})),this.g.attachEmptyPacketListener("hand_landmarks",(s=>{d(this,s)})),this.g.attachProtoVectorListener("world_hand_landmarks",((s,n)=>{for(const i of s){s=qt(i);const o=[];for(const a of Be(s,ta,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)}d(this,n)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(s=>{d(this,s)})),this.g.attachProtoVectorListener("hand_gestures",((s,n)=>{this.gestures.push(...oc(s,!1)),d(this,n)})),this.g.attachEmptyPacketListener("hand_gestures",(s=>{d(this,s)})),this.g.attachProtoVectorListener("handedness",((s,n)=>{this.handedness.push(...oc(s)),d(this,n)})),this.g.attachEmptyPacketListener("handedness",(s=>{d(this,s)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function ac(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}pe.prototype.recognizeForVideo=pe.prototype.Ia,pe.prototype.recognize=pe.prototype.Ha,pe.prototype.setOptions=pe.prototype.o,pe.createFromModelPath=function(e,t){return E(pe,e,{baseOptions:{modelAssetPath:t}})},pe.createFromModelBuffer=function(e,t){return E(pe,e,{baseOptions:{modelAssetBuffer:t}})},pe.createFromOptions=function(e,t){return E(pe,e,t)},pe.HAND_CONNECTIONS=Vn;var me=class extends de{constructor(e,t){super(new Ce(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],b(e=this.h=new wn,0,1,t=new O),this.u=new _n,b(this.h,0,3,this.u),this.j=new fa,b(this.h,0,2,this.j),De(this.j,3,1),y(this.j,2,.5),y(this.u,2,.5),y(this.h,4,.5)}get baseOptions(){return A(this.h,O,1)}set baseOptions(e){b(this.h,0,1,e)}o(e){return"numHands"in e&&De(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=[],Te(this,e,t),ac(this)}G(e,t,r){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Re(this,e,r,t),ac(this)}m(){var e=new le;x(e,"image_in"),x(e,"norm_rect"),k(e,"hand_landmarks"),k(e,"world_hand_landmarks"),k(e,"handedness");const t=new ue;xe(t,ku,this.h);const r=new re;ce(r,2,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),M(r,"IMAGE:image_in"),M(r,"NORM_RECT:norm_rect"),_(r,"LANDMARKS:hand_landmarks"),_(r,"WORLD_LANDMARKS:world_hand_landmarks"),_(r,"HANDEDNESS:handedness"),r.o(t),we(e,r),this.g.attachProtoVectorListener("hand_landmarks",((s,n)=>{for(const i of s)s=wr(i),this.landmarks.push(cs(s));d(this,n)})),this.g.attachEmptyPacketListener("hand_landmarks",(s=>{d(this,s)})),this.g.attachProtoVectorListener("world_hand_landmarks",((s,n)=>{for(const i of s)s=qt(i),this.worldLandmarks.push(Er(s));d(this,n)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(s=>{d(this,s)})),this.g.attachProtoVectorListener("handedness",((s,n)=>{var i=this.handedness,o=i.push;const a=[];for(const c of s){s=ns(c);const u=[];for(const h of s.g())u.push({score:R(h,2)??0,index:ve(h,1)??0??-1,categoryName:Y(P(h,3))??""??"",displayName:Y(P(h,4))??""??""});a.push(u)}o.call(i,...a),d(this,n)})),this.g.attachEmptyPacketListener("handedness",(s=>{d(this,s)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};me.prototype.detectForVideo=me.prototype.G,me.prototype.detect=me.prototype.F,me.prototype.setOptions=me.prototype.o,me.createFromModelPath=function(e,t){return E(me,e,{baseOptions:{modelAssetPath:t}})},me.createFromModelBuffer=function(e,t){return E(me,e,{baseOptions:{modelAssetBuffer:t}})},me.createFromOptions=function(e,t){return E(me,e,t)},me.HAND_CONNECTIONS=Vn;var cc=Se([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 hc(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function uc(e){try{if(!e.D)return e.h;e.D(e.h)}finally{ls(e)}}function fs(e,t){e=wr(e),t.push(cs(e))}var L=class extends de{constructor(e,t){super(new Ce(e,t),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,b(e=this.j=new _a,0,1,t=new O),this.I=new _n,b(this.j,0,2,this.I),this.W=new Su,b(this.j,0,3,this.W),this.u=new as,b(this.j,0,4,this.u),this.O=new ua,b(this.j,0,5,this.O),this.A=new ba,b(this.j,0,6,this.A),this.M=new va,b(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 A(this.j,O,1)}set baseOptions(e){b(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,hc(this),Te(this,e,s),uc(this)}G(e,t,r,s){const n=typeof r!="function"?r:{};return this.D=typeof r=="function"?r:s,hc(this),Re(this,e,n,t),uc(this)}m(){var e=new le;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 ue,r=new Uo;ce(r,1,"type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),(function(n,i){if(i!=null)if(Array.isArray(i))C(n,2,jr(i,0,gr));else{if(!(typeof i=="string"||i instanceof Pe||Ss(i)))throw Error("invalid value in Any.value field: "+i+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");ze(n,2,Ms(i,!1),st())}})(r,this.j.g());const s=new re;ce(s,2,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),Ys(s,8,Uo,r),M(s,"IMAGE:input_frames_image"),_(s,"POSE_LANDMARKS:pose_landmarks"),_(s,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),_(s,"FACE_LANDMARKS:face_landmarks"),_(s,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),_(s,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),_(s,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),_(s,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),s.o(t),we(e,s),us(this,e),this.g.attachProtoListener("pose_landmarks",((n,i)=>{fs(n,this.h.poseLandmarks),d(this,i)})),this.g.attachEmptyPacketListener("pose_landmarks",(n=>{d(this,n)})),this.g.attachProtoListener("pose_world_landmarks",((n,i)=>{var o=this.h.poseWorldLandmarks;n=qt(n),o.push(Er(n)),d(this,i)})),this.g.attachEmptyPacketListener("pose_world_landmarks",(n=>{d(this,n)})),this.outputPoseSegmentationMasks&&(_(s,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),Yt(this,"pose_segmentation_mask"),this.g.Z("pose_segmentation_mask",((n,i)=>{this.h.poseSegmentationMasks=[Jt(this,n,!0,!this.D)],d(this,i)})),this.g.attachEmptyPacketListener("pose_segmentation_mask",(n=>{this.h.poseSegmentationMasks=[],d(this,n)}))),this.g.attachProtoListener("face_landmarks",((n,i)=>{fs(n,this.h.faceLandmarks),d(this,i)})),this.g.attachEmptyPacketListener("face_landmarks",(n=>{d(this,n)})),this.outputFaceBlendshapes&&(k(e,"extra_blendshapes"),_(s,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",((n,i)=>{var o=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(n=ns(n),o.push(Mn(n.g()??[]))),d(this,i)})),this.g.attachEmptyPacketListener("extra_blendshapes",(n=>{d(this,n)}))),this.g.attachProtoListener("left_hand_landmarks",((n,i)=>{fs(n,this.h.leftHandLandmarks),d(this,i)})),this.g.attachEmptyPacketListener("left_hand_landmarks",(n=>{d(this,n)})),this.g.attachProtoListener("left_hand_world_landmarks",((n,i)=>{var o=this.h.leftHandWorldLandmarks;n=qt(n),o.push(Er(n)),d(this,i)})),this.g.attachEmptyPacketListener("left_hand_world_landmarks",(n=>{d(this,n)})),this.g.attachProtoListener("right_hand_landmarks",((n,i)=>{fs(n,this.h.rightHandLandmarks),d(this,i)})),this.g.attachEmptyPacketListener("right_hand_landmarks",(n=>{d(this,n)})),this.g.attachProtoListener("right_hand_world_landmarks",((n,i)=>{var o=this.h.rightHandWorldLandmarks;n=qt(n),o.push(Er(n)),d(this,i)})),this.g.attachEmptyPacketListener("right_hand_world_landmarks",(n=>{d(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};L.prototype.detectForVideo=L.prototype.G,L.prototype.detect=L.prototype.F,L.prototype.setOptions=L.prototype.o,L.createFromModelPath=function(e,t){return E(L,e,{baseOptions:{modelAssetPath:t}})},L.createFromModelBuffer=function(e,t){return E(L,e,{baseOptions:{modelAssetBuffer:t}})},L.createFromOptions=function(e,t){return E(L,e,t)},L.HAND_CONNECTIONS=Vn,L.POSE_CONNECTIONS=cc,L.FACE_LANDMARKS_LIPS=In,L.FACE_LANDMARKS_LEFT_EYE=Un,L.FACE_LANDMARKS_LEFT_EYEBROW=Nn,L.FACE_LANDMARKS_LEFT_IRIS=Za,L.FACE_LANDMARKS_RIGHT_EYE=Bn,L.FACE_LANDMARKS_RIGHT_EYEBROW=Dn,L.FACE_LANDMARKS_RIGHT_IRIS=ec,L.FACE_LANDMARKS_FACE_OVAL=jn,L.FACE_LANDMARKS_CONTOURS=tc,L.FACE_LANDMARKS_TESSELATION=rc;var Ee=class extends de{constructor(e,t){super(new Ce(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},b(e=this.h=new wa,0,1,t=new O)}get baseOptions(){return A(this.h,O,1)}set baseOptions(e){b(this.h,0,1,e)}o(e){return b(this.h,0,2,Pn(e,A(this.h,yn,2))),this.l(e)}sa(e,t){return this.j={classifications:[]},Te(this,e,t),this.j}ta(e,t,r){return this.j={classifications:[]},Re(this,e,r,t),this.j}m(){var e=new le;x(e,"input_image"),x(e,"norm_rect"),k(e,"classifications");const t=new ue;xe(t,Cu,this.h);const r=new re;ce(r,2,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),M(r,"IMAGE:input_image"),M(r,"NORM_RECT:norm_rect"),_(r,"CLASSIFICATIONS:classifications"),r.o(t),we(e,r),this.g.attachProtoListener("classifications",((s,n)=>{this.j=xu(pu(s)),d(this,n)})),this.g.attachEmptyPacketListener("classifications",(s=>{d(this,s)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ee.prototype.classifyForVideo=Ee.prototype.ta,Ee.prototype.classify=Ee.prototype.sa,Ee.prototype.setOptions=Ee.prototype.o,Ee.createFromModelPath=function(e,t){return E(Ee,e,{baseOptions:{modelAssetPath:t}})},Ee.createFromModelBuffer=function(e,t){return E(Ee,e,{baseOptions:{modelAssetBuffer:t}})},Ee.createFromOptions=function(e,t){return E(Ee,e,t)};var ge=class extends de{constructor(e,t){super(new Ce(e,t),"image_in","norm_rect",!0),this.h=new Ea,this.embeddings={embeddings:[]},b(e=this.h,0,1,t=new O)}get baseOptions(){return A(this.h,O,1)}set baseOptions(e){b(this.h,0,1,e)}o(e){var t=this.h,r=A(this.h,aa,2);return r=r?r.clone():new aa,e.l2Normalize!==void 0?C(r,1,fr(e.l2Normalize)):"l2Normalize"in e&&C(r,1),e.quantize!==void 0?C(r,2,fr(e.quantize)):"quantize"in e&&C(r,2),b(t,0,2,r),this.l(e)}za(e,t){return Te(this,e,t),this.embeddings}Aa(e,t,r){return Re(this,e,r,t),this.embeddings}m(){var e=new le;x(e,"image_in"),x(e,"norm_rect"),k(e,"embeddings_out");const t=new ue;xe(t,Tu,this.h);const r=new re;ce(r,2,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),M(r,"IMAGE:image_in"),M(r,"NORM_RECT:norm_rect"),_(r,"EMBEDDINGS:embeddings_out"),r.o(t),we(e,r),this.g.attachProtoListener("embeddings_out",((s,n)=>{s=yu(s),this.embeddings=(function(i){return{embeddings:Be(i,gu,1).map((o=>{var u,h;const a={headIndex:ve(o,3)??0??-1,headName:Y(P(o,4))??""??""};var c=o.v;return eo(c,0|c[p],na,Ws(o,1))!==void 0?(o=ut(o=A(o,na,Ws(o,1),void 0),1,Le,ht()),a.floatEmbedding=o.slice()):(c=new Uint8Array(0),a.quantizedEmbedding=((h=(u=A(o,mu,Ws(o,2),void 0))==null?void 0:u.na())==null?void 0:h.h())??c),a})),timestampMs:Fa(so(i))}})(s),d(this,n)})),this.g.attachEmptyPacketListener("embeddings_out",(s=>{d(this,s)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ge.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=$a(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=$a(Oa(e.quantizedEmbedding),Oa(t.quantizedEmbedding))}return e},ge.prototype.embedForVideo=ge.prototype.Aa,ge.prototype.embed=ge.prototype.za,ge.prototype.setOptions=ge.prototype.o,ge.createFromModelPath=function(e,t){return E(ge,e,{baseOptions:{modelAssetPath:t}})},ge.createFromModelBuffer=function(e,t){return E(ge,e,{baseOptions:{modelAssetBuffer:t}})},ge.createFromOptions=function(e,t){return E(ge,e,t)};var Gn=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 Bu(e){var r,s;const t=(function(n){return Be(n,re,1)})(e.ca()).filter((n=>(Y(P(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=A(t[0],ue,7))==null?void 0:r.j())==null?void 0:s.g())??new Map).forEach(((n,i)=>{e.u[Number(i)]=Y(P(n,1))??""}))}function lc(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function dc(e){try{const t=new Gn(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{ls(e)}}Gn.prototype.close=Gn.prototype.close;var se=class extends de{constructor(e,t){super(new Ce(e,t),"image_in","norm_rect",!1),this.u=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Sn,this.A=new Aa,b(this.h,0,3,this.A),b(e=this.h,0,1,t=new O)}get baseOptions(){return A(this.h,O,1)}set baseOptions(e){b(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?C(this.h,2,mr(e.displayNamesLocale)):"displayNamesLocale"in e&&C(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}L(){Bu(this)}segment(e,t,r){const s=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:r,lc(this),Te(this,e,s),dc(this)}La(e,t,r,s){const n=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:s,lc(this),Re(this,e,n,t),dc(this)}Da(){return this.u}m(){var e=new le;x(e,"image_in"),x(e,"norm_rect");const t=new ue;xe(t,Ca,this.h);const r=new re;ce(r,2,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),M(r,"IMAGE:image_in"),M(r,"NORM_RECT:norm_rect"),r.o(t),we(e,r),us(this,e),this.outputConfidenceMasks&&(k(e,"confidence_masks"),_(r,"CONFIDENCE_MASKS:confidence_masks"),Yt(this,"confidence_masks"),this.g.aa("confidence_masks",((s,n)=>{this.confidenceMasks=s.map((i=>Jt(this,i,!0,!this.j))),d(this,n)})),this.g.attachEmptyPacketListener("confidence_masks",(s=>{this.confidenceMasks=[],d(this,s)}))),this.outputCategoryMask&&(k(e,"category_mask"),_(r,"CATEGORY_MASK:category_mask"),Yt(this,"category_mask"),this.g.Z("category_mask",((s,n)=>{this.categoryMask=Jt(this,s,!1,!this.j),d(this,n)})),this.g.attachEmptyPacketListener("category_mask",(s=>{this.categoryMask=void 0,d(this,s)}))),k(e,"quality_scores"),_(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((s,n)=>{this.qualityScores=s,d(this,n)})),this.g.attachEmptyPacketListener("quality_scores",(s=>{this.categoryMask=void 0,d(this,s)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};se.prototype.getLabels=se.prototype.Da,se.prototype.segmentForVideo=se.prototype.La,se.prototype.segment=se.prototype.segment,se.prototype.setOptions=se.prototype.o,se.createFromModelPath=function(e,t){return E(se,e,{baseOptions:{modelAssetPath:t}})},se.createFromModelBuffer=function(e,t){return E(se,e,{baseOptions:{modelAssetBuffer:t}})},se.createFromOptions=function(e,t){return E(se,e,t)};var Hn=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()}};Hn.prototype.close=Hn.prototype.close;var Ie=class extends de{constructor(e,t){super(new Ce(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Sn,this.u=new Aa,b(this.h,0,3,this.u),b(e=this.h,0,1,t=new O)}get baseOptions(){return A(this.h,O,1)}set baseOptions(e){b(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 Pa,t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var i=new Cn;ze(i,3,fr(!0),!1),ze(i,1,dr(t.keypoint.x),0),ze(i,2,dr(t.keypoint.y),0),yr(s,1,Tn,i)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");{const a=new Mu;for(i of t.scribble)ze(t=new Cn,3,fr(!0),!1),ze(t,1,dr(i.x),0),ze(t,2,dr(i.y),0),Ys(a,1,Cn,t);yr(s,2,Tn,a)}}this.g.addProtoToStream(s.g(),"mediapipe.tasks.vision.interactive_segmenter.proto.RegionOfInterest","roi_in",r),Te(this,e,n);e:{try{const a=new Hn(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var o=a;break e}this.j(a)}finally{ls(this)}o=void 0}return o}m(){var e=new le;x(e,"image_in"),x(e,"roi_in"),x(e,"norm_rect_in");const t=new ue;xe(t,Ca,this.h);const r=new re;ce(r,2,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraphV2"),M(r,"IMAGE:image_in"),M(r,"ROI:roi_in"),M(r,"NORM_RECT:norm_rect_in"),r.o(t),we(e,r),us(this,e),this.outputConfidenceMasks&&(k(e,"confidence_masks"),_(r,"CONFIDENCE_MASKS:confidence_masks"),Yt(this,"confidence_masks"),this.g.aa("confidence_masks",((s,n)=>{this.confidenceMasks=s.map((i=>Jt(this,i,!0,!this.j))),d(this,n)})),this.g.attachEmptyPacketListener("confidence_masks",(s=>{this.confidenceMasks=[],d(this,s)}))),this.outputCategoryMask&&(k(e,"category_mask"),_(r,"CATEGORY_MASK:category_mask"),Yt(this,"category_mask"),this.g.Z("category_mask",((s,n)=>{this.categoryMask=Jt(this,s,!1,!this.j),d(this,n)})),this.g.attachEmptyPacketListener("category_mask",(s=>{this.categoryMask=void 0,d(this,s)}))),k(e,"quality_scores"),_(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((s,n)=>{this.qualityScores=s,d(this,n)})),this.g.attachEmptyPacketListener("quality_scores",(s=>{this.categoryMask=void 0,d(this,s)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ie.prototype.segment=Ie.prototype.segment,Ie.prototype.setOptions=Ie.prototype.o,Ie.createFromModelPath=function(e,t){return E(Ie,e,{baseOptions:{modelAssetPath:t}})},Ie.createFromModelBuffer=function(e,t){return E(Ie,e,{baseOptions:{modelAssetBuffer:t}})},Ie.createFromOptions=function(e,t){return E(Ie,e,t)};var Ae=class extends de{constructor(e,t){super(new Ce(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},b(e=this.h=new Ma,0,1,t=new O)}get baseOptions(){return A(this.h,O,1)}set baseOptions(e){b(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?C(this.h,2,mr(e.displayNamesLocale)):"displayNamesLocale"in e&&C(this.h,2),e.maxResults!==void 0?De(this.h,3,e.maxResults):"maxResults"in e&&C(this.h,3),e.scoreThreshold!==void 0?y(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&C(this.h,4),e.categoryAllowlist!==void 0?Vr(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&C(this.h,5),e.categoryDenylist!==void 0?Vr(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&C(this.h,6),this.l(e)}F(e,t){return this.j={detections:[]},Te(this,e,t),this.j}G(e,t,r){return this.j={detections:[]},Re(this,e,r,t),this.j}m(){var e=new le;x(e,"input_frame_gpu"),x(e,"norm_rect"),k(e,"detections");const t=new ue;xe(t,Lu,this.h);const r=new re;ce(r,2,"mediapipe.tasks.vision.ObjectDetectorGraph"),M(r,"IMAGE:input_frame_gpu"),M(r,"NORM_RECT:norm_rect"),_(r,"DETECTIONS:detections"),r.o(t),we(e,r),this.g.attachProtoVectorListener("detections",((s,n)=>{for(const i of s)s=ea(i),this.j.detections.push(xa(s));d(this,n)})),this.g.attachEmptyPacketListener("detections",(s=>{d(this,s)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ae.prototype.detectForVideo=Ae.prototype.G,Ae.prototype.detect=Ae.prototype.F,Ae.prototype.setOptions=Ae.prototype.o,Ae.createFromModelPath=async function(e,t){return E(Ae,e,{baseOptions:{modelAssetPath:t}})},Ae.createFromModelBuffer=function(e,t){return E(Ae,e,{baseOptions:{modelAssetBuffer:t}})},Ae.createFromOptions=function(e,t){return E(Ae,e,t)};var zn=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 fc(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function pc(e){try{const t=new zn(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.u)return t;e.u(t)}finally{ls(e)}}zn.prototype.close=zn.prototype.close;var ye=class extends de{constructor(e,t){super(new Ce(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,b(e=this.h=new La,0,1,t=new O),this.A=new va,b(this.h,0,3,this.A),this.j=new ba,b(this.h,0,2,this.j),De(this.j,4,1),y(this.j,2,.5),y(this.A,2,.5),y(this.h,4,.5)}get baseOptions(){return A(this.h,O,1)}set baseOptions(e){b(this.h,0,1,e)}o(e){return"numPoses"in e&&De(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,fc(this),Te(this,e,s),pc(this)}G(e,t,r,s){const n=typeof r!="function"?r:{};return this.u=typeof r=="function"?r:s,fc(this),Re(this,e,n,t),pc(this)}m(){var e=new le;x(e,"image_in"),x(e,"norm_rect"),k(e,"normalized_landmarks"),k(e,"world_landmarks"),k(e,"segmentation_masks");const t=new ue;xe(t,Fu,this.h);const r=new re;ce(r,2,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),M(r,"IMAGE:image_in"),M(r,"NORM_RECT:norm_rect"),_(r,"NORM_LANDMARKS:normalized_landmarks"),_(r,"WORLD_LANDMARKS:world_landmarks"),r.o(t),we(e,r),us(this,e),this.g.attachProtoVectorListener("normalized_landmarks",((s,n)=>{this.landmarks=[];for(const i of s)s=wr(i),this.landmarks.push(cs(s));d(this,n)})),this.g.attachEmptyPacketListener("normalized_landmarks",(s=>{this.landmarks=[],d(this,s)})),this.g.attachProtoVectorListener("world_landmarks",((s,n)=>{this.worldLandmarks=[];for(const i of s)s=qt(i),this.worldLandmarks.push(Er(s));d(this,n)})),this.g.attachEmptyPacketListener("world_landmarks",(s=>{this.worldLandmarks=[],d(this,s)})),this.outputSegmentationMasks&&(_(r,"SEGMENTATION_MASK:segmentation_masks"),Yt(this,"segmentation_masks"),this.g.aa("segmentation_masks",((s,n)=>{this.segmentationMasks=s.map((i=>Jt(this,i,!0,!this.u))),d(this,n)})),this.g.attachEmptyPacketListener("segmentation_masks",(s=>{this.segmentationMasks=[],d(this,s)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ye.prototype.detectForVideo=ye.prototype.G,ye.prototype.detect=ye.prototype.F,ye.prototype.setOptions=ye.prototype.o,ye.createFromModelPath=function(e,t){return E(ye,e,{baseOptions:{modelAssetPath:t}})},ye.createFromModelBuffer=function(e,t){return E(ye,e,{baseOptions:{modelAssetBuffer:t}})},ye.createFromOptions=function(e,t){return E(ye,e,t)},ye.POSE_CONNECTIONS=cc;const mc=.1,gc=.42,Wn=.24,Kn=.14,qn=.18,yc=.12,Du=0,ju=1,Vu=2;function bc(e){var h;const{detections:t,width:r,height:s}=e;if(t.length===0)return{hasFace:!1,faceCount:0,confidence:0,captureScore: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:((h=t[0])==null?void 0:h.confidence)??0,captureScore:0,isCentered:!1,passesQualityChecks:!1,feedback:"multiple-faces",message:"Multiple faces detected. Make sure only one person is in view."};const n=t[0],i=n.boundingBox;if(!i)return{hasFace:!0,faceCount:1,confidence:n.confidence,captureScore:0,isCentered:!1,passesQualityChecks:!1,feedback:"face-unclear",message:"Face detected, but the frame is unclear. Hold still and try again."};const o=i.width*i.height/(r*s);if(o<mc)return yt(n.confidence,"too-far","Move closer to the camera.");if(o>gc)return yt(n.confidence,"too-close","Move slightly farther away.");const a=(i.originX+i.width/2)/r,c=(i.originY+i.height/2)/s;if(a<.5-Kn)return yt(n.confidence,"move-left","Move your face a little to the left.");if(a>.5+Kn)return yt(n.confidence,"move-right","Move your face a little to the right.");if(c<.5-qn)return yt(n.confidence,"move-down","Move your face slightly down.");if(c>.5+qn)return yt(n.confidence,"move-up","Move your face slightly up.");const u=Gu(n.keypoints);return u?yt(n.confidence,u.feedback,u.message):{hasFace:!0,faceCount:1,confidence:n.confidence,captureScore:Hu(n.confidence,a,c,o),isCentered:!0,passesQualityChecks:!0,feedback:"good",message:"Hold still. Capturing automatically..."}}function Gu(e){const t=e[Du],r=e[ju],s=e[Vu];if(!t||!r||!s)return null;const n=(t.x+r.x)/2,i=Math.abs(r.x-t.x);if(i===0)return null;const o=(s.x-n)/i;return o<=-yc?{feedback:"turn-left",message:"Turn slightly left so your face points at the camera."}:o>=yc?{feedback:"turn-right",message:"Turn slightly right so your face points at the camera."}:null}function yt(e,t,r){return{hasFace:!0,faceCount:1,confidence:e,captureScore:0,isCentered:!1,passesQualityChecks:!1,feedback:t,message:r}}function Gl(e){return e}function Hu(e,t,r,s){const n=Math.abs(t-.5)/Kn,i=Math.abs(r-.5)/qn,o=1-Math.min((n+i)/2,1),a=Math.max(Math.abs(Wn-mc),Math.abs(gc-Wn)),c=1-Math.min(Math.abs(s-Wn)/a,1);return Number((e*.55+o*.3+c*.15).toFixed(4))}const zu="https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision/wasm",Wu="https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/1/blaze_face_short_range.tflite",Ku=.7;let vc=null,_c=null,wc=null;function qu(){return vc??(vc=gt.forVisionTasks(zu)),vc}function Xu(){return _c??(_c=Ac("IMAGE")),_c}function Ec(){return wc??(wc=Ac("VIDEO")),wc}async function Ac(e){const t=await qu();return fe.createFromOptions(t,{baseOptions:{modelAssetPath:Wu},runningMode:e,minDetectionConfidence:Ku})}async function Xn(e){const r=(await Xu()).detect(e);return bc({detections:Sc(r.detections),width:e.naturalWidth,height:e.naturalHeight})}async function kc(e,t){const s=(await Ec()).detectForVideo(e,t);return bc({detections:Sc(s.detections),width:e.videoWidth,height:e.videoHeight})}function Sc(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 Yu="Take a selfie",Qu="Use this capture";function Cc(e){return{presentation:(e==null?void 0:e.presentation)??"popup",capturePreference:(e==null?void 0:e.capturePreference)??"auto-preferred",allowMediaPickerFallback:(e==null?void 0:e.allowMediaPickerFallback)??!0,container:e==null?void 0:e.container,label:(e==null?void 0:e.label)??Yu,confirmLabel:(e==null?void 0:e.confirmLabel)??Qu}}async function Tc(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))??Ju())),{prefersMediaPicker:t,supportsMediaDevices:r,supportsAutoCapture:s}}function Pc(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"),{presentation:e.presentation,steps:r,capabilities:t}}async function Ju(){if(typeof window.requestAnimationFrame!="function"||typeof window.cancelAnimationFrame!="function"||!document.createElement("canvas").getContext("2d"))return!1;try{return await Ec(),!0}catch{return!1}}class ps 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 Mc(){var e;if(!((e=navigator.mediaDevices)!=null&&e.getUserMedia))throw new ps("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 ps(sl(t),{cause:t})}}async function Zu(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 el(e){e.play().catch(()=>{})}function tl(){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)},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 Yn(){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 Qn(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 rl(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 sl(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)})}class Fc{constructor(t){this.frameCapture=tl(),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=>Zu(r)),this.assessLiveQuality=t.assessLiveQuality??kc,this.assessPreviewBlob=t.assessPreviewBlob??nl,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(),el(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(Qc-(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{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.storeBestFrame(this.videoElement),this.bestCaptureScore=r.captureScore,this.bestQualityResult=r)),this.countdownStartedAt!==null){const s=Math.min((t-this.countdownStartedAt)/hi,1);if(s>=1){await this.finishAutoCapture();return}this.emit(this.createLiveState({feedbackMessage:Jc(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:Zc(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 nl(e){try{const t=await Qn(e);return await Xn(t)}catch{return null}}const il="2147483647";async function Jn(e){const t=Cc(e);if(t.presentation==="embedded")return ol(t);const r=await Tc({capturePreference:t.capturePreference}),s=Pc(t,r);for(let n=0;n<s.steps.length;n+=1){const i=s.steps[n];if(i==="media-picker")return Yn();try{return await cl(i==="auto-camera"?"auto":"manual")}catch(o){const a=s.steps.slice(n+1).includes("media-picker");if(o instanceof ps&&a)return Yn();throw o}}throw new Error("No supported capture strategy is available in this environment.")}async function ol(e){await Promise.resolve().then(()=>Nl);const t=al(e.container),r=t.tagName.toLowerCase()==="simface-capture",s=r?t:document.createElement("simface-capture");return r||t.appendChild(s),s.embedded=!0,s.label=e.label,s.confirmLabel=e.confirmLabel,s.capturePreference=e.capturePreference,s.allowMediaPickerFallback=e.allowMediaPickerFallback,new Promise((n,i)=>{const o=()=>{s.removeEventListener("simface-captured",a),s.removeEventListener("simface-cancelled",c),s.removeEventListener("simface-error",u),s.active=!1,r||s.remove()},a=h=>{o(),n(h.detail.imageBlob)},c=()=>{o(),n(null)},u=h=>{o(),i(new Error(h.detail.error))};s.addEventListener("simface-captured",a),s.addEventListener("simface-cancelled",c),s.addEventListener("simface-error",u),s.startCapture().catch(h=>{o(),i(h instanceof Error?h:new Error("Embedded capture failed."))})})}function al(e){if(!e)throw new Error("Embedded capture requires a container element or selector.");if(e instanceof HTMLElement)return e;const t=document.querySelector(e);if(!t)throw new Error(`No element matched the embedded capture container selector "${e}".`);return t}async function cl(e){return new Promise((t,r)=>{let s=!1,n=null,i="",o=null,a=null,c=null;const u=()=>{a==null||a.stop(),c&&window.removeEventListener("keydown",c),i&&URL.revokeObjectURL(i),o&&o.getTracks().forEach(l=>l.stop()),n==null||n.remove()},h=(l,f)=>{if(!s){if(s=!0,u(),f){r(f);return}t(l)}};try{n=document.createElement("div"),n.setAttribute("data-simface-camera-overlay","true"),n.setAttribute("role","dialog"),n.setAttribute("aria-modal","true"),J(n,{position:"fixed",inset:"0",zIndex:il,display:"flex",alignItems:"center",justifyContent:"center",padding:"24px",background:"rgba(15, 23, 42, 0.82)"});const l=document.createElement("div");J(l,{width:"min(100%, 560px)",display:"flex",flexDirection:"column",gap:"16px",padding:"20px",borderRadius:"20px",background:"#020617",color:"#e2e8f0",boxShadow:"0 24px 60px rgba(15, 23, 42, 0.35)"});const f=document.createElement("h2");J(f,{margin:"0",fontSize:"1.25rem",fontWeight:"700"});const v=document.createElement("p");J(v,{margin:"0",color:"#cbd5e1",fontSize:"0.95rem",lineHeight:"1.5"});const S=document.createElement("div");J(S,{position:"relative",overflow:"hidden",width:"100%",aspectRatio:"3 / 4",minHeight:"320px",borderRadius:"18px",background:"#000"});const ne=document.createElement("video");ne.autoplay=!0,ne.muted=!0,ne.playsInline=!0,J(ne,{width:"100%",height:"100%",objectFit:"cover",transform:"scaleX(-1)"});const te=document.createElement("div");J(te,{borderRadius:"14px",padding:"12px 14px",font:'600 14px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'});const Ge=document.createElement("div");J(Ge,{display:"flex",flexWrap:"wrap",gap:"12px",justifyContent:"flex-end"});const At=ms("Cancel","secondary");At.dataset.simfaceAction="cancel";const rr=ms("Take photo","primary");rr.dataset.simfaceAction="capture";const ai=ms("Use photo","primary");ai.dataset.simfaceAction="confirm";const ci=ms("Retake","secondary");ci.dataset.simfaceAction="retake";const jl=ul();l.append(f,v,S,te,Ge),n.append(l),document.body.appendChild(n),c=H=>{H.key==="Escape"&&h(null)},window.addEventListener("keydown",c),At.addEventListener("click",()=>h(null)),rr.addEventListener("click",()=>{a==null||a.takePhotoNow().catch(H=>{h(null,H instanceof Error?H:new Error("Failed to capture an image."))})}),ci.addEventListener("click",()=>{a==null||a.retake().catch(H=>{h(null,H instanceof Error?H:new Error("Failed to restart the capture."))})}),ai.addEventListener("click",()=>{try{const H=a==null?void 0:a.confirm();h(H??null)}catch(H){h(null,H instanceof Error?H:new Error("Failed to confirm the photo."))}}),a=new Fc({videoElement:ne,initialMode:e,copy:{autoReadyMessage:"Looking for a single face in frame...",manualReadyMessage:"When you are ready, press Take photo.",autoUnavailableMessage:"Automatic capture is unavailable in this browser. Use Take photo instead.",retakeReadyMessage:"When you are ready, press Take photo."},onStateChange:H=>{hl({state:H,mediaContainer:S,video:ne,title:f,copy:v,feedback:te,actions:Ge,cancelButton:At,captureButton:rr,confirmButton:ai,retakeButton:ci,guideOverlay:jl,setPreviewUrl(Vl){i&&URL.revokeObjectURL(i),i=Vl}})}}),(async()=>{try{if(o=await Mc(),s){o.getTracks().forEach(H=>H.stop());return}ne.srcObject=o,await(a==null?void 0:a.start())}catch(H){h(null,H instanceof Error?H:new Error("Failed to open the camera capture UI."))}})()}catch(l){h(null,l instanceof Error?l:new Error("Failed to open the camera capture UI."))}})}function hl(e){var S;const{state:t,mediaContainer:r,video:s,title:n,copy:i,feedback:o,actions:a,cancelButton:c,captureButton:u,confirmButton:h,retakeButton:l,guideOverlay:f,setPreviewUrl:v}=e;if(f.setProgress(t.phase==="live"&&t.mode==="auto"?t.countdownProgress:0),t.phase==="preview"){const ne=URL.createObjectURL(t.previewBlob);v(ne);const te=document.createElement("img");te.alt="Captured face preview",te.src=ne,J(te,{position:"absolute",inset:"0",zIndex:"1",width:"100%",height:"100%",objectFit:"cover",transform:"scaleX(-1)"}),r.replaceChildren(s,te),n.textContent="Review your photo",i.textContent=((S=t.qualityResult)==null?void 0:S.passesQualityChecks)===!1?"The capture did not pass the checks. Retake the photo.":"Confirm this photo or retake it.",o.textContent=t.feedbackMessage,xc(o,t.feedbackTone),a.replaceChildren(c,l),t.canConfirm&&a.append(h);return}r.replaceChildren(s,f.wrapper),v(""),t.mode==="auto"?(n.textContent=t.phase==="starting"?"Opening camera...":"Center your face",i.textContent="Keep your face inside the oval. We will start a short countdown when the framing looks good and keep the best frame."):(n.textContent=t.phase==="starting"?"Opening camera...":"Take a face photo",i.textContent="Line up your face in the oval, then take a photo manually."),o.textContent=t.phase==="starting"?"Requesting camera access...":t.feedbackMessage,xc(o,t.phase==="starting"?"neutral":t.feedbackTone),u.style.display=t.phase==="live"&&t.mode==="manual"?"inline-flex":"none",u.disabled=!(t.phase==="live"&&t.mode==="manual"),a.replaceChildren(c,u)}function ms(e,t){const r=document.createElement("button");return r.type="button",r.textContent=e,J(r,{display:"inline-flex",alignItems:"center",justifyContent:"center",border:"none",borderRadius:"999px",padding:"12px 18px",font:'600 15px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',cursor:"pointer",color:t==="primary"?"#fff":"#0f172a",background:t==="primary"?"#2563eb":"#e2e8f0"}),r}function ul(){const e=document.createElement("div");J(e,{position:"absolute",inset:"0",pointerEvents:"none"});const t=gs("svg");t.setAttribute("viewBox","0 0 100 100"),t.setAttribute("preserveAspectRatio","none"),J(t,{width:"100%",height:"100%",display:"block"});const r=gs("path");r.setAttribute("d",ui),r.setAttribute("fill","rgba(51, 65, 85, 0.75)"),r.setAttribute("fill-rule","evenodd");const s=gs("path");s.setAttribute("d",sr),s.setAttribute("fill","none"),s.setAttribute("stroke","rgba(255, 255, 255, 0.92)"),s.setAttribute("stroke-width","2.8"),s.setAttribute("stroke-linecap","round"),s.setAttribute("stroke-linejoin","round");const n=gs("path");return n.setAttribute("d",sr),n.setAttribute("fill","none"),n.setAttribute("stroke","#22c55e"),n.setAttribute("stroke-width","2.8"),n.setAttribute("stroke-linecap","round"),n.setAttribute("stroke-linejoin","round"),n.setAttribute("pathLength","100"),n.setAttribute("stroke-dasharray","100"),n.setAttribute("stroke-dashoffset","100"),n.style.transition="stroke-dashoffset 0.14s linear, opacity 0.14s linear",n.style.opacity="0",t.append(r,s,n),e.append(t),{wrapper:e,setProgress(i){const o=Math.min(Math.max(i,0),1);n.setAttribute("stroke-dashoffset",`${100-o*100}`),n.style.opacity=o>0?"1":"0"}}}function gs(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function xc(e,t){switch(t){case"success":J(e,{background:"#dcfce7",color:"#166534"});return;case"error":J(e,{background:"#fee2e2",color:"#991b1b"});return;case"manual":J(e,{background:"#e0f2fe",color:"#0f172a"});return;default:J(e,{background:"#e2e8f0",color:"#0f172a"})}}function J(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 Pn=globalThis,ui=Pn.ShadowRoot&&(Pn.ShadyCSS===void 0||Pn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,li=Symbol(),Rc=new WeakMap;let Ic=class{constructor(t,r,n){if(this._$cssResult$=!0,n!==li)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(ui&&t===void 0){const n=r!==void 0&&r.length===1;n&&(t=Rc.get(r)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&Rc.set(r,t))}return t}toString(){return this.cssText}};const u1=e=>new Ic(typeof e=="string"?e:e+"",void 0,li),l1=(e,...t)=>{const r=e.length===1?e[0]:t.reduce((n,s,i)=>n+(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.")})(s)+e[i+1],e[0]);return new Ic(r,e,li)},d1=(e,t)=>{if(ui)e.adoptedStyleSheets=t.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet);else for(const r of t){const n=document.createElement("style"),s=Pn.litNonce;s!==void 0&&n.setAttribute("nonce",s),n.textContent=r.cssText,e.appendChild(n)}},Uc=ui?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let r="";for(const n of t.cssRules)r+=n.cssText;return u1(r)})(e):e;/**
19
+ */const ys=globalThis,Zn=ys.ShadowRoot&&(ys.ShadyCSS===void 0||ys.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ei=Symbol(),Oc=new WeakMap;let $c=class{constructor(t,r,s){if(this._$cssResult$=!0,s!==ei)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=Oc.get(r)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&Oc.set(r,t))}return t}toString(){return this.cssText}};const ll=e=>new $c(typeof e=="string"?e:e+"",void 0,ei),dl=(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 $c(r,e,ei)},fl=(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=ys.litNonce;n!==void 0&&s.setAttribute("nonce",n),s.textContent=r.cssText,e.appendChild(s)}},Rc=Zn?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let r="";for(const s of t.cssRules)r+=s.cssText;return ll(r)})(e):e;/**
20
20
  * @license
21
21
  * Copyright 2017 Google LLC
22
22
  * SPDX-License-Identifier: BSD-3-Clause
23
- */const{is:f1,defineProperty:p1,getOwnPropertyDescriptor:m1,getOwnPropertyNames:g1,getOwnPropertySymbols:y1,getPrototypeOf:b1}=Object,ut=globalThis,Nc=ut.trustedTypes,_1=Nc?Nc.emptyScript:"",di=ut.reactiveElementPolyfillSupport,Or=(e,t)=>e,Mn={toAttribute(e,t){switch(t){case Boolean:e=e?_1: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}},fi=(e,t)=>!f1(e,t),Bc={attribute:!0,type:String,converter:Mn,reflect:!1,useDefault:!1,hasChanged:fi};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),ut.litPropertyMetadata??(ut.litPropertyMetadata=new WeakMap);let lr=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=Bc){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 n=Symbol(),s=this.getPropertyDescriptor(t,n,r);s!==void 0&&p1(this.prototype,t,s)}}static getPropertyDescriptor(t,r,n){const{get:s,set:i}=m1(this.prototype,t)??{get(){return this[r]},set(o){this[r]=o}};return{get:s,set(o){const a=s==null?void 0:s.call(this);i==null||i.call(this,o),this.requestUpdate(t,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Bc}static _$Ei(){if(this.hasOwnProperty(Or("elementProperties")))return;const t=b1(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Or("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Or("properties"))){const r=this.properties,n=[...g1(r),...y1(r)];for(const s of n)this.createProperty(s,r[s])}const t=this[Symbol.metadata];if(t!==null){const r=litPropertyMetadata.get(t);if(r!==void 0)for(const[n,s]of r)this.elementProperties.set(n,s)}this._$Eh=new Map;for(const[r,n]of this.elementProperties){const s=this._$Eu(r,n);s!==void 0&&this._$Eh.set(s,r)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const r=[];if(Array.isArray(t)){const n=new Set(t.flat(1/0).reverse());for(const s of n)r.unshift(Uc(s))}else t!==void 0&&r.push(Uc(t));return r}static _$Eu(t,r){const n=r.attribute;return n===!1?void 0:typeof n=="string"?n: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 n of r.keys())this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return d1(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 n;return(n=r.hostConnected)==null?void 0:n.call(r)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(r=>{var n;return(n=r.hostDisconnected)==null?void 0:n.call(r)})}attributeChangedCallback(t,r,n){this._$AK(t,n)}_$ET(t,r){var i;const n=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,n);if(s!==void 0&&n.reflect===!0){const o=(((i=n.converter)==null?void 0:i.toAttribute)!==void 0?n.converter:Mn).toAttribute(r,n.type);this._$Em=t,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(t,r){var i,o;const n=this.constructor,s=n._$Eh.get(t);if(s!==void 0&&this._$Em!==s){const a=n.getPropertyOptions(s),c=typeof a.converter=="function"?{fromAttribute:a.converter}:((i=a.converter)==null?void 0:i.fromAttribute)!==void 0?a.converter:Mn;this._$Em=s;const u=c.fromAttribute(r,a.type);this[s]=u??((o=this._$Ej)==null?void 0:o.get(s))??u,this._$Em=null}}requestUpdate(t,r,n,s=!1,i){var o;if(t!==void 0){const a=this.constructor;if(s===!1&&(i=this[t]),n??(n=a.getPropertyOptions(t)),!((n.hasChanged??fi)(i,r)||n.useDefault&&n.reflect&&i===((o=this._$Ej)==null?void 0:o.get(t))&&!this.hasAttribute(a._$Eu(t,n))))return;this.C(t,r,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,r,{useDefault:n,reflect:s,wrapped:i},o){n&&!(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||n||(r=void 0),this._$AL.set(t,r)),s===!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 n;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 s=this.constructor.elementProperties;if(s.size>0)for(const[i,o]of s){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),(n=this._$EO)==null||n.forEach(s=>{var i;return(i=s.hostUpdate)==null?void 0:i.call(s)}),this.update(r)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(r)}willUpdate(t){}_$AE(t){var r;(r=this._$EO)==null||r.forEach(n=>{var s;return(s=n.hostUpdated)==null?void 0:s.call(n)}),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){}};lr.elementStyles=[],lr.shadowRootOptions={mode:"open"},lr[Or("elementProperties")]=new Map,lr[Or("finalized")]=new Map,di==null||di({ReactiveElement:lr}),(ut.reactiveElementVersions??(ut.reactiveElementVersions=[])).push("2.1.2");/**
23
+ */const{is:pl,defineProperty:ml,getOwnPropertyDescriptor:gl,getOwnPropertyNames:yl,getOwnPropertySymbols:bl,getPrototypeOf:vl}=Object,Je=globalThis,Ic=Je.trustedTypes,_l=Ic?Ic.emptyScript:"",ti=Je.reactiveElementPolyfillSupport,kr=(e,t)=>e,bs={toAttribute(e,t){switch(t){case Boolean:e=e?_l: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}},ri=(e,t)=>!pl(e,t),Uc={attribute:!0,type:String,converter:bs,reflect:!1,useDefault:!1,hasChanged:ri};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Je.litPropertyMetadata??(Je.litPropertyMetadata=new WeakMap);let Zt=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=Uc){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&&ml(this.prototype,t,n)}}static getPropertyDescriptor(t,r,s){const{get:n,set:i}=gl(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)??Uc}static _$Ei(){if(this.hasOwnProperty(kr("elementProperties")))return;const t=vl(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(kr("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(kr("properties"))){const r=this.properties,s=[...yl(r),...bl(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(Rc(n))}else t!==void 0&&r.push(Rc(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 fl(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:bs).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:bs;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??ri)(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){}};Zt.elementStyles=[],Zt.shadowRootOptions={mode:"open"},Zt[kr("elementProperties")]=new Map,Zt[kr("finalized")]=new Map,ti==null||ti({ReactiveElement:Zt}),(Je.reactiveElementVersions??(Je.reactiveElementVersions=[])).push("2.1.2");/**
24
24
  * @license
25
25
  * Copyright 2017 Google LLC
26
26
  * SPDX-License-Identifier: BSD-3-Clause
27
- */const Rr=globalThis,Dc=e=>e,Fn=Rr.trustedTypes,jc=Fn?Fn.createPolicy("lit-html",{createHTML:e=>e}):void 0,Vc="$lit$",lt=`lit$${Math.random().toFixed(9).slice(2)}$`,Gc="?"+lt,v1=`<${Gc}>`,Pt=document,Ir=()=>Pt.createComment(""),Ur=e=>e===null||typeof e!="object"&&typeof e!="function",pi=Array.isArray,w1=e=>pi(e)||typeof(e==null?void 0:e[Symbol.iterator])=="function",mi=`[
28
- \f\r]`,Nr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Hc=/-->/g,zc=/>/g,Mt=RegExp(`>|${mi}(?:([^\\s"'>=/]+)(${mi}*=${mi}*(?:[^
29
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Wc=/'/g,Kc=/"/g,qc=/^(?:script|style|textarea|title)$/i,E1=e=>(t,...r)=>({_$litType$:e,strings:t,values:r}),_e=E1(1),dr=Symbol.for("lit-noChange"),Y=Symbol.for("lit-nothing"),Yc=new WeakMap,Ft=Pt.createTreeWalker(Pt,129);function Xc(e,t){if(!pi(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return jc!==void 0?jc.createHTML(t):t}const A1=(e,t)=>{const r=e.length-1,n=[];let s,i=t===2?"<svg>":t===3?"<math>":"",o=Nr;for(let a=0;a<r;a++){const c=e[a];let u,h,l=-1,g=0;for(;g<c.length&&(o.lastIndex=g,h=o.exec(c),h!==null);)g=o.lastIndex,o===Nr?h[1]==="!--"?o=Hc:h[1]!==void 0?o=zc:h[2]!==void 0?(qc.test(h[2])&&(s=RegExp("</"+h[2],"g")),o=Mt):h[3]!==void 0&&(o=Mt):o===Mt?h[0]===">"?(o=s??Nr,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]==='"'?Kc:Wc):o===Kc||o===Wc?o=Mt:o===Hc||o===zc?o=Nr:(o=Mt,s=void 0);const _=o===Mt&&e[a+1].startsWith("/>")?" ":"";i+=o===Nr?c+v1:l>=0?(n.push(u),c.slice(0,l)+Vc+c.slice(l)+lt+_):c+lt+(l===-2?a:_)}return[Xc(e,i+(e[r]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),n]};class Br{constructor({strings:t,_$litType$:r},n){let s;this.parts=[];let i=0,o=0;const a=t.length-1,c=this.parts,[u,h]=A1(t,r);if(this.el=Br.createElement(u,n),Ft.currentNode=this.el.content,r===2||r===3){const l=this.el.content.firstChild;l.replaceWith(...l.childNodes)}for(;(s=Ft.nextNode())!==null&&c.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(const l of s.getAttributeNames())if(l.endsWith(Vc)){const g=h[o++],_=s.getAttribute(l).split(lt),S=/([.?@])?(.*)/.exec(g);c.push({type:1,index:i,name:S[2],strings:_,ctor:S[1]==="."?S1:S[1]==="?"?C1:S[1]==="@"?T1:xn}),s.removeAttribute(l)}else l.startsWith(lt)&&(c.push({type:6,index:i}),s.removeAttribute(l));if(qc.test(s.tagName)){const l=s.textContent.split(lt),g=l.length-1;if(g>0){s.textContent=Fn?Fn.emptyScript:"";for(let _=0;_<g;_++)s.append(l[_],Ir()),Ft.nextNode(),c.push({type:2,index:++i});s.append(l[g],Ir())}}}else if(s.nodeType===8)if(s.data===Gc)c.push({type:2,index:i});else{let l=-1;for(;(l=s.data.indexOf(lt,l+1))!==-1;)c.push({type:7,index:i}),l+=lt.length-1}i++}}static createElement(t,r){const n=Pt.createElement("template");return n.innerHTML=t,n}}function fr(e,t,r=e,n){var o,a;if(t===dr)return t;let s=n!==void 0?(o=r._$Co)==null?void 0:o[n]:r._$Cl;const i=Ur(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==i&&((a=s==null?void 0:s._$AO)==null||a.call(s,!1),i===void 0?s=void 0:(s=new i(e),s._$AT(e,r,n)),n!==void 0?(r._$Co??(r._$Co=[]))[n]=s:r._$Cl=s),s!==void 0&&(t=fr(e,s._$AS(e,t.values),s,n)),t}class k1{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:n}=this._$AD,s=((t==null?void 0:t.creationScope)??Pt).importNode(r,!0);Ft.currentNode=s;let i=Ft.nextNode(),o=0,a=0,c=n[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new Dr(i,i.nextSibling,this,t):c.type===1?u=new c.ctor(i,c.name,c.strings,this,t):c.type===6&&(u=new L1(i,this,t)),this._$AV.push(u),c=n[++a]}o!==(c==null?void 0:c.index)&&(i=Ft.nextNode(),o++)}return Ft.currentNode=Pt,s}p(t){let r=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(t,n,r),r+=n.strings.length-2):n._$AI(t[r])),r++}}class Dr{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,r,n,s){this.type=2,this._$AH=Y,this._$AN=void 0,this._$AA=t,this._$AB=r,this._$AM=n,this.options=s,this._$Cv=(s==null?void 0:s.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=fr(this,t,r),Ur(t)?t===Y||t==null||t===""?(this._$AH!==Y&&this._$AR(),this._$AH=Y):t!==this._$AH&&t!==dr&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):w1(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!==Y&&Ur(this._$AH)?this._$AA.nextSibling.data=t:this.T(Pt.createTextNode(t)),this._$AH=t}$(t){var i;const{values:r,_$litType$:n}=t,s=typeof n=="number"?this._$AC(t):(n.el===void 0&&(n.el=Br.createElement(Xc(n.h,n.h[0]),this.options)),n);if(((i=this._$AH)==null?void 0:i._$AD)===s)this._$AH.p(r);else{const o=new k1(s,this),a=o.u(this.options);o.p(r),this.T(a),this._$AH=o}}_$AC(t){let r=Yc.get(t.strings);return r===void 0&&Yc.set(t.strings,r=new Br(t)),r}k(t){pi(this._$AH)||(this._$AH=[],this._$AR());const r=this._$AH;let n,s=0;for(const i of t)s===r.length?r.push(n=new Dr(this.O(Ir()),this.O(Ir()),this,this.options)):n=r[s],n._$AI(i),s++;s<r.length&&(this._$AR(n&&n._$AB.nextSibling,s),r.length=s)}_$AR(t=this._$AA.nextSibling,r){var n;for((n=this._$AP)==null?void 0:n.call(this,!1,!0,r);t!==this._$AB;){const s=Dc(t).nextSibling;Dc(t).remove(),t=s}}setConnected(t){var r;this._$AM===void 0&&(this._$Cv=t,(r=this._$AP)==null||r.call(this,t))}}class xn{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,r,n,s,i){this.type=1,this._$AH=Y,this._$AN=void 0,this.element=t,this.name=r,this._$AM=s,this.options=i,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=Y}_$AI(t,r=this,n,s){const i=this.strings;let o=!1;if(i===void 0)t=fr(this,t,r,0),o=!Ur(t)||t!==this._$AH&&t!==dr,o&&(this._$AH=t);else{const a=t;let c,u;for(t=i[0],c=0;c<i.length-1;c++)u=fr(this,a[n+c],r,c),u===dr&&(u=this._$AH[c]),o||(o=!Ur(u)||u!==this._$AH[c]),u===Y?t=Y:t!==Y&&(t+=(u??"")+i[c+1]),this._$AH[c]=u}o&&!s&&this.j(t)}j(t){t===Y?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class S1 extends xn{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===Y?void 0:t}}class C1 extends xn{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==Y)}}class T1 extends xn{constructor(t,r,n,s,i){super(t,r,n,s,i),this.type=5}_$AI(t,r=this){if((t=fr(this,t,r,0)??Y)===dr)return;const n=this._$AH,s=t===Y&&n!==Y||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,i=t!==Y&&(n===Y||s);s&&this.element.removeEventListener(this.name,this,n),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 L1{constructor(t,r,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=r,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){fr(this,t)}}const gi=Rr.litHtmlPolyfillSupport;gi==null||gi(Br,Dr),(Rr.litHtmlVersions??(Rr.litHtmlVersions=[])).push("3.3.2");const P1=(e,t,r)=>{const n=(r==null?void 0:r.renderBefore)??t;let s=n._$litPart$;if(s===void 0){const i=(r==null?void 0:r.renderBefore)??null;n._$litPart$=s=new Dr(t.insertBefore(Ir(),i),i,void 0,r??{})}return s._$AI(e),s};/**
27
+ */const Sr=globalThis,Nc=e=>e,vs=Sr.trustedTypes,Bc=vs?vs.createPolicy("lit-html",{createHTML:e=>e}):void 0,Dc="$lit$",Ze=`lit$${Math.random().toFixed(9).slice(2)}$`,jc="?"+Ze,wl=`<${jc}>`,bt=document,Cr=()=>bt.createComment(""),Tr=e=>e===null||typeof e!="object"&&typeof e!="function",si=Array.isArray,El=e=>si(e)||typeof(e==null?void 0:e[Symbol.iterator])=="function",ni=`[
28
+ \f\r]`,Pr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Vc=/-->/g,Gc=/>/g,vt=RegExp(`>|${ni}(?:([^\\s"'>=/]+)(${ni}*=${ni}*(?:[^
29
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Hc=/'/g,zc=/"/g,Wc=/^(?:script|style|textarea|title)$/i,Al=e=>(t,...r)=>({_$litType$:e,strings:t,values:r}),be=Al(1),er=Symbol.for("lit-noChange"),X=Symbol.for("lit-nothing"),Kc=new WeakMap,_t=bt.createTreeWalker(bt,129);function qc(e,t){if(!si(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Bc!==void 0?Bc.createHTML(t):t}const kl=(e,t)=>{const r=e.length-1,s=[];let n,i=t===2?"<svg>":t===3?"<math>":"",o=Pr;for(let a=0;a<r;a++){const c=e[a];let u,h,l=-1,f=0;for(;f<c.length&&(o.lastIndex=f,h=o.exec(c),h!==null);)f=o.lastIndex,o===Pr?h[1]==="!--"?o=Vc:h[1]!==void 0?o=Gc:h[2]!==void 0?(Wc.test(h[2])&&(n=RegExp("</"+h[2],"g")),o=vt):h[3]!==void 0&&(o=vt):o===vt?h[0]===">"?(o=n??Pr,l=-1):h[1]===void 0?l=-2:(l=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?vt:h[3]==='"'?zc:Hc):o===zc||o===Hc?o=vt:o===Vc||o===Gc?o=Pr:(o=vt,n=void 0);const v=o===vt&&e[a+1].startsWith("/>")?" ":"";i+=o===Pr?c+wl:l>=0?(s.push(u),c.slice(0,l)+Dc+c.slice(l)+Ze+v):c+Ze+(l===-2?a:v)}return[qc(e,i+(e[r]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};class Mr{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]=kl(t,r);if(this.el=Mr.createElement(u,s),_t.currentNode=this.el.content,r===2||r===3){const l=this.el.content.firstChild;l.replaceWith(...l.childNodes)}for(;(n=_t.nextNode())!==null&&c.length<a;){if(n.nodeType===1){if(n.hasAttributes())for(const l of n.getAttributeNames())if(l.endsWith(Dc)){const f=h[o++],v=n.getAttribute(l).split(Ze),S=/([.?@])?(.*)/.exec(f);c.push({type:1,index:i,name:S[2],strings:v,ctor:S[1]==="."?Cl:S[1]==="?"?Tl:S[1]==="@"?Pl:_s}),n.removeAttribute(l)}else l.startsWith(Ze)&&(c.push({type:6,index:i}),n.removeAttribute(l));if(Wc.test(n.tagName)){const l=n.textContent.split(Ze),f=l.length-1;if(f>0){n.textContent=vs?vs.emptyScript:"";for(let v=0;v<f;v++)n.append(l[v],Cr()),_t.nextNode(),c.push({type:2,index:++i});n.append(l[f],Cr())}}}else if(n.nodeType===8)if(n.data===jc)c.push({type:2,index:i});else{let l=-1;for(;(l=n.data.indexOf(Ze,l+1))!==-1;)c.push({type:7,index:i}),l+=Ze.length-1}i++}}static createElement(t,r){const s=bt.createElement("template");return s.innerHTML=t,s}}function tr(e,t,r=e,s){var o,a;if(t===er)return t;let n=s!==void 0?(o=r._$Co)==null?void 0:o[s]:r._$Cl;const i=Tr(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=tr(e,n._$AS(e,t.values),n,s)),t}class Sl{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)??bt).importNode(r,!0);_t.currentNode=n;let i=_t.nextNode(),o=0,a=0,c=s[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new Lr(i,i.nextSibling,this,t):c.type===1?u=new c.ctor(i,c.name,c.strings,this,t):c.type===6&&(u=new Ml(i,this,t)),this._$AV.push(u),c=s[++a]}o!==(c==null?void 0:c.index)&&(i=_t.nextNode(),o++)}return _t.currentNode=bt,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 Lr{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=tr(this,t,r),Tr(t)?t===X||t==null||t===""?(this._$AH!==X&&this._$AR(),this._$AH=X):t!==this._$AH&&t!==er&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):El(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&&Tr(this._$AH)?this._$AA.nextSibling.data=t:this.T(bt.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=Mr.createElement(qc(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 Sl(n,this),a=o.u(this.options);o.p(r),this.T(a),this._$AH=o}}_$AC(t){let r=Kc.get(t.strings);return r===void 0&&Kc.set(t.strings,r=new Mr(t)),r}k(t){si(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 Lr(this.O(Cr()),this.O(Cr()),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=Nc(t).nextSibling;Nc(t).remove(),t=n}}setConnected(t){var r;this._$AM===void 0&&(this._$Cv=t,(r=this._$AP)==null||r.call(this,t))}}class _s{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=tr(this,t,r,0),o=!Tr(t)||t!==this._$AH&&t!==er,o&&(this._$AH=t);else{const a=t;let c,u;for(t=i[0],c=0;c<i.length-1;c++)u=tr(this,a[s+c],r,c),u===er&&(u=this._$AH[c]),o||(o=!Tr(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 Cl extends _s{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===X?void 0:t}}class Tl extends _s{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==X)}}class Pl extends _s{constructor(t,r,s,n,i){super(t,r,s,n,i),this.type=5}_$AI(t,r=this){if((t=tr(this,t,r,0)??X)===er)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 Ml{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){tr(this,t)}}const ii=Sr.litHtmlPolyfillSupport;ii==null||ii(Mr,Lr),(Sr.litHtmlVersions??(Sr.litHtmlVersions=[])).push("3.3.2");const Ll=(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 Lr(t.insertBefore(Cr(),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 xt=globalThis;class jr extends lr{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=P1(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 dr}}jr._$litElement$=!0,jr.finalized=!0,(Zc=xt.litElementHydrateSupport)==null||Zc.call(xt,{LitElement:jr});const yi=xt.litElementPolyfillSupport;yi==null||yi({LitElement:jr}),(xt.litElementVersions??(xt.litElementVersions=[])).push("4.2.2");/**
33
+ */const wt=globalThis;class Fr extends Zt{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=Ll(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 er}}Fr._$litElement$=!0,Fr.finalized=!0,(Yc=wt.litElementHydrateSupport)==null||Yc.call(wt,{LitElement:Fr});const oi=wt.litElementPolyfillSupport;oi==null||oi({LitElement:Fr}),(wt.litElementVersions??(wt.litElementVersions=[])).push("4.2.2");/**
34
34
  * @license
35
35
  * Copyright 2017 Google LLC
36
36
  * SPDX-License-Identifier: BSD-3-Clause
37
- */const M1=e=>(t,r)=>{r!==void 0?r.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};/**
37
+ */const Fl=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 F1={attribute:!0,type:String,converter:Mn,reflect:!1,hasChanged:fi},x1=(e=F1,t,r)=>{const{kind:n,metadata:s}=r;let i=globalThis.litPropertyMetadata.get(s);if(i===void 0&&globalThis.litPropertyMetadata.set(s,i=new Map),n==="setter"&&((e=Object.create(e)).wrapped=!0),i.set(r.name,e),n==="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(n==="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: "+n)};function Vr(e){return(t,r)=>typeof r=="object"?x1(e,t,r):((n,s,i)=>{const o=s.hasOwnProperty(i);return s.constructor.createProperty(i,n),o?Object.getOwnPropertyDescriptor(s,i):void 0})(e,t,r)}/**
41
+ */const xl={attribute:!0,type:String,converter:bs,reflect:!1,hasChanged:ri},Ol=(e=xl,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 Et(e){return(t,r)=>typeof r=="object"?Ol(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
45
- */function $t(e){return Vr({...e,state:!0,attribute:!1})}/**
45
+ */function et(e){return Et({...e,state:!0,attribute:!1})}/**
46
46
  * @license
47
47
  * Copyright 2017 Google LLC
48
48
  * SPDX-License-Identifier: BSD-3-Clause
49
- */const $1=(e,t,r)=>(r.configurable=!0,r.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(e,t,r),r);/**
49
+ */const $l=(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 O1(e,t){return(r,n,s)=>{const i=o=>{var a;return((a=o.renderRoot)==null?void 0:a.querySelector(e))??null};return $1(r,n,{get(){return i(this)}})}}var R1=Object.defineProperty,I1=Object.getOwnPropertyDescriptor,ve=(e,t,r,n)=>{for(var s=n>1?void 0:n?I1(t,r):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=(n?o(t,r,s):o(s))||s);return n&&s&&R1(t,r,s),s};const U1=180,Qc=5e3,bi="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",N1=`M 0 0 H 100 V 100 H 0 Z ${bi}`;k.SimFaceCapture=class extends jr{constructor(){super(...arguments),this.label="Take a selfie",this.embedded=!1,this.active=!1,this.confirmLabel="Use this capture",this.captureState="idle",this.errorMessage="",this.feedbackMessage="Start a capture to see camera guidance here.",this.feedbackTone="neutral",this.previewUrl="",this.countdownProgress=0,this.qualityResult=null,this.stream=null,this.animationFrameId=null,this.analysisInFlight=!1,this.lastAnalysisTimestamp=0,this.capturedBlob=null,this.countdownStartedAt=null,this.bestCaptureBlob=null,this.bestCaptureScore=-1,this.bestQualityResult=null}disconnectedCallback(){super.disconnectedCallback(),this.stopEmbeddedSession()}updated(t){if(!(!this.embedded||!t.has("active"))){if(this.active){this.startEmbeddedCapture();return}this.stopEmbeddedSession(),this.resetEmbeddedState()}}render(){return this.embedded?_e`
53
+ */function Rl(e,t){return(r,s,n)=>{const i=o=>{var a;return((a=o.renderRoot)==null?void 0:a.querySelector(e))??null};return $l(r,s,{get(){return i(this)}})}}var Il=Object.defineProperty,Ul=Object.getOwnPropertyDescriptor,Z=(e,t,r,s)=>{for(var n=s>1?void 0:s?Ul(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&&Il(t,r,n),n};w.SimFaceCapture=class extends Fr{constructor(){super(...arguments),this.label="Take a selfie",this.embedded=!1,this.active=!1,this.confirmLabel="Use this capture",this.capturePreference="auto-preferred",this.allowMediaPickerFallback=!0,this.captureState="idle",this.errorMessage="",this.feedbackMessage="Start a capture to see camera guidance here.",this.feedbackTone="neutral",this.previewUrl="",this.countdownProgress=0,this.qualityResult=null,this.canTakePhoto=!0,this.stream=null,this.sessionController=null,this.currentCaptureStep=null,this.capturedBlob=null,this.pendingActiveSync=!1}disconnectedCallback(){super.disconnectedCallback(),this.stopEmbeddedSession()}updated(t){!this.embedded||!t.has("active")||this.pendingActiveSync||(this.pendingActiveSync=!0,queueMicrotask(()=>{if(this.pendingActiveSync=!1,!(!this.isConnected||!this.embedded)){if(this.active){this.captureState==="idle"&&this.beginEmbeddedCapture();return}this.endEmbeddedCapture()}}))}render(){return this.embedded?be`
54
54
  <div class="container embedded-shell">
55
55
  ${this.renderEmbeddedState()}
56
56
  </div>
57
- `:_e`
57
+ `:be`
58
58
  <div class="container">
59
59
  ${this.renderPopupState()}
60
60
  </div>
61
- `}async startCapture(){if(this.embedded){this.active=!0,await this.updateComplete;return}await this.handlePopupCapture()}renderPopupState(){switch(this.captureState){case"idle":return _e`
61
+ `}async startCapture(){if(this.embedded){this.active=!0,await this.updateComplete,await this.beginEmbeddedCapture();return}await this.handlePopupCapture()}renderPopupState(){switch(this.captureState){case"idle":return be`
62
62
  <p>${this.label}</p>
63
63
  <button class="btn btn-primary" @click=${this.handlePopupCapture}>
64
64
  Open Camera
65
65
  </button>
66
- `;case"starting":return _e`
66
+ `;case"starting":return be`
67
67
  <p>Opening camera...</p>
68
68
  <div class="spinner"></div>
69
- `;case"error":return _e`
69
+ `;case"error":return be`
70
70
  <div class="quality-msg quality-bad">${this.errorMessage}</div>
71
71
  <button class="btn btn-primary" @click=${this.handlePopupRetake}>Try again</button>
72
72
  <button class="btn btn-secondary" @click=${this.handlePopupCancel}>Cancel</button>
73
- `;default:return _e``}}renderEmbeddedState(){var t;return _e`
73
+ `;default:return be``}}renderEmbeddedState(){var t;return be`
74
74
  <p class="embedded-copy">${this.label}</p>
75
75
 
76
- ${this.captureState==="idle"?_e`<p class="embedded-copy">Waiting for the host page to start capture.</p>`:_e`
76
+ ${this.captureState==="idle"?be`<p class="embedded-copy">Waiting for the host page to start capture.</p>`:be`
77
77
  <div class="stage">
78
78
  <video
79
79
  id="embedded-video"
@@ -92,9 +92,9 @@
92
92
  style=${`--capture-progress:${this.countdownProgress};`}
93
93
  >
94
94
  <svg viewBox="0 0 100 100" preserveAspectRatio="none" aria-hidden="true">
95
- <path class="guide-mask" d=${N1}></path>
96
- <path class="ring-outline" d=${bi}></path>
97
- <path class="ring-progress" d=${bi} pathLength="100"></path>
95
+ <path class="guide-mask" d=${ui}></path>
96
+ <path class="ring-outline" d=${sr}></path>
97
+ <path class="ring-progress" d=${sr} pathLength="100"></path>
98
98
  </svg>
99
99
  </div>
100
100
  </div>
@@ -105,21 +105,21 @@
105
105
  </div>
106
106
 
107
107
  <div class="btn-row">
108
- ${this.captureState==="live"?_e`
109
- <button class="btn btn-secondary" @click=${this.handleEmbeddedManualCapture}>Take photo now</button>
108
+ ${this.captureState==="live"?be`
109
+ <button class="btn btn-secondary" ?disabled=${!this.canTakePhoto} @click=${this.handleEmbeddedManualCapture}>Take photo now</button>
110
110
  <button class="btn btn-ghost" @click=${this.handleEmbeddedCancel}>Cancel</button>
111
111
  `:""}
112
- ${this.captureState==="preview"?_e`
112
+ ${this.captureState==="preview"?be`
113
113
  <button class="btn btn-secondary" @click=${this.handleEmbeddedRetake}>Retake</button>
114
- ${((t=this.qualityResult)==null?void 0:t.passesQualityChecks)===!1?"":_e`<button class="btn btn-primary" @click=${this.handleEmbeddedConfirm}>${this.confirmLabel}</button>`}
114
+ ${((t=this.qualityResult)==null?void 0:t.passesQualityChecks)===!1?"":be`<button class="btn btn-primary" @click=${this.handleEmbeddedConfirm}>${this.confirmLabel}</button>`}
115
115
  <button class="btn btn-ghost" @click=${this.handleEmbeddedCancel}>Cancel</button>
116
116
  `:""}
117
- ${this.captureState==="error"?_e`
118
- <button class="btn btn-primary" @click=${this.startEmbeddedCapture}>Try again</button>
117
+ ${this.captureState==="error"?be`
118
+ <button class="btn btn-primary" @click=${this.beginEmbeddedCapture}>Try again</button>
119
119
  <button class="btn btn-ghost" @click=${this.handleEmbeddedCancel}>Cancel</button>
120
120
  `:""}
121
121
  </div>
122
- `}async handlePopupCapture(){this.captureState="starting";try{const t=await ci();if(!t){this.dispatchCancelled(),this.captureState="idle";return}this.dispatchCaptured(t),this.resetPopupState()}catch(t){this.errorMessage=t instanceof Error?t.message:"Capture failed",this.captureState="error",this.dispatchError(this.errorMessage)}}handlePopupRetake(){this.resetPopupState(),this.handlePopupCapture()}handlePopupCancel(){this.dispatchCancelled(),this.resetPopupState()}async startEmbeddedCapture(){var t;if(!(!this.active||this.captureState==="starting"||this.captureState==="live")){if(this.stopEmbeddedSession(),this.resetEmbeddedState(),this.captureState="starting",this.feedbackMessage="Requesting camera access...",this.feedbackTone="neutral",await this.updateComplete,!((t=navigator.mediaDevices)!=null&&t.getUserMedia)){this.handleEmbeddedError(new Error("This browser does not support inline camera capture."));return}try{this.stream=await navigator.mediaDevices.getUserMedia({video:{facingMode:{ideal:"user"}},audio:!1}),this.captureState="live",this.feedbackMessage="Center your face in the oval. We will capture automatically when framing looks good.",await this.updateComplete;const r=this.embeddedVideoElement;if(!r)throw new Error("Inline camera preview could not be created.");r.srcObject=this.stream,await this.waitForVideoReady(r),this.scheduleEmbeddedAnalysis()}catch(r){this.handleEmbeddedError(r)}}}scheduleEmbeddedAnalysis(){if(!(this.captureState!=="live"||!this.stream)){if(typeof window.requestAnimationFrame!="function"||typeof window.cancelAnimationFrame!="function"){this.feedbackMessage="Automatic analysis is unavailable. Use Take photo now.",this.feedbackTone="neutral";return}this.animationFrameId=window.requestAnimationFrame(async t=>{if(this.captureState!=="live"||this.analysisInFlight||t-this.lastAnalysisTimestamp<U1){this.scheduleEmbeddedAnalysis();return}const r=this.embeddedVideoElement;if(r){this.lastAnalysisTimestamp=t,this.analysisInFlight=!0;try{const n=await ai(r,t);if(this.qualityResult=n,n.passesQualityChecks&&(this.countdownStartedAt===null&&(this.countdownStartedAt=t,this.countdownProgress=0,this.feedbackMessage="Great framing detected. Hold still while we pick the best frame.",this.feedbackTone="success"),await this.considerBestFrame(r,n)),this.countdownStartedAt!==null){if(this.countdownProgress=Math.min((t-this.countdownStartedAt)/Qc,1),this.feedbackMessage=this.countdownMessage(t,n),this.feedbackTone=n.passesQualityChecks?"success":"neutral",this.countdownProgress>=1){this.finishCountdownCapture();return}}else this.feedbackMessage=n.message,this.feedbackTone="neutral"}catch{this.feedbackMessage="Automatic analysis is unavailable. Use Take photo now.",this.feedbackTone="neutral";return}finally{this.analysisInFlight=!1}this.scheduleEmbeddedAnalysis()}})}}async captureEmbeddedFrame(){const t=this.embeddedVideoElement;if(!(!t||this.captureState!=="live"))try{const r=await this.captureVideoFrame(t),n=await this.assessCapturedBlob(r);this.capturedBlob=r,this.qualityResult=n,this.captureState="preview",this.feedbackMessage=(n==null?void 0:n.message)??"Review this capture before continuing.",this.feedbackTone=n?n.passesQualityChecks?"success":"error":"neutral",this.previewUrl&&URL.revokeObjectURL(this.previewUrl),this.previewUrl=URL.createObjectURL(r),this.countdownProgress=0}catch(r){this.handleEmbeddedError(r)}}async considerBestFrame(t,r){if(r.captureScore<=this.bestCaptureScore)return;const n=await this.captureVideoFrame(t);this.bestCaptureBlob=n,this.bestCaptureScore=r.captureScore,this.bestQualityResult=r}finishCountdownCapture(){if(!this.bestCaptureBlob){this.captureEmbeddedFrame();return}this.capturedBlob=this.bestCaptureBlob,this.qualityResult=this.bestQualityResult,this.captureState="preview",this.feedbackMessage=this.bestCaptureMessage(),this.feedbackTone="success",this.previewUrl&&URL.revokeObjectURL(this.previewUrl),this.previewUrl=URL.createObjectURL(this.bestCaptureBlob),this.countdownProgress=1}async assessCapturedBlob(t){try{const r=await hi(t);return await oi(r)}catch{return null}}handleEmbeddedManualCapture(){this.captureEmbeddedFrame()}handleEmbeddedRetake(){this.capturedBlob=null,this.qualityResult=null,this.captureState="live",this.previewUrl&&(URL.revokeObjectURL(this.previewUrl),this.previewUrl=""),this.feedbackMessage="Ready to capture again.",this.feedbackTone="neutral",this.resetCountdown(),this.resumeEmbeddedVideo(),this.scheduleEmbeddedAnalysis()}handleEmbeddedConfirm(){if(!this.capturedBlob)return;const t=this.capturedBlob;this.active=!1,this.stopEmbeddedSession(),this.resetEmbeddedState(),this.dispatchCaptured(t)}handleEmbeddedCancel(){this.active=!1,this.stopEmbeddedSession(),this.resetEmbeddedState(),this.dispatchCancelled()}handleEmbeddedError(t){this.stopEmbeddedSession(),this.errorMessage=t instanceof Error?t.message:"Capture failed",this.captureState="error",this.feedbackMessage=this.errorMessage,this.feedbackTone="error",this.dispatchError(this.errorMessage)}stopEmbeddedSession(){this.animationFrameId!==null&&(window.cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.stream&&(this.stream.getTracks().forEach(r=>r.stop()),this.stream=null);const t=this.embeddedVideoElement;t&&(t.srcObject=null),this.analysisInFlight=!1,this.lastAnalysisTimestamp=0,this.resetCountdown()}resetEmbeddedState(){this.previewUrl&&(URL.revokeObjectURL(this.previewUrl),this.previewUrl=""),this.captureState="idle",this.errorMessage="",this.feedbackMessage="Start a capture to see camera guidance here.",this.feedbackTone="neutral",this.countdownProgress=0,this.qualityResult=null,this.capturedBlob=null}resetPopupState(){this.captureState="idle",this.errorMessage=""}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":"quality-neutral"}waitForVideoReady(t){return t.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?t.play().then(()=>{}):new Promise((r,n)=>{const s=()=>{o(),t.play().then(()=>r()).catch(n)},i=()=>{o(),n(new Error("Failed to start the inline camera preview."))},o=()=>{t.removeEventListener("loadedmetadata",s),t.removeEventListener("error",i)};t.addEventListener("loadedmetadata",s,{once:!0}),t.addEventListener("error",i,{once:!0})})}captureVideoFrame(t){if(!t.videoWidth||!t.videoHeight)return Promise.reject(new Error("Camera preview is not ready yet."));const r=document.createElement("canvas");r.width=t.videoWidth,r.height=t.videoHeight;const n=r.getContext("2d");return n?(n.drawImage(t,0,0,r.width,r.height),new Promise((s,i)=>{r.toBlob(o=>{if(!o){i(new Error("Failed to capture an image."));return}s(o)},"image/jpeg",.92)})):Promise.reject(new Error("Failed to initialize camera capture."))}resumeEmbeddedVideo(){const t=this.embeddedVideoElement;t&&t.play().catch(()=>{})}resetCountdown(){this.countdownStartedAt=null,this.countdownProgress=0,this.bestCaptureBlob=null,this.bestCaptureScore=-1,this.bestQualityResult=null}countdownMessage(t,r){if(this.countdownStartedAt===null)return"Center your face in the oval. We will capture automatically when framing looks good.";const n=Math.max(Qc-(t-this.countdownStartedAt),0),s=Math.max(Math.ceil(n/1e3),0);return r.passesQualityChecks?`Hold steady. Capturing the best frame in ${s}s.`:`${r.message} Best frame selection finishes in ${s}s.`}bestCaptureMessage(){var r;const t=(r=this.bestQualityResult)==null?void 0:r.captureScore;return typeof t=="number"&&t>0?"Best frame captured. Review and confirm this photo.":"Capture complete. Review and confirm this photo."}},k.SimFaceCapture.styles=l1`
122
+ `}async handlePopupCapture(){this.captureState="starting";try{const t=await Jn({presentation:"popup",capturePreference:this.capturePreference,allowMediaPickerFallback:this.allowMediaPickerFallback});if(!t){this.dispatchCancelled(),this.captureState="idle";return}this.dispatchCaptured(t),this.resetPopupState()}catch(t){this.errorMessage=t instanceof Error?t.message:"Capture failed",this.captureState="error",this.dispatchError(this.errorMessage)}}handlePopupRetake(){this.resetPopupState(),this.handlePopupCapture()}handlePopupCancel(){this.dispatchCancelled(),this.resetPopupState()}async beginEmbeddedCapture(){if(!this.active||this.captureState==="starting"||this.captureState==="live")return;this.stopEmbeddedSession(),this.resetEmbeddedState(),this.captureState="starting",this.feedbackMessage="Requesting camera access...",this.feedbackTone="neutral";const t=Cc({presentation:"embedded",capturePreference:this.capturePreference,allowMediaPickerFallback:this.allowMediaPickerFallback,label:this.label,confirmLabel:this.confirmLabel}),r=await Tc({capturePreference:t.capturePreference}),s=Pc(t,r),n=s.steps.find(a=>a==="auto-camera"||a==="manual-camera")??null,i=s.steps.includes("media-picker");if(!n){await this.startEmbeddedMediaPicker();return}try{this.stream=await Mc()}catch(a){if(a instanceof ps&&i){await this.startEmbeddedMediaPicker();return}this.handleEmbeddedError(a);return}if(await this.updateComplete,!this.active){this.stopEmbeddedSession();return}const o=this.embeddedVideoElement;if(!o||!this.stream){this.handleEmbeddedError(new Error("Inline camera preview could not be created."));return}o.srcObject=this.stream,this.currentCaptureStep=n,this.sessionController=new Fc({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, use Take photo now.",autoUnavailableMessage:"Automatic analysis is unavailable. Use Take photo now.",retakeReadyMessage:"When you are ready, use Take photo now."},onStateChange:a=>this.applySessionState(a)});try{await this.sessionController.start()}catch(a){this.handleEmbeddedError(a)}}async startEmbeddedMediaPicker(){this.stopEmbeddedSession(),this.currentCaptureStep="media-picker",this.captureState="starting",this.feedbackMessage="Opening media picker...",this.feedbackTone="neutral";try{const t=await Yn();if(!t){this.handleEmbeddedCancel();return}await this.showPickedPreview(t)}catch(t){this.handleEmbeddedError(t)}}applySessionState(t){if(this.captureState=t.phase,this.feedbackMessage=t.feedbackMessage,this.feedbackTone=t.feedbackTone,this.countdownProgress=t.countdownProgress,this.qualityResult=t.qualityResult,this.errorMessage=t.phase==="error"?t.errorMessage:"",this.canTakePhoto=t.canTakePhoto,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.countdownProgress=r?1:0,this.setPreviewBlob(t)}handleEmbeddedManualCapture(){var t;(t=this.sessionController)==null||t.takePhotoNow().catch(r=>{this.handleEmbeddedError(r)})}handleEmbeddedRetake(){var t;if(this.capturedBlob=null,this.qualityResult=null,this.clearPreviewUrl(),this.currentCaptureStep==="media-picker"){this.active&&this.beginEmbeddedCapture();return}(t=this.sessionController)==null||t.retake().catch(r=>{this.handleEmbeddedError(r)})}handleEmbeddedConfirm(){if(!this.capturedBlob)return;const t=this.capturedBlob;this.active=!1,this.stopEmbeddedSession(),this.resetEmbeddedState(),this.dispatchCaptured(t)}handleEmbeddedCancel(){this.active=!1,this.stopEmbeddedSession(),this.resetEmbeddedState(),this.dispatchCancelled()}handleEmbeddedError(t){this.stopEmbeddedSession(),this.errorMessage=t instanceof Error?t.message:"Capture failed",this.captureState="error",this.feedbackMessage=this.errorMessage,this.feedbackTone="error",this.dispatchError(this.errorMessage)}endEmbeddedCapture(){this.stopEmbeddedSession(),this.resetEmbeddedState()}stopEmbeddedSession(){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.countdownProgress=0}resetEmbeddedState(){this.clearPreviewUrl(),this.captureState="idle",this.errorMessage="",this.feedbackMessage="Start a capture to see camera guidance here.",this.feedbackTone="neutral",this.countdownProgress=0,this.qualityResult=null,this.capturedBlob=null}resetPopupState(){this.captureState="idle",this.errorMessage=""}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 Qn(t);return await Xn(r)}catch{return null}}},w.SimFaceCapture.styles=dl`
123
123
  :host {
124
124
  display: block;
125
125
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
@@ -170,6 +170,7 @@
170
170
  width: 100%;
171
171
  height: 100%;
172
172
  object-fit: cover;
173
+ transform: scaleX(-1);
173
174
  }
174
175
 
175
176
  .preview-img {
@@ -221,12 +222,6 @@
221
222
  gap: 12px;
222
223
  }
223
224
 
224
- .preview-img-inline {
225
- max-width: 100%;
226
- border-radius: 8px;
227
- margin: 12px 0;
228
- }
229
-
230
225
  .btn {
231
226
  display: inline-flex;
232
227
  align-items: center;
@@ -292,6 +287,11 @@
292
287
  color: #0f172a;
293
288
  }
294
289
 
290
+ .quality-manual {
291
+ background: #e0f2fe;
292
+ color: #0f172a;
293
+ }
294
+
295
295
  .spinner {
296
296
  display: inline-block;
297
297
  width: 24px;
@@ -312,4 +312,4 @@
312
312
  transform: rotate(360deg);
313
313
  }
314
314
  }
315
- `,ve([Vr({type:String})],k.SimFaceCapture.prototype,"label",2),ve([Vr({type:Boolean,reflect:!0})],k.SimFaceCapture.prototype,"embedded",2),ve([Vr({type:Boolean,reflect:!0})],k.SimFaceCapture.prototype,"active",2),ve([Vr({type:String,attribute:"confirm-label"})],k.SimFaceCapture.prototype,"confirmLabel",2),ve([$t()],k.SimFaceCapture.prototype,"captureState",2),ve([$t()],k.SimFaceCapture.prototype,"errorMessage",2),ve([$t()],k.SimFaceCapture.prototype,"feedbackMessage",2),ve([$t()],k.SimFaceCapture.prototype,"feedbackTone",2),ve([$t()],k.SimFaceCapture.prototype,"previewUrl",2),ve([$t()],k.SimFaceCapture.prototype,"countdownProgress",2),ve([$t()],k.SimFaceCapture.prototype,"qualityResult",2),ve([O1("#embedded-video")],k.SimFaceCapture.prototype,"embeddedVideoElement",2),k.SimFaceCapture=ve([M1("simface-capture")],k.SimFaceCapture);async function B1(e,t){const r=new dt(e);await r.validateAPIKey();const n=await Jc();if(!n)return{success:!1,clientId:t,message:"Capture cancelled by user"};const s=await r.enroll(t,n);return s.alreadyEnrolled,s}async function D1(e,t){const r=new dt(e);await r.validateAPIKey();const n=await Jc();return n?r.verify(t,n):{match:!1,score:0,threshold:0,message:"Capture cancelled by user"}}async function Jc(){return ci()}k.SimFaceAPIClient=dt,k.assessFaceQuality=oi,k.assessFaceQualityForVideo=ai,k.blobToDataURL=h1,k.blobToImage=hi,k.captureFromCamera=ci,k.enroll=B1,k.verify=D1,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})}));
315
+ `,Z([Et({type:String})],w.SimFaceCapture.prototype,"label",2),Z([Et({type:Boolean,reflect:!0})],w.SimFaceCapture.prototype,"embedded",2),Z([Et({type:Boolean,reflect:!0})],w.SimFaceCapture.prototype,"active",2),Z([Et({type:String,attribute:"confirm-label"})],w.SimFaceCapture.prototype,"confirmLabel",2),Z([Et({type:String,attribute:"capture-preference"})],w.SimFaceCapture.prototype,"capturePreference",2),Z([Et({type:Boolean,attribute:"allow-media-picker-fallback"})],w.SimFaceCapture.prototype,"allowMediaPickerFallback",2),Z([et()],w.SimFaceCapture.prototype,"captureState",2),Z([et()],w.SimFaceCapture.prototype,"errorMessage",2),Z([et()],w.SimFaceCapture.prototype,"feedbackMessage",2),Z([et()],w.SimFaceCapture.prototype,"feedbackTone",2),Z([et()],w.SimFaceCapture.prototype,"previewUrl",2),Z([et()],w.SimFaceCapture.prototype,"countdownProgress",2),Z([et()],w.SimFaceCapture.prototype,"qualityResult",2),Z([et()],w.SimFaceCapture.prototype,"canTakePhoto",2),Z([Rl("#embedded-video")],w.SimFaceCapture.prototype,"embeddedVideoElement",2),w.SimFaceCapture=Z([Fl("simface-capture")],w.SimFaceCapture);const Nl=Object.freeze(Object.defineProperty({__proto__:null,get SimFaceCapture(){return w.SimFaceCapture}},Symbol.toStringTag,{value:"Module"}));async function Bl(e,t,r){const s=new tt(e);await s.validateAPIKey();const n=await Xc(r);if(!n)return{success:!1,clientId:t,message:"Capture cancelled by user"};const i=await s.enroll(t,n);return i.alreadyEnrolled,i}async function Dl(e,t,r){const s=new tt(e);await s.validateAPIKey();const n=await Xc(r);return n?s.verify(t,n):{match:!1,score:0,threshold:0,message:"Capture cancelled by user"}}async function Xc(e){return Jn(e)}w.SimFaceAPIClient=tt,w.assessFaceQuality=Xn,w.assessFaceQualityForVideo=kc,w.blobToDataURL=rl,w.blobToImage=Qn,w.captureFromCamera=Jn,w.enroll=Bl,w.verify=Dl,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})}));