@mediapipe/tasks-text 0.10.6 → 0.10.7
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 +2 -2
- package/text_bundle.cjs +1 -1
- package/text_bundle.cjs.map +1 -1
- package/text_bundle.mjs +1 -1
- package/text_bundle.mjs.map +1 -1
- package/wasm/text_wasm_internal.js +5 -7
- package/wasm/text_wasm_internal.wasm +0 -0
- package/wasm/text_wasm_nosimd_internal.js +5 -7
- package/wasm/text_wasm_nosimd_internal.wasm +0 -0
package/text_bundle.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var t=self;function e(t){return t}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(128>e)r[n++]=e;else{if(2048>e)r[n++]=e>>6|192;else{if(55296<=e&&57343>=e){if(56319>=e&&i<t.length){const o=t.charCodeAt(++i);if(56320<=o&&57343>=o){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;t:{for(var f=["CLOSURE_FLAGS"],d=t,g=0;g<f.length;g++)if(null==(d=d[f[g]])){h=null;break t}h=d}var p,m=h&&h[610401301];l=null!=m&&m;const y=t.navigator;function v(t){return!!l&&(!!p&&p.brands.some((({brand:e})=>e&&-1!=e.indexOf(t))))}function b(e){var n;return(n=t.navigator)&&(n=n.userAgent)||(n=""),-1!=n.indexOf(e)}function w(){return!!l&&(!!p&&0<p.brands.length)}function A(){return w()?v("Chromium"):(b("Chrome")||b("CriOS"))&&!(!w()&&b("Edge"))||b("Silk")}p=y&&y.userAgentData||null;var _=!w()&&(b("Trident")||b("MSIE"));!b("Android")||A(),A(),b("Safari")&&(A()||!w()&&b("Coast")||!w()&&b("Opera")||!w()&&b("Edge")||(w()?v("Microsoft Edge"):b("Edg/"))||w()&&v("Opera"));var S={},E=null;function x(t){var e=t.length,n=3*e/4;n%3?n=Math.floor(n):-1!="=.".indexOf(t[e-1])&&(n=-1!="=.".indexOf(t[e-2])?n-2:n-1);var r=new Uint8Array(n),i=0;return function(t,e){function n(e){for(;r<t.length;){var n=t.charAt(r++),i=E[n];if(null!=i)return i;if(!/^[\s\xa0]*$/.test(n))throw Error("Unknown base64 encoding at char: "+n)}return e}T();for(var r=0;;){var i=n(-1),o=n(0),s=n(64),a=n(64);if(64===a&&-1===i)break;e(i<<2|o>>4),64!=s&&(e(o<<4&240|s>>2),64!=a&&e(s<<6&192|a))}}(t,(function(t){r[i++]=t})),i!==n?r.subarray(0,i):r}function T(){if(!E){E={};for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),e=["+/=","+/","-_=","-_.","-_"],n=0;5>n;n++){var r=t.concat(e[n].split(""));S[n]=r;for(var i=0;i<r.length;i++){var o=r[i];void 0===E[o]&&(E[o]=i)}}}}var O="undefined"!=typeof Uint8Array,L=!_&&"function"==typeof btoa;function P(t){if(!L){var e;void 0===e&&(e=0),T(),e=S[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 I=/[-_.]/g,j={"-":"+",_:"/",".":"="};function F(t){return j[t]||""}function U(t){if(!L)return x(t);I.test(t)&&(t=t.replace(I,F)),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 O&&null!=t&&t instanceof Uint8Array}let k;function C(){return k||=new Uint8Array(0)}var N={};let M;function G(t){if(t!==N)throw Error("illegal external caller")}function $(){return M||=new D(null,N)}function z(t){G(N);var e=t.C;return null==(e=null==e||B(e)?e:"string"==typeof e?U(e):null)?e:t.C=e}var D=class{constructor(t,e){if(G(e),this.C=t,null!=t&&0===t.length)throw Error("ByteString should be constructed with non-empty values")}K(){const t=z(this);return t?new Uint8Array(t):C()}};function R(t,e){return Error(`Invalid wire type: ${t} (at position ${e})`)}function V(){return Error("Failed to read varint, encoding is invalid.")}function W(t,e){return Error(`Tried to read past the end of the data ${e} > ${t}`)}function H(t){return 0==t.length?$():new D(t,N)}function q(t){if("string"==typeof t)return{buffer:U(t),u:!1};if(Array.isArray(t))return{buffer:new Uint8Array(t),u:!1};if(t.constructor===Uint8Array)return{buffer:t,u:!1};if(t.constructor===ArrayBuffer)return{buffer:new Uint8Array(t),u:!1};if(t.constructor===D)return{buffer:z(t)||C(),u:!0};if(t instanceof Uint8Array)return{buffer:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),u:!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")}const J="function"==typeof Uint8Array.prototype.slice;let K,Y=0,X=0;function Q(t){const e=0>t;let n=(t=Math.abs(t))>>>0;if(t=Math.floor((t-n)/4294967296),e){const[e,r]=rt(n,t);t=r,n=e}Y=n>>>0,X=t>>>0}function Z(t){const e=K||=new DataView(new ArrayBuffer(8));e.setFloat32(0,+t,!0),X=0,Y=e.getUint32(0,!0)}function tt(t,e){return 4294967296*e+(t>>>0)}function et(t,e){const n=2147483648&e;return n&&(e=~e>>>0,0==(t=1+~t>>>0)&&(e=e+1>>>0)),t=tt(t,e),n?-t:t}function nt(t){if(16>t.length)Q(Number(t));else if("function"==typeof BigInt)t=BigInt(t),Y=Number(t&BigInt(4294967295))>>>0,X=Number(t>>BigInt(32)&BigInt(4294967295));else{const e=+("-"===t[0]);X=Y=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));X*=1e6,Y=1e6*Y+e,4294967296<=Y&&(X+=Math.trunc(Y/4294967296),X>>>=0,Y>>>=0)}if(e){const[t,e]=rt(Y,X);Y=t,X=e}}}function rt(t,e){return e=~e,t?t=1+~t:e+=1,[t,e]}function it(t,e,{D:n=!1}={}){t.D=n,e&&(e=q(e),t.j=e.buffer,t.o=e.u,t.G=0,t.m=t.j.length,t.g=t.G)}function ot(t,e){if(t.g=e,e>t.m)throw W(t.m,e)}function st(t,e){let n,r=0,i=0,o=0;const s=t.j;let a=t.g;do{n=s[a++],r|=(127&n)<<o,o+=7}while(32>o&&128&n);for(32<o&&(i|=(127&n)>>4),o=3;32>o&&128&n;o+=7)n=s[a++],i|=(127&n)<<o;if(ot(t,a),128>n)return e(r>>>0,i>>>0);throw V()}function at(t){let e=0,n=t.g;const r=n+10,i=t.j;for(;n<r;){const r=i[n++];if(e|=r,0==(128&r))return ot(t,n),!!(127&e)}throw V()}function ut(t,e){if(0>e)throw Error(`Tried to read a negative byte length: ${e}`);const n=t.g,r=n+e;if(r>t.m)throw W(e,t.m-n);return t.g=r,n}function ct(t,e){if(0==e)return $();var n=ut(t,e);return t.D&&t.o?n=t.j.subarray(n,n+e):(t=t.j,n=n===(e=n+e)?C():J?t.slice(n,e):new Uint8Array(t.subarray(n,e))),H(n)}var lt=class{constructor(t,e){this.j=null,this.o=!1,this.g=this.m=this.G=0,it(this,t,e)}h(){const t=this.j;let e=this.g,n=t[e++],r=127&n;if(128&n&&(n=t[e++],r|=(127&n)<<7,128&n&&(n=t[e++],r|=(127&n)<<14,128&n&&(n=t[e++],r|=(127&n)<<21,128&n&&(n=t[e++],r|=n<<28,128&n&&128&t[e++]&&128&t[e++]&&128&t[e++]&&128&t[e++]&&128&t[e++])))))throw V();return ot(this,e),r}v(){var t=this.j;const e=this.g;var n=t[e],r=t[e+1],i=t[e+2];return t=t[e+3],ot(this,this.g+4),n=2*((i=(n<<0|r<<8|i<<16|t<<24)>>>0)>>31)+1,r=i>>>23&255,i&=8388607,255==r?i?NaN:1/0*n:0==r?n*Math.pow(2,-149)*i:n*Math.pow(2,r-150)*(i+Math.pow(2,23))}P(){return this.h()}},ht=[];function ft(t){var e=t.g;if(e.g==e.m)return!1;t.j=t.g.g;var n=t.g.h()>>>0;if(e=n>>>3,!(0<=(n&=7)&&5>=n))throw R(n,t.j);if(1>e)throw Error(`Invalid field number: ${e} (at position ${t.j})`);return t.m=e,t.h=n,!0}function dt(t){switch(t.h){case 0:0!=t.h?dt(t):at(t.g);break;case 1:ot(t=t.g,t.g+8);break;case 2:if(2!=t.h)dt(t);else{var e=t.g.h()>>>0;ot(t=t.g,t.g+e)}break;case 5:ot(t=t.g,t.g+4);break;case 3:for(e=t.m;;){if(!ft(t))throw Error("Unmatched start-group tag: stream EOF");if(4==t.h){if(t.m!=e)throw Error("Unmatched end-group tag");break}dt(t)}break;default:throw R(t.h,t.j)}}function gt(t,e,n){const r=t.g.m,i=t.g.h()>>>0,o=t.g.g+i;let s=o-r;if(0>=s&&(t.g.m=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.m=r}function pt(t){var e=t.g.h()>>>0,a=ut(t=t.g,e);if(t=t.j,s){var u,c=t;(u=o)||(u=o=new TextDecoder("utf-8",{fatal:!0})),t=a+e,c=0===a&&t===c.length?c:c.subarray(a,t);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++];128>h?a.push(h):224>h?l>=e?n():(i=t[l++],194>h||128!=(192&i)?(l--,n()):a.push((31&h)<<6|63&i)):240>h?l>=e-1?n():(i=t[l++],128!=(192&i)||224===h&&160>i||237===h&&160<=i||128!=(192&(c=t[l++]))?(l--,n()):a.push((15&h)<<12|(63&i)<<6|63&c)):244>=h?l>=e-2?n():(i=t[l++],128!=(192&i)||0!=i-144+(h<<28)>>30||128!=(192&(c=t[l++]))||128!=(192&(u=t[l++]))?(l--,n()):(h=(7&h)<<18|(63&i)<<12|(63&c)<<6|63&u,h-=65536,a.push(55296+(h>>10&1023),56320+(1023&h)))):n(),8192<=a.length&&(o=r(o,a),a.length=0)}l=r(o,a)}return l}function mt(t){const e=t.g.h()>>>0;return ct(t.g,e)}function yt(t,e,n){var r=t.g.h()>>>0;for(r=t.g.g+r;t.g.g<r;)n.push(e.call(t.g))}var vt=[];function bt(t){return t?/^\d+$/.test(t)?(nt(t),new wt(Y,X)):null:At||=new wt(0,0)}var wt=class{constructor(t,e){this.h=t>>>0,this.g=e>>>0}};let At;function _t(t){return t?/^-?\d+$/.test(t)?(nt(t),new St(Y,X)):null:Et||=new St(0,0)}var St=class{constructor(t,e){this.h=t>>>0,this.g=e>>>0}};let Et;function xt(t,e,n){for(;0<n||127<e;)t.g.push(127&e|128),e=(e>>>7|n<<25)>>>0,n>>>=7;t.g.push(e)}function Tt(t,e){for(;127<e;)t.g.push(127&e|128),e>>>=7;t.g.push(e)}function Ot(t,e){if(0<=e)Tt(t,e);else{for(let n=0;9>n;n++)t.g.push(127&e|128),e>>=7;t.g.push(1)}}function Lt(t){var e=Y;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 Pt(t,e){0!==e.length&&(t.j.push(e),t.h+=e.length)}function It(t,e,n){Tt(t.g,8*e+n)}function jt(t,e){return It(t,e,2),e=t.g.end(),Pt(t,e),e.push(t.h),e}function Ft(t,e){var n=e.pop();for(n=t.h+t.g.length()-n;127<n;)e.push(127&n|128),n>>>=7,t.h++;e.push(n),t.h++}function Ut(t,e,n){It(t,e,2),Tt(t.g,n.length),Pt(t,t.g.end()),Pt(t,n)}class Bt{constructor(t,e,n){this.g=t,this.h=e,this.j=n}}function kt(t){return Array.prototype.slice.call(t)}const Ct="function"==typeof Symbol&&"symbol"==typeof Symbol()?Symbol():void 0;var Nt=Ct?(t,e)=>{t[Ct]|=e}:(t,e)=>{void 0!==t.g?t.g|=e:Object.defineProperties(t,{g:{value:e,configurable:!0,writable:!0,enumerable:!1}})};function Mt(t){const e=$t(t);1!=(1&e)&&(Object.isFrozen(t)&&(t=kt(t)),Dt(t,1|e))}var Gt=Ct?(t,e)=>{t[Ct]&=~e}:(t,e)=>{void 0!==t.g&&(t.g&=~e)},$t=Ct?t=>0|t[Ct]:t=>0|t.g,zt=Ct?t=>t[Ct]:t=>t.g,Dt=Ct?(t,e)=>{t[Ct]=e}:(t,e)=>{void 0!==t.g?t.g=e:Object.defineProperties(t,{g:{value:e,configurable:!0,writable:!0,enumerable:!1}})};function Rt(t){return Nt(t,1),t}function Vt(t,e){Dt(e,-255&(0|t))}function Wt(t,e){Dt(e,-221&(34|t))}function Ht(t){return 0===(t=t>>11&1023)?536870912:t}var qt,Jt={};function Kt(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)&&t.constructor===Object}function Yt(t,e,n){if(null!=t)if("string"==typeof t)t=t?new D(t,N):$();else if(t.constructor!==D)if(B(t))t=n?H(t):t.length?new D(new Uint8Array(t),N):$();else{if(!e)throw Error();t=void 0}return t}const Xt=[];function Qt(t){if(2&t)throw Error()}let Zt,te,ee,ne;function re(t,e){(e=Zt?e[Zt]:void 0)&&(t[Zt]=kt(e))}function ie(t,e){t.__closure__error__context__984382||(t.__closure__error__context__984382={}),t.__closure__error__context__984382.severity=e}function oe(t){return null==t?t:"number"==typeof t||"NaN"===t||"Infinity"===t||"-Infinity"===t?Number(t):void 0}function se(t){if(null!=t){if("boolean"!=typeof t){var e=typeof t;throw Error(`Expected boolean but got ${"object"!=e?e:t?Array.isArray(t)?"array":e:"null"}: ${t}`)}t=!!t}return t}function ae(t){return"number"==typeof t&&Number.isFinite(t)||!!t&&"string"==typeof t&&isFinite(t)}function ue(t){if(null==t)return t;if("string"==typeof t){if(!t)return;t=+t}return"number"==typeof t?t:void 0}function ce(t){if("string"!=typeof t)throw Error();return t}function le(t){if(null!=t&&"string"!=typeof t)throw Error();return t}function he(t){return null==t||"string"==typeof t?t:void 0}function fe(t,e,n){var r=!1;if(null!=t&&"object"==typeof t&&!(r=Array.isArray(t))&&t.B===Jt)return t;if(r){var i=r=$t(t);return 0===i&&(i|=32&n),(i|=2&n)!==r&&Dt(t,i),new e(t)}}function de(t){switch(typeof t){case"number":return 0<t?void 0:0===t?ne||=[0,void 0]:[-t,void 0];case"string":return[0,t];case"object":return t}}function ge(t,e,n){if(null==t&&(t=ee),ee=void 0,null==t){var r=96;n?(t=[n],r|=512):t=[],e&&(r=-2095105&r|(1023&e)<<11)}else{if(!Array.isArray(t))throw Error();if(64&(r=$t(t)))return te&&delete t[te],t;if(r|=64,n&&(r|=512,n!==t[0]))throw Error();t:{var i=(n=t).length;if(i){const t=i-1;var o=n[t];if(Kt(o)){1024<=(i=t-(e=+!!(512&(r|=256))-1))&&(pe(n,e,o),i=1023),r=-2095105&r|(1023&i)<<11;break t}}e&&(o=+!!(512&r)-1,1024<(e=Math.max(e,i-o))&&(pe(n,o,{}),r|=256,e=1023),r=-2095105&r|(1023&e)<<11)}}return Dt(t,r),t}function pe(t,e,n){const r=1023+e,i=t.length;for(let o=r;o<i;o++){const r=t[o];null!=r&&r!==n&&(n[o-e]=r)}t.length=r+1,t[r]=n}function me(t,e,n,r,i,o){if(null!=t){if(Array.isArray(t))t=i&&0==t.length&&1&$t(t)?void 0:o&&2&$t(t)?t:ye(t,e,n,void 0!==r,i,o);else if(Kt(t)){const s={};for(let a in t)s[a]=me(t[a],e,n,r,i,o);t=s}else t=e(t,r);return t}}function ye(t,e,n,r,i,o){const s=r||n?$t(t):0;r=r?!!(32&s):void 0;const a=kt(t);for(let t=0;t<a.length;t++)a[t]=me(a[t],e,n,r,i,o);return n&&(re(a,t),n(s,a)),a}function ve(t){return t.B===Jt?t.toJSON():function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"boolean":return t?1:0;case"object":if(t&&!Array.isArray(t)){if(B(t))return P(t);if(t instanceof D){const e=t.C;return null==e?"":"string"==typeof e?e:t.C=P(e)}}}return t}(t)}function be(t,e,n=Wt){if(null!=t){if(O&&t instanceof Uint8Array)return e?t:new Uint8Array(t);if(Array.isArray(t)){const r=$t(t);return 2&r?t:!e||68&r||!(32&r||0===r)?ye(t,be,4&r?Wt:n,!0,!1,!0):(Dt(t,34|r),t)}return t.B===Jt&&(e=t.l,t=2&(n=zt(e))?t:Ae(t,e,n,!0)),t}}function we(t){const e=t.l;return Ae(t,e,zt(e),!1)}function Ae(t,e,n,r){return t=t.constructor,ee=e=_e(e,n,r),e=new t(e),ee=void 0,e}function _e(t,e,n){const r=n||2&e?Wt:Vt,i=!!(32&e);return t=function(t,e,n){const r=kt(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 re(r,t),r}(t,e,(t=>be(t,i,r))),Nt(t,32|(n?2:0)),t}function Se(t){const e=t.l,n=zt(e);return 2&n?Ae(t,e,n,!1):t}function Ee(t,e){return xe(t=t.l,zt(t),e)}function xe(t,e,n,r){if(-1===n)return null;if(n>=Ht(e)){if(256&e)return t[t.length-1][n]}else{var i=t.length;if(r&&256&e&&null!=(r=t[i-1][n]))return r;if((e=n+(+!!(512&e)-1))<i)return t[e]}}function Te(t,e,n,r){const i=t.l,o=zt(i);return Qt(o),Oe(i,o,e,n,r),t}function Oe(t,e,n,r,i){var o=Ht(e);if(n>=o||i){if(i=e,256&e)o=t[t.length-1];else{if(null==r)return;o=t[o+(+!!(512&e)-1)]={},i|=256}o[n]=r,i!==e&&Dt(t,i)}else t[n+(+!!(512&e)-1)]=r,256&e&&(n in(t=t[t.length-1])&&delete t[n])}function Le(t,e,n,r,i){var o=2&e;let s=xe(t,e,n,i);Array.isArray(s)||(s=qt);const a=$t(s);if(1&a||Rt(s),o)2&a||Nt(s,34),1&r||Object.freeze(s);else{o=!(2&r);const u=2&a;1&r||!u?o&&32&a&&!u&&Gt(s,32):(s=Rt(kt(s)),Oe(t,e,n,s,i))}return s}function Pe(t){t=t.l;const e=zt(t),n=xe(t,e,1),r=Yt(n,!0,!!(34&e));return null!=r&&r!==n&&Oe(t,e,1,r),r}function Ie(t,e,n){t=t.l;const r=zt(t);if(Qt(r),null==n)Oe(t,r,e);else{if(!(4&$t(n))){Object.isFrozen(n)&&(n=kt(n));for(let t=0;t<n.length;t++)n[t]=ce(n[t]);Dt(n,5)}Oe(t,r,e,n)}}function je(t,e){t=t.l;const n=zt(t);Qt(n),Oe(t,n,2,""===e?void 0:e)}function Fe(t,e){return Ue(t=t.l,zt(t),jr)===e?e:-1}function Ue(t,e,n){let r=0;for(let i=0;i<n.length;i++){const o=n[i];null!=xe(t,e,o)&&(0!==r&&Oe(t,e,r),r=o)}return r}function Be(t,e,n,r){const i=zt(t);Qt(i);const o=xe(t,i,n,r);let s;if(null!=o&&o.B===Jt)return(e=Se(o))!==o&&Oe(t,i,n,e,r),e.l;if(Array.isArray(o)){const t=$t(o);s=2&t?_e(o,t,!1):o,s=ge(s,e[0],e[1])}else s=ge(void 0,e[0],e[1]);return s!==o&&Oe(t,i,n,s,r),s}function ke(t,e,n,r){t=t.l;const i=zt(t),o=xe(t,i,n,r);return(e=fe(o,e,i))!==o&&null!=e&&Oe(t,i,n,e,r),e}function Ce(t,e,n){if(null==(e=ke(t,e,n,!1)))return e;t=t.l;const r=zt(t);if(!(2&r)){const i=Se(e);i!==e&&Oe(t,r,n,e=i,!1)}return e}function Ne(t,e,n,r){var i=!!(2&e),o=Le(t,e,1,1);if(o===qt||!(4&$t(o))){var s=o;o=!!(2&e);var a=!!(2&$t(s));i=s,!o&&a&&(s=kt(s));var u=e|(a?2:0);a=a||void 0;let c=0,l=0;for(;c<s.length;c++){const t=fe(s[c],n,u);void 0!==t&&(a=a||2&zt(t.l),s[l++]=t)}return l<c&&(s.length=l),u=5|(s=$t(n=s)),s!=(a=a?-9&u:8|u)&&(Object.isFrozen(n)&&(n=kt(n)),Dt(n,a)),i!==(s=n)&&Oe(t,e,1,s),(o&&2!==r||1===r)&&Object.freeze(s),s}return 3===r||(i?2===r&&(r=$t(o),o=kt(o),Dt(o,r),Oe(t,e,1,o)):(i=Object.isFrozen(o),1===r?i||Object.freeze(o):(n=-35&(r=$t(o)),i&&(r=0,Oe(t,e,1,o=kt(o))),r!==n&&Dt(o,n)))),o}function Me(t,e){var n=t.l,r=zt(n);if(e=Ne(n,r,e,(t=!!(2&r))?1:2),!(t||8&$t(e))){for(t=0;t<e.length;t++)(n=e[t])!==(r=Se(n))&&(e[t]=r);Nt(e,8)}return e}function Ge(t,e,n,r,i){return null==r&&(r=void 0),Te(t,n,r,i)}function $e(t,e,n){var r=Gr;null==n&&(n=void 0),t=t.l;const i=zt(t);Qt(i),(r=Ue(t,i,r))&&r!==e&&null!=n&&Oe(t,i,r),Oe(t,i,e,n)}function ze(t,e){var n=fr;t=t.l;const r=zt(t);Qt(r),t=Ne(t,r,n,2),e=null!=e?e:new n,t.push(e),e.u()&&Gt(t,8)}function De(t){return t=null==(t=Ee(t,2))||ae(t)?t:void 0}function Re(t){return t??0}function Ve(t,e,n){n=ce(n),t=t.l;const r=zt(t);Qt(r),Le(t,r,e,2).push(n)}function We(t,e,n){e.g?e.j(t,e.g,e.h,n,!0):e.j(t,e.h,n,!0)}Dt(Xt,39),qt=Object.freeze(Xt);var He=class{constructor(t,e){this.l=ge(t,e)}toJSON(){return qe(this,ye(this.l,ve,void 0,void 0,!1,!1),!0)}u(){return!!(2&$t(this.l))}};function qe(t,e,n){var r=t.constructor.A,i=Ht(zt(n?t.l:e)),o=!1;if(r){if(!n){var s;if((e=kt(e)).length&&Kt(s=e[e.length-1]))for(o=0;o<r.length;o++)if(r[o]>=i){Object.assign(e[e.length-1]={},s);break}o=!0}var a;i=e,n=!n,t=Ht(s=zt(t.l)),s=+!!(512&s)-1;for(let e=0;e<r.length;e++){var u=r[e];if(u<t){var c=i[u+=s];null==c?i[u]=n?qt:Rt([]):n&&c!==qt&&Mt(c)}else{if(!a){var l=void 0;i.length&&Kt(l=i[i.length-1])?a=l:i.push(a={})}c=a[u],null==a[u]?a[u]=n?qt:Rt([]):n&&c!==qt&&Mt(c)}}}if(!(r=e.length))return e;let h,f;if(Kt(a=e[r-1])){t:{var d=a;l={},i=!1;for(let t in d)n=d[t],Array.isArray(n)&&n!=n&&(i=!0),null!=n?l[t]=n:i=!0;if(i){for(let t in l){d=l;break t}d=null}}d!=a&&(h=!0),r--}for(;0<r&&null==(a=e[r-1]);r--)f=!0;return h||f?(e=o?e:Array.prototype.slice.call(e,0,r),o&&(e.length=r),d&&e.push(d),e):e}function Je(t){return{I:kn,F:t}}function Ke(t,e){if(Array.isArray(e)){var n=$t(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),Dt(e,5|n),2&n&&Object.freeze(e),e}}He.prototype.B=Jt,He.prototype.toString=function(){return qe(this,this.l,!1).toString()};const Ye=Symbol();function Xe(t){let e=t[Ye];if(!e){const n=ln(t),r=n.m;e=r?(t,e)=>r(t,e,n):(t,e)=>{for(;ft(e)&&4!=e.h;){var r=e.m,i=n[r];if(!i){var o=n.h;o&&(o=o[r])&&(i=n[r]=Qe(o))}i&&i(e,t,r)||(r=(i=e).j,dt(i),i.H?i=void 0:(o=i.g.g-r,i.g.g=r,i=ct(i.g,o)),r=t,i&&(Zt||=Symbol(),(o=r[Zt])?o.push(i):r[Zt]=[i]))}(e=n.j)&&(t[te||=Symbol()]=e)},t[Ye]=e}return e}function Qe(t){const e=function(t){if(t=t.F)return Xe(t)}(t),n=t.I.g;if(e){const r=ln(t.F).g;return(t,i,o)=>n(t,i,o,r,e)}return(t,e,r)=>n(t,e,r)}function Ze(t,e,n,r){e.g=de(t[0]);let i=1;if(t.length>i&&!(t[i]instanceof Bt)){var o=t[i++];if(Array.isArray(o))return e.m=o[0],e.h=o[1],e;e.h=o}for(o=0;i<t.length;){const l=t[i++];var s=t[i];for("number"==typeof s?(i++,o+=s):o++,l.j&&((s=e.j)||(e.j=s=[]),s.push(o)),s=i;s<t.length&&!(t[s]instanceof Bt);)s++;if(s-=i){var a=t,u=i,c=a[u];if("function"==typeof c&&(c=c(),a[u]=c),(a=Array.isArray(c))&&!(a=an in c||nn in c)&&(a=0<c.length)){const t=de(u=(a=c)[0]);null!=t&&t!==u&&(a[0]=t),a=null!=t}(c=a?c:void 0)?(i++,e[o]=1===s?r(l,c):r(l,c,t[i++])):e[o]=n(l,t[i++])}else e[o]=n(l)}return e}const tn=Symbol();function en(t){let e=t[tn];if(!e){const n=sn(t);e=(t,e)=>fn(t,e,n),t[tn]=e}return e}const nn=Symbol();function rn(t){return t.h}function on(t,e){let n,r;const i=t.h;return(t,o,s)=>i(t,o,s,r||=sn(e).g,n||=en(e))}function sn(t){let e=t[nn];return e||(e=Ze(t,t[nn]={},rn,on),an in t&&nn in t&&(t.length=0),e)}const an=Symbol();function un(t,e){const n=t.g;return e?(t,r,i)=>n(t,r,i,e):n}function cn(t,e,n){const r=t.g;let i,o;return(t,s,a)=>r(t,s,a,o||=ln(e).g,i||=Xe(e),n)}function ln(t){let e=t[an];return e||(e=Ze(t,t[an]={},un,cn),an in t&&nn in t&&(t.length=0),e)}function hn(t,e){var n=t[e];if(n)return n;if((n=t.h)&&(n=n[e])){var r=n.F,i=n.I.h;if(r){const t=en(r),e=sn(r).g;n=(n,r,o)=>i(n,r,o,e,t)}else n=i;return t[e]=n}}function fn(t,e,n){for(var r=zt(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=hn(n,o);a&&a(e,r,o)}if(256&r){r=t[o-1];for(let t in r)i=+t,Number.isNaN(i)||null!=(o=r[t])&&(a=hn(n,i))&&a(e,o,i)}if(t=Zt?t[Zt]:void 0)for(Pt(e,e.g.end()),n=0;n<t.length;n++)Pt(e,z(t[n])||C())}function dn(t,e){return new Bt(t,e,!1)}function gn(t,e){return new Bt(t,e,!0)}function pn(t,e,n){Oe(t,zt(t),e,n)}function mn(t,e,n){t:if(null!=e){if(ae(e)){if("string"==typeof e)break t;if("number"==typeof e)break t}e=void 0}null!=e&&("string"==typeof e&&_t(e),null!=e&&(It(t,n,0),"number"==typeof e?(t=t.g,Q(e),xt(t,Y,X)):(n=_t(e),xt(t.g,n.h,n.g))))}function yn(t,e,n){null!=(e=ue(e))&&null!=e&&(It(t,n,0),Ot(t.g,e))}function vn(t,e,n){null!=(e=null==e?e:"boolean"==typeof e||"number"==typeof e?!!e:void 0)&&(It(t,n,0),t.g.g.push(e?1:0))}function bn(t,e,n){null!=(e=he(e))&&Ut(t,n,c(e))}function wn(t,e,n,r,i){null!=(e=e instanceof He?e.l:Array.isArray(e)?ge(e,r[0],r[1]):void 0)&&(n=jt(t,n),i(e,t),Ft(t,n))}function An(t,e,n){null!=(e=null==e||"string"==typeof e||B(e)||e instanceof D?e:void 0)&&Ut(t,n,q(e).buffer)}var _n=dn((function(t,e,n){return 5===t.h&&(pn(e,n,t.g.v()),!0)}),(function(t,e,n){null!=(e=oe(e))&&(It(t,n,5),t=t.g,Z(e),Lt(t))})),Sn=gn((function(t,e,n){return(5===t.h||2===t.h)&&(e=Le(e,zt(e),n,2,!1),2==t.h?yt(t,lt.prototype.v,e):e.push(t.g.v()),!0)}),(function(t,e,n){if(null!=(e=Ke(oe,e))&&e.length){It(t,n,2),Tt(t.g,4*e.length);for(let r=0;r<e.length;r++)n=t.g,Z(e[r]),Lt(n)}})),En=dn((function(t,e,n){return 0===t.h&&(pn(e,n,st(t.g,et)),!0)}),mn),xn=dn((function(t,e,n){return 0===t.h&&(pn(e,n,0===(t=st(t.g,et))?void 0:t),!0)}),mn),Tn=dn((function(t,e,n){return 0===t.h&&(pn(e,n,st(t.g,tt)),!0)}),(function(t,e,n){t:if(null!=e){if(ae(e)){if("string"==typeof e)break t;if("number"==typeof e)break t}e=void 0}null!=e&&("string"==typeof e&&bt(e),null!=e&&(It(t,n,0),"number"==typeof e?(t=t.g,Q(e),xt(t,Y,X)):(n=bt(e),xt(t.g,n.h,n.g))))})),On=dn((function(t,e,n){return 0===t.h&&(pn(e,n,t.g.h()),!0)}),yn),Ln=gn((function(t,e,n){return(0===t.h||2===t.h)&&(e=Le(e,zt(e),n,2,!1),2==t.h?yt(t,lt.prototype.h,e):e.push(t.g.h()),!0)}),(function(t,e,n){if(null!=(e=Ke(ue,e))&&e.length){n=jt(t,n);for(let n=0;n<e.length;n++)Ot(t.g,e[n]);Ft(t,n)}})),Pn=dn((function(t,e,n){return 0===t.h&&(pn(e,n,0===(t=t.g.h())?void 0:t),!0)}),yn),In=dn((function(t,e,n){return 0===t.h&&(pn(e,n,at(t.g)),!0)}),vn),jn=dn((function(t,e,n){return 0===t.h&&(pn(e,n,!1===(t=at(t.g))?void 0:t),!0)}),vn),Fn=gn((function(t,e,n){if(2!==t.h)return!1;t=pt(t);const r=zt(e);return Qt(r),Le(e,r,n,2).push(t),!0}),(function(t,e,n){if(null!=(e=Ke(he,e)))for(let i=0;i<e.length;i++){var r=e[i];null!=r&&Ut(t,n,c(r))}})),Un=dn((function(t,e,n){return 2===t.h&&(pn(e,n,""===(t=pt(t))?void 0:t),!0)}),bn),Bn=dn((function(t,e,n){return 2===t.h&&(pn(e,n,pt(t)),!0)}),bn),kn=dn((function(t,e,n,r,i){return 2===t.h&&(gt(t,Be(e,r,n,!0),i),!0)}),wn),Cn=dn((function(t,e,n,r,i){return 2===t.h&&(gt(t,Be(e,r,n),i),!0)}),wn),Nn=gn((function(t,e,n,r,i){if(2!==t.h)return!1;r=ge(void 0,r[0],r[1]);const o=zt(e);Qt(o);let s=Le(e,o,n,3);return(Object.isFrozen(s)||4&$t(s))&&(s=kt(s),Oe(e,o,n,s)),s.push(r),gt(t,r,i),!0}),(function(t,e,n,r,i){if(Array.isArray(e))for(let o=0;o<e.length;o++)wn(t,e[o],n,r,i)})),Mn=dn((function(t,e,n,r,i,o){if(2!==t.h)return!1;const s=zt(e);return Qt(s),(o=Ue(e,s,o))&&n!==o&&Oe(e,s,o),gt(t,e=Be(e,r,n),i),!0}),wn),Gn=dn((function(t,e,n){return 2===t.h&&(pn(e,n,mt(t)),!0)}),An),$n=dn((function(t,e,n){return 0===t.h&&(pn(e,n,t.g.h()),!0)}),(function(t,e,n){null!=(e=ue(e))&&(e=parseInt(e,10),It(t,n,0),Ot(t.g,e))})),zn=gn((function(t,e,n){return(0===t.h||2===t.h)&&(e=Le(e,zt(e),n,2,!1),2==t.h?yt(t,lt.prototype.P,e):e.push(t.g.h()),!0)}),(function(t,e,n){if(null!=(e=Ke(ue,e))&&e.length){n=jt(t,n);for(let n=0;n<e.length;n++)Ot(t.g,e[n]);Ft(t,n)}}));class Dn{constructor(t,e){this.h=t,this.g=e,this.j=Ge,this.defaultValue=void 0}}function Rn(t,e){return(n,r)=>{t:{if(vt.length){const t=vt.pop();t.s(r),it(t.g,n,r),n=t}else n=new class{constructor(t,e){if(ht.length){const n=ht.pop();it(n,t,e),t=n}else t=new lt(t,e);this.g=t,this.j=this.g.g,this.h=this.m=-1,this.s(e)}s({H:t=!1}={}){this.H=t}}(n,r);try{var i=new t;const r=i.l;Xe(e)(r,n),te&&delete r[te];var o=i;break t}finally{(i=n.g).j=null,i.o=!1,i.G=0,i.m=0,i.g=0,i.D=!1,n.m=-1,n.h=-1,100>vt.length&&vt.push(n)}o=void 0}return o}}var Vn,Wn=[0,Un,dn((function(t,e,n){return 2===t.h&&(pn(e,n,(t=mt(t))===$()?void 0:t),!0)}),(function(t,e,n){if(null!=e){if(e instanceof He){const r=e.R;return void(r&&(e=r(e),null!=e&&Ut(t,n,q(e).buffer)))}if(Array.isArray(e))return}An(t,e,n)}))];function Hn(n){if(void 0===Vn){var r=null,i=t.trustedTypes;if(i&&i.createPolicy){try{r=i.createPolicy("goog#html",{createHTML:e,createScript:e,createScriptURL:e})}catch(e){t.console&&t.console.error(e.message)}Vn=r}else Vn=r}return n=(r=Vn)?r.createScriptURL(n):n,new class{constructor(t){this.g=t}toString(){return this.g+""}}(n)}var qn=[0,Bn],Jn=[0,On,$n,In,In,Ln,$n,$n],Kn=[0,In,In],Yn=class extends He{constructor(){super()}};Yn.A=[6];var Xn=[0,In,Bn,In,$n,$n,zn,Bn,Bn,Cn,Kn,$n],Qn=[0,Bn,Bn,Bn],Zn=class extends He{constructor(){super()}},tr=[0],er=[0,On],nr=[1,2,3,4,5],rr=class extends He{constructor(t){super(t,2)}},ir={},or=[-2,ir,In];ir[336783863]=Je([0,Bn,In,In,On,Cn,[0,Mn,tr,nr,Mn,Xn,nr,Mn,Qn,nr,Mn,er,nr,Mn,Jn,nr],Cn,qn]);var sr=[0,Un,jn],ar=[0,xn,xn,jn,jn,jn,jn,xn,Ln,Un,Pn,xn,xn,jn,Pn,jn,jn,jn,Un],ur=[-1,{}],cr=[0,Bn,Cn,2,ur],lr=[0,Bn,Fn,Cn,ur];function hr(t){Ve(t,3,"TEXT:text_in")}var fr=class extends He{constructor(t){super(t,500)}s(t){return Ge(this,0,7,t)}};fr.A=[3,4,5,6,8,13,17,1005];var dr=[-500,Un,Un,Fn,Fn,Fn,Fn,Cn,or,Nn,Wn,Pn,Pn,Cn,cr,Cn,lr,Nn,sr,Un,Cn,ar,Pn,Fn,Fn,988],gr=[0,Un,Un,Cn,ur],pr=[-500,Bn,Bn,Cn,[-1,{}],Bn,999],mr=[-500,Bn,Fn,Fn,Cn,[-2,{},In],Fn,998,Fn],yr=[-500,Bn,Fn,Cn,ur,Fn,999];function vr(t){Ve(t,10,"text_in")}var br,wr=class extends He{constructor(){super(void 0,500)}s(t){return Ge(this,0,1001,t)}};wr.A=[1,6,7,9,10,15,16,17,14,1002],wr.prototype.g=(br=[-500,Nn,dr,Nn,5,pr,Nn,mr,Pn,Nn,yr,Fn,Pn,Cn,cr,Cn,lr,Nn,gr,Fn,Fn,Fn,Cn,ar,Un,Un,jn,Cn,980,ur,Nn,Wn],function(){const t=new class{constructor(){this.j=[],this.h=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){const t=this.g;return this.g=[],t}}}};fn(this.l,t,sn(br)),Pt(t,t.g.end());const e=new Uint8Array(t.h),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 Ar=class extends He{constructor(t){super(t)}},_r=[0,On,_n,Bn,Bn],Sr=class extends He{constructor(t){super(t)}g(){return Me(this,Ar)}};Sr.A=[1];var Er=class extends He{constructor(t){super(t)}},xr=[0,On,2,Bn,Cn,[0,Nn,_r]],Tr=class extends He{constructor(t){super(t)}};Tr.A=[1];var Or=Rn(Tr,[0,Nn,xr,En]),Lr=class extends He{constructor(t){super(t)}};Lr.A=[1];var Pr=class extends He{constructor(t){super(t)}J(){const t=Pe(this);return null==t?$():t}},Ir=class extends He{constructor(t){super(t)}},jr=[1,2],Fr=[0,Mn,[0,Sn],jr,Mn,[0,Gn],jr,On,Bn],Ur=class extends He{constructor(t){super(t)}};Ur.A=[1];var Br=Rn(Ur,[0,Nn,Fr,En]),kr=class extends He{constructor(t){super(t)}};kr.A=[4,5];var Cr=class extends He{constructor(t){super(t)}},Nr=[0,In,In],Mr=class extends He{constructor(t){super(t)}},Gr=[1,2,3,4,5],$r=class extends He{constructor(t){super(t)}g(){return null!=Pe(this)}h(){return null!=he(Ee(this,2))}},zr=class extends He{constructor(t){super(t)}},Dr=[0,Cn,[0,Gn,Bn,Cn,[0,On,En,En],Cn,[0,Tn,En]],In,Cn,[0,Mn,er,Gr,Mn,Xn,Gr,Mn,Jn,Gr,Mn,tr,Gr,Mn,Qn,Gr]],Rr=class extends He{constructor(t){super(t)}},Vr=new Dn(462704549,Rr);ir[462704549]=Je([0,Cn,Dr,Cn,[0,Bn,On,_n,Fn,Fn]]);var Wr=class extends He{constructor(t){super(t)}},Hr=new Dn(477589892,Wr);function qr(e,n){if(n=n?we(n):new kr,void 0!==e.displayNamesLocale?Te(n,1,le(e.displayNamesLocale)):void 0===e.displayNamesLocale&&Te(n,1),void 0!==e.maxResults){var r=e.maxResults;if(null!=r){if("number"!=typeof r)throw ie(e=Error(),"warning"),e;if(!Number.isFinite(r)){const e=Error();ie(e,"incident"),function(e){t.setTimeout((()=>{throw e}),0)}(e)}}Te(n,2,r)}else"maxResults"in e&&Te(n,2);if(void 0!==e.scoreThreshold){if(null!=(r=e.scoreThreshold)&&"number"!=typeof r)throw Error(`Value of float/double field must be a number, found ${typeof r}: ${r}`);Te(n,3,r)}else"scoreThreshold"in e&&Te(n,3);return void 0!==e.categoryAllowlist?Ie(n,4,e.categoryAllowlist):"categoryAllowlist"in e&&Te(n,4),void 0!==e.categoryDenylist?Ie(n,5,e.categoryDenylist):"categoryDenylist"in e&&Te(n,5),n}function Jr(t){const e={classifications:Me(t,Er).map((t=>function(t,e=-1,n=""){return{categories:t.map((t=>{var e=ue(Ee(t,1))??0??-1;const n=t.l,r=zt(n),i=xe(n,r,2),o=oe(i);return null!=o&&o!==i&&Oe(n,r,2,o),{index:e,score:o??0??0,categoryName:he(Ee(t,3))??""??"",displayName:he(Ee(t,4))??""??""}})),headIndex:e,headName:n}}(Ce(t,Sr,4)?.g()??[],ue(Ee(t,2))??0,he(Ee(t,3))??"")))};return null!=De(t)&&(e.timestampMs=Re(De(t))),e}function Kr(t){return Array.from(t,(t=>127<t?t-256:t))}function Yr(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(0>=r||0>=i)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return n/Math.sqrt(r*i)}let Xr;ir[477589892]=Je([0,Cn,Dr,Cn,Nr]);const Qr=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 Zr(){if(void 0===Xr)try{await WebAssembly.instantiate(Qr),Xr=!0}catch{Xr=!1}return Xr}async function ti(t,e){const n=await Zr()?"wasm_internal":"wasm_nosimd_internal";return void 0!==e?{wasmLoaderPath:`${e}/${t}_${n}.js`,wasmBinaryPath:`${e}/${t}_${n}.wasm`}:{wasmLoaderPath:Hn(`./${encodeURIComponent(t)}_${encodeURIComponent(n)}.js`),wasmBinaryPath:Hn(`./${encodeURIComponent(t)}_${encodeURIComponent(n)}.wasm`)}}var ei=class{};async function ni(t){if("function"!=typeof importScripts){const e=document.createElement("script");return e.src=t.toString(),e.crossOrigin="anonymous",new Promise(((t,n)=>{e.addEventListener("load",(()=>{t()}),!1),e.addEventListener("error",(t=>{n(t)}),!1),document.body.appendChild(e)}))}importScripts(t.toString())}ei.forVisionTasks=function(t=""){return ti("vision",t)},ei.forTextTasks=function(t=""){return ti("text",t)},ei.forAudioTasks=function(t=""){return ti("audio",t)},ei.isSimdSupported=function(){return Zr()};function ri(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.i.stringToNewUTF8(e)),t.i._free(e)}function ii(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.i.stringToNewUTF8(e[n]);e=t.i._malloc(4*r.length),t.i.HEAPU32.set(r,e>>2),n(e);for(const e of r)t.i._free(e);t.i._free(e)}function oi(t,e,n){t.i.simpleListeners=t.i.simpleListeners||{},t.i.simpleListeners[e]=n}function si(t,e,n){let r=[];t.i.simpleListeners=t.i.simpleListeners||{},t.i.simpleListeners[e]=(t,e,i)=>{e?(n(r,i),r=[]):r.push(t)}}const ai=function(t){return class extends t{O(){this.i._registerModelResourcesGraphService()}}}(class{constructor(t,e){this.j=!0,this.i=t,this.g=null,this.h=0,this.m="function"==typeof this.i._addIntToInputStream,void 0!==e?this.i.canvas=e:((t="undefined"==typeof OffscreenCanvas)||(t=(t=navigator.userAgent).includes("Safari")&&!t.includes("Chrome")),t?(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.i.canvas=document.createElement("canvas")):this.i.canvas=new OffscreenCanvas(1,1))}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.i._malloc(n);this.i.HEAPU8.set(t,r),e?this.i._changeBinaryGraph(n,r):this.i._changeTextGraph(n,r),this.i._free(r)}configureAudio(t,e,n,r,i){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),ri(this,r||"input_audio",(r=>{ri(this,i=i||"audio_header",(i=>{this.i._configureAudio(r,i,t,e,n)}))}))}setAutoResizeCanvas(t){this.j=t}setAutoRenderToScreen(t){this.i._setAutoRenderToScreen(t)}setGpuBufferVerticalFlip(t){this.i.gpuOriginForWebTexturesIsBottomLeft=t}attachErrorListener(t){this.i.errorListener=t}attachEmptyPacketListener(t,e){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.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.h!==o&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(o),this.h=o),this.i.HEAPF32.set(t,this.g/4),ri(this,r,(t=>{this.i._addAudioToInputStream(this.g,e,n,t,i)}))}addGpuBufferToStream(t,e,n){ri(this,e,(e=>{if(!this.i.canvas)throw Error("No OpenGL canvas configured.");e?this.i._bindTextureToStream(e):this.i._bindTextureToCanvas();var r=this.i.canvas.getContext("webgl2")||this.i.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`.");let i;this.i.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!0),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t),this.i.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),t.videoWidth?(r=t.videoWidth,i=t.videoHeight):t.naturalWidth?(r=t.naturalWidth,i=t.naturalHeight):(r=t.width,i=t.height),!this.j||r===this.i.canvas.width&&i===this.i.canvas.height||(this.i.canvas.width=r,this.i.canvas.height=i);const[o,s]=[r,i];this.i._addBoundTextureToStream(e,o,s,n)}))}addBoolToStream(t,e,n){ri(this,e,(e=>{this.i._addBoolToInputStream(t,e,n)}))}addDoubleToStream(t,e,n){ri(this,e,(e=>{this.i._addDoubleToInputStream(t,e,n)}))}addFloatToStream(t,e,n){ri(this,e,(e=>{this.i._addFloatToInputStream(t,e,n)}))}addIntToStream(t,e,n){ri(this,e,(e=>{this.i._addIntToInputStream(t,e,n)}))}addStringToStream(t,e,n){ri(this,e,(e=>{ri(this,t,(t=>{this.i._addStringToInputStream(t,e,n)}))}))}addStringRecordToStream(t,e,n){ri(this,e,(e=>{ii(this,Object.keys(t),(r=>{ii(this,Object.values(t),(i=>{this.i._addFlatHashMapToInputStream(r,i,Object.keys(t).length,e,n)}))}))}))}addProtoToStream(t,e,n,r){ri(this,n,(n=>{ri(this,e,(e=>{const i=this.i._malloc(t.length);this.i.HEAPU8.set(t,i),this.i._addProtoToInputStream(i,t.length,e,n,r),this.i._free(i)}))}))}addEmptyPacketToStream(t,e){ri(this,t,(t=>{this.i._addEmptyPacketToInputStream(t,e)}))}addBoolToInputSidePacket(t,e){ri(this,e,(e=>{this.i._addBoolToInputSidePacket(t,e)}))}addDoubleToInputSidePacket(t,e){ri(this,e,(e=>{this.i._addDoubleToInputSidePacket(t,e)}))}addFloatToInputSidePacket(t,e){ri(this,e,(e=>{this.i._addFloatToInputSidePacket(t,e)}))}addIntToInputSidePacket(t,e){ri(this,e,(e=>{this.i._addIntToInputSidePacket(t,e)}))}addStringToInputSidePacket(t,e){ri(this,e,(e=>{ri(this,t,(t=>{this.i._addStringToInputSidePacket(t,e)}))}))}addProtoToInputSidePacket(t,e,n){ri(this,n,(n=>{ri(this,e,(e=>{const r=this.i._malloc(t.length);this.i.HEAPU8.set(t,r),this.i._addProtoToInputSidePacket(r,t.length,e,n),this.i._free(r)}))}))}attachBoolListener(t,e){oi(this,t,e),ri(this,t,(t=>{this.i._attachBoolListener(t)}))}attachBoolVectorListener(t,e){si(this,t,e),ri(this,t,(t=>{this.i._attachBoolVectorListener(t)}))}attachIntListener(t,e){oi(this,t,e),ri(this,t,(t=>{this.i._attachIntListener(t)}))}attachIntVectorListener(t,e){si(this,t,e),ri(this,t,(t=>{this.i._attachIntVectorListener(t)}))}attachDoubleListener(t,e){oi(this,t,e),ri(this,t,(t=>{this.i._attachDoubleListener(t)}))}attachDoubleVectorListener(t,e){si(this,t,e),ri(this,t,(t=>{this.i._attachDoubleVectorListener(t)}))}attachFloatListener(t,e){oi(this,t,e),ri(this,t,(t=>{this.i._attachFloatListener(t)}))}attachFloatVectorListener(t,e){si(this,t,e),ri(this,t,(t=>{this.i._attachFloatVectorListener(t)}))}attachStringListener(t,e){oi(this,t,e),ri(this,t,(t=>{this.i._attachStringListener(t)}))}attachStringVectorListener(t,e){si(this,t,e),ri(this,t,(t=>{this.i._attachStringVectorListener(t)}))}attachProtoListener(t,e,n){oi(this,t,e),ri(this,t,(t=>{this.i._attachProtoListener(t,n||!1)}))}attachProtoVectorListener(t,e,n){si(this,t,e),ri(this,t,(t=>{this.i._attachProtoVectorListener(t,n||!1)}))}attachAudioListener(t,e,n){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),oi(this,t,((t,n)=>{t=new Float32Array(t.buffer,t.byteOffset,t.length/4),e(t,n)})),ri(this,t,(t=>{this.i._attachAudioListener(t,n||!1)}))}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}});var ui=class extends ai{};async function ci(t,e,n){return t=await(async(t,e,n,r)=>{if(e&&await ni(e),!self.ModuleFactory)throw Error("ModuleFactory not set.");if(n&&(await ni(n),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&r&&((e=self.Module).locateFile=r.locateFile,r.mainScriptUrlOrBlob&&(e.mainScriptUrlOrBlob=r.mainScriptUrlOrBlob)),r=await self.ModuleFactory(self.Module||r),self.ModuleFactory=self.Module=void 0,new t(r,null)})(t,e.wasmLoaderPath,e.assetLoaderPath,{locateFile(t){var n=e.wasmBinaryPath.toString();return n.includes(t)?n:(n=e.assetBinaryPath?.toString(),n?.includes(t)?n:t)}}),await t.s(n),t}async function li(t,e,n){return ci(t,e,n)}function hi(t,e){const n=Ce(t.baseOptions,$r,1)||new $r;"string"==typeof e?(Te(n,2,le(e)),Te(n,1)):e instanceof Uint8Array&&(Te(n,1,Yt(e,!1,!1)),Te(n,2)),Ge(t.baseOptions,0,1,n)}function fi(t,e){const n=e.baseOptions||{};if(e.baseOptions?.modelAssetBuffer&&e.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(Ce(t.baseOptions,$r,1)?.g()||Ce(t.baseOptions,$r,1)?.h()||e.baseOptions?.modelAssetBuffer||e.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");return function(t,e){let n=Ce(t.baseOptions,Mr,3);if(!n){var r=n=new Mr;$e(r,4,new Zn)}"delegate"in e&&("GPU"===e.delegate?$e(e=n,2,r=new Yn):$e(e=n,4,r=new Zn)),Ge(t.baseOptions,0,3,n)}(t,n),n.modelAssetPath?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.i.FS_unlink("/model.dat")}catch{}t.g.i.FS_createDataFile("/","model.dat",new Uint8Array(e),!0,!1,!1),hi(t,"/model.dat"),t.v()})):(hi(t,n.modelAssetBuffer),t.v(),Promise.resolve())}function di(t){try{const e=t.m.length;if(1===e)throw Error(t.m[0].message);if(1<e)throw Error("Encountered multiple errors: "+t.m.map((t=>t.message)).join(", "))}finally{t.m=[]}}function gi(t,e){t.j=Math.max(t.j,e)}var pi=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.O(),this.g.setGraph(t,e),di(this)}finishProcessing(){this.g.finishProcessing(),di(this)}close(){this.g.closeGraph()}};pi.prototype.close=pi.prototype.close;var mi=class extends pi{constructor(t,e){super(new ui(t,e)),this.o={languages:[]},this.h=new Rr,t=new zr,Ge(this.h,0,1,t)}s(t){var e=qr(t,Ce(this.h,kr,2));return Ge(this.h,0,2,e),fi(this,t)}get baseOptions(){return Ce(this.h,zr,1)}set baseOptions(t){Ge(this.h,0,1,t)}M(t){return this.o={languages:[]},this.g.addStringToStream(t,"text_in",this.j+1),this.finishProcessing(),this.o}v(){var t=new wr;vr(t),Ve(t,15,"classifications_out");const e=new rr;We(e,Vr,this.h);const n=new fr;je(n,le("mediapipe.tasks.text.text_classifier.TextClassifierGraph")),hr(n),Ve(n,4,"CLASSIFICATIONS:classifications_out"),n.s(e),ze(t,n),this.g.attachProtoListener("classifications_out",((t,e)=>{if(({classifications:t}=Jr(Or(t))),1!==t.length)throw Error(`Expected 1 classification head, got ${t.length}`);this.o.languages=t[0].categories.map((t=>({languageCode:t.categoryName,probability:t.score}))),gi(this,e)})),this.g.attachEmptyPacketListener("classifications_out",(t=>{gi(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};mi.prototype.detect=mi.prototype.M,mi.prototype.setOptions=mi.prototype.s,mi.createFromModelPath=function(t,e){return li(mi,t,{baseOptions:{modelAssetPath:e}})},mi.createFromModelBuffer=function(t,e){return li(mi,t,{baseOptions:{modelAssetBuffer:e}})},mi.createFromOptions=function(t,e){return li(mi,t,e)};var yi=class extends pi{constructor(t,e){super(new ui(t,e)),this.o={classifications:[]},this.h=new Rr,t=new zr,Ge(this.h,0,1,t)}s(t){var e=qr(t,Ce(this.h,kr,2));return Ge(this.h,0,2,e),fi(this,t)}get baseOptions(){return Ce(this.h,zr,1)}set baseOptions(t){Ge(this.h,0,1,t)}L(t){return this.o={classifications:[]},this.g.addStringToStream(t,"text_in",this.j+1),this.finishProcessing(),this.o}v(){var t=new wr;vr(t),Ve(t,15,"classifications_out");const e=new rr;We(e,Vr,this.h);const n=new fr;je(n,le("mediapipe.tasks.text.text_classifier.TextClassifierGraph")),hr(n),Ve(n,4,"CLASSIFICATIONS:classifications_out"),n.s(e),ze(t,n),this.g.attachProtoListener("classifications_out",((t,e)=>{this.o=Jr(Or(t)),gi(this,e)})),this.g.attachEmptyPacketListener("classifications_out",(t=>{gi(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};yi.prototype.classify=yi.prototype.L,yi.prototype.setOptions=yi.prototype.s,yi.createFromModelPath=function(t,e){return li(yi,t,{baseOptions:{modelAssetPath:e}})},yi.createFromModelBuffer=function(t,e){return li(yi,t,{baseOptions:{modelAssetBuffer:e}})},yi.createFromOptions=function(t,e){return li(yi,t,e)};var vi=class extends pi{constructor(t,e){super(new ui(t,e)),this.o={embeddings:[]},this.h=new Wr,t=new zr,Ge(this.h,0,1,t)}s(t){var e=this.h,n=Ce(this.h,Cr,2);return n=n?we(n):new Cr,void 0!==t.l2Normalize?Te(n,1,se(t.l2Normalize)):"l2Normalize"in t&&Te(n,1),void 0!==t.quantize?Te(n,2,se(t.quantize)):"quantize"in t&&Te(n,2),Ge(e,0,2,n),fi(this,t)}get baseOptions(){return Ce(this.h,zr,1)}set baseOptions(t){Ge(this.h,0,1,t)}N(t){return this.g.addStringToStream(t,"text_in",this.j+1),this.finishProcessing(),this.o}v(){var t=new wr;vr(t),Ve(t,15,"embeddings_out");const e=new rr;We(e,Hr,this.h);const n=new fr;je(n,le("mediapipe.tasks.text.text_embedder.TextEmbedderGraph")),hr(n),Ve(n,4,"EMBEDDINGS:embeddings_out"),n.s(e),ze(t,n),this.g.attachProtoListener("embeddings_out",((t,e)=>{t=Br(t),this.o=function(t){return{embeddings:Me(t,Ir).map((t=>{const e={headIndex:ue(Ee(t,3))??0??-1,headName:he(Ee(t,4))??""??""};if(void 0!==ke(t,Lr,Fe(t,1))){t=Ce(t,Lr,Fe(t,1)).l;var n=zt(t);const r=2&n;let i=Le(t,n,1,1),o=$t(i);if(!(4&o)){Object.isFrozen(i)&&(o=0,i=kt(i),Oe(t,n,1,i));let e=0,s=0;for(;e<i.length;e++){const t=oe(i[e]);null!=t&&(i[s++]=t)}s<e&&(i.length=s),o|=5,r&&(o|=34),Dt(i,o),2&o&&Object.freeze(i)}!r&&(2&o||Object.isFrozen(i))&&(i=kt(i),Nt(i,5),Oe(t,n,1,i)),e.floatEmbedding=i}else n=new Uint8Array(0),e.quantizedEmbedding=Ce(t,Pr,Fe(t,2))?.J()?.K()??n;return e})),timestampMs:Re(De(t))}}(t),gi(this,e)})),this.g.attachEmptyPacketListener("embeddings_out",(t=>{gi(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};vi.cosineSimilarity=function(t,e){if(t.floatEmbedding&&e.floatEmbedding)t=Yr(t.floatEmbedding,e.floatEmbedding);else{if(!t.quantizedEmbedding||!e.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");t=Yr(Kr(t.quantizedEmbedding),Kr(e.quantizedEmbedding))}return t},vi.prototype.embed=vi.prototype.N,vi.prototype.setOptions=vi.prototype.s,vi.createFromModelPath=function(t,e){return li(vi,t,{baseOptions:{modelAssetPath:e}})},vi.createFromModelBuffer=function(t,e){return li(vi,t,{baseOptions:{modelAssetBuffer:e}})},vi.createFromOptions=function(t,e){return li(vi,t,e)};export{ei as FilesetResolver,mi as LanguageDetector,pi as TaskRunner,yi as TextClassifier,vi as TextEmbedder};
|
|
1
|
+
var t=self;function e(){throw Error("Invalid UTF8")}function n(t,e){return e=String.fromCharCode.apply(null,e),null==t?e:t+e}let r,i;const o="undefined"!=typeof TextDecoder;let s;const a="undefined"!=typeof TextEncoder;function u(t){if(a)t=(s||=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(128>e)r[n++]=e;else{if(2048>e)r[n++]=e>>6|192;else{if(55296<=e&&57343>=e){if(56319>=e&&i<t.length){const o=t.charCodeAt(++i);if(56320<=o&&57343>=o){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 c,l;t:{for(var h=["CLOSURE_FLAGS"],f=t,d=0;d<h.length;d++)if(null==(f=f[h[d]])){l=null;break t}l=f}var g,p=l&&l[610401301];c=null!=p&&p;const m=t.navigator;function y(t){return!!c&&(!!g&&g.brands.some((({brand:e})=>e&&-1!=e.indexOf(t))))}function v(e){var n;return(n=t.navigator)&&(n=n.userAgent)||(n=""),-1!=n.indexOf(e)}function b(){return!!c&&(!!g&&0<g.brands.length)}function w(){return b()?y("Chromium"):(v("Chrome")||v("CriOS"))&&!(!b()&&v("Edge"))||v("Silk")}g=m&&m.userAgentData||null;var A=!b()&&(v("Trident")||v("MSIE"));!v("Android")||w(),w(),v("Safari")&&(w()||!b()&&v("Coast")||!b()&&v("Opera")||!b()&&v("Edge")||(b()?y("Microsoft Edge"):v("Edg/"))||b()&&y("Opera"));var _={},S=null;function E(t){var e=t.length,n=3*e/4;n%3?n=Math.floor(n):-1!="=.".indexOf(t[e-1])&&(n=-1!="=.".indexOf(t[e-2])?n-2:n-1);var r=new Uint8Array(n),i=0;return function(t,e){function n(e){for(;r<t.length;){var n=t.charAt(r++),i=S[n];if(null!=i)return i;if(!/^[\s\xa0]*$/.test(n))throw Error("Unknown base64 encoding at char: "+n)}return e}x();for(var r=0;;){var i=n(-1),o=n(0),s=n(64),a=n(64);if(64===a&&-1===i)break;e(i<<2|o>>4),64!=s&&(e(o<<4&240|s>>2),64!=a&&e(s<<6&192|a))}}(t,(function(t){r[i++]=t})),i!==n?r.subarray(0,i):r}function x(){if(!S){S={};for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),e=["+/=","+/","-_=","-_.","-_"],n=0;5>n;n++){var r=t.concat(e[n].split(""));_[n]=r;for(var i=0;i<r.length;i++){var o=r[i];void 0===S[o]&&(S[o]=i)}}}}var T="undefined"!=typeof Uint8Array,O=!A&&"function"==typeof btoa;function P(t){if(!O){var e;void 0===e&&(e=0),x(),e=_[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 L=/[-_.]/g,F={"-":"+",_:"/",".":"="};function I(t){return F[t]||""}function j(t){if(!O)return E(t);L.test(t)&&(t=t.replace(L,I)),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 T&&null!=t&&t instanceof Uint8Array}let k;function U(){return k||=new Uint8Array(0)}var C={};let N;function M(t){if(t!==C)throw Error("illegal external caller")}function G(){return N||=new D(null,C)}function z(t){M(C);var e=t.F;return null==(e=null==e||B(e)?e:"string"==typeof e?j(e):null)?e:t.F=e}var D=class{constructor(t,e){if(M(e),this.F=t,null!=t&&0===t.length)throw Error("ByteString should be constructed with non-empty values")}M(){const t=z(this);return t?new Uint8Array(t):U()}};function $(t,e){return Error(`Invalid wire type: ${t} (at position ${e})`)}function R(){return Error("Failed to read varint, encoding is invalid.")}function V(t,e){return Error(`Tried to read past the end of the data ${e} > ${t}`)}function W(t){return 0==t.length?G():new D(t,C)}function H(t){if("string"==typeof t)return{buffer:j(t),B:!1};if(Array.isArray(t))return{buffer:new Uint8Array(t),B:!1};if(t.constructor===Uint8Array)return{buffer:t,B:!1};if(t.constructor===ArrayBuffer)return{buffer:new Uint8Array(t),B:!1};if(t.constructor===D)return{buffer:z(t)||U(),B:!0};if(t instanceof Uint8Array)return{buffer:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),B:!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")}const q="function"==typeof Uint8Array.prototype.slice;let J,K=0,Y=0;function X(t){const e=0>t;let n=(t=Math.abs(t))>>>0;if(t=Math.floor((t-n)/4294967296),e){const[e,r]=nt(n,t);t=r,n=e}K=n>>>0,Y=t>>>0}function Q(t){const e=J||=new DataView(new ArrayBuffer(8));e.setFloat32(0,+t,!0),Y=0,K=e.getUint32(0,!0)}function Z(t,e){return 4294967296*e+(t>>>0)}function tt(t,e){const n=2147483648&e;return n&&(e=~e>>>0,0==(t=1+~t>>>0)&&(e=e+1>>>0)),t=Z(t,e),n?-t:t}function et(t){if(16>t.length)X(Number(t));else if("function"==typeof BigInt)t=BigInt(t),K=Number(t&BigInt(4294967295))>>>0,Y=Number(t>>BigInt(32)&BigInt(4294967295));else{const e=+("-"===t[0]);Y=K=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));Y*=1e6,K=1e6*K+e,4294967296<=K&&(Y+=Math.trunc(K/4294967296),Y>>>=0,K>>>=0)}if(e){const[t,e]=nt(K,Y);K=t,Y=e}}}function nt(t,e){return e=~e,t?t=1+~t:e+=1,[t,e]}function rt(t,e,{G:n=!1}={}){t.G=n,e&&(e=H(e),t.j=e.buffer,t.o=e.B,t.I=0,t.m=t.j.length,t.g=t.I)}function it(t,e){if(t.g=e,e>t.m)throw V(t.m,e)}function ot(t,e){let n,r=0,i=0,o=0;const s=t.j;let a=t.g;do{n=s[a++],r|=(127&n)<<o,o+=7}while(32>o&&128&n);for(32<o&&(i|=(127&n)>>4),o=3;32>o&&128&n;o+=7)n=s[a++],i|=(127&n)<<o;if(it(t,a),128>n)return e(r>>>0,i>>>0);throw R()}function st(t){let e=0,n=t.g;const r=n+10,i=t.j;for(;n<r;){const r=i[n++];if(e|=r,0==(128&r))return it(t,n),!!(127&e)}throw R()}function at(t,e){if(0>e)throw Error(`Tried to read a negative byte length: ${e}`);const n=t.g,r=n+e;if(r>t.m)throw V(e,t.m-n);return t.g=r,n}function ut(t,e){if(0==e)return G();var n=at(t,e);return t.G&&t.o?n=t.j.subarray(n,n+e):(t=t.j,n=n===(e=n+e)?U():q?t.slice(n,e):new Uint8Array(t.subarray(n,e))),W(n)}var ct=class{constructor(t,e){this.j=null,this.o=!1,this.g=this.m=this.I=0,rt(this,t,e)}h(){const t=this.j;let e=this.g,n=t[e++],r=127&n;if(128&n&&(n=t[e++],r|=(127&n)<<7,128&n&&(n=t[e++],r|=(127&n)<<14,128&n&&(n=t[e++],r|=(127&n)<<21,128&n&&(n=t[e++],r|=n<<28,128&n&&128&t[e++]&&128&t[e++]&&128&t[e++]&&128&t[e++]&&128&t[e++])))))throw R();return it(this,e),r}v(){var t=this.j;const e=this.g;var n=t[e],r=t[e+1],i=t[e+2];return t=t[e+3],it(this,this.g+4),n=2*((i=(n<<0|r<<8|i<<16|t<<24)>>>0)>>31)+1,r=i>>>23&255,i&=8388607,255==r?i?NaN:1/0*n:0==r?n*Math.pow(2,-149)*i:n*Math.pow(2,r-150)*(i+Math.pow(2,23))}U(){return this.h()}},lt=[];function ht(t){var e=t.g;if(e.g==e.m)return!1;t.j=t.g.g;var n=t.g.h()>>>0;if(e=n>>>3,!(0<=(n&=7)&&5>=n))throw $(n,t.j);if(1>e)throw Error(`Invalid field number: ${e} (at position ${t.j})`);return t.m=e,t.h=n,!0}function ft(t){switch(t.h){case 0:0!=t.h?ft(t):st(t.g);break;case 1:it(t=t.g,t.g+8);break;case 2:if(2!=t.h)ft(t);else{var e=t.g.h()>>>0;it(t=t.g,t.g+e)}break;case 5:it(t=t.g,t.g+4);break;case 3:for(e=t.m;;){if(!ht(t))throw Error("Unmatched start-group tag: stream EOF");if(4==t.h){if(t.m!=e)throw Error("Unmatched end-group tag");break}ft(t)}break;default:throw $(t.h,t.j)}}function dt(t,e,n){const r=t.g.m,i=t.g.h()>>>0,o=t.g.g+i;let s=o-r;if(0>=s&&(t.g.m=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.m=r}function gt(t){var s=t.g.h()>>>0,a=at(t=t.g,s);if(t=t.j,o){var u,c=t;(u=i)||(u=i=new TextDecoder("utf-8",{fatal:!0})),t=a+s,c=0===a&&t===c.length?c:c.subarray(a,t);try{var l=u.decode(c)}catch(t){if(void 0===r){try{u.decode(new Uint8Array([128]))}catch(t){}try{u.decode(new Uint8Array([97])),r=!0}catch(t){r=!1}}throw!r&&(i=void 0),t}}else{s=(l=a)+s,a=[];let r,i=null;for(;l<s;){var h=t[l++];128>h?a.push(h):224>h?l>=s?e():(r=t[l++],194>h||128!=(192&r)?(l--,e()):a.push((31&h)<<6|63&r)):240>h?l>=s-1?e():(r=t[l++],128!=(192&r)||224===h&&160>r||237===h&&160<=r||128!=(192&(c=t[l++]))?(l--,e()):a.push((15&h)<<12|(63&r)<<6|63&c)):244>=h?l>=s-2?e():(r=t[l++],128!=(192&r)||0!=r-144+(h<<28)>>30||128!=(192&(c=t[l++]))||128!=(192&(u=t[l++]))?(l--,e()):(h=(7&h)<<18|(63&r)<<12|(63&c)<<6|63&u,h-=65536,a.push(55296+(h>>10&1023),56320+(1023&h)))):e(),8192<=a.length&&(i=n(i,a),a.length=0)}l=n(i,a)}return l}function pt(t){const e=t.g.h()>>>0;return ut(t.g,e)}function mt(t,e,n){var r=t.g.h()>>>0;for(r=t.g.g+r;t.g.g<r;)n.push(e.call(t.g))}var yt=[];function vt(t){return t?/^\d+$/.test(t)?(et(t),new bt(K,Y)):null:wt||=new bt(0,0)}var bt=class{constructor(t,e){this.h=t>>>0,this.g=e>>>0}};let wt;function At(t){return t?/^-?\d+$/.test(t)?(et(t),new _t(K,Y)):null:St||=new _t(0,0)}var _t=class{constructor(t,e){this.h=t>>>0,this.g=e>>>0}};let St;function Et(t,e,n){for(;0<n||127<e;)t.g.push(127&e|128),e=(e>>>7|n<<25)>>>0,n>>>=7;t.g.push(e)}function xt(t,e){for(;127<e;)t.g.push(127&e|128),e>>>=7;t.g.push(e)}function Tt(t,e){if(0<=e)xt(t,e);else{for(let n=0;9>n;n++)t.g.push(127&e|128),e>>=7;t.g.push(1)}}function Ot(t){var e=K;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 Pt(t,e){0!==e.length&&(t.j.push(e),t.h+=e.length)}function Lt(t,e,n){xt(t.g,8*e+n)}function Ft(t,e){return Lt(t,e,2),e=t.g.end(),Pt(t,e),e.push(t.h),e}function It(t,e){var n=e.pop();for(n=t.h+t.g.length()-n;127<n;)e.push(127&n|128),n>>>=7,t.h++;e.push(n),t.h++}function jt(t,e,n){Lt(t,e,2),xt(t.g,n.length),Pt(t,t.g.end()),Pt(t,n)}class Bt{constructor(t,e,n){this.g=t,this.h=e,this.j=n}}function kt(t){return Array.prototype.slice.call(t)}const Ut="function"==typeof Symbol&&"symbol"==typeof Symbol()?Symbol():void 0;var Ct=Ut?(t,e)=>{t[Ut]|=e}:(t,e)=>{void 0!==t.u?t.u|=e:Object.defineProperties(t,{u:{value:e,configurable:!0,writable:!0,enumerable:!1}})};function Nt(t){const e=Gt(t);1!=(1&e)&&(Object.isFrozen(t)&&(t=kt(t)),Dt(t,1|e))}var Mt=Ut?(t,e)=>{t[Ut]&=~e}:(t,e)=>{void 0!==t.u&&(t.u&=~e)},Gt=Ut?t=>0|t[Ut]:t=>0|t.u,zt=Ut?t=>t[Ut]:t=>t.u,Dt=Ut?(t,e)=>{t[Ut]=e}:(t,e)=>{void 0!==t.u?t.u=e:Object.defineProperties(t,{u:{value:e,configurable:!0,writable:!0,enumerable:!1}})};function $t(){var t=[];return Ct(t,1),t}function Rt(t,e){Dt(e,-255&(0|t))}function Vt(t,e){Dt(e,-221&(34|t))}function Wt(t){return 0===(t=t>>11&1023)?536870912:t}var Ht,qt={};function Jt(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)&&t.constructor===Object}function Kt(t,e,n){if(null!=t)if("string"==typeof t)t=t?new D(t,C):G();else if(t.constructor!==D)if(B(t))t=n?W(t):t.length?new D(new Uint8Array(t),C):G();else{if(!e)throw Error();t=void 0}return t}const Yt=[];function Xt(t){if(2&t)throw Error()}let Qt,Zt,te,ee,ne;function re(t,e){(e=Qt?e[Qt]:void 0)&&(t[Qt]=kt(e))}function ie(t,e){t.__closure__error__context__984382||(t.__closure__error__context__984382={}),t.__closure__error__context__984382.severity=e}function oe(t){return null==t?t:"number"==typeof t||"NaN"===t||"Infinity"===t||"-Infinity"===t?Number(t):void 0}function se(t){if(null!=t){if("boolean"!=typeof t){var e=typeof t;throw Error(`Expected boolean but got ${"object"!=e?e:t?Array.isArray(t)?"array":e:"null"}: ${t}`)}t=!!t}return t}function ae(t){return"number"==typeof t&&Number.isFinite(t)||!!t&&"string"==typeof t&&isFinite(t)}function ue(t){if(null==t)return t;if("string"==typeof t){if(!t)return;t=+t}return"number"==typeof t?t:void 0}function ce(t){if("string"!=typeof t)throw Error();return t}function le(t){if(null!=t&&"string"!=typeof t)throw Error();return t}function he(t){return null==t||"string"==typeof t?t:void 0}function fe(t,e,n){var r=!1;if(null!=t&&"object"==typeof t&&!(r=Array.isArray(t))&&t.D===qt)return t;if(r){var i=r=Gt(t);return 0===i&&(i|=32&n),(i|=2&n)!==r&&Dt(t,i),new e(t)}}function de(t){switch(typeof t){case"boolean":return ee||=[0,void 0,!0];case"number":return 0<t?void 0:0===t?ne||=[0,void 0]:[-t,void 0];case"string":return[0,t];case"object":return t}}function ge(t,e,n){if(null==t&&(t=te),te=void 0,null==t){var r=96;n?(t=[n],r|=512):t=[],e&&(r=-2095105&r|(1023&e)<<11)}else{if(!Array.isArray(t))throw Error();if(64&(r=Gt(t)))return Zt&&delete t[Zt],t;if(r|=64,n&&(r|=512,n!==t[0]))throw Error();t:{var i=(n=t).length;if(i){const t=i-1;var o=n[t];if(Jt(o)){1024<=(i=t-(e=+!!(512&(r|=256))-1))&&(pe(n,e,o),i=1023),r=-2095105&r|(1023&i)<<11;break t}}e&&(o=+!!(512&r)-1,1024<(e=Math.max(e,i-o))&&(pe(n,o,{}),r|=256,e=1023),r=-2095105&r|(1023&e)<<11)}}return Dt(t,r),t}function pe(t,e,n){const r=1023+e,i=t.length;for(let o=r;o<i;o++){const r=t[o];null!=r&&r!==n&&(n[o-e]=r)}t.length=r+1,t[r]=n}function me(t,e,n,r,i,o){if(null!=t){if(Array.isArray(t))t=i&&0==t.length&&1&Gt(t)?void 0:o&&2&Gt(t)?t:ye(t,e,n,void 0!==r,i,o);else if(Jt(t)){const s={};for(let a in t)s[a]=me(t[a],e,n,r,i,o);t=s}else t=e(t,r);return t}}function ye(t,e,n,r,i,o){const s=r||n?Gt(t):0;r=r?!!(32&s):void 0;const a=kt(t);for(let t=0;t<a.length;t++)a[t]=me(a[t],e,n,r,i,o);return n&&(re(a,t),n(s,a)),a}function ve(t){return t.D===qt?t.toJSON():function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"boolean":return t?1:0;case"object":if(t&&!Array.isArray(t)){if(B(t))return P(t);if(t instanceof D){const e=t.F;return null==e?"":"string"==typeof e?e:t.F=P(e)}}}return t}(t)}function be(t,e,n=Vt){if(null!=t){if(T&&t instanceof Uint8Array)return e?t:new Uint8Array(t);if(Array.isArray(t)){var r=Gt(t);return 2&r?t:(e&&=0===r||!!(32&r)&&!(64&r||!(16&r)),e?(Dt(t,34|r),4&r&&Object.freeze(t),t):ye(t,be,4&r?Vt:n,!0,!1,!0))}return t.D===qt&&(n=t.l,t=2&(r=zt(n))?t:Ae(t,n,r,!0)),t}}function we(t){const e=t.l;return Ae(t,e,zt(e),!1)}function Ae(t,e,n,r){return t=t.constructor,te=e=_e(e,n,r),e=new t(e),te=void 0,e}function _e(t,e,n){const r=n||2&e?Vt:Rt,i=!!(32&e);return t=function(t,e,n){const r=kt(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 re(r,t),r}(t,e,(t=>be(t,i,r))),Ct(t,32|(n?2:0)),t}function Se(t){const e=t.l,n=zt(e);return 2&n?Ae(t,e,n,!1):t}function Ee(t,e){return xe(t=t.l,zt(t),e)}function xe(t,e,n,r){if(-1===n)return null;if(n>=Wt(e)){if(256&e)return t[t.length-1][n]}else{var i=t.length;if(r&&256&e&&null!=(r=t[i-1][n]))return r;if((e=n+(+!!(512&e)-1))<i)return t[e]}}function Te(t,e,n,r){const i=t.l,o=zt(i);return Xt(o),Oe(i,o,e,n,r),t}function Oe(t,e,n,r,i){var o=Wt(e);if(n>=o||i){if(i=e,256&e)o=t[t.length-1];else{if(null==r)return;o=t[o+(+!!(512&e)-1)]={},i|=256}o[n]=r,i!==e&&Dt(t,i)}else t[n+(+!!(512&e)-1)]=r,256&e&&(n in(t=t[t.length-1])&&delete t[n])}function Pe(t,e,n,r,i){var o=2&e;let s=xe(t,e,n,i);Array.isArray(s)||(s=Ht);const a=!(2&r),u=!(1&r);r=!!(32&e);let c=Gt(s);return 0!==c||!r||o||a?1&c||(c|=1,Dt(s,c)):(c|=33,Dt(s,c)),o?(2&c||Ct(s,34),u&&Object.freeze(s)):(o=2&c,u&&o?(s=kt(s),o=1,r&&!a&&(o|=32),Dt(s,o),Oe(t,e,n,s,i)):a&&32&c&&!o&&Mt(s,32)),s}function Le(t){t=t.l;const e=zt(t),n=xe(t,e,1),r=Kt(n,!0,!!(34&e));return null!=r&&r!==n&&Oe(t,e,1,r),r}function Fe(t,e,n){t=t.l;const r=zt(t);if(Xt(r),null==n)Oe(t,r,e);else{if(!(4&Gt(n))){Object.isFrozen(n)&&(n=kt(n));for(let t=0;t<n.length;t++)n[t]=ce(n[t]);Dt(n,5)}Oe(t,r,e,n)}}function Ie(t,e){t=t.l;const n=zt(t);Xt(n),Oe(t,n,2,""===e?void 0:e)}function je(t,e){return Be(t=t.l,zt(t),kr)===e?e:-1}function Be(t,e,n){let r=0;for(let i=0;i<n.length;i++){const o=n[i];null!=xe(t,e,o)&&(0!==r&&Oe(t,e,r),r=o)}return r}function ke(t,e,n,r){const i=zt(t);Xt(i);const o=xe(t,i,n,r);let s;if(null!=o&&o.D===qt)return(e=Se(o))!==o&&Oe(t,i,n,e,r),e.l;if(Array.isArray(o)){const t=Gt(o);s=2&t?_e(o,t,!1):o,s=ge(s,e[0],e[1])}else s=ge(void 0,e[0],e[1]);return s!==o&&Oe(t,i,n,s,r),s}function Ue(t,e,n,r){t=t.l;const i=zt(t),o=xe(t,i,n,r);return(e=fe(o,e,i))!==o&&null!=e&&Oe(t,i,n,e,r),e}function Ce(t,e,n){if(null==(e=Ue(t,e,n,!1)))return e;t=t.l;const r=zt(t);if(!(2&r)){const i=Se(e);i!==e&&Oe(t,r,n,e=i,!1)}return e}function Ne(t,e,n,r){var i=!!(2&e),o=Pe(t,e,1,1),s=o===Ht;if(s&&2!==r)return o;if(s||!(4&Gt(o))){var a=o;o=!!(2&e),s=!!(2&Gt(a)),i=a,!o&&s&&(a=kt(a));var u=e|((s=s||void 0)?2:0),c=s;s=!1;let l=0,h=0;for(;l<a.length;l++){const t=fe(a[l],n,u);if(null==t)continue;const e=!!(2&Gt(t.l));c=c||e,s=s||!e,a[h++]=t}return h<l&&(a.length=h),u=5|(a=Gt(n=a)),c=c?-9&u:8|u,a!=(c=s?-17&c:16|c)&&(Object.isFrozen(n)&&(n=kt(n)),Dt(n,c)),i!==(a=n)&&Oe(t,e,1,a),(o&&2!==r||1===r)&&Object.freeze(a),a}return 3===r||(i?2===r&&(r=Gt(o),o=kt(o),Dt(o,r),Oe(t,e,1,o)):(i=Object.isFrozen(o),1===r?i||Object.freeze(o):(n=-33&(r=Gt(o)),i||2&r?(o=kt(o),Dt(o,-3&n),Oe(t,e,1,o)):r!==n&&Dt(o,n)))),o}function Me(t,e){var n=t.l,r=zt(n);if(e=Ne(n,r,e,(t=!!(2&r))?1:2),!(t||8&Gt(e))){for(t=0;t<e.length;t++)(n=e[t])!==(r=Se(n))&&(e[t]=r);Ct(e,8)}return e}function Ge(t,e,n,r,i){return null==r&&(r=void 0),Te(t,n,r,i)}function ze(t,e,n){var r=$r;null==n&&(n=void 0),t=t.l;const i=zt(t);Xt(i),(r=Be(t,i,r))&&r!==e&&null!=n&&Oe(t,i,r),Oe(t,i,e,n)}function De(t,e){var n=pr;t=t.l;const r=zt(t);Xt(r),t=Ne(t,r,n,2),e=null!=e?e:new n,t.push(e),2&Gt(e.l)?Mt(t,8):Mt(t,16)}function $e(t){return t=null==(t=Ee(t,2))||ae(t)?t:void 0}function Re(t){return t??0}function Ve(t,e,n){n=ce(n),t=t.l;const r=zt(t);Xt(r),Pe(t,r,e,2).push(n)}function We(t,e,n){e.g?e.j(t,e.g,e.h,n,!0):e.j(t,e.h,n,!0)}Dt(Yt,55),Ht=Object.freeze(Yt);var He=class{constructor(t,e){this.l=ge(t,e)}toJSON(){return qe(this,ye(this.l,ve,void 0,void 0,!1,!1),!0)}B(){return!!(2&Gt(this.l))}};function qe(t,e,n){var r=t.constructor.A,i=Wt(zt(n?t.l:e)),o=!1;if(r){if(!n){var s;if((e=kt(e)).length&&Jt(s=e[e.length-1]))for(o=0;o<r.length;o++)if(r[o]>=i){Object.assign(e[e.length-1]={},s);break}o=!0}var a;i=e,n=!n,t=Wt(s=zt(t.l)),s=+!!(512&s)-1;for(let e=0;e<r.length;e++){var u=r[e];if(u<t){var c=i[u+=s];null==c?i[u]=n?Ht:$t():n&&c!==Ht&&Nt(c)}else{if(!a){var l=void 0;i.length&&Jt(l=i[i.length-1])?a=l:i.push(a={})}c=a[u],null==a[u]?a[u]=n?Ht:$t():n&&c!==Ht&&Nt(c)}}}if(!(r=e.length))return e;let h,f;if(Jt(a=e[r-1])){t:{var d=a;l={},i=!1;for(let t in d)n=d[t],Array.isArray(n)&&n!=n&&(i=!0),null!=n?l[t]=n:i=!0;if(i){for(let t in l){d=l;break t}d=null}}d!=a&&(h=!0),r--}for(;0<r&&null==(a=e[r-1]);r--)f=!0;return h||f?(e=o?e:Array.prototype.slice.call(e,0,r),o&&(e.length=r),d&&e.push(d),e):e}function Je(t){return{K:zn,H:t}}function Ke(t,e){if(Array.isArray(e)){var n=Gt(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),Dt(e,5|n),2&n&&Object.freeze(e),e}}He.prototype.D=qt,He.prototype.toString=function(){return qe(this,this.l,!1).toString()};const Ye=Symbol();function Xe(t){let e=t[Ye];if(!e){const n=rn(t),r=pn(t),i=r.h;e=i?(t,e)=>i(t,e,r):(t,e)=>{for(;ht(e)&&4!=e.h;){var i=e.m,o=r[i];if(!o){var s=r.g;s&&(s=s[i])&&(o=r[i]=Qe(s))}o&&o(e,t,i)||(i=(o=e).j,ft(o),o.J?o=void 0:(s=o.g.g-i,o.g.g=i,o=ut(o.g,s)),i=t,o&&(Qt||=Symbol(),(s=i[Qt])?s.push(o):i[Qt]=[o]))}for(const e in n){t[Zt||=Symbol()]=n;break}},t[Ye]=e}return e}function Qe(t){const e=function(t){if(t=t.H)return Xe(t)}(t),n=t.K.g;if(e){const r=pn(t.H).C;return(t,i,o)=>n(t,i,o,r,e)}return(t,e,r)=>n(t,e,r)}const Ze=Symbol();function tn(t,e,n,r){let i;if(r){const e=r[Ze];i=e?e.C:de(r[0]),n[t]=e??r}i&&i===ee?((e=n.R)||(n.R=e=[]),e.push(t)):e.j&&((e=n.T)||(n.T=e=[]),e.push(t))}function en(t,e,n,r){tn(t,e,r)}function nn(t,e,n,r,i){tn(t,e,i,n)}function rn(t){let e=t[Ze];return e||(e=t[Ze]={},on(t,e,en,nn,e))}function on(t,e,n,r,i){e.C=de(t[0]);let o=1;if(t.length>o&&!(t[o]instanceof Bt)){var s=t[o++];if(Array.isArray(s))return e.h=s[0],e.g=s[1],e;e.g=s}for(s=0;o<t.length;){var a=t[o++],u=t[o];for("number"==typeof u?(o++,s+=u):s++,u=o;u<t.length&&!(t[u]instanceof Bt);)u++;if(u-=o){var c=t,l=o,h=c[l];if("function"==typeof h&&(h=h(),c[l]=h),(c=Array.isArray(h))&&!(c=fn in h||un in h)&&(c=0<h.length)){const t=de(l=(c=h)[0]);null!=t&&t!==l&&(c[0]=t),c=null!=t}(h=c?h:void 0)?(o++,1===u?void 0!==(a=r(s,a,h,void 0,i))&&(e[s]=a):void 0!==(a=r(s,a,h,t[o++],i))&&(e[s]=a)):void 0!==(a=n(s,a,t[o++],i))&&(e[s]=a)}else void 0!==(a=n(s,a,void 0,i))&&(e[s]=a)}return e}const sn=Symbol();function an(t){let e=t[sn];if(!e){const n=hn(t);e=(t,e)=>yn(t,e,n),t[sn]=e}return e}const un=Symbol();function cn(t,e){return e.h}function ln(t,e,n){let r,i;const o=e.h;return(t,e,s)=>o(t,e,s,i||=hn(n).C,r||=an(n))}function hn(t){let e=t[un];return e||(e=on(t,t[un]={},cn,ln),fn in t&&un in t&&(t.length=0),e)}const fn=Symbol();function dn(t,e,n){const r=e.g;return n?(t,e,i)=>r(t,e,i,n):r}function gn(t,e,n,r){const i=e.g;let o,s;return(t,e,a)=>i(t,e,a,s||=pn(n).C,o||=Xe(n),r)}function pn(t){let e=t[fn];return e||(rn(t),e=on(t,t[fn]={},dn,gn),fn in t&&un in t&&(t.length=0),e)}function mn(t,e){var n=t[e];if(n)return n;if((n=t.g)&&(n=n[e])){var r=n.H,i=n.K.h;if(r){const t=an(r),e=hn(r).C;n=(n,r,o)=>i(n,r,o,e,t)}else n=i;return t[e]=n}}function yn(t,e,n){for(var r=zt(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=mn(n,o);a&&a(e,r,o)}if(256&r){r=t[o-1];for(let t in r)i=+t,Number.isNaN(i)||null!=(o=r[t])&&(a=mn(n,i))&&a(e,o,i)}if(t=Qt?t[Qt]:void 0)for(Pt(e,e.g.end()),n=0;n<t.length;n++)Pt(e,z(t[n])||U())}function vn(t,e){return new Bt(t,e,!1)}function bn(t,e){return new Bt(t,e,!0)}function wn(t,e,n){Oe(t,zt(t),e,n)}function An(t,e,n){t:if(null!=e){if(ae(e)){if("string"==typeof e)break t;if("number"==typeof e)break t}e=void 0}null!=e&&("string"==typeof e&&At(e),null!=e&&(Lt(t,n,0),"number"==typeof e?(t=t.g,X(e),Et(t,K,Y)):(n=At(e),Et(t.g,n.h,n.g))))}function _n(t,e,n){null!=(e=ue(e))&&null!=e&&(Lt(t,n,0),Tt(t.g,e))}function Sn(t,e,n){null!=(e=null==e?e:"boolean"==typeof e||"number"==typeof e?!!e:void 0)&&(Lt(t,n,0),t.g.g.push(e?1:0))}function En(t,e,n){null!=(e=he(e))&&jt(t,n,u(e))}function xn(t,e,n,r,i){null!=(e=e instanceof He?e.l:Array.isArray(e)?ge(e,r[0],r[1]):void 0)&&(n=Ft(t,n),i(e,t),It(t,n))}function Tn(t,e,n){null!=(e=null==e||"string"==typeof e||B(e)||e instanceof D?e:void 0)&&jt(t,n,H(e).buffer)}var On=vn((function(t,e,n){return 5===t.h&&(wn(e,n,t.g.v()),!0)}),(function(t,e,n){null!=(e=oe(e))&&(Lt(t,n,5),t=t.g,Q(e),Ot(t))})),Pn=bn((function(t,e,n){return(5===t.h||2===t.h)&&(e=Pe(e,zt(e),n,2,!1),2==t.h?mt(t,ct.prototype.v,e):e.push(t.g.v()),!0)}),(function(t,e,n){if(null!=(e=Ke(oe,e))&&e.length){Lt(t,n,2),xt(t.g,4*e.length);for(let r=0;r<e.length;r++)n=t.g,Q(e[r]),Ot(n)}})),Ln=vn((function(t,e,n){return 0===t.h&&(wn(e,n,ot(t.g,tt)),!0)}),An),Fn=vn((function(t,e,n){return 0===t.h&&(wn(e,n,0===(t=ot(t.g,tt))?void 0:t),!0)}),An),In=vn((function(t,e,n){return 0===t.h&&(wn(e,n,ot(t.g,Z)),!0)}),(function(t,e,n){t:if(null!=e){if(ae(e)){if("string"==typeof e)break t;if("number"==typeof e)break t}e=void 0}null!=e&&("string"==typeof e&&vt(e),null!=e&&(Lt(t,n,0),"number"==typeof e?(t=t.g,X(e),Et(t,K,Y)):(n=vt(e),Et(t.g,n.h,n.g))))})),jn=vn((function(t,e,n){return 0===t.h&&(wn(e,n,t.g.h()),!0)}),_n),Bn=bn((function(t,e,n){return(0===t.h||2===t.h)&&(e=Pe(e,zt(e),n,2,!1),2==t.h?mt(t,ct.prototype.h,e):e.push(t.g.h()),!0)}),(function(t,e,n){if(null!=(e=Ke(ue,e))&&e.length){n=Ft(t,n);for(let n=0;n<e.length;n++)Tt(t.g,e[n]);It(t,n)}})),kn=vn((function(t,e,n){return 0===t.h&&(wn(e,n,0===(t=t.g.h())?void 0:t),!0)}),_n),Un=vn((function(t,e,n){return 0===t.h&&(wn(e,n,st(t.g)),!0)}),Sn),Cn=vn((function(t,e,n){return 0===t.h&&(wn(e,n,!1===(t=st(t.g))?void 0:t),!0)}),Sn),Nn=bn((function(t,e,n){if(2!==t.h)return!1;t=gt(t);const r=zt(e);return Xt(r),Pe(e,r,n,2).push(t),!0}),(function(t,e,n){if(null!=(e=Ke(he,e)))for(let i=0;i<e.length;i++){var r=e[i];null!=r&&jt(t,n,u(r))}})),Mn=vn((function(t,e,n){return 2===t.h&&(wn(e,n,""===(t=gt(t))?void 0:t),!0)}),En),Gn=vn((function(t,e,n){return 2===t.h&&(wn(e,n,gt(t)),!0)}),En),zn=vn((function(t,e,n,r,i){return 2===t.h&&(dt(t,ke(e,r,n,!0),i),!0)}),xn),Dn=vn((function(t,e,n,r,i){return 2===t.h&&(dt(t,ke(e,r,n),i),!0)}),xn),$n=bn((function(t,e,n,r,i){if(2!==t.h)return!1;r=ge(void 0,r[0],r[1]);const o=zt(e);Xt(o);let s=Pe(e,o,n,3);return(Object.isFrozen(s)||4&Gt(s))&&(s=kt(s),Oe(e,o,n,s)),s.push(r),dt(t,r,i),!0}),(function(t,e,n,r,i){if(Array.isArray(e))for(let o=0;o<e.length;o++)xn(t,e[o],n,r,i)})),Rn=vn((function(t,e,n,r,i,o){if(2!==t.h)return!1;const s=zt(e);return Xt(s),(o=Be(e,s,o))&&n!==o&&Oe(e,s,o),dt(t,e=ke(e,r,n),i),!0}),xn),Vn=vn((function(t,e,n){return 2===t.h&&(wn(e,n,pt(t)),!0)}),Tn),Wn=vn((function(t,e,n){return 0===t.h&&(wn(e,n,t.g.h()),!0)}),(function(t,e,n){null!=(e=ue(e))&&(e=parseInt(e,10),Lt(t,n,0),Tt(t.g,e))})),Hn=bn((function(t,e,n){return(0===t.h||2===t.h)&&(e=Pe(e,zt(e),n,2,!1),2==t.h?mt(t,ct.prototype.U,e):e.push(t.g.h()),!0)}),(function(t,e,n){if(null!=(e=Ke(ue,e))&&e.length){n=Ft(t,n);for(let n=0;n<e.length;n++)Tt(t.g,e[n]);It(t,n)}}));class qn{constructor(t,e){this.h=t,this.g=e,this.j=Ge,this.defaultValue=void 0}}function Jn(t,e){return(n,r)=>{t:{if(yt.length){const t=yt.pop();t.s(r),rt(t.g,n,r),n=t}else n=new class{constructor(t,e){if(lt.length){const n=lt.pop();rt(n,t,e),t=n}else t=new ct(t,e);this.g=t,this.j=this.g.g,this.h=this.m=-1,this.s(e)}s({J:t=!1}={}){this.J=t}}(n,r);try{var i=new t;const r=i.l;Xe(e)(r,n),Zt&&delete r[Zt];var o=i;break t}finally{(i=n.g).j=null,i.o=!1,i.I=0,i.m=0,i.g=0,i.G=!1,n.m=-1,n.h=-1,100>yt.length&&yt.push(n)}o=void 0}return o}}var Kn=[0,Mn,vn((function(t,e,n){return 2===t.h&&(wn(e,n,(t=pt(t))===G()?void 0:t),!0)}),(function(t,e,n){if(null!=e){if(e instanceof He){const r=e.V;return void(r&&(e=r(e),null!=e&&jt(t,n,H(e).buffer)))}if(Array.isArray(e))return}Tn(t,e,n)}))],Yn=[0,Gn],Xn=[0,jn,Wn,Un,Un,Bn,Wn,Wn],Qn=[0,Un,Un],Zn=class extends He{constructor(){super()}};Zn.A=[6];var tr=[0,Un,Gn,Un,Wn,Wn,Hn,Gn,Gn,Dn,Qn,Wn],er=[0,Gn,Gn,Gn],nr=class extends He{constructor(){super()}},rr=[0],ir=[0,jn],or=[1,2,3,4,5],sr=class extends He{constructor(t){super(t,2)}},ar={},ur=[-2,ar,Un];ar[336783863]=Je([0,Gn,Un,Un,jn,Dn,[0,Rn,rr,or,Rn,tr,or,Rn,er,or,Rn,ir,or,Rn,Xn,or],Dn,Yn]);var cr=[0,Mn,Cn],lr=[0,Fn,Fn,Cn,Cn,Cn,Cn,Fn,Bn,Mn,kn,Fn,Fn,Cn,kn,Cn,Cn,Cn,Mn],hr=[-1,{}],fr=[0,Gn,Dn,2,hr],dr=[0,Gn,Nn,Dn,hr];function gr(t){Ve(t,3,"TEXT:text_in")}var pr=class extends He{constructor(t){super(t,500)}s(t){return Ge(this,0,7,t)}};pr.A=[3,4,5,6,8,13,17,1005];var mr=[-500,Mn,Mn,Nn,Nn,Nn,Nn,Dn,ur,$n,Kn,kn,kn,Dn,fr,Dn,dr,$n,cr,Mn,Dn,lr,kn,Nn,Nn,988],yr=[0,Mn,Mn,Dn,hr],vr=[-500,Gn,Gn,Dn,[-1,{}],Gn,999],br=[-500,Gn,Nn,Nn,Dn,[-2,{},Un],Nn,998,Nn],wr=[-500,Gn,Nn,Dn,hr,Nn,999];function Ar(t){Ve(t,10,"text_in")}var _r,Sr=class extends He{constructor(){super(void 0,500)}s(t){return Ge(this,0,1001,t)}};Sr.A=[1,6,7,9,10,15,16,17,14,1002],Sr.prototype.g=(_r=[-500,$n,mr,$n,5,vr,$n,br,kn,$n,wr,Nn,kn,Dn,fr,Dn,dr,$n,yr,Nn,Nn,Nn,Dn,lr,Mn,Mn,Cn,Dn,980,hr,$n,Kn],function(){const t=new class{constructor(){this.j=[],this.h=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){const t=this.g;return this.g=[],t}}}};yn(this.l,t,hn(_r)),Pt(t,t.g.end());const e=new Uint8Array(t.h),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 Er=class extends He{constructor(t){super(t)}},xr=[0,jn,On,Gn,Gn],Tr=class extends He{constructor(t){super(t)}g(){return Me(this,Er)}};Tr.A=[1];var Or=class extends He{constructor(t){super(t)}},Pr=[0,jn,2,Gn,Dn,[0,$n,xr]],Lr=class extends He{constructor(t){super(t)}};Lr.A=[1];var Fr=Jn(Lr,[0,$n,Pr,Ln]),Ir=class extends He{constructor(t){super(t)}};Ir.A=[1];var jr=class extends He{constructor(t){super(t)}L(){const t=Le(this);return null==t?G():t}},Br=class extends He{constructor(t){super(t)}},kr=[1,2],Ur=[0,Rn,[0,Pn],kr,Rn,[0,Vn],kr,jn,Gn],Cr=class extends He{constructor(t){super(t)}};Cr.A=[1];var Nr=Jn(Cr,[0,$n,Ur,Ln]),Mr=class extends He{constructor(t){super(t)}};Mr.A=[4,5];var Gr=class extends He{constructor(t){super(t)}},zr=[0,Un,Un],Dr=class extends He{constructor(t){super(t)}},$r=[1,2,3,4,5],Rr=class extends He{constructor(t){super(t)}g(){return null!=Le(this)}h(){return null!=he(Ee(this,2))}},Vr=class extends He{constructor(t){super(t)}},Wr=[0,Dn,[0,Vn,Gn,Dn,[0,jn,Ln,Ln],Dn,[0,In,Ln]],Un,Dn,[0,Rn,ir,$r,Rn,tr,$r,Rn,Xn,$r,Rn,rr,$r,Rn,er,$r]],Hr=class extends He{constructor(t){super(t)}},qr=new qn(462704549,Hr);ar[462704549]=Je([0,Dn,Wr,Dn,[0,Gn,jn,On,Nn,Nn]]);var Jr=class extends He{constructor(t){super(t)}},Kr=new qn(477589892,Jr);function Yr(e,n){if(n=n?we(n):new Mr,void 0!==e.displayNamesLocale?Te(n,1,le(e.displayNamesLocale)):void 0===e.displayNamesLocale&&Te(n,1),void 0!==e.maxResults){var r=e.maxResults;if(null!=r){if("number"!=typeof r)throw ie(e=Error(),"warning"),e;if(!Number.isFinite(r)){const e=Error();ie(e,"incident"),function(e){t.setTimeout((()=>{throw e}),0)}(e)}}Te(n,2,r)}else"maxResults"in e&&Te(n,2);if(void 0!==e.scoreThreshold){if(null!=(r=e.scoreThreshold)&&"number"!=typeof r)throw Error(`Value of float/double field must be a number, found ${typeof r}: ${r}`);Te(n,3,r)}else"scoreThreshold"in e&&Te(n,3);return void 0!==e.categoryAllowlist?Fe(n,4,e.categoryAllowlist):"categoryAllowlist"in e&&Te(n,4),void 0!==e.categoryDenylist?Fe(n,5,e.categoryDenylist):"categoryDenylist"in e&&Te(n,5),n}function Xr(t){const e={classifications:Me(t,Or).map((t=>function(t,e=-1,n=""){return{categories:t.map((t=>{var e=ue(Ee(t,1))??0??-1;const n=t.l,r=zt(n),i=xe(n,r,2),o=oe(i);return null!=o&&o!==i&&Oe(n,r,2,o),{index:e,score:o??0??0,categoryName:he(Ee(t,3))??""??"",displayName:he(Ee(t,4))??""??""}})),headIndex:e,headName:n}}(Ce(t,Tr,4)?.g()??[],ue(Ee(t,2))??0,he(Ee(t,3))??"")))};return null!=$e(t)&&(e.timestampMs=Re($e(t))),e}function Qr(t){return Array.from(t,(t=>127<t?t-256:t))}function Zr(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(0>=r||0>=i)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return n/Math.sqrt(r*i)}let ti;ar[477589892]=Je([0,Dn,Wr,Dn,zr]);const ei=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 ni(){if(void 0===ti)try{await WebAssembly.instantiate(ei),ti=!0}catch{ti=!1}return ti}async function ri(t,e=""){const n=await ni()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${e}/${t}_${n}.js`,wasmBinaryPath:`${e}/${t}_${n}.wasm`}}var ii=class{};async function oi(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())}ii.forVisionTasks=function(t){return ri("vision",t)},ii.forTextTasks=function(t){return ri("text",t)},ii.forAudioTasks=function(t){return ri("audio",t)},ii.isSimdSupported=function(){return ni()};function si(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.i.stringToNewUTF8(e)),t.i._free(e)}function ai(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.i.stringToNewUTF8(e[n]);e=t.i._malloc(4*r.length),t.i.HEAPU32.set(r,e>>2),n(e);for(const e of r)t.i._free(e);t.i._free(e)}function ui(t,e,n){t.i.simpleListeners=t.i.simpleListeners||{},t.i.simpleListeners[e]=n}function ci(t,e,n){let r=[];t.i.simpleListeners=t.i.simpleListeners||{},t.i.simpleListeners[e]=(t,e,i)=>{e?(n(r,i),r=[]):r.push(t)}}const li=function(t){return class extends t{S(){this.i._registerModelResourcesGraphService()}}}(class{constructor(t,e){this.j=!0,this.i=t,this.g=null,this.h=0,this.m="function"==typeof this.i._addIntToInputStream,void 0!==e?this.i.canvas=e:((t="undefined"==typeof OffscreenCanvas)||(t=(t=navigator.userAgent).includes("Safari")&&!t.includes("Chrome")),t?(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.i.canvas=document.createElement("canvas")):this.i.canvas=new OffscreenCanvas(1,1))}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.i._malloc(n);this.i.HEAPU8.set(t,r),e?this.i._changeBinaryGraph(n,r):this.i._changeTextGraph(n,r),this.i._free(r)}configureAudio(t,e,n,r,i){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),si(this,r||"input_audio",(r=>{si(this,i=i||"audio_header",(i=>{this.i._configureAudio(r,i,t,e,n)}))}))}setAutoResizeCanvas(t){this.j=t}setAutoRenderToScreen(t){this.i._setAutoRenderToScreen(t)}setGpuBufferVerticalFlip(t){this.i.gpuOriginForWebTexturesIsBottomLeft=t}attachErrorListener(t){this.i.errorListener=t}attachEmptyPacketListener(t,e){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.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.h!==o&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(o),this.h=o),this.i.HEAPF32.set(t,this.g/4),si(this,r,(t=>{this.i._addAudioToInputStream(this.g,e,n,t,i)}))}addGpuBufferToStream(t,e,n){si(this,e,(e=>{if(!this.i.canvas)throw Error("No OpenGL canvas configured.");e?this.i._bindTextureToStream(e):this.i._bindTextureToCanvas();var r=this.i.canvas.getContext("webgl2")||this.i.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`.");let i;this.i.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!0),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t),this.i.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),t.videoWidth?(r=t.videoWidth,i=t.videoHeight):t.naturalWidth?(r=t.naturalWidth,i=t.naturalHeight):(r=t.width,i=t.height),!this.j||r===this.i.canvas.width&&i===this.i.canvas.height||(this.i.canvas.width=r,this.i.canvas.height=i);const[o,s]=[r,i];this.i._addBoundTextureToStream(e,o,s,n)}))}addBoolToStream(t,e,n){si(this,e,(e=>{this.i._addBoolToInputStream(t,e,n)}))}addDoubleToStream(t,e,n){si(this,e,(e=>{this.i._addDoubleToInputStream(t,e,n)}))}addFloatToStream(t,e,n){si(this,e,(e=>{this.i._addFloatToInputStream(t,e,n)}))}addIntToStream(t,e,n){si(this,e,(e=>{this.i._addIntToInputStream(t,e,n)}))}addStringToStream(t,e,n){si(this,e,(e=>{si(this,t,(t=>{this.i._addStringToInputStream(t,e,n)}))}))}addStringRecordToStream(t,e,n){si(this,e,(e=>{ai(this,Object.keys(t),(r=>{ai(this,Object.values(t),(i=>{this.i._addFlatHashMapToInputStream(r,i,Object.keys(t).length,e,n)}))}))}))}addProtoToStream(t,e,n,r){si(this,n,(n=>{si(this,e,(e=>{const i=this.i._malloc(t.length);this.i.HEAPU8.set(t,i),this.i._addProtoToInputStream(i,t.length,e,n,r),this.i._free(i)}))}))}addEmptyPacketToStream(t,e){si(this,t,(t=>{this.i._addEmptyPacketToInputStream(t,e)}))}addBoolToInputSidePacket(t,e){si(this,e,(e=>{this.i._addBoolToInputSidePacket(t,e)}))}addDoubleToInputSidePacket(t,e){si(this,e,(e=>{this.i._addDoubleToInputSidePacket(t,e)}))}addFloatToInputSidePacket(t,e){si(this,e,(e=>{this.i._addFloatToInputSidePacket(t,e)}))}addIntToInputSidePacket(t,e){si(this,e,(e=>{this.i._addIntToInputSidePacket(t,e)}))}addStringToInputSidePacket(t,e){si(this,e,(e=>{si(this,t,(t=>{this.i._addStringToInputSidePacket(t,e)}))}))}addProtoToInputSidePacket(t,e,n){si(this,n,(n=>{si(this,e,(e=>{const r=this.i._malloc(t.length);this.i.HEAPU8.set(t,r),this.i._addProtoToInputSidePacket(r,t.length,e,n),this.i._free(r)}))}))}attachBoolListener(t,e){ui(this,t,e),si(this,t,(t=>{this.i._attachBoolListener(t)}))}attachBoolVectorListener(t,e){ci(this,t,e),si(this,t,(t=>{this.i._attachBoolVectorListener(t)}))}attachIntListener(t,e){ui(this,t,e),si(this,t,(t=>{this.i._attachIntListener(t)}))}attachIntVectorListener(t,e){ci(this,t,e),si(this,t,(t=>{this.i._attachIntVectorListener(t)}))}attachDoubleListener(t,e){ui(this,t,e),si(this,t,(t=>{this.i._attachDoubleListener(t)}))}attachDoubleVectorListener(t,e){ci(this,t,e),si(this,t,(t=>{this.i._attachDoubleVectorListener(t)}))}attachFloatListener(t,e){ui(this,t,e),si(this,t,(t=>{this.i._attachFloatListener(t)}))}attachFloatVectorListener(t,e){ci(this,t,e),si(this,t,(t=>{this.i._attachFloatVectorListener(t)}))}attachStringListener(t,e){ui(this,t,e),si(this,t,(t=>{this.i._attachStringListener(t)}))}attachStringVectorListener(t,e){ci(this,t,e),si(this,t,(t=>{this.i._attachStringVectorListener(t)}))}attachProtoListener(t,e,n){ui(this,t,e),si(this,t,(t=>{this.i._attachProtoListener(t,n||!1)}))}attachProtoVectorListener(t,e,n){ci(this,t,e),si(this,t,(t=>{this.i._attachProtoVectorListener(t,n||!1)}))}attachAudioListener(t,e,n){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),ui(this,t,((t,n)=>{t=new Float32Array(t.buffer,t.byteOffset,t.length/4),e(t,n)})),si(this,t,(t=>{this.i._attachAudioListener(t,n||!1)}))}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}});var hi=class extends li{};async function fi(t,e,n){return t=await(async(t,e,n,r)=>{if(e&&await oi(e),!self.ModuleFactory)throw Error("ModuleFactory not set.");if(n&&(await oi(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.s(n),t}async function di(t,e,n){return fi(t,e,n)}function gi(t,e){const n=Ce(t.baseOptions,Rr,1)||new Rr;"string"==typeof e?(Te(n,2,le(e)),Te(n,1)):e instanceof Uint8Array&&(Te(n,1,Kt(e,!1,!1)),Te(n,2)),Ge(t.baseOptions,0,1,n)}function pi(t,e){const n=e.baseOptions||{};if(e.baseOptions?.modelAssetBuffer&&e.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(Ce(t.baseOptions,Rr,1)?.g()||Ce(t.baseOptions,Rr,1)?.h()||e.baseOptions?.modelAssetBuffer||e.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");return function(t,e){let n=Ce(t.baseOptions,Dr,3);if(!n){var r=n=new Dr;ze(r,4,new nr)}"delegate"in e&&("GPU"===e.delegate?ze(e=n,2,r=new Zn):ze(e=n,4,r=new nr)),Ge(t.baseOptions,0,3,n)}(t,n),n.modelAssetPath?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.i.FS_unlink("/model.dat")}catch{}t.g.i.FS_createDataFile("/","model.dat",new Uint8Array(e),!0,!1,!1),gi(t,"/model.dat"),t.v()})):(gi(t,n.modelAssetBuffer),t.v(),Promise.resolve())}function mi(t){try{const e=t.m.length;if(1===e)throw Error(t.m[0].message);if(1<e)throw Error("Encountered multiple errors: "+t.m.map((t=>t.message)).join(", "))}finally{t.m=[]}}function yi(t,e){t.j=Math.max(t.j,e)}var vi=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.S(),this.g.setGraph(t,e),mi(this)}finishProcessing(){this.g.finishProcessing(),mi(this)}close(){this.g.closeGraph()}};vi.prototype.close=vi.prototype.close;var bi=class extends vi{constructor(t,e){super(new hi(t,e)),this.o={languages:[]},this.h=new Hr,t=new Vr,Ge(this.h,0,1,t)}s(t){var e=Yr(t,Ce(this.h,Mr,2));return Ge(this.h,0,2,e),pi(this,t)}get baseOptions(){return Ce(this.h,Vr,1)}set baseOptions(t){Ge(this.h,0,1,t)}O(t){return this.o={languages:[]},this.g.addStringToStream(t,"text_in",this.j+1),this.finishProcessing(),this.o}v(){var t=new Sr;Ar(t),Ve(t,15,"classifications_out");const e=new sr;We(e,qr,this.h);const n=new pr;Ie(n,le("mediapipe.tasks.text.text_classifier.TextClassifierGraph")),gr(n),Ve(n,4,"CLASSIFICATIONS:classifications_out"),n.s(e),De(t,n),this.g.attachProtoListener("classifications_out",((t,e)=>{if(({classifications:t}=Xr(Fr(t))),1!==t.length)throw Error(`Expected 1 classification head, got ${t.length}`);this.o.languages=t[0].categories.map((t=>({languageCode:t.categoryName,probability:t.score}))),yi(this,e)})),this.g.attachEmptyPacketListener("classifications_out",(t=>{yi(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};bi.prototype.detect=bi.prototype.O,bi.prototype.setOptions=bi.prototype.s,bi.createFromModelPath=function(t,e){return di(bi,t,{baseOptions:{modelAssetPath:e}})},bi.createFromModelBuffer=function(t,e){return di(bi,t,{baseOptions:{modelAssetBuffer:e}})},bi.createFromOptions=function(t,e){return di(bi,t,e)};var wi=class extends vi{constructor(t,e){super(new hi(t,e)),this.o={classifications:[]},this.h=new Hr,t=new Vr,Ge(this.h,0,1,t)}s(t){var e=Yr(t,Ce(this.h,Mr,2));return Ge(this.h,0,2,e),pi(this,t)}get baseOptions(){return Ce(this.h,Vr,1)}set baseOptions(t){Ge(this.h,0,1,t)}N(t){return this.o={classifications:[]},this.g.addStringToStream(t,"text_in",this.j+1),this.finishProcessing(),this.o}v(){var t=new Sr;Ar(t),Ve(t,15,"classifications_out");const e=new sr;We(e,qr,this.h);const n=new pr;Ie(n,le("mediapipe.tasks.text.text_classifier.TextClassifierGraph")),gr(n),Ve(n,4,"CLASSIFICATIONS:classifications_out"),n.s(e),De(t,n),this.g.attachProtoListener("classifications_out",((t,e)=>{this.o=Xr(Fr(t)),yi(this,e)})),this.g.attachEmptyPacketListener("classifications_out",(t=>{yi(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};wi.prototype.classify=wi.prototype.N,wi.prototype.setOptions=wi.prototype.s,wi.createFromModelPath=function(t,e){return di(wi,t,{baseOptions:{modelAssetPath:e}})},wi.createFromModelBuffer=function(t,e){return di(wi,t,{baseOptions:{modelAssetBuffer:e}})},wi.createFromOptions=function(t,e){return di(wi,t,e)};var Ai=class extends vi{constructor(t,e){super(new hi(t,e)),this.o={embeddings:[]},this.h=new Jr,t=new Vr,Ge(this.h,0,1,t)}s(t){var e=this.h,n=Ce(this.h,Gr,2);return n=n?we(n):new Gr,void 0!==t.l2Normalize?Te(n,1,se(t.l2Normalize)):"l2Normalize"in t&&Te(n,1),void 0!==t.quantize?Te(n,2,se(t.quantize)):"quantize"in t&&Te(n,2),Ge(e,0,2,n),pi(this,t)}get baseOptions(){return Ce(this.h,Vr,1)}set baseOptions(t){Ge(this.h,0,1,t)}P(t){return this.g.addStringToStream(t,"text_in",this.j+1),this.finishProcessing(),this.o}v(){var t=new Sr;Ar(t),Ve(t,15,"embeddings_out");const e=new sr;We(e,Kr,this.h);const n=new pr;Ie(n,le("mediapipe.tasks.text.text_embedder.TextEmbedderGraph")),gr(n),Ve(n,4,"EMBEDDINGS:embeddings_out"),n.s(e),De(t,n),this.g.attachProtoListener("embeddings_out",((t,e)=>{t=Nr(t),this.o=function(t){return{embeddings:Me(t,Br).map((t=>{const e={headIndex:ue(Ee(t,3))??0??-1,headName:he(Ee(t,4))??""??""};if(void 0!==Ue(t,Ir,je(t,1))){t=Ce(t,Ir,je(t,1)).l;var n=zt(t);const r=2&n;let i=Pe(t,n,1,1),o=Gt(i);if(!(4&o)){Object.isFrozen(i)&&(i=kt(i),Dt(i,o=-3&o|32),Oe(t,n,1,i));let e=0,s=0;for(;e<i.length;e++){const t=oe(i[e]);null!=t&&(i[s++]=t)}s<e&&(i.length=s),o|=21,r?o|=34:o&=-33,Dt(i,o),2&o&&Object.freeze(i)}!r&&(2&o||Object.isFrozen(i))&&(i=kt(i),Dt(i,-35&o),Oe(t,n,1,i)),e.floatEmbedding=i}else n=new Uint8Array(0),e.quantizedEmbedding=Ce(t,jr,je(t,2))?.L()?.M()??n;return e})),timestampMs:Re($e(t))}}(t),yi(this,e)})),this.g.attachEmptyPacketListener("embeddings_out",(t=>{yi(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Ai.cosineSimilarity=function(t,e){if(t.floatEmbedding&&e.floatEmbedding)t=Zr(t.floatEmbedding,e.floatEmbedding);else{if(!t.quantizedEmbedding||!e.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");t=Zr(Qr(t.quantizedEmbedding),Qr(e.quantizedEmbedding))}return t},Ai.prototype.embed=Ai.prototype.P,Ai.prototype.setOptions=Ai.prototype.s,Ai.createFromModelPath=function(t,e){return di(Ai,t,{baseOptions:{modelAssetPath:e}})},Ai.createFromModelBuffer=function(t,e){return di(Ai,t,{baseOptions:{modelAssetBuffer:e}})},Ai.createFromOptions=function(t,e){return di(Ai,t,e)};export{ii as FilesetResolver,bi as LanguageDetector,vi as TaskRunner,wi as TextClassifier,Ai as TextEmbedder};
|
|
2
2
|
//# sourceMappingURL=text_bundle_mjs.js.map
|