investing 0.1.12 → 0.1.13

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.
@@ -1,13 +0,0 @@
1
- "use strict";const e=require("drizzle-orm"),t=require("xgboost_node"),n=require("yahoo-finance2"),r=require("dotenv"),i=require("axios"),a=require("node-fetch");require("predictos");const o=Symbol.for("drizzle:entityKind");function s(e,t){if(!e||"object"!=typeof e)return!1;if(e instanceof t)return!0;if(!Object.prototype.hasOwnProperty.call(t,o))throw new Error(`Class "${t.name??"<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let n=Object.getPrototypeOf(e).constructor;if(n)for(;n;){if(o in n&&n[o]===t[o])return!0;n=Object.getPrototypeOf(n)}return!1}class c{static[o]="ConsoleLogWriter";write(e){console.log(e)}}class l{static[o]="DefaultLogger";writer;constructor(e){this.writer=e?.writer??new c}logQuery(e,t){const n=t.map(e=>{try{return JSON.stringify(e)}catch{return String(e)}}),r=n.length?` -- params: [${n.join(", ")}]`:"";this.writer.write(`Query: ${e}${r}`)}}class u{static[o]="NoopLogger";logQuery(){}}const d=Symbol.for("drizzle:Name"),p=Symbol.for("drizzle:Schema"),h=Symbol.for("drizzle:Columns"),f=Symbol.for("drizzle:ExtraConfigColumns"),m=Symbol.for("drizzle:OriginalName"),g=Symbol.for("drizzle:BaseName"),y=Symbol.for("drizzle:IsAlias"),I=Symbol.for("drizzle:ExtraConfigBuilder"),C=Symbol.for("drizzle:IsDrizzleTable");class A{static[o]="Table";static Symbol={Name:d,Schema:p,OriginalName:m,Columns:h,ExtraConfigColumns:f,BaseName:g,IsAlias:y,ExtraConfigBuilder:I};[d];[m];[p];[h];[f];[g];[y]=!1;[C]=!0;[I]=void 0;constructor(e,t,n){this[d]=this[m]=e,this[p]=t,this[g]=n}}function S(e){return e[d]}function b(e){return`${e[p]??"public"}.${e[d]}`}class T{constructor(e,t){this.table=e,this.config=t,this.name=t.name,this.keyAsName=t.keyAsName,this.notNull=t.notNull,this.default=t.default,this.defaultFn=t.defaultFn,this.onUpdateFn=t.onUpdateFn,this.hasDefault=t.hasDefault,this.primary=t.primaryKey,this.isUnique=t.isUnique,this.uniqueName=t.uniqueName,this.uniqueType=t.uniqueType,this.dataType=t.dataType,this.columnType=t.columnType,this.generated=t.generated,this.generatedIdentity=t.generatedIdentity}static[o]="Column";name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;config;mapFromDriverValue(e){return e}mapToDriverValue(e){return e}shouldDisableInsert(){return void 0!==this.config.generated&&"byDefault"!==this.config.generated.type}}class v{static[o]="ColumnBuilder";config;constructor(e,t,n){this.config={name:e,keyAsName:""===e,notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:t,columnType:n,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(e){return this.config.default=e,this.config.hasDefault=!0,this}$defaultFn(e){return this.config.defaultFn=e,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(e){return this.config.onUpdateFn=e,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(e){""===this.config.name&&(this.config.name=e)}}const _=Symbol.for("drizzle:isPgEnum");class w{static[o]="Subquery";constructor(e,t,n,r=!1,i=[]){this._={brand:"Subquery",sql:e,selectedFields:t,alias:n,isWith:r,usedTables:i}}}class E extends w{static[o]="WithSubquery"}const P={startActiveSpan:(e,t)=>t()},R=Symbol.for("drizzle:ViewBaseConfig");function L(e){return null!=e&&"function"==typeof e.getSQL}class N{static[o]="StringChunk";value;constructor(e){this.value=Array.isArray(e)?e:[e]}getSQL(){return new O([this])}}class O{constructor(e){this.queryChunks=e;for(const t of e)if(s(t,A)){const e=t[A.Symbol.Schema];this.usedTables.push(void 0===e?t[A.Symbol.Name]:e+"."+t[A.Symbol.Name])}}static[o]="SQL";decoder=M;shouldInlineParams=!1;usedTables=[];append(e){return this.queryChunks.push(...e.queryChunks),this}toQuery(e){return P.startActiveSpan("drizzle.buildSQL",t=>{const n=this.buildQueryFromSourceParams(this.queryChunks,e);return t?.setAttributes({"drizzle.query.text":n.sql,"drizzle.query.params":JSON.stringify(n.params)}),n})}buildQueryFromSourceParams(e,t){const n=Object.assign({},t,{inlineParams:t.inlineParams||this.shouldInlineParams,paramStartIndex:t.paramStartIndex||{value:0}}),{casing:r,escapeName:i,escapeParam:a,prepareTyping:o,inlineParams:c,paramStartIndex:l}=n;return function(e){const t={sql:"",params:[]};for(const n of e)t.sql+=n.sql,t.params.push(...n.params),n.typings?.length&&(t.typings||(t.typings=[]),t.typings.push(...n.typings));return t}(e.map(e=>{if(s(e,N))return{sql:e.value.join(""),params:[]};if(s(e,B))return{sql:i(e.value),params:[]};if(void 0===e)return{sql:"",params:[]};if(Array.isArray(e)){const t=[new N("(")];for(const[n,r]of e.entries())t.push(r),n<e.length-1&&t.push(new N(", "));return t.push(new N(")")),this.buildQueryFromSourceParams(t,n)}if(s(e,O))return this.buildQueryFromSourceParams(e.queryChunks,{...n,inlineParams:c||e.shouldInlineParams});if(s(e,A)){const t=e[A.Symbol.Schema],n=e[A.Symbol.Name];return{sql:void 0===t||e[y]?i(n):i(t)+"."+i(n),params:[]}}if(s(e,T)){const n=r.getColumnCasing(e);if("indexes"===t.invokeSource)return{sql:i(n),params:[]};const a=e.table[A.Symbol.Schema];return{sql:e.table[y]||void 0===a?i(e.table[A.Symbol.Name])+"."+i(n):i(a)+"."+i(e.table[A.Symbol.Name])+"."+i(n),params:[]}}if(s(e,V)){const t=e[R].schema,n=e[R].name;return{sql:void 0===t||e[R].isAlias?i(n):i(t)+"."+i(n),params:[]}}if(s(e,F)){if(s(e.value,x))return{sql:a(l.value++,e),params:[e],typings:["none"]};const t=null===e.value?null:e.encoder.mapToDriverValue(e.value);if(s(t,O))return this.buildQueryFromSourceParams([t],n);if(c)return{sql:this.mapInlineParam(t,n),params:[]};let r=["none"];return o&&(r=[o(e.encoder)]),{sql:a(l.value++,t),params:[t],typings:r}}return s(e,x)?{sql:a(l.value++,e),params:[e],typings:["none"]}:s(e,O.Aliased)&&void 0!==e.fieldAlias?{sql:i(e.fieldAlias),params:[]}:s(e,w)?e._.isWith?{sql:i(e._.alias),params:[]}:this.buildQueryFromSourceParams([new N("("),e._.sql,new N(") "),new B(e._.alias)],n):(u=e)&&"function"==typeof u&&_ in u&&!0===u[_]?e.schema?{sql:i(e.schema)+"."+i(e.enumName),params:[]}:{sql:i(e.enumName),params:[]}:L(e)?e.shouldOmitSQLParens?.()?this.buildQueryFromSourceParams([e.getSQL()],n):this.buildQueryFromSourceParams([new N("("),e.getSQL(),new N(")")],n):c?{sql:this.mapInlineParam(e,n),params:[]}:{sql:a(l.value++,e),params:[e],typings:["none"]};var u}))}mapInlineParam(e,{escapeString:t}){if(null===e)return"null";if("number"==typeof e||"boolean"==typeof e)return e.toString();if("string"==typeof e)return t(e);if("object"==typeof e){const n=e.toString();return t("[object Object]"===n?JSON.stringify(e):n)}throw new Error("Unexpected param value: "+e)}getSQL(){return this}as(e){return void 0===e?this:new O.Aliased(this,e)}mapWith(e){return this.decoder="function"==typeof e?{mapFromDriverValue:e}:e,this}inlineParams(){return this.shouldInlineParams=!0,this}if(e){return e?this:void 0}}class B{constructor(e){this.value=e}static[o]="Name";brand;getSQL(){return new O([this])}}const M={mapFromDriverValue:e=>e},D={mapToDriverValue:e=>e};class F{constructor(e,t=D){this.value=e,this.encoder=t}static[o]="Param";brand;getSQL(){return new O([this])}}function k(e,...t){const n=[];(t.length>0||e.length>0&&""!==e[0])&&n.push(new N(e[0]));for(const[r,i]of t.entries())n.push(i,new N(e[r+1]));return new O(n)}var G;(G=k||(k={})).empty=function(){return new O([])},G.fromList=function(e){return new O(e)},G.raw=function(e){return new O([new N(e)])},G.join=function(e,t){const n=[];for(const[r,i]of e.entries())r>0&&void 0!==t&&n.push(t),n.push(i);return new O(n)},G.identifier=function(e){return new B(e)},G.placeholder=function(e){return new x(e)},G.param=function(e,t){return new F(e,t)},(e=>{class t{constructor(e,t){this.sql=e,this.fieldAlias=t}static[o]="SQL.Aliased";isSelectionField=!1;getSQL(){return this.sql}clone(){return new t(this.sql,this.fieldAlias)}}e.Aliased=t})(O||(O={}));class x{constructor(e){this.name=e}static[o]="Placeholder";getSQL(){return new O([this])}}function H(e,t){return e.map(e=>{if(s(e,x)){if(!(e.name in t))throw new Error(`No value for placeholder "${e.name}" was provided`);return t[e.name]}if(s(e,F)&&s(e.value,x)){if(!(e.value.name in t))throw new Error(`No value for placeholder "${e.value.name}" was provided`);return e.encoder.mapToDriverValue(t[e.value.name])}return e})}const U=Symbol.for("drizzle:IsDrizzleView");class V{static[o]="View";[R];[U]=!0;constructor({name:e,schema:t,selectedFields:n,query:r}){this[R]={name:e,originalName:e,schema:t,selectedFields:n,query:r,isExisting:!r,isAlias:!1}}getSQL(){return new O([this])}}function $(e,t,n){const r={},i=e.reduce((e,{path:i,field:a},o)=>{let c;c=s(a,T)?a:s(a,O)?a.decoder:s(a,w)?a._.sql.decoder:a.sql.decoder;let l=e;for(const[u,d]of i.entries())if(u<i.length-1)d in l||(l[d]={}),l=l[d];else{const e=t[o],u=l[d]=null===e?null:c.mapFromDriverValue(e);if(n&&s(a,T)&&2===i.length){const e=i[0];e in r?"string"==typeof r[e]&&r[e]!==S(a.table)&&(r[e]=!1):r[e]=null===u&&S(a.table)}}return e},{});if(n&&Object.keys(r).length>0)for(const[a,o]of Object.entries(r))"string"!=typeof o||n[o]||(i[a]=null);return i}function j(e,t){return Object.entries(e).reduce((e,[n,r])=>{if("string"!=typeof n)return e;const i=t?[...t,n]:[n];return s(r,T)||s(r,O)||s(r,O.Aliased)||s(r,w)?e.push({path:i,field:r}):s(r,A)?e.push(...j(r[A.Symbol.Columns],i)):e.push(...j(r,i)),e},[])}function W(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const[i,a]of n.entries())if(a!==r[i])return!1;return!0}function X(e,t){const n=Object.entries(t).filter(([,e])=>void 0!==e).map(([t,n])=>s(n,O)||s(n,T)?[t,n]:[t,new F(n,e[A.Symbol.Columns][t])]);if(0===n.length)throw new Error("No values to set");return Object.fromEntries(n)}function K(e){return s(e,w)?e._.alias:s(e,V)?e[R].name:s(e,O)?void 0:e[A.Symbol.IsAlias]?e[A.Symbol.Name]:e[A.Symbol.BaseName]}function Y(e,t){return{name:"string"==typeof e&&e.length>0?e:"",config:"object"==typeof e?e:t}}T.prototype.getSQL=function(){return new O([this])},A.prototype.getSQL=function(){return new O([this])},w.prototype.getSQL=function(){return new O([this])};const q="undefined"==typeof TextDecoder?null:new TextDecoder,Q=Symbol.for("drizzle:PgInlineForeignKeys"),J=Symbol.for("drizzle:EnableRLS");class z extends A{static[o]="PgTable";static Symbol=Object.assign({},A.Symbol,{InlineForeignKeys:Q,EnableRLS:J});[Q]=[];[J]=!1;[A.Symbol.ExtraConfigBuilder]=void 0;[A.Symbol.ExtraConfigColumns]={}}class Z{static[o]="PgPrimaryKeyBuilder";columns;name;constructor(e,t){this.columns=e,this.name=t}build(e){return new ee(e,this.columns,this.name)}}class ee{constructor(e,t,n){this.table=e,this.columns=t,this.name=n}static[o]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[z.Symbol.Name]}_${this.columns.map(e=>e.name).join("_")}_pk`}}function te(e,t){return!function(e){return"object"==typeof e&&null!==e&&"mapToDriverValue"in e&&"function"==typeof e.mapToDriverValue}(t)||L(e)||s(e,F)||s(e,x)||s(e,T)||s(e,A)||s(e,V)?e:new F(e,t)}const ne=(e,t)=>k`${e} = ${te(t,e)}`,re=(e,t)=>k`${e} <> ${te(t,e)}`;function ie(...e){const t=e.filter(e=>void 0!==e);if(0!==t.length)return 1===t.length?new O(t):new O([new N("("),k.join(t,new N(" and ")),new N(")")])}function ae(...e){const t=e.filter(e=>void 0!==e);if(0!==t.length)return 1===t.length?new O(t):new O([new N("("),k.join(t,new N(" or ")),new N(")")])}function oe(e){return k`not ${e}`}const se=(e,t)=>k`${e} > ${te(t,e)}`,ce=(e,t)=>k`${e} >= ${te(t,e)}`,le=(e,t)=>k`${e} < ${te(t,e)}`,ue=(e,t)=>k`${e} <= ${te(t,e)}`;function de(e,t){return Array.isArray(t)?0===t.length?k`false`:k`${e} in ${t.map(t=>te(t,e))}`:k`${e} in ${te(t,e)}`}function pe(e,t){return Array.isArray(t)?0===t.length?k`true`:k`${e} not in ${t.map(t=>te(t,e))}`:k`${e} not in ${te(t,e)}`}function he(e){return k`${e} is null`}function fe(e){return k`${e} is not null`}function me(e){return k`exists ${e}`}function ge(e){return k`not exists ${e}`}function ye(e,t,n){return k`${e} between ${te(t,e)} and ${te(n,e)}`}function Ie(e,t,n){return k`${e} not between ${te(t,e)} and ${te(n,e)}`}function Ce(e,t){return k`${e} like ${t}`}function Ae(e,t){return k`${e} not like ${t}`}function Se(e,t){return k`${e} ilike ${t}`}function be(e,t){return k`${e} not ilike ${t}`}function Te(e){return k`${e} asc`}function ve(e){return k`${e} desc`}class _e{constructor(e,t,n){this.sourceTable=e,this.referencedTable=t,this.relationName=n,this.referencedTableName=t[A.Symbol.Name]}static[o]="Relation";referencedTableName;fieldName}class we{constructor(e,t){this.table=e,this.config=t}static[o]="Relations"}class Ee extends _e{constructor(e,t,n,r){super(e,t,n?.relationName),this.config=n,this.isNullable=r}static[o]="One";withFieldName(e){const t=new Ee(this.sourceTable,this.referencedTable,this.config,this.isNullable);return t.fieldName=e,t}}class Pe extends _e{constructor(e,t,n){super(e,t,n?.relationName),this.config=n}static[o]="Many";withFieldName(e){const t=new Pe(this.sourceTable,this.referencedTable,this.config);return t.fieldName=e,t}}function Re(e,t){1===Object.keys(e).length&&"default"in e&&!s(e.default,A)&&(e=e.default);const n={},r={},i={};for(const[a,o]of Object.entries(e))if(s(o,A)){const e=b(o),t=r[e];n[e]=a,i[a]={tsName:a,dbName:o[A.Symbol.Name],schema:o[A.Symbol.Schema],columns:o[A.Symbol.Columns],relations:t?.relations??{},primaryKey:t?.primaryKey??[]};for(const n of Object.values(o[A.Symbol.Columns]))n.primary&&i[a].primaryKey.push(n);const c=o[A.Symbol.ExtraConfigBuilder]?.(o[A.Symbol.ExtraConfigColumns]);if(c)for(const n of Object.values(c))s(n,Z)&&i[a].primaryKey.push(...n.columns)}else if(s(o,we)){const e=b(o.table),a=n[e],s=o.config(t(o.table));let c;for(const[t,n]of Object.entries(s))if(a){i[a].relations[t]=n}else e in r||(r[e]={relations:{},primaryKey:c}),r[e].relations[t]=n}return{tables:i,tableNamesMap:n}}function Le(e){return function(t,n){return new Ee(e,t,n,n?.fields.reduce((e,t)=>e&&t.notNull,!0)??!1)}}function Ne(e){return function(t,n){return new Pe(e,t,n)}}function Oe(e,t,n){if(s(n,Ee)&&n.config)return{fields:n.config.fields,references:n.config.references};const r=t[b(n.referencedTable)];if(!r)throw new Error(`Table "${n.referencedTable[A.Symbol.Name]}" not found in schema`);const i=e[r];if(!i)throw new Error(`Table "${r}" not found in schema`);const a=n.sourceTable,o=t[b(a)];if(!o)throw new Error(`Table "${a[A.Symbol.Name]}" not found in schema`);const c=[];for(const s of Object.values(i.relations))(n.relationName&&n!==s&&s.relationName===n.relationName||!n.relationName&&s.referencedTable===n.sourceTable)&&c.push(s);if(c.length>1)throw n.relationName?new Error(`There are multiple relations with name "${n.relationName}" in table "${r}"`):new Error(`There are multiple relations between "${r}" and "${n.sourceTable[A.Symbol.Name]}". Please specify relation name`);if(c[0]&&s(c[0],Ee)&&c[0].config)return{fields:c[0].config.references,references:c[0].config.fields};throw new Error(`There is not enough information to infer relation "${o}.${n.fieldName}"`)}function Be(e){return{one:Le(e),many:Ne(e)}}function Me(e,t,n,r,i=e=>e){const a={};for(const[o,c]of r.entries())if(c.isJson){const r=t.relations[c.tsKey],l=n[o],u="string"==typeof l?JSON.parse(l):l;a[c.tsKey]=s(r,Ee)?u&&Me(e,e[c.relationTableTsKey],u,c.selection,i):u.map(t=>Me(e,e[c.relationTableTsKey],t,c.selection,i))}else{const e=i(n[o]),t=c.field;let r;r=s(t,T)?t:s(t,O)?t.decoder:t.sql.decoder,a[c.tsKey]=null===e?null:r.mapFromDriverValue(e)}return a}class De{constructor(e){this.table=e}static[o]="ColumnAliasProxyHandler";get(e,t){return"table"===t?this.table:e[t]}}class Fe{constructor(e,t){this.alias=e,this.replaceOriginalName=t}static[o]="TableAliasProxyHandler";get(e,t){if(t===A.Symbol.IsAlias)return!0;if(t===A.Symbol.Name)return this.alias;if(this.replaceOriginalName&&t===A.Symbol.OriginalName)return this.alias;if(t===R)return{...e[R],name:this.alias,isAlias:!0};if(t===A.Symbol.Columns){const t=e[A.Symbol.Columns];if(!t)return t;const n={};return Object.keys(t).map(r=>{n[r]=new Proxy(t[r],new De(new Proxy(e,this)))}),n}const n=e[t];return s(n,T)?new Proxy(n,new De(new Proxy(e,this))):n}}function ke(e,t){return new Proxy(e,new Fe(t,!1))}function Ge(e,t){return new Proxy(e,new De(new Proxy(e.table,new Fe(t,!1))))}function xe(e,t){return new O.Aliased(He(e.sql,t),e.fieldAlias)}function He(e,t){return k.join(e.queryChunks.map(e=>s(e,T)?Ge(e,t):s(e,O)?He(e,t):s(e,O.Aliased)?xe(e,t):e))}class Ue{static[o]="SelectionProxyHandler";config;constructor(e){this.config={...e}}get(e,t){if("_"===t)return{...e._,selectedFields:new Proxy(e._.selectedFields,this)};if(t===R)return{...e[R],selectedFields:new Proxy(e[R].selectedFields,this)};if("symbol"==typeof t)return e[t];const n=(s(e,w)?e._.selectedFields:s(e,V)?e[R].selectedFields:e)[t];if(s(n,O.Aliased)){if("sql"===this.config.sqlAliasedBehavior&&!n.isSelectionField)return n.sql;const e=n.clone();return e.isSelectionField=!0,e}if(s(n,O)){if("sql"===this.config.sqlBehavior)return n;throw new Error(`You tried to reference "${t}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}return s(n,T)?this.config.alias?new Proxy(n,new De(new Proxy(n.table,new Fe(this.config.alias,this.config.replaceOriginalName??!1)))):n:"object"!=typeof n||null===n?n:new Proxy(n,new Ue(this.config))}}class Ve{static[o]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch(e){return this.then(void 0,e)}finally(e){return this.then(t=>(e?.(),t),t=>{throw e?.(),t})}then(e,t){return this.execute().then(e,t)}}class $e{static[o]="SQLiteForeignKeyBuilder";reference;_onUpdate;_onDelete;constructor(e,t){this.reference=()=>{const{name:t,columns:n,foreignColumns:r}=e();return{name:t,columns:n,foreignTable:r[0].table,foreignColumns:r}},t&&(this._onUpdate=t.onUpdate,this._onDelete=t.onDelete)}onUpdate(e){return this._onUpdate=e,this}onDelete(e){return this._onDelete=e,this}build(e){return new je(e,this)}}class je{constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}static[o]="SQLiteForeignKey";reference;onUpdate;onDelete;getName(){const{name:e,columns:t,foreignColumns:n}=this.reference(),r=t.map(e=>e.name),i=n.map(e=>e.name),a=[this.table[d],...r,n[0].table[d],...i];return e??`${a.join("_")}_fk`}}class We extends v{static[o]="SQLiteColumnBuilder";foreignKeyConfigs=[];references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e){return this.config.isUnique=!0,this.config.uniqueName=e,this}generatedAlwaysAs(e,t){return this.config.generated={as:e,type:"always",mode:t?.mode??"virtual"},this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:n,actions:r})=>((n,r)=>{const i=new $e(()=>{const t=n();return{columns:[e],foreignColumns:[t]}});return r.onUpdate&&i.onUpdate(r.onUpdate),r.onDelete&&i.onDelete(r.onDelete),i.build(t)})(n,r))}}class Xe extends T{constructor(e,t){t.uniqueName||(t.uniqueName=function(e,t){return`${e[d]}_${t.join("_")}_unique`}(e,[t.name])),super(e,t),this.table=e}static[o]="SQLiteColumn"}class Ke extends We{static[o]="SQLiteBigIntBuilder";constructor(e){super(e,"bigint","SQLiteBigInt")}build(e){return new Ye(e,this.config)}}class Ye extends Xe{static[o]="SQLiteBigInt";getSQLType(){return"blob"}mapFromDriverValue(e){if("undefined"!=typeof Buffer&&Buffer.from){const t=Buffer.isBuffer(e)?e:e instanceof ArrayBuffer?Buffer.from(e):e.buffer?Buffer.from(e.buffer,e.byteOffset,e.byteLength):Buffer.from(e);return BigInt(t.toString("utf8"))}return BigInt(q.decode(e))}mapToDriverValue(e){return Buffer.from(e.toString())}}class qe extends We{static[o]="SQLiteBlobJsonBuilder";constructor(e){super(e,"json","SQLiteBlobJson")}build(e){return new Qe(e,this.config)}}class Qe extends Xe{static[o]="SQLiteBlobJson";getSQLType(){return"blob"}mapFromDriverValue(e){if("undefined"!=typeof Buffer&&Buffer.from){const t=Buffer.isBuffer(e)?e:e instanceof ArrayBuffer?Buffer.from(e):e.buffer?Buffer.from(e.buffer,e.byteOffset,e.byteLength):Buffer.from(e);return JSON.parse(t.toString("utf8"))}return JSON.parse(q.decode(e))}mapToDriverValue(e){return Buffer.from(JSON.stringify(e))}}class Je extends We{static[o]="SQLiteBlobBufferBuilder";constructor(e){super(e,"buffer","SQLiteBlobBuffer")}build(e){return new ze(e,this.config)}}class ze extends Xe{static[o]="SQLiteBlobBuffer";mapFromDriverValue(e){return Buffer.isBuffer(e)?e:Buffer.from(e)}getSQLType(){return"blob"}}function Ze(e,t){const{name:n,config:r}=Y(e,t);return"json"===r?.mode?new qe(n):"bigint"===r?.mode?new Ke(n):new Je(n)}class et extends We{static[o]="SQLiteCustomColumnBuilder";constructor(e,t,n){super(e,"custom","SQLiteCustomColumn"),this.config.fieldConfig=t,this.config.customTypeParams=n}build(e){return new tt(e,this.config)}}class tt extends Xe{static[o]="SQLiteCustomColumn";sqlName;mapTo;mapFrom;constructor(e,t){super(e,t),this.sqlName=t.customTypeParams.dataType(t.fieldConfig),this.mapTo=t.customTypeParams.toDriver,this.mapFrom=t.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(e){return"function"==typeof this.mapFrom?this.mapFrom(e):e}mapToDriverValue(e){return"function"==typeof this.mapTo?this.mapTo(e):e}}function nt(e){return(t,n)=>{const{name:r,config:i}=Y(t,n);return new et(r,i,e)}}class rt extends We{static[o]="SQLiteBaseIntegerBuilder";constructor(e,t,n){super(e,t,n),this.config.autoIncrement=!1}primaryKey(e){return e?.autoIncrement&&(this.config.autoIncrement=!0),this.config.hasDefault=!0,super.primaryKey()}}class it extends Xe{static[o]="SQLiteBaseInteger";autoIncrement=this.config.autoIncrement;getSQLType(){return"integer"}}class at extends rt{static[o]="SQLiteIntegerBuilder";constructor(e){super(e,"number","SQLiteInteger")}build(e){return new ot(e,this.config)}}class ot extends it{static[o]="SQLiteInteger"}class st extends rt{static[o]="SQLiteTimestampBuilder";constructor(e,t){super(e,"date","SQLiteTimestamp"),this.config.mode=t}defaultNow(){return this.default(k`(cast((julianday('now') - 2440587.5)*86400000 as integer))`)}build(e){return new ct(e,this.config)}}class ct extends it{static[o]="SQLiteTimestamp";mode=this.config.mode;mapFromDriverValue(e){return"timestamp"===this.config.mode?new Date(1e3*e):new Date(e)}mapToDriverValue(e){const t=e.getTime();return"timestamp"===this.config.mode?Math.floor(t/1e3):t}}class lt extends rt{static[o]="SQLiteBooleanBuilder";constructor(e,t){super(e,"boolean","SQLiteBoolean"),this.config.mode=t}build(e){return new ut(e,this.config)}}class ut extends it{static[o]="SQLiteBoolean";mode=this.config.mode;mapFromDriverValue(e){return 1===Number(e)}mapToDriverValue(e){return e?1:0}}function dt(e,t){const{name:n,config:r}=Y(e,t);return"timestamp"===r?.mode||"timestamp_ms"===r?.mode?new st(n,r.mode):"boolean"===r?.mode?new lt(n,r.mode):new at(n)}class pt extends We{static[o]="SQLiteNumericBuilder";constructor(e){super(e,"string","SQLiteNumeric")}build(e){return new ht(e,this.config)}}class ht extends Xe{static[o]="SQLiteNumeric";mapFromDriverValue(e){return"string"==typeof e?e:String(e)}getSQLType(){return"numeric"}}class ft extends We{static[o]="SQLiteNumericNumberBuilder";constructor(e){super(e,"number","SQLiteNumericNumber")}build(e){return new mt(e,this.config)}}class mt extends Xe{static[o]="SQLiteNumericNumber";mapFromDriverValue(e){return"number"==typeof e?e:Number(e)}mapToDriverValue=String;getSQLType(){return"numeric"}}class gt extends We{static[o]="SQLiteNumericBigIntBuilder";constructor(e){super(e,"bigint","SQLiteNumericBigInt")}build(e){return new yt(e,this.config)}}class yt extends Xe{static[o]="SQLiteNumericBigInt";mapFromDriverValue=BigInt;mapToDriverValue=String;getSQLType(){return"numeric"}}function It(e,t){const{name:n,config:r}=Y(e,t),i=r?.mode;return"number"===i?new ft(n):"bigint"===i?new gt(n):new pt(n)}class Ct extends We{static[o]="SQLiteRealBuilder";constructor(e){super(e,"number","SQLiteReal")}build(e){return new At(e,this.config)}}class At extends Xe{static[o]="SQLiteReal";getSQLType(){return"real"}}function St(e){return new Ct(e??"")}class bt extends We{static[o]="SQLiteTextBuilder";constructor(e,t){super(e,"string","SQLiteText"),this.config.enumValues=t.enum,this.config.length=t.length}build(e){return new Tt(e,this.config)}}class Tt extends Xe{static[o]="SQLiteText";enumValues=this.config.enumValues;length=this.config.length;constructor(e,t){super(e,t)}getSQLType(){return"text"+(this.config.length?`(${this.config.length})`:"")}}class vt extends We{static[o]="SQLiteTextJsonBuilder";constructor(e){super(e,"json","SQLiteTextJson")}build(e){return new _t(e,this.config)}}class _t extends Xe{static[o]="SQLiteTextJson";getSQLType(){return"text"}mapFromDriverValue(e){return JSON.parse(e)}mapToDriverValue(e){return JSON.stringify(e)}}function wt(e,t={}){const{name:n,config:r}=Y(e,t);return"json"===r.mode?new vt(n):new bt(n,r)}const Et=Symbol.for("drizzle:SQLiteInlineForeignKeys");class Pt extends A{static[o]="SQLiteTable";static Symbol=Object.assign({},A.Symbol,{InlineForeignKeys:Et});[A.Symbol.Columns];[Et]=[];[A.Symbol.ExtraConfigBuilder]=void 0}function Rt(e,t,n,r,i=e){const a=new Pt(e,r,i),o="function"==typeof t?t({blob:Ze,customType:nt,integer:dt,numeric:It,real:St,text:wt}):t,s=Object.fromEntries(Object.entries(o).map(([e,t])=>{const n=t;n.setName(e);const r=n.build(a);return a[Et].push(...n.buildForeignKeys(r,a)),[e,r]})),c=Object.assign(a,s);return c[A.Symbol.Columns]=s,c[A.Symbol.ExtraConfigColumns]=s,c}const Lt=(e,t,n)=>Rt(e,t);function Nt(e){return s(e,Pt)?[`${e[A.Symbol.BaseName]}`]:s(e,w)?e._.usedTables??[]:s(e,O)?e.usedTables??[]:[]}class Ot extends Ve{constructor(e,t,n,r){super(),this.table=e,this.session=t,this.dialect=n,this.config={table:e,withList:r}}static[o]="SQLiteDelete";config;where(e){return this.config.where=e,this}orderBy(...e){if("function"==typeof e[0]){const t=e[0](new Proxy(this.config.table[A.Symbol.Columns],new Ue({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),n=Array.isArray(t)?t:[t];this.config.orderBy=n}else{const t=e;this.config.orderBy=t}return this}limit(e){return this.config.limit=e,this}returning(e=this.table[Pt.Symbol.Columns]){return this.config.returning=j(e),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){const{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=!0){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"delete",tables:Nt(this.config.table)})}prepare(){return this._prepare(!1)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(e){return this._prepare().execute(e)}$dynamic(){return this}}function Bt(e){return(e.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map(e=>e.toLowerCase()).join("_")}function Mt(e){return(e.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((e,t,n)=>e+(0===n?t.toLowerCase():`${t[0].toUpperCase()}${t.slice(1)}`),"")}function Dt(e){return e}class Ft{static[o]="CasingCache";cache={};cachedTables={};convert;constructor(e){this.convert="snake_case"===e?Bt:"camelCase"===e?Mt:Dt}getColumnCasing(e){if(!e.keyAsName)return e.name;const t=`${e.table[A.Symbol.Schema]??"public"}.${e.table[A.Symbol.OriginalName]}.${e.name}`;return this.cache[t]||this.cacheTable(e.table),this.cache[t]}cacheTable(e){const t=`${e[A.Symbol.Schema]??"public"}.${e[A.Symbol.OriginalName]}`;if(!this.cachedTables[t]){for(const n of Object.values(e[A.Symbol.Columns])){const e=`${t}.${n.name}`;this.cache[e]=this.convert(n.name)}this.cachedTables[t]=!0}}clearCache(){this.cache={},this.cachedTables={}}}class kt extends Error{static[o]="DrizzleError";constructor({message:e,cause:t}){super(e),this.name="DrizzleError",this.cause=t}}class Gt extends Error{constructor(e,t,n){super(`Failed query: ${e}\nparams: ${t}`),this.query=e,this.params=t,this.cause=n,Error.captureStackTrace(this,Gt),n&&(this.cause=n)}}class xt extends kt{static[o]="TransactionRollbackError";constructor(){super({message:"Rollback"})}}class Ht extends V{static[o]="SQLiteViewBase"}class Ut{static[o]="SQLiteDialect";casing;constructor(e){this.casing=new Ft(e?.casing)}escapeName(e){return`"${e.replace(/"/g,'""')}"`}escapeParam(e){return"?"}escapeString(e){return`'${e.replace(/'/g,"''")}'`}buildWithCTE(e){if(!e?.length)return;const t=[k`with `];for(const[n,r]of e.entries())t.push(k`${k.identifier(r._.alias)} as (${r._.sql})`),n<e.length-1&&t.push(k`, `);return t.push(k` `),k.join(t)}buildDeleteQuery({table:e,where:t,returning:n,withList:r,limit:i,orderBy:a}){return k`${this.buildWithCTE(r)}delete from ${e}${t?k` where ${t}`:void 0}${n?k` returning ${this.buildSelection(n,{isSingleTable:!0})}`:void 0}${this.buildOrderBy(a)}${this.buildLimit(i)}`}buildUpdateSet(e,t){const n=e[A.Symbol.Columns],r=Object.keys(n).filter(e=>void 0!==t[e]||void 0!==n[e]?.onUpdateFn),i=r.length;return k.join(r.flatMap((e,r)=>{const a=n[e],o=a.onUpdateFn?.(),c=t[e]??(s(o,O)?o:k.param(o,a)),l=k`${k.identifier(this.casing.getColumnCasing(a))} = ${c}`;return r<i-1?[l,k.raw(", ")]:[l]}))}buildUpdateQuery({table:e,set:t,where:n,returning:r,withList:i,joins:a,from:o,limit:s,orderBy:c}){const l=this.buildWithCTE(i),u=this.buildUpdateSet(e,t),d=o&&k.join([k.raw(" from "),this.buildFromTable(o)]);return k`${l}update ${e} set ${u}${d}${this.buildJoins(a)}${n?k` where ${n}`:void 0}${r?k` returning ${this.buildSelection(r,{isSingleTable:!0})}`:void 0}${this.buildOrderBy(c)}${this.buildLimit(s)}`}buildSelection(e,{isSingleTable:t=!1}={}){const n=e.length,r=e.flatMap(({field:e},r)=>{const i=[];if(s(e,O.Aliased)&&e.isSelectionField)i.push(k.identifier(e.fieldAlias));else if(s(e,O.Aliased)||s(e,O)){const n=s(e,O.Aliased)?e.sql:e;t?i.push(new O(n.queryChunks.map(e=>s(e,T)?k.identifier(this.casing.getColumnCasing(e)):e))):i.push(n),s(e,O.Aliased)&&i.push(k` as ${k.identifier(e.fieldAlias)}`)}else if(s(e,T)){const n=e.table[A.Symbol.Name];"SQLiteNumericBigInt"===e.columnType?t?i.push(k`cast(${k.identifier(this.casing.getColumnCasing(e))} as text)`):i.push(k`cast(${k.identifier(n)}.${k.identifier(this.casing.getColumnCasing(e))} as text)`):t?i.push(k.identifier(this.casing.getColumnCasing(e))):i.push(k`${k.identifier(n)}.${k.identifier(this.casing.getColumnCasing(e))}`)}else if(s(e,w)){const t=Object.entries(e._.selectedFields);if(1===t.length){const n=t[0][1],r=s(n,O)?n.decoder:s(n,T)?{mapFromDriverValue:e=>n.mapFromDriverValue(e)}:n.sql.decoder;r&&(e._.sql.decoder=r)}i.push(e)}return r<n-1&&i.push(k`, `),i});return k.join(r)}buildJoins(e){if(!e||0===e.length)return;const t=[];if(e)for(const[n,r]of e.entries()){0===n&&t.push(k` `);const i=r.table,a=r.on?k` on ${r.on}`:void 0;if(s(i,Pt)){const e=i[Pt.Symbol.Name],n=i[Pt.Symbol.Schema],o=i[Pt.Symbol.OriginalName],s=e===o?void 0:r.alias;t.push(k`${k.raw(r.joinType)} join ${n?k`${k.identifier(n)}.`:void 0}${k.identifier(o)}${s&&k` ${k.identifier(s)}`}${a}`)}else t.push(k`${k.raw(r.joinType)} join ${i}${a}`);n<e.length-1&&t.push(k` `)}return k.join(t)}buildLimit(e){return"object"==typeof e||"number"==typeof e&&e>=0?k` limit ${e}`:void 0}buildOrderBy(e){const t=[];if(e)for(const[n,r]of e.entries())t.push(r),n<e.length-1&&t.push(k`, `);return t.length>0?k` order by ${k.join(t)}`:void 0}buildFromTable(e){return s(e,A)&&e[A.Symbol.IsAlias]?k`${k`${k.identifier(e[A.Symbol.Schema]??"")}.`.if(e[A.Symbol.Schema])}${k.identifier(e[A.Symbol.OriginalName])} ${k.identifier(e[A.Symbol.Name])}`:e}buildSelectQuery({withList:e,fields:t,fieldsFlat:n,where:r,having:i,table:a,joins:o,orderBy:c,groupBy:l,limit:u,offset:d,distinct:p,setOperators:h}){const f=n??j(t);for(const N of f)if(s(N.field,T)&&S(N.field.table)!==(s(a,w)?a._.alias:s(a,Ht)?a[R].name:s(a,O)?void 0:S(a))&&!(e=>o?.some(({alias:t})=>t===(e[A.Symbol.IsAlias]?S(e):e[A.Symbol.BaseName])))(N.field.table)){const e=S(N.field.table);throw new Error(`Your "${N.path.join("->")}" field references a column "${e}"."${N.field.name}", but the table "${e}" is not part of the query! Did you forget to join it?`)}const m=!o||0===o.length,g=this.buildWithCTE(e),y=p?k` distinct`:void 0,I=this.buildSelection(f,{isSingleTable:m}),C=this.buildFromTable(a),b=this.buildJoins(o),v=r?k` where ${r}`:void 0,_=i?k` having ${i}`:void 0,E=[];if(l)for(const[s,A]of l.entries())E.push(A),s<l.length-1&&E.push(k`, `);const P=E.length>0?k` group by ${k.join(E)}`:void 0,L=k`${g}select${y} ${I} from ${C}${b}${v}${P}${_}${this.buildOrderBy(c)}${this.buildLimit(u)}${d?k` offset ${d}`:void 0}`;return h.length>0?this.buildSetOperations(L,h):L}buildSetOperations(e,t){const[n,...r]=t;if(!n)throw new Error("Cannot pass undefined values to any set operator");return 0===r.length?this.buildSetOperationQuery({leftSelect:e,setOperator:n}):this.buildSetOperations(this.buildSetOperationQuery({leftSelect:e,setOperator:n}),r)}buildSetOperationQuery({leftSelect:e,setOperator:{type:t,isAll:n,rightSelect:r,limit:i,orderBy:a,offset:o}}){const c=k`${e.getSQL()} `,l=k`${r.getSQL()}`;let u;if(a&&a.length>0){const e=[];for(const t of a)if(s(t,Xe))e.push(k.identifier(t.name));else if(s(t,O)){for(let e=0;e<t.queryChunks.length;e++){const n=t.queryChunks[e];s(n,Xe)&&(t.queryChunks[e]=k.identifier(this.casing.getColumnCasing(n)))}e.push(k`${t}`)}else e.push(k`${t}`);u=k` order by ${k.join(e,k`, `)}`}const d="object"==typeof i||"number"==typeof i&&i>=0?k` limit ${i}`:void 0,p=k.raw(`${t} ${n?"all ":""}`);return k`${c}${p}${l}${u}${d}${o?k` offset ${o}`:void 0}`}buildInsertQuery({table:e,values:t,onConflict:n,returning:r,withList:i,select:a}){const o=[],c=e[A.Symbol.Columns],l=Object.entries(c).filter(([e,t])=>!t.shouldDisableInsert()),u=l.map(([,e])=>k.identifier(this.casing.getColumnCasing(e)));if(a){const e=t;s(e,O)?o.push(e):o.push(e.getSQL())}else{const e=t;o.push(k.raw("values "));for(const[t,n]of e.entries()){const r=[];for(const[e,t]of l){const i=n[e];if(void 0===i||s(i,F)&&void 0===i.value){let e;if(null!==t.default&&void 0!==t.default)e=s(t.default,O)?t.default:k.param(t.default,t);else if(void 0!==t.defaultFn){const n=t.defaultFn();e=s(n,O)?n:k.param(n,t)}else if(t.default||void 0===t.onUpdateFn)e=k`null`;else{const n=t.onUpdateFn();e=s(n,O)?n:k.param(n,t)}r.push(e)}else r.push(i)}o.push(r),t<e.length-1&&o.push(k`, `)}}const d=this.buildWithCTE(i),p=k.join(o),h=r?k` returning ${this.buildSelection(r,{isSingleTable:!0})}`:void 0,f=n?.length?k.join(n):void 0;return k`${d}insert into ${e} ${u} ${p}${f}${h}`}sqlToQuery(e,t){return e.toQuery({casing:this.casing,escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,invokeSource:t})}buildRelationalQuery({fullSchema:e,schema:t,tableNamesMap:n,table:r,tableConfig:i,queryConfig:a,tableAlias:o,nestedQueryRelation:c,joinOn:l}){let u,d,p,h=[],f=[];const m=[];if(!0===a){h=Object.entries(i.columns).map(([e,t])=>({dbKey:t.name,tsKey:e,field:Ge(t,o),relationTableTsKey:void 0,isJson:!1,selection:[]}))}else{const r=Object.fromEntries(Object.entries(i.columns).map(([e,t])=>[e,Ge(t,o)]));if(a.where){const e="function"==typeof a.where?a.where(r,{and:ie,between:ye,eq:ne,exists:me,gt:se,gte:ce,ilike:Se,inArray:de,isNull:he,isNotNull:fe,like:Ce,lt:le,lte:ue,ne:re,not:oe,notBetween:Ie,notExists:ge,notLike:Ae,notIlike:be,notInArray:pe,or:ae,sql:k}):a.where;p=e&&He(e,o)}const c=[];let l=[];if(a.columns){let e=!1;for(const[t,n]of Object.entries(a.columns))void 0!==n&&t in i.columns&&(e||!0!==n||(e=!0),l.push(t));l.length>0&&(l=e?l.filter(e=>!0===a.columns?.[e]):Object.keys(i.columns).filter(e=>!l.includes(e)))}else l=Object.keys(i.columns);for(const e of l){const t=i.columns[e];c.push({tsKey:e,value:t})}let m,g=[];if(a.with&&(g=Object.entries(a.with).filter(e=>!!e[1]).map(([e,t])=>({tsKey:e,queryConfig:t,relation:i.relations[e]}))),a.extras){m="function"==typeof a.extras?a.extras(r,{sql:k}):a.extras;for(const[e,t]of Object.entries(m))c.push({tsKey:e,value:xe(t,o)})}for(const{tsKey:e,value:t}of c)h.push({dbKey:s(t,O.Aliased)?t.fieldAlias:i.columns[e].name,tsKey:e,field:s(t,T)?Ge(t,o):t,relationTableTsKey:void 0,isJson:!1,selection:[]});let y="function"==typeof a.orderBy?a.orderBy(r,{sql:k,asc:Te,desc:ve}):a.orderBy??[];Array.isArray(y)||(y=[y]),f=y.map(e=>s(e,T)?Ge(e,o):He(e,o)),u=a.limit,d=a.offset;for(const{tsKey:i,queryConfig:a,relation:u}of g){const r=Oe(t,n,u),c=n[b(u.referencedTable)],l=`${o}_${i}`,d=ie(...r.fields.map((e,t)=>ne(Ge(r.references[t],l),Ge(e,o)))),p=this.buildRelationalQuery({fullSchema:e,schema:t,tableNamesMap:n,table:e[c],tableConfig:t[c],queryConfig:s(u,Ee)?!0===a?{limit:1}:{...a,limit:1}:a,tableAlias:l,joinOn:d,nestedQueryRelation:u}),f=k`(${p.sql})`.as(i);h.push({dbKey:i,tsKey:i,field:f,relationTableTsKey:c,isJson:!0,selection:p.selection})}}if(0===h.length)throw new kt({message:`No fields selected for table "${i.tsName}" ("${o}"). You need to have at least one item in "columns", "with" or "extras". If you need to select all columns, omit the "columns" key or set it to undefined.`});let g;if(p=ie(l,p),c){let e=k`json_array(${k.join(h.map(({field:e})=>s(e,Xe)?k.identifier(this.casing.getColumnCasing(e)):s(e,O.Aliased)?e.sql:e),k`, `)})`;s(c,Pe)&&(e=k`coalesce(json_group_array(${e}), json_array())`);const t=[{dbKey:"data",tsKey:"data",field:e.as("data"),isJson:!0,relationTableTsKey:i.tsName,selection:h}];void 0!==u||void 0!==d||f.length>0?(g=this.buildSelectQuery({table:ke(r,o),fields:{},fieldsFlat:[{path:[],field:k.raw("*")}],where:p,limit:u,offset:d,orderBy:f,setOperators:[]}),p=void 0,u=void 0,d=void 0,f=void 0):g=ke(r,o),g=this.buildSelectQuery({table:s(g,Pt)?g:new w(g,{},o),fields:{},fieldsFlat:t.map(({field:e})=>({path:[],field:s(e,T)?Ge(e,o):e})),joins:m,where:p,limit:u,offset:d,orderBy:f,setOperators:[]})}else g=this.buildSelectQuery({table:ke(r,o),fields:{},fieldsFlat:h.map(({field:e})=>({path:[],field:s(e,T)?Ge(e,o):e})),joins:m,where:p,limit:u,offset:d,orderBy:f,setOperators:[]});return{tableTsKey:i.tsName,sql:g,selection:h}}}class Vt extends Ut{static[o]="SQLiteSyncDialect";migrate(e,t,n){const r=void 0===n||"string"==typeof n?"__drizzle_migrations":n.migrationsTable??"__drizzle_migrations",i=k`
2
- CREATE TABLE IF NOT EXISTS ${k.identifier(r)} (
3
- id SERIAL PRIMARY KEY,
4
- hash text NOT NULL,
5
- created_at numeric
6
- )
7
- `;t.run(i);const a=t.values(k`SELECT id, hash, created_at FROM ${k.identifier(r)} ORDER BY created_at DESC LIMIT 1`)[0]??void 0;t.run(k`BEGIN`);try{for(const n of e)if(!a||Number(a[2])<n.folderMillis){for(const e of n.sql)t.run(k.raw(e));t.run(k`INSERT INTO ${k.identifier(r)} ("hash", "created_at") VALUES(${n.hash}, ${n.folderMillis})`)}t.run(k`COMMIT`)}catch(o){throw t.run(k`ROLLBACK`),o}}}class $t extends Ut{static[o]="SQLiteAsyncDialect";async migrate(e,t,n){const r=void 0===n||"string"==typeof n?"__drizzle_migrations":n.migrationsTable??"__drizzle_migrations",i=k`
8
- CREATE TABLE IF NOT EXISTS ${k.identifier(r)} (
9
- id SERIAL PRIMARY KEY,
10
- hash text NOT NULL,
11
- created_at numeric
12
- )
13
- `;await t.run(i);const a=(await t.values(k`SELECT id, hash, created_at FROM ${k.identifier(r)} ORDER BY created_at DESC LIMIT 1`))[0]??void 0;await t.transaction(async t=>{for(const n of e)if(!a||Number(a[2])<n.folderMillis){for(const e of n.sql)await t.run(k.raw(e));await t.run(k`INSERT INTO ${k.identifier(r)} ("hash", "created_at") VALUES(${n.hash}, ${n.folderMillis})`)}})}}class jt{static[o]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}}class Wt{static[o]="SQLiteSelectBuilder";fields;session;dialect;withList;distinct;constructor(e){this.fields=e.fields,this.session=e.session,this.dialect=e.dialect,this.withList=e.withList,this.distinct=e.distinct}from(e){const t=!!this.fields;let n;return n=this.fields?this.fields:s(e,w)?Object.fromEntries(Object.keys(e._.selectedFields).map(t=>[t,e[t]])):s(e,Ht)?e[R].selectedFields:s(e,O)?{}:e[A.Symbol.Columns],new Kt({table:e,fields:n,isPartialSelect:t,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct})}}class Xt extends jt{static[o]="SQLiteSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;cacheConfig=void 0;usedTables=new Set;constructor({table:e,fields:t,isPartialSelect:n,session:r,dialect:i,withList:a,distinct:o}){super(),this.config={withList:a,table:e,fields:{...t},distinct:o,setOperators:[]},this.isPartialSelect=n,this.session=r,this.dialect=i,this._={selectedFields:t,config:this.config},this.tableName=K(e),this.joinsNotNullableMap="string"==typeof this.tableName?{[this.tableName]:!0}:{};for(const s of Nt(e))this.usedTables.add(s)}getUsedTables(){return[...this.usedTables]}createJoin(e){return(t,n)=>{const r=this.tableName,i=K(t);for(const e of Nt(t))this.usedTables.add(e);if("string"==typeof i&&this.config.joins?.some(e=>e.alias===i))throw new Error(`Alias "${i}" is already used in this query`);if(!this.isPartialSelect&&(1===Object.keys(this.joinsNotNullableMap).length&&"string"==typeof r&&(this.config.fields={[r]:this.config.fields}),"string"==typeof i&&!s(t,O))){const e=s(t,w)?t._.selectedFields:s(t,V)?t[R].selectedFields:t[A.Symbol.Columns];this.config.fields[i]=e}if("function"==typeof n&&(n=n(new Proxy(this.config.fields,new Ue({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.joins||(this.config.joins=[]),this.config.joins.push({on:n,table:t,joinType:e,alias:i}),"string"==typeof i)switch(e){case"left":this.joinsNotNullableMap[i]=!1;break;case"right":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[i]=!0;break;case"cross":case"inner":this.joinsNotNullableMap[i]=!0;break;case"full":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[i]=!1}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");crossJoin=this.createJoin("cross");createSetOperator(e,t){return n=>{const r="function"==typeof n?n(qt()):n;if(!W(this.getSelectedFields(),r.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:e,isAll:t,rightSelect:r}),this}}union=this.createSetOperator("union",!1);unionAll=this.createSetOperator("union",!0);intersect=this.createSetOperator("intersect",!1);except=this.createSetOperator("except",!1);addSetOperators(e){return this.config.setOperators.push(...e),this}where(e){return"function"==typeof e&&(e=e(new Proxy(this.config.fields,new Ue({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.where=e,this}having(e){return"function"==typeof e&&(e=e(new Proxy(this.config.fields,new Ue({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.having=e,this}groupBy(...e){if("function"==typeof e[0]){const t=e[0](new Proxy(this.config.fields,new Ue({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(t)?t:[t]}else this.config.groupBy=e;return this}orderBy(...e){if("function"==typeof e[0]){const t=e[0](new Proxy(this.config.fields,new Ue({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),n=Array.isArray(t)?t:[t];this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=n:this.config.orderBy=n}else{const t=e;this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=t:this.config.orderBy=t}return this}limit(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).limit=e:this.config.limit=e,this}offset(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).offset=e:this.config.offset=e,this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){const{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}as(e){const t=[];if(t.push(...Nt(this.config.table)),this.config.joins)for(const n of this.config.joins)t.push(...Nt(n.table));return new Proxy(new w(this.getSQL(),this.config.fields,e,!1,[...new Set(t)]),new Ue({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new Ue({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}}class Kt extends Xt{static[o]="SQLiteSelect";_prepare(e=!0){if(!this.session)throw new Error("Cannot execute a query on a query builder. Please use a database instance instead.");const t=j(this.config.fields),n=this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),t,"all",!0,void 0,{type:"select",tables:[...this.usedTables]},this.cacheConfig);return n.joinsNotNullableMap=this.joinsNotNullableMap,n}$withCache(e){return this.cacheConfig=void 0===e?{config:{},enable:!0,autoInvalidate:!0}:!1===e?{enable:!1}:{enable:!0,autoInvalidate:!0,...e},this}prepare(){return this._prepare(!1)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this.all()}}function Yt(e,t){return(n,r,...i)=>{const a=[r,...i].map(n=>({type:e,isAll:t,rightSelect:n}));for(const e of a)if(!W(n.getSelectedFields(),e.rightSelect.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return n.addSetOperators(a)}}!function(e,t){for(const n of t)for(const t of Object.getOwnPropertyNames(n.prototype))"constructor"!==t&&Object.defineProperty(e.prototype,t,Object.getOwnPropertyDescriptor(n.prototype,t)||Object.create(null))}(Kt,[Ve]);const qt=()=>({union:Qt,unionAll:Jt,intersect:zt,except:Zt}),Qt=Yt("union",!1),Jt=Yt("union",!0),zt=Yt("intersect",!1),Zt=Yt("except",!1);class en{static[o]="SQLiteQueryBuilder";dialect;dialectConfig;constructor(e){this.dialect=s(e,Ut)?e:void 0,this.dialectConfig=s(e,Ut)?void 0:e}$with=(e,t)=>{const n=this;return{as:r=>("function"==typeof r&&(r=r(n)),new Proxy(new E(r.getSQL(),t??("getSelectedFields"in r?r.getSelectedFields()??{}:{}),e,!0),new Ue({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}};with(...e){const t=this;return{select:function(n){return new Wt({fields:n??void 0,session:void 0,dialect:t.getDialect(),withList:e})},selectDistinct:function(n){return new Wt({fields:n??void 0,session:void 0,dialect:t.getDialect(),withList:e,distinct:!0})}}}select(e){return new Wt({fields:e??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct(e){return new Wt({fields:e??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}getDialect(){return this.dialect||(this.dialect=new Vt(this.dialectConfig)),this.dialect}}class tn{constructor(e,t,n,r){this.table=e,this.session=t,this.dialect=n,this.withList=r}static[o]="SQLiteInsertBuilder";values(e){if(0===(e=Array.isArray(e)?e:[e]).length)throw new Error("values() must be called with at least one value");const t=e.map(e=>{const t={},n=this.table[A.Symbol.Columns];for(const r of Object.keys(e)){const i=e[r];t[r]=s(i,O)?i:new F(i,n[r])}return t});return new nn(this.table,t,this.session,this.dialect,this.withList)}select(e){const t="function"==typeof e?e(new en):e;if(!s(t,O)&&!W(this.table[h],t._.selectedFields))throw new Error("Insert select error: selected fields are not the same or are in a different order compared to the table definition");return new nn(this.table,t,this.session,this.dialect,this.withList,!0)}}class nn extends Ve{constructor(e,t,n,r,i,a){super(),this.session=n,this.dialect=r,this.config={table:e,values:t,withList:i,select:a}}static[o]="SQLiteInsert";config;returning(e=this.config.table[Pt.Symbol.Columns]){return this.config.returning=j(e),this}onConflictDoNothing(e={}){if(this.config.onConflict||(this.config.onConflict=[]),void 0===e.target)this.config.onConflict.push(k` on conflict do nothing`);else{const t=Array.isArray(e.target)?k`${e.target}`:k`${[e.target]}`,n=e.where?k` where ${e.where}`:k``;this.config.onConflict.push(k` on conflict ${t} do nothing${n}`)}return this}onConflictDoUpdate(e){if(e.where&&(e.targetWhere||e.setWhere))throw new Error('You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.');this.config.onConflict||(this.config.onConflict=[]);const t=e.where?k` where ${e.where}`:void 0,n=e.targetWhere?k` where ${e.targetWhere}`:void 0,r=e.setWhere?k` where ${e.setWhere}`:void 0,i=Array.isArray(e.target)?k`${e.target}`:k`${[e.target]}`,a=this.dialect.buildUpdateSet(this.config.table,X(this.config.table,e.set));return this.config.onConflict.push(k` on conflict ${i}${n} do update set ${a}${t}${r}`),this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){const{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=!0){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"insert",tables:Nt(this.config.table)})}prepare(){return this._prepare(!1)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}}class rn{constructor(e,t,n,r){this.table=e,this.session=t,this.dialect=n,this.withList=r}static[o]="SQLiteUpdateBuilder";set(e){return new an(this.table,X(this.table,e),this.session,this.dialect,this.withList)}}class an extends Ve{constructor(e,t,n,r,i){super(),this.session=n,this.dialect=r,this.config={set:t,table:e,withList:i,joins:[]}}static[o]="SQLiteUpdate";config;from(e){return this.config.from=e,this}createJoin(e){return(t,n)=>{const r=K(t);if("string"==typeof r&&this.config.joins.some(e=>e.alias===r))throw new Error(`Alias "${r}" is already used in this query`);if("function"==typeof n){const e=this.config.from?s(t,Pt)?t[A.Symbol.Columns]:s(t,w)?t._.selectedFields:s(t,Ht)?t[R].selectedFields:void 0:void 0;n=n(new Proxy(this.config.table[A.Symbol.Columns],new Ue({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),e&&new Proxy(e,new Ue({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))}return this.config.joins.push({on:n,table:t,joinType:e,alias:r}),this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");where(e){return this.config.where=e,this}orderBy(...e){if("function"==typeof e[0]){const t=e[0](new Proxy(this.config.table[A.Symbol.Columns],new Ue({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),n=Array.isArray(t)?t:[t];this.config.orderBy=n}else{const t=e;this.config.orderBy=t}return this}limit(e){return this.config.limit=e,this}returning(e=this.config.table[Pt.Symbol.Columns]){return this.config.returning=j(e),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){const{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=!0){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"insert",tables:Nt(this.config.table)})}prepare(){return this._prepare(!1)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}}class on extends O{constructor(e){super(on.buildEmbeddedCount(e.source,e.filters).queryChunks),this.params=e,this.session=e.session,this.sql=on.buildCount(e.source,e.filters)}sql;static[o]="SQLiteCountBuilderAsync";[Symbol.toStringTag]="SQLiteCountBuilderAsync";session;static buildEmbeddedCount(e,t){return k`(select count(*) from ${e}${k.raw(" where ").if(t)}${t})`}static buildCount(e,t){return k`select count(*) from ${e}${k.raw(" where ").if(t)}${t}`}then(e,t){return Promise.resolve(this.session.count(this.sql)).then(e,t)}catch(e){return this.then(void 0,e)}finally(e){return this.then(t=>(e?.(),t),t=>{throw e?.(),t})}}class sn{constructor(e,t,n,r,i,a,o,s){this.mode=e,this.fullSchema=t,this.schema=n,this.tableNamesMap=r,this.table=i,this.tableConfig=a,this.dialect=o,this.session=s}static[o]="SQLiteAsyncRelationalQueryBuilder";findMany(e){return"sync"===this.mode?new ln(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e||{},"many"):new cn(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e||{},"many")}findFirst(e){return"sync"===this.mode?new ln(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?{...e,limit:1}:{limit:1},"first"):new cn(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?{...e,limit:1}:{limit:1},"first")}}class cn extends Ve{constructor(e,t,n,r,i,a,o,s,c){super(),this.fullSchema=e,this.schema=t,this.tableNamesMap=n,this.table=r,this.tableConfig=i,this.dialect=a,this.session=o,this.config=s,this.mode=c}static[o]="SQLiteAsyncRelationalQuery";mode;getSQL(){return this.dialect.buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName}).sql}_prepare(e=!1){const{query:t,builtQuery:n}=this._toSQL();return this.session[e?"prepareOneTimeQuery":"prepareQuery"](n,void 0,"first"===this.mode?"get":"all",!0,(e,n)=>{const r=e.map(e=>Me(this.schema,this.tableConfig,e,t.selection,n));return"first"===this.mode?r[0]:r})}prepare(){return this._prepare(!1)}_toSQL(){const e=this.dialect.buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName});return{query:e,builtQuery:this.dialect.sqlToQuery(e.sql)}}toSQL(){return this._toSQL().builtQuery}executeRaw(){return"first"===this.mode?this._prepare(!1).get():this._prepare(!1).all()}async execute(){return this.executeRaw()}}class ln extends cn{static[o]="SQLiteSyncRelationalQuery";sync(){return this.executeRaw()}}class un extends Ve{constructor(e,t,n,r,i){super(),this.execute=e,this.getSQL=t,this.dialect=r,this.mapBatchResult=i,this.config={action:n}}static[o]="SQLiteRaw";config;getQuery(){return{...this.dialect.sqlToQuery(this.getSQL()),method:this.config.action}}mapResult(e,t){return t?this.mapBatchResult(e):e}_prepare(){return this}isResponseInArrayMode(){return!1}}class dn{constructor(e,t,n,r){this.resultKind=e,this.dialect=t,this.session=n,this._=r?{schema:r.schema,fullSchema:r.fullSchema,tableNamesMap:r.tableNamesMap}:{schema:void 0,fullSchema:{},tableNamesMap:{}},this.query={};const i=this.query;if(this._.schema)for(const[a,o]of Object.entries(this._.schema))i[a]=new sn(e,r.fullSchema,this._.schema,this._.tableNamesMap,r.fullSchema[a],o,t,n);this.$cache={invalidate:async e=>{}}}static[o]="BaseSQLiteDatabase";query;$with=(e,t)=>{const n=this;return{as:r=>("function"==typeof r&&(r=r(new en(n.dialect))),new Proxy(new E(r.getSQL(),t??("getSelectedFields"in r?r.getSelectedFields()??{}:{}),e,!0),new Ue({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}};$count(e,t){return new on({source:e,filters:t,session:this.session})}with(...e){const t=this;return{select:function(n){return new Wt({fields:n??void 0,session:t.session,dialect:t.dialect,withList:e})},selectDistinct:function(n){return new Wt({fields:n??void 0,session:t.session,dialect:t.dialect,withList:e,distinct:!0})},update:function(n){return new rn(n,t.session,t.dialect,e)},insert:function(n){return new tn(n,t.session,t.dialect,e)},delete:function(n){return new Ot(n,t.session,t.dialect,e)}}}select(e){return new Wt({fields:e??void 0,session:this.session,dialect:this.dialect})}selectDistinct(e){return new Wt({fields:e??void 0,session:this.session,dialect:this.dialect,distinct:!0})}update(e){return new rn(e,this.session,this.dialect)}$cache;insert(e){return new tn(e,this.session,this.dialect)}delete(e){return new Ot(e,this.session,this.dialect)}run(e){const t="string"==typeof e?k.raw(e):e.getSQL();return"async"===this.resultKind?new un(async()=>this.session.run(t),()=>t,"run",this.dialect,this.session.extractRawRunValueFromBatchResult.bind(this.session)):this.session.run(t)}all(e){const t="string"==typeof e?k.raw(e):e.getSQL();return"async"===this.resultKind?new un(async()=>this.session.all(t),()=>t,"all",this.dialect,this.session.extractRawAllValueFromBatchResult.bind(this.session)):this.session.all(t)}get(e){const t="string"==typeof e?k.raw(e):e.getSQL();return"async"===this.resultKind?new un(async()=>this.session.get(t),()=>t,"get",this.dialect,this.session.extractRawGetValueFromBatchResult.bind(this.session)):this.session.get(t)}values(e){const t="string"==typeof e?k.raw(e):e.getSQL();return"async"===this.resultKind?new un(async()=>this.session.values(t),()=>t,"values",this.dialect,this.session.extractRawValuesValueFromBatchResult.bind(this.session)):this.session.values(t)}transaction(e,t){return this.session.transaction(e,t)}}class pn{static[o]="Cache"}class hn extends pn{strategy(){return"all"}static[o]="NoopCache";async get(e){}async put(e,t,n,r){}async onMutate(e){}}async function fn(e,t){const n=`${e}-${JSON.stringify(t)}`,r=(new TextEncoder).encode(n),i=await crypto.subtle.digest("SHA-256",r);return[...new Uint8Array(i)].map(e=>e.toString(16).padStart(2,"0")).join("")}class mn extends Ve{constructor(e){super(),this.resultCb=e}static[o]="ExecuteResultSync";async execute(){return this.resultCb()}sync(){return this.resultCb()}}class gn{constructor(e,t,n,r,i,a){this.mode=e,this.executeMethod=t,this.query=n,this.cache=r,this.queryMetadata=i,this.cacheConfig=a,r&&"all"===r.strategy()&&void 0===a&&(this.cacheConfig={enable:!0,autoInvalidate:!0}),this.cacheConfig?.enable||(this.cacheConfig=void 0)}static[o]="PreparedQuery";joinsNotNullableMap;async queryWithCache(e,t,n){if(void 0===this.cache||s(this.cache,hn)||void 0===this.queryMetadata)try{return await n()}catch(r){throw new Gt(e,t,r)}if(this.cacheConfig&&!this.cacheConfig.enable)try{return await n()}catch(r){throw new Gt(e,t,r)}if(("insert"===this.queryMetadata.type||"update"===this.queryMetadata.type||"delete"===this.queryMetadata.type)&&this.queryMetadata.tables.length>0)try{const[e]=await Promise.all([n(),this.cache.onMutate({tables:this.queryMetadata.tables})]);return e}catch(r){throw new Gt(e,t,r)}if(!this.cacheConfig)try{return await n()}catch(r){throw new Gt(e,t,r)}if("select"===this.queryMetadata.type){const i=await this.cache.get(this.cacheConfig.tag??await fn(e,t),this.queryMetadata.tables,void 0!==this.cacheConfig.tag,this.cacheConfig.autoInvalidate);if(void 0===i){let i;try{i=await n()}catch(r){throw new Gt(e,t,r)}return await this.cache.put(this.cacheConfig.tag??await fn(e,t),i,this.cacheConfig.autoInvalidate?this.queryMetadata.tables:[],void 0!==this.cacheConfig.tag,this.cacheConfig.config),i}return i}try{return await n()}catch(r){throw new Gt(e,t,r)}}getQuery(){return this.query}mapRunResult(e,t){return e}mapAllResult(e,t){throw new Error("Not implemented")}mapGetResult(e,t){throw new Error("Not implemented")}execute(e){return"async"===this.mode?this[this.executeMethod](e):new mn(()=>this[this.executeMethod](e))}mapResult(e,t){switch(this.executeMethod){case"run":return this.mapRunResult(e,t);case"all":return this.mapAllResult(e,t);case"get":return this.mapGetResult(e,t)}}}class yn{constructor(e){this.dialect=e}static[o]="SQLiteSession";prepareOneTimeQuery(e,t,n,r,i,a,o){return this.prepareQuery(e,t,n,r,i,a,o)}run(e){const t=this.dialect.sqlToQuery(e);try{return this.prepareOneTimeQuery(t,void 0,"run",!1).run()}catch(n){throw new kt({cause:n,message:`Failed to run the query '${t.sql}'`})}}extractRawRunValueFromBatchResult(e){return e}all(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run",!1).all()}extractRawAllValueFromBatchResult(e){throw new Error("Not implemented")}get(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run",!1).get()}extractRawGetValueFromBatchResult(e){throw new Error("Not implemented")}values(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run",!1).values()}async count(e){return(await this.values(e))[0][0]}extractRawValuesValueFromBatchResult(e){throw new Error("Not implemented")}}class In extends dn{constructor(e,t,n,r,i=0){super(e,t,n,r),this.schema=r,this.nestedIndex=i}static[o]="SQLiteTransaction";rollback(){throw new xt}}class Cn extends yn{constructor(e,t,n,r={}){super(t),this.client=e,this.schema=n,this.options=r,this.logger=r.logger??new u,this.cache=r.cache??new hn}static[o]="SQLiteD1Session";logger;cache;prepareQuery(e,t,n,r,i,a,o){const s=this.client.prepare(e.sql);return new bn(s,e,this.logger,this.cache,a,o,t,n,r,i)}async batch(e){const t=[],n=[];for(const r of e){const e=r._prepare(),i=e.getQuery();if(t.push(e),i.params.length>0)n.push(e.stmt.bind(...i.params));else{const t=e.getQuery();n.push(this.client.prepare(t.sql).bind(...t.params))}}return(await this.client.batch(n)).map((e,n)=>t[n].mapResult(e,!0))}extractRawAllValueFromBatchResult(e){return e.results}extractRawGetValueFromBatchResult(e){return e.results[0]}extractRawValuesValueFromBatchResult(e){return Sn(e.results)}async transaction(e,t){const n=new An("async",this.dialect,this,this.schema);await this.run(k.raw("begin"+(t?.behavior?" "+t.behavior:"")));try{const t=await e(n);return await this.run(k`commit`),t}catch(r){throw await this.run(k`rollback`),r}}}class An extends In{static[o]="D1Transaction";async transaction(e){const t=`sp${this.nestedIndex}`,n=new An("async",this.dialect,this.session,this.schema,this.nestedIndex+1);await this.session.run(k.raw(`savepoint ${t}`));try{const r=await e(n);return await this.session.run(k.raw(`release savepoint ${t}`)),r}catch(r){throw await this.session.run(k.raw(`rollback to savepoint ${t}`)),r}}}function Sn(e){const t=[];for(const n of e){const e=Object.keys(n).map(e=>n[e]);t.push(e)}return t}class bn extends gn{constructor(e,t,n,r,i,a,o,s,c,l){super("async",s,t,r,i,a),this.logger=n,this._isResponseInArrayMode=c,this.customResultMapper=l,this.fields=o,this.stmt=e}static[o]="D1PreparedQuery";customResultMapper;fields;stmt;async run(e){const t=H(this.query.params,e??{});return this.logger.logQuery(this.query.sql,t),await this.queryWithCache(this.query.sql,t,async()=>this.stmt.bind(...t).run())}async all(e){const{fields:t,query:n,logger:r,stmt:i,customResultMapper:a}=this;if(!t&&!a){const t=H(n.params,e??{});return r.logQuery(n.sql,t),await this.queryWithCache(n.sql,t,async()=>i.bind(...t).all().then(({results:e})=>this.mapAllResult(e)))}const o=await this.values(e);return this.mapAllResult(o)}mapAllResult(e,t){return t&&(e=Sn(e.results)),this.fields||this.customResultMapper?this.customResultMapper?this.customResultMapper(e):e.map(e=>$(this.fields,e,this.joinsNotNullableMap)):e}async get(e){const{fields:t,joinsNotNullableMap:n,query:r,logger:i,stmt:a,customResultMapper:o}=this;if(!t&&!o){const t=H(r.params,e??{});return i.logQuery(r.sql,t),await this.queryWithCache(r.sql,t,async()=>a.bind(...t).all().then(({results:e})=>e[0]))}const s=await this.values(e);if(s[0])return o?o(s):$(t,s[0],n)}mapGetResult(e,t){return t&&(e=Sn(e.results)[0]),this.fields||this.customResultMapper?this.customResultMapper?this.customResultMapper([e]):$(this.fields,e,this.joinsNotNullableMap):e}async values(e){const t=H(this.query.params,e??{});return this.logger.logQuery(this.query.sql,t),await this.queryWithCache(this.query.sql,t,async()=>this.stmt.bind(...t).raw())}isResponseInArrayMode(){return this._isResponseInArrayMode}}class Tn extends dn{static[o]="D1Database";async batch(e){return this.session.batch(e)}}class vn extends yn{constructor(e,t,n,r,i={}){super(t),this.client=e,this.schema=n,this.batchCLient=r,this.logger=i.logger??new u,this.cache=i.cache??new hn}static[o]="SQLiteRemoteSession";logger;cache;prepareQuery(e,t,n,r,i,a,o){return new wn(this.client,e,this.logger,this.cache,a,o,t,n,r,i)}async batch(e){const t=[],n=[];for(const r of e){const e=r._prepare(),i=e.getQuery();t.push(e),n.push({sql:i.sql,params:i.params,method:i.method})}return(await this.batchCLient(n)).map((e,n)=>t[n].mapResult(e,!0))}async transaction(e,t){const n=new _n("async",this.dialect,this,this.schema);await this.run(k.raw("begin"+(t?.behavior?" "+t.behavior:"")));try{const t=await e(n);return await this.run(k`commit`),t}catch(r){throw await this.run(k`rollback`),r}}extractRawAllValueFromBatchResult(e){return e.rows}extractRawGetValueFromBatchResult(e){return e.rows[0]}extractRawValuesValueFromBatchResult(e){return e.rows}}class _n extends In{static[o]="SQLiteProxyTransaction";async transaction(e){const t=`sp${this.nestedIndex}`,n=new _n("async",this.dialect,this.session,this.schema,this.nestedIndex+1);await this.session.run(k.raw(`savepoint ${t}`));try{const r=await e(n);return await this.session.run(k.raw(`release savepoint ${t}`)),r}catch(r){throw await this.session.run(k.raw(`rollback to savepoint ${t}`)),r}}}class wn extends gn{constructor(e,t,n,r,i,a,o,s,c,l){super("async",s,t,r,i,a),this.client=e,this.logger=n,this.fields=o,this._isResponseInArrayMode=c,this.customResultMapper=l,this.customResultMapper=l,this.method=s}static[o]="SQLiteProxyPreparedQuery";method;getQuery(){return{...this.query,method:this.method}}async run(e){const t=H(this.query.params,e??{});return this.logger.logQuery(this.query.sql,t),await this.queryWithCache(this.query.sql,t,async()=>await this.client(this.query.sql,t,"run"))}mapAllResult(e,t){return t&&(e=e.rows),this.fields||this.customResultMapper?this.customResultMapper?this.customResultMapper(e):e.map(e=>$(this.fields,e,this.joinsNotNullableMap)):e}async all(e){const{query:t,logger:n,client:r}=this,i=H(t.params,e??{});n.logQuery(t.sql,i);const{rows:a}=await this.queryWithCache(t.sql,i,async()=>await r(t.sql,i,"all"));return this.mapAllResult(a)}async get(e){const{query:t,logger:n,client:r}=this,i=H(t.params,e??{});n.logQuery(t.sql,i);const a=await this.queryWithCache(t.sql,i,async()=>await r(t.sql,i,"get"));return this.mapGetResult(a.rows)}mapGetResult(e,t){t&&(e=e.rows);const n=e;return this.fields||this.customResultMapper?n?this.customResultMapper?this.customResultMapper([e]):$(this.fields,n,this.joinsNotNullableMap):void 0:n}async values(e){const t=H(this.query.params,e??{});this.logger.logQuery(this.query.sql,t);return(await this.queryWithCache(this.query.sql,t,async()=>await this.client(this.query.sql,t,"values"))).rows}isResponseInArrayMode(){return this._isResponseInArrayMode}}class En extends dn{static[o]="SqliteRemoteDatabase";async batch(e){return this.session.batch(e)}}const Pn=Lt("users",{id:wt("id").primaryKey(),name:wt("name").notNull(),email:wt("email").notNull().unique(),emailVerified:dt("email_verified",{mode:"boolean"}).default(!1),image:wt("image"),apiKey:wt("api_key").unique(),usageCount:dt("usage_count").default(0),alpacaKeyId:wt("alpaca_key_id"),alpacaSecretKey:wt("alpaca_secret_key"),alpacaPaper:dt("alpaca_paper",{mode:"boolean"}).default(!0),surveyResponse:wt("survey_response"),kycStatus:wt("kyc_status").default("not_started"),kycSessionId:wt("kyc_session_id"),kycVerifiedAt:dt("kyc_verified_at",{mode:"timestamp"}),createdAt:dt("created_at",{mode:"timestamp"}).notNull(),updatedAt:dt("updated_at",{mode:"timestamp"}).notNull()}),Rn=Lt("sessions",{id:wt("id").primaryKey(),userId:wt("user_id").notNull().references(()=>Pn.id,{onDelete:"cascade"}),expiresAt:dt("expires_at",{mode:"timestamp"}).notNull(),token:wt("token").notNull().unique(),ipAddress:wt("ip_address"),userAgent:wt("user_agent"),createdAt:dt("created_at",{mode:"timestamp"}).notNull(),updatedAt:dt("updated_at",{mode:"timestamp"}).notNull()}),Ln=Lt("accounts",{id:wt("id").primaryKey(),userId:wt("user_id").notNull().references(()=>Pn.id,{onDelete:"cascade"}),accountId:wt("account_id").notNull(),providerId:wt("provider_id").notNull(),accessToken:wt("access_token"),refreshToken:wt("refresh_token"),idToken:wt("id_token"),expiresAt:dt("expires_at",{mode:"timestamp"}),accessTokenExpiresAt:dt("access_token_expires_at",{mode:"timestamp"}),scope:wt("scope"),password:wt("password"),createdAt:dt("created_at",{mode:"timestamp"}).notNull(),updatedAt:dt("updated_at",{mode:"timestamp"}).notNull()}),Nn=Lt("verifications",{id:wt("id").primaryKey(),identifier:wt("identifier").notNull(),value:wt("value").notNull(),expiresAt:dt("expires_at",{mode:"timestamp"}).notNull(),createdAt:dt("created_at",{mode:"timestamp"}),updatedAt:dt("updated_at",{mode:"timestamp"})}),On=Lt("wallet_addresses",{id:wt("id").primaryKey(),userId:wt("user_id").notNull().references(()=>Pn.id,{onDelete:"cascade"}),address:wt("address").notNull().unique(),chainId:dt("chain_id").notNull(),isPrimary:dt("is_primary",{mode:"boolean"}).default(!1),createdAt:dt("created_at",{mode:"timestamp"}).notNull()}),Bn=Lt("user_settings",{id:wt("id").primaryKey(),userId:wt("user_id").notNull().references(()=>Pn.id,{onDelete:"cascade"}).unique(),groqApiKey:wt("groq_api_key"),openaiApiKey:wt("openai_api_key"),anthropicApiKey:wt("anthropic_api_key"),xaiApiKey:wt("xai_api_key"),googleApiKey:wt("google_api_key"),togetheraiApiKey:wt("togetherai_api_key"),perplexityApiKey:wt("perplexity_api_key"),cloudflareApiKey:wt("cloudflare_api_key"),alpacaApiKey:wt("alpaca_api_key"),alpacaApiSecret:wt("alpaca_api_secret"),alpacaBaseUrl:wt("alpaca_base_url"),webullUsername:wt("webull_username"),webullPassword:wt("webull_password"),robinhoodUsername:wt("robinhood_username"),robinhoodPassword:wt("robinhood_password"),ibkrUsername:wt("ibkr_username"),ibkrPassword:wt("ibkr_password"),alphaVantageApiKey:wt("alpha_vantage_api_key"),finnhubApiKey:wt("finnhub_api_key"),polygonApiKey:wt("polygon_api_key"),createdAt:dt("created_at",{mode:"timestamp"}).notNull(),updatedAt:dt("updated_at",{mode:"timestamp"}).notNull()}),Mn=Lt("strategies",{id:wt("id").primaryKey(),userId:wt("user_id").notNull().references(()=>Pn.id,{onDelete:"cascade"}),name:wt("name").notNull(),type:wt("type").notNull(),status:wt("status").notNull().default("paused"),riskLevel:wt("risk_level").notNull().default("medium"),todayPnL:St("today_pnl").default(0),last7DaysPnL:St("last_7days_pnl").default(0),last30DaysPnL:St("last_30days_pnl").default(0),winRate:St("win_rate").default(0),activeMarkets:dt("active_markets").default(0),tradesToday:dt("trades_today").default(0),config:wt("config"),createdAt:dt("created_at",{mode:"timestamp"}).notNull(),updatedAt:dt("updated_at",{mode:"timestamp"}).notNull()}),Dn=Lt("watchlists",{id:wt("id").primaryKey(),userId:wt("user_id").notNull().references(()=>Pn.id,{onDelete:"cascade"}),name:wt("name").notNull(),description:wt("description"),createdAt:dt("created_at",{mode:"timestamp"}).notNull(),updatedAt:dt("updated_at",{mode:"timestamp"}).notNull()}),Fn=Lt("watchlist",{id:wt("id").primaryKey(),userId:wt("user_id").notNull().references(()=>Pn.id,{onDelete:"cascade"}),watchlistId:wt("watchlist_id").references(()=>Dn.id,{onDelete:"cascade"}),symbol:wt("symbol").notNull(),name:wt("name"),addedAt:dt("added_at",{mode:"timestamp"}).notNull()}),kn=Lt("signals",{id:wt("id").primaryKey(),userId:wt("user_id").notNull().references(()=>Pn.id,{onDelete:"cascade"}),asset:wt("asset").notNull(),type:wt("type").notNull(),combinedScore:St("combined_score").notNull(),scoreLabel:wt("score_label").notNull(),fundamentalsScore:St("fundamentals_score"),vixScore:St("vix_score"),technicalScore:St("technical_score"),sentimentScore:St("sentiment_score"),strategy:wt("strategy"),timeframe:wt("timeframe"),suggestedAction:wt("suggested_action"),suggestedSize:wt("suggested_size"),metadata:wt("metadata"),createdAt:dt("created_at",{mode:"timestamp"}).notNull(),updatedAt:dt("updated_at",{mode:"timestamp"}).notNull()}),Gn=Lt("positions",{id:wt("id").primaryKey(),userId:wt("user_id").notNull().references(()=>Pn.id,{onDelete:"cascade"}),asset:wt("asset").notNull(),type:wt("type").notNull(),entryPrice:St("entry_price").notNull(),currentPrice:St("current_price").notNull(),size:St("size").notNull(),unrealizedPnL:St("unrealized_pnl").default(0),unrealizedPnLPercent:St("unrealized_pnl_percent").default(0),strategy:wt("strategy"),openedBy:wt("opened_by"),openedAt:dt("opened_at",{mode:"timestamp"}).notNull(),closedAt:dt("closed_at",{mode:"timestamp"}),createdAt:dt("created_at",{mode:"timestamp"}).notNull(),updatedAt:dt("updated_at",{mode:"timestamp"}).notNull()}),xn=Lt("trades",{id:wt("id").primaryKey(),userId:wt("user_id").notNull().references(()=>Pn.id,{onDelete:"cascade"}),asset:wt("asset").notNull(),type:wt("type").notNull(),action:wt("action").notNull(),price:St("price").notNull(),size:St("size").notNull(),pnl:St("pnl"),strategy:wt("strategy"),copiedFrom:wt("copied_from"),timestamp:dt("timestamp",{mode:"timestamp"}).notNull(),createdAt:dt("created_at",{mode:"timestamp"}).notNull()}),Hn=Lt("portfolios",{id:wt("id").primaryKey(),userId:wt("user_id").notNull().references(()=>Pn.id,{onDelete:"cascade"}).unique(),totalEquity:St("total_equity").default(1e5),cash:St("cash").default(1e5),stocks:St("stocks").default(0),predictionMarkets:St("prediction_markets").default(0),margin:St("margin").default(0),dailyPnL:St("daily_pnl").default(0),dailyPnLPercent:St("daily_pnl_percent").default(0),winRate:St("win_rate").default(0),openPositions:dt("open_positions").default(0),updatedAt:dt("updated_at",{mode:"timestamp"}).notNull()}),Un=Lt("polymarket_leaders",{trader:wt("trader").primaryKey(),rank:dt("rank"),userName:wt("user_name"),xUsername:wt("x_username"),verifiedBadge:dt("verified_badge",{mode:"boolean"}),profileImage:wt("profile_image"),vol:St("vol"),pnl:St("pnl"),overallGain:St("overall_gain"),winRate:St("win_rate"),activePositions:dt("active_positions"),totalPositions:dt("total_positions"),currentValue:St("current_value"),winAmount:St("win_amount"),lossAmount:St("loss_amount"),updatedAt:dt("updated_at",{mode:"timestamp"})}),Vn=Lt("polymarket_positions",{id:wt("id").primaryKey(),traderId:wt("trader_id").notNull(),marketId:wt("market_id"),marketTitle:wt("market_title"),cashPnl:St("cash_pnl"),realizedPnl:St("realized_pnl"),tags:wt("tags"),createdAt:dt("created_at",{mode:"timestamp"})}),$n=Lt("polymarket_categories",{tag:wt("tag").primaryKey(),pnl:St("pnl"),updatedAt:dt("updated_at",{mode:"timestamp"})}),jn=Lt("polymarket_markets",{id:wt("id").primaryKey(),conditionId:wt("condition_id"),question:wt("question").notNull(),slug:wt("slug").notNull(),eventSlug:wt("event_slug"),description:wt("description"),image:wt("image"),volume24hr:St("volume_24hr"),volumeTotal:St("volume_total"),active:dt("active",{mode:"boolean"}).default(!0),closed:dt("closed",{mode:"boolean"}).default(!1),outcomes:wt("outcomes").notNull(),outcomePrices:wt("outcome_prices").notNull(),clobTokenIds:wt("clob_token_ids"),tags:wt("tags"),category:wt("category"),subcategory:wt("subcategory"),endDate:wt("end_date"),groupItemTitle:wt("group_item_title"),enableOrderBook:dt("enable_order_book",{mode:"boolean"}),createdAt:dt("created_at",{mode:"timestamp"}).notNull(),updatedAt:dt("updated_at",{mode:"timestamp"}).notNull()}),Wn=Lt("polymarket_market_positions",{id:wt("id").primaryKey(),marketId:wt("market_id").notNull(),outcome:wt("outcome").notNull(),price:St("price").notNull(),size:St("size").notNull(),side:wt("side").notNull(),totalValue:St("total_value").notNull(),createdAt:dt("created_at",{mode:"timestamp"}).notNull()}),Xn=Lt("polymarket_debates",{id:wt("id").primaryKey(),marketId:wt("market_id").notNull().unique(),question:wt("question").notNull(),yesArguments:wt("yes_arguments").notNull(),noArguments:wt("no_arguments").notNull(),yesSummary:wt("yes_summary").notNull(),noSummary:wt("no_summary").notNull(),keyFactors:wt("key_factors").notNull(),uncertainties:wt("uncertainties").notNull(),currentYesPrice:St("current_yes_price"),currentNoPrice:St("current_no_price"),llmProvider:wt("llm_provider"),model:wt("model"),createdAt:dt("created_at",{mode:"timestamp"}).notNull(),updatedAt:dt("updated_at",{mode:"timestamp"}).notNull()}),Kn=Lt("polymarket_price_history",{id:wt("id").primaryKey(),tokenId:wt("token_id").notNull(),timestamp:dt("timestamp").notNull(),price:St("price").notNull(),interval:wt("interval").notNull(),createdAt:dt("created_at",{mode:"timestamp"}).notNull()}),Yn=Lt("polymarket_holders",{id:wt("id").primaryKey(),marketId:wt("market_id").notNull(),address:wt("address").notNull(),userName:wt("user_name"),profileImage:wt("profile_image"),rank:dt("rank").notNull(),outcome:wt("outcome"),balance:St("balance").notNull(),value:St("value").notNull(),overallGain:St("overall_gain"),winRate:St("win_rate"),totalProfit:St("total_profit"),totalLoss:St("total_loss"),totalPositions:dt("total_positions"),updatedAt:dt("updated_at",{mode:"timestamp"}).notNull()}),qn=Lt("polymarket_trade_history",{id:wt("id").primaryKey(),traderId:wt("trader_id").notNull(),transactionHash:wt("transaction_hash").notNull(),conditionId:wt("condition_id").notNull(),marketTitle:wt("market_title"),marketSlug:wt("market_slug"),eventSlug:wt("event_slug"),type:wt("type").notNull(),side:wt("side"),outcome:wt("outcome"),outcomeIndex:dt("outcome_index"),size:St("size").notNull(),usdcSize:St("usdc_size").notNull(),price:St("price"),traderName:wt("trader_name"),traderBio:wt("trader_bio"),traderProfileImage:wt("trader_profile_image"),timestamp:dt("timestamp",{mode:"timestamp"}).notNull(),syncedAt:dt("synced_at",{mode:"timestamp"}).notNull(),createdAt:dt("created_at",{mode:"timestamp"}).notNull()}),Qn=Lt("polymarket_trade_sync_status",{traderId:wt("trader_id").primaryKey(),lastSyncedTimestamp:dt("last_synced_timestamp",{mode:"timestamp"}),totalTradesSynced:dt("total_trades_synced").default(0),syncStatus:wt("sync_status").notNull().default("pending"),errorMessage:wt("error_message"),lastSyncAttempt:dt("last_sync_attempt",{mode:"timestamp"}),createdAt:dt("created_at",{mode:"timestamp"}).notNull(),updatedAt:dt("updated_at",{mode:"timestamp"}).notNull()}),Jn=Lt("nvstly_leaders",{id:wt("id").primaryKey(),name:wt("name").notNull(),rank:dt("rank"),rep:St("rep"),trades:dt("trades"),winRate:St("win_rate"),totalGain:St("total_gain"),avgReturn:St("avg_return"),broker:wt("broker"),updatedAt:dt("updated_at",{mode:"timestamp"})}),zn=Lt("nvstly_trades",{id:wt("id").primaryKey(),traderId:wt("trader_id").notNull(),symbol:wt("symbol").notNull(),type:wt("type").notNull(),price:St("price"),previousPrice:St("previous_price"),gain:St("gain"),time:dt("time",{mode:"timestamp"}),createdAt:dt("created_at",{mode:"timestamp"})}),Zn=Lt("zulu_traders",{providerId:dt("provider_id").primaryKey(),name:wt("name"),strategyDesc:wt("strategy_desc"),countryCode:wt("country_code"),countryName:wt("country_name"),brokerName:wt("broker_name"),balance:St("balance"),equity:St("equity"),followers:dt("followers"),liveFollowers:dt("live_followers"),roiAnnualized:St("roi_annualized"),roiProfit:St("roi_profit"),zuluRank:dt("zulu_rank"),bestTrade:St("best_trade"),worstTrade:St("worst_trade"),profitableTrades:dt("profitable_trades"),losingTrades:dt("losing_trades"),avgDrawdown:St("avg_drawdown"),maxDrawdown:St("max_drawdown"),maxDrawdownPercent:St("max_drawdown_percent"),leverage:St("leverage"),isEa:dt("is_ea"),currencies:wt("currencies"),weeks:dt("weeks"),demo:dt("demo"),avgTradeSeconds:dt("avg_trade_seconds"),avgPnlPerTrade:St("avg_pnl_per_trade"),winRate:St("win_rate"),totalTrades:dt("total_trades"),pageVisits:dt("page_visits"),includedInWatchlist:dt("included_in_watchlist"),registrationDate:dt("registration_date",{mode:"timestamp"}),lastOpenTradeDate:dt("last_open_trade_date",{mode:"timestamp"}),updatedAt:dt("updated_at",{mode:"timestamp"})}),er=Lt("zulu_currency_stats",{id:wt("id").primaryKey(),providerId:dt("provider_id").notNull(),currencyName:wt("currency_name"),totalCount:dt("total_count"),winCount:dt("win_count"),winPercent:St("win_percent"),totalBuyCount:dt("total_buy_count"),totalSellCount:dt("total_sell_count"),pips:St("pips"),createdAt:dt("created_at",{mode:"timestamp"})}),tr=Lt("agent_api_logs",{id:wt("id").primaryKey(),userId:wt("user_id").references(()=>Pn.id,{onDelete:"set null"}),symbol:wt("symbol").notNull(),requestPayload:wt("request_payload"),responseSignal:wt("response_signal"),responseAnalysis:wt("response_analysis"),llmProvider:wt("llm_provider"),model:wt("model_used"),timestamp:dt("timestamp",{mode:"timestamp"}).notNull(),createdAt:dt("created_at",{mode:"timestamp"}).notNull()}),nr=Lt("organizations",{id:wt("id").primaryKey(),name:wt("name").notNull(),description:wt("description"),image:wt("image"),ownerId:wt("owner_id").notNull().references(()=>Pn.id,{onDelete:"cascade"}),createdAt:dt("created_at",{mode:"timestamp"}).notNull(),updatedAt:dt("updated_at",{mode:"timestamp"}).notNull()}),rr=Lt("organization_members",{id:wt("id").primaryKey(),organizationId:wt("organization_id").notNull().references(()=>nr.id,{onDelete:"cascade"}),userId:wt("user_id").notNull().references(()=>Pn.id,{onDelete:"cascade"}),role:wt("role").notNull().default("member"),joinedAt:dt("joined_at",{mode:"timestamp"}).notNull()}),ir=Lt("teams",{id:wt("id").primaryKey(),organizationId:wt("organization_id").notNull().references(()=>nr.id,{onDelete:"cascade"}),name:wt("name").notNull(),description:wt("description"),upgradeMembers:dt("upgrade_members",{mode:"boolean"}).default(!1),maxMembers:dt("max_members").default(8),createdAt:dt("created_at",{mode:"timestamp"}).notNull(),updatedAt:dt("updated_at",{mode:"timestamp"}).notNull()}),ar=Lt("team_members",{id:wt("id").primaryKey(),teamId:wt("team_id").notNull().references(()=>ir.id,{onDelete:"cascade"}),userId:wt("user_id").notNull().references(()=>Pn.id,{onDelete:"cascade"}),role:wt("role").notNull().default("member"),joinedAt:dt("joined_at",{mode:"timestamp"}).notNull()}),or=Lt("user_follows",{id:wt("id").primaryKey(),followerId:wt("follower_id").notNull().references(()=>Pn.id,{onDelete:"cascade"}),followingId:wt("following_id").notNull().references(()=>Pn.id,{onDelete:"cascade"}),createdAt:dt("created_at",{mode:"timestamp"}).notNull()}),sr=Lt("user_invitations",{id:wt("id").primaryKey(),inviterId:wt("inviter_id").notNull().references(()=>Pn.id,{onDelete:"cascade"}),email:wt("email").notNull(),status:wt("status").notNull().default("pending"),organizationId:wt("organization_id").references(()=>nr.id,{onDelete:"cascade"}),teamId:wt("team_id").references(()=>ir.id,{onDelete:"cascade"}),expiresAt:dt("expires_at",{mode:"timestamp"}).notNull(),createdAt:dt("created_at",{mode:"timestamp"}).notNull()}),cr=Lt("shared_items",{id:wt("id").primaryKey(),sharedById:wt("shared_by_id").notNull().references(()=>Pn.id,{onDelete:"cascade"}),sharedWithEmail:wt("shared_with_email").notNull(),sharedWithUserId:wt("shared_with_user_id").references(()=>Pn.id,{onDelete:"set null"}),itemType:wt("item_type").notNull(),itemId:wt("item_id").notNull(),symbol:wt("symbol"),title:wt("title"),message:wt("message"),metadata:wt("metadata"),viewedAt:dt("viewed_at",{mode:"timestamp"}),createdAt:dt("created_at",{mode:"timestamp"}).notNull()}),lr=Lt("notifications",{id:wt("id").primaryKey(),userId:wt("user_id").notNull().references(()=>Pn.id,{onDelete:"cascade"}),type:wt("type").notNull(),title:wt("title").notNull(),message:wt("message").notNull(),actionUrl:wt("action_url"),fromUserId:wt("from_user_id").references(()=>Pn.id,{onDelete:"cascade"}),relatedItemType:wt("related_item_type"),relatedItemId:wt("related_item_id"),read:dt("read",{mode:"boolean"}).default(!1),createdAt:dt("created_at",{mode:"timestamp"}).notNull()}),ur=Lt("comments",{id:wt("id").primaryKey(),userId:wt("user_id").notNull().references(()=>Pn.id,{onDelete:"cascade"}),itemType:wt("item_type").notNull(),itemId:wt("item_id").notNull(),parentCommentId:wt("parent_comment_id").references(()=>ur.id,{onDelete:"cascade"}),content:wt("content").notNull(),editedAt:dt("edited_at",{mode:"timestamp"}),createdAt:dt("created_at",{mode:"timestamp"}).notNull(),updatedAt:dt("updated_at",{mode:"timestamp"}).notNull()}),dr=Lt("likes",{id:wt("id").primaryKey(),userId:wt("user_id").notNull().references(()=>Pn.id,{onDelete:"cascade"}),itemType:wt("item_type").notNull(),itemId:wt("item_id").notNull(),createdAt:dt("created_at",{mode:"timestamp"}).notNull()}),pr=Lt("stock_quote_cache",{symbol:wt("symbol").primaryKey(),price:St("price").notNull(),change:St("change"),changePercent:St("change_percent"),open:St("open"),high:St("high"),low:St("low"),previousClose:St("previous_close"),volume:St("volume")}),hr=Lt("stock_fundamentals",{symbol:wt("symbol").primaryKey(),peRatio:St("pe_ratio"),eps:St("eps"),dividendYield:St("dividend_yield"),beta:St("beta"),fiftyTwoWeekHigh:St("fifty_two_week_high"),fiftyTwoWeekLow:St("fifty_two_week_low"),fiftyDayAverage:St("fifty_day_average"),twoHundredDayAverage:St("two_hundred_day_average"),sharesOutstanding:St("shares_outstanding"),bookValue:St("book_value"),priceToBook:St("price_to_book"),trailingPE:St("trailing_pe"),forwardPE:St("forward_pe"),lastFetched:dt("last_fetched",{mode:"timestamp"}).notNull(),createdAt:dt("created_at",{mode:"timestamp"}).notNull(),updatedAt:dt("updated_at",{mode:"timestamp"}).notNull()}),fr=Lt("stock_historical_quotes",{id:wt("id").primaryKey(),symbol:wt("symbol").notNull(),date:wt("date").notNull(),open:St("open").notNull(),high:St("high").notNull(),low:St("low").notNull(),close:St("close").notNull(),volume:St("volume"),adjustedClose:St("adjusted_close"),createdAt:dt("created_at",{mode:"timestamp"}).notNull()}),mr=Lt("dukascopy_index_cache",{symbol:wt("symbol").primaryKey(),name:wt("name").notNull(),country:wt("country").notNull(),countryCode:wt("country_code").notNull(),price:St("price").notNull(),dailyChange:St("daily_change").notNull(),dailyChangePercent:St("daily_change_percent").notNull(),volume:St("volume").default(0),monthlyChangePercent:St("monthly_change_percent").default(0),yearlyChangePercent:St("yearly_change_percent").default(0),chartData:wt("chart_data").notNull(),lastFetched:dt("last_fetched",{mode:"timestamp"}).notNull(),createdAt:dt("created_at",{mode:"timestamp"}).notNull(),updatedAt:dt("updated_at",{mode:"timestamp"}).notNull()}),gr=Object.freeze(Object.defineProperty({__proto__:null,accounts:Ln,agentApiLogs:tr,comments:ur,dukascopyIndexCache:mr,likes:dr,notifications:lr,nvstlyLeaders:Jn,nvstlyTrades:zn,organizationMembers:rr,organizations:nr,polymarketCategories:$n,polymarketDebates:Xn,polymarketHolders:Yn,polymarketLeaders:Un,polymarketMarketPositions:Wn,polymarketMarkets:jn,polymarketPositions:Vn,polymarketPriceHistory:Kn,polymarketTradeHistory:qn,polymarketTradeSyncStatus:Qn,portfolios:Hn,positions:Gn,sessions:Rn,sharedItems:cr,signals:kn,stockFundamentals:hr,stockHistoricalQuotes:fr,stockQuoteCache:pr,strategies:Mn,teamMembers:ar,teams:ir,trades:xn,userFollows:or,userInvitations:sr,userSettings:Bn,users:Pn,verifications:Nn,walletAddresses:On,watchlist:Fn,watchlists:Dn,zuluCurrencyStats:er,zuluTraders:Zn},Symbol.toStringTag,{value:"Module"})),yr=e.relations(Pn,({many:e})=>({organizationMemberships:e(rr),teamMemberships:e(ar)})),Ir=e.relations(rr,({one:e})=>({organization:e(nr,{fields:[rr.organizationId],references:[nr.id]}),user:e(Pn,{fields:[rr.userId],references:[Pn.id]})})),Cr=e.relations(nr,({many:e})=>({members:e(rr),teams:e(ir)})),Ar=e.relations(ir,({one:e,many:t})=>({organization:e(nr,{fields:[ir.organizationId],references:[nr.id]}),members:t(ar)})),Sr=e.relations(ar,({one:e})=>({team:e(ir,{fields:[ar.teamId],references:[ir.id]}),user:e(Pn,{fields:[ar.userId],references:[Pn.id]})})),br=Object.freeze(Object.defineProperty({__proto__:null,organizationMembersRelations:Ir,organizationsRelations:Cr,teamMembersRelations:Sr,teamsRelations:Ar,usersRelations:yr},Symbol.toStringTag,{value:"Module"})),Tr="37dbe79c-2687-4127-ad02-2372e15ac077";function vr(){const e="undefined"!=typeof process?process.env:void 0;if(!e)return null;const t=e.CLOUDFLARE_ACCOUNT_ID,n=e.CLOUDFLARE_D1_TOKEN||e.CLOUDFLARE_API_TOKEN;return t&&n?{accountId:t,databaseId:e.CLOUDFLARE_DATABASE_ID||Tr,token:n}:null}function _r(e){return async(t,n,r)=>{const i=await async function(e,t,n){const r=`https://api.cloudflare.com/client/v4/accounts/${e.accountId}/d1/database/${e.databaseId}/query`,i=await fetch(r,{method:"POST",headers:{Authorization:`Bearer ${e.token}`,"Content-Type":"application/json"},body:JSON.stringify({sql:t,params:n})}),a=await i.json();if(!i.ok||!a.success){const e=a.errors?.map(e=>`${e.code}: ${e.message}`).join("; ")||`${i.status} ${i.statusText}`;throw new Error(`Cloudflare D1 HTTP query failed — ${e}`)}return a.result?.[0]?.results??[]}(e,t,n);if("run"===r)return{rows:[]};const a=i.map(e=>Object.values(e));return"get"===r?{rows:a[0]??[]}:{rows:a}}}const wr={...gr,...br};let Er=null;function Pr(){if(Er)return Er;const e=globalThis.__CLOUDFLARE_ENV__;if(e?.DB)return Er=function(e,t={}){const n=new $t({casing:t.casing});let r,i;if(!0===t.logger?r=new l:!1!==t.logger&&(r=t.logger),t.schema){const e=Re(t.schema,Be);i={fullSchema:t.schema,schema:e.tables,tableNamesMap:e.tableNamesMap}}const a=new Cn(e,n,i,{logger:r,cache:t.cache}),o=new Tn("async",n,a,i);return o.$client=e,o.$cache=t.cache,o.$cache&&(o.$cache.invalidate=t.cache?.onMutate),o}(e.DB,{schema:wr}),Er;const t=vr();if(!t)throw new Error("No Cloudflare D1 connection available. On Workers this needs the `DB` binding from wrangler.jsonc; elsewhere set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_D1_TOKEN (and optionally CLOUDFLARE_DATABASE_ID) to reach D1 over its REST API.");return Er=function(e,t,n){const r=new $t({casing:n?.casing});let i,a,o,s,c={};if(t&&("function"==typeof t?(o=t,c={}):(o=void 0,c=t),!0===c.logger?i=new l:!1!==c.logger&&(i=c.logger,a=c.cache)),c.schema){const e=Re(c.schema,Be);s={fullSchema:c.schema,schema:e.tables,tableNamesMap:e.tableNamesMap}}const u=new vn(e,r,s,o,{logger:i,cache:a}),d=new En("async",r,u,s);return d.$cache=a,d.$cache&&(d.$cache.invalidate=a?.onMutate),d}(_r(t),{schema:wr}),Er}const Rr=new Proxy({},{get(e,t){const n=Pr(),r=n[t];return"function"==typeof r?r.bind(n):r},has:(e,t)=>t in Pr()});function Lr(e,t){const n=t.reduce((e,t)=>e+t,0)/t.length,r=t.map(e=>Math.pow(e-n,2)).reduce((e,t)=>e+t,0),i=t.map((t,n)=>Math.pow(t-e[n],2)).reduce((e,t)=>e+t,0);return Math.round(100*(1-i/r))/100}function Nr(e,t,n=.2){const r=e.length,i=r-Math.floor(r*n),a=Array.from({length:r},(e,t)=>t);for(let c=a.length-1;c>0;c--){const e=Math.floor(Math.random()*(c+1));[a[c],a[e]]=[a[e],a[c]]}const o=a.slice(0,i),s=a.slice(i);return{trainFeatures:o.map(t=>e[t]),testFeatures:s.map(t=>e[t]),trainTarget:o.map(e=>t[e]),testTarget:s.map(e=>t[e])}}class Or{provider;model;temperature;apiKey;baseUrl;constructor(e,t){this.provider=e.llmProvider,this.model=t,this.temperature=e.temperature??.3,e.baseUrl?this.baseUrl=e.baseUrl:"groq"===this.provider.toLowerCase()&&(this.baseUrl="https://api.groq.com/openai/v1/chat/completions"),e.apiKeys?this.apiKey=e.apiKeys[this.provider]||"":this.apiKey=process.env[`${this.provider.toUpperCase()}_API_KEY`]||""}async invoke(e){const t="string"==typeof e?[{role:"user",content:e}]:e;switch(this.provider.toLowerCase()){case"openai":return this.invokeOpenAI(t);case"groq":return this.invokeGroq(t);case"anthropic":return this.invokeAnthropic(t);default:throw new Error(`Unsupported LLM provider: ${this.provider}`)}}async invokeOpenAI(e){const t=this.baseUrl||"https://api.openai.com/v1/chat/completions",n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({model:this.model,messages:e,temperature:this.temperature})});if(!n.ok)throw new Error(`OpenAI API error: ${n.statusText}`);const r=await n.json();return{content:r.choices[0].message.content,toolCalls:r.choices[0].message.tool_calls?.map(e=>({name:e.function.name,arguments:JSON.parse(e.function.arguments)}))}}async invokeGroq(e){const t=this.baseUrl||"https://api.groq.com/openai/v1/chat/completions",n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({model:this.model,messages:e,temperature:this.temperature})});if(!n.ok){const e=await n.text();throw new Error(`Groq API error: ${n.statusText} - ${e}`)}const r=await n.json();return{content:r.choices[0].message.content,toolCalls:r.choices[0].message.tool_calls?.map(e=>({name:e.function.name,arguments:JSON.parse(e.function.arguments)}))}}async invokeAnthropic(e){const t=this.baseUrl||"https://api.anthropic.com/v1/messages",n=e.find(e=>"system"===e.role),r=e.filter(e=>"system"!==e.role),i=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":this.apiKey,"anthropic-version":"2023-06-01"},body:JSON.stringify({model:this.model,max_tokens:4096,temperature:this.temperature,system:n?.content,messages:r.map(e=>({role:"assistant"===e.role?"assistant":"user",content:e.content}))})});if(!i.ok)throw new Error(`Anthropic API error: ${i.statusText}`);return{content:(await i.json()).content[0].text}}async invokeWithTools(e,t){switch(this.provider.toLowerCase()){case"openai":case"groq":return this.invokeWithToolsOpenAI(e,t);default:return this.invoke(e)}}async invokeWithToolsOpenAI(e,t){const n="groq"===this.provider.toLowerCase()?this.baseUrl||"https://api.groq.com/openai/v1/chat/completions":this.baseUrl||"https://api.openai.com/v1/chat/completions",r=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({model:this.model,messages:e,temperature:this.temperature,tools:t,tool_choice:"auto"})});if(!r.ok){const e=await r.text();throw new Error(`${this.provider} API error: ${r.statusText} - ${e}`)}const i=await r.json();return{content:i.choices[0].message.content,toolCalls:i.choices[0].message.tool_calls?.map(e=>({name:e.function.name,arguments:JSON.parse(e.function.arguments)}))}}}function Br(e,t){return new Or(e,t)}class Mr{name;memories=[];config;constructor(e,t){this.name=e,this.config=t}async addMemory(e){this.memories.push({...e,timestamp:new Date}),this.memories.length>100&&(this.memories=this.memories.slice(-100))}async getMemories(e,t=2){if(0===this.memories.length)return[];const n=this.memories.map(t=>({memory:t,score:this.calculateSimilarity(e,t.situation)}));return n.sort((e,t)=>t.score-e.score),n.slice(0,t).map(e=>e.memory)}calculateSimilarity(e,t){const n=this.tokenize(e),r=this.tokenize(t),i=n.filter(e=>r.includes(e)),a=new Set([...n,...r]);return i.length/a.size}tokenize(e){return e.toLowerCase().replace(/[^\w\s]/g," ").split(/\s+/).filter(e=>e.length>3)}clear(){this.memories=[]}getAllMemories(){return[...this.memories]}getMemoryCount(){return this.memories.length}}const Dr=new n;function Fr(e){if(null==e)return null;const t="number"==typeof e?e:Number(e);return Number.isFinite(t)?t:null}function kr(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(!n)continue;const e=n.date instanceof Date?n.date:new Date(n.date);if(Number.isNaN(e.getTime()))continue;const r=Fr(n.close),i=Fr(n.open),a=Fr(n.high),o=Fr(n.low),s=Fr(n.adjclose??n.adjClose),c=r??i??s??a??o;null!==c&&t.push({date:e,open:i??c,high:a??Math.max(i??c,r??c),low:o??Math.min(i??c,r??c),close:r??c,adjClose:s??r??c,volume:Fr(n.volume)??0})}return t}class Gr{constructor(){}async getQuote(e,t){try{return{success:!0,data:await Dr.quoteCombine(e,t)}}catch(n){return console.error(`Yahoo Finance quote error for ${e}:`,n),{success:!1,error:n.message||"Failed to fetch quote"}}}async getQuotes(e){try{return{success:!0,data:await Promise.all(e.map(e=>Dr.quoteCombine(e)))}}catch(t){return console.error("Yahoo Finance quotes error:",t),{success:!1,error:t.message||"Failed to fetch quotes"}}}async getHistorical(e,t){try{const n=t?.period1??new Date(Date.now()-31536e6),r=t?.period2??new Date,i=t?.interval||"1d",a=await Dr.chart(e,{period1:n,period2:r,interval:i},{validateResult:!1});return{success:!0,data:kr(a?.quotes)}}catch(n){return console.error(`Yahoo Finance historical error for ${e}:`,n?.message||n),{success:!1,error:n.message||"Failed to fetch historical data"}}}async getChart(e,t){try{return{success:!0,data:await Dr.chart(e,{period1:t?.period1||new Date(Date.now()-2592e6),period2:t?.period2||new Date,interval:t?.interval||"1d"})}}catch(n){return console.error(`Yahoo Finance chart error for ${e}:`,n),{success:!1,error:n.message||"Failed to fetch chart data"}}}async getQuoteSummary(e,t){try{const n=t||["assetProfile","summaryDetail","financialData","defaultKeyStatistics","calendarEvents","recommendationTrend","earnings","earningsTrend"];return{success:!0,data:await Dr.quoteSummary(e,{modules:n})}}catch(n){return console.error(`Yahoo Finance quoteSummary error for ${e}:`,n),{success:!1,error:n.message||"Failed to fetch quote summary"}}}async search(e,t){try{return{success:!0,data:await Dr.search(e,{quotesCount:t?.quotesCount||10,newsCount:t?.newsCount||5})}}catch(n){return console.error(`Yahoo Finance search error for "${e}":`,n),{success:!1,error:n.message||"Failed to search"}}}async getOptions(e,t){try{return{success:!0,data:await Dr.options(e,t?{date:t}:void 0)}}catch(n){return console.error(`Yahoo Finance options error for ${e}:`,n),{success:!1,error:n.message||"Failed to fetch options data"}}}async getRecommendations(e){try{return{success:!0,data:await Dr.recommendationsBySymbol(e)}}catch(t){return console.error(`Yahoo Finance recommendations error for ${e}:`,t),{success:!1,error:t.message||"Failed to fetch recommendations"}}}async getTrending(e="US"){try{return{success:!0,data:await Dr.trendingSymbols(e)}}catch(t){return console.error(`Yahoo Finance trending error for ${e}:`,t),{success:!1,error:t.message||"Failed to fetch trending symbols"}}}async getInsights(e){try{return{success:!0,data:await Dr.insights(e)}}catch(t){return console.error(`Yahoo Finance insights error for ${e}:`,t),{success:!1,error:t.message||"Failed to fetch insights"}}}async getFundamentalsTimeSeries(e,t){try{return{success:!0,data:await Dr.fundamentalsTimeSeries(e,t)}}catch(n){return console.error(`Yahoo Finance fundamentalsTimeSeries error for ${e}:`,n),{success:!1,error:n.message||"Failed to fetch fundamentals time series"}}}async screener(e){try{return{success:!0,data:await Dr.screener(e)}}catch(t){return console.error("Yahoo Finance screener error:",t),{success:!1,error:t.message||"Failed to run screener"}}}async getCompanyProfile(e){try{const t=await Dr.quoteSummary(e,{modules:["assetProfile","summaryProfile"]});return{success:!0,data:{assetProfile:t.assetProfile,summaryProfile:t.summaryProfile}}}catch(t){return console.error(`Yahoo Finance company profile error for ${e}:`,t),{success:!1,error:t.message||"Failed to fetch company profile"}}}async getFinancialStatements(e){try{const t=await Dr.quoteSummary(e,{modules:["incomeStatementHistory","incomeStatementHistoryQuarterly","balanceSheetHistory","balanceSheetHistoryQuarterly","cashflowStatementHistory","cashflowStatementHistoryQuarterly"]});return{success:!0,data:{incomeStatement:t.incomeStatementHistory,incomeStatementQuarterly:t.incomeStatementHistoryQuarterly,balanceSheet:t.balanceSheetHistory,balanceSheetQuarterly:t.balanceSheetHistoryQuarterly,cashFlow:t.cashflowStatementHistory,cashFlowQuarterly:t.cashflowStatementHistoryQuarterly}}}catch(t){return console.error(`Yahoo Finance financial statements error for ${e}:`,t),{success:!1,error:t.message||"Failed to fetch financial statements"}}}async getKeyStatistics(e){try{const t=await Dr.quoteSummary(e,{modules:["defaultKeyStatistics","summaryDetail"]});return{success:!0,data:{keyStatistics:t.defaultKeyStatistics,summaryDetail:t.summaryDetail}}}catch(t){return console.error(`Yahoo Finance key statistics error for ${e}:`,t),{success:!1,error:t.message||"Failed to fetch key statistics"}}}async getEarnings(e){try{const t=await Dr.quoteSummary(e,{modules:["earnings","earningsHistory","earningsTrend","calendarEvents"]});return{success:!0,data:{earnings:t.earnings,earningsHistory:t.earningsHistory,earningsTrend:t.earningsTrend,calendarEvents:t.calendarEvents}}}catch(t){return console.error(`Yahoo Finance earnings error for ${e}:`,t),{success:!1,error:t.message||"Failed to fetch earnings data"}}}async getOwnership(e){try{const t=await Dr.quoteSummary(e,{modules:["institutionOwnership","fundOwnership","insiderHolders","insiderTransactions","majorHoldersBreakdown"]});return{success:!0,data:{institutionOwnership:t.institutionOwnership,fundOwnership:t.fundOwnership,insiderHolders:t.insiderHolders,insiderTransactions:t.insiderTransactions,majorHoldersBreakdown:t.majorHoldersBreakdown}}}catch(t){return console.error(`Yahoo Finance ownership error for ${e}:`,t),{success:!1,error:t.message||"Failed to fetch ownership data"}}}async getSECFilings(e){try{return{success:!0,data:(await Dr.quoteSummary(e,{modules:["secFilings"]})).secFilings}}catch(t){return console.error(`Yahoo Finance SEC filings error for ${e}:`,t),{success:!1,error:t.message||"Failed to fetch SEC filings"}}}async getComprehensiveData(e){try{const[t,n,r,i]=await Promise.all([this.getQuote(e),this.getQuoteSummary(e),this.getHistorical(e,{period1:new Date(Date.now()-31536e6)}),this.getRecommendations(e)]);return{success:!0,data:{quote:t.data,summary:n.data,historical:r.data,recommendations:i.data}}}catch(t){return console.error(`Yahoo Finance comprehensive data error for ${e}:`,t),{success:!1,error:t.message||"Failed to fetch comprehensive data"}}}}const xr=new Gr,Hr=xr;async function Ur(e,t,n){try{const r=await Hr.getHistorical(e,{period1:t,period2:n,interval:"1d"});if(!r.success||!r.data)throw new Error(`Failed to fetch stock data for ${e}`);const i=Array.isArray(r.data)?r.data:r.data.quotes;if(!i||!Array.isArray(i))throw new Error(`Invalid data format returned for ${e}`);return i.map(e=>({date:e.date,open:e.open,high:e.high,low:e.low,close:e.close,volume:e.volume}))}catch(r){throw console.error("Error fetching stock data:",r),r}}async function Vr(e,t){const n={},r=e.map(e=>e.close),i=e.map(e=>e.high),a=e.map(e=>e.low),o=e.map(e=>e.volume);for(const s of t)switch(s.toLowerCase()){case"close_50_sma":case"sma50":n.sma50=$r(r,50);break;case"close_200_sma":case"sma200":n.sma200=$r(r,200);break;case"close_10_ema":case"ema10":n.ema10=jr(r,10);break;case"rsi":n.rsi=Wr(r,14);break;case"macd":const e=Xr(r);n.macd=e.macd,n.macdSignal=e.signal,n.macdHistogram=e.histogram;break;case"boll":case"bollinger":const t=Kr(r,20,2);n.bollingerUpper=t.upper,n.bollingerMiddle=t.middle,n.bollingerLower=t.lower;break;case"atr":n.atr=Yr(i,a,r,14);break;case"vwma":n.vwma=qr(r,o,20)}return n}function $r(e,t){const n=[];for(let r=0;r<e.length;r++)if(r<t-1)n.push(NaN);else{const i=e.slice(r-t+1,r+1).reduce((e,t)=>e+t,0);n.push(i/t)}return n}function jr(e,t){const n=[],r=2/(t+1);let i=e.slice(0,t).reduce((e,t)=>e+t,0)/t;n.push(...Array(t-1).fill(NaN)),n.push(i);for(let a=t;a<e.length;a++)i=(e[a]-i)*r+i,n.push(i);return n}function Wr(e,t=14){const n=[],r=[],i=[];for(let a=1;a<e.length;a++){const t=e[a]-e[a-1];r.push(t>0?t:0),i.push(t<0?Math.abs(t):0)}for(let a=0;a<r.length;a++)if(a<t-1)n.push(NaN);else{const e=r.slice(a-t+1,a+1).reduce((e,t)=>e+t,0)/t,o=i.slice(a-t+1,a+1).reduce((e,t)=>e+t,0)/t,s=100-100/(1+(0===o?100:e/o));n.push(s)}return n.unshift(NaN),n}function Xr(e){const t=jr(e,12),n=jr(e,26),r=t.map((e,t)=>e-n[t]),i=jr(r.filter(e=>!isNaN(e)),9),a=[...Array(r.length-i.length).fill(NaN),...i],o=r.map((e,t)=>e-a[t]);return{macd:r,signal:a,histogram:o}}function Kr(e,t=20,n=2){const r=$r(e,t),i=[],a=[];for(let o=0;o<e.length;o++)if(o<t-1)i.push(NaN),a.push(NaN);else{const s=e.slice(o-t+1,o+1),c=r[o],l=s.reduce((e,t)=>e+Math.pow(t-c,2),0)/t,u=Math.sqrt(l);i.push(c+n*u),a.push(c-n*u)}return{upper:i,middle:r,lower:a}}function Yr(e,t,n,r=14){const i=[],a=[];for(let o=1;o<e.length;o++){const r=e[o]-t[o],i=Math.abs(e[o]-n[o-1]),s=Math.abs(t[o]-n[o-1]);a.push(Math.max(r,i,s))}i.push(NaN);for(let o=0;o<a.length;o++)if(o<r-1)i.push(NaN);else{const e=a.slice(o-r+1,o+1).reduce((e,t)=>e+t,0)/r;i.push(e)}return i}function qr(e,t,n=20){const r=[];for(let i=0;i<e.length;i++)if(i<n-1)r.push(NaN);else{const a=e.slice(i-n+1,i+1),o=t.slice(i-n+1,i+1),s=a.reduce((e,t,n)=>e+t*o[n],0),c=o.reduce((e,t)=>e+t,0);r.push(s/c)}return r}class Qr{llm;constructor(e){this.llm=e}async analyze(e){const{companyOfInterest:t,tradeDate:n}=e,r=`You are a trading assistant tasked with analyzing financial markets. Your role is to select the **most relevant indicators** for a given market condition or trading strategy from the following list. The goal is to choose up to **8 indicators** that provide complementary insights without redundancy.\n\nMoving Averages:\n- close_50_sma: 50 SMA: A medium-term trend indicator. Identify trend direction and support/resistance.\n- close_200_sma: 200 SMA: A long-term trend benchmark. Confirm overall market trend and golden/death cross.\n- close_10_ema: 10 EMA: A responsive short-term average. Capture quick momentum shifts.\n\nMACD Related:\n- macd: MACD: Momentum via EMA differences. Look for crossovers and divergence.\n- macds: MACD Signal: EMA smoothing of MACD line. Use crossovers to trigger trades.\n- macdh: MACD Histogram: Gap between MACD and signal. Visualize momentum strength.\n\nMomentum Indicators:\n- rsi: RSI: Measures overbought/oversold conditions using 70/30 thresholds.\n\nVolatility Indicators:\n- boll: Bollinger Middle: 20 SMA basis for Bollinger Bands.\n- boll_ub: Bollinger Upper: 2 std devs above middle, signals overbought.\n- boll_lb: Bollinger Lower: 2 std devs below middle, signals oversold.\n- atr: ATR: Measures volatility for stop-loss and position sizing.\n\nVolume-Based Indicators:\n- vwma: VWMA: Volume-weighted moving average confirms trends.\n\nSelect indicators that provide diverse information and explain why they're suitable. Write a detailed report of trends observed.\nMake sure to append a Markdown table at the end of the report to organize key points.\n\nFor your reference, the current date is ${n}. The company we want to analyze is ${t}.`;try{const i=new Date(n),a=new Date(i);a.setMonth(a.getMonth()-6);const o=await Ur(t,a,i),s=["close_50_sma","close_200_sma","close_10_ema","rsi","macd","boll","atr","vwma"],c=await Vr(o,s),l=o.slice(-20),u=[{role:"system",content:r},{role:"user",content:`\nRecent Price Action for ${t}:\n${l.map(e=>`${e.date}: Close=$${e.close.toFixed(2)}, Volume=${e.volume}`).join("\n")}\n\nTechnical Indicators (Latest Values):\n- 50 SMA: ${c.sma50?.slice(-1)[0]?.toFixed(2)||"N/A"}\n- 200 SMA: ${c.sma200?.slice(-1)[0]?.toFixed(2)||"N/A"}\n- 10 EMA: ${c.ema10?.slice(-1)[0]?.toFixed(2)||"N/A"}\n- RSI: ${c.rsi?.slice(-1)[0]?.toFixed(2)||"N/A"}\n- MACD: ${c.macd?.slice(-1)[0]?.toFixed(2)||"N/A"}\n- Bollinger Upper: ${c.bollingerUpper?.slice(-1)[0]?.toFixed(2)||"N/A"}\n- Bollinger Middle: ${c.bollingerMiddle?.slice(-1)[0]?.toFixed(2)||"N/A"}\n- Bollinger Lower: ${c.bollingerLower?.slice(-1)[0]?.toFixed(2)||"N/A"}\n- ATR: ${c.atr?.slice(-1)[0]?.toFixed(2)||"N/A"}\n- VWMA: ${c.vwma?.slice(-1)[0]?.toFixed(2)||"N/A"}\n\nPlease analyze these indicators and provide a comprehensive market analysis report.`}],d=await this.llm.invoke(u);return{marketReport:d.content,messages:[...e.messages,{role:"assistant",content:d.content}],sender:"MarketAnalyst"}}catch(i){return console.error("Market Analyst error:",i),{marketReport:`Error analyzing market data for ${t}: ${i}`,sender:"MarketAnalyst"}}}}class Jr{llm;memory;constructor(e,t){this.llm=e,this.memory=t}async analyze(e){const{investmentDebateState:t,marketReport:n,sentimentReport:r,newsReport:i,fundamentalsReport:a}=e,o=`${n}\n\n${r}\n\n${i}\n\n${a}`,s=await this.memory.getMemories(o,2);let c="";c=s.length>0?s.map(e=>e.recommendation).join("\n\n"):"No past memories found.";const l=`You are a Bull Analyst advocating for investing in the stock. Your task is to build a strong, evidence-based case emphasizing growth potential, competitive advantages, and positive market indicators. Leverage the provided research and data to address concerns and counter bearish arguments effectively.\n\nKey points to focus on:\n- Growth Potential: Highlight the company's market opportunities, revenue projections, and scalability.\n- Competitive Advantages: Emphasize factors like unique products, strong branding, or dominant market positioning.\n- Positive Indicators: Use financial health, industry trends, and recent positive news as evidence.\n- Bear Counterpoints: Critically analyze the bear argument with specific data and sound reasoning, addressing concerns thoroughly and showing why the bull perspective holds stronger merit.\n- Engagement: Present your argument in a conversational style, engaging directly with the bear analyst's points and debating effectively rather than just listing data.\n\nResources available:\nMarket research report: ${n}\nSocial media sentiment report: ${r}\nLatest world affairs news: ${i}\nCompany fundamentals report: ${a}\nConversation history of the debate: ${t.history}\nLast bear argument: ${t.currentResponse}\nReflections from similar situations and lessons learned: ${c}\n\nUse this information to deliver a compelling bull argument, refute the bear's concerns, and engage in a dynamic debate that demonstrates the strengths of the bull position. You must also address reflections and learn from lessons and mistakes you made in the past.`,u=`Bull Analyst: ${(await this.llm.invoke(l)).content}`;return{investmentDebateState:{history:t.history+"\n"+u,bullHistory:t.bullHistory+"\n"+u,bearHistory:t.bearHistory,currentResponse:u,judgeDecision:t.judgeDecision,count:t.count+1}}}}class zr{llm;memory;constructor(e,t){this.llm=e,this.memory=t}async analyze(e){const{investmentDebateState:t,marketReport:n,sentimentReport:r,newsReport:i,fundamentalsReport:a}=e,o=`${n}\n\n${r}\n\n${i}\n\n${a}`,s=await this.memory.getMemories(o,2);let c="";c=s.length>0?s.map(e=>e.recommendation).join("\n\n"):"No past memories found.";const l=`You are a Bear Analyst advocating for caution or avoiding investment in the stock. Your task is to build a strong, evidence-based case emphasizing risks, challenges, and negative market indicators. Use the provided research and data to highlight concerns and counter bullish arguments effectively.\n\nKey points to focus on:\n- Risk Factors: Identify market risks, competitive threats, regulatory challenges, or economic headwinds.\n- Valuation Concerns: Point out if the stock is overvalued based on fundamentals or technical indicators.\n- Negative Indicators: Use weak financial metrics, declining trends, or negative news as evidence.\n- Bull Counterpoints: Critically analyze the bull argument with specific data and reasoning, showing why the bear perspective is more prudent.\n- Engagement: Present your argument conversationally, directly engaging with the bull analyst's points.\n\nResources available:\nMarket research report: ${n}\nSocial media sentiment report: ${r}\nLatest world affairs news: ${i}\nCompany fundamentals report: ${a}\nConversation history of the debate: ${t.history}\nLast bull argument: ${t.currentResponse}\nReflections from similar situations and lessons learned: ${c}\n\nUse this information to deliver a compelling bear argument, highlight risks, and engage in a dynamic debate. Learn from past mistakes reflected in the memories provided.`,u=`Bear Analyst: ${(await this.llm.invoke(l)).content}`;return{investmentDebateState:{history:t.history+"\n"+u,bullHistory:t.bullHistory,bearHistory:t.bearHistory+"\n"+u,currentResponse:u,judgeDecision:t.judgeDecision,count:t.count+1}}}}class Zr{llm;memory;constructor(e,t){this.llm=e,this.memory=t}async makeDecision(e){const{investmentDebateState:t,companyOfInterest:n}=e,r=`You are an Investment Judge tasked with evaluating the debate between a Bull Analyst and a Bear Analyst regarding ${n}.\n\nReview the complete debate history:\n${t.history}\n\nBased on the arguments presented by both sides:\n1. Evaluate the strength of each argument\n2. Consider the evidence provided\n3. Assess the risks and opportunities\n4. Make a final decision: Should we INVEST or NOT INVEST?\n\nProvide your reasoning and conclude with a clear decision: "FINAL DECISION: INVEST" or "FINAL DECISION: NOT INVEST"`,i=await this.llm.invoke(r),a=i.content.includes("INVEST")&&!i.content.includes("NOT INVEST")?"INVEST":"NOT INVEST";return{investmentDebateState:{...t,judgeDecision:i.content},investmentPlan:"INVEST"===a?"Proceed with investment based on bull arguments":"Avoid investment due to bear concerns"}}}class ei{llm;memory;constructor(e,t){this.llm=e,this.memory=t}async makeDecision(e){const{companyOfInterest:t,investmentPlan:n,marketReport:r,sentimentReport:i,newsReport:a,fundamentalsReport:o}=e,s=`${r}\n\n${i}\n\n${a}\n\n${o}`,c=await this.memory.getMemories(s,2);let l="";l=c.length>0?c.map(e=>e.recommendation).join("\n\n"):"No past memories found.";const u=[{role:"system",content:`You are a trading agent analyzing market data to make investment decisions. Based on your analysis, provide a specific recommendation to buy, sell, or hold. End with a firm decision and always conclude your response with 'FINAL TRANSACTION PROPOSAL: **BUY/HOLD/SELL**' to confirm your recommendation.\n\nDo not forget to utilize lessons from past decisions to learn from your mistakes. Here is some reflections from similar situations you traded in and the lessons learned:\n\n${l}`},{role:"user",content:`Based on a comprehensive analysis by a team of analysts, here is an investment plan tailored for ${t}. This plan incorporates insights from current technical market trends, macroeconomic indicators, and social media sentiment. Use this plan as a foundation for evaluating your next trading decision.\n\nProposed Investment Plan: ${n}\n\nLeverage these insights to make an informed and strategic decision.`}],d=await this.llm.invoke(u);return{traderInvestmentPlan:d.content,messages:[...e.messages,{role:"assistant",content:d.content}],sender:"Trader"}}}const ti={bodySerializer:e=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t)},ni=({allowReserved:e,explode:t,name:n,style:r,value:i})=>{if(!t){const t=(e?i:i.map(e=>encodeURIComponent(e))).join((e=>{switch(e){case"form":default:return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20"}})(r));switch(r){case"label":return`.${t}`;case"matrix":return`;${n}=${t}`;case"simple":return t;default:return`${n}=${t}`}}const a=(e=>{switch(e){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}})(r),o=i.map(t=>"label"===r||"simple"===r?e?t:encodeURIComponent(t):ri({allowReserved:e,name:n,value:t})).join(a);return"label"===r||"matrix"===r?a+o:o},ri=({allowReserved:e,name:t,value:n})=>{if(null==n)return"";if("object"==typeof n)throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${t}=${e?n:encodeURIComponent(n)}`},ii=({allowReserved:e,explode:t,name:n,style:r,value:i,valueOnly:a})=>{if(i instanceof Date)return a?i.toISOString():`${n}=${i.toISOString()}`;if("deepObject"!==r&&!t){let t=[];Object.entries(i).forEach(([n,r])=>{t=[...t,n,e?r:encodeURIComponent(r)]});const a=t.join(",");switch(r){case"form":return`${n}=${a}`;case"label":return`.${a}`;case"matrix":return`;${n}=${a}`;default:return a}}const o=(e=>{switch(e){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}})(r),s=Object.entries(i).map(([t,i])=>ri({allowReserved:e,name:"deepObject"===r?`${n}[${t}]`:t,value:i})).join(o);return"label"===r||"matrix"===r?o+s:s},ai=/\{[^{}]+\}/g,oi=({baseUrl:e,path:t,query:n,querySerializer:r,url:i})=>{let a=(e??"")+(i.startsWith("/")?i:`/${i}`);t&&(a=(({path:e,url:t})=>{let n=t;const r=t.match(ai);if(r)for(const i of r){let t=!1,r=i.substring(1,i.length-1),a="simple";r.endsWith("*")&&(t=!0,r=r.substring(0,r.length-1)),r.startsWith(".")?(r=r.substring(1),a="label"):r.startsWith(";")&&(r=r.substring(1),a="matrix");const o=e[r];if(null==o)continue;if(Array.isArray(o)){n=n.replace(i,ni({explode:t,name:r,style:a,value:o}));continue}if("object"==typeof o){n=n.replace(i,ii({explode:t,name:r,style:a,value:o,valueOnly:!0}));continue}if("matrix"===a){n=n.replace(i,`;${ri({name:r,value:o})}`);continue}const s=encodeURIComponent("label"===a?`.${o}`:o);n=n.replace(i,s)}return n})({path:t,url:a}));let o=n?r(n):"";return o.startsWith("?")&&(o=o.substring(1)),o&&(a+=`?${o}`),a};function si(e){const t=void 0!==e.body;if(t&&e.bodySerializer){if("serializedBody"in e){return void 0!==e.serializedBody&&""!==e.serializedBody?e.serializedBody:null}return""!==e.body?e.body:null}if(t)return e.body}const ci=async(e,t)=>{const n="function"==typeof t?await t(e):t;if(n)return"bearer"===e.scheme?`Bearer ${n}`:"basic"===e.scheme?`Basic ${btoa(n)}`:n},li=({parameters:e={},...t}={})=>n=>{const r=[];if(n&&"object"==typeof n)for(const i in n){const a=n[i];if(null==a)continue;const o=e[i]||t;if(Array.isArray(a)){const e=ni({allowReserved:o.allowReserved,explode:!0,name:i,style:"form",value:a,...o.array});e&&r.push(e)}else if("object"==typeof a){const e=ii({allowReserved:o.allowReserved,explode:!0,name:i,style:"deepObject",value:a,...o.object});e&&r.push(e)}else{const e=ri({allowReserved:o.allowReserved,name:i,value:a});e&&r.push(e)}}return r.join("&")},ui=(e,t)=>!!t&&!!(e.headers.has(t)||e.query?.[t]||e.headers.get("Cookie")?.includes(`${t}=`)),di=e=>oi({baseUrl:e.baseUrl,path:e.path,query:e.query,querySerializer:"function"==typeof e.querySerializer?e.querySerializer:li(e.querySerializer),url:e.url}),pi=(e,t)=>{const n={...e,...t};return n.baseUrl?.endsWith("/")&&(n.baseUrl=n.baseUrl.substring(0,n.baseUrl.length-1)),n.headers=fi(e.headers,t.headers),n},hi=e=>{const t=[];return e.forEach((e,n)=>{t.push([n,e])}),t},fi=(...e)=>{const t=new Headers;for(const n of e){if(!n)continue;const e=n instanceof Headers?hi(n):Object.entries(n);for(const[n,r]of e)if(null===r)t.delete(n);else if(Array.isArray(r))for(const e of r)t.append(n,e);else void 0!==r&&t.set(n,"object"==typeof r?JSON.stringify(r):r)}return t};class mi{fns=[];clear(){this.fns=[]}eject(e){const t=this.getInterceptorIndex(e);this.fns[t]&&(this.fns[t]=null)}exists(e){const t=this.getInterceptorIndex(e);return Boolean(this.fns[t])}getInterceptorIndex(e){return"number"==typeof e?this.fns[e]?e:-1:this.fns.indexOf(e)}update(e,t){const n=this.getInterceptorIndex(e);return!!this.fns[n]&&(this.fns[n]=t,e)}use(e){return this.fns.push(e),this.fns.length-1}}const gi=li({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),yi={"Content-Type":"application/json"},Ii=(e={})=>({...ti,headers:yi,parseAs:"auto",querySerializer:gi,...e}),Ci=((e={})=>{let t=pi(Ii(),e);const n=()=>({...t}),r={error:new mi,request:new mi,response:new mi},i=async e=>{const n={...t,...e,fetch:e.fetch??t.fetch??globalThis.fetch,headers:fi(t.headers,e.headers),serializedBody:void 0};n.security&&await(async({security:e,...t})=>{for(const n of e){if(ui(t,n.name))continue;const e=await ci(n,t.auth);if(!e)continue;const r=n.name??"Authorization";switch(n.in){case"query":t.query||(t.query={}),t.query[r]=e;break;case"cookie":t.headers.append("Cookie",`${r}=${e}`);break;default:t.headers.set(r,e)}}})({...n,security:n.security}),n.requestValidator&&await n.requestValidator(n),void 0!==n.body&&n.bodySerializer&&(n.serializedBody=n.bodySerializer(n.body)),void 0!==n.body&&""!==n.serializedBody||n.headers.delete("Content-Type");return{opts:n,url:di(n)}},a=async e=>{const{opts:t,url:n}=await i(e),a={redirect:"follow",...t,body:si(t)};let o=new Request(n,a);for(const i of r.request.fns)i&&(o=await i(o,t));const s=t.fetch;let c;try{c=await s(o)}catch(f){let e=f;for(const n of r.error.fns)n&&(e=await n(f,void 0,o,t));if(e=e||{},t.throwOnError)throw e;return"data"===t.responseStyle?void 0:{error:e,request:o,response:void 0}}for(const i of r.response.fns)i&&(c=await i(c,o,t));const l={request:o,response:c};if(c.ok){const e=("auto"===t.parseAs?(e=>{if(!e)return"stream";const t=e.split(";")[0]?.trim();return t?t.startsWith("application/json")||t.endsWith("+json")?"json":"multipart/form-data"===t?"formData":["application/","audio/","image/","video/"].some(e=>t.startsWith(e))?"blob":t.startsWith("text/")?"text":void 0:void 0})(c.headers.get("Content-Type")):t.parseAs)??"json";if(204===c.status||"0"===c.headers.get("Content-Length")){let n;switch(e){case"arrayBuffer":case"blob":case"text":n=await c[e]();break;case"formData":n=new FormData;break;case"stream":n=c.body;break;default:n={}}return"data"===t.responseStyle?n:{data:n,...l}}let n;switch(e){case"arrayBuffer":case"blob":case"formData":case"json":case"text":n=await c[e]();break;case"stream":return"data"===t.responseStyle?c.body:{data:c.body,...l}}return"json"===e&&(t.responseValidator&&await t.responseValidator(n),t.responseTransformer&&(n=await t.responseTransformer(n))),"data"===t.responseStyle?n:{data:n,...l}}const u=await c.text();let d;try{d=JSON.parse(u)}catch{}const p=d??u;let h=p;for(const i of r.error.fns)i&&(h=await i(p,c,o,t));if(h=h||{},t.throwOnError)throw h;return"data"===t.responseStyle?void 0:{error:h,...l}},o=e=>t=>a({...t,method:e}),s=e=>async t=>{const{opts:n,url:a}=await i(t);return(({onRequest:e,onSseError:t,onSseEvent:n,responseTransformer:r,responseValidator:i,sseDefaultRetryDelay:a,sseMaxRetryAttempts:o,sseMaxRetryDelay:s,sseSleepFn:c,url:l,...u})=>{let d;const p=c??(e=>new Promise(t=>setTimeout(t,e)));return{stream:async function*(){let c=a??3e3,h=0;const f=u.signal??(new AbortController).signal;for(;!f.aborted;){h++;const a=u.headers instanceof Headers?u.headers:new Headers(u.headers);void 0!==d&&a.set("Last-Event-ID",d);try{const t={redirect:"follow",...u,body:u.serializedBody,headers:a,signal:f};let o=new Request(l,t);e&&(o=await e(l,t));const s=u.fetch??globalThis.fetch,p=await s(o);if(!p.ok)throw new Error(`SSE failed: ${p.status} ${p.statusText}`);if(!p.body)throw new Error("No body in SSE response");const h=p.body.pipeThrough(new TextDecoderStream).getReader();let m="";const g=()=>{try{h.cancel()}catch{}};f.addEventListener("abort",g);try{for(;;){const{done:e,value:t}=await h.read();if(e)break;m+=t;const a=m.split("\n\n");m=a.pop()??"";for(const o of a){const e=o.split("\n"),t=[];let a,s;for(const n of e)if(n.startsWith("data:"))t.push(n.replace(/^data:\s*/,""));else if(n.startsWith("event:"))a=n.replace(/^event:\s*/,"");else if(n.startsWith("id:"))d=n.replace(/^id:\s*/,"");else if(n.startsWith("retry:")){const e=Number.parseInt(n.replace(/^retry:\s*/,""),10);Number.isNaN(e)||(c=e)}let l=!1;if(t.length){const e=t.join("\n");try{s=JSON.parse(e),l=!0}catch{s=e}}l&&(i&&await i(s),r&&(s=await r(s))),n?.({data:s,event:a,id:d,retry:c}),t.length&&(yield s)}}}finally{f.removeEventListener("abort",g),h.releaseLock()}break}catch(m){if(t?.(m),void 0!==o&&h>=o)break;const e=Math.min(c*2**(h-1),s??3e4);await p(e)}}}()}})({...n,body:n.body,headers:n.headers,method:e,onRequest:async(e,t)=>{let i=new Request(e,t);for(const a of r.request.fns)a&&(i=await a(i,n));return i},url:a})};return{buildUrl:di,connect:o("CONNECT"),delete:o("DELETE"),get:o("GET"),getConfig:n,head:o("HEAD"),interceptors:r,options:o("OPTIONS"),patch:o("PATCH"),post:o("POST"),put:o("PUT"),request:a,setConfig:e=>(t=pi(t,e),n()),sse:{connect:s("CONNECT"),delete:s("DELETE"),get:s("GET"),head:s("HEAD"),options:s("OPTIONS"),patch:s("PATCH"),post:s("POST"),put:s("PUT"),trace:s("TRACE")},trace:o("TRACE")}})((Ai=Ii(),{...Ai,baseUrl:"https://app.qwksearch.com/api"}));var Ai;class Si{llm;constructor(e){this.llm=e}async analyze(e){const{companyOfInterest:t,tradeDate:n}=e;try{const i=`${t} stock news analysis ${n}`;console.log(`NewsAnalyst searching for: ${i}`);const a=await(r={query:{q:i,cat:"news",recency:"month"}},(r.client??Ci).get({url:"/search",...r}));if(!a.data?.results||0===a.data.results.length)return{newsReport:`No significant news found for ${t} around ${n}.`,sender:"NewsAnalyst"};const o=a.data.results.slice(0,5).map((e,t)=>`\nArticle ${t+1}:\nTitle: ${e.title}\nSource: ${e.domain}\nSnippet: ${e.snippet}\nURL: ${e.url}\n`).join("\n"),s=`You are a financial news analyst. Your job is to synthesize news headlines and snippets into a concise, relevant report for a trading strategy.\n \nFocus on:\n1. Significant events (earnings, mergers, regulatory changes).\n2. Market sentiment (positive/negative coverage).\n3. Potential impact on stock price.\n\nProvide a summary first, then a bulleted list of key takeaways.\nThe current date is ${n}. The company is ${t}.`,c=[{role:"system",content:s},{role:"user",content:`Here are the latest news search results:\n${o}\n\nPlease analyze these and write your report.`}],l=await this.llm.invoke(c);return{newsReport:l.content,messages:[...e.messages,{role:"assistant",content:l.content}],sender:"NewsAnalyst"}}catch(i){return console.error("News Analyst error:",i),{newsReport:`Error analyzing news for ${t}: ${i}`,sender:"NewsAnalyst"}}var r}}const bi={llmProvider:"groq",deepThinkLLM:"llama3-70b-8192",quickThinkLLM:"llama3-8b-8192",temperature:.3,projectDir:"./data",apiKeys:{groq:process.env.GROQ_API_KEY||""}};var Ti="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function vi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function _i(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var n=function e(){var n=!1;try{n=this instanceof e}catch{}return n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var wi,Ei,Pi={exports:{}};const Ri={},Li=Object.freeze(Object.defineProperty({__proto__:null,default:Ri},Symbol.toStringTag,{value:"Module"})),Ni=_i(Li);var Oi,Bi,Mi,Di;function Fi(){if(Bi)return Oi;Bi=1;var e=function(){if(Ei)return wi;Ei=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===t.call(e)},a=function(n){if(!n||"[object Object]"!==t.call(n))return!1;var r,i=e.call(n,"constructor"),a=n.constructor&&n.constructor.prototype&&e.call(n.constructor.prototype,"isPrototypeOf");if(n.constructor&&!i&&!a)return!1;for(r in n);return void 0===r||e.call(n,r)},o=function(e,t){n&&"__proto__"===t.name?n(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},s=function(t,n){if("__proto__"===n){if(!e.call(t,n))return;if(r)return r(t,n).value}return t[n]};return wi=function e(){var t,n,r,c,l,u,d=arguments[0],p=1,h=arguments.length,f=!1;for("boolean"==typeof d&&(f=d,d=arguments[1]||{},p=2),(null==d||"object"!=typeof d&&"function"!=typeof d)&&(d={});p<h;++p)if(null!=(t=arguments[p]))for(n in t)r=s(d,n),d!==(c=s(t,n))&&(f&&c&&(a(c)||(l=i(c)))?(l?(l=!1,u=r&&i(r)?r:[]):u=r&&a(r)?r:{},o(d,{name:n,newValue:e(f,u,c)})):void 0!==c&&o(d,{name:n,newValue:c}));return d},wi}(),t=Ni,n=Ni;return Oi=function(){var r,i,a=Array.prototype.slice.call(arguments),o={};return a.length?1===a.length?a[0]:(i=a.map(function(n){var i="function"==typeof n?n():String(n||"");if(!i)return"";var a=t.parse(i,!0);return!r&&a&&(r=a),e(o,a.query),a.pathname}).filter(function(e){return!!e}),delete r.search,r.query=o,r.pathname=n.join.apply(n,i).replace(new RegExp("\\"+n.sep,"g"),"/"),t.format(r)):""},Oi}var ki,Gi,xi,Hi,Ui,Vi,$i,ji,Wi,Xi,Ki,Yi,qi,Qi,Ji,zi,Zi,ea={exports:{}},ta=ea.exports;function na(){return ki||(ki=1,e=ea,t=ea.exports,function(){var n,r="Expected a function",i="__lodash_hash_undefined__",a="__lodash_placeholder__",o=32,s=128,c=256,l=1/0,u=9007199254740991,d=NaN,p=4294967295,h=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",o],["partialRight",64],["rearg",c]],f="[object Arguments]",m="[object Array]",g="[object Boolean]",y="[object Date]",I="[object Error]",C="[object Function]",A="[object GeneratorFunction]",S="[object Map]",b="[object Number]",T="[object Object]",v="[object Promise]",_="[object RegExp]",w="[object Set]",E="[object String]",P="[object Symbol]",R="[object WeakMap]",L="[object ArrayBuffer]",N="[object DataView]",O="[object Float32Array]",B="[object Float64Array]",M="[object Int8Array]",D="[object Int16Array]",F="[object Int32Array]",k="[object Uint8Array]",G="[object Uint8ClampedArray]",x="[object Uint16Array]",H="[object Uint32Array]",U=/\b__p \+= '';/g,V=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,j=/&(?:amp|lt|gt|quot|#39);/g,W=/[&<>"']/g,X=RegExp(j.source),K=RegExp(W.source),Y=/<%-([\s\S]+?)%>/g,q=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,z=/^\w*$/,Z=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ee=/[\\^$.*+?()[\]{}|]/g,te=RegExp(ee.source),ne=/^\s+/,re=/\s/,ie=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,oe=/,? & /,se=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ce=/[()=,{}\[\]\/\s]/,le=/\\(\\)?/g,ue=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,de=/\w*$/,pe=/^[-+]0x[0-9a-f]+$/i,he=/^0b[01]+$/i,fe=/^\[object .+?Constructor\]$/,me=/^0o[0-7]+$/i,ge=/^(?:0|[1-9]\d*)$/,ye=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ie=/($^)/,Ce=/['\n\r\u2028\u2029\\]/g,Ae="\\ud800-\\udfff",Se="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",be="\\u2700-\\u27bf",Te="a-z\\xdf-\\xf6\\xf8-\\xff",ve="A-Z\\xc0-\\xd6\\xd8-\\xde",_e="\\ufe0e\\ufe0f",we="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="['’]",Pe="["+Ae+"]",Re="["+we+"]",Le="["+Se+"]",Ne="\\d+",Oe="["+be+"]",Be="["+Te+"]",Me="[^"+Ae+we+Ne+be+Te+ve+"]",De="\\ud83c[\\udffb-\\udfff]",Fe="[^"+Ae+"]",ke="(?:\\ud83c[\\udde6-\\uddff]){2}",Ge="[\\ud800-\\udbff][\\udc00-\\udfff]",xe="["+ve+"]",He="\\u200d",Ue="(?:"+Be+"|"+Me+")",Ve="(?:"+xe+"|"+Me+")",$e="(?:['’](?:d|ll|m|re|s|t|ve))?",je="(?:['’](?:D|LL|M|RE|S|T|VE))?",We="(?:"+Le+"|"+De+")?",Xe="["+_e+"]?",Ke=Xe+We+"(?:"+He+"(?:"+[Fe,ke,Ge].join("|")+")"+Xe+We+")*",Ye="(?:"+[Oe,ke,Ge].join("|")+")"+Ke,qe="(?:"+[Fe+Le+"?",Le,ke,Ge,Pe].join("|")+")",Qe=RegExp(Ee,"g"),Je=RegExp(Le,"g"),ze=RegExp(De+"(?="+De+")|"+qe+Ke,"g"),Ze=RegExp([xe+"?"+Be+"+"+$e+"(?="+[Re,xe,"$"].join("|")+")",Ve+"+"+je+"(?="+[Re,xe+Ue,"$"].join("|")+")",xe+"?"+Ue+"+"+$e,xe+"+"+je,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ne,Ye].join("|"),"g"),et=RegExp("["+He+Ae+Se+_e+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[O]=it[B]=it[M]=it[D]=it[F]=it[k]=it[G]=it[x]=it[H]=!0,it[f]=it[m]=it[L]=it[g]=it[N]=it[y]=it[I]=it[C]=it[S]=it[b]=it[T]=it[_]=it[w]=it[E]=it[R]=!1;var at={};at[f]=at[m]=at[L]=at[N]=at[g]=at[y]=at[O]=at[B]=at[M]=at[D]=at[F]=at[S]=at[b]=at[T]=at[_]=at[w]=at[E]=at[P]=at[k]=at[G]=at[x]=at[H]=!0,at[I]=at[C]=at[R]=!1;var ot={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},st=parseFloat,ct=parseInt,lt="object"==typeof Ti&&Ti&&Ti.Object===Object&&Ti,ut="object"==typeof self&&self&&self.Object===Object&&self,dt=lt||ut||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,ft=ht&&ht.exports===pt,mt=ft&&lt.process,gt=function(){try{var e=ht&&ht.require&&ht.require("util").types;return e||mt&&mt.binding&&mt.binding("util")}catch(t){}}(),yt=gt&&gt.isArrayBuffer,It=gt&&gt.isDate,Ct=gt&&gt.isMap,At=gt&&gt.isRegExp,St=gt&&gt.isSet,bt=gt&&gt.isTypedArray;function Tt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function vt(e,t,n,r){for(var i=-1,a=null==e?0:e.length;++i<a;){var o=e[i];t(r,o,n(o),e)}return r}function _t(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function wt(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function Et(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function Pt(e,t){for(var n=-1,r=null==e?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}function Rt(e,t){return!(null==e||!e.length)&&xt(e,t,0)>-1}function Lt(e,t,n){for(var r=-1,i=null==e?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}function Nt(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}function Ot(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function Bt(e,t,n,r){var i=-1,a=null==e?0:e.length;for(r&&a&&(n=e[++i]);++i<a;)n=t(n,e[i],i,e);return n}function Mt(e,t,n,r){var i=null==e?0:e.length;for(r&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n}function Dt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var Ft=$t("length");function kt(e,t,n){var r;return n(e,function(e,n,i){if(t(e,n,i))return r=n,!1}),r}function Gt(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}function xt(e,t,n){return t==t?function(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}(e,t,n):Gt(e,Ut,n)}function Ht(e,t,n,r){for(var i=n-1,a=e.length;++i<a;)if(r(e[i],t))return i;return-1}function Ut(e){return e!=e}function Vt(e,t){var n=null==e?0:e.length;return n?Xt(e,t)/n:d}function $t(e){return function(t){return null==t?n:t[e]}}function jt(e){return function(t){return null==e?n:e[t]}}function Wt(e,t,n,r,i){return i(e,function(e,i,a){n=r?(r=!1,e):t(n,e,i,a)}),n}function Xt(e,t){for(var r,i=-1,a=e.length;++i<a;){var o=t(e[i]);o!==n&&(r=r===n?o:r+o)}return r}function Kt(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Yt(e){return e?e.slice(0,dn(e)+1).replace(ne,""):e}function qt(e){return function(t){return e(t)}}function Qt(e,t){return Nt(t,function(t){return e[t]})}function Jt(e,t){return e.has(t)}function zt(e,t){for(var n=-1,r=e.length;++n<r&&xt(t,e[n],0)>-1;);return n}function Zt(e,t){for(var n=e.length;n--&&xt(t,e[n],0)>-1;);return n}var en=jt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),tn=jt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function nn(e){return"\\"+ot[e]}function rn(e){return et.test(e)}function an(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function on(e,t){return function(n){return e(t(n))}}function sn(e,t){for(var n=-1,r=e.length,i=0,o=[];++n<r;){var s=e[n];s!==t&&s!==a||(e[n]=a,o[i++]=n)}return o}function cn(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}function ln(e){return rn(e)?function(e){for(var t=ze.lastIndex=0;ze.test(e);)++t;return t}(e):Ft(e)}function un(e){return rn(e)?function(e){return e.match(ze)||[]}(e):function(e){return e.split("")}(e)}function dn(e){for(var t=e.length;t--&&re.test(e.charAt(t)););return t}var pn=jt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),hn=function e(t){var re,Ae=(t=null==t?dt:hn.defaults(dt.Object(),t,hn.pick(dt,nt))).Array,Se=t.Date,be=t.Error,Te=t.Function,ve=t.Math,_e=t.Object,we=t.RegExp,Ee=t.String,Pe=t.TypeError,Re=Ae.prototype,Le=Te.prototype,Ne=_e.prototype,Oe=t["__core-js_shared__"],Be=Le.toString,Me=Ne.hasOwnProperty,De=0,Fe=(re=/[^.]+$/.exec(Oe&&Oe.keys&&Oe.keys.IE_PROTO||""))?"Symbol(src)_1."+re:"",ke=Ne.toString,Ge=Be.call(_e),xe=dt._,He=we("^"+Be.call(Me).replace(ee,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ue=ft?t.Buffer:n,Ve=t.Symbol,$e=t.Uint8Array,je=Ue?Ue.allocUnsafe:n,We=on(_e.getPrototypeOf,_e),Xe=_e.create,Ke=Ne.propertyIsEnumerable,Ye=Re.splice,qe=Ve?Ve.isConcatSpreadable:n,ze=Ve?Ve.iterator:n,et=Ve?Ve.toStringTag:n,ot=function(){try{var e=la(_e,"defineProperty");return e({},"",{}),e}catch(t){}}(),lt=t.clearTimeout!==dt.clearTimeout&&t.clearTimeout,ut=Se&&Se.now!==dt.Date.now&&Se.now,pt=t.setTimeout!==dt.setTimeout&&t.setTimeout,ht=ve.ceil,mt=ve.floor,gt=_e.getOwnPropertySymbols,Ft=Ue?Ue.isBuffer:n,jt=t.isFinite,fn=Re.join,mn=on(_e.keys,_e),gn=ve.max,yn=ve.min,In=Se.now,Cn=t.parseInt,An=ve.random,Sn=Re.reverse,bn=la(t,"DataView"),Tn=la(t,"Map"),vn=la(t,"Promise"),_n=la(t,"Set"),wn=la(t,"WeakMap"),En=la(_e,"create"),Pn=wn&&new wn,Rn={},Ln=Ga(bn),Nn=Ga(Tn),On=Ga(vn),Bn=Ga(_n),Mn=Ga(wn),Dn=Ve?Ve.prototype:n,Fn=Dn?Dn.valueOf:n,kn=Dn?Dn.toString:n;function Gn(e){if(ns(e)&&!Wo(e)&&!(e instanceof Vn)){if(e instanceof Un)return e;if(Me.call(e,"__wrapped__"))return xa(e)}return new Un(e)}var xn=function(){function e(){}return function(t){if(!ts(t))return{};if(Xe)return Xe(t);e.prototype=t;var r=new e;return e.prototype=n,r}}();function Hn(){}function Un(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=n}function Vn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=p,this.__views__=[]}function $n(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function jn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Xn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Wn;++t<n;)this.add(e[t])}function Kn(e){var t=this.__data__=new jn(e);this.size=t.size}function Yn(e,t){var n=Wo(e),r=!n&&jo(e),i=!n&&!r&&qo(e),a=!n&&!r&&!i&&us(e),o=n||r||i||a,s=o?Kt(e.length,Ee):[],c=s.length;for(var l in e)!t&&!Me.call(e,l)||o&&("length"==l||i&&("offset"==l||"parent"==l)||a&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||ga(l,c))||s.push(l);return s}function qn(e){var t=e.length;return t?e[Xr(0,t-1)]:n}function Qn(e,t){return Oa(Ei(e),ar(t,0,e.length))}function Jn(e){return Oa(Ei(e))}function zn(e,t,r){(r!==n&&!Uo(e[t],r)||r===n&&!(t in e))&&rr(e,t,r)}function Zn(e,t,r){var i=e[t];Me.call(e,t)&&Uo(i,r)&&(r!==n||t in e)||rr(e,t,r)}function er(e,t){for(var n=e.length;n--;)if(Uo(e[n][0],t))return n;return-1}function tr(e,t,n,r){return ur(e,function(e,i,a){t(r,e,n(e),a)}),r}function nr(e,t){return e&&Pi(t,Os(t),e)}function rr(e,t,n){"__proto__"==t&&ot?ot(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ir(e,t){for(var r=-1,i=t.length,a=Ae(i),o=null==e;++r<i;)a[r]=o?n:Es(e,t[r]);return a}function ar(e,t,r){return e==e&&(r!==n&&(e=e<=r?e:r),t!==n&&(e=e>=t?e:t)),e}function or(e,t,r,i,a,o){var s,c=1&t,l=2&t,u=4&t;if(r&&(s=a?r(e,i,a,o):r(e)),s!==n)return s;if(!ts(e))return e;var d=Wo(e);if(d){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Me.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!c)return Ei(e,s)}else{var p=pa(e),h=p==C||p==A;if(qo(e))return Si(e,c);if(p==T||p==f||h&&!a){if(s=l||h?{}:fa(e),!c)return l?function(e,t){return Pi(e,da(e),t)}(e,function(e,t){return e&&Pi(t,Bs(t),e)}(s,e)):function(e,t){return Pi(e,ua(e),t)}(e,nr(s,e))}else{if(!at[p])return a?e:{};s=function(e,t,n){var r,i=e.constructor;switch(t){case L:return bi(e);case g:case y:return new i(+e);case N:return function(e,t){var n=t?bi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case O:case B:case M:case D:case F:case k:case G:case x:case H:return Ti(e,n);case S:return new i;case b:case E:return new i(e);case _:return function(e){var t=new e.constructor(e.source,de.exec(e));return t.lastIndex=e.lastIndex,t}(e);case w:return new i;case P:return r=e,Fn?_e(Fn.call(r)):{}}}(e,p,c)}}o||(o=new Kn);var m=o.get(e);if(m)return m;o.set(e,s),ss(e)?e.forEach(function(n){s.add(or(n,t,r,n,e,o))}):rs(e)&&e.forEach(function(n,i){s.set(i,or(n,t,r,i,e,o))});var I=d?n:(u?l?na:ta:l?Bs:Os)(e);return _t(I||e,function(n,i){I&&(n=e[i=n]),Zn(s,i,or(n,t,r,i,e,o))}),s}function sr(e,t,r){var i=r.length;if(null==e)return!i;for(e=_e(e);i--;){var a=r[i],o=t[a],s=e[a];if(s===n&&!(a in e)||!o(s))return!1}return!0}function cr(e,t,i){if("function"!=typeof e)throw new Pe(r);return Pa(function(){e.apply(n,i)},t)}function lr(e,t,n,r){var i=-1,a=Rt,o=!0,s=e.length,c=[],l=t.length;if(!s)return c;n&&(t=Nt(t,qt(n))),r?(a=Lt,o=!1):t.length>=200&&(a=Jt,o=!1,t=new Xn(t));e:for(;++i<s;){var u=e[i],d=null==n?u:n(u);if(u=r||0!==u?u:0,o&&d==d){for(var p=l;p--;)if(t[p]===d)continue e;c.push(u)}else a(t,d,r)||c.push(u)}return c}Gn.templateSettings={escape:Y,evaluate:q,interpolate:Q,variable:"",imports:{_:Gn}},Gn.prototype=Hn.prototype,Gn.prototype.constructor=Gn,Un.prototype=xn(Hn.prototype),Un.prototype.constructor=Un,Vn.prototype=xn(Hn.prototype),Vn.prototype.constructor=Vn,$n.prototype.clear=function(){this.__data__=En?En(null):{},this.size=0},$n.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},$n.prototype.get=function(e){var t=this.__data__;if(En){var r=t[e];return r===i?n:r}return Me.call(t,e)?t[e]:n},$n.prototype.has=function(e){var t=this.__data__;return En?t[e]!==n:Me.call(t,e)},$n.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=En&&t===n?i:t,this},jn.prototype.clear=function(){this.__data__=[],this.size=0},jn.prototype.delete=function(e){var t=this.__data__,n=er(t,e);return!(n<0||(n==t.length-1?t.pop():Ye.call(t,n,1),--this.size,0))},jn.prototype.get=function(e){var t=this.__data__,r=er(t,e);return r<0?n:t[r][1]},jn.prototype.has=function(e){return er(this.__data__,e)>-1},jn.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Wn.prototype.clear=function(){this.size=0,this.__data__={hash:new $n,map:new(Tn||jn),string:new $n}},Wn.prototype.delete=function(e){var t=sa(this,e).delete(e);return this.size-=t?1:0,t},Wn.prototype.get=function(e){return sa(this,e).get(e)},Wn.prototype.has=function(e){return sa(this,e).has(e)},Wn.prototype.set=function(e,t){var n=sa(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Xn.prototype.add=Xn.prototype.push=function(e){return this.__data__.set(e,i),this},Xn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new jn,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof jn){var r=n.__data__;if(!Tn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Wn(r)}return n.set(e,t),this.size=n.size,this};var ur=Ni(Ir),dr=Ni(Cr,!0);function pr(e,t){var n=!0;return ur(e,function(e,r,i){return n=!!t(e,r,i)}),n}function hr(e,t,r){for(var i=-1,a=e.length;++i<a;){var o=e[i],s=t(o);if(null!=s&&(c===n?s==s&&!ls(s):r(s,c)))var c=s,l=o}return l}function fr(e,t){var n=[];return ur(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}function mr(e,t,n,r,i){var a=-1,o=e.length;for(n||(n=ma),i||(i=[]);++a<o;){var s=e[a];t>0&&n(s)?t>1?mr(s,t-1,n,r,i):Ot(i,s):r||(i[i.length]=s)}return i}var gr=Oi(),yr=Oi(!0);function Ir(e,t){return e&&gr(e,t,Os)}function Cr(e,t){return e&&yr(e,t,Os)}function Ar(e,t){return Pt(t,function(t){return zo(e[t])})}function Sr(e,t){for(var r=0,i=(t=yi(t,e)).length;null!=e&&r<i;)e=e[ka(t[r++])];return r&&r==i?e:n}function br(e,t,n){var r=t(e);return Wo(e)?r:Ot(r,n(e))}function Tr(e){return null==e?e===n?"[object Undefined]":"[object Null]":et&&et in _e(e)?function(e){var t=Me.call(e,et),r=e[et];try{e[et]=n;var i=!0}catch(o){}var a=ke.call(e);return i&&(t?e[et]=r:delete e[et]),a}(e):function(e){return ke.call(e)}(e)}function vr(e,t){return e>t}function _r(e,t){return null!=e&&Me.call(e,t)}function wr(e,t){return null!=e&&t in _e(e)}function Er(e,t,r){for(var i=r?Lt:Rt,a=e[0].length,o=e.length,s=o,c=Ae(o),l=1/0,u=[];s--;){var d=e[s];s&&t&&(d=Nt(d,qt(t))),l=yn(d.length,l),c[s]=!r&&(t||a>=120&&d.length>=120)?new Xn(s&&d):n}d=e[0];var p=-1,h=c[0];e:for(;++p<a&&u.length<l;){var f=d[p],m=t?t(f):f;if(f=r||0!==f?f:0,!(h?Jt(h,m):i(u,m,r))){for(s=o;--s;){var g=c[s];if(!(g?Jt(g,m):i(e[s],m,r)))continue e}h&&h.push(m),u.push(f)}}return u}function Pr(e,t,r){var i=null==(e=_a(e,t=yi(t,e)))?e:e[ka(Qa(t))];return null==i?n:Tt(i,e,r)}function Rr(e){return ns(e)&&Tr(e)==f}function Lr(e,t,r,i,a){return e===t||(null==e||null==t||!ns(e)&&!ns(t)?e!=e&&t!=t:function(e,t,r,i,a,o){var s=Wo(e),c=Wo(t),l=s?m:pa(e),u=c?m:pa(t),d=(l=l==f?T:l)==T,p=(u=u==f?T:u)==T,h=l==u;if(h&&qo(e)){if(!qo(t))return!1;s=!0,d=!1}if(h&&!d)return o||(o=new Kn),s||us(e)?Zi(e,t,r,i,a,o):function(e,t,n,r,i,a,o){switch(n){case N:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case L:return!(e.byteLength!=t.byteLength||!a(new $e(e),new $e(t)));case g:case y:case b:return Uo(+e,+t);case I:return e.name==t.name&&e.message==t.message;case _:case E:return e==t+"";case S:var s=an;case w:var c=1&r;if(s||(s=cn),e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;r|=2,o.set(e,t);var u=Zi(s(e),s(t),r,i,a,o);return o.delete(e),u;case P:if(Fn)return Fn.call(e)==Fn.call(t)}return!1}(e,t,l,r,i,a,o);if(!(1&r)){var C=d&&Me.call(e,"__wrapped__"),A=p&&Me.call(t,"__wrapped__");if(C||A){var v=C?e.value():e,R=A?t.value():t;return o||(o=new Kn),a(v,R,r,i,o)}}return!!h&&(o||(o=new Kn),function(e,t,r,i,a,o){var s=1&r,c=ta(e),l=c.length,u=ta(t),d=u.length;if(l!=d&&!s)return!1;for(var p=l;p--;){var h=c[p];if(!(s?h in t:Me.call(t,h)))return!1}var f=o.get(e),m=o.get(t);if(f&&m)return f==t&&m==e;var g=!0;o.set(e,t),o.set(t,e);for(var y=s;++p<l;){var I=e[h=c[p]],C=t[h];if(i)var A=s?i(C,I,h,t,e,o):i(I,C,h,e,t,o);if(!(A===n?I===C||a(I,C,r,i,o):A)){g=!1;break}y||(y="constructor"==h)}if(g&&!y){var S=e.constructor,b=t.constructor;S==b||!("constructor"in e)||!("constructor"in t)||"function"==typeof S&&S instanceof S&&"function"==typeof b&&b instanceof b||(g=!1)}return o.delete(e),o.delete(t),g}(e,t,r,i,a,o))}(e,t,r,i,Lr,a))}function Nr(e,t,r,i){var a=r.length,o=a,s=!i;if(null==e)return!o;for(e=_e(e);a--;){var c=r[a];if(s&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++a<o;){var l=(c=r[a])[0],u=e[l],d=c[1];if(s&&c[2]){if(u===n&&!(l in e))return!1}else{var p=new Kn;if(i)var h=i(u,d,l,e,t,p);if(!(h===n?Lr(d,u,3,i,p):h))return!1}}return!0}function Or(e){return!(!ts(e)||(t=e,Fe&&Fe in t))&&(zo(e)?He:fe).test(Ga(e));var t}function Br(e){return"function"==typeof e?e:null==e?ic:"object"==typeof e?Wo(e)?xr(e[0],e[1]):Gr(e):hc(e)}function Mr(e){if(!Sa(e))return mn(e);var t=[];for(var n in _e(e))Me.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Dr(e){if(!ts(e))return function(e){var t=[];if(null!=e)for(var n in _e(e))t.push(n);return t}(e);var t=Sa(e),n=[];for(var r in e)("constructor"!=r||!t&&Me.call(e,r))&&n.push(r);return n}function Fr(e,t){return e<t}function kr(e,t){var n=-1,r=Ko(e)?Ae(e.length):[];return ur(e,function(e,i,a){r[++n]=t(e,i,a)}),r}function Gr(e){var t=ca(e);return 1==t.length&&t[0][2]?Ta(t[0][0],t[0][1]):function(n){return n===e||Nr(n,e,t)}}function xr(e,t){return Ia(e)&&ba(t)?Ta(ka(e),t):function(r){var i=Es(r,e);return i===n&&i===t?Ps(r,e):Lr(t,i,3)}}function Hr(e,t,r,i,a){e!==t&&gr(t,function(o,s){if(a||(a=new Kn),ts(o))!function(e,t,r,i,a,o,s){var c=wa(e,r),l=wa(t,r),u=s.get(l);if(u)zn(e,r,u);else{var d=o?o(c,l,r+"",e,t,s):n,p=d===n;if(p){var h=Wo(l),f=!h&&qo(l),m=!h&&!f&&us(l);d=l,h||f||m?Wo(c)?d=c:Yo(c)?d=Ei(c):f?(p=!1,d=Si(l,!0)):m?(p=!1,d=Ti(l,!0)):d=[]:as(l)||jo(l)?(d=c,jo(c)?d=Is(c):ts(c)&&!zo(c)||(d=fa(l))):p=!1}p&&(s.set(l,d),a(d,l,i,o,s),s.delete(l)),zn(e,r,d)}}(e,t,s,r,Hr,i,a);else{var c=i?i(wa(e,s),o,s+"",e,t,a):n;c===n&&(c=o),zn(e,s,c)}},Bs)}function Ur(e,t){var r=e.length;if(r)return ga(t+=t<0?r:0,r)?e[t]:n}function Vr(e,t,n){t=t.length?Nt(t,function(e){return Wo(e)?function(t){return Sr(t,1===e.length?e[0]:e)}:e}):[ic];var r=-1;return t=Nt(t,qt(oa())),function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(kr(e,function(e,n,i){return{criteria:Nt(t,function(t){return t(e)}),index:++r,value:e}}),function(e,t){return function(e,t,n){for(var r=-1,i=e.criteria,a=t.criteria,o=i.length,s=n.length;++r<o;){var c=vi(i[r],a[r]);if(c)return r>=s?c:c*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)})}function $r(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=Sr(e,o);n(s,o)&&Jr(a,yi(o,e),s)}return a}function jr(e,t,n,r){var i=r?Ht:xt,a=-1,o=t.length,s=e;for(e===t&&(t=Ei(t)),n&&(s=Nt(e,qt(n)));++a<o;)for(var c=0,l=t[a],u=n?n(l):l;(c=i(s,u,c,r))>-1;)s!==e&&Ye.call(s,c,1),Ye.call(e,c,1);return e}function Wr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==a){var a=i;ga(i)?Ye.call(e,i,1):li(e,i)}}return e}function Xr(e,t){return e+mt(An()*(t-e+1))}function Kr(e,t){var n="";if(!e||t<1||t>u)return n;do{t%2&&(n+=e),(t=mt(t/2))&&(e+=e)}while(t);return n}function Yr(e,t){return Ra(va(e,t,ic),e+"")}function qr(e){return qn(Us(e))}function Qr(e,t){var n=Us(e);return Oa(n,ar(t,0,n.length))}function Jr(e,t,r,i){if(!ts(e))return e;for(var a=-1,o=(t=yi(t,e)).length,s=o-1,c=e;null!=c&&++a<o;){var l=ka(t[a]),u=r;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(a!=s){var d=c[l];(u=i?i(d,l,c):n)===n&&(u=ts(d)?d:ga(t[a+1])?[]:{})}Zn(c,l,u),c=c[l]}return e}var zr=Pn?function(e,t){return Pn.set(e,t),e}:ic,Zr=ot?function(e,t){return ot(e,"toString",{configurable:!0,enumerable:!1,value:tc(t),writable:!0})}:ic;function ei(e){return Oa(Us(e))}function ti(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Ae(i);++r<i;)a[r]=e[r+t];return a}function ni(e,t){var n;return ur(e,function(e,r,i){return!(n=t(e,r,i))}),!!n}function ri(e,t,n){var r=0,i=null==e?r:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;r<i;){var a=r+i>>>1,o=e[a];null!==o&&!ls(o)&&(n?o<=t:o<t)?r=a+1:i=a}return i}return ii(e,t,ic,n)}function ii(e,t,r,i){var a=0,o=null==e?0:e.length;if(0===o)return 0;for(var s=(t=r(t))!=t,c=null===t,l=ls(t),u=t===n;a<o;){var d=mt((a+o)/2),p=r(e[d]),h=p!==n,f=null===p,m=p==p,g=ls(p);if(s)var y=i||m;else y=u?m&&(i||h):c?m&&h&&(i||!f):l?m&&h&&!f&&(i||!g):!f&&!g&&(i?p<=t:p<t);y?a=d+1:o=d}return yn(o,4294967294)}function ai(e,t){for(var n=-1,r=e.length,i=0,a=[];++n<r;){var o=e[n],s=t?t(o):o;if(!n||!Uo(s,c)){var c=s;a[i++]=0===o?0:o}}return a}function oi(e){return"number"==typeof e?e:ls(e)?d:+e}function si(e){if("string"==typeof e)return e;if(Wo(e))return Nt(e,si)+"";if(ls(e))return kn?kn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function ci(e,t,n){var r=-1,i=Rt,a=e.length,o=!0,s=[],c=s;if(n)o=!1,i=Lt;else if(a>=200){var l=t?null:Ki(e);if(l)return cn(l);o=!1,i=Jt,c=new Xn}else c=t?[]:s;e:for(;++r<a;){var u=e[r],d=t?t(u):u;if(u=n||0!==u?u:0,o&&d==d){for(var p=c.length;p--;)if(c[p]===d)continue e;t&&c.push(d),s.push(u)}else i(c,d,n)||(c!==s&&c.push(d),s.push(u))}return s}function li(e,t){var n=-1,r=(t=yi(t,e)).length;if(!r)return!0;for(;++n<r;){var i=ka(t[n]);if("__proto__"===i&&!Me.call(e,"__proto__"))return!1;if(("constructor"===i||"prototype"===i)&&n<r-1)return!1}var a=_a(e,t);return null==a||delete a[ka(Qa(t))]}function ui(e,t,n,r){return Jr(e,t,n(Sr(e,t)),r)}function di(e,t,n,r){for(var i=e.length,a=r?i:-1;(r?a--:++a<i)&&t(e[a],a,e););return n?ti(e,r?0:a,r?a+1:i):ti(e,r?a+1:0,r?i:a)}function pi(e,t){var n=e;return n instanceof Vn&&(n=n.value()),Bt(t,function(e,t){return t.func.apply(t.thisArg,Ot([e],t.args))},n)}function hi(e,t,n){var r=e.length;if(r<2)return r?ci(e[0]):[];for(var i=-1,a=Ae(r);++i<r;)for(var o=e[i],s=-1;++s<r;)s!=i&&(a[i]=lr(a[i]||o,e[s],t,n));return ci(mr(a,1),t,n)}function fi(e,t,r){for(var i=-1,a=e.length,o=t.length,s={};++i<a;){var c=i<o?t[i]:n;r(s,e[i],c)}return s}function mi(e){return Yo(e)?e:[]}function gi(e){return"function"==typeof e?e:ic}function yi(e,t){return Wo(e)?e:Ia(e,t)?[e]:Fa(Cs(e))}var Ii=Yr;function Ci(e,t,r){var i=e.length;return r=r===n?i:r,!t&&r>=i?e:ti(e,t,r)}var Ai=lt||function(e){return dt.clearTimeout(e)};function Si(e,t){if(t)return e.slice();var n=e.length,r=je?je(n):new e.constructor(n);return e.copy(r),r}function bi(e){var t=new e.constructor(e.byteLength);return new $e(t).set(new $e(e)),t}function Ti(e,t){var n=t?bi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function vi(e,t){if(e!==t){var r=e!==n,i=null===e,a=e==e,o=ls(e),s=t!==n,c=null===t,l=t==t,u=ls(t);if(!c&&!u&&!o&&e>t||o&&s&&l&&!c&&!u||i&&s&&l||!r&&l||!a)return 1;if(!i&&!o&&!u&&e<t||u&&r&&a&&!i&&!o||c&&r&&a||!s&&a||!l)return-1}return 0}function _i(e,t,n,r){for(var i=-1,a=e.length,o=n.length,s=-1,c=t.length,l=gn(a-o,0),u=Ae(c+l),d=!r;++s<c;)u[s]=t[s];for(;++i<o;)(d||i<a)&&(u[n[i]]=e[i]);for(;l--;)u[s++]=e[i++];return u}function wi(e,t,n,r){for(var i=-1,a=e.length,o=-1,s=n.length,c=-1,l=t.length,u=gn(a-s,0),d=Ae(u+l),p=!r;++i<u;)d[i]=e[i];for(var h=i;++c<l;)d[h+c]=t[c];for(;++o<s;)(p||i<a)&&(d[h+n[o]]=e[i++]);return d}function Ei(e,t){var n=-1,r=e.length;for(t||(t=Ae(r));++n<r;)t[n]=e[n];return t}function Pi(e,t,r,i){var a=!r;r||(r={});for(var o=-1,s=t.length;++o<s;){var c=t[o],l=i?i(r[c],e[c],c,r,e):n;l===n&&(l=e[c]),a?rr(r,c,l):Zn(r,c,l)}return r}function Ri(e,t){return function(n,r){var i=Wo(n)?vt:tr,a=t?t():{};return i(n,e,oa(r,2),a)}}function Li(e){return Yr(function(t,r){var i=-1,a=r.length,o=a>1?r[a-1]:n,s=a>2?r[2]:n;for(o=e.length>3&&"function"==typeof o?(a--,o):n,s&&ya(r[0],r[1],s)&&(o=a<3?n:o,a=1),t=_e(t);++i<a;){var c=r[i];c&&e(t,c,i,o)}return t})}function Ni(e,t){return function(n,r){if(null==n)return n;if(!Ko(n))return e(n,r);for(var i=n.length,a=t?i:-1,o=_e(n);(t?a--:++a<i)&&!1!==r(o[a],a,o););return n}}function Oi(e){return function(t,n,r){for(var i=-1,a=_e(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(!1===n(a[c],c,a))break}return t}}function Bi(e){return function(t){var r=rn(t=Cs(t))?un(t):n,i=r?r[0]:t.charAt(0),a=r?Ci(r,1).join(""):t.slice(1);return i[e]()+a}}function Mi(e){return function(t){return Bt(zs(js(t).replace(Qe,"")),e,"")}}function Di(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=xn(e.prototype),r=e.apply(n,t);return ts(r)?r:n}}function Fi(e){return function(t,r,i){var a=_e(t);if(!Ko(t)){var o=oa(r,3);t=Os(t),r=function(e){return o(a[e],e,a)}}var s=e(t,r,i);return s>-1?a[o?t[s]:s]:n}}function ki(e){return ea(function(t){var i=t.length,a=i,o=Un.prototype.thru;for(e&&t.reverse();a--;){var s=t[a];if("function"!=typeof s)throw new Pe(r);if(o&&!c&&"wrapper"==ia(s))var c=new Un([],!0)}for(a=c?a:i;++a<i;){var l=ia(s=t[a]),u="wrapper"==l?ra(s):n;c=u&&Ca(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?c[ia(u[0])].apply(c,u[3]):1==s.length&&Ca(s)?c[l]():c.thru(s)}return function(){var e=arguments,n=e[0];if(c&&1==e.length&&Wo(n))return c.plant(n).value();for(var r=0,a=i?t[r].apply(this,e):n;++r<i;)a=t[r].call(this,a);return a}})}function Gi(e,t,r,i,a,o,c,l,u,d){var p=t&s,h=1&t,f=2&t,m=24&t,g=512&t,y=f?n:Di(e);return function s(){for(var I=arguments.length,C=Ae(I),A=I;A--;)C[A]=arguments[A];if(m)var S=aa(s),b=function(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}(C,S);if(i&&(C=_i(C,i,a,m)),o&&(C=wi(C,o,c,m)),I-=b,m&&I<d){var T=sn(C,S);return Wi(e,t,Gi,s.placeholder,r,C,T,l,u,d-I)}var v=h?r:this,_=f?v[e]:e;return I=C.length,l?C=function(e,t){for(var r=e.length,i=yn(t.length,r),a=Ei(e);i--;){var o=t[i];e[i]=ga(o,r)?a[o]:n}return e}(C,l):g&&I>1&&C.reverse(),p&&u<I&&(C.length=u),this&&this!==dt&&this instanceof s&&(_=y||Di(_)),_.apply(v,C)}}function xi(e,t){return function(n,r){return function(e,t,n,r){return Ir(e,function(e,i,a){t(r,n(e),i,a)}),r}(n,e,t(r),{})}}function Hi(e,t){return function(r,i){var a;if(r===n&&i===n)return t;if(r!==n&&(a=r),i!==n){if(a===n)return i;"string"==typeof r||"string"==typeof i?(r=si(r),i=si(i)):(r=oi(r),i=oi(i)),a=e(r,i)}return a}}function Ui(e){return ea(function(t){return t=Nt(t,qt(oa())),Yr(function(n){var r=this;return e(t,function(e){return Tt(e,r,n)})})})}function Vi(e,t){var r=(t=t===n?" ":si(t)).length;if(r<2)return r?Kr(t,e):t;var i=Kr(t,ht(e/ln(t)));return rn(t)?Ci(un(i),0,e).join(""):i.slice(0,e)}function $i(e){return function(t,r,i){return i&&"number"!=typeof i&&ya(t,r,i)&&(r=i=n),t=fs(t),r===n?(r=t,t=0):r=fs(r),function(e,t,n,r){for(var i=-1,a=gn(ht((t-e)/(n||1)),0),o=Ae(a);a--;)o[r?a:++i]=e,e+=n;return o}(t,r,i=i===n?t<r?1:-1:fs(i),e)}}function ji(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=ys(t),n=ys(n)),e(t,n)}}function Wi(e,t,r,i,a,s,c,l,u,d){var p=8&t;t|=p?o:64,4&(t&=~(p?64:o))||(t&=-4);var h=[e,t,a,p?s:n,p?c:n,p?n:s,p?n:c,l,u,d],f=r.apply(n,h);return Ca(e)&&Ea(f,h),f.placeholder=i,La(f,e,t)}function Xi(e){var t=ve[e];return function(e,n){if(e=ys(e),(n=null==n?0:yn(ms(n),292))&&jt(e)){var r=(Cs(e)+"e").split("e");return+((r=(Cs(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var Ki=_n&&1/cn(new _n([,-0]))[1]==l?function(e){return new _n(e)}:lc;function Yi(e){return function(t){var n=pa(t);return n==S?an(t):n==w?function(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}(t):function(e,t){return Nt(t,function(t){return[t,e[t]]})}(t,e(t))}}function qi(e,t,i,l,u,d,p,h){var f=2&t;if(!f&&"function"!=typeof e)throw new Pe(r);var m=l?l.length:0;if(m||(t&=-97,l=u=n),p=p===n?p:gn(ms(p),0),h=h===n?h:ms(h),m-=u?u.length:0,64&t){var g=l,y=u;l=u=n}var I=f?n:ra(e),C=[e,t,i,l,u,g,y,d,p,h];if(I&&function(e,t){var n=e[1],r=t[1],i=n|r,o=i<131,l=r==s&&8==n||r==s&&n==c&&e[7].length<=t[8]||384==r&&t[7].length<=t[8]&&8==n;if(!o&&!l)return e;1&r&&(e[2]=t[2],i|=1&n?0:4);var u=t[3];if(u){var d=e[3];e[3]=d?_i(d,u,t[4]):u,e[4]=d?sn(e[3],a):t[4]}(u=t[5])&&(d=e[5],e[5]=d?wi(d,u,t[6]):u,e[6]=d?sn(e[5],a):t[6]),(u=t[7])&&(e[7]=u),r&s&&(e[8]=null==e[8]?t[8]:yn(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i}(C,I),e=C[0],t=C[1],i=C[2],l=C[3],u=C[4],!(h=C[9]=C[9]===n?f?0:e.length:gn(C[9]-m,0))&&24&t&&(t&=-25),t&&1!=t)A=8==t||16==t?function(e,t,r){var i=Di(e);return function a(){for(var o=arguments.length,s=Ae(o),c=o,l=aa(a);c--;)s[c]=arguments[c];var u=o<3&&s[0]!==l&&s[o-1]!==l?[]:sn(s,l);return(o-=u.length)<r?Wi(e,t,Gi,a.placeholder,n,s,u,n,n,r-o):Tt(this&&this!==dt&&this instanceof a?i:e,this,s)}}(e,t,h):t!=o&&33!=t||u.length?Gi.apply(n,C):function(e,t,n,r){var i=1&t,a=Di(e);return function t(){for(var o=-1,s=arguments.length,c=-1,l=r.length,u=Ae(l+s),d=this&&this!==dt&&this instanceof t?a:e;++c<l;)u[c]=r[c];for(;s--;)u[c++]=arguments[++o];return Tt(d,i?n:this,u)}}(e,t,i,l);else var A=function(e,t,n){var r=1&t,i=Di(e);return function t(){return(this&&this!==dt&&this instanceof t?i:e).apply(r?n:this,arguments)}}(e,t,i);return La((I?zr:Ea)(A,C),e,t)}function Qi(e,t,r,i){return e===n||Uo(e,Ne[r])&&!Me.call(i,r)?t:e}function Ji(e,t,r,i,a,o){return ts(e)&&ts(t)&&(o.set(t,e),Hr(e,t,n,Ji,o),o.delete(t)),e}function zi(e){return as(e)?n:e}function Zi(e,t,r,i,a,o){var s=1&r,c=e.length,l=t.length;if(c!=l&&!(s&&l>c))return!1;var u=o.get(e),d=o.get(t);if(u&&d)return u==t&&d==e;var p=-1,h=!0,f=2&r?new Xn:n;for(o.set(e,t),o.set(t,e);++p<c;){var m=e[p],g=t[p];if(i)var y=s?i(g,m,p,t,e,o):i(m,g,p,e,t,o);if(y!==n){if(y)continue;h=!1;break}if(f){if(!Dt(t,function(e,t){if(!Jt(f,t)&&(m===e||a(m,e,r,i,o)))return f.push(t)})){h=!1;break}}else if(m!==g&&!a(m,g,r,i,o)){h=!1;break}}return o.delete(e),o.delete(t),h}function ea(e){return Ra(va(e,n,Wa),e+"")}function ta(e){return br(e,Os,ua)}function na(e){return br(e,Bs,da)}var ra=Pn?function(e){return Pn.get(e)}:lc;function ia(e){for(var t=e.name+"",n=Rn[t],r=Me.call(Rn,t)?n.length:0;r--;){var i=n[r],a=i.func;if(null==a||a==e)return i.name}return t}function aa(e){return(Me.call(Gn,"placeholder")?Gn:e).placeholder}function oa(){var e=Gn.iteratee||ac;return e=e===ac?Br:e,arguments.length?e(arguments[0],arguments[1]):e}function sa(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function ca(e){for(var t=Os(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,ba(i)]}return t}function la(e,t){var r=function(e,t){return null==e?n:e[t]}(e,t);return Or(r)?r:n}var ua=gt?function(e){return null==e?[]:(e=_e(e),Pt(gt(e),function(t){return Ke.call(e,t)}))}:gc,da=gt?function(e){for(var t=[];e;)Ot(t,ua(e)),e=We(e);return t}:gc,pa=Tr;function ha(e,t,n){for(var r=-1,i=(t=yi(t,e)).length,a=!1;++r<i;){var o=ka(t[r]);if(!(a=null!=e&&n(e,o)))break;e=e[o]}return a||++r!=i?a:!!(i=null==e?0:e.length)&&es(i)&&ga(o,i)&&(Wo(e)||jo(e))}function fa(e){return"function"!=typeof e.constructor||Sa(e)?{}:xn(We(e))}function ma(e){return Wo(e)||jo(e)||!!(qe&&e&&e[qe])}function ga(e,t){var n=typeof e;return!!(t=null==t?u:t)&&("number"==n||"symbol"!=n&&ge.test(e))&&e>-1&&e%1==0&&e<t}function ya(e,t,n){if(!ts(n))return!1;var r=typeof t;return!!("number"==r?Ko(n)&&ga(t,n.length):"string"==r&&t in n)&&Uo(n[t],e)}function Ia(e,t){if(Wo(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!ls(e))||z.test(e)||!J.test(e)||null!=t&&e in _e(t)}function Ca(e){var t=ia(e),n=Gn[t];if("function"!=typeof n||!(t in Vn.prototype))return!1;if(e===n)return!0;var r=ra(n);return!!r&&e===r[0]}(bn&&pa(new bn(new ArrayBuffer(1)))!=N||Tn&&pa(new Tn)!=S||vn&&pa(vn.resolve())!=v||_n&&pa(new _n)!=w||wn&&pa(new wn)!=R)&&(pa=function(e){var t=Tr(e),r=t==T?e.constructor:n,i=r?Ga(r):"";if(i)switch(i){case Ln:return N;case Nn:return S;case On:return v;case Bn:return w;case Mn:return R}return t});var Aa=Oe?zo:yc;function Sa(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ne)}function ba(e){return e==e&&!ts(e)}function Ta(e,t){return function(r){return null!=r&&r[e]===t&&(t!==n||e in _e(r))}}function va(e,t,r){return t=gn(t===n?e.length-1:t,0),function(){for(var n=arguments,i=-1,a=gn(n.length-t,0),o=Ae(a);++i<a;)o[i]=n[t+i];i=-1;for(var s=Ae(t+1);++i<t;)s[i]=n[i];return s[t]=r(o),Tt(e,this,s)}}function _a(e,t){return t.length<2?e:Sr(e,ti(t,0,-1))}function wa(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Ea=Na(zr),Pa=pt||function(e,t){return dt.setTimeout(e,t)},Ra=Na(Zr);function La(e,t,n){var r=t+"";return Ra(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ie,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return _t(h,function(n){var r="_."+n[0];t&n[1]&&!Rt(e,r)&&e.push(r)}),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(oe):[]}(r),n)))}function Na(e){var t=0,r=0;return function(){var i=In(),a=16-(i-r);if(r=i,a>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(n,arguments)}}function Oa(e,t){var r=-1,i=e.length,a=i-1;for(t=t===n?i:t;++r<t;){var o=Xr(r,a),s=e[o];e[o]=e[r],e[r]=s}return e.length=t,e}var Ba,Ma,Da,Fa=(Ba=function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Z,function(e,n,r,i){t.push(r?i.replace(le,"$1"):n||e)}),t},Ma=Do(Ba,function(e){return 500===Da.size&&Da.clear(),e}),Da=Ma.cache,Ma);function ka(e){if("string"==typeof e||ls(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ga(e){if(null!=e){try{return Be.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function xa(e){if(e instanceof Vn)return e.clone();var t=new Un(e.__wrapped__,e.__chain__);return t.__actions__=Ei(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Ha=Yr(function(e,t){return Yo(e)?lr(e,mr(t,1,Yo,!0)):[]}),Ua=Yr(function(e,t){var r=Qa(t);return Yo(r)&&(r=n),Yo(e)?lr(e,mr(t,1,Yo,!0),oa(r,2)):[]}),Va=Yr(function(e,t){var r=Qa(t);return Yo(r)&&(r=n),Yo(e)?lr(e,mr(t,1,Yo,!0),n,r):[]});function $a(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:ms(n);return i<0&&(i=gn(r+i,0)),Gt(e,oa(t,3),i)}function ja(e,t,r){var i=null==e?0:e.length;if(!i)return-1;var a=i-1;return r!==n&&(a=ms(r),a=r<0?gn(i+a,0):yn(a,i-1)),Gt(e,oa(t,3),a,!0)}function Wa(e){return null!=e&&e.length?mr(e,1):[]}function Xa(e){return e&&e.length?e[0]:n}var Ka=Yr(function(e){var t=Nt(e,mi);return t.length&&t[0]===e[0]?Er(t):[]}),Ya=Yr(function(e){var t=Qa(e),r=Nt(e,mi);return t===Qa(r)?t=n:r.pop(),r.length&&r[0]===e[0]?Er(r,oa(t,2)):[]}),qa=Yr(function(e){var t=Qa(e),r=Nt(e,mi);return(t="function"==typeof t?t:n)&&r.pop(),r.length&&r[0]===e[0]?Er(r,n,t):[]});function Qa(e){var t=null==e?0:e.length;return t?e[t-1]:n}var Ja=Yr(za);function za(e,t){return e&&e.length&&t&&t.length?jr(e,t):e}var Za=ea(function(e,t){var n=null==e?0:e.length,r=ir(e,t);return Wr(e,Nt(t,function(e){return ga(e,n)?+e:e}).sort(vi)),r});function eo(e){return null==e?e:Sn.call(e)}var to=Yr(function(e){return ci(mr(e,1,Yo,!0))}),no=Yr(function(e){var t=Qa(e);return Yo(t)&&(t=n),ci(mr(e,1,Yo,!0),oa(t,2))}),ro=Yr(function(e){var t=Qa(e);return t="function"==typeof t?t:n,ci(mr(e,1,Yo,!0),n,t)});function io(e){if(!e||!e.length)return[];var t=0;return e=Pt(e,function(e){if(Yo(e))return t=gn(e.length,t),!0}),Kt(t,function(t){return Nt(e,$t(t))})}function ao(e,t){if(!e||!e.length)return[];var r=io(e);return null==t?r:Nt(r,function(e){return Tt(t,n,e)})}var oo=Yr(function(e,t){return Yo(e)?lr(e,t):[]}),so=Yr(function(e){return hi(Pt(e,Yo))}),co=Yr(function(e){var t=Qa(e);return Yo(t)&&(t=n),hi(Pt(e,Yo),oa(t,2))}),lo=Yr(function(e){var t=Qa(e);return t="function"==typeof t?t:n,hi(Pt(e,Yo),n,t)}),uo=Yr(io),po=Yr(function(e){var t=e.length,r=t>1?e[t-1]:n;return r="function"==typeof r?(e.pop(),r):n,ao(e,r)});function ho(e){var t=Gn(e);return t.__chain__=!0,t}function fo(e,t){return t(e)}var mo=ea(function(e){var t=e.length,r=t?e[0]:0,i=this.__wrapped__,a=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&i instanceof Vn&&ga(r)?((i=i.slice(r,+r+(t?1:0))).__actions__.push({func:fo,args:[a],thisArg:n}),new Un(i,this.__chain__).thru(function(e){return t&&!e.length&&e.push(n),e})):this.thru(a)}),go=Ri(function(e,t,n){Me.call(e,n)?++e[n]:rr(e,n,1)}),yo=Fi($a),Io=Fi(ja);function Co(e,t){return(Wo(e)?_t:ur)(e,oa(t,3))}function Ao(e,t){return(Wo(e)?wt:dr)(e,oa(t,3))}var So=Ri(function(e,t,n){Me.call(e,n)?e[n].push(t):rr(e,n,[t])}),bo=Yr(function(e,t,n){var r=-1,i="function"==typeof t,a=Ko(e)?Ae(e.length):[];return ur(e,function(e){a[++r]=i?Tt(t,e,n):Pr(e,t,n)}),a}),To=Ri(function(e,t,n){rr(e,n,t)});function vo(e,t){return(Wo(e)?Nt:kr)(e,oa(t,3))}var _o=Ri(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),wo=Yr(function(e,t){if(null==e)return[];var n=t.length;return n>1&&ya(e,t[0],t[1])?t=[]:n>2&&ya(t[0],t[1],t[2])&&(t=[t[0]]),Vr(e,mr(t,1),[])}),Eo=ut||function(){return dt.Date.now()};function Po(e,t,r){return t=r?n:t,t=e&&null==t?e.length:t,qi(e,s,n,n,n,n,t)}function Ro(e,t){var i;if("function"!=typeof t)throw new Pe(r);return e=ms(e),function(){return--e>0&&(i=t.apply(this,arguments)),e<=1&&(t=n),i}}var Lo=Yr(function(e,t,n){var r=1;if(n.length){var i=sn(n,aa(Lo));r|=o}return qi(e,r,t,n,i)}),No=Yr(function(e,t,n){var r=3;if(n.length){var i=sn(n,aa(No));r|=o}return qi(t,r,e,n,i)});function Oo(e,t,i){var a,o,s,c,l,u,d=0,p=!1,h=!1,f=!0;if("function"!=typeof e)throw new Pe(r);function m(t){var r=a,i=o;return a=o=n,d=t,c=e.apply(i,r)}function g(e){var r=e-u;return u===n||r>=t||r<0||h&&e-d>=s}function y(){var e=Eo();if(g(e))return I(e);l=Pa(y,function(e){var n=t-(e-u);return h?yn(n,s-(e-d)):n}(e))}function I(e){return l=n,f&&a?m(e):(a=o=n,c)}function C(){var e=Eo(),r=g(e);if(a=arguments,o=this,u=e,r){if(l===n)return function(e){return d=e,l=Pa(y,t),p?m(e):c}(u);if(h)return Ai(l),l=Pa(y,t),m(u)}return l===n&&(l=Pa(y,t)),c}return t=ys(t)||0,ts(i)&&(p=!!i.leading,s=(h="maxWait"in i)?gn(ys(i.maxWait)||0,t):s,f="trailing"in i?!!i.trailing:f),C.cancel=function(){l!==n&&Ai(l),d=0,a=u=o=l=n},C.flush=function(){return l===n?c:I(Eo())},C}var Bo=Yr(function(e,t){return cr(e,1,t)}),Mo=Yr(function(e,t,n){return cr(e,ys(t)||0,n)});function Do(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Pe(r);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(Do.Cache||Wn),n}function Fo(e){if("function"!=typeof e)throw new Pe(r);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Do.Cache=Wn;var ko=Ii(function(e,t){var n=(t=1==t.length&&Wo(t[0])?Nt(t[0],qt(oa())):Nt(mr(t,1),qt(oa()))).length;return Yr(function(r){for(var i=-1,a=yn(r.length,n);++i<a;)r[i]=t[i].call(this,r[i]);return Tt(e,this,r)})}),Go=Yr(function(e,t){var r=sn(t,aa(Go));return qi(e,o,n,t,r)}),xo=Yr(function(e,t){var r=sn(t,aa(xo));return qi(e,64,n,t,r)}),Ho=ea(function(e,t){return qi(e,c,n,n,n,t)});function Uo(e,t){return e===t||e!=e&&t!=t}var Vo=ji(vr),$o=ji(function(e,t){return e>=t}),jo=Rr(function(){return arguments}())?Rr:function(e){return ns(e)&&Me.call(e,"callee")&&!Ke.call(e,"callee")},Wo=Ae.isArray,Xo=yt?qt(yt):function(e){return ns(e)&&Tr(e)==L};function Ko(e){return null!=e&&es(e.length)&&!zo(e)}function Yo(e){return ns(e)&&Ko(e)}var qo=Ft||yc,Qo=It?qt(It):function(e){return ns(e)&&Tr(e)==y};function Jo(e){if(!ns(e))return!1;var t=Tr(e);return t==I||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!as(e)}function zo(e){if(!ts(e))return!1;var t=Tr(e);return t==C||t==A||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Zo(e){return"number"==typeof e&&e==ms(e)}function es(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=u}function ts(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ns(e){return null!=e&&"object"==typeof e}var rs=Ct?qt(Ct):function(e){return ns(e)&&pa(e)==S};function is(e){return"number"==typeof e||ns(e)&&Tr(e)==b}function as(e){if(!ns(e)||Tr(e)!=T)return!1;var t=We(e);if(null===t)return!0;var n=Me.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Be.call(n)==Ge}var os=At?qt(At):function(e){return ns(e)&&Tr(e)==_},ss=St?qt(St):function(e){return ns(e)&&pa(e)==w};function cs(e){return"string"==typeof e||!Wo(e)&&ns(e)&&Tr(e)==E}function ls(e){return"symbol"==typeof e||ns(e)&&Tr(e)==P}var us=bt?qt(bt):function(e){return ns(e)&&es(e.length)&&!!it[Tr(e)]},ds=ji(Fr),ps=ji(function(e,t){return e<=t});function hs(e){if(!e)return[];if(Ko(e))return cs(e)?un(e):Ei(e);if(ze&&e[ze])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[ze]());var t=pa(e);return(t==S?an:t==w?cn:Us)(e)}function fs(e){return e?(e=ys(e))===l||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ms(e){var t=fs(e),n=t%1;return t==t?n?t-n:t:0}function gs(e){return e?ar(ms(e),0,p):0}function ys(e){if("number"==typeof e)return e;if(ls(e))return d;if(ts(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ts(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Yt(e);var n=he.test(e);return n||me.test(e)?ct(e.slice(2),n?2:8):pe.test(e)?d:+e}function Is(e){return Pi(e,Bs(e))}function Cs(e){return null==e?"":si(e)}var As=Li(function(e,t){if(Sa(t)||Ko(t))Pi(t,Os(t),e);else for(var n in t)Me.call(t,n)&&Zn(e,n,t[n])}),Ss=Li(function(e,t){Pi(t,Bs(t),e)}),bs=Li(function(e,t,n,r){Pi(t,Bs(t),e,r)}),Ts=Li(function(e,t,n,r){Pi(t,Os(t),e,r)}),vs=ea(ir),_s=Yr(function(e,t){e=_e(e);var r=-1,i=t.length,a=i>2?t[2]:n;for(a&&ya(t[0],t[1],a)&&(i=1);++r<i;)for(var o=t[r],s=Bs(o),c=-1,l=s.length;++c<l;){var u=s[c],d=e[u];(d===n||Uo(d,Ne[u])&&!Me.call(e,u))&&(e[u]=o[u])}return e}),ws=Yr(function(e){return e.push(n,Ji),Tt(Ds,n,e)});function Es(e,t,r){var i=null==e?n:Sr(e,t);return i===n?r:i}function Ps(e,t){return null!=e&&ha(e,t,wr)}var Rs=xi(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=ke.call(t)),e[t]=n},tc(ic)),Ls=xi(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=ke.call(t)),Me.call(e,t)?e[t].push(n):e[t]=[n]},oa),Ns=Yr(Pr);function Os(e){return Ko(e)?Yn(e):Mr(e)}function Bs(e){return Ko(e)?Yn(e,!0):Dr(e)}var Ms=Li(function(e,t,n){Hr(e,t,n)}),Ds=Li(function(e,t,n,r){Hr(e,t,n,r)}),Fs=ea(function(e,t){var n={};if(null==e)return n;var r=!1;t=Nt(t,function(t){return t=yi(t,e),r||(r=t.length>1),t}),Pi(e,na(e),n),r&&(n=or(n,7,zi));for(var i=t.length;i--;)li(n,t[i]);return n}),ks=ea(function(e,t){return null==e?{}:function(e,t){return $r(e,t,function(t,n){return Ps(e,n)})}(e,t)});function Gs(e,t){if(null==e)return{};var n=Nt(na(e),function(e){return[e]});return t=oa(t),$r(e,n,function(e,n){return t(e,n[0])})}var xs=Yi(Os),Hs=Yi(Bs);function Us(e){return null==e?[]:Qt(e,Os(e))}var Vs=Mi(function(e,t,n){return t=t.toLowerCase(),e+(n?$s(t):t)});function $s(e){return Js(Cs(e).toLowerCase())}function js(e){return(e=Cs(e))&&e.replace(ye,en).replace(Je,"")}var Ws=Mi(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Xs=Mi(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Ks=Bi("toLowerCase"),Ys=Mi(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),qs=Mi(function(e,t,n){return e+(n?" ":"")+Js(t)}),Qs=Mi(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Js=Bi("toUpperCase");function zs(e,t,r){return e=Cs(e),(t=r?n:t)===n?function(e){return tt.test(e)}(e)?function(e){return e.match(Ze)||[]}(e):function(e){return e.match(se)||[]}(e):e.match(t)||[]}var Zs=Yr(function(e,t){try{return Tt(e,n,t)}catch(r){return Jo(r)?r:new be(r)}}),ec=ea(function(e,t){return _t(t,function(t){t=ka(t),rr(e,t,Lo(e[t],e))}),e});function tc(e){return function(){return e}}var nc=ki(),rc=ki(!0);function ic(e){return e}function ac(e){return Br("function"==typeof e?e:or(e,1))}var oc=Yr(function(e,t){return function(n){return Pr(n,e,t)}}),sc=Yr(function(e,t){return function(n){return Pr(e,n,t)}});function cc(e,t,n){var r=Os(t),i=Ar(t,r);null!=n||ts(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=Ar(t,Os(t)));var a=!(ts(n)&&"chain"in n&&!n.chain),o=zo(e);return _t(i,function(n){var r=t[n];e[n]=r,o&&(e.prototype[n]=function(){var t=this.__chain__;if(a||t){var n=e(this.__wrapped__);return(n.__actions__=Ei(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Ot([this.value()],arguments))})}),e}function lc(){}var uc=Ui(Nt),dc=Ui(Et),pc=Ui(Dt);function hc(e){return Ia(e)?$t(ka(e)):function(e){return function(t){return Sr(t,e)}}(e)}var fc=$i(),mc=$i(!0);function gc(){return[]}function yc(){return!1}var Ic,Cc=Hi(function(e,t){return e+t},0),Ac=Xi("ceil"),Sc=Hi(function(e,t){return e/t},1),bc=Xi("floor"),Tc=Hi(function(e,t){return e*t},1),vc=Xi("round"),_c=Hi(function(e,t){return e-t},0);return Gn.after=function(e,t){if("function"!=typeof t)throw new Pe(r);return e=ms(e),function(){if(--e<1)return t.apply(this,arguments)}},Gn.ary=Po,Gn.assign=As,Gn.assignIn=Ss,Gn.assignInWith=bs,Gn.assignWith=Ts,Gn.at=vs,Gn.before=Ro,Gn.bind=Lo,Gn.bindAll=ec,Gn.bindKey=No,Gn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wo(e)?e:[e]},Gn.chain=ho,Gn.chunk=function(e,t,r){t=(r?ya(e,t,r):t===n)?1:gn(ms(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var a=0,o=0,s=Ae(ht(i/t));a<i;)s[o++]=ti(e,a,a+=t);return s},Gn.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,i=[];++t<n;){var a=e[t];a&&(i[r++]=a)}return i},Gn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=Ae(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return Ot(Wo(n)?Ei(n):[n],mr(t,1))},Gn.cond=function(e){var t=null==e?0:e.length,n=oa();return e=t?Nt(e,function(e){if("function"!=typeof e[1])throw new Pe(r);return[n(e[0]),e[1]]}):[],Yr(function(n){for(var r=-1;++r<t;){var i=e[r];if(Tt(i[0],this,n))return Tt(i[1],this,n)}})},Gn.conforms=function(e){return function(e){var t=Os(e);return function(n){return sr(n,e,t)}}(or(e,1))},Gn.constant=tc,Gn.countBy=go,Gn.create=function(e,t){var n=xn(e);return null==t?n:nr(n,t)},Gn.curry=function e(t,r,i){var a=qi(t,8,n,n,n,n,n,r=i?n:r);return a.placeholder=e.placeholder,a},Gn.curryRight=function e(t,r,i){var a=qi(t,16,n,n,n,n,n,r=i?n:r);return a.placeholder=e.placeholder,a},Gn.debounce=Oo,Gn.defaults=_s,Gn.defaultsDeep=ws,Gn.defer=Bo,Gn.delay=Mo,Gn.difference=Ha,Gn.differenceBy=Ua,Gn.differenceWith=Va,Gn.drop=function(e,t,r){var i=null==e?0:e.length;return i?ti(e,(t=r||t===n?1:ms(t))<0?0:t,i):[]},Gn.dropRight=function(e,t,r){var i=null==e?0:e.length;return i?ti(e,0,(t=i-(t=r||t===n?1:ms(t)))<0?0:t):[]},Gn.dropRightWhile=function(e,t){return e&&e.length?di(e,oa(t,3),!0,!0):[]},Gn.dropWhile=function(e,t){return e&&e.length?di(e,oa(t,3),!0):[]},Gn.fill=function(e,t,r,i){var a=null==e?0:e.length;return a?(r&&"number"!=typeof r&&ya(e,t,r)&&(r=0,i=a),function(e,t,r,i){var a=e.length;for((r=ms(r))<0&&(r=-r>a?0:a+r),(i=i===n||i>a?a:ms(i))<0&&(i+=a),i=r>i?0:gs(i);r<i;)e[r++]=t;return e}(e,t,r,i)):[]},Gn.filter=function(e,t){return(Wo(e)?Pt:fr)(e,oa(t,3))},Gn.flatMap=function(e,t){return mr(vo(e,t),1)},Gn.flatMapDeep=function(e,t){return mr(vo(e,t),l)},Gn.flatMapDepth=function(e,t,r){return r=r===n?1:ms(r),mr(vo(e,t),r)},Gn.flatten=Wa,Gn.flattenDeep=function(e){return null!=e&&e.length?mr(e,l):[]},Gn.flattenDepth=function(e,t){return null!=e&&e.length?mr(e,t=t===n?1:ms(t)):[]},Gn.flip=function(e){return qi(e,512)},Gn.flow=nc,Gn.flowRight=rc,Gn.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var i=e[t];rr(r,i[0],i[1])}return r},Gn.functions=function(e){return null==e?[]:Ar(e,Os(e))},Gn.functionsIn=function(e){return null==e?[]:Ar(e,Bs(e))},Gn.groupBy=So,Gn.initial=function(e){return null!=e&&e.length?ti(e,0,-1):[]},Gn.intersection=Ka,Gn.intersectionBy=Ya,Gn.intersectionWith=qa,Gn.invert=Rs,Gn.invertBy=Ls,Gn.invokeMap=bo,Gn.iteratee=ac,Gn.keyBy=To,Gn.keys=Os,Gn.keysIn=Bs,Gn.map=vo,Gn.mapKeys=function(e,t){var n={};return t=oa(t,3),Ir(e,function(e,r,i){rr(n,t(e,r,i),e)}),n},Gn.mapValues=function(e,t){var n={};return t=oa(t,3),Ir(e,function(e,r,i){rr(n,r,t(e,r,i))}),n},Gn.matches=function(e){return Gr(or(e,1))},Gn.matchesProperty=function(e,t){return xr(e,or(t,1))},Gn.memoize=Do,Gn.merge=Ms,Gn.mergeWith=Ds,Gn.method=oc,Gn.methodOf=sc,Gn.mixin=cc,Gn.negate=Fo,Gn.nthArg=function(e){return e=ms(e),Yr(function(t){return Ur(t,e)})},Gn.omit=Fs,Gn.omitBy=function(e,t){return Gs(e,Fo(oa(t)))},Gn.once=function(e){return Ro(2,e)},Gn.orderBy=function(e,t,r,i){return null==e?[]:(Wo(t)||(t=null==t?[]:[t]),Wo(r=i?n:r)||(r=null==r?[]:[r]),Vr(e,t,r))},Gn.over=uc,Gn.overArgs=ko,Gn.overEvery=dc,Gn.overSome=pc,Gn.partial=Go,Gn.partialRight=xo,Gn.partition=_o,Gn.pick=ks,Gn.pickBy=Gs,Gn.property=hc,Gn.propertyOf=function(e){return function(t){return null==e?n:Sr(e,t)}},Gn.pull=Ja,Gn.pullAll=za,Gn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?jr(e,t,oa(n,2)):e},Gn.pullAllWith=function(e,t,r){return e&&e.length&&t&&t.length?jr(e,t,n,r):e},Gn.pullAt=Za,Gn.range=fc,Gn.rangeRight=mc,Gn.rearg=Ho,Gn.reject=function(e,t){return(Wo(e)?Pt:fr)(e,Fo(oa(t,3)))},Gn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,i=[],a=e.length;for(t=oa(t,3);++r<a;){var o=e[r];t(o,r,e)&&(n.push(o),i.push(r))}return Wr(e,i),n},Gn.rest=function(e,t){if("function"!=typeof e)throw new Pe(r);return Yr(e,t=t===n?t:ms(t))},Gn.reverse=eo,Gn.sampleSize=function(e,t,r){return t=(r?ya(e,t,r):t===n)?1:ms(t),(Wo(e)?Qn:Qr)(e,t)},Gn.set=function(e,t,n){return null==e?e:Jr(e,t,n)},Gn.setWith=function(e,t,r,i){return i="function"==typeof i?i:n,null==e?e:Jr(e,t,r,i)},Gn.shuffle=function(e){return(Wo(e)?Jn:ei)(e)},Gn.slice=function(e,t,r){var i=null==e?0:e.length;return i?(r&&"number"!=typeof r&&ya(e,t,r)?(t=0,r=i):(t=null==t?0:ms(t),r=r===n?i:ms(r)),ti(e,t,r)):[]},Gn.sortBy=wo,Gn.sortedUniq=function(e){return e&&e.length?ai(e):[]},Gn.sortedUniqBy=function(e,t){return e&&e.length?ai(e,oa(t,2)):[]},Gn.split=function(e,t,r){return r&&"number"!=typeof r&&ya(e,t,r)&&(t=r=n),(r=r===n?p:r>>>0)?(e=Cs(e))&&("string"==typeof t||null!=t&&!os(t))&&!(t=si(t))&&rn(e)?Ci(un(e),0,r):e.split(t,r):[]},Gn.spread=function(e,t){if("function"!=typeof e)throw new Pe(r);return t=null==t?0:gn(ms(t),0),Yr(function(n){var r=n[t],i=Ci(n,0,t);return r&&Ot(i,r),Tt(e,this,i)})},Gn.tail=function(e){var t=null==e?0:e.length;return t?ti(e,1,t):[]},Gn.take=function(e,t,r){return e&&e.length?ti(e,0,(t=r||t===n?1:ms(t))<0?0:t):[]},Gn.takeRight=function(e,t,r){var i=null==e?0:e.length;return i?ti(e,(t=i-(t=r||t===n?1:ms(t)))<0?0:t,i):[]},Gn.takeRightWhile=function(e,t){return e&&e.length?di(e,oa(t,3),!1,!0):[]},Gn.takeWhile=function(e,t){return e&&e.length?di(e,oa(t,3)):[]},Gn.tap=function(e,t){return t(e),e},Gn.throttle=function(e,t,n){var i=!0,a=!0;if("function"!=typeof e)throw new Pe(r);return ts(n)&&(i="leading"in n?!!n.leading:i,a="trailing"in n?!!n.trailing:a),Oo(e,t,{leading:i,maxWait:t,trailing:a})},Gn.thru=fo,Gn.toArray=hs,Gn.toPairs=xs,Gn.toPairsIn=Hs,Gn.toPath=function(e){return Wo(e)?Nt(e,ka):ls(e)?[e]:Ei(Fa(Cs(e)))},Gn.toPlainObject=Is,Gn.transform=function(e,t,n){var r=Wo(e),i=r||qo(e)||us(e);if(t=oa(t,4),null==n){var a=e&&e.constructor;n=i?r?new a:[]:ts(e)&&zo(a)?xn(We(e)):{}}return(i?_t:Ir)(e,function(e,r,i){return t(n,e,r,i)}),n},Gn.unary=function(e){return Po(e,1)},Gn.union=to,Gn.unionBy=no,Gn.unionWith=ro,Gn.uniq=function(e){return e&&e.length?ci(e):[]},Gn.uniqBy=function(e,t){return e&&e.length?ci(e,oa(t,2)):[]},Gn.uniqWith=function(e,t){return t="function"==typeof t?t:n,e&&e.length?ci(e,n,t):[]},Gn.unset=function(e,t){return null==e||li(e,t)},Gn.unzip=io,Gn.unzipWith=ao,Gn.update=function(e,t,n){return null==e?e:ui(e,t,gi(n))},Gn.updateWith=function(e,t,r,i){return i="function"==typeof i?i:n,null==e?e:ui(e,t,gi(r),i)},Gn.values=Us,Gn.valuesIn=function(e){return null==e?[]:Qt(e,Bs(e))},Gn.without=oo,Gn.words=zs,Gn.wrap=function(e,t){return Go(gi(t),e)},Gn.xor=so,Gn.xorBy=co,Gn.xorWith=lo,Gn.zip=uo,Gn.zipObject=function(e,t){return fi(e||[],t||[],Zn)},Gn.zipObjectDeep=function(e,t){return fi(e||[],t||[],Jr)},Gn.zipWith=po,Gn.entries=xs,Gn.entriesIn=Hs,Gn.extend=Ss,Gn.extendWith=bs,cc(Gn,Gn),Gn.add=Cc,Gn.attempt=Zs,Gn.camelCase=Vs,Gn.capitalize=$s,Gn.ceil=Ac,Gn.clamp=function(e,t,r){return r===n&&(r=t,t=n),r!==n&&(r=(r=ys(r))==r?r:0),t!==n&&(t=(t=ys(t))==t?t:0),ar(ys(e),t,r)},Gn.clone=function(e){return or(e,4)},Gn.cloneDeep=function(e){return or(e,5)},Gn.cloneDeepWith=function(e,t){return or(e,5,t="function"==typeof t?t:n)},Gn.cloneWith=function(e,t){return or(e,4,t="function"==typeof t?t:n)},Gn.conformsTo=function(e,t){return null==t||sr(e,t,Os(t))},Gn.deburr=js,Gn.defaultTo=function(e,t){return null==e||e!=e?t:e},Gn.divide=Sc,Gn.endsWith=function(e,t,r){e=Cs(e),t=si(t);var i=e.length,a=r=r===n?i:ar(ms(r),0,i);return(r-=t.length)>=0&&e.slice(r,a)==t},Gn.eq=Uo,Gn.escape=function(e){return(e=Cs(e))&&K.test(e)?e.replace(W,tn):e},Gn.escapeRegExp=function(e){return(e=Cs(e))&&te.test(e)?e.replace(ee,"\\$&"):e},Gn.every=function(e,t,r){var i=Wo(e)?Et:pr;return r&&ya(e,t,r)&&(t=n),i(e,oa(t,3))},Gn.find=yo,Gn.findIndex=$a,Gn.findKey=function(e,t){return kt(e,oa(t,3),Ir)},Gn.findLast=Io,Gn.findLastIndex=ja,Gn.findLastKey=function(e,t){return kt(e,oa(t,3),Cr)},Gn.floor=bc,Gn.forEach=Co,Gn.forEachRight=Ao,Gn.forIn=function(e,t){return null==e?e:gr(e,oa(t,3),Bs)},Gn.forInRight=function(e,t){return null==e?e:yr(e,oa(t,3),Bs)},Gn.forOwn=function(e,t){return e&&Ir(e,oa(t,3))},Gn.forOwnRight=function(e,t){return e&&Cr(e,oa(t,3))},Gn.get=Es,Gn.gt=Vo,Gn.gte=$o,Gn.has=function(e,t){return null!=e&&ha(e,t,_r)},Gn.hasIn=Ps,Gn.head=Xa,Gn.identity=ic,Gn.includes=function(e,t,n,r){e=Ko(e)?e:Us(e),n=n&&!r?ms(n):0;var i=e.length;return n<0&&(n=gn(i+n,0)),cs(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&xt(e,t,n)>-1},Gn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:ms(n);return i<0&&(i=gn(r+i,0)),xt(e,t,i)},Gn.inRange=function(e,t,r){return t=fs(t),r===n?(r=t,t=0):r=fs(r),function(e,t,n){return e>=yn(t,n)&&e<gn(t,n)}(e=ys(e),t,r)},Gn.invoke=Ns,Gn.isArguments=jo,Gn.isArray=Wo,Gn.isArrayBuffer=Xo,Gn.isArrayLike=Ko,Gn.isArrayLikeObject=Yo,Gn.isBoolean=function(e){return!0===e||!1===e||ns(e)&&Tr(e)==g},Gn.isBuffer=qo,Gn.isDate=Qo,Gn.isElement=function(e){return ns(e)&&1===e.nodeType&&!as(e)},Gn.isEmpty=function(e){if(null==e)return!0;if(Ko(e)&&(Wo(e)||"string"==typeof e||"function"==typeof e.splice||qo(e)||us(e)||jo(e)))return!e.length;var t=pa(e);if(t==S||t==w)return!e.size;if(Sa(e))return!Mr(e).length;for(var n in e)if(Me.call(e,n))return!1;return!0},Gn.isEqual=function(e,t){return Lr(e,t)},Gn.isEqualWith=function(e,t,r){var i=(r="function"==typeof r?r:n)?r(e,t):n;return i===n?Lr(e,t,n,r):!!i},Gn.isError=Jo,Gn.isFinite=function(e){return"number"==typeof e&&jt(e)},Gn.isFunction=zo,Gn.isInteger=Zo,Gn.isLength=es,Gn.isMap=rs,Gn.isMatch=function(e,t){return e===t||Nr(e,t,ca(t))},Gn.isMatchWith=function(e,t,r){return r="function"==typeof r?r:n,Nr(e,t,ca(t),r)},Gn.isNaN=function(e){return is(e)&&e!=+e},Gn.isNative=function(e){if(Aa(e))throw new be("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Or(e)},Gn.isNil=function(e){return null==e},Gn.isNull=function(e){return null===e},Gn.isNumber=is,Gn.isObject=ts,Gn.isObjectLike=ns,Gn.isPlainObject=as,Gn.isRegExp=os,Gn.isSafeInteger=function(e){return Zo(e)&&e>=-9007199254740991&&e<=u},Gn.isSet=ss,Gn.isString=cs,Gn.isSymbol=ls,Gn.isTypedArray=us,Gn.isUndefined=function(e){return e===n},Gn.isWeakMap=function(e){return ns(e)&&pa(e)==R},Gn.isWeakSet=function(e){return ns(e)&&"[object WeakSet]"==Tr(e)},Gn.join=function(e,t){return null==e?"":fn.call(e,t)},Gn.kebabCase=Ws,Gn.last=Qa,Gn.lastIndexOf=function(e,t,r){var i=null==e?0:e.length;if(!i)return-1;var a=i;return r!==n&&(a=(a=ms(r))<0?gn(i+a,0):yn(a,i-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,a):Gt(e,Ut,a,!0)},Gn.lowerCase=Xs,Gn.lowerFirst=Ks,Gn.lt=ds,Gn.lte=ps,Gn.max=function(e){return e&&e.length?hr(e,ic,vr):n},Gn.maxBy=function(e,t){return e&&e.length?hr(e,oa(t,2),vr):n},Gn.mean=function(e){return Vt(e,ic)},Gn.meanBy=function(e,t){return Vt(e,oa(t,2))},Gn.min=function(e){return e&&e.length?hr(e,ic,Fr):n},Gn.minBy=function(e,t){return e&&e.length?hr(e,oa(t,2),Fr):n},Gn.stubArray=gc,Gn.stubFalse=yc,Gn.stubObject=function(){return{}},Gn.stubString=function(){return""},Gn.stubTrue=function(){return!0},Gn.multiply=Tc,Gn.nth=function(e,t){return e&&e.length?Ur(e,ms(t)):n},Gn.noConflict=function(){return dt._===this&&(dt._=xe),this},Gn.noop=lc,Gn.now=Eo,Gn.pad=function(e,t,n){e=Cs(e);var r=(t=ms(t))?ln(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Vi(mt(i),n)+e+Vi(ht(i),n)},Gn.padEnd=function(e,t,n){e=Cs(e);var r=(t=ms(t))?ln(e):0;return t&&r<t?e+Vi(t-r,n):e},Gn.padStart=function(e,t,n){e=Cs(e);var r=(t=ms(t))?ln(e):0;return t&&r<t?Vi(t-r,n)+e:e},Gn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),Cn(Cs(e).replace(ne,""),t||0)},Gn.random=function(e,t,r){if(r&&"boolean"!=typeof r&&ya(e,t,r)&&(t=r=n),r===n&&("boolean"==typeof t?(r=t,t=n):"boolean"==typeof e&&(r=e,e=n)),e===n&&t===n?(e=0,t=1):(e=fs(e),t===n?(t=e,e=0):t=fs(t)),e>t){var i=e;e=t,t=i}if(r||e%1||t%1){var a=An();return yn(e+a*(t-e+st("1e-"+((a+"").length-1))),t)}return Xr(e,t)},Gn.reduce=function(e,t,n){var r=Wo(e)?Bt:Wt,i=arguments.length<3;return r(e,oa(t,4),n,i,ur)},Gn.reduceRight=function(e,t,n){var r=Wo(e)?Mt:Wt,i=arguments.length<3;return r(e,oa(t,4),n,i,dr)},Gn.repeat=function(e,t,r){return t=(r?ya(e,t,r):t===n)?1:ms(t),Kr(Cs(e),t)},Gn.replace=function(){var e=arguments,t=Cs(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Gn.result=function(e,t,r){var i=-1,a=(t=yi(t,e)).length;for(a||(a=1,e=n);++i<a;){var o=null==e?n:e[ka(t[i])];o===n&&(i=a,o=r),e=zo(o)?o.call(e):o}return e},Gn.round=vc,Gn.runInContext=e,Gn.sample=function(e){return(Wo(e)?qn:qr)(e)},Gn.size=function(e){if(null==e)return 0;if(Ko(e))return cs(e)?ln(e):e.length;var t=pa(e);return t==S||t==w?e.size:Mr(e).length},Gn.snakeCase=Ys,Gn.some=function(e,t,r){var i=Wo(e)?Dt:ni;return r&&ya(e,t,r)&&(t=n),i(e,oa(t,3))},Gn.sortedIndex=function(e,t){return ri(e,t)},Gn.sortedIndexBy=function(e,t,n){return ii(e,t,oa(n,2))},Gn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=ri(e,t);if(r<n&&Uo(e[r],t))return r}return-1},Gn.sortedLastIndex=function(e,t){return ri(e,t,!0)},Gn.sortedLastIndexBy=function(e,t,n){return ii(e,t,oa(n,2),!0)},Gn.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=ri(e,t,!0)-1;if(Uo(e[n],t))return n}return-1},Gn.startCase=qs,Gn.startsWith=function(e,t,n){return e=Cs(e),n=null==n?0:ar(ms(n),0,e.length),t=si(t),e.slice(n,n+t.length)==t},Gn.subtract=_c,Gn.sum=function(e){return e&&e.length?Xt(e,ic):0},Gn.sumBy=function(e,t){return e&&e.length?Xt(e,oa(t,2)):0},Gn.template=function(e,t,r){var i=Gn.templateSettings;r&&ya(e,t,r)&&(t=n),e=Cs(e),t=Ts({},t,i,Qi);var a=Ts({},t.imports,i.imports,Qi),o=Os(a),s=Qt(a,o);_t(o,function(e){if(ce.test(e))throw new be("Invalid `imports` option passed into `_.template`")});var c,l,u=0,d=t.interpolate||Ie,p="__p += '",h=we((t.escape||Ie).source+"|"+d.source+"|"+(d===Q?ue:Ie).source+"|"+(t.evaluate||Ie).source+"|$","g"),f="//# sourceURL="+(Me.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++rt+"]")+"\n";e.replace(h,function(t,n,r,i,a,o){return r||(r=i),p+=e.slice(u,o).replace(Ce,nn),n&&(c=!0,p+="' +\n__e("+n+") +\n'"),a&&(l=!0,p+="';\n"+a+";\n__p += '"),r&&(p+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),u=o+t.length,t}),p+="';\n";var m=Me.call(t,"variable")&&t.variable;if(m){if(ce.test(m))throw new be("Invalid `variable` option passed into `_.template`")}else p="with (obj) {\n"+p+"\n}\n";p=(l?p.replace(U,""):p).replace(V,"$1").replace($,"$1;"),p="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(c?", __e = _.escape":"")+(l?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var g=Zs(function(){return Te(o,f+"return "+p).apply(n,s)});if(g.source=p,Jo(g))throw g;return g},Gn.times=function(e,t){if((e=ms(e))<1||e>u)return[];var n=p,r=yn(e,p);t=oa(t),e-=p;for(var i=Kt(r,t);++n<e;)t(n);return i},Gn.toFinite=fs,Gn.toInteger=ms,Gn.toLength=gs,Gn.toLower=function(e){return Cs(e).toLowerCase()},Gn.toNumber=ys,Gn.toSafeInteger=function(e){return e?ar(ms(e),-9007199254740991,u):0===e?e:0},Gn.toString=Cs,Gn.toUpper=function(e){return Cs(e).toUpperCase()},Gn.trim=function(e,t,r){if((e=Cs(e))&&(r||t===n))return Yt(e);if(!e||!(t=si(t)))return e;var i=un(e),a=un(t);return Ci(i,zt(i,a),Zt(i,a)+1).join("")},Gn.trimEnd=function(e,t,r){if((e=Cs(e))&&(r||t===n))return e.slice(0,dn(e)+1);if(!e||!(t=si(t)))return e;var i=un(e);return Ci(i,0,Zt(i,un(t))+1).join("")},Gn.trimStart=function(e,t,r){if((e=Cs(e))&&(r||t===n))return e.replace(ne,"");if(!e||!(t=si(t)))return e;var i=un(e);return Ci(i,zt(i,un(t))).join("")},Gn.truncate=function(e,t){var r=30,i="...";if(ts(t)){var a="separator"in t?t.separator:a;r="length"in t?ms(t.length):r,i="omission"in t?si(t.omission):i}var o=(e=Cs(e)).length;if(rn(e)){var s=un(e);o=s.length}if(r>=o)return e;var c=r-ln(i);if(c<1)return i;var l=s?Ci(s,0,c).join(""):e.slice(0,c);if(a===n)return l+i;if(s&&(c+=l.length-c),os(a)){if(e.slice(c).search(a)){var u,d=l;for(a.global||(a=we(a.source,Cs(de.exec(a))+"g")),a.lastIndex=0;u=a.exec(d);)var p=u.index;l=l.slice(0,p===n?c:p)}}else if(e.indexOf(si(a),c)!=c){var h=l.lastIndexOf(a);h>-1&&(l=l.slice(0,h))}return l+i},Gn.unescape=function(e){return(e=Cs(e))&&X.test(e)?e.replace(j,pn):e},Gn.uniqueId=function(e){var t=++De;return Cs(e)+t},Gn.upperCase=Qs,Gn.upperFirst=Js,Gn.each=Co,Gn.eachRight=Ao,Gn.first=Xa,cc(Gn,(Ic={},Ir(Gn,function(e,t){Me.call(Gn.prototype,t)||(Ic[t]=e)}),Ic),{chain:!1}),Gn.VERSION="4.18.1",_t(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){Gn[e].placeholder=Gn}),_t(["drop","take"],function(e,t){Vn.prototype[e]=function(r){r=r===n?1:gn(ms(r),0);var i=this.__filtered__&&!t?new Vn(this):this.clone();return i.__filtered__?i.__takeCount__=yn(r,i.__takeCount__):i.__views__.push({size:yn(r,p),type:e+(i.__dir__<0?"Right":"")}),i},Vn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),_t(["filter","map","takeWhile"],function(e,t){var n=t+1,r=1==n||3==n;Vn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oa(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}}),_t(["head","last"],function(e,t){var n="take"+(t?"Right":"");Vn.prototype[e]=function(){return this[n](1).value()[0]}}),_t(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");Vn.prototype[e]=function(){return this.__filtered__?new Vn(this):this[n](1)}}),Vn.prototype.compact=function(){return this.filter(ic)},Vn.prototype.find=function(e){return this.filter(e).head()},Vn.prototype.findLast=function(e){return this.reverse().find(e)},Vn.prototype.invokeMap=Yr(function(e,t){return"function"==typeof e?new Vn(this):this.map(function(n){return Pr(n,e,t)})}),Vn.prototype.reject=function(e){return this.filter(Fo(oa(e)))},Vn.prototype.slice=function(e,t){e=ms(e);var r=this;return r.__filtered__&&(e>0||t<0)?new Vn(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==n&&(r=(t=ms(t))<0?r.dropRight(-t):r.take(t-e)),r)},Vn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Vn.prototype.toArray=function(){return this.take(p)},Ir(Vn.prototype,function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),a=Gn[i?"take"+("last"==t?"Right":""):t],o=i||/^find/.test(t);a&&(Gn.prototype[t]=function(){var t=this.__wrapped__,s=i?[1]:arguments,c=t instanceof Vn,l=s[0],u=c||Wo(t),d=function(e){var t=a.apply(Gn,Ot([e],s));return i&&p?t[0]:t};u&&r&&"function"==typeof l&&1!=l.length&&(c=u=!1);var p=this.__chain__,h=!!this.__actions__.length,f=o&&!p,m=c&&!h;if(!o&&u){t=m?t:new Vn(this);var g=e.apply(t,s);return g.__actions__.push({func:fo,args:[d],thisArg:n}),new Un(g,p)}return f&&m?e.apply(this,s):(g=this.thru(d),f?i?g.value()[0]:g.value():g)})}),_t(["pop","push","shift","sort","splice","unshift"],function(e){var t=Re[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Gn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wo(i)?i:[],e)}return this[n](function(n){return t.apply(Wo(n)?n:[],e)})}}),Ir(Vn.prototype,function(e,t){var n=Gn[t];if(n){var r=n.name+"";Me.call(Rn,r)||(Rn[r]=[]),Rn[r].push({name:t,func:n})}}),Rn[Gi(n,2).name]=[{name:"wrapper",func:n}],Vn.prototype.clone=function(){var e=new Vn(this.__wrapped__);return e.__actions__=Ei(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ei(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ei(this.__views__),e},Vn.prototype.reverse=function(){if(this.__filtered__){var e=new Vn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Vn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wo(e),r=t<0,i=n?e.length:0,a=function(e,t,n){for(var r=-1,i=n.length;++r<i;){var a=n[r],o=a.size;switch(a.type){case"drop":e+=o;break;case"dropRight":t-=o;break;case"take":t=yn(t,e+o);break;case"takeRight":e=gn(e,t-o)}}return{start:e,end:t}}(0,i,this.__views__),o=a.start,s=a.end,c=s-o,l=r?s:o-1,u=this.__iteratees__,d=u.length,p=0,h=yn(c,this.__takeCount__);if(!n||!r&&i==c&&h==c)return pi(e,this.__actions__);var f=[];e:for(;c--&&p<h;){for(var m=-1,g=e[l+=t];++m<d;){var y=u[m],I=y.iteratee,C=y.type,A=I(g);if(2==C)g=A;else if(!A){if(1==C)continue e;break e}}f[p++]=g}return f},Gn.prototype.at=mo,Gn.prototype.chain=function(){return ho(this)},Gn.prototype.commit=function(){return new Un(this.value(),this.__chain__)},Gn.prototype.next=function(){this.__values__===n&&(this.__values__=hs(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?n:this.__values__[this.__index__++]}},Gn.prototype.plant=function(e){for(var t,r=this;r instanceof Hn;){var i=xa(r);i.__index__=0,i.__values__=n,t?a.__wrapped__=i:t=i;var a=i;r=r.__wrapped__}return a.__wrapped__=e,t},Gn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Vn){var t=e;return this.__actions__.length&&(t=new Vn(this)),(t=t.reverse()).__actions__.push({func:fo,args:[eo],thisArg:n}),new Un(t,this.__chain__)}return this.thru(eo)},Gn.prototype.toJSON=Gn.prototype.valueOf=Gn.prototype.value=function(){return pi(this.__wrapped__,this.__actions__)},Gn.prototype.first=Gn.prototype.head,ze&&(Gn.prototype[ze]=function(){return this}),Gn}();ht?((ht.exports=hn)._=hn,pt._=hn):dt._=hn}.call(ta)),ea.exports;var e,t}function ra(){if(Wi)return ji;Wi=1;const{omitBy:e,isNil:t}=na(),{toDateString:n}=function(){if($i)return Vi;function e(e){return e<10?"0"+e:e}return $i=1,Vi={toDateString:function(t){return null==t||"string"==typeof t?t:`${t.getUTCFullYear()}-${e(t.getUTCMonth()+1)}-${e(t.getUTCDate())}`}}}();return ji={get:function({start:r,end:i}={}){const a=e({start:n(r),end:n(i)},t);return this.sendRequest("/calendar",a)}}}var ia,aa,oa,sa,ca,la,ua,da,pa,ha,fa,ma,ga,ya,Ia,Ca,Aa,Sa,ba,Ta,va,_a,wa,Ea,Pa,Ra,La,Na,Oa,Ba,Ma,Da,Fa,ka,Ga,xa,Ha,Ua,Va,$a,ja,Wa,Xa,Ka,Ya,qa,Qa={},Ja={};function za(){if(aa)return ia;aa=1;var e="object"==typeof Ti&&Ti&&Ti.Object===Object&&Ti;return ia=e}function Za(){if(sa)return oa;sa=1;var e=za(),t="object"==typeof self&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return oa=n}function eo(){if(la)return ca;la=1;var e=Za().Symbol;return ca=e}function to(){if(ma)return fa;ma=1;var e=eo(),t=function(){if(da)return ua;da=1;var e=eo(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;return ua=function(e){var t=n.call(e,i),a=e[i];try{e[i]=void 0;var o=!0}catch(c){}var s=r.call(e);return o&&(t?e[i]=a:delete e[i]),s}}(),n=function(){if(ha)return pa;ha=1;var e=Object.prototype.toString;return pa=function(t){return e.call(t)}}(),r=e?e.toStringTag:void 0;return fa=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":r&&r in Object(e)?t(e):n(e)}}function no(){if(ya)return ga;return ya=1,ga=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}}function ro(){if(Ca)return Ia;Ca=1;var e=to(),t=no();return Ia=function(n){if(!t(n))return!1;var r=e(n);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}}function io(){if(Ta)return ba;Ta=1;var e,t=function(){if(Sa)return Aa;Sa=1;var e=Za()["__core-js_shared__"];return Aa=e}(),n=(e=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||""))?"Symbol(src)_1."+e:"";return ba=function(e){return!!n&&n in e}}function ao(){if(_a)return va;_a=1;var e=Function.prototype.toString;return va=function(t){if(null!=t){try{return e.call(t)}catch(n){}try{return t+""}catch(n){}}return""}}function oo(){if(Na)return La;Na=1;var e=function(){if(Ea)return wa;Ea=1;var e=ro(),t=io(),n=no(),r=ao(),i=/^\[object .+?Constructor\]$/,a=Function.prototype,o=Object.prototype,s=a.toString,c=o.hasOwnProperty,l=RegExp("^"+s.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return wa=function(a){return!(!n(a)||t(a))&&(e(a)?l:i).test(r(a))}}(),t=Ra?Pa:(Ra=1,Pa=function(e,t){return null==e?void 0:e[t]});return La=function(n,r){var i=t(n,r);return e(i)?i:void 0}}function so(){if(Da)return Ma;Da=1;var e=function(){if(Ba)return Oa;Ba=1;var e=oo(),t=function(){try{var t=e(Object,"defineProperty");return t({},"",{}),t}catch(n){}}();return Oa=t}();return Ma=function(t,n,r){"__proto__"==n&&e?e(t,n,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[n]=r}}function co(){if(xa)return Ga;xa=1;var e=(ka?Fa:(ka=1,Fa=function(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(!1===n(a[c],c,a))break}return t}}))();return Ga=e}function lo(){if($a)return Va;return $a=1,Va=function(e){return null!=e&&"object"==typeof e}}function uo(){if(Ka)return Xa;Ka=1;var e=function(){if(Wa)return ja;Wa=1;var e=to(),t=lo();return ja=function(n){return t(n)&&"[object Arguments]"==e(n)}}(),t=lo(),n=Object.prototype,r=n.hasOwnProperty,i=n.propertyIsEnumerable,a=e(function(){return arguments}())?e:function(e){return t(e)&&r.call(e,"callee")&&!i.call(e,"callee")};return Xa=a}function po(){if(qa)return Ya;qa=1;var e=Array.isArray;return Ya=e}var ho,fo,mo,go,yo,Io,Co,Ao,So,bo,To,vo={exports:{}};function _o(){return mo||(mo=1,e=vo,t=vo.exports,n=Za(),r=fo?ho:(fo=1,ho=function(){return!1}),i=t&&!t.nodeType&&t,a=i&&e&&!e.nodeType&&e,o=a&&a.exports===i?n.Buffer:void 0,s=(o?o.isBuffer:void 0)||r,e.exports=s),vo.exports;var e,t,n,r,i,a,o,s}function wo(){if(yo)return go;yo=1;var e=/^(?:0|[1-9]\d*)$/;return go=function(t,n){var r=typeof t;return!!(n=null==n?9007199254740991:n)&&("number"==r||"symbol"!=r&&e.test(t))&&t>-1&&t%1==0&&t<n}}function Eo(){if(Co)return Io;Co=1;return Io=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}}var Po,Ro,Lo,No,Oo,Bo,Mo,Do,Fo,ko,Go,xo,Ho,Uo,Vo,$o,jo,Wo,Xo,Ko,Yo,qo,Qo,Jo,zo,Zo,es,ts,ns,rs,is,as,os,ss,cs,ls,us,ds,ps,hs,fs,ms,gs,ys,Is,Cs,As,Ss,bs,Ts,vs,_s,ws,Es,Ps,Rs,Ls,Ns,Os,Bs,Ms,Ds,Fs,ks,Gs,xs,Hs,Us,Vs,$s,js,Ws,Xs,Ks,Ys,qs,Qs,Js,zs,Zs,ec,tc,nc,rc,ic,ac,oc,sc,cc,lc,uc,dc,pc,hc,fc,mc,gc,yc,Ic,Cc,Ac,Sc,bc,Tc,vc,_c,wc,Ec,Pc,Rc,Lc,Nc,Oc,Bc,Mc,Dc,Fc,kc,Gc,xc,Hc,Uc,Vc,$c,jc,Wc,Xc,Kc,Yc,qc,Qc,Jc,zc,Zc,el,tl,nl,rl,il,al,ol,sl,cl,ll,ul,dl,pl,hl,fl,ml,gl,yl,Il,Cl,Al,Sl,bl,Tl,vl,_l,wl,El,Pl,Rl,Ll,Nl,Ol,Bl,Ml,Dl,Fl,kl,Gl,xl,Hl,Ul,Vl,$l,jl,Wl,Xl,Kl,Yl,ql,Ql,Jl={exports:{}};function zl(){if(Lo)return Ro;Lo=1;var e=function(){if(So)return Ao;So=1;var e=to(),t=Eo(),n=lo(),r={};return r["[object Float32Array]"]=r["[object Float64Array]"]=r["[object Int8Array]"]=r["[object Int16Array]"]=r["[object Int32Array]"]=r["[object Uint8Array]"]=r["[object Uint8ClampedArray]"]=r["[object Uint16Array]"]=r["[object Uint32Array]"]=!0,r["[object Arguments]"]=r["[object Array]"]=r["[object ArrayBuffer]"]=r["[object Boolean]"]=r["[object DataView]"]=r["[object Date]"]=r["[object Error]"]=r["[object Function]"]=r["[object Map]"]=r["[object Number]"]=r["[object Object]"]=r["[object RegExp]"]=r["[object Set]"]=r["[object String]"]=r["[object WeakMap]"]=!1,Ao=function(i){return n(i)&&t(i.length)&&!!r[e(i)]}}(),t=To?bo:(To=1,bo=function(e){return function(t){return e(t)}}),n=function(){return Po||(Po=1,e=Jl,t=Jl.exports,n=za(),r=t&&!t.nodeType&&t,i=r&&e&&!e.nodeType&&e,a=i&&i.exports===r&&n.process,o=function(){try{return i&&i.require&&i.require("util").types||a&&a.binding&&a.binding("util")}catch(e){}}(),e.exports=o),Jl.exports;var e,t,n,r,i,a,o}(),r=n&&n.isTypedArray,i=r?t(r):e;return Ro=i}function Zl(){if(Oo)return No;Oo=1;var e=Ua?Ha:(Ua=1,Ha=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}),t=uo(),n=po(),r=_o(),i=wo(),a=zl(),o=Object.prototype.hasOwnProperty;return No=function(s,c){var l=n(s),u=!l&&t(s),d=!l&&!u&&r(s),p=!l&&!u&&!d&&a(s),h=l||u||d||p,f=h?e(s.length,String):[],m=f.length;for(var g in s)!c&&!o.call(s,g)||h&&("length"==g||d&&("offset"==g||"parent"==g)||p&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||i(g,m))||f.push(g);return f}}function eu(){if(Go)return ko;Go=1;var e=(Fo?Do:(Fo=1,Do=function(e,t){return function(n){return e(t(n))}}))(Object.keys,Object);return ko=e}function tu(){if(Ho)return xo;Ho=1;var e=function(){if(Mo)return Bo;Mo=1;var e=Object.prototype;return Bo=function(t){var n=t&&t.constructor;return t===("function"==typeof n&&n.prototype||e)}}(),t=eu(),n=Object.prototype.hasOwnProperty;return xo=function(r){if(!e(r))return t(r);var i=[];for(var a in Object(r))n.call(r,a)&&"constructor"!=a&&i.push(a);return i}}function nu(){if(jo)return $o;jo=1;var e=Zl(),t=tu(),n=function(){if(Vo)return Uo;Vo=1;var e=ro(),t=Eo();return Uo=function(n){return null!=n&&t(n.length)&&!e(n)}}();return $o=function(r){return n(r)?e(r):t(r)}}function ru(){if(Xo)return Wo;Xo=1;var e=co(),t=nu();return Wo=function(n,r){return n&&e(n,r,t)}}function iu(){if(Qo)return qo;return Qo=1,qo=function(e,t){return e===t||e!=e&&t!=t}}function au(){if(zo)return Jo;zo=1;var e=iu();return Jo=function(t,n){for(var r=t.length;r--;)if(e(t[r][0],n))return r;return-1}}function ou(){if(cs)return ss;cs=1;var e=Yo?Ko:(Yo=1,Ko=function(){this.__data__=[],this.size=0}),t=function(){if(es)return Zo;es=1;var e=au(),t=Array.prototype.splice;return Zo=function(n){var r=this.__data__,i=e(r,n);return!(i<0||(i==r.length-1?r.pop():t.call(r,i,1),--this.size,0))}}(),n=function(){if(ns)return ts;ns=1;var e=au();return ts=function(t){var n=this.__data__,r=e(n,t);return r<0?void 0:n[r][1]}}(),r=function(){if(is)return rs;is=1;var e=au();return rs=function(t){return e(this.__data__,t)>-1}}(),i=function(){if(os)return as;os=1;var e=au();return as=function(t,n){var r=this.__data__,i=e(r,t);return i<0?(++this.size,r.push([t,n])):r[i][1]=n,this}}();function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,ss=a}function su(){if(Is)return ys;Is=1;var e=oo()(Za(),"Map");return ys=e}function cu(){if(As)return Cs;As=1;var e=oo()(Object,"create");return Cs=e}function lu(){if(Os)return Ns;Os=1;var e=function(){if(bs)return Ss;bs=1;var e=cu();return Ss=function(){this.__data__=e?e(null):{},this.size=0}}(),t=vs?Ts:(vs=1,Ts=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}),n=function(){if(ws)return _s;ws=1;var e=cu(),t=Object.prototype.hasOwnProperty;return _s=function(n){var r=this.__data__;if(e){var i=r[n];return"__lodash_hash_undefined__"===i?void 0:i}return t.call(r,n)?r[n]:void 0}}(),r=function(){if(Ps)return Es;Ps=1;var e=cu(),t=Object.prototype.hasOwnProperty;return Es=function(n){var r=this.__data__;return e?void 0!==r[n]:t.call(r,n)}}(),i=function(){if(Ls)return Rs;Ls=1;var e=cu();return Rs=function(t,n){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=e&&void 0===n?"__lodash_hash_undefined__":n,this}}();function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,Ns=a}function uu(){if(Gs)return ks;Gs=1;var e=Fs?Ds:(Fs=1,Ds=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e});return ks=function(t,n){var r=t.__data__;return e(n)?r["string"==typeof n?"string":"hash"]:r.map}}function du(){if(Ys)return Ks;Ys=1;var e=function(){if(Ms)return Bs;Ms=1;var e=lu(),t=ou(),n=su();return Bs=function(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}}(),t=function(){if(Hs)return xs;Hs=1;var e=uu();return xs=function(t){var n=e(this,t).delete(t);return this.size-=n?1:0,n}}(),n=function(){if(Vs)return Us;Vs=1;var e=uu();return Us=function(t){return e(this,t).get(t)}}(),r=function(){if(js)return $s;js=1;var e=uu();return $s=function(t){return e(this,t).has(t)}}(),i=function(){if(Xs)return Ws;Xs=1;var e=uu();return Ws=function(t,n){var r=e(this,t),i=r.size;return r.set(t,n),this.size+=r.size==i?0:1,this}}();function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,Ks=a}function pu(){if(zs)return Js;zs=1;var e=ou(),t=function(){if(us)return ls;us=1;var e=ou();return ls=function(){this.__data__=new e,this.size=0}}(),n=ps?ds:(ps=1,ds=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}),r=fs?hs:(fs=1,hs=function(e){return this.__data__.get(e)}),i=gs?ms:(gs=1,ms=function(e){return this.__data__.has(e)}),a=function(){if(Qs)return qs;Qs=1;var e=ou(),t=su(),n=du();return qs=function(r,i){var a=this.__data__;if(a instanceof e){var o=a.__data__;if(!t||o.length<199)return o.push([r,i]),this.size=++a.size,this;a=this.__data__=new n(o)}return a.set(r,i),this.size=a.size,this}}();function o(t){var n=this.__data__=new e(t);this.size=n.size}return o.prototype.clear=t,o.prototype.delete=n,o.prototype.get=r,o.prototype.has=i,o.prototype.set=a,Js=o}function hu(){if(ic)return rc;ic=1;var e=du(),t=ec?Zs:(ec=1,Zs=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}),n=nc?tc:(nc=1,tc=function(e){return this.__data__.has(e)});function r(t){var n=-1,r=null==t?0:t.length;for(this.__data__=new e;++n<r;)this.add(t[n])}return r.prototype.add=r.prototype.push=t,r.prototype.has=n,rc=r}function fu(){if(uc)return lc;uc=1;var e=hu(),t=oc?ac:(oc=1,ac=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}),n=cc?sc:(cc=1,sc=function(e,t){return e.has(t)});return lc=function(r,i,a,o,s,c){var l=1&a,u=r.length,d=i.length;if(u!=d&&!(l&&d>u))return!1;var p=c.get(r),h=c.get(i);if(p&&h)return p==i&&h==r;var f=-1,m=!0,g=2&a?new e:void 0;for(c.set(r,i),c.set(i,r);++f<u;){var y=r[f],I=i[f];if(o)var C=l?o(I,y,f,i,r,c):o(y,I,f,r,i,c);if(void 0!==C){if(C)continue;m=!1;break}if(g){if(!t(i,function(e,t){if(!n(g,t)&&(y===e||s(y,e,a,o,c)))return g.push(t)})){m=!1;break}}else if(y!==I&&!s(y,I,a,o,c)){m=!1;break}}return c.delete(r),c.delete(i),m}}function mu(){if(Ic)return yc;Ic=1;var e=eo(),t=function(){if(pc)return dc;pc=1;var e=Za().Uint8Array;return dc=e}(),n=iu(),r=fu(),i=fc?hc:(fc=1,hc=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}),a=gc?mc:(gc=1,mc=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}),o=e?e.prototype:void 0,s=o?o.valueOf:void 0;return yc=function(e,o,c,l,u,d,p){switch(c){case"[object DataView]":if(e.byteLength!=o.byteLength||e.byteOffset!=o.byteOffset)return!1;e=e.buffer,o=o.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=o.byteLength||!d(new t(e),new t(o)));case"[object Boolean]":case"[object Date]":case"[object Number]":return n(+e,+o);case"[object Error]":return e.name==o.name&&e.message==o.message;case"[object RegExp]":case"[object String]":return e==o+"";case"[object Map]":var h=i;case"[object Set]":var f=1&l;if(h||(h=a),e.size!=o.size&&!f)return!1;var m=p.get(e);if(m)return m==o;l|=2,p.set(e,o);var g=r(h(e),h(o),l,u,d,p);return p.delete(e),g;case"[object Symbol]":if(s)return s.call(e)==s.call(o)}return!1}}function gu(){if(bc)return Sc;bc=1;var e=Ac?Cc:(Ac=1,Cc=function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}),t=po();return Sc=function(n,r,i){var a=r(n);return t(n)?a:e(a,i(n))}}function yu(){if(Pc)return Ec;Pc=1;var e=vc?Tc:(vc=1,Tc=function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}),t=wc?_c:(wc=1,_c=function(){return[]}),n=Object.prototype.propertyIsEnumerable,r=Object.getOwnPropertySymbols;return Ec=r?function(t){return null==t?[]:(t=Object(t),e(r(t),function(e){return n.call(t,e)}))}:t}function Iu(){if(Oc)return Nc;Oc=1;var e=function(){if(Lc)return Rc;Lc=1;var e=gu(),t=yu(),n=nu();return Rc=function(r){return e(r,n,t)}}(),t=Object.prototype.hasOwnProperty;return Nc=function(n,r,i,a,o,s){var c=1&i,l=e(n),u=l.length;if(u!=e(r).length&&!c)return!1;for(var d=u;d--;){var p=l[d];if(!(c?p in r:t.call(r,p)))return!1}var h=s.get(n),f=s.get(r);if(h&&f)return h==r&&f==n;var m=!0;s.set(n,r),s.set(r,n);for(var g=c;++d<u;){var y=n[p=l[d]],I=r[p];if(a)var C=c?a(I,y,p,r,n,s):a(y,I,p,n,r,s);if(!(void 0===C?y===I||o(y,I,i,a,s):C)){m=!1;break}g||(g="constructor"==p)}if(m&&!g){var A=n.constructor,S=r.constructor;A==S||!("constructor"in n)||!("constructor"in r)||"function"==typeof A&&A instanceof A&&"function"==typeof S&&S instanceof S||(m=!1)}return s.delete(n),s.delete(r),m}}function Cu(){if(Vc)return Uc;Vc=1;var e=function(){if(Mc)return Bc;Mc=1;var e=oo()(Za(),"DataView");return Bc=e}(),t=su(),n=function(){if(Fc)return Dc;Fc=1;var e=oo()(Za(),"Promise");return Dc=e}(),r=function(){if(Gc)return kc;Gc=1;var e=oo()(Za(),"Set");return kc=e}(),i=function(){if(Hc)return xc;Hc=1;var e=oo()(Za(),"WeakMap");return xc=e}(),a=to(),o=ao(),s="[object Map]",c="[object Promise]",l="[object Set]",u="[object WeakMap]",d="[object DataView]",p=o(e),h=o(t),f=o(n),m=o(r),g=o(i),y=a;return(e&&y(new e(new ArrayBuffer(1)))!=d||t&&y(new t)!=s||n&&y(n.resolve())!=c||r&&y(new r)!=l||i&&y(new i)!=u)&&(y=function(e){var t=a(e),n="[object Object]"==t?e.constructor:void 0,r=n?o(n):"";if(r)switch(r){case p:return d;case h:return s;case f:return c;case m:return l;case g:return u}return t}),Uc=y}function Au(){if(Xc)return Wc;Xc=1;var e=function(){if(jc)return $c;jc=1;var e=pu(),t=fu(),n=mu(),r=Iu(),i=Cu(),a=po(),o=_o(),s=zl(),c="[object Arguments]",l="[object Array]",u="[object Object]",d=Object.prototype.hasOwnProperty;return $c=function(p,h,f,m,g,y){var I=a(p),C=a(h),A=I?l:i(p),S=C?l:i(h),b=(A=A==c?u:A)==u,T=(S=S==c?u:S)==u,v=A==S;if(v&&o(p)){if(!o(h))return!1;I=!0,b=!1}if(v&&!b)return y||(y=new e),I||s(p)?t(p,h,f,m,g,y):n(p,h,A,f,m,g,y);if(!(1&f)){var _=b&&d.call(p,"__wrapped__"),w=T&&d.call(h,"__wrapped__");if(_||w){var E=_?p.value():p,P=w?h.value():h;return y||(y=new e),g(E,P,f,m,y)}}return!!v&&(y||(y=new e),r(p,h,f,m,g,y))}}(),t=lo();return Wc=function n(r,i,a,o,s){return r===i||(null==r||null==i||!t(r)&&!t(i)?r!=r&&i!=i:e(r,i,a,o,n,s))},Wc}function Su(){if(Qc)return qc;Qc=1;var e=no();return qc=function(t){return t==t&&!e(t)}}function bu(){if(el)return Zc;return el=1,Zc=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}}function Tu(){if(nl)return tl;nl=1;var e=function(){if(Yc)return Kc;Yc=1;var e=pu(),t=Au();return Kc=function(n,r,i,a){var o=i.length,s=o,c=!a;if(null==n)return!s;for(n=Object(n);o--;){var l=i[o];if(c&&l[2]?l[1]!==n[l[0]]:!(l[0]in n))return!1}for(;++o<s;){var u=(l=i[o])[0],d=n[u],p=l[1];if(c&&l[2]){if(void 0===d&&!(u in n))return!1}else{var h=new e;if(a)var f=a(d,p,u,n,r,h);if(!(void 0===f?t(p,d,3,a,h):f))return!1}}return!0}}(),t=function(){if(zc)return Jc;zc=1;var e=Su(),t=nu();return Jc=function(n){for(var r=t(n),i=r.length;i--;){var a=r[i],o=n[a];r[i]=[a,o,e(o)]}return r}}(),n=bu();return tl=function(r){var i=t(r);return 1==i.length&&i[0][2]?n(i[0][0],i[0][1]):function(t){return t===r||e(t,r,i)}}}function vu(){if(il)return rl;il=1;var e=to(),t=lo();return rl=function(n){return"symbol"==typeof n||t(n)&&"[object Symbol]"==e(n)}}function _u(){if(ol)return al;ol=1;var e=po(),t=vu(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;return al=function(i,a){if(e(i))return!1;var o=typeof i;return!("number"!=o&&"symbol"!=o&&"boolean"!=o&&null!=i&&!t(i))||(r.test(i)||!n.test(i)||null!=a&&i in Object(a))}}function wu(){if(ul)return ll;ul=1;var e=function(){if(cl)return sl;cl=1;var e=du();function t(n,r){if("function"!=typeof n||null!=r&&"function"!=typeof r)throw new TypeError("Expected a function");var i=function(){var e=arguments,t=r?r.apply(this,e):e[0],a=i.cache;if(a.has(t))return a.get(t);var o=n.apply(this,e);return i.cache=a.set(t,o)||a,o};return i.cache=new(t.Cache||e),i}return t.Cache=e,sl=t}();return ll=function(t){var n=e(t,function(e){return 500===r.size&&r.clear(),e}),r=n.cache;return n}}function Eu(){if(gl)return ml;gl=1;var e=eo(),t=fl?hl:(fl=1,hl=function(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}),n=po(),r=vu(),i=e?e.prototype:void 0,a=i?i.toString:void 0;return ml=function e(i){if("string"==typeof i)return i;if(n(i))return t(i,e)+"";if(r(i))return a?a.call(i):"";var o=i+"";return"0"==o&&1/i==-1/0?"-0":o},ml}function Pu(){if(Al)return Cl;Al=1;var e=po(),t=_u(),n=function(){if(pl)return dl;pl=1;var e=wu(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(e){var r=[];return 46===e.charCodeAt(0)&&r.push(""),e.replace(t,function(e,t,i,a){r.push(i?a.replace(n,"$1"):t||e)}),r});return dl=r}(),r=function(){if(Il)return yl;Il=1;var e=Eu();return yl=function(t){return null==t?"":e(t)}}();return Cl=function(i,a){return e(i)?i:t(i,a)?[i]:n(r(i))}}function Ru(){if(bl)return Sl;bl=1;var e=vu();return Sl=function(t){if("string"==typeof t||e(t))return t;var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}}function Lu(){if(vl)return Tl;vl=1;var e=Pu(),t=Ru();return Tl=function(n,r){for(var i=0,a=(r=e(r,n)).length;null!=n&&i<a;)n=n[t(r[i++])];return i&&i==a?n:void 0}}function Nu(){if(Ol)return Nl;Ol=1;var e=Pl?El:(Pl=1,El=function(e,t){return null!=e&&t in Object(e)}),t=function(){if(Ll)return Rl;Ll=1;var e=Pu(),t=uo(),n=po(),r=wo(),i=Eo(),a=Ru();return Rl=function(o,s,c){for(var l=-1,u=(s=e(s,o)).length,d=!1;++l<u;){var p=a(s[l]);if(!(d=null!=o&&c(o,p)))break;o=o[p]}return d||++l!=u?d:!!(u=null==o?0:o.length)&&i(u)&&r(p,u)&&(n(o)||t(o))}}();return Nl=function(n,r){return null!=n&&t(n,r,e)}}function Ou(){if(Ml)return Bl;Ml=1;var e=Au(),t=function(){if(wl)return _l;wl=1;var e=Lu();return _l=function(t,n,r){var i=null==t?void 0:e(t,n);return void 0===i?r:i}}(),n=Nu(),r=_u(),i=Su(),a=bu(),o=Ru();return Bl=function(s,c){return r(s)&&i(c)?a(o(s),c):function(r){var i=t(r,s);return void 0===i&&i===c?n(r,s):e(c,i,3)}}}function Bu(){if(Vl)return Ul;Vl=1;var e=Gl?kl:(Gl=1,kl=function(e){return function(t){return null==t?void 0:t[e]}}),t=function(){if(Hl)return xl;Hl=1;var e=Lu();return xl=function(t){return function(n){return e(n,t)}}}(),n=_u(),r=Ru();return Ul=function(i){return n(i)?e(r(i)):t(i)}}function Mu(){if(jl)return $l;jl=1;var e=Tu(),t=Ou(),n=Fl?Dl:(Fl=1,Dl=function(e){return e}),r=po(),i=Bu();return $l=function(a){return"function"==typeof a?a:null==a?n:"object"==typeof a?r(a)?t(a[0],a[1]):e(a):i(a)}}function Du(){if(ql)return Ja;ql=1;var e=Ja&&Ja.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ja,"__esModule",{value:!0}),Ja.mergeCorporateActions=Ja.getCorporateActionsSize=Ja.convertCorporateActions=Ja.NewTimeframe=Ja.TimeFrameUnit=Ja.AlpacaNews=Ja.AlpacaOptionSnapshotV1Beta1=Ja.AlpacaOptionQuoteV1Beta1=Ja.AlpacaOptionTradeV1Beta1=Ja.AlpacaOptionBarV1Beta1=Ja.AlpacaCryptoOrderbook=Ja.AlpacaCryptoSnapshot=Ja.AlpacaCryptoBar=Ja.AlpacaCryptoQuote=Ja.AlpacaCryptoTrade=Ja.AlpacaCorrectionV2=Ja.AlpacaCancelErrorV2=Ja.AlpacaLuldV2=Ja.AlpacaStatusV2=Ja.AlpacaSnapshotV2=Ja.AlpacaBarV2=Ja.AlpacaQuoteV2=Ja.AlpacaTradeV2=void 0;const t=e(function(){if(Xl)return Wl;Xl=1;var e=so(),t=ru(),n=Mu();return Wl=function(r,i){var a={};return i=n(i,3),t(r,function(t,n,r){e(a,i(t,n,r),t)}),a}}()),n=e(function(){if(Yl)return Kl;Yl=1;var e=so(),t=ru(),n=Mu();return Kl=function(r,i){var a={};return i=n(i,3),t(r,function(t,n,r){e(a,n,i(t,n,r))}),a}}()),r={S:"Symbol",i:"ID",x:"Exchange",p:"Price",s:"Size",t:"Timestamp",c:"Conditions",z:"Tape"},i={S:"Symbol",bx:"BidExchange",bp:"BidPrice",bs:"BidSize",ax:"AskExchange",ap:"AskPrice",as:"AskSize",t:"Timestamp",c:"Conditions",z:"Tape"},a={S:"Symbol",o:"OpenPrice",h:"HighPrice",l:"LowPrice",c:"ClosePrice",v:"Volume",t:"Timestamp",vw:"VWAP",n:"TradeCount"},o={symbol:"symbol",latestTrade:"LatestTrade",latestQuote:"LatestQuote",minuteBar:"MinuteBar",dailyBar:"DailyBar",prevDailyBar:"PrevDailyBar"},s={S:"Symbol",sc:"StatusCode",sm:"StatusMessage",rc:"ReasonCode",rm:"ReasonMessage",t:"Timestamp",z:"Tape"},c={S:"Symbol",u:"LimitUpPrice",d:"LimitDownPrice",i:"Indicator",t:"Timestamp",z:"Tape"},l={S:"Symbol",i:"ID",x:"Exchange",p:"Price",s:"Size",a:"CancelErrorAction",z:"Tape",t:"Timestamp"},u={S:"Symbol",x:"Exchange",oi:"OriginalID",op:"OriginalPrice",os:"OriginalSize",oc:"OriginalConditions",ci:"CorrectedID",cp:"CorrectedPrice",cs:"CorrectedSize",cc:"CorrectedConditions",z:"Tape",t:"Timestamp"},d={S:"Symbol",t:"Timestamp",x:"Exchange",p:"Price",s:"Size",tks:"TakerSide",i:"ID"},p={t:"Timestamp",bp:"BidPrice",bs:"BidSize",ap:"AskPrice",as:"AskSize"},h={t:"Timestamp",o:"Open",h:"High",l:"Low",c:"Close",v:"Volume",vw:"VWAP",n:"TradeCount"},f={latestTrade:"LatestTrade",latestQuote:"LatestQuote",minuteBar:"MinuteBar",dailyBar:"DailyBar",prevDailyBar:"PrevDailyBar"},m={p:"Price",s:"Size"},g={t:"Timestamp",b:"Bids",a:"Asks"},y={size:"Size",url:"URL"},I={id:"ID",author:"Author",created_at:"CreatedAt",updated_at:"UpdatedAt",headline:"Headline",summary:"Summary",content:"Content",images:"Images",url:"URL",symbols:"Symbols",source:"Source"},C={S:"Symbol",o:"Open",h:"High",l:"Low",c:"Close",v:"Volume",t:"Timestamp",vw:"VWAP",n:"TradeCount"},A={S:"Symbol",x:"Exchange",p:"Price",s:"Size",t:"Timestamp",c:"Condition"},S={S:"Symbol",bx:"BidExchange",bp:"BidPrice",bs:"BidSize",ax:"AskExchange",ap:"AskPrice",as:"AskSize",t:"Timestamp",c:"Conditions",z:"Tape"},b={symbol:"symbol",latestTrade:"LatestTrade",latestQuote:"LatestQuote",impliedVolatility:"ImpliedVolatility",greeks:"Greeks"};function T(e){return N(e,r)}function v(e){return N(e,i)}function _(e){return N(e,a)}function w(e){return N(e,d)}function E(e){return N(e,p)}function P(e){return N(e,h)}function R(e){return N(e,A)}function L(e){return N(e,S)}function N(e,n){return(0,t.default)(e,(e,t)=>Object.hasOwn(n,t)?n[t]:t)}function O(e,t,n){switch(e){case"LatestTrade":return n?w(t):T(t);case"LatestQuote":return n?E(t):v(t);case"MinuteBar":case"DailyBar":case"PrevDailyBar":return n?P(t):_(t);default:return t}}var B,M;Ja.AlpacaTradeV2=T,Ja.AlpacaQuoteV2=v,Ja.AlpacaBarV2=_,Ja.AlpacaSnapshotV2=function(e){const t=N(e,o);return(0,n.default)(t,(e,t)=>O(t,e,!1))},Ja.AlpacaStatusV2=function(e){return N(e,s)},Ja.AlpacaLuldV2=function(e){return N(e,c)},Ja.AlpacaCancelErrorV2=function(e){return N(e,l)},Ja.AlpacaCorrectionV2=function(e){return N(e,u)},Ja.AlpacaCryptoTrade=w,Ja.AlpacaCryptoQuote=E,Ja.AlpacaCryptoBar=P,Ja.AlpacaCryptoSnapshot=function(e){const t=N(e,f);return(0,n.default)(t,(e,t)=>O(t,e,!0))},Ja.AlpacaCryptoOrderbook=function(e){const t=e=>e.map(e=>N(e,m)),n=N(e,g);return Object.assign(Object.assign({},n),{Bids:t(n.Bids),Asks:t(n.Asks)})},Ja.AlpacaOptionBarV1Beta1=function(e){return N(e,C)},Ja.AlpacaOptionTradeV1Beta1=R,Ja.AlpacaOptionQuoteV1Beta1=L,Ja.AlpacaOptionSnapshotV1Beta1=function(e){const t=N(e,b);return(0,n.default)(t,(e,t)=>function(e,t){switch(e){case"LatestTrade":return R(t);case"LatestQuote":return L(t);default:return t}}(t,e))},Ja.AlpacaNews=function(e){const t=N(e,I);return t.Images&&t.Images.forEach(e=>N(e,y)),t},(M=B||(Ja.TimeFrameUnit=B={})).MIN="Min",M.HOUR="Hour",M.DAY="Day",M.WEEK="Week",M.MONTH="Month",Ja.NewTimeframe=function(e,t){if(e<=0)throw new Error("amount must be a positive integer value");if(t==B.MIN&&e>59)throw new Error("minute timeframe can only be used with amount between 1-59");if(t==B.HOUR&&e>23)throw new Error("hour timeframe can only be used with amounts 1-23");if((t==B.DAY||t==B.WEEK)&&1!=e)throw new Error("day and week timeframes can only be used with amount 1");if(t==B.MONTH&&![1,2,3,6,12].includes(e))throw new Error("month timeframe can only be used with amount 1, 2, 3, 6 and 12");return`${e}${t}`};const D={ex_date:"ExDate",foreign:"Foreign",payable_date:"PayableDate",process_date:"ProcessDate",rate:"Rate",record_date:"RecordDate",special:"Special",symbol:"Symbol"},F={ex_date:"ExDate",new_rate:"NewRate",old_rate:"OldRate",payable_date:"PayableDate",process_date:"ProcessDate",record_date:"RecordDate",symbol:"Symbol"},k={due_bill_redemption_date:"DueBillRedemptionDate",ex_date:"ExDate",new_rate:"NewRate",old_rate:"OldRate",payable_date:"PayableDate",process_date:"ProcessDate",record_date:"RecordDate",symbol:"Symbol"},G={alternate_rate:"AlternateRate",alternate_symbol:"AlternateSymbol",effective_date:"EffectiveDate",new_rate:"NewRate",new_symbol:"NewSymbol",old_rate:"OldRate",old_symbol:"OldSymbol",process_date:"ProcessDate"},x={acquiree_symbol:"AcquireeSymbol",acquirer_symbol:"AcquirerSymbol",effective_date:"EffectiveDate",process_date:"ProcessDate",rate:"Rate"},H={acquiree_rate:"AcquireeRate",acquiree_symbol:"AcquireeSymbol",acquirer_rate:"AcquirerRate",acquirer_symbol:"AcquirerSymbol",effective_date:"EffectiveDate",payable_date:"PayableDate",process_date:"ProcessDate"},U={stock_merger_mapping:H,cash_rate:"CashRate"},V={ex_date:"ExDate",payable_date:"PayableDate",process_date:"ProcessDate",rate:"Rate",record_date:"RecordDate",symbol:"Symbol"},$={payable_date:"PayableDate",process_date:"ProcessDate",rate:"Rate",symbol:"Symbol"},j={ex_date:"ExDate",new_rate:"NewRate",new_symbol:"NewSymbol",process_date:"ProcessDate",record_date:"RecordDate",source_rate:"Rate",source_symbol:"SourceSymbol"},W={new_symbol:"NewSymbol",old_symbol:"OldSymbol",process_date:"ProcessDate"},X={symbol:"Symbol",process_date:"ProcessDate"},K={source_symbol:"SourceSymbol",new_symbol:"NewSymbol",rate:"Rate",process_date:"ProcessDate",ex_date:"ExDate",payable_date:"PayableDate",record_date:"RecordDate",expiration_date:"ExpirationDate"};return Ja.convertCorporateActions=function(e){var t,n,r,i,a,o,s,c,l,u,d,p,h;let f={};return(null===(t=e.cash_dividends)||void 0===t?void 0:t.length)>0&&(f.CashDividends=f.CashDividends?f.CashDividends:Array(),e.cash_dividends.forEach(e=>{f.CashDividends.push(N(e,D))})),(null===(n=e.reverse_splits)||void 0===n?void 0:n.length)>0&&(f.ReverseSplits=f.ReverseSplits?f.ReverseSplits:Array(),e.reverse_splits.forEach(e=>{f.ReverseSplits.push(N(e,F))})),(null===(r=e.forward_splits)||void 0===r?void 0:r.length)>0&&(f.ForwardSplits=f.ForwardSplits?f.ForwardSplits:Array(),e.forward_splits.forEach(e=>{f.ForwardSplits.push(N(e,k))})),(null===(i=e.unit_splits)||void 0===i?void 0:i.length)>0&&(f.UnitSplits=f.UnitSplits?f.UnitSplits:Array(),e.unit_splits.forEach(e=>{f.UnitSplits.push(N(e,G))})),(null===(a=e.cash_mergers)||void 0===a?void 0:a.length)>0&&(f.CashMergers=f.CashMergers?f.CashMergers:Array(),e.cash_mergers.forEach(e=>{f.CashMergers.push(N(e,x))})),(null===(o=e.stock_mergers)||void 0===o?void 0:o.length)>0&&(f.StockMergers=f.StockMergers?f.StockMergers:Array(),e.stock_mergers.forEach(e=>{f.StockMergers.push(N(e,H))})),(null===(s=e.stock_and_cash_mergers)||void 0===s?void 0:s.length)>0&&(f.StockAndCashMerger=f.StockAndCashMerger?f.StockAndCashMerger:Array(),e.stock_and_cash_mergers.forEach(e=>{f.StockAndCashMerger.push(N(e,U))})),(null===(c=e.stock_dividends)||void 0===c?void 0:c.length)>0&&(f.StockDividends=f.StockDividends?f.StockDividends:Array(),e.stock_dividends.forEach(e=>{f.StockDividends.push(N(e,V))})),(null===(l=e.redemptions)||void 0===l?void 0:l.length)>0&&(f.Redemptions=f.Redemptions?f.Redemptions:Array(),e.redemptions.forEach(e=>{f.Redemptions.push(N(e,$))})),(null===(u=e.spin_offs)||void 0===u?void 0:u.length)>0&&(f.SpinOffs=f.SpinOffs?f.SpinOffs:Array(),e.spin_offs.forEach(e=>{f.SpinOffs.push(N(e,j))})),(null===(d=e.name_changes)||void 0===d?void 0:d.length)>0&&(f.NameChanges=f.NameChanges?f.NameChanges:Array(),e.name_changes.forEach(e=>{f.NameChanges.push(N(e,W))})),(null===(p=e.worthless_removals)||void 0===p?void 0:p.length)>0&&(f.WorthlessRemovals=f.WorthlessRemovals?f.WorthlessRemovals:Array(),e.worthless_removals.forEach(e=>{f.WorthlessRemovals.push(N(e,X))})),(null===(h=e.rights_distributions)||void 0===h?void 0:h.length)>0&&(f.RightsDistributions=f.RightsDistributions?f.RightsDistributions:Array(),e.rights_distributions.forEach(e=>{f.RightsDistributions.push(N(e,K))})),f},Ja.getCorporateActionsSize=function(e){let t=0;for(const n in e)t+=e[n]?e[n].length:0;return t},Ja.mergeCorporateActions=function(e,t){return{CashDividends:(e.CashDividends||[]).concat(t.CashDividends||[]),ReverseSplits:(e.ReverseSplits||[]).concat(t.ReverseSplits||[]),ForwardSplits:(e.ForwardSplits||[]).concat(t.ForwardSplits||[]),UnitSplits:(e.UnitSplits||[]).concat(t.UnitSplits||[]),CashMergers:(e.CashMergers||[]).concat(t.CashMergers||[]),StockMergers:(e.StockMergers||[]).concat(t.StockMergers||[]),StockAndCashMerger:(e.StockAndCashMerger||[]).concat(t.StockAndCashMerger||[]),StockDividends:(e.StockDividends||[]).concat(t.StockDividends||[]),Redemptions:(e.Redemptions||[]).concat(t.Redemptions||[]),SpinOffs:(e.SpinOffs||[]).concat(t.SpinOffs||[]),NameChanges:(e.NameChanges||[]).concat(t.NameChanges||[]),WorthlessRemovals:(e.WorthlessRemovals||[]).concat(t.WorthlessRemovals||[]),RightsDistributions:(e.RightsDistributions||[]).concat(t.RightsDistributions||[])}},Ja}function Fu(){if(Ql)return Qa;Ql=1;var e=Qa&&Qa.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,a){function o(e){try{c(r.next(e))}catch(t){a(t)}}function s(e){try{c(r.throw(e))}catch(t){a(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},t=Qa&&Qa.__await||function(e){return this instanceof t?(this.v=e,this):new t(e)},n=Qa&&Qa.__asyncGenerator||function(e,n,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,a=r.apply(e,n||[]),o=[];return i={},s("next"),s("throw"),s("return",function(e){return function(t){return Promise.resolve(t).then(e,u)}}),i[Symbol.asyncIterator]=function(){return this},i;function s(e,t){a[e]&&(i[e]=function(t){return new Promise(function(n,r){o.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,n){try{(r=a[e](n)).value instanceof t?Promise.resolve(r.value.v).then(l,u):d(o[0][2],r)}catch(i){d(o[0][3],i)}var r}function l(e){c("next",e)}function u(e){c("throw",e)}function d(e,t){e(t),o.shift(),o.length&&c(o[0][0],o[0][1])}},r=Qa&&Qa.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise(function(r,i){(function(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)})(r,i,(t=e[n](t)).done,t.value)})}}},a=Qa&&Qa.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Qa,"__esModule",{value:!0}),Qa.getCorporateActions=Qa.getOptionChain=Qa.getOptionSnapshots=Qa.getLatestOptionQuotes=Qa.getLatestOptionTrades=Qa.getMultiOptionTradesAsync=Qa.getMultiOptionTrades=Qa.getMultiOptionBarsAsync=Qa.getMultiOptionBars=Qa.getNews=Qa.Sort=Qa.getLatestCryptoOrderbooks=Qa.getCryptoSnapshots=Qa.getLatestCryptoQuotes=Qa.getLatestCryptoTrades=Qa.getLatestCryptoBars=Qa.getCryptoBars=Qa.getCryptoQuotes=Qa.getCryptoTrades=Qa.getSnapshots=Qa.getSnapshot=Qa.getLatestBars=Qa.getLatestBar=Qa.getLatestQuotes=Qa.getLatestQuote=Qa.getLatestTrades=Qa.getLatestTrade=Qa.getMultiBarsAsync=Qa.getMultiBars=Qa.getBars=Qa.getMultiQuotesAsync=Qa.getMultiQuotes=Qa.getQuotes=Qa.getMultiTradesAsync=Qa.getMultiTrades=Qa.getTrades=Qa.getMultiDataV2=Qa.getDataV2=Qa.dataV2HttpRequest=Qa.TYPE=Qa.Adjustment=void 0;const o=a(i),s=Du(),c=1e4,l=1e3;var u,d,p,h,f,m;function g(e,t,n){const{dataBaseUrl:r,keyId:i,secretKey:a,oauth:s}=n,c={"Content-Type":"application/json","Accept-Encoding":"gzip"};return""==s?(c["APCA-API-KEY-ID"]=i,c["APCA-API-SECRET-KEY"]=a):c.Authorization="Bearer "+s,o.default.get(`${r}${e}`,{params:t,headers:c}).catch(e=>{var t,n;throw new Error(`code: ${(null===(t=e.response)||void 0===t?void 0:t.status)||e.statusCode}, message: ${null===(n=e.response)||void 0===n?void 0:n.data.message}`)})}function y(e,t,n){let r=0;if(0!==t&&(r=t),0!==e){const t=e-n;if(t<=0)return-1;(0==r||r>t)&&(r=t)}return r}function I(e,r,i,a){return n(this,arguments,function*(){var n;let o=null,s=0;const l=i.pageLimit?Math.min(i.pageLimit,c):c;for(delete i.pageLimit,i.limit=null!==(n=i.limit)&&void 0!==n?n:0;i.limit>s||0===i.limit;){let n;if(0!==i.limit){if(n=y(i.limit,l,s),-1==n)break}else n=null;const c=yield t(g(r,Object.assign(Object.assign({},i),{limit:n,page_token:o}),a)),u=c.data[e]||[];for(const e of u)yield yield t(e);if(s+=u.length,o=c.data.next_page_token,!o)break}})}function C(e,r,i,a,o){return n(this,arguments,function*(){var n;let s=null,l=0;const u=a.pageLimit?Math.min(a.pageLimit,c):c;for(delete a.pageLimit,a.limit=null!==(n=a.limit)&&void 0!==n?n:0;a.limit>l||0===a.limit;){const n=y(a.limit,u,l);if(-1==n)break;const c=Object.assign(Object.assign({},a),{symbols:e.join(","),limit:n,page_token:s}),d=yield t(g(`${r}${i}`,c,o)),p=d.data[i];for(const e in p)for(const n of p[e])l++,yield yield t({symbol:e,data:n});if(s=d.data.next_page_token,!s)break}})}function A(e,i,a){return n(this,arguments,function*(){var n,o,c,l;const u=C(e,"/v2/stocks/",p.TRADES,i,a);try{for(var d,h=!0,f=r(u);!(n=(d=yield t(f.next())).done);h=!0){l=d.value,h=!1;const e=l;e.data=Object.assign(Object.assign({},e.data),{S:e.symbol}),yield yield t((0,s.AlpacaTradeV2)(e.data))}}catch(m){o={error:m}}finally{try{h||n||!(c=f.return)||(yield t(c.call(f)))}finally{if(o)throw o.error}}})}function S(e,i,a){return n(this,arguments,function*(){var n,o,c,l;const u=C(e,"/v2/stocks/",p.QUOTES,i,a);try{for(var d,h=!0,f=r(u);!(n=(d=yield t(f.next())).done);h=!0){l=d.value,h=!1;const e=l;e.data=Object.assign(Object.assign({},e.data),{S:e.symbol}),yield yield t((0,s.AlpacaQuoteV2)(e.data))}}catch(m){o={error:m}}finally{try{h||n||!(c=f.return)||(yield t(c.call(f)))}finally{if(o)throw o.error}}})}function b(e,i,a){return n(this,arguments,function*(){var n,o,c,l;const u=C(e,"/v2/stocks/",p.BARS,i,a);try{for(var d,h=!0,f=r(u);!(n=(d=yield t(f.next())).done);h=!0){l=d.value,h=!1;const e=l;e.data=Object.assign(Object.assign({},e.data),{S:e.symbol}),yield yield t((0,s.AlpacaBarV2)(e.data))}}catch(m){o={error:m}}finally{try{h||n||!(c=f.return)||(yield t(c.call(f)))}finally{if(o)throw o.error}}})}function T(e,i,a){return n(this,arguments,function*(){var n,o,c,l;const u=C(e,"/v1beta1/options/",p.BARS,i,a);try{for(var d,h=!0,f=r(u);!(n=(d=yield t(f.next())).done);h=!0){l=d.value,h=!1;const e=l;e.data=Object.assign(Object.assign({},e.data),{S:e.symbol}),yield yield t((0,s.AlpacaOptionBarV1Beta1)(e.data))}}catch(m){o={error:m}}finally{try{h||n||!(c=f.return)||(yield t(c.call(f)))}finally{if(o)throw o.error}}})}function v(e,i,a){return n(this,arguments,function*(){var n,o,c,l;const u=C(e,"/v1beta1/options/",p.TRADES,i,a);try{for(var d,h=!0,f=r(u);!(n=(d=yield t(f.next())).done);h=!0){l=d.value,h=!1;const e=l;e.data=Object.assign(Object.assign({},e.data),{S:e.symbol}),yield yield t((0,s.AlpacaOptionTradeV1Beta1)(e.data))}}catch(m){o={error:m}}finally{try{h||n||!(c=f.return)||(yield t(c.call(f)))}finally{if(o)throw o.error}}})}return(d=u||(Qa.Adjustment=u={})).RAW="raw",d.DIVIDEND="dividend",d.SPLIT="split",d.ALL="all",(h=p||(Qa.TYPE=p={})).TRADES="trades",h.QUOTES="quotes",h.BARS="bars",h.SNAPSHOTS="snapshots",Qa.dataV2HttpRequest=g,Qa.getDataV2=I,Qa.getMultiDataV2=C,Qa.getTrades=function(e,i,a){return n(this,arguments,function*(){var n,o,c,l;const u=I(p.TRADES,`/v2/stocks/${e}/${p.TRADES}`,i,a);try{for(var d,h=!0,f=r(u);!(n=(d=yield t(f.next())).done);h=!0){l=d.value,h=!1;const e=l;yield yield t((0,s.AlpacaTradeV2)(e))}}catch(m){o={error:m}}finally{try{h||n||!(c=f.return)||(yield t(c.call(f)))}finally{if(o)throw o.error}}})},Qa.getMultiTrades=function(t,n,i){return e(this,void 0,void 0,function*(){var e,a,o,s;const c=A(t,n,i),l=new Map;try{for(var u,d=!0,p=r(c);!(e=(u=yield p.next()).done);d=!0){s=u.value,d=!1;const e=s,t=l.get(e.Symbol)||new Array;l.set(e.Symbol,[...t,e])}}catch(h){a={error:h}}finally{try{d||e||!(o=p.return)||(yield o.call(p))}finally{if(a)throw a.error}}return l})},Qa.getMultiTradesAsync=A,Qa.getQuotes=function(e,i,a){return n(this,arguments,function*(){var n,o,c,l;const u=I(p.QUOTES,`/v2/stocks/${e}/${p.QUOTES}`,i,a);try{for(var d,h=!0,f=r(u);!(n=(d=yield t(f.next())).done);h=!0){l=d.value,h=!1;const e=l;yield yield t((0,s.AlpacaQuoteV2)(e))}}catch(m){o={error:m}}finally{try{h||n||!(c=f.return)||(yield t(c.call(f)))}finally{if(o)throw o.error}}})},Qa.getMultiQuotes=function(t,n,i){return e(this,void 0,void 0,function*(){var e,a,o,s;const c=S(t,n,i),l=new Map;try{for(var u,d=!0,p=r(c);!(e=(u=yield p.next()).done);d=!0){s=u.value,d=!1;const e=s,t=l.get(e.Symbol)||new Array;l.set(e.Symbol,[...t,e])}}catch(h){a={error:h}}finally{try{d||e||!(o=p.return)||(yield o.call(p))}finally{if(a)throw a.error}}return l})},Qa.getMultiQuotesAsync=S,Qa.getBars=function(e,i,a){return n(this,arguments,function*(){var n,o,c,l;const u=I(p.BARS,`/v2/stocks/${e}/${p.BARS}`,i,a);try{for(var d,h=!0,f=r(u||[]);!(n=(d=yield t(f.next())).done);h=!0){l=d.value,h=!1;const e=l;yield yield t((0,s.AlpacaBarV2)(e))}}catch(m){o={error:m}}finally{try{h||n||!(c=f.return)||(yield t(c.call(f)))}finally{if(o)throw o.error}}})},Qa.getMultiBars=function(t,n,i){return e(this,void 0,void 0,function*(){var e,a,o,s;const c=b(t,n,i),l=new Map;try{for(var u,d=!0,p=r(c);!(e=(u=yield p.next()).done);d=!0){s=u.value,d=!1;const e=s,t=l.get(e.Symbol)||new Array;l.set(e.Symbol,[...t,e])}}catch(h){a={error:h}}finally{try{d||e||!(o=p.return)||(yield o.call(p))}finally{if(a)throw a.error}}return l})},Qa.getMultiBarsAsync=b,Qa.getLatestTrade=function(t,n){return e(this,void 0,void 0,function*(){const e=yield g(`/v2/stocks/${t}/trades/latest`,{},n);return(0,s.AlpacaTradeV2)(e.data.trade)})},Qa.getLatestTrades=function(t,n){return e(this,void 0,void 0,function*(){const e=(yield g(`/v2/stocks/${p.TRADES}/latest`,{symbols:t.join(",")},n)).data.trades,r=new Map;for(const t in e)r.set(t,(0,s.AlpacaTradeV2)(Object.assign({S:t},e[t])));return r})},Qa.getLatestQuote=function(t,n){return e(this,void 0,void 0,function*(){const e=yield g(`/v2/stocks/${t}/quotes/latest`,{},n);return(0,s.AlpacaQuoteV2)(e.data.quote)})},Qa.getLatestQuotes=function(t,n){return e(this,void 0,void 0,function*(){const e=(yield g(`/v2/stocks/${p.QUOTES}/latest`,{symbols:t.join(",")},n)).data.quotes,r=new Map;for(const t in e)r.set(t,(0,s.AlpacaQuoteV2)(Object.assign({S:t},e[t])));return r})},Qa.getLatestBar=function(t,n){return e(this,void 0,void 0,function*(){const e=yield g(`/v2/stocks/${t}/bars/latest`,{},n);return(0,s.AlpacaBarV2)(e.data.bar)})},Qa.getLatestBars=function(t,n){return e(this,void 0,void 0,function*(){const e=(yield g(`/v2/stocks/${p.BARS}/latest`,{symbols:t.join(",")},n)).data.bars,r=new Map;for(const t in e)r.set(t,(0,s.AlpacaBarV2)(Object.assign({S:t},e[t])));return r})},Qa.getSnapshot=function(t,n){return e(this,void 0,void 0,function*(){const e=yield g(`/v2/stocks/${t}/snapshot`,{},n);return(0,s.AlpacaSnapshotV2)(e.data)})},Qa.getSnapshots=function(t,n){return e(this,void 0,void 0,function*(){const e=yield g(`/v2/stocks/snapshots?symbols=${t.join(",")}`,{},n);return Object.entries(e.data).map(([e,t])=>(0,s.AlpacaSnapshotV2)(Object.assign({symbol:e},t)))})},Qa.getCryptoTrades=function(t,n,i){return e(this,void 0,void 0,function*(){var e,a,o,c;const l=C(t,"/v1beta3/crypto/us/",p.TRADES,n,i),u=new Map;try{for(var d,h=!0,f=r(l);!(e=(d=yield f.next()).done);h=!0){c=d.value,h=!1;const e=c,t=u.get(e.symbol)||new Array;u.set(e.symbol,[...t,(0,s.AlpacaCryptoTrade)(e.data)])}}catch(m){a={error:m}}finally{try{h||e||!(o=f.return)||(yield o.call(f))}finally{if(a)throw a.error}}return u})},Qa.getCryptoQuotes=function(t,n,i){return e(this,void 0,void 0,function*(){var e,a,o,c;const l=C(t,"/v1beta3/crypto/us/",p.QUOTES,n,i),u=new Map;try{for(var d,h=!0,f=r(l);!(e=(d=yield f.next()).done);h=!0){c=d.value,h=!1;const e=c,t=u.get(e.symbol)||new Array;u.set(e.symbol,[...t,(0,s.AlpacaCryptoQuote)(e.data)])}}catch(m){a={error:m}}finally{try{h||e||!(o=f.return)||(yield o.call(f))}finally{if(a)throw a.error}}return u})},Qa.getCryptoBars=function(t,n,i){return e(this,void 0,void 0,function*(){var e,a,o,c;const l=C(t,"/v1beta3/crypto/us/",p.BARS,n,i),u=new Map;try{for(var d,h=!0,f=r(l);!(e=(d=yield f.next()).done);h=!0){c=d.value,h=!1;const e=c,t=u.get(e.symbol)||new Array;u.set(e.symbol,[...t,(0,s.AlpacaCryptoBar)(e.data)])}}catch(m){a={error:m}}finally{try{h||e||!(o=f.return)||(yield o.call(f))}finally{if(a)throw a.error}}return u})},Qa.getLatestCryptoBars=function(t,n){return e(this,void 0,void 0,function*(){const e={symbols:t.join(",")},r=(yield g("/v1beta3/crypto/us/latest/bars",e,n)).data.bars,i=new Map;for(const t in r){const e=r[t];i.set(t,(0,s.AlpacaCryptoBar)(e))}return i})},Qa.getLatestCryptoTrades=function(t,n){return e(this,void 0,void 0,function*(){const e={symbols:t.join(",")},r=(yield g("/v1beta3/crypto/us/latest/trades",e,n)).data.trades,i=new Map;for(const t in r){const e=r[t];i.set(t,(0,s.AlpacaCryptoTrade)(e))}return i})},Qa.getLatestCryptoQuotes=function(t,n){return e(this,void 0,void 0,function*(){const e={symbols:t.join(",")},r=(yield g("/v1beta3/crypto/us/latest/quotes",e,n)).data.quotes,i=new Map;for(const t in r){const e=r[t];i.set(t,(0,s.AlpacaCryptoQuote)(e))}return i})},Qa.getCryptoSnapshots=function(t,n){return e(this,void 0,void 0,function*(){const e={symbols:t.join(",")},r=(yield g("/v1beta3/crypto/us/snapshots",e,n)).data.snapshots,i=new Map;for(const t in r){const e=r[t];i.set(t,(0,s.AlpacaCryptoSnapshot)(e))}return i})},Qa.getLatestCryptoOrderbooks=function(t,n){return e(this,void 0,void 0,function*(){const e={symbols:t.join(",")},r=(yield g("/v1beta3/crypto/us/latest/orderbooks",e,n)).data.orderbooks,i=new Map;for(const t in r){const e=r[t];i.set(t,(0,s.AlpacaCryptoOrderbook)(e))}return i})},(m=f||(Qa.Sort=f={})).ASC="asc",m.DESC="desc",Qa.getNews=function(t,n){return e(this,void 0,void 0,function*(){var e;if(t.totalLimit&&t.totalLimit<0)throw new Error("negative total limit");if(t.pageLimit&&t.pageLimit<0)throw new Error("negative page limit");let r=null,i=0;const a=(null==t?void 0:t.pageLimit)?Math.min(t.pageLimit,50):50;null==t||delete t.pageLimit;const o=null!==(e=t.totalLimit)&&void 0!==e?e:10,c=[],l=function(e){var t;const n={};return n.symbols=(null===(t=e.symbols)||void 0===t?void 0:t.length)>0?e.symbols.join(","):null,n.start=e.start,n.end=e.end,n.sort=e.sort,n.include_content=e.includeContent,n.exclude_contentless=e.excludeContentless,n}(t);let u;for(;u=y(o,a,i),!(u<1);){const e=yield g("/v1beta1/news",Object.assign(Object.assign({},l),{limit:u,page_token:r}),n);if(e.data.news.forEach(e=>c.push((0,s.AlpacaNews)(e))),i+=e.data.news.length,r=e.data.next_page_token,!r)break}return c})},Qa.getMultiOptionBars=function(t,n,i){return e(this,void 0,void 0,function*(){var e,a,o,s;const c=T(t,n,i),l=new Map;try{for(var u,d=!0,p=r(c);!(e=(u=yield p.next()).done);d=!0){s=u.value,d=!1;const e=s;let t=e.Symbol?e.Symbol:"";delete e.Symbol;const n=l.get(t)||new Array;l.set(t,[...n,e])}}catch(h){a={error:h}}finally{try{d||e||!(o=p.return)||(yield o.call(p))}finally{if(a)throw a.error}}return l})},Qa.getMultiOptionBarsAsync=T,Qa.getMultiOptionTrades=function(t,n,i){return e(this,void 0,void 0,function*(){var e,a,o,s;const c=v(t,n,i),l=new Map;try{for(var u,d=!0,p=r(c);!(e=(u=yield p.next()).done);d=!0){s=u.value,d=!1;const e=s;let t=e.Symbol?e.Symbol:"";delete e.Symbol;const n=l.get(t)||new Array;l.set(t,[...n,e])}}catch(h){a={error:h}}finally{try{d||e||!(o=p.return)||(yield o.call(p))}finally{if(a)throw a.error}}return l})},Qa.getMultiOptionTradesAsync=v,Qa.getLatestOptionTrades=function(t,n){return e(this,void 0,void 0,function*(){const e=(yield g(`/v1beta1/options/${p.TRADES}/latest`,{symbols:t.join(",")},n)).data.trades,r=new Map;for(const t in e)r.set(t,(0,s.AlpacaOptionTradeV1Beta1)(Object.assign({},e[t])));return r})},Qa.getLatestOptionQuotes=function(t,n){return e(this,void 0,void 0,function*(){const e=(yield g(`/v1beta1/options/${p.QUOTES}/latest`,{symbols:t.join(",")},n)).data.quotes,r=new Map;for(const t in e)r.set(t,(0,s.AlpacaOptionQuoteV1Beta1)(Object.assign({},e[t])));return r})},Qa.getOptionSnapshots=function(t,n){return e(this,void 0,void 0,function*(){const e=yield g(`/v1beta1/options/snapshots?symbols=${t.join(",")}`,{},n);return Object.entries(e.data.snapshots).map(([e,t])=>(0,s.AlpacaOptionSnapshotV1Beta1)(Object.assign({Symbol:e},t)))})},Qa.getOptionChain=function(t,n,r){return e(this,void 0,void 0,function*(){var e;if(n.totalLimit&&n.totalLimit<0)throw new Error("negative total limit");if(n.pageLimit&&n.pageLimit<0)throw new Error("negative page limit");let i=null,a=0;const o=(null==n?void 0:n.pageLimit)?Math.min(n.pageLimit,l):l;delete n.pageLimit;const c=null!==(e=null==n?void 0:n.totalLimit)&&void 0!==e?e:1e4;delete n.totalLimit;const u=[];let d;for(;d=y(c,o,a),!(d<1);){const e=yield g(`/v1beta1/options/snapshots/${t}`,Object.assign(Object.assign({},n),{limit:d,page_token:i}),r),o=Object.entries(e.data.snapshots).map(([e,t])=>(0,s.AlpacaOptionSnapshotV1Beta1)(Object.assign({Symbol:e},t)));if(a+=o.length,u.push(...o),i=e.data.next_page_token,!i)break}return u})},Qa.getCorporateActions=function(t,n,r){return e(this,void 0,void 0,function*(){var e,i;if(n.totalLimit&&n.totalLimit<0)throw new Error("negative total limit");if(n.pageLimit&&n.pageLimit<0)throw new Error("negative page limit");let a=null,o=0;const u=(null==n?void 0:n.pageLimit)?Math.min(n.pageLimit,l):l;null==n||delete n.pageLimit;const d=null!==(e=null==n?void 0:n.totalLimit)&&void 0!==e?e:c;delete n.totalLimit;let p={};const h=null===(i=null==n?void 0:n.types)||void 0===i?void 0:i.join(","),f=Object.assign(Object.assign({},n),{symbols:t,types:h});let m;for(;m=y(d,u,o),!(m<1);){const e=yield g("/v1beta1/corporate-actions",Object.assign(Object.assign({},f),{limit:m,page_token:a}),r),t=(0,s.convertCorporateActions)(e.data.corporate_actions);if(p=(0,s.mergeCorporateActions)(p,t),o+=(0,s.getCorporateActionsSize)(t),a=e.data.next_page_token,!a)break}return p})},Qa}var ku,Gu,xu,Hu={},Uu={},Vu={exports:{}};function $u(){if(ku)return Vu.exports;ku=1;var e,t="object"==typeof Reflect?Reflect:null,n=t&&"function"==typeof t.apply?t.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};e=t&&"function"==typeof t.ownKeys?t.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var r=Number.isNaN||function(e){return e!=e};function i(){i.init.call(this)}Vu.exports=i,Vu.exports.once=function(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}f(e,t,a,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&f(e,"error",t,n)}(e,i,{once:!0})})},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var a=10;function o(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function s(e){return void 0===e._maxListeners?i.defaultMaxListeners:e._maxListeners}function c(e,t,n,r){var i,a,c,l;if(o(n),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),a=e._events),c=a[t]),void 0===c)c=a[t]=n,++e._eventsCount;else if("function"==typeof c?c=a[t]=r?[n,c]:[c,n]:r?c.unshift(n):c.push(n),(i=s(e))>0&&c.length>i&&!c.warned){c.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+c.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=c.length,l=u,console&&console.warn&&console.warn(l)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=l.bind(r);return i.listener=n,r.wrapFn=i,i}function d(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):h(i,i.length)}function p(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function h(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function f(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)})}}return Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");a=e}}),i.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},i.prototype.getMaxListeners=function(){return s(this)},i.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,a=this._events;if(void 0!==a)i=i&&void 0===a.error;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var c=a[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var l=c.length,u=h(c,l);for(r=0;r<l;++r)n(u[r],this,t)}return!0},i.prototype.addListener=function(e,t){return c(this,e,t,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(e,t){return c(this,e,t,!0)},i.prototype.once=function(e,t){return o(t),this.on(e,u(this,e,t)),this},i.prototype.prependOnceListener=function(e,t){return o(t),this.prependListener(e,u(this,e,t)),this},i.prototype.removeListener=function(e,t){var n,r,i,a,s;if(o(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){s=n[a].listener,i=a;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,s||t)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,a=Object.keys(n);for(r=0;r<a.length;++r)"removeListener"!==(i=a[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},i.prototype.listeners=function(e){return d(this,e,!0)},i.prototype.rawListeners=function(e){return d(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},i.prototype.listenerCount=p,i.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]},Vu.exports}function ju(){return xu?Gu:(xu=1,Gu=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")})}var Wu,Xu={exports:{}},Ku={},Yu={};function qu(){if(Wu)return Yu;Wu=1,Yu.byteLength=function(e){var t=a(e),n=t[0],r=t[1];return 3*(n+r)/4-r},Yu.toByteArray=function(e){var r,i,o=a(e),s=o[0],c=o[1],l=new n(function(e,t,n){return 3*(t+n)/4-n}(0,s,c)),u=0,d=c>0?s-4:s;for(i=0;i<d;i+=4)r=t[e.charCodeAt(i)]<<18|t[e.charCodeAt(i+1)]<<12|t[e.charCodeAt(i+2)]<<6|t[e.charCodeAt(i+3)],l[u++]=r>>16&255,l[u++]=r>>8&255,l[u++]=255&r;2===c&&(r=t[e.charCodeAt(i)]<<2|t[e.charCodeAt(i+1)]>>4,l[u++]=255&r);1===c&&(r=t[e.charCodeAt(i)]<<10|t[e.charCodeAt(i+1)]<<4|t[e.charCodeAt(i+2)]>>2,l[u++]=r>>8&255,l[u++]=255&r);return l},Yu.fromByteArray=function(t){for(var n,r=t.length,i=r%3,a=[],o=16383,c=0,l=r-i;c<l;c+=o)a.push(s(t,c,c+o>l?l:c+o));1===i?(n=t[r-1],a.push(e[n>>2]+e[n<<4&63]+"==")):2===i&&(n=(t[r-2]<<8)+t[r-1],a.push(e[n>>10]+e[n>>4&63]+e[n<<2&63]+"="));return a.join("")};for(var e=[],t=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0;i<64;++i)e[i]=r[i],t[r.charCodeAt(i)]=i;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function o(t){return e[t>>18&63]+e[t>>12&63]+e[t>>6&63]+e[63&t]}function s(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(o(r));return i.join("")}return t["-".charCodeAt(0)]=62,t["_".charCodeAt(0)]=63,Yu}var Qu,Ju,zu,Zu={};function ed(){return Qu||(Qu=1,Zu.read=function(e,t,n,r,i){var a,o,s=8*i-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,p=n?-1:1,h=e[t+d];for(d+=p,a=h&(1<<-u)-1,h>>=-u,u+=s;u>0;a=256*a+e[t+d],d+=p,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=256*o+e[t+d],d+=p,u-=8);if(0===a)a=1-l;else{if(a===c)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,r),a-=l}return(h?-1:1)*o*Math.pow(2,a-r)},Zu.write=function(e,t,n,r,i,a){var o,s,c,l=8*a-i-1,u=(1<<l)-1,d=u>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:a-1,f=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),(t+=o+d>=1?p/c:p*Math.pow(2,1-d))*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*Math.pow(2,i),o+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;e[n+h]=255&s,h+=f,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+h]=255&o,h+=f,o/=256,l-=8);e[n+h-f]|=128*m}),Zu}function td(){return Ju||(Ju=1,function(e){const t=qu(),n=ed(),r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=function(e){+e!=e&&(e=0);return o.alloc(+e)},e.INSPECT_MAX_BYTES=50;const i=2147483647;function a(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return l(e)}return s(e,t,n)}function s(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|h(e,t);let r=a(n);const i=r.write(e,t);i!==n&&(r=r.slice(0,i));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(K(e,Uint8Array)){const t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return u(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(K(e,ArrayBuffer)||e&&K(e.buffer,ArrayBuffer))return d(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(K(e,SharedArrayBuffer)||e&&K(e.buffer,SharedArrayBuffer)))return d(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return o.from(r,t,n);const i=function(e){if(o.isBuffer(e)){const t=0|p(e.length),n=a(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||Y(e.length)?a(0):u(e);if("Buffer"===e.type&&Array.isArray(e.data))return u(e.data)}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function l(e){return c(e),a(e<0?0:0|p(e))}function u(e){const t=e.length<0?0:0|p(e.length),n=a(t);for(let r=0;r<t;r+=1)n[r]=255&e[r];return n}function d(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,o.prototype),r}function p(e){if(e>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function h(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||K(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return j(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return W(e).length;default:if(i)return r?-1:j(e).length;t=(""+t).toLowerCase(),i=!0}}function f(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return P(this,t,n);case"utf8":case"utf-8":return v(this,t,n);case"ascii":return w(this,t,n);case"latin1":case"binary":return E(this,t,n);case"base64":return T(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Y(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=o.from(t,r)),o.isBuffer(t))return 0===t.length?-1:y(e,t,n,r,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,r,i){let a,o=1,s=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,s/=2,c/=2,n/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){let r=-1;for(a=n;a<s;a++)if(l(e,a)===l(t,-1===r?0:a-r)){if(-1===r&&(r=a),a-r+1===c)return r*o}else-1!==r&&(a-=a-r),r=-1}else for(n+c>s&&(n=s-c),a=n;a>=0;a--){let n=!0;for(let r=0;r<c;r++)if(l(e,a+r)!==l(t,r)){n=!1;break}if(n)return a}return-1}function I(e,t,n,r){n=Number(n)||0;const i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;const a=t.length;let o;for(r>a/2&&(r=a/2),o=0;o<r;++o){const r=parseInt(t.substr(2*o,2),16);if(Y(r))return o;e[n+o]=r}return o}function C(e,t,n,r){return X(j(t,e.length-n),e,n,r)}function A(e,t,n,r){return X(function(e){const t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function S(e,t,n,r){return X(W(t),e,n,r)}function b(e,t,n,r){return X(function(e,t){let n,r,i;const a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}(t,e.length-n),e,n,r)}function T(e,n,r){return 0===n&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function v(e,t,n){n=Math.min(e.length,n);const r=[];let i=t;for(;i<n;){const t=e[i];let a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],128==(192&n)&&(c=(31&t)<<6|63&n,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],128==(192&n)&&128==(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&s,c>65535&&c<1114112&&(a=c))}}null===a?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),i+=o}return function(e){const t=e.length;if(t<=_)return String.fromCharCode.apply(String,e);let n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=_));return n}(r)}e.kMaxLength=i,o.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),o.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(e,t,n){return s(e,t,n)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,n){return function(e,t,n){return c(e),e<=0?a(e):void 0!==t?"string"==typeof n?a(e).fill(t,n):a(e).fill(t):a(e)}(e,t,n)},o.allocUnsafe=function(e){return l(e)},o.allocUnsafeSlow=function(e){return l(e)},o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(K(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),K(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},o.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);let n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const r=o.allocUnsafe(t);let i=0;for(n=0;n<e.length;++n){let t=e[n];if(K(t,Uint8Array))i+t.length>r.length?(o.isBuffer(t)||(t=o.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else{if(!o.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,i)}i+=t.length}return r},o.byteLength=h,o.prototype._isBuffer=!0,o.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)m(this,t,t+1);return this},o.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},o.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},o.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?v(this,0,e):f.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){let t="";const n=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(e,t,n,r,i){if(K(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;let a=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0);const c=Math.min(a,s),l=this.slice(r,i),u=e.slice(t,n);for(let o=0;o<c;++o)if(l[o]!==u[o]){a=l[o],s=u[o];break}return a<s?-1:s<a?1:0},o.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},o.prototype.indexOf=function(e,t,n){return g(this,e,t,n,!0)},o.prototype.lastIndexOf=function(e,t,n){return g(this,e,t,n,!1)},o.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let a=!1;for(;;)switch(r){case"hex":return I(this,e,t,n);case"utf8":case"utf-8":return C(this,e,t,n);case"ascii":case"latin1":case"binary":return A(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const _=4096;function w(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function E(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function P(e,t,n){const r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i="";for(let a=t;a<n;++a)i+=q[e[a]];return i}function R(e,t,n){const r=e.slice(t,n);let i="";for(let a=0;a<r.length-1;a+=2)i+=String.fromCharCode(r[a]+256*r[a+1]);return i}function L(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,n,r,i,a){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function O(e,t,n,r,i){H(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function B(e,t,n,r,i){H(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}function M(e,t,n,r,i,a){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(e,t,r,i,a){return t=+t,r>>>=0,a||M(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function F(e,t,r,i,a){return t=+t,r>>>=0,a||M(e,0,r,8),n.write(e,t,r,i,52,8),r+8}o.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);const r=this.subarray(e,t);return Object.setPrototypeOf(r,o.prototype),r},o.prototype.readUintLE=o.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},o.prototype.readUintBE=o.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},o.prototype.readUint8=o.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readBigUInt64LE=Q(function(e){U(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||V(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),o.prototype.readBigUInt64BE=Q(function(e){U(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||V(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),o.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*t)),r},o.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*t)),a},o.prototype.readInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readBigInt64LE=Q(function(e){U(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||V(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)}),o.prototype.readBigInt64BE=Q(function(e){U(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||V(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+n)}),o.prototype.readFloatLE=function(e,t){return e>>>=0,t||L(e,4,this.length),n.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),n.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),n.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),n.read(this,e,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){N(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=1,a=0;for(this[t]=255&e;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){N(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=n-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},o.prototype.writeUint8=o.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigUInt64LE=Q(function(e,t=0){return O(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=Q(function(e,t=0){return B(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);N(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=255&e;++i<n&&(a*=256);)e<0&&0===o&&0!==this[t+i-1]&&(o=1),this[t+i]=(e/a|0)-o&255;return t+n},o.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);N(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===o&&0!==this[t+i+1]&&(o=1),this[t+i]=(e/a|0)-o&255;return t+n},o.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigInt64LE=Q(function(e,t=0){return O(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=Q(function(e,t=0){return B(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeFloatLE=function(e,t,n){return D(this,e,t,!0,n)},o.prototype.writeFloatBE=function(e,t,n){return D(this,e,t,!1,n)},o.prototype.writeDoubleLE=function(e,t,n){return F(this,e,t,!0,n)},o.prototype.writeDoubleBE=function(e,t,n){return F(this,e,t,!1,n)},o.prototype.copy=function(e,t,n,r){if(!o.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);const i=r-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},o.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!o.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){const t=e.charCodeAt(0);("utf8"===r&&t<128||"latin1"===r)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;let i;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i<n;++i)this[i]=e;else{const a=o.isBuffer(e)?e:o.from(e,r),s=a.length;if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-t;++i)this[i+t]=a[i%s]}return this};const k={};function G(e,t,n){k[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function x(e){let t="",n=e.length;const r="-"===e[0]?1:0;for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function H(e,t,n,r,i,a){if(e>n||e<t){const n="bigint"==typeof t?"n":"";let r;throw r=0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(a+1)}${n}`:`>= -(2${n} ** ${8*(a+1)-1}${n}) and < 2 ** ${8*(a+1)-1}${n}`,new k.ERR_OUT_OF_RANGE("value",r,e)}!function(e,t,n){U(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||V(t,e.length-(n+1))}(r,i,a)}function U(e,t){if("number"!=typeof e)throw new k.ERR_INVALID_ARG_TYPE(t,"number",e)}function V(e,t,n){if(Math.floor(e)!==e)throw U(e,n),new k.ERR_OUT_OF_RANGE("offset","an integer",e);if(t<0)throw new k.ERR_BUFFER_OUT_OF_BOUNDS;throw new k.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${t}`,e)}G("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),G("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),G("ERR_OUT_OF_RANGE",function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=x(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=x(i)),i+="n"),r+=` It must be ${t}. Received ${i}`,r},RangeError);const $=/[^+/0-9A-Za-z-_]/g;function j(e,t){let n;t=t||1/0;const r=e.length;let i=null;const a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function W(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace($,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function X(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function K(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Y(e){return e!=e}const q=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t}();function Q(e){return"undefined"==typeof BigInt?J:e}function J(){throw new Error("BigInt not supported")}}(Ku)),Ku}function nd(){return zu||(zu=1,function(e,t){var n=td(),r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function a(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=n:(i(n,t),t.Buffer=a),a.prototype=Object.create(r.prototype),i(r,a),a.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},a.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=r(e);return void 0!==t?"string"==typeof n?i.fill(t,n):i.fill(t):i.fill(0),i},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}}(Xu,Xu.exports)),Xu.exports}var rd,id,ad,od,sd,cd,ld={exports:{}},ud={exports:{}};function dd(){return id?rd:(id=1,rd=$u().EventEmitter)}function pd(){if(od)return ad;function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function t(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?e(Object(i),!0).forEach(function(e){n(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function n(e,t,n){return(t=i(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function i(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:String(t)}od=1;var a=td().Buffer,o=Ni.inspect,s=o&&o.custom||"inspect";function c(e,t,n){a.prototype.copy.call(e,t,n)}return ad=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return r(e,[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return a.alloc(0);for(var t=a.allocUnsafe(e>>>0),n=this.head,r=0;n;)c(n.data,t,r),r+=n.data.length,n=n.next;return t}},{key:"consume",value:function(e,t){var n;return e<this.head.data.length?(n=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):n=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,n=1,r=t.data;for(e-=r.length;t=t.next;){var i=t.data,a=e>i.length?i.length:e;if(a===i.length?r+=i:r+=i.slice(0,e),0===(e-=a)){a===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(a));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var i=n.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(o));break}++r}return this.length-=r,t}},{key:s,value:function(e,n){return o(this,t(t({},n),{},{depth:0,customInspect:!1}))}}]),e}()}function hd(){if(cd)return sd;function e(e,r){n(e,r),t(e)}function t(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function n(e,t){e.emit("error",t)}return cd=1,sd={destroy:function(r,i){var a=this,o=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return o||s?(i?i(r):r&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(n,this,r)):process.nextTick(n,this,r)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(r||null,function(n){!i&&n?a._writableState?a._writableState.errorEmitted?process.nextTick(t,a):(a._writableState.errorEmitted=!0,process.nextTick(e,a,n)):process.nextTick(e,a,n):i?(process.nextTick(t,a),i(n)):process.nextTick(t,a)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}}}var fd,md,gd,yd={};function Id(){if(fd)return yd;fd=1;var e={};function t(t,n,r){r||(r=Error);var i=function(e){var t,r;function i(t,r,i){return e.call(this,function(e,t,r){return"string"==typeof n?n:n(e,t,r)}(t,r,i))||this}return r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,i}(r);i.prototype.name=r.name,i.prototype.code=t,e[t]=i}function n(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map(function(e){return String(e)}),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}return t("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),t("ERR_INVALID_ARG_TYPE",function(e,t,r){var i,a,o;if("string"==typeof t&&(a="not ",t.substr(0,a.length)===a)?(i="must not be",t=t.replace(/^not /,"")):i="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}(e," argument"))o="The ".concat(e," ").concat(i," ").concat(n(t,"type"));else{var s=function(e,t,n){return"number"!=typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}(e,".")?"property":"argument";o='The "'.concat(e,'" ').concat(s," ").concat(i," ").concat(n(t,"type"))}return o+=". Received type ".concat(typeof r)},TypeError),t("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),t("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),t("ERR_STREAM_PREMATURE_CLOSE","Premature close"),t("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),t("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),t("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),t("ERR_STREAM_WRITE_AFTER_END","write after end"),t("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),t("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),t("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),yd.codes=e,yd}function Cd(){if(gd)return md;gd=1;var e=Id().codes.ERR_INVALID_OPT_VALUE;return md={getHighWaterMark:function(t,n,r,i){var a=function(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}(n,i,r);if(null!=a){if(!isFinite(a)||Math.floor(a)!==a||a<0)throw new e(i?r:"highWaterMark",a);return Math.floor(a)}return t.objectMode?16:16384}}}var Ad,Sd,bd,Td,vd,_d,wd,Ed={exports:{}};function Pd(){return Ad||(Ad=1,"function"==typeof Object.create?Ed.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Ed.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}),Ed.exports}function Rd(){if(bd)return Sd;function e(e){try{if(!Ti.localStorage)return!1}catch(n){return!1}var t=Ti.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}return bd=1,Sd=function(t,n){if(e("noDeprecation"))return t;var r=!1;return function(){if(!r){if(e("throwDeprecation"))throw new Error(n);e("traceDeprecation")?console.trace(n):console.warn(n),r=!0}return t.apply(this,arguments)}},Sd}function Ld(){if(vd)return Td;function e(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;e.entry=null;for(;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree.next=e}(t,e)}}var t;vd=1,Td=S,S.WritableState=A;var n={deprecate:Rd()},r=dd(),i=td().Buffer,a=(void 0!==Ti?Ti:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var o,s=hd(),c=Cd().getHighWaterMark,l=Id().codes,u=l.ERR_INVALID_ARG_TYPE,d=l.ERR_METHOD_NOT_IMPLEMENTED,p=l.ERR_MULTIPLE_CALLBACK,h=l.ERR_STREAM_CANNOT_PIPE,f=l.ERR_STREAM_DESTROYED,m=l.ERR_STREAM_NULL_VALUES,g=l.ERR_STREAM_WRITE_AFTER_END,y=l.ERR_UNKNOWN_ENCODING,I=s.errorOrDestroy;function C(){}function A(n,r,i){t=t||Nd(),n=n||{},"boolean"!=typeof i&&(i=r instanceof t),this.objectMode=!!n.objectMode,i&&(this.objectMode=this.objectMode||!!n.writableObjectMode),this.highWaterMark=c(this,n,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===n.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=n.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if("function"!=typeof i)throw new p;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?(process.nextTick(i,r),process.nextTick(E,e,t),e._writableState.errorEmitted=!0,I(e,r)):(i(r),e._writableState.errorEmitted=!0,I(e,r),E(e,t))}(e,n,r,t,i);else{var a=_(n)||e.destroyed;a||n.corked||n.bufferProcessing||!n.bufferedRequest||v(e,n),r?process.nextTick(T,e,n,a,i):T(e,n,a,i)}}(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==n.emitClose,this.autoDestroy=!!n.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function S(e){var n=this instanceof(t=t||Nd());if(!n&&!o.call(S,this))return new S(e);this._writableState=new A(e,this,n),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),r.call(this)}function b(e,t,n,r,i,a,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new f("write")):n?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function T(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),E(e,t)}function v(t,n){n.bufferProcessing=!0;var r=n.bufferedRequest;if(t._writev&&r&&r.next){var i=n.bufferedRequestCount,a=new Array(i),o=n.corkedRequestsFree;o.entry=r;for(var s=0,c=!0;r;)a[s]=r,r.isBuf||(c=!1),r=r.next,s+=1;a.allBuffers=c,b(t,n,!0,n.length,a,"",o.finish),n.pendingcb++,n.lastBufferedRequest=null,o.next?(n.corkedRequestsFree=o.next,o.next=null):n.corkedRequestsFree=new e(n),n.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,u=r.encoding,d=r.callback;if(b(t,n,!1,n.objectMode?1:l.length,l,u,d),r=r.next,n.bufferedRequestCount--,n.writing)break}null===r&&(n.lastBufferedRequest=null)}n.bufferedRequest=r,n.bufferProcessing=!1}function _(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function w(e,t){e._final(function(n){t.pendingcb--,n&&I(e,n),t.prefinished=!0,e.emit("prefinish"),E(e,t)})}function E(e,t){var n=_(t);if(n&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,process.nextTick(w,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var r=e._readableState;(!r||r.autoDestroy&&r.endEmitted)&&e.destroy()}return n}return Pd()(S,r),A.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(A.prototype,"buffer",{get:n.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(o=Function.prototype[Symbol.hasInstance],Object.defineProperty(S,Symbol.hasInstance,{value:function(e){return!!o.call(this,e)||this===S&&(e&&e._writableState instanceof A)}})):o=function(e){return e instanceof this},S.prototype.pipe=function(){I(this,new h)},S.prototype.write=function(e,t,n){var r,o=this._writableState,s=!1,c=!o.objectMode&&(r=e,i.isBuffer(r)||r instanceof a);return c&&!i.isBuffer(e)&&(e=function(e){return i.from(e)}(e)),"function"==typeof t&&(n=t,t=null),c?t="buffer":t||(t=o.defaultEncoding),"function"!=typeof n&&(n=C),o.ending?function(e,t){var n=new g;I(e,n),process.nextTick(t,n)}(this,n):(c||function(e,t,n,r){var i;return null===n?i=new m:"string"==typeof n||t.objectMode||(i=new u("chunk",["string","Buffer"],n)),!i||(I(e,i),process.nextTick(r,i),!1)}(this,o,e,n))&&(o.pendingcb++,s=function(e,t,n,r,a,o){if(!n){var s=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=i.from(t,n));return t}(t,r,a);r!==s&&(n=!0,a="buffer",r=s)}var c=t.objectMode?1:r.length;t.length+=c;var l=t.length<t.highWaterMark;l||(t.needDrain=!0);if(t.writing||t.corked){var u=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:a,isBuf:n,callback:o,next:null},u?u.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else b(e,t,!1,c,r,a,o);return l}(this,o,c,e,t,n)),s},S.prototype.cork=function(){this._writableState.corked++},S.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||v(this,e))},S.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new y(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(S.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(S.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),S.prototype._write=function(e,t,n){n(new d("_write()"))},S.prototype._writev=null,S.prototype.end=function(e,t,n){var r=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||function(e,t,n){t.ending=!0,E(e,t),n&&(t.finished?process.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n),this},Object.defineProperty(S.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(S.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),S.prototype.destroy=s.destroy,S.prototype._undestroy=s.undestroy,S.prototype._destroy=function(e,t){t(e)},Td}function Nd(){if(wd)return _d;wd=1;var e=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};_d=o;var t=ep(),n=Ld();Pd()(o,t);for(var r=e(n.prototype),i=0;i<r.length;i++){var a=r[i];o.prototype[a]||(o.prototype[a]=n.prototype[a])}function o(e){if(!(this instanceof o))return new o(e);t.call(this,e),n.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",s)))}function s(){this._writableState.ended||process.nextTick(c,this)}function c(e){e.end()}return Object.defineProperty(o.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(o.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(o.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(o.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),_d}var Od,Bd,Md,Dd,Fd,kd,Gd,xd,Hd,Ud,Vd,$d,jd,Wd,Xd,Kd,Yd,qd={},Qd={exports:{}};function Jd(){if(Bd)return qd;Bd=1;var e=(Od||(Od=1,function(e,t){var n=td(),r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function a(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=n:(i(n,t),t.Buffer=a),i(r,a),a.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},a.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=r(e);return void 0!==t?"string"==typeof n?i.fill(t,n):i.fill(t):i.fill(0),i},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}}(Qd,Qd.exports)),Qd.exports).Buffer,t=e.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function n(n){var r;switch(this.encoding=function(n){var r=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(n);if("string"!=typeof r&&(e.isEncoding===t||!t(n)))throw new Error("Unknown encoding: "+n);return r||n}(n),this.encoding){case"utf16le":this.text=a,this.end=o,r=4;break;case"utf8":this.fillLast=i,r=4;break;case"base64":this.text=s,this.end=c,r=3;break;default:return this.write=l,void(this.end=u)}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(r)}function r(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function i(e){var t=this.lastTotal-this.lastNeed,n=function(e,t){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function a(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function o(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function s(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function c(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function l(e){return e.toString(this.encoding)}function u(e){return e&&e.length?this.write(e):""}return qd.StringDecoder=n,n.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},n.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},n.prototype.text=function(e,t){var n=function(e,t,n){var i=t.length-1;if(i<n)return 0;var a=r(t[i]);if(a>=0)return a>0&&(e.lastNeed=a-1),a;if(--i<n||-2===a)return 0;if(a=r(t[i]),a>=0)return a>0&&(e.lastNeed=a-2),a;if(--i<n||-2===a)return 0;if(a=r(t[i]),a>=0)return a>0&&(2===a?a=0:e.lastNeed=a-3),a;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var i=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},n.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length},qd}function zd(){if(Dd)return Md;Dd=1;var e=Id().codes.ERR_STREAM_PREMATURE_CLOSE;function t(){}return Md=function n(r,i,a){if("function"==typeof i)return n(r,null,i);i||(i={}),a=function(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];e.apply(this,r)}}}(a||t);var o=i.readable||!1!==i.readable&&r.readable,s=i.writable||!1!==i.writable&&r.writable,c=function(){r.writable||u()},l=r._writableState&&r._writableState.finished,u=function(){s=!1,l=!0,o||a.call(r)},d=r._readableState&&r._readableState.endEmitted,p=function(){o=!1,d=!0,s||a.call(r)},h=function(e){a.call(r,e)},f=function(){var t;return o&&!d?(r._readableState&&r._readableState.ended||(t=new e),a.call(r,t)):s&&!l?(r._writableState&&r._writableState.ended||(t=new e),a.call(r,t)):void 0},m=function(){r.req.on("finish",u)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(r)?s&&!r._writableState&&(r.on("end",c),r.on("close",c)):(r.on("complete",u),r.on("abort",f),r.req?m():r.on("request",m)),r.on("end",p),r.on("finish",u),!1!==i.error&&r.on("error",h),r.on("close",f),function(){r.removeListener("complete",u),r.removeListener("abort",f),r.removeListener("request",m),r.req&&r.req.removeListener("finish",u),r.removeListener("end",c),r.removeListener("close",c),r.removeListener("finish",u),r.removeListener("end",p),r.removeListener("error",h),r.removeListener("close",f)}},Md}function Zd(){if(kd)return Fd;var e;function t(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}kd=1;var n=zd(),r=Symbol("lastResolve"),i=Symbol("lastReject"),a=Symbol("error"),o=Symbol("ended"),s=Symbol("lastPromise"),c=Symbol("handlePromise"),l=Symbol("stream");function u(e,t){return{value:e,done:t}}function d(e){var t=e[r];if(null!==t){var n=e[l].read();null!==n&&(e[s]=null,e[r]=null,e[i]=null,t(u(n,!1)))}}function p(e){process.nextTick(d,e)}var h=Object.getPrototypeOf(function(){}),f=Object.setPrototypeOf((t(e={get stream(){return this[l]},next:function(){var e=this,t=this[a];if(null!==t)return Promise.reject(t);if(this[o])return Promise.resolve(u(void 0,!0));if(this[l].destroyed)return new Promise(function(t,n){process.nextTick(function(){e[a]?n(e[a]):t(u(void 0,!0))})});var n,r=this[s];if(r)n=new Promise(function(e,t){return function(n,r){e.then(function(){t[o]?n(u(void 0,!0)):t[c](n,r)},r)}}(r,this));else{var i=this[l].read();if(null!==i)return Promise.resolve(u(i,!1));n=new Promise(this[c])}return this[s]=n,n}},Symbol.asyncIterator,function(){return this}),t(e,"return",function(){var e=this;return new Promise(function(t,n){e[l].destroy(null,function(e){e?n(e):t(u(void 0,!0))})})}),e),h);return Fd=function(e){var d,h=Object.create(f,(t(d={},l,{value:e,writable:!0}),t(d,r,{value:null,writable:!0}),t(d,i,{value:null,writable:!0}),t(d,a,{value:null,writable:!0}),t(d,o,{value:e._readableState.endEmitted,writable:!0}),t(d,c,{value:function(e,t){var n=h[l].read();n?(h[s]=null,h[r]=null,h[i]=null,e(u(n,!1))):(h[r]=e,h[i]=t)},writable:!0}),d));return h[s]=null,n(e,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=h[i];return null!==t&&(h[s]=null,h[r]=null,h[i]=null,t(e)),void(h[a]=e)}var n=h[r];null!==n&&(h[s]=null,h[r]=null,h[i]=null,n(u(void 0,!0))),h[o]=!0}),e.on("readable",p.bind(null,h)),h}}function ep(){if(Ud)return Hd;var e;Ud=1,Hd=S,S.ReadableState=A,$u().EventEmitter;var t=function(e,t){return e.listeners(t).length},n=dd(),r=td().Buffer,i=(void 0!==Ti?Ti:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var a,o=Ni;a=o&&o.debuglog?o.debuglog("stream"):function(){};var s,c,l,u=pd(),d=hd(),p=Cd().getHighWaterMark,h=Id().codes,f=h.ERR_INVALID_ARG_TYPE,m=h.ERR_STREAM_PUSH_AFTER_EOF,g=h.ERR_METHOD_NOT_IMPLEMENTED,y=h.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;Pd()(S,n);var I=d.errorOrDestroy,C=["error","close","destroy","pause","resume"];function A(t,n,r){e=e||Nd(),t=t||{},"boolean"!=typeof r&&(r=n instanceof e),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=p(this,t,"readableHighWaterMark",r),this.buffer=new u,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(s||(s=Jd().StringDecoder),this.decoder=new s(t.encoding),this.encoding=t.encoding)}function S(t){if(e=e||Nd(),!(this instanceof S))return new S(t);var r=this instanceof e;this._readableState=new A(t,this,r),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),n.call(this)}function b(e,t,n,o,s){a("readableAddChunk",t);var c,l=e._readableState;if(null===t)l.reading=!1,function(e,t){if(a("onEofChunk"),t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?w(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,E(e)))}(e,l);else if(s||(c=function(e,t){var n;a=t,r.isBuffer(a)||a instanceof i||"string"==typeof t||void 0===t||e.objectMode||(n=new f("chunk",["string","Buffer","Uint8Array"],t));var a;return n}(l,t)),c)I(e,c);else if(l.objectMode||t&&t.length>0)if("string"==typeof t||l.objectMode||Object.getPrototypeOf(t)===r.prototype||(t=function(e){return r.from(e)}(t)),o)l.endEmitted?I(e,new y):T(e,l,t,!0);else if(l.ended)I(e,new m);else{if(l.destroyed)return!1;l.reading=!1,l.decoder&&!n?(t=l.decoder.write(t),l.objectMode||0!==t.length?T(e,l,t,!1):P(e,l)):T(e,l,t,!1)}else o||(l.reading=!1,P(e,l));return!l.ended&&(l.length<l.highWaterMark||0===l.length)}function T(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&w(e)),P(e,t)}Object.defineProperty(S.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),S.prototype.destroy=d.destroy,S.prototype._undestroy=d.undestroy,S.prototype._destroy=function(e,t){t(e)},S.prototype.push=function(e,t){var n,i=this._readableState;return i.objectMode?n=!0:"string"==typeof e&&((t=t||i.defaultEncoding)!==i.encoding&&(e=r.from(e,t),t=""),n=!0),b(this,e,t,!1,n)},S.prototype.unshift=function(e){return b(this,e,null,!0,!1)},S.prototype.isPaused=function(){return!1===this._readableState.flowing},S.prototype.setEncoding=function(e){s||(s=Jd().StringDecoder);var t=new s(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,r="";null!==n;)r+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==r&&this._readableState.buffer.push(r),this._readableState.length=r.length,this};var v=1073741824;function _(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=v?e=v:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function w(e){var t=e._readableState;a("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(a("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(E,e))}function E(e){var t=e._readableState;a("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,B(e)}function P(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(R,e,t))}function R(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var n=t.length;if(a("maybeReadMore read 0"),e.read(0),n===t.length)break}t.readingMore=!1}function L(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function N(e){a("readable nexttick read 0"),e.read(0)}function O(e,t){a("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),B(e),t.flowing&&!t.reading&&e.read(0)}function B(e){var t=e._readableState;for(a("flow",t.flowing);t.flowing&&null!==e.read(););}function M(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function D(e){var t=e._readableState;a("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(F,t,e))}function F(e,t){if(a("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}function k(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}return S.prototype.read=function(e){a("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return a("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?D(this):w(this),null;if(0===(e=_(e,t))&&t.ended)return 0===t.length&&D(this),null;var r,i=t.needReadable;return a("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&a("length less than watermark",i=!0),t.ended||t.reading?a("reading or ended",i=!1):i&&(a("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=_(n,t))),null===(r=e>0?M(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&D(this)),null!==r&&this.emit("data",r),r},S.prototype._read=function(e){I(this,new g("_read()"))},S.prototype.pipe=function(e,n){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,a("pipe count=%d opts=%j",i.pipesCount,n);var o=(!n||!1!==n.end)&&e!==process.stdout&&e!==process.stderr?c:m;function s(t,n){a("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,a("cleanup"),e.removeListener("close",h),e.removeListener("finish",f),e.removeListener("drain",l),e.removeListener("error",p),e.removeListener("unpipe",s),r.removeListener("end",c),r.removeListener("end",m),r.removeListener("data",d),u=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||l())}function c(){a("onend"),e.end()}i.endEmitted?process.nextTick(o):r.once("end",o),e.on("unpipe",s);var l=function(e){return function(){var n=e._readableState;a("pipeOnDrain",n.awaitDrain),n.awaitDrain&&n.awaitDrain--,0===n.awaitDrain&&t(e,"data")&&(n.flowing=!0,B(e))}}(r);e.on("drain",l);var u=!1;function d(t){a("ondata");var n=e.write(t);a("dest.write",n),!1===n&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==k(i.pipes,e))&&!u&&(a("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function p(n){a("onerror",n),m(),e.removeListener("error",p),0===t(e,"error")&&I(e,n)}function h(){e.removeListener("finish",f),m()}function f(){a("onfinish"),e.removeListener("close",h),m()}function m(){a("unpipe"),r.unpipe(e)}return r.on("data",d),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",p),e.once("close",h),e.once("finish",f),e.emit("pipe",r),i.flowing||(a("pipe resume"),r.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a<i;a++)r[a].emit("unpipe",this,{hasUnpiped:!1});return this}var o=k(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n)),this},S.prototype.on=function(e,t){var r=n.prototype.on.call(this,e,t),i=this._readableState;return"data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,a("on readable",i.length,i.reading),i.length?w(this):i.reading||process.nextTick(N,this))),r},S.prototype.addListener=S.prototype.on,S.prototype.removeListener=function(e,t){var r=n.prototype.removeListener.call(this,e,t);return"readable"===e&&process.nextTick(L,this),r},S.prototype.removeAllListeners=function(e){var t=n.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||process.nextTick(L,this),t},S.prototype.resume=function(){var e=this._readableState;return e.flowing||(a("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(O,e,t))}(this,e)),e.paused=!1,this},S.prototype.pause=function(){return a("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(a("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},S.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",function(){if(a("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(i){(a("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i)||(n.objectMode||i&&i.length)&&(t.push(i)||(r=!0,e.pause()))}),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o<C.length;o++)e.on(C[o],this.emit.bind(this,C[o]));return this._read=function(t){a("wrapped _read",t),r&&(r=!1,e.resume())},this},"function"==typeof Symbol&&(S.prototype[Symbol.asyncIterator]=function(){return void 0===c&&(c=Zd()),c(this)}),Object.defineProperty(S.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(S.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(S.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),S._fromList=M,Object.defineProperty(S.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(S.from=function(e,t){return void 0===l&&(l=xd?Gd:(xd=1,Gd=function(){throw new Error("Readable.from is not available in the browser")})),l(S,e,t)}),Hd}function tp(){if($d)return Vd;$d=1,Vd=s;var e=Id().codes,t=e.ERR_METHOD_NOT_IMPLEMENTED,n=e.ERR_MULTIPLE_CALLBACK,r=e.ERR_TRANSFORM_ALREADY_TRANSFORMING,i=e.ERR_TRANSFORM_WITH_LENGTH_0,a=Nd();function o(e,t){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(null===i)return this.emit("error",new n);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),i(e);var a=this._readableState;a.reading=!1,(a.needReadable||a.length<a.highWaterMark)&&this._read(a.highWaterMark)}function s(e){if(!(this instanceof s))return new s(e);a.call(this,e),this._transformState={afterTransform:o.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",c)}function c(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?l(this,null,null):this._flush(function(t,n){l(e,t,n)})}function l(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new i;if(e._transformState.transforming)throw new r;return e.push(null)}return Pd()(s,a),s.prototype.push=function(e,t){return this._transformState.needTransform=!1,a.prototype.push.call(this,e,t)},s.prototype._transform=function(e,n,r){r(new t("_transform()"))},s.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},s.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},s.prototype._destroy=function(e,t){a.prototype._destroy.call(this,e,function(e){t(e)})},Vd}function np(){if(Kd)return Xd;var e;Kd=1;var t=Id().codes,n=t.ERR_MISSING_ARGS,r=t.ERR_STREAM_DESTROYED;function i(e){if(e)throw e}function a(e){e()}function o(e,t){return e.pipe(t)}return Xd=function(){for(var t=arguments.length,s=new Array(t),c=0;c<t;c++)s[c]=arguments[c];var l,u=function(e){return e.length?"function"!=typeof e[e.length-1]?i:e.pop():i}(s);if(Array.isArray(s[0])&&(s=s[0]),s.length<2)throw new n("streams");var d=s.map(function(t,n){var i=n<s.length-1;return function(t,n,i,a){a=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(a);var o=!1;t.on("close",function(){o=!0}),void 0===e&&(e=zd()),e(t,{readable:n,writable:i},function(e){if(e)return a(e);o=!0,a()});var s=!1;return function(e){if(!o&&!s)return s=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void a(e||new r("pipe"))}}(t,i,n>0,function(e){l||(l=e),e&&d.forEach(a),i||(d.forEach(a),u(l))})});return s.reduce(o)},Xd}function rp(){return Yd||(Yd=1,e=ud.exports,(e=ud.exports=ep()).Stream=e,e.Readable=e,e.Writable=Ld(),e.Duplex=Nd(),e.Transform=tp(),e.PassThrough=function(){if(Wd)return jd;Wd=1,jd=t;var e=tp();function t(n){if(!(this instanceof t))return new t(n);e.call(this,n)}return Pd()(t,e),t.prototype._transform=function(e,t,n){n(null,e)},jd}(),e.finished=zd(),e.pipeline=np()),ud.exports;var e}var ip,ap,op,sp,cp={};function lp(){return ip||(ip=1,function(e){var t=qu(),n=ed(),r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=function(e){+e!=e&&(e=0);return o.alloc(+e)},e.INSPECT_MAX_BYTES=50;var i=2147483647;function a(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return l(e)}return s(e,t,n)}function s(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var n=0|h(e,t),r=a(n),i=r.write(e,t);i!==n&&(r=r.slice(0,i));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(x(e,Uint8Array)){var t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return u(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(x(e,ArrayBuffer)||e&&x(e.buffer,ArrayBuffer))return d(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(x(e,SharedArrayBuffer)||e&&x(e.buffer,SharedArrayBuffer)))return d(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return o.from(r,t,n);var i=function(e){if(o.isBuffer(e)){var t=0|p(e.length),n=a(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||H(e.length)?a(0):u(e);if("Buffer"===e.type&&Array.isArray(e.data))return u(e.data)}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function l(e){return c(e),a(e<0?0:0|p(e))}function u(e){for(var t=e.length<0?0:0|p(e.length),n=a(t),r=0;r<t;r+=1)n[r]=255&e[r];return n}function d(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');var r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,o.prototype),r}function p(e){if(e>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function h(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||x(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return F(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return k(e).length;default:if(i)return r?-1:F(e).length;t=(""+t).toLowerCase(),i=!0}}function f(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return P(this,t,n);case"utf8":case"utf-8":return v(this,t,n);case"ascii":return w(this,t,n);case"latin1":case"binary":return E(this,t,n);case"base64":return T(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),H(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=o.from(t,r)),o.isBuffer(t))return 0===t.length?-1:y(e,t,n,r,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,r,i){var a,o=1,s=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,s/=2,c/=2,n/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var u=-1;for(a=n;a<s;a++)if(l(e,a)===l(t,-1===u?0:a-u)){if(-1===u&&(u=a),a-u+1===c)return u*o}else-1!==u&&(a-=a-u),u=-1}else for(n+c>s&&(n=s-c),a=n;a>=0;a--){for(var d=!0,p=0;p<c;p++)if(l(e,a+p)!==l(t,p)){d=!1;break}if(d)return a}return-1}function I(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var a=t.length;r>a/2&&(r=a/2);for(var o=0;o<r;++o){var s=parseInt(t.substr(2*o,2),16);if(H(s))return o;e[n+o]=s}return o}function C(e,t,n,r){return G(F(t,e.length-n),e,n,r)}function A(e,t,n,r){return G(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function S(e,t,n,r){return G(k(t),e,n,r)}function b(e,t,n,r){return G(function(e,t){for(var n,r,i,a=[],o=0;o<e.length&&!((t-=2)<0);++o)r=(n=e.charCodeAt(o))>>8,i=n%256,a.push(i),a.push(r);return a}(t,e.length-n),e,n,r)}function T(e,n,r){return 0===n&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function v(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var a,o,s,c,l=e[i],u=null,d=l>239?4:l>223?3:l>191?2:1;if(i+d<=n)switch(d){case 1:l<128&&(u=l);break;case 2:128==(192&(a=e[i+1]))&&(c=(31&l)<<6|63&a)>127&&(u=c);break;case 3:a=e[i+1],o=e[i+2],128==(192&a)&&128==(192&o)&&(c=(15&l)<<12|(63&a)<<6|63&o)>2047&&(c<55296||c>57343)&&(u=c);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(c=(15&l)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&c<1114112&&(u=c)}null===u?(u=65533,d=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),i+=d}return function(e){var t=e.length;if(t<=_)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=_));return n}(r)}e.kMaxLength=i,o.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(n){return!1}}(),o.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(e,t,n){return s(e,t,n)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,n){return function(e,t,n){return c(e),e<=0?a(e):void 0!==t?"string"==typeof n?a(e).fill(t,n):a(e).fill(t):a(e)}(e,t,n)},o.allocUnsafe=function(e){return l(e)},o.allocUnsafeSlow=function(e){return l(e)},o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(x(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),x(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var n=e.length,r=t.length,i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},o.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=o.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var a=e[n];if(x(a,Uint8Array))i+a.length>r.length?o.from(a).copy(r,i):Uint8Array.prototype.set.call(r,a,i);else{if(!o.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(r,i)}i+=a.length}return r},o.byteLength=h,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)m(this,t,t+1);return this},o.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},o.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},o.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?v(this,0,e):f.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(e,t,n,r,i){if(x(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),c=Math.min(a,s),l=this.slice(r,i),u=e.slice(t,n),d=0;d<c;++d)if(l[d]!==u[d]){a=l[d],s=u[d];break}return a<s?-1:s<a?1:0},o.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},o.prototype.indexOf=function(e,t,n){return g(this,e,t,n,!0)},o.prototype.lastIndexOf=function(e,t,n){return g(this,e,t,n,!1)},o.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var a=!1;;)switch(r){case"hex":return I(this,e,t,n);case"utf8":case"utf-8":return C(this,e,t,n);case"ascii":case"latin1":case"binary":return A(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var _=4096;function w(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function E(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function P(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",a=t;a<n;++a)i+=U[e[a]];return i}function R(e,t,n){for(var r=e.slice(t,n),i="",a=0;a<r.length-1;a+=2)i+=String.fromCharCode(r[a]+256*r[a+1]);return i}function L(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,n,r,i,a){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function O(e,t,n,r,i,a){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function B(e,t,r,i,a){return t=+t,r>>>=0,a||O(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function M(e,t,r,i,a){return t=+t,r>>>=0,a||O(e,0,r,8),n.write(e,t,r,i,52,8),r+8}o.prototype.slice=function(e,t){var n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);var r=this.subarray(e,t);return Object.setPrototypeOf(r,o.prototype),r},o.prototype.readUintLE=o.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return r},o.prototype.readUintBE=o.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},o.prototype.readUint8=o.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},o.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);for(var r=t,i=1,a=this[e+--r];r>0&&(i*=256);)a+=this[e+--r]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},o.prototype.readInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return e>>>=0,t||L(e,4,this.length),n.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),n.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),n.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),n.read(this,e,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t>>>=0,n>>>=0,r)||N(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,a=0;for(this[t]=255&e;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t>>>=0,n>>>=0,r)||N(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},o.prototype.writeUint8=o.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);N(this,e,t,n,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a<n&&(o*=256);)e<0&&0===s&&0!==this[t+a-1]&&(s=1),this[t+a]=(e/o|0)-s&255;return t+n},o.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);N(this,e,t,n,i-1,-i)}var a=n-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o|0)-s&255;return t+n},o.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeFloatLE=function(e,t,n){return B(this,e,t,!0,n)},o.prototype.writeFloatBE=function(e,t,n){return B(this,e,t,!1,n)},o.prototype.writeDoubleLE=function(e,t,n){return M(this,e,t,!0,n)},o.prototype.writeDoubleBE=function(e,t,n){return M(this,e,t,!1,n)},o.prototype.copy=function(e,t,n,r){if(!o.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i=r-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},o.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!o.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){var i=e.charCodeAt(0);("utf8"===r&&i<128||"latin1"===r)&&(e=i)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var a;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(a=t;a<n;++a)this[a]=e;else{var s=o.isBuffer(e)?e:o.from(e,r),c=s.length;if(0===c)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(a=0;a<n-t;++a)this[a+t]=s[a%c]}return this};var D=/[^+/0-9A-Za-z-_]/g;function F(e,t){var n;t=t||1/0;for(var r=e.length,i=null,a=[],o=0;o<r;++o){if((n=e.charCodeAt(o))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function k(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(D,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function G(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function x(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function H(e){return e!=e}var U=function(){for(var e="0123456789abcdef",t=new Array(256),n=0;n<16;++n)for(var r=16*n,i=0;i<16;++i)t[r+i]=e[n]+e[i];return t}()}(cp)),cp}function up(){if(sp)return ld.exports;sp=1;const e=rp().Duplex,t=Pd(),n=function(){if(op)return ap;op=1;const{Buffer:e}=lp(),t=Symbol.for("BufferList");function n(e){if(!(this instanceof n))return new n(e);n._init.call(this,e)}return n._init=function(e){Object.defineProperty(this,t,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)},n.prototype._new=function(e){return new n(e)},n.prototype._offset=function(e){if(0===e)return[0,0];let t=0;for(let n=0;n<this._bufs.length;n++){const r=t+this._bufs[n].length;if(e<r||n===this._bufs.length-1)return[n,e-t];t=r}},n.prototype._reverseOffset=function(e){const t=e[0];let n=e[1];for(let r=0;r<t;r++)n+=this._bufs[r].length;return n},n.prototype.get=function(e){if(e>this.length||e<0)return;const t=this._offset(e);return this._bufs[t[0]][t[1]]},n.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},n.prototype.copy=function(t,n,r,i){if(("number"!=typeof r||r<0)&&(r=0),("number"!=typeof i||i>this.length)&&(i=this.length),r>=this.length)return t||e.alloc(0);if(i<=0)return t||e.alloc(0);const a=!!t,o=this._offset(r),s=i-r;let c=s,l=a&&n||0,u=o[1];if(0===r&&i===this.length){if(!a)return 1===this._bufs.length?this._bufs[0]:e.concat(this._bufs,this.length);for(let e=0;e<this._bufs.length;e++)this._bufs[e].copy(t,l),l+=this._bufs[e].length;return t}if(c<=this._bufs[o[0]].length-u)return a?this._bufs[o[0]].copy(t,n,u,u+c):this._bufs[o[0]].slice(u,u+c);a||(t=e.allocUnsafe(s));for(let e=o[0];e<this._bufs.length;e++){const n=this._bufs[e].length-u;if(!(c>n)){this._bufs[e].copy(t,l,u,u+c),l+=n;break}this._bufs[e].copy(t,l,u),l+=n,c-=n,u&&(u=0)}return t.length>l?t.slice(0,l):t},n.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!=typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return this._new();const n=this._offset(e),r=this._offset(t),i=this._bufs.slice(n[0],r[0]+1);return 0===r[1]?i.pop():i[i.length-1]=i[i.length-1].slice(0,r[1]),0!==n[1]&&(i[0]=i[0].slice(n[1])),this._new(i)},n.prototype.toString=function(e,t,n){return this.slice(t,n).toString(e)},n.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},n.prototype.duplicate=function(){const e=this._new();for(let t=0;t<this._bufs.length;t++)e.append(this._bufs[t]);return e},n.prototype.append=function(t){if(null==t)return this;if(t.buffer)this._appendBuffer(e.from(t.buffer,t.byteOffset,t.byteLength));else if(Array.isArray(t))for(let e=0;e<t.length;e++)this.append(t[e]);else if(this._isBufferList(t))for(let e=0;e<t._bufs.length;e++)this.append(t._bufs[e]);else"number"==typeof t&&(t=t.toString()),this._appendBuffer(e.from(t));return this},n.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length},n.prototype.indexOf=function(t,n,r){if(void 0===r&&"string"==typeof n&&(r=n,n=void 0),"function"==typeof t||Array.isArray(t))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if("number"==typeof t?t=e.from([t]):"string"==typeof t?t=e.from(t,r):this._isBufferList(t)?t=t.slice():Array.isArray(t.buffer)?t=e.from(t.buffer,t.byteOffset,t.byteLength):e.isBuffer(t)||(t=e.from(t)),n=Number(n||0),isNaN(n)&&(n=0),n<0&&(n=this.length+n),n<0&&(n=0),0===t.length)return n>this.length?this.length:n;const i=this._offset(n);let a=i[0],o=i[1];for(;a<this._bufs.length;a++){const e=this._bufs[a];for(;o<e.length;)if(e.length-o>=t.length){const n=e.indexOf(t,o);if(-1!==n)return this._reverseOffset([a,n]);o=e.length-t.length+1}else{const e=this._reverseOffset([a,o]);if(this._match(e,t))return e;o++}o=0}return-1},n.prototype._match=function(e,t){if(this.length-e<t.length)return!1;for(let n=0;n<t.length;n++)if(this.get(e+n)!==t[n])return!1;return!0},function(){const e={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const t in e)(function(t){n.prototype[t]=null===e[t]?function(e,n){return this.slice(e,e+n)[t](0,n)}:function(n=0){return this.slice(n,n+e[t])[t](0)}})(t)}(),n.prototype._isBufferList=function(e){return e instanceof n||n.isBufferList(e)},n.isBufferList=function(e){return null!=e&&e[t]},ap=n}();function r(t){if(!(this instanceof r))return new r(t);if("function"==typeof t){this._callback=t;const e=function(e){this._callback&&(this._callback(e),this._callback=null)}.bind(this);this.on("pipe",function(t){t.on("error",e)}),this.on("unpipe",function(t){t.removeListener("error",e)}),t=null}n._init.call(this,t),e.call(this)}return t(r,e),Object.assign(r.prototype,n.prototype),r.prototype._new=function(e){return new r(e)},r.prototype._write=function(e,t,n){this._appendBuffer(e),"function"==typeof n&&n()},r.prototype._read=function(e){if(!this.length)return this.push(null);e=Math.min(e,this.length),this.push(this.slice(0,e)),this.consume(e)},r.prototype.end=function(t){e.prototype.end.call(this,t),this._callback&&(this._callback(null,this.slice()),this._callback=null)},r.prototype._destroy=function(e,t){this._bufs.length=0,this.length=0,t(e)},r.prototype._isBufferList=function(e){return e instanceof r||e instanceof n||r.isBufferList(e)},r.isBufferList=n.isBufferList,ld.exports=r,ld.exports.BufferListStream=r,ld.exports.BufferList=n,ld.exports}var dp,pp={};var hp,fp,mp,gp,yp,Ip,Cp,Ap,Sp,bp,Tp,vp={};function _p(){if(hp)return vp;hp=1;const e=Ni;function t(e){Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message=e||"unable to decode"}return vp.IncompleteBufferError=t,e.inherits(t,Error),vp.isFloat=function(e){return e%1!=0},vp}function wp(){if(mp)return fp;mp=1;const e=up(),t=_p().IncompleteBufferError,n={196:2,197:3,198:5,199:3,200:4,201:6,202:5,203:9,204:2,205:3,206:5,207:9,208:2,209:3,210:5,211:9,212:3,213:4,214:6,215:10,216:18,217:2,218:3,219:5,222:3,220:3,221:5};function r(e,t,n){return t>=n+e}function i(e,t,n,r,i){let a=t;const s=[];let c=0;for(;c++<n;){const t=o(e,a,i);if(!t)return null;s.push(t[0]),a+=t[1]}return[s,r+a-t]}function a(e,t,n,r,a){const o=i(e,t,2*n,r,a);if(!o)return null;const[s,c]=o;let l=!a.options.preferMap;if(l)for(let i=0;i<2*n;i+=2)if("string"!=typeof s[i]){l=!1;break}if(l){const e={};for(let t=0;t<2*n;t+=2){const n=s[t],r=s[t+1];if("__proto__"===n){if("error"===a.options.protoAction)throw new SyntaxError("Object contains forbidden prototype property");if("remove"===a.options.protoAction)continue}e[n]=r}return[e,c]}{const e=new Map;for(let t=0;t<2*n;t+=2){const n=s[t],r=s[t+1];e.set(n,r)}return[e,c]}}function o(e,t,o){if(e.length<=t)return null;const c=e.length-t;let l=t;const u=e.readUInt8(l);l+=1;const d=n[u]||-1;if(c<d)return null;if(u<128)return[u,1];if(128==(240&u)){return a(e,l,15&u,l-t,o)}if(144==(240&u)){return i(e,l,15&u,l-t,o)}if(160==(224&u)){const t=31&u;if(!r(t,c,1))return null;return[e.toString("utf8",l,l+t),t+1]}if(u>=192&&u<=195)return function(e){if(192===e)return[null,1];if(194===e)return[!1,1];if(195===e)return[!0,1]}(u);if(u>=196&&u<=198){const t=e.readUIntBE(l,d-1);if(l+=d-1,!r(t,c,d))return null;return[e.slice(l,l+t),d+t]}if(u>=199&&u<=201){const t=e.readUIntBE(l,d-2);l+=d-2;const n=e.readInt8(l);return l+=1,r(t,c,d)?s(e,l,n,t,d,o):null}if(u>=202&&u<=203)return function(e,t,n){let r;4===n&&(r=e.readFloatBE(t));8===n&&(r=e.readDoubleBE(t));return[r,n+1]}(e,l,d-1);if(u>=204&&u<=207)return function(e,t,n){const r=t+n;let i=0;for(;t<r;)i+=e.readUInt8(t++)*Math.pow(256,r-t);return[i,n+1]}(e,l,d-1);if(u>=208&&u<=211)return function(e,t,n){let r;1===n&&(r=e.readInt8(t));2===n&&(r=e.readInt16BE(t));4===n&&(r=e.readInt32BE(t));8===n&&(r=function(e,t){var n=!(128&~e[t]);if(n){let n=1;for(let r=t+7;r>=t;r--){const t=(255^e[r])+n;e[r]=255&t,n=t>>8}}const r=e.readUInt32BE(t+0),i=e.readUInt32BE(t+4);return(4294967296*r+i)*(n?-1:1)}(e.slice(t,t+8),0));return[r,n+1]}(e,l,d-1);if(u>=212&&u<=216){const t=e.readInt8(l);return l+=1,s(e,l,t,d-2,2,o)}if(u>=217&&u<=219){const t=e.readUIntBE(l,d-1);if(l+=d-1,!r(t,c,d))return null;return[e.toString("utf8",l,l+t),d+t]}if(u>=220&&u<=221){const t=e.readUIntBE(l,d-1);return l+=d-1,i(e,l,t,d,o)}if(u>=222&&u<=223){let t;switch(u){case 222:return t=e.readUInt16BE(l),l+=2,a(e,l,t,3,o);case 223:return t=e.readUInt32BE(l),l+=4,a(e,l,t,5,o)}}if(u>=224)return[u-256,1];throw new Error("not implemented yet")}function s(e,t,n,r,i,a){const o=e.slice(t,t+r),s=a.decodingTypes.get(n);if(!s)throw new Error("unable to find ext type "+n);return[s(o),i+r]}return fp=function(n,r){const i={decodingTypes:n,options:r};return function(n){n instanceof e||(n=e().append(n));const r=o(n,0,i);if(!r)throw new t;return n.consume(r[1]),r[0]}}}function Ep(){if(yp)return gp;yp=1;const e=nd().Buffer,t=up(),n=_p().isFloat;function r(e,t,n){const r=n%4294967296,i=Math.floor(n/4294967296);e.writeUInt32BE(i,t+0),e.writeUInt32BE(r,t+4)}gp=function(i,l){function u(d){if(void 0===d)throw new Error("undefined is not encodable in msgpack!");if(null===d)return e.from([192]);if(!0===d)return e.from([195]);if(!1===d)return e.from([194]);if(d instanceof Map)return function(e,n,r){const i=[s(e.size,128,222)],a=[...e.keys()];n.preferMap||a.every(e=>"string"==typeof e)&&console.warn("Map with string only keys will be deserialized as an object!");return a.forEach(t=>{i.push(r(t),r(e.get(t)))}),t(i)}(d,l,u);if("string"==typeof d)return function(t,n){const r=e.byteLength(t);let i;r<32?(i=e.allocUnsafe(1+r),i[0]=160|r,r>0&&i.write(t,1)):r<=255&&!n.compatibilityMode?(i=e.allocUnsafe(2+r),i[0]=217,i[1]=r,i.write(t,2)):r<=65535?(i=e.allocUnsafe(3+r),i[0]=218,i.writeUInt16BE(r,1),i.write(t,3)):(i=e.allocUnsafe(5+r),i[0]=219,i.writeUInt32BE(r,1),i.write(t,5));return i}(d,l);if(d&&(d.readUInt32LE||d instanceof Uint8Array))return d instanceof Uint8Array&&(d=e.from(d)),t([c(d.length),d]);if(Array.isArray(d))return function(e,n){const r=[s(e.length,144,220)];if(e.forEach(e=>{r.push(n(e))}),r.length!==e.length+1)throw new Error("Sparse arrays are not encodable in msgpack");return t(r)}(d,u);if("object"==typeof d)return function(e,n){const r=n.find(t=>t.check(e));if(!r)return null;const i=r.encode(e);return i?t([o(i.length-1),i]):null}(d,i)||function(e,n,r){const i=[];for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&void 0!==e[t]&&"function"!=typeof e[t]&&i.push(t);const a=[s(i.length,128,222)];n.sortKeys&&i.sort();return i.forEach(t=>{a.push(r(t),r(e[t]))}),t(a)}(d,l,u);if("number"==typeof d)return function(t,i){let o;if(n(t))return a(t,i.forceFloat64);if(Math.abs(t)>9007199254740991)return a(t,!0);if(t>=0){if(t<128)return e.from([t]);if(t<256)return e.from([204,t]);if(t<65536)return e.from([205,255&t>>8,255&t]);if(t<=4294967295)return e.from([206,255&t>>24,255&t>>16,255&t>>8,255&t]);t<=9007199254740991&&(o=e.allocUnsafe(9),o[0]=207,r(o,1,t))}else t>=-32?(o=e.allocUnsafe(1),o[0]=256+t):t>=-128?(o=e.allocUnsafe(2),o[0]=208,o.writeInt8(t,1)):t>=-32768?(o=e.allocUnsafe(3),o[0]=209,o.writeInt16BE(t,1)):t>-214748365?(o=e.allocUnsafe(5),o[0]=210,o.writeInt32BE(t,1)):t>=-9007199254740991&&(o=e.allocUnsafe(9),o[0]=211,function(e,t,n){const i=n<0;n=Math.abs(n),r(e,t,n),i&&function(e,t){let n=t+8;for(;n-- >t;)if(0!==e[n]){e[n]=1+(255^e[n]);break}for(;n-- >t;)e[n]=255^e[n]}(e,t)}(o,1,t));return o}(d,l);throw new Error("not implemented yet")}return function(e){return u(e).slice()}};const i=Math.fround;function a(t,n){let r;return!n&&i&&Object.is(i(t),t)?(r=e.allocUnsafe(5),r[0]=202,r.writeFloatBE(t,1)):(r=e.allocUnsafe(9),r[0]=203,r.writeDoubleBE(t,1)),r}function o(t){return 1===t?e.from([212]):2===t?e.from([213]):4===t?e.from([214]):8===t?e.from([215]):16===t?e.from([216]):t<256?e.from([199,t]):t<65536?e.from([200,t>>8,255&t]):e.from([201,t>>24,t>>16&255,t>>8&255,255&t])}function s(t,n,r){if(t<16)return e.from([n|t]);const i=t<65536?2:4,a=e.allocUnsafe(1+i);return a[0]=t<65536?r:r+1,a.writeUIntBE(t,1,i),a}function c(t){let n;return t<=255?(n=e.allocUnsafe(2),n[0]=196,n[1]=t):t<=65535?(n=e.allocUnsafe(3),n[0]=197,n.writeUInt16BE(t,1)):(n=e.allocUnsafe(5),n[0]=198,n.writeUInt32BE(t,1)),n}return gp}function Pp(){if(Sp)return Ap;Sp=1;const e=nd().Buffer,t=Ni,n=up(),r=function(){if(dp)return pp;dp=1;const e=rp().Transform,t=Pd(),n=up();function r(t){(t=t||{}).objectMode=!0,t.highWaterMark=16,e.call(this,t),this._msgpack=t.msgpack}function i(e){if(!(this instanceof i))return(e=e||{}).msgpack=this,new i(e);r.call(this,e),this._wrap="wrap"in e&&e.wrap}function a(e){if(!(this instanceof a))return(e=e||{}).msgpack=this,new a(e);r.call(this,e),this._chunks=n(),this._wrap="wrap"in e&&e.wrap}return t(r,e),t(i,r),i.prototype._transform=function(e,t,n){let r=null;try{r=this._msgpack.encode(this._wrap?e.value:e).slice(0)}catch(i){return this.emit("error",i),n()}this.push(r),n()},t(a,r),a.prototype._transform=function(e,t,n){e&&this._chunks.append(e);try{let e=this._msgpack.decode(this._chunks);this._wrap&&(e={value:e}),this.push(e)}catch(r){return void(r instanceof this._msgpack.IncompleteBufferError?n():this.emit("error",r))}this._chunks.length>0?this._transform(null,t,n):n()},pp.decoder=a,pp.encoder=i,pp}(),i=wp(),a=Ep(),o=_p().IncompleteBufferError,s=Cp?Ip:(Cp=1,Ip={check:function(e){return"function"==typeof e.getDate},type:-1,encode:function(e){if(null===e)return;const t=1*e,n=Math.floor(t/1e3),r=1e6*(t-1e3*n);if(n<0||n>17179869184){const e=Buffer.allocUnsafe(13);e[0]=-1,e.writeUInt32BE(r,1);let t="";if(n>=0){const e="0000000000000000";t=n.toString(16),t=e.slice(0,-1*t.length)+t}else{let e=(-1*n).toString(2),r=e.length-1;for(;"0"===e[r];)r--;e=e.slice(0,r).split("").map(function(e){return"1"===e?0:1}).join("")+e.slice(r,e.length),e="1111111111111111111111111111111111111111111111111111111111111111".slice(0,-1*e.length)+e,e.match(/.{1,8}/g).forEach(function(e){1===(e=parseInt(e,2).toString(16)).length&&(e="0"+e),t+=e})}return e.write(t,5,"hex"),e}if(r||n>4294967295){const e=Buffer.allocUnsafe(9);e[0]=-1;const t=4*r+n/Math.pow(2,32)&4294967295,i=4294967295&n;return e.writeInt32BE(t,1),e.writeInt32BE(i,5),e}{const e=Buffer.allocUnsafe(5);return e[0]=-1,e.writeUInt32BE(Math.floor(t/1e3),1),e}},decode:function(e){let t,n,r,i,a=0;switch(e.length){case 4:t=e.readUInt32BE(0);break;case 8:n=e.readUInt32BE(0),r=e.readUInt32BE(4),a=n/4,t=(3&n)*Math.pow(2,32)+r;break;case 12:if(i=e.toString("hex",4,12),128&parseInt(e.toString("hex",4,6),16)){let e="";const n="00000000";i.match(/.{1,2}/g).forEach(function(t){t=parseInt(t,16).toString(2),t=n.slice(0,-1*t.length)+t,e+=t}),t=-1*parseInt(e.split("").map(function(e){return"1"===e?0:1}).join(""),2)-1}else t=parseInt(i,16);a=e.readUInt32BE(0)}const o=1e3*t+Math.round(a/1e6);return new Date(o)}});return Ap=function(c){const l=[],u=new Map;return c=c||{forceFloat64:!1,compatibilityMode:!1,disableTimestampEncoding:!1,preferMap:!1,protoAction:"error"},u.set(s.type,s.decode),c.disableTimestampEncoding||l.push(s),{encode:a(l,c),decode:i(u,c),register:function(r,i,a,o){return t(i,"must have a constructor"),t(a,"must have an encode function"),t(r>=0,"must have a non-negative type"),t(o,"must have a decode function"),this.registerEncoder(function(e){return e instanceof i},function(t){const i=n(),o=e.allocUnsafe(1);return o.writeInt8(r,0),i.append(o),i.append(a(t)),i}),this.registerDecoder(r,o),this},registerEncoder:function(e,n){return t(e,"must have an encode function"),t(n,"must have an encode function"),l.push({check:e,encode:n}),this},registerDecoder:function(e,n){return t(e>=0,"must have a non-negative type"),t(n,"must have a decode function"),u.set(e,n),this},encoder:r.encoder,decoder:r.decoder,buffer:!0,type:"msgpack5",IncompleteBufferError:o}}}function Rp(){return bp||(bp=1,function(e){var t=Uu&&Uu.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.AlpacaWebsocket=e.ERROR=e.CONN_ERROR=e.EVENT=e.STATE=void 0;const n=t($u()),r=t(ju()),i=t(Pp());var a,o,s,c,l,u;(o=a||(e.STATE=a={})).AUTHENTICATING="authenticating",o.AUTHENTICATED="authenticated",o.CONNECTED="connected",o.CONNECTING="connecting",o.DISCONNECTED="disconnected",o.WAITING_TO_CONNECT="waiting to connect",o.WAITING_TO_RECONNECT="waiting to reconnect",(c=s||(e.EVENT=s={})).CLIENT_ERROR="client_error",c.STATE_CHANGE="state_change",c.AUTHORIZED="authorized",c.UNAUTHORIZED="unauthorized",c.TRADES="stock_trades",c.QUOTES="stock_quotes",c.BARS="stock_bars",c.UPDATED_BARS="stock_updated_bars",c.DAILY_BARS="stock_daily_bars",c.TRADING_STATUSES="trading_statuses",c.LULDS="lulds",c.CANCEL_ERRORS="cancel_errors",c.CORRECTIONS="corrections",c.ORDERBOOKS="orderbooks",c.NEWS="news",e.CONN_ERROR=new Map([[400,"invalid syntax"],[401,"not authenticated"],[402,"auth failed"],[403,"already authenticated"],[404,"auth timeout"],[405,"symbol limit exceeded"],[406,"connection limit exceeded"],[407,"slow client"],[408,"v2 not enabled"],[409,"insufficient subscription"],[500,"internal error"]]),(u=l||(e.ERROR=l={})).MISSING_SECERT_KEY="missing secret key",u.MISSING_API_KEY="missing api key",u.UNEXPECTED_MESSAGE="unexpected message";class d extends n.default.EventEmitter{constructor(e){super(),this.msgpack=(0,i.default)(),this.session={apiKey:e.apiKey,secretKey:e.secretKey,subscriptions:e.subscriptions,reconnect:!0,verbose:e.verbose,backoff:!0,reconnectTimeout:0,maxReconnectTimeout:30,backoffIncrement:.5,url:e.url,currentState:a.WAITING_TO_CONNECT,isReconnected:!1,pongWait:5e3},Object.values(a).forEach(e=>{this.on(e,()=>{this.emit(s.STATE_CHANGE,e)})})}connect(){if(this.emit(a.CONNECTING),this.session.currentState=a.CONNECTING,0===this.session.apiKey.length)throw new Error(l.MISSING_API_KEY);if(0===this.session.secretKey.length)throw new Error(l.MISSING_SECERT_KEY);this.resetSession(),this.conn=new r.default(this.session.url,{perMessageDeflate:{serverNoContextTakeover:!1,clientNoContextTakeover:!1},headers:{"Content-Type":"application/msgpack"}}),this.conn.binaryType="nodebuffer",this.conn.once("open",()=>this.authenticate()),this.conn.on("message",e=>{this.handleMessage(this.msgpack.decode(e))}),this.conn.on("error",e=>{this.emit(s.CLIENT_ERROR,e.message),this.disconnect()}),this.conn.on("close",(e,t)=>{this.log(`connection closed with code: ${e} and message: ${t}`),this.session.reconnect&&this.reconnect()}),this.conn.on("pong",()=>{this.session.pongTimeout&&clearTimeout(this.session.pongTimeout)}),this.session.pingInterval=setInterval(()=>{this.ping()},1e4),this.on(a.WAITING_TO_RECONNECT,e=>{this.log(`backoff: ${e}`)})}onConnect(e){this.on(a.AUTHENTICATED,()=>{this.session.isReconnected?this.subscribeAll():e()})}reconnect(){this.log("Reconnecting..."),this.session.isReconnected=!0;const{backoff:e,backoffIncrement:t,maxReconnectTimeout:n}=this.session;let r=this.session.reconnectTimeout;e&&setTimeout(()=>{r+=t,r>n&&(r=n),this.emit(a.WAITING_TO_RECONNECT,r),this.connect()},1e3*r)}ping(){this.conn.ping(),this.session.pongTimeout=setTimeout(()=>{this.log("no pong received from server, terminating..."),this.conn.terminate()},this.session.pongWait)}authenticate(){const e={action:"auth",key:this.session.apiKey,secret:this.session.secretKey};this.conn.send(this.msgpack.encode(e)),this.emit(a.AUTHENTICATING),this.session.currentState=a.AUTHENTICATING}disconnect(){this.emit(a.DISCONNECTED),this.session.currentState=a.DISCONNECTED,this.conn.close(),this.session.reconnect=!1,this.session.pongTimeout&&clearTimeout(this.session.pongTimeout),this.session.pingInterval&&clearInterval(this.session.pingInterval)}onDisconnect(e){this.on(a.DISCONNECTED,()=>e())}onError(e){this.on(s.CLIENT_ERROR,t=>e(t))}onStateChange(e){this.on(s.STATE_CHANGE,t=>e(t))}handleMessage(t){switch((null==t?void 0:t.length)?t[0].T:""){case"success":"connected"===t[0].msg?(this.emit(a.CONNECTED),this.session.currentState=a.CONNECTED):"authenticated"===t[0].msg&&(this.emit(a.AUTHENTICATED),this.session.currentState=a.AUTHENTICATED);break;case"subscription":this.updateSubscriptions(t[0]);break;case"error":this.emit(s.CLIENT_ERROR,e.CONN_ERROR.get(t[0].code));break;default:this.dataHandler(t)}}log(e){this.session.verbose&&console.log(e)}getSubscriptions(){return this.session.subscriptions}resetSession(){this.session.reconnect=!0,this.session.backoff=!0,this.session.reconnectTimeout=0,this.session.maxReconnectTimeout=30,this.session.backoffIncrement=.5,this.session.pongTimeout&&clearTimeout(this.session.pongTimeout),this.session.pingInterval&&clearInterval(this.session.pingInterval)}}e.AlpacaWebsocket=d}(Uu)),Uu}var Lp,Np={};var Op,Bp={};var Mp,Dp={};var Fp,kp,Gp,xp,Hp,Up={};function Vp(){return Gp||(Gp=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=$u(),n=ju(),r=function(){if(kp)return Fp;kp=1;let e={T:"symbol",X:"askexchange",P:"askprice",S:"asksize",x:"bidexchange",p:"bidprice",s:"bidsize",c:"conditions",t:"timestamp"},t={T:"symbol",i:"tradeID",x:"exchange",p:"price",s:"size",t:"timestamp",z:"tapeID",c:"conditions"},n={T:"symbol",v:"volume",av:"accumulatedVolume",op:"officialOpenPrice",vw:"vwap",o:"openPrice",h:"highPrice",l:"lowPrice",c:"closePrice",a:"averagePrice",s:"startEpochTime",e:"endEpochTime"},r={t:"startEpochTime",o:"openPrice",h:"highPrice",l:"lowPrice",c:"closePrice",v:"volume"};function i(e,t){const n={};for(let[r,i]of Object.entries(e))t.hasOwnProperty(r)?n[t[r]]=i:n[r]=i;return n}return Fp={AlpacaTrade:function(e){return i(e,t)},AlpacaQuote:function(t){return i(t,e)},AggMinuteBar:function(e){return i(e,n)},Bar:function(e){return i(e,r)}}}();var i,a,o,s,c,l;(a=i=e.STATE||(e.STATE={})).AUTHENTICATING="authenticating",a.CONNECTED="connected",a.CONNECTING="connecting",a.DISCONNECTED="disconnected",a.WAITING_TO_CONNECT="waiting to connect",a.WAITING_TO_RECONNECT="waiting to reconnect",(s=o=e.EVENT||(e.EVENT={})).CLIENT_ERROR="client_error",s.STATE_CHANGE="state_change",s.AUTHORIZED="authorized",s.UNAUTHORIZED="unauthorized",s.ORDER_UPDATE="trade_updates",s.ACCOUNT_UPDATE="account_updates",s.STOCK_TRADES="stock_trades",s.STOCK_QUOTES="stock_quotes",s.STOCK_AGG_SEC="stock_agg_sec",s.STOCK_AGG_MIN="stock_agg_min",(l=c=e.ERROR||(e.ERROR={})).BAD_KEY_OR_SECRET="bad key id or secret",l.CONNECTION_REFUSED="connection refused",l.MISSING_API_KEY="missing api key",l.MISSING_SECRET_KEY="missing secret key",l.UNKNOWN="unknown error";class u extends t.EventEmitter{constructor(e={}){super(),this.defaultOptions={subscriptions:[],reconnect:!0,backoff:!0,reconnectTimeout:0,maxReconnectTimeout:30,backoffIncrement:.5,verbose:!1,usePolygon:!1},!e.backoff&&e.reconnectTimeout<1&&(e.reconnectTimeout=1),this.session=Object.assign(this.defaultOptions,e),this.session.url=this.session.url.replace(/^http/,"ws")+"/stream",this.subscriptionState={},this.session.subscriptions.forEach(e=>{this.subscriptionState[e]=!0}),this.currentState=i.WAITING_TO_CONNECT,Object.keys(i).forEach(e=>{this.on(i[e],()=>{this.currentState=i[e],this.log("info",`state change: ${i[e]}`),this.emit(o.STATE_CHANGE,i[e])})}),Object.keys(c).forEach(e=>{this.on(c[e],()=>{this.log("error",c[e]),this.emit(o.CLIENT_ERROR,c[e])})})}connect(){if(0===this.session.apiKey.length&&0===this.session.oauth.length)throw new Error(c.MISSING_API_KEY);if(0===this.session.secretKey.length&&0===this.session.oauth.length)throw new Error(c.MISSING_SECRET_KEY);this.reconnectDisabled=!1,this.emit(i.CONNECTING),this.conn=new n(this.session.url),this.conn.once("open",()=>{this.authenticate()}),this.conn.on("message",e=>this.handleMessage(e)),this.conn.once("error",e=>{this.emit(c.CONNECTION_REFUSED)}),this.conn.once("close",()=>{this.emit(i.DISCONNECTED),this.session.reconnect&&!this.reconnectDisabled&&this.reconnect()})}_ensure_polygon(e){this.polygon.connectCalled?e&&this.polygon.subscribe(e):this.polygon.connect(e)}_unsubscribe_polygon(e){this.polygon.connectCalled&&e&&this.polygon.unsubscribe(e)}subscribe(e){let t=[],n=[];if(e.forEach(e=>{["Q.","T.","A.","AM."].filter(t=>e.startsWith(t)).length>0?n.push(e):t.push(e)}),t.length>0){const e={action:"listen",data:{streams:t}};this.send(JSON.stringify(e))}n.length>0&&this._ensure_polygon(n),e.forEach(e=>{this.subscriptionState[e]=!0})}unsubscribe(e){let t=[];e.forEach(e=>{["Q.","T.","A.","AM."].filter(t=>e.startsWith(t)).length>0&&t.push(e)}),t.length>0&&this._unsubscribe_polygon(t),e.forEach(e=>{this.subscriptionState[e]=!1})}subscriptions(){return Object.keys(this.subscriptionState).filter(e=>this.subscriptionState[e])}onConnect(e){this.on(i.CONNECTED,()=>e())}onDisconnect(e){this.on(i.DISCONNECTED,()=>e())}onStateChange(e){this.on(o.STATE_CHANGE,t=>e(t))}onError(e){this.on(o.CLIENT_ERROR,t=>e(t))}onOrderUpdate(e){this.on(o.ORDER_UPDATE,t=>e(t))}onAccountUpdate(e){this.on(o.ACCOUNT_UPDATE,t=>e(t))}onPolygonConnect(e){this.polygon.on(i.CONNECTED,()=>e())}onPolygonDisconnect(e){this.polygon.on(i.DISCONNECTED,()=>e())}onStockTrades(e){this.session.usePolygon?this.polygon.on(o.STOCK_TRADES,function(t,n){e(t,n)}):this.on(o.STOCK_TRADES,function(t,n){e(t,n)})}onStockQuotes(e){this.session.usePolygon?this.polygon.on(o.STOCK_QUOTES,function(t,n){e(t,n)}):this.on(o.STOCK_QUOTES,function(t,n){e(t,n)})}onStockAggSec(e){this.polygon.on(o.STOCK_AGG_SEC,function(t,n){e(t,n)})}onStockAggMin(e){this.session.usePolygon?this.polygon.on(o.STOCK_AGG_MIN,function(t,n){e(t,n)}):this.on(o.STOCK_AGG_MIN,function(t,n){e(t,n)})}send(e){this.conn.send(e)}disconnect(){this.reconnectDisabled=!0,this.conn.close(),this.polygon&&this.polygon.close()}state(){return this.currentState}get(e){return this.session[e]}reconnect(){setTimeout(()=>{this.session.backoff&&(this.session.reconnectTimeout+=this.session.backoffIncrement,this.session.reconnectTimeout>this.session.maxReconnectTimeout&&(this.session.reconnectTimeout=this.session.maxReconnectTimeout)),this.connect()},1e3*this.session.reconnectTimeout),this.emit(i.WAITING_TO_RECONNECT,this.session.reconnectTimeout)}authenticate(){this.emit(i.AUTHENTICATING);const e={action:"authenticate",data:{key_id:this.session.apiKey,secret_key:this.session.secretKey}};this.send(JSON.stringify(e))}handleMessage(e){const t=new Uint8Array(e);if(1===t.length&&1===t[0])return;let n=JSON.parse(e);const i=n.stream;switch("error"in n.data&&console.log(n.data.error),i){case"authorization":this.authResultHandler(n.data.status);break;case"listening":this.log(`listening to the streams: ${n.data.streams}`);break;case"trade_updates":this.emit(o.ORDER_UPDATE,n.data);break;case"account_updates":this.emit(o.ACCOUNT_UPDATE,n.data);break;default:n.stream.startsWith("T.")?this.emit(o.STOCK_TRADES,i,r.AlpacaTrade(n.data)):n.stream.startsWith("Q.")?this.emit(o.STOCK_QUOTES,i,r.AlpacaQuote(n.data)):n.stream.startsWith("AM.")?this.emit(o.STOCK_AGG_MIN,i,r.AggMinuteBar(n.data)):this.emit(c.PROTOBUF)}}authResultHandler(e){switch(e){case"authorized":this.emit(i.CONNECTED);break;case"unauthorized":this.emit(c.BAD_KEY_OR_SECRET),this.disconnect()}}log(e,...t){this.session.verbose&&console[e](...t)}}e.AlpacaStreamClient=u}(Up)),Up}function $p(){if(Hp)return xp;Hp=1,r.config();const e=function(){if(Di)return Mi;Di=1;const e=i,t=Fi();return Mi={httpRequest:function(n,r,i,a){const{baseUrl:o,keyId:s,secretKey:c,apiVersion:l,oauth:u}=this.configuration,d={method:a||"GET",url:t(o,l,n),params:r||{},headers:""!==u?{"content-type":"DELETE"!==a?"application/json":"",Authorization:"Bearer "+u}:{"content-type":"DELETE"!==a?"application/json":"","APCA-API-KEY-ID":s,"APCA-API-SECRET-KEY":c},data:i||void 0};return e(d)},dataHttpRequest:function(n,r,i,a){const{dataBaseUrl:o,keyId:s,secretKey:c,oauth:l}=this.configuration,u={method:a||"GET",url:t(o,"v1",n),params:r||{},headers:""!==l?{"content-type":"DELETE"!==a?"application/json":"",Authorization:"Bearer "+l}:{"content-type":"DELETE"!==a?"application/json":"","APCA-API-KEY-ID":s,"APCA-API-SECRET-KEY":c},data:i||void 0};return e(u)},sendRequest:function(e,t,n,r,i){return e(t,n,r,i).then(e=>e.data)}}}(),t=function(){if(xi)return Gi;xi=1;const{omitBy:e,isNil:t}=na();return Gi={get:function(){return this.sendRequest("/account")},getConfigs:function(){return this.sendRequest("/account/configurations")},updateConfigs:function(e){return this.sendRequest("/account/configurations",null,e,"PATCH")},getActivities:function({activityTypes:n,until:r,after:i,direction:a,date:o,pageSize:s,pageToken:c}){Array.isArray(n)&&(n=n.join(","));const l=e({activity_types:n,until:r,after:i,direction:a,date:o,page_size:s,page_token:c},t);return this.sendRequest("/account/activities",l)},getPortfolioHistory:function({date_start:n,date_end:r,period:i,timeframe:a,extended_hours:o}){const s=e({date_start:n,date_end:r,period:i,timeframe:a,extended_hours:o},t);return this.sendRequest("/account/portfolio/history",s)}}}(),n=Ui?Hi:(Ui=1,Hi={getAll:function(){return this.sendRequest("/positions")},getOne:function(e){return this.sendRequest("/positions/"+e)},closeAll:function(){return this.sendRequest("/positions",null,null,"DELETE")},closeOne:function(e){return this.sendRequest("/positions/"+e,null,null,"DELETE")}}),a=ra(),o=Ki?Xi:(Ki=1,Xi={get:function(){return this.sendRequest("/clock")}}),s=qi?Yi:(qi=1,Yi={getAll:function(e={}){return this.sendRequest("/assets",e)},getOne:function(e){return this.sendRequest("/assets/"+e)}}),c=function(){if(Ji)return Qi;Ji=1;const{omitBy:e,isNil:t}=na();return Qi={getAll:function({status:n,until:r,after:i,limit:a,direction:o,nested:s,symbols:c}={}){const l=e({status:n,until:r,after:i,limit:a,direction:o,nested:s,symbols:c},t);return this.sendRequest("/orders",l)},getOne:function(e){return this.sendRequest("/orders/"+e)},getByClientOrderId:function(e){const t={client_order_id:e};return this.sendRequest("/orders:by_client_order_id",t)},post:function(e){return this.sendRequest("/orders",null,e,"POST")},patchOrder:function(e,t){return this.sendRequest(`/orders/${e}`,null,t,"PATCH")},cancel:function(e){return this.sendRequest("/orders/"+e,null,null,"DELETE")},cancelAll:function(){return this.sendRequest("/orders",null,null,"DELETE")}}}(),l=Zi?zi:(Zi=1,zi={getAll:function(){return this.sendRequest("/watchlists")},getOne:function(e){return this.sendRequest(`/watchlists/${e}`)},addWatchlist:function(e,t=void 0){const n={name:e,symbols:t};return this.sendRequest("/watchlists",null,n,"POST")},addToWatchlist:function(e,t){const n={symbol:t};return this.sendRequest(`/watchlists/${e}`,null,n,"POST")},updateWatchlist:function(e,t){return this.sendRequest(`/watchlists/${e}`,null,t,"PUT")},deleteWatchlist:function(e){return this.sendRequest(`/watchlists/${e}`,null,null,"DELETE")},deleteFromWatchlist:function(e,t){return this.sendRequest(`/watchlists/${e}/${t}`,null,null,"DELETE")}}),u=Fu(),d=Du(),p=function(){if(Tp)return Hu;Tp=1,Object.defineProperty(Hu,"__esModule",{value:!0}),Hu.AlpacaCryptoClient=void 0;const e=Du(),t=Rp(),n=new Map([["t",{event:t.EVENT.TRADES,parse:e.AlpacaCryptoTrade}],["q",{event:t.EVENT.QUOTES,parse:e.AlpacaCryptoQuote}],["b",{event:t.EVENT.BARS,parse:e.AlpacaCryptoBar}],["u",{event:t.EVENT.UPDATED_BARS,parse:e.AlpacaCryptoBar}],["d",{event:t.EVENT.DAILY_BARS,parse:e.AlpacaCryptoBar}],["o",{event:t.EVENT.ORDERBOOKS,parse:e.AlpacaCryptoOrderbook}]]);class r extends t.AlpacaWebsocket{constructor(e){e.url=e.url.replace("https","wss")+"/v1beta3/crypto/us",e.subscriptions={trades:[],quotes:[],bars:[],updatedBars:[],dailyBars:[],orderbooks:[]},super(e)}subscribeForTrades(e){this.session.subscriptions.trades.push(...e),this.subscribe({trades:e})}subscribeForQuotes(e){this.session.subscriptions.quotes.push(...e),this.subscribe({quotes:e})}subscribeForBars(e){this.session.subscriptions.bars.push(...e),this.subscribe({bars:e})}subscribeForUpdatedBars(e){this.session.subscriptions.updatedBars.push(...e),this.subscribe({updatedBars:e})}subscribeForDailyBars(e){this.session.subscriptions.dailyBars.push(...e),this.subscribe({dailyBars:e})}subscribeForOrderbooks(e){this.session.subscriptions.orderbooks.push(...e),this.subscribe({orderbooks:e})}subscribe(e){var t,n,r,i,a,o;const s={action:"subscribe",trades:null!==(t=e.trades)&&void 0!==t?t:[],quotes:null!==(n=e.quotes)&&void 0!==n?n:[],bars:null!==(r=e.bars)&&void 0!==r?r:[],updatedBars:null!==(i=e.updatedBars)&&void 0!==i?i:[],dailyBars:null!==(a=e.dailyBars)&&void 0!==a?a:[],orderbooks:null!==(o=e.orderbooks)&&void 0!==o?o:[]};this.conn.send(this.msgpack.encode(s))}subscribeAll(){this.subscribe(this.session.subscriptions)}unsubscribeFromTrades(e){this.session.subscriptions.trades=this.session.subscriptions.trades.filter(t=>!e.includes(t)),this.unsubscribe({trades:e})}unsubscribeFromQuotes(e){this.session.subscriptions.quotes=this.session.subscriptions.quotes.filter(t=>!e.includes(t)),this.unsubscribe({quotes:e})}unsubscribeFromBars(e){this.session.subscriptions.bars=this.session.subscriptions.bars.filter(t=>!e.includes(t)),this.unsubscribe({bars:e})}unsubscribeFromUpdatedBars(e){this.session.subscriptions.updatedBars=this.session.subscriptions.updatedBars.filter(t=>!e.includes(t)),this.unsubscribe({updatedBars:e})}unsubscriceFromDailyBars(e){this.session.subscriptions.dailyBars=this.session.subscriptions.dailyBars.filter(t=>!e.includes(t)),this.unsubscribe({dailyBars:e})}unsubscribeFromOrderbooks(e){this.session.subscriptions.orderbooks=this.session.subscriptions.orderbooks.filter(t=>!e.includes(t)),this.unsubscribe({orderbooks:e})}unsubscribe(e){var t,n,r,i,a,o;const s={action:"unsubscribe",trades:null!==(t=e.trades)&&void 0!==t?t:[],quotes:null!==(n=e.quotes)&&void 0!==n?n:[],bars:null!==(r=e.bars)&&void 0!==r?r:[],updatedBars:null!==(i=e.updatedBars)&&void 0!==i?i:[],dailyBars:null!==(a=e.dailyBars)&&void 0!==a?a:[],orderbooks:null!==(o=e.orderbooks)&&void 0!==o?o:[]};this.conn.send(this.msgpack.encode(s))}updateSubscriptions(e){this.session.subscriptions={trades:e.trades,quotes:e.quotes,bars:e.bars,updatedBars:e.updatedBars,dailyBars:e.dailyBars,orderbooks:e.orderbooks},this.log(`listening to streams:\n ${JSON.stringify(this.session.subscriptions)}`)}onCryptoTrade(e){this.on(t.EVENT.TRADES,t=>e(t))}onCryptoQuote(e){this.on(t.EVENT.QUOTES,t=>e(t))}onCryptoBar(e){this.on(t.EVENT.BARS,t=>e(t))}onCryptoUpdatedBar(e){this.on(t.EVENT.UPDATED_BARS,t=>e(t))}onCryptoDailyBar(e){this.on(t.EVENT.DAILY_BARS,t=>e(t))}onCryptoOrderbook(e){this.on(t.EVENT.ORDERBOOKS,t=>e(t))}dataHandler(e){e.forEach(e=>{if("T"in e){const r=n.get(e.T);r?this.emit(r.event,r.parse(e)):this.emit(t.EVENT.CLIENT_ERROR,t.ERROR.UNEXPECTED_MESSAGE)}})}}return Hu.AlpacaCryptoClient=r,Hu}(),h=function(){if(Lp)return Np;Lp=1,Object.defineProperty(Np,"__esModule",{value:!0}),Np.AlpacaNewsCLient=void 0;const e=Rp(),t=Du(),n=Rp();class r extends n.AlpacaWebsocket{constructor(e){const t="wss"+e.url.substr(e.url.indexOf(":"))+"/v1beta1/news";e.url=t,e.subscriptions={news:[]},super(e)}subscribeForNews(e){this.session.subscriptions.news.push(...e),this.subscribe(e)}subscribe(e){const t={action:"subscribe",news:e};console.log("subscribing",t),this.conn.send(this.msgpack.encode(t))}subscribeAll(){this.session.subscriptions.news.length>0&&this.subscribe(this.session.subscriptions.news)}unsubscribeFromNews(e){this.session.subscriptions.news=this.session.subscriptions.news.filter(t=>!e.includes(t)),this.unsubscribe(e)}unsubscribe(e){const t={action:"unsubscribe",news:e};this.conn.send(this.msgpack.encode(t))}updateSubscriptions(e){this.log(`listening to streams:\n news: ${e.news}`),this.session.subscriptions={news:e.news}}onNews(t){this.on(e.EVENT.NEWS,e=>t(e))}dataHandler(n){n.forEach(n=>{"T"in n&&"n"===n.T?this.emit(e.EVENT.NEWS,(0,t.AlpacaNews)(n)):this.emit(e.EVENT.CLIENT_ERROR,e.ERROR.UNEXPECTED_MESSAGE)})}}return Np.AlpacaNewsCLient=r,Np}(),f=function(){if(Op)return Bp;Op=1,Object.defineProperty(Bp,"__esModule",{value:!0}),Bp.AlpacaStocksClient=void 0;const e=Du(),t=Rp();class n extends t.AlpacaWebsocket{constructor(e){const t="wss"+e.url.substr(e.url.indexOf(":"))+"/v2/"+e.feed;e.url=t,e.subscriptions={trades:[],quotes:[],bars:[],updatedBars:[],dailyBars:[],statuses:[],lulds:[],cancelErrors:[],corrections:[]},super(e)}subscribeForTrades(e){this.session.subscriptions.trades.push(...e),this.subscribe({trades:e})}subscribeForQuotes(e){this.session.subscriptions.quotes.push(...e),this.subscribe({quotes:e})}subscribeForBars(e){this.session.subscriptions.bars.push(...e),this.subscribe({bars:e})}subscribeForUpdatedBars(e){this.session.subscriptions.updatedBars.push(...e),this.subscribe({updatedBars:e})}subscribeForDailyBars(e){this.session.subscriptions.dailyBars.push(...e),this.subscribe({dailyBars:e})}subscribeForStatuses(e){this.session.subscriptions.statuses.push(...e),this.subscribe({statuses:e})}subscribeForLulds(e){this.session.subscriptions.lulds.push(...e),this.subscribe({lulds:e})}subscribe(e){var t,n,r,i,a,o,s;const c={action:"subscribe",trades:null!==(t=e.trades)&&void 0!==t?t:[],quotes:null!==(n=e.quotes)&&void 0!==n?n:[],bars:null!==(r=e.bars)&&void 0!==r?r:[],updatedBars:null!==(i=e.updatedBars)&&void 0!==i?i:[],dailyBars:null!==(a=e.dailyBars)&&void 0!==a?a:[],statuses:null!==(o=e.statuses)&&void 0!==o?o:[],lulds:null!==(s=e.lulds)&&void 0!==s?s:[]};this.conn.send(this.msgpack.encode(c))}subscribeAll(){this.subscribe(this.session.subscriptions)}unsubscribeFromTrades(e){this.session.subscriptions.trades=this.session.subscriptions.trades.filter(t=>!e.includes(t)),this.unsubscribe({trades:e})}unsubscribeFromQuotes(e){this.session.subscriptions.quotes=this.session.subscriptions.quotes.filter(t=>!e.includes(t)),this.unsubscribe({quotes:e})}unsubscribeFromBars(e){this.session.subscriptions.bars=this.session.subscriptions.bars.filter(t=>!e.includes(t)),this.unsubscribe({bars:e})}unsubscribeFromUpdatedBars(e){this.session.subscriptions.updatedBars=this.session.subscriptions.updatedBars.filter(t=>!e.includes(t)),this.unsubscribe({updatedBars:e})}unsubscribeFromDailyBars(e){this.session.subscriptions.dailyBars=this.session.subscriptions.dailyBars.filter(t=>!e.includes(t)),this.unsubscribe({dailyBars:e})}unsubscribeFromStatuses(e){this.session.subscriptions.statuses=this.session.subscriptions.statuses.filter(t=>!e.includes(t)),this.unsubscribe({statuses:e})}unsubscribeFromLulds(e){this.session.subscriptions.lulds=this.session.subscriptions.lulds.filter(t=>!e.includes(t)),this.unsubscribe({lulds:e})}unsubscribe(e){var t,n,r,i,a,o,s;const c={action:"unsubscribe",trades:null!==(t=e.trades)&&void 0!==t?t:[],quotes:null!==(n=e.quotes)&&void 0!==n?n:[],bars:null!==(r=e.bars)&&void 0!==r?r:[],updatedBars:null!==(i=e.updatedBars)&&void 0!==i?i:[],dailyBars:null!==(a=e.dailyBars)&&void 0!==a?a:[],statuses:null!==(o=e.statuses)&&void 0!==o?o:[],lulds:null!==(s=e.lulds)&&void 0!==s?s:[]};this.conn.send(this.msgpack.encode(c))}updateSubscriptions(e){this.log(`listening to streams:\n trades: ${e.trades},\n quotes: ${e.quotes},\n bars: ${e.bars},\n updatedBars: ${e.updatedBars},\n dailyBars: ${e.dailyBars},\n statuses: ${e.statuses},\n lulds: ${e.lulds},\n cancelErrors: ${e.cancelErrors},\n corrections: ${e.corrections}`),this.session.subscriptions={trades:e.trades,quotes:e.quotes,bars:e.bars,updatedBars:e.updatedBars,dailyBars:e.dailyBars,statuses:e.statuses,lulds:e.lulds,cancelErrors:e.cancelErrors,corrections:e.corrections}}onStockTrade(e){this.on(t.EVENT.TRADES,t=>e(t))}onStockQuote(e){this.on(t.EVENT.QUOTES,t=>e(t))}onStockBar(e){this.on(t.EVENT.BARS,t=>e(t))}onStockUpdatedBar(e){this.on(t.EVENT.UPDATED_BARS,t=>e(t))}onStockDailyBar(e){this.on(t.EVENT.DAILY_BARS,t=>e(t))}onStatuses(e){this.on(t.EVENT.TRADING_STATUSES,t=>e(t))}onLulds(e){this.on(t.EVENT.LULDS,t=>e(t))}onCancelErrors(e){this.on(t.EVENT.CANCEL_ERRORS,t=>e(t))}onCorrections(e){this.on(t.EVENT.CORRECTIONS,t=>e(t))}dataHandler(n){n.forEach(n=>{if("T"in n)switch(n.T){case"t":this.emit(t.EVENT.TRADES,(0,e.AlpacaTradeV2)(n));break;case"q":this.emit(t.EVENT.QUOTES,(0,e.AlpacaQuoteV2)(n));break;case"b":this.emit(t.EVENT.BARS,(0,e.AlpacaBarV2)(n));break;case"u":this.emit(t.EVENT.UPDATED_BARS,(0,e.AlpacaBarV2)(n));break;case"d":this.emit(t.EVENT.DAILY_BARS,(0,e.AlpacaBarV2)(n));break;case"s":this.emit(t.EVENT.TRADING_STATUSES,(0,e.AlpacaStatusV2)(n));break;case"l":this.emit(t.EVENT.LULDS,(0,e.AlpacaLuldV2)(n));break;case"x":this.emit(t.EVENT.CANCEL_ERRORS,(0,e.AlpacaCancelErrorV2)(n));break;case"c":this.emit(t.EVENT.CORRECTIONS,(0,e.AlpacaCorrectionV2)(n));break;default:this.emit(t.EVENT.CLIENT_ERROR,t.ERROR.UNEXPECTED_MESSAGE)}})}}return Bp.AlpacaStocksClient=n,Bp}(),m=function(){if(Mp)return Dp;Mp=1,Object.defineProperty(Dp,"__esModule",{value:!0}),Dp.AlpacaOptionClient=void 0;const e=Du(),t=Rp();class n extends t.AlpacaWebsocket{constructor(e){const t="wss"+e.url.substr(e.url.indexOf(":"))+"/v1beta1/"+e.feed;e.url=t,e.subscriptions={trades:[],quotes:[]},super(e)}subscribeForTrades(e){this.session.subscriptions.trades.push(...e),this.subscribe({trades:e})}subscribeForQuotes(e){this.session.subscriptions.quotes.push(...e),this.subscribe({quotes:e})}subscribe(e){var t,n;const r={action:"subscribe",trades:null!==(t=e.trades)&&void 0!==t?t:[],quotes:null!==(n=e.quotes)&&void 0!==n?n:[]};this.conn.send(this.msgpack.encode(r))}subscribeAll(){this.subscribe(this.session.subscriptions)}unsubscribeFromTrades(e){this.session.subscriptions.trades=this.session.subscriptions.trades.filter(t=>!e.includes(t)),this.unsubscribe({trades:e})}unsubscribeFromQuotes(e){this.session.subscriptions.quotes=this.session.subscriptions.quotes.filter(t=>!e.includes(t)),this.unsubscribe({quotes:e})}unsubscribe(e){var t,n;const r={action:"unsubscribe",trades:null!==(t=e.trades)&&void 0!==t?t:[],quotes:null!==(n=e.quotes)&&void 0!==n?n:[]};this.conn.send(this.msgpack.encode(r))}updateSubscriptions(e){this.log(`listening to streams:\n trades: ${e.trades},\n quotes: ${e.quotes}`),this.session.subscriptions={trades:e.trades,quotes:e.quotes}}onOptionTrade(e){this.on(t.EVENT.TRADES,t=>e(t))}onOptionQuote(e){this.on(t.EVENT.QUOTES,t=>e(t))}dataHandler(n){n.forEach(n=>{if("T"in n)switch(n.T){case"t":this.emit(t.EVENT.TRADES,(0,e.AlpacaOptionTradeV1Beta1)(n));break;case"q":this.emit(t.EVENT.QUOTES,(0,e.AlpacaOptionQuoteV1Beta1)(n));break;default:this.emit(t.EVENT.CLIENT_ERROR,t.ERROR.UNEXPECTED_MESSAGE)}})}}return Dp.AlpacaOptionClient=n,Dp}(),g=Vp();return xp=class{constructor(r={}){this.httpRequest=e.httpRequest.bind(this),this.dataHttpRequest=e.dataHttpRequest,this.getAccount=t.get,this.updateAccountConfigurations=t.updateConfigs,this.getAccountConfigurations=t.getConfigs,this.getAccountActivities=t.getActivities,this.getPortfolioHistory=t.getPortfolioHistory,this.getPositions=n.getAll,this.getPosition=n.getOne,this.closeAllPositions=n.closeAll,this.closePosition=n.closeOne,this.getCalendar=a.get,this.getClock=o.get,this.getAssets=s.getAll,this.getAsset=s.getOne,this.getOrders=c.getAll,this.getOrder=c.getOne,this.getOrderByClientId=c.getByClientOrderId,this.createOrder=c.post,this.replaceOrder=c.patchOrder,this.cancelOrder=c.cancel,this.cancelAllOrders=c.cancelAll,this.getWatchlists=l.getAll,this.getWatchlist=l.getOne,this.addWatchlist=l.addWatchlist,this.addToWatchlist=l.addToWatchlist,this.updateWatchlist=l.updateWatchlist,this.deleteWatchlist=l.deleteWatchlist,this.deleteFromWatchlist=l.deleteFromWatchlist,this.configuration={baseUrl:r.baseUrl||process.env.APCA_API_BASE_URL||(r.paper?"https://paper-api.alpaca.markets":"https://api.alpaca.markets"),dataBaseUrl:r.dataBaseUrl||process.env.APCA_DATA_BASE_URL||process.env.DATA_PROXY_WS||"https://data.alpaca.markets",dataStreamUrl:r.dataStreamUrl||process.env.APCA_API_STREAM_URL||"https://stream.data.alpaca.markets",keyId:r.keyId||process.env.APCA_API_KEY_ID||"",secretKey:r.secretKey||process.env.APCA_API_SECRET_KEY||"",apiVersion:r.apiVersion||process.env.APCA_API_VERSION||"v2",oauth:r.oauth||process.env.APCA_API_OAUTH||"",feed:r.feed||"iex",optionFeed:r.optionFeed||"indicative",verbose:r.verbose},this.data_ws=new g.AlpacaStreamClient({url:this.configuration.dataBaseUrl,apiKey:this.configuration.keyId,secretKey:this.configuration.secretKey,oauth:this.configuration.oauth}),this.data_ws.STATE=g.STATE,this.data_ws.EVENT=g.EVENT,this.data_ws.ERROR=g.ERROR,this.trade_ws=new g.AlpacaStreamClient({url:this.configuration.baseUrl,apiKey:this.configuration.keyId,secretKey:this.configuration.secretKey,oauth:this.configuration.oauth}),this.trade_ws.STATE=g.STATE,this.trade_ws.EVENT=g.EVENT,this.trade_ws.ERROR=g.ERROR,this.data_stream_v2=new f.AlpacaStocksClient({url:this.configuration.dataStreamUrl,feed:this.configuration.feed,apiKey:this.configuration.keyId,secretKey:this.configuration.secretKey,verbose:this.configuration.verbose}),this.adjustment=u.Adjustment,this.timeframeUnit=d.TimeFrameUnit,this.crypto_stream_v1beta3=new p.AlpacaCryptoClient({url:this.configuration.dataStreamUrl,apiKey:this.configuration.keyId,secretKey:this.configuration.secretKey,verbose:this.configuration.verbose}),this.news_stream=new h.AlpacaNewsCLient({url:this.configuration.dataStreamUrl,apiKey:this.configuration.keyId,secretKey:this.configuration.secretKey,verbose:this.configuration.verbose}),this.option_stream=new m.AlpacaOptionClient({url:this.configuration.dataStreamUrl,feed:this.configuration.optionFeed,apiKey:this.configuration.keyId,secretKey:this.configuration.secretKey,verbose:this.configuration.verbose})}sendRequest(t,n,r,i){return e.sendRequest(this.httpRequest,t,n,r,i)}getTradesV2(e,t,n=this.configuration){return u.getTrades(e,t,n)}getMultiTradesV2(e,t,n=this.configuration){return u.getMultiTrades(e,t,n)}getMultiTradesAsyncV2(e,t,n=this.configuration){return u.getMultiTradesAsync(e,t,n)}getQuotesV2(e,t,n=this.configuration){return u.getQuotes(e,t,n)}getMultiQuotesV2(e,t,n=this.configuration){return u.getMultiQuotes(e,t,n)}getMultiQuotesAsyncV2(e,t,n=this.configuration){return u.getMultiQuotesAsync(e,t,n)}getBarsV2(e,t,n=this.configuration){return u.getBars(e,t,n)}getMultiBarsV2(e,t,n=this.configuration){return u.getMultiBars(e,t,n)}getMultiBarsAsyncV2(e,t,n=this.configuration){return u.getMultiBarsAsync(e,t,n)}getLatestTrade(e,t=this.configuration){return u.getLatestTrade(e,t)}getLatestTrades(e,t=this.configuration){return u.getLatestTrades(e,t)}getLatestQuote(e,t=this.configuration){return u.getLatestQuote(e,t)}getLatestQuotes(e,t=this.configuration){return u.getLatestQuotes(e,t)}getLatestBar(e,t=this.configuration){return u.getLatestBar(e,t)}getLatestBars(e,t=this.configuration){return u.getLatestBars(e,t)}getSnapshot(e,t=this.configuration){return u.getSnapshot(e,t)}getSnapshots(e,t=this.configuration){return u.getSnapshots(e,t)}getCryptoTrades(e,t,n=this.configuration){return u.getCryptoTrades(e,t,n)}getCryptoQuotes(e,t,n=this.configuration){return u.getCryptoQuotes(e,t,n)}getCryptoBars(e,t,n=this.configuration){return u.getCryptoBars(e,t,n)}getLatestCryptoTrades(e,t=this.configuration){return u.getLatestCryptoTrades(e,t)}getLatestCryptoQuotes(e,t=this.configuration){return u.getLatestCryptoQuotes(e,t)}getLatestCryptoBars(e,t=this.configuration){return u.getLatestCryptoBars(e,t)}getCryptoSnapshots(e,t=this.configuration){return u.getCryptoSnapshots(e,t)}getCryptoOrderbooks(e,t=this.configuration){return u.getLatestCryptoOrderbooks(e,t)}getOptionBars(e,t,n=this.configuration){return u.getMultiOptionBars(e,t,n)}getOptionTrades(e,t,n=this.configuration){return u.getMultiOptionTrades(e,t,n)}getOptionLatestTrades(e,t=this.configuration){return u.getLatestOptionTrades(e,t)}getOptionLatestQuotes(e,t=this.configuration){return u.getLatestOptionQuotes(e,t)}getOptionSnapshots(e,t=this.configuration){return u.getOptionSnapshots(e,t)}getOptionChain(e,t,n=this.configuration){return u.getOptionChain(e,t,n)}getCorporateActions(e,t,n=this.configuration){return u.getCorporateActions(e,t,n)}getNews(e,t=this.configuration){return u.getNews(e,t)}newTimeframe(e,t){return d.NewTimeframe(e,t)}},xp}var jp,Wp=Pi.exports;const Xp=vi((jp||(jp=1,function(e,t){var n=Wp&&Wp.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=n($p());t.default=r.default,e.exports=r.default}(Pi,Pi.exports)),Pi.exports));function Kp(e){const t=e?.keyId||process.env.ALPACA_API_KEY||process.env.ALPACA_KEY_ID||process.env.APCA_API_KEY_ID||"",n=e?.secretKey||process.env.ALPACA_SECRET||process.env.ALPACA_SECRET_KEY||process.env.APCA_API_SECRET_KEY||"",r=e?.paper??!0;t&&n?console.log(`[Alpaca] Client initialized with API key: ${t.substring(0,4)}...${t.substring(t.length-4)}`):console.warn("[Alpaca] API keys missing - check .env or user settings. Expected: ALPACA_API_KEY and ALPACA_SECRET (or APCA_API_KEY_ID and APCA_API_SECRET_KEY)");let i=e?.baseUrl;return i||(i=r?process.env.ALPACA_BASE_URL||process.env.APCA_API_BASE_URL||"https://paper-api.alpaca.markets":process.env.ALPACA_BASE_URL||process.env.APCA_API_BASE_URL||"https://api.alpaca.markets"),new Xp({keyId:t,secretKey:n,paper:r,baseUrl:i,usePolygon:!1})}const Yp=JSON.parse('[["A","Agilent Technologies Inc.",71,38908,0],["AA","Alcoa Corporation",102,13272,0],["AAA","AAA",1,0,0],["AAAC","AAAC",1,0,0],["AACB","Artius II Acquisition Inc. Class A",1,0,0],["AACBU","Artius II Acquisition Inc.",2,0,0],["AACG","ATA Creativity Global",3,28,0],["AADR","AADR",1,0,0],["AAEQ","AAEQ",1,0,0],["AAL","American Airlines Group Inc.",4,10416,0],["AALG","AALG",1,0,0],["AAM","AA Mission Acquisition Corp. Class A",1,0,0],["AAM.U","AAM.U",1,0,0],["AAME","Atlantic American Corporation",5,66,0],["AAMI","Acadian Asset Management Inc.",11,1698,0],["AAOI","Applied Optoelectronics Inc.",6,2138,0],["AAON","AAON Inc.",7,6150,0],["AAP","Advance Auto Parts Inc.",141,2425,0],["AAPB","AAPB",1,0,0],["AAPD","AAPD",1,0,0],["AAPG","Ascentage Pharma Group International American Depository Shares",8,2552,0],["AAPL","Apple Inc.",9,4043845,0],["AAPU","AAPU",1,0,0],["AARD","Aardvark Therapeutics Inc.",8,300,0],["AAT","American Assets Trust Inc.",30,1147,0],["AAUC","Allied Gold Corporation",1,2887,0],["AAUS","AAUS",1,0,0],["AAVM","AAVM",1,0,0],["AAXJ","AAXJ",1,0,0],["AB","AllianceBernstein Holding L.P. ",11,3577,0],["ABAT","American Battery Technology Company",10,516,0],["ABBV","AbbVie Inc.",8,400878,0],["ABCB","Ameris Bancorp",26,5297,0],["ABCL","AbCellera Biologics Inc.",8,1061,0],["ABCS","ABCS",1,0,0],["ABEO","Abeona Therapeutics Inc.",8,277,0],["ABEQ","ABEQ",1,0,0],["ABEV","Ambev S.A.",46,38985,0],["ABG","Asbury Automotive Group Inc",97,4605,0],["ABI","ABI",1,0,0],["ABIG","ABIG",1,0,0],["ABL","Abacus Global Management Inc. Class A",11,832,0],["ABLLL","Abacus Global Management Inc. 9.875% Fixed Rate Senior Notes due 2028",11,1896,0],["ABLV","Able View Global Inc. Class B",3,40,0],["ABM","ABM Industries Incorporated",12,2582,0],["ABNB","Airbnb Inc. Class A",12,83272,0],["ABNG","ABNG",1,0,0],["ABNY","ABNY",1,0,0],["ABOS","Acumen Pharmaceuticals Inc.",13,130,0],["ABP","Abpro Holdings Inc",8,14,0],["ABR","Arbor Realty Trust",30,1560,0],["ABR/PD","ABR/PD",1,0,0],["ABR/PE","ABR/PE",1,0,0],["ABR/PF","ABR/PF",1,0,0],["ABSI","Absci Corporation",14,508,0],["ABT","Abbott Laboratories",8,218141,0],["ABTC","American Bitcoin Corp. Class A",15,1651,0],["ABTS","Abits Group Inc",16,13,0],["ABUS","Arbutus Biopharma Corporation",8,852,0],["ABVC","ABVC BioPharma Inc.",8,53,0],["ABVE","Above Food Ingredients Inc.",17,87,0],["ABVX","Abivax SA",8,8931,0],["ACA","Arcosa Inc.",55,5455,0],["ACAD","ACADIA Pharmaceuticals Inc.",8,4595,0],["ACB","Aurora Cannabis Inc.",18,281,0],["ACCL","Acco Group Holdings Limited",19,44,0],["ACCO","Acco Brands Corporation",109,342,0],["ACCS","ACCESS Newswire Inc.",109,34,0],["ACDC","ProFrac Holding Corp. Class A",20,689,0],["ACEI","ACEI",1,0,0],["ACEL","Accel Entertainment Inc.",45,929,0],["ACEP","ACEP",1,0,0],["ACES","ACES",1,0,0],["ACET","Adicet Bio Inc.",8,76,0],["ACFN","Acorn Energy Inc.",21,38,0],["ACGL","Arch Capital Group Ltd.",22,34885,0],["ACGLN","Arch Capital Group Ltd.",22,6110,0],["ACGLO","Arch Capital Group Ltd.",22,7370,0],["ACGR","ACGR",1,0,0],["ACHC","Acadia Healthcare Company Inc.",23,1329,0],["ACHR","Archer Aviation Inc. Class A",50,5327,0],["ACHV","Achieve Life Sciences Inc.",24,230,0],["ACI","Albertsons Companies Inc. Class A",67,9574,0],["ACIC","American Coastal Insurance Corporation",22,621,0],["ACII","ACII",1,0,0],["ACIU","AC Immune SA",8,304,0],["ACIW","ACI Worldwide Inc.",25,4963,0],["ACKY","ACKY",1,0,0],["ACLC","ACLC",1,0,0],["ACLO","ACLO",1,0,0],["ACLS","Axcelis Technologies Inc.",7,2564,0],["ACLX","Arcellx Inc.",13,3698,0],["ACM","AECOM",21,12751,0],["ACMR","ACM Research Inc. Class A",7,2580,0],["ACN","Accenture plc Class A",36,179187,0],["ACNB","ACNB Corporation",26,536,0],["ACNT","Ascent Industries Co.",27,147,0],["ACOG","Alpha Cognition Inc.",1,90,0],["ACON","Aclarion Inc.",23,4,0],["ACP","abrdn Income Credit Strategies Fund",11,0,0],["ACP/PA","ACP/PA",1,0,0],["ACR","ACRES Commercial Realty Corp.",30,169,0],["ACR/PC","ACR/PC",1,0,0],["ACR/PD","ACR/PD",1,0,0],["ACRE","Ares Commercial Real Estate Corporation",30,293,0],["ACRS","Aclaris Therapeutics Inc.",8,340,0],["ACRV","Acrivon Therapeutics Inc.",8,68,0],["ACT","Enact Holdings Inc.",28,5834,0],["ACTG","Acacia Research Corporation (Acacia Tech)",29,357,0],["ACTU","Actuate Therapeutics Inc.",8,274,0],["ACU","Acme United Corporation.",7,161,0],["ACV","Virtus Diversified Income & Convertible Fund",123,270,0],["ACVA","ACV Auctions Inc. Class A",36,1343,0],["ACVF","ACVF",1,0,0],["ACVT","ACVT",1,0,0],["ACWI","ACWI",1,0,0],["ACWX","ACWX",1,0,0],["ACXP","Acurx Pharmaceuticals Inc.",8,7,0],["AD","Array Digital Infrastructure Inc.",33,4481,0],["ADACU","American Drive Acquisition Company",2,0,0],["ADAG","Adagene Inc.",8,86,0],["ADAM","Adamas Trust Inc.",25,675,0],["ADAMG","Adamas Trust Inc. 9.125% Senior Notes Due 2030",30,0,0],["ADAMH","Adamas Trust Inc. 9.875% Senior Notes Due 2030",30,0,0],["ADAMI","Adamas Trust Inc. 9.125% Senior Notes Due 2029",30,2271,0],["ADAML","Adamas Trust Inc. 6.875% Series F Fixed-to-Floating Rate Cumulative Redeemable",30,2064,0],["ADAMM","Adamas Trust Inc. 7.875% Series E Fixed-to-Floating Rate Cumulative Redeemable",30,2269,0],["ADAMN","Adamas Trust Inc. 8.00% Series D Fixed-to-Floating Rate Cumulative Redeemable",30,2018,0],["ADAMZ","Adamas Trust Inc. 7.000% Series G Cumulative Redeemable",30,1744,0],["ADBE","Adobe Inc.",25,148963,0],["ADBG","ADBG",1,0,0],["ADC","Agree Realty Corporation",30,8287,0],["ADC/PA","ADC/PA",1,0,0],["ADCT","ADC Therapeutics SA",8,462,0],["ADEA","Adeia Inc.",25,1398,0],["ADGM","Adagio Medical Holdings Inc",31,29,0],["ADI","Analog Devices Inc.",6,134381,0],["ADIL","Adial Pharmaceuticals Inc",8,10,0],["ADIV","ADIV",1,0,0],["ADM","Archer-Daniels-Midland Company",17,27988,0],["ADMA","ADMA Biologics Inc",13,4660,0],["ADNT","Adient plc",42,1550,0],["ADP","Automatic Data Processing Inc.",12,104324,0],["ADPT","Adaptive Biotechnologies Corporation",13,2595,0],["ADPV","ADPV",1,0,0],["ADSE","ADS-TEC ENERGY PLC",32,735,0],["ADSK","Autodesk Inc.",25,63617,0],["ADT","ADT Inc.",12,6665,0],["ADTN","ADTRAN Holdings Inc.",33,696,0],["ADTX","Aditxt Inc.",8,1,0],["ADUR","Aduro Clean Technologies Inc.",34,367,0],["ADUS","Addus HomeCare Corporation",35,2085,0],["ADV","Advantage Solutions Inc. Class A",36,298,0],["ADVB","Advanced Biomed Inc.",23,8,0],["ADVE","ADVE",1,0,0],["ADX","Adams Diversified Equity Fund Inc.",11,0,0],["ADXN","Addex Therapeutics Ltd",8,13,0],["AEAQU","Activate Energy Acquisition Corp. Unit",1,0,0],["AEBI","Aebi Schmidt Holding AG",37,1024,0],["AEC","Anfield Energy Inc.",10,78,0],["AEE","Ameren Corporation",129,26638,0],["AEF","abrdn Emerging Markets ex-China Fund Inc.",123,739,0],["AEFC","Aegon Funding Company LLC 5.10% Subordinated Notes due 2049",1,0,0],["AEG","Aegon Ltd. New York Registry Shares",5,15127,0],["AEHL","Antelope Enterprise Holdings Limited Class A",38,6,0],["AEHR","Aehr Test Systems",39,654,0],["AEI","Alset Inc.",36,105,0],["AEIS","Advanced Energy Industries Inc.",7,8156,0],["AEM","Agnico Eagle Mines Limited",104,87578,0],["AEMD","Aethlon Medical Inc.",31,2,0],["AENT","Alliance Entertainment Holding Corporation Class A",40,398,0],["AEO","American Eagle Outfitters Inc.",120,4719,0],["AEON","AEON Biopharma Inc. Class A",8,13,0],["AEP","American Electric Power Company Inc.",41,61283,0],["AER","AerCap Holdings N.V.",12,27042,0],["AERO","Grupo Aeromexico S.A.B. de C.V.",4,3108,0],["AERT","Aeries Technology Inc. Class A",19,31,0],["AES","The AES Corporation",41,9635,0],["AESI","Atlas Energy Solutions Inc.",74,1142,0],["AETH","AETH",1,0,0],["AEVA","Aeva Technologies Inc.",42,859,0],["AEXA","American Exceptionalism Acquisition Corp. A Class A",1,0,0],["AEYE","AudioEye Inc.",25,137,0],["AFB","AllianceBernstein National Municipal Income Fund Inc",81,0,0],["AFBI","Affinity Bancshares Inc.",43,139,0],["AFCG","Advanced Flower Capital Inc.",36,65,0],["AFG","American Financial Group Inc.",22,11465,0],["AFGB","American Financial Group Inc. 5.875% Subordinated Debentures due 2059",22,1810,0],["AFGC","American Financial Group Inc. 5.125% Subordinated Debentures due 2059",22,1589,0],["AFGD","American Financial Group Inc. 5.625% Subordinated Debentures due 2060",22,1748,0],["AFGE","American Financial Group Inc. 4.500% Subordinated Debentures due 2060",22,1418,0],["AFIX","AFIX",1,0,0],["AFJK","Aimei Health Technology Co. Ltd",1,0,0],["AFJKU","Aimei Health Technology Co. Ltd Unit",1,0,0],["AFK","AFK",1,0,0],["AFL","AFLAC Incorporated",143,57841,0],["AFLG","AFLG",1,0,0],["AFMC","AFMC",1,0,0],["AFOS","AFOS",1,0,0],["AFRI","Forafric Global PLC",17,291,0],["AFRM","Affirm Holdings Inc. Class A",44,25158,0],["AFSC","AFSC",1,0,0],["AFSM","AFSM",1,0,0],["AFYA","Afya Limited Class A",3,1316,0],["AG","First Majestic Silver Corp.",104,8199,0],["AGAE","Allied Gaming & Entertainment Inc.",45,14,0],["AGCC","Agencia Comercial Spirits Ltd Class A",46,345,0],["AGCO","AGCO Corporation",7,7894,0],["AGD","abrdn Global Dynamic Dividend Fund",81,0,0],["AGEM","AGEM",1,0,0],["AGEN","Agenus Inc.",13,117,0],["AGG","AGG",1,0,0],["AGGA","AGGA",1,0,0],["AGGH","AGGH",1,0,0],["AGGS","AGGS",1,0,0],["AGGY","AGGY",1,0,0],["AGH","Aureus Greenway Holdings Inc.",47,61,0],["AGI","Alamos Gold Inc. Class A",104,16188,0],["AGIG","Abundia Global Impact Group Inc.",59,63,0],["AGIO","Agios Pharmaceuticals Inc.",8,1426,0],["AGIQ","AGIQ",1,0,0],["AGIX","AGIX",1,0,0],["AGL","agilon health inc.",137,305,0],["AGM","Federal Agricultural Mortgage Corporation",116,1931,0],["AGM.A","AGM.A",1,0,0],["AGM/PD","AGM/PD",1,0,0],["AGM/PE","AGM/PE",1,0,0],["AGM/PF","AGM/PF",1,0,0],["AGM/PG","AGM/PG",1,0,0],["AGM/PH","AGM/PH",1,0,0],["AGMH","AGM Group Holdings Inc. Class A",15,5,0],["AGMI","AGMI",1,0,0],["AGNC","AGNC Investment Corp.",30,11435,0],["AGNCL","AGNC Investment Corp.",30,26668,0],["AGNCM","AGNC Investment Corp.",30,26807,0],["AGNCN","AGNC Investment Corp.",30,27569,0],["AGNCO","AGNC Investment Corp.",30,27344,0],["AGNCP","AGNC Investment Corp.",30,26882,0],["AGNCZ","AGNC Investment Corp.",1,27666,0],["AGNG","AGNG",1,0,0],["AGO","Assured Guaranty Ltd.",22,4173,0],["AGOX","AGOX",1,0,0],["AGPU","Axe Compute Inc.",32,23,0],["AGQ","AGQ",1,0,0],["AGQI","AGQI",1,0,0],["AGRH","AGRH",1,0,0],["AGRO","Adecoagro S.A.",48,1040,0],["AGRW","AGRW",1,0,0],["AGRZ","Agroz Inc.",48,39,0],["AGX","Argan Inc.",82,4517,0],["AGYS","Agilysys Inc.",15,3407,0],["AGZ","AGZ",1,0,0],["AGZD","AGZD",1,0,0],["AHCO","AdaptHealth Corp.",35,1350,0],["AHG","Akso Health Group ADS",36,712,0],["AHH","Armada Hoffler Properties Inc.",36,541,0],["AHH/PA","AHH/PA",1,0,0],["AHL","Aspen Insurance Holdings Limited Class A",22,3407,0],["AHL/PD","AHL/PD",1,0,0],["AHL/PE","AHL/PE",1,0,0],["AHL/PF","AHL/PF",1,0,0],["AHLT","AHLT",1,0,0],["AHMA","Ambitions Enterprise Management Co. L.L.C Class A",45,213,0],["AHR","American Healthcare REIT Inc.",30,9061,0],["AHT","Ashford Hospitality Trust Inc",30,24,0],["AHT/PD","AHT/PD",1,0,0],["AHT/PF","AHT/PF",1,0,0],["AHT/PG","AHT/PG",1,0,0],["AHT/PH","AHT/PH",1,0,0],["AHT/PI","AHT/PI",1,0,0],["AHYB","AHYB",1,0,0],["AI","C3.ai Inc. Class A",25,2032,0],["AIA","AIA",1,0,0],["AIBD","AIBD",1,0,0],["AIBU","AIBU",1,0,0],["AIEQ","AIEQ",1,0,0],["AIFD","AIFD",1,0,0],["AIFF","Firefly Neuroscience Inc.",25,18,0],["AIFU","AIFU Inc. Class A",28,38,0],["AIG","American International Group Inc. New",5,46420,0],["AIHS","Senmiao Technology Limited",44,4,0],["AII","American Integrity Insurance Group Inc.",22,402,0],["AIIA","AI Infrastructure Acquisition Corp. Class A",2,0,0],["AIIA.U","AIIA.U",1,0,0],["AIIO","Robo.ai Inc. Class B",37,91,0],["AIM","AIM ImmunoTech Inc.",13,4,0],["AIMD","Ainos Inc.",8,10,0],["AIN","Albany International Corporation",115,1448,0],["AINP","AINP",1,0,0],["AIO","Virtus Artificial Intelligence & Technology Opportunities Fund",123,780,0],["AIOT","PowerFleet Inc.",33,717,0],["AIP","Arteris Inc.",6,746,0],["AIPI","AIPI",1,0,0],["AIPO","AIPO",1,0,0],["AIQ","AIQ",1,0,0],["AIR","AAR Corp.",50,2987,0],["AIRE","reAlpha Tech Corp.",36,56,0],["AIRG","Airgain Inc.",49,48,0],["AIRI","Air Industries Group",21,14,0],["AIRJ","AirJoule Technologies Corporation Class A",7,203,0],["AIRO","AIRO Group Holdings Inc.",50,251,0],["AIRR","AIRR",1,0,0],["AIRS","AirSculpt Technologies Inc.",35,137,0],["AIRT","Air T Inc.",4,50,0],["AIRTP","Air T Inc. Air T Funding Alpha Income Trust Preferred Securities",4,53,0],["AIS","AIS",1,0,0],["AISP","Airship AI Holdings Inc. Class A",25,103,0],["AIT","Applied Industrial Technologies Inc.",32,9898,0],["AIV","Apartment Investment and Management Company",30,810,0],["AIVC","AIVC",1,0,0],["AIVI","AIVI",1,0,0],["AIVL","AIVL",1,0,0],["AIXC","AIxCrypto Holdings Inc.",8,64,0],["AIXI","XIAO-I Corporation",25,6,0],["AIYY","AIYY",1,0,0],["AIZ","Assurant Inc.",22,11970,0],["AIZN","Assurant Inc. 5.25% Subordinated Notes due 2061",22,998,0],["AJG","Arthur J. Gallagher & Co.",28,65071,0],["AKA","a.k.a. Brands Holding Corp.",57,116,0],["AKAF","AKAF",1,0,0],["AKAM","Akamai Technologies Inc.",36,12836,0],["AKAN","Akanda Corp.",18,0,0],["AKBA","Akebia Therapeutics Inc.",8,441,0],["AKO.A","AKO.A",1,0,0],["AKO.B","AKO.B",1,0,0],["AKR","Acadia Realty Trust",30,2699,0],["AKRE","AKRE",1,0,0],["AKTX","Akari Therapeutics plc ADS",8,12,0],["AL","Air Lease Corporation Class A",12,7170,0],["ALAB","Astera Labs Inc.",6,27768,0],["ALAI","ALAI",1,0,0],["ALAR","Alarum Technologies Ltd. American",25,54,0],["ALB","Albemarle Corporation",34,17170,0],["ALB/PA","ALB/PA",1,0,0],["ALBT","Avalon GloboCare Corp.",13,5,0],["ALC","Alcon Inc.",111,39554,0],["ALCO","Alico Inc.",1,288,0],["ALCY","Alchemy Investments Acquisition Corp 1 Class A",2,0,0],["ALDF","Aldel Financial II Inc. Class A",1,0,0],["ALDFU","Aldel Financial II Inc.",2,0,0],["ALDX","Aldeyra Therapeutics Inc.",8,298,0],["ALEC","Alector Inc.",13,153,0],["ALEX","Alexander & Baldwin Inc.",30,1502,0],["ALF","Centurion Acquisition Corp. Class A",1,0,0],["ALG","Alamo Group Inc.",7,2107,0],["ALGM","Allegro MicroSystems Inc.",6,4943,0],["ALGN","Align Technology Inc.",32,11314,0],["ALGS","Aligos Therapeutics Inc.",13,66,0],["ALGT","Allegiant Travel Company",4,1559,0],["ALH","Alliance Laundry Holdings Inc.",7,4035,0],["ALHC","Alignment Healthcare Inc.",23,4086,0],["ALIL","ALIL",1,0,0],["ALIS","Calisa Acquisition Corp",1,0,0],["ALISU","ALISU",1,0,0],["ALIT","Alight Inc. Class A",36,1034,0],["ALK","Alaska Air Group Inc.",4,6031,0],["ALKS","Alkermes plc",8,4698,0],["ALKT","Alkami Technology Inc.",25,2387,0],["ALL","Allstate Corporation (The)",22,53645,0],["ALL/PB","ALL/PB",1,0,0],["ALL/PH","ALL/PH",1,0,0],["ALL/PI","ALL/PI",1,0,0],["ALL/PJ","ALL/PJ",1,0,0],["ALLE","Allegion plc",12,13765,0],["ALLO","Allogene Therapeutics Inc.",13,319,0],["ALLR","Allarity Therapeutics Inc.",8,16,0],["ALLT","Allot Ltd.",51,354,0],["ALLW","ALLW",1,0,0],["ALLY","Ally Financial Inc.",26,14075,0],["ALM","Almonty Industries Inc.",52,1902,0],["ALMS","Alumis Inc.",8,1179,0],["ALMU","Aeluma Inc.",6,259,0],["ALNT","Allient Inc.",39,933,0],["ALNY","Alnylam Pharmaceuticals Inc.",8,52876,0],["ALOT","AstroNova Inc.",53,62,0],["ALPS","ALPS Group Inc",1,158,0],["ALRG","ALRG",1,0,0],["ALRM","Alarm.com Holdings Inc.",25,2627,0],["ALRS","Alerus Financial Corporation",26,576,0],["ALSN","Allison Transmission Holdings Inc.",42,8216,0],["ALT","Altimmune Inc.",8,407,0],["ALTG","Alta Equipment Group Inc. Class A",7,157,0],["ALTG/PA","ALTG/PA",1,0,0],["ALTI","AlTi Global Inc. Class A",11,716,0],["ALTL","ALTL",1,0,0],["ALTO","Alto Ingredients Inc.",34,229,0],["ALTS","ALT5 Sigma Corporation",44,161,0],["ALTY","ALTY",1,0,0],["ALUB.U","ALUB.U",1,0,0],["ALUR","Allurion Technologies Inc.",31,14,0],["ALV","Autoliv Inc.",42,9197,0],["ALVO","Alvotech",13,1479,0],["ALX","Alexander\'s Inc.",30,1106,0],["ALXO","ALX Oncology Holdings Inc.",8,79,0],["ALZN","Alzamend Neuro Inc.",8,8,0],["AM","Antero Midstream Corporation",107,8340,0],["AMAL","Amalgamated Financial Corp.",26,987,0],["AMAT","Applied Materials Inc.",6,203319,0],["AMAX","AMAX",1,0,0],["AMBA","Ambarella Inc.",6,3122,0],["AMBO","Ambow Education Holding Ltd. American Depository Shares (each representing twenty (20) Class A",3,10,0],["AMBP","Ardagh Metal Packaging S.A.",125,2427,0],["AMBQ","Ambiq Micro Inc.",6,556,0],["AMBR","Amber International Holding Limited",44,160,0],["AMC","AMC Entertainment Holdings Inc. Class A",89,898,0],["AMCI","AMC Robotics Corporation",73,37,0],["AMCR","Amcor plc",69,19136,0],["AMCX","AMC Networks Inc. Class A",54,419,0],["AMD","Advanced Micro Devices Inc.",6,347473,0],["AMDD","AMDD",1,0,0],["AMDG","AMDG",1,0,0],["AMDL","AMDL",1,0,0],["AMDU","AMDU",1,0,0],["AMDY","AMDY",1,0,0],["AME","AMETEK Inc.",7,46798,0],["AMG","Affiliated Managers Group Inc.",11,7850,0],["AMGN","Amgen Inc.",13,176288,0],["AMH","American Homes 4 Rent",30,11549,0],["AMH/PG","AMH/PG",1,0,0],["AMH/PH","AMH/PH",1,0,0],["AMID","AMID",1,0,0],["AMIX","Autonomix Medical Inc.",31,4,0],["AMJB","AMJB",1,0,0],["AMKR","Amkor Technology Inc.",6,9984,0],["AMLP","AMLP",1,0,0],["AMLX","Amylyx Pharmaceuticals Inc.",8,1320,0],["AMN","AMN Healthcare Services Inc",19,616,0],["AMOD","Alpha Modus Holdings Inc. Class A",29,26,0],["AMOM","AMOM",1,0,0],["AMP","Ameriprise Financial Inc.",11,45447,0],["AMPG","Amplitech Group Inc.",33,63,0],["AMPH","Amphastar Pharmaceuticals Inc.",8,1222,0],["AMPL","Amplitude Inc. Class A",25,1531,0],["AMPX","Amprius Technologies Inc.",7,1220,0],["AMPY","Amplify Energy Corp.",59,192,0],["AMR","Alpha Metallurgical Resources Inc.",65,2675,0],["AMRC","Ameresco Inc. Class A",82,1564,0],["AMRN","Amarin Corporation plc",8,287,0],["AMRX","Amneal Pharmaceuticals Inc. Class A",8,3952,0],["AMRZ","Amrize Ltd",38,30016,0],["AMS","American Shared Hospital Services",23,14,0],["AMSC","American Superconductor Corporation",55,1385,0],["AMSF","AMERISAFE Inc.",22,739,0],["AMST","Amesite Inc.",25,12,0],["AMT","American Tower Corporation (REIT)",30,80713,0],["AMTB","Amerant Bancorp Inc. Class A",26,832,0],["AMTD","AMTD IDEA Group",44,99,0],["AMTM","Amentum Holdings Inc.",36,7115,0],["AMTX","Aemetis Inc. (DE)",34,97,0],["AMUB","AMUB",1,0,0],["AMUN","AMUN",1,0,0],["AMUU","AMUU",1,0,0],["AMWD","American Woodmark Corporation",56,795,0],["AMWL","American Well Corporation Class A",36,76,0],["AMX","America Movil S.A.B. de C.V.",33,61894,0],["AMYY","AMYY",1,0,0],["AMZA","AMZA",1,0,0],["AMZD","AMZD",1,0,0],["AMZE","Amaze Holdings Inc.",46,8,0],["AMZN","Amazon.com Inc.",57,2430421,0],["AMZU","AMZU",1,0,0],["AMZY","AMZY",1,0,0],["AMZZ","AMZZ",1,0,0],["AN","AutoNation Inc.",97,7627,0],["ANAB","AnaptysBio Inc.",8,1359,0],["ANDE","Andersons Inc. (The)",48,1824,0],["ANDG","Andersen Group Inc. Class A",36,0,0],["ANEB","Anebulo Pharmaceuticals Inc.",8,89,0],["ANEL","ANEL",1,0,0],["ANET","Arista Networks Inc.",51,165117,0],["ANEW","ANEW",1,0,0],["ANF","Abercrombie & Fitch Company",120,5552,0],["ANG/PD","ANG/PD",1,0,0],["ANGH","Anghami Inc.",33,17,0],["ANGI","Angi Inc. Class A",58,552,0],["ANGL","ANGL",1,0,0],["ANGO","AngioDynamics Inc.",31,551,0],["ANGX","Angel Studios Inc. Class A",89,1082,0],["ANIK","Anika Therapeutics Inc.",31,138,0],["ANIP","ANI Pharmaceuticals Inc.",8,1861,0],["ANIX","Anixa Biosciences Inc.",8,109,0],["ANL","Adlai Nortye Ltd.",8,56,0],["ANNA","AleAnna Inc. Class A",59,206,0],["ANNX","Annexon Inc.",8,619,0],["ANPA","Rich Sparkle Holdings Limited",3,267,0],["ANRO","Alto Neuroscience Inc.",8,621,0],["ANSC","Agriculture & Natural Solutions Acquisition Corporation Class A",1,0,0],["ANTA","Antalpha Platform Holding Company Class A",60,227,0],["ANTX","AN2 Therapeutics Inc.",8,31,0],["ANVS","Annovis Bio Inc.",8,97,0],["ANY","Sphere 3D Corp.",44,16,0],["AOA","AOA",1,0,0],["AOD","abrdn Total Dynamic Dividend Fund",11,0,0],["AOHY","AOHY",1,0,0],["AOK","AOK",1,0,0],["AOM","AOM",1,0,0],["AOMD","Angel Oak Mortgage REIT Inc. 9.750% Senior Notes due 2030",36,0,0],["AOMN","Angel Oak Mortgage REIT Inc. 9.500% Senior Notes due 2029",36,0,0],["AOMR","Angel Oak Mortgage REIT Inc.",36,217,0],["AON","Aon plc Class A",28,75236,0],["AOR","AOR",1,0,0],["AORT","Artivion Inc.",31,2205,0],["AOS","A.O. Smith Corporation",133,9470,0],["AOSL","Alpha and Omega Semiconductor Limited",6,611,0],["AOTG","AOTG",1,0,0],["AOUT","American Outdoor Brands Inc.",61,106,0],["AP","Ampco-Pittsburgh Corporation",148,83,0],["APA","APA Corporation",59,8555,0],["APAC","StoneBridge Acquisition II Corporation Class A",1,0,0],["APACU","StoneBridge Acquisition II Corporation",2,0,0],["APAD","A Paradise Acquisition Corp. Class A",1,0,0],["APADU","A Paradise Acquisition Corp. Unit",1,0,0],["APAM","Artisan Partners Asset Management Inc. Class A",11,3348,0],["APCB","APCB",1,0,0],["APD","Air Products and Chemicals Inc.",34,53413,0],["APED","APED",1,0,0],["APEI","American Public Education Inc.",3,694,0],["APG","APi Group Corporation",82,16170,0],["APGE","Apogee Therapeutics Inc.",13,5366,0],["APH","Amphenol Corporation",39,165602,0],["API","Agora Inc.",25,368,0],["APIE","APIE",1,0,0],["APLD","Applied Digital Corporation",44,7777,0],["APLE","Apple Hospitality REIT Inc.",30,2879,0],["APLM","Apollomics Inc. Class A",8,18,0],["APLS","Apellis Pharmaceuticals Inc.",8,3119,0],["APLT","Applied Therapeutics Inc.",8,18,0],["APLU","APLU",1,0,0],["APLY","APLY",1,0,0],["APM","Aptorum Group Limited Class A",8,9,0],["APMU","APMU",1,0,0],["APO","Apollo Global Management Inc. (New)",11,84939,0],["APO/PA","APO/PA",1,0,0],["APOG","Apogee Enterprises Inc.",42,834,0],["APOS","Apollo Global Management Inc. 7.625% Fixed-Rate Resettable Junior Subordinated Notes due 2053",11,14825,0],["APP","Applovin Corporation Class A",16,243791,0],["APPF","AppFolio Inc. Class A",25,8394,0],["APPN","Appian Corporation Class A",25,2720,0],["APPS","Digital Turbine Inc.",29,590,0],["APPX","APPX",1,0,0],["APRE","Aprea Therapeutics Inc.",8,6,0],["APRT","APRT",1,0,0],["APRW","APRW",1,0,0],["APT","Alpha Pro Tech Ltd.",32,45,0],["APTV","Aptiv PLC",42,16917,0],["APUE","APUE",1,0,0],["APUS","Apimeds Pharmaceuticals US Inc.",8,19,0],["APVO","Aptevo Therapeutics Inc.",8,22,0],["APWC","Asia Pacific Wire & Cable Corporation Ltd.",33,38,0],["APXT","Apex Treasury Corporation Class A",25,0,0],["APXTU","Apex Treasury Corporation",2,0,0],["APYX","Apyx Medical Corporation",31,143,0],["AQB","AquaBounty Technologies Inc.",62,3,0],["AQMS","Aqua Metals Inc.",55,52,0],["AQN","Algonquin Power & Utilities Corp.",41,4732,0],["AQNB","Algonquin Power & Utilities Corp. 6.20% Fixed-to-Floating Subordinated Notes Series 2019-A due July 1 2079",41,19623,0],["AQST","Aquestive Therapeutics Inc.",8,708,0],["AQWA","AQWA",1,0,0],["AR","Antero Resources Corporation",59,10495,0],["ARAI","Arrive AI Inc.",12,108,0],["ARAY","Accuray Incorporated",31,103,0],["ARB","ARB",1,0,0],["ARBB","ARB IOT Group Limited",15,12,0],["ARBE","Arbe Robotics Ltd.",15,124,0],["ARBK","Argo Blockchain plc",44,64,0],["ARCB","ArcBest Corporation",63,1765,0],["ARCC","Ares Capital Corporation",44,14272,0],["ARCO","Arcos Dorados Holdings Inc. Class A Shares",68,1517,0],["ARCT","Arcturus Therapeutics Holdings Inc.",8,186,0],["ARDC","Ares Dynamic Credit Allocation Fund Inc.",11,304,0],["ARDT","Ardent Health Inc.",126,1261,0],["ARDX","Ardelyx Inc.",8,1380,0],["ARE","Alexandria Real Estate Equities Inc.",30,8285,0],["AREA","AREA",1,0,0],["AREB","American Rebel Holdings Inc.",64,6,0],["AREC","American Resources Corporation Class A",65,193,0],["AREN","The Arena Group Holdings Inc.",15,200,0],["ARES","Ares Management Corporation Class A",11,54156,0],["ARES/PB","ARES/PB",1,0,0],["ARGT","ARGT",1,0,0],["ARGX","argenx SE",13,52147,0],["ARHS","Arhaus Inc. Class A",66,1632,0],["ARI","Apollo Commercial Real Estate Finance Inc",30,1394,0],["ARKO","ARKO Corp.",67,549,0],["ARKR","Ark Restaurants Corp.",68,22,0],["ARL","American Realty Investors Inc.",3,262,0],["ARLO","Arlo Technologies Inc.",133,1489,0],["ARLP","Alliance Resource Partners L.P. Common",65,2992,0],["ARM","Arm Holdings plc",6,120788,0],["ARMG","ARMG",1,0,0],["ARMH","ARMH",1,0,0],["ARMK","Aramark",68,9984,0],["ARMN","Aris Mining Corporation",1,3225,0],["ARMP","Armata Pharmaceuticals Inc.",13,311,0],["AROC","Archrock Inc.",107,4444,0],["AROW","Arrow Financial Corporation",26,525,0],["ARP","ARP",1,0,0],["ARQ","Arq Inc.",34,137,0],["ARQQ","Arqit Quantum Inc.",25,399,0],["ARQT","Arcutis Biotherapeutics Inc.",8,3431,0],["ARR","ARMOUR Residential REIT Inc.",30,1947,0],["ARR/PC","ARR/PC",1,0,0],["ARRY","Array Technologies Inc.",69,1450,0],["ARTL","Artelo Biosciences Inc.",8,3,0],["ARTNA","Artesian Resources Corporation Class A",70,327,0],["ARTV","Artiva Biotherapeutics Inc.",13,116,0],["ARTW","Art\'s-Way Manufacturing Co. Inc.",7,11,0],["ARTY","ARTY",1,0,0],["ARVN","Arvinas Inc.",8,750,0],["ARVR","ARVR",1,0,0],["ARW","Arrow Electronics Inc.",76,5831,0],["ARWR","Arrowhead Pharmaceuticals Inc.",8,9745,0],["ARX","Accelerant Holdings Class A",28,3618,0],["AS","Amer Sports Inc.",86,21162,0],["ASA","ASA Gold and Precious Metals Limited",104,1108,0],["ASAN","Asana Inc. Class A",25,3433,0],["ASB","Associated Banc-Corp",26,4385,0],["ASB/PE","ASB/PE",1,0,0],["ASB/PF","ASB/PF",1,0,0],["ASBP","Aspire Biopharma Holdings Inc.",8,14,0],["ASC","Ardmore Shipping Corporation",98,441,0],["ASCE","ASCE",1,0,0],["ASCI","ASCI",1,0,0],["ASEA","ASEA",1,0,0],["ASG","Liberty All-Star Growth Fund Inc.",11,0,0],["ASGI","abrdn Global Infrastructure Income Fund",11,0,0],["ASGM","ASGM",1,0,0],["ASGN","ASGN Incorporated",19,2084,0],["ASH","Ashland Inc.",135,2718,0],["ASHR","ASHR",1,0,0],["ASHS","ASHS",1,0,0],["ASIA","ASIA",1,0,0],["ASIC","Ategrity Specialty Insurance Company Holdings",22,994,0],["ASIX","AdvanSix Inc.",34,445,0],["ASLE","AerSale Corporation",32,331,0],["ASLV","ASLV",1,0,0],["ASM","Avino Silver & Gold Mines Ltd.",10,1007,0],["ASMB","Assembly Biosciences Inc.",8,558,0],["ASMF","ASMF",1,0,0],["ASMG","ASMG",1,0,0],["ASMH","ASMH",1,0,0],["ASML","ASML Holding N.V. New York Registry Shares",7,415315,0],["ASND","Ascendis Pharma A/S",8,12137,0],["ASNS","Actelis Networks Inc.",33,2,0],["ASO","Academy Sports and Outdoors Inc.",66,3581,0],["ASPC","A SPAC III Acquisition Corp. Class A",2,0,0],["ASPCU","A SPAC III Acquisition Corp. Unit",2,0,0],["ASPI","ASP Isotopes Inc.",34,674,0],["ASPN","Aspen Aerogels Inc.",130,245,0],["ASPS","Altisource Portfolio Solutions S.A.",3,74,0],["ASR","Grupo Aeroportuario del Sureste S.A. de C.V.",50,9676,0],["ASRT","Assertio Holdings Inc.",8,69,0],["ASRV","AmeriServ Financial Inc.",26,50,0],["ASST","Strive Inc. Class A",25,733,0],["ASTC","Astrotech Corporation (DE)",71,6,0],["ASTE","Astec Industries Inc.",72,1044,0],["ASTH","Astrana Health Inc.",19,1344,0],["ASTI","Ascent Solar Technologies Inc.",6,15,0],["ASTL","Algoma Steel Group Inc.",27,453,0],["ASTS","AST SpaceMobile Inc. Class A",33,27835,0],["ASUR","Asure Software Inc",15,246,0],["ASX","ASE Technology Holding Co. Ltd.",6,33477,0],["ASYS","Amtech Systems Inc.",7,175,0],["ATAI","Atai Beckley N.V",8,1438,0],["ATAT","Atour Lifestyle Holdings Limited",47,5776,0],["ATCH","AtlasClear Holdings Inc.",44,40,0],["ATEC","Alphatec Holdings Inc.",31,2972,0],["ATEN","A10 Networks Inc.",51,1288,0],["ATER","Aterian Inc.",73,7,0],["ATEX","Anterix Inc.",33,414,0],["ATFV","ATFV",1,0,0],["ATGE","Adtalem Global Education Inc.",3,3655,0],["ATGL","Alpha Technology Group Limited Class A",15,381,0],["ATH/PA","ATH/PA",1,0,0],["ATH/PB","ATH/PB",1,0,0],["ATH/PD","ATH/PD",1,0,0],["ATH/PE","ATH/PE",1,0,0],["ATHA","Athira Pharma Inc.",13,27,0],["ATHE","Alterity Therapeutics Limited",8,47,0],["ATHM","Autohome Inc.",15,2731,0],["ATHR","Aether Holdings Inc.",25,74,0],["ATHS","Athene Holding Ltd. 7.250% Fixed-Rate Reset Junior Subordinated Debentures due 2064",5,5105,0],["ATI","ATI Inc.",27,15391,0],["ATII","Archimedes Tech SPAC Partners II Co.",1,0,0],["ATKR","Atkore Inc.",7,2165,0],["ATLC","Atlanticus Holdings Corporation",44,1048,0],["ATLCL","Atlanticus Holdings Corporation 6.125% Senior Notes due 2026",44,372,0],["ATLCP","Atlanticus Holdings Corporation 7.625% Series B Cumulative Perpetual",44,363,0],["ATLCZ","Atlanticus Holdings Corporation 9.25% Senior Notes due 2029",44,386,0],["ATLN","Atlantic International Corp.",71,76,0],["ATLO","Ames National Corporation",26,207,0],["ATLX","Atlas Lithium Corporation",74,141,0],["ATMC","ATMC",1,0,0],["ATMCU","ATMCU",1,0,0],["ATMU","Atmus Filtration Technologies Inc.",42,4366,0],["ATNI","ATN International Inc.",33,339,0],["ATNM","Actinium Pharmaceuticals Inc. (Delaware)",8,53,0],["ATO","Atmos Energy Corporation",140,26954,0],["ATOM","Atomera Incorporated",6,74,0],["ATON","AlphaTON Capital Corp.",59,6,0],["ATOS","Atossa Therapeutics Inc.",8,94,0],["ATPC","Agape ATP Corporation",35,6,0],["ATR","AptarGroup Inc.",64,7966,0],["ATRA","Atara Biotherapeutics Inc.",13,124,0],["ATRC","AtriCure Inc.",31,2036,0],["ATRO","Astronics Corporation",21,1952,0],["ATS","ATS Corporation",7,2733,0],["ATXG","Addentax Group Corp.",19,5,0],["ATXS","Astria Therapeutics Inc.",8,732,0],["ATYR","aTyr Pharma Inc.",13,73,0],["AU","AngloGold Ashanti PLC",104,43404,0],["AUAU","AUAU",1,0,0],["AUB","Atlantic Union Bankshares Corporation",26,5216,0],["AUB/PA","AUB/PA",1,0,0],["AUBN","Auburn National Bancorporation Inc.",26,98,0],["AUDC","AudioCodes Ltd.",33,268,0],["AUGO","Aura Minerals Inc.",1,4180,0],["AUGT","AUGT",1,0,0],["AUGW","AUGW",1,0,0],["AUID","authID Inc.",25,12,0],["AUMI","AUMI",1,0,0],["AUNA","Auna SA Class A",35,341,0],["AUPH","Aurinia Pharmaceuticals Inc",8,2133,0],["AUR","Aurora Innovation Inc. Class A",15,8051,0],["AURA","Aura Biosciences Inc.",13,372,0],["AURE","Aurelion Inc. Class A",44,12,0],["AUSF","AUSF",1,0,0],["AUSM","AUSM",1,0,0],["AUST","Austin Gold Corp.",104,24,0],["AUTL","Autolus Therapeutics plc American",13,434,0],["AUUD","Auddia Inc.",15,3,0],["AVA","Avista Corporation",129,3067,0],["AVAH","Aveanna Healthcare Holdings Inc.",35,1899,0],["AVAL","Grupo Aval Acciones y Valores S.A. ADR (Each representing 20",75,4867,0],["AVAV","AeroVironment Inc.",50,12132,0],["AVB","AvalonBay Communities Inc.",30,25364,0],["AVBC","Avidia Bancorp Inc.",43,350,0],["AVBH","Avidbank Holdings Inc.",75,300,0],["AVBP","ArriVent BioPharma Inc.",8,909,0],["AVD","American Vanguard Corporation",85,111,0],["AVDE","AVDE",1,0,0],["AVDL","Avadel Pharmaceuticals plc",8,2097,0],["AVDS","AVDS",1,0,0],["AVDV","AVDV",1,0,0],["AVEE","AVEE",1,0,0],["AVEM","AVEM",1,0,0],["AVES","AVES",1,0,0],["AVGB","AVGB",1,0,0],["AVGE","AVGE",1,0,0],["AVGG","AVGG",1,0,0],["AVGO","Broadcom Inc.",6,1607304,0],["AVGU","AVGU",1,0,0],["AVGV","AVGV",1,0,0],["AVGX","AVGX",1,0,0],["AVIE","AVIE",1,0,0],["AVIG","AVIG",1,0,0],["AVIR","Atea Pharmaceuticals Inc.",8,245,0],["AVIV","AVIV",1,0,0],["AVK","Advent Convertible and Income Fund",81,0,0],["AVL","AVL",1,0,0],["AVLC","AVLC",1,0,0],["AVLV","AVLV",1,0,0],["AVMA","AVMA",1,0,0],["AVMC","AVMC",1,0,0],["AVMU","AVMU",1,0,0],["AVMV","AVMV",1,0,0],["AVNM","AVNM",1,0,0],["AVNS","Avanos Medical Inc.",32,542,0],["AVNT","Avient Corporation",34,2847,0],["AVNV","AVNV",1,0,0],["AVNW","Aviat Networks Inc.",49,268,0],["AVO","Mission Produce Inc.",48,932,0],["AVPT","AvePoint Inc. Class A",25,3008,0],["AVR","Anteris Technologies Global Corp.",32,204,0],["AVRE","AVRE",1,0,0],["AVS","AVS",1,0,0],["AVSC","AVSC",1,0,0],["AVSD","AVSD",1,0,0],["AVSE","AVSE",1,0,0],["AVSF","AVSF",1,0,0],["AVSU","AVSU",1,0,0],["AVT","Avnet Inc.",76,4047,0],["AVTR","Avantor Inc.",71,7684,0],["AVTX","Avalo Therapeutics Inc.",8,337,0],["AVUQ","AVUQ",1,0,0],["AVUS","AVUS",1,0,0],["AVUV","AVUV",1,0,0],["AVX","Avax One Technology Ltd.",44,115,0],["AVXC","AVXC",1,0,0],["AVXL","Anavex Life Sciences Corp.",13,328,0],["AVXX","AVXX",1,0,0],["AVY","Avery Dennison Corporation",125,14002,0],["AWAY","AWAY",1,0,0],["AWEG","AWEG",1,0,0],["AWF","Alliancebernstein Global High Income Fund",81,0,0],["AWI","Armstrong World Industries Inc",64,8031,0],["AWK","American Water Works Company Inc.",70,25415,0],["AWP","abrdn Global Premier Properties Fund",81,0,0],["AWR","American States Water Company",70,2829,0],["AWRE","Aware Inc.",25,44,0],["AWX","Avalon Holdings Corporation",122,10,0],["AX","Axos Financial Inc.",84,4957,0],["AXG","Solowin Holdings Class A",60,788,0],["AXGN","Axogen Inc.",77,1475,0],["AXIA","AXIA Energia",41,25614,0],["AXIA/P","AXIA/P",1,0,0],["AXIL","AXIL Brands Inc.",90,53,0],["AXIN","Axiom Intelligence Acquisition Corp 1 Class A",2,0,0],["AXL","American Axle & Manufacturing Holdings Inc.",42,787,0],["AXON","Axon Enterprise Inc.",78,46889,0],["AXP","American Express Company",44,259360,0],["AXR","AMREP Corporation",121,100,0],["AXS","Axis Capital Holdings Limited",22,8315,0],["AXS/PE","AXS/PE",1,0,0],["AXSM","Axsome Therapeutics Inc.",8,7695,0],["AXTA","Axalta Coating Systems Ltd.",149,6840,0],["AXTI","AXT Inc",6,683,0],["AYI","Acuity Inc.",91,11108,0],["AYTU","Aytu BioPharma Inc. ",8,26,0],["AZ","A2Z Cust2Mate Solutions Corp.",7,243,0],["AZI","Autozi Internet Technology (Global) Ltd. Class A",79,8,0],["AZN","AstraZeneca PLC",8,283349,0],["AZO","AutoZone Inc.",141,56424,0],["AZTA","Azenta Inc.",7,1583,0],["AZTD","AZTD",1,0,0],["AZTR","Azitra Inc",8,18,0],["AZYY","AZYY",1,0,0],["AZZ","AZZ Inc.",32,3240,0],["B","Barrick Mining Corporation",104,75479,0],["BA","Boeing Company (The)",50,162721,0],["BA/PA","BA/PA",1,0,0],["BAB","BAB",1,0,0],["BABA","Alibaba Group Holding Limited",36,345907,0],["BABO","BABO",1,0,0],["BABX","BABX",1,0,0],["BAC","Bank of America Corporation",26,403609,0],["BAC/PB","BAC/PB",1,0,0],["BAC/PE","BAC/PE",1,0,0],["BAC/PK","BAC/PK",1,0,0],["BAC/PL","BAC/PL",1,0,0],["BAC/PM","BAC/PM",1,0,0],["BAC/PN","BAC/PN",1,0,0],["BAC/PO","BAC/PO",1,0,0],["BAC/PP","BAC/PP",1,0,0],["BAC/PQ","BAC/PQ",1,0,0],["BAC/PS","BAC/PS",1,0,0],["BACC","Blue Acquisition Corp. Class A",2,0,0],["BACCU","Blue Acquisition Corp. Unit",2,0,0],["BACQ","Inflection Point Acquisition Corp. IV Class A",1,0,0],["BACQU","BACQU",1,0,0],["BAER","Bridger Aerospace Group Holdings Inc.",36,93,0],["BAFE","BAFE",1,0,0],["BAFN","BayFirst Financial Corp.",26,32,0],["BAH","Booz Allen Hamilton Holding Corporation",19,10342,0],["BAI","BAI",1,0,0],["BAIG","BAIG",1,0,0],["BAK","Braskem SA ADR",34,1265,0],["BALL","Ball Corporation",125,13943,0],["BALQ","BALQ",1,0,0],["BALY","Bally\'s Corporation",47,867,0],["BAM","Brookfield Asset Management Inc Class A Limited Voting Shares",3,84065,0],["BANC","Banc of California Inc.",26,2982,0],["BANC/PF","BANC/PF",1,0,0],["BAND","Bandwidth Inc. Class A",25,454,0],["BANF","BancFirst Corporation",26,3753,0],["BANFP","BancFirst Corporation - BFC Capital Trust II Cumulative Trust Preferred Securities",26,864,0],["BANL","CBL International Limited",80,13,0],["BANR","Banner Corporation",26,2258,0],["BANX","ArrowMark Financial Corp.",81,159,0],["BAOS","Baosheng Media Group Holdings Limited",36,5,0],["BAP","Credicorp Ltd.",75,26972,0],["BAR","BAR",1,0,0],["BARK","BARK Inc. Class A",66,107,0],["BASG","BASG",1,0,0],["BASV","BASV",1,0,0],["BATL","Battalion Oil Corporation",59,20,0],["BATRA","Atlanta Braves Holdings Inc. Series A",45,2692,0],["BATRK","Atlanta Braves Holdings Inc. Series C",45,2493,0],["BATT","BATT",1,0,0],["BAX","Baxter International Inc.",31,9746,0],["BAYA","Bayview Acquisition Corp",1,0,0],["BB","BlackBerry Limited",25,2226,0],["BBAG","BBAG",1,0,0],["BBAI","BigBear.ai Inc.",25,2733,0],["BBAR","Banco BBVA Argentina S.A. ADS",75,3731,0],["BBB","BBB",1,0,0],["BBBI","BBBI",1,0,0],["BBBL","BBBL",1,0,0],["BBBS","BBBS",1,0,0],["BBBY","Bed Bath & Beyond Inc.",57,414,0],["BBC","BBC",1,0,0],["BBCB","BBCB",1,0,0],["BBCP","Concrete Pumping Holdings Inc.",82,361,0],["BBD","Banco Bradesco Sa",26,35651,0],["BBDC","Barings BDC Inc.",146,932,0],["BBDO","Banco Bradesco Sa",26,31394,0],["BBGI","Beasley Broadcast Group Inc. Class A",83,9,0],["BBH","BBH",1,0,0],["BBHL","BBHL",1,0,0],["BBHM","BBHM",1,0,0],["BBIO","BridgeBio Pharma Inc.",8,14704,0],["BBLG","Bone Biologics Corp",32,3,0],["BBLU","BBLU",1,0,0],["BBMC","BBMC",1,0,0],["BBN","BlackRock Taxable Municipal Bond Trust",116,0,0],["BBNX","Beta Bionics Inc.",31,1288,0],["BBOT","BridgeBio Oncology Therapeutics Inc.",8,294,0],["BBP","BBP",1,0,0],["BBSC","BBSC",1,0,0],["BBSI","Barrett Business Services Inc.",19,936,0],["BBT","Beacon Financial Corporation",43,2307,0],["BBU","Brookfield Business Partners L.P. Limited Partnership",82,7513,0],["BBUC","Brookfield Business Corporation Class A Exchangeable Subordinate Voting Shares",82,3467,0],["BBVA","Banco Bilbao Vizcaya Argentaria S.A.",75,132844,0],["BBW","Build-A-Bear Workshop Inc.",61,702,0],["BBWI","Bath & Body Works Inc.",120,4051,0],["BBY","Best Buy Co. Inc.",110,15051,0],["BBYY","BBYY",1,0,0],["BC","Brunswick Corporation",7,4927,0],["BC/PC","BC/PC",1,0,0],["BCAB","BioAtla Inc.",13,44,0],["BCAL","California BanCorp",26,630,0],["BCAR","D. Boral ARC Acquisition I Corp. Class A",2,0,0],["BCARU","D. Boral ARC Acquisition I Corp.",2,0,0],["BCAT","BlackRock Capital Allocation Term Trust",123,1563,0],["BCAX","Bicara Therapeutics Inc.",8,1101,0],["BCBP","BCB Bancorp Inc. (NJ)",84,145,0],["BCC","Boise Cascade L.L.C.",130,2770,0],["BCD","BCD",1,0,0],["BCDA","BioCardia Inc.",13,13,0],["BCDF","BCDF",1,0,0],["BCE","BCE Inc.",33,21299,0],["BCFN","BCFN",1,0,0],["BCG","Binah Capital Group Inc.",44,38,0],["BCGD","BCGD",1,0,0],["BCH","Banco De Chile ADS",75,19037,0],["BCHI","BCHI",1,0,0],["BCI","BCI",1,0,0],["BCIC","BCP Investment Corporation",44,157,0],["BCIL","BCIL",1,0,0],["BCLO","BCLO",1,0,0],["BCML","BayCom Corp",26,348,0],["BCO","Brinks Company (The)",105,4942,0],["BCOR","BCOR",1,0,0],["BCPC","Balchem Corporation",34,5062,0],["BCRX","BioCryst Pharmaceuticals Inc.",13,1560,0],["BCS","Barclays PLC",75,87400,0],["BCSF","Bain Capital Specialty Finance Inc.",123,901,0],["BCSM","BCSM",1,0,0],["BCSS","Bain Capital GSS Investment Corp. Class A",1,0,0],["BCSS.U","BCSS.U",1,0,0],["BCTK","BCTK",1,0,0],["BCTX","BriaCell Therapeutics Corp.",8,17,0],["BCUS","BCUS",1,0,0],["BCV","Bancroft Fund Ltd.",123,0,0],["BCV/PA","BCV/PA",1,0,0],["BCX","BlackRock Resources",123,919,0],["BCYC","Bicycle Therapeutics plc",8,477,0],["BDBT","BDBT",1,0,0],["BDC","Belden Inc",33,4628,0],["BDCI","BTC Development Corp. Class A",2,0,0],["BDCIU","BTC Development Corp. Unit",2,0,0],["BDCX","BDCX",1,0,0],["BDCZ","BDCZ",1,0,0],["BDGS","BDGS",1,0,0],["BDIV","BDIV",1,0,0],["BDJ","Blackrock Enhanced Equity Dividend Trust",116,1661,0],["BDL","Flanigan\'s Enterprises Inc.",68,52,0],["BDMD","Baird Medical Investment Holdings Ltd",31,51,0],["BDN","Brandywine Realty Trust",30,521,0],["BDRX","Biodexa Pharmaceuticals plc American Depositary Shs",8,2,0],["BDRY","BDRY",1,0,0],["BDSX","Biodesix Inc.",23,53,0],["BDTX","Black Diamond Therapeutics Inc.",13,145,0],["BDVG","BDVG",1,0,0],["BDVL","BDVL",1,0,0],["BDX","Becton Dickinson and Company",31,55825,0],["BDYN","BDYN",1,0,0],["BE","Bloom Energy Corporation Class A",7,21007,0],["BEAG","Bold Eagle Acquisition Corp. Class A",1,0,0],["BEAGU","BEAGU",1,0,0],["BEAM","Beam Therapeutics Inc.",13,2696,0],["BEAT","Heartbeam Inc.",31,107,0],["BEBE.U","BEBE.U",1,0,0],["BEDY","BEDY",1,0,0],["BEDZ","BEDZ",1,0,0],["BEEM","Beam Global",6,31,0],["BEEP","Mobile Infrastructure Corporation",2,110,0],["BEEX","BEEX",1,0,0],["BEEZ","BEEZ",1,0,0],["BEG","BEG",1,0,0],["BEKE","KE Holdings Inc",36,18620,0],["BELFA","Bel Fuse Inc. Class A",1,1936,0],["BELFB","Bel Fuse Inc. Class B",1,2224,0],["BELT","BELT",1,0,0],["BEN","Franklin Resources Inc.",11,12503,0],["BENF","Beneficient Class A",44,95,0],["BENJ","BENJ",1,0,0],["BEP","Brookfield Renewable Partners L.P. Limited Partnership",41,17687,0],["BEP/PA","BEP/PA",1,0,0],["BEPC","Brookfield Renewable Corporation Brookfield Renewable Corporation Class A Subordinate Voting Shares",41,14265,0],["BEPH","Brookfield BRP Holdings (Canada) Inc. 4.625% Perpetual Subordinated Notes",41,4417,0],["BEPI","Brookfield BRP Holdings (Canada) Inc. 4.875% Perpetual Subordinated Notes",41,4649,0],["BEPJ","Brookfield BRP Holdings (Canada) Inc. 7.250% Perpetual Subordinated Notes",41,7248,0],["BERZ","BERZ",1,0,0],["BETA","Beta Technologies Inc. Class A",50,6999,0],["BETE","BETE",1,0,0],["BETH","BETH",1,0,0],["BETR","Better Home & Finance Holding Company Class A",44,518,0],["BETZ","BETZ",1,0,0],["BF.A","BF.A",1,0,0],["BF.B","BF.B",1,0,0],["BFAM","Bright Horizons Family Solutions Inc.",3,5748,0],["BFAP","BFAP",1,0,0],["BFC","Bank First Corporation",26,1303,0],["BFH","Bread Financial Holdings Inc.",36,3562,0],["BFH/PA","BFH/PA",1,0,0],["BFIN","BankFinancial Corporation",84,158,0],["BFIX","BFIX",1,0,0],["BFJL","BFJL",1,0,0],["BFK","BlackRock Municipal Income Trust",116,0,0],["BFLY","Butterfly Network Inc. Class A",132,899,0],["BFOC","BFOC",1,0,0],["BFOR","BFOR",1,0,0],["BFRE","BFRE",1,0,0],["BFRG","Bullfrog AI Holdings Inc.",8,17,0],["BFRI","Biofrontera Inc.",8,9,0],["BFRZ","BFRZ",1,0,0],["BFS","Saul Centers Inc.",30,766,0],["BFS/PD","BFS/PD",1,0,0],["BFS/PE","BFS/PE",1,0,0],["BFST","Business First Bancshares Inc.",26,819,0],["BFZ","BlackRock California Municipal Income Trust",116,0,0],["BG","Bunge Limited",17,17687,0],["BGB","Blackstone Strategic Credit 2027 Term Fund",81,0,0],["BGC","BGC Group Inc. Class A",60,4223,0],["BGDV","BGDV",1,0,0],["BGH","Barings Global Short Duration High Yield Fund",11,0,0],["BGI","Birks Group Inc.",94,18,0],["BGIG","BGIG",1,0,0],["BGIN","Bgin Blockchain Limited Class A",1,230,0],["BGL","Blue Gold Limited Class A",10,90,0],["BGLC","BioNexus Gene Lab Corp",23,8,0],["BGM","BGM Group Ltd. Class A",8,424,0],["BGMS","Bio Green Med Solution Inc.",1,0,0],["BGMSP","Bio Green Med Solution Inc. 6% Convertible",1,0,0],["BGR","BlackRock Energy and Resources Trust",81,1820,0],["BGRN","BGRN",1,0,0],["BGRO","BGRO",1,0,0],["BGS","B&G Foods Inc.",17,366,0],["BGSF","BGSF Inc.",19,52,0],["BGSI","Boyd Group Services Inc.",1,4468,0],["BGT","BlackRock Floating Rate Income Trust",81,0,0],["BGX","Blackstone Long Short Credit Income Fund",81,0,0],["BGY","Blackrock Enhanced International Dividend Trust",81,0,0],["BH","Biglari Holdings Inc. Class B",68,795,0],["BH.A","BH.A",1,0,0],["BHAT","Blue Hat Interactive Entertainment Technology",61,9,0],["BHB","Bar Harbor Bankshares Inc.",26,541,0],["BHC","Bausch Health Companies Inc.",8,2549,0],["BHE","Benchmark Electronics Inc.",39,1588,0],["BHF","Brighthouse Financial Inc.",5,3711,0],["BHFAL","Brighthouse Financial Inc. 6.25% Junior Subordinated Debentures due 2058",5,951,0],["BHFAM","Brighthouse Financial Inc.",5,638,0],["BHFAN","Brighthouse Financial Inc.",5,726,0],["BHFAO","Brighthouse Financial Inc.",5,892,0],["BHFAP","Brighthouse Financial Inc.",5,873,0],["BHK","Blackrock Core Bond Trust",116,0,0],["BHM","Bluerock Homes Trust Inc. Class A",30,36,0],["BHP","BHP Group Limited",65,150641,0],["BHR","Braemar Hotels & Resorts Inc.",30,198,0],["BHR/PB","BHR/PB",1,0,0],["BHR/PD","BHR/PD",1,0,0],["BHRB","Burke & Herbert Financial Services Corp.",26,994,0],["BHST","BioHarvest Sciences Inc.",1,118,0],["BHV","BlackRock Virginia Municipal Bond Trust",123,0,0],["BHVN","Biohaven Ltd.",8,1149,0],["BIAF","bioAffinity Technologies Inc.",14,6,0],["BIB","BIB",1,0,0],["BIBL","BIBL",1,0,0],["BIDD","BIDD",1,0,0],["BIDG","BIDG",1,0,0],["BIDU","Baidu Inc. ADS",16,42566,0],["BIGY","BIGY",1,0,0],["BIIB","Biogen Inc.",13,25644,0],["BIL","BIL",1,0,0],["BILD","BILD",1,0,0],["BILI","Bilibili Inc.",15,10328,0],["BILL","BILL Holdings Inc.",15,5607,0],["BILS","BILS",1,0,0],["BILZ","BILZ",1,0,0],["BINC","BINC",1,0,0],["BINT","BINT",1,0,0],["BIO","Bio-Rad Laboratories Inc. Class A",71,8134,0],["BIOA","BioAge Labs Inc.",8,480,0],["BIOX","Bioceres Crop Solutions Corp.",85,89,0],["BIP","Brookfield Infrastructure Partners LP Limited Partnership",98,16083,0],["BIP/PA","BIP/PA",1,0,0],["BIP/PB","BIP/PB",1,0,0],["BIPC","Brookfield Infrastructure Corporation Brookfield Infrastructure Corporation",59,6085,0],["BIPH","Brookfield Infrastructure Corporation 5.000% Subordinated Notes due 2081",59,7668,0],["BIPI","BIP Bermuda Holdings I Limited 5.125% Perpetual Subordinated Notes",98,160,0],["BIPJ","Brookfield Infrastructure Corporation 7.250% Subordinated Notes due 2084",59,11524,0],["BIRD","Allbirds Inc. Class A",86,33,0],["BIRK","Birkenstock Holding plc",114,7996,0],["BIS","BIS",1,0,0],["BIT","BlackRock Multi-Sector Income Trust",81,0,0],["BITB","BITB",1,0,0],["BITC","BITC",1,0,0],["BITF","Bitfarms Ltd.",44,1513,0],["BITI","BITI",1,0,0],["BITO","BITO",1,0,0],["BITQ","BITQ",1,0,0],["BITS","BITS",1,0,0],["BITU","BITU",1,0,0],["BITW","BITW",1,0,0],["BIV","BIV",1,0,0],["BIVI","BioVie Inc. Class A",8,11,0],["BIXI","Bitcoin Infrastructure Acquisition Corp Ltd. Class A",1,0,0],["BIXIU","Bitcoin Infrastructure Acquisition Corp Ltd. Unit",2,0,0],["BIYA","Baiya International Group Inc.",12,3,0],["BIZD","BIZD",1,0,0],["BJ","BJ\'s Wholesale Club Holdings Inc.",113,12386,0],["BJDX","Bluejay Diagnostics Inc.",31,1,0],["BJK","BJK",1,0,0],["BJRI","BJ\'s Restaurants Inc.",68,875,0],["BK","The Bank of New York Mellon Corporation",26,80781,0],["BK/PK","BK/PK",1,0,0],["BKAG","BKAG",1,0,0],["BKCG","BKCG",1,0,0],["BKCH","BKCH",1,0,0],["BKCI","BKCI",1,0,0],["BKD","Brookdale Senior Living Inc.",126,2564,0],["BKDV","BKDV",1,0,0],["BKE","Buckle Inc. (The)",120,2873,0],["BKEM","BKEM",1,0,0],["BKF","BKF",1,0,0],["BKH","Black Hills Corporation",41,5094,0],["BKHA","BKHA",1,0,0],["BKHAU","Black Hawk Acquisition Corporation",1,0,0],["BKHY","BKHY",1,0,0],["BKIE","BKIE",1,0,0],["BKKT","Bakkt Holdings Inc. Class A",44,254,0],["BKLC","BKLC",1,0,0],["BKLN","BKLN",1,0,0],["BKMC","BKMC",1,0,0],["BKN","BlackRock Investment Quality Municipal Trust Inc. (The)",81,0,0],["BKNG","Booking Holdings Inc.",87,173861,0],["BKR","Baker Hughes Company Class A",88,44119,0],["BKSE","BKSE",1,0,0],["BKSY","BlackSky Technology Inc. Class A",49,798,0],["BKT","BlackRock Income Trust Inc. (The)",60,1639,0],["BKTI","BK Technologies Corporation",49,292,0],["BKU","BankUnited Inc.",84,3404,0],["BKUI","BKUI",1,0,0],["BKV","BKV Corporation",59,2565,0],["BKYI","BIO-key International Inc.",25,11,0],["BL","BlackLine Inc.",25,3441,0],["BLBD","Blue Bird Corporation",72,1640,0],["BLBX","Blackboxstocks Inc.",15,34,0],["BLCN","BLCN",1,0,0],["BLCO","Bausch + Lomb Corporation",111,6014,0],["BLCR","BLCR",1,0,0],["BLCV","BLCV",1,0,0],["BLD","TopBuild Corp.",82,11980,0],["BLDP","Ballard Power Systems Inc.",7,785,0],["BLDR","Builders FirstSource Inc.",130,11477,0],["BLE","BlackRock Municipal Income Trust II",123,0,0],["BLES","BLES",1,0,0],["BLFS","BioLife Solutions Inc.",77,1207,0],["BLFY","Blue Foundry Bancorp",43,262,0],["BLGR","BLGR",1,0,0],["BLIN","Bridgeline Digital Inc.",25,12,0],["BLIV","BeLive Holdings",15,42,0],["BLK","BlackRock Inc.",60,164486,0],["BLKB","Blackbaud Inc.",25,3044,0],["BLLN","BillionToOne Inc. Class A",23,4696,0],["BLMN","Bloomin\' Brands Inc.",68,590,0],["BLND","Blend Labs Inc. Class A",16,803,0],["BLNE","Beeline Holdings Inc.",44,56,0],["BLNK","Blink Charging Co.",32,110,0],["BLOK","BLOK",1,0,0],["BLOX","BLOX",1,0,0],["BLRKU","Bluerock Acquisition Corp. Unit",1,0,0],["BLRX","BioLineRx Ltd.",8,11,0],["BLSG","BLSG",1,0,0],["BLSH","Bullish",44,6520,0],["BLST","BLST",1,0,0],["BLTD","BLTD",1,0,0],["BLTE","Belite Bio Inc",8,5852,0],["BLUC","BLUC",1,0,0],["BLUI","BLUI",1,0,0],["BLUW","Blue Water Acquisition Corp. III Class A",1,75,0],["BLUWU","Blue Water Acquisition Corp. III Unit.",13,0,0],["BLUX","BLUX",1,0,0],["BLV","BLV",1,0,0],["BLW","Blackrock Limited Duration Income Trust",3,494,0],["BLX","Banco Latinoamericano de Comercio Exterior S.A.",75,1611,0],["BLZE","Backblaze Inc. Class A",25,278,0],["BLZR","Trailblazer Acquisition Corp. Class A",2,0,0],["BLZRU","Trailblazer Acquisition Corp. Unit",1,0,0],["BMA","Banco Macro S.A. ADR (representing Ten Class B",75,5757,0],["BMAX","BMAX",1,0,0],["BMBL","Bumble Inc. Class A",16,390,0],["BMDL","BMDL",1,0,0],["BME","Blackrock Health Sciences Trust",81,547,0],["BMEA","Biomea Fusion Inc.",8,99,0],["BMED","BMED",1,0,0],["BMEZ","BlackRock Health Sciences Term Trust",81,202,0],["BMGL","Basel Medical Group Ltd",35,14,0],["BMHL","Bluemount Holdings Limited Class B",44,88,0],["BMI","Badger Meter Inc.",7,5353,0],["BML/PG","BML/PG",1,0,0],["BML/PH","BML/PH",1,0,0],["BML/PJ","BML/PJ",1,0,0],["BML/PL","BML/PL",1,0,0],["BMN","BlackRock 2037 Municipal Target Term Trust",81,0,0],["BMNG","BMNG",1,0,0],["BMNR","BitMine Immersion Technologies Inc.",44,12044,0],["BMNZ","BMNZ",1,0,0],["BMO","Bank Of Montreal",75,91959,0],["BMR","Beamr Imaging Ltd.",25,31,0],["BMRA","Biomerica Inc.",24,7,0],["BMRC","Bank of Marin Bancorp",26,437,0],["BMRN","BioMarin Pharmaceutical Inc.",8,11748,0],["BMVP","BMVP",1,0,0],["BMY","Bristol-Myers Squibb Company",8,110317,0],["BN","Brookfield Corporation Class A Limited Voting Shares",134,101669,0],["BNAI","Brand Engagement Network Inc.",15,8,0],["BNBX","BNB Plus Corp.",3,3,0],["BNC","CEA Industries Inc.",7,297,0],["BND","BND",1,0,0],["BNDC","BNDC",1,0,0],["BNDD","BNDD",1,0,0],["BNDI","BNDI",1,0,0],["BNDP","BNDP",1,0,0],["BNDS","BNDS",1,0,0],["BNDW","BNDW",1,0,0],["BNDX","BNDX",1,0,0],["BNED","Barnes & Noble Education Inc",66,292,0],["BNGE","BNGE",1,0,0],["BNGO","Bionano Genomics Inc.",71,16,0],["BNH","Brookfield Finance Inc. 4.625% Subordinated Notes due October 16 2080",134,24607,0],["BNJ","Brookfield Finance Inc. 4.50% Perpetual Subordinated Notes",134,23001,0],["BNKD","BNKD",1,0,0],["BNKK","Bonk Inc.",90,21,0],["BNKU","BNKU",1,0,0],["BNL","Broadstone Net Lease Inc.",30,3315,0],["BNO","BNO",1,0,0],["BNR","Burning Rock Biotech Limited",23,234,0],["BNRG","Brenmiller Energy Ltd",91,3,0],["BNS","Bank Nova Scotia Halifax Pfd 3",26,90064,0],["BNT","Brookfield Wealth Solutions Ltd. Class A Exchangeable Limited Voting Shares",22,13920,0],["BNTC","Benitec Biopharma Inc.",8,389,0],["BNTX","BioNTech SE American",13,22197,0],["BNY","BlackRock New York Municipal Income Trust",81,0,0],["BNZI","Banzai International Inc. Class A",25,10,0],["BOAT","BOAT",1,0,0],["BOBP","BOBP",1,0,0],["BOC","Boston Omaha Corporation Class A",36,394,0],["BODI","The Beachbody Company Inc. Class A",3,80,0],["BOE","Blackrock Enhanced Global Dividend Trust",81,0,0],["BOED","BOED",1,0,0],["BOEG","BOEG",1,0,0],["BOEU","BOEU",1,0,0],["BOF","BranchOut Food Inc.",17,42,0],["BOH","Bank of Hawaii Corporation",26,2822,0],["BOH/PA","BOH/PA",1,0,0],["BOH/PB","BOH/PB",1,0,0],["BOIL","BOIL",1,0,0],["BOKF","BOK Financial Corporation",26,7588,0],["BOLD","Boundless Bio Inc.",8,27,0],["BOLT","Bolt Biotherapeutics Inc.",8,10,0],["BON","Bon Natural Life Limited Class A",18,4,0],["BOND","BOND",1,0,0],["BOOM","DMC Global Inc.",32,132,0],["BOOT","Boot Barn Holdings Inc.",120,5826,0],["BORR","Borr Drilling Limited",59,1197,0],["BOSC","B.O.S. Better Online Solutions",51,26,0],["BOTJ","Bank of the James Financial Group Inc.",26,82,0],["BOTT","BOTT",1,0,0],["BOTZ","BOTZ",1,0,0],["BOUT","BOUT",1,0,0],["BOW","Bowhead Specialty Holdings Inc.",22,918,0],["BOX","Box Inc. Class A",25,4360,0],["BOXL","Boxlight Corporation Class A",3,4,0],["BP","BP p.l.c.",106,88540,0],["BPACU","Blueport Acquisition Ltd",2,0,0],["BPAY","BPAY",1,0,0],["BPH","BPH",1,0,0],["BPI","BPI",1,0,0],["BPOP","Popular Inc.",26,8331,0],["BPOPM","Popular Inc. Popular Capital Trust II - 6.125% Cumulative Monthly Income Trust Preferred Securities",26,1677,0],["BPRE","Bluerock Private Real Estate Fund",1,0,0],["BPRN","Princeton Bancorp Inc.",26,239,0],["BPYPM","Brookfield Property Partners L.P. 6.25% Class A Cumulative Redeemable Preferred",36,16186,0],["BPYPN","Brookfield Property Partners L.P. 5.750% Class A Cumulative Redeemable Perpetual Preferred",36,14066,0],["BPYPO","Brookfield Property Partners L.P. 6.375% Class A Cumulative Redeemable Perpetual Preferred",36,15251,0],["BPYPP","Brookfield Property Partners L.P. 6.50% Class A Cumulative Redeemable Perpetual Preferred",36,15469,0],["BQ","Boqii Holding Limited Class A",66,6,0],["BR","Broadridge Financial Solutions Inc.",36,26376,0],["BRAG","Bragg Gaming Group Inc.",92,55,0],["BRAZ","BRAZ",1,0,0],["BRBI","BRBI BR Partners S.A. ADSs",44,668,0],["BRBR","BellRing Brands Inc.",17,3475,0],["BRBS","Blue Ridge Bankshares Inc.",26,408,0],["BRC","Brady Corporation",69,3820,0],["BRCB","Black Rock Coffee Bar Inc. Class A",68,1136,0],["BRCC","BRC Inc. Class A",46,313,0],["BRCE","BRCE",1,0,0],["BREM","BREM",1,0,0],["BRF","BRF",1,0,0],["BRFH","Barfresh Food Group Inc.",17,45,0],["BRHY","BRHY",1,0,0],["BRIA","BrilliA Inc Class A",86,51,0],["BRID","Bridgford Foods Corporation",93,67,0],["BRIE","BRIE",1,0,0],["BRIF","BRIF",1,0,0],["BRK.A","BRK.A",1,0,0],["BRK.B","BRK.B",1,0,0],["BRKC","BRKC",1,0,0],["BRKD","BRKD",1,0,0],["BRKR","Bruker Corporation",71,7062,0],["BRKRP","Bruker Corporation 6.375% Mandatory Convertible",71,54723,0],["BRKU","BRKU",1,0,0],["BRLS","Borealis Foods Inc. Class A",17,39,0],["BRLT","Brilliant Earth Group Inc. Class A",94,181,0],["BRN","Barnwell Industries Inc.",59,11,0],["BRNS","Barinthus Biotherapeutics plc",8,30,0],["BRNY","BRNY",1,0,0],["BRO","Brown & Brown Inc.",28,27375,0],["BROS","Dutch Bros Inc. Class A",68,10666,0],["BRR","ProCap Financial Inc.",44,263,0],["BRRR","BRRR",1,0,0],["BRSL","Brightstar Lottery PLC Trading under the Legal Name to begin at the market open on July 21 2025.",45,3251,0],["BRSP","BrightSpire Capital Inc. Class A",30,764,0],["BRT","BRT Apartments Corp. (MD)",30,281,0],["BRTR","BRTR",1,0,0],["BRTX","BioRestorative Therapies Inc.",95,10,0],["BRW","Saba Capital Income & Opportunities Fund SBI",81,0,0],["BRX","Brixmor Property Group Inc.",30,7888,0],["BRZE","Braze Inc. Class A",25,3980,0],["BRZU","BRZU",1,0,0],["BSAA","BSAA",1,0,0],["BSAAU","BSAAU",1,0,0],["BSAC","Banco Santander - Chile ADS",75,14459,0],["BSBK","Bogota Financial Corp.",43,106,0],["BSBR","Banco Santander Brasil SA",75,43937,0],["BSCQ","BSCQ",1,0,0],["BSCR","BSCR",1,0,0],["BSCS","BSCS",1,0,0],["BSCT","BSCT",1,0,0],["BSCU","BSCU",1,0,0],["BSCV","BSCV",1,0,0],["BSCW","BSCW",1,0,0],["BSCX","BSCX",1,0,0],["BSCY","BSCY",1,0,0],["BSCZ","BSCZ",1,0,0],["BSET","Bassett Furniture Industries Incorporated",73,153,0],["BSJQ","BSJQ",1,0,0],["BSJR","BSJR",1,0,0],["BSJS","BSJS",1,0,0],["BSJT","BSJT",1,0,0],["BSJU","BSJU",1,0,0],["BSJV","BSJV",1,0,0],["BSJW","BSJW",1,0,0],["BSJX","BSJX",1,0,0],["BSL","Blackstone Senior Floating Rate 2027 Term Fund",81,0,0],["BSLK","Bolt Projects Holdings Inc.",34,7,0],["BSM","Black Stone Minerals L.P. Common",59,3036,0],["BSMQ","BSMQ",1,0,0],["BSMR","BSMR",1,0,0],["BSMS","BSMS",1,0,0],["BSMT","BSMT",1,0,0],["BSMU","BSMU",1,0,0],["BSMV","BSMV",1,0,0],["BSMW","BSMW",1,0,0],["BSMY","BSMY",1,0,0],["BSMZ","BSMZ",1,0,0],["BSOL","BSOL",1,0,0],["BSR","BSR",1,0,0],["BSRR","Sierra Bancorp",26,450,0],["BSSX","BSSX",1,0,0],["BST","BlackRock Science and Technology Trust",116,914,0],["BSTP","BSTP",1,0,0],["BSTZ","BlackRock Science and Technology Term Trust",81,515,0],["BSV","BSV",1,0,0],["BSVN","Bank7 Corp.",26,414,0],["BSVO","BSVO",1,0,0],["BSX","Boston Scientific Corporation",31,141736,0],["BSY","Bentley Systems Incorporated Class B",25,12066,0],["BTA","BlackRock Long-Term Municipal Advantage Trust",81,0,0],["BTAI","BioXcel Therapeutics Inc.",8,38,0],["BTAL","BTAL",1,0,0],["BTBD","BT Brands Inc.",68,11,0],["BTBT","Bit Digital Inc.",44,722,0],["BTC","BTC",1,0,0],["BTCC","BTCC",1,0,0],["BTCS","BTCS Inc.",44,149,0],["BTCT","BTC Digital Ltd.",3,12,0],["BTDR","Bitdeer Technologies Group Class A",44,2166,0],["BTE","Baytex Energy Corp",59,2374,0],["BTF","BTF",1,0,0],["BTG","B2Gold Corp",104,6039,0],["BTGD","BTGD",1,0,0],["BTI","British American Tobacco Industries p.l.c.",18,123165,0],["BTM","Bitcoin Depot Inc. Class A",44,99,0],["BTMD","Biote Corp. Class A",18,127,0],["BTO","John Hancock Financial Opportunities Fund",11,0,0],["BTOC","Armlogi Holding Corp.",92,25,0],["BTOG","Bit Origin Limited Class A",44,19,0],["BTOP","BTOP",1,0,0],["BTOT","BTOT",1,0,0],["BTQ","BTQ Technologies Corp.",1,893,0],["BTR","BTR",1,0,0],["BTRN","BTRN",1,0,0],["BTSG","BrightSpring Health Services Inc.",35,6761,0],["BTSGU","BrightSpring Health Services Inc. Tangible Equity Unit",35,22957,0],["BTT","BlackRock Municipal 2030 Target Term Trust",11,0,0],["BTTC","Black Titan Corporation",13,3,0],["BTU","Peabody Energy Corporation",65,3754,0],["BTX","BlackRock Technology and Private Equity Term Trust",1,1585,0],["BTZ","BlackRock Credit Allocation Income Trust",116,1177,0],["BU","BU",1,0,0],["BUCK","BUCK",1,0,0],["BUD","Anheuser-Busch Inbev SA Sponsored ADR (Belgium)",46,115901,0],["BUFC","BUFC",1,0,0],["BUFI","BUFI",1,0,0],["BUFM","BUFM",1,0,0],["BUG","BUG",1,0,0],["BUI","BlackRock Utility Infrastructure & Power Opportunities Trust",81,0,0],["BUL","BUL",1,0,0],["BULD","BULD",1,0,0],["BULG","BULG",1,0,0],["BULL","Webull Corporation Class A",60,3955,0],["BULX","BULX",1,0,0],["BULZ","BULZ",1,0,0],["BUR","Burford Capital Limited",44,2028,0],["BURL","Burlington Stores Inc.",113,17542,0],["BURU","Nuburu Inc.",7,93,0],["BUSE","First Busey Corporation Class A",26,2210,0],["BUSEP","First Busey Corporation",26,2286,0],["BUUU","BUUU Group Limited Class A",45,132,0],["BUXX","BUXX",1,0,0],["BUYO","BUYO",1,0,0],["BUZZ","BUZZ",1,0,0],["BV","BrightView Holdings Inc.",36,1206,0],["BVAL","BVAL",1,0,0],["BVFL","BV Financial Inc.",84,174,0],["BVN","Buenaventura Mining Company Inc.",10,7201,0],["BVS","Bioventus Inc. Class A",31,620,0],["BW","Babcock & Wilcox Enterprises Inc.",91,544,0],["BW/PA","BW/PA",1,0,0],["BWA","BorgWarner Inc.",42,9633,0],["BWAY","BrainsWay Ltd.",31,323,0],["BWB","Bridgewater Bancshares Inc.",26,508,0],["BWBBP","Bridgewater Bancshares Inc.",26,529,0],["BWEB","BWEB",1,0,0],["BWEN","Broadwind Inc.",55,69,0],["BWET","BWET",1,0,0],["BWFG","Bankwell Financial Group Inc.",26,384,0],["BWG","BrandywineGLOBAL Global Income Opportunities Fund Inc.",123,0,0],["BWIN","The Baldwin Insurance Group Inc. Class A",28,2811,0],["BWLP","BW LPG Limited",87,1896,0],["BWMN","Bowman Consulting Group Ltd.",19,582,0],["BWMX","Betterware de Mexico S.A.P.I. de C.V.",57,515,0],["BWNB","Babcock & Wilcox Enterprises Inc. 6.50% Senior Notes due 2026",91,2465,0],["BWOW","BWOW",1,0,0],["BWX","BWX",1,0,0],["BWXT","BWX Technologies Inc.",7,16130,0],["BWZ","BWZ",1,0,0],["BX","Blackstone Inc.",11,111942,0],["BXC","Bluelinx Holdings Inc.",150,494,0],["BXMT","Blackstone Mortgage Trust Inc.",30,3375,0],["BXMX","Nuveen S&P 500 Buy-Write Income Fund",11,0,0],["BXP","BXP Inc.",30,10888,0],["BXSL","Blackstone Secured Lending Fund",81,0,0],["BY","Byline Bancorp Inc.",26,1398,0],["BYAH","Park Ha Biological Technology Co. Ltd.",90,6,0],["BYD","Boyd Gaming Corporation",47,6747,0],["BYFC","Broadway Financial Corporation Class A",84,54,0],["BYLD","BYLD",1,0,0],["BYM","Blackrock Municipal Income Quality Trust",11,0,0],["BYND","Beyond Meat Inc.",17,503,0],["BYRE","BYRE",1,0,0],["BYRN","Byrna Technologies Inc.",7,394,0],["BYSI","BeyondSpring Inc.",8,95,0],["BZ","KANZHUN LIMITED American Depository Shares",16,9051,0],["BZAI","Blaize Holdings Inc.",2,262,0],["BZFD","BuzzFeed Inc. Class A",33,34,0],["BZH","Beazer Homes USA Inc.",121,624,0],["BZQ","BZQ",1,0,0],["BZUN","Baozun Inc.",57,158,0],["C","Citigroup Inc.",26,205515,0],["C/PN","C/PN",1,0,0],["CA","CA",1,0,0],["CAAA","CAAA",1,0,0],["CAAP","Corporacion America Airports SA",50,4101,0],["CAAS","China Automotive Systems Inc.",42,130,0],["CABA","Cabaletta Bio Inc.",13,230,0],["CABO","Cable One Inc.",54,716,0],["CABR","Caring Brands Inc.",90,14,0],["CAC","Camden National Corporation",26,778,0],["CACC","Credit Acceptance Corporation",44,5098,0],["CACI","CACI International Inc. Class A",15,12290,0],["CADE","Cadence Bank",26,7979,0],["CADE/PA","CADE/PA",1,0,0],["CADL","Candel Therapeutics Inc.",13,306,0],["CAE","CAE Inc.",7,9695,0],["CAEP","Cantor Equity Partners III Inc. Class A",1,0,0],["CAF","Morgan Stanley China A Share Fund Inc.",11,0,0],["CAFG","CAFG",1,0,0],["CAFX","CAFX",1,0,0],["CAG","ConAgra Brands Inc.",17,8299,0],["CAH","Cardinal Health Inc.",112,48220,0],["CAI","Caris Life Sciences Inc.",23,7883,0],["CAIE","CAIE",1,0,0],["CAIQ","CAIQ",1,0,0],["CAKE","Cheesecake Factory Incorporated (The)",68,2593,0],["CAL","Caleres Inc.",114,447,0],["CALC","CalciMedica Inc.",8,91,0],["CALI","CALI",1,0,0],["CALM","Cal-Maine Foods Inc.",48,4156,0],["CALX","Calix Inc",33,3625,0],["CAM","CAM",1,0,0],["CAML","CAML",1,0,0],["CAMP","CAMP4 Therapeutics Corporation",1,467,0],["CAMT","Camtek Ltd.",76,4744,0],["CAMX","CAMX",1,0,0],["CAN","Canaan Inc.",6,346,0],["CANC","CANC",1,0,0],["CANE","CANE",1,0,0],["CANF","Can-Fite Biopharma Ltd Sponsored ADR (Israel)",8,3,0],["CANG","Cango Inc. Class A",25,161,0],["CANQ","CANQ",1,0,0],["CAPE","CAPE",1,0,0],["CAPL","CrossAmerica Partners LP Common",80,781,0],["CAPN","Cayson Acquisition Corp",1,0,0],["CAPR","Capricor Therapeutics Inc.",8,1438,0],["CAPS","Capstone Holding Corp.",130,6,0],["CAPT","Captivision Inc.",7,12,0],["CAR","Avis Budget Group Inc.",96,4596,0],["CARD","CARD",1,0,0],["CARE","Carter Bankshares Inc.",26,443,0],["CARG","CarGurus Inc. Class A",15,3686,0],["CARK","CARK",1,0,0],["CARL","Carlsmed Inc.",31,342,0],["CARR","Carrier Global Corporation",7,45286,0],["CARS","Cars.com Inc.",15,772,0],["CART","Maplebear Inc.",36,12061,0],["CARU","CARU",1,0,0],["CARY","CARY",1,0,0],["CARZ","CARZ",1,0,0],["CAS","CAS",1,0,0],["CASH","Pathward Financial Inc.",26,1685,0],["CASI","CASI Pharmaceuticals Inc.",8,13,0],["CASS","Cass Information Systems Inc",36,567,0],["CASY","Casey\'s General Stores Inc.",97,20702,0],["CAT","Caterpillar Inc.",72,269659,0],["CATF","CATF",1,0,0],["CATH","CATH",1,0,0],["CATO","Cato Corporation (The) Class A",120,61,0],["CATX","Perspective Therapeutics Inc.",31,204,0],["CATY","Cathay General Bancorp",26,3432,0],["CAVA","CAVA Group Inc.",68,6601,0],["CB","Chubb Limited ",22,122237,0],["CBAN","Colony Bankcorp Inc.",26,320,0],["CBAT","CBAK Energy Technology Inc.",7,82,0],["CBC","Central Bancompany Inc. Class A",1,5580,0],["CBFV","CB Financial Services Inc.",26,188,0],["CBIO","Crescent Biopharma Inc.",8,165,0],["CBK","Commercial Bancgroup Inc.",26,310,0],["CBL","CBL & Associates Properties Inc.",30,1138,0],["CBLL","CeriBell Inc.",77,786,0],["CBLS","CBLS",1,0,0],["CBNA","Chain Bridge Bancorp Inc. Class A",26,251,0],["CBNK","Capital Bancorp Inc.",26,480,0],["CBON","CBON",1,0,0],["CBRE","CBRE Group Inc",36,48100,0],["CBRL","Cracker Barrel Old Country Store Inc",68,585,0],["CBSE","CBSE",1,0,0],["CBSH","Commerce Bancshares Inc.",26,7342,0],["CBT","Cabot Corporation",34,3498,0],["CBU","Community Financial System Inc.",26,3176,0],["CBUS","Cibus Inc. Class A",85,93,0],["CBZ","CBIZ Inc.",36,2847,0],["CC","Chemours Company (The)",34,1772,0],["CCAP","Crescent Capital BDC Inc.",44,542,0],["CCB","Coastal Financial Corporation",26,1767,0],["CCBG","Capital City Bank Group",26,748,0],["CCC","CCC Intelligent Solutions Holdings Inc.",25,5072,0],["CCCC","C4 Therapeutics Inc.",13,302,0],["CCCX","Churchill Capital Corp X Class A",2,0,0],["CCCXU","Churchill Capital Corp X Unit",2,0,0],["CCD","Calamos Dynamic Convertible & Income Fund",81,0,0],["CCEC","Capital Clean Energy Carriers Corp.",98,1231,0],["CCEF","CCEF",1,0,0],["CCEL","Cryo-Cell International Inc.",137,30,0],["CCEP","Coca-Cola Europacific Partners plc",46,41830,0],["CCFE","CCFE",1,0,0],["CCG","Cheche Group Inc. Class A",28,78,0],["CCHH","CCH Holdings Ltd",68,12,0],["CCI","Crown Castle Inc.",30,37495,0],["CCID","Carlyle Credit Income Fund 7.375% Series D Term",1,0,0],["CCIF","Carlyle Credit Income Fund Shares of Beneficial Interest",123,0,0],["CCII","Cohen Circle Acquisition Corp. II Class A",1,0,0],["CCIIU","Cohen Circle Acquisition Corp. II Unit",1,0,0],["CCIX","Churchill Capital Corp IX",15,0,0],["CCIXU","Churchill Capital Corp IX Unit",15,0,0],["CCJ","Cameco Corporation",52,39182,0],["CCK","Crown Holdings Inc.",125,11764,0],["CCL","Carnival Corporation",98,42199,0],["CCLD","CareCloud Inc.",25,136,0],["CCLDO","CareCloud Inc. 8.75% Series B Cumulative Redeemable Perpetual",25,1077,0],["CCM","Concord Medical Services Holdings Limited",35,18,0],["CCNE","CNB Financial Corporation",26,807,0],["CCNEP","CNB Financial Corporation",26,730,0],["CCNR","CCNR",1,0,0],["CCO","Clear Channel Outdoor Holdings Inc.",58,1015,0],["CCOI","Cogent Communications Holdings Inc.",33,1070,0],["CCOR","CCOR",1,0,0],["CCRN","Cross Country Healthcare Inc.",19,260,0],["CCRP","CCRP",1,0,0],["CCS","Century Communities Inc.",121,1752,0],["CCSB","CCSB",1,0,0],["CCSI","Consensus Cloud Solutions Inc.",25,439,0],["CCSO","CCSO",1,0,0],["CCTG","CCSC Technology International Holdings Limited Class A",91,2,0],["CCU","Compania Cervecerias Unidas S.A.",46,924,0],["CCXIU","Churchill Capital Corp XI",2,0,0],["CCZ","Comcast Holdings ZONES",54,227379,0],["CD","Chaince Digital Holdings Inc.",44,336,0],["CDC","CDC",1,0,0],["CDE","Coeur Mining Inc.",104,11720,0],["CDEI","CDEI",1,0,0],["CDIG","CDIG",1,0,0],["CDIO","Cardio Diagnostics Holdings Inc.",24,6,0],["CDL","CDL",1,0,0],["CDLR","Cadeler A/S American Depositary Share (each representing four (4)",98,1626,0],["CDLX","Cardlytics Inc.",16,56,0],["CDNA","CareDx Inc.",23,1000,0],["CDNL","Cardinal Infrastructure Group Inc. Class A",21,881,0],["CDNS","Cadence Design Systems Inc.",25,85719,0],["CDP","COPT Defense Properties",30,3243,0],["CDR/PB","CDR/PB",1,0,0],["CDR/PC","CDR/PC",1,0,0],["CDRE","Cadre Holdings Inc.",32,1692,0],["CDRO","Codere Online Luxembourg S.A.",45,364,0],["CDT","CDT Equity Inc.",8,3,0],["CDTG","CDT Environmental Technology Investment Holdings Limited",99,5,0],["CDTX","Cidara Therapeutics Inc.",13,6942,0],["CDW","CDW Corporation",100,18312,0],["CDX","CDX",1,0,0],["CDXS","Codexis Inc.",34,150,0],["CDZI","CADIZ Inc.",70,445,0],["CDZIP","Cadiz Inc.",70,1629,0],["CE","Celanese Corporation",34,4631,0],["CECO","CECO Environmental Corp.",101,2092,0],["CEE","The Central and Eastern Europe Fund Inc. (The)",116,0,0],["CEF","CEF",1,0,0],["CEFA","CEFA",1,0,0],["CEFD","CEFD",1,0,0],["CEG","Constellation Energy Corporation",41,110988,0],["CELC","Celcuity Inc.",23,4681,0],["CELH","Celsius Holdings Inc.",46,11033,0],["CELU","Celularity Inc. Class A",8,41,0],["CELZ","Creative Medical Technology Holdings Inc.",44,5,0],["CENN","Cenntro Inc.",37,14,0],["CENT","Central Garden & Pet Company",94,1996,0],["CENTA","Central Garden & Pet Company Class A",94,1811,0],["CENX","Century Aluminum Company",102,3380,0],["CEPF","Cantor Equity Partners IV Inc. Class A",2,0,0],["CEPI","CEPI",1,0,0],["CEPO","Cantor Equity Partners I Inc. Class A",2,0,0],["CEPT","Cantor Equity Partners II Inc. Class A",2,0,0],["CEPU","Central Puerto S.A.",41,2657,0],["CEPV","Cantor Equity Partners V Inc. Class A",1,0,0],["CERS","Cerus Corporation",15,401,0],["CERT","Certara Inc.",25,1445,0],["CERY","CERY",1,0,0],["CET","Central Securities Corporation",123,12232,0],["CETX","Cemtrex Inc.",39,16,0],["CETY","Clean Energy Technologies Inc.",55,14,0],["CEV","Eaton Vance California Municipal Income Trust Shares of Beneficial Interest",123,71,0],["CEVA","CEVA Inc.",16,510,0],["CEW","CEW",1,0,0],["CF","CF Industries Holdings Inc.",85,12275,0],["CFA","CFA",1,0,0],["CFBK","CF Bankshares Inc.",26,171,0],["CFFI","C&F Financial Corporation",26,249,0],["CFFN","Capitol Federal Financial Inc.",84,946,0],["CFG","Citizens Financial Group Inc.",26,25421,0],["CFG/PE","CFG/PE",1,0,0],["CFG/PH","CFG/PH",1,0,0],["CFG/PI","CFG/PI",1,0,0],["CFLT","Confluent Inc. Class A",25,10481,0],["CFND","C1 Fund Inc.",1,0,0],["CFO","CFO",1,0,0],["CFR","Cullen/Frost Bankers Inc.",26,8250,0],["CFR/PB","CFR/PB",1,0,0],["CG","The Carlyle Group Inc.",11,21459,0],["CGABL","The Carlyle Group Inc. 4.625% Subordinated Notes due 2061",11,6326,0],["CGAU","Centerra Gold Inc.",104,2927,0],["CGBD","Carlyle Secured Lending Inc.",44,913,0],["CGBL","CGBL",1,0,0],["CGC","Canopy Growth Corporation",18,545,0],["CGCB","CGCB",1,0,0],["CGCP","CGCP",1,0,0],["CGCT","Cartesian Growth Corporation III Class A",2,0,0],["CGCTU","Cartesian Growth Corporation III Unit",2,0,0],["CGCV","CGCV",1,0,0],["CGDG","CGDG",1,0,0],["CGDV","CGDV",1,0,0],["CGEM","Cullinan Therapeutics Inc.",13,572,0],["CGEN","Compugen Ltd.",13,142,0],["CGGE","CGGE",1,0,0],["CGGG","CGGG",1,0,0],["CGGO","CGGO",1,0,0],["CGGR","CGGR",1,0,0],["CGHM","CGHM",1,0,0],["CGHY","CGHY",1,0,0],["CGIB","CGIB",1,0,0],["CGIC","CGIC",1,0,0],["CGIE","CGIE",1,0,0],["CGMM","CGMM",1,0,0],["CGMS","CGMS",1,0,0],["CGMU","CGMU",1,0,0],["CGNG","CGNG",1,0,0],["CGNT","Cognyte Software Ltd.",25,681,0],["CGNX","Cognex Corporation",7,6168,0],["CGO","Calamos Global Total Return Fund",11,0,0],["CGON","CG Oncology Inc.",13,3148,0],["CGRO","CGRO",1,0,0],["CGSD","CGSD",1,0,0],["CGSM","CGSM",1,0,0],["CGTL","Creative Global Technology Holdings Limited Class A",100,24,0],["CGTX","Cognition Therapeutics Inc.",13,136,0],["CGUI","CGUI",1,0,0],["CGUS","CGUS",1,0,0],["CGV","CGV",1,0,0],["CGVV","CGVV",1,0,0],["CGW","CGW",1,0,0],["CGXU","CGXU",1,0,0],["CHA","Chagee Holdings Limited",68,1473,0],["CHAC","Crane Harbor Acquisition Corp. Class A",1,0,0],["CHACU","CHACU",1,0,0],["CHAI","Core AI Holdings Inc.",33,46,0],["CHAR","Charlton Aria Acquisition Corporation Class A",1,0,0],["CHAT","CHAT",1,0,0],["CHAU","CHAU",1,0,0],["CHCI","Comstock Holding Companies Inc. Class A",36,119,0],["CHCO","City Holding Company",26,1804,0],["CHCT","Community Healthcare Trust Incorporated",30,454,0],["CHD","Church & Dwight Company Inc.",90,20430,0],["CHDN","Churchill Downs Incorporated",45,8002,0],["CHE","Chemed Corp",35,6166,0],["CHEC","Chenghe Acquisition III Co. Class A",1,0,0],["CHECU","CHECU",1,0,0],["CHEF","The Chefs\' Warehouse Inc.",103,2623,0],["CHGG","Chegg Inc.",3,104,0],["CHGX","CHGX",1,0,0],["CHH","Choice Hotels International Inc.",47,4487,0],["CHI","Calamos Convertible Opportunities and Income Fund",11,0,0],["CHIQ","CHIQ",1,0,0],["CHKP","Check Point Software Technologies Ltd.",25,20497,0],["CHMG","Chemung Financial Corp",26,277,0],["CHMI","Cherry Hill Mortgage Investment Corporation",30,97,0],["CHMI/PA","CHMI/PA",1,0,0],["CHMI/PB","CHMI/PB",1,0,0],["CHNR","China Natural Resources Inc.",104,5,0],["CHOW","ChowChow Cloud International Holdings Limited",25,31,0],["CHPG","ChampionsGate Acquisition Corporation Class A",1,0,0],["CHPGU","ChampionsGate Acquisition Corporation Unit",1,0,0],["CHPS","CHPS",1,0,0],["CHPT","ChargePoint Holdings Inc.",32,173,0],["CHPX","CHPX",1,0,0],["CHPY","CHPY",1,0,0],["CHR","Cheer Holding Inc. Class A",15,0,0],["CHRD","Chord Energy Corporation",59,5127,0],["CHRI","CHRI",1,0,0],["CHRS","Coherus Oncology Inc.",13,164,0],["CHRW","C.H. Robinson Worldwide Inc.",105,19665,0],["CHSCL","CHS Inc Class B Cumulative Redeemable",48,311,0],["CHSCM","CHS Inc Class B Reset Rate Cumulative Redeemable",48,303,0],["CHSCN","CHS Inc Preferred Class B Series 2 Reset Rate",48,306,0],["CHSCO","CHS Inc. Class B Cumulative Redeemable",48,317,0],["CHSCP","CHS Inc. 8% Cumulative Redeemable",48,345,0],["CHSN","Chanson International Holding Class A",17,87,0],["CHT","Chunghwa Telecom Co. Ltd.",33,31852,0],["CHTR","Charter Communications Inc. Class A",54,26529,0],["CHW","Calamos Global Dynamic Income Fund",11,0,0],["CHWY","Chewy Inc. Class A",57,13471,0],["CHY","Calamos Convertible and High Income Fund",11,0,0],["CHYM","Chime Financial Inc. Class A",44,9653,0],["CI","The Cigna Group",23,72629,0],["CIA","Citizens Inc. Class A",5,300,0],["CIB","Grupo Cibest S.A.",75,7987,0],["CIBR","CIBR",1,0,0],["CICB","CION Investment Corporation 7.50% Notes due 2029",123,0,0],["CIEN","Ciena Corporation",33,32444,0],["CIF","MFS Intermediate High Income Fund",81,0,0],["CIFG","CIFG",1,0,0],["CIFR","Cipher Mining Inc.",44,6404,0],["CIG","Comp En De Mn Cemig ADS",41,5666,0],["CIG.C","CIG.C",1,0,0],["CIGI","Colliers International Group Inc. Subordinate Voting Shares",36,7414,0],["CIGL","Concorde International Group Ltd Class A",12,44,0],["CII","BlackRock Enhanced Large Cap Core Fund Inc.",60,3561,0],["CIIT","Tianci International Inc.",59,10,0],["CIK","Credit Suisse Asset Management Income Fund Inc.",123,0,0],["CIL","CIL",1,0,0],["CIM","Chimera Investment Corporation",30,1073,0],["CIM/PA","CIM/PA",1,0,0],["CIM/PB","CIM/PB",1,0,0],["CIM/PC","CIM/PC",1,0,0],["CIM/PD","CIM/PD",1,0,0],["CIMN","Chimera Investment Corporation 9.000% Senior Notes due 2029",30,2041,0],["CIMO","Chimera Investment Corporation 9.250% Senior Notes due 2029",30,0,0],["CIMP","Chimera Investment Corporation 8.875% Senior Notes due 2030",30,0,0],["CINF","Cincinnati Financial Corporation",22,26100,0],["CING","Cingulate Inc.",8,27,0],["CINT","CI&T Inc Class A",15,633,0],["CIO","City Office REIT Inc.",30,281,0],["CIO/PA","CIO/PA",1,0,0],["CION","CION Investment Corporation",123,500,0],["CISO","CISO Global Inc.",19,19,0],["CISS","C3is Inc.",98,2,0],["CITR","General Enterprise Ventures Inc.",122,149,0],["CIVB","Civista Bancshares Inc.",26,462,0],["CIVI","Civitas Resources Inc.",59,2312,0],["CIX","CompX International Inc.",7,277,0],["CJMB","Callan JMB Inc.",36,7,0],["CKX","CKX Lands Inc.",59,19,0],["CL","Colgate-Palmolive Company",90,63163,0],["CLAR","Clarus Corporation",61,130,0],["CLB","Core Laboratories Inc.",20,756,0],["CLBK","Columbia Financial Inc.",84,1723,0],["CLBT","Cellebrite DI Ltd.",25,4600,0],["CLCG","CLCG",1,0,0],["CLCO","Cool Company Ltd.",98,529,0],["CLCV","CLCV",1,0,0],["CLDI","Calidi Biotherapeutics Inc.",13,10,0],["CLDT","Chatham Lodging Trust (REIT)",30,339,0],["CLDT/PA","CLDT/PA",1,0,0],["CLDX","Celldex Therapeutics Inc.",24,1701,0],["CLF","Cleveland-Cliffs Inc.",10,6540,0],["CLFD","Clearfield Inc.",33,396,0],["CLGN","CollPlant Biotechnologies Ltd",32,17,0],["CLH","Clean Harbors Inc.",122,12786,0],["CLIK","Click Holdings Limited Class A",12,19,0],["CLIP","CLIP",1,0,0],["CLIR","ClearSign Technologies Corporation",7,30,0],["CLIX","CLIX",1,0,0],["CLLS","Cellectis S.A.",8,315,0],["CLM","Cornerstone Strategic Investment Fund Inc.",123,0,0],["CLMB","Climb Global Solutions Inc.",100,497,0],["CLMT","Calumet Inc.",106,1758,0],["CLNE","Clean Energy Fuels Corp.",107,489,0],["CLNN","Clene Inc.",8,69,0],["CLOA","CLOA",1,0,0],["CLOB","CLOB",1,0,0],["CLOC","CLOC",1,0,0],["CLOD","CLOD",1,0,0],["CLOI","CLOI",1,0,0],["CLOU","CLOU",1,0,0],["CLOV","Clover Health Investments Corp. Class A",23,1333,0],["CLOX","CLOX",1,0,0],["CLOZ","CLOZ",1,0,0],["CLPR","Clipper Realty Inc.",30,55,0],["CLPS","CLPS Incorporation",25,25,0],["CLPT","ClearPoint Neuro Inc.",31,404,0],["CLRB","Cellectar Biosciences Inc. ",8,11,0],["CLRO","ClearOne Inc. (DE)",33,9,0],["CLS","Celestica Inc.",39,33624,0],["CLSK","CleanSpark Inc.",44,3075,0],["CLSM","CLSM",1,0,0],["CLST","Catalyst Bancorp Inc.",84,63,0],["CLVT","Clarivate Plc",15,2308,0],["CLW","Clearwater Paper Corporation",138,298,0],["CLWT","Euro Tech Holdings Company Limited",108,9,0],["CLX","Clorox Company (The)",135,11992,0],["CLYM","Climb Bio Inc.",8,292,0],["CM","Canadian Imperial Bank of Commerce",75,85960,0],["CMA","Comerica Incorporated",26,11275,0],["CMA/PB","CMA/PB",1,0,0],["CMBM","Cambium Networks Corporation",49,46,0],["CMBO","CMBO",1,0,0],["CMBS","CMBS",1,0,0],["CMBT","CMB.TECH NV",98,2112,0],["CMC","Commercial Metals Company",27,7711,0],["CMCL","Caledonia Mining Corporation Plc",104,519,0],["CMCM","Cheetah Mobile Inc.",25,5156,0],["CMCO","Columbus McKinnon Corporation",72,497,0],["CMCSA","Comcast Corporation Class A",54,107750,0],["CMCSV","Comcast Corporation Class A",54,0,0],["CMCT","Creative Media & Community Trust Corporation",30,3,0],["CMDB","Costamare Bulkers Holdings Limited",98,368,0],["CMDT","CMDT",1,0,0],["CMDY","CMDY",1,0,0],["CME","CME Group Inc. Class A",60,97033,0],["CMF","CMF",1,0,0],["CMG","Chipotle Mexican Grill Inc.",68,49771,0],["CMGG","CMGG",1,0,0],["CMI","Cummins Inc.",7,69946,0],["CMMB","Chemomab Therapeutics Ltd. American",8,10,0],["CMND","Clearmind Medicine Inc.",8,4,0],["CMP","Compass Minerals Intl Inc",74,820,0],["CMPO","CompoSecure Inc. Class A",44,2451,0],["CMPR","Cimpress plc",109,1801,0],["CMPS","COMPASS Pathways Plc American Depository Shares",8,612,0],["CMPX","Compass Therapeutics Inc.",13,888,0],["CMRC","Commerce.com Inc. Series 1",25,343,0],["CMRE","Costamare Inc.",98,1827,0],["CMRE/PB","CMRE/PB",1,0,0],["CMRE/PC","CMRE/PC",1,0,0],["CMRE/PD","CMRE/PD",1,0,0],["CMS","CMS Energy Corporation",129,21050,0],["CMS/PB","CMS/PB",1,0,0],["CMS/PC","CMS/PC",1,0,0],["CMSA","CMS Energy Corporation 5.625% Junior Subordinated Notes due 2078",129,6585,0],["CMSC","CMS Energy Corporation 5.875% Junior Subordinated Notes due 2078",129,6936,0],["CMSD","CMS Energy Corporation 5.875% Junior Subordinated Notes due 2079",129,6960,0],["CMT","Core Molding Technologies Inc",64,189,0],["CMTG","Claros Mortgage Trust Inc.",36,464,0],["CMTL","Comtech Telecommunications Corp.",49,99,0],["CMU","MFS Municipal Income Trust",11,98,0],["CNA","CNA Financial Corporation",22,12838,0],["CNBS","CNBS",1,0,0],["CNC","Centene Corporation",23,19179,0],["CNCK","Coincheck Group N.V.",44,293,0],["CNDT","Conduent Incorporated",36,315,0],["CNEQ","CNEQ",1,0,0],["CNET","ZW Data Action Technologies Inc.",16,4,0],["CNEY","CN Energy Group Inc. Class A",34,2,0],["CNF","CNFinance Holdings Limited",44,43,0],["CNH","CNH Industrial N.V.",72,11978,0],["CNI","Canadian National Railway Company",117,60442,0],["CNK","Cinemark Holdings Inc Cinemark Holdings Inc.",89,2616,0],["CNL","Collective Mining Ltd.",1,1287,0],["CNM","Core & Main Inc. Class A",40,10532,0],["CNMD","CONMED Corporation",77,1237,0],["CNNE","Cannae Holdings Inc.",68,793,0],["CNO","CNO Financial Group Inc.",143,4153,0],["CNO/PA","CNO/PA",1,0,0],["CNOB","ConnectOne Bancorp Inc.",26,1387,0],["CNOBP","ConnectOne Bancorp Inc.",26,1215,0],["CNP","CenterPoint Energy Inc (Holding Co)",41,24548,0],["CNQ","Canadian Natural Resources Limited",59,66451,0],["CNQQ","CNQQ",1,0,0],["CNR","Core Natural Resources Inc.",65,4528,0],["CNRG","CNRG",1,0,0],["CNS","Cohen & Steers Inc",11,3180,0],["CNSP","CNS Pharmaceuticals Inc.",8,4,0],["CNTA","Centessa Pharmaceuticals plc",8,3562,0],["CNTB","Connect Biopharma Holdings Limited",8,127,0],["CNTX","Context Therapeutics Inc.",8,117,0],["CNTY","Century Casinos Inc.",47,40,0],["CNVS","Cineverse Corp. Class A",110,41,0],["CNX","CNX Resources Corporation",59,5080,0],["CNXC","Concentrix Corporation",25,2591,0],["CNXN","PC Connection Inc.",57,1502,0],["CNXT","CNXT",1,0,0],["COAL","COAL",1,0,0],["COCH","Envoy Medical Inc. Class A",32,21,0],["COCO","The Vita Coco Company Inc.",46,3046,0],["COCP","Cocrystal Pharma Inc.",8,14,0],["CODA","Coda Octopus Group Inc.",7,106,0],["CODI","D/B/A Compass Diversified Holdings Shares of Beneficial Interest",73,360,0],["CODI/PA","CODI/PA",1,0,0],["CODI/PB","CODI/PB",1,0,0],["CODI/PC","CODI/PC",1,0,0],["CODX","Co-Diagnostics Inc.",31,16,0],["COE","51Talk Online Education Group",3,194,0],["COEP","Coeptis Therapeutics Holdings Inc.",13,79,0],["COF","Capital One Financial Corporation",26,154947,0],["COF/PI","COF/PI",1,0,0],["COF/PJ","COF/PJ",1,0,0],["COF/PK","COF/PK",1,0,0],["COF/PL","COF/PL",1,0,0],["COF/PN","COF/PN",1,0,0],["COFS","ChoiceOne Financial Services Inc.",26,458,0],["COGT","Cogent Biosciences Inc.",8,5631,0],["COHN","Cohen & Company Inc.",60,31,0],["COHR","Coherent Corp.",76,34828,0],["COHU","Cohu Inc.",39,1098,0],["COIA","COIA",1,0,0],["COIG","COIG",1,0,0],["COIN","Coinbase Global Inc. Class A",44,66095,0],["COKE","Coca-Cola Consolidated Inc.",46,14200,0],["COLA","Columbus Acquisition Corp",1,0,0],["COLAU","Columbus Acquisition Corp Unit",1,0,0],["COLB","Columbia Banking System Inc.",26,8630,0],["COLD","Americold Realty Trust Inc.",30,3478,0],["COLL","Collegium Pharmaceutical Inc.",8,1545,0],["COLM","Columbia Sportswear Company",86,2976,0],["COLO","COLO",1,0,0],["COM","COM",1,0,0],["COMB","COMB",1,0,0],["COMM","CommScope Holding Company Inc.",49,4052,0],["COMP","Compass Inc. Class A",15,5948,0],["COMT","COMT",1,0,0],["CON","Concentra Group Holdings Parent Inc.",23,2490,0],["CONI","CONI",1,0,0],["CONL","CONL",1,0,0],["CONX","CONX",1,0,0],["CONY","CONY",1,0,0],["COO","The Cooper Companies Inc.",111,16217,0],["COOK","Traeger Inc.",133,141,0],["COOT","Australian Oilseeds Holdings Limited",17,17,0],["COP","ConocoPhillips",106,113612,0],["COPJ","COPJ",1,0,0],["COPL","Copley Acquisition Corp",1,0,0],["COPP","COPP",1,0,0],["COPX","COPX",1,0,0],["COPY","COPY",1,0,0],["COR","Cencora Inc.",112,66138,0],["CORB","CORB",1,0,0],["CORN","CORN",1,0,0],["CORO","CORO",1,0,0],["CORP","CORP",1,0,0],["CORT","Corcept Therapeutics Incorporated",8,8811,0],["CORZ","Core Scientific Inc.",44,4837,0],["COSM","Cosmos Health Inc.",112,17,0],["COSO","CoastalSouth Bancshares Inc.",26,292,0],["COST","Costco Wholesale Corporation",113,379784,0],["COTG","COTG",1,0,0],["COTY","Coty Inc. Class A",90,2851,0],["COUR","Coursera Inc.",25,1260,0],["COWG","COWG",1,0,0],["COWS","COWS",1,0,0],["COYA","Coya Therapeutics Inc.",8,115,0],["COYY","COYY",1,0,0],["CP","Canadian Pacific Kansas City Limited",117,66842,0],["CPA","Copa Holdings S.A. Class A",4,5110,0],["CPAC","Cementos Pacasmayo S.A.A.",38,901,0],["CPAG","CPAG",1,0,0],["CPAI","CPAI",1,0,0],["CPAY","Corpay Inc.",36,21674,0],["CPB","The Campbell\'s Company",17,8521,0],["CPBI","Central Plains Bancshares Inc.",84,71,0],["CPER","CPER",1,0,0],["CPF","Central Pacific Financial Corp New",26,871,0],["CPHC","Canterbury Park Holding Corporation \'New\'",45,74,0],["CPHI","China Pharma Holdings Inc.",8,7,0],["CPHY","CPHY",1,0,0],["CPII","CPII",1,0,0],["CPIX","Cumberland Pharmaceuticals Inc.",8,66,0],["CPK","Chesapeake Utilities Corporation",59,2959,0],["CPLB","CPLB",1,0,0],["CPLS","CPLS",1,0,0],["CPNG","Coupang Inc. Class A",57,42378,0],["CPNJ","CPNJ",1,0,0],["CPNM","CPNM",1,0,0],["CPNQ","CPNQ",1,0,0],["CPNS","CPNS",1,0,0],["CPOP","Pop Culture Group Co. Ltd Class A",45,38,0],["CPRA","CPRA",1,0,0],["CPRI","Capri Holdings Limited",86,3008,0],["CPRJ","CPRJ",1,0,0],["CPRO","CPRO",1,0,0],["CPRT","Copart Inc. (DE)",97,37820,0],["CPRX","Catalyst Pharmaceuticals Inc.",8,2918,0],["CPRY","CPRY",1,0,0],["CPS","Cooper-Standard Holdings Inc.",42,614,0],["CPSA","CPSA",1,0,0],["CPSD","CPSD",1,0,0],["CPSF","CPSF",1,0,0],["CPSH","CPS Technologies Corp.",38,58,0],["CPSJ","CPSJ",1,0,0],["CPSM","CPSM",1,0,0],["CPSN","CPSN",1,0,0],["CPSO","CPSO",1,0,0],["CPSP","CPSP",1,0,0],["CPSR","CPSR",1,0,0],["CPSS","Consumer Portfolio Services Inc.",44,211,0],["CPST","CPST",1,0,0],["CPSU","CPSU",1,0,0],["CPSY","CPSY",1,0,0],["CPT","Camden Property Trust",30,11414,0],["CPXR","CPXR",1,0,0],["CPZ","Calamos Long/Short Equity & Dynamic Income Trust",81,292,0],["CQP","Cheniere Energy Partners LP Common",140,25887,0],["CQQQ","CQQQ",1,0,0],["CR","Crane Company",55,10771,0],["CRAC","Crown Reserve Acquisition Corp. I Class A",1,0,0],["CRACU","Crown Reserve Acquisition Corp. I Unit",2,0,0],["CRAI","CRA International Inc.",3,1370,0],["CRAK","CRAK",1,0,0],["CRANU","Crane Harbor Acquisition Corp. II",1,0,0],["CRAQ","Cal Redwood Acquisition Corp. Class A",2,0,0],["CRBD","Corebridge Financial Inc. 6.375% Junior Subordinated Notes due 2064",5,0,0],["CRBG","Corebridge Financial Inc.",5,15990,0],["CRBN","CRBN",1,0,0],["CRBP","Corbus Pharmaceuticals Holdings Inc.",8,143,0],["CRBU","Caribou Biosciences Inc.",13,157,0],["CRC","California Resources Corporation",59,3650,0],["CRCA","CRCA",1,0,0],["CRCG","CRCG",1,0,0],["CRCL","Circle Internet Group Inc. Class A",44,20282,0],["CRCO","CRCO",1,0,0],["CRCT","Cricut Inc. Class A",7,1078,0],["CRD.A","CRD.A",1,0,0],["CRD.B","CRD.B",1,0,0],["CRDF","Cardiff Oncology Inc.",13,173,0],["CRDL","Cardiol Therapeutics Inc. Class A",13,101,0],["CRDO","Credo Technology Group Holding Ltd",6,27118,0],["CRDT","CRDT",1,0,0],["CRE","Cre8 Enterprise Limited Class A",109,8,0],["CRED","CRED",1,0,0],["CREG","Smart Powerr Corp.",36,20,0],["CRESY","Cresud S.A.C.I.F. y A.",36,720,0],["CREV","Carbon Revolution Public Limited",42,3,0],["CREX","Creative Realities Inc.",15,29,0],["CRF","Cornerstone Total Return Fund Inc. (The)",123,0,0],["CRGO","Freightos Limited",105,122,0],["CRGY","Crescent Energy Company Class A",59,2050,0],["CRH","CRH PLC",38,83279,0],["CRI","Carter\'s Inc.",86,1165,0],["CRIS","Curis Inc.",13,14,0],["CRK","Comstock Resources Inc.",59,6315,0],["CRL","Charles River Laboratories International Inc.",14,9698,0],["CRM","Salesforce Inc.",25,243536,0],["CRMD","CorMedix Inc.",8,947,0],["CRMG","CRMG",1,0,0],["CRML","Critical Metals Corp.",10,805,0],["CRMT","America\'s Car-Mart Inc",97,223,0],["CRNC","Cerence Inc.",25,504,0],["CRNT","Ceragon Networks Ltd.",49,190,0],["CRNX","Crinetics Pharmaceuticals Inc.",8,4556,0],["CRON","Cronos Group Inc.",18,1133,0],["CROX","Crocs Inc.",114,4637,0],["CRPT","CRPT",1,0,0],["CRS","Carpenter Technology Corporation",27,16298,0],["CRSH","CRSH",1,0,0],["CRSP","CRISPR Therapeutics AG",13,5323,0],["CRSR","Corsair Gaming Inc.",53,654,0],["CRT","Cross Timbers Royalty Trust",59,48,0],["CRTC","CRTC",1,0,0],["CRTO","Criteo S.A.",58,1025,0],["CRUS","Cirrus Logic Inc.",6,6182,0],["CRVL","CorVel Corp.",28,3525,0],["CRVO","CervoMed Inc.",8,70,0],["CRVS","Corvus Pharmaceuticals Inc.",8,559,0],["CRWD","CrowdStrike Holdings Inc. Class A",25,121330,0],["CRWG","CRWG",1,0,0],["CRWL","CRWL",1,0,0],["CRWS","Crown Crafts Inc",115,28,0],["CRWV","CoreWeave Inc. Class A",25,41360,0],["CRXP","CRXP",1,0,0],["CSAI","Cloudastructure Inc. Class A",16,22,0],["CSAN","Cosan S.A. ADS",97,1877,0],["CSB","CSB",1,0,0],["CSBR","Champions Oncology Inc.",13,100,0],["CSCL","CSCL",1,0,0],["CSCO","Cisco Systems Inc.",51,309845,0],["CSCS","CSCS",1,0,0],["CSD","CSD",1,0,0],["CSGP","CoStar Group Inc.",36,27646,0],["CSGS","CSG Systems International Inc.",15,2196,0],["CSHI","CSHI",1,0,0],["CSHP","CSHP",1,0,0],["CSIO","CSIO",1,0,0],["CSIQ","Canadian Solar Inc.",6,1640,0],["CSL","Carlisle Companies Incorporated",135,13737,0],["CSMD","CSMD",1,0,0],["CSNR","CSNR",1,0,0],["CSPF","CSPF",1,0,0],["CSPI","CSP Inc.",15,133,0],["CSQ","Calamos Strategic Total Return",116,3054,0],["CSR","D/B/A Centerspace",30,1091,0],["CSRE","CSRE",1,0,0],["CSSD","CSSD",1,0,0],["CSTE","Caesarstone Ltd.",38,62,0],["CSTL","Castle Biosciences Inc.",23,1151,0],["CSTM","Constellium SE",55,2585,0],["CSV","Carriage Services Inc.",3,681,0],["CSW","CSW Industrials Inc.",73,5106,0],["CSWC","Capital Southwest Corporation",115,1240,0],["CSX","CSX Corporation",117,67968,0],["CTA","CTA",1,0,0],["CTA/PA","CTA/PA",1,0,0],["CTA/PB","CTA/PB",1,0,0],["CTAP","CTAP",1,0,0],["CTAS","Cintas Corporation",118,75378,0],["CTBI","Community Trust Bancorp Inc.",26,1064,0],["CTEC","CTEC",1,0,0],["CTEV","Claritev Corporation Class A",36,678,0],["CTEX","CTEX",1,0,0],["CTGO","Contango ORE Inc.",104,423,0],["CTKB","Cytek Biosciences Inc.",71,633,0],["CTLP","Cantaloupe Inc.",92,780,0],["CTM","Castellum Inc.",19,100,0],["CTMX","CytomX Therapeutics Inc.",8,678,0],["CTNM","Contineum Therapeutics Inc. Class A",8,429,0],["CTNT","Cheetah Net Supply Chain Service Inc. Class A",119,4,0],["CTO","CTO Realty Growth Inc.",30,585,0],["CTO/PA","CTO/PA",1,0,0],["CTOR","Citius Oncology Inc.",8,118,0],["CTOS","Custom Truck One Source Inc.",12,1350,0],["CTRA","Coterra Energy Inc.",59,19324,0],["CTRE","CareTrust REIT Inc.",30,8113,0],["CTRI","Centuri Holdings Inc.",59,2316,0],["CTRM","Castor Maritime Inc.",98,22,0],["CTRN","Citi Trends Inc.",120,350,0],["CTS","CTS Corporation",39,1273,0],["CTSH","Cognizant Technology Solutions Corporation Class A",15,41223,0],["CTSO","Cytosorbents Corporation",31,40,0],["CTVA","Corteva Inc.",48,44808,0],["CTW","CTW Cayman Class A",15,112,0],["CTWO","CTWO",1,0,0],["CTXR","Citius Pharmaceuticals Inc.",8,18,0],["CUB","Lionheart Holdings Class A",7,338,0],["CUBB","Customers Bancorp Inc 5.375% Subordinated Notes Due 2034",26,702,0],["CUBE","CubeSmart",30,8111,0],["CUBI","Customers Bancorp Inc",26,2591,0],["CUBWU","Lionheart Holdings Unit",2,0,0],["CUE","Cue Biopharma Inc.",8,21,0],["CUK","Carnival Plc ADS ADS",98,41983,0],["CULP","Culp Inc.",115,44,0],["CUPR","Cuprina Holdings (Cayman) Limited Class A",8,9,0],["CURB","Curbline Properties Corp.",36,2469,0],["CURE","CURE",1,0,0],["CURI","CuriosityStream Inc. Class A",89,238,0],["CURR","Currenc Group Inc.",36,133,0],["CURV","Torrid Holdings Inc.",120,107,0],["CURX","Curanex Pharmaceuticals Inc",8,11,0],["CUT","CUT",1,0,0],["CUZ","Cousins Properties Incorporated",30,4234,0],["CV","CapsoVision Inc.",77,620,0],["CVAC","CureVac N.V.",8,933,0],["CVBF","CVB Financial Corporation",26,2673,0],["CVCO","Cavco Industries Inc.",121,4722,0],["CVE","Cenovus Energy Inc",59,29844,0],["CVEO","Civeo Corporation (Canada)",47,265,0],["CVGI","Commercial Vehicle Group Inc.",42,56,0],["CVGW","Calavo Growers Inc.",93,394,0],["CVI","CVR Energy Inc.",106,2771,0],["CVIE","CVIE",1,0,0],["CVKD","Cadrenal Therapeutics Inc.",8,17,0],["CVLC","CVLC",1,0,0],["CVLG","Covenant Logistics Group Inc. Class A",63,567,0],["CVLT","Commvault Systems Inc.",25,5520,0],["CVM","Cel-Sci Corporation",13,34,0],["CVMC","CVMC",1,0,0],["CVNA","Carvana Co. Class A",97,97942,0],["CVNX","CVNX",1,0,0],["CVNY","CVNY",1,0,0],["CVR","Chicago Rivet & Machine Co.",7,12,0],["CVRD","CVRD",1,0,0],["CVRT","CVRT",1,0,0],["CVRX","CVRx Inc.",31,210,0],["CVS","CVS Health Corporation",142,98660,0],["CVSB","CVSB",1,0,0],["CVU","CPI Aerostructures Inc.",21,44,0],["CVV","CVD Equipment Corporation",7,21,0],["CVX","Chevron Corporation",106,297498,0],["CVY","CVY",1,0,0],["CW","Curtiss-Wright Corporation",7,20462,0],["CWAN","Clearwater Analytics Holdings Inc. Class A",25,6512,0],["CWB","CWB",1,0,0],["CWBC","Community West Bancshares",26,441,0],["CWCO","Consolidated Water Co. Ltd.",70,571,0],["CWD","CaliberCos Inc. Class A",36,10,0],["CWEB","CWEB",1,0,0],["CWEN","Clearway Energy Inc. Class C",41,6651,0],["CWEN.A","CWEN.A",1,0,0],["CWH","Camping World Holdings Inc. Class A",97,1023,0],["CWI","CWI",1,0,0],["CWK","Cushman & Wakefield Ltd.",36,3747,0],["CWS","CWS",1,0,0],["CWST","Casella Waste Systems Inc. Class A",122,6253,0],["CWT","California Water Service Group",70,2555,0],["CX","Cemex S.A.B. de C.V. Sponsored ADR",38,16916,0],["CXAI","CXApp Inc. Class A",15,11,0],["CXDO","Crexendo Inc.",33,213,0],["CXE","MFS High Income Municipal Trust",11,118,0],["CXH","MFS Investment Grade Municipal Trust",11,72,0],["CXM","Sprinklr Inc. Class A",25,1934,0],["CXRN","CXRN",1,0,0],["CXSE","CXSE",1,0,0],["CXT","Crane NXT Co.",55,2710,0],["CXW","CoreCivic Inc.",30,1984,0],["CYBN","Cybin Inc.",8,358,0],["CYBR","CyberArk Software Ltd.",25,22346,0],["CYCN","Cyclerion Therapeutics Inc.",8,6,0],["CYCU","Cycurion Inc.",15,10,0],["CYD","China Yuchai International Limited",7,1361,0],["CYH","Community Health Systems Inc.",126,452,0],["CYN","Cyngn Inc.",15,26,0],["CYPH","Cypherpunk Technologies Inc.",8,74,0],["CYRX","CryoPort Inc.",8,472,0],["CYTK","Cytokinetics Incorporated",8,7668,0],["CZA","CZA",1,0,0],["CZAR","CZAR",1,0,0],["CZFS","Citizens Financial Services Inc.",26,283,0],["CZNC","Citizens & Northern Corp",26,374,0],["CZR","Caesars Entertainment Inc.",47,4976,0],["CZWI","Citizens Community Bancorp Inc.",84,178,0],["D","Dominion Energy Inc.",41,50748,0],["DAAQ","Digital Asset Acquisition Corp. Class A",1,0,0],["DAAQU","DAAQU",1,0,0],["DABS","DABS",1,0,0],["DAC","Danaos Corporation",98,1721,0],["DADS","DADS",1,0,0],["DAIC","CID HoldCo Inc.",15,33,0],["DAIO","Data I/O Corporation",39,28,0],["DAK","DAK",1,0,0],["DAKT","Daktronics Inc.",69,917,0],["DAL","Delta Air Lines Inc.",4,46400,0],["DALI","DALI",1,0,0],["DAMD","DAMD",1,0,0],["DAN","Dana Incorporated",42,2773,0],["DANA","DANA",1,0,0],["DAO","Youdao Inc.",3,1074,0],["DAPP","DAPP",1,0,0],["DAR","Darling Ingredients Inc.",17,5437,0],["DARE","Dare Bioscience Inc.",8,30,0],["DARP","DARP",1,0,0],["DASH","DoorDash Inc. Class A",15,100961,0],["DAT","DAT",1,0,0],["DAVA","Endava plc",15,372,0],["DAVE","Dave Inc. Class A",44,2907,0],["DAWN","Day One Biopharmaceuticals Inc.",8,949,0],["DAX","DAX",1,0,0],["DAY","Dayforce Inc.",25,11086,0],["DB","Deutsche Bank AG",26,75121,0],["DBA","DBA",1,0,0],["DBAW","DBAW",1,0,0],["DBB","DBB",1,0,0],["DBC","DBC",1,0,0],["DBD","Diebold Nixdorf Incorporated",92,2459,0],["DBE","DBE",1,0,0],["DBEF","DBEF",1,0,0],["DBEM","DBEM",1,0,0],["DBEU","DBEU",1,0,0],["DBEZ","DBEZ",1,0,0],["DBGI","Digital Brands Group Inc.",120,87,0],["DBI","Designer Brands Inc. Class A",120,379,0],["DBJP","DBJP",1,0,0],["DBL","DoubleLine Opportunistic Credit Fund",1,0,0],["DBMF","DBMF",1,0,0],["DBND","DBND",1,0,0],["DBO","DBO",1,0,0],["DBP","DBP",1,0,0],["DBRG","DigitalBridge Group Inc.",30,2409,0],["DBRG/PH","DBRG/PH",1,0,0],["DBRG/PI","DBRG/PI",1,0,0],["DBRG/PJ","DBRG/PJ",1,0,0],["DBSC","DBSC",1,0,0],["DBVT","DBV Technologies S.A.",13,770,0],["DBX","Dropbox Inc. Class A",25,7423,0],["DC","Dakota Gold Corp.",10,659,0],["DCBO","Docebo Inc.",25,628,0],["DCGO","DocGo Inc.",35,87,0],["DCI","Donaldson Company Inc.",101,10681,0],["DCMT","DCMT",1,0,0],["DCO","Ducommun Incorporated",21,1409,0],["DCOM","Dime Community Bancshares Inc.",26,1393,0],["DCOMG","Dime Community Bancshares Inc. 9.000% Fixed-to-Floating Rate Subordinated Notes due 2034",26,1043,0],["DCOMP","Dime Community Bancshares Inc. Fixed-Rate Non-Cumulative Perpetual",26,799,0],["DCOR","DCOR",1,0,0],["DCRE","DCRE",1,0,0],["DCTH","Delcath Systems Inc.",31,355,0],["DCX","Digital Currency X Technology Inc. Class A",37,6,0],["DD","DuPont de Nemours Inc.",34,17287,0],["DDC","DDC Enterprise Limited Class A",17,9,0],["DDD","3D Systems Corporation",25,237,0],["DDI","DoubleDown Interactive Co. Ltd. American Depository Shares",15,426,0],["DDIV","DDIV",1,0,0],["DDL","Dingdong (Cayman) Limited",57,600,0],["DDM","DDM",1,0,0],["DDOG","Datadog Inc. Class A",25,49231,0],["DDS","Dillard\'s Inc.",113,10361,0],["DDT","Dillard\'s Capital Trust I",113,410,0],["DE","Deere & Company",7,127209,0],["DEA","Easterly Government Properties Inc.",30,989,0],["DEC","Diversified Energy Company",1,1052,0],["DECK","Deckers Outdoor Corporation",114,14497,0],["DECO","DECO",1,0,0],["DECT","DECT",1,0,0],["DECW","DECW",1,0,0],["DEED","DEED",1,0,0],["DEEF","DEEF",1,0,0],["DEEP","DEEP",1,0,0],["DEFI","DEFI",1,0,0],["DEFT","Defi Technologies Inc.",44,417,0],["DEHP","DEHP",1,0,0],["DEI","Douglas Emmett Inc.",30,1855,0],["DELL","Dell Technologies Inc. Class C",9,83777,0],["DEM","DEM",1,0,0],["DEMZ","DEMZ",1,0,0],["DENN","Denny\'s Corporation",68,320,0],["DEO","Diageo plc",46,49627,0],["DERM","Journey Medical Corporation",8,214,0],["DES","DES",1,0,0],["DESK","DESK",1,0,0],["DEUS","DEUS",1,0,0],["DEVS","DevvStream Corp.",123,6,0],["DEW","DEW",1,0,0],["DEXC","DEXC",1,0,0],["DFAC","DFAC",1,0,0],["DFAE","DFAE",1,0,0],["DFAI","DFAI",1,0,0],["DFAR","DFAR",1,0,0],["DFAS","DFAS",1,0,0],["DFAT","DFAT",1,0,0],["DFAU","DFAU",1,0,0],["DFAW","DFAW",1,0,0],["DFAX","DFAX",1,0,0],["DFCA","DFCA",1,0,0],["DFCF","DFCF",1,0,0],["DFDV","DeFi Development Corp.",44,162,0],["DFE","DFE",1,0,0],["DFEM","DFEM",1,0,0],["DFEN","DFEN",1,0,0],["DFEV","DFEV",1,0,0],["DFGP","DFGP",1,0,0],["DFGR","DFGR",1,0,0],["DFGX","DFGX",1,0,0],["DFH","Dream Finders Homes Inc. Class A",121,1660,0],["DFII","DFII",1,0,0],["DFIN","Donnelley Financial Solutions Inc.",3,1220,0],["DFIP","DFIP",1,0,0],["DFIV","DFIV",1,0,0],["DFJ","DFJ",1,0,0],["DFLI","Dragonfly Energy Holdings Corp.",7,49,0],["DFLV","DFLV",1,0,0],["DFNM","DFNM",1,0,0],["DFP","Flaherty & Crumrine Dynamic Preferred and Income Fund Inc.",11,0,0],["DFSB","DFSB",1,0,0],["DFSC","DEFSEC Technologies Inc.",25,3,0],["DFSD","DFSD",1,0,0],["DFSE","DFSE",1,0,0],["DFSI","DFSI",1,0,0],["DFSU","DFSU",1,0,0],["DFSV","DFSV",1,0,0],["DFTT","DFTT",1,0,0],["DFUS","DFUS",1,0,0],["DFUV","DFUV",1,0,0],["DFVE","DFVE",1,0,0],["DFVX","DFVX",1,0,0],["DG","Dollar General Corporation",113,30218,0],["DGCB","DGCB",1,0,0],["DGICA","Donegal Group Inc. Class A",22,752,0],["DGICB","Donegal Group Inc. Class B",22,628,0],["DGII","Digi International Inc.",51,1633,0],["DGIN","DGIN",1,0,0],["DGLO","DGLO",1,0,0],["DGLY","Digital Ally Inc.",49,4,0],["DGNX","Diginex Limited",15,1410,0],["DGP","DGP",1,0,0],["DGRE","DGRE",1,0,0],["DGRO","DGRO",1,0,0],["DGRS","DGRS",1,0,0],["DGRW","DGRW",1,0,0],["DGS","DGS",1,0,0],["DGT","DGT",1,0,0],["DGX","Quest Diagnostics Incorporated",23,19585,0],["DGXX","Digi Power X Inc. Subordinate Voting Shares",44,185,0],["DGZ","DGZ",1,0,0],["DH","Definitive Healthcare Corp. Class A",25,262,0],["DHC","Diversified Healthcare Trust",30,1245,0],["DHCNI","Diversified Healthcare Trust 5.625% Senior Notes due 2042",30,4114,0],["DHCNL","Diversified Healthcare Trust 6.25% Senior Notes Due 2046",30,4319,0],["DHF","BNY Mellon High Yield Strategies Fund",116,0,0],["DHI","D.R. Horton Inc.",121,42985,0],["DHIL","Diamond Hill Investment Group Inc. Class A",11,456,0],["DHLX","DHLX",1,0,0],["DHR","Danaher Corporation",7,158816,0],["DHS","DHS",1,0,0],["DHSB","DHSB",1,0,0],["DHT","DHT Holdings Inc.",98,1964,0],["DHX","DHI Group Inc.",36,72,0],["DHY","Credit Suisse High Yield Credit Fund",123,0,0],["DIA","DIA",1,0,0],["DIAL","DIAL",1,0,0],["DIAX","Nuveen Dow 30SM Dynamic Overwrite Fund",116,0,0],["DIBS","1stdibs.com Inc.",57,217,0],["DIEM","DIEM",1,0,0],["DIG","DIG",1,0,0],["DIM","DIM",1,0,0],["DIME","DIME",1,0,0],["DIN","Dine Brands Global Inc.",68,495,0],["DINO","HF Sinclair Corporation",107,8684,0],["DIOD","Diodes Incorporated",6,2361,0],["DIPS","DIPS",1,0,0],["DIS","Walt Disney Company (The)",45,198596,0],["DISO","DISO",1,0,0],["DIT","AMCON Distributing Company",103,69,0],["DIV","DIV",1,0,0],["DIVD","DIVD",1,0,0],["DIVE","DIVE",1,0,0],["DIVG","DIVG",1,0,0],["DIVI","DIVI",1,0,0],["DIVL","DIVL",1,0,0],["DIVO","DIVO",1,0,0],["DIVP","DIVP",1,0,0],["DIVS","DIVS",1,0,0],["DIVY","DIVY",1,0,0],["DIVZ","DIVZ",1,0,0],["DJCO","Daily Journal Corp. (S.C.)",124,724,0],["DJD","DJD",1,0,0],["DJIA","DJIA",1,0,0],["DJP","DJP",1,0,0],["DJT","Trump Media & Technology Group Corp.",16,4505,0],["DK","Delek US Holdings Inc.",106,1843,0],["DKI","DarkIris Inc. Class A",25,7,0],["DKL","Delek Logistics Partners L.P. Common",107,2379,0],["DKNG","DraftKings Inc. Class A",45,17029,0],["DKNX","DKNX",1,0,0],["DKS","Dick\'s Sporting Goods Inc",66,19086,0],["DLB","Dolby Laboratories",29,6327,0],["DLHC","DLH Holdings Corp.",19,82,0],["DLLL","DLLL",1,0,0],["DLN","DLN",1,0,0],["DLNG","Dynagas LNG Partners LP Common",98,144,0],["DLNG/PA","DLNG/PA",1,0,0],["DLO","DLocal Limited Class A",36,4065,0],["DLPN","Dolphin Entertainment Inc.",3,18,0],["DLR","Digital Realty Trust Inc.",30,51522,0],["DLR/PJ","DLR/PJ",1,0,0],["DLR/PK","DLR/PK",1,0,0],["DLR/PL","DLR/PL",1,0,0],["DLS","DLS",1,0,0],["DLTH","Duluth Holdings Inc. Class B",120,81,0],["DLTR","Dollar Tree Inc.",113,25421,0],["DLX","Deluxe Corporation",109,1010,0],["DLXY","Delixy Holdings Limited",80,14,0],["DLY","DoubleLine Yield Opportunities Fund",11,696,0],["DMA","Destra Multi-Alternative Fund",81,0,0],["DMAA","Drugs Made In America Acquisition Corp.",1,0,0],["DMAAU","DMAAU",1,0,0],["DMAC","DiaMedica Therapeutics Inc.",8,442,0],["DMAT","DMAT",1,0,0],["DMB","BNY Mellon Municipal Bond Infrastructure Fund Inc.",81,0,0],["DMBS","DMBS",1,0,0],["DMCY","DMCY",1,0,0],["DMII","Drugs Made In America Acquisition II Corp.",2,0,0],["DMIIU","Drugs Made In America Acquisition II Corp. Unit",1,0,0],["DMLP","Dorchester Minerals L.P. Common",59,1071,0],["DMO","Western Asset Mortgage Opportunity Fund Inc.",81,0,0],["DMRC","Digimarc Corporation",15,176,0],["DMX","DMX",1,0,0],["DMXF","DMXF",1,0,0],["DNA","Ginkgo Bioworks Holdings Inc. Class A",13,491,0],["DNL","DNL",1,0,0],["DNLI","Denali Therapeutics Inc.",13,2625,0],["DNMX","Dynamix Corporation III Class A",2,0,0],["DNMXU","Dynamix Corporation III Unit",2,0,0],["DNN","Denison Mines Corp",52,2459,0],["DNOW","DNOW Inc.",88,1438,0],["DNP","DNP Select Income Fund Inc.",11,0,0],["DNTH","Dianthus Therapeutics Inc.",8,1820,0],["DNUT","Krispy Kreme Inc.",67,781,0],["DOC","Healthpeak Properties Inc.",30,11112,0],["DOCN","DigitalOcean Holdings Inc.",16,4348,0],["DOCS","Doximity Inc. Class A",15,8218,0],["DOCU","DocuSign Inc.",25,14015,0],["DOG","DOG",1,0,0],["DOGZ","Dogness (International) Corporation Class A",69,141,0],["DOL","DOL",1,0,0],["DOLE","Dole plc",48,1453,0],["DOMH","Dominari Holdings Inc.",8,73,0],["DOMO","Domo Inc. Class B",25,361,0],["DON","DON",1,0,0],["DOO","BRP Inc. Common Subordinate Voting Shares",32,5267,0],["DORM","Dorman Products Inc.",42,3867,0],["DOUG","Douglas Elliman Inc.",36,219,0],["DOV","Dover Corporation",7,26911,0],["DOW","Dow Inc.",34,16532,0],["DOX","Amdocs Limited",15,8688,0],["DOYU","DouYu International Holdings Limited ADS",16,213,0],["DPG","Duff & Phelps Utility and Infrastructure Fund Inc.",81,0,0],["DPRO","Draganfly Inc.",50,175,0],["DPST","DPST",1,0,0],["DPZ","Domino\'s Pizza Inc",103,14579,0],["DQ","DAQO New Energy Corp.",6,2211,0],["DRAI","DRAI",1,0,0],["DRAY","DRAY",1,0,0],["DRCT","Direct Digital Holdings Inc. Class A",58,2,0],["DRD","DRDGOLD Limited",104,2701,0],["DRDB","Roman DBDR Acquisition Corp. II",1,0,0],["DRDBU","Roman DBDR Acquisition Corp. II Unit",1,0,0],["DRES","DRES",1,0,0],["DRH","Diamondrock Hospitality Company",30,1876,0],["DRH/PA","DRH/PA",1,0,0],["DRI","Darden Restaurants Inc.",68,22084,0],["DRIO","DarioHealth Corp.",31,78,0],["DRIP","DRIP",1,0,0],["DRIV","DRIV",1,0,0],["DRKY","DRKY",1,0,0],["DRLL","DRLL",1,0,0],["DRMA","Dermata Therapeutics Inc.",8,2,0],["DRN","DRN",1,0,0],["DRNZ","DRNZ",1,0,0],["DRS","Leonardo DRS Inc.",7,8949,0],["DRTS","Alpha Tau Medical Ltd.",31,357,0],["DRUG","Bright Minds Biosciences Inc.",8,595,0],["DRUP","DRUP",1,0,0],["DRV","DRV",1,0,0],["DRVN","Driven Brands Holdings Inc.",79,2450,0],["DSACU","Daedalus Special Acquisition Corp. Unit",2,0,0],["DSGN","Design Therapeutics Inc.",8,551,0],["DSGR","Distribution Solutions Group Inc.",32,1334,0],["DSGX","Descartes Systems Group Inc. (The)",25,7697,0],["DSI","DSI",1,0,0],["DSL","DoubleLine Income Solutions Fund",81,1143,0],["DSM","BNY Mellon Strategic Municipal Bond Fund Inc.",11,0,0],["DSMC","DSMC",1,0,0],["DSP","Viant Technology Inc. Class A",16,734,0],["DSPY","DSPY",1,0,0],["DSS","DSS Inc.",125,9,0],["DSTL","DSTL",1,0,0],["DSTX","DSTX",1,0,0],["DSU","Blackrock Debt Strategies Fund Inc.",116,0,0],["DSWL","Deswell Industries Inc.",64,53,0],["DSX","Diana Shipping inc.",98,193,0],["DSX/PB","DSX/PB",1,0,0],["DSY","Big Tree Cloud Holdings Limited",125,30,0],["DT","Dynatrace Inc.",25,13317,0],["DTAN","DTAN",1,0,0],["DTB","DTE Energy Company 2020 Series G 4.375% Junior Subordinated Debentures due 2080",41,3607,0],["DTCK","Davis Commodities Limited Class A",48,6,0],["DTCR","DTCR",1,0,0],["DTCX","Datacentrex Inc.",15,55,0],["DTD","DTD",1,0,0],["DTE","DTE Energy Company",41,26509,0],["DTEC","DTEC",1,0,0],["DTF","DTF Tax-Free Income 2028 Term Fund Inc.",11,79,0],["DTG","DTE Energy Company 2021 Series E 4.375% Junior Subordinated Debentures",41,3589,0],["DTH","DTH",1,0,0],["DTI","Drilling Tools International Corporation",88,96,0],["DTIL","Precision BioSciences Inc.",13,60,0],["DTK","DTE Energy Company 2025 Series H 6.25% Junior Subordinated Debentures due 2085",41,0,0],["DTM","DT Midstream Inc.",107,12000,0],["DTRE","DTRE",1,0,0],["DTSQ","DT Cloud Star Acquisition Corporation",1,0,0],["DTSS","Datasea Inc.",25,8,0],["DTST","Data Storage Corporation",15,38,0],["DTW","DTE Energy Company 2017 Series E 5.25% Junior Subordinated Debentures due 2077",41,4440,0],["DUG","DUG",1,0,0],["DUHP","DUHP",1,0,0],["DUK","Duke Energy Corporation (Holding Company)",129,89867,0],["DUK/PA","DUK/PA",1,0,0],["DUKB","Duke Energy Corporation 5.625% Junior Subordinated Debentures due 2078",129,19286,0],["DUKH","DUKH",1,0,0],["DUKQ","DUKQ",1,0,0],["DUKX","DUKX",1,0,0],["DUKZ","DUKZ",1,0,0],["DULL","DULL",1,0,0],["DUNK","DUNK",1,0,0],["DUO","Fangdd Network Group Ltd. Class A",36,7,0],["DUOG","DUOG",1,0,0],["DUOL","Duolingo Inc. Class A",25,8596,0],["DUOT","Duos Technologies Group Inc.",25,195,0],["DUSB","DUSB",1,0,0],["DUSL","DUSL",1,0,0],["DUST","DUST",1,0,0],["DV","DoubleVerify Holdings Inc.",16,1817,0],["DVA","DaVita Inc.",137,8133,0],["DVAL","DVAL",1,0,0],["DVAX","Dynavax Technologies Corporation",8,1275,0],["DVDN","DVDN",1,0,0],["DVGR","DVGR",1,0,0],["DVIN","DVIN",1,0,0],["DVLT","Datavault AI Inc.",6,277,0],["DVLU","DVLU",1,0,0],["DVN","Devon Energy Corporation",59,22482,0],["DVND","DVND",1,0,0],["DVOL","DVOL",1,0,0],["DVQQ","DVQQ",1,0,0],["DVRE","DVRE",1,0,0],["DVS","Dolly Varden Silver Corporation",1,428,0],["DVSP","DVSP",1,0,0],["DVUT","DVUT",1,0,0],["DVXB","DVXB",1,0,0],["DVXC","DVXC",1,0,0],["DVXE","DVXE",1,0,0],["DVXF","DVXF",1,0,0],["DVXK","DVXK",1,0,0],["DVXP","DVXP",1,0,0],["DVXV","DVXV",1,0,0],["DVXY","DVXY",1,0,0],["DVY","DVY",1,0,0],["DVYA","DVYA",1,0,0],["DVYE","DVYE",1,0,0],["DWAS","DWAS",1,0,0],["DWAW","DWAW",1,0,0],["DWM","DWM",1,0,0],["DWMF","DWMF",1,0,0],["DWSH","DWSH",1,0,0],["DWSN","Dawson Geophysical Company",59,51,0],["DWTX","Dogwood Therapeutics Inc.",8,200,0],["DWUS","DWUS",1,0,0],["DWX","DWX",1,0,0],["DX","Dynex Capital Inc.",30,2031,0],["DX/PC","DX/PC",1,0,0],["DXC","DXC Technology Company",15,2687,0],["DXCM","DexCom Inc.",31,25764,0],["DXD","DXD",1,0,0],["DXF","Eason Technology Limited",44,3,0],["DXIV","DXIV",1,0,0],["DXJ","DXJ",1,0,0],["DXLG","Destination XL Group Inc.",120,51,0],["DXPE","DXP Enterprises Inc.",7,1748,0],["DXR","Daxor Corporation",31,62,0],["DXST","Decent Holding Inc Class A",99,21,0],["DXUV","DXUV",1,0,0],["DXYZ","Destiny Tech100 Inc.",1,0,0],["DY","Dycom Industries Inc.",128,9972,0],["DYAI","Dyadic International Inc.",13,36,0],["DYFI","DYFI",1,0,0],["DYLD","DYLD",1,0,0],["DYLG","DYLG",1,0,0],["DYN","Dyne Therapeutics Inc.",8,3208,0],["DYNB","DYNB",1,0,0],["DYNF","DYNF",1,0,0],["DYOR","Insight Digital Partners II Class A",2,0,0],["DYORU","Insight Digital Partners II",2,0,0],["DYTA","DYTA",1,0,0],["DZZ","DZZ",1,0,0],["E","ENI S.p.A.",59,61174,0],["EA","Electronic Arts Inc.",45,50859,0],["EAD","Allspring Income Opportunities Fund",123,0,0],["EAF","GrafTech International Ltd.",7,397,0],["EAFG","EAFG",1,0,0],["EAGG","EAGG",1,0,0],["EAGL","EAGL",1,0,0],["EAI","Entergy Arkansas LLC First Mortgage Bonds 4.875% Series Due September 1 2066",41,9486,0],["EAPR","EAPR",1,0,0],["EARN","Ellington Credit Company",30,198,0],["EASG","EASG",1,0,0],["EASY","EASY",1,0,0],["EAT","Brinker International Inc.",68,6640,0],["EATZ","EATZ",1,0,0],["EB","Eventbrite Inc. Class A",16,433,0],["EBAY","eBay Inc.",36,38266,0],["EBC","Eastern Bankshares Inc.",84,3961,0],["EBF","Ennis Inc.",92,463,0],["EBI","EBI",1,0,0],["EBIT","EBIT",1,0,0],["EBIZ","EBIZ",1,0,0],["EBMT","Eagle Bancorp Montana Inc.",26,158,0],["EBND","EBND",1,0,0],["EBON","Ebang International Holdings Inc. Class A",6,23,0],["EBS","Emergent BioSolutions Inc.",8,652,0],["EBUF","EBUF",1,0,0],["EC","Ecopetrol S.A.",59,18934,0],["ECAT","BlackRock ESG Capital Allocation Term Trust",81,1723,0],["ECBK","ECB Bancorp Inc.",43,153,0],["ECC","Eagle Point Credit Company Inc.",81,347,0],["ECC/PD","ECC/PD",1,0,0],["ECCC","Eagle Point Credit Company Inc. 6.50% Series C Term",81,1508,0],["ECCF","Eagle Point Credit Company Inc. 8.00% Series F Term",1,27454,0],["ECCU","Eagle Point Credit Company Inc. 7.75% Notes due 2030",1,0,0],["ECCV","Eagle Point Credit Company Inc. 5.375% Notes due 2029",81,1437,0],["ECCW","Eagle Point Credit Company Inc. 6.75% Notes due 2031",81,1504,0],["ECCX","Eagle Point Credit Company Inc. 6.6875% Notes due 2028",81,1514,0],["ECDA","ECD Automotive Design Inc.",37,0,0],["ECF","Ellsworth Growth and Income Fund Ltd.",123,0,0],["ECF/PA","ECF/PA",1,0,0],["ECG","Everus Construction Group Inc.",121,4541,0],["ECL","Ecolab Inc.",90,74658,0],["ECML","ECML",1,0,0],["ECNS","ECNS",1,0,0],["ECO","Okeanis Eco Tankers Corp.",98,1092,0],["ECON","ECON",1,0,0],["ECOR","electroCore Inc.",77,37,0],["ECOW","ECOW",1,0,0],["ECPG","Encore Capital Group Inc",116,1216,0],["ECVT","Ecovyst Inc.",34,1093,0],["ECX","ECARX Holdings Inc. Class A",15,622,0],["ED","Consolidated Edison Inc.",129,35393,0],["EDAP","EDAP TMS S.A.",77,110,0],["EDBL","Edible Garden AG Incorporated",48,5,0],["EDC","EDC",1,0,0],["EDD","Morgan Stanley Emerging Markets Domestic Debt Fund Inc.",116,0,0],["EDF","Virtus Stone Harbor Emerging Markets Income Fund",11,0,0],["EDGF","EDGF",1,0,0],["EDGH","EDGH",1,0,0],["EDGI","EDGI",1,0,0],["EDGU","EDGU",1,0,0],["EDHL","Everbright Digital Holding Limited",58,12,0],["EDIT","Editas Medicine Inc.",13,228,0],["EDIV","EDIV",1,0,0],["EDN","Empresa Distribuidora Y Comercializadora Norte S.A. (Edenor)",41,1436,0],["EDOG","EDOG",1,0,0],["EDOW","EDOW",1,0,0],["EDRY","EuroDry Ltd.",98,37,0],["EDSA","Edesa Biotech Inc.",8,12,0],["EDTK","Skillful Craftsman Education Technology Limited",3,15,0],["EDU","New Oriental Education & Technology Group Inc. Sponsored ADR representing 10",3,22074,0],["EDUC","Educational Development Corporation",94,11,0],["EDV","EDV",1,0,0],["EDZ","EDZ",1,0,0],["EE","Excelerate Energy Inc. Class A",140,3049,0],["EEA","The European Equity Fund Inc.",81,0,0],["EEFT","Euronet Worldwide Inc.",60,3238,0],["EEIQ","EpicQuest Education Group International Limited",3,11,0],["EELV","EELV",1,0,0],["EEM","EEM",1,0,0],["EEMA","EEMA",1,0,0],["EEMO","EEMO",1,0,0],["EEMS","EEMS",1,0,0],["EEMX","EEMX",1,0,0],["EES","EES",1,0,0],["EET","EET",1,0,0],["EETH","EETH",1,0,0],["EEV","EEV",1,0,0],["EEX","Emerald Holding Inc.",36,928,0],["EFA","EFA",1,0,0],["EFAA","EFAA",1,0,0],["EFAS","EFAS",1,0,0],["EFAX","EFAX",1,0,0],["EFC","Ellington Financial Inc.",36,1485,0],["EFC/PA","EFC/PA",1,0,0],["EFC/PB","EFC/PB",1,0,0],["EFC/PC","EFC/PC",1,0,0],["EFC/PD","EFC/PD",1,0,0],["EFFE","EFFE",1,0,0],["EFFI","EFFI",1,0,0],["EFIV","EFIV",1,0,0],["EFO","EFO",1,0,0],["EFOI","Energy Focus Inc.",91,13,0],["EFR","Eaton Vance Senior Floating-Rate Fund",81,0,0],["EFRA","EFRA",1,0,0],["EFSC","Enterprise Financial Services Corporation",26,2065,0],["EFSCP","Enterprise Financial Services Corporation",26,735,0],["EFSI","Eagle Financial Services Inc",26,219,0],["EFT","Eaton Vance Floating Rate Income Trust",116,327,0],["EFU","EFU",1,0,0],["EFX","Equifax Inc.",44,26824,0],["EFXT","Enerflex Ltd",7,1826,0],["EFZ","EFZ",1,0,0],["EG","Everest Group Ltd.",22,13908,0],["EGAN","eGain Corporation",25,286,0],["EGBN","Eagle Bancorp Inc.",26,647,0],["EGG","Enigmatig Limited Class A",19,124,0],["EGGQ","EGGQ",1,0,0],["EGGS","EGGS",1,0,0],["EGGY","EGGY",1,0,0],["EGHA","EGH Acquisition Corp. Class A",123,0,0],["EGHAU","EGHAU",1,0,0],["EGHT","8x8 Inc",15,288,0],["EGLE","EGLE",1,0,0],["EGO","EGO",1,0,0],["EGP","EGP",1,0,0],["EGY","VAALCO Energy Inc. ",59,358,0],["EH","EHang Holdings Limited ADS",50,984,0],["EHAB","Enhabit Inc.",35,484,0],["EHC","Encompass Health Corporation",126,10705,0],["EHGO","Eshallgo Inc. Class A",12,7,0],["EHI","Western Asset Global High Income Fund Inc",11,0,0],["EHLD","Euroholdings Ltd.",98,19,0],["EHLS","EHLS",1,0,0],["EHTH","eHealth Inc.",28,134,0],["EIC","Eagle Point Income Company Inc.",123,101,0],["EICA","Eagle Point Income Company Inc. 5.00% Series A Term",123,219,0],["EICB","Eagle Point Income Company Inc. 7.75% Series B Term",1,0,0],["EICC","Eagle Point Income Company Inc. 8.00% Series C Term",1,0,0],["EIDO","EIDO",1,0,0],["EIG","Employers Holdings Inc",22,965,0],["EIIA","Eagle Point Institutional Income Fund 8.125% Series A Term",1,0,0],["EIM","Eaton Vance Municipal Bond Fund",123,0,0],["EINC","EINC",1,0,0],["EIPI","EIPI",1,0,0],["EIPX","EIPX",1,0,0],["EIRL","EIRL",1,0,0],["EIS","EIS",1,0,0],["EIX","Edison International",41,23126,0],["EJAN","EJAN",1,0,0],["EJH","E-Home Household Service Holdings Limited",3,73,0],["EJUL","EJUL",1,0,0],["EKG","EKG",1,0,0],["EKSO","Ekso Bionics Holdings Inc.",7,13,0],["EL","Estee Lauder Companies Inc. (The)",90,38919,0],["ELA","Envela Corporation",94,378,0],["ELAB","PMGC Holdings Inc.",8,13,0],["ELAN","Elanco Animal Health Incorporated",8,11080,0],["ELBM","Electra Battery Materials Corporation",7,87,0],["ELC","Entergy Louisiana Inc. Collateral Trust Mortgage Bonds 4.875 % Series due September 1 2066",41,4418,0],["ELCV","ELCV",1,0,0],["ELD","ELD",1,0,0],["ELDN","Eledon Pharmaceuticals Inc.",8,98,0],["ELE","Elemental Royalty Corporation",104,1041,0],["ELF","e.l.f. Beauty Inc.",90,4797,0],["ELFY","ELFY",1,0,0],["ELIL","ELIL",1,0,0],["ELIS","ELIS",1,0,0],["ELLO","Ellomay Capital Ltd",41,290,0],["ELM","ELM",1,0,0],["ELMD","Electromed Inc.",77,239,0],["ELME","Elme Communities",30,1527,0],["ELOG","Eastern International Ltd.",105,20,0],["ELP","Companhia Paranaense de Energia (COPEL)",41,3147,0],["ELPC","Companhia Paranaense de Energia (COPEL)",41,3115,0],["ELPW","Elong Power Holding Limited Class A",7,11,0],["ELS","Equity Lifestyle Properties Inc.",30,11878,0],["ELSE","Electro-Sensors Inc.",7,14,0],["ELTK","Eltek Ltd.",39,60,0],["ELTX","Elicio Therapeutics Inc.",8,139,0],["ELUT","Elutia Inc. Class A",13,25,0],["ELV","Elevance Health Inc.",23,75715,0],["ELVA","Electrovaya Inc.",1,285,0],["ELVN","Enliven Therapeutics Inc.",8,1001,0],["ELVR","Elevra Lithium Limited American Depository Shares",74,56920,0],["ELWS","Earlyworks Co. Ltd.",15,15,0],["ELWT","Elauwit Connection Inc.",33,34,0],["EM","Smart Share Global Limited",3,304,0],["EMA","Emera Incorporated",41,14518,0],["EMB","EMB",1,0,0],["EMBC","Embecta Corp.",31,688,0],["EMBD","EMBD",1,0,0],["EMBJ","Embraer S.A.",50,11656,0],["EMBX","EMBX",1,0,0],["EMC","EMC",1,0,0],["EMCB","EMCB",1,0,0],["EMCR","EMCR",1,0,0],["EMCS","EMCS",1,0,0],["EMD","Western Asset Emerging Markets Debt Fund Inc",123,0,0],["EMDM","EMDM",1,0,0],["EME","EMCOR Group Inc.",82,27370,0],["EMEQ","EMEQ",1,0,0],["EMES","EMES",1,0,0],["EMF","Templeton Emerging Markets Fund",123,0,0],["EMHC","EMHC",1,0,0],["EMIF","EMIF",1,0,0],["EMIS","Emmis Acquisition Corp. Class A",8,0,0],["EMKT","EMKT",1,0,0],["EML","Eastern Company (The)",7,122,0],["EMLC","EMLC",1,0,0],["EMLP","EMLP",1,0,0],["EMM","EMM",1,0,0],["EMMF","EMMF",1,0,0],["EMN","Eastman Chemical Company",34,7250,0],["EMNT","EMNT",1,0,0],["EMO","ClearBridge Energy Midstream Opportunity Fund Inc.",11,0,0],["EMOP","EMOP",1,0,0],["EMOT","EMOT",1,0,0],["EMP","Entergy Mississippi LLC First Mortgage Bonds 4.90% Series Due October 1 2066",41,9441,0],["EMPB","EMPB",1,0,0],["EMPD","Empery Digital Inc.",1,0,0],["EMQQ","EMQQ",1,0,0],["EMR","Emerson Electric Company",133,74708,0],["EMSF","EMSF",1,0,0],["EMTY","EMTY",1,0,0],["EMXC","EMXC",1,0,0],["EMXF","EMXF",1,0,0],["ENB","Enbridge Inc",107,101713,0],["ENDW","ENDW",1,0,0],["ENFR","ENFR",1,0,0],["ENGN","enGene Holdings Inc.",13,444,0],["ENGS","Energys Group Limited",82,11,0],["ENHU","ENHU",1,0,0],["ENIC","Enel Chile S.A.",41,5423,0],["ENJ","Entergy New Orleans LLC First Mortgage Bonds 5.0% Series due December 1 2052",129,9410,0],["ENLT","Enlight Renewable Energy Ltd.",41,5513,0],["ENLV","Enlivex Therapeutics Ltd.",8,197,0],["ENO","Entergy New Orleans LLC First Mortgage Bonds 5.50% Series due April 1 2066",129,4897,0],["ENOV","Enovis Corporation",32,1530,0],["ENPH","Enphase Energy Inc.",6,4351,0],["ENR","Energizer Holdings Inc.",7,1356,0],["ENS","EnerSys",7,5422,0],["ENSC","Ensysce Biosciences Inc.",8,4,0],["ENSG","The Ensign Group Inc.",126,10507,0],["ENTA","Enanta Pharmaceuticals Inc.",8,444,0],["ENTG","Entegris Inc.",64,12743,0],["ENTX","Entera Bio Ltd.",13,81,0],["ENVA","Enova International Inc.",44,4064,0],["ENVB","Enveric Biosciences Inc.",8,3,0],["ENVX","Enovix Corporation",7,1696,0],["ENZL","ENZL",1,0,0],["EOCT","EOCT",1,0,0],["EOD","Allspring Global Dividend Opportunity Fund",11,0,0],["EOG","EOG Resources Inc.",59,55307,0],["EOI","Eaton Vance Enhance Equity Income Fund Eaton Vance Enhanced Equity Income Fund Shares of Beneficial Interest",123,0,0],["EOLS","Evolus Inc.",8,458,0],["EONR","EON Resources Inc. Class A",59,19,0],["EOS","Eaton Vance Enhance Equity Income Fund II",81,0,0],["EOSE","Eos Energy Enterprises Inc. Class A",7,3767,0],["EOT","Eaton Vance Municipal Income Trust EATON VANCE NATIONAL MUNICIPAL OPPORTUNITIES TRUST",60,260,0],["EP","Empire Petroleum Corporation",59,105,0],["EP/PC","EP/PC",1,0,0],["EPAC","Enerpac Tool Group Corp.",7,1973,0],["EPAI","EPAI",1,0,0],["EPAM","EPAM Systems Inc.",15,11555,0],["EPC","Edgewell Personal Care Company",90,814,0],["EPD","Enterprise Products Partners L.P.",107,69096,0],["EPEM","EPEM",1,0,0],["EPHE","EPHE",1,0,0],["EPI","EPI",1,0,0],["EPIN","EPIN",1,0,0],["EPM","Evolution Petroleum Corporation Inc.",59,122,0],["EPMB","EPMB",1,0,0],["EPMV","EPMV",1,0,0],["EPOL","EPOL",1,0,0],["EPOW","Sunrise New Energy Co. Ltd Class A",36,25,0],["EPP","EPP",1,0,0],["EPR","EPR Properties",30,3820,0],["EPR/PC","EPR/PC",1,0,0],["EPR/PE","EPR/PE",1,0,0],["EPR/PG","EPR/PG",1,0,0],["EPRT","Essential Properties Realty Trust Inc.",30,6026,0],["EPRX","Eupraxia Pharmaceuticals Inc.",127,332,0],["EPS","EPS",1,0,0],["EPSB","EPSB",1,0,0],["EPSM","Epsium Enterprise Limited Class A",46,32,0],["EPSN","Epsilon Energy Ltd.",59,101,0],["EPSV","EPSV",1,0,0],["EPU","EPU",1,0,0],["EPV","EPV",1,0,0],["EPWK","EPWK Holdings Ltd. Class A",36,1,0],["EQ","Equillium Inc.",8,70,0],["EQAL","EQAL",1,0,0],["EQBK","Equity Bancshares Inc. Class A",26,873,0],["EQH","Equitable Holdings Inc.",28,13759,0],["EQH/PA","EQH/PA",1,0,0],["EQH/PC","EQH/PC",1,0,0],["EQIN","EQIN",1,0,0],["EQIX","Equinix Inc.",30,74475,0],["EQL","EQL",1,0,0],["EQNR","Equinor ASA",106,67199,0],["EQR","Equity Residential",30,23350,0],["EQRR","EQRR",1,0,0],["EQS","Equus Total Return Inc.",123,24,0],["EQT","EQT Corporation",59,33618,0],["EQTY","EQTY",1,0,0],["EQWL","EQWL",1,0,0],["EQX","Equinox Gold Corp.",104,11065,0],["ERAS","Erasca Inc.",8,979,0],["ERC","Allspring Multi-Sector Income Fund",123,0,0],["ERET","ERET",1,0,0],["ERH","Allspring Utilities and High Income Fund",123,0,0],["ERIC","Ericsson",49,32411,0],["ERIE","Erie Indemnity Company Class A",28,13110,0],["ERII","Energy Recovery Inc.",7,745,0],["ERNA","Ernexa Therapeutics Inc.",8,10,0],["ERNZ","ERNZ",1,0,0],["ERO","Ero Copper Corp.",10,2721,0],["ERTH","ERTH",1,0,0],["ERX","ERX",1,0,0],["ERY","ERY",1,0,0],["ES","Eversource Energy (D/B/A)",41,25198,0],["ESAB","ESAB Corporation",7,6903,0],["ESBA","ESBA",1,0,0],["ESBG","ESBG",1,0,0],["ESCA","Escalade Incorporated",61,177,0],["ESE","ESCO Technologies Inc.",33,5138,0],["ESEA","Euroseas Ltd.",98,378,0],["ESGD","ESGD",1,0,0],["ESGE","ESGE",1,0,0],["ESGL","ESGL Holdings Limited",122,167,0],["ESGU","ESGU",1,0,0],["ESHA","ESH Acquisition Corp. Class A",2,0,0],["ESI","Element Solutions Inc.",34,6089,0],["ESIM","ESIM",1,0,0],["ESIX","ESIX",1,0,0],["ESLA","Estrella Immunopharma Inc.",13,64,0],["ESLG","ESLG",1,0,0],["ESLT","Elbit Systems Ltd.",21,24723,0],["ESLV","ESLV",1,0,0],["ESMV","ESMV",1,0,0],["ESN","ESN",1,0,0],["ESNT","Essent Group Ltd.",22,6405,0],["ESOA","Energy Services of America Corporation",128,136,0],["ESP","Espey Mfg. & Electronics Corp.",7,126,0],["ESPO","ESPO",1,0,0],["ESPR","Esperion Therapeutics Inc.",8,940,0],["ESQ","Esquire Financial Holdings Inc.",75,917,0],["ESRT","Empire State Realty Trust Inc. Class A",30,1120,0],["ESS","Essex Property Trust Inc.",30,16577,0],["ESSC","ESSC",1,0,0],["ESTA","Establishment Labs Holdings Inc.",32,2162,0],["ESTC","Elastic N.V.",25,8053,0],["ESUM","ESUM",1,0,0],["ET","Energy Transfer LP Common",107,56273,0],["ET/PI","ET/PI",1,0,0],["ETB","Eaton Vance Tax-Managed Buy-Write Income Fund Eaton Vance Tax-Managed Buy-Write Income Fund",60,447,0],["ETCO","ETCO",1,0,0],["ETD","Ethan Allen Interiors Inc.",73,600,0],["ETEC","ETEC",1,0,0],["ETFT","ETFT",1,0,0],["ETG","Eaton Vance Tax-Advantaged Global Dividend Income Fund",11,0,0],["ETH","ETH",1,0,0],["ETHA","ETHA",1,0,0],["ETHD","ETHD",1,0,0],["ETHE","ETHE",1,0,0],["ETHI","ETHI",1,0,0],["ETHM","Dynamix Corporation Class A",1,0,0],["ETHMU","Dynamix Corporation Unit",1,0,0],["ETHO","ETHO",1,0,0],["ETHT","ETHT",1,0,0],["ETHW","ETHW",1,0,0],["ETHZ","ETHZilla Corporation",8,133,0],["ETI/P","ETI/P",1,0,0],["ETJ","Eaton Vance Risk-Managed Diversified Equity Income Fund",116,0,0],["ETN","Eaton Corporation PLC",7,123434,0],["ETO","Eaton Vance Tax-Advantage Global Dividend Opp",11,477,0],["ETON","Eton Pharmaceuticals Inc.",8,439,0],["ETOR","eToro Group Ltd. Class A",60,2928,0],["ETR","Entergy Corporation",41,40864,0],["ETRL","ETRL",1,0,0],["ETS","Elite Express Holding Inc. Class A",63,8,0],["ETSY","Etsy Inc.",36,5363,0],["ETV","Eaton Vance Corporation Eaton Vance Tax-Managed Buy-Write Opportunities Fund",60,1568,0],["ETW","Eaton Vance Corporation Eaton Vance Tax-Managed Global Buy-Write Opportunites Fund",11,1006,0],["ETX","Eaton Vance Municipal Income 2028 Term Trust",11,204,0],["ETY","Eaton Vance Tax-Managed Diversified Equity Income Fund",116,0,0],["EU","enCore Energy Corp.",52,502,0],["EUDA","EUDA Health Holdings Limited",35,111,0],["EUDG","EUDG",1,0,0],["EUFN","EUFN",1,0,0],["EUM","EUM",1,0,0],["EUO","EUO",1,0,0],["EURK","Eureka Acquisition Corp Class A",1,0,0],["EURL","EURL",1,0,0],["EUSA","EUSA",1,0,0],["EUSB","EUSB",1,0,0],["EVAC","EQV Ventures Acquisition Corp. II Class A",148,0,0],["EVAC.U","EVAC.U",1,0,0],["EVAX","Evaxion A/S American",13,39,0],["EVC","Entravision Communications Corporation",83,289,0],["EVCM","EverCommerce Inc.",25,2147,0],["EVER","EverQuote Inc. Class A",16,965,0],["EVEX","Eve Holding Inc.",50,1672,0],["EVF","Eaton Vance Senior Income Trust",60,92,0],["EVG","Eaton Vance Short Diversified Income Fund Eaton Vance Short Duration Diversified Income Fund",11,0,0],["EVGN","Evogene Ltd",85,7,0],["EVGO","EVgo Inc. Class A",15,939,0],["EVH","Evolent Health Inc Class A",3,445,0],["EVHY","EVHY",1,0,0],["EVI","EVI Industries Inc. ",3,303,0],["EVIM","EVIM",1,0,0],["EVLN","EVLN",1,0,0],["EVLV","Evolv Technologies Holdings Inc. Class A",53,1259,0],["EVMN","Evommune Inc.",8,575,0],["EVMO","EVMO",1,0,0],["EVMT","EVMT",1,0,0],["EVN","Eaton Vance Municipal Income Trust",11,426,0],["EVNT","EVNT",1,0,0],["EVO","Evotec SE",8,262,0],["EVOX","Evolution Global Acquisition Corp Class A",2,0,0],["EVOXU","Evolution Global Acquisition Corp",2,0,0],["EVR","Evercore Inc. Class A",11,13242,0],["EVRG","Evergy Inc.",129,16684,0],["EVSB","EVSB",1,0,0],["EVSD","EVSD",1,0,0],["EVSM","EVSM",1,0,0],["EVT","Eaton Vance Tax Advantaged Dividend Income Fund",116,0,0],["EVTC","Evertec Inc.",15,1858,0],["EVTL","Vertical Aerospace Ltd.",50,470,0],["EVTR","EVTR",1,0,0],["EVTV","Envirotech Vehicles Inc.",42,2,0],["EVV","Eaton Vance Limited Duration Income Fund",123,0,0],["EVX","EVX",1,0,0],["EVYM","EVYM",1,0,0],["EW","Edwards Lifesciences Corporation",32,49708,0],["EWA","EWA",1,0,0],["EWBC","East West Bancorp Inc.",26,15624,0],["EWC","EWC",1,0,0],["EWCZ","European Wax Center Inc. Class A",3,197,0],["EWD","EWD",1,0,0],["EWG","EWG",1,0,0],["EWH","EWH",1,0,0],["EWI","EWI",1,0,0],["EWJ","EWJ",1,0,0],["EWJV","EWJV",1,0,0],["EWK","EWK",1,0,0],["EWL","EWL",1,0,0],["EWM","EWM",1,0,0],["EWN","EWN",1,0,0],["EWO","EWO",1,0,0],["EWP","EWP",1,0,0],["EWQ","EWQ",1,0,0],["EWS","EWS",1,0,0],["EWT","EWT",1,0,0],["EWTX","Edgewise Therapeutics Inc.",8,2705,0],["EWU","EWU",1,0,0],["EWV","EWV",1,0,0],["EWW","EWW",1,0,0],["EWX","EWX",1,0,0],["EWY","EWY",1,0,0],["EWZ","EWZ",1,0,0],["EWZS","EWZS",1,0,0],["EXAS","Exact Sciences Corporation",23,19292,0],["EXC","Exelon Corporation",129,44109,0],["EXE","Expand Energy Corporation",59,25899,0],["EXEL","Exelixis Inc.",13,11877,0],["EXFY","Expensify Inc. Class A",25,135,0],["EXG","Eaton Vance Tax-Managed Global Diversified Equity Income Fund",116,0,0],["EXI","EXI",1,0,0],["EXK","Endeavour Silver Corporation",104,2801,0],["EXLS","ExlService Holdings Inc.",36,6840,0],["EXOD","Exodus Movement Inc. Class A",44,455,0],["EXOZ","eXoZymes Inc.",13,103,0],["EXP","Eagle Materials Inc",38,6975,0],["EXPD","Expeditors International of Washington Inc.",105,20488,0],["EXPE","Expedia Group Inc.",87,35443,0],["EXPI","eXp World Holdings Inc.",36,1568,0],["EXPO","Exponent Inc.",19,3593,0],["EXR","Extra Space Storage Inc",30,27607,0],["EXTR","Extreme Networks Inc.",51,2253,0],["EXUS","EXUS",1,0,0],["EYE","National Vision Holdings Inc.",111,2271,0],["EYEG","EYEG",1,0,0],["EYPT","EyePoint Inc.",71,1443,0],["EZA","EZA",1,0,0],["EZGO","EZGO Technologies Ltd.",119,2,0],["EZJ","EZJ",1,0,0],["EZM","EZM",1,0,0],["EZMO","EZMO",1,0,0],["EZPW","EZCORP Inc. Class A Non Voting",66,1170,0],["EZRO","EZRO",1,0,0],["F","Ford Motor Company",37,53671,0],["F/PB","F/PB",1,0,0],["F/PC","F/PC",1,0,0],["F/PD","F/PD",1,0,0],["FA","First Advantage Corporation",15,2647,0],["FAAR","FAAR",1,0,0],["FAB","FAB",1,0,0],["FACT","FACT II Acquisition Corp. Class A",1,0,0],["FACTU","FACT II Acquisition Corp. Unit",2,0,0],["FAD","FAD",1,0,0],["FAF","First American Corporation (New)",28,6419,0],["FAI","FAI",1,0,0],["FALN","FALN",1,0,0],["FAMI","Farmmi Inc.",17,2,0],["FAN","FAN",1,0,0],["FANG","Diamondback Energy Inc.",59,42443,0],["FARM","Farmer Brothers Company",17,33,0],["FARX","FARX",1,0,0],["FAS","FAS",1,0,0],["FAST","Fastenal Company",130,48619,0],["FAT","FAT Brands Inc. Class A",68,8,0],["FATBB","FAT Brands Inc. Class B",68,22,0],["FATBP","FAT Brands Inc. 8.25% Series B Cumulative",68,17,0],["FATE","Fate Therapeutics Inc.",13,121,0],["FATN","FatPipe Inc.",25,39,0],["FAX","abrdn Asia-Pacific Income Fund Inc.",11,0,0],["FAZ","FAZ",1,0,0],["FBDC","FBDC",1,0,0],["FBGL","FBS Global Limited",69,12,0],["FBIN","Fortune Brands Innovations Inc.",56,6129,0],["FBIO","Fortress Biotech Inc.",8,112,0],["FBIOP","Fortress Biotech Inc. 9.375% Series A Cumulative Redeemable Perpetual",8,291,0],["FBIZ","First Business Financial Services Inc.",26,473,0],["FBK","FB Financial Corporation",26,3036,0],["FBL","FBL",1,0,0],["FBLA","FB Bancorp Inc.",43,259,0],["FBLG","FibroBiologics Inc.",8,19,0],["FBNC","First Bancorp",26,2169,0],["FBND","FBND",1,0,0],["FBOT","FBOT",1,0,0],["FBP","First BanCorp. New",26,3392,0],["FBRT","Franklin BSP Realty Trust Inc.",30,865,0],["FBRT/PE","FBRT/PE",1,0,0],["FBRX","Forte Biosciences Inc.",8,372,0],["FBT","FBT",1,0,0],["FBY","FBY",1,0,0],["FBYD","Falcon\'s Beyond Global Inc. Class A",45,2541,0],["FBYY","FBYY",1,0,0],["FC","Franklin Covey Company",3,205,0],["FCA","FCA",1,0,0],["FCAL","FCAL",1,0,0],["FCAP","First Capital Inc.",84,223,0],["FCBC","First Community Bankshares Inc. (VA)",26,633,0],["FCBD","FCBD",1,0,0],["FCCO","First Community Corporation",26,236,0],["FCEF","FCEF",1,0,0],["FCEL","FuelCell Energy Inc.",7,398,0],["FCF","First Commonwealth Financial Corporation",26,1791,0],["FCFS","FirstCash Holdings Inc.",66,7108,0],["FCFY","FCFY",1,0,0],["FCG","FCG",1,0,0],["FCHL","Fitness Champs Holdings Limited",45,4,0],["FCN","FTI Consulting Inc.",19,5451,0],["FCNCA","First Citizens BancShares Inc. Class A",26,26550,0],["FCNCO","First Citizens BancShares Inc. 5.625% Non-Cumulative Perpetual",26,266,0],["FCNCP","First Citizens BancShares Inc.",26,254,0],["FCO","abrdn Global Income Fund Inc.",11,0,0],["FCOM","FCOM",1,0,0],["FCOR","FCOR",1,0,0],["FCPT","Four Corners Property Trust Inc.",30,2470,0],["FCRS","FutureCrest Acquisition Corp. Class A",2,0,0],["FCRS.U","FCRS.U",1,0,0],["FCRX","Crescent Capital BDC Inc. 5.00% Notes due 2026",44,925,0],["FCSH","FCSH",1,0,0],["FCT","First Trust Senior Floating Rate Income Fund II",116,0,0],["FCTE","FCTE",1,0,0],["FCUS","FCUS",1,0,0],["FCUV","Focus Universal Inc.",7,38,0],["FCVT","FCVT",1,0,0],["FCX","Freeport-McMoRan Inc.",10,70576,0],["FDAT","FDAT",1,0,0],["FDBC","Fidelity D & D Bancorp Inc.",26,267,0],["FDCF","FDCF",1,0,0],["FDD","FDD",1,0,0],["FDFF","FDFF",1,0,0],["FDG","FDG",1,0,0],["FDHY","FDHY",1,0,0],["FDIF","FDIF",1,0,0],["FDIG","FDIG",1,0,0],["FDIS","FDIS",1,0,0],["FDIV","FDIV",1,0,0],["FDL","FDL",1,0,0],["FDLO","FDLO",1,0,0],["FDLS","FDLS",1,0,0],["FDM","FDM",1,0,0],["FDMO","FDMO",1,0,0],["FDMT","4D Molecular Therapeutics Inc.",13,496,0],["FDN","FDN",1,0,0],["FDNI","FDNI",1,0,0],["FDP","Fresh Del Monte Produce Inc.",48,1794,0],["FDRR","FDRR",1,0,0],["FDS","FDS",1,0,0],["FDSB","Fifth District Bancorp Inc.",84,81,0],["FDT","FDT",1,0,0],["FDTS","FDTS",1,0,0],["FDTX","FDTX",1,0,0],["FDUS","Fidus Investment Corporation",123,687,0],["FDV","FDV",1,0,0],["FDVV","FDVV",1,0,0],["FDX","FedEx Corporation",4,68139,0],["FE","FirstEnergy Corp.",41,25550,0],["FEAC","FEAC",1,0,0],["FEAM","5E Advanced Materials Inc.",74,80,0],["FEAT","FEAT",1,0,0],["FEBO","Fenbo Holdings Limited Class A",73,15,0],["FEBT","FEBT",1,0,0],["FEBW","FEBW",1,0,0],["FEDM","FEDM",1,0,0],["FEDU","Four Seasons Education (Cayman) Inc.",3,25,0],["FEED","ENvue Medical Inc.",32,3,0],["FEGE","FEGE",1,0,0],["FEIG","FEIG",1,0,0],["FEIM","Frequency Electronics Inc.",39,471,0],["FELC","FELC",1,0,0],["FELE","Franklin Electric Co. Inc.",55,4332,0],["FELG","FELG",1,0,0],["FELV","FELV",1,0,0],["FEM","FEM",1,0,0],["FEMB","FEMB",1,0,0],["FEMR","FEMR",1,0,0],["FEMS","FEMS",1,0,0],["FEMY","Femasys Inc.",31,50,0],["FENC","Fennec Pharmaceuticals Inc.",13,215,0],["FENG","Phoenix New Media Limited",83,24,0],["FENI","FENI",1,0,0],["FENY","FENY",1,0,0],["FEOE","FEOE",1,0,0],["FEP","FEP",1,0,0],["FEPI","FEPI",1,0,0],["FER","Ferrovial SE",21,47813,0],["FERA","Fifth Era Acquisition Corp I Class A",1,0,0],["FERAU","FERAU",1,0,0],["FERG","Ferguson Enterprises Inc.",99,46090,0],["FESM","FESM",1,0,0],["FET","Forum Energy Technologies Inc.",88,406,0],["FEUS","FEUS",1,0,0],["FEUZ","FEUZ",1,0,0],["FEX","FEX",1,0,0],["FEZ","FEZ",1,0,0],["FF","FutureFuel Corp. ",34,149,0],["FFA","First Trust Enhanced Equity Income Fund",11,0,0],["FFAI","Faraday Future Intelligent Electric Inc. Class A",37,190,0],["FFBC","First Financial Bancorp.",26,2591,0],["FFC","Flaherty & Crumrine Preferred and Income Securities Fund Incorporated",81,0,0],["FFIC","Flushing Financial Corporation",26,586,0],["FFIN","First Financial Bankshares Inc.",26,4448,0],["FFIU","FFIU",1,0,0],["FFIV","F5 Inc.",51,14924,0],["FFLS","FFLS",1,0,0],["FFND","FFND",1,0,0],["FFOX","FFOX",1,0,0],["FFTY","FFTY",1,0,0],["FFUT","FFUT",1,0,0],["FFWM","First Foundation Inc.",26,517,0],["FG","F&G Annuities & Life Inc.",5,4193,0],["FGBI","First Guaranty Bancshares Inc.",84,78,0],["FGBIP","First Guaranty Bancshares Inc. 6.75% Series A Fixed-Rate Non-Cumulative Perpetual",84,232,0],["FGD","FGD",1,0,0],["FGDL","FGDL",1,0,0],["FGEN","FibroGen Inc",8,35,0],["FGI","FGI Industries Ltd.",32,13,0],["FGL","Founder Group Limited Class A",82,3,0],["FGM","FGM",1,0,0],["FGMC","FG Merger II Corp.",1,103,0],["FGMCU","FG Merger II Corp. Unit",1,0,0],["FGN","F&G Annuities & Life Inc. 7.950% Senior Notes due 2053",5,3210,0],["FGNX","FG Nexus Inc.",22,127,0],["FGNXP","FG Nexus Inc. 8.00% Cumulative",22,831,0],["FGSI","FGSI",1,0,0],["FGSM","FGSM",1,0,0],["FGSN","F&G Annuities & Life Inc. 7.300% Junior Subordinated Notes due 2065",5,0,0],["FHB","First Hawaiian Inc.",26,3249,0],["FHI","Federated Hermes Inc.",11,4082,0],["FHLC","FHLC",1,0,0],["FHN","First Horizon Corporation",26,12029,0],["FHN/PC","FHN/PC",1,0,0],["FHN/PE","FHN/PE",1,0,0],["FHN/PF","FHN/PF",1,0,0],["FHTX","Foghorn Therapeutics Inc.",8,296,0],["FHYS","FHYS",1,0,0],["FIAT","FIAT",1,0,0],["FIAX","FIAX",1,0,0],["FIBK","First Interstate BancSystem Inc.",26,3679,0],["FICO","Fair Isaac Corporation",36,41454,0],["FICS","FICS",1,0,0],["FID","FID",1,0,0],["FIDI","FIDI",1,0,0],["FIDU","FIDU",1,0,0],["FIEE","FiEE Inc",33,17,0],["FIG","Figma Inc. Class A",25,19566,0],["FIGB","FIGB",1,0,0],["FIGG","FIGG",1,0,0],["FIGR","Figure Technology Solutions Inc. Class A",44,9033,0],["FIGS","FIGS Inc. Class A",86,1997,0],["FIGX","FIGX Capital Acquisition Corp. Class A",1,0,0],["FIGXU","FIGX Capital Acquisition Corp.",2,0,0],["FIHL","Fidelis Insurance Holdings Limited",22,2147,0],["FIIG","FIIG",1,0,0],["FINS","Angel Oak Financial Strategies Income Term Trust",123,324,0],["FINT","FINT",1,0,0],["FINV","FinVolution Group",44,1313,0],["FINW","FinWise Bancorp",26,248,0],["FINX","FINX",1,0,0],["FIP","FTAI Infrastructure Inc.",80,547,0],["FIS","Fidelity National Information Services Inc.",36,34204,0],["FISI","Financial Institutions Inc.",26,645,0],["FISK","FISK",1,0,0],["FISR","FISR",1,0,0],["FISV","Fiserv Inc.",36,36542,0],["FITB","Fifth Third Bancorp",26,31616,0],["FITBI","Fifth Third Bancorp",26,17081,0],["FITBO","Fifth Third Bancorp",26,13009,0],["FITBP","Fifth Third Bancorp",26,16446,0],["FITE","FITE",1,0,0],["FIVA","FIVA",1,0,0],["FIVE","Five Below Inc.",113,10042,0],["FIVN","Five9 Inc.",15,1607,0],["FIVY","FIVY",1,0,0],["FIW","FIW",1,0,0],["FIX","Comfort Systems USA Inc.",82,33182,0],["FIXD","FIXD",1,0,0],["FIXP","FIXP",1,0,0],["FIXT","FIXT",1,0,0],["FIZZ","National Beverage Corp.",46,3026,0],["FJET","Starfighters Space Inc.",4,0,0],["FJP","FJP",1,0,0],["FKU","FKU",1,0,0],["FKWL","Franklin Wireless Corp.",33,49,0],["FLAG","FLAG",1,0,0],["FLAO","FLAO",1,0,0],["FLAU","FLAU",1,0,0],["FLAX","FLAX",1,0,0],["FLBR","FLBR",1,0,0],["FLC","Flaherty & Crumrine Total Return Fund Inc",81,0,0],["FLCA","FLCA",1,0,0],["FLCB","FLCB",1,0,0],["FLCC","FLCC",1,0,0],["FLCE","FLCE",1,0,0],["FLCG","FLCG",1,0,0],["FLCH","FLCH",1,0,0],["FLCO","FLCO",1,0,0],["FLCV","FLCV",1,0,0],["FLD","Fold Holdings Inc. Class A",44,133,0],["FLDB","FLDB",1,0,0],["FLEE","FLEE",1,0,0],["FLEU","FLEU",1,0,0],["FLEX","Flex Ltd.",39,23755,0],["FLG","Flagstar Bank N.A.",43,5567,0],["FLG/PA","FLG/PA",1,0,0],["FLG/PU","FLG/PU",1,0,0],["FLGB","FLGB",1,0,0],["FLGC","Flora Growth Corp.",8,5,0],["FLGR","FLGR",1,0,0],["FLGT","Fulgent Genetics Inc.",23,853,0],["FLGV","FLGV",1,0,0],["FLIN","FLIN",1,0,0],["FLJH","FLJH",1,0,0],["FLJJ","FLJJ",1,0,0],["FLJP","FLJP",1,0,0],["FLKR","FLKR",1,0,0],["FLL","Full House Resorts Inc.",47,104,0],["FLLA","FLLA",1,0,0],["FLMB","FLMB",1,0,0],["FLMI","FLMI",1,0,0],["FLMX","FLMX",1,0,0],["FLN","FLN",1,0,0],["FLNC","Fluence Energy Inc. Class A",7,3650,0],["FLNG","FLEX LNG Ltd.",98,1360,0],["FLNT","Fluent Inc.",58,61,0],["FLO","Flowers Foods Inc.",17,2308,0],["FLOC","Flowco Holdings Inc. Class A",88,1618,0],["FLOW","FLOW",1,0,0],["FLR","Fluor Corporation",21,6594,0],["FLRG","FLRG",1,0,0],["FLRN","FLRN",1,0,0],["FLRT","FLRT",1,0,0],["FLS","Flowserve Corporation",148,9033,0],["FLSA","FLSA",1,0,0],["FLSP","FLSP",1,0,0],["FLSW","FLSW",1,0,0],["FLTB","FLTB",1,0,0],["FLTR","FLTR",1,0,0],["FLTW","FLTW",1,0,0],["FLUD","FLUD",1,0,0],["FLUT","Flutter Entertainment plc",16,38909,0],["FLUX","Flux Power Holdings Inc.",7,29,0],["FLV","FLV",1,0,0],["FLWS","1-800-FLOWERS.COM Inc.",66,264,0],["FLX","BingEx Limited",63,225,0],["FLXR","FLXR",1,0,0],["FLXS","Flexsteel Industries Inc.",73,215,0],["FLY","Firefly Aerospace Inc.",21,3926,0],["FLYD","FLYD",1,0,0],["FLYE","Fly-E Group Inc.",50,11,0],["FLYU","FLYU",1,0,0],["FLYW","Flywire Corporation Voting",36,1780,0],["FLYX","flyExclusive Inc. Class A",87,253,0],["FMAO","Farmers & Merchants Bancorp Inc.",84,378,0],["FMAT","FMAT",1,0,0],["FMB","FMB",1,0,0],["FMBH","First Mid Bancshares Inc.",26,988,0],["FMC","FMC Corporation",34,1664,0],["FMCE","FMCE",1,0,0],["FMCX","FMCX",1,0,0],["FMDE","FMDE",1,0,0],["FMED","FMED",1,0,0],["FMET","FMET",1,0,0],["FMF","FMF",1,0,0],["FMFC","Kandal M Venture Limited Class A",86,6,0],["FMHI","FMHI",1,0,0],["FMKT","FMKT",1,0,0],["FMN","Federated Hermes Premier Municipal Income Fund",11,959,0],["FMNB","Farmers National Banc Corp.",26,528,0],["FMNY","FMNY",1,0,0],["FMQQ","FMQQ",1,0,0],["FMS","Fresenius Medical Care AG",137,13796,0],["FMST","Foremost Clean Energy Ltd.",52,36,0],["FMTL","FMTL",1,0,0],["FMTM","FMTM",1,0,0],["FMUB","FMUB",1,0,0],["FMUN","FMUN",1,0,0],["FMX","Fomento Economico Mexicano S.A.B. de C.V.",46,34809,0],["FMY","First Trust Mortgage Income Fund",123,0,0],["FN","Fabrinet",33,17035,0],["FNB","F.N.B. Corporation",26,6361,0],["FNCL","FNCL",1,0,0],["FND","Floor & Decor Holdings Inc.",130,6708,0],["FNDA","FNDA",1,0,0],["FNDB","FNDB",1,0,0],["FNDC","FNDC",1,0,0],["FNDE","FNDE",1,0,0],["FNDF","FNDF",1,0,0],["FNDX","FNDX",1,0,0],["FNF","Fidelity National Financial Inc.",28,15137,0],["FNGD","FNGD",1,0,0],["FNGG","FNGG",1,0,0],["FNGO","FNGO",1,0,0],["FNGR","FingerMotion Inc.",25,91,0],["FNGS","FNGS",1,0,0],["FNGU","FNGU",1,0,0],["FNK","FNK",1,0,0],["FNKO","Funko Inc. Class A",61,166,0],["FNLC","First Bancorp Inc (ME)",26,313,0],["FNV","Franco-Nevada Corporation",104,40846,0],["FNWB","First Northwest Bancorp",43,93,0],["FNWD","Finward Bancorp",26,165,0],["FNX","FNX",1,0,0],["FNY","FNY",1,0,0],["FOA","Finance of America Companies Inc. Class A",44,179,0],["FOF","Cohen & Steers Closed-End Opportunity Fund Inc.",11,644,0],["FOFO","Hang Feng Technology Innovation Co. Ltd.",19,64,0],["FOLD","Amicus Therapeutics Inc.",8,4375,0],["FONR","Fonar Corporation",77,103,0],["FOPC","FOPC",1,0,0],["FOR","Forestar Group Inc",36,1282,0],["FORA","Forian Inc.",15,63,0],["FORM","FormFactor Inc. FormFactor Inc.",6,4416,0],["FORR","Forrester Research Inc.",12,141,0],["FORTY","Formula Systems (1985) Ltd.",15,2728,0],["FOSL","Fossil Group Inc.",94,202,0],["FOUR","Shift4 Payments Inc. Class A",36,5678,0],["FOUR/PA","FOUR/PA",1,0,0],["FOX","Fox Corporation Class B",83,28235,0],["FOXA","Fox Corporation Class A",83,31862,0],["FOXF","Fox Factory Holding Corp.",119,724,0],["FOXX","Foxx Development Holdings Inc.",51,32,0],["FOXY","FOXY",1,0,0],["FPA","FPA",1,0,0],["FPE","FPE",1,0,0],["FPEI","FPEI",1,0,0],["FPF","First Trust Intermediate Duration Preferred & Income Fund",81,0,0],["FPH","Five Point Holdings LLC Class A",36,807,0],["FPI","Farmland Partners Inc.",30,433,0],["FPWR","FPWR",1,0,0],["FPX","FPX",1,0,0],["FPXE","FPXE",1,0,0],["FPXI","FPXI",1,0,0],["FQAL","FQAL",1,0,0],["FR","First Industrial Realty Trust Inc.",30,7695,0],["FRA","Blackrock Floating Rate Income Strategies Fund Inc ",60,1755,0],["FRAF","Franklin Financial Services Corporation",26,246,0],["FRBA","First Bank",75,447,0],["FRD","Friedman Industries Inc.",27,152,0],["FRDD","FRDD",1,0,0],["FRDU","FRDU",1,0,0],["FREL","FREL",1,0,0],["FRGE","Forge Global Holdings Inc.",60,614,0],["FRGN","FRGN",1,0,0],["FRGT","Freight Technologies Inc.",19,4,0],["FRHC","Freedom Holding Corp.",60,8335,0],["FRI","FRI",1,0,0],["FRIZ","FRIZ",1,0,0],["FRME","First Merchants Corporation",26,2218,0],["FRMEP","First Merchants Corporation Depository Shares",26,1498,0],["FRMI","Fermi Inc.",30,5182,0],["FRO","Frontline Plc",98,4835,0],["FROG","JFrog Ltd.",25,7904,0],["FRPH","FRP Holdings Inc.",36,427,0],["FRPT","Freshpet Inc.",17,3056,0],["FRSH","Freshworks Inc. Class A",25,3533,0],["FRST","Primis Financial Corp.",26,331,0],["FRSX","Foresight Autonomous Holdings Ltd.",25,7,0],["FRT","Federal Realty Investment Trust",30,8745,0],["FRT/PC","FRT/PC",1,0,0],["FRTY","FRTY",1,0,0],["FSBC","Five Star Bancorp",26,790,0],["FSBW","FS Bancorp Inc.",43,325,0],["FSCC","FSCC",1,0,0],["FSCO","FS Credit Opportunities Corp.",81,1216,0],["FSCS","FSCS",1,0,0],["FSEA","First Seacoast Bancorp Inc.",84,67,0],["FSEC","FSEC",1,0,0],["FSFG","First Savings Financial Group Inc.",84,231,0],["FSGS","FSGS",1,0,0],["FSHP","Flag Ship Acquisition Corp.",1,0,0],["FSHPU","FSHPU",1,0,0],["FSI","Flexible Solutions International Inc.",34,89,0],["FSIG","FSIG",1,0,0],["FSK","FS KKR Capital Corp.",11,4114,0],["FSLR","First Solar Inc.",6,28649,0],["FSLY","Fastly Inc. Class A",25,1528,0],["FSM","Fortuna Mining Corp.",104,3024,0],["FSMB","FSMB",1,0,0],["FSMD","FSMD",1,0,0],["FSML","FSML",1,0,0],["FSOL","FSOL",1,0,0],["FSP","Franklin Street Properties Corp.",30,94,0],["FSS","Federal Signal Corporation",37,6845,0],["FSSL","FS Specialty Lending Fund",123,0,0],["FSTA","FSTA",1,0,0],["FSTR","L.B. Foster Company",55,295,0],["FSUN","FirstSun Capital Bancorp",26,1089,0],["FSV","FirstService Corporation",36,7071,0],["FSYD","FSYD",1,0,0],["FSZ","FSZ",1,0,0],["FT","Franklin Universal Trust",81,199,0],["FTA","FTA",1,0,0],["FTAG","FTAG",1,0,0],["FTAI","FTAI Aviation Ltd.",131,17283,0],["FTAIM","FTAI Aviation Ltd. 9.500% Fixed-Rate Reset Series D Cumulative Perpetual Redeemable",131,2740,0],["FTAIN","FTAI Aviation Ltd. 8.25% Fixed - Rate Reset Series C Cumulative Perpetual Redeemable",131,2605,0],["FTBD","FTBD",1,0,0],["FTBI","FTBI",1,0,0],["FTC","FTC",1,0,0],["FTCA","FTCA",1,0,0],["FTCB","FTCB",1,0,0],["FTCE","FTCE",1,0,0],["FTCI","FTC Solar Inc.",6,156,0],["FTCS","FTCS",1,0,0],["FTDR","Frontdoor Inc.",12,4095,0],["FTDS","FTDS",1,0,0],["FTEC","FTEC",1,0,0],["FTEK","Fuel Tech Inc.",101,52,0],["FTEL","Fitell Corporation Class A",61,3,0],["FTF","Franklin Limited Duration Income Trust",123,244,0],["FTFT","Future FinTech Group Inc.",36,31,0],["FTGC","FTGC",1,0,0],["FTGS","FTGS",1,0,0],["FTHF","FTHF",1,0,0],["FTHI","FTHI",1,0,0],["FTHM","Fathom Holdings Inc.",36,35,0],["FTHY","First Trust High Yield Opportunities 2027 Term Fund",11,515,0],["FTI","TechnipFMC plc",88,18090,0],["FTIF","FTIF",1,0,0],["FTK","Flotek Industries Inc.",34,489,0],["FTKI","FTKI",1,0,0],["FTLF","FitLife Brands Inc.",18,159,0],["FTLS","FTLS",1,0,0],["FTMA","FTMA",1,0,0],["FTMH","FTMH",1,0,0],["FTMN","FTMN",1,0,0],["FTMS","FTMS",1,0,0],["FTMU","FTMU",1,0,0],["FTNJ","FTNJ",1,0,0],["FTNT","Fortinet Inc.",53,59670,0],["FTNY","FTNY",1,0,0],["FTOH","FTOH",1,0,0],["FTPA","FTPA",1,0,0],["FTQI","FTQI",1,0,0],["FTRB","FTRB",1,0,0],["FTRE","Fortrea Holdings Inc.",23,1639,0],["FTRI","FTRI",1,0,0],["FTRK","FAST TRACK GROUP",90,17,0],["FTS","Fortis Inc.",41,25705,0],["FTSD","FTSD",1,0,0],["FTSL","FTSL",1,0,0],["FTSM","FTSM",1,0,0],["FTV","Fortive Corporation",7,17440,0],["FTW","EQV Ventures Acquisition Corp. Class A",59,467,0],["FTW.U","FTW.U",1,0,0],["FTWO","FTWO",1,0,0],["FTXG","FTXG",1,0,0],["FTXH","FTXH",1,0,0],["FTXL","FTXL",1,0,0],["FTXN","FTXN",1,0,0],["FTXO","FTXO",1,0,0],["FTXR","FTXR",1,0,0],["FUBO","FuboTV Inc. Class A",89,3498,0],["FUFU","BitFuFu Inc. Class A",44,426,0],["FUL","H. B. Fuller Company",73,3239,0],["FULC","Fulcrum Therapeutics Inc.",8,810,0],["FULT","Fulton Financial Corporation",26,3646,0],["FULTP","Fulton Financial Corporation",26,3485,0],["FUMB","FUMB",1,0,0],["FUN","Six Flags Entertainment Corporation",45,1429,0],["FUNC","First United Corporation",26,262,0],["FUND","Sprott Focus Trust Inc.",11,255,0],["FURY","Fury Gold Mines Limited",104,115,0],["FUSB","First US Bancshares Inc.",26,76,0],["FUSE","Fusemachines Inc.",15,53,0],["FUSI","FUSI",1,0,0],["FUTG","FUTG",1,0,0],["FUTU","Futu Holdings Limited",60,22925,0],["FUTY","FUTY",1,0,0],["FV","FV",1,0,0],["FVAL","FVAL",1,0,0],["FVC","FVC",1,0,0],["FVCB","FVCBankcorp Inc.",26,252,0],["FVD","FVD",1,0,0],["FVN","Future Vision II Acquisition Corporation",1,0,0],["FVR","FrontView REIT Inc.",30,329,0],["FVRR","Fiverr International Ltd.",36,715,0],["FWD","FWD",1,0,0],["FWDI","Forward Industries Inc.",64,608,0],["FWONA","Liberty Media Corporation Series A Liberty Formula One",83,22117,0],["FWONK","Liberty Media Corporation Series C Liberty Formula One",83,24300,0],["FWRD","Forward Air Corporation",105,782,0],["FWRG","First Watch Restaurant Group Inc.",68,989,0],["FXA","FXA",1,0,0],["FXB","FXB",1,0,0],["FXC","FXC",1,0,0],["FXD","FXD",1,0,0],["FXE","FXE",1,0,0],["FXED","FXED",1,0,0],["FXF","FXF",1,0,0],["FXG","FXG",1,0,0],["FXH","FXH",1,0,0],["FXI","FXI",1,0,0],["FXL","FXL",1,0,0],["FXN","FXN",1,0,0],["FXNC","First National Corporation",26,233,0],["FXO","FXO",1,0,0],["FXP","FXP",1,0,0],["FXR","FXR",1,0,0],["FXU","FXU",1,0,0],["FXY","FXY",1,0,0],["FXZ","FXZ",1,0,0],["FYBR","Frontier Communications Parent Inc.",33,9538,0],["FYC","FYC",1,0,0],["FYT","FYT",1,0,0],["FYX","FYX",1,0,0],["G","Genpact Limited",19,8260,0],["GAB","Gabelli Equity Trust Inc. (The)",11,1830,0],["GAB/PG","GAB/PG",1,0,0],["GAB/PH","GAB/PH",1,0,0],["GAB/PK","GAB/PK",1,0,0],["GABC","German American Bancorp Inc.",26,1526,0],["GABF","GABF",1,0,0],["GAEM","GAEM",1,0,0],["GAIA","Gaia Inc. Class A",89,95,0],["GAIN","Gladstone Investment Corporation Business Development Company",44,550,0],["GAINI","Gladstone Investment Corporation 7.875% Notes due 2030",44,0,0],["GAINN","Gladstone Investment Corporation 5.00% Notes Due 2026",44,959,0],["GAINZ","Gladstone Investment Corporation 4.875% Notes due 2028",44,912,0],["GAL","GAL",1,0,0],["GALT","Galectin Therapeutics Inc.",8,282,0],["GAM","General American Investors Inc.",11,1403,0],["GAM/PB","GAM/PB",1,0,0],["GAMB","Gambling.com Group Limited",45,179,0],["GAME","GameSquare Holdings Inc.",45,46,0],["GAMR","GAMR",1,0,0],["GANX","Gain Therapeutics Inc.",8,143,0],["GAP","Gap Inc. (The)",120,10421,0],["GASS","StealthGas Inc.",98,252,0],["GATX","GATX Corporation",87,6168,0],["GAU","Galiano Gold Inc.",74,665,0],["GAUZ","Gauzy Ltd.",7,21,0],["GBAB","Guggenheim Taxable Municipal Bond & Investment Grade Debt Trust",11,337,0],["GBCI","Glacier Bancorp Inc.",26,5929,0],["GBDC","Golub Capital BDC Inc.",44,3546,0],["GBF","GBF",1,0,0],["GBFH","GBank Financial Holdings Inc.",75,516,0],["GBHI","GBHI",1,0,0],["GBIL","GBIL",1,0,0],["GBIO","Generation Bio Co.",8,37,0],["GBLD","GBLD",1,0,0],["GBLI","Global Indemnity Group LLC Class A",22,398,0],["GBND","GBND",1,0,0],["GBR","New Concept Energy Inc",59,4,0],["GBTC","GBTC",1,0,0],["GBTG","Global Business Travel Group Inc. Class A",87,4104,0],["GBUG","GBUG",1,0,0],["GBX","Greenbrier Companies Inc. (The)",117,1435,0],["GCAD","GCAD",1,0,0],["GCAL","GCAL",1,0,0],["GCBC","Greene County Bancorp Inc.",43,415,0],["GCC","GCC",1,0,0],["GCL","GCL Global Holdings Ltd",25,144,0],["GCMG","GCM Grosvenor Inc. Class A",11,2198,0],["GCO","Genesco Inc.",120,252,0],["GCOR","GCOR",1,0,0],["GCT","GigaCloud Technology Inc Class A",57,1496,0],["GCTK","GlucoTrack Inc.",31,4,0],["GCTS","GCT Semiconductor Holding Inc.",6,74,0],["GCV","Gabelli Convertible and Income Securities Fund Inc. (The)",123,78,0],["GD","General Dynamics Corporation",98,91668,0],["GDC","GD Culture Group Limited",27,294,0],["GDDY","GoDaddy Inc. Class A",15,17193,0],["GDEN","Golden Entertainment Inc.",45,724,0],["GDEV","GDEV Inc.",15,309,0],["GDFN","GDFN",1,0,0],["GDHG","Golden Heaven Group Holdings Ltd. Class A",45,7,0],["GDIV","GDIV",1,0,0],["GDL","GDL Fund The",11,0,0],["GDLC","GDLC",1,0,0],["GDO","Western Asset Global Corporate Opportunity Fund Inc.",116,0,0],["GDOC","GDOC",1,0,0],["GDOG","GDOG",1,0,0],["GDOT","Green Dot Corporation Class A",44,714,0],["GDRX","GoodRx Holdings Inc. Class A",15,940,0],["GDS","GDS Holdings Limited ADS",16,7200,0],["GDTC","CytoMed Therapeutics Limited",8,16,0],["GDV","Gabelli Dividend & Income Trust",11,2489,0],["GDV/PH","GDV/PH",1,0,0],["GDV/PK","GDV/PK",1,0,0],["GDX","GDX",1,0,0],["GDXD","GDXD",1,0,0],["GDXJ","GDXJ",1,0,0],["GDXU","GDXU",1,0,0],["GDXY","GDXY",1,0,0],["GDYN","Grid Dynamics Holdings Inc. Class A",25,790,0],["GE","GE Aerospace",133,324049,0],["GECC","Great Elm Capital Corp.",44,51,0],["GECCG","Great Elm Capital Corp. 7.75% Notes Due 2030",44,0,0],["GECCH","Great Elm Capital Corp. 8.125% Notes Due 2029",1,0,0],["GECCI","Great Elm Capital Corp. 8.50% NOTES DUE 2029",116,0,0],["GECCO","Great Elm Capital Corp. 5.875% Notes due 2026",116,0,0],["GEF","Greif Inc. Class A",1,3264,0],["GEF.B","GEF.B",1,0,0],["GEG","Great Elm Group Inc.",25,80,0],["GEGGL","Great Elm Group Inc. 7.25% Notes due 2027",25,715,0],["GEHC","GE HealthCare Technologies Inc.",132,37758,0],["GEL","Genesis Energy L.P. Common",80,1899,0],["GELS","Gelteq Limited",8,10,0],["GEM","GEM",1,0,0],["GEME","GEME",1,0,0],["GEMG","GEMG",1,0,0],["GEMI","Gemini Space Station Inc. Class A",60,1344,0],["GEN","Gen Digital Inc.",25,17028,0],["GENC","Gencor Industries Inc.",72,186,0],["GEND","GEND",1,0,0],["GENI","Genius Sports Limited",45,2590,0],["GENK","GEN Restaurant Group Inc. Class A",68,81,0],["GENM","GENM",1,0,0],["GENT","GENT",1,0,0],["GENW","GENW",1,0,0],["GEO","Geo Group Inc (The) REIT",121,2224,0],["GEOA","GEOA",1,0,0],["GEOS","Geospace Technologies Corporation",7,195,0],["GERN","Geron Corporation",8,849,0],["GES","Guess? Inc.",86,874,0],["GETY","Getty Images Holdings Inc. Class A",36,524,0],["GEV","GE Vernova Inc.",1,178605,0],["GEVG","GEVG",1,0,0],["GEVO","Gevo Inc.",34,523,0],["GEW","GEW",1,0,0],["GF","New Germany Fund Inc. (The)",11,0,0],["GFAI","Guardforce AI Co. Limited",12,17,0],["GFF","Griffon Corporation",91,3547,0],["GFGF","GFGF",1,0,0],["GFI","Gold Fields Limited",104,40419,0],["GFL","GFL Environmental Inc. Subordinate voting shares no par value",122,15471,0],["GFLW","GFLW",1,0,0],["GFR","Greenfire Resources Ltd.",59,309,0],["GFS","GlobalFoundries Inc.",6,20253,0],["GGAL","Grupo Financiero Galicia S.A.",75,8701,0],["GGB","Gerdau S.A.",27,7588,0],["GGG","Graco Inc.",148,13708,0],["GGLL","GGLL",1,0,0],["GGLS","GGLS",1,0,0],["GGM","GGM",1,0,0],["GGME","GGME",1,0,0],["GGN","GAMCO Global Gold Natural Resources & Income Trust",123,0,0],["GGN/PB","GGN/PB",1,0,0],["GGOV","GGOV",1,0,0],["GGR","Gogoro Inc.",37,53,0],["GGRW","GGRW",1,0,0],["GGT","Gabelli Multi-Media Trust Inc. (The)",81,115,0],["GGT/PE","GGT/PE",1,0,0],["GGT/PG","GGT/PG",1,0,0],["GGTL","GGTL",1,0,0],["GGUS","GGUS",1,0,0],["GGZ","Gabelli Global Small and Mid Cap Value Trust (The)",11,131,0],["GH","Guardant Health Inc.",23,12571,0],["GHC","Graham Holdings Company",3,4806,0],["GHG","GreenTree Hospitality Group Ltd.",47,175,0],["GHI","Greystone Housing Impact Investors LP Beneficial Unit Certificates representing assignments of limited partnership interests",44,162,0],["GHM","Graham Corporation",7,677,0],["GHRS","GH Research PLC",8,804,0],["GHY","PGIM Global High Yield Fund Inc.",81,0,0],["GHYB","GHYB",1,0,0],["GIAX","GIAX",1,0,0],["GIB","CGI Inc.",19,20118,0],["GIBO","GIBO Holdings Limited Class A",25,10,0],["GIC","Global Industrial Company",7,1143,0],["GIFI","Gulf Island Fabrication Inc.",55,191,0],["GIFT","Giftify Inc.",57,32,0],["GIG","GigCapital7 Corp. Class A",2,0,0],["GIGB","GIGB",1,0,0],["GIGGU","GigCapital7 Corp. Unit",25,1649,0],["GIGL","GIGL",1,0,0],["GIGM","GigaMedia Limited",16,17,0],["GII","GII",1,0,0],["GIII","G-III Apparel Group LTD.",86,1277,0],["GIL","Gildan Activewear Inc. Class A Sub. Vot.",86,9448,0],["GILD","Gilead Sciences Inc.",13,154204,0],["GILT","Gilat Satellite Networks Ltd.",49,674,0],["GIND","GIND",1,0,0],["GINN","GINN",1,0,0],["GINX","GINX",1,0,0],["GIPR","Generation Income Properties Inc.",30,4,0],["GIS","General Mills Inc.",17,25537,0],["GITS","Global Interactive Technologies Inc.",16,6,0],["GIW","GigCapital8 Corp. Class A",1,0,0],["GIWWU","GigCapital8 Corp.",1,0,0],["GJH","Synthetic Fixed-Income Securities Inc 6.375% (STRATS) Cl A-1",44,0,0],["GJO","Synthetic Fixed-Income Securities Inc. on behalf of STRATS(SM) Trust for Wal-Mart Stores Inc. Securities Series 2004-5",44,0,0],["GJP","Synthetic Fixed-Income Securities Inc. on behalf of STRATS (SM) Trust for Dominion Resources Inc. Securities Series 2005-6 Floating Rate Structured Repackaged Asset-Backed Trust Securities (STRATS) Certificates",44,0,0],["GJR","Synthetic Fixed-Income Securities Inc. STRATS Trust for Procter&Gamble Securities Series 2006-1",44,0,0],["GJS","Goldman Sachs Group Securities STRATS Trust for Goldman Sachs Group Securities Series 2006-2",44,7239,0],["GJT","Synthetic Fixed-Income Securities Inc. Floating Rate Structured Repackaged Asset-Backed Trust Securities Certificates Series 2006-3",44,0,0],["GK","GK",1,0,0],["GKAT","GKAT",1,0,0],["GKOS","Glaukos Corporation",31,6675,0],["GL","Globe Life Inc.",5,11116,0],["GL/PD","GL/PD",1,0,0],["GLAD","Gladstone Capital Corporation",115,466,0],["GLBE","Global-E Online Ltd.",25,6797,0],["GLBS","Globus Maritime Limited",98,35,0],["GLBZ","Glen Burnie Bancorp",26,13,0],["GLCR","GLCR",1,0,0],["GLD","GLD",1,0,0],["GLDB","GLDB",1,0,0],["GLDD","Great Lakes Dredge & Dock Corporation",21,919,0],["GLDG","GoldMining Inc.",104,264,0],["GLDI","GLDI",1,0,0],["GLDM","GLDM",1,0,0],["GLDY","GLDY",1,0,0],["GLE","Global Engine Group Holding Limited Class A",15,8,0],["GLGG","GLGG",1,0,0],["GLIBA","GCI Liberty Inc. Series A GCI Group",54,1057,0],["GLIBK","GCI Liberty Inc. Series C GCI Group",54,1056,0],["GLIN","GLIN",1,0,0],["GLIX","GLIX",1,0,0],["GLL","GLL",1,0,0],["GLMD","Galmed Pharmaceuticals Ltd.",8,2,0],["GLNG","Golar Lng Ltd",98,3985,0],["GLNK","GLNK",1,0,0],["GLO","Clough Global Opportunities Fund",123,0,0],["GLOB","Globant S.A.",15,3060,0],["GLOF","GLOF",1,0,0],["GLOO","Gloo Holdings Inc. Class A",15,465,0],["GLOP/PA","GLOP/PA",1,0,0],["GLOP/PB","GLOP/PB",1,0,0],["GLOP/PC","GLOP/PC",1,0,0],["GLOW","GLOW",1,0,0],["GLP","Global Partners LP Common",80,1469,0],["GLP/PB","GLP/PB",1,0,0],["GLPG","Galapagos NV",8,2132,0],["GLPI","Gaming and Leisure Properties Inc.",30,12642,0],["GLQ","Clough Global Equity Fund Clough Global Equity Fund",123,0,0],["GLRE","Greenlight Capital Re Ltd. Class A",22,492,0],["GLRY","GLRY",1,0,0],["GLSI","Greenwich LifeSciences Inc.",8,180,0],["GLTO","Galecto Inc.",8,43,0],["GLTR","GLTR",1,0,0],["GLU","Gabelli Global Utility",123,112,0],["GLU/PA","GLU/PA",1,0,0],["GLU/PB","GLU/PB",1,0,0],["GLUE","Monte Rosa Therapeutics Inc.",13,1012,0],["GLV","Clough Global Dividend and Income Fund",123,76,0],["GLW","Corning Incorporated",33,75328,0],["GLXG","Galaxy Payroll Group Limited Class A",12,5,0],["GLXY","Galaxy Digital Inc. Class A",60,9375,0],["GM","General Motors Company",37,76821,0],["GMAB","Genmab A/S ADS",8,21431,0],["GME","GameStop Corporation",151,10085,0],["GMED","Globus Medical Inc. Class A",31,11652,0],["GMET","GMET",1,0,0],["GMEY","GMEY",1,0,0],["GMF","GMF",1,0,0],["GMGI","Golden Matrix Group Inc.",25,116,0],["GMHS","Gamehaus Holdings Inc. Class A",15,54,0],["GMM","Global Mofy AI Limited Class A",16,4,0],["GMMA","GMMA",1,0,0],["GMMF","GMMF",1,0,0],["GMNY","GMNY",1,0,0],["GMOC","GMOC",1,0,0],["GMOD","GMOD",1,0,0],["GMOI","GMOI",1,0,0],["GMOV","GMOV",1,0,0],["GMRE","Global Medical REIT Inc.",30,458,0],["GMRE/PA","GMRE/PA",1,0,0],["GMRE/PB","GMRE/PB",1,0,0],["GMUB","GMUB",1,0,0],["GMUN","GMUN",1,0,0],["GNE","Genie Energy Ltd. Class B",129,374,0],["GNK","Genco Shipping & Trading Limited",98,790,0],["GNL","Global Net Lease Inc.",30,1828,0],["GNL/PA","GNL/PA",1,0,0],["GNL/PB","GNL/PB",1,0,0],["GNL/PD","GNL/PD",1,0,0],["GNL/PE","GNL/PE",1,0,0],["GNLN","Greenlane Holdings Inc. Class A",40,4,0],["GNLX","Genelux Corporation",8,160,0],["GNMA","GNMA",1,0,0],["GNOM","GNOM",1,0,0],["GNPX","Genprex Inc.",8,8,0],["GNR","GNR",1,0,0],["GNRC","Generac Holdlings Inc.",55,8154,0],["GNS","Genius Group Limited",45,45,0],["GNSS","Genasys Inc.",133,101,0],["GNT","GAMCO Natural Resources Gold & Income Trust",123,145,0],["GNT/PA","GNT/PA",1,0,0],["GNTA","Genenta Science S.p.A.",13,34,0],["GNTX","Gentex Corporation",42,5160,0],["GNW","Genworth Financial Inc",5,3662,0],["GO","Grocery Outlet Holding Corp.",67,981,0],["GOAU","GOAU",1,0,0],["GOCO","GoHealth Inc. Class A",28,67,0],["GOEX","GOEX",1,0,0],["GOF","Guggenheim Strategic Opportunities Fund",123,0,0],["GOGO","Gogo Inc.",33,606,0],["GOLD","Gold.com Inc.",66,817,0],["GOLF","Acushnet Holdings Corp.",61,4837,0],["GOOD","Gladstone Commercial Corporation Real Estate Investment Trust",36,523,0],["GOODN","Gladstone Commercial Corporation 6.625% Series E Cumulative Redeemable",36,1121,0],["GOODO","Gladstone Commercial Corporation 6.00% Series G Cumulative Redeemable",36,1005,0],["GOOG","Alphabet Inc. Class C",16,3723997,0],["GOOGL","Alphabet Inc. Class A",16,3706500,0],["GOOS","Canada Goose Holdings Inc. Subordinate Voting Shares",86,1249,0],["GOOY","GOOY",1,0,0],["GORO","Gold Resource Corporation",104,143,0],["GOSS","Gossamer Bio Inc.",8,796,0],["GOTU","Gaotu Techedu Inc.",3,571,0],["GOU","GOU",1,0,0],["GOVI","GOVI",1,0,0],["GOVX","GeoVax Labs Inc.",8,8,0],["GP","GreenPower Motor Company Inc.",72,3,0],["GPACU","General Purpose Acquisition Corp.",1,0,0],["GPAT","GP-Act III Acquisition Corp. Class A",1,0,0],["GPC","Genuine Parts Company",79,17453,0],["GPCR","Structure Therapeutics Inc.",8,4490,0],["GPI","Group 1 Automotive Inc.",97,5118,0],["GPIQ","GPIQ",1,0,0],["GPIX","GPIX",1,0,0],["GPJA","Georgia Power Company Series 2017A 5.00% Junior Subordinated Notes due October 1 2077",41,210,0],["GPK","Graphic Packaging Holding Company",125,4554,0],["GPMT","Granite Point Mortgage Trust Inc.",30,115,0],["GPMT/PA","GPMT/PA",1,0,0],["GPN","Global Payments Inc.",36,19141,0],["GPOR","Gulfport Energy Corporation",59,3888,0],["GPRE","Green Plains Inc.",34,656,0],["GPRF","GPRF",1,0,0],["GPRK","Geopark Ltd",59,363,0],["GPRO","GoPro Inc. Class A",7,259,0],["GPT","GPT",1,0,0],["GPTY","GPTY",1,0,0],["GPUS","Hyperscale Data Inc.",7,89,0],["GPUS/PD","GPUS/PD",1,0,0],["GPZ","GPZ",1,0,0],["GQGU","GQGU",1,0,0],["GQI","GQI",1,0,0],["GQQQ","GQQQ",1,0,0],["GQRE","GQRE",1,0,0],["GRAB","Grab Holdings Limited Class A",36,20086,0],["GRAF","Graf Global Corp. Class A",1,0,0],["GRAG","GRAG",1,0,0],["GRAL","GRAIL Inc.",23,3551,0],["GRAN","Grande Group Limited Class A",44,82,0],["GRBK","Green Brick Partners Inc.",121,2792,0],["GRBK/PA","GRBK/PA",1,0,0],["GRC","Gorman-Rupp Company (The)",148,1292,0],["GRCE","Grace Therapeutics Inc.",8,47,0],["GRDN","Guardian Pharmacy Services Inc. Class A",142,1997,0],["GRDX","GridAI Technologies Corp.",8,8,0],["GREE","Greenidge Generation Holdings Inc. Class A",44,27,0],["GREEL","Greenidge Generation Holdings Inc. 8.50% Senior Notes due 2026",44,283,0],["GREK","GREK",1,0,0],["GRF","Eagle Capital Growth Fund Inc.",123,0,0],["GRFS","Grifols S.A.",8,6202,0],["GRI","GRI Bio Inc.",8,3,0],["GRID","GRID",1,0,0],["GRIN","GRIN",1,0,0],["GRMN","Garmin Ltd.",7,38779,0],["GRN","GRN",1,0,0],["GRNB","GRNB",1,0,0],["GRND","Grindr Inc.",16,2566,0],["GRNI","GRNI",1,0,0],["GRNJ","GRNJ",1,0,0],["GRNQ","Greenpro Capital Corp.",15,15,0],["GRNT","Granite Ridge Resources Inc.",59,609,0],["GRNY","GRNY",1,0,0],["GRO","Brazil Potash Corp.",74,104,0],["GROV","Grove Collaborative Holdings Inc. Class A",57,50,0],["GROW","U.S. Global Investors Inc. Class A",11,30,0],["GROY","Gold Royalty Corp.",104,711,0],["GRP.U","GRP.U",1,0,0],["GRPM","GRPM",1,0,0],["GRPN","Groupon Inc.",58,677,0],["GRPZ","GRPZ",1,0,0],["GRRR","Gorilla Technology Group Inc.",25,248,0],["GRVY","GRAVITY Co. Ltd. American Depository Shares",36,397,0],["GRW","GRW",1,0,0],["GRWG","GrowGeneration Corp.",130,107,0],["GRX","The Gabelli Healthcare & Wellness Trust",123,165,0],["GS","Goldman Sachs Group Inc. (The)",60,267980,0],["GS/PA","GS/PA",1,0,0],["GS/PC","GS/PC",1,0,0],["GS/PD","GS/PD",1,0,0],["GSAT","Globalstar Inc.",33,7896,0],["GSBC","Great Southern Bancorp Inc.",26,720,0],["GSBD","Goldman Sachs BDC Inc.",11,1098,0],["GSC","GSC",1,0,0],["GSEU","GSEU",1,0,0],["GSG","GSG",1,0,0],["GSGO","GSGO",1,0,0],["GSHD","Goosehead Insurance Inc. Class A",28,2706,0],["GSHR","Gesher Acquisition Corp. II Class A",1,0,0],["GSHRU","Gesher Acquisition Corp. II",2,0,0],["GSIB","GSIB",1,0,0],["GSIE","GSIE",1,0,0],["GSIG","GSIG",1,0,0],["GSIT","GSI Technology",6,209,0],["GSIW","Garden Stage Limited",60,10,0],["GSJY","GSJY",1,0,0],["GSK","GSK plc",8,99136,0],["GSKH","GSKH",1,0,0],["GSL","Global Ship Lease Inc New Class A",98,1209,0],["GSL/PB","GSL/PB",1,0,0],["GSLC","GSLC",1,0,0],["GSM","Ferroglobe PLC",10,872,0],["GSOL","GSOL",1,0,0],["GSPY","GSPY",1,0,0],["GSRF","GSR IV Acquisition Corp. Class A",1,0,0],["GSRFU","GSR IV Acquisition Corp.",1,0,0],["GSSC","GSSC",1,0,0],["GSUN","Golden Sun Health Technology Group Limited Class A",3,2,0],["GSY","GSY",1,0,0],["GT","The Goodyear Tire & Rubber Company",79,2538,0],["GTBP","GT Biopharma Inc.",8,8,0],["GTE","Gran Tierra Energy Inc.",59,136,0],["GTEC","Greenland Technologies Holding Corporation",7,18,0],["GTEK","GTEK",1,0,0],["GTEN","Gores Holdings X Inc. Class A",1,0,0],["GTENU","GTENU",1,0,0],["GTERA","Globa Terra Acquisition Corporation Class A",2,0,0],["GTERU","GTERU",1,0,0],["GTES","Gates Industrial Corporation plc",7,5581,0],["GTIM","Good Times Restaurants Inc.",68,14,0],["GTLB","GitLab Inc. Class A",25,6399,0],["GTLS","Chart Industries Inc.",55,9256,0],["GTM","ZoomInfo Technologies Inc",25,3200,0],["GTN","Gray Media Inc.",83,521,0],["GTN.A","GTN.A",1,0,0],["GTO","GTO",1,0,0],["GTOP","GTOP",1,0,0],["GTPE","GTPE",1,0,0],["GTR","GTR",1,0,0],["GTX","Garrett Motion Inc.",42,3382,0],["GTY","Getty Realty Corporation",36,1617,0],["GUG","Guggenheim Active Allocation Fund",81,0,0],["GUMI","GUMI",1,0,0],["GUNR","GUNR",1,0,0],["GURE","Gulf Resources Inc. (NV)",34,6,0],["GURU","GURU",1,0,0],["GUSA","GUSA",1,0,0],["GUSE","GUSE",1,0,0],["GUSH","GUSH",1,0,0],["GUT","Gabelli Utility Trust (The)",81,446,0],["GUT/PC","GUT/PC",1,0,0],["GUTS","Fractyl Health Inc.",31,301,0],["GV","Visionary Holdings Inc.",3,5,0],["GVA","Granite Construction Incorporated",21,5039,0],["GVH","Globavend Holdings Limited",105,4,0],["GVIP","GVIP",1,0,0],["GVLE","GVLE",1,0,0],["GVLU","GVLU",1,0,0],["GVUS","GVUS",1,0,0],["GWAV","Greenwave Technology Solutions Inc.",55,5,0],["GWH","ESS Tech Inc.",7,42,0],["GWRE","Guidewire Software Inc.",25,16997,0],["GWRS","Global Water Resources Inc.",70,243,0],["GWW","W.W. Grainger Inc.",92,48739,0],["GWX","GWX",1,0,0],["GXAI","Gaxos.ai Inc.",25,8,0],["GXC","GXC",1,0,0],["GXDW","GXDW",1,0,0],["GXIG","GXIG",1,0,0],["GXLC","GXLC",1,0,0],["GXO","GXO Logistics Inc.",87,6101,0],["GXPC","GXPC",1,0,0],["GXPD","GXPD",1,0,0],["GXPE","GXPE",1,0,0],["GXPS","GXPS",1,0,0],["GXPT","GXPT",1,0,0],["GXRP","GXRP",1,0,0],["GXUS","GXUS",1,0,0],["GYLD","GYLD",1,0,0],["GYRE","Gyre Therapeutics Inc.",8,687,0],["GYRO","Gyrodyne LLC",134,20,0],["H","Hyatt Hotels Corporation Class A",47,15628,0],["HACK","HACK",1,0,0],["HAE","Haemonetics Corporation",31,3755,0],["HAFC","Hanmi Financial Corporation",26,854,0],["HAFN","Hafnia Limited",87,2679,0],["HAIL","HAIL",1,0,0],["HAIN","Hain Celestial Group Inc. (The)",17,107,0],["HAL","Halliburton Company",20,23330,0],["HALO","Halozyme Therapeutics Inc.",13,7920,0],["HAO","Haoxi Health Technology Limited Class A",58,3,0],["HAP","HAP",1,0,0],["HAPI","HAPI",1,0,0],["HAPS","HAPS",1,0,0],["HARD","HARD",1,0,0],["HAS","Hasbro Inc.",61,11505,0],["HASI","HA Sustainable Infrastructure Capital Inc.",123,4124,0],["HAUZ","HAUZ",1,0,0],["HAVA","Harvard Ave Acquisition Corporation Class A",1,0,0],["HAVAU","Harvard Ave Acquisition Corporation Unit",2,0,0],["HAWX","HAWX",1,0,0],["HAYW","Hayward Holdings Inc.",7,3468,0],["HBAN","Huntington Bancshares Incorporated",26,27858,0],["HBANL","Huntington Bancshares Incorporated",26,40488,0],["HBANM","Huntington Bancshares Incorporated",26,34819,0],["HBANP","Huntington Bancshares Incorporated",26,27244,0],["HBB","Hamilton Beach Brands Holding Company Class A",73,214,0],["HBCP","Home Bancorp Inc.",43,477,0],["HBDC","HBDC",1,0,0],["HBIO","Harvard Bioscience Inc.",71,34,0],["HBM","Hudbay Minerals Inc.",10,7634,0],["HBNB","Hotel101 Global Holdings Corp. Class A",47,1758,0],["HBNC","Horizon Bancorp Inc.",26,926,0],["HBR","Canary HBAR ETF Shares of Beneficial Interest",44,53,0],["HBT","HBT Financial Inc.",26,842,0],["HBTA","HBTA",1,0,0],["HCA","HCA Healthcare Inc.",126,107931,0],["HCACU","Hall Chadwick Acquisition Corp. Unit",42,0,0],["HCAI","Huachen AI Parking Management Technology Holding Co. Ltd. Class A",69,12,0],["HCAT","Health Catalyst Inc",16,166,0],["HCC","Warrior Met Coal Inc.",65,4596,0],["HCHL","Happy City Holdings Limited Class A",68,71,0],["HCI","HCI Group Inc.",22,2462,0],["HCKT","Hackett Group Inc (The).",19,541,0],["HCM","HUTCHMED (China) Limited",8,2364,0],["HCMA","HCM III Acquisition Corp. Class A",47,799,0],["HCMAU","HCM III Acquisition Corp.",1,0,0],["HCMT","HCMT",1,0,0],["HCOW","HCOW",1,0,0],["HCSG","Healthcare Services Group Inc.",126,1377,0],["HCTI","Healthcare Triangle Inc.",15,88,0],["HCWB","HCW Biologics Inc.",8,4,0],["HCWC","Healthy Choice Wellness Corp. Class A",67,4,0],["HCXY","Hercules Capital Inc. 6.25% Notes due 2033",11,4622,0],["HD","Home Depot Inc. (The)",130,343451,0],["HDB","HDFC Bank Limited",75,183686,0],["HDEF","HDEF",1,0,0],["HDG","HDG",1,0,0],["HDGE","HDGE",1,0,0],["HDL","SUPER HI INTERNATIONAL HOLDING LTD.",68,1106,0],["HDLB","HDLB",1,0,0],["HDMV","HDMV",1,0,0],["HDSN","Hudson Technologies Inc.",32,307,0],["HDUS","HDUS",1,0,0],["HDV","HDV",1,0,0],["HE","Hawaiian Electric Industries Inc.",41,1971,0],["HEAL","HEAL",1,0,0],["HECA","HECA",1,0,0],["HECO","HECO",1,0,0],["HEDG","HEDG",1,0,0],["HEDJ","HEDJ",1,0,0],["HEFT","HEFT",1,0,0],["HEI","Heico Corporation",50,45475,0],["HEI.A","HEI.A",1,0,0],["HEJD","HEJD",1,0,0],["HELE","Helen of Troy Limited",73,470,0],["HELO","HELO",1,0,0],["HELS","HELS",1,0,0],["HEPS","D-Market Electronic Services & Trading",57,1057,0],["HEQ","John Hancock Diversified Income Fund",11,0,0],["HEQQ","HEQQ",1,0,0],["HEQT","HEQT",1,0,0],["HERD","HERD",1,0,0],["HERE","Here Group Limited",3,278,0],["HERO","HERO",1,0,0],["HERZ","Herzfeld Credit Income Fund Inc.",11,0,0],["HESM","Hess Midstream LP Class A Representing Limited Partner Interests",59,4381,0],["HEWJ","HEWJ",1,0,0],["HEZU","HEZU",1,0,0],["HF","HF",1,0,0],["HFBL","Home Federal Bancorp Inc. of Louisiana",84,50,0],["HFEQ","HFEQ",1,0,0],["HFFG","HF Foods Group Inc.",103,128,0],["HFGM","HFGM",1,0,0],["HFMF","HFMF",1,0,0],["HFND","HFND",1,0,0],["HFRO","Highland Opportunities and Income Fund",123,0,0],["HFRO/PA","HFRO/PA",1,0,0],["HFRO/PB","HFRO/PB",1,0,0],["HFSP","HFSP",1,0,0],["HFWA","Heritage Financial Corporation",43,846,0],["HFXI","HFXI",1,0,0],["HG","Hamilton Insurance Group Ltd. Class B",1,1823,0],["HGBL","Heritage Global Inc.",36,43,0],["HGER","HGER",1,0,0],["HGLB","Highland Global Allocation Fund",81,0,0],["HGRO","HGRO",1,0,0],["HGTY","Hagerty Inc. Class A",28,4491,0],["HGV","Hilton Grand Vacations Inc.",47,3879,0],["HHH","Howard Hughes Holdings Inc.",30,4660,0],["HHS","Harte Hanks Inc.",58,25,0],["HI","Hillenbrand Inc",69,2232,0],["HIBL","HIBL",1,0,0],["HIBS","HIBS",1,0,0],["HIDE","HIDE",1,0,0],["HIDV","HIDV",1,0,0],["HIFS","Hingham Institution for Savings",43,635,0],["HIG","The Hartford Insurance Group Inc.",22,38735,0],["HIG/PG","HIG/PG",1,0,0],["HIGH","HIGH",1,0,0],["HIHO","Highway Holdings Limited",55,4,0],["HII","Huntington Ingalls Industries Inc.",98,13210,0],["HIMS","Hims & Hers Health Inc. Class A",35,8095,0],["HIMX","Himax Technologies Inc.",6,1417,0],["HIMY","HIMY",1,0,0],["HIMZ","HIMZ",1,0,0],["HIND","Vyome Holdings Inc.",31,21,0],["HIO","Western Asset High Income Opportunity Fund Inc.",123,0,0],["HIPO","Hippo Holdings Inc.",22,783,0],["HIPS","HIPS",1,0,0],["HISF","HISF",1,0,0],["HIT","Health In Tech Inc. Class A",28,77,0],["HITI","High Tide Inc.",66,241,0],["HIVE","HIVE Digital Technologies Ltd.",44,673,0],["HIW","Highwoods Properties Inc.",30,2791,0],["HIX","Western Asset High Income Fund II Inc.",123,0,0],["HIYY","HIYY",1,0,0],["HKD","AMTD Digital Inc.",44,172,0],["HKIT","Hitek Global Inc. Class A",25,193,0],["HKPD","Hong Kong Pharma Digital Technology Holdings Limited",112,8,0],["HL","Hecla Mining Company",74,13181,0],["HL/PB","HL/PB",1,0,0],["HLAL","HLAL",1,0,0],["HLF","Herbalife Ltd.",112,1445,0],["HLI","Houlihan Lokey Inc. Class A",11,12371,0],["HLIO","Helios Technologies Inc.",55,1811,0],["HLIT","Harmonic Inc.",49,1109,0],["HLLY","Holley Inc.",42,508,0],["HLMN","Hillman Solutions Corp.",7,1752,0],["HLN","Haleon plc",90,44087,0],["HLNE","Hamilton Lane Incorporated Class A",11,7502,0],["HLP","Hongli Group Inc.",7,87,0],["HLT","Hilton Worldwide Holdings Inc.",47,67929,0],["HLX","Helix Energy Solutions Group Inc.",20,903,0],["HMC","Honda Motor Company Ltd.",37,43639,0],["HMN","Horace Mann Educators Corporation",22,1893,0],["HMOP","HMOP",1,0,0],["HMR","Heidmar Maritime Holdings Corp.",98,54,0],["HMY","Harmony Gold Mining Company Limited",104,13121,0],["HMYY","HMYY",1,0,0],["HNDL","HNDL",1,0,0],["HNGE","Hinge Health Inc. Class A",15,3719,0],["HNI","HNI Corporation",92,1929,0],["HNNA","Hennessy Advisors Inc.",11,73,0],["HNNAZ","Hennessy Advisors Inc. 4.875% Notes due 2026",11,193,0],["HNRG","Hallador Energy Company",65,845,0],["HNST","The Honest Company Inc.",57,312,0],["HNVR","Hanover Bancorp Inc.",26,172,0],["HODU","HODU",1,0,0],["HOFT","Hooker Furnishings Corporation",73,119,0],["HOG","Harley-Davidson Inc.",119,2511,0],["HOLA","HOLA",1,0,0],["HOLD","HOLD",1,0,0],["HOLO","MicroCloud Hologram Inc.",16,43,0],["HOLX","Hologic Inc.",132,16707,0],["HOMB","Home BancShares Inc.",26,5592,0],["HOMZ","HOMZ",1,0,0],["HON","Honeywell International Inc.",50,126412,0],["HOOD","Robinhood Markets Inc. Class A",60,109117,0],["HOOG","HOOG",1,0,0],["HOOI","HOOI",1,0,0],["HOOX","HOOX",1,0,0],["HOOY","HOOY",1,0,0],["HOOZ","HOOZ",1,0,0],["HOPE","Hope Bancorp Inc.",26,1468,0],["HOTH","Hoth Therapeutics Inc.",8,17,0],["HOUR","Hour Loop Inc.",57,69,0],["HOUS","Anywhere Real Estate Inc.",36,1624,0],["HOV","Hovnanian Enterprises Inc. Class A",121,607,0],["HOVNP","Hovnanian Enterprises Inc Dep Shr Srs A Pfd",121,118,0],["HOVR","New Horizon Aircraft Ltd. Class A",50,73,0],["HOWL","Werewolf Therapeutics Inc.",8,33,0],["HOYY","HOYY",1,0,0],["HP","Helmerich & Payne Inc.",59,2751,0],["HPAI","Helport AI Limited",25,155,0],["HPE","Hewlett Packard Enterprise Company",100,32234,0],["HPE/PC","HPE/PC",1,0,0],["HPF","John Hancock Pfd Income Fund II Pfd Income Fund II",116,0,0],["HPI","John Hancock Preferred Income Fund",81,0,0],["HPK","HighPeak Energy Inc.",59,534,0],["HPP","Hudson Pacific Properties Inc.",36,560,0],["HPP/PC","HPP/PC",1,0,0],["HPQ","HP Inc.",9,21352,0],["HPS","John Hancock Preferred Income Fund III Preferred Income Fund III",11,0,0],["HQGO","HQGO",1,0,0],["HQH","abrdn Healthcare Investors Shares of Beneficial Interest",116,898,0],["HQI","HireQuest Inc.",19,118,0],["HQL","abrdn Life Sciences Investors Shares of Beneficial Interest",11,434,0],["HQY","HealthEquity Inc.",36,8159,0],["HR","Healthcare Realty Trust Incorporated",30,5925,0],["HRB","H&R Block Inc.",3,5526,0],["HRI","Herc Holdings Inc.",131,5118,0],["HRL","Hormel Foods Corporation",62,13021,0],["HRMY","Harmony Biosciences Holdings Inc.",8,2178,0],["HROW","Harrow Inc.",8,1719,0],["HRTG","Heritage Insurance Holdings Inc.",22,895,0],["HRTS","HRTS",1,0,0],["HRTX","Heron Therapeutics Inc.",8,238,0],["HRZN","Horizon Technology Finance Corporation",44,285,0],["HSAI","Hesai Group American",7,3121,0],["HSBC","HSBC Holdings plc.",84,267659,0],["HSCS","HeartSciences Inc.",32,8,0],["HSCZ","HSCZ",1,0,0],["HSDT","Solana Company Class A",77,123,0],["HSHP","Himalaya Shipping Ltd.",98,411,0],["HSIC","Henry Schein Inc.",23,9106,0],["HSMV","HSMV",1,0,0],["HSPT","Horizon Space Acquisition II Corp.",1,0,0],["HSPTU","Horizon Space Acquisition II Corp.",1,0,0],["HST","Host Hotels & Resorts Inc.",30,12729,0],["HSTM","HealthStream Inc.",16,710,0],["HSY","The Hershey Company",93,38379,0],["HTAB","HTAB",1,0,0],["HTAX","HTAX",1,0,0],["HTB","HomeTrust Bancshares Inc.",84,779,0],["HTBK","Heritage Commerce Corp",26,761,0],["HTCO","High-Trend International Group Class A",98,62,0],["HTCR","Heartcore Enterprises Inc.",15,9,0],["HTD","John Hancock Tax Advantaged Dividend Income Fund",116,0,0],["HTEC","HTEC",1,0,0],["HTFB","Horizon Technology Finance Corporation 4.875% Notes due 2026",44,1058,0],["HTFC","Horizon Technology Finance Corporation 6.25% Notes due 2027",44,1055,0],["HTFL","Heartflow Inc.",31,2598,0],["HTGC","Hercules Capital Inc.",11,3364,0],["HTH","Hilltop Holdings Inc.",26,2128,0],["HTHT","H World Group Limited",47,15077,0],["HTLD","Heartland Express Inc.",63,695,0],["HTLM","HomesToLife Ltd",66,232,0],["HTO","H2O America",70,1753,0],["HTOO","Fusion Fuel Green PLC Class A",7,3,0],["HTRB","HTRB",1,0,0],["HTZ","Hertz Global Holdings Inc",96,1605,0],["HUBB","Hubbell Inc",39,23517,0],["HUBC","Hub Cyber Security Ltd.",51,4,0],["HUBG","Hub Group Inc. Class A",105,2679,0],["HUBS","HubSpot Inc.",25,20402,0],["HUDI","Huadi International Group Co. Ltd.",27,18,0],["HUHU","HUHUTECH International Group Inc.",55,240,0],["HUIZ","Huize Holding Limited",28,31,0],["HUM","Humana Inc.",23,31199,0],["HUMA","Humacyte Inc.",13,233,0],["HUN","Huntsman Corporation",34,1751,0],["HURA","TuHURA Biosciences Inc.",8,50,0],["HURC","Hurco Companies Inc.",7,95,0],["HURN","Huron Consulting Group Inc.",19,3114,0],["HUSV","HUSV",1,0,0],["HUT","Hut 8 Corp.",44,4767,0],["HUYA","HUYA Inc.",16,679,0],["HVAC","HVAC",1,0,0],["HVII","Hennessy Capital Investment Corp. VII",1,0,0],["HVIIU","Hennessy Capital Investment Corp. VII Unit",2,0,0],["HVMC","Highview Merger Corp. Class A",1,0,0],["HVMCU","Highview Merger Corp.",2,0,0],["HVT","Haverty Furniture Companies Inc.",66,395,0],["HVT.A","HVT.A",1,0,0],["HWAY","HWAY",1,0,0],["HWBK","Hawthorn Bancshares Inc.",26,251,0],["HWC","Hancock Whitney Corporation",26,5503,0],["HWCPZ","Hancock Whitney Corporation 6.25% Subordinated Notes due 2060",26,1996,0],["HWH","HWH International Inc.",112,10,0],["HWKN","Hawkins Inc.",135,3012,0],["HWM","Howmet Aerospace Inc.",55,81816,0],["HWSM","HWSM",1,0,0],["HXHX","Haoxin Holdings Limited Class A",63,5,0],["HXL","Hexcel Corporation",34,5933,0],["HY","Hyster-Yale Inc. Class A",72,544,0],["HYAC","Haymaker Acquisition Corp. 4 Class A",1,0,0],["HYAC.U","HYAC.U",1,0,0],["HYBB","HYBB",1,0,0],["HYBI","HYBI",1,0,0],["HYBX","HYBX",1,0,0],["HYDR","HYDR",1,0,0],["HYDW","HYDW",1,0,0],["HYEM","HYEM",1,0,0],["HYFI","HYFI",1,0,0],["HYFM","Hydrofarm Holdings Group Inc.",94,8,0],["HYFT","MindWalk Holdings Corp.",8,78,0],["HYG","HYG",1,0,0],["HYGH","HYGH",1,0,0],["HYGV","HYGV",1,0,0],["HYI","Western Asset High Yield Opportunity Fund Inc.",11,0,0],["HYLB","HYLB",1,0,0],["HYLN","Hyliion Holdings Corp. Class A",72,327,0],["HYLS","HYLS",1,0,0],["HYMB","HYMB",1,0,0],["HYMC","Hycroft Mining Holding Corporation Class A",104,1329,0],["HYNE","Hoyne Bancorp Inc.",43,111,0],["HYP","HYP",1,0,0],["HYPD","Hyperion DeFi Inc.",8,216,0],["HYPR","Hyperfine Inc. Class A",77,107,0],["HYRM","HYRM",1,0,0],["HYS","HYS",1,0,0],["HYSA","HYSA",1,0,0],["HYSD","HYSD",1,0,0],["HYT","Blackrock Corporate High Yield Fund Inc.",116,0,0],["HYTI","HYTI",1,0,0],["HYTR","HYTR",1,0,0],["HYUP","HYUP",1,0,0],["HYXF","HYXF",1,0,0],["HYZD","HYZD",1,0,0],["HZO","MarineMax Inc. (FL)",141,541,0],["IAC","IAC Inc.",16,3102,0],["IAE","Voya Asia Pacific High Dividend Equity Income Fund ING Asia Pacific High Dividend Equity Income Fund",81,0,0],["IAF","abrdn Australia Equity Fund Inc.",123,0,0],["IAG","Iamgold Corporation",104,9659,0],["IAI","IAI",1,0,0],["IAK","IAK",1,0,0],["IALT","IALT",1,0,0],["IAPR","IAPR",1,0,0],["IART","Integra LifeSciences Holdings Corporation",31,985,0],["IAS","Integral Ad Science Holding Corp.",16,1722,0],["IAT","IAT",1,0,0],["IAU","IAU",1,0,0],["IAUG","IAUG",1,0,0],["IAUM","IAUM",1,0,0],["IAUX","i-80 Gold Corp.",104,1272,0],["IBAC","IB Acquisition Corp.",2,0,0],["IBAT","IBAT",1,0,0],["IBB","IBB",1,0,0],["IBBQ","IBBQ",1,0,0],["IBCA","IBCA",1,0,0],["IBCP","Independent Bank Corporation",26,706,0],["IBD","IBD",1,0,0],["IBDR","IBDR",1,0,0],["IBDS","IBDS",1,0,0],["IBDT","IBDT",1,0,0],["IBDU","IBDU",1,0,0],["IBDV","IBDV",1,0,0],["IBDW","IBDW",1,0,0],["IBDX","IBDX",1,0,0],["IBDY","IBDY",1,0,0],["IBDZ","IBDZ",1,0,0],["IBEX","IBEX Limited",15,512,0],["IBG","Innovation Beverage Group Limited",46,6,0],["IBGA","IBGA",1,0,0],["IBGB","IBGB",1,0,0],["IBGK","IBGK",1,0,0],["IBGL","IBGL",1,0,0],["IBIC","IBIC",1,0,0],["IBID","IBID",1,0,0],["IBIE","IBIE",1,0,0],["IBIF","IBIF",1,0,0],["IBIG","IBIG",1,0,0],["IBIH","IBIH",1,0,0],["IBII","IBII",1,0,0],["IBIJ","IBIJ",1,0,0],["IBIK","IBIK",1,0,0],["IBIL","IBIL",1,0,0],["IBIO","iBio Inc.",8,45,0],["IBIT","IBIT",1,0,0],["IBKR","Interactive Brokers Group Inc. Class A",60,28619,0],["IBLC","IBLC",1,0,0],["IBM","International Business Machines Corporation",9,281337,0],["IBN","ICICI Bank Limited",75,106748,0],["IBND","IBND",1,0,0],["IBO","Impact BioMedical Inc.",8,68,0],["IBOC","International Bancshares Corporation",26,4379,0],["IBOT","IBOT",1,0,0],["IBP","Installed Building Products Inc.",121,7247,0],["IBRN","IBRN",1,0,0],["IBRX","ImmunityBio Inc.",13,2049,0],["IBTA","Ibotta Inc. Class A",58,574,0],["IBTG","IBTG",1,0,0],["IBTH","IBTH",1,0,0],["IBTI","IBTI",1,0,0],["IBTJ","IBTJ",1,0,0],["IBTK","IBTK",1,0,0],["IBTL","IBTL",1,0,0],["IBTM","IBTM",1,0,0],["IBTO","IBTO",1,0,0],["IBTP","IBTP",1,0,0],["IBTQ","IBTQ",1,0,0],["IBUF","IBUF",1,0,0],["IBUY","IBUY",1,0,0],["ICAP","ICAP",1,0,0],["ICCC","ImmuCell Corporation",24,54,0],["ICCM","IceCure Medical Ltd.",31,38,0],["ICE","Intercontinental Exchange Inc.",60,91400,0],["ICFI","ICF International Inc.",19,1575,0],["ICG","Intchains Group Limited",6,216,0],["ICHR","Ichor Holdings",6,606,0],["ICL","ICL Group Ltd.",85,6426,0],["ICLN","ICLN",1,0,0],["ICLR","ICON plc",14,14033,0],["ICMB","Investcorp Credit Management BDC Inc.",44,41,0],["ICOI","ICOI",1,0,0],["ICON","Icon Energy Corp.",98,2,0],["ICOP","ICOP",1,0,0],["ICPI","ICPI",1,0,0],["ICPY","ICPY",1,0,0],["ICR/PA","ICR/PA",1,0,0],["ICRC","ICRC",1,0,0],["ICU","SeaStar Medical Holding Corporation",31,9,0],["ICUI","ICU Medical Inc.",31,3583,0],["IDA","IDACORP Inc.",41,6800,0],["IDAI","T Stamp Inc. Class A",25,20,0],["IDCC","InterDigital Inc.",29,8609,0],["IDE","Voya Infrastructure Industrials and Materials Fund",123,0,0],["IDEC","IDEC",1,0,0],["IDEF","IDEF",1,0,0],["IDEQ","IDEQ",1,0,0],["IDEV","IDEV",1,0,0],["IDGT","IDGT",1,0,0],["IDHQ","IDHQ",1,0,0],["IDLV","IDLV",1,0,0],["IDMO","IDMO",1,0,0],["IDN","Intellicheck Inc.",25,139,0],["IDNA","IDNA",1,0,0],["IDOG","IDOG",1,0,0],["IDR","Idaho Strategic Resources Inc.",104,715,0],["IDRV","IDRV",1,0,0],["IDT","IDT Corporation Class B",33,1291,0],["IDU","IDU",1,0,0],["IDVO","IDVO",1,0,0],["IDX","IDX",1,0,0],["IDXX","IDEXX Laboratories Inc.",24,55923,0],["IDYA","IDEAYA Biosciences Inc.",8,2941,0],["IDYN","IDYN",1,0,0],["IE","Ivanhoe Electric Inc.",10,2252,0],["IEF","IEF",1,0,0],["IEI","IEI",1,0,0],["IEMG","IEMG",1,0,0],["IEP","Icahn Enterprises L.P.",42,4610,0],["IESC","IES Holdings Inc.",82,8143,0],["IETH","IETH",1,0,0],["IEUR","IEUR",1,0,0],["IEUS","IEUS",1,0,0],["IEV","IEV",1,0,0],["IEX","IDEX Corporation",148,13307,0],["IEZ","IEZ",1,0,0],["IFBD","Infobird Co. Ltd",25,8,0],["IFEB","IFEB",1,0,0],["IFED","IFED",1,0,0],["IFF","International Flavors & Fragrances Inc.",34,16843,0],["IFGL","IFGL",1,0,0],["IFLO","IFLO",1,0,0],["IFLR","IFLR",1,0,0],["IFN","India Fund Inc. (The)",123,0,0],["IFRX","InflaRx N.V.",8,66,0],["IFS","Intercorp Financial Services Inc.",75,4925,0],["IFV","IFV",1,0,0],["IG","IG",1,0,0],["IGA","Voya Global Advantage and Premium Opportunity Fund",11,0,0],["IGACU","Invest Green Acquisition Corporation",2,0,0],["IGBH","IGBH",1,0,0],["IGC","IGC Pharma Inc.",8,28,0],["IGCB","IGCB",1,0,0],["IGD","Voya Global Equity Dividend and Premium Opportunity Fund",81,0,0],["IGF","IGF",1,0,0],["IGGY","IGGY",1,0,0],["IGI","Western Asset Investment Grade Opportunity Trust Inc.",11,0,0],["IGIB","IGIB",1,0,0],["IGIC","International General Insurance Holdings Ltd.",22,1139,0],["IGLB","IGLB",1,0,0],["IGM","IGM",1,0,0],["IGME","IGME",1,0,0],["IGOV","IGOV",1,0,0],["IGPT","IGPT",1,0,0],["IGR","CBRE Global Real Estate Income Fund",116,0,0],["IGSB","IGSB",1,0,0],["IGTR","IGTR",1,0,0],["IH","iHuman Inc.",3,114,0],["IHAK","IHAK",1,0,0],["IHD","Voya Emerging Markets High Income Dividend Equity Fund",11,0,0],["IHDG","IHDG",1,0,0],["IHE","IHE",1,0,0],["IHF","IHF",1,0,0],["IHG","Intercontinental Hotels Group",47,21626,0],["IHI","IHI",1,0,0],["IHRT","iHeartMedia Inc. Class A",83,661,0],["IHS","IHS Holding Limited",33,2447,0],["IHT","InnSuites Hospitality Trust Shares of Beneficial Interest",60,12,0],["IHY","IHY",1,0,0],["IHYF","IHYF",1,0,0],["IIF","Morgan Stanley India Investment Fund Inc.",81,0,0],["IIGD","IIGD",1,0,0],["III","Information Services Group Inc.",19,283,0],["IIIN","Insteel Industries Inc.",27,616,0],["IIIV","i3 Verticals Inc. Class A",36,838,0],["IIM","Invesco Value Municipal Income Trust",11,578,0],["IINN","Inspira Technologies Oxy B.H.N. Ltd.",31,36,0],["IIPR","Innovative Industrial Properties Inc.",36,1489,0],["IIPR/PA","IIPR/PA",1,0,0],["IJAN","IJAN",1,0,0],["IJH","IJH",1,0,0],["IJJ","IJJ",1,0,0],["IJK","IJK",1,0,0],["IJR","IJR",1,0,0],["IJS","IJS",1,0,0],["IJT","IJT",1,0,0],["IJUL","IJUL",1,0,0],["IJUN","IJUN",1,0,0],["IKT","Inhibikase Therapeutics Inc.",13,208,0],["ILAG","Intelligent Living Application Group Inc.",92,7,0],["ILCB","ILCB",1,0,0],["ILCG","ILCG",1,0,0],["ILCV","ILCV",1,0,0],["ILDR","ILDR",1,0,0],["ILF","ILF",1,0,0],["ILIT","ILIT",1,0,0],["ILLR","Triller Group Inc.",11,96,0],["ILMN","Illumina Inc.",23,20594,0],["ILOW","ILOW",1,0,0],["ILPT","Industrial Logistics Properties Trust",30,363,0],["ILS","ILS",1,0,0],["ILTB","ILTB",1,0,0],["IMA","ImageneBio Inc.",13,69,0],["IMAR","IMAR",1,0,0],["IMAX","Imax Corporation",7,2006,0],["IMAY","IMAY",1,0,0],["IMCB","IMCB",1,0,0],["IMCC","IM Cannabis Corp.",18,5,0],["IMCG","IMCG",1,0,0],["IMCR","Immunocore Holdings plc",13,1732,0],["IMCV","IMCV",1,0,0],["IMDX","Insight Molecular Diagnostics Inc.",24,155,0],["IMG","CIMG Inc.",66,21,0],["IMKTA","Ingles Markets Incorporated Class A",67,1362,0],["IMMP","Immutep Limited",8,387,0],["IMMR","Immersion Corporation",53,209,0],["IMMX","Immix Biopharma Inc.",8,298,0],["IMNM","Immunome Inc.",8,2366,0],["IMNN","Imunon Inc.",8,12,0],["IMO","Imperial Oil Limited",106,41850,0],["IMOM","IMOM",1,0,0],["IMOS","ChipMOS TECHNOLOGIES INC.",6,1006,0],["IMPP","Imperial Petroleum Inc.",98,175,0],["IMPPP","Imperial Petroleum Inc. 8.75% Series A Cumulative Redeemable Perpetual",98,1189,0],["IMRA","IMRA",1,0,0],["IMRN","Immuron Limited",8,6,0],["IMRX","Immuneering Corporation Class A",8,365,0],["IMSR","Terrestrial Energy Inc.",1,819,0],["IMST","IMST",1,0,0],["IMTB","IMTB",1,0,0],["IMTE","Integrated Media Technology Limited",133,2,0],["IMTM","IMTM",1,0,0],["IMTX","Immatics N.V.",13,1377,0],["IMUX","Immunic Inc.",8,69,0],["IMVT","Immunovant Inc.",13,5407,0],["IMXI","International Money Express Inc.",36,456,0],["INAB","IN8bio Inc.",13,6,0],["INAC","Indigo Acquisition Corp.",1,0,0],["INACU","Indigo Acquisition Corp. Unit",1,0,0],["INBK","First Internet Bancorp",26,188,0],["INBKZ","First Internet Bancorp 6.0% Fixed-to-Floating Rate Subordinated Notes Due 2029",26,216,0],["INBS","Intelligent Bio Solutions Inc.",31,6,0],["INBX","Inhibrx Biosciences Inc.",13,1253,0],["INCE","INCE",1,0,0],["INCM","INCM",1,0,0],["INCO","INCO",1,0,0],["INCR","Intercure Ltd.",8,74,0],["INCY","Incyte Corp.",14,20160,0],["IND","IND",1,0,0],["INDB","Independent Bank Corp.",26,3837,0],["INDE","INDE",1,0,0],["INDH","INDH",1,0,0],["INDI","indie Semiconductor Inc. Class A",6,832,0],["INDL","INDL",1,0,0],["INDO","Indonesia Energy Corporation Limited",59,40,0],["INDP","Indaptus Therapeutics Inc.",8,4,0],["INDS","INDS",1,0,0],["INDV","Indivior PLC",8,4393,0],["INDY","INDY",1,0,0],["INEO","INNEOVA Holdings Limited Class A",119,5,0],["INEQ","INEQ",1,0,0],["INFL","INFL",1,0,0],["INFO","INFO",1,0,0],["INFR","INFR",1,0,0],["INFU","InfuSystems Holdings Inc.",31,187,0],["INFY","Infosys Limited",15,83998,0],["ING","ING Group N.V.",75,87749,0],["INGM","Ingram Micro Holding Corporation",100,5270,0],["INGN","Inogen Inc",32,182,0],["INGR","Ingredion Incorporated",17,7019,0],["INHD","Inno Holdings Inc.",27,7,0],["INKM","INKM",1,0,0],["INKT","MiNK Therapeutics Inc.",13,98,0],["INLF","INLIF LIMITED Class A",7,8,0],["INLX","Intellinetics Inc.",25,36,0],["INM","InMed Pharmaceuticals Inc.",8,3,0],["INMB","INmune Bio Inc.",13,49,0],["INMD","InMode Ltd.",77,999,0],["INMU","INMU",1,0,0],["INN","Summit Hotel Properties Inc.",30,555,0],["INN/PE","INN/PE",1,0,0],["INN/PF","INN/PF",1,0,0],["INNV","InnovAge Holding Corp.",35,814,0],["INO","Inovio Pharmaceuticals Inc.",31,122,0],["INOD","Innodata Inc.",15,1689,0],["INOV","INOV",1,0,0],["INQQ","INQQ",1,0,0],["INR","Infinity Natural Resources Inc. Class A",59,883,0],["INRO","INRO",1,0,0],["INSE","Inspired Entertainment Inc.",25,244,0],["INSG","Inseego Corp.",33,164,0],["INSM","Insmed Incorporated",8,37289,0],["INSP","Inspire Medical Systems Inc.",31,2805,0],["INSW","International Seaways Inc.",98,2389,0],["INTA","Intapp Inc.",25,3765,0],["INTC","Intel Corporation",6,161161,0],["INTF","INTF",1,0,0],["INTG","Intergroup Corporation (The)",134,59,0],["INTJ","Intelligent Group Limited Class A",19,17,0],["INTR","Inter & Co. Inc. Class A",75,3619,0],["INTS","Intensity Therapeutics Inc.",13,25,0],["INTT","inTest Corporation",39,91,0],["INTU","Intuit Inc.",25,186890,0],["INTW","INTW",1,0,0],["INTZ","Intrusion Inc.",51,26,0],["INUV","Inuvo Inc.",58,39,0],["INV","Innventure Inc.",2,294,0],["INVA","Innoviva Inc.",8,1495,0],["INVE","Identiv Inc.",53,85,0],["INVG","INVG",1,0,0],["INVH","Invitation Homes Inc.",36,16582,0],["INVN","INVN",1,0,0],["INVX","Innovex International Inc.",88,1492,0],["INVZ","Innoviz Technologies Ltd.",42,235,0],["IOBT","IO Biotech Inc.",8,48,0],["IOCT","IOCT",1,0,0],["ION","ION",1,0,0],["IONL","IONL",1,0,0],["IONQ","IonQ Inc.",15,17175,0],["IONR","ioneer Ltd",74,297,0],["IONS","Ionis Pharmaceuticals Inc.",8,12888,0],["IONX","IONX",1,0,0],["IONZ","IONZ",1,0,0],["IOO","IOO",1,0,0],["IOPP","IOPP",1,0,0],["IOR","Income Opportunity Realty Investors Inc.",30,71,0],["IOSP","Innospec Inc.",34,1923,0],["IOT","Samsara Inc. Class A",15,22036,0],["IOTR","iOThree Limited",33,7,0],["IOVA","Iovance Biotherapeutics Inc.",13,984,0],["IOYY","IOYY",1,0,0],["IP","International Paper Company",138,20192,0],["IPAC","IPAC",1,0,0],["IPAR","Interparfums Inc.",90,2699,0],["IPAY","IPAY",1,0,0],["IPB","IPB",1,0,0],["IPCX","Inflection Point Acquisition Corp. III Class A",1,0,0],["IPCXU","IPCXU",1,0,0],["IPDN","Professional Diversity Network Inc.",16,8,0],["IPEX","Inflection Point Acquisition Corp. V Class A",8,0,0],["IPEXU","Inflection Point Acquisition Corp. V",2,0,0],["IPGP","IPG Photonics Corporation",6,3196,0],["IPHA","Innate Pharma S.A. ADS",13,161,0],["IPI","Intrepid Potash Inc",74,361,0],["IPKW","IPKW",1,0,0],["IPM","Intelligent Protection Management Corp.",36,16,0],["IPO","IPO",1,0,0],["IPOD","Dune Acquisition Corporation II Class A",2,0,0],["IPOS","IPOS",1,0,0],["IPSC","Century Therapeutics Inc.",13,79,0],["IPST","Heritage Distilling Holding Company Inc.",46,25,0],["IPW","iPower Inc.",130,13,0],["IPWR","Ideal Power Inc.",6,26,0],["IPX","IperionX Limited American",52,1058,0],["IQ","iQIYI Inc.",110,1781,0],["IQDF","IQDF",1,0,0],["IQDY","IQDY",1,0,0],["IQHI","IQHI",1,0,0],["IQI","Invesco Quality Municipal Income Trust",116,527,0],["IQLT","IQLT",1,0,0],["IQQQ","IQQQ",1,0,0],["IQRA","IQRA",1,0,0],["IQSI","IQSI",1,0,0],["IQSM","IQSM",1,0,0],["IQST","iQSTEL Inc.",33,13,0],["IQSU","IQSU",1,0,0],["IQSZ","IQSZ",1,0,0],["IQV","IQVIA Holdings Inc.",14,37584,0],["IR","Ingersoll Rand Inc.",7,31324,0],["IRBT","iRobot Corporation",133,15,0],["IRD","Opus Genetics Inc.",8,138,0],["IRDM","Iridium Communications Inc",33,1785,0],["IRE","IRE",1,0,0],["IREG","IREG",1,0,0],["IREN","IREN Limited",15,13107,0],["IRET","IRET",1,0,0],["IRHOU","Iron Horse Acquisitions II Corp.",2,0,0],["IRIX","IRIDEX Corporation",77,17,0],["IRM","Iron Mountain Incorporated (Delaware)Common Stock REIT",30,23674,0],["IRMD","iRadimed Corporation",31,1236,0],["IRON","Disc Medicine Inc.",8,3022,0],["IROQ","IF Bancorp Inc.",84,90,0],["IRS","IRSA Inversiones Y Representaciones S.A. Global",121,1186,0],["IRT","Independence Realty Trust Inc.",30,4015,0],["IRTC","iRhythm Technologies Inc.",31,5612,0],["IRTR","IRTR",1,0,0],["IRVH","IRVH",1,0,0],["IRWD","Ironwood Pharmaceuticals Inc. Class A",8,509,0],["ISBA","Isabella Bank Corporation",26,415,0],["ISCB","ISCB",1,0,0],["ISCF","ISCF",1,0,0],["ISCG","ISCG",1,0,0],["ISCV","ISCV",1,0,0],["ISD","PGIM High Yield Bond Fund Inc.",81,0,0],["ISEP","ISEP",1,0,0],["ISHG","ISHG",1,0,0],["ISHP","ISHP",1,0,0],["ISMD","ISMD",1,0,0],["ISOU","IsoEnergy Ltd.",1,461,0],["ISPC","iSpecimen Inc.",14,4,0],["ISPO","Inspirato Incorporated Class A",2,53,0],["ISPR","Ispire Technology Inc.",18,167,0],["ISRA","ISRA",1,0,0],["ISRG","Intuitive Surgical Inc.",32,202938,0],["ISSC","Innovative Solutions and Support Inc.",15,293,0],["ISTB","ISTB",1,0,0],["ISTR","Investar Holding Corporation",26,269,0],["ISUL","ISUL",1,0,0],["ISWN","ISWN",1,0,0],["IT","Gartner Inc.",3,18074,0],["ITAN","ITAN",1,0,0],["ITDB","ITDB",1,0,0],["ITDC","ITDC",1,0,0],["ITDD","ITDD",1,0,0],["ITDE","ITDE",1,0,0],["ITDF","ITDF",1,0,0],["ITDG","ITDG",1,0,0],["ITDH","ITDH",1,0,0],["ITDI","ITDI",1,0,0],["ITDJ","ITDJ",1,0,0],["ITEQ","ITEQ",1,0,0],["ITGR","Integer Holdings Corporation",77,2753,0],["ITHAU","ITHAX Acquisition Corp III",1,0,0],["ITIC","Investors Title Company",28,480,0],["ITOT","ITOT",1,0,0],["ITP","IT Tech Packaging Inc.",125,4,0],["ITRG","Integra Resources Corp.",104,747,0],["ITRI","Itron Inc.",39,4408,0],["ITRM","Iterum Therapeutics plc",8,20,0],["ITRN","Ituran Location and Control Ltd.",76,857,0],["ITT","ITT Inc.",148,15001,0],["ITUB","Itau Unibanco Banco Holding SA",26,69606,0],["ITW","Illinois Tool Works Inc.",7,72566,0],["IUS","IUS",1,0,0],["IUSB","IUSB",1,0,0],["IUSG","IUSG",1,0,0],["IUSV","IUSV",1,0,0],["IVA","Inventiva S.A. American Depository Shares",8,403,0],["IVAL","IVAL",1,0,0],["IVDA","Iveda Solutions Inc.",25,6,0],["IVE","IVE",1,0,0],["IVES","IVES",1,0,0],["IVF","INVO Fertility Inc.",31,9,0],["IVLU","IVLU",1,0,0],["IVOG","IVOG",1,0,0],["IVOL","IVOL",1,0,0],["IVOO","IVOO",1,0,0],["IVOV","IVOV",1,0,0],["IVP","Inspire Veterinary Partners Inc. Class A",48,4,0],["IVR","INVESCO MORTGAGE CAPITAL INC",30,626,0],["IVR/PC","IVR/PC",1,0,0],["IVRS","IVRS",1,0,0],["IVSI","IVSI",1,0,0],["IVSS","IVSS",1,0,0],["IVT","InvenTrust Properties Corp.",30,2215,0],["IVV","IVV",1,0,0],["IVVD","Invivyd Inc.",13,536,0],["IVW","IVW",1,0,0],["IVZ","Invesco Ltd",11,12018,0],["IWB","IWB",1,0,0],["IWC","IWC",1,0,0],["IWD","IWD",1,0,0],["IWDL","IWDL",1,0,0],["IWF","IWF",1,0,0],["IWFG","IWFG",1,0,0],["IWFL","IWFL",1,0,0],["IWL","IWL",1,0,0],["IWLG","IWLG",1,0,0],["IWM","IWM",1,0,0],["IWML","IWML",1,0,0],["IWMY","IWMY",1,0,0],["IWN","IWN",1,0,0],["IWO","IWO",1,0,0],["IWP","IWP",1,0,0],["IWR","IWR",1,0,0],["IWS","IWS",1,0,0],["IWV","IWV",1,0,0],["IWX","IWX",1,0,0],["IWY","IWY",1,0,0],["IX","ORIX Corporation",146,33540,0],["IXC","IXC",1,0,0],["IXG","IXG",1,0,0],["IXHL","Incannex Healthcare Inc.",8,152,0],["IXJ","IXJ",1,0,0],["IXN","IXN",1,0,0],["IXP","IXP",1,0,0],["IXUS","IXUS",1,0,0],["IYC","IYC",1,0,0],["IYE","IYE",1,0,0],["IYF","IYF",1,0,0],["IYG","IYG",1,0,0],["IYH","IYH",1,0,0],["IYK","IYK",1,0,0],["IYM","IYM",1,0,0],["IYR","IYR",1,0,0],["IYW","IYW",1,0,0],["IYY","IYY",1,0,0],["IZEA","IZEA Worldwide Inc.",58,79,0],["IZM","ICZOOM Group Inc. Class A",110,15,0],["J","Jacobs Solutions Inc.",21,15921,0],["JAAA","JAAA",1,0,0],["JABS","JABS",1,0,0],["JACK","Jack In The Box Inc.",68,367,0],["JACS","Jackson Acquisition Company II Class A",1,0,0],["JADE","JADE",1,0,0],["JAGX","Jaguar Health Inc.",8,4,0],["JAKK","JAKKS Pacific Inc.",61,193,0],["JAMF","Jamf Holding Corp.",25,1732,0],["JANT","JANT",1,0,0],["JANW","JANW",1,0,0],["JANX","Janux Therapeutics Inc.",8,829,0],["JAPN","JAPN",1,0,0],["JAVA","JAVA",1,0,0],["JAZZ","Jazz Pharmaceuticals plc",8,10147,0],["JBDI","JBDI Holdings Limited",1,18,0],["JBGS","JBG SMITH Properties",30,1019,0],["JBHT","J.B. Hunt Transport Services Inc.",63,18823,0],["JBI","Janus International Group Inc.",91,941,0],["JBIO","Jade Biosciences Inc.",8,783,0],["JBK","JBK",1,0,0],["JBL","Jabil Inc.",39,24211,0],["JBLU","JetBlue Airways Corporation",4,1746,0],["JBND","JBND",1,0,0],["JBS","JBS N.V. Class A",62,32163,0],["JBSS","John B. Sanfilippo & Son Inc.",93,862,0],["JBTM","JBT Marel Corporation",7,8024,0],["JCAP","Jefferson Capital Inc.",116,1316,0],["JCE","Nuveen Core Equity Alpha Fund",81,0,0],["JCHI","JCHI",1,0,0],["JCI","Johnson Controls International plc",7,73049,0],["JCSE","JE Cleantech Holdings Limited",69,6,0],["JCTC","Jewett-Cameron Trading Company",130,7,0],["JD","JD.com Inc.",66,41884,0],["JDIV","JDIV",1,0,0],["JDOC","JDOC",1,0,0],["JDST","JDST",1,0,0],["JDVI","JDVI",1,0,0],["JDVL","JDVL",1,0,0],["JDZG","JIADE LIMITED Class A",3,3,0],["JEDI","JEDI",1,0,0],["JEF","Jefferies Financial Group Inc.",60,12779,0],["JELD","JELD-WEN Holding Inc.",56,236,0],["JEM","707 Cayman Holdings Limited",120,4,0],["JEMB","JEMB",1,0,0],["JENA","Jena Acquisition Corporation II Class A",1,0,0],["JENA.U","JENA.U",1,0,0],["JEPI","JEPI",1,0,0],["JEPQ","JEPQ",1,0,0],["JETD","JETD",1,0,0],["JETS","JETS",1,0,0],["JETU","JETU",1,0,0],["JFB","JFB Construction Holdings Class A",136,435,0],["JFBR","Jeffs\' Brands Ltd",66,21,0],["JFIN","Jiayin Group Inc.",44,353,0],["JFLI","JFLI",1,0,0],["JFLX","JFLX",1,0,0],["JFR","Nuveen Floating Rate Income Fund",81,0,0],["JFU","9F Inc.",44,76,0],["JG","Aurora Mobile Limited",16,41,0],["JGH","Nuveen Global High Income Fund",11,0,0],["JGLO","JGLO",1,0,0],["JGRO","JGRO",1,0,0],["JGRW","JGRW",1,0,0],["JHAC","JHAC",1,0,0],["JHAI","JHAI",1,0,0],["JHCB","JHCB",1,0,0],["JHCP","JHCP",1,0,0],["JHCR","JHCR",1,0,0],["JHDV","JHDV",1,0,0],["JHEM","JHEM",1,0,0],["JHG","Janus Henderson Group plc",11,7109,0],["JHHY","JHHY",1,0,0],["JHI","John Hancock Investors Trust",81,118,0],["JHID","JHID",1,0,0],["JHLN","JHLN",1,0,0],["JHMB","JHMB",1,0,0],["JHMD","JHMD",1,0,0],["JHML","JHML",1,0,0],["JHMM","JHMM",1,0,0],["JHMU","JHMU",1,0,0],["JHPI","JHPI",1,0,0],["JHS","John Hancock Income Securities Trust",116,133,0],["JHSC","JHSC",1,0,0],["JHX","James Hardie Industries plc.",38,8816,0],["JIG","JIG",1,0,0],["JIII","JIII",1,0,0],["JILL","J. Jill Inc.",86,221,0],["JIRE","JIRE",1,0,0],["JIVE","JIVE",1,0,0],["JJSF","J & J Snack Foods Corp.",93,1788,0],["JKHY","Jack Henry & Associates Inc.",15,13354,0],["JKS","JinkoSolar Holding Company Limited",6,1453,0],["JL","J-Long Group Limited Class A",120,23,0],["JLHL","Julong Holding Limited Class A",21,77,0],["JLL","Jones Lang LaSalle Incorporated",36,15888,0],["JLQD","JLQD",1,0,0],["JLS","Nuveen Mortgage and Income Fund",11,0,0],["JMBS","JMBS",1,0,0],["JMEE","JMEE",1,0,0],["JMG","JM Group Limited",32,120,0],["JMHI","JMHI",1,0,0],["JMIA","Jumia Technologies AG",57,1581,0],["JMID","JMID",1,0,0],["JMM","Nuveen Multi-Market Income Fund (MA)",81,0,0],["JMMF","JMMF",1,0,0],["JMOM","JMOM",1,0,0],["JMSB","John Marshall Bancorp Inc.",26,303,0],["JMSI","JMSI",1,0,0],["JMTG","JMTG",1,0,0],["JNJ","Johnson & Johnson",8,497206,0],["JNK","JNK",1,0,0],["JNUG","JNUG",1,0,0],["JOB","GEE Group Inc.",12,21,0],["JOBY","Joby Aviation Inc.",50,12966,0],["JOE","St. Joe Company (The)",121,3540,0],["JOET","JOET",1,0,0],["JOF","Japan Smaller Capitalization Fund Inc",81,0,0],["JOJO","JOJO",1,0,0],["JOUT","Johnson Outdoors Inc. Class A",61,458,0],["JOYY","JOYY Inc.",15,3371,0],["JPAN","JPAN",1,0,0],["JPC","Nuveen Preferred & Income Opportunities Fund",11,0,0],["JPEF","JPEF",1,0,0],["JPEM","JPEM",1,0,0],["JPIE","JPIE",1,0,0],["JPIN","JPIN",1,0,0],["JPM","JP Morgan Chase & Co.",26,863529,0],["JPM/PC","JPM/PC",1,0,0],["JPM/PD","JPM/PD",1,0,0],["JPM/PJ","JPM/PJ",1,0,0],["JPM/PK","JPM/PK",1,0,0],["JPM/PL","JPM/PL",1,0,0],["JPM/PM","JPM/PM",1,0,0],["JPMB","JPMB",1,0,0],["JPME","JPME",1,0,0],["JPMO","JPMO",1,0,0],["JPRE","JPRE",1,0,0],["JPSE","JPSE",1,0,0],["JPST","JPST",1,0,0],["JPSV","JPSV",1,0,0],["JPUS","JPUS",1,0,0],["JPX","JPX",1,0,0],["JPXN","JPXN",1,0,0],["JPY","JPY",1,0,0],["JQC","Nuveen Credit Strategies Income Fund Shares of Beneficial Interest",116,0,0],["JQUA","JQUA",1,0,0],["JRE","JRE",1,0,0],["JRI","Nuveen Real Asset Income and Growth Fund",116,0,0],["JRS","Nuveen Real Estate Income Fund",123,0,0],["JRSH","Jerash Holdings (US) Inc.",86,37,0],["JRVR","James River Group Holdings Inc.",22,288,0],["JSCP","JSCP",1,0,0],["JSI","JSI",1,0,0],["JSM","Navient Corporation 6% Senior Notes due December 15 2043",60,1952,0],["JSMD","JSMD",1,0,0],["JSML","JSML",1,0,0],["JSPR","Jasper Therapeutics Inc.",13,52,0],["JSTC","JSTC",1,0,0],["JTAI","Jet.AI Inc.",87,7,0],["JTEK","JTEK",1,0,0],["JULT","JULT",1,0,0],["JULW","JULW",1,0,0],["JUNS","Jupiter Neurosciences Inc.",8,38,0],["JUNT","JUNT",1,0,0],["JUNW","JUNW",1,0,0],["JUSA","JUSA",1,0,0],["JUST","JUST",1,0,0],["JVA","Coffee Holding Co. Inc.",17,21,0],["JVAL","JVAL",1,0,0],["JWEL","Jowell Global Ltd.",3,5,0],["JXG","JX Luxventure Group Inc.",86,11,0],["JXI","JXI",1,0,0],["JXN","Jackson Financial Inc. Class A",5,7320,0],["JXN/PA","JXN/PA",1,0,0],["JYD","Jayud Global Logistics Limited Class A",105,10,0],["JYNT","The Joint Corp.",29,134,0],["JZ","Jianzhi Education Technology Group Company Limited American Depositary Shs",3,4,0],["JZXN","Jiuzi Holdings Inc.",97,5,0],["KAI","Kadant Inc",7,3403,0],["KALA","KALA BIO Inc.",8,12,0],["KALU","Kaiser Aluminum Corporation",55,1849,0],["KALV","KalVista Pharmaceuticals Inc.",8,770,0],["KAPA","Kairos Pharma Ltd.",8,18,0],["KAR","OPENLANE Inc.",97,3246,0],["KARO","Karooooo Ltd.",25,1449,0],["KARS","KARS",1,0,0],["KAT","KAT",1,0,0],["KAVL","Kaival Brands Innovations Group Inc.",3,2,0],["KB","KB Financial Group Inc",75,31958,0],["KBA","KBA",1,0,0],["KBAB","KBAB",1,0,0],["KBDC","Kayne Anderson BDC Inc.",1,1040,0],["KBDU","KBDU",1,0,0],["KBE","KBE",1,0,0],["KBH","KB Home",121,3717,0],["KBONU","Karbon Capital Partners Corp.",2,0,0],["KBR","KBR Inc.",21,5118,0],["KBSX","FST Corp.",61,53,0],["KBUF","KBUF",1,0,0],["KBWB","KBWB",1,0,0],["KBWD","KBWD",1,0,0],["KBWP","KBWP",1,0,0],["KBWR","KBWR",1,0,0],["KBWY","KBWY",1,0,0],["KC","Kingsoft Cloud Holdings Limited",25,3078,0],["KCAI","KCAI",1,0,0],["KCCA","KCCA",1,0,0],["KCE","KCE",1,0,0],["KCHV","Kochav Defense Acquisition Corp. Class A",1,0,0],["KCHVU","Kochav Defense Acquisition Corp.",1,0,0],["KCSH","KCSH",1,0,0],["KD","Kyndryl Holdings Inc.",15,6190,0],["KDEF","KDEF",1,0,0],["KDK","Kodiak AI Inc.",15,1870,0],["KDP","Keurig Dr Pepper Inc.",46,37891,0],["KDRN","KDRN",1,0,0],["KDVD","KDVD",1,0,0],["KE","Kimball Electronics Inc.",39,694,0],["KEAT","KEAT",1,0,0],["KELYA","Kelly Services Inc. Class A",19,311,0],["KELYB","Kelly Services Inc. Class B",19,316,0],["KEMQ","KEMQ",1,0,0],["KEMX","KEMX",1,0,0],["KEN","Kenon Holdings Ltd.",41,3351,0],["KEP","Korea Electric Power Corporation",41,21711,0],["KEQU","Kewaunee Scientific Corporation",23,110,0],["KEUA","KEUA",1,0,0],["KEX","Kirby Corporation",98,6013,0],["KEY","KeyCorp",26,22929,0],["KEY/PI","KEY/PI",1,0,0],["KEY/PJ","KEY/PJ",1,0,0],["KEY/PK","KEY/PK",1,0,0],["KEY/PL","KEY/PL",1,0,0],["KEYS","Keysight Technologies Inc.",7,34788,0],["KF","Korea Fund Inc. (The) New",11,0,0],["KFFB","Kentucky First Federal Bancorp",84,35,0],["KFII","K&F Growth Acquisition Corp. II Class A",1,0,0],["KFIIU","KFIIU",1,0,0],["KFRC","Kforce Inc.",19,556,0],["KFS","Kingsway Financial Services Inc.",22,371,0],["KFY","Korn Ferry",12,3563,0],["KG","Kestrel Group Ltd.",22,83,0],["KGC","Kinross Gold Corporation",104,34511,0],["KGEI","Kolibri Global Energy Inc.",59,134,0],["KGRN","KGRN",1,0,0],["KGS","Kodiak Gas Services Inc.",107,3147,0],["KHC","The Kraft Heinz Company",17,29011,0],["KHYB","KHYB",1,0,0],["KIDS","OrthoPediatrics Corp.",31,428,0],["KIDZ","Classover Holdings Inc. Class B",3,8,0],["KIE","KIE",1,0,0],["KIM","Kimco Realty Corporation (HC)",30,13537,0],["KIM/PL","KIM/PL",1,0,0],["KIM/PM","KIM/PM",1,0,0],["KIM/PN","KIM/PN",1,0,0],["KINS","Kingstone Companies Inc.",22,240,0],["KIO","KKR Income Opportunities Fund",11,0,0],["KITT","Nauticus Robotics Inc.",7,12,0],["KJD","KJD",1,0,0],["KKR","KKR & Co. Inc.",11,116420,0],["KKR/PD","KKR/PD",1,0,0],["KKRS","KKR Group Finance Co. IX LLC 4.625% Subordinated Notes due 2061",11,15554,0],["KKRT","KKR & Co. Inc. 6.875% Subordinated Notes due 2065",11,0,0],["KLAC","KLA Corporation",76,163671,0],["KLAG","KLAG",1,0,0],["KLAR","Klarna Group plc",44,22129,0],["KLC","KinderCare Learning Companies Inc.",3,536,0],["KLIC","Kulicke and Soffa Industries Inc.",6,2391,0],["KLIP","KLIP",1,0,0],["KLMN","KLMN",1,0,0],["KLMT","KLMT",1,0,0],["KLRS","Kalaris Therapeutics Inc.",13,171,0],["KLTO","Klotho Neurosciences Inc.",13,28,0],["KLTR","Kaltura Inc.",25,263,0],["KLXE","KLX Energy Services Holdings Inc.",20,28,0],["KLXY","KLXY",1,0,0],["KMB","Kimberly-Clark Corporation",125,33405,0],["KMDA","Kamada Ltd.",8,419,0],["KMI","Kinder Morgan Inc.",107,58934,0],["KMID","KMID",1,0,0],["KMLI","KMLI",1,0,0],["KMLM","KMLM",1,0,0],["KMPB","Kemper Corporation 5.875% Fixed-Rate Reset Junior Subordinated Debentures due 2062",22,1365,0],["KMPR","Kemper Corporation",22,2388,0],["KMRK","K-Tech Solutions Company Limited Class A",61,20,0],["KMT","Kennametal Inc.",7,2187,0],["KMTS","Kestra Medical Technologies Ltd.",31,1594,0],["KMX","CarMax Inc",97,5649,0],["KN","Knowles Corporation",133,1883,0],["KNCT","KNCT",1,0,0],["KNDI","Kandi Technologies Group Inc.",37,77,0],["KNF","Knife Riv Holding Co.",74,4163,0],["KNGZ","KNGZ",1,0,0],["KNO","KNO",1,0,0],["KNOP","KNOT Offshore Partners LP Common",98,359,0],["KNRG","KNRG",1,0,0],["KNRX","KNOREX LTD. Class A",16,44,0],["KNSA","Kiniksa Pharmaceuticals International plc Class A",8,3274,0],["KNSL","Kinsale Capital Group Inc.",22,9289,0],["KNTK","Kinetik Holdings Inc. Class A",107,5432,0],["KNX","Knight-Swift Transportation Holdings Inc.",63,8500,0],["KO","Coca-Cola Company (The)",46,301371,0],["KOD","Kodiak Sciences Inc",13,1559,0],["KODK","Eastman Kodak Company Common New",7,803,0],["KOF","Coca Cola Femsa S.A.B. de C.V. ",46,19950,0],["KOID","KOID",1,0,0],["KOKU","KOKU",1,0,0],["KOLD","KOLD",1,0,0],["KOMP","KOMP",1,0,0],["KOOL","KOOL",1,0,0],["KOP","Koppers Holdings Inc.",56,539,0],["KOPN","Kopin Corporation",6,443,0],["KORE","KORE Group Holdings Inc.",33,78,0],["KORP","KORP",1,0,0],["KORU","KORU",1,0,0],["KOS","Kosmos Energy Ltd.",59,475,0],["KOSS","Koss Corporation",133,40,0],["KOYN","CSLM Digital Asset Acquisition Corp III Class A",1,0,0],["KOYNU","CSLM Digital Asset Acquisition Corp III",1,0,0],["KPDD","KPDD",1,0,0],["KPHO","KPHO",1,0,0],["KPLT","Katapult Holdings Inc.",12,30,0],["KPRO","KPRO",1,0,0],["KPRX","Kiora Pharmaceuticals Inc. ",8,8,0],["KPTI","Karyopharm Therapeutics Inc.",8,118,0],["KQQQ","KQQQ",1,0,0],["KR","Kroger Company (The)",67,39496,0],["KRBN","KRBN",1,0,0],["KRC","Kilroy Realty Corporation",30,4560,0],["KRE","KRE",1,0,0],["KREF","KKR Real Estate Finance Trust Inc.",30,554,0],["KREF/PA","KREF/PA",1,0,0],["KRG","Kite Realty Group Trust",30,5142,0],["KRKR","36Kr Holdings Inc.",36,158,0],["KRMA","KRMA",1,0,0],["KRMD","KORU Medical Systems Inc.",31,269,0],["KRMN","Karman Holdings Inc.",21,9481,0],["KRNT","Kornit Digital Ltd.",7,652,0],["KRNY","Kearny Financial Corp",84,509,0],["KRO","Kronos Worldwide Inc",34,532,0],["KROP","KROP",1,0,0],["KROS","Keros Therapeutics Inc.",8,617,0],["KRP","Kimbell Royalty Partners Common",59,1226,0],["KRRO","Korro Bio Inc.",8,74,0],["KRSP","Rice Acquisition Corporation 3 Class A",1,0,0],["KRSP.U","KRSP.U",1,0,0],["KRT","Karat Packaging Inc.",64,459,0],["KRUS","Kura Sushi USA Inc. Class A",68,671,0],["KRYS","Krystal Biotech Inc.",13,6983,0],["KSA","KSA",1,0,0],["KSCP","Knightscope Inc. Class A",33,43,0],["KSPI","Joint Stock Company Kaspi.kz American Depository Shares",1,14683,0],["KSPY","KSPY",1,0,0],["KSS","Kohl\'s Corporation",113,2603,0],["KSTR","KSTR",1,0,0],["KT","KT Corporation",33,9155,0],["KTB","Kontoor Brands Inc.",118,3564,0],["KTCC","Key Tronic Corporation",39,28,0],["KTEC","KTEC",1,0,0],["KTF","DWS Municipal Income Trust",116,357,0],["KTH","Structures Products Cp 8% CorTS Issued by Peco Energy Cap Tr II",44,0,0],["KTN","Structured Products Corp 8.205% CorTS 8.205% Corporate Backed Trust Securities (CorTS)",44,0,0],["KTOS","Kratos Defense & Security Solutions Inc.",21,12729,0],["KTTA","Pasithea Therapeutics Corp.",8,26,0],["KULR","KULR Technology Group Inc.",39,145,0],["KURA","Kura Oncology Inc.",8,856,0],["KURE","KURE",1,0,0],["KVAC","Keen Vision Acquisition Corporation",1,0,0],["KVHI","KVH Industries Inc.",49,138,0],["KVLE","KVLE",1,0,0],["KVUE","Kenvue Inc.",135,32607,0],["KVYO","Klaviyo Inc. Series A",25,9647,0],["KW","Kennedy-Wilson Holdings Inc.",36,1339,0],["KWEB","KWEB",1,0,0],["KWIN","KWIN",1,0,0],["KWM","K Wave Media Ltd.",89,33,0],["KWR","Quaker Houghton",34,2513,0],["KXI","KXI",1,0,0],["KXIN","Kaixin Holdings",97,3,0],["KYIV","Kyivstar Group Ltd.",33,3244,0],["KYMR","Kymera Therapeutics Inc.",13,6613,0],["KYN","Kayne Anderson Energy Infrastructure Fund Inc.",123,1609,0],["KYTX","Kyverna Therapeutics Inc.",13,315,0],["KZIA","Kazia Therapeutics Limited",8,18,0],["KZR","Kezar Life Sciences Inc.",8,46,0],["L","Loews Corporation",22,22026,0],["LAB","Standard BioTools Inc.",71,627,0],["LABD","LABD",1,0,0],["LABU","LABU",1,0,0],["LAC","Lithium Americas Corp.",10,1442,0],["LACG","LACG",1,0,0],["LAD","Lithia Motors Inc.",97,8339,0],["LADR","Ladder Capital Corp Class A",30,1449,0],["LAES","SEALSQ Corp",6,439,0],["LAFA","LaFayette Acquisition Corp.",1,0,0],["LAFAU","LaFayette Acquisition Corp. Unit",1,0,0],["LAKE","Lakeland Industries Inc.",32,78,0],["LALT","LALT",1,0,0],["LAMR","Lamar Advertising Company Class A",30,12894,0],["LAND","Gladstone Land Corporation",30,328,0],["LANDM","Gladstone Land Corporation 5.00% Series D Cumulative Term",30,930,0],["LANDO","Gladstone Land Corporation 6.00% Series B Cumulative Redeemable",30,706,0],["LANDP","Gladstone Land Corporation 6.00% Series C Cumulative Redeemable",30,701,0],["LANV","Lanvin Group Holdings Limited",86,252,0],["LAR","Lithium Argentina AG",10,880,0],["LARK","Landmark Bancorp Inc.",26,174,0],["LASE","Laser Photonics Corporation",7,37,0],["LASR","nLIGHT Inc.",6,1915,0],["LATA","Galata Acquisition Corp. II Class A",2,0,0],["LAUR","Laureate Education Inc.",3,4985,0],["LAW","CS Disco Inc.",25,524,0],["LAYS","LAYS",1,0,0],["LAZ","Lazard Inc.",11,5601,0],["LAZR","Luminar Technologies Inc. Class A",42,47,0],["LB","LandBridge Company LLC Class A Shares Representing Limited Liability Company Interests",59,4046,0],["LBAY","LBAY",1,0,0],["LBGJ","Li Bang International Corporation Inc. Class A",7,12,0],["LBRDA","Liberty Broadband Corporation Class A",54,6862,0],["LBRDK","Liberty Broadband Corporation Class C",54,6854,0],["LBRDP","Liberty Broadband Corporation Series A Cumulative Redeemable",54,3534,0],["LBRT","Liberty Energy Inc. Class A",20,2831,0],["LBRX","LB Pharmaceuticals Inc",8,533,0],["LBTYA","Liberty Global Ltd. Class A",54,3765,0],["LBTYB","Liberty Global Ltd. Class B",54,3705,0],["LBTYK","Liberty Global Ltd. Class C",54,3748,0],["LC","LendingClub Corporation",44,2266,0],["LCCC","Lakeshore Acquisition III Corp.",2,0,0],["LCCCU","Lakeshore Acquisition III Corp. Unit",2,0,0],["LCDL","LCDL",1,0,0],["LCDS","LCDS",1,0,0],["LCFY","Locafy Limited",16,6,0],["LCID","Lucid Group Inc.",37,3832,0],["LCII","LCI Industries",42,2992,0],["LCLG","LCLG",1,0,0],["LCNB","LCNB Corporation",26,239,0],["LCR","LCR",1,0,0],["LCTD","LCTD",1,0,0],["LCTU","LCTU",1,0,0],["LCTX","Lineage Cell Therapeutics Inc.",13,387,0],["LCUT","Lifetime Brands Inc.",7,84,0],["LDEM","LDEM",1,0,0],["LDI","loanDepot Inc. Class A",44,750,0],["LDOS","Leidos Holdings Inc.",15,23612,0],["LDP","Cohen & Steers Limited Duration Preferred and Income Fund Inc.",116,0,0],["LDRC","LDRC",1,0,0],["LDRH","LDRH",1,0,0],["LDRI","LDRI",1,0,0],["LDRT","LDRT",1,0,0],["LDRX","LDRX",1,0,0],["LDSF","LDSF",1,0,0],["LDUR","LDUR",1,0,0],["LDWY","Lendway Inc.",48,6,0],["LE","Lands\' End Inc.",120,457,0],["LEA","Lear Corporation",42,6163,0],["LECO","Lincoln Electric Holdings Inc.",7,13396,0],["LEDS","SemiLEDS Corporation",6,15,0],["LEE","Lee Enterprises Incorporated",124,23,0],["LEG","Leggett & Platt Incorporated",73,1509,0],["LEGH","Legacy Housing Corporation",121,474,0],["LEGN","Legend Biotech Corporation",8,4026,0],["LEGR","LEGR",1,0,0],["LEGT","Legato Merger Corp. III",1,0,0],["LEGT.U","LEGT.U",1,0,0],["LEMB","LEMB",1,0,0],["LEN","Lennar Corporation Class A",121,27540,0],["LEN.B","LEN.B",1,0,0],["LENZ","LENZ Therapeutics Inc.",13,563,0],["LEO","BNY Mellon Strategic Municipals Inc.",81,393,0],["LESL","Leslie\'s Inc.",66,17,0],["LEU","Centrus Energy Corp. Class A",74,4767,0],["LEVI","Levi Strauss & Co Class A",86,8485,0],["LEXI","LEXI",1,0,0],["LEXX","Lexaria Bioscience Corp.",8,13,0],["LFACU","Leapfrog Acquisition Corporation",1,0,0],["LFCR","Lifecore Biomedical Inc.",8,301,0],["LFEQ","LFEQ",1,0,0],["LFGY","LFGY",1,0,0],["LFMD","LifeMD Inc.",35,155,0],["LFMDP","LifeMD Inc. 8.875% Series A Cumulative Perpetual",35,1009,0],["LFS","LEIFRAS Co. Ltd.",3,99,0],["LFSC","LFSC",1,0,0],["LFST","LifeStance Health Group Inc.",35,2742,0],["LFT","Lument Finance Trust Inc.",30,77,0],["LFT/PA","LFT/PA",1,0,0],["LFUS","Littelfuse Inc.",39,6350,0],["LFVN","Lifevantage Corporation",8,79,0],["LFWD","Lifeward Ltd.",32,12,0],["LGCB","Linkage Global Inc. Class A",57,22,0],["LGCF","LGCF",1,0,0],["LGCL","Lucas GC Limited",16,6,0],["LGCY","Legacy Education Inc.",3,132,0],["LGDX","LGDX",1,0,0],["LGH","LGH",1,0,0],["LGHL","Lion Group Holding Ltd. American",60,3,0],["LGHT","LGHT",1,0,0],["LGI","Lazard Global Total Return and Income Fund",1,0,0],["LGIH","LGI Homes Inc.",121,1026,0],["LGL","LGL Group Inc. (The)",7,31,0],["LGLV","LGLV",1,0,0],["LGN","Legence Corp. Class A",82,4651,0],["LGND","Ligand Pharmaceuticals Incorporated",8,3943,0],["LGO","Largo Inc.",74,78,0],["LGOV","LGOV",1,0,0],["LGPS","LogProstyle Inc.",121,24,0],["LGRO","LGRO",1,0,0],["LGVN","Longeveron Inc. Class A",8,12,0],["LH","Labcorp Holdings Inc.",23,20893,0],["LHAI","Linkhome Holdings Inc.",36,208,0],["LHSW","Lianhe Sowell International Group Ltd Class A",25,32,0],["LHX","L3Harris Technologies Inc.",7,53768,0],["LI","Li Auto Inc.",37,17990,0],["LICN","Lichen International Limited Class A",19,52,0],["LIDR","AEye Inc. Class A",42,105,0],["LIEN","Chicago Atlantic BDC Inc.",44,242,0],["LIF","Life360 Inc.",15,5062,0],["LII","Lennox International Inc.",7,17428,0],["LILA","Liberty Latin America Ltd. Class A",54,1598,0],["LILAK","Liberty Latin America Ltd. Class C",54,1608,0],["LIMN","Liminatus Pharma Inc. Class A",1,21,0],["LIN","Linde plc",34,196786,0],["LINC","Lincoln Educational Services Corporation",3,754,0],["LIND","Lindblad Expeditions Holdings Inc.",87,815,0],["LINE","Lineage Inc.",30,7792,0],["LINK","Interlink Electronics Inc.",53,57,0],["LINT","LINT",1,0,0],["LION","Lionsgate Studios Corp",89,2408,0],["LIQT","LiqTech International Inc.",7,18,0],["LIT","LIT",1,0,0],["LITB","LightInTheBox Holding Co. Ltd.",57,225,0],["LITE","Lumentum Holdings Inc.",33,26334,0],["LITL","LITL",1,0,0],["LITM","Snow Lake Resources Ltd.",52,32,0],["LITP","LITP",1,0,0],["LITS","Lite Strategy Inc.",8,53,0],["LIVE","Live Ventures Incorporated",66,48,0],["LIVN","LivaNova PLC",77,3430,0],["LIXT","Lixte Biotechnology Holdings Inc.",8,25,0],["LKFN","Lakeland Financial Corporation",26,1514,0],["LKQ","LKQ Corporation",119,7612,0],["LKSP","Lake Superior Acquisition Corp. Class A",1,0,0],["LKSPR","Lake Superior Acquisition Corp.",1,0,0],["LKSPU","Lake Superior Acquisition Corp.",1,0,0],["LLDR","LLDR",1,0,0],["LLY","Eli Lilly and Company",8,1012922,0],["LLYVA","Liberty Live Holdings Inc. Series A Liberty Live Group",45,7550,0],["LLYVK","Liberty Live Holdings Inc. Series C Liberty Live Group",45,7756,0],["LLYX","LLYX",1,0,0],["LLYZ","LLYZ",1,0,0],["LMAT","LeMaitre Vascular Inc.",31,1927,0],["LMB","Limbach Holdings Inc.",82,912,0],["LMBO","LMBO",1,0,0],["LMBS","LMBS",1,0,0],["LMFA","LM Funding America Inc.",44,7,0],["LMND","Lemonade Inc.",22,6174,0],["LMNR","Limoneira Co",48,265,0],["LMNX","LMNX",1,0,0],["LMRI","Lumexa Imaging Holdings Inc.",23,1678,0],["LMT","Lockheed Martin Corporation",21,109713,0],["LMTL","LMTL",1,0,0],["LMTS","LMTS",1,0,0],["LMUB","LMUB",1,0,0],["LNAI","Lunai Bioworks Inc.",8,34,0],["LNC","Lincoln National Corporation",5,8777,0],["LNC/PD","LNC/PD",1,0,0],["LND","Brasilagro Brazilian Agric Real Estate Co Sponsored ADR (Brazil)",48,368,0],["LNG","Cheniere Energy Inc.",140,40843,0],["LNGX","LNGX",1,0,0],["LNKB","LINKBANCORP Inc.",26,325,0],["LNKS","Linkers Industries Limited Class A",39,4,0],["LNN","Lindsay Corporation",7,1303,0],["LNSR","LENSAR Inc.",31,143,0],["LNT","Alliant Energy Corporation",129,16613,0],["LNTH","Lantheus Holdings Inc.",24,4371,0],["LNZA","LanzaTech Global Inc.",34,31,0],["LOAN","Manhattan Bridge Capital Inc",30,57,0],["LOAR","Loar Holdings Inc.",21,6321,0],["LOB","Live Oak Bancshares Inc.",26,1672,0],["LOB/PA","LOB/PA",1,0,0],["LOBO","LOBO TECHNOLOGIES LTD. Class A",119,10,0],["LOCL","Local Bounti Corporation",48,66,0],["LOCO","El Pollo Loco Holdings Inc.",68,325,0],["LODE","Comstock Inc.",34,189,0],["LODI","LODI",1,0,0],["LOGI","Logitech International S.A.",53,15314,0],["LOGO","LOGO",1,0,0],["LOKV","Live Oak Acquisition Corp. V Class A",1,0,0],["LOKVU","LOKVU",1,0,0],["LOMA","Loma Negra Compania Industrial Argentina Sociedad Anonima ADS",38,1473,0],["LONZ","LONZ",1,0,0],["LOOP","Loop Industries Inc.",34,46,0],["LOPE","Grand Canyon Education Inc.",3,4641,0],["LOPP","LOPP",1,0,0],["LOT","Lotus Technology Inc.",37,909,0],["LOTI","LOTI",1,0,0],["LOUP","LOUP",1,0,0],["LOVE","The Lovesac Company",66,212,0],["LOW","Lowe\'s Companies Inc.",130,134875,0],["LOWV","LOWV",1,0,0],["LPA","Logistic Properties of the Americas",36,108,0],["LPAA","Launch One Acquisition Corp. Class A",1,0,0],["LPAAU","LPAAU",1,0,0],["LPBB","Launch Two Acquisition Corp. Class A",1,0,0],["LPBBU","Launch Two Acquisition Corp. Unit",2,0,0],["LPCN","Lipocine Inc.",8,24,0],["LPCVU","Launchpad Cadenza Acquisition Corp I Unit",2,0,0],["LPG","Dorian LPG Ltd.",98,1051,0],["LPL","LG Display Co Ltd AMERICAN DEPOSITORY SHARES",7,4150,0],["LPLA","LPL Financial Holdings Inc.",60,29010,0],["LPRE","LPRE",1,0,0],["LPRO","Open Lending Corporation",44,190,0],["LPSN","LivePerson Inc.",25,50,0],["LPTH","LightPath Technologies Inc. Class A",6,407,0],["LPX","Louisiana-Pacific Corporation",56,5628,0],["LQAI","LQAI",1,0,0],["LQD","LQD",1,0,0],["LQDA","Liquidia Corporation",8,3004,0],["LQDB","LQDB",1,0,0],["LQDH","LQDH",1,0,0],["LQDT","Liquidity Services Inc.",36,966,0],["LQIG","LQIG",1,0,0],["LQPE","LQPE",1,0,0],["LQTI","LQTI",1,0,0],["LRCX","Lam Research Corporation",7,216376,0],["LRE","Lead Real Estate Co. Ltd",121,19,0],["LRGC","LRGC",1,0,0],["LRGE","LRGE",1,0,0],["LRGF","LRGF",1,0,0],["LRGG","LRGG",1,0,0],["LRHC","La Rosa Holdings Corp.",36,1,0],["LRMR","Larimar Therapeutics Inc.",8,312,0],["LRN","Stride Inc.",3,2898,0],["LRND","LRND",1,0,0],["LRNZ","LRNZ",1,0,0],["LSAF","LSAF",1,0,0],["LSAK","Lesaka Technologies Inc.",60,373,0],["LSAT","LSAT",1,0,0],["LSBK","Lake Shore Bancorp Inc.",84,116,0],["LSCC","Lattice Semiconductor Corporation",6,10301,0],["LSE","Leishen Energy Holding Co. Ltd.",88,72,0],["LSEQ","LSEQ",1,0,0],["LSF","Laird Superfood Inc.",17,24,0],["LSGR","LSGR",1,0,0],["LSH","Lakeside Holding Limited",1,16,0],["LSPD","Lightspeed Commerce Inc. Subordinate Voting Shares",25,1634,0],["LST","LST",1,0,0],["LSTA","Lisata Therapeutics Inc.",137,18,0],["LSTR","Landstar System Inc.",63,4972,0],["LSVD","LSVD",1,0,0],["LTBR","Lightbridge Corporation",19,457,0],["LTC","LTC Properties Inc.",30,1628,0],["LTCC","Canary Litecoin ETF Shares of Beneficial Interest",60,7,0],["LTH","Life Time Group Holdings Inc.",47,5830,0],["LTL","LTL",1,0,0],["LTM","LATAM Airlines Group S.A.",4,16592,0],["LTPZ","LTPZ",1,0,0],["LTRN","Lantern Pharma Inc.",8,36,0],["LTRX","Lantronix Inc.",51,219,0],["LTTI","LTTI",1,0,0],["LU","Lufax Holding Ltd",44,2314,0],["LUCD","Lucid Diagnostics Inc.",31,154,0],["LUCK","Lucky Strike Entertainment Corporation Class A",45,1257,0],["LUCY","Innovative Eyewear Inc.",111,7,0],["LUD","Luda Technology Group Limited",27,165,0],["LULG","LULG",1,0,0],["LULU","lululemon athletica inc.",86,23498,0],["LUMN","Lumen Technologies Inc.",33,8400,0],["LUNG","Pulmonx Corporation",31,107,0],["LUNR","Intuitive Machines Inc. Class A",7,2692,0],["LUV","Southwest Airlines Company",4,21338,0],["LUXE","LuxExperience B.V.",57,1229,0],["LVHD","LVHD",1,0,0],["LVLN","LVLN",1,0,0],["LVLU","Lulu\'s Fashion Lounge Holdings Inc.",57,15,0],["LVO","LiveOne Inc.",68,55,0],["LVRO","Lavoro Limited Class A",66,71,0],["LVS","Las Vegas Sands Corp.",47,45267,0],["LVWR","LiveWire Group Inc.",119,977,0],["LW","Lamb Weston Holdings Inc.",17,6123,0],["LWAC","LightWave Acquisition Corp. Class A",1,0,0],["LWAY","Lifeway Foods Inc.",17,360,0],["LWLG","Lightwave Logic Inc.",125,400,0],["LX","LexinFintech Holdings Ltd.",44,555,0],["LXEH","Lixiang Education Holding Co. Ltd.",3,5,0],["LXEO","Lexeo Therapeutics Inc.",13,755,0],["LXFR","Luxfer Holdings PLC",34,368,0],["LXP","LXP Industrial Trust",30,2998,0],["LXP/PC","LXP/PC",1,0,0],["LXRX","Lexicon Pharmaceuticals Inc.",8,425,0],["LXU","LSB Industries Inc.",34,624,0],["LYB","LyondellBasell Industries NV",34,13870,0],["LYEL","Lyell Immunopharma Inc.",8,707,0],["LYFT","Lyft Inc. Class A",36,7755,0],["LYG","Lloyds Banking Group Plc",75,77514,0],["LYRA","Lyra Therapeutics Inc.",31,6,0],["LYTS","LSI Industries Inc.",91,575,0],["LYV","Live Nation Entertainment Inc.",45,33122,0],["LZ","LegalZoom.com Inc.",15,1810,0],["LZB","La-Z-Boy Incorporated",73,1625,0],["LZM","Lifezone Metals Limited",10,320,0],["LZMH","LZ Technology Holdings Limited Class B",15,225,0],["M","Macy\'s Inc",113,6336,0],["MA","Mastercard Incorporated",36,513860,0],["MAA","Mid-America Apartment Communities Inc.",30,15716,0],["MAA/PI","MAA/PI",1,0,0],["MAAS","Maase Inc. Class A",11,1589,0],["MAAY","MAAY",1,0,0],["MAC","Macerich Company (The)",30,4771,0],["MACI","Melar Acquisition Corp. I Class A",1,0,0],["MADE","MADE",1,0,0],["MAGG","MAGG",1,0,0],["MAGN","Magnera Corporation",138,532,0],["MAIA","MAIA Biotechnology Inc.",8,45,0],["MAIN","Main Street Capital Corporation",123,5391,0],["MAKX","MAKX",1,0,0],["MAMA","Mama\'s Creations Inc.",93,572,0],["MAMO","Massimo Group",32,220,0],["MAN","ManpowerGroup",19,1382,0],["MANH","Manhattan Associates Inc.",25,10596,0],["MANI","MANI",1,0,0],["MANU","Manchester United Ltd. Class A",45,2735,0],["MAPP","MAPP",1,0,0],["MAPS","WM Technology Inc. Class A",25,146,0],["MAR","Marriott International Class A",47,83232,0],["MARA","MARA Holdings Inc.",15,3850,0],["MARB","MARB",1,0,0],["MARO","MARO",1,0,0],["MARPS","Marine Petroleum Trust",59,9,0],["MART","MART",1,0,0],["MARW","MARW",1,0,0],["MAS","Masco Corporation",32,13317,0],["MASI","Masimo Corporation",77,7200,0],["MASK","3 E Network Technology Group Ltd Class A",15,4,0],["MASS","908 Devices Inc.",7,211,0],["MAT","Mattel Inc.",61,6238,0],["MATE","MATE",1,0,0],["MATH","Metalpha Technology Holding Limited",123,96,0],["MATV","Mativ Holdings Inc.",138,683,0],["MATW","Matthews International Corporation Class A",55,801,0],["MATX","Matson Inc.",98,3888,0],["MAVF","MAVF",1,0,0],["MAX","MediaAlpha Inc. Class A",36,834,0],["MAXI","MAXI",1,0,0],["MAXN","Maxeon Solar Technologies Ltd.",6,57,0],["MAYS","J. W. Mays Inc.",134,76,0],["MAYT","MAYT",1,0,0],["MAYW","MAYW",1,0,0],["MAZE","Maze Therapeutics Inc.",13,2007,0],["MB","MasterBeef Group",68,104,0],["MBAI","Check-Cap Ltd.",132,11,0],["MBAV","M3-Brigade Acquisition V Corp. Class A",1,0,0],["MBB","MBB",1,0,0],["MBBC","Marathon Bancorp Inc.",43,35,0],["MBC","MasterBrand Inc.",73,1421,0],["MBCN","Middlefield Banc Corp.",26,290,0],["MBI","MBIA Inc.",22,365,0],["MBIN","Merchants Bancorp",26,1611,0],["MBINL","Merchants Bancorp",26,1066,0],["MBINM","Merchants Bancorp",26,1161,0],["MBINN","Merchants Bancorp",26,860,0],["MBIO","Mustang Bio Inc.",8,8,0],["MBLY","Mobileye Global Inc. Class A",25,2201,0],["MBNKO","Medallion Bank Fixed-Rate Reset Non-Cumulative Perpetual",75,25,0],["MBOT","Microbot Medical Inc.",13,140,0],["MBOX","MBOX",1,0,0],["MBRX","Moleculin Biotech Inc.",8,8,0],["MBS","MBS",1,0,0],["MBSD","MBSD",1,0,0],["MBSF","MBSF",1,0,0],["MBSX","MBSX",1,0,0],["MBUU","Malibu Boats Inc. Class A",98,566,0],["MBVI","M3-Brigade Acquisition VI Corp. Class A",1,0,0],["MBVIU","M3-Brigade Acquisition VI Corp.",2,0,0],["MBWM","Mercantile Bank Corporation",26,805,0],["MBX","MBX Biosciences Inc.",8,1366,0],["MC","Moelis & Company Class A",11,5485,0],["MCB","Metropolitan Bank Holding Corp.",26,832,0],["MCBS","MetroCity Bankshares Inc.",26,713,0],["MCD","McDonald\'s Corporation",68,224927,0],["MCDS","MCDS",1,0,0],["MCFT","MasterCraft Boat Holdings Inc.",98,321,0],["MCGA","Yorkville Acquisition Corp. Class A",41,0,0],["MCGAU","Yorkville Acquisition Corp. Unit",2,0,0],["MCH","MCH",1,0,0],["MCHB","Mechanics Bancorp Class A",26,3135,0],["MCHI","MCHI",1,0,0],["MCHP","Microchip Technology Incorporated",6,35080,0],["MCHPP","Microchip Technology Incorporated",6,32038,0],["MCHS","MCHS",1,0,0],["MCHX","Marchex Inc. Class B",25,74,0],["MCI","Barings Corporate Investors",81,393,0],["MCK","McKesson Corporation",112,101241,0],["MCN","XAI Madison Equity Premium Income Fund",1,0,0],["MCO","Moody\'s Corporation",44,89749,0],["MCR","MFS Charter Income Trust",81,275,0],["MCRB","Seres Therapeutics Inc.",8,136,0],["MCRI","Monarch Casino & Resort Inc.",47,1818,0],["MCRP","Micropolis AI Robotics",42,46,0],["MCS","Marcus Corporation (The)",89,471,0],["MCSE","MCSE",1,0,0],["MCW","Mister Car Wash Inc.",79,1880,0],["MCY","Mercury General Corporation",22,5185,0],["MD","Pediatrix Medical Group Inc.",126,1882,0],["MDAA","MDAA",1,0,0],["MDAI","Spectral AI Inc. Class A",31,48,0],["MDB","MongoDB Inc. Class A",25,35051,0],["MDBH","MDB Capital Holdings LLC Class A common",44,34,0],["MDCX","Medicus Pharma Ltd.",1,35,0],["MDGL","Madrigal Pharmaceuticals Inc.",8,13423,0],["MDIA","Mediaco Holding Inc. Class A",83,52,0],["MDIV","MDIV",1,0,0],["MDLN","Medline Inc. Class A",31,54772,0],["MDLZ","Mondelez International Inc. Class A",17,70325,0],["MDRR","Medalist Diversified REIT Inc.",30,14,0],["MDST","MDST",1,0,0],["MDT","Medtronic plc.",77,126445,0],["MDU","MDU Resources Group Inc.",74,3918,0],["MDV","Modiv Industrial Inc. Class C",30,152,0],["MDV/PA","MDV/PA",1,0,0],["MDWD","MediWound Ltd.",18,211,0],["MDXG","MiMedx Group Inc",8,1044,0],["MDXH","MDxHealth SA",23,156,0],["MDY","MDY",1,0,0],["MDYG","MDYG",1,0,0],["MDYV","MDYV",1,0,0],["MEC","Mayville Engineering Company Inc.",32,352,0],["MED","MEDIFAST INC",17,130,0],["MEDI","MEDI",1,0,0],["MEDP","Medpace Holdings Inc.",14,16010,0],["MEDX","MEDX",1,0,0],["MEG","Montrose Environmental Group Inc.",19,923,0],["MEGI","NYLI CBRE Global Infrastructure Megatrends Term Fund",11,0,0],["MEGL","Magic Empire Global Limited Class A",44,6,0],["MEHA","Functional Brands Inc.",18,4,0],["MEI","Methode Electronics Inc.",39,241,0],["MELI","MercadoLibre Inc.",36,101273,0],["MEM","MEM",1,0,0],["MEMA","MEMA",1,0,0],["MEME","MEME",1,0,0],["MEMS","MEMS",1,0,0],["MEMX","MEMX",1,0,0],["MENS","Jyong Biotech Ltd.",8,241,0],["MEOH","Methanex Corporation",34,3028,0],["MER/PK","MER/PK",1,0,0],["MERC","Mercer International Inc.",138,139,0],["MESHU","Meshflow Acquisition Corp.",1,0,0],["MESO","Mesoblast Limited",13,2496,0],["MET","MetLife Inc.",5,53746,0],["MET/PA","MET/PA",1,0,0],["MET/PE","MET/PE",1,0,0],["MET/PF","MET/PF",1,0,0],["META","Meta Platforms Inc. Class A",16,1660448,0],["METC","Ramaco Resources Inc. Class A",65,975,0],["METCB","Ramaco Resources Inc. Class B",65,686,0],["METCI","Ramaco Resources Inc. 8.250% Senior Notes due 2030",1,0,0],["METCZ","Ramaco Resources Inc. 8.375% Senior Notes due 2029",65,0,0],["METD","METD",1,0,0],["METL","METL",1,0,0],["METU","METU",1,0,0],["METV","METV",1,0,0],["MEXX","MEXX",1,0,0],["MFA","MFA Financial Inc.",30,994,0],["MFA/PB","MFA/PB",1,0,0],["MFA/PC","MFA/PC",1,0,0],["MFAN","MFA Financial Inc. 8.875% Senior Notes due 2029",30,2587,0],["MFAO","MFA Financial Inc. 9.000% Senior Notes due 2029",30,2601,0],["MFC","Manulife Financial Corporation",5,60929,0],["MFDX","MFDX",1,0,0],["MFEM","MFEM",1,0,0],["MFG","Mizuho Financial Group Inc. Sponosred ADR (Japan)",26,91845,0],["MFI","mF International Limited Class A",15,31,0],["MFIC","MidCap Financial Investment Corporation",123,1070,0],["MFIG","MFIG",1,0,0],["MFIN","Medallion Financial Corp.",44,252,0],["MFLX","MFLX",1,0,0],["MFM","MFS Municipal Income Trust",116,221,0],["MFMO","MFMO",1,0,0],["MFSB","MFSB",1,0,0],["MFSG","MFSG",1,0,0],["MFSI","MFSI",1,0,0],["MFSM","MFSM",1,0,0],["MFSV","MFSV",1,0,0],["MFUS","MFUS",1,0,0],["MFVL","MFVL",1,0,0],["MG","Mistras Group Inc",21,404,0],["MGA","Magna International Inc.",42,15536,0],["MGC","MGC",1,0,0],["MGEE","MGE Energy Inc",41,2879,0],["MGF","MFS Government Markets Income Trust",81,97,0],["MGIC","Magic Software Enterprises Ltd.",25,1291,0],["MGIH","Millennium Group International Holdings Limited",109,14,0],["MGK","MGK",1,0,0],["MGLD","The Marygold Companies Inc.",44,44,0],["MGM","MGM Resorts International",47,10202,0],["MGMT","MGMT",1,0,0],["MGN","Megan Holdings Limited",48,33,0],["MGNI","Magnite Inc.",16,2356,0],["MGNR","MGNR",1,0,0],["MGNX","MacroGenics Inc.",8,95,0],["MGOV","MGOV",1,0,0],["MGPI","MGP Ingredients Inc.",46,511,0],["MGR","Affiliated Managers Group Inc. 5.875% Junior Subordinated Notes due 2059",11,611,0],["MGRB","Affiliated Managers Group Inc. 4.750% Junior Subordinated Notes due 2060",11,498,0],["MGRC","McGrath RentCorp",12,2660,0],["MGRD","Affiliated Managers Group Inc. 4.200% Junior Subordinated Notes due 2061",11,450,0],["MGRE","Affiliated Managers Group Inc. 6.750% Junior Subordinated Notes due 2064",11,708,0],["MGRT","Mega Fortune Company Limited",15,100,0],["MGRX","Mangoceuticals Inc.",137,10,0],["MGTX","MeiraGTx Holdings plc",13,646,0],["MGV","MGV",1,0,0],["MGX","Metagenomi Inc.",13,66,0],["MGY","Magnolia Oil & Gas Corporation Class A",59,4083,0],["MGYR","Magyar Bancorp Inc.",84,115,0],["MH","McGraw Hill Inc.",109,3270,0],["MHD","Blackrock MuniHoldings Fund Inc.",60,1739,0],["MHF","Western Asset Municipal High Income Fund Inc.",123,0,0],["MHH","Mastech Digital Inc",19,85,0],["MHK","Mohawk Industries Inc.",73,6669,0],["MHLA","Maiden Holdings Ltd. 6.625% Notes due 2046",22,101,0],["MHN","Blackrock MuniHoldings New York Quality Fund Inc.",60,1528,0],["MHNC","Maiden Holdings North America Ltd. 7.75% Notes due 2043",22,122,0],["MHO","M/I Homes Inc.",121,3338,0],["MHY","MHY",1,0,0],["MI","NFT Limited Class A",66,21,0],["MIAX","Miami International Holdings Inc.",60,3634,0],["MICC","The Magnum Ice Cream Company N.V.",93,9723,0],["MID","MID",1,0,0],["MIDD","Middleby Corporation (The)",7,7437,0],["MIDE","MIDE",1,0,0],["MIDU","MIDU",1,0,0],["MIGI","Mawson Infrastructure Group Inc.",44,5,0],["MILN","MILN",1,0,0],["MIMI","Mint Incorporation Limited Class A",36,12,0],["MIN","MFS Intermediate Income Trust",81,300,0],["MIND","MIND Technology Inc.",7,71,0],["MINO","MINO",1,0,0],["MINT","MINT",1,0,0],["MINV","MINV",1,0,0],["MIR","Mirion Technologies Inc. Class A",7,5977,0],["MIRA","MIRA Pharmaceuticals Inc.",8,68,0],["MIRM","Mirum Pharmaceuticals Inc.",8,3995,0],["MISL","MISL",1,0,0],["MIST","Milestone Pharmaceuticals Inc.",8,183,0],["MITK","Mitek Systems Inc.",53,479,0],["MITN","AG Mortgage Investment Trust Inc. 9.500% Senior Notes due 2029",30,748,0],["MITP","AG Mortgage Investment Trust Inc. 9.500% Senior Notes due 2029",30,749,0],["MITQ","Moving iMage Technologies Inc.",7,6,0],["MITT","AG Mortgage Investment Trust Inc.",30,280,0],["MITT/PA","MITT/PA",1,0,0],["MITT/PB","MITT/PB",1,0,0],["MITT/PC","MITT/PC",1,0,0],["MIY","Blackrock MuniYield Michigan Quality Fund Inc.",60,1723,0],["MJ","MJ",1,0,0],["MJSC","MJSC",1,0,0],["MKAM","MKAM",1,0,0],["MKC","McCormick & Company Incorporated",17,18405,0],["MKC.V","MKC.V",1,0,0],["MKDW","MKDWELL Tech Inc.",133,28,0],["MKL","Markel Group Inc.",22,27322,0],["MKLY","McKinley Acquisition Corporation Class A",1,0,0],["MKLYU","McKinley Acquisition Corporation",2,0,0],["MKOR","MKOR",1,0,0],["MKSI","MKS Inc.",7,10718,0],["MKTN","MKTN",1,0,0],["MKTW","MarketWise Inc. Class A",25,244,0],["MKTX","MarketAxess Holdings Inc.",60,6646,0],["MKZR","MacKenzie Realty Capital Inc.",30,8,0],["MLAB","Mesa Laboratories Inc.",7,448,0],["MLAC","Mountain Lake Acquisition Corp. Class A",37,0,0],["MLACU","MLACU",1,0,0],["MLCI","Mount Logan Capital Inc.",11,108,0],["MLCO","Melco Resorts & Entertainment Limited",47,3400,0],["MLDR","MLDR",1,0,0],["MLEC","Moolec Science SA",2,1,0],["MLGO","MicroAlgo Inc. Class A",15,79,0],["MLI","Mueller Industries Inc.",55,12833,0],["MLKN","MillerKnoll Inc.",92,1245,0],["MLM","Martin Marietta Materials Inc.",74,38231,0],["MLP","Maui Land & Pineapple Company Inc.",36,334,0],["MLPA","MLPA",1,0,0],["MLPB","MLPB",1,0,0],["MLPD","MLPD",1,0,0],["MLPR","MLPR",1,0,0],["MLPX","MLPX",1,0,0],["MLR","Miller Industries Inc.",72,425,0],["MLSS","Milestone Scientific Inc.",32,25,0],["MLTX","MoonLake Immunotherapeutics Class A",8,860,0],["MLYS","Mineralys Therapeutics Inc.",8,2915,0],["MMA","Mixed Martial Arts Group Limited",3,15,0],["MMC","Marsh & McLennan Companies Inc.",28,90486,0],["MMCA","MMCA",1,0,0],["MMD","NYLI MacKay DefinedTerm Muni Opportunities Fund",11,0,0],["MMI","Marcus & Millichap Inc.",36,1066,0],["MMID","MMID",1,0,0],["MMIN","MMIN",1,0,0],["MMIT","MMIT",1,0,0],["MMKT","MMKT",1,0,0],["MMLG","MMLG",1,0,0],["MMLP","Martin Midstream Partners L.P. Limited Partnership",80,88,0],["MMM","3M Company",31,86037,0],["MMMA","MMMA",1,0,0],["MMS","Maximus Inc.",36,4798,0],["MMSC","MMSC",1,0,0],["MMSD","MMSD",1,0,0],["MMSI","Merit Medical Systems Inc.",31,5200,0],["MMT","MFS Multimarket Income Trust",81,277,0],["MMTM","MMTM",1,0,0],["MMTX","Miluna Acquisition Corp Class A",2,0,0],["MMTXU","Miluna Acquisition Corp",1,0,0],["MMU","Western Asset Managed Municipals Fund Inc.",11,0,0],["MMYT","MakeMyTrip Limited",87,9612,0],["MNA","MNA",1,0,0],["MNBD","MNBD",1,0,0],["MNDO","MIND C.T.I. Ltd.",15,24,0],["MNDR","Mobile-health Network Solutions Class A",25,2,0],["MNDY","monday.com Ltd.",25,7468,0],["MNKD","MannKind Corporation",8,1793,0],["MNMD","Mind Medicine (MindMed) Inc.",18,1251,0],["MNOV","Medicinova Inc",8,70,0],["MNPR","Monopar Therapeutics Inc.",8,459,0],["MNR","Mach Natural Resources LP Common",59,1876,0],["MNRO","Monro Inc.",79,628,0],["MNRS","MNRS",1,0,0],["MNSB","MainStreet Bancshares Inc.",26,165,0],["MNSBP","MainStreet Bancshares Inc.",26,190,0],["MNSO","MINISO Group Holding Limited",113,6127,0],["MNST","Monster Beverage Corporation",46,74508,0],["MNTK","Montauk Renewables Inc.",107,266,0],["MNTN","MNTN Inc. Class A",58,863,0],["MNTS","Momentus Inc. Class A",21,12,0],["MNY","MoneyHero Limited Class A",36,60,0],["MNZL","MNZL",1,0,0],["MO","Altria Group Inc.",18,97480,0],["MOB","Mobilicom Limited",50,66,0],["MOBX","Mobix Labs Inc. Class A",6,21,0],["MOD","Modine Manufacturing Company",42,7169,0],["MODD","Modular Medical Inc.",31,26,0],["MODG","Topgolf Callaway Brands Corp.",61,2243,0],["MODL","MODL",1,0,0],["MOFG","MidWestOne Financial Gp",26,836,0],["MOG.A","MOG.A",1,0,0],["MOG.B","MOG.B",1,0,0],["MOGO","Mogo Inc.",44,27,0],["MOGU","MOGU Inc.",36,21,0],["MOH","Molina Healthcare Inc",23,8414,0],["MOLN","Molecular Partners AG",13,177,0],["MOMO","Hello Group Inc.",25,1068,0],["MOO","MOO",1,0,0],["MOOD","MOOD",1,0,0],["MORN","Morningstar Inc.",11,8860,0],["MORT","MORT",1,0,0],["MOS","Mosaic Company (The)",85,7554,0],["MOTO","MOTO",1,0,0],["MOV","Movado Group Inc.",94,466,0],["MOVE","Movano Inc.",77,7,0],["MP","MP Materials Corp.",10,9565,0],["MPA","Blackrock MuniYield Pennsylvania Quality Fund",116,0,0],["MPAA","Motorcar Parts of America Inc.",42,252,0],["MPB","Mid Penn Bancorp",26,746,0],["MPC","Marathon Petroleum Corporation",106,50597,0],["MPG","MPG",1,0,0],["MPL","MPL",1,0,0],["MPLT","MapLight Therapeutics Inc.",8,932,0],["MPLX","MPLX LP Common",107,54616,0],["MPTI","M-tron Industries Inc.",7,154,0],["MPU","Mega Matrix Inc. Class A",12,75,0],["MPV","Barings Participation Investors",116,197,0],["MPW","Medical Properties Trust Inc.",30,3092,0],["MPWR","Monolithic Power Systems Inc.",6,44894,0],["MPX","Marine Products Corporation",98,319,0],["MQ","Marqeta Inc. Class A",25,2231,0],["MQQQ","MQQQ",1,0,0],["MQT","Blackrock MuniYield Quality Fund II Inc.",60,1488,0],["MQY","Blackrock MuniYield Quality Fund Inc.",60,1696,0],["MRAL","MRAL",1,0,0],["MRAM","Everspin Technologies Inc.",6,204,0],["MRBK","Meridian Corporation",26,206,0],["MRCC","Monroe Capital Corporation",11,141,0],["MRCY","Mercury Systems Inc",39,4186,0],["MREO","Mereo BioPharma Group plc",8,310,0],["MRK","Merck & Company Inc.",8,250908,0],["MRKR","Marker Therapeutics Inc.",8,21,0],["MRM","MEDIROM Healthcare Technologies Inc. American",3,17,0],["MRNA","Moderna Inc.",13,13205,0],["MRNO","Murano Global Investments PLC",47,67,0],["MRNY","MRNY",1,0,0],["MRP","Millrose Properties Inc. Class A",36,4884,0],["MRSK","MRSK",1,0,0],["MRSN","Mersana Therapeutics Inc.",8,145,0],["MRT","Marti Technologies Inc. Class A",96,170,0],["MRTN","Marten Transport Ltd.",63,934,0],["MRUS","Merus N.V.",8,7358,0],["MRVI","Maravai LifeSciences Holdings Inc. Class A",8,877,0],["MRVL","Marvell Technology Inc.",6,71317,0],["MRX","Marex Group plc",60,2755,0],["MS","Morgan Stanley",60,281276,0],["MS/PA","MS/PA",1,0,0],["MS/PE","MS/PE",1,0,0],["MS/PF","MS/PF",1,0,0],["MS/PI","MS/PI",1,0,0],["MS/PK","MS/PK",1,0,0],["MS/PL","MS/PL",1,0,0],["MS/PO","MS/PO",1,0,0],["MS/PP","MS/PP",1,0,0],["MS/PQ","MS/PQ",1,0,0],["MSA","MSA Safety Incorporated",32,6268,0],["MSAI","MultiSensor AI Holdings Inc.",76,23,0],["MSB","Mesabi Trust",104,452,0],["MSBI","Midland States Bancorp Inc.",26,465,0],["MSBIP","Midland States Bancorp Inc.",26,534,0],["MSC","Studio City International Holdings Limited",47,634,0],["MSCI","MSCI Inc.",36,42700,0],["MSD","Morgan Stanley Emerging Markets Debt Fund Inc.",81,0,0],["MSDD","MSDD",1,0,0],["MSDL","Morgan Stanley Direct Lending Fund",1,0,0],["MSEX","Middlesex Water Company",70,948,0],["MSFD","MSFD",1,0,0],["MSFL","MSFL",1,0,0],["MSFO","MSFO",1,0,0],["MSFT","Microsoft Corporation",25,3611541,0],["MSFU","MSFU",1,0,0],["MSGE","Madison Square Garden Entertainment Corp. Class A",45,2485,0],["MSGM","Motorsport Games Inc. Class A",25,18,0],["MSGS","Madison Square Garden Sports Corp. Class A",45,5928,0],["MSGY","Masonglory Limited",1,38,0],["MSI","Motorola Solutions Inc.",49,61620,0],["MSIF","MSC Income Fund Inc.",123,620,0],["MSLC","MSLC",1,0,0],["MSM","MSC Industrial Direct Company Inc.",7,4819,0],["MSN","Emerson Radio Corporation",133,9,0],["MSOS","MSOS",1,0,0],["MSOX","MSOX",1,0,0],["MSPR","MSP Recovery Inc. Class A",15,3,0],["MSS","Maison Solutions Inc. Class A",67,21,0],["MSSM","MSSM",1,0,0],["MST","MST",1,0,0],["MSTI","MSTI",1,0,0],["MSTP","MSTP",1,0,0],["MSTR","Strategy Inc",25,47362,0],["MSTX","MSTX",1,0,0],["MSTY","MSTY",1,0,0],["MSW","Ming Shing Group Holdings Limited",82,15,0],["MT","Arcelor Mittal NY Registry Shares NEW",27,34316,0],["MTA","Metalla Royalty & Streaming Ltd.",104,763,0],["MTB","M&T Bank Corporation",26,31633,0],["MTB/PH","MTB/PH",1,0,0],["MTB/PJ","MTB/PJ",1,0,0],["MTB/PK","MTB/PK",1,0,0],["MTBA","MTBA",1,0,0],["MTC","MMTec Inc.",25,86,0],["MTCH","Match Group Inc.",16,7795,0],["MTD","Mettler-Toledo International Inc.",71,28651,0],["MTDR","Matador Resources Company",59,5109,0],["MTEK","Maris-Tech Ltd.",33,10,0],["MTEN","Mingteng International Corporation Inc. Class A",91,68,0],["MTEST","MTEST",1,0,0],["MTEST.A","MTEST.A",1,0,0],["MTEX","Mannatech Incorporated",18,15,0],["MTG","MGIC Investment Corporation",22,6629,0],["MTGP","MTGP",1,0,0],["MTH","Meritage Homes Corporation",121,4688,0],["MTLS","Materialise NV",25,336,0],["MTN","Vail Resorts Inc.",45,5493,0],["MTNB","Matinas Biopharma Holdings Inc.",8,5,0],["MTR","Mesa Royalty Trust",59,8,0],["MTRN","Materion Corporation",32,2150,0],["MTRX","Matrix Service Company",82,330,0],["MTSI","MACOM Technology Solutions Holdings Inc.",6,13070,0],["MTUL","MTUL",1,0,0],["MTUS","Metallus Inc.",27,727,0],["MTVA","MetaVia Inc.",8,21,0],["MTW","Manitowoc Company Inc. (The)",72,463,0],["MTX","Minerals Technologies Inc.",34,1885,0],["MTYY","MTYY",1,0,0],["MTZ","MasTec Inc.",128,17215,0],["MU","Micron Technology Inc.",6,298486,0],["MUA","Blackrock MuniAssets Fund Inc",60,1602,0],["MUB","MUB",1,0,0],["MUC","Blackrock MuniHoldings California Quality Fund Inc. ",60,1599,0],["MUD","MUD",1,0,0],["MUE","Blackrock MuniHoldings Quality Fund II Inc.",60,1488,0],["MUFG","Mitsubishi UFJ Financial Group Inc.",75,189946,0],["MUJ","Blackrock MuniHoldings New Jersey Quality Fund Inc.",60,1803,0],["MULL","MULL",1,0,0],["MULT","MULT",1,0,0],["MUNA","MUNA",1,0,0],["MUNB","MUNB",1,0,0],["MUNC","MUNC",1,0,0],["MUND","MUND",1,0,0],["MUNI","MUNI",1,0,0],["MUNX","MUNX",1,0,0],["MUR","Murphy Oil Corporation",59,4508,0],["MUSA","Murphy USA Inc.",97,7585,0],["MUSE","MUSE",1,0,0],["MUSI","MUSI",1,0,0],["MUSQ","MUSQ",1,0,0],["MUST","MUST",1,0,0],["MUU","MUU",1,0,0],["MUX","McEwen Inc.",104,1054,0],["MVBF","MVB Financial Corp.",26,344,0],["MVF","Blackrock MuniVest Fund Inc.",60,1025,0],["MVIS","MicroVision Inc.",7,288,0],["MVLL","MVLL",1,0,0],["MVO","MV Oil Trust",59,14,0],["MVPA","MVPA",1,0,0],["MVPL","MVPL",1,0,0],["MVRL","MVRL",1,0,0],["MVST","Microvast Holdings Inc.",7,965,0],["MVT","Blackrock MuniVest Fund II Inc. ",60,1590,0],["MVV","MVV",1,0,0],["MWA","MUELLER WATER PRODUCTS",55,3829,0],["MWG","Multi Ways Holdings Limited Class A",69,8,0],["MWYN","Marwynn Holdings Inc.",103,17,0],["MX","Magnachip Semiconductor Corporation",6,98,0],["MXC","Mexco Energy Corporation",59,20,0],["MXCT","MaxCyte Inc.",14,160,0],["MXE","Mexico Equity and Income Fund Inc. (The)",116,0,0],["MXF","Mexico Fund Inc. (The)",81,0,0],["MXI","MXI",1,0,0],["MXL","MaxLinear Inc.",6,1540,0],["MYCF","MYCF",1,0,0],["MYCG","MYCG",1,0,0],["MYCH","MYCH",1,0,0],["MYCI","MYCI",1,0,0],["MYCJ","MYCJ",1,0,0],["MYCK","MYCK",1,0,0],["MYCL","MYCL",1,0,0],["MYCM","MYCM",1,0,0],["MYCN","MYCN",1,0,0],["MYCO","MYCO",1,0,0],["MYD","Blackrock MuniYield Fund Inc. ",60,1549,0],["MYE","Myers Industries Inc.",64,723,0],["MYFW","First Western Financial Inc.",26,254,0],["MYGN","Myriad Genetics Inc.",24,611,0],["MYI","Blackrock MuniYield Quality Fund III Inc",60,1613,0],["MYMF","MYMF",1,0,0],["MYMG","MYMG",1,0,0],["MYMH","MYMH",1,0,0],["MYMI","MYMI",1,0,0],["MYMJ","MYMJ",1,0,0],["MYMK","MYMK",1,0,0],["MYN","Blackrock MuniYield New York Quality Fund Inc.Common Stock",116,0,0],["MYND","Mynd.ai Inc.",3,24,0],["MYNZ","Mainz Biomed N.V.",8,13,0],["MYO","Myomo Inc.",32,36,0],["MYPS","PLAYSTUDIOS Inc. Class A",25,83,0],["MYRG","MYR Group Inc.",128,3433,0],["MYSE","Myseum Inc.",33,9,0],["MYSZ","My Size Inc.",25,3,0],["MYY","MYY",1,0,0],["MZTI","The Marzetti Company",17,4650,0],["MZZ","MZZ",1,0,0],["NA","Nano Labs Ltd Class A",6,89,0],["NAAS","NaaS Technology Inc.",66,8,0],["NABL","N-able Inc.",25,1424,0],["NAC","Nuveen California Quality Municipal Income Fund",11,0,0],["NACP","NACP",1,0,0],["NAD","Nuveen Quality Municipal Income Fund",11,0,0],["NAGE","Niagen Bioscience Inc.",18,520,0],["NAII","Natural Alternatives International Inc.",18,11,0],["NAIL","NAIL",1,0,0],["NAK","Northern Dynasty Minerals Ltd.",104,1221,0],["NAKA","Kindly MD Inc.",35,173,0],["NAMI","Jinxin Technology Holding Company",3,46,0],["NAMM","Namib Minerals",104,75,0],["NAMS","NewAmsterdam Pharma Company N.V.",8,3981,0],["NAN","Nuveen New York Quality Municipal Income Fund",11,3401,0],["NANR","NANR",1,0,0],["NAT","Nordic American Tankers Limited",98,714,0],["NATH","Nathan\'s Famous Inc.",68,392,0],["NATL","NCR Atleos Corporation",92,2876,0],["NATO","NATO",1,0,0],["NATR","Nature\'s Sunshine Products Inc.",8,389,0],["NAUT","Nautilus Biotechnology Inc.",71,245,0],["NAVI","Navient Corporation",60,1275,0],["NAVN","Navan Inc. Class A",25,3757,0],["NAZ","Nuveen Arizona Quality Municipal Income Fund",123,0,0],["NB","NioCorp Developments Ltd.",10,684,0],["NBB","Nuveen Taxable Municipal Income Fund",116,0,0],["NBBK","NB Bancorp Inc.",43,842,0],["NBCE","NBCE",1,0,0],["NBCM","NBCM",1,0,0],["NBCR","NBCR",1,0,0],["NBDS","NBDS",1,0,0],["NBET","NBET",1,0,0],["NBFC","NBFC",1,0,0],["NBGX","NBGX",1,0,0],["NBH","Neuberger Municipal Fund Inc.",123,0,0],["NBHC","National Bank Holdings Corporation",26,1513,0],["NBIG","NBIG",1,0,0],["NBIL","NBIL",1,0,0],["NBIS","Nebius Group N.V. Class A",16,21301,0],["NBIX","Neurocrine Biosciences Inc.",13,14457,0],["NBJP","NBJP",1,0,0],["NBN","Northeast Bank",26,871,0],["NBOS","NBOS",1,0,0],["NBP","NovaBridge Biosciences",8,341,0],["NBR","Nabors Industries Ltd.",59,746,0],["NBSD","NBSD",1,0,0],["NBSM","NBSM",1,0,0],["NBTB","NBT Bancorp Inc.",26,2276,0],["NBTR","NBTR",1,0,0],["NBTX","Nanobiotix S.A.",8,1050,0],["NBXG","Neuberger Next Generation Connectivity Fund Inc.",81,0,0],["NBY","NovaBay Pharmaceuticals Inc.",8,668,0],["NC","NACCO Industries Inc.",65,367,0],["NCA","Nuveen California Municipal Value Fund",11,0,0],["NCDL","Nuveen Churchill Direct Lending Corp.",1,695,0],["NCEL","NewcelX Ltd.",8,12,0],["NCEW","New Century Logistics (BVI) Limited",105,14,0],["NCI","Neo-Concept International Group Holdings Limited Class A",86,6,0],["NCIQ","NCIQ",1,0,0],["NCL","Northann Corp.",64,6,0],["NCLH","Norwegian Cruise Line Holdings Ltd.",98,10489,0],["NCLO","NCLO",1,0,0],["NCMI","National CineMedia Inc.",58,362,0],["NCNA","NuCana plc American",8,7,0],["NCNO","nCino Inc.",25,2945,0],["NCPB","NCPB",1,0,0],["NCPL","Netcapital Inc.",44,6,0],["NCRA","Nocera Inc.",48,267,0],["NCSM","NCS Multistage Holdings Inc.",20,101,0],["NCT","Intercont (Cayman) Limited",68,24,0],["NCTY","The9 Limited American Depository Shares",44,116,0],["NCV","Virtus Convertible & Income Fund",116,1377,0],["NCV/PA","NCV/PA",1,0,0],["NCZ","Virtus Convertible & Income Fund II",116,1058,0],["NCZ/PA","NCZ/PA",1,0,0],["NDAA","NDAA",1,0,0],["NDAQ","Nasdaq Inc.",60,54450,0],["NDIA","NDIA",1,0,0],["NDIV","NDIV",1,0,0],["NDLS","Noodles & Company Class A",68,31,0],["NDMO","Nuveen Dynamic Municipal Opportunities Fund",81,593,0],["NDRA","ENDRA Life Sciences Inc.",77,6,0],["NDSN","Nordson Corporation",7,13419,0],["NDVG","NDVG",1,0,0],["NE","Noble Corporation plc A",59,4443,0],["NEA","Nuveen AMT-Free Quality Municipal Income Fund",123,0,0],["NECB","NorthEast Community Bancorp Inc.",43,324,0],["NEE","NextEra Energy Inc.",15,165651,0],["NEE/PN","NEE/PN",1,0,0],["NEE/PS","NEE/PS",1,0,0],["NEE/PT","NEE/PT",1,0,0],["NEE/PU","NEE/PU",1,0,0],["NEGG","Newegg Commerce Inc.",66,1059,0],["NEM","Newmont Corporation",104,110534,0],["NEMD","NEMD",1,0,0],["NEMG","NEMG",1,0,0],["NEN","New England Realty Associates Limited Partnership Class A Depositary Receipts Evidencing",134,180,0],["NEO","NeoGenomics Inc.",139,1531,0],["NEOG","Neogen Corporation",24,1565,0],["NEON","Neonode Inc.",7,34,0],["NEOV","NeoVolta Inc.",7,113,0],["NEPH","Nephros Inc.",31,53,0],["NERV","Minerva Neurosciences Inc",8,28,0],["NESR","National Energy Services Reunited Corp",20,1414,0],["NET","Cloudflare Inc. Class A",25,68543,0],["NETG","NETG",1,0,0],["NETL","NETL",1,0,0],["NEU","NewMarket Corp",34,6854,0],["NEUP","Neuphoria Therapeutics Inc.",8,21,0],["NEWP","New Pacific Metals Corp.",104,657,0],["NEWT","NewtekOne Inc.",26,353,0],["NEWTG","NewtekOne Inc. 8.50% Fixed Rate Senior Notes due 2029",26,660,0],["NEWTH","NewtekOne Inc. 8.625% Fixed Rate Senior Notes due 2029",26,0,0],["NEWTI","NewtekOne Inc. 8.00% Fixed Rate Senior Notes due 2028",26,663,0],["NEWTP","NewtekOne Inc.",26,672,0],["NEWTZ","NewtekOne Inc. 5.50% Notes Due 2026",26,652,0],["NEWZ","NEWZ",1,0,0],["NEXA","Nexa Resources S.A.",10,1085,0],["NEXM","NexMetals Mining Corp.",1,0,0],["NEXN","Nexxen International Ltd.",16,427,0],["NEXT","NextDecade Corporation",59,1451,0],["NFBK","Northfield Bancorp Inc.",84,503,0],["NFE","New Fortress Energy Inc. Class A",140,344,0],["NFG","National Fuel Gas Company",140,7325,0],["NFGC","New Found Gold Corp",104,679,0],["NFJ","Virtus Dividend Interest & Premium Strategy Fund",44,0,0],["NFLT","NFLT",1,0,0],["NFLX","Netflix Inc.",110,399961,0],["NFLY","NFLY",1,0,0],["NFRA","NFRA",1,0,0],["NFTY","NFTY",1,0,0],["NFXL","NFXL",1,0,0],["NFXS","NFXS",1,0,0],["NG","Novagold Resources Inc.",104,4045,0],["NGD","New Gold Inc.",10,6983,0],["NGG","National Grid Transco PLC National Grid PLC (NEW)",107,75525,0],["NGL","NGL ENERGY PARTNERS LP Common",107,1194,0],["NGL/PB","NGL/PB",1,0,0],["NGL/PC","NGL/PC",1,0,0],["NGNE","Neurogene Inc.",8,318,0],["NGS","Natural Gas Services Group Inc.",20,408,0],["NGVC","Natural Grocers by Vitamin Cottage Inc.",67,580,0],["NGVT","Ingevity Corporation",34,2108,0],["NHC","National HealthCare Corporation",126,2198,0],["NHI","National Health Investors Inc.",30,3708,0],["NHIC","NewHold Investment Corp III Class A",1,0,0],["NHICU","NHICU",1,0,0],["NHPAP","National Healthcare Properties Inc. 7.375% Series A Cumulative Redeemable Perpetual",30,539,0],["NHPBP","National Healthcare Properties Inc. 7.125% Series B Cumulative Redeemable Perpetual",30,529,0],["NHS","Neuberger High Yield Strategies Fund Inc.",81,0,0],["NHTC","Natural Health Trends Corp.",94,38,0],["NHYB","NHYB",1,0,0],["NHYM","NHYM",1,0,0],["NI","NiSource Inc",129,19551,0],["NIC","Nicolet Bankshares Inc.",26,1901,0],["NICE","NICE Ltd",25,6896,0],["NIE","Virtus Equity & Convertible Income Fund",11,692,0],["NIKL","NIKL",1,0,0],["NIM","Nuveen Select Maturities Municipal Fund",81,0,0],["NINE","Nine Energy Service Inc.",20,15,0],["NIO","NIO Inc.",37,11207,0],["NIOG","NIOG",1,0,0],["NIPG","NIP Group Inc.",45,154,0],["NIQ","NIQ Global Intelligence plc",16,4897,0],["NISN","NiSun International Enterprise Development Group Co. Ltd. Class A",55,8,0],["NITE","NITE",1,0,0],["NITO","N2OFF Inc.",85,7,0],["NIU","Niu Technologies",37,240,0],["NIVF","NewGenIvf Group Limited Class A",137,6,0],["NIXT","NIXT",1,0,0],["NIXX","Nixxy Inc.",15,28,0],["NJNK","NJNK",1,0,0],["NJR","NewJersey Resources Corporation",140,4665,0],["NKE","Nike Inc.",114,86785,0],["NKLR","Terra Innovatum Global N.V.",55,355,0],["NKSH","National Bankshares Inc.",26,220,0],["NKTR","Nektar Therapeutics ",8,953,0],["NKTX","Nkarta Inc.",8,127,0],["NKX","Nuveen California AMT-Free Quality Municipal Income Fund",123,0,0],["NL","NL Industries Inc.",34,274,0],["NLOP","Net Lease Office Properties",30,390,0],["NLR","NLR",1,0,0],["NLY","Annaly Capital Management Inc.",30,15505,0],["NLY/PF","NLY/PF",1,0,0],["NLY/PG","NLY/PG",1,0,0],["NLY/PI","NLY/PI",1,0,0],["NLY/PJ","NLY/PJ",1,0,0],["NMAI","Nuveen Multi-Asset Income Fund",11,0,0],["NMAX","Newsmax Inc. Class B",83,1176,0],["NMB","NMB",1,0,0],["NMBL","NMBL",1,0,0],["NMCO","Nuveen Municipal Credit Opportunities Fund",123,564,0],["NMFC","New Mountain Finance Corporation",123,929,0],["NMFCZ","New Mountain Finance Corporation 8.250% Notes due 2028",1,2695,0],["NMG","Nouveau Monde Graphite Inc.",52,381,0],["NMI","Nuveen Municipal Income Fund Inc.",81,0,0],["NMIH","NMI Holdings Inc.",22,3157,0],["NML","Neuberger Energy Infrastructure and Income Fund Inc.",123,0,0],["NMM","Navios Maritime Partners LP Common",98,1508,0],["NMP","NMP Acquisition Corp. Class A",2,0,0],["NMPAU","NMP Acquisition Corp.",2,0,0],["NMR","Nomura Holdings Inc ADR",60,24359,0],["NMRA","Neumora Therapeutics Inc.",13,292,0],["NMRK","Newmark Group Inc. Class A",36,3157,0],["NMS","Nuveen Minnesota Quality Municipal Income Fund",116,0,0],["NMT","Nuveen Massachusetts Quality Municipal Income Fund",123,0,0],["NMTC","NeuroOne Medical Technologies Corporation",31,37,0],["NMZ","Nuveen Municipal High Income Opportunity Fund",123,0,0],["NN","NextNav Inc.",7,2264,0],["NNBR","NN Inc.",7,60,0],["NNDM","Nano Dimension Ltd.",39,504,0],["NNE","Nano Nuclear Energy Inc.",41,1373,0],["NNI","Nelnet Inc.",44,4980,0],["NNN","NNN REIT Inc.",30,7551,0],["NNNN","Anbio Biotechnology Class A",24,4655,0],["NNOX","NANO-X IMAGING LTD",132,202,0],["NNVC","NanoViricides Inc.",8,36,0],["NNY","Nuveen New York Municipal Value Fund",11,0,0],["NOA","North American Construction Group Ltd.",20,385,0],["NOAH","Noah Holdings Limited",11,658,0],["NOC","Northrop Grumman Corporation",7,81131,0],["NODK","NI Holdings Inc.",22,287,0],["NOEM","CO2 Energy Transition Corp.",1,0,0],["NOG","Northern Oil and Gas Inc.",59,2102,0],["NOK","Nokia Corporation Sponsored",49,36438,0],["NOM","Nuveen Missouri Quality Municipal Income Fund",11,0,0],["NOMA","NOMADAR Corp. Class A",45,160,0],["NOMD","Nomad Foods Limited",17,1965,0],["NORW","NORW",1,0,0],["NOTE","FiscalNote Holdings Inc. Class A",36,29,0],["NOTV","Inotiv Inc.",14,23,0],["NOV","NOV Inc.",88,5716,0],["NOVT","Novanta Inc.",7,4270,0],["NOVTU","Novanta Inc. Tangible Equity",7,1960,0],["NOW","ServiceNow Inc.",25,161272,0],["NOWL","NOWL",1,0,0],["NP","Neptune Insurance Holdings Inc. Class A",28,3888,0],["NPAC","New Providence Acquisition Corp. III Class A",1,0,0],["NPACU","New Providence Acquisition Corp. III",2,0,0],["NPB","Northpointe Bancshares Inc.",26,584,0],["NPCE","Neuropace Inc.",31,553,0],["NPCT","Nuveen Core Plus Impact Fund",11,0,0],["NPFD","Nuveen Variable Rate Preferred & Income Fund",81,0,0],["NPFI","NPFI",1,0,0],["NPK","National Presto Industries Inc.",78,754,0],["NPKI","NPK International Inc.",88,1034,0],["NPO","Enpro Inc.",55,4363,0],["NPT","Texxon Holding Limited",135,118,0],["NPV","Nuveen Virginia Quality Municipal Income Fund",11,0,0],["NPWR","NET Power Inc. Class A",7,515,0],["NQP","Nuveen Pennsylvania Quality Municipal Income Fund",81,0,0],["NRC","National Research Corporation",14,424,0],["NRDS","NerdWallet Inc. Class A",15,1045,0],["NRDY","Nerdy Inc. Class A",3,229,0],["NREF","NexPoint Real Estate Finance Inc.",30,252,0],["NREF/PA","NREF/PA",1,0,0],["NRES","NRES",1,0,0],["NRG","NRG Energy Inc.",41,29934,0],["NRGD","NRGD",1,0,0],["NRGU","NRGU",1,0,0],["NRGV","Energy Vault Holdings Inc.",7,802,0],["NRIM","Northrim BanCorp Inc",84,598,0],["NRIX","Nurix Therapeutics Inc.",8,1424,0],["NRK","Nuveen New York AMT-Free Quality Municipal Income Fund",81,0,0],["NRO","Neuberger Real Estate Securities Income Fund Inc.",123,0,0],["NRP","Natural Resource Partners LP Limited Partnership",65,1350,0],["NRSH","NRSH",1,0,0],["NRSN","NeuroSense Therapeutics Ltd.",8,24,0],["NRT","North European Oil Royality Trust",59,58,0],["NRUC","National Rural Utilities Cooperative Finance Corporation 5.500% Subordinated Notes due 2064 (Subordinated Deferrable Interest Notes)",146,0,0],["NRXP","NRX Pharmaceuticals Inc.",8,67,0],["NRXS","Neuraxis Inc.",77,34,0],["NSA","National Storage Affiliates Trust",30,2159,0],["NSA/PA","NSA/PA",1,0,0],["NSA/PB","NSA/PB",1,0,0],["NSC","Norfolk Southern Corporation",117,65389,0],["NSCI","NSCI",1,0,0],["NSCR","NSCR",1,0,0],["NSI","NSI",1,0,0],["NSIT","Insight Enterprises Inc.",57,2456,0],["NSP","Insperity Inc.",19,1456,0],["NSPR","InspireMD Inc.",31,84,0],["NSRX","Nasus Pharma Ltd.",8,68,0],["NSSC","NAPCO Security Technologies Inc.",33,1534,0],["NSTS","NSTS Bancorp Inc.",84,63,0],["NSYS","Nortech Systems Incorporated",7,20,0],["NTAP","NetApp Inc.",76,22163,0],["NTB","Bank of N.T. Butterfield & Son Limited (The) Voting",75,2202,0],["NTCL","NETCLASS TECHNOLOGY INC Class A",25,12,0],["NTCT","NetScout Systems Inc.",15,2027,0],["NTES","NetEase Inc.",25,87027,0],["NTGR","NETGEAR Inc.",33,693,0],["NTHI","NeOnc Technologies Holdings Inc.",8,168,0],["NTIC","Northern Technologies International Corporation",32,74,0],["NTIP","Network-1 Technologies Inc.",29,30,0],["NTLA","Intellia Therapeutics Inc.",24,1069,0],["NTNX","Nutanix Inc. Class A",25,14142,0],["NTR","Nutrien Ltd.",85,30102,0],["NTRA","Natera Inc.",23,32014,0],["NTRB","Nutriband Inc.",32,55,0],["NTRP","NextTrip Inc.",69,35,0],["NTRS","Northern Trust Corporation",26,26374,0],["NTRSO","Northern Trust Corporation",26,3656,0],["NTSE","NTSE",1,0,0],["NTSI","NTSI",1,0,0],["NTSK","Netskope Inc. Class A",25,7574,0],["NTST","NetSTREIT Corp.",30,1459,0],["NTSX","NTSX",1,0,0],["NTWK","NetSol Technologies Inc. Common Stock",25,36,0],["NTWO","Newbury Street II Acquisition Corp Class A",1,0,0],["NTZ","Natuzzi S.p.A.",73,25,0],["NU","Nu Holdings Ltd. Class A",44,78737,0],["NUAG","NUAG",1,0,0],["NUAI","New Era Energy & Digital Inc.",59,202,0],["NUBD","NUBD",1,0,0],["NUE","Nucor Corporation",27,36423,0],["NUG","NUG",1,0,0],["NUGO","NUGO",1,0,0],["NUGT","NUGT",1,0,0],["NUGY","NUGY",1,0,0],["NUHY","NUHY",1,0,0],["NUKK","Nukkleus Inc.",19,74,0],["NUKZ","NUKZ",1,0,0],["NUMI","NUMI",1,0,0],["NUS","Nu Skin Enterprises Inc.",112,501,0],["NUSA","NUSA",1,0,0],["NUSB","NUSB",1,0,0],["NUTX","Nutex Health Inc.",36,1216,0],["NUV","Nuveen Municipal Value Fund Inc.",81,0,0],["NUVB","Nuvation Bio Inc. Class A",8,3236,0],["NUVL","Nuvalent Inc. Class A",8,7547,0],["NUW","Nuveen AMT-Free Municipal Value Fund",11,0,0],["NUWE","Nuwellis Inc.",77,4,0],["NVA","Nova Minerals Limited",104,232,0],["NVAX","Novavax Inc.",13,1082,0],["NVBT","NVBT",1,0,0],["NVBW","NVBW",1,0,0],["NVCR","NovoCure Limited",31,1438,0],["NVCT","Nuvectis Pharma Inc.",8,199,0],["NVD","NVD",1,0,0],["NVDA","NVIDIA Corporation",6,4398057,0],["NVDB","NVDB",1,0,0],["NVDD","NVDD",1,0,0],["NVDG","NVDG",1,0,0],["NVDL","NVDL",1,0,0],["NVDS","NVDS",1,0,0],["NVDU","NVDU",1,0,0],["NVDY","NVDY",1,0,0],["NVEC","NVE Corporation",6,325,0],["NVG","Nuveen AMT-Free Municipal Credit Income Fund",11,0,0],["NVGS","Navigator Holdings Ltd.",98,1201,0],["NVIR","NVIR",1,0,0],["NVMI","Nova Ltd.",76,9452,0],["NVNI","Nvni Group Limited",25,31,0],["NVNO","enVVeno Medical Corporation",31,6,0],["NVO","Novo Nordisk A/S",8,214722,0],["NVOH","NVOH",1,0,0],["NVOX","NVOX",1,0,0],["NVR","NVR Inc.",121,21011,0],["NVRI","Enviri Corporation",12,1469,0],["NVS","Novartis AG",8,268731,0],["NVST","Envista Holdings Corporation",31,3663,0],["NVT","nVent Electric plc",7,16384,0],["NVTS","Navitas Semiconductor Corporation",6,1679,0],["NVVE","Nuvve Holding Corp.",39,5,0],["NVX","NOVONIX Limited American Depository Shares",7,145,0],["NVYY","NVYY",1,0,0],["NWAX.U","NWAX.U",1,0,0],["NWBI","Northwest Bancshares Inc.",26,1842,0],["NWE","NorthWestern Energy Group Inc.",129,3858,0],["NWFL","Norwood Financial Corp.",26,275,0],["NWG","NatWest Group plc",75,69344,0],["NWGL","Nature Wood Group Limited",1,21,0],["NWL","Newell Brands Inc.",64,1559,0],["NWLG","NWLG",1,0,0],["NWN","Northwest Natural Holding Company",140,1931,0],["NWPX","NWPX Infrastructure Inc.",27,616,0],["NWS","News Corporation Class B",124,16727,0],["NWSA","News Corporation Class A",124,14644,0],["NWTG","Newton Golf Company Inc.",61,8,0],["NX","Quanex Building Products Corporation",55,705,0],["NXC","Nuveen California Select Tax-Free Income Portfolio",11,84,0],["NXDR","Nextdoor Holdings Inc. Class A",16,855,0],["NXDT","NexPoint Diversified Real Estate Trust",30,184,0],["NXDT/PA","NXDT/PA",1,0,0],["NXE","Nexgen Energy Ltd.",52,5976,0],["NXG","NXG NextGen Infrastructure Income Fund",1,128,0],["NXGL","NexGel Inc",31,13,0],["NXJ","Nuveen New Jersey Qualified Municipal Fund",123,0,0],["NXL","Nexalin Technology Inc.",77,16,0],["NXN","Nuveen New York Select Tax-Free Income Portfolio",81,48,0],["NXP","Nuveen Select Tax Free Income Portfolio",81,662,0],["NXPI","NXP Semiconductors N.V.",6,56946,0],["NXPL","NextPlat Corp",33,16,0],["NXRT","NexPoint Residential Trust Inc.",30,717,0],["NXST","Nexstar Media Group Inc.",83,6125,0],["NXT","Nextpower Inc. Class A",7,13162,0],["NXTC","NextCure Inc.",8,59,0],["NXTE","NXTE",1,0,0],["NXTG","NXTG",1,0,0],["NXTT","Next Technology Holding Inc.",15,33,0],["NXUS","NXUS",1,0,0],["NXXT","NextNRG Inc.",97,193,0],["NYAX","Nayax Ltd.",25,1708,0],["NYC","American Strategic Investment Co. Class A",30,22,0],["NYF","NYF",1,0,0],["NYM","NYM",1,0,0],["NYT","New York Times Company (The)",124,11493,0],["NYXH","Nyxoah SA",31,182,0],["NZAC","NZAC",1,0,0],["NZF","Nuveen Municipal Credit Income Fund",116,0,0],["NZUS","NZUS",1,0,0],["O","Realty Income Corporation",30,51818,0],["OABI","OmniAb Inc.",14,301,0],["OACC","Oaktree Acquisition Corp. III Life Sciences Class A",2,0,0],["OACCU","Oaktree Acquisition Corp. III Life Sciences Unit",2,0,0],["OACP","OACP",1,0,0],["OAEM","OAEM",1,0,0],["OAIM","OAIM",1,0,0],["OAK/PA","OAK/PA",1,0,0],["OAK/PB","OAK/PB",1,0,0],["OAKG","OAKG",1,0,0],["OAKI","OAKI",1,0,0],["OAKM","OAKM",1,0,0],["OAKU","Oak Woods Acquisition Corporation Class A",2,0,0],["OALC","OALC",1,0,0],["OARK","OARK",1,0,0],["OASC","OASC",1,0,0],["OBA","Oxley Bridge Acquisition Limited Class A",2,0,0],["OBDC","Blue Owl Capital Corporation",146,6465,0],["OBE","Obsidian Energy Ltd.",59,377,0],["OBIL","OBIL",1,0,0],["OBIO","Orchestra BioMed Holdings Inc.",18,246,0],["OBK","Origin Bancorp Inc.",26,1204,0],["OBOR","OBOR",1,0,0],["OBT","Orange County Bancorp Inc.",26,399,0],["OC","Owens Corning Inc",7,9414,0],["OCC","Optical Cable Corporation",33,44,0],["OCCI","OFS Credit Company Inc.",81,55,0],["OCCIM","OFS Credit Company Inc. 7.875% Series F Term",1,0,0],["OCCIN","OFS Credit Company Inc. 5.25% Series E Term",81,283,0],["OCCIO","OFS Credit Company Inc. 6.125% Series C Term",81,291,0],["OCFC","OceanFirst Financial Corp.",26,1155,0],["OCG","Oriental Culture Holding LTD",3,5,0],["OCGN","Ocugen Inc.",13,437,0],["OCIO","OCIO",1,0,0],["OCS","Oculis Holding AG",8,1123,0],["OCSL","Oaktree Specialty Lending Corporation",44,1127,0],["OCTT","OCTT",1,0,0],["OCTW","OCTW",1,0,0],["OCUL","Ocular Therapeutix Inc.",8,2676,0],["ODC","Oil-Dri Corporation Of America",69,742,0],["ODD","ODDITY Tech Ltd. Class A",90,2333,0],["ODDS","ODDS",1,0,0],["ODFL","Old Dominion Freight Line Inc.",63,32910,0],["ODHY","ODHY",1,0,0],["ODV","Osisko Development Corp.",104,961,0],["ODYS","Odysight.ai Inc.",76,55,0],["OEC","Orion S.A.",34,284,0],["OEF","OEF",1,0,0],["OEI","OEI",1,0,0],["OESX","Orion Energy Systems Inc.",91,57,0],["OFAL","OFA Group Class A",21,9,0],["OFG","OFG Bancorp",26,1859,0],["OFIX","Orthofix Medical Inc.",31,612,0],["OFLX","Omega Flex Inc.",32,284,0],["OFS","OFS Capital Corporation",123,62,0],["OFSSH","OFSSH",1,0,0],["OFSSO","OFS Capital Corporation 7.50% Notes due 2028",1,0,0],["OGCP","OGCP",1,0,0],["OGE","OGE Energy Corp",41,8562,0],["OGEN","Oragenics Inc.",8,4,0],["OGI","Organigram Global Inc.",8,270,0],["OGN","Organon & Co.",8,1776,0],["OGS","ONE Gas Inc.",140,4652,0],["OGSP","OGSP",1,0,0],["OHI","Omega Healthcare Investors Inc.",30,12994,0],["OI","O-I Glass Inc.",125,2250,0],["OIA","Invesco Municipal Income Opportunities Trust",116,289,0],["OIH","OIH",1,0,0],["OII","Oceaneering International Inc.",20,2356,0],["OILD","OILD",1,0,0],["OILT","OILT",1,0,0],["OILU","OILU",1,0,0],["OIS","Oil States International Inc.",88,410,0],["OKE","ONEOK Inc.",59,45097,0],["OKLL","OKLL",1,0,0],["OKLO","Oklo Inc. Class A",41,13004,0],["OKLS","OKLS",1,0,0],["OKTA","Okta Inc. Class A",25,15988,0],["OKTG","OKTG",1,0,0],["OKUR","OnKure Therapeutics Inc. Class A",8,41,0],["OKYO","OKYO Pharma Limited",13,69,0],["OLB","The OLB Group Inc.",36,8,0],["OLED","Universal Display Corporation",39,5560,0],["OLLI","Ollie\'s Bargain Outlet Holdings Inc.",113,6622,0],["OLMA","Olema Pharmaceuticals Inc.",8,2100,0],["OLN","Olin Corporation",34,2327,0],["OLP","One Liberty Properties Inc.",30,450,0],["OLPX","Olaplex Holdings Inc.",90,841,0],["OM","Outset Medical Inc.",77,67,0],["OMAB","Grupo Aeroportuario del Centro Norte S.A.B. de C.V. ADS",50,5207,0],["OMAH","OMAH",1,0,0],["OMC","Omnicom Group Inc.",58,15483,0],["OMCC","Old Market Capital Corporation",116,34,0],["OMCL","Omnicell Inc.",9,2102,0],["OMDA","Omada Health Inc.",35,840,0],["OMER","Omeros Corporation",8,681,0],["OMEX","Odyssey Marine Exploration Inc.",98,121,0],["OMF","OneMain Holdings Inc.",44,8041,0],["OMH","Ohmyhome Limited Class A",36,19,0],["OMI","Owens & Minor Inc.",23,220,0],["OMSE","OMS Energy Technologies Inc.",88,181,0],["ON","ON Semiconductor Corporation",6,22215,0],["ONB","Old National Bancorp",26,9125,0],["ONBPO","Old National Bancorp",26,9808,0],["ONBPP","Old National Bancorp",26,9824,0],["ONC","BeOne Medicines Ltd.",8,34973,0],["ONCH","1RT Acquisition Corp. Class A",1,0,0],["ONCHU","1RT Acquisition Corp.",1,0,0],["ONCO","Onconetix Inc.",8,3,0],["ONCY","Oncolytics Biotech Inc.",8,109,0],["OND","OND",1,0,0],["ONDS","Ondas Holdings Inc.",49,3452,0],["ONEG","OneConstruction Group Limited",121,18,0],["ONEO","ONEO",1,0,0],["ONEQ","ONEQ",1,0,0],["ONEV","ONEV",1,0,0],["ONEW","OneWater Marine Inc. Class A",141,173,0],["ONEY","ONEY",1,0,0],["ONFO","Onfolio Holdings Inc.",15,4,0],["ONIT","Onity Group Inc.",44,359,0],["ONL","Orion Properties Inc.",30,116,0],["ONLN","ONLN",1,0,0],["ONMD","OneMedNet Corp Class A",14,67,0],["ONOF","ONOF",1,0,0],["ONON","On Holding AG Class A",114,30829,0],["ONTF","ON24 Inc.",25,245,0],["ONTO","Onto Innovation Inc.",7,7663,0],["OOMA","Ooma Inc.",15,321,0],["OOQB","OOQB",1,0,0],["OOSB","OOSB",1,0,0],["OOSP","OOSP",1,0,0],["OPAD","Offerpad Solutions Inc. Class A",36,51,0],["OPAL","OPAL Fuels Inc. Class A",107,357,0],["OPBK","OP Bancorp",26,222,0],["OPCH","Option Care Health Inc.",35,5160,0],["OPEG","OPEG",1,0,0],["OPEN","Opendoor Technologies Inc",36,6066,0],["OPER","OPER",1,0,0],["OPFI","OppFi Inc. Class A",44,928,0],["OPHC","OptimumBank Holdings Inc.",26,50,0],["OPK","OPKO Health Inc.",8,1006,0],["OPP","RiverNorth/DoubleLine Strategic Opportunity Fund Inc.",123,0,0],["OPP/PA","OPP/PA",1,0,0],["OPP/PB","OPP/PB",1,0,0],["OPP/PC","OPP/PC",1,0,0],["OPPE","OPPE",1,0,0],["OPPJ","OPPJ",1,0,0],["OPRA","Opera Limited",25,1262,0],["OPRT","Oportun Financial Corporation",44,239,0],["OPRX","OptimizeRx Corporation",36,252,0],["OPTT","Ocean Power Technologies Inc.",41,69,0],["OPTU","Optimum Communications Inc. Class A",54,799,0],["OPTX","Syntec Optics Holdings Inc. Class A",76,63,0],["OPTZ","OPTZ",1,0,0],["OPXS","Optex Systems Holdings Inc.",76,94,0],["OPY","Oppenheimer Holdings Inc. Class A",60,784,0],["OR","OR Royalties Inc.",104,6962,0],["ORA","Ormat Technologies Inc.",41,6734,0],["ORBS","Eightco Holdings Inc.",1,455,0],["ORC","Orchid Island Capital Inc.",30,1114,0],["ORCL","Oracle Corporation",25,551555,0],["ORCS","ORCS",1,0,0],["ORCU","ORCU",1,0,0],["ORCX","ORCX",1,0,0],["ORGN","Origin Materials Inc.",34,41,0],["ORGO","Organogenesis Holdings Inc. Class A",8,711,0],["ORI","Old Republic International Corporation",22,11261,0],["ORIC","Oric Pharmaceuticals Inc.",8,783,0],["ORIQ","Origin Investment Corp I",1,0,0],["ORIQU","ORIQU",1,0,0],["ORIS","Oriental Rise Holdings Limited",48,2,0],["ORKA","Oruka Therapeutics Inc.",24,1541,0],["ORKT","Orangekloud Technology Inc. Class A",25,5,0],["ORLA","Orla Mining Ltd.",104,4820,0],["ORLY","O\'Reilly Automotive Inc.",141,76813,0],["ORMP","Oramed Pharmaceuticals Inc.",8,117,0],["ORN","Orion Group Holdings Inc. Common",21,415,0],["ORR","ORR",1,0,0],["ORRF","Orrstown Financial Services Inc.",26,714,0],["OS","OneStream Inc. Class A",25,4491,0],["OSBC","Old Second Bancorp Inc.",26,1081,0],["OSCG","OSCG",1,0,0],["OSCR","Oscar Health Inc. Class A",23,3944,0],["OSCX","OSCX",1,0,0],["OSEA","OSEA",1,0,0],["OSG","Octave Specialty Group Inc.",22,363,0],["OSIS","OSI Systems Inc.",6,4491,0],["OSK","Oshkosh Corporation (Holding Company)Common Stock",37,8247,0],["OSPN","OneSpan Inc.",15,486,0],["OSRH","OSR Holdings Inc.",31,17,0],["OSS","One Stop Systems Inc.",9,180,0],["OSTX","OS Therapies Incorporated",8,54,0],["OSUR","OraSure Technologies Inc.",31,171,0],["OSW","OneSpaWorld Holdings Limited",47,2191,0],["OTEX","Open Text Corporation",15,8410,0],["OTF","Blue Owl Technology Finance Corp.",1,6354,0],["OTGA","OTG Acquisition Corp. I Class A",2,0,0],["OTGAU","OTG Acquisition Corp. I Unit",2,0,0],["OTGL","OTGL",1,0,0],["OTH","Off The Hook YS Inc.",98,56,0],["OTIS","Otis Worldwide Corporation",133,33929,0],["OTLK","Outlook Therapeutics Inc.",13,89,0],["OTLY","Oatly Group AB",17,333,0],["OTTR","Otter Tail Corporation",41,3441,0],["OUNZ","OUNZ",1,0,0],["OUST","Ouster Inc.",7,1334,0],["OUT","OUTFRONT Media Inc.",30,3997,0],["OVBC","Ohio Valley Banc Corp.",26,194,0],["OVID","Ovid Therapeutics Inc.",8,191,0],["OVLY","Oak Valley Bancorp (CA)",26,258,0],["OVV","Ovintiv Inc. (DE)",59,9469,0],["OWL","Blue Owl Capital Inc. Class A",11,24003,0],["OWLS","OBOOK Holdings Inc. Class A",25,533,0],["OWLT","Owlet Inc. Class A",7,388,0],["OWNB","OWNB",1,0,0],["OWNS","OWNS",1,0,0],["OXBR","Oxbridge Re Holdings Limited",22,10,0],["OXLC","Oxford Lane Capital Corp.",11,2418,0],["OXLCG","Oxford Lane Capital Corp. 7.95% Notes due 2032",11,0,0],["OXLCI","Oxford Lane Capital Corp. 8.75% Notes due 2030",1,0,0],["OXLCL","Oxford Lane Capital Corp. 6.75% Notes due 2031",116,4175,0],["OXLCN","Oxford Lane Capital Corp. 7.125% Series 2029 Term",11,4232,0],["OXLCO","Oxford Lane Capital Corp.",11,4071,0],["OXLCP","Oxford Lane Capital Corp. 6.25% Series 2027 Term",11,4253,0],["OXLCZ","Oxford Lane Capital Corp. 5.00% Notes due 2027",116,4227,0],["OXM","Oxford Industries Inc.",118,540,0],["OXSQ","Oxford Square Capital Corp.",2,144,0],["OXSQG","Oxford Square Capital Corp. 5.50% Notes due 2028",3,1531,0],["OXSQH","Oxford Square Capital Corp. 7.75% Notes due 2030",2,0,0],["OXY","Occidental Petroleum Corporation",59,39034,0],["OYSE","Oyster Enterprises II Acquisition Corp Class A",2,0,0],["OYSEU","Oyster Enterprises II Acquisition Corp",1,0,0],["OZ","Belpointe PREP LLC Class A",30,251,0],["OZEM","OZEM",1,0,0],["OZK","Bank OZK",26,5349,0],["OZKAP","Bank OZK 4.625% Series A Non-Cumulative Perpetual",26,1857,0],["PAA","Plains All American Pipeline L.P. Common",107,12381,0],["PAAA","PAAA",1,0,0],["PAAS","Pan American Silver Corp.",104,21849,0],["PAB","PAB",1,0,0],["PABD","PABD",1,0,0],["PABU","PABU",1,0,0],["PAC","Grupo Aeroportuario Del Pacifico S.A. B. de C.V. Grupo Aeroportuario Del Pacifico S.A. de C.V. (each representing 10 Series B shares)",50,13484,0],["PACB","Pacific Biosciences of California Inc.",71,556,0],["PACH","Pioneer Acquisition I Corp Class A",1,0,0],["PACHU","Pioneer Acquisition I Corp",1,0,0],["PACK","Ranpak Holdings Corp Class A",125,459,0],["PACS","PACS Group Inc.",126,5699,0],["PAG","Penske Automotive Group Inc.",97,10949,0],["PAGP","Plains GP Holdings L.P. Class A",107,3701,0],["PAGS","PagSeguro Digital Ltd. Class A",15,3151,0],["PAHC","Phibro Animal Health Corporation Class A",8,1510,0],["PAI","Western Asset Investment Grade Income Fund Inc.",81,0,0],["PAII","Pyrophyte Acquisition Corp. II Class A",1,0,0],["PAII.U","PAII.U",1,0,0],["PAL","Proficient Auto Logistics Inc.",87,271,0],["PALC","PALC",1,0,0],["PALD","PALD",1,0,0],["PALI","Palisade Bio Inc.",13,273,0],["PALL","PALL",1,0,0],["PALU","PALU",1,0,0],["PAM","Pampa Energia S.A.",41,4876,0],["PAMC","PAMC",1,0,0],["PAMT","PAMT CORP",63,225,0],["PANG","PANG",1,0,0],["PANL","Pangaea Logistics Solutions Ltd.",98,451,0],["PANW","Palo Alto Networks Inc.",53,130255,0],["PAPI","PAPI",1,0,0],["PAPL","Pineapple Financial Inc.",44,3,0],["PAR","PAR Technology Corporation",92,1507,0],["PARK","Park Dental Partners Inc.",137,72,0],["PARR","Par Pacific Holdings Inc. ",59,1899,0],["PASG","Passage Bio Inc.",13,30,0],["PASW","Ping An Biomedical Co. Ltd.",86,12,0],["PATH","UiPath Inc. Class A",25,8620,0],["PATK","Patrick Industries Inc.",42,3684,0],["PATN","PATN",1,0,0],["PAVM","PAVmed Inc.",31,9,0],["PAVS","Paranovus Entertainment Technology Ltd. Class A",18,2,0],["PAX","Patria Investments Limited Class A",11,2477,0],["PAXS","PIMCO Access Income Fund",11,0,0],["PAY","Paymentus Holdings Inc. Class A",36,3775,0],["PAYC","Paycom Software Inc.",25,9156,0],["PAYO","Payoneer Global Inc.",36,2067,0],["PAYS","Paysign Inc.",15,293,0],["PAYX","Paychex Inc.",12,40409,0],["PB","Prosperity Bancshares Inc.",26,6782,0],["PBA","Pembina Pipeline Corp.",59,21423,0],["PBBK","PB Bankshares Inc.",43,58,0],["PBD","PBD",1,0,0],["PBDC","PBDC",1,0,0],["PBE","PBE",1,0,0],["PBEU","PBEU",1,0,0],["PBF","PBF Energy Inc. Class A",106,3053,0],["PBFS","Pioneer Bancorp Inc.",43,367,0],["PBH","Prestige Consumer Healthcare Inc.",8,2969,0],["PBHC","Pathfinder Bancorp Inc.",26,87,0],["PBI","Pitney Bowes Inc.",92,1709,0],["PBI/PB","PBI/PB",1,0,0],["PBJ","PBJ",1,0,0],["PBM","Psyence Biomedical Ltd.",8,2,0],["PBOG","PBOG",1,0,0],["PBOT","PBOT",1,0,0],["PBPH","PBPH",1,0,0],["PBQQ","PBQQ",1,0,0],["PBR","Petroleo Brasileiro S.A. Petrobras ADS",59,75721,0],["PBR.A","PBR.A",1,0,0],["PBRG","PBRG",1,0,0],["PBT","Permian Basin Royalty Trust",59,780,0],["PBW","PBW",1,0,0],["PBYI","Puma Biotechnology Inc",8,284,0],["PCAP","ProCap Acquisition Corp Class A",2,0,0],["PCAPU","ProCap Acquisition Corp Unit",1,0,0],["PCAR","PACCAR Inc.",119,58597,0],["PCB","PCB Bancorp",26,326,0],["PCCE","PCCE",1,0,0],["PCEF","PCEF",1,0,0],["PCEM","PCEM",1,0,0],["PCF","High Income Securities Fund",81,0,0],["PCFI","PCFI",1,0,0],["PCG","Pacific Gas & Electric Co.",129,42088,0],["PCG/PA","PCG/PA",1,0,0],["PCG/PB","PCG/PB",1,0,0],["PCG/PC","PCG/PC",1,0,0],["PCG/PD","PCG/PD",1,0,0],["PCG/PE","PCG/PE",1,0,0],["PCG/PG","PCG/PG",1,0,0],["PCG/PH","PCG/PH",1,0,0],["PCG/PI","PCG/PI",1,0,0],["PCG/PX","PCG/PX",1,0,0],["PCGG","PCGG",1,0,0],["PCH","PotlatchDeltic Corporation",30,3065,0],["PCHI","PCHI",1,0,0],["PCIG","PCIG",1,0,0],["PCLA","PicoCELA Inc.",91,3,0],["PCLG","PCLG",1,0,0],["PCLN","PCLN",1,0,0],["PCLO","PCLO",1,0,0],["PCM","PCM Fund Inc.",81,0,0],["PCMM","PCMM",1,0,0],["PCN","Pimco Corporate & Income Strategy Fund",11,0,0],["PCOR","Procore Technologies Inc.",25,11525,0],["PCQ","PIMCO California Municipal Income Fund",11,0,0],["PCR","PCR",1,0,0],["PCRB","PCRB",1,0,0],["PCRX","Pacira BioSciences Inc.",8,1134,0],["PCSA","Processa Pharmaceuticals Inc.",8,9,0],["PCSC","Perceptive Capital Solutions Corp Class A",1,0,0],["PCT","PureCycle Technologies Inc.",34,1600,0],["PCTTU","PureCycle Technologies Inc. Unit",34,1753,0],["PCTY","Paylocity Holding Corporation",25,8312,0],["PCVX","Vaxcyte Inc.",8,6077,0],["PCY","PCY",1,0,0],["PCYO","Pure Cycle Corporation",70,273,0],["PD","PagerDuty Inc.",25,1177,0],["PDBA","PDBA",1,0,0],["PDBC","PDBC",1,0,0],["PDCC","Pearl Diver Credit Company Inc.",1,0,0],["PDD","PDD Holdings Inc.",15,155465,0],["PDDL","PDDL",1,0,0],["PDEX","Pro-Dex Inc.",31,126,0],["PDFS","PDF Solutions Inc.",25,1104,0],["PDI","PIMCO Dynamic Income Fund",81,4305,0],["PDLB","Ponce Financial Group Inc.",84,409,0],["PDM","Piedmont Realty Trust Inc. Class A",134,1041,0],["PDN","PDN",1,0,0],["PDO","PIMCO Dynamic Income Opportunities Fund",81,1874,0],["PDP","PDP",1,0,0],["PDPA","Pearl Diver Credit Company Inc. 8.00% Series A",1,0,0],["PDS","Precision Drilling Corporation",59,927,0],["PDSB","PDS Biotechnology Corporation",8,44,0],["PDT","John Hancock Premium Dividend Fund",116,0,0],["PDX","PIMCO Dynamic Income Strategy Fund",123,933,0],["PDYN","Palladyne AI Corp.",25,186,0],["PEB","Pebblebrook Hotel Trust",30,1307,0],["PEB/PE","PEB/PE",1,0,0],["PEB/PF","PEB/PF",1,0,0],["PEB/PG","PEB/PG",1,0,0],["PEB/PH","PEB/PH",1,0,0],["PEBK","Peoples Bancorp of North Carolina Inc.",26,207,0],["PEBO","Peoples Bancorp Inc.",26,1117,0],["PECO","Phillips Edison & Company Inc.",30,4535,0],["PED","Pedevco Corp.",59,51,0],["PEG","Public Service Enterprise Group Incorporated",129,39937,0],["PEGA","Pegasystems Inc.",15,10382,0],["PEJ","PEJ",1,0,0],["PELI","Pelican Acquisition Corporation",2,0,0],["PELIU","Pelican Acquisition Corporation Unit",2,0,0],["PEMX","PEMX",1,0,0],["PEN","Penumbra Inc.",31,12371,0],["PENG","Penguin Solutions Inc.",6,1040,0],["PENN","PENN Entertainment Inc.",47,1940,0],["PEO","Adams Natural Resources Fund Inc.",123,0,0],["PEP","PepsiCo Inc.",46,202585,0],["PEPG","PepGen Inc.",8,373,0],["PEPS","PEPS",1,0,0],["PERF","Perfect Corp. Class A",25,184,0],["PERI","Perion Network Ltd.",15,445,0],["PESI","Perma-Fix Environmental Services Inc.",122,245,0],["PETS","PetMed Express Inc.",142,76,0],["PETZ","TDH Holdings Inc.",27,10,0],["PEVC","PEVC",1,0,0],["PEW","GrabAGun Digital Holdings Inc.",66,95,0],["PEXL","PEXL",1,0,0],["PEY","PEY",1,0,0],["PEZ","PEZ",1,0,0],["PFAI","Pinnacle Food Group Limited Class A",48,26,0],["PFBC","Preferred Bank",26,1441,0],["PFD","Flaherty & Crumrine Preferred and Income Fund Incorporated",11,0,0],["PFE","Pfizer Inc.",8,143223,0],["PFF","PFF",1,0,0],["PFFA","PFFA",1,0,0],["PFFD","PFFD",1,0,0],["PFFL","PFFL",1,0,0],["PFFR","PFFR",1,0,0],["PFFV","PFFV",1,0,0],["PFG","Principal Financial Group Inc",143,19542,0],["PFGC","Performance Food Group Company",103,14373,0],["PFH","Prudential Financial Inc. 4.125% Junior Subordinated Notes due 2060",5,6226,0],["PFI","PFI",1,0,0],["PFIG","PFIG",1,0,0],["PFIS","Peoples Financial Services Corp.",26,511,0],["PFIX","PFIX",1,0,0],["PFL","PIMCO Income Strategy Fund Shares of Beneficial Interest",116,0,0],["PFLD","PFLD",1,0,0],["PFLT","PennantPark Floating Rate Capital Ltd.",44,896,0],["PFM","PFM",1,0,0],["PFN","PIMCO Income Strategy Fund II",123,0,0],["PFO","Flaherty & Crumrine Preferred and Income Opportunity Fund Incorporated",116,0,0],["PFRL","PFRL",1,0,0],["PFS","Provident Financial Services Inc",84,2731,0],["PFSA","Profusa Inc.",31,8,0],["PFSI","PennyMac Financial Services Inc.",44,6996,0],["PFUT","PFUT",1,0,0],["PFX","PhenixFIN Corporation",44,92,0],["PFXF","PFXF",1,0,0],["PFXNZ","PhenixFIN Corporation 5.25% Notes due 2028",44,47,0],["PG","Procter & Gamble Company (The)",90,337565,0],["PGAC","Pantages Capital Acquisition Corporation Class A",1,0,0],["PGACU","PGACU",1,0,0],["PGC","Peapack-Gladstone Financial Corporation",75,520,0],["PGEN","Precigen Inc.",8,1529,0],["PGF","PGF",1,0,0],["PGHY","PGHY",1,0,0],["PGJ","PGJ",1,0,0],["PGNY","Progyny Inc.",137,2296,0],["PGP","Pimco Global StocksPlus & Income Fund",116,0,0],["PGR","Progressive Corporation (The)",22,131517,0],["PGRI","PGRI",1,0,0],["PGRO","PGRO",1,0,0],["PGX","PGX",1,0,0],["PGY","Pagaya Technologies Ltd. Class A",44,1883,0],["PGZ","Principal Real Estate Income Fund",11,0,0],["PH","Parker-Hannifin Corporation",55,110389,0],["PHAR","Pharming Group N.V. ADS each representing 10",8,1137,0],["PHAT","Phathom Pharmaceuticals Inc.",8,1247,0],["PHB","PHB",1,0,0],["PHDG","PHDG",1,0,0],["PHEQ","PHEQ",1,0,0],["PHG","Koninklijke Philips N.V. NY Registry Shares",132,24663,0],["PHGE","BiomX Inc.",13,3,0],["PHI","PLDT Inc. Sponsored ADR",33,4559,0],["PHIN","PHINIA Inc.",42,2327,0],["PHIO","Phio Pharmaceuticals Corp.",8,25,0],["PHK","Pimco High Income Fund",123,0,0],["PHM","PulteGroup Inc.",121,23339,0],["PHO","PHO",1,0,0],["PHOE","Phoenix Asia Holdings Limited",82,354,0],["PHR","Phreesia Inc.",36,998,0],["PHUN","Phunware Inc.",15,39,0],["PHVS","Pharvaris N.V.",8,1394,0],["PHXE/P","PHXE/P",1,0,0],["PHYD","PHYD",1,0,0],["PHYL","PHYL",1,0,0],["PHYS","PHYS",1,0,0],["PI","Impinj Inc.",7,5214,0],["PICB","PICB",1,0,0],["PID","PID",1,0,0],["PIE","PIE",1,0,0],["PIFI","PIFI",1,0,0],["PII","Polaris Inc.",32,3913,0],["PIII","P3 Health Partners Inc. Class A",35,30,0],["PILL","PILL",1,0,0],["PIM","Putnam Master Intermediate Income Trust",116,163,0],["PIN","PIN",1,0,0],["PINE","Alpine Income Property Trust Inc.",30,233,0],["PINE/PA","PINE/PA",1,0,0],["PINK","PINK",1,0,0],["PINS","Pinterest Inc. Class A",16,17619,0],["PIO","PIO",1,0,0],["PIPR","Piper Sandler Companies",60,6137,0],["PIZ","PIZ",1,0,0],["PJFG","PJFG",1,0,0],["PJFV","PJFV",1,0,0],["PJIO","PJIO",1,0,0],["PJP","PJP",1,0,0],["PJT","PJT Partners Inc. Class A",11,4089,0],["PK","Park Hotels & Resorts Inc.",47,2183,0],["PKB","PKB",1,0,0],["PKBK","Parke Bancorp Inc.",26,291,0],["PKE","Park Aerospace Corp.",21,427,0],["PKG","Packaging Corporation of America",125,18249,0],["PKOH","Park-Ohio Holdings Corp.",32,325,0],["PKST","Peakstone Realty Trust",30,526,0],["PKW","PKW",1,0,0],["PKX","POSCO HOLDINGS INC.",27,16859,0],["PL","Planet Labs PBC Class A",49,6016,0],["PLAB","Photronics Inc.",6,1954,0],["PLAG","Planet Green Holdings Corp.",17,19,0],["PLAY","Dave & Buster\'s Entertainment Inc.",68,590,0],["PLBC","Plumas Bancorp",116,321,0],["PLBL","Polibeli Group Ltd Class A",133,4369,0],["PLBY","Playboy Inc.",66,198,0],["PLCE","Children\'s Place Inc. (The)",120,96,0],["PLD","Prologis Inc.",30,118180,0],["PLDR","PLDR",1,0,0],["PLG","Platinum Group Metals Ltd.",104,299,0],["PLMK","Plum Acquisition Corp. IV Class A",1,0,0],["PLMR","Palomar Holdings Inc.",22,3577,0],["PLNT","Planet Fitness Inc.",47,9278,0],["PLOW","Douglas Dynamics Inc.",72,776,0],["PLPC","Preformed Line Products Company",128,1055,0],["PLRX","Pliant Therapeutics Inc.",8,76,0],["PLRZ","Polyrizon Ltd.",8,15,0],["PLSE","Pulse Biosciences Inc",31,1034,0],["PLT","PLT",1,0,0],["PLTA","PLTA",1,0,0],["PLTD","PLTD",1,0,0],["PLTG","PLTG",1,0,0],["PLTK","Playtika Holding Corp.",15,1546,0],["PLTM","PLTM",1,0,0],["PLTR","Palantir Technologies Inc. Class A",25,460909,0],["PLTU","PLTU",1,0,0],["PLTY","PLTY",1,0,0],["PLTZ","PLTZ",1,0,0],["PLUG","Plug Power Inc.",7,3064,0],["PLUR","Pluri Inc.",13,31,0],["PLUS","ePlus inc.",100,2367,0],["PLUT","Plutus Financial Group Limited",60,48,0],["PLX","Protalix BioTherapeutics Inc. (DE)",13,139,0],["PLXS","Plexus Corp.",39,4104,0],["PLYM","Plymouth Industrial REIT Inc.",30,975,0],["PLYY","PLYY",1,0,0],["PM","Philip Morris International Inc",18,244143,0],["PMAX","Powell Max Limited Class A",3,28,0],["PMBS","PMBS",1,0,0],["PMCB","PharmaCyte Biotech Inc.",13,6,0],["PMEC","Primech Holdings Ltd.",12,41,0],["PMI","Picard Medical Inc.",31,172,0],["PMIO","PMIO",1,0,0],["PML","Pimco Municipal Income Fund II",11,0,0],["PMM","Putnam Managed Municipal Income Trust",11,300,0],["PMMF","PMMF",1,0,0],["PMN","ProMIS Neurosciences Inc.",8,18,0],["PMNT","Perfect Moment Ltd.",86,17,0],["PMO","Putnam Municipal Opportunities Trust",116,354,0],["PMT","PennyMac Mortgage Investment Trust",30,1147,0],["PMT/PA","PMT/PA",1,0,0],["PMT/PB","PMT/PB",1,0,0],["PMT/PC","PMT/PC",1,0,0],["PMTR","Perimeter Acquisition Corp. I Class A",2,0,0],["PMTRU","Perimeter Acquisition Corp. I Unit",2,0,0],["PMTS","CPI Card Group Inc.",109,180,0],["PMTU","PennyMac Mortgage Investment Trust 8.50% Senior Notes due 2028",30,2207,0],["PMTV","PennyMac Mortgage Investment Trust 9.00% Senior Notes due 2030",30,0,0],["PMTW","PennyMac Mortgage Investment Trust 9.00% Senior Notes due 2030",30,0,0],["PMVP","PMV Pharmaceuticals Inc.",8,66,0],["PN","Skycorp Solar Group Limited",100,29,0],["PNBK","Patriot National Bancorp Inc.",26,221,0],["PNC","PNC Financial Services Group Inc. (The)",26,82432,0],["PNFP","Pinnacle Financial Partners Inc.",26,7807,0],["PNFPP","Pinnacle Financial Partners Inc.",26,1940,0],["PNI","Pimco New York Municipal Income Fund II",81,0,0],["PNNT","PennantPark Investment Corporation",44,382,0],["PNQI","PNQI",1,0,0],["PNR","Pentair plc.",7,16997,0],["PNRG","PrimeEnergy Resources Corporation",59,275,0],["PNTG","The Pennant Group Inc.",35,1015,0],["PNW","Pinnacle West Capital Corporation",41,10449,0],["POAS","Phaos Technology Holdings (Cayman) Limited Class A",7,107,0],["POCI","Precision Optics Corporation Inc.",77,31,0],["PODC","PodcastOne Inc.",16,60,0],["PODD","Insulet Corporation",31,20374,0],["POET","POET Technologies Inc.",6,617,0],["POLA","Polar Power Inc.",7,5,0],["POLE","Andretti Acquisition Corp. II Class A",1,0,0],["POLEU","POLEU",1,0,0],["POM","POMDOCTOR LIMITED",66,36,0],["PONY","Pony AI Inc.",15,5663,0],["POOL","Pool Corporation",32,8642,0],["POR","Portland General Electric Co",41,5368,0],["POST","Post Holdings Inc.",17,5259,0],["POW","POW",1,0,0],["POWA","POWA",1,0,0],["POWI","Power Integrations Inc.",6,2024,0],["POWL","Powell Industries Inc.",39,4025,0],["POWR","POWR",1,0,0],["POWW","Outdoor Holding Company",78,218,0],["POWWP","Outdoor Holding Company 8.75% Series A Cumulative Redeemable Perpetual",78,2811,0],["PPA","PPA",1,0,0],["PPBT","Purple Biotech Ltd.",8,2,0],["PPC","Pilgrim\'s Pride Corporation",62,9369,0],["PPCB","Propanc Biopharma Inc.",8,10,0],["PPEM","PPEM",1,0,0],["PPG","PPG Industries Inc.",149,23041,0],["PPH","PPH",1,0,0],["PPI","PPI",1,0,0],["PPIE","PPIE",1,0,0],["PPIH","Perma-Pipe International Holdings Inc.",101,261,0],["PPL","PPL Corporation",41,25366,0],["PPLT","PPLT",1,0,0],["PPSI","Pioneer Power Solutions Inc.",39,42,0],["PPT","Putnam Premier Income Trust",116,351,0],["PPTA","Perpetua Resources Corp.",104,3364,0],["PPTY","PPTY",1,0,0],["PQAP","PQAP",1,0,0],["PQDI","PQDI",1,0,0],["PQJA","PQJA",1,0,0],["PQJL","PQJL",1,0,0],["PQNT","PQNT",1,0,0],["PQOC","PQOC",1,0,0],["PR","Permian Resources Corporation Class A",59,11461,0],["PRA","ProAssurance Corporation",22,1239,0],["PRAA","PRA Group Inc.",44,661,0],["PRAE","PRAE",1,0,0],["PRAX","Praxis Precision Medicines Inc.",8,6825,0],["PRAY","PRAY",1,0,0],["PRCH","Porch Group Inc.",25,1106,0],["PRCS","PRCS",1,0,0],["PRCT","PROCEPT BioRobotics Corporation",31,1791,0],["PRDO","Perdoceo Education Corporation",3,1886,0],["PRE","Prenetics Global Limited Class A",2,228,0],["PREF","PREF",1,0,0],["PRF","PRF",1,0,0],["PRFD","PRFD",1,0,0],["PRFX","PainReform Ltd.",8,2,0],["PRFZ","PRFZ",1,0,0],["PRG","PROG Holdings Inc.",12,1184,0],["PRGO","Perrigo Company plc",8,1821,0],["PRGS","Progress Software Corporation",25,1845,0],["PRH","Prudential Financial Inc. 5.950% Junior Subordinated Notes due 2062",5,8744,0],["PRHI","Presurance Holdings Inc.",22,11,0],["PRHIZ","Presurance Holdings Inc. 9.75% Senior Unsecured Notes due 2028",22,214,0],["PRI","Primerica Inc.",5,8261,0],["PRIF/PD","PRIF/PD",1,0,0],["PRIF/PJ","PRIF/PJ",1,0,0],["PRIF/PK","PRIF/PK",1,0,0],["PRIF/PL","PRIF/PL",1,0,0],["PRIM","Primoris Services Corporation",128,6764,0],["PRIV","PRIV",1,0,0],["PRK","Park National Corporation",26,2607,0],["PRKS","United Parks & Resorts Inc.",77,1891,0],["PRLB","Proto Labs Inc.",55,1234,0],["PRLD","Prelude Therapeutics Incorporated",8,135,0],["PRM","Perimeter Solutions SA",34,4188,0],["PRMB","Primo Brands Corporation Class A",46,5887,0],["PRME","Prime Medicine Inc.",13,657,0],["PRMR","PRMR",1,0,0],["PRN","PRN",1,0,0],["PROF","Profound Medical Corp.",31,229,0],["PROK","ProKidney Corp. Class A",13,713,0],["PROP","Prairie Operating Co.",44,100,0],["PROV","Provident Financial Holdings Inc.",84,103,0],["PRPH","ProPhase Labs Inc.",8,4,0],["PRPL","Purple Innovation Inc.",73,81,0],["PRPO","Precipio Inc. ",71,39,0],["PRQR","ProQR Therapeutics N.V.",8,233,0],["PRS","Prudential Financial Inc. 5.625% Junior Subordinated Notes due 2058",5,8427,0],["PRSD","PRSD",1,0,0],["PRSO","Peraso Inc.",6,10,0],["PRSU","Pursuit Attractions and Hospitality Inc.",36,991,0],["PRT","PermRock Royalty Trust",59,47,0],["PRTA","Prothena Corporation plc",8,496,0],["PRTC","PureTech Health plc",8,412,0],["PRTH","Priority Technology Holdings Inc.",36,459,0],["PRTS","CarParts.com Inc.",141,31,0],["PRU","Prudential Financial Inc.",5,44813,0],["PRVA","Privia Health Group Inc.",35,2908,0],["PRVS","PRVS",1,0,0],["PRXG","PRXG",1,0,0],["PRXV","PRXV",1,0,0],["PRZO","ParaZero Technologies Ltd.",21,19,0],["PSA","Public Storage",30,45471,0],["PSA/PF","PSA/PF",1,0,0],["PSA/PG","PSA/PG",1,0,0],["PSA/PH","PSA/PH",1,0,0],["PSA/PI","PSA/PI",1,0,0],["PSA/PJ","PSA/PJ",1,0,0],["PSA/PK","PSA/PK",1,0,0],["PSA/PL","PSA/PL",1,0,0],["PSA/PM","PSA/PM",1,0,0],["PSA/PN","PSA/PN",1,0,0],["PSA/PO","PSA/PO",1,0,0],["PSA/PP","PSA/PP",1,0,0],["PSA/PQ","PSA/PQ",1,0,0],["PSA/PR","PSA/PR",1,0,0],["PSA/PS","PSA/PS",1,0,0],["PSBD","Palmer Square Capital BDC Inc.",1,0,0],["PSC","PSC",1,0,0],["PSCC","PSCC",1,0,0],["PSCD","PSCD",1,0,0],["PSCE","PSCE",1,0,0],["PSCF","PSCF",1,0,0],["PSCH","PSCH",1,0,0],["PSCI","PSCI",1,0,0],["PSCM","PSCM",1,0,0],["PSCT","PSCT",1,0,0],["PSCU","PSCU",1,0,0],["PSEC","Prospect Capital Corporation",44,1158,0],["PSEC/PA","PSEC/PA",1,0,0],["PSET","PSET",1,0,0],["PSF","Cohen & Steers Select Preferred and Income Fund Inc.",11,991,0],["PSFE","Paysafe Limited",36,481,0],["PSHG","Performance Shipping Inc.",98,28,0],["PSI","PSI",1,0,0],["PSIG","PS International Group Ltd.",105,36,0],["PSIL","PSIL",1,0,0],["PSIX","Power Solutions International Inc.",7,1584,0],["PSK","PSK",1,0,0],["PSKY","Paramount Skydance Corporation Class B",83,14396,0],["PSL","PSL",1,0,0],["PSLV","PSLV",1,0,0],["PSMT","PriceSmart Inc.",113,3851,0],["PSN","Parsons Corporation",15,6536,0],["PSNL","Personalis Inc.",23,759,0],["PSNY","Polestar Automotive Holding UK PLC Class A ADS",37,985,0],["PSNYW","Polestar Automotive Holding UK PLC Class C-1 ADS (ADW)",37,423,0],["PSO","Pearson Plc",145,8945,0],["PSP","PSP",1,0,0],["PSQ","PSQ",1,0,0],["PSQA","PSQA",1,0,0],["PSQH","PSQ Holdings Inc. Class A",58,47,0],["PSQO","PSQO",1,0,0],["PSR","PSR",1,0,0],["PST","PST",1,0,0],["PSTG","Pure Storage Inc. Class A",76,22825,0],["PSTL","Postal Realty Trust Inc. Class A",30,420,0],["PSTP","PSTP",1,0,0],["PSTR","PSTR",1,0,0],["PSTV","PLUS THERAPEUTICS Inc.",31,78,0],["PSWD","PSWD",1,0,0],["PSX","Phillips 66",106,51933,0],["PT","Pintec Technology Holdings Limited",16,15,0],["PTA","Cohen & Steers Tax-Advantaged Preferred Securities and Income Fund",81,1064,0],["PTBD","PTBD",1,0,0],["PTC","PTC Inc.",25,21282,0],["PTCT","PTC Therapeutics Inc.",8,6308,0],["PTEN","Patterson-UTI Energy Inc.",59,2211,0],["PTF","PTF",1,0,0],["PTGX","Protagonist Therapeutics Inc.",8,5379,0],["PTH","PTH",1,0,0],["PTHL","Pheton Holdings Ltd Class A",77,7,0],["PTHS","Pelthos Therapeutics Inc.",13,78,0],["PTIN","PTIN",1,0,0],["PTIR","PTIR",1,0,0],["PTIX","Protagenic Therapeutics Inc.",8,2,0],["PTL","PTL",1,0,0],["PTLE","PTL LTD Class A",80,10,0],["PTLO","Portillo\'s Inc. Class A",68,347,0],["PTN","Palatin Technologies Inc.",8,29,0],["PTNQ","PTNQ",1,0,0],["PTON","Peloton Interactive Inc. Class A",61,2590,0],["PTRB","PTRB",1,0,0],["PTRN","Pattern Group Inc. Series A",57,1840,0],["PTY","Pimco Corporate & Income Opportunity Fund",11,0,0],["PUBM","PubMatic Inc. Class A",16,410,0],["PUI","PUI",1,0,0],["PUK","Prudential Public Limited Company",5,39402,0],["PULM","Pulmatrix Inc.",8,9,0],["PULS","PULS",1,0,0],["PULT","PULT",1,0,0],["PUMP","ProPetro Holding Corp.",20,947,0],["PURR","Hyperliquid Strategies Inc",8,433,0],["PUSH","PUSH",1,0,0],["PVAL","PVAL",1,0,0],["PVH","PVH Corp.",118,3234,0],["PVI","PVI",1,0,0],["PVL","Permianville Royalty Trust",59,58,0],["PVLA","Palvella Therapeutics Inc.",8,1180,0],["PW","Power REIT (MD)",30,3,0],["PW/PA","PW/PA",1,0,0],["PWB","PWB",1,0,0],["PWER","PWER",1,0,0],["PWP","Perella Weinberg Partners Class A",44,1545,0],["PWR","Quanta Services Inc.",82,63622,0],["PWRD","PWRD",1,0,0],["PWV","PWV",1,0,0],["PWZ","PWZ",1,0,0],["PX","P10 Inc. Class A",11,1090,0],["PXE","PXE",1,0,0],["PXED","Phoenix Education Partners Inc.",3,1177,0],["PXF","PXF",1,0,0],["PXH","PXH",1,0,0],["PXI","PXI",1,0,0],["PXJ","PXJ",1,0,0],["PXLW","Pixelworks Inc. ",6,40,0],["PXS","Pyxis Tankers Inc.",98,31,0],["PY","PY",1,0,0],["PYLD","PYLD",1,0,0],["PYPD","PolyPid Ltd.",8,40,0],["PYPG","PYPG",1,0,0],["PYPL","PayPal Holdings Inc.",12,55961,0],["PYPY","PYPY",1,0,0],["PYT","PPlus Tr GSC-2 Tr Ctf Fltg Rate",44,0,0],["PYXS","Pyxis Oncology Inc.",8,116,0],["PYZ","PYZ",1,0,0],["PZA","PZA",1,0,0],["PZG","Paramount Gold Nevada Corp.",10,93,0],["PZT","PZT",1,0,0],["PZZA","Papa John\'s International Inc.",68,1340,0],["Q","Qnity Electronics Inc.",6,16694,0],["QABA","QABA",1,0,0],["QAI","QAI",1,0,0],["QALT","QALT",1,0,0],["QARP","QARP",1,0,0],["QAT","QAT",1,0,0],["QB","QB",1,0,0],["QBIG","QBIG",1,0,0],["QBTS","D-Wave Quantum Inc.",15,9390,0],["QBTZ","QBTZ",1,0,0],["QBUF","QBUF",1,0,0],["QBY","QBY",1,0,0],["QCLN","QCLN",1,0,0],["QCLR","QCLR",1,0,0],["QCLS","Q/C Technologies Inc.",24,20,0],["QCMD","QCMD",1,0,0],["QCML","QCML",1,0,0],["QCMU","QCMU",1,0,0],["QCOM","QUALCOMM Incorporated",49,187693,0],["QCRH","QCR Holdings Inc.",26,1441,0],["QD","Qudian Inc.",44,632,0],["QDEF","QDEF",1,0,0],["QDEL","QuidelOrtho Corporation",24,1967,0],["QDF","QDF",1,0,0],["QDIV","QDIV",1,0,0],["QDPL","QDPL",1,0,0],["QDTY","QDTY",1,0,0],["QDVO","QDVO",1,0,0],["QEFA","QEFA",1,0,0],["QEMM","QEMM",1,0,0],["QETA","Quetta Acquisition Corporation",2,0,0],["QFIN","Qfin Holdings Inc.",44,2556,0],["QFLR","QFLR",1,0,0],["QGEN","Qiagen N.V.",13,9851,0],["QGRO","QGRO",1,0,0],["QGRW","QGRW",1,0,0],["QH","Quhuo Limited American Depository Shares",36,1,0],["QHDG","QHDG",1,0,0],["QID","QID",1,0,0],["QIDX","QIDX",1,0,0],["QINT","QINT",1,0,0],["QIPT","Quipt Home Medical Corp.",137,155,0],["QIS","QIS",1,0,0],["QLD","QLD",1,0,0],["QLDY","QLDY",1,0,0],["QLTA","QLTA",1,0,0],["QLTI","QLTI",1,0,0],["QLTY","QLTY",1,0,0],["QLV","QLV",1,0,0],["QLVD","QLVD",1,0,0],["QLVE","QLVE",1,0,0],["QLYS","Qualys Inc.",25,5119,0],["QMCO","Quantum Corporation",76,100,0],["QMID","QMID",1,0,0],["QMOM","QMOM",1,0,0],["QNCX","Quince Therapeutics Inc.",13,199,0],["QNRX","Quoin Pharmaceuticals Ltd.",31,154,0],["QNST","QuinStreet Inc.",36,821,0],["QNTM","Quantum Biopharma Ltd. Class B Subordinate Voting Shares",8,34,0],["QNXT","QNXT",1,0,0],["QOWZ","QOWZ",1,0,0],["QPUX","QPUX",1,0,0],["QPX","QPX",1,0,0],["QQA","QQA",1,0,0],["QQDN","QQDN",1,0,0],["QQEW","QQEW",1,0,0],["QQH","QQH",1,0,0],["QQHG","QQHG",1,0,0],["QQJG","QQJG",1,0,0],["QQLV","QQLV",1,0,0],["QQMG","QQMG",1,0,0],["QQQ","QQQ",1,0,0],["QQQA","QQQA",1,0,0],["QQQD","QQQD",1,0,0],["QQQE","QQQE",1,0,0],["QQQG","QQQG",1,0,0],["QQQH","QQQH",1,0,0],["QQQI","QQQI",1,0,0],["QQQJ","QQQJ",1,0,0],["QQQM","QQQM",1,0,0],["QQQP","QQQP",1,0,0],["QQQS","QQQS",1,0,0],["QQQT","QQQT",1,0,0],["QQQU","QQQU",1,0,0],["QQQX","Nuveen NASDAQ 100 Dynamic Overwrite Fund Shares of Beneficial Interest",116,0,0],["QQQY","QQQY",1,0,0],["QQUP","QQUP",1,0,0],["QQWZ","QQWZ",1,0,0],["QQXL","QQXL",1,0,0],["QQXT","QQXT",1,0,0],["QRFT","QRFT",1,0,0],["QRHC","Quest Resource Holding Corporation",122,44,0],["QRMI","QRMI",1,0,0],["QRVO","Qorvo Inc.",6,7912,0],["QS","QuantumScape Corporation Class A",7,6873,0],["QSEA","Quartzsea Acquisition Corporation",2,0,0],["QSEAU","QSEAU",1,0,0],["QSI","Quantum-Si Incorporated Class A",7,274,0],["QSIX","QSIX",1,0,0],["QSML","QSML",1,0,0],["QSR","Restaurant Brands International Inc.",68,31858,0],["QSU","QSU",1,0,0],["QTEC","QTEC",1,0,0],["QTOP","QTOP",1,0,0],["QTPI","QTPI",1,0,0],["QTR","QTR",1,0,0],["QTRX","Quanterix Corporation",71,308,0],["QTTB","Q32 Bio Inc.",8,36,0],["QTUM","QTUM",1,0,0],["QTWO","Q2 Holdings Inc.",25,4636,0],["QUAD","Quad Graphics Inc Class A",109,329,0],["QUBT","Quantum Computing Inc.",25,2441,0],["QUIK","QuickLogic Corporation",6,109,0],["QUIZ","QUIZ",1,0,0],["QULL","QULL",1,0,0],["QUMS","Quantumsphere Acquisition Corp.",1,0,0],["QUMSU","Quantumsphere Acquisition Corp.",1,0,0],["QURE","uniQure N.V.",8,1494,0],["QUS","QUS",1,0,0],["QUSA","QUSA",1,0,0],["QVAL","QVAL",1,0,0],["QVCGA","QVC Group Inc. Series A",57,101,0],["QVCGP","QVC Group Inc. 8.0% Fixed Rate Cumulative Redeemable",57,33,0],["QVML","QVML",1,0,0],["QVMM","QVMM",1,0,0],["QVMS","QVMS",1,0,0],["QWLD","QWLD",1,0,0],["QXO","QXO Inc.",130,14702,0],["QXO/PB","QXO/PB",1,0,0],["QXQ","QXQ",1,0,0],["QYLD","QYLD",1,0,0],["QYLG","QYLG",1,0,0],["R","Ryder System Inc.",96,7735,0],["RA","Brookfield Real Assets Income Fund Inc.",11,0,0],["RAA","RAA",1,0,0],["RAAA","RAAA",1,0,0],["RAAQ","Real Asset Acquisition Corp. Class A",1,0,0],["RAAQU","Real Asset Acquisition Corp. Unit",2,0,0],["RAAX","RAAX",1,0,0],["RAC","Rithm Acquisition Corp. Class A",1,0,0],["RAC.U","RAC.U",1,0,0],["RACE","Ferrari N.V.",37,91689,0],["RADX","Radiopharm Theranostics Limited",8,66,0],["RAFE","RAFE",1,0,0],["RAIL","FreightCar America Inc.",117,173,0],["RAIN","Rain Enhancement Technologies Holdco Inc. Class A",7,60,0],["RAL","Ralliant Corporation",7,5896,0],["RAMP","LiveRamp Holdings Inc.",15,1886,0],["RAND","Rand Capital Corporation",44,40,0],["RANG","Range Capital Acquisition Corp.",1,0,0],["RANI","Rani Therapeutics Holdings Inc. Class A",8,183,0],["RAPP","Rapport Therapeutics Inc.",8,1470,0],["RAPT","RAPT Therapeutics Inc.",8,937,0],["RARE","Ultragenyx Pharmaceutical Inc.",8,3232,0],["RAUS","RAUS",1,0,0],["RAVE","Rave Restaurant Group Inc.",103,41,0],["RAVI","RAVI",1,0,0],["RAY","Raytech Holding Limited",133,4,0],["RAYA","Erayak Power Solution Group Inc. Class A",55,4,0],["RAYD","RAYD",1,0,0],["RAYE","RAYE",1,0,0],["RAYJ","RAYJ",1,0,0],["RBA","RB Global Inc.",36,19340,0],["RBB","RBB Bancorp",26,370,0],["RBBN","Ribbon Communications Inc.",15,510,0],["RBC","RBC Bearings Incorporated",55,14259,0],["RBCAA","Republic Bancorp Inc. Class A",26,1414,0],["RBIL","RBIL",1,0,0],["RBKB","Rhinebeck Bancorp Inc.",43,138,0],["RBLD","RBLD",1,0,0],["RBLX","Roblox Corporation Class A",25,57516,0],["RBLY","RBLY",1,0,0],["RBNE","Robin Energy Ltd.",98,2,0],["RBOT","Vicarious Surgical Inc. Class A",32,0,0],["RBRK","Rubrik Inc. Class A",25,15647,0],["RC","Ready Capital Corporation",30,362,0],["RC/PC","RC/PC",1,0,0],["RC/PE","RC/PE",1,0,0],["RCAT","Red Cat Holdings Inc.",25,961,0],["RCB","Ready Capital Corporation 6.20% Senior Notes due 2026",30,4026,0],["RCC","Ready Capital Corporation 5.75% Senior Notes due 2026",30,4095,0],["RCD","Ready Capital Corporation 9.00% Senior Notes due 2029",30,0,0],["RCEL","Avita Medical Inc.",31,106,0],["RCG","RENN Fund Inc",11,0,0],["RCGE","RCGE",1,0,0],["RCI","Rogers Communication Inc.",54,19783,0],["RCKT","Rocket Pharmaceuticals Inc.",8,350,0],["RCKY","Rocky Brands Inc.",114,224,0],["RCL","Royal Caribbean Cruises Ltd.",98,80066,0],["RCLO","RCLO",1,0,0],["RCMT","RCM Technologies Inc.",19,154,0],["RCON","Recon Technology Ltd. Class A",20,42,0],["RCS","PIMCO Strategic Income Fund Inc.",11,0,0],["RCT","RedCloud Holdings plc",16,61,0],["RCTR","RCTR",1,0,0],["RCUS","Arcus Biosciences Inc.",8,2373,0],["RDAC","Rising Dragon Acquisition Corp.",1,0,0],["RDACU","Rising Dragon Acquisition Corp. Unit",2,0,0],["RDAG","Republic Digital Acquisition Company Class A",2,0,0],["RDAGU","Republic Digital Acquisition Company Unit",2,0,0],["RDCM","Radcom Ltd.",53,213,0],["RDDT","Reddit Inc. Class A",15,44189,0],["RDGT","Ridgetech Inc.",142,69,0],["RDHL","Redhill Biopharma Ltd.",8,4,0],["RDI","Reading International Inc Class A",89,23,0],["RDIB","Reading International Inc Class B",89,252,0],["RDIV","RDIV",1,0,0],["RDN","Radian Group Inc.",22,4982,0],["RDNT","RadNet Inc.",23,5926,0],["RDNW","RideNow Group Inc. Class B",15,215,0],["RDOG","RDOG",1,0,0],["RDTL","RDTL",1,0,0],["RDTY","RDTY",1,0,0],["RDVT","Red Violet Inc.",25,771,0],["RDVY","RDVY",1,0,0],["RDW","Redwire Corporation",21,1321,0],["RDWR","Radware Ltd.",36,1023,0],["RDY","Dr. Reddy\'s Laboratories Ltd",8,11833,0],["RDYY","RDYY",1,0,0],["RDZN","Roadzen Inc.",28,132,0],["REAI","REAI",1,0,0],["REAL","The RealReal Inc.",66,1812,0],["REAX","The Real Brokerage Inc.",36,820,0],["REBN","Reborn Coffee Inc.",68,9,0],["RECS","RECS",1,0,0],["RECT","Rectitude Holdings Ltd",7,23,0],["REE","REE Automotive Ltd. Class A",37,20,0],["REED","Reed\'s Inc.",1,0,0],["REET","REET",1,0,0],["REFA","REFA",1,0,0],["REFI","Chicago Atlantic Real Estate Finance Inc.",30,274,0],["REFR","Research Frontiers Incorporated",29,49,0],["REG","Regency Centers Corporation",30,12538,0],["REGCO","Regency Centers Corporation 5.875% Series B Cumulative Redeemable",30,4135,0],["REGCP","Regency Centers Corporation 6.25% Series A Cumulative Redeemable",30,4332,0],["REGN","Regeneron Pharmaceuticals Inc.",8,80712,0],["REI","Ring Energy Inc.",59,177,0],["REIT","REIT",1,0,0],["REK","REK",1,0,0],["REKR","Rekor Systems Inc.",33,217,0],["REKT","REKT",1,0,0],["RELI","Reliance Global Group Inc.",28,6,0],["RELL","Richardson Electronics Ltd.",76,156,0],["RELX","RELX PLC PLC",36,74291,0],["RELY","Remitly Global Inc.",36,3056,0],["REMC","REMC",1,0,0],["REMG","REMG",1,0,0],["REMX","REMX",1,0,0],["RENT","Rent the Runway Inc. Class A",66,294,0],["RENX","RenX Enterprises Corp.",1,25,0],["REPL","Replimune Group Inc.",13,775,0],["REPX","Riley Exploration Permian Inc.",59,559,0],["RERE","ATRenew Inc.",66,1174,0],["RES","RPC Inc.",20,1224,0],["RESM","RESM",1,0,0],["RETL","RETL",1,0,0],["RETO","ReTo Eco-Solutions Inc. Class A Shares",7,3,0],["REVB","Revelation Biosciences Inc.",8,5,0],["REVG","REV Group Inc.",37,2991,0],["REVS","REVS",1,0,0],["REW","REW",1,0,0],["REX","REX American Resources Corporation",34,1117,0],["REXR","Rexford Industrial Realty Inc.",30,9585,0],["REXR/PB","REXR/PB",1,0,0],["REXR/PC","REXR/PC",1,0,0],["REYN","Reynolds Consumer Products Inc.",125,5008,0],["REZ","REZ",1,0,0],["REZI","Resideo Technologies Inc.",150,5348,0],["RF","Regions Financial Corporation",26,24254,0],["RF/PC","RF/PC",1,0,0],["RF/PE","RF/PE",1,0,0],["RF/PF","RF/PF",1,0,0],["RFAI","RF Acquisition Corp II",1,0,0],["RFCI","RFCI",1,0,0],["RFDA","RFDA",1,0,0],["RFDI","RFDI",1,0,0],["RFEM","RFEM",1,0,0],["RFEU","RFEU",1,0,0],["RFFC","RFFC",1,0,0],["RFG","RFG",1,0,0],["RFI","Cohen & Steers Total Return Realty Fund Inc.",11,535,0],["RFIL","RF Industries Ltd.",39,64,0],["RFIX","RFIX",1,0,0],["RFL","Rafael Holdings Inc. Class B",36,64,0],["RFLR","RFLR",1,0,0],["RFM","RiverNorth Flexible Municipal Income Fund Inc.",123,86,0],["RFMZ","RiverNorth Flexible Municipal Income Fund II Inc.",81,314,0],["RFV","RFV",1,0,0],["RGA","Reinsurance Group of America Incorporated",5,13517,0],["RGC","Regencell Bioscience Holdings Limited",18,9796,0],["RGCO","RGC Resources Inc.",59,239,0],["RGEF","RGEF",1,0,0],["RGEN","Repligen Corporation",13,9140,0],["RGLD","Royal Gold Inc.",104,19212,0],["RGLO","RGLO",1,0,0],["RGNT","Regentis Biomaterials Ltd.",8,32,0],["RGNX","REGENXBIO Inc.",13,739,0],["RGP","Resources Connection Inc.",36,176,0],["RGR","Sturm Ruger & Company Inc.",78,511,0],["RGS","Regis Corporation",3,72,0],["RGT","Royce Global Trust Inc.",81,81,0],["RGTI","Rigetti Computing Inc.",15,7841,0],["RGTX","RGTX",1,0,0],["RGTZ","RGTZ",1,0,0],["RGYY","RGYY",1,0,0],["RH","RH",66,3211,0],["RHI","Robert Half Inc.",19,2826,0],["RHLD","Resolute Holdings Management",44,1855,0],["RHP","Ryman Hospitality Properties Inc. (REIT)",30,6174,0],["RHRX","RHRX",1,0,0],["RHTX","RHTX",1,0,0],["RIBB","Ribbon Acquisition Corp Class A",1,0,0],["RIBBU","Ribbon Acquisition Corp Unit",1,0,0],["RICK","RCI Hospitality Holdings Inc.",68,201,0],["RIET","RIET",1,0,0],["RIFR","RIFR",1,0,0],["RIG","Transocean Ltd (Switzerland)",59,4373,0],["RIGL","Rigel Pharmaceuticals Inc.",8,755,0],["RIGS","RIGS",1,0,0],["RILA","RILA",1,0,0],["RILY","B. Riley Financial Inc.",11,154,0],["RILYG","B. Riley Financial Inc. 5.00% Senior Notes due 2026",11,588,0],["RILYK","B. Riley Financial Inc. 5.50% Senior Notes Due 2026",11,749,0],["RILYL","B. Riley Financial Inc.",11,171,0],["RILYN","B. Riley Financial Inc. 6.50% Senior Notes Due 2026",11,625,0],["RILYP","B. Riley Financial Inc.",11,162,0],["RILYT","B. Riley Financial Inc. 6.00% Senior Notes Due 2028",11,442,0],["RILYZ","B. Riley Financial Inc. 5.25% Senior Notes due 2028",11,371,0],["RIME","Algorhythm Holdings Inc.",144,4,0],["RINF","RINF",1,0,0],["RING","RING",1,0,0],["RINT","RINT",1,0,0],["RIO","Rio Tinto Plc",10,98236,0],["RIOT","Riot Platforms Inc.",44,5391,0],["RIOX","RIOX",1,0,0],["RISN","RISN",1,0,0],["RISR","RISR",1,0,0],["RITA","RITA",1,0,0],["RITM","Rithm Capital Corp.",30,6190,0],["RITM/PA","RITM/PA",1,0,0],["RITM/PB","RITM/PB",1,0,0],["RITM/PC","RITM/PC",1,0,0],["RITM/PD","RITM/PD",1,0,0],["RITM/PE","RITM/PE",1,0,0],["RITR","Reitar Logtech Holdings Limited",36,87,0],["RIV","RiverNorth Opportunities Fund Inc.",116,0,0],["RIV/PA","RIV/PA",1,0,0],["RIVN","Rivian Automotive Inc. Class A",37,27522,0],["RJDI","RJDI",1,0,0],["RJET","Republic Airways Holdings Inc.",4,56,0],["RJF","Raymond James Financial Inc.",60,32060,0],["RJF/PB","RJF/PB",1,0,0],["RJMG","RJMG",1,0,0],["RJMI","RJMI",1,0,0],["RJVI","RJVI",1,0,0],["RKDA","Arcadia Biosciences Inc.",48,5,0],["RKLB","Rocket Lab Corporation",21,37669,0],["RKLX","RKLX",1,0,0],["RKLZ","RKLZ",1,0,0],["RKT","Rocket Companies Inc. Class A",44,53727,0],["RL","Ralph Lauren Corporation",118,21984,0],["RLAY","Relay Therapeutics Inc.",13,1456,0],["RLGT","Radiant Logistics Inc.",105,303,0],["RLI","RLI Corp.",22,6028,0],["RLJ","RLJ Lodging Trust",30,1178,0],["RLJ/PA","RLJ/PA",1,0,0],["RLMD","Relmada Therapeutics Inc.",8,319,0],["RLTY","Cohen & Steers Real Estate Opportunities and Income Fund",11,0,0],["RLX","RLX Technology Inc.",18,3597,0],["RLY","RLY",1,0,0],["RLYB","Rallybio Corporation",8,33,0],["RM","Regional Management Corp.",44,394,0],["RMAX","RE/MAX Holdings Inc. Class A",36,154,0],["RMBI","Richmond Mutual Bancorporation Inc.",26,152,0],["RMBS","Rambus Inc.",6,10377,0],["RMCA","RMCA",1,0,0],["RMCF","Rocky Mountain Chocolate Factory Inc.",93,12,0],["RMCO","Royalty Management Holding Corporation Class A",29,35,0],["RMD","ResMed Inc.",31,35753,0],["RMI","RiverNorth Opportunistic Municipal Income Fund Inc.",123,93,0],["RMM","RiverNorth Managed Duration Municipal Income Fund Inc.",81,271,0],["RMMZ","RiverNorth Managed Duration Municipal Income Fund II Inc.",11,292,0],["RMNI","Rimini Street Inc. (DE)",36,364,0],["RMNY","RMNY",1,0,0],["RMOP","RMOP",1,0,0],["RMR","The RMR Group Inc. Class A",19,484,0],["RMSG","Real Messenger Corporation",16,15,0],["RMT","Royce Micro-Cap Trust Inc.",11,487,0],["RMTI","Rockwell Medical Inc.",8,33,0],["RNA","Avidity Biosciences Inc.",8,10900,0],["RNAC","Cartesian Therapeutics Inc.",8,188,0],["RNAZ","TransCode Therapeutics Inc.",8,7,0],["RND","RND",1,0,0],["RNEM","RNEM",1,0,0],["RNG","RingCentral Inc. Class A",15,2564,0],["RNGR","Ranger Energy Services Inc. Class A",20,299,0],["RNGT","Range Capital Acquisition Corp II Class A",1,0,0],["RNGTU","Range Capital Acquisition Corp II",1,0,0],["RNIN","RNIN",1,0,0],["RNP","Cohen & Steers REIT and Preferred and Income Fund Inc.",11,961,0],["RNR","RenaissanceRe Holdings Ltd.",22,12842,0],["RNR/PF","RNR/PF",1,0,0],["RNR/PG","RNR/PG",1,0,0],["RNRG","RNRG",1,0,0],["RNST","Renasant Corporation",26,3498,0],["RNTX","Rein Therapeutics Inc.",8,37,0],["RNTY","RNTY",1,0,0],["RNW","ReNew Energy Global plc Class A",41,1941,0],["RNWZ","RNWZ",1,0,0],["RNXT","RenovoRx Inc.",8,34,0],["ROAD","Construction Partners Inc. Class A",21,6169,0],["ROAM","ROAM",1,0,0],["ROBO","ROBO",1,0,0],["ROBT","ROBT",1,0,0],["ROCK","Gibraltar Industries Inc.",27,1475,0],["RODM","RODM",1,0,0],["ROE","ROE",1,0,0],["ROG","Rogers Corporation",34,1684,0],["ROIV","Roivant Sciences Ltd.",8,15586,0],["ROK","Rockwell Automation Inc.",7,44446,0],["ROKT","ROKT",1,0,0],["ROKU","Roku Inc. Class A",54,16078,0],["ROL","Rollins Inc.",12,29107,0],["ROLR","High Roller Technologies Inc.",45,12,0],["ROM","ROM",1,0,0],["ROMA","Roma Green Finance Limited",19,132,0],["RONB","RONB",1,0,0],["ROOT","Root Inc. Class A",22,1146,0],["ROP","Roper Technologies Inc.",16,47898,0],["ROPE","ROPE",1,0,0],["ROSC","ROSC",1,0,0],["ROST","Ross Stores Inc.",120,59000,0],["ROUS","ROUS",1,0,0],["RPAR","RPAR",1,0,0],["RPAY","Repay Holdings Corporation Class A",36,326,0],["RPD","Rapid7 Inc.",25,1014,0],["RPG","RPG",1,0,0],["RPGL","Republic Power Group Limited Class A",25,3,0],["RPID","Rapid Micro Biosystems Inc. Class A",71,140,0],["RPM","RPM International Inc.",149,13480,0],["RPRX","Royalty Pharma plc Class A",8,22281,0],["RPT","Rithm Property Trust Inc.",30,126,0],["RPT/PC","RPT/PC",1,0,0],["RPTX","Repare Therapeutics Inc.",8,92,0],["RPV","RPV",1,0,0],["RQI","Cohen & Steers Quality Income Realty Fund Inc",81,1538,0],["RR","Richtech Robotics Inc. Class B",7,531,0],["RRBI","Red River Bancshares Inc.",47,509,0],["RRC","Range Resources Corporation",59,8177,0],["RRGB","Red Robin Gourmet Burgers Inc.",68,76,0],["RRR","Red Rock Resorts Inc. Class A",47,6683,0],["RRX","Regal Rexnord Corporation",55,9294,0],["RS","Reliance Inc.",55,15215,0],["RSDE","RSDE",1,0,0],["RSF","RiverNorth Capital and Income Fund",11,48,0],["RSG","Republic Services Inc.",122,65980,0],["RSHO","RSHO",1,0,0],["RSI","Rush Street Interactive Inc. Class A",45,4474,0],["RSJN","RSJN",1,0,0],["RSKD","Riskified Ltd. Class A",36,794,0],["RSMC","RSMC",1,0,0],["RSMR","RSMR",1,0,0],["RSMV","RSMV",1,0,0],["RSP","RSP",1,0,0],["RSPA","RSPA",1,0,0],["RSPC","RSPC",1,0,0],["RSPD","RSPD",1,0,0],["RSPE","RSPE",1,0,0],["RSPF","RSPF",1,0,0],["RSPG","RSPG",1,0,0],["RSPH","RSPH",1,0,0],["RSPM","RSPM",1,0,0],["RSPN","RSPN",1,0,0],["RSPR","RSPR",1,0,0],["RSPS","RSPS",1,0,0],["RSPT","RSPT",1,0,0],["RSPU","RSPU",1,0,0],["RSSE","RSSE",1,0,0],["RSSL","RSSL",1,0,0],["RSSS","Research Solutions Inc",15,95,0],["RSVR","Reservoir Media Inc.",45,491,0],["RTAC","Renatus Tactical Acquisition Corp I Class A",2,0,0],["RTACU","Renatus Tactical Acquisition Corp I Unit",2,0,0],["RTH","RTH",1,0,0],["RTO","Rentokil Initial plc",3,7503,0],["RTX","RTX Corporation",50,244034,0],["RTXG","RTXG",1,0,0],["RTYY","RTYY",1,0,0],["RUBI","Rubico Inc.",98,7,0],["RUM","Rumble Inc. Class A",16,3001,0],["RUN","Sunrun Inc.",7,4237,0],["RUNN","RUNN",1,0,0],["RUSC","RUSC",1,0,0],["RUSHA","Rush Enterprises Inc.",97,4360,0],["RUSHB","Rush Enterprises Inc. Class B",97,4511,0],["RVER","RVER",1,0,0],["RVLV","Revolve Group Inc. Class A",57,2068,0],["RVMD","Revolution Medicines Inc.",13,15230,0],["RVNL","RVNL",1,0,0],["RVNU","RVNU",1,0,0],["RVP","Retractable Technologies Inc.",31,25,0],["RVPH","Reviva Pharmaceuticals Holdings Inc.",8,69,0],["RVSB","Riverview Bancorp Inc",84,110,0],["RVSN","Rail Vision Ltd.",117,21,0],["RVT","Royce Small-Cap Trust Inc.",81,1751,0],["RVTY","Revvity Inc.",71,10911,0],["RVYL","Ryvyl Inc.",19,8,0],["RW","RW",1,0,0],["RWAY","Runway Growth Finance Corp.",44,322,0],["RWAYL","Runway Growth Finance Corp. 7.50% Notes due 2027",44,912,0],["RWAYZ","Runway Growth Finance Corp. 8.00% Notes due 2027",44,915,0],["RWJ","RWJ",1,0,0],["RWK","RWK",1,0,0],["RWL","RWL",1,0,0],["RWM","RWM",1,0,0],["RWO","RWO",1,0,0],["RWR","RWR",1,0,0],["RWT","Redwood Trust Inc.",30,733,0],["RWT/PA","RWT/PA",1,0,0],["RWTN","Redwood Trust Inc. 9.125% Senior Notes Due 2029",30,3192,0],["RWTO","Redwood Trust Inc. 9.00% Senior Notes Due 2029",30,3219,0],["RWTP","Redwood Trust Inc. 9.125% Senior Notes Due 2030",30,0,0],["RWTQ","Redwood Trust Inc. 9.500% Senior Notes Due 2030",30,0,0],["RWX","RWX",1,0,0],["RXD","RXD",1,0,0],["RXI","RXI",1,0,0],["RXL","RXL",1,0,0],["RXO","RXO Inc.",87,2225,0],["RXRX","Recursion Pharmaceuticals Inc. Class A",13,2215,0],["RXST","RxSight Inc.",111,495,0],["RXT","Rackspace Technology Inc.",16,251,0],["RY","Royal Bank Of Canada",75,236272,0],["RYAAY","Ryanair Holdings plc",4,38152,0],["RYAM","Rayonier Advanced Materials Inc.",138,383,0],["RYAN","Ryan Specialty Holdings Inc. Class A",28,13948,0],["RYDE","Ryde Group Ltd. Class A",36,31,0],["RYET","Ruanyun Edai Technology Inc.",25,42,0],["RYI","Ryerson Holding Corporation",55,823,0],["RYLD","RYLD",1,0,0],["RYLG","RYLG",1,0,0],["RYM","RYTHM Inc.",48,61,0],["RYN","Rayonier Inc. REIT",30,3352,0],["RYOJ","rYojbaba Co. Ltd.",19,40,0],["RYTM","Rhythm Pharmaceuticals Inc.",8,7484,0],["RZB","Reinsurance Group of America Incorporated 5.75% Fixed-To-Floating Rate Subordinated Debentures due 2056",5,1633,0],["RZC","Reinsurance Group of America Incorporated 7.125% Fixed-Rate Reset Subordinated Debentures due 2052",5,1691,0],["RZG","RZG",1,0,0],["RZLT","Rezolute Inc.",8,164,0],["RZLV","Rezolve AI PLC",16,948,0],["RZV","RZV",1,0,0],["S","SentinelOne Inc. Class A",25,5006,0],["SA","Seabridge Gold Inc.",104,3072,0],["SAA","SAA",1,0,0],["SABA","Saba Capital Income & Opportunities Fund II Shares of Beneficial Interest",1,0,0],["SABR","Sabre Corporation",16,584,0],["SABS","SAB Biotherapeutics Inc.",13,190,0],["SAC.U","SAC.U",1,0,0],["SACH","Sachem Capital Corp.",30,50,0],["SACH/PA","SACH/PA",1,0,0],["SAEF","SAEF",1,0,0],["SAFE","Safehold Inc. New",30,983,0],["SAFT","Safety Insurance Group Inc.",22,1167,0],["SAFX","XCF Global Inc. Class A",34,78,0],["SAGP","SAGP",1,0,0],["SAGT","SAGTEC GLOBAL LIMITED Class A",25,26,0],["SAH","Sonic Automotive Inc.",97,2173,0],["SAIA","Saia Inc.",63,8533,0],["SAIC","Science Applications International Corporation",15,4603,0],["SAIH","SAIHEAT Limited Class A",15,17,0],["SAIL","SailPoint Inc.",25,11805,0],["SAJ","Saratoga Investment Corp 8.00% Notes due 2027",11,396,0],["SAM","Boston Beer Company Inc. (The)",46,2139,0],["SAMG","Silvercrest Asset Management Group Inc. Class A",11,183,0],["SAMM","SAMM",1,0,0],["SAMT","SAMT",1,0,0],["SAN","Banco Santander S.A. Sponsored ADR (Spain)",75,172215,0],["SANA","Sana Biotechnology Inc.",13,1161,0],["SANG","Sangoma Technologies Corporation",16,172,0],["SANM","Sanmina Corporation",39,8268,0],["SAP","SAP SE ADS",25,300160,0],["SAPH","SAPH",1,0,0],["SAR","Saratoga Investment Corp New",11,370,0],["SARK","SARK",1,0,0],["SARO","StandardAero Inc.",50,9586,0],["SAT","Saratoga Investment Corp 6.00% Notes due 2027",11,389,0],["SATA","Strive Inc. Variable Rate Series A Perpetual",1,75816,0],["SATG","SATG",1,0,0],["SATL","Satellogic Inc. Class A",49,279,0],["SATS","EchoStar Corporation",33,29913,0],["SAVA","Cassava Sciences Inc.",8,105,0],["SAWG","SAWG",1,0,0],["SAWS","SAWS",1,0,0],["SAY","Saratoga Investment Corp 8.125% Notes due 2027",11,396,0],["SAZ","Saratoga Investment Corp 8.50% Notes due 2028",11,398,0],["SB","Safe Bulkers Inc",98,505,0],["SB/PC","SB/PC",1,0,0],["SB/PD","SB/PD",1,0,0],["SBAC","SBA Communications Corporation Class A",30,20245,0],["SBAR","SBAR",1,0,0],["SBB","SBB",1,0,0],["SBC","SBC Medical Group Holdings Incorporated",35,464,0],["SBCF","Seacoast Banking Corporation of Florida",26,3113,0],["SBDS","Solo Brands Inc. Class A",61,17,0],["SBET","SharpLink Gaming Inc.",25,1930,0],["SBEV","Splash Beverage Group Inc. (NV)",46,3,0],["SBFG","SB Financial Group Inc.",26,145,0],["SBFM","Sunshine Biopharma Inc.",8,6,0],["SBGI","Sinclair Inc. Class A",83,1109,0],["SBH","Sally Beauty Holdings Inc. (Name to be changed from Sally Holdings Inc.)",66,1488,0],["SBI","Western Asset Intermediate Muni Fund Inc",123,0,0],["SBIL","SBIL",1,0,0],["SBIO","SBIO",1,0,0],["SBIT","SBIT",1,0,0],["SBLK","Star Bulk Carriers Corp.",98,2143,0],["SBLX","StableX Technologies Inc.",33,5,0],["SBND","SBND",1,0,0],["SBR","Sabine Royalty Trust",59,989,0],["SBRA","Sabra Health Care REIT Inc.",30,4660,0],["SBS","Companhia de saneamento Basico Do Estado De Sao Paulo - Sabesp",70,16773,0],["SBSI","Southside Bancshares Inc.",26,964,0],["SBSW","D/B/A Sibanye-Stillwater Limited ADS",104,10133,0],["SBU","SBU",1,0,0],["SBUX","Starbucks Corporation",68,100440,0],["SBXD","SilverBox Corp IV Class A",1,0,0],["SBXD.U","SBXD.U",1,0,0],["SBXE.U","SBXE.U",1,0,0],["SCAG","Scage Future",72,177,0],["SCAP","SCAP",1,0,0],["SCC","SCC",1,0,0],["SCCF","Sachem Capital Corp. 7.125% Notes due 2027",30,1096,0],["SCCG","Sachem Capital Corp. 8.00% Notes due 2027",30,1099,0],["SCCO","Southern Copper Corporation",10,116956,0],["SCCR","SCCR",1,0,0],["SCD","LMP Capital and Income Fund Inc.",81,0,0],["SCDL","SCDL",1,0,0],["SCDS","SCDS",1,0,0],["SCDV","SCDV",1,0,0],["SCE/PG","SCE/PG",1,0,0],["SCE/PK","SCE/PK",1,0,0],["SCE/PL","SCE/PL",1,0,0],["SCE/PM","SCE/PM",1,0,0],["SCE/PN","SCE/PN",1,0,0],["SCHA","SCHA",1,0,0],["SCHB","SCHB",1,0,0],["SCHC","SCHC",1,0,0],["SCHD","SCHD",1,0,0],["SCHE","SCHE",1,0,0],["SCHF","SCHF",1,0,0],["SCHG","SCHG",1,0,0],["SCHH","SCHH",1,0,0],["SCHI","SCHI",1,0,0],["SCHJ","SCHJ",1,0,0],["SCHK","SCHK",1,0,0],["SCHL","Scholastic Corporation",145,679,0],["SCHM","SCHM",1,0,0],["SCHO","SCHO",1,0,0],["SCHP","SCHP",1,0,0],["SCHQ","SCHQ",1,0,0],["SCHR","SCHR",1,0,0],["SCHV","SCHV",1,0,0],["SCHW","Charles Schwab Corporation (The)",60,175597,0],["SCHW/PD","SCHW/PD",1,0,0],["SCHW/PJ","SCHW/PJ",1,0,0],["SCHX","SCHX",1,0,0],["SCHY","SCHY",1,0,0],["SCHZ","SCHZ",1,0,0],["SCI","Service Corporation International",3,10961,0],["SCIIU","SC II Acquisition Corp.",1,0,0],["SCIO","SCIO",1,0,0],["SCJ","SCJ",1,0,0],["SCKT","Socket Mobile Inc.",9,8,0],["SCL","Stepan Company",90,1075,0],["SCLS","SCLS",1,0,0],["SCLX","Scilex Holding Company",13,109,0],["SCM","Stellus Capital Investment Corporation",123,364,0],["SCMB","SCMB",1,0,0],["SCNI","Scinai Immunotherapeutics Ltd.",13,1,0],["SCNX","Scienture Holdings Inc.",112,23,0],["SCO","SCO",1,0,0],["SCOR","comScore Inc.",36,36,0],["SCSC","ScanSource Inc.",100,901,0],["SCUS","SCUS",1,0,0],["SCVL","Shoe Carnival Inc.",120,514,0],["SCWO","374Water Inc.",55,84,0],["SCYB","SCYB",1,0,0],["SCYX","SCYNEXIS Inc.",8,26,0],["SCZ","SCZ",1,0,0],["SD","SandRidge Energy Inc.",59,522,0],["SDA","SunCar Technology Group Inc. Class A",79,202,0],["SDCI","SDCI",1,0,0],["SDCP","SDCP",1,0,0],["SDD","SDD",1,0,0],["SDEM","SDEM",1,0,0],["SDFI","SDFI",1,0,0],["SDG","SDG",1,0,0],["SDGR","Schrodinger Inc.",8,1301,0],["SDHC","Smith Douglas Homes Corp. Class A",121,1032,0],["SDHI","Siddhi Acquisition Corp Class A",2,0,0],["SDHIU","Siddhi Acquisition Corp Unit",2,0,0],["SDHY","PGIM Short Duration High Yield Opportunities Fund",123,404,0],["SDIV","SDIV",1,0,0],["SDOG","SDOG",1,0,0],["SDOT","Sadot Group Inc.",68,3,0],["SDOW","SDOW",1,0,0],["SDP","SDP",1,0,0],["SDRL","Seadrill Limited",59,1969,0],["SDS","SDS",1,0,0],["SDSI","SDSI",1,0,0],["SDST","Stardust Power Inc.",34,32,0],["SDTY","SDTY",1,0,0],["SDVY","SDVY",1,0,0],["SDY","SDY",1,0,0],["SE","Sea Limited",3,72209,0],["SEA","SEA",1,0,0],["SEAL/PA","SEAL/PA",1,0,0],["SEAL/PB","SEAL/PB",1,0,0],["SEAT","Vivid Seats Inc. Class A",45,66,0],["SEB","Seaboard Corporation",48,4251,0],["SECR","SECR",1,0,0],["SEDG","SolarEdge Technologies Inc.",6,1738,0],["SEE","Sealed Air Corporation",34,6076,0],["SEED","Origin Agritech Limited",48,9,0],["SEEM","SEEM",1,0,0],["SEER","Seer Inc. Class A",71,100,0],["SEF","SEF",1,0,0],["SEG","Seaport Entertainment Group Inc.",45,254,0],["SEGG","Lottery.com Inc.",25,4,0],["SEI","Solaris Energy Infrastructure Inc. Class A",88,3078,0],["SEIC","SEI Investments Company",60,10216,0],["SEIE","SEIE",1,0,0],["SEIS","SEIS",1,0,0],["SEIX","SEIX",1,0,0],["SELF","Global Self Storage Inc.",30,56,0],["SELX","Semilux International Ltd.",6,23,0],["SEM","Select Medical Holdings Corporation",126,1859,0],["SEMG","SEMG",1,0,0],["SEMI","SEMI",1,0,0],["SEMR","SEMrush Holdings Inc. Class A",25,1771,0],["SEMY","SEMY",1,0,0],["SENEA","Seneca Foods Corp. Class A",17,772,0],["SENEB","Seneca Foods Corp. Class B",17,787,0],["SENS","Senseonics Holdings Inc.",31,251,0],["SEPI","SEPI",1,0,0],["SEPN","Septerna Inc.",8,1324,0],["SEPT","SEPT",1,0,0],["SEPW","SEPW",1,0,0],["SER","Serina Therapeutics Inc.",8,29,0],["SERA","Sera Prognostics Inc. Class A",23,137,0],["SERV","Serve Robotics Inc.",32,764,0],["SES","SES AI Corporation Class A",7,705,0],["SETH","SETH",1,0,0],["SETM","SETM",1,0,0],["SEV","Aptera Motors Corp. Class B",37,141,0],["SEVN","Seven Hills Realty Trust",30,137,0],["SEZL","Sezzle Inc.",36,2510,0],["SF","Stifel Financial Corporation",60,12974,0],["SF/PB","SF/PB",1,0,0],["SF/PC","SF/PC",1,0,0],["SF/PD","SF/PD",1,0,0],["SFB","Stifel Financial Corporation 5.20% Senior Notes due 2047",60,2161,0],["SFBC","Sound Financial Bancorp Inc.",84,111,0],["SFBS","ServisFirst Bancshares Inc.",26,3968,0],["SFD","Smithfield Foods Inc.",62,8955,0],["SFGV","SFGV",1,0,0],["SFHG","Samfine Creation Holdings Group Limited Class A",109,17,0],["SFIX","Stitch Fix Inc. Class A",57,701,0],["SFL","SFL Corporation Ltd",98,1078,0],["SFLO","SFLO",1,0,0],["SFLR","SFLR",1,0,0],["SFM","Sprouts Farmers Market Inc.",67,7948,0],["SFNC","Simmons First National Corporation Class A",26,2789,0],["SFST","Southern First Bancshares Inc.",26,438,0],["SFTX","SFTX",1,0,0],["SFWL","Shengfeng Development Limited Class A",63,82,0],["SFY","SFY",1,0,0],["SFYF","SFYF",1,0,0],["SFYX","SFYX",1,0,0],["SG","Sweetgreen Inc. Class A",68,811,0],["SGA","Saga Communications Inc. Class A",83,73,0],["SGBX","Safe & Green Holdings Corp.",130,14,0],["SGC","Superior Group of Companies Inc.",86,156,0],["SGDJ","SGDJ",1,0,0],["SGDM","SGDM",1,0,0],["SGHC","Super Group (SGHC) Limited",45,6012,0],["SGHT","Sight Sciences Inc.",31,447,0],["SGI","Somnigroup International Inc.",73,18864,0],["SGLC","SGLC",1,0,0],["SGLY","Singularity Future Technology Ltd.",105,4,0],["SGML","Sigma Lithium Corporation",10,1358,0],["SGMO","Sangamo Therapeutics Inc.",13,150,0],["SGMT","Sagimet Biosciences Inc. Series A",8,204,0],["SGN","Signing Day Sports Inc.",15,5,0],["SGOL","SGOL",1,0,0],["SGOV","SGOV",1,0,0],["SGRP","SPAR Group Inc.",36,19,0],["SGRT","SGRT",1,0,0],["SGRY","Surgery Partners Inc.",126,2031,0],["SGU","Star Group L.P.",66,386,0],["SGVT","SGVT",1,0,0],["SH","SH",1,0,0],["SHAK","Shake Shack Inc. Class A",68,3659,0],["SHBI","Shore Bancshares Inc",26,619,0],["SHC","Sotera Health Company",137,4878,0],["SHCO","Soho House & Co Inc. Class A",47,1748,0],["SHE","SHE",1,0,0],["SHEL","Shell PLC",59,209270,0],["SHEN","Shenandoah Telecommunications Co",33,615,0],["SHFS","SHF Holdings Inc. Class A",44,4,0],["SHG","Shinhan Financial Group Co Ltd",26,26839,0],["SHIM","Shimmick Corporation",21,98,0],["SHIP","Seanergy Maritime Holdings Corp.",98,196,0],["SHLD","SHLD",1,0,0],["SHLS","Shoals Technologies Group Inc. Class A",6,1500,0],["SHM","SHM",1,0,0],["SHMD","SCHMID Group N.V. Class A",7,218,0],["SHNY","SHNY",1,0,0],["SHO","Sunstone Hotel Investors Inc. Sunstone Hotel Investors Inc.",47,1738,0],["SHO/PH","SHO/PH",1,0,0],["SHO/PI","SHO/PI",1,0,0],["SHOC","SHOC",1,0,0],["SHOO","Steven Madden Ltd.",114,3128,0],["SHOP","Shopify Inc. Class A Subordinate Voting Shares",25,220658,0],["SHPD","SHPD",1,0,0],["SHPH","Shuttle Pharmaceuticals Holdings Inc.",8,3,0],["SHPP","SHPP",1,0,0],["SHPU","SHPU",1,0,0],["SHRT","SHRT",1,0,0],["SHRY","SHRY",1,0,0],["SHV","SHV",1,0,0],["SHW","Sherwin-Williams Company (The)",130,79539,0],["SHY","SHY",1,0,0],["SHYG","SHYG",1,0,0],["SHYL","SHYL",1,0,0],["SI","Shoulder Innovations Inc.",31,316,0],["SIBN","SI-BONE Inc.",31,884,0],["SID","Companhia Siderurgica Nacional S.A.",27,2162,0],["SIDU","Sidus Space Inc. Class A",33,41,0],["SIEB","Siebert Financial Corp.",60,164,0],["SIF","SIFCO Industries Inc.",50,41,0],["SIFI","SIFI",1,0,0],["SIFY","Sify Technologies Limited",16,822,0],["SIG","Signet Jewelers Limited",94,3390,0],["SIGA","SIGA Technologies Inc.",8,449,0],["SIGI","Selective Insurance Group Inc.",22,5106,0],["SIGIP","Selective Insurance Group Inc.",22,1020,0],["SIHY","SIHY",1,0,0],["SII","Sprott Inc.",44,2495,0],["SIJ","SIJ",1,0,0],["SIL","SIL",1,0,0],["SILA","Sila Realty Trust Inc.",30,1278,0],["SILC","Silicom Ltd",51,77,0],["SILJ","SILJ",1,0,0],["SILO","Silo Pharma Inc.",86,6,0],["SIM","Grupo Simec S.A.B. de C.V.",27,3995,0],["SIMA","SIM Acquisition Corp. I Class A",7,0,0],["SIMO","Silicon Motion Technology Corporation",6,3016,0],["SIMS","SIMS",1,0,0],["SINT","SiNtx Technologies Inc.",31,15,0],["SIO","SIO",1,0,0],["SION","Sionna Therapeutics Inc.",8,1891,0],["SIOO","SIOO",1,0,0],["SIRI","SiriusXM Holdings Inc.",83,6990,0],["SITC","SITE Centers Corp.",30,330,0],["SITE","SiteOne Landscape Supply Inc.",108,5726,0],["SITM","SiTime Corporation",6,9569,0],["SIVR","SIVR",1,0,0],["SIXA","SIXA",1,0,0],["SIXD","SIXD",1,0,0],["SIXF","SIXF",1,0,0],["SIXG","SIXG",1,0,0],["SIXH","SIXH",1,0,0],["SIXJ","SIXJ",1,0,0],["SIXL","SIXL",1,0,0],["SIXO","SIXO",1,0,0],["SIXP","SIXP",1,0,0],["SIXS","SIXS",1,0,0],["SIXZ","SIXZ",1,0,0],["SIZE","SIZE",1,0,0],["SJ","Scienjoy Holding Corporation Class A",15,26,0],["SJB","SJB",1,0,0],["SJCP","SJCP",1,0,0],["SJLD","SJLD",1,0,0],["SJM","The J.M. Smucker Company",17,10530,0],["SJNK","SJNK",1,0,0],["SJT","San Juan Basin Royalty Trust",59,253,0],["SKBL","Skyline Builders Group Holding Limited Class A",82,75,0],["SKE","Skeena Resources Limited",104,2859,0],["SKF","SKF",1,0,0],["SKIL","Skillsoft Corp. Class A",25,68,0],["SKIN","The Beauty Health Company Class A",31,195,0],["SKK","SKK Holdings Limited",128,5,0],["SKLZ","Skillz Inc. Class A",15,73,0],["SKM","SK Telecom Co. Ltd.",33,7595,0],["SKOR","SKOR",1,0,0],["SKRE","SKRE",1,0,0],["SKT","Tanger Inc.",30,3944,0],["SKWD","Skyward Specialty Insurance Group Inc.",22,2070,0],["SKY","Champion Homes Inc.",121,4862,0],["SKYE","Skye Bioscience Inc.",8,30,0],["SKYH","Sky Harbour Group Corporation Class A",36,650,0],["SKYQ","Sky Quarry Inc.",122,7,0],["SKYT","SkyWater Technology Inc.",6,804,0],["SKYU","SKYU",1,0,0],["SKYW","SkyWest Inc.",4,4175,0],["SKYX","SKYX Platforms Corp.",91,250,0],["SKYY","SKYY",1,0,0],["SLAB","Silicon Laboratories Inc.",6,4436,0],["SLAI","SOLAI Limited",15,11,0],["SLB","SLB Limited",20,56889,0],["SLDB","Solid Biosciences Inc.",13,463,0],["SLDE","Slide Insurance Holdings Inc.",22,2327,0],["SLDP","Solid Power Inc. Class A",7,896,0],["SLDR","SLDR",1,0,0],["SLE","Super League Enterprise Inc.",45,36,0],["SLF","Sun Life Financial Inc.",5,34304,0],["SLG","SL Green Realty Corp",30,3149,0],["SLG/PI","SLG/PI",1,0,0],["SLGB","Smart Logistics Global Limited",105,46,0],["SLGL","Sol-Gel Technologies Ltd.",8,117,0],["SLGN","Silgan Holdings Inc.",125,4317,0],["SLI","Standard Lithium Ltd.",34,1218,0],["SLJY","SLJY",1,0,0],["SLM","SLM Corporation",44,5553,0],["SLMBP","SLM Corporation Floating Rate Non-Cumulative",44,15277,0],["SLMT","Brera Holdings PLC Class B",45,188,0],["SLN","Silence Therapeutics Plc American Depository Share",8,298,0],["SLND","Southland Holdings Inc.",21,206,0],["SLNG","Stabilis Solutions Inc.",140,87,0],["SLNH","Soluna Holdings Inc.",15,147,0],["SLNHP","Soluna Holdings Inc 9.0% Series A Cumulative Perpetual",15,863,0],["SLNO","Soleno Therapeutics Inc.",77,2570,0],["SLNZ","SLNZ",1,0,0],["SLON","SLON",1,0,0],["SLP","Simulations Plus Inc.",15,378,0],["SLQD","SLQD",1,0,0],["SLQT","SelectQuote Inc.",28,234,0],["SLRC","SLR Investment Corp.",123,835,0],["SLRX","Salarius Pharmaceuticals Inc.",8,4,0],["SLS","SELLAS Life Sciences Group Inc.",8,336,0],["SLSN","Solesence Inc.",90,144,0],["SLSR","Solaris Resources Inc.",1,1334,0],["SLTY","SLTY",1,0,0],["SLV","SLV",1,0,0],["SLVM","Sylvamo Corporation",138,1964,0],["SLVO","SLVO",1,0,0],["SLVR","SLVR",1,0,0],["SLX","SLX",1,0,0],["SLXN","Silexion Therapeutics Corp",13,8,0],["SLYG","SLYG",1,0,0],["SLYV","SLYV",1,0,0],["SM","SM Energy Company",59,2140,0],["SMA","SmartStop Self Storage REIT Inc.",30,1737,0],["SMAP","SMAP",1,0,0],["SMBC","Southern Missouri Bancorp Inc.",43,691,0],["SMBK","SmartFinancial Inc.",26,659,0],["SMBS","SMBS",1,0,0],["SMC","Summit Midstream Corporation",107,498,0],["SMCC","SMCC",1,0,0],["SMCF","SMCF",1,0,0],["SMCI","Super Micro Computer Inc.",9,18572,0],["SMCL","SMCL",1,0,0],["SMCO","SMCO",1,0,0],["SMCX","SMCX",1,0,0],["SMCY","SMCY",1,0,0],["SMCZ","SMCZ",1,0,0],["SMDD","SMDD",1,0,0],["SMDX","SMDX",1,0,0],["SMFG","Sumitomo Mitsui Financial Group Inc Unsponsored",75,124755,0],["SMG","Scotts Miracle-Gro Company (The)",85,3402,0],["SMH","SMH",1,0,0],["SMHB","SMHB",1,0,0],["SMHI","SEACOR Marine Holdings Inc.",98,175,0],["SMHX","SMHX",1,0,0],["SMID","Smith-Midland Corporation",38,187,0],["SMIG","SMIG",1,0,0],["SMIZ","SMIZ",1,0,0],["SMJF","SMJ International Holdings Inc. Class A",130,191,0],["SMLF","SMLF",1,0,0],["SMLL","SMLL",1,0,0],["SMLR","Semler Scientific Inc.",77,272,0],["SMLV","SMLV",1,0,0],["SMMT","Summit Therapeutics Inc.",8,13266,0],["SMMU","SMMU",1,0,0],["SMN","SMN",1,0,0],["SMOG","SMOG",1,0,0],["SMOM","SMOM",1,0,0],["SMOX","SMOX",1,0,0],["SMP","Standard Motor Products Inc.",42,838,0],["SMPL","The Simply Good Foods Company",17,1961,0],["SMR","NuScale Power Corporation Class A",55,4865,0],["SMRI","SMRI",1,0,0],["SMRT","SmartRent Inc. Class A",15,395,0],["SMSI","Smith Micro Software Inc.",25,17,0],["SMST","SMST",1,0,0],["SMTC","Semtech Corporation",6,6753,0],["SMTH","SMTH",1,0,0],["SMTI","Sanara MedTech Inc.",32,216,0],["SMTK","SmartKem Inc.",6,9,0],["SMWB","Similarweb Ltd.",16,578,0],["SMX","SMX (Security Matters) Public Limited Company",7,3824,0],["SMXT","Solarmax Technology Inc.",82,44,0],["SMYY","SMYY",1,0,0],["SN","SharkNinja Inc.",133,16176,0],["SNA","Snap-On Incorporated",7,18011,0],["SNAG","SNAG",1,0,0],["SNAL","Snail Inc. Class A",25,37,0],["SNAP","Snap Inc. Class A",16,13016,0],["SNBR","Sleep Number Corporation",73,192,0],["SNCR","Synchronoss Technologies Inc.",15,97,0],["SNCY","Sun Country Airlines Holdings Inc.",4,770,0],["SND","Smart Sand Inc.",74,148,0],["SNDA","Sonida Senior Living Inc.",126,618,0],["SNDK","Sandisk Corporation",76,34823,0],["SNDL","SNDL Inc.",18,494,0],["SNDR","Schneider National Inc.",63,4735,0],["SNDX","Syndax Pharmaceuticals Inc.",8,1805,0],["SNES","SenesTech Inc.",85,12,0],["SNEX","StoneX Group Inc.",60,5000,0],["SNFCA","Security National Financial Corporation Class A",44,240,0],["SNGX","Soligenix Inc.",8,14,0],["SNN","Smith & Nephew SNATS Inc.",32,13944,0],["SNOA","Sonoma Pharmaceuticals Inc.",8,6,0],["SNOW","Snowflake Inc.",25,76126,0],["SNOY","SNOY",1,0,0],["SNPE","SNPE",1,0,0],["SNPS","Synopsys Inc.",25,86137,0],["SNSE","Sensei Biotherapeutics Inc.",8,11,0],["SNSR","SNSR",1,0,0],["SNT","Senstar Technologies Corporation",33,91,0],["SNTG","Sentage Holdings Inc. Class A",44,6,0],["SNTH","SNTH",1,0,0],["SNTI","Senti Biosciences Inc.",13,32,0],["SNV","Synovus Financial Corp.",26,7307,0],["SNV/PD","SNV/PD",1,0,0],["SNV/PE","SNV/PE",1,0,0],["SNWV","SANUWAVE Health Inc.",31,277,0],["SNX","TD SYNNEX Corporation",100,12552,0],["SNY","Sanofi ADS",8,118307,0],["SNYR","Synergy CHC Corp.",112,17,0],["SO","Southern Company (The)",41,93902,0],["SOAR","Volato Group Inc. Class A",87,8,0],["SOBO","South Bow Corporation",107,5689,0],["SOBR","SOBR Safe Inc.",124,2,0],["SOC","Sable Offshore Corp.",59,1128,0],["SOCA","Solarius Capital Acquisition Corp. Class A",1,0,0],["SOCAU","Solarius Capital Acquisition Corp.",2,0,0],["SOCL","SOCL",1,0,0],["SOEZ","SOEZ",1,0,0],["SOFI","SoFi Technologies Inc.",44,34298,0],["SOFR","SOFR",1,0,0],["SOFX","SOFX",1,0,0],["SOGP","Sound Group Inc.",16,66,0],["SOHO","Sotherly Hotels Inc.",30,44,0],["SOHOB","Sotherly Hotels Inc. 8.0% Series B Cumulative Redeemable Perpetual",30,350,0],["SOHON","Sotherly Hotels Inc. 8.25% Series D Cumulative Redeemable Perpetual",30,311,0],["SOHOO","Sotherly Hotels Inc. 7.875% Series C Cumulative Redeemable Perpetual",30,357,0],["SOHU","Sohu.com Limited",15,450,0],["SOJC","Southern Company (The) Series 2017B 5.25% Junior Subordinated Notes due December 1 2077",41,23959,0],["SOJD","Southern Company (The) Series 2020A 4.95% Junior Subordinated Notes due January 30 2080",41,22331,0],["SOJE","Southern Company (The) Series 2020C 4.20% Junior Subordinated Notes due October 15 2060",10,19647,0],["SOJF","Southern Company (The) Series 2025A 6.50% Junior Subordinated Notes due March 15 2085",10,0,0],["SOLC","Canary Marinade Solana ETF Shares of Beneficial Interest",1,2,0],["SOLR","SOLR",1,0,0],["SOLS","Solstice Advanced Materials Inc.",50,7992,0],["SOLT","SOLT",1,0,0],["SOLV","Solventum Corporation",31,14152,0],["SOLZ","SOLZ",1,0,0],["SOMN","Southern Company (The) 2025 Series A Corporate",10,53789,0],["SON","Sonoco Products Company",125,4272,0],["SONM","Sonim Technologies Inc.",33,6,0],["SONO","Sonos Inc.",133,2217,0],["SONY","Sony Group Corporation",133,153035,0],["SOPA","Society Pass Incorporated",36,9,0],["SOPH","SOPHiA GENETICS SA",13,308,0],["SOR","Source Capital Inc. Cmn Shs of BI",11,395,0],["SORA","AsiaStrategy",66,84,0],["SOS","SOS Limited Class A",44,15,0],["SOTK","Sono-Tek Corporation",7,60,0],["SOUL","Soulpower Acquisition Corporation Class A",109,0,0],["SOUL.U","SOUL.U",1,0,0],["SOUN","SoundHound AI Inc Class A",25,4629,0],["SOUX","SOUX",1,0,0],["SOVF","SOVF",1,0,0],["SOWG","Sow Good Inc.",17,6,0],["SOXL","SOXL",1,0,0],["SOXQ","SOXQ",1,0,0],["SOXS","SOXS",1,0,0],["SOXX","SOXX",1,0,0],["SOXY","SOXY",1,0,0],["SOYB","SOYB",1,0,0],["SPAB","SPAB",1,0,0],["SPAI","Safe Pro Group Inc.",32,87,0],["SPAM","SPAM",1,0,0],["SPAQ","SPAQ",1,0,0],["SPB","Spectrum Brands Holdings Inc.",7,1396,0],["SPBC","SPBC",1,0,0],["SPBO","SPBO",1,0,0],["SPBW","SPBW",1,0,0],["SPBX","SPBX",1,0,0],["SPC","SPC",1,0,0],["SPCB","SuperCom Ltd.",6,21,0],["SPCE","Virgin Galactic Holdings Inc.",87,221,0],["SPCT","SPCT",1,0,0],["SPCX","SPCX",1,0,0],["SPCY","SPCY",1,0,0],["SPD","SPD",1,0,0],["SPDG","SPDG",1,0,0],["SPDN","SPDN",1,0,0],["SPDV","SPDV",1,0,0],["SPDW","SPDW",1,0,0],["SPE","Special Opportunities Fund Inc",123,0,0],["SPE/PC","SPE/PC",1,0,0],["SPEG","Silver Pegasus Acquisition Corp Class A",1,0,0],["SPEGU","Silver Pegasus Acquisition Corp Unit",1,0,0],["SPEM","SPEM",1,0,0],["SPEU","SPEU",1,0,0],["SPFF","SPFF",1,0,0],["SPFI","South Plains Financial Inc.",26,654,0],["SPG","Simon Property Group Inc.",30,60374,0],["SPG/PJ","SPG/PJ",1,0,0],["SPGI","S&P Global Inc.",44,155215,0],["SPGM","SPGM",1,0,0],["SPGP","SPGP",1,0,0],["SPH","Suburban Propane Partners L.P.",66,1227,0],["SPHB","SPHB",1,0,0],["SPHD","SPHD",1,0,0],["SPHL","Springview Holdings Ltd Class A",121,35,0],["SPHQ","SPHQ",1,0,0],["SPHR","Sphere Entertainment Co. Class A",45,3293,0],["SPHY","SPHY",1,0,0],["SPIB","SPIB",1,0,0],["SPIP","SPIP",1,0,0],["SPIR","Spire Global Inc. Class A",33,273,0],["SPIT","SPIT",1,0,0],["SPKL","Spark I Acquisition Corp. Class A",1,0,0],["SPLB","SPLB",1,0,0],["SPLV","SPLV",1,0,0],["SPMA","Sound Point Meridian Capital Inc. 8.00% Series A",1,0,0],["SPMB","SPMB",1,0,0],["SPMC","Sound Point Meridian Capital Inc.",1,0,0],["SPMD","SPMD",1,0,0],["SPME","Sound Point Meridian Capital Inc. 7.875% Series B",1,0,0],["SPMO","SPMO",1,0,0],["SPNT","SiriusPoint Ltd.",22,2582,0],["SPNT/PB","SPNT/PB",1,0,0],["SPOG","SPOG",1,0,0],["SPOK","Spok Holdings Inc.",33,266,0],["SPOT","Spotify Technology S.A.",83,118670,0],["SPPL","SIMPPLE LTD.",12,16,0],["SPPP","SPPP",1,0,0],["SPRB","Spruce Biosciences Inc.",8,84,0],["SPRC","SciSparc Ltd.",8,5,0],["SPRE","SPRE",1,0,0],["SPRO","Spero Therapeutics Inc.",8,131,0],["SPRU","Spruce Power Holding Corporation Class A",42,92,0],["SPRX","SPRX",1,0,0],["SPRY","ARS Pharmaceuticals Inc.",8,1037,0],["SPSB","SPSB",1,0,0],["SPSC","SPS Commerce Inc.",25,3415,0],["SPSK","SPSK",1,0,0],["SPSM","SPSM",1,0,0],["SPT","Sprout Social Inc Class A",25,672,0],["SPTB","SPTB",1,0,0],["SPTE","SPTE",1,0,0],["SPTI","SPTI",1,0,0],["SPTL","SPTL",1,0,0],["SPTM","SPTM",1,0,0],["SPTS","SPTS",1,0,0],["SPTU","SPTU",1,0,0],["SPUC","SPUC",1,0,0],["SPUS","SPUS",1,0,0],["SPUT","SPUT",1,0,0],["SPUU","SPUU",1,0,0],["SPVM","SPVM",1,0,0],["SPVU","SPVU",1,0,0],["SPWH","Sportsman\'s Warehouse Holdings Inc.",66,53,0],["SPWO","SPWO",1,0,0],["SPWR","SunPower Inc.",6,145,0],["SPXC","SPX Technologies Inc.",7,10125,0],["SPXD","SPXD",1,0,0],["SPXE","SPXE",1,0,0],["SPXL","SPXL",1,0,0],["SPXN","SPXN",1,0,0],["SPXS","SPXS",1,0,0],["SPXT","SPXT",1,0,0],["SPXU","SPXU",1,0,0],["SPXV","SPXV",1,0,0],["SPXX","Nuveen S&P 500 Dynamic Overwrite Fund",81,0,0],["SPY","SPY",1,0,0],["SPYC","SPYC",1,0,0],["SPYD","SPYD",1,0,0],["SPYG","SPYG",1,0,0],["SPYM","SPYM",1,0,0],["SPYQ","SPYQ",1,0,0],["SPYT","SPYT",1,0,0],["SPYU","SPYU",1,0,0],["SPYV","SPYV",1,0,0],["SPYX","SPYX",1,0,0],["SQFT","Presidio Property Trust Inc. Class A",30,5,0],["SQFTP","Presidio Property Trust Inc. 9.375% Series D Cumulative Redeemable Perpetual",30,22,0],["SQLV","SQLV",1,0,0],["SQM","Sociedad Quimica y Minera S.A.",74,19640,0],["SQNS","Sequans Communications S.A.",6,72,0],["SQQQ","SQQQ",1,0,0],["SR","Spire Inc.",140,4874,0],["SR/PA","SR/PA",1,0,0],["SRAD","Sportradar Group AG Class A",16,6846,0],["SRBK","SR Bancorp Inc.",43,145,0],["SRCE","1st Source Corporation",26,1600,0],["SRE","DBA Sempra",107,56744,0],["SREA","DBA Sempra 5.750% Junior Subordinated Notes due 2079",107,14138,0],["SRET","SRET",1,0,0],["SRFM","Surf Air Mobility Inc.",87,116,0],["SRG","Seritage Growth Properties Class A",36,190,0],["SRG/PA","SRG/PA",1,0,0],["SRHQ","SRHQ",1,0,0],["SRHR","SRHR",1,0,0],["SRI","Stoneridge Inc.",42,162,0],["SRL","Scully Royalty Ltd.",75,109,0],["SRLN","SRLN",1,0,0],["SROI","SROI",1,0,0],["SRPT","Sarepta Therapeutics Inc.",8,2205,0],["SRRK","Scholar Rock Holding Corporation",13,4478,0],["SRS","SRS",1,0,0],["SRTA","Strata Critical Medical Inc. Class A",87,443,0],["SRTS","Sensus Healthcare Inc.",31,63,0],["SRTY","SRTY",1,0,0],["SRV","NXG Cushing Midstream Energy Fund",116,0,0],["SRVR","SRVR",1,0,0],["SRXH","SRX Health Solutions Inc.",46,68,0],["SRZN","Surrozen Inc.",13,187,0],["SSB","SouthState Bank Corporation",26,9768,0],["SSBI","Summit State Bank",26,78,0],["SSD","Simpson Manufacturing Company Inc.",7,6918,0],["SSEA","Starry Sea Acquisition Corp\\tOrdinary Shares",1,0,0],["SSEAU","Starry Sea Acquisition Corp Unit",2,0,0],["SSFI","SSFI",1,0,0],["SSG","SSG",1,0,0],["SSII","SS Innovations International Inc.",31,1108,0],["SSKN","Strata Skin Sciences Inc.",31,7,0],["SSL","Sasol Ltd.",59,4013,0],["SSM","Sono Group N.V.",1,0,0],["SSNC","SS&C Technologies Holdings Inc.",25,21413,0],["SSO","SSO",1,0,0],["SSP","E.W. Scripps Company (The) Class A",83,417,0],["SSPY","SSPY",1,0,0],["SSRM","SSR Mining Inc.",104,4659,0],["SSSS","SuRo Capital Corp.",44,238,0],["SSSSL","SuRo Capital Corp. 6.00% Notes due 2026",44,595,0],["SST","System1 Inc. Class A",16,45,0],["SSTI","SoundThinking Inc.",25,100,0],["SSTK","Shutterstock Inc.",15,650,0],["SSUS","SSUS",1,0,0],["SSXU","SSXU",1,0,0],["SSYS","Stratasys Ltd.",53,642,0],["ST","Sensata Technologies Holding plc",7,4937,0],["STAA","STAAR Surgical Company",111,1251,0],["STAG","Stag Industrial Inc.",30,6956,0],["STAI","ScanTech AI Systems Inc.",39,12,0],["STAK","STAK Inc. Class A",88,5,0],["STAX","STAX",1,0,0],["STBA","S&T Bancorp Inc.",26,1586,0],["STC","Stewart Information Services Corporation",28,2143,0],["STCE","STCE",1,0,0],["STE","STERIS plc (Ireland)",32,24963,0],["STEC","Santech Holdings Limited",11,77,0],["STEL","Stellar Bancorp Inc.",26,1620,0],["STEM","Stem Inc. Class A",7,140,0],["STEP","StepStone Group Inc. Class A",11,7519,0],["STEW","SRH Total Return Fund Inc.",11,0,0],["STEX","Streamex Corp.",77,667,0],["STFS","Star Fashion Culture Holdings Limited Class A",58,3,0],["STG","Sunlands Technology Group",3,82,0],["STGW","Stagwell Inc. Class A",58,1306,0],["STHH","STHH",1,0,0],["STHO","Star Holdings Shares of Beneficial Interest",36,98,0],["STI","Solidion Technology Inc.",7,53,0],["STIM","Neuronetics Inc.",31,96,0],["STIP","STIP",1,0,0],["STK","Columbia Seligman Premium Technology Growth Fund Inc",11,0,0],["STKE","Sol Strategies Inc.",1,43,0],["STKH","Steakholder Foods Ltd.",17,1,0],["STKL","SunOpta Inc.",48,439,0],["STKS","The ONE Group Hospitality Inc.",68,58,0],["STLA","Stellantis N.V.",37,33241,0],["STLD","Steel Dynamics Inc.",27,25451,0],["STM","STMicroelectronics N.V.",6,23191,0],["STN","Stantec Inc",21,10745,0],["STNC","STNC",1,0,0],["STNE","StoneCo Ltd. Class A",15,3883,0],["STNG","Scorpio Tankers Inc.",98,2559,0],["STOK","Stoke Therapeutics Inc.",8,1825,0],["STPZ","STPZ",1,0,0],["STRA","Strategic Education Inc.",3,1889,0],["STRC","Strategy Inc Variable Rate Series A Perpetual Stretch",25,28373,0],["STRD","Strategy Inc 10.00% Series A Perpetual Stride",25,22273,0],["STRF","Strategy Inc 10.00% Series A Perpetual Strife",25,30957,0],["STRK","Strategy Inc 8.00% Series A Perpetual Strike",25,23735,0],["STRL","Sterling Infrastructure Inc.",21,9479,0],["STRN","STRN",1,0,0],["STRO","Sutro Biopharma Inc.",13,85,0],["STRR","Star Equity Holdings Inc.",19,38,0],["STRRP","Star Equity Holdings Inc. 10% Series A Cumulative Perpetual",1,32,0],["STRS","Stratus Properties Inc.",121,201,0],["STRT","STRATTEC SECURITY CORPORATION",42,336,0],["STRV","STRV",1,0,0],["STRW","Strawberry Fields REIT Inc.",30,175,0],["STRZ","Starz Entertainment Corp.",89,191,0],["STSM","STSM",1,0,0],["STSS","Sharps Technology Inc.",31,63,0],["STT","State Street Corporation",26,35892,0],["STT/PG","STT/PG",1,0,0],["STTK","Shattuck Labs Inc.",8,199,0],["STUB","StubHub Holdings Inc. Class A",45,4758,0],["STVN","Stevanato Group S.p.A.",31,6217,0],["STWD","STARWOOD PROPERTY TRUST INC. Starwood Property Trust Inc.",30,6829,0],["STX","Seagate Technology Holdings PLC",76,63290,0],["STXD","STXD",1,0,0],["STXE","STXE",1,0,0],["STXG","STXG",1,0,0],["STXI","STXI",1,0,0],["STXK","STXK",1,0,0],["STXM","STXM",1,0,0],["STXS","Stereotaxis Inc.",77,218,0],["STXT","STXT",1,0,0],["STXV","STXV",1,0,0],["STZ","Constellation Brands Inc.",46,23629,0],["SU","Suncor Energy Inc.",106,51354,0],["SUB","SUB",1,0,0],["SUGP","SU Group Holdings Limited",12,40,0],["SUI","Sun Communities Inc.",30,15179,0],["SUIG","Sui Group Holdings Limited",116,164,0],["SUN","Sunoco LP Common",106,10663,0],["SUNC","SunocoCorp LLC Common",106,2517,0],["SUNE","SUNation Energy Inc.",33,4,0],["SUNS","Sunrise Realty Trust Inc.",30,135,0],["SUPL","SUPL",1,0,0],["SUPN","Supernus Pharmaceuticals Inc.",8,2952,0],["SUPP","SUPP",1,0,0],["SUPV","Grupo Supervielle S.A.",75,1088,0],["SUPX","SuperX AI Technology Limited",1,438,0],["SURE","SURE",1,0,0],["SURG","SurgePays Inc.",58,34,0],["SURI","SURI",1,0,0],["SUSA","SUSA",1,0,0],["SUSB","SUSB",1,0,0],["SUSC","SUSC",1,0,0],["SUSL","SUSL",1,0,0],["SUUN","PowerBank Corporation",129,60,0],["SUZ","Suzano S.A.",138,11971,0],["SVAC","Spring Valley Acquisition Corp. III Class A",2,0,0],["SVACU","Spring Valley Acquisition Corp. III Unit",2,0,0],["SVC","Service Properties Trust",30,321,0],["SVCC","Stellar V Capital Corp. Class A",1,0,0],["SVCO","Silvaco Group Inc.",25,130,0],["SVM","Silvercorp Metals Inc.",104,1906,0],["SVOL","SVOL",1,0,0],["SVRA","Savara Inc.",8,1231,0],["SVRE","SaverOne 2014 Ltd.",15,2,0],["SVRN","OceanPal Inc.",98,118,0],["SVV","Savers Value Village Inc.",66,1423,0],["SW","Smurfit WestRock plc",125,19901,0],["SWAG","Stran & Company Inc.",58,33,0],["SWAN","SWAN",1,0,0],["SWBI","Smith & Wesson Brands Inc.",78,461,0],["SWIM","Latham Group Inc.",64,734,0],["SWK","Stanley Black & Decker Inc.",7,11268,0],["SWKH","SWK Holdings Corporation",146,210,0],["SWKHL","SWK Holdings Corporation 9.00% Senior Notes due 2027",1,307,0],["SWKS","Skyworks Solutions Inc.",6,9697,0],["SWP","SWP",1,0,0],["SWVL","Swvl Holdings Corp Class A",36,19,0],["SWX","Southwest Gas Holdings Inc.",59,5820,0],["SWZ","Total Return Securities Fund",116,0,0],["SXC","SunCoke Energy Inc.",27,607,0],["SXI","Standex International Corporation",7,2726,0],["SXQG","SXQG",1,0,0],["SXT","Sensient Technologies Corporation",34,4110,0],["SXTC","China SXT Pharmaceuticals Inc.",8,187,0],["SXTP","60 Degrees Pharmaceuticals Inc.",8,3,0],["SY","So-Young International Inc. American Depository Shares",15,290,0],["SYBT","Stock Yards Bancorp Inc.",26,1985,0],["SYBX","Synlogic Inc.",8,14,0],["SYF","Synchrony Financial",44,30499,0],["SYF/PA","SYF/PA",1,0,0],["SYF/PB","SYF/PB",1,0,0],["SYFI","SYFI",1,0,0],["SYK","Stryker Corporation",31,135837,0],["SYM","Symbotic Inc. Class A",7,35301,0],["SYNA","Synaptics Incorporated",6,2890,0],["SYNX","Silynxcom Ltd.",133,4,0],["SYPR","Sypris Solutions Inc.",7,52,0],["SYRE","Spyre Therapeutics Inc.",8,2592,0],["SYY","Sysco Corporation",103,35670,0],["SYZ","SYZ",1,0,0],["SZK","SZK",1,0,0],["SZNE","SZNE",1,0,0],["SZZL","Sizzle Acquisition Corp. II Class A",2,0,0],["T","AT&T Inc.",33,171210,0],["T/PA","T/PA",1,0,0],["T/PC","T/PC",1,0,0],["TABD","TABD",1,0,0],["TAC","TransAlta Corporation",41,3728,0],["TACH","Titan Acquisition Corp. Class A",1,0,0],["TACHU","TACHU",1,0,0],["TACK","TACK",1,0,0],["TACN","TACN",1,0,0],["TACO","Berto Acquisition Corp.",2,369,0],["TACOU","Berto Acquisition Corp. Unit",2,0,0],["TACT","TransAct Technologies Incorporated",53,42,0],["TACU","TACU",1,0,0],["TAFI","TAFI",1,0,0],["TAFL","TAFL",1,0,0],["TAFM","TAFM",1,0,0],["TAGG","TAGG",1,0,0],["TAGS","TAGS",1,0,0],["TAK","Takeda Pharmaceutical Company Limited",8,46895,0],["TAL","TAL Education Group",3,6588,0],["TALK","Talkspace Inc.",35,588,0],["TALO","Talos Energy Inc.",59,1858,0],["TALV","TALV",1,0,0],["TAN","TAN",1,0,0],["TANH","Tantech Holdings Ltd.",34,1,0],["TAOP","Taoping Inc.",25,2,0],["TAOX","Tao Synergies Inc.",8,36,0],["TAP","Molson Coors Beverage Company Class B",46,8957,0],["TAP.A","TAP.A",1,0,0],["TARA","Protara Therapeutics Inc. ",13,272,0],["TARK","TARK",1,0,0],["TARS","Tarsus Pharmaceuticals Inc.",13,3455,0],["TASK","TaskUs Inc. Class A",15,1038,0],["TATT","TAT Technologies Ltd.",50,438,0],["TAVI","Tavia Acquisition Corp.",2,0,0],["TAVIU","Tavia Acquisition Corp. Unit",2,0,0],["TAX","TAX",1,0,0],["TAXE","TAXE",1,0,0],["TAXF","TAXF",1,0,0],["TAXI","TAXI",1,0,0],["TAXM","TAXM",1,0,0],["TAXS","TAXS",1,0,0],["TAXT","TAXT",1,0,0],["TAXX","TAXX",1,0,0],["TAYD","Taylor Devices Inc.",7,179,0],["TBB","AT&T Inc. 5.350% Global Notes due 2066",33,158810,0],["TBBB","BBB Foods Inc. Class A",67,3869,0],["TBBK","The Bancorp Inc",26,3025,0],["TBCH","Turtle Beach Corporation",33,265,0],["TBF","TBF",1,0,0],["TBFC","TBFC",1,0,0],["TBFG","TBFG",1,0,0],["TBG","TBG",1,0,0],["TBH","Brag House Holdings Inc.",45,12,0],["TBHC","The Brand House Collective Inc.",66,27,0],["TBI","TrueBlue Inc.",19,142,0],["TBIL","TBIL",1,0,0],["TBLA","Taboola.com Ltd.",16,1156,0],["TBLD","Thornburg Income Builder Opportunities Trust",11,637,0],["TBLL","TBLL",1,0,0],["TBLU","TBLU",1,0,0],["TBMC","Trailblazer Merger Corporation I Class A",2,0,0],["TBN","Tamboran Resources Corporation",59,512,0],["TBPH","Theravance Biopharma Inc.",8,952,0],["TBRG","TruBridge Inc.",15,336,0],["TBT","TBT",1,0,0],["TBUX","TBUX",1,0,0],["TBX","TBX",1,0,0],["TBXU","TBXU",1,0,0],["TC","Token Cat Limited",36,20,0],["TCAF","TCAF",1,0,0],["TCAI","TCAI",1,0,0],["TCAL","TCAL",1,0,0],["TCBI","Texas Capital Bancshares Inc.",26,4226,0],["TCBIO","Texas Capital Bancshares Inc.",26,945,0],["TCBK","TriCo Bancshares",26,1617,0],["TCBS","Texas Community Bancshares Inc.",43,48,0],["TCBX","Third Coast Bancshares Inc.",43,561,0],["TCGL","TechCreate Group Ltd. Class A",15,102,0],["TCHI","TCHI",1,0,0],["TCHP","TCHP",1,0,0],["TCI","Transcontinental Realty Investors Inc.",30,502,0],["TCMD","Tactile Systems Technology Inc.",31,646,0],["TCOM","Trip.com Group Limited",36,47179,0],["TCPA","TransCanada PipeLines Limited 6.250% Junior Subordinated Notes due 2085",1,0,0],["TCPB","TCPB",1,0,0],["TCPC","BlackRock TCP Capital Corp.",123,459,0],["TCRT","Alaunos Therapeutics Inc.",8,8,0],["TCRX","TScan Therapeutics Inc.",13,51,0],["TCV","TCV",1,0,0],["TCX","Tucows Inc. Class A",15,261,0],["TD","Toronto Dominion Bank (The)",75,158463,0],["TDAC","Translational Development Acquisition Corp.",1,0,0],["TDAY","USA TODAY Co. Inc.",124,808,0],["TDC","Teradata Corporation",25,2862,0],["TDF","Templeton Dragon Fund Inc.",123,0,0],["TDG","Transdigm Group Incorporated",21,71909,0],["TDI","TDI",1,0,0],["TDIC","Dreamland Limited Class A",3,7,0],["TDIV","TDIV",1,0,0],["TDOC","Teladoc Health Inc.",35,1283,0],["TDS","Telephone and Data Systems Inc.",33,4456,0],["TDS/PU","TDS/PU",1,0,0],["TDS/PV","TDS/PV",1,0,0],["TDSB","TDSB",1,0,0],["TDSC","TDSC",1,0,0],["TDTF","TDTF",1,0,0],["TDTH","Trident Digital Tech Holdings Ltd American Depository Shares",36,30,0],["TDTT","TDTT",1,0,0],["TDUP","ThredUp Inc. Class A",57,936,0],["TDVG","TDVG",1,0,0],["TDW","Tidewater Inc.",98,2496,0],["TDWD","Tailwind 2.0 Acquisition Corp. Class A",2,0,0],["TDWDU","Tailwind 2.0 Acquisition Corp. Unit",1,0,0],["TDY","Teledyne Technologies Incorporated",7,23945,0],["TE","T1 Energy Inc.",7,1662,0],["TEAD","Teads Holding Co.",16,71,0],["TEAM","Atlassian Corporation Class A",25,42379,0],["TEC","TEC",1,0,0],["TECB","TECB",1,0,0],["TECH","Bio-Techne Corp",13,9079,0],["TECK","Teck Resources Ltd",74,21842,0],["TECL","TECL",1,0,0],["TECS","TECS",1,0,0],["TECTP","Tectonic Financial Inc. 9.00% Fixed-to-Floating Rate Series B Non-Cumulative Perpetual",26,76,0],["TECX","Tectonic Therapeutic Inc.",13,366,0],["TEF","Telefonica SA",33,22340,0],["TEI","Templeton Emerging Markets Income Fund Inc.",116,0,0],["TEK","TEK",1,0,0],["TEKX","TEKX",1,0,0],["TEKY","TEKY",1,0,0],["TEL","TE Connectivity plc",76,67658,0],["TELA","TELA Bio Inc.",31,46,0],["TELO","Telomir Pharmaceuticals Inc.",8,48,0],["TEM","Tempus AI Inc. Class A",16,11468,0],["TEN","Tsakos Energy Navigation Ltd",98,664,0],["TEN/PE","TEN/PE",1,0,0],["TEN/PF","TEN/PF",1,0,0],["TENB","Tenable Holdings Inc.",25,2959,0],["TENX","Tenax Therapeutics Inc.",8,82,0],["TEO","Telecom Argentina SA",33,4876,0],["TEQI","TEQI",1,0,0],["TER","Teradyne Inc.",39,30567,0],["TERG","TERG",1,0,0],["TERN","Terns Pharmaceuticals Inc.",8,4140,0],["TESL","TESL",1,0,0],["TEVA","Teva Pharmaceutical Industries Limited",8,34820,0],["TEX","Terex Corporation",72,3539,0],["TEXN","TEXN",1,0,0],["TEXU","TEXU",1,0,0],["TFC","Truist Financial Corporation",26,64065,0],["TFC/PI","TFC/PI",1,0,0],["TFC/PO","TFC/PO",1,0,0],["TFC/PR","TFC/PR",1,0,0],["TFI","TFI",1,0,0],["TFII","TFI International Inc.",63,8601,0],["TFIN","Triumph Financial Inc.",26,1475,0],["TFIN/P","TFIN/P",1,0,0],["TFLO","TFLO",1,0,0],["TFLR","TFLR",1,0,0],["TFNS","TFNS",1,0,0],["TFPM","Triple Flag Precious Metals Corp.",104,7114,0],["TFPN","TFPN",1,0,0],["TFSA","Terra Income Fund 6 LLC 7.00% Notes due 2026",1,210,0],["TFSL","TFS Financial Corporation",84,4014,0],["TFX","Teleflex Incorporated",31,5387,0],["TG","Tredegar Corporation",55,263,0],["TGB","Taseko Mines Ltd.",104,1982,0],["TGE","The Generation Essentials Group Class A",124,53,0],["TGEN","Tecogen Inc.",7,150,0],["TGHL","The GrowHub Limited Class A",15,10,0],["TGL","Treasure Global Inc.",36,11,0],["TGLB","TGLB",1,0,0],["TGLS","Tecnoglass Inc.",76,2352,0],["TGNA","TEGNA Inc",83,3110,0],["TGRT","TGRT",1,0,0],["TGRW","TGRW",1,0,0],["TGS","Transportadora de Gas del Sur SA TGS",107,4747,0],["TGT","Target Corporation",113,44380,0],["TGTX","TG Therapeutics Inc.",8,4918,0],["TH","Target Hospitality Corp.",47,807,0],["THAR","Tharimmune Inc.",8,436,0],["THC","Tenet Healthcare Corporation",126,17254,0],["THCH","TH International Limited",68,71,0],["THD","THD",1,0,0],["THEQ","THEQ",1,0,0],["THFF","First Financial Corporation",26,759,0],["THG","Hanover Insurance Group Inc",22,6575,0],["THH","TryHard Holdings Limited",45,826,0],["THIR","THIR",1,0,0],["THLV","THLV",1,0,0],["THM","International Tower Hill Mines Ltd.",10,428,0],["THMZ","THMZ",1,0,0],["THNQ","THNQ",1,0,0],["THNR","THNR",1,0,0],["THO","Thor Industries Inc.",121,5602,0],["THQ","abrdn Healthcare Opportunities Fund Shares of Beneficial Interest",116,0,0],["THR","Thermon Group Holdings Inc.",7,1268,0],["THRM","Gentherm Inc",42,1133,0],["THRO","THRO",1,0,0],["THRV","THRV",1,0,0],["THRY","Thryv Holdings Inc.",58,266,0],["THS","Treehouse Foods Inc.",17,1192,0],["THTA","THTA",1,0,0],["THW","abrdn World Healthcare Fund Shares of Beneficial Interest",116,0,0],["THY","THY",1,0,0],["THYF","THYF",1,0,0],["THYM","THYM",1,0,0],["TIC","TIC Solutions Inc.",36,2252,0],["TIER","TIER",1,0,0],["TIGO","Millicom International Cellular S.A.",33,9247,0],["TIGR","UP Fintech Holding Ltd American Depositary Share representing fifteen Class A",60,1675,0],["TII","Titan Mining Corporation",1,231,0],["TIIV","TIIV",1,0,0],["TIL","Instil Bio Inc.",13,76,0],["TILE","Interface Inc.",73,1631,0],["TILL","TILL",1,0,0],["TIMB","TIM S.A.",33,9983,0],["TIME","TIME",1,0,0],["TINS","TINS",1,0,0],["TINT","TINT",1,0,0],["TINY","TINY",1,0,0],["TIP","TIP",1,0,0],["TIPA","TIPA",1,0,0],["TIPB","TIPB",1,0,0],["TIPC","TIPC",1,0,0],["TIPD","TIPD",1,0,0],["TIPT","Tiptree Inc.",22,683,0],["TIPX","TIPX",1,0,0],["TIPZ","TIPZ",1,0,0],["TIRX","TIAN RUIXIANG Holdings Ltd Class A",28,11,0],["TISI","Team Inc.",3,65,0],["TITN","Titan Machinery Inc.",66,372,0],["TIVC","Tivic Health Systems Inc.",77,3,0],["TJGC","TJGC Group Limited",58,14,0],["TJX","TJX Companies Inc. (The)",120,171678,0],["TK","Teekay Corporation Ltd.",98,766,0],["TKC","Turkcell Iletisim Hizmetleri AS",33,5192,0],["TKLF","Tokyo Lifestyle Co. Ltd.",66,12,0],["TKNO","Alpha Teknova Inc.",24,249,0],["TKO","TKO Group Holdings Inc. Class A",45,41638,0],["TKR","Timken Company (The)",55,5939,0],["TLCI","TLCI",1,0,0],["TLF","Tandy Leather Factory Inc.",86,22,0],["TLH","TLH",1,0,0],["TLIH","Ten-League International Holdings Limited",1,12,0],["TLK","PT Telekomunikasi Indonesia Tbk",33,20684,0],["TLN","Talen Energy Corporation",41,17007,0],["TLNC","Talon Capital Corp. Class A",1,0,0],["TLNCU","Talon Capital Corp.",2,0,0],["TLPH","Talphera Inc.",8,51,0],["TLRY","Tilray Brands Inc.",18,1296,0],["TLS","Telos Corporation",15,399,0],["TLSA","Tiziana Life Sciences Ltd.",8,169,0],["TLSI","TriSalus Life Sciences Inc.",23,371,0],["TLT","TLT",1,0,0],["TLTD","TLTD",1,0,0],["TLTE","TLTE",1,0,0],["TLX","Telix Pharmaceuticals Limited",8,2611,0],["TLYS","Tilly\'s Inc.",120,56,0],["TM","Toyota Motor Corporation",37,286267,0],["TMB","TMB",1,0,0],["TMC","TMC the metals company Inc.",10,3262,0],["TMCI","Treace Medical Concepts Inc.",31,164,0],["TMDE","TMD Energy Limited",80,15,0],["TMDX","TransMedics Group Inc.",77,4363,0],["TME","Tencent Music Entertainment Group",83,27555,0],["TMED","TMED",1,0,0],["TMET","TMET",1,0,0],["TMF","TMF",1,0,0],["TMH","TMH",1,0,0],["TMHC","Taylor Morrison Home Corporation",121,5843,0],["TMNL","TMNL",1,0,0],["TMNS","TMNS",1,0,0],["TMO","Thermo Fisher Scientific Inc",7,213338,0],["TMP","Tompkins Financial Corporation",26,1085,0],["TMQ","Trilogy Metals Inc.",104,764,0],["TMSF","TMSF",1,0,0],["TMSL","TMSL",1,0,0],["TMUS","T-Mobile US Inc.",33,220044,0],["TMUSI","T-Mobile US Inc. 5.500% Senior Notes due June 2070",33,0,0],["TMUSL","T-Mobile US Inc. 6.250% Senior Notes due 2069",33,0,0],["TMUSZ","T-Mobile US Inc. 5.500% Senior Notes due March 2070",33,0,0],["TMV","TMV",1,0,0],["TMVE","TMVE",1,0,0],["TNA","TNA",1,0,0],["TNC","Tennant Company",7,1352,0],["TNDM","Tandem Diabetes Care Inc.",31,1496,0],["TNET","TriNet Group Inc.",36,2799,0],["TNGX","Tango Therapeutics Inc.",8,1147,0],["TNGY","TNGY",1,0,0],["TNK","Teekay Tankers Ltd.",98,1863,0],["TNL","Travel Leisure Co. Common Stock",47,4635,0],["TNMG","TNL Mediagene",58,4,0],["TNON","Tenon Medical Inc.",31,18,0],["TNUK","TNUK",1,0,0],["TNXP","Tonix Pharmaceuticals Holding Corp.",8,201,0],["TNYA","Tenaya Therapeutics Inc.",13,150,0],["TOAK","TOAK",1,0,0],["TOGA","TOGA",1,0,0],["TOI","The Oncology Institute Inc.",35,344,0],["TOK","TOK",1,0,0],["TOL","Toll Brothers Inc.",121,13473,0],["TOLZ","TOLZ",1,0,0],["TOMZ","TOMI Environmental Solutions Inc.",34,19,0],["TONX","TON Strategy Company",3,144,0],["TOON","Kartoon Studios Inc.",89,51,0],["TOP","TOP Financial Group Limited Class A",60,39,0],["TOPC","TOPC",1,0,0],["TOPP","Toppoint Holdings Inc.",63,17,0],["TOPS","TOP Ships Inc.",98,23,0],["TOPT","TOPT",1,0,0],["TORO","Toro Corp.",98,106,0],["TOST","Toast Inc. Class A",15,21297,0],["TOT","TOT",1,0,0],["TOTL","TOTL",1,0,0],["TOTR","TOTR",1,0,0],["TOUR","Tuniu Corporation",87,79,0],["TOUS","TOUS",1,0,0],["TOV","TOV",1,0,0],["TOVX","Theriva Biologics Inc.",8,10,0],["TOWN","TowneBank",26,2606,0],["TOYO","TOYO Co. Ltd",69,291,0],["TPB","Turning Point Brands Inc.",152,2083,0],["TPC","Tutor Perini Corporation",136,3691,0],["TPCS","TechPrecision Corporation",55,46,0],["TPET","Trio Petroleum Corp.",59,6,0],["TPG","TPG Inc. Class A",11,24438,0],["TPGXL","TPG Operating Group II L.P. 6.950% Fixed-Rate Junior Subordinated Notes due 2064",1,9048,0],["TPH","Tri Pointe Homes Inc.",121,2757,0],["TPHD","TPHD",1,0,0],["TPIF","TPIF",1,0,0],["TPL","Texas Pacific Land Corporation",59,20655,0],["TPLC","TPLC",1,0,0],["TPLS","TPLS",1,0,0],["TPOR","TPOR",1,0,0],["TPR","Tapestry Inc.",86,25667,0],["TPSC","TPSC",1,0,0],["TPST","Tempest Therapeutics Inc.",8,15,0],["TPTA","Terra Property Trust Inc. 6.00% Notes due 2026",30,577,0],["TPVG","TriplePoint Venture Growth BDC Corp.",3,250,0],["TPYP","TPYP",1,0,0],["TPZ","TPZ",1,0,0],["TQQQ","TQQQ",1,0,0],["TQQY","TQQY",1,0,0],["TR","Tootsie Roll Industries Inc.",93,2755,0],["TRAK","ReposiTrak Inc.",15,238,0],["TRAW","Traws Pharma Inc.",8,10,0],["TRBF","TRBF",1,0,0],["TRC","Tejon Ranch Co",36,424,0],["TRDA","Entrada Therapeutics Inc.",8,420,0],["TREE","LendingTree Inc.",44,716,0],["TREX","Trex Company Inc.",56,3789,0],["TRFK","TRFK",1,0,0],["TRFM","TRFM",1,0,0],["TRGP","Targa Resources Inc.",107,38409,0],["TRI","Thomson Reuters Corporation",109,58555,0],["TRIB","Trinity Biotech plc",24,17,0],["TRIL","TRIL",1,0,0],["TRIN","Trinity Capital Inc.",44,1141,0],["TRINI","Trinity Capital Inc. 7.875% Notes Due 2029",44,1780,0],["TRINZ","Trinity Capital Inc. 7.875% Notes due 2029",44,1770,0],["TRIP","TripAdvisor Inc.",16,1622,0],["TRMB","Trimble Inc.",7,19243,0],["TRMD","TORM plc Class A",98,1910,0],["TRMK","Trustmark Corporation",26,2450,0],["TRN","Trinity Industries Inc.",117,2280,0],["TRND","TRND",1,0,0],["TRNO","Terreno Realty Corporation",36,6274,0],["TRNR","Interactive Strength Inc.",133,4,0],["TRNS","Transcat Inc.",39,556,0],["TRON","Tron Inc.",61,383,0],["TROO","TROOPS Inc.",146,215,0],["TROW","T. Rowe Price Group Inc.",60,22540,0],["TROX","Tronox Holdings plc",34,691,0],["TRP","TC Energy Corporation",107,56599,0],["TRS","TriMas Corporation",32,1428,0],["TRSG","Tungray Technologies Inc Class A",7,19,0],["TRST","TrustCo Bank Corp NY",26,798,0],["TRT","Trio-Tech International",7,45,0],["TRTN/PA","TRTN/PA",1,0,0],["TRTN/PB","TRTN/PB",1,0,0],["TRTN/PC","TRTN/PC",1,0,0],["TRTN/PD","TRTN/PD",1,0,0],["TRTN/PE","TRTN/PE",1,0,0],["TRTN/PF","TRTN/PF",1,0,0],["TRTX","TPG RE Finance Trust Inc.",30,717,0],["TRTX/PC","TRTX/PC",1,0,0],["TRU","TransUnion",44,16913,0],["TRUD","TRUD",1,0,0],["TRUE","TrueCar Inc.",16,190,0],["TRUG","TruGolf Holdings Inc. Class A",61,2,0],["TRUP","Trupanion Inc.",23,1642,0],["TRUT","TRUT",1,0,0],["TRV","The Travelers Companies Inc.",22,65340,0],["TRVG","trivago N.V.",15,204,0],["TRVI","Trevi Therapeutics Inc.",8,1668,0],["TRX","TRX Gold Corporation",104,259,0],["TS","Tenaris S.A.",27,20471,0],["TSAT","Telesat Corporation Class A",55,1026,0],["TSBK","Timberland Bancorp Inc.",43,287,0],["TSCO","Tractor Supply Company",130,27160,0],["TSCV","TSCV",1,0,0],["TSDD","TSDD",1,0,0],["TSE","Trinseo PLC",34,18,0],["TSEC","TSEC",1,0,0],["TSEL","TSEL",1,0,0],["TSEM","Tower Semiconductor Ltd.",6,13317,0],["TSHA","Taysha Gene Therapies Inc.",13,1504,0],["TSI","TCW Strategic Income Fund Inc.",11,0,0],["TSL","TSL",1,0,0],["TSLA","Tesla Inc.",37,1600384,0],["TSLG","TSLG",1,0,0],["TSLI","TSLI",1,0,0],["TSLL","TSLL",1,0,0],["TSLQ","TSLQ",1,0,0],["TSLR","TSLR",1,0,0],["TSLS","TSLS",1,0,0],["TSLX","Sixth Street Specialty Lending Inc.",11,2040,0],["TSLY","TSLY",1,0,0],["TSM","Taiwan Semiconductor Manufacturing Company Ltd.",6,1498653,0],["TSME","TSME",1,0,0],["TSMG","TSMG",1,0,0],["TSMU","TSMU",1,0,0],["TSMX","TSMX",1,0,0],["TSMY","TSMY",1,0,0],["TSMZ","TSMZ",1,0,0],["TSN","Tyson Foods Inc.",62,20643,0],["TSPA","TSPA",1,0,0],["TSPY","TSPY",1,0,0],["TSQ","Townsquare Media Inc. Class A",83,87,0],["TSSI","TSS Inc.",19,218,0],["TSXD","TSXD",1,0,0],["TSXU","TSXU",1,0,0],["TSYY","TSYY",1,0,0],["TT","Trane Technologies plc",42,86443,0],["TTAM","Titan America SA",74,3140,0],["TTAN","ServiceTitan Inc. Class A",25,10174,0],["TTC","Toro Company (The)",153,7604,0],["TTD","The Trade Desk Inc. Class A",16,18019,0],["TTE","TotalEnergies SE",59,143348,0],["TTEC","TTEC Holdings Inc.",19,178,0],["TTEK","Tetra Tech Inc.",21,8986,0],["TTEQ","TTEQ",1,0,0],["TTGT","TechTarget Inc.",33,401,0],["TTI","Tetra Technologies Inc.",59,1206,0],["TTMI","TTM Technologies Inc.",39,7272,0],["TTOP","TTOP",1,0,0],["TTRX","Turn Therapeutics Inc.",8,88,0],["TTSH","Tile Shop Holdings Inc.",73,186,0],["TTT","TTT",1,0,0],["TTWO","Take-Two Interactive Software Inc.",45,45714,0],["TTXD","TTXD",1,0,0],["TTXU","TTXU",1,0,0],["TU","Telus Corporation",33,19520,0],["TUA","TUA",1,0,0],["TUG","TUG",1,0,0],["TUGN","TUGN",1,0,0],["TUR","TUR",1,0,0],["TURB","Turbo Energy S.A.",7,10,0],["TURF","TURF",1,0,0],["TUSB","TUSB",1,0,0],["TUSK","Mammoth Energy Services Inc.",20,89,0],["TUYA","Tuya Inc.",25,1384,0],["TV","Grupo Televisa S.A.B.",83,5577,0],["TVA","Texas Ventures Acquisition III Corp Class A",1,0,0],["TVACU","TVACU",1,0,0],["TVAI","Thayer Ventures Acquisition Corporation II Class A",1,0,0],["TVAIU","Thayer Ventures Acquisition Corporation II Unit",2,0,0],["TVAL","TVAL",1,0,0],["TVC","Tennessee Valley Authority",41,0,0],["TVE","Tennessee Valley Authority",41,0,0],["TVGN","Tevogen Bio Holdings Inc.",13,75,0],["TVRD","Tvardi Therapeutics Inc.",8,37,0],["TVTX","Travere Therapeutics Inc.",8,3088,0],["TW","Tradeweb Markets Inc. Class A",60,24717,0],["TWAV","TaoWeave Inc.",16,7,0],["TWFG","TWFG Inc. Class A",28,1607,0],["TWG","Top Wealth Group Holding Limited Class A",17,6,0],["TWI","Titan International Inc. (DE)",27,502,0],["TWIN","Twin Disc Incorporated",7,223,0],["TWLO","Twilio Inc. Class A",25,21490,0],["TWLVU","Twelve Seas Investment Company III",2,0,0],["TWM","TWM",1,0,0],["TWN","Taiwan Fund Inc. (The)",81,0,0],["TWNP","Twin Hospitality Group Inc. Class A",68,46,0],["TWO","Two Harbors Investment Corp",30,1188,0],["TWO/PA","TWO/PA",1,0,0],["TWO/PB","TWO/PB",1,0,0],["TWO/PC","TWO/PC",1,0,0],["TWOD","Two Harbors Investments Corp 9.375% Senior Notes due 2030",30,0,0],["TWST","Twist Bioscience Corporation",13,1988,0],["TX","Ternium S.A. Ternium S.A.",27,7462,0],["TXBC","TXBC",1,0,0],["TXG","10x Genomics Inc. Class A",71,2031,0],["TXMD","TherapeuticsMD Inc.",8,20,0],["TXN","Texas Instruments Incorporated",6,160181,0],["TXNM","TXNM Energy Inc.",41,6399,0],["TXO","TXO Partners L.P. Common",59,585,0],["TXRH","Texas Roadhouse Inc.",68,11626,0],["TXS","TXS",1,0,0],["TXT","Textron Inc.",50,15765,0],["TXUE","TXUE",1,0,0],["TXUG","TXUG",1,0,0],["TXXD","TXXD",1,0,0],["TXXI","TXXI",1,0,0],["TXXS","TXXS",1,0,0],["TY","Tri Continental Corporation",116,1773,0],["TY/P","TY/P",1,0,0],["TYD","TYD",1,0,0],["TYG","Tortoise Energy Infrastructure Corporation",11,486,0],["TYGO","Tigo Energy Inc.",6,113,0],["TYL","Tyler Technologies Inc.",25,19702,0],["TYLG","TYLG",1,0,0],["TYO","TYO",1,0,0],["TYRA","Tyra Biosciences Inc.",8,1362,0],["TZA","TZA",1,0,0],["TZOO","Travelzoo",58,78,0],["U","Unity Software Inc.",25,19864,0],["UA","Under Armour Inc. Class C",86,1831,0],["UAA","Under Armour Inc. Class A",86,1920,0],["UAE","UAE",1,0,0],["UAL","United Airlines Holdings Inc.",4,36903,0],["UAMY","United States Antimony Corporation",55,675,0],["UAN","CVR Partners LP Common",85,1009,0],["UAVS","AgEagle Aerial Systems Inc.",50,41,0],["UBCP","United Bancorp Inc.",26,82,0],["UBER","Uber Technologies Inc.",36,164793,0],["UBFO","United Security Bancshares",26,182,0],["UBND","UBND",1,0,0],["UBOT","UBOT",1,0,0],["UBR","UBR",1,0,0],["UBRL","UBRL",1,0,0],["UBS","UBS Group AG Registered",26,296337,0],["UBSI","United Bankshares Inc.",26,5608,0],["UBT","UBT",1,0,0],["UBXG","U-BX Technology Ltd. Class A",16,60,0],["UCAR","U Power Limited Class A",42,7,0],["UCB","United Community Banks Inc.",26,3921,0],["UCC","UCC",1,0,0],["UCIB","UCIB",1,0,0],["UCL","uCloudlink Group Inc.",33,73,0],["UCO","UCO",1,0,0],["UCON","UCON",1,0,0],["UCRD","UCRD",1,0,0],["UCTT","Ultra Clean Holdings Inc.",6,1162,0],["UCYB","UCYB",1,0,0],["UDI","UDI",1,0,0],["UDIV","UDIV",1,0,0],["UDMY","Udemy Inc.",3,874,0],["UDN","UDN",1,0,0],["UDOW","UDOW",1,0,0],["UDR","UDR Inc.",30,11782,0],["UE","Urban Edge Properties",36,2434,0],["UEC","Uranium Energy Corp.",52,5989,0],["UEIC","Universal Electronics Inc.",133,42,0],["UEVM","UEVM",1,0,0],["UFCS","United Fire Group Inc.",22,941,0],["UFG","Uni-Fuels Holdings Limited Class A",80,28,0],["UFI","Unifi Inc. New",115,61,0],["UFIV","UFIV",1,0,0],["UFO","UFO",1,0,0],["UFPI","UFP Industries Inc.",56,5431,0],["UFPT","UFP Technologies Inc.",31,1769,0],["UG","United-Guardian Inc.",90,28,0],["UGA","UGA",1,0,0],["UGE","UGE",1,0,0],["UGI","UGI Corporation",107,8174,0],["UGL","UGL",1,0,0],["UGP","Ultrapar Participacoes S.A. (New)",140,3982,0],["UGRO","urban-gro Inc.",32,5,0],["UHAL","U-Haul Holding Company",96,10127,0],["UHAL.B","UHAL.B",1,0,0],["UHG","United Homes Group Inc Class A",121,86,0],["UHS","Universal Health Services Inc.",126,14212,0],["UHT","Universal Health Realty Income Trust",30,575,0],["UI","Ubiquiti Inc.",49,34159,0],["UIS","Unisys Corporation New",15,200,0],["UITB","UITB",1,0,0],["UIVM","UIVM",1,0,0],["UJB","UJB",1,0,0],["UK","Ucommune International Ltd",36,2,0],["UL","Unilever PLC",90,145344,0],["ULBI","Ultralife Corporation",7,96,0],["ULCC","Frontier Group Holdings Inc.",4,1122,0],["ULE","ULE",1,0,0],["ULH","Universal Logistics Holdings Inc.",63,419,0],["ULS","UL Solutions Inc. Class A",139,15468,0],["ULST","ULST",1,0,0],["ULTA","Ulta Beauty Inc.",66,26523,0],["ULTI","ULTI",1,0,0],["ULTY","ULTY",1,0,0],["ULVM","ULVM",1,0,0],["ULY","Urgent.ly Inc.",15,4,0],["UMAC","Unusual Machines Inc.",49,363,0],["UMBF","UMB Financial Corporation",26,9035,0],["UMBFO","UMB Financial Corporation",26,2070,0],["UMC","United Microelectronics Corporation (NEW)",6,20348,0],["UMDD","UMDD",1,0,0],["UMH","UMH Properties Inc.",30,1352,0],["UMH/PD","UMH/PD",1,0,0],["UMI","UMI",1,0,0],["UMMA","UMMA",1,0,0],["UNB","Union Bankshares Inc.",26,109,0],["UNCY","Unicycive Therapeutics Inc.",8,119,0],["UNF","Unifirst Corporation",3,3083,0],["UNFI","United Natural Foods Inc.",103,2047,0],["UNG","UNG",1,0,0],["UNH","UnitedHealth Group Incorporated",23,296590,0],["UNHG","UNHG",1,0,0],["UNIT","Uniti Group Inc.",30,1702,0],["UNIY","UNIY",1,0,0],["UNL","UNL",1,0,0],["UNM","Unum Group",143,13259,0],["UNMA","Unum Group 6.250% Junior Subordinated Notes due 2058",143,3951,0],["UNP","Union Pacific Corporation",117,138936,0],["UNTY","Unity Bancorp Inc.",26,549,0],["UOKA","MDJM LTD Class A",36,3,0],["UONE","Urban One Inc. Class A",83,53,0],["UONEK","Urban One Inc. Class D",83,49,0],["UP","Wheels Up Experience Inc. Class A",87,477,0],["UPAR","UPAR",1,0,0],["UPB","Upstream Bio Inc.",8,1586,0],["UPBD","Upbound Group Inc.",12,1003,0],["UPC","Universe Pharmaceuticals Inc.",8,2,0],["UPGD","UPGD",1,0,0],["UPGR","UPGR",1,0,0],["UPLD","Upland Software Inc.",25,42,0],["UPRO","UPRO",1,0,0],["UPS","United Parcel Service Inc.",63,86467,0],["UPSG","UPSG",1,0,0],["UPST","Upstart Holdings Inc.",44,4630,0],["UPV","UPV",1,0,0],["UPW","UPW",1,0,0],["UPWK","Upwork Inc.",15,2691,0],["UPXI","Upexi Inc.",18,138,0],["URA","URA",1,0,0],["URAA","URAA",1,0,0],["URBN","Urban Outfitters Inc.",120,7294,0],["URE","URE",1,0,0],["URG","Ur Energy Inc",104,549,0],["URGN","UroGen Pharma Ltd.",8,1067,0],["URI","United Rentals Inc.",12,51694,0],["URNJ","URNJ",1,0,0],["URNM","URNM",1,0,0],["UROY","Uranium Royalty Corp.",60,529,0],["URSP","URSP",1,0,0],["URTH","URTH",1,0,0],["URTY","URTY",1,0,0],["USA","Liberty All-Star Equity Fund",116,0,0],["USAC","USA Compression Partners LP Common",107,2779,0],["USAF","USAF",1,0,0],["USAI","USAI",1,0,0],["USAR","USA Rare Earth Inc. Class A",10,1836,0],["USAS","Americas Gold and Silver Corporation",10,1513,0],["USAU","U.S. Gold Corp.",10,272,0],["USB","U.S. Bancorp",26,84188,0],["USB/PA","USB/PA",1,0,0],["USB/PH","USB/PH",1,0,0],["USB/PP","USB/PP",1,0,0],["USB/PQ","USB/PQ",1,0,0],["USB/PR","USB/PR",1,0,0],["USB/PS","USB/PS",1,0,0],["USBC","USBC Inc.",7,289,0],["USCA","USCA",1,0,0],["USCB","USCB Financial Holdings Inc. Class A",26,347,0],["USCI","USCI",1,0,0],["USCL","USCL",1,0,0],["USD","USD",1,0,0],["USDU","USDU",1,0,0],["USDX","USDX",1,0,0],["USE","USE",1,0,0],["USEA","United Maritime Corporation",98,17,0],["USEG","U.S. Energy Corp.",59,55,0],["USFD","US Foods Holding Corp.",103,17256,0],["USFI","USFI",1,0,0],["USFR","USFR",1,0,0],["USG","USG",1,0,0],["USGO","U.S. GoldMining Inc.",104,130,0],["USIG","USIG",1,0,0],["USIN","USIN",1,0,0],["USIO","Usio Inc.",60,38,0],["USL","USL",1,0,0],["USLM","United States Lime & Minerals Inc.",74,3653,0],["USMC","USMC",1,0,0],["USML","USML",1,0,0],["USNA","USANA Health Sciences Inc.",18,364,0],["USNG","USNG",1,0,0],["USNZ","USNZ",1,0,0],["USO","USO",1,0,0],["USOI","USOI",1,0,0],["USOY","USOY",1,0,0],["USPH","U.S. Physical Therapy Inc.",35,1184,0],["USPX","USPX",1,0,0],["USRD","USRD",1,0,0],["USRT","USRT",1,0,0],["USSE","USSE",1,0,0],["USSG","USSG",1,0,0],["USSH","USSH",1,0,0],["UST","UST",1,0,0],["USTB","USTB",1,0,0],["USVM","USVM",1,0,0],["USVN","USVN",1,0,0],["USXF","USXF",1,0,0],["UTEN","UTEN",1,0,0],["UTES","UTES",1,0,0],["UTF","Cohen & Steers Infrastructure Fund Inc",116,0,0],["UTG","Reaves Utility Income Fund",11,0,0],["UTHR","United Therapeutics Corporation",8,22266,0],["UTHY","UTHY",1,0,0],["UTI","Universal Technical Institute Inc",3,1431,0],["UTL","UNITIL Corporation",129,857,0],["UTMD","Utah Medical Products Inc.",31,181,0],["UTRE","UTRE",1,0,0],["UTSI","UTStarcom Holdings Corp.",33,23,0],["UTSL","UTSL",1,0,0],["UTWO","UTWO",1,0,0],["UTWY","UTWY",1,0,0],["UTZ","Utz Brands Inc Class A",17,1467,0],["UUP","UUP",1,0,0],["UUU","Universal Safety Products Inc.",76,12,0],["UUUU","Energy Fuels Inc",74,3576,0],["UVE","UNIVERSAL INSURANCE HOLDINGS INC",22,951,0],["UVSP","Univest Financial Corporation",26,971,0],["UVV","Universal Corporation",48,1342,0],["UWM","UWM",1,0,0],["UWMC","UWM Holdings Corporation Class A",44,7791,0],["UXI","UXI",1,0,0],["UXIN","Uxin Limited ADS",36,703,0],["UXRP","UXRP",1,0,0],["UYG","UYG",1,0,0],["UYLD","UYLD",1,0,0],["UYM","UYM",1,0,0],["UYSC","UY Scuti Acquisition Corp.",2,0,0],["UYSCU","UYSCU",1,0,0],["UZD","Array Digital Infrastructure Inc. 6.250% Senior Notes due 2069",33,1722,0],["UZE","Array Digital Infrastructure Inc. 5.500% Senior Notes due 2070",33,1540,0],["UZF","Array Digital Infrastructure Inc. 5.500% Senior Notes due 2070",33,1539,0],["V","Visa Inc.",36,672559,0],["VABK","Virginia National Bankshares Corporation",26,229,0],["VABS","VABS",1,0,0],["VAC","Marriott Vacations Worldwide Corporation",36,1999,0],["VACH","Voyager Acquisition Corp Class A",1,0,0],["VACHU","Voyager Acquisition Corp Unit",2,0,0],["VACI","Viking Acquisition Corp. I Class A",33,0,0],["VACI.U","VACI.U",1,0,0],["VAL","Valaris Limited",59,3445,0],["VALE","VALE S.A. ",10,54299,0],["VALG","VALG",1,0,0],["VALN","Valneva SE",13,656,0],["VALQ","VALQ",1,0,0],["VALU","Value Line Inc.",11,369,0],["VANI","Vivani Medical Inc.",77,101,0],["VATE","INNOVATE Corp.",55,71,0],["VAW","VAW",1,0,0],["VB","VB",1,0,0],["VBF","Invesco Bond Fund",81,0,0],["VBIL","VBIL",1,0,0],["VBIX","Viewbix Inc.",25,11,0],["VBK","VBK",1,0,0],["VBND","VBND",1,0,0],["VBNK","VersaBank",75,490,0],["VBR","VBR",1,0,0],["VC","Visteon Corporation",42,2725,0],["VCEL","Vericel Corporation",13,1823,0],["VCIC","Vine Hill Capital Investment Corp. Class A",1,0,0],["VCICU","Vine Hill Capital Investment Corp. Unit",2,0,0],["VCIG","VCI Global Limited",12,1,0],["VCIT","VCIT",1,0,0],["VCLN","VCLN",1,0,0],["VCLT","VCLT",1,0,0],["VCOB","VCOB",1,0,0],["VCR","VCR",1,0,0],["VCRB","VCRB",1,0,0],["VCSH","VCSH",1,0,0],["VCTR","Victory Capital Holdings Inc. Class A",11,4086,0],["VCV","Invesco California Value Municipal Income Trust",81,518,0],["VCYT","Veracyte Inc.",23,3393,0],["VDC","VDC",1,0,0],["VDE","VDE",1,0,0],["VDI","VDI",1,0,0],["VEA","VEA",1,0,0],["VECO","Veeco Instruments Inc.",7,1762,0],["VEEA","Veea Inc.",2,37,0],["VEEE","Twin Vee PowerCats Co.",98,4,0],["VEEV","Veeva Systems Inc. Class A",25,36470,0],["VEGA","VEGA",1,0,0],["VEGI","VEGI",1,0,0],["VEL","Velocity Financial Inc.",44,760,0],["VELO","Velo3D Inc.",7,226,0],["VEMY","VEMY",1,0,0],["VENU","Venu Holding Corporation",45,388,0],["VEON","VEON Ltd. ADS",33,3809,0],["VERA","Vera Therapeutics Inc. Class A",8,3587,0],["VERI","Veritone Inc.",15,460,0],["VERO","Venus Concept Inc.",31,4,0],["VERS","VERS",1,0,0],["VERU","Veru Inc.",8,37,0],["VERX","Vertex Inc. Class A",25,3194,0],["VET","Vermilion Energy Inc. Common (Canada)",59,1243,0],["VETZ","VETZ",1,0,0],["VEU","VEU",1,0,0],["VEXC","VEXC",1,0,0],["VFC","V.F. Corporation",118,7275,0],["VFF","Village Farms International Inc.",1,464,0],["VFH","VFH",1,0,0],["VFL","abrdn National Municipal Income Fund",123,0,0],["VFLO","VFLO",1,0,0],["VFS","VinFast Auto Ltd.",37,8022,0],["VG","Venture Global Inc. Class A",140,15546,0],["VGAS","Verde Clean Fuels Inc. Class A",34,116,0],["VGI","Virtus Global Multi-Sector Income Fund",11,0,0],["VGIT","VGIT",1,0,0],["VGK","VGK",1,0,0],["VGLT","VGLT",1,0,0],["VGM","Invesco Trust for Investment Grade Municipals",81,559,0],["VGSH","VGSH",1,0,0],["VGSR","VGSR",1,0,0],["VGT","VGT",1,0,0],["VGUS","VGUS",1,0,0],["VGVT","VGVT",1,0,0],["VGZ","Vista Gold Corp",104,265,0],["VHC","VirnetX Holding Corp",29,78,0],["VHCPU","Vine Hill Capital Investment Corp. II",2,0,0],["VHI","Valhi Inc.",34,336,0],["VHT","VHT",1,0,0],["VIA","Via Transportation Inc. Class A",25,2697,0],["VIASP","Via Renewables Inc. 8.75% Series A Fixed-to-Floating Rate Cumulative Redeemable Perpetual",129,188,0],["VIAV","Viavi Solutions Inc.",6,4022,0],["VICE","VICE",1,0,0],["VICI","VICI Properties Inc.",30,29606,0],["VICR","Vicor Corporation",7,4662,0],["VIDI","VIDI",1,0,0],["VIG","VIG",1,0,0],["VIGI","VIGI",1,0,0],["VIK","Viking Holdings Ltd",98,32455,0],["VINP","Vinci Compass Investments Ltd. Class A",11,815,0],["VIOG","VIOG",1,0,0],["VIOO","VIOO",1,0,0],["VIOT","Viomi Technology Co. Ltd",133,139,0],["VIOV","VIOV",1,0,0],["VIPS","Vipshop Holdings Limited",57,11344,0],["VIR","Vir Biotechnology Inc.",13,801,0],["VIRC","Virco Manufacturing Corporation",32,101,0],["VIRT","Virtu Financial Inc. Class A",60,5176,0],["VIS","VIS",1,0,0],["VIST","Vista Energy S.A.B. de C.V.",59,4420,0],["VITL","Vital Farms Inc.",17,1495,0],["VIV","Telefonica Brasil S.A.",33,19195,0],["VIVK","Vivakor Inc.",122,13,0],["VIVS","VivoSim Labs Inc.",13,5,0],["VIXI","VIXI",1,0,0],["VKI","Invesco Advantage Municipal Income Trust II",116,395,0],["VKQ","Invesco Municipal Trust",81,533,0],["VKTX","Viking Therapeutics Inc.",8,3978,0],["VLGEA","Village Super Market Inc. Class A",67,559,0],["VLLU","VLLU",1,0,0],["VLN","Valens Semiconductor Ltd.",6,158,0],["VLO","Valero Energy Corporation",106,49628,0],["VLRS","Controladora Vuela Compania de Aviacion S.A.B. de C.V.",4,1107,0],["VLT","Invesco High Income Trust II",81,0,0],["VLTO","Veralto Corp",39,24976,0],["VLU","VLU",1,0,0],["VLY","Valley National Bancorp",26,6703,0],["VLYPN","Valley National Bancorp 8.250% Fixed-Rate Reset Non-Cumulative Perpetual",26,14515,0],["VLYPO","Valley National Bancorp 5.50% Fixed-to-Floating Rate Non-Cumulative Perpetual",26,13974,0],["VLYPP","Valley National Bancorp 6.25% Fixed-to-Floating Rate Non-Cumulative Perpetual",26,14025,0],["VMAR","Vision Marine Technologies Inc.",98,5,0],["VMBS","VMBS",1,0,0],["VMC","Vulcan Materials Company (Holding Company)",74,38565,0],["VMD","Viemed Healthcare Inc.",137,282,0],["VMI","Valmont Industries Inc.",55,8108,0],["VMO","Invesco Municipal Opportunity Trust",81,646,0],["VMSB","VMSB",1,0,0],["VNAM","VNAM",1,0,0],["VNCE","Vince Holding Corp.",120,54,0],["VNDA","Vanda Pharmaceuticals Inc.",8,399,0],["VNET","VNET Group Inc.",16,2354,0],["VNIE","VNIE",1,0,0],["VNLA","VNLA",1,0,0],["VNME","Vendome Acquisition Corporation I Class A",2,0,0],["VNMEU","Vendome Acquisition Corporation I Unit",2,0,0],["VNO","Vornado Realty Trust",30,6409,0],["VNO/PL","VNO/PL",1,0,0],["VNO/PM","VNO/PM",1,0,0],["VNO/PN","VNO/PN",1,0,0],["VNO/PO","VNO/PO",1,0,0],["VNOM","Viper Energy Inc. Class A",59,13629,0],["VNQ","VNQ",1,0,0],["VNQI","VNQI",1,0,0],["VNRX","VolitionRX Limited",24,31,0],["VNSE","VNSE",1,0,0],["VNT","Vontier Corporation",7,5493,0],["VNTG","Vantage Corp Class A",105,29,0],["VO","VO",1,0,0],["VOC","VOC Energy Trust",59,48,0],["VOD","Vodafone Group Plc",33,30507,0],["VOE","VOE",1,0,0],["VOLT","VOLT",1,0,0],["VONE","VONE",1,0,0],["VONG","VONG",1,0,0],["VONV","VONV",1,0,0],["VOO","VOO",1,0,0],["VOOG","VOOG",1,0,0],["VOOV","VOOV",1,0,0],["VOR","Vor Biopharma Inc.",13,272,0],["VOT","VOT",1,0,0],["VOTE","VOTE",1,0,0],["VOX","VOX",1,0,0],["VOXR","Vox Royalty Corp.",104,354,0],["VOYA","Voya Financial Inc.",5,7165,0],["VOYA/PB","VOYA/PB",1,0,0],["VOYG","Voyager Technologies Inc. Class A",21,1605,0],["VPC","VPC",1,0,0],["VPG","Vishay Precision Group Inc.",39,515,0],["VPL","VPL",1,0,0],["VPLS","VPLS",1,0,0],["VPU","VPU",1,0,0],["VPV","Invesco Pennsylvania Value Municipal Income Trust",81,247,0],["VRA","Vera Bradley Inc.",86,66,0],["VRAI","VRAI",1,0,0],["VRAR","The Glimpse Group Inc.",15,20,0],["VRAX","Virax Biolabs Group Limited",24,2,0],["VRCA","Verrica Pharmaceuticals Inc.",8,125,0],["VRDN","Viridian Therapeutics Inc.",23,3047,0],["VRE","Veris Residential Inc.",30,1367,0],["VREX","Varex Imaging Corporation",7,512,0],["VRIG","VRIG",1,0,0],["VRM","Vroom Inc.",97,129,0],["VRME","VerifyMe Inc.",15,9,0],["VRNS","Varonis Systems Inc.",25,3940,0],["VRP","VRP",1,0,0],["VRRM","Verra Mobility Corporation Class A",87,3530,0],["VRSK","Verisk Analytics Inc.",12,30387,0],["VRSN","VeriSign Inc.",15,22622,0],["VRT","Vertiv Holdings LLC Class A",7,61105,0],["VRTL","VRTL",1,0,0],["VRTS","Virtus Investment Partners Inc.",11,1091,0],["VRTX","Vertex Pharmaceuticals Incorporated",8,115747,0],["VS","Versus Systems Inc.",15,6,0],["VSA","VisionSys AI Inc.",3,3,0],["VSAT","ViaSat Inc.",49,4573,0],["VSCO","Victorias Secret & Co.",120,4551,0],["VSDA","VSDA",1,0,0],["VSEC","VSE Corporation",21,3637,0],["VSEE","VSee Health Inc.",35,14,0],["VSH","Vishay Intertechnology Inc.",39,2016,0],["VSHY","VSHY",1,0,0],["VSLU","VSLU",1,0,0],["VSME","VS Media Holdings Limited Class A",109,1,0],["VSMV","VSMV",1,0,0],["VSNTV","Versant Media Group Inc. Class A",83,169820,0],["VSOL","VanEck Solana ETF Shares of Beneficial Interest",1,17,0],["VSS","VSS",1,0,0],["VST","Vistra Corp.",41,55239,0],["VSTA","Vasta Platform Limited Class A",3,399,0],["VSTD","Vestand Inc. Class A",68,3,0],["VSTL","VSTL",1,0,0],["VSTM","Verastem Inc.",8,518,0],["VSTS","Vestis Corporation",1,906,0],["VT","VT",1,0,0],["VTAK","Catheter Precision Inc.",31,3,0],["VTC","VTC",1,0,0],["VTEB","VTEB",1,0,0],["VTES","VTES",1,0,0],["VTEX","VTEX Class A",25,720,0],["VTG","VTG",1,0,0],["VTGN","Vistagen Therapeutics Inc.",8,31,0],["VTHR","VTHR",1,0,0],["VTI","VTI",1,0,0],["VTIP","VTIP",1,0,0],["VTMX","Corporacion Inmobiliaria Vesta S.A.B de C.V.",36,2718,0],["VTN","Invesco Trust for Investment Grade New York Municipals",116,224,0],["VTOL","Bristow Group Inc.",87,1052,0],["VTP","VTP",1,0,0],["VTR","Ventas Inc.",30,37156,0],["VTRS","Viatris Inc.",8,13741,0],["VTS","Vitesse Energy Inc.",59,750,0],["VTSI","VirTra Inc.",69,50,0],["VTV","VTV",1,0,0],["VTVT","vTv Therapeutics Inc. Class A",8,142,0],["VTWG","VTWG",1,0,0],["VTWO","VTWO",1,0,0],["VTWV","VTWV",1,0,0],["VTYX","Ventyx Biosciences Inc.",8,624,0],["VUG","VUG",1,0,0],["VUS","VUS",1,0,0],["VUSE","VUSE",1,0,0],["VUSI","VUSI",1,0,0],["VUZI","Vuzix Corporation",49,246,0],["VV","VV",1,0,0],["VVOS","Vivos Therapeutics Inc.",31,18,0],["VVPR","VivoPower International PLC",129,45,0],["VVR","Invesco Senior Income Trust",81,0,0],["VVV","Valvoline Inc.",34,3758,0],["VVX","V2X Inc.",12,1686,0],["VWAV","VisionWave Holdings Inc.",25,131,0],["VWO","VWO",1,0,0],["VWOB","VWOB",1,0,0],["VXF","VXF",1,0,0],["VXUS","VXUS",1,0,0],["VYGR","Voyager Therapeutics Inc.",13,316,0],["VYLD","VYLD",1,0,0],["VYM","VYM",1,0,0],["VYMI","VYMI",1,0,0],["VYNE","VYNE Therapeutics Inc.",8,19,0],["VYX","NCR Voyix Corporation",92,1436,0],["VZ","VZ",1,0,0],["VZLA","Vizsla Silver Corp.",104,1848,0],["W","Wayfair Inc. Class A",57,13255,0],["WAB","Westinghouse Air Brake Technologies Corporation",117,36951,0],["WABC","Westamerica Bancorporation",26,1246,0],["WABF","WABF",1,0,0],["WAFD","WaFd Inc.",26,2556,0],["WAFDP","WaFd Inc.",26,1304,0],["WAFU","Wah Fu Education Group Limited",3,7,0],["WAI","Top KingWin Ltd Class A",36,4,0],["WAL","Western Alliance Bancorporation",26,9504,0],["WAL/PA","WAL/PA",1,0,0],["WALD","Waldencast plc Class A",90,238,0],["WANT","WANT",1,0,0],["WAR","WAR",1,0,0],["WASH","Washington Trust Bancorp Inc.",26,581,0],["WAT","Waters Corporation",71,22506,0],["WATT","Energous Corporation",49,9,0],["WAVE","Eco Wave Power Global AB (publ)",41,293,0],["WAY","Waystar Holding Corp.",15,6283,0],["WB","Weibo Corporation American",16,2492,0],["WBD","Warner Bros. Discovery Inc. Series A",45,68813,0],["WBI","WaterBridge Infrastructure LLC Class A Shares Representing Limited Liability Company Interests",20,2504,0],["WBIF","WBIF",1,0,0],["WBIG","WBIG",1,0,0],["WBIL","WBIL",1,0,0],["WBIY","WBIY",1,0,0],["WBS","Webster Financial Corporation",26,10429,0],["WBS/PF","WBS/PF",1,0,0],["WBS/PG","WBS/PG",1,0,0],["WBTN","WEBTOON Entertainment Inc.",109,1684,0],["WBUY","WEBUY GLOBAL LTD. Class A",66,1,0],["WBX","Wallbox N.V. Class A",32,48,0],["WCAP","WCAP",1,0,0],["WCBR","WCBR",1,0,0],["WCC","WESCO International Inc.",33,12230,0],["WCEO","WCEO",1,0,0],["WCLD","WCLD",1,0,0],["WCME","WCME",1,0,0],["WCMI","WCMI",1,0,0],["WCN","Waste Connections Inc.",122,45123,0],["WCPB","WCPB",1,0,0],["WCT","Wellchange Holdings Company Limited Class A",25,33,0],["WD","Walker & Dunlop Inc",44,2054,0],["WDAF","WDAF",1,0,0],["WDAY","Workday Inc. Class A",15,57500,0],["WDC","Western Digital Corporation",76,61911,0],["WDEF","WDEF",1,0,0],["WDFC","WD-40 Company",34,2744,0],["WDGF","WDGF",1,0,0],["WDH","Waterdrop Inc.",28,705,0],["WDI","Western Asset Diversified Income Fund",81,0,0],["WDIV","WDIV",1,0,0],["WDS","Woodside Energy Group Limited",59,28291,0],["WDTE","WDTE",1,0,0],["WEA","Western Asset Bond Fund Share of Beneficial Interest",81,0,0],["WEAT","WEAT",1,0,0],["WEAV","Weave Communications Inc.",25,541,0],["WEBL","WEBL",1,0,0],["WEBS","WEBS",1,0,0],["WEC","WEC Energy Group Inc.",129,33811,0],["WEEI","WEEI",1,0,0],["WEEL","WEEL",1,0,0],["WELL","Welltower Inc.",30,127664,0],["WEN","Wendy\'s Company (The)",68,1595,0],["WENN","Wen Acquisition Corp Class A",1,0,0],["WENNU","Wen Acquisition Corp Unit",2,0,0],["WERN","Werner Enterprises Inc.",63,1812,0],["WES","Western Midstream Partners LP Common",107,15940,0],["WEST","Westrock Coffee Company",46,406,0],["WETH","Wetouch Technology Inc.",53,18,0],["WETO","Webus International Limited",147,20,0],["WEX","WEX Inc.",36,5174,0],["WEYS","Weyco Group Inc.",86,312,0],["WF","Woori Financial Group Inc.",75,14102,0],["WFC","Wells Fargo & Company",26,291966,0],["WFC/PA","WFC/PA",1,0,0],["WFC/PC","WFC/PC",1,0,0],["WFC/PD","WFC/PD",1,0,0],["WFC/PL","WFC/PL",1,0,0],["WFC/PY","WFC/PY",1,0,0],["WFC/PZ","WFC/PZ",1,0,0],["WFCF","Where Food Comes From Inc.",25,58,0],["WFF","WF Holding Limited",69,10,0],["WFG","West Fraser Timber Co. Ltd",56,4643,0],["WFRD","Weatherford International plc",88,5654,0],["WGMI","WGMI",1,0,0],["WGO","Winnebago Industries Inc.",121,1233,0],["WGRX","Wellgistics Health Inc.",112,44,0],["WGS","GeneDx Holdings Corp. Class A",100,4059,0],["WH","Wyndham Hotels & Resorts Inc.",47,5939,0],["WHD","Cactus Inc. Class A",88,3645,0],["WHF","WhiteHorse Finance Inc.",116,167,0],["WHFCL","WhiteHorse Finance Inc. 7.875% Notes due 2028",1,585,0],["WHG","Westwood Holdings Group Inc",11,178,0],["WHLR","Wheeler Real Estate Investment Trust Inc.",30,2,0],["WHLRD","Wheeler Real Estate Investment Trust Inc. Series D Cumulative",30,26,0],["WHLRL","Wheeler Real Estate Investment Trust Inc. 7.00% Senior Subordinated Convertible Notes Due 2031",30,62,0],["WHLRP","Wheeler Real Estate Investment Trust Inc. Class B",30,3,0],["WHR","Whirlpool Corporation",133,4131,0],["WHWK","Whitehawk Therapeutics Inc.",8,121,0],["WIA","Western Asset Inflation-Linked Income Fund",81,0,0],["WILC","G. Willi-Food International Ltd.",103,388,0],["WILD","WILD",1,0,0],["WIMI","WiMi Hologram Cloud Inc. Class B",25,14,0],["WINA","Winmark Corporation",66,1450,0],["WING","Wingstop Inc.",68,7202,0],["WINN","WINN",1,0,0],["WIP","WIP",1,0,0],["WISD","WISD",1,0,0],["WISE","WISE",1,0,0],["WIT","Wipro Limited",15,32045,0],["WIW","Western Asset Inflation-Linked Opportunities & Income Fund",116,0,0],["WIX","Wix.com Ltd.",16,5813,0],["WK","Workiva Inc. Class A",25,4935,0],["WKC","World Kinect Corporation",80,1310,0],["WKEY","WISeKey International Holding Ltd",15,69,0],["WKHS","Workhorse Group Inc.",37,12,0],["WKSP","Worksport Ltd.",42,19,0],["WLAC","Willow Lane Acquisition Corp. Class A",2,0,0],["WLACU","Willow Lane Acquisition Corp. Unit",2,0,0],["WLDN","Willdan Group Inc.",21,1643,0],["WLDS","Wearable Devices Ltd.",51,15,0],["WLFC","Willis Lease Finance Corporation",32,916,0],["WLK","Westlake Corporation",34,9299,0],["WLKP","Westlake Chemical Partners LP Common",34,673,0],["WLTG","WLTG",1,0,0],["WLTH","Wealthfront Corporation",44,1894,0],["WLY","John Wiley & Sons Inc.",145,1630,0],["WLYB","John Wiley & Sons Inc.",145,1826,0],["WM","Waste Management Inc.",122,87156,0],["WMB","Williams Companies Inc. (The)",107,71148,0],["WMG","Warner Music Group Corp. Class A",45,15333,0],["WMK","Weis Markets Inc.",67,1662,0],["WMS","Advanced Drainage Systems Inc.",125,11549,0],["WMSB","WMSB",1,0,0],["WMT","Walmart Inc.",113,911468,0],["WNC","Wabash National Corporation",72,364,0],["WNEB","Western New England Bancorp Inc.",84,272,0],["WNTR","WNTR",1,0,0],["WNW","Meiwu Technology Company Limited",57,25,0],["WOK","WORK Medical Technology Group LTD Class A",31,3,0],["WOLF","Wolfspeed Inc.",6,684,0],["WOMN","WOMN",1,0,0],["WOOD","WOOD",1,0,0],["WOOF","Petco Health and Wellness Company Inc. Class A",66,932,0],["WOR","Worthington Enterprises Inc.",27,2601,0],["WORX","SCWorx Corp.",45,3,0],["WOW","WideOpenWest Inc.",54,447,0],["WPC","W. P. Carey Inc. REIT",30,14161,0],["WPM","Wheaton Precious Metals Corp",104,54346,0],["WPP","WPP plc",58,4803,0],["WPRT","Westport Fuel Systems Inc",7,29,0],["WRAP","Wrap Technologies Inc.",78,118,0],["WRB","W.R. Berkley Corporation",22,26362,0],["WRB/PE","WRB/PE",1,0,0],["WRB/PF","WRB/PF",1,0,0],["WRB/PG","WRB/PG",1,0,0],["WRB/PH","WRB/PH",1,0,0],["WRBY","Warby Parker Inc. Class A",111,3224,0],["WRD","WeRide Inc.",15,2538,0],["WRLD","World Acceptance Corporation",44,719,0],["WRN","Western Copper and Gold Corporation",10,560,0],["WRND","WRND",1,0,0],["WS","Worthington Steel Inc.",27,1847,0],["WSBC","WesBanco Inc.",26,3342,0],["WSBCO","WesBanco Inc.",26,2462,0],["WSBF","Waterstone Financial Inc.",84,308,0],["WSBK","Winchester Bancorp Inc.",1,0,0],["WSC","WillScot Holdings Corporation Class A",131,3431,0],["WSFS","WSFS Financial Corporation",26,3139,0],["WSGE","WSGE",1,0,0],["WSHP","WeShop Holdings Limited Class A",66,3048,0],["WSM","Williams-Sonoma Inc.",73,22787,0],["WSML","WSML",1,0,0],["WSO","Watsco Inc.",7,14107,0],["WSO.B","WSO.B",1,0,0],["WSR","Whitestone REIT",30,694,0],["WST","West Pharmaceutical Services Inc.",31,19607,0],["WSTNU","Westin Acquisition Corp",1,0,0],["WT","WisdomTree Inc.",60,1750,0],["WTBA","West Bancorporation",26,393,0],["WTBN","WTBN",1,0,0],["WTF","Waton Financial Limited",60,171,0],["WTFC","Wintrust Financial Corporation",26,9531,0],["WTFCN","Wintrust Financial Corporation",26,1775,0],["WTG","Wintergreen Acquisition Corp.",2,0,0],["WTGUU","WTGUU",1,0,0],["WTI","W&T Offshore Inc.",59,250,0],["WTIB","WTIB",1,0,0],["WTID","WTID",1,0,0],["WTIP","WTIP",1,0,0],["WTIU","WTIU",1,0,0],["WTM","White Mountains Insurance Group Ltd.",22,5213,0],["WTMF","WTMF",1,0,0],["WTMU","WTMU",1,0,0],["WTMY","WTMY",1,0,0],["WTO","UTime Limited Class A",133,1,0],["WTPI","WTPI",1,0,0],["WTRE","WTRE",1,0,0],["WTRG","Essential Utilities Inc.",70,10733,0],["WTS","Watts Water Technologies Inc. Class A",55,9334,0],["WTTR","Select Water Solutions Inc. Class A",20,1272,0],["WTV","WTV",1,0,0],["WTW","Willis Towers Watson Public Limited Company",28,31842,0],["WU","Western Union Company (The)",36,3039,0],["WULF","TeraWulf Inc.",15,5242,0],["WVE","Wave Life Sciences Ltd.",8,2876,0],["WVVI","Willamette Valley Vineyards Inc.",46,14,0],["WVVIP","Willamette Valley Vineyards Inc. Series A Redeemable",46,15,0],["WW","WW International Inc. ",3,275,0],["WWD","Woodward Inc.",7,18318,0],["WWJD","WWJD",1,0,0],["WWR","Westwater Resources Inc.",10,103,0],["WWW","Wolverine World Wide Inc.",114,1500,0],["WXET","WXET",1,0,0],["WXM","WF International Limited",82,4,0],["WY","Weyerhaeuser Company",30,16926,0],["WYFI","WhiteFiber Inc.",44,640,0],["WYHG","Wing Yip Food Holdings Group Limited",93,38,0],["WYNN","Wynn Resorts Limited",47,13302,0],["WYY","WidePoint Corporation",15,61,0],["XAGG","XAGG",1,0,0],["XAIR","Beyond Air Inc.",31,7,0],["XAIX","XAIX",1,0,0],["XAR","XAR",1,0,0],["XB","XB",1,0,0],["XBB","XBB",1,0,0],["XBI","XBI",1,0,0],["XBIL","XBIL",1,0,0],["XBIO","Xenetic Biosciences Inc.",8,5,0],["XBIT","XBiotech Inc.",8,76,0],["XBP","XBP Global Holdings Inc.",36,76,0],["XBTY","XBTY",1,0,0],["XC","XC",1,0,0],["XCCC","XCCC",1,0,0],["XCEM","XCEM",1,0,0],["XCH","XCHG Limited American",39,73,0],["XCHG","XCHG",1,0,0],["XCLR","XCLR",1,0,0],["XCNY","XCNY",1,0,0],["XCOR","XCOR",1,0,0],["XCUR","Exicure Inc.",8,38,0],["XEL","Xcel Energy Inc.",129,42987,0],["XELB","Xcel Brands Inc.",29,6,0],["XELLL","Xcel Energy Inc. 6.25% Junior Subordinated Notes Series due 2085",129,0,0],["XENE","Xenon Pharmaceuticals Inc.",8,3408,0],["XERS","Xeris Biopharma Holdings Inc.",8,1218,0],["XES","XES",1,0,0],["XFIV","XFIV",1,0,0],["XFIX","XFIX",1,0,0],["XFLT","XAI Octagon Floating Rate & Alternative Income Trust",11,163,0],["XFLX","XFLX",1,0,0],["XFOR","X4 Pharmaceuticals Inc.",13,315,0],["XGN","Exagen Inc.",23,146,0],["XHB","XHB",1,0,0],["XHE","XHE",1,0,0],["XHG","XChange TEC.INC",36,1,0],["XHLD","TEN Holdings Inc.",36,5,0],["XHLF","XHLF",1,0,0],["XHR","Xenia Hotels & Resorts Inc.",47,1420,0],["XHS","XHS",1,0,0],["XHYC","XHYC",1,0,0],["XHYD","XHYD",1,0,0],["XHYE","XHYE",1,0,0],["XHYF","XHYF",1,0,0],["XHYH","XHYH",1,0,0],["XHYI","XHYI",1,0,0],["XHYT","XHYT",1,0,0],["XIDV","XIDV",1,0,0],["XIFR","XPLR Infrastructure LP Common",41,869,0],["XITK","XITK",1,0,0],["XLB","XLB",1,0,0],["XLBI","XLBI",1,0,0],["XLC","XLC",1,0,0],["XLCI","XLCI",1,0,0],["XLE","XLE",1,0,0],["XLEI","XLEI",1,0,0],["XLF","XLF",1,0,0],["XLFI","XLFI",1,0,0],["XLG","XLG",1,0,0],["XLI","XLI",1,0,0],["XLII","XLII",1,0,0],["XLK","XLK",1,0,0],["XLKI","XLKI",1,0,0],["XLO","Xilio Therapeutics Inc.",8,35,0],["XLP","XLP",1,0,0],["XLRE","XLRE",1,0,0],["XLRI","XLRI",1,0,0],["XLSI","XLSI",1,0,0],["XLSR","XLSR",1,0,0],["XLU","XLU",1,0,0],["XLUI","XLUI",1,0,0],["XLV","XLV",1,0,0],["XLVI","XLVI",1,0,0],["XLY","XLY",1,0,0],["XLYI","XLYI",1,0,0],["XMAG","XMAG",1,0,0],["XME","XME",1,0,0],["XMHQ","XMHQ",1,0,0],["XMLV","XMLV",1,0,0],["XMMO","XMMO",1,0,0],["XMTR","Xometry Inc. Class A",36,3152,0],["XMVM","XMVM",1,0,0],["XNAV","XNAV",1,0,0],["XNCR","Xencor Inc.",8,1110,0],["XNET","Xunlei Limited",25,2186,0],["XNTK","XNTK",1,0,0],["XOEF","XOEF",1,0,0],["XOM","Exxon Mobil Corporation",106,492101,0],["XOMA","XOMA Royalty Corporation",8,314,0],["XOMAO","XOMA Royalty Corporation",8,317,0],["XOMAP","XOMA Royalty Corporation 8.625% Series A Cumulative Perpetual",8,329,0],["XOMO","XOMO",1,0,0],["XOMX","XOMX",1,0,0],["XOMZ","XOMZ",1,0,0],["XONE","XONE",1,0,0],["XOP","XOP",1,0,0],["XOS","Xos Inc.",42,23,0],["XOVR","XOVR",1,0,0],["XP","XP Inc. Class A",60,8604,0],["XPAY","XPAY",1,0,0],["XPEL","XPEL Inc.",32,1412,0],["XPER","Xperi Inc.",25,271,0],["XPEV","XPeng Inc.",37,18871,0],["XPH","XPH",1,0,0],["XPL","Solitario Resources Corp.",104,61,0],["XPM","XPM",1,0,0],["XPND","XPND",1,0,0],["XPO","XPO Inc.",87,16260,0],["XPOF","Xponential Fitness Inc. Class A",45,377,0],["XPON","Expion360 Inc.",7,9,0],["XPP","XPP",1,0,0],["XPRO","Expro Group Holdings N.V.",20,1473,0],["XRAY","DENTSPLY SIRONA Inc.",31,2237,0],["XRLV","XRLV",1,0,0],["XRLX","XRLX",1,0,0],["XRMI","XRMI",1,0,0],["XRP","XRP",1,0,0],["XRPC","XRPC",1,0,0],["XRPI","XRPI",1,0,0],["XRPN","Armada Acquisition Corp. II Class A",2,0,0],["XRPNU","Armada Acquisition Corp. II",2,0,0],["XRPT","XRPT",1,0,0],["XRPZ","XRPZ",1,0,0],["XRT","XRT",1,0,0],["XRTX","XORTX Therapeutics Inc.",8,4,0],["XRX","Xerox Holdings Corporation",53,335,0],["XSD","XSD",1,0,0],["XSLV","XSLV",1,0,0],["XSMO","XSMO",1,0,0],["XSOE","XSOE",1,0,0],["XSVM","XSVM",1,0,0],["XSVN","XSVN",1,0,0],["XSW","XSW",1,0,0],["XT","XT",1,0,0],["XTEN","XTEN",1,0,0],["XTIA","XTI Aerospace Inc.",15,45,0],["XTKG","X3 Holdings Co. Ltd.",15,27,0],["XTL","XTL",1,0,0],["XTLB","XTL Biopharmaceuticals Ltd.",8,7,0],["XTN","XTN",1,0,0],["XTNT","Xtant Medical Holdings Inc.",13,108,0],["XTR","XTR",1,0,0],["XTRE","XTRE",1,0,0],["XTWO","XTWO",1,0,0],["XTWY","XTWY",1,0,0],["XUDV","XUDV",1,0,0],["XV","XV",1,0,0],["XWEL","XWELL Inc.",3,4,0],["XWIN","XMAX Inc.",73,254,0],["XXI","Twenty One Capital Inc. Class A",44,146,0],["XXII","22nd Century Group Inc.",18,7,0],["XXRP","XXRP",1,0,0],["XXV","XXV",1,0,0],["XYF","X Financial",44,270,0],["XYL","Xylem Inc.",148,33616,0],["XYLD","XYLD",1,0,0],["XYLG","XYLG",1,0,0],["XYZ","Block Inc. Class A",25,39699,0],["XYZG","XYZG",1,0,0],["XYZY","XYZY",1,0,0],["XZO","Exzeo Group Inc.",22,1881,0],["YAAS","Youxin Technology Ltd Class A",25,3,0],["YALA","Yalla Group Limited",16,1111,0],["YALL","YALL",1,0,0],["YANG","YANG",1,0,0],["YB","Yuanbao Inc.",28,912,0],["YBIT","YBIT",1,0,0],["YBMN","YBMN",1,0,0],["YBST","YBST",1,0,0],["YBTY","YBTY",1,0,0],["YCBD","cbdMD Inc.",90,13,0],["YCL","YCL",1,0,0],["YCS","YCS",1,0,0],["YCY","AA Mission Acquisition Corp. II Class A",1,0,0],["YCY.U","YCY.U",1,0,0],["YDDL","One and One Green Technologies. Inc Class A",32,324,0],["YDES","YD Bio Limited",23,871,0],["YDKG","Yueda Digital Holding Class A",58,5,0],["YEAR","YEAR",1,0,0],["YELP","Yelp Inc.",3,1925,0],["YETI","YETI Holdings Inc.",61,3468,0],["YEXT","Yext Inc.",15,1021,0],["YFFI","YFFI",1,0,0],["YFYA","YFYA",1,0,0],["YGLD","YGLD",1,0,0],["YHC","LQR House Inc.",46,13,0],["YHGJ","Yunhong Green CTI Ltd.",135,12,0],["YHNA","YHN Acquisition I Limited",1,0,0],["YI","111 Inc.",142,32,0],["YIBO","Planet Image International Limited Class A",7,55,0],["YINN","YINN",1,0,0],["YJ","Yunji Inc. American Depository Shares",66,7,0],["YLD","YLD",1,0,0],["YLDE","YLDE",1,0,0],["YLDW","YLDW",1,0,0],["YMAG","YMAG",1,0,0],["YMAT","J-Star Holding Co. Ltd. Class A",61,11,0],["YMAX","YMAX",1,0,0],["YMM","Full Truck Alliance Co. Ltd.",25,11609,0],["YMT","Yimutian Inc.",15,146,0],["YNOT","YNOT",1,0,0],["YOKE","YOKE",1,0,0],["YOLO","YOLO",1,0,0],["YORW","York Water Company (The)",70,476,0],["YOU","Clear Secure Inc. Class A",25,4924,0],["YOUL","Youlife Group Inc.",3,119,0],["YPF","YPF Sociedad Anonima",106,13978,0],["YQ","17 Education & Technology Group Inc.",3,36,0],["YQQQ","YQQQ",1,0,0],["YRD","Yiren Digital Ltd.",44,371,0],["YSG","Yatsen Holding Limited",90,407,0],["YSPY","YSPY",1,0,0],["YSXT","YSX Tech. Co. Ltd Class A",79,28,0],["YTRA","Yatra Online Inc.",87,105,0],["YUM","Yum! Brands Inc.",68,42689,0],["YUMC","Yum China Holdings Inc.",68,17496,0],["YXI","YXI",1,0,0],["YXT","YXT.COM GROUP HOLDING LIMITED American Depository Shares",25,45,0],["YYAI","AiRWA Inc.",61,20,0],["YYGH","YY Group Holding Limited Class A",19,8,0],["YYY","YYY",1,0,0],["Z","Zillow Group Inc. Class C",36,16692,0],["ZAP","ZAP",1,0,0],["ZBAI","ATIF Holdings Limited",19,84,0],["ZBAO","Zhibao Technology Inc. Class A",28,28,0],["ZBH","Zimmer Biomet Holdings Inc.",32,17664,0],["ZBIO","Zenas BioPharma Inc.",8,1941,0],["ZBRA","Zebra Technologies Corporation Class A",7,12749,0],["ZCMD","Zhongchao Inc. Class A",3,15,0],["ZD","Ziff Davis Inc.",33,1406,0],["ZDAI","DirectBooking Technology Co. Ltd.",136,7,0],["ZDGE","Zedge Inc. Class B",25,43,0],["ZENA","ZenaTech Inc.",25,94,0],["ZENV","Zenvia Inc. Class A",25,56,0],["ZEO","Zeo Energy Corporation Class A",7,56,0],["ZEPP","Zepp Health Corporation",9,399,0],["ZETA","Zeta Global Holdings Corp. Class A",25,4280,0],["ZEUS","Olympic Steel Inc.",55,489,0],["ZG","Zillow Group Inc. Class A",36,16452,0],["ZGM","Zenta Group Company Limited",19,29,0],["ZGN","Ermenegildo Zegna N.V.",86,2682,0],["ZH","Zhihu Inc.",36,311,0],["ZHDG","ZHDG",1,0,0],["ZIG","ZIG",1,0,0],["ZIM","ZIM Integrated Shipping Services Ltd.",98,2318,0],["ZION","Zions Bancorporation N.A.",26,8850,0],["ZIONP","Zions Bancorporation N.A.",26,3033,0],["ZIP","ZipRecruiter Inc. Class A",16,392,0],["ZIPP","ZIPP",1,0,0],["ZJK","ZJK Industrial Co. Ltd.",55,123,0],["ZJYL","JIN MEDICAL INTERNATIONAL LTD.",32,33,0],["ZK","ZEEKR Intelligent Technology Holding Limited",37,6795,0],["ZKH","ZKH Group Limited",130,515,0],["ZKIN","ZK International Group Co. Ltd",55,9,0],["ZLAB","Zai Lab Limited",8,1995,0],["ZM","Zoom Communications Inc. Class A",16,26596,0],["ZMUN","ZMUN",1,0,0],["ZNB","Zeta Network Group Class A",82,95,0],["ZNTL","Zentalis Pharmaceuticals Inc.",8,101,0],["ZONE","CleanCore Solutions Inc. Class B",7,60,0],["ZOOZ","ZOOZ Strategy Ltd.",7,65,0],["ZROZ","ZROZ",1,0,0],["ZS","Zscaler Inc.",15,37085,0],["ZSB","ZSB",1,0,0],["ZSC","ZSC",1,0,0],["ZSL","ZSL",1,0,0],["ZSPC","zSpace Inc.",25,13,0],["ZTAX","ZTAX",1,0,0],["ZTEK","Zentek Ltd.",34,79,0],["ZTEN","ZTEN",1,0,0],["ZTO","ZTO Express (Cayman) Inc.",63,17111,0],["ZTOP","ZTOP",1,0,0],["ZTR","Virtus Total Return Fund Inc.",11,0,0],["ZTRE","ZTRE",1,0,0],["ZTS","Zoetis Inc. Class A",8,53870,0],["ZTWO","ZTWO",1,0,0],["ZUMZ","Zumiez Inc.",120,486,0],["ZURA","Zura Bio Limited Class A",13,278,0],["ZVIA","Zevia PBC Class A",46,197,0],["ZVRA","Zevra Therapeutics Inc.",8,468,0],["ZWS","Zurn Elkay Water Solutions Corporation",7,7949,0],["ZYBT","Zhengye Biotechnology Holding Limited",8,88,0],["ZYME","Zymeworks Inc.",8,2038,0],["ZYXI","Zynex Inc.",77,9,0]]'),qp=[" Inc."," Inc"," Incorporated"," Corporation"," Corp."," Corp"," Company"," Limited"," Ltd."," Ltd"," LLC"," L.L.C."," PLC"," P.L.C."," LP"," L.P."," Class A"," Class B"," Class C"," Class D"," Class E"," Common Stock"," Common Shares"," Common Share"," Ordinary Shares"," Ordinary Share"," Capital Stock"," Depositary Shares"," Depositary Share"," American Depositary Shares"," American Depositary Share"," ADS"," Warrants"," Warrant"," Rights"," Preferred Stock"," Preferred Shares"," Units"," Public Company"," Publicly Traded"," S.A."," SA"," N.V."," NV"," AB"," AG"," AS"," ASA"];const Qp=Hr,Jp=10,zp=/^\d{10}-\d{2}-\d{6}$/;class Zp{tickerOrCik;formType;limit;constructor(e,t,n=null){this.tickerOrCik=e,this.formType=t,this.limit=n}static fromString(e){const t=e.split("/");if(t.length<2)throw new Error(`Invalid query string format: ${e}`);const[n,r,i]=t,a=i?parseInt(i):null;return new Zp(n,r,a)}}class eh{tickerOrCik;accessionNumber;constructor(e,t){this.tickerOrCik=e,this.accessionNumber=t}static fromString(e,t=!0){const n=e.split("/");if(2===n.length){const[e,t]=n;if(zp.test(t)||18===t.length)return new eh(e,t)}if(t)throw new Error(`Invalid company and accession number format: ${e}`);return null}}function th(e,t){if(/^\d+$/.test(e))return e.padStart(Jp,"0");const n=t[e.toUpperCase()];if(!n)throw new Error(`Could not find CIK for ticker: ${e}`);return n.padStart(Jp,"0")}async function nh(e){const{tickerOrCik:t,accessionNumber:n,userAgent:r,tickerToCikMapping:i,includeAmends:a}=e;let o=n;if(18===n.length&&(o=`${n.slice(0,10)}-${n.slice(10,12)}-${n.slice(12)}`),!zp.test(o))throw new Error(`Invalid Accession Number: ${n}`);const s=th(t,i),c=await rh({cik:s,userAgent:r,limit:1,accessionNumber:o,includeAmends:a});if(0===c.length)throw new Error(`Could not find filing for ${n}`);return c[0]}async function rh(e){const{cik:t,userAgent:n,limit:r,tickerOrCik:a,accessionNumber:o,formType:s,includeAmends:c=!1}=e,l="CIK{cik}.json".replace("{cik}",t),u="https://data.sec.gov/submissions/{submission}".replace("{submission}",l),d=(await i.get(u,{headers:{"User-Agent":n}})).data,p=d.filings.recent,h=[],f=p.accessionNumber||[],m=p.primaryDocument||[],g=p.filingDate||[],y=p.reportDate||[],I=p.form||[];for(let i=0;i<f.length&&h.length<r;i++){const e=f[i],n=m[i],r=g[i],a=y[i];let l=I[i];const u=l.endsWith("/A");if(l=u?l.slice(0,-2):l,s&&s!==l||o&&o!==e||u&&!c)continue;const p=e.replace(/-/g,""),C=`https://www.sec.gov/Archives/edgar/data/${parseInt(t)}/${p}/${n}`;h.push({primaryDocUrl:C,accessionNumber:e,tickers:(d.tickers||[]).map((e,t)=>({symbol:e,exchange:d.exchanges?.[t]||""})),companyName:d.name,filingDate:r,reportDate:a,primaryDocDescription:"",items:"",formType:l,cik:String(d.cik).padStart(Jp,"0")})}return h}const ih="data/stock-names.json",ah="data/sectors-industries.json",oh={fields:["symbol","name","industryId","marketCap","cik"]},sh=["nasdaq","nyse","amex"],ch=[" American Depositary Shares"," Depositary Shares"," Ordinary Shares"," Common Stock"," Common Shares"," Capital Stock"," Units"," Warrants"," Warrant"," Rights"," Preferred Stock"," Preferred Shares"," Depositary Share"," Ordinary Share"," Common Share"],lh=e=>{let t=e;for(const n of ch){const e=new RegExp(n+".*$","i");if(e.test(t)){t=t.replace(e,"");break}}return t};function uh(e,t,n){if(t[e])return t[e];const r=Object.values(t),i=r.length>0?Math.max(...r)+1:1;return t[e]=i,n[i]=e,i}async function dh(){const e={headers:{"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:85.0) Gecko/20100101 Firefox/85.0","Content-Type":"application/json"}};try{console.log("Fetching symbols from TradingView...");const t=await fetch("https://scanner.tradingview.com/america/scan",e);if(!t.ok)throw new Error(`TradingView request failed. Status Code: ${t.status}`);const n=await t.json(),r=new Set;return n.data&&Array.isArray(n.data)&&n.data.forEach(e=>{if(e.s){const[t,n]=e.s.split(":");t&&n&&["NYSE","NASDAQ","AMEX"].includes(t.toUpperCase())&&r.add(n)}}),console.log(`Fetched ${r.size} symbols from TradingView (NYSE, NASDAQ, AMEX only)`),console.log(`Total count from TradingView: ${n.totalCount||0}`),r}catch(t){return console.error("Error fetching TradingView symbols:",t),new Set}}async function ph(e){const t=`https://api.nasdaq.com/api/screener/stocks?tableonly=true&limit=25&offset=0&download=true&exchange=${e}`,n={headers:{"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:85.0) Gecko/20100101 Firefox/85.0"}};try{const e=await fetch(t,n);if(!e.ok)throw new Error(`Request failed. Status Code: ${e.status}`);return await e.json()}catch(r){return console.error(`Error fetching ${e}:`,r),null}}async function hh(){const e="data/company_tickers.json";try{if(console.log("Loading SEC CIK data from local file..."),!Ri.existsSync(e))return console.warn(`SEC data file not found: ${e}`),console.warn("Skipping CIK data. Download from: https://www.sec.gov/files/company_tickers.json"),{tickerToCik:new Map,secCompanies:new Map};const t=Ri.readFileSync(e,"utf-8"),n=JSON.parse(t),r=new Map,i=new Map;return Object.values(n).forEach(e=>{e.ticker&&e.cik_str&&(r.set(e.ticker,e.cik_str),i.set(e.ticker,{ticker:e.ticker,name:e.title,cik:e.cik_str}))}),console.log(`Loaded ${r.size} SEC tickers with CIK numbers from local file`),{tickerToCik:r,secCompanies:i}}catch(t){return console.error("Error loading SEC data:",t),{tickerToCik:new Map,secCompanies:new Map}}}!async function(){try{console.log("Fetching stock data..."),Ri.existsSync("data")||Ri.mkdirSync("data");const e=function(){if(Ri.existsSync(ah))try{const e=JSON.parse(Ri.readFileSync(ah,"utf-8"));console.log(`Loaded existing mappings: ${Object.keys(e.sectors||{}).length} sectors, ${Object.keys(e.industries||{}).length} industries`);const t={},n={};for(const[r,i]of Object.entries(e.sectors||{}))t[i]=r;for(const[r,i]of Object.entries(e.industries||{}))n[i]=r;return{sectors:e.sectors||{},industries:e.industries||{},sectorsReverse:t,industriesReverse:n,industryToSector:e.industryToSector||{}}}catch(e){console.warn("Error loading existing mappings, starting fresh:",e)}return{sectors:{},industries:{},sectorsReverse:{},industriesReverse:{},industryToSector:{}}}(),[t,n,r]=await Promise.all([dh(),Promise.all(sh.map(ph)),hh()]),{tickerToCik:i,secCompanies:a}=r,o=[];n.forEach(e=>{e&&e.data&&e.data.rows&&o.push(...e.data.rows)}),console.log(`Fetched ${o.length} total rows from NASDAQ/NYSE/AMEX.`);const s=new Map;o.forEach(e=>{e.symbol&&s.set(e.symbol.trim(),e)});const c=new Map;t.forEach(t=>{if(!c.has(t)){const n=s.get(t),r=i.get(t)||0;if(n){const i=n.sector?String(n.sector).trim():"Unknown",a=n.industry?String(n.industry).trim():"Unknown",o=uh(i,e.sectors,e.sectorsReverse),s=uh(a,e.industries,e.industriesReverse);e.industryToSector[s]=o;const l=oh.fields.map(e=>"symbol"===e?t:"name"===e?lh(n.name?n.name.trim():""):"industryId"===e?s:"marketCap"===e?(e=>{if(!e)return 0;const t=parseFloat(String(e).replace(/,/g,"").replace(/\$/g,""));return isNaN(t)?0:Math.round(t/1e6)})(n.marketCap):"cik"===e?r:n[e]);c.set(t,l)}else{const n=a.get(t),i=uh("Unknown",e.sectors,e.sectorsReverse),o=uh("Unknown",e.industries,e.industriesReverse);e.industryToSector[o]=i;const s=oh.fields.map(e=>"symbol"===e?t:"name"===e?n?lh(n.name):t:"industryId"===e?o:"marketCap"===e?0:"cik"===e?r:0);c.set(t,s)}}}),console.log(`Total unique tickers from TradingView core index: ${c.size}`),console.log(`Tickers with NASDAQ data: ${Array.from(c.values()).filter(e=>0!==e[3]&&null!==e[3]).length}`),console.log(`Total sectors: ${Object.keys(e.sectors).length}`),console.log(`Total industries: ${Object.keys(e.industries).length}`),console.log(`Industry-to-Sector mappings: ${Object.keys(e.industryToSector).length}`),console.log(`Output fields: ${JSON.stringify(oh.fields)}`),Ri.writeFileSync(ah,JSON.stringify({sectors:e.sectors,industries:e.industries,industryToSector:e.industryToSector},null,2)),console.log(`Successfully wrote mappings to ${ah}`);const l=Array.from(c.values()).sort((e,t)=>{const n=String(e[0]||""),r=String(t[0]||"");return n.localeCompare(r)});Ri.writeFileSync(ih,JSON.stringify(l)),console.log(`Successfully wrote ${l.length} stocks to ${ih}`);const u={},d={sector:"Overall US Public Stocks",totalCompanies:0,totalMarketCap:0,industries:{},companies:[]};l.forEach(t=>{const n=t[0],r=t[1],i=t[2],a="number"==typeof t[3]?t[3]:0,o=e.industryToSector[i]||0,s=e.sectorsReverse[o]||"Unknown",c=e.industriesReverse[i]||"Unknown";u[s]||(u[s]={totalCompanies:0,totalMarketCap:0,industries:{},companies:[]}),u[s].totalCompanies++,u[s].totalMarketCap+=a,u[s].industries[c]||(u[s].industries[c]={name:c,totalCompanies:0,totalMarketCap:0,leader:{symbol:n,name:r,_marketCap:a}}),u[s].industries[c].totalCompanies++,u[s].industries[c].totalMarketCap+=a,a>u[s].industries[c].leader._marketCap&&(u[s].industries[c].leader={symbol:n,name:r,_marketCap:a}),d.totalCompanies++,d.totalMarketCap+=a,d.companies.push({symbol:n,name:r,marketCap:a})});const p=(e,t,n=!0)=>{e.companies.sort((e,t)=>t.marketCap-e.marketCap);const r=e.companies.slice(0,10);let i=[];n&&(i=Object.values(e.industries).sort((e,t)=>t.totalMarketCap-e.totalMarketCap).map(e=>{const{_marketCap:t,...n}=e.leader||{};return{...e,leader:n}}));const a={sector:t,totalCompanies:e.totalCompanies,totalMarketCap:e.totalMarketCap,top10Companies:r};return n&&(a.industries=i),a},h=Object.keys(u).map(e=>p(u[e],e,!0));h.sort((e,t)=>t.totalMarketCap-e.totalMarketCap),h.unshift(p(d,"Overall US Public Stocks",!1));const f="data/sector-info.json";Ri.writeFileSync(f,JSON.stringify(h,null,2)),console.log(`Successfully wrote to ${f}`)}catch(e){console.error("An error occurred:",e),process.exit(1)}}();const fh=process.env.FINNHUB_API_KEY||"";function mh(e){return"string"==typeof e?Math.floor(new Date(e).getTime()/1e3):Math.floor(e.getTime()/1e3)}async function gh(e,t={}){const n=new URL(`https://finnhub.io/api/v1${e}`);n.searchParams.set("token",fh);for(const[i,a]of Object.entries(t))n.searchParams.set(i,a);const r=await fetch(n.toString());if(!r.ok)throw new Error(`Finnhub API error: ${r.status} ${r.statusText}`);return r.json()}function yh(e){return e.toISOString()}function Ih(e){return e.toISOString().split("T")[0]}class Ch{async getHistoricalData(e){const{symbol:t,period1:n,period2:r,interval:i="1d"}=e;if(console.log(`[Historical] Fetching data for ${t}, interval: ${i}, period: ${n} to ${r}`),fh)try{const e=function(e){return{"1m":"1","5m":"5","15m":"15","30m":"30","60m":"60","1h":"60","1d":"D","1wk":"W","1mo":"M",D:"D",W:"W",M:"M"}[e||"1d"]||"D"}(i),a=mh(n),o=mh(r);console.log(`[Finnhub] Requesting candles for ${t}, resolution: ${e}, from: ${a}, to: ${o}`);const s=await gh("/stock/candle",{symbol:t.toUpperCase(),resolution:e,from:String(a),to:String(o)});if("no_data"===s.s)console.log(`[Finnhub] Returned no_data for ${t}, trying Alpaca...`);else{if(s.t&&s.t.length>0){const e=s.t.map((e,t)=>({date:new Date(1e3*e),open:s.o[t],high:s.h[t],low:s.l[t],close:s.c[t],volume:s.v[t]}));return console.log(`[Finnhub] Successfully fetched ${e.length} candles for ${t}`),{success:!0,symbol:t,source:"finnhub",data:{quotes:e,meta:{symbol:t,exchangeName:"US",regularMarketPrice:e.length>0?e[e.length-1].close:null}},meta:{symbol:t,regularMarketPrice:e.length>0?e[e.length-1].close:null}}}console.log(`[Finnhub] Returned empty data for ${t} (status: ${s.s}), trying Alpaca...`)}}catch(o){console.log(`[Finnhub] API failed for ${t}: ${o.message}, trying Alpaca...`)}else console.log("[Finnhub] API key not configured, skipping to Alpaca...");try{console.log(`[Alpaca] Attempting to fetch historical data for ${t}...`);const e=await this.getHistoricalDataFromAlpaca(t,n,r,i);if(e.success&&e.data?.quotes&&e.data.quotes.length>0)return console.log(`[Alpaca] Successfully fetched ${e.data.quotes.length} bars for ${t}`),{...e,source:"alpaca"};console.log(`[Alpaca] Returned no data for ${t}`)}catch(s){console.log(`[Alpaca] API fallback failed for ${t}: ${s.message}`)}const a=function(e){return{D:"1d",W:"1wk",M:"1mo","1d":"1d","1wk":"1wk","1mo":"1mo"}[e||"1d"]||null}(i);if(a)try{console.log(`[Yahoo] Attempting to fetch historical data for ${t}...`);const e=await Hr.getHistorical(t,{period1:n,period2:r,interval:a});if(e.success&&e.data&&e.data.length>0){const n=e.data.map(e=>({date:new Date(e.date),open:e.open,high:e.high,low:e.low,close:e.close,volume:e.volume}));return console.log(`[Yahoo] Successfully fetched ${n.length} bars for ${t}`),{success:!0,symbol:t,source:"yahoo",data:{quotes:n,meta:{symbol:t,exchangeName:"US",regularMarketPrice:n[n.length-1].close}},meta:{symbol:t,regularMarketPrice:n[n.length-1].close}}}console.log(`[Yahoo] Returned no data for ${t}`)}catch(c){console.log(`[Yahoo] API fallback failed for ${t}: ${c.message}`)}return console.error(`[Historical] Failed to fetch data for ${t} from Finnhub, Alpaca, and Yahoo Finance`),{success:!1,error:"Failed to fetch historical data from Finnhub, Alpaca, and Yahoo Finance."}}async getHistoricalDataFromAlpaca(e,t,n,r="1d"){const i=function(e){return{1:"1Min",5:"5Min",15:"15Min",30:"30Min",60:"1Hour","1m":"1Min","5m":"5Min","15m":"15Min","30m":"30Min","1h":"1Hour",D:"1Day",W:"1Week",M:"1Month","1d":"1Day","1wk":"1Week","1mo":"1Month"}[e]||"1Day"}(r),a="string"==typeof t?new Date(t):t,o="string"==typeof n?new Date(n):n;try{const t=await this.getHistoricalDataFromAlpacaHttp(e,a,o,i);if(t.success&&t.data?.quotes&&t.data.quotes.length>0)return console.log(`Alpaca HTTP API succeeded for ${e}: ${t.data.quotes.length} bars`),t;console.log(`Alpaca HTTP API returned no data for ${e}`)}catch(s){console.log(`Alpaca HTTP API failed for ${e}: ${s.message}`)}try{const t=Kp();console.log(`Trying Alpaca SDK for ${e} from ${Ih(a)} to ${Ih(o)}`);const n=t.getBarsV2(e.toUpperCase(),{start:Ih(a),end:Ih(o),timeframe:i,feed:"iex"}),r=[];for await(const e of n){const t=e,n=t.Timestamp||t.t,i=t.OpenPrice??t.o,a=t.HighPrice??t.h,o=t.LowPrice??t.l,s=t.ClosePrice??t.c,c=t.Volume??t.v;n&&void 0!==i&&r.push({date:new Date(n),open:i,high:a,low:o,close:s,volume:c})}if(r.length>0)return console.log(`Alpaca SDK succeeded for ${e}: ${r.length} bars`),{success:!0,symbol:e,data:{quotes:r,meta:{symbol:e,exchangeName:"US",regularMarketPrice:r[r.length-1].close}},meta:{symbol:e,exchangeName:"US",regularMarketPrice:r[r.length-1].close}};console.log(`Alpaca SDK returned no data for ${e}`)}catch(c){console.log(`Alpaca SDK failed for ${e}: ${c.message}`)}return{success:!1,symbol:e,data:{quotes:[],meta:{symbol:e}}}}async getHistoricalDataFromAlpacaHttp(e,t,n,r){const{apiKey:i,secretKey:a}={apiKey:process.env.ALPACA_API_KEY||process.env.ALPACA_KEY_ID||process.env.APCA_API_KEY_ID||"",secretKey:process.env.ALPACA_SECRET||process.env.ALPACA_SECRET_KEY||process.env.APCA_API_SECRET_KEY||""};if(!i||!a)throw new Error("Alpaca API credentials not configured. Set ALPACA_API_KEY and ALPACA_SECRET environment variables.");const o=[];let s=null,c=0;const l=["iex","sip"];let u=null;for(const h of l){o.length=0,s=null,c=0;try{do{const l=new URL(`https://data.alpaca.markets/v2/stocks/${e.toUpperCase()}/bars`);l.searchParams.set("start",yh(t)),l.searchParams.set("end",yh(n)),l.searchParams.set("timeframe",r),l.searchParams.set("feed",h),l.searchParams.set("limit","10000"),l.searchParams.set("adjustment","split"),s&&l.searchParams.set("page_token",s),0===c&&console.log(`[Alpaca HTTP] Requesting ${e} with ${h} feed: ${l.toString().replace(/apikey=[^&]+/gi,"apikey=***")}`);const u=await fetch(l.toString(),{headers:{"APCA-API-KEY-ID":i,"APCA-API-SECRET-KEY":a,Accept:"application/json"}});if(!u.ok){const e=await u.text();if(403===u.status&&"sip"===h)throw console.log("[Alpaca HTTP] SIP feed not available (subscription required), trying IEX..."),new Error("SIP_NOT_AVAILABLE");throw console.error(`[Alpaca HTTP] Error response: ${u.status} ${u.statusText} - ${e}`),new Error(`Alpaca API error: ${u.status} ${u.statusText} - ${e}`)}const d=await u.json(),p=d.bars||[];Array.isArray(p)&&o.push(...p),s=d.next_page_token||null,c++,s&&console.log(`[Alpaca HTTP] Page ${c}: fetched ${p.length} bars, more pages available...`)}while(s&&c<50);if(o.length>0){console.log(`[Alpaca HTTP] Successfully fetched ${o.length} bars for ${e} using ${h} feed (${c} page(s))`);break}}catch(p){if("SIP_NOT_AVAILABLE"===p.message)continue;u=p,console.log(`[Alpaca HTTP] ${h} feed failed for ${e}: ${p.message}`)}}if(0===o.length){if(console.log(`[Alpaca HTTP] No data returned for ${e} from any feed`),u)throw u;return{success:!0,symbol:e,data:{quotes:[],meta:{symbol:e}},meta:{symbol:e}}}const d=o.map(e=>({date:new Date(e.t),open:e.o,high:e.h,low:e.l,close:e.c,volume:e.v}));return d.sort((e,t)=>e.date.getTime()-t.date.getTime()),{success:!0,symbol:e,data:{quotes:d,meta:{symbol:e,exchangeName:"US",regularMarketPrice:d.length>0?d[d.length-1].close:null}},meta:{symbol:e,exchangeName:"US",regularMarketPrice:d.length>0?d[d.length-1].close:null}}}async getQuote(e){const{symbol:t}=e;try{const[e,n,r]=await Promise.all([gh("/quote",{symbol:t.toUpperCase()}),gh("/stock/profile2",{symbol:t.toUpperCase()}).catch(()=>null),gh("/stock/metric",{symbol:t.toUpperCase(),metric:"all"}).catch(()=>null)]),i={price:{regularMarketPrice:e.c,regularMarketChange:e.d,regularMarketChangePercent:e.dp,regularMarketDayHigh:e.h,regularMarketDayLow:e.l,regularMarketOpen:e.o,regularMarketPreviousClose:e.pc,regularMarketTime:new Date(1e3*e.t)},summaryDetail:{previousClose:e.pc,open:e.o,dayHigh:e.h,dayLow:e.l,regularMarketVolume:r?.metric?.["10DayAverageTradingVolume"]||null,fiftyTwoWeekHigh:r?.metric?.["52WeekHigh"]||null,fiftyTwoWeekLow:r?.metric?.["52WeekLow"]||null,trailingPE:r?.metric?.peBasicExclExtraTTM||null,dividendYield:r?.metric?.dividendYieldIndicatedAnnual?r.metric.dividendYieldIndicatedAnnual/100:null,beta:r?.metric?.beta||null},defaultKeyStatistics:{priceToBook:r?.metric?.pbAnnual||null,enterpriseValue:null,forwardPE:null,pegRatio:null,beta:r?.metric?.beta||null,sharesOutstanding:n?.shareOutstanding?1e6*n.shareOutstanding:null},financialData:{currentPrice:e.c,targetHighPrice:null,targetLowPrice:null,targetMeanPrice:null,targetMedianPrice:null,recommendationMean:null,recommendationKey:null,numberOfAnalystOpinions:null,totalCash:null,totalDebt:null,totalRevenue:null,returnOnEquity:r?.metric?.roeTTM?r.metric.roeTTM/100:null,returnOnAssets:r?.metric?.roaeTTM?r.metric.roaeTTM/100:null,profitMargins:r?.metric?.netProfitMarginTTM?r.metric.netProfitMarginTTM/100:null,operatingMargins:r?.metric?.operatingMarginTTM?r.metric.operatingMarginTTM/100:null,grossMargins:r?.metric?.grossMarginTTM?r.metric.grossMarginTTM/100:null,freeCashflow:null,operatingCashflow:null,revenueGrowth:r?.metric?.revenueGrowthTTMYoy?r.metric.revenueGrowthTTMYoy/100:null,earningsGrowth:r?.metric?.epsGrowthTTMYoy?r.metric.epsGrowthTTMYoy/100:null,currentRatio:r?.metric?.currentRatio||null,debtToEquity:r?.metric?.totalDebtToEquity||null},summaryProfile:n?{industry:n.finnhubIndustry,sector:n.finnhubIndustry,website:n.weburl,country:n.country,fullTimeEmployees:null,longBusinessSummary:null}:null};return n&&(i.price.currency=n.currency,i.price.longName=n.name,i.price.shortName=n.name,i.price.marketCap=n.marketCapitalization?1e6*n.marketCapitalization:null,i.price.exchange=n.exchange,i.summaryDetail.marketCap=n.marketCapitalization?1e6*n.marketCapitalization:null),{success:!0,symbol:t,data:i}}catch(n){return{success:!1,error:n.message||"Failed to fetch quote"}}}async search(e){try{return{success:!0,query:e,results:(await gh("/search",{q:e})).result.map(e=>({symbol:e.symbol,shortname:e.description,exchange:e.type,quoteType:e.type}))}}catch(t){return{success:!1,error:t.message||"Failed to search"}}}async getPeers(e){try{const t=await gh("/stock/peers",{symbol:e.toUpperCase()});return{success:!0,symbol:e,peers:t||[]}}catch(t){return{success:!1,error:t.message||"Failed to fetch peers"}}}async getRecommendations(e){try{const t=await gh("/stock/recommendation",{symbol:e.toUpperCase()});return{success:!0,symbol:e,data:{recommendationTrend:{trend:t.map(e=>({period:e.period,strongBuy:e.strongBuy,buy:e.buy,hold:e.hold,sell:e.sell,strongSell:e.strongSell}))}}}}catch(t){return{success:!1,error:t.message||"Failed to fetch recommendations"}}}async getFinancials(e){try{const t=await gh("/stock/metric",{symbol:e.toUpperCase(),metric:"all"});return{success:!0,symbol:e,data:{earnings:{earningsChart:{},financialsChart:{}},incomeStatementHistory:{},balanceSheetHistory:{},cashflowStatementHistory:{},metrics:t.metric,series:t.series}}}catch(t){return{success:!1,error:t.message||"Failed to fetch financials"}}}async getNews(e,t,n){try{const r=new Date,i=new Date(r.getTime()-6048e5),a=await gh("/company-news",{symbol:e.toUpperCase(),from:t||i.toISOString().split("T")[0],to:n||r.toISOString().split("T")[0]});return{success:!0,symbol:e,news:a.map(e=>({title:e.headline,link:e.url,publisher:e.source,publishedAt:new Date(1e3*e.datetime),summary:e.summary,image:e.image,category:e.category,related:e.related}))}}catch(r){return{success:!1,error:r.message||"Failed to fetch news"}}}async getForexRate(e,t){try{const n=(await gh("/forex/rates",{base:e.toUpperCase()})).quote[t.toUpperCase()];return{success:!0,baseCurrency:e,quoteCurrency:t,rate:n||null}}catch(n){return{success:!1,error:n.message||"Failed to fetch forex rate"}}}}const Ah=new Ch,Sh=process.env.NEXT_PUBLIC_ALPACA_MCP_URL||"http://localhost:3001";class bh{baseURL;apiKey;apiSecret;constructor(e){this.baseURL=e?.baseURL||Sh,this.apiKey=e?.apiKey,this.apiSecret=e?.apiSecret}async callTool(e,t={}){const n=await fetch(`${this.baseURL}/mcp/call`,{method:"POST",headers:{"Content-Type":"application/json",...this.apiKey&&{"X-API-Key":this.apiKey},...this.apiSecret&&{"X-API-Secret":this.apiSecret}},body:JSON.stringify({tool:e,arguments:t})});if(!n.ok){const e=await n.json().catch(()=>({error:"Unknown error"}));throw new Error(e.error||`MCP call failed: ${n.statusText}`)}const r=await n.json();if(!r.success)throw new Error(r.error||"Tool call failed");return r.data}async getAccount(){return this.callTool("get_account",{})}async getPositions(){return this.callTool("get_all_positions",{})}async getPosition(e){return this.callTool("get_position",{symbol:e})}async getPortfolioHistory(e){return this.callTool("get_portfolio_history",e||{})}async placeOrder(e){return this.callTool("place_order",e)}async getOrders(e){return this.callTool("get_orders",e||{})}async getOrder(e){return this.callTool("get_order",{order_id:e})}async cancelOrder(e){return this.callTool("cancel_order",{order_id:e})}async closePosition(e,t){return this.callTool("close_position",{symbol:e,...t&&{qty:t}})}async closeAllPositions(){return this.callTool("close_all_positions",{})}async getQuote(e){return this.callTool("get_latest_quote",{symbol:e})}async getBars(e){return this.callTool("get_bars",e)}async getLatestBar(e){return this.callTool("get_latest_bar",{symbol:e})}async getSnapshot(e){return this.callTool("get_snapshot",{symbol:e})}async searchAssets(e){return this.callTool("search_assets",e||{})}async getOptionChain(e){return this.callTool("get_option_chain",e)}async placeOptionOrder(e){return this.callTool("place_option_order",e)}async getCryptoBars(e){return this.callTool("get_crypto_bars",e)}async getCryptoQuote(e){return this.callTool("get_latest_crypto_quote",{symbol:e})}async placeCryptoOrder(e){return this.callTool("place_crypto_order",e)}async getWatchlists(){return this.callTool("get_watchlists",{})}async createWatchlist(e,t){return this.callTool("create_watchlist",{name:e,symbols:t})}async addToWatchlist(e,t){return this.callTool("add_to_watchlist",{watchlist_id:e,symbol:t})}async deleteWatchlist(e){return this.callTool("delete_watchlist",{watchlist_id:e})}async getMarketCalendar(e){return this.callTool("get_market_calendar",e||{})}async getCorporateActions(e){return this.callTool("get_corporate_actions",e)}async chatWithAI(e){try{const t=await fetch("/api/alpaca/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:e})});if(!t.ok)throw new Error(`Chat API error: ${t.statusText}`);const n=await t.json();return{role:"assistant",content:n.content,timestamp:new Date(n.timestamp),suggestions:n.suggestions||[]}}catch(t){return console.error("Chat error:",t),{role:"assistant",content:`Sorry, I encountered an error: ${t.message}\n\nPlease try again or check your GROQ API key configuration.`,timestamp:new Date,suggestions:["What is a momentum trading strategy?","How do I set stop loss and take profit?","Explain technical indicators for trading"]}}}async generateStrategyFromDescription(e){return{name:"AI Generated Strategy",description:e,symbols:["AAPL","MSFT","GOOGL"],active:!1,rules:[{id:"1",type:"entry",condition:{indicator:"price",operator:"crosses_above",value:"sma_20",timeframe:"1D"},action:{type:"buy",orderType:"market"}},{id:"2",type:"exit",condition:{indicator:"price",operator:"crosses_below",value:"sma_20",timeframe:"1D"},action:{type:"sell",orderType:"market"}}],riskManagement:{maxPositionSize:10,stopLoss:5,takeProfit:15,maxDailyLoss:2,trailingStop:3},createdAt:(new Date).toISOString()}}}let Th=null;function vh(){return Th||(Th=new bh),Th}const _h={get instance(){return vh()}};const wh=new class{roundPrice(e){return null==e||isNaN(e)?null:Math.round(100*e)/100}async getCachedQuote(t){try{const n=await Rr.select().from(pr).where(e.eq(pr.symbol,t.toUpperCase())).limit(1);if(0===n.length)return null;const r=n[0];return{symbol:r.symbol,price:r.price,change:r.change,changePercent:r.changePercent,open:r.open,high:r.high,low:r.low,previousClose:r.previousClose,volume:r.volume}}catch(n){return console.error(`[QuoteCache] Error reading cache for ${t}:`,n.message),null}}async saveQuoteToCache(e){try{const t={symbol:e.symbol.toUpperCase(),price:this.roundPrice(e.price)||0,change:this.roundPrice(e.change),changePercent:this.roundPrice(e.changePercent),open:this.roundPrice(e.open),high:this.roundPrice(e.high),low:this.roundPrice(e.low),previousClose:this.roundPrice(e.previousClose),volume:e.volume};await Rr.insert(pr).values(t).onConflictDoUpdate({target:pr.symbol,set:{price:t.price,change:t.change,changePercent:t.changePercent,open:t.open,high:t.high,low:t.low,previousClose:t.previousClose,volume:t.volume}})}catch(t){console.error(`[QuoteCache] Error saving quote for ${e.symbol}:`,t.message)}}async saveQuotesToCache(e){try{await Promise.all(e.map(e=>this.saveQuoteToCache(e)))}catch(t){console.error("[QuoteCache] Error saving quotes to cache:",t.message)}}async saveHistoricalQuotes(e,t){if(t&&0!==t.length)try{const r=new Date,i=e.toUpperCase(),a=t.filter(t=>!!(t.date&&t.open&&t.high&&t.low&&t.close)||(console.warn(`[QuoteCache] Skipping invalid quote for ${e} on ${t.date}`),!1)).map(e=>({id:`${i}-${e.date}`,symbol:i,date:e.date,open:this.roundPrice(e.open)||0,high:this.roundPrice(e.high)||0,low:this.roundPrice(e.low)||0,close:this.roundPrice(e.close)||0,volume:e.volume||null,adjustedClose:this.roundPrice(e.adjustedClose)||null,createdAt:r}));if(0===a.length)return;const o=50;for(let t=0;t<a.length;t+=o){const r=a.slice(t,t+o);for(const t of r)try{await Rr.insert(fr).values(t).onConflictDoNothing()}catch(n){console.error(`[QuoteCache] Failed to insert historical quote for ${e} on ${t.date}:`,n.message||n)}}}catch(r){console.error(`[QuoteCache] Error saving historical quotes for ${e}:`,r.message||r,r.stack)}}async getCachedHistoricalQuotes(t,n,r){try{const i=t.toUpperCase();let a=Rr.select().from(fr).where(e.eq(fr.symbol,i));let o=await a;return n&&(o=o.filter(e=>e.date>=n)),r&&(o=o.filter(e=>e.date<=r)),o.map(e=>({date:e.date,open:e.open,high:e.high,low:e.low,close:e.close,volume:e.volume||void 0,adjustedClose:e.adjustedClose||void 0}))}catch(i){return console.error(`[QuoteCache] Error reading historical quotes for ${t}:`,i.message),[]}}async saveFundamentals(e,t){try{const n=new Date,r={symbol:e.toUpperCase(),peRatio:this.roundPrice(t.peRatio),eps:this.roundPrice(t.eps),dividendYield:this.roundPrice(t.dividendYield),beta:this.roundPrice(t.beta),fiftyTwoWeekHigh:this.roundPrice(t.fiftyTwoWeekHigh),fiftyTwoWeekLow:this.roundPrice(t.fiftyTwoWeekLow),fiftyDayAverage:this.roundPrice(t.fiftyDayAverage),twoHundredDayAverage:this.roundPrice(t.twoHundredDayAverage),sharesOutstanding:t.sharesOutstanding,bookValue:this.roundPrice(t.bookValue),priceToBook:this.roundPrice(t.priceToBook),trailingPE:this.roundPrice(t.trailingPE),forwardPE:this.roundPrice(t.forwardPE),lastFetched:n,createdAt:n,updatedAt:n};await Rr.insert(hr).values(r).onConflictDoUpdate({target:hr.symbol,set:{peRatio:r.peRatio,eps:r.eps,dividendYield:r.dividendYield,beta:r.beta,fiftyTwoWeekHigh:r.fiftyTwoWeekHigh,fiftyTwoWeekLow:r.fiftyTwoWeekLow,fiftyDayAverage:r.fiftyDayAverage,twoHundredDayAverage:r.twoHundredDayAverage,sharesOutstanding:r.sharesOutstanding,bookValue:r.bookValue,priceToBook:r.priceToBook,trailingPE:r.trailingPE,forwardPE:r.forwardPE,lastFetched:n,updatedAt:n}})}catch(n){console.error(`[QuoteCache] Error saving fundamentals for ${e}:`,n.message)}}async getCachedFundamentals(t){try{const n=await Rr.select().from(hr).where(e.eq(hr.symbol,t.toUpperCase())).limit(1);if(0===n.length)return null;const r=n[0],i=new Date,a=new Date(r.lastFetched);return i.getTime()-a.getTime()>864e5?null:r}catch(n){return console.error(`[QuoteCache] Error reading fundamentals for ${t}:`,n.message),null}}async clearExpiredCache(){}};function Eh(e,t,n){return Promise.race([e,new Promise((e,r)=>setTimeout(()=>r(new Error(n)),t))])}class Ph{async getQuote(e,t={}){const{useCache:n=!0,cacheTTL:r}=t;if(console.log(`[UnifiedQuote] Fetching quote for ${e} (useCache: ${n}${r?`, cacheTTL: ${r}ms`:""})`),n)try{const t=await wh.getCachedQuote(e,r);if(t)return console.log(`[UnifiedQuote] ✓ Returning cached quote for ${e}`),{success:!0,data:t}}catch(i){console.log(`[UnifiedQuote] Cache check failed for ${e}: ${i.message}`)}else console.log(`[UnifiedQuote] Skipping cache for ${e} (live data requested)`);try{console.log(`[UnifiedQuote] Trying alpaca for ${e}...`);const t=vh(),n=await Eh(t.getQuote(e),1e4,`alpaca timeout after 10s for ${e}`);if(n){const t=n,r={symbol:e,price:t.ap||t.bp||0,change:null,changePercent:null,open:null,high:null,low:null,previousClose:null,volume:t.as||t.bs||null,marketCap:null,currency:"USD",name:e,exchange:t.x||null,timestamp:t.t?new Date(t.t):new Date,source:"alpaca"};return console.log(`[UnifiedQuote] ✓ alpaca succeeded for ${e}`),await wh.saveQuoteToCache(r),{success:!0,data:r}}}catch(i){console.log(`[UnifiedQuote] ✗ alpaca failed for ${e}: ${i.message}`)}try{console.log(`[UnifiedQuote] Trying yfinance for ${e}...`);const t=await Eh(xr.getQuote(e),1e4,`yfinance timeout after 10s for ${e}`);if(t.success&&t.data){const n=t.data,r={symbol:e,price:n.regularMarketPrice||n.currentPrice||0,change:n.regularMarketChange||null,changePercent:n.regularMarketChangePercent||null,open:n.regularMarketOpen||n.open||null,high:n.regularMarketDayHigh||n.dayHigh||null,low:n.regularMarketDayLow||n.dayLow||null,previousClose:n.regularMarketPreviousClose||n.previousClose||null,volume:n.volume||null,marketCap:n.marketCap||null,currency:n.currency||"USD",name:n.longName||n.shortName||e,exchange:n.exchange||n.fullExchangeName||null,timestamp:n.regularMarketTime?new Date(n.regularMarketTime):new Date,source:"yfinance"};return console.log(`[UnifiedQuote] ✓ yfinance succeeded for ${e}`),await wh.saveQuoteToCache(r),{success:!0,data:r}}}catch(i){console.log(`[UnifiedQuote] ✗ yfinance failed for ${e}: ${i.message}`)}return console.error(`[UnifiedQuote] All sources failed for ${e}`),{success:!1,error:`Failed to fetch quote for ${e} from all sources (alpaca, yfinance)`}}async getQuotes(e,t={}){const{useCache:n=!0,cacheTTL:r}=t;if(console.log(`[UnifiedQuotes] Fetching quotes for ${e.length} symbols (useCache: ${n}${r?`, cacheTTL: ${r}ms`:""})`),0===e.length)return{success:!1,error:"No symbols provided"};const i=[],a=[];if(n)try{for(const t of e){const e=await wh.getCachedQuote(t,r);e?i.push(e):a.push(t)}if(console.log(`[UnifiedQuotes] Found ${i.length}/${e.length} quotes in cache`),0===a.length)return{success:!0,data:{quotes:i,source:"mixed",timestamp:new Date}}}catch(c){console.log(`[UnifiedQuotes] Cache check failed: ${c.message}`)}else console.log("[UnifiedQuotes] Skipping cache for all symbols (live data requested)"),a.push(...e);const o=a.length>0?a:e;console.log(`[UnifiedQuotes] Fetching ${o.length} symbols individually...`);const s=[...i];for(const l of o){const e=await this.getQuote(l,{useCache:n,cacheTTL:r});e.success&&e.data&&s.push(e.data)}return s.length>0?{success:!0,data:{quotes:s,source:"mixed",timestamp:new Date}}:(console.error("[UnifiedQuotes] Failed to fetch any quotes"),{success:!1,error:`Failed to fetch quotes for any of the ${e.length} symbols`})}async getHistoricalQuotes(e,t,n,r={}){const{forceRefreshRecent:i=!0}=r,a=e.toUpperCase(),o="string"==typeof t?t:t.toISOString().split("T")[0],s="string"==typeof n?n:n.toISOString().split("T")[0];console.log(`[UnifiedHistorical] Fetching historical data for ${a} from ${o} to ${s}`);let c=[];try{c=await wh.getCachedHistoricalQuotes(a,o,s),console.log(`[UnifiedHistorical] Found ${c.length} cached quotes for ${a}`)}catch(I){console.log(`[UnifiedHistorical] Cache read failed: ${I.message}`)}const l=this.generateTradingDates(o,s);console.log(`[UnifiedHistorical] Expected ~${l.length} trading days in range`);const u=new Set(c.map(e=>e.date));let d=l.filter(e=>!u.has(e));if(i&&c.length>0){const e=new Date(new Date);e.setDate(e.getDate()-2);const t=e.toISOString().split("T")[0],n=l.filter(e=>e>=t);for(const r of n)d.includes(r)||d.push(r);c=c.filter(e=>e.date<t)}if(console.log(`[UnifiedHistorical] Missing ${d.length} dates to fetch`),0===d.length)return console.log(`[UnifiedHistorical] ✓ All data found in cache for ${a}`),{success:!0,symbol:a,data:{quotes:c.sort((e,t)=>e.date.localeCompare(t.date)),meta:{symbol:a,cachedCount:c.length,fetchedCount:0,source:"cache"}}};let p=[];d.sort();const h=d[0],f=d[d.length-1];try{console.log(`[UnifiedHistorical] Fetching from Alpaca: ${h} to ${f}...`);const e=vh(),t=await Eh(e.getBars({symbol:a,timeframe:"1Day",start:h,end:f}),3e4,`Alpaca historical timeout after 30s for ${a}`);t&&Array.isArray(t)&&(p=t.map(e=>({date:e.t?e.t.split("T")[0]:new Date(e.Timestamp||e.t).toISOString().split("T")[0],open:e.o??e.OpenPrice??0,high:e.h??e.HighPrice??0,low:e.l??e.LowPrice??0,close:e.c??e.ClosePrice??0,volume:e.v??e.Volume??void 0})),console.log(`[UnifiedHistorical] ✓ Alpaca returned ${p.length} bars`),p.length>0&&(await wh.saveHistoricalQuotes(a,p),console.log(`[UnifiedHistorical] Saved ${p.length} quotes to cache`)))}catch(I){console.log(`[UnifiedHistorical] ✗ Alpaca failed: ${I.message}`);try{console.log("[UnifiedHistorical] Trying finnhub fallback...");const e=await Ah.getHistoricalData({symbol:a,period1:h,period2:f,interval:"D"});e.success&&e.data?.quotes&&(p=e.data.quotes.map(e=>({date:e.date instanceof Date?e.date.toISOString().split("T")[0]:e.date,open:e.open,high:e.high,low:e.low,close:e.close,volume:e.volume})),console.log(`[UnifiedHistorical] ✓ Finnhub returned ${p.length} bars`),p.length>0&&await wh.saveHistoricalQuotes(a,p))}catch(C){console.log(`[UnifiedHistorical] ✗ Finnhub fallback also failed: ${C.message}`)}}const m=[...c,...p],g=new Map;for(const A of m)g.set(A.date,A);const y=Array.from(g.values()).sort((e,t)=>e.date.localeCompare(t.date));return 0===y.length?{success:!1,symbol:a,error:`Failed to fetch historical data for ${a}`}:{success:!0,symbol:a,data:{quotes:y,meta:{symbol:a,cachedCount:c.length,fetchedCount:p.length,source:p.length>0?c.length>0?"mixed":"alpaca":"cache"}}}}generateTradingDates(e,t){const n=[],r=new Date(e),i=new Date(t),a=new Date(r);for(;a<=i;){const e=a.getDay();0!==e&&6!==e&&n.push(a.toISOString().split("T")[0]),a.setDate(a.getDate()+1)}return n}async getQuoteFromSource(e,t){console.log(`[UnifiedQuote] Fetching quote for ${e} from ${t}`);try{if("yfinance"===t){const t=await xr.getQuote(e);if(t.success&&t.data){const n=t.data;return{success:!0,data:{symbol:e,price:n.regularMarketPrice||n.currentPrice||0,change:n.regularMarketChange||null,changePercent:n.regularMarketChangePercent||null,open:n.regularMarketOpen||n.open||null,high:n.regularMarketDayHigh||n.dayHigh||null,low:n.regularMarketDayLow||n.dayLow||null,previousClose:n.regularMarketPreviousClose||n.previousClose||null,volume:n.volume||null,marketCap:n.marketCap||null,currency:n.currency||"USD",name:n.longName||n.shortName||e,exchange:n.exchange||n.fullExchangeName||null,timestamp:n.regularMarketTime?new Date(n.regularMarketTime):new Date,source:"yfinance"}}}}else if("finnhub"===t){const t=await Ah.getQuote({symbol:e});if(t.success&&t.data){const n=t.data;return{success:!0,data:{symbol:e,price:n.price?.regularMarketPrice||0,change:n.price?.regularMarketChange||null,changePercent:n.price?.regularMarketChangePercent||null,open:n.summaryDetail?.open||null,high:n.summaryDetail?.dayHigh||null,low:n.summaryDetail?.dayLow||null,previousClose:n.summaryDetail?.previousClose||null,volume:n.summaryDetail?.regularMarketVolume||null,marketCap:n.price?.marketCap||null,currency:n.price?.currency||"USD",name:n.price?.longName||n.price?.shortName||e,exchange:n.price?.exchange||null,timestamp:n.price?.regularMarketTime||new Date,source:"finnhub"}}}}else if("alpaca"===t){const t=vh(),n=await t.getQuote(e);if(n){const t=n;return{success:!0,data:{symbol:e,price:t.ap||t.bp||0,change:null,changePercent:null,open:null,high:null,low:null,previousClose:null,volume:t.as||t.bs||null,marketCap:null,currency:"USD",name:e,exchange:t.x||null,timestamp:t.t?new Date(t.t):new Date,source:"alpaca"}}}}}catch(n){return{success:!1,error:`Failed to fetch quote from ${t}: ${n.message}`}}return{success:!1,error:`No data returned from ${t}`}}}const Rh=new Ph;const Lh=["Overall","Politics","Sports","Crypto","Culture","Mentions","Weather","Economics","Tech","Finance"];function Nh(){return[]}async function Oh(e=50,t="volume24hr",n=0){try{const r=new URL(`${"https://gamma-api.polymarket.com"}/markets`);r.searchParams.set("closed","false"),r.searchParams.set("active","true"),r.searchParams.set("limit",String(e)),r.searchParams.set("offset",String(n)),r.searchParams.set("order",t),r.searchParams.set("ascending","false");const i=await a(r,{headers:{accept:"application/json"},cache:"no-store"});if(!i.ok)throw new Error(`Polymarket API returned ${i.status} ${i.statusText}`);return await i.json()}catch(r){throw console.error(`Error fetching markets (limit: ${e}, offset: ${n}):`,r.message),r}}async function Bh(e="volume24hr",t=1e3){try{const r=[];let i=0;const a=100;let o=!0,s=0;const c=3;for(;o;)try{const n=await Oh(a,e,i);if(!n||0===n.length){o=!1;break}r.push(...n),i+=n.length,s=0,(t>0&&r.length>=t||n.length<a)&&(o=!1)}catch(n){s++,console.error(`Error fetching markets batch at offset ${i} (attempt ${s}/${c}):`,n.message),s>=c?(console.error("Too many consecutive errors, stopping pagination"),o=!1):await new Promise(e=>setTimeout(e,1e3))}return t>0&&r.length>t?r.slice(0,t):r}catch(n){throw console.error("Fatal error in fetchAllMarkets:",n.message),n}}async function Mh(e){const t=new URL("https://gamma-api.polymarket.com/public-search");t.searchParams.set("q",e.q),void 0!==e.cache&&t.searchParams.set("cache",String(e.cache)),e.events_status&&t.searchParams.set("events_status",e.events_status),void 0!==e.limit_per_type&&t.searchParams.set("limit_per_type",String(e.limit_per_type)),void 0!==e.page&&t.searchParams.set("page",String(e.page)),e.events_tag&&e.events_tag.forEach(e=>t.searchParams.append("events_tag",e)),void 0!==e.keep_closed_markets&&t.searchParams.set("keep_closed_markets",String(e.keep_closed_markets)),e.sort&&t.searchParams.set("sort",e.sort),void 0!==e.ascending&&t.searchParams.set("ascending",String(e.ascending)),void 0!==e.search_tags&&t.searchParams.set("search_tags",String(e.search_tags)),void 0!==e.search_profiles&&t.searchParams.set("search_profiles",String(e.search_profiles)),e.recurrence&&t.searchParams.set("recurrence",e.recurrence),e.exclude_tag_id&&e.exclude_tag_id.forEach(e=>t.searchParams.append("exclude_tag_id",String(e))),void 0!==e.optimized&&t.searchParams.set("optimized",String(e.optimized));const n=await a(t,{headers:{accept:"application/json"},cache:"no-store"});if(!n.ok)throw console.error(`Public search failed: ${n.status}`),new Error(`Public search failed: ${n.status}`);return await n.json()}async function Dh(e={}){const{timePeriod:t="all",orderBy:n="VOL",limit:r=20,offset:i=0,category:o="Overall"}=e,s=new URL("https://data-api.polymarket.com/v1/leaderboard");s.searchParams.set("timePeriod",t),s.searchParams.set("orderBy",n),s.searchParams.set("limit",String(r)),s.searchParams.set("offset",String(i)),s.searchParams.set("category",o);const c=await a(s,{headers:{accept:"application/json"}});if(!c.ok)throw new Error(`leaderboard fetch failed: ${c.status}`);return await c.json()}async function Fh(e=50){const t=await a("https://polymarketanalytics.com/api/traders-tag-performance",{method:"POST",headers:{accept:"*/*","content-type":"application/json"},body:JSON.stringify({tag:"Overall",sortColumn:"overall_gain",sortDirection:"DESC",minPnL:-4534159.552280787,maxPnL:3203232.91229432,minActivePositions:0,maxActivePositions:38642,minWinAmount:0,maxWinAmount:20316723.043360095,minLossAmount:-20494980.369057264,maxLossAmount:0,minWinRate:0,maxWinRate:100,minCurrentValue:0,maxCurrentValue:1e12,minTotalPositions:1,maxTotalPositions:56928})});if(!t.ok)throw new Error(`leaders fetch failed: ${t.status}`);const n=await t.json();let r=[];return Array.isArray(n)?(r=n,r.slice(0,e)):(console.error("Polymarket API returned non-array:",JSON.stringify(n)),[])}async function kh(e){const t=await a("https://polymarketanalytics.com/api/traders-positions",{method:"POST",headers:{accept:"*/*","content-type":"application/json"},body:JSON.stringify({trader_id:e})});if(!t.ok)throw new Error(`positions fetch failed: ${t.status}`);return await t.json()}async function Gh(e){const{user:t,limit:n=100,offset:r=0,market:i,type:o,start:s,end:c,sortBy:l="TIMESTAMP",sortDirection:u="DESC",side:d}=e,p=new URL("https://data-api.polymarket.com/activity");p.searchParams.set("user",t),p.searchParams.set("limit",String(Math.min(n,500))),p.searchParams.set("offset",String(Math.min(r,1e4))),p.searchParams.set("sortBy",l),p.searchParams.set("sortDirection",u),i&&i.length>0&&p.searchParams.set("market",i.join(",")),o&&o.length>0&&p.searchParams.set("type",o.join(",")),void 0!==s&&p.searchParams.set("start",String(s)),void 0!==c&&p.searchParams.set("end",String(c)),d&&p.searchParams.set("side",d);const h=await a(p,{headers:{accept:"application/json"}});if(!h.ok)throw new Error(`Activity fetch failed for ${t}: ${h.status}`);return await h.json()}async function xh(e,t={},n){const r=[];let i=0;for(;i<1e4;){const a=await Gh({...t,user:e,limit:500,offset:i});if(0===a.length)break;if(r.push(...a),n?.(r.length,null),a.length<500)break;i+=500,await new Promise(e=>setTimeout(e,100))}return r}async function Hh(e){const t=new URL(`https://gamma-api.polymarket.com/markets/${e}`),n=await a(t,{headers:{accept:"application/json"},cache:"no-store"});return n.ok?await n.json():(console.error(`Market details fetch failed for market ${e}: ${n.status}`),null)}async function Uh(e){const t=await a("https://polymarketanalytics.com/api/markets-dashboard",{method:"POST",headers:{accept:"*/*","accept-language":"en-US,en;q=0.9","content-type":"application/json"},body:JSON.stringify({eventId:e}),cache:"no-store"});if(!t.ok)throw console.error(`Markets dashboard fetch failed: ${t.status}`),new Error(`Dashboard API error: ${t.status}`);return await t.json()}async function Vh(e){const{market:t,interval:n="1h",startTs:r,endTs:i,abs:o=!1}=e,s=new URL("https://clob.polymarket.com/prices-history");s.searchParams.set("market",t),s.searchParams.set("interval",n),s.searchParams.set("abs",String(o)),void 0!==r&&s.searchParams.set("startTs",String(r)),void 0!==i&&s.searchParams.set("endTs",String(i));const c=await a(s,{headers:{accept:"application/json"},cache:"no-store"});if(!c.ok){let e="";try{const t=await c.text();e=t?` - ${t}`:""}catch(l){}if(400===c.status)throw new Error(`Invalid token or price history not available for token ${t}${e}`);throw new Error(`Price history fetch failed for token ${t}: ${c.status}${e}`)}return await c.json()}function $h(e){return{info:(t,n)=>{"string"==typeof t?console.log(`[${e}] INFO: ${t}`,n||""):console.log(`[${e}] INFO:`,n||"",t)},debug:(t,n)=>{"string"==typeof t?console.debug(`[${e}] DEBUG: ${t}`,n||""):console.debug(`[${e}] DEBUG:`,n||"",t)},warn:(t,n)=>{"string"==typeof t?console.warn(`[${e}] WARN: ${t}`,n||""):console.warn(`[${e}] WARN:`,n||"",t)},error:(t,n)=>{"string"==typeof t?console.error(`[${e}] ERROR: ${t}`,n||""):console.error(`[${e}] ERROR:`,n||"",t)}}}const jh=$h("gamma"),Wh="https://gamma-api.polymarket.com";function Xh(e,t,n,r){const i=t.toLowerCase();for(const o of n)if(i===o.toLowerCase())return{blocked:!0,reason:"category",matchedValue:o};const a=e.toLowerCase();for(const o of r)if(a.includes(o.toLowerCase()))return{blocked:!0,reason:"keyword",matchedValue:o};return{blocked:!1}}const Kh=5e4;function Yh(e,t,n){if(e.closed)return null;if((e.volumeNum??e.volume24hr??0)<Kh)return null;let r="",i="";if(e.clobTokenIds)try{const t=JSON.parse(e.clobTokenIds);r=t[0]??"",i=t[1]??""}catch{}let a=0,o=0;if(e.outcomePrices)try{const t=JSON.parse(e.outcomePrices);a=parseFloat(t[0]??"0")||0,o=parseFloat(t[1]??"0")||0}catch{}if(!r&&!i)return null;let s=null;e.endDate?s=new Date(e.endDate):e.endDateIso&&(s=new Date(e.endDateIso));return{market:{id:e.id,conditionId:e.conditionId??"",question:e.question,slug:e.slug??"",eventSlug:n,category:t,endDate:s,active:e.active??!0,volumeNum:e.volumeNum??e.volume24hr??0,tokenYes:r,tokenNo:i},yesPrice:a,noPrice:o}}const qh={Politics:{Elections:["election","vote","ballot","primary","electoral","swing state","battleground","polling","voter","campaign"],Presidency:["president","presidential","white house","oval office","executive order","trump","biden","administration"],Legislature:["senate","congress","house","representative","senator","bill","legislation","legislative","congress","filibuster"],Cabinet:["cabinet","secretary of","attorney general","chief of staff","press secretary","advisor","nominee","confirmation"],Judicial:["supreme court","justice","judge","ruling","court decision","judicial","scotus"],"Foreign Policy":["foreign policy","international","embassy","diplomat","treaty","sanctions","nato","un","united nations"]},Sports:{Football:["nfl","super bowl","quarterback","touchdown","football","patriots","cowboys","chiefs"],Basketball:["nba","basketball","lebron","championship","finals","lakers","warriors","celtics"],Baseball:["mlb","baseball","world series","yankees","dodgers"],Soccer:["fifa","world cup","premier league","messi","ronaldo","soccer","uefa","champions league"],Hockey:["nhl","hockey","stanley cup"],Olympics:["olympics","olympic","gold medal","winter games","summer games"],Combat:["ufc","boxing","mma","fight","fighter","heavyweight"],Racing:["nascar","f1","formula 1","racing","grand prix"]},Crypto:{Bitcoin:["bitcoin","btc","satoshi"],Ethereum:["ethereum","eth","vitalik","erc","gas fees"],Altcoins:["solana","cardano","polygon","avalanche","polkadot","chainlink","altcoin"],DeFi:["defi","decentralized finance","lending","liquidity","yield","staking","aave","uniswap"],NFTs:["nft","non-fungible","opensea","bored ape","cryptopunk"],Memecoins:["doge","dogecoin","shib","shiba","pepe","memecoin"],Exchanges:["binance","coinbase","kraken","ftx","exchange"],Regulation:["sec","regulation","compliance","etf","custody"]},Culture:{Movies:["movie","film","box office","oscar","academy awards","director","actor","cinema"],Music:["music","album","song","grammy","billboard","artist","concert","tour","spotify"],TV:["netflix","tv show","series","streaming","emmy","hulu","disney+"],Social:["tiktok","instagram","youtube","twitter","influencer","viral","trending"],Gaming:["gaming","video game","esports","twitch","xbox","playstation"],Awards:["award","oscar","grammy","emmy","golden globe"]},Weather:{Temperature:["temperature","degrees","celsius","fahrenheit","heat","cold"],Storms:["hurricane","storm","tornado","cyclone","typhoon"],Precipitation:["rain","rainfall","snow","snowfall","precipitation"],Climate:["climate","global warming","el nino","la nina"]},Economics:{"Monetary Policy":["federal reserve","fed","interest rate","rate cut","rate hike","powell"],Inflation:["inflation","cpi","pce","prices","deflation"],Employment:["unemployment","jobs","employment","payroll","labor market"],Growth:["gdp","growth","recession","expansion","contraction"],Trade:["trade","tariff","export","import","trade war"]},Tech:{"Big Tech":["apple","google","microsoft","amazon","meta","facebook"],AI:["ai","artificial intelligence","chatgpt","openai","claude","llm","machine learning"],Semiconductors:["nvidia","amd","intel","chip","semiconductor","tsmc"],Space:["spacex","starship","rocket","satellite","space"],Automotive:["tesla","electric vehicle","ev","autonomous","self-driving"],Software:["software","saas","platform","app","application"]},Finance:{Stocks:["stock","equity","shares","nasdaq","s&p","dow","market cap","trading"],Banking:["bank","banking","goldman","jpmorgan","wells fargo"],IPO:["ipo","initial public offering","listing","debut"],Earnings:["earnings","revenue","profit","eps","quarterly results"],Markets:["bull market","bear market","correction","crash","rally"]}},Qh={Politics:["election","president","senate","congress","vote","democrat","republican","trump","biden","policy","government","political","politician","cabinet","white house","legislative","bill","law","supreme court"],Sports:["nfl","nba","mlb","nhl","fifa","olympics","championship","playoff","super bowl","world cup","champion","athlete","player","team","match","game","sports","tournament","soccer","basketball","football","baseball","hockey"],Crypto:["bitcoin","ethereum","btc","eth","crypto","blockchain","defi","nft","token","altcoin","cryptocurrency","binance","coinbase","solana","cardano","polygon","doge","shib","web3"],Culture:["entertainment","celebrity","movie","music","artist","album","box office","grammy","oscar","emmy","award","netflix","spotify","tiktok","instagram","youtube","influencer","viral","meme"],Weather:["hurricane","temperature","rainfall","snow","storm","climate","tornado","flood","drought","weather","forecast","celsius","fahrenheit"],Economics:["gdp","inflation","recession","unemployment","interest rate","federal reserve","fed","economy","economic","market","jobs","employment","cpi","pce"],Tech:["apple","google","microsoft","amazon","meta","tesla","nvidia","ai","artificial intelligence","chatgpt","openai","technology","software","hardware","chip","semiconductor","spacex","starship","rocket"],Finance:["stock","nasdaq","s&p","dow","ipo","earnings","revenue","profit","market cap","trading","shares","investor","wall street","banking","financial"]};function Jh(e,t){for(const r of Lh)if("Overall"!==r&&"Mentions"!==r&&e.some(e=>e.toLowerCase()===r.toLowerCase()))return r;const n=t.toLowerCase();for(const[r,i]of Object.entries(Qh))for(const e of i)if(n.includes(e.toLowerCase()))return r;for(const r of e){const e=r.toLowerCase();for(const[t,n]of Object.entries(Qh))for(const r of n)if(e.includes(r.toLowerCase()))return t}return"Overall"}function zh(e,t,n=[]){const r=qh[e];if(!r)return null;const i=t.toLowerCase(),a=n.map(e=>e.toLowerCase()),o={};for(const[s,c]of Object.entries(r)){let e=0;for(const t of c)i.includes(t.toLowerCase())&&(e+=2);for(const t of a)for(const n of c)t.includes(n.toLowerCase())&&(e+=1);e>0&&(o[s]=e)}if(Object.keys(o).length>0){return Object.entries(o).sort((e,t)=>t[1]-e[1])[0][0]}return null}function Zh(e){if(!e)return[];if(Array.isArray(e))return e;if("string"==typeof e)try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}return[]}function ef(e){if(null==e)return JSON.stringify([]);if("string"==typeof e)try{return JSON.parse(e),e}catch{return JSON.stringify([e])}return JSON.stringify(e)}async function tf(e){const t=Date.now();let n=0,r=0;for(const a of e)try{const e=a.events&&a.events.length>0?a.events[0].slug:null,r=Zh(a.tags),i=Jh(r,a.question),o=i?zh(i,a.question,r):null;await Rr.insert(jn).values({id:a.id,conditionId:a.conditionId||null,question:a.question,slug:a.slug,eventSlug:e,description:a.description||null,image:a.imageUrl||a.image||null,volume24hr:a.volume24hr||0,volumeTotal:a.volumeNum||a.volumeTotal||0,active:a.active??!0,closed:a.closed??!1,outcomes:ef(a.outcomes),outcomePrices:ef(a.outcomePrices),clobTokenIds:ef(a.clobTokenIds),tags:ef(a.tags),category:i,subcategory:o,endDate:a.endDate||null,groupItemTitle:a.groupItemTitle||null,enableOrderBook:a.enableOrderBook??!1,createdAt:new Date(t),updatedAt:new Date(t)}).onConflictDoUpdate({target:jn.id,set:{conditionId:a.conditionId||null,question:a.question,eventSlug:e,description:a.description||null,image:a.imageUrl||a.image||null,volume24hr:a.volume24hr||0,volumeTotal:a.volumeNum||a.volumeTotal||0,active:a.active??!0,closed:a.closed??!1,outcomes:ef(a.outcomes),outcomePrices:ef(a.outcomePrices),clobTokenIds:ef(a.clobTokenIds),tags:ef(a.tags),category:i,subcategory:o,endDate:a.endDate||null,groupItemTitle:a.groupItemTitle||null,enableOrderBook:a.enableOrderBook??!1,updatedAt:new Date(t)}}),n++}catch(i){r++,console.error(`Failed to save market ${a.id} (${a.question}):`,i.message)}r>0&&console.log(`Saved ${n}/${e.length} markets (${r} failed)`)}async function nf(e){const t=Date.now();for(const n of e)await Rr.insert(Un).values({trader:n.trader,userName:n.trader_name||null,overallGain:n.overall_gain||0,winRate:n.win_rate||0,activePositions:n.active_positions||0,totalPositions:n.total_positions||0,currentValue:n.current_value||0,winAmount:n.win_amount||0,lossAmount:n.loss_amount||0,updatedAt:new Date(t)}).onConflictDoUpdate({target:Un.trader,set:{userName:n.trader_name||null,overallGain:n.overall_gain||0,winRate:n.win_rate||0,activePositions:n.active_positions||0,totalPositions:n.total_positions||0,currentValue:n.current_value||0,winAmount:n.win_amount||0,lossAmount:n.loss_amount||0,updatedAt:new Date(t)}})}async function rf(e){const t=Date.now();for(const n of e)await Rr.insert(Un).values({trader:n.proxyWallet,rank:parseInt(n.rank),userName:n.userName||null,xUsername:n.xUsername||null,verifiedBadge:n.verifiedBadge||!1,profileImage:n.profileImage||null,vol:n.vol||0,pnl:n.pnl||0,updatedAt:new Date(t)}).onConflictDoUpdate({target:Un.trader,set:{rank:parseInt(n.rank),userName:n.userName||null,xUsername:n.xUsername||null,verifiedBadge:n.verifiedBadge||!1,profileImage:n.profileImage||null,vol:n.vol||0,pnl:n.pnl||0,updatedAt:new Date(t)}})}async function af(e,t){const n=Date.now();for(const r of t){const t=JSON.stringify(r.tags||r.market_tags||[]),i=`${e}-${r.market_id||r.id||Math.random()}`;await Rr.insert(Vn).values({id:i,traderId:e,marketId:r.market_id||r.id,marketTitle:r.market_title||r.title||"",cashPnl:r.cashPnl||r.cash_pnl||0,realizedPnl:r.realizedPnl||r.realized_pnl||0,tags:t,createdAt:new Date(n)}).onConflictDoUpdate({target:Vn.id,set:{cashPnl:r.cashPnl||r.cash_pnl||0,realizedPnl:r.realizedPnl||r.realized_pnl||0,tags:t}})}}async function of(t,n){const r=Date.now();await Rr.delete(Yn).where(e.eq(Yn.marketId,t));for(const[e,i]of n.entries()){const n=i.address||i.user||i.proxyWallet||"",a=`${t}-${n}-${Date.now()}-${e}`;await Rr.insert(Yn).values({id:a,marketId:t,address:n,userName:i.userName||i.username||i.name||null,profileImage:i.profileImage||i.image||null,rank:e+1,outcome:i.outcome||i.side||null,balance:parseFloat(i.balance||i.shares||0),value:parseFloat(i.value||i.volume||i.usdValue||0),overallGain:i.overallGain||i.pnl||i.gain||null,winRate:i.winRate??null,totalProfit:i.totalProfit??null,totalLoss:i.totalLoss??null,totalPositions:i.totalPositions??null,updatedAt:new Date(r)})}}async function sf(e,t,n="1h"){try{Date.now();if(!t.history||0===t.history.length)return void console.log(`No price history data to save for token ${e}`);for(const i of t.history)try{const t=`${e}-${i.t}-${n}`;await Rr.insert(Kn).values({id:t,tokenId:e,timestamp:i.t,price:i.p,interval:n,createdAt:new Date}).onConflictDoUpdate({target:Kn.id,set:{price:i.p}})}catch(r){console.error(`Failed to save price point for token ${e} at timestamp ${i.t}:`,r.message)}}catch(i){throw console.error(`Error saving price history for token ${e}:`,i.message),i}}async function cf(t,n={}){const{interval:r,startTimestamp:i,endTimestamp:a,limit:o}=n,s=[e.eq(Kn.tokenId,t)];r&&s.push(e.eq(Kn.interval,r));let c=Rr.select().from(Kn).where(e.and(...s)).orderBy(e.asc(Kn.timestamp));o&&(c=c.limit(o));const l=await c;let u=l;return void 0===i&&void 0===a||(u=l.filter(e=>!(void 0!==i&&e.timestamp<i)&&!(void 0!==a&&e.timestamp>a))),u}async function lf(e,t){const n=new Date;let r=0;for(const a of t){const t=`${a.transactionHash}-${a.outcomeIndex??0}`;try{await Rr.insert(qn).values({id:t,traderId:a.proxyWallet||e,transactionHash:a.transactionHash,conditionId:a.conditionId,marketTitle:a.title||null,marketSlug:a.slug||null,eventSlug:a.eventSlug||null,type:a.type,side:a.side||null,outcome:a.outcome||null,outcomeIndex:a.outcomeIndex??null,size:parseFloat(a.size)||0,usdcSize:parseFloat(a.usdcSize)||0,price:a.price?parseFloat(a.price):null,traderName:a.pseudonym||null,traderBio:a.bio||null,traderProfileImage:a.profileImage||null,timestamp:new Date(1e3*a.timestamp),syncedAt:n,createdAt:n}).onConflictDoUpdate({target:qn.id,set:{marketTitle:a.title||null,marketSlug:a.slug||null,eventSlug:a.eventSlug||null,traderName:a.pseudonym||null,traderBio:a.bio||null,traderProfileImage:a.profileImage||null,syncedAt:n}}),r++}catch(i){console.error(`Error saving trade ${t}:`,i)}}return r}async function uf(e,t){const n=new Date;await Rr.insert(Qn).values({traderId:e,syncStatus:t.syncStatus||"pending",lastSyncedTimestamp:t.lastSyncedTimestamp||null,totalTradesSynced:t.totalTradesSynced||0,errorMessage:t.errorMessage||null,lastSyncAttempt:n,createdAt:n,updatedAt:n}).onConflictDoUpdate({target:Qn.traderId,set:{...t.syncStatus&&{syncStatus:t.syncStatus},...t.lastSyncedTimestamp&&{lastSyncedTimestamp:t.lastSyncedTimestamp},...void 0!==t.totalTradesSynced&&{totalTradesSynced:t.totalTradesSynced},...void 0!==t.errorMessage&&{errorMessage:t.errorMessage},lastSyncAttempt:n,updatedAt:n}})}async function df(t){return(await Rr.select().from(Qn).where(e.eq(Qn.traderId,t)).limit(1))[0]||null}async function pf(t){const n=await Rr.select({timestamp:e.sql`max(strftime('%s', ${qn.timestamp}))`}).from(qn).where(e.eq(qn.traderId,t));return n[0]?.timestamp||null}async function hf(){const t=await Rr.select({status:Qn.syncStatus,count:e.sql`count(*)`}).from(Qn).groupBy(Qn.syncStatus),n={pending:0,in_progress:0,completed:0,error:0,total:0};for(const e of t)n[e.status]=e.count,n.total+=e.count;return n}async function ff(e){const t=Date.now();await Rr.delete($n);for(const n of e)await Rr.insert($n).values({tag:n.tag,pnl:n.pnl,updatedAt:new Date(t)})}function mf(e){const t=new Map;for(const r of e){const e=Number(r.cash_pnl||r.cashPnl||r.realized_pnl||r.realizedPnl||0);if(!e)continue;let n=r.tags||r.market_tags||[];if("string"==typeof n)try{n=JSON.parse(n)}catch{n=[]}for(const r of n){const n=t.get(r)||0;t.set(r,n+e)}}const n=Array.from(t.entries()).map(([e,t])=>({tag:e,pnl:t}));n.sort((e,t)=>t.pnl-e.pnl);return{best:n.slice(0,20),worst:[...n].sort((e,t)=>e.pnl-t.pnl).slice(0,20)}}async function gf(e,t){return new Map}const yf=$h("greeks");function If(e){return Math.exp(-.5*e*e)/Math.sqrt(2*Math.PI)}function Cf(e){const t=Math.max(1e-4,Math.min(.9999,e)),n=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],r=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],i=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],a=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],o=.02425;let s,c;return t<o?(s=Math.sqrt(-2*Math.log(t)),(((((i[0]*s+i[1])*s+i[2])*s+i[3])*s+i[4])*s+i[5])/((((a[0]*s+a[1])*s+a[2])*s+a[3])*s+1)):t<=.97575?(s=t-.5,c=s*s,(((((n[0]*c+n[1])*c+n[2])*c+n[3])*c+n[4])*c+n[5])*s/(((((r[0]*c+r[1])*c+r[2])*c+r[3])*c+r[4])*c+1)):(s=Math.sqrt(-2*Math.log(1-t)),-(((((i[0]*s+i[1])*s+i[2])*s+i[3])*s+i[4])*s+i[5])/((((a[0]*s+a[1])*s+a[2])*s+a[3])*s+1))}async function Af(e){const t={query:async(e,t)=>(console.log("Mock query executed:",e),{rows:[]})};try{const n=(await t.query("\n WITH daily_prices AS (\n SELECT\n DATE(timestamp) as date,\n AVG(price) as avg_price\n FROM price_snapshots\n WHERE token_id = $1\n AND timestamp >= NOW() - INTERVAL '7 days'\n GROUP BY DATE(timestamp)\n ORDER BY date\n ),\n returns AS (\n SELECT\n (avg_price - LAG(avg_price) OVER (ORDER BY date)) /\n NULLIF(LAG(avg_price) OVER (ORDER BY date), 0) as daily_return\n FROM daily_prices\n )\n SELECT\n COALESCE(STDDEV(daily_return), 0) as daily_vol,\n COUNT(*) as sample_count\n FROM returns\n WHERE daily_return IS NOT NULL\n ",[e])).rows[0],r=Number(n?.daily_vol)||0,i=Number(n?.sample_count)||0,a=r*Math.sqrt(365);return yf.debug({tokenId:e,dailyVol:r,annualizedVol:a,sampleCount:i},"Calculated historical volatility"),i<3?.5:Math.max(.1,Math.min(3,a))}catch(n){return yf.error({err:n,tokenId:e},"Failed to calculate volatility"),.5}}async function Sf(e,t,n){const r=new Date,i=n?Math.max(0,(n.getTime()-r.getTime())/864e5):365,a=i/365,o=await Af(t),s=function(e,t,n){return t<=0||n<=0?0:-n*If(Cf(e))/(2*Math.sqrt(t))*100/365}(e,a,o),c=function(e,t){return t<=0?0:If(Cf(e))*Math.sqrt(t)}(e,a);var l;return{theta:s,vega:c,impliedVol:o,uncertainty:(l=e)*(1-l),daysToExpiry:i}}const bf={name:"greeks",async enrich(e){const{movement:t}=e;try{const n=await Sf(t.priceAfter,t.tokenId,t.market.endDate);return yf.debug({marketId:t.marketId,theta:n.theta.toFixed(3),vega:n.vega.toFixed(3),impliedVol:(100*n.impliedVol).toFixed(1)},"Calculated Greeks"),{...e,enrichments:{...e.enrichments,greeks:n}}}catch(n){return yf.error({err:n,marketId:t.marketId},"Failed to calculate Greeks"),e}}},Tf=$h("detector");function vf(e,t,n,r,i,a){if(!r||null===r.oldest||null===r.latest)return null;const o=100*(r.latest-r.oldest),s=o;return Math.abs(o)>=i?(Tf.debug({marketId:e.id,side:n,changeCents:o.toFixed(1),windowMinutes:a,threshold:i},"Movement detected"),{marketId:e.id,market:e,tokenId:t,side:n,priceBefore:r.oldest,priceAfter:r.latest,changePercent:s,timeWindowMinutes:a,detectedAt:new Date}):null}async function _f(e,t={}){const{interval:n="1h",startTs:r,endTs:i,abs:a=!1}=t,o=await Vh({market:e,interval:n,startTs:r,endTs:i,abs:a});await sf(e,o,n);return{pricePoints:o.history?.length||0}}async function wf(e=200,t=!0){try{console.log("Starting Polymarket markets sync...");try{await Rr.delete(jn)}catch(n){console.error("Failed to clear existing markets:",n.message)}const r=await Oh(e,"volume24hr");await tf(r),console.log(`Saved ${r.length} markets`);let i=0;if(t){console.log("Fetching price history for markets...");for(const e of r)if(e.clobTokenIds&&e.clobTokenIds.length>0)try{const t=e.clobTokenIds[0];if(!t||"string"!=typeof t||t.trim().length<10||!/^[a-zA-Z0-9_-]+$/.test(t)){console.log(`Skipping market ${e.id} - Invalid token ID: ${t}`);continue}i+=(await _f(t,{interval:"1h"})).pricePoints}catch(n){n.message?.includes("400")||n.message?.includes("Invalid token")?console.log(`Skipping market ${e.id} - ${n.message}`):console.error(`Error syncing price history for market ${e.id}:`,n.message)}console.log(`Saved ${i} price data points across all markets`)}return{markets:r.length,pricePoints:i}}catch(n){throw console.error("Fatal error in syncMarkets:",n.message),n}}async function Ef(e={}){console.log("Starting Polymarket leaderboard sync...");const t=await Dh(e);return await rf(t),console.log(`Saved ${t.length} leaderboard entries`),{leaders:t.length}}async function Pf(){console.log("Starting Polymarket sync...");const e=await Fh(50);await nf(e),console.log(`Saved ${e.length} leaders`);const t=[];for(const r of e){const e=r.trader,n=await kh(e);await af(e,n),t.push(...n),console.log(`Saved positions for trader ${e}`)}const n=mf(t);return await ff([...n.best,...n.worst]),console.log(`Saved ${n.best.length+n.worst.length} categories`),{leaders:e.length,positions:t.length}}async function Rf(e,t={}){const{timePeriod:n="all",orderBy:r="VOL"}=t,i=[];let a=0;for(;i.length<e;){const t=await Dh({timePeriod:n,orderBy:r,limit:Math.min(100,e-i.length),offset:a});if(!Array.isArray(t)||0===t.length)break;i.push(...t),a+=100,await new Promise(e=>setTimeout(e,100))}return i.length>0&&await rf(i),i.map(e=>e.trader||e.proxyWallet||e.proxy_wallet||e.address||e.user).filter(Boolean).slice(0,e)}async function Lf(e,t={}){await uf(e,{syncStatus:"in_progress"});try{let n=t.sinceTimestamp;if(!n){const t=await pf(e);t&&(n=t+1)}const r=await xh(e,{type:["TRADE"],start:n},t.onProgress),i=await lf(e,r),a=await df(e),o=(a?.totalTradesSynced||0)+i;return await uf(e,{syncStatus:"completed",totalTradesSynced:o,lastSyncedTimestamp:new Date,errorMessage:null}),i}catch(n){const t=n instanceof Error?n.message:String(n);throw await uf(e,{syncStatus:"error",errorMessage:t}),n}}async function Nf(e={}){const{limit:t=1e3,timePeriod:n="all",orderBy:r="VOL",batchSize:i=10,batchDelay:a=1e3,traderDelay:o=200,sinceTimestamp:s,skipRecentlysynced:c=24,onProgress:l}=e,u=Date.now(),d={tradersProcessed:0,tradersSkipped:0,tradersFailed:0,totalTradesSynced:0,duration:0,errors:[]};console.log(`Starting trade history sync for top ${t} traders...`),l?.({currentTrader:0,totalTraders:t,currentTraderAddress:"",tradesFetched:0,status:"fetching_leaderboard"});const p=await Rf(t,{timePeriod:n,orderBy:r});if(console.log(`Fetched ${p.length} traders from leaderboard`),0===p.length)return console.warn("No traders found in leaderboard"),d.duration=Date.now()-u,d;const h=Date.now()-60*c*60*1e3;for(const m of p){await df(m)||await uf(m,{syncStatus:"pending"})}for(let m=0;m<p.length;m+=i){const e=p.slice(m,m+i);for(let t=0;t<e.length;t++){const n=e[t],r=m+t,i=await df(n);if("completed"===i?.syncStatus&&i.lastSyncAttempt&&i.lastSyncAttempt.getTime()>h)console.log(`Skipping ${n} - synced within last ${c} hours`),d.tradersSkipped++;else{l?.({currentTrader:r+1,totalTraders:p.length,currentTraderAddress:n,tradesFetched:0,status:"syncing_trader"});try{console.log(`[${r+1}/${p.length}] Syncing trades for ${n}...`);const e=await Lf(n,{sinceTimestamp:s,onProgress:e=>{l?.({currentTrader:r+1,totalTraders:p.length,currentTraderAddress:n,tradesFetched:e,status:"syncing_trader"})}});d.tradersProcessed++,d.totalTradesSynced+=e,console.log(` -> Synced ${e} trades for ${n}`)}catch(f){const e=f instanceof Error?f.message:String(f);console.error(` -> Error syncing ${n}: ${e}`),d.tradersFailed++,d.errors.push({traderId:n,error:e})}t<e.length-1&&await new Promise(e=>setTimeout(e,o))}}m+i<p.length&&(console.log(`Batch complete. Waiting ${a}ms before next batch...`),await new Promise(e=>setTimeout(e,a)))}return d.duration=Date.now()-u,l?.({currentTrader:p.length,totalTraders:p.length,currentTraderAddress:"",tradesFetched:d.totalTradesSynced,status:"completed"}),console.log(`\nTrade history sync completed in ${d.duration}ms`),console.log(` Traders processed: ${d.tradersProcessed}`),console.log(` Traders skipped: ${d.tradersSkipped}`),console.log(` Traders failed: ${d.tradersFailed}`),console.log(` Total trades synced: ${d.totalTradesSynced}`),d}const Of=Ri.join(process.cwd(),"lib/algo-stategies/algo-strategies.json");async function Bf(e=1,t=""){const n=t?`&sort=${t}`:"",r=1===e?`https://www.tradingview.com/scripts/?component-data-only=1&script_type=strategies${n}`:`https://www.tradingview.com/scripts/page-${e}/?component-data-only=1&script_type=strategies${n}`,a=(await i.get(r,{headers:{"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0 Safari/537.36","Accept-Language":"en-US,en;q=0.9",Accept:"application/json"}})).data;return(a?.data?.ideas?.data?.items||[]).map(e=>{const t=e.user?.username||null,n=e.chart_url||`https://www.tradingview.com/script/${e.image_url}/`,r=e.likes_count||0;e.comments_count;const i=e.image_url||null;return e.symbol&&(e.symbol.short_name,e.symbol.exchange,e.symbol.logo_urls&&e.symbol.logo_urls[0]),{url:n.split("script/")[1].replace(/\/$/,""),name:e.name||null,description:e.description||null,image_url:i,author:t,likes:r,type:e.script_type||null}})}async function Mf(e,t){if(t[e.url]&&t[e.url].source)return console.log(`Using cached data for ${e.url}`),t[e.url];try{const n=`https://www.tradingview.com/script/${e.url}`,r=await i.get(n,{headers:{"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0 Safari/537.36","Accept-Language":"en-US,en;q=0.9"}}),a=r.data.match(/"script_id_part"\s*:\s*"([^"]+)"(?:[^}]+?"version_maj"\s*:\s*(\d+))?/);if(!a)return console.log(`No script_id_part found for ${e.url}`),e;const o=a[1],s=a[2]?Number(a[2]):3,c=`https://pine-facade.tradingview.com/pine-facade/get/${encodeURIComponent(o)}/${s}?no_4xx=true`;console.log(`Fetching pine-facade for ${e.url} -> ${o} (version_maj=${s})`);const l=(await i.get(c,{headers:{"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0 Safari/537.36","Accept-Language":"en-US,en;q=0.9"}})).data;let{created:u,updated:d,source:p}=l;u=new Date(u).toISOString().split("T")[0],d=new Date(d).toISOString().split("T")[0];const h={...e,updated:d,source:p};return t[e.url]=h,console.log(`Enriched ${e.url}`),h}catch(n){return console.log(`Error enriching ${e.url}: ${n.message}`),e}}(async function(){const e=function(){if(!Ri.existsSync(Of))return{};try{const e=JSON.parse(Ri.readFileSync(Of,"utf8")),t={};return Array.isArray(e)&&e.forEach(e=>{e.url&&(t[e.url]=e)}),t}catch{return{}}}(),t=process.argv.slice(2),n=t.find(e=>e.startsWith("--sort=")),r=n?n.split("=")[1]:"",i="recent"===r?"recent_extended":r,a=t.find(e=>e.startsWith("--pages=")),o=a?parseInt(a.split("=")[1],10):1,s=Array.from({length:o},(e,t)=>t+1),c=[];console.log(`Fetching TradingView scripts${i?` (sorted by: ${i})`:""}...`);for(const d of s){console.log(`Fetching page ${d}...`);const e=await Bf(d,i);c.push(...e)}console.log(`\nEnriching ${c.length} scripts with Pine Script source code...\n`);const l=[];for(const d of c){const t=await Mf(d,e);l.push(t),e[t.url]=t}Ri.writeFileSync(Of,JSON.stringify(l,null,2),"utf8"),console.log(`\nDone! Total items: ${l.length}`),console.log(`Output saved to: ${Of}`);const u=l.filter(e=>e.source).length;console.log(`Scripts with source code: ${u}/${l.length}`)})().catch(e=>{console.error(e),process.exit(1)});const Df={reset:[0,"000000"],black:[30,"1f2937"],red:[31,"dc2626"],green:[32,"2d6a4f"],yellow:[33,"92400e"],blue:[34,"1a56db"],magenta:[35,"6d28d9"],cyan:[36,"0e7490"],white:[37,"374151"],gray:[90,"6b7280"],brightRed:[91,"ef4444"],brightGreen:[92,"059669"],brightYellow:[93,"d97706"],brightBlue:[94,"3b82f6"],brightMagenta:[95,"8b5cf6"],brightCyan:[96,"06b6d4"],brightWhite:[97,"f9fafb"],bgBlack:[40,"111827"],bgRed:[41,"fca5a5"],bgGreen:[42,"a7f3d0"],bgYellow:[43,"fde68a"],bgBlue:[44,"bfdbfe"],bgMagenta:[45,"ddd6fe"],bgCyan:[46,"a5f3fc"],bgWhite:[47,"f9fafb"],bgGray:[100,"d1d5db"],bgBrightRed:[101,"fee2e2"],bgBrightGreen:[102,"d1fae5"],bgBrightYellow:[103,"fef3c7"],bgBrightBlue:[104,"dbeafe"],bgBrightMagenta:[105,"ede9fe"],bgBrightCyan:[106,"cffafe"],bgBrightWhite:[107,"ffffff"]};function Ff(e="ansi"){const t={};for(const[n,[r,i]]of Object.entries(Df))t[n]="html"===e?"reset"===n?"</span>":`<span style="color:#${i}">`:"["+r+"m";return t}function kf(e,t="ansi"){const n=Ff(t);return"string"==typeof e?n.yellow:"number"==typeof e?n.cyan:"boolean"==typeof e?n.magenta:"function"==typeof e?n.red:null===e?n.gray:Array.isArray(e)?n.blue:"object"==typeof e?n.green:n.white}function Gf(e){return"string"==typeof e?'""':"number"==typeof e?"number":"boolean"==typeof e?"bool":"function"==typeof e?"function":null===e?"null":Array.isArray(e)?e.length?"["+Gf(e[0])+"]":"[]":"object"==typeof e?"{...}":typeof e}function xf(e,t=0,n="ansi"){const r=Ff(n),i="html"===n,a=" ".repeat(t);if("object"!=typeof e||null===e)return kf(e,n)+Gf(e)+r.reset;if(Array.isArray(e)){if(i){let i=[];return e.length&&(i=e.every(t=>typeof t==typeof e[0])?[xf(e[0],t+1,n)]:e.map(e=>xf(e,t+1,n))),`<details open><summary style="cursor:pointer;display:inline">${r.blue}[${r.reset}&thinsp;${e.length} × ${Gf(e[0]??void 0)}&thinsp;${r.blue}]${r.reset}</summary>${i.map(e=>`<div style="margin-left:1.5em">${e}</div>`).join("")}</details>`}let o=r.blue+"["+r.reset;return e.length&&(o+="\n"),e.every(t=>typeof t==typeof e[0])?o+=a+" "+xf(e[0],t+1,n)+",\n":e.forEach((r,i)=>{o+=a+" "+xf(r,t+1,n),i<e.length-1&&(o+=","),o+="\n"}),o+=a+r.blue+"]"+r.reset,o}const o=Object.keys(e);if(i){const i=o.slice(0,4).join(", ")+(o.length>4?"…":"");return`<details open><summary style="cursor:pointer">${r.green}{${r.reset}&nbsp;${i}&nbsp;${r.green}}${r.reset}</summary>${o.map(i=>{const a=e[i],o=kf(a,n);return"object"==typeof a&&null!==a?`<div style="margin-left:1.5em">${o}${i}${r.reset}: ${xf(a,t+1,n)}</div>`:`<div style="margin-left:1.5em">${o}${i}: ${Gf(a)}${r.reset}</div>`}).join("")}</details>`}let s=r.green+"{"+r.reset;return o.length&&(s+="\n"),o.forEach((i,c)=>{const l=e[i],u=kf(l,n);s+=a+" ",s+="object"==typeof l&&null!==l?u+i+r.reset+": "+xf(l,t+1,n):u+i+": "+Gf(l)+r.reset,c<o.length-1&&(s+=","),s+="\n"}),s+=a+r.green+"}"+r.reset,s}function Hf(e="",t={}){let{color:n,style:r="color:rgb(54, 165, 220); font-size: 10pt;",hideInProduction:i,startSpinner:a=!1,stopSpinner:o=!1}=t;const s=Ff();void 0===i&&(i="undefined"!=typeof window&&window?.location.hostname.includes("localhost")),"object"==typeof e&&(e=xf(e)+"\n\n"+JSON.stringify(e,null,2)),Array.isArray(n)&&1==n.length&&(n=n[0]),n&&"undefined"!=typeof process&&("string"==typeof e&&e.includes("%c")&&Array.isArray(n)?e=e.replace(/%c/g,(e,t)=>s[n[t]]||""):n&&"string"==typeof n&&(e=(s[n]||"")+e+s.reset));var c=0;return a?globalThis.interval=setInterval(()=>{process.stdout.write((Array.isArray(n)?s[n[0]]:s[n]||"")+"\r"+"⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏".split("")[c=++c%10]+" "+e+s.reset)},50):o?(clearInterval(globalThis.interval),process.stdout.write("\r"+(e||" ")+" ".repeat("string"==typeof e?e.length+20:40)+"\n")):"string"==typeof r?(1==r.split(" ").length||n?r=`color: ${n||r}; font-size: 11pt;`:r.match(/^#[0-9a-fA-F]{6}$/)&&(r=`color: ${r}; font-size: 11pt;`),i?console.debug((r?"%c":"")+(e||""),r):console.log((r?"%c":"")+(e||""),r)):"object"==typeof r&&console.log(e,...r),!0}function Uf(e){if("undefined"==typeof document)return;let t,n=document.getElementById("alert-overlay");if(!n){n=document.body.appendChild(document.createElement("div")),n.id="alert-overlay",n.setAttribute("style","position:fixed;inset:0;z-index:9999;background:rgba(0,0,0,0.5);display:flex;align-items:center;justify-content:center"),n.innerHTML='<div id="alert-box" style="background:#fff;padding:1.5em 2em;border-radius:8px;box-shadow:0 2px 16px #0003;min-width:320px;max-width:90vw;max-height:80vh;position:relative;display:flex;flex-direction:column;">\n <button id="close-alert" style="position:absolute;top:12px;right:20px;font-size:1.5em;background:none;border:none;cursor:pointer;color:black;">&times;</button>\n <div id="alert-list" style="overflow:auto;flex:1;font-family:monospace;font-size:13px;"></div>\n </div>',n.addEventListener("click",e=>e.target==n&&n.remove());const e=document.getElementById("close-alert");e&&(e.onclick=()=>n.remove())}t=document.getElementById("alert-list"),t.innerHTML+=`<div style="border-bottom:1px solid #e5e7eb;margin:0.5em 0;padding-bottom:0.5em">${e}</div>`}function Vf(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function $f(e){const{extract:t}=await Promise.resolve().then(()=>require("./archiver-web.es-D5Ph5uOj.cjs")),n=await t({archiveBuffer:e}),r={};for(const i of n)r[i.path]=i.content;return r}async function jf(e,t){const{parseHTML:n}=await Promise.resolve().then(()=>require("./index-CLlAnStL-B7EBGdAY.cjs")),{document:r}=n(e);if(!t||!0===t)return r;const i=r.querySelector(t);return i?i.innerHTML??i.textContent:null}const Wf=(Kf=async function(e,t,n,r,i,a,o,s){const c="undefined"!=typeof window?window.grab:globalThis.grab,l=c?.mock?.[t],u=JSON.stringify(i);if(l&&(!l.method||l.method===r.method)&&(!l.params||u===JSON.stringify(l.params)))return await(e=>new Promise(t=>setTimeout(t,1e3*e||0)))(l.delay||0),"function"==typeof l.response?l.response(i):l.response;const d=await fetch(e+t+n,r).catch(e=>{throw new Error(e.message)});if(!d.ok)throw new Error(`HTTP error: ${d.status} ${d.statusText}`);if(a)return await a(d.body),null;const p=d.headers.get("content-type")??"",h=!1!==o&&(p.includes("application/zip")||p.includes("application/x-zip")),f=!1!==s&&("string"==typeof s||p.includes("text/html"));if(h){const e=await d.arrayBuffer().catch(e=>{throw new Error("Error reading zip: "+e)});return{data:await $f(e)}}if(f){const e=await d.text().catch(e=>{throw new Error("Error reading html: "+e)});return{data:await jf(e,"string"!=typeof s||s)}}return await(p.includes("application/json")?d.json():p.includes("application/pdf")||p.includes("application/octet-stream")?d.blob():p?d.text():d.json()).catch(e=>{throw new Error("Error parsing response: "+e)})},async function e(t,n){const r=(i=n,{..."undefined"!=typeof window?window?.grab?.defaults:globalThis?.grab?.defaults||{},...i});var i;let{headers:a,response:o,method:s=(r.post?"POST":r.put?"PUT":r.patch?"PATCH":"GET"),cache:c,timeout:l=30,baseURL:u="undefined"!=typeof process&&process.env.SERVER_API_URL||"/api/",cancelOngoingIfNew:d,cancelNewIfOngoing:p,rateLimit:h,debug:f,infiniteScroll:m,logger:g=Hf,onRequest:y,onResponse:I,onError:C,onStream:A,unzip:S,dom:b,body:T,post:v,put:_,patch:w,...E}=r;const P=((e,t)=>{let n=e=>t?.startsWith(e)||!1,r=e,i=t;return t?.startsWith("http:")||t?.startsWith("https:")?r="":n("/")||r.endsWith("/")?n("/")&&r.endsWith("/")&&(i=t.slice(1)):i="/"+t,{baseURL:r,path:i}})(u,t);u=P.baseURL,t=P.path;const R=function(e){const t="function"==typeof e?e:null;return{response:!e||t?{}:e,resFunction:t}}(o);let L=R.response,N=R.resFunction;const O="undefined"!=typeof window?window.grab:globalThis.grab,B=O?.log||[];N?L=N({...L,isLoading:!0}):"object"==typeof L&&(L.isLoading=!0);try{const i=await async function(e,t,n,r){const{debounce:i=0,repeat:a=0,repeatEvery:o=null,setDefaults:s=!1}=n;if(i>0){const a=await(async(e,t)=>{let n;return async function(...r){clearTimeout(n),n=setTimeout(async()=>{clearTimeout(n),await e(...r)},t)}})(async()=>{await r(e,{...t,debounce:0})},1e3*i);return await a(),n.response||{}}if(a>1){for(let n=0;n<a;n++)await r(e,{...t,repeat:0});return n.response||{}}if(o)return setInterval(async()=>{await r(e,{...t,repeat:0,repeatEvery:null})},1e3*o),n.response||{};if(s){const e="undefined"!=typeof window?window.grab:globalThis.grab;return e&&(e.defaults={...t,setDefaults:void 0}),n.response||{}}return null}(t,n||{},r,e);if(i)return i;!function(e,t,n,r){if("undefined"==typeof window)return;const{regrabOnStale:i,regrabOnFocus:a,regrabOnNetwork:o,cache:s,cacheForTime:c=60}=n,l=async()=>await r(e,{...t,cache:!1});i&&s&&setTimeout(l,1e3*c),o&&window.addEventListener("online",l),a&&(window.addEventListener("focus",l),document.addEventListener("visibilitychange",async()=>{"visible"===document.visibilityState&&await l()}))}(t,n||{},r,e);let{params:o,priorRequest:C,response:v,paramsAsText:_}=function(e,t,n,r,i,a){const{cache:o,cacheForTime:s,infiniteScroll:c}=n,[l,u]=c||[],d=JSON.stringify(l?{...t,[l]:void 0}:t);let p=a.find(t=>t.request===d&&t.path===e);if(l){let e=(p?.currentPage||0)+1||t?.[l]||1;p?p.currentPage=e:(r[u]=[],e=1),t={...t,[l]:e}}else{for(let e of Object.keys(r))r[e]=void 0;if(o&&p?.response&&(!s||p.lastFetchTime>Date.now()-1e3*s)){for(let e of Object.keys(p.response))r[e]=p.response[e];i&&(r=i(r))}}return{params:t,priorRequest:p,response:r,paramsAsText:d}}(t,E,r,L,N,B);if(E=o,L=v,function(e,t,n,r,i){if("undefined"==typeof window||!n?.length)return;const[a,,o]=n;if(void 0===o)return;let s="string"==typeof o?document.querySelector(o):o;s?(window.scrollListener&&"function"==typeof s.removeEventListener&&s.removeEventListener("scroll",window.scrollListener),window.scrollListener=n=>{const s=n.target;localStorage.setItem("scroll",JSON.stringify([s.scrollTop,s.scrollLeft,o])),s.scrollHeight-s.scrollTop<=s.clientHeight+200&&i(e,{...t,cache:!1,[a]:(r?.currentPage||0)+1})},s.addEventListener("scroll",window.scrollListener)):Hf("paginateDOM not found",{color:"red"})}(t,n,m,C,e),h>0&&C?.lastFetchTime>Date.now()-1e3*h)throw new Error(`Fetch rate limit exceeded for ${t}. Wait ${h}s between requests.`);if(C?.controller)if(d)C.controller.abort();else if(p)return{isLoading:!0};const w=new AbortController;let P=w.signal;d||"function"!=typeof AbortSignal.timeout||(P=AbortSignal.timeout(1e3*l)),B.unshift({path:t,request:_,lastFetchTime:Date.now(),controller:w});let{fetchParams:R,paramsGETRequest:O}=function(e,t,n,r,i,a){const o=["POST","PUT","PATCH"].includes(e),s={method:e,headers:{"Content-Type":"application/json",Accept:"application/json",...t},body:n||(o?JSON.stringify(r):null),redirect:"follow",cache:i?"force-cache":"no-store",signal:a};let c="";return o||(c=(Object.keys(r).length?"?":"")+new URLSearchParams(r).toString()),{fetchParams:s,paramsGETRequest:c}}(s,a,T,E,!!c,P);if("function"==typeof y){const e=y(t,L,E,R);Array.isArray(e)&&([t,L,E,R]=e)}const M=new Date,D=await Kf(u,t,O,R,E,A,S,b);if(N?L=N({...L,isLoading:void 0}):"object"==typeof L&&delete L.isLoading,"function"==typeof I){const e=I(t,L,E,R);Array.isArray(e)&&([t,L,E,R]=e)}const F=((Number(new Date)-Number(M))/1e3).toFixed(1);f&&g(`Path:${u+t+O}\n${JSON.stringify(n,null,2)}\nTime: ${F}s\nResponse: ${xf(D)}`);const[,k]=m||[];return L=function(e,t,n,r){if("object"==typeof e&&null!==e){for(let n of Object.keys(e))t[n]=r===n&&Array.isArray(t[n])?[...t[n],...e[n]]:e[n];t.data=e}else n?t=n({data:e,...e}):"object"==typeof t&&(t.data=e);return t}(D,L,N,k),B[0]&&(B[0].response=L),N&&(L=N(L)),L}catch(M){if("function"==typeof C&&C(M.message,u+t,E),r.retryAttempts&&r.retryAttempts>0)return await e(t,{...n,retryAttempts:--r.retryAttempts});!M.message.includes("signal")&&f&&(g(`Error: ${M.message}\nPath:${u+t}\n`,{color:"red"}),"undefined"!=typeof document&&Uf(M.message)),L=L||{},L.error=M.message;const i="function"==typeof o?o:null;return i?(L.data=i({isLoading:void 0,error:M.message}),L=L.data):delete L.isLoading,L}}),Xf=Wf;var Kf;Xf.instance=(e={})=>(t,n={})=>Wf(t,{...e,...n}),Xf.log=[],Xf.mock={},Xf.defaults={},"undefined"!=typeof window?(window.log=Hf,window.grab=Xf,"undefined"!=typeof document&&document.addEventListener("keydown",e=>{const t=window.grab;if(t&&t.log&&"i"===e.key&&e.ctrlKey&&e.altKey){let e="";for(const n of t.log){const t=new Date(n.lastFetchTime).toLocaleString(),r=xf(n.request,0,"html"),i=xf(n.response,0,"html"),a=Vf(JSON.stringify(n.response,null,2));e+=`\n <details open style="margin-bottom:0.75em">\n <summary style="cursor:pointer;font-weight:bold;padding:4px 0;list-style:none;display:flex;justify-content:space-between">\n <span style="color:#1a56db">${Vf(n.path)}</span>\n <span style="color:#6b7280;font-weight:normal;margin-left:1em">${t}</span>\n </summary>\n <div style="padding-left:1em;margin-top:0.5em">\n <details style="margin-bottom:0.4em">\n <summary style="cursor:pointer;color:#6b7280;font-size:0.9em">Request</summary>\n <div style="padding:0.4em 0 0 1em">${r}</div>\n </details>\n <details open style="margin-bottom:0.4em">\n <summary style="cursor:pointer;color:#6b7280;font-size:0.9em">Response (structure)</summary>\n <div style="padding:0.4em 0 0 1em">${i}</div>\n </details>\n <details style="margin-bottom:0.4em">\n <summary style="cursor:pointer;color:#6b7280;font-size:0.9em">Response (data)</summary>\n <pre style="margin:0.4em 0 0 1em;padding:0.5em;background:#f9fafb;border:1px solid #e5e7eb;border-radius:4px;overflow:auto;max-height:300px;font-size:12px">${a}</pre>\n </details>\n </div>\n </details>`}Uf(e||"<em>No requests logged yet.</em>")}}),document.addEventListener("DOMContentLoaded",()=>{try{const e=localStorage.getItem("scroll");if(!e)return;const[t,n,r]=JSON.parse(e);if(!t||!r)return;const i=document.querySelector(r);i&&(i.scrollTop=t,i.scrollLeft=n)}catch(e){console.warn("Failed to restore scroll position",e)}})):"undefined"!=typeof globalThis&&(globalThis.log=Hf,globalThis.grab=Xf);const Yf="./data/leaders.json";const qf=new class{api;constructor(){this.api=Xf.instance({baseURL:"https://db.nvstly.com/api",post:!0,compress:!1})}getTraderRankings=async(e="1mo",t=100)=>{try{const n=await this.api("/market/ranks",{time:e,engines:["stocks"],limit:t});if(console.log(`NVSTLY API Response: Fetched ${n?.data?.data?.length||0} traders`),!n?.data?.data)return console.error("Invalid response from NVSTLY API:",n),[];const r=n.data.data.map(e=>({id:e.id,name:e.name,rank:e.rank,rep:e.rep,trades:e.trades,winRate:Math.floor(e.winRate),totalGain:Math.floor(e.totalGain),avgReturn:Math.floor(e.avgReturn)}));return console.log(`Successfully parsed ${r.length} traders from NVSTLY API`),r}catch(n){return console.error("Error fetching trader rankings:",n),[]}};getTraderTrades=async(e,t="1mo")=>{try{const n=await this.api("/accounts/trades",{id:e,filter:{frame:t,engines:["options","stocks","crypto","forex"]}});return n?.data?.data?n.data.data.map(e=>({symbol:e.symbol,type:"short"==e.type?"short":e.closed?"sell":"buy",time:new Date(e.lastModified).toISOString(),price:Number(e.price.toFixed(2)),...("short"==e.type||e.closed)&&{previousPrice:Number(e.previousEntryPrice.toFixed(2))},...e.closed&&{gain:Math.floor(e.gain)}})):(console.warn(`No trades data for trader ${e}`),[])}catch(n){return console.error(`Error fetching trades for trader ${e}:`,n),[]}}};async function Qf(){const e=await fetch("https://www.zulutrade.com/zulutrade-gateway/api/providers/performance/topTraders/75932/search?flavorId=1&accessingFlavorId=1",{headers:{accept:"application/json, text/plain, */*","accept-language":"en-US,en;q=0.9","sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-origin"}});if(!e.ok)throw new Error(`Zulu fetch failed: ${e.status}`);return(await e.json()).result||[]}async function Jf(e){const t=await fetch(`https://www.zulutrade.com/zulutrade-gateway/v2/api/providers/${e}/thi/init?accessingFlavorId=1&flavor=global`,{headers:{accept:"application/json","accept-language":"en-US,en;q=0.9","content-type":"application/json","sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-origin"}});if(!t.ok)throw new Error(`Zulu trader detail fetch failed: ${t.status}`);return await t.json()}async function zf(e){const t=Date.now();for(const n of e){const e=n.trader,r=e.profile,i=e.overallStats,a=i.timeframeStats||{},o=Object.values(a)[0]||{};await Rr.insert(Zn).values({providerId:e.providerId,name:r.name,strategyDesc:r.strategyDesc||null,countryCode:r.countryIsoCode,countryName:r.countryName,brokerName:r.brokerName,balance:i.balance||0,equity:i.equity||0,followers:i.followers||0,liveFollowers:i.liveFollowers||0,roiAnnualized:i.roiAnnualized||0,roiProfit:i.roiProfit||0,zuluRank:i.zuluRank||0,bestTrade:i.bestTrade||0,worstTrade:i.worstTrade||0,profitableTrades:i.profitableTrades||0,losingTrades:i.losingTrades||0,avgDrawdown:i.avgDrawdown||0,maxDrawdown:i.overallDrawDownInMoney||0,maxDrawdownPercent:o.maxDrawDownPercent||0,leverage:r.leverage||0,isEa:e.badges?.ea?1:0,currencies:i.providerCurrencies||"",weeks:i.weeks||0,demo:r.demo?1:0,avgTradeSeconds:o.avgTradeSeconds||0,avgPnlPerTrade:o.avgPnlPerTrade||0,winRate:o.winTrades||0,totalTrades:o.trades||0,pageVisits:r.pageVisits||0,includedInWatchlist:i.includedInWatchlist||0,registrationDate:r.registrationDate?new Date(r.registrationDate):null,lastOpenTradeDate:i.lastOpenTradeDate?new Date(i.lastOpenTradeDate):null,updatedAt:new Date(t)}).onConflictDoUpdate({target:Zn.providerId,set:{name:r.name,strategyDesc:r.strategyDesc||null,countryCode:r.countryIsoCode,countryName:r.countryName,brokerName:r.brokerName,balance:i.balance||0,equity:i.equity||0,followers:i.followers||0,liveFollowers:i.liveFollowers||0,roiAnnualized:i.roiAnnualized||0,roiProfit:i.roiProfit||0,zuluRank:i.zuluRank||0,bestTrade:i.bestTrade||0,worstTrade:i.worstTrade||0,profitableTrades:i.profitableTrades||0,losingTrades:i.losingTrades||0,avgDrawdown:i.avgDrawdown||0,maxDrawdown:i.overallDrawDownInMoney||0,maxDrawdownPercent:o.maxDrawDownPercent||0,leverage:r.leverage||0,isEa:e.badges?.ea?1:0,currencies:i.providerCurrencies||"",weeks:i.weeks||0,demo:r.demo?1:0,avgTradeSeconds:o.avgTradeSeconds||0,avgPnlPerTrade:o.avgPnlPerTrade||0,winRate:o.winTrades||0,totalTrades:o.trades||0,pageVisits:r.pageVisits||0,includedInWatchlist:i.includedInWatchlist||0,registrationDate:r.registrationDate?new Date(r.registrationDate):null,lastOpenTradeDate:i.lastOpenTradeDate?new Date(i.lastOpenTradeDate):null,updatedAt:new Date(t)}}),e.currencyStats&&e.currencyStats.length>0&&await Zf(e.providerId,e.currencyStats)}}async function Zf(e,t){const n=Date.now();for(const r of t){const t=`${e}-${r.currencyName}`;await Rr.insert(er).values({id:t,providerId:e,currencyName:r.currencyName,totalCount:r.totalCurrencyCount||0,winCount:r.currencyWinCount||0,winPercent:r.currencyWinPercent||0,totalBuyCount:r.totalCurrencyBuyCount||0,totalSellCount:r.totalCurrencySellCount||0,pips:r.pips||0,createdAt:new Date(n)}).onConflictDoUpdate({target:er.id,set:{totalCount:r.totalCurrencyCount||0,winCount:r.currencyWinCount||0,winPercent:r.currencyWinPercent||0,totalBuyCount:r.totalCurrencyBuyCount||0,totalSellCount:r.totalCurrencySellCount||0,pips:r.pips||0}})}}class em extends Error{response;request;options;constructor(e,t,n){const r=`${e.status||0===e.status?e.status:""} ${e.statusText??""}`.trim();super(`Request failed with ${r?`status code ${r}`:"an unknown error"}: ${t.method} ${t.url}`),this.name="HTTPError",this.response=e,this.request=t,this.options=n}}class tm extends Error{name="NonError";value;constructor(e){let t="Non-error value was thrown";try{"string"==typeof e?t=e:e&&"object"==typeof e&&"message"in e&&"string"==typeof e.message&&(t=e.message)}catch{}super(t),this.value=e}}class nm extends Error{name="ForceRetryError";customDelay;code;customRequest;constructor(e){const t=e?.cause?e.cause instanceof Error?e.cause:new tm(e.cause):void 0;super(e?.code?`Forced retry: ${e.code}`:"Forced retry",t?{cause:t}:void 0),this.customDelay=e?.delay,this.code=e?.code,this.customRequest=e?.request}}const rm=(()=>{let e=!1,t=!1;const n="function"==typeof globalThis.ReadableStream,r="function"==typeof globalThis.Request;if(n&&r)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(i){if(i instanceof Error&&"unsupported BodyInit type"===i.message)return!1;throw i}return e&&!t})(),im="function"==typeof globalThis.AbortController,am="function"==typeof globalThis.AbortSignal&&"function"==typeof globalThis.AbortSignal.any,om="function"==typeof globalThis.ReadableStream,sm="function"==typeof globalThis.FormData,cm=["get","post","put","patch","head","delete"],lm={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},um=2147483647,dm=(new TextEncoder).encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,pm=Symbol("stop");class hm{options;constructor(e){this.options=e}}const fm=e=>new hm(e),mm={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},gm={next:!0},ym={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0},Im=(e,t,n)=>{let r,i=0;return e.pipeThrough(new TransformStream({transform(e,a){if(a.enqueue(e),r){i+=r.byteLength;let e=0===t?0:i/t;e>=1&&(e=1-Number.EPSILON),n?.({percent:e,totalBytes:Math.max(t,i),transferredBytes:i},r)}r=e},flush(){r&&(i+=r.byteLength,n?.({percent:1,totalBytes:Math.max(t,i),transferredBytes:i},r))}}))},Cm=(e,t,n)=>{if(!e.body)return e;const r=(e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(const[n,r]of e)t+=dm,t+=(new TextEncoder).encode(`Content-Disposition: form-data; name="${n}"`).length,t+="string"==typeof r?(new TextEncoder).encode(r).length:r.size;return t}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if("string"==typeof e)return(new TextEncoder).encode(e).length;if(e instanceof URLSearchParams)return(new TextEncoder).encode(e.toString()).length;if("byteLength"in e)return e.byteLength;if("object"==typeof e&&null!==e)try{const t=JSON.stringify(e);return(new TextEncoder).encode(t).length}catch{return 0}return 0})(n??e.body);return new Request(e,{duplex:"half",body:Im(e.body,r,t)})},Am=e=>null!==e&&"object"==typeof e,Sm=(...e)=>{for(const t of e)if((!Am(t)||Array.isArray(t))&&void 0!==t)throw new TypeError("The `options` argument must be an object");return wm({},...e)},bm=(e={},t={})=>{const n=new globalThis.Headers(e),r=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(const[a,o]of i.entries())r&&"undefined"===o||void 0===o?n.delete(a):n.set(a,o);return n};function Tm(e,t,n){return Object.hasOwn(t,n)&&void 0===t[n]?[]:wm(e[n]??[],t[n]??[])}const vm=(e={},t={})=>({beforeRequest:Tm(e,t,"beforeRequest"),beforeRetry:Tm(e,t,"beforeRetry"),afterResponse:Tm(e,t,"afterResponse"),beforeError:Tm(e,t,"beforeError")}),_m=(e,t)=>{const n=new URLSearchParams;for(const r of[e,t])if(void 0!==r)if(r instanceof URLSearchParams)for(const[e,t]of r.entries())n.append(e,t);else if(Array.isArray(r))for(const e of r){if(!Array.isArray(e)||2!==e.length)throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");n.append(String(e[0]),String(e[1]))}else if(Am(r))for(const[e,t]of Object.entries(r))void 0!==t&&n.append(e,String(t));else{const e=new URLSearchParams(r);for(const[t,r]of e.entries())n.append(t,r)}return n},wm=(...e)=>{let t,n={},r={},i={};const a=[];for(const o of e)if(Array.isArray(o))Array.isArray(n)||(n=[]),n=[...n,...o];else if(Am(o)){for(let[e,r]of Object.entries(o))if("signal"===e&&r instanceof globalThis.AbortSignal)a.push(r);else if("context"!==e)"searchParams"!==e?(Am(r)&&e in n&&(r=wm(n[e],r)),n={...n,[e]:r}):t=null==r?void 0:void 0===t?r:_m(t,r);else{if(null!=r&&(!Am(r)||Array.isArray(r)))throw new TypeError("The `context` option must be an object");n={...n,context:null==r?{}:{...n.context,...r}}}Am(o.hooks)&&(i=vm(i,o.hooks),n.hooks=i),Am(o.headers)&&(r=bm(r,o.headers),n.headers=r)}return void 0!==t&&(n.searchParams=t),a.length>0&&(1===a.length?n.signal=a[0]:n.signal=am?AbortSignal.any(a):a.at(-1)),n},Em=e=>cm.includes(e)?e.toUpperCase():e,Pm={limit:2,methods:["get","put","head","delete","options","trace"],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:[413,429,503],maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3,jitter:void 0,retryOnTimeout:!1},Rm=(e={})=>{if("number"==typeof e)return{...Pm,limit:e};if(e.methods&&!Array.isArray(e.methods))throw new Error("retry.methods must be an array");if(e.methods&&=e.methods.map(e=>e.toLowerCase()),e.statusCodes&&!Array.isArray(e.statusCodes))throw new Error("retry.statusCodes must be an array");const t=Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e));return{...Pm,...t}};class Lm extends Error{request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.name="TimeoutError",this.request=e}}class Nm{static create(e,t){const n=new Nm(e,t),r=n.#e(async()=>{if("number"==typeof n.#t.timeout&&n.#t.timeout>um)throw new RangeError("The `timeout` option cannot be greater than 2147483647");await Promise.resolve();let e=await n.#n();for(const r of n.#t.hooks.afterResponse){const i=n.#r(e.clone());let a;try{a=await r(n.request,n.#i(),i,{retryCount:n.#a})}catch(t){throw n.#o(i),n.#o(e),t}if(a instanceof hm)throw n.#o(i),n.#o(e),new nm(a.options);const o=a instanceof globalThis.Response?a:e;i!==o&&n.#o(i),e!==o&&n.#o(e),e=o}if(n.#r(e),!e.ok&&("function"==typeof n.#t.throwHttpErrors?n.#t.throwHttpErrors(e.status):n.#t.throwHttpErrors)){let t=new em(e,n.request,n.#i());for(const e of n.#t.hooks.beforeError)t=await e(t,{retryCount:n.#a});throw t}if(n.#t.onDownloadProgress){if("function"!=typeof n.#t.onDownloadProgress)throw new TypeError("The `onDownloadProgress` option must be a function");if(!om)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");const t=e.clone();return n.#o(e),((e,t)=>{if(!e.body)return e;if(204===e.status)return new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers});const n=Math.max(0,Number(e.headers.get("content-length"))||0);return new Response(Im(e.body,n,t),{status:e.status,statusText:e.statusText,headers:e.headers})})(t,n.#t.onDownloadProgress)}return e}).finally(()=>{const e=n.#s;n.#c(e?.body??void 0),n.#c(n.request.body??void 0)});for(const[i,a]of Object.entries(lm))"bytes"===i&&"function"!=typeof globalThis.Response?.prototype?.bytes||(r[i]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||a);const e=await r;if("json"===i){if(204===e.status)return"";const n=await e.text();return""===n?"":t.parseJson?t.parseJson(n):JSON.parse(n)}return e[i]()});return r}static#l(e){return!e||"object"!=typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e))}request;#u;#a=0;#d;#t;#s;#p;#h;constructor(e,t={}){if(this.#d=e,this.#t={...t,headers:bm(this.#d.headers,t.headers),hooks:vm({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},t.hooks),method:Em(t.method??this.#d.method??"GET"),prefixUrl:String(t.prefixUrl||""),retry:Rm(t.retry),throwHttpErrors:t.throwHttpErrors??!0,timeout:t.timeout??1e4,fetch:t.fetch??globalThis.fetch.bind(globalThis),context:t.context??{}},"string"!=typeof this.#d&&!(this.#d instanceof URL||this.#d instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this.#t.prefixUrl&&"string"==typeof this.#d){if(this.#d.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this.#t.prefixUrl.endsWith("/")||(this.#t.prefixUrl+="/"),this.#d=this.#t.prefixUrl+this.#d}im&&am&&(this.#p=this.#t.signal??this.#d.signal,this.#u=new globalThis.AbortController,this.#t.signal=this.#p?AbortSignal.any([this.#p,this.#u.signal]):this.#u.signal),rm&&(this.#t.duplex="half"),void 0!==this.#t.json&&(this.#t.body=this.#t.stringifyJson?.(this.#t.json)??JSON.stringify(this.#t.json),this.#t.headers.set("content-type",this.#t.headers.get("content-type")??"application/json"));const n=t.headers&&new globalThis.Headers(t.headers).has("content-type");if(this.#d instanceof globalThis.Request&&(sm&&this.#t.body instanceof globalThis.FormData||this.#t.body instanceof URLSearchParams)&&!n&&this.#t.headers.delete("content-type"),this.request=new globalThis.Request(this.#d,this.#t),void 0!==(r=this.#t.searchParams)&&(Array.isArray(r)?r.length>0:r instanceof URLSearchParams?r.size>0:"object"==typeof r?Object.keys(r).length>0:"string"==typeof r?r.trim().length>0:Boolean(r))){const e="?"+("string"==typeof this.#t.searchParams?this.#t.searchParams.replace(/^\?/,""):new URLSearchParams(Nm.#l(this.#t.searchParams)).toString()),t=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,e);this.request=new globalThis.Request(t,this.#t)}var r;if(this.#t.onUploadProgress){if("function"!=typeof this.#t.onUploadProgress)throw new TypeError("The `onUploadProgress` option must be a function");if(!rm)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request=this.#f(this.request,this.#t.body??void 0)}}#m(){const e=this.#t.retry.delay(this.#a);let t=e;!0===this.#t.retry.jitter?t=Math.random()*e:"function"==typeof this.#t.retry.jitter&&(t=this.#t.retry.jitter(e),(!Number.isFinite(t)||t<0)&&(t=e));const n=this.#t.retry.backoffLimit??Number.POSITIVE_INFINITY;return Math.min(n,t)}async#g(e){if(this.#a++,this.#a>this.#t.retry.limit)throw e;const t=e instanceof Error?e:new tm(e);if(t instanceof nm)return t.customDelay??this.#m();if(!this.#t.retry.methods.includes(this.request.method.toLowerCase()))throw e;if(void 0!==this.#t.retry.shouldRetry){const n=await this.#t.retry.shouldRetry({error:t,retryCount:this.#a});if(!1===n)throw e;if(!0===n)return this.#m()}if(function(e){return e instanceof Lm||e?.name===Lm.name}(e)&&!this.#t.retry.retryOnTimeout)throw e;if(function(e){return e instanceof em||e?.name===em.name}(e)){if(!this.#t.retry.statusCodes.includes(e.response.status))throw e;const t=e.response.headers.get("Retry-After")??e.response.headers.get("RateLimit-Reset")??e.response.headers.get("X-RateLimit-Retry-After")??e.response.headers.get("X-RateLimit-Reset")??e.response.headers.get("X-Rate-Limit-Reset");if(t&&this.#t.retry.afterStatusCodes.includes(e.response.status)){let e=1e3*Number(t);Number.isNaN(e)?e=Date.parse(t)-Date.now():e>=Date.parse("2024-01-01")&&(e-=Date.now());const n=this.#t.retry.maxRetryAfter??e;return e<n?e:n}if(413===e.response.status)throw e}return this.#m()}#r(e){return this.#t.parseJson&&(e.json=async()=>this.#t.parseJson(await e.text())),e}#c(e){e&&e.cancel().catch(()=>{})}#o(e){this.#c(e.body??void 0)}async#e(e){try{return await e()}catch(t){const n=Math.min(await this.#g(t),um);if(this.#a<1)throw t;if(await async function(e,{signal:t}){return new Promise((n,r)=>{function i(){clearTimeout(a),r(t.reason)}t&&(t.throwIfAborted(),t.addEventListener("abort",i,{once:!0}));const a=setTimeout(()=>{t?.removeEventListener("abort",i),n()},e)})}(n,this.#p?{signal:this.#p}:{}),t instanceof nm&&t.customRequest){const e=this.#t.signal?new globalThis.Request(t.customRequest,{signal:this.#t.signal}):new globalThis.Request(t.customRequest);this.#y(e)}for(const e of this.#t.hooks.beforeRetry){const n=await e({request:this.request,options:this.#i(),error:t,retryCount:this.#a});if(n instanceof globalThis.Request){this.#y(n);break}if(n instanceof globalThis.Response)return n;if(n===pm)return}return this.#e(e)}}async#n(){this.#u?.signal.aborted&&(this.#u=new globalThis.AbortController,this.#t.signal=this.#p?AbortSignal.any([this.#p,this.#u.signal]):this.#u.signal,this.request=new globalThis.Request(this.request,{signal:this.#t.signal}));for(const t of this.#t.hooks.beforeRequest){const e=await t(this.request,this.#i(),{retryCount:this.#a});if(e instanceof Response)return e;if(e instanceof globalThis.Request){this.#y(e);break}}const e=((e,t)=>{const n={};for(const r in t)Object.hasOwn(t,r)&&(r in ym||r in mm||r in e&&!(r in gm)||(n[r]=t[r]));return n})(this.request,this.#t);return this.#s=this.request,this.request=this.#s.clone(),!1===this.#t.timeout?this.#t.fetch(this.#s,e):async function(e,t,n,r){return new Promise((i,a)=>{const o=setTimeout(()=>{n&&n.abort(),a(new Lm(e))},r.timeout);r.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(o)})})}(this.#s,e,this.#u,this.#t)}#i(){if(!this.#h){const{hooks:e,...t}=this.#t;this.#h=Object.freeze(t)}return this.#h}#y(e){this.#h=void 0,this.request=this.#f(e)}#f(e,t){return this.#t.onUploadProgress&&e.body?Cm(e,this.#t.onUploadProgress,t??this.#t.body??void 0):e}}const Om=e=>{const t=(t,n)=>Nm.create(t,Sm(e,n));for(const n of cm)t[n]=(t,r)=>Nm.create(t,Sm(e,r,{method:n}));return t.create=e=>Om(Sm(e)),t.extend=t=>("function"==typeof t&&(t=t(e??{})),Om(Sm(e,t))),t.stop=pm,t.retry=fm,t},Bm=Om();function Mm(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>null!=e))}var Dm;(Dm||(Dm={})).API_BASE_URL="https://api.tavily.com";var Fm=class{ky;apiKey;apiBaseUrl;constructor({apiKey:e=process.env.TAVILY_API_KEY,apiBaseUrl:t=Dm.API_BASE_URL,ky:n=Bm}={}){if(!e)throw new Error('TavilyClient missing required "apiKey" (defaults to "TAVILY_API_KEY")');this.apiKey=e,this.apiBaseUrl=t,this.ky=n.extend({prefixUrl:this.apiBaseUrl})}async search(e){const t="string"==typeof e?{query:e}:e,n=await this.ky.post("search",{json:{...t,api_key:this.apiKey}}).json();return Mm({...n,results:n.results?.map(Mm)})}};const km={"llama3-70b-8192":{maxInputTokens:8192,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"qwen-qwq-32b":{maxInputTokens:131072,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:16384,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"llama-3.1-8b-instant":{maxInputTokens:131072,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:131072,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"llama-guard-3-8b":{maxInputTokens:8192,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!1},"deepseek-r1-distill-llama-70b":{maxInputTokens:131072,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:8192,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"llama3-8b-8192":{maxInputTokens:8192,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"mistral-saba-24b":{maxInputTokens:32768,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:32768,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"llama-3.3-70b-versatile":{maxInputTokens:131072,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:32768,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"gemma2-9b-it":{maxInputTokens:8192,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"moonshotai/kimi-k2-instruct":{maxInputTokens:131072,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:16384,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"moonshotai/kimi-k2-instruct-0905":{maxInputTokens:262144,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:16384,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"qwen/qwen3-32b":{maxInputTokens:131072,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:16384,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"meta-llama/llama-4-scout-17b-16e-instruct":{maxInputTokens:131072,imageInputs:!0,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"meta-llama/llama-guard-4-12b":{maxInputTokens:131072,imageInputs:!0,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:1024,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!1},"meta-llama/llama-4-maverick-17b-128e-instruct":{maxInputTokens:131072,imageInputs:!0,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"openai/gpt-oss-120b":{maxInputTokens:131072,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"openai/gpt-oss-20b":{maxInputTokens:131072,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0}};function Gm(e){if(!e||"object"!=typeof e)return e;if("null"===e.type)return e;if(Array.isArray(e.type)&&e.type.includes("null"))return e;if(Array.isArray(e.enum)){const t=e.enum.includes(null)?e.enum:[...e.enum,null],n=Array.isArray(e.type)?e.type.filter(e=>"null"!==e):"string"==typeof e.type?[e.type]:["string"],r=Array.from(new Set([...n,"null"]));return{...e,type:r,enum:t}}if(Array.isArray(e.anyOf)){if(e.anyOf.some(e=>"null"===e?.type||Array.isArray(e?.type)&&e.type.includes("null")))return e;const t=e.anyOf.map(e=>e?.type).filter(e=>e&&"string"==typeof e);if(t.length===e.anyOf.length){const{anyOf:n,...r}=e;return{...r,type:[...t,"null"]}}return{...e,anyOf:[...e.anyOf,{type:"null"}]}}return"string"==typeof e.type?{...e,type:[e.type,"null"]}:Array.isArray(e.type)?{...e,type:Array.from(new Set([...e.type,"null"]))}:e.properties?{...e,type:["object","null"]}:e}function xm(e,t=!0){if(!e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(e=>xm(e,!1));const n={...e};for(const r of["anyOf","oneOf","allOf"])Array.isArray(n[r])&&(n[r]=n[r].map(e=>xm(e,!1)));if(n.items&&(n.items=xm(n.items,!1)),n.$defs){n.$defs={...n.$defs};for(const e of Object.keys(n.$defs))n.$defs[e]=xm(n.$defs[e],!1)}if(("object"===n.type||Array.isArray(n.type)&&n.type.includes("object")||n.properties)&&n.properties&&"object"==typeof n.properties){n.additionalProperties=!1;const e=Object.keys(n.properties),t=new Set(Array.isArray(n.required)?n.required:[]);n.properties={...n.properties};for(const r of e)n.properties[r]=xm(n.properties[r],!1),t.has(r)||(n.properties[r]=Gm(n.properties[r]));n.required=e}if(t){if(Array.isArray(n.anyOf)){const e=n.anyOf.find(e=>"object"===e?.type||e?.properties);if(e)return{...xm(e,!0),type:"object"};throw new Error("Groq strict mode requires the root schema to be an object type, but the schema has anyOf/oneOf with no object variant.")}if(n.oneOf)throw new Error("Groq strict mode does not support oneOf at the root schema level.");if(n.not)throw new Error("Groq strict mode does not support 'not' at the root schema level.");n.properties&&(n.type="object")}return n}const Hm=["jsonSchema","functionCalling","jsonMode"];Object.defineProperty;function Um(e,t,n){function r(n,r){var i;Object.defineProperty(n,"_zod",{value:n._zod??{},enumerable:!1}),(i=n._zod).traits??(i.traits=new Set),n._zod.traits.add(e),t(n,r);for(const e in o.prototype)e in n||Object.defineProperty(n,e,{value:o.prototype[e].bind(n)});n._zod.constr=o,n._zod.def=r}const i=n?.Parent??Object;class a extends i{}function o(e){var t;const i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(const n of i._zod.deferred)n();return i}return Object.defineProperty(a,"name",{value:e}),Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}class Vm extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const $m={};function jm(e){return $m}function Wm(e,t){return"bigint"==typeof t?t.toString():t}const Xm=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Km(e,t,n){const r=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(r._zod.parent=e),r}function Ym(e,t=0){for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function qm(e){return"string"==typeof e?e:e?.message}function Qm(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const i=qm(e.inst?._zod.def?.error?.(e))??qm(t?.error?.(e))??qm(n.customError?.(e))??qm(n.localeError?.(e))??"Invalid input";r.message=i}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}const Jm=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get:()=>JSON.stringify(t,Wm,2),enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},zm=Um("$ZodError",Jm),Zm=Um("$ZodError",Jm,{Parent:Error}),eg=e=>async(t,n,r,i)=>{const a=r?Object.assign(r,{async:!0}):{async:!0};let o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){const t=new(i?.Err??e)(o.issues.map(e=>Qm(e,a,jm())));throw Xm(t,i?.callee),t}return o.value},tg=eg(Zm),ng=e=>(t,n,r)=>{const i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Vm;return a.issues.length?{success:!1,error:new(e??zm)(a.issues.map(e=>Qm(e,i,jm())))}:{success:!0,data:a.value}},rg=ng(Zm),ig=e=>async(t,n,r)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Qm(e,i,jm())))}:{success:!0,data:a.value}},ag=ig(Zm),og={major:4,minor:0,patch:0},sg=Um("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=og;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const t of i._zod.onattach)t(e);if(0===r.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,n)=>{let r,i=Ym(e);for(const a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(i)continue;const t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&!1===n?.async)throw new Vm;if(r||o instanceof Promise)r=(r??Promise.resolve()).then(async()=>{await o;e.issues.length!==t&&(i||(i=Ym(e,t)))});else{if(e.issues.length===t)continue;i||(i=Ym(e,t))}}return r?r.then(()=>e):e};e._zod.run=(n,i)=>{const a=e._zod.parse(n,i);if(a instanceof Promise){if(!1===i.async)throw new Vm;return a.then(e=>t(e,r,i))}return t(a,r,i)}}e["~standard"]={validate:t=>{try{const n=rg(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return ag(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}}),cg=Um("$ZodNever",(e,t)=>{sg.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});class lg{constructor(){this._map=new Map,this._idmap=new Map}add(e,...t){const n=t[0];if(this._map.set(e,n),n&&"object"==typeof n&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function ug(){return new lg}const dg=ug();class pg{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??dg,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,t={path:[],schemaPath:[]}){var n;const r=e._zod.def,i={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},a=this.seen.get(e);if(a){a.count++;return t.schemaPath.includes(e)&&(a.cycle=t.path),a.schema}const o={schema:{},count:1,cycle:void 0,path:t.path};this.seen.set(e,o);const s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{const n={...t,schemaPath:[...t.schemaPath,e],path:t.path},a=e._zod.parent;if(a)o.ref=a,this.process(a,n),this.seen.get(a).isParent=!0;else{const t=o.schema;switch(r.type){case"string":{const n=t;n.type="string";const{minimum:r,maximum:a,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if("number"==typeof r&&(n.minLength=r),"number"==typeof a&&(n.maxLength=a),s&&(n.format=i[s]??s,""===n.format&&delete n.format),l&&(n.contentEncoding=l),c&&c.size>0){const e=[...c];1===e.length?n.pattern=e[0].source:e.length>1&&(o.schema.allOf=[...e.map(e=>({..."draft-7"===this.target?{type:"string"}:{},pattern:e.source}))])}break}case"number":{const n=t,{minimum:r,maximum:i,format:a,multipleOf:o,exclusiveMaximum:s,exclusiveMinimum:c}=e._zod.bag;"string"==typeof a&&a.includes("int")?n.type="integer":n.type="number","number"==typeof c&&(n.exclusiveMinimum=c),"number"==typeof r&&(n.minimum=r,"number"==typeof c&&(c>=r?delete n.minimum:delete n.exclusiveMinimum)),"number"==typeof s&&(n.exclusiveMaximum=s),"number"==typeof i&&(n.maximum=i,"number"==typeof s&&(s<=i?delete n.maximum:delete n.exclusiveMaximum)),"number"==typeof o&&(n.multipleOf=o);break}case"boolean":t.type="boolean";break;case"bigint":if("throw"===this.unrepresentable)throw new Error("BigInt cannot be represented in JSON Schema");break;case"symbol":if("throw"===this.unrepresentable)throw new Error("Symbols cannot be represented in JSON Schema");break;case"null":t.type="null";break;case"any":case"unknown":break;case"undefined":if("throw"===this.unrepresentable)throw new Error("Undefined cannot be represented in JSON Schema");break;case"void":if("throw"===this.unrepresentable)throw new Error("Void cannot be represented in JSON Schema");break;case"never":t.not={};break;case"date":if("throw"===this.unrepresentable)throw new Error("Date cannot be represented in JSON Schema");break;case"array":{const i=t,{minimum:a,maximum:o}=e._zod.bag;"number"==typeof a&&(i.minItems=a),"number"==typeof o&&(i.maxItems=o),i.type="array",i.items=this.process(r.element,{...n,path:[...n.path,"items"]});break}case"object":{const e=t;e.type="object",e.properties={};const i=r.shape;for(const t in i)e.properties[t]=this.process(i[t],{...n,path:[...n.path,"properties",t]});const a=new Set(Object.keys(i)),o=new Set([...a].filter(e=>{const t=r.shape[e]._zod;return"input"===this.io?void 0===t.optin:void 0===t.optout}));o.size>0&&(e.required=Array.from(o)),"never"===r.catchall?._zod.def.type?e.additionalProperties=!1:r.catchall?r.catchall&&(e.additionalProperties=this.process(r.catchall,{...n,path:[...n.path,"additionalProperties"]})):"output"===this.io&&(e.additionalProperties=!1);break}case"union":t.anyOf=r.options.map((e,t)=>this.process(e,{...n,path:[...n.path,"anyOf",t]}));break;case"intersection":{const e=t,i=this.process(r.left,{...n,path:[...n.path,"allOf",0]}),a=this.process(r.right,{...n,path:[...n.path,"allOf",1]}),o=e=>"allOf"in e&&1===Object.keys(e).length,s=[...o(i)?i.allOf:[i],...o(a)?a.allOf:[a]];e.allOf=s;break}case"tuple":{const i=t;i.type="array";const a=r.items.map((e,t)=>this.process(e,{...n,path:[...n.path,"prefixItems",t]}));if("draft-2020-12"===this.target?i.prefixItems=a:i.items=a,r.rest){const e=this.process(r.rest,{...n,path:[...n.path,"items"]});"draft-2020-12"===this.target?i.items=e:i.additionalItems=e}r.rest&&(i.items=this.process(r.rest,{...n,path:[...n.path,"items"]}));const{minimum:o,maximum:s}=e._zod.bag;"number"==typeof o&&(i.minItems=o),"number"==typeof s&&(i.maxItems=s);break}case"record":{const e=t;e.type="object",e.propertyNames=this.process(r.keyType,{...n,path:[...n.path,"propertyNames"]}),e.additionalProperties=this.process(r.valueType,{...n,path:[...n.path,"additionalProperties"]});break}case"map":if("throw"===this.unrepresentable)throw new Error("Map cannot be represented in JSON Schema");break;case"set":if("throw"===this.unrepresentable)throw new Error("Set cannot be represented in JSON Schema");break;case"enum":{const e=t,n=function(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t)}(r.entries);n.every(e=>"number"==typeof e)&&(e.type="number"),n.every(e=>"string"==typeof e)&&(e.type="string"),e.enum=n;break}case"literal":{const e=t,n=[];for(const t of r.values)if(void 0===t){if("throw"===this.unrepresentable)throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof t){if("throw"===this.unrepresentable)throw new Error("BigInt literals cannot be represented in JSON Schema");n.push(Number(t))}else n.push(t);if(0===n.length);else if(1===n.length){const t=n[0];e.type=null===t?"null":typeof t,e.const=t}else n.every(e=>"number"==typeof e)&&(e.type="number"),n.every(e=>"string"==typeof e)&&(e.type="string"),n.every(e=>"boolean"==typeof e)&&(e.type="string"),n.every(e=>null===e)&&(e.type="null"),e.enum=n;break}case"file":{const n=t,r={type:"string",format:"binary",contentEncoding:"binary"},{minimum:i,maximum:a,mime:o}=e._zod.bag;void 0!==i&&(r.minLength=i),void 0!==a&&(r.maxLength=a),o?1===o.length?(r.contentMediaType=o[0],Object.assign(n,r)):n.anyOf=o.map(e=>({...r,contentMediaType:e})):Object.assign(n,r);break}case"transform":if("throw"===this.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema");break;case"nullable":{const e=this.process(r.innerType,n);t.anyOf=[e,{type:"null"}];break}case"nonoptional":case"promise":case"optional":this.process(r.innerType,n),o.ref=r.innerType;break;case"success":t.type="boolean";break;case"default":this.process(r.innerType,n),o.ref=r.innerType,t.default=JSON.parse(JSON.stringify(r.defaultValue));break;case"prefault":this.process(r.innerType,n),o.ref=r.innerType,"input"===this.io&&(t._prefault=JSON.parse(JSON.stringify(r.defaultValue)));break;case"catch":{let e;this.process(r.innerType,n),o.ref=r.innerType;try{e=r.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}t.default=e;break}case"nan":if("throw"===this.unrepresentable)throw new Error("NaN cannot be represented in JSON Schema");break;case"template_literal":{const n=t,r=e._zod.pattern;if(!r)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=r.source;break}case"pipe":{const e="input"===this.io?"transform"===r.in._zod.def.type?r.out:r.in:r.out;this.process(e,n),o.ref=e;break}case"readonly":this.process(r.innerType,n),o.ref=r.innerType,t.readOnly=!0;break;case"lazy":{const t=e._zod.innerType;this.process(t,n),o.ref=t;break}case"custom":if("throw"===this.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")}}}const c=this.metadataRegistry.get(e);c&&Object.assign(o.schema,c),"input"===this.io&&fg(e)&&(delete o.schema.examples,delete o.schema.default),"input"===this.io&&o.schema._prefault&&((n=o.schema).default??(n.default=o.schema._prefault)),delete o.schema._prefault;return this.seen.get(e).schema}emit(e,t){const n={cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0},r=this.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=e=>{const t="draft-2020-12"===this.target?"$defs":"definitions";if(n.external){const r=n.external.registry.get(e[0])?.id,i=n.external.uri??(e=>e);if(r)return{ref:i(r)};const a=e[1].defId??e[1].schema.id??"schema"+this.counter++;return e[1].defId=a,{defId:a,ref:`${i("__shared")}#/${t}/${a}`}}if(e[1]===r)return{ref:"#"};const i=`#/${t}/`,a=e[1].schema.id??"__schema"+this.counter++;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;const t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);const a=t.schema;for(const i in a)delete a[i];a.$ref=n};if("throw"===n.cycles)for(const u of this.seen.entries()){const e=u[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const u of this.seen.entries()){const t=u[1];if(e===u[0]){a(u);continue}if(n.external){const t=n.external.registry.get(u[0])?.id;if(e!==u[0]&&t){a(u);continue}}const r=this.metadataRegistry.get(u[0])?.id;r?a(u):(t.cycle||t.count>1&&"ref"===n.reused)&&a(u)}const o=(e,t)=>{const n=this.seen.get(e),r=n.def??n.schema,i={...r};if(null===n.ref)return;const a=n.ref;if(n.ref=null,a){o(a,t);const e=this.seen.get(a).schema;e.$ref&&"draft-7"===t.target?(r.allOf=r.allOf??[],r.allOf.push(e)):(Object.assign(r,e),Object.assign(r,i))}n.isParent||this.override({zodSchema:e,jsonSchema:r,path:n.path??[]})};for(const u of[...this.seen.entries()].reverse())o(u[0],{target:this.target});const s={};if("draft-2020-12"===this.target?s.$schema="https://json-schema.org/draft/2020-12/schema":"draft-7"===this.target?s.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),n.external?.uri){const t=n.external.registry.get(e)?.id;if(!t)throw new Error("Schema is missing an `id` property");s.$id=n.external.uri(t)}Object.assign(s,r.def);const c=n.external?.defs??{};for(const u of this.seen.entries()){const e=u[1];e.def&&e.defId&&(c[e.defId]=e.def)}n.external||Object.keys(c).length>0&&("draft-2020-12"===this.target?s.$defs=c:s.definitions=c);try{return JSON.parse(JSON.stringify(s))}catch(l){throw new Error("Error converting schema to JSON.")}}}function hg(e,t){if(e instanceof lg){const n=new pg(t),r={};for(const t of e._idmap.entries()){const[e,r]=t;n.process(r)}const i={},a={registry:e,uri:t?.uri,defs:r};for(const o of e._idmap.entries()){const[e,r]=o;i[e]=n.emit(r,{...t,external:a})}if(Object.keys(r).length>0){const e="draft-2020-12"===n.target?"$defs":"definitions";i.__shared={[e]:r}}return{schemas:i}}const n=new pg(t);return n.process(e),n.emit(e,t)}function fg(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;switch(r.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":case"custom":case"success":case"catch":return!1;case"array":return fg(r.element,n);case"object":for(const e in r.shape)if(fg(r.shape[e],n))return!0;return!1;case"union":for(const e of r.options)if(fg(e,n))return!0;return!1;case"intersection":return fg(r.left,n)||fg(r.right,n);case"tuple":for(const e of r.items)if(fg(e,n))return!0;return!(!r.rest||!fg(r.rest,n));case"record":case"map":return fg(r.keyType,n)||fg(r.valueType,n);case"set":return fg(r.valueType,n);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":case"default":case"prefault":return fg(r.innerType,n);case"lazy":return fg(r.getter(),n);case"transform":return!0;case"pipe":return fg(r.in,n)||fg(r.out,n)}throw new Error(`Unknown schema type: ${r.type}`)}function mg(e){if("object"!=typeof e||null===e)return!1;if(!("_zod"in e))return!1;const t=e._zod;return"object"==typeof t&&null!==t&&"def"in t}function gg(e){if("object"!=typeof e||null===e)return!1;if(!("_def"in e)||"_zod"in e)return!1;const t=e._def;return"object"==typeof t&&null!=t&&"typeName"in t}function yg(e){return!!e&&("object"==typeof e&&(!Array.isArray(e)&&!(!mg(e)&&!gg(e))))}async function Ig(e,t){if(mg(e))return await tg(e,t);if(gg(e))return await e.parseAsync(t);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function Cg(e){return mg(e)?dg.get(e)?.description:gg(e)||"description"in e&&"string"==typeof e.description?e.description:void 0}function Ag(e){return!!mg(e)&&("object"==typeof e&&null!==e&&"_zod"in e&&"object"==typeof e._zod&&null!==e._zod&&"def"in e._zod&&"object"==typeof e._zod.def&&null!==e._zod.def&&"type"in e._zod.def&&"object"===e._zod.def.type)}function Sg(e){return!!mg(e)&&("object"==typeof e&&null!==e&&"_zod"in e&&"object"==typeof e._zod&&null!==e._zod&&"def"in e._zod&&"object"==typeof e._zod.def&&null!==e._zod.def&&"type"in e._zod.def&&"array"===e._zod.def.type)}function bg(e,t=!1){if("object"==typeof(n=e)&&null!==n&&"_def"in n&&"object"==typeof n._def&&null!==n._def&&"typeName"in n._def&&"ZodObject"===n._def.typeName)return e.strict();var n,r;if(Ag(e)){const n=e._zod.def.shape;if(t)for(const[r,o]of Object.entries(e._zod.def.shape)){if(Ag(o))n[r]=bg(o,t);else if(Sg(o)){let e=o._zod.def.element;Ag(e)&&(e=bg(e,t)),n[r]=Km(o,{...o._zod.def,element:e})}else n[r]=o;const e=dg.get(o);e&&dg.add(n[r],e)}const i=Km(e,{...e._zod.def,shape:n,catchall:(r=cg,new r({type:"never"}))}),a=dg.get(e);return a&&dg.add(i,a),i}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Tg(e,t,n){const r=n.get(e);if(void 0!==r)return r;if(gg(e))return function(e){return gg(e)&&"typeName"in e._def&&"ZodEffects"===e._def.typeName}(e)?Tg(e._def.schema,t,n):e;if(mg(e)){let r=e;if(function(e){return mg(e)&&"pipe"===e._zod.def.type}(e)&&(r=Tg(e._zod.def.in,t,n)),t)if(Ag(r)){const e={};for(const[i,a]of Object.entries(r._zod.def.shape))e[i]=Tg(a,t,n);r=Km(r,{...r._zod.def,shape:e})}else if(Sg(r)){const e=Tg(r._zod.def.element,t,n);r=Km(r,{...r._zod.def,element:e})}else if(mg(i=r)&&"object"==typeof i&&null!==i&&"_zod"in i&&"object"==typeof i._zod&&null!==i._zod&&"def"in i._zod&&"object"==typeof i._zod.def&&null!==i._zod.def&&"type"in i._zod.def&&"optional"===i._zod.def.type){const e=Tg(r._zod.def.innerType,t,n);r=Km(r,{...r._zod.def,innerType:e})}else if(function(e){return!!mg(e)&&"object"==typeof e&&null!==e&&"_zod"in e&&"object"==typeof e._zod&&null!==e._zod&&"def"in e._zod&&"object"==typeof e._zod.def&&null!==e._zod.def&&"type"in e._zod.def&&"nullable"===e._zod.def.type}(r)){const e=Tg(r._zod.def.innerType,t,n);r=Km(r,{...r._zod.def,innerType:e})}const a=dg.get(e);return a&&dg.add(r,a),n.set(e,r),r}var i;throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}const vg=Symbol("Let zodToJsonSchema decide on which parser to use"),_g={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},wg=e=>{const t=(e=>({..._g,...e}))(e),n=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}},Eg=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join("/")};function Pg(e){if("openAi"!==e.target)return{};const t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?Eg(t,e.currentPath):t.join("/")}}function Rg(e,t,n,r){r?.errorMessages&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function Lg(e,t,n,r,i){e[t]=n,Rg(e,t,r,i)}var Ng,Og,Bg;(Og=Ng||(Ng={})).assertEqual=e=>{},Og.assertIs=function(e){},Og.assertNever=function(e){throw new Error},Og.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},Og.getValidEnumValues=e=>{const t=Og.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),n={};for(const r of t)n[r]=e[r];return Og.objectValues(n)},Og.objectValues=e=>Og.objectKeys(e).map(function(t){return e[t]}),Og.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},Og.find=(e,t)=>{for(const n of e)if(t(n))return n},Og.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,Og.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},Og.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(Bg||(Bg={})).mergeShapes=(e,t)=>({...e,...t});const Mg=Ng.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Dg=e=>{switch(typeof e){case"undefined":return Mg.undefined;case"string":return Mg.string;case"number":return Number.isNaN(e)?Mg.nan:Mg.number;case"boolean":return Mg.boolean;case"function":return Mg.function;case"bigint":return Mg.bigint;case"symbol":return Mg.symbol;case"object":return Array.isArray(e)?Mg.array:null===e?Mg.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?Mg.promise:"undefined"!=typeof Map&&e instanceof Map?Mg.map:"undefined"!=typeof Set&&e instanceof Set?Mg.set:"undefined"!=typeof Date&&e instanceof Date?Mg.date:Mg.object;default:return Mg.unknown}},Fg=Ng.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class kg extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(r);else if("invalid_return_type"===i.code)r(i.returnTypeError);else if("invalid_arguments"===i.code)r(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){const n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(e){if(!(e instanceof kg))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ng.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const r of this.issues)if(r.path.length>0){const n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}kg.create=e=>new kg(e);const Gg=(e,t)=>{let n;switch(e.code){case Fg.invalid_type:n=e.received===Mg.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case Fg.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ng.jsonStringifyReplacer)}`;break;case Fg.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ng.joinValues(e.keys,", ")}`;break;case Fg.invalid_union:n="Invalid input";break;case Fg.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ng.joinValues(e.options)}`;break;case Fg.invalid_enum_value:n=`Invalid enum value. Expected ${Ng.joinValues(e.options)}, received '${e.received}'`;break;case Fg.invalid_arguments:n="Invalid function arguments";break;case Fg.invalid_return_type:n="Invalid function return type";break;case Fg.invalid_date:n="Invalid date";break;case Fg.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ng.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case Fg.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case Fg.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case Fg.custom:n="Invalid input";break;case Fg.invalid_intersection_types:n="Intersection results could not be merged";break;case Fg.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Fg.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ng.assertNever(e)}return{message:n}};let xg=Gg;function Hg(e,t){const n=xg,r=(e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(void 0!==i.message)return{...i,path:a,message:i.message};let s="";const c=r.filter(e=>!!e).slice().reverse();for(const l of c)s=l(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}})({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Gg?void 0:Gg].filter(e=>!!e)});e.common.issues.push(r)}class Ug{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if("aborted"===r.status)return Vg;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const r of t){const e=await r.key,t=await r.value;n.push({key:e,value:t})}return Ug.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:t,value:i}=r;if("aborted"===t.status)return Vg;if("aborted"===i.status)return Vg;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===t.value||void 0===i.value&&!r.alwaysSet||(n[t.value]=i.value)}return{status:e.value,value:n}}}const Vg=Object.freeze({status:"aborted"}),$g=e=>({status:"dirty",value:e}),jg=e=>({status:"valid",value:e}),Wg=e=>"aborted"===e.status,Xg=e=>"dirty"===e.status,Kg=e=>"valid"===e.status,Yg=e=>"undefined"!=typeof Promise&&e instanceof Promise;var qg,Qg;(Qg=qg||(qg={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},Qg.toString=e=>"string"==typeof e?e:e?.message;class Jg{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const zg=(e,t)=>{if(Kg(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new kg(e.common.issues);return this._error=t,this._error}}};function Zg(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:i};return{errorMap:(t,i)=>{const{message:a}=e;return"invalid_enum_value"===t.code?{message:a??i.defaultError}:void 0===i.data?{message:a??r??i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:a??n??i.defaultError}},description:i}}class ey{get description(){return this._def.description}_getType(e){return Dg(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Dg(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ug,ctx:{common:e.parent.common,data:e.data,parsedType:Dg(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Yg(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){const n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Dg(e)},r=this._parseSync({data:e,path:n.path,parent:n});return zg(n,r)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Dg(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:t});return Kg(n)?{value:n.value}:{issues:t.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>Kg(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Dg(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(Yg(r)?r:Promise.resolve(r));return zg(n,i)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,r)=>{const i=e(t),a=()=>r.addIssue({code:Fg.custom,...n(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then(e=>!!e||(a(),!1)):!!i||(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1))}_refinement(e){return new zy({schema:this,typeName:sI.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return Zy.create(this,this._def)}nullable(){return eI.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ky.create(this)}promise(){return Jy.create(this,this._def)}or(e){return Hy.create([this,e],this._def)}and(e){return Vy.create(this,e,this._def)}transform(e){return new zy({...Zg(this._def),schema:this,typeName:sI.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new tI({...Zg(this._def),innerType:this,defaultValue:t,typeName:sI.ZodDefault})}brand(){return new iI({typeName:sI.ZodBranded,type:this,...Zg(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new nI({...Zg(this._def),innerType:this,catchValue:t,typeName:sI.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return aI.create(this,e)}readonly(){return oI.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ty=/^c[^\s-]{8,}$/i,ny=/^[0-9a-z]+$/,ry=/^[0-9A-HJKMNP-TV-Z]{26}$/i,iy=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ay=/^[a-z0-9_-]{21}$/i,oy=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,sy=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,cy=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let ly;const uy=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,dy=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,py=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,hy=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,fy=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,my=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,gy="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",yy=new RegExp(`^${gy}$`);function Iy(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function Cy(e){return new RegExp(`^${Iy(e)}$`)}function Ay(e){let t=`${gy}T${Iy(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Sy(e,t){return!("v4"!==t&&t||!uy.test(e))||!("v6"!==t&&t||!py.test(e))}function by(e,t){if(!oy.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return"object"==typeof i&&null!==i&&((!("typ"in i)||"JWT"===i?.typ)&&(!!i.alg&&(!t||i.alg===t)))}catch{return!1}}function Ty(e,t){return!("v4"!==t&&t||!dy.test(e))||!("v6"!==t&&t||!hy.test(e))}class vy extends ey{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==Mg.string){const t=this._getOrReturnCtx(e);return Hg(t,{code:Fg.invalid_type,expected:Mg.string,received:t.parsedType}),Vg}const t=new Ug;let n;for(const r of this._def.checks)if("min"===r.kind)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),Hg(n,{code:Fg.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("max"===r.kind)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),Hg(n,{code:Fg.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("length"===r.kind){const i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?Hg(n,{code:Fg.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):a&&Hg(n,{code:Fg.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if("email"===r.kind)cy.test(e.data)||(n=this._getOrReturnCtx(e,n),Hg(n,{validation:"email",code:Fg.invalid_string,message:r.message}),t.dirty());else if("emoji"===r.kind)ly||(ly=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),ly.test(e.data)||(n=this._getOrReturnCtx(e,n),Hg(n,{validation:"emoji",code:Fg.invalid_string,message:r.message}),t.dirty());else if("uuid"===r.kind)iy.test(e.data)||(n=this._getOrReturnCtx(e,n),Hg(n,{validation:"uuid",code:Fg.invalid_string,message:r.message}),t.dirty());else if("nanoid"===r.kind)ay.test(e.data)||(n=this._getOrReturnCtx(e,n),Hg(n,{validation:"nanoid",code:Fg.invalid_string,message:r.message}),t.dirty());else if("cuid"===r.kind)ty.test(e.data)||(n=this._getOrReturnCtx(e,n),Hg(n,{validation:"cuid",code:Fg.invalid_string,message:r.message}),t.dirty());else if("cuid2"===r.kind)ny.test(e.data)||(n=this._getOrReturnCtx(e,n),Hg(n,{validation:"cuid2",code:Fg.invalid_string,message:r.message}),t.dirty());else if("ulid"===r.kind)ry.test(e.data)||(n=this._getOrReturnCtx(e,n),Hg(n,{validation:"ulid",code:Fg.invalid_string,message:r.message}),t.dirty());else if("url"===r.kind)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),Hg(n,{validation:"url",code:Fg.invalid_string,message:r.message}),t.dirty()}else if("regex"===r.kind){r.regex.lastIndex=0;r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),Hg(n,{validation:"regex",code:Fg.invalid_string,message:r.message}),t.dirty())}else if("trim"===r.kind)e.data=e.data.trim();else if("includes"===r.kind)e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),Hg(n,{code:Fg.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty());else if("toLowerCase"===r.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===r.kind)e.data=e.data.toUpperCase();else if("startsWith"===r.kind)e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),Hg(n,{code:Fg.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty());else if("endsWith"===r.kind)e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),Hg(n,{code:Fg.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty());else if("datetime"===r.kind){Ay(r).test(e.data)||(n=this._getOrReturnCtx(e,n),Hg(n,{code:Fg.invalid_string,validation:"datetime",message:r.message}),t.dirty())}else if("date"===r.kind){yy.test(e.data)||(n=this._getOrReturnCtx(e,n),Hg(n,{code:Fg.invalid_string,validation:"date",message:r.message}),t.dirty())}else if("time"===r.kind){Cy(r).test(e.data)||(n=this._getOrReturnCtx(e,n),Hg(n,{code:Fg.invalid_string,validation:"time",message:r.message}),t.dirty())}else"duration"===r.kind?sy.test(e.data)||(n=this._getOrReturnCtx(e,n),Hg(n,{validation:"duration",code:Fg.invalid_string,message:r.message}),t.dirty()):"ip"===r.kind?Sy(e.data,r.version)||(n=this._getOrReturnCtx(e,n),Hg(n,{validation:"ip",code:Fg.invalid_string,message:r.message}),t.dirty()):"jwt"===r.kind?by(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),Hg(n,{validation:"jwt",code:Fg.invalid_string,message:r.message}),t.dirty()):"cidr"===r.kind?Ty(e.data,r.version)||(n=this._getOrReturnCtx(e,n),Hg(n,{validation:"cidr",code:Fg.invalid_string,message:r.message}),t.dirty()):"base64"===r.kind?fy.test(e.data)||(n=this._getOrReturnCtx(e,n),Hg(n,{validation:"base64",code:Fg.invalid_string,message:r.message}),t.dirty()):"base64url"===r.kind?my.test(e.data)||(n=this._getOrReturnCtx(e,n),Hg(n,{validation:"base64url",code:Fg.invalid_string,message:r.message}),t.dirty()):Ng.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:Fg.invalid_string,...qg.errToObj(n)})}_addCheck(e){return new vy({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...qg.errToObj(e)})}url(e){return this._addCheck({kind:"url",...qg.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...qg.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...qg.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...qg.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...qg.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...qg.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...qg.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...qg.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...qg.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...qg.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...qg.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...qg.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...qg.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...qg.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...qg.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...qg.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...qg.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...qg.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...qg.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...qg.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...qg.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...qg.errToObj(t)})}nonempty(e){return this.min(1,qg.errToObj(e))}trim(){return new vy({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new vy({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new vy({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function _y(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}vy.create=e=>new vy({checks:[],typeName:sI.ZodString,coerce:e?.coerce??!1,...Zg(e)});class wy extends ey{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==Mg.number){const t=this._getOrReturnCtx(e);return Hg(t,{code:Fg.invalid_type,expected:Mg.number,received:t.parsedType}),Vg}let t;const n=new Ug;for(const r of this._def.checks)if("int"===r.kind)Ng.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Hg(t,{code:Fg.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty());else if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),Hg(t,{code:Fg.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Hg(t,{code:Fg.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else"multipleOf"===r.kind?0!==_y(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),Hg(t,{code:Fg.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Hg(t,{code:Fg.not_finite,message:r.message}),n.dirty()):Ng.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,qg.toString(t))}gt(e,t){return this.setLimit("min",e,!1,qg.toString(t))}lte(e,t){return this.setLimit("max",e,!0,qg.toString(t))}lt(e,t){return this.setLimit("max",e,!1,qg.toString(t))}setLimit(e,t,n,r){return new wy({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:qg.toString(r)}]})}_addCheck(e){return new wy({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:qg.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:qg.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:qg.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:qg.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:qg.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:qg.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:qg.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:qg.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:qg.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&Ng.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}wy.create=e=>new wy({checks:[],typeName:sI.ZodNumber,coerce:e?.coerce||!1,...Zg(e)});class Ey extends ey{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Mg.bigint)return this._getInvalidInput(e);let t;const n=new Ug;for(const r of this._def.checks)if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),Hg(t,{code:Fg.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Hg(t,{code:Fg.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty())}else"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Hg(t,{code:Fg.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):Ng.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Hg(t,{code:Fg.invalid_type,expected:Mg.bigint,received:t.parsedType}),Vg}gte(e,t){return this.setLimit("min",e,!0,qg.toString(t))}gt(e,t){return this.setLimit("min",e,!1,qg.toString(t))}lte(e,t){return this.setLimit("max",e,!0,qg.toString(t))}lt(e,t){return this.setLimit("max",e,!1,qg.toString(t))}setLimit(e,t,n,r){return new Ey({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:qg.toString(r)}]})}_addCheck(e){return new Ey({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:qg.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:qg.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:qg.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:qg.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:qg.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}Ey.create=e=>new Ey({checks:[],typeName:sI.ZodBigInt,coerce:e?.coerce??!1,...Zg(e)});class Py extends ey{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==Mg.boolean){const t=this._getOrReturnCtx(e);return Hg(t,{code:Fg.invalid_type,expected:Mg.boolean,received:t.parsedType}),Vg}return jg(e.data)}}Py.create=e=>new Py({typeName:sI.ZodBoolean,coerce:e?.coerce||!1,...Zg(e)});class Ry extends ey{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==Mg.date){const t=this._getOrReturnCtx(e);return Hg(t,{code:Fg.invalid_type,expected:Mg.date,received:t.parsedType}),Vg}if(Number.isNaN(e.data.getTime())){return Hg(this._getOrReturnCtx(e),{code:Fg.invalid_date}),Vg}const t=new Ug;let n;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),Hg(n,{code:Fg.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),Hg(n,{code:Fg.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):Ng.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ry({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:qg.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:qg.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}Ry.create=e=>new Ry({checks:[],coerce:e?.coerce||!1,typeName:sI.ZodDate,...Zg(e)});class Ly extends ey{_parse(e){if(this._getType(e)!==Mg.symbol){const t=this._getOrReturnCtx(e);return Hg(t,{code:Fg.invalid_type,expected:Mg.symbol,received:t.parsedType}),Vg}return jg(e.data)}}Ly.create=e=>new Ly({typeName:sI.ZodSymbol,...Zg(e)});class Ny extends ey{_parse(e){if(this._getType(e)!==Mg.undefined){const t=this._getOrReturnCtx(e);return Hg(t,{code:Fg.invalid_type,expected:Mg.undefined,received:t.parsedType}),Vg}return jg(e.data)}}Ny.create=e=>new Ny({typeName:sI.ZodUndefined,...Zg(e)});class Oy extends ey{_parse(e){if(this._getType(e)!==Mg.null){const t=this._getOrReturnCtx(e);return Hg(t,{code:Fg.invalid_type,expected:Mg.null,received:t.parsedType}),Vg}return jg(e.data)}}Oy.create=e=>new Oy({typeName:sI.ZodNull,...Zg(e)});class By extends ey{constructor(){super(...arguments),this._any=!0}_parse(e){return jg(e.data)}}By.create=e=>new By({typeName:sI.ZodAny,...Zg(e)});class My extends ey{constructor(){super(...arguments),this._unknown=!0}_parse(e){return jg(e.data)}}My.create=e=>new My({typeName:sI.ZodUnknown,...Zg(e)});class Dy extends ey{_parse(e){const t=this._getOrReturnCtx(e);return Hg(t,{code:Fg.invalid_type,expected:Mg.never,received:t.parsedType}),Vg}}Dy.create=e=>new Dy({typeName:sI.ZodNever,...Zg(e)});class Fy extends ey{_parse(e){if(this._getType(e)!==Mg.undefined){const t=this._getOrReturnCtx(e);return Hg(t,{code:Fg.invalid_type,expected:Mg.void,received:t.parsedType}),Vg}return jg(e.data)}}Fy.create=e=>new Fy({typeName:sI.ZodVoid,...Zg(e)});class ky extends ey{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==Mg.array)return Hg(t,{code:Fg.invalid_type,expected:Mg.array,received:t.parsedType}),Vg;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(Hg(t,{code:e?Fg.too_big:Fg.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(Hg(t,{code:Fg.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(Hg(t,{code:Fg.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new Jg(t,e,t.path,n)))).then(e=>Ug.mergeArray(n,e));const i=[...t.data].map((e,n)=>r.type._parseSync(new Jg(t,e,t.path,n)));return Ug.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new ky({...this._def,minLength:{value:e,message:qg.toString(t)}})}max(e,t){return new ky({...this._def,maxLength:{value:e,message:qg.toString(t)}})}length(e,t){return new ky({...this._def,exactLength:{value:e,message:qg.toString(t)}})}nonempty(e){return this.min(1,e)}}function Gy(e){if(e instanceof xy){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Zy.create(Gy(r))}return new xy({...e._def,shape:()=>t})}return e instanceof ky?new ky({...e._def,type:Gy(e.element)}):e instanceof Zy?Zy.create(Gy(e.unwrap())):e instanceof eI?eI.create(Gy(e.unwrap())):e instanceof $y?$y.create(e.items.map(e=>Gy(e))):e}ky.create=(e,t)=>new ky({type:e,minLength:null,maxLength:null,exactLength:null,typeName:sI.ZodArray,...Zg(t)});class xy extends ey{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Ng.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==Mg.object){const t=this._getOrReturnCtx(e);return Hg(t,{code:Fg.invalid_type,expected:Mg.object,received:t.parsedType}),Vg}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Dy&&"strip"===this._def.unknownKeys))for(const s in n.data)i.includes(s)||a.push(s);const o=[];for(const s of i){const e=r[s],t=n.data[s];o.push({key:{status:"valid",value:s},value:e._parse(new Jg(n,t,n.path,s)),alwaysSet:s in n.data})}if(this._def.catchall instanceof Dy){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of a)o.push({key:{status:"valid",value:t},value:{status:"valid",value:n.data[t]}});else if("strict"===e)a.length>0&&(Hg(n,{code:Fg.unrecognized_keys,keys:a}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of a){const r=n.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new Jg(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of o){const n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>Ug.mergeObjectSync(t,e)):Ug.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return qg.errToObj,new xy({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{const r=this._def.errorMap?.(t,n).message??n.defaultError;return"unrecognized_keys"===t.code?{message:qg.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new xy({...this._def,unknownKeys:"strip"})}passthrough(){return new xy({...this._def,unknownKeys:"passthrough"})}extend(e){return new xy({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new xy({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:sI.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new xy({...this._def,catchall:e})}pick(e){const t={};for(const n of Ng.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new xy({...this._def,shape:()=>t})}omit(e){const t={};for(const n of Ng.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new xy({...this._def,shape:()=>t})}deepPartial(){return Gy(this)}partial(e){const t={};for(const n of Ng.objectKeys(this.shape)){const r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()}return new xy({...this._def,shape:()=>t})}required(e){const t={};for(const n of Ng.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Zy;)e=e._def.innerType;t[n]=e}return new xy({...this._def,shape:()=>t})}keyof(){return Yy(Ng.objectKeys(this.shape))}}xy.create=(e,t)=>new xy({shape:()=>e,unknownKeys:"strip",catchall:Dy.create(),typeName:sI.ZodObject,...Zg(t)}),xy.strictCreate=(e,t)=>new xy({shape:()=>e,unknownKeys:"strict",catchall:Dy.create(),typeName:sI.ZodObject,...Zg(t)}),xy.lazycreate=(e,t)=>new xy({shape:e,unknownKeys:"strip",catchall:Dy.create(),typeName:sI.ZodObject,...Zg(t)});class Hy extends ey{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map(async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const n=e.map(e=>new kg(e.ctx.common.issues));return Hg(t,{code:Fg.invalid_union,unionErrors:n}),Vg});{let e;const r=[];for(const a of n){const n={...t,common:{...t.common,issues:[]},parent:null},i=a._parseSync({data:t.data,path:t.path,parent:n});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=r.map(e=>new kg(e));return Hg(t,{code:Fg.invalid_union,unionErrors:i}),Vg}}get options(){return this._def.options}}function Uy(e,t){const n=Dg(e),r=Dg(t);if(e===t)return{valid:!0,data:e};if(n===Mg.object&&r===Mg.object){const n=Ng.objectKeys(t),r=Ng.objectKeys(e).filter(e=>-1!==n.indexOf(e)),i={...e,...t};for(const a of r){const n=Uy(e[a],t[a]);if(!n.valid)return{valid:!1};i[a]=n.data}return{valid:!0,data:i}}if(n===Mg.array&&r===Mg.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let r=0;r<e.length;r++){const i=Uy(e[r],t[r]);if(!i.valid)return{valid:!1};n.push(i.data)}return{valid:!0,data:n}}return n===Mg.date&&r===Mg.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}Hy.create=(e,t)=>new Hy({options:e,typeName:sI.ZodUnion,...Zg(t)});class Vy extends ey{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(Wg(e)||Wg(r))return Vg;const i=Uy(e.value,r.value);return i.valid?((Xg(e)||Xg(r))&&t.dirty(),{status:t.value,value:i.data}):(Hg(n,{code:Fg.invalid_intersection_types}),Vg)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Vy.create=(e,t,n)=>new Vy({left:e,right:t,typeName:sI.ZodIntersection,...Zg(n)});class $y extends ey{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Mg.array)return Hg(n,{code:Fg.invalid_type,expected:Mg.array,received:n.parsedType}),Vg;if(n.data.length<this._def.items.length)return Hg(n,{code:Fg.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Vg;!this._def.rest&&n.data.length>this._def.items.length&&(Hg(n,{code:Fg.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...n.data].map((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new Jg(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>Ug.mergeArray(t,e)):Ug.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new $y({...this._def,rest:e})}}$y.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new $y({items:e,typeName:sI.ZodTuple,rest:null,...Zg(t)})};class jy extends ey{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Mg.map)return Hg(n,{code:Fg.invalid_type,expected:Mg.map,received:n.parsedType}),Vg;const r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new Jg(n,e,n.path,[a,"key"])),value:i._parse(new Jg(n,t,n.path,[a,"value"]))}));if(n.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const n of a){const r=await n.key,i=await n.value;if("aborted"===r.status||"aborted"===i.status)return Vg;"dirty"!==r.status&&"dirty"!==i.status||t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}{const e=new Map;for(const n of a){const r=n.key,i=n.value;if("aborted"===r.status||"aborted"===i.status)return Vg;"dirty"!==r.status&&"dirty"!==i.status||t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}}jy.create=(e,t,n)=>new jy({valueType:t,keyType:e,typeName:sI.ZodMap,...Zg(n)});class Wy extends ey{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Mg.set)return Hg(n,{code:Fg.invalid_type,expected:Mg.set,received:n.parsedType}),Vg;const r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(Hg(n,{code:Fg.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&n.data.size>r.maxSize.value&&(Hg(n,{code:Fg.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const i=this._def.valueType;function a(e){const n=new Set;for(const r of e){if("aborted"===r.status)return Vg;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}const o=[...n.data.values()].map((e,t)=>i._parse(new Jg(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(e,t){return new Wy({...this._def,minSize:{value:e,message:qg.toString(t)}})}max(e,t){return new Wy({...this._def,maxSize:{value:e,message:qg.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Wy.create=(e,t)=>new Wy({valueType:e,minSize:null,maxSize:null,typeName:sI.ZodSet,...Zg(t)});class Xy extends ey{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Xy.create=(e,t)=>new Xy({getter:e,typeName:sI.ZodLazy,...Zg(t)});class Ky extends ey{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Hg(t,{received:t.data,code:Fg.invalid_literal,expected:this._def.value}),Vg}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Yy(e,t){return new qy({values:e,typeName:sI.ZodEnum,...Zg(t)})}Ky.create=(e,t)=>new Ky({value:e,typeName:sI.ZodLiteral,...Zg(t)});class qy extends ey{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return Hg(t,{expected:Ng.joinValues(n),received:t.parsedType,code:Fg.invalid_type}),Vg}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return Hg(t,{received:t.data,code:Fg.invalid_enum_value,options:n}),Vg}return jg(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return qy.create(e,{...this._def,...t})}exclude(e,t=this._def){return qy.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}qy.create=Yy;class Qy extends ey{_parse(e){const t=Ng.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Mg.string&&n.parsedType!==Mg.number){const e=Ng.objectValues(t);return Hg(n,{expected:Ng.joinValues(e),received:n.parsedType,code:Fg.invalid_type}),Vg}if(this._cache||(this._cache=new Set(Ng.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=Ng.objectValues(t);return Hg(n,{received:n.data,code:Fg.invalid_enum_value,options:e}),Vg}return jg(e.data)}get enum(){return this._def.values}}Qy.create=(e,t)=>new Qy({values:e,typeName:sI.ZodNativeEnum,...Zg(t)});class Jy extends ey{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Mg.promise&&!1===t.common.async)return Hg(t,{code:Fg.invalid_type,expected:Mg.promise,received:t.parsedType}),Vg;const n=t.parsedType===Mg.promise?t.data:Promise.resolve(t.data);return jg(n.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Jy.create=(e,t)=>new Jy({type:e,typeName:sI.ZodPromise,...Zg(t)});class zy extends ey{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===sI.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{Hg(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===r.type){const e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return Vg;const r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?Vg:"dirty"===r.status||"dirty"===t.value?$g(r.value):r});{if("aborted"===t.value)return Vg;const r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?Vg:"dirty"===r.status||"dirty"===t.value?$g(r.value):r}}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===r.status?Vg:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>"aborted"===n.status?Vg:("dirty"===n.status&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if("transform"===r.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Kg(e))return Vg;const a=r.transform(e.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>Kg(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):Vg)}Ng.assertNever(r)}}zy.create=(e,t,n)=>new zy({schema:e,typeName:sI.ZodEffects,effect:t,...Zg(n)}),zy.createWithPreprocess=(e,t,n)=>new zy({schema:t,effect:{type:"preprocess",transform:e},typeName:sI.ZodEffects,...Zg(n)});class Zy extends ey{_parse(e){return this._getType(e)===Mg.undefined?jg(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Zy.create=(e,t)=>new Zy({innerType:e,typeName:sI.ZodOptional,...Zg(t)});class eI extends ey{_parse(e){return this._getType(e)===Mg.null?jg(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}eI.create=(e,t)=>new eI({innerType:e,typeName:sI.ZodNullable,...Zg(t)});class tI extends ey{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===Mg.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}tI.create=(e,t)=>new tI({innerType:e,typeName:sI.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...Zg(t)});class nI extends ey{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Yg(r)?r.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new kg(n.common.issues)},input:n.data})})):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new kg(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}nI.create=(e,t)=>new nI({innerType:e,typeName:sI.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...Zg(t)});class rI extends ey{_parse(e){if(this._getType(e)!==Mg.nan){const t=this._getOrReturnCtx(e);return Hg(t,{code:Fg.invalid_type,expected:Mg.nan,received:t.parsedType}),Vg}return{status:"valid",value:e.data}}}rI.create=e=>new rI({typeName:sI.ZodNaN,...Zg(e)});class iI extends ey{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class aI extends ey{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?Vg:"dirty"===e.status?(t.dirty(),$g(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?Vg:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new aI({in:e,out:t,typeName:sI.ZodPipeline})}}class oI extends ey{_parse(e){const t=this._def.innerType._parse(e),n=e=>(Kg(e)&&(e.value=Object.freeze(e.value)),e);return Yg(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}}var sI,cI;oI.create=(e,t)=>new oI({innerType:e,typeName:sI.ZodReadonly,...Zg(t)}),(cI=sI||(sI={})).ZodString="ZodString",cI.ZodNumber="ZodNumber",cI.ZodNaN="ZodNaN",cI.ZodBigInt="ZodBigInt",cI.ZodBoolean="ZodBoolean",cI.ZodDate="ZodDate",cI.ZodSymbol="ZodSymbol",cI.ZodUndefined="ZodUndefined",cI.ZodNull="ZodNull",cI.ZodAny="ZodAny",cI.ZodUnknown="ZodUnknown",cI.ZodNever="ZodNever",cI.ZodVoid="ZodVoid",cI.ZodArray="ZodArray",cI.ZodObject="ZodObject",cI.ZodUnion="ZodUnion",cI.ZodDiscriminatedUnion="ZodDiscriminatedUnion",cI.ZodIntersection="ZodIntersection",cI.ZodTuple="ZodTuple",cI.ZodRecord="ZodRecord",cI.ZodMap="ZodMap",cI.ZodSet="ZodSet",cI.ZodFunction="ZodFunction",cI.ZodLazy="ZodLazy",cI.ZodLiteral="ZodLiteral",cI.ZodEnum="ZodEnum",cI.ZodEffects="ZodEffects",cI.ZodNativeEnum="ZodNativeEnum",cI.ZodOptional="ZodOptional",cI.ZodNullable="ZodNullable",cI.ZodDefault="ZodDefault",cI.ZodCatch="ZodCatch",cI.ZodPromise="ZodPromise",cI.ZodBranded="ZodBranded",cI.ZodPipeline="ZodPipeline",cI.ZodReadonly="ZodReadonly";const lI=vy.create,uI=By.create;Dy.create,ky.create;const dI=xy.create;function pI(e,t){return xI(e.type._def,t)}Hy.create,Vy.create,$y.create,qy.create,Jy.create,Zy.create,eI.create;function hI(e,t,n){const r=n??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map(n=>hI(e,t,n))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return fI(e,t)}}const fI=(e,t)=>{const n={type:"integer",format:"unix-time"};if("openApi3"===t.target)return n;for(const r of e.checks)switch(r.kind){case"min":Lg(n,"minimum",r.value,r.message,t);break;case"max":Lg(n,"maximum",r.value,r.message,t)}return n};let mI;const gI=/^[cC][^\s-]{8,}$/,yI=/^[0-9a-z]+$/,II=/^[0-9A-HJKMNP-TV-Z]{26}$/,CI=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,AI=()=>(void 0===mI&&(mI=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),mI),SI=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,bI=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,TI=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,vI=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,_I=/^[a-zA-Z0-9_-]{21}$/,wI=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function EI(e,t){const n={type:"string"};if(e.checks)for(const r of e.checks)switch(r.kind){case"min":Lg(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,r.value):r.value,r.message,t);break;case"max":Lg(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case"email":switch(t.emailStrategy){case"format:email":LI(n,"email",r.message,t);break;case"format:idn-email":LI(n,"idn-email",r.message,t);break;case"pattern:zod":NI(n,CI,r.message,t)}break;case"url":LI(n,"uri",r.message,t);break;case"uuid":LI(n,"uuid",r.message,t);break;case"regex":NI(n,r.regex,r.message,t);break;case"cuid":NI(n,gI,r.message,t);break;case"cuid2":NI(n,yI,r.message,t);break;case"startsWith":NI(n,RegExp(`^${PI(r.value,t)}`),r.message,t);break;case"endsWith":NI(n,RegExp(`${PI(r.value,t)}$`),r.message,t);break;case"datetime":LI(n,"date-time",r.message,t);break;case"date":LI(n,"date",r.message,t);break;case"time":LI(n,"time",r.message,t);break;case"duration":LI(n,"duration",r.message,t);break;case"length":Lg(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,r.value):r.value,r.message,t),Lg(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case"includes":NI(n,RegExp(PI(r.value,t)),r.message,t);break;case"ip":"v6"!==r.version&&LI(n,"ipv4",r.message,t),"v4"!==r.version&&LI(n,"ipv6",r.message,t);break;case"base64url":NI(n,vI,r.message,t);break;case"jwt":NI(n,wI,r.message,t);break;case"cidr":"v6"!==r.version&&NI(n,SI,r.message,t),"v4"!==r.version&&NI(n,bI,r.message,t);break;case"emoji":NI(n,AI(),r.message,t);break;case"ulid":NI(n,II,r.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":LI(n,"binary",r.message,t);break;case"contentEncoding:base64":Lg(n,"contentEncoding","base64",r.message,t);break;case"pattern:zod":NI(n,TI,r.message,t)}break;case"nanoid":NI(n,_I,r.message,t)}return n}function PI(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let n=0;n<e.length;n++)RI.has(e[n])||(t+="\\"),t+=e[n];return t}(e):e}const RI=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function LI(e,t,n,r){e.format||e.anyOf?.some(e=>e.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&r.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.anyOf.push({format:t,...n&&r.errorMessages&&{errorMessage:{format:n}}})):Lg(e,"format",t,n,r)}function NI(e,t,n,r){e.pattern||e.allOf?.some(e=>e.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&r.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.allOf.push({pattern:OI(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):Lg(e,"pattern",OI(t,r),n,r)}function OI(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;const n=e.flags.includes("i"),r=e.flags.includes("m"),i=e.flags.includes("s"),a=n?e.source.toLowerCase():e.source;let o="",s=!1,c=!1,l=!1;for(let u=0;u<a.length;u++)if(s)o+=a[u],s=!1;else{if(n)if(c){if(a[u].match(/[a-z]/)){l?(o+=a[u],o+=`${a[u-2]}-${a[u]}`.toUpperCase(),l=!1):"-"===a[u+1]&&a[u+2]?.match(/[a-z]/)?(o+=a[u],l=!0):o+=`${a[u]}${a[u].toUpperCase()}`;continue}}else if(a[u].match(/[a-z]/)){o+=`[${a[u]}${a[u].toUpperCase()}]`;continue}if(r){if("^"===a[u]){o+="(^|(?<=[\r\n]))";continue}if("$"===a[u]){o+="($|(?=[\r\n]))";continue}}i&&"."===a[u]?o+=c?`${a[u]}\r\n`:`[${a[u]}\r\n]`:(o+=a[u],"\\"===a[u]?s=!0:c&&"]"===a[u]?c=!1:c||"["!==a[u]||(c=!0))}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}function BI(e,t){if("openAi"===t.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===t.target&&e.keyType?._def.typeName===sI.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,r)=>({...n,[r]:xI(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",r]})??Pg(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};const n={type:"object",additionalProperties:xI(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if("openApi3"===t.target)return n;if(e.keyType?._def.typeName===sI.ZodString&&e.keyType._def.checks?.length){const{type:r,...i}=EI(e.keyType._def,t);return{...n,propertyNames:i}}if(e.keyType?._def.typeName===sI.ZodEnum)return{...n,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===sI.ZodBranded&&e.keyType._def.type._def.typeName===sI.ZodString&&e.keyType._def.type._def.checks?.length){const{type:r,...i}=pI(e.keyType._def,t);return{...n,propertyNames:i}}return n}const MI={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};const DI=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>xI(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${n}`]})).filter(e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0));return n.length?{anyOf:n}:void 0};function FI(e,t){const n="openAi"===t.target,r={type:"object",properties:{}},i=[],a=e.shape();for(const s in a){let e=a[s];if(void 0===e||void 0===e._def)continue;let o=kI(e);o&&n&&("ZodOptional"===e._def.typeName&&(e=e._def.innerType),e.isNullable()||(e=e.nullable()),o=!1);const c=xI(e._def,{...t,currentPath:[...t.currentPath,"properties",s],propertyPath:[...t.currentPath,"properties",s]});void 0!==c&&(r.properties[s]=c,o||i.push(s))}i.length&&(r.required=i);const o=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return xI(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return"strict"===t.removeAdditionalStrategy?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}(e,t);return void 0!==o&&(r.additionalProperties=o),r}function kI(e){try{return e.isOptional()}catch{return!0}}const GI=(e,t,n)=>{switch(t){case sI.ZodString:return EI(e,n);case sI.ZodNumber:return function(e,t){const n={type:"number"};if(!e.checks)return n;for(const r of e.checks)switch(r.kind){case"int":n.type="integer",Rg(n,"type",r.message,t);break;case"min":"jsonSchema7"===t.target?r.inclusive?Lg(n,"minimum",r.value,r.message,t):Lg(n,"exclusiveMinimum",r.value,r.message,t):(r.inclusive||(n.exclusiveMinimum=!0),Lg(n,"minimum",r.value,r.message,t));break;case"max":"jsonSchema7"===t.target?r.inclusive?Lg(n,"maximum",r.value,r.message,t):Lg(n,"exclusiveMaximum",r.value,r.message,t):(r.inclusive||(n.exclusiveMaximum=!0),Lg(n,"maximum",r.value,r.message,t));break;case"multipleOf":Lg(n,"multipleOf",r.value,r.message,t)}return n}(e,n);case sI.ZodObject:return FI(e,n);case sI.ZodBigInt:return function(e,t){const n={type:"integer",format:"int64"};if(!e.checks)return n;for(const r of e.checks)switch(r.kind){case"min":"jsonSchema7"===t.target?r.inclusive?Lg(n,"minimum",r.value,r.message,t):Lg(n,"exclusiveMinimum",r.value,r.message,t):(r.inclusive||(n.exclusiveMinimum=!0),Lg(n,"minimum",r.value,r.message,t));break;case"max":"jsonSchema7"===t.target?r.inclusive?Lg(n,"maximum",r.value,r.message,t):Lg(n,"exclusiveMaximum",r.value,r.message,t):(r.inclusive||(n.exclusiveMaximum=!0),Lg(n,"maximum",r.value,r.message,t));break;case"multipleOf":Lg(n,"multipleOf",r.value,r.message,t)}return n}(e,n);case sI.ZodBoolean:return{type:"boolean"};case sI.ZodDate:return hI(e,n);case sI.ZodUndefined:return function(e){return{not:Pg(e)}}(n);case sI.ZodNull:return function(e){return"openApi3"===e.target?{enum:["null"],nullable:!0}:{type:"null"}}(n);case sI.ZodArray:return function(e,t){const n={type:"array"};return e.type?._def&&e.type?._def?.typeName!==sI.ZodAny&&(n.items=xI(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&Lg(n,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&Lg(n,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(Lg(n,"minItems",e.exactLength.value,e.exactLength.message,t),Lg(n,"maxItems",e.exactLength.value,e.exactLength.message,t)),n}(e,n);case sI.ZodUnion:case sI.ZodDiscriminatedUnion:return function(e,t){if("openApi3"===t.target)return DI(e,t);const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in MI&&(!e._def.checks||!e._def.checks.length))){const e=n.reduce((e,t)=>{const n=MI[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e},[]);return{type:e.length>1?e:e[0]}}if(n.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){const e=n.reduce((e,t)=>{const n=typeof t._def.value;switch(n){case"string":case"number":case"boolean":return[...e,n];case"bigint":return[...e,"integer"];case"object":return null===t._def.value?[...e,"null"]:e;default:return e}},[]);if(e.length===n.length){const t=e.filter((e,t,n)=>n.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:n.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(n.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:n.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return DI(e,t)}(e,n);case sI.ZodIntersection:return function(e,t){const n=[xI(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),xI(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(e=>!!e);let r="jsonSchema2019-09"===t.target?{unevaluatedProperties:!1}:void 0;const i=[];return n.forEach(e=>{if("type"in(t=e)&&"string"===t.type||!("allOf"in t)){let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){const{additionalProperties:n,...r}=e;t=r}else r=void 0;i.push(t)}else i.push(...e.allOf),void 0===e.unevaluatedProperties&&(r=void 0);var t}),i.length?{allOf:i,...r}:void 0}(e,n);case sI.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,n)=>xI(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:xI(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>xI(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])}}(e,n);case sI.ZodRecord:return BI(e,n);case sI.ZodLiteral:return function(e,t){const n=typeof e.value;return"bigint"!==n&&"number"!==n&&"boolean"!==n&&"string"!==n?{type:Array.isArray(e.value)?"array":"object"}:"openApi3"===t.target?{type:"bigint"===n?"integer":n,enum:[e.value]}:{type:"bigint"===n?"integer":n,const:e.value}}(e,n);case sI.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case sI.ZodNativeEnum:return function(e){const t=e.values,n=Object.keys(e.values).filter(e=>"number"!=typeof t[t[e]]).map(e=>t[e]),r=Array.from(new Set(n.map(e=>typeof e)));return{type:1===r.length?"string"===r[0]?"string":"number":["string","number"],enum:n}}(e);case sI.ZodNullable:return function(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return"openApi3"===t.target?{type:MI[e.innerType._def.typeName],nullable:!0}:{type:[MI[e.innerType._def.typeName],"null"]};if("openApi3"===t.target){const n=xI(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}const n=xI(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}(e,n);case sI.ZodOptional:return((e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return xI(e.innerType._def,t);const n=xI(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:Pg(t)},n]}:Pg(t)})(e,n);case sI.ZodMap:return function(e,t){return"record"===t.mapStrategy?BI(e,t):{type:"array",maxItems:125,items:{type:"array",items:[xI(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Pg(t),xI(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Pg(t)],minItems:2,maxItems:2}}}(e,n);case sI.ZodSet:return function(e,t){const n={type:"array",uniqueItems:!0,items:xI(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&Lg(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&Lg(n,"maxItems",e.maxSize.value,e.maxSize.message,t),n}(e,n);case sI.ZodLazy:return()=>e.getter()._def;case sI.ZodPromise:return function(e,t){return xI(e.type._def,t)}(e,n);case sI.ZodNaN:case sI.ZodNever:return function(e){return"openAi"===e.target?void 0:{not:Pg({...e,currentPath:[...e.currentPath,"not"]})}}(n);case sI.ZodEffects:return function(e,t){return"input"===t.effectStrategy?xI(e.schema._def,t):Pg(t)}(e,n);case sI.ZodAny:return Pg(n);case sI.ZodUnknown:return function(e){return Pg(e)}(n);case sI.ZodDefault:return function(e,t){return{...xI(e.innerType._def,t),default:e.defaultValue()}}(e,n);case sI.ZodBranded:return pI(e,n);case sI.ZodReadonly:case sI.ZodCatch:return((e,t)=>xI(e.innerType._def,t))(e,n);case sI.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return xI(e.in._def,t);if("output"===t.pipeStrategy)return xI(e.out._def,t);const n=xI(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[n,xI(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]})].filter(e=>void 0!==e)}})(e,n);case sI.ZodFunction:case sI.ZodVoid:case sI.ZodSymbol:default:return}};function xI(e,t,n=!1){const r=t.seen.get(e);if(t.override){const i=t.override?.(e,t,r,n);if(i!==vg)return i}if(r&&!n){const e=HI(r,t);if(void 0!==e)return e}const i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);const a=GI(e,e.typeName,t),o="function"==typeof a?xI(a(),t):a;if(o&&UI(e,t,o),t.postProcess){const n=t.postProcess(o,e,t);return i.jsonSchema=o,n}return i.jsonSchema=o,o}const HI=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Eg(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((e,n)=>t.currentPath[n]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Pg(t)):"seen"===t.$refStrategy?Pg(t):void 0}},UI=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n);function VI(e){return("object"==typeof e||"function"==typeof e)&&null!==e&&"~standard"in e&&"object"==typeof e["~standard"]&&null!==e["~standard"]&&"jsonSchema"in e["~standard"]}function $I(e){return function(e){return("object"==typeof e||"function"==typeof e)&&null!==e&&"~standard"in e&&"object"==typeof e["~standard"]&&null!==e["~standard"]&&"validate"in e["~standard"]}(e)&&VI(e)}function jI(e,t){const n=typeof e;if(n!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(!jI(e[r],t[r]))return!1;return!0}if("object"===n){if(!e||!t)return e===t;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n)if(!jI(e[i],t[i]))return!1;return!0}return e===t}const WI=new WeakMap;function XI(e,t){const n=null!=e&&"object"==typeof e;if(n){const t=WI.get(e);if(t)return t}let r;if(VI(e)&&!mg(e))r=e["~standard"].jsonSchema.input({target:"draft-07"});else if(mg(e)){const n=function(e,t=!1){return Tg(e,t,new WeakMap)}(e,!0);if(Ag(n)){r=hg(bg(n,!0),t)}else r=hg(e,t)}else r=gg(e)?((e,t)=>{const n=wg(t);let r;const i=t?.name,a=xI(e._def,n,!1)??Pg(n);n.flags.hasReferencedOpenAiAnyType&&(r||(r={}),r[n.openAiAnyTypeName]||(r[n.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===n.$refStrategy?"1":[...n.basePath,n.definitionPath,n.openAiAnyTypeName].join("/")}}));const o=void 0===i?r?{...a,[n.definitionPath]:r}:a:{$ref:[..."relative"===n.$refStrategy?[]:n.basePath,n.definitionPath,i].join("/"),[n.definitionPath]:{...r,[i]:a}};return"jsonSchema7"===n.target?o.$schema="http://json-schema.org/draft-07/schema#":"jsonSchema2019-09"!==n.target&&"openAi"!==n.target||(o.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===n.target&&("anyOf"in o||"oneOf"in o||"allOf"in o||"type"in o&&Array.isArray(o.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),o})(e):e;return n&&null!=r&&"object"==typeof r&&WI.set(e,r),r}const KI=/([A-Z]+)([A-Z][a-z0-9]+)/g,YI=/([a-z0-9])([A-Z])/g,qI=/[-_\s]+/g;function QI(e,t){return t?.[e]||function(e){return e.replace(KI,"$1_$2").replace(YI,"$1_$2").replace(qI,"_").toLowerCase()}(e)}const JI="__lc_escaped__";function zI(e,t=new WeakSet){if(null!==e&&"object"==typeof e&&!Array.isArray(e)){if(t.has(e))return function(e){let t;return t=null!==e&&"object"==typeof e?"lc_id"in e&&Array.isArray(e.lc_id)?e.lc_id:[e.constructor?.name??"Object"]:[typeof e],{lc:1,type:"not_implemented",id:t}}(e);if(null!==(n=e)&&"object"==typeof n&&"lc_serializable"in n&&"function"==typeof n.toJSON)return e;t.add(e);const r=e;if(function(e){return"lc"in e||1===Object.keys(e).length&&"__lc_escaped__"in e}(r))return t.delete(e),function(e){return{[JI]:e}}(r);const i={};for(const[e,n]of Object.entries(r))i[e]=zI(n,t);return t.delete(e),i}var n;return Array.isArray(e)?e.map(e=>zI(e,t)):e}function ZI(e){return Array.isArray(e)?[...e]:{...e}}function eC(e){const t=Object.getPrototypeOf(e);return"function"!=typeof e.lc_name||"function"==typeof t.lc_name&&e.lc_name()===t.lc_name()?e.name:e.lc_name()}var tC=class e{lc_serializable=!1;lc_kwargs;static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,eC(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}constructor(e,...t){void 0!==this.lc_serializable_keys?this.lc_kwargs=Object.fromEntries(Object.entries(e||{}).filter(([e])=>this.lc_serializable_keys?.includes(e))):this.lc_kwargs=e??{}}toJSON(){if(!this.lc_serializable)return this.toJSONNotImplemented();if(this.lc_kwargs instanceof e||"object"!=typeof this.lc_kwargs||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();const t={},n={},r=Object.keys(this.lc_kwargs).reduce((e,t)=>(e[t]=t in this?this[t]:this.lc_kwargs[t],e),{});for(let e=Object.getPrototypeOf(this);e;e=Object.getPrototypeOf(e))Object.assign(t,Reflect.get(e,"lc_aliases",this)),Object.assign(n,Reflect.get(e,"lc_secrets",this)),Object.assign(r,Reflect.get(e,"lc_attributes",this));Object.keys(n).forEach(e=>{let t=this,n=r;const[i,...a]=e.split(".").reverse();for(const r of a.reverse()){if(!(r in t)||void 0===t[r])return;r in n&&void 0!==n[r]||("object"==typeof t[r]&&null!=t[r]?n[r]={}:Array.isArray(t[r])&&(n[r]=[])),t=t[r],n=n[r]}i in t&&void 0!==t[i]&&(n[i]=n[i]||t[i])});const i={},a=new WeakSet;a.add(this);for(const[e,s]of Object.entries(r))i[e]=zI(s,a);const o=function(e,t,n){const r={};for(const i in e)Object.hasOwn(e,i)&&(r[t(i,n)]=e[i]);return r}(Object.keys(n).length?function(e,t){const n=ZI(e);for(const[r,i]of Object.entries(t)){const[e,...t]=r.split(".").reverse();let a=n;for(const n of t.reverse()){if(void 0===a[n])break;a[n]=ZI(a[n]),a=a[n]}void 0!==a[e]&&(a[e]={lc:1,type:"secret",id:[i]})}return n}(i,n):i,QI,t);return{lc:1,type:"constructor",id:this.lc_id,kwargs:o}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}};function nC(e){return"object"==typeof e&&null!==e&&"type"in e&&"string"==typeof e.type&&"source_type"in e&&("url"===e.source_type||"base64"===e.source_type||"text"===e.source_type||"id"===e.source_type)}function rC(e){return nC(e)&&"url"===e.source_type&&"url"in e&&"string"==typeof e.url}function iC(e){return nC(e)&&"base64"===e.source_type&&"data"in e&&"string"==typeof e.data}function aC(e){if(nC(e)){if("url"===e.source_type)return{type:"image_url",image_url:{url:e.url}};if("base64"===e.source_type){if(!e.mime_type)throw new Error("mime_type key is required for base64 data.");return{type:"image_url",image_url:{url:`data:${e.mime_type};base64,${e.data}`}}}}throw new Error("Unsupported source type. Only 'url' and 'base64' are supported.")}function oC({dataUrl:e,asTypedArray:t=!1}){const n=e.match(/^data:(\w+\/\w+);base64,([A-Za-z0-9+/]+=*)$/);let r;if(n){r=n[1].toLowerCase();return{mime_type:r,data:t?Uint8Array.from(atob(n[2]),e=>e.charCodeAt(0)):n[2]}}}function sC(e,t){return cC(e)&&e.type===t}function cC(e){return"object"==typeof e&&null!==e}function lC(e){return Array.isArray(e)}function uC(e){return"string"==typeof e}function dC(e){return"number"==typeof e}function pC(e){return e instanceof Uint8Array}function hC(e){try{return JSON.parse(e)}catch{return}}const fC=e=>e();function mC(e){if("char_location"===e.type&&uC(e.document_title)&&dC(e.start_char_index)&&dC(e.end_char_index)&&uC(e.cited_text)){const{document_title:t,start_char_index:n,end_char_index:r,cited_text:i,...a}=e;return{...a,type:"citation",source:"char",title:t??void 0,startIndex:n,endIndex:r,citedText:i}}if("page_location"===e.type&&uC(e.document_title)&&dC(e.start_page_number)&&dC(e.end_page_number)&&uC(e.cited_text)){const{document_title:t,start_page_number:n,end_page_number:r,cited_text:i,...a}=e;return{...a,type:"citation",source:"page",title:t??void 0,startIndex:n,endIndex:r,citedText:i}}if("content_block_location"===e.type&&uC(e.document_title)&&dC(e.start_block_index)&&dC(e.end_block_index)&&uC(e.cited_text)){const{document_title:t,start_block_index:n,end_block_index:r,cited_text:i,...a}=e;return{...a,type:"citation",source:"block",title:t??void 0,startIndex:n,endIndex:r,citedText:i}}if("web_search_result_location"===e.type&&uC(e.url)&&uC(e.title)&&uC(e.encrypted_index)&&uC(e.cited_text)){const{url:t,title:n,encrypted_index:r,cited_text:i,...a}=e;return{...a,type:"citation",source:"url",url:t,title:n,startIndex:Number(r),endIndex:Number(r),citedText:i}}if("search_result_location"===e.type&&uC(e.source)&&uC(e.title)&&dC(e.start_block_index)&&dC(e.end_block_index)&&uC(e.cited_text)){const{source:t,title:n,start_block_index:r,end_block_index:i,cited_text:a,...o}=e;return{...o,type:"citation",source:"search",url:t,title:n??void 0,startIndex:r,endIndex:i,citedText:a}}}function gC(e){if(sC(e,"document")&&cC(e.source)&&"type"in e.source){if("base64"===e.source.type&&uC(e.source.media_type)&&uC(e.source.data))return{type:"file",mimeType:e.source.media_type,data:e.source.data};if("url"===e.source.type&&uC(e.source.url))return{type:"file",url:e.source.url};if("file"===e.source.type&&uC(e.source.file_id))return{type:"file",fileId:e.source.file_id};if("text"===e.source.type&&uC(e.source.data))return{type:"file",mimeType:String(e.source.media_type??"text/plain"),data:e.source.data}}else if(sC(e,"image")&&cC(e.source)&&"type"in e.source){if("base64"===e.source.type&&uC(e.source.media_type)&&uC(e.source.data))return{type:"image",mimeType:e.source.media_type,data:e.source.data};if("url"===e.source.type&&uC(e.source.url))return{type:"image",url:e.source.url};if("file"===e.source.type&&uC(e.source.file_id))return{type:"image",fileId:e.source.file_id}}}function yC(e){return Array.from(function*(){for(const t of e){const e=gC(t);e?yield e:yield t}}())}function IC(e){return Array.from(function*(){const t="string"==typeof e.content?[{type:"text",text:e.content}]:e.content;for(const n of t){if(sC(n,"text")&&uC(n.text)){const{text:e,citations:t,...r}=n;if(lC(t)&&t.length){const n=t.reduce((e,t)=>{const n=mC(t);return n?[...e,n]:e},[]);yield{...r,type:"text",text:e,annotations:n};continue}yield{...r,type:"text",text:e};continue}if(sC(n,"thinking")&&uC(n.thinking)){const{thinking:e,signature:t,...r}=n;yield{...r,type:"reasoning",reasoning:e,signature:t};continue}if(sC(n,"redacted_thinking"))yield{type:"non_standard",value:n};else if(sC(n,"tool_use")&&uC(n.name)&&uC(n.id))yield{type:"tool_call",id:n.id,name:n.name,args:n.input};else{if(sC(n,"input_json_delta")){if(AC(e)&&e.tool_call_chunks?.length){const t=e.tool_call_chunks[0];yield{type:"tool_call_chunk",id:t.id,name:t.name,args:t.args,index:t.index};continue}}else if(sC(n,"server_tool_use")&&uC(n.name)&&uC(n.id)){const{name:e,id:t}=n;if("web_search"===e){yield{id:t,type:"server_tool_call",name:"web_search",args:{query:fC(()=>{if("string"==typeof n.input)return n.input;if(cC(n.input)&&uC(n.input.query))return n.input.query;if(uC(n.partial_json)){const e=hC(n.partial_json);if(e?.query)return e.query}return""})}};continue}if("code_execution"===n.name){yield{id:t,type:"server_tool_call",name:"code_execution",args:{code:fC(()=>{if("string"==typeof n.input)return n.input;if(cC(n.input)&&uC(n.input.code))return n.input.code;if(uC(n.partial_json)){const e=hC(n.partial_json);if(e?.code)return e.code}return""})}};continue}}else{if(sC(n,"web_search_tool_result")&&uC(n.tool_use_id)&&lC(n.content)){const{content:e,tool_use_id:t}=n;yield{type:"server_tool_call_result",name:"web_search",toolCallId:t,status:"success",output:{urls:e.reduce((e,t)=>sC(t,"web_search_result")?[...e,t.url]:e,[])}};continue}if(sC(n,"code_execution_tool_result")&&uC(n.tool_use_id)&&cC(n.content)){yield{type:"server_tool_call_result",name:"code_execution",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}if(sC(n,"mcp_tool_use")){yield{id:n.id,type:"server_tool_call",name:"mcp_tool_use",args:n.input};continue}if(sC(n,"mcp_tool_result")&&uC(n.tool_use_id)&&cC(n.content)){yield{type:"server_tool_call_result",name:"mcp_tool_use",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}if(sC(n,"container_upload")){yield{type:"server_tool_call",name:"container_upload",args:n.input};continue}if(sC(n,"search_result")){yield{id:n.id,type:"non_standard",value:n};continue}if(sC(n,"tool_result")){yield{id:n.id,type:"non_standard",value:n};continue}{const e=gC(n);if(e){yield e;continue}}}yield{type:"non_standard",value:n}}}}())}const CC={translateContent:IC,translateContentChunk:IC};function AC(e){return"function"==typeof e?._getType&&"function"==typeof e.concat&&"ai"===e._getType()}function SC(e){return rC(e)?{type:e.type,mimeType:e.mime_type,url:e.url,metadata:e.metadata}:iC(e)?{type:e.type,mimeType:e.mime_type??"application/octet-stream",data:e.data,metadata:e.metadata}:nC(t=e)&&"id"===t.source_type&&"id"in t&&"string"==typeof t.id?{type:e.type,mimeType:e.mime_type,fileId:e.id,metadata:e.metadata}:e;var t}function bC(e){return e.map(SC)}function TC(e){return!(!sC(e,"image_url")||!cC(e.image_url))||(!(!sC(e,"input_audio")||!cC(e.input_audio))||!(!sC(e,"file")||!cC(e.file)))}function vC(e){if(sC(e,"image_url")&&cC(e.image_url)&&uC(e.image_url.url)){const t=oC({dataUrl:e.image_url.url});return t?{type:"image",mimeType:t.mime_type,data:t.data}:{type:"image",url:e.image_url.url}}if(sC(e,"input_audio")&&cC(e.input_audio)&&uC(e.input_audio.data)&&uC(e.input_audio.format))return{type:"audio",data:e.input_audio.data,mimeType:`audio/${e.input_audio.format}`};if(sC(e,"file")&&cC(e.file)&&uC(e.file.data)){const t=oC({dataUrl:e.file.data});if(t)return{type:"file",data:t.data,mimeType:t.mime_type};if(uC(e.file.file_id))return{type:"file",fileId:e.file.file_id}}return e}function _C(e){const t=[];for(const n of e)TC(n)?t.push(vC(n)):t.push(n);return t}function wC(e){if("url_citation"===e.type){const{url:t,title:n,start_index:r,end_index:i}=e;return{type:"citation",url:t,title:n,startIndex:r,endIndex:i}}if("file_citation"===e.type){const{file_id:t,filename:n,index:r}=e;return{type:"citation",title:n,startIndex:r,endIndex:r,fileId:t}}return e}function EC(e){return Array.from(function*(){cC(e.additional_kwargs?.reasoning)&&lC(e.additional_kwargs.reasoning.summary)&&(yield{type:"reasoning",reasoning:e.additional_kwargs.reasoning.summary.reduce((e,t)=>cC(t)&&uC(t.text)?`${e}${t.text}`:e,"")});const t="string"==typeof e.content?[{type:"text",text:e.content}]:e.content;for(const e of t)if(sC(e,"text")){const{text:t,annotations:n,phase:r,extras:i,...a}=e,o=cC(i)?{...i}:{};uC(r)&&(o.phase=r);const s=Object.keys(o).length>0?{extras:o}:{};Array.isArray(n)?yield{...a,...s,type:"text",text:String(t),annotations:n.map(wC)}:yield{...a,...s,type:"text",text:String(t)}}for(const n of e.tool_calls??[])yield{type:"tool_call",id:n.id,name:n.name,args:n.args};if(cC(e.additional_kwargs)&&lC(e.additional_kwargs.tool_outputs))for(const n of e.additional_kwargs.tool_outputs){if(sC(n,"web_search_call")){const e={};if(cC(n.action)&&uC(n.action.query)&&(e.query=n.action.query),yield{id:n.id,type:"server_tool_call",name:"web_search",args:e},"completed"===n.status||"failed"===n.status){const e={};cC(n.action)&&(e.action=n.action),yield{type:"server_tool_call_result",toolCallId:uC(n.id)?n.id:"",status:"completed"===n.status?"success":"error",output:e}}continue}if(sC(n,"file_search_call"))yield{id:n.id,type:"server_tool_call",name:"file_search",args:{queries:lC(n.queries)?n.queries:[]}},"completed"!==n.status&&"failed"!==n.status||(yield{type:"server_tool_call_result",toolCallId:uC(n.id)?n.id:"",status:"completed"===n.status?"success":"error",output:lC(n.results)?{results:n.results}:{}});else if(sC(n,"computer_call"))yield{type:"non_standard",value:n};else if(sC(n,"code_interpreter_call")){if(uC(n.code)&&(yield{id:n.id,type:"server_tool_call",name:"code_interpreter",args:{code:n.code}}),lC(n.outputs)){const e=fC(()=>{if("in_progress"!==n.status){if("completed"===n.status)return 0;if("incomplete"===n.status)return 127;if("interpreting"!==n.status)return"failed"===n.status?1:void 0}});for(const t of n.outputs)if(sC(t,"logs")){yield{type:"server_tool_call_result",toolCallId:n.id??"",status:"success",output:{type:"code_interpreter_output",returnCode:e??0,stderr:[0,void 0].includes(e)?void 0:String(t.logs),stdout:[0,void 0].includes(e)?String(t.logs):void 0}};continue}}}else if(sC(n,"mcp_call"))yield{id:n.id,type:"server_tool_call",name:"mcp_call",args:n.input};else if(sC(n,"mcp_list_tools"))yield{id:n.id,type:"server_tool_call",name:"mcp_list_tools",args:n.input};else if(sC(n,"mcp_approval_request"))yield{type:"non_standard",value:n};else{if(sC(n,"tool_search_call")){const e={};cC(n.arguments)&&Object.assign(e,n.arguments);const t={};uC(n.execution)&&(t.execution=n.execution),uC(n.status)&&(t.status=n.status),uC(n.call_id)&&(t.call_id=n.call_id),yield{id:uC(n.id)?n.id:"",type:"server_tool_call",name:"tool_search",args:e,...Object.keys(t).length>0?{extras:t}:{}};continue}if(sC(n,"tool_search_output")){const e={name:"tool_search"};uC(n.execution)&&(e.execution=n.execution),yield{type:"server_tool_call_result",toolCallId:uC(n.id)?n.id:"",status:"completed"===n.status?"success":"failed"===n.status?"error":"success",output:{tools:lC(n.tools)?n.tools:[]},extras:e};continue}sC(n,"image_generation_call")?(uC(n.result)&&(yield{type:"image",mimeType:"image/png",data:n.result,id:uC(n.id)?n.id:void 0,metadata:{status:uC(n.status)?n.status:void 0}}),yield{type:"non_standard",value:n}):cC(n)&&(yield{type:"non_standard",value:n})}}}())}const PC={translateContent:e=>"string"==typeof e.content?function(e){const t=[];"string"==typeof e.content?e.content.length>0&&t.push({type:"text",text:e.content}):t.push(..._C(e.content));for(const n of e.tool_calls??[])t.push({type:"tool_call",id:n.id,name:n.name,args:n.args});return t}(e):EC(e),translateContentChunk:e=>"string"==typeof e.content?function(e){const t=[];"string"==typeof e.content?e.content.length>0&&t.push({type:"text",text:e.content}):t.push(..._C(e.content));for(const n of e.tool_calls??[])t.push({type:"tool_call",id:n.id,name:n.name,args:n.args});return t}(e):function(e){return Array.from(function*(){yield*EC(e);for(const t of e.tool_call_chunks??[])yield{type:"tool_call_chunk",id:t.id,name:t.name,args:t.args}}())}(e)};function RC(e,t="pretty"){return"pretty"===t?function(e){const t=[],n=` ${e.type.charAt(0).toUpperCase()+e.type.slice(1)} Message `,r=Math.floor((80-n.length)/2),i="=".repeat(r),a=n.length%2==0?i:`${i}=`;if(t.push(`${i}${n}${a}`),"ai"===e.type){const n=e;if(n.tool_calls&&n.tool_calls.length>0){t.push("Tool Calls:");for(const e of n.tool_calls){t.push(` ${e.name} (${e.id})`),t.push(` Call ID: ${e.id}`),t.push(" Args:");for(const[n,r]of Object.entries(e.args))t.push(` ${n}: ${"object"==typeof r?JSON.stringify(r):r}`)}}}if("tool"===e.type){const n=e;n.name&&t.push(`Name: ${n.name}`)}"string"==typeof e.content&&e.content.trim()&&(t.length>1&&t.push(""),t.push(e.content));return t.join("\n")}(e):JSON.stringify(e)}const LC=Symbol.for("langchain.message");function NC(e){return Array.isArray(e)?e:"string"==typeof e?""===e?[]:[{type:"text",text:e}]:null==e?[]:[e]}function OC(e,t){if("string"==typeof e)return""===e?t:"string"==typeof t?e+t:Array.isArray(t)&&0===t.length?e:Array.isArray(t)&&t.some(e=>nC(e))?[{type:"text",source_type:"text",text:e},...t]:[{type:"text",text:e},...t];if(Array.isArray(t)){const n=NC(e);return HC(n,t)??[...n,...t]}return""===t?e:Array.isArray(e)&&e.some(e=>nC(e))?[...e,{type:"file",source_type:"text",text:t}]:[...NC(e),{type:"text",text:t}]}var BC=class extends tC{lc_namespace=["langchain_core","messages"];lc_serializable=!0;get lc_aliases(){return{additional_kwargs:"additional_kwargs",response_metadata:"response_metadata"}}[LC]=!0;id;name;content;additional_kwargs;response_metadata;_getType(){return this.type}getType(){return this._getType()}constructor(e){const t="string"==typeof e||Array.isArray(e)?{content:e}:e;t.additional_kwargs||(t.additional_kwargs={}),t.response_metadata||(t.response_metadata={}),super(t),this.name=t.name,void 0===t.content&&void 0!==t.contentBlocks?(this.content=t.contentBlocks,this.response_metadata={output_version:"v1",...t.response_metadata}):void 0!==t.content?(this.content=t.content??[],this.response_metadata=t.response_metadata):(this.content=[],this.response_metadata=t.response_metadata),this.additional_kwargs=t.additional_kwargs,this.id=t.id}get text(){return this.contentBlocks.filter(e=>"text"===e.type).reduce((e,t)=>e+(t.text??""),"")}get contentBlocks(){const e="string"==typeof this.content?[{type:"text",text:this.content}]:this.content;return[bC,_C,yC].reduce((e,t)=>t(e),e)}toDict(){return{type:this.getType(),data:this.toJSON().kwargs}}static lc_name(){return"BaseMessage"}get _printableFields(){return{id:this.id,content:this.content,name:this.name,additional_kwargs:this.additional_kwargs,response_metadata:this.response_metadata}}static isInstance(e){return"object"==typeof e&&null!==e&&LC in e&&!0===e[LC]&&("object"==typeof(t=e)&&null!==t&&"type"in t&&"content"in t&&("string"==typeof t.content||Array.isArray(t.content)));var t}static[Symbol.hasInstance](e){return this.isInstance(e)}_updateId(e){this.id=e,this.lc_kwargs.id=e}get[Symbol.toStringTag](){return this.constructor.lc_name()}[Symbol.for("nodejs.util.inspect.custom")](e){if(null===e)return this;const t=(n=this._printableFields,r=Math.max(4,e),JSON.stringify(function e(t,n){if("object"!=typeof t||null==t)return t;if(n>=r)return Array.isArray(t)?"[Array]":"[Object]";if(Array.isArray(t))return t.map(t=>e(t,n+1));const i={};for(const r of Object.keys(t))i[r]=e(t[r],n+1);return i}(n,0),null,2));var n,r;return`${this.constructor.lc_name()} ${t}`}toFormattedString(e="pretty"){return RC(this,e)}};const MC=["index","created","timestamp"];function DC(e,t,n){const r=MC;if(null==e&&null==t)return;if(null==e||null==t)return e??t;const i={...e};for(const[a,o]of Object.entries(t))if(null==i[a])i[a]=o;else{if(null==o)continue;if(typeof i[a]!=typeof o||Array.isArray(i[a])!==Array.isArray(o))throw new Error(`field[${a}] already exists in the message chunk, but with a different type.`);if("string"==typeof i[a]){if("type"===a)continue;if(["id","name","output_version","model_provider"].includes(a))o&&(i[a]=o);else{if(r.includes(a))continue;i[a]+=o}}else if("number"==typeof i[a]){if(r.includes(a))continue;i[a]=i[a]+o}else if("object"!=typeof i[a]||Array.isArray(i[a]))if(Array.isArray(i[a]))i[a]=HC(i[a],o);else{if(i[a]===o)continue;console.warn(`field[${a}] already exists in this message chunk and value has unsupported type.`)}else i[a]=DC(i[a],o)}return i}function FC(e){return"object"==typeof e&&null!==e&&("index"in e&&("number"==typeof(t=e.index)||"string"==typeof t));var t}function kC(e){if("object"!=typeof e||null===e)return!1;if(!("id"in e))return!1;const t=e.id;return null!=t&&""!==t}function GC(e){return e.endsWith("_delta")?e.slice(0,-6):e}function xC(e,t){const n=FC(t),r=kC(t);return n||r?e.findIndex(e=>{const i=FC(e),a=kC(e);return n&&i?e.index===t.index&&(s=t,("object"!=typeof(o=e)||null===o||"object"!=typeof s||null===s||!("type"in o)||!("type"in s)||"string"!=typeof o.type||"string"!=typeof s.type||GC(o.type)===GC(s.type))&&(!a||!r||e.id===t.id)):!(n||i||!r||!a)&&e.id===t.id;var o,s}):-1}function HC(e,t,n){if(null!=e||null!=t){if(null==e||null==t)return e||t;{const n=[...e];for(const e of t){const t=xC(n,e);if(-1!==t)n[t]=DC(n[t],e);else{if("object"==typeof e&&null!==e&&"text"in e&&""===e.text)continue;n.push(e)}}return n}}}function UC(e,t,n){if(null!=e||null!=t){if(null==e||null==t)return e??t;if(typeof e!=typeof t)throw new Error(`Cannot merge objects of different types.\nLeft ${typeof e}\nRight ${typeof t}`);if("string"==typeof e&&"string"==typeof t)return e+t;if(Array.isArray(e)&&Array.isArray(t))return HC(e,t);if("object"==typeof e&&"object"==typeof t)return DC(e,t);if(e===t)return e;throw new Error(`Can not merge objects of different types.\nLeft ${e}\nRight ${t}`)}}var VC=class e extends BC{static isInstance(t){if(!super.isInstance(t))return!1;let n=Object.getPrototypeOf(t);for(;null!==n;){if(n===e.prototype)return!0;n=Object.getPrototypeOf(n)}return!1}static[Symbol.hasInstance](e){return this.isInstance(e)}};function $C(e){return"function"==typeof e?._getType}function jC(e){return VC.isInstance(e)}function WC(e){switch(e){case"csv":return"text/csv";case"doc":case"docx":return"application/vnd.openxmlformats-officedocument.wordprocessingml.document";case"html":return"text/html";case"md":return"text/markdown";case"pdf":return"application/pdf";case"txt":return"text/plain";case"xls":return"application/vnd.ms-excel";case"xlsx":return"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";case"gif":return"image/gif";case"jpeg":case"jpg":return"image/jpeg";case"png":return"image/png";case"webp":return"image/webp";case"flv":return"video/flv";case"mkv":return"video/mkv";case"mov":return"video/mov";case"mp4":return"video/mp4";case"mpeg":return"video/mpeg";case"mpg":return"video/mpg";case"three_gp":return"video/three_gp";case"webm":return"video/webm";case"wmv":return"video/wmv";default:return"application/octet-stream"}}function XC(e){if(cC(e.document)&&cC(e.document.source)){const t=WC(cC(e.document)&&uC(e.document.format)?e.document.format:"");if(cC(e.document.source)){if(cC(e.document.source.s3Location)&&uC(e.document.source.s3Location.uri))return{type:"file",mimeType:t,fileId:e.document.source.s3Location.uri};if(pC(e.document.source.bytes))return{type:"file",mimeType:t,data:e.document.source.bytes};if(uC(e.document.source.text))return{type:"file",mimeType:t,data:Buffer.from(e.document.source.text).toString("base64")};if(lC(e.document.source.content))return{type:"file",mimeType:t,data:e.document.source.content.reduce((e,t)=>cC(t)&&uC(t.text)?e+t.text:e,"")}}}return{type:"non_standard",value:e}}function KC(e){if(sC(e,"image")&&cC(e.image)){const t=WC(cC(e.image)&&uC(e.image.format)?e.image.format:"");if(cC(e.image.source)){if(cC(e.image.source.s3Location)&&uC(e.image.source.s3Location.uri))return{type:"image",mimeType:t,fileId:e.image.source.s3Location.uri};if(pC(e.image.source.bytes))return{type:"image",mimeType:t,data:e.image.source.bytes}}}return{type:"non_standard",value:e}}function YC(e){if(sC(e,"video")&&cC(e.video)){const t=WC(cC(e.video)&&uC(e.video.format)?e.video.format:"");if(cC(e.video.source)){if(cC(e.video.source.s3Location)&&uC(e.video.source.s3Location.uri))return{type:"video",mimeType:t,fileId:e.video.source.s3Location.uri};if(pC(e.video.source.bytes))return{type:"video",mimeType:t,data:e.video.source.bytes}}}return{type:"non_standard",value:e}}function qC(e){return Array.from(function*(){const t="string"==typeof e.content?[{type:"text",text:e.content}]:e.content;for(const e of t)sC(e,"reasoning")&&uC(e.reasoning)?yield{...e,type:"reasoning",reasoning:e.reasoning}:sC(e,"cache_point")?yield{type:"non_standard",value:e}:sC(e,"citations_content")&&cC(e.citationsContent)?yield{type:"text",text:lC(e.citationsContent.content)?e.citationsContent.content.reduce((e,t)=>cC(t)&&uC(t.text)?e+t.text:e,""):"",annotations:lC(e.citationsContent.citations)?e.citationsContent.citations.reduce((e,t)=>{if(cC(t)){const n=lC(t.sourceContent)?t.sourceContent.reduce((e,t)=>cC(t)&&uC(t.text)?e+t.text:e,""):"",r=fC(()=>{if(cC(t.location)){const e=t.location.documentChar||t.location.documentPage||t.location.documentChunk;if(cC(e))return{source:dC(e.documentIndex)?e.documentIndex.toString():void 0,startIndex:dC(e.start)?e.start:void 0,endIndex:dC(e.end)?e.end:void 0}}return{}});e.push({type:"citation",citedText:n,...r})}return e},[]):[]}:sC(e,"document")&&cC(e.document)?yield XC(e):sC(e,"guard_content")?yield{type:"non_standard",value:e}:sC(e,"image")&&cC(e.image)?yield KC(e):sC(e,"reasoning_content")&&cC(e.reasoningText)&&uC(e.reasoningText.text)?yield{type:"reasoning",reasoning:e.reasoningText.text,...uC(e.reasoningText.signature)?{signature:e.reasoningText.signature}:{}}:sC(e,"reasoning_content")&&uC(e.reasoningText)?yield{type:"reasoning",reasoning:e.reasoningText}:sC(e,"text")&&uC(e.text)?yield{type:"text",text:e.text}:sC(e,"tool_result")?yield{type:"non_standard",value:e}:sC(e,"tool_call")||(sC(e,"video")&&cC(e.video)?yield YC(e):yield{type:"non_standard",value:e})}())}const QC={translateContent:qC,translateContentChunk:qC};function JC(e){const t=[],n=e.additional_kwargs?.reasoning_content;if(uC(n)&&n.length>0&&t.push({type:"reasoning",reasoning:n}),"string"==typeof e.content)e.content.length>0&&t.push({type:"text",text:e.content});else for(const r of e.content)"object"==typeof r&&"type"in r&&"text"===r.type&&"text"in r&&uC(r.text)&&t.push({type:"text",text:r.text});for(const r of e.tool_calls??[])t.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return t}const zC={translateContent:JC,translateContentChunk:JC};function ZC(e){return Array.from(function*(){const t="string"==typeof e.content?[{type:"text",text:e.content}]:e.content;for(const n of t)sC(n,"text")&&uC(n.text)?yield{type:"text",text:n.text}:sC(n,"thinking")&&uC(n.thinking)?yield{type:"reasoning",reasoning:n.thinking,...n.signature?{signature:n.signature}:{}}:sC(n,"inlineData")&&cC(n.inlineData)&&uC(n.inlineData.mimeType)&&uC(n.inlineData.data)?yield{type:"file",mimeType:n.inlineData.mimeType,data:n.inlineData.data}:sC(n,"functionCall")&&cC(n.functionCall)&&uC(n.functionCall.name)&&cC(n.functionCall.args)?yield{type:"tool_call",id:e.id,name:n.functionCall.name,args:n.functionCall.args}:sC(n,"functionResponse")?yield{type:"non_standard",value:n}:sC(n,"fileData")&&cC(n.fileData)&&uC(n.fileData.mimeType)&&uC(n.fileData.fileUri)?yield{type:"file",mimeType:n.fileData.mimeType,fileId:n.fileData.fileUri}:(sC(n,"executableCode")||sC(n,"codeExecutionResult"),yield{type:"non_standard",value:n})}())}const eA={translateContent:ZC,translateContentChunk:ZC};function tA(e){return Array.from(function*(){const t="string"==typeof e.content?[{type:"text",text:e.content}]:e.content;for(const n of t){if(sC(n,"reasoning")&&uC(n.reasoning)){const r=fC(()=>{const r=t.indexOf(n);if(lC(e.additional_kwargs?.signatures)&&r>=0)return e.additional_kwargs.signatures.at(r)});uC(r)?yield{type:"reasoning",reasoning:n.reasoning,signature:r}:yield{type:"reasoning",reasoning:n.reasoning};continue}if(sC(n,"thinking")&&uC(n.thinking))yield{type:"reasoning",reasoning:n.thinking,...n.signature?{signature:n.signature}:{}};else if(sC(n,"text")&&uC(n.text)){if(""===n.text)continue;yield{type:"text",text:n.text}}else if(sC(n,"image_url")){if(uC(n.image_url))if(n.image_url.startsWith("data:")){const e=n.image_url.match(/^data:([^;]+);base64,(.+)$/);e?yield{type:"image",data:e[2],mimeType:e[1]}:yield{type:"image",url:n.image_url}}else yield{type:"image",url:n.image_url}}else sC(n,"media")&&uC(n.mimeType)&&uC(n.data)?yield{type:"file",mimeType:n.mimeType,data:n.data}:yield{type:"non_standard",value:n}}for(const n of e.tool_calls??[])yield{type:"tool_call",id:n.id,name:n.name,args:n.args}}())}const nA={translateContent:tA,translateContentChunk:tA};function rA(e){const t=[],n=e.additional_kwargs?.reasoning;if(uC(n)&&n.length>0&&t.push({type:"reasoning",reasoning:n}),"string"==typeof e.content){let n=e.content;const r=n.match(/<think>([\s\S]*?)<\/think>/);if(r){const e=r[1].trim();e.length>0&&t.push({type:"reasoning",reasoning:e}),n=n.replace(/<think>[\s\S]*?<\/think>/,"").trim()}n.length>0&&t.push({type:"text",text:n})}else for(const r of e.content)if("object"==typeof r&&"type"in r&&"text"===r.type&&"text"in r&&uC(r.text)){let e=r.text;const n=e.match(/<think>([\s\S]*?)<\/think>/);if(n){const r=n[1].trim();r.length>0&&t.push({type:"reasoning",reasoning:r}),e=e.replace(/<think>[\s\S]*?<\/think>/,"").trim()}e.length>0&&t.push({type:"text",text:e})}for(const r of e.tool_calls??[])t.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return t}const iA={translateContent:rA,translateContentChunk:rA};function aA(e){const t=[],n=e.additional_kwargs?.reasoning_content;if(uC(n)&&n.length>0&&t.push({type:"reasoning",reasoning:n}),"string"==typeof e.content)e.content.length>0&&t.push({type:"text",text:e.content});else for(const r of e.content)"object"==typeof r&&"type"in r&&"text"===r.type&&"text"in r&&uC(r.text)&&t.push({type:"text",text:r.text});for(const r of e.tool_calls??[])t.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return t}const oA={translateContent:aA,translateContentChunk:aA};function sA(e){const t=[],n=e.additional_kwargs?.reasoning_details;let r=!1;if(Array.isArray(n)&&n.length>0)for(const i of n){if(null==i||"object"!=typeof i)continue;const e=i.type;if("reasoning.summary"===e){const e=i.summary;uC(e)&&e.length>0&&(t.push({type:"reasoning",reasoning:e}),r=!0)}else if("reasoning.text"===e){const e=i.text;uC(e)&&e.length>0&&(t.push({type:"reasoning",reasoning:e}),r=!0)}}if(!r){const n=e.additional_kwargs?.reasoning_content;uC(n)&&n.length>0&&t.push({type:"reasoning",reasoning:n})}if("string"==typeof e.content)e.content.length>0&&t.push({type:"text",text:e.content});else for(const i of e.content)"object"==typeof i&&"type"in i&&"text"===i.type&&"text"in i&&uC(i.text)&&t.push({type:"text",text:i.text});for(const i of e.tool_calls??[])t.push({type:"tool_call",id:i.id,name:i.name,args:i.args});return t}const cA={translateContent:sA,translateContentChunk:sA};function lA(e){const t=[];if(cC(e.additional_kwargs?.reasoning)){const n=e.additional_kwargs.reasoning;if(lC(n.summary)){const e=n.summary.reduce((e,t)=>cC(t)&&uC(t.text)?`${e}${t.text}`:e,"");e.length>0&&t.push({type:"reasoning",reasoning:e})}}const n=e.additional_kwargs?.reasoning_content;if(uC(n)&&n.length>0&&t.push({type:"reasoning",reasoning:n}),"string"==typeof e.content)e.content.length>0&&t.push({type:"text",text:e.content});else for(const r of e.content)"object"==typeof r&&"type"in r&&"text"===r.type&&"text"in r&&uC(r.text)&&t.push({type:"text",text:r.text});for(const r of e.tool_calls??[])t.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return t}const uA={translateContent:lA,translateContentChunk:lA};function dA(e){return Array.from(function*(){const t=fC(()=>{if("string"==typeof e.content)return e.additional_kwargs.originalTextContentBlock?[{...e.additional_kwargs.originalTextContentBlock,type:"text"}]:[{type:"text",text:e.content}];{const t=e.additional_kwargs?.originalTextContentBlock;if(t?.thoughtSignature&&!e.content.some(e=>"thoughtSignature"in e)){const n=[...e.content];for(let e=n.length-1;e>=0;e--){const r=n[e];if("text"===r.type&&!r.thought)return r.thoughtSignature=t.thoughtSignature,n}}return e.content}});for(const n of t){const t=fC(()=>sC(n,"text")&&uC(n.text)?{type:"text",text:n.text}:sC(n,"inlineData")&&cC(n.inlineData)&&uC(n.inlineData.mimeType)&&uC(n.inlineData.data)?{type:"file",mimeType:n.inlineData.mimeType,data:n.inlineData.data}:sC(n,"functionCall")&&cC(n.functionCall)&&uC(n.functionCall.name)&&cC(n.functionCall.args)?{type:"tool_call",id:e.id,name:n.functionCall.name,args:n.functionCall.args}:sC(n,"functionResponse")?{type:"non_standard",value:n}:sC(n,"fileData")&&cC(n.fileData)&&uC(n.fileData.mimeType)&&uC(n.fileData.fileUri)?{type:"file",mimeType:n.fileData.mimeType,fileId:n.fileData.fileUri}:(sC(n,"executableCode")||sC(n,"codeExecutionResult"),{type:"non_standard",value:n})),r=fC(()=>"thought"in n&&n.thought?{type:"reasoning",reasoning:"text"===t.type?t.text:"",reasoningContentBlock:t}:t),i={thought:n.thought,thoughtSignature:n.thoughtSignature,partMetadata:n.partMetadata,...r};for(const e in i)void 0===i[e]&&delete i[e];yield i}}())}const pA={translateContent:dA,translateContentChunk:dA};function hA(e){return globalThis.lc_block_translators_registry.get(e)}function fA(e,t){const n={};return void 0===e?.audio&&void 0===t?.audio||(n.audio=(e?.audio??0)+(t?.audio??0)),void 0===e?.image&&void 0===t?.image||(n.image=(e?.image??0)+(t?.image??0)),void 0===e?.video&&void 0===t?.video||(n.video=(e?.video??0)+(t?.video??0)),void 0===e?.document&&void 0===t?.document||(n.document=(e?.document??0)+(t?.document??0)),void 0===e?.text&&void 0===t?.text||(n.text=(e?.text??0)+(t?.text??0)),n}function mA(e,t){const n={...fA(e,t)};return void 0===e?.cache_read&&void 0===t?.cache_read||(n.cache_read=(e?.cache_read??0)+(t?.cache_read??0)),void 0===e?.cache_creation&&void 0===t?.cache_creation||(n.cache_creation=(e?.cache_creation??0)+(t?.cache_creation??0)),n}function gA(e,t){const n={...fA(e,t)};return void 0===e?.reasoning&&void 0===t?.reasoning||(n.reasoning=(e?.reasoning??0)+(t?.reasoning??0)),n}function yA(e,t){return{input_tokens:(e?.input_tokens??0)+(t?.input_tokens??0),output_tokens:(e?.output_tokens??0)+(t?.output_tokens??0),total_tokens:(e?.total_tokens??0)+(t?.total_tokens??0),input_token_details:mA(e?.input_token_details,t?.input_token_details),output_token_details:gA(e?.output_token_details,t?.output_token_details)}}globalThis.lc_block_translators_registry??=new Map([["anthropic",CC],["bedrock-converse",QC],["deepseek",zC],["google",pA],["google-genai",eA],["google-vertexai",nA],["groq",iA],["ollama",oA],["openai",PC],["openrouter",cA],["xai",uA]]);var IA=class extends BC{static lc_name(){return"ToolMessage"}get lc_aliases(){return{tool_call_id:"tool_call_id"}}lc_direct_tool_output=!0;type="tool";status;tool_call_id;metadata;artifact;constructor(e,t,n){const r="string"==typeof e||Array.isArray(e)?{content:e,name:n,tool_call_id:t}:e;super(r),this.tool_call_id=r.tool_call_id,this.artifact=r.artifact,this.status=r.status,this.metadata=r.metadata}static isInstance(e){return super.isInstance(e)&&"tool"===e.type}static[Symbol.hasInstance](e){return this.isInstance(e)}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}},CA=class extends VC{type="tool";tool_call_id;status;artifact;constructor(e){super(e),this.tool_call_id=e.tool_call_id,this.artifact=e.artifact,this.status=e.status}static lc_name(){return"ToolMessageChunk"}concat(e){return new(0,this.constructor)({content:OC(this.content,e.content),additional_kwargs:DC(this.additional_kwargs,e.additional_kwargs),response_metadata:DC(this.response_metadata,e.response_metadata),artifact:UC(this.artifact,e.artifact),tool_call_id:this.tool_call_id,id:this.id??e.id,status:(t=this.status,n=e.status,"error"===t||"error"===n?"error":"success")});var t,n}static isInstance(e){return super.isInstance(e)&&"tool"===e.type}static[Symbol.hasInstance](e){return this.isInstance(e)}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}};const AA=function e(t){const n=Symbol.for(t);return{brand(e,r){const i=r?Symbol.for(`${t}.${r}`):n;class a extends e{[i]=!0;constructor(...e){super(...e)}static isInstance(e){return"object"==typeof e&&null!==e&&i in e&&!0===e[i]}static[Symbol.hasInstance](e){return this.isInstance(e)}}return Object.defineProperty(a,"name",{value:e.name}),a},sub:n=>e(`${t}.${n}`),isInstance:e=>"object"==typeof e&&null!==e&&n in e&&!0===e[n]}}("langchain");function SA(e,t){return e.lc_error_code=t,e.message=`${e.message}\n\nTroubleshooting URL: https://docs.langchain.com/oss/javascript/langchain/errors/${t}/\n`,e}const bA=AA.sub("error"),TA=Symbol.for("langchain.errors.retryable");function vA(e,t){if("object"!=typeof e||null===e)return e;try{Object.defineProperty(e,TA,{value:t,configurable:!0})}catch{}return e}var _A=class extends(bA.brand(Error)){name="LangChainError";constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},wA=class extends(bA.brand(_A,"model-abort")){name="ModelAbortError";partialOutput;constructor(e,t){super(e),this.partialOutput=t,vA(this,!1)}};function EA(e){return!(!e||"object"!=typeof e||!("type"in e)||"tool_call"!==e.type)}bA.brand(_A,"context-overflow");var PA=class extends Error{output;constructor(e,t){super(e),this.output=t}};function RA(e,t=NA){const n=(e=e.trim()).indexOf("```");if(-1===n)return t(e);let r=e.substring(n+3);r.startsWith("json\n")?r=r.substring(5):r.startsWith("json")?r=r.substring(4):r.startsWith("\n")&&(r=r.substring(1));const i=r.indexOf("```");let a=r;return-1!==i&&(a=r.substring(0,i)),t(a.trim())}function LA(e){try{return JSON.parse(e)}catch{}const t=e.trim();if(0===t.length)throw new Error("Unexpected end of JSON input");let n=0;function r(){for(;n<t.length&&/\s/.test(t[n]);)n+=1}function i(){if('"'!==t[n])throw new Error(`Expected '"' at position ${n}, got '${t[n]}'`);n+=1;let e="",r=!1;for(;n<t.length;){const i=t[n];if(r){if("n"===i)e+="\n";else if("t"===i)e+="\t";else if("r"===i)e+="\r";else if("\\"===i)e+="\\";else if('"'===i)e+='"';else if("b"===i)e+="\b";else if("f"===i)e+="\f";else if("/"===i)e+="/";else{if("u"!==i)throw new Error(`Invalid escape sequence '\\${i}' at position ${n}`);{const r=t.substring(n+1,n+5);if(!/^[0-9A-Fa-f]{0,4}$/.test(r))throw new Error(`Invalid unicode escape sequence '\\u${r}' at position ${n}`);4===r.length?e+=String.fromCharCode(Number.parseInt(r,16)):e+=`u${r}`,n+=r.length}}r=!1}else if("\\"===i)r=!0;else{if('"'===i)return n+=1,e;e+=i}n+=1}return r&&(e+="\\"),e}function a(){if(r(),n>=t.length)throw new Error(`Unexpected end of input at position ${n}`);const e=t[n];if("{"===e)return function(){if("{"!==t[n])throw new Error(`Expected '{' at position ${n}, got '${t[n]}'`);const e={};if(n+=1,r(),n>=t.length)return e;if("}"===t[n])return n+=1,e;for(;n<t.length;){if(r(),n>=t.length)return e;const o=i();if(r(),n>=t.length)return e;if(":"!==t[n])throw new Error(`Expected ':' at position ${n}, got '${t[n]}'`);if(n+=1,r(),n>=t.length)return e;if(e[o]=a(),r(),n>=t.length)return e;if("}"===t[n])return n+=1,e;if(","!==t[n])throw new Error(`Expected ',' or '}' at position ${n}, got '${t[n]}'`);n+=1}return e}();if("["===e)return function(){if("["!==t[n])throw new Error(`Expected '[' at position ${n}, got '${t[n]}'`);const e=[];if(n+=1,r(),n>=t.length)return e;if("]"===t[n])return n+=1,e;for(;n<t.length;){if(r(),n>=t.length)return e;if(e.push(a()),r(),n>=t.length)return e;if("]"===t[n])return n+=1,e;if(","!==t[n])throw new Error(`Expected ',' or ']' at position ${n}, got '${t[n]}'`);n+=1}return e}();if('"'===e)return i();if("null".startsWith(t.substring(n,n+4)))return n+=Math.min(4,t.length-n),null;if("true".startsWith(t.substring(n,n+4)))return n+=Math.min(4,t.length-n),!0;if("false".startsWith(t.substring(n,n+5)))return n+=Math.min(5,t.length-n),!1;if("-"===e||e>="0"&&e<="9")return function(){const e=n;let r="";if("-"===t[n]&&(r+="-",n+=1),n<t.length&&"0"===t[n]&&(r+="0",n+=1,t[n]>="0"&&t[n]<="9"))throw new Error(`Invalid number at position ${e}`);if(n<t.length&&t[n]>="1"&&t[n]<="9")for(;n<t.length&&t[n]>="0"&&t[n]<="9";)r+=t[n],n+=1;if(n<t.length&&"."===t[n])for(r+=".",n+=1;n<t.length&&t[n]>="0"&&t[n]<="9";)r+=t[n],n+=1;if(n<t.length&&("e"===t[n]||"E"===t[n]))for(r+=t[n],n+=1,n<t.length&&("+"===t[n]||"-"===t[n])&&(r+=t[n],n+=1);n<t.length&&t[n]>="0"&&t[n]<="9";)r+=t[n],n+=1;if("-"===r)return-0;const i=Number.parseFloat(r);if(Number.isNaN(i))throw n=e,new Error(`Invalid number '${r}' at position ${e}`);return i}();throw new Error(`Unexpected character '${e}' at position ${n}`)}const o=a();if(r(),n<t.length)throw new Error(`Unexpected character '${t[n]}' at position ${n}`);return o}function NA(e){try{return void 0===e?null:LA(e)}catch{return null}}var OA=class e extends BC{static lc_name(){return"ChatMessage"}type="generic";role;static _chatMessageClass(){return e}constructor(e,t){("string"==typeof e||Array.isArray(e))&&(e={content:e,role:t}),super(e),this.role=e.role}static isInstance(e){return super.isInstance(e)&&"generic"===e.type}static[Symbol.hasInstance](e){return this.isInstance(e)}get _printableFields(){return{...super._printableFields,role:this.role}}},BA=class extends VC{static lc_name(){return"ChatMessageChunk"}type="generic";role;constructor(e,t){("string"==typeof e||Array.isArray(e))&&(e={content:e,role:t}),super(e),this.role=e.role}concat(e){return new(0,this.constructor)({content:OC(this.content,e.content),additional_kwargs:DC(this.additional_kwargs,e.additional_kwargs),response_metadata:DC(this.response_metadata,e.response_metadata),role:this.role,id:this.id??e.id})}static isInstance(e){return super.isInstance(e)&&"generic"===e.type}static[Symbol.hasInstance](e){return this.isInstance(e)}get _printableFields(){return{...super._printableFields,role:this.role}}},MA=class extends VC{static lc_name(){return"FunctionMessageChunk"}type="function";concat(e){return new(0,this.constructor)({content:OC(this.content,e.content),additional_kwargs:DC(this.additional_kwargs,e.additional_kwargs),response_metadata:DC(this.response_metadata,e.response_metadata),name:this.name??"",id:this.id??e.id})}static isInstance(e){return super.isInstance(e)&&"function"===e.type}static[Symbol.hasInstance](e){return this.isInstance(e)}},DA=class extends BC{static lc_name(){return"HumanMessage"}type="human";constructor(e){super(e)}static isInstance(e){return super.isInstance(e)&&"human"===e.type}static[Symbol.hasInstance](e){return this.isInstance(e)}},FA=class extends VC{static lc_name(){return"HumanMessageChunk"}type="human";constructor(e){super(e)}concat(e){return new(0,this.constructor)({content:OC(this.content,e.content),additional_kwargs:DC(this.additional_kwargs,e.additional_kwargs),response_metadata:DC(this.response_metadata,e.response_metadata),id:this.id??e.id})}static isInstance(e){return super.isInstance(e)&&"human"===e.type}static[Symbol.hasInstance](e){return this.isInstance(e)}},kA=class extends BC{type="remove";id;constructor(e){super({...e,content:[]}),this.id=e.id}get _printableFields(){return{...super._printableFields,id:this.id}}static isInstance(e){return super.isInstance(e)&&"remove"===e.type}static[Symbol.hasInstance](e){return this.isInstance(e)}},GA=class e extends BC{static lc_name(){return"SystemMessage"}type="system";constructor(e){super(e)}concat(t){if("string"==typeof t)return new e({content:OC(this.content,t),additional_kwargs:this.additional_kwargs,response_metadata:this.response_metadata,id:this.id,name:this.name});if(e.isInstance(t))return new e({content:OC(this.content,t.content),additional_kwargs:{...this.additional_kwargs,...t.additional_kwargs},response_metadata:{...this.response_metadata,...t.response_metadata},id:this.id??t.id,name:this.name??t.name});throw new Error("Unexpected chunk type for system message")}static isInstance(e){return super.isInstance(e)&&"system"===e.type}static[Symbol.hasInstance](e){return this.isInstance(e)}},xA=class extends VC{static lc_name(){return"SystemMessageChunk"}type="system";constructor(e){super(e)}concat(e){return new(0,this.constructor)({content:OC(this.content,e.content),additional_kwargs:DC(this.additional_kwargs,e.additional_kwargs),response_metadata:DC(this.response_metadata,e.response_metadata),id:this.id??e.id})}static isInstance(e){return super.isInstance(e)&&"system"===e.type}static[Symbol.hasInstance](e){return this.isInstance(e)}};function HA(e){return!0===e.isCustomTool}function UA(e){return EA(e)?e:"string"==typeof e.id&&"function"===e.type&&"object"==typeof e.function&&null!==e.function&&"arguments"in e.function&&"string"==typeof e.function.arguments&&"name"in e.function&&"string"==typeof e.function.name?{id:e.id,args:JSON.parse(e.function.arguments),name:e.function.name,type:"tool_call"}:e}function VA(e){let t,n;if("object"==typeof(r=e)&&null!=r&&1===r.lc&&Array.isArray(r.id)&&null!=r.kwargs&&"object"==typeof r.kwargs){const r=e.id.at(-1);t="HumanMessage"===r||"HumanMessageChunk"===r?"user":"AIMessage"===r||"AIMessageChunk"===r?"assistant":"SystemMessage"===r||"SystemMessageChunk"===r?"system":"FunctionMessage"===r||"FunctionMessageChunk"===r?"function":"ToolMessage"===r||"ToolMessageChunk"===r?"tool":"unknown",n=e.kwargs}else{const{type:r,...i}=e;t=r,n=i}var r;if("human"===t||"user"===t)return new DA(n);if("ai"===t||"assistant"===t){const{tool_calls:e,...t}=n;if(!Array.isArray(e))return new YA(n);const r=e.map(UA);return new YA({...t,tool_calls:r})}if("system"===t)return new GA(n);if("developer"===t)return new GA({...n,additional_kwargs:{...n.additional_kwargs,__openai_role__:"developer"}});if("tool"===t&&"tool_call_id"in n)return new IA({...n,content:n.content,tool_call_id:n.tool_call_id,name:n.name});if("remove"===t&&"id"in n&&"string"==typeof n.id)return new kA({...n,id:n.id});throw SA(new Error(`Unable to coerce message from array: only human, AI, system, developer, or tool message coercion is currently supported.\n\nReceived: ${JSON.stringify(e,null,2)}`),"MESSAGE_COERCION_FAILURE")}function $A(e){if("string"==typeof e)return new DA(e);if($C(e))return e;if(Array.isArray(e)){const[t,n]=e;return VA({type:t,content:n})}if("string"==typeof e.role){const{role:t,...n}=e;return VA({...n,type:t})}return VA(e)}function jA(e){if("string"==typeof e)return e;switch(e.type){case"text":return e.text??"";case"text-plain":return e.text??"[text-plain file]";case"image":case"image_url":return"[image]";case"audio":case"input_audio":return"[audio]";case"video":return"[video]";case"file":return"[file]";case"reasoning":case"tool_call":case"tool_call_chunk":case"invalid_tool_call":case"server_tool_call":case"server_tool_call_chunk":case"server_tool_call_result":case"non_standard":return"";default:return e.type?`[${e.type}]`:""}}function WA(e,t="Human",n="AI"){const r=[];for(const i of e){let e;if("human"===i.type)e=t;else if("ai"===i.type)e=n;else if("system"===i.type)e="System";else if("tool"===i.type)e="Tool";else{if("generic"!==i.type)throw new Error(`Got unsupported message type: ${i.type}`);e=i.role}let a=`${e}: ${i.name?`${i.name}, `:""}${"string"==typeof i.content?i.content:Array.isArray(i.content)?i.content.map(jA).filter(Boolean).join(""):""}`;if("ai"===i.type){const e=i;e.tool_calls&&e.tool_calls.length>0?a+=JSON.stringify(e.tool_calls):e.additional_kwargs&&"function_call"in e.additional_kwargs&&(a+=JSON.stringify(e.additional_kwargs.function_call))}r.push(a)}return r.join("\n")}function XA(e){const t=e._getType();if("human"===t)return new FA({...e});if("ai"===t){let t={...e};return"tool_calls"in t&&(t={...t,tool_call_chunks:t.tool_calls?.map(e=>({...e,type:"tool_call_chunk",index:void 0,args:JSON.stringify(e.args)}))}),new JA({...t})}if("system"===t)return new xA({...e});if("function"===t)return new MA({...e});if(OA.isInstance(e))return new BA({...e});throw new Error("Unknown message type.")}function KA(e){return"string"==typeof e?e.length>0?[{type:"text",text:e}]:[]:Array.isArray(e)?e:null==e?[]:[e]}var YA=class extends BC{type="ai";tool_calls=[];invalid_tool_calls=[];usage_metadata;get lc_aliases(){return{...super.lc_aliases,tool_calls:"tool_calls",invalid_tool_calls:"invalid_tool_calls",usage_metadata:"usage_metadata"}}constructor(e){let t;if("string"==typeof e||Array.isArray(e))t={content:e,tool_calls:[],invalid_tool_calls:[],additional_kwargs:{}};else{t=e;const n=t.additional_kwargs?.tool_calls,r=t.tool_calls;null!=n&&n.length>0&&(void 0===r||0===r.length)&&console.warn(["New LangChain packages are available that more efficiently handle","tool calling.\n\nPlease upgrade your packages to versions that set","message tool calls. e.g., `pnpm install @langchain/anthropic`,","pnpm install @langchain/openai`, etc."].join(" "));try{if(null!=n&&void 0===r){const[e,r]=function(e){const t=[],n=[];for(const r of e)if(r.function){const e=r.function.name;try{const n=JSON.parse(r.function.arguments);t.push({name:e||"",args:n||{},id:r.id})}catch{n.push({name:e,args:r.function.arguments,id:r.id,error:"Malformed args."})}}return[t,n]}(n);t.tool_calls=e??[],t.invalid_tool_calls=r??[]}else t.tool_calls=t.tool_calls??[],t.invalid_tool_calls=t.invalid_tool_calls??[]}catch{t.tool_calls=[],t.invalid_tool_calls=[]}if(void 0!==t.response_metadata&&"output_version"in t.response_metadata&&"v1"===t.response_metadata.output_version&&void 0!==t.content&&(t.contentBlocks=KA(t.content),t.content=void 0),void 0!==t.contentBlocks){if(Array.isArray(t.contentBlocks)||(t.contentBlocks=KA(t.contentBlocks)),t.tool_calls){const e=t.tool_calls.filter(e=>!t.contentBlocks?.some(t=>"tool_call"===t.type&&t.id===e.id&&t.name===e.name));t.contentBlocks.push(...e.map(e=>({type:"tool_call",id:e.id,name:e.name,args:e.args})))}const e=t.contentBlocks.filter(e=>"tool_call"===e.type).filter(e=>!t.tool_calls?.some(t=>t.id===e.id&&t.name===e.name));e.length>0&&(t.tool_calls=[...t.tool_calls??[],...e.map(e=>({type:"tool_call",id:e.id,name:e.name,args:e.args}))])}}super(t),"string"!=typeof t&&(this.tool_calls=t.tool_calls??this.tool_calls,this.invalid_tool_calls=t.invalid_tool_calls??this.invalid_tool_calls),this.usage_metadata=t.usage_metadata}static lc_name(){return"AIMessage"}get contentBlocks(){if(this.response_metadata&&"output_version"in this.response_metadata&&"v1"===this.response_metadata.output_version)return this.content;if(this.response_metadata&&"model_provider"in this.response_metadata&&"string"==typeof this.response_metadata.model_provider){const e=hA(this.response_metadata.model_provider);if(e)return e.translateContent(this)}const e=super.contentBlocks;if(this.tool_calls){const t=this.tool_calls.filter(t=>!e.some(e=>e.id===t.id&&e.name===t.name));e.push(...t.map(e=>({type:"tool_call",id:e.id,name:e.name,args:e.args})))}return e}get _printableFields(){return{...super._printableFields,tool_calls:this.tool_calls,invalid_tool_calls:this.invalid_tool_calls,usage_metadata:this.usage_metadata}}static isInstance(e){return super.isInstance(e)&&"ai"===e.type}static[Symbol.hasInstance](e){return this.isInstance(e)}};function qA(e){return"ai"===e._getType()}function QA(e){return"ai"===e._getType()}var JA=class extends VC{type="ai";tool_calls=[];invalid_tool_calls=[];tool_call_chunks=[];usage_metadata;constructor(e){let t;if("string"==typeof e||Array.isArray(e))t={content:e,tool_calls:[],invalid_tool_calls:[],tool_call_chunks:[]};else if(void 0===e.tool_call_chunks||0===e.tool_call_chunks.length)t={...e,tool_calls:e.tool_calls??[],invalid_tool_calls:[],tool_call_chunks:[],usage_metadata:void 0!==e.usage_metadata?e.usage_metadata:void 0};else{const n=function(e){const t=e.reduce((e,t)=>{const n=e.findIndex(([e])=>"id"in t&&t.id&&"index"in t&&void 0!==t.index?t.id===e.id&&t.index===e.index:"id"in t&&t.id?t.id===e.id:"index"in t&&void 0!==t.index&&t.index===e.index);return-1!==n?e[n].push(t):e.push([t]),e},[]),n=[],r=[];for(const i of t){let e=null;const t=i.some(HA),a=i[0]?.name??"",o=i.map(e=>e.args||"").join(""),s=t?o:o.trim(),c=s.length?s:"{}",l=i.find(e=>e.id)?.id??i[0]?.id;if(t&&l)n.push({name:a,args:{input:s},id:l,type:"tool_call"});else try{if(e=NA(c),!l||null===e||"object"!=typeof e||Array.isArray(e))throw new Error("Malformed tool call chunk args.");n.push({name:a,args:e,id:l,type:"tool_call"})}catch{r.push({name:a,args:c,id:l,error:"Malformed args.",type:"invalid_tool_call"})}}return{tool_call_chunks:e,tool_calls:n,invalid_tool_calls:r}}(e.tool_call_chunks??[]);t={...e,tool_call_chunks:n.tool_call_chunks,tool_calls:n.tool_calls,invalid_tool_calls:n.invalid_tool_calls,usage_metadata:void 0!==e.usage_metadata?e.usage_metadata:void 0}}super(t),this.tool_call_chunks=t.tool_call_chunks??this.tool_call_chunks,this.tool_calls=t.tool_calls??this.tool_calls,this.invalid_tool_calls=t.invalid_tool_calls??this.invalid_tool_calls,this.usage_metadata=t.usage_metadata}get lc_aliases(){return{...super.lc_aliases,tool_calls:"tool_calls",invalid_tool_calls:"invalid_tool_calls",tool_call_chunks:"tool_call_chunks",usage_metadata:"usage_metadata"}}static lc_name(){return"AIMessageChunk"}get contentBlocks(){if(this.response_metadata&&"output_version"in this.response_metadata&&"v1"===this.response_metadata.output_version)return this.content;if(this.response_metadata&&"model_provider"in this.response_metadata&&"string"==typeof this.response_metadata.model_provider){const e=hA(this.response_metadata.model_provider);if(e)return e.translateContent(this)}const e=super.contentBlocks;if(this.tool_calls&&"string"!=typeof this.content){const t=this.content.filter(e=>"tool_call"===e.type).map(e=>e.id);for(const n of this.tool_calls)n.id&&!t.includes(n.id)&&e.push({...n,type:"tool_call",id:n.id,name:n.name,args:n.args})}return e}get _printableFields(){return{...super._printableFields,tool_calls:this.tool_calls,tool_call_chunks:this.tool_call_chunks,invalid_tool_calls:this.invalid_tool_calls,usage_metadata:this.usage_metadata}}concat(e){const t={content:OC(this.content,e.content),additional_kwargs:DC(this.additional_kwargs,e.additional_kwargs),response_metadata:(n=this.response_metadata,r=e.response_metadata,DC(n,r)??{}),tool_call_chunks:[],tool_calls:[],id:this.id??e.id};var n,r;if(void 0!==this.tool_call_chunks||void 0!==e.tool_call_chunks){const n=HC(this.tool_call_chunks,e.tool_call_chunks);void 0!==n&&n.length>0&&(t.tool_call_chunks=n)}if(void 0!==this.tool_calls||void 0!==e.tool_calls){const n=HC(this.tool_calls,e.tool_calls);void 0!==n&&n.length>0&&(t.tool_calls=n)}void 0===this.usage_metadata&&void 0===e.usage_metadata||(t.usage_metadata=yA(this.usage_metadata,e.usage_metadata));return new(0,this.constructor)(t)}static isInstance(e){return super.isInstance(e)&&"ai"===e.type}static[Symbol.hasInstance](e){return this.isInstance(e)}};const zA={wav:"audio/wav",mp3:"audio/mpeg",flac:"audio/flac",opus:"audio/opus",aac:"audio/aac",pcm16:"audio/pcm"},ZA={png:"image/png",jpeg:"image/jpeg",jpg:"image/jpeg",webp:"image/webp",gif:"image/gif"};function eS(e){let t=0;for(const n of e.keys())n>=t&&(t=n+1);return t}function tS(e){const t=e.additional_kwargs;return null!=t&&"object"==typeof t?t:{}}function nS(e){const t=tS(e).tool_outputs;if(!Array.isArray(t))return[];const n=[];for(const r of t){if(null==r||"object"!=typeof r)continue;const e=r;if("image_generation_call"!==e.type)continue;const t="string"==typeof e.result?e.result:void 0,i="string"==typeof e.url?e.url:void 0;if(null==t&&null==i)continue;const a="string"==typeof e.output_format?e.output_format.toLowerCase():void 0,o=(null!=a?ZA[a]:void 0)??"image/png";n.push({type:"image",..."string"==typeof e.id?{id:e.id}:{},...null!=i?{url:i}:{},...null!=t?{data:t}:{},mimeType:o})}return n}function rS(e){const t=tS(e).audio;if(null==t||"object"!=typeof t)return;const n=t,r="string"==typeof n.data?n.data:void 0,i="string"==typeof n.url?n.url:void 0,a="string"==typeof n.transcript?n.transcript:void 0;if(null==r&&null==i&&null==a)return;const o="string"==typeof n.mime_type?n.mime_type:"string"==typeof n.mimeType?n.mimeType:void 0,s="string"==typeof n.format?n.format.toLowerCase():void 0,c=o??(null!=s?zA[s]:void 0)??(null!=r?"audio/wav":"audio/pcm");return{..."string"==typeof n.id?{id:n.id}:{},...null!=r?{data:r}:{},...null!=i?{url:i}:{},...null!=a?{transcript:a}:{},mimeType:c}}function iS(e,t){switch(t.type){case"text-delta":return"text"===e.type?{...e,text:(e.text??"")+t.text}:e;case"reasoning-delta":return"thinking"===e.type?{...e,thinking:(e.thinking??"")+t.reasoning}:"reasoning"===e.type?{...e,reasoning:(e.reasoning??"")+t.reasoning}:e;case"data-delta":return{...e,data:(e.data??"")+t.data};case"block-delta":return{...e,...t.fields};default:throw new Error(`Unknown delta type: ${JSON.stringify(t)}`)}}function aS(e){if("text"===e.type)return{type:"text-delta",text:e.text};if("reasoning"===e.type)return{type:"reasoning-delta",reasoning:e.reasoning};if("thinking"===e.type&&"string"==typeof e.thinking)return{type:"reasoning-delta",reasoning:e.thinking};if("string"==typeof e.data)return{type:"data-delta",data:e.data,encoding:"base64"};if("string"==typeof e.type)return{type:"block-delta",fields:{...e}};throw new Error(`Unsupported content block delta: ${JSON.stringify(e)}`)}function oS(e){if("tool_call_chunk"===e.type){const t=e;let n;try{n=JSON.parse(t.args??"{}")}catch{return{type:"invalid_tool_call",id:t.id,name:t.name,args:t.args,error:"Failed to parse tool call arguments as JSON"}}return{type:"tool_call",id:t.id,name:t.name,args:n}}return e}function sS(e){const t=e.reasoning_content??e.reasoning;return"string"==typeof t&&t.length>0?t:void 0}function cS(e){return{input_tokens:e.prompt_tokens??0,output_tokens:e.completion_tokens??0,total_tokens:e.total_tokens??0}}function lS(e){switch(e){case"stop":default:return"stop";case"length":case"max_tokens":return"length";case"tool_calls":case"function_call":return"tool_use";case"content_filter":return"content_filter"}}function uS(e){const t={...null!=e.prompt_tokens_details?.audio_tokens&&{audio:e.prompt_tokens_details.audio_tokens},...null!=e.prompt_tokens_details?.cached_tokens&&{cache_read:e.prompt_tokens_details.cached_tokens}},n={...null!=e.completion_tokens_details?.audio_tokens&&{audio:e.completion_tokens_details.audio_tokens},...null!=e.completion_tokens_details?.reasoning_tokens&&{reasoning:e.completion_tokens_details.reasoning_tokens}};return{input_tokens:e.prompt_tokens??0,output_tokens:e.completion_tokens??0,total_tokens:e.total_tokens??0,...Object.keys(t).length>0&&{input_token_details:t},...Object.keys(n).length>0&&{output_token_details:n}}}function dS(e,t){return{model_provider:"openai",model_name:e.model,system_fingerprint:e.system_fingerprint,service_tier:e.service_tier,finish_reason:t.finish_reason,...e.usage?{usage:e.usage}:{}}}const pS=()=>"undefined"!=typeof Deno,hS=()=>{let e;return e="undefined"!=typeof window&&void 0!==window.document?"browser":"undefined"==typeof process||void 0===process.versions||void 0===process.versions.node||pS()?"object"==typeof globalThis&&globalThis.constructor&&"DedicatedWorkerGlobalScope"===globalThis.constructor.name?"webworker":"undefined"!=typeof window&&"nodejs"===window.name||"undefined"!=typeof navigator&&navigator.userAgent.includes("jsdom")?"jsdom":pS()?"deno":"other":"node",e};let fS;function mS(e){try{return"undefined"!=typeof process?process.env?.[e]:pS()?Deno?.env.get(e):void 0}catch{return}}var gS=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;const yS=[];for(let FO=0;FO<256;++FO)yS.push((FO+256).toString(16).slice(1));function IS(e,t=0){return(yS[e[t+0]]+yS[e[t+1]]+yS[e[t+2]]+yS[e[t+3]]+"-"+yS[e[t+4]]+yS[e[t+5]]+"-"+yS[e[t+6]]+yS[e[t+7]]+"-"+yS[e[t+8]]+yS[e[t+9]]+"-"+yS[e[t+10]]+yS[e[t+11]]+yS[e[t+12]]+yS[e[t+13]]+yS[e[t+14]]+yS[e[t+15]]).toLowerCase()}const CS=new Uint8Array(16);function AS(){return crypto.getRandomValues(CS)}const SS={};function bS(e,t,n,r,i=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(r){if(i<0||i+16>r.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`)}else r=new Uint8Array(16),i=0;return t??=Date.now(),n??=127*e[6]<<24|e[7]<<16|e[8]<<8|e[9],r[i++]=t/1099511627776&255,r[i++]=t/4294967296&255,r[i++]=t/16777216&255,r[i++]=t/65536&255,r[i++]=t/256&255,r[i++]=255&t,r[i++]=112|n>>>28&15,r[i++]=n>>>20&255,r[i++]=128|n>>>14&63,r[i++]=n>>>6&255,r[i++]=n<<2&255|3&e[10],r[i++]=e[11],r[i++]=e[12],r[i++]=e[13],r[i++]=e[14],r[i++]=e[15],r}const TS=function(e,t,n){return t||e||!crypto.randomUUID?function(e,t,n){e=e||{};const r=e.random??e.rng?.()??AS();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){if((n=n||0)<0||n+16>t.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return IS(r)}(e,t,n):crypto.randomUUID()},vS=function(e,t,n){let r;if(e)r=bS(e.random??e.rng?.()??AS(),e.msecs,e.seq,t,n);else{const e=Date.now(),i=AS();!function(e,t,n){e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=n[6]<<23|n[7]<<16|n[8]<<8|n[9],e.msecs=t):(e.seq=e.seq+1|0,0===e.seq&&e.msecs++)}(SS,e,i),r=bS(i,SS.msecs,SS.seq,t,n)}return t??IS(r)},_S=function(e){return"string"==typeof e&&gS.test(e)};var wS=class{};function ES(e){return"lc_prefer_streaming"in e&&e.lc_prefer_streaming}function PS(e){return"lc_prefer_chat_model_stream_events"in e&&e.lc_prefer_chat_model_stream_events}var RS=class extends wS{lc_serializable=!1;get lc_namespace(){return["langchain_core","callbacks",this.name]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,eC(this.constructor)]}lc_kwargs;ignoreLLM=!1;ignoreChain=!1;ignoreAgent=!1;ignoreRetriever=!1;ignoreCustomEvent=!1;raiseError=!1;awaitHandlers="false"===mS("LANGCHAIN_CALLBACKS_BACKGROUND");constructor(e){super(),this.lc_kwargs=e||{},e&&(this.ignoreLLM=e.ignoreLLM??this.ignoreLLM,this.ignoreChain=e.ignoreChain??this.ignoreChain,this.ignoreAgent=e.ignoreAgent??this.ignoreAgent,this.ignoreRetriever=e.ignoreRetriever??this.ignoreRetriever,this.ignoreCustomEvent=e.ignoreCustomEvent??this.ignoreCustomEvent,this.raiseError=e.raiseError??this.raiseError,this.awaitHandlers=this.raiseError||(e._awaitHandler??this.awaitHandlers))}copy(){return new this.constructor(this)}toJSON(){return tC.prototype.toJSON.call(this)}toJSONNotImplemented(){return tC.prototype.toJSONNotImplemented.call(this)}static fromMethods(e){return new class extends RS{name=vS();constructor(){super(),Object.assign(this,e)}}}};const LS=e=>{const t=e;return void 0!==t&&"function"==typeof t.copy&&"string"==typeof t.name&&"boolean"==typeof t.awaitHandlers},NS=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function OS(e){if(!function(e){return"string"==typeof e&&NS.test(e)}(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,255&t,(t=parseInt(e.slice(9,13),16))>>>8,255&t,(t=parseInt(e.slice(14,18),16))>>>8,255&t,(t=parseInt(e.slice(19,23),16))>>>8,255&t,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,255&t)}const BS=[];for(let FO=0;FO<256;++FO)BS.push((FO+256).toString(16).slice(1));function MS(e,t=0){return(BS[e[t+0]]+BS[e[t+1]]+BS[e[t+2]]+BS[e[t+3]]+"-"+BS[e[t+4]]+BS[e[t+5]]+"-"+BS[e[t+6]]+BS[e[t+7]]+"-"+BS[e[t+8]]+BS[e[t+9]]+"-"+BS[e[t+10]]+BS[e[t+11]]+BS[e[t+12]]+BS[e[t+13]]+BS[e[t+14]]+BS[e[t+15]]).toLowerCase()}const DS=new Uint8Array(16);function FS(){return crypto.getRandomValues(DS)}function kS(e,t,n){return crypto.randomUUID?crypto.randomUUID():function(e){e=e||{};const t=e.random??e.rng?.()??FS();if(t.length<16)throw new Error("Random bytes length must be >= 16");return t[6]=15&t[6]|64,t[8]=63&t[8]|128,MS(t)}(e)}function GS(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:case 3:return t^n^r;case 2:return t&n^t&r^n&r}}function xS(e,t){return e<<t|e>>>32-t}function HS(e){const t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520],r=new Uint8Array(e.length+1);r.set(e),r[e.length]=128;const i=(e=r).length/4+2,a=Math.ceil(i/16),o=new Array(a);for(let s=0;s<a;++s){const t=new Uint32Array(16);for(let n=0;n<16;++n)t[n]=e[64*s+4*n]<<24|e[64*s+4*n+1]<<16|e[64*s+4*n+2]<<8|e[64*s+4*n+3];o[s]=t}o[a-1][14]=8*(e.length-1)/2**32,o[a-1][14]=Math.floor(o[a-1][14]),o[a-1][15]=8*(e.length-1)&4294967295;for(let s=0;s<a;++s){const e=new Uint32Array(80);for(let t=0;t<16;++t)e[t]=o[s][t];for(let t=16;t<80;++t)e[t]=xS(e[t-3]^e[t-8]^e[t-14]^e[t-16],1);let r=n[0],i=n[1],a=n[2],c=n[3],l=n[4];for(let n=0;n<80;++n){const o=Math.floor(n/20),s=xS(r,5)+GS(o,i,a,c)+l+t[o]+e[n]>>>0;l=c,c=a,a=xS(i,30)>>>0,i=r,r=s}n[0]=n[0]+r>>>0,n[1]=n[1]+i>>>0,n[2]=n[2]+a>>>0,n[3]=n[3]+c>>>0,n[4]=n[4]+l>>>0}return Uint8Array.of(n[0]>>24,n[0]>>16,n[0]>>8,n[0],n[1]>>24,n[1]>>16,n[1]>>8,n[1],n[2]>>24,n[2]>>16,n[2]>>8,n[2],n[3]>>24,n[3]>>16,n[3]>>8,n[3],n[4]>>24,n[4]>>16,n[4]>>8,n[4])}function US(e,t,n,r,i,a){const o="string"==typeof n?function(e){e=unescape(encodeURIComponent(e));const t=new Uint8Array(e.length);for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}(n):n,s="string"==typeof r?OS(r):r;if("string"==typeof r&&(r=OS(r)),16!==r?.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+o.length);if(c.set(s),c.set(o,s.length),c=t(c),c[6]=15&c[6]|e,c[8]=63&c[8]|128,i){if(a??=0,a<0||a+16>i.length)throw new RangeError(`UUID byte range ${a}:${a+15} is out of buffer bounds`);for(let e=0;e<16;++e)i[a+e]=c[e];return i}return MS(c)}function VS(e,t,n,r){return US(80,HS,e,t,n,r)}VS.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",VS.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";const $S={};function jS(e,t,n){let r;if(e)r=WS(e.random??e.rng?.()??FS(),e.msecs,e.seq,t,n);else{const e=Date.now(),i=FS();!function(e,t,n){e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=n[6]<<23|n[7]<<16|n[8]<<8|n[9],e.msecs=t):(e.seq=e.seq+1|0,0===e.seq&&e.msecs++)}($S,e,i),r=WS(i,$S.msecs,$S.seq,t,n)}return t??MS(r)}function WS(e,t,n,r,i=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(r){if(i<0||i+16>r.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`)}else r=new Uint8Array(16),i=0;return t??=Date.now(),n??=127*e[6]<<24|e[7]<<16|e[8]<<8|e[9],r[i++]=t/1099511627776&255,r[i++]=t/4294967296&255,r[i++]=t/16777216&255,r[i++]=t/65536&255,r[i++]=t/256&255,r[i++]=255&t,r[i++]=112|n>>>28&15,r[i++]=n>>>20&255,r[i++]=128|n>>>14&63,r[i++]=n>>>6&255,r[i++]=n<<2&255|3&e[10],r[i++]=e[11],r[i++]=e[12],r[i++]=e[13],r[i++]=e[14],r[i++]=e[15],r}const XS="gen_ai.request.model",KS="gen_ai.usage.input_tokens",YS="gen_ai.usage.output_tokens",qS="gen_ai.usage.total_tokens",QS="langsmith.span.tags",JS="langsmith.usage_metadata",zS=(...e)=>fetch(...e),ZS=Symbol.for("ls:fetch_implementation"),eb=e=>async(...t)=>{if(e||"true"===NT("DEBUG")){const[e,n]=t;console.log(`→ ${n?.method||"GET"} ${e}`)}const n=await(globalThis[ZS]??zS)(...t);return(e||"true"===NT("DEBUG"))&&console.log(`← ${n.status} ${n.statusText} ${n.url}`),n},tb=()=>NT("PROJECT")??LT("LANGCHAIN_SESSION")??"default",nb={};function rb(e,t){const n=t?.code??e;nb[n]||(nb[n]=!0,t?.type&&"undefined"!=typeof process&&"function"==typeof process.emitWarning?process.emitWarning(e,{type:t.type,code:t.code}):t?.type&&t?.code?console.warn(`${t.type} [${t.code}]: ${e}`):console.warn(e))}const ib=e=>BigInt(e),ab=ib("0x9E3779B1"),ob=ib("0x85EBCA77"),sb=ib("0xC2B2AE3D"),cb=ib("0x9E3779B185EBCA87"),lb=ib("0xC2B2AE3D27D4EB4F"),ub=ib("0x165667B19E3779F9"),db=ib("0x85EBCA77C2B2AE63"),pb=ib("0x27D4EB2F165667C5"),hb=ib("0x165667919E3779F9"),fb=ib("0x9FB21C651E98DF25");const mb=function(e){const t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)t[n/2]=parseInt(e.substring(n,n+2),16);return t}("b8fe6c3923a44bbe7c01812cf721ad1cded46de9839097db7240a4a4b7b3671fcb79e64eccc0e578825ad07dccff7221b8084674f743248ee03590e6813a264c3c2852bb91c300cb88d0658b1b532ea371644897a20df94e3819ef46a9deacd8a8fa763fe39c343ff9dcbbc7c70b4f1d8a51e04bcdb45931c89f7ec9d9787364eac5ac8334d3ebc3c581a0fffa1363eb170ddd51b7f0da49d316552629d4689e2b16be587d47a1fc8ff8b8d17ad031ce45cb3a8f95160428afd7fbcabb4b407e"),gb=(ib(1)<<ib(128))-ib(1),yb=(ib(1)<<ib(64))-ib(1),Ib=(ib(1)<<ib(32))-ib(1),Cb=64;function Ab(e,t=0){return new Uint8Array(e.buffer,e.byteOffset+t,e.length-t)}function Sb(e,t=0){return new DataView(e.buffer,e.byteOffset+t).getBigUint64(0,!0)}function bb(e,t=0){return new DataView(e.buffer,e.byteOffset+t).getUint32(0,!0)}function Tb(e,t=0){return e[t]}const vb=(e,t)=>(e&Ib)*(t&Ib)&yb,_b=e=>{if(!e)throw new Error("Assert failed")};function wb(e,t,n){for(let r=0;r<8;r++){const i=Sb(t,8*r),a=i^Sb(n,8*r);e[1^r]+=i,e[r]+=vb(a,a>>ib(32))}return e}function Eb(e,t,n,r){for(let i=0;i<r;i++)wb(e,Ab(t,i*Cb),Ab(n,8*i));return e}function Pb(e,t){for(let n=0;n<8;n++){const r=Sb(t,8*n);let i=e[n];i=Gb(i,ib(47)),i^=r,i*=ab,e[n]=i&yb}return e}function Rb(e,t){return Ob(e[0]^Sb(t,0),e[1]^Sb(t,8))}function Lb(e,t,n){let r=n;return r+=Rb(e.slice(0),Ab(t,0)),r+=Rb(e.slice(2),Ab(t,16)),r+=Rb(e.slice(4),Ab(t,32)),r+=Rb(e.slice(6),Ab(t,48)),Db(r&yb)}function Nb(e,t,n){let r=new BigUint64Array([sb,cb,lb,ub,db,ob,pb,ab]);_b(e.length>128),r=function(e,t,n,r,i){const a=Math.floor((n.byteLength-Cb)/8),o=Cb*a,s=Math.floor((t.byteLength-1)/o);for(let c=0;c<s;c++)e=i(e=Eb(e,Ab(t,c*o),n,a),Ab(n,n.byteLength-Cb));{const i=Math.floor((t.byteLength-1-o*s)/Cb);e=r(e=Eb(e,Ab(t,s*o),n,i),Ab(t,t.byteLength-Cb),Ab(n,n.byteLength-Cb-7))}return e}(r,e,t,wb,Pb),_b(8*r.length==64);{const n=Lb(r,Ab(t,11),ib(e.byteLength)*cb&yb);return Lb(r,Ab(t,t.byteLength-Cb-11),~(ib(e.byteLength)*lb)&yb)<<ib(64)|n}}function Ob(e,t){const n=e*t&gb;return n&yb^n>>ib(64)}function Bb(e,t,n){return Ob((Sb(e,0)^Sb(t,0)+n)&yb,(Sb(e,8)^Sb(t,8)-n)&yb)}function Mb(e,t,n,r,i){let a=e&yb,o=e>>ib(64)&yb;return a+=Bb(t,r,i),a^=Sb(n,0)+Sb(n,8),a&=yb,o+=Bb(n,Ab(r,16),i),o^=Sb(t,0)+Sb(t,8),o&=yb,o<<ib(64)|a}function Db(e){return e^=e>>ib(37),e*=hb,e&=yb,e^=e>>ib(32)}function Fb(e){return e^=e>>ib(33),e*=lb,e&=yb,e^=e>>ib(29),e*=ub,e&=yb,e^=e>>ib(32)}function kb(e,t,n){const r=e.byteLength;_b(r>0&&r<=3);const i=ib(Tb(e,r-1))|ib(r<<8)|ib(Tb(e,0)<<16)|ib(Tb(e,r>>1)<<24),a=(i^(ib(bb(t,0))^ib(bb(t,4)))+n)&yb,o=(ib(bb(t,8))^ib(bb(t,12)))-n;var s;return(Fb((function(e,t){return(e<<t|e>>ib(32)-t)&Ib}(((s=((s=i)&ib(65535))<<ib(16)|(s&ib(4294901760))>>ib(16))&ib(16711935))<<ib(8)|(s&ib(4278255360))>>ib(8),ib(13))^o)&yb)&yb)<<ib(64)|Fb(a)}function Gb(e,t){return e^e>>t}function xb(e,t,n){const r=e.byteLength;_b(r>=9&&r<=16);{const a=(Sb(t,32)^Sb(t,40))+n&yb,o=(Sb(t,48)^Sb(t,56))-n&yb,s=Sb(e);let c=Sb(e,r-8),l=(s^c^a)*cb;const u=(l&yb)+(ib(r-1)<<ib(54));l=l&(gb^yb)|u,c^=o,l+=c+(c&Ib)*(ob-ib(1))<<ib(64),l&=gb,l^=((i=l>>ib(64))&ib(255))<<ib(56)|(i&ib(65280))<<ib(40)|(i&ib(16711680))<<ib(24)|(i&ib(4278190080))<<ib(8)|(i&ib(0xff00000000))>>ib(8)|(i&ib(0xff0000000000))>>ib(24)|(i&ib(0xff000000000000))>>ib(40)|(i&ib(0xff00000000000000))>>ib(56);let d=(l&yb)*lb;return d+=(l>>ib(64))*lb<<ib(64),d&=gb,Db(d&yb)|Db(d>>ib(64))<<ib(64)}var i}function Hb(e,t){const n=e.byteLength;return _b(n<=16),n>8?xb(e,mb,t):n>=4?function(e,t,n){const r=e.byteLength;_b(r>=4&&r<=8);{const i=bb(e,0),a=bb(e,r-4);let o=((ib(i)|ib(a)<<ib(32))^(Sb(t,16)^Sb(t,24))+n&yb)*(cb+(ib(r)<<ib(2)))&gb;return o+=(o&yb)<<ib(65),o&=gb,o^=o>>ib(67),Gb(Gb(o&yb,ib(35))*fb&yb,ib(28))|Db(o>>ib(64))<<ib(64)}}(e,mb,t):n>0?kb(e,mb,t):Fb(t^Sb(mb,64)^Sb(mb,72))|Fb(t^Sb(mb,80)^Sb(mb,88))<<ib(64)}function Ub(e){return~e+ib(1)&yb}function Vb(e,t=ib(0)){const n=e.byteLength;return n<=16?Hb(e,t):n<=128?function(e,t,n){let r=ib(e.byteLength)*cb&yb,i=ib(e.byteLength-1)/ib(32);for(;i>=0;){const a=Number(i);r=Mb(r,Ab(e,16*a),Ab(e,e.byteLength-16*(a+1)),Ab(t,32*a),n),i--}let a=r+(r>>ib(64))&yb;a=Db(a);let o=(r&yb)*cb+(r>>ib(64))*db+(ib(e.byteLength)-n&yb)*lb;return o&=yb,o=Ub(Db(o)),a|o<<ib(64)}(e,mb,t):n<=240?function(e,t,n){let r=ib(e.byteLength)*cb&yb;for(let o=32;o<160;o+=32)r=Mb(r,Ab(e,o-32),Ab(e,o-16),Ab(t,o-32),n);r=Db(r&yb)|Db(r>>ib(64))<<ib(64);for(let o=160;o<=e.byteLength;o+=32)r=Mb(r,Ab(e,o-32),Ab(e,o-16),Ab(t,3+o-160),n);r=Mb(r,Ab(e,e.byteLength-16),Ab(e,e.byteLength-32),Ab(t,103),Ub(n));let i=r+(r>>ib(64))&yb;i=Db(i);let a=(r&yb)*cb+(r>>ib(64))*db+(ib(e.byteLength)-n&yb)*lb;return a&=yb,a=Ub(Db(a)),i|a<<ib(64)}(e,mb,t):Nb(e,mb)}const $b=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function jb(e,t){if(!$b.test(e)){throw new Error(void 0!==t?`Invalid UUID for ${t}: ${e}`:`Invalid UUID: ${e}`)}return e}const Wb=new TextEncoder;function Xb(e){return function(e){const t=new Uint8Array(16),n=new DataView(t.buffer),r=e&yb,i=e>>ib(64);return n.setBigUint64(0,i,!1),n.setBigUint64(8,r,!1),t}(Vb(Wb.encode(e)))}function Kb(e,t){const n=Xb(`${e}:${t}`),r=new Uint8Array(16);if(7===function(e){if(!$b.test(e))return null;const t=e[14];return parseInt(t,16)}(e)){const t=function(e){const t=e.replace(/-/g,""),n=new Uint8Array(16);for(let r=0;r<16;r++)n[r]=parseInt(t.slice(2*r,2*r+2),16);return n}(e);r.set(t.slice(0,6),0)}else r.set(n.slice(10,16),0);return r[6]=112|15&n[0],r[7]=n[1],r[8]=128|63&n[2],r.set(n.slice(3,10),9),function(e){const t=Array.from(e).map(e=>e.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}(r)}const Yb=Symbol.for("ls:tracing_async_local_storage"),qb=new class{getStore(){}run(e,t){return t()}};const Qb=new class{getInstance(){return globalThis[Yb]??qb}initializeGlobalInstance(e){void 0===globalThis[Yb]&&(globalThis[Yb]=e)}};function Jb(e){return"function"==typeof e&&"langsmith:traceable"in e}const zb=(...e)=>e.join("/"),Zb=e=>e.split("/").slice(0,-1).join("/");async function eT(e){}async function tT(e,t){}async function nT(e){return{size:0}}async function rT(e){}async function iT(e){}function aT(e,t){if(null===t)return!1;return Date.now()-e.createdAt>1e3*t}const oT=new class{constructor(e={}){Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ttlSeconds",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"refreshIntervalSeconds",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"refreshTimer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_metrics",{enumerable:!0,configurable:!0,writable:!0,value:{hits:0,misses:0,refreshes:0,refreshErrors:0}}),this.configure(e)}get metrics(){return{...this._metrics}}get totalRequests(){return this._metrics.hits+this._metrics.misses}get hitRate(){const e=this.totalRequests;return e>0?this._metrics.hits/e:0}resetMetrics(){this._metrics={hits:0,misses:0,refreshes:0,refreshErrors:0}}get(e,t){if(0===this.maxSize)return;const n=this.cache.get(e);if(n)return this.cache.delete(e),this.cache.set(e,{...n,refreshFunc:t}),this._metrics.hits+=1,n.value;this._metrics.misses+=1}set(e,t,n){if(0===this.maxSize)return;if(void 0===this.refreshTimer&&this.startRefreshLoop(),!this.cache.has(e)&&this.cache.size>=this.maxSize){const e=this.cache.keys().next().value;void 0!==e&&this.cache.delete(e)}const r={value:t,createdAt:Date.now(),refreshFunc:n};this.cache.delete(e),this.cache.set(e,r)}invalidate(e){this.cache.delete(e)}clear(){this.cache.clear()}get size(){return this.cache.size}stop(){this.refreshTimer&&(clearInterval(this.refreshTimer),this.refreshTimer=void 0)}dump(e){const t={};for(const[r,i]of this.cache.entries())t[r]=i.value;Zb(e);try{JSON.stringify({entries:t},null,2)}catch(n){throw n}}load(e){return 0}startRefreshLoop(){this.stop(),null!==this.ttlSeconds&&(this.refreshTimer=setInterval(()=>{this.refreshStaleEntries().catch(e=>{console.warn("Unexpected error in cache refresh loop:",e)})},1e3*this.refreshIntervalSeconds),this.refreshTimer.unref&&this.refreshTimer.unref())}getStaleEntries(){const e=[];for(const[t,n]of this.cache.entries())aT(n,this.ttlSeconds)&&e.push([t,n]);return e}async refreshStaleEntries(){const e=this.getStaleEntries();if(0!==e.length)for(const[n,r]of e)if(void 0!==r.refreshFunc)try{const e=await r.refreshFunc();this.set(n,e,r.refreshFunc),this._metrics.refreshes+=1}catch(t){this._metrics.refreshErrors+=1,console.warn(`Failed to refresh cache entry ${n}:`,t)}}configure(e){this.stop(),this.refreshIntervalSeconds=e.refreshIntervalSeconds??60,this.maxSize=e.maxSize??100,this.ttlSeconds=e.ttlSeconds??300}};const sT=e=>{if(e instanceof Error)return e;if("object"==typeof e&&null!==e){try{if("[object Error]"===Object.prototype.toString.call(e)){const t=new Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return new Error(JSON.stringify(e))}catch{}}return new Error(e)};class cT extends Error{}let lT=class e extends cT{constructor(t,n,r,i){super(`${e.makeMessage(t,n,r)}`),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.status=t,this.headers=i,this.error=n}static makeMessage(e,t,n){const r=t?.message?"string"==typeof t.message?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||"(no status code or body)"}static generate(t,n,r,i){if(!t||!i)return new dT({message:r,cause:sT(n)});const a=n;return 400===t?new hT(t,a,r,i):401===t?new fT(t,a,r,i):403===t?new mT(t,a,r,i):404===t?new gT(t,a,r,i):409===t?new yT(t,a,r,i):422===t?new IT(t,a,r,i):429===t?new CT(t,a,r,i):t>=500?new AT(t,a,r,i):new e(t,a,r,i)}},uT=class extends lT{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},dT=class extends lT{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0),t&&(this.cause=t)}},pT=class extends dT{constructor({message:e}={}){super({message:e??"Request timed out."})}},hT=class extends lT{},fT=class extends lT{},mT=class extends lT{},gT=class extends lT{},yT=class extends lT{},IT=class extends lT{},CT=class extends lT{},AT=class extends lT{};const ST="0.10.2";let bT;const TT=()=>void 0!==globalThis.Deno,vT=()=>bT||(bT="undefined"!=typeof Bun?"bun":"undefined"!=typeof window&&void 0!==window.document?"browser":"undefined"==typeof process||void 0===process.versions||void 0===process.versions.node||TT()?"object"==typeof globalThis&&globalThis.constructor&&"DedicatedWorkerGlobalScope"===globalThis.constructor.name?"webworker":"undefined"!=typeof window&&"nodejs"===window.name||"undefined"!=typeof navigator&&navigator.userAgent.includes("jsdom")?"jsdom":TT()?"deno":"other":"node",bT);let _T;function wT(){if(void 0===_T){const e=vT(),t=function(){if(void 0!==OT)return OT;const e=["VERCEL_GIT_COMMIT_SHA","NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA","COMMIT_REF","RENDER_GIT_COMMIT","CI_COMMIT_SHA","CIRCLE_SHA1","CF_PAGES_COMMIT_SHA","REACT_APP_GIT_SHA","SOURCE_VERSION","GITHUB_SHA","TRAVIS_COMMIT","GIT_COMMIT","BUILD_VCS_NUMBER","bamboo_planRepository_revision","Build.SourceVersion","BITBUCKET_COMMIT","DRONE_COMMIT_SHA","SEMAPHORE_GIT_SHA","BUILDKITE_COMMIT"],t={};for(const n of e){const e=LT(n);void 0!==e&&(t[n]=e)}return OT=t,t}();_T={library:"langsmith",runtime:e,sdk:"langsmith-js",sdk_version:ST,...t}}return _T}const ET=["key","secret","token","password","passwd","pwd","credential","email"];function PT(e){const t=e.toLowerCase();return ET.some(e=>t.includes(e))}function RT(){const e=function(){const e={};try{if("undefined"!=typeof process&&process.env)for(const[t,n]of Object.entries(process.env))(t.startsWith("LANGCHAIN_")||t.startsWith("LANGSMITH_"))&&null!=n&&(PT(t)&&"string"==typeof n?e[t]=n.slice(0,2)+"*".repeat(n.length-4)+n.slice(-2):e[t]=n)}catch(t){}return e}(),t={},n=["LANGCHAIN_API_KEY","LANGCHAIN_ENDPOINT","LANGCHAIN_TRACING_V2","LANGCHAIN_PROJECT","LANGCHAIN_SESSION","LANGSMITH_API_KEY","LANGSMITH_ENDPOINT","LANGSMITH_TRACING_V2","LANGSMITH_CONFIG_FILE","LANGSMITH_PROJECT","LANGSMITH_SESSION"];for(const[r,i]of Object.entries(e))"string"!=typeof i||n.includes(r)||PT(r)||("LANGCHAIN_REVISION_ID"===r?t.revision_id=i:t[r]=i);return t}function LT(e){try{return"undefined"!=typeof process?process.env?.[e]:void 0}catch(t){return}}function NT(e){return LT(`LANGSMITH_${e}`)||LT(`LANGCHAIN_${e}`)}let OT;function BT(){return"true"===LT("OTEL_ENABLED")||"true"===NT("OTEL_ENABLED")}const MT=new Set(["langsmith","otel"]);function DT(e){if(void 0!==e)return e;const t=NT("TRACING_MODE");if(void 0!==t&&""!==t){const e=t.toLowerCase();if(!MT.has(e))throw new Error(`Invalid LANGSMITH_TRACING_MODE=${JSON.stringify(t)}. Must be one of: ${[...MT].sort().join(", ")}`);return BT()&&console.warn("Both LANGSMITH_TRACING_MODE and the legacy OTEL_ENABLED / LANGSMITH_OTEL_ENABLED env vars are set. LANGSMITH_TRACING_MODE takes precedence."),e}return BT()?"otel":"langsmith"}class FT{constructor(){Object.defineProperty(this,"hasWarned",{enumerable:!0,configurable:!0,writable:!0,value:!1})}startActiveSpan(e,...t){let n;if(this.hasWarned||"otel"!==DT()||(console.warn('OTel tracing mode is active (via LANGSMITH_TRACING_MODE, OTEL_ENABLED, or LANGSMITH_OTEL_ENABLED), but the required OTEL instances have not been initialized. Please add:\n```\nimport { initializeOTEL } from "langsmith/experimental/otel/setup";\ninitializeOTEL();\n```\nat the beginning of your code.'),this.hasWarned=!0),1===t.length&&"function"==typeof t[0]?n=t[0]:2===t.length&&"function"==typeof t[1]?n=t[1]:3===t.length&&"function"==typeof t[2]&&(n=t[2]),"function"==typeof n)return n()}}const kT=Symbol.for("ls:otel_trace"),GT=Symbol.for("ls:otel_context"),xT=Symbol.for("ls:otel_get_default_otlp_tracer_provider"),HT=new class{constructor(){Object.defineProperty(this,"mockTracer",{enumerable:!0,configurable:!0,writable:!0,value:new FT})}getTracer(e,t){return this.mockTracer}getActiveSpan(){}setSpan(e,t){return e}getSpan(e){}setSpanContext(e,t){return e}getTracerProvider(){}setGlobalTracerProvider(e){return!1}},UT=new class{active(){return{}}with(e,t){return t()}};const VT=new class{getTraceInstance(){return globalThis[kT]??HT}getContextInstance(){return globalThis[GT]??UT}initializeGlobalInstances(e){void 0===globalThis[kT]&&(globalThis[kT]=e.trace),void 0===globalThis[GT]&&(globalThis[GT]=e.context)}setDefaultOTLPTracerComponents(e){globalThis[xT]=e}getDefaultOTLPTracerComponents(){return globalThis[xT]??void 0}};function $T(){return VT.getTraceInstance()}const jT={llm:"chat",tool:"execute_tool",retriever:"embeddings",embedding:"embeddings",prompt:"chat"};function WT(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e}class XT{constructor(){Object.defineProperty(this,"spans",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}exportBatch(e,t){for(const r of e)try{if(!r.run)continue;if("post"===r.operation){const e=this.createSpanForRun(r,r.run,t.get(r.id));e&&!r.run.end_time&&this.spans.set(r.id,e)}else this.updateSpanForRun(r,r.run)}catch(n){console.error(`Error processing operation ${r.id}:`,n)}}createSpanForRun(e,t,n){const r=n&&$T().getSpan(n);if(r)try{return this.finishSpanSetup(r,t,e)}catch(i){return void console.error(`Failed to create span for run ${e.id}:`,i)}}finishSpanSetup(e,t,n){return this.setSpanAttributes(e,t,n),t.error?(e.setStatus({code:2}),e.recordException(new Error(t.error))):e.setStatus({code:1}),t.end_time&&e.end(new Date(t.end_time)),e}updateSpanForRun(e,t){try{const n=this.spans.get(e.id);if(!n)return void console.debug(`No span found for run ${e.id} during update`);this.setSpanAttributes(n,t,e),t.error?(n.setStatus({code:2}),n.recordException(new Error(t.error))):n.setStatus({code:1});const r=t.end_time;r&&(n.end(new Date(r)),this.spans.delete(e.id))}catch(n){console.error(`Failed to update span for run ${e.id}:`,n)}}extractModelName(e){if(e.extra?.metadata){const t=e.extra.metadata;if(t.ls_model_name)return t.ls_model_name;if(t.invocation_params){const e=t.invocation_params;if(e.model)return e.model;if(e.model_name)return e.model_name}}}setSpanAttributes(e,t,n){if("run_type"in t&&t.run_type){e.setAttribute("langsmith.span.kind",t.run_type);const n=(r=t.run_type||"chain",jT[r]||r);e.setAttribute("gen_ai.operation.name",n)}var r;"name"in t&&t.name&&e.setAttribute("langsmith.trace.name",t.name),"session_id"in t&&t.session_id&&e.setAttribute("langsmith.trace.session_id",t.session_id),"session_name"in t&&t.session_name&&e.setAttribute("langsmith.trace.session_name",t.session_name),this.setGenAiSystem(e,t);const i=this.extractModelName(t);i&&e.setAttribute(XS,i),t.extra?.metadata?.usage_metadata&&"object"==typeof t.extra.metadata.usage_metadata&&e.setAttribute(JS,JSON.stringify(t.extra.metadata.usage_metadata)),"prompt_tokens"in t&&"number"==typeof t.prompt_tokens&&e.setAttribute(KS,t.prompt_tokens),"completion_tokens"in t&&"number"==typeof t.completion_tokens&&e.setAttribute(YS,t.completion_tokens),"total_tokens"in t&&"number"==typeof t.total_tokens&&e.setAttribute(qS,t.total_tokens),this.setInvocationParameters(e,t);const a=t.extra?.metadata||{};for(const[s,c]of Object.entries(a))null!=c&&e.setAttribute(`langsmith.metadata.${s}`,WT(c)?String(c):JSON.stringify(c));const o=t.tags;if(o&&Array.isArray(o)?e.setAttribute(QS,o.join(", ")):o&&e.setAttribute(QS,String(o)),"serialized"in t&&"object"==typeof t.serialized){const n=t.serialized;n.name&&e.setAttribute("gen_ai.serialized.name",String(n.name)),n.signature&&e.setAttribute("gen_ai.serialized.signature",String(n.signature)),n.doc&&e.setAttribute("gen_ai.serialized.doc",String(n.doc))}this.setIOAttributes(e,n)}setGenAiSystem(e,t){let n="langchain";const r=this.extractModelName(t);if(r){const e=r.toLowerCase();e.includes("anthropic")||e.startsWith("claude")?n="anthropic":e.includes("bedrock")?n="aws.bedrock":e.includes("azure")&&e.includes("openai")?n="az.ai.openai":e.includes("azure")&&e.includes("inference")?n="az.ai.inference":e.includes("cohere")?n="cohere":e.includes("deepseek")?n="deepseek":e.includes("gemini")?n="gemini":e.includes("groq")?n="groq":e.includes("watson")||e.includes("ibm")?n="ibm.watsonx.ai":e.includes("mistral")?n="mistral_ai":e.includes("gpt")||e.includes("openai")?n="openai":e.includes("perplexity")||e.includes("sonar")?n="perplexity":e.includes("vertex")?n="vertex_ai":(e.includes("xai")||e.includes("grok"))&&(n="xai")}e.setAttribute("gen_ai.system",n)}setInvocationParameters(e,t){if(!t.extra?.metadata?.invocation_params)return;const n=t.extra.metadata.invocation_params;void 0!==n.max_tokens&&e.setAttribute("gen_ai.request.max_tokens",n.max_tokens),void 0!==n.temperature&&e.setAttribute("gen_ai.request.temperature",n.temperature),void 0!==n.top_p&&e.setAttribute("gen_ai.request.top_p",n.top_p),void 0!==n.frequency_penalty&&e.setAttribute("gen_ai.request.frequency_penalty",n.frequency_penalty),void 0!==n.presence_penalty&&e.setAttribute("gen_ai.request.presence_penalty",n.presence_penalty)}setIOAttributes(e,t){if(t.run.inputs)try{const n=t.run.inputs;"object"==typeof n&&null!==n&&(n.model&&Array.isArray(n.messages)&&e.setAttribute(XS,n.model),void 0!==n.stream&&e.setAttribute("langsmith.request.streaming",n.stream),n.extra_headers&&e.setAttribute("langsmith.request.headers",JSON.stringify(n.extra_headers)),n.extra_query&&e.setAttribute("gen_ai.request.extra_query",JSON.stringify(n.extra_query)),n.extra_body&&e.setAttribute("gen_ai.request.extra_body",JSON.stringify(n.extra_body))),e.setAttribute("gen_ai.prompt",JSON.stringify(n))}catch(n){console.debug(`Failed to process inputs for run ${t.id}`,n)}if(t.run.outputs)try{const n=t.run.outputs,r=this.getUnifiedRunTokens(n);if(r&&(e.setAttribute(KS,r[0]),e.setAttribute(YS,r[1]),e.setAttribute(qS,r[0]+r[1])),n&&"object"==typeof n){if(n.model&&e.setAttribute("gen_ai.response.model",String(n.model)),n.id&&e.setAttribute("gen_ai.response.id",n.id),n.choices&&Array.isArray(n.choices)){const t=n.choices.map(e=>e.finish_reason).filter(e=>e).map(String);t.length>0&&e.setAttribute("gen_ai.response.finish_reasons",t.join(", "))}if(n.service_tier&&e.setAttribute("gen_ai.response.service_tier",n.service_tier),n.system_fingerprint&&e.setAttribute("gen_ai.response.system_fingerprint",n.system_fingerprint),n.usage_metadata&&"object"==typeof n.usage_metadata){const t=n.usage_metadata;e.setAttribute(JS,JSON.stringify(t)),t.input_token_details&&e.setAttribute("gen_ai.usage.input_token_details",JSON.stringify(t.input_token_details)),t.output_token_details&&e.setAttribute("gen_ai.usage.output_token_details",JSON.stringify(t.output_token_details))}}e.setAttribute("gen_ai.completion",JSON.stringify(n))}catch(n){console.debug(`Failed to process outputs for run ${t.id}`,n)}}getUnifiedRunTokens(e){if(!e)return null;let t=this.extractUnifiedRunTokens(e.usage_metadata);if(t)return t;const n=Object.keys(e);for(const a of n){const n=e[a];if(n&&"object"==typeof n){if(t=this.extractUnifiedRunTokens(n.usage_metadata),t)return t;if(1===n.lc&&n.kwargs&&"object"==typeof n.kwargs&&(t=this.extractUnifiedRunTokens(n.kwargs.usage_metadata),t))return t}}const r=e.generations||[];if(!Array.isArray(r))return null;const i=Array.isArray(r[0])?r.flat():r;for(const a of i)if("object"==typeof a&&a.message&&"object"==typeof a.message&&a.message.kwargs&&"object"==typeof a.message.kwargs&&(t=this.extractUnifiedRunTokens(a.message.kwargs.usage_metadata),t))return t;return null}extractUnifiedRunTokens(e){return e&&"object"==typeof e?"number"!=typeof e.input_tokens||"number"!=typeof e.output_tokens?null:[e.input_tokens,e.output_tokens]:null}}const KT=Object.prototype.toString,YT=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function qT(e){var t;if(!(e&&(t=e,"[object Error]"===KT.call(t))&&"TypeError"===e.name&&"string"==typeof e.message))return!1;const{message:n,stack:r}=e;return"Load failed"===n?void 0===r||"__sentry_captured__"in e:!!n.startsWith("error sending request for url")||YT.has(n)}function QT(e,t,{min:n=0,allowInfinity:r=!1}={}){if(void 0!==t){if("number"!=typeof t||Number.isNaN(t))throw new TypeError(`Expected \`${e}\` to be a number${r?" or Infinity":""}.`);if(!r&&!Number.isFinite(t))throw new TypeError(`Expected \`${e}\` to be a finite number.`);if(t<n)throw new TypeError(`Expected \`${e}\` to be ≥ ${n}.`)}}let JT=class extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,({message:e}=e)):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}};function zT(e,t){return Number.isFinite(t)?t-(performance.now()-e):t}async function ZT({error:e,attemptNumber:t,retriesConsumed:n,startTime:r,options:i}){const a=e instanceof Error?e:new TypeError(`Non-error was thrown: "${e}". You should only throw errors.`);if(a instanceof JT)throw a.originalError;const o=Number.isFinite(i.retries)?Math.max(0,i.retries-n):i.retries,s=i.maxRetryTime??Number.POSITIVE_INFINITY,c=Object.freeze({error:a,attemptNumber:t,retriesLeft:o,retriesConsumed:n});if(await i.onFailedAttempt(c),zT(r,s)<=0)throw a;const l=await i.shouldConsumeRetry(c),u=zT(r,s);if(u<=0||o<=0)throw a;if(a instanceof TypeError&&!qT(a)){if(l)throw a;return i.signal?.throwIfAborted(),!1}if(!(await i.shouldRetry(c)))throw a;if(!l)return i.signal?.throwIfAborted(),!1;const d=function(e,t){const n=Math.max(1,e+1),r=t.randomize?Math.random()+1:1;let i=Math.round(r*t.minTimeout*t.factor**(n-1));return i=Math.min(i,t.maxTimeout),i}(n,i),p=Math.min(d,u);return p>0&&await new Promise((e,t)=>{const n=()=>{clearTimeout(r),i.signal?.removeEventListener("abort",n),t(i.signal.reason)},r=setTimeout(()=>{i.signal?.removeEventListener("abort",n),e()},p);i.unref&&r.unref?.(),i.signal?.addEventListener("abort",n,{once:!0})}),i.signal?.throwIfAborted(),!0}async function ev(e,t={}){if(function(e){if("number"==typeof e){if(e<0)throw new TypeError("Expected `retries` to be a non-negative number.");if(Number.isNaN(e))throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.")}else if(void 0!==e)throw new TypeError("Expected `retries` to be a number or Infinity.")}((t={...t}).retries),Object.hasOwn(t,"forever"))throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");t.retries??=10,t.factor??=2,t.minTimeout??=1e3,t.maxTimeout??=Number.POSITIVE_INFINITY,t.maxRetryTime??=Number.POSITIVE_INFINITY,t.randomize??=!1,t.onFailedAttempt??=()=>{},t.shouldRetry??=()=>!0,t.shouldConsumeRetry??=()=>!0,QT("factor",t.factor,{min:0,allowInfinity:!1}),QT("minTimeout",t.minTimeout,{min:0,allowInfinity:!1}),QT("maxTimeout",t.maxTimeout,{min:0,allowInfinity:!0}),QT("maxRetryTime",t.maxRetryTime,{min:0,allowInfinity:!0}),t.factor>0||(t.factor=1),t.signal?.throwIfAborted();let n=0,r=0;const i=performance.now();for(;!Number.isFinite(t.retries)||r<=t.retries;){n++;try{t.signal?.throwIfAborted();const r=await e(n);return t.signal?.throwIfAborted(),r}catch(a){await ZT({error:a,attemptNumber:n,retriesConsumed:r,startTime:i,options:t})&&r++}}throw new Error("Retry attempts exhausted without throwing an error.")}var tv,nv={},rv={exports:{}};var iv,av,ov,sv={exports:{}};function cv(){if(ov)return sv.exports;ov=1;const e=av?iv:(av=1,iv=(e,t)=>(t=t||(()=>{}),e.then(e=>new Promise(e=>{e(t())}).then(()=>e),e=>new Promise(e=>{e(t())}).then(()=>{throw e}))));class t extends Error{constructor(e){super(e),this.name="TimeoutError"}}const n=(n,r,i)=>new Promise((a,o)=>{if("number"!=typeof r||r<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(r===1/0)return void a(n);const s=setTimeout(()=>{if("function"==typeof i){try{a(i())}catch(s){o(s)}return}const e=i instanceof Error?i:new t("string"==typeof i?i:`Promise timed out after ${r} milliseconds`);"function"==typeof n.cancel&&n.cancel(),o(e)},r);e(n.then(a,o),()=>{clearTimeout(s)})});return sv.exports=n,sv.exports.default=n,sv.exports.TimeoutError=t,sv.exports}var lv,uv,dv,pv={},hv={};function fv(){if(uv)return pv;uv=1,Object.defineProperty(pv,"__esModule",{value:!0});const e=(lv||(lv=1,Object.defineProperty(hv,"__esModule",{value:!0}),hv.default=function(e,t,n){let r=0,i=e.length;for(;i>0;){const a=i/2|0;let o=r+a;n(e[o],t)<=0?(r=++o,i-=a+1):i=a}return r}),hv);return pv.default=class{constructor(){this._queue=[]}enqueue(t,n){const r={priority:(n=Object.assign({priority:0},n)).priority,run:t};if(this.size&&this._queue[this.size-1].priority>=n.priority)return void this._queue.push(r);const i=e.default(this._queue,r,(e,t)=>t.priority-e.priority);this._queue.splice(i,0,r)}dequeue(){const e=this._queue.shift();return null==e?void 0:e.run}filter(e){return this._queue.filter(t=>t.priority===e.priority).map(e=>e.run)}get size(){return this._queue.length}},pv}const mv=vi(function(){if(dv)return nv;dv=1,Object.defineProperty(nv,"__esModule",{value:!0});const e=(tv||(tv=1,function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function a(e,t,r,a,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new i(r,a||e,o),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function o(e,t){0===--e._eventsCount?e._events=new r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,a=r.length,o=new Array(a);i<a;i++)o[i]=r[i].fn;return o},s.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},s.prototype.emit=function(e,t,r,i,a,o){var s=n?n+e:e;if(!this._events[s])return!1;var c,l,u=this._events[s],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,r),!0;case 4:return u.fn.call(u.context,t,r,i),!0;case 5:return u.fn.call(u.context,t,r,i,a),!0;case 6:return u.fn.call(u.context,t,r,i,a,o),!0}for(l=1,c=new Array(d-1);l<d;l++)c[l-1]=arguments[l];u.fn.apply(u.context,c)}else{var p,h=u.length;for(l=0;l<h;l++)switch(u[l].once&&this.removeListener(e,u[l].fn,void 0,!0),d){case 1:u[l].fn.call(u[l].context);break;case 2:u[l].fn.call(u[l].context,t);break;case 3:u[l].fn.call(u[l].context,t,r);break;case 4:u[l].fn.call(u[l].context,t,r,i);break;default:if(!c)for(p=1,c=new Array(d-1);p<d;p++)c[p-1]=arguments[p];u[l].fn.apply(u[l].context,c)}}return!0},s.prototype.on=function(e,t,n){return a(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return a(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,r,i){var a=n?n+e:e;if(!this._events[a])return this;if(!t)return o(this,a),this;var s=this._events[a];if(s.fn)s.fn!==t||i&&!s.once||r&&s.context!==r||o(this,a);else{for(var c=0,l=[],u=s.length;c<u;c++)(s[c].fn!==t||i&&!s[c].once||r&&s[c].context!==r)&&l.push(s[c]);l.length?this._events[a]=1===l.length?l[0]:l:o(this,a)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&o(this,t)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s}(rv)),rv.exports),t=cv(),n=fv(),r=()=>{},i=new t.TimeoutError;return nv.default=class extends e{constructor(e){var t,i,a,o;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=r,this._resolveIdle=r,!("number"==typeof(e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:n.default},e)).intervalCap&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${null!==(i=null===(t=e.intervalCap)||void 0===t?void 0:t.toString())&&void 0!==i?i:""}\` (${typeof e.intervalCap})`);if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${null!==(o=null===(a=e.interval)||void 0===a?void 0:a.toString())&&void 0!==o?o:""}\` (${typeof e.interval})`);this._carryoverConcurrencyCount=e.carryoverConcurrencyCount,this._isIntervalIgnored=e.intervalCap===1/0||0===e.interval,this._intervalCap=e.intervalCap,this._interval=e.interval,this._queue=new e.queueClass,this._queueClass=e.queueClass,this.concurrency=e.concurrency,this._timeout=e.timeout,this._throwOnTimeout=!0===e.throwOnTimeout,this._isPaused=!1===e.autoStart}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount<this._intervalCap}get _doesConcurrentAllowAnother(){return this._pendingCount<this._concurrency}_next(){this._pendingCount--,this._tryToStartAnother(),this.emit("next")}_resolvePromises(){this._resolveEmpty(),this._resolveEmpty=r,0===this._pendingCount&&(this._resolveIdle(),this._resolveIdle=r,this.emit("idle"))}_onResumeInterval(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=void 0}_isIntervalPaused(){const e=Date.now();if(void 0===this._intervalId){const t=this._intervalEnd-e;if(!(t<0))return void 0===this._timeoutId&&(this._timeoutId=setTimeout(()=>{this._onResumeInterval()},t)),!0;this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0}return!1}_tryToStartAnother(){if(0===this._queue.size)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){const e=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){const t=this._queue.dequeue();return!!t&&(this.emit("active"),t(),e&&this._initializeIntervalIfNeeded(),!0)}}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||void 0!==this._intervalId||(this._intervalId=setInterval(()=>{this._onInterval()},this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){0===this._intervalCount&&0===this._pendingCount&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}_processQueue(){for(;this._tryToStartAnother(););}get concurrency(){return this._concurrency}set concurrency(e){if(!("number"==typeof e&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this._concurrency=e,this._processQueue()}async add(e,n={}){return new Promise((r,a)=>{this._queue.enqueue(async()=>{this._pendingCount++,this._intervalCount++;try{const o=void 0===this._timeout&&void 0===n.timeout?e():t.default(Promise.resolve(e()),void 0===n.timeout?this._timeout:n.timeout,()=>{(void 0===n.throwOnTimeout?this._throwOnTimeout:n.throwOnTimeout)&&a(i)});r(await o)}catch(o){a(o)}this._next()},n),this._tryToStartAnother(),this.emit("add")})}async addAll(e,t){return Promise.all(e.map(async e=>this.add(e,t)))}start(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}pause(){this._isPaused=!0}clear(){this._queue=new this._queueClass}async onEmpty(){if(0!==this._queue.size)return new Promise(e=>{const t=this._resolveEmpty;this._resolveEmpty=()=>{t(),e()}})}async onIdle(){if(0!==this._pendingCount||0!==this._queue.size)return new Promise(e=>{const t=this._resolveIdle;this._resolveIdle=()=>{t(),e()}})}get size(){return this._queue.size}sizeBy(e){return this._queue.filter(e).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(e){this._timeout=e}},nv}()),gv="default"in mv?mv.default:mv,yv=[408,425,429,500,502,503,504];let Iv=class{constructor(e){Object.defineProperty(this,"maxConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxQueueSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"queue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onFailedResponseHook",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"queueSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:0}),this.maxConcurrency=e.maxConcurrency??1/0,this.maxRetries=e.maxRetries??6,this.maxQueueSizeBytes=e.maxQueueSizeBytes,this.queue=new gv({concurrency:this.maxConcurrency}),this.onFailedResponseHook=e?.onFailedResponseHook}call(e,...t){return this.callWithOptions({},e,...t)}callWithOptions(e,t,...n){const r=e.sizeBytes??0;if(void 0!==this.maxQueueSizeBytes&&r>0&&this.queueSizeBytes+r>this.maxQueueSizeBytes)return Promise.reject(new Error(`Queue size limit (${this.maxQueueSizeBytes} bytes) exceeded. Current queue size: ${this.queueSizeBytes} bytes, attempted addition: ${r} bytes.`));r>0&&(this.queueSizeBytes+=r);const i=this.onFailedResponseHook;let a=this.queue.add(()=>ev(()=>t(...n).catch(e=>{throw e instanceof Error?e:new Error(e)}),{async onFailedAttempt({error:e}){if("object"!=typeof e||null==e)throw e;const t="message"in e&&"string"==typeof e.message?e.message:void 0;if(t?.startsWith("Cancel")||t?.startsWith("TimeoutError")||t?.startsWith("AbortError"))throw e;if("name"in e&&"TimeoutError"===e.name)throw e;if("code"in e&&"ECONNABORTED"===e.code)throw e;const n="response"in e?e.response:void 0;if(i){if(await i(n))return}const r=n?.status??("status"in e?e.status:void 0);if(null!=r&&("number"==typeof r||"string"==typeof r)&&!yv.includes(+r))throw e},retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0});return r>0&&(a=a.finally(()=>{this.queueSizeBytes-=r})),e.signal?Promise.race([a,new Promise((t,n)=>{e.signal?.addEventListener("abort",()=>{n(new Error("AbortError"))})})]):a}};function Cv(e){return"function"==typeof e?._getType}function Av(e){const t={type:e._getType(),data:{content:e.content}};return e?.additional_kwargs&&Object.keys(e.additional_kwargs).length>0&&(t.data.additional_kwargs={...e.additional_kwargs}),t}let Sv=function(){const{crypto:e}=globalThis;if(e?.randomUUID)return Sv=e.randomUUID.bind(e),e.randomUUID();const t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>255*Math.random()&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^n()&15>>+e/4).toString(16))};const bv=/^[a-z][a-z0-9+.-]*:/i;let Tv=e=>(Tv=Array.isArray,Tv(e)),vv=Tv;function _v(e){return"object"!=typeof e?{}:e??{}}function wv(e){if(!e)return!0;for(const t in e)return!1;return!0}const Ev="0.0.1";const Pv=()=>{const e="undefined"!=typeof Deno&&null!=Deno.build?"deno":"undefined"!=typeof EdgeRuntime?"edge":"[object process]"===Object.prototype.toString.call(void 0!==globalThis.process?globalThis.process:0)?"node":"unknown";if("deno"===e)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ev,"X-Stainless-OS":Lv(Deno.build.os),"X-Stainless-Arch":Rv(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":"string"==typeof Deno.version?Deno.version:Deno.version?.deno??"unknown"};if("undefined"!=typeof EdgeRuntime)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ev,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if("node"===e)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ev,"X-Stainless-OS":Lv(globalThis.process.platform??"unknown"),"X-Stainless-Arch":Rv(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};const t=function(){if("undefined"==typeof navigator||!navigator)return null;const e=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(const{key:t,pattern:n}of e){const e=n.exec(navigator.userAgent);if(e){return{browser:t,version:`${e[1]||0}.${e[2]||0}.${e[3]||0}`}}}return null}();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ev,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ev,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};const Rv=e=>"x32"===e?"x32":"x86_64"===e||"x64"===e?"x64":"arm"===e?"arm":"aarch64"===e||"arm64"===e?"arm64":e?`other:${e}`:"unknown",Lv=e=>(e=e.toLowerCase()).includes("ios")?"iOS":"android"===e?"Android":"darwin"===e?"MacOS":"win32"===e?"Windows":"freebsd"===e?"FreeBSD":"openbsd"===e?"OpenBSD":"linux"===e?"Linux":e?`Other:${e}`:"Unknown";let Nv;function Ov(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return function(...e){const t=globalThis.ReadableStream;if(void 0===t)throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}({start(){},async pull(e){const{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await(t.return?.())}})}const Bv=({headers:e,body:t})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(t)}),Mv="RFC3986",Dv=e=>String(e),Fv={RFC1738:e=>String(e).replace(/%20/g,"+"),RFC3986:Dv};let kv=(e,t)=>(kv=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),kv(e,t));const Gv=(()=>{const e=[];for(let t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e})(),xv=1024;function Hv(e,t){if(Tv(e)){const n=[];for(let r=0;r<e.length;r+=1)n.push(t(e[r]));return n}return t(e)}const Uv={brackets:e=>String(e)+"[]",comma:"comma",indices:(e,t)=>String(e)+"["+t+"]",repeat:e=>String(e)},Vv=function(e,t){Array.prototype.push.apply(e,Tv(t)?t:[t])};let $v;const jv={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:(e,t,n,r,i)=>{if(0===e.length)return e;let a=e;if("symbol"==typeof e?a=Symbol.prototype.toString.call(e):"string"!=typeof e&&(a=String(e)),"iso-8859-1"===n)return escape(a).replace(/%u[0-9a-f]{4}/gi,function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"});let o="";for(let s=0;s<a.length;s+=xv){const e=a.length>=xv?a.slice(s,s+xv):a,t=[];for(let n=0;n<e.length;++n){let r=e.charCodeAt(n);45===r||46===r||95===r||126===r||r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||"RFC1738"===i&&(40===r||41===r)?t[t.length]=e.charAt(n):r<128?t[t.length]=Gv[r]:r<2048?t[t.length]=Gv[192|r>>6]+Gv[128|63&r]:r<55296||r>=57344?t[t.length]=Gv[224|r>>12]+Gv[128|r>>6&63]+Gv[128|63&r]:(n+=1,r=65536+((1023&r)<<10|1023&e.charCodeAt(n)),t[t.length]=Gv[240|r>>18]+Gv[128|r>>12&63]+Gv[128|r>>6&63]+Gv[128|63&r])}o+=t.join("")}return o},encodeValuesOnly:!1,format:Mv,formatter:Dv,indices:!1,serializeDate:e=>($v??=Function.prototype.call.bind(Date.prototype.toISOString))(e),skipNulls:!1,strictNullHandling:!1};const Wv={};function Xv(e,t,n,r,i,a,o,s,c,l,u,d,p,h,f,m,g,y){let I=e,C=y,A=0,S=!1;for(;void 0!==(C=C.get(Wv))&&!S;){const t=C.get(e);if(A+=1,void 0!==t){if(t===A)throw new RangeError("Cyclic object value");S=!0}void 0===C.get(Wv)&&(A=0)}if("function"==typeof l?I=l(t,I):I instanceof Date?I=p?.(I):"comma"===n&&Tv(I)&&(I=Hv(I,function(e){return e instanceof Date?p?.(e):e})),null===I){if(a)return c&&!m?c(t,jv.encoder,g,"key",h):t;I=""}if("string"==typeof(b=I)||"number"==typeof b||"boolean"==typeof b||"symbol"==typeof b||"bigint"==typeof b||function(e){return!(!e||"object"!=typeof e||!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e)))}(I)){if(c){const e=m?t:c(t,jv.encoder,g,"key",h);return[f?.(e)+"="+f?.(c(I,jv.encoder,g,"value",h))]}return[f?.(t)+"="+f?.(String(I))]}var b;const T=[];if(void 0===I)return T;let v;if("comma"===n&&Tv(I))m&&c&&(I=Hv(I,c)),v=[{value:I.length>0?I.join(",")||null:void 0}];else if(Tv(l))v=l;else{const e=Object.keys(I);v=u?e.sort(u):e}const _=s?String(t).replace(/\./g,"%2E"):String(t),w=r&&Tv(I)&&1===I.length?_+"[]":_;if(i&&Tv(I)&&0===I.length)return w+"[]";for(let E=0;E<v.length;++E){const t=v[E],C="object"==typeof t&&void 0!==t.value?t.value:I[t];if(o&&null===C)continue;const S=d&&s?t.replace(/\./g,"%2E"):t,b=Tv(I)?"function"==typeof n?n(w,S):w:w+(d?"."+S:"["+S+"]");y.set(e,A);const _=new WeakMap;_.set(Wv,y),Vv(T,Xv(C,b,n,r,i,a,o,s,"comma"===n&&m&&Tv(I)?null:c,l,u,d,p,h,f,m,g,_))}return T}function Kv(e,t={}){let n=e;const r=function(e=jv){if(void 0!==e.allowEmptyArrays&&"boolean"!=typeof e.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==e.encodeDotInKeys&&"boolean"!=typeof e.encodeDotInKeys)throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");const t=e.charset||jv.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let n=Mv;if(void 0!==e.format){if(!kv(Fv,e.format))throw new TypeError("Unknown format option provided.");n=e.format}const r=Fv[n];let i,a=jv.filter;if(("function"==typeof e.filter||Tv(e.filter))&&(a=e.filter),i=e.arrayFormat&&e.arrayFormat in Uv?e.arrayFormat:"indices"in e?e.indices?"indices":"repeat":jv.arrayFormat,"commaRoundTrip"in e&&"boolean"!=typeof e.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");const o=void 0===e.allowDots?1==!!e.encodeDotInKeys||jv.allowDots:!!e.allowDots;return{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:jv.addQueryPrefix,allowDots:o,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:jv.allowEmptyArrays,arrayFormat:i,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:jv.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:void 0===e.delimiter?jv.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:jv.encode,encodeDotInKeys:"boolean"==typeof e.encodeDotInKeys?e.encodeDotInKeys:jv.encodeDotInKeys,encoder:"function"==typeof e.encoder?e.encoder:jv.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:jv.encodeValuesOnly,filter:a,format:n,formatter:r,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:jv.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:jv.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:jv.strictNullHandling}}(t);let i,a;"function"==typeof r.filter?(a=r.filter,n=a("",n)):Tv(r.filter)&&(a=r.filter,i=a);const o=[];if("object"!=typeof n||null===n)return"";const s=Uv[r.arrayFormat],c="comma"===s&&r.commaRoundTrip;i||(i=Object.keys(n)),r.sort&&i.sort(r.sort);const l=new WeakMap;for(let p=0;p<i.length;++p){const e=i[p];r.skipNulls&&null===n[e]||Vv(o,Xv(n[e],e,s,c,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,l))}const u=o.join(r.delimiter);let d=!0===r.addQueryPrefix?"?":"";return r.charsetSentinel&&("iso-8859-1"===r.charset?d+="utf8=%26%2310003%3B&":d+="utf8=%E2%9C%93&"),u.length>0?d+u:""}const Yv={off:0,error:200,warn:300,info:400,debug:500},qv=(e,t,n)=>{var r,i;if(e)return r=Yv,i=e,Object.prototype.hasOwnProperty.call(r,i)?e:void e_(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Yv))}`)};function Qv(){}function Jv(e,t,n){return!t||Yv[e]>Yv[n]?Qv:t[e].bind(t)}const zv={error:Qv,warn:Qv,info:Qv,debug:Qv};let Zv=new WeakMap;function e_(e){const t=e.logger,n=e.logLevel??"off";if(!t)return zv;const r=Zv.get(t);if(r&&r[0]===n)return r[1];const i={error:Jv("error",t,n),warn:Jv("warn",t,n),info:Jv("info",t,n),debug:Jv("debug",t,n)};return Zv.set(t,[n,i]),i}const t_=e=>(e.options&&(e.options={...e.options},delete e.options.headers),e.headers&&(e.headers=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([e,t])=>[e,"authorization"===e.toLowerCase()||"api-key"===e.toLowerCase()||"x-api-key"===e.toLowerCase()||"cookie"===e.toLowerCase()||"set-cookie"===e.toLowerCase()||"x-tenant-id"===e.toLowerCase()?"***":t]))),"retryOfRequestLogID"in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e);async function n_(e,t){const{response:n,requestLogID:r,retryOfRequestLogID:i,startTime:a}=t,o=await(async()=>{if(204===n.status)return null;if(t.options.__binaryResponse)return n;const e=n.headers.get("content-type"),r=e?.split(";")[0]?.trim();if(r?.includes("application/json")||r?.endsWith("+json")){if("0"===n.headers.get("content-length"))return;return await n.json()}return await n.text()})();return e_(e).debug(`[${r}] response parsed`,t_({retryOfRequestLogID:i,url:n.url,status:n.status,body:o,durationMs:Date.now()-a})),o}var r_,i_=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};let a_=class e extends Promise{constructor(e,t,n=n_){super(e=>{e(null)}),Object.defineProperty(this,"responsePromise",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"parseResponse",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"parsedPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r_.set(this,void 0),function(e,t,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?i.call(e,n):i?i.value=n:t.set(e,n)}(this,r_,e,"f")}_thenUnwrap(t){return new e(i_(this,r_,"f"),this.responsePromise,async(e,n)=>t(await this.parseResponse(e,n),n))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){const[e,t]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:t}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(i_(this,r_,"f"),e))),this.parsedPromise}then(e,t){return this.parse().then(e,t)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};r_=new WeakMap;var o_;class s_{constructor(e,t,n,r){o_.set(this,void 0),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"response",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),function(e,t,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?i.call(e,n):i?i.value=n:t.set(e,n)}(this,o_,e,"f"),this.options=r,this.response=t,this.body=n}hasNextPage(){return!!this.getPaginatedItems().length&&null!=this.nextPageRequestOptions()}async getNextPage(){const e=this.nextPageRequestOptions();if(!e)throw new cT("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}(this,o_,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(o_=new WeakMap,Symbol.asyncIterator)](){for await(const e of this.iterPages())for(const t of e.getPaginatedItems())yield t}}class c_ extends a_{constructor(e,t,n){super(e,t,async(e,t)=>new n(e,t.response,await n_(e,t),t.options))}async*[Symbol.asyncIterator](){const e=await(this);for await(const t of e)yield t}}class l_ extends s_{constructor(e,t,n,r){super(e,t,n,r),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.items=n||[]}getPaginatedItems(){return this.items??[]}nextPageRequestOptions(){const e=(this.options.query.offset??0)+this.getPaginatedItems().length;return{...this.options,query:{..._v(this.options.query),offset:e}}}}class u_ extends s_{constructor(e,t,n,r){super(e,t,n,r),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.items=n||[]}getPaginatedItems(){return this.items??[]}nextPageRequestOptions(){const e=(this.options.query.offset??0)+this.getPaginatedItems().length;return{...this.options,query:{..._v(this.options.query),offset:e}}}}class d_ extends s_{constructor(e,t,n,r){super(e,t,n,r),Object.defineProperty(this,"evaluators",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"total",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.evaluators=n.evaluators||[],this.total=n.total||0}getPaginatedItems(){return this.evaluators??[]}nextPageRequestOptions(){const e=(this.options.query.offset??0)+this.getPaginatedItems().length;return{...this.options,query:{..._v(this.options.query),offset:e}}}}class p_ extends s_{constructor(e,t,n,r){super(e,t,n,r),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"next_cursor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.items=n.items||[],this.next_cursor=n.next_cursor||""}getPaginatedItems(){return this.items??[]}nextPageRequestOptions(){const e=this.next_cursor;return e?{...this.options,body:{..._v(this.options.body),cursor:e}}:null}}class h_ extends s_{constructor(e,t,n,r){super(e,t,n,r),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"next_cursor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.items=n.items||[],this.next_cursor=n.next_cursor||""}getPaginatedItems(){return this.items??[]}nextPageRequestOptions(){const e=this.next_cursor;return e?{...this.options,query:{..._v(this.options.query),cursor:e}}:null}}const f_=()=>{if("undefined"==typeof File){const{process:e}=globalThis,t="string"==typeof e?.versions?.node&&parseInt(e.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(t?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function m_(e,t,n){return f_(),new File(e,t??"unknown_file",n)}const g_=e=>null!=e&&"object"==typeof e&&"number"==typeof e.size&&"string"==typeof e.type&&"function"==typeof e.text&&"function"==typeof e.slice&&"function"==typeof e.arrayBuffer;async function y_(e){let t=[];if("string"==typeof e||ArrayBuffer.isView(e)||e instanceof ArrayBuffer)t.push(e);else if(g_(e))t.push(e instanceof Blob?e:await e.arrayBuffer());else{if(!(e=>null!=e&&"object"==typeof e&&"function"==typeof e[Symbol.asyncIterator])(e)){const t=e?.constructor?.name;throw new Error(`Unexpected data type: ${typeof e}${t?`; constructor: ${t}`:""}${function(e){if("object"!=typeof e||null===e)return"";const t=Object.getOwnPropertyNames(e);return`; props: [${t.map(e=>`"${e}"`).join(", ")}]`}(e)}`)}for await(const n of e)t.push(...await y_(n))}return t}let I_=class{constructor(e){Object.defineProperty(this,"_client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._client=e}};function C_(e){return e.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}const A_=Object.freeze(Object.create(null)),S_=(e=C_)=>function(t,...n){if(1===t.length)return t[0];let r=!1;const i=[],a=t.reduce((t,a,o)=>{/[?#]/.test(a)&&(r=!0);const s=n[o];let c=(r?encodeURIComponent:e)(""+s);return o!==n.length&&(null==s||"object"==typeof s&&s.toString===Object.getPrototypeOf(Object.getPrototypeOf(s.hasOwnProperty??A_)??A_)?.toString)&&(c=s+"",i.push({start:t.length+a.length,length:c.length,error:`Value of type ${Object.prototype.toString.call(s).slice(8,-1)} is not a valid path parameter`})),t+a+(o===n.length?"":c)},""),o=a.split(/[?#]/,1)[0],s=new RegExp("(?<=^|\\/)(?:\\.|%2e){1,2}(?=\\/|$)","gi");let c;for(;null!==(c=s.exec(o));)i.push({start:c.index,length:c[0].length,error:`Value "${c[0]}" can't be safely passed as a path parameter`});if(i.sort((e,t)=>e.start-t.start),i.length>0){let e=0;const t=i.reduce((t,n)=>{const r=" ".repeat(n.start-e),i="^".repeat(n.length);return e=n.start+n.length,t+r+i},"");throw new cT(`Path parameters result in path with invalid segments:\n${i.map(e=>e.error).join("\n")}\n${a}\n${t}`)}return a},b_=S_(C_);class T_ extends I_{create(e,t,n){const{extend_trace_retention:r,...i}=t;return this._client.post(b_`/api/v1/platform/annotation-queues/${e}/items`,{query:{extend_trace_retention:r},body:i,...n})}update(e,t,n){const{queue_id:r,...i}=t;return this._client.patch(b_`/api/v1/platform/annotation-queues/${r}/items/${e}`,{body:i,...n})}list(e,t,n){return this._client.getAPIList(b_`/api/v1/platform/annotation-queues/${e}/items`,h_,{query:t,...n})}createStatus(e,t,n){return this._client.post(b_`/api/v1/platform/annotation-queues/items/${e}/status`,{body:t,...n})}deleteAll(e,t,n){return this._client.post(b_`/api/v1/platform/annotation-queues/${e}/items/delete`,{body:t,...n})}retrieveCount(e,t,n){return this._client.get(b_`/api/v1/platform/annotation-queues/${e}/items/count`,{query:t,...n})}retrievePlacement(e,t,n){const{queue_id:r}=t;return this._client.get(b_`/api/v1/platform/annotation-queues/${r}/items/${e}/placement`,n)}}let v_=class extends I_{create(e,t,n){const{body:r,extend_trace_retention:i}=t;return this._client.post(b_`/api/v1/annotation-queues/${e}/runs`,{query:{extend_trace_retention:i},body:r,...n})}update(e,t,n){const{queue_id:r,...i}=t;return this._client.patch(b_`/api/v1/annotation-queues/${r}/runs/${e}`,{body:i,...n})}list(e,t={},n){return this._client.get(b_`/api/v1/annotation-queues/${e}/runs`,{query:t,...n})}createByKey(e,t,n){const{body:r,extend_trace_retention:i}=t;return this._client.post(b_`/api/v1/annotation-queues/${e}/runs/by-key`,{query:{extend_trace_retention:i},body:r,...n})}deleteAll(e,t,n){return this._client.post(b_`/api/v1/annotation-queues/${e}/runs/delete`,{body:t,...n})}deleteQueue(e,t,n){const{queue_id:r}=t;return this._client.delete(b_`/api/v1/annotation-queues/${r}/runs/${e}`,n)}};class __ extends I_{constructor(){super(...arguments),Object.defineProperty(this,"runs",{enumerable:!0,configurable:!0,writable:!0,value:new v_(this._client)}),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:new T_(this._client)})}retrieve(e,t){return this._client.get(b_`/api/v1/annotation-queues/${e}`,t)}update(e,t,n){return this._client.patch(b_`/api/v1/annotation-queues/${e}`,{body:t,...n})}delete(e,t){return this._client.delete(b_`/api/v1/annotation-queues/${e}`,t)}annotationQueues(e,t){return this._client.post("/api/v1/annotation-queues",{body:e,...t})}createRunStatus(e,t,n){return this._client.post(b_`/api/v1/annotation-queues/status/${e}`,{body:t,...n})}export(e,t,n){return this._client.post(b_`/api/v1/annotation-queues/${e}/export`,{body:t,...n})}populate(e,t){return this._client.post("/api/v1/annotation-queues/populate",{body:e,...t})}retrieveAnnotationQueues(e={},t){return this._client.getAPIList("/api/v1/annotation-queues",l_,{query:e,...t})}retrieveQueues(e,t){return this._client.get(b_`/api/v1/annotation-queues/${e}/queues`,t)}retrieveRun(e,t,n){const{queue_id:r,...i}=t;return this._client.get(b_`/api/v1/annotation-queues/${r}/run/${e}`,{query:i,...n})}retrieveSize(e,t={},n){return this._client.get(b_`/api/v1/annotation-queues/${e}/size`,{query:t,...n})}retrieveTotalArchived(e,t={},n){return this._client.get(b_`/api/v1/annotation-queues/${e}/total_archived`,{query:t,...n})}retrieveTotalSize(e,t){return this._client.get(b_`/api/v1/annotation-queues/${e}/total_size`,t)}}__.Runs=v_,__.Items=T_;class w_ extends I_{query(e,t,n){return this._client.getAPIList(b_`/api/v2/datasets/${e}/experiment-runs`,p_,{body:t,method:"post",...n})}}class E_ extends I_{constructor(){super(...arguments),Object.defineProperty(this,"experimentRuns",{enumerable:!0,configurable:!0,writable:!0,value:new w_(this._client)})}}E_.ExperimentRuns=w_;class P_ extends I_{list(e){return this._client.get("/api/v1/info",e)}}class R_ extends I_{retrieve(e,t){return this._client.get(b_`/api/v1/platform/issues/${e}`,t)}list(e={},t){return this._client.getAPIList("/api/v1/platform/issues",u_,{query:e,...t})}}const L_=Symbol("brand.privateNullableHeaders");function*N_(e){if(!e)return;if(L_ in e){const{values:t,nulls:n}=e;yield*t.entries();for(const e of n)yield[e,null];return}let t,n=!1;e instanceof Headers?t=e.entries():vv(e)?t=e:(n=!0,t=Object.entries(e??{}));for(let r of t){const e=r[0];if("string"!=typeof e)throw new TypeError("expected header name to be a string");const t=vv(r[1])?r[1]:[r[1]];let i=!1;for(const r of t)void 0!==r&&(n&&!i&&(i=!0,yield[e,null]),yield[e,r])}}const O_=e=>{const t=new Headers,n=new Set;for(const r of e){const e=new Set;for(const[i,a]of N_(r)){const r=i.toLowerCase();e.has(r)||(t.delete(i),e.add(r)),null===a?(t.delete(i),n.add(r)):(t.append(i,a),n.delete(r))}}return{[L_]:!0,values:t,nulls:n}};class B_ extends I_{create(e,t){return this._client.post("/api/v1/platform/evaluators",{body:e,...t})}retrieve(e,t){return this._client.get(b_`/api/v1/platform/evaluators/${e}`,t)}update(e,t,n){return this._client.patch(b_`/api/v1/platform/evaluators/${e}`,{body:t,...n})}list(e={},t){return this._client.getAPIList("/api/v1/platform/evaluators",d_,{query:e,...t})}delete(e,t={},n){const{delete_run_rules:r}=t??{};return this._client.delete(b_`/api/v1/platform/evaluators/${e}`,{query:{delete_run_rules:r},...n,headers:O_([{Accept:"*/*"},n?.headers])})}bulkDelete(e,t){const{evaluator_ids:n,delete_run_rules:r}=e;return this._client.delete("/api/v1/platform/evaluators",{query:{evaluator_ids:n,delete_run_rules:r},...t})}spend(e,t){return this._client.get("/api/v1/platform/evaluators/spend",{query:e,...t})}}let M_=class extends I_{retrieve(e,t,n){const{share_token:r,Accept:i,...a}=t;return this._client.get(b_`/api/v2/public/${r}/run/${e}`,{query:a,...n,headers:O_([{...null!=i?{Accept:i}:void 0},n?.headers])})}query(e,t,n){const{Accept:r,...i}=t;return this._client.post(b_`/api/v2/public/${e}/runs/query`,{body:i,...n,headers:O_([{...null!=r?{Accept:r}:void 0},n?.headers])})}};class D_ extends I_{constructor(){super(...arguments),Object.defineProperty(this,"runs",{enumerable:!0,configurable:!0,writable:!0,value:new M_(this._client)})}}D_.Runs=M_;class F_ extends I_{create(e,t,n){return this._client.post(b_`/api/v2/runs/${e}/share`,{body:t,...n})}delete(e,t,n){return this._client.delete(b_`/api/v2/runs/${e}/share`,{body:t,...n,headers:O_([{Accept:"*/*"},n?.headers])})}}class k_ extends I_{constructor(){super(...arguments),Object.defineProperty(this,"share",{enumerable:!0,configurable:!0,writable:!0,value:new F_(this._client)}),Object.defineProperty(this,"retrieve",{enumerable:!0,configurable:!0,writable:!0,value:this.retrieveV2}),Object.defineProperty(this,"query",{enumerable:!0,configurable:!0,writable:!0,value:this.queryV2})}getURL(e,t,n){return this._client.get(b_`/api/v2/runs/${e}/url`,{query:t,...n})}queryV2(e,t){const{Accept:n,...r}=e;return this._client.getAPIList("/api/v2/runs/query",p_,{body:r,method:"post",...t,headers:O_([{...null!=n?{Accept:n}:void 0},t?.headers])})}retrieveV2(e,t,n){const{Accept:r,...i}=t;return this._client.get(b_`/api/v2/runs/${e}`,{query:i,...n,headers:O_([{...null!=r?{Accept:r}:void 0},n?.headers])})}}k_.Share=F_;class G_ extends I_{create(e,t){return this._client.post("/api/v2/sandboxes/boxes",{body:e,...t})}retrieve(e,t){return this._client.get(b_`/api/v2/sandboxes/boxes/${e}`,t)}update(e,t,n){return this._client.patch(b_`/api/v2/sandboxes/boxes/${e}`,{body:t,...n})}list(e={},t){return this._client.getAPIList("/api/v2/sandboxes/boxes",h_,{query:e,...t})}delete(e,t){return this._client.delete(b_`/api/v2/sandboxes/boxes/${e}`,{...t,headers:O_([{Accept:"*/*"},t?.headers])})}createSnapshot(e,t,n){return this._client.post(b_`/api/v2/sandboxes/boxes/${e}/snapshot`,{body:t,...n})}generateDownloadURL(e,t,n){return this._client.post(b_`/api/v2/sandboxes/boxes/${e}/download-url`,{body:t,...n})}generateServiceURL(e,t,n){return this._client.post(b_`/api/v2/sandboxes/boxes/${e}/service-url`,{body:t,...n})}getStatus(e,t){return this._client.get(b_`/api/v2/sandboxes/boxes/${e}/status`,t)}start(e,t){return this._client.post(b_`/api/v2/sandboxes/boxes/${e}/start`,t)}stop(e,t){return this._client.post(b_`/api/v2/sandboxes/boxes/${e}/stop`,{...t,headers:O_([{Accept:"*/*"},t?.headers])})}}class x_ extends I_{create(e,t){return this._client.post("/api/v2/sandboxes/registries",{body:e,...t})}retrieve(e,t){return this._client.get(b_`/api/v2/sandboxes/registries/${e}`,t)}update(e,t,n){return this._client.patch(b_`/api/v2/sandboxes/registries/${e}`,{body:t,...n})}list(e={},t){return this._client.get("/api/v2/sandboxes/registries",{query:e,...t})}delete(e,t){return this._client.delete(b_`/api/v2/sandboxes/registries/${e}`,{...t,headers:O_([{Accept:"*/*"},t?.headers])})}}class H_ extends I_{create(e,t){return this._client.post("/api/v2/sandboxes/snapshots",{body:e,...t})}retrieve(e,t){return this._client.get(b_`/api/v2/sandboxes/snapshots/${e}`,t)}list(e={},t){return this._client.getAPIList("/api/v2/sandboxes/snapshots",h_,{query:e,...t})}delete(e,t){return this._client.delete(b_`/api/v2/sandboxes/snapshots/${e}`,{...t,headers:O_([{Accept:"*/*"},t?.headers])})}retrieveByName(e,t){return this._client.get(b_`/api/v2/sandboxes/snapshots-by-name/${e}`,t)}}class U_ extends I_{constructor(){super(...arguments),Object.defineProperty(this,"boxes",{enumerable:!0,configurable:!0,writable:!0,value:new G_(this._client)}),Object.defineProperty(this,"registries",{enumerable:!0,configurable:!0,writable:!0,value:new x_(this._client)}),Object.defineProperty(this,"snapshots",{enumerable:!0,configurable:!0,writable:!0,value:new H_(this._client)})}}U_.Boxes=G_,U_.Registries=x_,U_.Snapshots=H_;class V_ extends I_{listTraces(e,t,n){return this._client.getAPIList(b_`/api/v2/threads/${e}/traces`,h_,{query:t,...n})}query(e,t){return this._client.getAPIList("/api/v2/threads/query",p_,{body:e,method:"post",...t})}stats(e,t,n){return this._client.get(b_`/api/v2/threads/${e}/stats`,{query:t,...n})}}class $_ extends I_{listRuns(e,t,n){const{Accept:r,...i}=t;return this._client.get(b_`/api/v2/traces/${e}/runs`,{query:i,...n,headers:O_([{...null!=r?{Accept:r}:void 0},n?.headers])})}query(e,t){return this._client.getAPIList("/api/v2/traces/query",p_,{body:e,method:"post",...t})}}const j_=e=>void 0!==globalThis.process?globalThis.process.env?.[e]?.trim()||void 0:void 0!==globalThis.Deno&&globalThis.Deno.env?.get?.(e)?.trim()||void 0;var W_,X_,K_,Y_,q_=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};class Q_{constructor({baseURL:e=j_("LANGCHAIN_BASE_URL"),apiKey:t=j_("LANGSMITH_API_KEY")??null,tenantID:n=j_("LANGSMITH_TENANT_ID")??null,...r}={}){W_.add(this),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tenantID",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"baseURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"logLevel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fetchOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fetch",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),K_.set(this,void 0),Object.defineProperty(this,"idempotencyHeader",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"datasets",{enumerable:!0,configurable:!0,writable:!0,value:new E_(this)}),Object.defineProperty(this,"runs",{enumerable:!0,configurable:!0,writable:!0,value:new k_(this)}),Object.defineProperty(this,"threads",{enumerable:!0,configurable:!0,writable:!0,value:new V_(this)}),Object.defineProperty(this,"traces",{enumerable:!0,configurable:!0,writable:!0,value:new $_(this)}),Object.defineProperty(this,"onlineEvaluators",{enumerable:!0,configurable:!0,writable:!0,value:new B_(this)}),Object.defineProperty(this,"public",{enumerable:!0,configurable:!0,writable:!0,value:new D_(this)}),Object.defineProperty(this,"annotationQueues",{enumerable:!0,configurable:!0,writable:!0,value:new __(this)}),Object.defineProperty(this,"info",{enumerable:!0,configurable:!0,writable:!0,value:new P_(this)}),Object.defineProperty(this,"issues",{enumerable:!0,configurable:!0,writable:!0,value:new R_(this)}),Object.defineProperty(this,"sandboxes",{enumerable:!0,configurable:!0,writable:!0,value:new U_(this)});const i={apiKey:t,tenantID:n,...r,baseURL:e||"https://api.smith.langchain.com/"};this.baseURL=i.baseURL,this.timeout=i.timeout??X_.DEFAULT_TIMEOUT,this.logger=i.logger??console;const a="warn";this.logLevel=a,this.logLevel=qv(i.logLevel,"ClientOptions.logLevel",this)??qv(j_("LANGCHAIN_LOG"),"process.env['LANGCHAIN_LOG']",this)??a,this.fetchOptions=i.fetchOptions,this.maxRetries=i.maxRetries??2,this.fetch=i.fetch??function(){if("undefined"!=typeof fetch)return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Langsmith({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}(),function(e,t,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?i.call(e,n):i?i.value=n:t.set(e,n)}(this,K_,Bv,"f");const o=j_("LANGCHAIN_CUSTOM_HEADERS");if(o){const e={};for(const t of o.split("\n")){const n=t.indexOf(":");n>=0&&(e[t.substring(0,n).trim()]=t.substring(n+1).trim())}i.defaultHeaders={...e,...i.defaultHeaders}}this._options=i,this.apiKey=t,this.tenantID=n}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,tenantID:this.tenantID,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){if(!(this.apiKey&&e.get("x-api-key")||t.has("x-api-key")||this.tenantID&&e.get("x-tenant-id")||t.has("x-tenant-id")))throw new Error('Could not resolve authentication method. Expected either apiKey or tenantID to be set. Or for one of the "X-API-Key" or "X-Tenant-Id" headers to be explicitly omitted')}async authHeaders(e){return O_([await this.apiKeyAuth(e),await this.tenantIDAuth(e)])}async apiKeyAuth(e){if(null!=this.apiKey)return O_([{"X-API-Key":this.apiKey}])}async tenantIDAuth(e){if(null!=this.tenantID)return O_([{"X-Tenant-Id":this.tenantID}])}stringifyQuery(e){return function(e){return Kv(e,{arrayFormat:"repeat"})}(e)}getUserAgent(){return`${this.constructor.name}/JS ${Ev}`}defaultIdempotencyKey(){return`stainless-node-retry-${Sv()}`}makeStatusError(e,t,n,r){return lT.generate(e,t,n,r)}buildURL(e,t,n){const r=!q_(this,W_,"m",Y_).call(this)&&n||this.baseURL,i=(e=>bv.test(e))(e)?new URL(e):new URL(r+(r.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),a=this.defaultQuery(),o=Object.fromEntries(i.searchParams);return wv(a)&&wv(o)||(t={...o,...a,...t}),"object"==typeof t&&t&&!Array.isArray(t)&&(i.search=this.stringifyQuery(t)),i.toString()}async prepareOptions(e){}async prepareRequest(e,{url:t,options:n}){}get(e,t){return this.methodRequest("get",e,t)}post(e,t){return this.methodRequest("post",e,t)}patch(e,t){return this.methodRequest("patch",e,t)}put(e,t){return this.methodRequest("put",e,t)}delete(e,t){return this.methodRequest("delete",e,t)}methodRequest(e,t,n){return this.request(Promise.resolve(n).then(n=>({method:e,path:t,...n})))}request(e,t=null){return new a_(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,n){const r=await e,i=r.maxRetries??this.maxRetries;null==t&&(t=i),await this.prepareOptions(r);const{req:a,url:o,timeout:s}=await this.buildRequest(r,{retryCount:i-t});await this.prepareRequest(a,{url:o,options:r});const c="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),l=void 0===n?"":`, retryOf: ${n}`,u=Date.now();if(e_(this).debug(`[${c}] sending request`,t_({retryOfRequestLogID:n,method:r.method,url:o,options:r,headers:a.headers})),r.signal?.aborted)throw new uT;const d=new AbortController,p=await this.fetchWithTimeout(o,a,s,d).catch(sT),h=Date.now();if(p instanceof globalThis.Error){const e=`retrying, ${t} attempts remaining`;if(r.signal?.aborted)throw new uT;const i="object"==typeof(f=p)&&null!==f&&("name"in f&&"AbortError"===f.name||"message"in f&&String(f.message).includes("FetchRequestCanceledException"))||/timed? ?out/i.test(String(p)+("cause"in p?String(p.cause):""));if(t)return e_(this).info(`[${c}] connection ${i?"timed out":"failed"} - ${e}`),e_(this).debug(`[${c}] connection ${i?"timed out":"failed"} (${e})`,t_({retryOfRequestLogID:n,url:o,durationMs:h-u,message:p.message})),this.retryRequest(r,t,n??c);if(e_(this).info(`[${c}] connection ${i?"timed out":"failed"} - error; no more retries left`),e_(this).debug(`[${c}] connection ${i?"timed out":"failed"} (error; no more retries left)`,t_({retryOfRequestLogID:n,url:o,durationMs:h-u,message:p.message})),i)throw new pT;throw new dT({cause:p})}var f;const m=`[${c}${l}] ${a.method} ${o} ${p.ok?"succeeded":"failed"} with status ${p.status} in ${h-u}ms`;if(!p.ok){const e=await this.shouldRetry(p);if(t&&e){const e=`retrying, ${t} attempts remaining`;return await async function(e){if(null===e||"object"!=typeof e)return;if(e[Symbol.asyncIterator])return void(await(e[Symbol.asyncIterator]().return?.()));const t=e.getReader(),n=t.cancel();t.releaseLock(),await n}(p.body),e_(this).info(`${m} - ${e}`),e_(this).debug(`[${c}] response error (${e})`,t_({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:h-u})),this.retryRequest(r,t,n??c,p.headers)}const i=e?"error; no more retries left":"error; not retryable";e_(this).info(`${m} - ${i}`);const a=await p.text().catch(e=>sT(e).message),o=(e=>{try{return JSON.parse(e)}catch(f){return}})(a),s=o?void 0:a;e_(this).debug(`[${c}] response error (${i})`,t_({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,message:s,durationMs:Date.now()-u}));throw this.makeStatusError(p.status,o,s,p.headers)}return e_(this).info(m),e_(this).debug(`[${c}] response start`,t_({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:h-u})),{response:p,options:r,controller:d,requestLogID:c,retryOfRequestLogID:n,startTime:u}}getAPIList(e,t,n){return this.requestAPIList(t,n&&"then"in n?n.then(t=>({method:"get",path:e,...t})):{method:"get",path:e,...n})}requestAPIList(e,t){const n=this.makeRequest(t,null,void 0);return new c_(this,n,e)}async fetchWithTimeout(e,t,n,r){const{signal:i,method:a,...o}=t||{},s=this._makeAbort(r);i&&i.addEventListener("abort",s,{once:!0});const c=setTimeout(s,n),l=globalThis.ReadableStream&&o.body instanceof globalThis.ReadableStream||"object"==typeof o.body&&null!==o.body&&Symbol.asyncIterator in o.body,u={signal:r.signal,...l?{duplex:"half"}:{},method:"GET",...o};a&&(u.method=a.toUpperCase());try{return await this.fetch.call(void 0,e,u)}finally{clearTimeout(c)}}async shouldRetry(e){const t=e.headers.get("x-should-retry");return"true"===t||"false"!==t&&(408===e.status||(409===e.status||(429===e.status||e.status>=500)))}async retryRequest(e,t,n,r){let i;const a=r?.get("retry-after-ms");if(a){const e=parseFloat(a);Number.isNaN(e)||(i=e)}const o=r?.get("retry-after");if(o&&!i){const e=parseFloat(o);i=Number.isNaN(e)?Date.parse(o)-Date.now():1e3*e}if(void 0===i){const n=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(t,n)}var s;return await(s=i,new Promise(e=>setTimeout(e,s))),this.makeRequest(e,t-1,n)}calculateDefaultRetryTimeoutMillis(e,t){const n=t-e;return Math.min(.5*Math.pow(2,n),16)*(1-.25*Math.random())*1e3}async buildRequest(e,{retryCount:t=0}={}){const n={...e},{method:r,path:i,query:a,defaultBaseURL:o}=n,s=this.buildURL(i,a,o);"timeout"in n&&((e,t)=>{if("number"!=typeof t||!Number.isInteger(t))throw new cT(`${e} must be an integer`);if(t<0)throw new cT(`${e} must be a positive integer`)})("timeout",n.timeout),n.timeout=n.timeout??this.timeout;const{bodyHeaders:c,body:l}=this.buildBody({options:n});return{req:{method:r,headers:await this.buildHeaders({options:e,method:r,bodyHeaders:c,retryCount:t}),...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&l instanceof globalThis.ReadableStream&&{duplex:"half"},...l&&{body:l},...this.fetchOptions??{},...n.fetchOptions??{}},url:s,timeout:n.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:n,retryCount:r}){let i={};this.idempotencyHeader&&"get"!==t&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);const a=O_([i,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(r),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...Nv??=Pv()},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(a),a.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:t}}){if(!e)return{bodyHeaders:void 0,body:void 0};const n=O_([t]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||"string"==typeof e&&n.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:"object"==typeof e&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&"function"==typeof e.next)?{bodyHeaders:void 0,body:Ov(e)}:"object"==typeof e&&"application/x-www-form-urlencoded"===n.values.get("content-type")?{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(e)}:q_(this,K_,"f").call(this,{body:e,headers:n})}}X_=Q_,K_=new WeakMap,W_=new WeakSet,Y_=function(){return"https://api.smith.langchain.com/"!==this.baseURL},Object.defineProperty(Q_,"Langsmith",{enumerable:!0,configurable:!0,writable:!0,value:X_}),Object.defineProperty(Q_,"DEFAULT_TIMEOUT",{enumerable:!0,configurable:!0,writable:!0,value:9e4}),Object.defineProperty(Q_,"LangsmithError",{enumerable:!0,configurable:!0,writable:!0,value:cT}),Object.defineProperty(Q_,"APIError",{enumerable:!0,configurable:!0,writable:!0,value:lT}),Object.defineProperty(Q_,"APIConnectionError",{enumerable:!0,configurable:!0,writable:!0,value:dT}),Object.defineProperty(Q_,"APIConnectionTimeoutError",{enumerable:!0,configurable:!0,writable:!0,value:pT}),Object.defineProperty(Q_,"APIUserAbortError",{enumerable:!0,configurable:!0,writable:!0,value:uT}),Object.defineProperty(Q_,"NotFoundError",{enumerable:!0,configurable:!0,writable:!0,value:gT}),Object.defineProperty(Q_,"ConflictError",{enumerable:!0,configurable:!0,writable:!0,value:yT}),Object.defineProperty(Q_,"RateLimitError",{enumerable:!0,configurable:!0,writable:!0,value:CT}),Object.defineProperty(Q_,"BadRequestError",{enumerable:!0,configurable:!0,writable:!0,value:hT}),Object.defineProperty(Q_,"AuthenticationError",{enumerable:!0,configurable:!0,writable:!0,value:fT}),Object.defineProperty(Q_,"InternalServerError",{enumerable:!0,configurable:!0,writable:!0,value:AT}),Object.defineProperty(Q_,"PermissionDeniedError",{enumerable:!0,configurable:!0,writable:!0,value:mT}),Object.defineProperty(Q_,"UnprocessableEntityError",{enumerable:!0,configurable:!0,writable:!0,value:IT}),Object.defineProperty(Q_,"toFile",{enumerable:!0,configurable:!0,writable:!0,value:async function(e,t,n){if(f_(),(e=>null!=e&&"object"==typeof e&&"string"==typeof e.name&&"number"==typeof e.lastModified&&g_(e))(e=await e))return e instanceof File?e:m_([await e.arrayBuffer()],e.name);if((e=>null!=e&&"object"==typeof e&&"string"==typeof e.url&&"function"==typeof e.blob)(e)){const r=await e.blob();return t||=new URL(e.url).pathname.split(/[\\/]/).pop(),m_(await y_(r),t,n)}const r=await y_(e);if(t||=function(e){return("object"==typeof e&&null!==e&&("name"in e&&e.name&&String(e.name)||"url"in e&&e.url&&String(e.url)||"filename"in e&&e.filename&&String(e.filename)||"path"in e&&e.path&&String(e.path))||"").split(/[\\/]/).pop()||void 0}(e),!n?.type){const e=r.find(e=>"object"==typeof e&&"type"in e&&e.type);"string"==typeof e&&(n={...n,type:e})}return m_(r,t,n)}}),Q_.Datasets=E_,Q_.Runs=k_,Q_.Threads=V_,Q_.Traces=$_,Q_.OnlineEvaluators=B_,Q_.Public=D_,Q_.AnnotationQueues=__,Q_.Info=P_,Q_.Issues=R_,Q_.Sandboxes=U_;const J_=1000000n,z_=new TextEncoder,Z_="clickhouse_only",ew="smithdb_only",tw="dual";function nw(e){return`Invalid prompt identifier format: "${e}". Expected one of:\n - "prompt-name" (for private prompts)\n - "owner/prompt-name" (for prompts with explicit owner)\n - "prompt-name:commit-hash" (with commit reference)\n - "owner/prompt-name:commit-hash" (with owner and commit)`}class rw extends Error{constructor(e){super(e),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="LangSmithConflictError",this.status=409}}class iw extends Error{constructor(e){super(e),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="LangSmithNotFoundError",this.status=404}}function aw(e){return null!=e&&"object"==typeof e&&"name"in e&&"LangSmithNotFoundError"===e?.name}async function ow(e,t,n){let r;if(e.ok)return void(n&&(r=await e.text()));if(403===e.status)try{const t=await e.json(),n=t?.error;"org_scoped_key_requires_workspace"===n&&(r="This API key is org-scoped and requires workspace specification. Please provide 'workspaceId' parameter, or set LANGSMITH_WORKSPACE_ID environment variable.")}catch(o){const t=new Error(`${e.status} ${e.statusText}`);throw t.status=e?.status,t}if(void 0===r)try{r=await e.text()}catch(o){r=""}const i=`Failed to ${t}. Received status [${e.status}]: ${e.statusText}. Message: ${r}`;if(404===e.status)throw new iw(i);if(409===e.status)throw new rw(i);const a=new Error(i);throw a.status=e.status,a}const sw="ERR_CONFLICTING_ENDPOINTS";class cw extends Error{constructor(){super("You cannot provide both LANGSMITH_ENDPOINT / LANGCHAIN_ENDPOINT and LANGSMITH_RUNS_ENDPOINTS."),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:sw}),this.name="ConflictingEndpointsError"}}function lw(e){if(!e||e.split("/").length>2||e.startsWith("/")||e.endsWith("/")||e.split(":").length>2)throw new Error(nw(e));const[t,n]=e.split(":"),r=n||"latest";if(t.includes("/")){const[n,i]=t.split("/",2);if(!n||!i)throw new Error(nw(e));return[n,i,r]}if(!t)throw new Error(nw(e));return["-",t,r]}const uw="created_at";function dw(e){return new Promise(t=>setTimeout(t,e))}function pw(e){return"object"==typeof e&&null!==e&&"EEXIST"===e.code}function hw(e){try{return(zb(e,uw),"").split("\n")}catch{return}}async function fw(e){const t=function(e){const t=hw(e);if(t&&t[0]&&t[0].trim()){const e=Date.parse(t[0].trim());if(!Number.isNaN(e))return e}}(e);return!(void 0===t||Date.now()-t<=1e4)&&(await iT(),!0)}async function mw(e,t){const n=`${e}.oauth.lock.lock`;Zb(n)&&await eT();const r=globalThis.crypto.randomUUID();for(;;){try{await rT()}catch(i){if(!pw(i))throw i;if(!(await fw(n))){if(Date.now()>=t)throw new Error("timed out acquiring OAuth refresh lock");await dw(Math.min(10,Math.max(0,t-Date.now())))}continue}try{await tT(zb(n,uw),(new Date).toISOString())}catch(i){throw await iT(),i}break}return{async release(){(function(e){const t=hw(e);if(t&&t.length>=2&&t[1].trim())return t[1].trim()})(n)===r&&await iT()}}}const gw="https://api.smith.langchain.com",yw="/.well-known/oauth-authorization-server";function Iw(){(function(){const e=vT();return"browser"===e||"webworker"===e})()||function(){const e=LT("LANGSMITH_CONFIG_FILE");if(e)return e;const t=LT("HOME")??LT("USERPROFILE");t&&zb(t,".langsmith","config.json")}()}function Cw(e){return null!=e&&""!==e.trim()}function Aw(e){return e?.trim().replace(/^["']|["']$/g,"")}function Sw(e){const t=e.oauth;if(!t?.refresh_token)return!1;if(!t.access_token)return!0;if(!t.expires_at)return!1;const n=Date.parse(t.expires_at);return!Number.isNaN(n)&&n<=Date.now()+6e4}function bw(e){let t=e;for(;t.endsWith("/");)t=t.slice(0,-1);const n="/api/v1";return t.endsWith(n)?t.slice(0,-7):t}function Tw(e){const t=`${e}${yw}`;let n;try{const t=new URL(e);n=`${t.origin}${yw}${"/"===t.pathname?"":t.pathname}`}catch{return[t]}return n===t?[n]:[n,t]}async function vw(e,t,n){let r,i;try{r=await n(e,{method:"GET",headers:{Accept:"application/json"},signal:AbortSignal.timeout(5e3)})}catch{return}if(r.ok){try{i=await r.json()}catch{return}return i&&"object"==typeof i&&function(e,t){const{issuer:n}=e;if("string"!=typeof n||n.replace(/\/+$/,"")!==t.replace(/\/+$/,""))return!1;let r;try{r=new URL(n)}catch{return!1}for(const i of[e.device_authorization_endpoint,e.token_endpoint]){if("string"!=typeof i||!i)return!1;try{const e=new URL(i);if(e.protocol!==r.protocol||e.host!==r.host)return!1}catch{return!1}}return!0}(i,t)?i:void 0}}async function _w(e,t){for(const n of function(e){const t=bw(e),n=t.endsWith("/api")?t.slice(0,-4):t,r=[];for(const i of[t,`${n}/api`,n])i&&"/api"!==i&&!r.includes(i)&&r.push(i);return r}(e))for(const e of Tw(n)){const r=await vw(e,n,t);if(r)return r.token_endpoint}return`${bw(e)}/oauth/token`}function ww(e){return e.reason??new Error("The operation was aborted.")}class Ew{constructor(e){Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"refreshPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"managedAuthorizationValue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.rememberProfileAuthHeader(this.currentAuthHeader())}currentAuthHeader(){const e=function(e){const t=Aw(e.oauth?.access_token);if(t)return{name:"Authorization",value:`Bearer ${t}`};if(Aw(e.oauth?.refresh_token))return;return Pw(e)}(this.state.profile);return this.rememberProfileAuthHeader(e),e}async getAuthHeader(e,t){Sw(this.state.profile)&&(this.refreshPromise||(this.refreshPromise=this.refreshOAuthToken(e).finally(()=>{this.refreshPromise=void 0})),await async function(e,t){if(!t)return e;if(t.aborted)throw ww(t);let n;const r=new Promise((e,r)=>{const i=()=>{r(ww(t))};t.addEventListener("abort",i,{once:!0}),n=()=>{t.removeEventListener("abort",i)}});try{return await Promise.race([e,r])}finally{n?.()}}(this.refreshPromise,t));const n=Pw(this.state.profile);return this.rememberProfileAuthHeader(n),n}isProfileAuthorizationHeader(e){return e===this.managedAuthorizationValue}reloadProfile(){try{const e=JSON.parse((this.state.configPath,"")),t=e.profiles?.[this.state.profileName];if(!t)return;return this.state.config=e,this.state.profile=t,t}catch{return}}async refreshOAuthToken(e){const t=this.state.profile.oauth?.refresh_token;if(!t)return;const n=Aw(this.state.profile.api_url)??gw,r=Date.now()+1e4;let i;try{i=await mw(this.state.configPath,r);if(this.reloadProfile()&&!Sw(this.state.profile))return;const a=new URLSearchParams({grant_type:"refresh_token",client_id:"langsmith-cli",refresh_token:this.state.profile.oauth?.refresh_token??t}),o=await _w(n,e),s=await e(o,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:a.toString(),signal:AbortSignal.timeout(Math.max(0,r-Date.now()))});if(!s.ok)return;const c=await s.json();if(!c.access_token)return;!function(e,t){e.oauth??={},t.access_token&&(e.oauth.access_token=t.access_token),t.refresh_token&&(e.oauth.refresh_token=t.refresh_token),"number"==typeof t.expires_in&&t.expires_in>0&&(e.oauth.expires_at=new Date(Date.now()+1e3*t.expires_in).toISOString())}(this.state.profile,c),this.state.config.profiles??={},this.state.config.profiles[this.state.profileName]=this.state.profile,await tT(this.state.configPath,JSON.stringify(this.state.config,null,2))}catch{return}finally{await(i?.release())}}rememberProfileAuthHeader(e){this.managedAuthorizationValue="Authorization"===e?.name?e.value:void 0}}function Pw(e){const t=Aw(e.oauth?.access_token);if(t)return{name:"Authorization",value:`Bearer ${t}`};const n=Aw(e.api_key);return n?{name:"x-api-key",value:n}:void 0}var Rw="[...]",Lw={result:"[Circular]"},Nw=[],Ow=[];const Bw=new TextEncoder;function Mw(e){return Bw.encode(e)}function Dw(e){if(e&&"object"==typeof e&&null!==e){if(e instanceof Map)return Object.fromEntries(e);if(e instanceof Set)return Array.from(e);if(e instanceof Date)return e.toISOString();if(e instanceof RegExp)return e.toString();if(e instanceof Error)return{name:e.name,message:e.message}}else if("bigint"==typeof e)return e.toString();return e}function Fw(e,t,n,r,i){try{return Mw(JSON.stringify(e,function(e,t){return Dw(t)},r))}catch(a){if(!a.message?.includes("Converting circular structure to JSON"))return console.warn("[WARNING]: LangSmith received unserializable value."+(t?`\nContext: ${t}`:"")),Mw("[Unserializable]");let s;"true"!==NT("SUPPRESS_CIRCULAR_JSON_WARNINGS")&&console.warn("[WARNING]: LangSmith received circular JSON. This will decrease tracer performance. "+(t?`\nContext: ${t}`:"")),void 0===i&&(i={depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}),Gw(e,"",0,[],void 0,0,i);try{s=0===Ow.length?JSON.stringify(e,n,r):JSON.stringify(e,function(e){return e=void 0!==e?e:function(e,t){return t},function(t,n){if(Ow.length>0)for(var r=0;r<Ow.length;r++){var i=Ow[r];if(i[1]===t&&i[0]===n){n=i[2],Ow.splice(r,1);break}}return e.call(this,t,n)}}(n),r)}catch(o){return Mw("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==Nw.length;){const e=Nw.pop();4===e.length?Object.defineProperty(e[0],e[1],e[3]):e[0][e[1]]=e[2]}}return Mw(s)}}function kw(e,t,n,r){var i=Object.getOwnPropertyDescriptor(r,n);void 0!==i.get?i.configurable?(Object.defineProperty(r,n,{value:e}),Nw.push([r,n,t,i])):Ow.push([t,n,e]):(r[n]=e,Nw.push([r,n,t]))}function Gw(e,t,n,r,i,a,o){var s;if(a+=1,"object"==typeof e&&null!==e){for(s=0;s<r.length;s++)if(r[s]===e)return void kw(Lw,e,t,i);if(void 0!==o.depthLimit&&a>o.depthLimit)return void kw(Rw,e,t,i);if(void 0!==o.edgesLimit&&n+1>o.edgesLimit)return void kw(Rw,e,t,i);if(r.push(e),Array.isArray(e))for(s=0;s<e.length;s++)Gw(e[s],s,s,r,e,a,o);else{e=Dw(e);var c=Object.keys(e);for(s=0;s<c.length;s++){var l=c[s];Gw(e[l],l,s,r,e,a,o)}}r.pop()}}class xw{constructor(){Object.defineProperty(this,"worker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nextId",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"pending",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"disabled",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"startPromise",{enumerable:!0,configurable:!0,writable:!0,value:null})}async ensureStarted(){if(this.disabled)return!1;if(null!==this.worker)return!0;if(null!==this.startPromise)return this.startPromise;this.startPromise=this._start();try{return await this.startPromise}finally{this.startPromise=null}}async _start(){return this.disabled=!0,!1}async serialize(e){if(!(await this.ensureStarted()))return null;const t=this.nextId++;return new Promise((n,r)=>{this.pending.set(t,{resolve:n,reject:r});try{this.worker.postMessage({id:t,op:"serialize",payload:e})}catch(i){this.pending.delete(t),r(i)}})}async terminate(){this.worker&&(await this.worker.terminate(),this.worker=null);for(const[,e]of this.pending)e.reject(new Error("worker terminated"));this.pending.clear()}}let Hw=null;function Uw(e){return"string"==typeof e&&e.length>0&&!e.includes("Z")&&!e.includes("+")&&!e.includes("-",10)?e+"Z":e}function Vw(e){return{...e,start_time:Uw(e.start_time),end_time:Uw(e.end_time)}}function $w(e,t,n){if(n)return e;const r=wT(),i=t??RT(),a=e.extra??{},o=a.metadata;return e.extra={...a,runtime:{...r,...a?.runtime},metadata:{...i,...i.revision_id||"revision_id"in e&&e.revision_id?{revision_id:("revision_id"in e?e.revision_id:void 0)??i.revision_id}:{},...o}},e}function jw(e){if(void 0!==e)return e.trim().replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1")}const Ww=async e=>{if(429===e?.status){const t=1e3*parseInt(e.headers.get("retry-after")??"10",10);if(t>0)return await new Promise(e=>setTimeout(e,t)),!0}return!1};function Xw(e){return"number"==typeof e?Number(e.toFixed(4)):e}const Kw=1073741824;function Yw(e,t){new Headers({[e]:t})}function qw(e){for(const[t,n]of Object.entries(e??{}))Yw(t,n)}function Qw(e){if(!e)return{};const t=e instanceof Headers?[...e.entries()]:Array.isArray(e)?e.map(([e,t])=>[e,t]):Object.entries(e),n={},r=new Map;for(const[i,a]of t){Yw(i,a);const e=i.toLowerCase(),t=r.get(e);void 0===t?(r.set(e,i),n[i]=a):n[t]=a}return n}class Jw{constructor(e){Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"sizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"maxSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSizeBytes=e??Kw}peek(){return this.items[0]}push(e){let t;const n=new Promise(e=>{t=e}),r=function(e){try{let t=function(e){const t=c(e);return t>s&&(s=t),t+2},n=function(e){return 0===e?2:2+4*e},r=function(e){return void 0===e||"function"==typeof e||"symbol"==typeof e},i=function(e){return void 0===e||"function"==typeof e||"symbol"==typeof e?4:a(e)},a=function(e){if(null===e)return 4;if(void 0===e)return 0;const s=typeof e;if("boolean"===s)return 5;if("number"===s)return Number.isFinite(e)?e.toString().length:4;if("bigint"===s)return e.toString().length+2;if("string"===s)return t(e);if("function"===s||"symbol"===s)return 0;const l=e;if(l instanceof Date)return 26;if(l instanceof RegExp)return c(l.toString())+2;if(l instanceof Error){const e=l.name??"",t=l.message??"";return 22+c(e)+c(t)}if("undefined"!=typeof Buffer&&l instanceof Buffer)return 28+n(l.byteLength);if(ArrayBuffer.isView(l))return l instanceof DataView?2:2+(l.length??0)*(l instanceof Float32Array||l instanceof Float64Array?30:12);if(l instanceof ArrayBuffer)return 2;if(o.has(l))return 24;if("function"==typeof l.toJSON){let e;try{e=l.toJSON("")}catch{return 16}o.add(l);const t=a(e);return o.delete(l),t}let u;if(o.add(l),Array.isArray(l)){u=2;const e=l.length;for(let t=0;t<e;t++)u+=i(l[t]),t<e-1&&(u+=1)}else if(l instanceof Map){u=2;let e=0;for(const[t,n]of l){if(r(n))continue;e>0&&(u+=1);const i="string"==typeof t?t:String(t);u+=c(i)+3,u+=a(n),e++}}else if(l instanceof Set){u=2;let e=0;for(const t of l)e>0&&(u+=1),u+=i(t),e++}else{u=2;let e=0;const t=Object.keys(l);for(let n=0;n<t.length;n++){const i=t[n],o=l[i];r(o)||(e>0&&(u+=1),u+=c(i)+3,u+=a(o),e++)}}return o.delete(l),u};const o=new Set;let s=0;const c="undefined"!=typeof Buffer&&"function"==typeof Buffer.byteLength?e=>Buffer.byteLength(e,"utf8"):e=>e.length;return{size:a(e),maxStringLen:s}}catch{return{size:Fw(e).length,maxStringLen:0}}}(e.item).size;return this.sizeBytes+r>this.maxSizeBytes&&this.items.length>0?(console.warn(`AutoBatchQueue size limit (${this.maxSizeBytes} bytes) exceeded. Dropping run with id: ${e.item.id}. Current queue size: ${this.sizeBytes} bytes, attempted addition: ${r} bytes.`),t(),n):(this.items.push({action:e.action,payload:e.item,otelContext:e.otelContext,apiKey:e.apiKey,apiUrl:e.apiUrl,workspaceId:e.workspaceId,itemPromiseResolve:t,itemPromise:n,size:r}),this.sizeBytes+=r,n)}pop({upToSizeBytes:e,upToSize:t}){if(e<1)throw new Error("Number of bytes to pop off may not be less than 1.");const n=[];let r=0;for(;r+(this.peek()?.size??0)<e&&this.items.length>0&&n.length<t;){const e=this.items.shift();e&&(n.push(e),r+=e.size,this.sizeBytes-=e.size)}if(0===n.length&&this.items.length>0){const e=this.items.shift();n.push(e),r+=e.size,this.sizeBytes-=e.size}return[n.map(e=>({action:e.action,item:e.payload,otelContext:e.otelContext,apiKey:e.apiKey,apiUrl:e.apiUrl,workspaceId:e.workspaceId,size:e.size})),()=>n.forEach(e=>e.itemPromiseResolve())]}}class zw{get tracingMode(){return this._tracingMode}get _fetch(){const e=this.fetchImplementation||eb(this.debug);return async(t,n)=>{let r;const i=this.getProfileManagedAuthorizationHeader(n);return void 0!==this.apiKey?r={name:"x-api-key",value:`${this.apiKey}`}:this.hasExplicitAuthHeader(n,i)||(r=await(this.profileAuth?.getAuthHeader(e,n?.signal))),e(t,this.applyCurrentAuthHeaders(n,r,i))}}getProfileManagedAuthorizationHeader(e){if(!e?.headers||!this.profileAuth)return;const t=new Headers(e.headers).get("Authorization");return Cw(t)&&this.profileAuth.isProfileAuthorizationHeader(t??"")?t??void 0:void 0}isProfileManagedAuthorizationHeader(e,t){return e===t||!0===this.profileAuth?.isProfileAuthorizationHeader(e)}hasExplicitAuthHeader(e,t){if(!e?.headers)return!1;const n=new Headers(e.headers);if(Cw(n.get("x-api-key")))return!0;const r=n.get("Authorization");return!!Cw(r)&&!this.isProfileManagedAuthorizationHeader(r??"",t)}applyCurrentAuthHeaders(e,t,n){if(!t)return e;const r=e=>{if(void 0!==this.apiKey&&"x-api-key"===t.name)return e.delete("Authorization"),e.has("x-api-key")||e.set("x-api-key",t.value),e;if("Authorization"===t.name){if(Cw(e.get("x-api-key")))return e;const r=e.get("Authorization");return Cw(r)&&!this.isProfileManagedAuthorizationHeader(r??"",n)||e.set("Authorization",t.value),e}const r=e.get("Authorization");return Cw(r)&&!this.isProfileManagedAuthorizationHeader(r??"",n)||(Cw(r)&&e.delete("Authorization"),e.has("x-api-key")||e.set("x-api-key",t.value)),e};if(!e)return{headers:{[t.name]:t.value}};if(e.headers instanceof Headers)return{...e,headers:r(new Headers(e.headers))};if(Array.isArray(e.headers))return{...e,headers:r(new Headers(e.headers))};const i={...e.headers??{}},a=e=>Object.keys(i).find(t=>t.toLowerCase()===e),o=e=>{const t=a(e);return t?i[t]:void 0},s=Cw(o("x-api-key")),c=o("authorization"),l=Cw(c)&&!this.isProfileManagedAuthorizationHeader(c??"",n);if(void 0!==this.apiKey&&"x-api-key"===t.name){const n=a("authorization");return n&&delete i[n],s||(i["x-api-key"]=t.value),{...e,headers:i}}if("Authorization"===t.name){if(!s&&!l){const e=a("authorization");e&&"Authorization"!==e&&delete i[e],i.Authorization=t.value}return{...e,headers:i}}if(!l){const e=a("authorization");e&&delete i[e],s||(i["x-api-key"]=t.value)}return{...e,headers:i}}_trackDrain(e){this._pendingDrains.add(e),e.finally(()=>{this._pendingDrains.delete(e)})}async _serializeBody(e,t){if(this.manualFlushMode)return Fw(e,t);if(!function(e,t=65536,n=2048){if(null===e||"object"!=typeof e)return"string"==typeof e&&e.length>=t;const r=[e],i=new Set;let a=0;for(;r.length>0;){if(a++>=n)return!1;const e=r.pop();if(null==e)continue;const o=typeof e;if("string"===o){if(e.length>=t)return!0;continue}if("object"!==o)continue;const s=e;if(i.has(s))continue;if(i.add(s),s instanceof Date||s instanceof RegExp||s instanceof Error||s instanceof ArrayBuffer||ArrayBuffer.isView(s))continue;if(Array.isArray(s)){for(let e=s.length-1;e>=0;e--)r.push(s[e]);continue}if(s instanceof Map){for(const[,e]of s)r.push(e);continue}if(s instanceof Set){for(const e of s)r.push(e);continue}const c=Object.keys(s);for(let t=c.length-1;t>=0;t--)r.push(s[c[t]])}return!1}(e))return Fw(e,t);if(void 0===this._serializeWorker&&(this._serializeWorker=(null===Hw&&(Hw=new xw),Hw)),null===this._serializeWorker)return Fw(e,t);try{const n=await this._serializeWorker.serialize(e);return null===n?(this._serializeWorker=null,Fw(e,t)):n}catch{return Fw(e,t)}}constructor(e={}){Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"webUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"workspaceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"caller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchIngestCaller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout_ms",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tenantId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"hideInputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideOutputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideMetadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"anonymizer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"omitTracedRuntimeInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingSampleRate",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"autoBatchTracing",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"autoBatchQueue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"autoBatchTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"autoBatchAggregationDelayMs",{enumerable:!0,configurable:!0,writable:!0,value:250}),Object.defineProperty(this,"batchSizeBytesLimit",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchSizeLimit",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fetchOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_fetchOptionsHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_openAPIClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_openAPIClientSignature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"settings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"blockOnRootRunFinalization",{enumerable:!0,configurable:!0,writable:!0,value:"false"===LT("LANGSMITH_TRACING_BACKGROUND")}),Object.defineProperty(this,"traceBatchConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:5}),Object.defineProperty(this,"_serverInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_getServerInfoPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_stainlessVersionsChecked",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"manualFlushMode",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_serializeWorker",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pendingDrains",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"langSmithToOTELTranslator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tracingMode",{enumerable:!0,configurable:!0,writable:!0,value:"langsmith"}),Object.defineProperty(this,"fetchImplementation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cachedLSEnvVarsForMetadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_promptCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"profileAuth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"multipartStreamingDisabled",{enumerable:!0,configurable:!0,writable:!0,value:"true"===NT("DISABLE_MULTIPART_STREAMING")}),Object.defineProperty(this,"_multipartDisabled",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_runCompressionDisabled",{enumerable:!0,configurable:!0,writable:!0,value:"true"===NT("DISABLE_RUN_COMPRESSION")}),Object.defineProperty(this,"failedTracesDir",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"failedTracesMaxBytes",{enumerable:!0,configurable:!0,writable:!0,value:104857600}),Object.defineProperty(this,"_customHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"debug",{enumerable:!0,configurable:!0,writable:!0,value:"true"===LT("LANGSMITH_DEBUG")});const t=zw.getDefaultClientConfig();this.tracingSampleRate=(e=>{const t=e?.toString()??NT("TRACING_SAMPLING_RATE");if(void 0===t)return;const n=parseFloat(t);if(n<0||n>1)throw new Error(`LANGSMITH_TRACING_SAMPLING_RATE must be between 0 and 1 if set. Got: ${n}`);return n})(e.tracingSamplingRate),this.apiUrl=jw(e.apiUrl??t.apiUrl)??"",this.apiUrl.endsWith("/")&&(this.apiUrl=this.apiUrl.slice(0,-1));const n=jw(e.apiKey??t.apiKey);if(this.apiKey=Cw(n)?n:void 0,this.profileAuth=void 0!==this.apiKey?void 0:t.profileAuth,this.webUrl=jw(e.webUrl??t.webUrl),this.webUrl?.endsWith("/")&&(this.webUrl=this.webUrl.slice(0,-1)),this.workspaceId=jw(e.workspaceId??t.workspaceId),this.timeout_ms=e.timeout_ms??9e4,this.caller=new Iv({...e.callerOptions??{},maxRetries:4,debug:e.debug??this.debug}),this.traceBatchConcurrency=e.traceBatchConcurrency??this.traceBatchConcurrency,this.traceBatchConcurrency<1)throw new Error("Trace batch concurrency must be positive.");this.debug=e.debug??this.debug,this.fetchImplementation=e.fetchImplementation,this.failedTracesDir=NT("FAILED_TRACES_DIR")||void 0;const r=NT("FAILED_TRACES_MAX_MB");if(r){const e=parseInt(r,10);Number.isFinite(e)&&e>0&&(this.failedTracesMaxBytes=1024*e*1024)}const i=e.maxIngestMemoryBytes??Kw;this.batchIngestCaller=new Iv({maxRetries:4,maxConcurrency:this.traceBatchConcurrency,maxQueueSizeBytes:i,...e.callerOptions??{},onFailedResponseHook:Ww,debug:e.debug??this.debug}),this.hideInputs=e.hideInputs??e.anonymizer??t.hideInputs,this.hideOutputs=e.hideOutputs??e.anonymizer??t.hideOutputs,this.hideMetadata=e.hideMetadata??e.anonymizer??t.hideMetadata,this.anonymizer=e.anonymizer,this.omitTracedRuntimeInfo=e.omitTracedRuntimeInfo??!1,this.autoBatchTracing=e.autoBatchTracing??this.autoBatchTracing,this.autoBatchQueue=new Jw(i),this.blockOnRootRunFinalization=e.blockOnRootRunFinalization??this.blockOnRootRunFinalization,this.batchSizeBytesLimit=e.batchSizeBytesLimit,this.batchSizeLimit=e.batchSizeLimit;const{headers:a,...o}=e.fetchOptions||{};this.fetchOptions=o,this._fetchOptionsHeaders=Qw(a),qw(e.headers),this._customHeaders=e.headers??{},this.manualFlushMode=e.manualFlushMode??this.manualFlushMode,this._tracingMode=DT(e.tracingMode),"otel"===this._tracingMode&&(this.langSmithToOTELTranslator=new XT),this.cachedLSEnvVarsForMetadata=RT(),void 0!==e.cache&&e.disablePromptCache&&rb("Both 'cache' and 'disablePromptCache' were provided. The 'cache' parameter is deprecated and will be removed in a future version. Using 'cache' parameter value."),void 0!==e.cache?(rb("The 'cache' parameter is deprecated and will be removed in a future version. Use 'configureGlobalPromptCache()' to configure the global cache, or 'disablePromptCache: true' to disable caching for this client."),!1===e.cache?this._promptCache=void 0:!0===e.cache?this._promptCache=oT:this._promptCache=e.cache):e.disablePromptCache||(this._promptCache=oT)}static getDefaultClientConfig(){const e=function(){const e=Iw(),t=e?.profile;if(!e||!t)return{};const n=Aw(t.api_key),r=Aw(t.oauth?.access_token),i=Aw(t.oauth?.refresh_token);return{apiUrl:t.api_url,apiKey:n,workspaceId:t.workspace_id,oauthAccessToken:r,oauthRefreshToken:i,profileAuth:n||r||i?new Ew(e):void 0}}(),t=NT("API_KEY"),n=NT("ENDPOINT"),r=NT("WORKSPACE_ID"),i=Cw(t),a=n??e.apiUrl??gw,o=r??e.workspaceId;return{apiUrl:a,apiKey:t,webUrl:void 0,hideInputs:"true"===NT("HIDE_INPUTS"),hideOutputs:"true"===NT("HIDE_OUTPUTS"),hideMetadata:"true"===NT("HIDE_METADATA"),workspaceId:o,oauthAccessToken:i?void 0:e.oauthAccessToken,oauthRefreshToken:i?void 0:e.oauthRefreshToken,profileAuth:i?void 0:e.profileAuth}}getHostUrl(){return this.webUrl?this.webUrl:(e=>{const t=e.replace("http://","").replace("https://","").split("/")[0].split(":")[0];return"localhost"===t||"127.0.0.1"===t||"::1"===t})(this.apiUrl)?(this.webUrl="http://localhost:3000",this.webUrl):this.apiUrl.endsWith("/api/v1")?(this.webUrl=this.apiUrl.replace("/api/v1",""),this.webUrl):this.apiUrl.includes("/api")&&!this.apiUrl.split(".",1)[0].endsWith("api")?(this.webUrl=this.apiUrl.replace("/api",""),this.webUrl):this.apiUrl.split(".",1)[0].includes("dev")?(this.webUrl="https://dev.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("eu")?(this.webUrl="https://eu.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("aws")?(this.webUrl="https://aws.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("apac")?(this.webUrl="https://apac.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("beta")?(this.webUrl="https://beta.smith.langchain.com",this.webUrl):(this.webUrl="https://smith.langchain.com",this.webUrl)}get _sdkControlledHeaders(){const e=new Set;if(void 0!==this.apiKey)e.add("x-api-key");else{const t=this.profileAuth?.currentAuthHeader();t&&e.add(t.name.toLowerCase())}return this.workspaceId&&e.add("x-tenant-id"),e}get _callerHeaders(){return function(e,t,n){const r={...e},i=new Map(Object.keys(r).map(e=>[e.toLowerCase(),e]));for(const[a,o]of Object.entries(t)){const e=a.toLowerCase();r[i.get(e)??a]=o}for(const a of Object.keys(r))n.has(a.toLowerCase())&&delete r[a];return r}(Qw(this._customHeaders),this._fetchOptionsHeaders,this._sdkControlledHeaders)}get _mergedHeaders(){const e={"User-Agent":`langsmith-js/${ST}`,...this._callerHeaders};if(void 0!==this.apiKey)e["x-api-key"]=`${this.apiKey}`;else{const t=this.profileAuth?.currentAuthHeader();t&&(e[t.name]=t.value)}return this.workspaceId&&(e["x-tenant-id"]=this.workspaceId),e}get _openAPIClientOptions(){const e={...this._callerHeaders};Object.keys(e).some(e=>"user-agent"===e.toLowerCase())||(e["User-Agent"]=`langsmith-js/${ST}`);const t=Object.keys(e).find(e=>"x-api-key"===e.toLowerCase());let n=this.apiKey;return void 0===n&&void 0!==t&&(n=e[t]??void 0,delete e[t]),void 0===n&&void 0===this.workspaceId&&(e["X-API-Key"]=null),{apiKey:n,defaultHeaders:Object.keys(e).length>0?e:void 0}}get headers(){return this._customHeaders}set headers(e){qw(e),this._customHeaders=e??{}}_getOpenAPIBaseUrl(){const e=this.apiUrl.replace(/\/$/,"");for(const t of["/api/v1","/api"])if(e.endsWith(t))return e.slice(0,-t.length);return e}get openAPIClient(){const e=this._openAPIClientOptions,t=JSON.stringify([e.apiKey,e.defaultHeaders]);return void 0!==this._openAPIClient&&this._openAPIClientSignature===t||(this._openAPIClientSignature=t,this._openAPIClient=this._newOpenAPIClient(e)),this._openAPIClient}_newOpenAPIClient(e=this._openAPIClientOptions){const{method:t,body:n,signal:r,...i}=this.fetchOptions;return new Q_({apiKey:e.apiKey,tenantID:this.workspaceId,baseURL:this._getOpenAPIBaseUrl(),timeout:this.timeout_ms,fetch:this._fetch,fetchOptions:i,defaultHeaders:e.defaultHeaders})}_getPlatformEndpointPath(e){return"/v1"!==this.apiUrl.slice(-3)&&"/v1/"!==this.apiUrl.slice(-4)?`/v1/platform/${e}`:`/platform/${e}`}get evaluators(){return this._checkStainlessVersion("0.16.0"),this.openAPIClient.onlineEvaluators}get runs(){return this._checkStainlessVersion("0.16.0"),this.openAPIClient.runs}get sandboxes(){return this._checkStainlessVersion("0.16.0"),this.openAPIClient.sandboxes}get datasets(){return this._checkStainlessVersion("0.16.0"),this.openAPIClient.datasets}get annotationQueues(){return this._checkStainlessVersion("0.16.14"),this.openAPIClient.annotationQueues}get threads(){return this._checkStainlessVersion("0.16.0"),this.openAPIClient.threads}get traces(){return this._checkStainlessVersion("0.16.0"),this.openAPIClient.traces}get public(){return this._checkStainlessVersion("0.16.0"),this.openAPIClient.public}async processInputs(e){return!1===this.hideInputs?e:!0===this.hideInputs?{}:"function"==typeof this.hideInputs?this.hideInputs(e):e}async processOutputs(e){return!1===this.hideOutputs?e:!0===this.hideOutputs?{}:"function"==typeof this.hideOutputs?this.hideOutputs(e):e}async processMetadata(e){return!1===this.hideMetadata?e:!0===this.hideMetadata?{}:"function"==typeof this.hideMetadata?this.hideMetadata(e):e}async processError(e){if(null==this.anonymizer)return e;const t=await this.anonymizer({error:e});return"string"==typeof t?.error?t.error:e}_filterNewTokenEvents(e){return e&&0!==e.length?e.map(e=>{if("new_token"===e.name){const{kwargs:t,...n}=e;return n}return e}):e}async prepareRunCreateOrUpdateInputs(e){const t={...e};return void 0!==t.inputs&&(t.inputs=await this.processInputs(t.inputs)),void 0!==t.outputs&&(t.outputs=await this.processOutputs(t.outputs)),void 0!==t.error&&(t.error=await this.processError(t.error)),null!=t.extra&&"metadata"in t.extra&&(t.extra={...t.extra,metadata:await this.processMetadata(t.extra.metadata)}),void 0!==t.events&&(t.events=this._filterNewTokenEvents(t.events)),t}async _getResponse(e,t){const n=t?.toString()??"",r=`${this.apiUrl}${e}?${n}`;return await this.caller.call(async()=>{const t=await this._fetch(r,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(t,`fetch ${e}`),t})}async _get(e,t){return(await this._getResponse(e,t)).json()}async*_getPaginated(e,t=new URLSearchParams,n){let r=Number(t.get("offset"))||0;const i=Number(t.get("limit"))||100;for(;;){t.set("offset",String(r)),t.set("limit",String(i));const a=`${this.apiUrl}${e}?${t}`,o=await this.caller.call(async()=>{const t=await this._fetch(a,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(t,`fetch ${e}`),t}),s=n?n(await o.json()):await o.json();if(0===s.length)break;if(yield s,s.length<i)break;r+=s.length}}async*_getCursorPaginatedList(e,t=null,n="POST",r="runs"){const i=t?{...t}:{};for(;;){const t=JSON.stringify(i),a=await this.caller.call(async()=>{const r=await this._fetch(`${this.apiUrl}${e}`,{method:n,headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:t});return await ow(r,`fetch ${e}`),r}),o=await a.json();if(!o)break;if(!o[r])break;yield o[r];const s=o.cursors;if(!s)break;if(!s.next)break;i.cursor=s.next}}_shouldSample(e){return((e,t)=>{if(void 0===t||t>=1)return!0;if(t<=0)return!1;if(null==e)return!0;const n=Vb(z_.encode(e.toLowerCase()))%J_;return Number(n)/Number(J_)<t})(e,this.tracingSampleRate)}_filterForSampling(e){return e.filter(e=>this._shouldSample(e.trace_id??e.dotted_order?.split(".",1)[0].split("Z")[1]??e.id))}async _getBatchSizeLimitBytes(){const e=await this._ensureServerInfo();return this.batchSizeBytesLimit??e?.batch_ingest_config?.size_limit_bytes??25165824}async _getBatchSizeLimit(){const e=await this._ensureServerInfo();return this.batchSizeLimit??e?.batch_ingest_config?.size_limit??100}async _getDatasetExamplesMultiPartSupport(){const e=await this._ensureServerInfo();return e.instance_flags?.dataset_examples_multipart_enabled??!1}drainAutoBatchQueue({batchSizeLimitBytes:e,batchSizeLimit:t}){const n=[];for(;this.autoBatchQueue.items.length>0;){const[r,i]=this.autoBatchQueue.pop({upToSizeBytes:e,upToSize:t});if(!r.length){i();break}const a=r.reduce((e,t)=>{const n=t.apiUrl??this.apiUrl,r=t.apiKey??this.apiKey,i=t.workspaceId??this.workspaceId,a=t.apiKey===this.apiKey&&t.apiUrl===this.apiUrl&&t.workspaceId===this.workspaceId?"default":`${n}|${r}|${i??""}`;return e[a]||(e[a]=[]),e[a].push(t),e},{}),o=[];for(const[e,t]of Object.entries(a)){const n="default"===e,r=n?[]:e.split("|"),i=r[2],a=this._processBatch(t,{apiUrl:n?void 0:r[0],apiKey:n?void 0:r[1],workspaceId:n||!i?void 0:i});o.push(a)}const s=Promise.all(o).finally(i);n.push(s)}return Promise.all(n)}static async _writeTraceToFallbackDir(e,t,n,r,i){try{const a="string"==typeof t?Buffer.from(t,"utf8"):Buffer.from(t),o=(JSON.stringify({version:1,endpoint:r,headers:n,body_base64:a.toString("base64")}),`trace_${Date.now()}_${kS().slice(0,8)}.json`),s=zb(e,o);if(zw._fallbackDirsCreated.has(e)||(await eT(),zw._fallbackDirsCreated.add(e)),void 0!==i&&i>0)try{const t=(await async function(){return[]}()).filter(e=>e.startsWith("trace_")&&e.endsWith(".json"));let n=0;for(const r of t){const{size:t}=await nT(zb(e,r));n+=t}if(n>=i)return void console.warn(`Could not write trace to fallback dir ${e} as it's already over size limit (${n} bytes >= ${i} bytes). Increase LANGSMITH_FAILED_TRACES_MAX_MB if possible.`)}catch{}await tT(),console.warn(`LangSmith trace upload failed; data saved to ${s} for later replay.`)}catch(a){console.error(`LangSmith tracing error: could not write trace to fallback dir ${e}:`,a)}}async _processBatch(e,t){if(!e.length)return;const n=e.reduce((e,t)=>e+(t.size??0),0);try{if(void 0!==this.langSmithToOTELTranslator){for(const t of e)t.item=await this._maskRunMetadata(t.item);this._sendBatchToOTELTranslator(e)}else{const i={runCreates:e.filter(e=>"create"===e.action).map(e=>e.item),runUpdates:e.filter(e=>"update"===e.action).map(e=>e.item)},a=await this._ensureServerInfo();if(!this._multipartDisabled&&(a?.batch_ingest_config?.use_multipart_endpoint??!0)){const e=!this._runCompressionDisabled&&a?.instance_flags?.gzip_body_enabled;try{await this.multipartIngestRuns(i,{...t,useGzip:e,sizeBytes:n})}catch(r){if(!aw(r))throw r;this._multipartDisabled=!0,await this.batchIngestRuns(i,{...t,sizeBytes:n})}}else await this.batchIngestRuns(i,{...t,sizeBytes:n})}}catch(r){console.error("Error exporting batch:",r)}}_sendBatchToOTELTranslator(e){if(void 0!==this.langSmithToOTELTranslator){const t=new Map,n=[];for(const r of e)r.item.id&&r.otelContext&&(t.set(r.item.id,r.otelContext),"create"===r.action?n.push({operation:"post",id:r.item.id,trace_id:r.item.trace_id??r.item.id,run:r.item}):n.push({operation:"patch",id:r.item.id,trace_id:r.item.trace_id??r.item.id,run:r.item}));this.langSmithToOTELTranslator.exportBatch(n,t)}}async _maskRunMetadata(e){return null==e.extra?.metadata?e:{...e,extra:{...e.extra,metadata:await this.processMetadata(e.extra.metadata)}}}async _mergeRuntimeEnvAndMaskMetadata(e){const t=$w(e,this.cachedLSEnvVarsForMetadata,this.omitTracedRuntimeInfo);return this.omitTracedRuntimeInfo?t:this._maskRunMetadata(t)}async processRunOperation(e){clearTimeout(this.autoBatchTimeout),this.autoBatchTimeout=void 0,e.item=$w(e.item,this.cachedLSEnvVarsForMetadata,this.omitTracedRuntimeInfo);const t=this.autoBatchQueue.push(e);if(this.manualFlushMode)return t;const n=await this._getBatchSizeLimitBytes(),r=await this._getBatchSizeLimit();return(this.autoBatchQueue.sizeBytes>n||this.autoBatchQueue.items.length>r)&&this._trackDrain(this.drainAutoBatchQueue({batchSizeLimitBytes:n,batchSizeLimit:r})),this.autoBatchQueue.items.length>0&&(this.autoBatchTimeout=setTimeout(()=>{this.autoBatchTimeout=void 0,this._trackDrain(this.drainAutoBatchQueue({batchSizeLimitBytes:n,batchSizeLimit:r}))},this.autoBatchAggregationDelayMs)),t}async _getServerInfo(){const e=await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/info`,{method:"GET",headers:{...this._mergedHeaders,Accept:"application/json"},signal:AbortSignal.timeout(1e4),...this.fetchOptions});return await ow(e,"get server info"),e}),t=await e.json();return this.debug&&console.log("\n=== LangSmith Server Configuration ===\n"+JSON.stringify(t,null,2)+"\n"),t}_checkStainlessVersion(e){this._stainlessVersionsChecked.has(e)||(this._stainlessVersionsChecked.add(e),this._ensureServerInfo().then(t=>{!function(e,t){if(!e)return;const n=e=>e.split(".").map(e=>parseInt(e,10)),[r,i,a]=n(e),[o,s,c]=n(t);isNaN(r)||isNaN(i)||isNaN(a)||isNaN(o)||isNaN(s)||isNaN(c)?console.warn(`[LANGSMITH]: Could not parse backend version ${JSON.stringify(e)} for compatibility check.`):(r<o||r===o&&i<s||r===o&&i===s&&a<c)&&console.warn(`[LANGSMITH]: Backend version ${JSON.stringify(e)} is older than the minimum version required by this SDK (${JSON.stringify(t)}). Some features may not work as expected. See https://docs.langchain.com/langsmith/smithdb-sdk-migration`)}(t?.version,e)}).catch(()=>{}))}async _ensureServerInfo(){return void 0===this._getServerInfoPromise&&(this._getServerInfoPromise=(async()=>{if(void 0===this._serverInfo)try{this._serverInfo=await this._getServerInfo()}catch(e){console.warn(`[LANGSMITH]: Failed to fetch info on supported operations. Falling back to batch operations and default limits. Info: ${e.status??"Unspecified status code"} ${e.message}`)}return this._serverInfo??{}})()),this._getServerInfoPromise.then(e=>(void 0===this._serverInfo&&(this._getServerInfoPromise=void 0),e))}async _supportsSDBQuery(){const e=await this._ensureServerInfo();return!0===e.instance_flags?.sdb_query_enabled}async _checkFeedbackSessionId(){const e="https://docs.langchain.com/langsmith/smithdb-sdk-migration-feedback#feedback-create";if(function(e){const t=e??{},n=Boolean(t.ch_query_enabled??!0),r=Boolean(t.sdb_query_enabled??!1);return!n&&r?ew:n&&r?tw:Z_}((await this._ensureServerInfo()).instance_flags)===ew)throw new Error(`sessionId must be provided when creating feedback for a run: this deployment cannot locate the run without it. See ${e}`);rb(`Creating feedback for a run without sessionId is deprecated and will stop working in a future release. See ${e}`)}async _getSettings(){return this.settings||(this.settings=this._get("/settings")),await this.settings}async flush(){const e=await this._getBatchSizeLimitBytes(),t=await this._getBatchSizeLimit();await this.drainAutoBatchQueue({batchSizeLimitBytes:e,batchSizeLimit:t})}_cloneCurrentOTELContext(){const e=$T(),t=VT.getContextInstance();if(void 0!==this.langSmithToOTELTranslator){const n=e.getActiveSpan();if(n)return e.setSpan(t.active(),n)}}async createRun(e,t){if(!this._filterForSampling([e]).length)return;const n={...this._mergedHeaders,"Content-Type":"application/json"},r=e.project_name;delete e.project_name;const i=await this.prepareRunCreateOrUpdateInputs({session_name:r,...e,start_time:e.start_time??Date.now()});if(this.autoBatchTracing&&void 0!==i.trace_id&&void 0!==i.dotted_order){const e=this._cloneCurrentOTELContext();return void this.processRunOperation({action:"create",item:i,otelContext:e,apiKey:t?.apiKey,apiUrl:t?.apiUrl,workspaceId:t?.workspaceId}).catch(console.error)}const a=await this._mergeRuntimeEnvAndMaskMetadata(i);void 0!==t?.apiKey&&(n["x-api-key"]=t.apiKey),void 0!==t?.workspaceId&&(n["x-tenant-id"]=t.workspaceId);const o=Fw(a,`Creating run with id: ${a.id}`);await this.caller.call(async()=>{const e=await this._fetch(`${t?.apiUrl??this.apiUrl}/runs`,{method:"POST",headers:n,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:o});return await ow(e,"create run",!0),e})}async batchIngestRuns({runCreates:e,runUpdates:t},n){if(void 0===e&&void 0===t)return;let r=await Promise.all(e?.map(e=>this.prepareRunCreateOrUpdateInputs(e))??[]),i=await Promise.all(t?.map(e=>this.prepareRunCreateOrUpdateInputs(e))??[]);if(r.length>0&&i.length>0){const e=r.reduce((e,t)=>t.id?(e[t.id]=t,e):e,{}),t=[];for(const n of i)void 0!==n.id&&e[n.id]?e[n.id]={...e[n.id],...n}:t.push(n);r=Object.values(e),i=t}const a={post:r,patch:i};if(!a.post.length&&!a.patch.length)return;const o={post:[],patch:[]};for(const s of["post","patch"]){const e=s,t=a[e].reverse();let n=t.pop();for(;void 0!==n;)o[e].push(n),n=t.pop()}if(o.post.length>0||o.patch.length>0){const e=o.post.map(e=>e.id).concat(o.patch.map(e=>e.id)).join(",");await this._postBatchIngestRuns(await this._serializeBody(o,`Ingesting runs with ids: ${e}`),n)}}async _postBatchIngestRuns(e,t){const n={...this._mergedHeaders,"Content-Type":"application/json",Accept:"application/json"};void 0!==t?.apiKey&&(n["x-api-key"]=t.apiKey),void 0!==t?.workspaceId&&(n["x-tenant-id"]=t.workspaceId),await this.batchIngestCaller.callWithOptions({sizeBytes:t?.sizeBytes},async()=>{const r=await this._fetch(`${t?.apiUrl??this.apiUrl}/runs/batch`,{method:"POST",headers:n,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:e});return await ow(r,"batch create run",!0),r})}async multipartIngestRuns({runCreates:e,runUpdates:t},n){if(void 0===e&&void 0===t)return;const r={};let i=[];for(const c of e??[]){const e=await this.prepareRunCreateOrUpdateInputs(c);void 0!==e.id&&void 0!==e.attachments&&(r[e.id]=e.attachments),delete e.attachments,i.push(e)}let a=[];for(const c of t??[])a.push(await this.prepareRunCreateOrUpdateInputs(c));if(void 0!==i.find(e=>void 0===e.trace_id||void 0===e.dotted_order))throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when creating a run');if(void 0!==a.find(e=>void 0===e.trace_id||void 0===e.dotted_order))throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when updating a run');if(i.length>0&&a.length>0){const e=i.reduce((e,t)=>t.id?(e[t.id]=t,e):e,{}),t=[];for(const n of a)void 0!==n.id&&e[n.id]?e[n.id]={...e[n.id],...n}:t.push(n);i=Object.values(e),a=t}if(0===i.length&&0===a.length)return;const o=[],s=[];for(const[c,l]of[["post",i],["patch",a]])for(const e of l){const{inputs:t,outputs:n,events:i,extra:a,error:l,serialized:u,attachments:d,...p}=e,h={inputs:t,outputs:n,events:i,extra:a,error:l,serialized:u},f=await this._serializeBody(p,`Serializing for multipart ingestion of run with id: ${p.id}`);s.push({name:`${c}.${p.id}`,payload:new Blob([f],{type:`application/json; length=${f.length}`})});for(const[e,r]of Object.entries(h)){if(void 0===r)continue;const t=await this._serializeBody(r,`Serializing ${e} for multipart ingestion of run with id: ${p.id}`);s.push({name:`${c}.${p.id}.${e}`,payload:new Blob([t],{type:`application/json; length=${t.length}`})})}if(void 0!==p.id){const e=r[p.id];if(e){delete r[p.id];for(const[t,n]of Object.entries(e)){let e,r;Array.isArray(n)?[e,r]=n:(e=n.mimeType,r=n.data),t.includes(".")?console.warn(`Skipping attachment '${t}' for run ${p.id}: Invalid attachment name. Attachment names must not contain periods ('.'). Please rename the attachment and try again.`):s.push({name:`attachment.${p.id}.${t}`,payload:new Blob([r],{type:`${e}; length=${r.byteLength}`})})}}}o.push(`trace=${p.trace_id},id=${p.id}`)}await this._sendMultipartRequest(s,o.join("; "),n)}async _createNodeFetchBody(e,t){const n=[];for(const i of e)n.push(new Blob([`--${t}\r\n`])),n.push(new Blob([`Content-Disposition: form-data; name="${i.name}"\r\n`,`Content-Type: ${i.payload.type}\r\n\r\n`])),n.push(i.payload),n.push(new Blob(["\r\n"]));n.push(new Blob([`--${t}--\r\n`]));const r=new Blob(n);return await r.arrayBuffer()}async _createMultipartStream(e,t){const n=new TextEncoder;return new ReadableStream({async start(r){const i=async e=>{"string"==typeof e?r.enqueue(n.encode(e)):r.enqueue(e)};for(const n of e){await i(`--${t}\r\n`),await i(`Content-Disposition: form-data; name="${n.name}"\r\n`),await i(`Content-Type: ${n.payload.type}\r\n\r\n`);const e=n.payload.stream().getReader();try{let t;for(;!(t=await e.read()).done;)r.enqueue(t.value)}finally{e.releaseLock()}await i("\r\n")}await i(`--${t}--\r\n`),r.close()}})}async _sendMultipartRequest(e,t,n){const r="----LangSmithFormBoundary"+Math.random().toString(36).slice(2),i=()=>this._createNodeFetchBody(e,r),a=()=>this._createMultipartStream(e,r),o=async e=>this.batchIngestCaller.callWithOptions({sizeBytes:n?.sizeBytes},async()=>{const t=await e(),i={...this._mergedHeaders,"Content-Type":`multipart/form-data; boundary=${r}`};void 0!==n?.apiKey&&(i["x-api-key"]=n.apiKey),void 0!==n?.workspaceId&&(i["x-tenant-id"]=n.workspaceId);let a=t;n?.useGzip&&"object"==typeof t&&"pipeThrough"in t&&(a=t.pipeThrough(new CompressionStream("gzip")),i["Content-Encoding"]="gzip");const o=await this._fetch(`${n?.apiUrl??this.apiUrl}/runs/multipart`,{method:"POST",headers:i,body:a,duplex:"half",signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(o,"Failed to send multipart request",!0),o});try{let e,r=!1;void 0===globalThis[ZS]&&!this.multipartStreamingDisabled&&"bun"!==vT()?(r=!0,e=await o(a)):e=await o(i),this.multipartStreamingDisabled&&!r||422!==e.status||(n?.apiUrl??this.apiUrl)===gw||(console.warn(`Streaming multipart upload to ${n?.apiUrl??this.apiUrl}/runs/multipart failed. This usually means the host does not support chunked uploads. Retrying with a buffered upload for operation "${t}".`),this.multipartStreamingDisabled=!0,e=await o(i))}catch(s){if(aw(s))throw s;if(console.warn(`${s.message.trim()}\n\nContext: ${t}`),this.failedTracesDir){const t=await this._createNodeFetchBody(e,r).catch(()=>null);t&&await zw._writeTraceToFallbackDir(this.failedTracesDir,t,{"Content-Type":`multipart/form-data; boundary=${r}`},"runs/multipart",this.failedTracesMaxBytes)}}}async updateRun(e,t,n){jb(e),t.inputs&&(t.inputs=await this.processInputs(t.inputs)),t.outputs&&(t.outputs=await this.processOutputs(t.outputs)),t.error&&(t.error=await this.processError(t.error)),null!=t.extra&&"metadata"in t.extra&&(t.extra={...t.extra,metadata:await this.processMetadata(t.extra.metadata)}),t.events&&(t.events=this._filterNewTokenEvents(t.events));const r={...t,id:e};if(!this._filterForSampling([r]).length)return;if(this.autoBatchTracing&&void 0!==r.trace_id&&void 0!==r.dotted_order){const e=this._cloneCurrentOTELContext();return void 0!==t.end_time&&void 0===r.parent_run_id&&this.blockOnRootRunFinalization&&!this.manualFlushMode?void(await this.processRunOperation({action:"update",item:r,otelContext:e,apiKey:n?.apiKey,apiUrl:n?.apiUrl,workspaceId:n?.workspaceId}).catch(console.error)):void this.processRunOperation({action:"update",item:r,otelContext:e,apiKey:n?.apiKey,apiUrl:n?.apiUrl,workspaceId:n?.workspaceId}).catch(console.error)}const i={...this._mergedHeaders,"Content-Type":"application/json"};void 0!==n?.apiKey&&(i["x-api-key"]=n.apiKey),void 0!==n?.workspaceId&&(i["x-tenant-id"]=n.workspaceId);const a=Fw(t,`Serializing payload to update run with id: ${e}`);await this.caller.call(async()=>{const t=await this._fetch(`${n?.apiUrl??this.apiUrl}/runs/${e}`,{method:"PATCH",headers:i,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await ow(t,"update run",!0),t})}async readRun(e,{loadChildRuns:t}={loadChildRuns:!1}){return rb("readRun() is deprecated and will be removed after Jan 31, 2027. Use client.runs.retrieve() instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration-runs#runs-retrieve for the migration guide.",{type:"DeprecationWarning",code:"LANGSMITH_DEPRECATED_READ_RUN"}),this._readRun(e,{loadChildRuns:t})}async _readRun(e,{loadChildRuns:t}={loadChildRuns:!1}){jb(e);let n=Vw(await this._get(`/runs/${e}`));return t&&(n=await this._loadChildRuns(n)),n}async getRunUrl({runId:e,run:t,projectOpts:n}){if(rb("getRunUrl() is deprecated and will be removed after Jan 31, 2027. Use client.runs.getURL() instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration-runs#runs-get-url for the migration guide.",{type:"DeprecationWarning",code:"LANGSMITH_DEPRECATED_GET_RUN_URL"}),void 0!==t){let e;if(t.session_id)e=t.session_id;else if(n?.projectName)e=(await this.readProject({projectName:n?.projectName})).id;else if(n?.projectId)e=n?.projectId;else{e=(await this.readProject({projectName:NT("PROJECT")||"default"})).id}const r=await this._getTenantId();return`${this.getHostUrl()}/o/${r}/projects/p/${e}/r/${t.id}?poll=true`}if(void 0!==e){const t=await this._readRun(e);if(!t.app_path)throw new Error(`Run ${e} has no app_path`);return`${this.getHostUrl()}${t.app_path}`}throw new Error("Must provide either runId or run")}async _loadChildRuns(e){const t=await async function(e){const t=[];for await(const n of e)t.push(n);return t}(this._listRuns({isRoot:!1,projectId:e.session_id,traceId:e.trace_id})),n={},r={};t.sort((e,t)=>(e?.dotted_order??"").localeCompare(t?.dotted_order??""));for(const i of t){if(null===i.parent_run_id||void 0===i.parent_run_id)throw new Error(`Child run ${i.id} has no parent`);i.dotted_order?.startsWith(e.dotted_order??"")&&i.id!==e.id&&(i.parent_run_id in n||(n[i.parent_run_id]=[]),n[i.parent_run_id].push(i),r[i.id]=i)}e.child_runs=n[e.id]||[];for(const i in n)i!==e.id&&(r[i].child_runs=n[i]);return e}async*listRuns(e){rb("listRuns() is deprecated and will be removed after Jan 31, 2027. Use client.runs.query() instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration-query-runs#runs-query for the migration guide.",{type:"DeprecationWarning",code:"LANGSMITH_DEPRECATED_LIST_RUNS"}),yield*this._listRuns(e)}async*_listRuns(e){const{projectId:t,projectName:n,parentRunId:r,traceId:i,referenceExampleId:a,startTime:o,executionOrder:s,isRoot:c,runType:l,error:u,id:d,query:p,filter:h,traceFilter:f,treeFilter:m,limit:g,select:y,order:I}=e;let C=[];if(t&&(C=Array.isArray(t)?t:[t]),n){const e=Array.isArray(n)?n:[n],t=await Promise.all(e.map(e=>this.readProject({projectName:e}).then(e=>e.id)));C.push(...t)}const A={session:C.length?C:null,run_type:l,reference_example:a,query:p,filter:h,trace_filter:f,tree_filter:m,execution_order:s,parent_run:r,start_time:o?o.toISOString():null,error:u,id:d,limit:g,trace:i,select:y||["app_path","completion_cost","completion_tokens","dotted_order","end_time","error","events","extra","feedback_stats","first_token_time","id","inputs","name","outputs","parent_run_id","parent_run_ids","prompt_cost","prompt_tokens","reference_example_id","run_type","session_id","start_time","status","tags","total_cost","total_tokens","trace_id"],is_root:c,order:I};A.select.includes("child_run_ids")&&rb("Deprecated: 'child_run_ids' in the listRuns select parameter is deprecated and will be removed in a future version.");let S=0;for await(const b of this._getCursorPaginatedList("/runs/query",A)){const e=b.map(Vw);if(g){if(S>=g)break;if(e.length+S>g){const t=e.slice(0,g-S);yield*t;break}S+=e.length,yield*e}else yield*e}}async*listGroupRuns(e){const{projectId:t,projectName:n,groupBy:r,filter:i,startTime:a,endTime:o,limit:s,offset:c}=e,l={session_id:t||(await this.readProject({projectName:n})).id,group_by:r,filter:i,start_time:a?a.toISOString():null,end_time:o?o.toISOString():null,limit:Number(s)||100};let u=Number(c)||0;const d="/runs/group",p=`${this.apiUrl}${d}`;for(;;){const e={...l,offset:u},t=Object.fromEntries(Object.entries(e).filter(([e,t])=>void 0!==t)),n=JSON.stringify(t),r=await this.caller.call(async()=>{const e=await this._fetch(p,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await ow(e,`Failed to fetch ${d}`),e}),i=await r.json(),{groups:a,total:o}=i;if(0===a.length)break;for(const s of a)yield s;if(u+=a.length,u>=o)break}}async*readThread(e){rb("readThread() is deprecated and will be removed after Jan 31, 2027. Use client.threads.listTraces() instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration-threads#threads-list-traces for the migration guide.",{type:"DeprecationWarning",code:"LANGSMITH_DEPRECATED_READ_THREAD"});const{threadId:t,projectId:n,projectName:r,isRoot:i=!0,limit:a,filter:o,order:s="asc"}=e;if(!n&&!r)throw new Error("threadId requires projectId or projectName");const c=`eq(thread_id, ${JSON.stringify(t)})`,l=o?`and(${c}, ${o})`:c;yield*this._listRuns({projectId:n??void 0,projectName:r??void 0,isRoot:i,limit:a,filter:l,order:s})}async listThreads(e){rb("listThreads() is deprecated and will be removed after Jan 31, 2027. Use client.threads.query() instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration-threads#threads-query for the migration guide.",{type:"DeprecationWarning",code:"LANGSMITH_DEPRECATED_LIST_THREADS"});const{projectId:t,projectName:n,limit:r,offset:i=0,filter:a,startTime:o,isRoot:s=!0}=e;if(!t&&!n)throw new Error("Either projectId or projectName must be provided");if(t&&n)throw new Error("Provide exactly one of projectId or projectName");const c={session:[t??(await this.readProject({projectName:n})).id],is_root:s,limit:100,order:"desc",select:["id","name","status","start_time","end_time","thread_id","trace_id","run_type","error","tags","session_id","parent_run_id","total_tokens","total_cost","dotted_order","reference_example_id","feedback_stats","app_path","completion_cost","completion_tokens","prompt_cost","prompt_tokens","first_token_time"],start_time:(o??new Date(Date.now()-864e5)).toISOString()};null!=a&&(c.filter=a);const l=new Map;for await(const p of this._getCursorPaginatedList("/runs/query",c))for(const e of p){const t=Vw(e),n=t.thread_id;if(n){const e=l.get(n)??[];e.push(t),l.set(n,e)}}const u=[];for(const[p,h]of l.entries()){h.sort((e,t)=>{const n=e,r=t,i=n.start_time??"",a=r.start_time??"";if(i!==a)return i.localeCompare(a);const o=n.dotted_order??"",s=r.dotted_order??"";return o.localeCompare(s)});const e=[...h.map(e=>e.start_time).filter(Boolean)].sort(),t=e.length?e[0]:"",n=e.length?e[e.length-1]:"";u.push({thread_id:p,runs:h,count:h.length,filter:"",total_tokens:0,total_cost:null,min_start_time:t,max_start_time:n,latency_p50:0,latency_p99:0,feedback_stats:null,first_inputs:"",last_outputs:"",last_error:null})}u.sort((e,t)=>{const n=e.max_start_time??"";return(t.max_start_time??"").localeCompare(n)});const d=i>0?u.slice(i):u;return void 0!==r?d.slice(0,r):d}async getRunStats({id:e,trace:t,parentRun:n,runType:r,projectNames:i,projectIds:a,referenceExampleIds:o,startTime:s,endTime:c,error:l,query:u,filter:d,traceFilter:p,treeFilter:h,isRoot:f,dataSourceType:m}){let g=a||[];if(i&&(g=[...a||[],...await Promise.all(i.map(e=>this.readProject({projectName:e}).then(e=>e.id)))]),0===g.length)throw new Error("At least one of projectNames or projectIds must be provided.");const y={id:e,trace:t,parent_run:n,run_type:r,session:g,reference_example:o,start_time:s,end_time:c,error:l,query:u,filter:d,trace_filter:p,tree_filter:h,is_root:f,data_source_type:m},I=Object.fromEntries(Object.entries(y).filter(([e,t])=>void 0!==t)),C=JSON.stringify(I),A=await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/runs/stats`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:C});return await ow(e,"get run stats"),e});return await A.json()}async shareRun(e,{shareId:t}={}){rb("shareRun() is deprecated and will be removed after Jan 31, 2027. Use client.runs.share.create() instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration-feedback#share-and-read-public-runs for the migration guide.",{type:"DeprecationWarning",code:"LANGSMITH_DEPRECATED_SHARE_RUN"});const n={run_id:e,share_token:t||kS()};jb(e);const r=JSON.stringify(n),i=await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"PUT",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:r});return await ow(t,"share run"),t}),a=await i.json();if(null===a||!("share_token"in a))throw new Error("Invalid response from server");return`${this.getHostUrl()}/public/${a.share_token}/r`}async unshareRun(e){rb("unshareRun() is deprecated and will be removed after Jan 31, 2027. Use client.runs.share.delete() instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration-feedback#share-and-read-public-runs for the migration guide.",{type:"DeprecationWarning",code:"LANGSMITH_DEPRECATED_UNSHARE_RUN"}),jb(e),await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(t,"unshare run",!0),t})}async readRunSharedLink(e){rb('readRunSharedLink() is deprecated and will be removed after Jan 31, 2027. Use client.runs.retrieve({ selects: ["SHARE_URL"] }) instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration-feedback#share-and-read-public-runs for the migration guide.',{type:"DeprecationWarning",code:"LANGSMITH_DEPRECATED_READ_RUN_SHARED_LINK"}),jb(e);const t=await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(t,"read run shared link"),t}),n=await t.json();if(null!==n&&"share_token"in n)return`${this.getHostUrl()}/public/${n.share_token}/r`}async listSharedRuns(e,{runIds:t}={}){rb("listSharedRuns() is deprecated and will be removed after Jan 31, 2027. Use client.public.runs.query() instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration-feedback#share-and-read-public-runs for the migration guide.",{type:"DeprecationWarning",code:"LANGSMITH_DEPRECATED_LIST_SHARED_RUNS"});const n=new URLSearchParams({share_token:e});if(void 0!==t)for(const i of t)n.append("id",i);jb(e);const r=await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/public/${e}/runs${n}`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(t,"list shared runs"),t});return(await r.json()).map(Vw)}async readDatasetSharedSchema(e,t){if(!e&&!t)throw new Error("Either datasetId or datasetName must be given");if(!e){const n=await this.readDataset({datasetName:t});e=n.id}jb(e);const n=await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(t,"read dataset shared schema"),t}),r=await n.json();return r.url=`${this.getHostUrl()}/public/${r.share_token}/d`,r}async shareDataset(e,t){if(!e&&!t)throw new Error("Either datasetId or datasetName must be given");if(!e){const n=await this.readDataset({datasetName:t});e=n.id}const n={dataset_id:e};jb(e);const r=JSON.stringify(n),i=await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"PUT",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:r});return await ow(t,"share dataset"),t}),a=await i.json();return a.url=`${this.getHostUrl()}/public/${a.share_token}/d`,a}async unshareDataset(e){jb(e),await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(t,"unshare dataset",!0),t})}async readSharedDataset(e){jb(e);const t=await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/public/${e}/datasets`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(t,"read shared dataset"),t});return await t.json()}async listSharedExamples(e,t){const n={};t?.exampleIds&&(n.id=t.exampleIds);const r=new URLSearchParams;Object.entries(n).forEach(([e,t])=>{Array.isArray(t)?t.forEach(t=>r.append(e,t)):r.append(e,t)});const i=await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/public/${e}/examples?${r.toString()}`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(t,"list shared examples"),t}),a=await i.json();if(!i.ok){if("detail"in a)throw new Error(`Failed to list shared examples.\nStatus: ${i.status}\nMessage: ${Array.isArray(a.detail)?a.detail.join("\n"):"Unspecified error"}`);throw new Error(`Failed to list shared examples: ${i.status} ${i.statusText}`)}return a.map(e=>({...e,_hostUrl:this.getHostUrl()}))}async createProject({projectName:e,description:t=null,metadata:n=null,upsert:r=!1,projectExtra:i=null,referenceDatasetId:a=null,numExamples:o=null,numRepetitions:s=null,evaluatorKeys:c=null,tagValueIds:l=null}){const u=r?"?upsert=true":"",d=`${this.apiUrl}/sessions${u}`,p=i||{};n&&(p.metadata=n);const h={name:e,extra:p,description:t};null!==a&&(h.reference_dataset_id=a),null!=o&&(h.num_examples=o),null!=s&&(h.num_repetitions=s),null!=c&&c.length>0&&(h.evaluator_keys=c),null!==l&&(h.tag_value_ids=l);const f=JSON.stringify(h),m=await this.caller.call(async()=>{const e=await this._fetch(d,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:f});return await ow(e,"create project"),e});return await m.json()}async updateProject(e,{name:t=null,description:n=null,metadata:r=null,projectExtra:i=null,endTime:a=null}){const o=`${this.apiUrl}/sessions/${e}`;let s=i;r&&(s={...s||{},metadata:r});const c=JSON.stringify({name:t,extra:s,description:n,end_time:a?new Date(a).toISOString():null}),l=await this.caller.call(async()=>{const e=await this._fetch(o,{method:"PATCH",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await ow(e,"update project"),e});return await l.json()}async hasProject({projectId:e,projectName:t}){let n="/sessions";const r=new URLSearchParams;if(void 0!==e&&void 0!==t)throw new Error("Must provide either projectName or projectId, not both");if(void 0!==e)jb(e),n+=`/${e}`;else{if(void 0===t)throw new Error("Must provide projectName or projectId");r.append("name",t)}const i=await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}${n}?${r}`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(e,"has project"),e});try{const e=await i.json();return!!i.ok&&(!Array.isArray(e)||e.length>0)}catch(a){return!1}}async readProject({projectId:e,projectName:t,includeStats:n}){let r="/sessions";const i=new URLSearchParams;if(void 0!==e&&void 0!==t)throw new Error("Must provide either projectName or projectId, not both");if(void 0!==e)jb(e),r+=`/${e}`;else{if(void 0===t)throw new Error("Must provide projectName or projectId");i.append("name",t)}void 0!==n&&i.append("include_stats",n.toString());const a=await this._get(r,i);let o;if(Array.isArray(a)){if(0===a.length)throw new Error(`Project[id=${e}, name=${t}] not found`);o=a[0]}else o=a;return o}async getProjectUrl({projectId:e,projectName:t}){if(void 0===e&&void 0===t)throw new Error("Must provide either projectName or projectId");const n=await this.readProject({projectId:e,projectName:t}),r=await this._getTenantId();return`${this.getHostUrl()}/o/${r}/projects/p/${n.id}`}async getDatasetUrl({datasetId:e,datasetName:t}){if(void 0===e&&void 0===t)throw new Error("Must provide either datasetName or datasetId");const n=await this.readDataset({datasetId:e,datasetName:t}),r=await this._getTenantId();return`${this.getHostUrl()}/o/${r}/datasets/${n.id}`}async _getTenantId(){if(null!==this._tenantId)return this._tenantId;const e=new URLSearchParams({limit:"1"});for await(const t of this._getPaginated("/sessions",e))return this._tenantId=t[0].tenant_id,t[0].tenant_id;throw new Error("No projects found to resolve tenant.")}async*listProjects({projectIds:e,name:t,nameContains:n,referenceDatasetId:r,referenceDatasetName:i,includeStats:a,datasetVersion:o,referenceFree:s,metadata:c}={}){const l=new URLSearchParams;if(void 0!==e)for(const u of e)l.append("id",u);if(void 0!==t&&l.append("name",t),void 0!==n&&l.append("name_contains",n),void 0!==r)l.append("reference_dataset",r);else if(void 0!==i){const e=await this.readDataset({datasetName:i});l.append("reference_dataset",e.id)}void 0!==a&&l.append("include_stats",a.toString()),void 0!==o&&l.append("dataset_version",o),void 0!==s&&l.append("reference_free",s.toString()),void 0!==c&&l.append("metadata",JSON.stringify(c));for await(const u of this._getPaginated("/sessions",l))yield*u}async deleteProject({projectId:e,projectName:t}){let n;if(void 0===e&&void 0===t)throw new Error("Must provide projectName or projectId");if(void 0!==e&&void 0!==t)throw new Error("Must provide either projectName or projectId, not both");n=void 0===e?(await this.readProject({projectName:t})).id:e,jb(n),await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/sessions/${n}`,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(e,`delete session ${n} (${t})`,!0),e})}async uploadCsv({csvFile:e,fileName:t,inputKeys:n,outputKeys:r,description:i,dataType:a,name:o}){const s=`${this.apiUrl}/datasets/upload`,c=new FormData,l=new Blob([e],{type:"text/csv"});c.append("file",l,t),n.forEach(e=>{c.append("input_keys",e)}),r.forEach(e=>{c.append("output_keys",e)}),i&&c.append("description",i),a&&c.append("data_type",a),o&&c.append("name",o);const u=await this.caller.call(async()=>{const e=await this._fetch(s,{method:"POST",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await ow(e,"upload CSV"),e});return await u.json()}async createDataset(e,{description:t,dataType:n,inputsSchema:r,outputsSchema:i,metadata:a,tagValueIds:o}={}){const s={name:e,description:t,extra:{source:"sdk",...a?{metadata:a}:{}}};n&&(s.data_type=n),r&&(s.inputs_schema_definition=r),i&&(s.outputs_schema_definition=i),void 0!==o&&(s.tag_value_ids=o);const c=JSON.stringify(s),l=await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/datasets`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await ow(e,"create dataset"),e});return await l.json()}async readDataset({datasetId:e,datasetName:t}){let n="/datasets";const r=new URLSearchParams({limit:"1"});if(e&&t)throw new Error("Must provide either datasetName or datasetId, not both");if(e)jb(e),n+=`/${e}`;else{if(!t)throw new Error("Must provide datasetName or datasetId");r.append("name",t)}const i=await this._get(n,r);let a;if(Array.isArray(i)){if(0===i.length)throw new Error(`Dataset[id=${e}, name=${t}] not found`);a=i[0]}else a=i;return a}async hasDataset({datasetId:e,datasetName:t}){try{return await this.readDataset({datasetId:e,datasetName:t}),!0}catch(n){if(n instanceof Error&&n.message.toLocaleLowerCase().includes("not found"))return!1;throw n}}async diffDatasetVersions({datasetId:e,datasetName:t,fromVersion:n,toVersion:r}){let i=e;if(void 0===i&&void 0===t)throw new Error("Must provide either datasetName or datasetId");if(void 0!==i&&void 0!==t)throw new Error("Must provide either datasetName or datasetId, not both");if(void 0===i){i=(await this.readDataset({datasetName:t})).id}const a=new URLSearchParams({from_version:"string"==typeof n?n:n.toISOString(),to_version:"string"==typeof r?r:r.toISOString()});return await this._get(`/datasets/${i}/versions/diff`,a)}async readDatasetOpenaiFinetuning({datasetId:e,datasetName:t}){if(void 0!==e);else{if(void 0===t)throw new Error("Must provide either datasetName or datasetId");e=(await this.readDataset({datasetName:t})).id}const n=await this._getResponse(`/datasets/${e}/openai_ft`);return(await n.text()).trim().split("\n").map(e=>JSON.parse(e))}async*listDatasets({limit:e=100,offset:t=0,datasetIds:n,datasetName:r,datasetNameContains:i,metadata:a}={}){const o=new URLSearchParams({limit:e.toString(),offset:t.toString()});if(void 0!==n)for(const s of n)o.append("id",s);void 0!==r&&o.append("name",r),void 0!==i&&o.append("name_contains",i),void 0!==a&&o.append("metadata",JSON.stringify(a));for await(const s of this._getPaginated("/datasets",o))yield*s}async updateDataset(e){const{datasetId:t,datasetName:n,...r}=e;if(!t&&!n)throw new Error("Must provide either datasetName or datasetId");const i=t??(await this.readDataset({datasetName:n})).id;jb(i);const a=JSON.stringify(r),o=await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/datasets/${i}`,{method:"PATCH",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await ow(e,"update dataset"),e});return await o.json()}async updateDatasetTag(e){const{datasetId:t,datasetName:n,asOf:r,tag:i}=e;if(!t&&!n)throw new Error("Must provide either datasetName or datasetId");const a=t??(await this.readDataset({datasetName:n})).id;jb(a);const o=JSON.stringify({as_of:"string"==typeof r?r:r.toISOString(),tag:i});await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/datasets/${a}/tags`,{method:"PUT",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:o});return await ow(e,"update dataset tags",!0),e})}async deleteDataset({datasetId:e,datasetName:t}){let n="/datasets",r=e;if(void 0!==e&&void 0!==t)throw new Error("Must provide either datasetName or datasetId, not both");if(void 0!==t){r=(await this.readDataset({datasetName:t})).id}if(void 0===r)throw new Error("Must provide datasetName or datasetId");jb(r),n+=`/${r}`,await this.caller.call(async()=>{const e=await this._fetch(this.apiUrl+n,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(e,`delete ${n}`,!0),e})}async createExample(e,t,n){if(Zw(e)&&(void 0!==t||void 0!==n))throw new Error("Cannot provide outputs or options when using ExampleCreate object");let r=t?n?.datasetId:e.dataset_id;const i=t?n?.datasetName:e.dataset_name;if(void 0===r&&void 0===i)throw new Error("Must provide either datasetName or datasetId");if(void 0!==r&&void 0!==i)throw new Error("Must provide either datasetName or datasetId, not both");if(void 0===r){r=(await this.readDataset({datasetName:i})).id}const a=(t?n?.createdAt:e.created_at)||new Date;let o;o=Zw(e)?e:{inputs:e,outputs:t,created_at:a?.toISOString(),id:n?.exampleId,metadata:n?.metadata,split:n?.split,source_run_id:n?.sourceRunId,use_source_run_io:n?.useSourceRunIO,use_source_run_attachments:n?.useSourceRunAttachments,attachments:n?.attachments};const s=await this._uploadExamplesMultipart(r,[o]);return await this.readExample(s.example_ids?.[0]??kS())}async createExamples(e){if(Array.isArray(e)){if(0===e.length)return[];const t=e;let n=t[0].dataset_id;const r=t[0].dataset_name;if(void 0===n&&void 0===r)throw new Error("Must provide either datasetName or datasetId");if(void 0!==n&&void 0!==r)throw new Error("Must provide either datasetName or datasetId, not both");if(void 0===n){n=(await this.readDataset({datasetName:r})).id}const i=await this._uploadExamplesMultipart(n,t);return await Promise.all(i.example_ids.map(e=>this.readExample(e)))}const{inputs:t,outputs:n,metadata:r,splits:i,sourceRunIds:a,useSourceRunIOs:o,useSourceRunAttachments:s,attachments:c,exampleIds:l,datasetId:u,datasetName:d}=e;if(void 0===t)throw new Error("Must provide inputs when using legacy parameters");let p=u;const h=d;if(void 0===p&&void 0===h)throw new Error("Must provide either datasetName or datasetId");if(void 0!==p&&void 0!==h)throw new Error("Must provide either datasetName or datasetId, not both");if(void 0===p){const e=await this.readDataset({datasetName:h});p=e.id}const f=t.map((e,t)=>({dataset_id:p,inputs:e,outputs:n?.[t],metadata:r?.[t],split:i?.[t],id:l?.[t],attachments:c?.[t],source_run_id:a?.[t],use_source_run_io:o?.[t],use_source_run_attachments:s?.[t]})),m=await this._uploadExamplesMultipart(p,f);return await Promise.all(m.example_ids.map(e=>this.readExample(e)))}async createLLMExample(e,t,n){return this.createExample({input:e},{output:t},n)}async createChatExample(e,t,n){const r=e.map(e=>Cv(e)?Av(e):e),i=Cv(t)?Av(t):t;return this.createExample({input:r},{output:i},n)}async readExample(e){jb(e);const t=`/examples/${e}`,n=await this._get(t),{attachment_urls:r,...i}=n,a=i;return r&&(a.attachments=Object.entries(r).reduce((e,[t,n])=>(e[t.slice(11)]={presigned_url:n.presigned_url,mime_type:n.mime_type},e),{})),a}async*listExamples({datasetId:e,datasetName:t,exampleIds:n,asOf:r,splits:i,inlineS3Urls:a,metadata:o,limit:s,offset:c,filter:l,includeAttachments:u}={}){let d;if(void 0!==e&&void 0!==t)throw new Error("Must provide either datasetName or datasetId, not both");if(void 0!==e)d=e;else{if(void 0===t)throw new Error("Must provide a datasetName or datasetId");d=(await this.readDataset({datasetName:t})).id}const p=new URLSearchParams({dataset:d}),h=r?"string"==typeof r?r:r?.toISOString():void 0;h&&p.append("as_of",h);const f=a??!0;if(p.append("inline_s3_urls",f.toString()),void 0!==n)for(const g of n)p.append("id",g);if(void 0!==i)for(const g of i)p.append("splits",g);if(void 0!==o){const e=JSON.stringify(o);p.append("metadata",e)}void 0!==s&&p.append("limit",s.toString()),void 0!==c&&p.append("offset",c.toString()),void 0!==l&&p.append("filter",l),!0===u&&["attachment_urls","outputs","metadata"].forEach(e=>p.append("select",e));let m=0;for await(const g of this._getPaginated("/examples",p)){for(const e of g){const{attachment_urls:t,...n}=e,r=n;t&&(r.attachments=Object.entries(t).reduce((e,[t,n])=>(e[t.slice(11)]={presigned_url:n.presigned_url,mime_type:n.mime_type||void 0},e),{})),yield r,m++}if(void 0!==s&&m>=s)break}}async deleteExample(e){jb(e);const t=`/examples/${e}`;await this.caller.call(async()=>{const e=await this._fetch(this.apiUrl+t,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(e,`delete ${t}`,!0),e})}async deleteExamples(e,t){if(e.forEach(e=>jb(e)),t?.hardDelete){const t=this._getPlatformEndpointPath("datasets/examples/delete");await this.caller.call(async()=>{const n=await this._fetch(`${this.apiUrl}${t}`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},body:JSON.stringify({example_ids:e,hard_delete:!0}),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(n,"hard delete examples",!0),n})}else{const t=new URLSearchParams;e.forEach(e=>t.append("example_ids",e)),await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/examples?${t.toString()}`,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(e,"delete examples",!0),e})}}async updateExample(e,t){let n,r,i;if(n=t?e:e.id,jb(n),r=t?{id:n,...t}:e,void 0!==r.dataset_id)i=r.dataset_id;else{i=(await this.readExample(n)).dataset_id}return this._updateExamplesMultipart(i,[r])}async updateExamples(e){let t;if(void 0===e[0].dataset_id){t=(await this.readExample(e[0].id)).dataset_id}else t=e[0].dataset_id;return this._updateExamplesMultipart(t,e)}async readDatasetVersion({datasetId:e,datasetName:t,asOf:n,tag:r}){let i;if(e)i=e;else{const e=await this.readDataset({datasetName:t});i=e.id}if(jb(i),n&&r||!n&&!r)throw new Error("Exactly one of asOf and tag must be specified.");const a=new URLSearchParams;void 0!==n&&a.append("as_of","string"==typeof n?n:n.toISOString()),void 0!==r&&a.append("tag",r);const o=await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/datasets/${i}/version?${a.toString()}`,{method:"GET",headers:{...this._mergedHeaders},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(e,"read dataset version"),e});return await o.json()}async listDatasetSplits({datasetId:e,datasetName:t,asOf:n}){let r;if(void 0===e&&void 0===t)throw new Error("Must provide dataset name or ID");if(void 0!==e&&void 0!==t)throw new Error("Must provide either datasetName or datasetId, not both");if(void 0===e){r=(await this.readDataset({datasetName:t})).id}else r=e;jb(r);const i=new URLSearchParams,a=n?"string"==typeof n?n:n?.toISOString():void 0;a&&i.append("as_of",a);return await this._get(`/datasets/${r}/splits`,i)}async updateDatasetSplits({datasetId:e,datasetName:t,splitName:n,exampleIds:r,remove:i=!1}){let a;if(void 0===e&&void 0===t)throw new Error("Must provide dataset name or ID");if(void 0!==e&&void 0!==t)throw new Error("Must provide either datasetName or datasetId, not both");if(void 0===e){const e=await this.readDataset({datasetName:t});a=e.id}else a=e;jb(a);const o={split_name:n,examples:r.map(e=>(jb(e),e)),remove:i},s=JSON.stringify(o);await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/datasets/${a}/splits`,{method:"PUT",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ow(e,"update dataset splits",!0),e})}async createFeedback(e,t,n){const{runId:r=null,key:i,score:a,value:o,correction:s,comment:c,sourceInfo:l,feedbackSourceType:u="api",sourceRunId:d,feedbackId:p,feedbackConfig:h,projectId:f,traceId:m,comparativeExperimentId:g,sessionId:y,startTime:I,extendTraceRetention:C}="object"==typeof e&&null!==e?e:{runId:e,key:t,...n};if(!r&&!f)throw new Error("One of runId or projectId must be provided");if(r&&f)throw new Error("Only one of runId or projectId can be provided");r&&void 0===y&&await this._checkFeedbackSessionId();const A={type:u??"api",metadata:l??{}};void 0===d||void 0===A?.metadata||A.metadata.__run||(A.metadata.__run={run_id:d}),void 0!==A?.metadata&&void 0!==A.metadata.__run?.run_id&&jb(A.metadata.__run.run_id);const S={id:p??jS(),run_id:r,trace_id:m,key:i,score:Xw(a),value:o,correction:s,comment:c,feedback_source:A,comparative_experiment_id:g,feedbackConfig:h,session_id:y??f,start_time:I,extend_trace_retention:C},b=m??r;if(null!=b&&!this._shouldSample(b))return S;const T=JSON.stringify(S),v=`${this.apiUrl}/feedback`;return await this.caller.call(async()=>{const e=await this._fetch(v,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:T});return await ow(e,"create feedback",!0),e}),S}async updateFeedback(e,{score:t,value:n,correction:r,comment:i}){const a={};null!=t&&(a.score=Xw(t)),null!=n&&(a.value=n),null!=r&&(a.correction=r),null!=i&&(a.comment=i),jb(e);const o=JSON.stringify(a);await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/feedback/${e}`,{method:"PATCH",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:o});return await ow(t,"update feedback",!0),t})}async readFeedback(e){jb(e);const t=`/feedback/${e}`;return await this._get(t)}async deleteFeedback(e){jb(e);const t=`/feedback/${e}`;await this.caller.call(async()=>{const e=await this._fetch(this.apiUrl+t,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(e,`delete ${t}`,!0),e})}async*listFeedback({runIds:e,feedbackKeys:t,feedbackSourceTypes:n}={}){const r=new URLSearchParams;if(e)for(const i of e)jb(i),r.append("run",i);if(t)for(const i of t)r.append("key",i);if(n)for(const i of n)r.append("source",i);for await(const i of this._getPaginated("/feedback",r))yield*i}async createPresignedFeedbackToken(e,t,{expiration:n,feedbackConfig:r}={}){const i={run_id:e,feedback_key:t,feedback_config:r};n?"string"==typeof n?i.expires_at=n:(n?.hours||n?.minutes||n?.days)&&(i.expires_in=n):i.expires_in={hours:3};const a=JSON.stringify(i),o=await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/feedback/tokens`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await ow(e,"create presigned feedback token"),e});return await o.json()}async createComparativeExperiment({name:e,experimentIds:t,referenceDatasetId:n,createdAt:r,description:i,metadata:a,id:o}){if(0===t.length)throw new Error("At least one experiment is required");if(n||(n=(await this.readProject({projectId:t[0]})).reference_dataset_id),null==!n)throw new Error("A reference dataset is required");const s={id:o,name:e,experiment_ids:t,reference_dataset_id:n,description:i,created_at:(r??new Date)?.toISOString(),extra:{}};a&&(s.extra.metadata=a);const c=JSON.stringify(s);return(await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/datasets/comparative`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await ow(e,"create comparative experiment"),e})).json()}async*listPresignedFeedbackTokens(e){jb(e);const t=new URLSearchParams({run_id:e});for await(const n of this._getPaginated("/feedback/tokens",t))yield*n}_selectEvalResults(e){let t;return t="results"in e?e.results:Array.isArray(e)?e:[e],t}async _logEvaluationFeedback(e,t,n,r){const i=this._selectEvalResults(e),a=[];for(const o of i){let e=n||{};o.evaluatorInfo&&(e={...o.evaluatorInfo,...e});let i=null;o.targetRunId?i=o.targetRunId:t&&(i=t.id),a.push(await this.createFeedback(i,o.key,{score:o.score,value:o.value,comment:o.comment,correction:o.correction,sourceInfo:e,sourceRunId:o.sourceRunId,feedbackConfig:o.feedbackConfig,feedbackSourceType:"model",sessionId:t?.session_id??r,startTime:t?.start_time,traceId:i===t?.id?t?.trace_id:void 0}))}return[i,a]}async logEvaluationFeedback(e,t,n,r){if(null!=e&&"object"==typeof e&&"evaluatorResponse"in e){const[t]=await this._logEvaluationFeedback(e.evaluatorResponse,e.run,e.sourceInfo,e.projectId);return t}const[i]=await this._logEvaluationFeedback(e,t,n,r);return i}async createFeedbackConfig(e){const{feedbackKey:t,feedbackConfig:n,isLowerScoreBetter:r=!1}=e,i={feedback_key:t,feedback_config:n,is_lower_score_better:r};return(await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/feedback-configs`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:JSON.stringify(i)});return await ow(e,"create feedback config"),e})).json()}async*listFeedbackConfigs(e={}){const{feedbackKeys:t,nameContains:n,limit:r}=e,i=new URLSearchParams;t&&t.forEach(e=>{i.append("key",e)}),n&&i.append("name_contains",n),i.append("limit",(void 0!==r?Math.min(r,100):100).toString());let a=0;for await(const o of this._getPaginated("/feedback-configs",i))if(yield*o,a+=o.length,void 0!==r&&a>=r)break}async updateFeedbackConfig(e,t={}){const{feedbackConfig:n,isLowerScoreBetter:r}=t,i={feedback_key:e};void 0!==n&&(i.feedback_config=n),void 0!==r&&(i.is_lower_score_better=r);return(await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/feedback-configs`,{method:"PATCH",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:JSON.stringify(i)});return await ow(e,"update feedback config"),e})).json()}async deleteFeedbackConfig(e){const t=new URLSearchParams({feedback_key:e});await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/feedback-configs?${t}`,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(e,"delete feedback config",!0),e})}async*listAnnotationQueues(e={}){const{queueIds:t,name:n,nameContains:r,limit:i}=e,a=new URLSearchParams;t&&t.forEach((e,t)=>{jb(e,`queueIds[${t}]`),a.append("ids",e)}),n&&a.append("name",n),r&&a.append("name_contains",r),a.append("limit",(void 0!==i?Math.min(i,100):100).toString());let o=0;for await(const s of this._getPaginated("/annotation-queues",a))if(yield*s,o++,void 0!==i&&o>=i)break}async createAnnotationQueue(e){const{name:t,description:n,queueId:r,rubricInstructions:i,rubricItems:a}=e,o={name:t,description:n,id:r||kS(),rubric_instructions:i,rubric_items:a},s=JSON.stringify(Object.fromEntries(Object.entries(o).filter(([e,t])=>void 0!==t)));return(await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/annotation-queues`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ow(e,"create annotation queue"),e})).json()}async readAnnotationQueue(e){return(await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/annotation-queues/${jb(e,"queueId")}`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(t,"read annotation queue"),t})).json()}async updateAnnotationQueue(e,t){const{name:n,description:r,rubricInstructions:i,rubricItems:a}=t,o={};void 0!==n&&(o.name=n),void 0!==r&&(o.description=r),void 0!==i&&(o.rubric_instructions=i),void 0!==a&&(o.rubric_items=a);const s=JSON.stringify(o);await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/annotation-queues/${jb(e,"queueId")}`,{method:"PATCH",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ow(t,"update annotation queue",!0),t})}async deleteAnnotationQueue(e){await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/annotation-queues/${jb(e,"queueId")}`,{method:"DELETE",headers:{...this._mergedHeaders,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(t,"delete annotation queue",!0),t})}async addRunsToAnnotationQueue(e,t){const n=`${this.apiUrl}/annotation-queues/${jb(e,"queueId")}/runs`;let r,i;t.every(e=>"string"==typeof e)?(rb("Passing run IDs as strings to addRunsToAnnotationQueue() is deprecated and will be removed after Jan 31, 2027. Use RunKey[] instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration-feedback#annotation-queues-add-runs for the migration guide.",{type:"DeprecationWarning",code:"LANGSMITH_DEPRECATED_ADD_RUNS_STRING_IDS"}),r=n,i=JSON.stringify(t.map((e,t)=>jb(e,`runs[${t}]`).toString()))):(r=`${n}/by-key`,i=JSON.stringify(t.map((e,t)=>{const n={run_id:jb(e.runId,`runs[${t}].runId`).toString(),session_id:jb(e.sessionId,`runs[${t}].sessionId`).toString(),start_time:"string"==typeof e.startTime?e.startTime:new Date(e.startTime).toISOString()};return null!=e.sourceProposedExampleId&&(n.source_proposed_example_id=jb(e.sourceProposedExampleId,`runs[${t}].sourceProposedExampleId`).toString()),n}))),await this.caller.call(async()=>{const e=await this._fetch(r,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:i});return await ow(e,"add runs to annotation queue",!0),e})}async getRunFromAnnotationQueue(e,t){const n=`/annotation-queues/${jb(e,"queueId")}/run`,r=await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}${n}/${t}`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(e,"get run from annotation queue"),e});return Vw(await r.json())}async*listRunsFromAnnotationQueue(e,t={}){const{status:n,limit:r}=t,i=new URLSearchParams,a=void 0!==r&&Number.isFinite(r)?Math.min(r,100):100;n&&i.append("status",n),i.append("limit",a.toString());let o=0;const s=`/annotation-queues/${jb(e,"queueId")}/runs`;for await(const c of this._getPaginated(s,i))for(const e of c)if(yield Vw(e),o++,o>=a)return}async deleteRunFromAnnotationQueue(e,t){await this.caller.call(async()=>{const n=await this._fetch(`${this.apiUrl}/annotation-queues/${jb(e,"queueId")}/runs/${jb(t,"queueRunId")}`,{method:"DELETE",headers:{...this._mergedHeaders,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(n,"delete run from annotation queue",!0),n})}async getSizeFromAnnotationQueue(e){return(await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/annotation-queues/${jb(e,"queueId")}/size`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(t,"get size from annotation queue"),t})).json()}async _currentTenantIsOwner(e){const t=await this._getSettings();return"-"==e||t.tenant_handle===e}async _ownerConflictError(e,t){const n=await this._getSettings();return new Error(`Cannot ${e} for another tenant.\n\n Current tenant: ${n.tenant_handle}\n\n Requested tenant: ${t}`)}async _getLatestCommitHash(e){const t=await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/commits/${e}/?limit=1&offset=0`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(t,"get latest commit hash"),t}),n=await t.json();if(0!==n.commits.length)return n.commits[0].commit_hash}async _createCommitTags(e,t,n){const r="string"==typeof n?[n]:n;await Promise.all(r.map(async n=>this.caller.call(async()=>{const r=await this._fetch(`${this.apiUrl}/repos/${e}/tags`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:JSON.stringify({tag_name:n,commit_id:t})});return await ow(r,"create commit tag"),r})))}async _likeOrUnlikePrompt(e,t){const[n,r,i]=lw(e),a=JSON.stringify({like:t});return(await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/likes/${n}/${r}`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await ow(e,(t?"like":"unlike")+" prompt"),e})).json()}async _getPromptUrl(e){const[t,n,r]=lw(e);if(await this._currentTenantIsOwner(t)){const e=await this._getSettings();return"latest"!==r?`${this.getHostUrl()}/prompts/${n}/${r.substring(0,8)}?organizationId=${e.id}`:`${this.getHostUrl()}/prompts/${n}?organizationId=${e.id}`}return"latest"!==r?`${this.getHostUrl()}/hub/${t}/${n}/${r.substring(0,8)}`:`${this.getHostUrl()}/hub/${t}/${n}`}async promptExists(e){return!!(await this.getPrompt(e))}async likePrompt(e){return this._likeOrUnlikePrompt(e,!0)}async unlikePrompt(e){return this._likeOrUnlikePrompt(e,!1)}async*listCommits(e){const[t,n,r]=lw(e);for await(const i of this._getPaginated(`/commits/${t}/${n}/`,new URLSearchParams,e=>e.commits))yield*i}async*listPrompts(e){const t=new URLSearchParams;t.append("sort_field",e?.sortField??"updated_at"),t.append("sort_direction","desc"),t.append("is_archived",(!!e?.isArchived).toString()),void 0!==e?.isPublic&&t.append("is_public",e.isPublic.toString()),e?.query&&t.append("query",e.query);for await(const n of this._getPaginated("/repos",t,e=>e.repos))yield*n}async getPrompt(e){const[t,n,r]=lw(e),i=await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/repos/${t}/${n}`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return 404===e?.status?null:(await ow(e,"get prompt"),e)}),a=await(i?.json());return a?.repo?a.repo:null}async createPrompt(e,t){const n=await this._getSettings();if(t?.isPublic&&!n.tenant_handle)throw new Error("Cannot create a public prompt without first\n\n creating a LangChain Hub handle.\n You can add a handle by creating a public prompt at:\n\n https://smith.langchain.com/prompts");const[r,i,a]=lw(e);if(!(await this._currentTenantIsOwner(r)))throw await this._ownerConflictError("create a prompt",r);const o={repo_handle:i,...t?.description&&{description:t.description},...t?.readme&&{readme:t.readme},...t?.tags&&{tags:t.tags},is_public:!!t?.isPublic},s=JSON.stringify(o),c=await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/repos/`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await ow(e,"create prompt"),e}),{repo:l}=await c.json();return l}async createCommit(e,t,n){if(!(await this.promptExists(e)))throw new Error("Prompt does not exist, you must create it first.");const[r,i,a]=lw(e),o="latest"!==n?.parentCommitHash&&n?.parentCommitHash?n?.parentCommitHash:await this._getLatestCommitHash(`${r}/${i}`),s={manifest:JSON.parse(JSON.stringify(t)),parent_commit:o,...void 0!==n?.description&&{description:n.description}},c=JSON.stringify(s),l=await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/commits/${r}/${i}`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await ow(e,"create commit"),e}),u=await l.json(),d=u.commit??u;return n?.tags&&await this._createCommitTags(`${r}/${i}`,d.id,n.tags),this._getPromptUrl(`${r}/${i}${d.commit_hash?`:${d.commit_hash}`:""}`)}async updateExamplesMultipart(e,t=[]){return this._updateExamplesMultipart(e,t)}async _updateExamplesMultipart(e,t=[]){if(!(await this._getDatasetExamplesMultiPartSupport()))throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");const n=new FormData;for(const i of t){const e=i.id,t=Fw({...i.metadata&&{metadata:i.metadata},...i.split&&{split:i.split}},`Serializing body for example with id: ${e}`),r=new Blob([t],{type:"application/json"});if(n.append(e,r),i.inputs){const t=Fw(i.inputs,`Serializing inputs for example with id: ${e}`),r=new Blob([t],{type:"application/json"});n.append(`${e}.inputs`,r)}if(i.outputs){const t=Fw(i.outputs,`Serializing outputs whle updating example with id: ${e}`),r=new Blob([t],{type:"application/json"});n.append(`${e}.outputs`,r)}if(i.attachments)for(const[a,o]of Object.entries(i.attachments)){let t,r;Array.isArray(o)?[t,r]=o:(t=o.mimeType,r=o.data);const i=new Blob([r],{type:`${t}; length=${r.byteLength}`});n.append(`${e}.attachment.${a}`,i)}if(i.attachments_operations){const t=Fw(i.attachments_operations,`Serializing attachments while updating example with id: ${e}`),r=new Blob([t],{type:"application/json"});n.append(`${e}.attachments_operations`,r)}}const r=e??t[0]?.dataset_id;return(await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${r}/examples`)}`,{method:"PATCH",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await ow(e,"update examples"),e})).json()}async uploadExamplesMultipart(e,t=[]){return this._uploadExamplesMultipart(e,t)}async _uploadExamplesMultipart(e,t=[]){if(!(await this._getDatasetExamplesMultiPartSupport()))throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");const n=new FormData;for(const r of t){const e=(r.id??kS()).toString(),t=Fw({created_at:r.created_at,...r.metadata&&{metadata:r.metadata},...r.split&&{split:r.split},...r.source_run_id&&{source_run_id:r.source_run_id},...r.use_source_run_io&&{use_source_run_io:r.use_source_run_io},...r.use_source_run_attachments&&{use_source_run_attachments:r.use_source_run_attachments}},`Serializing body for uploaded example with id: ${e}`),i=new Blob([t],{type:"application/json"});if(n.append(e,i),r.inputs){const t=Fw(r.inputs,`Serializing inputs for uploaded example with id: ${e}`),i=new Blob([t],{type:"application/json"});n.append(`${e}.inputs`,i)}if(r.outputs){const t=Fw(r.outputs,`Serializing outputs for uploaded example with id: ${e}`),i=new Blob([t],{type:"application/json"});n.append(`${e}.outputs`,i)}if(r.attachments)for(const[a,o]of Object.entries(r.attachments)){let t,r;Array.isArray(o)?[t,r]=o:(t=o.mimeType,r=o.data);const i=new Blob([r],{type:`${t}; length=${r.byteLength}`});n.append(`${e}.attachment.${a}`,i)}}return(await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${e}/examples`)}`,{method:"POST",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await ow(t,"upload examples"),t})).json()}async updatePrompt(e,t){if(!(await this.promptExists(e)))throw new Error("Prompt does not exist, you must create it first.");const[n,r]=lw(e);if(!(await this._currentTenantIsOwner(n)))throw await this._ownerConflictError("update a prompt",n);const i={};if(void 0!==t?.description&&(i.description=t.description),void 0!==t?.readme&&(i.readme=t.readme),void 0!==t?.tags&&(i.tags=t.tags),void 0!==t?.isPublic&&(i.is_public=t.isPublic),void 0!==t?.isArchived&&(i.is_archived=t.isArchived),0===Object.keys(i).length)throw new Error("No valid update options provided");const a=JSON.stringify(i);return(await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/repos/${n}/${r}`,{method:"PATCH",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await ow(e,"update prompt"),e})).json()}async deletePrompt(e){if(!(await this.promptExists(e)))throw new Error("Prompt does not exist, you must create it first.");const[t,n,r]=lw(e);if(!(await this._currentTenantIsOwner(t)))throw await this._ownerConflictError("delete a prompt",t);return(await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/repos/${t}/${n}`,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(e,"delete prompt"),e})).json()}_getPromptCacheKey(e,t){return`${e}${t?":with_model":""}`}async _fetchPromptFromApi(e,t){const[n,r,i]=lw(e),a=await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/commits/${n}/${r}/${i}${t?.includeModel?"?include_model=true":""}`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(e,"pull prompt commit"),e}),o=await a.json();return{owner:n,repo:r,commit_hash:o.commit_hash,manifest:o.manifest,examples:o.examples,hub_model_config:o.model_config,hub_model_provider:o.model_provider}}async pullPromptCommit(e,t){!function(e,t){const[n]=lw(e);if("-"!==n&&!t)throw new Error("Pulling a public prompt by owner/name is disabled by default because prompts may contain untrusted serialized LangChain objects. If you trust this prompt, set `dangerouslyPullPublicPrompt: true` to acknowledge the risk.")}(e,t?.dangerouslyPullPublicPrompt);const n=this._fetchPromptFromApi.bind(this,e,t);if(!t?.skipCache&&this._promptCache){const r=this._getPromptCacheKey(e,t?.includeModel),i=this._promptCache.get(r,n);if(i)return i;const a=await n();return this._promptCache.set(r,a,n),a}return this._fetchPromptFromApi(e,t)}async _pullPrompt(e,t){const n=await this.pullPromptCommit(e,{includeModel:t?.includeModel,skipCache:t?.skipCache,dangerouslyPullPublicPrompt:t?.dangerouslyPullPublicPrompt});return JSON.stringify(n.manifest)}async pushPrompt(e,t){if(await this.promptExists(e)?t&&["description","readme","tags","isPublic"].some(e=>void 0!==t[e])&&await this.updatePrompt(e,{description:t?.description,readme:t?.readme,tags:t?.tags,isPublic:t?.isPublic}):await this.createPrompt(e,{description:t?.description,readme:t?.readme,tags:t?.tags,isPublic:t?.isPublic}),!t?.object)return await this._getPromptUrl(e);return await this.createCommit(e,t?.object,{parentCommitHash:t?.parentCommitHash,tags:t?.commitTags,description:t?.commitDescription})}async agentExists(e){const[t,n]=lw(e);return this._repoExists(t,n)}async skillExists(e){const[t,n]=lw(e);return this._repoExists(t,n)}async pullAgent(e,t){return await this._pullDirectory(e,"agent",t?.version)}async pullSkill(e,t){return await this._pullDirectory(e,"skill",t?.version)}async pushAgent(e,t){return this._pushDirectory(e,"agent",t)}async pushSkill(e,t){return this._pushDirectory(e,"skill",t)}async deleteAgent(e){return this._deleteDirectory(e)}async deleteSkill(e){return this._deleteDirectory(e)}async*listAgents(e){yield*this._listReposByType("agent",e)}async*listSkills(e){yield*this._listReposByType("skill",e)}async*_listReposByType(e,t){const n=new URLSearchParams;n.append("repo_type",e),n.append("is_archived",(!!t?.isArchived).toString()),void 0!==t?.isPublic&&n.append("is_public",t.isPublic.toString()),t?.query&&n.append("query",t.query);for await(const r of this._getPaginated("/repos",n,e=>e.repos))yield*r}async _pullDirectory(e,t,n){const[r,i,a]=lw(e),o=n??("latest"!==a?a:void 0),s=new URL(`${this.apiUrl}${this._getPlatformEndpointPath(`hub/repos/${r}/${i}/directories`)}`);s.searchParams.set("repo_type",t),o&&s.searchParams.set("commit",o);const c=await this.caller.call(async()=>{const e=await this._fetch(s.toString(),{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(e,"pull directory"),e});return await c.json()}async _pushDirectory(e,t,n){if(void 0!==n.parentCommit&&(n.parentCommit.length<8||n.parentCommit.length>64))throw new Error("parent_commit must be 8-64 characters");const[r,i]=lw(e);if(!(await this._currentTenantIsOwner(r)))throw await this._ownerConflictError(`push ${t}`,r);if(await this._repoExists(r,i))void 0===n.description&&void 0===n.readme&&void 0===n.tags&&void 0===n.isPublic||await this._updateRepoMetadata(r,i,n);else{const e=/^[a-z][a-z0-9-_]*$/;if(!e.test(i))throw new Error(`Invalid repo_handle ${JSON.stringify(i)}: must match ${e}`);await this._createRepo(i,t,n)}const a={files:n.files};n.parentCommit&&(a.parent_commit=n.parentCommit);const o=await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`hub/repos/${r}/${i}/directories/commits`)}`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:JSON.stringify(a)});return await ow(e,`push ${t}`),e}),s=(await o.json()).commit.commit_hash,c=await this._getSettings(),l=new URLSearchParams({organizationId:c.id});return`${this.getHostUrl()}/context/${i}/${s.slice(0,8)}?${l.toString()}`}async _deleteDirectory(e){const[t,n]=lw(e);if(!(await this._currentTenantIsOwner(t)))throw await this._ownerConflictError("delete",t);await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`hub/repos/${t}/${n}/directories`)}`,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(e,"delete directory"),e})}async _repoExists(e,t){try{return await this.caller.call(async()=>{const n=await this._fetch(`${this.apiUrl}/repos/${e}/${t}`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await ow(n,"check repo exists"),n}),!0}catch(n){if(aw(n))return!1;throw n}}async _createRepo(e,t,n){const r={repo_handle:e,repo_type:t,is_public:!!n.isPublic};void 0!==n.description&&(r.description=n.description),void 0!==n.readme&&(r.readme=n.readme),void 0!==n.tags&&(r.tags=n.tags);try{await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/repos/`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:JSON.stringify(r)});return await ow(e,`create ${t}`),e})}catch(a){if(null!=(i=a)&&"object"==typeof i&&"name"in i&&"LangSmithConflictError"===i?.name)return;throw a}var i}async _updateRepoMetadata(e,t,n){const r={};void 0!==n.description&&(r.description=n.description),void 0!==n.readme&&(r.readme=n.readme),void 0!==n.tags&&(r.tags=n.tags),void 0!==n.isPublic&&(r.is_public=n.isPublic),0!==Object.keys(r).length&&await this.caller.call(async()=>{const n=await this._fetch(`${this.apiUrl}/repos/${e}/${t}`,{method:"PATCH",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:JSON.stringify(r)});return await ow(n,"update repo metadata"),n})}async clonePublicDataset(e,t={}){const{sourceApiUrl:n=this.apiUrl,datasetName:r}=t,[i,a]=this.parseTokenOrUrl(e,n),o=new zw({apiUrl:i,apiKey:"placeholder"}),s=await o.readSharedDataset(a),c=r||s.name;try{if(await this.hasDataset({datasetId:c}))return void console.log(`Dataset ${c} already exists in your tenant. Skipping.`)}catch(d){}const l=await o.listSharedExamples(a),u=await this.createDataset(c,{description:s.description,dataType:s.data_type||"kv",inputsSchema:s.inputs_schema_definition??void 0,outputsSchema:s.outputs_schema_definition??void 0});try{await this.createExamples({inputs:l.map(e=>e.inputs),outputs:l.flatMap(e=>e.outputs?[e.outputs]:[]),datasetId:u.id})}catch(p){throw console.error(`An error occurred while creating dataset ${c}. You should delete it manually.`),p}}parseTokenOrUrl(e,t,n=2,r="dataset"){try{return jb(e),[t,e]}catch(i){}try{const i=new URL(e).pathname.split("/").filter(e=>""!==e);if(i.length>=n){return[t,i[i.length-n]]}throw new Error(`Invalid public ${r} URL: ${e}`)}catch(a){throw new Error(`Invalid public ${r} URL or token: ${e}`)}}cleanup(){this._promptCache&&this._promptCache.stop()}async awaitPendingTraceBatches(){if(this.manualFlushMode)return console.warn("[WARNING]: When tracing in manual flush mode, you must call `await client.flush()` manually to submit trace batches."),Promise.resolve();for(await new Promise(e=>setTimeout(e,1));this._pendingDrains.size>0;)await Promise.all([...this._pendingDrains]);await Promise.all([...this.autoBatchQueue.items.map(({itemPromise:e})=>e),this.batchIngestCaller.queue.onIdle()]),void 0!==this.langSmithToOTELTranslator&&await(VT.getDefaultOTLPTracerComponents()?.DEFAULT_LANGSMITH_SPAN_PROCESSOR?.forceFlush())}toString(){const e=[`apiUrl=${JSON.stringify(this.apiUrl)}`];return void 0!==this.webUrl&&e.push(`webUrl=${JSON.stringify(this.webUrl)}`),void 0!==this.workspaceId&&e.push(`workspaceId=${JSON.stringify(this.workspaceId)}`),`[LangSmithClient ${e.join(" ")}]`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}function Zw(e){return"dataset_id"in e||"dataset_name"in e}Object.defineProperty(zw,"_fallbackDirsCreated",{enumerable:!0,configurable:!0,writable:!0,value:new Set});const eE=Symbol.for("lc:context_variables"),tE=Symbol.for("langsmith:replica_trace_roots");function nE(e,t){if(eE in e){return e[eE][t]}}function rE(e){return VS(Object.keys(e).sort().map(t=>`${t}:${e[t]??""}`).join("|"),"6ba7b810-9dad-11d1-80b4-00c04fd430c8")}function iE(e,t=1){const n=t.toFixed(0).slice(0,3).padStart(3,"0");return`${new Date(e).toISOString().slice(0,-1)}${n}Z`}function aE(e,t,n=1){const r=iE(e,n);return{dottedOrder:(i=r,i.replace(/[-:.]/g,"")+t),microsecondPrecisionDatestring:r};var i}const oE=new Set(["projectName","primary","updates","reroot"]);function sE(e){const t={};for(const n of Object.keys(e))"primary"===n&&"boolean"!=typeof e[n]||oE.has(n)&&(t[n]=e[n]);return t}class cE{constructor(e,t,n,r){Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"replicas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.metadata=e,this.tags=t,this.project_name=n,this.replicas=r}static fromHeader(e){const t=e.split(",");let n,r,i={},a=[];for(const o of t){const[e,t]=o.split("="),s=decodeURIComponent(t);if("langsmith-metadata"===e)i=JSON.parse(s);else if("langsmith-tags"===e)a=s.split(",");else if("langsmith-project"===e)n=s;else if("langsmith-replicas"===e){r=JSON.parse(s).map(e=>Array.isArray(e)?e:sE(e))}}return new cE(i,a,n,r)}toHeader(){const e=[];return this.metadata&&Object.keys(this.metadata).length>0&&e.push(`langsmith-metadata=${encodeURIComponent(JSON.stringify(this.metadata))}`),this.tags&&this.tags.length>0&&e.push(`langsmith-tags=${encodeURIComponent(this.tags.join(","))}`),this.project_name&&e.push(`langsmith-project=${encodeURIComponent(this.project_name)}`),e.join(",")}}class lE{constructor(e){if(Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"run_type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parent_run",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parent_run_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_runs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"end_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"extra",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"serialized",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"outputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reference_example_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"trace_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dotted_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingEnabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"attachments",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"replicas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"distributedParentId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_serialized_start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_awaitInputsOnPost",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),null!=(t=e)&&"function"==typeof t.createChild&&"function"==typeof t.postRun)return void Object.assign(this,{...e});var t;const n=lE.getDefaultConfig(),{metadata:r,...i}=e,a=i.client??lE.getSharedClient(),o={...r,...i?.extra?.metadata};var s;if(i.extra={...i.extra,metadata:o},"id"in i&&null==i.id&&delete i.id,Object.assign(this,{...n,...i,client:a}),this.execution_order??=1,this.child_execution_order??=1,this.dotted_order||(this._serialized_start_time=iE(this.start_time,this.execution_order)),this.id||(this.id=jS({msecs:"string"==typeof(s=this._serialized_start_time??this.start_time)?Date.parse(s):s,seq:0})),this.trace_id||(this.parent_run?this.trace_id=this.parent_run.trace_id??this.id:this.trace_id=this.id),this.replicas=function(e){const t=e?e.map(e=>Array.isArray(e)?{projectName:e[0],updates:e[1]}:e):function(){const e=LT("LANGSMITH_RUNS_ENDPOINTS");if(!e)return[];try{const t=JSON.parse(e);if(Array.isArray(t)){const e=[];for(const n of t)"object"==typeof n&&null!==n?"string"==typeof n.api_url?"string"==typeof n.api_key?void 0===n.project_name||null===n.project_name||"string"==typeof n.project_name?void 0===n.primary||"boolean"==typeof n.primary?e.push({apiUrl:n.api_url.replace(/\/$/,""),apiKey:n.api_key,projectName:n.project_name??void 0,primary:n.primary??void 0}):console.warn("Invalid primary type in LANGSMITH_RUNS_ENDPOINTS: expected boolean, got "+typeof n.primary):console.warn("Invalid project_name type in LANGSMITH_RUNS_ENDPOINTS: expected string, got "+typeof n.project_name):console.warn("Invalid api_key type in LANGSMITH_RUNS_ENDPOINTS: expected string, got "+typeof n.api_key):console.warn("Invalid api_url type in LANGSMITH_RUNS_ENDPOINTS: expected string, got "+typeof n.api_url):console.warn("Invalid item type in LANGSMITH_RUNS_ENDPOINTS: expected object, got "+typeof n);return e}if("object"==typeof t&&null!==t){!function(e){if(Object.keys(e).length>0&&NT("ENDPOINT"))throw new cw}(t);const e=[];for(const[n,r]of Object.entries(t)){const t=n.replace(/\/$/,"");"string"==typeof r?e.push({apiUrl:t,apiKey:r}):console.warn(`Invalid value type in LANGSMITH_RUNS_ENDPOINTS for URL ${n}: expected string, got ${typeof r}`)}return e}return console.warn("Invalid LANGSMITH_RUNS_ENDPOINTS – must be valid JSON array of objects with api_url and api_key properties, or object mapping url->apiKey, got "+typeof t),[]}catch(n){if("object"==typeof(t=n)&&null!==t&&t.code===sw)throw n;return console.warn("Invalid LANGSMITH_RUNS_ENDPOINTS – must be valid JSON array of objects with api_url and api_key properties, or object mapping url->apiKey"),[]}var t}();if(t.filter(e=>!0===e.primary).length>1)throw new Error("Only one replica can be marked as primary.");return t}(this.replicas),!this.dotted_order){const{dottedOrder:e}=aE(this.start_time,this.id,this.execution_order);this.parent_run?this.dotted_order=this.parent_run.dotted_order+"."+e:this.dotted_order=e}}set metadata(e){this.extra={...this.extra,metadata:{...this.extra?.metadata,...e}}}get metadata(){return this.extra?.metadata}static getDefaultConfig(){const e=Date.now();return{run_type:"chain",project_name:tb(),child_runs:[],api_url:LT("LANGCHAIN_ENDPOINT")??"http://localhost:1984",api_key:LT("LANGCHAIN_API_KEY"),caller_options:{},start_time:e,serialized:{},inputs:{},extra:{}}}static getSharedClient(){return lE.sharedClient||(lE.sharedClient=new zw),lE.sharedClient}createChild(e){const t=this.child_execution_order+1,n=this.replicas?.map(e=>{const{reroot:t,...n}=e;return n}),r=e.replicas??n,i=new lE({...e,parent_run:this,project_name:this.project_name,replicas:r,client:this.client,tracingEnabled:this.tracingEnabled,execution_order:t,child_execution_order:t}),a=this.extra?.metadata??{},o=i.extra?.metadata??{};Object.keys(a).length>0&&(i.extra={...i.extra,metadata:{...a,...o}}),eE in this&&(i[eE]=this[eE]);const s=Symbol.for("lc:child_config"),c=e.extra?.[s]??this.extra[s];if(function(e){const t=e?.callbacks;return null!=e&&"object"==typeof t&&(dE(t?.handlers)||dE(t))}(c)){const e={...c},t="object"==typeof(l=e.callbacks)&&null!=l&&Array.isArray(l.handlers)?e.callbacks.copy?.():void 0;t&&(Object.assign(t,{_parentRunId:i.id}),t.handlers?.find(uE)?.updateFromRunTree?.(i),e.callbacks=t),i.extra[s]=e}var l;const u=new Set;let d=this;for(;null!=d&&!u.has(d.id);)u.add(d.id),d.child_execution_order=Math.max(d.child_execution_order,t),d=d.parent_run;return this.child_runs.push(i),i}async end(e,t,n=Date.now(),r){this.outputs=this.outputs??e,this.error=this.error??t,this.end_time=this.end_time??n,r&&Object.keys(r).length>0&&(this.extra=this.extra?{...this.extra,metadata:{...this.extra.metadata,...r}}:{metadata:r})}_convertToCreate(e,t,n=!0){const r=e.extra??{};if(void 0===r?.runtime?.library&&(r.runtime||(r.runtime={}),t))for(const[o,s]of Object.entries(t))r.runtime[o]||(r.runtime[o]=s);const i=e.parent_run?.id??e.parent_run_id;let a;return a=n?[]:e.child_runs.map(e=>this._convertToCreate(e,t,n)),{id:e.id,name:e.name,start_time:e._serialized_start_time??e.start_time,end_time:e.end_time,run_type:e.run_type,reference_example_id:e.reference_example_id,extra:r,serialized:e.serialized,error:e.error,inputs:e.inputs,outputs:e.outputs,session_name:e.project_name,child_runs:a,parent_run_id:i,trace_id:e.trace_id,dotted_order:e.dotted_order,tags:e.tags,attachments:e.attachments,events:e.events}}_sliceParentId(e,t){if(t.dotted_order){const n=t.dotted_order.split(".");let r=null;for(let t=0;t<n.length;t++){if(n[t].slice(-36)===e){r=t;break}}if(null!==r){const e=n.slice(r+1);t.dotted_order=e.join("."),e.length>0?t.trace_id=e[0].slice(-36):t.trace_id=t.id}}t.parent_run_id===e&&(t.parent_run_id=void 0)}_setReplicaTraceRoot(e,t){const n=nE(this,tE)??{};n[e]=t,function(e,t,n){const r=eE in e?e[eE]:{};r[t]=n,e[eE]=r}(this,tE,n);for(const r of this.child_runs)r._setReplicaTraceRoot(e,t)}_remapForProject(e){const{projectName:t,primary:n,runtimeEnv:r,excludeChildRuns:i=!0,reroot:a=!1,distributedParentId:o,apiUrl:s,apiKey:c,workspaceId:l}=e,u=this._convertToCreate(this,r,i);if(void 0===n&&t===this.project_name)return{...u,session_name:t};if(a){if(o)this._sliceParentId(o,u);else if(u.parent_run_id=void 0,u.dotted_order){const e=u.dotted_order.split(".");e.length>0&&(u.dotted_order=e[e.length-1],u.trace_id=u.id)}const e=rE({projectName:t,apiUrl:s,apiKey:c,workspaceId:l});this._setReplicaTraceRoot(e,u.id)}let d;if(!a){if(d=(nE(this,tE)??{})[rE({projectName:t,apiUrl:s,apiKey:c,workspaceId:l})],d&&(u.trace_id=d,u.dotted_order)){const e=u.dotted_order.split(".");let t=null;for(let n=0;n<e.length;n++){if(e[n].slice(-36)===d){t=n;break}}if(null!==t){const n=e.slice(t);u.dotted_order=n.join(".")}}}if(n)return{...u,session_name:t};const p=Kb(u.id,t);let h,f,m;if(h=u.trace_id?Kb(u.trace_id,t):p,u.parent_run_id&&(f=Kb(u.parent_run_id,t)),u.dotted_order){m=u.dotted_order.split(".").map(e=>{const n=Kb(e.slice(-36),t);return e.slice(0,-36)+n}).join(".")}return{...u,id:p,trace_id:h,parent_run_id:f,dotted_order:m,session_name:t}}async postRun(e=!0){this._awaitInputsOnPost&&(this.inputs=await this.inputs);try{const t=wT();if(this.replicas&&this.replicas.length>0)for(const{projectName:e,primary:n,apiKey:r,apiUrl:i,workspaceId:a,reroot:o,client:s}of this.replicas){const c=this._remapForProject({projectName:e??this.project_name,primary:n,runtimeEnv:t,excludeChildRuns:!0,reroot:o,distributedParentId:this.distributedParentId,apiUrl:i,apiKey:r,workspaceId:a}),l=s??this.client;await l.createRun(c,{apiKey:r,apiUrl:i,workspaceId:a})}else{const n=this._convertToCreate(this,t,e);await this.client.createRun(n)}if(!e){rb("Posting with excludeChildRuns=false is deprecated and will be removed in a future version.");for(const e of this.child_runs)await e.postRun(!1)}this.child_runs=[]}catch(t){console.error(`Error in postRun for run ${this.id}:`,t)}}async patchRun(e){const t=e?.excludeInputs??function(){const e=NT("EXCLUDE_INPUTS_ON_PATCH");return void 0===e||"true"===e.toLowerCase()||"1"===e}();if(this.replicas&&this.replicas.length>0)for(const{projectName:r,primary:i,apiKey:a,apiUrl:o,workspaceId:s,updates:c,reroot:l,client:u}of this.replicas){const e=this._remapForProject({projectName:r??this.project_name,primary:i,runtimeEnv:void 0,excludeChildRuns:!0,reroot:l,distributedParentId:this.distributedParentId,apiUrl:o,apiKey:a,workspaceId:s}),n={id:e.id,name:e.name,run_type:e.run_type,start_time:e.start_time,outputs:e.outputs,error:e.error,parent_run_id:e.parent_run_id,session_name:e.session_name,reference_example_id:e.reference_example_id,end_time:e.end_time,dotted_order:e.dotted_order,trace_id:e.trace_id,events:e.events,tags:e.tags,extra:e.extra,attachments:this.attachments,...c};t||(n.inputs=e.inputs);const d=u??this.client;await d.updateRun(e.id,n,{apiKey:a,apiUrl:o,workspaceId:s})}else try{const e={name:this.name,run_type:this.run_type,start_time:this._serialized_start_time??this.start_time,end_time:this.end_time,error:this.error,outputs:this.outputs,parent_run_id:this.parent_run?.id??this.parent_run_id,reference_example_id:this.reference_example_id,extra:this.extra,events:this.events,dotted_order:this.dotted_order,trace_id:this.trace_id,tags:this.tags,attachments:this.attachments,session_name:this.project_name};t||(e.inputs=this.inputs),await this.client.updateRun(this.id,e)}catch(n){console.error(`Error in patchRun for run ${this.id}`,n)}this.child_runs=[]}toJSON(){return this._convertToCreate(this,void 0,!1)}addEvent(e){this.events||(this.events=[]),"string"==typeof e?this.events.push({name:"event",time:(new Date).toISOString(),message:e}):this.events.push({...e,time:e.time??(new Date).toISOString()})}static fromRunnableConfig(e,t){const n=e?.callbacks;let r,i,a,o=!!["TRACING_V2","TRACING"].find(e=>"true"===NT(e));if(n){const e=n?.getParentRunId?.()??"",t=n?.handlers?.find(e=>"langchain_tracer"==e?.name);r=t?.getRun?.(e),i=t?.projectName,a=t?.client,o=o||!!t}if(!r)return new lE({...t,client:a,tracingEnabled:o,project_name:i});return new lE({name:r.name,id:r.id,trace_id:r.trace_id,dotted_order:r.dotted_order,client:a,tracingEnabled:o,project_name:i,tags:[...new Set((r?.tags??[]).concat(e?.tags??[]))],extra:{metadata:{...r?.extra?.metadata,...e?.metadata}}}).createChild(t)}static fromDottedOrder(e){return this.fromHeaders({"langsmith-trace":e})}static fromHeaders(e,t){const n="get"in e&&"function"==typeof e.get?{"langsmith-trace":e.get("langsmith-trace"),baggage:e.get("baggage")}:e,r=n["langsmith-trace"];if(!r||"string"!=typeof r)return;const i=r.trim(),a=i.split(".").map(e=>{const[t,n]=e.split("Z");return{strTime:t,time:Date.parse(t+"Z"),uuid:n}}),o=a[0].uuid,s={...t,name:t?.name??"parent",run_type:t?.run_type??"chain",start_time:t?.start_time??Date.now(),id:a.at(-1)?.uuid,trace_id:o,dotted_order:i};if(n.baggage&&"string"==typeof n.baggage){const e=cE.fromHeader(n.baggage);s.metadata=e.metadata,s.tags=e.tags,s.project_name=e.project_name,s.replicas=e.replicas}const c=new lE(s);return c.distributedParentId=c.id,c}toHeaders(e){const t={"langsmith-trace":this.dotted_order,baggage:new cE(this.extra?.metadata,this.tags,this.project_name,this.replicas).toHeader()};if(e)for(const[n,r]of Object.entries(t))e.set(n,r);return t}}function uE(e){return"object"==typeof e&&null!=e&&"string"==typeof e.name&&"langchain_tracer"===e.name}function dE(e){return Array.isArray(e)&&e.some(e=>uE(e))}Object.defineProperty(lE,"sharedClient",{enumerable:!0,configurable:!0,writable:!0,value:null});function pE(e,t){if(e)return new lE({...e,start_time:e._serialized_start_time??e.start_time,parent_run:pE(t),child_runs:e.child_runs.map(e=>pE(e)).filter(e=>void 0!==e),extra:{...e.extra,runtime:(void 0===fS&&(fS={library:"langchain-js",runtime:hS()}),fS)},tracingEnabled:!1})}function hE(e,t){return e&&!Array.isArray(e)&&"object"==typeof e?e:{[t]:e}}function fE(e){return"function"==typeof e._addRunToRunMap}var mE=class extends RS{runMap=new Map;runTreeMap=new Map;usesRunTreeMap=!1;constructor(e){super(...arguments)}copy(){return this}getRunById(e){if(void 0!==e)return this.usesRunTreeMap?(e=>{if(e)return e.events=e.events??[],e.child_runs=e.child_runs??[],e})(this.runTreeMap.get(e)):this.runMap.get(e)}stringifyError(e){return e instanceof Error?e.message+(e?.stack?`\n\n${e.stack}`:""):"string"==typeof e?e:`${e}`}_addChildRun(e,t){e.child_runs.push(t)}_addRunToRunMap(e){const{dottedOrder:t,microsecondPrecisionDatestring:n}=aE(new Date(e.start_time).getTime(),e.id,e.execution_order),r={...e},i=this.getRunById(r.parent_run_id);if(void 0!==r.parent_run_id?i?(this._addChildRun(i,r),i.child_execution_order=Math.max(i.child_execution_order,r.child_execution_order),r.trace_id=i.trace_id,void 0!==i.dotted_order&&(r.dotted_order=[i.dotted_order,t].join("."),r._serialized_start_time=n)):r.parent_run_id=void 0:(r.trace_id=r.id,r.dotted_order=t,r._serialized_start_time=n),this.usesRunTreeMap){const e=pE(r,i);void 0!==e&&this.runTreeMap.set(r.id,e)}else this.runMap.set(r.id,r);return r}async _endTrace(e){const t=void 0!==e.parent_run_id&&this.getRunById(e.parent_run_id);t?t.child_execution_order=Math.max(t.child_execution_order,e.child_execution_order):await this.persistRun(e),await(this.onRunUpdate?.(e)),this.usesRunTreeMap?this.runTreeMap.delete(e.id):this.runMap.delete(e.id)}_getExecutionOrder(e){const t=void 0!==e&&this.getRunById(e);return t?t.child_execution_order+1:1}_createRunForLLMStart(e,t,n,r,i,a,o,s){const c=this._getExecutionOrder(r),l=Date.now(),u=o?{...i,metadata:o}:i,d={id:n,name:s??e.id[e.id.length-1],parent_run_id:r,start_time:l,serialized:e,events:[{name:"start",time:new Date(l).toISOString()}],inputs:{prompts:t},execution_order:c,child_runs:[],child_execution_order:c,run_type:"llm",extra:u??{},tags:a||[]};return this._addRunToRunMap(d)}async handleLLMStart(e,t,n,r,i,a,o,s){const c=this.getRunById(n)??this._createRunForLLMStart(e,t,n,r,i,a,o,s);return await(this.onRunCreate?.(c)),await(this.onLLMStart?.(c)),c}_createRunForChatModelStart(e,t,n,r,i,a,o,s){const c=this._getExecutionOrder(r),l=Date.now(),u=o?{...i,metadata:o}:i,d={id:n,name:s??e.id[e.id.length-1],parent_run_id:r,start_time:l,serialized:e,events:[{name:"start",time:new Date(l).toISOString()}],inputs:{messages:t},execution_order:c,child_runs:[],child_execution_order:c,run_type:"llm",extra:u??{},tags:a||[]};return this._addRunToRunMap(d)}async handleChatModelStart(e,t,n,r,i,a,o,s){const c=this.getRunById(n)??this._createRunForChatModelStart(e,t,n,r,i,a,o,s);return await(this.onRunCreate?.(c)),await(this.onLLMStart?.(c)),c}async handleLLMEnd(e,t,n,r,i){const a=this.getRunById(t);if(!a||"llm"!==a?.run_type)throw new Error("No LLM run to end.");return a.end_time=Date.now(),a.outputs=e,a.events.push({name:"end",time:new Date(a.end_time).toISOString()}),a.extra={...a.extra,...i},await(this.onLLMEnd?.(a)),await this._endTrace(a),a}async handleLLMError(e,t,n,r,i){const a=this.getRunById(t);if(!a||"llm"!==a?.run_type)throw new Error("No LLM run to end.");return a.end_time=Date.now(),a.error=this.stringifyError(e),a.events.push({name:"error",time:new Date(a.end_time).toISOString()}),a.extra={...a.extra,...i},await(this.onLLMError?.(a)),await this._endTrace(a),a}_createRunForChainStart(e,t,n,r,i,a,o,s,c){const l=this._getExecutionOrder(r),u=Date.now(),d={id:n,name:s??e.id[e.id.length-1],parent_run_id:r,start_time:u,serialized:e,events:[{name:"start",time:new Date(u).toISOString()}],inputs:t,execution_order:l,child_execution_order:l,run_type:o??"chain",child_runs:[],extra:a?{...c,metadata:a}:{...c},tags:i||[]};return this._addRunToRunMap(d)}async handleChainStart(e,t,n,r,i,a,o,s){const c=this.getRunById(n)??this._createRunForChainStart(e,t,n,r,i,a,o,s);return await(this.onRunCreate?.(c)),await(this.onChainStart?.(c)),c}async handleChainEnd(e,t,n,r,i){const a=this.getRunById(t);if(!a)throw new Error("No chain run to end.");return a.end_time=Date.now(),a.outputs=hE(e,"output"),a.events.push({name:"end",time:new Date(a.end_time).toISOString()}),void 0!==i?.inputs&&(a.inputs=hE(i.inputs,"input")),await(this.onChainEnd?.(a)),await this._endTrace(a),a}async handleChainError(e,t,n,r,i){const a=this.getRunById(t);if(!a)throw new Error("No chain run to end.");return a.end_time=Date.now(),a.error=this.stringifyError(e),a.events.push({name:"error",time:new Date(a.end_time).toISOString()}),void 0!==i?.inputs&&(a.inputs=hE(i.inputs,"input")),await(this.onChainError?.(a)),await this._endTrace(a),a}_createRunForToolStart(e,t,n,r,i,a,o){const s=this._getExecutionOrder(r),c=Date.now(),l={id:n,name:o??e.id[e.id.length-1],parent_run_id:r,start_time:c,serialized:e,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{input:t},execution_order:s,child_execution_order:s,run_type:"tool",child_runs:[],extra:a?{metadata:a}:{},tags:i||[]};return this._addRunToRunMap(l)}async handleToolStart(e,t,n,r,i,a,o){const s=this.getRunById(n)??this._createRunForToolStart(e,t,n,r,i,a,o);return await(this.onRunCreate?.(s)),await(this.onToolStart?.(s)),s}async handleToolEnd(e,t){const n=this.getRunById(t);if(!n||"tool"!==n?.run_type)throw new Error("No tool run to end");return n.end_time=Date.now(),n.outputs={output:e},n.events.push({name:"end",time:new Date(n.end_time).toISOString()}),await(this.onToolEnd?.(n)),await this._endTrace(n),n}async handleToolError(e,t){const n=this.getRunById(t);if(!n||"tool"!==n?.run_type)throw new Error("No tool run to end");return n.end_time=Date.now(),n.error=this.stringifyError(e),n.events.push({name:"error",time:new Date(n.end_time).toISOString()}),await(this.onToolError?.(n)),await this._endTrace(n),n}async handleAgentAction(e,t){const n=this.getRunById(t);if(!n||"chain"!==n?.run_type)return;const r=n;r.actions=r.actions||[],r.actions.push(e),r.events.push({name:"agent_action",time:(new Date).toISOString(),kwargs:{action:e}}),await(this.onAgentAction?.(n))}async handleAgentEnd(e,t){const n=this.getRunById(t);n&&"chain"===n?.run_type&&(n.events.push({name:"agent_end",time:(new Date).toISOString(),kwargs:{action:e}}),await(this.onAgentEnd?.(n)))}_createRunForRetrieverStart(e,t,n,r,i,a,o){const s=this._getExecutionOrder(r),c=Date.now(),l={id:n,name:o??e.id[e.id.length-1],parent_run_id:r,start_time:c,serialized:e,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{query:t},execution_order:s,child_execution_order:s,run_type:"retriever",child_runs:[],extra:a?{metadata:a}:{},tags:i||[]};return this._addRunToRunMap(l)}async handleRetrieverStart(e,t,n,r,i,a,o){const s=this.getRunById(n)??this._createRunForRetrieverStart(e,t,n,r,i,a,o);return await(this.onRunCreate?.(s)),await(this.onRetrieverStart?.(s)),s}async handleRetrieverEnd(e,t){const n=this.getRunById(t);if(!n||"retriever"!==n?.run_type)throw new Error("No retriever run to end");return n.end_time=Date.now(),n.outputs={documents:e},n.events.push({name:"end",time:new Date(n.end_time).toISOString()}),await(this.onRetrieverEnd?.(n)),await this._endTrace(n),n}async handleRetrieverError(e,t){const n=this.getRunById(t);if(!n||"retriever"!==n?.run_type)throw new Error("No retriever run to end");return n.end_time=Date.now(),n.error=this.stringifyError(e),n.events.push({name:"error",time:new Date(n.end_time).toISOString()}),await(this.onRetrieverError?.(n)),await this._endTrace(n),n}async handleText(e,t){const n=this.getRunById(t);n&&"chain"===n?.run_type&&(n.events.push({name:"text",time:(new Date).toISOString(),kwargs:{text:e}}),await(this.onText?.(n)))}async handleLLMNewToken(e,t,n,r,i,a){const o=this.getRunById(n);if(!o||"llm"!==o?.run_type)throw new Error('Invalid "runId" provided to "handleLLMNewToken" callback.');return o.events.push({name:"new_token",time:(new Date).toISOString(),kwargs:{token:e,idx:t,chunk:a?.chunk}}),await(this.onLLMNewToken?.(o,e,{chunk:a?.chunk})),o}};const gE={bold:{open:"",close:""},color:{grey:{open:"",close:""},green:{open:"",close:""},cyan:{open:"",close:""},red:{open:"",close:""},blue:{open:"",close:""}}};function yE(e,t){return`${e.open}${t}${e.close}`}function IE(e,t){try{return JSON.stringify(e,null,2)}catch{return t}}function CE(e){return"string"==typeof e?e.trim():null==e?e:IE(e,e.toString())}function AE(e){if(!e.end_time)return"";const t=e.end_time-e.start_time;return t<1e3?`${t}ms`:`${(t/1e3).toFixed(2)}s`}const{color:SE}=gE;var bE=class extends mE{name="console_callback_handler";persistRun(e){return Promise.resolve()}getParents(e){const t=[];let n=e;for(;n.parent_run_id;){const e=this.runMap.get(n.parent_run_id);if(!e)break;t.push(e),n=e}return t}getBreadcrumbs(e){const t=[...this.getParents(e).reverse(),e].map((e,t,n)=>{const r=`${e.execution_order}:${e.run_type}:${e.name}`;return t===n.length-1?yE(gE.bold,r):r}).join(" > ");return yE(SE.grey,t)}onChainStart(e){const t=this.getBreadcrumbs(e);console.log(`${yE(SE.green,"[chain/start]")} [${t}] Entering Chain run with input: ${IE(e.inputs,"[inputs]")}`)}onChainEnd(e){const t=this.getBreadcrumbs(e);console.log(`${yE(SE.cyan,"[chain/end]")} [${t}] [${AE(e)}] Exiting Chain run with output: ${IE(e.outputs,"[outputs]")}`)}onChainError(e){const t=this.getBreadcrumbs(e);console.log(`${yE(SE.red,"[chain/error]")} [${t}] [${AE(e)}] Chain run errored with error: ${IE(e.error,"[error]")}`)}onLLMStart(e){const t=this.getBreadcrumbs(e),n="prompts"in e.inputs?{prompts:e.inputs.prompts.map(e=>e.trim())}:e.inputs;console.log(`${yE(SE.green,"[llm/start]")} [${t}] Entering LLM run with input: ${IE(n,"[inputs]")}`)}onLLMEnd(e){const t=this.getBreadcrumbs(e);console.log(`${yE(SE.cyan,"[llm/end]")} [${t}] [${AE(e)}] Exiting LLM run with output: ${IE(e.outputs,"[response]")}`)}onLLMError(e){const t=this.getBreadcrumbs(e);console.log(`${yE(SE.red,"[llm/error]")} [${t}] [${AE(e)}] LLM run errored with error: ${IE(e.error,"[error]")}`)}onToolStart(e){const t=this.getBreadcrumbs(e);console.log(`${yE(SE.green,"[tool/start]")} [${t}] Entering Tool run with input: "${CE(e.inputs.input)}"`)}onToolEnd(e){const t=this.getBreadcrumbs(e);console.log(`${yE(SE.cyan,"[tool/end]")} [${t}] [${AE(e)}] Exiting Tool run with output: "${CE(e.outputs?.output)}"`)}onToolError(e){const t=this.getBreadcrumbs(e);console.log(`${yE(SE.red,"[tool/error]")} [${t}] [${AE(e)}] Tool run errored with error: ${IE(e.error,"[error]")}`)}onRetrieverStart(e){const t=this.getBreadcrumbs(e);console.log(`${yE(SE.green,"[retriever/start]")} [${t}] Entering Retriever run with input: ${IE(e.inputs,"[inputs]")}`)}onRetrieverEnd(e){const t=this.getBreadcrumbs(e);console.log(`${yE(SE.cyan,"[retriever/end]")} [${t}] [${AE(e)}] Exiting Retriever run with output: ${IE(e.outputs,"[outputs]")}`)}onRetrieverError(e){const t=this.getBreadcrumbs(e);console.log(`${yE(SE.red,"[retriever/error]")} [${t}] [${AE(e)}] Retriever run errored with error: ${IE(e.error,"[error]")}`)}onAgentAction(e){const t=e,n=this.getBreadcrumbs(e);console.log(`${yE(SE.blue,"[agent/action]")} [${n}] Agent selected action: ${IE(t.actions[t.actions.length-1],"[action]")}`)}};let TE;const vE=new Set(["ls_agent_type"]);var _E=class e extends mE{fields;name="langchain_tracer";projectName;exampleId;client;replicas;usesRunTreeMap=!0;tracingMetadata;tracingTags=[];constructor(t={}){super(t),this.fields=t;const{exampleId:n,projectName:r,client:i,replicas:a,metadata:o,tags:s}=t;this.projectName=r??tb(),this.replicas=a,this.exampleId=n,this.client=i??(()=>{if(void 0===TE){const e="false"===mS("LANGCHAIN_CALLBACKS_BACKGROUND")?{blockOnRootRunFinalization:!0}:{};TE=new zw(e)}return TE})(),this.tracingMetadata=o?{...o}:void 0,this.tracingTags=s??[];const c=e.getTraceableRunTree();c&&this.updateFromRunTree(c)}async persistRun(e){}async onRunCreate(e){wE(this,e),e.extra?.lc_defers_inputs||await(this.getRunTreeWithTracingConfig(e.id)?.postRun())}async onRunUpdate(e){wE(this,e);const t=this.getRunTreeWithTracingConfig(e.id);e.extra?.lc_defers_inputs?await(t?.postRun()):await(t?.patchRun())}onLLMEnd(e){const t=e.outputs;if(t?.generations){const n=function(e){let t;for(const n of e)for(const e of n)YA.isInstance(e.message)&&void 0!==e.message.usage_metadata&&(t=yA(t,e.message.usage_metadata));return t}(t.generations);if(void 0!==n){e.extra=e.extra??{};const t=e.extra.metadata??{};t.usage_metadata=n,e.extra.metadata=t}}}copyWithTracingConfig({metadata:t,tags:n}){let r;if(void 0===t)r=this.tracingMetadata?{...this.tracingMetadata}:void 0;else if(void 0===this.tracingMetadata)r={...t};else{r={...this.tracingMetadata};for(const[e,n]of Object.entries(t))Object.prototype.hasOwnProperty.call(r,e)&&!vE.has(e)||(r[e]=n)}const i=n?Array.from(new Set([...this.tracingTags,...n])):[...this.tracingTags],a=new e({...this.fields,metadata:r,tags:i});return a.runMap=this.runMap,a.runTreeMap=this.runTreeMap,a}_getRunStoreKey(){return this.runTreeMap}getRun(e){return this.runTreeMap.get(e)}updateFromRunTree(e){this.runTreeMap.set(e.id,e);let t=e;const n=new Set;for(;t.parent_run&&!n.has(t.id)&&(n.add(t.id),t.parent_run);)t=t.parent_run;n.clear();const r=[t];for(;r.length>0;){const e=r.shift();e&&!n.has(e.id)&&(n.add(e.id),this.runTreeMap.set(e.id,e),e.child_runs&&r.push(...e.child_runs))}this.client=e.client??this.client,this.replicas=e.replicas??this.replicas,this.projectName=e.project_name??this.projectName,this.exampleId=e.reference_example_id??this.exampleId,this.fields={...this.fields,client:this.client,replicas:this.replicas,projectName:this.projectName,exampleId:this.exampleId}}getRunTreeWithTracingConfig(e){const t=this.runTreeMap.get(e);if(t)return new lE({...t,client:this.client,project_name:this.projectName,replicas:this.replicas,reference_example_id:this.exampleId,tracingEnabled:!0})}static getTraceableRunTree(){try{return function(e=!1){const t=Qb.getInstance().getStore();if(!e&&void 0===t)throw new Error("Could not get the current run tree.\n\nPlease make sure you are calling this method within a traceable function and that tracing is enabled.");return t}(!0)}catch{return}}static[Symbol.hasInstance](e){if("object"!=typeof e||null===e)return!1;const t=e;return"name"in t&&"langchain_tracer"===t.name&&"copyWithTracingConfig"in t&&"function"==typeof t.copyWithTracingConfig&&"getRunTreeWithTracingConfig"in t&&"function"==typeof t.getRunTreeWithTracingConfig}};function wE(e,t){if(e.tracingMetadata){t.extra??={};const n=t.extra.metadata??{};let r=!1;for(const[t,i]of Object.entries(e.tracingMetadata))Object.prototype.hasOwnProperty.call(n,t)&&!vE.has(t)||n[t]!==i&&(n[t]=i,r=!0);r&&(t.extra.metadata=n)}e.tracingTags.length>0&&(t.tags=Array.from(new Set([...t.tags??[],...e.tracingTags])))}const EE=Symbol.for("ls:tracing_async_local_storage"),PE=Symbol.for("lc:context_variables"),RE=()=>globalThis[EE];let LE;function NE(){return void 0===LE&&(LE=new("default"in mv?mv.default:mv)({autoStart:!0,concurrency:1})),LE}async function OE(e,t){if(!0===t){const t=RE();void 0!==t?await t.run(void 0,async()=>e()):await e()}else LE=NE(),LE.add(async()=>{const t=RE();void 0!==t?await t.run(void 0,async()=>e()):await e()})}function BE(e){const t=RE();if(void 0!==t)return t.getStore()?.[PE]?.[e]}const ME=Symbol("lc:configure_hooks");function DE(e){return e._getRunStoreKey?.()??e}var FE=class{setHandler(e){return this.setHandlers([e])}},kE=class{runId;handlers;inheritableHandlers;tags;inheritableTags;metadata;inheritableMetadata;_parentRunId;constructor(e,t,n,r,i,a,o,s){this.runId=e,this.handlers=t,this.inheritableHandlers=n,this.tags=r,this.inheritableTags=i,this.metadata=a,this.inheritableMetadata=o,this._parentRunId=s}get parentRunId(){return this._parentRunId}async handleText(e){await Promise.all(this.handlers.map(t=>OE(async()=>{try{await(t.handleText?.(e,this.runId,this._parentRunId,this.tags))}catch(n){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleText: ${n}`),t.raiseError)throw n}},t.awaitHandlers)))}async handleCustomEvent(e,t,n,r,i){await Promise.all(this.handlers.map(n=>OE(async()=>{try{await(n.handleCustomEvent?.(e,t,this.runId,this.tags,this.metadata))}catch(r){if((n.raiseError?console.error:console.warn)(`Error in handler ${n.constructor.name}, handleCustomEvent: ${r}`),n.raiseError)throw r}},n.awaitHandlers)))}},GE=class extends kE{getChild(e){const t=new VE(this.runId);return t.setHandlers(this.inheritableHandlers),t.addTags(this.inheritableTags),t.addMetadata(this.inheritableMetadata),e&&t.addTags([e],!1),t}async handleRetrieverEnd(e){await Promise.all(this.handlers.map(t=>OE(async()=>{if(!t.ignoreRetriever)try{await(t.handleRetrieverEnd?.(e,this.runId,this._parentRunId,this.tags))}catch(n){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleRetriever`),t.raiseError)throw n}},t.awaitHandlers)))}async handleRetrieverError(e){await Promise.all(this.handlers.map(t=>OE(async()=>{if(!t.ignoreRetriever)try{await(t.handleRetrieverError?.(e,this.runId,this._parentRunId,this.tags))}catch(n){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleRetrieverError: ${n}`),t.raiseError)throw e}},t.awaitHandlers)))}},xE=class extends kE{async handleLLMNewToken(e,t,n,r,i,a){await Promise.all(this.handlers.map(n=>OE(async()=>{if(!n.ignoreLLM)try{await(n.handleLLMNewToken?.(e,t??{prompt:0,completion:0},this.runId,this._parentRunId,this.tags,a))}catch(r){if((n.raiseError?console.error:console.warn)(`Error in handler ${n.constructor.name}, handleLLMNewToken: ${r}`),n.raiseError)throw r}},n.awaitHandlers)))}async handleChatModelStreamEvent(e){await Promise.all(this.handlers.map(t=>OE(async()=>{if(!t.ignoreLLM)try{await(t.handleChatModelStreamEvent?.(e,this.runId,this._parentRunId,this.tags))}catch(n){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleChatModelStreamEvent: ${n}`),t.raiseError)throw n}},t.awaitHandlers)))}async handleLLMError(e,t,n,r,i){await Promise.all(this.handlers.map(t=>OE(async()=>{if(!t.ignoreLLM)try{await(t.handleLLMError?.(e,this.runId,this._parentRunId,this.tags,i))}catch(n){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleLLMError: ${n}`),t.raiseError)throw n}},t.awaitHandlers)))}async handleLLMEnd(e,t,n,r,i){await Promise.all(this.handlers.map(t=>OE(async()=>{if(!t.ignoreLLM)try{await(t.handleLLMEnd?.(e,this.runId,this._parentRunId,this.tags,i))}catch(n){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleLLMEnd: ${n}`),t.raiseError)throw n}},t.awaitHandlers)))}},HE=class extends kE{getChild(e){const t=new VE(this.runId);return t.setHandlers(this.inheritableHandlers),t.addTags(this.inheritableTags),t.addMetadata(this.inheritableMetadata),e&&t.addTags([e],!1),t}async handleChainError(e,t,n,r,i){await Promise.all(this.handlers.map(t=>OE(async()=>{if(!t.ignoreChain)try{await(t.handleChainError?.(e,this.runId,this._parentRunId,this.tags,i))}catch(n){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleChainError: ${n}`),t.raiseError)throw n}},t.awaitHandlers)))}async handleChainEnd(e,t,n,r,i){await Promise.all(this.handlers.map(t=>OE(async()=>{if(!t.ignoreChain)try{await(t.handleChainEnd?.(e,this.runId,this._parentRunId,this.tags,i))}catch(n){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleChainEnd: ${n}`),t.raiseError)throw n}},t.awaitHandlers)))}async handleAgentAction(e){await Promise.all(this.handlers.map(t=>OE(async()=>{if(!t.ignoreAgent)try{await(t.handleAgentAction?.(e,this.runId,this._parentRunId,this.tags))}catch(n){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleAgentAction: ${n}`),t.raiseError)throw n}},t.awaitHandlers)))}async handleAgentEnd(e){await Promise.all(this.handlers.map(t=>OE(async()=>{if(!t.ignoreAgent)try{await(t.handleAgentEnd?.(e,this.runId,this._parentRunId,this.tags))}catch(n){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleAgentEnd: ${n}`),t.raiseError)throw n}},t.awaitHandlers)))}},UE=class extends kE{getChild(e){const t=new VE(this.runId);return t.setHandlers(this.inheritableHandlers),t.addTags(this.inheritableTags),t.addMetadata(this.inheritableMetadata),e&&t.addTags([e],!1),t}async handleToolError(e){await Promise.all(this.handlers.map(t=>OE(async()=>{if(!t.ignoreAgent)try{await(t.handleToolError?.(e,this.runId,this._parentRunId,this.tags))}catch(n){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleToolError: ${n}`),t.raiseError)throw n}},t.awaitHandlers)))}async handleToolEvent(e){await Promise.all(this.handlers.map(t=>OE(async()=>{if(!t.ignoreAgent)try{await(t.handleToolEvent?.(e,this.runId,this._parentRunId,this.tags))}catch(n){if(t.raiseError)throw n}},t.awaitHandlers)))}async handleToolEnd(e){await Promise.all(this.handlers.map(t=>OE(async()=>{if(!t.ignoreAgent)try{await(t.handleToolEnd?.(e,this.runId,this._parentRunId,this.tags))}catch(n){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleToolEnd: ${n}`),t.raiseError)throw n}},t.awaitHandlers)))}},VE=class e extends FE{handlers=[];inheritableHandlers=[];tags=[];inheritableTags=[];metadata={};inheritableMetadata={};name="callback_manager";_parentRunId;constructor(e,t){super(),this.handlers=t?.handlers??this.handlers,this.inheritableHandlers=t?.inheritableHandlers??this.inheritableHandlers,this.tags=t?.tags??this.tags,this.inheritableTags=t?.inheritableTags??this.inheritableTags,this.metadata=t?.metadata??this.metadata,this.inheritableMetadata=t?.inheritableMetadata??this.inheritableMetadata,this._parentRunId=e}getParentRunId(){return this._parentRunId}async handleLLMStart(e,t,n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0){return Promise.all(t.map(async(t,r)=>{const a=0===r&&n?n:vS();return await Promise.all(this.handlers.map(n=>{if(!n.ignoreLLM)return fE(n)&&n._createRunForLLMStart(e,[t],a,this._parentRunId,i,this.tags,this.metadata,s),OE(async()=>{try{await(n.handleLLMStart?.(e,[t],a,this._parentRunId,i,this.tags,this.metadata,s))}catch(r){if((n.raiseError?console.error:console.warn)(`Error in handler ${n.constructor.name}, handleLLMStart: ${r}`),n.raiseError)throw r}},n.awaitHandlers)})),new xE(a,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChatModelStart(e,t,n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0){return Promise.all(t.map(async(t,r)=>{const a=0===r&&n?n:vS();return await Promise.all(this.handlers.map(n=>{if(!n.ignoreLLM)return fE(n)&&n._createRunForChatModelStart(e,[t],a,this._parentRunId,i,this.tags,this.metadata,s),OE(async()=>{try{if(n.handleChatModelStart)await(n.handleChatModelStart?.(e,[t],a,this._parentRunId,i,this.tags,this.metadata,s));else if(n.handleLLMStart){const r=WA(t);await(n.handleLLMStart?.(e,[r],a,this._parentRunId,i,this.tags,this.metadata,s))}}catch(r){if((n.raiseError?console.error:console.warn)(`Error in handler ${n.constructor.name}, handleLLMStart: ${r}`),n.raiseError)throw r}},n.awaitHandlers)})),new xE(a,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChainStart(e,t,n=vS(),r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,c=void 0){return await Promise.all(this.handlers.map(i=>{if(!i.ignoreChain)return fE(i)&&i._createRunForChainStart(e,t,n,this._parentRunId,this.tags,this.metadata,r,o,c),OE(async()=>{try{await(i.handleChainStart?.(e,t,n,this._parentRunId,this.tags,this.metadata,r,o,c))}catch(a){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleChainStart: ${a}`),i.raiseError)throw a}},i.awaitHandlers)})),new HE(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleToolStart(e,t,n=vS(),r=void 0,i=void 0,a=void 0,o=void 0,s=void 0){return await Promise.all(this.handlers.map(r=>{if(!r.ignoreAgent)return fE(r)&&r._createRunForToolStart(e,t,n,this._parentRunId,this.tags,this.metadata,o),OE(async()=>{try{await(r.handleToolStart?.(e,t,n,this._parentRunId,this.tags,this.metadata,o,s))}catch(i){if((r.raiseError?console.error:console.warn)(`Error in handler ${r.constructor.name}, handleToolStart: ${i}`),r.raiseError)throw i}},r.awaitHandlers)})),new UE(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleRetrieverStart(e,t,n=vS(),r=void 0,i=void 0,a=void 0,o=void 0){return await Promise.all(this.handlers.map(r=>{if(!r.ignoreRetriever)return fE(r)&&r._createRunForRetrieverStart(e,t,n,this._parentRunId,this.tags,this.metadata,o),OE(async()=>{try{await(r.handleRetrieverStart?.(e,t,n,this._parentRunId,this.tags,this.metadata,o))}catch(i){if((r.raiseError?console.error:console.warn)(`Error in handler ${r.constructor.name}, handleRetrieverStart: ${i}`),r.raiseError)throw i}},r.awaitHandlers)})),new GE(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleCustomEvent(e,t,n,r,i){await Promise.all(this.handlers.map(r=>OE(async()=>{if(!r.ignoreCustomEvent)try{await(r.handleCustomEvent?.(e,t,n,this.tags,this.metadata))}catch(i){if((r.raiseError?console.error:console.warn)(`Error in handler ${r.constructor.name}, handleCustomEvent: ${i}`),r.raiseError)throw i}},r.awaitHandlers)))}addHandler(e,t=!0){this.handlers.push(e),t&&this.inheritableHandlers.push(e)}removeHandler(e){this.handlers=this.handlers.filter(t=>t!==e),this.inheritableHandlers=this.inheritableHandlers.filter(t=>t!==e)}setHandlers(e,t=!0){this.handlers=[],this.inheritableHandlers=[];for(const n of e)this.addHandler(n,t)}addTags(e,t=!0){this.removeTags(e),this.tags.push(...e),t&&this.inheritableTags.push(...e)}removeTags(e){this.tags=this.tags.filter(t=>!e.includes(t)),this.inheritableTags=this.inheritableTags.filter(t=>!e.includes(t))}addMetadata(e,t=!0){this.metadata={...this.metadata,...e},t&&(this.inheritableMetadata={...this.inheritableMetadata,...e})}removeMetadata(e){for(const t of Object.keys(e))delete this.metadata[t],delete this.inheritableMetadata[t]}copy(t=[],n=!0){const r=new e(this._parentRunId);for(const e of this.handlers){const t=this.inheritableHandlers.includes(e);r.addHandler(e,t)}for(const e of this.tags){const t=this.inheritableTags.includes(e);r.addTags([e],t)}for(const e of Object.keys(this.metadata)){const t=Object.keys(this.inheritableMetadata).includes(e);r.addMetadata({[e]:this.metadata[e]},t)}for(const e of t)r.handlers.filter(e=>"console_callback_handler"===e.name).some(t=>t.name===e.name)||r.addHandler(e,n);return r}static fromHandlers(e){const t=new this;return t.addHandler(new class extends RS{name=vS();constructor(){super(),Object.assign(this,e)}}),t}static configure(e,t,n,r,i,a,o){return this._configureSync(e,t,n,r,i,a,o)}static _configureSync(t,n,r,i,a,o,s){let c;(t||n)&&(Array.isArray(t)||!t?(c=new e,c.setHandlers(t?.map($E)??[],!0)):c=t,c=c.copy(Array.isArray(n)?n.map($E):n?.handlers,!1));const l="true"===mS("LANGCHAIN_VERBOSE")||s?.verbose,u=_E.getTraceableRunTree(),d=u?.tracingEnabled??!!["LANGSMITH_TRACING_V2","LANGCHAIN_TRACING_V2","LANGSMITH_TRACING","LANGCHAIN_TRACING"].find(e=>"true"===mS(e));if(!1===u?.tracingEnabled&&c){const e=c.handlers.filter(e=>"langchain_tracer"===e.name);for(const t of e)c.removeHandler(t)}const p=d||(mS("LANGCHAIN_TRACING")??!1);if(l||p){if(c||(c=new e),l&&!c.handlers.some(e=>e.name===bE.prototype.name)){const e=new bE;c.addHandler(e,!0)}if(p&&!c.handlers.some(e=>"langchain_tracer"===e.name)&&d){const e=new _E;c.addHandler(e,!0)}d&&u&&void 0===c._parentRunId&&(c._parentRunId=u.id,c.handlers.find(e=>"langchain_tracer"===e.name)?.updateFromRunTree(u))}for(const{contextVar:m,inheritable:g=!0,handlerClass:y,envVar:I}of BE(ME)||[]){const t=I&&"true"===mS(I)&&y;let n;const r=void 0!==m?BE(m):void 0;r&&LS(r)?n=r:t&&(n=new y({})),void 0!==n&&(c||(c=new e),c.handlers.some(e=>e.name===n.name)||c.addHandler(n,g))}(r||i)&&c&&(c.addTags(r??[]),c.addTags(i??[],!1)),(a||o)&&c&&(c.addMetadata(a??{}),c.addMetadata(o??{},!1));const h=s?.tracerInheritableMetadata,f=s?.tracerInheritableTags;if(c&&(h||f)){const e=new Map,t=t=>{if(!(t instanceof _E))return t;const n=e.get(t);if(void 0!==n)return n;const r=t.copyWithTracingConfig({metadata:h,tags:f});return e.set(t,r),r};c.handlers=c.handlers.map(t),c.inheritableHandlers=c.inheritableHandlers.map(t)}if(c){const e=function(e,t){const n=new Set(t),r=new Map,i=[],a=e=>{const t=DE(e),a=n.has(e),o=r.get(t);if(void 0===o)return r.set(t,{index:i.length,tracer:e,hasInheritable:a}),void i.push(e);var s,c;a&&!o.hasInheritable?(o.tracer=e,o.hasInheritable=!0):!a&&o.hasInheritable||(o.tracer=(s=o.tracer)===(c=e)?s:s.copyWithTracingConfig({metadata:c.tracingMetadata,tags:c.tracingTags})),i[o.index]=o.tracer};for(const s of e)s instanceof _E?a(s):i.push(s);for(const s of t)s instanceof _E&&!r.has(DE(s))&&a(s);const o=new Set;return{handlers:i,inheritableHandlers:t.flatMap(e=>{if(!(e instanceof _E))return[e];const t=DE(e);return o.has(t)?[]:(o.add(t),[r.get(t)?.tracer??e])})}}(c.handlers,c.inheritableHandlers);c.handlers=e.handlers,c.inheritableHandlers=e.inheritableHandlers}return c}};function $E(e){return"name"in e?e:RS.fromMethods(e)}const jE=new class{getStore(){}run(e,t){return t()}enterWith(e){}},WE=Symbol.for("lc:child_config");const XE=new class{getInstance(){return RE()??jE}getRunnableConfig(){return this.getInstance().getStore()?.extra?.[WE]}runWithConfig(e,t,n){const r=VE._configureSync(e?.callbacks,void 0,e?.tags,void 0,e?.metadata),i=this.getInstance(),a=i.getStore(),o=r?.getParentRunId(),s=r?.handlers?.find(e=>"langchain_tracer"===e?.name);let c;return s&&o?c=s.getRunTreeWithTracingConfig(o):n||(c=new lE({name:"<runnable_lambda>",tracingEnabled:!1})),c&&(c.extra={...c.extra,[WE]:e}),void 0!==a&&void 0!==a[PE]&&(void 0===c&&(c={}),c[PE]=a[PE]),i.run(c,t)}initializeGlobalInstance(e){void 0===RE()&&(e=>{globalThis[EE]=e})(e)}},KE=new Set(["api_key"]),YE=new Set(["string","number","boolean"]);function qE(e){const t=e.configurable??{},n=e.metadata??{},r={};for(const[i,a]of Object.entries(t))i.startsWith("__")||Object.prototype.hasOwnProperty.call(n,i)||KE.has(i)||!YE.has(typeof a)||(r[i]=a);return Object.keys(r).length>0?r:void 0}async function QE(e){return VE._configureSync(e?.callbacks,void 0,e?.tags,void 0,e?.metadata,void 0,{tracerInheritableMetadata:e?qE(e):void 0})}function JE(...e){const t={};for(const n of e.filter(e=>!!e))for(const e of Object.keys(n))if("metadata"===e)t[e]={...t[e],...n[e]};else if("tags"===e){const r=t[e]??[];t[e]=[...new Set(r.concat(n[e]??[]))]}else if("configurable"===e)t[e]={...t[e],...n[e]};else if("timeout"===e)void 0===t.timeout?t.timeout=n.timeout:void 0!==n.timeout&&(t.timeout=Math.min(t.timeout,n.timeout));else if("signal"===e)void 0===t.signal?t.signal=n.signal:void 0!==n.signal&&("any"in AbortSignal?t.signal=AbortSignal.any([t.signal,n.signal]):t.signal=n.signal);else if("callbacks"===e){const e=t.callbacks,r=n.callbacks;if(Array.isArray(r))if(e)if(Array.isArray(e))t.callbacks=e.concat(r);else{const n=e.copy();for(const e of r)n.addHandler($E(e),!0);t.callbacks=n}else t.callbacks=r;else if(r)if(e)if(Array.isArray(e)){const n=r.copy();for(const t of e)n.addHandler($E(t),!0);t.callbacks=n}else t.callbacks=new VE(r._parentRunId,{handlers:e.handlers.concat(r.handlers),inheritableHandlers:e.inheritableHandlers.concat(r.inheritableHandlers),tags:Array.from(new Set(e.tags.concat(r.tags))),inheritableTags:Array.from(new Set(e.inheritableTags.concat(r.inheritableTags))),metadata:{...e.metadata,...r.metadata}});else t.callbacks=r}else{const r=e;t[r]=n[r]??t[r]}return t}function zE(e){const t=XE.getRunnableConfig();let n={tags:[],metadata:{},recursionLimit:25,runId:void 0};if(t){const{runId:e,runName:r,...i}=t;n=Object.entries(i).reduce((e,[t,n])=>(void 0!==n&&(e[t]=n),e),n)}if(e&&(n=Object.entries(e).reduce((e,[t,n])=>(void 0!==n&&(e[t]=n),e),n)),n?.configurable&&"string"==typeof n.configurable.model&&void 0===n.metadata?.model&&(n.metadata||(n.metadata={}),n.metadata.model=n.configurable.model),void 0!==n.timeout){if(n.timeout<=0)throw new Error("Timeout must be a positive number");const e=n.timeout,t=AbortSignal.timeout(e);n.metadata||(n.metadata={}),void 0===n.metadata.timeoutMs&&(n.metadata.timeoutMs=e),void 0!==n.signal?"any"in AbortSignal&&(n.signal=AbortSignal.any([n.signal,t])):n.signal=t,delete n.timeout}return n}function ZE(e={},{callbacks:t,maxConcurrency:n,recursionLimit:r,runName:i,configurable:a,runId:o}={}){const s=zE(e);return void 0!==t&&(delete s.runName,s.callbacks=t),void 0!==r&&(s.recursionLimit=r),void 0!==n&&(s.maxConcurrency=n),void 0!==i&&(s.runName=i),void 0!==a&&(s.configurable={...s.configurable,...a}),void 0!==o&&delete s.runId,s}function eP(e){if(e)return{configurable:e.configurable,recursionLimit:e.recursionLimit,callbacks:e.callbacks,tags:e.tags,metadata:e.metadata,maxConcurrency:e.maxConcurrency,timeout:e.timeout,signal:e.signal,store:e.store}}async function tP(e,t){if(void 0===t)return e;let n;return Promise.race([e.catch(e=>{if(!t?.aborted)throw e}),new Promise((e,r)=>{n=()=>{r(nP(t))},t.addEventListener("abort",n,{once:!0}),t.aborted&&r(nP(t))})]).finally(()=>t.removeEventListener("abort",n))}function nP(e){return e?.reason instanceof Error?e.reason:"string"==typeof e?.reason?new Error(e.reason):new Error("Aborted")}var rP=class e extends ReadableStream{reader;ensureReader(){this.reader||(this.reader=this.getReader())}async next(){this.ensureReader();try{const e=await this.reader.read();return e.done?(this.reader.releaseLock(),{done:!0,value:void 0}):{done:!1,value:e.value}}catch(e){throw this.reader.releaseLock(),e}}async return(){if(this.ensureReader(),this.locked){const e=this.reader.cancel();this.reader.releaseLock(),await e}return{done:!0,value:void 0}}async throw(e){if(this.ensureReader(),this.locked){const e=this.reader.cancel();this.reader.releaseLock(),await e}throw e}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}static fromReadableStream(t){const n=t.getReader();return new e({start:e=>function t(){return n.read().then(({done:n,value:r})=>{if(!n)return e.enqueue(r),t();e.close()})}(),cancel(){n.releaseLock()}})}static fromAsyncGenerator(t){return new e({async pull(e){const{value:n,done:r}=await t.next();r&&e.close(),e.enqueue(n)},async cancel(e){await t.return(e)}})}};function iP(e,t=2){const n=Array.from({length:t},()=>[]);return n.map(async function*(t){for(;;)if(0===t.length){const t=await e.next();for(const e of n)e.push(t)}else{if(t[0].done)return;yield t.shift().value}})}function aP(e,t){if(Array.isArray(e)&&Array.isArray(t))return e.concat(t);if("string"==typeof e&&"string"==typeof t)return e+t;if("number"==typeof e&&"number"==typeof t)return e+t;if("concat"in e&&"function"==typeof e.concat)return e.concat(t);if("object"==typeof e&&"object"==typeof t){const n={...e};for(const[e,r]of Object.entries(t))e in n&&!Array.isArray(n[e])?n[e]=aP(n[e],r):n[e]=r;return n}throw new Error(`Cannot concat ${typeof e} and ${typeof t}`)}var oP=class{generator;setup;config;signal;firstResult;firstResultUsed=!1;constructor(e){this.generator=e.generator,this.config=e.config,this.signal=e.signal??this.config?.signal,this.setup=new Promise((t,n)=>{XE.runWithConfig(eP(e.config),async()=>{this.firstResult=this.signal?tP(e.generator.next(),this.signal):e.generator.next(),e.startSetup?this.firstResult.then(e.startSetup).then(t,n):this.firstResult.then(e=>t(void 0),n)},!0)})}async next(...e){return this.signal?.throwIfAborted(),this.firstResultUsed?XE.runWithConfig(eP(this.config),this.signal?async()=>tP(this.generator.next(...e),this.signal):async()=>this.generator.next(...e),!0):(this.firstResultUsed=!0,this.firstResult)}async return(e){return this.generator.return(e)}async throw(e){return this.generator.throw(e)}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}};const sP="__run";var cP=class e{text;generationInfo;constructor(e){this.text=e.text,this.generationInfo=e.generationInfo}concat(t){return new e({text:this.text+t.text,generationInfo:{...this.generationInfo,...t.generationInfo}})}},lP=class e extends cP{message;constructor(e){super(e),this.message=e.message}concat(t){return new e({text:this.text+t.text,generationInfo:{...this.generationInfo,...t.generationInfo},message:this.message.concat(t.message)})}};const uP=Object.prototype.hasOwnProperty;function dP(e,t){return uP.call(e,t)}function pP(e){if(Array.isArray(e)){const t=new Array(e.length);for(let e=0;e<t.length;e++)t[e]=""+e;return t}if(Object.keys)return Object.keys(e);let t=[];for(let n in e)dP(e,n)&&t.push(n);return t}function hP(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function fP(e){let t=0;const n=e.length;let r;for(;t<n;){if(r=e.charCodeAt(t),!(r>=48&&r<=57))return!1;t++}return!0}function mP(e){return-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function gP(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function yP(e){if(void 0===e)return!0;if(e)if(Array.isArray(e)){for(let n=0,r=e.length;n<r;n++)if(yP(e[n]))return!0}else if("object"==typeof e){const n=pP(e),r=n.length;for(var t=0;t<r;t++)if(yP(e[n[t]]))return!0}return!1}function IP(e,t){const n=[e];for(const r in t){const e="object"==typeof t[r]?JSON.stringify(t[r],null,2):t[r];void 0!==e&&n.push(`${r}: ${e}`)}return n.join("\n")}var CP=class extends Error{name;index;operation;tree;constructor(e,t,n,r,i){super(IP(e,{name:t,index:n,operation:r,tree:i})),this.name=t,this.index=n,this.operation=r,this.tree=i,Object.setPrototypeOf(this,new.target.prototype),this.message=IP(e,{name:t,index:n,operation:r,tree:i})}};const AP=CP,SP={add:function(e,t,n){if("__proto__"===t||"constructor"===t)throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor` prop is banned for security reasons");return e[t]=this.value,{newDocument:n}},remove:function(e,t,n){if("__proto__"===t||"constructor"===t)throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor` prop is banned for security reasons");var r=e[t];return delete e[t],{newDocument:n,removed:r}},replace:function(e,t,n){if("__proto__"===t||"constructor"===t)throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor` prop is banned for security reasons");var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:function(e,t,n){let r=TP(n,this.path);r&&(r=hP(r));const i=vP(n,{op:"remove",path:this.from}).removed;return vP(n,{op:"add",path:this.path,value:i}),{newDocument:n,removed:r}},copy:function(e,t,n){const r=TP(n,this.from);return vP(n,{op:"add",path:this.path,value:hP(r)}),{newDocument:n}},test:function(e,t,n){return{newDocument:n,test:PP(e[t],this.value)}},_get:function(e,t,n){return this.value=e[t],{newDocument:n}}};var bP={add:function(e,t,n){return fP(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:n,index:t}},remove:function(e,t,n){return{newDocument:n,removed:e.splice(t,1)[0]}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:SP.move,copy:SP.copy,test:SP.test,_get:SP._get};function TP(e,t){if(""==t)return e;var n={op:"_get",path:t};return vP(e,n),n.value}function vP(e,t,n=!1,r=!0,i=!0,a=0){if(n&&("function"==typeof n?n(t,0,e,t.path):wP(t,0)),""===t.path){let r={newDocument:e};if("add"===t.op)return r.newDocument=t.value,r;if("replace"===t.op)return r.newDocument=t.value,r.removed=e,r;if("move"===t.op||"copy"===t.op)return r.newDocument=TP(e,t.from),"move"===t.op&&(r.removed=e),r;if("test"===t.op){if(r.test=PP(e,t.value),!1===r.test)throw new AP("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return r.newDocument=e,r}if("remove"===t.op)return r.removed=e,r.newDocument=null,r;if("_get"===t.op)return t.value=e,r;if(n)throw new AP("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",a,t,e);return r}{r||(e=hP(e));const o=(t.path||"").split("/");let s,c,l,u=e,d=1,p=o.length;for(l="function"==typeof n?n:wP;;){if(c=o[d],c&&-1!=c.indexOf("~")&&(c=gP(c)),i&&("__proto__"==c||"prototype"==c&&d>0&&"constructor"==o[d-1]))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(n&&void 0===s&&(void 0===u[c]?s=o.slice(0,d).join("/"):d==p-1&&(s=t.path),void 0!==s&&l(t,0,e,s)),d++,Array.isArray(u)){if("-"===c)c=u.length;else{if(n&&!fP(c))throw new AP("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",a,t,e);fP(c)&&(c=~~c)}if(d>=p){if(n&&"add"===t.op&&c>u.length)throw new AP("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",a,t,e);const r=bP[t.op].call(t,u,c,e);if(!1===r.test)throw new AP("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return r}}else if(d>=p){const n=SP[t.op].call(t,u,c,e);if(!1===n.test)throw new AP("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return n}if(u=u[c],n&&d<p&&(!u||"object"!=typeof u))throw new AP("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",a,t,e)}}}function _P(e,t,n,r=!0,i=!0){if(n&&!Array.isArray(t))throw new AP("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");r||(e=hP(e));const a=new Array(t.length);for(let o=0,s=t.length;o<s;o++)a[o]=vP(e,t[o],n,!0,i,o),e=a[o].newDocument;return a.newDocument=e,a}function wP(e,t,n,r){if("object"!=typeof e||null===e||Array.isArray(e))throw new AP("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,n);if(!SP[e.op])throw new AP("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,n);if("string"!=typeof e.path)throw new AP("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,n);if(0!==e.path.indexOf("/")&&e.path.length>0)throw new AP('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,n);if(("move"===e.op||"copy"===e.op)&&"string"!=typeof e.from)throw new AP("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,n);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&void 0===e.value)throw new AP("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,n);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&yP(e.value))throw new AP("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,n);if(n)if("add"==e.op){var i=e.path.split("/").length,a=r.split("/").length;if(i!==a+1&&i!==a)throw new AP("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,n)}else if("replace"===e.op||"remove"===e.op||"_get"===e.op){if(e.path!==r)throw new AP("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,n)}else if("move"===e.op||"copy"===e.op){var o=EP([{op:"_get",path:e.from,value:void 0}],n);if(o&&"OPERATION_PATH_UNRESOLVABLE"===o.name)throw new AP("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,n)}}function EP(e,t,n){try{if(!Array.isArray(e))throw new AP("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)_P(hP(t),hP(e),n||!0);else{n=n||wP;for(var r=0;r<e.length;r++)n(e[r],r,t,void 0)}}catch(i){if(i instanceof AP)return i;throw i}}function PP(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){var n,r,i,a=Array.isArray(e),o=Array.isArray(t);if(a&&o){if((r=e.length)!=t.length)return!1;for(n=r;0!==n--;)if(!PP(e[n],t[n]))return!1;return!0}if(a!=o)return!1;var s=Object.keys(e);if((r=s.length)!==Object.keys(t).length)return!1;for(n=r;0!==n--;)if(!t.hasOwnProperty(s[n]))return!1;for(n=r;0!==n--;)if(!PP(e[i=s[n]],t[i]))return!1;return!0}return e!=e&&t!=t}function RP(e,t,n,r,i){if(t!==e){"function"==typeof t.toJSON&&(t=t.toJSON());for(var a=pP(t),o=pP(e),s=!1,c=o.length-1;c>=0;c--){var l=e[d=o[c]];if(!dP(t,d)||void 0===t[d]&&void 0!==l&&!1===Array.isArray(t))Array.isArray(e)===Array.isArray(t)?(i&&n.push({op:"test",path:r+"/"+mP(d),value:hP(l)}),n.push({op:"remove",path:r+"/"+mP(d)}),s=!0):(i&&n.push({op:"test",path:r,value:e}),n.push({op:"replace",path:r,value:t}));else{var u=t[d];"object"==typeof l&&null!=l&&"object"==typeof u&&null!=u&&Array.isArray(l)===Array.isArray(u)?RP(l,u,n,r+"/"+mP(d),i):l!==u&&(i&&n.push({op:"test",path:r+"/"+mP(d),value:hP(l)}),n.push({op:"replace",path:r+"/"+mP(d),value:hP(u)}))}}if(s||a.length!=o.length)for(c=0;c<a.length;c++){var d;dP(e,d=a[c])||void 0===t[d]||n.push({op:"add",path:r+"/"+mP(d),value:hP(t[d])})}}}function LP(e,t,n=!1){var r=[];return RP(e,t,r,"",n),r}var NP=class{ops;constructor(e){this.ops=e.ops??[]}concat(e){const t=this.ops.concat(e.ops),n=_P({},t);return new OP({ops:t,state:n[n.length-1].newDocument})}},OP=class e extends NP{state;constructor(e){super(e),this.state=e.state}concat(t){const n=this.ops.concat(t.ops),r=_P(this.state,t.ops);return new e({ops:n,state:r[r.length-1].newDocument})}static fromRunLogPatch(t){const n=_P({},t.ops);return new e({ops:t.ops,state:n[n.length-1].newDocument})}};const BP=e=>"log_stream_tracer"===e.name;async function MP(e,t){if("original"===t)throw new Error("Do not assign inputs with original schema drop the key for now. When inputs are added to streamLog they should be added with standardized schema for streaming events.");const{inputs:n}=e;return["retriever","llm","prompt"].includes(e.run_type)?n:1!==Object.keys(n).length||""!==n?.input?n.input:void 0}async function DP(e,t){const{outputs:n}=e;return"original"===t||["retriever","llm","prompt"].includes(e.run_type)?n:void 0!==n&&1===Object.keys(n).length&&void 0!==n?.output?n.output:n}var FP=class extends mE{autoClose=!0;includeNames;includeTypes;includeTags;excludeNames;excludeTypes;excludeTags;_schemaFormat="original";rootId;keyMapByRunId={};counterMapByRunName={};transformStream;writer;receiveStream;name="log_stream_tracer";lc_prefer_streaming=!0;constructor(e){super({_awaitHandler:!0,...e}),this.autoClose=e?.autoClose??!0,this.includeNames=e?.includeNames,this.includeTypes=e?.includeTypes,this.includeTags=e?.includeTags,this.excludeNames=e?.excludeNames,this.excludeTypes=e?.excludeTypes,this.excludeTags=e?.excludeTags,this._schemaFormat=e?._schemaFormat??this._schemaFormat,this.transformStream=new TransformStream,this.writer=this.transformStream.writable.getWriter(),this.receiveStream=rP.fromReadableStream(this.transformStream.readable)}[Symbol.asyncIterator](){return this.receiveStream}async persistRun(e){}_includeRun(e){if(e.id===this.rootId)return!1;const t=e.tags??[];let n=void 0===this.includeNames&&void 0===this.includeTags&&void 0===this.includeTypes;return void 0!==this.includeNames&&(n=n||this.includeNames.includes(e.name)),void 0!==this.includeTypes&&(n=n||this.includeTypes.includes(e.run_type)),void 0!==this.includeTags&&(n=n||void 0!==t.find(e=>this.includeTags?.includes(e))),void 0!==this.excludeNames&&(n=n&&!this.excludeNames.includes(e.name)),void 0!==this.excludeTypes&&(n=n&&!this.excludeTypes.includes(e.run_type)),void 0!==this.excludeTags&&(n=n&&t.every(e=>!this.excludeTags?.includes(e))),n}async*tapOutputIterable(e,t){for await(const n of t){if(e!==this.rootId){const t=this.keyMapByRunId[e];t&&await this.writer.write(new NP({ops:[{op:"add",path:`/logs/${t}/streamed_output/-`,value:n}]}))}yield n}}async onRunCreate(e){if(void 0===this.rootId&&(this.rootId=e.id,await this.writer.write(new NP({ops:[{op:"replace",path:"",value:{id:e.id,name:e.name,type:e.run_type,streamed_output:[],final_output:void 0,logs:{}}}]}))),!this._includeRun(e))return;void 0===this.counterMapByRunName[e.name]&&(this.counterMapByRunName[e.name]=0),this.counterMapByRunName[e.name]+=1;const t=this.counterMapByRunName[e.name];this.keyMapByRunId[e.id]=1===t?e.name:`${e.name}:${t}`;const n={id:e.id,name:e.name,type:e.run_type,tags:e.tags??[],metadata:e.extra?.metadata??{},start_time:new Date(e.start_time).toISOString(),streamed_output:[],streamed_output_str:[],final_output:void 0,end_time:void 0};"streaming_events"===this._schemaFormat&&(n.inputs=await MP(e,this._schemaFormat)),await this.writer.write(new NP({ops:[{op:"add",path:`/logs/${this.keyMapByRunId[e.id]}`,value:n}]}))}async onRunUpdate(e){try{const t=this.keyMapByRunId[e.id];if(void 0===t)return;const n=[];"streaming_events"===this._schemaFormat&&n.push({op:"replace",path:`/logs/${t}/inputs`,value:await MP(e,this._schemaFormat)}),n.push({op:"add",path:`/logs/${t}/final_output`,value:await DP(e,this._schemaFormat)}),void 0!==e.end_time&&n.push({op:"add",path:`/logs/${t}/end_time`,value:new Date(e.end_time).toISOString()});const r=new NP({ops:n});await this.writer.write(r)}finally{if(e.id===this.rootId){const t=new NP({ops:[{op:"replace",path:"/final_output",value:await DP(e,this._schemaFormat)}]});await this.writer.write(t),this.autoClose&&await this.writer.close()}}}async onLLMNewToken(e,t,n){const r=this.keyMapByRunId[e.id];if(void 0===r)return;let i;var a;void 0!==e.inputs.messages?(a=n?.chunk,i=void 0!==a&&void 0!==a.message?n?.chunk:new JA({id:`run-${e.id}`,content:t})):i=t;const o=new NP({ops:[{op:"add",path:`/logs/${r}/streamed_output_str/-`,value:t},{op:"add",path:`/logs/${r}/streamed_output/-`,value:i}]});await this.writer.write(o)}};function kP({name:e,serialized:t}){return void 0!==e?e:void 0!==t?.name?t.name:void 0!==t?.id&&Array.isArray(t?.id)?t.id[t.id.length-1]:"Unnamed"}const GP=e=>"event_stream_tracer"===e.name;var xP=class extends mE{autoClose=!0;includeNames;includeTypes;includeTags;excludeNames;excludeTypes;excludeTags;runInfoMap=new Map;tappedPromises=new Map;transformStream;writer;receiveStream;readableStreamClosed=!1;name="event_stream_tracer";lc_prefer_streaming=!0;constructor(e){super({_awaitHandler:!0,...e}),this.autoClose=e?.autoClose??!0,this.includeNames=e?.includeNames,this.includeTypes=e?.includeTypes,this.includeTags=e?.includeTags,this.excludeNames=e?.excludeNames,this.excludeTypes=e?.excludeTypes,this.excludeTags=e?.excludeTags,this.transformStream=new TransformStream({flush:()=>{this.readableStreamClosed=!0}}),this.writer=this.transformStream.writable.getWriter(),this.receiveStream=rP.fromReadableStream(this.transformStream.readable)}[Symbol.asyncIterator](){return this.receiveStream}async persistRun(e){}_includeRun(e){const t=e.tags??[];let n=void 0===this.includeNames&&void 0===this.includeTags&&void 0===this.includeTypes;return void 0!==this.includeNames&&(n=n||this.includeNames.includes(e.name)),void 0!==this.includeTypes&&(n=n||this.includeTypes.includes(e.runType)),void 0!==this.includeTags&&(n=n||void 0!==t.find(e=>this.includeTags?.includes(e))),void 0!==this.excludeNames&&(n=n&&!this.excludeNames.includes(e.name)),void 0!==this.excludeTypes&&(n=n&&!this.excludeTypes.includes(e.runType)),void 0!==this.excludeTags&&(n=n&&t.every(e=>!this.excludeTags?.includes(e))),n}async*tapOutputIterable(e,t){const n=await t.next();if(n.done)return;const r=this.runInfoMap.get(e);if(void 0===r)return void(yield n.value);function i(e,t){return"llm"===e&&"string"==typeof t?new cP({text:t}):t}let a=this.tappedPromises.get(e);if(void 0===a){let o;a=new Promise(e=>{o=e}),this.tappedPromises.set(e,a);try{const a={event:`on_${r.runType}_stream`,run_id:e,name:r.name,tags:r.tags,metadata:r.metadata,data:{}};await this.send({...a,data:{chunk:i(r.runType,n.value)}},r),yield n.value;for await(const e of t)"tool"!==r.runType&&"retriever"!==r.runType&&await this.send({...a,data:{chunk:i(r.runType,e)}},r),yield e}finally{o?.()}}else{yield n.value;for await(const e of t)yield e}}async send(e,t){this.readableStreamClosed||this._includeRun(t)&&await this.writer.write(e)}async sendEndEvent(e,t){const n=this.tappedPromises.get(e.run_id);void 0!==n?n.then(()=>{this.send(e,t)}):await this.send(e,t)}async onLLMStart(e){const t=kP(e),n=void 0!==e.inputs.messages?"chat_model":"llm",r={tags:e.tags??[],metadata:e.extra?.metadata??{},name:t,runType:n,inputs:e.inputs};this.runInfoMap.set(e.id,r);const i=`on_${n}_start`;await this.send({event:i,data:{input:e.inputs},name:t,tags:e.tags??[],run_id:e.id,metadata:e.extra?.metadata??{}},r)}async onLLMNewToken(e,t,n){const r=this.runInfoMap.get(e.id);let i,a;if(void 0===r)throw new Error(`onLLMNewToken: Run ID ${e.id} not found in run map.`);if(1!==this.runInfoMap.size){if("chat_model"===r.runType)a="on_chat_model_stream",i=void 0===n?.chunk?new JA({content:t,id:`run-${e.id}`}):n.chunk.message;else{if("llm"!==r.runType)throw new Error(`Unexpected run type ${r.runType}`);a="on_llm_stream",i=void 0===n?.chunk?new cP({text:t}):n.chunk}await this.send({event:a,data:{chunk:i},run_id:e.id,name:r.name,tags:r.tags,metadata:r.metadata},r)}}async onLLMEnd(e){const t=this.runInfoMap.get(e.id);let n;if(this.runInfoMap.delete(e.id),void 0===t)throw new Error(`onLLMEnd: Run ID ${e.id} not found in run map.`);const r=e.outputs?.generations;let i;if("chat_model"===t.runType){for(const e of r??[]){if(void 0!==i)break;i=e[0]?.message}n="on_chat_model_end"}else{if("llm"!==t.runType)throw new Error(`onLLMEnd: Unexpected run type: ${t.runType}`);i={generations:r?.map(e=>e.map(e=>({text:e.text,generationInfo:e.generationInfo}))),llmOutput:e.outputs?.llmOutput??{}},n="on_llm_end"}await this.sendEndEvent({event:n,data:{output:i,input:t.inputs},run_id:e.id,name:t.name,tags:t.tags,metadata:t.metadata},t)}async onChainStart(e){const t=kP(e),n=e.run_type??"chain",r={tags:e.tags??[],metadata:e.extra?.metadata??{},name:t,runType:e.run_type};let i={};""===e.inputs.input&&1===Object.keys(e.inputs).length?(i={},r.inputs={}):void 0!==e.inputs.input?(i.input=e.inputs.input,r.inputs=e.inputs.input):(i.input=e.inputs,r.inputs=e.inputs),this.runInfoMap.set(e.id,r),await this.send({event:`on_${n}_start`,data:i,name:t,tags:e.tags??[],run_id:e.id,metadata:e.extra?.metadata??{}},r)}async onChainEnd(e){const t=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),void 0===t)throw new Error(`onChainEnd: Run ID ${e.id} not found in run map.`);const n=`on_${e.run_type}_end`,r=e.inputs??t.inputs??{},i={output:e.outputs?.output??e.outputs,input:r};r.input&&1===Object.keys(r).length&&(i.input=r.input,t.inputs=r.input),await this.sendEndEvent({event:n,data:i,run_id:e.id,name:t.name,tags:t.tags,metadata:t.metadata??{}},t)}async onToolStart(e){const t=kP(e),n={tags:e.tags??[],metadata:e.extra?.metadata??{},name:t,runType:"tool",inputs:e.inputs??{}};this.runInfoMap.set(e.id,n),await this.send({event:"on_tool_start",data:{input:e.inputs??{}},name:t,run_id:e.id,tags:e.tags??[],metadata:e.extra?.metadata??{}},n)}async onToolEnd(e){const t=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),void 0===t)throw new Error(`onToolEnd: Run ID ${e.id} not found in run map.`);if(void 0===t.inputs)throw new Error(`onToolEnd: Run ID ${e.id} is a tool call, and is expected to have traced inputs.`);const n=void 0===e.outputs?.output?e.outputs:e.outputs.output;await this.sendEndEvent({event:"on_tool_end",data:{output:n,input:t.inputs},run_id:e.id,name:t.name,tags:t.tags,metadata:t.metadata},t)}async onToolError(e){const t=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),void 0===t)throw new Error(`onToolEnd: Run ID ${e.id} not found in run map.`);if(void 0===t.inputs)throw new Error(`onToolEnd: Run ID ${e.id} is a tool call, and is expected to have traced inputs.`);await this.sendEndEvent({event:"on_tool_error",data:{input:t.inputs,error:e.error},run_id:e.id,name:t.name,tags:t.tags,metadata:t.metadata},t)}async onRetrieverStart(e){const t=kP(e),n={tags:e.tags??[],metadata:e.extra?.metadata??{},name:t,runType:"retriever",inputs:{query:e.inputs.query}};this.runInfoMap.set(e.id,n),await this.send({event:"on_retriever_start",data:{input:{query:e.inputs.query}},name:t,tags:e.tags??[],run_id:e.id,metadata:e.extra?.metadata??{}},n)}async onRetrieverEnd(e){const t=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),void 0===t)throw new Error(`onRetrieverEnd: Run ID ${e.id} not found in run map.`);await this.sendEndEvent({event:"on_retriever_end",data:{output:e.outputs?.documents??e.outputs,input:t.inputs},run_id:e.id,name:t.name,tags:t.tags,metadata:t.metadata},t)}async handleCustomEvent(e,t,n){const r=this.runInfoMap.get(n);if(void 0===r)throw new Error(`handleCustomEvent: Run ID ${n} not found in run map.`);await this.send({event:"on_custom_event",run_id:n,name:e,tags:r.tags,metadata:r.metadata,data:t},r)}async finish(){const e=[...this.tappedPromises.values()];Promise.all(e).finally(()=>{this.writer.close()})}};const HP=Object.prototype.toString,UP=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function VP(e){if(!e||(t=e,"[object Error]"!==HP.call(t))||"TypeError"!==e.name||"string"!=typeof e.message)return!1;var t;const{message:n,stack:r}=e;return"Load failed"===n?void 0===r||"__sentry_captured__"in e:!!n.startsWith("error sending request for url")||UP.has(n)}function $P(e,t,{min:n=0,allowInfinity:r=!1}={}){if(void 0!==t){if("number"!=typeof t||Number.isNaN(t))throw new TypeError(`Expected \`${e}\` to be a number${r?" or Infinity":""}.`);if(!r&&!Number.isFinite(t))throw new TypeError(`Expected \`${e}\` to be a finite number.`);if(t<n)throw new TypeError(`Expected \`${e}\` to be ≥ ${n}.`)}}var jP=class extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,({message:e}=e)):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}};function WP(e,t){return Number.isFinite(t)?t-(performance.now()-e):t}async function XP({error:e,attemptNumber:t,retriesConsumed:n,startTime:r,options:i}){const a=e instanceof Error?e:new TypeError(`Non-error was thrown: "${e}". You should only throw errors.`);if(a instanceof jP)throw a.originalError;const o=Number.isFinite(i.retries)?Math.max(0,i.retries-n):i.retries,s=i.maxRetryTime??Number.POSITIVE_INFINITY,c=Object.freeze({error:a,attemptNumber:t,retriesLeft:o,retriesConsumed:n});if(await i.onFailedAttempt(c),WP(r,s)<=0)throw a;const l=await i.shouldConsumeRetry(c),u=WP(r,s);if(u<=0||o<=0)throw a;if(a instanceof TypeError&&!VP(a)){if(l)throw a;return i.signal?.throwIfAborted(),!1}if(!(await i.shouldRetry(c)))throw a;if(!l)return i.signal?.throwIfAborted(),!1;let d=function(e,t){const n=Math.max(1,e+1),r=t.randomize?Math.random()+1:1;let i=Math.round(r*t.minTimeout*t.factor**(n-1));return i=Math.min(i,t.maxTimeout),i}(n,i);const p="number"==typeof a.retryAfterMs&&a.retryAfterMs>=0?a.retryAfterMs:void 0;void 0!==p&&(d=Math.max(d,p));const h=Math.min(d,u);return h>0&&await new Promise((e,t)=>{const n=()=>{clearTimeout(r),i.signal?.removeEventListener("abort",n),t(i.signal.reason)},r=setTimeout(()=>{i.signal?.removeEventListener("abort",n),e()},h);i.unref&&r.unref?.(),i.signal?.addEventListener("abort",n,{once:!0})}),i.signal?.throwIfAborted(),!0}async function KP(e,t={}){if(function(e){if("number"==typeof e){if(e<0)throw new TypeError("Expected `retries` to be a non-negative number.");if(Number.isNaN(e))throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.")}else if(void 0!==e)throw new TypeError("Expected `retries` to be a number or Infinity.")}((t={...t}).retries),Object.hasOwn(t,"forever"))throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");t.retries??=10,t.factor??=2,t.minTimeout??=1e3,t.maxTimeout??=Number.POSITIVE_INFINITY,t.maxRetryTime??=Number.POSITIVE_INFINITY,t.randomize??=!1,t.onFailedAttempt??=()=>{},t.shouldRetry??=()=>!0,t.shouldConsumeRetry??=()=>!0,$P("factor",t.factor,{min:0,allowInfinity:!1}),$P("minTimeout",t.minTimeout,{min:0,allowInfinity:!1}),$P("maxTimeout",t.maxTimeout,{min:0,allowInfinity:!0}),$P("maxRetryTime",t.maxRetryTime,{min:0,allowInfinity:!0}),t.factor>0||(t.factor=1),t.signal?.throwIfAborted();let n=0,r=0;const i=performance.now();for(;!Number.isFinite(t.retries)||r<=t.retries;){n++;try{t.signal?.throwIfAborted();const r=await e(n);return t.signal?.throwIfAborted(),r}catch(a){await XP({error:a,attemptNumber:n,retriesConsumed:r,startTime:i,options:t})&&r++}}throw new Error("Retry attempts exhausted without throwing an error.")}const YP=[400,401,402,403,404,405,406,407,409,413],qP=[/insufficient[_ -]?quota/i,/exceeded (?:your|the current|the available).+quota/i,/usage quota/i,/quota (?:has been )?exhausted/i,/billing/i,/credit balance/i,/out of credits/i,/will reset at/i],QP=/(?:try again in|retry after)\s+(\d+(?:\.\d+)?)\s*(milliseconds?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h)\b/i;function JP(e){return"object"==typeof e&&null!==e&&"response"in e&&"object"==typeof e.response&&null!==e.response&&"status"in e.response&&"number"==typeof e.response.status?e.response.status:void 0}function zP(e){if("object"==typeof e&&null!==e)return"status"in e&&"number"==typeof e.status?e.status:"statusCode"in e&&"number"==typeof e.statusCode?e.statusCode:void 0}function ZP(e){return"object"==typeof e&&null!==e&&"message"in e&&"string"==typeof e.message?e.message:void 0}function eR(e){if("object"==typeof e&&null!==e)return"code"in e&&"string"==typeof e.code?e.code:"error"in e&&"object"==typeof e.error&&null!==e.error&&"code"in e.error&&"string"==typeof e.error.code?e.error.code:void 0}function tR(e,t){if(e instanceof Error)return e;const n=new Error(t);return"object"==typeof e&&null!==e&&Object.assign(n,e),n}function nR(e,t){if("object"!=typeof e||null===e)return;const n=e;n.rateLimitType=t.action,n.rateLimitReason=t.reason,void 0!==t.retryAfterMs&&(n.retryAfterMs=t.retryAfterMs)}function rR(e){if(429!==(JP(e)??zP(e)))return;if("insufficient_quota"===eR(e))return{action:"stop",reason:"insufficient_quota"};const t=ZP(e);if(t&&qP.some(e=>e.test(t)))return{action:"stop",reason:"quota_message"};const n=function(e){if(null==e)return;const t=e.trim();if(!t)return;const n=Number(t);if(!Number.isNaN(n)&&n>=0)return 1e3*n;const r=Date.parse(t);if(!Number.isNaN(r)){const e=r-Date.now();return e>0?e:0}}(function(e){return e?.headers?"function"==typeof e.headers.get?e.headers.get("retry-after"):e.headers["retry-after"]??e.headers["Retry-After"]:e?.response?.headers?"function"==typeof e.response.headers.get?e.response.headers.get("retry-after"):e.response.headers["retry-after"]??e.response.headers["Retry-After"]:void 0}(e))??function(e){if(null==e)return;const t=QP.exec(e);if(!t)return;const n=Number(t[1]),r=t[2]?.toLowerCase();return!Number.isNaN(n)&&r?"ms"===r||r.startsWith("millisecond")?n:"m"===r||r.startsWith("min")?6e4*n:"h"===r||r.startsWith("hr")||r.startsWith("hour")?36e5*n:1e3*n:void 0}(t);return void 0!==n?n<=6e4?{action:"wait",retryAfterMs:n,reason:"retry_after_hint"}:{action:"capacity",retryAfterMs:n,reason:"retry_after_too_large"}:{action:"capacity",reason:"headerless_429"}}const iR=e=>{if("object"!=typeof e||null===e)return;if(!1===function(e){if("object"==typeof e&&null!==e)return Object.getOwnPropertyDescriptor(e,TA)?.value}(e))throw e;if("message"in e&&"string"==typeof e.message&&(e.message.startsWith("Cancel")||e.message.startsWith("AbortError"))||"name"in e&&"string"==typeof e.name&&"AbortError"===e.name)throw vA(e,!1);if("code"in e&&"string"==typeof e.code&&"ECONNABORTED"===e.code)throw e;const t=JP(e)??zP(e);if(t&&YP.includes(+t))throw vA(e,!1);if("insufficient_quota"===eR(e)){const t=tR(e,ZP(e)??"Insufficient quota");throw t.name="InsufficientQuotaError",nR(t,{action:"stop",reason:"insufficient_quota"}),vA(t,!1)}const n=rR(e);if(n){if("wait"===n.action)return nR(e,n),void vA(e,!0);const t=tR(e,ZP(e)??"Rate limit exceeded");throw"Error"===t.name&&(t.name="stop"===n.action?"RateLimitQuotaExhaustedError":"RateLimitCapacityError"),nR(t,n),vA(t,"stop"!==n.action)}};var aR=class{maxConcurrency;maxRetries;onFailedAttempt;queue;constructor(e){this.maxConcurrency=e.maxConcurrency??1/0,this.maxRetries=e.maxRetries??6,this.onFailedAttempt=e.onFailedAttempt??iR;const t="default"in mv?mv.default:mv;this.queue=new t({concurrency:this.maxConcurrency})}async call(e,...t){return this.callWithRetries(this.maxRetries,e,t)}callWithRetries(e,t,n){return this.queue.add(()=>KP(()=>t(...n).catch(e=>{throw e instanceof Error?e:new Error(e)}),{onFailedAttempt:({error:e})=>this.onFailedAttempt?.(e),retries:e,randomize:!0}),{throwOnTimeout:!0})}callWithOptions(e,t,...n){const r=e.maxRetries??this.maxRetries;if(e.signal){let i;return Promise.race([this.callWithRetries(r,t,n),new Promise((t,n)=>{i=()=>{n(nP(e.signal))},e.signal?.addEventListener("abort",i,{once:!0})})]).finally(()=>{e.signal&&i&&e.signal.removeEventListener("abort",i)})}return this.callWithRetries(r,t,n)}fetch(...e){return this.call(()=>fetch(...e).then(e=>e.ok?e:Promise.reject(e)))}},oR=class extends mE{name="RootListenersTracer";rootId;config;argOnStart;argOnEnd;argOnError;constructor({config:e,onStart:t,onEnd:n,onError:r}){super({_awaitHandler:!0}),this.config=e,this.argOnStart=t,this.argOnEnd=n,this.argOnError=r}persistRun(e){return Promise.resolve()}async onRunCreate(e){this.rootId||(this.rootId=e.id,this.argOnStart&&await this.argOnStart(e,this.config))}async onRunUpdate(e){e.id===this.rootId&&(e.error?this.argOnError&&await this.argOnError(e,this.config):this.argOnEnd&&await this.argOnEnd(e,this.config))}};function sR(e){return!!e&&e.lc_runnable}var cR=class{includeNames;includeTypes;includeTags;excludeNames;excludeTypes;excludeTags;constructor(e){this.includeNames=e.includeNames,this.includeTypes=e.includeTypes,this.includeTags=e.includeTags,this.excludeNames=e.excludeNames,this.excludeTypes=e.excludeTypes,this.excludeTags=e.excludeTags}includeEvent(e,t){let n=void 0===this.includeNames&&void 0===this.includeTypes&&void 0===this.includeTags;const r=e.tags??[];return void 0!==this.includeNames&&(n=n||this.includeNames.includes(e.name)),void 0!==this.includeTypes&&(n=n||this.includeTypes.includes(t)),void 0!==this.includeTags&&(n=n||r.some(e=>this.includeTags?.includes(e))),void 0!==this.excludeNames&&(n=n&&!this.excludeNames.includes(e.name)),void 0!==this.excludeTypes&&(n=n&&!this.excludeTypes.includes(t)),void 0!==this.excludeTags&&(n=n&&r.every(e=>!this.excludeTags?.includes(e))),n}};function lR(e){return e.replace(/[^a-zA-Z-_0-9]/g,"_")}const uR=["*","_","`"];function dR(e,t,n){const{firstNode:r,lastNode:i,nodeColors:a,withStyles:o=!0,curveStyle:s="linear",wrapLabelNWords:c=9}=n??{};let l=o?`%%{init: {'flowchart': {'curve': '${s}'}}}%%\ngraph TD;\n`:"graph TD;\n";if(o){const t="default",n={[t]:"{0}({1})"};void 0!==r&&(n[r]="{0}([{1}]):::first"),void 0!==i&&(n[i]="{0}([{1}]):::last");for(const[r,i]of Object.entries(e)){const e=i.name.split(":").pop()??"";let a=uR.some(t=>e.startsWith(t)&&e.endsWith(t))?`<p>${e}</p>`:e;Object.keys(i.metadata??{}).length&&(a+=`<hr/><small><em>${Object.entries(i.metadata??{}).map(([e,t])=>`${e} = ${t}`).join("\n")}</em></small>`);const o=(n[r]??n[t]).replace("{0}",lR(r)).replace("{1}",a);l+=`\t${o}\n`}}const u={};for(const h of t){const e=h.source.split(":"),t=h.target.split(":"),n=e.filter((e,n)=>e===t[n]).join(":");u[n]||(u[n]=[]),u[n].push(h)}const d=new Set;function p(e,t){const n=1===e.length&&e[0].source===e[0].target;if(t&&!n){const e=t.split(":").pop();if(d.has(t))throw new Error(`Found duplicate subgraph '${e}' at '${t} -- this likely means that you're reusing a subgraph node with the same name. Please adjust your graph to have subgraph nodes with unique names.`);d.add(t),l+=`\tsubgraph ${e}\n`}const r=(i=Object.keys(u).filter(e=>e.startsWith(`${t}:`)&&e!==t&&e.split(":").length===t.split(":").length+1),[...i].sort((e,t)=>e.split(":").length-t.split(":").length));var i;for(const a of r)p(u[a],a);for(const a of e){const{source:e,target:t,data:n,conditional:r}=a;let i="";if(void 0!==n){let e=n;const t=e.split(" ");t.length>c&&(e=Array.from({length:Math.ceil(t.length/c)},(e,n)=>t.slice(n*c,(n+1)*c).join(" ")).join("&nbsp;<br>&nbsp;")),i=r?` -. &nbsp;${e}&nbsp; .-> `:` -- &nbsp;${e}&nbsp; --\x3e `}else i=r?" -.-> ":" --\x3e ";l+=`\t${lR(e)}${i}${lR(t)};\n`}t&&!n&&(l+="\tend\n")}p(u[""]??[],"");for(const h in u)h.includes(":")||""===h||p(u[h],h);return o&&(l+=function(e){let t="";for(const[n,r]of Object.entries(e))t+=`\tclassDef ${n} ${r};\n`;return t}(a??{})),l}async function pR(e,t){let n=t?.backgroundColor??"white";const r=t?.imageType??"png",i=btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");void 0!==n&&(/^#(?:[0-9a-fA-F]{3}){1,2}$/.test(n)||(n=`!${n}`));const a=`https://mermaid.ink/img/${i}?bgColor=${n}&type=${r}`,o=await fetch(a);if(!o.ok)throw new Error(["Failed to render the graph using the Mermaid.INK API.",`Status code: ${o.status}`,`Status text: ${o.statusText}`].join("\n"));return await o.blob()}function hR(e,t){if(void 0!==e&&!_S(e))return e;if(!sR(t))return t.name??"UnknownSchema";try{let e=t.getName();return e=e.startsWith("Runnable")?e.slice(8):e,e}catch{return t.getName()}}function fR(e){return sR(e.data)?{type:"runnable",data:{id:e.data.lc_id,name:e.data.getName()}}:{type:"schema",data:{...XI(e.data.schema),title:e.data.name}}}var mR=class e{nodes={};edges=[];constructor(e){this.nodes=e?.nodes??this.nodes,this.edges=e?.edges??this.edges}toJSON(){const e={};return Object.values(this.nodes).forEach((t,n)=>{e[t.id]=_S(t.id)?n:t.id}),{nodes:Object.values(this.nodes).map(t=>({id:e[t.id],...fR(t)})),edges:this.edges.map(t=>{const n={source:e[t.source],target:e[t.target]};return void 0!==t.data&&(n.data=t.data),void 0!==t.conditional&&(n.conditional=t.conditional),n})}}addNode(e,t,n){if(void 0!==t&&void 0!==this.nodes[t])throw new Error(`Node with id ${t} already exists`);const r=t??TS(),i={id:r,data:e,name:hR(t,e),metadata:n};return this.nodes[r]=i,i}removeNode(e){delete this.nodes[e.id],this.edges=this.edges.filter(t=>t.source!==e.id&&t.target!==e.id)}addEdge(e,t,n,r){if(void 0===this.nodes[e.id])throw new Error(`Source node ${e.id} not in graph`);if(void 0===this.nodes[t.id])throw new Error(`Target node ${t.id} not in graph`);const i={source:e.id,target:t.id,data:n,conditional:r};return this.edges.push(i),i}firstNode(){return gR(this)}lastNode(){return yR(this)}extend(e,t=""){let n=t;Object.values(e.nodes).map(e=>e.id).every(_S)&&(n="");const r=e=>n?`${n}:${e}`:e;Object.entries(e.nodes).forEach(([e,t])=>{this.nodes[r(e)]={...t,id:r(e)}});const i=e.edges.map(e=>({...e,source:r(e.source),target:r(e.target)}));this.edges=[...this.edges,...i];const a=e.firstNode(),o=e.lastNode();return[a?{id:r(a.id),data:a.data}:void 0,o?{id:r(o.id),data:o.data}:void 0]}trimFirstNode(){const e=this.firstNode();e&&gR(this,[e.id])&&this.removeNode(e)}trimLastNode(){const e=this.lastNode();e&&yR(this,[e.id])&&this.removeNode(e)}reid(){const t=Object.fromEntries(Object.values(this.nodes).map(e=>[e.id,e.name])),n=new Map;Object.values(t).forEach(e=>{n.set(e,(n.get(e)||0)+1)});const r=e=>{const r=t[e];return _S(e)&&1===n.get(r)?r:e};return new e({nodes:Object.fromEntries(Object.entries(this.nodes).map(([e,t])=>[r(e),{...t,id:r(e)}])),edges:this.edges.map(e=>({...e,source:r(e.source),target:r(e.target)}))})}drawMermaid(e){const{withStyles:t,curveStyle:n,nodeColors:r={default:"fill:#f2f0ff,line-height:1.2",first:"fill-opacity:0",last:"fill:#bfb6fc"},wrapLabelNWords:i}=e??{},a=this.reid(),o=a.firstNode(),s=a.lastNode();return dR(a.nodes,a.edges,{firstNode:o?.id,lastNode:s?.id,withStyles:t,curveStyle:n,nodeColors:r,wrapLabelNWords:i})}async drawMermaidPng(e){return pR(this.drawMermaid(e),{backgroundColor:e?.backgroundColor})}};function gR(e,t=[]){const n=new Set(e.edges.filter(e=>!t.includes(e.source)).map(e=>e.target)),r=[];for(const i of Object.values(e.nodes))t.includes(i.id)||n.has(i.id)||r.push(i);return 1===r.length?r[0]:void 0}function yR(e,t=[]){const n=new Set(e.edges.filter(e=>!t.includes(e.target)).map(e=>e.source)),r=[];for(const i of Object.values(e.nodes))t.includes(i.id)||n.has(i.id)||r.push(i);return 1===r.length?r[0]:void 0}function IR(e){return"object"==typeof e&&null!==e&&"function"==typeof e[Symbol.iterator]&&"function"==typeof e.next}function CR(e){return"object"==typeof e&&null!==e&&"function"==typeof e[Symbol.asyncIterator]}function*AR(e,t){for(;;){const{value:n,done:r}=XE.runWithConfig(eP(e),t.next.bind(t),!0);if(r)break;yield n}}async function*SR(e,t){const n=t[Symbol.asyncIterator]();for(;;){const{value:r,done:i}=await XE.runWithConfig(eP(e),n.next.bind(t),!0);if(i)break;yield r}}function bR(e,t){return!e||Array.isArray(e)||e instanceof Date||"object"!=typeof e?{[t]:e}:e}var TR=class extends tC{lc_runnable=!0;name;getName(e){const t=this.name??this.constructor.lc_name()??this.constructor.name;return e?`${t}${e}`:t}withRetry(e){return new _R({bound:this,kwargs:{},config:{},maxAttemptNumber:e?.stopAfterAttempt,...e})}withConfig(e){return new vR({bound:this,config:e,kwargs:{}})}withFallbacks(e){const t=Array.isArray(e)?e:e.fallbacks;return new LR({runnable:this,fallbacks:t})}_getOptionsList(e,t=0){if(Array.isArray(e)&&e.length!==t)throw new Error(`Passed "options" must be an array with the same length as the inputs, but got ${e.length} options for ${t} inputs`);if(Array.isArray(e))return e.map(zE);if(t>1&&!Array.isArray(e)&&e.runId){console.warn("Provided runId will be used only for the first element of the batch.");const n=Object.fromEntries(Object.entries(e).filter(([e])=>"runId"!==e));return Array.from({length:t},(t,r)=>zE(0===r?e:n))}return Array.from({length:t},()=>zE(e))}async batch(e,t,n){const r=this._getOptionsList(t??{},e.length),i=r[0]?.maxConcurrency??n?.maxConcurrency,a=new aR({maxConcurrency:i,onFailedAttempt:e=>{throw e}}),o=e.map((e,t)=>a.call(async()=>{try{return await this.invoke(e,r[t])}catch(i){if(n?.returnExceptions)return i;throw i}}));return Promise.all(o)}async*_streamIterator(e,t){yield this.invoke(e,t)}async stream(e,t){const n=zE(t),r=new oP({generator:this._streamIterator(e,n),config:n});return await r.setup,rP.fromAsyncGenerator(r)}_separateRunnableConfigFromCallOptions(e){let t;t=zE(void 0===e?e:{callbacks:e.callbacks,tags:e.tags,metadata:e.metadata,runName:e.runName,configurable:e.configurable,recursionLimit:e.recursionLimit,maxConcurrency:e.maxConcurrency,runId:e.runId,timeout:e.timeout,signal:e.signal});const n={...e};return delete n.callbacks,delete n.tags,delete n.metadata,delete n.runName,delete n.configurable,delete n.recursionLimit,delete n.maxConcurrency,delete n.runId,delete n.timeout,delete n.signal,[t,n]}async _callWithConfig(e,t,n){const r=zE(n),i=await((await QE(r))?.handleChainStart(this.toJSON(),bR(t,"input"),r.runId,r?.runType,void 0,void 0,r?.runName??this.getName()));let a;delete r.runId;try{const n=e.call(this,t,r,i);a=await tP(n,r.signal)}catch(o){throw await(i?.handleChainError(o)),o}return await(i?.handleChainEnd(bR(a,"output"))),a}async _batchWithConfig(e,t,n,r){const i=this._getOptionsList(n??{},t.length),a=await Promise.all(i.map(QE)),o=await Promise.all(a.map(async(e,n)=>{const r=await(e?.handleChainStart(this.toJSON(),bR(t[n],"input"),i[n].runId,i[n].runType,void 0,void 0,i[n].runName??this.getName()));return delete i[n].runId,r}));let s;try{const n=e.call(this,t,i,o,r);s=await tP(n,i?.[0]?.signal)}catch(c){throw await Promise.all(o.map(e=>e?.handleChainError(c))),c}return await Promise.all(o.map(e=>e?.handleChainEnd(bR(s,"output")))),s}_concatOutputChunks(e,t){return aP(e,t)}async*_transformStreamWithConfig(e,t,n){let r,i,a=!0,o=!0;const s=zE(n),c=await QE(s),l=this;let u;try{const n=await async function(e,t,n,r,...i){const a=new oP({generator:t,startSetup:n,signal:r}),o=await a.setup;return{output:e(a,o,...i),setup:o}}(t.bind(this),async function*(){for await(const t of e){if(a)if(void 0===r)r=t;else try{r=l._concatOutputChunks(r,t)}catch{r=void 0,a=!1}yield t}}(),async()=>c?.handleChainStart(this.toJSON(),{input:""},s.runId,s.runType,void 0,void 0,s.runName??this.getName(),void 0,{lc_defers_inputs:!0}),s.signal,s);delete s.runId,u=n.setup;const d=u?.handlers.find(GP);let p=n.output;void 0!==d&&void 0!==u&&(p=d.tapOutputIterable(u.runId,p));const h=u?.handlers.find(BP);void 0!==h&&void 0!==u&&(p=h.tapOutputIterable(u.runId,p));for await(const e of p)if(yield e,o)if(void 0===i)i=e;else try{i=this._concatOutputChunks(i,e)}catch{i=void 0,o=!1}}catch(d){throw await(u?.handleChainError(d,void 0,void 0,void 0,{inputs:bR(r,"input")})),d}await(u?.handleChainEnd(i??{},void 0,void 0,void 0,{inputs:bR(r,"input")}))}getGraph(e){const t=new mR,n=t.addNode({name:`${this.getName()}Input`,schema:uI()}),r=t.addNode(this),i=t.addNode({name:`${this.getName()}Output`,schema:uI()});return t.addEdge(n,r),t.addEdge(r,i),t}pipe(e){return new wR({first:this,last:NR(e)})}pick(e){return this.pipe(new BR(e))}assign(e){return this.pipe(new OR(new ER({steps:e})))}async*transform(e,t){let n;for await(const r of e)n=void 0===n?r:this._concatOutputChunks(n,r);yield*this._streamIterator(n,zE(t))}async*streamLog(e,t,n){const r=new FP({...n,autoClose:!1,_schemaFormat:"original"}),i=zE(t);yield*this._streamLog(e,r,i)}async*_streamLog(e,t,n){const{callbacks:r}=n;if(void 0===r)n.callbacks=[t];else if(Array.isArray(r))n.callbacks=r.concat([t]);else{const e=r.copy();e.addHandler(t,!0),n.callbacks=e}const i=this.stream(e,n);const a=async function(){try{const e=await i;for await(const n of e){const e=new NP({ops:[{op:"add",path:"/streamed_output/-",value:n}]});await t.writer.write(e)}}finally{await t.writer.close()}}();try{for await(const e of t)yield e}finally{await a}}streamEvents(e,t,n){let r;if("v1"===t.version)r=this._streamEventsV1(e,t,n);else{if("v2"!==t.version)throw new Error('Only versions "v1" and "v2" of the schema are currently supported.');r=this._streamEventsV2(e,t,n)}return"text/event-stream"===t.encoding?function(e){const t=new TextEncoder,n=new ReadableStream({async start(n){for await(const r of e)n.enqueue(t.encode(`event: data\ndata: ${JSON.stringify(r)}\n\n`));n.enqueue(t.encode("event: end\n\n")),n.close()}});return rP.fromReadableStream(n)}(r):rP.fromAsyncGenerator(r)}async*_streamEventsV2(e,t,n){const r=new xP({...n,autoClose:!1}),i=zE(t),a=i.runId??vS();i.runId=a;const o=i.callbacks;if(void 0===o)i.callbacks=[r];else if(Array.isArray(o))i.callbacks=o.concat(r);else{const e=o.copy();e.addHandler(r,!0),i.callbacks=e}const s=new AbortController,c=this;const l=async function(){let t;try{if(i.signal)if("any"in AbortSignal)t=AbortSignal.any([s.signal,i.signal]);else{const e=new AbortController;i.signal.addEventListener("abort",()=>e.abort(),{once:!0}),s.signal.addEventListener("abort",()=>e.abort(),{once:!0}),t=e.signal}else t=s.signal;const n=await c.stream(e,{...i,signal:t}),o=r.tapOutputIterable(a,n);for await(const e of o)if(s.signal.aborted)break}finally{await r.finish()}}();let u,d=!1;try{for await(const t of r)d?(t.run_id===u&&t.event.endsWith("_end")&&t.data?.input&&delete t.data.input,yield t):(t.data.input=e,d=!0,u=t.run_id,yield t)}finally{s.abort(),await l}}async*_streamEventsV1(e,t,n){let r,i=!1;const a=zE(t),o=a.tags??[],s=a.metadata??{},c=a.runName??this.getName(),l=new FP({...n,autoClose:!1,_schemaFormat:"streaming_events"}),u=new cR({...n}),d=this._streamLog(e,l,a);for await(const h of d){if(r=r?r.concat(h):OP.fromRunLogPatch(h),void 0===r.state)throw new Error('Internal error: "streamEvents" state is missing. Please open a bug report.');if(!i){i=!0;const t={...r.state},n={run_id:t.id,event:`on_${t.type}_start`,name:c,tags:o,metadata:s,data:{input:e}};u.includeEvent(n,t.type)&&(yield n)}const t=h.ops.filter(e=>e.path.startsWith("/logs/")).map(e=>e.path.split("/")[2]),n=[...new Set(t)];for(const e of n){let t,n={};const i=r.state.logs[e];if(t=void 0===i.end_time?i.streamed_output.length>0?"stream":"start":"end","start"===t)void 0!==i.inputs&&(n.input=i.inputs);else if("end"===t)void 0!==i.inputs&&(n.input=i.inputs),n.output=i.final_output;else if("stream"===t){const e=i.streamed_output.length;if(1!==e)throw new Error(`Expected exactly one chunk of streamed output, got ${e} instead. Encountered in: "${i.name}"`);n={chunk:i.streamed_output[0]},i.streamed_output=[]}yield{event:`on_${i.type}_${t}`,name:i.name,run_id:i.id,tags:i.tags,metadata:i.metadata,data:n}}const{state:a}=r;if(a.streamed_output.length>0){const e=a.streamed_output.length;if(1!==e)throw new Error(`Expected exactly one chunk of streamed output, got ${e} instead. Encountered in: "${a.name}"`);const t={chunk:a.streamed_output[0]};a.streamed_output=[];const n={event:`on_${a.type}_stream`,run_id:a.id,tags:o,metadata:s,name:c,data:t};u.includeEvent(n,a.type)&&(yield n)}}const p=r?.state;if(void 0!==p){const e={event:`on_${p.type}_end`,name:c,run_id:p.id,tags:o,metadata:s,data:{output:p.final_output}};u.includeEvent(e,p.type)&&(yield e)}}static isRunnable(e){return sR(e)}withListeners({onStart:e,onEnd:t,onError:n}){return new vR({bound:this,config:{},configFactories:[r=>({callbacks:[new oR({config:r,onStart:e,onEnd:t,onError:n})]})]})}asTool(e){return function(e,t){const n=t.name??e.getName(),r=t.description??Cg(t.schema);return function(e){return!!yg(e)&&(gg(e)?"ZodString"===e._def.typeName:!!mg(e)&&"string"===e._zod.def.type)}(t.schema)?new MR({name:n,description:r,schema:dI({input:lI()}).transform(e=>e.input),bound:e}):new MR({name:n,description:r,schema:t.schema,bound:e})}(this,e)}},vR=class e extends TR{static lc_name(){return"RunnableBinding"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;bound;config;kwargs;configFactories;constructor(e){super(e),this.bound=e.bound,this.kwargs=e.kwargs,this.config=e.config,this.configFactories=e.configFactories}getName(e){return this.bound.getName(e)}async _mergeConfig(...e){const t=JE(this.config,...e);return JE(t,...this.configFactories?await Promise.all(this.configFactories.map(async e=>await e(t))):[])}withConfig(e){return new this.constructor({bound:this.bound,kwargs:this.kwargs,config:{...this.config,...e}})}withRetry(e){return new _R({bound:this.bound,kwargs:this.kwargs,config:this.config,maxAttemptNumber:e?.stopAfterAttempt,...e})}async invoke(e,t){return this.bound.invoke(e,await this._mergeConfig(t,this.kwargs))}async batch(e,t,n){const r=Array.isArray(t)?await Promise.all(t.map(async e=>this._mergeConfig(zE(e),this.kwargs))):await this._mergeConfig(zE(t),this.kwargs);return this.bound.batch(e,r,n)}_concatOutputChunks(e,t){return this.bound._concatOutputChunks(e,t)}async*_streamIterator(e,t){yield*this.bound._streamIterator(e,await this._mergeConfig(zE(t),this.kwargs))}async stream(e,t){return this.bound.stream(e,await this._mergeConfig(zE(t),this.kwargs))}async*transform(e,t){yield*this.bound.transform(e,await this._mergeConfig(zE(t),this.kwargs))}streamEvents(e,t,n){const r=this;return rP.fromAsyncGenerator(async function*(){yield*r.bound.streamEvents(e,{...await r._mergeConfig(zE(t),r.kwargs),version:t.version},n)}())}static isRunnableBinding(e){return e.bound&&TR.isRunnable(e.bound)}withListeners({onStart:t,onEnd:n,onError:r}){return new e({bound:this.bound,kwargs:this.kwargs,config:this.config,configFactories:[e=>({callbacks:[new oR({config:e,onStart:t,onEnd:n,onError:r})]})]})}},_R=class extends vR{static lc_name(){return"RunnableRetry"}lc_namespace=["langchain_core","runnables"];maxAttemptNumber=3;onFailedAttempt=()=>{};constructor(e){super(e),this.maxAttemptNumber=e.maxAttemptNumber??this.maxAttemptNumber,this.onFailedAttempt=e.onFailedAttempt??this.onFailedAttempt}_patchConfigForRetry(e,t,n){const r=e>1?`retry:attempt:${e}`:void 0;return ZE(t,{callbacks:n?.getChild(r)})}async _invoke(e,t,n){return KP(r=>super.invoke(e,this._patchConfigForRetry(r,t,n)),{onFailedAttempt:({error:t})=>this.onFailedAttempt(t,e),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}async invoke(e,t){return this._callWithConfig(this._invoke.bind(this),e,t)}async _batch(e,t,n,r){const i={};try{await KP(async a=>{const o=e.map((e,t)=>t).filter(e=>void 0===i[e.toString()]||i[e.toString()]instanceof Error),s=o.map(t=>e[t]),c=o.map(e=>this._patchConfigForRetry(a,t?.[e],n?.[e])),l=await super.batch(s,c,{...r,returnExceptions:!0});let u;for(let e=0;e<l.length;e+=1){const t=l[e],n=o[e];t instanceof Error&&void 0===u&&(u=t,u.input=s[e]),i[n.toString()]=t}if(u)throw u;return l},{onFailedAttempt:({error:e})=>this.onFailedAttempt(e,e.input),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}catch(a){if(!0!==r?.returnExceptions)throw a}return Object.keys(i).sort((e,t)=>parseInt(e,10)-parseInt(t,10)).map(e=>i[parseInt(e,10)])}async batch(e,t,n){return this._batchWithConfig(this._batch.bind(this),e,t,n)}},wR=class e extends TR{static lc_name(){return"RunnableSequence"}first;middle=[];last;omitSequenceTags=!1;lc_serializable=!0;lc_namespace=["langchain_core","runnables"];constructor(e){super(e),this.first=e.first,this.middle=e.middle??this.middle,this.last=e.last,this.name=e.name,this.omitSequenceTags=e.omitSequenceTags??this.omitSequenceTags}get steps(){return[this.first,...this.middle,this.last]}async invoke(e,t){const n=zE(t),r=await((await QE(n))?.handleChainStart(this.toJSON(),bR(e,"input"),n.runId,void 0,void 0,void 0,n?.runName));delete n.runId;let i,a=e;try{const e=[this.first,...this.middle];for(let t=0;t<e.length;t+=1){const i=e[t].invoke(a,ZE(n,{callbacks:r?.getChild(this.omitSequenceTags?void 0:`seq:step:${t+1}`)}));a=await tP(i,n.signal)}if(n.signal?.aborted)throw nP(n.signal);i=await this.last.invoke(a,ZE(n,{callbacks:r?.getChild(this.omitSequenceTags?void 0:`seq:step:${this.steps.length}`)}))}catch(o){throw await(r?.handleChainError(o)),o}return await(r?.handleChainEnd(bR(i,"output"))),i}async batch(e,t,n){const r=this._getOptionsList(t??{},e.length),i=await Promise.all(r.map(QE)),a=await Promise.all(i.map(async(t,n)=>{const i=await(t?.handleChainStart(this.toJSON(),bR(e[n],"input"),r[n].runId,void 0,void 0,void 0,r[n].runName));return delete r[n].runId,i}));let o=e;try{for(let e=0;e<this.steps.length;e+=1){const t=this.steps[e].batch(o,a.map((t,n)=>{const i=t?.getChild(this.omitSequenceTags?void 0:`seq:step:${e+1}`);return ZE(r[n],{callbacks:i})}),n);o=await tP(t,r[0]?.signal)}}catch(s){throw await Promise.all(a.map(e=>e?.handleChainError(s))),s}return await Promise.all(a.map(e=>e?.handleChainEnd(bR(o,"output")))),o}_concatOutputChunks(e,t){return this.last._concatOutputChunks(e,t)}async*_streamIterator(e,t){const n=await QE(t),{runId:r,...i}=t??{},a=await(n?.handleChainStart(this.toJSON(),bR(e,"input"),r,void 0,void 0,void 0,i?.runName)),o=[this.first,...this.middle,this.last];let s,c=!0;try{let n=o[0].transform(async function*(){yield e}(),ZE(i,{callbacks:a?.getChild(this.omitSequenceTags?void 0:"seq:step:1")}));for(let e=1;e<o.length;e+=1)n=await o[e].transform(n,ZE(i,{callbacks:a?.getChild(this.omitSequenceTags?void 0:`seq:step:${e+1}`)}));for await(const e of n)if(t?.signal?.throwIfAborted(),yield e,c)if(void 0===s)s=e;else try{s=this._concatOutputChunks(s,e)}catch{s=void 0,c=!1}}catch(l){throw await(a?.handleChainError(l)),l}await(a?.handleChainEnd(bR(s,"output")))}getGraph(e){const t=new mR;let n=null;return this.steps.forEach((r,i)=>{const a=r.getGraph(e);0!==i&&a.trimFirstNode(),i!==this.steps.length-1&&a.trimLastNode(),t.extend(a);const o=a.firstNode();if(!o)throw new Error(`Runnable ${r} has no first node`);n&&t.addEdge(n,o),n=a.lastNode()}),t}pipe(t){return e.isRunnableSequence(t)?new e({first:this.first,middle:this.middle.concat([this.last,t.first,...t.middle]),last:t.last,name:this.name??t.name}):new e({first:this.first,middle:[...this.middle,this.last],last:NR(t),name:this.name})}static isRunnableSequence(e){return Array.isArray(e.middle)&&TR.isRunnable(e)}static from([t,...n],r){let i={};return"string"==typeof r?i.name=r:void 0!==r&&(i=r),new e({...i,first:NR(t),middle:n.slice(0,-1).map(NR),last:NR(n[n.length-1])})}},ER=class e extends TR{static lc_name(){return"RunnableMap"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;steps;getStepsKeys(){return Object.keys(this.steps)}constructor(e){super(e),this.steps={};for(const[t,n]of Object.entries(e.steps))this.steps[t]=NR(n)}static from(t){return new e({steps:t})}async invoke(e,t){const n=zE(t),r=await((await QE(n))?.handleChainStart(this.toJSON(),{input:e},n.runId,void 0,void 0,void 0,n?.runName));delete n.runId;const i={};try{const t=Object.entries(this.steps).map(async([t,a])=>{i[t]=await a.invoke(e,ZE(n,{callbacks:r?.getChild(`map:key:${t}`)}))});await tP(Promise.all(t),n.signal)}catch(a){throw await(r?.handleChainError(a)),a}return await(r?.handleChainEnd(i)),i}async*_transform(e,t,n){const r={...this.steps},i=iP(e,Object.keys(r).length),a=new Map(Object.entries(r).map(([e,r],a)=>{const o=r.transform(i[a],ZE(n,{callbacks:t?.getChild(`map:key:${e}`)}));return[e,o.next().then(t=>({key:e,gen:o,result:t}))]}));for(;a.size;){const e=Promise.race(a.values()),{key:t,result:r,gen:i}=await tP(e,n?.signal);a.delete(t),r.done||(yield{[t]:r.value},a.set(t,i.next().then(e=>({key:t,gen:i,result:e}))))}}transform(e,t){return this._transformStreamWithConfig(e,this._transform.bind(this),t)}async stream(e,t){const n=zE(t),r=new oP({generator:this.transform(async function*(){yield e}(),n),config:n});return await r.setup,rP.fromAsyncGenerator(r)}},PR=class e extends TR{lc_serializable=!1;lc_namespace=["langchain_core","runnables"];func;constructor(e){if(super(e),!Jb(e.func))throw new Error("RunnableTraceable requires a function that is wrapped in traceable higher-order function");this.func=e.func}async invoke(e,t){const[n]=this._getOptionsList(t??{},1),r=await QE(n);return tP(this.func(ZE(n,{callbacks:r}),e),n?.signal)}async*_streamIterator(e,t){const[n]=this._getOptionsList(t??{},1),r=await this.invoke(e,t);var i;if(CR(r))for await(const a of r)n?.signal?.throwIfAborted(),yield a;else if(null!=(i=r)&&"object"==typeof i&&"next"in i&&"function"==typeof i.next)for(;;){n?.signal?.throwIfAborted();const e=r.next();if(e.done)break;yield e.value}else yield r}static from(t){return new e({func:t})}};var RR=class e extends TR{static lc_name(){return"RunnableLambda"}lc_namespace=["langchain_core","runnables"];func;constructor(e){if(Jb(e.func))return PR.from(e.func);super(e),function(e){if(Jb(e))throw new Error("RunnableLambda requires a function that is not wrapped in traceable higher-order function. This shouldn't happen.")}(e.func),this.func=e.func}static from(t){return new e({func:t})}async _invoke(e,t,n){return new Promise((r,i)=>{const a=ZE(t,{callbacks:n?.getChild(),recursionLimit:(t?.recursionLimit??25)-1});XE.runWithConfig(eP(a),async()=>{try{let n=await this.func(e,{...a});if(n&&TR.isRunnable(n)){if(0===t?.recursionLimit)throw new Error("Recursion limit reached.");n=await n.invoke(e,{...a,recursionLimit:(a.recursionLimit??25)-1})}else if(CR(n)){let e;for await(const r of SR(a,n))if(t?.signal?.throwIfAborted(),void 0===e)e=r;else try{e=this._concatOutputChunks(e,r)}catch{e=r}n=e}else if(IR(n)){let e;for(const r of AR(a,n))if(t?.signal?.throwIfAborted(),void 0===e)e=r;else try{e=this._concatOutputChunks(e,r)}catch{e=r}n=e}r(n)}catch(n){i(n)}})})}async invoke(e,t){return this._callWithConfig(this._invoke.bind(this),e,t)}async*_transform(e,t,n){let r;for await(const o of e)if(void 0===r)r=o;else try{r=this._concatOutputChunks(r,o)}catch{r=o}const i=ZE(n,{callbacks:t?.getChild(),recursionLimit:(n?.recursionLimit??25)-1}),a=await new Promise((e,t)=>{XE.runWithConfig(eP(i),async()=>{try{e(await this.func(r,{...i,config:i}))}catch(n){t(n)}})});if(a&&TR.isRunnable(a)){if(0===n?.recursionLimit)throw new Error("Recursion limit reached.");const e=await a.stream(r,i);for await(const t of e)yield t}else if(CR(a))for await(const o of SR(i,a))n?.signal?.throwIfAborted(),yield o;else if(IR(a))for(const o of AR(i,a))n?.signal?.throwIfAborted(),yield o;else yield a}transform(e,t){return this._transformStreamWithConfig(e,this._transform.bind(this),t)}async stream(e,t){const n=zE(t),r=new oP({generator:this.transform(async function*(){yield e}(),n),config:n});return await r.setup,rP.fromAsyncGenerator(r)}},LR=class extends TR{static lc_name(){return"RunnableWithFallbacks"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;runnable;fallbacks;constructor(e){super(e),this.runnable=e.runnable,this.fallbacks=e.fallbacks}*runnables(){yield this.runnable;for(const e of this.fallbacks)yield e}async invoke(e,t){const n=zE(t),r=await QE(n),{runId:i,...a}=n,o=await(r?.handleChainStart(this.toJSON(),bR(e,"input"),i,void 0,void 0,void 0,a?.runName)),s=ZE(a,{callbacks:o?.getChild()});return await XE.runWithConfig(s,async()=>{let t;for(const i of this.runnables()){n?.signal?.throwIfAborted();try{const t=await i.invoke(e,s);return await(o?.handleChainEnd(bR(t,"output"))),t}catch(r){void 0===t&&(t=r)}}if(void 0===t)throw new Error("No error stored at end of fallback.");throw await(o?.handleChainError(t)),t})}async*_streamIterator(e,t){const n=zE(t),r=await QE(n),{runId:i,...a}=n,o=await(r?.handleChainStart(this.toJSON(),bR(e,"input"),i,void 0,void 0,void 0,a?.runName));let s,c,l;for(const d of this.runnables()){n?.signal?.throwIfAborted();const t=ZE(a,{callbacks:o?.getChild()});try{c=SR(t,await d.stream(e,t));break}catch(u){void 0===s&&(s=u)}}if(void 0===c){const e=s??new Error("No error stored at end of fallback.");throw await(o?.handleChainError(e)),e}try{for await(const e of c){yield e;try{l=void 0===l?l:this._concatOutputChunks(l,e)}catch{l=void 0}}}catch(u){throw await(o?.handleChainError(u)),u}await(o?.handleChainEnd(bR(l,"output")))}async batch(e,t,n){if(n?.returnExceptions)throw new Error("Not implemented.");const r=this._getOptionsList(t??{},e.length),i=await Promise.all(r.map(e=>QE(e))),a=await Promise.all(i.map(async(t,n)=>{const i=await(t?.handleChainStart(this.toJSON(),bR(e[n],"input"),r[n].runId,void 0,void 0,void 0,r[n].runName));return delete r[n].runId,i}));let o;for(const c of this.runnables()){r[0].signal?.throwIfAborted();try{const t=await c.batch(e,a.map((e,t)=>ZE(r[t],{callbacks:e?.getChild()})),n);return await Promise.all(a.map((e,n)=>e?.handleChainEnd(bR(t[n],"output")))),t}catch(s){void 0===o&&(o=s)}}if(!o)throw new Error("No error stored at end of fallbacks.");throw await Promise.all(a.map(e=>e?.handleChainError(o))),o}};function NR(e){if("function"==typeof e)return new RR({func:e});if(TR.isRunnable(e))return e;if(Array.isArray(e)||"object"!=typeof e)throw new Error("Expected a Runnable, function or object.\nInstead got an unsupported type.");{const t={};for(const[n,r]of Object.entries(e))t[n]=NR(r);return new ER({steps:t})}}var OR=class extends TR{static lc_name(){return"RunnableAssign"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;mapper;constructor(e){e instanceof ER&&(e={mapper:e}),super(e),this.mapper=e.mapper}async invoke(e,t){const n=await this.mapper.invoke(e,t);return{...e,...n}}async*_transform(e,t,n){const r=this.mapper.getStepsKeys(),[i,a]=iP(e),o=this.mapper.transform(a,ZE(n,{callbacks:t?.getChild()})),s=o.next();for await(const c of i){if("object"!=typeof c||Array.isArray(c))throw new Error("RunnableAssign can only be used with objects as input, got "+typeof c);const e=Object.fromEntries(Object.entries(c).filter(([e])=>!r.includes(e)));Object.keys(e).length>0&&(yield e)}yield(await s).value;for await(const c of o)yield c}transform(e,t){return this._transformStreamWithConfig(e,this._transform.bind(this),t)}async stream(e,t){const n=zE(t),r=new oP({generator:this.transform(async function*(){yield e}(),n),config:n});return await r.setup,rP.fromAsyncGenerator(r)}},BR=class extends TR{static lc_name(){return"RunnablePick"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;keys;constructor(e){("string"==typeof e||Array.isArray(e))&&(e={keys:e}),super(e),this.keys=e.keys}async _pick(e){if("string"==typeof this.keys)return e[this.keys];{const t=this.keys.map(t=>[t,e[t]]).filter(e=>void 0!==e[1]);return 0===t.length?void 0:Object.fromEntries(t)}}async invoke(e,t){return this._callWithConfig(this._pick.bind(this),e,t)}async*_transform(e){for await(const t of e){const e=await this._pick(t);void 0!==e&&(yield e)}}transform(e,t){return this._transformStreamWithConfig(e,this._transform.bind(this),t)}async stream(e,t){const n=zE(t),r=new oP({generator:this.transform(async function*(){yield e}(),n),config:n});return await r.setup,rP.fromAsyncGenerator(r)}},MR=class extends vR{name;description;schema;constructor(e){super({bound:wR.from([RR.from(async e=>{let t;if(EA(e))try{t=await Ig(this.schema,e.args)}catch{throw new PA("Received tool input did not match expected schema",JSON.stringify(e.args))}else t=e;return t}).withConfig({runName:`${e.name}:parse_input`}),e.bound]).withConfig({runName:e.name}),config:e.config??{}}),this.name=e.name,this.description=e.description,this.schema=e.schema}static lc_name(){return"RunnableToolLike"}};var DR="0123456789abcdef".split(""),FR=[-2147483648,8388608,32768,128],kR=[24,16,8,0],GR=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],xR=[];function HR(e,t){t?(xR[0]=xR[16]=xR[1]=xR[2]=xR[3]=xR[4]=xR[5]=xR[6]=xR[7]=xR[8]=xR[9]=xR[10]=xR[11]=xR[12]=xR[13]=xR[14]=xR[15]=0,this.blocks=xR):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=e}HR.prototype.update=function(e){if(!this.finalized){var t,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(ERROR);if(null===e)throw new Error(ERROR);if(ARRAY_BUFFER&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||ARRAY_BUFFER&&ArrayBuffer.isView(e)))throw new Error(ERROR);t=!0}for(var r,i,a=0,o=e.length,s=this.blocks;a<o;){if(this.hashed&&(this.hashed=!1,s[0]=this.block,this.block=s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),t)for(i=this.start;a<o&&i<64;++a)s[i>>>2]|=e[a]<<kR[3&i++];else for(i=this.start;a<o&&i<64;++a)(r=e.charCodeAt(a))<128?s[i>>>2]|=r<<kR[3&i++]:r<2048?(s[i>>>2]|=(192|r>>>6)<<kR[3&i++],s[i>>>2]|=(128|63&r)<<kR[3&i++]):r<55296||r>=57344?(s[i>>>2]|=(224|r>>>12)<<kR[3&i++],s[i>>>2]|=(128|r>>>6&63)<<kR[3&i++],s[i>>>2]|=(128|63&r)<<kR[3&i++]):(r=65536+((1023&r)<<10|1023&e.charCodeAt(++a)),s[i>>>2]|=(240|r>>>18)<<kR[3&i++],s[i>>>2]|=(128|r>>>12&63)<<kR[3&i++],s[i>>>2]|=(128|r>>>6&63)<<kR[3&i++],s[i>>>2]|=(128|63&r)<<kR[3&i++]);this.lastByteIndex=i,this.bytes+=i-this.start,i>=64?(this.block=s[16],this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},HR.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>>2]|=FR[3&t],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}},HR.prototype.hash=function(){var e,t,n,r,i,a,o,s,c,l=this.h0,u=this.h1,d=this.h2,p=this.h3,h=this.h4,f=this.h5,m=this.h6,g=this.h7,y=this.blocks;for(e=16;e<64;++e)t=((i=y[e-15])>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,n=((i=y[e-2])>>>17|i<<15)^(i>>>19|i<<13)^i>>>10,y[e]=y[e-16]+t+y[e-7]+n|0;for(c=u&d,e=0;e<64;e+=4)this.first?(this.is224?(a=300032,g=(i=y[0]-1413257819)-150054599|0,p=i+24177077|0):(a=704751109,g=(i=y[0]-210244248)-1521486534|0,p=i+143694565|0),this.first=!1):(t=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),r=(a=l&u)^l&d^c,g=p+(i=g+(n=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(h&f^~h&m)+GR[e]+y[e])|0,p=i+(t+r)|0),t=(p>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10),r=(o=p&l)^p&u^a,m=d+(i=f+(n=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7))+(m&g^~m&h)+GR[e+1]+y[e+1])|0,t=((d=i+(t+r)|0)>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),r=(s=d&p)^d&l^o,f=u+(i=h+(n=(m>>>6|m<<26)^(m>>>11|m<<21)^(m>>>25|m<<7))+(f&m^~f&g)+GR[e+2]+y[e+2])|0,t=((u=i+(t+r)|0)>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),r=(c=u&d)^u&p^s,h=l+(i=h+(n=(f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7))+(f&m^~f&g)+GR[e+3]+y[e+3])|0,l=i+(t+r)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+l|0,this.h1=this.h1+u|0,this.h2=this.h2+d|0,this.h3=this.h3+p|0,this.h4=this.h4+h|0,this.h5=this.h5+f|0,this.h6=this.h6+m|0,this.h7=this.h7+g|0},HR.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3,i=this.h4,a=this.h5,o=this.h6,s=this.h7,c=DR[e>>>28&15]+DR[e>>>24&15]+DR[e>>>20&15]+DR[e>>>16&15]+DR[e>>>12&15]+DR[e>>>8&15]+DR[e>>>4&15]+DR[15&e]+DR[t>>>28&15]+DR[t>>>24&15]+DR[t>>>20&15]+DR[t>>>16&15]+DR[t>>>12&15]+DR[t>>>8&15]+DR[t>>>4&15]+DR[15&t]+DR[n>>>28&15]+DR[n>>>24&15]+DR[n>>>20&15]+DR[n>>>16&15]+DR[n>>>12&15]+DR[n>>>8&15]+DR[n>>>4&15]+DR[15&n]+DR[r>>>28&15]+DR[r>>>24&15]+DR[r>>>20&15]+DR[r>>>16&15]+DR[r>>>12&15]+DR[r>>>8&15]+DR[r>>>4&15]+DR[15&r]+DR[i>>>28&15]+DR[i>>>24&15]+DR[i>>>20&15]+DR[i>>>16&15]+DR[i>>>12&15]+DR[i>>>8&15]+DR[i>>>4&15]+DR[15&i]+DR[a>>>28&15]+DR[a>>>24&15]+DR[a>>>20&15]+DR[a>>>16&15]+DR[a>>>12&15]+DR[a>>>8&15]+DR[a>>>4&15]+DR[15&a]+DR[o>>>28&15]+DR[o>>>24&15]+DR[o>>>20&15]+DR[o>>>16&15]+DR[o>>>12&15]+DR[o>>>8&15]+DR[o>>>4&15]+DR[15&o];return this.is224||(c+=DR[s>>>28&15]+DR[s>>>24&15]+DR[s>>>20&15]+DR[s>>>16&15]+DR[s>>>12&15]+DR[s>>>8&15]+DR[s>>>4&15]+DR[15&s]),c},HR.prototype.toString=HR.prototype.hex,HR.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3,i=this.h4,a=this.h5,o=this.h6,s=this.h7,c=[e>>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,n>>>24&255,n>>>16&255,n>>>8&255,255&n,r>>>24&255,r>>>16&255,r>>>8&255,255&r,i>>>24&255,i>>>16&255,i>>>8&255,255&i,a>>>24&255,a>>>16&255,a>>>8&255,255&a,o>>>24&255,o>>>16&255,o>>>8&255,255&o];return this.is224||c.push(s>>>24&255,s>>>16&255,s>>>8&255,255&s),c},HR.prototype.array=HR.prototype.digest,HR.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(this.is224?28:32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),this.is224||t.setUint32(28,this.h7),e};const UR=(...e)=>((...e)=>new HR(!1,!0).update(e.join("")).hex())(e.join("_"));var VR=class{keyEncoder=UR;makeDefaultKeyEncoder(e){this.keyEncoder=e}};const $R=new Map;var jR=class e extends VR{cache;constructor(e){super(),this.cache=e??new Map}lookup(e,t){return Promise.resolve(this.cache.get(this.keyEncoder(e,t))??null)}async update(e,t,n){this.cache.set(this.keyEncoder(e,t),n)}static global(){return new e($R)}},WR=class extends tC{},XR=class extends WR{static lc_name(){return"StringPromptValue"}lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;value;constructor(e){super({value:e}),this.value=e}toString(){return this.value}toChatMessages(){return[new DA(this.value)]}},KR=class extends WR{lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;static lc_name(){return"ChatPromptValue"}messages;constructor(e){Array.isArray(e)&&(e={messages:e}),super(e),this.messages=e.messages}toString(){return WA(this.messages)}toChatMessages(){return this.messages}};const YR=vi(qu());var qR=Object.defineProperty;function QR(e,t){return 1===e.length?[t.get(e.join(","))]:function(e,t){let n=Array.from({length:e.length},(e,t)=>({start:t,end:t+1}));for(;n.length>1;){let r=null;for(let i=0;i<n.length-1;i++){const a=e.slice(n[i].start,n[i+1].end),o=t.get(a.join(","));null!=o&&(null==r||o<r[0])&&(r=[o,i])}if(null==r)break;{const e=r[1];n[e]={start:n[e].start,end:n[e+1].end},n.splice(e+1,1)}}return n}(e,t).map(n=>t.get(e.slice(n.start,n.end).join(","))).filter(e=>null!=e)}var JR=class{specialTokens;inverseSpecialTokens;patStr;textEncoder=new TextEncoder;textDecoder=new TextDecoder("utf-8");rankMap=new Map;textMap=new Map;constructor(e,t){this.patStr=e.pat_str;const n=e.bpe_ranks.split("\n").filter(Boolean).reduce((e,t)=>{const[n,r,...i]=t.split(" "),a=Number.parseInt(r,10);return i.forEach((t,n)=>e[t]=a+n),e},{});for(const[r,i]of Object.entries(n)){const e=YR.toByteArray(r);this.rankMap.set(e.join(","),i),this.textMap.set(i,e)}this.specialTokens={...e.special_tokens,...t},this.inverseSpecialTokens=Object.entries(this.specialTokens).reduce((e,[t,n])=>(e[n]=this.textEncoder.encode(t),e),{})}encode(e,t=[],n="all"){const r=new RegExp(this.patStr,"ug"),i=JR.specialTokenRegex(Object.keys(this.specialTokens)),a=[],o=new Set("all"===t?Object.keys(this.specialTokens):t),s=new Set("all"===n?Object.keys(this.specialTokens).filter(e=>!o.has(e)):n);if(s.size>0){const t=JR.specialTokenRegex([...s]),n=e.match(t);if(null!=n)throw new Error(`The text contains a special token that is not allowed: ${n[0]}`)}let c=0;for(;;){let t=null,n=c;for(;i.lastIndex=n,t=i.exec(e),null!=t&&!o.has(t[0]);)n=t.index+1;const s=t?.index??e.length;for(const i of e.substring(c,s).matchAll(r)){const e=this.textEncoder.encode(i[0]),t=this.rankMap.get(e.join(","));null==t?a.push(...QR(e,this.rankMap)):a.push(t)}if(null==t)break;let l=this.specialTokens[t[0]];a.push(l),c=t.index+t[0].length}return a}decode(e){const t=[];let n=0;for(let a=0;a<e.length;++a){const r=e[a],i=this.textMap.get(r)??this.inverseSpecialTokens[r];null!=i&&(t.push(i),n+=i.length)}const r=new Uint8Array(n);let i=0;for(const a of t)r.set(a,i),i+=a.length;return this.textDecoder.decode(r)}},zR=JR;((e,t,n)=>{t in e?qR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(zR,"specialTokenRegex"+"",e=>new RegExp(e.map(e=>e.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")).join("|"),"g"));const ZR={},eL=new aR({});async function tL(e){return async function(e){return e in ZR||(ZR[e]=eL.fetch(`https://tiktoken.pages.dev/js/${e}.json`).then(e=>e.json()).then(e=>new zR(e)).catch(t=>{throw delete ZR[e],t})),await ZR[e]}(function(e){switch(e){case"gpt2":return"gpt2";case"code-cushman-001":case"code-cushman-002":case"code-davinci-001":case"code-davinci-002":case"cushman-codex":case"davinci-codex":case"davinci-002":case"text-davinci-002":case"text-davinci-003":return"p50k_base";case"code-davinci-edit-001":case"text-davinci-edit-001":return"p50k_edit";case"ada":case"babbage":case"babbage-002":case"code-search-ada-code-001":case"code-search-babbage-code-001":case"curie":case"davinci":case"text-ada-001":case"text-babbage-001":case"text-curie-001":case"text-davinci-001":case"text-search-ada-doc-001":case"text-search-babbage-doc-001":case"text-search-curie-doc-001":case"text-search-davinci-doc-001":case"text-similarity-ada-001":case"text-similarity-babbage-001":case"text-similarity-curie-001":case"text-similarity-davinci-001":return"r50k_base";case"gpt-3.5-turbo-instruct-0914":case"gpt-3.5-turbo-instruct":case"gpt-3.5-turbo-16k-0613":case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo":case"gpt-4-32k-0613":case"gpt-4-32k-0314":case"gpt-4-32k":case"gpt-4-0613":case"gpt-4-0314":case"gpt-4":case"gpt-3.5-turbo-1106":case"gpt-35-turbo":case"gpt-4-1106-preview":case"gpt-4-vision-preview":case"gpt-3.5-turbo-0125":case"gpt-4-turbo":case"gpt-4-turbo-2024-04-09":case"gpt-4-turbo-preview":case"gpt-4-0125-preview":case"text-embedding-ada-002":case"text-embedding-3-small":case"text-embedding-3-large":return"cl100k_base";case"gpt-4o":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":case"gpt-4o-2024-11-20":case"gpt-4o-mini-2024-07-18":case"gpt-4o-mini":case"gpt-4o-search-preview":case"gpt-4o-search-preview-2025-03-11":case"gpt-4o-mini-search-preview":case"gpt-4o-mini-search-preview-2025-03-11":case"gpt-4o-audio-preview":case"gpt-4o-audio-preview-2024-12-17":case"gpt-4o-audio-preview-2024-10-01":case"gpt-4o-mini-audio-preview":case"gpt-4o-mini-audio-preview-2024-12-17":case"o1":case"o1-2024-12-17":case"o1-mini":case"o1-mini-2024-09-12":case"o1-preview":case"o1-preview-2024-09-12":case"o1-pro":case"o1-pro-2025-03-19":case"o3":case"o3-2025-04-16":case"o3-mini":case"o3-mini-2025-01-31":case"o4-mini":case"o4-mini-2025-04-16":case"chatgpt-4o-latest":case"gpt-4o-realtime":case"gpt-4o-realtime-preview-2024-10-01":case"gpt-4o-realtime-preview-2024-12-17":case"gpt-4o-mini-realtime-preview":case"gpt-4o-mini-realtime-preview-2024-12-17":case"gpt-4.1":case"gpt-4.1-2025-04-14":case"gpt-4.1-mini":case"gpt-4.1-mini-2025-04-14":case"gpt-4.1-nano":case"gpt-4.1-nano-2025-04-14":case"gpt-4.5-preview":case"gpt-4.5-preview-2025-02-27":case"gpt-5":case"gpt-5-2025-08-07":case"gpt-5-nano":case"gpt-5-nano-2025-08-07":case"gpt-5-mini":case"gpt-5-mini-2025-08-07":case"gpt-5-chat-latest":return"o200k_base";default:throw new Error("Unknown model")}}(e))}var nL=class extends TR{verbose;callbacks;tags;metadata;get lc_attributes(){return{callbacks:void 0,verbose:void 0}}constructor(e){super(e),this.verbose=e.verbose??!1,this.callbacks=e.callbacks,this.tags=e.tags??[],this.metadata=e.metadata??{},this._addVersion("@langchain/core","1.2.10")}_addVersion(e,t){const n=this.metadata?.versions;this.metadata={...this.metadata,versions:{..."object"==typeof n&&null!==n?n:{},[e]:t}}}},rL=class extends nL{get callKeys(){return["stop","timeout","signal","tags","metadata","callbacks"]}caller;cache;constructor({callbacks:e,callbackManager:t,...n}){const{cache:r,...i}=n;super({callbacks:e??t,...i}),this.cache="object"==typeof r?r:r?jR.global():void 0,this.caller=new aR(n??{})}_encoding;async getNumTokens(e){let t;t="string"==typeof e?e:e.map(e=>"string"==typeof e?e:"text"===e.type&&"text"in e?e.text:"").join("");let n=Math.ceil(t.length/4);if(!this._encoding)try{this._encoding=await tL("modelName"in this?(r=this.modelName,r.startsWith("gpt-5")?"gpt-5":r.startsWith("gpt-3.5-turbo-16k")?"gpt-3.5-turbo-16k":r.startsWith("gpt-3.5-turbo-")?"gpt-3.5-turbo":r.startsWith("gpt-4-32k")?"gpt-4-32k":r.startsWith("gpt-4-")?"gpt-4":r.startsWith("gpt-4o")?"gpt-4o":r):"gpt2")}catch(i){console.warn("Failed to calculate number of tokens, falling back to approximate count",i)}var r;if(this._encoding)try{n=this._encoding.encode(t).length}catch(i){console.warn("Failed to calculate number of tokens, falling back to approximate count",i)}return n}static _convertInputToPromptValue(e){return"string"==typeof e?new XR(e):Array.isArray(e)?new KR(e.map($A)):e}_identifyingParams(){return{}}_getSerializedCacheKeyParametersForCall({config:e,...t}){const n={...this._identifyingParams(),...t,_type:this._llmType(),_model:this._modelType()};return Object.entries(n).filter(([e,t])=>void 0!==t).map(([e,t])=>`${e}:${JSON.stringify(t)}`).sort().join(",")}serialize(){return{...this._identifyingParams(),_type:this._llmType(),_model:this._modelType()}}static async deserialize(e){throw new Error("Use .toJSON() instead")}get profile(){return{}}_filterInvocationParamsForTracing(e){const{tools:t,functions:n,messages:r,response_format:i,...a}=e;return a}};function iL(e){return new(0,e.constructor)({...e,content:e.contentBlocks,response_metadata:{...e.response_metadata,output_version:"v1"}})}var aL=class extends TR{static lc_name(){return"RunnablePassthrough"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;func;constructor(e){super(e),e&&(this.func=e.func)}async invoke(e,t){const n=zE(t);return this.func&&await this.func(e,n),this._callWithConfig(e=>Promise.resolve(e),e,n)}async*transform(e,t){const n=zE(t);let r,i=!0;for await(const a of this._transformStreamWithConfig(e,e=>e,n))if(yield a,i)if(void 0===r)r=a;else try{r=aP(r,a)}catch{r=void 0,i=!1}this.func&&void 0!==r&&await this.func(r,n)}static assign(e){return new OR(new ER({steps:e}))}},oL=class extends TR{parseResultWithPrompt(e,t,n){return this.parseResult(e,n)}_baseMessageToString(e){return"string"==typeof e.content?e.content:this._baseMessageContentToString(e.content)}_baseMessageContentToString(e){return JSON.stringify(e)}async invoke(e,t){return"string"==typeof e?this._callWithConfig(async(e,t)=>this.parseResult([{text:e}],t?.callbacks),e,{...t,runType:"parser"}):this._callWithConfig(async(e,t)=>this.parseResult([{message:e,text:this._baseMessageToString(e)}],t?.callbacks),e,{...t,runType:"parser"})}},sL=class extends oL{parseResult(e,t){return this.parse(e[0].text,t)}async parseWithPrompt(e,t,n){return this.parse(e,n)}_type(){throw new Error("_type not implemented")}},cL=class extends Error{llmOutput;observation;sendToLLM;constructor(e,t,n,r=!1){if(super(e),this.llmOutput=t,this.observation=n,this.sendToLLM=r,r&&(void 0===n||void 0===t))throw new Error("Arguments 'observation' & 'llmOutput' are required if 'sendToLlm' is true");SA(this,"OUTPUT_PARSING_FAILURE")}},lL=class extends sL{async*_transform(e){for await(const t of e)"string"==typeof t?yield this.parseResult([{text:t}]):yield this.parseResult([{message:t,text:this._baseMessageToString(t)}])}async*transform(e,t){yield*this._transformStreamWithConfig(e,this._transform.bind(this),{...t,runType:"parser"})}},uL=class extends lL{diff=!1;constructor(e){super(e),this.diff=e?.diff??this.diff}async*_transform(e){let t,n;for await(const r of e){if("string"!=typeof r&&"string"!=typeof r.content)throw new Error("Cannot handle non-string output.");let e;if(jC(r)){if("string"!=typeof r.content)throw new Error("Cannot handle non-string message output.");e=new lP({message:r,text:r.content})}else if($C(r)){if("string"!=typeof r.content)throw new Error("Cannot handle non-string message output.");e=new lP({message:XA(r),text:r.content})}else e=new cP({text:r});n=void 0===n?e:n.concat(e);const i=await this.parsePartialResult([n]);null==i||jI(i,t)||(this.diff?yield this._diff(t,i):yield i,t=i)}}getFormatInstructions(){return""}},dL=class extends uL{static lc_name(){return"JsonOutputParser"}lc_namespace=["langchain_core","output_parsers"];lc_serializable=!0;_concatOutputChunks(e,t){return this.diff?super._concatOutputChunks(e,t):t}_diff(e,t){if(t)return e?LP(e,t):[{op:"replace",path:"",value:t}]}async parsePartialResult(e){return RA(e[0].text)}async parse(e){return RA(e,JSON.parse)}getFormatInstructions(){return""}_baseMessageToString(e){return e.text}},pL=class extends sL{static lc_name(){return"StandardSchemaOutputParser"}lc_namespace=["langchain","output_parsers","standard_schema"];schema;constructor(e){super(),this.schema=e}static fromSerializableSchema(e){return new this(e)}async parse(e){try{const t=RA(e,JSON.parse),n=await this.schema["~standard"].validate(t);if(n.issues)throw new Error(`Validation failed: ${JSON.stringify(n.issues)}`);return n.value}catch(t){throw new cL(`Failed to parse. Text: "${e}". Error: ${t}`,e)}}_baseMessageToString(e){return e.text}getFormatInstructions(){return""}},hL=class extends sL{schema;static lc_name(){return"StructuredOutputParser"}lc_namespace=["langchain","output_parsers","structured"];toJSON(){return this.toJSONNotImplemented()}constructor(e){super(e),this.schema=e}static fromZodSchema(e){return new this(e)}static fromNamesAndDescriptions(e){return new this(dI(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,lI().describe(t)]))))}getFormatInstructions(){return`You must format your output as a JSON value that adheres to a given "JSON Schema" instance.\n\n"JSON Schema" is a declarative language that allows you to annotate and validate JSON documents.\n\nFor example, the example "JSON Schema" instance {{"properties": {{"foo": {{"description": "a list of test words", "type": "array", "items": {{"type": "string"}}}}}}, "required": ["foo"]}}\nwould match an object with one required property, "foo". The "type" property specifies "foo" must be an "array", and the "description" property semantically describes it as "a list of test words". The items within "foo" must be strings.\nThus, the object {{"foo": ["bar", "baz"]}} is a well-formatted instance of this example "JSON Schema". The object {{"properties": {{"foo": ["bar", "baz"]}}}} is not well-formatted.\n\nYour output will be parsed and type-checked according to the provided schema instance, so make sure all fields in your output match the schema exactly and there are no trailing commas!\n\nHere is the JSON Schema instance your output must adhere to. Include the enclosing markdown codeblock:\n\`\`\`json\n${JSON.stringify(XI(this.schema))}\n\`\`\`\n`}async parse(e){try{const t=e.trim(),n=(t.match(/^```(?:json)?\s*([\s\S]*?)```/)?.[1]||t.match(/```json\s*([\s\S]*?)```/)?.[1]||t).replace(/"([^"\\]*(\\.[^"\\]*)*)"/g,(e,t)=>`"${t.replace(/\n/g,"\\n")}"`).replace(/\n/g,"");return await Ig(this.schema,JSON.parse(n))}catch(t){throw new cL(`Failed to parse. Text: "${e}". Error: ${t}`,e)}}_baseMessageToString(e){return e.text}};function fL(e,t){if(void 0===e.function)return;let n;if(t?.partial)try{n=NA(e.function.arguments??"{}")}catch{return}else try{n=JSON.parse(e.function.arguments)}catch(i){throw new cL([`Function "${e.function.name}" arguments:`,"",e.function.arguments,"","are not valid JSON.",`Error: ${i.message}`].join("\n"))}const r={name:e.function.name,args:n,type:"tool_call"};return t?.returnId&&(r.id=e.id),r}function mL(e){if(void 0===e.id)throw new Error('All OpenAI tool calls must have an "id" field.');return{id:e.id,type:"function",function:{name:e.name,arguments:JSON.stringify(e.args)}}}function gL(e,t){return{name:e.function?.name,args:e.function?.arguments,id:e.id,error:t,type:"invalid_tool_call"}}!function(){const e={parser:function(e,t){return new n(e,t)}};e.SAXParser=n,e.SAXStream=a,e.createStream=function(e,t){return new a(e,t)},e.MAX_BUFFER_LENGTH=65536;const t=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];function n(r,i){if(!(this instanceof n))return new n(r,i);var a=this;!function(e){for(var n=0,r=t.length;n<r;n++)e[t[n]]=""}(a),a.q=a.c="",a.bufferCheckPosition=e.MAX_BUFFER_LENGTH,a.opt=i||{},a.opt.lowercase=a.opt.lowercase||a.opt.lowercasetags,a.looseCase=a.opt.lowercase?"toLowerCase":"toUpperCase",a.tags=[],a.closed=a.closedRoot=a.sawRoot=!1,a.tag=a.error=null,a.strict=!!r,a.noscript=!(!r&&!a.opt.noscript),a.state=T.BEGIN,a.strictEntities=a.opt.strictEntities,a.ENTITIES=a.strictEntities?Object.create(e.XML_ENTITIES):Object.create(e.ENTITIES),a.attribList=[],a.opt.xmlns&&(a.ns=Object.create(u)),a.trackPosition=!1!==a.opt.position,a.trackPosition&&(a.position=a.line=a.column=0),_(a,"onready")}e.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"],Object.create||(Object.create=function(e){function t(){}return t.prototype=e,new t}),Object.keys||(Object.keys=function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t}),n.prototype={end:function(){L(this)},write:function(n){var r=this;if(this.error)throw this.error;if(r.closed)return R(r,"Cannot write after close. Assign an onready handler.");if(null===n)return L(r);"object"==typeof n&&(n=n.toString());var i=0,a="";for(;a=x(n,i++),r.c=a,a;)switch(r.trackPosition&&(r.position++,"\n"===a?(r.line++,r.column=0):r.column++),r.state){case T.BEGIN:if(r.state=T.BEGIN_WHITESPACE,"\ufeff"===a)continue;G(r,a);continue;case T.BEGIN_WHITESPACE:G(r,a);continue;case T.TEXT:if(r.sawRoot&&!r.closedRoot){for(var c=i-1;a&&"<"!==a&&"&"!==a;)(a=x(n,i++))&&r.trackPosition&&(r.position++,"\n"===a?(r.line++,r.column=0):r.column++);r.textNode+=n.substring(c,i-1)}"<"!==a||r.sawRoot&&r.closedRoot&&!r.strict?(m(a)||r.sawRoot&&!r.closedRoot||N(r,"Text data outside of root node."),"&"===a?r.state=T.TEXT_ENTITY:r.textNode+=a):(r.state=T.OPEN_WAKA,r.startTagPosition=r.position);continue;case T.SCRIPT:"<"===a?r.state=T.SCRIPT_ENDING:r.script+=a;continue;case T.SCRIPT_ENDING:"/"===a?r.state=T.CLOSE_TAG:(r.script+="<"+a,r.state=T.SCRIPT);continue;case T.OPEN_WAKA:if("!"===a)r.state=T.SGML_DECL,r.sgmlDecl="";else if(m(a));else if(I(d,a))r.state=T.OPEN_TAG,r.tagName=a;else if("/"===a)r.state=T.CLOSE_TAG,r.tagName="";else if("?"===a)r.state=T.PROC_INST,r.procInstName=r.procInstBody="";else{if(N(r,"Unencoded <"),r.startTagPosition+1<r.position){var l=r.position-r.startTagPosition;a=new Array(l).join(" ")+a}r.textNode+="<"+a,r.state=T.TEXT}continue;case T.SGML_DECL:(r.sgmlDecl+a).toUpperCase()===o?(w(r,"onopencdata"),r.state=T.CDATA,r.sgmlDecl="",r.cdata=""):r.sgmlDecl+a==="--"?(r.state=T.COMMENT,r.comment="",r.sgmlDecl=""):(r.sgmlDecl+a).toUpperCase()===s?(r.state=T.DOCTYPE,(r.doctype||r.sawRoot)&&N(r,"Inappropriately located doctype declaration"),r.doctype="",r.sgmlDecl=""):">"===a?(w(r,"onsgmldeclaration",r.sgmlDecl),r.sgmlDecl="",r.state=T.TEXT):g(a)?(r.state=T.SGML_DECL_QUOTED,r.sgmlDecl+=a):r.sgmlDecl+=a;continue;case T.SGML_DECL_QUOTED:a===r.q&&(r.state=T.SGML_DECL,r.q=""),r.sgmlDecl+=a;continue;case T.DOCTYPE:">"===a?(r.state=T.TEXT,w(r,"ondoctype",r.doctype),r.doctype=!0):(r.doctype+=a,"["===a?r.state=T.DOCTYPE_DTD:g(a)&&(r.state=T.DOCTYPE_QUOTED,r.q=a));continue;case T.DOCTYPE_QUOTED:r.doctype+=a,a===r.q&&(r.q="",r.state=T.DOCTYPE);continue;case T.DOCTYPE_DTD:r.doctype+=a,"]"===a?r.state=T.DOCTYPE:g(a)&&(r.state=T.DOCTYPE_DTD_QUOTED,r.q=a);continue;case T.DOCTYPE_DTD_QUOTED:r.doctype+=a,a===r.q&&(r.state=T.DOCTYPE_DTD,r.q="");continue;case T.COMMENT:"-"===a?r.state=T.COMMENT_ENDING:r.comment+=a;continue;case T.COMMENT_ENDING:"-"===a?(r.state=T.COMMENT_ENDED,r.comment=P(r.opt,r.comment),r.comment&&w(r,"oncomment",r.comment),r.comment=""):(r.comment+="-"+a,r.state=T.COMMENT);continue;case T.COMMENT_ENDED:">"!==a?(N(r,"Malformed comment"),r.comment+="--"+a,r.state=T.COMMENT):r.state=T.TEXT;continue;case T.CDATA:"]"===a?r.state=T.CDATA_ENDING:r.cdata+=a;continue;case T.CDATA_ENDING:"]"===a?r.state=T.CDATA_ENDING_2:(r.cdata+="]"+a,r.state=T.CDATA);continue;case T.CDATA_ENDING_2:">"===a?(r.cdata&&w(r,"oncdata",r.cdata),w(r,"onclosecdata"),r.cdata="",r.state=T.TEXT):"]"===a?r.cdata+="]":(r.cdata+="]]"+a,r.state=T.CDATA);continue;case T.PROC_INST:"?"===a?r.state=T.PROC_INST_ENDING:m(a)?r.state=T.PROC_INST_BODY:r.procInstName+=a;continue;case T.PROC_INST_BODY:if(!r.procInstBody&&m(a))continue;"?"===a?r.state=T.PROC_INST_ENDING:r.procInstBody+=a;continue;case T.PROC_INST_ENDING:">"===a?(w(r,"onprocessinginstruction",{name:r.procInstName,body:r.procInstBody}),r.procInstName=r.procInstBody="",r.state=T.TEXT):(r.procInstBody+="?"+a,r.state=T.PROC_INST_BODY);continue;case T.OPEN_TAG:I(p,a)?r.tagName+=a:(O(r),">"===a?D(r):"/"===a?r.state=T.OPEN_TAG_SLASH:(m(a)||N(r,"Invalid character in tag name"),r.state=T.ATTRIB));continue;case T.OPEN_TAG_SLASH:">"===a?(D(r,!0),F(r)):(N(r,"Forward-slash in opening tag not followed by >"),r.state=T.ATTRIB);continue;case T.ATTRIB:if(m(a))continue;">"===a?D(r):"/"===a?r.state=T.OPEN_TAG_SLASH:I(d,a)?(r.attribName=a,r.attribValue="",r.state=T.ATTRIB_NAME):N(r,"Invalid attribute name");continue;case T.ATTRIB_NAME:"="===a?r.state=T.ATTRIB_VALUE:">"===a?(N(r,"Attribute without value"),r.attribValue=r.attribName,M(r),D(r)):m(a)?r.state=T.ATTRIB_NAME_SAW_WHITE:I(p,a)?r.attribName+=a:N(r,"Invalid attribute name");continue;case T.ATTRIB_NAME_SAW_WHITE:if("="===a)r.state=T.ATTRIB_VALUE;else{if(m(a))continue;N(r,"Attribute without value"),r.tag.attributes[r.attribName]="",r.attribValue="",w(r,"onattribute",{name:r.attribName,value:""}),r.attribName="",">"===a?D(r):I(d,a)?(r.attribName=a,r.state=T.ATTRIB_NAME):(N(r,"Invalid attribute name"),r.state=T.ATTRIB)}continue;case T.ATTRIB_VALUE:if(m(a))continue;g(a)?(r.q=a,r.state=T.ATTRIB_VALUE_QUOTED):(N(r,"Unquoted attribute value"),r.state=T.ATTRIB_VALUE_UNQUOTED,r.attribValue=a);continue;case T.ATTRIB_VALUE_QUOTED:if(a!==r.q){"&"===a?r.state=T.ATTRIB_VALUE_ENTITY_Q:r.attribValue+=a;continue}M(r),r.q="",r.state=T.ATTRIB_VALUE_CLOSED;continue;case T.ATTRIB_VALUE_CLOSED:m(a)?r.state=T.ATTRIB:">"===a?D(r):"/"===a?r.state=T.OPEN_TAG_SLASH:I(d,a)?(N(r,"No whitespace between attributes"),r.attribName=a,r.attribValue="",r.state=T.ATTRIB_NAME):N(r,"Invalid attribute name");continue;case T.ATTRIB_VALUE_UNQUOTED:if(!y(a)){"&"===a?r.state=T.ATTRIB_VALUE_ENTITY_U:r.attribValue+=a;continue}M(r),">"===a?D(r):r.state=T.ATTRIB;continue;case T.CLOSE_TAG:if(r.tagName)">"===a?F(r):I(p,a)?r.tagName+=a:r.script?(r.script+="</"+r.tagName,r.tagName="",r.state=T.SCRIPT):(m(a)||N(r,"Invalid tagname in closing tag"),r.state=T.CLOSE_TAG_SAW_WHITE);else{if(m(a))continue;C(d,a)?r.script?(r.script+="</"+a,r.state=T.SCRIPT):N(r,"Invalid tagname in closing tag."):r.tagName=a}continue;case T.CLOSE_TAG_SAW_WHITE:if(m(a))continue;">"===a?F(r):N(r,"Invalid characters in closing tag");continue;case T.TEXT_ENTITY:case T.ATTRIB_VALUE_ENTITY_Q:case T.ATTRIB_VALUE_ENTITY_U:var u,A;switch(r.state){case T.TEXT_ENTITY:u=T.TEXT,A="textNode";break;case T.ATTRIB_VALUE_ENTITY_Q:u=T.ATTRIB_VALUE_QUOTED,A="attribValue";break;case T.ATTRIB_VALUE_ENTITY_U:u=T.ATTRIB_VALUE_UNQUOTED,A="attribValue"}if(";"===a)if(r.opt.unparsedEntities){var S=k(r);r.entity="",r.state=u,r.write(S)}else r[A]+=k(r),r.entity="",r.state=u;else I(r.entity.length?f:h,a)?r.entity+=a:(N(r,"Invalid character in entity name"),r[A]+="&"+r.entity+a,r.entity="",r.state=u);continue;default:throw new Error(r,"Unknown state: "+r.state)}r.position>=r.bufferCheckPosition&&function(n){for(var r=Math.max(e.MAX_BUFFER_LENGTH,10),i=0,a=0,o=t.length;a<o;a++){var s=n[t[a]].length;if(s>r)switch(t[a]){case"textNode":E(n);break;case"cdata":w(n,"oncdata",n.cdata),n.cdata="";break;case"script":w(n,"onscript",n.script),n.script="";break;default:R(n,"Max buffer length exceeded: "+t[a])}i=Math.max(i,s)}n.bufferCheckPosition=e.MAX_BUFFER_LENGTH-i+n.position}(r);return r},resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){var e;E(e=this),""!==e.cdata&&(w(e,"oncdata",e.cdata),e.cdata=""),""!==e.script&&(w(e,"onscript",e.script),e.script="")}};var r=ReadableStream;r||(r=function(){});var i=e.EVENTS.filter(function(e){return"error"!==e&&"end"!==e});function a(e,t){if(!(this instanceof a))return new a(e,t);r.apply(this),this._parser=new n(e,t),this.writable=!0,this.readable=!0;var o=this;this._parser.onend=function(){o.emit("end")},this._parser.onerror=function(e){o.emit("error",e),o._parser.error=null},this._decoder=null,i.forEach(function(e){Object.defineProperty(o,"on"+e,{get:function(){return o._parser["on"+e]},set:function(t){if(!t)return o.removeAllListeners(e),o._parser["on"+e]=t,t;o.on(e,t)},enumerable:!0,configurable:!1})})}a.prototype=Object.create(r.prototype,{constructor:{value:a}}),a.prototype.write=function(e){return this._parser.write(e.toString()),this.emit("data",e),!0},a.prototype.end=function(e){return e&&e.length&&this.write(e),this._parser.end(),!0},a.prototype.on=function(e,t){var n=this;return n._parser["on"+e]||-1===i.indexOf(e)||(n._parser["on"+e]=function(){var t=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);t.splice(0,0,e),n.emit.apply(n,t)}),r.prototype.on.call(n,e,t)};var o="[CDATA[",s="DOCTYPE",c="http://www.w3.org/XML/1998/namespace",l="http://www.w3.org/2000/xmlns/",u={xml:c,xmlns:l},d=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,p=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,h=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,f=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function m(e){return" "===e||"\n"===e||"\r"===e||"\t"===e}function g(e){return'"'===e||"'"===e}function y(e){return">"===e||m(e)}function I(e,t){return e.test(t)}function C(e,t){return!I(e,t)}var A,S,b,T=0;for(var v in e.STATE={BEGIN:T++,BEGIN_WHITESPACE:T++,TEXT:T++,TEXT_ENTITY:T++,OPEN_WAKA:T++,SGML_DECL:T++,SGML_DECL_QUOTED:T++,DOCTYPE:T++,DOCTYPE_QUOTED:T++,DOCTYPE_DTD:T++,DOCTYPE_DTD_QUOTED:T++,COMMENT_STARTING:T++,COMMENT:T++,COMMENT_ENDING:T++,COMMENT_ENDED:T++,CDATA:T++,CDATA_ENDING:T++,CDATA_ENDING_2:T++,PROC_INST:T++,PROC_INST_BODY:T++,PROC_INST_ENDING:T++,OPEN_TAG:T++,OPEN_TAG_SLASH:T++,ATTRIB:T++,ATTRIB_NAME:T++,ATTRIB_NAME_SAW_WHITE:T++,ATTRIB_VALUE:T++,ATTRIB_VALUE_QUOTED:T++,ATTRIB_VALUE_CLOSED:T++,ATTRIB_VALUE_UNQUOTED:T++,ATTRIB_VALUE_ENTITY_Q:T++,ATTRIB_VALUE_ENTITY_U:T++,CLOSE_TAG:T++,CLOSE_TAG_SAW_WHITE:T++,SCRIPT:T++,SCRIPT_ENDING:T++},e.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},e.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(e.ENTITIES).forEach(function(t){var n=e.ENTITIES[t],r="number"==typeof n?String.fromCharCode(n):n;e.ENTITIES[t]=r}),e.STATE)e.STATE[e.STATE[v]]=v;function _(e,t,n){e[t]&&e[t](n)}function w(e,t,n){e.textNode&&E(e),_(e,t,n)}function E(e){e.textNode=P(e.opt,e.textNode),e.textNode&&_(e,"ontext",e.textNode),e.textNode=""}function P(e,t){return e.trim&&(t=t.trim()),e.normalize&&(t=t.replace(/\s+/g," ")),t}function R(e,t){return E(e),e.trackPosition&&(t+="\nLine: "+e.line+"\nColumn: "+e.column+"\nChar: "+e.c),t=new Error(t),e.error=t,_(e,"onerror",t),e}function L(e){return e.sawRoot&&!e.closedRoot&&N(e,"Unclosed root tag"),e.state!==T.BEGIN&&e.state!==T.BEGIN_WHITESPACE&&e.state!==T.TEXT&&R(e,"Unexpected end"),E(e),e.c="",e.closed=!0,_(e,"onend"),n.call(e,e.strict,e.opt),e}function N(e,t){if("object"!=typeof e||!(e instanceof n))throw new Error("bad call to strictFail");e.strict&&R(e,t)}function O(e){e.strict||(e.tagName=e.tagName[e.looseCase]());var t=e.tags[e.tags.length-1]||e,n=e.tag={name:e.tagName,attributes:{}};e.opt.xmlns&&(n.ns=t.ns),e.attribList.length=0,w(e,"onopentagstart",n)}function B(e,t){var n=e.indexOf(":")<0?["",e]:e.split(":"),r=n[0],i=n[1];return t&&"xmlns"===e&&(r="xmlns",i=""),{prefix:r,local:i}}function M(e){if(e.strict||(e.attribName=e.attribName[e.looseCase]()),-1!==e.attribList.indexOf(e.attribName)||e.tag.attributes.hasOwnProperty(e.attribName))e.attribName=e.attribValue="";else{if(e.opt.xmlns){var t=B(e.attribName,!0),n=t.prefix,r=t.local;if("xmlns"===n)if("xml"===r&&e.attribValue!==c)N(e,"xml: prefix must be bound to "+c+"\nActual: "+e.attribValue);else if("xmlns"===r&&e.attribValue!==l)N(e,"xmlns: prefix must be bound to "+l+"\nActual: "+e.attribValue);else{var i=e.tag,a=e.tags[e.tags.length-1]||e;i.ns===a.ns&&(i.ns=Object.create(a.ns)),i.ns[r]=e.attribValue}e.attribList.push([e.attribName,e.attribValue])}else e.tag.attributes[e.attribName]=e.attribValue,w(e,"onattribute",{name:e.attribName,value:e.attribValue});e.attribName=e.attribValue=""}}function D(e,t){if(e.opt.xmlns){var n=e.tag,r=B(e.tagName);n.prefix=r.prefix,n.local=r.local,n.uri=n.ns[r.prefix]||"",n.prefix&&!n.uri&&(N(e,"Unbound namespace prefix: "+JSON.stringify(e.tagName)),n.uri=r.prefix);var i=e.tags[e.tags.length-1]||e;n.ns&&i.ns!==n.ns&&Object.keys(n.ns).forEach(function(t){w(e,"onopennamespace",{prefix:t,uri:n.ns[t]})});for(var a=0,o=e.attribList.length;a<o;a++){var s=e.attribList[a],c=s[0],l=s[1],u=B(c,!0),d=u.prefix,p=u.local,h=""===d?"":n.ns[d]||"",f={name:c,value:l,prefix:d,local:p,uri:h};d&&"xmlns"!==d&&!h&&(N(e,"Unbound namespace prefix: "+JSON.stringify(d)),f.uri=d),e.tag.attributes[c]=f,w(e,"onattribute",f)}e.attribList.length=0}e.tag.isSelfClosing=!!t,e.sawRoot=!0,e.tags.push(e.tag),w(e,"onopentag",e.tag),t||(e.noscript||"script"!==e.tagName.toLowerCase()?e.state=T.TEXT:e.state=T.SCRIPT,e.tag=null,e.tagName=""),e.attribName=e.attribValue="",e.attribList.length=0}function F(e){if(!e.tagName)return N(e,"Weird empty close tag."),e.textNode+="</>",void(e.state=T.TEXT);if(e.script){if("script"!==e.tagName)return e.script+="</"+e.tagName+">",e.tagName="",void(e.state=T.SCRIPT);w(e,"onscript",e.script),e.script=""}var t=e.tags.length,n=e.tagName;e.strict||(n=n[e.looseCase]());for(var r=n;t--&&e.tags[t].name!==r;)N(e,"Unexpected close tag");if(t<0)return N(e,"Unmatched closing tag: "+e.tagName),e.textNode+="</"+e.tagName+">",void(e.state=T.TEXT);e.tagName=n;for(var i=e.tags.length;i-- >t;){var a=e.tag=e.tags.pop();e.tagName=e.tag.name,w(e,"onclosetag",e.tagName);var o={};for(var s in a.ns)o[s]=a.ns[s];var c=e.tags[e.tags.length-1]||e;e.opt.xmlns&&a.ns!==c.ns&&Object.keys(a.ns).forEach(function(t){var n=a.ns[t];w(e,"onclosenamespace",{prefix:t,uri:n})})}0===t&&(e.closedRoot=!0),e.tagName=e.attribValue=e.attribName="",e.attribList.length=0,e.state=T.TEXT}function k(e){var t,n=e.entity,r=n.toLowerCase(),i="";return e.ENTITIES[n]?e.ENTITIES[n]:e.ENTITIES[r]?e.ENTITIES[r]:("#"===(n=r).charAt(0)&&("x"===n.charAt(1)?(n=n.slice(2),i=(t=parseInt(n,16)).toString(16)):(n=n.slice(1),i=(t=parseInt(n,10)).toString(10))),n=n.replace(/^0+/,""),isNaN(t)||i.toLowerCase()!==n?(N(e,"Invalid character entity"),"&"+e.entity+";"):String.fromCodePoint(t))}function G(e,t){"<"===t?(e.state=T.OPEN_WAKA,e.startTagPosition=e.position):m(t)||(N(e,"Non-whitespace before first tag."),e.textNode=t,e.state=T.TEXT)}function x(e,t){var n="";return t<e.length&&(n=e.charAt(t)),n}T=e.STATE,String.fromCodePoint||(A=String.fromCharCode,S=Math.floor,b=function(){var e,t,n=[],r=-1,i=arguments.length;if(!i)return"";for(var a="";++r<i;){var o=Number(arguments[r]);if(!isFinite(o)||o<0||o>1114111||S(o)!==o)throw RangeError("Invalid code point: "+o);o<=65535?n.push(o):(e=55296+((o-=65536)>>10),t=o%1024+56320,n.push(e,t)),(r+1===i||n.length>16384)&&(a+=A.apply(null,n),n.length=0)}return a},Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:b,configurable:!0,writable:!0}):String.fromCodePoint=b)}();var yL=class extends uL{static lc_name(){return"JsonOutputToolsParser"}returnId=!1;lc_namespace=["langchain","output_parsers","openai_tools"];lc_serializable=!0;constructor(e){super(e),this.returnId=e?.returnId??this.returnId}_diff(){throw new Error("Not supported.")}async parse(){throw new Error("Not implemented.")}async parseResult(e){return await this.parsePartialResult(e,!1)}async parsePartialResult(e,t=!0){const n=e[0].message;let r;if(qA(n)&&n.tool_calls?.length?r=n.tool_calls.map(e=>{const{id:t,...n}=e;return this.returnId?{id:t,...n}:n}):void 0!==n.additional_kwargs.tool_calls&&(r=JSON.parse(JSON.stringify(n.additional_kwargs.tool_calls)).map(e=>fL(e,{returnId:this.returnId,partial:t}))),!r)return[];const i=[];for(const a of r)if(void 0!==a){const e={type:a.name,args:a.args,id:a.id};i.push(e)}return i}},IL=class extends yL{static lc_name(){return"JsonOutputKeyToolsParser"}lc_namespace=["langchain","output_parsers","openai_tools"];lc_serializable=!0;returnId=!1;keyName;returnSingle=!1;zodSchema;serializableSchema;constructor(e){super(e),this.keyName=e.keyName,this.returnSingle=e.returnSingle??this.returnSingle,"zodSchema"in e&&(this.zodSchema=e.zodSchema),"serializableSchema"in e&&(this.serializableSchema=e.serializableSchema)}async _validateResult(e){if(void 0!==this.serializableSchema){const t=await this.serializableSchema["~standard"].validate(e);if(t.issues)throw new cL(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(t.issues)}`,JSON.stringify(e,null,2));return t.value}if(void 0===this.zodSchema)return e;const t=await async function(e,t){if(mg(e))try{return{success:!0,data:await tg(e,t)}}catch(n){return{success:!1,error:n}}if(gg(e))return await e.safeParseAsync(t);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}(this.zodSchema,e);if(t.success)return t.data;throw new cL(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(t.error?.issues)}`,JSON.stringify(e,null,2))}async parsePartialResult(e){const t=(await super.parsePartialResult(e)).filter(e=>e.type===this.keyName);let n=t;if(t.length)return this.returnId||(n=t.map(e=>e.args)),this.returnSingle?n[0]:n}async parseResult(e){const t=(await super.parsePartialResult(e,!1)).filter(e=>e.type===this.keyName);let n=t;if(t.length)return this.returnId||(n=t.map(e=>e.args)),this.returnSingle?this._validateResult(n[0]):await Promise.all(n.map(e=>this._validateResult(e)))}};function CL(e){return yg(e)?hL.fromZodSchema(e):$I(e)?pL.fromSerializableSchema(e):new dL}function AL(e,t,n,r){if(!n){const n=e.pipe(t);return r?n.withConfig({runName:r}):n}const i=aL.assign({parsed:(e,n)=>t.invoke(e.raw,n)}),a=aL.assign({parsed:()=>null}),o=i.withFallbacks({fallbacks:[a]}),s=wR.from([{raw:e},o]);return r?s.withConfig({runName:r}):s}var SL=class{events=[];finished=!1;waiters=[];error=null;push(e){this.events.push(e);const t=this.waiters.splice(0);for(const n of t)n()}finish(){this.finished=!0;const e=this.waiters.splice(0);for(const t of e)t()}setError(e){this.error=e,this.finished=!0;const t=this.waiters.splice(0);for(const n of t)n()}async*iterate(){if(this.finished){if(this.error)throw this.error;return void(yield*this.events)}let e=0;for(;;){for(;e<this.events.length;)yield this.events[e],e++;if(this.finished){if(this.error)throw this.error;return}await new Promise(t=>{e<this.events.length||this.finished?t():this.waiters.push(t)})}}};function bL(e,t){switch(t.type){case"text-delta":return"text"===e.type?{...e,text:(e.text??"")+t.text}:e;case"reasoning-delta":return"thinking"===e.type?{...e,thinking:(e.thinking??"")+t.reasoning}:"reasoning"===e.type?{...e,reasoning:(e.reasoning??"")+t.reasoning}:e;case"data-delta":return{...e,data:(e.data??"")+t.data};case"block-delta":return{...e,...t.fields};default:throw new Error(`Unknown delta type: ${JSON.stringify(t)}`)}}function TL(e){if("content-block-delta"!==e.event)return;if("delta"in e&&e.delta)return e.delta;const t=e.content;if(null==t||"object"!=typeof t)return;const n=t;return"text"===n.type&&"string"==typeof n.text?{type:"text-delta",text:n.text}:"reasoning"===n.type&&"string"==typeof n.reasoning?{type:"reasoning-delta",reasoning:n.reasoning}:"thinking"===n.type&&"string"==typeof n.thinking?{type:"reasoning-delta",reasoning:n.thinking}:"string"==typeof n.data?{type:"data-delta",data:n.data,encoding:"base64"}:"string"==typeof n.type?{type:"block-delta",fields:{...n,type:n.type}}:void 0}function vL(e){if(null==e||"object"!=typeof e)return;const t=e;return"reasoning"===t.type&&"string"==typeof t.reasoning?t.reasoning:"thinking"===t.type&&"string"==typeof t.thinking?t.thinking:void 0}function _L(e){if(null==e||"object"!=typeof e)return!1;const t=e.type;return"reasoning"===t||"thinking"===t}function wL(e){if(e)return{...e,input_tokens:e.input_tokens??0,output_tokens:e.output_tokens??0,total_tokens:e.total_tokens??0}}function EL(e){if(null!=e&&"object"==typeof e&&!Array.isArray(e))return e;if("string"!=typeof e||0===e.length)return{};try{const t=JSON.parse(e);return null==t||"object"!=typeof t||Array.isArray(t)?{}:t}catch{return{}}}function PL(e){const t=e;if("tool_call"===e.type)return e;if("tool_call_chunk"!==e.type&&"tool_use"!==e.type&&"input_json_delta"!==e.type)return e;const n="string"==typeof t.name?t.name:void 0;if(null==n)return e;const r=t.args??t.input;return{...t,type:"tool_call",name:n,args:EL(r)}}var RL=class{_buffer;constructor(e){this._buffer=e}get full(){const e=this._buffer;return{async*[Symbol.asyncIterator](){let t="";for await(const n of e.iterate()){const e=TL(n);"text-delta"===e?.type&&(t+=e.text,yield t)}}}}[Symbol.asyncIterator](){const e=this._buffer;return async function*(){for await(const t of e.iterate()){const e=TL(t);"text-delta"===e?.type&&(yield e.text)}}()}then(e,t){return(async()=>{let e="";for await(const t of this)e+=t;return e})().then(e,t)}},LL=class{_buffer;constructor(e){this._buffer=e}get full(){const e=this._buffer;return{async*[Symbol.asyncIterator](){const t=[];for await(const n of e.iterate())"content-block-finish"===n.event&&"tool_call"===n.content.type&&(t.push(n.content),yield[...t])}}}[Symbol.asyncIterator](){const e=this._buffer;return async function*(){for await(const t of e.iterate())"content-block-finish"===t.event&&"tool_call"===t.content.type&&(yield t.content)}()}then(e,t){return(async()=>{const e=[];for await(const t of this)e.push(t);return e})().then(e,t)}},NL=class{_buffer;constructor(e){this._buffer=e}get full(){const e=this._buffer;return{async*[Symbol.asyncIterator](){let t="",n=!1;for await(const r of e.iterate())if("content-block-start"===r.event){if(!_L(r.content)){if(n)return;continue}n=!0;const e=vL(r.content);if(null==e||0===e.length)continue;t+=e,yield t}else if("content-block-delta"===r.event){const e=TL(r);if("reasoning-delta"!==e?.type)continue;n=!0;const i=e.reasoning;if(null==i||0===i.length)continue;t+=i,yield t}else{if("content-block-finish"===r.event&&_L(r.content))return;if("message-finish"===r.event)return}}}}[Symbol.asyncIterator](){const e=this._buffer;return async function*(){let t=!1;for await(const n of e.iterate())if("content-block-start"===n.event){if(!_L(n.content)){if(t)return;continue}t=!0;const e=vL(n.content);null!=e&&e.length>0&&(yield e)}else if("content-block-delta"===n.event){const e=TL(n);if("reasoning-delta"!==e?.type)continue;t=!0;const r=e.reasoning;null!=r&&r.length>0&&(yield r)}else{if("content-block-finish"===n.event&&_L(n.content))return;if("message-finish"===n.event)return}}()}then(e,t){return(async()=>{let e="";for await(const t of this)e+=t;return e})().then(e,t)}},OL=class{_buffer;constructor(e){this._buffer=e}[Symbol.asyncIterator](){const e=this._buffer;return async function*(){for await(const t of e.iterate())if("usage"===t.event){const e=wL(t.usage);e&&(yield e)}else if("message-start"===t.event&&t.usage){const e=wL(t.usage);e&&(yield e)}else if("message-finish"===t.event&&t.usage){const e=wL(t.usage);e&&(yield e)}}()}then(e,t){return(async()=>{let e;for await(const t of this)e=t;return e})().then(e,t)}},BL=class{_buffer;constructor(e){this._buffer=new SL,this._consume(e)}async _consume(e){try{for await(const t of e)this._buffer.push(t);this._buffer.finish()}catch(t){this._buffer.setError(t instanceof Error?t:new Error(String(t)))}}[Symbol.asyncIterator](){return this._buffer.iterate()}get text(){return new RL(this._buffer)}get toolCalls(){return new LL(this._buffer)}get reasoning(){return new NL(this._buffer)}get usage(){return new OL(this._buffer)}get output(){return this._assembleMessage()}then(e,t){return this._assembleMessage().then(e,t)}async _assembleMessage(){const e=[];let t,n,r,i={};for await(const o of this._buffer.iterate())switch(o.event){case"message-start":t=o.id??t,o.usage&&(n=wL(o.usage));break;case"content-block-start":case"content-block-finish":e[o.index]=o.content;break;case"content-block-delta":{const t=e[o.index],n=TL(o);t&&n&&(e[o.index]=bL(t,n));break}case"usage":n=wL(o.usage);break;case"message-finish":r=o.reason,o.usage&&(n=wL(o.usage)),o.responseMetadata&&(i={...i,...o.responseMetadata})}const a=e.filter(e=>null!=e).map(PL);return new YA({id:t,content:a,usage_metadata:n,response_metadata:{...i,...r?{finish_reason:r}:{},output_version:"v1"}})}};function ML(e){const t=[];for(const n of e){let e=n;if(Array.isArray(n.content))for(let t=0;t<n.content.length;t++){const r=n.content[t];(rC(r)||iC(r))&&e===n&&(e=new n.constructor({...e,content:[...n.content.slice(0,t),aC(r),...n.content.slice(t+1)]}))}t.push(e)}return t}var DL=class e extends rL{lc_namespace=["langchain","chat_models",this._llmType()];disableStreaming=!1;outputVersion;get callKeys(){return[...super.callKeys,"outputVersion"]}constructor(e){super(e),this.outputVersion=(()=>{const t=e.outputVersion??mS("LC_OUTPUT_VERSION");return t&&["v0","v1"].includes(t)?t:"v0"})()}_separateRunnableConfigFromCallOptionsCompat(e){const[t,n]=super._separateRunnableConfigFromCallOptions(e);return n.signal=t.signal,[t,n]}async invoke(t,n){const r=e._convertInputToPromptValue(t);return(await this.generatePrompt([r],n,n?.callbacks)).generations[0][0].message}async*_streamResponseChunks(e,t,n){throw new Error("Not implemented.")}async*_streamChatModelEvents(e,t,n){const r=this._streamResponseChunks(e,t,n);yield*async function*(e,t){const n=new Map;let r,i,a=!1;const o=new Set;for await(const s of e){t?.signal?.throwIfAborted();const e=s.message;let c=!1;if(!a){a=!0;const t={event:"message-start",id:e.id??void 0};JA.isInstance(e)&&e.usage_metadata&&(t.usage=e.usage_metadata,r={...e.usage_metadata},c=!0),yield t}const l=e.content;if("string"==typeof l){if(""!==l){const e=0;if(!n.has(e)){const t={type:"text",text:""};n.set(e,{type:"text",accumulated:t}),yield{event:"content-block-start",index:e,content:t}}const t=n.get(e);t.accumulated={...t.accumulated,text:(t.accumulated.text??"")+l},yield{event:"content-block-delta",index:e,delta:{type:"text-delta",text:l}}}}else if(Array.isArray(l))for(const t of l){const e="number"==typeof t.index?t.index:n.size;if(n.has(e)){const r=n.get(e),i=aS(t);r.accumulated=iS(r.accumulated,i),yield{event:"content-block-delta",index:e,delta:i}}else n.set(e,{type:t.type,accumulated:{...t}}),yield{event:"content-block-start",index:e,content:{...t}}}if(JA.isInstance(e)&&e.tool_call_chunks&&e.tool_call_chunks.length>0)for(const t of e.tool_call_chunks){const e="number"==typeof t.index?t.index:n.size;if(!n.has(e)){const r={type:"tool_call_chunk",id:t.id,name:t.name,args:"",index:e};n.set(e,{type:"tool_call_chunk",accumulated:r}),yield{event:"content-block-start",index:e,content:r}}const r=n.get(e).accumulated;null!=t.id&&(r.id=t.id),null!=t.name&&(r.name=t.name),r.args=(r.args??"")+(t.args??""),yield{event:"content-block-delta",index:e,delta:{type:"block-delta",fields:{type:"tool_call_chunk",..."id"in r&&null!=r.id?{id:r.id}:{},..."name"in r&&null!=r.name?{name:r.name}:{},args:r.args}}}}const u=rS(e);if(null!=u){if(null==i){const e=eS(n);i={index:e,id:u.id,mimeType:u.mimeType,transcript:""};const t={type:"audio",...null!=u.id?{id:u.id}:{},...null!=u.url?{url:u.url}:{},data:"",mimeType:u.mimeType};n.set(e,{type:"audio",accumulated:t}),yield{event:"content-block-start",index:e,content:t}}const e=n.get(i.index);if(null!=e){const t=e.accumulated;null!=u.id&&null==i.id&&(i.id=u.id,t.id=u.id),null!=u.transcript&&(i.transcript+=u.transcript,t.transcript=i.transcript,yield{event:"content-block-delta",index:i.index,delta:{type:"block-delta",fields:{type:"audio",transcript:i.transcript}}}),null!=u.data&&u.data.length>0&&(t.data=(t.data??"")+u.data,yield{event:"content-block-delta",index:i.index,delta:{type:"data-delta",data:u.data,encoding:"base64"}})}}for(const t of nS(e)){const e=t,r=e.id??e.url??(null!=e.data?`${e.data.length}:${e.data.slice(0,32)}`:void 0);if(null!=r&&o.has(r))continue;null!=r&&o.add(r);const i=eS(n);n.set(i,{type:"image",accumulated:t}),yield{event:"content-block-start",index:i,content:t}}if(!c&&JA.isInstance(e)&&e.usage_metadata){const t=e.usage_metadata;r=r?{input_tokens:r.input_tokens+t.input_tokens,output_tokens:r.output_tokens+t.output_tokens,total_tokens:r.total_tokens+t.total_tokens}:{...t},yield{event:"usage",usage:{...r}}}}for(const[s,c]of n)yield{event:"content-block-finish",index:s,content:oS(c.accumulated)};yield{event:"message-finish",reason:"stop",...r?{usage:r}:{}}}(r,{signal:t.signal})}streamEvents(t,n,r){if("v1"===n?.version||"v2"===n?.version)return super.streamEvents(t,n,r);const i=e._convertInputToPromptValue(t).toChatMessages(),[,a]=this._separateRunnableConfigFromCallOptionsCompat(n),o=this._streamChatModelEvents(i,a);return new BL(o)}streamV2(e,t){return this.streamEvents(e,t)}async*_streamIterator(t,n){if(this._streamResponseChunks===e.prototype._streamResponseChunks||this.disableStreaming)yield this.invoke(t,n);else{const i=e._convertInputToPromptValue(t).toChatMessages(),[a,o]=this._separateRunnableConfigFromCallOptionsCompat(n),s={...a.metadata,...this.getLsParamsWithDefaults(o)},c=this._getInvocationParamsForTracing(o),l=await VE.configure(a.callbacks,this.callbacks,a.tags,this.tags,s,this.metadata,{verbose:this.verbose,tracerInheritableMetadata:this._filterInvocationParamsForTracing(c)}),u={options:this._getCallOptionsForTracing(o,c),invocation_params:c,batch_size:1},d=o.outputVersion??this.outputVersion,p=await(l?.handleChatModelStart(this.toJSON(),[ML(i)],a.runId,void 0,u,void 0,void 0,a.runName));let h,f;try{for await(const e of this._streamResponseChunks(i,o,p?.[0])){if(o.signal?.throwIfAborted(),null==e.message.id){const t=p?.at(0)?.runId;null!=t&&e.message._updateId(`run-${t}`)}e.message.response_metadata={...e.generationInfo,...e.message.response_metadata},"v1"===d?yield iL(e.message):yield e.message,h=h?h.concat(e):e,QA(e.message)&&void 0!==e.message.usage_metadata&&(f={tokenUsage:{promptTokens:e.message.usage_metadata.input_tokens,completionTokens:e.message.usage_metadata.output_tokens,totalTokens:e.message.usage_metadata.total_tokens}})}o.signal?.throwIfAborted()}catch(r){throw await Promise.all((p??[]).map(e=>e?.handleLLMError(r))),r}await Promise.all((p??[]).map(e=>e?.handleLLMEnd({generations:[[h]],llmOutput:f})))}}getLsParams(e){const t=this.getName().startsWith("Chat")?this.getName().replace("Chat",""):this.getName();return{ls_model_type:"chat",ls_stop:e.stop,ls_provider:t}}getLsParamsWithDefaults(e){return{...this.getLsParams(e),ls_integration:"langchain_chat_model"}}async _generateUncached(t,n,r,i){const a=t.map(e=>e.map($A));let o;if(void 0!==i&&i.length===a.length)o=i;else{const e={...r.metadata,...this.getLsParamsWithDefaults(n)},t=this._getInvocationParamsForTracing(n),i=await VE.configure(r.callbacks,this.callbacks,r.tags,this.tags,e,this.metadata,{verbose:this.verbose,tracerInheritableMetadata:this._filterInvocationParamsForTracing(t)}),s={options:this._getCallOptionsForTracing(n,t),invocation_params:t,batch_size:1};o=await(i?.handleChatModelStart(this.toJSON(),a.map(ML),r.runId,void 0,s,void 0,void 0,r.runName))}const s=n.outputVersion??this.outputVersion,c=[],l=[],u=!!o?.[0].handlers.find(PS),d=!!o?.[0].handlers.find(ES);if(!u||this.disableStreaming||1!==a.length||this._streamChatModelEvents===e.prototype._streamChatModelEvents&&this._streamResponseChunks===e.prototype._streamResponseChunks)if(d&&!this.disableStreaming&&1===a.length&&this._streamResponseChunks!==e.prototype._streamResponseChunks)try{const e=await this._streamResponseChunks(a[0],n,o?.[0]);let t,r;for await(const i of e){if(n.signal?.aborted){const e=t?.message;throw new wA("Model invocation was aborted.",e)}if(null==i.message.id){const e=o?.at(0)?.runId;null!=e&&i.message._updateId(`run-${e}`)}t=void 0===t?i:aP(t,i),QA(i.message)&&void 0!==i.message.usage_metadata&&(r={tokenUsage:{promptTokens:i.message.usage_metadata.input_tokens,completionTokens:i.message.usage_metadata.output_tokens,totalTokens:i.message.usage_metadata.total_tokens}})}if(n.signal?.aborted){const e=t?.message;throw new wA("Model invocation was aborted.",e)}if(void 0===t)throw new Error("Received empty response from chat model call.");"v1"===s&&(t.message=iL(t.message)),c.push([t]),await(o?.[0].handleLLMEnd({generations:c,llmOutput:r}))}catch(h){throw await(o?.[0].handleLLMError(h)),h}else{const e=await Promise.allSettled(a.map(async(e,t)=>{const r=await this._generate(e,{...n,promptIndex:t},o?.[t]);if("v1"===s)for(const n of r.generations)n.message=iL(n.message);return r}));await Promise.all(e.map(async(e,t)=>{if("fulfilled"===e.status){const n=e.value;for(const e of n.generations){if(null==e.message.id){const t=o?.at(0)?.runId;null!=t&&e.message._updateId(`run-${t}`)}e.message.response_metadata={...e.generationInfo,...e.message.response_metadata}}return 1===n.generations.length&&(n.generations[0].message.response_metadata={...n.llmOutput,...n.generations[0].message.response_metadata}),c[t]=n.generations,l[t]=n.llmOutput,o?.[t]?.handleLLMEnd({generations:[n.generations],llmOutput:n.llmOutput})}return await(o?.[t]?.handleLLMError(e.reason)),Promise.reject(e.reason)}))}else try{let e=!1;const t=o?.[0],r=this._streamChatModelEvents(a[0],n),i=await new BL({async*[Symbol.asyncIterator](){for await(const i of r){n.signal?.throwIfAborted(),e=!0;const r="message-start"===i.event&&null==i.id&&null!=t?.runId?{...i,id:`run-${t.runId}`}:i;await(t?.handleChatModelStreamEvent(r)),yield r}}});if(n.signal?.throwIfAborted(),!e)throw new Error("Received empty response from chat model call.");if(null==i.id){const e=o?.at(0)?.runId;null!=e&&i._updateId(`run-${e}`)}const s={text:i.text,message:i};c.push([s]);const l=void 0!==i.usage_metadata?{tokenUsage:{promptTokens:i.usage_metadata.input_tokens,completionTokens:i.usage_metadata.output_tokens,totalTokens:i.usage_metadata.total_tokens}}:void 0;await(o?.[0].handleLLMEnd({generations:c,llmOutput:l}))}catch(h){throw await(o?.[0].handleLLMError(h)),h}const p={generations:c,llmOutput:l.length?this._combineLLMOutput?.(...l):void 0};return Object.defineProperty(p,sP,{value:o?{runIds:o?.map(e=>e.runId)}:void 0,configurable:!0}),p}async _generateCached({messages:t,cache:n,llmStringKey:r,parsedOptions:i,handledOptions:a}){const o=t.map(e=>e.map($A)),s={...a.metadata,...this.getLsParamsWithDefaults(i)},c=this._getInvocationParamsForTracing(i),l=await VE.configure(a.callbacks,this.callbacks,a.tags,this.tags,s,this.metadata,{verbose:this.verbose,tracerInheritableMetadata:this._filterInvocationParamsForTracing(c)}),u={options:this._getCallOptionsForTracing(i,c),invocation_params:c,batch_size:1},d=await(l?.handleChatModelStart(this.toJSON(),o.map(ML),a.runId,void 0,u,void 0,void 0,a.runName)),p=[],h=(await Promise.allSettled(o.map(async(t,i)=>{const a=e._convertInputToPromptValue(t).toString(),o=await n.lookup(a,r);return null==o&&p.push(i),o}))).map((e,t)=>({result:e,runManager:d?.[t]})).filter(({result:e})=>"fulfilled"===e.status&&null!=e.value||"rejected"===e.status),f=i.outputVersion??this.outputVersion,m=[];await Promise.all(h.map(async({result:e,runManager:t},n)=>{if("fulfilled"===e.status){const r=e.value;return m[n]=r.map(e=>("message"in e&&$C(e.message)&&qA(e.message)&&(e.message.usage_metadata={input_tokens:0,output_tokens:0,total_tokens:0},"v1"===f&&(e.message=iL(e.message))),e.generationInfo={...e.generationInfo,tokenUsage:{}},e)),r.length&&await(t?.handleLLMNewToken(r[0].text)),t?.handleLLMEnd({generations:[r]},void 0,void 0,void 0,{cached:!0})}return await(t?.handleLLMError(e.reason,void 0,void 0,void 0,{cached:!0})),Promise.reject(e.reason)}));const g={generations:m,missingPromptIndices:p,startedRunManagers:d};return Object.defineProperty(g,sP,{value:d?{runIds:d?.map(e=>e.runId)}:void 0,configurable:!0}),g}async generate(t,n,r){let i;i=Array.isArray(n)?{stop:n}:n;const a=t.map(e=>e.map($A)),[o,s]=this._separateRunnableConfigFromCallOptionsCompat(i);if(o.callbacks=o.callbacks??r,!this.cache)return this._generateUncached(a,s,o);const{cache:c}=this,l=this._getSerializedCacheKeyParametersForCall(s),{generations:u,missingPromptIndices:d,startedRunManagers:p}=await this._generateCached({messages:a,cache:c,llmStringKey:l,parsedOptions:s,handledOptions:o});let h={};if(d.length>0){const t=await this._generateUncached(d.map(e=>a[e]),s,o,void 0!==p?d.map(e=>p?.[e]):void 0);await Promise.all(t.generations.map(async(t,n)=>{const r=d[n];u[r]=t;const i=e._convertInputToPromptValue(a[r]).toString();return c.update(i,l,t)})),h=t.llmOutput??{}}return{generations:u,llmOutput:h}}_getInvocationParamsForTracing(e){return this.invocationParams(e)}_getCallOptionsForTracing(e,t){return e}invocationParams(e){return{}}_modelType(){return"base_chat_model"}async generatePrompt(e,t,n){const r=e.map(e=>e.toChatMessages());return this.generate(r,t,n)}withStructuredOutput(e,t){if("function"!=typeof this.bindTools)throw new Error('Chat model must implement ".bindTools()" to use withStructuredOutput.');if(t?.strict)throw new Error('"strict" mode is not supported for this model by default.');const n=e,r=t?.name,i=Cg(n)??"A function available to call.",a=t?.method,o=t?.includeRaw;if("jsonMode"===a)throw new Error('Base withStructuredOutput implementation only supports "functionCalling" as a method.');let s=r??"extract";yg(n)||$I(n)||!("name"in n)||(s=n.name);const c=yg(n)||$I(n)?XI(n):n,l=[{type:"function",function:{name:s,description:i,parameters:c}}];return AL(this.bindTools(l),RR.from(e=>{if(!JA.isInstance(e))throw new Error("Input is not an AIMessageChunk.");if(!e.tool_calls||0===e.tool_calls.length)throw new Error("No tool calls found in the response.");const t=e.tool_calls.find(e=>e.name===s);if(!t)throw new Error(`No tool call found with name ${s}.`);return t.args}),o,o?"StructuredOutputRunnable":"StructuredOutput")}};function FL(e,t,n,r,i){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}function kL(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}let GL=function(){const{crypto:e}=globalThis;if(e?.randomUUID)return GL=e.randomUUID.bind(e),e.randomUUID();const t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>255*Math.random()&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^n()&15>>+e/4).toString(16))};function xL(e){return"object"==typeof e&&null!==e&&("name"in e&&"AbortError"===e.name||"message"in e&&String(e.message).includes("FetchRequestCanceledException"))}const HL=e=>{if(e instanceof Error)return e;if("object"==typeof e&&null!==e){try{if("[object Error]"===Object.prototype.toString.call(e)){const t=new Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return new Error(JSON.stringify(e))}catch{}}return new Error(e)};class UL extends Error{}class VL extends UL{constructor(e,t,n,r){super(`${VL.makeMessage(e,t,n)}`),this.status=e,this.headers=r,this.error=t}static makeMessage(e,t,n){const r=t?.message?"string"==typeof t.message?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||"(no status code or body)"}static generate(e,t,n,r){if(!e||!r)return new jL({message:n,cause:HL(t)});const i=t;return 400===e?new XL(e,i,n,r):401===e?new KL(e,i,n,r):403===e?new YL(e,i,n,r):404===e?new qL(e,i,n,r):409===e?new QL(e,i,n,r):422===e?new JL(e,i,n,r):429===e?new zL(e,i,n,r):e>=500?new ZL(e,i,n,r):new VL(e,i,n,r)}}class $L extends VL{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}}class jL extends VL{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0),t&&(this.cause=t)}}class WL extends jL{constructor({message:e}={}){super({message:e??"Request timed out."})}}class XL extends VL{}class KL extends VL{}class YL extends VL{}class qL extends VL{}class QL extends VL{}class JL extends VL{}class zL extends VL{}class ZL extends VL{}const eN=/^[a-z][a-z0-9+.-]*:/i;let tN=e=>(tN=Array.isArray,tN(e)),nN=tN;function rN(e){if(!e)return!0;for(const t in e)return!1;return!0}const iN="1.6.0";const aN=()=>{const e="undefined"!=typeof Deno&&null!=Deno.build?"deno":"undefined"!=typeof EdgeRuntime?"edge":"[object process]"===Object.prototype.toString.call(void 0!==globalThis.process?globalThis.process:0)?"node":"unknown";if("deno"===e)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":iN,"X-Stainless-OS":sN(Deno.build.os),"X-Stainless-Arch":oN(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":"string"==typeof Deno.version?Deno.version:Deno.version?.deno??"unknown"};if("undefined"!=typeof EdgeRuntime)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":iN,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if("node"===e)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":iN,"X-Stainless-OS":sN(globalThis.process.platform??"unknown"),"X-Stainless-Arch":oN(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};const t=function(){if("undefined"==typeof navigator||!navigator)return null;const e=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(const{key:t,pattern:n}of e){const e=n.exec(navigator.userAgent);if(e){return{browser:t,version:`${e[1]||0}.${e[2]||0}.${e[3]||0}`}}}return null}();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":iN,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":iN,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};const oN=e=>"x32"===e?"x32":"x86_64"===e||"x64"===e?"x64":"arm"===e?"arm":"aarch64"===e||"arm64"===e?"arm64":e?`other:${e}`:"unknown",sN=e=>(e=e.toLowerCase()).includes("ios")?"iOS":"android"===e?"Android":"darwin"===e?"MacOS":"win32"===e?"Windows":"freebsd"===e?"FreeBSD":"openbsd"===e?"OpenBSD":"linux"===e?"Linux":e?`Other:${e}`:"Unknown";let cN;function lN(...e){const t=globalThis.ReadableStream;if(void 0===t)throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function uN(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return lN({start(){},async pull(e){const{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await(t.return?.())}})}function dN(e){if(e[Symbol.asyncIterator])return e;const t=e.getReader();return{async next(){try{const e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){const e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}const pN=({headers:e,body:t})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(t)});const hN=()=>{if("undefined"==typeof File){const{process:e}=globalThis,t="string"==typeof e?.versions?.node&&parseInt(e.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(t?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function fN(e,t,n){return hN(),new File(e,t??"unknown_file",n)}function mN(e){return("object"==typeof e&&null!==e&&("name"in e&&e.name&&String(e.name)||"url"in e&&e.url&&String(e.url)||"filename"in e&&e.filename&&String(e.filename)||"path"in e&&e.path&&String(e.path))||"").split(/[\\/]/).pop()||void 0}const gN=e=>null!=e&&"object"==typeof e&&"function"==typeof e[Symbol.asyncIterator],yN=async(e,t)=>({...e,body:await CN(e.body,t)}),IN=new WeakMap;const CN=async(e,t)=>{if(!(await function(e){const t="function"==typeof e?e:e.fetch,n=IN.get(t);if(n)return n;const r=(async()=>{try{const e="Response"in t?t.Response:(await t("data:,")).constructor,n=new FormData;return n.toString()!==await new e(n).text()}catch{return!0}})();return IN.set(t,r),r}(t)))throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");const n=new FormData;return await Promise.all(Object.entries(e||{}).map(([e,t])=>AN(n,e,t))),n},AN=async(e,t,n)=>{if(void 0!==n){if(null==n)throw new TypeError(`Received null for "${t}"; to pass null in FormData, you must use the string 'null'`);if("string"==typeof n||"number"==typeof n||"boolean"==typeof n)e.append(t,String(n));else if(n instanceof Response)e.append(t,fN([await n.blob()],mN(n)));else if(gN(n))e.append(t,fN([await new Response(uN(n)).blob()],mN(n)));else if((e=>e instanceof Blob&&"name"in e)(n))e.append(t,n,mN(n));else if(Array.isArray(n))await Promise.all(n.map(n=>AN(e,t+"[]",n)));else{if("object"!=typeof n)throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${n} instead`);await Promise.all(Object.entries(n).map(([n,r])=>AN(e,`${t}[${n}]`,r)))}}},SN=e=>null!=e&&"object"==typeof e&&"number"==typeof e.size&&"string"==typeof e.type&&"function"==typeof e.text&&"function"==typeof e.slice&&"function"==typeof e.arrayBuffer;async function bN(e){let t=[];if("string"==typeof e||ArrayBuffer.isView(e)||e instanceof ArrayBuffer)t.push(e);else if(SN(e))t.push(e instanceof Blob?e:await e.arrayBuffer());else{if(!gN(e)){const t=e?.constructor?.name;throw new Error(`Unexpected data type: ${typeof e}${t?`; constructor: ${t}`:""}${function(e){if("object"!=typeof e||null===e)return"";const t=Object.getOwnPropertyNames(e);return`; props: [${t.map(e=>`"${e}"`).join(", ")}]`}(e)}`)}for await(const n of e)t.push(...await bN(n))}return t}class TN{constructor(e){this._client=e}}const vN=Symbol("brand.privateNullableHeaders");function*_N(e){if(!e)return;if(vN in e){const{values:t,nulls:n}=e;yield*t.entries();for(const e of n)yield[e,null];return}let t,n=!1;e instanceof Headers?t=e.entries():nN(e)?t=e:(n=!0,t=Object.entries(e??{}));for(let r of t){const e=r[0];if("string"!=typeof e)throw new TypeError("expected header name to be a string");const t=nN(r[1])?r[1]:[r[1]];let i=!1;for(const r of t)void 0!==r&&(n&&!i&&(i=!0,yield[e,null]),yield[e,r])}}const wN=e=>{const t=new Headers,n=new Set;for(const r of e){const e=new Set;for(const[i,a]of _N(r)){const r=i.toLowerCase();e.has(r)||(t.delete(i),e.add(r)),null===a?(t.delete(i),n.add(r)):(t.append(i,a),n.delete(r))}}return{[vN]:!0,values:t,nulls:n}};class EN extends TN{create(e,t){return this._client.post("/openai/v1/audio/speech",{body:e,...t,headers:wN([{Accept:"audio/wav"},t?.headers]),__binaryResponse:!0})}}class PN extends TN{create(e,t){return this._client.post("/openai/v1/audio/transcriptions",yN({body:e,...t},this._client))}}class RN extends TN{create(e,t){return this._client.post("/openai/v1/audio/translations",yN({body:e,...t},this._client))}}class LN extends TN{constructor(){super(...arguments),this.speech=new EN(this._client),this.transcriptions=new PN(this._client),this.translations=new RN(this._client)}}function NN(e){return e.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}LN.Speech=EN,LN.Transcriptions=PN,LN.Translations=RN;const ON=Object.freeze(Object.create(null)),BN=(e=NN)=>function(t,...n){if(1===t.length)return t[0];let r=!1;const i=[],a=t.reduce((t,a,o)=>{/[?#]/.test(a)&&(r=!0);const s=n[o];let c=(r?encodeURIComponent:e)(""+s);return o!==n.length&&(null==s||"object"==typeof s&&s.toString===Object.getPrototypeOf(Object.getPrototypeOf(s.hasOwnProperty??ON)??ON)?.toString)&&(c=s+"",i.push({start:t.length+a.length,length:c.length,error:`Value of type ${Object.prototype.toString.call(s).slice(8,-1)} is not a valid path parameter`})),t+a+(o===n.length?"":c)},""),o=a.split(/[?#]/,1)[0],s=new RegExp("(?<=^|\\/)(?:\\.|%2e){1,2}(?=\\/|$)","gi");let c;for(;null!==(c=s.exec(o));)i.push({start:c.index,length:c[0].length,error:`Value "${c[0]}" can't be safely passed as a path parameter`});if(i.sort((e,t)=>e.start-t.start),i.length>0){let e=0;const t=i.reduce((t,n)=>{const r=" ".repeat(n.start-e),i="^".repeat(n.length);return e=n.start+n.length,t+r+i},"");throw new UL(`Path parameters result in path with invalid segments:\n${i.map(e=>e.error).join("\n")}\n${a}\n${t}`)}return a},MN=BN(NN);class DN extends TN{create(e,t){return this._client.post("/openai/v1/batches",{body:e,...t})}retrieve(e,t){return this._client.get(MN`/openai/v1/batches/${e}`,t)}list(e){return this._client.get("/openai/v1/batches",e)}cancel(e,t){return this._client.post(MN`/openai/v1/batches/${e}/cancel`,t)}}let FN,kN,GN=class extends TN{create(e,t){return this._client.post("/openai/v1/chat/completions",{body:e,...t,stream:e.stream??!1})}};class xN extends TN{constructor(){super(...arguments),this.completions=new GN(this._client)}}xN.Completions=GN;class HN extends TN{}class UN extends TN{create(e,t){return this._client.post("/openai/v1/embeddings",{body:e,...t})}}class VN extends TN{create(e,t){return this._client.post("/openai/v1/files",yN({body:e,...t},this._client))}list(e){return this._client.get("/openai/v1/files",e)}delete(e,t){return this._client.delete(MN`/openai/v1/files/${e}`,t)}content(e,t){return this._client.get(MN`/openai/v1/files/${e}/content`,{...t,headers:wN([{Accept:"application/octet-stream"},t?.headers]),__binaryResponse:!0})}info(e,t){return this._client.get(MN`/openai/v1/files/${e}`,t)}}class $N extends TN{retrieve(e,t){return this._client.get(MN`/openai/v1/models/${e}`,t)}list(e){return this._client.get("/openai/v1/models",e)}delete(e,t){return this._client.delete(MN`/openai/v1/models/${e}`,t)}}function jN(e){let t;return(FN??(t=new globalThis.TextEncoder,FN=t.encode.bind(t)))(e)}function WN(e){let t;return(kN??(t=new globalThis.TextDecoder,kN=t.decode.bind(t)))(e)}var XN,KN;class YN{constructor(){XN.set(this,void 0),KN.set(this,void 0),FL(this,XN,new Uint8Array),FL(this,KN,null)}decode(e){if(null==e)return[];const t=e instanceof ArrayBuffer?new Uint8Array(e):"string"==typeof e?jN(e):e;FL(this,XN,function(e){let t=0;for(const i of e)t+=i.length;const n=new Uint8Array(t);let r=0;for(const i of e)n.set(i,r),r+=i.length;return n}([kL(this,XN,"f"),t]));const n=[];let r;for(;null!=(r=qN(kL(this,XN,"f"),kL(this,KN,"f")));){if(r.carriage&&null==kL(this,KN,"f")){FL(this,KN,r.index);continue}if(null!=kL(this,KN,"f")&&(r.index!==kL(this,KN,"f")+1||r.carriage)){n.push(WN(kL(this,XN,"f").subarray(0,kL(this,KN,"f")-1))),FL(this,XN,kL(this,XN,"f").subarray(kL(this,KN,"f"))),FL(this,KN,null);continue}const e=null!==kL(this,KN,"f")?r.preceding-1:r.preceding,t=WN(kL(this,XN,"f").subarray(0,e));n.push(t),FL(this,XN,kL(this,XN,"f").subarray(r.index)),FL(this,KN,null)}return n}flush(){return kL(this,XN,"f").length?this.decode("\n"):[]}}function qN(e,t){for(let n=t??0;n<e.length;n++){if(10===e[n])return{preceding:n,index:n+1,carriage:!1};if(13===e[n])return{preceding:n,index:n+1,carriage:!0}}return null}function QN(e){for(let t=0;t<e.length-1;t++){if(10===e[t]&&10===e[t+1])return t+2;if(13===e[t]&&13===e[t+1])return t+2;if(13===e[t]&&10===e[t+1]&&t+3<e.length&&13===e[t+2]&&10===e[t+3])return t+4}return-1}XN=new WeakMap,KN=new WeakMap,YN.NEWLINE_CHARS=new Set(["\n","\r"]),YN.NEWLINE_REGEXP=/\r\n|[\n\r]/g;const JN={off:0,error:200,warn:300,info:400,debug:500},zN=(e,t,n)=>{if(e)return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(JN,e)?e:void rO(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(JN))}`)};function ZN(){}function eO(e,t,n){return!t||JN[e]>JN[n]?ZN:t[e].bind(t)}const tO={error:ZN,warn:ZN,info:ZN,debug:ZN};let nO=new WeakMap;function rO(e){const t=e.logger,n=e.logLevel??"off";if(!t)return tO;const r=nO.get(t);if(r&&r[0]===n)return r[1];const i={error:eO("error",t,n),warn:eO("warn",t,n),info:eO("info",t,n),debug:eO("debug",t,n)};return nO.set(t,[n,i]),i}const iO=e=>(e.options&&(e.options={...e.options},delete e.options.headers),e.headers&&(e.headers=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([e,t])=>[e,"authorization"===e.toLowerCase()||"api-key"===e.toLowerCase()||"x-api-key"===e.toLowerCase()||"cookie"===e.toLowerCase()||"set-cookie"===e.toLowerCase()?"***":t]))),"retryOfRequestLogID"in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e);var aO,oO;class sO{constructor(e,t,n){this.iterator=e,aO.set(this,void 0),this.controller=t,FL(this,aO,n)}static fromSSEResponse(e,t,n){let r=!1;const i=n?rO(n):console;return new sO(async function*(){if(r)throw new UL("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");r=!0;let n=!1;try{for await(const r of async function*(e,t){if(!e.body){if(t.abort(),void 0!==globalThis.navigator&&"ReactNative"===globalThis.navigator.product)throw new UL("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new UL("Attempted to iterate over a response with no body")}const n=new cO,r=new YN,i=dN(e.body);for await(const a of async function*(e){let t=new Uint8Array;for await(const n of e){if(null==n)continue;const e=n instanceof ArrayBuffer?new Uint8Array(n):"string"==typeof n?jN(n):n;let r,i=new Uint8Array(t.length+e.length);for(i.set(t),i.set(e,t.length),t=i;-1!==(r=QN(t));)yield t.slice(0,r),t=t.slice(r)}t.length>0&&(yield t)}(i))for(const e of r.decode(a)){const t=n.decode(e);t&&(yield t)}for(const a of r.flush()){const e=n.decode(a);e&&(yield e)}}(e,t))if(!n)if(r.data.startsWith("[DONE]"))n=!0;else if(null!==r.event&&r.event.startsWith("thread.")){let e;try{e=JSON.parse(r.data)}catch(a){throw console.error("Could not parse message into JSON:",r.data),console.error("From chunk:",r.raw),a}if("error"==r.event)throw new VL(void 0,e.error,e.message,void 0);yield{event:r.event,data:e}}else{let t;try{t=JSON.parse(r.data)}catch(a){throw i.error("Could not parse message into JSON:",r.data),i.error("From chunk:",r.raw),a}if(t&&t.error)throw new VL(void 0,t.error,void 0,e.headers);yield t}n=!0}catch(a){if(xL(a))return;throw a}finally{n||t.abort()}},t,n)}static fromReadableStream(e,t,n){let r=!1;return new sO(async function*(){if(r)throw new UL("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");r=!0;let n=!1;try{for await(const t of async function*(){const t=new YN,n=dN(e);for await(const e of n)for(const n of t.decode(e))yield n;for(const e of t.flush())yield e}())n||t&&(yield JSON.parse(t));n=!0}catch(i){if(xL(i))return;throw i}finally{n||t.abort()}},t,n)}[(aO=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){const e=[],t=[],n=this.iterator(),r=r=>({next:()=>{if(0===r.length){const r=n.next();e.push(r),t.push(r)}return r.shift()}});return[new sO(()=>r(e),this.controller,kL(this,aO,"f")),new sO(()=>r(t),this.controller,kL(this,aO,"f"))]}toReadableStream(){const e=this;let t;return lN({async start(){t=e[Symbol.asyncIterator]()},async pull(e){try{const{value:n,done:r}=await t.next();if(r)return e.close();const i=jN(JSON.stringify(n)+"\n");e.enqueue(i)}catch(n){e.error(n)}},async cancel(){await(t.return?.())}})}}class cO{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;const e={event:this.event,data:this.data.join("\n"),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],e}if(this.chunks.push(e),e.startsWith(":"))return null;let[t,n,r]=function(e,t){const n=e.indexOf(t);if(-1!==n)return[e.substring(0,n),t,e.substring(n+t.length)];return[e,"",""]}(e,":");return r.startsWith(" ")&&(r=r.substring(1)),"event"===t?this.event=r:"data"===t&&this.data.push(r),null}}async function lO(e,t){const{response:n,requestLogID:r,retryOfRequestLogID:i,startTime:a}=t,o=await(async()=>{if(204===n.status)return null;if(t.options.__binaryResponse)return n;if(t.options.stream)return sO.fromSSEResponse(n,t.controller,e);const r=n.headers.get("content-type"),i=r?.split(";")[0]?.trim();if(i?.includes("application/json")||i?.endsWith("+json")){if("0"===n.headers.get("content-length"))return;return await n.json()}return await n.text()})();return rO(e).debug(`[${r}] response parsed`,iO({retryOfRequestLogID:i,url:n.url,status:n.status,body:o,durationMs:Date.now()-a})),o}class uO extends Promise{constructor(e,t,n=lO){super(e=>{e(null)}),this.responsePromise=t,this.parseResponse=n,oO.set(this,void 0),FL(this,oO,e)}_thenUnwrap(e){return new uO(kL(this,oO,"f"),this.responsePromise,async(t,n)=>e(await this.parseResponse(t,n),n))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){const[e,t]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:t}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(kL(this,oO,"f"),e))),this.parsedPromise}then(e,t){return this.parse().then(e,t)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}}oO=new WeakMap;const dO=e=>void 0!==globalThis.process?globalThis.process.env?.[e]?.trim()||void 0:void 0!==globalThis.Deno&&globalThis.Deno.env?.get?.(e)?.trim()||void 0;var pO,hO,fO,mO;class gO{constructor({baseURL:e=dO("GROQ_BASE_URL"),apiKey:t=dO("GROQ_API_KEY"),...n}={}){if(pO.add(this),fO.set(this,void 0),this.completions=new HN(this),this.chat=new xN(this),this.embeddings=new UN(this),this.audio=new LN(this),this.models=new $N(this),this.batches=new DN(this),this.files=new VN(this),void 0===t)throw new UL("The GROQ_API_KEY environment variable is missing or empty; either provide it, or instantiate the Groq client with an apiKey option, like new Groq({ apiKey: 'My API Key' }).");const r={apiKey:t,...n,baseURL:e||"https://api.groq.com"};if(!r.dangerouslyAllowBrowser&&"undefined"!=typeof window&&void 0!==window.document&&"undefined"!=typeof navigator)throw new UL("It looks like you're running in a browser-like environment.\n\nThis is disabled by default, as it risks exposing your secret API credentials to attackers.\nIf you understand the risks and have appropriate mitigations in place,\nyou can set the `dangerouslyAllowBrowser` option to `true`, e.g.,\n\nnew Groq({ apiKey, dangerouslyAllowBrowser: true })");this.baseURL=r.baseURL,this.timeout=r.timeout??hO.DEFAULT_TIMEOUT,this.logger=r.logger??console;const i="warn";this.logLevel=i,this.logLevel=zN(r.logLevel,"ClientOptions.logLevel",this)??zN(dO("GROQ_LOG"),"process.env['GROQ_LOG']",this)??i,this.fetchOptions=r.fetchOptions,this.maxRetries=r.maxRetries??2,this.fetch=r.fetch??function(){if("undefined"!=typeof fetch)return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Groq({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}(),FL(this,fO,pN);const a=dO("GROQ_CUSTOM_HEADERS");if(a){const e={};for(const t of a.split("\n")){const n=t.indexOf(":");n>=0&&(e[t.substring(0,n).trim()]=t.substring(n+1).trim())}r.defaultHeaders={...e,...r.defaultHeaders}}this._options=r,this.apiKey=t}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){}async authHeaders(e){return wN([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(e){return function(e){return Object.entries(e).filter(([e,t])=>void 0!==t).map(([e,t])=>{if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(null===t)return`${encodeURIComponent(e)}=`;throw new UL(`Cannot stringify type ${typeof t}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}(e)}getUserAgent(){return`${this.constructor.name}/JS ${iN}`}defaultIdempotencyKey(){return`stainless-node-retry-${GL()}`}makeStatusError(e,t,n,r){return VL.generate(e,t,n,r)}buildURL(e,t,n){const r=!kL(this,pO,"m",mO).call(this)&&n||this.baseURL,i=(e=>eN.test(e))(e)?new URL(e):new URL(r+(r.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),a=this.defaultQuery(),o=Object.fromEntries(i.searchParams);return rN(a)&&rN(o)||(t={...o,...a,...t}),"object"==typeof t&&t&&!Array.isArray(t)&&(i.search=this.stringifyQuery(t)),i.toString()}async prepareOptions(e){}async prepareRequest(e,{url:t,options:n}){}get(e,t){return this.methodRequest("get",e,t)}post(e,t){return this.methodRequest("post",e,t)}patch(e,t){return this.methodRequest("patch",e,t)}put(e,t){return this.methodRequest("put",e,t)}delete(e,t){return this.methodRequest("delete",e,t)}methodRequest(e,t,n){return this.request(Promise.resolve(n).then(n=>({method:e,path:t,...n})))}request(e,t=null){return new uO(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,n){const r=await e,i=r.maxRetries??this.maxRetries;null==t&&(t=i),await this.prepareOptions(r);const{req:a,url:o,timeout:s}=await this.buildRequest(r,{retryCount:i-t});await this.prepareRequest(a,{url:o,options:r});const c="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),l=void 0===n?"":`, retryOf: ${n}`,u=Date.now();if(rO(this).debug(`[${c}] sending request`,iO({retryOfRequestLogID:n,method:r.method,url:o,options:r,headers:a.headers})),r.signal?.aborted)throw new $L;const d=new AbortController,p=await this.fetchWithTimeout(o,a,s,d).catch(HL),h=Date.now();if(p instanceof globalThis.Error){const e=`retrying, ${t} attempts remaining`;if(r.signal?.aborted)throw new $L;const i=xL(p)||/timed? ?out/i.test(String(p)+("cause"in p?String(p.cause):""));if(t)return rO(this).info(`[${c}] connection ${i?"timed out":"failed"} - ${e}`),rO(this).debug(`[${c}] connection ${i?"timed out":"failed"} (${e})`,iO({retryOfRequestLogID:n,url:o,durationMs:h-u,message:p.message})),this.retryRequest(r,t,n??c);if(rO(this).info(`[${c}] connection ${i?"timed out":"failed"} - error; no more retries left`),rO(this).debug(`[${c}] connection ${i?"timed out":"failed"} (error; no more retries left)`,iO({retryOfRequestLogID:n,url:o,durationMs:h-u,message:p.message})),i)throw new WL;throw new jL({cause:p})}const f=`[${c}${l}] ${a.method} ${o} ${p.ok?"succeeded":"failed"} with status ${p.status} in ${h-u}ms`;if(!p.ok){const e=await this.shouldRetry(p);if(t&&e){const e=`retrying, ${t} attempts remaining`;return await async function(e){if(null===e||"object"!=typeof e)return;if(e[Symbol.asyncIterator])return void(await(e[Symbol.asyncIterator]().return?.()));const t=e.getReader(),n=t.cancel();t.releaseLock(),await n}(p.body),rO(this).info(`${f} - ${e}`),rO(this).debug(`[${c}] response error (${e})`,iO({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:h-u})),this.retryRequest(r,t,n??c,p.headers)}const i=e?"error; no more retries left":"error; not retryable";rO(this).info(`${f} - ${i}`);const a=await p.text().catch(e=>HL(e).message),o=(e=>{try{return JSON.parse(e)}catch(t){return}})(a),s=o?void 0:a;rO(this).debug(`[${c}] response error (${i})`,iO({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,message:s,durationMs:Date.now()-u}));throw this.makeStatusError(p.status,o,s,p.headers)}return rO(this).info(f),rO(this).debug(`[${c}] response start`,iO({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:h-u})),{response:p,options:r,controller:d,requestLogID:c,retryOfRequestLogID:n,startTime:u}}async fetchWithTimeout(e,t,n,r){const{signal:i,method:a,...o}=t||{},s=this._makeAbort(r);i&&i.addEventListener("abort",s,{once:!0});const c=setTimeout(s,n),l=globalThis.ReadableStream&&o.body instanceof globalThis.ReadableStream||"object"==typeof o.body&&null!==o.body&&Symbol.asyncIterator in o.body,u={signal:r.signal,...l?{duplex:"half"}:{},method:"GET",...o};a&&(u.method=a.toUpperCase());try{return await this.fetch.call(void 0,e,u)}finally{clearTimeout(c)}}async shouldRetry(e){const t=e.headers.get("x-should-retry");return"true"===t||"false"!==t&&(408===e.status||(409===e.status||(429===e.status||e.status>=500)))}async retryRequest(e,t,n,r){let i;const a=r?.get("retry-after-ms");if(a){const e=parseFloat(a);Number.isNaN(e)||(i=e)}const o=r?.get("retry-after");if(o&&!i){const e=parseFloat(o);i=Number.isNaN(e)?Date.parse(o)-Date.now():1e3*e}if(void 0===i){const n=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(t,n)}var s;return await(s=i,new Promise(e=>setTimeout(e,s))),this.makeRequest(e,t-1,n)}calculateDefaultRetryTimeoutMillis(e,t){const n=t-e;return Math.min(.5*Math.pow(2,n),8)*(1-.25*Math.random())*1e3}async buildRequest(e,{retryCount:t=0}={}){const n={...e},{method:r,path:i,query:a,defaultBaseURL:o}=n,s=this.buildURL(i,a,o);"timeout"in n&&((e,t)=>{if("number"!=typeof t||!Number.isInteger(t))throw new UL(`${e} must be an integer`);if(t<0)throw new UL(`${e} must be a positive integer`)})("timeout",n.timeout),n.timeout=n.timeout??this.timeout;const{bodyHeaders:c,body:l}=this.buildBody({options:n});return{req:{method:r,headers:await this.buildHeaders({options:e,method:r,bodyHeaders:c,retryCount:t}),...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&l instanceof globalThis.ReadableStream&&{duplex:"half"},...l&&{body:l},...this.fetchOptions??{},...n.fetchOptions??{}},url:s,timeout:n.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:n,retryCount:r}){let i={};this.idempotencyHeader&&"get"!==t&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);const a=wN([i,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(r),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...cN??(cN=aN())},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(a),a.values}_makeAbort(e){return()=>e.abort()}buildBody({options:e}){const{body:t,headers:n}=e;if(!t)return null==t&&"body"in e?kL(this,fO,"f").call(this,{body:t,headers:wN([n])}):{bodyHeaders:void 0,body:void 0};const r=wN([n]);return ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof DataView||"string"==typeof t&&r.values.has("content-type")||globalThis.Blob&&t instanceof globalThis.Blob||t instanceof FormData||t instanceof URLSearchParams||globalThis.ReadableStream&&t instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:t}:"object"==typeof t&&(Symbol.asyncIterator in t||Symbol.iterator in t&&"next"in t&&"function"==typeof t.next)?{bodyHeaders:void 0,body:uN(t)}:"object"==typeof t&&"application/x-www-form-urlencoded"===r.values.get("content-type")?{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(t)}:kL(this,fO,"f").call(this,{body:t,headers:r})}}function yO(e){return function(e){return!!e&&"object"==typeof e&&"name"in e&&"schema"in e&&(yg(e.schema)||null!=e.schema&&"object"==typeof e.schema&&"type"in e.schema&&"string"==typeof e.schema.type&&["null","boolean","object","array","number","string"].includes(e.schema.type))}(e)||function(e){return void 0!==e&&TR.isRunnable(e)&&"lc_name"in e.constructor&&"function"==typeof e.constructor.lc_name&&"RunnableToolLike"===e.constructor.lc_name()}(e)||function(e){return void 0!==e&&Array.isArray(e.lc_namespace)}(e)}function IO(e,t){return{name:e.name,description:e.description,parameters:XI(e.schema)}}function CO(e,t){let n;return n=yO(e)?{type:"function",function:IO(e)}:e,n}hO=gO,fO=new WeakMap,pO=new WeakSet,mO=function(){return"https://api.groq.com"!==this.baseURL},gO.Groq=hO,gO.DEFAULT_TIMEOUT=6e4,gO.GroqError=UL,gO.APIError=VL,gO.APIConnectionError=jL,gO.APIConnectionTimeoutError=WL,gO.APIUserAbortError=$L,gO.NotFoundError=qL,gO.ConflictError=QL,gO.RateLimitError=zL,gO.BadRequestError=XL,gO.AuthenticationError=KL,gO.InternalServerError=ZL,gO.PermissionDeniedError=YL,gO.UnprocessableEntityError=JL,gO.toFile=async function(e,t,n){if(hN(),(e=>null!=e&&"object"==typeof e&&"string"==typeof e.name&&"number"==typeof e.lastModified&&SN(e))(e=await e))return e instanceof File?e:fN([await e.arrayBuffer()],e.name);if((e=>null!=e&&"object"==typeof e&&"string"==typeof e.url&&"function"==typeof e.blob)(e)){const r=await e.blob();return t||(t=new URL(e.url).pathname.split(/[\\/]/).pop()),fN(await bN(r),t,n)}const r=await bN(e);if(t||(t=mN(e)),!n?.type){const e=r.find(e=>"object"==typeof e&&"type"in e&&e.type);"string"==typeof e&&(n={...n,type:e})}return fN(r,t,n)},gO.Completions=HN,gO.Chat=xN,gO.Embeddings=UN,gO.Audio=LN,gO.Models=$N,gO.Batches=DN,gO.Files=VN;const AO=["frequency_penalty","function_call","functions","logit_bias","logprobs","max_completion_tokens","max_tokens","n","parallel_tool_calls","presence_penalty","reasoning_effort","reasoning_format","response_format","seed","service_tier","stop","temperature","tool_choice","top_logprobs","top_p","headers","promptIndex","stream_options","tools"];function SO(e){switch(e.type){case"system":return"system";case"ai":return"assistant";case"human":return"user";case"function":return"function";case"tool":return"tool";case"generic":if(!OA.isInstance(e))throw new Error("Invalid generic chat message");return function(e){if("system"!==e.role&&"assistant"!==e.role&&"user"!==e.role&&"function"!==e.role)throw new Error(`Unsupported message role: ${e.role}. Expected "system", "assistant", "user", or "function"`);return e.role}(e);default:throw new Error(`Unknown message type: ${e.type}`)}}function bO(e){return e.map(e=>{const t={role:SO(e),content:e.content,name:e.name,function_call:e.additional_kwargs.function_call,tool_calls:e.additional_kwargs.tool_calls,tool_call_id:e.tool_call_id};return qA(e)&&e.tool_calls?.length?t.tool_calls=e.tool_calls.map(mL):(null!=e.additional_kwargs.tool_calls&&(t.tool_calls=e.additional_kwargs.tool_calls),null!=e.tool_call_id&&(t.tool_call_id=e.tool_call_id)),t})}function TO(e,t,n){const r=e.tool_calls,i={...n,model_provider:"groq"};if("assistant"===e.role){const n=[],o=[];for(const e of r??[])try{n.push(fL(e,{returnId:!0}))}catch(a){o.push(gL(e,a.message))}return new YA({content:e.content||"",additional_kwargs:{tool_calls:r},tool_calls:n,invalid_tool_calls:o,usage_metadata:t,response_metadata:i})}return new OA(e.content||"",e.role??"unknown")}function vO(e,t,n,r){const i=e.role??t,a=e.content??"";let o,s;o=e.function_call?{function_call:e.function_call}:e.tool_calls?{tool_calls:e.tool_calls}:{},e.audio&&(o.audio={...e.audio,index:n.choices[0].index});let c,l=r;const u=n.x_groq;u?.usage&&(s={input_tokens:u.usage.prompt_tokens,output_tokens:u.usage.completion_tokens,total_tokens:u.usage.total_tokens},c={completion_time:u.usage.completion_time,prompt_time:u.usage.prompt_time,queue_time:u.usage.queue_time,total_time:u.usage.total_time}),u?.id&&(l=u.id);const d={usage:s,timing:c,model_provider:"groq"};if("user"===i)return new FA({content:a,response_metadata:d});if("assistant"===i){const t=[];if(Array.isArray(e.tool_calls))for(const n of e.tool_calls)t.push({name:n.function?.name,args:n.function?.arguments,id:n.id,index:n.index,type:"tool_call_chunk"});return new JA({content:a,tool_call_chunks:t,additional_kwargs:o,id:l,response_metadata:d})}return"system"===i?new xA({content:a,response_metadata:d}):"developer"===i?new xA({content:a,response_metadata:d,additional_kwargs:{__openai_role__:"developer"}}):"function"===i?new MA({content:a,additional_kwargs:o,name:e.name,response_metadata:d}):"tool"===i?new CA({content:a,additional_kwargs:o,tool_call_id:e.tool_call_id,response_metadata:d}):new BA({content:a,role:i,response_metadata:d})}var _O=class extends DL{lc_namespace=["langchain","chat_models","groq"];client;model;temperature=.7;stop;stopSequences;maxTokens;streaming=!1;apiKey;streamUsage=!0;topP;frequencyPenalty;presencePenalty;logprobs;n;logitBias;user;reasoningEffort;reasoningFormat;serviceTier;topLogprobs;lc_serializable=!0;get lc_serialized_keys(){return["client","model","temperature","stop","stopSequences","maxTokens","streaming","apiKey","streamUsage","topP","frequencyPenalty","presencePenalty","logprobs","n","logitBias","user","reasoningEffort","reasoningFormat","serviceTier","topLogprobs"]}static lc_name(){return"ChatGroq"}_llmType(){return"groq"}get lc_secrets(){return{apiKey:"GROQ_API_KEY"}}get callKeys(){return[...super.callKeys,...AO]}constructor(e,t){const n="string"==typeof e?{...t??{},model:e}:e??{};super(n),this._addVersion("@langchain/groq","1.3.1");const r=n.apiKey||mS("GROQ_API_KEY");if(!r)throw new Error('Groq API key not found. Please set the GROQ_API_KEY environment variable or provide the key into "apiKey"');const i={"User-Agent":"langchainjs",...n.defaultHeaders??{}};this.client=new gO({apiKey:r,dangerouslyAllowBrowser:!0,baseURL:n.baseUrl,timeout:n.timeout,httpAgent:n.httpAgent,fetch:n.fetch,maxRetries:0,defaultHeaders:i,defaultQuery:n.defaultQuery}),this.apiKey=r,this.temperature=n.temperature??this.temperature,this.model=n.model,this.streaming=n.streaming??this.streaming,this.stop=n.stopSequences??("string"==typeof n.stop?[n.stop]:n.stop)??[],this.stopSequences=this.stop,this.maxTokens=n.maxTokens,this.topP=n.topP,this.frequencyPenalty=n.frequencyPenalty,this.presencePenalty=n.presencePenalty,this.logprobs=n.logprobs,this.n=n.n,this.logitBias=n.logitBias,this.user=n.user,this.reasoningEffort=n.reasoningEffort}getLsParams(e){const t=this.invocationParams(e);return{ls_provider:"groq",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:t.temperature??this.temperature,ls_max_tokens:t.max_tokens??this.maxTokens,ls_stop:e.stop}}async completionWithRetry(e,t){return this.caller.call(async()=>this.client.chat.completions.create(e,t))}invocationParams(e,t){const n=super.invocationParams(e);let r={};void 0!==e?.stream_options?r={stream_options:e.stream_options}:(this.streamUsage&&this.streaming||t?.streaming)&&(r={stream_options:{include_usage:!0}});const i={model:this.model,frequency_penalty:this.frequencyPenalty,function_call:e?.function_call,functions:e?.functions,logit_bias:this.logitBias,logprobs:this.logprobs,n:this.n,parallel_tool_calls:e?.parallel_tool_calls,presence_penalty:this.presencePenalty,reasoning_effort:e?.reasoning_effort??this.reasoningEffort,reasoning_format:this.reasoningFormat,response_format:e?.response_format,seed:e?.seed,service_tier:this.serviceTier,stop:e?.stop??this.stopSequences,temperature:e?.temperature??this.temperature,tool_choice:wO(e?.tool_choice),tools:e?.tools?.length?e.tools.map(e=>CO(e)):void 0,top_logprobs:this.topLogprobs,top_p:this.topP,user:this.user,stream:this.streaming,...n,...r};return i.max_completion_tokens=e?.max_completion_tokens??e?.max_tokens??this.maxTokens,-1===i.max_completion_tokens&&delete i.max_completion_tokens,i}bindTools(e,t){return this.withConfig({tools:e.map(e=>CO(e)),...t})}async*_streamChatModelEvents(e,t,n){const r=this.invocationParams(t,{streaming:!0}),i=bO(e),a=await this.completionWithRetry({...r,messages:i,stream:!0},{signal:t?.signal,headers:t?.headers});yield*async function*(e,t={}){const n=t.streamUsage??!0,r=t.provider??"openai",i=t.mapChunk,a=new Map,o=new Map;let s,c,l,u=0,d=!1,p=!1;const h=(e,t)=>{const n=o.get(e);if(void 0!==n)return{index:n,isNew:!1};const r=u++;return o.set(e,r),a.set(r,{...t}),{index:r,isNew:!0}};for await(let f of e){i&&(f=i(f)),d||(d=!0,yield{event:"message-start",id:f.id}),p||!f.model&&!f.service_tier||(p=!0,yield{event:"provider",provider:r,name:"stream_metadata",payload:{model:f.model,service_tier:f.service_tier}}),f.usage&&n&&(s=uS(f.usage),yield{event:"usage",usage:s});const e=f.x_groq?.usage;e&&n&&(s=cS(e),yield{event:"usage",usage:s});const t=f.choices?.[0];if(!t)continue;null!=t.finish_reason&&(c=lS(t.finish_reason),l=dS(f,t));const{delta:o}=t;if(!o)continue;const u=sS(o);if(u){const{index:e,isNew:t}=h("reasoning",{type:"reasoning",reasoning:""});t&&(yield{event:"content-block-start",index:e,content:{type:"reasoning",reasoning:""}});const n=a.get(e);n.reasoning=(n.reasoning??"")+u,yield{event:"content-block-delta",index:e,delta:{type:"reasoning-delta",reasoning:u}}}if(o.content){const{index:e,isNew:t}=h("text",{type:"text",text:""});t&&(yield{event:"content-block-start",index:e,content:{type:"text",text:""}});const n=a.get(e);n.text=(n.text??"")+o.content,yield{event:"content-block-delta",index:e,delta:{type:"text-delta",text:o.content}}}if(Array.isArray(o.tool_calls))for(const n of o.tool_calls){const e=n.index??0,{index:t,isNew:r}=h(`tool:${e}`,{type:"tool_call_chunk",id:n.id,name:n.function?.name,args:"",index:e});r&&(yield{event:"content-block-start",index:t,content:{type:"tool_call_chunk",id:n.id,name:n.function?.name,args:"",index:e}});const i=a.get(t);null!=n.id&&(i.id=n.id),null!=n.function?.name&&(i.name=n.function.name);const o=n.function?.arguments??"";i.args=(i.args??"")+o,yield{event:"content-block-delta",index:t,delta:{type:"block-delta",fields:{type:"tool_call_chunk",...null!=i.id?{id:i.id}:{},...null!=i.name?{name:i.name}:{},args:i.args}}}}if(o.audio){const{index:e,isNew:t}=h("audio",{type:"audio",id:o.audio.id,data:"",mimeType:"audio/pcm",transcript:o.audio.transcript??""});t&&(yield{event:"content-block-start",index:e,content:{type:"audio",id:o.audio.id,data:"",mimeType:"audio/pcm",transcript:o.audio.transcript??""}});const n=a.get(e);o.audio.transcript&&(n.transcript=(n.transcript??"")+o.audio.transcript,yield{event:"content-block-delta",index:e,delta:{type:"block-delta",fields:{type:"audio",transcript:n.transcript}}}),o.audio.data&&(n.data=(n.data??"")+o.audio.data,yield{event:"content-block-delta",index:e,delta:{type:"data-delta",data:o.audio.data,encoding:"base64"}})}o.function_call&&(yield{event:"provider",provider:r,name:"function_call",payload:o.function_call}),t.logprobs&&(yield{event:"provider",provider:r,name:"logprobs",payload:t.logprobs})}for(const[f,m]of a)yield{event:"content-block-finish",index:f,content:oS(m)};yield{event:"message-finish",reason:c,...s?{usage:s}:{},...l?{responseMetadata:l}:{}}}(async function*(e,t){for await(const n of e){if(t?.aborted)return;yield n}}(a,t.signal),{streamUsage:!0,provider:"groq"})}async*_streamResponseChunks(e,t,n){const r=this.invocationParams(t,{streaming:!0}),i=bO(e),a=await this.completionWithRetry({...r,messages:i,stream:!0},{signal:t?.signal,headers:t?.headers});let o,s;for await(const c of a){if(t.signal?.aborted)return;s=c;const e=c?.choices[0];if(!e)continue;e.delta?.role&&(o=e.delta.role);const r=vO(e.delta,o,c,void 0),i={prompt:t.promptIndex??0,completion:e.index??0};if("string"!=typeof r.content){console.log("[WARNING]: Received non-string content from OpenAI. This is currently not supported.");continue}const a={...i};null!=e.finish_reason&&(a.finish_reason=e.finish_reason,a.system_fingerprint=c.system_fingerprint,a.model_name=c.model);const l=new lP({message:r,text:r.content,generationInfo:a});yield l,await(n?.handleLLMNewToken(l.text??"",i,void 0,void 0,void 0,{chunk:l}))}if(s&&("choices"in s&&delete s.choices,yield new lP({message:new JA({content:"",response_metadata:s}),text:""})),t.signal?.aborted)throw new Error("AbortError")}async _generate(e,t,n){if(t.signal?.throwIfAborted(),this.streaming){const r={},i=this._streamResponseChunks(e,t,n),a={};for await(const e of i){const t=e.generationInfo?.completion??0;void 0===a[t]?a[t]=e:a[t]=a[t].concat(e)}return{generations:Object.entries(a).sort(([e],[t])=>parseInt(e,10)-parseInt(t,10)).map(([e,t])=>t),llmOutput:{estimatedTokenUsage:r}}}return this._generateNonStreaming(e,t,n)}async _generateNonStreaming(e,t,n){const r={},i=this.invocationParams(t),a=bO(e),o=await this.completionWithRetry({...i,stream:!1,messages:a},{signal:t?.signal,headers:t?.headers});if("usage"in o&&o.usage){const{completion_tokens:e,prompt_tokens:t,total_tokens:n}=o.usage;e&&(r.completionTokens=(r.completionTokens??0)+e),t&&(r.promptTokens=(r.promptTokens??0)+t),n&&(r.totalTokens=(r.totalTokens??0)+n)}const s=[];if("choices"in o&&o.choices)for(const c of o.choices){const e=c.message?.content??"";let t;void 0!==r.totalTokens&&(t={input_tokens:r.promptTokens??0,output_tokens:r.completionTokens??0,total_tokens:r.totalTokens});const{choices:n,...i}=o,a={text:e,message:TO(c.message??{role:"assistant"},t,i)};a.generationInfo={...c.finish_reason?{finish_reason:c.finish_reason}:{},...c.logprobs?{logprobs:c.logprobs}:{}},s.push(a)}return{generations:s,llmOutput:{tokenUsage:r}}}get profile(){return km[this.model]??{}}withStructuredOutput(e,t){const n=e,r=t?.name,i=t?.includeRaw,a=function(e,t){if(void 0!==t&&!Hm.includes(t))throw new Error(`Invalid structured output method: ${t}. Supported methods are: ${Hm.join(", ")}`);const n=function(e){return e.startsWith("openai/gpt-oss")}(e);if(n&&!t)return"jsonSchema";if(!n&&"jsonSchema"===t)throw new Error(`Native JSON Schema structured output is not supported for model "${e}". Only models with the "openai/gpt-oss" prefix are supported. Use "functionCalling" or "jsonMode" instead.`);return t??"functionCalling"}(this.model,t?.method);let o,s,c=r??"extract";if("jsonSchema"===a){const e=r??"structured_output",t=Cg(n),i=yg(n)||$I(n)?XI(n):n,a=xm(i);s=this.withConfig({response_format:{type:"json_schema",json_schema:{name:e,description:t,strict:!0,schema:a}},ls_structured_output_format:{kwargs:{method:"jsonSchema"},schema:{title:e,description:t,...i}}}),o=CL(n)}else if("jsonMode"===a){o=CL(n);const e=yg(n)||$I(n)?XI(n):n;s=this.withConfig({response_format:{type:"json_object"},ls_structured_output_format:{kwargs:{method:"jsonMode"},schema:e}})}else{let e;if(yg(n)||$I(n)){const t=XI(n);e={name:c,description:t.description,parameters:t}}else"string"==typeof n.name&&"object"==typeof n.parameters&&null!=n.parameters?(e=n,c=n.name):(c=n.title??c,e={name:c,description:n.description??"",parameters:n});s=this.bindTools([{type:"function",function:e}]).withConfig({tool_choice:{type:"function",function:{name:c}},ls_structured_output_format:{kwargs:{method:"functionCalling"},schema:e.parameters}}),o=function(e,t){const n=IL;return yg(e)?new n({returnSingle:!0,keyName:t,zodSchema:e}):$I(e)?new n({returnSingle:!0,keyName:t,serializableSchema:e}):new n({returnSingle:!0,keyName:t})}(n,c)}return AL(s,o,i,"ChatGroqStructuredOutput")}};function wO(e){return e?"any"===e||"required"===e?"required":"auto"===e?"auto":"none"===e?"none":"string"==typeof e?{type:"function",function:{name:e}}:e:void 0}let EO=null;async function PO(e){try{const t=(EO||(EO=new Fm({apiKey:process.env.TAVILY_API_KEY||""})),EO);if(!process.env.TAVILY_API_KEY)return console.warn("TAVILY_API_KEY not set, skipping web research"),"Web research unavailable: API key not configured";const n=await t.search({query:e,search_depth:"advanced",max_results:5,include_raw_content:!0}),r=[];if(n?.answer&&r.push(`High-level answer: ${n.answer}`),n?.results?.length)for(const e of n.results.slice(0,3)){const t=(e.content??"").slice(0,800);r.push(`Source: ${e.url}\nRelevance: ${e.score}\nSnippet:\n${t}`)}return r.join("\n\n")}catch(t){return console.error("Error researching with Tavily:",t.message),`Web research failed: ${t.message}. Analysis will proceed with limited context.`}}function RO(e,t,n){const r=`You are an expert analyst tasked with providing a balanced debate analysis for a prediction market question.\n\nMarket Question: ${e.question}\n${e.description?`Description: ${e.description}`:""}\n\nCurrent Polymarket displayed odds:\n- YES: ${e.currentYesPrice}\n- NO: ${e.currentNoPrice}\n\nNote: These displayed odds are a UI placeholder and do NOT necessarily reflect true market probabilities. Use them only as a reference for comparison, not as ground truth. [web:89][web:92][web:96]\n\n${e.volume24hr?`24h Volume: $${e.volume24hr.toLocaleString()}`:""}\n${e.volumeTotal?`Total Volume: $${e.volumeTotal.toLocaleString()}`:""}\n\nYou have the following external research about this question from web search (via Tavily). Use it heavily for factual grounding:\n\n${t}\n\nYour tasks:\n1. Infer your own best-estimate probability for YES and NO based on the research, expressed as numbers between 0 and 1 that sum to 1.0.\n2. Provide a full debate analysis (arguments, summaries, key factors, uncertainties).\n3. Explain how and why your inferred probabilities differ from the displayed 50/50 odds.\n\nRespond with valid JSON in this format:\n\n{\n "yesArguments": ["argument 1", "argument 2", "argument 3"],\n "noArguments": ["argument 1", "argument 2", "argument 3"],\n "yesSummary": "2-3 sentence summary of the strongest case for YES",\n "noSummary": "2-3 sentence summary of the strongest case for NO",\n "keyFactors": ["factor 1", "factor 2", "factor 3"],\n "uncertainties": ["uncertainty 1", "uncertainty 2"],\n "modelYesProbability": 0.63,\n "modelNoProbability": 0.37,\n "commentaryOnDiscrepancy": "2-4 sentences explaining why your inferred odds differ from the 50/50 displayed odds."\n}\n\nGuidelines:\n1. Be intellectually honest and balanced - present the strongest arguments for BOTH sides.\n2. Base arguments primarily on the provided research, plus relevant facts, data, historical precedent, and logical reasoning. [web:85][web:87][web:90]\n3. Explicitly justify your probability estimates using the research (e.g., base rates, polls, fundamentals, historical analogies).\n4. Highlight structural reasons the displayed 50/50 odds might deviate from “true odds” (e.g., low liquidity, retail bias, information lags). [web:89][web:92][web:94][web:99]\n5. Each argument should be specific and substantive (2-3 sentences).\n6. Key factors should be concrete, measurable events or conditions.\n7. Focus on factors that are actually relevant to the prediction timeframe.\n8. Avoid simply repeating the 50/50 odds; your probabilities should reflect your best judgment based on the research, even if far from 50/50.\n\n`;return n?r+"\nReturn ONLY the JSON object, with no additional text or explanation.":r}async function LO(e,t,{model:n="llama-3.3-70b-versatile",temperature:r=.7}={}){try{const a=t||process.env.GROQ_API_KEY;if(!a)throw new Error("GROQ_API_KEY not configured");const o=new _O({apiKey:a,model:n,temperature:r});console.log(`Calling Groq API with model ${n}...`);const s=await o.invoke([{role:"system",content:"You are an expert analyst who provides balanced, fact-based debate analysis. Always respond with valid JSON matching the requested schema."},{role:"user",content:e}],{response_format:{type:"json_object"}});let c,l=("string"==typeof s.content?s.content:Array.isArray(s.content)?s.content.map(e=>e?.text??"").join(""):String(s.content)).trim();try{c=JSON.parse(l)}catch(i){throw console.error("Failed to parse Groq response as JSON:",l.substring(0,200)),new Error(`Invalid JSON response from Groq: ${i.message}`)}const u=["yesArguments","noArguments","yesSummary","noSummary","keyFactors","uncertainties"].filter(e=>!c[e]);if(u.length>0)throw console.error("Missing fields in Groq response:",u),new Error(`Missing required fields in analysis: ${u.join(", ")}`);return c}catch(a){throw console.error("Error calling Groq API:",a.message),a}}const NO={sp500Top:["AAPL","MSFT","NVDA","GOOGL","AMZN","META","TSLA","BRK.B","LLY","V"],tech:["AAPL","MSFT","NVDA","GOOGL","META","TSLA","ORCL","CRM","ADBE","NFLX"],faang:["META","AAPL","AMZN","NFLX","GOOGL"],mag7:["AAPL","MSFT","NVDA","GOOGL","AMZN","META","TSLA"],mostActive:["TSLA","NVDA","AAPL","AMD","PLTR","SOFI","F","NIO","LCID","RIVN"]};class OO{baseURL;constructor(e="/api"){this.baseURL=e}async fetchAPI(e,t={}){const n=`${this.baseURL}${e}`,r=await fetch(n,{...t,headers:{"Content-Type":"application/json",...t.headers}});if(!r.ok){const e=await r.json().catch(()=>({detail:"Unknown error"}));throw new Error(e.detail||`API error: ${r.statusText}`)}return r.json()}async getHealth(){const e=await this.fetchAPI("/trading-agents");return{status:"online",timestamp:(new Date).toISOString(),services:{news_researcher:"online",debate_analyst:"online"},...e}}async getAgentLogs(e=50){return this.fetchAPI(`/trading-agents?action=history&limit=${e}`)}async analyzeWithNewsResearcher(e){const t=e.symbols[0],n=await this.fetchAPI("/trading-agents",{method:"POST",body:JSON.stringify({symbol:t,date:e.date,analysts:["news","fundamentals","market"]})});return{success:n.success,symbols:[n.symbol],date:n.date,timestamp:(new Date).toISOString(),result:{portfolio_manager_results:{decision:n.signal.action,confidence:n.signal.confidence,reasoning:n.signal.reasoning},news_intelligence_results:{summary:n.analysis.newsReport},technical_analysis_results:{summary:n.analysis.marketReport},data_collection_results:{summary:n.analysis.fundamentalsReport}}}}async batchAnalyzeWithNewsResearcher(e){throw new Error("Batch analysis not supported in this version")}async analyzeWithDebateAnalyst(e){const t=await this.fetchAPI("/trading-agents",{method:"POST",body:JSON.stringify({symbol:e.symbol,date:e.date,config:{deepThinkLLM:e.deep_think_llm,quickThinkLLM:e.quick_think_llm}})});return{success:t.success,symbol:t.symbol,date:t.date,timestamp:(new Date).toISOString(),decision:{action:t.signal.action,confidence:t.signal.confidence,position_size:1,reasoning:t.signal.reasoning,debate_summary:t.analysis.investmentDebate?{bull_arguments:[t.analysis.investmentDebate.bullArguments],bear_arguments:[t.analysis.investmentDebate.bearArguments],risk_assessment:"See full analysis for risk details"}:void 0}}}async reflectOnTrade(e){return{success:!0}}async getDebateAnalystConfig(){return{success:!0}}async runBacktest(e){const t=await this.fetchAPI("/backtest",{method:"POST",body:JSON.stringify({symbol:e.symbol,startDate:"2023-01-01",endDate:(new Date).toISOString().split("T")[0],strategy:"momentum"})});return{success:t.success,symbol:t.symbol,timestamp:(new Date).toISOString(),primo_results:{"Starting Portfolio Value [$]":t.initialCapital,"Final Portfolio Value [$]":t.finalValue,"Cumulative Return [%]":t.totalReturnPercent,"Annual Return [%]":0,"Annual Volatility [%]":0,"Sharpe Ratio":t.metrics.sharpeRatio||0,"Max Drawdown [%]":t.metrics.maxDrawdown,"Total Trades":t.metrics.totalTrades,"Win Rate [%]":t.metrics.winRate},buyhold_results:{"Cumulative Return [%]":0,"Annual Return [%]":0,"Sharpe Ratio":0,"Max Drawdown [%]":0},comparison:{relative_return:0,outperformed:t.totalReturn>0,metrics:{cumulative_return_diff:0,volatility_diff:0,max_drawdown_diff:0,sharpe_diff:0}}}}async getAvailableStocks(e="./output/csv"){return{success:!0,files:[]}}async analyzeTopStocks(e="mag7",t="news-researcher"){const n=NO[e];if("news-researcher"===t){return await Promise.allSettled(n.map(e=>this.analyzeWithNewsResearcher({symbols:[e]})))}return await Promise.allSettled(n.map(e=>this.analyzeWithDebateAnalyst({symbol:e})))}async batchBacktest(e){return await Promise.allSettled(e.map(e=>this.runBacktest({symbol:e})))}}const BO=new OO;class MO{BASE_URL="https://wikimedia.org/api/rest_v1";userAgent;constructor(e){this.userAgent=e||"wiki-pageviews-ts/1.0.0"}formatDate(e,t=!1){const n="string"==typeof e?new Date(e):e;if("string"==typeof e&&/^\d{8}(\d{2})?$/.test(e))return e;const r=e=>e.toString().padStart(2,"0"),i=`${n.getUTCFullYear()}${r(n.getUTCMonth()+1)}${r(n.getUTCDate())}`;return t?`${i}${r(n.getUTCHours())}`:i}async request(e){const t=await fetch(e,{headers:{"User-Agent":this.userAgent}});if(!t.ok){const e=await t.text();let n=`HTTP ${t.status}`;try{const t=JSON.parse(e);n=t.detail||t.title||n}catch{}throw new Error(n)}return t.json()}validateProject(e){if(e&&"all-projects"!==e&&"wikidata"!==e&&!e.includes("."))throw new Error('Invalid project name. Must be a valid wiki domain (e.g., "en.wikipedia.org")')}async getPerArticlePageviews(e){const t=e.project||"en.wikipedia.org";if(this.validateProject(t),e.articles){const t=e.articles.map(t=>this.getPerArticlePageviews({...e,article:t,articles:void 0}));return Promise.all(t)}if(!e.article)throw new Error('Required parameter "article" missing');const n=encodeURIComponent(e.article.replace(/\s/g,"_")),r=this.formatDate(e.start),i=this.formatDate(e.end),a=e.access||"all-access",o=e.agent||"all-agents",s=e.granularity||"daily",c=`${this.BASE_URL}/metrics/pageviews/per-article/${t}/${a}/${o}/${n}/${s}/${r}/${i}`;return this.request(c)}async getAggregatedPageviews(e){if(e.projects&&"all-projects"!==e.projects){const t=(Array.isArray(e.projects)?e.projects:[e.projects]).map(t=>this.getAggregatedPageviews({...e,project:t,projects:void 0}));return Promise.all(t)}const t=e.project||e.projects||"en.wikipedia.org";this.validateProject(t);const n=this.formatDate(e.start,!0),r=this.formatDate(e.end,!0),i=e.access||"all-access",a=e.agent||"all-agents",o=e.granularity||"daily",s=`${this.BASE_URL}/metrics/pageviews/aggregate/${t}/${i}/${a}/${o}/${n}/${r}`;return this.request(s)}async getAggregatedLegacyPagecounts(e){if(e.projects&&"all-projects"!==e.projects){const t=(Array.isArray(e.projects)?e.projects:[e.projects]).map(t=>this.getAggregatedLegacyPagecounts({...e,project:t,projects:void 0}));return Promise.all(t)}const t=e.project||e.projects||"en.wikipedia.org";this.validateProject(t);const n=this.formatDate(e.start,!0),r=this.formatDate(e.end,!0),i=e.accessSite||"all-sites",a=e.granularity||"hourly",o=`${this.BASE_URL}/metrics/legacy/pagecounts/aggregate/${t}/${i}/${a}/${n}/${r}`;return this.request(o)}async getTopPageviews(e){if(e.date){const t="string"==typeof e.date?new Date(e.date):e.date;e.year=t.getUTCFullYear(),e.month=t.getUTCMonth()+1,e.day=t.getUTCDate()}if(!e.year||!e.month||!e.day)throw new Error('Required parameters "year", "month", and "day" missing');if(e.projects){const t=(Array.isArray(e.projects)?e.projects:[e.projects]).map(t=>this.getTopPageviews({...e,project:t,projects:void 0}));return Promise.all(t)}const t=e.project||"en.wikipedia.org";this.validateProject(t);const n=e.year.toString(),r=e.month.toString().padStart(2,"0"),i=e.day.toString().padStart(2,"0"),a=e.access||"all-access",o=`${this.BASE_URL}/metrics/pageviews/top/${t}/${a}/${n}/${r}/${i}`,s=await this.request(o);return e.limit&&s.items[0]?.articles&&(s.items[0].articles=s.items[0].articles.slice(0,e.limit)),s}async getTopPageviewsByCountry(e){if(!e.year||!e.month)throw new Error('Required parameters "year" and "month" missing');if(e.projects){const t=(Array.isArray(e.projects)?e.projects:[e.projects]).map(t=>this.getTopPageviewsByCountry({...e,project:t,projects:void 0}));return Promise.all(t)}const t=e.project||"en.wikipedia.org";this.validateProject(t);const n=e.year.toString(),r=e.month.toString().padStart(2,"0"),i=e.access||"all-access",a=`${this.BASE_URL}/metrics/pageviews/top-by-country/${t}/${i}/${n}/${r}`;return this.request(a)}async getUniqueDevices(e){if(!e.project)throw new Error('Required parameter "project" missing');this.validateProject(e.project);const t=e.project,n=this.formatDate(e.start),r=this.formatDate(e.end),i=e.accessSite||"all-sites",a=e.granularity||"daily",o=`${this.BASE_URL}/metrics/unique-devices/${t}/${i}/${a}/${n}/${r}`;return this.request(o)}async getPageviewsDimensions(){const e=`${this.BASE_URL}/metrics/pageviews/`;return this.request(e)}}const DO=new MO;exports.AlpacaMCPClient=bh,exports.BearResearcher=zr,exports.BullResearcher=Jr,exports.CompanyAndAccessionNumberClass=eh,exports.DEFAULT_D1_DATABASE_ID=Tr,exports.Downloader=class{companyName;emailAddress;_tickerToCikMapping=null;_initPromise=null;constructor(e,t){this.companyName=e,this.emailAddress=t}get userAgent(){return`${this.companyName} ${this.emailAddress}`}async init(){return this._initPromise||(this._initPromise=this._loadTickerToCikMapping()),this._initPromise}async _loadTickerToCikMapping(){this._tickerToCikMapping||(this._tickerToCikMapping=await async function(e){try{const e=await Promise.resolve().then(()=>Li),t=(await Promise.resolve().then(()=>Li)).join(__dirname,"../data","company_tickers.json"),n=await e.readFile(t,"utf-8"),r=JSON.parse(n),i={};if(Array.isArray(r))for(const a of r)if(a&&a.length>=3&&a[0]&&a[2]){const e=String(a[0]).padStart(Jp,"0");i[a[2].toUpperCase()]=e}return i}catch(t){const n="https://www.sec.gov/files/company_tickers.json",r={},a=(await i.get(n,{headers:{"User-Agent":e}})).data;for(const e in a){const t=a[e];if(t.ticker&&t.cik_str){const e=String(t.cik_str).padStart(Jp,"0");r[t.ticker.toUpperCase()]=e}}return r}}(this.userAgent))}async getFilingMetadatas(e,t={}){await this.init();const{includeAmends:n=!1}=t;if("string"==typeof e){const t=eh.fromString(e,!1);t&&(e=t)}if(e instanceof eh)return[await nh({tickerOrCik:e.tickerOrCik,accessionNumber:e.accessionNumber,userAgent:this.userAgent,tickerToCikMapping:this._tickerToCikMapping,includeAmends:n})];if("string"==typeof e&&(e=Zp.fromString(e)),e instanceof Zp)return await async function(e){const{requested:t,userAgent:n,tickerToCikMapping:r,includeAmends:i}=e,a=th(t.tickerOrCik,r);let o;if(null===t.limit)o=Number.MAX_SAFE_INTEGER;else if(o=parseInt(String(t.limit)),o<1)throw new Error("Invalid amount. Please enter a number greater than 1.");return await rh({cik:a,userAgent:n,limit:o,tickerOrCik:t.tickerOrCik,formType:t.formType,includeAmends:i})}({requested:e,userAgent:this.userAgent,tickerToCikMapping:this._tickerToCikMapping,includeAmends:n});throw new Error(`Invalid input: ${e}`)}async downloadFiling({url:e}){return await async function(e,t){try{const n=await i.get(e,{headers:{"User-Agent":t},responseType:"arraybuffer"});return Buffer.from(n.data)}catch(n){throw new Error(`Failed to download filing from ${e}: ${n}`)}}(e,this.userAgent)}async getFilingHtml(e={}){let{query:t,ticker:n,form:r}=e;if(t&&(n||r))throw new Error("Error: Ticker or form should not be provided when query is specified.");if((n||r)&&t)throw new Error("Error: Query should not be provided when ticker or form is specified.");if((n||r)&&(t=`${n}/${r}`),!t)throw new Error("Error: Either query or ticker and form must be specified.");const i=await this.getFilingMetadatas(t);if(0===i.length)throw new Error(`Could not find filing for ${t}`);if(i.length>1)throw new Error(`Found multiple filings for ${t}. Use 'getFilingMetadatas()' and 'downloadFiling()' instead.`);return await this.downloadFiling({url:i[0].primaryDocUrl})}},exports.FinancialSituationMemory=Mr,exports.FinnhubWrapper=Ch,exports.InvestmentJudge=Zr,exports.MarketAnalyst=Qr,exports.POLYMARKET_CATEGORIES=Lh,exports.RequestedFilingsClass=Zp,exports.StockAgentsAPI=OO,exports.TOP_STOCKS=NO,exports.Trader=ei,exports.TradingAgentsGraph=class{config;deepThinkingLLM;quickThinkingLLM;selectedAnalysts;debug;bullMemory;bearMemory;traderMemory;investJudgeMemory;riskManagerMemory;marketAnalyst;bullResearcher;bearResearcher;investmentJudge;trader;newsAnalyst;currentState=null;ticker=null;logStatesDict={};constructor(e=["market","social","news","fundamentals"],t=!1,n){this.selectedAnalysts=e,this.debug=t,this.config={...bi,...n},this.deepThinkingLLM=Br(this.config,this.config.deepThinkLLM),this.quickThinkingLLM=Br(this.config,this.config.quickThinkLLM),this.bullMemory=new Mr("bull_memory",this.config),this.bearMemory=new Mr("bear_memory",this.config),this.traderMemory=new Mr("trader_memory",this.config),this.investJudgeMemory=new Mr("invest_judge_memory",this.config),this.riskManagerMemory=new Mr("risk_manager_memory",this.config),this.marketAnalyst=new Qr(this.deepThinkingLLM),this.bullResearcher=new Jr(this.deepThinkingLLM,this.bullMemory),this.bearResearcher=new zr(this.deepThinkingLLM,this.bearMemory),this.investmentJudge=new Zr(this.quickThinkingLLM,this.investJudgeMemory),this.trader=new ei(this.quickThinkingLLM,this.traderMemory),this.newsAnalyst=new Si(this.deepThinkingLLM)}async propagate(e,t){this.ticker=e;const n=this.createInitialState(e,t);this.debug&&console.log(`\n=== Starting Analysis for ${e} on ${t} ===\n`);let r=n;if(this.selectedAnalysts.includes("market")){this.debug&&console.log("Running Market Analyst...");const e=await this.marketAnalyst.analyze(r);r={...r,...e}}if(r.sentimentReport||(r.sentimentReport="No social media analysis performed."),this.selectedAnalysts.includes("news")){this.debug&&console.log("Running News Analyst...");const e=await this.newsAnalyst.analyze(r);r={...r,...e}}else r.newsReport||(r.newsReport="No news analysis performed.");r.fundamentalsReport||(r.fundamentalsReport="No fundamentals analysis performed."),this.debug&&console.log("\n=== Investment Debate ==="),r.investmentDebateState={bullHistory:"",bearHistory:"",history:"",currentResponse:"",judgeDecision:"",count:0};for(let c=0;c<3;c++){this.debug&&console.log(`\nDebate Round ${c+1}`);const e=await this.bullResearcher.analyze(r);r={...r,...e};const t=await this.bearResearcher.analyze(r);r={...r,...t}}this.debug&&console.log("\nInvestment Judge making decision...");const i=await this.investmentJudge.makeDecision(r);r={...r,...i},this.debug&&console.log("\nTrader making final decision...");const a=await this.trader.makeDecision(r);r={...r,...a};const o=this.extractDecision(r.traderInvestmentPlan||"");r.finalTradeDecision=o,this.currentState=r,this.logState(t,r);const s=this.processSignal(o);return this.debug&&console.log(`\n=== Final Decision: ${s.action} (Confidence: ${s.confidence}) ===\n`),{state:r,signal:s}}createInitialState(e,t){return{companyOfInterest:e,tradeDate:t,messages:[],sender:"",marketReport:"",sentimentReport:"",newsReport:"",fundamentalsReport:"",investmentDebateState:{bullHistory:"",bearHistory:"",history:"",currentResponse:"",judgeDecision:"",count:0},investmentPlan:"",traderInvestmentPlan:"",riskDebateState:{riskyHistory:"",safeHistory:"",neutralHistory:"",history:"",latestSpeaker:"",currentRiskyResponse:"",currentSafeResponse:"",currentNeutralResponse:"",judgeDecision:"",count:0},finalTradeDecision:""}}extractDecision(e){const t=e.toUpperCase();return t.includes("BUY")&&!t.includes("NOT BUY")?"BUY":t.includes("SELL")&&!t.includes("NOT SELL")?"SELL":"HOLD"}processSignal(e){return{action:e,confidence:.75,reasoning:"Based on multi-agent analysis and debate",timestamp:new Date}}logState(e,t){this.logStatesDict[e]={companyOfInterest:t.companyOfInterest,tradeDate:t.tradeDate,marketReport:t.marketReport,sentimentReport:t.sentimentReport,newsReport:t.newsReport,fundamentalsReport:t.fundamentalsReport,investmentDebateState:{bullHistory:t.investmentDebateState.bullHistory,bearHistory:t.investmentDebateState.bearHistory,history:t.investmentDebateState.history,currentResponse:t.investmentDebateState.currentResponse,judgeDecision:t.investmentDebateState.judgeDecision},traderInvestmentDecision:t.traderInvestmentPlan,finalTradeDecision:t.finalTradeDecision}}async reflectAndRemember(e){if(!this.currentState)return;const t=`${this.currentState.marketReport}\n${this.currentState.newsReport}`,n=this.currentState.finalTradeDecision,r=`Decision: ${n}, Outcome: ${e>0?"Positive":"Negative"} (${e.toFixed(2)}%)`,i={situation:t,decision:n,outcome:e,recommendation:r,timestamp:new Date};await this.bullMemory.addMemory(i),await this.bearMemory.addMemory(i),await this.traderMemory.addMemory(i),await this.investJudgeMemory.addMemory(i)}getLogStates(){return this.logStatesDict}getCurrentState(){return this.currentState}},exports.UnifiedLLMClient=Or,exports.UnifiedQuoteService=Ph,exports.WikiPageviews=MO,exports.YahooFinanceWrapper=Gr,exports.alpacaMCPClient=_h,exports.analyzeCategories=mf,exports.analyzeStock=async function(e,t="debate-analyst"){return"news-researcher"===t?BO.analyzeWithNewsResearcher({symbols:[e]}):BO.analyzeWithDebateAnalyst({symbol:e})},exports.analyzeTopStocks=async function(e="mag7",t="news-researcher"){return BO.analyzeTopStocks(e,t)},exports.backtestStock=async function(e){return BO.runBacktest({symbol:e})},exports.calculateGreeks=Sf,exports.calculatePriceChanges=async function(e,t){try{const n=await cf(e,{interval:"1h"});if(!n||0===n.length)return{daily:null,weekly:null,monthly:null};const r=Math.floor(Date.now()/1e3),i=86400,a=7*i,o=30*i,s=[...n].sort((e,t)=>e.timestamp-t.timestamp),c=e=>{for(let t=s.length-1;t>=0;t--)if(s[t].timestamp<=e)return s[t].price;return null},l=c(r-i),u=c(r-a),d=c(r-o);return{daily:null!==l?100*(t-l):null,weekly:null!==u?100*(t-u):null,monthly:null!==d?100*(t-d):null}}catch(n){return console.error(`Error calculating price changes for token ${e}:`,n.message),{daily:null,weekly:null,monthly:null}}},exports.calculateR2=Lr,exports.calculateRMSE=function(e,t){const n=e.map((e,n)=>Math.pow(e-t[n],2)).reduce((e,t)=>e+t,0)/e.length;return Math.sqrt(n)},exports.calculateRollingStats=function(e,t,n=7){return e.map((r,i)=>{if(i<n-1)return{...r,[`${t}_rolling_mean_${n}d`]:r[t],[`${t}_rolling_std_${n}d`]:r[t]};const a=e.slice(i-n+1,i+1).map(e=>e[t]).filter(e=>null!=e&&!isNaN(e));if(0===a.length)return{...r,[`${t}_rolling_mean_${n}d`]:null,[`${t}_rolling_std_${n}d`]:null};const o=a.reduce((e,t)=>e+t,0)/a.length,s=a.reduce((e,t)=>e+Math.pow(t-o,2),0)/a.length,c=Math.sqrt(s);return{...r,[`${t}_rolling_mean_${n}d`]:Math.floor(o),[`${t}_rolling_std_${n}d`]:Math.floor(c)}})},exports.chatWithAI=async function(e){return vh().chatWithAI(e)},exports.checkGammaHealth=async function(){try{return 200===(await i.get(`${Wh}/events`,{params:{limit:1},timeout:5e3})).status}catch{return!1}},exports.checkMarket=async function(e){return Tf.warn({marketId:e},"Market not found in cache"),[]},exports.cleanCompanyName=function(e){if(!e)return e;let t=e.trim();const n=[...qp].sort((e,t)=>t.length-e.length);for(const r of n){const e=new RegExp(r.replace(/\./g,"\\.")+".*$","i");if(e.test(t)){t=t.replace(e,"").trim();break}}return t=t.replace(/[,.]$/,"").trim(),t},exports.commonjsGlobal=Ti,exports.createAlpacaBrokerClient=function(e){const t=e?.keyId||process.env.ALPACA_BROKER_API_KEY||process.env.ALPACA_API_KEY||"",n=e?.secretKey||process.env.ALPACA_BROKER_SECRET_KEY||process.env.ALPACA_SECRET||"",r=e?.baseUrl||process.env.ALPACA_BROKER_BASE_URL||"https://broker-api.alpaca.markets";if(!t||!n)throw new Error("Alpaca Broker API keys missing - check .env");return new Xp({keyId:t,secretKey:n,baseUrl:r,paper:!1})},exports.createAlpacaClient=Kp,exports.createLLM=Br,exports.db=Rr,exports.detectMovements=async function(){const e=Date.now(),t=await async function(){return{minVolumeUsd:5e4,minDaysToResolution:2,cooldownMinutes:60,alertsPaused:!1,triggers:[{cents:5,minutes:30}],blocklistCategories:[],blocklistKeywords:[]}}();if(t.alertsPaused)return Tf.debug("Alerts are paused, skipping detection"),[];const n=[].filter(e=>{if(e.volumeNum<t.minVolumeUsd)return!1;if(e.endDate){if(Math.ceil((e.endDate.getTime()-Date.now())/864e5)<t.minDaysToResolution)return!1}return!Xh(e.question,e.category,t.blocklistCategories,t.blocklistKeywords).blocked});if(0===n.length)return[];n.map(e=>e.id);const r=await async function(){return new Set}(0,t.cooldownMinutes),i=n.filter(e=>!r.has(e.id));if(0===i.length)return[];const a=[];for(const c of i)c.tokenYes&&a.push(c.tokenYes),c.tokenNo&&a.push(c.tokenNo);const o=[];for(const c of t.triggers){const e=await gf(0,c.minutes);for(const t of i)if(!o.some(e=>e.marketId===t.id)){if(t.tokenYes){const n=e.get(t.tokenYes),r=vf(t,t.tokenYes,"YES",n,c.cents,c.minutes);if(r){o.push(r);continue}}if(t.tokenNo){const n=e.get(t.tokenNo),r=vf(t,t.tokenNo,"NO",n,c.cents,c.minutes);r&&o.push(r)}}}const s=Date.now()-e;return o.length>0?Tf.info({count:o.length,durationMs:s},"Detected price movements"):Tf.debug({marketsChecked:i.length,durationMs:s},"Detection complete, no movements"),o},exports.fetchActiveMarketsWithPrices=async function(e=[],t=[]){jh.debug("Fetching active events from Gamma API");const n=[];let r=0,a=!0;for(;a;){const o=(await i.get(`${Wh}/events`,{params:{active:!0,closed:!1,limit:100,offset:r},timeout:3e4})).data;if(o&&0!==o.length){for(const r of o){let i="Unknown";if(r.tags&&r.tags.length>0?i=r.tags[0]?.label||"Unknown":r.category&&(i=r.category),r.markets&&Array.isArray(r.markets))for(const a of r.markets){const o=Xh(a.question,i,e,t);if(o.blocked){jh.debug({marketId:a.id,reason:o.reason,match:o.matchedValue},"Market blocked by filter");continue}const s=Yh(a,i,r.slug??"");s&&n.push(s)}}o.length<100?a=!1:r+=100,r>5e3&&(jh.warn("Reached safety limit of 5000 events, stopping pagination"),a=!1)}else a=!1}return jh.info({count:n.length},"Fetched active markets with prices"),n},exports.fetchAllMarkets=Bh,exports.fetchAllTraderActivity=xh,exports.fetchAndStoreTopTraders=Rf,exports.fetchLeaderboard=Dh,exports.fetchMarket=async function(e){try{const t=Yh((await i.get(`${Wh}/markets/${e}`,{timeout:3e4})).data,"Unknown","");return t?.market??null}catch(t){if(i.isAxiosError(t)&&404===t.response?.status)return null;throw t}},exports.fetchMarketDetails=Hh,exports.fetchMarketHolders=async function(e,t=20){if(!e)return console.error("No conditionId provided for holders fetch"),[];const n=new URL("https://data-api.polymarket.com/holders");n.searchParams.set("market",e),n.searchParams.set("limit",String(Math.min(t,20))),n.searchParams.set("minBalance","1");try{const e=await a(n.toString(),{headers:{accept:"application/json"},cache:"no-store"});if(!e.ok)return console.error(`Holders fetch failed: ${e.status}`),[];const t=await e.json();return Array.isArray(t)?t:[]}catch(r){return console.error("Error fetching market holders:",r),[]}},exports.fetchMarketOrderBook=async function(e){const t=new URL(`https://gamma-api.polymarket.com/markets/${e}/order-book`),n=await a(t,{headers:{accept:"application/json"},cache:"no-store"});return n.ok?await n.json():(console.error(`Order book fetch failed for market ${e}: ${n.status}`),null)},exports.fetchMarketSummary=async function(e){const t=await a("https://polymarketanalytics.com/api/market-summary",{method:"POST",headers:{accept:"*/*","accept-language":"en-US,en;q=0.9","content-type":"application/json"},body:JSON.stringify({eventId:e}),cache:"no-store"});if(!t.ok)throw console.error(`Market summary fetch failed: ${t.status}`),new Error(`Market summary API error: ${t.status}`);return await t.json()},exports.fetchMarkets=Oh,exports.fetchMarketsDashboard=Uh,exports.fetchPriceHistory=Vh,exports.fetchTopTraders=Fh,exports.fetchTraderActivity=Gh,exports.fetchTraderPositions=kh,exports.fetchTraderProfiles=async function(e){const t=new Map;if(0===e.length)return t;try{const n=await a("https://polymarketanalytics.com/api/traders-tag-performance",{method:"POST",headers:{accept:"*/*","content-type":"application/json"},body:JSON.stringify({tag:"Overall",sortColumn:"overall_gain",sortDirection:"DESC",minPnL:-1e8,maxPnL:1e8,minActivePositions:0,maxActivePositions:1e5,minWinAmount:0,maxWinAmount:1e8,minLossAmount:-1e8,maxLossAmount:0,minWinRate:0,maxWinRate:100,minCurrentValue:0,maxCurrentValue:1e11,minTotalPositions:0,maxTotalPositions:1e5})});if(!n.ok)return console.error(`Trader profiles fetch failed: ${n.status}`),t;const r=await n.json(),i=Array.isArray(r)?r:[],o=new Set(e.map(e=>e.toLowerCase()));for(const e of i){const n=e.proxy_wallet||e.proxyWallet||e.address||"";o.has(n.toLowerCase())&&t.set(n.toLowerCase(),{address:n,userName:e.user_name||e.userName,profileImage:e.profile_image||e.profileImage,overallGain:e.overall_gain||e.overallGain||0,winRate:e.win_rate||e.winRate||0,totalProfit:e.win_amount||e.winAmount||0,totalLoss:e.loss_amount||e.lossAmount||0,totalPositions:e.total_positions||e.totalPositions||0,activePositions:e.active_positions||e.activePositions||0,currentValue:e.current_value||e.currentValue||0})}}catch(n){console.error("Error fetching trader profiles:",n)}return t},exports.fetchZuluTraderDetail=Jf,exports.fetchZuluTraders=Qf,exports.finnhub=Ah,exports.formatTriggerType=function(e,t){return`${e>=0?"UP":"DOWN"}_${t}m`},exports.generateDebateAnalysis=async function(e,t){try{console.log(`Generating debate analysis for: ${e.question}`);const n=RO(e,await PO(e.question),!0),r=await LO(n,t);return console.log("Successfully generated debate analysis"),r}catch(n){throw console.error("Error generating debate analysis:",n.message),new Error(`Failed to generate debate analysis: ${n.message}`)}},exports.generateDebateAnalysisWithOpenAI=async function(e,t){return LO(RO(e,await PO(e.question),!1),t)},exports.getAccount=async function(){return vh().getAccount()},exports.getAlpacaMCPClient=vh,exports.getCachedMarkets=Nh,exports.getCategories=async function(){return{best:await Rr.select().from($n).orderBy(e.desc($n.pnl)).limit(20),worst:await Rr.select().from($n).orderBy(e.asc($n.pnl)).limit(20)}},exports.getD1HttpCredentials=vr,exports.getDefaultExportFromCjs=vi,exports.getFundamentals=async function(e){try{const t=await fetch(`/api/stocks/quote/${e}`);if(!t.ok)throw new Error("Failed to fetch fundamentals");const n=await t.json();return{marketCap:n.marketCap,peRatio:n.peRatio,dividendYield:n.dividendYield,eps:n.eps,revenue:n.revenue,profitMargin:n.profitMargin}}catch(t){throw console.error("Error fetching fundamentals:",t),t}},exports.getHistoricalQuotes=async function(e,t,n,r={}){return Rh.getHistoricalQuotes(e,t,n,r)},exports.getIndicators=Vr,exports.getLatestTradeTimestamp=pf,exports.getLeaders=async function(t="vol",n=50){const r="vol"===t?Un.vol:"pnl"===t?Un.pnl:Un.overallGain;return await Rr.select().from(Un).orderBy(e.desc(r)).limit(n)},exports.getMarketById=function(e){},exports.getMarketDebate=async function(t){const n=await Rr.select().from(Xn).where(e.eq(Xn.marketId,t)).limit(1);return n.length>0?n[0]:null},exports.getMarketHolders=async function(t,n=10){return await Rr.select().from(Yn).where(e.eq(Yn.marketId,t)).orderBy(e.asc(Yn.rank)).limit(n)},exports.getMarketPositions=async function(t){return await Rr.select().from(Wn).where(e.eq(Wn.marketId,t)).orderBy(e.desc(Wn.totalValue))},exports.getMarkets=async function(t={}){const{limit:n=50,offset:r=0,sortBy:i="volume24hr",category:a,activeOnly:o=!0}=t;let s=Rr.select().from(jn);const c=[];o&&c.push(e.eq(jn.active,!0)),a&&"Overall"!==a&&"all"!==a&&c.push(e.eq(jn.category,a)),c.length>0&&(s=s.where(e.and(...c)));const l="volume24hr"===i?jn.volume24hr:"volumeTotal"===i?jn.volumeTotal:jn.createdAt;return s=s.orderBy(e.desc(l)),s=s.limit(n).offset(r),await s},exports.getMarketsByCategory=async function(){const t=await Rr.select().from(jn).where(e.eq(jn.active,!0)).orderBy(e.desc(jn.volume24hr)).limit(100),n={};for(const e of t)try{const t=JSON.parse(e.tags||"[]");for(const r of t)n[r]||(n[r]=[]),n[r].push(e)}catch{}return n},exports.getNews=async function(e,t=10){try{return[]}catch(n){return console.error("Error fetching news:",n),[]}},exports.getPriceHistory=cf,exports.getQuoteFromSource=async function(e,t){return Rh.getQuoteFromSource(e,t)},exports.getQuotes=async function(e,t={}){return Rh.getQuotes(e,t)},exports.getServiceHealth=async function(){return BO.getHealth()},exports.getStockData=Ur,exports.getSyncStatusStats=hf,exports.getTradeHistorySyncProgress=async function(){return hf()},exports.getTradeSyncStatus=df,exports.getTraderPositions=async function(t){return await Rr.select().from(Vn).where(e.eq(Vn.traderId,t))},exports.getTraderTradeHistory=async function(t,n={}){const{limit:r=100,offset:i=0,type:a,startDate:o,endDate:s}=n,c=[e.eq(qn.traderId,t)];return a&&c.push(e.eq(qn.type,a)),o&&c.push(e.gte(qn.timestamp,o)),s&&c.push(e.lte(qn.timestamp,s)),await Rr.select().from(qn).where(e.and(...c)).orderBy(e.desc(qn.timestamp)).limit(r).offset(i)},exports.getTraderTradeStats=async function(t){return(await Rr.select({totalTrades:e.sql`count(*)`,totalVolume:e.sql`sum(${qn.usdcSize})`,buyCount:e.sql`sum(case when ${qn.side} = 'BUY' then 1 else 0 end)`,sellCount:e.sql`sum(case when ${qn.side} = 'SELL' then 1 else 0 end)`,firstTradeDate:e.sql`min(${qn.timestamp})`,lastTradeDate:e.sql`max(${qn.timestamp})`,uniqueMarkets:e.sql`count(distinct ${qn.conditionId})`}).from(qn).where(e.eq(qn.traderId,t)))[0]||null},exports.getTradersNeedingSync=async function(t=100){return(await Rr.select({traderId:Qn.traderId}).from(Qn).where(e.sql`${Qn.syncStatus} IN ('pending', 'error')`).limit(t)).map(e=>e.traderId)},exports.getZuluTopByRank=async function(t=50){return await Rr.select().from(Zn).orderBy(e.asc(Zn.zuluRank)).limit(t)},exports.getZuluTraderById=async function(t){const n=await Rr.select().from(Zn).where(e.eq(Zn.providerId,t)).limit(1);if(0===n.length)return null;const r=await Rr.select().from(er).where(e.eq(er.providerId,t));return{...n[0],currencyStats:r}},exports.getZuluTraders=async function(t=50){return await Rr.select().from(Zn).orderBy(e.desc(Zn.roiAnnualized)).limit(t)},exports.greeksEnricher=bf,exports.isMarketBlocked=Xh,exports.loadModel=async function(e){await t.loadModel(e)},exports.myLeadersAPI=qf,exports.normalizeChartQuotes=kr,exports.pageviews=DO,exports.placeOrder=async function(e){return vh().placeOrder(e)},exports.predictFuture=function(e,n){const{featuresToUse:r}=n,i=e.map(e=>({...r.reduce((t,n)=>(t[n]=e[n],t),{})})).map(e=>Object.values(e)).map(e=>e.map(Number)).filter(e=>e.length>1&&!!e[0]);return t.predict(i).then(t=>(e.forEach((e,n)=>{e.predicted=t[n]}),e))},exports.queryKeys={health:["health"],newsResearcher:e=>["news-researcher",...e],debateAnalyst:e=>["debate-analyst",e],backtest:e=>["backtest",e],availableStocks:["available-stocks"],topStocks:(e,t)=>["top-stocks",e,t]},exports.resumeTradeHistorySync=async function(e={}){const t=await hf();return console.log("Current sync status:"),console.log(` Pending: ${t.pending}`),console.log(` In Progress: ${t.in_progress}`),console.log(` Completed: ${t.completed}`),console.log(` Error: ${t.error}`),Nf({...e,limit:e.limit||t.pending+t.error+t.in_progress,skipRecentlysynced:0})},exports.saveCategories=ff,exports.saveDebate=async function(e,t){const n=Date.now(),r=`debate-${e}`;await Rr.insert(Xn).values({id:r,marketId:e,question:t.question,yesArguments:JSON.stringify(t.yesArguments),noArguments:JSON.stringify(t.noArguments),yesSummary:t.yesSummary,noSummary:t.noSummary,keyFactors:JSON.stringify(t.keyFactors),uncertainties:JSON.stringify(t.uncertainties),currentYesPrice:t.currentYesPrice,currentNoPrice:t.currentNoPrice,llmProvider:t.llmProvider||null,model:t.model||null,createdAt:new Date(n),updatedAt:new Date(n)}).onConflictDoUpdate({target:Xn.marketId,set:{question:t.question,yesArguments:JSON.stringify(t.yesArguments),noArguments:JSON.stringify(t.noArguments),yesSummary:t.yesSummary,noSummary:t.noSummary,keyFactors:JSON.stringify(t.keyFactors),uncertainties:JSON.stringify(t.uncertainties),currentYesPrice:t.currentYesPrice,currentNoPrice:t.currentNoPrice,llmProvider:t.llmProvider||null,model:t.model||null,updatedAt:new Date(n)}})},exports.saveHolders=of,exports.saveLeaderboardData=rf,exports.saveLeaders=nf,exports.saveMarketPositions=async function(t,n){const r=Date.now();if(await Rr.delete(Wn).where(e.eq(Wn.marketId,t)),n&&n.bids&&n.asks){for(const e of n.bids||[]){const n=`${t}-buy-${e.price}-${Date.now()}-${Math.random()}`;await Rr.insert(Wn).values({id:n,marketId:t,outcome:e.outcome||"Yes",price:e.price||0,size:e.size||0,side:"buy",totalValue:(e.price||0)*(e.size||0),createdAt:new Date(r)})}for(const e of n.asks||[]){const n=`${t}-sell-${e.price}-${Date.now()}-${Math.random()}`;await Rr.insert(Wn).values({id:n,marketId:t,outcome:e.outcome||"Yes",price:e.price||0,size:e.size||0,side:"sell",totalValue:(e.price||0)*(e.size||0),createdAt:new Date(r)})}}},exports.saveMarkets=tf,exports.saveModel=async function(e){await t.saveModel(e)},exports.savePositions=af,exports.savePriceHistory=sf,exports.saveTradeHistory=lf,exports.saveZuluCurrencyStats=Zf,exports.saveZuluTraders=zf,exports.searchMarkets=async function(e,t=100){return e&&""!==e.trim()?((await Mh({q:e,keep_closed_markets:0,limit_per_type:t,search_tags:!0,search_profiles:!1})).markets||[]).filter(e=>e.active&&!e.closed):[]},exports.searchMarketsInDB=async function(t,n={}){const{limit:r=50,offset:i=0,sortBy:a="volume24hr",category:o,activeOnly:s=!0}=n;if(!t||""===t.trim())return[];let c=Rr.select().from(jn);const l=[];s&&l.push(e.eq(jn.active,!0)),o&&"Overall"!==o&&"all"!==o&&l.push(e.eq(jn.category,o)),l.length>0&&(c=c.where(e.and(...l)));const u="volume24hr"===a?jn.volume24hr:"volumeTotal"===a?jn.volumeTotal:jn.createdAt;c=c.orderBy(e.desc(u));const d=await c,p=t.toLowerCase();return d.filter(e=>e.question.toLowerCase().includes(p)).slice(i,i+r)},exports.searchPublic=Mh,exports.searchZuluTraders=async function(t){let n=Rr.select().from(Zn);return t.minRoi&&(n=n.where(e.sql`${Zn.roiAnnualized} >= ${t.minRoi}`)),t.minWinRate&&(n=n.where(e.sql`${Zn.winRate} >= ${t.minWinRate}`)),t.maxDrawdown&&(n=n.where(e.sql`${Zn.maxDrawdownPercent} <= ${t.maxDrawdown}`)),void 0!==t.isEa&&(n=n.where(e.eq(Zn.isEa,t.isEa?1:0))),await n.orderBy(e.desc(Zn.roiAnnualized)).limit(t.limit||50)},exports.splitTrainTest=Nr,exports.stockAgentsAPI=BO,exports.stockNames=Yp,exports.syncAll=async function(){console.log("Starting full Polymarket sync...");const e=await wf(),t=await Ef({limit:100,orderBy:"VOL"}),n=await Pf();return{markets:e.markets,leaderboard:t.leaders,leaders:n.leaders,positions:n.positions}},exports.syncAllMarkets=async function(e=0,t=!0){try{console.log("Starting Polymarket all markets sync...");try{await Rr.delete(jn)}catch(n){console.error("Failed to clear existing markets:",n.message)}const r=await Bh("volume24hr",e);await tf(r),console.log(`Saved ${r.length} markets`);let i=0;if(t){console.log("Fetching price history for markets...");for(const e of r)if(e.clobTokenIds&&e.clobTokenIds.length>0)try{const t=e.clobTokenIds[0];if(!t||"string"!=typeof t||t.trim().length<10||!/^[a-zA-Z0-9_-]+$/.test(t)){console.log(`Skipping market ${e.id} - Invalid token ID: ${t}`);continue}i+=(await _f(t,{interval:"1h"})).pricePoints}catch(n){n.message?.includes("400")||n.message?.includes("Invalid token")?console.log(`Skipping market ${e.id} - ${n.message}`):console.error(`Error syncing price history for market ${e.id}:`,n.message)}console.log(`Saved ${i} price data points across all markets`)}return{markets:r.length,pricePoints:i}}catch(n){throw console.error("Fatal error in syncAllMarkets:",n.message),n}},exports.syncCopyTradingLeadersOrders=async function(){console.log("Starting NVSTLY sync - fetching all available leaders...");const t=await qf.getTraderRankings("1mo",100);if(!t||0===t.length)return console.log("Warning: No traders found from NVSTLY API"),[];console.log(`Found ${t.length} NVSTLY traders to process`);for(let r=0;r<t.length;r++){const i=t[r],a=i.id;console.log(`Processing trader ${r+1}/${t.length}: ${i.name} (Rank #${i.rank})`);try{const n=await qf.getTraderTrades(a);t[r].orders=n,console.log(` ✓ Fetched ${n.length} trades for ${i.name}`),await Rr.insert(Jn).values({id:i.id,name:i.name,rank:i.rank,rep:i.rep,trades:i.trades,winRate:i.winRate,totalGain:i.totalGain,avgReturn:i.avgReturn,broker:i.broker||null,updatedAt:new Date}).onConflictDoUpdate({target:Jn.id,set:{name:i.name,rank:i.rank,rep:i.rep,trades:i.trades,winRate:i.winRate,totalGain:i.totalGain,avgReturn:i.avgReturn,broker:i.broker||null,updatedAt:new Date}}),await Rr.delete(zn).where(e.eq(zn.traderId,i.id)),n.length>0&&await Rr.insert(zn).values(n.map((e,t)=>({id:`${i.id}-${e.symbol}-${e.time}-${t}`,traderId:i.id,symbol:e.symbol,type:e.type,price:e.price,previousPrice:e.previousPrice||null,gain:e.gain||null,time:new Date(e.time),createdAt:new Date}))),console.log(` ✓ Saved ${i.name} to database`)}catch(n){console.error(` ✗ Error processing trader ${i.name}:`,n),t[r].orders=[]}r<t.length-1&&await new Promise(e=>setTimeout(e,1e3))}try{await Ri.writeFile(Yf,JSON.stringify(t,null,2)),console.log(`✓ Saved ${t.length} traders to ${Yf}`)}catch(n){console.error("Error saving to JSON file:",n)}return console.log(`\n✓ Successfully synced ${t.length} NVSTLY traders to database`),t},exports.syncLeaderboard=Ef,exports.syncLeadersAndCategories=Pf,exports.syncMarketHolders=async function(e,t){let n=t;if(!n){const t=await Hh(e);t&&t.events&&t.events.length>0&&(n=t.events[0].id)}if(!n)return console.warn(`Could not determine event ID for market ${e}, skipping holders sync.`),{holders:0};try{const t=await Uh(n);return t&&t.holders&&Array.isArray(t.holders)?(await of(e,t.holders),{holders:t.holders.length}):{holders:0}}catch(r){return console.error(`Error syncing holders for market ${e}:`,r),{holders:0}}},exports.syncMarkets=wf,exports.syncMarketsIncremental=async function(e=1e3,t=!0,n=!0){try{console.log(`Starting incremental Polymarket markets sync (max: ${e})...`);const r=await Bh("volume24hr",e);await tf(r),console.log(`Synced ${r.length} markets (upsert)`);let i=0,a=0;if(t&&r.length>0){console.log("Fetching price history for markets...");const e=50;for(let t=0;t<r.length;t+=e){const n=r.slice(t,t+e);await Promise.allSettled(n.map(async e=>{if(e.clobTokenIds&&e.clobTokenIds.length>0)try{const t=e.clobTokenIds[0];if(!t||"string"!=typeof t||t.trim().length<10||!/^[a-zA-Z0-9_-]+$/.test(t))return;const n=await _f(t,{interval:"1h"});i+=n.pricePoints,a++}catch(t){t.message?.includes("400")||t.message?.includes("Invalid token")||console.error(`Error syncing price history for market ${e.id}:`,t.message)}}));const o=Math.min(t+e,r.length);console.log(`Processed ${o}/${r.length} markets for price history`)}console.log(`Saved ${i} price data points across ${a} markets`)}let o=0,s=0;if(n&&r.length>0){console.log("Fetching top holders for markets...");const e=20;for(let t=0;t<r.length;t+=e){const n=r.slice(t,t+e);await Promise.allSettled(n.map(async e=>{try{let t=e.events&&e.events.length>0?e.events[0].id:null;if(!t){const n=await Hh(e.id);n&&n.events&&n.events.length>0&&(t=n.events[0].id)}if(!t)return;const n=await Uh(t);n&&n.holders&&Array.isArray(n.holders)&&(await of(e.id,n.holders),o+=n.holders.length,s++)}catch(t){t.message?.includes("400")||t.message?.includes("404")||t.message?.includes("429")||console.error(`Error syncing holders for market ${e.id}:`,t.message)}}));const i=Math.min(t+e,r.length);console.log(`Processed ${i}/${r.length} markets for holders`),t+e<r.length&&await new Promise(e=>setTimeout(e,2e3))}console.log(`Saved ${o} holders across ${s} markets`)}return{markets:r.length,pricePoints:i,priceHistoryUpdates:a,holders:o,holderUpdates:s}}catch(r){throw console.error("Fatal error in syncMarketsIncremental:",r.message),r}},exports.syncPriceHistory=_f,exports.syncTopTradersTradeHistory=Nf,exports.syncTraderTradeHistory=Lf,exports.syncZuluTraderDetails=async function(e){console.log(`Syncing details for ${e.length} traders...`);const t=[];for(const r of e)try{const e=await Jf(r);t.push(e),await new Promise(e=>setTimeout(e,500))}catch(n){console.error(`Failed to fetch trader ${r}:`,n.message)}return t.length>0&&await zf(t.map(e=>({trader:e.trader.stats}))),console.log(`Saved ${t.length} trader details`),{details:t.length}},exports.syncZuluTraders=async function(){console.log("Starting Zulu sync...");const e=await Qf();return await zf(e),console.log(`Saved ${e.length} Zulu traders`),{traders:e.length}},exports.trainModels=async function(e,n,r){const{xgbParams:i={verbosity:0,max_depth:7,eta:.07,objective:"reg:squarederror",nthread:4,subsample:.85,colsample_bytree:.8,colsample_bylevel:.8,min_child_weight:5,gamma:.2,alpha:.1,lambda:1.5,early_stopping_rounds:50,seed:42,nrounds:2e3,tree_method:"hist",grow_policy:"depthwise",...r.xgbParams},testSize:a=.1,featuresToUse:o}=r;let s=e.map(e=>({...o.reduce((t,n)=>(t[n]=e[n],t),{})})).filter(e=>Object.values(e).length>0).map(e=>Object.values(e));s=s.map(e=>e.map(Number));const c=e.map(e=>e[n]),{trainFeatures:l,testFeatures:u,trainTarget:d,testTarget:p}=Nr(s,c,a),h=Object.values(l).map(e=>Object.values(e)).map(e=>e.map(Number)),f=Object.values(u).map(e=>Object.values(e)).map(e=>e.map(Number)),m=[];for(let t=0;t<d.length;t++)isNaN(d[t])||m.push(t);const g=m.map(e=>h[e]),y=m.map(e=>d[e]);return await t.train(g,y,i),Lr(await t.predict(f),p)},exports.unifiedQuoteService=Rh,exports.updateTradeSyncStatus=uf,exports.yahooFinance=Hr,exports.yahooFinanceWrapper=xr,exports.yfinance=Qp;