@mediapipe/tasks-text 0.10.19-rc.20241113 → 0.10.19-rc.20241114

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mediapipe/tasks-text",
3
- "version": "0.10.19-rc.20241113",
3
+ "version": "0.10.19-rc.20241114",
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(653718497,e(1,!0));const d=t.navigator;function g(t){return!!h&&(!!l&&l.brands.some((({brand:e})=>e&&-1!=e.indexOf(t))))}function p(e){var n;return(n=t.navigator)&&(n=n.userAgent)||(n=""),-1!=n.indexOf(e)}function m(){return!!h&&(!!l&&l.brands.length>0)}function y(){return m()?g("Chromium"):(p("Chrome")||p("CriOS"))&&!(!m()&&p("Edge"))||p("Silk")}l=d&&d.userAgentData||null;var b=!m()&&(p("Trident")||p("MSIE"));!p("Android")||y(),y(),p("Safari")&&(y()||!m()&&p("Coast")||!m()&&p("Opera")||!m()&&p("Edge")||(m()?g("Microsoft Edge"):p("Edg/"))||m()&&g("Opera"));var v={},w=null;function _(t){const e=t.length;let 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);const r=new Uint8Array(n);let i=0;return function(t,e){function n(e){for(;r<t.length;){const e=t.charAt(r++),n=w[e];if(null!=n)return n;if(!/^[\s\xa0]*$/.test(e))throw Error("Unknown base64 encoding at char: "+e)}return e}S();let r=0;for(;;){const t=n(-1),r=n(0),i=n(64),o=n(64);if(64===o&&-1===t)break;e(t<<2|r>>4),64!=i&&(e(r<<4&240|i>>2),64!=o&&e(i<<6&192|o))}}(t,(function(t){r[i++]=t})),i!==n?r.subarray(0,i):r}function S(){if(!w){w={};var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),e=["+/=","+/","-_=","-_.","-_"];for(let n=0;n<5;n++){const r=t.concat(e[n].split(""));v[n]=r;for(let t=0;t<r.length;t++){const e=r[t];void 0===w[e]&&(w[e]=t)}}}}var A="undefined"!=typeof Uint8Array,E=!b&&"function"==typeof btoa;function I(t){if(!E){var e;void 0===e&&(e=0),S(),e=v[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 T=/[-_.]/g,x={"-":"+",_:"/",".":"="};function P(t){return x[t]||""}function U(t){if(!E)return _(t);T.test(t)&&(t=t.replace(T,P)),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 A&&null!=t&&t instanceof Uint8Array}var O={};function L(){return F||=new k(null,O)}function N(t){j(O);var e=t.g;return null==(e=null==e||B(e)?e:"string"==typeof e?U(e):null)?e:t.g=e}var k=class{i(){return new Uint8Array(N(this)||0)}constructor(t,e){if(j(e),this.g=t,null!=t&&0===t.length)throw Error("ByteString should be constructed with non-empty values")}};let F,V;function j(t){if(t!==O)throw Error("illegal external caller")}function C(t,e){t.__closure__error__context__984382||(t.__closure__error__context__984382={}),t.__closure__error__context__984382.severity=e}function M(){const e=Error();C(e,"incident"),function(e){t.setTimeout((()=>{throw e}),0)}(e)}function G(){const t=Error("int32");return C(t,"warning"),t}function D(){return"function"==typeof BigInt}function z(t){return Array.prototype.slice.call(t)}var $="function"==typeof Symbol&&"symbol"==typeof Symbol();function R(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol()?Symbol():t}var W=R(),H=R("2ex"),q=R("1oa"),J=$?(t,e)=>{t[W]|=e}:(t,e)=>{void 0!==t.s?t.s|=e:Object.defineProperties(t,{s:{value:e,configurable:!0,writable:!0,enumerable:!1}})},K=$?(t,e)=>{t[W]&=~e}:(t,e)=>{void 0!==t.s&&(t.s&=~e)},X=$?t=>0|t[W]:t=>0|t.s,Y=$?t=>t[W]:t=>t.s,Q=$?(t,e)=>{t[W]=e}:(t,e)=>{void 0!==t.s?t.s=e:Object.defineProperties(t,{s:{value:e,configurable:!0,writable:!0,enumerable:!1}})};function Z(t,e){Q(e,-30975&(0|t))}function tt(t,e){Q(e,-30941&(34|t))}var et,nt={},rt={};function it(t){return!(!t||"object"!=typeof t||t.g!==rt)}function ot(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)&&t.constructor===Object}function st(t,e){if(null!=t)if("string"==typeof t)t=t?new k(t,O):L();else if(t.constructor!==k)if(B(t))t=t.length?new k(new Uint8Array(t),O):L();else{if(!e)throw Error();t=void 0}return t}function at(t){return!(!Array.isArray(t)||t.length)&&!!(1&X(t))}const ut=[];function ct(t){if(2&t)throw Error()}let lt;function ht(t,e){(e=lt?e[lt]:void 0)&&(t[lt]=z(e))}Q(ut,55),et=Object.freeze(ut);var ft=Object.freeze({}),dt=Object.freeze({}),gt=Object.freeze({}),pt="function"==typeof t.BigInt&&"bigint"==typeof t.BigInt(0),mt=t=>pt?t>=bt&&t<=wt:"-"===t[0]?_t(t,yt):_t(t,vt);const yt=Number.MIN_SAFE_INTEGER.toString(),bt=pt?BigInt(Number.MIN_SAFE_INTEGER):void 0,vt=Number.MAX_SAFE_INTEGER.toString(),wt=pt?BigInt(Number.MAX_SAFE_INTEGER):void 0;function _t(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}}const St="function"==typeof Uint8Array.prototype.slice;let At,Et=0,It=0;function Tt(t){const e=t>>>0;Et=e,It=(t-e)/4294967296>>>0}function xt(t){if(t<0){Tt(-t);const[e,n]=kt(Et,It);Et=e>>>0,It=n>>>0}else Tt(t)}function Pt(t){const e=At||=new DataView(new ArrayBuffer(8));e.setFloat32(0,+t,!0),It=0,Et=e.getUint32(0,!0)}function Ut(t,e){const n=4294967296*e+(t>>>0);return Number.isSafeInteger(n)?n:Ot(t,e)}function Bt(t,e){const n=2147483648&e;return n&&(e=~e>>>0,0==(t=1+~t>>>0)&&(e=e+1>>>0)),"number"==typeof(t=Ut(t,e))?n?-t:t:n?"-"+t:t}function Ot(t,e){if(t>>>=0,(e>>>=0)<=2097151)var n=""+(4294967296*e+t);else D()?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+Lt(n)+Lt(t));return n}function Lt(t){return t=String(t),"0000000".slice(t.length)+t}function Nt(t){if(t.length<16)xt(Number(t));else if(D())t=BigInt(t),Et=Number(t&BigInt(4294967295))>>>0,It=Number(t>>BigInt(32)&BigInt(4294967295));else{const e=+("-"===t[0]);It=Et=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));It*=1e6,Et=1e6*Et+e,Et>=4294967296&&(It+=Math.trunc(Et/4294967296),It>>>=0,Et>>>=0)}if(e){const[t,e]=kt(Et,It);Et=t,It=e}}}function kt(t,e){return e=~e,t?t=1+~t:e+=1,[t,e]}function Ft(t){return null==t||"number"==typeof t?t:"NaN"===t||"Infinity"===t||"-Infinity"===t?Number(t):void 0}function Vt(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 jt=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Ct(t){const e=typeof t;switch(e){case"bigint":return!0;case"number":return Number.isFinite(t)}return"string"===e&&jt.test(t)}function Mt(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 Gt(t){return"-"!==t[0]&&(t.length<20||20===t.length&&Number(t.substring(0,6))<184467)}function Dt(t){return t=Math.trunc(t),Number.isSafeInteger(t)||(xt(t),t=Bt(Et,It)),t}function zt(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(Nt(t),t=Et,2147483648&(e=It))if(D())t=""+(BigInt(0|e)<<BigInt(32)|BigInt(t>>>0));else{const[n,r]=kt(t,e);t="-"+Ot(n,r)}else t=Ot(t,e);return t}function $t(t){return null==t?t:"bigint"==typeof t?(mt(t)?t=Number(t):(t=BigInt.asIntN(64,t),t=mt(t)?Number(t):String(t)),t):Ct(t)?"number"==typeof t?Dt(t):zt(t):void 0}function Rt(t){if(null==t)return t;var e=typeof t;if("bigint"===e)return String(BigInt.asUintN(64,t));if(Ct(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)),Gt(t)||(Nt(t),t=Ot(Et,It))),t;if("number"===e)return(t=Math.trunc(t))>=0&&Number.isSafeInteger(t)?t:function(t){if(t<0){xt(t);var e=Ot(Et,It);return t=Number(e),Number.isSafeInteger(t)?t:e}return Gt(e=String(t))?e:(xt(t),Ut(Et,It))}(t)}}function Wt(t){if("string"!=typeof t)throw Error();return t}function Ht(t){if(null!=t&&"string"!=typeof t)throw Error();return t}function qt(t){return null==t||"string"==typeof t?t:void 0}function Jt(t,e,n){if(null!=t&&"object"==typeof t&&t.C===nt)return t;if(Array.isArray(t)){var r=X(t),i=r;return 0===i&&(i|=32&n),(i|=2&n)!==r&&Q(t,i),new e(t)}}function Kt(t){var e;return void 0===Qt&&(Qt="function"==typeof Proxy?ie(Proxy):null),(e=!Qt)||(void 0===Zt&&(Zt="function"==typeof WeakMap?ie(WeakMap):null),e=!Zt),e?t:(e=Xt?.get(t))?e:Math.random()>.01?t:(function(t){if(void 0===te){const t=new Qt([],{});te=1===Array.prototype.concat.call([],t).length}te&&"function"==typeof Symbol&&Symbol.isConcatSpreadable&&(t[Symbol.isConcatSpreadable]=!0)}(t),function(t,e){(Xt||=new Zt).set(t,e),(Yt||=new Zt).set(e,t)}(t,e=new Qt(t,{set:(t,e,n)=>(M(),t[e]=n,!0)})),e)}let Xt,Yt,Qt,Zt,te,ee,ne,re;function ie(t){try{return-1!==t.toString().indexOf("[native code]")?t:null}catch{return null}}function oe(t,e,n){return t=se(t,e[0],e[1],n?1:2),e!==ne&&n&&J(t,16384),t}function se(t,e,n,r){if(r=r??0,null==t&&(t=ee),ee=void 0,null==t){var i=96;n?(t=[n],i|=512):t=[],e&&(i=-33521665&i|(1023&e)<<15)}else{if(!Array.isArray(t))throw Error("narr");if(2048&(i=X(t)))throw Error("farr");if(64&i)return t;if(1===r||2===r||(i|=64),n&&(i|=512,n!==t[0]))throw Error("mid");t:{if(r=(n=t).length){const t=r-1;if(ot(n[t])){if((e=t-(+!!(512&(i|=256))-1))>=1024)throw Error("pvtlmt");i=-33521665&i|(1023&e)<<15;break t}}if(e){if((e=Math.max(e,r-(+!!(512&i)-1)))>1024)throw Error("spvt");i=-33521665&i|(1023&e)<<15}}}return Q(t,i),t}function ae(t,e,n,r,i){if(null!=t){if(Array.isArray(t))t=at(t)?void 0:i&&2&X(t)?t:ue(t,e,n,void 0!==r,i);else if(ot(t)){const o={};for(let s in t)o[s]=ae(t[s],e,n,r,i);t=o}else t=e(t,r);return t}}function ue(t,e,n,r,i){const o=r||n?X(t):0;r=r?!!(32&o):void 0;const s=z(t);for(let t=0;t<s.length;t++)s[t]=ae(s[t],e,n,r,i);return n&&(ht(s,t),n(o,s)),s}function ce(t){return t.C===nt?t.toJSON():function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"bigint":return mt(t)?Number(t):String(t);case"boolean":return t?1:0;case"object":if(t)if(Array.isArray(t)){if(at(t))return}else{if(B(t))return I(t);if(t instanceof k){const e=t.g;return null==e?"":"string"==typeof e?e:t.g=I(e)}}}return t}(t)}function le(t,e,n=tt){if(null!=t){if(A&&t instanceof Uint8Array)return e?t:new Uint8Array(t);if(Array.isArray(t)){var r=X(t);return 2&r?t:(e&&=0===r||!!(32&r)&&!(64&r||!(16&r)),e?(Q(t,-12293&(34|r)),t):ue(t,le,4&r?tt:n,!0,!0))}return t.C===nt&&(n=t.l,t=2&(r=Y(n))?t:fe(t,n,r,!0)),t}}function he(t){const e=t.l;return fe(t,e,Y(e),!1)}function fe(t,e,n,r){return t=t.constructor,ee=e=de(e,n,r),e=new t(e),ee=void 0,e}function de(t,e,n){const r=n||2&e?tt:Z,i=!!(32&e);return t=function(t,e,n){const r=z(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 ht(r,t),r}(t,e,(t=>le(t,i,r))),J(t,32|(n?2:0)),t}function ge(t){const e=t.l,n=Y(e);return 2&n?fe(t,e,n,!1):t}function pe(t,e){return ye(t=t.l,Y(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>>15&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!=H&&((e=(t=V??={})[H]||0)>=4||(t[H]=e+1,M())),r):me(t,e,i,n)}return 256&e?t[t.length-1][n]:void 0}function be(t,e,n){const r=t.l;let i=Y(r);return ct(i),ve(r,i,e,n),t}function ve(t,e,n,r){const i=e>>15&1023||536870912;if(n>=i){let o,s=e;if(256&e)o=t[t.length-1];else{if(null==r)return s;o=t[i+(+!!(512&e)-1)]={},s|=256}return o[n]=r,n<i&&(t[n+(+!!(512&e)-1)]=void 0),s!==e&&Q(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){t=t.l;let e=Y(t);const n=ye(t,e,1),r=st(n,!0);return null!=r&&r!==n&&ve(t,e,1,r),r}function _e(t,e,n,r,i){const o=t.l,s=2&(t=Y(o))?1:r;i=!!i,r=Se(o,t,e);var a=X(r);if(!(4&a)){4&a&&(r=z(r),a=Ce(a,t),t=ve(o,t,e,r));let i=0,s=0;for(;i<r.length;i++){const t=n(r[i]);null!=t&&(r[s++]=t)}s<i&&(r.length=s),a=-4097&(20|(a=Ae(a,t))),Q(r,a&=-8193),2&a&&Object.freeze(r)}let u;return 1===s||4===s&&32&a?Ee(a)||(i=a,(a|=2)!==i&&Q(r,a),Object.freeze(r)):(n=5===s&&(!!(32&a)||Ee(a)||!!Xt?.get(r)),(2===s||n)&&Ee(a)&&(r=z(r),a=Me(a=Ce(a,t),t,i),Q(r,a),t=ve(o,t,e,r)),Ee(a)||(e=a,(a=Me(a,t,i))!==e&&Q(r,a)),n?u=Kt(r):2!==s||i||Xt?.delete(r)),u||r}function Se(t,e,n,r){return t=ye(t,e,n,r),Array.isArray(t)?t:et}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=Y(t);ct(n),ve(t,n,2,""===e?void 0:e)}function Te(t,e,n,r,i){ct(e);var o=!(!(64&e)&&16384&e);const s=(i=Se(t,e,n,i))!==et;if(o||!s){let a=o=s?X(i):0;(!s||2&a||Ee(a)||4&a&&!(32&a))&&(i=z(i),a=Ce(a,e),e=ve(t,e,n,i)),a=-13&Ae(a,e),a=Me(r?-17&a:16|a,e,!0),a!==o&&Q(i,a)}return i}function xe(t,e){var n=gi;return Be(Pe(t=t.l),t,Y(t),n)===e?e:-1}function Pe(t){if($)return t[q]??(t[q]=new Map);if(q in t)return t[q];const e=new Map;return Object.defineProperty(t,q,{value:e}),e}function Ue(t,e,n,r){const i=Pe(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 Oe(t,e,n,r){let i,o=Y(t);if(null!=(r=ye(t,o,n,r))&&r.C===nt)return(e=ge(r))!==r&&ve(t,o,n,e),e.l;if(Array.isArray(r)){const t=X(r);i=2&t?oe(de(r,t,!1),e,!0):64&t?r:oe(i,e,!0)}else i=oe(void 0,e,!0);return i!==r&&ve(t,o,n,i),i}function Le(t,e,n,r){t=t.l;let i=Y(t);return(e=Jt(r=ye(t,i,n,r),e,i))!==r&&null!=e&&ve(t,i,n,e),e}function Ne(t,e,n){if(null==(e=Le(t,e,n,!1)))return e;t=t.l;let r=Y(t);if(!(2&r)){const i=ge(e);i!==e&&ve(t,r,n,e=i)}return e}function ke(t,e,n,r,i,o){t=t.l;var s=!!(2&e);r=s?1:r,i=!!i,o&&=!s,s=Se(t,e,1);var a=X(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=Jt(c[o],n,l);if(e instanceof n){if(!t){const t=!!(2&X(e.l));r&&=!t,i&&=t}c[u++]=e}}u<o&&(c.length=u),a|=4,a=i?16|a:-17&a,Q(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=z(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=ge(a))&&(n[c]=l);o|=8,o=n.length?-17&o:16|o,Q(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&&Q(s,a),Object.freeze(s)):(u=5===r&&(!!(32&a)||Ee(a)||!!Xt?.get(s)),(2===r||u)&&Ee(a)&&(s=z(s),a=Me(a=Ce(a,e),e,i),Q(s,a),e=ve(t,e,1,s)),Ee(a)||(t=a,(a=Me(a,e,i))!==t&&Q(s,a)),u?h=Kt(s):2!==r||i||Xt?.delete(s)),h||s}function Fe(t,e){const n=Y(t.l);return ke(t,n,e,void 0===ft?2:f?4:5,!1,!(2&n))}function Ve(t,e,n,r){return null==r&&(r=void 0),be(t,n,r)}function je(t,e,n){var r=wi;null==n&&(n=void 0);t:{t=t.l;let i=Y(t);if(ct(i),null==n){const n=Pe(t);if(Be(n,t,i,r)!==e)break t;n.set(r,0)}else i=Ue(t,i,r,e);ve(t,i,e,n)}}function Ce(t,e){return-2049&(t=32|(2&e?2|t:-3&t))}function Me(t,e,n){return 32&e&&n||(t&=-33),t}function Ge(t,e){var n=ti;const r=Y(t.l);ct(r),t=ke(t,r,n,2,!0),e=null!=e?e:new n,t.push(e),2&X(e.l)?K(t,8):K(t,16)}function De(t,e){return t??e}function ze(t,e,n){{const a=t.l;let u=Y(a);if(ct(u),null==n)ve(a,u,e);else{n=Yt?.get(n)||n;var r=t=X(n),i=!!(4&t),o=Ee(t),s=o||Object.isFrozen(n);if(o||(t=0),(o=!s)&&(o=void 0===gt||void 0!==dt),o&&(n=z(n),r=0,t=Me(t=Ce(t,u),u,!0),s=!1),t|=21,!i)for(i=0;i<n.length;i++){const e=Wt(o=n[i]);Object.is(o,e)||(s&&(n=z(n),r=0,t=Me(t=Ce(t,u),u,!0),s=!1),n[i]=e)}t!==r&&(s&&(n=z(n),t=Me(t=Ce(t,u),u,!0)),Q(n,t)),ve(a,u,e,n)}}}function $e(t,e,n){ct(Y(t.l)),_e(t,e,qt,2,!0).push(Wt(n))}function Re(t,e){return Error(`Invalid wire type: ${t} (at position ${e})`)}function We(){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:U(t),A:!1};if(Array.isArray(t))return{buffer:new Uint8Array(t),A:!1};if(t.constructor===Uint8Array)return{buffer:t,A:!1};if(t.constructor===ArrayBuffer)return{buffer:new Uint8Array(t),A:!1};if(t.constructor===k)return{buffer:N(t)||new Uint8Array(0),A:!0};if(t instanceof Uint8Array)return{buffer:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),A:!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 We()}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 We()}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 We();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?1401298464324817e-60*t*i:t*Math.pow(2,r-150)*(i+8388608)}function Qe(t){return Xe(t)}function Ze(t,e,{D:n=!1}={}){t.D=n,e&&(e=qe(e),t.i=e.buffer,t.m=e.A,t.v=0,t.j=t.i.length,t.g=t.v)}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 L();var n=en(t,e);return t.D&&t.m?n=t.i.subarray(n,n+e):(t=t.i,n=n===(e=n+e)?new Uint8Array(0):St?t.slice(n,e):new Uint8Array(t.subarray(n,e))),0==n.length?L():new k(n,O)}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 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 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 Re(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=se(t,e)}toJSON(){return pn(this)}A(){return!!(2&X(this.l))}};function pn(t){t=fn?t.l:ue(t.l,ce,void 0,void 0,!1);{var e=!fn;let c=t.length;if(c){var n=t[c-1],r=ot(n);r?c--:n=void 0;var i=t;if(r){t:{var o,s=n,a=!1;if(s)for(let t in s)isNaN(+t)?(o??={})[t]=s[t]:(r=s[t],Array.isArray(r)&&(at(r)||it(r)&&0===r.size)&&(r=null),null==r&&(a=!0),null!=r&&((o??={})[t]=r));if(a||(o=s),o)for(let t in o){a=o;break t}a=null}s=null==a?null!=n:a!==n}for(;c>0&&(null==(o=i[c-1])||at(o)||it(o)&&0===o.size);c--)var u=!0;(i!==t||s||u)&&(e?(u||s||a)&&(i.length=c):i=Array.prototype.slice.call(i,0,c),a&&i.push(a)),u=i}else u=t}return u}function mn(t){return t?/^\d+$/.test(t)?(Nt(t),new yn(Et,It)):null:bn||=new yn(0,0)}gn.prototype.C=nt,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)?(Nt(t),new wn(Et,It)):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=Et;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 Bn(t,e,n){xn(t,e,2),An(t.g,n.length),Tn(t,t.g.end()),Tn(t,n)}function On(){const t=class{constructor(){throw Error()}};return Object.setPrototypeOf(t,t.prototype),t}var Ln=On(),Nn=On(),kn=On(),Fn=On(),Vn=On(),jn=On(),Cn=On(),Mn=On(),Gn=class{constructor(t,e,n){this.g=t,this.i=e,t=Ln,this.j=!!t&&n===t||!1}};function Dn(t,e){return new Gn(t,e,Ln)}function zn(t,e,n,r,i){null!=(e=Zn(e,r))&&(n=Pn(t,n),i(e,t),Un(t,n))}const $n=Dn((function(t,e,n,r,i){return 2===t.i&&(an(t,Oe(e,r,n),i),!0)}),zn),Rn=Dn((function(t,e,n,r,i){return 2===t.i&&(an(t,Oe(e,r,n,!0),i),!0)}),zn);var Wn=Symbol(),Hn=Symbol(),qn=Symbol(),Jn=Symbol();let Kn,Xn;function Yn(t,e,n,r){var i=r[t];if(i)return i;(i={}).B=function(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}}(r[0]);var o=r[1];let s=1;o&&o.constructor===Object&&(i.G=o,"function"==typeof(o=r[++s])&&(i.H=!0,Kn??=o,Xn??=r[s+1],o=r[s+=2]));const a={};for(;o&&Array.isArray(o)&&o.length&&"number"==typeof o[0]&&o[0]>0;){for(var u=0;u<o.length;u++)a[o[u]]=o;o=r[++s]}for(u=1;void 0!==o;){let t;"number"==typeof o&&(u+=o,o=r[++s]);var c=void 0;if(o instanceof Gn?t=o:(t=$n,s--),t?.j){o=r[++s],c=r;var l=s;"function"==typeof o&&(o=o(),c[l]=o),c=o}for(l=u+1,"number"==typeof(o=r[++s])&&o<0&&(l-=o,o=r[++s]);u<l;u++){const r=a[u];c?n(i,u,t,c,r):e(i,u,t,r)}}return r[t]=i}function Qn(t){return Array.isArray(t)?t[0]instanceof Gn?t:[Rn,t]:[t,void 0]}function Zn(t,e){return t instanceof gn?t.l:Array.isArray(t)?oe(t,e,!1):void 0}function tr(t,e,n,r){const i=n.g;t[e]=r?(t,e,n)=>i(t,e,n,r):i}function er(t,e,n,r,i){const o=n.g;let s,a;t[e]=(t,e,n)=>o(t,e,n,a||=Yn(Hn,tr,er,r).B,s||=nr(r),i)}function nr(t){let e=t[qn];if(null!=e)return e;const n=Yn(Hn,tr,er,t);return e=n.H?(t,e)=>Kn(t,e,n):(t,e)=>{const r=Y(t);for(;on(e)&&4!=e.i;){var i=e.m,o=n[i];if(null==o){var s=n.G;s&&(s=s[i])&&(null!=(s=rr(s))&&(o=n[i]=s))}null!=o&&o(e,t,i)||(i=(o=e).j,sn(o),o.F?o=void 0:(s=o.g.g-i,o.g.g=i,o=nn(o.g,s)),i=t,o&&(lt||=Symbol(),(s=i[lt])?s.push(o):i[lt]=[o]))}return 16384&r&&J(t,34),!0},t[qn]=e}function rr(t){const e=(t=Qn(t))[0].g;if(t=t[1]){const n=nr(t),r=Yn(Hn,tr,er,t).B;return(t,i,o)=>e(t,i,o,r,n)}return e}function ir(t,e,n){t[e]=n.i}function or(t,e,n,r){let i,o;const s=n.i;t[e]=(t,e,n)=>s(t,e,n,o||=Yn(Wn,ir,or,r).B,i||=sr(r))}function sr(t){let e=t[Jn];if(!e){const n=Yn(Wn,ir,or,t);e=(t,e)=>ar(t,e,n),t[Jn]=e}return e}function ar(t,e,n){for(var r=X(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=ur(n,o);a&&a(e,r,o)}if(256&r){r=t[o-1];for(const t in r)i=+t,Number.isNaN(i)||null!=(o=r[i])&&(a=ur(n,i))&&a(e,o,i)}if(t=lt?t[lt]:void 0)for(Tn(e,e.g.end()),n=0;n<t.length;n++)Tn(e,N(t[n])||new Uint8Array(0))}function ur(t,e){var n=t[e];if(n)return n;if((n=t.G)&&(n=n[e])){var r=(n=Qn(n))[0].i;if(n=n[1]){const e=sr(n),i=Yn(Wn,ir,or,n).B;n=t.H?Xn(i,e):(t,n,o)=>r(t,n,o,i,e)}else n=r;return t[e]=n}}function cr(t,e){if(Array.isArray(e)){var n=X(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),Q(e,-12289&(5|n)),2&n&&Object.freeze(e),e}}function lr(t,e,n){return new Gn(t,e,n)}function hr(t,e,n){return new Gn(t,e,n)}function fr(t,e,n){ve(t,Y(t),e,n)}function dr(t,e,n){if(e=function(t){if(null==t)return t;const e=typeof t;if("bigint"===e)return String(BigInt.asIntN(64,t));if(Ct(t)){if("string"===e)return zt(t);if("number"===e)return Dt(t)}}(e),null!=e){if("string"==typeof e)vn(e);if(null!=e)switch(xn(t,n,0),typeof e){case"number":t=t.g,xt(e),Sn(t,Et,It);break;case"bigint":n=BigInt.asUintN(64,e),n=new wn(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),Sn(t.g,n.i,n.g);break;default:n=vn(e),Sn(t.g,n.i,n.g)}}}function gr(t,e,n){null!=(e=Mt(e))&&null!=e&&(xn(t,n,0),En(t.g,e))}function pr(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 mr(t,e,n){null!=(e=qt(e))&&Bn(t,n,c(e))}function yr(t,e,n,r,i){null!=(e=Zn(e,r))&&(n=Pn(t,n),i(e,t),Un(t,n))}function br(t,e,n){null!=(e=null==e||"string"==typeof e||B(e)||e instanceof k?e:void 0)&&Bn(t,n,qe(e).buffer)}var vr=lr((function(t,e,n){return 5===t.i&&(fr(e,n,Ye(t.g)),!0)}),(function(t,e,n){null!=(e=Ft(e))&&(xn(t,n,5),t=t.g,Pt(e),In(t))}),jn),wr=hr((function(t,e,n){return(5===t.i||2===t.i)&&(e=Te(e,Y(e),n,!1,!1),2==t.i?ln(t,Ye,e):e.push(Ye(t.g)),!0)}),(function(t,e,n){if(null!=(e=cr(Ft,e))&&e.length){xn(t,n,2),An(t.g,4*e.length);for(let r=0;r<e.length;r++)n=t.g,Pt(e[r]),In(n)}}),jn),_r=lr((function(t,e,n){return 0===t.i&&(fr(e,n,Je(t.g,Bt)),!0)}),dr,Vn),Sr=lr((function(t,e,n){return 0===t.i&&(fr(e,n,0===(t=Je(t.g,Bt))?void 0:t),!0)}),dr,Vn),Ar=lr((function(t,e,n){return 0===t.i&&(fr(e,n,Je(t.g,Ut)),!0)}),(function(t,e,n){if(null!=(e=Rt(e))){if("string"==typeof e)mn(e);if(null!=e)switch(xn(t,n,0),typeof e){case"number":t=t.g,xt(e),Sn(t,Et,It);break;case"bigint":n=BigInt.asUintN(64,e),n=new yn(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),Sn(t.g,n.i,n.g);break;default:n=mn(e),Sn(t.g,n.i,n.g)}}}),On()),Er=lr((function(t,e,n){return 0===t.i&&(fr(e,n,Xe(t.g)),!0)}),gr,Fn),Ir=hr((function(t,e,n){return(0===t.i||2===t.i)&&(e=Te(e,Y(e),n,!1,!1),2==t.i?ln(t,Xe,e):e.push(Xe(t.g)),!0)}),(function(t,e,n){if(null!=(e=cr(Mt,e))&&e.length){n=Pn(t,n);for(let n=0;n<e.length;n++)En(t.g,e[n]);Un(t,n)}}),Fn),Tr=lr((function(t,e,n){return 0===t.i&&(fr(e,n,0===(t=Xe(t.g))?void 0:t),!0)}),gr,Fn),xr=lr((function(t,e,n){return 0===t.i&&(fr(e,n,Ke(t.g)),!0)}),pr,Nn),Pr=lr((function(t,e,n){return 0===t.i&&(fr(e,n,!1===(t=Ke(t.g))?void 0:t),!0)}),pr,Nn),Ur=hr((function(t,e,n){return 2===t.i&&(t=un(t),Te(e,Y(e),n,!1).push(t),!0)}),(function(t,e,n){if(null!=(e=cr(qt,e)))for(let s=0;s<e.length;s++){var r=t,i=n,o=e[s];null!=o&&Bn(r,i,c(o))}}),kn),Br=lr((function(t,e,n){return 2===t.i&&(fr(e,n,""===(t=un(t))?void 0:t),!0)}),mr,kn),Or=lr((function(t,e,n){return 2===t.i&&(fr(e,n,un(t)),!0)}),mr,kn),Lr=function(t,e,n=Ln){return new Gn(t,e,n)}((function(t,e,n,r,i){return 2===t.i&&(r=oe(void 0,r,!0),Te(e,Y(e),n,!0).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++)yr(t,e[o],n,r,i)})),Nr=Dn((function(t,e,n,r,i,o){return 2===t.i&&(Ue(e,X(e),o,n),an(t,e=Oe(e,r,n),i),!0)}),yr),kr=lr((function(t,e,n){return 2===t.i&&(fr(e,n,cn(t)),!0)}),br,Cn),Fr=lr((function(t,e,n){return 0===t.i&&(fr(e,n,Xe(t.g)),!0)}),(function(t,e,n){null!=(e=Mt(e))&&(e=parseInt(e,10),xn(t,n,0),En(t.g,e))}),Mn);class Vr{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.v=0,Ze(this,t,e)}clear(){this.i=null,this.m=!1,this.g=this.j=this.v=0,this.D=!1}}(t,e);this.g=t,this.j=this.g.g,this.i=this.m=-1,this.o(e)}o({F:t=!1}={}){this.F=t}}(n,r);try{const r=new t,o=r.l;nr(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 Cr=[0,Br,lr((function(t,e,n){return 2===t.i&&(fr(e,n,(t=cn(t))===L()?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&&Bn(t,n,qe(e).buffer)))}if(Array.isArray(e))return}br(t,e,n)}),Cn)];let Mr,Gr=globalThis.trustedTypes;function Dr(t){void 0===Mr&&(Mr=function(){let t=null;if(!Gr)return t;try{const e=t=>t;t=Gr.createPolicy("goog#html",{createHTML:e,createScript:e,createScriptURL:e})}catch(t){}return t}());var e=Mr;return new class{constructor(t){this.g=t}toString(){return this.g+""}}(e?e.createScriptURL(t):t)}function zr(t,...e){if(0===e.length)return Dr(t[0]);let n=t[0];for(let r=0;r<e.length;r++)n+=encodeURIComponent(e[r])+t[r+1];return Dr(n)}var $r=[0,Er,Fr,xr,-1,Ir,Fr,-1],Rr=class extends gn{constructor(){super()}},Wr=[0,xr,Or,xr,Fr,-1,hr((function(t,e,n){return(0===t.i||2===t.i)&&(e=Te(e,Y(e),n,!1,!1),2==t.i?ln(t,Qe,e):e.push(Xe(t.g)),!0)}),(function(t,e,n){if(null!=(e=cr(Mt,e))&&e.length){n=Pn(t,n);for(let n=0;n<e.length;n++)En(t.g,e[n]);Un(t,n)}}),Mn),Or,-1,[0,xr,-1],Fr,xr,-1],Hr=[0,Or,-2],qr=class extends gn{constructor(){super()}},Jr=[0],Kr=[0,Er,xr,1,xr,-3],Xr=class extends gn{constructor(t){super(t,2)}},Yr={};Yr[336783863]=[0,Or,xr,-1,Er,[0,[1,2,3,4,5,6,7],Nr,Jr,Nr,Wr,Nr,Hr,Nr,Kr,Nr,$r,Nr,[0,Or,-2],Nr,[0,Or,Fr]],[0,Or],xr,[0,[1,3],[2,4],Nr,[0,Ir],-1,Nr,[0,Ur],-1,Lr,[0,Or,-1]],Or];var Qr=[0,Sr,-1,Pr,-3,Sr,Ir,Br,Tr,Sr,-1,Pr,Tr,Pr,-2,Br];function Zr(t){$e(t,3,"TEXT:text_in")}var ti=class extends gn{constructor(t){super(t,500)}o(t){return Ve(this,0,7,t)}},ei=[-1,{}],ni=[0,Or,1,ei],ri=[0,Or,Ur,ei];function ii(t){$e(t,10,"text_in")}var oi,si=class extends gn{constructor(){super(void 0,500)}o(t){return Ve(this,0,1001,t)}};si.prototype.g=(oi=[-500,Lr,[-500,Br,-1,Ur,-3,[-2,Yr,xr],Lr,Cr,Tr,-1,ni,ri,Lr,[0,Br,Pr],Br,Qr,Tr,Ur,987,Ur],4,Lr,[-500,Or,-1,[-1,{}],998,Or],Lr,[-500,Or,Ur,-1,[-2,{},xr],997,Ur,-1],Tr,Lr,[-500,Or,Ur,ei,998,Ur],Ur,Tr,ni,ri,Lr,[0,Br,-1,ei],Ur,-2,Qr,Br,-1,Pr,979,ei,Lr,Cr],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}}}};ar(this.l,t,Yn(Wn,ir,or,oi)),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 ai=class extends gn{constructor(t){super(t)}},ui=class extends gn{constructor(t){super(t)}g(){return Fe(this,ai)}},ci=class extends gn{constructor(t){super(t)}},li=jr(class extends gn{constructor(t){super(t)}},[0,Lr,[0,1,Er,Or,[0,Lr,[0,Er,vr,Or,-1]]],_r]),hi=class extends gn{constructor(t){super(t)}},fi=class extends gn{constructor(t){super(t)}I(){const t=we(this);return null==t?L():t}},di=class extends gn{constructor(t){super(t)}},gi=[1,2],pi=jr(class extends gn{constructor(t){super(t)}},[0,Lr,[0,gi,Nr,[0,wr],Nr,[0,kr],Er,Or],_r]),mi=class extends gn{constructor(t){super(t)}},yi=class extends gn{constructor(t){super(t)}},bi=[0,xr,-1],vi=class extends gn{constructor(t){super(t)}},wi=[1,2,3,4,5],_i=class extends gn{constructor(t){super(t)}g(){return null!=we(this)}i(){return null!=qt(pe(this,2))}},Si=class extends gn{constructor(t){super(t)}},Ai=[0,[0,kr,Or,[0,Er,_r,-1],[0,Ar,_r]],xr,[0,wi,Nr,Kr,Nr,Wr,Nr,$r,Nr,Jr,Nr,Hr],Fr],Ei=class extends gn{constructor(t){super(t)}},Ii=new Vr(462704549,Ei);Yr[462704549]=[0,Ai,[0,Or,Er,vr,Ur,-1]];var Ti=class extends gn{constructor(t){super(t)}},xi=new Vr(477589892,Ti);function Pi(t,e){if(e=e?he(e):new mi,void 0!==t.displayNamesLocale?be(e,1,Ht(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 G();if(!Number.isFinite(n))throw G();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 Ui(t){const e={classifications:Fe(t,ci).map((t=>function(t,e=-1,n=""){return{categories:t.map((t=>{var e=De(Mt(pe(t,1)),0)??-1;const n=t.l;let r=Y(n);const i=ye(n,r,2),o=Ft(i);return null!=o&&o!==i&&ve(n,r,2,o),{index:e,score:o??0??0,categoryName:De(qt(pe(t,3)),"")??"",displayName:De(qt(pe(t,4)),"")??""}})),headIndex:e,headName:n}}(Ne(t,ui,4)?.g()??[],De(Mt(pe(t,2)),0),De(qt(pe(t,3)),""))))};return null!=$t(pe(t,2))&&(e.timestampMs=De($t(pe(t,2)),0)),e}function Bi(t){return Array.from(t,(t=>t>127?t-256:t))}function Oi(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 Li;Yr[477589892]=[0,Ai,bi];const Ni=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 ki(){if(void 0===Li)try{await WebAssembly.instantiate(Ni),Li=!0}catch{Li=!1}return Li}async function Fi(t,e=zr``){const n=await ki()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${e}/${t}_${n}.js`,wasmBinaryPath:`${e}/${t}_${n}.wasm`}}var Vi=class{};function ji(){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 Ci(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())}Vi.forVisionTasks=function(t){return Fi("vision",t)},Vi.forTextTasks=function(t){return Fi("text",t)},Vi.forGenAiExperimentalTasks=function(t){return Fi("genai_experimental",t)},Vi.forGenAiTasks=function(t){return Fi("genai",t)},Vi.forAudioTasks=function(t){return Fi("audio",t)},Vi.isSimdSupported=function(){return ki()};function Mi(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 Gi(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 Di(t,e,n){t.h.simpleListeners=t.h.simpleListeners||{},t.h.simpleListeners[e]=n}function zi(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 $i=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:ji()?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?'),Mi(this,r||"input_audio",(r=>{Mi(this,i=i||"audio_header",(i=>{this.h._configureAudio(r,i,t,e??0,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),Mi(this,r,(t=>{this.h._addAudioToInputStream(this.g,e,n,t,i)}))}addGpuBufferToStream(t,e,n){Mi(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){Mi(this,e,(e=>{this.h._addBoolToInputStream(t,e,n)}))}addDoubleToStream(t,e,n){Mi(this,e,(e=>{this.h._addDoubleToInputStream(t,e,n)}))}addFloatToStream(t,e,n){Mi(this,e,(e=>{this.h._addFloatToInputStream(t,e,n)}))}addIntToStream(t,e,n){Mi(this,e,(e=>{this.h._addIntToInputStream(t,e,n)}))}addUintToStream(t,e,n){Mi(this,e,(e=>{this.h._addUintToInputStream(t,e,n)}))}addStringToStream(t,e,n){Mi(this,e,(e=>{Mi(this,t,(t=>{this.h._addStringToInputStream(t,e,n)}))}))}addStringRecordToStream(t,e,n){Mi(this,e,(e=>{Gi(this,Object.keys(t),(r=>{Gi(this,Object.values(t),(i=>{this.h._addFlatHashMapToInputStream(r,i,Object.keys(t).length,e,n)}))}))}))}addProtoToStream(t,e,n,r){Mi(this,n,(n=>{Mi(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){Mi(this,t,(t=>{this.h._addEmptyPacketToInputStream(t,e)}))}addBoolVectorToStream(t,e,n){Mi(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){Mi(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){Mi(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){Mi(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){Mi(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){Mi(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)Mi(this,e,(t=>{this.h._addStringVectorEntry(r,t)}));this.h._addStringVectorToInputStream(r,e,n)}))}addBoolToInputSidePacket(t,e){Mi(this,e,(e=>{this.h._addBoolToInputSidePacket(t,e)}))}addDoubleToInputSidePacket(t,e){Mi(this,e,(e=>{this.h._addDoubleToInputSidePacket(t,e)}))}addFloatToInputSidePacket(t,e){Mi(this,e,(e=>{this.h._addFloatToInputSidePacket(t,e)}))}addIntToInputSidePacket(t,e){Mi(this,e,(e=>{this.h._addIntToInputSidePacket(t,e)}))}addUintToInputSidePacket(t,e){Mi(this,e,(e=>{this.h._addUintToInputSidePacket(t,e)}))}addStringToInputSidePacket(t,e){Mi(this,e,(e=>{Mi(this,t,(t=>{this.h._addStringToInputSidePacket(t,e)}))}))}addProtoToInputSidePacket(t,e,n){Mi(this,n,(n=>{Mi(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){Mi(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){Mi(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){Mi(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){Mi(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){Mi(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){Mi(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)Mi(this,e,(t=>{this.h._addStringVectorEntry(n,t)}));this.h._addStringVectorToInputSidePacket(n,e)}))}attachBoolListener(t,e){Di(this,t,e),Mi(this,t,(t=>{this.h._attachBoolListener(t)}))}attachBoolVectorListener(t,e){zi(this,t,e),Mi(this,t,(t=>{this.h._attachBoolVectorListener(t)}))}attachIntListener(t,e){Di(this,t,e),Mi(this,t,(t=>{this.h._attachIntListener(t)}))}attachIntVectorListener(t,e){zi(this,t,e),Mi(this,t,(t=>{this.h._attachIntVectorListener(t)}))}attachUintListener(t,e){Di(this,t,e),Mi(this,t,(t=>{this.h._attachUintListener(t)}))}attachUintVectorListener(t,e){zi(this,t,e),Mi(this,t,(t=>{this.h._attachUintVectorListener(t)}))}attachDoubleListener(t,e){Di(this,t,e),Mi(this,t,(t=>{this.h._attachDoubleListener(t)}))}attachDoubleVectorListener(t,e){zi(this,t,e),Mi(this,t,(t=>{this.h._attachDoubleVectorListener(t)}))}attachFloatListener(t,e){Di(this,t,e),Mi(this,t,(t=>{this.h._attachFloatListener(t)}))}attachFloatVectorListener(t,e){zi(this,t,e),Mi(this,t,(t=>{this.h._attachFloatVectorListener(t)}))}attachStringListener(t,e){Di(this,t,e),Mi(this,t,(t=>{this.h._attachStringListener(t)}))}attachStringVectorListener(t,e){zi(this,t,e),Mi(this,t,(t=>{this.h._attachStringVectorListener(t)}))}attachProtoListener(t,e,n){Di(this,t,e),Mi(this,t,(t=>{this.h._attachProtoListener(t,n||!1)}))}attachProtoVectorListener(t,e,n){zi(this,t,e),Mi(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?'),Di(this,t,((t,n)=>{t=new Float32Array(t.buffer,t.byteOffset,t.length/4),e(t,n)})),Mi(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 Ri=class extends $i{};async function Wi(t,e,n){return t=await(async(t,e,n,r)=>{if(e&&await Ci(e),!self.ModuleFactory)throw Error("ModuleFactory not set.");if(n&&(await Ci(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 Hi(t,e,n){return Wi(t,e,n)}function qi(t,e){const n=Ne(t.baseOptions,_i,1)||new _i;"string"==typeof e?(be(n,2,Ht(e)),be(n,1)):e instanceof Uint8Array&&(be(n,1,st(e,!1)),be(n,2)),Ve(t.baseOptions,0,1,n)}function Ji(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,_i,1)?.g()||Ne(t.baseOptions,_i,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,vi,3);if(!n){var r=n=new vi;je(r,4,new qr)}"delegate"in e&&("GPU"===e.delegate?je(e=n,2,r=new Rr):je(e=n,4,r=new qr)),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),qi(t,"/model.dat"),t.v()}));if(n.modelAssetBuffer instanceof Uint8Array)qi(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=>{qi(t,e),t.v()}));return t.v(),Promise.resolve()}function Ki(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 Xi(t,e){t.j=Math.max(t.j,e)}var Yi=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),Ki(this)}finishProcessing(){this.g.finishProcessing(),Ki(this)}close(){this.g.closeGraph()}};Yi.prototype.close=Yi.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",Yi);var Qi=class extends Yi{constructor(t,e){super(new Ri(t,e)),this.u={languages:[]},Ve(t=this.i=new Ei,0,1,e=new Si)}o(t){return Ve(this.i,0,2,Pi(t,Ne(this.i,mi,2))),Ji(this,t)}get baseOptions(){return Ne(this.i,Si,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}v(){var t=new si;ii(t),$e(t,15,"classifications_out");const e=new Xr;dn(e,Ii,this.i);const n=new ti;Ie(n,Ht("mediapipe.tasks.text.text_classifier.TextClassifierGraph")),Zr(n),$e(n,4,"CLASSIFICATIONS:classifications_out"),n.o(e),Ge(t,n),this.g.attachProtoListener("classifications_out",((t,e)=>{if(({classifications:t}=Ui(li(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}))),Xi(this,e)})),this.g.attachEmptyPacketListener("classifications_out",(t=>{Xi(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Qi.prototype.detect=Qi.prototype.K,Qi.prototype.setOptions=Qi.prototype.o,Qi.createFromModelPath=function(t,e){return Hi(Qi,t,{baseOptions:{modelAssetPath:e}})},Qi.createFromModelBuffer=function(t,e){return Hi(Qi,t,{baseOptions:{modelAssetBuffer:e}})},Qi.createFromOptions=function(t,e){return Hi(Qi,t,e)};var Zi=class extends Yi{constructor(t,e){super(new Ri(t,e)),this.u={classifications:[]},Ve(t=this.i=new Ei,0,1,e=new Si)}o(t){return Ve(this.i,0,2,Pi(t,Ne(this.i,mi,2))),Ji(this,t)}get baseOptions(){return Ne(this.i,Si,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}v(){var t=new si;ii(t),$e(t,15,"classifications_out");const e=new Xr;dn(e,Ii,this.i);const n=new ti;Ie(n,Ht("mediapipe.tasks.text.text_classifier.TextClassifierGraph")),Zr(n),$e(n,4,"CLASSIFICATIONS:classifications_out"),n.o(e),Ge(t,n),this.g.attachProtoListener("classifications_out",((t,e)=>{this.u=Ui(li(t)),Xi(this,e)})),this.g.attachEmptyPacketListener("classifications_out",(t=>{Xi(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Zi.prototype.classify=Zi.prototype.J,Zi.prototype.setOptions=Zi.prototype.o,Zi.createFromModelPath=function(t,e){return Hi(Zi,t,{baseOptions:{modelAssetPath:e}})},Zi.createFromModelBuffer=function(t,e){return Hi(Zi,t,{baseOptions:{modelAssetBuffer:e}})},Zi.createFromOptions=function(t,e){return Hi(Zi,t,e)};var to=class extends Yi{constructor(t,e){super(new Ri(t,e)),this.u={embeddings:[]},Ve(t=this.i=new Ti,0,1,e=new Si)}o(t){var e=this.i,n=Ne(this.i,yi,2);return n=n?he(n):new yi,void 0!==t.l2Normalize?be(n,1,Vt(t.l2Normalize)):"l2Normalize"in t&&be(n,1),void 0!==t.quantize?be(n,2,Vt(t.quantize)):"quantize"in t&&be(n,2),Ve(e,0,2,n),Ji(this,t)}get baseOptions(){return Ne(this.i,Si,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}v(){var t=new si;ii(t),$e(t,15,"embeddings_out");const e=new Xr;dn(e,xi,this.i);const n=new ti;Ie(n,Ht("mediapipe.tasks.text.text_embedder.TextEmbedderGraph")),Zr(n),$e(n,4,"EMBEDDINGS:embeddings_out"),n.o(e),Ge(t,n),this.g.attachProtoListener("embeddings_out",((t,e)=>{t=pi(t),this.u=function(t){return{embeddings:Fe(t,di).map((t=>{const e={headIndex:De(Mt(pe(t,3)),0)??-1,headName:De(qt(pe(t,4)),"")??""};if(void 0!==Le(t,hi,xe(t,1)))e.floatEmbedding=_e(Ne(t,hi,xe(t,1)),1,Ft,void 0===ft?2:f?4:5).slice();else{const n=new Uint8Array(0);e.quantizedEmbedding=Ne(t,fi,xe(t,2))?.I()?.i()??n}return e})),timestampMs:De($t(pe(t,2)),0)}}(t),Xi(this,e)})),this.g.attachEmptyPacketListener("embeddings_out",(t=>{Xi(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};to.cosineSimilarity=function(t,e){if(t.floatEmbedding&&e.floatEmbedding)t=Oi(t.floatEmbedding,e.floatEmbedding);else{if(!t.quantizedEmbedding||!e.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");t=Oi(Bi(t.quantizedEmbedding),Bi(e.quantizedEmbedding))}return t},to.prototype.embed=to.prototype.L,to.prototype.setOptions=to.prototype.o,to.createFromModelPath=function(t,e){return Hi(to,t,{baseOptions:{modelAssetPath:e}})},to.createFromModelBuffer=function(t,e){return Hi(to,t,{baseOptions:{modelAssetBuffer:e}})},to.createFromOptions=function(t,e){return Hi(to,t,e)},exports.FilesetResolver=Vi,exports.LanguageDetector=Qi,exports.TextClassifier=Zi,exports.TextEmbedder=to;
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(653718497,e(1,!0));const d=t.navigator;function g(t){return!!h&&(!!l&&l.brands.some((({brand:e})=>e&&-1!=e.indexOf(t))))}function p(e){var n;return(n=t.navigator)&&(n=n.userAgent)||(n=""),-1!=n.indexOf(e)}function m(){return!!h&&(!!l&&l.brands.length>0)}function y(){return m()?g("Chromium"):(p("Chrome")||p("CriOS"))&&!(!m()&&p("Edge"))||p("Silk")}l=d&&d.userAgentData||null;var b=!m()&&(p("Trident")||p("MSIE"));!p("Android")||y(),y(),p("Safari")&&(y()||!m()&&p("Coast")||!m()&&p("Opera")||!m()&&p("Edge")||(m()?g("Microsoft Edge"):p("Edg/"))||m()&&g("Opera"));var v={},w=null;function _(t){const e=t.length;let 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);const r=new Uint8Array(n);let i=0;return function(t,e){function n(e){for(;r<t.length;){const e=t.charAt(r++),n=w[e];if(null!=n)return n;if(!/^[\s\xa0]*$/.test(e))throw Error("Unknown base64 encoding at char: "+e)}return e}S();let r=0;for(;;){const t=n(-1),r=n(0),i=n(64),o=n(64);if(64===o&&-1===t)break;e(t<<2|r>>4),64!=i&&(e(r<<4&240|i>>2),64!=o&&e(i<<6&192|o))}}(t,(function(t){r[i++]=t})),i!==n?r.subarray(0,i):r}function S(){if(!w){w={};var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),e=["+/=","+/","-_=","-_.","-_"];for(let n=0;n<5;n++){const r=t.concat(e[n].split(""));v[n]=r;for(let t=0;t<r.length;t++){const e=r[t];void 0===w[e]&&(w[e]=t)}}}}var A="undefined"!=typeof Uint8Array,E=!b&&"function"==typeof btoa;function I(t){if(!E){var e;void 0===e&&(e=0),S(),e=v[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 T=/[-_.]/g,x={"-":"+",_:"/",".":"="};function P(t){return x[t]||""}function U(t){if(!E)return _(t);T.test(t)&&(t=t.replace(T,P)),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 A&&null!=t&&t instanceof Uint8Array}var O={};function L(){return F||=new k(null,O)}function N(t){j(O);var e=t.g;return null==(e=null==e||B(e)?e:"string"==typeof e?U(e):null)?e:t.g=e}var k=class{i(){return new Uint8Array(N(this)||0)}constructor(t,e){if(j(e),this.g=t,null!=t&&0===t.length)throw Error("ByteString should be constructed with non-empty values")}};let F,V;function j(t){if(t!==O)throw Error("illegal external caller")}function C(t,e){t.__closure__error__context__984382||(t.__closure__error__context__984382={}),t.__closure__error__context__984382.severity=e}function M(){const e=Error();C(e,"incident"),function(e){t.setTimeout((()=>{throw e}),0)}(e)}function G(){const t=Error("int32");return C(t,"warning"),t}function D(){return"function"==typeof BigInt}function $(t){return Array.prototype.slice.call(t)}var z="function"==typeof Symbol&&"symbol"==typeof Symbol();function R(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol()?Symbol():t}var W=R(),H=R("2ex"),q=R("1oa"),J=z?(t,e)=>{t[W]|=e}:(t,e)=>{void 0!==t.s?t.s|=e:Object.defineProperties(t,{s:{value:e,configurable:!0,writable:!0,enumerable:!1}})},K=z?(t,e)=>{t[W]&=~e}:(t,e)=>{void 0!==t.s&&(t.s&=~e)},X=z?t=>0|t[W]:t=>0|t.s,Y=z?t=>t[W]:t=>t.s,Q=z?(t,e)=>{t[W]=e}:(t,e)=>{void 0!==t.s?t.s=e:Object.defineProperties(t,{s:{value:e,configurable:!0,writable:!0,enumerable:!1}})};function Z(t,e){Q(e,-30975&(0|t))}function tt(t,e){Q(e,-30941&(34|t))}var et,nt={},rt={};function it(t){return!(!t||"object"!=typeof t||t.g!==rt)}function ot(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)&&t.constructor===Object}function st(t,e){if(null!=t)if("string"==typeof t)t=t?new k(t,O):L();else if(t.constructor!==k)if(B(t))t=t.length?new k(new Uint8Array(t),O):L();else{if(!e)throw Error();t=void 0}return t}function at(t){return!(!Array.isArray(t)||t.length)&&!!(1&X(t))}const ut=[];function ct(t){if(2&t)throw Error()}let lt;function ht(t,e){(e=lt?e[lt]:void 0)&&(t[lt]=$(e))}Q(ut,55),et=Object.freeze(ut);var ft=Object.freeze({}),dt="function"==typeof t.BigInt&&"bigint"==typeof t.BigInt(0),gt=t=>dt?t>=mt&&t<=bt:"-"===t[0]?vt(t,pt):vt(t,yt);const pt=Number.MIN_SAFE_INTEGER.toString(),mt=dt?BigInt(Number.MIN_SAFE_INTEGER):void 0,yt=Number.MAX_SAFE_INTEGER.toString(),bt=dt?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}}const wt="function"==typeof Uint8Array.prototype.slice;let _t,St=0,At=0;function Et(t){const e=t>>>0;St=e,At=(t-e)/4294967296>>>0}function It(t){if(t<0){Et(-t);const[e,n]=Lt(St,At);St=e>>>0,At=n>>>0}else Et(t)}function Tt(t){const e=_t||=new DataView(new ArrayBuffer(8));e.setFloat32(0,+t,!0),At=0,St=e.getUint32(0,!0)}function xt(t,e){const n=4294967296*e+(t>>>0);return Number.isSafeInteger(n)?n:Ut(t,e)}function Pt(t,e){const n=2147483648&e;return n&&(e=~e>>>0,0==(t=1+~t>>>0)&&(e=e+1>>>0)),"number"==typeof(t=xt(t,e))?n?-t:t:n?"-"+t:t}function Ut(t,e){if(t>>>=0,(e>>>=0)<=2097151)var n=""+(4294967296*e+t);else D()?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+Bt(n)+Bt(t));return n}function Bt(t){return t=String(t),"0000000".slice(t.length)+t}function Ot(t){if(t.length<16)It(Number(t));else if(D())t=BigInt(t),St=Number(t&BigInt(4294967295))>>>0,At=Number(t>>BigInt(32)&BigInt(4294967295));else{const e=+("-"===t[0]);At=St=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));At*=1e6,St=1e6*St+e,St>=4294967296&&(At+=Math.trunc(St/4294967296),At>>>=0,St>>>=0)}if(e){const[t,e]=Lt(St,At);St=t,At=e}}}function Lt(t,e){return e=~e,t?t=1+~t:e+=1,[t,e]}function Nt(t){return null==t||"number"==typeof t?t:"NaN"===t||"Infinity"===t||"-Infinity"===t?Number(t):void 0}function kt(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 Ft=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Vt(t){const e=typeof t;switch(e){case"bigint":return!0;case"number":return Number.isFinite(t)}return"string"===e&&Ft.test(t)}function jt(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 Ct(t){return"-"!==t[0]&&(t.length<20||20===t.length&&Number(t.substring(0,6))<184467)}function Mt(t){return t=Math.trunc(t),Number.isSafeInteger(t)||(It(t),t=Pt(St,At)),t}function Gt(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(Ot(t),t=St,2147483648&(e=At))if(D())t=""+(BigInt(0|e)<<BigInt(32)|BigInt(t>>>0));else{const[n,r]=Lt(t,e);t="-"+Ut(n,r)}else t=Ut(t,e);return t}function Dt(t){return null==t?t:"bigint"==typeof t?(gt(t)?t=Number(t):(t=BigInt.asIntN(64,t),t=gt(t)?Number(t):String(t)),t):Vt(t)?"number"==typeof t?Mt(t):Gt(t):void 0}function $t(t){if(null==t)return t;var e=typeof t;if("bigint"===e)return String(BigInt.asUintN(64,t));if(Vt(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)),Ct(t)||(Ot(t),t=Ut(St,At))),t;if("number"===e)return(t=Math.trunc(t))>=0&&Number.isSafeInteger(t)?t:function(t){if(t<0){It(t);var e=Ut(St,At);return t=Number(e),Number.isSafeInteger(t)?t:e}return Ct(e=String(t))?e:(It(t),xt(St,At))}(t)}}function zt(t){if("string"!=typeof t)throw Error();return t}function Rt(t){if(null!=t&&"string"!=typeof t)throw Error();return t}function Wt(t){return null==t||"string"==typeof t?t:void 0}function Ht(t,e,n){if(null!=t&&"object"==typeof t&&t.C===nt)return t;if(Array.isArray(t)){var r=X(t),i=r;return 0===i&&(i|=32&n),(i|=2&n)!==r&&Q(t,i),new e(t)}}function qt(t){var e;return void 0===Xt&&(Xt="function"==typeof Proxy?ne(Proxy):null),(e=!Xt)||(void 0===Yt&&(Yt="function"==typeof WeakMap?ne(WeakMap):null),e=!Yt),e?t:(e=Jt?.get(t))?e:Math.random()>.01?t:(function(t){if(void 0===Qt){const t=new Xt([],{});Qt=1===Array.prototype.concat.call([],t).length}Qt&&"function"==typeof Symbol&&Symbol.isConcatSpreadable&&(t[Symbol.isConcatSpreadable]=!0)}(t),function(t,e){(Jt||=new Yt).set(t,e),(Kt||=new Yt).set(e,t)}(t,e=new Xt(t,{set:(t,e,n)=>(M(),t[e]=n,!0)})),e)}let Jt,Kt,Xt,Yt,Qt,Zt,te,ee;function ne(t){try{return-1!==t.toString().indexOf("[native code]")?t:null}catch{return null}}function re(t,e,n){return t=ie(t,e[0],e[1],n?1:2),e!==te&&n&&J(t,16384),t}function ie(t,e,n,r){if(r=r??0,null==t&&(t=Zt),Zt=void 0,null==t){var i=96;n?(t=[n],i|=512):t=[],e&&(i=-33521665&i|(1023&e)<<15)}else{if(!Array.isArray(t))throw Error("narr");if(2048&(i=X(t)))throw Error("farr");if(64&i)return t;if(1===r||2===r||(i|=64),n&&(i|=512,n!==t[0]))throw Error("mid");t:{if(r=(n=t).length){const t=r-1;if(ot(n[t])){if((e=t-(+!!(512&(i|=256))-1))>=1024)throw Error("pvtlmt");i=-33521665&i|(1023&e)<<15;break t}}if(e){if((e=Math.max(e,r-(+!!(512&i)-1)))>1024)throw Error("spvt");i=-33521665&i|(1023&e)<<15}}}return Q(t,i),t}function oe(t,e,n,r,i){if(null!=t){if(Array.isArray(t))t=at(t)?void 0:i&&2&X(t)?t:se(t,e,n,void 0!==r,i);else if(ot(t)){const o={};for(let s in t)o[s]=oe(t[s],e,n,r,i);t=o}else t=e(t,r);return t}}function se(t,e,n,r,i){const o=r||n?X(t):0;r=r?!!(32&o):void 0;const s=$(t);for(let t=0;t<s.length;t++)s[t]=oe(s[t],e,n,r,i);return n&&(ht(s,t),n(o,s)),s}function ae(t){return t.C===nt?t.toJSON():function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"bigint":return gt(t)?Number(t):String(t);case"boolean":return t?1:0;case"object":if(t)if(Array.isArray(t)){if(at(t))return}else{if(B(t))return I(t);if(t instanceof k){const e=t.g;return null==e?"":"string"==typeof e?e:t.g=I(e)}}}return t}(t)}function ue(t,e,n=tt){if(null!=t){if(A&&t instanceof Uint8Array)return e?t:new Uint8Array(t);if(Array.isArray(t)){var r=X(t);return 2&r?t:(e&&=0===r||!!(32&r)&&!(64&r||!(16&r)),e?(Q(t,-12293&(34|r)),t):se(t,ue,4&r?tt:n,!0,!0))}return t.C===nt&&(n=t.l,t=2&(r=Y(n))?t:le(t,n,r,!0)),t}}function ce(t){const e=t.l;return le(t,e,Y(e),!1)}function le(t,e,n,r){return t=t.constructor,Zt=e=he(e,n,r),e=new t(e),Zt=void 0,e}function he(t,e,n){const r=n||2&e?tt:Z,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 ht(r,t),r}(t,e,(t=>ue(t,i,r))),J(t,32|(n?2:0)),t}function fe(t){const e=t.l,n=Y(e);return 2&n?le(t,e,n,!1):t}function de(t,e){return pe(t=t.l,Y(t),e)}function ge(t,e,n,r){if(!((e=r+(+!!(512&e)-1))<0||e>=t.length||e>=n))return t[e]}function pe(t,e,n,r){if(-1===n)return null;const i=e>>15&1023||536870912;if(!(n>=i)){var o=t.length;return r&&256&e&&null!=(r=t[o-1][n])?(ge(t,e,i,n)&&null!=H&&((e=(t=V??={})[H]||0)>=4||(t[H]=e+1,M())),r):ge(t,e,i,n)}return 256&e?t[t.length-1][n]:void 0}function me(t,e,n){const r=t.l;let i=Y(r);return ct(i),ye(r,i,e,n),t}function ye(t,e,n,r){const i=e>>15&1023||536870912;if(n>=i){let o,s=e;if(256&e)o=t[t.length-1];else{if(null==r)return s;o=t[i+(+!!(512&e)-1)]={},s|=256}return o[n]=r,n<i&&(t[n+(+!!(512&e)-1)]=void 0),s!==e&&Q(t,s),s}return t[n+(+!!(512&e)-1)]=r,256&e&&(n in(t=t[t.length-1])&&delete t[n]),e}function be(t){t=t.l;let e=Y(t);const n=pe(t,e,1),r=st(n,!0);return null!=r&&r!==n&&ye(t,e,1,r),r}function ve(t,e,n,r,i){const o=t.l,s=2&(t=Y(o))?1:r;i=!!i,r=we(o,t,e);var a=X(r);if(!(4&a)){4&a&&(r=$(r),a=je(a,t),t=ye(o,t,e,r));let i=0,s=0;for(;i<r.length;i++){const t=n(r[i]);null!=t&&(r[s++]=t)}s<i&&(r.length=s),a=-4097&(20|(a=_e(a,t))),Q(r,a&=-8193),2&a&&Object.freeze(r)}let u;return 1===s||4===s&&32&a?Se(a)||(i=a,(a|=2)!==i&&Q(r,a),Object.freeze(r)):(n=5===s&&(!!(32&a)||Se(a)||!!Jt?.get(r)),(2===s||n)&&Se(a)&&(r=$(r),a=Ce(a=je(a,t),t,i),Q(r,a),t=ye(o,t,e,r)),Se(a)||(e=a,(a=Ce(a,t,i))!==e&&Q(r,a)),n?u=qt(r):2!==s||i||Jt?.delete(r)),u||r}function we(t,e,n,r){return t=pe(t,e,n,r),Array.isArray(t)?t:et}function _e(t,e){return 0===t&&(t=je(t,e)),1|t}function Se(t){return!!(2&t)&&!!(4&t)||!!(2048&t)}function Ae(t,e,n){t=t.l;let r=Y(t);if(ct(r),null==n)ye(t,r,e);else{n=Kt?.get(n)||n;var i=X(n),o=i,s=!!(4&i),a=Se(i),u=a||Object.isFrozen(n);if(a||(i=0),u||(n=$(n),o=0,i=Ce(i=je(i,r),r,!0),u=!1),i|=21,!s)for(s=0;s<n.length;s++){const t=zt(a=n[s]);Object.is(a,t)||(u&&(n=$(n),o=0,i=Ce(i=je(i,r),r,!0),u=!1),n[s]=t)}i!==o&&(u&&(n=$(n),i=Ce(i=je(i,r),r,!0)),Q(n,i)),ye(t,r,e,n)}}function Ee(t,e){t=t.l;let n=Y(t);ct(n),ye(t,n,2,""===e?void 0:e)}function Ie(t,e,n,r,i){ct(e);var o=!(!(64&e)&&16384&e);const s=(i=we(t,e,n,i))!==et;if(o||!s){let a=o=s?X(i):0;(!s||2&a||Se(a)||4&a&&!(32&a))&&(i=$(i),a=je(a,e),e=ye(t,e,n,i)),a=-13&_e(a,e),a=Ce(r?-17&a:16|a,e,!0),a!==o&&Q(i,a)}return i}function Te(t,e){var n=fi;return Ue(xe(t=t.l),t,Y(t),n)===e?e:-1}function xe(t){if(z)return t[q]??(t[q]=new Map);if(q in t)return t[q];const e=new Map;return Object.defineProperty(t,q,{value:e}),e}function Pe(t,e,n,r){const i=xe(t),o=Ue(i,t,e,n);return o!==r&&(o&&(e=ye(t,e,o)),i.set(n,r)),e}function Ue(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!=pe(e,n,o)&&(0!==i&&(n=ye(e,n,i)),i=o)}return t.set(r,i),i}function Be(t,e,n,r){let i,o=Y(t);if(null!=(r=pe(t,o,n,r))&&r.C===nt)return(e=fe(r))!==r&&ye(t,o,n,e),e.l;if(Array.isArray(r)){const t=X(r);i=2&t?re(he(r,t,!1),e,!0):64&t?r:re(i,e,!0)}else i=re(void 0,e,!0);return i!==r&&ye(t,o,n,i),i}function Oe(t,e,n,r){t=t.l;let i=Y(t);return(e=Ht(r=pe(t,i,n,r),e,i))!==r&&null!=e&&ye(t,i,n,e),e}function Le(t,e,n){if(null==(e=Oe(t,e,n,!1)))return e;t=t.l;let r=Y(t);if(!(2&r)){const i=fe(e);i!==e&&ye(t,r,n,e=i)}return e}function Ne(t,e,n,r,i,o){t=t.l;var s=!!(2&e);r=s?1:r,i=!!i,o&&=!s,s=we(t,e,1);var a=X(s),u=!!(4&a);if(!u){var c=s,l=e;const t=!!(2&(a=_e(a,e)));t&&(l|=2);let r=!t,i=!0,o=0,u=0;for(;o<c.length;o++){const e=Ht(c[o],n,l);if(e instanceof n){if(!t){const t=!!(2&X(e.l));r&&=!t,i&&=t}c[u++]=e}}u<o&&(c.length=u),a|=4,a=i?16|a:-17&a,Q(c,a=r?8|a:-9&a),t&&Object.freeze(c)}if(o&&!(8&a||!s.length&&(1===r||4===r&&32&a))){for(Se(a)&&(s=$(s),a=je(a,e),e=ye(t,e,1,s)),n=s,o=a,c=0;c<n.length;c++)(a=n[c])!==(l=fe(a))&&(n[c]=l);o|=8,o=n.length?-17&o:16|o,Q(n,o),a=o}let h;return 1===r||4===r&&32&a?Se(a)||(e=a,(a|=!s.length||16&a&&(!u||32&a)?2:2048)!==e&&Q(s,a),Object.freeze(s)):(u=5===r&&(!!(32&a)||Se(a)||!!Jt?.get(s)),(2===r||u)&&Se(a)&&(s=$(s),a=Ce(a=je(a,e),e,i),Q(s,a),e=ye(t,e,1,s)),Se(a)||(t=a,(a=Ce(a,e,i))!==t&&Q(s,a)),u?h=qt(s):2!==r||i||Jt?.delete(s)),h||s}function ke(t,e){const n=Y(t.l);return Ne(t,n,e,void 0===ft?2:f?4:5,!1,!(2&n))}function Fe(t,e,n,r){return null==r&&(r=void 0),me(t,n,r)}function Ve(t,e,n){var r=bi;null==n&&(n=void 0);t:{t=t.l;let i=Y(t);if(ct(i),null==n){const n=xe(t);if(Ue(n,t,i,r)!==e)break t;n.set(r,0)}else i=Pe(t,i,r,e);ye(t,i,e,n)}}function je(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 Me(t,e){var n=Qr;const r=Y(t.l);ct(r),t=Ne(t,r,n,2,!0),e=null!=e?e:new n,t.push(e),2&X(e.l)?K(t,8):K(t,16)}function Ge(t,e){return t??e}function De(t,e,n){ct(Y(t.l)),ve(t,e,Wt,2,!0).push(zt(n))}function $e(t,e){return Error(`Invalid wire type: ${t} (at position ${e})`)}function ze(){return Error("Failed to read varint, encoding is invalid.")}function Re(t,e){return Error(`Tried to read past the end of the data ${e} > ${t}`)}function We(t){if("string"==typeof t)return{buffer:U(t),A:!1};if(Array.isArray(t))return{buffer:new Uint8Array(t),A:!1};if(t.constructor===Uint8Array)return{buffer:t,A:!1};if(t.constructor===ArrayBuffer)return{buffer:new Uint8Array(t),A:!1};if(t.constructor===k)return{buffer:N(t)||new Uint8Array(0),A:!0};if(t instanceof Uint8Array)return{buffer:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),A:!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 He(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(Qe(t,a),n<128)return e(r>>>0,i>>>0);throw ze()}function qe(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 Qe(t,n),!!(127&e)}throw ze()}function Je(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 ze();return Qe(t,n),i}function Ke(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],Qe(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?1401298464324817e-60*t*i:t*Math.pow(2,r-150)*(i+8388608)}function Xe(t){return Je(t)}function Ye(t,e,{D:n=!1}={}){t.D=n,e&&(e=We(e),t.i=e.buffer,t.m=e.A,t.v=0,t.j=t.i.length,t.g=t.v)}function Qe(t,e){if(t.g=e,e>t.j)throw Re(t.j,e)}function Ze(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 Re(e,t.j-n);return t.g=r,n}function tn(t,e){if(0==e)return L();var n=Ze(t,e);return t.D&&t.m?n=t.i.subarray(n,n+e):(t=t.i,n=n===(e=n+e)?new Uint8Array(0):wt?t.slice(n,e):new Uint8Array(t.subarray(n,e))),0==n.length?L():new k(n,O)}var en=[];function nn(t){var e=t.g;if(e.g==e.j)return!1;t.j=t.g.g;var n=Je(t.g)>>>0;if(e=n>>>3,!((n&=7)>=0&&n<=5))throw $e(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 rn(t){switch(t.i){case 0:0!=t.i?rn(t):qe(t.g);break;case 1:Qe(t=t.g,t.g+8);break;case 2:if(2!=t.i)rn(t);else{var e=Je(t.g)>>>0;Qe(t=t.g,t.g+e)}break;case 5:Qe(t=t.g,t.g+4);break;case 3:for(e=t.m;;){if(!nn(t))throw Error("Unmatched start-group tag: stream EOF");if(4==t.i){if(t.m!=e)throw Error("Unmatched end-group tag");break}rn(t)}break;default:throw $e(t.i,t.j)}}function on(t,e,n){const r=t.g.j,i=Je(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 sn(t){var e=Je(t.g)>>>0,a=Ze(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 an(t){const e=Je(t.g)>>>0;return tn(t.g,e)}function un(t,e,n){var r=Je(t.g)>>>0;for(r=t.g.g+r;t.g.g<r;)n.push(e(t.g))}var cn=[];let ln;function hn(t,e,n){e.g?e.j(t,e.g,e.i,n,!0):e.j(t,e.i,n,!0)}var fn=class{constructor(t,e){this.l=ie(t,e)}toJSON(){return dn(this)}A(){return!!(2&X(this.l))}};function dn(t){t=ln?t.l:se(t.l,ae,void 0,void 0,!1);{var e=!ln;let c=t.length;if(c){var n=t[c-1],r=ot(n);r?c--:n=void 0;var i=t;if(r){t:{var o,s=n,a=!1;if(s)for(let t in s)isNaN(+t)?(o??={})[t]=s[t]:(r=s[t],Array.isArray(r)&&(at(r)||it(r)&&0===r.size)&&(r=null),null==r&&(a=!0),null!=r&&((o??={})[t]=r));if(a||(o=s),o)for(let t in o){a=o;break t}a=null}s=null==a?null!=n:a!==n}for(;c>0&&(null==(o=i[c-1])||at(o)||it(o)&&0===o.size);c--)var u=!0;(i!==t||s||u)&&(e?(u||s||a)&&(i.length=c):i=Array.prototype.slice.call(i,0,c),a&&i.push(a)),u=i}else u=t}return u}function gn(t){return t?/^\d+$/.test(t)?(Ot(t),new pn(St,At)):null:mn||=new pn(0,0)}fn.prototype.C=nt,fn.prototype.toString=function(){try{return ln=!0,dn(this).toString()}finally{ln=!1}};var pn=class{constructor(t,e){this.i=t>>>0,this.g=e>>>0}};let mn;function yn(t){return t?/^-?\d+$/.test(t)?(Ot(t),new bn(St,At)):null:vn||=new bn(0,0)}var bn=class{constructor(t,e){this.i=t>>>0,this.g=e>>>0}};let vn;function wn(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 _n(t,e){for(;e>127;)t.g.push(127&e|128),e>>>=7;t.g.push(e)}function Sn(t,e){if(e>=0)_n(t,e);else{for(let n=0;n<9;n++)t.g.push(127&e|128),e>>=7;t.g.push(1)}}function An(t){var e=St;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 En(t,e){0!==e.length&&(t.j.push(e),t.i+=e.length)}function In(t,e,n){_n(t.g,8*e+n)}function Tn(t,e){return In(t,e,2),e=t.g.end(),En(t,e),e.push(t.i),e}function xn(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 Pn(t,e,n){In(t,e,2),_n(t.g,n.length),En(t,t.g.end()),En(t,n)}function Un(){const t=class{constructor(){throw Error()}};return Object.setPrototypeOf(t,t.prototype),t}var Bn=Un(),On=Un(),Ln=Un(),Nn=Un(),kn=Un(),Fn=Un(),Vn=Un(),jn=Un(),Cn=class{constructor(t,e,n){this.g=t,this.i=e,t=Bn,this.j=!!t&&n===t||!1}};function Mn(t,e){return new Cn(t,e,Bn)}function Gn(t,e,n,r,i){null!=(e=Yn(e,r))&&(n=Tn(t,n),i(e,t),xn(t,n))}const Dn=Mn((function(t,e,n,r,i){return 2===t.i&&(on(t,Be(e,r,n),i),!0)}),Gn),$n=Mn((function(t,e,n,r,i){return 2===t.i&&(on(t,Be(e,r,n,!0),i),!0)}),Gn);var zn=Symbol(),Rn=Symbol(),Wn=Symbol(),Hn=Symbol();let qn,Jn;function Kn(t,e,n,r){var i=r[t];if(i)return i;(i={}).B=function(t){switch(typeof t){case"boolean":return te||=[0,void 0,!0];case"number":return t>0?void 0:0===t?ee||=[0,void 0]:[-t,void 0];case"string":return[0,t];case"object":return t}}(r[0]);var o=r[1];let s=1;o&&o.constructor===Object&&(i.G=o,"function"==typeof(o=r[++s])&&(i.H=!0,qn??=o,Jn??=r[s+1],o=r[s+=2]));const a={};for(;o&&Array.isArray(o)&&o.length&&"number"==typeof o[0]&&o[0]>0;){for(var u=0;u<o.length;u++)a[o[u]]=o;o=r[++s]}for(u=1;void 0!==o;){let t;"number"==typeof o&&(u+=o,o=r[++s]);var c=void 0;if(o instanceof Cn?t=o:(t=Dn,s--),t?.j){o=r[++s],c=r;var l=s;"function"==typeof o&&(o=o(),c[l]=o),c=o}for(l=u+1,"number"==typeof(o=r[++s])&&o<0&&(l-=o,o=r[++s]);u<l;u++){const r=a[u];c?n(i,u,t,c,r):e(i,u,t,r)}}return r[t]=i}function Xn(t){return Array.isArray(t)?t[0]instanceof Cn?t:[$n,t]:[t,void 0]}function Yn(t,e){return t instanceof fn?t.l:Array.isArray(t)?re(t,e,!1):void 0}function Qn(t,e,n,r){const i=n.g;t[e]=r?(t,e,n)=>i(t,e,n,r):i}function Zn(t,e,n,r,i){const o=n.g;let s,a;t[e]=(t,e,n)=>o(t,e,n,a||=Kn(Rn,Qn,Zn,r).B,s||=tr(r),i)}function tr(t){let e=t[Wn];if(null!=e)return e;const n=Kn(Rn,Qn,Zn,t);return e=n.H?(t,e)=>qn(t,e,n):(t,e)=>{const r=Y(t);for(;nn(e)&&4!=e.i;){var i=e.m,o=n[i];if(null==o){var s=n.G;s&&(s=s[i])&&(null!=(s=er(s))&&(o=n[i]=s))}null!=o&&o(e,t,i)||(i=(o=e).j,rn(o),o.F?o=void 0:(s=o.g.g-i,o.g.g=i,o=tn(o.g,s)),i=t,o&&(lt||=Symbol(),(s=i[lt])?s.push(o):i[lt]=[o]))}return 16384&r&&J(t,34),!0},t[Wn]=e}function er(t){const e=(t=Xn(t))[0].g;if(t=t[1]){const n=tr(t),r=Kn(Rn,Qn,Zn,t).B;return(t,i,o)=>e(t,i,o,r,n)}return e}function nr(t,e,n){t[e]=n.i}function rr(t,e,n,r){let i,o;const s=n.i;t[e]=(t,e,n)=>s(t,e,n,o||=Kn(zn,nr,rr,r).B,i||=ir(r))}function ir(t){let e=t[Hn];if(!e){const n=Kn(zn,nr,rr,t);e=(t,e)=>or(t,e,n),t[Hn]=e}return e}function or(t,e,n){for(var r=X(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=sr(n,o);a&&a(e,r,o)}if(256&r){r=t[o-1];for(const t in r)i=+t,Number.isNaN(i)||null!=(o=r[i])&&(a=sr(n,i))&&a(e,o,i)}if(t=lt?t[lt]:void 0)for(En(e,e.g.end()),n=0;n<t.length;n++)En(e,N(t[n])||new Uint8Array(0))}function sr(t,e){var n=t[e];if(n)return n;if((n=t.G)&&(n=n[e])){var r=(n=Xn(n))[0].i;if(n=n[1]){const e=ir(n),i=Kn(zn,nr,rr,n).B;n=t.H?Jn(i,e):(t,n,o)=>r(t,n,o,i,e)}else n=r;return t[e]=n}}function ar(t,e){if(Array.isArray(e)){var n=X(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),Q(e,-12289&(5|n)),2&n&&Object.freeze(e),e}}function ur(t,e,n){return new Cn(t,e,n)}function cr(t,e,n){return new Cn(t,e,n)}function lr(t,e,n){ye(t,Y(t),e,n)}function hr(t,e,n){if(e=function(t){if(null==t)return t;const e=typeof t;if("bigint"===e)return String(BigInt.asIntN(64,t));if(Vt(t)){if("string"===e)return Gt(t);if("number"===e)return Mt(t)}}(e),null!=e){if("string"==typeof e)yn(e);if(null!=e)switch(In(t,n,0),typeof e){case"number":t=t.g,It(e),wn(t,St,At);break;case"bigint":n=BigInt.asUintN(64,e),n=new bn(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),wn(t.g,n.i,n.g);break;default:n=yn(e),wn(t.g,n.i,n.g)}}}function fr(t,e,n){null!=(e=jt(e))&&null!=e&&(In(t,n,0),Sn(t.g,e))}function dr(t,e,n){null!=(e=null==e||"boolean"==typeof e?e:"number"==typeof e?!!e:void 0)&&(In(t,n,0),t.g.g.push(e?1:0))}function gr(t,e,n){null!=(e=Wt(e))&&Pn(t,n,c(e))}function pr(t,e,n,r,i){null!=(e=Yn(e,r))&&(n=Tn(t,n),i(e,t),xn(t,n))}function mr(t,e,n){null!=(e=null==e||"string"==typeof e||B(e)||e instanceof k?e:void 0)&&Pn(t,n,We(e).buffer)}var yr=ur((function(t,e,n){return 5===t.i&&(lr(e,n,Ke(t.g)),!0)}),(function(t,e,n){null!=(e=Nt(e))&&(In(t,n,5),t=t.g,Tt(e),An(t))}),Fn),br=cr((function(t,e,n){return(5===t.i||2===t.i)&&(e=Ie(e,Y(e),n,!1,!1),2==t.i?un(t,Ke,e):e.push(Ke(t.g)),!0)}),(function(t,e,n){if(null!=(e=ar(Nt,e))&&e.length){In(t,n,2),_n(t.g,4*e.length);for(let r=0;r<e.length;r++)n=t.g,Tt(e[r]),An(n)}}),Fn),vr=ur((function(t,e,n){return 0===t.i&&(lr(e,n,He(t.g,Pt)),!0)}),hr,kn),wr=ur((function(t,e,n){return 0===t.i&&(lr(e,n,0===(t=He(t.g,Pt))?void 0:t),!0)}),hr,kn),_r=ur((function(t,e,n){return 0===t.i&&(lr(e,n,He(t.g,xt)),!0)}),(function(t,e,n){if(null!=(e=$t(e))){if("string"==typeof e)gn(e);if(null!=e)switch(In(t,n,0),typeof e){case"number":t=t.g,It(e),wn(t,St,At);break;case"bigint":n=BigInt.asUintN(64,e),n=new pn(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),wn(t.g,n.i,n.g);break;default:n=gn(e),wn(t.g,n.i,n.g)}}}),Un()),Sr=ur((function(t,e,n){return 0===t.i&&(lr(e,n,Je(t.g)),!0)}),fr,Nn),Ar=cr((function(t,e,n){return(0===t.i||2===t.i)&&(e=Ie(e,Y(e),n,!1,!1),2==t.i?un(t,Je,e):e.push(Je(t.g)),!0)}),(function(t,e,n){if(null!=(e=ar(jt,e))&&e.length){n=Tn(t,n);for(let n=0;n<e.length;n++)Sn(t.g,e[n]);xn(t,n)}}),Nn),Er=ur((function(t,e,n){return 0===t.i&&(lr(e,n,0===(t=Je(t.g))?void 0:t),!0)}),fr,Nn),Ir=ur((function(t,e,n){return 0===t.i&&(lr(e,n,qe(t.g)),!0)}),dr,On),Tr=ur((function(t,e,n){return 0===t.i&&(lr(e,n,!1===(t=qe(t.g))?void 0:t),!0)}),dr,On),xr=cr((function(t,e,n){return 2===t.i&&(t=sn(t),Ie(e,Y(e),n,!1).push(t),!0)}),(function(t,e,n){if(null!=(e=ar(Wt,e)))for(let s=0;s<e.length;s++){var r=t,i=n,o=e[s];null!=o&&Pn(r,i,c(o))}}),Ln),Pr=ur((function(t,e,n){return 2===t.i&&(lr(e,n,""===(t=sn(t))?void 0:t),!0)}),gr,Ln),Ur=ur((function(t,e,n){return 2===t.i&&(lr(e,n,sn(t)),!0)}),gr,Ln),Br=function(t,e,n=Bn){return new Cn(t,e,n)}((function(t,e,n,r,i){return 2===t.i&&(r=re(void 0,r,!0),Ie(e,Y(e),n,!0).push(r),on(t,r,i),!0)}),(function(t,e,n,r,i){if(Array.isArray(e))for(let o=0;o<e.length;o++)pr(t,e[o],n,r,i)})),Or=Mn((function(t,e,n,r,i,o){return 2===t.i&&(Pe(e,X(e),o,n),on(t,e=Be(e,r,n),i),!0)}),pr),Lr=ur((function(t,e,n){return 2===t.i&&(lr(e,n,an(t)),!0)}),mr,Vn),Nr=ur((function(t,e,n){return 0===t.i&&(lr(e,n,Je(t.g)),!0)}),(function(t,e,n){null!=(e=jt(e))&&(e=parseInt(e,10),In(t,n,0),Sn(t.g,e))}),jn);class kr{constructor(t,e){this.i=t,this.g=e,this.j=Fe,this.defaultValue=void 0}}function Fr(t,e){return(n,r)=>{if(cn.length){const t=cn.pop();t.o(r),Ye(t.g,n,r),n=t}else n=new class{constructor(t,e){if(en.length){const n=en.pop();Ye(n,t,e),t=n}else t=new class{constructor(t,e){this.i=null,this.m=!1,this.g=this.j=this.v=0,Ye(this,t,e)}clear(){this.i=null,this.m=!1,this.g=this.j=this.v=0,this.D=!1}}(t,e);this.g=t,this.j=this.g.g,this.i=this.m=-1,this.o(e)}o({F:t=!1}={}){this.F=t}}(n,r);try{const r=new t,o=r.l;tr(e)(o,n);var i=r}finally{n.g.clear(),n.m=-1,n.i=-1,cn.length<100&&cn.push(n)}return i}}var Vr=[0,Pr,ur((function(t,e,n){return 2===t.i&&(lr(e,n,(t=an(t))===L()?void 0:t),!0)}),(function(t,e,n){if(null!=e){if(e instanceof fn){const r=e.N;return void(r&&(e=r(e),null!=e&&Pn(t,n,We(e).buffer)))}if(Array.isArray(e))return}mr(t,e,n)}),Vn)];let jr,Cr=globalThis.trustedTypes;function Mr(t){void 0===jr&&(jr=function(){let t=null;if(!Cr)return t;try{const e=t=>t;t=Cr.createPolicy("goog#html",{createHTML:e,createScript:e,createScriptURL:e})}catch(t){}return t}());var e=jr;return new class{constructor(t){this.g=t}toString(){return this.g+""}}(e?e.createScriptURL(t):t)}function Gr(t,...e){if(0===e.length)return Mr(t[0]);let n=t[0];for(let r=0;r<e.length;r++)n+=encodeURIComponent(e[r])+t[r+1];return Mr(n)}var Dr=[0,Sr,Nr,Ir,-1,Ar,Nr,-1],$r=class extends fn{constructor(){super()}},zr=[0,Ir,Ur,Ir,Nr,-1,cr((function(t,e,n){return(0===t.i||2===t.i)&&(e=Ie(e,Y(e),n,!1,!1),2==t.i?un(t,Xe,e):e.push(Je(t.g)),!0)}),(function(t,e,n){if(null!=(e=ar(jt,e))&&e.length){n=Tn(t,n);for(let n=0;n<e.length;n++)Sn(t.g,e[n]);xn(t,n)}}),jn),Ur,-1,[0,Ir,-1],Nr,Ir,-1],Rr=[0,Ur,-2],Wr=class extends fn{constructor(){super()}},Hr=[0],qr=[0,Sr,Ir,1,Ir,-3],Jr=class extends fn{constructor(t){super(t,2)}},Kr={};Kr[336783863]=[0,Ur,Ir,-1,Sr,[0,[1,2,3,4,5,6,7],Or,Hr,Or,zr,Or,Rr,Or,qr,Or,Dr,Or,[0,Ur,-2],Or,[0,Ur,Nr]],[0,Ur],Ir,[0,[1,3],[2,4],Or,[0,Ar],-1,Or,[0,xr],-1,Br,[0,Ur,-1]],Ur];var Xr=[0,wr,-1,Tr,-3,wr,Ar,Pr,Er,wr,-1,Tr,Er,Tr,-2,Pr];function Yr(t){De(t,3,"TEXT:text_in")}var Qr=class extends fn{constructor(t){super(t,500)}o(t){return Fe(this,0,7,t)}},Zr=[-1,{}],ti=[0,Ur,1,Zr],ei=[0,Ur,xr,Zr];function ni(t){De(t,10,"text_in")}var ri,ii=class extends fn{constructor(){super(void 0,500)}o(t){return Fe(this,0,1001,t)}};ii.prototype.g=(ri=[-500,Br,[-500,Pr,-1,xr,-3,[-2,Kr,Ir],Br,Vr,Er,-1,ti,ei,Br,[0,Pr,Tr],Pr,Xr,Er,xr,987,xr],4,Br,[-500,Ur,-1,[-1,{}],998,Ur],Br,[-500,Ur,xr,-1,[-2,{},Ir],997,xr,-1],Er,Br,[-500,Ur,xr,Zr,998,xr],xr,Er,ti,ei,Br,[0,Pr,-1,Zr],xr,-2,Xr,Pr,-1,Tr,979,Zr,Br,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}}}};or(this.l,t,Kn(zn,nr,rr,ri)),En(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 oi=class extends fn{constructor(t){super(t)}},si=class extends fn{constructor(t){super(t)}g(){return ke(this,oi)}},ai=class extends fn{constructor(t){super(t)}},ui=Fr(class extends fn{constructor(t){super(t)}},[0,Br,[0,1,Sr,Ur,[0,Br,[0,Sr,yr,Ur,-1]]],vr]),ci=class extends fn{constructor(t){super(t)}},li=class extends fn{constructor(t){super(t)}I(){const t=be(this);return null==t?L():t}},hi=class extends fn{constructor(t){super(t)}},fi=[1,2],di=Fr(class extends fn{constructor(t){super(t)}},[0,Br,[0,fi,Or,[0,br],Or,[0,Lr],Sr,Ur],vr]),gi=class extends fn{constructor(t){super(t)}},pi=class extends fn{constructor(t){super(t)}},mi=[0,Ir,-1],yi=class extends fn{constructor(t){super(t)}},bi=[1,2,3,4,5],vi=class extends fn{constructor(t){super(t)}g(){return null!=be(this)}i(){return null!=Wt(de(this,2))}},wi=class extends fn{constructor(t){super(t)}},_i=[0,[0,Lr,Ur,[0,Sr,vr,-1],[0,_r,vr]],Ir,[0,bi,Or,qr,Or,zr,Or,Dr,Or,Hr,Or,Rr],Nr],Si=class extends fn{constructor(t){super(t)}},Ai=new kr(462704549,Si);Kr[462704549]=[0,_i,[0,Ur,Sr,yr,xr,-1]];var Ei=class extends fn{constructor(t){super(t)}},Ii=new kr(477589892,Ei);function Ti(t,e){if(e=e?ce(e):new gi,void 0!==t.displayNamesLocale?me(e,1,Rt(t.displayNamesLocale)):void 0===t.displayNamesLocale&&me(e,1),void 0!==t.maxResults){var n=t.maxResults;if(null!=n){if("number"!=typeof n)throw G();if(!Number.isFinite(n))throw G();n|=0}me(e,2,n)}else"maxResults"in t&&me(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}`);me(e,3,n)}else"scoreThreshold"in t&&me(e,3);return void 0!==t.categoryAllowlist?Ae(e,4,t.categoryAllowlist):"categoryAllowlist"in t&&me(e,4),void 0!==t.categoryDenylist?Ae(e,5,t.categoryDenylist):"categoryDenylist"in t&&me(e,5),e}function xi(t){const e={classifications:ke(t,ai).map((t=>function(t,e=-1,n=""){return{categories:t.map((t=>{var e=Ge(jt(de(t,1)),0)??-1;const n=t.l;let r=Y(n);const i=pe(n,r,2),o=Nt(i);return null!=o&&o!==i&&ye(n,r,2,o),{index:e,score:o??0??0,categoryName:Ge(Wt(de(t,3)),"")??"",displayName:Ge(Wt(de(t,4)),"")??""}})),headIndex:e,headName:n}}(Le(t,si,4)?.g()??[],Ge(jt(de(t,2)),0),Ge(Wt(de(t,3)),""))))};return null!=Dt(de(t,2))&&(e.timestampMs=Ge(Dt(de(t,2)),0)),e}function Pi(t){return Array.from(t,(t=>t>127?t-256:t))}function Ui(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 Bi;Kr[477589892]=[0,_i,mi];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 Li(){if(void 0===Bi)try{await WebAssembly.instantiate(Oi),Bi=!0}catch{Bi=!1}return Bi}async function Ni(t,e=Gr``){const n=await Li()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${e}/${t}_${n}.js`,wasmBinaryPath:`${e}/${t}_${n}.wasm`}}var ki=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 Vi(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())}ki.forVisionTasks=function(t){return Ni("vision",t)},ki.forTextTasks=function(t){return Ni("text",t)},ki.forGenAiExperimentalTasks=function(t){return Ni("genai_experimental",t)},ki.forGenAiTasks=function(t){return Ni("genai",t)},ki.forAudioTasks=function(t){return Ni("audio",t)},ki.isSimdSupported=function(){return Li()};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 Ci(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 Gi(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 Di=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??0,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=>{Ci(this,Object.keys(t),(r=>{Ci(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){Mi(this,t,e),ji(this,t,(t=>{this.h._attachBoolListener(t)}))}attachBoolVectorListener(t,e){Gi(this,t,e),ji(this,t,(t=>{this.h._attachBoolVectorListener(t)}))}attachIntListener(t,e){Mi(this,t,e),ji(this,t,(t=>{this.h._attachIntListener(t)}))}attachIntVectorListener(t,e){Gi(this,t,e),ji(this,t,(t=>{this.h._attachIntVectorListener(t)}))}attachUintListener(t,e){Mi(this,t,e),ji(this,t,(t=>{this.h._attachUintListener(t)}))}attachUintVectorListener(t,e){Gi(this,t,e),ji(this,t,(t=>{this.h._attachUintVectorListener(t)}))}attachDoubleListener(t,e){Mi(this,t,e),ji(this,t,(t=>{this.h._attachDoubleListener(t)}))}attachDoubleVectorListener(t,e){Gi(this,t,e),ji(this,t,(t=>{this.h._attachDoubleVectorListener(t)}))}attachFloatListener(t,e){Mi(this,t,e),ji(this,t,(t=>{this.h._attachFloatListener(t)}))}attachFloatVectorListener(t,e){Gi(this,t,e),ji(this,t,(t=>{this.h._attachFloatVectorListener(t)}))}attachStringListener(t,e){Mi(this,t,e),ji(this,t,(t=>{this.h._attachStringListener(t)}))}attachStringVectorListener(t,e){Gi(this,t,e),ji(this,t,(t=>{this.h._attachStringVectorListener(t)}))}attachProtoListener(t,e,n){Mi(this,t,e),ji(this,t,(t=>{this.h._attachProtoListener(t,n||!1)}))}attachProtoVectorListener(t,e,n){Gi(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?'),Mi(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 $i=class extends Di{};async function zi(t,e,n){return t=await(async(t,e,n,r)=>{if(e&&await Vi(e),!self.ModuleFactory)throw Error("ModuleFactory not set.");if(n&&(await Vi(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 Ri(t,e,n){return zi(t,e,n)}function Wi(t,e){const n=Le(t.baseOptions,vi,1)||new vi;"string"==typeof e?(me(n,2,Rt(e)),me(n,1)):e instanceof Uint8Array&&(me(n,1,st(e,!1)),me(n,2)),Fe(t.baseOptions,0,1,n)}function Hi(t,e){const n=e.baseOptions||{};if(e.baseOptions?.modelAssetBuffer&&e.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(Le(t.baseOptions,vi,1)?.g()||Le(t.baseOptions,vi,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=Le(t.baseOptions,yi,3);if(!n){var r=n=new yi;Ve(r,4,new Wr)}"delegate"in e&&("GPU"===e.delegate?Ve(e=n,2,r=new $r):Ve(e=n,4,r=new Wr)),Fe(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.v()}));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.v()}));return t.v(),Promise.resolve()}function qi(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 Ji(t,e){t.j=Math.max(t.j,e)}var Ki=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),qi(this)}finishProcessing(){this.g.finishProcessing(),qi(this)}close(){this.g.closeGraph()}};Ki.prototype.close=Ki.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",Ki);var Xi=class extends Ki{constructor(t,e){super(new $i(t,e)),this.u={languages:[]},Fe(t=this.i=new Si,0,1,e=new wi)}o(t){return Fe(this.i,0,2,Ti(t,Le(this.i,gi,2))),Hi(this,t)}get baseOptions(){return Le(this.i,wi,1)}set baseOptions(t){Fe(this.i,0,1,t)}K(t){return this.u={languages:[]},this.g.addStringToStream(t,"text_in",this.j+1),this.finishProcessing(),this.u}v(){var t=new ii;ni(t),De(t,15,"classifications_out");const e=new Jr;hn(e,Ai,this.i);const n=new Qr;Ee(n,Rt("mediapipe.tasks.text.text_classifier.TextClassifierGraph")),Yr(n),De(n,4,"CLASSIFICATIONS:classifications_out"),n.o(e),Me(t,n),this.g.attachProtoListener("classifications_out",((t,e)=>{if(({classifications:t}=xi(ui(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}))),Ji(this,e)})),this.g.attachEmptyPacketListener("classifications_out",(t=>{Ji(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Xi.prototype.detect=Xi.prototype.K,Xi.prototype.setOptions=Xi.prototype.o,Xi.createFromModelPath=function(t,e){return Ri(Xi,t,{baseOptions:{modelAssetPath:e}})},Xi.createFromModelBuffer=function(t,e){return Ri(Xi,t,{baseOptions:{modelAssetBuffer:e}})},Xi.createFromOptions=function(t,e){return Ri(Xi,t,e)};var Yi=class extends Ki{constructor(t,e){super(new $i(t,e)),this.u={classifications:[]},Fe(t=this.i=new Si,0,1,e=new wi)}o(t){return Fe(this.i,0,2,Ti(t,Le(this.i,gi,2))),Hi(this,t)}get baseOptions(){return Le(this.i,wi,1)}set baseOptions(t){Fe(this.i,0,1,t)}J(t){return this.u={classifications:[]},this.g.addStringToStream(t,"text_in",this.j+1),this.finishProcessing(),this.u}v(){var t=new ii;ni(t),De(t,15,"classifications_out");const e=new Jr;hn(e,Ai,this.i);const n=new Qr;Ee(n,Rt("mediapipe.tasks.text.text_classifier.TextClassifierGraph")),Yr(n),De(n,4,"CLASSIFICATIONS:classifications_out"),n.o(e),Me(t,n),this.g.attachProtoListener("classifications_out",((t,e)=>{this.u=xi(ui(t)),Ji(this,e)})),this.g.attachEmptyPacketListener("classifications_out",(t=>{Ji(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Yi.prototype.classify=Yi.prototype.J,Yi.prototype.setOptions=Yi.prototype.o,Yi.createFromModelPath=function(t,e){return Ri(Yi,t,{baseOptions:{modelAssetPath:e}})},Yi.createFromModelBuffer=function(t,e){return Ri(Yi,t,{baseOptions:{modelAssetBuffer:e}})},Yi.createFromOptions=function(t,e){return Ri(Yi,t,e)};var Qi=class extends Ki{constructor(t,e){super(new $i(t,e)),this.u={embeddings:[]},Fe(t=this.i=new Ei,0,1,e=new wi)}o(t){var e=this.i,n=Le(this.i,pi,2);return n=n?ce(n):new pi,void 0!==t.l2Normalize?me(n,1,kt(t.l2Normalize)):"l2Normalize"in t&&me(n,1),void 0!==t.quantize?me(n,2,kt(t.quantize)):"quantize"in t&&me(n,2),Fe(e,0,2,n),Hi(this,t)}get baseOptions(){return Le(this.i,wi,1)}set baseOptions(t){Fe(this.i,0,1,t)}L(t){return this.g.addStringToStream(t,"text_in",this.j+1),this.finishProcessing(),this.u}v(){var t=new ii;ni(t),De(t,15,"embeddings_out");const e=new Jr;hn(e,Ii,this.i);const n=new Qr;Ee(n,Rt("mediapipe.tasks.text.text_embedder.TextEmbedderGraph")),Yr(n),De(n,4,"EMBEDDINGS:embeddings_out"),n.o(e),Me(t,n),this.g.attachProtoListener("embeddings_out",((t,e)=>{t=di(t),this.u=function(t){return{embeddings:ke(t,hi).map((t=>{const e={headIndex:Ge(jt(de(t,3)),0)??-1,headName:Ge(Wt(de(t,4)),"")??""};if(void 0!==Oe(t,ci,Te(t,1)))e.floatEmbedding=ve(Le(t,ci,Te(t,1)),1,Nt,void 0===ft?2:f?4:5).slice();else{const n=new Uint8Array(0);e.quantizedEmbedding=Le(t,li,Te(t,2))?.I()?.i()??n}return e})),timestampMs:Ge(Dt(de(t,2)),0)}}(t),Ji(this,e)})),this.g.attachEmptyPacketListener("embeddings_out",(t=>{Ji(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Qi.cosineSimilarity=function(t,e){if(t.floatEmbedding&&e.floatEmbedding)t=Ui(t.floatEmbedding,e.floatEmbedding);else{if(!t.quantizedEmbedding||!e.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");t=Ui(Pi(t.quantizedEmbedding),Pi(e.quantizedEmbedding))}return t},Qi.prototype.embed=Qi.prototype.L,Qi.prototype.setOptions=Qi.prototype.o,Qi.createFromModelPath=function(t,e){return Ri(Qi,t,{baseOptions:{modelAssetPath:e}})},Qi.createFromModelBuffer=function(t,e){return Ri(Qi,t,{baseOptions:{modelAssetBuffer:e}})},Qi.createFromOptions=function(t,e){return Ri(Qi,t,e)},exports.FilesetResolver=ki,exports.LanguageDetector=Xi,exports.TextClassifier=Yi,exports.TextEmbedder=Qi;
2
2
  //# sourceMappingURL=text_bundle_cjs.js.map