@mediapipe/tasks-text 0.10.15-rc.20240829 → 0.10.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mediapipe/tasks-text",
3
- "version": "0.10.15-rc.20240829",
3
+ "version": "0.10.15",
4
4
  "description": "MediaPipe Text Tasks",
5
5
  "main": "text_bundle.cjs",
6
6
  "browser": "text_bundle.mjs",
package/text_bundle.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t="undefined"!=typeof self?self:{};function e(e,n){t:{for(var r=["CLOSURE_FLAGS"],i=t,o=0;o<r.length;o++)if(null==(i=i[r[o]])){r=null;break t}r=i}return null!=(e=r&&r[e])?e:n}function n(){throw Error("Invalid UTF8")}function r(t,e){return e=String.fromCharCode.apply(null,e),null==t?e:t+e}let i,o;const s="undefined"!=typeof TextDecoder;let a;const u="undefined"!=typeof TextEncoder;function c(t){if(u)t=(a||=new TextEncoder).encode(t);else{let n=0;const r=new Uint8Array(3*t.length);for(let i=0;i<t.length;i++){var e=t.charCodeAt(i);if(e<128)r[n++]=e;else{if(e<2048)r[n++]=e>>6|192;else{if(e>=55296&&e<=57343){if(e<=56319&&i<t.length){const o=t.charCodeAt(++i);if(o>=56320&&o<=57343){e=1024*(e-55296)+o-56320+65536,r[n++]=e>>18|240,r[n++]=e>>12&63|128,r[n++]=e>>6&63|128,r[n++]=63&e|128;continue}i--}e=65533}r[n++]=e>>12|224,r[n++]=e>>6&63|128}r[n++]=63&e|128}}t=n===r.length?r:r.subarray(0,n)}return t}var l,h=e(610401301,!1),f=e(645172343,!0),d=e(660014094,!1);const g=t.navigator;function p(t){return!!h&&(!!l&&l.brands.some((({brand:e})=>e&&-1!=e.indexOf(t))))}function m(e){var n;return(n=t.navigator)&&(n=n.userAgent)||(n=""),-1!=n.indexOf(e)}function y(){return!!h&&(!!l&&l.brands.length>0)}function b(){return y()?p("Chromium"):(m("Chrome")||m("CriOS"))&&!(!y()&&m("Edge"))||m("Silk")}l=g&&g.userAgentData||null;var v=!y()&&(m("Trident")||m("MSIE"));!m("Android")||b(),b(),m("Safari")&&(b()||!y()&&m("Coast")||!y()&&m("Opera")||!y()&&m("Edge")||(y()?p("Microsoft Edge"):m("Edg/"))||y()&&p("Opera"));var w={},_=null;function S(t){var e=t.length,n=3*e/4;n%3?n=Math.floor(n):-1!="=.".indexOf(t[e-1])&&(n=-1!="=.".indexOf(t[e-2])?n-2:n-1);var r=new Uint8Array(n),i=0;return function(t,e){function n(e){for(;r<t.length;){var n=t.charAt(r++),i=_[n];if(null!=i)return i;if(!/^[\s\xa0]*$/.test(n))throw Error("Unknown base64 encoding at char: "+n)}return e}A();for(var r=0;;){var i=n(-1),o=n(0),s=n(64),a=n(64);if(64===a&&-1===i)break;e(i<<2|o>>4),64!=s&&(e(o<<4&240|s>>2),64!=a&&e(s<<6&192|a))}}(t,(function(t){r[i++]=t})),i!==n?r.subarray(0,i):r}function A(){if(!_){_={};for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),e=["+/=","+/","-_=","-_.","-_"],n=0;n<5;n++){var r=t.concat(e[n].split(""));w[n]=r;for(var i=0;i<r.length;i++){var o=r[i];void 0===_[o]&&(_[o]=i)}}}}var E="undefined"!=typeof Uint8Array,I=!v&&"function"==typeof btoa;function T(t){if(!I){var e;void 0===e&&(e=0),A(),e=w[e];var n=Array(Math.floor(t.length/3)),r=e[64]||"";let u=0,c=0;for(;u<t.length-2;u+=3){var i=t[u],o=t[u+1],s=t[u+2],a=e[i>>2];i=e[(3&i)<<4|o>>4],o=e[(15&o)<<2|s>>6],s=e[63&s],n[c++]=a+i+o+s}switch(a=0,s=r,t.length-u){case 2:s=e[(15&(a=t[u+1]))<<2]||r;case 1:t=t[u],n[c]=e[t>>2]+e[(3&t)<<4|a>>4]+s+r}return n.join("")}for(e="",n=0,r=t.length-10240;n<r;)e+=String.fromCharCode.apply(null,t.subarray(n,n+=10240));return e+=String.fromCharCode.apply(null,n?t.subarray(n):t),btoa(e)}const x=/[-_.]/g,P={"-":"+",_:"/",".":"="};function U(t){return P[t]||""}function O(t){if(!I)return S(t);x.test(t)&&(t=t.replace(x,U)),t=atob(t);const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}function B(t){return E&&null!=t&&t instanceof Uint8Array}var L={};let F;function N(t){if(t!==L)throw Error("illegal external caller")}function j(){return F||=new k(null,L)}function V(t){N(L);var e=t.g;return null==(e=null==e||B(e)?e:"string"==typeof e?O(e):null)?e:t.g=e}var k=class{constructor(t,e){if(N(e),this.g=t,null!=t&&0===t.length)throw Error("ByteString should be constructed with non-empty values")}i(){return new Uint8Array(V(this)||0)}};function M(t,e){t.__closure__error__context__984382||(t.__closure__error__context__984382={}),t.__closure__error__context__984382.severity=e}let C;function G(){const e=Error();M(e,"incident"),function(e){t.setTimeout((()=>{throw e}),0)}(e)}function D(){const t=Error("int32");return M(t,"warning"),t}function z(){return"function"==typeof BigInt}function $(t){return Array.prototype.slice.call(t)}var W="function"==typeof Symbol&&"symbol"==typeof Symbol();function R(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol()?Symbol():t}var H=R(),q=R("2ex"),J=R("1oa"),K=R("0dg"),X=W?(t,e)=>{t[H]|=e}:(t,e)=>{void 0!==t.g?t.g|=e:Object.defineProperties(t,{g:{value:e,configurable:!0,writable:!0,enumerable:!1}})},Y=W?(t,e)=>{t[H]&=~e}:(t,e)=>{void 0!==t.g&&(t.g&=~e)},Q=W?t=>0|t[H]:t=>0|t.g,Z=W?t=>t[H]:t=>t.g,tt=W?(t,e)=>{t[H]=e}:(t,e)=>{void 0!==t.g?t.g=e:Object.defineProperties(t,{g:{value:e,configurable:!0,writable:!0,enumerable:!1}})};function et(t,e){tt(e,-14591&(0|t))}function nt(t,e){tt(e,-14557&(34|t))}var rt,it={},ot={};function st(t){return!(!t||"object"!=typeof t||t.g!==ot)}function at(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)&&t.constructor===Object}function ut(t,e,n){if(null!=t)if("string"==typeof t)t=t?new k(t,L):j();else if(t.constructor!==k)if(B(t))t=t.length?new k(n?t:new Uint8Array(t),L):j();else{if(!e)throw Error();t=void 0}return t}function ct(t){return!(!Array.isArray(t)||t.length)&&!!(1&Q(t))}const lt=[];function ht(t){if(2&t)throw Error()}let ft,dt;function gt(t,e){(e=ft?e[ft]:void 0)&&(t[ft]=$(e))}tt(lt,55),rt=Object.freeze(lt);var pt=Object.freeze({});Object.freeze({});var mt=Object.freeze({});const yt="function"==typeof Uint8Array.prototype.slice;let bt,vt=0,wt=0;function _t(t){const e=t>>>0;vt=e,wt=(t-e)/4294967296>>>0}function St(t){if(t<0){_t(-t);const[e,n]=Ut(vt,wt);vt=e>>>0,wt=n>>>0}else _t(t)}function At(t){const e=bt||=new DataView(new ArrayBuffer(8));e.setFloat32(0,+t,!0),wt=0,vt=e.getUint32(0,!0)}function Et(t,e){return 4294967296*e+(t>>>0)}function It(t,e){const n=2147483648&e;return n&&(e=~e>>>0,0==(t=1+~t>>>0)&&(e=e+1>>>0)),t=Et(t,e),n?-t:t}function Tt(t,e){if(t>>>=0,(e>>>=0)<=2097151)var n=""+(4294967296*e+t);else z()?n=""+(BigInt(e)<<BigInt(32)|BigInt(t)):(t=(16777215&t)+6777216*(n=16777215&(t>>>24|e<<8))+6710656*(e=e>>16&65535),n+=8147497*e,e*=2,t>=1e7&&(n+=t/1e7>>>0,t%=1e7),n>=1e7&&(e+=n/1e7>>>0,n%=1e7),n=e+xt(n)+xt(t));return n}function xt(t){return t=String(t),"0000000".slice(t.length)+t}function Pt(t){if(t.length<16)St(Number(t));else if(z())t=BigInt(t),vt=Number(t&BigInt(4294967295))>>>0,wt=Number(t>>BigInt(32)&BigInt(4294967295));else{const e=+("-"===t[0]);wt=vt=0;const n=t.length;for(let r=e,i=(n-e)%6+e;i<=n;r=i,i+=6){const e=Number(t.slice(r,i));wt*=1e6,vt=1e6*vt+e,vt>=4294967296&&(wt+=Math.trunc(vt/4294967296),wt>>>=0,vt>>>=0)}if(e){const[t,e]=Ut(vt,wt);vt=t,wt=e}}}function Ut(t,e){return e=~e,t?t=1+~t:e+=1,[t,e]}var Ot="function"==typeof t.BigInt&&"bigint"==typeof t.BigInt(0),Bt=t=>Ot?t>=Ft&&t<=jt:"-"===t[0]?Vt(t,Lt):Vt(t,Nt);const Lt=Number.MIN_SAFE_INTEGER.toString(),Ft=Ot?BigInt(Number.MIN_SAFE_INTEGER):void 0,Nt=Number.MAX_SAFE_INTEGER.toString(),jt=Ot?BigInt(Number.MAX_SAFE_INTEGER):void 0;function Vt(t,e){if(t.length>e.length)return!1;if(t.length<e.length||t===e)return!0;for(let n=0;n<t.length;n++){const r=t[n],i=e[n];if(r>i)return!1;if(r<i)return!0}}function kt(t){return null==t||"number"==typeof t?t:"NaN"===t||"Infinity"===t||"-Infinity"===t?Number(t):void 0}function Mt(t){if(null!=t&&"boolean"!=typeof t){var e=typeof t;throw Error(`Expected boolean but got ${"object"!=e?e:t?Array.isArray(t)?"array":e:"null"}: ${t}`)}return t}const Ct=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Gt(t){const e=typeof t;switch(e){case"bigint":return!0;case"number":return Number.isFinite(t)}return"string"===e&&Ct.test(t)}function Dt(t){if(null==t)return t;if("string"==typeof t){if(!t)return;t=+t}return"number"==typeof t&&Number.isFinite(t)?0|t:void 0}function zt(t){return"-"!==t[0]&&(t.length<20||20===t.length&&Number(t.substring(0,6))<184467)}function $t(t){return t=Math.trunc(t),Number.isSafeInteger(t)||(St(t),t=It(vt,wt)),t}function Wt(t){var e=Math.trunc(Number(t));if(Number.isSafeInteger(e))return String(e);if(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),!("-"===t[0]?t.length<20||20===t.length&&Number(t.substring(0,7))>-922337:t.length<19||19===t.length&&Number(t.substring(0,6))<922337))if(Pt(t),t=vt,2147483648&(e=wt))if(z())t=""+(BigInt(0|e)<<BigInt(32)|BigInt(t>>>0));else{const[n,r]=Ut(t,e);t="-"+Tt(n,r)}else t=Tt(t,e);return t}function Rt(t){return null==t?t:"bigint"==typeof t?(Bt(t)?t=Number(t):(t=BigInt.asIntN(64,t),t=Bt(t)?Number(t):String(t)),t):Gt(t)?"number"==typeof t?$t(t):Wt(t):void 0}function Ht(t){if(null==t)return t;var e=typeof t;if("bigint"===e)return String(BigInt.asUintN(64,t));if(Gt(t)){if("string"===e)return e=Math.trunc(Number(t)),Number.isSafeInteger(e)&&e>=0?t=String(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),zt(t)||(Pt(t),t=Tt(vt,wt))),t;if("number"===e)return(t=Math.trunc(t))>=0&&Number.isSafeInteger(t)?t:function(t){if(t<0){St(t);const e=Tt(vt,wt);return t=Number(e),Number.isSafeInteger(t)?t:e}return zt(String(t))?t:(St(t),Et(vt,wt))}(t)}}function qt(t){if("string"!=typeof t)throw Error();return t}function Jt(t){if(null!=t&&"string"!=typeof t)throw Error();return t}function Kt(t){return null==t||"string"==typeof t?t:void 0}function Xt(t,e,n){if(null!=t&&"object"==typeof t&&t.D===it)return t;if(Array.isArray(t)){var r=Q(t),i=r;return 0===i&&(i|=32&n),(i|=2&n)!==r&&tt(t,i),new e(t)}}function Yt(t){var e=Qt?.get(t);if(e)return e;if(Math.random()>.01)return t;if(void 0===te)if("function"!=typeof Proxy)te=null;else try{te=-1!==Proxy.toString().indexOf("[native code]")?Proxy:null}catch{te=null}return(e=te)?(function(t,e){(Qt||=new WeakMap).set(t,e),(Zt||=new WeakMap).set(e,t)}(t,e=new e(t,{set:(t,e,n)=>(G(),t[e]=n,!0)})),e):t}let Qt,Zt,te,ee,ne,re;function ie(t){switch(typeof t){case"boolean":return ne||=[0,void 0,!0];case"number":return t>0?void 0:0===t?re||=[0,void 0]:[-t,void 0];case"string":return[0,t];case"object":return t}}function oe(t,e,n){if(null==t&&(t=ee),ee=void 0,null==t){var r=96;n?(t=[n],r|=512):t=[],e&&(r=-16760833&r|(1023&e)<<14)}else{if(!Array.isArray(t))throw Error("narr");if(2048&(r=Q(t)))throw Error("farr");if(64&r)return t;if(r|=64,n&&(r|=512,n!==t[0]))throw Error("mid");t:{const i=(n=t).length;if(i){const t=i-1;if(at(n[t])){if((e=t-(+!!(512&(r|=256))-1))>=1024)throw Error("pvtlmt");r=-16760833&r|(1023&e)<<14;break t}}if(e){if((e=Math.max(e,i-(+!!(512&r)-1)))>1024)throw Error("spvt");r=-16760833&r|(1023&e)<<14}}}return tt(t,r),t}function se(t,e,n,r,i){if(null!=t){if(Array.isArray(t))t=ct(t)?void 0:i&&2&Q(t)?t:ae(t,e,n,void 0!==r,i);else if(at(t)){const o={};for(let s in t)o[s]=se(t[s],e,n,r,i);t=o}else t=e(t,r);return t}}function ae(t,e,n,r,i){const o=r||n?Q(t):0;r=r?!!(32&o):void 0;const s=$(t);for(let t=0;t<s.length;t++)s[t]=se(s[t],e,n,r,i);return n&&(gt(s,t),n(o,s)),s}function ue(t){return t.D===it?t.toJSON():function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"bigint":return Bt(t)?Number(t):String(t);case"boolean":return t?1:0;case"object":if(t)if(Array.isArray(t)){if(ct(t))return}else{if(B(t))return T(t);if(t instanceof k){const e=t.g;return null==e?"":"string"==typeof e?e:t.g=T(e)}}}return t}(t)}function ce(t,e,n=nt){if(null!=t){if(E&&t instanceof Uint8Array)return e?t:new Uint8Array(t);if(Array.isArray(t)){var r=Q(t);return 2&r?t:(e&&=0===r||!!(32&r)&&!(64&r||!(16&r)),e?(tt(t,-12293&(34|r)),t):ae(t,ce,4&r?nt:n,!0,!0))}return t.D===it&&(n=t.l,t=2&(r=Z(n))?t:he(t,n,r,!0)),t}}function le(t){const e=t.l;return he(t,e,Z(e),!1)}function he(t,e,n,r){return t=t.constructor,ee=e=fe(e,n,r),e=new t(e),ee=void 0,e}function fe(t,e,n){const r=n||2&e?nt:et,i=!!(32&e);return t=function(t,e,n){const r=$(t);var i=r.length;const o=256&e?r[i-1]:void 0;for(i+=o?-1:0,e=512&e?1:0;e<i;e++)r[e]=n(r[e]);if(o){e=r[e]={};for(const t in o)e[t]=n(o[t])}return gt(r,t),r}(t,e,(t=>ce(t,i,r))),X(t,32|(n?2:0)),t}function de(t){const e=t.l,n=Z(e);return 2&n?he(t,e,n,!1):t}function ge(t,e,n,r){return!(4&e)||null!=n&&(!r&&0===n&&(4096&e||8192&e)&&(t.constructor[K]=1+(0|t.constructor[K]))<5&&G(),0!==n&&!(n&e))}function pe(t,e){return ye(t=t.l,Z(t),e)}function me(t,e,n,r){if(!((e=r+(+!!(512&e)-1))<0||e>=t.length||e>=n))return t[e]}function ye(t,e,n,r){if(-1===n)return null;const i=e>>14&1023||536870912;if(!(n>=i)){var o=t.length;return r&&256&e&&null!=(r=t[o-1][n])?(me(t,e,i,n)&&null!=q&&((e=(t=C??={})[q]||0)>=4||(t[q]=e+1,G())),r):me(t,e,i,n)}return 256&e?t[t.length-1][n]:void 0}function be(t,e,n,r){const i=t.l;let o=Z(i);return ht(o),ve(i,o,e,n,r),t}function ve(t,e,n,r,i){const o=e>>14&1023||536870912;if(n>=o||i&&!f){let s=e;if(256&e)i=t[t.length-1];else{if(null==r)return s;i=t[o+(+!!(512&e)-1)]={},s|=256}return i[n]=r,n<o&&(t[n+(+!!(512&e)-1)]=void 0),s!==e&&tt(t,s),s}return t[n+(+!!(512&e)-1)]=r,256&e&&(n in(t=t[t.length-1])&&delete t[n]),e}function we(t,e,n,r,i){var o=2&e;let s=ye(t,e,n,i);Array.isArray(s)||(s=rt);const a=!(2&r);r=!(1&r);const u=!!(32&e);let c=Q(s);return 0!==c||!u||o||a?1&c||(c|=1,tt(s,c)):(c|=33,tt(s,c)),o?(t=!1,2&c||(X(s,34),t=!!(4&c)),(r||t)&&Object.freeze(s)):(o=!!(2&c)||!!(2048&c),r&&o?(s=$(s),r=1,u&&!a&&(r|=32),tt(s,r),ve(t,e,n,s,i)):a&&32&c&&!o&&Y(s,32)),s}function _e(t){t=t.l;let e=Z(t);const n=ye(t,e,1),r=ut(n,!0,!!(34&e));return null!=r&&r!==n&&ve(t,e,1,r),r}function Se(t,e,n,r,i,o){const s=t.l;let a=Z(s);const u=2&a?1:r;o=!!o,r=Ae(s,a,e,i);var c=Q(r);if(ge(t,c,void 0,o)){(4&c||Object.isFrozen(r))&&(r=$(r),c=Me(c,a),a=ve(s,a,e,r,i));let o=t=0;for(;t<r.length;t++){const e=n(r[t]);null!=e&&(r[o++]=e)}o<t&&(r.length=o),c=-4097&(20|(c=Ee(c,a))),tt(r,c&=-8193),2&c&&Object.freeze(r)}let l;return 1===u||4===u&&32&c?Ie(c)||(o=c,(c|=2)!==o&&tt(r,c),Object.freeze(r)):(n=5===u&&(!!(32&c)||Ie(c)||!!Qt?.get(r)),(2===u||n)&&Ie(c)&&(r=$(r),c=Ce(c=Me(c,a),a,o),tt(r,c),a=ve(s,a,e,r,i)),Ie(c)||(e=c,(c=Ce(c,a,o))!==e&&tt(r,c)),n&&(l=Yt(r))),l||r}function Ae(t,e,n,r){return t=ye(t,e,n,r),Array.isArray(t)?t:rt}function Ee(t,e){return 0===t&&(t=Me(t,e)),1|t}function Ie(t){return!!(2&t)&&!!(4&t)||!!(2048&t)}function Te(t,e){t=t.l;let n=Z(t);ht(n),ve(t,n,2,""===e?void 0:e)}function xe(t,e){var n=li;return Oe(Pe(t=t.l),t,Z(t),n)===e?e:-1}function Pe(t){if(W)return t[J]??(t[J]=new Map);if(J in t)return t[J];const e=new Map;return Object.defineProperty(t,J,{value:e}),e}function Ue(t,e,n,r){const i=Pe(t),o=Oe(i,t,e,n);return o!==r&&(o&&(e=ve(t,e,o)),i.set(n,r)),e}function Oe(t,e,n,r){let i=t.get(r);if(null!=i)return i;i=0;for(let t=0;t<r.length;t++){const o=r[t];null!=ye(e,n,o)&&(0!==i&&(n=ve(e,n,i)),i=o)}return t.set(r,i),i}function Be(t,e,n,r){let i=Z(t);const o=ye(t,i,n,r);let s;if(null!=o&&o.D===it)return(e=de(o))!==o&&ve(t,i,n,e,r),e.l;if(Array.isArray(o)){const t=Q(o);s=2&t?fe(o,t,!1):o,s=oe(s,e[0],e[1])}else s=oe(void 0,e[0],e[1]);return s!==o&&ve(t,i,n,s,r),s}function Le(t,e,n,r){t=t.l;let i=Z(t);const o=ye(t,i,n,r);return(e=Xt(o,e,i))!==o&&null!=e&&ve(t,i,n,e,r),e}function Fe(t,e,n){if(null==(e=Le(t,e,n,!1)))return e;t=t.l;let r=Z(t);if(!(2&r)){const i=de(e);i!==e&&ve(t,r,n,e=i,!1)}return e}function Ne(t,e,n,r,i,o){var s=!!(2&e);r=s?1:r,i=!!i,o&&=!s,s=Ae(t,e,1);var a=Q(s),u=!!(4&a);if(!u){var c=s,l=e;const t=!!(2&(a=Ee(a,e)));t&&(l|=2);let r=!t,i=!0,o=0,u=0;for(;o<c.length;o++){const e=Xt(c[o],n,l);if(e instanceof n){if(!t){const t=!!(2&Q(e.l));r&&=!t,i&&=t}c[u++]=e}}u<o&&(c.length=u),a|=4,a=i?16|a:-17&a,tt(c,a=r?8|a:-9&a),t&&Object.freeze(c)}if(o&&!(8&a||!s.length&&(1===r||4===r&&32&a))){for(Ie(a)&&(s=$(s),a=Me(a,e),e=ve(t,e,1,s)),n=s,o=a,c=0;c<n.length;c++)(a=n[c])!==(l=de(a))&&(n[c]=l);o|=8,o=n.length?-17&o:16|o,tt(n,o),a=o}let h;return 1===r||4===r&&32&a?Ie(a)||(e=a,(a|=!s.length||16&a&&(!u||32&a)?2:2048)!==e&&tt(s,a),Object.freeze(s)):(u=5===r&&(!!(32&a)||Ie(a)||!!Qt?.get(s)),(2===r||u)&&Ie(a)&&(s=$(s),a=Ce(a=Me(a,e),e,i),tt(s,a),e=ve(t,e,1,s)),Ie(a)||(t=a,(a=Ce(a,e,i))!==t&&tt(s,a)),u&&(h=Yt(s))),h||s}function je(t,e){t=t.l;const n=Z(t);return Ne(t,n,e,void 0===pt?2:5,!1,!(2&n))}function Ve(t,e,n,r,i){return null==r&&(r=void 0),be(t,n,r,i)}function ke(t,e,n){var r=mi;null==n&&(n=void 0);t:{t=t.l;let i=Z(t);if(ht(i),null==n){const n=Pe(t);if(Oe(n,t,i,r)!==e)break t;n.set(r,0)}else i=Ue(t,i,r,e);ve(t,i,e,n)}}function Me(t,e){return-2049&(t=32|(2&e?2|t:-3&t))}function Ce(t,e,n){return 32&e&&n||(t&=-33),t}function Ge(t,e){var n=Xr;t=t.l;const r=Z(t);ht(r),t=Ne(t,r,n,2,!0),e=null!=e?e:new n,t.push(e),2&Q(e.l)?Y(t,8):Y(t,16)}function De(t,e){return t??e}function ze(t,e,n){{const a=t.l;let u=Z(a);if(ht(u),null==n)ve(a,u,e);else{n=Zt?.get(n)||n;var r,i=Q(n),o=i,s=!!(2&i)||Object.isFrozen(n);if((r=!s)&&(r=void 0===mt||!1),ge(t,i))for(i=21,s&&(n=$(n),o=0,i=Ce(i=Me(i,u),u,!0)),t=0;t<n.length;t++)n[t]=qt(n[t]);r&&(n=$(n),o=0,i=Ce(i=Me(i,u),u,!0)),i!==o&&tt(n,i),ve(a,u,e,n)}}}function $e(t,e,n){ht(Z(t.l)),Se(t,e,Kt,2,void 0,!0).push(qt(n))}function We(t,e){return Error(`Invalid wire type: ${t} (at position ${e})`)}function Re(){return Error("Failed to read varint, encoding is invalid.")}function He(t,e){return Error(`Tried to read past the end of the data ${e} > ${t}`)}function qe(t){if("string"==typeof t)return{buffer:O(t),v:!1};if(Array.isArray(t))return{buffer:new Uint8Array(t),v:!1};if(t.constructor===Uint8Array)return{buffer:t,v:!1};if(t.constructor===ArrayBuffer)return{buffer:new Uint8Array(t),v:!1};if(t.constructor===k)return{buffer:V(t)||new Uint8Array(0),v:!0};if(t instanceof Uint8Array)return{buffer:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),v:!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 Je(t,e){let n,r=0,i=0,o=0;const s=t.i;let a=t.g;do{n=s[a++],r|=(127&n)<<o,o+=7}while(o<32&&128&n);for(o>32&&(i|=(127&n)>>4),o=3;o<32&&128&n;o+=7)n=s[a++],i|=(127&n)<<o;if(tn(t,a),n<128)return e(r>>>0,i>>>0);throw Re()}function Ke(t){let e=0,n=t.g;const r=n+10,i=t.i;for(;n<r;){const r=i[n++];if(e|=r,0==(128&r))return tn(t,n),!!(127&e)}throw Re()}function Xe(t){const e=t.i;let n=t.g,r=e[n++],i=127&r;if(128&r&&(r=e[n++],i|=(127&r)<<7,128&r&&(r=e[n++],i|=(127&r)<<14,128&r&&(r=e[n++],i|=(127&r)<<21,128&r&&(r=e[n++],i|=r<<28,128&r&&128&e[n++]&&128&e[n++]&&128&e[n++]&&128&e[n++]&&128&e[n++])))))throw Re();return tn(t,n),i}function Ye(t){var e=t.i;const n=t.g;var r=e[n],i=e[n+1];const o=e[n+2];return e=e[n+3],tn(t,t.g+4),t=2*((i=(r<<0|i<<8|o<<16|e<<24)>>>0)>>31)+1,r=i>>>23&255,i&=8388607,255==r?i?NaN:t*(1/0):0==r?t*Math.pow(2,-149)*i:t*Math.pow(2,r-150)*(i+Math.pow(2,23))}function Qe(t){return Xe(t)}function Ze(t,e,{F:n=!1}={}){t.F=n,e&&(e=qe(e),t.i=e.buffer,t.m=e.v,t.s=0,t.j=t.i.length,t.g=t.s)}function tn(t,e){if(t.g=e,e>t.j)throw He(t.j,e)}function en(t,e){if(e<0)throw Error(`Tried to read a negative byte length: ${e}`);const n=t.g,r=n+e;if(r>t.j)throw He(e,t.j-n);return t.g=r,n}function nn(t,e){if(0==e)return j();var n=en(t,e);return t.F&&t.m?n=t.i.subarray(n,n+e):(t=t.i,n=n===(e=n+e)?new Uint8Array(0):yt?t.slice(n,e):new Uint8Array(t.subarray(n,e))),0==n.length?j():new k(n,L)}var rn=[];function on(t){var e=t.g;if(e.g==e.j)return!1;t.j=t.g.g;var n=Xe(t.g)>>>0;if(e=n>>>3,!((n&=7)>=0&&n<=5))throw We(n,t.j);if(e<1)throw Error(`Invalid field number: ${e} (at position ${t.j})`);return t.m=e,t.i=n,!0}function sn(t){switch(t.i){case 0:0!=t.i?sn(t):Ke(t.g);break;case 1:tn(t=t.g,t.g+8);break;case 2:if(2!=t.i)sn(t);else{var e=Xe(t.g)>>>0;tn(t=t.g,t.g+e)}break;case 5:tn(t=t.g,t.g+4);break;case 3:for(e=t.m;;){if(!on(t))throw Error("Unmatched start-group tag: stream EOF");if(4==t.i){if(t.m!=e)throw Error("Unmatched end-group tag");break}sn(t)}break;default:throw We(t.i,t.j)}}function an(t,e,n){const r=t.g.j,i=Xe(t.g)>>>0,o=t.g.g+i;let s=o-r;if(s<=0&&(t.g.j=o,n(e,t,void 0,void 0,void 0),s=o-t.g.g),s)throw Error(`Message parsing ended unexpectedly. Expected to read ${i} bytes, instead read ${i-s} bytes, either the data ended unexpectedly or the message misreported its own length`);t.g.g=o,t.g.j=r}function un(t){var e=Xe(t.g)>>>0,a=en(t=t.g,e);if(t=t.i,s){var u,c=t;(u=o)||(u=o=new TextDecoder("utf-8",{fatal:!0})),e=a+e,c=0===a&&e===c.length?c:c.subarray(a,e);try{var l=u.decode(c)}catch(t){if(void 0===i){try{u.decode(new Uint8Array([128]))}catch(t){}try{u.decode(new Uint8Array([97])),i=!0}catch(t){i=!1}}throw!i&&(o=void 0),t}}else{e=(l=a)+e,a=[];let i,o=null;for(;l<e;){var h=t[l++];h<128?a.push(h):h<224?l>=e?n():(i=t[l++],h<194||128!=(192&i)?(l--,n()):a.push((31&h)<<6|63&i)):h<240?l>=e-1?n():(i=t[l++],128!=(192&i)||224===h&&i<160||237===h&&i>=160||128!=(192&(u=t[l++]))?(l--,n()):a.push((15&h)<<12|(63&i)<<6|63&u)):h<=244?l>=e-2?n():(i=t[l++],128!=(192&i)||i-144+(h<<28)>>30!=0||128!=(192&(u=t[l++]))||128!=(192&(c=t[l++]))?(l--,n()):(h=(7&h)<<18|(63&i)<<12|(63&u)<<6|63&c,h-=65536,a.push(55296+(h>>10&1023),56320+(1023&h)))):n(),a.length>=8192&&(o=r(o,a),a.length=0)}l=r(o,a)}return l}function cn(t){const e=Xe(t.g)>>>0;return nn(t.g,e)}function ln(t,e,n){var r=Xe(t.g)>>>0;for(r=t.g.g+r;t.g.g<r;)n.push(e(t.g))}var hn=[];let fn;function dn(t,e,n){e.g?e.j(t,e.g,e.i,n,!0):e.j(t,e.i,n,!0)}var gn=class{constructor(t,e){this.l=oe(t,e)}toJSON(){return pn(this)}v(){return!!(2&Q(this.l))}};function pn(t){t=fn?t.l:ae(t.l,ue,void 0,void 0,!1);{var e=!fn;let c=t.length;if(c){var n=t[c-1],r=at(n);r?c--:n=void 0;var i=t;if(r){t:{var o=n,s={};if(r=!1,o)for(var a in o){if(isNaN(+a)){s[a]=o[a];continue}let t=o[a];Array.isArray(t)&&(ct(t)||st(t)&&0===t.size)&&(t=null),null==t&&(r=!0),null!=t&&(s[a]=t)}if(r){for(let t in s)break t;s=null}else s=o}o=null==s?null!=n:s!==n}for(;c>0&&(null==(a=i[c-1])||ct(a)||st(a)&&0===a.size);c--)var u=!0;(i!==t||o||u)&&(e?(u||o||s)&&(i.length=c):i=Array.prototype.slice.call(i,0,c),s&&i.push(s)),u=i}else u=t}return u}function mn(t){return t?/^\d+$/.test(t)?(Pt(t),new yn(vt,wt)):null:bn||=new yn(0,0)}gn.prototype.D=it,gn.prototype.toString=function(){try{return fn=!0,pn(this).toString()}finally{fn=!1}};var yn=class{constructor(t,e){this.i=t>>>0,this.g=e>>>0}};let bn;function vn(t){return t?/^-?\d+$/.test(t)?(Pt(t),new wn(vt,wt)):null:_n||=new wn(0,0)}var wn=class{constructor(t,e){this.i=t>>>0,this.g=e>>>0}};let _n;function Sn(t,e,n){for(;n>0||e>127;)t.g.push(127&e|128),e=(e>>>7|n<<25)>>>0,n>>>=7;t.g.push(e)}function An(t,e){for(;e>127;)t.g.push(127&e|128),e>>>=7;t.g.push(e)}function En(t,e){if(e>=0)An(t,e);else{for(let n=0;n<9;n++)t.g.push(127&e|128),e>>=7;t.g.push(1)}}function In(t){var e=vt;t.g.push(e>>>0&255),t.g.push(e>>>8&255),t.g.push(e>>>16&255),t.g.push(e>>>24&255)}function Tn(t,e){0!==e.length&&(t.j.push(e),t.i+=e.length)}function xn(t,e,n){An(t.g,8*e+n)}function Pn(t,e){return xn(t,e,2),e=t.g.end(),Tn(t,e),e.push(t.i),e}function Un(t,e){var n=e.pop();for(n=t.i+t.g.length()-n;n>127;)e.push(127&n|128),n>>>=7,t.i++;e.push(n),t.i++}function On(t,e,n){xn(t,e,2),An(t.g,n.length),Tn(t,t.g.end()),Tn(t,n)}class Bn{constructor(t,e,n,r){this.g=t,this.i=e,this.j=n,this.H=r}}function Ln(t){return Array.isArray(t)?t[0]instanceof Bn?t:[Ur,t]:[t,void 0]}function Fn(t,e){if(Array.isArray(e)){var n=Q(e);if(4&n)return e;for(var r=0,i=0;r<e.length;r++){const n=t(e[r]);null!=n&&(e[i++]=n)}return i<r&&(e.length=i),tt(e,-12289&(5|n)),2&n&&Object.freeze(e),e}}const Nn=Symbol();function jn(t){let e=t[Nn];if(!e){const n=$n(t),r=er(t),i=r.j;e=i?(t,e)=>i(t,e,r):(t,e)=>{for(;on(e)&&4!=e.i;){var i=e.m;let n=r[i];const a=!n;let u=!1;if(!n){var o=r.C;if(o){var s=o[i];s&&(u=o.A?.[i],(!d||u)&&(o=Vn(s))&&(n=r[i]=o))}}n&&n(e,t,i)||(i=(o=e).j,sn(o),o.G?o=void 0:(s=o.g.g-i,o.g.g=i,o=nn(o.g,s)),i=t,o&&(ft||=Symbol(),(s=i[ft])?s.push(o):i[ft]=[o])),a&&n&&!u&&ur++<5&&G()}n===Mn||n===Cn||n.s||(t[dt||=Symbol()]=n)},t[Nn]=e}return e}function Vn(t){const e=(t=Ln(t))[0].g;if(t=t[1]){const n=jn(t),r=er(t).B;return(t,i,o)=>e(t,i,o,r,n)}return e}class kn{}let Mn,Cn;const Gn=Symbol();function Dn(t,e,n){const r=n[1];let i;if(r){const n=r[Gn];i=n?n.B:ie(r[0]),t[e]=n??r}i&&i===ne?(t.g||(t.g=new Set)).add(e):n[0]&&(t.i||(t.i=new Set)).add(e)}function zn(t,e){return[t.j,!e||e[0]>0?void 0:e]}function $n(t){var e=t[Gn];if(e)return e;if(!(e=Rn(t,t[Gn]=new kn,zn,zn,Dn)).C&&!e.i&&!e.g){let n=!0;for(let t in e)isNaN(t)||(n=!1);n?(ie(t[0])===ne?Cn?e=Cn:((e=new kn).B=ie(!0),e=Cn=e):e=Mn||=new kn,e=t[Gn]=e):e.s=!0}return e}function Wn(t,e,n){t[e]=n}function Rn(t,e,n,r,i=Wn){e.B=ie(t[0]);let o=0;var s=t[++o];s&&s.constructor===Object&&(e.C=s,"function"==typeof(s=t[++o])&&(e.j=s,e.m=t[++o],s=t[++o]));const a={};for(;Array.isArray(s)&&"number"==typeof s[0]&&s[0]>0;){for(var u=0;u<s.length;u++)a[s[u]]=s;s=t[++o]}for(u=1;void 0!==s;){let h;"number"==typeof s&&(u+=s,s=t[++o]);var c=void 0;if(s instanceof Bn?h=s:(h=Or,o--),h.H){s=t[++o],c=t;var l=o;"function"==typeof s&&(s=s(),c[l]=s),c=s}for(l=u+1,"number"==typeof(s=t[++o])&&s<0&&(l-=s,s=t[++o]);u<l;u++){const t=a[u];i(e,u,c?r(h,c,t):n(h,t))}}return e}const Hn=Symbol();function qn(t){let e=t[Hn];if(!e){const n=Yn(t);e=(t,e)=>ir(t,e,n),t[Hn]=e}return e}const Jn=Symbol();function Kn(t){return t.i}function Xn(t,e){let n,r;const i=t.i;return(t,o,s)=>i(t,o,s,r||=Yn(e).B,n||=qn(e))}function Yn(t){let e=t[Jn];return e||(e=Rn(t,t[Jn]={},Kn,Xn),nr(t),e)}const Qn=Symbol();function Zn(t,e){const n=t.g;return e?(t,r,i)=>n(t,r,i,e):n}function tr(t,e,n){const r=t.g;let i,o;return(t,s,a)=>r(t,s,a,o||=er(e).B,i||=jn(e),n)}function er(t){let e=t[Qn];return e||($n(t),e=Rn(t,t[Qn]={},Zn,tr),nr(t),e)}function nr(t){Qn in t&&Gn in t&&Jn in t&&(t.length=0)}function rr(t,e){var n=t[e];if(n)return n;if(n=t.C){var r=n[e];if(r){var i=(r=Ln(r))[0].i;if(r=r[1],n=n.A?.[e],!d||n){if(r){const e=qn(r),o=Yn(r).B;n=(n=t.m)?n(o,e):(t,n,r)=>i(t,n,r,o,e)}else n=i;return t[e]=n}}}}function ir(t,e,n){for(var r=Z(t),i=+!!(512&r)-1,o=t.length,s=512&r?1:0,a=o+(256&r?-1:0);s<a;s++){const r=t[s];if(null==r)continue;const o=s-i,a=rr(n,o);if(!a)continue;const u=n.C;u?.[o]&&!u?.A?.[o]&&ur++<5&&G(),a(e,r,o)}if(256&r){r=t[o-1];for(let t in r)i=+t,!Number.isNaN(i)&&(null!=(o=r[t])&&(a=rr(n,i)))&&((s=n.C)?.[i]&&!s?.A?.[i]&&ur++<5&&G(),a(e,o,i))}if(t=ft?t[ft]:void 0)for(Tn(e,e.g.end()),n=0;n<t.length;n++)Tn(e,V(t[n])||new Uint8Array(0))}function or(t,e){return new Bn(t,e,!1,!1)}function sr(t,e){return new Bn(t,e,!0,!1)}function ar(t,e,n){ve(t,Z(t),e,n)}let ur=0;function cr(t,e,n){e=function(t){if(null==t)return t;const e=typeof t;if("bigint"===e)return String(BigInt.asIntN(64,t));if(Gt(t)){if("string"===e)return Wt(t);if("number"===e)return $t(t)}}(e),null!=e&&("string"==typeof e&&vn(e),null!=e&&(xn(t,n,0),"number"==typeof e?(t=t.g,St(e),Sn(t,vt,wt)):(n=vn(e),Sn(t.g,n.i,n.g))))}function lr(t,e,n){null!=(e=Dt(e))&&null!=e&&(xn(t,n,0),En(t.g,e))}function hr(t,e,n){null!=(e=null==e||"boolean"==typeof e?e:"number"==typeof e?!!e:void 0)&&(xn(t,n,0),t.g.g.push(e?1:0))}function fr(t,e,n){null!=(e=Kt(e))&&On(t,n,c(e))}function dr(t,e,n,r,i){null!=(e=e instanceof gn?e.l:Array.isArray(e)?oe(e,r[0],r[1]):void 0)&&(n=Pn(t,n),i(e,t),Un(t,n))}function gr(t,e,n){null!=(e=null==e||"string"==typeof e||B(e)||e instanceof k?e:void 0)&&On(t,n,qe(e).buffer)}var pr,mr=or((function(t,e,n){return 5===t.i&&(ar(e,n,Ye(t.g)),!0)}),(function(t,e,n){null!=(e=kt(e))&&(xn(t,n,5),t=t.g,At(e),In(t))})),yr=sr((function(t,e,n){return(5===t.i||2===t.i)&&(e=we(e,Z(e),n,2,!1),2==t.i?ln(t,Ye,e):e.push(Ye(t.g)),!0)}),(function(t,e,n){if(null!=(e=Fn(kt,e))&&e.length){xn(t,n,2),An(t.g,4*e.length);for(let r=0;r<e.length;r++)n=t.g,At(e[r]),In(n)}})),br=or((function(t,e,n){return 0===t.i&&(ar(e,n,Je(t.g,It)),!0)}),cr),vr=or((function(t,e,n){return 0===t.i&&(ar(e,n,0===(t=Je(t.g,It))?void 0:t),!0)}),cr),wr=or((function(t,e,n){return 0===t.i&&(ar(e,n,Je(t.g,Et)),!0)}),(function(t,e,n){null!=(e=Ht(e))&&("string"==typeof e&&mn(e),null!=e&&(xn(t,n,0),"number"==typeof e?(t=t.g,St(e),Sn(t,vt,wt)):(n=mn(e),Sn(t.g,n.i,n.g))))})),_r=or((function(t,e,n){return 0===t.i&&(ar(e,n,Xe(t.g)),!0)}),lr),Sr=sr((function(t,e,n){return(0===t.i||2===t.i)&&(e=we(e,Z(e),n,2,!1),2==t.i?ln(t,Xe,e):e.push(Xe(t.g)),!0)}),(function(t,e,n){if(null!=(e=Fn(Dt,e))&&e.length){n=Pn(t,n);for(let n=0;n<e.length;n++)En(t.g,e[n]);Un(t,n)}})),Ar=or((function(t,e,n){return 0===t.i&&(ar(e,n,0===(t=Xe(t.g))?void 0:t),!0)}),lr),Er=or((function(t,e,n){return 0===t.i&&(ar(e,n,Ke(t.g)),!0)}),hr),Ir=or((function(t,e,n){return 0===t.i&&(ar(e,n,!1===(t=Ke(t.g))?void 0:t),!0)}),hr),Tr=sr((function(t,e,n){if(2!==t.i)return!1;t=un(t);const r=Z(e);return ht(r),we(e,r,n,2).push(t),!0}),(function(t,e,n){if(null!=(e=Fn(Kt,e)))for(let s=0;s<e.length;s++){var r=t,i=n,o=e[s];null!=o&&On(r,i,c(o))}})),xr=or((function(t,e,n){return 2===t.i&&(ar(e,n,""===(t=un(t))?void 0:t),!0)}),fr),Pr=or((function(t,e,n){return 2===t.i&&(ar(e,n,un(t)),!0)}),fr),Ur=new Bn((function(t,e,n,r,i){return 2===t.i&&(an(t,Be(e,r,n,!0),i),!0)}),dr,!1,!0),Or=new Bn((function(t,e,n,r,i){return 2===t.i&&(an(t,Be(e,r,n),i),!0)}),dr,!1,!0);pr=new Bn((function(t,e,n,r,i){if(2!==t.i)return!1;r=oe(void 0,r[0],r[1]);let o=Z(e);ht(o);let s=we(e,o,n,3);return o=Z(e),4&Q(s)&&(s=$(s),tt(s,-2079&(1|Q(s))),ve(e,o,n,s)),s.push(r),an(t,r,i),!0}),(function(t,e,n,r,i){if(Array.isArray(e))for(let o=0;o<e.length;o++)dr(t,e[o],n,r,i)}),!0,!0);var Br=new Bn((function(t,e,n,r,i,o){return 2===t.i&&(Ue(e,Z(e),o,n),an(t,e=Be(e,r,n),i),!0)}),dr,!1,!0),Lr=or((function(t,e,n){return 2===t.i&&(ar(e,n,cn(t)),!0)}),gr),Fr=or((function(t,e,n){return 0===t.i&&(ar(e,n,Xe(t.g)),!0)}),(function(t,e,n){null!=(e=Dt(e))&&(e=parseInt(e,10),xn(t,n,0),En(t.g,e))}));class Nr{constructor(t,e){this.i=t,this.g=e,this.j=Ve,this.defaultValue=void 0}}function jr(t,e){return(n,r)=>{if(hn.length){const t=hn.pop();t.o(r),Ze(t.g,n,r),n=t}else n=new class{constructor(t,e){if(rn.length){const n=rn.pop();Ze(n,t,e),t=n}else t=new class{constructor(t,e){this.i=null,this.m=!1,this.g=this.j=this.s=0,Ze(this,t,e)}clear(){this.i=null,this.m=!1,this.g=this.j=this.s=0,this.F=!1}}(t,e);this.g=t,this.j=this.g.g,this.i=this.m=-1,this.o(e)}o({G:t=!1}={}){this.G=t}}(n,r);try{const r=new t,o=r.l;jn(e)(o,n);var i=r}finally{n.g.clear(),n.m=-1,n.i=-1,hn.length<100&&hn.push(n)}return i}}var Vr=[0,xr,or((function(t,e,n){return 2===t.i&&(ar(e,n,(t=cn(t))===j()?void 0:t),!0)}),(function(t,e,n){if(null!=e){if(e instanceof gn){const r=e.N;return void(r&&(e=r(e),null!=e&&On(t,n,qe(e).buffer)))}if(Array.isArray(e))return}gr(t,e,n)}))],kr=[0,_r,Fr,Er,-1,Sr,Fr,-1],Mr=class extends gn{constructor(){super()}},Cr=[0,Er,Pr,Er,Fr,-1,sr((function(t,e,n){return(0===t.i||2===t.i)&&(e=we(e,Z(e),n,2,!1),2==t.i?ln(t,Qe,e):e.push(Xe(t.g)),!0)}),(function(t,e,n){if(null!=(e=Fn(Dt,e))&&e.length){n=Pn(t,n);for(let n=0;n<e.length;n++)En(t.g,e[n]);Un(t,n)}})),Pr,-1,[0,Er,-1],Fr,Er],Gr=[0,Pr,-2],Dr=class extends gn{constructor(){super()}},zr=[0],$r=[0,_r,Er,1,Er,-3],Wr=[0,Pr,Er,-1,_r,[0,[1,2,3,4,5,6],Br,zr,Br,Cr,Br,Gr,Br,$r,Br,kr,Br,[0,Pr,-2]],[0,Pr],Er,[0,[1,3],[2,4],Br,[0,Sr],-1,Br,[0,Tr],-1,pr,[0,Pr,-1]],Pr],Rr=class extends gn{constructor(t){super(t,2)}},Hr={},qr=Hr.A={};Hr[336783863]=Wr,qr[336783863]=1;var Jr=[0,vr,-1,Ir,-3,vr,Sr,xr,Ar,vr,-1,Ir,Ar,Ir,-2,xr];function Kr(t){$e(t,3,"TEXT:text_in")}var Xr=class extends gn{constructor(t){super(t,500)}o(t){return Ve(this,0,7,t)}},Yr=[-1,{A:{}}],Qr=[0,Pr,1,Yr],Zr=[0,Pr,Tr,Yr];function ti(t){$e(t,10,"text_in")}var ei,ni=class extends gn{constructor(){super(void 0,500)}o(t){return Ve(this,0,1001,t)}};ni.prototype.g=(ei=[-500,pr,[-500,xr,-1,Tr,-3,[-2,Hr,Er],pr,Vr,Ar,-1,Qr,Zr,pr,[0,xr,Ir],xr,Jr,Ar,Tr,987,Tr],4,pr,[-500,Pr,-1,[-1,{A:{}}],998,Pr],pr,[-500,Pr,Tr,-1,[-2,{A:{}},Er],997,Tr,-1],Ar,pr,[-500,Pr,Tr,Yr,998,Tr],Tr,Ar,Qr,Zr,pr,[0,xr,-1,Yr],Tr,-2,Jr,xr,-1,Ir,979,Yr,pr,Vr],function(){const t=new class{constructor(){this.j=[],this.i=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){const t=this.g;return this.g=[],t}}}};ir(this.l,t,Yn(ei)),Tn(t,t.g.end());const e=new Uint8Array(t.i),n=t.j,r=n.length;let i=0;for(let t=0;t<r;t++){const r=n[t];e.set(r,i),i+=r.length}return t.j=[e],e});var ri=class extends gn{constructor(t){super(t)}},ii=class extends gn{constructor(t){super(t)}g(){return je(this,ri)}},oi=class extends gn{constructor(t){super(t)}},si=jr(class extends gn{constructor(t){super(t)}},[0,pr,[0,1,_r,Pr,[0,pr,[0,_r,mr,Pr,-1]]],br]),ai=class extends gn{constructor(t){super(t)}},ui=class extends gn{constructor(t){super(t)}I(){const t=_e(this);return null==t?j():t}},ci=class extends gn{constructor(t){super(t)}},li=[1,2],hi=jr(class extends gn{constructor(t){super(t)}},[0,pr,[0,li,Br,[0,yr],Br,[0,Lr],_r,Pr],br]),fi=class extends gn{constructor(t){super(t)}},di=class extends gn{constructor(t){super(t)}},gi=[0,Er,-1],pi=class extends gn{constructor(t){super(t)}},mi=[1,2,3,4,5],yi=class extends gn{constructor(t){super(t)}g(){return null!=_e(this)}i(){return null!=Kt(pe(this,2))}},bi=class extends gn{constructor(t){super(t)}},vi=[0,[0,Lr,Pr,[0,_r,br,-1],[0,wr,br]],Er,[0,mi,Br,$r,Br,Cr,Br,kr,Br,zr,Br,Gr],Fr],wi=class extends gn{constructor(t){super(t)}},_i=new Nr(462704549,wi);Hr[462704549]=[0,vi,[0,Pr,_r,mr,Tr,-1]],qr[462704549]=1;var Si=class extends gn{constructor(t){super(t)}},Ai=new Nr(477589892,Si);function Ei(t,e){if(e=e?le(e):new fi,void 0!==t.displayNamesLocale?be(e,1,Jt(t.displayNamesLocale)):void 0===t.displayNamesLocale&&be(e,1),void 0!==t.maxResults){var n=t.maxResults;if(null!=n){if("number"!=typeof n)throw D();if(!Number.isFinite(n))throw D();n|=0}be(e,2,n)}else"maxResults"in t&&be(e,2);if(void 0!==t.scoreThreshold){if(null!=(n=t.scoreThreshold)&&"number"!=typeof n)throw Error(`Value of float/double field must be a number, found ${typeof n}: ${n}`);be(e,3,n)}else"scoreThreshold"in t&&be(e,3);return void 0!==t.categoryAllowlist?ze(e,4,t.categoryAllowlist):"categoryAllowlist"in t&&be(e,4),void 0!==t.categoryDenylist?ze(e,5,t.categoryDenylist):"categoryDenylist"in t&&be(e,5),e}function Ii(t){const e={classifications:je(t,oi).map((t=>function(t,e=-1,n=""){return{categories:t.map((t=>{var e=De(Dt(pe(t,1)),0)??-1;const n=t.l;let r=Z(n);const i=ye(n,r,2),o=kt(i);return null!=o&&o!==i&&ve(n,r,2,o),{index:e,score:o??0??0,categoryName:De(Kt(pe(t,3)),"")??"",displayName:De(Kt(pe(t,4)),"")??""}})),headIndex:e,headName:n}}(Fe(t,ii,4)?.g()??[],De(Dt(pe(t,2)),0),De(Kt(pe(t,3)),""))))};return null!=Rt(pe(t,2))&&(e.timestampMs=De(Rt(pe(t,2)),0)),e}function Ti(t){return Array.from(t,(t=>t>127?t-256:t))}function xi(t,e){if(t.length!==e.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${t.length} vs. ${e.length}).`);let n=0,r=0,i=0;for(let o=0;o<t.length;o++)n+=t[o]*e[o],r+=t[o]*t[o],i+=e[o]*e[o];if(r<=0||i<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return n/Math.sqrt(r*i)}let Pi;Hr[477589892]=[0,vi,gi],qr[477589892]=1;const Ui=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 Oi(){if(void 0===Pi)try{await WebAssembly.instantiate(Ui),Pi=!0}catch{Pi=!1}return Pi}async function Bi(t,e=""){const n=await Oi()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${e}/${t}_${n}.js`,wasmBinaryPath:`${e}/${t}_${n}.wasm`}}var Li=class{};function Fi(){var t=navigator;return"undefined"!=typeof OffscreenCanvas&&(!function(t=navigator){return(t=t.userAgent).includes("Safari")&&!t.includes("Chrome")}(t)||!!((t=t.userAgent.match(/Version\/([\d]+).*Safari/))&&t.length>=1&&Number(t[1])>=17))}async function Ni(t){if("function"!=typeof importScripts){const e=document.createElement("script");return e.src=t.toString(),e.crossOrigin="anonymous",new Promise(((t,n)=>{e.addEventListener("load",(()=>{t()}),!1),e.addEventListener("error",(t=>{n(t)}),!1),document.body.appendChild(e)}))}importScripts(t.toString())}Li.forVisionTasks=function(t){return Bi("vision",t)},Li.forTextTasks=function(t){return Bi("text",t)},Li.forGenAiExperimentalTasks=function(t){return Bi("genai_experimental",t)},Li.forGenAiTasks=function(t){return Bi("genai",t)},Li.forAudioTasks=function(t){return Bi("audio",t)},Li.isSimdSupported=function(){return Oi()};function ji(t,e,n){t.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),n(e=t.h.stringToNewUTF8(e)),t.h._free(e)}function Vi(t,e,n){t.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const r=new Uint32Array(e.length);for(let n=0;n<e.length;n++)r[n]=t.h.stringToNewUTF8(e[n]);e=t.h._malloc(4*r.length),t.h.HEAPU32.set(r,e>>2),n(e);for(const e of r)t.h._free(e);t.h._free(e)}function ki(t,e,n){t.h.simpleListeners=t.h.simpleListeners||{},t.h.simpleListeners[e]=n}function Mi(t,e,n){let r=[];t.h.simpleListeners=t.h.simpleListeners||{},t.h.simpleListeners[e]=(t,e,i)=>{e?(n(r,i),r=[]):r.push(t)}}const Ci=function(t){return class extends t{M(){this.h._registerModelResourcesGraphService()}}}(class{constructor(t,e){this.j=!0,this.h=t,this.g=null,this.i=0,this.m="function"==typeof this.h._addIntToInputStream,void 0!==e?this.h.canvas=e:Fi()?this.h.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.h.canvas=document.createElement("canvas"))}async initializeGraph(t){const e=await(await fetch(t)).arrayBuffer();t=!(t.endsWith(".pbtxt")||t.endsWith(".textproto")),this.setGraph(new Uint8Array(e),t)}setGraphFromString(t){this.setGraph((new TextEncoder).encode(t),!1)}setGraph(t,e){const n=t.length,r=this.h._malloc(n);this.h.HEAPU8.set(t,r),e?this.h._changeBinaryGraph(n,r):this.h._changeTextGraph(n,r),this.h._free(r)}configureAudio(t,e,n,r,i){this.h._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),ji(this,r||"input_audio",(r=>{ji(this,i=i||"audio_header",(i=>{this.h._configureAudio(r,i,t,e,n)}))}))}setAutoResizeCanvas(t){this.j=t}setAutoRenderToScreen(t){this.h._setAutoRenderToScreen(t)}setGpuBufferVerticalFlip(t){this.h.gpuOriginForWebTexturesIsBottomLeft=t}attachErrorListener(t){this.h.errorListener=t}attachEmptyPacketListener(t,e){this.h.emptyPacketListeners=this.h.emptyPacketListeners||{},this.h.emptyPacketListeners[t]=e}addAudioToStream(t,e,n){this.addAudioToStreamWithShape(t,0,0,e,n)}addAudioToStreamWithShape(t,e,n,r,i){const o=4*t.length;this.i!==o&&(this.g&&this.h._free(this.g),this.g=this.h._malloc(o),this.i=o),this.h.HEAPF32.set(t,this.g/4),ji(this,r,(t=>{this.h._addAudioToInputStream(this.g,e,n,t,i)}))}addGpuBufferToStream(t,e,n){ji(this,e,(e=>{if(!this.h.canvas)throw Error("No OpenGL canvas configured.");e?this.h._bindTextureToStream(e):this.h._bindTextureToCanvas();const r=this.h.canvas.getContext("webgl2")||this.h.canvas.getContext("webgl");if(!r)throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");this.h.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!0),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t),this.h.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1);const[i,o]=void 0!==t.videoWidth?[t.videoWidth,t.videoHeight]:void 0!==t.naturalWidth?[t.naturalWidth,t.naturalHeight]:void 0!==t.displayWidth?[t.displayWidth,t.displayHeight]:[t.width,t.height];!this.j||i===this.h.canvas.width&&o===this.h.canvas.height||(this.h.canvas.width=i,this.h.canvas.height=o);const[s,a]=[i,o];this.h._addBoundTextureToStream(e,s,a,n)}))}addBoolToStream(t,e,n){ji(this,e,(e=>{this.h._addBoolToInputStream(t,e,n)}))}addDoubleToStream(t,e,n){ji(this,e,(e=>{this.h._addDoubleToInputStream(t,e,n)}))}addFloatToStream(t,e,n){ji(this,e,(e=>{this.h._addFloatToInputStream(t,e,n)}))}addIntToStream(t,e,n){ji(this,e,(e=>{this.h._addIntToInputStream(t,e,n)}))}addUintToStream(t,e,n){ji(this,e,(e=>{this.h._addUintToInputStream(t,e,n)}))}addStringToStream(t,e,n){ji(this,e,(e=>{ji(this,t,(t=>{this.h._addStringToInputStream(t,e,n)}))}))}addStringRecordToStream(t,e,n){ji(this,e,(e=>{Vi(this,Object.keys(t),(r=>{Vi(this,Object.values(t),(i=>{this.h._addFlatHashMapToInputStream(r,i,Object.keys(t).length,e,n)}))}))}))}addProtoToStream(t,e,n,r){ji(this,n,(n=>{ji(this,e,(e=>{const i=this.h._malloc(t.length);this.h.HEAPU8.set(t,i),this.h._addProtoToInputStream(i,t.length,e,n,r),this.h._free(i)}))}))}addEmptyPacketToStream(t,e){ji(this,t,(t=>{this.h._addEmptyPacketToInputStream(t,e)}))}addBoolVectorToStream(t,e,n){ji(this,e,(e=>{const r=this.h._allocateBoolVector(t.length);if(!r)throw Error("Unable to allocate new bool vector on heap.");for(const e of t)this.h._addBoolVectorEntry(r,e);this.h._addBoolVectorToInputStream(r,e,n)}))}addDoubleVectorToStream(t,e,n){ji(this,e,(e=>{const r=this.h._allocateDoubleVector(t.length);if(!r)throw Error("Unable to allocate new double vector on heap.");for(const e of t)this.h._addDoubleVectorEntry(r,e);this.h._addDoubleVectorToInputStream(r,e,n)}))}addFloatVectorToStream(t,e,n){ji(this,e,(e=>{const r=this.h._allocateFloatVector(t.length);if(!r)throw Error("Unable to allocate new float vector on heap.");for(const e of t)this.h._addFloatVectorEntry(r,e);this.h._addFloatVectorToInputStream(r,e,n)}))}addIntVectorToStream(t,e,n){ji(this,e,(e=>{const r=this.h._allocateIntVector(t.length);if(!r)throw Error("Unable to allocate new int vector on heap.");for(const e of t)this.h._addIntVectorEntry(r,e);this.h._addIntVectorToInputStream(r,e,n)}))}addUintVectorToStream(t,e,n){ji(this,e,(e=>{const r=this.h._allocateUintVector(t.length);if(!r)throw Error("Unable to allocate new unsigned int vector on heap.");for(const e of t)this.h._addUintVectorEntry(r,e);this.h._addUintVectorToInputStream(r,e,n)}))}addStringVectorToStream(t,e,n){ji(this,e,(e=>{const r=this.h._allocateStringVector(t.length);if(!r)throw Error("Unable to allocate new string vector on heap.");for(const e of t)ji(this,e,(t=>{this.h._addStringVectorEntry(r,t)}));this.h._addStringVectorToInputStream(r,e,n)}))}addBoolToInputSidePacket(t,e){ji(this,e,(e=>{this.h._addBoolToInputSidePacket(t,e)}))}addDoubleToInputSidePacket(t,e){ji(this,e,(e=>{this.h._addDoubleToInputSidePacket(t,e)}))}addFloatToInputSidePacket(t,e){ji(this,e,(e=>{this.h._addFloatToInputSidePacket(t,e)}))}addIntToInputSidePacket(t,e){ji(this,e,(e=>{this.h._addIntToInputSidePacket(t,e)}))}addUintToInputSidePacket(t,e){ji(this,e,(e=>{this.h._addUintToInputSidePacket(t,e)}))}addStringToInputSidePacket(t,e){ji(this,e,(e=>{ji(this,t,(t=>{this.h._addStringToInputSidePacket(t,e)}))}))}addProtoToInputSidePacket(t,e,n){ji(this,n,(n=>{ji(this,e,(e=>{const r=this.h._malloc(t.length);this.h.HEAPU8.set(t,r),this.h._addProtoToInputSidePacket(r,t.length,e,n),this.h._free(r)}))}))}addBoolVectorToInputSidePacket(t,e){ji(this,e,(e=>{const n=this.h._allocateBoolVector(t.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(const e of t)this.h._addBoolVectorEntry(n,e);this.h._addBoolVectorToInputSidePacket(n,e)}))}addDoubleVectorToInputSidePacket(t,e){ji(this,e,(e=>{const n=this.h._allocateDoubleVector(t.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(const e of t)this.h._addDoubleVectorEntry(n,e);this.h._addDoubleVectorToInputSidePacket(n,e)}))}addFloatVectorToInputSidePacket(t,e){ji(this,e,(e=>{const n=this.h._allocateFloatVector(t.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(const e of t)this.h._addFloatVectorEntry(n,e);this.h._addFloatVectorToInputSidePacket(n,e)}))}addIntVectorToInputSidePacket(t,e){ji(this,e,(e=>{const n=this.h._allocateIntVector(t.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(const e of t)this.h._addIntVectorEntry(n,e);this.h._addIntVectorToInputSidePacket(n,e)}))}addUintVectorToInputSidePacket(t,e){ji(this,e,(e=>{const n=this.h._allocateUintVector(t.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(const e of t)this.h._addUintVectorEntry(n,e);this.h._addUintVectorToInputSidePacket(n,e)}))}addStringVectorToInputSidePacket(t,e){ji(this,e,(e=>{const n=this.h._allocateStringVector(t.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(const e of t)ji(this,e,(t=>{this.h._addStringVectorEntry(n,t)}));this.h._addStringVectorToInputSidePacket(n,e)}))}attachBoolListener(t,e){ki(this,t,e),ji(this,t,(t=>{this.h._attachBoolListener(t)}))}attachBoolVectorListener(t,e){Mi(this,t,e),ji(this,t,(t=>{this.h._attachBoolVectorListener(t)}))}attachIntListener(t,e){ki(this,t,e),ji(this,t,(t=>{this.h._attachIntListener(t)}))}attachIntVectorListener(t,e){Mi(this,t,e),ji(this,t,(t=>{this.h._attachIntVectorListener(t)}))}attachUintListener(t,e){ki(this,t,e),ji(this,t,(t=>{this.h._attachUintListener(t)}))}attachUintVectorListener(t,e){Mi(this,t,e),ji(this,t,(t=>{this.h._attachUintVectorListener(t)}))}attachDoubleListener(t,e){ki(this,t,e),ji(this,t,(t=>{this.h._attachDoubleListener(t)}))}attachDoubleVectorListener(t,e){Mi(this,t,e),ji(this,t,(t=>{this.h._attachDoubleVectorListener(t)}))}attachFloatListener(t,e){ki(this,t,e),ji(this,t,(t=>{this.h._attachFloatListener(t)}))}attachFloatVectorListener(t,e){Mi(this,t,e),ji(this,t,(t=>{this.h._attachFloatVectorListener(t)}))}attachStringListener(t,e){ki(this,t,e),ji(this,t,(t=>{this.h._attachStringListener(t)}))}attachStringVectorListener(t,e){Mi(this,t,e),ji(this,t,(t=>{this.h._attachStringVectorListener(t)}))}attachProtoListener(t,e,n){ki(this,t,e),ji(this,t,(t=>{this.h._attachProtoListener(t,n||!1)}))}attachProtoVectorListener(t,e,n){Mi(this,t,e),ji(this,t,(t=>{this.h._attachProtoVectorListener(t,n||!1)}))}attachAudioListener(t,e,n){this.h._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),ki(this,t,((t,n)=>{t=new Float32Array(t.buffer,t.byteOffset,t.length/4),e(t,n)})),ji(this,t,(t=>{this.h._attachAudioListener(t,n||!1)}))}finishProcessing(){this.h._waitUntilIdle()}closeGraph(){this.h._closeGraph(),this.h.simpleListeners=void 0,this.h.emptyPacketListeners=void 0}});var Gi=class extends Ci{};async function Di(t,e,n){return t=await(async(t,e,n,r)=>{if(e&&await Ni(e),!self.ModuleFactory)throw Error("ModuleFactory not set.");if(n&&(await Ni(n),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&r&&((e=self.Module).locateFile=r.locateFile,r.mainScriptUrlOrBlob&&(e.mainScriptUrlOrBlob=r.mainScriptUrlOrBlob)),r=await self.ModuleFactory(self.Module||r),self.ModuleFactory=self.Module=void 0,new t(r,null)})(t,e.wasmLoaderPath,e.assetLoaderPath,{locateFile:t=>t.endsWith(".wasm")?e.wasmBinaryPath.toString():e.assetBinaryPath&&t.endsWith(".data")?e.assetBinaryPath.toString():t}),await t.o(n),t}async function zi(t,e,n){return Di(t,e,n)}function $i(t,e){const n=Fe(t.baseOptions,yi,1)||new yi;"string"==typeof e?(be(n,2,Jt(e)),be(n,1)):e instanceof Uint8Array&&(be(n,1,ut(e,!1,!1)),be(n,2)),Ve(t.baseOptions,0,1,n)}function Wi(t,e){const n=e.baseOptions||{};if(e.baseOptions?.modelAssetBuffer&&e.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(Fe(t.baseOptions,yi,1)?.g()||Fe(t.baseOptions,yi,1)?.i()||e.baseOptions?.modelAssetBuffer||e.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if(function(t,e){let n=Fe(t.baseOptions,pi,3);if(!n){var r=n=new pi;ke(r,4,new Dr)}"delegate"in e&&("GPU"===e.delegate?ke(e=n,2,r=new Mr):ke(e=n,4,r=new Dr)),Ve(t.baseOptions,0,3,n)}(t,n),n.modelAssetPath)return fetch(n.modelAssetPath.toString()).then((t=>{if(t.ok)return t.arrayBuffer();throw Error(`Failed to fetch model: ${n.modelAssetPath} (${t.status})`)})).then((e=>{try{t.g.h.FS_unlink("/model.dat")}catch{}t.g.h.FS_createDataFile("/","model.dat",new Uint8Array(e),!0,!1,!1),$i(t,"/model.dat"),t.s()}));if(n.modelAssetBuffer instanceof Uint8Array)$i(t,n.modelAssetBuffer);else if(n.modelAssetBuffer)return async function(t){const e=[];for(var n=0;;){const{done:r,value:i}=await t.read();if(r)break;e.push(i),n+=i.length}if(0===e.length)return new Uint8Array(0);if(1===e.length)return e[0];t=new Uint8Array(n),n=0;for(const r of e)t.set(r,n),n+=r.length;return t}(n.modelAssetBuffer).then((e=>{$i(t,e),t.s()}));return t.s(),Promise.resolve()}function Ri(t){try{const e=t.m.length;if(1===e)throw Error(t.m[0].message);if(e>1)throw Error("Encountered multiple errors: "+t.m.map((t=>t.message)).join(", "))}finally{t.m=[]}}function Hi(t,e){t.j=Math.max(t.j,e)}var qi=class{constructor(t){this.g=t,this.m=[],this.j=0,this.g.setAutoRenderToScreen(!1)}setGraph(t,e){this.g.attachErrorListener(((t,e)=>{this.m.push(Error(e))})),this.g.M(),this.g.setGraph(t,e),Ri(this)}finishProcessing(){this.g.finishProcessing(),Ri(this)}close(){this.g.closeGraph()}};qi.prototype.close=qi.prototype.close,function(e,n){e=e.split(".");var r,i=t;e[0]in i||void 0===i.execScript||i.execScript("var "+e[0]);for(;e.length&&(r=e.shift());)e.length||void 0===n?i=i[r]&&i[r]!==Object.prototype[r]?i[r]:i[r]={}:i[r]=n}("TaskRunner",qi);var Ji=class extends qi{constructor(t,e){super(new Gi(t,e)),this.u={languages:[]},Ve(t=this.i=new wi,0,1,e=new bi)}o(t){return Ve(this.i,0,2,Ei(t,Fe(this.i,fi,2))),Wi(this,t)}get baseOptions(){return Fe(this.i,bi,1)}set baseOptions(t){Ve(this.i,0,1,t)}K(t){return this.u={languages:[]},this.g.addStringToStream(t,"text_in",this.j+1),this.finishProcessing(),this.u}s(){var t=new ni;ti(t),$e(t,15,"classifications_out");const e=new Rr;dn(e,_i,this.i);const n=new Xr;Te(n,Jt("mediapipe.tasks.text.text_classifier.TextClassifierGraph")),Kr(n),$e(n,4,"CLASSIFICATIONS:classifications_out"),n.o(e),Ge(t,n),this.g.attachProtoListener("classifications_out",((t,e)=>{if(({classifications:t}=Ii(si(t))),1!==t.length)throw Error(`Expected 1 classification head, got ${t.length}`);this.u.languages=t[0].categories.map((t=>({languageCode:t.categoryName,probability:t.score}))),Hi(this,e)})),this.g.attachEmptyPacketListener("classifications_out",(t=>{Hi(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Ji.prototype.detect=Ji.prototype.K,Ji.prototype.setOptions=Ji.prototype.o,Ji.createFromModelPath=function(t,e){return zi(Ji,t,{baseOptions:{modelAssetPath:e}})},Ji.createFromModelBuffer=function(t,e){return zi(Ji,t,{baseOptions:{modelAssetBuffer:e}})},Ji.createFromOptions=function(t,e){return zi(Ji,t,e)};var Ki=class extends qi{constructor(t,e){super(new Gi(t,e)),this.u={classifications:[]},Ve(t=this.i=new wi,0,1,e=new bi)}o(t){return Ve(this.i,0,2,Ei(t,Fe(this.i,fi,2))),Wi(this,t)}get baseOptions(){return Fe(this.i,bi,1)}set baseOptions(t){Ve(this.i,0,1,t)}J(t){return this.u={classifications:[]},this.g.addStringToStream(t,"text_in",this.j+1),this.finishProcessing(),this.u}s(){var t=new ni;ti(t),$e(t,15,"classifications_out");const e=new Rr;dn(e,_i,this.i);const n=new Xr;Te(n,Jt("mediapipe.tasks.text.text_classifier.TextClassifierGraph")),Kr(n),$e(n,4,"CLASSIFICATIONS:classifications_out"),n.o(e),Ge(t,n),this.g.attachProtoListener("classifications_out",((t,e)=>{this.u=Ii(si(t)),Hi(this,e)})),this.g.attachEmptyPacketListener("classifications_out",(t=>{Hi(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Ki.prototype.classify=Ki.prototype.J,Ki.prototype.setOptions=Ki.prototype.o,Ki.createFromModelPath=function(t,e){return zi(Ki,t,{baseOptions:{modelAssetPath:e}})},Ki.createFromModelBuffer=function(t,e){return zi(Ki,t,{baseOptions:{modelAssetBuffer:e}})},Ki.createFromOptions=function(t,e){return zi(Ki,t,e)};var Xi=class extends qi{constructor(t,e){super(new Gi(t,e)),this.u={embeddings:[]},Ve(t=this.i=new Si,0,1,e=new bi)}o(t){var e=this.i,n=Fe(this.i,di,2);return n=n?le(n):new di,void 0!==t.l2Normalize?be(n,1,Mt(t.l2Normalize)):"l2Normalize"in t&&be(n,1),void 0!==t.quantize?be(n,2,Mt(t.quantize)):"quantize"in t&&be(n,2),Ve(e,0,2,n),Wi(this,t)}get baseOptions(){return Fe(this.i,bi,1)}set baseOptions(t){Ve(this.i,0,1,t)}L(t){return this.g.addStringToStream(t,"text_in",this.j+1),this.finishProcessing(),this.u}s(){var t=new ni;ti(t),$e(t,15,"embeddings_out");const e=new Rr;dn(e,Ai,this.i);const n=new Xr;Te(n,Jt("mediapipe.tasks.text.text_embedder.TextEmbedderGraph")),Kr(n),$e(n,4,"EMBEDDINGS:embeddings_out"),n.o(e),Ge(t,n),this.g.attachProtoListener("embeddings_out",((t,e)=>{t=hi(t),this.u=function(t){return{embeddings:je(t,ci).map((t=>{const e={headIndex:De(Dt(pe(t,3)),0)??-1,headName:De(Kt(pe(t,4)),"")??""};if(void 0!==Le(t,ai,xe(t,1)))e.floatEmbedding=Se(Fe(t,ai,xe(t,1)),1,kt,void 0===pt?2:5).slice();else{const n=new Uint8Array(0);e.quantizedEmbedding=Fe(t,ui,xe(t,2))?.I()?.i()??n}return e})),timestampMs:De(Rt(pe(t,2)),0)}}(t),Hi(this,e)})),this.g.attachEmptyPacketListener("embeddings_out",(t=>{Hi(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Xi.cosineSimilarity=function(t,e){if(t.floatEmbedding&&e.floatEmbedding)t=xi(t.floatEmbedding,e.floatEmbedding);else{if(!t.quantizedEmbedding||!e.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");t=xi(Ti(t.quantizedEmbedding),Ti(e.quantizedEmbedding))}return t},Xi.prototype.embed=Xi.prototype.L,Xi.prototype.setOptions=Xi.prototype.o,Xi.createFromModelPath=function(t,e){return zi(Xi,t,{baseOptions:{modelAssetPath:e}})},Xi.createFromModelBuffer=function(t,e){return zi(Xi,t,{baseOptions:{modelAssetBuffer:e}})},Xi.createFromOptions=function(t,e){return zi(Xi,t,e)},exports.FilesetResolver=Li,exports.LanguageDetector=Ji,exports.TextClassifier=Ki,exports.TextEmbedder=Xi;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t="undefined"!=typeof self?self:{};function e(e,n){t:{for(var r=["CLOSURE_FLAGS"],i=t,o=0;o<r.length;o++)if(null==(i=i[r[o]])){r=null;break t}r=i}return null!=(e=r&&r[e])?e:n}function n(){throw Error("Invalid UTF8")}function r(t,e){return e=String.fromCharCode.apply(null,e),null==t?e:t+e}let i,o;const s="undefined"!=typeof TextDecoder;let a;const u="undefined"!=typeof TextEncoder;function c(t){if(u)t=(a||=new TextEncoder).encode(t);else{let n=0;const r=new Uint8Array(3*t.length);for(let i=0;i<t.length;i++){var e=t.charCodeAt(i);if(e<128)r[n++]=e;else{if(e<2048)r[n++]=e>>6|192;else{if(e>=55296&&e<=57343){if(e<=56319&&i<t.length){const o=t.charCodeAt(++i);if(o>=56320&&o<=57343){e=1024*(e-55296)+o-56320+65536,r[n++]=e>>18|240,r[n++]=e>>12&63|128,r[n++]=e>>6&63|128,r[n++]=63&e|128;continue}i--}e=65533}r[n++]=e>>12|224,r[n++]=e>>6&63|128}r[n++]=63&e|128}}t=n===r.length?r:r.subarray(0,n)}return t}var l,h=e(610401301,!1),f=e(645172343,e(1,!0)),d=e(660014094,!1);const g=t.navigator;function p(t){return!!h&&(!!l&&l.brands.some((({brand:e})=>e&&-1!=e.indexOf(t))))}function m(e){var n;return(n=t.navigator)&&(n=n.userAgent)||(n=""),-1!=n.indexOf(e)}function y(){return!!h&&(!!l&&l.brands.length>0)}function b(){return y()?p("Chromium"):(m("Chrome")||m("CriOS"))&&!(!y()&&m("Edge"))||m("Silk")}l=g&&g.userAgentData||null;var v=!y()&&(m("Trident")||m("MSIE"));!m("Android")||b(),b(),m("Safari")&&(b()||!y()&&m("Coast")||!y()&&m("Opera")||!y()&&m("Edge")||(y()?p("Microsoft Edge"):m("Edg/"))||y()&&p("Opera"));var w={},_=null;function S(t){var e=t.length,n=3*e/4;n%3?n=Math.floor(n):-1!="=.".indexOf(t[e-1])&&(n=-1!="=.".indexOf(t[e-2])?n-2:n-1);var r=new Uint8Array(n),i=0;return function(t,e){function n(e){for(;r<t.length;){var n=t.charAt(r++),i=_[n];if(null!=i)return i;if(!/^[\s\xa0]*$/.test(n))throw Error("Unknown base64 encoding at char: "+n)}return e}A();for(var r=0;;){var i=n(-1),o=n(0),s=n(64),a=n(64);if(64===a&&-1===i)break;e(i<<2|o>>4),64!=s&&(e(o<<4&240|s>>2),64!=a&&e(s<<6&192|a))}}(t,(function(t){r[i++]=t})),i!==n?r.subarray(0,i):r}function A(){if(!_){_={};for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),e=["+/=","+/","-_=","-_.","-_"],n=0;n<5;n++){var r=t.concat(e[n].split(""));w[n]=r;for(var i=0;i<r.length;i++){var o=r[i];void 0===_[o]&&(_[o]=i)}}}}var E="undefined"!=typeof Uint8Array,I=!v&&"function"==typeof btoa;function T(t){if(!I){var e;void 0===e&&(e=0),A(),e=w[e];var n=Array(Math.floor(t.length/3)),r=e[64]||"";let u=0,c=0;for(;u<t.length-2;u+=3){var i=t[u],o=t[u+1],s=t[u+2],a=e[i>>2];i=e[(3&i)<<4|o>>4],o=e[(15&o)<<2|s>>6],s=e[63&s],n[c++]=a+i+o+s}switch(a=0,s=r,t.length-u){case 2:s=e[(15&(a=t[u+1]))<<2]||r;case 1:t=t[u],n[c]=e[t>>2]+e[(3&t)<<4|a>>4]+s+r}return n.join("")}for(e="",n=0,r=t.length-10240;n<r;)e+=String.fromCharCode.apply(null,t.subarray(n,n+=10240));return e+=String.fromCharCode.apply(null,n?t.subarray(n):t),btoa(e)}const x=/[-_.]/g,P={"-":"+",_:"/",".":"="};function U(t){return P[t]||""}function O(t){if(!I)return S(t);x.test(t)&&(t=t.replace(x,U)),t=atob(t);const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}function B(t){return E&&null!=t&&t instanceof Uint8Array}var L={};let F;function N(t){if(t!==L)throw Error("illegal external caller")}function j(){return F||=new k(null,L)}function V(t){N(L);var e=t.g;return null==(e=null==e||B(e)?e:"string"==typeof e?O(e):null)?e:t.g=e}var k=class{constructor(t,e){if(N(e),this.g=t,null!=t&&0===t.length)throw Error("ByteString should be constructed with non-empty values")}i(){return new Uint8Array(V(this)||0)}};function M(t,e){t.__closure__error__context__984382||(t.__closure__error__context__984382={}),t.__closure__error__context__984382.severity=e}let C;function G(){const e=Error();M(e,"incident"),function(e){t.setTimeout((()=>{throw e}),0)}(e)}function D(){const t=Error("int32");return M(t,"warning"),t}function z(){return"function"==typeof BigInt}function $(t){return Array.prototype.slice.call(t)}var W="function"==typeof Symbol&&"symbol"==typeof Symbol();function R(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol()?Symbol():t}var H=R(),q=R("2ex"),J=R("1oa"),K=R("0dg"),X=W?(t,e)=>{t[H]|=e}:(t,e)=>{void 0!==t.g?t.g|=e:Object.defineProperties(t,{g:{value:e,configurable:!0,writable:!0,enumerable:!1}})},Y=W?(t,e)=>{t[H]&=~e}:(t,e)=>{void 0!==t.g&&(t.g&=~e)},Q=W?t=>0|t[H]:t=>0|t.g,Z=W?t=>t[H]:t=>t.g,tt=W?(t,e)=>{t[H]=e}:(t,e)=>{void 0!==t.g?t.g=e:Object.defineProperties(t,{g:{value:e,configurable:!0,writable:!0,enumerable:!1}})};function et(t,e){tt(e,-14591&(0|t))}function nt(t,e){tt(e,-14557&(34|t))}var rt,it={},ot={};function st(t){return!(!t||"object"!=typeof t||t.g!==ot)}function at(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)&&t.constructor===Object}function ut(t,e,n){if(null!=t)if("string"==typeof t)t=t?new k(t,L):j();else if(t.constructor!==k)if(B(t))t=t.length?new k(n?t:new Uint8Array(t),L):j();else{if(!e)throw Error();t=void 0}return t}function ct(t){return!(!Array.isArray(t)||t.length)&&!!(1&Q(t))}const lt=[];function ht(t){if(2&t)throw Error()}let ft,dt;function gt(t,e){(e=ft?e[ft]:void 0)&&(t[ft]=$(e))}tt(lt,55),rt=Object.freeze(lt);var pt=Object.freeze({});Object.freeze({});var mt=Object.freeze({});const yt="function"==typeof Uint8Array.prototype.slice;let bt,vt=0,wt=0;function _t(t){const e=t>>>0;vt=e,wt=(t-e)/4294967296>>>0}function St(t){if(t<0){_t(-t);const[e,n]=Ut(vt,wt);vt=e>>>0,wt=n>>>0}else _t(t)}function At(t){const e=bt||=new DataView(new ArrayBuffer(8));e.setFloat32(0,+t,!0),wt=0,vt=e.getUint32(0,!0)}function Et(t,e){return 4294967296*e+(t>>>0)}function It(t,e){const n=2147483648&e;return n&&(e=~e>>>0,0==(t=1+~t>>>0)&&(e=e+1>>>0)),t=Et(t,e),n?-t:t}function Tt(t,e){if(t>>>=0,(e>>>=0)<=2097151)var n=""+(4294967296*e+t);else z()?n=""+(BigInt(e)<<BigInt(32)|BigInt(t)):(t=(16777215&t)+6777216*(n=16777215&(t>>>24|e<<8))+6710656*(e=e>>16&65535),n+=8147497*e,e*=2,t>=1e7&&(n+=t/1e7>>>0,t%=1e7),n>=1e7&&(e+=n/1e7>>>0,n%=1e7),n=e+xt(n)+xt(t));return n}function xt(t){return t=String(t),"0000000".slice(t.length)+t}function Pt(t){if(t.length<16)St(Number(t));else if(z())t=BigInt(t),vt=Number(t&BigInt(4294967295))>>>0,wt=Number(t>>BigInt(32)&BigInt(4294967295));else{const e=+("-"===t[0]);wt=vt=0;const n=t.length;for(let r=e,i=(n-e)%6+e;i<=n;r=i,i+=6){const e=Number(t.slice(r,i));wt*=1e6,vt=1e6*vt+e,vt>=4294967296&&(wt+=Math.trunc(vt/4294967296),wt>>>=0,vt>>>=0)}if(e){const[t,e]=Ut(vt,wt);vt=t,wt=e}}}function Ut(t,e){return e=~e,t?t=1+~t:e+=1,[t,e]}var Ot="function"==typeof t.BigInt&&"bigint"==typeof t.BigInt(0),Bt=t=>Ot?t>=Ft&&t<=jt:"-"===t[0]?Vt(t,Lt):Vt(t,Nt);const Lt=Number.MIN_SAFE_INTEGER.toString(),Ft=Ot?BigInt(Number.MIN_SAFE_INTEGER):void 0,Nt=Number.MAX_SAFE_INTEGER.toString(),jt=Ot?BigInt(Number.MAX_SAFE_INTEGER):void 0;function Vt(t,e){if(t.length>e.length)return!1;if(t.length<e.length||t===e)return!0;for(let n=0;n<t.length;n++){const r=t[n],i=e[n];if(r>i)return!1;if(r<i)return!0}}function kt(t){return null==t||"number"==typeof t?t:"NaN"===t||"Infinity"===t||"-Infinity"===t?Number(t):void 0}function Mt(t){if(null!=t&&"boolean"!=typeof t){var e=typeof t;throw Error(`Expected boolean but got ${"object"!=e?e:t?Array.isArray(t)?"array":e:"null"}: ${t}`)}return t}const Ct=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Gt(t){const e=typeof t;switch(e){case"bigint":return!0;case"number":return Number.isFinite(t)}return"string"===e&&Ct.test(t)}function Dt(t){if(null==t)return t;if("string"==typeof t){if(!t)return;t=+t}return"number"==typeof t&&Number.isFinite(t)?0|t:void 0}function zt(t){return"-"!==t[0]&&(t.length<20||20===t.length&&Number(t.substring(0,6))<184467)}function $t(t){return t=Math.trunc(t),Number.isSafeInteger(t)||(St(t),t=It(vt,wt)),t}function Wt(t){var e=Math.trunc(Number(t));if(Number.isSafeInteger(e))return String(e);if(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),!("-"===t[0]?t.length<20||20===t.length&&Number(t.substring(0,7))>-922337:t.length<19||19===t.length&&Number(t.substring(0,6))<922337))if(Pt(t),t=vt,2147483648&(e=wt))if(z())t=""+(BigInt(0|e)<<BigInt(32)|BigInt(t>>>0));else{const[n,r]=Ut(t,e);t="-"+Tt(n,r)}else t=Tt(t,e);return t}function Rt(t){return null==t?t:"bigint"==typeof t?(Bt(t)?t=Number(t):(t=BigInt.asIntN(64,t),t=Bt(t)?Number(t):String(t)),t):Gt(t)?"number"==typeof t?$t(t):Wt(t):void 0}function Ht(t){if(null==t)return t;var e=typeof t;if("bigint"===e)return String(BigInt.asUintN(64,t));if(Gt(t)){if("string"===e)return e=Math.trunc(Number(t)),Number.isSafeInteger(e)&&e>=0?t=String(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),zt(t)||(Pt(t),t=Tt(vt,wt))),t;if("number"===e)return(t=Math.trunc(t))>=0&&Number.isSafeInteger(t)?t:function(t){if(t<0){St(t);const e=Tt(vt,wt);return t=Number(e),Number.isSafeInteger(t)?t:e}return zt(String(t))?t:(St(t),Et(vt,wt))}(t)}}function qt(t){if("string"!=typeof t)throw Error();return t}function Jt(t){if(null!=t&&"string"!=typeof t)throw Error();return t}function Kt(t){return null==t||"string"==typeof t?t:void 0}function Xt(t,e,n){if(null!=t&&"object"==typeof t&&t.D===it)return t;if(Array.isArray(t)){var r=Q(t),i=r;return 0===i&&(i|=32&n),(i|=2&n)!==r&&tt(t,i),new e(t)}}function Yt(t){var e=Qt?.get(t);if(e)return e;if(Math.random()>.01)return t;if(void 0===te)if("function"!=typeof Proxy)te=null;else try{te=-1!==Proxy.toString().indexOf("[native code]")?Proxy:null}catch{te=null}return(e=te)?(function(t,e){(Qt||=new WeakMap).set(t,e),(Zt||=new WeakMap).set(e,t)}(t,e=new e(t,{set:(t,e,n)=>(G(),t[e]=n,!0)})),e):t}let Qt,Zt,te,ee,ne,re;function ie(t){switch(typeof t){case"boolean":return ne||=[0,void 0,!0];case"number":return t>0?void 0:0===t?re||=[0,void 0]:[-t,void 0];case"string":return[0,t];case"object":return t}}function oe(t,e,n){if(null==t&&(t=ee),ee=void 0,null==t){var r=96;n?(t=[n],r|=512):t=[],e&&(r=-16760833&r|(1023&e)<<14)}else{if(!Array.isArray(t))throw Error("narr");if(2048&(r=Q(t)))throw Error("farr");if(64&r)return t;if(r|=64,n&&(r|=512,n!==t[0]))throw Error("mid");t:{const i=(n=t).length;if(i){const t=i-1;if(at(n[t])){if((e=t-(+!!(512&(r|=256))-1))>=1024)throw Error("pvtlmt");r=-16760833&r|(1023&e)<<14;break t}}if(e){if((e=Math.max(e,i-(+!!(512&r)-1)))>1024)throw Error("spvt");r=-16760833&r|(1023&e)<<14}}}return tt(t,r),t}function se(t,e,n,r,i){if(null!=t){if(Array.isArray(t))t=ct(t)?void 0:i&&2&Q(t)?t:ae(t,e,n,void 0!==r,i);else if(at(t)){const o={};for(let s in t)o[s]=se(t[s],e,n,r,i);t=o}else t=e(t,r);return t}}function ae(t,e,n,r,i){const o=r||n?Q(t):0;r=r?!!(32&o):void 0;const s=$(t);for(let t=0;t<s.length;t++)s[t]=se(s[t],e,n,r,i);return n&&(gt(s,t),n(o,s)),s}function ue(t){return t.D===it?t.toJSON():function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"bigint":return Bt(t)?Number(t):String(t);case"boolean":return t?1:0;case"object":if(t)if(Array.isArray(t)){if(ct(t))return}else{if(B(t))return T(t);if(t instanceof k){const e=t.g;return null==e?"":"string"==typeof e?e:t.g=T(e)}}}return t}(t)}function ce(t,e,n=nt){if(null!=t){if(E&&t instanceof Uint8Array)return e?t:new Uint8Array(t);if(Array.isArray(t)){var r=Q(t);return 2&r?t:(e&&=0===r||!!(32&r)&&!(64&r||!(16&r)),e?(tt(t,-12293&(34|r)),t):ae(t,ce,4&r?nt:n,!0,!0))}return t.D===it&&(n=t.l,t=2&(r=Z(n))?t:he(t,n,r,!0)),t}}function le(t){const e=t.l;return he(t,e,Z(e),!1)}function he(t,e,n,r){return t=t.constructor,ee=e=fe(e,n,r),e=new t(e),ee=void 0,e}function fe(t,e,n){const r=n||2&e?nt:et,i=!!(32&e);return t=function(t,e,n){const r=$(t);var i=r.length;const o=256&e?r[i-1]:void 0;for(i+=o?-1:0,e=512&e?1:0;e<i;e++)r[e]=n(r[e]);if(o){e=r[e]={};for(const t in o)e[t]=n(o[t])}return gt(r,t),r}(t,e,(t=>ce(t,i,r))),X(t,32|(n?2:0)),t}function de(t){const e=t.l,n=Z(e);return 2&n?he(t,e,n,!1):t}function ge(t,e,n,r){return!(4&e)||null!=n&&(!r&&0===n&&(4096&e||8192&e)&&(t.constructor[K]=1+(0|t.constructor[K]))<5&&G(),0!==n&&!(n&e))}function pe(t,e){return ye(t=t.l,Z(t),e)}function me(t,e,n,r){if(!((e=r+(+!!(512&e)-1))<0||e>=t.length||e>=n))return t[e]}function ye(t,e,n,r){if(-1===n)return null;const i=e>>14&1023||536870912;if(!(n>=i)){var o=t.length;return r&&256&e&&null!=(r=t[o-1][n])?(me(t,e,i,n)&&null!=q&&((e=(t=C??={})[q]||0)>=4||(t[q]=e+1,G())),r):me(t,e,i,n)}return 256&e?t[t.length-1][n]:void 0}function be(t,e,n,r){const i=t.l;let o=Z(i);return ht(o),ve(i,o,e,n,r),t}function ve(t,e,n,r,i){const o=e>>14&1023||536870912;if(n>=o||i&&!f){let s=e;if(256&e)i=t[t.length-1];else{if(null==r)return s;i=t[o+(+!!(512&e)-1)]={},s|=256}return i[n]=r,n<o&&(t[n+(+!!(512&e)-1)]=void 0),s!==e&&tt(t,s),s}return t[n+(+!!(512&e)-1)]=r,256&e&&(n in(t=t[t.length-1])&&delete t[n]),e}function we(t,e,n,r,i){var o=2&e;let s=ye(t,e,n,i);Array.isArray(s)||(s=rt);const a=!(2&r);r=!(1&r);const u=!!(32&e);let c=Q(s);return 0!==c||!u||o||a?1&c||(c|=1,tt(s,c)):(c|=33,tt(s,c)),o?(t=!1,2&c||(X(s,34),t=!!(4&c)),(r||t)&&Object.freeze(s)):(o=!!(2&c)||!!(2048&c),r&&o?(s=$(s),r=1,u&&!a&&(r|=32),tt(s,r),ve(t,e,n,s,i)):a&&32&c&&!o&&Y(s,32)),s}function _e(t){t=t.l;let e=Z(t);const n=ye(t,e,1),r=ut(n,!0,!!(34&e));return null!=r&&r!==n&&ve(t,e,1,r),r}function Se(t,e){return t=ye(t,e,1),Array.isArray(t)?t:rt}function Ae(t,e){return 0===t&&(t=Ce(t,e)),1|t}function Ee(t){return!!(2&t)&&!!(4&t)||!!(2048&t)}function Ie(t,e){t=t.l;let n=Z(t);ht(n),ve(t,n,2,""===e?void 0:e)}function Te(t,e,n,r){const i=Z(t);ht(i),t=we(t,i,e,2),r=n(r,(4&(e=Q(t))?4096&e?4096:8192&e?8192:0:void 0)??0),t.push(r)}function xe(t){return t}function Pe(t,e){var n=hi;return Be(Ue(t=t.l),t,Z(t),n)===e?e:-1}function Ue(t){if(W)return t[J]??(t[J]=new Map);if(J in t)return t[J];const e=new Map;return Object.defineProperty(t,J,{value:e}),e}function Oe(t,e,n,r){const i=Ue(t),o=Be(i,t,e,n);return o!==r&&(o&&(e=ve(t,e,o)),i.set(n,r)),e}function Be(t,e,n,r){let i=t.get(r);if(null!=i)return i;i=0;for(let t=0;t<r.length;t++){const o=r[t];null!=ye(e,n,o)&&(0!==i&&(n=ve(e,n,i)),i=o)}return t.set(r,i),i}function Le(t,e,n,r){let i=Z(t);const o=ye(t,i,n,r);let s;if(null!=o&&o.D===it)return(e=de(o))!==o&&ve(t,i,n,e,r),e.l;if(Array.isArray(o)){const t=Q(o);s=2&t?fe(o,t,!1):o,s=oe(s,e[0],e[1])}else s=oe(void 0,e[0],e[1]);return s!==o&&ve(t,i,n,s,r),s}function Fe(t,e,n,r){t=t.l;let i=Z(t);const o=ye(t,i,n,r);return(e=Xt(o,e,i))!==o&&null!=e&&ve(t,i,n,e,r),e}function Ne(t,e,n){if(null==(e=Fe(t,e,n,!1)))return e;t=t.l;let r=Z(t);if(!(2&r)){const i=de(e);i!==e&&ve(t,r,n,e=i,!1)}return e}function je(t,e,n,r,i,o){var s=!!(2&e);r=s?1:r,i=!!i,o&&=!s,s=Se(t,e);var a=Q(s),u=!!(4&a);if(!u){var c=s,l=e;const t=!!(2&(a=Ae(a,e)));t&&(l|=2);let r=!t,i=!0,o=0,u=0;for(;o<c.length;o++){const e=Xt(c[o],n,l);if(e instanceof n){if(!t){const t=!!(2&Q(e.l));r&&=!t,i&&=t}c[u++]=e}}u<o&&(c.length=u),a|=4,a=i?16|a:-17&a,tt(c,a=r?8|a:-9&a),t&&Object.freeze(c)}if(o&&!(8&a||!s.length&&(1===r||4===r&&32&a))){for(Ee(a)&&(s=$(s),a=Ce(a,e),e=ve(t,e,1,s)),n=s,o=a,c=0;c<n.length;c++)(a=n[c])!==(l=de(a))&&(n[c]=l);o|=8,o=n.length?-17&o:16|o,tt(n,o),a=o}let h;return 1===r||4===r&&32&a?Ee(a)||(e=a,(a|=!s.length||16&a&&(!u||32&a)?2:2048)!==e&&tt(s,a),Object.freeze(s)):(u=5===r&&(!!(32&a)||Ee(a)||!!Qt?.get(s)),(2===r||u)&&Ee(a)&&(s=$(s),a=Ge(a=Ce(a,e),e,i),tt(s,a),e=ve(t,e,1,s)),Ee(a)||(t=a,(a=Ge(a,e,i))!==t&&tt(s,a)),u&&(h=Yt(s))),h||s}function Ve(t,e){t=t.l;const n=Z(t);return je(t,n,e,void 0===pt?2:5,!1,!(2&n))}function ke(t,e,n,r,i){return null==r&&(r=void 0),be(t,n,r,i)}function Me(t,e,n){var r=yi;null==n&&(n=void 0);t:{t=t.l;let i=Z(t);if(ht(i),null==n){const n=Ue(t);if(Be(n,t,i,r)!==e)break t;n.set(r,0)}else i=Oe(t,i,r,e);ve(t,i,e,n)}}function Ce(t,e){return-2049&(t=32|(2&e?2|t:-3&t))}function Ge(t,e,n){return 32&e&&n||(t&=-33),t}function De(t,e){var n=Yr;t=t.l;const r=Z(t);ht(r),t=je(t,r,n,2,!0),e=null!=e?e:new n,t.push(e),2&Q(e.l)?Y(t,8):Y(t,16)}function ze(t,e){return t??e}function $e(t,e,n){{const a=t.l;let u=Z(a);if(ht(u),null==n)ve(a,u,e);else{n=Zt?.get(n)||n;var r,i=Q(n),o=i,s=!!(2&i)||Object.isFrozen(n);if((r=!s)&&(r=void 0===mt||!1),ge(t,i))for(i=21,s&&(n=$(n),o=0,i=Ge(i=Ce(i,u),u,!0)),t=0;t<n.length;t++)n[t]=qt(n[t]);r&&(n=$(n),o=0,i=Ge(i=Ce(i,u),u,!0)),i!==o&&tt(n,i),ve(a,u,e,n)}}}function We(t,e,n){Te(t.l,e,qt,n)}function Re(t,e){return Error(`Invalid wire type: ${t} (at position ${e})`)}function He(){return Error("Failed to read varint, encoding is invalid.")}function qe(t,e){return Error(`Tried to read past the end of the data ${e} > ${t}`)}function Je(t){if("string"==typeof t)return{buffer:O(t),v:!1};if(Array.isArray(t))return{buffer:new Uint8Array(t),v:!1};if(t.constructor===Uint8Array)return{buffer:t,v:!1};if(t.constructor===ArrayBuffer)return{buffer:new Uint8Array(t),v:!1};if(t.constructor===k)return{buffer:V(t)||new Uint8Array(0),v:!0};if(t instanceof Uint8Array)return{buffer:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),v:!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 Ke(t,e){let n,r=0,i=0,o=0;const s=t.i;let a=t.g;do{n=s[a++],r|=(127&n)<<o,o+=7}while(o<32&&128&n);for(o>32&&(i|=(127&n)>>4),o=3;o<32&&128&n;o+=7)n=s[a++],i|=(127&n)<<o;if(en(t,a),n<128)return e(r>>>0,i>>>0);throw He()}function Xe(t){let e=0,n=t.g;const r=n+10,i=t.i;for(;n<r;){const r=i[n++];if(e|=r,0==(128&r))return en(t,n),!!(127&e)}throw He()}function Ye(t){const e=t.i;let n=t.g,r=e[n++],i=127&r;if(128&r&&(r=e[n++],i|=(127&r)<<7,128&r&&(r=e[n++],i|=(127&r)<<14,128&r&&(r=e[n++],i|=(127&r)<<21,128&r&&(r=e[n++],i|=r<<28,128&r&&128&e[n++]&&128&e[n++]&&128&e[n++]&&128&e[n++]&&128&e[n++])))))throw He();return en(t,n),i}function Qe(t){var e=t.i;const n=t.g;var r=e[n],i=e[n+1];const o=e[n+2];return e=e[n+3],en(t,t.g+4),t=2*((i=(r<<0|i<<8|o<<16|e<<24)>>>0)>>31)+1,r=i>>>23&255,i&=8388607,255==r?i?NaN:t*(1/0):0==r?t*Math.pow(2,-149)*i:t*Math.pow(2,r-150)*(i+Math.pow(2,23))}function Ze(t){return Ye(t)}function tn(t,e,{F:n=!1}={}){t.F=n,e&&(e=Je(e),t.i=e.buffer,t.m=e.v,t.s=0,t.j=t.i.length,t.g=t.s)}function en(t,e){if(t.g=e,e>t.j)throw qe(t.j,e)}function nn(t,e){if(e<0)throw Error(`Tried to read a negative byte length: ${e}`);const n=t.g,r=n+e;if(r>t.j)throw qe(e,t.j-n);return t.g=r,n}function rn(t,e){if(0==e)return j();var n=nn(t,e);return t.F&&t.m?n=t.i.subarray(n,n+e):(t=t.i,n=n===(e=n+e)?new Uint8Array(0):yt?t.slice(n,e):new Uint8Array(t.subarray(n,e))),0==n.length?j():new k(n,L)}var on=[];function sn(t){var e=t.g;if(e.g==e.j)return!1;t.j=t.g.g;var n=Ye(t.g)>>>0;if(e=n>>>3,!((n&=7)>=0&&n<=5))throw Re(n,t.j);if(e<1)throw Error(`Invalid field number: ${e} (at position ${t.j})`);return t.m=e,t.i=n,!0}function an(t){switch(t.i){case 0:0!=t.i?an(t):Xe(t.g);break;case 1:en(t=t.g,t.g+8);break;case 2:if(2!=t.i)an(t);else{var e=Ye(t.g)>>>0;en(t=t.g,t.g+e)}break;case 5:en(t=t.g,t.g+4);break;case 3:for(e=t.m;;){if(!sn(t))throw Error("Unmatched start-group tag: stream EOF");if(4==t.i){if(t.m!=e)throw Error("Unmatched end-group tag");break}an(t)}break;default:throw Re(t.i,t.j)}}function un(t,e,n){const r=t.g.j,i=Ye(t.g)>>>0,o=t.g.g+i;let s=o-r;if(s<=0&&(t.g.j=o,n(e,t,void 0,void 0,void 0),s=o-t.g.g),s)throw Error(`Message parsing ended unexpectedly. Expected to read ${i} bytes, instead read ${i-s} bytes, either the data ended unexpectedly or the message misreported its own length`);t.g.g=o,t.g.j=r}function cn(t){var e=Ye(t.g)>>>0,a=nn(t=t.g,e);if(t=t.i,s){var u,c=t;(u=o)||(u=o=new TextDecoder("utf-8",{fatal:!0})),e=a+e,c=0===a&&e===c.length?c:c.subarray(a,e);try{var l=u.decode(c)}catch(t){if(void 0===i){try{u.decode(new Uint8Array([128]))}catch(t){}try{u.decode(new Uint8Array([97])),i=!0}catch(t){i=!1}}throw!i&&(o=void 0),t}}else{e=(l=a)+e,a=[];let i,o=null;for(;l<e;){var h=t[l++];h<128?a.push(h):h<224?l>=e?n():(i=t[l++],h<194||128!=(192&i)?(l--,n()):a.push((31&h)<<6|63&i)):h<240?l>=e-1?n():(i=t[l++],128!=(192&i)||224===h&&i<160||237===h&&i>=160||128!=(192&(u=t[l++]))?(l--,n()):a.push((15&h)<<12|(63&i)<<6|63&u)):h<=244?l>=e-2?n():(i=t[l++],128!=(192&i)||i-144+(h<<28)>>30!=0||128!=(192&(u=t[l++]))||128!=(192&(c=t[l++]))?(l--,n()):(h=(7&h)<<18|(63&i)<<12|(63&u)<<6|63&c,h-=65536,a.push(55296+(h>>10&1023),56320+(1023&h)))):n(),a.length>=8192&&(o=r(o,a),a.length=0)}l=r(o,a)}return l}function ln(t){const e=Ye(t.g)>>>0;return rn(t.g,e)}function hn(t,e,n){var r=Ye(t.g)>>>0;for(r=t.g.g+r;t.g.g<r;)n.push(e(t.g))}var fn=[];let dn;function gn(t,e,n){e.g?e.j(t,e.g,e.i,n,!0):e.j(t,e.i,n,!0)}var pn=class{constructor(t,e){this.l=oe(t,e)}toJSON(){return mn(this)}v(){return!!(2&Q(this.l))}};function mn(t){t=dn?t.l:ae(t.l,ue,void 0,void 0,!1);{var e=!dn;let c=t.length;if(c){var n=t[c-1],r=at(n);r?c--:n=void 0;var i=t;if(r){t:{var o=n,s={};if(r=!1,o)for(var a in o){if(isNaN(+a)){s[a]=o[a];continue}let t=o[a];Array.isArray(t)&&(ct(t)||st(t)&&0===t.size)&&(t=null),null==t&&(r=!0),null!=t&&(s[a]=t)}if(r){for(let t in s)break t;s=null}else s=o}o=null==s?null!=n:s!==n}for(;c>0&&(null==(a=i[c-1])||ct(a)||st(a)&&0===a.size);c--)var u=!0;(i!==t||o||u)&&(e?(u||o||s)&&(i.length=c):i=Array.prototype.slice.call(i,0,c),s&&i.push(s)),u=i}else u=t}return u}function yn(t){return t?/^\d+$/.test(t)?(Pt(t),new bn(vt,wt)):null:vn||=new bn(0,0)}pn.prototype.D=it,pn.prototype.toString=function(){try{return dn=!0,mn(this).toString()}finally{dn=!1}};var bn=class{constructor(t,e){this.i=t>>>0,this.g=e>>>0}};let vn;function wn(t){return t?/^-?\d+$/.test(t)?(Pt(t),new _n(vt,wt)):null:Sn||=new _n(0,0)}var _n=class{constructor(t,e){this.i=t>>>0,this.g=e>>>0}};let Sn;function An(t,e,n){for(;n>0||e>127;)t.g.push(127&e|128),e=(e>>>7|n<<25)>>>0,n>>>=7;t.g.push(e)}function En(t,e){for(;e>127;)t.g.push(127&e|128),e>>>=7;t.g.push(e)}function In(t,e){if(e>=0)En(t,e);else{for(let n=0;n<9;n++)t.g.push(127&e|128),e>>=7;t.g.push(1)}}function Tn(t){var e=vt;t.g.push(e>>>0&255),t.g.push(e>>>8&255),t.g.push(e>>>16&255),t.g.push(e>>>24&255)}function xn(t,e){0!==e.length&&(t.j.push(e),t.i+=e.length)}function Pn(t,e,n){En(t.g,8*e+n)}function Un(t,e){return Pn(t,e,2),e=t.g.end(),xn(t,e),e.push(t.i),e}function On(t,e){var n=e.pop();for(n=t.i+t.g.length()-n;n>127;)e.push(127&n|128),n>>>=7,t.i++;e.push(n),t.i++}function Bn(t,e,n){Pn(t,e,2),En(t.g,n.length),xn(t,t.g.end()),xn(t,n)}class Ln{constructor(t,e,n,r){this.g=t,this.i=e,this.j=n,this.H=r}}function Fn(t){return Array.isArray(t)?t[0]instanceof Ln?t:[Or,t]:[t,void 0]}function Nn(t,e){if(Array.isArray(e)){var n=Q(e);if(4&n)return e;for(var r=0,i=0;r<e.length;r++){const n=t(e[r]);null!=n&&(e[i++]=n)}return i<r&&(e.length=i),tt(e,-12289&(5|n)),2&n&&Object.freeze(e),e}}const jn=Symbol();function Vn(t){let e=t[jn];if(!e){const n=Wn(t),r=nr(t),i=r.j;e=i?(t,e)=>i(t,e,r):(t,e)=>{for(;sn(e)&&4!=e.i;){var i=e.m;let n=r[i];const a=!n;let u=!1;if(!n){var o=r.C;if(o){var s=o[i];s&&(u=o.A?.[i],(!d||u)&&(o=kn(s))&&(n=r[i]=o))}}n&&n(e,t,i)||(i=(o=e).j,an(o),o.G?o=void 0:(s=o.g.g-i,o.g.g=i,o=rn(o.g,s)),i=t,o&&(ft||=Symbol(),(s=i[ft])?s.push(o):i[ft]=[o])),a&&n&&!u&&cr++<5&&G()}n===Cn||n===Gn||n.s||(t[dt||=Symbol()]=n)},t[jn]=e}return e}function kn(t){const e=(t=Fn(t))[0].g;if(t=t[1]){const n=Vn(t),r=nr(t).B;return(t,i,o)=>e(t,i,o,r,n)}return e}class Mn{}let Cn,Gn;const Dn=Symbol();function zn(t,e,n){const r=n[1];let i;if(r){const n=r[Dn];i=n?n.B:ie(r[0]),t[e]=n??r}i&&i===ne?(t.g||(t.g=new Set)).add(e):n[0]&&(t.i||(t.i=new Set)).add(e)}function $n(t,e){return[t.j,!e||e[0]>0?void 0:e]}function Wn(t){var e=t[Dn];if(e)return e;if(!(e=Hn(t,t[Dn]=new Mn,$n,$n,zn)).C&&!e.i&&!e.g){let n=!0;for(let t in e)isNaN(t)||(n=!1);n?(ie(t[0])===ne?Gn?e=Gn:((e=new Mn).B=ie(!0),e=Gn=e):e=Cn||=new Mn,e=t[Dn]=e):e.s=!0}return e}function Rn(t,e,n){t[e]=n}function Hn(t,e,n,r,i=Rn){e.B=ie(t[0]);let o=0;var s=t[++o];s&&s.constructor===Object&&(e.C=s,"function"==typeof(s=t[++o])&&(e.j=s,e.m=t[++o],s=t[++o]));const a={};for(;Array.isArray(s)&&"number"==typeof s[0]&&s[0]>0;){for(var u=0;u<s.length;u++)a[s[u]]=s;s=t[++o]}for(u=1;void 0!==s;){let h;"number"==typeof s&&(u+=s,s=t[++o]);var c=void 0;if(s instanceof Ln?h=s:(h=Br,o--),h.H){s=t[++o],c=t;var l=o;"function"==typeof s&&(s=s(),c[l]=s),c=s}for(l=u+1,"number"==typeof(s=t[++o])&&s<0&&(l-=s,s=t[++o]);u<l;u++){const t=a[u];i(e,u,c?r(h,c,t):n(h,t))}}return e}const qn=Symbol();function Jn(t){let e=t[qn];if(!e){const n=Qn(t);e=(t,e)=>or(t,e,n),t[qn]=e}return e}const Kn=Symbol();function Xn(t){return t.i}function Yn(t,e){let n,r;const i=t.i;return(t,o,s)=>i(t,o,s,r||=Qn(e).B,n||=Jn(e))}function Qn(t){let e=t[Kn];return e||(e=Hn(t,t[Kn]={},Xn,Yn),rr(t),e)}const Zn=Symbol();function tr(t,e){const n=t.g;return e?(t,r,i)=>n(t,r,i,e):n}function er(t,e,n){const r=t.g;let i,o;return(t,s,a)=>r(t,s,a,o||=nr(e).B,i||=Vn(e),n)}function nr(t){let e=t[Zn];return e||(Wn(t),e=Hn(t,t[Zn]={},tr,er),rr(t),e)}function rr(t){Zn in t&&Dn in t&&Kn in t&&(t.length=0)}function ir(t,e){var n=t[e];if(n)return n;if(n=t.C){var r=n[e];if(r){var i=(r=Fn(r))[0].i;if(r=r[1],n=n.A?.[e],!d||n){if(r){const e=Jn(r),o=Qn(r).B;n=(n=t.m)?n(o,e):(t,n,r)=>i(t,n,r,o,e)}else n=i;return t[e]=n}}}}function or(t,e,n){for(var r=Z(t),i=+!!(512&r)-1,o=t.length,s=512&r?1:0,a=o+(256&r?-1:0);s<a;s++){const r=t[s];if(null==r)continue;const o=s-i,a=ir(n,o);if(!a)continue;const u=n.C;u?.[o]&&!u?.A?.[o]&&cr++<5&&G(),a(e,r,o)}if(256&r){r=t[o-1];for(let t in r)i=+t,!Number.isNaN(i)&&(null!=(o=r[t])&&(a=ir(n,i)))&&((s=n.C)?.[i]&&!s?.A?.[i]&&cr++<5&&G(),a(e,o,i))}if(t=ft?t[ft]:void 0)for(xn(e,e.g.end()),n=0;n<t.length;n++)xn(e,V(t[n])||new Uint8Array(0))}function sr(t,e){return new Ln(t,e,!1,!1)}function ar(t,e){return new Ln(t,e,!0,!1)}function ur(t,e,n){ve(t,Z(t),e,n)}let cr=0;function lr(t,e,n){e=function(t){if(null==t)return t;const e=typeof t;if("bigint"===e)return String(BigInt.asIntN(64,t));if(Gt(t)){if("string"===e)return Wt(t);if("number"===e)return $t(t)}}(e),null!=e&&("string"==typeof e&&wn(e),null!=e&&(Pn(t,n,0),"number"==typeof e?(t=t.g,St(e),An(t,vt,wt)):(n=wn(e),An(t.g,n.i,n.g))))}function hr(t,e,n){null!=(e=Dt(e))&&null!=e&&(Pn(t,n,0),In(t.g,e))}function fr(t,e,n){null!=(e=null==e||"boolean"==typeof e?e:"number"==typeof e?!!e:void 0)&&(Pn(t,n,0),t.g.g.push(e?1:0))}function dr(t,e,n){null!=(e=Kt(e))&&Bn(t,n,c(e))}function gr(t,e,n,r,i){null!=(e=e instanceof pn?e.l:Array.isArray(e)?oe(e,r[0],r[1]):void 0)&&(n=Un(t,n),i(e,t),On(t,n))}function pr(t,e,n){null!=(e=null==e||"string"==typeof e||B(e)||e instanceof k?e:void 0)&&Bn(t,n,Je(e).buffer)}var mr,yr=sr((function(t,e,n){return 5===t.i&&(ur(e,n,Qe(t.g)),!0)}),(function(t,e,n){null!=(e=kt(e))&&(Pn(t,n,5),t=t.g,At(e),Tn(t))})),br=ar((function(t,e,n){return(5===t.i||2===t.i)&&(e=we(e,Z(e),n,2,!1),2==t.i?hn(t,Qe,e):e.push(Qe(t.g)),!0)}),(function(t,e,n){if(null!=(e=Nn(kt,e))&&e.length){Pn(t,n,2),En(t.g,4*e.length);for(let r=0;r<e.length;r++)n=t.g,At(e[r]),Tn(n)}})),vr=sr((function(t,e,n){return 0===t.i&&(ur(e,n,Ke(t.g,It)),!0)}),lr),wr=sr((function(t,e,n){return 0===t.i&&(ur(e,n,0===(t=Ke(t.g,It))?void 0:t),!0)}),lr),_r=sr((function(t,e,n){return 0===t.i&&(ur(e,n,Ke(t.g,Et)),!0)}),(function(t,e,n){null!=(e=Ht(e))&&("string"==typeof e&&yn(e),null!=e&&(Pn(t,n,0),"number"==typeof e?(t=t.g,St(e),An(t,vt,wt)):(n=yn(e),An(t.g,n.i,n.g))))})),Sr=sr((function(t,e,n){return 0===t.i&&(ur(e,n,Ye(t.g)),!0)}),hr),Ar=ar((function(t,e,n){return(0===t.i||2===t.i)&&(e=we(e,Z(e),n,2,!1),2==t.i?hn(t,Ye,e):e.push(Ye(t.g)),!0)}),(function(t,e,n){if(null!=(e=Nn(Dt,e))&&e.length){n=Un(t,n);for(let n=0;n<e.length;n++)In(t.g,e[n]);On(t,n)}})),Er=sr((function(t,e,n){return 0===t.i&&(ur(e,n,0===(t=Ye(t.g))?void 0:t),!0)}),hr),Ir=sr((function(t,e,n){return 0===t.i&&(ur(e,n,Xe(t.g)),!0)}),fr),Tr=sr((function(t,e,n){return 0===t.i&&(ur(e,n,!1===(t=Xe(t.g))?void 0:t),!0)}),fr),xr=ar((function(t,e,n){return 2===t.i&&(Te(e,n,xe,t=cn(t)),!0)}),(function(t,e,n){if(null!=(e=Nn(Kt,e)))for(let s=0;s<e.length;s++){var r=t,i=n,o=e[s];null!=o&&Bn(r,i,c(o))}})),Pr=sr((function(t,e,n){return 2===t.i&&(ur(e,n,""===(t=cn(t))?void 0:t),!0)}),dr),Ur=sr((function(t,e,n){return 2===t.i&&(ur(e,n,cn(t)),!0)}),dr),Or=new Ln((function(t,e,n,r,i){return 2===t.i&&(un(t,Le(e,r,n,!0),i),!0)}),gr,!1,!0),Br=new Ln((function(t,e,n,r,i){return 2===t.i&&(un(t,Le(e,r,n),i),!0)}),gr,!1,!0);mr=new Ln((function(t,e,n,r,i){if(2!==t.i)return!1;r=oe(void 0,r[0],r[1]);let o=Z(e);ht(o);let s=we(e,o,n,3);return o=Z(e),4&Q(s)&&(s=$(s),tt(s,-2079&(1|Q(s))),ve(e,o,n,s)),s.push(r),un(t,r,i),!0}),(function(t,e,n,r,i){if(Array.isArray(e))for(let o=0;o<e.length;o++)gr(t,e[o],n,r,i)}),!0,!0);var Lr=new Ln((function(t,e,n,r,i,o){return 2===t.i&&(Oe(e,Z(e),o,n),un(t,e=Le(e,r,n),i),!0)}),gr,!1,!0),Fr=sr((function(t,e,n){return 2===t.i&&(ur(e,n,ln(t)),!0)}),pr),Nr=sr((function(t,e,n){return 0===t.i&&(ur(e,n,Ye(t.g)),!0)}),(function(t,e,n){null!=(e=Dt(e))&&(e=parseInt(e,10),Pn(t,n,0),In(t.g,e))}));class jr{constructor(t,e){this.i=t,this.g=e,this.j=ke,this.defaultValue=void 0}}function Vr(t,e){return(n,r)=>{if(fn.length){const t=fn.pop();t.o(r),tn(t.g,n,r),n=t}else n=new class{constructor(t,e){if(on.length){const n=on.pop();tn(n,t,e),t=n}else t=new class{constructor(t,e){this.i=null,this.m=!1,this.g=this.j=this.s=0,tn(this,t,e)}clear(){this.i=null,this.m=!1,this.g=this.j=this.s=0,this.F=!1}}(t,e);this.g=t,this.j=this.g.g,this.i=this.m=-1,this.o(e)}o({G:t=!1}={}){this.G=t}}(n,r);try{const r=new t,o=r.l;Vn(e)(o,n);var i=r}finally{n.g.clear(),n.m=-1,n.i=-1,fn.length<100&&fn.push(n)}return i}}var kr=[0,Pr,sr((function(t,e,n){return 2===t.i&&(ur(e,n,(t=ln(t))===j()?void 0:t),!0)}),(function(t,e,n){if(null!=e){if(e instanceof pn){const r=e.N;return void(r&&(e=r(e),null!=e&&Bn(t,n,Je(e).buffer)))}if(Array.isArray(e))return}pr(t,e,n)}))],Mr=[0,Sr,Nr,Ir,-1,Ar,Nr,-1],Cr=class extends pn{constructor(){super()}},Gr=[0,Ir,Ur,Ir,Nr,-1,ar((function(t,e,n){return(0===t.i||2===t.i)&&(e=we(e,Z(e),n,2,!1),2==t.i?hn(t,Ze,e):e.push(Ye(t.g)),!0)}),(function(t,e,n){if(null!=(e=Nn(Dt,e))&&e.length){n=Un(t,n);for(let n=0;n<e.length;n++)In(t.g,e[n]);On(t,n)}})),Ur,-1,[0,Ir,-1],Nr,Ir],Dr=[0,Ur,-2],zr=class extends pn{constructor(){super()}},$r=[0],Wr=[0,Sr,Ir,1,Ir,-3],Rr=[0,Ur,Ir,-1,Sr,[0,[1,2,3,4,5,6],Lr,$r,Lr,Gr,Lr,Dr,Lr,Wr,Lr,Mr,Lr,[0,Ur,-2]],[0,Ur],Ir,[0,[1,3],[2,4],Lr,[0,Ar],-1,Lr,[0,xr],-1,mr,[0,Ur,-1]],Ur],Hr=class extends pn{constructor(t){super(t,2)}},qr={},Jr=qr.A={};qr[336783863]=Rr,Jr[336783863]=1;var Kr=[0,wr,-1,Tr,-3,wr,Ar,Pr,Er,wr,-1,Tr,Er,Tr,-2,Pr];function Xr(t){We(t,3,"TEXT:text_in")}var Yr=class extends pn{constructor(t){super(t,500)}o(t){return ke(this,0,7,t)}},Qr=[-1,{A:{}}],Zr=[0,Ur,1,Qr],ti=[0,Ur,xr,Qr];function ei(t){We(t,10,"text_in")}var ni,ri=class extends pn{constructor(){super(void 0,500)}o(t){return ke(this,0,1001,t)}};ri.prototype.g=(ni=[-500,mr,[-500,Pr,-1,xr,-3,[-2,qr,Ir],mr,kr,Er,-1,Zr,ti,mr,[0,Pr,Tr],Pr,Kr,Er,xr,987,xr],4,mr,[-500,Ur,-1,[-1,{A:{}}],998,Ur],mr,[-500,Ur,xr,-1,[-2,{A:{}},Ir],997,xr,-1],Er,mr,[-500,Ur,xr,Qr,998,xr],xr,Er,Zr,ti,mr,[0,Pr,-1,Qr],xr,-2,Kr,Pr,-1,Tr,979,Qr,mr,kr],function(){const t=new class{constructor(){this.j=[],this.i=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){const t=this.g;return this.g=[],t}}}};or(this.l,t,Qn(ni)),xn(t,t.g.end());const e=new Uint8Array(t.i),n=t.j,r=n.length;let i=0;for(let t=0;t<r;t++){const r=n[t];e.set(r,i),i+=r.length}return t.j=[e],e});var ii=class extends pn{constructor(t){super(t)}},oi=class extends pn{constructor(t){super(t)}g(){return Ve(this,ii)}},si=class extends pn{constructor(t){super(t)}},ai=Vr(class extends pn{constructor(t){super(t)}},[0,mr,[0,1,Sr,Ur,[0,mr,[0,Sr,yr,Ur,-1]]],vr]),ui=class extends pn{constructor(t){super(t)}},ci=class extends pn{constructor(t){super(t)}I(){const t=_e(this);return null==t?j():t}},li=class extends pn{constructor(t){super(t)}},hi=[1,2],fi=Vr(class extends pn{constructor(t){super(t)}},[0,mr,[0,hi,Lr,[0,br],Lr,[0,Fr],Sr,Ur],vr]),di=class extends pn{constructor(t){super(t)}},gi=class extends pn{constructor(t){super(t)}},pi=[0,Ir,-1],mi=class extends pn{constructor(t){super(t)}},yi=[1,2,3,4,5],bi=class extends pn{constructor(t){super(t)}g(){return null!=_e(this)}i(){return null!=Kt(pe(this,2))}},vi=class extends pn{constructor(t){super(t)}},wi=[0,[0,Fr,Ur,[0,Sr,vr,-1],[0,_r,vr]],Ir,[0,yi,Lr,Wr,Lr,Gr,Lr,Mr,Lr,$r,Lr,Dr],Nr],_i=class extends pn{constructor(t){super(t)}},Si=new jr(462704549,_i);qr[462704549]=[0,wi,[0,Ur,Sr,yr,xr,-1]],Jr[462704549]=1;var Ai=class extends pn{constructor(t){super(t)}},Ei=new jr(477589892,Ai);function Ii(t,e){if(e=e?le(e):new di,void 0!==t.displayNamesLocale?be(e,1,Jt(t.displayNamesLocale)):void 0===t.displayNamesLocale&&be(e,1),void 0!==t.maxResults){var n=t.maxResults;if(null!=n){if("number"!=typeof n)throw D();if(!Number.isFinite(n))throw D();n|=0}be(e,2,n)}else"maxResults"in t&&be(e,2);if(void 0!==t.scoreThreshold){if(null!=(n=t.scoreThreshold)&&"number"!=typeof n)throw Error(`Value of float/double field must be a number, found ${typeof n}: ${n}`);be(e,3,n)}else"scoreThreshold"in t&&be(e,3);return void 0!==t.categoryAllowlist?$e(e,4,t.categoryAllowlist):"categoryAllowlist"in t&&be(e,4),void 0!==t.categoryDenylist?$e(e,5,t.categoryDenylist):"categoryDenylist"in t&&be(e,5),e}function Ti(t){const e={classifications:Ve(t,si).map((t=>function(t,e=-1,n=""){return{categories:t.map((t=>{var e=ze(Dt(pe(t,1)),0)??-1;const n=t.l;let r=Z(n);const i=ye(n,r,2),o=kt(i);return null!=o&&o!==i&&ve(n,r,2,o),{index:e,score:o??0??0,categoryName:ze(Kt(pe(t,3)),"")??"",displayName:ze(Kt(pe(t,4)),"")??""}})),headIndex:e,headName:n}}(Ne(t,oi,4)?.g()??[],ze(Dt(pe(t,2)),0),ze(Kt(pe(t,3)),""))))};return null!=Rt(pe(t,2))&&(e.timestampMs=ze(Rt(pe(t,2)),0)),e}function xi(t){return Array.from(t,(t=>t>127?t-256:t))}function Pi(t,e){if(t.length!==e.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${t.length} vs. ${e.length}).`);let n=0,r=0,i=0;for(let o=0;o<t.length;o++)n+=t[o]*e[o],r+=t[o]*t[o],i+=e[o]*e[o];if(r<=0||i<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return n/Math.sqrt(r*i)}let Ui;qr[477589892]=[0,wi,pi],Jr[477589892]=1;const Oi=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 Bi(){if(void 0===Ui)try{await WebAssembly.instantiate(Oi),Ui=!0}catch{Ui=!1}return Ui}async function Li(t,e=""){const n=await Bi()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${e}/${t}_${n}.js`,wasmBinaryPath:`${e}/${t}_${n}.wasm`}}var Fi=class{};function Ni(){var t=navigator;return"undefined"!=typeof OffscreenCanvas&&(!function(t=navigator){return(t=t.userAgent).includes("Safari")&&!t.includes("Chrome")}(t)||!!((t=t.userAgent.match(/Version\/([\d]+).*Safari/))&&t.length>=1&&Number(t[1])>=17))}async function ji(t){if("function"!=typeof importScripts){const e=document.createElement("script");return e.src=t.toString(),e.crossOrigin="anonymous",new Promise(((t,n)=>{e.addEventListener("load",(()=>{t()}),!1),e.addEventListener("error",(t=>{n(t)}),!1),document.body.appendChild(e)}))}importScripts(t.toString())}Fi.forVisionTasks=function(t){return Li("vision",t)},Fi.forTextTasks=function(t){return Li("text",t)},Fi.forGenAiExperimentalTasks=function(t){return Li("genai_experimental",t)},Fi.forGenAiTasks=function(t){return Li("genai",t)},Fi.forAudioTasks=function(t){return Li("audio",t)},Fi.isSimdSupported=function(){return Bi()};function Vi(t,e,n){t.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),n(e=t.h.stringToNewUTF8(e)),t.h._free(e)}function ki(t,e,n){t.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const r=new Uint32Array(e.length);for(let n=0;n<e.length;n++)r[n]=t.h.stringToNewUTF8(e[n]);e=t.h._malloc(4*r.length),t.h.HEAPU32.set(r,e>>2),n(e);for(const e of r)t.h._free(e);t.h._free(e)}function Mi(t,e,n){t.h.simpleListeners=t.h.simpleListeners||{},t.h.simpleListeners[e]=n}function Ci(t,e,n){let r=[];t.h.simpleListeners=t.h.simpleListeners||{},t.h.simpleListeners[e]=(t,e,i)=>{e?(n(r,i),r=[]):r.push(t)}}const Gi=function(t){return class extends t{M(){this.h._registerModelResourcesGraphService()}}}(class{constructor(t,e){this.j=!0,this.h=t,this.g=null,this.i=0,this.m="function"==typeof this.h._addIntToInputStream,void 0!==e?this.h.canvas=e:Ni()?this.h.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.h.canvas=document.createElement("canvas"))}async initializeGraph(t){const e=await(await fetch(t)).arrayBuffer();t=!(t.endsWith(".pbtxt")||t.endsWith(".textproto")),this.setGraph(new Uint8Array(e),t)}setGraphFromString(t){this.setGraph((new TextEncoder).encode(t),!1)}setGraph(t,e){const n=t.length,r=this.h._malloc(n);this.h.HEAPU8.set(t,r),e?this.h._changeBinaryGraph(n,r):this.h._changeTextGraph(n,r),this.h._free(r)}configureAudio(t,e,n,r,i){this.h._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),Vi(this,r||"input_audio",(r=>{Vi(this,i=i||"audio_header",(i=>{this.h._configureAudio(r,i,t,e,n)}))}))}setAutoResizeCanvas(t){this.j=t}setAutoRenderToScreen(t){this.h._setAutoRenderToScreen(t)}setGpuBufferVerticalFlip(t){this.h.gpuOriginForWebTexturesIsBottomLeft=t}attachErrorListener(t){this.h.errorListener=t}attachEmptyPacketListener(t,e){this.h.emptyPacketListeners=this.h.emptyPacketListeners||{},this.h.emptyPacketListeners[t]=e}addAudioToStream(t,e,n){this.addAudioToStreamWithShape(t,0,0,e,n)}addAudioToStreamWithShape(t,e,n,r,i){const o=4*t.length;this.i!==o&&(this.g&&this.h._free(this.g),this.g=this.h._malloc(o),this.i=o),this.h.HEAPF32.set(t,this.g/4),Vi(this,r,(t=>{this.h._addAudioToInputStream(this.g,e,n,t,i)}))}addGpuBufferToStream(t,e,n){Vi(this,e,(e=>{if(!this.h.canvas)throw Error("No OpenGL canvas configured.");e?this.h._bindTextureToStream(e):this.h._bindTextureToCanvas();const r=this.h.canvas.getContext("webgl2")||this.h.canvas.getContext("webgl");if(!r)throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");this.h.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!0),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t),this.h.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1);const[i,o]=void 0!==t.videoWidth?[t.videoWidth,t.videoHeight]:void 0!==t.naturalWidth?[t.naturalWidth,t.naturalHeight]:void 0!==t.displayWidth?[t.displayWidth,t.displayHeight]:[t.width,t.height];!this.j||i===this.h.canvas.width&&o===this.h.canvas.height||(this.h.canvas.width=i,this.h.canvas.height=o);const[s,a]=[i,o];this.h._addBoundTextureToStream(e,s,a,n)}))}addBoolToStream(t,e,n){Vi(this,e,(e=>{this.h._addBoolToInputStream(t,e,n)}))}addDoubleToStream(t,e,n){Vi(this,e,(e=>{this.h._addDoubleToInputStream(t,e,n)}))}addFloatToStream(t,e,n){Vi(this,e,(e=>{this.h._addFloatToInputStream(t,e,n)}))}addIntToStream(t,e,n){Vi(this,e,(e=>{this.h._addIntToInputStream(t,e,n)}))}addUintToStream(t,e,n){Vi(this,e,(e=>{this.h._addUintToInputStream(t,e,n)}))}addStringToStream(t,e,n){Vi(this,e,(e=>{Vi(this,t,(t=>{this.h._addStringToInputStream(t,e,n)}))}))}addStringRecordToStream(t,e,n){Vi(this,e,(e=>{ki(this,Object.keys(t),(r=>{ki(this,Object.values(t),(i=>{this.h._addFlatHashMapToInputStream(r,i,Object.keys(t).length,e,n)}))}))}))}addProtoToStream(t,e,n,r){Vi(this,n,(n=>{Vi(this,e,(e=>{const i=this.h._malloc(t.length);this.h.HEAPU8.set(t,i),this.h._addProtoToInputStream(i,t.length,e,n,r),this.h._free(i)}))}))}addEmptyPacketToStream(t,e){Vi(this,t,(t=>{this.h._addEmptyPacketToInputStream(t,e)}))}addBoolVectorToStream(t,e,n){Vi(this,e,(e=>{const r=this.h._allocateBoolVector(t.length);if(!r)throw Error("Unable to allocate new bool vector on heap.");for(const e of t)this.h._addBoolVectorEntry(r,e);this.h._addBoolVectorToInputStream(r,e,n)}))}addDoubleVectorToStream(t,e,n){Vi(this,e,(e=>{const r=this.h._allocateDoubleVector(t.length);if(!r)throw Error("Unable to allocate new double vector on heap.");for(const e of t)this.h._addDoubleVectorEntry(r,e);this.h._addDoubleVectorToInputStream(r,e,n)}))}addFloatVectorToStream(t,e,n){Vi(this,e,(e=>{const r=this.h._allocateFloatVector(t.length);if(!r)throw Error("Unable to allocate new float vector on heap.");for(const e of t)this.h._addFloatVectorEntry(r,e);this.h._addFloatVectorToInputStream(r,e,n)}))}addIntVectorToStream(t,e,n){Vi(this,e,(e=>{const r=this.h._allocateIntVector(t.length);if(!r)throw Error("Unable to allocate new int vector on heap.");for(const e of t)this.h._addIntVectorEntry(r,e);this.h._addIntVectorToInputStream(r,e,n)}))}addUintVectorToStream(t,e,n){Vi(this,e,(e=>{const r=this.h._allocateUintVector(t.length);if(!r)throw Error("Unable to allocate new unsigned int vector on heap.");for(const e of t)this.h._addUintVectorEntry(r,e);this.h._addUintVectorToInputStream(r,e,n)}))}addStringVectorToStream(t,e,n){Vi(this,e,(e=>{const r=this.h._allocateStringVector(t.length);if(!r)throw Error("Unable to allocate new string vector on heap.");for(const e of t)Vi(this,e,(t=>{this.h._addStringVectorEntry(r,t)}));this.h._addStringVectorToInputStream(r,e,n)}))}addBoolToInputSidePacket(t,e){Vi(this,e,(e=>{this.h._addBoolToInputSidePacket(t,e)}))}addDoubleToInputSidePacket(t,e){Vi(this,e,(e=>{this.h._addDoubleToInputSidePacket(t,e)}))}addFloatToInputSidePacket(t,e){Vi(this,e,(e=>{this.h._addFloatToInputSidePacket(t,e)}))}addIntToInputSidePacket(t,e){Vi(this,e,(e=>{this.h._addIntToInputSidePacket(t,e)}))}addUintToInputSidePacket(t,e){Vi(this,e,(e=>{this.h._addUintToInputSidePacket(t,e)}))}addStringToInputSidePacket(t,e){Vi(this,e,(e=>{Vi(this,t,(t=>{this.h._addStringToInputSidePacket(t,e)}))}))}addProtoToInputSidePacket(t,e,n){Vi(this,n,(n=>{Vi(this,e,(e=>{const r=this.h._malloc(t.length);this.h.HEAPU8.set(t,r),this.h._addProtoToInputSidePacket(r,t.length,e,n),this.h._free(r)}))}))}addBoolVectorToInputSidePacket(t,e){Vi(this,e,(e=>{const n=this.h._allocateBoolVector(t.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(const e of t)this.h._addBoolVectorEntry(n,e);this.h._addBoolVectorToInputSidePacket(n,e)}))}addDoubleVectorToInputSidePacket(t,e){Vi(this,e,(e=>{const n=this.h._allocateDoubleVector(t.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(const e of t)this.h._addDoubleVectorEntry(n,e);this.h._addDoubleVectorToInputSidePacket(n,e)}))}addFloatVectorToInputSidePacket(t,e){Vi(this,e,(e=>{const n=this.h._allocateFloatVector(t.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(const e of t)this.h._addFloatVectorEntry(n,e);this.h._addFloatVectorToInputSidePacket(n,e)}))}addIntVectorToInputSidePacket(t,e){Vi(this,e,(e=>{const n=this.h._allocateIntVector(t.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(const e of t)this.h._addIntVectorEntry(n,e);this.h._addIntVectorToInputSidePacket(n,e)}))}addUintVectorToInputSidePacket(t,e){Vi(this,e,(e=>{const n=this.h._allocateUintVector(t.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(const e of t)this.h._addUintVectorEntry(n,e);this.h._addUintVectorToInputSidePacket(n,e)}))}addStringVectorToInputSidePacket(t,e){Vi(this,e,(e=>{const n=this.h._allocateStringVector(t.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(const e of t)Vi(this,e,(t=>{this.h._addStringVectorEntry(n,t)}));this.h._addStringVectorToInputSidePacket(n,e)}))}attachBoolListener(t,e){Mi(this,t,e),Vi(this,t,(t=>{this.h._attachBoolListener(t)}))}attachBoolVectorListener(t,e){Ci(this,t,e),Vi(this,t,(t=>{this.h._attachBoolVectorListener(t)}))}attachIntListener(t,e){Mi(this,t,e),Vi(this,t,(t=>{this.h._attachIntListener(t)}))}attachIntVectorListener(t,e){Ci(this,t,e),Vi(this,t,(t=>{this.h._attachIntVectorListener(t)}))}attachUintListener(t,e){Mi(this,t,e),Vi(this,t,(t=>{this.h._attachUintListener(t)}))}attachUintVectorListener(t,e){Ci(this,t,e),Vi(this,t,(t=>{this.h._attachUintVectorListener(t)}))}attachDoubleListener(t,e){Mi(this,t,e),Vi(this,t,(t=>{this.h._attachDoubleListener(t)}))}attachDoubleVectorListener(t,e){Ci(this,t,e),Vi(this,t,(t=>{this.h._attachDoubleVectorListener(t)}))}attachFloatListener(t,e){Mi(this,t,e),Vi(this,t,(t=>{this.h._attachFloatListener(t)}))}attachFloatVectorListener(t,e){Ci(this,t,e),Vi(this,t,(t=>{this.h._attachFloatVectorListener(t)}))}attachStringListener(t,e){Mi(this,t,e),Vi(this,t,(t=>{this.h._attachStringListener(t)}))}attachStringVectorListener(t,e){Ci(this,t,e),Vi(this,t,(t=>{this.h._attachStringVectorListener(t)}))}attachProtoListener(t,e,n){Mi(this,t,e),Vi(this,t,(t=>{this.h._attachProtoListener(t,n||!1)}))}attachProtoVectorListener(t,e,n){Ci(this,t,e),Vi(this,t,(t=>{this.h._attachProtoVectorListener(t,n||!1)}))}attachAudioListener(t,e,n){this.h._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),Mi(this,t,((t,n)=>{t=new Float32Array(t.buffer,t.byteOffset,t.length/4),e(t,n)})),Vi(this,t,(t=>{this.h._attachAudioListener(t,n||!1)}))}finishProcessing(){this.h._waitUntilIdle()}closeGraph(){this.h._closeGraph(),this.h.simpleListeners=void 0,this.h.emptyPacketListeners=void 0}});var Di=class extends Gi{};async function zi(t,e,n){return t=await(async(t,e,n,r)=>{if(e&&await ji(e),!self.ModuleFactory)throw Error("ModuleFactory not set.");if(n&&(await ji(n),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&r&&((e=self.Module).locateFile=r.locateFile,r.mainScriptUrlOrBlob&&(e.mainScriptUrlOrBlob=r.mainScriptUrlOrBlob)),r=await self.ModuleFactory(self.Module||r),self.ModuleFactory=self.Module=void 0,new t(r,null)})(t,e.wasmLoaderPath,e.assetLoaderPath,{locateFile:t=>t.endsWith(".wasm")?e.wasmBinaryPath.toString():e.assetBinaryPath&&t.endsWith(".data")?e.assetBinaryPath.toString():t}),await t.o(n),t}async function $i(t,e,n){return zi(t,e,n)}function Wi(t,e){const n=Ne(t.baseOptions,bi,1)||new bi;"string"==typeof e?(be(n,2,Jt(e)),be(n,1)):e instanceof Uint8Array&&(be(n,1,ut(e,!1,!1)),be(n,2)),ke(t.baseOptions,0,1,n)}function Ri(t,e){const n=e.baseOptions||{};if(e.baseOptions?.modelAssetBuffer&&e.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(Ne(t.baseOptions,bi,1)?.g()||Ne(t.baseOptions,bi,1)?.i()||e.baseOptions?.modelAssetBuffer||e.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if(function(t,e){let n=Ne(t.baseOptions,mi,3);if(!n){var r=n=new mi;Me(r,4,new zr)}"delegate"in e&&("GPU"===e.delegate?Me(e=n,2,r=new Cr):Me(e=n,4,r=new zr)),ke(t.baseOptions,0,3,n)}(t,n),n.modelAssetPath)return fetch(n.modelAssetPath.toString()).then((t=>{if(t.ok)return t.arrayBuffer();throw Error(`Failed to fetch model: ${n.modelAssetPath} (${t.status})`)})).then((e=>{try{t.g.h.FS_unlink("/model.dat")}catch{}t.g.h.FS_createDataFile("/","model.dat",new Uint8Array(e),!0,!1,!1),Wi(t,"/model.dat"),t.s()}));if(n.modelAssetBuffer instanceof Uint8Array)Wi(t,n.modelAssetBuffer);else if(n.modelAssetBuffer)return async function(t){const e=[];for(var n=0;;){const{done:r,value:i}=await t.read();if(r)break;e.push(i),n+=i.length}if(0===e.length)return new Uint8Array(0);if(1===e.length)return e[0];t=new Uint8Array(n),n=0;for(const r of e)t.set(r,n),n+=r.length;return t}(n.modelAssetBuffer).then((e=>{Wi(t,e),t.s()}));return t.s(),Promise.resolve()}function Hi(t){try{const e=t.m.length;if(1===e)throw Error(t.m[0].message);if(e>1)throw Error("Encountered multiple errors: "+t.m.map((t=>t.message)).join(", "))}finally{t.m=[]}}function qi(t,e){t.j=Math.max(t.j,e)}var Ji=class{constructor(t){this.g=t,this.m=[],this.j=0,this.g.setAutoRenderToScreen(!1)}setGraph(t,e){this.g.attachErrorListener(((t,e)=>{this.m.push(Error(e))})),this.g.M(),this.g.setGraph(t,e),Hi(this)}finishProcessing(){this.g.finishProcessing(),Hi(this)}close(){this.g.closeGraph()}};Ji.prototype.close=Ji.prototype.close,function(e,n){e=e.split(".");var r,i=t;e[0]in i||void 0===i.execScript||i.execScript("var "+e[0]);for(;e.length&&(r=e.shift());)e.length||void 0===n?i=i[r]&&i[r]!==Object.prototype[r]?i[r]:i[r]={}:i[r]=n}("TaskRunner",Ji);var Ki=class extends Ji{constructor(t,e){super(new Di(t,e)),this.u={languages:[]},ke(t=this.i=new _i,0,1,e=new vi)}o(t){return ke(this.i,0,2,Ii(t,Ne(this.i,di,2))),Ri(this,t)}get baseOptions(){return Ne(this.i,vi,1)}set baseOptions(t){ke(this.i,0,1,t)}K(t){return this.u={languages:[]},this.g.addStringToStream(t,"text_in",this.j+1),this.finishProcessing(),this.u}s(){var t=new ri;ei(t),We(t,15,"classifications_out");const e=new Hr;gn(e,Si,this.i);const n=new Yr;Ie(n,Jt("mediapipe.tasks.text.text_classifier.TextClassifierGraph")),Xr(n),We(n,4,"CLASSIFICATIONS:classifications_out"),n.o(e),De(t,n),this.g.attachProtoListener("classifications_out",((t,e)=>{if(({classifications:t}=Ti(ai(t))),1!==t.length)throw Error(`Expected 1 classification head, got ${t.length}`);this.u.languages=t[0].categories.map((t=>({languageCode:t.categoryName,probability:t.score}))),qi(this,e)})),this.g.attachEmptyPacketListener("classifications_out",(t=>{qi(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Ki.prototype.detect=Ki.prototype.K,Ki.prototype.setOptions=Ki.prototype.o,Ki.createFromModelPath=function(t,e){return $i(Ki,t,{baseOptions:{modelAssetPath:e}})},Ki.createFromModelBuffer=function(t,e){return $i(Ki,t,{baseOptions:{modelAssetBuffer:e}})},Ki.createFromOptions=function(t,e){return $i(Ki,t,e)};var Xi=class extends Ji{constructor(t,e){super(new Di(t,e)),this.u={classifications:[]},ke(t=this.i=new _i,0,1,e=new vi)}o(t){return ke(this.i,0,2,Ii(t,Ne(this.i,di,2))),Ri(this,t)}get baseOptions(){return Ne(this.i,vi,1)}set baseOptions(t){ke(this.i,0,1,t)}J(t){return this.u={classifications:[]},this.g.addStringToStream(t,"text_in",this.j+1),this.finishProcessing(),this.u}s(){var t=new ri;ei(t),We(t,15,"classifications_out");const e=new Hr;gn(e,Si,this.i);const n=new Yr;Ie(n,Jt("mediapipe.tasks.text.text_classifier.TextClassifierGraph")),Xr(n),We(n,4,"CLASSIFICATIONS:classifications_out"),n.o(e),De(t,n),this.g.attachProtoListener("classifications_out",((t,e)=>{this.u=Ti(ai(t)),qi(this,e)})),this.g.attachEmptyPacketListener("classifications_out",(t=>{qi(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Xi.prototype.classify=Xi.prototype.J,Xi.prototype.setOptions=Xi.prototype.o,Xi.createFromModelPath=function(t,e){return $i(Xi,t,{baseOptions:{modelAssetPath:e}})},Xi.createFromModelBuffer=function(t,e){return $i(Xi,t,{baseOptions:{modelAssetBuffer:e}})},Xi.createFromOptions=function(t,e){return $i(Xi,t,e)};var Yi=class extends Ji{constructor(t,e){super(new Di(t,e)),this.u={embeddings:[]},ke(t=this.i=new Ai,0,1,e=new vi)}o(t){var e=this.i,n=Ne(this.i,gi,2);return n=n?le(n):new gi,void 0!==t.l2Normalize?be(n,1,Mt(t.l2Normalize)):"l2Normalize"in t&&be(n,1),void 0!==t.quantize?be(n,2,Mt(t.quantize)):"quantize"in t&&be(n,2),ke(e,0,2,n),Ri(this,t)}get baseOptions(){return Ne(this.i,vi,1)}set baseOptions(t){ke(this.i,0,1,t)}L(t){return this.g.addStringToStream(t,"text_in",this.j+1),this.finishProcessing(),this.u}s(){var t=new ri;ei(t),We(t,15,"embeddings_out");const e=new Hr;gn(e,Ei,this.i);const n=new Yr;Ie(n,Jt("mediapipe.tasks.text.text_embedder.TextEmbedderGraph")),Xr(n),We(n,4,"EMBEDDINGS:embeddings_out"),n.o(e),De(t,n),this.g.attachProtoListener("embeddings_out",((t,e)=>{t=fi(t),this.u=function(t){return{embeddings:Ve(t,li).map((t=>{const e={headIndex:ze(Dt(pe(t,3)),0)??-1,headName:ze(Kt(pe(t,4)),"")??""};if(void 0!==Fe(t,ui,Pe(t,1))){var n=Ne(t,ui,Pe(t,1)),r=void 0===pt?2:5,i=n.l;const s=2&(t=Z(i))?1:r;r=Se(i,t);let a=Q(r);if(ge(n,a,void 0,!1)){(4&a||Object.isFrozen(r))&&(r=$(r),a=Ce(a,t),t=ve(i,t,1,r));let e=n=0;for(;n<r.length;n++){const t=kt(r[n]);null!=t&&(r[e++]=t)}e<n&&(r.length=e),a=Ae(a,t),a=-12289&(20|a),tt(r,a),2&a&&Object.freeze(r)}var o;1===s||4===s&&32&a?Ee(a)||(t=a,a|=2,a!==t&&tt(r,a),Object.freeze(r)):(n=5===s&&(!!(32&a)||Ee(a)||!!Qt?.get(r)),(2===s||n)&&Ee(a)&&(r=$(r),a=Ce(a,t),a=Ge(a,t,!1),tt(r,a),t=ve(i,t,1,r)),Ee(a)||(i=a,a=Ge(a,t,!1),a!==i&&tt(r,a)),n&&(o=Yt(r))),e.floatEmbedding=(o||r).slice()}else o=new Uint8Array(0),e.quantizedEmbedding=Ne(t,ci,Pe(t,2))?.I()?.i()??o;return e})),timestampMs:ze(Rt(pe(t,2)),0)}}(t),qi(this,e)})),this.g.attachEmptyPacketListener("embeddings_out",(t=>{qi(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Yi.cosineSimilarity=function(t,e){if(t.floatEmbedding&&e.floatEmbedding)t=Pi(t.floatEmbedding,e.floatEmbedding);else{if(!t.quantizedEmbedding||!e.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");t=Pi(xi(t.quantizedEmbedding),xi(e.quantizedEmbedding))}return t},Yi.prototype.embed=Yi.prototype.L,Yi.prototype.setOptions=Yi.prototype.o,Yi.createFromModelPath=function(t,e){return $i(Yi,t,{baseOptions:{modelAssetPath:e}})},Yi.createFromModelBuffer=function(t,e){return $i(Yi,t,{baseOptions:{modelAssetBuffer:e}})},Yi.createFromOptions=function(t,e){return $i(Yi,t,e)},exports.FilesetResolver=Fi,exports.LanguageDetector=Ki,exports.TextClassifier=Xi,exports.TextEmbedder=Yi;
2
2
  //# sourceMappingURL=text_bundle_cjs.js.map