@mediapipe/tasks-text 0.10.35 → 0.10.36-rc.20260514

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mediapipe/tasks-text",
3
- "version": "0.10.35",
3
+ "version": "0.10.36-rc.20260514",
4
4
  "description": "MediaPipe Text Tasks",
5
5
  "main": "text_bundle.cjs",
6
6
  "browser": "text_bundle.mjs",
package/text.d.ts CHANGED
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  /** Options to configure MediaPipe model loading and processing. */
17
- declare interface BaseOptions_2 {
17
+ declare interface BaseOptions {
18
18
  /**
19
19
  * The model path to the model asset file. Only one of `modelAssetPath` or
20
20
  * `modelAssetBuffer` can be set.
@@ -371,6 +371,7 @@ declare abstract class TaskRunner {
371
371
  protected constructor();
372
372
  /** Configures the task with custom options. */
373
373
  abstract setOptions(options: TaskRunnerOptions): Promise<void>;
374
+ enableLogging(taskName: string, options: TaskRunnerOptions): void;
374
375
  /**
375
376
  * Closes and cleans up the resources held by this task.
376
377
  * @export
@@ -381,7 +382,7 @@ declare abstract class TaskRunner {
381
382
  /** Options to configure MediaPipe Tasks in general. */
382
383
  declare interface TaskRunnerOptions {
383
384
  /** Options to configure the loading of the model assets. */
384
- baseOptions?: BaseOptions_2;
385
+ baseOptions?: BaseOptions;
385
386
  }
386
387
 
387
388
  /** Performs Natural Language classification. */
@@ -511,9 +512,10 @@ export declare class TextEmbedder extends TaskRunner {
511
512
  *
512
513
  * @export
513
514
  * @param text The text to process.
515
+ * @param formatOptions The formatting to apply to the input text.
514
516
  * @return The embedding results of the text
515
517
  */
516
- embed(text: string): TextEmbedderResult;
518
+ embed(text: string, formatOptions?: TextFormatOptions): TextEmbedderResult;
517
519
  /**
518
520
  * Utility function to compute cosine similarity[1] between two `Embedding`
519
521
  * objects.
@@ -549,6 +551,51 @@ export declare interface TextEmbedderResult {
549
551
  timestampMs?: number;
550
552
  }
551
553
 
554
+ /**
555
+ * The type of embedding to generate. This can be used to specify different
556
+ * embedding tasks for models that support it (e.g. Gecko).
557
+ *
558
+ * Supported embedding types are:
559
+ * - 'RETRIEVAL_QUERY': Embeds a query for document retrieval. The input text
560
+ * will be formatted as "task: search result | query: ${text}".
561
+ * - 'RETRIEVAL_DOCUMENT': Embeds a document for semantic retrieval. The input
562
+ * text will be formatted as "title: none | text: ${text}".
563
+ * - 'SEMANTIC_SIMILARITY': Embeds text for semantic similarity. The input text
564
+ * will be formatted as "task: sentence similarity | query: ${text}".
565
+ * - 'CLASSIFICATION': Embeds text for classification. The input text will be
566
+ * formatted as "task: classification | query: ${text}".
567
+ * - 'QUESTION_ANSWERING': Embeds text for question answering. The input text
568
+ * will be formatted as "task: question answering | query: ${text}".
569
+ * - 'CLUSTERING': Embeds text for clustering. The input text will be formatted
570
+ * as "task: clustering | query: ${text}".
571
+ * - 'FACT_CHECKING': Embeds text for fact checking. The input text will be
572
+ * formatted as "task: fact checking | query: ${text}".
573
+ * - 'CODE_RETRIEVAL': Embeds text for code retrieval. The input text will be
574
+ * formatted as "task: code retrieval | query: ${text}".
575
+ */
576
+ export declare type TextEmbeddingType = "RETRIEVAL_QUERY" | "RETRIEVAL_DOCUMENT" | "SEMANTIC_SIMILARITY" | "CLASSIFICATION" | "QUESTION_ANSWERING" | "CLUSTERING" | "FACT_CHECKING" | "CODE_RETRIEVAL";
577
+
578
+ /**
579
+ * Options for formatting a text embedding request.
580
+ */
581
+ export declare interface TextFormatOptions {
582
+ /** The embedding type to generate for the given text. */
583
+ type: TextEmbeddingType;
584
+ /** The title of the text to be embedded. Only used for document embeddings. */
585
+ title?: string;
586
+ /** The role of the text to be embedded. */
587
+ textRole?: TextRole;
588
+ }
589
+
590
+ /**
591
+ * The role of the text to be embedded.
592
+ *
593
+ * Supported roles are:
594
+ * - 'QUERY': The text is a query.
595
+ * - 'DOCUMENT': The text is a document.
596
+ */
597
+ export declare type TextRole = "QUERY" | "DOCUMENT";
598
+
552
599
  /**
553
600
  * Copyright 2022 The MediaPipe Authors.
554
601
  *
package/text_bundle.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";function t(t){if(t&&t.__esModule)return t;var n=Object.create(null);return t&&Object.keys(t).forEach((function(e){if("default"!==e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})}})),n.default=t,Object.freeze(n)}Object.defineProperty(exports,"__esModule",{value:!0});var n="undefined"!=typeof self?self:{};function e(t,e){t:{for(var r=["CLOSURE_FLAGS"],i=n,o=0;o<r.length;o++)if(null==(i=i[r[o]])){r=null;break t}r=i}return null!=(t=r&&r[t])?t:e}function r(){throw Error("Invalid UTF8")}function i(t,n){return n=String.fromCharCode.apply(null,n),null==t?n:t+n}let o,s;const a="undefined"!=typeof TextDecoder;let u;const c="undefined"!=typeof TextEncoder;function l(t){if(c)t=(u||=new TextEncoder).encode(t);else{let e=0;const r=new Uint8Array(3*t.length);for(let i=0;i<t.length;i++){var n=t.charCodeAt(i);if(n<128)r[e++]=n;else{if(n<2048)r[e++]=n>>6|192;else{if(n>=55296&&n<=57343){if(n<=56319&&i<t.length){const o=t.charCodeAt(++i);if(o>=56320&&o<=57343){n=1024*(n-55296)+o-56320+65536,r[e++]=n>>18|240,r[e++]=n>>12&63|128,r[e++]=n>>6&63|128,r[e++]=63&n|128;continue}i--}n=65533}r[e++]=n>>12|224,r[e++]=n>>6&63|128}r[e++]=63&n|128}}t=e===r.length?r:r.subarray(0,e)}return t}var h,f=e(610401301,!1),d=e(748402147,!0);function g(){var t=n.navigator;return t&&(t=t.userAgent)?t:""}const p=n.navigator;function m(t){return m[" "](t),t}h=p&&p.userAgentData||null,m[" "]=function(){};const v={};let y=null;function b(t){const n=t.length;let e=3*n/4;e%3?e=Math.floor(e):-1!="=.".indexOf(t[n-1])&&(e=-1!="=.".indexOf(t[n-2])?e-2:e-1);const r=new Uint8Array(e);let i=0;return function(t,n){function e(n){for(;r<t.length;){const n=t.charAt(r++),e=y[n];if(null!=e)return e;if(!/^[\s\xa0]*$/.test(n))throw Error("Unknown base64 encoding at char: "+n)}return n}w();let r=0;for(;;){const t=e(-1),r=e(0),i=e(64),o=e(64);if(64===o&&-1===t)break;n(t<<2|r>>4),64!=i&&(n(r<<4&240|i>>2),64!=o&&n(i<<6&192|o))}}(t,(function(t){r[i++]=t})),i!==e?r.subarray(0,i):r}function w(){if(!y){y={};var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),n=["+/=","+/","-_=","-_.","-_"];for(let e=0;e<5;e++){const r=t.concat(n[e].split(""));v[e]=r;for(let t=0;t<r.length;t++){const n=r[t];void 0===y[n]&&(y[n]=t)}}}}var _="undefined"!=typeof Uint8Array,S=!(!(f&&h&&h.brands.length>0)&&(-1!=g().indexOf("Trident")||-1!=g().indexOf("MSIE")))&&"function"==typeof btoa;const A=/[-_.]/g,E={"-":"+",_:"/",".":"="};function I(t){return E[t]||""}function T(t){if(!S)return b(t);t=A.test(t)?t.replace(A,I):t,t=atob(t);const n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}var B={};function P(){return O||=new U(null,B)}function x(t){N(B);var n=t.g;return null==(n=null==n||_&&null!=n&&n instanceof Uint8Array?n:"string"==typeof n?T(n):null)?n:t.g=n}var U=class{i(){return new Uint8Array(x(this)||0)}constructor(t,n){if(N(n),this.g=t,null!=t&&0===t.length)throw Error("ByteString should be constructed with non-empty values")}};let O,L;function N(t){if(t!==B)throw Error("illegal external caller")}function j(t,n){t.__closure__error__context__984382||(t.__closure__error__context__984382={}),t.__closure__error__context__984382.severity=n}function k(){const t=Error("int32");return j(t,"warning"),t}function V(t,e){if(null!=t){var r=L??={},i=r[t]||0;i>=e||(r[t]=i+1,j(t=Error(),"incident"),function(t){n.setTimeout((()=>{throw t}),0)}(t))}}function F(){return"function"==typeof BigInt}var C="function"==typeof Symbol&&"symbol"==typeof Symbol();function M(t,n,e=!1){return"function"==typeof Symbol&&"symbol"==typeof Symbol()?e&&Symbol.for&&t?Symbol.for(t):null!=t?Symbol(t):Symbol():n}var G=M("jas",void 0,!0),D=M(void 0,"1oa"),z=M(void 0,Symbol()),R=M(void 0,"0ubs"),$=M(void 0,"0ubsb"),W=M(void 0,"0actk"),H=M("m_m","R",!0);const q={M:{value:0,configurable:!0,writable:!0,enumerable:!1}},K=Object.defineProperties,X=C?G:"M";var J;const Y=[];function Q(t,n){C||X in t||K(t,q),t[X]|=n}function Z(t,n){C||X in t||K(t,q),t[X]=n}Z(Y,7),J=Object.freeze(Y);var tt={};function nt(t,n){return void 0===n?t.g!==et&&!!(2&(0|t.l[X])):!!(2&n)&&t.g!==et}const et={};function rt(t,n){if(null!=t)if("string"==typeof t)t=t?new U(t,B):P();else if(t.constructor!==U)if(_&&null!=t&&t instanceof Uint8Array)t=t.length?new U(new Uint8Array(t),B):P();else{if(!n)throw Error();t=void 0}return t}var it=Object.freeze({});function ot(t,n,e){const r=128&n?0:-1,i=t.length;var o;(o=!!i)&&(o=null!=(o=t[i-1])&&"object"==typeof o&&o.constructor===Object);const s=i+(o?-1:0);for(n=128&n?1:0;n<s;n++)e(n-r,t[n]);if(o){t=t[i-1];for(const n in t)!isNaN(n)&&e(+n,t[n])}}var st={};function at(t){return 128&t?st:void 0}function ut(t){return t.O=!0,t}var ct=ut((t=>"number"==typeof t)),lt=ut((t=>"string"==typeof t)),ht=ut((t=>"boolean"==typeof t)),ft="function"==typeof n.BigInt&&"bigint"==typeof n.BigInt(0);function dt(t){var n=t;if(lt(n)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(n))throw Error(String(n))}else if(ct(n)&&!Number.isSafeInteger(n))throw Error(String(n));return ft?BigInt(t):t=ht(t)?t?"1":"0":lt(t)?t.trim()||"0":String(t)}var gt=ut((t=>ft?t>=mt&&t<=yt:"-"===t[0]?bt(t,pt):bt(t,vt)));const pt=Number.MIN_SAFE_INTEGER.toString(),mt=ft?BigInt(Number.MIN_SAFE_INTEGER):void 0,vt=Number.MAX_SAFE_INTEGER.toString(),yt=ft?BigInt(Number.MAX_SAFE_INTEGER):void 0;function bt(t,n){if(t.length>n.length)return!1;if(t.length<n.length||t===n)return!0;for(let e=0;e<t.length;e++){const r=t[e],i=n[e];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 n=t>>>0;St=n,At=(t-n)/4294967296>>>0}function It(t){if(t<0){Et(-t);const[n,e]=jt(St,At);St=n>>>0,At=e>>>0}else Et(t)}function Tt(t){const n=_t||=new DataView(new ArrayBuffer(8));n.setFloat32(0,+t,!0),At=0,St=n.getUint32(0,!0)}function Bt(t,n){const e=4294967296*n+(t>>>0);return Number.isSafeInteger(e)?e:Ut(t,n)}function Pt(t,n){return dt(F()?BigInt.asUintN(64,(BigInt(n>>>0)<<BigInt(32))+BigInt(t>>>0)):Ut(t,n))}function xt(t,n){return F()?dt(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(n))<<BigInt(32))+BigInt.asUintN(32,BigInt(t)))):dt(Lt(t,n))}function Ut(t,n){if(t>>>=0,(n>>>=0)<=2097151)var e=""+(4294967296*n+t);else F()?e=""+(BigInt(n)<<BigInt(32)|BigInt(t)):(t=(16777215&t)+6777216*(e=16777215&(t>>>24|n<<8))+6710656*(n=n>>16&65535),e+=8147497*n,n*=2,t>=1e7&&(e+=t/1e7>>>0,t%=1e7),e>=1e7&&(n+=e/1e7>>>0,e%=1e7),e=n+Ot(e)+Ot(t));return e}function Ot(t){return t=String(t),"0000000".slice(t.length)+t}function Lt(t,n){if(2147483648&n)if(F())t=""+(BigInt(0|n)<<BigInt(32)|BigInt(t>>>0));else{const[e,r]=jt(t,n);t="-"+Ut(e,r)}else t=Ut(t,n);return t}function Nt(t){if(t.length<16)It(Number(t));else if(F())t=BigInt(t),St=Number(t&BigInt(4294967295))>>>0,At=Number(t>>BigInt(32)&BigInt(4294967295));else{const n=+("-"===t[0]);At=St=0;const e=t.length;for(let r=n,i=(e-n)%6+n;i<=e;r=i,i+=6){const n=Number(t.slice(r,i));At*=1e6,St=1e6*St+n,St>=4294967296&&(At+=Math.trunc(St/4294967296),At>>>=0,St>>>=0)}if(n){const[t,n]=jt(St,At);St=t,At=n}}}function jt(t,n){return n=~n,t?t=1+~t:n+=1,[t,n]}function kt(t){return Array.prototype.slice.call(t)}const Vt="function"==typeof BigInt?BigInt.asIntN:void 0,Ft="function"==typeof BigInt?BigInt.asUintN:void 0,Ct=Number.isSafeInteger,Mt=Number.isFinite,Gt=Math.trunc;function Dt(t){return null==t||"number"==typeof t?t:"NaN"===t||"Infinity"===t||"-Infinity"===t?Number(t):void 0}function zt(t){if(null!=t&&"boolean"!=typeof t){var n=typeof t;throw Error(`Expected boolean but got ${"object"!=n?n:t?Array.isArray(t)?"array":n:"null"}: ${t}`)}return t}const Rt=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function $t(t){switch(typeof t){case"bigint":return!0;case"number":return Mt(t);case"string":return Rt.test(t);default:return!1}}function Wt(t){if(null==t)return t;if("string"==typeof t&&t)t=+t;else if("number"!=typeof t)return;return Mt(t)?0|t:void 0}function Ht(t){const n=t.length;return("-"===t[0]?n<20||20===n&&t<="-9223372036854775808":n<19||19===n&&t<="9223372036854775807")?t:(Nt(t),Lt(St,At))}function qt(t){if(t=Gt(t),!Ct(t)){It(t);var n=St,e=At;(t=2147483648&e)&&(e=~e>>>0,0==(n=1+~n>>>0)&&(e=e+1>>>0)),t="number"==typeof(n=Bt(n,e))?t?-n:n:t?"-"+n:n}return t}function Kt(t){var n=Gt(Number(t));return Ct(n)?String(n):(-1!==(n=t.indexOf("."))&&(t=t.substring(0,n)),Ht(t))}function Xt(t){var n=typeof t;return null==t?t:"bigint"===n?dt(Vt(64,t)):$t(t)?("string"===n?(n=Gt(Number(t)),Ct(n)?t=dt(n):(-1!==(n=t.indexOf("."))&&(t=t.substring(0,n)),t=F()?dt(Vt(64,BigInt(t))):dt(Ht(t)))):Ct(t)?t=dt(qt(t)):(t=Gt(t),Ct(t)?t=String(t):(It(t),t=Lt(St,At)),t=dt(t)),t):void 0}function Jt(t){if("string"!=typeof t)throw Error();return t}function Yt(t){if(null!=t&&"string"!=typeof t)throw Error();return t}function Qt(t){return null==t||"string"==typeof t?t:void 0}function Zt(t,n,e){if(null!=t&&t[H]===tt)return t;if(Array.isArray(t)){var r=0|t[X];return(e=r|32&e|2&e)!==r&&Z(t,e),new n(t)}}function tn(t){return z?t[z]:void 0}function nn(t,n){for(const e in t)!isNaN(e)&&n(t,+e,t[e])}var en=class{};function rn(t,n){n<100||V(R,1)}function on(t,n,e,r){const i=void 0!==r;r=!!r;var o,s=z;!i&&C&&s&&(o=t[s])&&nn(o,rn),s=[];var a=t.length;let u;o=4294967295;let c=!1;const l=!!(64&n),h=l?128&n?0:-1:void 0;1&n||(u=a&&t[a-1],null!=u&&"object"==typeof u&&u.constructor===Object?o=--a:u=void 0,!l||128&n||i||(c=!0,o=o-h+h)),n=void 0;for(var f=0;f<a;f++){let i=t[f];if(null!=i&&null!=(i=e(i,r)))if(l&&f>=o){const t=f-h;(n??={})[t]=i}else s[f]=i}if(u)for(let t in u){if(null==(a=u[t])||null==(a=e(a,r)))continue;let i;f=+t,l&&!Number.isNaN(f)&&(i=f+h)<o?s[i]=a:(n??={})[t]=a}return n&&(c?s.push(n):s[o]=n),i&&z&&(t=tn(t))&&t instanceof en&&(s[z]=function(t){const n=new en;return nn(t,((t,e,r)=>{n[e]=kt(r)})),n.g=t.g,n}(t)),s}function sn(t){switch(typeof t){case"number":return Number.isFinite(t)?t:""+t;case"bigint":return gt(t)?Number(t):""+t;case"boolean":return t?1:0;case"object":if(Array.isArray(t)){var n=0|t[X];return 0===t.length&&1&n?void 0:on(t,n,sn)}if(null!=t&&t[H]===tt)return cn(t);if(t instanceof U){if(null==(n=t.g))t="";else if("string"==typeof n)t=n;else{if(S){for(var e="",r=0,i=n.length-10240;r<i;)e+=String.fromCharCode.apply(null,n.subarray(r,r+=10240));e+=String.fromCharCode.apply(null,r?n.subarray(r):n),n=btoa(e)}else{void 0===e&&(e=0),w(),e=v[e],r=Array(Math.floor(n.length/3)),i=e[64]||"";let t=0,c=0;for(;t<n.length-2;t+=3){var o=n[t],s=n[t+1],a=n[t+2],u=e[o>>2];o=e[(3&o)<<4|s>>4],s=e[(15&s)<<2|a>>6],a=e[63&a],r[c++]=u+o+s+a}switch(u=0,a=i,n.length-t){case 2:a=e[(15&(u=n[t+1]))<<2]||i;case 1:n=n[t],r[c]=e[n>>2]+e[(3&n)<<4|u>>4]+a+i}n=r.join("")}t=t.g=n}return t}return}return t}let an,un;function cn(t){return on(t=t.l,0|t[X],sn)}function ln(t,n){return hn(t,n[0],n[1])}function hn(t,n,e,r=0){if(null==t){var i=32;e?(t=[e],i|=128):t=[],n&&(i=-16760833&i|(1023&n)<<14)}else{if(!Array.isArray(t))throw Error("narr");if(i=0|t[X],d&&1&i)throw Error("rfarr");if(2048&i&&!(2&i)&&function(){if(d)throw Error("carr");V(W,5)}(),256&i)throw Error("farr");if(64&i)return(i|r)!==i&&Z(t,i|r),t;if(e&&(i|=128,e!==t[0]))throw Error("mid");t:{i|=64;var o=(e=t).length;if(o){var s=o-1;const t=e[s];if(null!=t&&"object"==typeof t&&t.constructor===Object){if((s-=n=128&i?0:-1)>=1024)throw Error("pvtlmt");for(var a in t)(o=+a)<s&&(e[o+n]=t[a],delete t[a]);i=-16760833&i|(1023&s)<<14;break t}}if(n){if((a=Math.max(n,o-(128&i?0:-1)))>1024)throw Error("spvt");i=-16760833&i|(1023&a)<<14}}}return Z(t,64|i|r),t}function fn(t,n){if("object"!=typeof t)return t;if(Array.isArray(t)){var e=0|t[X];return 0===t.length&&1&e?t=void 0:2&e||(!n||4096&e||16&e?t=pn(t,e,!1,n&&!(16&e)):(Q(t,34),4&e&&Object.freeze(t))),t}return null!=t&&t[H]===tt?nt(t,e=0|(n=t.l)[X])?t:wn(t,n,e)?dn(t,n):pn(n,e):t instanceof U?t:void 0}function dn(t,n,e){return t=new t.constructor(n),e&&(t.g=et),t.m=et,t}function gn(t){const n=t.l,e=0|n[X];return wn(t,n,e)?dn(t,n,!0):new t.constructor(pn(n,e,!1))}function pn(t,n,e,r){return r??=!!(34&n),t=on(t,n,fn,r),r=32,e&&(r|=2),Z(t,n=16769217&n|r),t}function mn(t){const n=t.l,e=0|n[X];return nt(t,e)?wn(t,n,e)?dn(t,n,!0):new t.constructor(pn(n,e,!1)):t}function vn(t){if(t.g!==et)return!1;var n=t.l;return Q(n=pn(n,0|n[X]),2048),t.l=n,t.g=void 0,t.m=void 0,!0}function yn(t){if(!vn(t)&&nt(t,0|t.l[X]))throw Error()}function bn(t,n){void 0===n&&(n=0|t[X]),32&n&&!(4096&n)&&Z(t,4096|n)}function wn(t,n,e){return!!(2&e)||!(!(32&e)||4096&e)&&(Z(n,2|e),t.g=et,!0)}const _n=dt(0);function Sn(t,n,e,r){if(null!==(t=An(t.l,n,e,r)))return t}function An(t,n,e,r){if(-1===n)return null;const i=n+(e?0:-1),o=t.length-1;let s,a;if(!(o<1+(e?0:-1))){if(i>=o)if(s=t[o],null!=s&&"object"==typeof s&&s.constructor===Object)e=s[n],a=!0;else{if(i!==o)return;e=s}else e=t[i];if(r&&null!=e){if(null==(r=r(e)))return r;if(!Object.is(r,e))return a?s[n]=r:t[i]=r,r}return e}}function En(t,n,e,r){yn(t),In(t=t.l,0|t[X],n,e,r)}function In(t,n,e,r,i){const o=e+(i?0:-1);var s=t.length-1;if(s>=1+(i?0:-1)&&o>=s){const i=t[s];if(null!=i&&"object"==typeof i&&i.constructor===Object)return i[e]=r,n}return o<=s?(t[o]=r,n):(void 0!==r&&(e>=(s=(n??=0|t[X])>>14&1023||536870912)?null!=r&&(t[s+(i?0:-1)]={[e]:r}):t[o]=r),n)}function Tn(t,n,e,r,i){let o=t.l,s=0|o[X];r=nt(t,s)?1:r,i=!!i||3===r,2===r&&vn(t)&&(o=t.l,s=0|o[X]);let a=(t=Pn(o,n))===J?7:0|t[X],u=xn(a,s);var c=!(4&u);if(c){4&u&&(t=kt(t),a=0,u=qn(u,s),s=In(o,s,n,t));let r=0,i=0;for(;r<t.length;r++){const n=e(t[r]);null!=n&&(t[i++]=n)}i<r&&(t.length=i),e=-513&(4|u),u=e&=-1025,u&=-4097}return u!==a&&(Z(t,u),2&u&&Object.freeze(t)),Bn(t,u,o,s,n,r,c,i)}function Bn(t,n,e,r,i,o,s,a){let u=n;return 1===o||4===o&&(2&n||!(16&n)&&32&r)?Un(n)||((n|=!t.length||s&&!(4096&n)||32&r&&!(4096&n||16&n)?2:256)!==u&&Z(t,n),Object.freeze(t)):(2===o&&Un(n)&&(t=kt(t),u=0,n=qn(n,r),r=In(e,r,i,t)),Un(n)||(a||(n|=16),n!==u&&Z(t,n))),2&n||!(4096&n||16&n)||bn(e,r),t}function Pn(t,n,e){return t=An(t,n,e),Array.isArray(t)?t:J}function xn(t,n){return 2&n&&(t|=2),1|t}function Un(t){return!!(2&t)&&!!(4&t)||!!(256&t)}function On(t){return rt(t,!0)}function Ln(t,n,e){yn(t);let r=0|(t=t.l)[X];if(null==e)In(t,r,n);else{var i=e===J?7:0|e[X],o=i,s=Un(i),a=s||Object.isFrozen(e);for(s||(i=0),a||(e=kt(e),o=0,i=qn(i,r),a=!1),i|=5,i|=(4&i?512&i?512:1024&i?1024:0:void 0)??1024,s=0;s<e.length;s++){const t=e[s],n=Jt(t);Object.is(t,n)||(a&&(e=kt(e),o=0,i=qn(i,r),a=!1),e[s]=n)}i!==o&&(a&&(e=kt(e),i=qn(i,r)),Z(e,i)),In(t,r,n,e)}}function Nn(t,n){yn(t),In(t=t.l,0|t[X],2,""===n?void 0:n)}function jn(t,n,e){if(2&n)throw Error();const r=at(n);let i=Pn(t,e,r),o=i===J?7:0|i[X],s=xn(o,n);return(2&s||Un(s)||16&s)&&(s===o||Un(s)||Z(i,s),i=kt(i),o=0,s=qn(s,n),In(t,n,e,i,r)),s&=-13,s!==o&&Z(i,s),i}function kn(t,n){var e=Ei;return Cn(Vn(t=t.l),t,void 0,e)===n?n:-1}function Vn(t){if(C)return t[D]??(t[D]=new Map);if(D in t)return t[D];const n=new Map;return Object.defineProperty(t,D,{value:n}),n}function Fn(t,n,e,r,i){const o=Vn(t),s=Cn(o,t,n,e,i);return s!==r&&(s&&(n=In(t,n,s,void 0,i)),o.set(e,r)),n}function Cn(t,n,e,r,i){let o=t.get(r);if(null!=o)return o;o=0;for(let t=0;t<r.length;t++){const s=r[t];null!=An(n,s,i)&&(0!==o&&(e=In(n,e,o,void 0,i)),o=s)}return t.set(r,o),o}function Mn(t,n,e){let r=0|t[X];const i=at(r),o=An(t,e,i);let s;if(null!=o&&o[H]===tt){if(!nt(o))return vn(o),o.l;s=o.l}else Array.isArray(o)&&(s=o);if(s){const t=0|s[X];2&t&&(s=pn(s,t))}return s=ln(s,n),s!==o&&In(t,r,e,s,i),s}function Gn(t,n,e,r){let i=!1;if(null!=(r=An(t,r,void 0,(t=>{const r=Zt(t,e,n);return i=r!==t&&null!=r,r}))))return i&&!nt(r)&&bn(t,n),r}function Dn(t,n,e){let r=t.l,i=0|r[X];if(null==(n=Gn(r,i,n,e)))return n;if(i=0|r[X],!nt(t,i)){const o=mn(n);o!==n&&(vn(t)&&(r=t.l,i=0|r[X]),i=In(r,i,e,n=o),bn(r,i))}return n}function zn(t,n,e,r,i,o,s){var a=nt(t,e);i=a?1:i,o=!!o||3===i,a=s&&!a,(2===i||a)&&vn(t)&&(e=0|(n=t.l)[X]);var u=(t=Pn(n,1))===J?7:0|t[X],c=xn(u,e);if(s=!(4&c)){var l=t,h=e;const n=!!(2&c);n&&(h|=2);let i=!n,o=!0,s=0,a=0;for(;s<l.length;s++){const t=Zt(l[s],r,h);if(t instanceof r){if(!n){const n=nt(t);i&&=!n,o&&=n}l[a++]=t}}a<s&&(l.length=a),c|=4,c=o?-4097&c:4096|c,c=i?8|c:-9&c}if(c!==u&&(Z(t,c),2&c&&Object.freeze(t)),a&&!(8&c||!t.length&&(1===i||4===i&&(2&c||!(16&c)&&32&e)))){for(Un(c)&&(t=kt(t),c=qn(c,e),e=In(n,e,1,t)),r=t,a=c,u=0;u<r.length;u++)(l=r[u])!==(c=mn(l))&&(r[u]=c);a|=8,Z(t,c=a=r.length?4096|a:-4097&a)}return Bn(t,c,n,e,1,i,s,o)}function Rn(t,n){const e=t.l;return zn(t,e,0|e[X],n,void 0===it?2:4,!1,!0)}function $n(t){return null==t&&(t=void 0),t}function Wn(t,n,e,r,i){return En(t,e,r=$n(r),i),r&&!nt(r)&&bn(t.l),t}function Hn(t,n,e){var r=Ui;t:{var i=e=$n(e);yn(t);const o=t.l;let s=0|o[X];if(null==i){const t=Vn(o);if(Cn(t,o,s,r)!==n)break t;t.set(r,0)}else s=Fn(o,s,r,n);In(o,s,n,i)}e&&!nt(e)&&bn(t.l)}function qn(t,n){return-273&(2&n?2|t:-3&t)}function Kn(t,n){var e=li;yn(t);const r=t.l;t=zn(t,r,0|r[X],e,2,!0),n=null!=n?n:new e,t.push(n);const i=e=t===J?7:0|t[X];(n=nt(n))?(e&=-9,1===t.length&&(e&=-4097)):e|=4096,e!==i&&Z(t,e),n||bn(r)}function Xn(t,n,e){yn(t),Tn(t,n,Qt,2,!0).push(Jt(e))}var Jn=class{constructor(t,n,e){if(this.buffer=t,e&&!n)throw Error();this.g=n}};function Yn(t,n){if("string"==typeof t)return new Jn(T(t),n);if(Array.isArray(t))return new Jn(new Uint8Array(t),n);if(t.constructor===Uint8Array)return new Jn(t,!1);if(t.constructor===ArrayBuffer)return t=new Uint8Array(t),new Jn(t,!1);if(t.constructor===U)return n=x(t)||new Uint8Array(0),new Jn(n,!0,t);if(t instanceof Uint8Array)return t=t.constructor===Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Jn(t,!1);throw Error()}function Qn(t,n){let e,r=0,i=0,o=0;const s=t.i;let a=t.g;do{e=s[a++],r|=(127&e)<<o,o+=7}while(o<32&&128&e);if(o>32)for(i|=(127&e)>>4,o=3;o<32&&128&e;o+=7)e=s[a++],i|=(127&e)<<o;if(re(t,a),!(128&e))return n(r>>>0,i>>>0);throw Error()}function Zn(t){let n=0,e=t.g;const r=e+10,i=t.i;for(;e<r;){const r=i[e++];if(n|=r,0==(128&r))return re(t,e),!!(127&n)}throw Error()}function te(t){const n=t.i;let e=t.g,r=n[e++],i=127&r;if(128&r&&(r=n[e++],i|=(127&r)<<7,128&r&&(r=n[e++],i|=(127&r)<<14,128&r&&(r=n[e++],i|=(127&r)<<21,128&r&&(r=n[e++],i|=r<<28,128&r&&128&n[e++]&&128&n[e++]&&128&n[e++]&&128&n[e++]&&128&n[e++])))))throw Error();return re(t,e),i}function ne(t){var n=t.i;const e=t.g;var r=n[e],i=n[e+1];const o=n[e+2];return n=n[e+3],re(t,t.g+4),t=2*((i=(r<<0|i<<8|o<<16|n<<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 ee(t){return te(t)}function re(t,n){if(t.g=n,n>t.j)throw Error()}function ie(t,n){if(n<0)throw Error();const e=t.g;if((n=e+n)>t.j)throw Error();return t.g=n,e}function oe(t,n){if(0==n)return P();var e=ie(t,n);return t.B&&t.v?e=t.i.subarray(e,e+n):(t=t.i,e=e===(n=e+n)?new Uint8Array(0):wt?t.slice(e,n):new Uint8Array(t.subarray(e,n))),0==e.length?P():new U(e,B)}var se=[];function ae(t,n,e,r){if(me.length){const i=me.pop();return i.o(r),i.g.init(t,n,e,r),i}return new pe(t,n,e,r)}function ue(t){t.g.clear(),t.j=-1,t.i=-1,me.length<100&&me.push(t)}function ce(t){var n=t.g;if(n.g==n.j)return!1;t.m=t.g.g;var e=te(t.g)>>>0;if(n=e>>>3,!((e&=7)>=0&&e<=5))throw Error();if(n<1)throw Error();return t.j=n,t.i=e,!0}function le(t){switch(t.i){case 0:0!=t.i?le(t):Zn(t.g);break;case 1:re(t=t.g,t.g+8);break;case 2:if(2!=t.i)le(t);else{var n=te(t.g)>>>0;re(t=t.g,t.g+n)}break;case 5:re(t=t.g,t.g+4);break;case 3:for(n=t.j;;){if(!ce(t))throw Error();if(4==t.i){if(t.j!=n)throw Error();break}le(t)}break;default:throw Error()}}function he(t,n,e){const r=t.g.j;var i=te(t.g)>>>0;let o=(i=t.g.g+i)-r;if(o<=0&&(t.g.j=i,e(n,t,void 0,void 0,void 0),o=i-t.g.g),o)throw Error();t.g.g=i,t.g.j=r}function fe(t){var n=te(t.g)>>>0,e=ie(t=t.g,n);if(t=t.i,a){var u,c=t;(u=s)||(u=s=new TextDecoder("utf-8",{fatal:!0})),n=e+n,c=0===e&&n===c.length?c:c.subarray(e,n);try{var l=u.decode(c)}catch(t){if(void 0===o){try{u.decode(new Uint8Array([128]))}catch(t){}try{u.decode(new Uint8Array([97])),o=!0}catch(t){o=!1}}throw!o&&(s=void 0),t}}else{n=(l=e)+n,e=[];let o,s=null;for(;l<n;){var h=t[l++];h<128?e.push(h):h<224?l>=n?r():(o=t[l++],h<194||128!=(192&o)?(l--,r()):e.push((31&h)<<6|63&o)):h<240?l>=n-1?r():(o=t[l++],128!=(192&o)||224===h&&o<160||237===h&&o>=160||128!=(192&(u=t[l++]))?(l--,r()):e.push((15&h)<<12|(63&o)<<6|63&u)):h<=244?l>=n-2?r():(o=t[l++],128!=(192&o)||o-144+(h<<28)>>30!=0||128!=(192&(u=t[l++]))||128!=(192&(c=t[l++]))?(l--,r()):(h=(7&h)<<18|(63&o)<<12|(63&u)<<6|63&c,h-=65536,e.push(55296+(h>>10&1023),56320+(1023&h)))):r(),e.length>=8192&&(s=i(s,e),e.length=0)}l=i(s,e)}return l}function de(t){const n=te(t.g)>>>0;return oe(t.g,n)}function ge(t,n,e){var r=te(t.g)>>>0;for(r=t.g.g+r;t.g.g<r;)e.push(n(t.g))}var pe=class{constructor(t,n,e,r){if(se.length){const i=se.pop();i.init(t,n,e,r),t=i}else t=new class{constructor(t,n,e,r){this.i=null,this.v=!1,this.g=this.j=this.m=0,this.init(t,n,e,r)}init(t,n,e,{B:r=!1,D:i=!1}={}){this.B=r,this.D=i,t&&(t=Yn(t,this.D),this.i=t.buffer,this.v=t.g,this.m=n||0,this.j=void 0!==e?this.m+e:this.i.length,this.g=this.m)}clear(){this.i=null,this.v=!1,this.g=this.j=this.m=0,this.B=!1}}(t,n,e,r);this.g=t,this.m=this.g.g,this.i=this.j=-1,this.o(r)}o({F:t=!1}={}){this.F=t}},me=[];function ve(t){return t?/^\d+$/.test(t)?(Nt(t),new ye(St,At)):null:be||=new ye(0,0)}var ye=class{constructor(t,n){this.i=t>>>0,this.g=n>>>0}};let be;function we(t){return t?/^-?\d+$/.test(t)?(Nt(t),new _e(St,At)):null:Se||=new _e(0,0)}var _e=class{constructor(t,n){this.i=t>>>0,this.g=n>>>0}};let Se;function Ae(t,n,e){for(;e>0||n>127;)t.g.push(127&n|128),n=(n>>>7|e<<25)>>>0,e>>>=7;t.g.push(n)}function Ee(t,n){for(;n>127;)t.g.push(127&n|128),n>>>=7;t.g.push(n)}function Ie(t,n){if(n>=0)Ee(t,n);else{for(let e=0;e<9;e++)t.g.push(127&n|128),n>>=7;t.g.push(1)}}function Te(t){var n=St;t.g.push(n>>>0&255),t.g.push(n>>>8&255),t.g.push(n>>>16&255),t.g.push(n>>>24&255)}function Be(t,n){0!==n.length&&(t.j.push(n),t.i+=n.length)}function Pe(t,n,e){Ee(t.g,8*n+e)}function xe(t,n){return Pe(t,n,2),n=t.g.end(),Be(t,n),n.push(t.i),n}function Ue(t,n){var e=n.pop();for(e=t.i+t.g.length()-e;e>127;)n.push(127&e|128),e>>>=7,t.i++;n.push(e),t.i++}function Oe(t,n,e){Pe(t,n,2),Ee(t.g,e.length),Be(t,t.g.end()),Be(t,e)}function Le(){const t=class{constructor(){throw Error()}};return Object.setPrototypeOf(t,t.prototype),t}var Ne=Le(),je=Le(),ke=Le(),Ve=Le(),Fe=Le(),Ce=Le(),Me=Le(),Ge=Le(),De=Le(),ze=Le();function Re(t,n,e){var r=t.l;z&&z in r&&(r=r[z])&&delete r[n.g],n.i?n.m(t,n.i,n.g,e,n.j):n.m(t,n.g,e,n.j)}var $e=class{constructor(t,n){this.l=hn(t,n,void 0,2048)}toJSON(){return cn(this)}};$e.prototype[H]=tt,$e.prototype.toString=function(){return this.l.toString()};var We=class{constructor(t,n,e){this.g=t,this.i=n,t=Ne,this.j=!!t&&e===t||!1}};function He(t,n){return new We(t,n,Ne)}function qe(t,n,e,r,i){null!=(n=or(n,r))&&(e=xe(t,e),i(n,t),Ue(t,e))}const Ke=He((function(t,n,e,r,i){return 2===t.i&&(he(t,Mn(n,r,e),i),!0)}),qe),Xe=He((function(t,n,e,r,i){return 2===t.i&&(he(t,Mn(n,r,e),i),!0)}),qe);var Je=Symbol(),Ye=Symbol(),Qe=Symbol(),Ze=Symbol(),tr=Symbol();let nr,er;function rr(t,n,e,r){var i=r[t];if(i)return i;(i={}).I=r,i.A=function(t){switch(typeof t){case"boolean":return an||=[0,void 0,!0];case"number":return t>0?void 0:0===t?un||=[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.C=o,"function"==typeof(o=r[++s])&&(i.G=!0,nr??=o,er??=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 We?t=o:(t=Ke,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?e(i,u,t,c,r):n(i,u,t,r)}}return r[t]=i}function ir(t){return Array.isArray(t)?t[0]instanceof We?t:[Xe,t]:[t,void 0]}function or(t,n){return t instanceof $e?t.l:Array.isArray(t)?ln(t,n):void 0}function sr(t,n,e,r){const i=e.g;t[n]=r?(t,n,e)=>i(t,n,e,r):i}function ar(t,n,e,r,i){const o=e.g;let s,a;t[n]=(t,n,e)=>o(t,n,e,a||=rr(Ye,sr,ar,r).A,s||=ur(r),i)}function ur(t){let n=t[Qe];if(null!=n)return n;const e=rr(Ye,sr,ar,t);return n=e.G?(t,n)=>nr(t,n,e):(t,n)=>{for(;ce(n)&&4!=n.i;){var r=n.j,i=e[r];if(null==i){var o=e.C;o&&(o=o[r])&&(null!=(o=lr(o))&&(i=e[r]=o))}if(null==i||!i(n,t,r)){if(i=(o=n).m,le(o),o.F)var s=void 0;else s=o.g.g-i,o.g.g=i,s=oe(o.g,s);i=void 0,o=t,s&&((i=o[z]??(o[z]=new en))[r]??(i[r]=[])).push(s)}}return(t=tn(t))&&(t.g=e.I[tr]),!0},t[Qe]=n,t[tr]=cr.bind(t),n}function cr(t,n,e,r){var i=this[Ye];const o=this[Qe],s=ln(void 0,i.A),a=tn(t);if(a){var u=!1,c=i.C;if(c){if(i=(n,e,i)=>{if(0!==i.length)if(c[e])for(const t of i){n=ae(t);try{u=!0,o(s,n)}finally{ue(n)}}else r?.(t,e,i)},null==n)nn(a,i);else if(null!=a){const t=a[n];t&&i(a,n,t)}if(u){let r=0|t[X];if(2&r&&2048&r&&!e?.T)throw Error();const i=at(r),o=(n,o)=>{if(null!=An(t,n,i)){if(1===e?.S)return;throw Error()}null!=o&&(r=In(t,r,n,o,i)),delete a[n]};null==n?ot(s,0|s[X],((t,n)=>{o(t,n)})):o(n,An(s,n,i))}}}}function lr(t){const n=(t=ir(t))[0].g;if(t=t[1]){const e=ur(t),r=rr(Ye,sr,ar,t).A;return(t,i,o)=>n(t,i,o,r,e)}return n}function hr(t,n,e){t[n]=e.i}function fr(t,n,e,r){let i,o;const s=e.i;t[n]=(t,n,e)=>s(t,n,e,o||=rr(Je,hr,fr,r).A,i||=dr(r))}function dr(t){let n=t[Ze];if(!n){const e=rr(Je,hr,fr,t);n=(t,n)=>gr(t,n,e),t[Ze]=n}return n}function gr(t,n,e){ot(t,0|t[X],((t,r)=>{if(null!=r){var i=function(t,n){var e=t[n];if(e)return e;if((e=t.C)&&(e=e[n])){var r=(e=ir(e))[0].i;if(e=e[1]){const n=dr(e),i=rr(Je,hr,fr,e).A;e=t.G?er(i,n):(t,e,o)=>r(t,e,o,i,n)}else e=r;return t[n]=e}}(e,t);i?i(n,r,t):t<500||V($,3)}})),(t=tn(t))&&nn(t,((t,e,r)=>{for(Be(n,n.g.end()),t=0;t<r.length;t++)Be(n,x(r[t])||new Uint8Array(0))}))}const pr=dt(0);function mr(t,n){if(Array.isArray(n)){var e=0|n[X];if(4&e)return n;for(var r=0,i=0;r<n.length;r++){const e=t(n[r]);null!=e&&(n[i++]=e)}return i<r&&(n.length=i),(t=-1537&(5|e))!==e&&Z(n,t),2&t&&Object.freeze(n),n}}function vr(t,n,e){return new We(t,n,e)}function yr(t,n,e){return new We(t,n,e)}function br(t,n,e){In(t,0|t[X],n,e,at(0|t[X]))}function wr(t,n,e){if(n=function(t){if(null==t)return t;const n=typeof t;if("bigint"===n)return String(Vt(64,t));if($t(t)){if("string"===n)return Kt(t);if("number"===n)return qt(t)}}(n),null!=n){if("string"==typeof n)we(n);if(null!=n)switch(Pe(t,e,0),typeof n){case"number":t=t.g,It(n),Ae(t,St,At);break;case"bigint":e=BigInt.asUintN(64,n),e=new _e(Number(e&BigInt(4294967295)),Number(e>>BigInt(32))),Ae(t.g,e.i,e.g);break;default:e=we(n),Ae(t.g,e.i,e.g)}}}function _r(t,n,e){null!=(n=Wt(n))&&null!=n&&(Pe(t,e,0),Ie(t.g,n))}function Sr(t,n,e){null!=(n=null==n||"boolean"==typeof n?n:"number"==typeof n?!!n:void 0)&&(Pe(t,e,0),t.g.g.push(n?1:0))}function Ar(t,n,e){null!=(n=Qt(n))&&Oe(t,e,l(n))}function Er(t,n,e,r,i){null!=(n=or(n,r))&&(e=xe(t,e),i(n,t),Ue(t,e))}function Ir(t,n,e){null!=(n=null==n||"string"==typeof n||n instanceof U?n:void 0)&&Oe(t,e,Yn(n,!0).buffer)}function Tr(t,n,e){n=function(t){if(null==t)return t;if("string"==typeof t&&t)t=+t;else if("number"!=typeof t)return;return Mt(t)?t>>>0:void 0}(n),null!=n&&null!=n&&(Pe(t,e,0),Ee(t.g,n))}var Br=vr((function(t,n,e){return 5===t.i&&(br(n,e,ne(t.g)),!0)}),(function(t,n,e){null!=(n=Dt(n))&&(Pe(t,e,5),t=t.g,Tt(n),Te(t))}),Ge),Pr=yr((function(t,n,e){return(5===t.i||2===t.i)&&(n=jn(n,0|n[X],e),2==t.i?ge(t,ne,n):n.push(ne(t.g)),!0)}),(function(t,n,e){if(null!=(n=mr(Dt,n))&&n.length){Pe(t,e,2),Ee(t.g,4*n.length);for(let r=0;r<n.length;r++)e=t.g,Tt(n[r]),Te(e)}}),Ge),xr=vr((function(t,n,e){return 0!==t.i?t=!1:(br(n,e,Qn(t.g,xt)),t=!0),t}),wr,Ce),Ur=vr((function(t,n,e){return 0!==t.i?n=!1:(br(n,e,(t=Qn(t.g,xt))===pr?void 0:t),n=!0),n}),wr,Ce),Or=vr((function(t,n,e){return 0!==t.i?t=!1:(br(n,e,Qn(t.g,Pt)),t=!0),t}),(function(t,n,e){if(n=function(t){if(null==t)return t;var n=typeof t;if("bigint"===n)return String(Ft(64,t));if($t(t)){if("string"===n)return n=Gt(Number(t)),Ct(n)&&n>=0?t=String(n):(-1!==(n=t.indexOf("."))&&(t=t.substring(0,n)),(n="-"!==t[0]&&((n=t.length)<20||20===n&&t<="18446744073709551615"))||(Nt(t),t=Ut(St,At))),t;if("number"===n)return(t=Gt(t))>=0&&Ct(t)||(It(t),t=Bt(St,At)),t}}(n),null!=n){if("string"==typeof n)ve(n);if(null!=n)switch(Pe(t,e,0),typeof n){case"number":t=t.g,It(n),Ae(t,St,At);break;case"bigint":e=BigInt.asUintN(64,n),e=new ye(Number(e&BigInt(4294967295)),Number(e>>BigInt(32))),Ae(t.g,e.i,e.g);break;default:e=ve(n),Ae(t.g,e.i,e.g)}}}),Me),Lr=vr((function(t,n,e){return 0===t.i&&(br(n,e,te(t.g)),!0)}),_r,Ve),Nr=yr((function(t,n,e){return(0===t.i||2===t.i)&&(n=jn(n,0|n[X],e),2==t.i?ge(t,te,n):n.push(te(t.g)),!0)}),(function(t,n,e){if(null!=(n=mr(Wt,n))&&n.length){e=xe(t,e);for(let e=0;e<n.length;e++)Ie(t.g,n[e]);Ue(t,e)}}),Ve),jr=vr((function(t,n,e){return 0===t.i&&(br(n,e,0===(t=te(t.g))?void 0:t),!0)}),_r,Ve),kr=vr((function(t,n,e){return 0===t.i&&(br(n,e,Zn(t.g)),!0)}),Sr,je),Vr=vr((function(t,n,e){return 0===t.i&&(br(n,e,!1===(t=Zn(t.g))?void 0:t),!0)}),Sr,je),Fr=yr((function(t,n,e){return 2===t.i&&(t=fe(t),jn(n,0|n[X],e).push(t),!0)}),(function(t,n,e){if(null!=(n=mr(Qt,n)))for(let s=0;s<n.length;s++){var r=t,i=e,o=n[s];null!=o&&Oe(r,i,l(o))}}),ke),Cr=vr((function(t,n,e){return 2===t.i&&(br(n,e,""===(t=fe(t))?void 0:t),!0)}),Ar,ke),Mr=vr((function(t,n,e){return 2===t.i&&(br(n,e,fe(t)),!0)}),Ar,ke),Gr=function(t,n,e=Ne){return new We(t,n,e)}((function(t,n,e,r,i){return 2===t.i&&(r=ln(void 0,r),jn(n,0|n[X],e).push(r),he(t,r,i),!0)}),(function(t,n,e,r,i){if(Array.isArray(n)){for(let o=0;o<n.length;o++)Er(t,n[o],e,r,i);1&(t=0|n[X])||Z(n,1|t)}})),Dr=He((function(t,n,e,r,i,o){if(2!==t.i)return!1;let s=0|n[X];return Fn(n,s,o,e,at(s)),he(t,n=Mn(n,r,e),i),!0}),Er),zr=vr((function(t,n,e){return 2===t.i&&(br(n,e,de(t)),!0)}),Ir,De),Rr=vr((function(t,n,e){return 0===t.i&&(br(n,e,0===(t=te(t.g)>>>0)?void 0:t),!0)}),Tr,Fe),$r=vr((function(t,n,e){return 0===t.i&&(br(n,e,te(t.g)),!0)}),(function(t,n,e){null!=(n=Wt(n))&&(n=parseInt(n,10),Pe(t,e,0),Ie(t.g,n))}),ze);class Wr{constructor(t,n){var e=si;this.g=t,this.i=n,this.m=Wn,this.defaultValue=void 0,this.j=null!=e.P?st:void 0}register(){m(this)}}function Hr(t,n){return(e,r)=>{{const o={D:!0};r&&Object.assign(o,r),e=ae(e,void 0,void 0,o);try{const r=new t,o=r.l;ur(n)(o,e);var i=r}finally{ue(e)}}return i}}var qr=[0,Cr,vr((function(t,n,e){return 2===t.i&&(br(n,e,(t=de(t))===P()?void 0:t),!0)}),(function(t,n,e){if(null!=n){if(n instanceof $e){const r=n.U;return void(r?(n=r(n),null!=n&&Oe(t,e,Yn(n,!0).buffer)):V($,3))}if(Array.isArray(n))return void V($,3)}Ir(t,n,e)}),De)];let Kr,Xr=globalThis.trustedTypes;function Jr(t){var n;return void 0===Kr&&(Kr=function(){let t=null;if(!Xr)return t;try{const n=t=>t;t=Xr.createPolicy("goog#html",{createHTML:n,createScript:n,createScriptURL:n})}catch(t){}return t}()),t=(n=Kr)?n.createScriptURL(t):t,new class{constructor(t){this.g=t}toString(){return this.g+""}}(t)}function Yr(t,...n){if(0===n.length)return Jr(t[0]);let e=t[0];for(let r=0;r<n.length;r++)e+=encodeURIComponent(n[r])+t[r+1];return Jr(e)}var Qr=[0,Lr,$r,kr,-1,Nr,$r,-1,kr],Zr=class extends $e{constructor(t){super(t)}},ti=[0,kr,Mr,kr,$r,-1,yr((function(t,n,e){return(0===t.i||2===t.i)&&(n=jn(n,0|n[X],e),2==t.i?ge(t,ee,n):n.push(te(t.g)),!0)}),(function(t,n,e){if(null!=(n=mr(Wt,n))&&n.length){e=xe(t,e);for(let e=0;e<n.length;e++)Ie(t.g,n[e]);Ue(t,e)}}),ze),Mr,-1,[0,kr,-1],$r,kr,-1],ni=[0,3,kr,-1,2,[0,[2],Lr,Dr,[0,vr((function(t,n,e){return 0===t.i&&(br(n,e,te(t.g)>>>0),!0)}),Tr,Fe)]],[0,$r,kr,$r,kr,$r,kr,Mr,-1],[0,[3,4],Mr,-1,Dr,[0,Lr],Dr,[0,$r]],[0]],ei=[0,Mr,-2],ri=class extends $e{constructor(t){super(t)}},ii=[0],oi=[0,Lr,kr,1,kr,-4],si=class extends $e{constructor(t){super(t,2)}},ai={};ai[336783863]=[0,Mr,kr,-1,Lr,[0,[1,2,3,4,5,6,7,8,9],Dr,ii,Dr,ti,Dr,ei,Dr,oi,Dr,Qr,Dr,[0,Mr,-2],Dr,[0,Mr,$r],Dr,ni,Dr,[0,$r,-1,kr]],[0,Mr],kr,[0,[1,3],[2,4],Dr,[0,Nr],-1,Dr,[0,Fr],-1,Gr,[0,Mr,-1]],Mr];var ui=[0,Ur,-1,Vr,-3,Ur,Nr,Cr,jr,Ur,-1,Vr,jr,Vr,-2,Cr];function ci(t){Xn(t,3,"TEXT:text_in")}var li=class extends $e{constructor(t){super(t,500)}o(t){return Wn(this,0,7,t)}},hi=[-1,{}],fi=[0,Mr,1,hi],di=[0,Mr,Fr,hi];function gi(t){Xn(t,10,"text_in")}var pi,mi=class extends $e{constructor(t){super(t,500)}o(t){return Wn(this,0,1001,t)}};mi.prototype.i=(pi=[-500,Gr,[-500,Cr,-1,Fr,-3,[-2,ai,kr],Gr,qr,jr,-1,fi,di,Gr,[0,Cr,Vr],Cr,ui,jr,Fr,987,Fr],4,Gr,[-500,Mr,-1,[-1,{}],998,Mr],Gr,[-500,Mr,Fr,-1,[-2,{},kr],997,Fr,-1],jr,Gr,[-500,Mr,Fr,hi,998,Fr],Fr,jr,fi,di,Gr,[0,Cr,-1,hi],Fr,-2,ui,Cr,-1,Vr,[0,Vr,Rr],978,hi,Gr,qr],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}}}};gr(this.l,t,rr(Je,hr,fr,pi)),Be(t,t.g.end());const n=new Uint8Array(t.i),e=t.j,r=e.length;let i=0;for(let t=0;t<r;t++){const r=e[t];n.set(r,i),i+=r.length}return t.j=[n],n});var vi=class extends $e{constructor(t){super(t)}},yi=class extends $e{constructor(t){super(t)}i(){return Rn(this,vi)}},bi=class extends $e{constructor(t){super(t)}},wi=Hr(class extends $e{constructor(t){super(t)}},[0,Gr,[0,1,Lr,Mr,[0,Gr,[0,Lr,Br,Mr,-1]]],xr]),_i=class extends $e{constructor(t){super(t)}},Si=class extends $e{constructor(t){super(t)}H(){const t=Sn(this,1,void 0,On);return null==t?P():t}},Ai=class extends $e{constructor(t){super(t)}},Ei=[1,2],Ii=Hr(class extends $e{constructor(t){super(t)}},[0,Gr,[0,Ei,Dr,[0,Pr],Dr,[0,zr],Lr,Mr],xr]),Ti=class extends $e{constructor(t){super(t)}},Bi=class extends $e{constructor(t){super(t)}},Pi=[0,kr,-1],xi=class extends $e{constructor(t){super(t)}},Ui=[1,2,3,4,5,6],Oi=class extends $e{constructor(t){super(t)}i(){return null!=Sn(this,1,void 0,On)}j(){return null!=Qt(Sn(this,2))}},Li=class extends $e{constructor(t){super(t)}},Ni=[0,[0,zr,Mr,[0,Lr,xr,-1],[0,Or,xr]],kr,[0,Ui,Dr,oi,Dr,ti,Dr,Qr,Dr,ii,Dr,ei,Dr,ni],$r],ji=class extends $e{constructor(t){super(t)}},ki=new Wr(462704549,ji);ai[462704549]=[0,Ni,[0,Mr,Lr,Br,Fr,-1]];var Vi=class extends $e{constructor(t){super(t)}},Fi=new Wr(477589892,Vi);function Ci(t,n){if(n=n?gn(n):new Ti,void 0!==t.displayNamesLocale?En(n,1,Yt(t.displayNamesLocale)):void 0===t.displayNamesLocale&&En(n,1),void 0!==t.maxResults){var e=t.maxResults;if(null!=e){if("number"!=typeof e)throw k();if(!Mt(e))throw k();e|=0}En(n,2,e)}else"maxResults"in t&&En(n,2);if(void 0!==t.scoreThreshold){if(null!=(e=t.scoreThreshold)&&"number"!=typeof e)throw Error(`Value of float/double field must be a number, found ${typeof e}: ${e}`);En(n,3,e)}else"scoreThreshold"in t&&En(n,3);return void 0!==t.categoryAllowlist?Ln(n,4,t.categoryAllowlist):"categoryAllowlist"in t&&En(n,4),void 0!==t.categoryDenylist?Ln(n,5,t.categoryDenylist):"categoryDenylist"in t&&En(n,5),n}function Mi(t){const n=Number(t);return Number.isSafeInteger(n)?n:String(t)}function Gi(t){const n={classifications:Rn(t,bi).map((t=>function(t,n=-1,e=""){return{categories:t.map((t=>({index:Wt(Sn(t,1))??0??-1,score:Sn(t,2,void 0,Dt)??0??0,categoryName:Qt(Sn(t,3))??""??"",displayName:Qt(Sn(t,4))??""??""}))),headIndex:n,headName:e}}(Dn(t,yi,4)?.i()??[],Wt(Sn(t,2))??0,Qt(Sn(t,3))??"")))};return null!=function(t){return null==t?t:"bigint"==typeof t?(gt(t)?t=Number(t):(t=Vt(64,t),t=gt(t)?Number(t):String(t)),t):$t(t)?"number"==typeof t?qt(t):Kt(t):void 0}(Sn(t,2,void 0,Xt))&&(n.timestampMs=Mi(Sn(t,2,void 0,Xt)??_n)),n}function Di(t){return Array.from(t,(t=>t>127?t-256:t))}function zi(t,n){if(t.length!==n.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${t.length} vs. ${n.length}).`);let e=0,r=0,i=0;for(let o=0;o<t.length;o++)e+=t[o]*n[o],r+=t[o]*t[o],i+=n[o]*n[o];if(r<=0||i<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return e/Math.sqrt(r*i)}let Ri;ai[477589892]=[0,Ni,Pi];const $i=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 Wi(t){if(t)return!0;if(void 0===Ri)try{await WebAssembly.instantiate($i),Ri=!0}catch{Ri=!1}return Ri}async function Hi(t,n,e){return{wasmLoaderPath:`${n}/${t}_${e=`wasm${e?"_module":""}${await Wi(e)?"":"_nosimd"}_internal`}.js`,wasmBinaryPath:`${n}/${t}_${e}.wasm`}}var qi=class{};function Ki(){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 Xi(n){if("function"!=typeof importScripts){const t=document.createElement("script");return t.src=n.toString(),t.crossOrigin="anonymous",new Promise(((n,e)=>{t.addEventListener("load",(()=>{n()}),!1),t.addEventListener("error",(t=>{e(t)}),!1),document.body.appendChild(t)}))}try{importScripts(n.toString())}catch(e){if(!(e instanceof TypeError))throw e;{const e=self.import;e?await e(n.toString()):await function(n){return Promise.resolve().then((function(){return t(require(n))}))}(n.toString())}}}qi.forVisionTasks=function(t,n=!1){return Hi("vision",t??Yr``,n)},qi.forTextTasks=function(t,n=!1){return Hi("text",t??Yr``,n)},qi.forGenAiTasks=function(t,n=!1){return Hi("genai",t??Yr``,n)},qi.forAudioTasks=function(t,n=!1){return Hi("audio",t??Yr``,n)},qi.isSimdSupported=function(t=!1){return Wi(t)};function Ji(t,n,e){t.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),e(n=t.h.stringToNewUTF8(n)),t.h._free(n)}function Yi(t,n,e){t.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const r=new Uint32Array(n.length);for(let e=0;e<n.length;e++)r[e]=t.h.stringToNewUTF8(n[e]);n=t.h._malloc(4*r.length),t.h.HEAPU32.set(r,n>>2),e(n);for(const n of r)t.h._free(n);t.h._free(n)}function Qi(t,n,e){t.h.simpleListeners=t.h.simpleListeners||{},t.h.simpleListeners[n]=e}function Zi(t,n,e){let r=[];t.h.simpleListeners=t.h.simpleListeners||{},t.h.simpleListeners[n]=(t,n,i)=>{n?(e(r,i),r=[]):r.push(t)}}const to=function(t){return class extends t{N(){this.h._registerModelResourcesGraphService()}}}(class{constructor(t,n){this.j=!0,this.h=t,this.g=null,this.i=0,this.m="function"==typeof this.h._addIntToInputStream,void 0!==n?this.h.canvas=n:Ki()?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 n=await(await fetch(t)).arrayBuffer();t=!(t.endsWith(".pbtxt")||t.endsWith(".textproto")),this.setGraph(new Uint8Array(n),t)}setGraphFromString(t){this.setGraph((new TextEncoder).encode(t),!1)}setGraph(t,n){const e=t.length,r=this.h._malloc(e);this.h.HEAPU8.set(t,r),n?this.h._changeBinaryGraph(e,r):this.h._changeTextGraph(e,r),this.h._free(r)}configureAudio(t,n,e,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,n??0,e)}))}))}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,n){this.h.emptyPacketListeners=this.h.emptyPacketListeners||{},this.h.emptyPacketListeners[t]=n}addAudioToStream(t,n,e){this.addAudioToStreamWithShape(t,0,0,n,e)}addAudioToStreamWithShape(t,n,e,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,n,e,t,i)}))}addGpuBufferToStream(t,n,e){Ji(this,n,(n=>{if(!this.h.canvas)throw Error("No OpenGL canvas configured.");n?this.h._bindTextureToStream(n):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(n,s,a,e)}))}addBoolToStream(t,n,e){Ji(this,n,(n=>{this.h._addBoolToInputStream(t,n,e)}))}addDoubleToStream(t,n,e){Ji(this,n,(n=>{this.h._addDoubleToInputStream(t,n,e)}))}addFloatToStream(t,n,e){Ji(this,n,(n=>{this.h._addFloatToInputStream(t,n,e)}))}addIntToStream(t,n,e){Ji(this,n,(n=>{this.h._addIntToInputStream(t,n,e)}))}addUintToStream(t,n,e){Ji(this,n,(n=>{this.h._addUintToInputStream(t,n,e)}))}addStringToStream(t,n,e){Ji(this,n,(n=>{Ji(this,t,(t=>{this.h._addStringToInputStream(t,n,e)}))}))}addStringRecordToStream(t,n,e){Ji(this,n,(n=>{Yi(this,Object.keys(t),(r=>{Yi(this,Object.values(t),(i=>{this.h._addFlatHashMapToInputStream(r,i,Object.keys(t).length,n,e)}))}))}))}addProtoToStream(t,n,e,r){Ji(this,e,(e=>{Ji(this,n,(n=>{const i=this.h._malloc(t.length);this.h.HEAPU8.set(t,i),this.h._addProtoToInputStream(i,t.length,n,e,r),this.h._free(i)}))}))}addEmptyPacketToStream(t,n){Ji(this,t,(t=>{this.h._addEmptyPacketToInputStream(t,n)}))}addBoolVectorToStream(t,n,e){Ji(this,n,(n=>{const r=this.h._allocateBoolVector(t.length);if(!r)throw Error("Unable to allocate new bool vector on heap.");for(const n of t)this.h._addBoolVectorEntry(r,n);this.h._addBoolVectorToInputStream(r,n,e)}))}addDoubleVectorToStream(t,n,e){Ji(this,n,(n=>{const r=this.h._allocateDoubleVector(t.length);if(!r)throw Error("Unable to allocate new double vector on heap.");for(const n of t)this.h._addDoubleVectorEntry(r,n);this.h._addDoubleVectorToInputStream(r,n,e)}))}addFloatVectorToStream(t,n,e){Ji(this,n,(n=>{const r=this.h._allocateFloatVector(t.length);if(!r)throw Error("Unable to allocate new float vector on heap.");for(const n of t)this.h._addFloatVectorEntry(r,n);this.h._addFloatVectorToInputStream(r,n,e)}))}addIntVectorToStream(t,n,e){Ji(this,n,(n=>{const r=this.h._allocateIntVector(t.length);if(!r)throw Error("Unable to allocate new int vector on heap.");for(const n of t)this.h._addIntVectorEntry(r,n);this.h._addIntVectorToInputStream(r,n,e)}))}addUintVectorToStream(t,n,e){Ji(this,n,(n=>{const r=this.h._allocateUintVector(t.length);if(!r)throw Error("Unable to allocate new unsigned int vector on heap.");for(const n of t)this.h._addUintVectorEntry(r,n);this.h._addUintVectorToInputStream(r,n,e)}))}addStringVectorToStream(t,n,e){Ji(this,n,(n=>{const r=this.h._allocateStringVector(t.length);if(!r)throw Error("Unable to allocate new string vector on heap.");for(const n of t)Ji(this,n,(t=>{this.h._addStringVectorEntry(r,t)}));this.h._addStringVectorToInputStream(r,n,e)}))}addBoolToInputSidePacket(t,n){Ji(this,n,(n=>{this.h._addBoolToInputSidePacket(t,n)}))}addDoubleToInputSidePacket(t,n){Ji(this,n,(n=>{this.h._addDoubleToInputSidePacket(t,n)}))}addFloatToInputSidePacket(t,n){Ji(this,n,(n=>{this.h._addFloatToInputSidePacket(t,n)}))}addIntToInputSidePacket(t,n){Ji(this,n,(n=>{this.h._addIntToInputSidePacket(t,n)}))}addUintToInputSidePacket(t,n){Ji(this,n,(n=>{this.h._addUintToInputSidePacket(t,n)}))}addStringToInputSidePacket(t,n){Ji(this,n,(n=>{Ji(this,t,(t=>{this.h._addStringToInputSidePacket(t,n)}))}))}addProtoToInputSidePacket(t,n,e){Ji(this,e,(e=>{Ji(this,n,(n=>{const r=this.h._malloc(t.length);this.h.HEAPU8.set(t,r),this.h._addProtoToInputSidePacket(r,t.length,n,e),this.h._free(r)}))}))}addBoolVectorToInputSidePacket(t,n){Ji(this,n,(n=>{const e=this.h._allocateBoolVector(t.length);if(!e)throw Error("Unable to allocate new bool vector on heap.");for(const n of t)this.h._addBoolVectorEntry(e,n);this.h._addBoolVectorToInputSidePacket(e,n)}))}addDoubleVectorToInputSidePacket(t,n){Ji(this,n,(n=>{const e=this.h._allocateDoubleVector(t.length);if(!e)throw Error("Unable to allocate new double vector on heap.");for(const n of t)this.h._addDoubleVectorEntry(e,n);this.h._addDoubleVectorToInputSidePacket(e,n)}))}addFloatVectorToInputSidePacket(t,n){Ji(this,n,(n=>{const e=this.h._allocateFloatVector(t.length);if(!e)throw Error("Unable to allocate new float vector on heap.");for(const n of t)this.h._addFloatVectorEntry(e,n);this.h._addFloatVectorToInputSidePacket(e,n)}))}addIntVectorToInputSidePacket(t,n){Ji(this,n,(n=>{const e=this.h._allocateIntVector(t.length);if(!e)throw Error("Unable to allocate new int vector on heap.");for(const n of t)this.h._addIntVectorEntry(e,n);this.h._addIntVectorToInputSidePacket(e,n)}))}addUintVectorToInputSidePacket(t,n){Ji(this,n,(n=>{const e=this.h._allocateUintVector(t.length);if(!e)throw Error("Unable to allocate new unsigned int vector on heap.");for(const n of t)this.h._addUintVectorEntry(e,n);this.h._addUintVectorToInputSidePacket(e,n)}))}addStringVectorToInputSidePacket(t,n){Ji(this,n,(n=>{const e=this.h._allocateStringVector(t.length);if(!e)throw Error("Unable to allocate new string vector on heap.");for(const n of t)Ji(this,n,(t=>{this.h._addStringVectorEntry(e,t)}));this.h._addStringVectorToInputSidePacket(e,n)}))}attachBoolListener(t,n){Qi(this,t,n),Ji(this,t,(t=>{this.h._attachBoolListener(t)}))}attachBoolVectorListener(t,n){Zi(this,t,n),Ji(this,t,(t=>{this.h._attachBoolVectorListener(t)}))}attachIntListener(t,n){Qi(this,t,n),Ji(this,t,(t=>{this.h._attachIntListener(t)}))}attachIntVectorListener(t,n){Zi(this,t,n),Ji(this,t,(t=>{this.h._attachIntVectorListener(t)}))}attachUintListener(t,n){Qi(this,t,n),Ji(this,t,(t=>{this.h._attachUintListener(t)}))}attachUintVectorListener(t,n){Zi(this,t,n),Ji(this,t,(t=>{this.h._attachUintVectorListener(t)}))}attachDoubleListener(t,n){Qi(this,t,n),Ji(this,t,(t=>{this.h._attachDoubleListener(t)}))}attachDoubleVectorListener(t,n){Zi(this,t,n),Ji(this,t,(t=>{this.h._attachDoubleVectorListener(t)}))}attachFloatListener(t,n){Qi(this,t,n),Ji(this,t,(t=>{this.h._attachFloatListener(t)}))}attachFloatVectorListener(t,n){Zi(this,t,n),Ji(this,t,(t=>{this.h._attachFloatVectorListener(t)}))}attachStringListener(t,n){Qi(this,t,n),Ji(this,t,(t=>{this.h._attachStringListener(t)}))}attachStringVectorListener(t,n){Zi(this,t,n),Ji(this,t,(t=>{this.h._attachStringVectorListener(t)}))}attachProtoListener(t,n,e){Qi(this,t,n),Ji(this,t,(t=>{this.h._attachProtoListener(t,e||!1)}))}attachProtoVectorListener(t,n,e){Zi(this,t,n),Ji(this,t,(t=>{this.h._attachProtoVectorListener(t,e||!1)}))}attachAudioListener(t,n,e){this.h._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),Qi(this,t,((t,e)=>{t=new Float32Array(t.buffer,t.byteOffset,t.length/4),n(t,e)})),Ji(this,t,(t=>{this.h._attachAudioListener(t,e||!1)}))}finishProcessing(){this.h._waitUntilIdle()}closeGraph(){this.h._closeGraph(),this.h.simpleListeners=void 0,this.h.emptyPacketListeners=void 0}});var no=class extends to{};async function eo(t,n,e){return t=await(async(t,n,e,r)=>{if(n&&await Xi(n),!self.ModuleFactory)throw Error("ModuleFactory not set.");if(e&&(await Xi(e),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&r&&((n=self.Module).locateFile=r.locateFile,r.mainScriptUrlOrBlob&&(n.mainScriptUrlOrBlob=r.mainScriptUrlOrBlob)),r=await self.ModuleFactory(self.Module||r),self.ModuleFactory=self.Module=void 0,new t(r,null)})(t,n.wasmLoaderPath,n.assetLoaderPath,{locateFile:t=>t.endsWith(".wasm")?n.wasmBinaryPath.toString():n.assetBinaryPath&&t.endsWith(".data")?n.assetBinaryPath.toString():t}),await t.o(e),t}async function ro(t,n,e){return eo(t,n,e)}function io(t,n){const e=Dn(t.baseOptions,Oi,1)||new Oi;"string"==typeof n?(En(e,2,Yt(n)),En(e,1)):n instanceof Uint8Array&&(En(e,1,rt(n,!1)),En(e,2)),Wn(t.baseOptions,0,1,e)}function oo(t,n){const e=n.baseOptions||{};if(n.baseOptions?.modelAssetBuffer&&n.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(Dn(t.baseOptions,Oi,1)?.i()||Dn(t.baseOptions,Oi,1)?.j()||n.baseOptions?.modelAssetBuffer||n.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if(function(t,n){let e=Dn(t.baseOptions,xi,3);if(!e){var r=e=new xi;Hn(r,4,new ri)}"delegate"in n&&("GPU"===n.delegate?Hn(n=e,2,r=new Zr):Hn(n=e,4,r=new ri)),Wn(t.baseOptions,0,3,e)}(t,e),e.modelAssetPath)return fetch(e.modelAssetPath.toString()).then((t=>{if(t.ok)return t.arrayBuffer();throw Error(`Failed to fetch model: ${e.modelAssetPath} (${t.status})`)})).then((n=>{try{t.g.h.FS_unlink("/model.dat")}catch{}t.g.h.FS_createDataFile("/","model.dat",new Uint8Array(n),!0,!1,!1),io(t,"/model.dat"),t.v()}));if(e.modelAssetBuffer instanceof Uint8Array)io(t,e.modelAssetBuffer);else if(e.modelAssetBuffer)return async function(t){const n=[];for(var e=0;;){const{done:r,value:i}=await t.read();if(r)break;n.push(i),e+=i.length}if(0===n.length)return new Uint8Array(0);if(1===n.length)return n[0];t=new Uint8Array(e),e=0;for(const r of n)t.set(r,e),e+=r.length;return t}(e.modelAssetBuffer).then((n=>{io(t,n),t.v()}));return t.v(),Promise.resolve()}function so(t){try{const n=t.m.length;if(1===n)throw Error(t.m[0].message);if(n>1)throw Error("Encountered multiple errors: "+t.m.map((t=>t.message)).join(", "))}finally{t.m=[]}}function ao(t,n){t.j=Math.max(t.j,n)}var uo=class{constructor(t){this.g=t,this.m=[],this.j=0,this.g.setAutoRenderToScreen(!1)}setGraph(t,n){this.g.attachErrorListener(((t,n)=>{this.m.push(Error(n))})),this.g.N(),this.g.setGraph(t,n),so(this)}finishProcessing(){this.g.finishProcessing(),so(this)}close(){this.g.closeGraph()}};uo.prototype.close=uo.prototype.close;var co=class extends uo{constructor(t,n){super(new no(t,n)),this.u={languages:[]},Wn(t=this.i=new ji,0,1,n=new Li)}o(t){return Wn(this.i,0,2,Ci(t,Dn(this.i,Ti,2))),oo(this,t)}get baseOptions(){return Dn(this.i,Li,1)}set baseOptions(t){Wn(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 mi;gi(t),Xn(t,15,"classifications_out");const n=new si;Re(n,ki,this.i);const e=new li;Nn(e,Yt("mediapipe.tasks.text.text_classifier.TextClassifierGraph")),ci(e),Xn(e,4,"CLASSIFICATIONS:classifications_out"),e.o(n),Kn(t,e),this.g.attachProtoListener("classifications_out",((t,n)=>{if(({classifications:t}=Gi(wi(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}))),ao(this,n)})),this.g.attachEmptyPacketListener("classifications_out",(t=>{ao(this,t)})),t=t.i(),this.setGraph(new Uint8Array(t),!0)}};co.prototype.detect=co.prototype.K,co.prototype.setOptions=co.prototype.o,co.createFromModelPath=function(t,n){return ro(co,t,{baseOptions:{modelAssetPath:n}})},co.createFromModelBuffer=function(t,n){return ro(co,t,{baseOptions:{modelAssetBuffer:n}})},co.createFromOptions=function(t,n){return ro(co,t,n)};var lo=class extends uo{constructor(t,n){super(new no(t,n)),this.u={classifications:[]},Wn(t=this.i=new ji,0,1,n=new Li)}o(t){return Wn(this.i,0,2,Ci(t,Dn(this.i,Ti,2))),oo(this,t)}get baseOptions(){return Dn(this.i,Li,1)}set baseOptions(t){Wn(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 mi;gi(t),Xn(t,15,"classifications_out");const n=new si;Re(n,ki,this.i);const e=new li;Nn(e,Yt("mediapipe.tasks.text.text_classifier.TextClassifierGraph")),ci(e),Xn(e,4,"CLASSIFICATIONS:classifications_out"),e.o(n),Kn(t,e),this.g.attachProtoListener("classifications_out",((t,n)=>{this.u=Gi(wi(t)),ao(this,n)})),this.g.attachEmptyPacketListener("classifications_out",(t=>{ao(this,t)})),t=t.i(),this.setGraph(new Uint8Array(t),!0)}};lo.prototype.classify=lo.prototype.J,lo.prototype.setOptions=lo.prototype.o,lo.createFromModelPath=function(t,n){return ro(lo,t,{baseOptions:{modelAssetPath:n}})},lo.createFromModelBuffer=function(t,n){return ro(lo,t,{baseOptions:{modelAssetBuffer:n}})},lo.createFromOptions=function(t,n){return ro(lo,t,n)};var ho=class extends uo{constructor(t,n){super(new no(t,n)),this.u={embeddings:[]},Wn(t=this.i=new Vi,0,1,n=new Li)}o(t){var n=this.i,e=Dn(this.i,Bi,2);return e=e?gn(e):new Bi,void 0!==t.l2Normalize?En(e,1,zt(t.l2Normalize)):"l2Normalize"in t&&En(e,1),void 0!==t.quantize?En(e,2,zt(t.quantize)):"quantize"in t&&En(e,2),Wn(n,0,2,e),oo(this,t)}get baseOptions(){return Dn(this.i,Li,1)}set baseOptions(t){Wn(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 mi;gi(t),Xn(t,15,"embeddings_out");const n=new si;Re(n,Fi,this.i);const e=new li;Nn(e,Yt("mediapipe.tasks.text.text_embedder.TextEmbedderGraph")),ci(e),Xn(e,4,"EMBEDDINGS:embeddings_out"),e.o(n),Kn(t,e),this.g.attachProtoListener("embeddings_out",((t,n)=>{t=Ii(t),this.u=function(t){return{embeddings:Rn(t,Ai).map((t=>{const n={headIndex:Wt(Sn(t,3))??0??-1,headName:Qt(Sn(t,4))??""??""};var e=t.l;return void 0!==Gn(e,0|e[X],_i,kn(t,1))?(t=Tn(t=Dn(t,_i,kn(t,1)),1,Dt,void 0===it?2:4),n.floatEmbedding=t.slice()):(e=new Uint8Array(0),n.quantizedEmbedding=Dn(t,Si,kn(t,2))?.H()?.i()??e),n})),timestampMs:Mi(Sn(t,2,void 0,Xt)??_n)}}(t),ao(this,n)})),this.g.attachEmptyPacketListener("embeddings_out",(t=>{ao(this,t)})),t=t.i(),this.setGraph(new Uint8Array(t),!0)}};ho.cosineSimilarity=function(t,n){if(t.floatEmbedding&&n.floatEmbedding)t=zi(t.floatEmbedding,n.floatEmbedding);else{if(!t.quantizedEmbedding||!n.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");t=zi(Di(t.quantizedEmbedding),Di(n.quantizedEmbedding))}return t},ho.prototype.embed=ho.prototype.L,ho.prototype.setOptions=ho.prototype.o,ho.createFromModelPath=function(t,n){return ro(ho,t,{baseOptions:{modelAssetPath:n}})},ho.createFromModelBuffer=function(t,n){return ro(ho,t,{baseOptions:{modelAssetBuffer:n}})},ho.createFromOptions=function(t,n){return ro(ho,t,n)},exports.FilesetResolver=qi,exports.LanguageDetector=co,exports.TaskRunner=uo,exports.TextClassifier=lo,exports.TextEmbedder=ho;
1
+ "use strict";var t="undefined"!=typeof self?self:{};function e(e,r){t:{for(var n=["CLOSURE_FLAGS"],i=t,o=0;o<n.length;o++)if(null==(i=i[n[o]])){n=null;break t}n=i}return null!=(e=n&&n[e])?e:r}function r(){throw Error("Invalid UTF8")}function n(t,e){return e=String.fromCharCode.apply(null,e),null==t?e:t+e}var i,o,s=void 0,a="undefined"!=typeof TextDecoder,u="undefined"!=typeof TextEncoder;function l(t){if(u)t=(o||=new TextEncoder).encode(t);else{let r=0,n=new Uint8Array(3*t.length);for(let i=0;i<t.length;i++){var e=t.charCodeAt(i);if(e<128)n[r++]=e;else{if(e<2048)n[r++]=e>>6|192;else{if(e>=55296&&e<=57343){if(e<=56319&&i<t.length){let o=t.charCodeAt(++i);if(o>=56320&&o<=57343){e=1024*(e-55296)+o-56320+65536,n[r++]=e>>18|240,n[r++]=e>>12&63|128,n[r++]=e>>6&63|128,n[r++]=63&e|128;continue}i--}e=65533}n[r++]=e>>12|224,n[r++]=e>>6&63|128}n[r++]=63&e|128}}t=r===n.length?n:n.subarray(0,r)}return t}var c=e(610401301,!1),h=e(748402147,!0);function f(){var e=t.navigator;return e&&(e=e.userAgent)?e:""}var d,g=t.navigator;function p(t){return p[" "](t),t}d=g&&g.userAgentData||null,p[" "]=function(){};var v={},m=null;function y(t){var e=t.length,r=3*e/4;r%3?r=Math.floor(r):-1!="=.".indexOf(t[e-1])&&(r=-1!="=.".indexOf(t[e-2])?r-2:r-1);var n=new Uint8Array(r),i=0;return function(t,e){function r(e){for(;n<t.length;){let e=t.charAt(n++),r=m[e];if(null!=r)return r;if(!/^[\s\xa0]*$/.test(e))throw Error("Unknown base64 encoding at char: "+e)}return e}b();for(var n=0;;){let t=r(-1),n=r(0),i=r(64),o=r(64);if(64===o&&-1===t)break;e(t<<2|n>>4),64!=i&&(e(n<<4&240|i>>2),64!=o&&e(i<<6&192|o))}}(t,function(t){n[i++]=t}),i!==r?n.subarray(0,i):n}function b(){if(!m){m={};var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),e=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){let n=t.concat(e[r].split(""));v[r]=n;for(let t=0;t<n.length;t++){let e=n[t];void 0===m[e]&&(m[e]=t)}}}}var w="undefined"!=typeof Uint8Array,_=!(!(c&&d&&d.brands.length>0)&&(-1!=f().indexOf("Trident")||-1!=f().indexOf("MSIE")))&&"function"==typeof btoa,S=/[-_.]/g,E={"-":"+",_:"/",".":"="};function A(t){return E[t]||""}function I(t){if(!_)return y(t);t=S.test(t)?t.replace(S,A):t,t=atob(t);var e=new Uint8Array(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}var T={};function U(){return x||=new N(null,T)}function B(t){O(T);var e=t.g;return null==(e=null==e||w&&null!=e&&e instanceof Uint8Array?e:"string"==typeof e?I(e):null)?e:t.g=e}var x,N=class{i(){return new Uint8Array(B(this)||0)}constructor(t,e){if(O(e),this.g=t,null!=t&&0===t.length)throw Error("ByteString should be constructed with non-empty values")}};function O(t){if(t!==T)throw Error("illegal external caller")}function P(t,e){t.__closure__error__context__984382||(t.__closure__error__context__984382={}),t.__closure__error__context__984382.severity=e}var L=void 0;function k(){var t=Error("int32");return P(t,"warning"),t}function V(e,r){if(null!=e){var n=L??={},i=n[e]||0;i>=r||(n[e]=i+1,P(e=Error(),"incident"),function(e){t.setTimeout(()=>{throw e},0)}(e))}}function j(){return"function"==typeof BigInt}var F="function"==typeof Symbol&&"symbol"==typeof Symbol();function C(t,e,r=!1){return"function"==typeof Symbol&&"symbol"==typeof Symbol()?r&&Symbol.for&&t?Symbol.for(t):null!=t?Symbol(t):Symbol():e}var G,M=C("jas",void 0,!0),R=C(void 0,"1oa"),D=C(void 0,Symbol()),$=C(void 0,"0ubs"),z=C(void 0,"0ubsb"),W=C(void 0,"0actk"),H=C("m_m","R",!0),q={M:{value:0,configurable:!0,writable:!0,enumerable:!1}},K=Object.defineProperties,Y=F?M:"M",Q=[];function X(t,e){F||Y in t||K(t,q),t[Y]|=e}function J(t,e){F||Y in t||K(t,q),t[Y]=e}J(Q,7),G=Object.freeze(Q);var Z={};function tt(t,e){return void 0===e?t.g!==et&&!!(2&t.l[Y]):!!(2&e)&&t.g!==et}var et={};function rt(t,e){if(null!=t)if("string"==typeof t)t=t?new N(t,T):U();else if(t.constructor!==N)if(w&&null!=t&&t instanceof Uint8Array)t=t.length?new N(new Uint8Array(t),T):U();else{if(!e)throw Error();t=void 0}return t}var nt=Object.freeze({});function it(t,e,r){var n,i=128&e?0:-1,o=t.length;(n=!!o)&&(n=null!=(n=t[o-1])&&"object"==typeof n&&n.constructor===Object);var s=o+(n?-1:0);for(e=128&e?1:0;e<s;e++)r(e-i,t[e]);if(n){t=t[o-1];for(let e in t)!isNaN(e)&&r(+e,t[e])}}var ot={};function st(t){return 128&t?ot:void 0}function at(t){return t.O=!0,t}var ut=at(t=>"number"==typeof t),lt=at(t=>"string"==typeof t),ct=at(t=>"boolean"==typeof t),ht="function"==typeof t.BigInt&&"bigint"==typeof t.BigInt(0);function ft(t){var e=t;if(lt(e)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(e))throw Error(String(e))}else if(ut(e)&&!Number.isSafeInteger(e))throw Error(String(e));return ht?BigInt(t):t=ct(t)?t?"1":"0":lt(t)?t.trim()||"0":String(t)}var dt=at(t=>ht?t>=pt&&t<=mt:"-"===t[0]?yt(t,gt):yt(t,vt)),gt=Number.MIN_SAFE_INTEGER.toString(),pt=ht?BigInt(Number.MIN_SAFE_INTEGER):void 0,vt=Number.MAX_SAFE_INTEGER.toString(),mt=ht?BigInt(Number.MAX_SAFE_INTEGER):void 0;function yt(t,e){if(t.length>e.length)return!1;if(t.length<e.length||t===e)return!0;for(let r=0;r<t.length;r++){let n=t[r],i=e[r];if(n>i)return!1;if(n<i)return!0}}var bt,wt="function"==typeof Uint8Array.prototype.slice,_t=0,St=0;function Et(t){var e=t>>>0;_t=e,St=(t-e)/4294967296>>>0}function At(t){if(t<0){Et(-t);let[e,r]=Lt(_t,St);_t=e>>>0,St=r>>>0}else Et(t)}function It(t){var e=bt||=new DataView(new ArrayBuffer(8));e.setFloat32(0,+t,!0),St=0,_t=e.getUint32(0,!0)}function Tt(t,e){var r=4294967296*e+(t>>>0);return Number.isSafeInteger(r)?r:xt(t,e)}function Ut(t,e){return ft(j()?BigInt.asUintN(64,(BigInt(e>>>0)<<BigInt(32))+BigInt(t>>>0)):xt(t,e))}function Bt(t,e){return j()?ft(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(e))<<BigInt(32))+BigInt.asUintN(32,BigInt(t)))):ft(Ot(t,e))}function xt(t,e){if(t>>>=0,(e>>>=0)<=2097151)var r=""+(4294967296*e+t);else j()?r=""+(BigInt(e)<<BigInt(32)|BigInt(t)):(t=(16777215&t)+6777216*(r=16777215&(t>>>24|e<<8))+6710656*(e=e>>16&65535),r+=8147497*e,e*=2,t>=1e7&&(r+=t/1e7>>>0,t%=1e7),r>=1e7&&(e+=r/1e7>>>0,r%=1e7),r=e+Nt(r)+Nt(t));return r}function Nt(t){return t=String(t),"0000000".slice(t.length)+t}function Ot(t,e){if(2147483648&e)if(j())t=""+(BigInt(0|e)<<BigInt(32)|BigInt(t>>>0));else{let[r,n]=Lt(t,e);t="-"+xt(r,n)}else t=xt(t,e);return t}function Pt(t){if(t.length<16)At(Number(t));else if(j())t=BigInt(t),_t=Number(t&BigInt(4294967295))>>>0,St=Number(t>>BigInt(32)&BigInt(4294967295));else{let e=+("-"===t[0]);St=_t=0;let r=t.length;for(let n=e,i=(r-e)%6+e;i<=r;n=i,i+=6){let e=Number(t.slice(n,i));St*=1e6,(_t=1e6*_t+e)>=4294967296&&(St+=Math.trunc(_t/4294967296),St>>>=0,_t>>>=0)}if(e){let[t,e]=Lt(_t,St);_t=t,St=e}}}function Lt(t,e){return e=~e,t?t=1+~t:e+=1,[t,e]}function kt(t){return Array.prototype.slice.call(t)}var Vt="function"==typeof BigInt?BigInt.asIntN:void 0,jt="function"==typeof BigInt?BigInt.asUintN:void 0,Ft=Number.isSafeInteger,Ct=Number.isFinite,Gt=Math.trunc;function Mt(t){return null==t||"number"==typeof t?t:"NaN"===t||"Infinity"===t||"-Infinity"===t?Number(t):void 0}function Rt(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}var Dt=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function $t(t){switch(typeof t){case"bigint":return!0;case"number":return Ct(t);case"string":return Dt.test(t);default:return!1}}function zt(t){if(null==t)return t;if("string"==typeof t&&t)t=+t;else if("number"!=typeof t)return;return Ct(t)?0|t:void 0}function Wt(t){var e=t.length;return("-"===t[0]?e<20||20===e&&t<="-9223372036854775808":e<19||19===e&&t<="9223372036854775807")?t:(Pt(t),Ot(_t,St))}function Ht(t){if(t=Gt(t),!Ft(t)){At(t);var e=_t,r=St;(t=2147483648&r)&&(r=~r>>>0,0==(e=1+~e>>>0)&&(r=r+1>>>0)),t="number"==typeof(e=Tt(e,r))?t?-e:e:t?"-"+e:e}return t}function qt(t){var e=Gt(Number(t));return Ft(e)?String(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),Wt(t))}function Kt(t){var e=typeof t;return null==t?t:"bigint"===e?ft(Vt(64,t)):$t(t)?("string"===e?(e=Gt(Number(t)),Ft(e)?t=ft(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),t=j()?ft(Vt(64,BigInt(t))):ft(Wt(t)))):Ft(t)?t=ft(Ht(t)):(t=Gt(t),Ft(t)?t=String(t):(At(t),t=Ot(_t,St)),t=ft(t)),t):void 0}function Yt(t){if("string"!=typeof t)throw Error();return t}function Qt(t){if(null!=t&&"string"!=typeof t)throw Error();return t}function Xt(t){return null==t||"string"==typeof t?t:void 0}function Jt(t,e,r){if(null!=t&&t[H]===Z)return t;if(Array.isArray(t)){var n=0|t[Y];return(r=n|32&r|2&r)!==n&&J(t,r),new e(t)}}function Zt(t){return t}function te(t){return D?t[D]:void 0}function ee(t,e){for(let r in t)!isNaN(r)&&e(t,+r,t[r])}var re,ne,ie,oe=class{};function se(t,e){e<100||V($,1)}function ae(t,e,r,n){var i=void 0!==n;n=!!n;var o,s=D;!i&&F&&s&&(o=t[s])&&ee(o,se),s=[];var a=t.length;o=4294967295;var u=!1,l=!!(64&e),c=l?128&e?0:-1:void 0;if(!(1&e)){var h=a&&t[a-1];null!=h&&"object"==typeof h&&h.constructor===Object?o=--a:h=void 0,!l||128&e||i||(u=!0,o=(re??Zt)(o-c,c,t,h,void 0)+c)}e=void 0;for(var f=0;f<a;f++){let i=t[f];if(null!=i&&null!=(i=r(i,n)))if(l&&f>=o){let t=f-c;(e??={})[t]=i}else s[f]=i}if(h)for(let t in h){if(null==(a=h[t])||null==(a=r(a,n)))continue;let i;f=+t,l&&!Number.isNaN(f)&&(i=f+c)<o?s[i]=a:(e??={})[t]=a}return e&&(u?s.push(e):s[o]=e),i&&D&&(t=te(t))&&t instanceof oe&&(s[D]=function(t){var e=new oe;return ee(t,(t,r,n)=>{e[r]=kt(n)}),e.g=t.g,e}(t)),s}function ue(t){switch(typeof t){case"number":return Number.isFinite(t)?t:""+t;case"bigint":return dt(t)?Number(t):""+t;case"boolean":return t?1:0;case"object":if(Array.isArray(t)){var e=0|t[Y];return 0===t.length&&1&e?void 0:ae(t,e,ue)}if(null!=t&&t[H]===Z)return le(t);if(t instanceof N){if(null==(e=t.g))t="";else if("string"==typeof e)t=e;else{if(_){for(var r="",n=0,i=e.length-10240;n<i;)r+=String.fromCharCode.apply(null,e.subarray(n,n+=10240));r+=String.fromCharCode.apply(null,n?e.subarray(n):e),e=btoa(r)}else{void 0===r&&(r=0),b(),r=v[r],n=Array(Math.floor(e.length/3)),i=r[64]||"";let t=0,l=0;for(;t<e.length-2;t+=3){var o=e[t],s=e[t+1],a=e[t+2],u=r[o>>2];o=r[(3&o)<<4|s>>4],s=r[(15&s)<<2|a>>6],a=r[63&a],n[l++]=u+o+s+a}switch(u=0,a=i,e.length-t){case 2:a=r[(15&(u=e[t+1]))<<2]||i;case 1:e=e[t],n[l]=r[e>>2]+r[(3&e)<<4|u>>4]+a+i}e=n.join("")}t=t.g=e}return t}return}return t}function le(t){return ae(t=t.l,0|t[Y],ue)}function ce(t,e){return he(t,e[0],e[1])}function he(t,e,r,n=0){if(null==t){var i=32;r?(t=[r],i|=128):t=[],e&&(i=-16760833&i|(1023&e)<<14)}else{if(!Array.isArray(t))throw Error("narr");if(i=0|t[Y],h&&1&i)throw Error("rfarr");if(2048&i&&!(2&i)&&function(){if(h)throw Error("carr");V(W,5)}(),256&i)throw Error("farr");if(64&i)return(i|n)!==i&&J(t,i|n),t;if(r&&(i|=128,r!==t[0]))throw Error("mid");t:{i|=64;var o=(r=t).length;if(o){var s=o-1;let t=r[s];if(null!=t&&"object"==typeof t&&t.constructor===Object){if((s-=e=128&i?0:-1)>=1024)throw Error("pvtlmt");for(var a in t)(o=+a)<s&&(r[o+e]=t[a],delete t[a]);i=-16760833&i|(1023&s)<<14;break t}}if(e){if((a=Math.max(e,o-(128&i?0:-1)))>1024)throw Error("spvt");i=-16760833&i|(1023&a)<<14}}}return J(t,64|i|n),t}function fe(t,e){if("object"!=typeof t)return t;if(Array.isArray(t)){var r=0|t[Y];return 0===t.length&&1&r?t=void 0:2&r||(!e||4096&r||16&r?t=pe(t,r,!1,e&&!(16&r)):(X(t,34),4&r&&Object.freeze(t))),t}return null!=t&&t[H]===Z?tt(t,r=0|(e=t.l)[Y])?t:we(t,e,r)?de(t,e):pe(e,r):t instanceof N?t:void 0}function de(t,e,r){return t=new t.constructor(e),r&&(t.g=et),t.m=et,t}function ge(t){var e=t.l,r=0|e[Y];return we(t,e,r)?de(t,e,!0):new t.constructor(pe(e,r,!1))}function pe(t,e,r,n){return n??=!!(34&e),t=ae(t,e,fe,n),n=32,r&&(n|=2),J(t,e=16769217&e|n),t}function ve(t){var e=t.l,r=0|e[Y];return tt(t,r)?we(t,e,r)?de(t,e,!0):new t.constructor(pe(e,r,!1)):t}function me(t){if(t.g!==et)return!1;var e=t.l;return X(e=pe(e,0|e[Y]),2048),t.l=e,t.g=void 0,t.m=void 0,!0}function ye(t){if(!me(t)&&tt(t,0|t.l[Y]))throw Error()}function be(t,e){void 0===e&&(e=0|t[Y]),32&e&&!(4096&e)&&J(t,4096|e)}function we(t,e,r){return!!(2&r)||!(!(32&r)||4096&r)&&(J(e,2|r),t.g=et,!0)}var _e=ft(0);function Se(t,e,r,n){if(null!==(t=Ee(t.l,e,r,n)))return t}function Ee(t,e,r,n){if(-1===e)return null;var i=e+(r?0:-1),o=t.length-1;if(!(o<1+(r?0:-1))){if(i>=o){var s=t[o];if(null!=s&&"object"==typeof s&&s.constructor===Object){r=s[e];var a=!0}else{if(i!==o)return;r=s}}else r=t[i];if(n&&null!=r){if(null==(n=n(r)))return n;if(!Object.is(n,r))return a?s[e]=n:t[i]=n,n}return r}}function Ae(t,e,r,n){ye(t),Ie(t=t.l,0|t[Y],e,r,n)}function Ie(t,e,r,n,i){var o=r+(i?0:-1),s=t.length-1;if(s>=1+(i?0:-1)&&o>=s){let i=t[s];if(null!=i&&"object"==typeof i&&i.constructor===Object)return i[r]=n,e}return o<=s?(t[o]=n,e):(void 0!==n&&(r>=(s=(e??=0|t[Y])>>14&1023||536870912)?null!=n&&(t[s+(i?0:-1)]={[r]:n}):t[o]=n),e)}function Te(t,e,r,n){var i=t.l;return void 0!==Re(i,0|i[Y],e,t=je(t,n)===r?r:-1)}function Ue(t,e,r,n,i){var o=t.l,s=0|o[Y];n=tt(t,s)?1:n,i=!!i||3===n,2===n&&me(t)&&(s=0|(o=t.l)[Y]);var a=(t=xe(o,e))===G?7:0|t[Y],u=Ne(a,s),l=!(4&u);if(l){4&u&&(t=kt(t),a=0,u=Ke(u,s),s=Ie(o,s,e,t));let n=0,i=0;for(;n<t.length;n++){let e=r(t[n]);null!=e&&(t[i++]=e)}i<n&&(t.length=i),r=-513&u|4,u=r&=-1025,u&=-4097}return u!==a&&(J(t,u),2&u&&Object.freeze(t)),Be(t,u,o,s,e,n,l,i)}function Be(t,e,r,n,i,o,s,a){var u=e;return 1===o||4===o&&(2&e||!(16&e)&&32&n)?Oe(e)||((e|=!t.length||s&&!(4096&e)||32&n&&!(4096&e||16&e)?2:256)!==u&&J(t,e),Object.freeze(t)):(2===o&&Oe(e)&&(t=kt(t),u=0,e=Ke(e,n),n=Ie(r,n,i,t)),Oe(e)||(a||(e|=16),e!==u&&J(t,e))),2&e||!(4096&e||16&e)||be(r,n),t}function xe(t,e,r){return t=Ee(t,e,r),Array.isArray(t)?t:G}function Ne(t,e){return 2&e&&(t|=2),1|t}function Oe(t){return!!(2&t)&&!!(4&t)||!!(256&t)}function Pe(t){return rt(t,!0)}function Le(t,e,r){ye(t);var n=0|(t=t.l)[Y];if(null==r)Ie(t,n,e);else{var i=r===G?7:0|r[Y],o=i,s=Oe(i),a=s||Object.isFrozen(r);for(s||(i=0),a||(r=kt(r),o=0,i=Ke(i,n),a=!1),i|=5,i|=(4&i?512&i?512:1024&i?1024:0:void 0)??1024,s=0;s<r.length;s++){let t=r[s],e=Yt(t);Object.is(t,e)||(a&&(r=kt(r),o=0,i=Ke(i,n),a=!1),r[s]=e)}i!==o&&(a&&(r=kt(r),i=Ke(i,n)),J(r,i)),Ie(t,n,e,r)}}function ke(t,e){ye(t),Ie(t=t.l,0|t[Y],2,""===e?void 0:e)}function Ve(t,e,r){if(2&e)throw Error();var n=st(e),i=xe(t,r,n),o=i===G?7:0|i[Y],s=Ne(o,e);return(2&s||Oe(s)||16&s)&&(s===o||Oe(s)||J(i,s),i=kt(i),o=0,s=Ke(s,e),Ie(t,e,r,i,n)),(s&=-13)!==o&&J(i,s),i}function je(t,e){return Ge(Fe(t=t.l),t,void 0,e)}function Fe(t){if(F)return t[R]??(t[R]=new Map);if(R in t)return t[R];var e=new Map;return Object.defineProperty(t,R,{value:e}),e}function Ce(t,e,r,n,i){var o=Fe(t),s=Ge(o,t,e,r,i);return s!==n&&(s&&(e=Ie(t,e,s,void 0,i)),o.set(r,n)),e}function Ge(t,e,r,n,i){var o=t.get(n);if(null!=o)return o;o=0;for(let t=0;t<n.length;t++){let s=n[t];null!=Ee(e,s,i)&&(0!==o&&(r=Ie(e,r,o,void 0,i)),o=s)}return t.set(n,o),o}function Me(t,e,r){var n=0|t[Y],i=st(n),o=Ee(t,r,i);if(null!=o&&o[H]===Z){if(!tt(o))return me(o),o.l;var s=o.l}else Array.isArray(o)&&(s=o);if(s){let t=0|s[Y];2&t&&(s=pe(s,t))}return(s=ce(s,e))!==o&&Ie(t,n,r,s,i),s}function Re(t,e,r,n){var i=!1;if(null!=(n=Ee(t,n,void 0,t=>{var n=Jt(t,r,e);return i=n!==t&&null!=n,n})))return i&&!tt(n)&&be(t,e),n}function De(t,e,r){var n=t.l,i=0|n[Y];if(null==(e=Re(n,i,e,r)))return e;if(!tt(t,i=0|n[Y])){let o=ve(e);o!==e&&(me(t)&&(i=0|(n=t.l)[Y]),be(n,i=Ie(n,i,r,e=o)))}return e}function $e(t,e,r,n,i,o,s){var a=tt(t,r);i=a?1:i,o=!!o||3===i,a=s&&!a,(2===i||a)&&me(t)&&(r=0|(e=t.l)[Y]);var u=(t=xe(e,1))===G?7:0|t[Y],l=Ne(u,r);if(s=!(4&l)){var c=t,h=r;let e=!!(2&l);e&&(h|=2);let i=!e,o=!0,s=0,a=0;for(;s<c.length;s++){let t=Jt(c[s],n,h);if(t instanceof n){if(!e){let e=tt(t);i&&=!e,o&&=e}c[a++]=t}}a<s&&(c.length=a),l|=4,l=o?-4097&l:4096|l,l=i?8|l:-9&l}if(l!==u&&(J(t,l),2&l&&Object.freeze(t)),a&&!(8&l||!t.length&&(1===i||4===i&&(2&l||!(16&l)&&32&r)))){for(Oe(l)&&(t=kt(t),l=Ke(l,r),r=Ie(e,r,1,t)),n=t,a=l,u=0;u<n.length;u++)(c=n[u])!==(l=ve(c))&&(n[u]=l);a|=8,J(t,l=a=n.length?4096|a:-4097&a)}return Be(t,l,e,r,1,i,s,o)}function ze(t,e){var r=t.l;return $e(t,r,0|r[Y],e,void 0===nt?2:4,!1,!0)}function We(t){return null==t&&(t=void 0),t}function He(t,e,r,n,i){return Ae(t,r,n=We(n),i),n&&!tt(n)&&be(t.l),t}function qe(t,e,r){var n=Fi;t:{var i=r=We(r);ye(t);let o=t.l,s=0|o[Y];if(null==i){let t=Fe(o);if(Ge(t,o,s,n)!==e)break t;t.set(n,0)}else s=Ce(o,s,n,e);Ie(o,s,e,i)}r&&!tt(r)&&be(t.l)}function Ke(t,e){return-273&(2&e?2|t:-3&t)}function Ye(t,e){var r=mi;ye(t);var n=t.l;t=$e(t,n,0|n[Y],r,2,!0),e=null!=e?e:new r,t.push(e);var i=r=t===G?7:0|t[Y];(e=tt(e))?(r&=-9,1===t.length&&(r&=-4097)):r|=4096,r!==i&&J(t,r),e||be(n)}function Qe(t,e,r){return De(t,e,r=je(t,Oi)===r?r:-1)}function Xe(t,e,r){ye(t),Ue(t,e,Xt,2,!0).push(Yt(r))}var Je=class{constructor(t,e,r){if(this.buffer=t,r&&!e)throw Error();this.g=e}};function Ze(t,e){if("string"==typeof t)return new Je(I(t),e);if(Array.isArray(t))return new Je(new Uint8Array(t),e);if(t.constructor===Uint8Array)return new Je(t,!1);if(t.constructor===ArrayBuffer)return t=new Uint8Array(t),new Je(t,!1);if(t.constructor===N)return e=B(t)||new Uint8Array(0),new Je(e,!0,t);if(t instanceof Uint8Array)return t=t.constructor===Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Je(t,!1);throw Error()}function tr(t,e){var r=0,n=0,i=0,o=t.i,s=t.g;do{var a=o[s++];r|=(127&a)<<i,i+=7}while(i<32&&128&a);if(i>32)for(n|=(127&a)>>4,i=3;i<32&&128&a;i+=7)n|=(127&(a=o[s++]))<<i;if(or(t,s),!(128&a))return e(r>>>0,n>>>0);throw Error()}function er(t){for(var e=0,r=t.g,n=r+10,i=t.i;r<n;){let n=i[r++];if(e|=n,!(128&n))return or(t,r),!!(127&e)}throw Error()}function rr(t){var e=t.i,r=t.g,n=e[r++],i=127&n;if(128&n&&(i|=(127&(n=e[r++]))<<7,128&n&&(i|=(127&(n=e[r++]))<<14,128&n&&(i|=(127&(n=e[r++]))<<21,128&n&&(i|=(n=e[r++])<<28,128&n&&128&e[r++]&&128&e[r++]&&128&e[r++]&&128&e[r++]&&128&e[r++])))))throw Error();return or(t,r),i}function nr(t){var e=t.i,r=t.g,n=e[r],i=e[r+1],o=e[r+2];return e=e[r+3],or(t,t.g+4),t=2*((i=(n|i<<8|o<<16|e<<24)>>>0)>>31)+1,n=i>>>23&255,i&=8388607,255==n?i?NaN:t*(1/0):0==n?1401298464324817e-60*t*i:t*Math.pow(2,n-150)*(i+8388608)}function ir(t){return rr(t)}function or(t,e){if(t.g=e,e>t.j)throw Error()}function sr(t,e){if(e<0)throw Error();var r=t.g;if((e=r+e)>t.j)throw Error();return t.g=e,r}function ar(t,e){if(0==e)return U();var r=sr(t,e);return t.B&&t.v?r=t.i.subarray(r,r+e):(t=t.i,r=r===(e=r+e)?new Uint8Array(0):wt?t.slice(r,e):new Uint8Array(t.subarray(r,e))),0==r.length?U():new N(r,T)}var ur=class{constructor(t,e,r,n){this.i=null,this.v=!1,this.g=this.j=this.m=0,this.init(t,e,r,n)}init(t,e,r,{B:n=!1,D:i=!1}={}){this.B=n,this.D=i,t&&(t=Ze(t,this.D),this.i=t.buffer,this.v=t.g,this.m=e||0,this.j=void 0!==r?this.m+r:this.i.length,this.g=this.m)}clear(){this.i=null,this.v=!1,this.g=this.j=this.m=0,this.B=!1}},lr=[];function cr(t,e,r,n){if(br.length){let i=br.pop();return i.o(n),i.g.init(t,e,r,n),i}return new yr(t,e,r,n)}function hr(t){t.g.clear(),t.j=-1,t.i=-1,br.length<100&&br.push(t)}function fr(t){var e=t.g;if(e.g==e.j)return!1;t.m=t.g.g;var r=rr(t.g)>>>0;if(e=r>>>3,!((r&=7)>=0&&r<=5))throw Error();if(e<1)throw Error();return t.j=e,t.i=r,!0}function dr(t){switch(t.i){case 0:0!=t.i?dr(t):er(t.g);break;case 1:or(t=t.g,t.g+8);break;case 2:if(2!=t.i)dr(t);else{var e=rr(t.g)>>>0;or(t=t.g,t.g+e)}break;case 5:or(t=t.g,t.g+4);break;case 3:for(e=t.j;;){if(!fr(t))throw Error();if(4==t.i){if(t.j!=e)throw Error();break}dr(t)}break;default:throw Error()}}function gr(t,e,r){var n=t.g.j,i=rr(t.g)>>>0,o=(i=t.g.g+i)-n;if(o<=0&&(t.g.j=i,r(e,t,void 0,void 0,void 0),o=i-t.g.g),o)throw Error();t.g.g=i,t.g.j=n}function pr(t){var e=rr(t.g)>>>0,o=sr(t=t.g,e);if(t=t.i,a){var u,l=t;(u=i)||(u=i=new TextDecoder("utf-8",{fatal:!0})),e=o+e,l=0===o&&e===l.length?l:l.subarray(o,e);try{var c=u.decode(l)}catch(t){if(void 0===s){try{u.decode(new Uint8Array([128]))}catch(t){}try{u.decode(new Uint8Array([97])),s=!0}catch(t){s=!1}}throw!s&&(i=void 0),t}}else{e=(c=o)+e,o=[];let i,s=null;for(;c<e;){var h=t[c++];h<128?o.push(h):h<224?c>=e?r():(i=t[c++],h<194||128!=(192&i)?(c--,r()):o.push((31&h)<<6|63&i)):h<240?c>=e-1?r():(i=t[c++],128!=(192&i)||224===h&&i<160||237===h&&i>=160||128!=(192&(u=t[c++]))?(c--,r()):o.push((15&h)<<12|(63&i)<<6|63&u)):h<=244?c>=e-2?r():(i=t[c++],128!=(192&i)||i-144+(h<<28)>>30||128!=(192&(u=t[c++]))||128!=(192&(l=t[c++]))?(c--,r()):(h=(7&h)<<18|(63&i)<<12|(63&u)<<6|63&l,h-=65536,o.push(55296+(h>>10&1023),56320+(1023&h)))):r(),o.length>=8192&&(s=n(s,o),o.length=0)}c=n(s,o)}return c}function vr(t){var e=rr(t.g)>>>0;return ar(t.g,e)}function mr(t,e,r){var n=rr(t.g)>>>0;for(n=t.g.g+n;t.g.g<n;)r.push(e(t.g))}var yr=class{constructor(t,e,r,n){if(lr.length){let i=lr.pop();i.init(t,e,r,n),t=i}else t=new ur(t,e,r,n);this.g=t,this.m=this.g.g,this.i=this.j=-1,this.o(n)}o({F:t=!1}={}){this.F=t}},br=[];function wr(t){return t?/^\d+$/.test(t)?(Pt(t),new Sr(_t,St)):null:_r||=new Sr(0,0)}var _r,Sr=class{constructor(t,e){this.i=t>>>0,this.g=e>>>0}};function Er(t){return t?/^-?\d+$/.test(t)?(Pt(t),new Ir(_t,St)):null:Ar||=new Ir(0,0)}var Ar,Ir=class{constructor(t,e){this.i=t>>>0,this.g=e>>>0}};function Tr(t,e,r){for(;r>0||e>127;)t.g.push(127&e|128),e=(e>>>7|r<<25)>>>0,r>>>=7;t.g.push(e)}function Ur(t,e){for(;e>127;)t.g.push(127&e|128),e>>>=7;t.g.push(e)}function Br(t,e){if(e>=0)Ur(t,e);else{for(let r=0;r<9;r++)t.g.push(127&e|128),e>>=7;t.g.push(1)}}function xr(t){var e=_t;t.g.push(e>>>0&255),t.g.push(e>>>8&255),t.g.push(e>>>16&255),t.g.push(e>>>24&255)}var Nr=class{constructor(){this.g=[]}length(){return this.g.length}end(){var t=this.g;return this.g=[],t}};function Or(t,e){0!==e.length&&(t.j.push(e),t.i+=e.length)}function Pr(t,e,r){Ur(t.g,8*e+r)}function Lr(t,e){return Pr(t,e,2),e=t.g.end(),Or(t,e),e.push(t.i),e}function kr(t,e){var r=e.pop();for(r=t.i+t.g.length()-r;r>127;)e.push(127&r|128),r>>>=7,t.i++;e.push(r),t.i++}function Vr(t,e,r){Pr(t,e,2),Ur(t.g,r.length),Or(t,t.g.end()),Or(t,r)}var jr=class{constructor(){this.j=[],this.i=0,this.g=new Nr}};function Fr(){var t=class{constructor(){throw Error()}};return Object.setPrototypeOf(t,t.prototype),t}var Cr=Fr(),Gr=Fr(),Mr=Fr(),Rr=Fr(),Dr=Fr(),$r=Fr(),zr=Fr(),Wr=Fr(),Hr=Fr(),qr=Fr();function Kr(t,e,r){var n=t.l;D&&D in n&&(n=n[D])&&delete n[e.g],e.i?e.m(t,e.i,e.g,r,e.j):e.m(t,e.g,r,e.j)}var Yr=class{constructor(t,e){this.l=he(t,e,void 0,2048)}toJSON(){return le(this)}};Yr.prototype[H]=Z,Yr.prototype.toString=function(){return this.l.toString()};var Qr=class{constructor(t,e,r){this.g=t,this.i=e,t=Cr,this.j=!!t&&r===t||!1}};function Xr(t,e){return new Qr(t,e,Cr)}function Jr(t,e,r,n,i){null!=(e=hn(e,n))&&(r=Lr(t,r),i(e,t),kr(t,r))}var Zr,tn,en=Xr(function(t,e,r,n,i){return 2===t.i&&(gr(t,Me(e,n,r),i),!0)},Jr),rn=Xr(function(t,e,r,n,i){return 2===t.i&&(gr(t,Me(e,n,r),i),!0)},Jr),nn=Symbol(),on=Symbol(),sn=Symbol(),an=Symbol(),un=Symbol();function ln(t,e,r,n){var i=n[t];if(i)return i;(i={}).I=n,i.A=function(t){switch(typeof t){case"boolean":return ne||=[0,void 0,!0];case"number":return t>0?void 0:0===t?ie||=[0,void 0]:[-t,void 0];case"string":return[0,t];case"object":return t}}(n[0]);var o=n[1],s=1;o&&o.constructor===Object&&(i.C=o,"function"==typeof(o=n[++s])&&(i.G=!0,Zr??=o,tn??=n[s+1],o=n[s+=2]));for(var a={};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=n[++s]}for(u=1;void 0!==o;){let t;"number"==typeof o&&(u+=o,o=n[++s]);var l=void 0;if(o instanceof Qr?t=o:(t=en,s--),t?.j){o=n[++s],l=n;var c=s;"function"==typeof o&&(o=o(),l[c]=o),l=o}for(c=u+1,"number"==typeof(o=n[++s])&&o<0&&(c-=o,o=n[++s]);u<c;u++){let n=a[u];l?r(i,u,t,l,n):e(i,u,t,n)}}return n[t]=i}function cn(t){return Array.isArray(t)?t[0]instanceof Qr?t:[rn,t]:[t,void 0]}function hn(t,e){return t instanceof Yr?t.l:Array.isArray(t)?ce(t,e):void 0}function fn(t,e,r,n){var i=r.g;t[e]=n?(t,e,r)=>i(t,e,r,n):i}function dn(t,e,r,n,i){var o,s,a=r.g;t[e]=(t,e,r)=>a(t,e,r,s||=ln(on,fn,dn,n).A,o||=gn(n),i)}function gn(t){var e=t[sn];if(null!=e)return e;var r=ln(on,fn,dn,t);return e=r.G?(t,e)=>Zr(t,e,r):(t,e)=>{for(;fr(e)&&4!=e.i;){var n=e.j,i=r[n];if(null==i){var o=r.C;o&&(o=o[n])&&(null!=(o=vn(o))&&(i=r[n]=o))}if(null==i||!i(e,t,n)){if(i=(o=e).m,dr(o),o.F)var s=void 0;else s=o.g.g-i,o.g.g=i,s=ar(o.g,s);i=void 0,o=t,s&&((i=o[D]??(o[D]=new oe))[n]??(i[n]=[])).push(s)}}return(t=te(t))&&(t.g=r.I[un]),!0},t[sn]=e,t[un]=pn.bind(t),e}function pn(t,e,r,n){var i=this[on],o=this[sn],s=ce(void 0,i.A),a=te(t);if(a){var u=!1,l=i.C;if(l){if(i=(e,r,i)=>{if(0!==i.length)if(l[r])for(let t of i){e=cr(t);try{u=!0,o(s,e)}finally{hr(e)}}else n?.(t,r,i)},null==e)ee(a,i);else if(null!=a){let t=a[e];t&&i(a,e,t)}if(u){let n=0|t[Y];if(2&n&&2048&n&&!r?.T)throw Error();let i=st(n),o=(e,o)=>{if(null!=Ee(t,e,i)){if(1===r?.S)return;throw Error()}null!=o&&(n=Ie(t,n,e,o,i)),delete a[e]};null==e?it(s,0|s[Y],(t,e)=>{o(t,e)}):o(e,Ee(s,e,i))}}}}function vn(t){var e=(t=cn(t))[0].g;if(t=t[1]){let r=gn(t),n=ln(on,fn,dn,t).A;return(t,i,o)=>e(t,i,o,n,r)}return e}function mn(t,e,r){t[e]=r.i}function yn(t,e,r,n){var i,o,s=r.i;t[e]=(t,e,r)=>s(t,e,r,o||=ln(nn,mn,yn,n).A,i||=bn(n))}function bn(t){var e=t[an];if(!e){let r=ln(nn,mn,yn,t);e=(t,e)=>wn(t,e,r),t[an]=e}return e}function wn(t,e,r){it(t,0|t[Y],(t,n)=>{if(null!=n){var i=function(t,e){var r=t[e];if(r)return r;if((r=t.C)&&(r=r[e])){var n=(r=cn(r))[0].i;if(r=r[1]){let e=bn(r),i=ln(nn,mn,yn,r).A;r=t.G?tn(i,e):(t,r,o)=>n(t,r,o,i,e)}else r=n;return t[e]=r}}(r,t);i?i(e,n,t):t<500||V(z,3)}}),(t=te(t))&&ee(t,(t,r,n)=>{for(Or(e,e.g.end()),t=0;t<n.length;t++)Or(e,B(n[t])||new Uint8Array(0))})}var _n=ft(0);function Sn(t,e){if(Array.isArray(e)){var r=0|e[Y];if(4&r)return e;for(var n=0,i=0;n<e.length;n++){let r=t(e[n]);null!=r&&(e[i++]=r)}return i<n&&(e.length=i),(t=-1537&r|5)!==r&&J(e,t),2&t&&Object.freeze(e),e}}function En(t,e,r){return new Qr(t,e,r)}function An(t,e,r){return new Qr(t,e,r)}function In(t,e,r){Ie(t,0|t[Y],e,r,st(0|t[Y]))}function Tn(t,e,r){if(e=function(t){if(null==t)return t;var e=typeof t;if("bigint"===e)return String(Vt(64,t));if($t(t)){if("string"===e)return qt(t);if("number"===e)return Ht(t)}}(e),null!=e){if("string"==typeof e)Er(e);if(null!=e)switch(Pr(t,r,0),typeof e){case"number":t=t.g,At(e),Tr(t,_t,St);break;case"bigint":r=BigInt.asUintN(64,e),r=new Ir(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),Tr(t.g,r.i,r.g);break;default:r=Er(e),Tr(t.g,r.i,r.g)}}}function Un(t,e,r){null!=(e=zt(e))&&null!=e&&(Pr(t,r,0),Br(t.g,e))}function Bn(t,e,r){null!=(e=null==e||"boolean"==typeof e?e:"number"==typeof e?!!e:void 0)&&(Pr(t,r,0),t.g.g.push(e?1:0))}function xn(t,e,r){null!=(e=Xt(e))&&Vr(t,r,l(e))}function Nn(t,e,r,n,i){null!=(e=hn(e,n))&&(r=Lr(t,r),i(e,t),kr(t,r))}function On(t,e,r){null!=(e=null==e||"string"==typeof e||e instanceof N?e:void 0)&&Vr(t,r,Ze(e,!0).buffer)}function Pn(t,e,r){e=function(t){if(null==t)return t;if("string"==typeof t&&t)t=+t;else if("number"!=typeof t)return;return Ct(t)?t>>>0:void 0}(e),null!=e&&null!=e&&(Pr(t,r,0),Ur(t.g,e))}var Ln=En(function(t,e,r){return 5===t.i&&(In(e,r,nr(t.g)),!0)},function(t,e,r){null!=(e=Mt(e))&&(Pr(t,r,5),t=t.g,It(e),xr(t))},Wr),kn=An(function(t,e,r){return(5===t.i||2===t.i)&&(e=Ve(e,0|e[Y],r),2==t.i?mr(t,nr,e):e.push(nr(t.g)),!0)},function(t,e,r){if(null!=(e=Sn(Mt,e))&&e.length){Pr(t,r,2),Ur(t.g,4*e.length);for(let n=0;n<e.length;n++)r=t.g,It(e[n]),xr(r)}},Wr),Vn=En(function(t,e,r){return 0!==t.i?t=!1:(In(e,r,tr(t.g,Bt)),t=!0),t},Tn,$r),jn=En(function(t,e,r){return 0!==t.i?e=!1:(In(e,r,(t=tr(t.g,Bt))===_n?void 0:t),e=!0),e},Tn,$r),Fn=En(function(t,e,r){return 0!==t.i?t=!1:(In(e,r,tr(t.g,Ut)),t=!0),t},function(t,e,r){if(e=function(t){if(null==t)return t;var e=typeof t;if("bigint"===e)return String(jt(64,t));if($t(t)){if("string"===e)return e=Gt(Number(t)),Ft(e)&&e>=0?t=String(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),(e="-"!==t[0]&&((e=t.length)<20||20===e&&t<="18446744073709551615"))||(Pt(t),t=xt(_t,St))),t;if("number"===e)return(t=Gt(t))>=0&&Ft(t)||(At(t),t=Tt(_t,St)),t}}(e),null!=e){if("string"==typeof e)wr(e);if(null!=e)switch(Pr(t,r,0),typeof e){case"number":t=t.g,At(e),Tr(t,_t,St);break;case"bigint":r=BigInt.asUintN(64,e),r=new Sr(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),Tr(t.g,r.i,r.g);break;default:r=wr(e),Tr(t.g,r.i,r.g)}}},zr),Cn=En(function(t,e,r){return 0===t.i&&(In(e,r,rr(t.g)),!0)},Un,Rr),Gn=An(function(t,e,r){return(0===t.i||2===t.i)&&(e=Ve(e,0|e[Y],r),2==t.i?mr(t,rr,e):e.push(rr(t.g)),!0)},function(t,e,r){if(null!=(e=Sn(zt,e))&&e.length){r=Lr(t,r);for(let r=0;r<e.length;r++)Br(t.g,e[r]);kr(t,r)}},Rr),Mn=En(function(t,e,r){return 0===t.i&&(In(e,r,0===(t=rr(t.g))?void 0:t),!0)},Un,Rr),Rn=En(function(t,e,r){return 0===t.i&&(In(e,r,er(t.g)),!0)},Bn,Gr),Dn=En(function(t,e,r){return 0===t.i&&(In(e,r,!1===(t=er(t.g))?void 0:t),!0)},Bn,Gr),$n=An(function(t,e,r){return 2===t.i&&(t=pr(t),Ve(e,0|e[Y],r).push(t),!0)},function(t,e,r){if(null!=(e=Sn(Xt,e)))for(let s=0;s<e.length;s++){var n=t,i=r,o=e[s];null!=o&&Vr(n,i,l(o))}},Mr),zn=En(function(t,e,r){return 2===t.i&&(In(e,r,""===(t=pr(t))?void 0:t),!0)},xn,Mr),Wn=En(function(t,e,r){return 2===t.i&&(In(e,r,pr(t)),!0)},xn,Mr),Hn=function(t,e,r=Cr){return new Qr(t,e,r)}(function(t,e,r,n,i){return 2===t.i&&(n=ce(void 0,n),Ve(e,0|e[Y],r).push(n),gr(t,n,i),!0)},function(t,e,r,n,i){if(Array.isArray(e)){for(let o=0;o<e.length;o++)Nn(t,e[o],r,n,i);1&(t=0|e[Y])||J(e,1|t)}}),qn=Xr(function(t,e,r,n,i,o){if(2!==t.i)return!1;var s=0|e[Y];return Ce(e,s,o,r,st(s)),gr(t,e=Me(e,n,r),i),!0},Nn),Kn=En(function(t,e,r){return 2===t.i&&(In(e,r,vr(t)),!0)},On,Hr),Yn=En(function(t,e,r){return 0===t.i&&(In(e,r,0===(t=rr(t.g)>>>0)?void 0:t),!0)},Pn,Dr),Qn=En(function(t,e,r){return 0===t.i&&(In(e,r,rr(t.g)),!0)},function(t,e,r){null!=(e=zt(e))&&(e=parseInt(e,10),Pr(t,r,0),Br(t.g,e))},qr);class Xn{constructor(t,e){var r=di;this.g=t,this.i=e,this.m=He,this.defaultValue=void 0,this.j=null!=r.P?ot:void 0}register(){p(this)}}function Jn(t,e){return(r,n)=>{{let o={D:!0};n&&Object.assign(o,n),r=cr(r,void 0,void 0,o);try{let n=new t,o=n.l;gn(e)(o,r);var i=n}finally{hr(r)}}return i}}var Zn,ti=[0,zn,En(function(t,e,r){return 2===t.i&&(In(e,r,(t=vr(t))===U()?void 0:t),!0)},function(t,e,r){if(null!=e){if(e instanceof Yr){let n=e.U;return void(n?(e=n(e),null!=e&&Vr(t,r,Ze(e,!0).buffer)):V(z,3))}if(Array.isArray(e))return void V(z,3)}On(t,e,r)},Hr)],ei=globalThis.trustedTypes;var ri=class{constructor(t){this.g=t}toString(){return this.g+""}};function ni(t){var e;return void 0===Zn&&(Zn=function(){var t=null;if(!ei)return t;try{let e=t=>t;t=ei.createPolicy("goog#html",{createHTML:e,createScript:e,createScriptURL:e})}catch(t){}return t}()),t=(e=Zn)?e.createScriptURL(t):t,new ri(t)}function ii(t,...e){if(0===e.length)return ni(t[0]);var r=t[0];for(let n=0;n<e.length;n++)r+=encodeURIComponent(e[n])+t[n+1];return ni(r)}var oi=[0,Cn,Qn,Rn,-1,Gn,Qn,-1,Rn],si=class extends Yr{constructor(t){super(t)}},ai=[0,Rn,Wn,Rn,Qn,-1,An(function(t,e,r){return(0===t.i||2===t.i)&&(e=Ve(e,0|e[Y],r),2==t.i?mr(t,ir,e):e.push(rr(t.g)),!0)},function(t,e,r){if(null!=(e=Sn(zt,e))&&e.length){r=Lr(t,r);for(let r=0;r<e.length;r++)Br(t.g,e[r]);kr(t,r)}},qr),Wn,-1,[0,Rn,-1],Qn,Rn,-1],ui=[0,3,Rn,-1,2,[0,[2],Cn,qn,[0,En(function(t,e,r){return 0===t.i&&(In(e,r,rr(t.g)>>>0),!0)},Pn,Dr)]],[0,Qn,Rn,Qn,Rn,Qn,Rn,Wn,-1],[0,[3,4],Wn,-1,qn,[0,Cn],qn,[0,Qn]],[0]],li=[0,Wn,-2],ci=class extends Yr{constructor(t){super(t)}},hi=[0],fi=[0,Cn,Rn,1,Rn,-4],di=class extends Yr{constructor(t){super(t,2)}},gi={};gi[336783863]=[0,Wn,Rn,-1,Cn,[0,[1,2,3,4,5,6,7,8,9],qn,hi,qn,ai,qn,li,qn,fi,qn,oi,qn,[0,Wn,-2],qn,[0,Wn,Qn],qn,ui,qn,[0,Qn,-1,Rn]],[0,Wn],Rn,[0,[1,3],[2,4],qn,[0,Gn],-1,qn,[0,$n],-1,Hn,[0,Wn,-1]],Wn];var pi=[0,jn,-1,Dn,-3,jn,Gn,zn,Mn,jn,-1,Dn,Mn,Dn,-2,zn];function vi(t){Xe(t,3,"TEXT:text_in")}var mi=class extends Yr{constructor(t){super(t,500)}o(t){return He(this,0,7,t)}},yi=[-1,{}],bi=[0,Wn,1,yi],wi=[0,Wn,$n,yi];function _i(t){Xe(t,10,"text_in")}var Si,Ei=class extends Yr{constructor(t){super(t,500)}o(t){return He(this,0,1001,t)}};Ei.prototype.i=(Si=[-500,Hn,[-500,zn,-1,$n,-3,[-2,gi,Rn],Hn,ti,Mn,-1,bi,wi,Hn,[0,zn,Dn],zn,pi,Mn,$n,987,$n],4,Hn,[-500,Wn,-1,[-1,{}],998,Wn],Hn,[-500,Wn,$n,-1,[-2,{},Rn],997,$n,-1],Mn,Hn,[-500,Wn,$n,yi,998,$n],$n,Mn,bi,wi,Hn,[0,zn,-1,yi],$n,-2,pi,zn,-1,Dn,[0,Dn,Yn],978,yi,Hn,ti],function(){var t=new jr;wn(this.l,t,ln(nn,mn,yn,Si)),Or(t,t.g.end());var e=new Uint8Array(t.i),r=t.j,n=r.length,i=0;for(let t=0;t<n;t++){let n=r[t];e.set(n,i),i+=n.length}return t.j=[e],e});var Ai=class extends Yr{constructor(t){super(t)}},Ii=class extends Yr{constructor(t){super(t)}i(){return ze(this,Ai)}},Ti=class extends Yr{constructor(t){super(t)}},Ui=Jn(class extends Yr{constructor(t){super(t)}},[0,Hn,[0,1,Cn,Wn,[0,Hn,[0,Cn,Ln,Wn,-1]]],Vn]),Bi=class extends Yr{constructor(t){super(t)}},xi=class extends Yr{constructor(t){super(t)}i(){var t=Se(this,1,void 0,Pe);return null==t?U():t}},Ni=class extends Yr{constructor(t){super(t)}},Oi=[1,2],Pi=Jn(class extends Yr{constructor(t){super(t)}},[0,Hn,[0,Oi,qn,[0,kn],qn,[0,Kn],Cn,Wn],Vn]),Li=class extends Yr{constructor(t){super(t)}},ki=class extends Yr{constructor(t){super(t)}},Vi=[0,Rn,-1],ji=class extends Yr{constructor(t){super(t)}i(){Te(this,si,2,Fi)}},Fi=[1,2,3,4,5,6],Ci=class extends Yr{constructor(t){super(t)}i(){return null!=Se(this,1,void 0,Pe)}j(){return null!=Xt(Se(this,2))}},Gi=class extends Yr{constructor(t){super(t)}},Mi=[0,Kn,Wn,[0,Cn,Vn,-1],[0,Fn,Vn]],Ri=[0,Mi,Rn,[0,Fi,qn,fi,qn,ai,qn,oi,qn,hi,qn,li,qn,ui],Qn],Di=class extends Yr{constructor(t){super(t)}},$i=new Xn(462704549,Di);gi[462704549]=[0,Ri,[0,Wn,Cn,Ln,$n,-1]];var zi=class extends Yr{constructor(t){super(t)}},Wi=new Xn(477589892,zi);function Hi(t,e){if(e=e?ge(e):new Li,void 0!==t.displayNamesLocale?Ae(e,1,Qt(t.displayNamesLocale)):void 0===t.displayNamesLocale&&Ae(e,1),void 0!==t.maxResults){var r=t.maxResults;if(null!=r){if("number"!=typeof r)throw k();if(!Ct(r))throw k();r|=0}Ae(e,2,r)}else"maxResults"in t&&Ae(e,2);if(void 0!==t.scoreThreshold){if(null!=(r=t.scoreThreshold)&&"number"!=typeof r)throw Error(`Value of float/double field must be a number, found ${typeof r}: ${r}`);Ae(e,3,r)}else"scoreThreshold"in t&&Ae(e,3);return void 0!==t.categoryAllowlist?Le(e,4,t.categoryAllowlist):"categoryAllowlist"in t&&Ae(e,4),void 0!==t.categoryDenylist?Le(e,5,t.categoryDenylist):"categoryDenylist"in t&&Ae(e,5),e}function qi(t){var e=Number(t);return Number.isSafeInteger(e)?e:String(t)}function Ki(t){var e={classifications:ze(t,Ti).map(t=>function(t,e=-1,r=""){return{categories:t.map(t=>({index:zt(Se(t,1))??0??-1,score:Se(t,2,void 0,Mt)??0??0,categoryName:Xt(Se(t,3))??""??"",displayName:Xt(Se(t,4))??""??""})),headIndex:e,headName:r}}(De(t,Ii,4)?.i()??[],zt(Se(t,2))??0,Xt(Se(t,3))??""))};return null!=function(t){return null==t?t:"bigint"==typeof t?(dt(t)?t=Number(t):(t=Vt(64,t),t=dt(t)?Number(t):String(t)),t):$t(t)?"number"==typeof t?Ht(t):qt(t):void 0}(Se(t,2,void 0,Kt))&&(e.timestampMs=qi(Se(t,2,void 0,Kt)??_e)),e}function Yi(t){return Array.from(t,t=>t>127?t-256:t)}function Qi(t,e){if(t.length!==e.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${t.length} vs. ${e.length}).`);var r=0,n=0,i=0;for(let o=0;o<t.length;o++)r+=t[o]*e[o],n+=t[o]*t[o],i+=e[o]*e[o];if(n<=0||i<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return r/Math.sqrt(n*i)}gi[477589892]=[0,Ri,Vi,1,Mi];var Xi,Ji=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 Zi(t){if(t)return!0;if(void 0===Xi)try{await WebAssembly.instantiate(Ji),Xi=!0}catch{Xi=!1}return Xi}async function to(t,e,r){return{wasmLoaderPath:`${e}/${t}_${r=`wasm${r?"_module":""}${await Zi(r)?"":"_nosimd"}_internal`}.js`,wasmBinaryPath:`${e}/${t}_${r}.wasm`}}var eo=class{};eo.forVisionTasks=function(t,e=!1){return to("vision",t??ii``,e)},eo.forTextTasks=function(t,e=!1){return to("text",t??ii``,e)},eo.forGenAiTasks=function(t,e=!1){return to("genai",t??ii``,e)},eo.forAudioTasks=function(t,e=!1){return to("audio",t??ii``,e)},eo.isSimdSupported=function(t=!1){return Zi(t)};var ro=class{close(){}};function no(){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 io(t){if("function"!=typeof importScripts){let e=document.createElement("script");return e.src=t.toString(),e.crossOrigin="anonymous",new Promise((t,r)=>{e.addEventListener("load",()=>{t()},!1),e.addEventListener("error",t=>{r(t)},!1),document.body.appendChild(e)})}try{importScripts(t.toString())}catch(e){if(!(e instanceof TypeError))throw e;{let e=self.import;e?await e(t.toString()):await import(t.toString())}}}function oo(t,e,r){t.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),r(e=t.h.stringToNewUTF8(e)),t.h._free(e)}function so(t,e,r){t.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");var n=new Uint32Array(e.length);for(let r=0;r<e.length;r++)n[r]=t.h.stringToNewUTF8(e[r]);e=t.h._malloc(4*n.length),t.h.HEAPU32.set(n,e>>2),r(e);for(let e of n)t.h._free(e);t.h._free(e)}function ao(t,e,r){t.h.simpleListeners=t.h.simpleListeners||{},t.h.simpleListeners[e]=r}function uo(t,e,r){var n=[];t.h.simpleListeners=t.h.simpleListeners||{},t.h.simpleListeners[e]=(t,e,i)=>{e?(r(n,i),n=[]):n.push(t)}}var lo=function(t){return class extends t{N(){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:no()?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){var 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){var r=t.length,n=this.h._malloc(r);this.h.HEAPU8.set(t,n),e?this.h._changeBinaryGraph(r,n):this.h._changeTextGraph(r,n),this.h._free(n)}configureAudio(t,e,r,n,i){this.h._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),oo(this,n||"input_audio",n=>{oo(this,i=i||"audio_header",i=>{this.h._configureAudio(n,i,t,e??0,r)})})}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,r){this.addAudioToStreamWithShape(t,0,0,e,r)}addAudioToStreamWithShape(t,e,r,n,i){var 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),oo(this,n,t=>{this.h._addAudioToInputStream(this.g,e,r,t,i)})}addGpuBufferToStream(t,e,r){oo(this,e,e=>{if(!this.h.canvas)throw Error("No OpenGL canvas configured.");e?this.h._bindTextureToStream(e):this.h._bindTextureToCanvas();var n=this.h.canvas.getContext("webgl2")||this.h.canvas.getContext("webgl");if(!n)throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");this.h.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!0),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t),this.h.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1);var[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);var[s,a]=[i,o];this.h._addBoundTextureToStream(e,s,a,r)})}addBoolToStream(t,e,r){oo(this,e,e=>{this.h._addBoolToInputStream(t,e,r)})}addDoubleToStream(t,e,r){oo(this,e,e=>{this.h._addDoubleToInputStream(t,e,r)})}addFloatToStream(t,e,r){oo(this,e,e=>{this.h._addFloatToInputStream(t,e,r)})}addIntToStream(t,e,r){oo(this,e,e=>{this.h._addIntToInputStream(t,e,r)})}addUintToStream(t,e,r){oo(this,e,e=>{this.h._addUintToInputStream(t,e,r)})}addStringToStream(t,e,r){oo(this,e,e=>{oo(this,t,t=>{this.h._addStringToInputStream(t,e,r)})})}addStringRecordToStream(t,e,r){oo(this,e,e=>{so(this,Object.keys(t),n=>{so(this,Object.values(t),i=>{this.h._addFlatHashMapToInputStream(n,i,Object.keys(t).length,e,r)})})})}addProtoToStream(t,e,r,n){oo(this,r,r=>{oo(this,e,e=>{var i=this.h._malloc(t.length);this.h.HEAPU8.set(t,i),this.h._addProtoToInputStream(i,t.length,e,r,n),this.h._free(i)})})}addEmptyPacketToStream(t,e){oo(this,t,t=>{this.h._addEmptyPacketToInputStream(t,e)})}addBoolVectorToStream(t,e,r){oo(this,e,e=>{var n=this.h._allocateBoolVector(t.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(let e of t)this.h._addBoolVectorEntry(n,e);this.h._addBoolVectorToInputStream(n,e,r)})}addDoubleVectorToStream(t,e,r){oo(this,e,e=>{var n=this.h._allocateDoubleVector(t.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(let e of t)this.h._addDoubleVectorEntry(n,e);this.h._addDoubleVectorToInputStream(n,e,r)})}addFloatVectorToStream(t,e,r){oo(this,e,e=>{var n=this.h._allocateFloatVector(t.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(let e of t)this.h._addFloatVectorEntry(n,e);this.h._addFloatVectorToInputStream(n,e,r)})}addIntVectorToStream(t,e,r){oo(this,e,e=>{var n=this.h._allocateIntVector(t.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(let e of t)this.h._addIntVectorEntry(n,e);this.h._addIntVectorToInputStream(n,e,r)})}addUintVectorToStream(t,e,r){oo(this,e,e=>{var n=this.h._allocateUintVector(t.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(let e of t)this.h._addUintVectorEntry(n,e);this.h._addUintVectorToInputStream(n,e,r)})}addStringVectorToStream(t,e,r){oo(this,e,e=>{var n=this.h._allocateStringVector(t.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(let e of t)oo(this,e,t=>{this.h._addStringVectorEntry(n,t)});this.h._addStringVectorToInputStream(n,e,r)})}addBoolToInputSidePacket(t,e){oo(this,e,e=>{this.h._addBoolToInputSidePacket(t,e)})}addDoubleToInputSidePacket(t,e){oo(this,e,e=>{this.h._addDoubleToInputSidePacket(t,e)})}addFloatToInputSidePacket(t,e){oo(this,e,e=>{this.h._addFloatToInputSidePacket(t,e)})}addIntToInputSidePacket(t,e){oo(this,e,e=>{this.h._addIntToInputSidePacket(t,e)})}addUintToInputSidePacket(t,e){oo(this,e,e=>{this.h._addUintToInputSidePacket(t,e)})}addStringToInputSidePacket(t,e){oo(this,e,e=>{oo(this,t,t=>{this.h._addStringToInputSidePacket(t,e)})})}addProtoToInputSidePacket(t,e,r){oo(this,r,r=>{oo(this,e,e=>{var n=this.h._malloc(t.length);this.h.HEAPU8.set(t,n),this.h._addProtoToInputSidePacket(n,t.length,e,r),this.h._free(n)})})}addBoolVectorToInputSidePacket(t,e){oo(this,e,e=>{var r=this.h._allocateBoolVector(t.length);if(!r)throw Error("Unable to allocate new bool vector on heap.");for(let e of t)this.h._addBoolVectorEntry(r,e);this.h._addBoolVectorToInputSidePacket(r,e)})}addDoubleVectorToInputSidePacket(t,e){oo(this,e,e=>{var r=this.h._allocateDoubleVector(t.length);if(!r)throw Error("Unable to allocate new double vector on heap.");for(let e of t)this.h._addDoubleVectorEntry(r,e);this.h._addDoubleVectorToInputSidePacket(r,e)})}addFloatVectorToInputSidePacket(t,e){oo(this,e,e=>{var r=this.h._allocateFloatVector(t.length);if(!r)throw Error("Unable to allocate new float vector on heap.");for(let e of t)this.h._addFloatVectorEntry(r,e);this.h._addFloatVectorToInputSidePacket(r,e)})}addIntVectorToInputSidePacket(t,e){oo(this,e,e=>{var r=this.h._allocateIntVector(t.length);if(!r)throw Error("Unable to allocate new int vector on heap.");for(let e of t)this.h._addIntVectorEntry(r,e);this.h._addIntVectorToInputSidePacket(r,e)})}addUintVectorToInputSidePacket(t,e){oo(this,e,e=>{var r=this.h._allocateUintVector(t.length);if(!r)throw Error("Unable to allocate new unsigned int vector on heap.");for(let e of t)this.h._addUintVectorEntry(r,e);this.h._addUintVectorToInputSidePacket(r,e)})}addStringVectorToInputSidePacket(t,e){oo(this,e,e=>{var r=this.h._allocateStringVector(t.length);if(!r)throw Error("Unable to allocate new string vector on heap.");for(let e of t)oo(this,e,t=>{this.h._addStringVectorEntry(r,t)});this.h._addStringVectorToInputSidePacket(r,e)})}attachBoolListener(t,e){ao(this,t,e),oo(this,t,t=>{this.h._attachBoolListener(t)})}attachBoolVectorListener(t,e){uo(this,t,e),oo(this,t,t=>{this.h._attachBoolVectorListener(t)})}attachIntListener(t,e){ao(this,t,e),oo(this,t,t=>{this.h._attachIntListener(t)})}attachIntVectorListener(t,e){uo(this,t,e),oo(this,t,t=>{this.h._attachIntVectorListener(t)})}attachUintListener(t,e){ao(this,t,e),oo(this,t,t=>{this.h._attachUintListener(t)})}attachUintVectorListener(t,e){uo(this,t,e),oo(this,t,t=>{this.h._attachUintVectorListener(t)})}attachDoubleListener(t,e){ao(this,t,e),oo(this,t,t=>{this.h._attachDoubleListener(t)})}attachDoubleVectorListener(t,e){uo(this,t,e),oo(this,t,t=>{this.h._attachDoubleVectorListener(t)})}attachFloatListener(t,e){ao(this,t,e),oo(this,t,t=>{this.h._attachFloatListener(t)})}attachFloatVectorListener(t,e){uo(this,t,e),oo(this,t,t=>{this.h._attachFloatVectorListener(t)})}attachStringListener(t,e){ao(this,t,e),oo(this,t,t=>{this.h._attachStringListener(t)})}attachStringVectorListener(t,e){uo(this,t,e),oo(this,t,t=>{this.h._attachStringVectorListener(t)})}attachProtoListener(t,e,r){ao(this,t,e),oo(this,t,t=>{this.h._attachProtoListener(t,r||!1)})}attachProtoVectorListener(t,e,r){uo(this,t,e),oo(this,t,t=>{this.h._attachProtoVectorListener(t,r||!1)})}attachAudioListener(t,e,r){this.h._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),ao(this,t,(t,r)=>{t=new Float32Array(t.buffer,t.byteOffset,t.length/4),e(t,r)}),oo(this,t,t=>{this.h._attachAudioListener(t,r||!1)})}finishProcessing(){this.h._waitUntilIdle()}closeGraph(){this.h._closeGraph(),this.h.simpleListeners=void 0,this.h.emptyPacketListeners=void 0}}),co=class extends lo{};async function ho(t,e,r){return t=await(async(t,e,r,n)=>{if(e&&await io(e),!self.ModuleFactory)throw Error("ModuleFactory not set.");if(r&&(await io(r),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&n&&((e=self.Module).locateFile=n.locateFile,n.mainScriptUrlOrBlob&&(e.mainScriptUrlOrBlob=n.mainScriptUrlOrBlob)),n=await self.ModuleFactory(self.Module||n),self.ModuleFactory=self.Module=void 0,new t(n,null)})(t,e.wasmLoaderPath,e.assetLoaderPath,{locateFile:t=>t.endsWith(".wasm")?e.wasmBinaryPath.toString():e.assetBinaryPath&&t.endsWith(".data")?e.assetBinaryPath.toString():t}),t.H=new ro,await t.o(r),t}async function fo(t,e,r){return ho(t,e,r)}function go(t,e){var r=De(t.baseOptions,Ci,1)||new Ci;"string"==typeof e?(Ae(r,2,Qt(e)),Ae(r,1)):e instanceof Uint8Array&&(Ae(r,1,rt(e,!1)),Ae(r,2)),He(t.baseOptions,0,1,r)}function po(t,e){var r=e.baseOptions||{};if(e.baseOptions?.modelAssetBuffer&&e.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(De(t.baseOptions,Ci,1)?.i()||De(t.baseOptions,Ci,1)?.j()||e.baseOptions?.modelAssetBuffer||e.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if(function(t,e){var r=De(t.baseOptions,ji,3);if(!r){var n=r=new ji;qe(n,4,new ci)}"delegate"in e&&("GPU"===e.delegate?qe(e=r,2,n=new si):qe(e=r,4,n=new ci)),He(t.baseOptions,0,3,r)}(t,r),r.modelAssetPath)return fetch(r.modelAssetPath.toString()).then(t=>{if(t.ok)return t.arrayBuffer();throw Error(`Failed to fetch model: ${r.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),go(t,"/model.dat"),t.v()});if(r.modelAssetBuffer instanceof Uint8Array)go(t,r.modelAssetBuffer);else if(r.modelAssetBuffer)return async function(t){for(var e=[],r=0;;){let{done:n,value:i}=await t.read();if(n)break;e.push(i),r+=i.length}if(0===e.length)return new Uint8Array(0);if(1===e.length)return e[0];t=new Uint8Array(r),r=0;for(let n of e)t.set(n,r),r+=n.length;return t}(r.modelAssetBuffer).then(e=>{go(t,e),t.v()});return t.v(),Promise.resolve()}function vo(t){try{let 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 mo(t,e){t.H&&void 0!==e&&De(t.baseOptions,ji,3)?.i()}function yo(t,e){t.j=Math.max(t.j,e)}var bo=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.N(),this.g.setGraph(t,e),vo(this)}finishProcessing(){this.g.finishProcessing(),vo(this)}close(){this.H?.close(),this.g.closeGraph()}};bo.prototype.close=bo.prototype.close;var wo=class extends bo{constructor(t,e){super(new co(t,e)),this.u={languages:[]},He(t=this.i=new Di,0,1,e=new Gi)}o(t){return He(this.i,0,2,Hi(t,De(this.i,Li,2))),po(this,t)}get baseOptions(){return De(this.i,Gi,1)}set baseOptions(t){He(this.i,0,1,t)}K(t){this.u={languages:[]};var e=this.j+1;return mo(this,e),this.g.addStringToStream(t,"text_in",e),this.finishProcessing(e),this.u}v(){var t=new Ei;_i(t),Xe(t,15,"classifications_out");var e=new di;Kr(e,$i,this.i);var r=new mi;ke(r,Qt("mediapipe.tasks.text.text_classifier.TextClassifierGraph")),vi(r),Xe(r,4,"CLASSIFICATIONS:classifications_out"),r.o(e),Ye(t,r),this.g.attachProtoListener("classifications_out",(t,e)=>{if(({classifications:t}=Ki(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})),yo(this,e)}),this.g.attachEmptyPacketListener("classifications_out",t=>{yo(this,t)}),t=t.i(),this.setGraph(new Uint8Array(t),!0)}};wo.prototype.detect=wo.prototype.K,wo.prototype.setOptions=wo.prototype.o,wo.createFromModelPath=function(t,e){return fo(wo,t,{baseOptions:{modelAssetPath:e}})},wo.createFromModelBuffer=function(t,e){return fo(wo,t,{baseOptions:{modelAssetBuffer:e}})},wo.createFromOptions=function(t,e){return fo(wo,t,e)};var _o=class extends bo{constructor(t,e){super(new co(t,e)),this.u={classifications:[]},He(t=this.i=new Di,0,1,e=new Gi)}o(t){return He(this.i,0,2,Hi(t,De(this.i,Li,2))),po(this,t)}get baseOptions(){return De(this.i,Gi,1)}set baseOptions(t){He(this.i,0,1,t)}J(t){this.u={classifications:[]};var e=this.j+1;return mo(this,e),this.g.addStringToStream(t,"text_in",e),this.finishProcessing(e),this.u}v(){var t=new Ei;_i(t),Xe(t,15,"classifications_out");var e=new di;Kr(e,$i,this.i);var r=new mi;ke(r,Qt("mediapipe.tasks.text.text_classifier.TextClassifierGraph")),vi(r),Xe(r,4,"CLASSIFICATIONS:classifications_out"),r.o(e),Ye(t,r),this.g.attachProtoListener("classifications_out",(t,e)=>{this.u=Ki(Ui(t)),yo(this,e)}),this.g.attachEmptyPacketListener("classifications_out",t=>{yo(this,t)}),t=t.i(),this.setGraph(new Uint8Array(t),!0)}};function So(t){switch(t){case"RETRIEVAL_QUERY":default:return"search result";case"SEMANTIC_SIMILARITY":return"sentence similarity";case"CLASSIFICATION":return"classification";case"CLUSTERING":return"clustering";case"QUESTION_ANSWERING":return"question answering";case"FACT_CHECKING":return"fact checking";case"CODE_RETRIEVAL":return"code retrieval"}}_o.prototype.classify=_o.prototype.J,_o.prototype.setOptions=_o.prototype.o,_o.createFromModelPath=function(t,e){return fo(_o,t,{baseOptions:{modelAssetPath:e}})},_o.createFromModelBuffer=function(t,e){return fo(_o,t,{baseOptions:{modelAssetBuffer:e}})},_o.createFromOptions=function(t,e){return fo(_o,t,e)};var Eo=class extends bo{constructor(t,e){super(new co(t,e)),this.u={embeddings:[]},He(t=this.i=new zi,0,1,e=new Gi)}o(t){var e=this.i,r=De(this.i,ki,2);return r=r?ge(r):new ki,void 0!==t.l2Normalize?Ae(r,1,Rt(t.l2Normalize)):"l2Normalize"in t&&Ae(r,1),void 0!==t.quantize?Ae(r,2,Rt(t.quantize)):"quantize"in t&&Ae(r,2),He(e,0,2,r),po(this,t)}get baseOptions(){return De(this.i,Gi,1)}set baseOptions(t){He(this.i,0,1,t)}L(t,e){var r=this.j+1;if(mo(this,r),e)t:{let r=e.type,n=e.title&&e.title.length>0?e.title:"none";switch(e="DOCUMENT"!==e.textRole,r){case"RETRIEVAL_DOCUMENT":t=`title: ${n} | text: ${t}`;break t;case"RETRIEVAL_QUERY":t=`task: ${So(r)} | query: ${t}`;break t;case"QUESTION_ANSWERING":case"FACT_CHECKING":case"CODE_RETRIEVAL":t=e?`task: ${So(r)} | query: ${t}`:`title: ${n} | text: ${t}`;break t;default:t=`task: ${So(r)} | query: ${t}`}}return this.g.addStringToStream(t,"text_in",r),this.finishProcessing(r),this.u}v(){var t=new Ei;_i(t),Xe(t,15,"embeddings_out");var e=new di;Kr(e,Wi,this.i);var r=new mi;ke(r,Qt("mediapipe.tasks.text.text_embedder.TextEmbedderGraph")),vi(r),Xe(r,4,"EMBEDDINGS:embeddings_out"),r.o(e),Ye(t,r),this.g.attachProtoListener("embeddings_out",(t,e)=>{t=Pi(t),this.u=function(t){return{embeddings:ze(t,Ni).map(t=>{var e={headIndex:zt(Se(t,3))??0??-1,headName:Xt(Se(t,4))??""??""};if(Te(t,Bi,1,Oi))t=Ue(t=Qe(t,Bi,1),1,Mt,void 0===nt?2:4),e.floatEmbedding=t.slice();else{let r=new Uint8Array(0);e.quantizedEmbedding=Qe(t,xi,2)?.i()?.i()??r}return e}),timestampMs:qi(Se(t,2,void 0,Kt)??_e)}}(t),yo(this,e)}),this.g.attachEmptyPacketListener("embeddings_out",t=>{yo(this,t)}),t=t.i(),this.setGraph(new Uint8Array(t),!0)}};Eo.cosineSimilarity=function(t,e){if(t.floatEmbedding&&e.floatEmbedding)t=Qi(t.floatEmbedding,e.floatEmbedding);else{if(!t.quantizedEmbedding||!e.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");t=Qi(Yi(t.quantizedEmbedding),Yi(e.quantizedEmbedding))}return t},Eo.prototype.embed=Eo.prototype.L,Eo.prototype.setOptions=Eo.prototype.o,Eo.createFromModelPath=function(t,e){return fo(Eo,t,{baseOptions:{modelAssetPath:e}})},Eo.createFromModelBuffer=function(t,e){return fo(Eo,t,{baseOptions:{modelAssetBuffer:e}})},Eo.createFromOptions=function(t,e){return fo(Eo,t,e)},exports.FilesetResolver=eo,exports.LanguageDetector=wo,exports.TaskRunner=bo,exports.TextClassifier=_o,exports.TextEmbedder=Eo;
2
2
  //# sourceMappingURL=text_bundle_cjs.js.map