UNPKG

@needle-tools/facefilter

Version:

Needle Engine FaceFilter

1 lines 217 kB
"use strict";var f2=Object.defineProperty;var m2=(e,t,r)=>t in e?f2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var d=(e,t,r)=>m2(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("@needle-tools/engine"),g=require("three");var tr=typeof self<"u"?self:{};function to(e){e:{for(var t=["CLOSURE_FLAGS"],r=tr,i=0;i<t.length;i++)if((r=r[t[i]])==null){t=null;break e}t=r}return(e=t&&t[e])!=null&&e}function lt(){throw Error("Invalid UTF8")}function Ys(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}let mr,ui;const p2=typeof TextDecoder<"u";let g2;const _2=typeof TextEncoder<"u";function ro(e){if(_2)e=(g2||(g2=new TextEncoder)).encode(e);else{let r=0;const i=new Uint8Array(3*e.length);for(let s=0;s<e.length;s++){var t=e.charCodeAt(s);if(128>t)i[r++]=t;else{if(2048>t)i[r++]=t>>6|192;else{if(55296<=t&&57343>=t){if(56319>=t&&s<e.length){const n=e.charCodeAt(++s);if(56320<=n&&57343>=n){t=1024*(t-55296)+n-56320+65536,i[r++]=t>>18|240,i[r++]=t>>12&63|128,i[r++]=t>>6&63|128,i[r++]=63&t|128;continue}s--}t=65533}i[r++]=t>>12|224,i[r++]=t>>6&63|128}i[r++]=63&t|128}}e=r===i.length?i:i.subarray(0,r)}return e}var Yt,io=to(610401301),v2=to(188588736);const qs=tr.navigator;function ki(e){return!!io&&!!Yt&&Yt.brands.some(({brand:t})=>t&&t.indexOf(e)!=-1)}function we(e){var t;return(t=tr.navigator)&&(t=t.userAgent)||(t=""),t.indexOf(e)!=-1}function Je(){return!!io&&!!Yt&&0<Yt.brands.length}function di(){return Je()?ki("Chromium"):(we("Chrome")||we("CriOS"))&&!(!Je()&&we("Edge"))||we("Silk")}function Xi(e){return Xi[" "](e),e}Yt=qs&&qs.userAgentData||null,Xi[" "]=function(){};var y2=!Je()&&(we("Trident")||we("MSIE"));!we("Android")||di(),di(),we("Safari")&&(di()||!Je()&&we("Coast")||!Je()&&we("Opera")||!Je()&&we("Edge")||(Je()?ki("Microsoft Edge"):we("Edg/"))||Je()&&ki("Opera"));var so={},Vt=null;function b2(e){var t=e.length,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);var i=new Uint8Array(r),s=0;return function(n,o){function c(y){for(;a<n.length;){var _=n.charAt(a++),E=Vt[_];if(E!=null)return E;if(!/^[\s\xa0]*$/.test(_))throw Error("Unknown base64 encoding at char: "+_)}return y}no();for(var a=0;;){var l=c(-1),u=c(0),h=c(64),m=c(64);if(m===64&&l===-1)break;o(l<<2|u>>4),h!=64&&(o(u<<4&240|h>>2),m!=64&&o(h<<6&192|m))}}(e,function(n){i[s++]=n}),s!==r?i.subarray(0,s):i}function no(){if(!Vt){Vt={};for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"],r=0;5>r;r++){var i=e.concat(t[r].split(""));so[r]=i;for(var s=0;s<i.length;s++){var n=i[s];Vt[n]===void 0&&(Vt[n]=s)}}}}var oo=typeof Uint8Array<"u",ao=!y2&&typeof btoa=="function";function Qs(e){if(!ao){var t;t===void 0&&(t=0),no(),t=so[t];var r=Array(Math.floor(e.length/3)),i=t[64]||"";let a=0,l=0;for(;a<e.length-2;a+=3){var s=e[a],n=e[a+1],o=e[a+2],c=t[s>>2];s=t[(3&s)<<4|n>>4],n=t[(15&n)<<2|o>>6],o=t[63&o],r[l++]=c+s+n+o}switch(c=0,o=i,e.length-a){case 2:o=t[(15&(c=e[a+1]))<<2]||i;case 1:e=e[a],r[l]=t[e>>2]+t[(3&e)<<4|c>>4]+o+i}return r.join("")}for(t="",r=0,i=e.length-10240;r<i;)t+=String.fromCharCode.apply(null,e.subarray(r,r+=10240));return t+=String.fromCharCode.apply(null,r?e.subarray(r):e),btoa(t)}const Js=/[-_.]/g,w2={"-":"+",_:"/",".":"="};function x2(e){return w2[e]||""}function co(e){if(!ao)return b2(e);Js.test(e)&&(e=e.replace(Js,x2)),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 rr(e){return oo&&e!=null&&e instanceof Uint8Array}let T2;function Vr(){return T2||(T2=new Uint8Array(0))}var bt={};let E2;function lo(e){if(e!==bt)throw Error("illegal external caller")}function pt(){return E2||(E2=new Ke(null,bt))}function Ki(e){lo(bt);var t=e.g;return(t=t==null||rr(t)?t:typeof t=="string"?co(t):null)==null?t:e.g=t}var Ke=class{constructor(e,t){if(lo(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}h(){const e=Ki(this);return e?new Uint8Array(e):Vr()}};function ho(e,t){return Error(`Invalid wire type: ${e} (at position ${t})`)}function $i(){return Error("Failed to read varint, encoding is invalid.")}function uo(e,t){return Error(`Tried to read past the end of the data ${t} > ${e}`)}function Yi(e){if(typeof e=="string")return{buffer:co(e),P:!1};if(Array.isArray(e))return{buffer:new Uint8Array(e),P:!1};if(e.constructor===Uint8Array)return{buffer:e,P:!1};if(e.constructor===ArrayBuffer)return{buffer:new Uint8Array(e),P:!1};if(e.constructor===Ke)return{buffer:Ki(e)||Vr(),P:!0};if(e instanceof Uint8Array)return{buffer:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),P:!1};throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, a ByteString or an Array of numbers")}function qi(){return typeof BigInt=="function"}const k2=typeof Uint8Array.prototype.slice=="function";let fo,R=0,X=0;function ut(e){const t=0>e;let r=(e=Math.abs(e))>>>0;if(e=Math.floor((e-r)/4294967296),t){const[i,s]=Zi(r,e);e=s,r=i}R=r>>>0,X=e>>>0}function Qi(e){const t=fo||(fo=new DataView(new ArrayBuffer(8)));t.setFloat32(0,+e,!0),X=0,R=t.getUint32(0,!0)}function Ai(e,t){return 4294967296*t+(e>>>0)}function Ji(e,t){const r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),e=Ai(e,t),r?-e:e}function Sr(e,t){if(e>>>=0,2097151>=(t>>>=0))var r=""+(4294967296*t+e);else qi()?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,1e7<=e&&(r+=Math.floor(e/1e7),e%=1e7),1e7<=r&&(t+=Math.floor(r/1e7),r%=1e7),r=t+Zs(r)+Zs(e));return r}function Zs(e){return e=String(e),"0000000".slice(e.length)+e}function mo(){var e=R,t=X;if(2147483648&t)if(qi())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{const[r,i]=Zi(e,t);e="-"+Sr(r,i)}else e=Sr(e,t);return e}function Gr(e){if(16>e.length)ut(Number(e));else if(qi())e=BigInt(e),R=Number(e&BigInt(4294967295))>>>0,X=Number(e>>BigInt(32)&BigInt(4294967295));else{const t=+(e[0]==="-");X=R=0;const r=e.length;for(let i=t,s=(r-t)%6+t;s<=r;i=s,s+=6){const n=Number(e.slice(i,s));X*=1e6,R=1e6*R+n,4294967296<=R&&(X+=Math.trunc(R/4294967296),X>>>=0,R>>>=0)}if(t){const[i,s]=Zi(R,X);R=i,X=s}}}function Zi(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}function es(e,t){let r,i=0,s=0,n=0;const o=e.h;let c=e.g;do r=o[c++],i|=(127&r)<<n,n+=7;while(32>n&&128&r);for(32<n&&(s|=(127&r)>>4),n=3;32>n&&128&r;n+=7)r=o[c++],s|=(127&r)<<n;if(dt(e,c),128>r)return t(i>>>0,s>>>0);throw $i()}function ts(e){let t=0,r=e.g;const i=r+10,s=e.h;for(;r<i;){const n=s[r++];if(t|=n,(128&n)==0)return dt(e,r),!!(127&t)}throw $i()}function tt(e){const t=e.h;let r=e.g,i=t[r++],s=127&i;if(128&i&&(i=t[r++],s|=(127&i)<<7,128&i&&(i=t[r++],s|=(127&i)<<14,128&i&&(i=t[r++],s|=(127&i)<<21,128&i&&(i=t[r++],s|=i<<28,128&i&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++])))))throw $i();return dt(e,r),s}function rt(e){return tt(e)>>>0}function Fi(e){var t=e.h;const r=e.g,i=t[r],s=t[r+1],n=t[r+2];return t=t[r+3],dt(e,e.g+4),(i<<0|s<<8|n<<16|t<<24)>>>0}function Mi(e){var t=Fi(e);e=2*(t>>31)+1;const r=t>>>23&255;return t&=8388607,r==255?t?NaN:1/0*e:r==0?e*Math.pow(2,-149)*t:e*Math.pow(2,r-150)*(t+Math.pow(2,23))}function A2(e){return tt(e)}function fi(e,t,{ca:r=!1}={}){e.ca=r,t&&(t=Yi(t),e.h=t.buffer,e.m=t.P,e.j=0,e.l=e.h.length,e.g=e.j)}function dt(e,t){if(e.g=t,t>e.l)throw uo(e.l,t)}function po(e,t){if(0>t)throw Error(`Tried to read a negative byte length: ${t}`);const r=e.g,i=r+t;if(i>e.l)throw uo(t,e.l-r);return e.g=i,r}function go(e,t){if(t==0)return pt();var r=po(e,t);return e.ca&&e.m?r=e.h.subarray(r,r+t):(e=e.h,r=r===(t=r+t)?Vr():k2?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?pt():new Ke(r,bt)}var en=[];function _o(e){var t=e.g;if(t.g==t.l)return!1;e.l=e.g.g;var r=rt(e.g);if(t=r>>>3,!(0<=(r&=7)&&5>=r))throw ho(r,e.l);if(1>t)throw Error(`Invalid field number: ${t} (at position ${e.l})`);return e.m=t,e.h=r,!0}function wr(e){switch(e.h){case 0:e.h!=0?wr(e):ts(e.g);break;case 1:dt(e=e.g,e.g+8);break;case 2:if(e.h!=2)wr(e);else{var t=rt(e.g);dt(e=e.g,e.g+t)}break;case 5:dt(e=e.g,e.g+4);break;case 3:for(t=e.m;;){if(!_o(e))throw Error("Unmatched start-group tag: stream EOF");if(e.h==4){if(e.m!=t)throw Error("Unmatched end-group tag");break}wr(e)}break;default:throw ho(e.h,e.l)}}function ir(e,t,r){const i=e.g.l,s=rt(e.g),n=e.g.g+s;let o=n-i;if(0>=o&&(e.g.l=n,r(t,e,void 0,void 0,void 0),o=n-e.g.g),o)throw Error(`Message parsing ended unexpectedly. Expected to read ${s} bytes, instead read ${s-o} bytes, either the data ended unexpectedly or the message misreported its own length`);return e.g.g=n,e.g.l=i,t}function rs(e){var t=rt(e.g),r=po(e=e.g,t);if(e=e.h,p2){var i,s=e;(i=ui)||(i=ui=new TextDecoder("utf-8",{fatal:!0})),t=r+t,s=r===0&&t===s.length?s:s.subarray(r,t);try{var n=i.decode(s)}catch(c){if(mr===void 0){try{i.decode(new Uint8Array([128]))}catch{}try{i.decode(new Uint8Array([97])),mr=!0}catch{mr=!1}}throw!mr&&(ui=void 0),c}}else{t=(n=r)+t,r=[];let c,a=null;for(;n<t;){var o=e[n++];128>o?r.push(o):224>o?n>=t?lt():(c=e[n++],194>o||(192&c)!=128?(n--,lt()):r.push((31&o)<<6|63&c)):240>o?n>=t-1?lt():(c=e[n++],(192&c)!=128||o===224&&160>c||o===237&&160<=c||(192&(i=e[n++]))!=128?(n--,lt()):r.push((15&o)<<12|(63&c)<<6|63&i)):244>=o?n>=t-2?lt():(c=e[n++],(192&c)!=128||c-144+(o<<28)>>30!=0||(192&(i=e[n++]))!=128||(192&(s=e[n++]))!=128?(n--,lt()):(o=(7&o)<<18|(63&c)<<12|(63&i)<<6|63&s,o-=65536,r.push(55296+(o>>10&1023),56320+(1023&o)))):lt(),8192<=r.length&&(a=Ys(a,r),r.length=0)}n=Ys(a,r)}return n}function vo(e){const t=rt(e.g);return go(e.g,t)}function Wr(e,t,r){var i=rt(e.g);for(i=e.g.g+i;e.g.g<i;)r.push(t(e.g))}var pr=[];function tn(e){return e?/^\d+$/.test(e)?(Gr(e),new rn(R,X)):null:F2||(F2=new rn(0,0))}var rn=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let F2;function sn(e){return e?/^-?\d+$/.test(e)?(Gr(e),new nn(R,X)):null:M2||(M2=new nn(0,0))}var nn=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let M2;function Lr(e,t,r){for(;0<r||127<t;)e.g.push(127&t|128),t=(t>>>7|r<<25)>>>0,r>>>=7;e.g.push(t)}function sr(e,t){for(;127<t;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function Hr(e,t){if(0<=t)sr(e,t);else{for(let r=0;9>r;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function qt(e,t){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 wt(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function Ee(e,t,r){sr(e.g,8*t+r)}function is(e,t){return Ee(e,t,2),t=e.g.end(),wt(e,t),t.push(e.h),t}function ss(e,t){var r=t.pop();for(r=e.h+e.g.length()-r;127<r;)t.push(127&r|128),r>>>=7,e.h++;t.push(r),e.h++}function zr(e,t,r){Ee(e,t,2),sr(e.g,r.length),wt(e,e.g.end()),wt(e,r)}function Si(e,t,r,i){r!=null&&(t=is(e,t),i(r,e),ss(e,t))}class St{constructor(t,r,i,s){this.g=t,this.h=r,this.l=i,this.pa=s}}function me(e){return Array.prototype.slice.call(e)}function ns(e){return typeof Symbol=="function"&&typeof Symbol()=="symbol"?Symbol():e}var Ue=ns(),on=ns("0di"),mi=ns("2ex"),os=Ue?(e,t)=>{e[Ue]|=t}:(e,t)=>{e.g!==void 0?e.g|=t:Object.defineProperties(e,{g:{value:t,configurable:!0,writable:!0,enumerable:!1}})},Cr=Ue?(e,t)=>{e[Ue]&=~t}:(e,t)=>{e.g!==void 0&&(e.g&=~t)};function Q(e,t,r){return r?e|t:e&~t}var V=Ue?e=>0|e[Ue]:e=>0|e.g,M=Ue?e=>e[Ue]:e=>e.g,j=Ue?(e,t)=>(e[Ue]=t,e):(e,t)=>(e.g!==void 0?e.g=t:Object.defineProperties(e,{g:{value:t,configurable:!0,writable:!0,enumerable:!1}}),e);function Lt(e){return os(e,34),e}function S2(e,t){j(t,-14591&(0|e))}function Li(e,t){j(t,-14557&(34|e))}function yo(e){return(e=e>>14&1023)===0?536870912:e}var as,nr={},bo={};function an(e){return!(!e||typeof e!="object"||e.Ja!==bo)}function cs(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.constructor===Object}function ls(e,t,r){if(e!=null){if(typeof e=="string")e=e?new Ke(e,bt):pt();else if(e.constructor!==Ke)if(rr(e))e=e.length?new Ke(r?e:new Uint8Array(e),bt):pt();else{if(!t)throw Error();e=void 0}}return e}function Or(e,t,r){if(!Array.isArray(e)||e.length)return!1;const i=V(e);return!!(1&i)||!(!t||!(Array.isArray(t)?t.includes(r):t.has(r)))&&(j(e,1|i),!0)}const cn=[];function je(e){if(2&e)throw Error()}j(cn,55),as=Object.freeze(cn);class Rr{constructor(t,r,i){this.l=0,this.g=t,this.h=r,this.m=i}next(){if(this.l<this.g.length){const t=this.g[this.l++];return{done:!1,value:this.h?this.h.call(this.m,t):t}}return{done:!0,value:void 0}}[Symbol.iterator](){return new Rr(this.g,this.h,this.m)}}let Ze,L2,C2;function wo(e,t){(t=Ze?t[Ze]:void 0)&&(e[Ze]=me(t))}function xo(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function O2(){const e=Error();xo(e,"incident"),function(t){tr.setTimeout(()=>{throw t},0)}(e)}function Ci(e){return xo(e=Error(e),"warning"),e}function at(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function To(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}Object.freeze(new class{}),Object.freeze(new class{});const R2=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Xr(e){const t=typeof e;return t==="number"?Number.isFinite(e):t==="string"&&R2.test(e)}function Ct(e){if(e==null)return e;if(typeof e=="string"){if(!e)return;e=+e}return typeof e=="number"&&Number.isFinite(e)?0|e:void 0}function P2(e){if(e==null)return e;if(typeof e=="string"){if(!e)return;e=+e}return typeof e=="number"&&Number.isFinite(e)?e>>>0:void 0}function ln(e){return e[0]!=="-"&&(20>e.length||e.length===20&&184467>Number(e.substring(0,6)))}function Eo(e){return e[0]==="-"?20>e.length||e.length===20&&-922337<Number(e.substring(0,7)):19>e.length||e.length===19&&922337>Number(e.substring(0,6))}function hs(e){return e=Math.trunc(e),Number.isSafeInteger(e)||(ut(e),e=Ji(R,X)),e}function us(e){var t=Math.trunc(Number(e));return Number.isSafeInteger(t)?String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Eo(e)||(Gr(e),e=mo()),e)}function Pr(e){return e==null?e:Xr(e)?typeof e=="number"?hs(e):us(e):void 0}function or(e){if(typeof e!="string")throw Error();return e}function Ot(e){if(e!=null&&typeof e!="string")throw Error();return e}function ft(e){return e==null||typeof e=="string"?e:void 0}function ds(e,t,r,i){if(e!=null&&typeof e=="object"&&e.X===nr)return e;if(!Array.isArray(e))return r?2&i?(e=t[on])?t=e:(Lt((e=new t).s),t=t[on]=e):t=new t:t=void 0,t;let s=r=V(e);return s===0&&(s|=32&i),s|=2&i,s!==r&&j(e,s),new t(e)}function D2(e,t,r){if(t){var i=!!i;if(!Xr(t=e))throw Ci("int64");typeof t=="string"?i=us(t):i?(i=Math.trunc(t),Number.isSafeInteger(i)?i=String(i):Eo(t=String(i))?i=t:(ut(i),i=mo())):i=hs(t)}else i=Pr(e);return typeof(r=(e=i)==null?r?0:void 0:e)=="string"&&(i=+r,Number.isSafeInteger(i))?i:r}let Dr,fs,U2;function Ur(e){switch(typeof e){case"boolean":return fs||(fs=[0,void 0,!0]);case"number":return 0<e?void 0:e===0?U2||(U2=[0,void 0]):[-e,void 0];case"string":return[0,e];case"object":return e}}function mt(e,t){return ko(e,t[0],t[1])}function ko(e,t,r){if(e==null&&(e=Dr),Dr=void 0,e==null){var i=96;r?(e=[r],i|=512):e=[],t&&(i=-16760833&i|(1023&t)<<14)}else{if(!Array.isArray(e))throw Error("narr");if(2048&(i=V(e)))throw Error("farr");if(64&i)return e;if(i|=64,r&&(i|=512,r!==e[0]))throw Error("mid");e:{const s=(r=e).length;if(s){const n=s-1;if(cs(r[n])){if(1024<=(t=n-(+!!(512&(i|=256))-1)))throw Error("pvtlmt");i=-16760833&i|(1023&t)<<14;break e}}if(t){if(1024<(t=Math.max(t,s-(+!!(512&i)-1))))throw Error("spvt");i=-16760833&i|(1023&t)<<14}}}return j(e,i),e}const I2={};let B2=function(){try{return Xi(new class extends Map{constructor(){super()}}),!1}catch{return!0}}();class pi{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 N2=B2?(Object.setPrototypeOf(pi.prototype,Map.prototype),Object.defineProperties(pi.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),pi):class extends Map{constructor(){super()}};function hn(e){return e}function gi(e){if(2&e.N)throw Error("Cannot mutate an immutable Map")}var Te=class extends N2{constructor(e,t,r=hn,i=hn){super();let s=V(e);s|=64,j(e,s),this.N=s,this.U=t,this.S=r,this.Z=this.U?j2:i;for(let n=0;n<e.length;n++){const o=e[n],c=r(o[0],!1,!0);let a=o[1];t?a===void 0&&(a=null):a=i(o[1],!1,!0,void 0,void 0,s),super.set(c,a)}}oa(e=un){if(this.size!==0)return this.Y(e)}Y(e=un){const t=[],r=super.entries();for(var i;!(i=r.next()).done;)(i=i.value)[0]=e(i[0]),i[1]=e(i[1]),t.push(i);return t}clear(){gi(this),super.clear()}delete(e){return gi(this),super.delete(this.S(e,!0,!1))}entries(){var e=this.na();return new Rr(e,V2,this)}keys(){return this.Ia()}values(){var e=this.na();return new Rr(e,Te.prototype.get,this)}forEach(e,t){super.forEach((r,i)=>{e.call(t,this.get(i),i,this)})}set(e,t){return gi(this),(e=this.S(e,!0,!1))==null?this:t==null?(super.delete(e),this):super.set(e,this.Z(t,!0,!0,this.U,!1,this.N))}Oa(e){const t=this.S(e[0],!1,!0);e=e[1],e=this.U?e===void 0?null:e:this.Z(e,!1,!0,void 0,!1,this.N),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.U;return r?((r=this.Z(t,!1,!0,r,this.ta,this.N))!==t&&super.set(e,r),r):t}}na(){return Array.from(super.keys())}Ia(){return super.keys()}[Symbol.iterator](){return this.entries()}};function j2(e,t,r,i,s,n){return e=ds(e,i,r,n),s&&(e=$r(e)),e}function un(e){return e}function V2(e){return[e,this.get(e)]}let G2;function dn(){return G2||(G2=new Te(Lt([]),void 0,void 0,void 0,I2))}function ms(e,t,r,i,s){if(e!=null){if(Array.isArray(e))e=Or(e,void 0,0)?void 0:s&&2&V(e)?e:Kr(e,t,r,i!==void 0,s);else if(cs(e)){const n={};for(let o in e)n[o]=ms(e[o],t,r,i,s);e=n}else e=t(e,i);return e}}function Kr(e,t,r,i,s){const n=i||r?V(e):0;i=i?!!(32&n):void 0;const o=me(e);for(let c=0;c<o.length;c++)o[c]=ms(o[c],t,r,i,s);return r&&(wo(o,e),r(n,o)),o}function W2(e){return ms(e,ps,void 0,void 0,!1)}function ps(e){return e.X===nr?e.toJSON():e instanceof Te?e.oa(W2):function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"boolean":return t?1:0;case"object":if(t)if(Array.isArray(t)){if(Or(t,void 0,0))return}else{if(rr(t))return Qs(t);if(t instanceof Ke){const r=t.g;return r==null?"":typeof r=="string"?r:t.g=Qs(r)}if(t instanceof Te)return t.oa()}}return t}(e)}function Oi(e,t,r=Li){if(e!=null){if(oo&&e instanceof Uint8Array)return t?e:new Uint8Array(e);if(Array.isArray(e)){var i=V(e);return 2&i||(t&&(t=i===0||!!(32&i)&&!(64&i||!(16&i))),e=t?j(e,-12293&(34|i)):Kr(e,Oi,4&i?Li:r,!0,!0)),e}return e.X===nr?(r=e.s,e=2&(i=M(r))?e:gs(e,r,i,!0)):e instanceof Te&&!(2&e.N)&&(r=Lt(e.Y(Oi)),e=new Te(r,e.U,e.S,e.Z)),e}}function gs(e,t,r,i){return e=e.constructor,Dr=t=Ao(t,r,i),t=new e(t),Dr=void 0,t}function Ao(e,t,r){const i=r||2&t?Li:S2,s=!!(32&t);return e=function(n,o,c){const a=me(n);var l=a.length;const u=256&o?a[l-1]:void 0;for(l+=u?-1:0,o=512&o?1:0;o<l;o++)a[o]=c(a[o]);if(u){o=a[o]={};for(const h in u)o[h]=c(u[h])}return wo(a,n),a}(e,t,n=>Oi(n,s,i)),os(e,32|(r?2:0)),e}function $r(e){const t=e.s,r=M(t);return 2&r?gs(e,t,r,!1):e}function Fo(e,t,r,i){return!(4&t)||r!=null}function it(e,t){return Ve(e=e.s,M(e),t)}function fn(e,t,r,i){if(!(0>(t=i+(+!!(512&t)-1))||t>=e.length||t>=r))return e[t]}function Ve(e,t,r,i){if(r===-1)return null;const s=yo(t);if(!(r>=s)){var n=e.length;return i&&256&t&&(i=e[n-1][r])!=null?(fn(e,t,s,r)&&mi!=null&&(4<=(t=(e=C2??(C2={}))[mi]||0)||(e[mi]=t+1,O2())),i):fn(e,t,s,r)}return 256&t?e[e.length-1][r]:void 0}function C(e,t,r,i){const s=e.s;let n=M(s);return je(n),P(s,n,t,r,i),e}function P(e,t,r,i,s){const n=yo(t);if(r>=n||s){let o=t;if(256&t)s=e[e.length-1];else{if(i==null)return o;s=e[n+(+!!(512&t)-1)]={},o|=256}return s[r]=i,r<n&&(e[r+(+!!(512&t)-1)]=void 0),o!==t&&j(e,o),o}return e[r+(+!!(512&t)-1)]=i,256&t&&r in(e=e[e.length-1])&&delete e[r],t}function Rt(e,t,r,i,s){var n=2&t;let o=Ve(e,t,r,s);Array.isArray(o)||(o=as);const c=!(2&i);i=!(1&i);const a=!!(32&t);let l=V(o);return l!==0||!a||n||c?1&l||(l|=1,j(o,l)):(l|=33,j(o,l)),n?(e=!1,2&l||(Lt(o),e=!!(4&l)),(i||e)&&Object.freeze(o)):(n=!!(2&l)||!!(2048&l),i&&n?(o=me(o),i=1,a&&!c&&(i|=32),j(o,i),P(e,t,r,o,s)):c&&32&l&&!n&&Cr(o,32)),o}function xr(e,t){e=e.s;let r=M(e);const i=Ve(e,r,t),s=at(i);return s!=null&&s!==i&&P(e,r,t,s),s}function Mo(e){e=e.s;let t=M(e);const r=Ve(e,t,1),i=ls(r,!0,!!(34&t));return i!=null&&i!==r&&P(e,t,1,i),i}function vt(e,t,r){const i=e.s;let s=M(i);const n=2&s?1:2;let o=So(i,s,t);var c=V(o);if(Fo(e,c,void 0)){(4&c||Object.isFrozen(o))&&(o=me(o),c=gt(c,s),s=P(i,s,t,o));let a=e=0;for(;e<o.length;e++){const l=r(o[e]);l!=null&&(o[a++]=l)}a<e&&(o.length=a),c=Q(c=Lo(c,s),20,!0),c=Q(c,4096,!1),c=Q(c,8192,!1),j(o,c),2&c&&Object.freeze(o)}return Wt(c)||(r=c,(c=(e=n===1||n===4&&!!(32&c))?Q(c,2,!0):xt(c,s,!1))!==r&&j(o,c),e&&Object.freeze(o)),n===2&&Wt(c)&&(o=me(o),c=xt(c=gt(c,s),s,!1),j(o,c),P(i,s,t,o)),o}function So(e,t,r){return e=Ve(e,t,r),Array.isArray(e)?e:as}function Lo(e,t){return e===0&&(e=gt(e,t)),Q(e,1,!0)}function Wt(e){return!!(2&e)&&!!(4&e)||!!(2048&e)}function Co(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]=Lt(r[1]))}return e}function Ir(e,t,r){{const c=e.s;let a=M(c);if(je(a),r==null)P(c,a,t);else{var i,s=V(r),n=s,o=!!(2&s)||Object.isFrozen(r);if((i=!o)&&(i=!1),Fo(e,s))for(s=21,o&&(r=me(r),n=0,s=xt(s=gt(s,a),a,!0)),e=0;e<r.length;e++)r[e]=or(r[e]);i&&(r=me(r),n=0,s=xt(s=gt(s,a),a,!0)),s!==n&&j(r,s),P(c,a,t,r)}}}function Ri(e,t,r,i){e=e.s;let s=M(e);je(s),P(e,s,t,(i==="0"?Number(r)===0:r===i)?void 0:r)}function ar(e,t,r,i){const s=M(e);je(s),e=Rt(e,s,t,2),i=r(i,!!(4&(t=V(e)))&&!!(4096&t)),e.push(i)}function H2(e){return e}function _i(e,t){return _s(e=e.s,M(e),pa)===t?t:-1}function _s(e,t,r){let i=0;for(let s=0;s<r.length;s++){const n=r[s];Ve(e,t,n)!=null&&(i!==0&&(t=P(e,t,i)),i=n)}return i}function vs(e,t,r,i){let s=M(e);je(s);const n=Ve(e,s,r,i);let o;if(n!=null&&n.X===nr)return(t=$r(n))!==n&&P(e,s,r,t,i),t.s;if(Array.isArray(n)){const c=V(n);o=2&c?Ao(n,c,!1):n,o=mt(o,t)}else o=mt(void 0,t);return o!==n&&P(e,s,r,o,i),o}function Oo(e,t,r,i){e=e.s;let s=M(e);const n=Ve(e,s,r,i);return(t=ds(n,t,!1,s))!==n&&t!=null&&P(e,s,r,t,i),t}function A(e,t,r,i=!1){if((t=Oo(e,t,r,i))==null)return t;e=e.s;let s=M(e);if(!(2&s)){const n=$r(t);n!==t&&P(e,s,r,t=n,i)}return t}function Ro(e,t,r,i,s,n){var o=2,c=!!(2&t);o=c?1:o,s=!!s,n&&(n=!c),c=So(e,t,i);var a=V(c);const l=!!(4&a);if(!l){var u=c,h=t;const m=!!(2&(a=Lo(a,t)));m&&(h=Q(h,2,!0));let y=!m,_=!0,E=0,he=0;for(;E<u.length;E++){const ee=ds(u[E],r,!1,h);if(ee instanceof r){if(!m){const Ce=!!(2&V(ee.s));y&&(y=!Ce),_&&(_=Ce)}u[he++]=ee}}he<E&&(u.length=he),a=Q(a,4,!0),a=Q(a,16,_),a=Q(a,8,y),j(u,a),m&&Object.freeze(u)}if(n&&!(8&a||!c.length&&(o===1||o===4&&32&a))){for(Wt(a)&&(c=me(c),a=gt(a,t),t=P(e,t,i,c)),r=c,n=a,u=0;u<r.length;u++)(a=r[u])!==(h=$r(a))&&(r[u]=h);n=Q(n,8,!0),n=Q(n,16,!r.length),j(r,n),a=n}return Wt(a)||(r=a,(a=(n=o===1||o===4&&!!(32&a))?Q(a,!c.length||16&a&&(!l||32&a)?2:2048,!0):xt(a,t,s))!==r&&j(c,a),n&&Object.freeze(c)),o===2&&Wt(a)&&(c=me(c),a=xt(a=gt(a,t),t,s),j(c,a),P(e,t,i,c)),c}function Ye(e,t,r){e=e.s;const i=M(e);return Ro(e,i,t,r,!1,!(2&i))}function x(e,t,r,i,s){return i==null&&(i=void 0),C(e,r,i,s)}function Ht(e,t,r,i){i==null&&(i=void 0),e=e.s;let s=M(e);je(s),(r=_s(e,s,r))&&r!==t&&i!=null&&(s=P(e,s,r)),P(e,s,t,i)}function gt(e,t){return e=Q(e,2,!!(2&t)),e=Q(e,32,!0),Q(e,2048,!1)}function xt(e,t,r){return 32&t&&r||(e=Q(e,32,!1)),e}function Br(e,t,r,i){e=e.s;const s=M(e);je(s),t=Ro(e,s,r,t,!0),r=i??new r,t.push(r),2&V(r.s)?Cr(t,8):Cr(t,16)}function xe(e,t){return Ct(it(e,t))}function Fe(e,t){return e??t}function W(e,t){return Fe(xr(e,t),0)}function Ie(e,t){return Fe(ft(it(e,t)),"")}function Qt(e,t,r){if(r!=null&&typeof r!="boolean")throw e=typeof r,Error(`Expected boolean but got ${e!="object"?e:r?Array.isArray(r)?"array":e:"null"}: ${r}`);C(e,t,r)}function Be(e,t,r){if(r!=null){if(typeof r!="number"||!Number.isFinite(r))throw Ci("int32");r|=0}C(e,t,r)}function b(e,t,r){if(r!=null&&typeof r!="number")throw Error(`Value of float/double field must be a number, found ${typeof r}: ${r}`);C(e,t,r)}function Me(e,t,r){t.g?t.m(e,t.g,t.h,r,!0):t.m(e,t.h,r,!0)}Te.prototype.toJSON=void 0,Te.prototype.Ja=bo;var v=class{constructor(e,t){this.s=ko(e,t)}toJSON(){return Po(this,Kr(this.s,ps,void 0,void 0,!1),!0)}l(){var e=q0;return e.g?e.l(this,e.g,e.h,!0):e.l(this,e.h,e.defaultValue,!0)}clone(){const e=this.s;return gs(this,e,M(e),!1)}P(){return!!(2&V(this.s))}};function Po(e,t,r){var i=v2?void 0:e.constructor.B;const s=M(r?e.s:t);if(!(e=t.length))return t;let n,o;if(cs(r=t[e-1])){e:{var c=r;let u={},h=!1;for(var a in c){let m=c[a];if(Array.isArray(m)){let y=m;(Or(m,i,+a)||an(m)&&m.size===0)&&(m=null),m!=y&&(h=!0)}m!=null?u[a]=m:h=!0}if(h){for(var l in u){c=u;break e}c=null}}c!=r&&(n=!0),e--}for(a=+!!(512&s)-1;0<e&&(r=t[l=e-1],l-=a,r==null||Or(r,i,l)||an(r)&&r.size===0);e--)o=!0;return(n||o)&&(t=Array.prototype.slice.call(t,0,e),c&&t.push(c)),t}function Do(e){return Array.isArray(e)?e[0]instanceof St?e:[t0,e]:[e,void 0]}function Pt(e,t){if(Array.isArray(t)){var r=V(t);if(4&r)return t;for(var i=0,s=0;i<t.length;i++){const n=e(t[i]);n!=null&&(t[s++]=n)}return s<i&&(t.length=s),j(t,-12289&(5|r)),2&r&&Object.freeze(t),t}}v.prototype.X=nr,v.prototype.toString=function(){return Po(this,this.s,!1).toString()};const mn=Symbol();function ys(e){let t=e[mn];if(!t){const r=Io(e),i=ws(e),s=i.l;t=s?(n,o)=>s(n,o,i):(n,o)=>{for(;_o(o)&&o.h!=4;){var c=o.m,a=i[c];if(!a){var l=i.ea;l&&(l=l[c])&&(a=i[c]=z2(l))}a&&a(o,n,c)||(c=(a=o).l,wr(a),a.ia?a=void 0:(l=a.g.g-c,a.g.g=c,a=go(a.g,l)),c=n,a&&(Ze||(Ze=Symbol()),(l=c[Ze])?l.push(a):c[Ze]=[a]))}r===Uo||r===Tr||r.j||(n[L2||(L2=Symbol())]=r)},e[mn]=t}return t}function z2(e){const t=(e=Do(e))[0].g;if(e=e[1]){const r=ys(e),i=ws(e).T;return(s,n,o)=>t(s,n,o,i,r)}return t}class vi{}let Uo,Tr;const zt=Symbol();function X2(e,t,r){const i=r[1];let s;if(i){const n=i[zt];s=n?n.T:Ur(i[0]),e[t]=n??i}s&&s===fs?(e.g||(e.g=new Set)).add(t):r[0]&&(e.h||(e.h=new Set)).add(t)}function pn(e,t){return[e.l,!t||0<t[0]?void 0:t]}function Io(e){var t=e[zt];if(t)return t;if(!(t=bs(e,e[zt]=new vi,pn,pn,X2)).ea&&!t.h&&!t.g){let r=!0;for(let i in t)isNaN(i)||(r=!1);r?(Ur(e[0])===fs?Tr?t=Tr:((t=new vi).T=Ur(!0),t=Tr=t):t=Uo||(Uo=new vi),t=e[zt]=t):t.j=!0}return t}function K2(e,t,r){e[t]=r}function bs(e,t,r,i,s=K2){t.T=Ur(e[0]);let n=0;var o=e[++n];o&&o.constructor===Object&&(t.ea=o,typeof(o=e[++n])=="function"&&(t.l=o,t.m=e[++n],o=e[++n]));const c={};for(;Array.isArray(o)&&typeof o[0]=="number"&&0<o[0];){for(var a=0;a<o.length;a++)c[o[a]]=o;o=e[++n]}for(a=1;o!==void 0;){let h;typeof o=="number"&&(a+=o,o=e[++n]);var l=void 0;if(o instanceof St?h=o:(h=r0,n--),h.pa){o=e[++n],l=e;var u=n;typeof o=="function"&&(o=o(),l[u]=o),l=o}for(u=a+1,typeof(o=e[++n])=="number"&&0>o&&(u-=o,o=e[++n]);a<u;a++){const m=c[a];s(t,a,l?i(h,l,m):r(h,m))}}return t}const gn=Symbol();function Bo(e){let t=e[gn];if(!t){const r=Yr(e);t=(i,s)=>jo(i,s,r),e[gn]=t}return t}const Pi=Symbol();function $2(e){return e.h}function Y2(e,t){let r,i;const s=e.h;return(n,o,c)=>s(n,o,c,i||(i=Yr(t).T),r||(r=Bo(t)))}function Yr(e){let t=e[Pi];return t||(t=bs(e,e[Pi]={},$2,Y2),No(e),t)}const Di=Symbol();function q2(e,t){const r=e.g;return t?(i,s,n)=>r(i,s,n,t):r}function Q2(e,t,r){const i=e.g;let s,n;return(o,c,a)=>i(o,c,a,n||(n=ws(t).T),s||(s=ys(t)),r)}function ws(e){let t=e[Di];return t||(Io(e),t=bs(e,e[Di]={},q2,Q2),No(e),t)}function No(e){Di in e&&zt in e&&Pi in e&&(e.length=0)}function _n(e,t){var r=e[t];if(r)return r;if((r=e.ea)&&(r=r[t])){var i=(r=Do(r))[0].h;if(r=r[1]){const s=Bo(r),n=Yr(r).T;r=(r=e.m)?r(n,s):(o,c,a)=>i(o,c,a,n,s)}else r=i;return e[t]=r}}function jo(e,t,r){for(var i=M(e),s=+!!(512&i)-1,n=e.length,o=512&i?1:0,c=n+(256&i?-1:0);o<c;o++){const a=e[o];if(a==null)continue;const l=o-s,u=_n(r,l);u&&u(t,a,l)}if(256&i){i=e[n-1];for(let a in i)s=+a,Number.isNaN(s)||(n=i[a])!=null&&(c=_n(r,s))&&c(t,n,s)}if(e=Ze?e[Ze]:void 0)for(wt(t,t.g.end()),r=0;r<e.length;r++)wt(t,Ki(e[r])||Vr())}function ce(e,t){return new St(e,t,!1,!1)}function Dt(e,t){return new St(e,t,!0,!1)}function qr(e,t){return new St(e,t,!1,!0)}function le(e,t,r){P(e,M(e),t,r)}var J2=qr(function(e,t,r,i,s){return e.h===2&&(e=ir(e,mt([void 0,void 0],i),s),je(i=M(t)),(s=Ve(t,i,r))instanceof Te?(2&s.N)!=0?((s=s.Y()).push(e),P(t,i,r,s)):s.Oa(e):Array.isArray(s)?(2&V(s)&&P(t,i,r,s=Co(s)),s.push(e)):P(t,i,r,[e]),!0)},function(e,t,r,i,s){if(t instanceof Te)t.forEach((n,o)=>{Si(e,r,mt([o,n],i),s)});else if(Array.isArray(t))for(let n=0;n<t.length;n++){const o=t[n];Array.isArray(o)&&Si(e,r,mt(o,i),s)}});function Vo(e,t,r){e:if(t!=null){if(Xr(t)){if(typeof t=="string"){t=us(t);break e}if(typeof t=="number"){t=hs(t);break e}}t=void 0}t!=null&&(typeof t=="string"&&sn(t),t!=null&&(Ee(e,r,0),typeof t=="number"?(e=e.g,ut(t),Lr(e,R,X)):(r=sn(t),Lr(e.g,r.h,r.g))))}function Go(e,t,r){(t=Ct(t))!=null&&t!=null&&(Ee(e,r,0),Hr(e.g,t))}function Wo(e,t,r){(t=To(t))!=null&&(Ee(e,r,0),e.g.g.push(t?1:0))}function Ho(e,t,r){(t=ft(t))!=null&&zr(e,r,ro(t))}function Qr(e,t,r,i,s){Si(e,r,t instanceof v?t.s:Array.isArray(t)?mt(t,i):void 0,s)}function zo(e,t,r){(t=t==null||typeof t=="string"||rr(t)||t instanceof Ke?t:void 0)!=null&&zr(e,r,Yi(t).buffer)}function Xo(e,t,r){return(e.h===5||e.h===2)&&(t=Rt(t,M(t),r,2,!1),e.h==2?Wr(e,Mi,t):t.push(Mi(e.g)),!0)}var K,$e=ce(function(e,t,r){if(e.h!==1)return!1;var i=e.g;e=Fi(i);const s=Fi(i);i=2*(s>>31)+1;const n=s>>>20&2047;return e=4294967296*(1048575&s)+e,le(t,r,n==2047?e?NaN:1/0*i:n==0?i*Math.pow(2,-1074)*e:i*Math.pow(2,n-1075)*(e+4503599627370496)),!0},function(e,t,r){(t=at(t))!=null&&(Ee(e,r,1),e=e.g,(r=fo||(fo=new DataView(new ArrayBuffer(8)))).setFloat64(0,+t,!0),R=r.getUint32(0,!0),X=r.getUint32(4,!0),qt(e,R),qt(e,X))}),Y=ce(function(e,t,r){return e.h===5&&(le(t,r,Mi(e.g)),!0)},function(e,t,r){(t=at(t))!=null&&(Ee(e,r,5),e=e.g,Qi(t),qt(e,R))}),Z2=Dt(Xo,function(e,t,r){if((t=Pt(at,t))!=null)for(let o=0;o<t.length;o++){var i=e,s=r,n=t[o];n!=null&&(Ee(i,s,5),i=i.g,Qi(n),qt(i,R))}}),xs=Dt(Xo,function(e,t,r){if((t=Pt(at,t))!=null&&t.length){Ee(e,r,2),sr(e.g,4*t.length);for(let i=0;i<t.length;i++)r=e.g,Qi(t[i]),qt(r,R)}}),st=ce(function(e,t,r){return e.h===0&&(le(t,r,es(e.g,Ji)),!0)},Vo),yi=ce(function(e,t,r){return e.h===0&&(le(t,r,(e=es(e.g,Ji))===0?void 0:e),!0)},Vo),e0=ce(function(e,t,r){return e.h===0&&(le(t,r,es(e.g,Ai)),!0)},function(e,t,r){e:if(t!=null){if(Xr(t)){if(typeof t=="string"){var i=Math.trunc(Number(t));Number.isSafeInteger(i)&&0<=i?t=String(i):((i=t.indexOf("."))!==-1&&(t=t.substring(0,i)),ln(t)||(Gr(t),t=Sr(R,X)));break e}if(typeof t=="number"){t=0<=(t=Math.trunc(t))&&Number.isSafeInteger(t)?t:function(s){if(0>s){ut(s);const n=Sr(R,X);return s=Number(n),Number.isSafeInteger(s)?s:n}return ln(String(s))?s:(ut(s),Ai(R,X))}(t);break e}}t=void 0}t!=null&&(typeof t=="string"&&tn(t),t!=null&&(Ee(e,r,0),typeof t=="number"?(e=e.g,ut(t),Lr(e,R,X)):(r=tn(t),Lr(e.g,r.h,r.g))))}),G=ce(function(e,t,r){return e.h===0&&(le(t,r,tt(e.g)),!0)},Go),Jr=Dt(function(e,t,r){return(e.h===0||e.h===2)&&(t=Rt(t,M(t),r,2,!1),e.h==2?Wr(e,tt,t):t.push(tt(e.g)),!0)},function(e,t,r){if((t=Pt(Ct,t))!=null&&t.length){r=is(e,r);for(let i=0;i<t.length;i++)Hr(e.g,t[i]);ss(e,r)}}),Tt=ce(function(e,t,r){return e.h===0&&(le(t,r,(e=tt(e.g))===0?void 0:e),!0)},Go),H=ce(function(e,t,r){return e.h===0&&(le(t,r,ts(e.g)),!0)},Wo),Xt=ce(function(e,t,r){return e.h===0&&(le(t,r,(e=ts(e.g))===!1?void 0:e),!0)},Wo),J=Dt(function(e,t,r){return e.h===2&&(ar(t,r,H2,e=rs(e)),!0)},function(e,t,r){if((t=Pt(ft,t))!=null)for(let o=0;o<t.length;o++){var i=e,s=r,n=t[o];n!=null&&zr(i,s,ro(n))}}),nt=ce(function(e,t,r){return e.h===2&&(le(t,r,(e=rs(e))===""?void 0:e),!0)},Ho),S=ce(function(e,t,r){return e.h===2&&(le(t,r,rs(e)),!0)},Ho),t0=qr(function(e,t,r,i,s){return e.h===2&&(ir(e,vs(t,i,r,!0),s),!0)},Qr),r0=qr(function(e,t,r,i,s){return e.h===2&&(ir(e,vs(t,i,r),s),!0)},Qr);K=new St(function(e,t,r,i,s){if(e.h!==2)return!1;i=mt(void 0,i);let n=M(t);je(n);let o=Rt(t,n,r,3);return n=M(t),4&V(o)&&(o=me(o),j(o,-2079&(1|V(o))),P(t,n,r,o)),o.push(i),ir(e,i,s),!0},function(e,t,r,i,s){if(Array.isArray(t))for(let n=0;n<t.length;n++)Qr(e,t[n],r,i,s)},!0,!0);var L=qr(function(e,t,r,i,s,n){if(e.h!==2)return!1;let o=M(t);return je(o),(n=_s(t,o,n))&&r!==n&&P(t,o,n),ir(e,t=vs(t,i,r),s),!0},Qr),Ko=ce(function(e,t,r){return e.h===2&&(le(t,r,vo(e)),!0)},zo),i0=Dt(function(e,t,r){return(e.h===0||e.h===2)&&(t=Rt(t,M(t),r,2,!1),e.h==2?Wr(e,rt,t):t.push(rt(e.g)),!0)},function(e,t,r){if((t=Pt(P2,t))!=null)for(let o=0;o<t.length;o++){var i=e,s=r,n=t[o];n!=null&&(Ee(i,s,0),sr(i.g,n))}}),Ne=ce(function(e,t,r){return e.h===0&&(le(t,r,tt(e.g)),!0)},function(e,t,r){(t=Ct(t))!=null&&(t=parseInt(t,10),Ee(e,r,0),Hr(e.g,t))}),s0=Dt(function(e,t,r){return(e.h===0||e.h===2)&&(t=Rt(t,M(t),r,2,!1),e.h==2?Wr(e,A2,t):t.push(tt(e.g)),!0)},function(e,t,r){if((t=Pt(Ct,t))!=null&&t.length){r=is(e,r);for(let i=0;i<t.length;i++)Hr(e.g,t[i]);ss(e,r)}});class n0{constructor(t,r){this.h=t,this.g=r,this.l=A,this.m=x,this.defaultValue=void 0}}function Se(e,t){return new n0(e,t)}function ct(e,t){return(r,i)=>{if(pr.length){const n=pr.pop();n.o(i),fi(n.g,r,i),r=n}else r=new class{constructor(n,o){if(en.length){const c=en.pop();fi(c,n,o),n=c}else n=new class{constructor(c,a){this.h=null,this.m=!1,this.g=this.l=this.j=0,fi(this,c,a)}clear(){this.h=null,this.m=!1,this.g=this.l=this.j=0,this.ca=!1}}(n,o);this.g=n,this.l=this.g.g,this.h=this.m=-1,this.o(o)}o({ia:n=!1}={}){this.ia=n}}(r,i);try{const n=new e,o=n.s;ys(t)(o,r);var s=n}finally{r.g.clear(),r.m=-1,r.h=-1,100>pr.length&&pr.push(r)}return s}}function Zr(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}}}};jo(this.s,t,Yr(e)),wt(t,t.g.end());const r=new Uint8Array(t.h),i=t.l,s=i.length;let n=0;for(let o=0;o<s;o++){const c=i[o];r.set(c,n),n+=c.length}return t.l=[r],r}}var vn=class extends v{constructor(e){super(e)}},$o=[0,nt,ce(function(e,t,r){return e.h===2&&(le(t,r,(e=vo(e))===pt()?void 0:e),!0)},function(e,t,r){if(t!=null){if(t instanceof v){const i=t.Qa;return void(i&&(t=i(t),t!=null&&zr(e,r,Yi(t).buffer)))}if(Array.isArray(t))return}zo(e,t,r)})],o0=[0,S],Yo=[0,G,Ne,H,-1,Jr,Ne,-1],a0=[0,H,-1],qo=class extends v{constructor(){super()}};qo.B=[6];var Qo=[0,H,S,H,Ne,-1,s0,S,-1,a0,Ne],Jo=[0,S,-2],yn=class extends v{constructor(){super()}},Zo=[0],ea=[0,G,H,-4],pe=class extends v{constructor(e){super(e,2)}},B={},c0=[-2,B,H];B[336783863]=[0,S,H,-1,G,[0,[1,2,3,4,5,6],L,Zo,L,Qo,L,Jo,L,ea,L,Yo,L,[0,S]],o0,H,[0,[1,3],[2,4],L,[0,Jr],-1,L,[0,J],-1,K,[0,S,-1]],S];var l0=[0,nt,Xt],ta=[0,yi,-1,Xt,-3,yi,Jr,nt,Tt,yi,-1,Xt,Tt,Xt,-2,nt],cr=[-1,{}],ra=[0,S,1,cr],ia=[0,S,J,cr];function ge(e,t){Ri(e,2,Ot(t),"")}function O(e,t){ar(e.s,3,or,t)}function k(e,t){ar(e.s,4,or,t)}var Z=class extends v{constructor(e){super(e,500)}o(e){return x(this,0,7,e)}};Z.B=[3,4,5,6,8,13,17,1005];var h0=[-500,nt,-1,J,-3,c0,K,$o,Tt,-1,ra,ia,K,l0,nt,ta,Tt,J,987,J],u0=[0,nt,-1,cr],d0=[-500,S,-1,[-1,{}],998,S],f0=[-500,S,J,-1,[-2,{},H],997,J,-1],m0=[-500,S,J,cr,998,J];function _e(e,t){Br(e,1,Z,t)}function D(e,t){ar(e.s,10,or,t)}function F(e,t){ar(e.s,15,or,t)}var ne=class extends v{constructor(e){super(e,500)}o(e){return x(this,0,1001,e)}};ne.B=[1,6,7,9,10,15,16,17,14,1002];var sa=[-500,K,h0,4,K,d0,K,f0,Tt,K,m0,J,Tt,ra,ia,K,u0,J,-2,ta,nt,-1,Xt,979,cr,K,$o],p0=ct(ne,sa);ne.prototype.g=Zr(sa);var g0=[0,K,[0,G,-2]],_0=class extends v{constructor(e){super(e)}},v0=[0,G,Y,S,-1],Ts=class extends v{constructor(e){super(e)}g(){return Ye(this,_0,1)}};Ts.B=[1];var na=[0,K,v0],ei=ct(Ts,na),y0=[0,G,Y],b0=[0,G,-1,g0],w0=class extends v{constructor(e){super(e)}},x0=[0,G,-3],T0=[0,Y,-3],E0=class extends v{constructor(e){super(e)}},k0=[0,Y,-1,S,Y],Er=class extends v{constructor(e){super(e)}h(){return A(this,w0,2)}g(){return Ye(this,E0,5)}};Er.B=[5];var A0=[0,Ne,x0,T0,b0,K,k0],oa=class extends v{constructor(e){super(e)}};oa.B=[1,2,3,8,9];var aa=ct(oa,[0,J,Jr,xs,A0,S,-1,st,K,y0,J,st]),ca=class extends v{constructor(e){super(e)}},F0=[0,Y,-4],la=class extends v{constructor(e){super(e)}};la.B=[1];var yt=ct(la,[0,K,F0]),ha=class extends v{constructor(e){super(e)}},M0=[0,Y,-4],ua=class extends v{constructor(e){super(e)}};ua.B=[1];var lr=ct(ua,[0,K,M0]),da=class extends v{constructor(e){super(e)}};da.B=[3];var S0=[0,G,-1,xs,Ne],fa=class extends v{constructor(){super()}};fa.prototype.g=Zr([0,Y,-4,st]);var L0=class extends v{constructor(e){super(e)}},C0=[0,1,G,S,na],ma=class extends v{constructor(e){super(e)}};ma.B=[1];var O0=ct(ma,[0,K,C0,st]),Ui=class extends v{constructor(e){super(e)}};Ui.B=[1];var R0=class extends v{constructor(e){super(e)}qa(){const e=Mo(this);return e??pt()}},P0=class extends v{constructor(e){super(e)}},pa=[1,2],D0=[0,pa,L,[0,xs],L,[0,Ko],G,S],ga=class extends v{constructor(e){super(e)}};ga.B=[1];var U0=ct(ga,[0,K,D0,st]),ti=class extends v{constructor(e){super(e)}};ti.B=[4,5];var _a=[0,S,G,Y,J,-1],bn=class extends v{constructor(e){super(e)}},I0=[0,H,-1],wn=class extends v{constructor(e){super(e)}},kr=[1,2,3,4,5],Nr=class extends v{constructor(e){super(e)}g(){return Mo(this)!=null}h(){return ft(it(this,2))!=null}},va=[0,Ko,S,[0,G,st,-1],[0,e0,st]],N=class extends v{constructor(e){super(e)}g(){return To(it(this,2))??!1}},z=[0,va,H,[0,kr,L,ea,L,Qo,L,Yo,L,Zo,L,Jo],Ne],ri=class extends v{constructor(e){super(e)}},Es=[0,z,Y,-1,G],B0=Se(502141897,ri);B[502141897]=Es;var ya=[0,va];B[512499200]=ya;var ba=[0,ya];B[515723506]=ba;var N0=ct(class extends v{constructor(e){super(e)}},[0,[0,Ne,-1,Z2,i0],S0]),wa=[0,z];B[508981768]=wa;var xa=class extends v{constructor(e){super(e)}},ks=[0,z,Y,wa,H],Ta=class extends v{constructor(e){super(e)}},Ea=[0,z,Es,ks,Y,ba];B[508968149]=ks;var j0=Se(508968150,Ta);B[508968150]=Ea;var ka=class extends v{constructor(e){super(e)}},V0=Se(513916220,ka);B[513916220]=[0,z,Ea,G];var _t=class extends v{constructor(e){super(e)}h(){return A(this,ti,2)}g(){C(this,2)}},Aa=[0,z,_a];B[478825465]=Aa;var Fa=[0,z];B[478825422]=Fa;var G0=class extends v{constructor(e){super(e)}},Ma=[0,z,Fa,Aa,-1],Sa=class extends v{constructor(e){super(e)}},La=[0,z,Y,G],As=class extends v{constructor(e){super(e)}},Fs=[0,z,Y],Ms=class extends v{constructor(e){super(e)}},Ca=[0,z,La,Fs,Y],Oa=class extends v{constructor(e){super(e)}},W0=[0,z,Ca,Ma];B[463370452]=Ma,B[464864288]=La,B[474472470]=Fs;var H0=Se(462713202,Ms);B[462713202]=Ca;var z0=Se(479097054,Oa);B[479097054]=W0;var X0=class extends v{constructor(e){super(e)}},K0=[0,z],Ra=class extends v{constructor(e){super(e)}},Ss=[0,z,Y,-1,G];B[514774813]=Ss;var Pa=class extends v{constructor(e){super(e)}},Ls=[0,z,Y,H];B[518928384]=Ls;var Da=class extends v{constructor(){super()}};Da.prototype.g=Zr([0,z,Fs,K0,Es,ks,Ss,Ls]);var Ua=class extends v{constructor(e){super(e)}},$0=Se(456383383,Ua);B[456383383]=[0,z,_a];var Ia=class extends v{constructor(e){super(e)}},Y0=Se(476348187,Ia);B[476348187]=[0,z,I0];var Ba=class extends v{constructor(e){super(e)}},Na=[0,Ne,-1],Ii=class extends v{constructor(e){super(e)}};Ii.B=[3];var q0=Se(458105876,class extends v{constructor(e){super(e)}g(){var e=this.s;const t=M(e);var r=2&t;return e=function(i,s,n){var o=Ii;const c=2&s;let a=!1;if(n==null){if(c)return dn();n=[]}else if(n.constructor===Te){if((2&n.N)==0||c)return n;n=n.Y()}else Array.isArray(n)?a=!!(2&V(n)):n=[];if(c){if(!n.length)return dn();a||(a=!0,Lt(n))}else a&&(a=!1,n=Co(n));return a||(64&V(n)?Cr(n,32):32&s&&os(n,32)),P(i,s,2,o=new Te(n,o,D2,void 0),!1),o}(e,t,Ve(e,t,2)),e==null||!r&&Ii&&(e.ta=!0),r=e}});B[458105876]=[0,Na,J2,[!0,st,[0,S,-1,J]]];var Cs=class extends v{constructor(e){super(e)}},ja=Se(458105758,Cs);B[458105758]=[0,z,S,Na];var Os=class extends v{constructor(e){super(e)}};Os.B=[5,6];var Q0=Se(443442058,Os);B[443442058]=[0,z,S,G,Y,J,-1];var Va=class extends v{constructor(e){super(e)}},J0=Se(516587230,Va);function Bi(e,t){return t=t?t.clone():new ti,e.displayNamesLocale!==void 0?C(t,1,Ot(e.displayNamesLocale)):e.displayNamesLocale===void 0&&C(t,1),e.maxResults!==void 0?Be(t,2,e.maxResults):"maxResults"in e&&C(t,2),e.scoreThreshold!==void 0?b(t,3,e.scoreThreshold):"scoreThreshold"in e&&C(t,3),e.categoryAllowlist!==void 0?Ir(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&C(t,4),e.categoryDenylist!==void 0?Ir(t,5,e.categoryDenylist):"categoryDenylist"in e&&C(t,5),t}function Rs(e,t=-1,r=""){return{categories:e.map(i=>({index:Fe(xe(i,1),0)??-1,score:W(i,2)??0,categoryName:Ie(i,3)??"",displayName:Ie(i,4)??""})),headIndex:t,headName:r}}function Ga(e){var o,c;var t=vt(e,3,at),r=vt(e,2,Ct),i=vt(e,1,ft),s=vt(e,9,ft);const n={categories:[],keypoints:[]};for(let a=0;a<t.length;a++)n.categories.push({score:t[a],index:r[a]??-1,categoryName:i[a]??"",displayName:s[a]??""});if((t=(o=A(e,Er,4))==null?void 0:o.h())&&(n.boundingBox={originX:xe(t,1)??0,originY:xe(t,2)??0,width:xe(t,3)??0,height:xe(t,4)??0,angle:0}),(c=A(e,Er,4))==null?void 0:c.g().length)for(const a of A(e,Er,4).g())n.keypoints.push({x:xr(a,1)??0,y:xr(a,2)??0,score:xr(a,4)??0,label:ft(it(a,3))??""});return n}function ii(e){const t=[];for(const r of Ye(e,ha,1))t.push({x:W(r,1)??0,y:W(r,2)??0,z:W(r,3)??0,visibility:W(r,4)??0});return t}function Kt(e){const t=[];for(const r of Ye(e,ca,1))t.push({x:W(r,1)??0,y:W(r,2)??0,z:W(r,3)??0,visibility:W(r,4)??0});return t}function xn(e){return Array.from(e,t=>127<t?t-256:t)}function Tn(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,i=0,s=0;for(let n=0;n<e.length;n++)r+=e[n]*t[n],i+=e[n]*e[n],s+=t[n]*t[n];if(0>=i||0>=s)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return r/Math.sqrt(i*s)}let gr;B[516587230]=[0,z,Ss,Ls,Y];const Z0=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 Wa(){if(gr===void 0)try{await WebAssembly.instantiate(Z0),gr=!0}catch{gr=!1}return gr}async function Nt(e,t=""){const r=await Wa()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var ht=class{};function Ha(){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/))&&1<=e.length&&17<=Number(e[1])))}async function En(e){if(typeof importScripts!="function"){const t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise((r,i)=>{t.addEventListener("load",()=>{r()},!1),t.addEventListener("error",s=>{i(s)},!1),document.body.appendChild(t)})}importScripts(e.toString())}function za(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 w(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 kn(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[i,s]=za(t);return!e.l||i===e.i.canvas.width&&s===e.i.canvas.height||(e.i.canvas.width=i,e.i.canvas.height=s),[i,s]}function An(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const i=new Uint32Array(t.length);for(let s=0;s<t.length;s++)i[s]=e.i.stringToNewUTF8(t[s]);t=e.i._malloc(4*i.length),e.i.HEAPU32.set(i,t>>2),r(t);for(const s of i)e.i._free(s);e.i._free(t)}function Oe(e,t,r){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=r}function qe(e,t,r){let i=[];e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=(s,n,o)=>{n?(r(i,o),i=[]):i.push(s)}}ht.forVisionTasks=function(e){return Nt("vision",e)},ht.forTextTasks=function(e){return Nt("text",e)},ht.forGenAiExperimentalTasks=function(e){return Nt("genai_experimental",e)},ht.forGenAiTasks=function(e){return Nt("genai",e)},ht.forAudioTasks=function(e){return Nt("audio",e)},ht.isSimdSupported=function(){return Wa()};async function e1(e,t,r,i){return e=await(async(s,n,o,c,a)=>{if(n&&await En(n),!self.ModuleFactory||o&&(await En(o),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&a&&((n=self.Module).locateFile=a.locateFile,a.mainScriptUrlOrBlob&&(n.mainScriptUrlOrBlob=a.mainScriptUrlOrBlob)),a=await self.ModuleFactory(self.Module||a),self.ModuleFactory=self.Module=void 0,new s(a,c)})(e,r.wasmLoaderPath,r.assetLoaderPath,t,{locateFile:s=>s.endsWith(".wasm")?r.wasmBinaryPath.toString():r.assetBinaryPath&&s.endsWith(".data")?r.assetBinaryPath.toString():s}),await e.o(i),e}function bi(e,t){const r=A(e.baseOptions,Nr,1)||new Nr;typeof t=="string"?(C(r,2,Ot(t)),C(r,1)):t instanceof Uint8Array&&(C(r,1,ls(t,!1,!1)),C(r,2)),x(e.baseOptions,0,1,r)}function Fn(e){try{const t=e.K.length;if(t===1)throw Error(e.K[0].message);if(1<t)throw Error("Encountered multiple errors: "+e.K.map(r=>r.message).join(", "))}finally{e.K=[]}}function p(e,t){e.J=Math.max(e.J,t)}function si(e,t){e.C=new Z,ge(e.C,"PassThroughCalculator"),O(e.C,"free_memory"),k(e.C,"free_memory_unused_out"),D(t,"free_memory"),_e(t,e.C)}function Et(e,t){O(e.C,t),k(e.C,t+"_unused_out")}function ni(e){e.g.addBoolToStream(!0,"free_memory",e.J)}var Ar=class{constructor(e){this.g=e,this.K=[],this.J=0,this.g.setAutoRenderToScreen(!1)}l(e,t=!0){var r,i,s,n,o,c;if(t){const a=e.baseOptions||{};if((r=e.baseOptions)!=null&&r.modelAssetBuffer&&((i=e.baseOptions)!=null&&i.modelAssetPath))throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!((s=A(this.baseOptions,Nr,1))!=null&&s.g()||(n=A(this.baseOptions,Nr,1))!=null&&n.h()||(o=e.baseOptions)!=null&&o.modelAssetBuffer||(c=e.baseOptions)!=null&&c.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if(function(l,u){let h=A(l.baseOptions,wn,3);if(!h){var m=h=new wn,y=new yn;Ht(m,4,kr,y)}"delegate"in u&&(u.delegate==="GPU"?(u=h,m=new qo,Ht(u,2,kr,m)):(u=h,m=new yn,Ht(u,4,kr,m))),x(l.baseOptions,0,3,h)}(this,a),a.modelAssetPath)return fetch(a.modelAssetPath.toString()).then(l=>{if(l.ok)return l.arrayBuffer();throw Error(`Failed to fetch model: ${a.modelAssetPath} (${l.status})`)}).then(l=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(l),!0,!1,!1),bi(this,"/model.dat"),this.m(),this.L()});if(a.modelAssetBuffer instanceof Uint8Array)bi(this,a.modelAssetBuffer);else if(a.modelAssetBuffer)return async function(l){const u=[];for(var h=0;;){const{done:m,value:y}=await l.read();if(m)break;u.push(y),h+=y.length}if(u.length===0)return new Uint8Array(0);if(u.length===1)return u[0];l=new Uint8Array(h),h=0;for(const m of u)l.set(m,h),h+=m.length;return l}(a.modelAssetBuffer).then(l=>{bi(this,l),this.m(),this.L()})}return this.m(),this.L(),Promise.resolve()}L(){}fa(){let e;if(this.g.fa(t=>{e=p0(t)}),!e)throw Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.g.attachErrorListener((r,i)=>{this.K.push(Error(i))}),this.g.Ma(),this.g.setGraph(e,t),this.C=void 0,Fn(this)}finishProcessing(){this.g.finishProcessing(),Fn(this)}close(){this.C=void 0,this.g.closeGraph()}};function ie(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}Ar.prototype.close=Ar.prototype.close,function(e,t){e=e.split(".");var r,i=tr;for((e[0]in i)||i.execScript===void 0||i.execScript("var "+e[0]);e.length&&(r=e.shift());)e.length||t===void 0?i=i[r]&&i[r]!==Object.prototype[r]?i[r]:i[r]={}:i[r]=t}("TaskRunner",Ar);class t1{constructor(t,r,i,s){this.g=t,this.h=r,this.m=i,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 Mn(e,t,r){const i=e.g;if(r=ie(i.createShader(r),"Failed to create WebGL shader"),i.shaderSource(r,t),i.compileShader(r),!i.getShaderParameter(r,i.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${i.getShaderInfoLog(r)}`);return i.attachShader(e.h,r),r}function Sn(e,t){const r=e.g,i=ie(r.createVertexArray(),"Failed to create vertex array");r.bindVertexArray(i);const s=ie(r.createBuffer(),"Failed to create buffer");r.bindBuffer(r.ARRAY_BUFFER,s),r.enableVertexAttribArray(e.K),r.vertexAttribPointer(e.K,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 n=ie(r.createBuffer(),"Failed to create buffer");return r.bindBuffer(r.ARRAY_BUFFER,n),r.enableVertexAttribArray(e.J),r.vertexAttribPointer(e.J,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 t1(r,i,s,n)}function Ps(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function hr(e,t,r,i){return Ps(e,t),e.h||(e.m(),e.D()),r?(e.v||(e.v=Sn(e,!0)),r=e.v):(e.A||(e.A=Sn(e,!1)