@yukino.js/yukino 0.0.17 → 0.0.18

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.
Files changed (31) hide show
  1. package/README.md +76 -27
  2. package/dist/{anthropic-3WALTWVK.js → anthropic-SNLPAGHS.js} +1 -1
  3. package/dist/{chunk-UDW5FQQ2.js → chunk-BPGCPI76.js} +1 -1
  4. package/dist/{chunk-XWPHUABN.js → chunk-CTYNHZ3Y.js} +1 -1
  5. package/dist/chunk-CYKTCSRI.js +866 -0
  6. package/dist/{chunk-OARVZDYW.js → chunk-CZGLX3AK.js} +1 -1
  7. package/dist/{chunk-E5GNPWNI.js → chunk-F7FUNBYM.js} +1 -1
  8. package/dist/{chunk-3NCODM6S.js → chunk-ILSOSAOB.js} +28 -28
  9. package/dist/{chunk-IGVEI6KM.js → chunk-IO3PJG3N.js} +1 -1
  10. package/dist/{chunk-6ZJ6N7IH.js → chunk-UQM7BD5K.js} +1 -1
  11. package/dist/{chunk-6RBGIE4I.js → chunk-ZESFB5XU.js} +1 -1
  12. package/dist/lib/{anthropic-7WH7P3RI.js → anthropic-UZWRSZSZ.js} +3 -3
  13. package/dist/lib/{chunk-XBRU3RBT.js → chunk-EYSD63EM.js} +1 -1
  14. package/dist/lib/{chunk-6NWFDYBU.js → chunk-F66UUNE7.js} +2 -2
  15. package/dist/lib/{chunk-WZQR25VY.js → chunk-I7AT5Q45.js} +2 -2
  16. package/dist/lib/{chunk-2TTVGX57.js → chunk-KKAVW72Q.js} +2 -2
  17. package/dist/lib/{chunk-PGTK52O6.js → chunk-T33QIWPB.js} +1 -0
  18. package/dist/lib/index.d.ts +2169 -1454
  19. package/dist/lib/index.js +2483 -470
  20. package/dist/lib/{openai-WF5FTR27.js → openai-UB67SMOX.js} +3 -3
  21. package/dist/lib/{providers-EPEZ5LNH.js → providers-YZB3ZC4N.js} +2 -2
  22. package/dist/{main-JAXZTXEK.js → main-XRZCWPXW.js} +233 -229
  23. package/dist/main.js +2 -2
  24. package/dist/{openai-VOM3AZYR.js → openai-SVRRJUPW.js} +1 -1
  25. package/dist/{providers-OW3JL52M.js → providers-KK4H4FPS.js} +1 -1
  26. package/dist/{server-WA7I53NC.js → server-SHFUKQA4.js} +1 -1
  27. package/dist/{server-Z3ZXR2HE.js → server-ZYMTEUKF.js} +1 -1
  28. package/dist/{stdio-FINC2RYM.js → stdio-DWJD5XUT.js} +1 -1
  29. package/dist/{websocket-4BV3XTZ3.js → websocket-5P5FBVU6.js} +1 -1
  30. package/package.json +2 -1
  31. package/dist/chunk-IRS7KPMN.js +0 -820
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __yukinoCreateRequire } from "node:module";
3
3
  const require = __yukinoCreateRequire(import.meta.url);
