@yukino.js/yukino 0.0.1

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 (87) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +320 -0
  3. package/dist/acp-IVY5HZR4.js +14 -0
  4. package/dist/agent-QANDY7FO.js +4 -0
  5. package/dist/anthropic-6YLT4JZR.js +4 -0
  6. package/dist/bwrap-MLSZLWHD.js +4 -0
  7. package/dist/chunk-2LHY3FND.js +67 -0
  8. package/dist/chunk-3KKA6537.js +4 -0
  9. package/dist/chunk-3QL446GD.js +4 -0
  10. package/dist/chunk-4GE22WHI.js +4 -0
  11. package/dist/chunk-5VOCXSSX.js +5 -0
  12. package/dist/chunk-77W2UPS2.js +4 -0
  13. package/dist/chunk-7MKA3SHV.js +4 -0
  14. package/dist/chunk-AGSYLE4E.js +16 -0
  15. package/dist/chunk-CU3IISCC.js +4 -0
  16. package/dist/chunk-GYBJR2RB.js +65 -0
  17. package/dist/chunk-HLE7243Q.js +4 -0
  18. package/dist/chunk-HMZQYFYG.js +4 -0
  19. package/dist/chunk-JFKC4VCA.js +4 -0
  20. package/dist/chunk-K4BYVVW7.js +5 -0
  21. package/dist/chunk-KCMBAHWU.js +4 -0
  22. package/dist/chunk-L2BWSPCF.js +10 -0
  23. package/dist/chunk-MDPSQ6L7.js +44 -0
  24. package/dist/chunk-OFC2GD5K.js +4 -0
  25. package/dist/chunk-RAS3ORX3.js +164 -0
  26. package/dist/chunk-RCXKUD3Y.js +4 -0
  27. package/dist/chunk-SAJCBGHL.js +4 -0
  28. package/dist/chunk-SOO5OXX2.js +237 -0
  29. package/dist/chunk-T4O4GQVL.js +607 -0
  30. package/dist/chunk-UPNNYP7M.js +60 -0
  31. package/dist/chunk-VCIRD267.js +4 -0
  32. package/dist/chunk-VU3JWAJR.js +4 -0
  33. package/dist/chunk-VWUGGYUP.js +6 -0
  34. package/dist/chunk-XO7ITAWR.js +4 -0
  35. package/dist/devtools-YWVUN4HX.js +7 -0
  36. package/dist/esm-57CJEGGK.js +4 -0
  37. package/dist/esm-6L5BJ5GT.js +4 -0
  38. package/dist/esm-DIYJ5HX6.js +4 -0
  39. package/dist/esm-HW2JMFYC.js +4 -0
  40. package/dist/esm-RPR2GBJ2.js +4 -0
  41. package/dist/esm-YKAO4ES6.js +4 -0
  42. package/dist/esm-ZTIYTMTS.js +229 -0
  43. package/dist/getMachineId-bsd-E27XJQLX.js +4 -0
  44. package/dist/getMachineId-darwin-35UPAIXP.js +5 -0
  45. package/dist/getMachineId-linux-MKXIYT6A.js +4 -0
  46. package/dist/getMachineId-unsupported-ZXVGGFX2.js +4 -0
  47. package/dist/getMachineId-win-RNVIYJG5.js +4 -0
  48. package/dist/lib/agent-6FZX4P2Y.js +16 -0
  49. package/dist/lib/anthropic-IP23YZ3P.js +21 -0
  50. package/dist/lib/bwrap-2OL7VPSO.js +7 -0
  51. package/dist/lib/chunk-2VF3XTGH.js +3382 -0
  52. package/dist/lib/chunk-5DVQ64YL.js +619 -0
  53. package/dist/lib/chunk-5TGXH7BX.js +624 -0
  54. package/dist/lib/chunk-6OMQD7MK.js +591 -0
  55. package/dist/lib/chunk-AZRC67RW.js +512 -0
  56. package/dist/lib/chunk-F2YJG72O.js +150 -0
  57. package/dist/lib/chunk-FFM2LB4C.js +132 -0
  58. package/dist/lib/chunk-FLKB4BK7.js +50 -0
  59. package/dist/lib/chunk-I34MAQRE.js +255 -0
  60. package/dist/lib/chunk-KA6POJKI.js +889 -0
  61. package/dist/lib/chunk-MLKGABMK.js +9 -0
  62. package/dist/lib/chunk-O7ELJUEK.js +262 -0
  63. package/dist/lib/chunk-QYBQT2DM.js +655 -0
  64. package/dist/lib/chunk-YIWNQ7OA.js +47 -0
  65. package/dist/lib/index.d.ts +8581 -0
  66. package/dist/lib/index.js +15905 -0
  67. package/dist/lib/openai-EMJ6U4FW.js +15 -0
  68. package/dist/lib/permissions-KZ5ACZAX.js +19 -0
  69. package/dist/lib/providers-2CGZPBFI.js +9 -0
  70. package/dist/lib/sandbox-runtime-CCQ3X3SM.js +9 -0
  71. package/dist/lib/seatbelt-WO7YWKLR.js +7 -0
  72. package/dist/lib/tool-filter-CKHZUUBQ.js +21 -0
  73. package/dist/main.js +332 -0
  74. package/dist/node-634LOHDX.js +15 -0
  75. package/dist/openai-YXYO5OW6.js +34 -0
  76. package/dist/permissions-VCDMNX3L.js +4 -0
  77. package/dist/providers-HNMBGGW6.js +4 -0
  78. package/dist/sandbox-runtime-ELKAYRIL.js +4 -0
  79. package/dist/seatbelt-JOCANLYS.js +4 -0
  80. package/dist/server-ZHQILOBP.js +4 -0
  81. package/dist/src-43CPCEK2.js +12 -0
  82. package/dist/src-JBRNH4FA.js +4 -0
  83. package/dist/src-R4BSSIJJ.js +4 -0
  84. package/dist/src-X6JWWHHT.js +4 -0
  85. package/dist/tool-filter-BQZDV3TF.js +4 -0
  86. package/dist/turndown.es-NQ3KDXM7.js +83 -0
  87. package/package.json +146 -0
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __yukinoCreateRequire } from "node:module";
3
+ const require = __yukinoCreateRequire(import.meta.url);
4
+ import{b as Dr,c as Hr,d as Le,e as Gr}from"./chunk-JFKC4VCA.js";import{D as qe}from"./chunk-GYBJR2RB.js";import{a as Xr}from"./chunk-HMZQYFYG.js";import{g as pe,h as Mr,i as Ue}from"./chunk-3QL446GD.js";import{e as Vr,f as jr,g as Br,i as ya}from"./chunk-AGSYLE4E.js";import{E as Ve,I as Nr,J as je,M as ye,N as Ur,O as Kr,P as zr,a as kr,g as Ne,k as Se,l as ar,m as xe,n as nr,o as Cr,q as Ar,v as sr,y as Ir,z as Me}from"./chunk-CU3IISCC.js";import{c as Z,e as Ae,g as er,k as Ie,n as rr,o as we,p as O,r as or,s as he,u as le}from"./chunk-VCIRD267.js";le();var va=Object.defineProperty,Y=(o,e)=>{for(var a in e)va(o,a,{get:e[a],enumerable:!0})};function q(o){if(typeof process<"u"&&process.env[o])return process.env[o];if(typeof globalThis<"u")return globalThis[o]}function ur(o){let e=atob(o);return Uint8Array.from(e,a=>a.codePointAt(0))}function tr(o){let e=Array.from(o,a=>String.fromCharCode(a)).join("");return btoa(e)}function qr(o){if(typeof Buffer<"u")return Buffer.from(o,"utf8").toString("base64");let e=new TextEncoder().encode(o);return tr(e)}var cr=(o=>(o[o.NONE=4]="NONE",o[o.ERROR=3]="ERROR",o[o.WARN=2]="WARN",o[o.INFO=1]="INFO",o[o.DEBUG=0]="DEBUG",o))(cr||{});function Ra(){var o;if(typeof process=="object"&&"env"in process){if(((o=q("LANGFUSE_DEBUG"))==null?void 0:o.toLowerCase())==="true")return 0;let e=q("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 Fr=class{constructor(o={level:1}){this.config={enableTimestamp:!0,...o}}shouldLog(o){return o>=this.config.level}formatMessage(o,e){let a=this.config.enableTimestamp?new Date().toISOString():"",s=this.config.prefix||"[Langfuse SDK]";return[a,s,`[${o}]`,e].filter(Boolean).join(" ")}error(o,...e){this.shouldLog(3)&&console.error(this.formatMessage("ERROR",o),...e)}warn(o,...e){this.shouldLog(2)&&console.warn(this.formatMessage("WARN",o),...e)}info(o,...e){this.shouldLog(1)&&console.info(this.formatMessage("INFO",o),...e)}debug(o,...e){this.shouldLog(0)&&console.debug(this.formatMessage("DEBUG",o),...e)}setLevel(o){this.config.level=o}getLevel(){return this.config.level}isLevelEnabled(o){return this.shouldLog(o)}},$r,wr=class me{static getInstance(){return me.instance||(me.instance=new Fr(me.defaultConfig)),me.instance}static configure(e){me.defaultConfig=e,me.instance=new Fr(e)}static reset(){me.instance=null,me.defaultConfig={level:1}}};wr.instance=null;wr.defaultConfig={level:($r=Ra())!=null?$r:1};var Sa=wr;var ee=()=>Sa.getInstance();var xa={name:"@langfuse/core",version:"5.11.1",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"}},Ee="langfuse-sdk",Pe=xa.version;var La="sdk-experiment",U=(o=>(o.TRACE_NAME="langfuse.trace.name",o.TRACE_USER_ID="user.id",o.TRACE_SESSION_ID="session.id",o.TRACE_TAGS="langfuse.trace.tags",o.TRACE_PUBLIC="langfuse.trace.public",o.TRACE_METADATA="langfuse.trace.metadata",o.TRACE_INPUT="langfuse.trace.input",o.TRACE_OUTPUT="langfuse.trace.output",o.OBSERVATION_TYPE="langfuse.observation.type",o.OBSERVATION_METADATA="langfuse.observation.metadata",o.OBSERVATION_LEVEL="langfuse.observation.level",o.OBSERVATION_STATUS_MESSAGE="langfuse.observation.status_message",o.OBSERVATION_INPUT="langfuse.observation.input",o.OBSERVATION_OUTPUT="langfuse.observation.output",o.OBSERVATION_COMPLETION_START_TIME="langfuse.observation.completion_start_time",o.OBSERVATION_MODEL="langfuse.observation.model.name",o.OBSERVATION_MODEL_PARAMETERS="langfuse.observation.model.parameters",o.OBSERVATION_USAGE_DETAILS="langfuse.observation.usage_details",o.OBSERVATION_COST_DETAILS="langfuse.observation.cost_details",o.OBSERVATION_PROMPT_NAME="langfuse.observation.prompt.name",o.OBSERVATION_PROMPT_VERSION="langfuse.observation.prompt.version",o.ENVIRONMENT="langfuse.environment",o.RELEASE="langfuse.release",o.VERSION="langfuse.version",o.AS_ROOT="langfuse.internal.as_root",o.IS_APP_ROOT="langfuse.internal.is_app_root",o.EXPERIMENT_ID="langfuse.experiment.id",o.EXPERIMENT_NAME="langfuse.experiment.name",o.EXPERIMENT_DESCRIPTION="langfuse.experiment.description",o.EXPERIMENT_METADATA="langfuse.experiment.metadata",o.EXPERIMENT_DATASET_ID="langfuse.experiment.dataset.id",o.EXPERIMENT_ITEM_ID="langfuse.experiment.item.id",o.EXPERIMENT_ITEM_EXPECTED_OUTPUT="langfuse.experiment.item.expected_output",o.EXPERIMENT_ITEM_METADATA="langfuse.experiment.item.metadata",o.EXPERIMENT_ITEM_ROOT_OBSERVATION_ID="langfuse.experiment.item.root_observation_id",o.TRACE_COMPAT_USER_ID="langfuse.user.id",o.TRACE_COMPAT_SESSION_ID="langfuse.session.id",o))(U||{}),Ea={};Y(Ea,{AnnotationQueueObjectType:()=>Ta,AnnotationQueueStatus:()=>Pa});var Pa={Pending:"PENDING",Completed:"COMPLETED"},Ta={Trace:"TRACE",Observation:"OBSERVATION",Session:"SESSION"},ka={};Y(ka,{BlobStorageExportFieldGroup:()=>ja,BlobStorageExportFrequency:()=>Ma,BlobStorageExportMode:()=>Na,BlobStorageExportSource:()=>Va,BlobStorageIntegrationFileType:()=>Aa,BlobStorageIntegrationFileTypeResponse:()=>Ia,BlobStorageIntegrationType:()=>Ca,BlobStorageSyncStatus:()=>Ua});var Ca={S3:"S3",S3Compatible:"S3_COMPATIBLE",AzureBlobStorage:"AZURE_BLOB_STORAGE"},Aa={Json:"JSON",Csv:"CSV",Jsonl:"JSONL",Parquet:"PARQUET"},Ia={Json:"JSON",Csv:"CSV",Jsonl:"JSONL",Parquet:"PARQUET"},Na={FullHistory:"FULL_HISTORY",FromToday:"FROM_TODAY",FromCustomDate:"FROM_CUSTOM_DATE"},Ma={Every20Minutes:"every_20_minutes",Hourly:"hourly",Daily:"daily",Weekly:"weekly"},Va={LegacyTracesObservations:"LEGACY_TRACES_OBSERVATIONS",ObservationsV2:"OBSERVATIONS_V2",LegacyTracesAndEnrichedObservations:"LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS"},ja={Core:"core",Basic:"basic",Time:"time",Io:"io",Metadata:"metadata",Model:"model",Usage:"usage",Prompt:"prompt",Metrics:"metrics",Tools:"tools",TraceContext:"trace_context"},Ua={Idle:"idle",Running:"running",Queued:"queued",UpToDate:"up_to_date",Disabled:"disabled",Error:"error"};var Ka={};Y(Ka,{AccessDeniedError:()=>v,CommentObjectType:()=>Ga,DatasetItemMediaReferenceField:()=>za,DatasetStatus:()=>Fa,Error:()=>b,MethodNotAllowedError:()=>S,ModelUsageUnit:()=>Da,NotFoundError:()=>R,ObservationLevel:()=>Ha,PricingTierAttributeSource:()=>Ba,PricingTierOperator:()=>Xa,ScoreConfigDataType:()=>Wa,ScoreDataType:()=>Qa,ScoreSource:()=>$a,UnauthorizedError:()=>y});var za={Input:"input",ExpectedOutput:"expectedOutput",Metadata:"metadata"},Ba={ModelParameters:"model_parameters",Metadata:"metadata"},Xa={Gt:"gt",Gte:"gte",Lt:"lt",Lte:"lte",Eq:"eq",Neq:"neq"},Da={Characters:"CHARACTERS",Tokens:"TOKENS",Milliseconds:"MILLISECONDS",Seconds:"SECONDS",Images:"IMAGES",Requests:"REQUESTS"},Ha={Debug:"DEBUG",Default:"DEFAULT",Warning:"WARNING",Error:"ERROR"},Ga={Trace:"TRACE",Observation:"OBSERVATION",Session:"SESSION",Prompt:"PROMPT"},Fa={Active:"ACTIVE",Archived:"ARCHIVED"},$a={Annotation:"ANNOTATION",Api:"API",Eval:"EVAL"},Wa={Numeric:"NUMERIC",Boolean:"BOOLEAN",Categorical:"CATEGORICAL",Text:"TEXT"},Qa={Numeric:"NUMERIC",Boolean:"BOOLEAN",Categorical:"CATEGORICAL",Correction:"CORRECTION",Text:"TEXT"},hr=(o,e,a)=>JSON.stringify(o,e,a);function ir(o,e){return JSON.parse(o,e)}var m=class eo extends Error{constructor({message:e,statusCode:a,body:s,rawResponse:i}){super(Ya({message:e,statusCode:a,body:s})),Object.setPrototypeOf(this,eo.prototype),this.statusCode=a,this.body=s,this.rawResponse=i}};function Ya({message:o,statusCode:e,body:a}){let s=[];return o!=null&&s.push(o),e!=null&&s.push(`Status code: ${e.toString()}`),a!=null&&s.push(`Body: ${hr(a,void 0,2)}`),s.join(`
5
+ `)}var E=class ro extends Error{constructor(e){super(e),Object.setPrototypeOf(this,ro.prototype)}},b=class oo extends m{constructor(e,a){super({message:"Error",statusCode:400,body:e,rawResponse:a}),Object.setPrototypeOf(this,oo.prototype)}},y=class ao extends m{constructor(e,a){super({message:"UnauthorizedError",statusCode:401,body:e,rawResponse:a}),Object.setPrototypeOf(this,ao.prototype)}},v=class no extends m{constructor(e,a){super({message:"AccessDeniedError",statusCode:403,body:e,rawResponse:a}),Object.setPrototypeOf(this,no.prototype)}},R=class so extends m{constructor(e,a){super({message:"NotFoundError",statusCode:404,body:e,rawResponse:a}),Object.setPrototypeOf(this,so.prototype)}},S=class to extends m{constructor(e,a){super({message:"MethodNotAllowedError",statusCode:405,body:e,rawResponse:a}),Object.setPrototypeOf(this,to.prototype)}};var Ja={};Y(Ja,{CodeEvaluatorSourceCodeLanguage:()=>Oa,EvaluationRuleArrayOptionsFilterOperator:()=>nn,EvaluationRuleBooleanFilterOperator:()=>sn,EvaluationRuleNullFilterOperator:()=>tn,EvaluationRuleNumberFilterOperator:()=>on,EvaluationRuleOptionsFilterOperator:()=>an,EvaluationRuleStringFilterOperator:()=>rn,EvaluatorOutputScoreType:()=>en,EvaluatorType:()=>Za,LegacyEvaluationObject:()=>ln,PromptVariableMappingSource:()=>qa});var Za={LlmAsJudge:"llm_as_judge",Code:"code"},Oa={Python:"PYTHON",Typescript:"TYPESCRIPT"},qa={Input:"input",Output:"output",Metadata:"metadata",ToolCalls:"tool_calls",ExpectedOutput:"expected_output",ExperimentItemMetadata:"experiment_item_metadata"},en={Numeric:"NUMERIC",Boolean:"BOOLEAN",Categorical:"CATEGORICAL"},rn={Equals:"=",Contains:"contains",DoesNotContain:"does not contain",StartsWith:"starts with",EndsWith:"ends with"},on={Equals:"=",GreaterThan:">",LessThan:"<",GreaterThanOrEqual:">=",LessThanOrEqual:"<="},an={AnyOf:"any of",NoneOf:"none of"},nn={AnyOf:"any of",NoneOf:"none of",AllOf:"all of"},sn={Equals:"=",NotEquals:"<>"},tn={IsNull:"is null",IsNotNull:"is not null"},ln={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"},dn={};Y(dn,{BadRequestError:()=>_e,ConflictError:()=>ze,EvaluationAccessDeniedError:()=>ne,EvaluationMethodNotAllowedError:()=>se,EvaluationNotFoundError:()=>ge,EvaluationUnauthorizedError:()=>ae,InternalServerError:()=>ie,PreconditionFailedError:()=>lr,PublicApiErrorCode:()=>un,TooManyRequestsError:()=>te});var un={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"},_e=class io extends m{constructor(e,a){super({message:"BadRequestError",statusCode:400,body:e,rawResponse:a}),Object.setPrototypeOf(this,io.prototype)}},ae=class lo extends m{constructor(e,a){super({message:"EvaluationUnauthorizedError",statusCode:401,body:e,rawResponse:a}),Object.setPrototypeOf(this,lo.prototype)}},ne=class uo extends m{constructor(e,a){super({message:"EvaluationAccessDeniedError",statusCode:403,body:e,rawResponse:a}),Object.setPrototypeOf(this,uo.prototype)}},ge=class co extends m{constructor(e,a){super({message:"EvaluationNotFoundError",statusCode:404,body:e,rawResponse:a}),Object.setPrototypeOf(this,co.prototype)}},se=class wo extends m{constructor(e,a){super({message:"EvaluationMethodNotAllowedError",statusCode:405,body:e,rawResponse:a}),Object.setPrototypeOf(this,wo.prototype)}},ze=class ho extends m{constructor(e,a){super({message:"ConflictError",statusCode:409,body:e,rawResponse:a}),Object.setPrototypeOf(this,ho.prototype)}},lr=class mo extends m{constructor(e,a){super({message:"PreconditionFailedError",statusCode:412,body:e,rawResponse:a}),Object.setPrototypeOf(this,mo.prototype)}},te=class go extends m{constructor(e,a){super({message:"TooManyRequestsError",statusCode:429,body:e,rawResponse:a}),Object.setPrototypeOf(this,go.prototype)}},ie=class po extends m{constructor(e,a){super({message:"InternalServerError",statusCode:500,body:e,rawResponse:a}),Object.setPrototypeOf(this,po.prototype)}};var cn={};Y(cn,{EvaluatorChatMessageRole:()=>wn,EvaluatorStatus:()=>hn});var wn={System:"system",User:"user",Assistant:"assistant"},hn={Active:"active",Paused:"paused"};var mn={};Y(mn,{FeedbackNotConfiguredError:()=>_o,FeedbackTargetType:()=>gn});var gn={Skill:"skill",McpTool:"mcp-tool",Cli:"cli",Docs:"docs",PublicApi:"public-api",Other:"other"},_o=class fo extends m{constructor(e){super({message:"FeedbackNotConfiguredError",statusCode:409,rawResponse:e}),Object.setPrototypeOf(this,fo.prototype)}},pn={};Y(pn,{ServiceUnavailableError:()=>bo});var bo=class yo extends m{constructor(e){super({message:"ServiceUnavailableError",statusCode:503,rawResponse:e}),Object.setPrototypeOf(this,yo.prototype)}},_n={};Y(_n,{ObservationType:()=>fn});var fn={Span:"SPAN",Generation:"GENERATION",Event:"EVENT",Agent:"AGENT",Tool:"TOOL",Chain:"CHAIN",Retriever:"RETRIEVER",Evaluator:"EVALUATOR",Embedding:"EMBEDDING",Guardrail:"GUARDRAIL"},bn={};Y(bn,{CreateScoreSource:()=>mr,metricsV1:()=>yn,observationsV1:()=>vn,scoreV1:()=>vo});var yn={},vn={},vo={};Y(vo,{CreateScoreSource:()=>mr});var mr={Api:"API",Annotation:"ANNOTATION"},Rn={};Y(Rn,{LlmAdapter:()=>Sn});var Sn={Anthropic:"anthropic",OpenAi:"openai",Azure:"azure",Bedrock:"bedrock",GoogleVertexAi:"google-vertex-ai",GoogleAiStudio:"google-ai-studio"},xn={};Y(xn,{MediaContentType:()=>Ln});var Ln={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 En={};Y(En,{ModelTokenizerId:()=>Pn});var Pn={Openai:"openai",Claude:"claude"};var Tn={};Y(Tn,{MembershipRole:()=>kn});var kn={Owner:"OWNER",Admin:"ADMIN",Member:"MEMBER",Viewer:"VIEWER"};var Cn={};Y(Cn,{ChatMessageType:()=>In,CreateChatPromptType:()=>Mn,CreateTextPromptType:()=>Vn,PlaceholderMessageType:()=>Nn,PromptType:()=>An});var An={Chat:"chat",Text:"text"},In={Chatmessage:"chatmessage"},Nn={Placeholder:"placeholder"},Mn={Chat:"chat"},Vn={Text:"text"};var jn={};Y(jn,{CreateScoreSource:()=>mr});var A={};Y(A,{AccessDeniedError:()=>Mo,BadRequestError:()=>Co,ConflictError:()=>Bo,DashboardWidgetChartType:()=>Lo,DashboardWidgetMetricAggregation:()=>Eo,DashboardWidgetSortOrder:()=>Po,DashboardWidgetView:()=>So,DashboardWidgetViewWithLegacy:()=>xo,InternalServerError:()=>Go,MethodNotAllowedError:()=>Ko,NotFoundError:()=>jo,PublicApiErrorCode:()=>ko,TooManyRequestsError:()=>Do,UnauthorizedError:()=>Io,dashboardWidgets:()=>Ro,dashboards:()=>Un,errors:()=>To});var Ro={};Y(Ro,{DashboardWidgetChartType:()=>Lo,DashboardWidgetMetricAggregation:()=>Eo,DashboardWidgetSortOrder:()=>Po,DashboardWidgetView:()=>So,DashboardWidgetViewWithLegacy:()=>xo});var So={Observations:"observations",ScoresNumeric:"scores-numeric",ScoresBoolean:"scores-boolean",ScoresCategorical:"scores-categorical"},xo={Observations:"observations",ScoresNumeric:"scores-numeric",ScoresBoolean:"scores-boolean",ScoresCategorical:"scores-categorical",Traces:"traces"},Lo={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"},Eo={Sum:"sum",Avg:"avg",Count:"count",Max:"max",Min:"min",P50:"p50",P75:"p75",P90:"p90",P95:"p95",P99:"p99",Histogram:"histogram",Uniq:"uniq"},Po={Asc:"ASC",Desc:"DESC"},Un={},To={};Y(To,{AccessDeniedError:()=>Mo,BadRequestError:()=>Co,ConflictError:()=>Bo,InternalServerError:()=>Go,MethodNotAllowedError:()=>Ko,NotFoundError:()=>jo,PublicApiErrorCode:()=>ko,TooManyRequestsError:()=>Do,UnauthorizedError:()=>Io});var ko={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"},Co=class Ao extends m{constructor(e,a){super({message:"BadRequestError",statusCode:400,body:e,rawResponse:a}),Object.setPrototypeOf(this,Ao.prototype)}},Io=class No extends m{constructor(e,a){super({message:"UnauthorizedError",statusCode:401,body:e,rawResponse:a}),Object.setPrototypeOf(this,No.prototype)}},Mo=class Vo extends m{constructor(e,a){super({message:"AccessDeniedError",statusCode:403,body:e,rawResponse:a}),Object.setPrototypeOf(this,Vo.prototype)}},jo=class Uo extends m{constructor(e,a){super({message:"NotFoundError",statusCode:404,body:e,rawResponse:a}),Object.setPrototypeOf(this,Uo.prototype)}},Ko=class zo extends m{constructor(e,a){super({message:"MethodNotAllowedError",statusCode:405,body:e,rawResponse:a}),Object.setPrototypeOf(this,zo.prototype)}},Bo=class Xo extends m{constructor(e,a){super({message:"ConflictError",statusCode:409,body:e,rawResponse:a}),Object.setPrototypeOf(this,Xo.prototype)}},Do=class Ho extends m{constructor(e,a){super({message:"TooManyRequestsError",statusCode:429,body:e,rawResponse:a}),Object.setPrototypeOf(this,Ho.prototype)}},Go=class Fo extends m{constructor(e,a){super({message:"InternalServerError",statusCode:500,body:e,rawResponse:a}),Object.setPrototypeOf(this,Fo.prototype)}},Kn={};Y(Kn,{pagination:()=>zn});var zn={};function x(...o){let e={};for(let[a,s]of o.filter(i=>i!=null).flatMap(i=>Object.entries(i)))s!=null?e[a]=s:a in e&&delete e[a];return e}function P(...o){let e={};for(let[a,s]of o.filter(i=>i!=null).flatMap(i=>Object.entries(i)))s!=null&&(e[a]=s);return e}var Bn={arrayFormat:"indices",encode:!0};function Wr(o,e){if(o===void 0||o===null)return"";let a=String(o);return e?encodeURIComponent(a):a}function dr(o,e="",a){let s=[];for(let[i,l]of Object.entries(o)){let d=e?`${e}[${i}]`:i;if(l!==void 0)if(Array.isArray(l)){if(l.length===0)continue;for(let u=0;u<l.length;u++){let c=l[u];if(c!==void 0)if(typeof c=="object"&&!Array.isArray(c)&&c!==null){let h=a.arrayFormat==="indices"?`${d}[${u}]`:d;s.push(...dr(c,h,a))}else{let h=a.arrayFormat==="indices"?`${d}[${u}]`:d,t=a.encode?encodeURIComponent(h):h;s.push(`${t}=${Wr(c,a.encode)}`)}}}else if(typeof l=="object"&&l!==null){if(Object.keys(l).length===0)continue;s.push(...dr(l,d,a))}else{let u=a.encode?encodeURIComponent(d):d;s.push(`${u}=${Wr(l,a.encode)}`)}}return s}function $o(o,e){return o==null||typeof o!="object"?"":dr(o,"",{...Bn,...e}).join("&")}function Xn(o,e){let a=$o(e,{arrayFormat:"repeat"});return a?`${o}?${a}`:o}function Dn(o){let e={get bodyUsed(){return o.bodyUsed},stream:()=>o.body,arrayBuffer:o.arrayBuffer.bind(o),blob:o.blob.bind(o)};return"bytes"in o&&typeof o.bytes=="function"&&(e.bytes=o.bytes.bind(o)),e}function Hn(o){return o.body!=null}async function Wo(o,e){if(!Hn(o))return;switch(e){case"binary-response":return Dn(o);case"blob":return await o.blob();case"arrayBuffer":return await o.arrayBuffer();case"sse":return o.body;case"streaming":return o.body;case"text":return await o.text()}let a=await o.text();if(a.length>0)try{return ir(a)}catch{return{ok:!1,error:{reason:"non-json",statusCode:o.status,rawBody:a}}}}async function Gn(o){var e,a,s;let i=(e=o.headers.get("Content-Type"))==null?void 0:e.toLowerCase();if(i==null||i.length===0)return Wo(o);switch(i.indexOf(";")!==-1&&(i=(s=(a=i.split(";")[0])==null?void 0:a.trim())!=null?s:""),i){case"application/hal+json":case"application/json":case"application/ld+json":case"application/problem+json":case"application/vnd.api+json":case"text/json":let l=await o.text();return l.length>0?ir(l):void 0;default:if(i.startsWith("application/vnd.")&&i.endsWith("+json")){let d=await o.text();return d.length>0?ir(d):void 0}return await o.text()}}async function Fn(){return fetch}async function $n({body:o,type:e}){return e.includes("json")?hr(o):o}var Wn="timeout";function Qn(o){let e=new AbortController,a=setTimeout(()=>e.abort(Wn),o);return{signal:e.signal,abortId:a}}function Yn(...o){let e=o.length===1&&Array.isArray(o[0])?o[0]:o,a=new AbortController;for(let s of e){if(s.aborted){a.abort(s?.reason);break}s.addEventListener("abort",()=>a.abort(s?.reason),{signal:a.signal})}return a.signal}var Jn=async(o,e,a,s,i,l,d,u,c)=>{let h=[],t;if(l!=null){let{signal:p,abortId:w}=Qn(l);t=w,h.push(p)}d!=null&&h.push(d);let r=Yn(h),n=await o(e,{method:a,headers:s,body:i,signal:r,credentials:u?"include":void 0,duplex:c});return t!=null&&clearTimeout(t),n},Be;typeof globalThis.Headers<"u"?Be=globalThis.Headers:Be=class Qo{constructor(e){if(this.headers=new Map,e)if(e instanceof Qo)e.forEach((a,s)=>this.append(s,a));else if(Array.isArray(e))for(let[a,s]of e)if(typeof a=="string"&&typeof s=="string")this.append(a,s);else throw new TypeError("Each header entry must be a [string, string] tuple");else for(let[a,s]of Object.entries(e))if(typeof s=="string")this.append(a,s);else throw new TypeError("Header values must be strings")}append(e,a){let s=e.toLowerCase(),i=this.headers.get(s)||[];this.headers.set(s,[...i,a])}delete(e){let a=e.toLowerCase();this.headers.delete(a)}get(e){let a=e.toLowerCase(),s=this.headers.get(a);return s?s.join(", "):null}has(e){let a=e.toLowerCase();return this.headers.has(a)}set(e,a){let s=e.toLowerCase();this.headers.set(s,[a])}forEach(e,a){let s=a?e.bind(a):e;this.headers.forEach((i,l)=>s(i.join(", "),l,this))}getSetCookie(){return this.headers.get("set-cookie")||[]}*entries(){for(let[e,a]of this.headers.entries())yield[e,a.join(", ")]}*keys(){yield*this.headers.keys()}*values(){for(let e of this.headers.values())yield e.join(", ")}[Symbol.iterator](){return this.entries()}};var Qr={headers:new Be,redirected:!1,status:499,statusText:"Client Closed Request",type:"error",url:""},Yr={headers:new Be,redirected:!1,status:0,statusText:"Unknown Error",type:"error",url:""};function Jr(o){return{headers:o.headers,redirected:o.redirected,status:o.status,statusText:o.statusText,type:o.type,url:o.url}}var Zn=1e3,Ke=6e4,On=2,Yo=.2;function qn(o){let e=1+Math.random()*Yo;return o*e}function es(o){let e=1+(Math.random()-.5)*Yo;return o*e}function rs(o,e){let a=o.headers.get("Retry-After");if(a){let i=parseInt(a,10);if(!isNaN(i)&&i>0)return Math.min(i*1e3,Ke);let l=new Date(a);if(!isNaN(l.getTime())){let d=l.getTime()-Date.now();if(d>0)return Math.min(Math.max(d,0),Ke)}}let s=o.headers.get("X-RateLimit-Reset");if(s){let i=parseInt(s,10);if(!isNaN(i)){let l=i*1e3-Date.now();if(l>0)return qn(Math.min(l,Ke))}}return es(Math.min(Zn*Math.pow(2,e),Ke))}async function os(o,e=On){let a=await o();for(let s=0;s<e&&([408,429].includes(a.status)||a.status>=500);++s){let i=rs(a,s);await new Promise(l=>setTimeout(l,i)),a=await o()}return a}var g={get:async o=>typeof o=="function"?o():o};async function as(o){let e={};if(o.body!==void 0&&o.contentType!=null&&(e["Content-Type"]=o.contentType),o.headers==null)return e;for(let[a,s]of Object.entries(o.headers)){let i=await g.get(s);if(typeof i=="string"){e[a]=i;continue}i!=null&&(e[a]=`${i}`)}return e}async function ns(o){let e=Xn(o.url,o.queryParameters),a=await $n({body:o.body,type:o.requestType==="json"?"json":"other"}),s=await Fn();try{let i=await os(async()=>Jn(s,e,o.method,await as(o),a,o.timeoutMs,o.abortSignal,o.withCredentials,o.duplex),o.maxRetries);return i.status>=200&&i.status<400?{ok:!0,body:await Wo(i,o.responseType),headers:i.headers,rawResponse:Jr(i)}:{ok:!1,error:{reason:"status-code",statusCode:i.status,body:await Gn(i)},rawResponse:Jr(i)}}catch(i){return o.abortSignal!=null&&o.abortSignal.aborted?{ok:!1,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:Qr}:i instanceof Error&&i.name==="AbortError"?{ok:!1,error:{reason:"timeout"},rawResponse:Qr}:i instanceof Error?{ok:!1,error:{reason:"unknown",errorMessage:i.message},rawResponse:Yr}:{ok:!1,error:{reason:"unknown",errorMessage:hr(i)},rawResponse:Yr}}}var T=ns,k=class ve extends Promise{constructor(e){super(a=>{a(void 0)}),this.innerPromise=e}static fromFunction(e,...a){return new ve(e(...a))}static interceptFunction(e){return(...a)=>ve.fromPromise(e(...a))}static fromPromise(e){return new ve(e)}static fromExecutor(e){let a=new Promise(e);return new ve(a)}static fromResult(e){let a=Promise.resolve(e);return new ve(a)}unwrap(){return this.unwrappedPromise||(this.unwrappedPromise=this.innerPromise.then(({data:e})=>e)),this.unwrappedPromise}then(e,a){return this.unwrap().then(e,a)}catch(e){return this.unwrap().catch(e)}finally(e){return this.unwrap().finally(e)}async withRawResponse(){return await this.innerPromise}},L={};Y(L,{join:()=>ss,toQueryString:()=>$o});function ss(o,...e){if(!o)return"";if(e.length===0)return o;if(o.includes("://")){let a;try{a=new URL(o)}catch{return Zr(o,...e)}let s=e[e.length-1],i=s&&s.endsWith("/");for(let l of e){let d=Zo(l);d&&(a.pathname=Jo(a.pathname,d))}return i&&!a.pathname.endsWith("/")&&(a.pathname+="/"),a.toString()}return Zr(o,...e)}function Zr(o,...e){if(e.length===0)return o;let a=o,s=e[e.length-1],i=s&&s.endsWith("/");for(let l of e){let d=Zo(l);d&&(a=Jo(a,d))}return i&&!a.endsWith("/")&&(a+="/"),a}function Jo(o,e){return o.endsWith("/")?o+e:o+"/"+e}function Zo(o){if(!o)return o;let e=0,a=o.length;return o.startsWith("/")&&(e=1),o.endsWith("/")&&(a=o.length-1),e===0&&a===o.length?o:o.slice(e,a)}function ts(o){let e=atob(o);return Uint8Array.from(e,a=>a.codePointAt(0))}function is(o){let e=String.fromCodePoint(...o);return btoa(e)}function ls(o){if(typeof Buffer<"u")return Buffer.from(o,"utf8").toString("base64");let e=new TextEncoder().encode(o);return is(e)}function ds(o){if(typeof Buffer<"u")return Buffer.from(o,"base64").toString("utf8");let e=ts(o);return new TextDecoder().decode(e)}var us=/^Basic /i,D={toAuthorizationHeader:o=>o==null?void 0:`Basic ${ls(`${o.username}:${o.password}`)}`,fromAuthorizationHeader:o=>{let e=o.replace(us,""),a=ds(e),[s,i]=a.split(":",2);if(s==null||i==null)throw new Error("Invalid basic auth");return{username:s,password:i}}},cs=class{constructor(o){this._options=o}listQueues(o={},e){return k.fromPromise(this.__listQueues(o,e))}async __listQueues(o={},e){var a,s,i,l,d,u,c,h;let{page:t,limit:r}=o,n={};t!=null&&(n.page=t.toString()),r!=null&&(n.limit=r.toString());let p=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),w=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/annotation-queues"),method:"GET",headers:p,queryParameters:{...n,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(w.ok)return{data:w.body,rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new b(w.error.body,w.rawResponse);case 401:throw new y(w.error.body,w.rawResponse);case 403:throw new v(w.error.body,w.rawResponse);case 405:throw new S(w.error.body,w.rawResponse);case 404:throw new R(w.error.body,w.rawResponse);default:throw new m({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}switch(w.error.reason){case"non-json":throw new m({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/annotation-queues.");case"unknown":throw new m({message:w.error.errorMessage,rawResponse:w.rawResponse})}}createQueue(o,e){return k.fromPromise(this.__createQueue(o,e))}async __createQueue(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/annotation-queues"),method:"POST",headers:t,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling POST /api/public/annotation-queues.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getQueue(o,e){return k.fromPromise(this.__getQueue(o,e))}async __getQueue(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/annotation-queues/${encodeURIComponent(o)}`),method:"GET",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/annotation-queues/{queueId}.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listQueueItems(o,e={},a){return k.fromPromise(this.__listQueueItems(o,e,a))}async __listQueueItems(o,e={},a){var s,i,l,d,u,c,h,t;let{status:r,page:n,limit:p}=e,w={};r!=null&&(w.status=r),n!=null&&(w.page=n.toString()),p!=null&&(w.limit=p.toString());let _=x((s=this._options)==null?void 0:s.headers,P({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":(u=a?.xLangfuseSdkVersion)!=null?u:(d=this._options)==null?void 0:d.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(h=a?.xLangfusePublicKey)!=null?h:(c=this._options)==null?void 0:c.xLangfusePublicKey}),a?.headers),f=await T({url:L.join((t=await g.get(this._options.baseUrl))!=null?t:await g.get(this._options.environment),`/api/public/annotation-queues/${encodeURIComponent(o)}/items`),method:"GET",headers:_,queryParameters:{...w,...a?.queryParams},timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.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 b(f.error.body,f.rawResponse);case 401:throw new y(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 E("Timeout exceeded when calling GET /api/public/annotation-queues/{queueId}/items.");case"unknown":throw new m({message:f.error.errorMessage,rawResponse:f.rawResponse})}}getQueueItem(o,e,a){return k.fromPromise(this.__getQueueItem(o,e,a))}async __getQueueItem(o,e,a){var s,i,l,d,u,c,h,t;let r=x((s=this._options)==null?void 0:s.headers,P({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":(u=a?.xLangfuseSdkVersion)!=null?u:(d=this._options)==null?void 0:d.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(h=a?.xLangfusePublicKey)!=null?h:(c=this._options)==null?void 0:c.xLangfusePublicKey}),a?.headers),n=await T({url:L.join((t=await g.get(this._options.baseUrl))!=null?t:await g.get(this._options.environment),`/api/public/annotation-queues/${encodeURIComponent(o)}/items/${encodeURIComponent(e)}`),method:"GET",headers:r,queryParameters:a?.queryParams,timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.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 b(n.error.body,n.rawResponse);case 401:throw new y(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 E("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(o,e,a){return k.fromPromise(this.__createQueueItem(o,e,a))}async __createQueueItem(o,e,a){var s,i,l,d,u,c,h,t;let r=x((s=this._options)==null?void 0:s.headers,P({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":(u=a?.xLangfuseSdkVersion)!=null?u:(d=this._options)==null?void 0:d.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(h=a?.xLangfusePublicKey)!=null?h:(c=this._options)==null?void 0:c.xLangfusePublicKey}),a?.headers),n=await T({url:L.join((t=await g.get(this._options.baseUrl))!=null?t:await g.get(this._options.environment),`/api/public/annotation-queues/${encodeURIComponent(o)}/items`),method:"POST",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:e,timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.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 b(n.error.body,n.rawResponse);case 401:throw new y(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 E("Timeout exceeded when calling POST /api/public/annotation-queues/{queueId}/items.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}updateQueueItem(o,e,a,s){return k.fromPromise(this.__updateQueueItem(o,e,a,s))}async __updateQueueItem(o,e,a,s){var i,l,d,u,c,h,t,r;let n=x((i=this._options)==null?void 0:i.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(d=s?.xLangfuseSdkName)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(c=s?.xLangfuseSdkVersion)!=null?c:(u=this._options)==null?void 0:u.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(t=s?.xLangfusePublicKey)!=null?t:(h=this._options)==null?void 0:h.xLangfusePublicKey}),s?.headers),p=await T({url:L.join((r=await g.get(this._options.baseUrl))!=null?r:await g.get(this._options.environment),`/api/public/annotation-queues/${encodeURIComponent(o)}/items/${encodeURIComponent(e)}`),method:"PATCH",headers:n,contentType:"application/json",queryParameters:s?.queryParams,requestType:"json",body:a,timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.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 b(p.error.body,p.rawResponse);case 401:throw new y(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 E("Timeout exceeded when calling PATCH /api/public/annotation-queues/{queueId}/items/{itemId}.");case"unknown":throw new m({message:p.error.errorMessage,rawResponse:p.rawResponse})}}deleteQueueItem(o,e,a){return k.fromPromise(this.__deleteQueueItem(o,e,a))}async __deleteQueueItem(o,e,a){var s,i,l,d,u,c,h,t;let r=x((s=this._options)==null?void 0:s.headers,P({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":(u=a?.xLangfuseSdkVersion)!=null?u:(d=this._options)==null?void 0:d.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(h=a?.xLangfusePublicKey)!=null?h:(c=this._options)==null?void 0:c.xLangfusePublicKey}),a?.headers),n=await T({url:L.join((t=await g.get(this._options.baseUrl))!=null?t:await g.get(this._options.environment),`/api/public/annotation-queues/${encodeURIComponent(o)}/items/${encodeURIComponent(e)}`),method:"DELETE",headers:r,queryParameters:a?.queryParams,timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.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 b(n.error.body,n.rawResponse);case 401:throw new y(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 E("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(o,e,a){return k.fromPromise(this.__createQueueAssignment(o,e,a))}async __createQueueAssignment(o,e,a){var s,i,l,d,u,c,h,t;let r=x((s=this._options)==null?void 0:s.headers,P({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":(u=a?.xLangfuseSdkVersion)!=null?u:(d=this._options)==null?void 0:d.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(h=a?.xLangfusePublicKey)!=null?h:(c=this._options)==null?void 0:c.xLangfusePublicKey}),a?.headers),n=await T({url:L.join((t=await g.get(this._options.baseUrl))!=null?t:await g.get(this._options.environment),`/api/public/annotation-queues/${encodeURIComponent(o)}/assignments`),method:"POST",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:e,timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.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 b(n.error.body,n.rawResponse);case 401:throw new y(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 E("Timeout exceeded when calling POST /api/public/annotation-queues/{queueId}/assignments.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}deleteQueueAssignment(o,e,a){return k.fromPromise(this.__deleteQueueAssignment(o,e,a))}async __deleteQueueAssignment(o,e,a){var s,i,l,d,u,c,h,t;let r=x((s=this._options)==null?void 0:s.headers,P({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":(u=a?.xLangfuseSdkVersion)!=null?u:(d=this._options)==null?void 0:d.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(h=a?.xLangfusePublicKey)!=null?h:(c=this._options)==null?void 0:c.xLangfusePublicKey}),a?.headers),n=await T({url:L.join((t=await g.get(this._options.baseUrl))!=null?t:await g.get(this._options.environment),`/api/public/annotation-queues/${encodeURIComponent(o)}/assignments`),method:"DELETE",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:e,timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.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 b(n.error.body,n.rawResponse);case 401:throw new y(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 E("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 o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},ws=class{constructor(o){this._options=o}getBlobStorageIntegrations(o){return k.fromPromise(this.__getBlobStorageIntegrations(o))}async __getBlobStorageIntegrations(o){var e,a,s,i,l,d,u,c;let h=x((e=this._options)==null?void 0:e.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=o?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=o?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(u=o?.xLangfusePublicKey)!=null?u:(d=this._options)==null?void 0:d.xLangfusePublicKey}),o?.headers),t=await T({url:L.join((c=await g.get(this._options.baseUrl))!=null?c:await g.get(this._options.environment),"/api/public/integrations/blob-storage"),method:"GET",headers:h,queryParameters:o?.queryParams,timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new b(t.error.body,t.rawResponse);case 401:throw new y(t.error.body,t.rawResponse);case 403:throw new v(t.error.body,t.rawResponse);case 405:throw new S(t.error.body,t.rawResponse);case 404:throw new R(t.error.body,t.rawResponse);default:throw new m({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/integrations/blob-storage.");case"unknown":throw new m({message:t.error.errorMessage,rawResponse:t.rawResponse})}}upsertBlobStorageIntegration(o,e){return k.fromPromise(this.__upsertBlobStorageIntegration(o,e))}async __upsertBlobStorageIntegration(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/integrations/blob-storage"),method:"PUT",headers:t,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling PUT /api/public/integrations/blob-storage.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getBlobStorageIntegrationStatus(o,e){return k.fromPromise(this.__getBlobStorageIntegrationStatus(o,e))}async __getBlobStorageIntegrationStatus(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/integrations/blob-storage/${encodeURIComponent(o)}`),method:"GET",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/integrations/blob-storage/{id}.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteBlobStorageIntegration(o,e){return k.fromPromise(this.__deleteBlobStorageIntegration(o,e))}async __deleteBlobStorageIntegration(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/integrations/blob-storage/${encodeURIComponent(o)}`),method:"DELETE",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling DELETE /api/public/integrations/blob-storage/{id}.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){let o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},hs=class{constructor(o){this._options=o}create(o,e){return k.fromPromise(this.__create(o,e))}async __create(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/comments"),method:"POST",headers:t,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling POST /api/public/comments.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}get(o={},e){return k.fromPromise(this.__get(o,e))}async __get(o={},e){var a,s,i,l,d,u,c,h;let{page:t,limit:r,objectType:n,objectId:p,authorUserId:w}=o,_={};t!=null&&(_.page=t.toString()),r!=null&&(_.limit=r.toString()),n!=null&&(_.objectType=n),p!=null&&(_.objectId=p),w!=null&&(_.authorUserId=w);let f=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),C=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/comments"),method:"GET",headers:f,queryParameters:{..._,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(C.ok)return{data:C.body,rawResponse:C.rawResponse};if(C.error.reason==="status-code")switch(C.error.statusCode){case 400:throw new b(C.error.body,C.rawResponse);case 401:throw new y(C.error.body,C.rawResponse);case 403:throw new v(C.error.body,C.rawResponse);case 405:throw new S(C.error.body,C.rawResponse);case 404:throw new R(C.error.body,C.rawResponse);default:throw new m({statusCode:C.error.statusCode,body:C.error.body,rawResponse:C.rawResponse})}switch(C.error.reason){case"non-json":throw new m({statusCode:C.error.statusCode,body:C.error.rawBody,rawResponse:C.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/comments.");case"unknown":throw new m({message:C.error.errorMessage,rawResponse:C.rawResponse})}}getById(o,e){return k.fromPromise(this.__getById(o,e))}async __getById(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/comments/${encodeURIComponent(o)}`),method:"GET",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/comments/{commentId}.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){let o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},ms=class{constructor(o){this._options=o}create(o,e){return k.fromPromise(this.__create(o,e))}async __create(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/dataset-items"),method:"POST",headers:t,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling POST /api/public/dataset-items.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}get(o,e){return k.fromPromise(this.__get(o,e))}async __get(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/dataset-items/${encodeURIComponent(o)}`),method:"GET",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/dataset-items/{id}.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}list(o={},e){return k.fromPromise(this.__list(o,e))}async __list(o={},e){var a,s,i,l,d,u,c,h;let{datasetName:t,sourceTraceId:r,sourceObservationId:n,version:p,page:w,limit:_}=o,f={};t!=null&&(f.datasetName=t),r!=null&&(f.sourceTraceId=r),n!=null&&(f.sourceObservationId=n),p!=null&&(f.version=p),w!=null&&(f.page=w.toString()),_!=null&&(f.limit=_.toString());let C=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),I=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/dataset-items"),method:"GET",headers:C,queryParameters:{...f,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(I.ok)return{data:I.body,rawResponse:I.rawResponse};if(I.error.reason==="status-code")switch(I.error.statusCode){case 400:throw new b(I.error.body,I.rawResponse);case 401:throw new y(I.error.body,I.rawResponse);case 403:throw new v(I.error.body,I.rawResponse);case 405:throw new S(I.error.body,I.rawResponse);case 404:throw new R(I.error.body,I.rawResponse);default:throw new m({statusCode:I.error.statusCode,body:I.error.body,rawResponse:I.rawResponse})}switch(I.error.reason){case"non-json":throw new m({statusCode:I.error.statusCode,body:I.error.rawBody,rawResponse:I.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/dataset-items.");case"unknown":throw new m({message:I.error.errorMessage,rawResponse:I.rawResponse})}}delete(o,e){return k.fromPromise(this.__delete(o,e))}async __delete(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/dataset-items/${encodeURIComponent(o)}`),method:"DELETE",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling DELETE /api/public/dataset-items/{id}.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){let o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},gs=class{constructor(o){this._options=o}create(o,e){return k.fromPromise(this.__create(o,e))}async __create(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/dataset-run-items"),method:"POST",headers:t,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling POST /api/public/dataset-run-items.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}list(o,e){return k.fromPromise(this.__list(o,e))}async __list(o,e){var a,s,i,l,d,u,c,h;let{datasetId:t,runName:r,page:n,limit:p}=o,w={};w.datasetId=t,w.runName=r,n!=null&&(w.page=n.toString()),p!=null&&(w.limit=p.toString());let _=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),f=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/dataset-run-items"),method:"GET",headers:_,queryParameters:{...w,...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 b(f.error.body,f.rawResponse);case 401:throw new y(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 E("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 o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},ps=class{constructor(o){this._options=o}list(o={},e){return k.fromPromise(this.__list(o,e))}async __list(o={},e){var a,s,i,l,d,u,c,h;let{page:t,limit:r}=o,n={};t!=null&&(n.page=t.toString()),r!=null&&(n.limit=r.toString());let p=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),w=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/v2/datasets"),method:"GET",headers:p,queryParameters:{...n,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(w.ok)return{data:w.body,rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new b(w.error.body,w.rawResponse);case 401:throw new y(w.error.body,w.rawResponse);case 403:throw new v(w.error.body,w.rawResponse);case 405:throw new S(w.error.body,w.rawResponse);case 404:throw new R(w.error.body,w.rawResponse);default:throw new m({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}switch(w.error.reason){case"non-json":throw new m({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/v2/datasets.");case"unknown":throw new m({message:w.error.errorMessage,rawResponse:w.rawResponse})}}get(o,e){return k.fromPromise(this.__get(o,e))}async __get(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/v2/datasets/${encodeURIComponent(o)}`),method:"GET",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/v2/datasets/{datasetName}.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}create(o,e){return k.fromPromise(this.__create(o,e))}async __create(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/v2/datasets"),method:"POST",headers:t,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling POST /api/public/v2/datasets.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getRun(o,e,a){return k.fromPromise(this.__getRun(o,e,a))}async __getRun(o,e,a){var s,i,l,d,u,c,h,t;let r=x((s=this._options)==null?void 0:s.headers,P({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":(u=a?.xLangfuseSdkVersion)!=null?u:(d=this._options)==null?void 0:d.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(h=a?.xLangfusePublicKey)!=null?h:(c=this._options)==null?void 0:c.xLangfusePublicKey}),a?.headers),n=await T({url:L.join((t=await g.get(this._options.baseUrl))!=null?t:await g.get(this._options.environment),`/api/public/datasets/${encodeURIComponent(o)}/runs/${encodeURIComponent(e)}`),method:"GET",headers:r,queryParameters:a?.queryParams,timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.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 b(n.error.body,n.rawResponse);case 401:throw new y(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 E("Timeout exceeded when calling GET /api/public/datasets/{datasetName}/runs/{runName}.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}deleteRun(o,e,a){return k.fromPromise(this.__deleteRun(o,e,a))}async __deleteRun(o,e,a){var s,i,l,d,u,c,h,t;let r=x((s=this._options)==null?void 0:s.headers,P({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":(u=a?.xLangfuseSdkVersion)!=null?u:(d=this._options)==null?void 0:d.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(h=a?.xLangfusePublicKey)!=null?h:(c=this._options)==null?void 0:c.xLangfusePublicKey}),a?.headers),n=await T({url:L.join((t=await g.get(this._options.baseUrl))!=null?t:await g.get(this._options.environment),`/api/public/datasets/${encodeURIComponent(o)}/runs/${encodeURIComponent(e)}`),method:"DELETE",headers:r,queryParameters:a?.queryParams,timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.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 b(n.error.body,n.rawResponse);case 401:throw new y(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 E("Timeout exceeded when calling DELETE /api/public/datasets/{datasetName}/runs/{runName}.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getRuns(o,e={},a){return k.fromPromise(this.__getRuns(o,e,a))}async __getRuns(o,e={},a){var s,i,l,d,u,c,h,t;let{page:r,limit:n}=e,p={};r!=null&&(p.page=r.toString()),n!=null&&(p.limit=n.toString());let w=x((s=this._options)==null?void 0:s.headers,P({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":(u=a?.xLangfuseSdkVersion)!=null?u:(d=this._options)==null?void 0:d.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(h=a?.xLangfusePublicKey)!=null?h:(c=this._options)==null?void 0:c.xLangfusePublicKey}),a?.headers),_=await T({url:L.join((t=await g.get(this._options.baseUrl))!=null?t:await g.get(this._options.environment),`/api/public/datasets/${encodeURIComponent(o)}/runs`),method:"GET",headers:w,queryParameters:{...p,...a?.queryParams},timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.abortSignal});if(_.ok)return{data:_.body,rawResponse:_.rawResponse};if(_.error.reason==="status-code")switch(_.error.statusCode){case 400:throw new b(_.error.body,_.rawResponse);case 401:throw new y(_.error.body,_.rawResponse);case 403:throw new v(_.error.body,_.rawResponse);case 405:throw new S(_.error.body,_.rawResponse);case 404:throw new R(_.error.body,_.rawResponse);default:throw new m({statusCode:_.error.statusCode,body:_.error.body,rawResponse:_.rawResponse})}switch(_.error.reason){case"non-json":throw new m({statusCode:_.error.statusCode,body:_.error.rawBody,rawResponse:_.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/datasets/{datasetName}/runs.");case"unknown":throw new m({message:_.error.errorMessage,rawResponse:_.rawResponse})}}async _getAuthorizationHeader(){let o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},_s=class{constructor(o){this._options=o}create(o,e){return k.fromPromise(this.__create(o,e))}async __create(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/v2/evaluation-rules"),method:"POST",headers:t,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new _e(r.error.body,r.rawResponse);case 401:throw new ae(r.error.body,r.rawResponse);case 403:throw new ne(r.error.body,r.rawResponse);case 404:throw new ge(r.error.body,r.rawResponse);case 405:throw new se(r.error.body,r.rawResponse);case 409:throw new ze(r.error.body,r.rawResponse);case 429:throw new te(r.error.body,r.rawResponse);case 500:throw new ie(r.error.body,r.rawResponse);case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling POST /api/public/v2/evaluation-rules.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}list(o={},e){return k.fromPromise(this.__list(o,e))}async __list(o={},e){var a,s,i,l,d,u,c,h;let{limit:t,cursor:r}=o,n={};t!=null&&(n.limit=t.toString()),r!=null&&(n.cursor=r);let p=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),w=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/v2/evaluation-rules"),method:"GET",headers:p,queryParameters:{...n,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(w.ok)return{data:w.body,rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new _e(w.error.body,w.rawResponse);case 401:throw new ae(w.error.body,w.rawResponse);case 403:throw new ne(w.error.body,w.rawResponse);case 405:throw new se(w.error.body,w.rawResponse);case 429:throw new te(w.error.body,w.rawResponse);case 500:throw new ie(w.error.body,w.rawResponse);case 400:throw new b(w.error.body,w.rawResponse);case 401:throw new y(w.error.body,w.rawResponse);case 403:throw new v(w.error.body,w.rawResponse);case 405:throw new S(w.error.body,w.rawResponse);case 404:throw new R(w.error.body,w.rawResponse);default:throw new m({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}switch(w.error.reason){case"non-json":throw new m({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/v2/evaluation-rules.");case"unknown":throw new m({message:w.error.errorMessage,rawResponse:w.rawResponse})}}get(o,e){return k.fromPromise(this.__get(o,e))}async __get(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/v2/evaluation-rules/${encodeURIComponent(o)}`),method:"GET",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new ae(r.error.body,r.rawResponse);case 403:throw new ne(r.error.body,r.rawResponse);case 404:throw new ge(r.error.body,r.rawResponse);case 405:throw new se(r.error.body,r.rawResponse);case 429:throw new te(r.error.body,r.rawResponse);case 500:throw new ie(r.error.body,r.rawResponse);case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/v2/evaluation-rules/{evaluationRuleId}.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(o,e,a){return k.fromPromise(this.__update(o,e,a))}async __update(o,e,a){var s,i,l,d,u,c,h,t;let r=x((s=this._options)==null?void 0:s.headers,P({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":(u=a?.xLangfuseSdkVersion)!=null?u:(d=this._options)==null?void 0:d.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(h=a?.xLangfusePublicKey)!=null?h:(c=this._options)==null?void 0:c.xLangfusePublicKey}),a?.headers),n=await T({url:L.join((t=await g.get(this._options.baseUrl))!=null?t:await g.get(this._options.environment),`/api/public/v2/evaluation-rules/${encodeURIComponent(o)}`),method:"PATCH",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:e,timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.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 _e(n.error.body,n.rawResponse);case 401:throw new ae(n.error.body,n.rawResponse);case 403:throw new ne(n.error.body,n.rawResponse);case 404:throw new ge(n.error.body,n.rawResponse);case 405:throw new se(n.error.body,n.rawResponse);case 409:throw new ze(n.error.body,n.rawResponse);case 429:throw new te(n.error.body,n.rawResponse);case 500:throw new ie(n.error.body,n.rawResponse);case 400:throw new b(n.error.body,n.rawResponse);case 401:throw new y(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 E("Timeout exceeded when calling PATCH /api/public/v2/evaluation-rules/{evaluationRuleId}.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}delete(o,e){return k.fromPromise(this.__delete(o,e))}async __delete(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/v2/evaluation-rules/${encodeURIComponent(o)}`),method:"DELETE",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new ae(r.error.body,r.rawResponse);case 403:throw new ne(r.error.body,r.rawResponse);case 404:throw new ge(r.error.body,r.rawResponse);case 405:throw new se(r.error.body,r.rawResponse);case 429:throw new te(r.error.body,r.rawResponse);case 500:throw new ie(r.error.body,r.rawResponse);case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling DELETE /api/public/v2/evaluation-rules/{evaluationRuleId}.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){let o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},fs=class{constructor(o){this._options=o}create(o,e){return k.fromPromise(this.__create(o,e))}async __create(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/v2/evaluators"),method:"POST",headers:t,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new _e(r.error.body,r.rawResponse);case 401:throw new ae(r.error.body,r.rawResponse);case 403:throw new ne(r.error.body,r.rawResponse);case 405:throw new se(r.error.body,r.rawResponse);case 412:throw new lr(r.error.body,r.rawResponse);case 429:throw new te(r.error.body,r.rawResponse);case 500:throw new ie(r.error.body,r.rawResponse);case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling POST /api/public/v2/evaluators.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}list(o={},e){return k.fromPromise(this.__list(o,e))}async __list(o={},e){var a,s,i,l,d,u,c,h;let{limit:t,cursor:r}=o,n={};t!=null&&(n.limit=t.toString()),r!=null&&(n.cursor=r);let p=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),w=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/v2/evaluators"),method:"GET",headers:p,queryParameters:{...n,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(w.ok)return{data:w.body,rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new _e(w.error.body,w.rawResponse);case 401:throw new ae(w.error.body,w.rawResponse);case 403:throw new ne(w.error.body,w.rawResponse);case 405:throw new se(w.error.body,w.rawResponse);case 429:throw new te(w.error.body,w.rawResponse);case 500:throw new ie(w.error.body,w.rawResponse);case 400:throw new b(w.error.body,w.rawResponse);case 401:throw new y(w.error.body,w.rawResponse);case 403:throw new v(w.error.body,w.rawResponse);case 405:throw new S(w.error.body,w.rawResponse);case 404:throw new R(w.error.body,w.rawResponse);default:throw new m({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}switch(w.error.reason){case"non-json":throw new m({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/v2/evaluators.");case"unknown":throw new m({message:w.error.errorMessage,rawResponse:w.rawResponse})}}get(o,e){return k.fromPromise(this.__get(o,e))}async __get(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/v2/evaluators/${encodeURIComponent(o)}`),method:"GET",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new ae(r.error.body,r.rawResponse);case 403:throw new ne(r.error.body,r.rawResponse);case 404:throw new ge(r.error.body,r.rawResponse);case 405:throw new se(r.error.body,r.rawResponse);case 429:throw new te(r.error.body,r.rawResponse);case 500:throw new ie(r.error.body,r.rawResponse);case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/v2/evaluators/{evaluatorId}.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(o,e,a){return k.fromPromise(this.__update(o,e,a))}async __update(o,e,a){var s,i,l,d,u,c,h,t;let r=x((s=this._options)==null?void 0:s.headers,P({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":(u=a?.xLangfuseSdkVersion)!=null?u:(d=this._options)==null?void 0:d.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(h=a?.xLangfusePublicKey)!=null?h:(c=this._options)==null?void 0:c.xLangfusePublicKey}),a?.headers),n=await T({url:L.join((t=await g.get(this._options.baseUrl))!=null?t:await g.get(this._options.environment),`/api/public/v2/evaluators/${encodeURIComponent(o)}`),method:"PATCH",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:e,timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.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 _e(n.error.body,n.rawResponse);case 401:throw new ae(n.error.body,n.rawResponse);case 403:throw new ne(n.error.body,n.rawResponse);case 404:throw new ge(n.error.body,n.rawResponse);case 405:throw new se(n.error.body,n.rawResponse);case 409:throw new ze(n.error.body,n.rawResponse);case 412:throw new lr(n.error.body,n.rawResponse);case 429:throw new te(n.error.body,n.rawResponse);case 500:throw new ie(n.error.body,n.rawResponse);case 400:throw new b(n.error.body,n.rawResponse);case 401:throw new y(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 E("Timeout exceeded when calling PATCH /api/public/v2/evaluators/{evaluatorId}.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}delete(o,e){return k.fromPromise(this.__delete(o,e))}async __delete(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/v2/evaluators/${encodeURIComponent(o)}`),method:"DELETE",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new ae(r.error.body,r.rawResponse);case 403:throw new ne(r.error.body,r.rawResponse);case 404:throw new ge(r.error.body,r.rawResponse);case 405:throw new se(r.error.body,r.rawResponse);case 429:throw new te(r.error.body,r.rawResponse);case 500:throw new ie(r.error.body,r.rawResponse);case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling DELETE /api/public/v2/evaluators/{evaluatorId}.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listVersions(o,e={},a){return k.fromPromise(this.__listVersions(o,e,a))}async __listVersions(o,e={},a){var s,i,l,d,u,c,h,t;let{limit:r,cursor:n}=e,p={};r!=null&&(p.limit=r.toString()),n!=null&&(p.cursor=n);let w=x((s=this._options)==null?void 0:s.headers,P({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":(u=a?.xLangfuseSdkVersion)!=null?u:(d=this._options)==null?void 0:d.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(h=a?.xLangfusePublicKey)!=null?h:(c=this._options)==null?void 0:c.xLangfusePublicKey}),a?.headers),_=await T({url:L.join((t=await g.get(this._options.baseUrl))!=null?t:await g.get(this._options.environment),`/api/public/v2/evaluators/${encodeURIComponent(o)}/versions`),method:"GET",headers:w,queryParameters:{...p,...a?.queryParams},timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.abortSignal});if(_.ok)return{data:_.body,rawResponse:_.rawResponse};if(_.error.reason==="status-code")switch(_.error.statusCode){case 400:throw new _e(_.error.body,_.rawResponse);case 401:throw new ae(_.error.body,_.rawResponse);case 403:throw new ne(_.error.body,_.rawResponse);case 404:throw new ge(_.error.body,_.rawResponse);case 405:throw new se(_.error.body,_.rawResponse);case 429:throw new te(_.error.body,_.rawResponse);case 500:throw new ie(_.error.body,_.rawResponse);case 400:throw new b(_.error.body,_.rawResponse);case 401:throw new y(_.error.body,_.rawResponse);case 403:throw new v(_.error.body,_.rawResponse);case 405:throw new S(_.error.body,_.rawResponse);case 404:throw new R(_.error.body,_.rawResponse);default:throw new m({statusCode:_.error.statusCode,body:_.error.body,rawResponse:_.rawResponse})}switch(_.error.reason){case"non-json":throw new m({statusCode:_.error.statusCode,body:_.error.rawBody,rawResponse:_.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/v2/evaluators/{evaluatorId}/versions.");case"unknown":throw new m({message:_.error.errorMessage,rawResponse:_.rawResponse})}}async _getAuthorizationHeader(){let o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},bs=class{constructor(o){this._options=o}list(o,e){return k.fromPromise(this.__list(o,e))}async __list(o,e){var a,s,i,l,d,u,c,h;let{fields:t,limit:r,scoreLimit:n,cursor:p,fromStartTime:w,toStartTime:_,id:f,name:C,datasetId:I,filter:M}=o,B={};t!=null&&(B.fields=t),r!=null&&(B.limit=r.toString()),n!=null&&(B.scoreLimit=n.toString()),p!=null&&(B.cursor=p),B.fromStartTime=w,_!=null&&(B.toStartTime=_),f!=null&&(B.id=f),C!=null&&(B.name=C),I!=null&&(B.datasetId=I),M!=null&&(B.filter=M);let X=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),j=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/experiments"),method:"GET",headers:X,queryParameters:{...B,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(j.ok)return{data:j.body,rawResponse:j.rawResponse};if(j.error.reason==="status-code")switch(j.error.statusCode){case 400:throw new b(j.error.body,j.rawResponse);case 401:throw new y(j.error.body,j.rawResponse);case 403:throw new v(j.error.body,j.rawResponse);case 405:throw new S(j.error.body,j.rawResponse);case 404:throw new R(j.error.body,j.rawResponse);default:throw new m({statusCode:j.error.statusCode,body:j.error.body,rawResponse:j.rawResponse})}switch(j.error.reason){case"non-json":throw new m({statusCode:j.error.statusCode,body:j.error.rawBody,rawResponse:j.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/experiments.");case"unknown":throw new m({message:j.error.errorMessage,rawResponse:j.rawResponse})}}listItems(o,e){return k.fromPromise(this.__listItems(o,e))}async __listItems(o,e){var a,s,i,l,d,u,c,h;let{fields:t,limit:r,scoreLimit:n,cursor:p,fromStartTime:w,toStartTime:_,experimentId:f,experimentName:C,experimentItemId:I,datasetId:M,filter:B}=o,X={};t!=null&&(X.fields=t),r!=null&&(X.limit=r.toString()),n!=null&&(X.scoreLimit=n.toString()),p!=null&&(X.cursor=p),X.fromStartTime=w,_!=null&&(X.toStartTime=_),f!=null&&(X.experimentId=f),C!=null&&(X.experimentName=C),I!=null&&(X.experimentItemId=I),M!=null&&(X.datasetId=M),B!=null&&(X.filter=B);let j=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),N=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/experiment-items"),method:"GET",headers:j,queryParameters:{...X,...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 b(N.error.body,N.rawResponse);case 401:throw new y(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 E("Timeout exceeded when calling GET /api/public/experiment-items.");case"unknown":throw new m({message:N.error.errorMessage,rawResponse:N.rawResponse})}}async _getAuthorizationHeader(){let o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},ys=class{constructor(o){this._options=o}submit(o,e){return k.fromPromise(this.__submit(o,e))}async __submit(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/feedback"),method:"POST",headers:t,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 409:throw new _o(r.rawResponse);case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling POST /api/public/feedback.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){let o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},vs=class{constructor(o){this._options=o}health(o){return k.fromPromise(this.__health(o))}async __health(o){var e,a,s,i,l,d,u,c;let h=x((e=this._options)==null?void 0:e.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=o?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=o?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(u=o?.xLangfusePublicKey)!=null?u:(d=this._options)==null?void 0:d.xLangfusePublicKey}),o?.headers),t=await T({url:L.join((c=await g.get(this._options.baseUrl))!=null?c:await g.get(this._options.environment),"/api/public/health"),method:"GET",headers:h,queryParameters:o?.queryParams,timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 503:throw new bo(t.rawResponse);case 400:throw new b(t.error.body,t.rawResponse);case 401:throw new y(t.error.body,t.rawResponse);case 403:throw new v(t.error.body,t.rawResponse);case 405:throw new S(t.error.body,t.rawResponse);case 404:throw new R(t.error.body,t.rawResponse);default:throw new m({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/health.");case"unknown":throw new m({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){let o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},Rs=class{constructor(o){this._options=o}batch(o,e){return k.fromPromise(this.__batch(o,e))}async __batch(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/ingestion"),method:"POST",headers:t,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling POST /api/public/ingestion.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){let o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},Ss=class{constructor(o){this._options=o}metrics(o,e){return k.fromPromise(this.__metrics(o,e))}async __metrics(o,e){var a,s,i,l,d,u,c,h;let{query:t}=o,r={};r.query=t;let n=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),p=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/metrics"),method:"GET",headers:n,queryParameters:{...r,...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 b(p.error.body,p.rawResponse);case 401:throw new y(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 E("Timeout exceeded when calling GET /api/public/metrics.");case"unknown":throw new m({message:p.error.errorMessage,rawResponse:p.rawResponse})}}async _getAuthorizationHeader(){let o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},xs=class{constructor(o){this._options=o}get(o,e){return k.fromPromise(this.__get(o,e))}async __get(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/observations/${encodeURIComponent(o)}`),method:"GET",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/observations/{observationId}.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getMany(o={},e){return k.fromPromise(this.__getMany(o,e))}async __getMany(o={},e){var a,s,i,l,d,u,c,h;let{page:t,limit:r,name:n,userId:p,type:w,traceId:_,level:f,parentObservationId:C,environment:I,fromStartTime:M,toStartTime:B,version:X,filter:j}=o,N={};t!=null&&(N.page=t.toString()),r!=null&&(N.limit=r.toString()),n!=null&&(N.name=n),p!=null&&(N.userId=p),w!=null&&(N.type=w),_!=null&&(N.traceId=_),f!=null&&(N.level=f),C!=null&&(N.parentObservationId=C),I!=null&&(Array.isArray(I)?N.environment=I.map(z=>z):N.environment=I),M!=null&&(N.fromStartTime=M),B!=null&&(N.toStartTime=B),X!=null&&(N.version=X),j!=null&&(N.filter=j);let H=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),K=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/observations"),method:"GET",headers:H,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 b(K.error.body,K.rawResponse);case 401:throw new y(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 E("Timeout exceeded when calling GET /api/public/observations.");case"unknown":throw new m({message:K.error.errorMessage,rawResponse:K.rawResponse})}}async _getAuthorizationHeader(){let o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},Oo=class{constructor(o){this._options=o}create(o,e){return k.fromPromise(this.__create(o,e))}async __create(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/scores"),method:"POST",headers:t,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling POST /api/public/scores.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getMany(o={},e){return k.fromPromise(this.__getMany(o,e))}async __getMany(o={},e){var a,s,i,l,d,u,c,h;let{page:t,limit:r,userId:n,name:p,fromTimestamp:w,toTimestamp:_,environment:f,source:C,operator:I,value:M,scoreIds:B,configId:X,sessionId:j,datasetRunId:N,traceId:H,observationId:K,queueId:z,dataType:oe,traceTags:G,fields:fe,filter:V}=o,F={};t!=null&&(F.page=t.toString()),r!=null&&(F.limit=r.toString()),n!=null&&(F.userId=n),p!=null&&(F.name=p),w!=null&&(F.fromTimestamp=w),_!=null&&(F.toTimestamp=_),f!=null&&(Array.isArray(f)?F.environment=f.map(Oe=>Oe):F.environment=f),C!=null&&(F.source=C),I!=null&&(F.operator=I),M!=null&&(F.value=M.toString()),B!=null&&(F.scoreIds=B),X!=null&&(F.configId=X),j!=null&&(F.sessionId=j),N!=null&&(F.datasetRunId=N),H!=null&&(F.traceId=H),K!=null&&(F.observationId=K),z!=null&&(F.queueId=z),oe!=null&&(F.dataType=oe),G!=null&&(Array.isArray(G)?F.traceTags=G.map(Oe=>Oe):F.traceTags=G),fe!=null&&(F.fields=fe),V!=null&&(F.filter=V);let $=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),W=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/v2/scores"),method:"GET",headers:$,queryParameters:{...F,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(W.ok)return{data:W.body,rawResponse:W.rawResponse};if(W.error.reason==="status-code")switch(W.error.statusCode){case 400:throw new b(W.error.body,W.rawResponse);case 401:throw new y(W.error.body,W.rawResponse);case 403:throw new v(W.error.body,W.rawResponse);case 405:throw new S(W.error.body,W.rawResponse);case 404:throw new R(W.error.body,W.rawResponse);default:throw new m({statusCode:W.error.statusCode,body:W.error.body,rawResponse:W.rawResponse})}switch(W.error.reason){case"non-json":throw new m({statusCode:W.error.statusCode,body:W.error.rawBody,rawResponse:W.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/v2/scores.");case"unknown":throw new m({message:W.error.errorMessage,rawResponse:W.rawResponse})}}getById(o,e){return k.fromPromise(this.__getById(o,e))}async __getById(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/v2/scores/${encodeURIComponent(o)}`),method:"GET",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/v2/scores/{scoreId}.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){let o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},Ls=class{constructor(o){this._options=o}create(o,e){return new Oo(this._options).create(o,e)}delete(o,e){return k.fromPromise(this.__delete(o,e))}async __delete(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/scores/${encodeURIComponent(o)}`),method:"DELETE",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:void 0,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling DELETE /api/public/scores/{scoreId}.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){let o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},Es=class{constructor(o){this._options=o}get metricsV1(){var o;return(o=this._metricsV1)!=null?o:this._metricsV1=new Ss(this._options)}get observationsV1(){var o;return(o=this._observationsV1)!=null?o:this._observationsV1=new xs(this._options)}get scoreV1(){var o;return(o=this._scoreV1)!=null?o:this._scoreV1=new Ls(this._options)}},Ps=class{constructor(o){this._options=o}list(o={},e){return k.fromPromise(this.__list(o,e))}async __list(o={},e){var a,s,i,l,d,u,c,h;let{page:t,limit:r}=o,n={};t!=null&&(n.page=t.toString()),r!=null&&(n.limit=r.toString());let p=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),w=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/llm-connections"),method:"GET",headers:p,queryParameters:{...n,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(w.ok)return{data:w.body,rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new b(w.error.body,w.rawResponse);case 401:throw new y(w.error.body,w.rawResponse);case 403:throw new v(w.error.body,w.rawResponse);case 405:throw new S(w.error.body,w.rawResponse);case 404:throw new R(w.error.body,w.rawResponse);default:throw new m({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}switch(w.error.reason){case"non-json":throw new m({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/llm-connections.");case"unknown":throw new m({message:w.error.errorMessage,rawResponse:w.rawResponse})}}upsert(o,e){return k.fromPromise(this.__upsert(o,e))}async __upsert(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/llm-connections"),method:"PUT",headers:t,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling PUT /api/public/llm-connections.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}delete(o,e){return k.fromPromise(this.__delete(o,e))}async __delete(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/llm-connections/${encodeURIComponent(o)}`),method:"DELETE",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling DELETE /api/public/llm-connections/{id}.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){let o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},Ts=class{constructor(o){this._options=o}get(o,e){return k.fromPromise(this.__get(o,e))}async __get(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/media/${encodeURIComponent(o)}`),method:"GET",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/media/{mediaId}.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}patch(o,e,a){return k.fromPromise(this.__patch(o,e,a))}async __patch(o,e,a){var s,i,l,d,u,c,h,t;let r=x((s=this._options)==null?void 0:s.headers,P({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":(u=a?.xLangfuseSdkVersion)!=null?u:(d=this._options)==null?void 0:d.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(h=a?.xLangfusePublicKey)!=null?h:(c=this._options)==null?void 0:c.xLangfusePublicKey}),a?.headers),n=await T({url:L.join((t=await g.get(this._options.baseUrl))!=null?t:await g.get(this._options.environment),`/api/public/media/${encodeURIComponent(o)}`),method:"PATCH",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:e,timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.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 b(n.error.body,n.rawResponse);case 401:throw new y(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 E("Timeout exceeded when calling PATCH /api/public/media/{mediaId}.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getUploadUrl(o,e){return k.fromPromise(this.__getUploadUrl(o,e))}async __getUploadUrl(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/media"),method:"POST",headers:t,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling POST /api/public/media.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){let o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},ks=class{constructor(o){this._options=o}metrics(o,e){return k.fromPromise(this.__metrics(o,e))}async __metrics(o,e){var a,s,i,l,d,u,c,h;let{query:t}=o,r={};r.query=t;let n=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),p=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/v2/metrics"),method:"GET",headers:n,queryParameters:{...r,...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 b(p.error.body,p.rawResponse);case 401:throw new y(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 E("Timeout exceeded when calling GET /api/public/v2/metrics.");case"unknown":throw new m({message:p.error.errorMessage,rawResponse:p.rawResponse})}}async _getAuthorizationHeader(){let o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},Cs=class{constructor(o){this._options=o}create(o,e){return k.fromPromise(this.__create(o,e))}async __create(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/models"),method:"POST",headers:t,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling POST /api/public/models.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}upsert(o,e,a){return k.fromPromise(this.__upsert(o,e,a))}async __upsert(o,e,a){var s,i,l,d,u,c,h,t;let r=x((s=this._options)==null?void 0:s.headers,P({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":(u=a?.xLangfuseSdkVersion)!=null?u:(d=this._options)==null?void 0:d.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(h=a?.xLangfusePublicKey)!=null?h:(c=this._options)==null?void 0:c.xLangfusePublicKey}),a?.headers),n=await T({url:L.join((t=await g.get(this._options.baseUrl))!=null?t:await g.get(this._options.environment),`/api/public/models/${encodeURIComponent(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:e,timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.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 b(n.error.body,n.rawResponse);case 401:throw new y(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 E("Timeout exceeded when calling PUT /api/public/models/{id}.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}list(o={},e){return k.fromPromise(this.__list(o,e))}async __list(o={},e){var a,s,i,l,d,u,c,h;let{page:t,limit:r}=o,n={};t!=null&&(n.page=t.toString()),r!=null&&(n.limit=r.toString());let p=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),w=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/models"),method:"GET",headers:p,queryParameters:{...n,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(w.ok)return{data:w.body,rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new b(w.error.body,w.rawResponse);case 401:throw new y(w.error.body,w.rawResponse);case 403:throw new v(w.error.body,w.rawResponse);case 405:throw new S(w.error.body,w.rawResponse);case 404:throw new R(w.error.body,w.rawResponse);default:throw new m({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}switch(w.error.reason){case"non-json":throw new m({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/models.");case"unknown":throw new m({message:w.error.errorMessage,rawResponse:w.rawResponse})}}get(o,e){return k.fromPromise(this.__get(o,e))}async __get(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/models/${encodeURIComponent(o)}`),method:"GET",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/models/{id}.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}delete(o,e){return k.fromPromise(this.__delete(o,e))}async __delete(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/models/${encodeURIComponent(o)}`),method:"DELETE",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:void 0,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling DELETE /api/public/models/{id}.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){let o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},As=class{constructor(o){this._options=o}getMany(o={},e){return k.fromPromise(this.__getMany(o,e))}async __getMany(o={},e){var a,s,i,l,d,u,c,h;let{fields:t,expandMetadata:r,limit:n,cursor:p,parseIoAsJson:w,name:_,userId:f,sessionId:C,type:I,traceId:M,level:B,parentObservationId:X,isRootObservation:j,environment:N,fromStartTime:H,toStartTime:K,version:z,filter:oe}=o,G={};t!=null&&(G.fields=t),r!=null&&(G.expandMetadata=r),n!=null&&(G.limit=n.toString()),p!=null&&(G.cursor=p),w!=null&&(G.parseIoAsJson=w.toString()),_!=null&&(G.name=_),f!=null&&(G.userId=f),C!=null&&(G.sessionId=C),I!=null&&(G.type=I),M!=null&&(G.traceId=M),B!=null&&(G.level=B),X!=null&&(G.parentObservationId=X),j!=null&&(G.isRootObservation=j.toString()),N!=null&&(Array.isArray(N)?G.environment=N.map(F=>F):G.environment=N),H!=null&&(G.fromStartTime=H),K!=null&&(G.toStartTime=K),z!=null&&(G.version=z),oe!=null&&(G.filter=oe);let fe=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),V=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/v2/observations"),method:"GET",headers:fe,queryParameters:{...G,...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 b(V.error.body,V.rawResponse);case 401:throw new y(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 E("Timeout exceeded when calling GET /api/public/v2/observations.");case"unknown":throw new m({message:V.error.errorMessage,rawResponse:V.rawResponse})}}async _getAuthorizationHeader(){let o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},Is=class{constructor(o){this._options=o}exportTraces(o,e){return k.fromPromise(this.__exportTraces(o,e))}async __exportTraces(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/otel/v1/traces"),method:"POST",headers:t,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling POST /api/public/otel/v1/traces.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){let o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},Ns=class{constructor(o){this._options=o}getOrganizationMemberships(o){return k.fromPromise(this.__getOrganizationMemberships(o))}async __getOrganizationMemberships(o){var e,a,s,i,l,d,u,c;let h=x((e=this._options)==null?void 0:e.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=o?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=o?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(u=o?.xLangfusePublicKey)!=null?u:(d=this._options)==null?void 0:d.xLangfusePublicKey}),o?.headers),t=await T({url:L.join((c=await g.get(this._options.baseUrl))!=null?c:await g.get(this._options.environment),"/api/public/organizations/memberships"),method:"GET",headers:h,queryParameters:o?.queryParams,timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new b(t.error.body,t.rawResponse);case 401:throw new y(t.error.body,t.rawResponse);case 403:throw new v(t.error.body,t.rawResponse);case 405:throw new S(t.error.body,t.rawResponse);case 404:throw new R(t.error.body,t.rawResponse);default:throw new m({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/organizations/memberships.");case"unknown":throw new m({message:t.error.errorMessage,rawResponse:t.rawResponse})}}updateOrganizationMembership(o,e){return k.fromPromise(this.__updateOrganizationMembership(o,e))}async __updateOrganizationMembership(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/organizations/memberships"),method:"PUT",headers:t,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling PUT /api/public/organizations/memberships.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteOrganizationMembership(o,e){return k.fromPromise(this.__deleteOrganizationMembership(o,e))}async __deleteOrganizationMembership(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/organizations/memberships"),method:"DELETE",headers:t,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling DELETE /api/public/organizations/memberships.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getProjectMemberships(o,e){return k.fromPromise(this.__getProjectMemberships(o,e))}async __getProjectMemberships(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/projects/${encodeURIComponent(o)}/memberships`),method:"GET",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/projects/{projectId}/memberships.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateProjectMembership(o,e,a){return k.fromPromise(this.__updateProjectMembership(o,e,a))}async __updateProjectMembership(o,e,a){var s,i,l,d,u,c,h,t;let r=x((s=this._options)==null?void 0:s.headers,P({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":(u=a?.xLangfuseSdkVersion)!=null?u:(d=this._options)==null?void 0:d.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(h=a?.xLangfusePublicKey)!=null?h:(c=this._options)==null?void 0:c.xLangfusePublicKey}),a?.headers),n=await T({url:L.join((t=await g.get(this._options.baseUrl))!=null?t:await g.get(this._options.environment),`/api/public/projects/${encodeURIComponent(o)}/memberships`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:e,timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.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 b(n.error.body,n.rawResponse);case 401:throw new y(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 E("Timeout exceeded when calling PUT /api/public/projects/{projectId}/memberships.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}deleteProjectMembership(o,e,a){return k.fromPromise(this.__deleteProjectMembership(o,e,a))}async __deleteProjectMembership(o,e,a){var s,i,l,d,u,c,h,t;let r=x((s=this._options)==null?void 0:s.headers,P({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":(u=a?.xLangfuseSdkVersion)!=null?u:(d=this._options)==null?void 0:d.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(h=a?.xLangfusePublicKey)!=null?h:(c=this._options)==null?void 0:c.xLangfusePublicKey}),a?.headers),n=await T({url:L.join((t=await g.get(this._options.baseUrl))!=null?t:await g.get(this._options.environment),`/api/public/projects/${encodeURIComponent(o)}/memberships`),method:"DELETE",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:e,timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.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 b(n.error.body,n.rawResponse);case 401:throw new y(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 E("Timeout exceeded when calling DELETE /api/public/projects/{projectId}/memberships.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getOrganizationProjects(o){return k.fromPromise(this.__getOrganizationProjects(o))}async __getOrganizationProjects(o){var e,a,s,i,l,d,u,c;let h=x((e=this._options)==null?void 0:e.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=o?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=o?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(u=o?.xLangfusePublicKey)!=null?u:(d=this._options)==null?void 0:d.xLangfusePublicKey}),o?.headers),t=await T({url:L.join((c=await g.get(this._options.baseUrl))!=null?c:await g.get(this._options.environment),"/api/public/organizations/projects"),method:"GET",headers:h,queryParameters:o?.queryParams,timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new b(t.error.body,t.rawResponse);case 401:throw new y(t.error.body,t.rawResponse);case 403:throw new v(t.error.body,t.rawResponse);case 405:throw new S(t.error.body,t.rawResponse);case 404:throw new R(t.error.body,t.rawResponse);default:throw new m({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/organizations/projects.");case"unknown":throw new m({message:t.error.errorMessage,rawResponse:t.rawResponse})}}getOrganizationApiKeys(o){return k.fromPromise(this.__getOrganizationApiKeys(o))}async __getOrganizationApiKeys(o){var e,a,s,i,l,d,u,c;let h=x((e=this._options)==null?void 0:e.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=o?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=o?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(u=o?.xLangfusePublicKey)!=null?u:(d=this._options)==null?void 0:d.xLangfusePublicKey}),o?.headers),t=await T({url:L.join((c=await g.get(this._options.baseUrl))!=null?c:await g.get(this._options.environment),"/api/public/organizations/apiKeys"),method:"GET",headers:h,queryParameters:o?.queryParams,timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new b(t.error.body,t.rawResponse);case 401:throw new y(t.error.body,t.rawResponse);case 403:throw new v(t.error.body,t.rawResponse);case 405:throw new S(t.error.body,t.rawResponse);case 404:throw new R(t.error.body,t.rawResponse);default:throw new m({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/organizations/apiKeys.");case"unknown":throw new m({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){let o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},Ms=class{constructor(o){this._options=o}get(o){return k.fromPromise(this.__get(o))}async __get(o){var e,a,s,i,l,d,u,c;let h=x((e=this._options)==null?void 0:e.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=o?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=o?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(u=o?.xLangfusePublicKey)!=null?u:(d=this._options)==null?void 0:d.xLangfusePublicKey}),o?.headers),t=await T({url:L.join((c=await g.get(this._options.baseUrl))!=null?c:await g.get(this._options.environment),"/api/public/projects"),method:"GET",headers:h,queryParameters:o?.queryParams,timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new b(t.error.body,t.rawResponse);case 401:throw new y(t.error.body,t.rawResponse);case 403:throw new v(t.error.body,t.rawResponse);case 405:throw new S(t.error.body,t.rawResponse);case 404:throw new R(t.error.body,t.rawResponse);default:throw new m({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/projects.");case"unknown":throw new m({message:t.error.errorMessage,rawResponse:t.rawResponse})}}create(o,e){return k.fromPromise(this.__create(o,e))}async __create(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/projects"),method:"POST",headers:t,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling POST /api/public/projects.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(o,e,a){return k.fromPromise(this.__update(o,e,a))}async __update(o,e,a){var s,i,l,d,u,c,h,t;let r=x((s=this._options)==null?void 0:s.headers,P({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":(u=a?.xLangfuseSdkVersion)!=null?u:(d=this._options)==null?void 0:d.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(h=a?.xLangfusePublicKey)!=null?h:(c=this._options)==null?void 0:c.xLangfusePublicKey}),a?.headers),n=await T({url:L.join((t=await g.get(this._options.baseUrl))!=null?t:await g.get(this._options.environment),`/api/public/projects/${encodeURIComponent(o)}`),method:"PUT",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:e,timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.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 b(n.error.body,n.rawResponse);case 401:throw new y(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 E("Timeout exceeded when calling PUT /api/public/projects/{projectId}.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}delete(o,e){return k.fromPromise(this.__delete(o,e))}async __delete(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/projects/${encodeURIComponent(o)}`),method:"DELETE",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling DELETE /api/public/projects/{projectId}.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getApiKeys(o,e){return k.fromPromise(this.__getApiKeys(o,e))}async __getApiKeys(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/projects/${encodeURIComponent(o)}/apiKeys`),method:"GET",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/projects/{projectId}/apiKeys.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}createApiKey(o,e={},a){return k.fromPromise(this.__createApiKey(o,e,a))}async __createApiKey(o,e={},a){var s,i,l,d,u,c,h,t;let r=x((s=this._options)==null?void 0:s.headers,P({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":(u=a?.xLangfuseSdkVersion)!=null?u:(d=this._options)==null?void 0:d.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(h=a?.xLangfusePublicKey)!=null?h:(c=this._options)==null?void 0:c.xLangfusePublicKey}),a?.headers),n=await T({url:L.join((t=await g.get(this._options.baseUrl))!=null?t:await g.get(this._options.environment),`/api/public/projects/${encodeURIComponent(o)}/apiKeys`),method:"POST",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:e,timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.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 b(n.error.body,n.rawResponse);case 401:throw new y(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 E("Timeout exceeded when calling POST /api/public/projects/{projectId}/apiKeys.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}deleteApiKey(o,e,a){return k.fromPromise(this.__deleteApiKey(o,e,a))}async __deleteApiKey(o,e,a){var s,i,l,d,u,c,h,t;let r=x((s=this._options)==null?void 0:s.headers,P({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":(u=a?.xLangfuseSdkVersion)!=null?u:(d=this._options)==null?void 0:d.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(h=a?.xLangfusePublicKey)!=null?h:(c=this._options)==null?void 0:c.xLangfusePublicKey}),a?.headers),n=await T({url:L.join((t=await g.get(this._options.baseUrl))!=null?t:await g.get(this._options.environment),`/api/public/projects/${encodeURIComponent(o)}/apiKeys/${encodeURIComponent(e)}`),method:"DELETE",headers:r,queryParameters:a?.queryParams,timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.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 b(n.error.body,n.rawResponse);case 401:throw new y(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 E("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 o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},Vs=class{constructor(o){this._options=o}update(o,e,a,s){return k.fromPromise(this.__update(o,e,a,s))}async __update(o,e,a,s){var i,l,d,u,c,h,t,r;let n=x((i=this._options)==null?void 0:i.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(d=s?.xLangfuseSdkName)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(c=s?.xLangfuseSdkVersion)!=null?c:(u=this._options)==null?void 0:u.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(t=s?.xLangfusePublicKey)!=null?t:(h=this._options)==null?void 0:h.xLangfusePublicKey}),s?.headers),p=await T({url:L.join((r=await g.get(this._options.baseUrl))!=null?r:await g.get(this._options.environment),`/api/public/v2/prompts/${encodeURIComponent(o)}/versions/${encodeURIComponent(e)}`),method:"PATCH",headers:n,contentType:"application/json",queryParameters:s?.queryParams,requestType:"json",body:a,timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.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 b(p.error.body,p.rawResponse);case 401:throw new y(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 E("Timeout exceeded when calling PATCH /api/public/v2/prompts/{name}/versions/{version}.");case"unknown":throw new m({message:p.error.errorMessage,rawResponse:p.rawResponse})}}async _getAuthorizationHeader(){let o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},js=class{constructor(o){this._options=o}get(o,e={},a){return k.fromPromise(this.__get(o,e,a))}async __get(o,e={},a){var s,i,l,d,u,c,h,t;let{version:r,label:n,resolve:p}=e,w={};r!=null&&(w.version=r.toString()),n!=null&&(w.label=n),p!=null&&(w.resolve=p.toString());let _=x((s=this._options)==null?void 0:s.headers,P({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":(u=a?.xLangfuseSdkVersion)!=null?u:(d=this._options)==null?void 0:d.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(h=a?.xLangfusePublicKey)!=null?h:(c=this._options)==null?void 0:c.xLangfusePublicKey}),a?.headers),f=await T({url:L.join((t=await g.get(this._options.baseUrl))!=null?t:await g.get(this._options.environment),`/api/public/v2/prompts/${encodeURIComponent(o)}`),method:"GET",headers:_,queryParameters:{...w,...a?.queryParams},timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.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 b(f.error.body,f.rawResponse);case 401:throw new y(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 E("Timeout exceeded when calling GET /api/public/v2/prompts/{promptName}.");case"unknown":throw new m({message:f.error.errorMessage,rawResponse:f.rawResponse})}}list(o={},e){return k.fromPromise(this.__list(o,e))}async __list(o={},e){var a,s,i,l,d,u,c,h;let{name:t,label:r,tag:n,page:p,limit:w,fromUpdatedAt:_,toUpdatedAt:f}=o,C={};t!=null&&(C.name=t),r!=null&&(C.label=r),n!=null&&(C.tag=n),p!=null&&(C.page=p.toString()),w!=null&&(C.limit=w.toString()),_!=null&&(C.fromUpdatedAt=_),f!=null&&(C.toUpdatedAt=f);let I=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),M=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/v2/prompts"),method:"GET",headers:I,queryParameters:{...C,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(M.ok)return{data:M.body,rawResponse:M.rawResponse};if(M.error.reason==="status-code")switch(M.error.statusCode){case 400:throw new b(M.error.body,M.rawResponse);case 401:throw new y(M.error.body,M.rawResponse);case 403:throw new v(M.error.body,M.rawResponse);case 405:throw new S(M.error.body,M.rawResponse);case 404:throw new R(M.error.body,M.rawResponse);default:throw new m({statusCode:M.error.statusCode,body:M.error.body,rawResponse:M.rawResponse})}switch(M.error.reason){case"non-json":throw new m({statusCode:M.error.statusCode,body:M.error.rawBody,rawResponse:M.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/v2/prompts.");case"unknown":throw new m({message:M.error.errorMessage,rawResponse:M.rawResponse})}}create(o,e){return k.fromPromise(this.__create(o,e))}async __create(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/v2/prompts"),method:"POST",headers:t,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling POST /api/public/v2/prompts.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}delete(o,e={},a){return k.fromPromise(this.__delete(o,e,a))}async __delete(o,e={},a){var s,i,l,d,u,c,h,t;let{label:r,version:n}=e,p={};r!=null&&(p.label=r),n!=null&&(p.version=n.toString());let w=x((s=this._options)==null?void 0:s.headers,P({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":(u=a?.xLangfuseSdkVersion)!=null?u:(d=this._options)==null?void 0:d.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(h=a?.xLangfusePublicKey)!=null?h:(c=this._options)==null?void 0:c.xLangfusePublicKey}),a?.headers),_=await T({url:L.join((t=await g.get(this._options.baseUrl))!=null?t:await g.get(this._options.environment),`/api/public/v2/prompts/${encodeURIComponent(o)}`),method:"DELETE",headers:w,queryParameters:{...p,...a?.queryParams},timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.abortSignal});if(_.ok)return{data:void 0,rawResponse:_.rawResponse};if(_.error.reason==="status-code")switch(_.error.statusCode){case 400:throw new b(_.error.body,_.rawResponse);case 401:throw new y(_.error.body,_.rawResponse);case 403:throw new v(_.error.body,_.rawResponse);case 405:throw new S(_.error.body,_.rawResponse);case 404:throw new R(_.error.body,_.rawResponse);default:throw new m({statusCode:_.error.statusCode,body:_.error.body,rawResponse:_.rawResponse})}switch(_.error.reason){case"non-json":throw new m({statusCode:_.error.statusCode,body:_.error.rawBody,rawResponse:_.rawResponse});case"timeout":throw new E("Timeout exceeded when calling DELETE /api/public/v2/prompts/{promptName}.");case"unknown":throw new m({message:_.error.errorMessage,rawResponse:_.rawResponse})}}async _getAuthorizationHeader(){let o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},Us=class{constructor(o){this._options=o}getServiceProviderConfig(o){return k.fromPromise(this.__getServiceProviderConfig(o))}async __getServiceProviderConfig(o){var e,a,s,i,l,d,u,c;let h=x((e=this._options)==null?void 0:e.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=o?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=o?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(u=o?.xLangfusePublicKey)!=null?u:(d=this._options)==null?void 0:d.xLangfusePublicKey}),o?.headers),t=await T({url:L.join((c=await g.get(this._options.baseUrl))!=null?c:await g.get(this._options.environment),"/api/public/scim/ServiceProviderConfig"),method:"GET",headers:h,queryParameters:o?.queryParams,timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new b(t.error.body,t.rawResponse);case 401:throw new y(t.error.body,t.rawResponse);case 403:throw new v(t.error.body,t.rawResponse);case 405:throw new S(t.error.body,t.rawResponse);case 404:throw new R(t.error.body,t.rawResponse);default:throw new m({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/scim/ServiceProviderConfig.");case"unknown":throw new m({message:t.error.errorMessage,rawResponse:t.rawResponse})}}getResourceTypes(o){return k.fromPromise(this.__getResourceTypes(o))}async __getResourceTypes(o){var e,a,s,i,l,d,u,c;let h=x((e=this._options)==null?void 0:e.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=o?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=o?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(u=o?.xLangfusePublicKey)!=null?u:(d=this._options)==null?void 0:d.xLangfusePublicKey}),o?.headers),t=await T({url:L.join((c=await g.get(this._options.baseUrl))!=null?c:await g.get(this._options.environment),"/api/public/scim/ResourceTypes"),method:"GET",headers:h,queryParameters:o?.queryParams,timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new b(t.error.body,t.rawResponse);case 401:throw new y(t.error.body,t.rawResponse);case 403:throw new v(t.error.body,t.rawResponse);case 405:throw new S(t.error.body,t.rawResponse);case 404:throw new R(t.error.body,t.rawResponse);default:throw new m({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/scim/ResourceTypes.");case"unknown":throw new m({message:t.error.errorMessage,rawResponse:t.rawResponse})}}getSchemas(o){return k.fromPromise(this.__getSchemas(o))}async __getSchemas(o){var e,a,s,i,l,d,u,c;let h=x((e=this._options)==null?void 0:e.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(s=o?.xLangfuseSdkName)!=null?s:(a=this._options)==null?void 0:a.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(l=o?.xLangfuseSdkVersion)!=null?l:(i=this._options)==null?void 0:i.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(u=o?.xLangfusePublicKey)!=null?u:(d=this._options)==null?void 0:d.xLangfusePublicKey}),o?.headers),t=await T({url:L.join((c=await g.get(this._options.baseUrl))!=null?c:await g.get(this._options.environment),"/api/public/scim/Schemas"),method:"GET",headers:h,queryParameters:o?.queryParams,timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new b(t.error.body,t.rawResponse);case 401:throw new y(t.error.body,t.rawResponse);case 403:throw new v(t.error.body,t.rawResponse);case 405:throw new S(t.error.body,t.rawResponse);case 404:throw new R(t.error.body,t.rawResponse);default:throw new m({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/scim/Schemas.");case"unknown":throw new m({message:t.error.errorMessage,rawResponse:t.rawResponse})}}listUsers(o={},e){return k.fromPromise(this.__listUsers(o,e))}async __listUsers(o={},e){var a,s,i,l,d,u,c,h;let{filter:t,startIndex:r,count:n}=o,p={};t!=null&&(p.filter=t),r!=null&&(p.startIndex=r.toString()),n!=null&&(p.count=n.toString());let w=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),_=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/scim/Users"),method:"GET",headers:w,queryParameters:{...p,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(_.ok)return{data:_.body,rawResponse:_.rawResponse};if(_.error.reason==="status-code")switch(_.error.statusCode){case 400:throw new b(_.error.body,_.rawResponse);case 401:throw new y(_.error.body,_.rawResponse);case 403:throw new v(_.error.body,_.rawResponse);case 405:throw new S(_.error.body,_.rawResponse);case 404:throw new R(_.error.body,_.rawResponse);default:throw new m({statusCode:_.error.statusCode,body:_.error.body,rawResponse:_.rawResponse})}switch(_.error.reason){case"non-json":throw new m({statusCode:_.error.statusCode,body:_.error.rawBody,rawResponse:_.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/scim/Users.");case"unknown":throw new m({message:_.error.errorMessage,rawResponse:_.rawResponse})}}createUser(o,e){return k.fromPromise(this.__createUser(o,e))}async __createUser(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/scim/Users"),method:"POST",headers:t,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling POST /api/public/scim/Users.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getUser(o,e){return k.fromPromise(this.__getUser(o,e))}async __getUser(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/scim/Users/${encodeURIComponent(o)}`),method:"GET",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/scim/Users/{userId}.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteUser(o,e){return k.fromPromise(this.__deleteUser(o,e))}async __deleteUser(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/scim/Users/${encodeURIComponent(o)}`),method:"DELETE",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling DELETE /api/public/scim/Users/{userId}.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){let o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},Ks=class{constructor(o){this._options=o}create(o,e){return k.fromPromise(this.__create(o,e))}async __create(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/score-configs"),method:"POST",headers:t,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling POST /api/public/score-configs.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}get(o={},e){return k.fromPromise(this.__get(o,e))}async __get(o={},e){var a,s,i,l,d,u,c,h;let{page:t,limit:r}=o,n={};t!=null&&(n.page=t.toString()),r!=null&&(n.limit=r.toString());let p=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),w=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/score-configs"),method:"GET",headers:p,queryParameters:{...n,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(w.ok)return{data:w.body,rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new b(w.error.body,w.rawResponse);case 401:throw new y(w.error.body,w.rawResponse);case 403:throw new v(w.error.body,w.rawResponse);case 405:throw new S(w.error.body,w.rawResponse);case 404:throw new R(w.error.body,w.rawResponse);default:throw new m({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}switch(w.error.reason){case"non-json":throw new m({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/score-configs.");case"unknown":throw new m({message:w.error.errorMessage,rawResponse:w.rawResponse})}}getById(o,e){return k.fromPromise(this.__getById(o,e))}async __getById(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/score-configs/${encodeURIComponent(o)}`),method:"GET",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/score-configs/{configId}.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(o,e,a){return k.fromPromise(this.__update(o,e,a))}async __update(o,e,a){var s,i,l,d,u,c,h,t;let r=x((s=this._options)==null?void 0:s.headers,P({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":(u=a?.xLangfuseSdkVersion)!=null?u:(d=this._options)==null?void 0:d.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(h=a?.xLangfusePublicKey)!=null?h:(c=this._options)==null?void 0:c.xLangfusePublicKey}),a?.headers),n=await T({url:L.join((t=await g.get(this._options.baseUrl))!=null?t:await g.get(this._options.environment),`/api/public/score-configs/${encodeURIComponent(o)}`),method:"PATCH",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:e,timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.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 b(n.error.body,n.rawResponse);case 401:throw new y(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 E("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 o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},zs=class{constructor(o){this._options=o}getManyV3(o={},e){return k.fromPromise(this.__getManyV3(o,e))}async __getManyV3(o={},e){var a,s,i,l,d,u,c,h;let{limit:t,cursor:r,fields:n,id:p,name:w,source:_,dataType:f,environment:C,configId:I,queueId:M,authorUserId:B,value:X,valueMin:j,valueMax:N,traceId:H,sessionId:K,observationId:z,experimentId:oe,fromTimestamp:G,toTimestamp:fe}=o,V={};t!=null&&(V.limit=t.toString()),r!=null&&(V.cursor=r),n!=null&&(V.fields=n),p!=null&&(V.id=p),w!=null&&(V.name=w),_!=null&&(V.source=_),f!=null&&(V.dataType=f),C!=null&&(V.environment=C),I!=null&&(V.configId=I),M!=null&&(V.queueId=M),B!=null&&(V.authorUserId=B),X!=null&&(V.value=X),j!=null&&(V.valueMin=j.toString()),N!=null&&(V.valueMax=N.toString()),H!=null&&(V.traceId=H),K!=null&&(V.sessionId=K),z!=null&&(V.observationId=z),oe!=null&&(V.experimentId=oe),G!=null&&(V.fromTimestamp=G),fe!=null&&(V.toTimestamp=fe);let F=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),$=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/v3/scores"),method:"GET",headers:F,queryParameters:{...V,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if($.ok)return{data:$.body,rawResponse:$.rawResponse};if($.error.reason==="status-code")switch($.error.statusCode){case 400:throw new b($.error.body,$.rawResponse);case 401:throw new y($.error.body,$.rawResponse);case 403:throw new v($.error.body,$.rawResponse);case 405:throw new S($.error.body,$.rawResponse);case 404:throw new R($.error.body,$.rawResponse);default:throw new m({statusCode:$.error.statusCode,body:$.error.body,rawResponse:$.rawResponse})}switch($.error.reason){case"non-json":throw new m({statusCode:$.error.statusCode,body:$.error.rawBody,rawResponse:$.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/v3/scores.");case"unknown":throw new m({message:$.error.errorMessage,rawResponse:$.rawResponse})}}async _getAuthorizationHeader(){let o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},Bs=class{constructor(o){this._options=o}list(o={},e){return k.fromPromise(this.__list(o,e))}async __list(o={},e){var a,s,i,l,d,u,c,h;let{page:t,limit:r,fromTimestamp:n,toTimestamp:p,environment:w}=o,_={};t!=null&&(_.page=t.toString()),r!=null&&(_.limit=r.toString()),n!=null&&(_.fromTimestamp=n),p!=null&&(_.toTimestamp=p),w!=null&&(Array.isArray(w)?_.environment=w.map(I=>I):_.environment=w);let f=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),C=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/sessions"),method:"GET",headers:f,queryParameters:{..._,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(C.ok)return{data:C.body,rawResponse:C.rawResponse};if(C.error.reason==="status-code")switch(C.error.statusCode){case 400:throw new b(C.error.body,C.rawResponse);case 401:throw new y(C.error.body,C.rawResponse);case 403:throw new v(C.error.body,C.rawResponse);case 405:throw new S(C.error.body,C.rawResponse);case 404:throw new R(C.error.body,C.rawResponse);default:throw new m({statusCode:C.error.statusCode,body:C.error.body,rawResponse:C.rawResponse})}switch(C.error.reason){case"non-json":throw new m({statusCode:C.error.statusCode,body:C.error.rawBody,rawResponse:C.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/sessions.");case"unknown":throw new m({message:C.error.errorMessage,rawResponse:C.rawResponse})}}get(o,e){return k.fromPromise(this.__get(o,e))}async __get(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/sessions/${encodeURIComponent(o)}`),method:"GET",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/sessions/{sessionId}.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){let o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},Xs=class{constructor(o){this._options=o}get(o,e={},a){return k.fromPromise(this.__get(o,e,a))}async __get(o,e={},a){var s,i,l,d,u,c,h,t;let{fields:r}=e,n={};r!=null&&(n.fields=r);let p=x((s=this._options)==null?void 0:s.headers,P({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":(u=a?.xLangfuseSdkVersion)!=null?u:(d=this._options)==null?void 0:d.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(h=a?.xLangfusePublicKey)!=null?h:(c=this._options)==null?void 0:c.xLangfusePublicKey}),a?.headers),w=await T({url:L.join((t=await g.get(this._options.baseUrl))!=null?t:await g.get(this._options.environment),`/api/public/traces/${encodeURIComponent(o)}`),method:"GET",headers:p,queryParameters:{...n,...a?.queryParams},timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.abortSignal});if(w.ok)return{data:w.body,rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new b(w.error.body,w.rawResponse);case 401:throw new y(w.error.body,w.rawResponse);case 403:throw new v(w.error.body,w.rawResponse);case 405:throw new S(w.error.body,w.rawResponse);case 404:throw new R(w.error.body,w.rawResponse);default:throw new m({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}switch(w.error.reason){case"non-json":throw new m({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/traces/{traceId}.");case"unknown":throw new m({message:w.error.errorMessage,rawResponse:w.rawResponse})}}delete(o,e){return k.fromPromise(this.__delete(o,e))}async __delete(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/traces/${encodeURIComponent(o)}`),method:"DELETE",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling DELETE /api/public/traces/{traceId}.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}list(o={},e){return k.fromPromise(this.__list(o,e))}async __list(o={},e){var a,s,i,l,d,u,c,h;let{page:t,limit:r,userId:n,name:p,sessionId:w,fromTimestamp:_,toTimestamp:f,orderBy:C,tags:I,version:M,release:B,environment:X,fields:j,filter:N}=o,H={};t!=null&&(H.page=t.toString()),r!=null&&(H.limit=r.toString()),n!=null&&(H.userId=n),p!=null&&(H.name=p),w!=null&&(H.sessionId=w),_!=null&&(H.fromTimestamp=_),f!=null&&(H.toTimestamp=f),C!=null&&(H.orderBy=C),I!=null&&(Array.isArray(I)?H.tags=I.map(oe=>oe):H.tags=I),M!=null&&(H.version=M),B!=null&&(H.release=B),X!=null&&(Array.isArray(X)?H.environment=X.map(oe=>oe):H.environment=X),j!=null&&(H.fields=j),N!=null&&(H.filter=N);let K=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),z=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/traces"),method:"GET",headers:K,queryParameters:{...H,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(z.ok)return{data:z.body,rawResponse:z.rawResponse};if(z.error.reason==="status-code")switch(z.error.statusCode){case 400:throw new b(z.error.body,z.rawResponse);case 401:throw new y(z.error.body,z.rawResponse);case 403:throw new v(z.error.body,z.rawResponse);case 405:throw new S(z.error.body,z.rawResponse);case 404:throw new R(z.error.body,z.rawResponse);default:throw new m({statusCode:z.error.statusCode,body:z.error.body,rawResponse:z.rawResponse})}switch(z.error.reason){case"non-json":throw new m({statusCode:z.error.statusCode,body:z.error.rawBody,rawResponse:z.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/traces.");case"unknown":throw new m({message:z.error.errorMessage,rawResponse:z.rawResponse})}}deleteMultiple(o,e){return k.fromPromise(this.__deleteMultiple(o,e))}async __deleteMultiple(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/traces"),method:"DELETE",headers:t,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling DELETE /api/public/traces.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){let o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},Ds=class{constructor(o){this._options=o}list(o={},e){return k.fromPromise(this.__list(o,e))}async __list(o={},e){var a,s,i,l,d,u,c,h;let{page:t,limit:r}=o,n={};t!=null&&(n.page=t.toString()),r!=null&&(n.limit=r.toString());let p=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),w=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/unstable/dashboard-widgets"),method:"GET",headers:p,queryParameters:{...n,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(w.ok)return{data:w.body,rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new A.BadRequestError(w.error.body,w.rawResponse);case 401:throw new A.UnauthorizedError(w.error.body,w.rawResponse);case 403:throw new A.AccessDeniedError(w.error.body,w.rawResponse);case 405:throw new A.MethodNotAllowedError(w.error.body,w.rawResponse);case 429:throw new A.TooManyRequestsError(w.error.body,w.rawResponse);case 500:throw new A.InternalServerError(w.error.body,w.rawResponse);case 400:throw new b(w.error.body,w.rawResponse);case 401:throw new y(w.error.body,w.rawResponse);case 403:throw new v(w.error.body,w.rawResponse);case 405:throw new S(w.error.body,w.rawResponse);case 404:throw new R(w.error.body,w.rawResponse);default:throw new m({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}switch(w.error.reason){case"non-json":throw new m({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/unstable/dashboard-widgets.");case"unknown":throw new m({message:w.error.errorMessage,rawResponse:w.rawResponse})}}create(o,e){return k.fromPromise(this.__create(o,e))}async __create(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/unstable/dashboard-widgets"),method:"POST",headers:t,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new A.BadRequestError(r.error.body,r.rawResponse);case 401:throw new A.UnauthorizedError(r.error.body,r.rawResponse);case 403:throw new A.AccessDeniedError(r.error.body,r.rawResponse);case 405:throw new A.MethodNotAllowedError(r.error.body,r.rawResponse);case 429:throw new A.TooManyRequestsError(r.error.body,r.rawResponse);case 500:throw new A.InternalServerError(r.error.body,r.rawResponse);case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling POST /api/public/unstable/dashboard-widgets.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}get(o,e){return k.fromPromise(this.__get(o,e))}async __get(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/unstable/dashboard-widgets/${encodeURIComponent(o)}`),method:"GET",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new A.BadRequestError(r.error.body,r.rawResponse);case 401:throw new A.UnauthorizedError(r.error.body,r.rawResponse);case 403:throw new A.AccessDeniedError(r.error.body,r.rawResponse);case 404:throw new A.NotFoundError(r.error.body,r.rawResponse);case 405:throw new A.MethodNotAllowedError(r.error.body,r.rawResponse);case 429:throw new A.TooManyRequestsError(r.error.body,r.rawResponse);case 500:throw new A.InternalServerError(r.error.body,r.rawResponse);case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/unstable/dashboard-widgets/{widgetId}.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(o,e,a){return k.fromPromise(this.__update(o,e,a))}async __update(o,e,a){var s,i,l,d,u,c,h,t;let r=x((s=this._options)==null?void 0:s.headers,P({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":(u=a?.xLangfuseSdkVersion)!=null?u:(d=this._options)==null?void 0:d.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(h=a?.xLangfusePublicKey)!=null?h:(c=this._options)==null?void 0:c.xLangfusePublicKey}),a?.headers),n=await T({url:L.join((t=await g.get(this._options.baseUrl))!=null?t:await g.get(this._options.environment),`/api/public/unstable/dashboard-widgets/${encodeURIComponent(o)}`),method:"PATCH",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:e,timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.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 A.BadRequestError(n.error.body,n.rawResponse);case 401:throw new A.UnauthorizedError(n.error.body,n.rawResponse);case 403:throw new A.AccessDeniedError(n.error.body,n.rawResponse);case 404:throw new A.NotFoundError(n.error.body,n.rawResponse);case 405:throw new A.MethodNotAllowedError(n.error.body,n.rawResponse);case 429:throw new A.TooManyRequestsError(n.error.body,n.rawResponse);case 500:throw new A.InternalServerError(n.error.body,n.rawResponse);case 400:throw new b(n.error.body,n.rawResponse);case 401:throw new y(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 E("Timeout exceeded when calling PATCH /api/public/unstable/dashboard-widgets/{widgetId}.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}delete(o,e){return k.fromPromise(this.__delete(o,e))}async __delete(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/unstable/dashboard-widgets/${encodeURIComponent(o)}`),method:"DELETE",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new A.BadRequestError(r.error.body,r.rawResponse);case 401:throw new A.UnauthorizedError(r.error.body,r.rawResponse);case 403:throw new A.AccessDeniedError(r.error.body,r.rawResponse);case 404:throw new A.NotFoundError(r.error.body,r.rawResponse);case 405:throw new A.MethodNotAllowedError(r.error.body,r.rawResponse);case 409:throw new A.ConflictError(r.error.body,r.rawResponse);case 429:throw new A.TooManyRequestsError(r.error.body,r.rawResponse);case 500:throw new A.InternalServerError(r.error.body,r.rawResponse);case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling DELETE /api/public/unstable/dashboard-widgets/{widgetId}.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){let o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},Hs=class{constructor(o){this._options=o}list(o={},e){return k.fromPromise(this.__list(o,e))}async __list(o={},e){var a,s,i,l,d,u,c,h;let{page:t,limit:r}=o,n={};t!=null&&(n.page=t.toString()),r!=null&&(n.limit=r.toString());let p=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),w=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/unstable/dashboards"),method:"GET",headers:p,queryParameters:{...n,...e?.queryParams},timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(w.ok)return{data:w.body,rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 400:throw new A.BadRequestError(w.error.body,w.rawResponse);case 401:throw new A.UnauthorizedError(w.error.body,w.rawResponse);case 403:throw new A.AccessDeniedError(w.error.body,w.rawResponse);case 405:throw new A.MethodNotAllowedError(w.error.body,w.rawResponse);case 429:throw new A.TooManyRequestsError(w.error.body,w.rawResponse);case 500:throw new A.InternalServerError(w.error.body,w.rawResponse);case 400:throw new b(w.error.body,w.rawResponse);case 401:throw new y(w.error.body,w.rawResponse);case 403:throw new v(w.error.body,w.rawResponse);case 405:throw new S(w.error.body,w.rawResponse);case 404:throw new R(w.error.body,w.rawResponse);default:throw new m({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}switch(w.error.reason){case"non-json":throw new m({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/unstable/dashboards.");case"unknown":throw new m({message:w.error.errorMessage,rawResponse:w.rawResponse})}}create(o,e){return k.fromPromise(this.__create(o,e))}async __create(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),"/api/public/unstable/dashboards"),method:"POST",headers:t,contentType:"application/json",queryParameters:e?.queryParams,requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new A.BadRequestError(r.error.body,r.rawResponse);case 401:throw new A.UnauthorizedError(r.error.body,r.rawResponse);case 403:throw new A.AccessDeniedError(r.error.body,r.rawResponse);case 404:throw new A.NotFoundError(r.error.body,r.rawResponse);case 405:throw new A.MethodNotAllowedError(r.error.body,r.rawResponse);case 429:throw new A.TooManyRequestsError(r.error.body,r.rawResponse);case 500:throw new A.InternalServerError(r.error.body,r.rawResponse);case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling POST /api/public/unstable/dashboards.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}get(o,e){return k.fromPromise(this.__get(o,e))}async __get(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/unstable/dashboards/${encodeURIComponent(o)}`),method:"GET",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new A.BadRequestError(r.error.body,r.rawResponse);case 401:throw new A.UnauthorizedError(r.error.body,r.rawResponse);case 403:throw new A.AccessDeniedError(r.error.body,r.rawResponse);case 404:throw new A.NotFoundError(r.error.body,r.rawResponse);case 405:throw new A.MethodNotAllowedError(r.error.body,r.rawResponse);case 429:throw new A.TooManyRequestsError(r.error.body,r.rawResponse);case 500:throw new A.InternalServerError(r.error.body,r.rawResponse);case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling GET /api/public/unstable/dashboards/{dashboardId}.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(o,e,a){return k.fromPromise(this.__update(o,e,a))}async __update(o,e,a){var s,i,l,d,u,c,h,t;let r=x((s=this._options)==null?void 0:s.headers,P({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":(u=a?.xLangfuseSdkVersion)!=null?u:(d=this._options)==null?void 0:d.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(h=a?.xLangfusePublicKey)!=null?h:(c=this._options)==null?void 0:c.xLangfusePublicKey}),a?.headers),n=await T({url:L.join((t=await g.get(this._options.baseUrl))!=null?t:await g.get(this._options.environment),`/api/public/unstable/dashboards/${encodeURIComponent(o)}`),method:"PATCH",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:e,timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.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 A.BadRequestError(n.error.body,n.rawResponse);case 401:throw new A.UnauthorizedError(n.error.body,n.rawResponse);case 403:throw new A.AccessDeniedError(n.error.body,n.rawResponse);case 404:throw new A.NotFoundError(n.error.body,n.rawResponse);case 405:throw new A.MethodNotAllowedError(n.error.body,n.rawResponse);case 429:throw new A.TooManyRequestsError(n.error.body,n.rawResponse);case 500:throw new A.InternalServerError(n.error.body,n.rawResponse);case 400:throw new b(n.error.body,n.rawResponse);case 401:throw new y(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 E("Timeout exceeded when calling PATCH /api/public/unstable/dashboards/{dashboardId}.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}delete(o,e){return k.fromPromise(this.__delete(o,e))}async __delete(o,e){var a,s,i,l,d,u,c,h;let t=x((a=this._options)==null?void 0:a.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(i=e?.xLangfuseSdkName)!=null?i:(s=this._options)==null?void 0:s.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(d=e?.xLangfuseSdkVersion)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(c=e?.xLangfusePublicKey)!=null?c:(u=this._options)==null?void 0:u.xLangfusePublicKey}),e?.headers),r=await T({url:L.join((h=await g.get(this._options.baseUrl))!=null?h:await g.get(this._options.environment),`/api/public/unstable/dashboards/${encodeURIComponent(o)}`),method:"DELETE",headers:t,queryParameters:e?.queryParams,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new A.BadRequestError(r.error.body,r.rawResponse);case 401:throw new A.UnauthorizedError(r.error.body,r.rawResponse);case 403:throw new A.AccessDeniedError(r.error.body,r.rawResponse);case 404:throw new A.NotFoundError(r.error.body,r.rawResponse);case 405:throw new A.MethodNotAllowedError(r.error.body,r.rawResponse);case 429:throw new A.TooManyRequestsError(r.error.body,r.rawResponse);case 500:throw new A.InternalServerError(r.error.body,r.rawResponse);case 400:throw new b(r.error.body,r.rawResponse);case 401:throw new y(r.error.body,r.rawResponse);case 403:throw new v(r.error.body,r.rawResponse);case 405:throw new S(r.error.body,r.rawResponse);case 404:throw new R(r.error.body,r.rawResponse);default:throw new m({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new m({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new E("Timeout exceeded when calling DELETE /api/public/unstable/dashboards/{dashboardId}.");case"unknown":throw new m({message:r.error.errorMessage,rawResponse:r.rawResponse})}}addPlacement(o,e,a){return k.fromPromise(this.__addPlacement(o,e,a))}async __addPlacement(o,e,a){var s,i,l,d,u,c,h,t;let r=x((s=this._options)==null?void 0:s.headers,P({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":(u=a?.xLangfuseSdkVersion)!=null?u:(d=this._options)==null?void 0:d.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(h=a?.xLangfusePublicKey)!=null?h:(c=this._options)==null?void 0:c.xLangfusePublicKey}),a?.headers),n=await T({url:L.join((t=await g.get(this._options.baseUrl))!=null?t:await g.get(this._options.environment),`/api/public/unstable/dashboards/${encodeURIComponent(o)}/placements`),method:"POST",headers:r,contentType:"application/json",queryParameters:a?.queryParams,requestType:"json",body:e,timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.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 A.BadRequestError(n.error.body,n.rawResponse);case 401:throw new A.UnauthorizedError(n.error.body,n.rawResponse);case 403:throw new A.AccessDeniedError(n.error.body,n.rawResponse);case 404:throw new A.NotFoundError(n.error.body,n.rawResponse);case 405:throw new A.MethodNotAllowedError(n.error.body,n.rawResponse);case 409:throw new A.ConflictError(n.error.body,n.rawResponse);case 429:throw new A.TooManyRequestsError(n.error.body,n.rawResponse);case 500:throw new A.InternalServerError(n.error.body,n.rawResponse);case 400:throw new b(n.error.body,n.rawResponse);case 401:throw new y(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 E("Timeout exceeded when calling POST /api/public/unstable/dashboards/{dashboardId}/placements.");case"unknown":throw new m({message:n.error.errorMessage,rawResponse:n.rawResponse})}}updatePlacement(o,e,a,s){return k.fromPromise(this.__updatePlacement(o,e,a,s))}async __updatePlacement(o,e,a,s){var i,l,d,u,c,h,t,r;let n=x((i=this._options)==null?void 0:i.headers,P({Authorization:await this._getAuthorizationHeader(),"X-Langfuse-Sdk-Name":(d=s?.xLangfuseSdkName)!=null?d:(l=this._options)==null?void 0:l.xLangfuseSdkName,"X-Langfuse-Sdk-Version":(c=s?.xLangfuseSdkVersion)!=null?c:(u=this._options)==null?void 0:u.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(t=s?.xLangfusePublicKey)!=null?t:(h=this._options)==null?void 0:h.xLangfusePublicKey}),s?.headers),p=await T({url:L.join((r=await g.get(this._options.baseUrl))!=null?r:await g.get(this._options.environment),`/api/public/unstable/dashboards/${encodeURIComponent(o)}/placements/${encodeURIComponent(e)}`),method:"PATCH",headers:n,contentType:"application/json",queryParameters:s?.queryParams,requestType:"json",body:a,timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.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 A.BadRequestError(p.error.body,p.rawResponse);case 401:throw new A.UnauthorizedError(p.error.body,p.rawResponse);case 403:throw new A.AccessDeniedError(p.error.body,p.rawResponse);case 404:throw new A.NotFoundError(p.error.body,p.rawResponse);case 405:throw new A.MethodNotAllowedError(p.error.body,p.rawResponse);case 429:throw new A.TooManyRequestsError(p.error.body,p.rawResponse);case 500:throw new A.InternalServerError(p.error.body,p.rawResponse);case 400:throw new b(p.error.body,p.rawResponse);case 401:throw new y(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 E("Timeout exceeded when calling PATCH /api/public/unstable/dashboards/{dashboardId}/placements/{placementId}.");case"unknown":throw new m({message:p.error.errorMessage,rawResponse:p.rawResponse})}}deletePlacement(o,e,a){return k.fromPromise(this.__deletePlacement(o,e,a))}async __deletePlacement(o,e,a){var s,i,l,d,u,c,h,t;let r=x((s=this._options)==null?void 0:s.headers,P({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":(u=a?.xLangfuseSdkVersion)!=null?u:(d=this._options)==null?void 0:d.xLangfuseSdkVersion,"X-Langfuse-Public-Key":(h=a?.xLangfusePublicKey)!=null?h:(c=this._options)==null?void 0:c.xLangfusePublicKey}),a?.headers),n=await T({url:L.join((t=await g.get(this._options.baseUrl))!=null?t:await g.get(this._options.environment),`/api/public/unstable/dashboards/${encodeURIComponent(o)}/placements/${encodeURIComponent(e)}`),method:"DELETE",headers:r,queryParameters:a?.queryParams,timeoutMs:a?.timeoutInSeconds!=null?a.timeoutInSeconds*1e3:6e4,maxRetries:a?.maxRetries,abortSignal:a?.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 A.BadRequestError(n.error.body,n.rawResponse);case 401:throw new A.UnauthorizedError(n.error.body,n.rawResponse);case 403:throw new A.AccessDeniedError(n.error.body,n.rawResponse);case 404:throw new A.NotFoundError(n.error.body,n.rawResponse);case 405:throw new A.MethodNotAllowedError(n.error.body,n.rawResponse);case 429:throw new A.TooManyRequestsError(n.error.body,n.rawResponse);case 500:throw new A.InternalServerError(n.error.body,n.rawResponse);case 400:throw new b(n.error.body,n.rawResponse);case 401:throw new y(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 E("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 o=await g.get(this._options.username),e=await g.get(this._options.password);if(o!=null&&e!=null)return D.toAuthorizationHeader({username:o,password:e})}},Gs=class{constructor(o){this._options=o}get dashboardWidgets(){var o;return(o=this._dashboardWidgets)!=null?o:this._dashboardWidgets=new Ds(this._options)}get dashboards(){var o;return(o=this._dashboards)!=null?o:this._dashboards=new Hs(this._options)}},qo=class{constructor(o){this._options={...o,headers:x({"X-Langfuse-Sdk-Name":o?.xLangfuseSdkName,"X-Langfuse-Sdk-Version":o?.xLangfuseSdkVersion,"X-Langfuse-Public-Key":o?.xLangfusePublicKey},o?.headers)}}get annotationQueues(){var o;return(o=this._annotationQueues)!=null?o:this._annotationQueues=new cs(this._options)}get blobStorageIntegrations(){var o;return(o=this._blobStorageIntegrations)!=null?o:this._blobStorageIntegrations=new ws(this._options)}get comments(){var o;return(o=this._comments)!=null?o:this._comments=new hs(this._options)}get datasetItems(){var o;return(o=this._datasetItems)!=null?o:this._datasetItems=new ms(this._options)}get datasetRunItems(){var o;return(o=this._datasetRunItems)!=null?o:this._datasetRunItems=new gs(this._options)}get datasets(){var o;return(o=this._datasets)!=null?o:this._datasets=new ps(this._options)}get evaluationRules(){var o;return(o=this._evaluationRules)!=null?o:this._evaluationRules=new _s(this._options)}get evaluators(){var o;return(o=this._evaluators)!=null?o:this._evaluators=new fs(this._options)}get experiments(){var o;return(o=this._experiments)!=null?o:this._experiments=new bs(this._options)}get feedback(){var o;return(o=this._feedback)!=null?o:this._feedback=new ys(this._options)}get health(){var o;return(o=this._health)!=null?o:this._health=new vs(this._options)}get ingestion(){var o;return(o=this._ingestion)!=null?o:this._ingestion=new Rs(this._options)}get legacy(){var o;return(o=this._legacy)!=null?o:this._legacy=new Es(this._options)}get llmConnections(){var o;return(o=this._llmConnections)!=null?o:this._llmConnections=new Ps(this._options)}get media(){var o;return(o=this._media)!=null?o:this._media=new Ts(this._options)}get metrics(){var o;return(o=this._metrics)!=null?o:this._metrics=new ks(this._options)}get models(){var o;return(o=this._models)!=null?o:this._models=new Cs(this._options)}get observations(){var o;return(o=this._observations)!=null?o:this._observations=new As(this._options)}get opentelemetry(){var o;return(o=this._opentelemetry)!=null?o:this._opentelemetry=new Is(this._options)}get organizations(){var o;return(o=this._organizations)!=null?o:this._organizations=new Ns(this._options)}get projects(){var o;return(o=this._projects)!=null?o:this._projects=new Ms(this._options)}get promptVersion(){var o;return(o=this._promptVersion)!=null?o:this._promptVersion=new Vs(this._options)}get prompts(){var o;return(o=this._prompts)!=null?o:this._prompts=new js(this._options)}get scim(){var o;return(o=this._scim)!=null?o:this._scim=new Us(this._options)}get scoreConfigs(){var o;return(o=this._scoreConfigs)!=null?o:this._scoreConfigs=new Ks(this._options)}get scoresV3(){var o;return(o=this._scoresV3)!=null?o:this._scoresV3=new zs(this._options)}get scores(){var o;return(o=this._scores)!=null?o:this._scores=new Oo(this._options)}get sessions(){var o;return(o=this._sessions)!=null?o:this._sessions=new Bs(this._options)}get trace(){var o;return(o=this._trace)!=null?o:this._trace=new Xs(this._options)}get unstable(){var o;return(o=this._unstable)!=null?o:this._unstable=new Gs(this._options)}},gr=class{constructor(o){let{source:e}=o;if(this._source=e,e==="base64_data_uri"){let[a,s]=this.parseBase64DataUri(o.base64DataUri);this._contentBytes=a,this._contentType=s}else this._contentBytes=o.contentBytes,this._contentType=o.contentType}parseBase64DataUri(o){try{if(!o||typeof o!="string")throw new Error("Data URI is not a string");if(!o.startsWith("data:"))throw new Error("Data URI does not start with 'data:'");let[e,a]=o.slice(5).split(",",2);if(!e||!a)throw new Error("Invalid URI");let s=e.split(";");if(!s.includes("base64"))throw new Error("Data is not base64 encoded");let i=s[0];if(!i)throw new Error("Content type is empty");return[ur(a),i]}catch(e){return ee().error("Error parsing base64 data URI",e),[void 0,void 0]}}async getId(){let o=await this.getSha256Hash();return o?o.replaceAll("+","-").replaceAll("/","_").slice(0,22):null}get contentLength(){var o;return(o=this._contentBytes)==null?void 0:o.length}async getSha256Hash(){if(this._contentBytes)try{let o=await crypto.subtle.digest("SHA-256",this._contentBytes);return tr(new Uint8Array(o))}catch(o){ee().warn("[Langfuse] Failed to generate SHA-256 hash for media content:",o);return}}async getTag(){let o=await this.getId();return!this._contentType||!this._source||!o?null:`@@@langfuseMedia:type=${this._contentType}|id=${o}|source=${this._source}@@@`}get base64DataUri(){return this._contentBytes?`data:${this._contentType};base64,${tr(this._contentBytes)}`:null}toJSON(){return this.base64DataUri}};async function ea(o){var e;let{apiClient:a,media:s,traceId:i,observationId:l,datasetId:d,datasetItemId:u,field:c,maxRetries:h=3,baseDelay:t=1e3}=o,r=(e=o.logger)!=null?e:ee(),n=await s.getSha256Hash();if(!s.contentLength||!s._contentType||!n||!s._contentBytes)throw new Error("Cannot upload media: media content is incomplete.");let{uploadUrl:p,mediaId:w}=await a.media.getUploadUrl({contentLength:s.contentLength,traceId:i,observationId:l,datasetId:d,datasetItemId:u,field:c,contentType:s._contentType,sha256Hash:n});if(!p){r.debug(`Media status: Media with ID ${w} already uploaded. Skipping duplicate upload.`);return}let _=await s.getId();if(_!==w)throw new Error(`Media integrity error: Media ID mismatch between SDK (${_}) and Server (${w}). Upload cancelled.`);r.debug(`Uploading media ${w}...`);let f=Date.now(),C=await Fs({uploadUrl:p,contentBytes:s._contentBytes,contentType:s._contentType,contentSha256Hash:n,maxRetries:h,baseDelay:t});if(!C)throw new Error("Media upload process failed");let I=C.status===200||C.status===201;if(await a.media.patch(w,{uploadedAt:new Date().toISOString(),uploadHttpStatus:C.status,uploadHttpError:await C.text(),uploadTimeMs:Date.now()-f}),r.debug(`Media upload status reported for ${w}`),!I)throw new Error(`Media upload failed with HTTP ${C.status} after ${h} retries.`)}async function Fs(o){let{uploadUrl:e,contentType:a,contentSha256Hash:s,contentBytes:i,maxRetries:l,baseDelay:d}=o;for(let u=0;u<=l;u++)try{let c;try{c=new URL(e).hostname}catch{c=""}let t=c==="storage.googleapis.com"||c.endsWith(".storage.googleapis.com")?{"Content-Type":a}:{"Content-Type":a,"x-amz-checksum-sha256":s,"x-ms-blob-type":"BlockBlob"},r=await fetch(e,{method:"PUT",body:i,headers:t});if(u<l&&r.status!==200&&r.status!==201)throw new Error(`Upload failed with status ${r.status}`);return r}catch(c){if(u===l)throw c;let h=d*Math.pow(2,u),t=Math.random()*1e3;await new Promise(r=>setTimeout(r,h+t))}}var $s=["experimentId","experimentName","experimentMetadata","experimentDatasetId","experimentItemId","experimentItemMetadata","experimentItemRootObservationId"],de={userId:Z("langfuse_user_id"),sessionId:Z("langfuse_session_id"),metadata:Z("langfuse_metadata"),version:Z("langfuse_version"),tags:Z("langfuse_tags"),traceName:Z("langfuse_trace_name"),environment:Z("langfuse_environment"),promptName:Z("langfuse_prompt_name"),promptVersion:Z("langfuse_prompt_version"),experimentId:Z("langfuse_experiment_id"),experimentName:Z("langfuse_experiment_name"),experimentMetadata:Z("langfuse_experiment_metadata"),experimentDatasetId:Z("langfuse_experiment_dataset_id"),experimentItemId:Z("langfuse_experiment_item_id"),experimentItemMetadata:Z("langfuse_experiment_item_metadata"),experimentItemRootObservationId:Z("langfuse_experiment_item_root_observation_id")},J="langfuse_",Ws=",",ra="langfuse_trace_id";function oa(o){let e=or.getBaggage(o),a=e?.getEntry(ra);if(a?.value)return a.value.toLowerCase()}function aa(o){let e={},a=or.getBaggage(o);a&&a.getAllEntries().forEach(([n,p])=>{if(n!==ra&&n.startsWith(J)){let w=Js(n);if(w){if(w==="langfuse.environment"){Or(p.value)&&(e[w]=p.value);return}if(w==="langfuse.observation.prompt.version"&&/^\d+$/.test(p.value)){e[w]=Number(p.value);return}let _=n==Ys("tags");e[w]=_?p.value.split(Ws):p.value}}});let s=o.getValue(de.userId);if(s&&typeof s=="string"){let n=Q("userId");e[n]=s}let i=o.getValue(de.sessionId);if(i&&typeof i=="string"){let n=Q("sessionId");e[n]=i}let l=o.getValue(de.version);if(l&&typeof l=="string"){let n=Q("version");e[n]=l}let d=o.getValue(de.traceName);if(d&&typeof d=="string"){let n=Q("traceName");e[n]=d}let u=o.getValue(de.environment);Or(u)&&(e["langfuse.environment"]=u);let c=o.getValue(de.tags);if(c&&Array.isArray(c)){let n=Q("tags");e[n]=c}let h=o.getValue(de.promptName);if(h&&typeof h=="string"){let n=Q("promptName");e[n]=h}let t=o.getValue(de.promptVersion);if(typeof t=="number"){let n=Q("promptVersion");e[n]=t}let r=o.getValue(de.metadata);if(r&&typeof r=="object"&&r!==null)for(let[n,p]of Object.entries(r)){let w=`langfuse.trace.metadata.${n}`;e[w]=String(p)}for(let n of $s){let p=de[n],w=o.getValue(p);if(w&&typeof w=="string"){let _=Q(n);e[_]=w}}return e[Q("experimentItemRootObservationId")]&&(e["langfuse.environment"]=La),e}var Qs=/^(?!langfuse)[a-z0-9_-]+$/;function Or(o){let e=ee();return typeof o!="string"?(o!==void 0&&e.warn("Propagated attribute 'environment' must be a string. Dropping value."),!1):o.length>40?(e.warn(`Propagated attribute 'environment' value is over 40 characters (${o.length} chars). Dropping value.`),!1):Qs.test(o)?!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 Q(o){switch(o){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",o)}}function Ys(o){switch(o){case"userId":return`${J}user_id`;case"sessionId":return`${J}session_id`;case"version":return`${J}version`;case"traceName":return`${J}trace_name`;case"environment":return`${J}environment`;case"metadata":return`${J}metadata`;case"tags":return`${J}tags`;case"promptName":return`${J}prompt_name`;case"promptVersion":return`${J}prompt_version`;case"experimentId":return`${J}experiment_id`;case"experimentName":return`${J}experiment_name`;case"experimentMetadata":return`${J}experiment_metadata`;case"experimentDatasetId":return`${J}experiment_dataset_id`;case"experimentItemId":return`${J}experiment_item_id`;case"experimentItemMetadata":return`${J}experiment_item_metadata`;case"experimentItemRootObservationId":return`${J}experiment_item_root_observation_id`;default:throw Error("Unhandled propagated key",o)}}function Js(o){if(!o.startsWith(J))return;let e=o.slice(J.length);if(e.startsWith("metadata_"))return`langfuse.trace.metadata.${e.slice(9)}`;switch(e){case"user_id":return Q("userId");case"session_id":return Q("sessionId");case"version":return Q("version");case"trace_name":return Q("traceName");case"environment":return Q("environment");case"tags":return Q("tags");case"prompt_name":return Q("promptName");case"prompt_version":return Q("promptVersion");case"experiment_id":return Q("experimentId");case"experiment_name":return Q("experimentName");case"experiment_metadata":return Q("experimentMetadata");case"experiment_dataset_id":return Q("experimentDatasetId");case"experiment_item_id":return Q("experimentItemId");case"experiment_item_metadata":return Q("experimentItemMetadata");case"experiment_item_root_observation_id":return Q("experimentItemRootObservationId")}}ye();var Zs=class{constructor(o){this.pendingMediaUploads=new Set,this.apiClient=o.apiClient}get logger(){return ee()}async flush(){await Promise.all(Array.from(this.pendingMediaUploads))}async process(o){var e;let a=[U.OBSERVATION_INPUT,U.TRACE_INPUT,U.OBSERVATION_OUTPUT,U.TRACE_OUTPUT,U.OBSERVATION_METADATA,U.TRACE_METADATA];for(let s of a){let i=Object.keys(o.attributes).filter(l=>l.startsWith(s));for(let l of i){let d=o.attributes[l];if(typeof d!="string"){this.logger.warn(`Span attribute ${s} is not a stringified object. Skipping media handling.`);continue}let u=d,c=/data:[^;]+;base64,[A-Za-z0-9+/]+=*/g,h=[...new Set((e=d.match(c))!=null?e:[])];if(h.length!==0){for(let t of h){let r=new gr({base64DataUri:t,source:"base64_data_uri"}),n=await r.getTag();if(!n){this.logger.warn("Failed to create Langfuse media tag. Skipping media item.");continue}this.scheduleUpload({span:o,media:r,field:s.includes("input")?"input":s.includes("output")?"output":"metadata"}),u=u.replaceAll(t,n)}o.attributes[l]=u}}}if(["ai","gen_ai"].includes(o.instrumentationScope.name)){let s=["ai.prompt.messages","ai.prompt"];for(let l of s){let d=o.attributes[l];if(!d||typeof d!="string")continue;let u=d;try{let c=JSON.parse(d);if(Array.isArray(c)){for(let h of c)if(Array.isArray(h.content)){let t=h.content;for(let r of t)if(r.type==="file"){let n=null,p=r.mediaType;if(typeof r.data=="string"&&!r.data.startsWith("http")&&(n=r.data),typeof r.image=="string"&&!r.image.startsWith("http")&&(n=r.image),!n||typeof p!="string")continue;u=await this.replaceBytesMedia({span:o,mediaReplacedValue:u,base64Content:n,contentType:p,field:"input"})}}}o.attributes[l]=u}catch(c){this.logger.warn(`Failed to handle media for AI SDK attribute ${l} for span ${o.spanContext().spanId}`,c)}}let i=[{attribute:"gen_ai.input.messages",field:"input"},{attribute:"gen_ai.output.messages",field:"output"}];for(let{attribute:l,field:d}of i){let u=o.attributes[l];if(!u||typeof u!="string")continue;let c=u;try{let h=JSON.parse(u);if(Array.isArray(h)){for(let t of h)if(Array.isArray(t.parts))for(let r of t.parts){let n=r.content,p=r.mime_type;if(r.type!=="blob"||typeof n!="string"||!n||typeof p!="string"||n.startsWith("http"))continue;let w=Os(n);w&&(c=await this.replaceBytesMedia({span:o,mediaReplacedValue:c,base64Content:w.base64Content,contentToReplace:n,contentType:p,field:d}))}}o.attributes[l]=c}catch(h){this.logger.warn(`Failed to handle media for AI SDK v7 attribute ${l} for span ${o.spanContext().spanId}`,h)}}}}async replaceBytesMedia(o){var e;let a=new gr({contentType:o.contentType,contentBytes:ur(o.base64Content),source:"bytes"}),s=await a.getTag();return s?(this.scheduleUpload({span:o.span,media:a,field:o.field}),o.mediaReplacedValue.replaceAll((e=o.contentToReplace)!=null?e:o.base64Content,s)):(this.logger.warn("Failed to create Langfuse media tag. Skipping media item."),o.mediaReplacedValue)}scheduleUpload(o){let{span:e,field:a,media:s}=o,i=this.handleUpload({media:s,traceId:e.spanContext().traceId,observationId:e.spanContext().spanId,field:a}).catch(l=>{this.logger.error("Media upload failed with error: ",l)});this.pendingMediaUploads.add(i),i.finally(()=>{this.pendingMediaUploads.delete(i)})}async handleUpload({media:o,traceId:e,observationId:a,field:s}){try{await ea({apiClient:this.apiClient,media:o,traceId:e,observationId:a,field:s,logger:this.logger})}catch(i){this.logger.error(`Error processing media item: ${i}`)}}};function Os(o){if(!o.startsWith("data:"))return{base64Content:o};let e=o.indexOf(";base64,");if(e===-1)return;let a=o.slice(e+8);if(a)return{base64Content:a}}var qs=[Ee,"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"],et=new Set(["ai"]);function rt(o){return o.instrumentationScope.name===Ee}function ot(o){return Object.keys(o.attributes).some(e=>e.startsWith("gen_ai."))}function at(o){let e=o.instrumentationScope.name;return qs.some(a=>e===a||!et.has(a)&&e.startsWith(`${a}.`))}function nt(o){return rt(o)||ot(o)||at(o)}var na=class{constructor(o){this.pendingEndedSpans=new Set,this.spanExportExpectationById=new Map;var e,a,s,i,l,d,u,c,h,t,r,n,p,w;let _=ee(),f=(e=o?.publicKey)!=null?e:q("LANGFUSE_PUBLIC_KEY"),C=(a=o?.secretKey)!=null?a:q("LANGFUSE_SECRET_KEY"),I=(l=(i=(s=o?.baseUrl)!=null?s:q("LANGFUSE_BASE_URL"))!=null?i:q("LANGFUSE_BASEURL"))!=null?l:"https://cloud.langfuse.com";!o?.exporter&&!f&&_.warn("No exporter configured and no public key provided in constructor or as LANGFUSE_PUBLIC_KEY env var. Span exports will fail."),!o?.exporter&&!C&&_.warn("No exporter configured and no secret key provided in constructor or as LANGFUSE_SECRET_KEY env var. Span exports will fail.");let M=(d=o?.flushAt)!=null?d:q("LANGFUSE_FLUSH_AT"),B=(u=o?.flushInterval)!=null?u:q("LANGFUSE_FLUSH_INTERVAL"),X=qr(`${f}:${C}`),j=(h=o?.timeout)!=null?h:Number((c=q("LANGFUSE_TIMEOUT"))!=null?c:5),N=q("LANGFUSE_MEDIA_UPLOAD_ENABLED"),H=(t=o?.mediaUploadEnabled)!=null?t:N?!["false","0"].includes(N.toLowerCase()):!0,K=(r=o?.exporter)!=null?r:new Xr({url:`${I}/api/public/otel/v1/traces`,headers:{Authorization:`Basic ${X}`,"x-langfuse-sdk-name":"javascript","x-langfuse-sdk-version":Pe,"x-langfuse-public-key":f??"<missing>",...o?.additionalHeaders},timeoutMillis:j*1e3});this.processor=o?.exportMode==="immediate"?new Gr(K):new Le(K,{maxExportBatchSize:M?Number(M):void 0,scheduledDelayMillis:B?Number(B)*1e3:void 0}),this.publicKey=f,this.baseUrl=I,this.environment=(n=o?.environment)!=null?n:q("LANGFUSE_TRACING_ENVIRONMENT"),this.release=(p=o?.release)!=null?p:q("LANGFUSE_RELEASE"),this.mask=o?.mask,this.shouldExportSpan=(w=o?.shouldExportSpan)!=null?w:({otelSpan:z})=>nt(z),this.mediaUploadEnabled=H,this.apiClient=new qo({baseUrl:this.baseUrl,username:this.publicKey,password:C,xLangfusePublicKey:this.publicKey,xLangfuseSdkVersion:Pe,xLangfuseSdkName:"javascript",environment:"",headers:o?.additionalHeaders}),this.mediaService=new Zs({apiClient:this.apiClient}),_.debug("Initialized LangfuseSpanProcessor with params:",{publicKey:f,baseUrl:I,environment:this.environment,release:this.release,timeoutSeconds:j,flushAt:M,flushIntervalSeconds:B,mediaUploadEnabled:H})}get logger(){return ee()}onStart(o,e){let a=aa(e);o.attributes[U.OBSERVATION_PROMPT_NAME]!=null&&(delete a[U.OBSERVATION_PROMPT_NAME],delete a[U.OBSERVATION_PROMPT_VERSION]),o.setAttributes({[U.ENVIRONMENT]:this.environment,[U.RELEASE]:this.release,...a});try{this.markAppRootCandidate(o,e)}catch(s){this.logger.debug("App-root start-time check failed. Span will not be marked as app root.",{spanName:o.name},s)}return this.processor.onStart(o,e)}onEnd(o){this.spanExportExpectationById.delete(o.spanContext().spanId);let e=this.processEndedSpan(o).catch(a=>{this.logger.error(a)});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(o){var e,a;try{if(this.shouldExportSpan({otelSpan:o})===!1){this.logger.debug("Dropped span due to shouldExportSpan filter.",{spanName:o.name,instrumentationScope:o.instrumentationScope.name});return}}catch(s){this.logger.error("shouldExportSpan failed with error. Dropping span.",{spanName:o.name,instrumentationScope:o.instrumentationScope.name},s);return}await this.applyMaskInPlace(o),this.mediaUploadEnabled&&await this.mediaService.process(o),this.logger.isLevelEnabled(cr.DEBUG)&&this.logger.debug(`Processed span:
6
+ ${JSON.stringify({name:o.name,traceId:o.spanContext().traceId,spanId:o.spanContext().spanId,parentSpanId:(a=(e=o.parentSpanContext)==null?void 0:e.spanId)!=null?a:null,attributes:o.attributes,startTime:new Date(Me(o.startTime)),endTime:new Date(Me(o.endTime)),durationMs:Me(o.duration),kind:o.kind,status:o.status,resource:o.resource.attributes,instrumentationScope:o.instrumentationScope},null,2)}`),this.processor.onEnd(o)}markAppRootCandidate(o,e){var a;let s=o.spanContext().traceId,i=o.spanContext().spanId,l=(a=o.parentSpanContext)==null?void 0:a.spanId,d=this.isExpectedExportedAtStart(o),u=oa(e),c=l!==void 0?this.spanExportExpectationById.get(l)===!0:!1,h=u===s;this.spanExportExpectationById.set(i,d),d&&!c&&!h&&o.setAttribute(U.IS_APP_ROOT,!0)}isExpectedExportedAtStart(o){let e=o;try{return this.shouldExportSpan({otelSpan:e})===!0}catch(a){return this.logger.debug("shouldExportSpan threw during app-root start-time check. Span will not be marked as app root.",{spanName:o.name,instrumentationScope:e.instrumentationScope.name},a),!1}}async applyMaskInPlace(o){let e=[U.OBSERVATION_INPUT,U.TRACE_INPUT,U.OBSERVATION_OUTPUT,U.TRACE_OUTPUT,U.OBSERVATION_METADATA,U.TRACE_METADATA];for(let a of e)a in o.attributes&&(o.attributes[a]=await this.applyMask(o.attributes[a]))}async applyMask(o){if(!this.mask)return o;try{return await this.mask({data:o})}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>"}}};le();le();function st({input:o,output:e}={}){let a={[U.TRACE_INPUT]:ue(o),[U.TRACE_OUTPUT]:ue(e)};return Object.fromEntries(Object.entries(a).filter(([s,i])=>i!=null))}function sa(o,e){let{metadata:a,input:s,output:i,level:l,statusMessage:d,version:u,environment:c,completionStartTime:h,model:t,modelParameters:r,usageDetails:n,costDetails:p,prompt:w}=e,_={[U.OBSERVATION_TYPE]:o,[U.OBSERVATION_LEVEL]:l,[U.OBSERVATION_STATUS_MESSAGE]:d,[U.VERSION]:u,[U.ENVIRONMENT]:c,[U.OBSERVATION_INPUT]:ue(s),[U.OBSERVATION_OUTPUT]:ue(i),[U.OBSERVATION_MODEL]:t,[U.OBSERVATION_USAGE_DETAILS]:ue(n),[U.OBSERVATION_COST_DETAILS]:ue(p),[U.OBSERVATION_COMPLETION_START_TIME]:ue(h),[U.OBSERVATION_MODEL_PARAMETERS]:ue(r),...w&&!w.isFallback?{[U.OBSERVATION_PROMPT_NAME]:w.name,[U.OBSERVATION_PROMPT_VERSION]:w.version}:{},...tt(a,"observation")};return Object.fromEntries(Object.entries(_).filter(([f,C])=>C!=null))}function ue(o){try{return typeof o=="string"?o:o!=null?JSON.stringify(o):void 0}catch{return"<failed to serialize>"}}function tt(o,e){let a=e==="observation"?U.OBSERVATION_METADATA:U.TRACE_METADATA,s={};if(o==null)return s;if(typeof o!="object"||Array.isArray(o)){let i=ue(o);i&&(s[a]=i)}else for(let[i,l]of Object.entries(o)){let d=typeof l=="string"?l:ue(l);d&&(s[`${a}.${i}`]=d)}return s}var pr=Symbol.for("langfuse");function it(){return{isolatedTracerProvider:null}}function ta(){let o=it();try{let e=globalThis;return typeof e!="object"||e===null?(ee().warn("globalThis is not available, using fallback state"),o):(e[pr]||Object.defineProperty(e,pr,{value:o,writable:!1,configurable:!1,enumerable:!1}),e[pr])}catch(e){return e instanceof Error?ee().error(`Failed to access global state: ${e.message}`):ee().error(`Failed to access global state: ${String(e)}`),o}}function _r(o){ta().isolatedTracerProvider=o}function lt(){let{isolatedTracerProvider:o}=ta();return o||he.getTracerProvider()}function ia(){return lt().getTracer(Ee,Pe)}var ce=class{constructor(o){var e;this.otelSpan=o.otelSpan,this.id=o.otelSpan.spanContext().spanId,this.traceId=o.otelSpan.spanContext().traceId,this.type=o.type,this.otelSpan.setAttributes(sa(o.type,(e=o.attributes)!=null?e:{}))}get tracer(){return ia()}end(o){this.otelSpan.end(o)}updateOtelSpanAttributes(o){this.otelSpan.setAttributes(sa(this.type,o))}setTraceIO(o){return this.otelSpan.setAttributes(st(o)),this}setTraceAsPublic(){return this.otelSpan.setAttributes({[U.TRACE_PUBLIC]:!0}),this}startObservation(o,e,a){let{asType:s="span"}=a||{};return Te(o,e,{asType:s,parentSpanContext:this.otelSpan.spanContext()})}},dt=class extends ce{constructor(o){super({...o,type:"span"})}update(o){return super.updateOtelSpanAttributes(o),this}},ut=class extends ce{constructor(o){super({...o,type:"agent"})}update(o){return super.updateOtelSpanAttributes(o),this}},ct=class extends ce{constructor(o){super({...o,type:"tool"})}update(o){return super.updateOtelSpanAttributes(o),this}},wt=class extends ce{constructor(o){super({...o,type:"chain"})}update(o){return super.updateOtelSpanAttributes(o),this}},ht=class extends ce{constructor(o){super({...o,type:"retriever"})}update(o){return super.updateOtelSpanAttributes(o),this}},mt=class extends ce{constructor(o){super({...o,type:"evaluator"})}update(o){return super.updateOtelSpanAttributes(o),this}},gt=class extends ce{constructor(o){super({...o,type:"guardrail"})}update(o){return super.updateOtelSpanAttributes(o),this}},pt=class extends ce{constructor(o){super({...o,type:"generation"})}update(o){return this.updateOtelSpanAttributes(o),this}},_t=class extends ce{constructor(o){super({...o,type:"embedding"})}update(o){return this.updateOtelSpanAttributes(o),this}},ft=class extends ce{constructor(o){super({...o,type:"event"}),this.otelSpan.end(o.timestamp)}};function bt(o){return ia().startSpan(o.name,{startTime:o.startTime},yt(o.parentSpanContext))}function yt(o){if(o)return he.setSpanContext(we.active(),o)}function Te(o,e,a){var s;let{asType:i="span",...l}=a||{},d=bt({name:o,...l});switch(i){case"generation":return new pt({otelSpan:d,attributes:e});case"embedding":return new _t({otelSpan:d,attributes:e});case"agent":return new ut({otelSpan:d,attributes:e});case"tool":return new ct({otelSpan:d,attributes:e});case"chain":return new wt({otelSpan:d,attributes:e});case"retriever":return new ht({otelSpan:d,attributes:e});case"evaluator":return new mt({otelSpan:d,attributes:e});case"guardrail":return new gt({otelSpan:d,attributes:e});case"event":{let u=(s=l?.startTime)!=null?s:new Date;return new ft({otelSpan:d,attributes:e,timestamp:u})}default:return new dt({otelSpan:d,attributes:e})}}le();Ue();zr();le();Ue();zr();ye();Ue();le();le();ye();Ar();le();function vt(o){return fr(o,new WeakSet)}function fr(o,e){if(o==null||typeof o=="string"||typeof o=="number"||typeof o=="boolean"||o instanceof Uint8Array)return!0;if(typeof o=="object"){if(e.has(o))return!1;if(e.add(o),Array.isArray(o)){for(let s of o)if(!fr(s,e))return!1;return!0}let a=o;if(a.constructor!==Object&&a.constructor!==void 0)return!1;for(let s in a)if(Object.prototype.hasOwnProperty.call(a,s)&&!fr(a[s],e))return!1;return!0}return!1}var re;(function(o){o[o.DROP_INVALID=0]="DROP_INVALID",o[o.DROP_LIMIT_REACHED=1]="DROP_LIMIT_REACHED",o[o.ADD_NEW=2]="ADD_NEW",o[o.ADD_OVERWRITE_EXISTING=3]="ADD_OVERWRITE_EXISTING"})(re||(re={}));function yr(o,e,a,s,i){if(s.length===0)return O.warn(`Invalid attribute key: ${s}`),re.DROP_INVALID;if(!vt(i))return O.warn(`Invalid attribute value set for key: ${s}`),re.DROP_INVALID;let l=!Object.prototype.hasOwnProperty.call(o,s);return l&&a>=e.attributeCountLimit?re.DROP_LIMIT_REACHED:(o[s]=br(i,e.attributeValueLengthLimit),l?re.ADD_NEW:re.ADD_OVERWRITE_EXISTING)}function br(o,e){if(e<=0)return O.warn(`Attribute value limit must be positive, got ${e}`),o;if(o==null)return o;if(typeof o=="string")return o.length<=e?o:o.substring(0,e);if(o instanceof Uint8Array)return o;if(Array.isArray(o))return o.map(a=>br(a,e));if(typeof o=="object"){let a={};for(let[s,i]of Object.entries(o))a[s]=br(i,e);return a}return o}function la(o,e){if(e==null)return{};let a={},s=0,i=0;for(let[l,d]of Object.entries(e)){let u=yr(a,o,s,l,d);u===re.ADD_NEW?s+=1:(u===re.DROP_INVALID||u===re.DROP_LIMIT_REACHED)&&(i+=1)}return{attributes:s>0?a:void 0,droppedAttributesCount:i}}var Xe=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,a,s){let{timestamp:i,observedTimestamp:l,eventName:d,severityNumber:u,severityText:c,body:h,attributes:t={},exception:r,context:n}=s,p=Date.now();if(this._hrTime=sr(i??p),this._hrTimeObserved=sr(l??p),n){let w=he.getSpanContext(n);w&&Ie(w)&&(this._spanContext=w)}this.severityNumber=u,this.severityText=c,this.body=h,this.resource=e.resource,this.instrumentationScope=a,this._logRecordLimits=e.logRecordLimits,this._eventName=d,this.setAttributes(t),r!=null&&this._setException(r)}setAttribute(e,a){if(this._isLogRecordReadonly())return this;let s=yr(this.attributes,this._logRecordLimits,this._attributesCount,e,a);return s===re.DROP_LIMIT_REACHED?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&O.warn("Dropping extra attributes.")):s===re.ADD_NEW&&this._attributesCount++,this}setAttributes(e){for(let[a,s]of Object.entries(e))this.setAttribute(a,s);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 a=!1;if(typeof e=="string"||typeof e=="number")Object.hasOwn(this.attributes,Se)||this.setAttribute(Se,String(e)),a=!0;else if(e&&typeof e=="object"){let s=e;s.code?(Object.hasOwn(this.attributes,xe)||this.setAttribute(xe,s.code.toString()),a=!0):s.name&&(Object.hasOwn(this.attributes,xe)||this.setAttribute(xe,s.name),a=!0),s.message&&(Object.hasOwn(this.attributes,Se)||this.setAttribute(Se,s.message),a=!0),s.stack&&(Object.hasOwn(this.attributes,ar)||this.setAttribute(ar,s.stack),a=!0)}a||O.warn(`Failed to record an exception ${e}`)}_isLogRecordReadonly(){return this._isReadonly&&O.warn("Can not execute the operation on emitted log record"),this._isReadonly}};var De=class{_instrumentationScope;_sharedState;_loggerConfig;constructor(e,a){this._instrumentationScope=e,this._sharedState=a,this._loggerConfig=this._sharedState.getLoggerConfig(this._instrumentationScope)}emit(e){let a=e.context||we.active();if(!this.enabled(e))return;let s=new Xe(this._sharedState,this._instrumentationScope,{context:a,...e});this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(s,a),s._makeReadonly()}enabled(e){if(this._sharedState.hasShutdown)return!1;let a=this._loggerConfig;if(a.disabled)return!1;let s=e?.severityNumber;if(typeof s=="number"&&s!==pe.UNSPECIFIED&&s<a.minimumSeverity)return!1;let i=e?.context||we.active();if(a.traceBased){let d=he.getSpanContext(i);if(d&&Ie(d)&&!((d.traceFlags&er.SAMPLED)===er.SAMPLED))return!1}let l={context:i,instrumentationScope:this._instrumentationScope,severityNumber:e?.severityNumber,eventName:e?.eventName};for(let d of this._sharedState.processors)if(!d.enabled||d.enabled(l))return!0;return!1}};le();Ue();var He=class{forceFlush(){return Promise.resolve()}onEmit(e,a){}shutdown(){return Promise.resolve()}enabled(e){return!1}};ye();var Ge=class{processors;constructor(e){this.processors=e}async forceFlush(e){let a=e?.timeoutMillis??3e4;await Promise.all(this.processors.map(s=>Nr(s.forceFlush(),a)))}onEmit(e,a){this.processors.forEach(s=>s.onEmit(e,a))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}enabled(e){for(let a of this.processors)if(!a.enabled||a.enabled(e))return!0;return!1}};function vr(o){if(o===void 0)return["u",null];if(o===null)return["n",null];let e=typeof o;return e==="string"?["s",o]:e==="boolean"?["b",o]:e==="number"?Number.isNaN(o)?["nan",null]:o===1/0?["inf",null]:o===-1/0?["-inf",null]:Object.is(o,-0)?["n0",null]:["d",o]:o instanceof Uint8Array?["bytes",Array.from(o)]:Array.isArray(o)?["arr",o.map(vr)]:["map",Object.entries(o).sort(([a],[s])=>a.localeCompare(s)).map(([a,s])=>[a,vr(s)])]}function Fe(o){return JSON.stringify([o.name,o.version||"",o.schemaUrl||"",vr(o.attributes),o.droppedAttributesCount??0])}var da="otel.sdk.log.created",ua="otel.sdk.processor.log.processed",ca="otel.sdk.processor.log.queue.capacity",wa="otel.sdk.processor.log.queue.size",ha="otel.component.name",ma="otel.component.type",ga="batching_log_processor";var Rr="error.type";var $e=class{createdLogs;constructor(e){this.createdLogs=e.createCounter(da,{unit:"{log_record}",description:"The number of logs submitted to enabled SDK Loggers."})}emitLog(){this.createdLogs.add(1)}};var pa="0.222.0";var Rt={disabled:!1,minimumSeverity:pe.UNSPECIFIED,traceBased:!1},Sr=()=>({...Rt}),We=class{loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];resource;logRecordLimits;processors;loggerMetrics;hasShutdown=!1;_loggerConfigurator;_loggerConfigs=new Map;constructor(e,a,s,i,l){this.resource=e,this.logRecordLimits=a,this.processors=s,s.length>0?(this.registeredLogRecordProcessors=s,this.activeProcessor=new Ge(this.registeredLogRecordProcessors)):this.activeProcessor=new He,this._loggerConfigurator=i??Sr;let d=l?l.getMeter("@opentelemetry/sdk-logs",pa):Ae();this.loggerMetrics=new $e(d)}getLoggerConfig(e){let a=Fe(e),s=this._loggerConfigs.get(a);return s||(s=this._loggerConfigurator(e),this._loggerConfigs.set(a,s),s)}};var St="unknown",ke=class{_shutdownOnce;_sharedState;constructor(e={}){let a={resource:e.resource??Kr(),logRecordLimits:{attributeCountLimit:e.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:e.loggerConfigurator??Sr,processors:e.processors??[],meterProvider:e.meterProvider};this._sharedState=new We(a.resource,a.logRecordLimits,a.processors,a.loggerConfigurator,a.meterProvider),this._shutdownOnce=new je(this._shutdown,this)}getLogger(e,a,s){if(this._shutdownOnce.isCalled)return O.warn("A shutdown LoggerProvider cannot provide a Logger"),Mr();e||O.warn("Logger requested without instrumentation scope name.");let l={name:e||St,version:a,schemaUrl:s?.schemaUrl,...la(this._sharedState.logRecordLimits,s?.attributes)},d=Fe(l);return this._sharedState.loggers.has(d)||this._sharedState.loggers.set(d,new De(l,this._sharedState)),this._sharedState.loggers.get(d)}forceFlush(e){return this._shutdownOnce.isCalled?(O.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush(e)}shutdown(){return this._shutdownOnce.isCalled?(O.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()}};ye();var Ce=class{export(e,a){this._sendLogRecords(e,a)}async forceFlush(){}async shutdown(){}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:Ir(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,a){for(let s of e)console.dir(this._exportInfo(s),{depth:3});a?.({code:Ve.SUCCESS})}};var _a=new Map,Qe=class{processedLogs;queueSize;queueSizeCallback;standardAttrs;droppedAttrs;constructor(e,a,s){let i=_a.get(e)??0;if(_a.set(e,i+1),this.standardAttrs={[ma]:e,[ha]:`${e}/${i}`},this.droppedAttrs={...this.standardAttrs,[Rr]:"queue_full"},this.processedLogs=a.createCounter(ua,{unit:"{log_record}",description:"The number of log records for which the processing has finished, either successful or failed."}),s){let{capacity:l,getQueueSize:d}=s;a.createUpDownCounter(ca,{unit:"{log_record}",description:"The maximum number of log records the queue of a given instance of an SDK log processor can hold."}).add(l,this.standardAttrs),this.queueSize=a.createObservableUpDownCounter(wa,{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(d(),this.standardAttrs),this.queueSize.addCallback(this.queueSizeCallback)}}dropLogs(e){this.processedLogs.add(e,this.droppedAttrs)}finishLogs(e,a){if(!a){this.processedLogs.add(e,this.standardAttrs);return}let s={...this.standardAttrs,[Rr]:a.name};this.processedLogs.add(e,s)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}};le();ye();async function xt(o){let e=[];for(let a=0,s=o.length;a<s;a++){let i=o[a];i.resource.asyncAttributesPending&&i.resource.waitForAsyncAttributes&&e.push(i.resource.waitForAsyncAttributes())}e!=null&&e.length>0&&await Promise.all(e)}var Ye=class{_exportCompleted;_exportScheduledPromise;_metrics;_exportScheduledResolve;constructor(e,a,s,i){this._exportScheduledPromise=new Promise(l=>{this._exportScheduledResolve=l}),this._exportCompleted=this._executeExport(e,a,s),this._metrics=i}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}async _executeExport(e,a,s){try{await xt(a),await we.with(kr(we.active()),async()=>this._exportWithTimeout(e,a,s))}catch(i){Ne(i),this._exportScheduledResolve()}}async _exportWithTimeout(e,a,s){return new Promise((i,l)=>{let d=setTimeout(()=>{l(new Error("Timeout"))},s);e.export(a,u=>{this._metrics.finishLogs(a.length,u.error),clearTimeout(d),u.code===Ve.SUCCESS?i():l(u.error??new Error("BatchLogRecordProcessor: log record export failed"))}),this._exportScheduledResolve()})}},Je=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 je(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(O.warn("BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize);let a=e?.selfObsMeterProvider?e.selfObsMeterProvider.getMeter("@opentelemetry/sdk-logs"):Ae();this._metrics=new Qe(ga,a,{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 a=this._currentExport;for(a!==null&&(await this._exporter.forceFlush(),await a.exportCompleted,this._currentExport=null);e.length>0;){let s;e.length<=this._maxExportBatchSize?(s=e,e=[]):s=e.splice(0,this._maxExportBatchSize);let i=new Ye(this._exporter,s,this._exportTimeoutMillis,this._metrics);this._currentExport=i;try{await i.exportScheduled,await this._exporter.forceFlush(),await i.exportCompleted}catch(l){Ne(l)}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 a=new Ye(this._exporter,e,this._exportTimeoutMillis,this._metrics);this._currentExport=a,a.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(s=>{this._currentExport=null,Ne(s),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 be=class extends Je{onShutdown(){}};ya();Ar();import{readFileSync as Lt}from"fs";import fa from"path";import{fileURLToPath as Et}from"url";var Pt=qe.object({version:qe.string()});function Tt(){return"0.0.1"}var Re=Tt();var kt=6e4,xr=2e3;function Pr(o){return(o??"").split(",").map(e=>e.trim()).filter(e=>e.length>0&&e!=="none")}function Ct(o,e){let a=Number.parseInt(o??"",10);return Number.isFinite(a)&&a>0?a:e}function Tr(o){let e=`OTEL_EXPORTER_OTLP_${o.toUpperCase()}_PROTOCOL`,s=process.env[e]?.trim()||process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim()||"http/protobuf";if(s==="grpc"||s==="http/json"||s==="http/protobuf")return s;throw new Error(`Unsupported OpenTelemetry protocol: ${s}`)}function At(o){let e={};for(let a of o?.split(",")??[]){let s=a.indexOf("=");if(s<=0)continue;let i=a.slice(0,s).trim(),l=a.slice(s+1).trim();if(i&&l)try{e[decodeURIComponent(i)]=decodeURIComponent(l)}catch{e[i]=l}}return e}function It(){return Ur({[nr]:"yukino",[Cr]:Re,...At(process.env.OTEL_RESOURCE_ATTRIBUTES),...process.env.OTEL_SERVICE_NAME?{[nr]:process.env.OTEL_SERVICE_NAME}:{}})}async function Nt(o){switch(o){case"grpc":{let{OTLPTraceExporter:e}=await import("./src-R4BSSIJJ.js");return new e}case"http/json":{let{OTLPTraceExporter:e}=await import("./esm-DIYJ5HX6.js");return new e}case"http/protobuf":{let{OTLPTraceExporter:e}=await import("./esm-RPR2GBJ2.js");return new e}}}async function Mt(o){switch(o){case"grpc":{let{OTLPLogExporter:e}=await import("./src-X6JWWHHT.js");return new e}case"http/json":{let{OTLPLogExporter:e}=await import("./esm-6L5BJ5GT.js");return new e}case"http/protobuf":{let{OTLPLogExporter:e}=await import("./esm-YKAO4ES6.js");return new e}}}async function Vt(o){switch(o){case"grpc":{let{OTLPMetricExporter:e}=await import("./src-JBRNH4FA.js");return new e}case"http/json":{let{OTLPMetricExporter:e}=await import("./esm-HW2JMFYC.js");return new e}case"http/protobuf":{let{OTLPMetricExporter:e}=await import("./esm-57CJEGGK.js");return new e}}}async function jt(o){let e=[],a=Pr(process.env.OTEL_TRACES_EXPORTER);for(let i of a)if(i==="console")e.push(new Le(new Dr));else if(i==="otlp")e.push(new Le(await Nt(Tr("traces"))));else throw new Error(`Unsupported trace exporter: ${i}`);if(process.env.LANGFUSE_PUBLIC_KEY&&process.env.LANGFUSE_SECRET_KEY&&e.push(new na({mediaUploadEnabled:!1,release:process.env.LANGFUSE_RELEASE??Re})),e.length===0)return null;let s=new Hr({resource:o,spanProcessors:e});return _r(s),s}async function Ut(o){let e=[];for(let a of Pr(process.env.OTEL_LOGS_EXPORTER)){let s;if(a==="console")s=new Ce;else if(a==="otlp")s=await Mt(Tr("logs"));else throw new Error(`Unsupported log exporter: ${a}`);e.push(new be({exporter:s}))}return e.length>0?new ke({resource:o,processors:e}):null}async function Kt(){let o=[],e=Ct(process.env.OTEL_METRIC_EXPORT_INTERVAL,kt);for(let a of Pr(process.env.OTEL_METRICS_EXPORTER)){if(a==="prometheus"){let{PrometheusExporter:i}=await import("./src-43CPCEK2.js");o.push(new i);continue}let s;if(a==="console")s=new jr;else if(a==="otlp")s=await Vt(Tr("metrics"));else throw new Error(`Unsupported metric exporter: ${a}`);o.push(new Vr({exporter:s,exportIntervalMillis:e}))}return o}async function zt(){if(!process.env.SENTRY_DSN)return null;let o=await import("./esm-ZTIYTMTS.js");return o.init({debug:process.env.SENTRY_DEBUG?.toLowerCase()==="true",dsn:process.env.SENTRY_DSN,environment:process.env.SENTRY_ENVIRONMENT,includeLocalVariables:!1,integrations:e=>e.filter(a=>a.name!=="OnUncaughtException"&&a.name!=="OnUnhandledRejection"),registerEsmLoaderHooks:!1,release:process.env.SENTRY_RELEASE??Re,sendDefaultPii:!1,skipOpenTelemetrySetup:!0,tracesSampleRate:0}),o}async function Ze(o){try{return await o()}catch{return null}}function ba(o){return new Promise(e=>{let a=setTimeout(e,xr);a.unref(),o.then(()=>{clearTimeout(a),e()},()=>{clearTimeout(a),e()})})}function Bt(o){switch(o){case"error":return pe.ERROR;case"info":return pe.INFO;case"warn":return pe.WARN}}function Xt(o,e,a){switch(o){case"agent":return Te(e,{metadata:a},{asType:"agent"});case"generation":{let s=typeof a.model=="string"?a.model:void 0;return Te(e,{metadata:a,model:s},{asType:"generation"})}case"tool":return Te(e,{metadata:a},{asType:"tool"})}}function Dt(o,e,a,s){switch(e){case"agent":return o.startObservation(a,{metadata:s},{asType:"agent"});case"generation":{let i=typeof s.model=="string"?s.model:void 0;return o.startObservation(a,{metadata:s,model:i},{asType:"generation"})}case"tool":return o.startObservation(a,{metadata:s},{asType:"tool"})}}var Lr=class o{constructor(e){this.observation=e}observation;end(){this.observation.end()}recordException(e){let a=e instanceof Error?e.name:typeof e;this.observation.otelSpan.setAttribute("error.type",a),this.observation.otelSpan.setStatus({code:rr.ERROR}),this.observation.updateOtelSpanAttributes({level:"ERROR",statusMessage:a})}startChild(e,a,s={}){return new o(Dt(this.observation,e,a,s))}update(e){this.observation.updateOtelSpanAttributes(e)}},Er=class{constructor(e,a,s,i,l,d){this.tracerProvider=e;this.loggerProvider=a;this.meterProvider=s;this.meter=i;this.logger=l;this.sentry=d}tracerProvider;loggerProvider;meterProvider;meter;logger;sentry;counters=new Map;histograms=new Map;mode="unknown";captureError(e,a){this.sentry?.captureException(e,{tags:{context:a,mode:this.mode}}),this.emitLog("yukino.error","error",{context:a,"error.type":e instanceof Error?e.name:typeof e})}emitLog(e,a,s={}){this.logger?.emit({attributes:{...s,"yukino.mode":this.mode},body:e,severityNumber:Bt(a),severityText:a.toUpperCase()})}async flush(){let e=[];this.tracerProvider&&e.push(this.tracerProvider.forceFlush()),this.loggerProvider&&e.push(this.loggerProvider.forceFlush()),this.meterProvider&&e.push(this.meterProvider.forceFlush()),this.sentry&&e.push(this.sentry.flush(xr)),await ba(Promise.allSettled(e).then(()=>{}))}recordMetric(e,a,s,i={}){if(!this.meter)return;let l={...i,"yukino.mode":this.mode};if(a==="counter"){let u=this.counters.get(e);u||(u=this.meter.createCounter(e),this.counters.set(e,u)),u.add(s,l);return}let d=this.histograms.get(e);d||(d=this.meter.createHistogram(e,{unit:"ms"}),this.histograms.set(e,d)),d.record(s,l)}setMode(e){this.mode=e,this.sentry?.setTag("yukino.mode",e)}async shutdown(){let e=[];this.tracerProvider&&e.push(this.tracerProvider.shutdown()),this.loggerProvider&&e.push(this.loggerProvider.shutdown()),this.meterProvider&&e.push(this.meterProvider.shutdown()),this.sentry&&e.push(this.sentry.close(xr)),await ba(Promise.allSettled(e).then(()=>{})),_r(null)}startObservation(e,a,s={}){return this.tracerProvider?new Lr(Xt(e,a,{...s,"yukino.mode":this.mode})):{end:()=>{},recordException:()=>{},startChild:(i,l,d)=>this.startObservation(i,l,d),update:()=>{}}}};async function _d(){let o=It(),e=process.env.OTEL_SDK_DISABLED?.toLowerCase()!=="true",[a,s,i,l]=await Promise.all([e?Ze(()=>jt(o)):Promise.resolve(null),e?Ze(()=>Ut(o)):Promise.resolve(null),e?Ze(Kt):Promise.resolve(null),Ze(zt)]),d=i&&i.length>0?new Br({readers:i,resource:o}):null,u=d?.getMeter("@yukino.js/yukino",Re)??null,c=s?.getLogger("@yukino.js/yukino",Re)??null;return new Er(a,s,d,u,c,l)}export{Re as a,Pr as b,_d as c};