4
- import{Bc as It,Cc as kt,Hc as Nt,Oa as At}from"./chunk-6RBGIE4I.js";import{d as Io,f as Me,g as Mo,h as Vt,i as Oe,j as Pr,k as Bt,l as Ie,o as jt,p as Ft,q as $t,s as Wt,t as Qt,u as rr,v as Yt}from"./chunk-XQCCZYMT.js";import{a as Ht}from"./chunk-HRAX6543.js";import{b as qe,d as ns,h as xe,i as Dt,j as kr}from"./chunk-W2VWX7HR.js";import{a as zt,c as Cr,g as Uo,j as Kt,l as Ar,m as Xt,n as Ir,p as er,u as Gt,v as ss}from"./chunk-K6F424MN.js";import{b as Je,c as ko,d as Ze,e as No,f as Mt,l as Ut}from"./chunk-IQT2IFSO.js";import{a as Ne}from"./chunk-IGVEI6KM.js";import{c as ee,e as Se,f as Ae,g as Po,k as Lr,m as Co,o as te,p as M,r as Ao,s as be,t as Z}from"./chunk-5ZELCP2G.js";Z();var is=Object.defineProperty,O=(r,e)=>{for(var t in e)is(r,t,{get:e[t],enumerable:!0})};function oe(r){if(typeof process<"u"&&process.env[r])return process.env[r];if(typeof globalThis<"u")return globalThis[r]}function Ko(r){let e=atob(r);return Uint8Array.from(e,t=>t.codePointAt(0))}function Vo(r){let e=Array.from(r,t=>String.fromCharCode(t)).join("");return btoa(e)}function aa(r){if(typeof Buffer<"u")return Buffer.from(r,"utf8").toString("base64");let e=new TextEncoder().encode(r);return Vo(e)}var Xo=(r=>(r[r.NONE=4]="NONE",r[r.ERROR=3]="ERROR",r[r.WARN=2]="WARN",r[r.INFO=1]="INFO",r[r.DEBUG=0]="DEBUG",r))(Xo||{});function ls(){var r;if(typeof process=="object"&&"env"in process){if(((r=oe("LANGFUSE_DEBUG"))==null?void 0:r.toLowerCase())==="true")return 0;let e=oe("LANGFUSE_LOG_LEVEL");switch((e??"").toUpperCase()){case"NONE":return 4;case"ERROR":return 3;case"WARN":return 2;case"INFO":return 1;case"DEBUG":return 0;default:return}}}var Jt=class{constructor(r={level:1}){this.config={enableTimestamp:!0,...r}}shouldLog(r){return r>=this.config.level}formatMessage(r,e){let t=this.config.enableTimestamp?new Date().toISOString():"",a=this.config.prefix||"[Langfuse SDK]";return[t,a,`[${r}]`,e].filter(Boolean).join(" ")}error(r,...e){this.shouldLog(3)&&console.error(this.formatMessage("ERROR",r),...e)}warn(r,...e){this.shouldLog(2)&&console.warn(this.formatMessage("WARN",r),...e)}info(r,...e){this.shouldLog(1)&&console.info(this.formatMessage("INFO",r),...e)}debug(r,...e){this.shouldLog(0)&&console.debug(this.formatMessage("DEBUG",r),...e)}setLevel(r){this.config.level=r}getLevel(){return this.config.level}isLevelEnabled(r){return this.shouldLog(r)}},Zt,Do=class ve{static getInstance(){return ve.instance||(ve.instance=new Jt(ve.defaultConfig)),ve.instance}static configure(e){ve.defaultConfig=e,ve.instance=new Jt(e)}static reset(){ve.instance=null,ve.defaultConfig={level:1}}};Do.instance=null;Do.defaultConfig={level:(Zt=ls())!=null?Zt:1};var ds=Do;var re=()=>ds.getInstance();var us={name:"@langfuse/core",version:"5.14.0",description:"Core functions and utilities for Langfuse packages",type:"module",sideEffects:!1,main:"./dist/index.cjs",module:"./dist/index.mjs",types:"./dist/index.d.ts",exports:{".":{import:{types:"./dist/index.d.ts",default:"./dist/index.mjs"},require:{types:"./dist/index.d.cts",default:"./dist/index.cjs"}}},scripts:{build:"tsup",test:"vitest run","test:watch":"vitest",format:'prettier --write "src/**/*.ts"',"format:check":'prettier --check "src/**/*.ts"',clean:"rm -rf dist"},author:"Langfuse",license:"MIT",repository:{type:"git",url:"https://github.com/langfuse/langfuse-js.git",directory:"packages/core"},files:["dist"],peerDependencies:{"@opentelemetry/api":"^1.9.0"},devDependencies:{"@types/node":"^24.1.0"}},or="langfuse-sdk",tr=us.version;var cs="sdk-experiment",j=(r=>(r.TRACE_NAME="langfuse.trace.name",r.TRACE_USER_ID="user.id",r.TRACE_SESSION_ID="session.id",r.TRACE_TAGS="langfuse.trace.tags",r.TRACE_PUBLIC="langfuse.trace.public",r.TRACE_METADATA="langfuse.trace.metadata",r.TRACE_INPUT="langfuse.trace.input",r.TRACE_OUTPUT="langfuse.trace.output",r.OBSERVATION_TYPE="langfuse.observation.type",r.OBSERVATION_METADATA="langfuse.observation.metadata",r.OBSERVATION_LEVEL="langfuse.observation.level",r.OBSERVATION_STATUS_MESSAGE="langfuse.observation.status_message",r.OBSERVATION_INPUT="langfuse.observation.input",r.OBSERVATION_OUTPUT="langfuse.observation.output",r.OBSERVATION_COMPLETION_START_TIME="langfuse.observation.completion_start_time",r.OBSERVATION_MODEL="langfuse.observation.model.name",r.OBSERVATION_MODEL_PARAMETERS="langfuse.observation.model.parameters",r.OBSERVATION_USAGE_DETAILS="langfuse.observation.usage_details",r.OBSERVATION_COST_DETAILS="langfuse.observation.cost_details",r.OBSERVATION_PROMPT_NAME="langfuse.observation.prompt.name",r.OBSERVATION_PROMPT_VERSION="langfuse.observation.prompt.version",r.ENVIRONMENT="langfuse.environment",r.RELEASE="langfuse.release",r.VERSION="langfuse.version",r.AS_ROOT="langfuse.internal.as_root",r.IS_APP_ROOT="langfuse.internal.is_app_root",r.EXPERIMENT_ID="langfuse.experiment.id",r.EXPERIMENT_NAME="langfuse.experiment.name",r.EXPERIMENT_DESCRIPTION="langfuse.experiment.description",r.EXPERIMENT_METADATA="langfuse.experiment.metadata",r.EXPERIMENT_DATASET_ID="langfuse.experiment.dataset.id",r.EXPERIMENT_ITEM_ID="langfuse.experiment.item.id",r.EXPERIMENT_ITEM_EXPECTED_OUTPUT="langfuse.experiment.item.expected_output",r.EXPERIMENT_ITEM_METADATA="langfuse.experiment.item.metadata",r.EXPERIMENT_ITEM_ROOT_OBSERVATION_ID="langfuse.experiment.item.root_observation_id",r.TRACE_COMPAT_USER_ID="langfuse.user.id",r.TRACE_COMPAT_SESSION_ID="langfuse.session.id",r))(j||{}),ws={};O(ws,{AnnotationQueueObjectType:()=>ms,AnnotationQueueStatus:()=>hs});var hs={Pending:"PENDING",Completed:"COMPLETED"},ms={Trace:"TRACE",Observation:"OBSERVATION",Session:"SESSION"},_s={};O(_s,{BlobStorageExportFieldGroup:()=>Rs,BlobStorageExportFrequency:()=>bs,BlobStorageExportMode:()=>ys,BlobStorageExportSource:()=>vs,BlobStorageIntegrationFileType:()=>ps,BlobStorageIntegrationFileTypeResponse:()=>fs,BlobStorageIntegrationType:()=>gs,BlobStorageSyncStatus:()=>Ss});var gs={S3:"S3",S3Compatible:"S3_COMPATIBLE",AzureBlobStorage:"AZURE_BLOB_STORAGE"},ps={Json:"JSON",Csv:"CSV",Jsonl:"JSONL",Parquet:"PARQUET"},fs={Json:"JSON",Csv:"CSV",Jsonl:"JSONL",Parquet:"PARQUET"},ys={FullHistory:"FULL_HISTORY",FromToday:"FROM_TODAY",FromCustomDate:"FROM_CUSTOM_DATE"},bs={Every20Minutes:"every_20_minutes",Hourly:"hourly",Daily:"daily",Weekly:"weekly"},vs={LegacyTracesObservations:"LEGACY_TRACES_OBSERVATIONS",ObservationsV2:"OBSERVATIONS_V2",LegacyTracesAndEnrichedObservations:"LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS"},Rs={Core:"core",Basic:"basic",Time:"time",Io:"io",Metadata:"metadata",Model:"model",Usage:"usage",Prompt:"prompt",Metrics:"metrics",Tools:"tools",TraceContext:"trace_context"},Ss={Idle:"idle",Running:"running",Queued:"queued",UpToDate:"up_to_date",Disabled:"disabled",Error:"error"};var xs={};O(xs,{AccessDeniedError:()=>v,CommentObjectType:()=>As,DatasetItemMediaReferenceField:()=>Es,DatasetStatus:()=>Is,Error:()=>y,MethodNotAllowedError:()=>S,ModelUsageUnit:()=>Ps,NotFoundError:()=>R,ObservationLevel:()=>Cs,PricingTierAttributeSource:()=>Ts,PricingTierOperator:()=>Ls,ScoreConfigDataType:()=>Ns,ScoreDataType:()=>Ms,ScoreSource:()=>ks,UnauthorizedError:()=>b});var Es={Input:"input",ExpectedOutput:"expectedOutput",Metadata:"metadata"},Ts={ModelParameters:"model_parameters",Metadata:"metadata"},Ls={Gt:"gt",Gte:"gte",Lt:"lt",Lte:"lte",Eq:"eq",Neq:"neq"},Ps={Characters:"CHARACTERS",Tokens:"TOKENS",Milliseconds:"MILLISECONDS",Seconds:"SECONDS",Images:"IMAGES",Requests:"REQUESTS"},Cs={Debug:"DEBUG",Default:"DEFAULT",Warning:"WARNING",Error:"ERROR"},As={Trace:"TRACE",Observation:"OBSERVATION",Session:"SESSION",Prompt:"PROMPT"},Is={Active:"ACTIVE",Archived:"ARCHIVED"},ks={Annotation:"ANNOTATION",Api:"API",Eval:"EVAL"},Ns={Numeric:"NUMERIC",Boolean:"BOOLEAN",Categorical:"CATEGORICAL",Text:"TEXT"},Ms={Numeric:"NUMERIC",Boolean:"BOOLEAN",Categorical:"CATEGORICAL",Correction:"CORRECTION",Text:"TEXT"},Go=(r,e,t)=>JSON.stringify(r,e,t);function Bo(r,e){return JSON.parse(r,e)}var m=class na extends Error{constructor({message:e,statusCode:t,body:a,rawResponse:s}){super(Us({message:e,statusCode:t,body:a})),Object.setPrototypeOf(this,na.prototype),this.statusCode=t,this.body=a,this.rawResponse=s}};function Us({message:r,statusCode:e,body:t}){let a=[];return r!=null&&a.push(r),e!=null&&a.push(`Status code: ${e.toString()}`),t!=null&&a.push(`Body: ${Go(t,void 0,2)}`),a.join(`
4
+ import{Bc as It,Cc as kt,Hc as Nt,Oa as At}from"./chunk-ZESFB5XU.js";import{d as Io,f as Me,g as Mo,h as Vt,i as Oe,j as Pr,k as Bt,l as Ie,o as jt,p as Ft,q as $t,s as Wt,t as Qt,u as rr,v as Yt}from"./chunk-XQCCZYMT.js";import{a as Ht}from"./chunk-HRAX6543.js";import{b as qe,d as ns,h as xe,i as Dt,j as kr}from"./chunk-W2VWX7HR.js";import{a as zt,c as Cr,g as Uo,j as Kt,l as Ar,m as Xt,n as Ir,p as er,u as Gt,v as ss}from"./chunk-K6F424MN.js";import{b as Je,c as ko,d as Ze,e as No,f as Mt,l as Ut}from"./chunk-IQT2IFSO.js";import{a as Ne}from"./chunk-IO3PJG3N.js";import{c as ee,e as Se,f as Ae,g as Po,k as Lr,m as Co,o as te,p as M,r as Ao,s as be,t as Z}from"./chunk-5ZELCP2G.js";Z();var is=Object.defineProperty,O=(r,e)=>{for(var t in e)is(r,t,{get:e[t],enumerable:!0})};function oe(r){if(typeof process<"u"&&process.env[r])return process.env[r];if(typeof globalThis<"u")return globalThis[r]}function Ko(r){let e=atob(r);return Uint8Array.from(e,t=>t.codePointAt(0))}function Vo(r){let e=Array.from(r,t=>String.fromCharCode(t)).join("");return btoa(e)}function aa(r){if(typeof Buffer<"u")return Buffer.from(r,"utf8").toString("base64");let e=new TextEncoder().encode(r);return Vo(e)}var Xo=(r=>(r[r.NONE=4]="NONE",r[r.ERROR=3]="ERROR",r[r.WARN=2]="WARN",r[r.INFO=1]="INFO",r[r.DEBUG=0]="DEBUG",r))(Xo||{});function ls(){var r;if(typeof process=="object"&&"env"in process){if(((r=oe("LANGFUSE_DEBUG"))==null?void 0:r.toLowerCase())==="true")return 0;let e=oe("LANGFUSE_LOG_LEVEL");switch((e??"").toUpperCase()){case"NONE":return 4;case"ERROR":return 3;case"WARN":return 2;case"INFO":return 1;case"DEBUG":return 0;default:return}}}var Jt=class{constructor(r={level:1}){this.config={enableTimestamp:!0,...r}}shouldLog(r){return r>=this.config.level}formatMessage(r,e){let t=this.config.enableTimestamp?new Date().toISOString():"",a=this.config.prefix||"[Langfuse SDK]";return[t,a,`[${r}]`,e].filter(Boolean).join(" ")}error(r,...e){this.shouldLog(3)&&console.error(this.formatMessage("ERROR",r),...e)}warn(r,...e){this.shouldLog(2)&&console.warn(this.formatMessage("WARN",r),...e)}info(r,...e){this.shouldLog(1)&&console.info(this.formatMessage("INFO",r),...e)}debug(r,...e){this.shouldLog(0)&&console.debug(this.formatMessage("DEBUG",r),...e)}setLevel(r){this.config.level=r}getLevel(){return this.config.level}isLevelEnabled(r){return this.shouldLog(r)}},Zt,Do=class ve{static getInstance(){return ve.instance||(ve.instance=new Jt(ve.defaultConfig)),ve.instance}static configure(e){ve.defaultConfig=e,ve.instance=new Jt(e)}static reset(){ve.instance=null,ve.defaultConfig={level:1}}};Do.instance=null;Do.defaultConfig={level:(Zt=ls())!=null?Zt:1};var ds=Do;var re=()=>ds.getInstance();var us={name:"@langfuse/core",version:"5.14.0",description:"Core functions and utilities for Langfuse packages",type:"module",sideEffects:!1,main:"./dist/index.cjs",module:"./dist/index.mjs",types:"./dist/index.d.ts",exports:{".":{import:{types:"./dist/index.d.ts",default:"./dist/index.mjs"},require:{types:"./dist/index.d.cts",default:"./dist/index.cjs"}}},scripts:{build:"tsup",test:"vitest run","test:watch":"vitest",format:'prettier --write "src/**/*.ts"',"format:check":'prettier --check "src/**/*.ts"',clean:"rm -rf dist"},author:"Langfuse",license:"MIT",repository:{type:"git",url:"https://github.com/langfuse/langfuse-js.git",directory:"packages/core"},files:["dist"],peerDependencies:{"@opentelemetry/api":"^1.9.0"},devDependencies:{"@types/node":"^24.1.0"}},or="langfuse-sdk",tr=us.version;var cs="sdk-experiment",j=(r=>(r.TRACE_NAME="langfuse.trace.name",r.TRACE_USER_ID="user.id",r.TRACE_SESSION_ID="session.id",r.TRACE_TAGS="langfuse.trace.tags",r.TRACE_PUBLIC="langfuse.trace.public",r.TRACE_METADATA="langfuse.trace.metadata",r.TRACE_INPUT="langfuse.trace.input",r.TRACE_OUTPUT="langfuse.trace.output",r.OBSERVATION_TYPE="langfuse.observation.type",r.OBSERVATION_METADATA="langfuse.observation.metadata",r.OBSERVATION_LEVEL="langfuse.observation.level",r.OBSERVATION_STATUS_MESSAGE="langfuse.observation.status_message",r.OBSERVATION_INPUT="langfuse.observation.input",r.OBSERVATION_OUTPUT="langfuse.observation.output",r.OBSERVATION_COMPLETION_START_TIME="langfuse.observation.completion_start_time",r.OBSERVATION_MODEL="langfuse.observation.model.name",r.OBSERVATION_MODEL_PARAMETERS="langfuse.observation.model.parameters",r.OBSERVATION_USAGE_DETAILS="langfuse.observation.usage_details",r.OBSERVATION_COST_DETAILS="langfuse.observation.cost_details",r.OBSERVATION_PROMPT_NAME="langfuse.observation.prompt.name",r.OBSERVATION_PROMPT_VERSION="langfuse.observation.prompt.version",r.ENVIRONMENT="langfuse.environment",r.RELEASE="langfuse.release",r.VERSION="langfuse.version",r.AS_ROOT="langfuse.internal.as_root",r.IS_APP_ROOT="langfuse.internal.is_app_root",r.EXPERIMENT_ID="langfuse.experiment.id",r.EXPERIMENT_NAME="langfuse.experiment.name",r.EXPERIMENT_DESCRIPTION="langfuse.experiment.description",r.EXPERIMENT_METADATA="langfuse.experiment.metadata",r.EXPERIMENT_DATASET_ID="langfuse.experiment.dataset.id",r.EXPERIMENT_ITEM_ID="langfuse.experiment.item.id",r.EXPERIMENT_ITEM_EXPECTED_OUTPUT="langfuse.experiment.item.expected_output",r.EXPERIMENT_ITEM_METADATA="langfuse.experiment.item.metadata",r.EXPERIMENT_ITEM_ROOT_OBSERVATION_ID="langfuse.experiment.item.root_observation_id",r.TRACE_COMPAT_USER_ID="langfuse.user.id",r.TRACE_COMPAT_SESSION_ID="langfuse.session.id",r))(j||{}),ws={};O(ws,{AnnotationQueueObjectType:()=>ms,AnnotationQueueStatus:()=>hs});var hs={Pending:"PENDING",Completed:"COMPLETED"},ms={Trace:"TRACE",Observation:"OBSERVATION",Session:"SESSION"},_s={};O(_s,{BlobStorageExportFieldGroup:()=>Rs,BlobStorageExportFrequency:()=>bs,BlobStorageExportMode:()=>ys,BlobStorageExportSource:()=>vs,BlobStorageIntegrationFileType:()=>ps,BlobStorageIntegrationFileTypeResponse:()=>fs,BlobStorageIntegrationType:()=>gs,BlobStorageSyncStatus:()=>Ss});var gs={S3:"S3",S3Compatible:"S3_COMPATIBLE",AzureBlobStorage:"AZURE_BLOB_STORAGE"},ps={Json:"JSON",Csv:"CSV",Jsonl:"JSONL",Parquet:"PARQUET"},fs={Json:"JSON",Csv:"CSV",Jsonl:"JSONL",Parquet:"PARQUET"},ys={FullHistory:"FULL_HISTORY",FromToday:"FROM_TODAY",FromCustomDate:"FROM_CUSTOM_DATE"},bs={Every20Minutes:"every_20_minutes",Hourly:"hourly",Daily:"daily",Weekly:"weekly"},vs={LegacyTracesObservations:"LEGACY_TRACES_OBSERVATIONS",ObservationsV2:"OBSERVATIONS_V2",LegacyTracesAndEnrichedObservations:"LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS"},Rs={Core:"core",Basic:"basic",Time:"time",Io:"io",Metadata:"metadata",Model:"model",Usage:"usage",Prompt:"prompt",Metrics:"metrics",Tools:"tools",TraceContext:"trace_context"},Ss={Idle:"idle",Running:"running",Queued:"queued",UpToDate:"up_to_date",Disabled:"disabled",Error:"error"};var xs={};O(xs,{AccessDeniedError:()=>v,CommentObjectType:()=>As,DatasetItemMediaReferenceField:()=>Es,DatasetStatus:()=>Is,Error:()=>y,MethodNotAllowedError:()=>S,ModelUsageUnit:()=>Ps,NotFoundError:()=>R,ObservationLevel:()=>Cs,PricingTierAttributeSource:()=>Ts,PricingTierOperator:()=>Ls,ScoreConfigDataType:()=>Ns,ScoreDataType:()=>Ms,ScoreSource:()=>ks,UnauthorizedError:()=>b});var Es={Input:"input",ExpectedOutput:"expectedOutput",Metadata:"metadata"},Ts={ModelParameters:"model_parameters",Metadata:"metadata"},Ls={Gt:"gt",Gte:"gte",Lt:"lt",Lte:"lte",Eq:"eq",Neq:"neq"},Ps={Characters:"CHARACTERS",Tokens:"TOKENS",Milliseconds:"MILLISECONDS",Seconds:"SECONDS",Images:"IMAGES",Requests:"REQUESTS"},Cs={Debug:"DEBUG",Default:"DEFAULT",Warning:"WARNING",Error:"ERROR"},As={Trace:"TRACE",Observation:"OBSERVATION",Session:"SESSION",Prompt:"PROMPT"},Is={Active:"ACTIVE",Archived:"ARCHIVED"},ks={Annotation:"ANNOTATION",Api:"API",Eval:"EVAL"},Ns={Numeric:"NUMERIC",Boolean:"BOOLEAN",Categorical:"CATEGORICAL",Text:"TEXT"},Ms={Numeric:"NUMERIC",Boolean:"BOOLEAN",Categorical:"CATEGORICAL",Correction:"CORRECTION",Text:"TEXT"},Go=(r,e,t)=>JSON.stringify(r,e,t);function Bo(r,e){return JSON.parse(r,e)}var m=class na extends Error{constructor({message:e,statusCode:t,body:a,rawResponse:s}){super(Us({message:e,statusCode:t,body:a})),Object.setPrototypeOf(this,na.prototype),this.statusCode=t,this.body=a,this.rawResponse=s}};function Us({message:r,statusCode:e,body:t}){let a=[];return r!=null&&a.push(r),e!=null&&a.push(`Status code: ${e.toString()}`),t!=null&&a.push(`Body: ${Go(t,void 0,2)}`),a.join(`
5
5
  `)}var T=class sa extends Error{constructor(e){super(e),Object.setPrototypeOf(this,sa.prototype)}},y=class ia extends m{constructor(e,t){super({message:"Error",statusCode:400,body:e,rawResponse:t}),Object.setPrototypeOf(this,ia.prototype)}},b=class la extends m{constructor(e,t){super({message:"UnauthorizedError",statusCode:401,body:e,rawResponse:t}),Object.setPrototypeOf(this,la.prototype)}},v=class da extends m{constructor(e,t){super({message:"AccessDeniedError",statusCode:403,body:e,rawResponse:t}),Object.setPrototypeOf(this,da.prototype)}},R=class ua extends m{constructor(e,t){super({message:"NotFoundError",statusCode:404,body:e,rawResponse:t}),Object.setPrototypeOf(this,ua.prototype)}},S=class ca extends m{constructor(e,t){super({message:"MethodNotAllowedError",statusCode:405,body:e,rawResponse:t}),Object.setPrototypeOf(this,ca.prototype)}};var Vs={};O(Vs,{CodeEvaluatorSourceCodeLanguage:()=>js,EvaluationRuleArrayOptionsFilterOperator:()=>Fs,EvaluationRuleBooleanFilterOperator:()=>$s,EvaluationRuleNullFilterOperator:()=>Ws,EvaluationRuleNumberFilterOperator:()=>Gs,EvaluationRuleOptionsFilterOperator:()=>Hs,EvaluationRuleStringFilterOperator:()=>Xs,EvaluationRuleStringObjectFilterOperator:()=>Ds,EvaluatorOutputScoreType:()=>Ks,EvaluatorType:()=>Bs,LegacyEvaluationObject:()=>Qs,PromptVariableMappingSource:()=>zs});var Bs={LlmAsJudge:"llm_as_judge",Code:"code"},js={Python:"PYTHON",Typescript:"TYPESCRIPT"},zs={Input:"input",Output:"output",Metadata:"metadata",ToolCalls:"tool_calls",ExpectedOutput:"expected_output",ExperimentItemMetadata:"experiment_item_metadata"},Ks={Numeric:"NUMERIC",Boolean:"BOOLEAN",Categorical:"CATEGORICAL"},Xs={Equals:"=",Contains:"contains",DoesNotContain:"does not contain",StartsWith:"starts with",EndsWith:"ends with"},Ds={Equals:"=",Contains:"contains",DoesNotContain:"does not contain",StartsWith:"starts with",EndsWith:"ends with",IsSet:"is set",IsNotSet:"is not set"},Gs={Equals:"=",GreaterThan:">",LessThan:"<",GreaterThanOrEqual:">=",LessThanOrEqual:"<="},Hs={AnyOf:"any of",NoneOf:"none of"},Fs={AnyOf:"any of",NoneOf:"none of",AllOf:"all of"},$s={Equals:"=",NotEquals:"<>"},Ws={IsNull:"is null",IsNotNull:"is not null"},Qs={Trace:"trace",Span:"span",Generation:"generation",Event:"event",Agent:"agent",Tool:"tool",Chain:"chain",Retriever:"retriever",Evaluator:"evaluator",Embedding:"embedding",Guardrail:"guardrail",DatasetItem:"dataset_item"},Ys={};O(Ys,{BadRequestError:()=>Ee,ConflictError:()=>Mr,EvaluationAccessDeniedError:()=>le,EvaluationMethodNotAllowedError:()=>de,EvaluationNotFoundError:()=>Re,EvaluationUnauthorizedError:()=>ie,InternalServerError:()=>ce,PreconditionFailedError:()=>jo,PublicApiErrorCode:()=>Js,TooManyRequestsError:()=>ue});var Js={AuthenticationFailed:"authentication_failed",AccessDenied:"access_denied",InvalidRequest:"invalid_request",InvalidQuery:"invalid_query",InvalidBody:"invalid_body",ResourceNotFound:"resource_not_found",Conflict:"conflict",RateLimited:"rate_limited",MethodNotAllowed:"method_not_allowed",InternalError:"internal_error"},Ee=class wa extends m{constructor(e,t){super({message:"BadRequestError",statusCode:400,body:e,rawResponse:t}),Object.setPrototypeOf(this,wa.prototype)}},ie=class ha extends m{constructor(e,t){super({message:"EvaluationUnauthorizedError",statusCode:401,body:e,rawResponse:t}),Object.setPrototypeOf(this,ha.prototype)}},le=class ma extends m{constructor(e,t){super({message:"EvaluationAccessDeniedError",statusCode:403,body:e,rawResponse:t}),Object.setPrototypeOf(this,ma.prototype)}},Re=class _a extends m{constructor(e,t){super({message:"EvaluationNotFoundError",statusCode:404,body:e,rawResponse:t}),Object.setPrototypeOf(this,_a.prototype)}},de=class ga extends m{constructor(e,t){super({message:"EvaluationMethodNotAllowedError",statusCode:405,body:e,rawResponse:t}),Object.setPrototypeOf(this,ga.prototype)}},Mr=class pa extends m{constructor(e,t){super({message:"ConflictError",statusCode:409,body:e,rawResponse:t}),Object.setPrototypeOf(this,pa.prototype)}},jo=class fa extends m{constructor(e,t){super({message:"PreconditionFailedError",statusCode:412,body:e,rawResponse:t}),Object.setPrototypeOf(this,fa.prototype)}},ue=class ya extends m{constructor(e,t){super({message:"TooManyRequestsError",statusCode:429,body:e,rawResponse:t}),Object.setPrototypeOf(this,ya.prototype)}},ce=class ba extends m{constructor(e,t){super({message:"InternalServerError",statusCode:500,body:e,rawResponse:t}),Object.setPrototypeOf(this,ba.prototype)}};var Zs={};O(Zs,{EvaluatorChatMessageRole:()=>Os,EvaluatorStatus:()=>qs});var Os={System:"system",User:"user",Assistant:"assistant"},qs={Active:"active",Paused:"paused"};var ei={};O(ei,{FeedbackNotConfiguredError:()=>va,FeedbackTargetType:()=>ri});var ri={Skill:"skill",McpTool:"mcp-tool",Cli:"cli",Docs:"docs",PublicApi:"public-api",Other:"other"},va=class Ra extends m{constructor(e){super({message:"FeedbackNotConfiguredError",statusCode:409,rawResponse:e}),Object.setPrototypeOf(this,Ra.prototype)}},oi={};O(oi,{ServiceUnavailableError:()=>Sa});var Sa=class xa extends m{constructor(e){super({message:"ServiceUnavailableError",statusCode:503,rawResponse:e}),Object.setPrototypeOf(this,xa.prototype)}},ti={};O(ti,{ObservationType:()=>ai});var ai={Span:"SPAN",Generation:"GENERATION",Event:"EVENT",Agent:"AGENT",Tool:"TOOL",Chain:"CHAIN",Retriever:"RETRIEVER",Evaluator:"EVALUATOR",Embedding:"EMBEDDING",Guardrail:"GUARDRAIL"},ni={};O(ni,{CreateScoreSource:()=>Ho,metricsV1:()=>si,observationsV1:()=>ii,scoreV1:()=>Ea});var si={},ii={},Ea={};O(Ea,{CreateScoreSource:()=>Ho});var Ho={Api:"API",Annotation:"ANNOTATION"},li={};O(li,{LlmAdapter:()=>di});var di={Anthropic:"anthropic",OpenAi:"openai",Azure:"azure",Bedrock:"bedrock",GoogleVertexAi:"google-vertex-ai",GoogleAiStudio:"google-ai-studio"},ui={};O(ui,{MediaContentType:()=>ci});var ci={ImagePng:"image/png",ImageJpeg:"image/jpeg",ImageJpg:"image/jpg",ImageWebp:"image/webp",ImageGif:"image/gif",ImageSvgXml:"image/svg+xml",ImageTiff:"image/tiff",ImageBmp:"image/bmp",ImageAvif:"image/avif",ImageHeic:"image/heic",AudioMpeg:"audio/mpeg",AudioMp3:"audio/mp3",AudioWav:"audio/wav",AudioOgg:"audio/ogg",AudioOga:"audio/oga",AudioAac:"audio/aac",AudioMp4:"audio/mp4",AudioFlac:"audio/flac",AudioOpus:"audio/opus",AudioWebm:"audio/webm",VideoMp4:"video/mp4",VideoWebm:"video/webm",VideoOgg:"video/ogg",VideoMpeg:"video/mpeg",VideoQuicktime:"video/quicktime",VideoXMsvideo:"video/x-msvideo",VideoXMatroska:"video/x-matroska",TextPlain:"text/plain",TextHtml:"text/html",TextCss:"text/css",TextCsv:"text/csv",TextMarkdown:"text/markdown",TextXPython:"text/x-python",ApplicationJavascript:"application/javascript",TextXTypescript:"text/x-typescript",ApplicationXYaml:"application/x-yaml",ApplicationPdf:"application/pdf",ApplicationMsword:"application/msword",ApplicationMsExcel:"application/vnd.ms-excel",ApplicationOpenxmlSpreadsheet:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ApplicationZip:"application/zip",ApplicationJson:"application/json",ApplicationXml:"application/xml",ApplicationOctetStream:"application/octet-stream",ApplicationOpenxmlWord:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",ApplicationOpenxmlPresentation:"application/vnd.openxmlformats-officedocument.presentationml.presentation",ApplicationRtf:"application/rtf",ApplicationXNdjson:"application/x-ndjson",ApplicationParquet:"application/vnd.apache.parquet",ApplicationGzip:"application/gzip",ApplicationXTar:"application/x-tar",ApplicationX7ZCompressed:"application/x-7z-compressed"};var wi={};O(wi,{ModelTokenizerId:()=>hi});var hi={Openai:"openai",Claude:"claude"};var mi={};O(mi,{MembershipRole:()=>_i});var _i={Owner:"OWNER",Admin:"ADMIN",Member:"MEMBER",Viewer:"VIEWER"};var gi={};O(gi,{ChatMessageType:()=>fi,CreateChatPromptType:()=>bi,CreateTextPromptType:()=>vi,PlaceholderMessageType:()=>yi,PromptType:()=>pi});var pi={Chat:"chat",Text:"text"},fi={Chatmessage:"chatmessage"},yi={Placeholder:"placeholder"},bi={Chat:"chat"},vi={Text:"text"};var Ri={};O(Ri,{CreateScoreSource:()=>Ho});var I={};O(I,{AccessDeniedError:()=>ja,BadRequestError:()=>Ma,ConflictError:()=>Ha,DashboardWidgetChartType:()=>Ca,DashboardWidgetMetricAggregation:()=>Aa,DashboardWidgetSortOrder:()=>Ia,DashboardWidgetView:()=>La,DashboardWidgetViewWithLegacy:()=>Pa,InternalServerError:()=>Qa,MethodNotAllowedError:()=>Da,NotFoundError:()=>Ka,PublicApiErrorCode:()=>Na,TooManyRequestsError:()=>$a,UnauthorizedError:()=>Va,dashboardWidgets:()=>Ta,dashboards:()=>Si,errors:()=>ka});var Ta={};O(Ta,{DashboardWidgetChartType:()=>Ca,DashboardWidgetMetricAggregation:()=>Aa,DashboardWidgetSortOrder:()=>Ia,DashboardWidgetView:()=>La,DashboardWidgetViewWithLegacy:()=>Pa});var La={Observations:"observations",ScoresNumeric:"scores-numeric",ScoresBoolean:"scores-boolean",ScoresCategorical:"scores-categorical"},Pa={Observations:"observations",ScoresNumeric:"scores-numeric",ScoresBoolean:"scores-boolean",ScoresCategorical:"scores-categorical",Traces:"traces"},Ca={LineTimeSeries:"LINE_TIME_SERIES",AreaTimeSeries:"AREA_TIME_SERIES",BarTimeSeries:"BAR_TIME_SERIES",HorizontalBar:"HORIZONTAL_BAR",VerticalBar:"VERTICAL_BAR",Pie:"PIE",Number:"NUMBER",Histogram:"HISTOGRAM",PivotTable:"PIVOT_TABLE"},Aa={Sum:"sum",Avg:"avg",Count:"count",Max:"max",Min:"min",P50:"p50",P75:"p75",P90:"p90",P95:"p95",P99:"p99",Histogram:"histogram",Uniq:"uniq"},Ia={Asc:"ASC",Desc:"DESC"},Si={},ka={};O(ka,{AccessDeniedError:()=>ja,BadRequestError:()=>Ma,ConflictError:()=>Ha,InternalServerError:()=>Qa,MethodNotAllowedError:()=>Da,NotFoundError:()=>Ka,PublicApiErrorCode:()=>Na,TooManyRequestsError:()=>$a,UnauthorizedError:()=>Va});var Na={AuthenticationFailed:"authentication_failed",AccessDenied:"access_denied",InvalidRequest:"invalid_request",InvalidQuery:"invalid_query",InvalidBody:"invalid_body",ResourceNotFound:"resource_not_found",Conflict:"conflict",RateLimited:"rate_limited",MethodNotAllowed:"method_not_allowed",InternalError:"internal_error"},Ma=class Ua extends m{constructor(e,t){super({message:"BadRequestError",statusCode:400,body:e,rawResponse:t}),Object.setPrototypeOf(this,Ua.prototype)}},Va=class Ba extends m{constructor(e,t){super({message:"UnauthorizedError",statusCode:401,body:e,rawResponse:t}),Object.setPrototypeOf(this,Ba.prototype)}},ja=class za extends m{constructor(e,t){super({message:"AccessDeniedError",statusCode:403,body:e,rawResponse:t}),Object.setPrototypeOf(this,za.prototype)}},Ka=class Xa extends m{constructor(e,t){super({message:"NotFoundError",statusCode:404,body:e,rawResponse:t}),Object.setPrototypeOf(this,Xa.prototype)}},Da=class Ga extends m{constructor(e,t){super({message:"MethodNotAllowedError",statusCode:405,body:e,rawResponse:t}),Object.setPrototypeOf(this,Ga.prototype)}},Ha=class Fa extends m{constructor(e,t){super({message:"ConflictError",statusCode:409,body:e,rawResponse:t}),Object.setPrototypeOf(this,Fa.prototype)}},$a=class Wa extends m{constructor(e,t){super({message:"TooManyRequestsError",statusCode:429,body:e,rawResponse:t}),Object.setPrototypeOf(this,Wa.prototype)}},Qa=class Ya extends m{constructor(e,t){super({message:"InternalServerError",statusCode:500,body:e,rawResponse:t}),Object.setPrototypeOf(this,Ya.prototype)}},xi={};O(xi,{pagination:()=>Ei});var Ei={};function x(...r){let e={};for(let[t,a]of r.filter(s=>s!=null).flatMap(s=>Object.entries(s)))a!=null?e[t]=a:t in e&&delete e[t];return e}function L(...r){let e={};for(let[t,a]of r.filter(s=>s!=null).flatMap(s=>Object.entries(s)))a!=null&&(e[t]=a);return e}var Ti={arrayFormat:"indices",encode:!0};function Ot(r,e){if(r===void 0||r===null)return"";let t=String(r);return e?encodeURIComponent(t):t}function zo(r,e="",t){let a=[];for(let[s,i]of Object.entries(r)){let l=e?`${e}[${s}]`:s;if(i!==void 0)if(Array.isArray(i)){if(i.length===0)continue;for(let u=0;u<i.length;u++){let c=i[u];if(c!==void 0)if(typeof c=="object"&&!Array.isArray(c)&&c!==null){let w=t.arrayFormat==="indices"?`${l}[${u}]`:l;a.push(...zo(c,w,t))}else{let w=t.arrayFormat==="indices"?`${l}[${u}]`:l,d=t.encode?encodeURIComponent(w):w;a.push(`${d}=${Ot(c,t.encode)}`)}}}else if(typeof i=="object"&&i!==null){if(Object.keys(i).length===0)continue;a.push(...zo(i,l,t))}else{let u=t.encode?encodeURIComponent(l):l;a.push(`${u}=${Ot(i,t.encode)}`)}}return a}function Ja(r,e){return r==null||typeof r!="object"?"":zo(r,"",{...Ti,...e}).join("&")}function Li(r,e){let t=Ja(e,{arrayFormat:"repeat"});return t?`${r}?${t}`:r}function Pi(r){let e={get bodyUsed(){return r.bodyUsed},stream:()=>r.body,arrayBuffer:r.arrayBuffer.bind(r),blob:r.blob.bind(r)};return"bytes"in r&&typeof r.bytes=="function"&&(e.bytes=r.bytes.bind(r)),e}function Ci(r){return r.body!=null}async function Za(r,e){if(!Ci(r))return;switch(e){case"binary-response":return Pi(r);case"blob":return await r.blob();case"arrayBuffer":return await r.arrayBuffer();case"sse":return r.body;case"streaming":return r.body;case"text":return await r.text()}let t=await r.text();if(t.length>0)try{return Bo(t)}catch{return{ok:!1,error:{reason:"non-json",statusCode:r.status,rawBody:t}}}}async function Ai(r){var e,t,a;let s=(e=r.headers.get("Content-Type"))==null?void 0:e.toLowerCase();if(s==null||s.length===0)return Za(r);switch(s.indexOf(";")!==-1&&(s=(a=(t=s.split(";")[0])==null?void 0:t.trim())!=null?a:""),s){case"application/hal+json":case"application/json":case"application/ld+json":case"application/problem+json":case"application/vnd.api+json":case"text/json":let i=await r.text();return i.length>0?Bo(i):void 0;default:if(s.startsWith("application/vnd.")&&s.endsWith("+json")){let l=await r.text();return l.length>0?Bo(l):void 0}return await r.text()}}async function Ii(){return fetch}async function ki({body:r,type:e}){return e.includes("json")?Go(r):r}var Ni="timeout";function Mi(r){let e=new AbortController,t=setTimeout(()=>e.abort(Ni),r);return{signal:e.signal,abortId:t}}function Ui(...r){let e=r.length===1&&Array.isArray(r[0])?r[0]:r,t=new AbortController;for(let a of e){if(a.aborted){t.abort(a?.reason);break}a.addEventListener("abort",()=>t.abort(a?.reason),{signal:t.signal})}return t.signal}var Vi=async(r,e,t,a,s,i,l,u,c)=>{let w=[],d;if(i!=null){let{signal:g,abortId:h}=Mi(i);d=h,w.push(g)}l!=null&&w.push(l);let o=Ui(w),n=await r(e,{method:t,headers:a,body:s,signal:o,credentials:u?"include":void 0,duplex:c});return d!=null&&clearTimeout(d),n},Ur;typeof globalThis.Headers<"u"?Ur=globalThis.Headers:Ur=class Oa{constructor(e){if(this.headers=new Map,e)if(e instanceof Oa)e.forEach((t,a)=>this.append(a,t));else if(Array.isArray(e))for(let[t,a]of e)if(typeof t=="string"&&typeof a=="string")this.append(t,a);else throw new TypeError("Each header entry must be a [string, string] tuple");else for(let[t,a]of Object.entries(e))if(typeof a=="string")this.append(t,a);else throw new TypeError("Header values must be strings")}append(e,t){let a=e.toLowerCase(),s=this.headers.get(a)||[];this.headers.set(a,[...s,t])}delete(e){let t=e.toLowerCase();this.headers.delete(t)}get(e){let t=e.toLowerCase(),a=this.headers.get(t);return a?a.join(", "):null}has(e){let t=e.toLowerCase();return this.headers.has(t)}set(e,t){let a=e.toLowerCase();this.headers.set(a,[t])}forEach(e,t){let a=t?e.bind(t):e;this.headers.forEach((s,i)=>a(s.join(", "),i,this))}getSetCookie(){return this.headers.get("set-cookie")||[]}*entries(){for(let[e,t]of this.headers.entries())yield[e,t.join(", ")]}*keys(){yield*this.headers.keys()}*values(){for(let e of this.headers.values())yield e.join(", ")}[Symbol.iterator](){return this.entries()}};var qt={headers:new Ur,redirected:!1,status:499,statusText:"Client Closed Request",type:"error",url:""},ea={headers:new Ur,redirected:!1,status:0,statusText:"Unknown Error",type:"error",url:""};function ra(r){return{headers:r.headers,redirected:r.redirected,status:r.status,statusText:r.statusText,type:r.type,url:r.url}}var Bi=1e3,Nr=6e4,ji=2,qa=.2;function zi(r){let e=1+Math.random()*qa;return r*e}function Ki(r){let e=1+(Math.random()-.5)*qa;return r*e}function Xi(r,e){let t=r.headers.get("Retry-After");if(t){let s=parseInt(t,10);if(!isNaN(s)&&s>0)return Math.min(s*1e3,Nr);let i=new Date(t);if(!isNaN(i.getTime())){let l=i.getTime()-Date.now();if(l>0)return Math.min(Math.max(l,0),Nr)}}let a=r.headers.get("X-RateLimit-Reset");if(a){let s=parseInt(a,10);if(!isNaN(s)){let i=s*1e3-Date.now();if(i>0)return zi(Math.min(i,Nr))}}return Ki(Math.min(Bi*Math.pow(2,e),Nr))}async function Di(r,e=ji){let t=await r();for(let a=0;a<e&&([408,429].includes(t.status)||t.status>=500);++a){let s=Xi(t,a);await new Promise(i=>setTimeout(i,s)),t=await r()}return t}var _={get:async r=>typeof r=="function"?r():r};async function Gi(r){let e={};if(r.body!==void 0&&r.contentType!=null&&(e["Content-Type"]=r.contentType),r.headers==null)return e;for(let[t,a]of Object.entries(r.headers)){let s=await _.get(a);if(typeof s=="string"){e[t]=s;continue}s!=null&&(e[t]=`${s}`)}return e}async function Hi(r){let e=Li(r.url,r.queryParameters),t=await ki({body:r.body,type:r.requestType==="json"?"json":"other"}),a=await Ii();try{let s=await Di(async()=>Vi(a,e,r.method,await Gi(r),t,r.timeoutMs,r.abortSignal,r.withCredentials,r.duplex),r.maxRetries);return s.status>=200&&s.status<400?{ok:!0,body:await Za(s,r.responseType),headers:s.headers,rawResponse:ra(s)}:{ok:!1,error:{reason:"status-code",statusCode:s.status,body:await Ai(s)},rawResponse:ra(s)}}catch(s){return r.abortSignal!=null&&r.abortSignal.aborted?{ok:!1,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:qt}:s instanceof Error&&s.name==="AbortError"?{ok:!1,error:{reason:"timeout"},rawResponse:qt}:s instanceof Error?{ok:!1,error:{reason:"unknown",errorMessage:s.message},rawResponse:ea}:{ok:!1,error:{reason:"unknown",errorMessage:Go(s)},rawResponse:ea}}}var P=Hi,C=class Ue extends Promise{constructor(e){super(t=>{t(void 0)}),this.innerPromise=e}static fromFunction(e,...t){return new Ue(e(...t))}static interceptFunction(e){return(...t)=>Ue.fromPromise(e(...t))}static fromPromise(e){return new Ue(e)}static fromExecutor(e){let t=new Promise(e);return new Ue(t)}static fromResult(e){let t=Promise.resolve(e);return new Ue(t)}unwrap(){return this.unwrappedPromise||(this.unwrappedPromise=this.innerPromise.then(({data:e})=>e)),this.unwrappedPromise}then(e,t){return this.unwrap().then(e,t)}catch(e){return this.unwrap().catch(e)}finally(e){return this.unwrap().finally(e)}async withRawResponse(){return await this.innerPromise}},E={};O(E,{join:()=>Fi,toQueryString:()=>Ja});function Fi(r,...e){if(!r)return"";if(e.length===0)return r;if(r.includes("://")){let t;try{t=new URL(r)}catch{return oa(r,...e)}let a=e[e.length-1],s=a&&a.endsWith("/");for(let i of e){let l=rn(i);l&&(t.pathname=en(t.pathname,l))}return s&&!t.pathname.endsWith("/")&&(t.pathname+="/"),t.toString()}return oa(r,...e)}function oa(r,...e){if(e.length===0)return r;let t=r,a=e[e.length-1],s=a&&a.endsWith("/");for(let i of e){let l=rn(i);l&&(t=en(t,l))}return s&&!t.endsWith("/")&&(t+="/"),t}function en(r,e){return r.endsWith("/")?r+e:r+"/"+e}function rn(r){if(!r)return r;let e=0,t=r.length;return r.startsWith("/")&&(e=1),r.endsWith("/")&&(t=r.length-1),e===0&&t===r.length?r:r.slice(e,t)}function $i(r){let e=atob(r);return Uint8Array.from(e,t=>t.codePointAt(0))}function Wi(r){let e=String.fromCodePoint(...r);return btoa(e)}function Qi(r){if(typeof Buffer<"u")return Buffer.from(r,"utf8").toString("base64");let e=new TextEncoder().encode(r);return Wi(e)}function Yi(r){if(typeof Buffer<"u")return Buffer.from(r,"base64").toString("utf8");let e=$i(r);return new TextDecoder().decode(e)}var Ji=/^Basic /i,G={toAuthorizationHeader:r=>r==null?void 0:`Basic ${Qi(`${r.username}:${r.password}`)}`,fromAuthorizationHeader:r=>{let e=r.replace(Ji,""),t=Yi(e),[a,s]=t.split(":",2);if(a==null||s==null)throw new Error("Invalid basic auth");return{username:a,password:s}}},Zi=class{constructor(r){this._options=r}listQueues(r={},e){return C.fromPromise(this.__listQueues(r,e))}async __listQueues(r={},e){var t,a,s,i,l,u,c,w;let{page:d,limit:o}=r,n={};d!=null&&(n.page=d.toString()),o!=null&&(n.limit=o.toString());let g=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),h=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/annotation-queues"),method:"GET",headers:g,queryParameters:{...n,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(h.ok)return{data:h.body,rawResponse:h.rawResponse};if(h.error.reason==="status-code")switch(h.error.statusCode){case 400:throw new y(h.error.body,h.rawResponse);case 401:throw new b(h.error.body,h.rawResponse);case 403:throw new v(h.error.body,h.rawResponse);case 405:throw new S(h.error.body,h.rawResponse);case 404:throw new R(h.error.body,h.rawResponse);default:throw new m({statusCode:h.error.statusCode,body:h.error.body,rawResponse:h.rawResponse})}switch(h.error.reason){case"non-json":throw new m({statusCode:h.error.statusCode,body:h.error.rawBody,rawResponse:h.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/annotation-queues.");case"unknown":throw new m({message:h.error.errorMessage,rawResponse:h.rawResponse})}}createQueue(r,e){return C.fromPromise(this.__createQueue(r,e))}async __createQueue(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/annotation-queues"),method:"POST",headers:d,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling POST /api/public/annotation-queues.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getQueue(r,e){return C.fromPromise(this.__getQueue(r,e))}async __getQueue(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/annotation-queues/${encodeURIComponent(r)}`),method:"GET",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/annotation-queues/{queueId}.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}listQueueItems(r,e={},t){return C.fromPromise(this.__listQueueItems(r,e,t))}async __listQueueItems(r,e={},t){var a,s,i,l,u,c,w,d;let{status:o,page:n,limit:g}=e,h={};o!=null&&(h.status=o),n!=null&&(h.page=n.toString()),g!=null&&(h.limit=g.toString());let p=x((a=this._options)==null?void 0:a.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=t?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(u=t?.xLangfuseSdkVersion)!=null?u:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(w=t?.xLangfusePublicKey)!=null?w:(c=this._options)==null?void 0:c.xLangfusePublicKey}),t?.headers),f=await P({url:E.join((d=await _.get(this._options.baseUrl))!=null?d:await _.get(this._options.environment),`/api/public/annotation-queues/${encodeURIComponent(r)}/items`),method:"GET",headers:p,queryParameters:{...h,...t?.queryParams},timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(f.ok)return{data:f.body,rawResponse:f.rawResponse};if(f.error.reason==="status-code")switch(f.error.statusCode){case 400:throw new y(f.error.body,f.rawResponse);case 401:throw new b(f.error.body,f.rawResponse);case 403:throw new v(f.error.body,f.rawResponse);case 405:throw new S(f.error.body,f.rawResponse);case 404:throw new R(f.error.body,f.rawResponse);default:throw new m({statusCode:f.error.statusCode,body:f.error.body,rawResponse:f.rawResponse})}switch(f.error.reason){case"non-json":throw new m({statusCode:f.error.statusCode,body:f.error.rawBody,rawResponse:f.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/annotation-queues/{queueId}/items.");case"unknown":throw new m({message:f.error.errorMessage,rawResponse:f.rawResponse})}}getQueueItem(r,e,t){return C.fromPromise(this.__getQueueItem(r,e,t))}async __getQueueItem(r,e,t){var a,s,i,l,u,c,w,d;let o=x((a=this._options)==null?void 0:a.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=t?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(u=t?.xLangfuseSdkVersion)!=null?u:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(w=t?.xLangfusePublicKey)!=null?w:(c=this._options)==null?void 0:c.xLangfusePublicKey}),t?.headers),n=await P({url:E.join((d=await _.get(this._options.baseUrl))!=null?d:await _.get(this._options.environment),`/api/public/annotation-queues/${encodeURIComponent(r)}/items/${encodeURIComponent(e)}`),method:"GET",headers:o,queryParameters:t?.queryParams,timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new y(n.error.body,n.rawResponse);case 401:throw new b(n.error.body,n.rawResponse);case 403:throw new v(n.error.body,n.rawResponse);case 405:throw new S(n.error.body,n.rawResponse);case 404:throw new R(n.error.body,n.rawResponse);default:throw new m({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new m({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/annotation-queues/{queueId}/items/{itemId}.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}createQueueItem(r,e,t){return C.fromPromise(this.__createQueueItem(r,e,t))}async __createQueueItem(r,e,t){var a,s,i,l,u,c,w,d;let o=x((a=this._options)==null?void 0:a.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=t?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(u=t?.xLangfuseSdkVersion)!=null?u:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(w=t?.xLangfusePublicKey)!=null?w:(c=this._options)==null?void 0:c.xLangfusePublicKey}),t?.headers),n=await P({url:E.join((d=await _.get(this._options.baseUrl))!=null?d:await _.get(this._options.environment),`/api/public/annotation-queues/${encodeURIComponent(r)}/items`),method:"POST",headers:o,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:e,timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new y(n.error.body,n.rawResponse);case 401:throw new b(n.error.body,n.rawResponse);case 403:throw new v(n.error.body,n.rawResponse);case 405:throw new S(n.error.body,n.rawResponse);case 404:throw new R(n.error.body,n.rawResponse);default:throw new m({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new m({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new T("Timeout exceeded when calling POST /api/public/annotation-queues/{queueId}/items.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}updateQueueItem(r,e,t,a){return C.fromPromise(this.__updateQueueItem(r,e,t,a))}async __updateQueueItem(r,e,t,a){var s,i,l,u,c,w,d,o;let n=x((s=this._options)==null?void 0:s.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(l=a?.xLangfuseSdkName)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(c=a?.xLangfuseSdkVersion)!=null?c:(u=this._options)==null?void 0:u.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(d=a?.xLangfusePublicKey)!=null?d:(w=this._options)==null?void 0:w.xLangfusePublicKey}),a?.headers),g=await P({url:E.join((o=await _.get(this._options.baseUrl))!=null?o:await _.get(this._options.environment),`/api/public/annotation-queues/${encodeURIComponent(r)}/items/${encodeURIComponent(e)}`),method:"PATCH",headers:n,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:t,timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.abortSignal});if(g.ok)return{data:g.body,rawResponse:g.rawResponse};if(g.error.reason==="status-code")switch(g.error.statusCode){case 400:throw new y(g.error.body,g.rawResponse);case 401:throw new b(g.error.body,g.rawResponse);case 403:throw new v(g.error.body,g.rawResponse);case 405:throw new S(g.error.body,g.rawResponse);case 404:throw new R(g.error.body,g.rawResponse);default:throw new m({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}switch(g.error.reason){case"non-json":throw new m({statusCode:g.error.statusCode,body:g.error.rawBody,rawResponse:g.rawResponse});case"timeout":throw new T("Timeout exceeded when calling PATCH /api/public/annotation-queues/{queueId}/items/{itemId}.");case"unknown":throw new m({message:g.error.errorMessage,rawResponse:g.rawResponse})}}deleteQueueItem(r,e,t){return C.fromPromise(this.__deleteQueueItem(r,e,t))}async __deleteQueueItem(r,e,t){var a,s,i,l,u,c,w,d;let o=x((a=this._options)==null?void 0:a.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=t?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(u=t?.xLangfuseSdkVersion)!=null?u:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(w=t?.xLangfusePublicKey)!=null?w:(c=this._options)==null?void 0:c.xLangfusePublicKey}),t?.headers),n=await P({url:E.join((d=await _.get(this._options.baseUrl))!=null?d:await _.get(this._options.environment),`/api/public/annotation-queues/${encodeURIComponent(r)}/items/${encodeURIComponent(e)}`),method:"DELETE",headers:o,queryParameters:t?.queryParams,timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new y(n.error.body,n.rawResponse);case 401:throw new b(n.error.body,n.rawResponse);case 403:throw new v(n.error.body,n.rawResponse);case 405:throw new S(n.error.body,n.rawResponse);case 404:throw new R(n.error.body,n.rawResponse);default:throw new m({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new m({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new T("Timeout exceeded when calling DELETE /api/public/annotation-queues/{queueId}/items/{itemId}.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}createQueueAssignment(r,e,t){return C.fromPromise(this.__createQueueAssignment(r,e,t))}async __createQueueAssignment(r,e,t){var a,s,i,l,u,c,w,d;let o=x((a=this._options)==null?void 0:a.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=t?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(u=t?.xLangfuseSdkVersion)!=null?u:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(w=t?.xLangfusePublicKey)!=null?w:(c=this._options)==null?void 0:c.xLangfusePublicKey}),t?.headers),n=await P({url:E.join((d=await _.get(this._options.baseUrl))!=null?d:await _.get(this._options.environment),`/api/public/annotation-queues/${encodeURIComponent(r)}/assignments`),method:"POST",headers:o,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:e,timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new y(n.error.body,n.rawResponse);case 401:throw new b(n.error.body,n.rawResponse);case 403:throw new v(n.error.body,n.rawResponse);case 405:throw new S(n.error.body,n.rawResponse);case 404:throw new R(n.error.body,n.rawResponse);default:throw new m({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new m({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new T("Timeout exceeded when calling POST /api/public/annotation-queues/{queueId}/assignments.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}deleteQueueAssignment(r,e,t){return C.fromPromise(this.__deleteQueueAssignment(r,e,t))}async __deleteQueueAssignment(r,e,t){var a,s,i,l,u,c,w,d;let o=x((a=this._options)==null?void 0:a.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=t?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(u=t?.xLangfuseSdkVersion)!=null?u:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(w=t?.xLangfusePublicKey)!=null?w:(c=this._options)==null?void 0:c.xLangfusePublicKey}),t?.headers),n=await P({url:E.join((d=await _.get(this._options.baseUrl))!=null?d:await _.get(this._options.environment),`/api/public/annotation-queues/${encodeURIComponent(r)}/assignments`),method:"DELETE",headers:o,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:e,timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new y(n.error.body,n.rawResponse);case 401:throw new b(n.error.body,n.rawResponse);case 403:throw new v(n.error.body,n.rawResponse);case 405:throw new S(n.error.body,n.rawResponse);case 404:throw new R(n.error.body,n.rawResponse);default:throw new m({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new m({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new T("Timeout exceeded when calling DELETE /api/public/annotation-queues/{queueId}/assignments.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},Oi=class{constructor(r){this._options=r}getBlobStorageIntegrations(r){return C.fromPromise(this.__getBlobStorageIntegrations(r))}async __getBlobStorageIntegrations(r){var e,t,a,s,i,l,u,c;let w=x((e=this._options)==null?void 0:e.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(a=r?.xLangfuseSdkName)!=null?a:(t=this._options)==null?void 0:t.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(i=r?.xLangfuseSdkVersion)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(u=r?.xLangfusePublicKey)!=null?u:(l=this._options)==null?void 0:l.xLangfusePublicKey}),r?.headers),d=await P({url:E.join((c=await _.get(this._options.baseUrl))!=null?c:await _.get(this._options.environment),"/api/public/integrations/blob-storage"),method:"GET",headers:w,queryParameters:r?.queryParams,timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new y(d.error.body,d.rawResponse);case 401:throw new b(d.error.body,d.rawResponse);case 403:throw new v(d.error.body,d.rawResponse);case 405:throw new S(d.error.body,d.rawResponse);case 404:throw new R(d.error.body,d.rawResponse);default:throw new m({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new m({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/integrations/blob-storage.");case"unknown":throw new m({message:d.error.errorMessage,rawResponse:d.rawResponse})}}upsertBlobStorageIntegration(r,e){return C.fromPromise(this.__upsertBlobStorageIntegration(r,e))}async __upsertBlobStorageIntegration(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/integrations/blob-storage"),method:"PUT",headers:d,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling PUT /api/public/integrations/blob-storage.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getBlobStorageIntegrationStatus(r,e){return C.fromPromise(this.__getBlobStorageIntegrationStatus(r,e))}async __getBlobStorageIntegrationStatus(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/integrations/blob-storage/${encodeURIComponent(r)}`),method:"GET",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/integrations/blob-storage/{id}.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteBlobStorageIntegration(r,e){return C.fromPromise(this.__deleteBlobStorageIntegration(r,e))}async __deleteBlobStorageIntegration(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/integrations/blob-storage/${encodeURIComponent(r)}`),method:"DELETE",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling DELETE /api/public/integrations/blob-storage/{id}.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},qi=class{constructor(r){this._options=r}create(r,e){return C.fromPromise(this.__create(r,e))}async __create(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/comments"),method:"POST",headers:d,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling POST /api/public/comments.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}get(r={},e){return C.fromPromise(this.__get(r,e))}async __get(r={},e){var t,a,s,i,l,u,c,w;let{page:d,limit:o,objectType:n,objectId:g,authorUserId:h}=r,p={};d!=null&&(p.page=d.toString()),o!=null&&(p.limit=o.toString()),n!=null&&(p.objectType=n),g!=null&&(p.objectId=g),h!=null&&(p.authorUserId=h);let f=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),A=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/comments"),method:"GET",headers:f,queryParameters:{...p,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(A.ok)return{data:A.body,rawResponse:A.rawResponse};if(A.error.reason==="status-code")switch(A.error.statusCode){case 400:throw new y(A.error.body,A.rawResponse);case 401:throw new b(A.error.body,A.rawResponse);case 403:throw new v(A.error.body,A.rawResponse);case 405:throw new S(A.error.body,A.rawResponse);case 404:throw new R(A.error.body,A.rawResponse);default:throw new m({statusCode:A.error.statusCode,body:A.error.body,rawResponse:A.rawResponse})}switch(A.error.reason){case"non-json":throw new m({statusCode:A.error.statusCode,body:A.error.rawBody,rawResponse:A.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/comments.");case"unknown":throw new m({message:A.error.errorMessage,rawResponse:A.rawResponse})}}getById(r,e){return C.fromPromise(this.__getById(r,e))}async __getById(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/comments/${encodeURIComponent(r)}`),method:"GET",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/comments/{commentId}.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},el=class{constructor(r){this._options=r}create(r,e){return C.fromPromise(this.__create(r,e))}async __create(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/dataset-items"),method:"POST",headers:d,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling POST /api/public/dataset-items.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}get(r,e){return C.fromPromise(this.__get(r,e))}async __get(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/dataset-items/${encodeURIComponent(r)}`),method:"GET",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/dataset-items/{id}.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}list(r={},e){return C.fromPromise(this.__list(r,e))}async __list(r={},e){var t,a,s,i,l,u,c,w;let{datasetName:d,sourceTraceId:o,sourceObservationId:n,version:g,page:h,limit:p}=r,f={};d!=null&&(f.datasetName=d),o!=null&&(f.sourceTraceId=o),n!=null&&(f.sourceObservationId=n),g!=null&&(f.version=g),h!=null&&(f.page=h.toString()),p!=null&&(f.limit=p.toString());let A=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),k=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/dataset-items"),method:"GET",headers:A,queryParameters:{...f,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(k.ok)return{data:k.body,rawResponse:k.rawResponse};if(k.error.reason==="status-code")switch(k.error.statusCode){case 400:throw new y(k.error.body,k.rawResponse);case 401:throw new b(k.error.body,k.rawResponse);case 403:throw new v(k.error.body,k.rawResponse);case 405:throw new S(k.error.body,k.rawResponse);case 404:throw new R(k.error.body,k.rawResponse);default:throw new m({statusCode:k.error.statusCode,body:k.error.body,rawResponse:k.rawResponse})}switch(k.error.reason){case"non-json":throw new m({statusCode:k.error.statusCode,body:k.error.rawBody,rawResponse:k.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/dataset-items.");case"unknown":throw new m({message:k.error.errorMessage,rawResponse:k.rawResponse})}}delete(r,e){return C.fromPromise(this.__delete(r,e))}async __delete(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/dataset-items/${encodeURIComponent(r)}`),method:"DELETE",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling DELETE /api/public/dataset-items/{id}.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},rl=class{constructor(r){this._options=r}create(r,e){return C.fromPromise(this.__create(r,e))}async __create(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/dataset-run-items"),method:"POST",headers:d,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling POST /api/public/dataset-run-items.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}list(r,e){return C.fromPromise(this.__list(r,e))}async __list(r,e){var t,a,s,i,l,u,c,w;let{datasetId:d,runName:o,page:n,limit:g}=r,h={};h.datasetId=d,h.runName=o,n!=null&&(h.page=n.toString()),g!=null&&(h.limit=g.toString());let p=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),f=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/dataset-run-items"),method:"GET",headers:p,queryParameters:{...h,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(f.ok)return{data:f.body,rawResponse:f.rawResponse};if(f.error.reason==="status-code")switch(f.error.statusCode){case 400:throw new y(f.error.body,f.rawResponse);case 401:throw new b(f.error.body,f.rawResponse);case 403:throw new v(f.error.body,f.rawResponse);case 405:throw new S(f.error.body,f.rawResponse);case 404:throw new R(f.error.body,f.rawResponse);default:throw new m({statusCode:f.error.statusCode,body:f.error.body,rawResponse:f.rawResponse})}switch(f.error.reason){case"non-json":throw new m({statusCode:f.error.statusCode,body:f.error.rawBody,rawResponse:f.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/dataset-run-items.");case"unknown":throw new m({message:f.error.errorMessage,rawResponse:f.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},ol=class{constructor(r){this._options=r}list(r={},e){return C.fromPromise(this.__list(r,e))}async __list(r={},e){var t,a,s,i,l,u,c,w;let{page:d,limit:o}=r,n={};d!=null&&(n.page=d.toString()),o!=null&&(n.limit=o.toString());let g=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),h=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/v2/datasets"),method:"GET",headers:g,queryParameters:{...n,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(h.ok)return{data:h.body,rawResponse:h.rawResponse};if(h.error.reason==="status-code")switch(h.error.statusCode){case 400:throw new y(h.error.body,h.rawResponse);case 401:throw new b(h.error.body,h.rawResponse);case 403:throw new v(h.error.body,h.rawResponse);case 405:throw new S(h.error.body,h.rawResponse);case 404:throw new R(h.error.body,h.rawResponse);default:throw new m({statusCode:h.error.statusCode,body:h.error.body,rawResponse:h.rawResponse})}switch(h.error.reason){case"non-json":throw new m({statusCode:h.error.statusCode,body:h.error.rawBody,rawResponse:h.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/v2/datasets.");case"unknown":throw new m({message:h.error.errorMessage,rawResponse:h.rawResponse})}}get(r,e){return C.fromPromise(this.__get(r,e))}async __get(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/v2/datasets/${encodeURIComponent(r)}`),method:"GET",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/v2/datasets/{datasetName}.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}create(r,e){return C.fromPromise(this.__create(r,e))}async __create(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/v2/datasets"),method:"POST",headers:d,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling POST /api/public/v2/datasets.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getRun(r,e,t){return C.fromPromise(this.__getRun(r,e,t))}async __getRun(r,e,t){var a,s,i,l,u,c,w,d;let o=x((a=this._options)==null?void 0:a.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=t?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(u=t?.xLangfuseSdkVersion)!=null?u:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(w=t?.xLangfusePublicKey)!=null?w:(c=this._options)==null?void 0:c.xLangfusePublicKey}),t?.headers),n=await P({url:E.join((d=await _.get(this._options.baseUrl))!=null?d:await _.get(this._options.environment),`/api/public/datasets/${encodeURIComponent(r)}/runs/${encodeURIComponent(e)}`),method:"GET",headers:o,queryParameters:t?.queryParams,timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new y(n.error.body,n.rawResponse);case 401:throw new b(n.error.body,n.rawResponse);case 403:throw new v(n.error.body,n.rawResponse);case 405:throw new S(n.error.body,n.rawResponse);case 404:throw new R(n.error.body,n.rawResponse);default:throw new m({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new m({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/datasets/{datasetName}/runs/{runName}.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}deleteRun(r,e,t){return C.fromPromise(this.__deleteRun(r,e,t))}async __deleteRun(r,e,t){var a,s,i,l,u,c,w,d;let o=x((a=this._options)==null?void 0:a.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=t?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(u=t?.xLangfuseSdkVersion)!=null?u:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(w=t?.xLangfusePublicKey)!=null?w:(c=this._options)==null?void 0:c.xLangfusePublicKey}),t?.headers),n=await P({url:E.join((d=await _.get(this._options.baseUrl))!=null?d:await _.get(this._options.environment),`/api/public/datasets/${encodeURIComponent(r)}/runs/${encodeURIComponent(e)}`),method:"DELETE",headers:o,queryParameters:t?.queryParams,timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new y(n.error.body,n.rawResponse);case 401:throw new b(n.error.body,n.rawResponse);case 403:throw new v(n.error.body,n.rawResponse);case 405:throw new S(n.error.body,n.rawResponse);case 404:throw new R(n.error.body,n.rawResponse);default:throw new m({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new m({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new T("Timeout exceeded when calling DELETE /api/public/datasets/{datasetName}/runs/{runName}.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getRuns(r,e={},t){return C.fromPromise(this.__getRuns(r,e,t))}async __getRuns(r,e={},t){var a,s,i,l,u,c,w,d;let{page:o,limit:n}=e,g={};o!=null&&(g.page=o.toString()),n!=null&&(g.limit=n.toString());let h=x((a=this._options)==null?void 0:a.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=t?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(u=t?.xLangfuseSdkVersion)!=null?u:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(w=t?.xLangfusePublicKey)!=null?w:(c=this._options)==null?void 0:c.xLangfusePublicKey}),t?.headers),p=await P({url:E.join((d=await _.get(this._options.baseUrl))!=null?d:await _.get(this._options.environment),`/api/public/datasets/${encodeURIComponent(r)}/runs`),method:"GET",headers:h,queryParameters:{...g,...t?.queryParams},timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new y(p.error.body,p.rawResponse);case 401:throw new b(p.error.body,p.rawResponse);case 403:throw new v(p.error.body,p.rawResponse);case 405:throw new S(p.error.body,p.rawResponse);case 404:throw new R(p.error.body,p.rawResponse);default:throw new m({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new m({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/datasets/{datasetName}/runs.");case"unknown":throw new m({message:p.error.errorMessage,rawResponse:p.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},tl=class{constructor(r){this._options=r}create(r,e){return C.fromPromise(this.__create(r,e))}async __create(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/v2/evaluation-rules"),method:"POST",headers:d,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new Ee(o.error.body,o.rawResponse);case 401:throw new ie(o.error.body,o.rawResponse);case 403:throw new le(o.error.body,o.rawResponse);case 404:throw new Re(o.error.body,o.rawResponse);case 405:throw new de(o.error.body,o.rawResponse);case 409:throw new Mr(o.error.body,o.rawResponse);case 429:throw new ue(o.error.body,o.rawResponse);case 500:throw new ce(o.error.body,o.rawResponse);case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling POST /api/public/v2/evaluation-rules.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}list(r={},e){return C.fromPromise(this.__list(r,e))}async __list(r={},e){var t,a,s,i,l,u,c,w;let{limit:d,cursor:o}=r,n={};d!=null&&(n.limit=d.toString()),o!=null&&(n.cursor=o);let g=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),h=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/v2/evaluation-rules"),method:"GET",headers:g,queryParameters:{...n,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(h.ok)return{data:h.body,rawResponse:h.rawResponse};if(h.error.reason==="status-code")switch(h.error.statusCode){case 400:throw new Ee(h.error.body,h.rawResponse);case 401:throw new ie(h.error.body,h.rawResponse);case 403:throw new le(h.error.body,h.rawResponse);case 405:throw new de(h.error.body,h.rawResponse);case 429:throw new ue(h.error.body,h.rawResponse);case 500:throw new ce(h.error.body,h.rawResponse);case 400:throw new y(h.error.body,h.rawResponse);case 401:throw new b(h.error.body,h.rawResponse);case 403:throw new v(h.error.body,h.rawResponse);case 405:throw new S(h.error.body,h.rawResponse);case 404:throw new R(h.error.body,h.rawResponse);default:throw new m({statusCode:h.error.statusCode,body:h.error.body,rawResponse:h.rawResponse})}switch(h.error.reason){case"non-json":throw new m({statusCode:h.error.statusCode,body:h.error.rawBody,rawResponse:h.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/v2/evaluation-rules.");case"unknown":throw new m({message:h.error.errorMessage,rawResponse:h.rawResponse})}}get(r,e){return C.fromPromise(this.__get(r,e))}async __get(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/v2/evaluation-rules/${encodeURIComponent(r)}`),method:"GET",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new ie(o.error.body,o.rawResponse);case 403:throw new le(o.error.body,o.rawResponse);case 404:throw new Re(o.error.body,o.rawResponse);case 405:throw new de(o.error.body,o.rawResponse);case 429:throw new ue(o.error.body,o.rawResponse);case 500:throw new ce(o.error.body,o.rawResponse);case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/v2/evaluation-rules/{evaluationRuleId}.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}update(r,e,t){return C.fromPromise(this.__update(r,e,t))}async __update(r,e,t){var a,s,i,l,u,c,w,d;let o=x((a=this._options)==null?void 0:a.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=t?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(u=t?.xLangfuseSdkVersion)!=null?u:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(w=t?.xLangfusePublicKey)!=null?w:(c=this._options)==null?void 0:c.xLangfusePublicKey}),t?.headers),n=await P({url:E.join((d=await _.get(this._options.baseUrl))!=null?d:await _.get(this._options.environment),`/api/public/v2/evaluation-rules/${encodeURIComponent(r)}`),method:"PATCH",headers:o,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:e,timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new Ee(n.error.body,n.rawResponse);case 401:throw new ie(n.error.body,n.rawResponse);case 403:throw new le(n.error.body,n.rawResponse);case 404:throw new Re(n.error.body,n.rawResponse);case 405:throw new de(n.error.body,n.rawResponse);case 409:throw new Mr(n.error.body,n.rawResponse);case 429:throw new ue(n.error.body,n.rawResponse);case 500:throw new ce(n.error.body,n.rawResponse);case 400:throw new y(n.error.body,n.rawResponse);case 401:throw new b(n.error.body,n.rawResponse);case 403:throw new v(n.error.body,n.rawResponse);case 405:throw new S(n.error.body,n.rawResponse);case 404:throw new R(n.error.body,n.rawResponse);default:throw new m({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new m({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new T("Timeout exceeded when calling PATCH /api/public/v2/evaluation-rules/{evaluationRuleId}.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}delete(r,e){return C.fromPromise(this.__delete(r,e))}async __delete(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/v2/evaluation-rules/${encodeURIComponent(r)}`),method:"DELETE",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new ie(o.error.body,o.rawResponse);case 403:throw new le(o.error.body,o.rawResponse);case 404:throw new Re(o.error.body,o.rawResponse);case 405:throw new de(o.error.body,o.rawResponse);case 429:throw new ue(o.error.body,o.rawResponse);case 500:throw new ce(o.error.body,o.rawResponse);case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling DELETE /api/public/v2/evaluation-rules/{evaluationRuleId}.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},al=class{constructor(r){this._options=r}create(r,e){return C.fromPromise(this.__create(r,e))}async __create(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/v2/evaluators"),method:"POST",headers:d,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new Ee(o.error.body,o.rawResponse);case 401:throw new ie(o.error.body,o.rawResponse);case 403:throw new le(o.error.body,o.rawResponse);case 405:throw new de(o.error.body,o.rawResponse);case 412:throw new jo(o.error.body,o.rawResponse);case 429:throw new ue(o.error.body,o.rawResponse);case 500:throw new ce(o.error.body,o.rawResponse);case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling POST /api/public/v2/evaluators.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}list(r={},e){return C.fromPromise(this.__list(r,e))}async __list(r={},e){var t,a,s,i,l,u,c,w;let{limit:d,cursor:o}=r,n={};d!=null&&(n.limit=d.toString()),o!=null&&(n.cursor=o);let g=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),h=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/v2/evaluators"),method:"GET",headers:g,queryParameters:{...n,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(h.ok)return{data:h.body,rawResponse:h.rawResponse};if(h.error.reason==="status-code")switch(h.error.statusCode){case 400:throw new Ee(h.error.body,h.rawResponse);case 401:throw new ie(h.error.body,h.rawResponse);case 403:throw new le(h.error.body,h.rawResponse);case 405:throw new de(h.error.body,h.rawResponse);case 429:throw new ue(h.error.body,h.rawResponse);case 500:throw new ce(h.error.body,h.rawResponse);case 400:throw new y(h.error.body,h.rawResponse);case 401:throw new b(h.error.body,h.rawResponse);case 403:throw new v(h.error.body,h.rawResponse);case 405:throw new S(h.error.body,h.rawResponse);case 404:throw new R(h.error.body,h.rawResponse);default:throw new m({statusCode:h.error.statusCode,body:h.error.body,rawResponse:h.rawResponse})}switch(h.error.reason){case"non-json":throw new m({statusCode:h.error.statusCode,body:h.error.rawBody,rawResponse:h.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/v2/evaluators.");case"unknown":throw new m({message:h.error.errorMessage,rawResponse:h.rawResponse})}}get(r,e){return C.fromPromise(this.__get(r,e))}async __get(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/v2/evaluators/${encodeURIComponent(r)}`),method:"GET",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new ie(o.error.body,o.rawResponse);case 403:throw new le(o.error.body,o.rawResponse);case 404:throw new Re(o.error.body,o.rawResponse);case 405:throw new de(o.error.body,o.rawResponse);case 429:throw new ue(o.error.body,o.rawResponse);case 500:throw new ce(o.error.body,o.rawResponse);case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/v2/evaluators/{evaluatorId}.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}update(r,e,t){return C.fromPromise(this.__update(r,e,t))}async __update(r,e,t){var a,s,i,l,u,c,w,d;let o=x((a=this._options)==null?void 0:a.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=t?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(u=t?.xLangfuseSdkVersion)!=null?u:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(w=t?.xLangfusePublicKey)!=null?w:(c=this._options)==null?void 0:c.xLangfusePublicKey}),t?.headers),n=await P({url:E.join((d=await _.get(this._options.baseUrl))!=null?d:await _.get(this._options.environment),`/api/public/v2/evaluators/${encodeURIComponent(r)}`),method:"PATCH",headers:o,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:e,timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new Ee(n.error.body,n.rawResponse);case 401:throw new ie(n.error.body,n.rawResponse);case 403:throw new le(n.error.body,n.rawResponse);case 404:throw new Re(n.error.body,n.rawResponse);case 405:throw new de(n.error.body,n.rawResponse);case 409:throw new Mr(n.error.body,n.rawResponse);case 412:throw new jo(n.error.body,n.rawResponse);case 429:throw new ue(n.error.body,n.rawResponse);case 500:throw new ce(n.error.body,n.rawResponse);case 400:throw new y(n.error.body,n.rawResponse);case 401:throw new b(n.error.body,n.rawResponse);case 403:throw new v(n.error.body,n.rawResponse);case 405:throw new S(n.error.body,n.rawResponse);case 404:throw new R(n.error.body,n.rawResponse);default:throw new m({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new m({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new T("Timeout exceeded when calling PATCH /api/public/v2/evaluators/{evaluatorId}.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}delete(r,e){return C.fromPromise(this.__delete(r,e))}async __delete(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/v2/evaluators/${encodeURIComponent(r)}`),method:"DELETE",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new ie(o.error.body,o.rawResponse);case 403:throw new le(o.error.body,o.rawResponse);case 404:throw new Re(o.error.body,o.rawResponse);case 405:throw new de(o.error.body,o.rawResponse);case 429:throw new ue(o.error.body,o.rawResponse);case 500:throw new ce(o.error.body,o.rawResponse);case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling DELETE /api/public/v2/evaluators/{evaluatorId}.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}listVersions(r,e={},t){return C.fromPromise(this.__listVersions(r,e,t))}async __listVersions(r,e={},t){var a,s,i,l,u,c,w,d;let{limit:o,cursor:n}=e,g={};o!=null&&(g.limit=o.toString()),n!=null&&(g.cursor=n);let h=x((a=this._options)==null?void 0:a.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=t?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(u=t?.xLangfuseSdkVersion)!=null?u:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(w=t?.xLangfusePublicKey)!=null?w:(c=this._options)==null?void 0:c.xLangfusePublicKey}),t?.headers),p=await P({url:E.join((d=await _.get(this._options.baseUrl))!=null?d:await _.get(this._options.environment),`/api/public/v2/evaluators/${encodeURIComponent(r)}/versions`),method:"GET",headers:h,queryParameters:{...g,...t?.queryParams},timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new Ee(p.error.body,p.rawResponse);case 401:throw new ie(p.error.body,p.rawResponse);case 403:throw new le(p.error.body,p.rawResponse);case 404:throw new Re(p.error.body,p.rawResponse);case 405:throw new de(p.error.body,p.rawResponse);case 429:throw new ue(p.error.body,p.rawResponse);case 500:throw new ce(p.error.body,p.rawResponse);case 400:throw new y(p.error.body,p.rawResponse);case 401:throw new b(p.error.body,p.rawResponse);case 403:throw new v(p.error.body,p.rawResponse);case 405:throw new S(p.error.body,p.rawResponse);case 404:throw new R(p.error.body,p.rawResponse);default:throw new m({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new m({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/v2/evaluators/{evaluatorId}/versions.");case"unknown":throw new m({message:p.error.errorMessage,rawResponse:p.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},nl=class{constructor(r){this._options=r}list(r,e){return C.fromPromise(this.__list(r,e))}async __list(r,e){var t,a,s,i,l,u,c,w;let{fields:d,limit:o,scoreLimit:n,cursor:g,fromStartTime:h,toStartTime:p,id:f,name:A,datasetId:k,filter:U}=r,H={};d!=null&&(H.fields=d),o!=null&&(H.limit=o.toString()),n!=null&&(H.scoreLimit=n.toString()),g!=null&&(H.cursor=g),H.fromStartTime=h,p!=null&&(H.toStartTime=p),f!=null&&(H.id=f),A!=null&&(H.name=A),k!=null&&(H.datasetId=k),U!=null&&(H.filter=U);let D=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),B=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/experiments"),method:"GET",headers:D,queryParameters:{...H,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(B.ok)return{data:B.body,rawResponse:B.rawResponse};if(B.error.reason==="status-code")switch(B.error.statusCode){case 400:throw new y(B.error.body,B.rawResponse);case 401:throw new b(B.error.body,B.rawResponse);case 403:throw new v(B.error.body,B.rawResponse);case 405:throw new S(B.error.body,B.rawResponse);case 404:throw new R(B.error.body,B.rawResponse);default:throw new m({statusCode:B.error.statusCode,body:B.error.body,rawResponse:B.rawResponse})}switch(B.error.reason){case"non-json":throw new m({statusCode:B.error.statusCode,body:B.error.rawBody,rawResponse:B.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/experiments.");case"unknown":throw new m({message:B.error.errorMessage,rawResponse:B.rawResponse})}}listItems(r,e){return C.fromPromise(this.__listItems(r,e))}async __listItems(r,e){var t,a,s,i,l,u,c,w;let{fields:d,limit:o,scoreLimit:n,cursor:g,fromStartTime:h,toStartTime:p,experimentId:f,experimentName:A,experimentItemId:k,datasetId:U,filter:H}=r,D={};d!=null&&(D.fields=d),o!=null&&(D.limit=o.toString()),n!=null&&(D.scoreLimit=n.toString()),g!=null&&(D.cursor=g),D.fromStartTime=h,p!=null&&(D.toStartTime=p),f!=null&&(D.experimentId=f),A!=null&&(D.experimentName=A),k!=null&&(D.experimentItemId=k),U!=null&&(D.datasetId=U),H!=null&&(D.filter=H);let B=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),N=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/experiment-items"),method:"GET",headers:B,queryParameters:{...D,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(N.ok)return{data:N.body,rawResponse:N.rawResponse};if(N.error.reason==="status-code")switch(N.error.statusCode){case 400:throw new y(N.error.body,N.rawResponse);case 401:throw new b(N.error.body,N.rawResponse);case 403:throw new v(N.error.body,N.rawResponse);case 405:throw new S(N.error.body,N.rawResponse);case 404:throw new R(N.error.body,N.rawResponse);default:throw new m({statusCode:N.error.statusCode,body:N.error.body,rawResponse:N.rawResponse})}switch(N.error.reason){case"non-json":throw new m({statusCode:N.error.statusCode,body:N.error.rawBody,rawResponse:N.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/experiment-items.");case"unknown":throw new m({message:N.error.errorMessage,rawResponse:N.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},sl=class{constructor(r){this._options=r}submit(r,e){return C.fromPromise(this.__submit(r,e))}async __submit(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/feedback"),method:"POST",headers:d,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 409:throw new va(o.rawResponse);case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling POST /api/public/feedback.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},il=class{constructor(r){this._options=r}health(r){return C.fromPromise(this.__health(r))}async __health(r){var e,t,a,s,i,l,u,c;let w=x((e=this._options)==null?void 0:e.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(a=r?.xLangfuseSdkName)!=null?a:(t=this._options)==null?void 0:t.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(i=r?.xLangfuseSdkVersion)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(u=r?.xLangfusePublicKey)!=null?u:(l=this._options)==null?void 0:l.xLangfusePublicKey}),r?.headers),d=await P({url:E.join((c=await _.get(this._options.baseUrl))!=null?c:await _.get(this._options.environment),"/api/public/health"),method:"GET",headers:w,queryParameters:r?.queryParams,timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 503:throw new Sa(d.rawResponse);case 400:throw new y(d.error.body,d.rawResponse);case 401:throw new b(d.error.body,d.rawResponse);case 403:throw new v(d.error.body,d.rawResponse);case 405:throw new S(d.error.body,d.rawResponse);case 404:throw new R(d.error.body,d.rawResponse);default:throw new m({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new m({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/health.");case"unknown":throw new m({message:d.error.errorMessage,rawResponse:d.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},ll=class{constructor(r){this._options=r}batch(r,e){return C.fromPromise(this.__batch(r,e))}async __batch(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/ingestion"),method:"POST",headers:d,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling POST /api/public/ingestion.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},dl=class{constructor(r){this._options=r}metrics(r,e){return C.fromPromise(this.__metrics(r,e))}async __metrics(r,e){var t,a,s,i,l,u,c,w;let{query:d}=r,o={};o.query=d;let n=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),g=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/metrics"),method:"GET",headers:n,queryParameters:{...o,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(g.ok)return{data:g.body,rawResponse:g.rawResponse};if(g.error.reason==="status-code")switch(g.error.statusCode){case 400:throw new y(g.error.body,g.rawResponse);case 401:throw new b(g.error.body,g.rawResponse);case 403:throw new v(g.error.body,g.rawResponse);case 405:throw new S(g.error.body,g.rawResponse);case 404:throw new R(g.error.body,g.rawResponse);default:throw new m({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}switch(g.error.reason){case"non-json":throw new m({statusCode:g.error.statusCode,body:g.error.rawBody,rawResponse:g.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/metrics.");case"unknown":throw new m({message:g.error.errorMessage,rawResponse:g.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},ul=class{constructor(r){this._options=r}get(r,e){return C.fromPromise(this.__get(r,e))}async __get(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/observations/${encodeURIComponent(r)}`),method:"GET",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/observations/{observationId}.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getMany(r={},e){return C.fromPromise(this.__getMany(r,e))}async __getMany(r={},e){var t,a,s,i,l,u,c,w;let{page:d,limit:o,name:n,userId:g,type:h,traceId:p,level:f,parentObservationId:A,environment:k,fromStartTime:U,toStartTime:H,version:D,filter:B}=r,N={};d!=null&&(N.page=d.toString()),o!=null&&(N.limit=o.toString()),n!=null&&(N.name=n),g!=null&&(N.userId=g),h!=null&&(N.type=h),p!=null&&(N.traceId=p),f!=null&&(N.level=f),A!=null&&(N.parentObservationId=A),k!=null&&(Array.isArray(k)?N.environment=k.map(X=>X):N.environment=k),U!=null&&(N.fromStartTime=U),H!=null&&(N.toStartTime=H),D!=null&&(N.version=D),B!=null&&(N.filter=B);let F=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),K=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/observations"),method:"GET",headers:F,queryParameters:{...N,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(K.ok)return{data:K.body,rawResponse:K.rawResponse};if(K.error.reason==="status-code")switch(K.error.statusCode){case 400:throw new y(K.error.body,K.rawResponse);case 401:throw new b(K.error.body,K.rawResponse);case 403:throw new v(K.error.body,K.rawResponse);case 405:throw new S(K.error.body,K.rawResponse);case 404:throw new R(K.error.body,K.rawResponse);default:throw new m({statusCode:K.error.statusCode,body:K.error.body,rawResponse:K.rawResponse})}switch(K.error.reason){case"non-json":throw new m({statusCode:K.error.statusCode,body:K.error.rawBody,rawResponse:K.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/observations.");case"unknown":throw new m({message:K.error.errorMessage,rawResponse:K.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},on=class{constructor(r){this._options=r}create(r,e){return C.fromPromise(this.__create(r,e))}async __create(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/scores"),method:"POST",headers:d,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling POST /api/public/scores.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getMany(r={},e){return C.fromPromise(this.__getMany(r,e))}async __getMany(r={},e){var t,a,s,i,l,u,c,w;let{page:d,limit:o,userId:n,name:g,fromTimestamp:h,toTimestamp:p,environment:f,source:A,operator:k,value:U,scoreIds:H,configId:D,sessionId:B,datasetRunId:N,traceId:F,observationId:K,queueId:X,dataType:se,traceTags:$,fields:Ce,filter:V}=r,W={};d!=null&&(W.page=d.toString()),o!=null&&(W.limit=o.toString()),n!=null&&(W.userId=n),g!=null&&(W.name=g),h!=null&&(W.fromTimestamp=h),p!=null&&(W.toTimestamp=p),f!=null&&(Array.isArray(f)?W.environment=f.map(Lo=>Lo):W.environment=f),A!=null&&(W.source=A),k!=null&&(W.operator=k),U!=null&&(W.value=U.toString()),H!=null&&(W.scoreIds=H),D!=null&&(W.configId=D),B!=null&&(W.sessionId=B),N!=null&&(W.datasetRunId=N),F!=null&&(W.traceId=F),K!=null&&(W.observationId=K),X!=null&&(W.queueId=X),se!=null&&(W.dataType=se),$!=null&&(Array.isArray($)?W.traceTags=$.map(Lo=>Lo):W.traceTags=$),Ce!=null&&(W.fields=Ce),V!=null&&(W.filter=V);let Q=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),Y=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/v2/scores"),method:"GET",headers:Q,queryParameters:{...W,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(Y.ok)return{data:Y.body,rawResponse:Y.rawResponse};if(Y.error.reason==="status-code")switch(Y.error.statusCode){case 400:throw new y(Y.error.body,Y.rawResponse);case 401:throw new b(Y.error.body,Y.rawResponse);case 403:throw new v(Y.error.body,Y.rawResponse);case 405:throw new S(Y.error.body,Y.rawResponse);case 404:throw new R(Y.error.body,Y.rawResponse);default:throw new m({statusCode:Y.error.statusCode,body:Y.error.body,rawResponse:Y.rawResponse})}switch(Y.error.reason){case"non-json":throw new m({statusCode:Y.error.statusCode,body:Y.error.rawBody,rawResponse:Y.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/v2/scores.");case"unknown":throw new m({message:Y.error.errorMessage,rawResponse:Y.rawResponse})}}getById(r,e){return C.fromPromise(this.__getById(r,e))}async __getById(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/v2/scores/${encodeURIComponent(r)}`),method:"GET",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/v2/scores/{scoreId}.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},cl=class{constructor(r){this._options=r}create(r,e){return new on(this._options).create(r,e)}delete(r,e){return C.fromPromise(this.__delete(r,e))}async __delete(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/scores/${encodeURIComponent(r)}`),method:"DELETE",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling DELETE /api/public/scores/{scoreId}.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},wl=class{constructor(r){this._options=r}get metricsV1(){var r;return(r=this._metricsV1)!=null?r:this._metricsV1=new dl(this._options)}get observationsV1(){var r;return(r=this._observationsV1)!=null?r:this._observationsV1=new ul(this._options)}get scoreV1(){var r;return(r=this._scoreV1)!=null?r:this._scoreV1=new cl(this._options)}},hl=class{constructor(r){this._options=r}list(r={},e){return C.fromPromise(this.__list(r,e))}async __list(r={},e){var t,a,s,i,l,u,c,w;let{page:d,limit:o}=r,n={};d!=null&&(n.page=d.toString()),o!=null&&(n.limit=o.toString());let g=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),h=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/llm-connections"),method:"GET",headers:g,queryParameters:{...n,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(h.ok)return{data:h.body,rawResponse:h.rawResponse};if(h.error.reason==="status-code")switch(h.error.statusCode){case 400:throw new y(h.error.body,h.rawResponse);case 401:throw new b(h.error.body,h.rawResponse);case 403:throw new v(h.error.body,h.rawResponse);case 405:throw new S(h.error.body,h.rawResponse);case 404:throw new R(h.error.body,h.rawResponse);default:throw new m({statusCode:h.error.statusCode,body:h.error.body,rawResponse:h.rawResponse})}switch(h.error.reason){case"non-json":throw new m({statusCode:h.error.statusCode,body:h.error.rawBody,rawResponse:h.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/llm-connections.");case"unknown":throw new m({message:h.error.errorMessage,rawResponse:h.rawResponse})}}upsert(r,e){return C.fromPromise(this.__upsert(r,e))}async __upsert(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/llm-connections"),method:"PUT",headers:d,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling PUT /api/public/llm-connections.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}delete(r,e){return C.fromPromise(this.__delete(r,e))}async __delete(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/llm-connections/${encodeURIComponent(r)}`),method:"DELETE",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling DELETE /api/public/llm-connections/{id}.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},ml=class{constructor(r){this._options=r}get(r,e){return C.fromPromise(this.__get(r,e))}async __get(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/media/${encodeURIComponent(r)}`),method:"GET",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/media/{mediaId}.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}patch(r,e,t){return C.fromPromise(this.__patch(r,e,t))}async __patch(r,e,t){var a,s,i,l,u,c,w,d;let o=x((a=this._options)==null?void 0:a.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=t?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(u=t?.xLangfuseSdkVersion)!=null?u:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(w=t?.xLangfusePublicKey)!=null?w:(c=this._options)==null?void 0:c.xLangfusePublicKey}),t?.headers),n=await P({url:E.join((d=await _.get(this._options.baseUrl))!=null?d:await _.get(this._options.environment),`/api/public/media/${encodeURIComponent(r)}`),method:"PATCH",headers:o,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:e,timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(n.ok)return{data:void 0,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new y(n.error.body,n.rawResponse);case 401:throw new b(n.error.body,n.rawResponse);case 403:throw new v(n.error.body,n.rawResponse);case 405:throw new S(n.error.body,n.rawResponse);case 404:throw new R(n.error.body,n.rawResponse);default:throw new m({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new m({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new T("Timeout exceeded when calling PATCH /api/public/media/{mediaId}.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getUploadUrl(r,e){return C.fromPromise(this.__getUploadUrl(r,e))}async __getUploadUrl(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/media"),method:"POST",headers:d,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling POST /api/public/media.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},_l=class{constructor(r){this._options=r}metrics(r,e){return C.fromPromise(this.__metrics(r,e))}async __metrics(r,e){var t,a,s,i,l,u,c,w;let{query:d}=r,o={};o.query=d;let n=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),g=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/v2/metrics"),method:"GET",headers:n,queryParameters:{...o,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(g.ok)return{data:g.body,rawResponse:g.rawResponse};if(g.error.reason==="status-code")switch(g.error.statusCode){case 400:throw new y(g.error.body,g.rawResponse);case 401:throw new b(g.error.body,g.rawResponse);case 403:throw new v(g.error.body,g.rawResponse);case 405:throw new S(g.error.body,g.rawResponse);case 404:throw new R(g.error.body,g.rawResponse);default:throw new m({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}switch(g.error.reason){case"non-json":throw new m({statusCode:g.error.statusCode,body:g.error.rawBody,rawResponse:g.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/v2/metrics.");case"unknown":throw new m({message:g.error.errorMessage,rawResponse:g.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},gl=class{constructor(r){this._options=r}create(r,e){return C.fromPromise(this.__create(r,e))}async __create(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/models"),method:"POST",headers:d,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling POST /api/public/models.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}upsert(r,e,t){return C.fromPromise(this.__upsert(r,e,t))}async __upsert(r,e,t){var a,s,i,l,u,c,w,d;let o=x((a=this._options)==null?void 0:a.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=t?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(u=t?.xLangfuseSdkVersion)!=null?u:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(w=t?.xLangfusePublicKey)!=null?w:(c=this._options)==null?void 0:c.xLangfusePublicKey}),t?.headers),n=await P({url:E.join((d=await _.get(this._options.baseUrl))!=null?d:await _.get(this._options.environment),`/api/public/models/${encodeURIComponent(r)}`),method:"PUT",headers:o,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:e,timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new y(n.error.body,n.rawResponse);case 401:throw new b(n.error.body,n.rawResponse);case 403:throw new v(n.error.body,n.rawResponse);case 405:throw new S(n.error.body,n.rawResponse);case 404:throw new R(n.error.body,n.rawResponse);default:throw new m({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new m({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new T("Timeout exceeded when calling PUT /api/public/models/{id}.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}list(r={},e){return C.fromPromise(this.__list(r,e))}async __list(r={},e){var t,a,s,i,l,u,c,w;let{page:d,limit:o}=r,n={};d!=null&&(n.page=d.toString()),o!=null&&(n.limit=o.toString());let g=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),h=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/models"),method:"GET",headers:g,queryParameters:{...n,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(h.ok)return{data:h.body,rawResponse:h.rawResponse};if(h.error.reason==="status-code")switch(h.error.statusCode){case 400:throw new y(h.error.body,h.rawResponse);case 401:throw new b(h.error.body,h.rawResponse);case 403:throw new v(h.error.body,h.rawResponse);case 405:throw new S(h.error.body,h.rawResponse);case 404:throw new R(h.error.body,h.rawResponse);default:throw new m({statusCode:h.error.statusCode,body:h.error.body,rawResponse:h.rawResponse})}switch(h.error.reason){case"non-json":throw new m({statusCode:h.error.statusCode,body:h.error.rawBody,rawResponse:h.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/models.");case"unknown":throw new m({message:h.error.errorMessage,rawResponse:h.rawResponse})}}get(r,e){return C.fromPromise(this.__get(r,e))}async __get(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/models/${encodeURIComponent(r)}`),method:"GET",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/models/{id}.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}delete(r,e){return C.fromPromise(this.__delete(r,e))}async __delete(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/models/${encodeURIComponent(r)}`),method:"DELETE",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling DELETE /api/public/models/{id}.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},pl=class{constructor(r){this._options=r}getMany(r={},e){return C.fromPromise(this.__getMany(r,e))}async __getMany(r={},e){var t,a,s,i,l,u,c,w;let{fields:d,expandMetadata:o,limit:n,cursor:g,parseIoAsJson:h,name:p,userId:f,sessionId:A,type:k,traceId:U,level:H,parentObservationId:D,isRootObservation:B,environment:N,fromStartTime:F,toStartTime:K,version:X,filter:se}=r,$={};d!=null&&($.fields=d),o!=null&&($.expandMetadata=o),n!=null&&($.limit=n.toString()),g!=null&&($.cursor=g),h!=null&&($.parseIoAsJson=h.toString()),p!=null&&($.name=p),f!=null&&($.userId=f),A!=null&&($.sessionId=A),k!=null&&($.type=k),U!=null&&($.traceId=U),H!=null&&($.level=H),D!=null&&($.parentObservationId=D),B!=null&&($.isRootObservation=B.toString()),N!=null&&(Array.isArray(N)?$.environment=N.map(W=>W):$.environment=N),F!=null&&($.fromStartTime=F),K!=null&&($.toStartTime=K),X!=null&&($.version=X),se!=null&&($.filter=se);let Ce=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),V=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/v2/observations"),method:"GET",headers:Ce,queryParameters:{...$,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(V.ok)return{data:V.body,rawResponse:V.rawResponse};if(V.error.reason==="status-code")switch(V.error.statusCode){case 400:throw new y(V.error.body,V.rawResponse);case 401:throw new b(V.error.body,V.rawResponse);case 403:throw new v(V.error.body,V.rawResponse);case 405:throw new S(V.error.body,V.rawResponse);case 404:throw new R(V.error.body,V.rawResponse);default:throw new m({statusCode:V.error.statusCode,body:V.error.body,rawResponse:V.rawResponse})}switch(V.error.reason){case"non-json":throw new m({statusCode:V.error.statusCode,body:V.error.rawBody,rawResponse:V.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/v2/observations.");case"unknown":throw new m({message:V.error.errorMessage,rawResponse:V.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},fl=class{constructor(r){this._options=r}exportTraces(r,e){return C.fromPromise(this.__exportTraces(r,e))}async __exportTraces(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/otel/v1/traces"),method:"POST",headers:d,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling POST /api/public/otel/v1/traces.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},yl=class{constructor(r){this._options=r}getOrganizationMemberships(r){return C.fromPromise(this.__getOrganizationMemberships(r))}async __getOrganizationMemberships(r){var e,t,a,s,i,l,u,c;let w=x((e=this._options)==null?void 0:e.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(a=r?.xLangfuseSdkName)!=null?a:(t=this._options)==null?void 0:t.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(i=r?.xLangfuseSdkVersion)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(u=r?.xLangfusePublicKey)!=null?u:(l=this._options)==null?void 0:l.xLangfusePublicKey}),r?.headers),d=await P({url:E.join((c=await _.get(this._options.baseUrl))!=null?c:await _.get(this._options.environment),"/api/public/organizations/memberships"),method:"GET",headers:w,queryParameters:r?.queryParams,timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new y(d.error.body,d.rawResponse);case 401:throw new b(d.error.body,d.rawResponse);case 403:throw new v(d.error.body,d.rawResponse);case 405:throw new S(d.error.body,d.rawResponse);case 404:throw new R(d.error.body,d.rawResponse);default:throw new m({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new m({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/organizations/memberships.");case"unknown":throw new m({message:d.error.errorMessage,rawResponse:d.rawResponse})}}updateOrganizationMembership(r,e){return C.fromPromise(this.__updateOrganizationMembership(r,e))}async __updateOrganizationMembership(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/organizations/memberships"),method:"PUT",headers:d,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling PUT /api/public/organizations/memberships.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteOrganizationMembership(r,e){return C.fromPromise(this.__deleteOrganizationMembership(r,e))}async __deleteOrganizationMembership(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/organizations/memberships"),method:"DELETE",headers:d,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling DELETE /api/public/organizations/memberships.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getProjectMemberships(r,e){return C.fromPromise(this.__getProjectMemberships(r,e))}async __getProjectMemberships(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/projects/${encodeURIComponent(r)}/memberships`),method:"GET",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/projects/{projectId}/memberships.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateProjectMembership(r,e,t){return C.fromPromise(this.__updateProjectMembership(r,e,t))}async __updateProjectMembership(r,e,t){var a,s,i,l,u,c,w,d;let o=x((a=this._options)==null?void 0:a.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=t?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(u=t?.xLangfuseSdkVersion)!=null?u:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(w=t?.xLangfusePublicKey)!=null?w:(c=this._options)==null?void 0:c.xLangfusePublicKey}),t?.headers),n=await P({url:E.join((d=await _.get(this._options.baseUrl))!=null?d:await _.get(this._options.environment),`/api/public/projects/${encodeURIComponent(r)}/memberships`),method:"PUT",headers:o,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:e,timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new y(n.error.body,n.rawResponse);case 401:throw new b(n.error.body,n.rawResponse);case 403:throw new v(n.error.body,n.rawResponse);case 405:throw new S(n.error.body,n.rawResponse);case 404:throw new R(n.error.body,n.rawResponse);default:throw new m({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new m({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new T("Timeout exceeded when calling PUT /api/public/projects/{projectId}/memberships.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}deleteProjectMembership(r,e,t){return C.fromPromise(this.__deleteProjectMembership(r,e,t))}async __deleteProjectMembership(r,e,t){var a,s,i,l,u,c,w,d;let o=x((a=this._options)==null?void 0:a.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=t?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(u=t?.xLangfuseSdkVersion)!=null?u:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(w=t?.xLangfusePublicKey)!=null?w:(c=this._options)==null?void 0:c.xLangfusePublicKey}),t?.headers),n=await P({url:E.join((d=await _.get(this._options.baseUrl))!=null?d:await _.get(this._options.environment),`/api/public/projects/${encodeURIComponent(r)}/memberships`),method:"DELETE",headers:o,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:e,timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new y(n.error.body,n.rawResponse);case 401:throw new b(n.error.body,n.rawResponse);case 403:throw new v(n.error.body,n.rawResponse);case 405:throw new S(n.error.body,n.rawResponse);case 404:throw new R(n.error.body,n.rawResponse);default:throw new m({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new m({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new T("Timeout exceeded when calling DELETE /api/public/projects/{projectId}/memberships.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getOrganizationProjects(r){return C.fromPromise(this.__getOrganizationProjects(r))}async __getOrganizationProjects(r){var e,t,a,s,i,l,u,c;let w=x((e=this._options)==null?void 0:e.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(a=r?.xLangfuseSdkName)!=null?a:(t=this._options)==null?void 0:t.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(i=r?.xLangfuseSdkVersion)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(u=r?.xLangfusePublicKey)!=null?u:(l=this._options)==null?void 0:l.xLangfusePublicKey}),r?.headers),d=await P({url:E.join((c=await _.get(this._options.baseUrl))!=null?c:await _.get(this._options.environment),"/api/public/organizations/projects"),method:"GET",headers:w,queryParameters:r?.queryParams,timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new y(d.error.body,d.rawResponse);case 401:throw new b(d.error.body,d.rawResponse);case 403:throw new v(d.error.body,d.rawResponse);case 405:throw new S(d.error.body,d.rawResponse);case 404:throw new R(d.error.body,d.rawResponse);default:throw new m({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new m({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/organizations/projects.");case"unknown":throw new m({message:d.error.errorMessage,rawResponse:d.rawResponse})}}getOrganizationApiKeys(r){return C.fromPromise(this.__getOrganizationApiKeys(r))}async __getOrganizationApiKeys(r){var e,t,a,s,i,l,u,c;let w=x((e=this._options)==null?void 0:e.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(a=r?.xLangfuseSdkName)!=null?a:(t=this._options)==null?void 0:t.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(i=r?.xLangfuseSdkVersion)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(u=r?.xLangfusePublicKey)!=null?u:(l=this._options)==null?void 0:l.xLangfusePublicKey}),r?.headers),d=await P({url:E.join((c=await _.get(this._options.baseUrl))!=null?c:await _.get(this._options.environment),"/api/public/organizations/apiKeys"),method:"GET",headers:w,queryParameters:r?.queryParams,timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new y(d.error.body,d.rawResponse);case 401:throw new b(d.error.body,d.rawResponse);case 403:throw new v(d.error.body,d.rawResponse);case 405:throw new S(d.error.body,d.rawResponse);case 404:throw new R(d.error.body,d.rawResponse);default:throw new m({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new m({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/organizations/apiKeys.");case"unknown":throw new m({message:d.error.errorMessage,rawResponse:d.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},bl=class{constructor(r){this._options=r}get(r){return C.fromPromise(this.__get(r))}async __get(r){var e,t,a,s,i,l,u,c;let w=x((e=this._options)==null?void 0:e.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(a=r?.xLangfuseSdkName)!=null?a:(t=this._options)==null?void 0:t.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(i=r?.xLangfuseSdkVersion)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(u=r?.xLangfusePublicKey)!=null?u:(l=this._options)==null?void 0:l.xLangfusePublicKey}),r?.headers),d=await P({url:E.join((c=await _.get(this._options.baseUrl))!=null?c:await _.get(this._options.environment),"/api/public/projects"),method:"GET",headers:w,queryParameters:r?.queryParams,timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new y(d.error.body,d.rawResponse);case 401:throw new b(d.error.body,d.rawResponse);case 403:throw new v(d.error.body,d.rawResponse);case 405:throw new S(d.error.body,d.rawResponse);case 404:throw new R(d.error.body,d.rawResponse);default:throw new m({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new m({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/projects.");case"unknown":throw new m({message:d.error.errorMessage,rawResponse:d.rawResponse})}}create(r,e){return C.fromPromise(this.__create(r,e))}async __create(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/projects"),method:"POST",headers:d,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling POST /api/public/projects.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}update(r,e,t){return C.fromPromise(this.__update(r,e,t))}async __update(r,e,t){var a,s,i,l,u,c,w,d;let o=x((a=this._options)==null?void 0:a.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=t?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(u=t?.xLangfuseSdkVersion)!=null?u:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(w=t?.xLangfusePublicKey)!=null?w:(c=this._options)==null?void 0:c.xLangfusePublicKey}),t?.headers),n=await P({url:E.join((d=await _.get(this._options.baseUrl))!=null?d:await _.get(this._options.environment),`/api/public/projects/${encodeURIComponent(r)}`),method:"PUT",headers:o,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:e,timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new y(n.error.body,n.rawResponse);case 401:throw new b(n.error.body,n.rawResponse);case 403:throw new v(n.error.body,n.rawResponse);case 405:throw new S(n.error.body,n.rawResponse);case 404:throw new R(n.error.body,n.rawResponse);default:throw new m({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new m({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new T("Timeout exceeded when calling PUT /api/public/projects/{projectId}.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}delete(r,e){return C.fromPromise(this.__delete(r,e))}async __delete(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/projects/${encodeURIComponent(r)}`),method:"DELETE",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling DELETE /api/public/projects/{projectId}.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getApiKeys(r,e){return C.fromPromise(this.__getApiKeys(r,e))}async __getApiKeys(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/projects/${encodeURIComponent(r)}/apiKeys`),method:"GET",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/projects/{projectId}/apiKeys.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createApiKey(r,e={},t){return C.fromPromise(this.__createApiKey(r,e,t))}async __createApiKey(r,e={},t){var a,s,i,l,u,c,w,d;let o=x((a=this._options)==null?void 0:a.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=t?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(u=t?.xLangfuseSdkVersion)!=null?u:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(w=t?.xLangfusePublicKey)!=null?w:(c=this._options)==null?void 0:c.xLangfusePublicKey}),t?.headers),n=await P({url:E.join((d=await _.get(this._options.baseUrl))!=null?d:await _.get(this._options.environment),`/api/public/projects/${encodeURIComponent(r)}/apiKeys`),method:"POST",headers:o,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:e,timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new y(n.error.body,n.rawResponse);case 401:throw new b(n.error.body,n.rawResponse);case 403:throw new v(n.error.body,n.rawResponse);case 405:throw new S(n.error.body,n.rawResponse);case 404:throw new R(n.error.body,n.rawResponse);default:throw new m({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new m({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new T("Timeout exceeded when calling POST /api/public/projects/{projectId}/apiKeys.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}deleteApiKey(r,e,t){return C.fromPromise(this.__deleteApiKey(r,e,t))}async __deleteApiKey(r,e,t){var a,s,i,l,u,c,w,d;let o=x((a=this._options)==null?void 0:a.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=t?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(u=t?.xLangfuseSdkVersion)!=null?u:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(w=t?.xLangfusePublicKey)!=null?w:(c=this._options)==null?void 0:c.xLangfusePublicKey}),t?.headers),n=await P({url:E.join((d=await _.get(this._options.baseUrl))!=null?d:await _.get(this._options.environment),`/api/public/projects/${encodeURIComponent(r)}/apiKeys/${encodeURIComponent(e)}`),method:"DELETE",headers:o,queryParameters:t?.queryParams,timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new y(n.error.body,n.rawResponse);case 401:throw new b(n.error.body,n.rawResponse);case 403:throw new v(n.error.body,n.rawResponse);case 405:throw new S(n.error.body,n.rawResponse);case 404:throw new R(n.error.body,n.rawResponse);default:throw new m({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new m({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new T("Timeout exceeded when calling DELETE /api/public/projects/{projectId}/apiKeys/{apiKeyId}.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},vl=class{constructor(r){this._options=r}update(r,e,t,a){return C.fromPromise(this.__update(r,e,t,a))}async __update(r,e,t,a){var s,i,l,u,c,w,d,o;let n=x((s=this._options)==null?void 0:s.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(l=a?.xLangfuseSdkName)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(c=a?.xLangfuseSdkVersion)!=null?c:(u=this._options)==null?void 0:u.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(d=a?.xLangfusePublicKey)!=null?d:(w=this._options)==null?void 0:w.xLangfusePublicKey}),a?.headers),g=await P({url:E.join((o=await _.get(this._options.baseUrl))!=null?o:await _.get(this._options.environment),`/api/public/v2/prompts/${encodeURIComponent(r)}/versions/${encodeURIComponent(e)}`),method:"PATCH",headers:n,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:t,timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.abortSignal});if(g.ok)return{data:g.body,rawResponse:g.rawResponse};if(g.error.reason==="status-code")switch(g.error.statusCode){case 400:throw new y(g.error.body,g.rawResponse);case 401:throw new b(g.error.body,g.rawResponse);case 403:throw new v(g.error.body,g.rawResponse);case 405:throw new S(g.error.body,g.rawResponse);case 404:throw new R(g.error.body,g.rawResponse);default:throw new m({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}switch(g.error.reason){case"non-json":throw new m({statusCode:g.error.statusCode,body:g.error.rawBody,rawResponse:g.rawResponse});case"timeout":throw new T("Timeout exceeded when calling PATCH /api/public/v2/prompts/{name}/versions/{version}.");case"unknown":throw new m({message:g.error.errorMessage,rawResponse:g.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},Rl=class{constructor(r){this._options=r}get(r,e={},t){return C.fromPromise(this.__get(r,e,t))}async __get(r,e={},t){var a,s,i,l,u,c,w,d;let{version:o,label:n,resolve:g}=e,h={};o!=null&&(h.version=o.toString()),n!=null&&(h.label=n),g!=null&&(h.resolve=g.toString());let p=x((a=this._options)==null?void 0:a.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=t?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(u=t?.xLangfuseSdkVersion)!=null?u:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(w=t?.xLangfusePublicKey)!=null?w:(c=this._options)==null?void 0:c.xLangfusePublicKey}),t?.headers),f=await P({url:E.join((d=await _.get(this._options.baseUrl))!=null?d:await _.get(this._options.environment),`/api/public/v2/prompts/${encodeURIComponent(r)}`),method:"GET",headers:p,queryParameters:{...h,...t?.queryParams},timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(f.ok)return{data:f.body,rawResponse:f.rawResponse};if(f.error.reason==="status-code")switch(f.error.statusCode){case 400:throw new y(f.error.body,f.rawResponse);case 401:throw new b(f.error.body,f.rawResponse);case 403:throw new v(f.error.body,f.rawResponse);case 405:throw new S(f.error.body,f.rawResponse);case 404:throw new R(f.error.body,f.rawResponse);default:throw new m({statusCode:f.error.statusCode,body:f.error.body,rawResponse:f.rawResponse})}switch(f.error.reason){case"non-json":throw new m({statusCode:f.error.statusCode,body:f.error.rawBody,rawResponse:f.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/v2/prompts/{promptName}.");case"unknown":throw new m({message:f.error.errorMessage,rawResponse:f.rawResponse})}}list(r={},e){return C.fromPromise(this.__list(r,e))}async __list(r={},e){var t,a,s,i,l,u,c,w;let{name:d,label:o,tag:n,page:g,limit:h,fromUpdatedAt:p,toUpdatedAt:f}=r,A={};d!=null&&(A.name=d),o!=null&&(A.label=o),n!=null&&(A.tag=n),g!=null&&(A.page=g.toString()),h!=null&&(A.limit=h.toString()),p!=null&&(A.fromUpdatedAt=p),f!=null&&(A.toUpdatedAt=f);let k=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),U=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/v2/prompts"),method:"GET",headers:k,queryParameters:{...A,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(U.ok)return{data:U.body,rawResponse:U.rawResponse};if(U.error.reason==="status-code")switch(U.error.statusCode){case 400:throw new y(U.error.body,U.rawResponse);case 401:throw new b(U.error.body,U.rawResponse);case 403:throw new v(U.error.body,U.rawResponse);case 405:throw new S(U.error.body,U.rawResponse);case 404:throw new R(U.error.body,U.rawResponse);default:throw new m({statusCode:U.error.statusCode,body:U.error.body,rawResponse:U.rawResponse})}switch(U.error.reason){case"non-json":throw new m({statusCode:U.error.statusCode,body:U.error.rawBody,rawResponse:U.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/v2/prompts.");case"unknown":throw new m({message:U.error.errorMessage,rawResponse:U.rawResponse})}}create(r,e){return C.fromPromise(this.__create(r,e))}async __create(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/v2/prompts"),method:"POST",headers:d,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling POST /api/public/v2/prompts.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}delete(r,e={},t){return C.fromPromise(this.__delete(r,e,t))}async __delete(r,e={},t){var a,s,i,l,u,c,w,d;let{label:o,version:n}=e,g={};o!=null&&(g.label=o),n!=null&&(g.version=n.toString());let h=x((a=this._options)==null?void 0:a.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=t?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(u=t?.xLangfuseSdkVersion)!=null?u:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(w=t?.xLangfusePublicKey)!=null?w:(c=this._options)==null?void 0:c.xLangfusePublicKey}),t?.headers),p=await P({url:E.join((d=await _.get(this._options.baseUrl))!=null?d:await _.get(this._options.environment),`/api/public/v2/prompts/${encodeURIComponent(r)}`),method:"DELETE",headers:h,queryParameters:{...g,...t?.queryParams},timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(p.ok)return{data:void 0,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new y(p.error.body,p.rawResponse);case 401:throw new b(p.error.body,p.rawResponse);case 403:throw new v(p.error.body,p.rawResponse);case 405:throw new S(p.error.body,p.rawResponse);case 404:throw new R(p.error.body,p.rawResponse);default:throw new m({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new m({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new T("Timeout exceeded when calling DELETE /api/public/v2/prompts/{promptName}.");case"unknown":throw new m({message:p.error.errorMessage,rawResponse:p.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},Sl=class{constructor(r){this._options=r}getServiceProviderConfig(r){return C.fromPromise(this.__getServiceProviderConfig(r))}async __getServiceProviderConfig(r){var e,t,a,s,i,l,u,c;let w=x((e=this._options)==null?void 0:e.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(a=r?.xLangfuseSdkName)!=null?a:(t=this._options)==null?void 0:t.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(i=r?.xLangfuseSdkVersion)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(u=r?.xLangfusePublicKey)!=null?u:(l=this._options)==null?void 0:l.xLangfusePublicKey}),r?.headers),d=await P({url:E.join((c=await _.get(this._options.baseUrl))!=null?c:await _.get(this._options.environment),"/api/public/scim/ServiceProviderConfig"),method:"GET",headers:w,queryParameters:r?.queryParams,timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new y(d.error.body,d.rawResponse);case 401:throw new b(d.error.body,d.rawResponse);case 403:throw new v(d.error.body,d.rawResponse);case 405:throw new S(d.error.body,d.rawResponse);case 404:throw new R(d.error.body,d.rawResponse);default:throw new m({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new m({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/scim/ServiceProviderConfig.");case"unknown":throw new m({message:d.error.errorMessage,rawResponse:d.rawResponse})}}getResourceTypes(r){return C.fromPromise(this.__getResourceTypes(r))}async __getResourceTypes(r){var e,t,a,s,i,l,u,c;let w=x((e=this._options)==null?void 0:e.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(a=r?.xLangfuseSdkName)!=null?a:(t=this._options)==null?void 0:t.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(i=r?.xLangfuseSdkVersion)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(u=r?.xLangfusePublicKey)!=null?u:(l=this._options)==null?void 0:l.xLangfusePublicKey}),r?.headers),d=await P({url:E.join((c=await _.get(this._options.baseUrl))!=null?c:await _.get(this._options.environment),"/api/public/scim/ResourceTypes"),method:"GET",headers:w,queryParameters:r?.queryParams,timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new y(d.error.body,d.rawResponse);case 401:throw new b(d.error.body,d.rawResponse);case 403:throw new v(d.error.body,d.rawResponse);case 405:throw new S(d.error.body,d.rawResponse);case 404:throw new R(d.error.body,d.rawResponse);default:throw new m({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new m({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/scim/ResourceTypes.");case"unknown":throw new m({message:d.error.errorMessage,rawResponse:d.rawResponse})}}getSchemas(r){return C.fromPromise(this.__getSchemas(r))}async __getSchemas(r){var e,t,a,s,i,l,u,c;let w=x((e=this._options)==null?void 0:e.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(a=r?.xLangfuseSdkName)!=null?a:(t=this._options)==null?void 0:t.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(i=r?.xLangfuseSdkVersion)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(u=r?.xLangfusePublicKey)!=null?u:(l=this._options)==null?void 0:l.xLangfusePublicKey}),r?.headers),d=await P({url:E.join((c=await _.get(this._options.baseUrl))!=null?c:await _.get(this._options.environment),"/api/public/scim/Schemas"),method:"GET",headers:w,queryParameters:r?.queryParams,timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new y(d.error.body,d.rawResponse);case 401:throw new b(d.error.body,d.rawResponse);case 403:throw new v(d.error.body,d.rawResponse);case 405:throw new S(d.error.body,d.rawResponse);case 404:throw new R(d.error.body,d.rawResponse);default:throw new m({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new m({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/scim/Schemas.");case"unknown":throw new m({message:d.error.errorMessage,rawResponse:d.rawResponse})}}listUsers(r={},e){return C.fromPromise(this.__listUsers(r,e))}async __listUsers(r={},e){var t,a,s,i,l,u,c,w;let{filter:d,startIndex:o,count:n}=r,g={};d!=null&&(g.filter=d),o!=null&&(g.startIndex=o.toString()),n!=null&&(g.count=n.toString());let h=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),p=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/scim/Users"),method:"GET",headers:h,queryParameters:{...g,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new y(p.error.body,p.rawResponse);case 401:throw new b(p.error.body,p.rawResponse);case 403:throw new v(p.error.body,p.rawResponse);case 405:throw new S(p.error.body,p.rawResponse);case 404:throw new R(p.error.body,p.rawResponse);default:throw new m({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new m({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/scim/Users.");case"unknown":throw new m({message:p.error.errorMessage,rawResponse:p.rawResponse})}}createUser(r,e){return C.fromPromise(this.__createUser(r,e))}async __createUser(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/scim/Users"),method:"POST",headers:d,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling POST /api/public/scim/Users.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getUser(r,e){return C.fromPromise(this.__getUser(r,e))}async __getUser(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/scim/Users/${encodeURIComponent(r)}`),method:"GET",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/scim/Users/{userId}.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteUser(r,e){return C.fromPromise(this.__deleteUser(r,e))}async __deleteUser(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/scim/Users/${encodeURIComponent(r)}`),method:"DELETE",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling DELETE /api/public/scim/Users/{userId}.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},xl=class{constructor(r){this._options=r}create(r,e){return C.fromPromise(this.__create(r,e))}async __create(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/score-configs"),method:"POST",headers:d,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling POST /api/public/score-configs.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}get(r={},e){return C.fromPromise(this.__get(r,e))}async __get(r={},e){var t,a,s,i,l,u,c,w;let{page:d,limit:o}=r,n={};d!=null&&(n.page=d.toString()),o!=null&&(n.limit=o.toString());let g=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),h=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/score-configs"),method:"GET",headers:g,queryParameters:{...n,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(h.ok)return{data:h.body,rawResponse:h.rawResponse};if(h.error.reason==="status-code")switch(h.error.statusCode){case 400:throw new y(h.error.body,h.rawResponse);case 401:throw new b(h.error.body,h.rawResponse);case 403:throw new v(h.error.body,h.rawResponse);case 405:throw new S(h.error.body,h.rawResponse);case 404:throw new R(h.error.body,h.rawResponse);default:throw new m({statusCode:h.error.statusCode,body:h.error.body,rawResponse:h.rawResponse})}switch(h.error.reason){case"non-json":throw new m({statusCode:h.error.statusCode,body:h.error.rawBody,rawResponse:h.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/score-configs.");case"unknown":throw new m({message:h.error.errorMessage,rawResponse:h.rawResponse})}}getById(r,e){return C.fromPromise(this.__getById(r,e))}async __getById(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/score-configs/${encodeURIComponent(r)}`),method:"GET",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/score-configs/{configId}.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}update(r,e,t){return C.fromPromise(this.__update(r,e,t))}async __update(r,e,t){var a,s,i,l,u,c,w,d;let o=x((a=this._options)==null?void 0:a.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=t?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(u=t?.xLangfuseSdkVersion)!=null?u:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(w=t?.xLangfusePublicKey)!=null?w:(c=this._options)==null?void 0:c.xLangfusePublicKey}),t?.headers),n=await P({url:E.join((d=await _.get(this._options.baseUrl))!=null?d:await _.get(this._options.environment),`/api/public/score-configs/${encodeURIComponent(r)}`),method:"PATCH",headers:o,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:e,timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new y(n.error.body,n.rawResponse);case 401:throw new b(n.error.body,n.rawResponse);case 403:throw new v(n.error.body,n.rawResponse);case 405:throw new S(n.error.body,n.rawResponse);case 404:throw new R(n.error.body,n.rawResponse);default:throw new m({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new m({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new T("Timeout exceeded when calling PATCH /api/public/score-configs/{configId}.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},El=class{constructor(r){this._options=r}getManyV3(r={},e){return C.fromPromise(this.__getManyV3(r,e))}async __getManyV3(r={},e){var t,a,s,i,l,u,c,w;let{limit:d,cursor:o,fields:n,id:g,name:h,source:p,dataType:f,environment:A,configId:k,queueId:U,authorUserId:H,value:D,valueMin:B,valueMax:N,traceId:F,sessionId:K,observationId:X,experimentId:se,fromTimestamp:$,toTimestamp:Ce}=r,V={};d!=null&&(V.limit=d.toString()),o!=null&&(V.cursor=o),n!=null&&(V.fields=n),g!=null&&(V.id=g),h!=null&&(V.name=h),p!=null&&(V.source=p),f!=null&&(V.dataType=f),A!=null&&(V.environment=A),k!=null&&(V.configId=k),U!=null&&(V.queueId=U),H!=null&&(V.authorUserId=H),D!=null&&(V.value=D),B!=null&&(V.valueMin=B.toString()),N!=null&&(V.valueMax=N.toString()),F!=null&&(V.traceId=F),K!=null&&(V.sessionId=K),X!=null&&(V.observationId=X),se!=null&&(V.experimentId=se),$!=null&&(V.fromTimestamp=$),Ce!=null&&(V.toTimestamp=Ce);let W=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),Q=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/v3/scores"),method:"GET",headers:W,queryParameters:{...V,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(Q.ok)return{data:Q.body,rawResponse:Q.rawResponse};if(Q.error.reason==="status-code")switch(Q.error.statusCode){case 400:throw new y(Q.error.body,Q.rawResponse);case 401:throw new b(Q.error.body,Q.rawResponse);case 403:throw new v(Q.error.body,Q.rawResponse);case 405:throw new S(Q.error.body,Q.rawResponse);case 404:throw new R(Q.error.body,Q.rawResponse);default:throw new m({statusCode:Q.error.statusCode,body:Q.error.body,rawResponse:Q.rawResponse})}switch(Q.error.reason){case"non-json":throw new m({statusCode:Q.error.statusCode,body:Q.error.rawBody,rawResponse:Q.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/v3/scores.");case"unknown":throw new m({message:Q.error.errorMessage,rawResponse:Q.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},Tl=class{constructor(r){this._options=r}list(r={},e){return C.fromPromise(this.__list(r,e))}async __list(r={},e){var t,a,s,i,l,u,c,w;let{page:d,limit:o,fromTimestamp:n,toTimestamp:g,environment:h}=r,p={};d!=null&&(p.page=d.toString()),o!=null&&(p.limit=o.toString()),n!=null&&(p.fromTimestamp=n),g!=null&&(p.toTimestamp=g),h!=null&&(Array.isArray(h)?p.environment=h.map(k=>k):p.environment=h);let f=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),A=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/sessions"),method:"GET",headers:f,queryParameters:{...p,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(A.ok)return{data:A.body,rawResponse:A.rawResponse};if(A.error.reason==="status-code")switch(A.error.statusCode){case 400:throw new y(A.error.body,A.rawResponse);case 401:throw new b(A.error.body,A.rawResponse);case 403:throw new v(A.error.body,A.rawResponse);case 405:throw new S(A.error.body,A.rawResponse);case 404:throw new R(A.error.body,A.rawResponse);default:throw new m({statusCode:A.error.statusCode,body:A.error.body,rawResponse:A.rawResponse})}switch(A.error.reason){case"non-json":throw new m({statusCode:A.error.statusCode,body:A.error.rawBody,rawResponse:A.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/sessions.");case"unknown":throw new m({message:A.error.errorMessage,rawResponse:A.rawResponse})}}get(r,e){return C.fromPromise(this.__get(r,e))}async __get(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/sessions/${encodeURIComponent(r)}`),method:"GET",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/sessions/{sessionId}.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},Ll=class{constructor(r){this._options=r}get(r,e={},t){return C.fromPromise(this.__get(r,e,t))}async __get(r,e={},t){var a,s,i,l,u,c,w,d;let{fields:o}=e,n={};o!=null&&(n.fields=o);let g=x((a=this._options)==null?void 0:a.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=t?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(u=t?.xLangfuseSdkVersion)!=null?u:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(w=t?.xLangfusePublicKey)!=null?w:(c=this._options)==null?void 0:c.xLangfusePublicKey}),t?.headers),h=await P({url:E.join((d=await _.get(this._options.baseUrl))!=null?d:await _.get(this._options.environment),`/api/public/traces/${encodeURIComponent(r)}`),method:"GET",headers:g,queryParameters:{...n,...t?.queryParams},timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(h.ok)return{data:h.body,rawResponse:h.rawResponse};if(h.error.reason==="status-code")switch(h.error.statusCode){case 400:throw new y(h.error.body,h.rawResponse);case 401:throw new b(h.error.body,h.rawResponse);case 403:throw new v(h.error.body,h.rawResponse);case 405:throw new S(h.error.body,h.rawResponse);case 404:throw new R(h.error.body,h.rawResponse);default:throw new m({statusCode:h.error.statusCode,body:h.error.body,rawResponse:h.rawResponse})}switch(h.error.reason){case"non-json":throw new m({statusCode:h.error.statusCode,body:h.error.rawBody,rawResponse:h.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/traces/{traceId}.");case"unknown":throw new m({message:h.error.errorMessage,rawResponse:h.rawResponse})}}delete(r,e){return C.fromPromise(this.__delete(r,e))}async __delete(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/traces/${encodeURIComponent(r)}`),method:"DELETE",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling DELETE /api/public/traces/{traceId}.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}list(r={},e){return C.fromPromise(this.__list(r,e))}async __list(r={},e){var t,a,s,i,l,u,c,w;let{page:d,limit:o,userId:n,name:g,sessionId:h,fromTimestamp:p,toTimestamp:f,orderBy:A,tags:k,version:U,release:H,environment:D,fields:B,filter:N}=r,F={};d!=null&&(F.page=d.toString()),o!=null&&(F.limit=o.toString()),n!=null&&(F.userId=n),g!=null&&(F.name=g),h!=null&&(F.sessionId=h),p!=null&&(F.fromTimestamp=p),f!=null&&(F.toTimestamp=f),A!=null&&(F.orderBy=A),k!=null&&(Array.isArray(k)?F.tags=k.map(se=>se):F.tags=k),U!=null&&(F.version=U),H!=null&&(F.release=H),D!=null&&(Array.isArray(D)?F.environment=D.map(se=>se):F.environment=D),B!=null&&(F.fields=B),N!=null&&(F.filter=N);let K=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),X=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/traces"),method:"GET",headers:K,queryParameters:{...F,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(X.ok)return{data:X.body,rawResponse:X.rawResponse};if(X.error.reason==="status-code")switch(X.error.statusCode){case 400:throw new y(X.error.body,X.rawResponse);case 401:throw new b(X.error.body,X.rawResponse);case 403:throw new v(X.error.body,X.rawResponse);case 405:throw new S(X.error.body,X.rawResponse);case 404:throw new R(X.error.body,X.rawResponse);default:throw new m({statusCode:X.error.statusCode,body:X.error.body,rawResponse:X.rawResponse})}switch(X.error.reason){case"non-json":throw new m({statusCode:X.error.statusCode,body:X.error.rawBody,rawResponse:X.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/traces.");case"unknown":throw new m({message:X.error.errorMessage,rawResponse:X.rawResponse})}}deleteMultiple(r,e){return C.fromPromise(this.__deleteMultiple(r,e))}async __deleteMultiple(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/traces"),method:"DELETE",headers:d,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling DELETE /api/public/traces.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},Pl=class{constructor(r){this._options=r}list(r={},e){return C.fromPromise(this.__list(r,e))}async __list(r={},e){var t,a,s,i,l,u,c,w;let{page:d,limit:o}=r,n={};d!=null&&(n.page=d.toString()),o!=null&&(n.limit=o.toString());let g=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),h=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/unstable/dashboard-widgets"),method:"GET",headers:g,queryParameters:{...n,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(h.ok)return{data:h.body,rawResponse:h.rawResponse};if(h.error.reason==="status-code")switch(h.error.statusCode){case 400:throw new I.BadRequestError(h.error.body,h.rawResponse);case 401:throw new I.UnauthorizedError(h.error.body,h.rawResponse);case 403:throw new I.AccessDeniedError(h.error.body,h.rawResponse);case 405:throw new I.MethodNotAllowedError(h.error.body,h.rawResponse);case 429:throw new I.TooManyRequestsError(h.error.body,h.rawResponse);case 500:throw new I.InternalServerError(h.error.body,h.rawResponse);case 400:throw new y(h.error.body,h.rawResponse);case 401:throw new b(h.error.body,h.rawResponse);case 403:throw new v(h.error.body,h.rawResponse);case 405:throw new S(h.error.body,h.rawResponse);case 404:throw new R(h.error.body,h.rawResponse);default:throw new m({statusCode:h.error.statusCode,body:h.error.body,rawResponse:h.rawResponse})}switch(h.error.reason){case"non-json":throw new m({statusCode:h.error.statusCode,body:h.error.rawBody,rawResponse:h.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/unstable/dashboard-widgets.");case"unknown":throw new m({message:h.error.errorMessage,rawResponse:h.rawResponse})}}create(r,e){return C.fromPromise(this.__create(r,e))}async __create(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/unstable/dashboard-widgets"),method:"POST",headers:d,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new I.BadRequestError(o.error.body,o.rawResponse);case 401:throw new I.UnauthorizedError(o.error.body,o.rawResponse);case 403:throw new I.AccessDeniedError(o.error.body,o.rawResponse);case 405:throw new I.MethodNotAllowedError(o.error.body,o.rawResponse);case 429:throw new I.TooManyRequestsError(o.error.body,o.rawResponse);case 500:throw new I.InternalServerError(o.error.body,o.rawResponse);case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling POST /api/public/unstable/dashboard-widgets.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}get(r,e){return C.fromPromise(this.__get(r,e))}async __get(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/unstable/dashboard-widgets/${encodeURIComponent(r)}`),method:"GET",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new I.BadRequestError(o.error.body,o.rawResponse);case 401:throw new I.UnauthorizedError(o.error.body,o.rawResponse);case 403:throw new I.AccessDeniedError(o.error.body,o.rawResponse);case 404:throw new I.NotFoundError(o.error.body,o.rawResponse);case 405:throw new I.MethodNotAllowedError(o.error.body,o.rawResponse);case 429:throw new I.TooManyRequestsError(o.error.body,o.rawResponse);case 500:throw new I.InternalServerError(o.error.body,o.rawResponse);case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/unstable/dashboard-widgets/{widgetId}.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}update(r,e,t){return C.fromPromise(this.__update(r,e,t))}async __update(r,e,t){var a,s,i,l,u,c,w,d;let o=x((a=this._options)==null?void 0:a.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=t?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(u=t?.xLangfuseSdkVersion)!=null?u:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(w=t?.xLangfusePublicKey)!=null?w:(c=this._options)==null?void 0:c.xLangfusePublicKey}),t?.headers),n=await P({url:E.join((d=await _.get(this._options.baseUrl))!=null?d:await _.get(this._options.environment),`/api/public/unstable/dashboard-widgets/${encodeURIComponent(r)}`),method:"PATCH",headers:o,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:e,timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new I.BadRequestError(n.error.body,n.rawResponse);case 401:throw new I.UnauthorizedError(n.error.body,n.rawResponse);case 403:throw new I.AccessDeniedError(n.error.body,n.rawResponse);case 404:throw new I.NotFoundError(n.error.body,n.rawResponse);case 405:throw new I.MethodNotAllowedError(n.error.body,n.rawResponse);case 429:throw new I.TooManyRequestsError(n.error.body,n.rawResponse);case 500:throw new I.InternalServerError(n.error.body,n.rawResponse);case 400:throw new y(n.error.body,n.rawResponse);case 401:throw new b(n.error.body,n.rawResponse);case 403:throw new v(n.error.body,n.rawResponse);case 405:throw new S(n.error.body,n.rawResponse);case 404:throw new R(n.error.body,n.rawResponse);default:throw new m({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new m({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new T("Timeout exceeded when calling PATCH /api/public/unstable/dashboard-widgets/{widgetId}.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}delete(r,e){return C.fromPromise(this.__delete(r,e))}async __delete(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/unstable/dashboard-widgets/${encodeURIComponent(r)}`),method:"DELETE",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new I.BadRequestError(o.error.body,o.rawResponse);case 401:throw new I.UnauthorizedError(o.error.body,o.rawResponse);case 403:throw new I.AccessDeniedError(o.error.body,o.rawResponse);case 404:throw new I.NotFoundError(o.error.body,o.rawResponse);case 405:throw new I.MethodNotAllowedError(o.error.body,o.rawResponse);case 409:throw new I.ConflictError(o.error.body,o.rawResponse);case 429:throw new I.TooManyRequestsError(o.error.body,o.rawResponse);case 500:throw new I.InternalServerError(o.error.body,o.rawResponse);case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling DELETE /api/public/unstable/dashboard-widgets/{widgetId}.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},Cl=class{constructor(r){this._options=r}list(r={},e){return C.fromPromise(this.__list(r,e))}async __list(r={},e){var t,a,s,i,l,u,c,w;let{page:d,limit:o}=r,n={};d!=null&&(n.page=d.toString()),o!=null&&(n.limit=o.toString());let g=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),h=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/unstable/dashboards"),method:"GET",headers:g,queryParameters:{...n,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(h.ok)return{data:h.body,rawResponse:h.rawResponse};if(h.error.reason==="status-code")switch(h.error.statusCode){case 400:throw new I.BadRequestError(h.error.body,h.rawResponse);case 401:throw new I.UnauthorizedError(h.error.body,h.rawResponse);case 403:throw new I.AccessDeniedError(h.error.body,h.rawResponse);case 405:throw new I.MethodNotAllowedError(h.error.body,h.rawResponse);case 429:throw new I.TooManyRequestsError(h.error.body,h.rawResponse);case 500:throw new I.InternalServerError(h.error.body,h.rawResponse);case 400:throw new y(h.error.body,h.rawResponse);case 401:throw new b(h.error.body,h.rawResponse);case 403:throw new v(h.error.body,h.rawResponse);case 405:throw new S(h.error.body,h.rawResponse);case 404:throw new R(h.error.body,h.rawResponse);default:throw new m({statusCode:h.error.statusCode,body:h.error.body,rawResponse:h.rawResponse})}switch(h.error.reason){case"non-json":throw new m({statusCode:h.error.statusCode,body:h.error.rawBody,rawResponse:h.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/unstable/dashboards.");case"unknown":throw new m({message:h.error.errorMessage,rawResponse:h.rawResponse})}}create(r,e){return C.fromPromise(this.__create(r,e))}async __create(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),"/api/public/unstable/dashboards"),method:"POST",headers:d,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new I.BadRequestError(o.error.body,o.rawResponse);case 401:throw new I.UnauthorizedError(o.error.body,o.rawResponse);case 403:throw new I.AccessDeniedError(o.error.body,o.rawResponse);case 404:throw new I.NotFoundError(o.error.body,o.rawResponse);case 405:throw new I.MethodNotAllowedError(o.error.body,o.rawResponse);case 429:throw new I.TooManyRequestsError(o.error.body,o.rawResponse);case 500:throw new I.InternalServerError(o.error.body,o.rawResponse);case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling POST /api/public/unstable/dashboards.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}get(r,e){return C.fromPromise(this.__get(r,e))}async __get(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/unstable/dashboards/${encodeURIComponent(r)}`),method:"GET",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new I.BadRequestError(o.error.body,o.rawResponse);case 401:throw new I.UnauthorizedError(o.error.body,o.rawResponse);case 403:throw new I.AccessDeniedError(o.error.body,o.rawResponse);case 404:throw new I.NotFoundError(o.error.body,o.rawResponse);case 405:throw new I.MethodNotAllowedError(o.error.body,o.rawResponse);case 429:throw new I.TooManyRequestsError(o.error.body,o.rawResponse);case 500:throw new I.InternalServerError(o.error.body,o.rawResponse);case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling GET /api/public/unstable/dashboards/{dashboardId}.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}update(r,e,t){return C.fromPromise(this.__update(r,e,t))}async __update(r,e,t){var a,s,i,l,u,c,w,d;let o=x((a=this._options)==null?void 0:a.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=t?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(u=t?.xLangfuseSdkVersion)!=null?u:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(w=t?.xLangfusePublicKey)!=null?w:(c=this._options)==null?void 0:c.xLangfusePublicKey}),t?.headers),n=await P({url:E.join((d=await _.get(this._options.baseUrl))!=null?d:await _.get(this._options.environment),`/api/public/unstable/dashboards/${encodeURIComponent(r)}`),method:"PATCH",headers:o,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:e,timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new I.BadRequestError(n.error.body,n.rawResponse);case 401:throw new I.UnauthorizedError(n.error.body,n.rawResponse);case 403:throw new I.AccessDeniedError(n.error.body,n.rawResponse);case 404:throw new I.NotFoundError(n.error.body,n.rawResponse);case 405:throw new I.MethodNotAllowedError(n.error.body,n.rawResponse);case 429:throw new I.TooManyRequestsError(n.error.body,n.rawResponse);case 500:throw new I.InternalServerError(n.error.body,n.rawResponse);case 400:throw new y(n.error.body,n.rawResponse);case 401:throw new b(n.error.body,n.rawResponse);case 403:throw new v(n.error.body,n.rawResponse);case 405:throw new S(n.error.body,n.rawResponse);case 404:throw new R(n.error.body,n.rawResponse);default:throw new m({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new m({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new T("Timeout exceeded when calling PATCH /api/public/unstable/dashboards/{dashboardId}.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}delete(r,e){return C.fromPromise(this.__delete(r,e))}async __delete(r,e){var t,a,s,i,l,u,c,w;let d=x((t=this._options)==null?void 0:t.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=e?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=e?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),o=await P({url:E.join((w=await _.get(this._options.baseUrl))!=null?w:await _.get(this._options.environment),`/api/public/unstable/dashboards/${encodeURIComponent(r)}`),method:"DELETE",headers:d,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new I.BadRequestError(o.error.body,o.rawResponse);case 401:throw new I.UnauthorizedError(o.error.body,o.rawResponse);case 403:throw new I.AccessDeniedError(o.error.body,o.rawResponse);case 404:throw new I.NotFoundError(o.error.body,o.rawResponse);case 405:throw new I.MethodNotAllowedError(o.error.body,o.rawResponse);case 429:throw new I.TooManyRequestsError(o.error.body,o.rawResponse);case 500:throw new I.InternalServerError(o.error.body,o.rawResponse);case 400:throw new y(o.error.body,o.rawResponse);case 401:throw new b(o.error.body,o.rawResponse);case 403:throw new v(o.error.body,o.rawResponse);case 405:throw new S(o.error.body,o.rawResponse);case 404:throw new R(o.error.body,o.rawResponse);default:throw new m({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new T("Timeout exceeded when calling DELETE /api/public/unstable/dashboards/{dashboardId}.");case"unknown":throw new m({message:o.error.errorMessage,rawResponse:o.rawResponse})}}addPlacement(r,e,t){return C.fromPromise(this.__addPlacement(r,e,t))}async __addPlacement(r,e,t){var a,s,i,l,u,c,w,d;let o=x((a=this._options)==null?void 0:a.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=t?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(u=t?.xLangfuseSdkVersion)!=null?u:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(w=t?.xLangfusePublicKey)!=null?w:(c=this._options)==null?void 0:c.xLangfusePublicKey}),t?.headers),n=await P({url:E.join((d=await _.get(this._options.baseUrl))!=null?d:await _.get(this._options.environment),`/api/public/unstable/dashboards/${encodeURIComponent(r)}/placements`),method:"POST",headers:o,contentType:"application/json",queryParameters:t?.queryParams,requestType:"json",body:e,timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new I.BadRequestError(n.error.body,n.rawResponse);case 401:throw new I.UnauthorizedError(n.error.body,n.rawResponse);case 403:throw new I.AccessDeniedError(n.error.body,n.rawResponse);case 404:throw new I.NotFoundError(n.error.body,n.rawResponse);case 405:throw new I.MethodNotAllowedError(n.error.body,n.rawResponse);case 409:throw new I.ConflictError(n.error.body,n.rawResponse);case 429:throw new I.TooManyRequestsError(n.error.body,n.rawResponse);case 500:throw new I.InternalServerError(n.error.body,n.rawResponse);case 400:throw new y(n.error.body,n.rawResponse);case 401:throw new b(n.error.body,n.rawResponse);case 403:throw new v(n.error.body,n.rawResponse);case 405:throw new S(n.error.body,n.rawResponse);case 404:throw new R(n.error.body,n.rawResponse);default:throw new m({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new m({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new T("Timeout exceeded when calling POST /api/public/unstable/dashboards/{dashboardId}/placements.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}updatePlacement(r,e,t,a){return C.fromPromise(this.__updatePlacement(r,e,t,a))}async __updatePlacement(r,e,t,a){var s,i,l,u,c,w,d,o;let n=x((s=this._options)==null?void 0:s.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(l=a?.xLangfuseSdkName)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(c=a?.xLangfuseSdkVersion)!=null?c:(u=this._options)==null?void 0:u.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(d=a?.xLangfusePublicKey)!=null?d:(w=this._options)==null?void 0:w.xLangfusePublicKey}),a?.headers),g=await P({url:E.join((o=await _.get(this._options.baseUrl))!=null?o:await _.get(this._options.environment),`/api/public/unstable/dashboards/${encodeURIComponent(r)}/placements/${encodeURIComponent(e)}`),method:"PATCH",headers:n,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:t,timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.abortSignal});if(g.ok)return{data:g.body,rawResponse:g.rawResponse};if(g.error.reason==="status-code")switch(g.error.statusCode){case 400:throw new I.BadRequestError(g.error.body,g.rawResponse);case 401:throw new I.UnauthorizedError(g.error.body,g.rawResponse);case 403:throw new I.AccessDeniedError(g.error.body,g.rawResponse);case 404:throw new I.NotFoundError(g.error.body,g.rawResponse);case 405:throw new I.MethodNotAllowedError(g.error.body,g.rawResponse);case 429:throw new I.TooManyRequestsError(g.error.body,g.rawResponse);case 500:throw new I.InternalServerError(g.error.body,g.rawResponse);case 400:throw new y(g.error.body,g.rawResponse);case 401:throw new b(g.error.body,g.rawResponse);case 403:throw new v(g.error.body,g.rawResponse);case 405:throw new S(g.error.body,g.rawResponse);case 404:throw new R(g.error.body,g.rawResponse);default:throw new m({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}switch(g.error.reason){case"non-json":throw new m({statusCode:g.error.statusCode,body:g.error.rawBody,rawResponse:g.rawResponse});case"timeout":throw new T("Timeout exceeded when calling PATCH /api/public/unstable/dashboards/{dashboardId}/placements/{placementId}.");case"unknown":throw new m({message:g.error.errorMessage,rawResponse:g.rawResponse})}}deletePlacement(r,e,t){return C.fromPromise(this.__deletePlacement(r,e,t))}async __deletePlacement(r,e,t){var a,s,i,l,u,c,w,d;let o=x((a=this._options)==null?void 0:a.headers,L({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=t?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(u=t?.xLangfuseSdkVersion)!=null?u:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(w=t?.xLangfusePublicKey)!=null?w:(c=this._options)==null?void 0:c.xLangfusePublicKey}),t?.headers),n=await P({url:E.join((d=await _.get(this._options.baseUrl))!=null?d:await _.get(this._options.environment),`/api/public/unstable/dashboards/${encodeURIComponent(r)}/placements/${encodeURIComponent(e)}`),method:"DELETE",headers:o,queryParameters:t?.queryParams,timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new I.BadRequestError(n.error.body,n.rawResponse);case 401:throw new I.UnauthorizedError(n.error.body,n.rawResponse);case 403:throw new I.AccessDeniedError(n.error.body,n.rawResponse);case 404:throw new I.NotFoundError(n.error.body,n.rawResponse);case 405:throw new I.MethodNotAllowedError(n.error.body,n.rawResponse);case 429:throw new I.TooManyRequestsError(n.error.body,n.rawResponse);case 500:throw new I.InternalServerError(n.error.body,n.rawResponse);case 400:throw new y(n.error.body,n.rawResponse);case 401:throw new b(n.error.body,n.rawResponse);case 403:throw new v(n.error.body,n.rawResponse);case 405:throw new S(n.error.body,n.rawResponse);case 404:throw new R(n.error.body,n.rawResponse);default:throw new m({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new m({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new T("Timeout exceeded when calling DELETE /api/public/unstable/dashboards/{dashboardId}/placements/{placementId}.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){let r=await _.get(this._options.username),e=await _.get(this._options.password);if(r!=null&&e!=null)return G.toAuthorizationHeader({username:r,password:e})}},Al=class{constructor(r){this._options=r}get dashboardWidgets(){var r;return(r=this._dashboardWidgets)!=null?r:this._dashboardWidgets=new Pl(this._options)}get dashboards(){var r;return(r=this._dashboards)!=null?r:this._dashboards=new Cl(this._options)}},tn=class{constructor(r){this._options={...r,headers:x({"X-Langfuse-Sdk-Name":r?.xLangfuseSdkName,"X-Langfuse-Sdk-Version":r?.xLangfuseSdkVersion,"X-Langfuse-Public-Key":r?.xLangfusePublicKey},r?.headers)}}get annotationQueues(){var r;return(r=this._annotationQueues)!=null?r:this._annotationQueues=new Zi(this._options)}get blobStorageIntegrations(){var r;return(r=this._blobStorageIntegrations)!=null?r:this._blobStorageIntegrations=new Oi(this._options)}get comments(){var r;return(r=this._comments)!=null?r:this._comments=new qi(this._options)}get datasetItems(){var r;return(r=this._datasetItems)!=null?r:this._datasetItems=new el(this._options)}get datasetRunItems(){var r;return(r=this._datasetRunItems)!=null?r:this._datasetRunItems=new rl(this._options)}get datasets(){var r;return(r=this._datasets)!=null?r:this._datasets=new ol(this._options)}get evaluationRules(){var r;return(r=this._evaluationRules)!=null?r:this._evaluationRules=new tl(this._options)}get evaluators(){var r;return(r=this._evaluators)!=null?r:this._evaluators=new al(this._options)}get experiments(){var r;return(r=this._experiments)!=null?r:this._experiments=new nl(this._options)}get feedback(){var r;return(r=this._feedback)!=null?r:this._feedback=new sl(this._options)}get health(){var r;return(r=this._health)!=null?r:this._health=new il(this._options)}get ingestion(){var r;return(r=this._ingestion)!=null?r:this._ingestion=new ll(this._options)}get legacy(){var r;return(r=this._legacy)!=null?r:this._legacy=new wl(this._options)}get llmConnections(){var r;return(r=this._llmConnections)!=null?r:this._llmConnections=new hl(this._options)}get media(){var r;return(r=this._media)!=null?r:this._media=new ml(this._options)}get metrics(){var r;return(r=this._metrics)!=null?r:this._metrics=new _l(this._options)}get models(){var r;return(r=this._models)!=null?r:this._models=new gl(this._options)}get observations(){var r;return(r=this._observations)!=null?r:this._observations=new pl(this._options)}get opentelemetry(){var r;return(r=this._opentelemetry)!=null?r:this._opentelemetry=new fl(this._options)}get organizations(){var r;return(r=this._organizations)!=null?r:this._organizations=new yl(this._options)}get projects(){var r;return(r=this._projects)!=null?r:this._projects=new bl(this._options)}get promptVersion(){var r;return(r=this._promptVersion)!=null?r:this._promptVersion=new vl(this._options)}get prompts(){var r;return(r=this._prompts)!=null?r:this._prompts=new Rl(this._options)}get scim(){var r;return(r=this._scim)!=null?r:this._scim=new Sl(this._options)}get scoreConfigs(){var r;return(r=this._scoreConfigs)!=null?r:this._scoreConfigs=new xl(this._options)}get scoresV3(){var r;return(r=this._scoresV3)!=null?r:this._scoresV3=new El(this._options)}get scores(){var r;return(r=this._scores)!=null?r:this._scores=new on(this._options)}get sessions(){var r;return(r=this._sessions)!=null?r:this._sessions=new Tl(this._options)}get trace(){var r;return(r=this._trace)!=null?r:this._trace=new Ll(this._options)}get unstable(){var r;return(r=this._unstable)!=null?r:this._unstable=new Al(this._options)}},Fo=class{constructor(r){let{source:e}=r;if(this._source=e,e==="base64_data_uri"){let[t,a]=this.parseBase64DataUri(r.base64DataUri);this._contentBytes=t,this._contentType=a}else this._contentBytes=r.contentBytes,this._contentType=r.contentType}parseBase64DataUri(r){try{if(!r||typeof r!="string")throw new Error("Data URI is not a string");if(!r.startsWith("data:"))throw new Error("Data URI does not start with 'data:'");let[e,t]=r.slice(5).split(",",2);if(!e||!t)throw new Error("Invalid URI");let a=e.split(";");if(!a.includes("base64"))throw new Error("Data is not base64 encoded");let s=a[0];if(!s)throw new Error("Content type is empty");return[Ko(t),s]}catch(e){return re().error("Error parsing base64 data URI",e),[void 0,void 0]}}async getId(){let r=await this.getSha256Hash();return r?r.replaceAll("+","-").replaceAll("/","_").slice(0,22):null}get contentLength(){var r;return(r=this._contentBytes)==null?void 0:r.length}async getSha256Hash(){if(this._contentBytes)try{let r=await crypto.subtle.digest("SHA-256",this._contentBytes);return Vo(new Uint8Array(r))}catch(r){re().warn("[Langfuse] Failed to generate SHA-256 hash for media content:",r);return}}async getTag(){let r=await this.getId();return!this._contentType||!this._source||!r?null:`@@@langfuseMedia:type=${this._contentType}|id=${r}|source=${this._source}@@@`}get base64DataUri(){return this._contentBytes?`data:${this._contentType};base64,${Vo(this._contentBytes)}`:null}toJSON(){return this.base64DataUri}};async function an(r){var e;let{apiClient:t,media:a,traceId:s,observationId:i,datasetId:l,datasetItemId:u,field:c,maxRetries:w=3,baseDelay:d=1e3}=r,o=(e=r.logger)!=null?e:re(),n=await a.getSha256Hash();if(!a.contentLength||!a._contentType||!n||!a._contentBytes)throw new Error("Cannot upload media: media content is incomplete.");let{uploadUrl:g,mediaId:h}=await t.media.getUploadUrl({contentLength:a.contentLength,traceId:s,observationId:i,datasetId:l,datasetItemId:u,field:c,contentType:a._contentType,sha256Hash:n});if(!g){o.debug(`Media status: Media with ID ${h} already uploaded. Skipping duplicate upload.`);return}let p=await a.getId();if(p!==h)throw new Error(`Media integrity error: Media ID mismatch between SDK (${p}) and Server (${h}). Upload cancelled.`);o.debug(`Uploading media ${h}...`);let f=Date.now(),A=await Il({uploadUrl:g,contentBytes:a._contentBytes,contentType:a._contentType,contentSha256Hash:n,maxRetries:w,baseDelay:d});if(!A)throw new Error("Media upload process failed");let k=A.status===200||A.status===201;if(await t.media.patch(h,{uploadedAt:new Date().toISOString(),uploadHttpStatus:A.status,uploadHttpError:await A.text(),uploadTimeMs:Date.now()-f}),o.debug(`Media upload status reported for ${h}`),!k)throw new Error(`Media upload failed with HTTP ${A.status} after ${w} retries.`)}async function Il(r){let{uploadUrl:e,contentType:t,contentSha256Hash:a,contentBytes:s,maxRetries:i,baseDelay:l}=r;for(let u=0;u<=i;u++)try{let c;try{c=new URL(e).hostname}catch{c=""}let d=c==="storage.googleapis.com"||c.endsWith(".storage.googleapis.com")?{"Content-Type":t}:{"Content-Type":t,"x-amz-checksum-sha256":a,"x-ms-blob-type":"BlockBlob"},o=await fetch(e,{method:"PUT",body:s,headers:d});if(u<i&&o.status!==200&&o.status!==201)throw new Error(`Upload failed with status ${o.status}`);return o}catch(c){if(u===i)throw c;let w=l*Math.pow(2,u),d=Math.random()*1e3;await new Promise(o=>setTimeout(o,w+d))}}var kl=["experimentId","experimentName","experimentMetadata","experimentDatasetId","experimentItemId","experimentItemMetadata","experimentItemRootObservationId"],me={userId:ee("langfuse_user_id"),sessionId:ee("langfuse_session_id"),metadata:ee("langfuse_metadata"),version:ee("langfuse_version"),tags:ee("langfuse_tags"),traceName:ee("langfuse_trace_name"),environment:ee("langfuse_environment"),promptName:ee("langfuse_prompt_name"),promptVersion:ee("langfuse_prompt_version"),experimentId:ee("langfuse_experiment_id"),experimentName:ee("langfuse_experiment_name"),experimentMetadata:ee("langfuse_experiment_metadata"),experimentDatasetId:ee("langfuse_experiment_dataset_id"),experimentItemId:ee("langfuse_experiment_item_id"),experimentItemMetadata:ee("langfuse_experiment_item_metadata"),experimentItemRootObservationId:ee("langfuse_experiment_item_root_observation_id")},q="langfuse_",Nl=",",nn="langfuse_trace_id";function sn(r){let e=Ao.getBaggage(r),t=e?.getEntry(nn);if(t?.value)return t.value.toLowerCase()}function ln(r){let e={},t=Ao.getBaggage(r);t&&t.getAllEntries().forEach(([n,g])=>{if(n!==nn&&n.startsWith(q)){let h=Vl(n);if(h){if(h==="langfuse.environment"){ta(g.value)&&(e[h]=g.value);return}if(h==="langfuse.observation.prompt.version"&&/^\d+$/.test(g.value)){e[h]=Number(g.value);return}let p=n==Ul("tags");e[h]=p?g.value.split(Nl):g.value}}});let a=r.getValue(me.userId);if(a&&typeof a=="string"){let n=J("userId");e[n]=a}let s=r.getValue(me.sessionId);if(s&&typeof s=="string"){let n=J("sessionId");e[n]=s}let i=r.getValue(me.version);if(i&&typeof i=="string"){let n=J("version");e[n]=i}let l=r.getValue(me.traceName);if(l&&typeof l=="string"){let n=J("traceName");e[n]=l}let u=r.getValue(me.environment);ta(u)&&(e["langfuse.environment"]=u);let c=r.getValue(me.tags);if(c&&Array.isArray(c)){let n=J("tags");e[n]=c}let w=r.getValue(me.promptName);if(w&&typeof w=="string"){let n=J("promptName");e[n]=w}let d=r.getValue(me.promptVersion);if(typeof d=="number"){let n=J("promptVersion");e[n]=d}let o=r.getValue(me.metadata);if(o&&typeof o=="object"&&o!==null)for(let[n,g]of Object.entries(o)){let h=`langfuse.trace.metadata.${n}`;e[h]=String(g)}for(let n of kl){let g=me[n],h=r.getValue(g);if(h&&typeof h=="string"){let p=J(n);e[p]=h}}return e[J("experimentItemRootObservationId")]&&(e["langfuse.environment"]=cs),e}var Ml=/^(?!langfuse)[a-z0-9_-]+$/;function ta(r){let e=re();return typeof r!="string"?(r!==void 0&&e.warn("Propagated attribute 'environment' must be a string. Dropping value."),!1):r.length>40?(e.warn(`Propagated attribute 'environment' value is over 40 characters (${r.length} chars). Dropping value.`),!1):Ml.test(r)?!0:(e.warn("Propagated attribute 'environment' must be a lowercase alphanumeric string with optional hyphens or underscores and must not start with 'langfuse'. Dropping value."),!1)}function J(r){switch(r){case"userId":return"user.id";case"sessionId":return"session.id";case"version":return"langfuse.version";case"traceName":return"langfuse.trace.name";case"environment":return"langfuse.environment";case"metadata":return"langfuse.trace.metadata";case"tags":return"langfuse.trace.tags";case"promptName":return"langfuse.observation.prompt.name";case"promptVersion":return"langfuse.observation.prompt.version";case"experimentId":return"langfuse.experiment.id";case"experimentName":return"langfuse.experiment.name";case"experimentMetadata":return"langfuse.experiment.metadata";case"experimentDatasetId":return"langfuse.experiment.dataset.id";case"experimentItemId":return"langfuse.experiment.item.id";case"experimentItemMetadata":return"langfuse.experiment.item.metadata";case"experimentItemRootObservationId":return"langfuse.experiment.item.root_observation_id";default:throw Error("Unhandled propagated key",r)}}function Ul(r){switch(r){case"userId":return`${q}user_id`;case"sessionId":return`${q}session_id`;case"version":return`${q}version`;case"traceName":return`${q}trace_name`;case"environment":return`${q}environment`;case"metadata":return`${q}metadata`;case"tags":return`${q}tags`;case"promptName":return`${q}prompt_name`;case"promptVersion":return`${q}prompt_version`;case"experimentId":return`${q}experiment_id`;case"experimentName":return`${q}experiment_name`;case"experimentMetadata":return`${q}experiment_metadata`;case"experimentDatasetId":return`${q}experiment_dataset_id`;case"experimentItemId":return`${q}experiment_item_id`;case"experimentItemMetadata":return`${q}experiment_item_metadata`;case"experimentItemRootObservationId":return`${q}experiment_item_root_observation_id`;default:throw Error("Unhandled propagated key",r)}}function Vl(r){if(!r.startsWith(q))return;let e=r.slice(q.length);if(e.startsWith("metadata_"))return`langfuse.trace.metadata.${e.slice(9)}`;switch(e){case"user_id":return J("userId");case"session_id":return J("sessionId");case"version":return J("version");case"trace_name":return J("traceName");case"environment":return J("environment");case"tags":return J("tags");case"prompt_name":return J("promptName");case"prompt_version":return J("promptVersion");case"experiment_id":return J("experimentId");case"experiment_name":return J("experimentName");case"experiment_metadata":return J("experimentMetadata");case"experiment_dataset_id":return J("experimentDatasetId");case"experiment_item_id":return J("experimentItemId");case"experiment_item_metadata":return J("experimentItemMetadata");case"experiment_item_root_observation_id":return J("experimentItemRootObservationId")}}ns();var Bl=class{constructor(r){this.pendingMediaUploads=new Set,this.apiClient=r.apiClient}get logger(){return re()}async flush(){await Promise.all(Array.from(this.pendingMediaUploads))}async process(r){var e;let t=[j.OBSERVATION_INPUT,j.TRACE_INPUT,j.OBSERVATION_OUTPUT,j.TRACE_OUTPUT,j.OBSERVATION_METADATA,j.TRACE_METADATA];for(let a of t){let s=Object.keys(r.attributes).filter(i=>i.startsWith(a));for(let i of s){let l=r.attributes[i];if(typeof l!="string"){this.logger.warn(`Span attribute ${a} is not a stringified object. Skipping media handling.`);continue}let u=l,c=/data:[^;]+;base64,[A-Za-z0-9+/]+=*/g,w=[...new Set((e=l.match(c))!=null?e:[])];if(w.length!==0){for(let d of w){let o=new Fo({base64DataUri:d,source:"base64_data_uri"}),n=await o.getTag();if(!n){this.logger.warn("Failed to create Langfuse media tag. Skipping media item.");continue}this.scheduleUpload({span:r,media:o,field:a.includes("input")?"input":a.includes("output")?"output":"metadata"}),u=u.replaceAll(d,n)}r.attributes[i]=u}}}if(["ai","gen_ai"].includes(r.instrumentationScope.name)){let a=["ai.prompt.messages","ai.prompt"];for(let i of a){let l=r.attributes[i];if(!l||typeof l!="string")continue;let u=l;try{let c=JSON.parse(l);if(Array.isArray(c)){for(let w of c)if(Array.isArray(w.content)){let d=w.content;for(let o of d)if(o.type==="file"){let n=null,g=o.mediaType;if(typeof o.data=="string"&&!o.data.startsWith("http")&&(n=o.data),typeof o.image=="string"&&!o.image.startsWith("http")&&(n=o.image),!n||typeof g!="string")continue;u=await this.replaceBytesMedia({span:r,mediaReplacedValue:u,base64Content:n,contentType:g,field:"input"})}}}r.attributes[i]=u}catch(c){this.logger.warn(`Failed to handle media for AI SDK attribute ${i} for span ${r.spanContext().spanId}`,c)}}let s=[{attribute:"gen_ai.input.messages",field:"input"},{attribute:"gen_ai.output.messages",field:"output"}];for(let{attribute:i,field:l}of s){let u=r.attributes[i];if(!u||typeof u!="string")continue;let c=u;try{let w=JSON.parse(u);if(Array.isArray(w)){for(let d of w)if(Array.isArray(d.parts))for(let o of d.parts){let n=o.content,g=o.mime_type;if(o.type!=="blob"||typeof n!="string"||!n||typeof g!="string"||n.startsWith("http"))continue;let h=jl(n);h&&(c=await this.replaceBytesMedia({span:r,mediaReplacedValue:c,base64Content:h.base64Content,contentToReplace:n,contentType:g,field:l}))}}r.attributes[i]=c}catch(w){this.logger.warn(`Failed to handle media for AI SDK v7 attribute ${i} for span ${r.spanContext().spanId}`,w)}}}}async replaceBytesMedia(r){var e;let t=new Fo({contentType:r.contentType,contentBytes:Ko(r.base64Content),source:"bytes"}),a=await t.getTag();return a?(this.scheduleUpload({span:r.span,media:t,field:r.field}),r.mediaReplacedValue.replaceAll((e=r.contentToReplace)!=null?e:r.base64Content,a)):(this.logger.warn("Failed to create Langfuse media tag. Skipping media item."),r.mediaReplacedValue)}scheduleUpload(r){let{span:e,field:t,media:a}=r,s=this.handleUpload({media:a,traceId:e.spanContext().traceId,observationId:e.spanContext().spanId,field:t}).catch(i=>{this.logger.error("Media upload failed with error: ",i)});this.pendingMediaUploads.add(s),s.finally(()=>{this.pendingMediaUploads.delete(s)})}async handleUpload({media:r,traceId:e,observationId:t,field:a}){try{await an({apiClient:this.apiClient,media:r,traceId:e,observationId:t,field:a,logger:this.logger})}catch(s){this.logger.error(`Error processing media item: ${s}`)}}};function jl(r){if(!r.startsWith("data:"))return{base64Content:r};let e=r.indexOf(";base64,");if(e===-1)return;let t=r.slice(e+8);if(t)return{base64Content:t}}var $o=64*1024*1024;function zl(r){var e,t;let a=0;for(let s of r){a+=s.name.length+((t=(e=s.status.message)==null?void 0:e.length)!=null?t:0)+Wo(s.attributes);for(let i of s.events)a+=i.name.length+Wo(i.attributes);for(let i of s.links)a+=Wo(i.attributes)}return a}function Wo(r={}){let e=0;for(let[t,a]of Object.entries(r))if(e+=t.length,typeof a=="string")e+=a.length;else if(Array.isArray(a))for(let s of a)typeof s=="string"&&(e+=s.length);return e}function Kl(r){let e=r?.trim();if(!e)return $o;let t=/^\d+$/.test(e)?Number(e):Number.NaN;return Number.isSafeInteger(t)&&t>0?t:(re().warn("Invalid LANGFUSE_OTEL_MAX_BATCH_SIZE_BYTES. Using the default limit.",{defaultMaxBatchSizeBytes:$o}),$o)}function Xl(){return Kl(oe("LANGFUSE_OTEL_MAX_BATCH_SIZE_BYTES"))}var Dl=class{constructor(r){this.delegate=r.delegate,this.maxBatchSizeBytes=r.maxBatchSizeBytes}export(r,e){let t=zl(r);if(t>this.maxBatchSizeBytes){re().warn("Dropping OpenTelemetry span batch because it exceeds the configured byte limit.",{maxBatchSizeBytes:this.maxBatchSizeBytes,sizeLowerBoundBytes:t,spanCount:r.length}),e({code:Ie.FAILED,error:new Error(`OpenTelemetry span batch size of at least ${t} bytes exceeds the configured limit of ${this.maxBatchSizeBytes} bytes.`)});return}this.delegate.export(r,e)}forceFlush(){var r,e,t;return(t=(e=(r=this.delegate).forceFlush)==null?void 0:e.call(r))!=null?t:Promise.resolve()}shutdown(){return this.delegate.shutdown()}},Gl=[or,"agent_framework","ai","haystack","langsmith","litellm","openinference","opentelemetry.instrumentation.anthropic","opentelemetry.instrumentation.aws_bedrock","opentelemetry.instrumentation.bedrock","opentelemetry.instrumentation.gemini","opentelemetry.instrumentation.google_genai","opentelemetry.instrumentation.google_generativeai","opentelemetry.instrumentation.openai","opentelemetry.instrumentation.openai_v2","opentelemetry.instrumentation.vertex_ai","opentelemetry.instrumentation.vertexai","strands-agents","vllm"],Hl=new Set(["ai"]);function Fl(r){return r.instrumentationScope.name===or}function $l(r){return Object.keys(r.attributes).some(e=>e.startsWith("gen_ai."))}function Wl(r){let e=r.instrumentationScope.name;return Gl.some(t=>e===t||!Hl.has(t)&&e.startsWith(`${t}.`))}function Ql(r){return Fl(r)||$l(r)||Wl(r)}var un=class{constructor(r){this.pendingEndedSpans=new Set,this.spanExportExpectationById=new Map;var e,t,a,s,i,l,u,c,w,d,o,n,g;let h=re(),p=(e=r?.publicKey)!=null?e:oe("LANGFUSE_PUBLIC_KEY"),f=(t=r?.secretKey)!=null?t:oe("LANGFUSE_SECRET_KEY"),A=(i=(s=(a=r?.baseUrl)!=null?a:oe("LANGFUSE_BASE_URL"))!=null?s:oe("LANGFUSE_BASEURL"))!=null?i:"https://cloud.langfuse.com";!r?.exporter&&!p&&h.warn("No exporter configured and no public key provided in constructor or as LANGFUSE_PUBLIC_KEY env var. Span exports will fail."),!r?.exporter&&!f&&h.warn("No exporter configured and no secret key provided in constructor or as LANGFUSE_SECRET_KEY env var. Span exports will fail."),r?.exporter&&r.compression!==void 0&&h.warn("The compression option is ignored because a custom exporter was provided. Configure compression on the exporter instead.");let k=(l=r?.flushAt)!=null?l:oe("LANGFUSE_FLUSH_AT"),U=(u=r?.flushInterval)!=null?u:oe("LANGFUSE_FLUSH_INTERVAL"),H=aa(`${p}:${f}`),D=(w=r?.timeout)!=null?w:Number((c=oe("LANGFUSE_TIMEOUT"))!=null?c:5),B=oe("LANGFUSE_MEDIA_UPLOAD_ENABLED"),N=(d=r?.mediaUploadEnabled)!=null?d:B?!["false","0"].includes(B.toLowerCase()):!0,F=r?.compression!==void 0?dn(r.compression,"compression"):dn(oe("LANGFUSE_OTEL_COMPRESSION"),"LANGFUSE_OTEL_COMPRESSION"),K=r?.exporter?r.exporter:new Dl({maxBatchSizeBytes:Xl(),delegate:new Ht({url:`${A}/api/public/otel/v1/traces`,headers:{Authorization:`Basic ${H}`,"x-langfuse-sdk-name":"javascript","x-langfuse-sdk-version":tr,"x-langfuse-public-key":p??"<missing>",...r?.additionalHeaders},timeoutMillis:D*1e3,compression:F})});this.processor=r?.exportMode==="immediate"?new Yt(K):new rr(K,{maxExportBatchSize:k?Number(k):void 0,scheduledDelayMillis:U?Number(U)*1e3:void 0}),this.publicKey=p,this.baseUrl=A,this.environment=(o=r?.environment)!=null?o:oe("LANGFUSE_TRACING_ENVIRONMENT"),this.release=(n=r?.release)!=null?n:oe("LANGFUSE_RELEASE"),this.mask=r?.mask,this.shouldExportSpan=(g=r?.shouldExportSpan)!=null?g:({otelSpan:X})=>Ql(X),this.mediaUploadEnabled=N,this.apiClient=new tn({baseUrl:this.baseUrl,username:this.publicKey,password:f,xLangfusePublicKey:this.publicKey,xLangfuseSdkVersion:tr,xLangfuseSdkName:"javascript",environment:"",headers:r?.additionalHeaders}),this.mediaService=new Bl({apiClient:this.apiClient}),h.debug("Initialized LangfuseSpanProcessor with params:",{publicKey:p,baseUrl:A,environment:this.environment,release:this.release,timeoutSeconds:D,flushAt:k,flushIntervalSeconds:U,mediaUploadEnabled:N,compression:F})}get logger(){return re()}onStart(r,e){let t=ln(e);r.attributes[j.OBSERVATION_PROMPT_NAME]!=null&&(delete t[j.OBSERVATION_PROMPT_NAME],delete t[j.OBSERVATION_PROMPT_VERSION]),r.setAttributes({[j.ENVIRONMENT]:this.environment,[j.RELEASE]:this.release,...t});try{this.markAppRootCandidate(r,e)}catch(a){this.logger.debug("App-root start-time check failed. Span will not be marked as app root.",{spanName:r.name},a)}return this.processor.onStart(r,e)}onEnd(r){this.spanExportExpectationById.delete(r.spanContext().spanId);let e=this.processEndedSpan(r).catch(t=>{this.logger.error(t)});this.pendingEndedSpans.add(e),e.finally(()=>this.pendingEndedSpans.delete(e))}async flush(){await Promise.all(Array.from(this.pendingEndedSpans)),await this.mediaService.flush()}async forceFlush(){return await this.flush(),this.processor.forceFlush()}async shutdown(){return await this.flush(),this.processor.shutdown()}async processEndedSpan(r){var e,t;try{if(this.shouldExportSpan({otelSpan:r})===!1){this.logger.debug("Dropped span due to shouldExportSpan filter.",{spanName:r.name,instrumentationScope:r.instrumentationScope.name});return}}catch(a){this.logger.error("shouldExportSpan failed with error. Dropping span.",{spanName:r.name,instrumentationScope:r.instrumentationScope.name},a);return}await this.applyMaskInPlace(r),this.mediaUploadEnabled&&await this.mediaService.process(r),this.logger.isLevelEnabled(Xo.DEBUG)&&this.logger.debug(`Processed span:
6
6
  ${JSON.stringify({name:r.name,traceId:r.spanContext().traceId,spanId:r.spanContext().spanId,parentSpanId:(t=(e=r.parentSpanContext)==null?void 0:e.spanId)!=null?t:null,attributes:r.attributes,startTime:new Date(Pr(r.startTime)),endTime:new Date(Pr(r.endTime)),durationMs:Pr(r.duration),kind:r.kind,status:r.status,resource:r.resource.attributes,instrumentationScope:r.instrumentationScope},null,2)}`),this.processor.onEnd(r)}markAppRootCandidate(r,e){var t;let a=r.spanContext().traceId,s=r.spanContext().spanId,i=(t=r.parentSpanContext)==null?void 0:t.spanId,l=this.isExpectedExportedAtStart(r),u=sn(e),c=i!==void 0?this.spanExportExpectationById.get(i)===!0:!1,w=u===a;this.spanExportExpectationById.set(s,l),l&&!c&&!w&&r.setAttribute(j.IS_APP_ROOT,!0)}isExpectedExportedAtStart(r){let e=r;try{return this.shouldExportSpan({otelSpan:e})===!0}catch(t){return this.logger.debug("shouldExportSpan threw during app-root start-time check. Span will not be marked as app root.",{spanName:r.name,instrumentationScope:e.instrumentationScope.name},t),!1}}async applyMaskInPlace(r){let e=[j.OBSERVATION_INPUT,j.TRACE_INPUT,j.OBSERVATION_OUTPUT,j.TRACE_OUTPUT,j.OBSERVATION_METADATA,j.TRACE_METADATA];for(let t of e)t in r.attributes&&(r.attributes[t]=await this.applyMask(r.attributes[t]))}async applyMask(r){if(!this.mask)return r;try{return await this.mask({data:r})}catch(e){return this.logger.warn(`Applying mask function failed due to error, fully masking property. Error: ${e}`),"<fully masked due to failed mask function>"}}};function dn(r,e){let t=r?.trim().toLowerCase();if(t){if(t===qe.GZIP)return qe.GZIP;if(t===qe.NONE)return qe.NONE;re().warn(`Invalid ${e} value "${r}". Expected "gzip" or "none". Falling back to the OTEL_EXPORTER_OTLP_*COMPRESSION environment variables.`)}}Z();Z();function Yl({input:r,output:e}={}){let t={[j.TRACE_INPUT]:_e(r),[j.TRACE_OUTPUT]:_e(e)};return Object.fromEntries(Object.entries(t).filter(([a,s])=>s!=null))}function cn(r,e){let{metadata:t,input:a,output:s,level:i,statusMessage:l,version:u,environment:c,completionStartTime:w,model:d,modelParameters:o,usageDetails:n,costDetails:g,prompt:h}=e,p={[j.OBSERVATION_TYPE]:r,[j.OBSERVATION_LEVEL]:i,[j.OBSERVATION_STATUS_MESSAGE]:l,[j.VERSION]:u,[j.ENVIRONMENT]:c,[j.OBSERVATION_INPUT]:_e(a),[j.OBSERVATION_OUTPUT]:_e(s),[j.OBSERVATION_MODEL]:d,[j.OBSERVATION_USAGE_DETAILS]:_e(n),[j.OBSERVATION_COST_DETAILS]:_e(g),[j.OBSERVATION_COMPLETION_START_TIME]:_e(w),[j.OBSERVATION_MODEL_PARAMETERS]:_e(o),...h&&!h.isFallback?{[j.OBSERVATION_PROMPT_NAME]:h.name,[j.OBSERVATION_PROMPT_VERSION]:h.version}:{},...Jl(t,"observation")};return Object.fromEntries(Object.entries(p).filter(([f,A])=>A!=null))}function _e(r){try{return typeof r=="string"?r:r!=null?JSON.stringify(r):void 0}catch{return"<failed to serialize>"}}function Jl(r,e){let t=e==="observation"?j.OBSERVATION_METADATA:j.TRACE_METADATA,a={};if(r==null)return a;if(typeof r!="object"||Array.isArray(r)){let s=_e(r);s&&(a[t]=s)}else for(let[s,i]of Object.entries(r)){let l=typeof i=="string"?i:_e(i);l&&(a[`${t}.${s}`]=l)}return a}var Qo=Symbol.for("langfuse");function Zl(){return{isolatedTracerProvider:null}}function wn(){let r=Zl();try{let e=globalThis;return typeof e!="object"||e===null?(re().warn("globalThis is not available, using fallback state"),r):(e[Qo]||Object.defineProperty(e,Qo,{value:r,writable:!1,configurable:!1,enumerable:!1}),e[Qo])}catch(e){return e instanceof Error?re().error(`Failed to access global state: ${e.message}`):re().error(`Failed to access global state: ${String(e)}`),r}}function Yo(r){wn().isolatedTracerProvider=r}function Ol(){let{isolatedTracerProvider:r}=wn();return r||be.getTracerProvider()}function hn(){return Ol().getTracer(or,tr)}var ge=class{constructor(r){var e;this.otelSpan=r.otelSpan,this.id=r.otelSpan.spanContext().spanId,this.traceId=r.otelSpan.spanContext().traceId,this.type=r.type,this.otelSpan.setAttributes(cn(r.type,(e=r.attributes)!=null?e:{}))}get tracer(){return hn()}end(r){this.otelSpan.end(r)}updateOtelSpanAttributes(r){this.otelSpan.setAttributes(cn(this.type,r))}setTraceIO(r){return this.otelSpan.setAttributes(Yl(r)),this}setTraceAsPublic(){return this.otelSpan.setAttributes({[j.TRACE_PUBLIC]:!0}),this}startObservation(r,e,t){let{asType:a="span"}=t||{};return ar(r,e,{asType:a,parentSpanContext:this.otelSpan.spanContext()})}},ql=class extends ge{constructor(r){super({...r,type:"span"})}update(r){return super.updateOtelSpanAttributes(r),this}},ed=class extends ge{constructor(r){super({...r,type:"agent"})}update(r){return super.updateOtelSpanAttributes(r),this}},rd=class extends ge{constructor(r){super({...r,type:"tool"})}update(r){return super.updateOtelSpanAttributes(r),this}},od=class extends ge{constructor(r){super({...r,type:"chain"})}update(r){return super.updateOtelSpanAttributes(r),this}},td=class extends ge{constructor(r){super({...r,type:"retriever"})}update(r){return super.updateOtelSpanAttributes(r),this}},ad=class extends ge{constructor(r){super({...r,type:"evaluator"})}update(r){return super.updateOtelSpanAttributes(r),this}},nd=class extends ge{constructor(r){super({...r,type:"guardrail"})}update(r){return super.updateOtelSpanAttributes(r),this}},sd=class extends ge{constructor(r){super({...r,type:"generation"})}update(r){return this.updateOtelSpanAttributes(r),this}},id=class extends ge{constructor(r){super({...r,type:"embedding"})}update(r){return this.updateOtelSpanAttributes(r),this}},ld=class extends ge{constructor(r){super({...r,type:"event"}),this.otelSpan.end(r.timestamp)}};function dd(r){return hn().startSpan(r.name,{startTime:r.startTime},ud(r.parentSpanContext))}function ud(r){if(r)return be.setSpanContext(te.active(),r)}function ar(r,e,t){var a;let{asType:s="span",...i}=t||{},l=dd({name:r,...i});switch(s){case"generation":return new sd({otelSpan:l,attributes:e});case"embedding":return new id({otelSpan:l,attributes:e});case"agent":return new ed({otelSpan:l,attributes:e});case"tool":return new rd({otelSpan:l,attributes:e});case"chain":return new od({otelSpan:l,attributes:e});case"retriever":return new td({otelSpan:l,attributes:e});case"evaluator":return new ad({otelSpan:l,attributes:e});case"guardrail":return new nd({otelSpan:l,attributes:e});case"event":{let u=(a=i?.startTime)!=null?a:new Date;return new ld({otelSpan:l,attributes:e,timestamp:u})}default:return new ql({otelSpan:l,attributes:e})}}Z();kr();Z();kr();ss();er();kr();Z();Z();er();Ut();Z();function cd(r){return Jo(r,new WeakSet)}function Jo(r,e){if(r==null||typeof r=="string"||typeof r=="number"||typeof r=="boolean"||r instanceof Uint8Array)return!0;if(typeof r=="object"){if(e.has(r))return!1;if(e.add(r),Array.isArray(r)){for(let a of r)if(!Jo(a,e))return!1;return!0}let t=r;if(t.constructor!==Object&&t.constructor!==void 0)return!1;for(let a in t)if(Object.prototype.hasOwnProperty.call(t,a)&&!Jo(t[a],e))return!1;return!0}return!1}var ae;(function(r){r[r.DROP_INVALID=0]="DROP_INVALID",r[r.DROP_LIMIT_REACHED=1]="DROP_LIMIT_REACHED",r[r.ADD_NEW=2]="ADD_NEW",r[r.ADD_OVERWRITE_EXISTING=3]="ADD_OVERWRITE_EXISTING"})(ae||(ae={}));function Oo(r,e,t,a,s){if(a.length===0)return M.warn(`Invalid attribute key: ${a}`),ae.DROP_INVALID;if(!cd(s))return M.warn(`Invalid attribute value set for key: ${a}`),ae.DROP_INVALID;let i=!Object.prototype.hasOwnProperty.call(r,a);return i&&t>=e.attributeCountLimit?ae.DROP_LIMIT_REACHED:(r[a]=Zo(s,e.attributeValueLengthLimit),i?ae.ADD_NEW:ae.ADD_OVERWRITE_EXISTING)}function Zo(r,e){if(e<=0)return M.warn(`Attribute value limit must be positive, got ${e}`),r;if(r==null)return r;if(typeof r=="string")return r.length<=e?r:r.substring(0,e);if(r instanceof Uint8Array)return r;if(Array.isArray(r))return r.map(t=>Zo(t,e));if(typeof r=="object"){let t={};for(let[a,s]of Object.entries(r))t[a]=Zo(s,e);return t}return r}function mn(r,e){if(e==null)return{};let t={},a=0,s=0;for(let[i,l]of Object.entries(e)){let u=Oo(t,r,a,i,l);u===ae.ADD_NEW?a+=1:(u===ae.DROP_INVALID||u===ae.DROP_LIMIT_REACHED)&&(s+=1)}return{attributes:a>0?t:void 0,droppedAttributesCount:s}}var Vr=class{resource;instrumentationScope;attributes={};_hrTime;_hrTimeObserved;_spanContext;_severityText;_severityNumber;_body;_eventName;_attributesCount=0;_droppedAttributesCount=0;_isReadonly=!1;_logRecordLimits;get hrTime(){return this._hrTime}set hrTime(e){this._isLogRecordReadonly()||(this._hrTime=e)}get hrTimeObserved(){return this._hrTimeObserved}set hrTimeObserved(e){this._isLogRecordReadonly()||(this._hrTimeObserved=e)}get spanContext(){return this._spanContext}set spanContext(e){this._isLogRecordReadonly()||(this._spanContext=e)}set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(e,t,a){let{timestamp:s,observedTimestamp:i,eventName:l,severityNumber:u,severityText:c,body:w,attributes:d={},exception:o,context:n}=a,g=Date.now();if(this._hrTime=Uo(s??g),this._hrTimeObserved=Uo(i??g),n){let h=be.getSpanContext(n);h&&Lr(h)&&(this._spanContext=h)}this.severityNumber=u,this.severityText=c,this.body=w,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=l,this.setAttributes(d),o!=null&&this._setException(o)}setAttribute(e,t){if(this._isLogRecordReadonly())return this;let a=Oo(this.attributes,this._logRecordLimits,this._attributesCount,e,t);return a===ae.DROP_LIMIT_REACHED?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&M.warn("Dropping extra attributes.")):a===ae.ADD_NEW&&this._attributesCount++,this}setAttributes(e){for(let[t,a]of Object.entries(e))this.setAttribute(t,a);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_setException(e){let t=!1;if(typeof e=="string"||typeof e=="number")Object.hasOwn(this.attributes,Je)||this.setAttribute(Je,String(e)),t=!0;else if(e&&typeof e=="object"){let a=e;a.code?(Object.hasOwn(this.attributes,Ze)||this.setAttribute(Ze,a.code.toString()),t=!0):a.name&&(Object.hasOwn(this.attributes,Ze)||this.setAttribute(Ze,a.name),t=!0),a.message&&(Object.hasOwn(this.attributes,Je)||this.setAttribute(Je,a.message),t=!0),a.stack&&(Object.hasOwn(this.attributes,ko)||this.setAttribute(ko,a.stack),t=!0)}t||M.warn(`Failed to record an exception ${e}`)}_isLogRecordReadonly(){return this._isReadonly&&M.warn("Can not execute the operation on emitted log record"),this._isReadonly}};var jr=class{_instrumentationScope;_sharedState;_loggerConfig;constructor(e,t){this._instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this._instrumentationScope)}emit(e){let t=e.context||te.active();if(!this.enabled(e))return;let a=new Vr(this._sharedState,this._instrumentationScope,{context:t,...e});this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(a,t),a._makeReadonly()}enabled(e){if(this._sharedState.hasShutdown)return!1;let t=this._loggerConfig;if(t.disabled)return!1;let a=e?.severityNumber;if(typeof a=="number"&&a!==xe.UNSPECIFIED&&a<t.minimumSeverity)return!1;let s=e?.context||te.active();if(t.traceBased){let l=be.getSpanContext(s);if(l&&Lr(l)&&!((l.traceFlags&Po.SAMPLED)===Po.SAMPLED))return!1}let i={context:s,instrumentationScope:this._instrumentationScope,severityNumber:e?.severityNumber,eventName:e?.eventName};for(let l of this._sharedState.processors)if(!l.enabled||l.enabled(i))return!0;return!1}};Z();kr();var zr=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}};er();var Kr=class{processors;constructor(e){this.processors=e}async forceFlush(e){let t=e?.timeoutMillis??3e4;await Promise.all(this.processors.map(a=>Xt(a.forceFlush(),t)))}onEmit(e,t){this.processors.forEach(a=>a.onEmit(e,t))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}enabled(e){for(let t of this.processors)if(!t.enabled||t.enabled(e))return!0;return!1}};function qo(r){if(r===void 0)return["u",null];if(r===null)return["n",null];let e=typeof r;return e==="string"?["s",r]:e==="boolean"?["b",r]:e==="number"?Number.isNaN(r)?["nan",null]:r===1/0?["inf",null]:r===-1/0?["-inf",null]:Object.is(r,-0)?["n0",null]:["d",r]:r instanceof Uint8Array?["bytes",Array.from(r)]:Array.isArray(r)?["arr",r.map(qo)]:["map",Object.entries(r).sort(([t],[a])=>t.localeCompare(a)).map(([t,a])=>[t,qo(a)])]}function Xr(r){return JSON.stringify([r.name,r.version||"",r.schemaUrl||"",qo(r.attributes),r.droppedAttributesCount??0])}var _n="otel.sdk.log.created",gn="otel.sdk.processor.log.processed",pn="otel.sdk.processor.log.queue.capacity",fn="otel.sdk.processor.log.queue.size",yn="otel.component.name",bn="otel.component.type",vn="batching_log_processor";var et="error.type";var Dr=class{createdLogs;constructor(e){this.createdLogs=e.createCounter(_n,{unit:"{log_record}",description:"The number of logs submitted to enabled SDK Loggers."})}emitLog(){this.createdLogs.add(1)}};var Rn="0.222.0";var wd={disabled:!1,minimumSeverity:xe.UNSPECIFIED,traceBased:!1},rt=()=>({...wd}),Gr=class{loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];resource;logRecordLimits;processors;loggerMetrics;hasShutdown=!1;_loggerConfigurator;_loggerConfigs=new Map;constructor(e,t,a,s,i){this.resource=e,this.logRecordLimits=t,this.processors=a,a.length>0?(this.registeredLogRecordProcessors=a,this.activeProcessor=new Kr(this.registeredLogRecordProcessors)):this.activeProcessor=new zr,this._loggerConfigurator=s??rt;let l=i?i.getMeter("@opentelemetry/sdk-logs",Rn):Se();this.loggerMetrics=new Dr(l)}getLoggerConfig(e){let t=Xr(e),a=this._loggerConfigs.get(t);return a||(a=this._loggerConfigurator(e),this._loggerConfigs.set(t,a),a)}};var hd="unknown",nr=class{_shutdownOnce;_sharedState;constructor(e={}){let t={resource:e.resource??Gt(),logRecordLimits:{attributeCountLimit:e.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:e.loggerConfigurator??rt,processors:e.processors??[],meterProvider:e.meterProvider};this._sharedState=new Gr(t.resource,t.logRecordLimits,t.processors,t.loggerConfigurator,t.meterProvider),this._shutdownOnce=new Ir(this._shutdown,this)}getLogger(e,t,a){if(this._shutdownOnce.isCalled)return M.warn("A shutdown LoggerProvider cannot provide a Logger"),Dt();e||M.warn("Logger requested without instrumentation scope name.");let i={name:e||hd,version:t,schemaUrl:a?.schemaUrl,...mn(this._sharedState.logRecordLimits,a?.attributes)},l=Xr(i);return this._sharedState.loggers.has(l)||this._sharedState.loggers.set(l,new jr(i,this._sharedState)),this._sharedState.loggers.get(l)}forceFlush(e){return this._shutdownOnce.isCalled?(M.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush(e)}shutdown(){return this._shutdownOnce.isCalled?(M.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.hasShutdown=!0,this._sharedState.activeProcessor.shutdown()}};er();var sr=class{export(e,t){this._sendLogRecords(e,t)}async forceFlush(){}async shutdown(){}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:Kt(e.hrTime),traceId:e.spanContext?.traceId,spanId:e.spanContext?.spanId,traceFlags:e.spanContext?.traceFlags,severityText:e.severityText,severityNumber:e.severityNumber,eventName:e.eventName,body:e.body,attributes:e.attributes}}_sendLogRecords(e,t){for(let a of e)console.dir(this._exportInfo(a),{depth:3});t?.({code:Ar.SUCCESS})}};var Sn=new Map,Hr=class{processedLogs;queueSize;queueSizeCallback;standardAttrs;droppedAttrs;constructor(e,t,a){let s=Sn.get(e)??0;if(Sn.set(e,s+1),this.standardAttrs={[bn]:e,[yn]:`${e}/${s}`},this.droppedAttrs={...this.standardAttrs,[et]:"queue_full"},this.processedLogs=t.createCounter(gn,{unit:"{log_record}",description:"The number of log records for which the processing has finished, either successful or failed."}),a){let{capacity:i,getQueueSize:l}=a;t.createUpDownCounter(pn,{unit:"{log_record}",description:"The maximum number of log records the queue of a given instance of an SDK log processor can hold."}).add(i,this.standardAttrs),this.queueSize=t.createObservableUpDownCounter(fn,{unit:"{log_record}",description:"The number of log records in the queue of a given instance of an SDK log processor."}),this.queueSizeCallback=c=>c.observe(l(),this.standardAttrs),this.queueSize.addCallback(this.queueSizeCallback)}}dropLogs(e){this.processedLogs.add(e,this.droppedAttrs)}finishLogs(e,t){if(!t){this.processedLogs.add(e,this.standardAttrs);return}let a={...this.standardAttrs,[et]:t.name};this.processedLogs.add(e,a)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}};Z();er();async function md(r){let e=[];for(let t=0,a=r.length;t<a;t++){let s=r[t];s.resource.asyncAttributesPending&&s.resource.waitForAsyncAttributes&&e.push(s.resource.waitForAsyncAttributes())}e!=null&&e.length>0&&await Promise.all(e)}var Fr=class{_exportCompleted;_exportScheduledPromise;_metrics;_exportScheduledResolve;constructor(e,t,a,s){this._exportScheduledPromise=new Promise(i=>{this._exportScheduledResolve=i}),this._exportCompleted=this._executeExport(e,t,a),this._metrics=s}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}async _executeExport(e,t,a){try{await md(t),await te.with(zt(te.active()),async()=>this._exportWithTimeout(e,t,a))}catch(s){Cr(s),this._exportScheduledResolve()}}async _exportWithTimeout(e,t,a){return new Promise((s,i)=>{let l=setTimeout(()=>{i(new Error("Timeout"))},a);e.export(t,u=>{this._metrics.finishLogs(t.length,u.error),clearTimeout(l),u.code===Ar.SUCCESS?s():i(u.error??new Error("BatchLogRecordProcessor: log record export failed"))}),this._exportScheduledResolve()})}},$r=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_metrics;_currentExport=null;_finishedLogRecords=[];_timer;_shutdownOnce;_flushing=!1;constructor(e){this._exporter=e.exporter,this._maxExportBatchSize=e.maxExportBatchSize??512,this._maxQueueSize=e.maxQueueSize??2048,this._scheduledDelayMillis=e.scheduledDelayMillis??1e3,this._exportTimeoutMillis=e.exportTimeoutMillis??3e4,this._shutdownOnce=new Ir(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(M.warn("BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize);let t=e?.selfObsMeterProvider?e.selfObsMeterProvider.getMeter("@opentelemetry/sdk-logs"):Se();this._metrics=new Hr(vn,t,{capacity:this._maxQueueSize,getQueueSize:()=>this._finishedLogRecords.length})}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(e){if(this._finishedLogRecords.length>=this._maxQueueSize){this._metrics.dropLogs(1);return}this._finishedLogRecords.push(e),this._maybeStartTimer()}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),this._metrics.shutdown(),await this._exporter.shutdown()}async _flushAll(){if(this._flushing)return;this._flushing=!0;let e=this._finishedLogRecords;this._finishedLogRecords=[],this._clearTimer();let t=this._currentExport;for(t!==null&&(await this._exporter.forceFlush(),await t.exportCompleted,this._currentExport=null);e.length>0;){let a;e.length<=this._maxExportBatchSize?(a=e,e=[]):a=e.splice(0,this._maxExportBatchSize);let s=new Fr(this._exporter,a,this._exportTimeoutMillis,this._metrics);this._currentExport=s;try{await s.exportScheduled,await this._exporter.forceFlush(),await s.exportCompleted}catch(i){Cr(i)}finally{this._currentExport=null}}this._flushing=!1,this._maybeStartTimer()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let e=this._finishedLogRecords;return this._finishedLogRecords=[],e}else return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let e=this._extractBatch();if(e===null)return;let t=new Fr(this._exporter,e,this._exportTimeoutMillis,this._metrics);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(a=>{this._currentExport=null,Cr(a),this._maybeStartTimer()})}_maybeStartTimer(){if(!this._shutdownOnce.isCalled&&!this._flushing&&this._finishedLogRecords.length!==0&&this._currentExport===null){if(this._finishedLogRecords.length>=this._maxExportBatchSize){this._exportOneBatch();return}this._timer===void 0&&(this._timer=setTimeout(()=>{this._timer=void 0,this._exportOneBatch()},this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}};var ke=class extends $r{onShutdown(){}};var Ve;(function(r){r[r.DELTA=0]="DELTA",r[r.CUMULATIVE=1]="CUMULATIVE"})(Ve||(Ve={}));var z;(function(r){r.COUNTER="COUNTER",r.GAUGE="GAUGE",r.HISTOGRAM="HISTOGRAM",r.UP_DOWN_COUNTER="UP_DOWN_COUNTER",r.OBSERVABLE_COUNTER="OBSERVABLE_COUNTER",r.OBSERVABLE_GAUGE="OBSERVABLE_GAUGE",r.OBSERVABLE_UP_DOWN_COUNTER="OBSERVABLE_UP_DOWN_COUNTER"})(z||(z={}));var pe;(function(r){r[r.HISTOGRAM=0]="HISTOGRAM",r[r.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",r[r.GAUGE=2]="GAUGE",r[r.SUM=3]="SUM"})(pe||(pe={}));Z();function Wr(r){let e=Object.keys(r);return e.length===0?"":(e=e.sort(),JSON.stringify(e.map(t=>[t,r[t]])))}function xn(r){return`${r.name}:${r.version??""}:${r.schemaUrl??""}`}var ir=class r extends Error{constructor(e){super(e),Object.setPrototypeOf(this,r.prototype)}};function Te(r,e){let t,a=new Promise(function(i,l){t=setTimeout(function(){l(new ir("Operation timed out."))},e)});return Promise.race([r,a]).then(s=>(clearTimeout(t),s),s=>{throw clearTimeout(t),s})}function En(r,e){if(r.size!==e.size)return!1;for(let t of r)if(!e.has(t))return!1;return!0}function Tn(r,e){let t=0,a=r.length-1,s=r.length;for(;a>=t;){let i=t+Math.trunc((a-t)/2);r[i]<e?t=i+1:(s=i,a=i-1)}return s}function Ln(r,e){return r.toLowerCase()===e.toLowerCase()}Z();var we;(function(r){r[r.DROP=0]="DROP",r[r.SUM=1]="SUM",r[r.LAST_VALUE=2]="LAST_VALUE",r[r.HISTOGRAM=3]="HISTOGRAM",r[r.EXPONENTIAL_HISTOGRAM=4]="EXPONENTIAL_HISTOGRAM"})(we||(we={}));var lr=class{kind=we.DROP;createAccumulation(){}merge(e,t){}diff(e,t){}toMetricData(e,t,a,s){}};function _d(r){let e=r.map(()=>0);return e.push(0),{buckets:{boundaries:r,counts:e},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var Be=class{startTime;_boundaries;_recordMinMax;_current;constructor(e,t,a=!0,s=_d(t)){this.startTime=e,this._boundaries=t,this._recordMinMax=a,this._current=s}record(e){if(Number.isNaN(e))return;this._current.count+=1,this._current.sum+=e,this._recordMinMax&&(this._current.min=Math.min(e,this._current.min),this._current.max=Math.max(e,this._current.max),this._current.hasMinMax=!0);let t=Tn(this._boundaries,e);this._current.buckets.counts[t]+=1}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},je=class{kind=we.HISTOGRAM;_boundaries;_recordMinMax;constructor(e,t){this._boundaries=e,this._recordMinMax=t}createAccumulation(e){return new Be(e,this._boundaries,this._recordMinMax)}merge(e,t){let a=e.toPointValue(),s=t.toPointValue(),i=a.buckets.counts,l=s.buckets.counts,u=new Array(i.length);for(let d=0;d<i.length;d++)u[d]=i[d]+l[d];let c=1/0,w=-1/0;return this._recordMinMax&&(a.hasMinMax&&s.hasMinMax?(c=Math.min(a.min,s.min),w=Math.max(a.max,s.max)):a.hasMinMax?(c=a.min,w=a.max):s.hasMinMax&&(c=s.min,w=s.max)),new Be(e.startTime,a.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:a.buckets.boundaries,counts:u},count:a.count+s.count,sum:a.sum+s.sum,hasMinMax:this._recordMinMax&&(a.hasMinMax||s.hasMinMax),min:c,max:w})}diff(e,t){let a=e.toPointValue(),s=t.toPointValue(),i=a.buckets.counts,l=s.buckets.counts,u=new Array(i.length);for(let c=0;c<i.length;c++)u[c]=l[c]-i[c];return new Be(t.startTime,a.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:a.buckets.boundaries,counts:u},count:s.count-a.count,sum:s.sum-a.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(e,t,a,s){return{descriptor:e,aggregationTemporality:t,dataPointType:pe.HISTOGRAM,dataPoints:a.map(([i,l])=>{let u=l.toPointValue(),c=e.type===z.GAUGE||e.type===z.UP_DOWN_COUNTER||e.type===z.OBSERVABLE_GAUGE||e.type===z.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:i,startTime:l.startTime,endTime:s,value:{min:u.hasMinMax?u.min:void 0,max:u.hasMinMax?u.max:void 0,sum:c?void 0:u.sum,buckets:u.buckets,count:u.count}}})}}};Z();var dr=class r{backing;indexBase;indexStart;indexEnd;constructor(e=new ot,t=0,a=0,s=0){this.backing=e,this.indexBase=t,this.indexStart=a,this.indexEnd=s}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(e,t)=>this.at(t))}at(e){let t=this.indexBase-this.indexStart;return e<t&&(e+=this.backing.length),e-=t,this.backing.countAt(e)}incrementBucket(e,t){this.backing.increment(e,t)}decrementBucket(e,t){this.backing.decrement(e,t)}trim(){for(let e=0;e<this.length;e++)if(this.at(e)!==0){this.indexStart+=e;break}else if(e===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let e=this.length-1;e>=0;e--)if(this.at(e)!==0){this.indexEnd-=this.length-e-1;break}this._rotate()}downscale(e){this._rotate();let t=1+this.indexEnd-this.indexStart,a=1<<e,s=0,i=0;for(let l=this.indexStart;l<=this.indexEnd;){let u=l%a;u<0&&(u+=a);for(let c=u;c<a&&s<t;c++)this._relocateBucket(i,s),s++,l++;i++}this.indexStart>>=e,this.indexEnd>>=e,this.indexBase=this.indexStart}clone(){return new r(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let e=this.indexBase-this.indexStart;e!==0&&(e>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,e),this.backing.reverse(e,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+e)),this.indexBase=this.indexStart)}_relocateBucket(e,t){e!==t&&this.incrementBucket(e,this.backing.emptyBucket(t))}},ot=class r{_counts;constructor(e=[0]){this._counts=e}get length(){return this._counts.length}countAt(e){return this._counts[e]}growTo(e,t,a){let s=new Array(e).fill(0);s.splice(a,this._counts.length-t,...this._counts.slice(t)),s.splice(0,t,...this._counts.slice(0,t)),this._counts=s}reverse(e,t){let a=Math.floor((e+t)/2)-e;for(let s=0;s<a;s++){let i=this._counts[e+s];this._counts[e+s]=this._counts[t-s-1],this._counts[t-s-1]=i}}emptyBucket(e){let t=this._counts[e];return this._counts[e]=0,t}increment(e,t){this._counts[e]+=t}decrement(e,t){this._counts[e]>=t?this._counts[e]-=t:this._counts[e]=0}clone(){return new r([...this._counts])}};var ur=Math.pow(2,-1022),tt=new DataView(new ArrayBuffer(8));function Pn(r){return tt.setFloat64(0,r),{hi:tt.getUint32(0),lo:tt.getUint32(4)}}function Qr(r){let{hi:e}=Pn(r);return((e&2146435072)>>20)-1023}function Yr(r){let{hi:e,lo:t}=Pn(r);return(e&1048575)===0&&t===0}function cr(r,e){return r===0||r===Number.POSITIVE_INFINITY||r===Number.NEGATIVE_INFINITY||Number.isNaN(r)?r:r*Math.pow(2,e)}function An(r){return r--,r|=r>>1,r|=r>>2,r|=r>>4,r|=r>>8,r|=r>>16,r++,r}var fe=class extends Error{};var Jr=class{_shift;constructor(e){this._shift=-e}mapToIndex(e){if(e<ur)return this._minNormalLowerBoundaryIndex();let t=Qr(e),a=Yr(e)?-1:0;return t+a>>this._shift}lowerBoundary(e){let t=this._minNormalLowerBoundaryIndex();if(e<t)throw new fe(`underflow: ${e} is < minimum lower boundary: ${t}`);let a=this._maxNormalLowerBoundaryIndex();if(e>a)throw new fe(`overflow: ${e} is > maximum lower boundary: ${a}`);return cr(1,e<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let e=-1022>>this._shift;return this._shift<2&&e--,e}_maxNormalLowerBoundaryIndex(){return 1023>>this._shift}};var Zr=class{_scale;_scaleFactor;_inverseFactor;constructor(e){this._scale=e,this._scaleFactor=cr(Math.LOG2E,e),this._inverseFactor=cr(Math.LN2,-e)}mapToIndex(e){if(e<=ur)return this._minNormalLowerBoundaryIndex()-1;if(Yr(e))return(Qr(e)<<this._scale)-1;let t=Math.floor(Math.log(e)*this._scaleFactor),a=this._maxNormalLowerBoundaryIndex();return t>=a?a:t}lowerBoundary(e){let t=this._maxNormalLowerBoundaryIndex();if(e>=t){if(e===t)return 2*Math.exp((e-(1<<this._scale))/this._scaleFactor);throw new fe(`overflow: ${e} is > maximum lower boundary: ${t}`)}let a=this._minNormalLowerBoundaryIndex();if(e<=a){if(e===a)return ur;if(e===a-1)return Math.exp((e+(1<<this._scale))/this._scaleFactor)/2;throw new fe(`overflow: ${e} is < minimum lower boundary: ${a}`)}return Math.exp(e*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return-1022<<this._scale}_maxNormalLowerBoundaryIndex(){return(1024<<this._scale)-1}};var kn=-10,Nn=20,gd=Array.from({length:31},(r,e)=>e>10?new Zr(e-10):new Jr(e-10));function st(r){if(r>Nn||r<kn)throw new fe(`expected scale >= ${kn} && <= ${Nn}, got: ${r}`);return gd[r+10]}var ze=class r{static combine(e,t){return new r(Math.min(e.low,t.low),Math.max(e.high,t.high))}low;high;constructor(e,t){this.low=e,this.high=t}},pd=20,fd=160,it=2,Or=class r{startTime;_maxSize;_recordMinMax;_sum;_count;_zeroCount;_min;_max;_positive;_negative;_mapping;constructor(e,t=fd,a=!0,s=0,i=0,l=0,u=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,w=new dr,d=new dr,o=st(pd)){this.startTime=e,this._maxSize=t,this._recordMinMax=a,this._sum=s,this._count=i,this._zeroCount=l,this._min=u,this._max=c,this._positive=w,this._negative=d,this._mapping=o,this._maxSize<it&&(M.warn(`Exponential Histogram Max Size set to ${this._maxSize}, changing to the minimum size of: ${it}`),this._maxSize=it)}record(e){this.updateByIncrement(e,1)}setStartTime(e){this.startTime=e}toPointValue(){return{hasMinMax:this._recordMinMax,min:this.min,max:this.max,sum:this.sum,positive:{offset:this.positive.offset,bucketCounts:this.positive.counts()},negative:{offset:this.negative.offset,bucketCounts:this.negative.counts()},count:this.count,scale:this.scale,zeroCount:this.zeroCount}}get sum(){return this._sum}get min(){return this._min}get max(){return this._max}get count(){return this._count}get zeroCount(){return this._zeroCount}get scale(){return this._count===this._zeroCount?0:this._mapping.scale}get positive(){return this._positive}get negative(){return this._negative}updateByIncrement(e,t){if(Number.isFinite(e)){if(e>this._max&&(this._max=e),e<this._min&&(this._min=e),this._count+=t,e===0){this._zeroCount+=t;return}this._sum+=e*t,e>0?this._updateBuckets(this._positive,e,t):this._updateBuckets(this._negative,-e,t)}}merge(e){this._count===0?(this._min=e.min,this._max=e.max):e.count!==0&&(e.min<this.min&&(this._min=e.min),e.max>this.max&&(this._max=e.max)),this.startTime=e.startTime,this._sum+=e.sum,this._count+=e.count,this._zeroCount+=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._mergeBuckets(this.positive,e,e.positive,t),this._mergeBuckets(this.negative,e,e.negative,t)}diff(e){this._min=1/0,this._max=-1/0,this._sum-=e.sum,this._count-=e.count,this._zeroCount-=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._diffBuckets(this.positive,e,e.positive,t),this._diffBuckets(this.negative,e,e.negative,t)}clone(){return new r(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)}_updateBuckets(e,t,a){let s=this._mapping.mapToIndex(t),i=!1,l=0,u=0;if(e.length===0?(e.indexStart=s,e.indexEnd=e.indexStart,e.indexBase=e.indexStart):s<e.indexStart&&e.indexEnd-s>=this._maxSize?(i=!0,u=s,l=e.indexEnd):s>e.indexEnd&&s-e.indexStart>=this._maxSize&&(i=!0,u=e.indexStart,l=s),i){let c=this._changeScale(l,u);this._downscale(c),s=this._mapping.mapToIndex(t)}this._incrementIndexBy(e,s,a)}_incrementIndexBy(e,t,a){if(a===0)return;if(e.length===0&&(e.indexStart=e.indexEnd=e.indexBase=t),t<e.indexStart){let i=e.indexEnd-t;i>=e.backing.length&&this._grow(e,i+1),e.indexStart=t}else if(t>e.indexEnd){let i=t-e.indexStart;i>=e.backing.length&&this._grow(e,i+1),e.indexEnd=t}let s=t-e.indexBase;s<0&&(s+=e.backing.length),e.incrementBucket(s,a)}_grow(e,t){let a=e.backing.length,s=e.indexBase-e.indexStart,i=a-s,l=An(t);l>this._maxSize&&(l=this._maxSize);let u=l-s;e.backing.growTo(l,i,u)}_changeScale(e,t){let a=0;for(;e-t>=this._maxSize;)e>>=1,t>>=1,a++;return a}_downscale(e){if(e===0)return;if(e<0)throw new Error(`impossible change of scale: ${this.scale}`);let t=this._mapping.scale-e;this._positive.downscale(e),this._negative.downscale(e),this._mapping=st(t)}_minScale(e){let t=Math.min(this.scale,e.scale),a=ze.combine(this._highLowAtScale(this.positive,this.scale,t),this._highLowAtScale(e.positive,e.scale,t)),s=ze.combine(this._highLowAtScale(this.negative,this.scale,t),this._highLowAtScale(e.negative,e.scale,t));return Math.min(t-this._changeScale(a.high,a.low),t-this._changeScale(s.high,s.low))}_highLowAtScale(e,t,a){if(e.length===0)return new ze(0,-1);let s=t-a;return new ze(e.indexStart>>s,e.indexEnd>>s)}_mergeBuckets(e,t,a,s){let i=a.offset,l=t.scale-s;for(let u=0;u<a.length;u++)this._incrementIndexBy(e,i+u>>l,a.at(u))}_diffBuckets(e,t,a,s){let i=a.offset,l=t.scale-s;for(let u=0;u<a.length;u++){let w=(i+u>>l)-e.indexBase;w<0&&(w+=e.backing.length),e.decrementBucket(w,a.at(u))}e.trim()}},wr=class{kind=we.EXPONENTIAL_HISTOGRAM;_maxSize;_recordMinMax;constructor(e,t){this._maxSize=e,this._recordMinMax=t}createAccumulation(e){return new Or(e,this._maxSize,this._recordMinMax)}merge(e,t){let a=t.clone();return a.merge(e),a}diff(e,t){let a=t.clone();return a.diff(e),a}toMetricData(e,t,a,s){return{descriptor:e,aggregationTemporality:t,dataPointType:pe.EXPONENTIAL_HISTOGRAM,dataPoints:a.map(([i,l])=>{let u=l.toPointValue(),c=e.type===z.GAUGE||e.type===z.UP_DOWN_COUNTER||e.type===z.OBSERVABLE_GAUGE||e.type===z.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:i,startTime:l.startTime,endTime:s,value:{min:u.hasMinMax?u.min:void 0,max:u.hasMinMax?u.max:void 0,sum:c?void 0:u.sum,positive:{offset:u.positive.offset,bucketCounts:u.positive.bucketCounts},negative:{offset:u.negative.offset,bucketCounts:u.negative.bucketCounts},count:u.count,scale:u.scale,zeroCount:u.zeroCount}}})}}};var Ke=class{startTime;_current;sampleTime;constructor(e,t=0,a=[0,0]){this.startTime=e,this._current=t,this.sampleTime=a}record(e){this._current=e,this.sampleTime=Me(Date.now())}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},hr=class{kind=we.LAST_VALUE;createAccumulation(e){return new Ke(e)}merge(e,t){let a=Oe(t.sampleTime)>=Oe(e.sampleTime)?t:e;return new Ke(e.startTime,a.toPointValue(),a.sampleTime)}diff(e,t){let a=Oe(t.sampleTime)>=Oe(e.sampleTime)?t:e;return new Ke(t.startTime,a.toPointValue(),a.sampleTime)}toMetricData(e,t,a,s){return{descriptor:e,aggregationTemporality:t,dataPointType:pe.GAUGE,dataPoints:a.map(([i,l])=>({attributes:i,startTime:l.startTime,endTime:s,value:l.toPointValue()}))}}};var Le=class{startTime;monotonic;_current;reset;constructor(e,t,a=0,s=!1){this.startTime=e,this.monotonic=t,this._current=a,this.reset=s}record(e){this.monotonic&&e<0||(this._current+=e)}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},Xe=class{kind=we.SUM;monotonic;constructor(e){this.monotonic=e}createAccumulation(e){return new Le(e,this.monotonic)}merge(e,t){let a=e.toPointValue(),s=t.toPointValue();return t.reset?new Le(t.startTime,this.monotonic,s,t.reset):new Le(e.startTime,this.monotonic,a+s)}diff(e,t){let a=e.toPointValue(),s=t.toPointValue();return this.monotonic&&a>s?new Le(t.startTime,this.monotonic,s,!0):new Le(t.startTime,this.monotonic,s-a)}toMetricData(e,t,a,s){return{descriptor:e,aggregationTemporality:t,dataPointType:pe.SUM,dataPoints:a.map(([i,l])=>({attributes:i,startTime:l.startTime,endTime:s,value:l.toPointValue()})),isMonotonic:this.monotonic}}};var lt=class r{static DEFAULT_INSTANCE=new lr;createAggregator(e){return r.DEFAULT_INSTANCE}},dt=class r{static MONOTONIC_INSTANCE=new Xe(!0);static NON_MONOTONIC_INSTANCE=new Xe(!1);createAggregator(e){switch(e.type){case z.COUNTER:case z.OBSERVABLE_COUNTER:case z.HISTOGRAM:return r.MONOTONIC_INSTANCE;default:return r.NON_MONOTONIC_INSTANCE}}},ut=class r{static DEFAULT_INSTANCE=new hr;createAggregator(e){return r.DEFAULT_INSTANCE}},ct=class r{static DEFAULT_INSTANCE=new je([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0);createAggregator(e){return r.DEFAULT_INSTANCE}},mr=class{_boundaries;_recordMinMax;constructor(e,t=!0){if(e==null)throw new Error("ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array");e=e.concat(),e=e.sort((i,l)=>i-l);let a=e.lastIndexOf(-1/0),s=e.indexOf(1/0);s===-1&&(s=void 0),this._boundaries=e.slice(a+1,s),this._recordMinMax=t}createAggregator(e){return new je(this._boundaries,this._recordMinMax)}},_r=class{_maxSize;_recordMinMax;constructor(e=160,t=!0){this._maxSize=e,this._recordMinMax=t}createAggregator(e){return new wr(this._maxSize,this._recordMinMax)}},wt=class{_resolve(e){switch(e.type){case z.COUNTER:case z.UP_DOWN_COUNTER:case z.OBSERVABLE_COUNTER:case z.OBSERVABLE_UP_DOWN_COUNTER:return mt;case z.GAUGE:case z.OBSERVABLE_GAUGE:return _t;case z.HISTOGRAM:return e.advice.explicitBucketBoundaries?new mr(e.advice.explicitBucketBoundaries):gt}return M.warn(`Unable to recognize instrument type: ${e.type}`),ht}createAggregator(e){return this._resolve(e).createAggregator(e)}},ht=new lt,mt=new dt,_t=new ut,gt=new ct,Jw=new _r,Mn=new wt;var he;(function(r){r[r.DEFAULT=0]="DEFAULT",r[r.DROP=1]="DROP",r[r.SUM=2]="SUM",r[r.LAST_VALUE=3]="LAST_VALUE",r[r.EXPLICIT_BUCKET_HISTOGRAM=4]="EXPLICIT_BUCKET_HISTOGRAM",r[r.EXPONENTIAL_HISTOGRAM=5]="EXPONENTIAL_HISTOGRAM"})(he||(he={}));function qr(r){switch(r.type){case he.DEFAULT:return Mn;case he.DROP:return ht;case he.SUM:return mt;case he.LAST_VALUE:return _t;case he.EXPONENTIAL_HISTOGRAM:{let e=r;return new _r(e.options?.maxSize,e.options?.recordMinMax)}case he.EXPLICIT_BUCKET_HISTOGRAM:{let e=r;return e.options==null?gt:new mr(e.options?.boundaries,e.options?.recordMinMax)}default:throw new Error("Unsupported Aggregation")}}var Un=r=>({type:he.DEFAULT}),eo=r=>Ve.CUMULATIVE;var Vn="otel.component.name",Bn="otel.component.type",jn="periodic_metric_reader",zn="otel.sdk.metric_reader.collection.duration",Kn="error.type";var Xn=new Map,gr=class{collectionDuration;standardAttrs;constructor(e,t){let a=Xn.get(e)??0;Xn.set(e,a+1),this.standardAttrs={[Bn]:e,[Vn]:`${e}/${a}`},this.collectionDuration=t.createHistogram(zn,{unit:"s",description:"The duration of the collect operation of the metric reader.",advice:{explicitBucketBoundaries:[]}})}recordCollection(e,t){let a=t?{...this.standardAttrs,[Kn]:t}:this.standardAttrs;this.collectionDuration.record(e,a)}};var Dn="2.12.0";var De=class{_shutdown=!1;_metricProducers;_sdkMetricProducer;_selfObsMetrics;_aggregationTemporalitySelector;_aggregationSelector;_cardinalitySelector;_otelComponentType;constructor(e){this._aggregationSelector=e?.aggregationSelector??Un,this._aggregationTemporalitySelector=e?.aggregationTemporalitySelector??eo,this._metricProducers=e?.metricProducers??[],this._cardinalitySelector=e?.cardinalitySelector,this._otelComponentType=e?.otelComponentType??this.constructor.name,this._selfObsMetrics=new gr(this._otelComponentType,Se())}setMetricProducer(e){if(this._sdkMetricProducer)throw new Error("MetricReader can not be bound to a MeterProvider again.");this._sdkMetricProducer=e,this.onInitialized()}_setSelfObsMeterProvider(e){let t=e.getMeter("@opentelemetry/sdk-metrics",Dn);this._selfObsMetrics=new gr(this._otelComponentType,t)}selectAggregation(e){return this._aggregationSelector(e)}selectAggregationTemporality(e){return this._aggregationTemporalitySelector(e)}selectCardinalityLimit(e){return this._cardinalitySelector?this._cardinalitySelector(e):2e3}onInitialized(){}async collect(e){if(this._sdkMetricProducer===void 0)throw new Error("MetricReader is not bound to a MetricProducer");if(this._shutdown)throw new Error("MetricReader is shutdown");let t=Mo(),[a,...s]=await Promise.all([this._sdkMetricProducer.collect({timeoutMillis:e?.timeoutMillis}),...this._metricProducers.map(d=>d.collect({timeoutMillis:e?.timeoutMillis}))]),i=Mo(),l=a.errors.concat(s.flatMap(d=>d.errors)),u=Bt(Vt(t,i));this._selfObsMetrics.recordCollection(u,l.length>0?l[0].name??"collect_error":void 0);let c=a.resourceMetrics.resource,w=a.resourceMetrics.scopeMetrics.concat(s.flatMap(d=>d.resourceMetrics.scopeMetrics));return{resourceMetrics:{resource:c,scopeMetrics:w},errors:l}}async shutdown(e){if(this._shutdown){M.error("Cannot call shutdown twice.");return}e?.timeoutMillis==null?await this.onShutdown():await Te(this.onShutdown(),e.timeoutMillis),this._shutdown=!0}async forceFlush(e){if(this._shutdown){M.warn("Cannot forceFlush on already shutdown MetricReader.");return}if(e?.timeoutMillis==null){await this.onForceFlush();return}await Te(this.onForceFlush(),e.timeoutMillis)}};Z();function Gn(r,e){if(!Number.isInteger(e)||e<=0)throw new Error("maxExportBatchSize must be a positive integer");let t=[],a=0,s=[];function i(){s.length>0&&(t.push({resource:r.resource,scopeMetrics:s}),s=[],a=0)}for(let l of r.scopeMetrics){let u=null;for(let c of l.metrics){let w=c.dataPoints;if(w.length===0){u||(u={scope:l.scope,metrics:[]},s.push(u)),u.metrics.push(c);continue}let d=0;for(;d<w.length;){let o=e-a,n=Math.min(o,w.length-d);u||(u={scope:l.scope,metrics:[]},s.push(u));let g={...c,dataPoints:w.slice(d,d+n)};u.metrics.push(g),d+=n,a+=n,a===e&&(i(),u=null)}}}return i(),t}var pr=class extends De{_interval;_exporter;_exportInterval;_exportTimeout;_maxExportBatchSize;_ongoingExportPromise=null;constructor(e){let{exporter:t,exportIntervalMillis:a=6e4,metricProducers:s,cardinalityLimits:i,maxExportBatchSize:l}=e,{exportTimeoutMillis:u=3e4}=e;if(super({aggregationSelector:t.selectAggregation?.bind(t),aggregationTemporalitySelector:t.selectAggregationTemporality?.bind(t),otelComponentType:jn,metricProducers:s,cardinalitySelector:c=>{let w={default:2e3,...i};switch(c){case z.COUNTER:return w.counter??w.default;case z.GAUGE:return w.gauge??w.default;case z.HISTOGRAM:return w.histogram??w.default;case z.OBSERVABLE_COUNTER:return w.observableCounter??w.default;case z.OBSERVABLE_UP_DOWN_COUNTER:return w.observableUpDownCounter??w.default;case z.OBSERVABLE_GAUGE:return w.observableGauge??w.default;case z.UP_DOWN_COUNTER:return w.upDownCounter??w.default;default:return w.default}}}),a<=0)throw Error("exportIntervalMillis must be greater than 0");if(u<=0)throw Error("exportTimeoutMillis must be greater than 0");if(l!==void 0&&(!Number.isInteger(l)||l<=0))throw Error("maxExportBatchSize must be a positive integer");if(a<u){if("exportIntervalMillis"in e&&"exportTimeoutMillis"in e)throw Error("exportIntervalMillis must be greater than or equal to exportTimeoutMillis");M.info(`Timeout of ${u} exceeds the interval of ${a}. Clamping timeout to interval duration.`),u=a}this._exportInterval=a,this._exportTimeout=u,this._exporter=t,this._maxExportBatchSize=l}async _runOnce(){try{await this._doRun()}catch(e){Io(e)}}async _doRun(){if(this._ongoingExportPromise){M.debug("PeriodicExportingMetricReader: export already in progress, skipping");return}let e=async()=>{let{resourceMetrics:t,errors:a}=await this.collect({timeoutMillis:this._exportTimeout});if(a.length>0&&M.error("PeriodicExportingMetricReader: metrics collection errors",...a),t.resource.asyncAttributesPending)try{await t.resource.waitForAsyncAttributes?.()}catch(l){M.debug("Error while resolving async portion of resource: ",l),Io(l)}if(t.scopeMetrics.length===0)return;let s=this._maxExportBatchSize?Gn(t,this._maxExportBatchSize):[t],i=null;for(let l of s)try{let u=await Te(jt._export(this._exporter,l),this._exportTimeout);u.code!==Ie.SUCCESS&&(i=new Error(`PeriodicExportingMetricReader: metrics export failed (error ${u.error})`))}catch(u){if(u instanceof ir){M.error(`PeriodicExportingMetricReader: metrics export timed out after ${this._exportTimeout}ms`);break}else M.error("PeriodicExportingMetricReader: metrics export threw error",u),i=u instanceof Error?u:new Error(String(u))}if(i)throw i};this._ongoingExportPromise=e();try{await this._ongoingExportPromise}finally{this._ongoingExportPromise=null}}onInitialized(){this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),typeof this._interval!="number"&&this._interval.unref()}async onForceFlush(){await this._awaitOngoingExport(),this._ongoingExportPromise?await this._awaitOngoingExport():await this._runOnce(),await this._exporter.forceFlush()}async _awaitOngoingExport(){if(this._ongoingExportPromise){M.debug("PeriodicExportingMetricReader: export already in progress, awaiting ongoing export");try{await this._ongoingExportPromise}catch{}}}async onShutdown(){this._interval&&clearInterval(this._interval),await this.onForceFlush(),await this._exporter.shutdown()}};var fr=class r{_shutdown=!1;_temporalitySelector;constructor(e){this._temporalitySelector=e?.temporalitySelector??eo}export(e,t){if(this._shutdown){t({code:Ie.FAILED});return}return r._sendMetrics(e,t)}forceFlush(){return Promise.resolve()}selectAggregationTemporality(e){return this._temporalitySelector(e)}shutdown(){return this._shutdown=!0,Promise.resolve()}static _sendMetrics(e,t){for(let a of e.scopeMetrics)for(let s of a.metrics)console.dir({descriptor:s.descriptor,dataPointType:s.dataPointType,dataPoints:s.dataPoints},{depth:null});t({code:Ie.SUCCESS})}};Z();var ro=class{_registeredViews=[];addView(e){this._registeredViews.push(e)}findViews(e,t){return this._registeredViews.filter(s=>this._matchInstrument(s.instrumentSelector,e)&&this._matchMeter(s.meterSelector,t))}_matchInstrument(e,t){return(e.getType()===void 0||t.type===e.getType())&&e.getNameFilter().match(t.name)&&e.getUnitFilter().match(t.unit)}_matchMeter(e,t){return e.getNameFilter().match(t.name)&&(t.version===void 0||e.getVersionFilter().match(t.version))&&(t.schemaUrl===void 0||e.getSchemaUrlFilter().match(t.schemaUrl))}};Z();function ye(r,e,t){return bd(r)||M.warn(`Invalid metric name: "${r}". The metric name should be a ASCII string with a length no greater than 255 characters.`),{name:r,type:e,description:t?.description??"",unit:t?.unit??"",valueType:t?.valueType??Ae.DOUBLE,advice:t?.advice??{}}}function Hn(r,e){return{name:r.name??e.name,description:r.description??e.description,type:e.type,unit:e.unit,valueType:e.valueType,advice:e.advice}}function Fn(r,e){return Ln(r.name,e.name)&&r.unit===e.unit&&r.type===e.type&&r.valueType===e.valueType}var yd=/^[a-z][a-z0-9_.\-/]{0,254}$/i;function bd(r){return yd.test(r)}Z();var Ge=class{_writableMetricStorage;_descriptor;constructor(e,t){this._writableMetricStorage=e,this._descriptor=t}_record(e,t={},a){if(typeof e!="number"){M.warn(`non-number value provided to metric ${this._descriptor.name}: ${e}`);return}this._descriptor.valueType===Ae.INT&&!Number.isInteger(e)&&(M.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._writableMetricStorage.record(e,t,a,Date.now())}},oo=class extends Ge{add(e,t,a){this._record(e,t,a)}},to=class extends Ge{add(e,t,a){if(e<0){M.warn(`negative value provided to counter ${this._descriptor.name}: ${e}`);return}this._record(e,t,a)}},ao=class extends Ge{record(e,t,a){this._record(e,t,a)}},no=class extends Ge{record(e,t,a){if(e<0){M.warn(`negative value provided to histogram ${this._descriptor.name}: ${e}`);return}this._record(e,t,a)}},He=class{_metricStorages;_descriptor;_observableRegistry;constructor(e,t,a){this._descriptor=e,this._metricStorages=t,this._observableRegistry=a}addCallback(e){this._observableRegistry.addCallback(e,this)}removeCallback(e){this._observableRegistry.removeCallback(e,this)}},so=class extends He{},io=class extends He{},lo=class extends He{};function yr(r){return r instanceof He}var uo=class{_meterSharedState;constructor(e){this._meterSharedState=e}createGauge(e,t){let a=ye(e,z.GAUGE,t),s=this._meterSharedState.registerMetricStorage(a);return new ao(s,a)}createHistogram(e,t){let a=ye(e,z.HISTOGRAM,t),s=this._meterSharedState.registerMetricStorage(a);return new no(s,a)}createCounter(e,t){let a=ye(e,z.COUNTER,t),s=this._meterSharedState.registerMetricStorage(a);return new to(s,a)}createUpDownCounter(e,t){let a=ye(e,z.UP_DOWN_COUNTER,t),s=this._meterSharedState.registerMetricStorage(a);return new oo(s,a)}createObservableGauge(e,t){let a=ye(e,z.OBSERVABLE_GAUGE,t),s=this._meterSharedState.registerAsyncMetricStorage(a);return new io(a,s,this._meterSharedState.observableRegistry)}createObservableCounter(e,t){let a=ye(e,z.OBSERVABLE_COUNTER,t),s=this._meterSharedState.registerAsyncMetricStorage(a);return new so(a,s,this._meterSharedState.observableRegistry)}createObservableUpDownCounter(e,t){let a=ye(e,z.OBSERVABLE_UP_DOWN_COUNTER,t),s=this._meterSharedState.registerAsyncMetricStorage(a);return new lo(a,s,this._meterSharedState.observableRegistry)}addBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.addBatchCallback(e,t)}removeBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.removeBatchCallback(e,t)}};var Fe=class{_instrumentDescriptor;constructor(e){this._instrumentDescriptor=e}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(e){this._instrumentDescriptor=ye(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:e,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}};var pt=class{_valueMap=new Map;_keyMap=new Map;_hash;constructor(e){this._hash=e}get(e,t){return t??=this._hash(e),this._valueMap.get(t)}getOrDefault(e,t){let a=this._hash(e);if(this._valueMap.has(a))return this._valueMap.get(a);let s=t();return this._keyMap.has(a)||this._keyMap.set(a,e),this._valueMap.set(a,s),s}set(e,t,a){a??=this._hash(e),this._keyMap.has(a)||this._keyMap.set(a,e),this._valueMap.set(a,t)}has(e,t){return t??=this._hash(e),this._valueMap.has(t)}*keys(){let e=this._keyMap.entries(),t=e.next();for(;t.done!==!0;)yield[t.value[1],t.value[0]],t=e.next()}*entries(){let e=this._valueMap.entries(),t=e.next();for(;t.done!==!0;)yield[this._keyMap.get(t.value[0]),t.value[1],t.value[0]],t=e.next()}get size(){return this._valueMap.size}},ne=class extends pt{constructor(){super(Wr)}};var $e=class{_activeCollectionStorage=new ne;_cumulativeMemoStorage=new ne;_cardinalityLimit;_overflowAttributes={"otel.metric.overflow":!0};_overflowHashCode;_aggregator;constructor(e,t){this._aggregator=e,this._cardinalityLimit=(t??2e3)-1,this._overflowHashCode=Wr(this._overflowAttributes)}record(e,t,a){let s=this._activeCollectionStorage.get(t);if(!s){let i=Me(a);if(this._activeCollectionStorage.size>=this._cardinalityLimit){this._activeCollectionStorage.getOrDefault(this._overflowAttributes,()=>this._aggregator.createAccumulation(i))?.record(e);return}s=this._aggregator.createAccumulation(i),this._activeCollectionStorage.set(t,s)}s?.record(e)}batchCumulate(e,t){for(let[a,s,i]of e.entries()){let l=a,u=i,c=this._aggregator.createAccumulation(t);c?.record(s);let w=c;if(this._cumulativeMemoStorage.has(l,u)){let d=this._cumulativeMemoStorage.get(l,u);w=this._aggregator.diff(d,c)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit&&(l=this._overflowAttributes,u=this._overflowHashCode,this._cumulativeMemoStorage.has(l,u))){let d=this._cumulativeMemoStorage.get(l,u);w=this._aggregator.diff(d,c)}if(this._activeCollectionStorage.has(l,u)){let d=this._activeCollectionStorage.get(l,u);w=this._aggregator.merge(d,w)}this._cumulativeMemoStorage.set(l,c,u),this._activeCollectionStorage.set(l,w,u)}}collect(){let e=this._activeCollectionStorage;return this._activeCollectionStorage=new ne,e}};var We=class r{_aggregator;_unreportedAccumulations=new Map;_reportHistory=new Map;constructor(e,t){this._aggregator=e,t.forEach(a=>{this._unreportedAccumulations.set(a,[])})}buildMetrics(e,t,a,s){this._stashAccumulations(a);let i=this._getMergedUnreportedAccumulations(e),l=i,u;if(this._reportHistory.has(e)){let w=this._reportHistory.get(e),d=w.collectionTime;u=w.aggregationTemporality,u===Ve.CUMULATIVE?l=r.merge(w.accumulations,i,this._aggregator):l=r.calibrateStartTime(w.accumulations,i,d)}else u=e.selectAggregationTemporality(t.type);this._reportHistory.set(e,{accumulations:l,collectionTime:s,aggregationTemporality:u});let c=vd(l);if(c.length!==0)return this._aggregator.toMetricData(t,u,c,s)}_stashAccumulations(e){let t=this._unreportedAccumulations.keys();for(let a of t){let s=this._unreportedAccumulations.get(a);s===void 0&&(s=[],this._unreportedAccumulations.set(a,s)),s.push(e)}}_getMergedUnreportedAccumulations(e){let t=new ne,a=this._unreportedAccumulations.get(e);if(this._unreportedAccumulations.set(e,[]),a===void 0)return t;for(let s of a)t=r.merge(t,s,this._aggregator);return t}static merge(e,t,a){let s=e,i=t.entries(),l=i.next();for(;l.done!==!0;){let[u,c,w]=l.value;if(e.has(u,w)){let d=e.get(u,w),o=a.merge(d,c);s.set(u,o,w)}else s.set(u,c,w);l=i.next()}return s}static calibrateStartTime(e,t,a){for(let[s,i]of e.keys())t.get(s,i)?.setStartTime(a);return t}};function vd(r){return Array.from(r.entries())}var co=class extends Fe{_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;_attributesProcessor;constructor(e,t,a,s,i){super(e),this._aggregationCardinalityLimit=i,this._deltaMetricStorage=new $e(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new We(t,s),this._attributesProcessor=a}record(e,t){if(this._attributesProcessor===void 0){this._deltaMetricStorage.batchCumulate(e,t);return}let a=new ne;for(let[s,i]of e.entries())a.set(this._attributesProcessor.process(s),i);this._deltaMetricStorage.batchCumulate(a,t)}collect(e,t){let a=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,a,t)}};Z();function ft(r,e){let t="";return r.unit!==e.unit&&(t+=` - Unit '${r.unit}' does not match '${e.unit}'
7
7
  `),r.type!==e.type&&(t+=` - Type '${r.type}' does not match '${e.type}'