opik 1.6.13 → 1.6.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Client-CgkZJ_1L.d.cts → Client-BFXzOx36.d.cts} +133 -39
- package/dist/{Client-CgkZJ_1L.d.ts → Client-BFXzOx36.d.ts} +133 -39
- package/dist/{Node18UniversalStreamWrapper-4W3MJAHL.js → Node18UniversalStreamWrapper-GZXI7BSF.js} +1 -1
- package/dist/{NodePre18StreamWrapper-6SHOOALU.js → NodePre18StreamWrapper-TZYQXHQT.js} +1 -1
- package/dist/{UndiciStreamWrapper-MDO66TBH.js → UndiciStreamWrapper-4QYH36IP.js} +1 -1
- package/dist/chunk-37E5PSYD.js +4 -0
- package/dist/chunk-WOT6VMZA.js +1 -0
- package/dist/index.cjs +4 -4
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/vercel/index.cjs +4 -4
- package/dist/vercel/index.d.cts +1 -1
- package/dist/vercel/index.d.ts +1 -1
- package/dist/vercel/index.js +1 -1
- package/package.json +1 -7
- package/dist/chunk-5TBO732O.js +0 -1
- package/dist/chunk-OKUDNHYJ.js +0 -4
- package/dist/langchain/index.cjs +0 -19
- package/dist/langchain/index.d.cts +0 -55
- package/dist/langchain/index.d.ts +0 -55
- package/dist/langchain/index.js +0 -17
package/dist/langchain/index.cjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use strict';var ansiEscapes=require('ansi-escapes'),tslog=require('tslog'),xr=require('uuid'),Tl=require('fs'),sf=require('ini'),Yf=require('qs'),async_hooks=require('async_hooks');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var xr__namespace=/*#__PURE__*/_interopNamespace(xr);var Tl__default=/*#__PURE__*/_interopDefault(Tl);var sf__default=/*#__PURE__*/_interopDefault(sf);var Yf__default=/*#__PURE__*/_interopDefault(Yf);var Dd=Object.create;var qo=Object.defineProperty;var Od=Object.getOwnPropertyDescriptor;var Ld=Object.getOwnPropertyNames;var Bd=Object.getPrototypeOf,$d=Object.prototype.hasOwnProperty;var ea=(a,r)=>()=>(a&&(r=a(a=0)),r);var A=(a,r)=>()=>(r||a((r={exports:{}}).exports,r),r.exports),$=(a,r)=>{for(var e in r)qo(a,e,{get:r[e],enumerable:true});},Vd=(a,r,e,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of Ld(r))!$d.call(a,o)&&o!==e&&qo(a,o,{get:()=>r[o],enumerable:!(t=Od(r,o))||t.enumerable});return a};var je=(a,r,e)=>(e=a!=null?Dd(Bd(a)):{},Vd(qo(e,"default",{value:a,enumerable:true}),a));var fl=A((r_,dl)=>{dl.exports=function(a,r){if(typeof a!="string")throw new TypeError("Expected a string");return r=typeof r=="undefined"?"_":r,a.replace(/([a-z\d])([A-Z])/g,"$1"+r+"$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g,"$1"+r+"$2").toLowerCase()};});var Sl=A((t_,ra)=>{var Xd=/[\p{Lu}]/u,Gd=/[\p{Ll}]/u,hl=/^[\p{Lu}](?![\p{Lu}])/gu,wl=/([\p{Alpha}\p{N}_]|$)/u,yl=/[_.\- ]+/,Hd=new RegExp("^"+yl.source),gl=new RegExp(yl.source+wl.source,"gu"),bl=new RegExp("\\d+"+wl.source,"gu"),Yd=(a,r,e)=>{let t=false,o=false,n=false;for(let s=0;s<a.length;s++){let c=a[s];t&&Xd.test(c)?(a=a.slice(0,s)+"-"+a.slice(s),t=false,n=o,o=true,s++):o&&n&&Gd.test(c)?(a=a.slice(0,s-1)+"-"+a.slice(s-1),n=o,o=false,t=true):(t=r(c)===c&&e(c)!==c,n=o,o=e(c)===c&&r(c)!==c);}return a},Zd=(a,r)=>(hl.lastIndex=0,a.replace(hl,e=>r(e))),Qd=(a,r)=>(gl.lastIndex=0,bl.lastIndex=0,a.replace(gl,(e,t)=>r(t)).replace(bl,e=>r(e))),_l=(a,r)=>{if(!(typeof a=="string"||Array.isArray(a)))throw new TypeError("Expected the input to be `string | string[]`");if(r={pascalCase:false,preserveConsecutiveUppercase:false,...r},Array.isArray(a)?a=a.map(n=>n.trim()).filter(n=>n.length).join("-"):a=a.trim(),a.length===0)return "";let e=r.locale===false?n=>n.toLowerCase():n=>n.toLocaleLowerCase(r.locale),t=r.locale===false?n=>n.toUpperCase():n=>n.toLocaleUpperCase(r.locale);return a.length===1?r.pascalCase?t(a):e(a):(a!==e(a)&&(a=Yd(a,e,t)),a=a.replace(Hd,""),r.preserveConsecutiveUppercase?a=Zd(a,e):a=e(a),r.pascalCase&&(a=t(a.charAt(0))+a.slice(1)),Qd(a,t))};ra.exports=_l;ra.exports.default=_l;});var Gl={};$(Gl,{Node18UniversalStreamWrapper:()=>ha});var ha,Hl=ea(()=>{ha=class a{constructor(r){this.readableStream=r,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=false,this.resumeCallback=null,this.encoding=null;}on(r,e){var t;(t=this.events[r])==null||t.push(e);}off(r,e){var t;this.events[r]=(t=this.events[r])==null?void 0:t.filter(o=>o!==e);}pipe(r){return this.on("data",async e=>{if(r instanceof a)r._write(e);else if(r instanceof WritableStream){let t=r.getWriter();t.write(e).then(()=>t.releaseLock());}else r.write(e);}),this.on("end",async()=>{r instanceof a?r._end():r instanceof WritableStream?r.getWriter().close():r.end();}),this.on("error",async e=>{r instanceof a?r._error(e):r instanceof WritableStream?r.getWriter().abort(e):r.destroy(e);}),this._startReading(),r}pipeTo(r){return this.pipe(r)}unpipe(r){this.off("data",async e=>{if(r instanceof a)r._write(e);else if(r instanceof WritableStream){let t=r.getWriter();t.write(e).then(()=>t.releaseLock());}else r.write(e);}),this.off("end",async()=>{r instanceof a?r._end():r instanceof WritableStream?r.getWriter().close():r.end();}),this.off("error",async e=>{r instanceof a?r._error(e):r instanceof WritableStream?r.getWriter().abort(e):r.destroy(e);});}destroy(r){this.reader.cancel(r).then(()=>{this._emit("close");}).catch(e=>{this._emit("error",e);});}pause(){this.paused=true,this._emit("pause");}resume(){this.paused&&(this.paused=false,this._emit("resume"),this.resumeCallback&&(this.resumeCallback(),this.resumeCallback=null));}get isPaused(){return this.paused}async read(){this.paused&&await new Promise(t=>{this.resumeCallback=t;});let{done:r,value:e}=await this.reader.read();if(!r)return e}setEncoding(r){this.encoding=r;}async text(){let r=[];for(;;){let{done:t,value:o}=await this.reader.read();if(t)break;o&&r.push(o);}return new TextDecoder(this.encoding||"utf-8").decode(await new Blob(r).arrayBuffer())}async json(){let r=await this.text();return JSON.parse(r)}_write(r){this._emit("data",r);}_end(){this._emit("end");}_error(r){this._emit("error",r);}_emit(r,e){if(this.events[r])for(let t of this.events[r]||[])t(e);}async _startReading(){try{for(this._emit("readable");;){this.paused&&await new Promise(t=>{this.resumeCallback=t;});let{done:r,value:e}=await this.reader.read();if(r){this._emit("end"),this._emit("close");break}e&&this._emit("data",e);}}catch(r){this._emit("error",r);}}[Symbol.asyncIterator](){return {next:async()=>{this.paused&&await new Promise(t=>{this.resumeCallback=t;});let{done:r,value:e}=await this.reader.read();return r?{done:true,value:void 0}:{done:false,value:e}},[Symbol.asyncIterator](){return this}}}};});var Yl={};$(Yl,{UndiciStreamWrapper:()=>ga});var ga,Zl=ea(()=>{ga=class a{constructor(r){this.readableStream=r,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=false,this.resumeCallback=null,this.encoding=null;}on(r,e){var t;(t=this.events[r])==null||t.push(e);}off(r,e){var t;this.events[r]=(t=this.events[r])==null?void 0:t.filter(o=>o!==e);}pipe(r){return this.on("data",e=>{if(r instanceof a)r._write(e);else {let t=r.getWriter();t.write(e).then(()=>t.releaseLock());}}),this.on("end",()=>{r instanceof a?r._end():r.getWriter().close();}),this.on("error",e=>{r instanceof a?r._error(e):r.getWriter().abort(e);}),this._startReading(),r}pipeTo(r){return this.pipe(r)}unpipe(r){this.off("data",e=>{if(r instanceof a)r._write(e);else {let t=r.getWriter();t.write(e).then(()=>t.releaseLock());}}),this.off("end",()=>{r instanceof a?r._end():r.getWriter().close();}),this.off("error",e=>{r instanceof a?r._error(e):r.getWriter().abort(e);});}destroy(r){this.reader.cancel(r).then(()=>{this._emit("close");}).catch(e=>{this._emit("error",e);});}pause(){this.paused=true,this._emit("pause");}resume(){this.paused&&(this.paused=false,this._emit("resume"),this.resumeCallback&&(this.resumeCallback(),this.resumeCallback=null));}get isPaused(){return this.paused}async read(){this.paused&&await new Promise(t=>{this.resumeCallback=t;});let{done:r,value:e}=await this.reader.read();if(!r)return e}setEncoding(r){this.encoding=r;}async text(){let r=[];for(;;){let{done:t,value:o}=await this.reader.read();if(t)break;o&&r.push(o);}return new TextDecoder(this.encoding||"utf-8").decode(await new Blob(r).arrayBuffer())}async json(){let r=await this.text();return JSON.parse(r)}_write(r){this._emit("data",r);}_end(){this._emit("end");}_error(r){this._emit("error",r);}_emit(r,e){if(this.events[r])for(let t of this.events[r]||[])t(e);}async _startReading(){try{for(this._emit("readable");;){this.paused&&await new Promise(t=>{this.resumeCallback=t;});let{done:r,value:e}=await this.reader.read();if(r){this._emit("end"),this._emit("close");break}e&&this._emit("data",e);}}catch(r){this._emit("error",r);}}[Symbol.asyncIterator](){return {next:async()=>{this.paused&&await new Promise(t=>{this.resumeCallback=t;});let{done:r,value:e}=await this.reader.read();return r?{done:true,value:void 0}:{done:false,value:e}},[Symbol.asyncIterator](){return this}}}};});var Ql={};$(Ql,{NodePre18StreamWrapper:()=>ba});var ba,ql=ea(()=>{ba=class{constructor(r){this.readableStream=r;}on(r,e){this.readableStream.on(r,e);}off(r,e){this.readableStream.off(r,e);}pipe(r){return this.readableStream.pipe(r),r}pipeTo(r){return this.pipe(r)}unpipe(r){r?this.readableStream.unpipe(r):this.readableStream.unpipe();}destroy(r){this.readableStream.destroy(r);}pause(){this.readableStream.pause();}resume(){this.readableStream.resume();}get isPaused(){return this.readableStream.isPaused()}async read(){return new Promise((r,e)=>{let t=this.readableStream.read();t?r(t):(this.readableStream.once("readable",()=>{let o=this.readableStream.read();r(o);}),this.readableStream.once("error",e));})}setEncoding(r){this.readableStream.setEncoding(r),this.encoding=r;}async text(){let r=[],e=new TextEncoder;this.readableStream.setEncoding(this.encoding||"utf-8");for await(let o of this.readableStream)r.push(e.encode(o));return new TextDecoder(this.encoding||"utf-8").decode(Buffer.concat(r))}async json(){let r=await this.text();return JSON.parse(r)}[Symbol.asyncIterator](){let e=this.readableStream[Symbol.asyncIterator]();return {async next(){let{value:t,done:o}=await e.next();return {value:t,done:o}},[Symbol.asyncIterator](){return this}}}};});var Gp=A((XK,Xp)=>{function Re(a,r){typeof r=="boolean"&&(r={forever:r}),this._originalTimeouts=JSON.parse(JSON.stringify(a)),this._timeouts=a,this._options=r||{},this._maxRetryTime=r&&r.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0));}Xp.exports=Re;Re.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0);};Re.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null;};Re.prototype.retry=function(a){if(this._timeout&&clearTimeout(this._timeout),!a)return false;var r=new Date().getTime();if(a&&r-this._operationStart>=this._maxRetryTime)return this._errors.push(a),this._errors.unshift(new Error("RetryOperation timeout occurred")),false;this._errors.push(a);var e=this._timeouts.shift();if(e===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),e=this._cachedTimeouts.slice(-1);else return false;var t=this;return this._timer=setTimeout(function(){t._attempts++,t._operationTimeoutCb&&(t._timeout=setTimeout(function(){t._operationTimeoutCb(t._attempts);},t._operationTimeout),t._options.unref&&t._timeout.unref()),t._fn(t._attempts);},e),this._options.unref&&this._timer.unref(),true};Re.prototype.attempt=function(a,r){this._fn=a,r&&(r.timeout&&(this._operationTimeout=r.timeout),r.cb&&(this._operationTimeoutCb=r.cb));var e=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){e._operationTimeoutCb();},e._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts);};Re.prototype.try=function(a){console.log("Using RetryOperation.try() is deprecated"),this.attempt(a);};Re.prototype.start=function(a){console.log("Using RetryOperation.start() is deprecated"),this.attempt(a);};Re.prototype.start=Re.prototype.try;Re.prototype.errors=function(){return this._errors};Re.prototype.attempts=function(){return this._attempts};Re.prototype.mainError=function(){if(this._errors.length===0)return null;for(var a={},r=null,e=0,t=0;t<this._errors.length;t++){var o=this._errors[t],n=o.message,s=(a[n]||0)+1;a[n]=s,s>=e&&(r=o,e=s);}return r};});var Hp=A(or=>{var Jh=Gp();or.operation=function(a){var r=or.timeouts(a);return new Jh(r,{forever:a&&(a.forever||a.retries===1/0),unref:a&&a.unref,maxRetryTime:a&&a.maxRetryTime})};or.timeouts=function(a){if(a instanceof Array)return [].concat(a);var r={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:false};for(var e in a)r[e]=a[e];if(r.minTimeout>r.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var t=[],o=0;o<r.retries;o++)t.push(this.createTimeout(o,r));return a&&a.forever&&!t.length&&t.push(this.createTimeout(o,r)),t.sort(function(n,s){return n-s}),t};or.createTimeout=function(a,r){var e=r.randomize?Math.random()+1:1,t=Math.round(e*Math.max(r.minTimeout,1)*Math.pow(r.factor,a));return t=Math.min(t,r.maxTimeout),t};or.wrap=function(a,r,e){if(r instanceof Array&&(e=r,r=null),!e){e=[];for(var t in a)typeof a[t]=="function"&&e.push(t);}for(var o=0;o<e.length;o++){var n=e[o],s=a[n];a[n]=function(l){var u=or.operation(r),d=Array.prototype.slice.call(arguments,1),h=d.pop();d.push(function(b){u.retry(b)||(b&&(arguments[0]=u.mainError()),h.apply(this,arguments));}),u.attempt(function(){l.apply(a,d);});}.bind(a,s),a[n].options=r;}};});var Zp=A((HK,Yp)=>{Yp.exports=Hp();});var wo=A((YK,bo)=>{var Wh=Zp(),Kh=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"],go=class extends Error{constructor(r){super(),r instanceof Error?(this.originalError=r,{message:r}=r):(this.originalError=new Error(r),this.originalError.stack=this.stack),this.name="AbortError",this.message=r;}},Xh=(a,r,e)=>{let t=e.retries-(r-1);return a.attemptNumber=r,a.retriesLeft=t,a},Gh=a=>Kh.includes(a),Qp=(a,r)=>new Promise((e,t)=>{r={onFailedAttempt:()=>{},retries:10,...r};let o=Wh.operation(r);o.attempt(async n=>{try{e(await a(n));}catch(s){if(!(s instanceof Error)){t(new TypeError(`Non-error was thrown: "${s}". You should only throw errors.`));return}if(s instanceof go)o.stop(),t(s.originalError);else if(s instanceof TypeError&&!Gh(s.message))o.stop(),t(s);else {Xh(s,n,r);try{await r.onFailedAttempt(s);}catch(c){t(c);return}o.retry(s)||t(o.mainError());}}});});bo.exports=Qp;bo.exports.default=Qp;bo.exports.AbortError=go;});var eu=A((ZK,hc)=>{var Hh=Object.prototype.hasOwnProperty,le="~";function Gt(){}Object.create&&(Gt.prototype=Object.create(null),new Gt().__proto__||(le=false));function Yh(a,r,e){this.fn=a,this.context=r,this.once=e||false;}function qp(a,r,e,t,o){if(typeof e!="function")throw new TypeError("The listener must be a function");var n=new Yh(e,t||a,o),s=le?le+r:r;return a._events[s]?a._events[s].fn?a._events[s]=[a._events[s],n]:a._events[s].push(n):(a._events[s]=n,a._eventsCount++),a}function yo(a,r){--a._eventsCount===0?a._events=new Gt:delete a._events[r];}function se(){this._events=new Gt,this._eventsCount=0;}se.prototype.eventNames=function(){var r=[],e,t;if(this._eventsCount===0)return r;for(t in e=this._events)Hh.call(e,t)&&r.push(le?t.slice(1):t);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r};se.prototype.listeners=function(r){var e=le?le+r:r,t=this._events[e];if(!t)return [];if(t.fn)return [t.fn];for(var o=0,n=t.length,s=new Array(n);o<n;o++)s[o]=t[o].fn;return s};se.prototype.listenerCount=function(r){var e=le?le+r:r,t=this._events[e];return t?t.fn?1:t.length:0};se.prototype.emit=function(r,e,t,o,n,s){var c=le?le+r:r;if(!this._events[c])return false;var l=this._events[c],u=arguments.length,d,h;if(l.fn){switch(l.once&&this.removeListener(r,l.fn,void 0,true),u){case 1:return l.fn.call(l.context),true;case 2:return l.fn.call(l.context,e),true;case 3:return l.fn.call(l.context,e,t),true;case 4:return l.fn.call(l.context,e,t,o),true;case 5:return l.fn.call(l.context,e,t,o,n),true;case 6:return l.fn.call(l.context,e,t,o,n,s),true}for(h=1,d=new Array(u-1);h<u;h++)d[h-1]=arguments[h];l.fn.apply(l.context,d);}else {var b=l.length,w;for(h=0;h<b;h++)switch(l[h].once&&this.removeListener(r,l[h].fn,void 0,true),u){case 1:l[h].fn.call(l[h].context);break;case 2:l[h].fn.call(l[h].context,e);break;case 3:l[h].fn.call(l[h].context,e,t);break;case 4:l[h].fn.call(l[h].context,e,t,o);break;default:if(!d)for(w=1,d=new Array(u-1);w<u;w++)d[w-1]=arguments[w];l[h].fn.apply(l[h].context,d);}}return true};se.prototype.on=function(r,e,t){return qp(this,r,e,t,false)};se.prototype.once=function(r,e,t){return qp(this,r,e,t,true)};se.prototype.removeListener=function(r,e,t,o){var n=le?le+r:r;if(!this._events[n])return this;if(!e)return yo(this,n),this;var s=this._events[n];if(s.fn)s.fn===e&&(!o||s.once)&&(!t||s.context===t)&&yo(this,n);else {for(var c=0,l=[],u=s.length;c<u;c++)(s[c].fn!==e||o&&!s[c].once||t&&s[c].context!==t)&&l.push(s[c]);l.length?this._events[n]=l.length===1?l[0]:l:yo(this,n);}return this};se.prototype.removeAllListeners=function(r){var e;return r?(e=le?le+r:r,this._events[e]&&yo(this,e)):(this._events=new Gt,this._eventsCount=0),this};se.prototype.off=se.prototype.removeListener;se.prototype.addListener=se.prototype.on;se.prefixed=le;se.EventEmitter=se;typeof hc!="undefined"&&(hc.exports=se);});var tu=A((QK,ru)=>{ru.exports=(a,r)=>(r=r||(()=>{}),a.then(e=>new Promise(t=>{t(r());}).then(()=>e),e=>new Promise(t=>{t(r());}).then(()=>{throw e})));});var ou=A((qK,So)=>{var Zh=tu(),_o=class extends Error{constructor(r){super(r),this.name="TimeoutError";}},iu=(a,r,e)=>new Promise((t,o)=>{if(typeof r!="number"||r<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(r===1/0){t(a);return}let n=setTimeout(()=>{if(typeof e=="function"){try{t(e());}catch(l){o(l);}return}let s=typeof e=="string"?e:`Promise timed out after ${r} milliseconds`,c=e instanceof Error?e:new _o(s);typeof a.cancel=="function"&&a.cancel(),o(c);},r);Zh(a.then(t,o),()=>{clearTimeout(n);});});So.exports=iu;So.exports.default=iu;So.exports.TimeoutError=_o;});var au=A(gc=>{Object.defineProperty(gc,"__esModule",{value:true});function Qh(a,r,e){let t=0,o=a.length;for(;o>0;){let n=o/2|0,s=t+n;e(a[s],r)<=0?(t=++s,o-=n+1):o=n;}return t}gc.default=Qh;});var nu=A(wc=>{Object.defineProperty(wc,"__esModule",{value:true});var qh=au(),bc=class{constructor(){this._queue=[];}enqueue(r,e){e=Object.assign({priority:0},e);let t={priority:e.priority,run:r};if(this.size&&this._queue[this.size-1].priority>=e.priority){this._queue.push(t);return}let o=qh.default(this._queue,t,(n,s)=>s.priority-n.priority);this._queue.splice(o,0,t);}dequeue(){let r=this._queue.shift();return r==null?void 0:r.run}filter(r){return this._queue.filter(e=>e.priority===r.priority).map(e=>e.run)}get size(){return this._queue.length}};wc.default=bc;});var xo=A(_c=>{Object.defineProperty(_c,"__esModule",{value:true});var eg=eu(),su=ou(),rg=nu(),ko=()=>{},tg=new su.TimeoutError,yc=class extends eg{constructor(r){var e,t,o,n;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=ko,this._resolveIdle=ko,r=Object.assign({carryoverConcurrencyCount:false,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:true,queueClass:rg.default},r),!(typeof r.intervalCap=="number"&&r.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(t=(e=r.intervalCap)===null||e===void 0?void 0:e.toString())!==null&&t!==void 0?t:""}\` (${typeof r.intervalCap})`);if(r.interval===void 0||!(Number.isFinite(r.interval)&&r.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(n=(o=r.interval)===null||o===void 0?void 0:o.toString())!==null&&n!==void 0?n:""}\` (${typeof r.interval})`);this._carryoverConcurrencyCount=r.carryoverConcurrencyCount,this._isIntervalIgnored=r.intervalCap===1/0||r.interval===0,this._intervalCap=r.intervalCap,this._interval=r.interval,this._queue=new r.queueClass,this._queueClass=r.queueClass,this.concurrency=r.concurrency,this._timeout=r.timeout,this._throwOnTimeout=r.throwOnTimeout===true,this._isPaused=r.autoStart===false;}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount<this._intervalCap}get _doesConcurrentAllowAnother(){return this._pendingCount<this._concurrency}_next(){this._pendingCount--,this._tryToStartAnother(),this.emit("next");}_resolvePromises(){this._resolveEmpty(),this._resolveEmpty=ko,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=ko,this.emit("idle"));}_onResumeInterval(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=void 0;}_isIntervalPaused(){let r=Date.now();if(this._intervalId===void 0){let e=this._intervalEnd-r;if(e<0)this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0;else return this._timeoutId===void 0&&(this._timeoutId=setTimeout(()=>{this._onResumeInterval();},e)),true}return false}_tryToStartAnother(){if(this._queue.size===0)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),false;if(!this._isPaused){let r=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){let e=this._queue.dequeue();return e?(this.emit("active"),e(),r&&this._initializeIntervalIfNeeded(),true):false}}return false}_initializeIntervalIfNeeded(){this._isIntervalIgnored||this._intervalId!==void 0||(this._intervalId=setInterval(()=>{this._onInterval();},this._interval),this._intervalEnd=Date.now()+this._interval);}_onInterval(){this._intervalCount===0&&this._pendingCount===0&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue();}_processQueue(){for(;this._tryToStartAnother(););}get concurrency(){return this._concurrency}set concurrency(r){if(!(typeof r=="number"&&r>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${r}\` (${typeof r})`);this._concurrency=r,this._processQueue();}async add(r,e={}){return new Promise((t,o)=>{let n=async()=>{this._pendingCount++,this._intervalCount++;try{let s=this._timeout===void 0&&e.timeout===void 0?r():su.default(Promise.resolve(r()),e.timeout===void 0?this._timeout:e.timeout,()=>{(e.throwOnTimeout===void 0?this._throwOnTimeout:e.throwOnTimeout)&&o(tg);});t(await s);}catch(s){o(s);}this._next();};this._queue.enqueue(n,e),this._tryToStartAnother(),this.emit("add");})}async addAll(r,e){return Promise.all(r.map(async t=>this.add(t,e)))}start(){return this._isPaused?(this._isPaused=false,this._processQueue(),this):this}pause(){this._isPaused=true;}clear(){this._queue=new this._queueClass;}async onEmpty(){if(this._queue.size!==0)return new Promise(r=>{let e=this._resolveEmpty;this._resolveEmpty=()=>{e(),r();};})}async onIdle(){if(!(this._pendingCount===0&&this._queue.size===0))return new Promise(r=>{let e=this._resolveIdle;this._resolveIdle=()=>{e(),r();};})}get size(){return this._queue.size}sizeBy(r){return this._queue.filter(r).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(r){this._timeout=r;}};_c.default=yc;});var Yt=A((lX,uu)=>{var sg="2.0.0",cg=Number.MAX_SAFE_INTEGER||9007199254740991,lg=16,pg=250,ug=["major","premajor","minor","preminor","patch","prepatch","prerelease"];uu.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:lg,MAX_SAFE_BUILD_LENGTH:pg,MAX_SAFE_INTEGER:cg,RELEASE_TYPES:ug,SEMVER_SPEC_VERSION:sg,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2};});var Zt=A((pX,mu)=>{var mg=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...a)=>console.error("SEMVER",...a):()=>{};mu.exports=mg;});var _r=A((Oe,du)=>{var{MAX_SAFE_COMPONENT_LENGTH:xc,MAX_SAFE_BUILD_LENGTH:dg,MAX_LENGTH:fg}=Yt(),hg=Zt();Oe=du.exports={};var gg=Oe.re=[],bg=Oe.safeRe=[],R=Oe.src=[],v=Oe.t={},wg=0,Rc="[a-zA-Z0-9-]",yg=[["\\s",1],["\\d",fg],[Rc,dg]],_g=a=>{for(let[r,e]of yg)a=a.split(`${r}*`).join(`${r}{0,${e}}`).split(`${r}+`).join(`${r}{1,${e}}`);return a},C=(a,r,e)=>{let t=_g(r),o=wg++;hg(a,o,r),v[a]=o,R[o]=r,gg[o]=new RegExp(r,e?"g":void 0),bg[o]=new RegExp(t,e?"g":void 0);};C("NUMERICIDENTIFIER","0|[1-9]\\d*");C("NUMERICIDENTIFIERLOOSE","\\d+");C("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Rc}*`);C("MAINVERSION",`(${R[v.NUMERICIDENTIFIER]})\\.(${R[v.NUMERICIDENTIFIER]})\\.(${R[v.NUMERICIDENTIFIER]})`);C("MAINVERSIONLOOSE",`(${R[v.NUMERICIDENTIFIERLOOSE]})\\.(${R[v.NUMERICIDENTIFIERLOOSE]})\\.(${R[v.NUMERICIDENTIFIERLOOSE]})`);C("PRERELEASEIDENTIFIER",`(?:${R[v.NUMERICIDENTIFIER]}|${R[v.NONNUMERICIDENTIFIER]})`);C("PRERELEASEIDENTIFIERLOOSE",`(?:${R[v.NUMERICIDENTIFIERLOOSE]}|${R[v.NONNUMERICIDENTIFIER]})`);C("PRERELEASE",`(?:-(${R[v.PRERELEASEIDENTIFIER]}(?:\\.${R[v.PRERELEASEIDENTIFIER]})*))`);C("PRERELEASELOOSE",`(?:-?(${R[v.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${R[v.PRERELEASEIDENTIFIERLOOSE]})*))`);C("BUILDIDENTIFIER",`${Rc}+`);C("BUILD",`(?:\\+(${R[v.BUILDIDENTIFIER]}(?:\\.${R[v.BUILDIDENTIFIER]})*))`);C("FULLPLAIN",`v?${R[v.MAINVERSION]}${R[v.PRERELEASE]}?${R[v.BUILD]}?`);C("FULL",`^${R[v.FULLPLAIN]}$`);C("LOOSEPLAIN",`[v=\\s]*${R[v.MAINVERSIONLOOSE]}${R[v.PRERELEASELOOSE]}?${R[v.BUILD]}?`);C("LOOSE",`^${R[v.LOOSEPLAIN]}$`);C("GTLT","((?:<|>)?=?)");C("XRANGEIDENTIFIERLOOSE",`${R[v.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);C("XRANGEIDENTIFIER",`${R[v.NUMERICIDENTIFIER]}|x|X|\\*`);C("XRANGEPLAIN",`[v=\\s]*(${R[v.XRANGEIDENTIFIER]})(?:\\.(${R[v.XRANGEIDENTIFIER]})(?:\\.(${R[v.XRANGEIDENTIFIER]})(?:${R[v.PRERELEASE]})?${R[v.BUILD]}?)?)?`);C("XRANGEPLAINLOOSE",`[v=\\s]*(${R[v.XRANGEIDENTIFIERLOOSE]})(?:\\.(${R[v.XRANGEIDENTIFIERLOOSE]})(?:\\.(${R[v.XRANGEIDENTIFIERLOOSE]})(?:${R[v.PRERELEASELOOSE]})?${R[v.BUILD]}?)?)?`);C("XRANGE",`^${R[v.GTLT]}\\s*${R[v.XRANGEPLAIN]}$`);C("XRANGELOOSE",`^${R[v.GTLT]}\\s*${R[v.XRANGEPLAINLOOSE]}$`);C("COERCEPLAIN",`(^|[^\\d])(\\d{1,${xc}})(?:\\.(\\d{1,${xc}}))?(?:\\.(\\d{1,${xc}}))?`);C("COERCE",`${R[v.COERCEPLAIN]}(?:$|[^\\d])`);C("COERCEFULL",R[v.COERCEPLAIN]+`(?:${R[v.PRERELEASE]})?(?:${R[v.BUILD]})?(?:$|[^\\d])`);C("COERCERTL",R[v.COERCE],true);C("COERCERTLFULL",R[v.COERCEFULL],true);C("LONETILDE","(?:~>?)");C("TILDETRIM",`(\\s*)${R[v.LONETILDE]}\\s+`,true);Oe.tildeTrimReplace="$1~";C("TILDE",`^${R[v.LONETILDE]}${R[v.XRANGEPLAIN]}$`);C("TILDELOOSE",`^${R[v.LONETILDE]}${R[v.XRANGEPLAINLOOSE]}$`);C("LONECARET","(?:\\^)");C("CARETTRIM",`(\\s*)${R[v.LONECARET]}\\s+`,true);Oe.caretTrimReplace="$1^";C("CARET",`^${R[v.LONECARET]}${R[v.XRANGEPLAIN]}$`);C("CARETLOOSE",`^${R[v.LONECARET]}${R[v.XRANGEPLAINLOOSE]}$`);C("COMPARATORLOOSE",`^${R[v.GTLT]}\\s*(${R[v.LOOSEPLAIN]})$|^$`);C("COMPARATOR",`^${R[v.GTLT]}\\s*(${R[v.FULLPLAIN]})$|^$`);C("COMPARATORTRIM",`(\\s*)${R[v.GTLT]}\\s*(${R[v.LOOSEPLAIN]}|${R[v.XRANGEPLAIN]})`,true);Oe.comparatorTrimReplace="$1$2$3";C("HYPHENRANGE",`^\\s*(${R[v.XRANGEPLAIN]})\\s+-\\s+(${R[v.XRANGEPLAIN]})\\s*$`);C("HYPHENRANGELOOSE",`^\\s*(${R[v.XRANGEPLAINLOOSE]})\\s+-\\s+(${R[v.XRANGEPLAINLOOSE]})\\s*$`);C("STAR","(<|>)?=?\\s*\\*");C("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");C("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$");});var Eo=A((uX,fu)=>{var Sg=Object.freeze({loose:true}),kg=Object.freeze({}),xg=a=>a?typeof a!="object"?Sg:a:kg;fu.exports=xg;});var vc=A((mX,bu)=>{var hu=/^[0-9]+$/,gu=(a,r)=>{let e=hu.test(a),t=hu.test(r);return e&&t&&(a=+a,r=+r),a===r?0:e&&!t?-1:t&&!e?1:a<r?-1:1},Rg=(a,r)=>gu(r,a);bu.exports={compareIdentifiers:gu,rcompareIdentifiers:Rg};});var ce=A((dX,Su)=>{var Ao=Zt(),{MAX_LENGTH:wu,MAX_SAFE_INTEGER:zo}=Yt(),{safeRe:yu,t:_u}=_r(),vg=Eo(),{compareIdentifiers:Sr}=vc(),Ec=class a{constructor(r,e){if(e=vg(e),r instanceof a){if(r.loose===!!e.loose&&r.includePrerelease===!!e.includePrerelease)return r;r=r.version;}else if(typeof r!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof r}".`);if(r.length>wu)throw new TypeError(`version is longer than ${wu} characters`);Ao("SemVer",r,e),this.options=e,this.loose=!!e.loose,this.includePrerelease=!!e.includePrerelease;let t=r.trim().match(e.loose?yu[_u.LOOSE]:yu[_u.FULL]);if(!t)throw new TypeError(`Invalid Version: ${r}`);if(this.raw=r,this.major=+t[1],this.minor=+t[2],this.patch=+t[3],this.major>zo||this.major<0)throw new TypeError("Invalid major version");if(this.minor>zo||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>zo||this.patch<0)throw new TypeError("Invalid patch version");t[4]?this.prerelease=t[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){let n=+o;if(n>=0&&n<zo)return n}return o}):this.prerelease=[],this.build=t[5]?t[5].split("."):[],this.format();}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(r){if(Ao("SemVer.compare",this.version,this.options,r),!(r instanceof a)){if(typeof r=="string"&&r===this.version)return 0;r=new a(r,this.options);}return r.version===this.version?0:this.compareMain(r)||this.comparePre(r)}compareMain(r){return r instanceof a||(r=new a(r,this.options)),Sr(this.major,r.major)||Sr(this.minor,r.minor)||Sr(this.patch,r.patch)}comparePre(r){if(r instanceof a||(r=new a(r,this.options)),this.prerelease.length&&!r.prerelease.length)return -1;if(!this.prerelease.length&&r.prerelease.length)return 1;if(!this.prerelease.length&&!r.prerelease.length)return 0;let e=0;do{let t=this.prerelease[e],o=r.prerelease[e];if(Ao("prerelease compare",e,t,o),t===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(t===void 0)return -1;if(t===o)continue;return Sr(t,o)}while(++e)}compareBuild(r){r instanceof a||(r=new a(r,this.options));let e=0;do{let t=this.build[e],o=r.build[e];if(Ao("build compare",e,t,o),t===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(t===void 0)return -1;if(t===o)continue;return Sr(t,o)}while(++e)}inc(r,e,t){switch(r){case "premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",e,t);break;case "preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",e,t);break;case "prepatch":this.prerelease.length=0,this.inc("patch",e,t),this.inc("pre",e,t);break;case "prerelease":this.prerelease.length===0&&this.inc("patch",e,t),this.inc("pre",e,t);break;case "major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case "minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case "patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case "pre":{let o=Number(t)?1:0;if(!e&&t===false)throw new Error("invalid increment argument: identifier is empty");if(this.prerelease.length===0)this.prerelease=[o];else {let n=this.prerelease.length;for(;--n>=0;)typeof this.prerelease[n]=="number"&&(this.prerelease[n]++,n=-2);if(n===-1){if(e===this.prerelease.join(".")&&t===false)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o);}}if(e){let n=[e,o];t===false&&(n=[e]),Sr(this.prerelease[0],e)===0?isNaN(this.prerelease[1])&&(this.prerelease=n):this.prerelease=n;}break}default:throw new Error(`invalid increment argument: ${r}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};Su.exports=Ec;});var ar=A((fX,xu)=>{var ku=ce(),Eg=(a,r,e=false)=>{if(a instanceof ku)return a;try{return new ku(a,r)}catch(t){if(!e)return null;throw t}};xu.exports=Eg;});var vu=A((hX,Ru)=>{var Ag=ar(),zg=(a,r)=>{let e=Ag(a,r);return e?e.version:null};Ru.exports=zg;});var Au=A((gX,Eu)=>{var Tg=ar(),Pg=(a,r)=>{let e=Tg(a.trim().replace(/^[=v]+/,""),r);return e?e.version:null};Eu.exports=Pg;});var Pu=A((bX,Tu)=>{var zu=ce(),Cg=(a,r,e,t,o)=>{typeof e=="string"&&(o=t,t=e,e=void 0);try{return new zu(a instanceof zu?a.version:a,e).inc(r,t,o).version}catch{return null}};Tu.exports=Cg;});var Iu=A((wX,ju)=>{var Cu=ar(),jg=(a,r)=>{let e=Cu(a,null,true),t=Cu(r,null,true),o=e.compare(t);if(o===0)return null;let n=o>0,s=n?e:t,c=n?t:e,l=!!s.prerelease.length;if(!!c.prerelease.length&&!l)return !c.patch&&!c.minor?"major":s.patch?"patch":s.minor?"minor":"major";let d=l?"pre":"";return e.major!==t.major?d+"major":e.minor!==t.minor?d+"minor":e.patch!==t.patch?d+"patch":"prerelease"};ju.exports=jg;});var Uu=A((yX,Nu)=>{var Ig=ce(),Ng=(a,r)=>new Ig(a,r).major;Nu.exports=Ng;});var Fu=A((_X,Mu)=>{var Ug=ce(),Mg=(a,r)=>new Ug(a,r).minor;Mu.exports=Mg;});var Ou=A((SX,Du)=>{var Fg=ce(),Dg=(a,r)=>new Fg(a,r).patch;Du.exports=Dg;});var Bu=A((kX,Lu)=>{var Og=ar(),Lg=(a,r)=>{let e=Og(a,r);return e&&e.prerelease.length?e.prerelease:null};Lu.exports=Lg;});var ve=A((xX,Vu)=>{var $u=ce(),Bg=(a,r,e)=>new $u(a,e).compare(new $u(r,e));Vu.exports=Bg;});var Wu=A((RX,Ju)=>{var $g=ve(),Vg=(a,r,e)=>$g(r,a,e);Ju.exports=Vg;});var Xu=A((vX,Ku)=>{var Jg=ve(),Wg=(a,r)=>Jg(a,r,true);Ku.exports=Wg;});var To=A((EX,Hu)=>{var Gu=ce(),Kg=(a,r,e)=>{let t=new Gu(a,e),o=new Gu(r,e);return t.compare(o)||t.compareBuild(o)};Hu.exports=Kg;});var Zu=A((AX,Yu)=>{var Xg=To(),Gg=(a,r)=>a.sort((e,t)=>Xg(e,t,r));Yu.exports=Gg;});var qu=A((zX,Qu)=>{var Hg=To(),Yg=(a,r)=>a.sort((e,t)=>Hg(t,e,r));Qu.exports=Yg;});var Qt=A((TX,em)=>{var Zg=ve(),Qg=(a,r,e)=>Zg(a,r,e)>0;em.exports=Qg;});var Po=A((PX,rm)=>{var qg=ve(),eb=(a,r,e)=>qg(a,r,e)<0;rm.exports=eb;});var Ac=A((CX,tm)=>{var rb=ve(),tb=(a,r,e)=>rb(a,r,e)===0;tm.exports=tb;});var zc=A((jX,im)=>{var ib=ve(),ob=(a,r,e)=>ib(a,r,e)!==0;im.exports=ob;});var Co=A((IX,om)=>{var ab=ve(),nb=(a,r,e)=>ab(a,r,e)>=0;om.exports=nb;});var jo=A((NX,am)=>{var sb=ve(),cb=(a,r,e)=>sb(a,r,e)<=0;am.exports=cb;});var Tc=A((UX,nm)=>{var lb=Ac(),pb=zc(),ub=Qt(),mb=Co(),db=Po(),fb=jo(),hb=(a,r,e,t)=>{switch(r){case "===":return typeof a=="object"&&(a=a.version),typeof e=="object"&&(e=e.version),a===e;case "!==":return typeof a=="object"&&(a=a.version),typeof e=="object"&&(e=e.version),a!==e;case "":case "=":case "==":return lb(a,e,t);case "!=":return pb(a,e,t);case ">":return ub(a,e,t);case ">=":return mb(a,e,t);case "<":return db(a,e,t);case "<=":return fb(a,e,t);default:throw new TypeError(`Invalid operator: ${r}`)}};nm.exports=hb;});var cm=A((MX,sm)=>{var gb=ce(),bb=ar(),{safeRe:Io,t:No}=_r(),wb=(a,r)=>{if(a instanceof gb)return a;if(typeof a=="number"&&(a=String(a)),typeof a!="string")return null;r=r||{};let e=null;if(!r.rtl)e=a.match(r.includePrerelease?Io[No.COERCEFULL]:Io[No.COERCE]);else {let l=r.includePrerelease?Io[No.COERCERTLFULL]:Io[No.COERCERTL],u;for(;(u=l.exec(a))&&(!e||e.index+e[0].length!==a.length);)(!e||u.index+u[0].length!==e.index+e[0].length)&&(e=u),l.lastIndex=u.index+u[1].length+u[2].length;l.lastIndex=-1;}if(e===null)return null;let t=e[2],o=e[3]||"0",n=e[4]||"0",s=r.includePrerelease&&e[5]?`-${e[5]}`:"",c=r.includePrerelease&&e[6]?`+${e[6]}`:"";return bb(`${t}.${o}.${n}${s}${c}`,r)};sm.exports=wb;});var pm=A((FX,lm)=>{var Pc=class{constructor(){this.max=1e3,this.map=new Map;}get(r){let e=this.map.get(r);if(e!==void 0)return this.map.delete(r),this.map.set(r,e),e}delete(r){return this.map.delete(r)}set(r,e){if(!this.delete(r)&&e!==void 0){if(this.map.size>=this.max){let o=this.map.keys().next().value;this.delete(o);}this.map.set(r,e);}return this}};lm.exports=Pc;});var Ee=A((DX,fm)=>{var yb=/\s+/g,Cc=class a{constructor(r,e){if(e=Sb(e),r instanceof a)return r.loose===!!e.loose&&r.includePrerelease===!!e.includePrerelease?r:new a(r.raw,e);if(r instanceof jc)return this.raw=r.value,this.set=[[r]],this.formatted=void 0,this;if(this.options=e,this.loose=!!e.loose,this.includePrerelease=!!e.includePrerelease,this.raw=r.trim().replace(yb," "),this.set=this.raw.split("||").map(t=>this.parseRange(t.trim())).filter(t=>t.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let t=this.set[0];if(this.set=this.set.filter(o=>!mm(o[0])),this.set.length===0)this.set=[t];else if(this.set.length>1){for(let o of this.set)if(o.length===1&&zb(o[0])){this.set=[o];break}}}this.formatted=void 0;}get range(){if(this.formatted===void 0){this.formatted="";for(let r=0;r<this.set.length;r++){r>0&&(this.formatted+="||");let e=this.set[r];for(let t=0;t<e.length;t++)t>0&&(this.formatted+=" "),this.formatted+=e[t].toString().trim();}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(r){let t=((this.options.includePrerelease&&Eb)|(this.options.loose&&Ab))+":"+r,o=um.get(t);if(o)return o;let n=this.options.loose,s=n?he[pe.HYPHENRANGELOOSE]:he[pe.HYPHENRANGE];r=r.replace(s,Db(this.options.includePrerelease)),J("hyphen replace",r),r=r.replace(he[pe.COMPARATORTRIM],xb),J("comparator trim",r),r=r.replace(he[pe.TILDETRIM],Rb),J("tilde trim",r),r=r.replace(he[pe.CARETTRIM],vb),J("caret trim",r);let c=r.split(" ").map(h=>Tb(h,this.options)).join(" ").split(/\s+/).map(h=>Fb(h,this.options));n&&(c=c.filter(h=>(J("loose invalid filter",h,this.options),!!h.match(he[pe.COMPARATORLOOSE])))),J("range list",c);let l=new Map,u=c.map(h=>new jc(h,this.options));for(let h of u){if(mm(h))return [h];l.set(h.value,h);}l.size>1&&l.has("")&&l.delete("");let d=[...l.values()];return um.set(t,d),d}intersects(r,e){if(!(r instanceof a))throw new TypeError("a Range is required");return this.set.some(t=>dm(t,e)&&r.set.some(o=>dm(o,e)&&t.every(n=>o.every(s=>n.intersects(s,e)))))}test(r){if(!r)return false;if(typeof r=="string")try{r=new kb(r,this.options);}catch{return false}for(let e=0;e<this.set.length;e++)if(Ob(this.set[e],r,this.options))return true;return false}};fm.exports=Cc;var _b=pm(),um=new _b,Sb=Eo(),jc=qt(),J=Zt(),kb=ce(),{safeRe:he,t:pe,comparatorTrimReplace:xb,tildeTrimReplace:Rb,caretTrimReplace:vb}=_r(),{FLAG_INCLUDE_PRERELEASE:Eb,FLAG_LOOSE:Ab}=Yt(),mm=a=>a.value==="<0.0.0-0",zb=a=>a.value==="",dm=(a,r)=>{let e=true,t=a.slice(),o=t.pop();for(;e&&t.length;)e=t.every(n=>o.intersects(n,r)),o=t.pop();return e},Tb=(a,r)=>(J("comp",a,r),a=jb(a,r),J("caret",a),a=Pb(a,r),J("tildes",a),a=Nb(a,r),J("xrange",a),a=Mb(a,r),J("stars",a),a),ue=a=>!a||a.toLowerCase()==="x"||a==="*",Pb=(a,r)=>a.trim().split(/\s+/).map(e=>Cb(e,r)).join(" "),Cb=(a,r)=>{let e=r.loose?he[pe.TILDELOOSE]:he[pe.TILDE];return a.replace(e,(t,o,n,s,c)=>{J("tilde",a,t,o,n,s,c);let l;return ue(o)?l="":ue(n)?l=`>=${o}.0.0 <${+o+1}.0.0-0`:ue(s)?l=`>=${o}.${n}.0 <${o}.${+n+1}.0-0`:c?(J("replaceTilde pr",c),l=`>=${o}.${n}.${s}-${c} <${o}.${+n+1}.0-0`):l=`>=${o}.${n}.${s} <${o}.${+n+1}.0-0`,J("tilde return",l),l})},jb=(a,r)=>a.trim().split(/\s+/).map(e=>Ib(e,r)).join(" "),Ib=(a,r)=>{J("caret",a,r);let e=r.loose?he[pe.CARETLOOSE]:he[pe.CARET],t=r.includePrerelease?"-0":"";return a.replace(e,(o,n,s,c,l)=>{J("caret",a,o,n,s,c,l);let u;return ue(n)?u="":ue(s)?u=`>=${n}.0.0${t} <${+n+1}.0.0-0`:ue(c)?n==="0"?u=`>=${n}.${s}.0${t} <${n}.${+s+1}.0-0`:u=`>=${n}.${s}.0${t} <${+n+1}.0.0-0`:l?(J("replaceCaret pr",l),n==="0"?s==="0"?u=`>=${n}.${s}.${c}-${l} <${n}.${s}.${+c+1}-0`:u=`>=${n}.${s}.${c}-${l} <${n}.${+s+1}.0-0`:u=`>=${n}.${s}.${c}-${l} <${+n+1}.0.0-0`):(J("no pr"),n==="0"?s==="0"?u=`>=${n}.${s}.${c}${t} <${n}.${s}.${+c+1}-0`:u=`>=${n}.${s}.${c}${t} <${n}.${+s+1}.0-0`:u=`>=${n}.${s}.${c} <${+n+1}.0.0-0`),J("caret return",u),u})},Nb=(a,r)=>(J("replaceXRanges",a,r),a.split(/\s+/).map(e=>Ub(e,r)).join(" ")),Ub=(a,r)=>{a=a.trim();let e=r.loose?he[pe.XRANGELOOSE]:he[pe.XRANGE];return a.replace(e,(t,o,n,s,c,l)=>{J("xRange",a,t,o,n,s,c,l);let u=ue(n),d=u||ue(s),h=d||ue(c),b=h;return o==="="&&b&&(o=""),l=r.includePrerelease?"-0":"",u?o===">"||o==="<"?t="<0.0.0-0":t="*":o&&b?(d&&(s=0),c=0,o===">"?(o=">=",d?(n=+n+1,s=0,c=0):(s=+s+1,c=0)):o==="<="&&(o="<",d?n=+n+1:s=+s+1),o==="<"&&(l="-0"),t=`${o+n}.${s}.${c}${l}`):d?t=`>=${n}.0.0${l} <${+n+1}.0.0-0`:h&&(t=`>=${n}.${s}.0${l} <${n}.${+s+1}.0-0`),J("xRange return",t),t})},Mb=(a,r)=>(J("replaceStars",a,r),a.trim().replace(he[pe.STAR],"")),Fb=(a,r)=>(J("replaceGTE0",a,r),a.trim().replace(he[r.includePrerelease?pe.GTE0PRE:pe.GTE0],"")),Db=a=>(r,e,t,o,n,s,c,l,u,d,h,b)=>(ue(t)?e="":ue(o)?e=`>=${t}.0.0${a?"-0":""}`:ue(n)?e=`>=${t}.${o}.0${a?"-0":""}`:s?e=`>=${e}`:e=`>=${e}${a?"-0":""}`,ue(u)?l="":ue(d)?l=`<${+u+1}.0.0-0`:ue(h)?l=`<${u}.${+d+1}.0-0`:b?l=`<=${u}.${d}.${h}-${b}`:a?l=`<${u}.${d}.${+h+1}-0`:l=`<=${l}`,`${e} ${l}`.trim()),Ob=(a,r,e)=>{for(let t=0;t<a.length;t++)if(!a[t].test(r))return false;if(r.prerelease.length&&!e.includePrerelease){for(let t=0;t<a.length;t++)if(J(a[t].semver),a[t].semver!==jc.ANY&&a[t].semver.prerelease.length>0){let o=a[t].semver;if(o.major===r.major&&o.minor===r.minor&&o.patch===r.patch)return true}return false}return true};});var qt=A((OX,_m)=>{var ei=Symbol("SemVer ANY"),Uc=class a{static get ANY(){return ei}constructor(r,e){if(e=hm(e),r instanceof a){if(r.loose===!!e.loose)return r;r=r.value;}r=r.trim().split(/\s+/).join(" "),Nc("comparator",r,e),this.options=e,this.loose=!!e.loose,this.parse(r),this.semver===ei?this.value="":this.value=this.operator+this.semver.version,Nc("comp",this);}parse(r){let e=this.options.loose?gm[bm.COMPARATORLOOSE]:gm[bm.COMPARATOR],t=r.match(e);if(!t)throw new TypeError(`Invalid comparator: ${r}`);this.operator=t[1]!==void 0?t[1]:"",this.operator==="="&&(this.operator=""),t[2]?this.semver=new wm(t[2],this.options.loose):this.semver=ei;}toString(){return this.value}test(r){if(Nc("Comparator.test",r,this.options.loose),this.semver===ei||r===ei)return true;if(typeof r=="string")try{r=new wm(r,this.options);}catch{return false}return Ic(r,this.operator,this.semver,this.options)}intersects(r,e){if(!(r instanceof a))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?true:new ym(r.value,e).test(this.value):r.operator===""?r.value===""?true:new ym(this.value,e).test(r.semver):(e=hm(e),e.includePrerelease&&(this.value==="<0.0.0-0"||r.value==="<0.0.0-0")||!e.includePrerelease&&(this.value.startsWith("<0.0.0")||r.value.startsWith("<0.0.0"))?false:!!(this.operator.startsWith(">")&&r.operator.startsWith(">")||this.operator.startsWith("<")&&r.operator.startsWith("<")||this.semver.version===r.semver.version&&this.operator.includes("=")&&r.operator.includes("=")||Ic(this.semver,"<",r.semver,e)&&this.operator.startsWith(">")&&r.operator.startsWith("<")||Ic(this.semver,">",r.semver,e)&&this.operator.startsWith("<")&&r.operator.startsWith(">")))}};_m.exports=Uc;var hm=Eo(),{safeRe:gm,t:bm}=_r(),Ic=Tc(),Nc=Zt(),wm=ce(),ym=Ee();});var ri=A((LX,Sm)=>{var Lb=Ee(),Bb=(a,r,e)=>{try{r=new Lb(r,e);}catch{return false}return r.test(a)};Sm.exports=Bb;});var xm=A((BX,km)=>{var $b=Ee(),Vb=(a,r)=>new $b(a,r).set.map(e=>e.map(t=>t.value).join(" ").trim().split(" "));km.exports=Vb;});var vm=A(($X,Rm)=>{var Jb=ce(),Wb=Ee(),Kb=(a,r,e)=>{let t=null,o=null,n=null;try{n=new Wb(r,e);}catch{return null}return a.forEach(s=>{n.test(s)&&(!t||o.compare(s)===-1)&&(t=s,o=new Jb(t,e));}),t};Rm.exports=Kb;});var Am=A((VX,Em)=>{var Xb=ce(),Gb=Ee(),Hb=(a,r,e)=>{let t=null,o=null,n=null;try{n=new Gb(r,e);}catch{return null}return a.forEach(s=>{n.test(s)&&(!t||o.compare(s)===1)&&(t=s,o=new Xb(t,e));}),t};Em.exports=Hb;});var Pm=A((JX,Tm)=>{var Mc=ce(),Yb=Ee(),zm=Qt(),Zb=(a,r)=>{a=new Yb(a,r);let e=new Mc("0.0.0");if(a.test(e)||(e=new Mc("0.0.0-0"),a.test(e)))return e;e=null;for(let t=0;t<a.set.length;++t){let o=a.set[t],n=null;o.forEach(s=>{let c=new Mc(s.semver.version);switch(s.operator){case ">":c.prerelease.length===0?c.patch++:c.prerelease.push(0),c.raw=c.format();case "":case ">=":(!n||zm(c,n))&&(n=c);break;case "<":case "<=":break;default:throw new Error(`Unexpected operation: ${s.operator}`)}}),n&&(!e||zm(e,n))&&(e=n);}return e&&a.test(e)?e:null};Tm.exports=Zb;});var jm=A((WX,Cm)=>{var Qb=Ee(),qb=(a,r)=>{try{return new Qb(a,r).range||"*"}catch{return null}};Cm.exports=qb;});var Uo=A((KX,Mm)=>{var ew=ce(),Um=qt(),{ANY:rw}=Um,tw=Ee(),iw=ri(),Im=Qt(),Nm=Po(),ow=jo(),aw=Co(),nw=(a,r,e,t)=>{a=new ew(a,t),r=new tw(r,t);let o,n,s,c,l;switch(e){case ">":o=Im,n=ow,s=Nm,c=">",l=">=";break;case "<":o=Nm,n=aw,s=Im,c="<",l="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(iw(a,r,t))return false;for(let u=0;u<r.set.length;++u){let d=r.set[u],h=null,b=null;if(d.forEach(w=>{w.semver===rw&&(w=new Um(">=0.0.0")),h=h||w,b=b||w,o(w.semver,h.semver,t)?h=w:s(w.semver,b.semver,t)&&(b=w);}),h.operator===c||h.operator===l||(!b.operator||b.operator===c)&&n(a,b.semver))return false;if(b.operator===l&&s(a,b.semver))return false}return true};Mm.exports=nw;});var Dm=A((XX,Fm)=>{var sw=Uo(),cw=(a,r,e)=>sw(a,r,">",e);Fm.exports=cw;});var Lm=A((GX,Om)=>{var lw=Uo(),pw=(a,r,e)=>lw(a,r,"<",e);Om.exports=pw;});var Vm=A((HX,$m)=>{var Bm=Ee(),uw=(a,r,e)=>(a=new Bm(a,e),r=new Bm(r,e),a.intersects(r,e));$m.exports=uw;});var Wm=A((YX,Jm)=>{var mw=ri(),dw=ve();Jm.exports=(a,r,e)=>{let t=[],o=null,n=null,s=a.sort((d,h)=>dw(d,h,e));for(let d of s)mw(d,r,e)?(n=d,o||(o=d)):(n&&t.push([o,n]),n=null,o=null);o&&t.push([o,null]);let c=[];for(let[d,h]of t)d===h?c.push(d):!h&&d===s[0]?c.push("*"):h?d===s[0]?c.push(`<=${h}`):c.push(`${d} - ${h}`):c.push(`>=${d}`);let l=c.join(" || "),u=typeof r.raw=="string"?r.raw:String(r);return l.length<u.length?l:r};});var Zm=A((ZX,Ym)=>{var Km=Ee(),Dc=qt(),{ANY:Fc}=Dc,ti=ri(),Oc=ve(),fw=(a,r,e={})=>{if(a===r)return true;a=new Km(a,e),r=new Km(r,e);let t=false;e:for(let o of a.set){for(let n of r.set){let s=gw(o,n,e);if(t=t||s!==null,s)continue e}if(t)return false}return true},hw=[new Dc(">=0.0.0-0")],Xm=[new Dc(">=0.0.0")],gw=(a,r,e)=>{if(a===r)return true;if(a.length===1&&a[0].semver===Fc){if(r.length===1&&r[0].semver===Fc)return true;e.includePrerelease?a=hw:a=Xm;}if(r.length===1&&r[0].semver===Fc){if(e.includePrerelease)return true;r=Xm;}let t=new Set,o,n;for(let w of a)w.operator===">"||w.operator===">="?o=Gm(o,w,e):w.operator==="<"||w.operator==="<="?n=Hm(n,w,e):t.add(w.semver);if(t.size>1)return null;let s;if(o&&n){if(s=Oc(o.semver,n.semver,e),s>0)return null;if(s===0&&(o.operator!==">="||n.operator!=="<="))return null}for(let w of t){if(o&&!ti(w,String(o),e)||n&&!ti(w,String(n),e))return null;for(let x of r)if(!ti(w,String(x),e))return false;return true}let c,l,u,d,h=n&&!e.includePrerelease&&n.semver.prerelease.length?n.semver:false,b=o&&!e.includePrerelease&&o.semver.prerelease.length?o.semver:false;h&&h.prerelease.length===1&&n.operator==="<"&&h.prerelease[0]===0&&(h=false);for(let w of r){if(d=d||w.operator===">"||w.operator===">=",u=u||w.operator==="<"||w.operator==="<=",o){if(b&&w.semver.prerelease&&w.semver.prerelease.length&&w.semver.major===b.major&&w.semver.minor===b.minor&&w.semver.patch===b.patch&&(b=false),w.operator===">"||w.operator===">="){if(c=Gm(o,w,e),c===w&&c!==o)return false}else if(o.operator===">="&&!ti(o.semver,String(w),e))return false}if(n){if(h&&w.semver.prerelease&&w.semver.prerelease.length&&w.semver.major===h.major&&w.semver.minor===h.minor&&w.semver.patch===h.patch&&(h=false),w.operator==="<"||w.operator==="<="){if(l=Hm(n,w,e),l===w&&l!==n)return false}else if(n.operator==="<="&&!ti(n.semver,String(w),e))return false}if(!w.operator&&(n||o)&&s!==0)return false}return !(o&&u&&!n&&s!==0||n&&d&&!o&&s!==0||b||h)},Gm=(a,r,e)=>{if(!a)return r;let t=Oc(a.semver,r.semver,e);return t>0?a:t<0||r.operator===">"&&a.operator===">="?r:a},Hm=(a,r,e)=>{if(!a)return r;let t=Oc(a.semver,r.semver,e);return t<0?a:t>0||r.operator==="<"&&a.operator==="<="?r:a};Ym.exports=fw;});var rd=A((QX,ed)=>{var Lc=_r(),Qm=Yt(),bw=ce(),qm=vc(),ww=ar(),yw=vu(),_w=Au(),Sw=Pu(),kw=Iu(),xw=Uu(),Rw=Fu(),vw=Ou(),Ew=Bu(),Aw=ve(),zw=Wu(),Tw=Xu(),Pw=To(),Cw=Zu(),jw=qu(),Iw=Qt(),Nw=Po(),Uw=Ac(),Mw=zc(),Fw=Co(),Dw=jo(),Ow=Tc(),Lw=cm(),Bw=qt(),$w=Ee(),Vw=ri(),Jw=xm(),Ww=vm(),Kw=Am(),Xw=Pm(),Gw=jm(),Hw=Uo(),Yw=Dm(),Zw=Lm(),Qw=Vm(),qw=Wm(),ey=Zm();ed.exports={parse:ww,valid:yw,clean:_w,inc:Sw,diff:kw,major:xw,minor:Rw,patch:vw,prerelease:Ew,compare:Aw,rcompare:zw,compareLoose:Tw,compareBuild:Pw,sort:Cw,rsort:jw,gt:Iw,lt:Nw,eq:Uw,neq:Mw,gte:Fw,lte:Dw,cmp:Ow,coerce:Lw,Comparator:Bw,Range:$w,satisfies:Vw,toComparators:Jw,maxSatisfying:Ww,minSatisfying:Kw,minVersion:Xw,validRange:Gw,outside:Hw,gtr:Yw,ltr:Zw,intersects:Qw,simplifyRange:qw,subset:ey,SemVer:bw,re:Lc.re,src:Lc.src,tokens:Lc.t,SEMVER_SPEC_VERSION:Qm.SEMVER_SPEC_VERSION,RELEASE_TYPES:Qm.RELEASE_TYPES,compareIdentifiers:qm.compareIdentifiers,rcompareIdentifiers:qm.rcompareIdentifiers};});var _d=A((XG,yd)=>{var bd=(a=0)=>r=>`\x1B[${38+a};5;${r}m`,wd=(a=0)=>(r,e,t)=>`\x1B[${38+a};2;${r};${e};${t}m`;function Cy(){let a=new Map,r={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};r.color.gray=r.color.blackBright,r.bgColor.bgGray=r.bgColor.bgBlackBright,r.color.grey=r.color.blackBright,r.bgColor.bgGrey=r.bgColor.bgBlackBright;for(let[e,t]of Object.entries(r)){for(let[o,n]of Object.entries(t))r[o]={open:`\x1B[${n[0]}m`,close:`\x1B[${n[1]}m`},t[o]=r[o],a.set(n[0],n[1]);Object.defineProperty(r,e,{value:t,enumerable:false});}return Object.defineProperty(r,"codes",{value:a,enumerable:false}),r.color.close="\x1B[39m",r.bgColor.close="\x1B[49m",r.color.ansi256=bd(),r.color.ansi16m=wd(),r.bgColor.ansi256=bd(10),r.bgColor.ansi16m=wd(10),Object.defineProperties(r,{rgbToAnsi256:{value:(e,t,o)=>e===t&&t===o?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(o/255*5),enumerable:false},hexToRgb:{value:e=>{let t=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(e.toString(16));if(!t)return [0,0,0];let{colorString:o}=t.groups;o.length===3&&(o=o.split("").map(s=>s+s).join(""));let n=Number.parseInt(o,16);return [n>>16&255,n>>8&255,n&255]},enumerable:false},hexToAnsi256:{value:e=>r.rgbToAnsi256(...r.hexToRgb(e)),enumerable:false}}),r}Object.defineProperty(yd,"exports",{enumerable:true,get:Cy});});var Kd={SILLY:0,TRACE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5,FATAL:6};function ul(a,r=a){return ansiEscapes.link(r,a)}var U=new tslog.Logger({hideLogPositionForProduction:true,prettyLogTemplate:"{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}} {{logLevelName}} "}),ml=a=>{U.settings.minLevel=Kd[a];};ml(process.env.OPIK_LOG_LEVEL||"INFO");var kl=je(fl());je(Sl());function xl(a,r){return (r==null?void 0:r[a])||(0, kl.default)(a)}function Rl(a,r,e){let t={};for(let o in a)Object.hasOwn(a,o)&&(t[r(o,e)]=a[o]);return t}function vl(a){return Array.isArray(a)?[...a]:{...a}}function ef(a,r){let e=vl(a);for(let[t,o]of Object.entries(r)){let[n,...s]=t.split(".").reverse(),c=e;for(let l of s.reverse()){if(c[l]===void 0)break;c[l]=vl(c[l]),c=c[l];}c[n]!==void 0&&(c[n]={lc:1,type:"secret",id:[o]});}return e}function ta(a){let r=Object.getPrototypeOf(a);return typeof a.lc_name=="function"&&(typeof r.lc_name!="function"||a.lc_name()!==r.lc_name())?a.lc_name():a.name}var We=class a{static lc_name(){return this.name}get lc_id(){return [...this.lc_namespace,ta(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}constructor(r,...e){Object.defineProperty(this,"lc_serializable",{enumerable:true,configurable:true,writable:true,value:false}),Object.defineProperty(this,"lc_kwargs",{enumerable:true,configurable:true,writable:true,value:void 0}),this.lc_serializable_keys!==void 0?this.lc_kwargs=Object.fromEntries(Object.entries(r||{}).filter(([t])=>{var o;return (o=this.lc_serializable_keys)==null?void 0:o.includes(t)})):this.lc_kwargs=r!=null?r:{};}toJSON(){if(!this.lc_serializable)return this.toJSONNotImplemented();if(this.lc_kwargs instanceof a||typeof this.lc_kwargs!="object"||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();let r={},e={},t=Object.keys(this.lc_kwargs).reduce((o,n)=>(o[n]=n in this?this[n]:this.lc_kwargs[n],o),{});for(let o=Object.getPrototypeOf(this);o;o=Object.getPrototypeOf(o))Object.assign(r,Reflect.get(o,"lc_aliases",this)),Object.assign(e,Reflect.get(o,"lc_secrets",this)),Object.assign(t,Reflect.get(o,"lc_attributes",this));return Object.keys(e).forEach(o=>{let n=this,s=t,[c,...l]=o.split(".").reverse();for(let u of l.reverse()){if(!(u in n)||n[u]===void 0)return;(!(u in s)||s[u]===void 0)&&(typeof n[u]=="object"&&n[u]!=null?s[u]={}:Array.isArray(n[u])&&(s[u]=[])),n=n[u],s=s[u];}c in n&&n[c]!==void 0&&(s[c]=s[c]||n[c]);}),{lc:1,type:"constructor",id:this.lc_id,kwargs:Rl(Object.keys(e).length?ef(t,e):t,xl,r)}}toJSONNotImplemented(){return {lc:1,type:"not_implemented",id:this.lc_id}}};var oa=()=>typeof Deno!="undefined";function we(a){var r;try{return typeof process!="undefined"?(r=process.env)==null?void 0:r[a]:oa()?Deno==null?void 0:Deno.env.get(a):void 0}catch{return}}var aa=class{};var Ue=class a extends aa{get lc_namespace(){return ["langchain_core","callbacks",this.name]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}static lc_name(){return this.name}get lc_id(){return [...this.lc_namespace,ta(this.constructor)]}constructor(r){var e,t,o,n,s,c,l;super(),Object.defineProperty(this,"lc_serializable",{enumerable:true,configurable:true,writable:true,value:false}),Object.defineProperty(this,"lc_kwargs",{enumerable:true,configurable:true,writable:true,value:void 0}),Object.defineProperty(this,"ignoreLLM",{enumerable:true,configurable:true,writable:true,value:false}),Object.defineProperty(this,"ignoreChain",{enumerable:true,configurable:true,writable:true,value:false}),Object.defineProperty(this,"ignoreAgent",{enumerable:true,configurable:true,writable:true,value:false}),Object.defineProperty(this,"ignoreRetriever",{enumerable:true,configurable:true,writable:true,value:false}),Object.defineProperty(this,"ignoreCustomEvent",{enumerable:true,configurable:true,writable:true,value:false}),Object.defineProperty(this,"raiseError",{enumerable:true,configurable:true,writable:true,value:false}),Object.defineProperty(this,"awaitHandlers",{enumerable:true,configurable:true,writable:true,value:we("LANGCHAIN_CALLBACKS_BACKGROUND")==="false"}),this.lc_kwargs=r||{},r&&(this.ignoreLLM=(e=r.ignoreLLM)!=null?e:this.ignoreLLM,this.ignoreChain=(t=r.ignoreChain)!=null?t:this.ignoreChain,this.ignoreAgent=(o=r.ignoreAgent)!=null?o:this.ignoreAgent,this.ignoreRetriever=(n=r.ignoreRetriever)!=null?n:this.ignoreRetriever,this.ignoreCustomEvent=(s=r.ignoreCustomEvent)!=null?s:this.ignoreCustomEvent,this.raiseError=(c=r.raiseError)!=null?c:this.raiseError,this.awaitHandlers=this.raiseError||((l=r._awaitHandler)!=null?l:this.awaitHandlers));}copy(){return new this.constructor(this)}toJSON(){return We.prototype.toJSON.call(this)}toJSONNotImplemented(){return We.prototype.toJSONNotImplemented.call(this)}static fromMethods(r){class e extends a{constructor(){super(),Object.defineProperty(this,"name",{enumerable:true,configurable:true,writable:true,value:xr__namespace.v4()}),Object.assign(this,r);}}return new e}};var cf="~/.opik.config",lf={apiKey:"",apiUrl:"http://localhost:5173/api",projectName:"Default Project",workspaceName:"default"};function Pl(a){return Object.fromEntries(Object.entries(a).filter(([,r])=>r!==void 0))}function pf(){return Pl({apiKey:process.env.OPIK_API_KEY,apiUrl:process.env.OPIK_URL_OVERRIDE,projectName:process.env.OPIK_PROJECT_NAME,workspaceName:process.env.OPIK_WORKSPACE})}function uf(){let a=process.env.OPIK_CONFIG_PATH||cf;if(!Tl__default.default.existsSync(a)){if(process.env.OPIK_CONFIG_PATH)throw new Error(`Config file not found at ${a}`);return {}}try{let r=sf__default.default.parse(Tl__default.default.readFileSync(a,"utf8"));return r.opik?Pl({apiKey:r.opik.api_key,apiUrl:r.opik.url_override,projectName:r.opik.project_name,workspaceName:r.opik.workspace}):{}}catch(r){return U.error(`Error loading config file ${a}: ${r}`),{}}}function Cl(a){let r=pf(),e=uf();return mf({...lf,...e,...r,...a})}function mf(a){if(!a.apiUrl)throw new Error("OPIK_URL_OVERRIDE is not set");let r=df(a.apiUrl);if(r&&!a.apiKey)throw new Error("OPIK_API_KEY is not set");if(r&&(!a.workspaceName||a.workspaceName==="default"))throw new Error("OPIK_WORKSPACE is not set");return a}function df(a){return new URL(a).hostname.endsWith("comet.com")}var ye={};$(ye,{AssistantMessageRole:()=>xf,AttachmentListRequestEntityType:()=>jl,BadRequestError:()=>X,ColumnCompareTypesItem:()=>Tf,ColumnPublicTypesItem:()=>If,ColumnTypesItem:()=>Nf,CompleteMultipartUploadRequestEntityType:()=>ff,ConflictError:()=>de,DatasetItemCompareSource:()=>Pf,DatasetItemPublicSource:()=>jf,DatasetItemSource:()=>Ef,DatasetItemWriteSource:()=>zf,DeleteAttachmentsRequestEntityType:()=>hf,DeltaRole:()=>Rf,DownloadAttachmentRequestEntityType:()=>Il,FeedbackScoreBatchItemSource:()=>Kf,FeedbackScoreCompareSource:()=>Cf,FeedbackScorePublicSource:()=>Jf,FeedbackScoreSource:()=>Af,FindFeedbackDefinitionsRequestType:()=>Ml,FindFeedbackScoreNames1RequestType:()=>$l,ForbiddenError:()=>ie,GetSpanStatsRequestType:()=>Vl,GetSpansByProjectRequestType:()=>Bl,LlmAsJudgeMessagePublicRole:()=>_f,LlmAsJudgeMessageRole:()=>gf,LlmAsJudgeMessageWriteRole:()=>wf,LlmAsJudgeOutputSchemaPublicType:()=>Sf,LlmAsJudgeOutputSchemaType:()=>bf,LlmAsJudgeOutputSchemaWriteType:()=>yf,LogItemLevel:()=>kf,NotFoundError:()=>O,NotImplementedError:()=>jr,ProjectMetricRequestPublicInterval:()=>Ol,ProjectMetricRequestPublicMetricType:()=>Dl,ProjectMetricResponsePublicInterval:()=>Df,ProjectMetricResponsePublicMetricType:()=>Ff,PromptType:()=>Of,PromptVersionDetailType:()=>Bf,PromptVersionPublicType:()=>$f,PromptVersionType:()=>Lf,PromptWriteType:()=>Ll,ProviderApiKeyProvider:()=>Mf,ProviderApiKeyPublicProvider:()=>Uf,ProviderApiKeyWriteProvider:()=>Fl,ResponseFormatType:()=>vf,SpanFilterPublicOperator:()=>Xf,SpanPublicType:()=>Wf,SpanSearchStreamRequestPublicType:()=>Jl,SpanType:()=>Qe,SpanWriteType:()=>Vf,StartMultipartUploadRequestEntityType:()=>Nl,TraceFilterPublicOperator:()=>Gf,UnauthorizedError:()=>Y,UnprocessableEntityError:()=>xe,UploadAttachmentRequestEntityType:()=>Ul,attachments:()=>li,automationRuleEvaluators:()=>ca,chatCompletions:()=>la,check:()=>sa,datasets:()=>pa,experiments:()=>ua,feedbackDefinitions:()=>pi,llmProviderKey:()=>ui,openTelemetryIngestion:()=>ma,projects:()=>mi,prompts:()=>di,redirect:()=>fa,spans:()=>fi,systemUsage:()=>na,traces:()=>da});var li={};$(li,{AttachmentListRequestEntityType:()=>jl,DownloadAttachmentRequestEntityType:()=>Il,StartMultipartUploadRequestEntityType:()=>Nl,UploadAttachmentRequestEntityType:()=>Ul});var jl={Trace:"trace",Span:"span"};var Il={Trace:"trace",Span:"span"};var Nl={Trace:"trace",Span:"span"};var Ul={Trace:"trace",Span:"span"};var pi={};$(pi,{FindFeedbackDefinitionsRequestType:()=>Ml});var Ml={Numerical:"numerical",Categorical:"categorical"};var ui={};$(ui,{ProviderApiKeyWriteProvider:()=>Fl});var Fl={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter"};var mi={};$(mi,{ProjectMetricRequestPublicInterval:()=>Ol,ProjectMetricRequestPublicMetricType:()=>Dl});var Dl={FeedbackScores:"FEEDBACK_SCORES",TraceCount:"TRACE_COUNT",TokenUsage:"TOKEN_USAGE",Duration:"DURATION",Cost:"COST"};var Ol={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var di={};$(di,{PromptWriteType:()=>Ll});var Ll={Mustache:"mustache",Jinja2:"jinja2"};var fi={};$(fi,{FindFeedbackScoreNames1RequestType:()=>$l,GetSpanStatsRequestType:()=>Vl,GetSpansByProjectRequestType:()=>Bl,SpanSearchStreamRequestPublicType:()=>Jl});var Bl={General:"general",Tool:"tool",Llm:"llm"};var $l={General:"general",Tool:"tool",Llm:"llm"};var Vl={General:"general",Tool:"tool",Llm:"llm"};var Jl={General:"general",Tool:"tool",Llm:"llm"};var na={};var sa={};var ca={};var la={};var pa={};var ua={};var ma={};var da={};var fa={};var ff={Trace:"trace",Span:"span"};var hf={Trace:"trace",Span:"span"};var gf={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT"};var bf={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var wf={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT"};var yf={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var _f={System:"SYSTEM",User:"USER",Ai:"AI",ToolExecutionResult:"TOOL_EXECUTION_RESULT"};var Sf={Boolean:"BOOLEAN",Integer:"INTEGER",Double:"DOUBLE"};var kf={Info:"INFO",Warn:"WARN",Error:"ERROR",Debug:"DEBUG",Trace:"TRACE"};var xf={System:"system",User:"user",Assistant:"assistant",Tool:"tool",Function:"function"};var Rf={System:"system",User:"user",Assistant:"assistant",Tool:"tool",Function:"function"};var vf={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};var Ef={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var Af={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var zf={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var Tf={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var Pf={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var Cf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var jf={Manual:"manual",Trace:"trace",Span:"span",Sdk:"sdk"};var If={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var Nf={String:"string",Number:"number",Object:"object",Boolean:"boolean",Array:"array",Null:"null"};var Uf={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter"};var Mf={Openai:"openai",Anthropic:"anthropic",Gemini:"gemini",Openrouter:"openrouter"};var Ff={FeedbackScores:"FEEDBACK_SCORES",TraceCount:"TRACE_COUNT",TokenUsage:"TOKEN_USAGE",Duration:"DURATION",Cost:"COST"};var Df={Hourly:"HOURLY",Daily:"DAILY",Weekly:"WEEKLY"};var Of={Mustache:"mustache",Jinja2:"jinja2"};var Lf={Mustache:"mustache",Jinja2:"jinja2"};var Bf={Mustache:"mustache",Jinja2:"jinja2"};var $f={Mustache:"mustache",Jinja2:"jinja2"};var Qe={General:"general",Tool:"tool",Llm:"llm"};var Vf={General:"general",Tool:"tool",Llm:"llm"};var Jf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Wf={General:"general",Tool:"tool",Llm:"llm"};var Kf={Ui:"ui",Sdk:"sdk",OnlineScoring:"online_scoring"};var Xf={Contains:"contains",NotContains:"not_contains",StartsWith:"starts_with",EndsWith:"ends_with",EqualTo:"=",NotEquals:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",IsEmpty:"is_empty",IsNotEmpty:"is_not_empty"};var Gf={Contains:"contains",NotContains:"not_contains",StartsWith:"starts_with",EndsWith:"ends_with",EqualTo:"=",NotEquals:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",IsEmpty:"is_empty",IsNotEmpty:"is_not_empty"};var pr=(a,r,e)=>JSON.stringify(a,r,e);var m=class a extends Error{constructor({message:r,statusCode:e,body:t}){super(Hf({message:r,statusCode:e,body:t})),Object.setPrototypeOf(this,a.prototype),e!=null&&(this.statusCode=e),t!==void 0&&(this.body=t);}};function Hf({message:a,statusCode:r,body:e}){let t=[];return a!=null&&t.push(a),r!=null&&t.push(`Status code: ${r.toString()}`),e!=null&&t.push(`Body: ${pr(e,void 0,2)}`),t.join(`
|
|
2
|
-
`)}var y=class a extends Error{constructor(r){super(r),Object.setPrototypeOf(this,a.prototype);}};var Y=class a extends m{constructor(r){super({message:"UnauthorizedError",statusCode:401,body:r}),Object.setPrototypeOf(this,a.prototype);}};var ie=class a extends m{constructor(r){super({message:"ForbiddenError",statusCode:403,body:r}),Object.setPrototypeOf(this,a.prototype);}};var X=class a extends m{constructor(r){super({message:"BadRequestError",statusCode:400,body:r}),Object.setPrototypeOf(this,a.prototype);}};var O=class a extends m{constructor(r){super({message:"NotFoundError",statusCode:404,body:r}),Object.setPrototypeOf(this,a.prototype);}};var de=class a extends m{constructor(r){super({message:"ConflictError",statusCode:409,body:r}),Object.setPrototypeOf(this,a.prototype);}};var xe=class a extends m{constructor(r){super({message:"UnprocessableEntityError",statusCode:422,body:r}),Object.setPrototypeOf(this,a.prototype);}};var jr=class a extends m{constructor(r){super({message:"NotImplementedError",statusCode:501,body:r}),Object.setPrototypeOf(this,a.prototype);}};var _={Default:"http://localhost:5173/api"};function Wl(a,r){return Object.keys(r!=null?r:{}).length>0?`${a}?${Yf__default.default.stringify(r,{arrayFormat:"repeat"})}`:a}var g=Zf();function Zf(){var l,u,d,h,b;return typeof window!="undefined"&&typeof window.document!="undefined"?{type:"browser",version:window.navigator.userAgent}:typeof globalThis!="undefined"&&((l=globalThis==null?void 0:globalThis.navigator)==null?void 0:l.userAgent)==="Cloudflare-Workers"?{type:"workerd"}:typeof EdgeRuntime=="string"?{type:"edge-runtime"}:typeof self=="object"&&typeof(self==null?void 0:self.importScripts)=="function"&&(((u=self.constructor)==null?void 0:u.name)==="DedicatedWorkerGlobalScope"||((d=self.constructor)==null?void 0:d.name)==="ServiceWorkerGlobalScope"||((h=self.constructor)==null?void 0:h.name)==="SharedWorkerGlobalScope")?{type:"web-worker"}:typeof Deno!="undefined"&&typeof Deno.version!="undefined"&&typeof Deno.version.deno!="undefined"?{type:"deno",version:Deno.version.deno}:typeof Bun!="undefined"&&typeof Bun.version!="undefined"?{type:"bun",version:Bun.version}:typeof process!="undefined"&&"version"in process&&!!process.version&&"versions"in process&&!!((b=process.versions)!=null&&b.node)?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:typeof navigator!="undefined"&&(navigator==null?void 0:navigator.product)==="ReactNative"?{type:"react-native"}:{type:"unknown"}}async function Kl(){return g.type==="node"&&g.parsedVersion!=null&&g.parsedVersion>=18?fetch:g.type==="node"?(await import('node-fetch')).default:typeof fetch=="function"?fetch:(await import('node-fetch')).default}async function Xl({body:a,type:r}){return r.includes("json")?pr(a):a}async function ep(a){return g.type==="node"&&g.parsedVersion!=null&&g.parsedVersion>=18?new(await Promise.resolve().then(()=>(Hl(),Gl))).Node18UniversalStreamWrapper(a):g.type!=="node"&&typeof fetch=="function"?new(await Promise.resolve().then(()=>(Zl(),Yl))).UndiciStreamWrapper(a):new(await Promise.resolve().then(()=>(ql(),Ql))).NodePre18StreamWrapper(a)}async function rp(a,r){if(a.body!=null&&r==="blob")return await a.blob();if(a.body!=null&&r==="arrayBuffer")return await a.arrayBuffer();if(a.body!=null&&r==="sse")return a.body;if(a.body!=null&&r==="streaming")return ep(a.body);if(a.body!=null&&r==="text")return await a.text();{let e=await a.text();if(e.length>0)try{return JSON.parse(e)}catch{return {ok:false,error:{reason:"non-json",statusCode:a.status,rawBody:e}}}else return}}var Qf="timeout";function tp(a){let r=new AbortController,e=setTimeout(()=>r.abort(Qf),a);return {signal:r.signal,abortId:e}}function ip(...a){let r=a.length===1&&Array.isArray(a[0])?a[0]:a,e=new AbortController;for(let t of r){if(t.aborted){e.abort(t==null?void 0:t.reason);break}t.addEventListener("abort",()=>e.abort(t==null?void 0:t.reason),{signal:e.signal});}return e.signal}var op=async(a,r,e,t,o,n,s,c,l)=>{let u=[],d;if(n!=null){let{signal:w,abortId:x}=tp(n);d=x,u.push(w);}s!=null&&u.push(s);let h=ip(u),b=await a(r,{method:e,headers:t,body:o,signal:h,credentials:c?"include":void 0,duplex:l});return d!=null&&clearTimeout(d),b};function qf(a){let r=1+(Math.random()*2-1)*.2;return a*r}async function ap(a,r=2){let e=await a();for(let t=0;t<r&&([408,429].includes(e.status)||e.status>=500);++t){let o=Math.min(1e3*Math.pow(2,t),6e4),n=qf(o);await new Promise(s=>setTimeout(s,n)),e=await a();}return e}async function eh(a){let r={};if(a.body!==void 0&&a.contentType!=null&&(r["Content-Type"]=a.contentType),a.headers!=null)for(let[n,s]of Object.entries(a.headers))s!=null&&(r[n]=s);let e=Wl(a.url,a.queryParameters),t=await Xl({body:a.body,type:a.requestType==="json"?"json":"other"}),o=await Kl();try{let n=await ap(async()=>op(o,e,a.method,r,t,a.timeoutMs,a.abortSignal,a.withCredentials,a.duplex),a.maxRetries),s=await rp(n,a.responseType);return n.status>=200&&n.status<400?{ok:!0,body:s,headers:n.headers}:{ok:!1,error:{reason:"status-code",statusCode:n.status,body:s}}}catch(n){return a.abortSignal!=null&&a.abortSignal.aborted?{ok:false,error:{reason:"unknown",errorMessage:"The user aborted a request"}}:n instanceof Error&&n.name==="AbortError"?{ok:false,error:{reason:"timeout"}}:n instanceof Error?{ok:false,error:{reason:"unknown",errorMessage:n.message}}:{ok:false,error:{reason:"unknown",errorMessage:pr(n)}}}}var S=eh;var p={get:async a=>typeof a=="function"?a():a};var i={};$(i,{JsonError:()=>ur,ParseError:()=>mr,any:()=>_p,bigint:()=>sp,boolean:()=>Sp,booleanLiteral:()=>yp,date:()=>cp,discriminant:()=>Pp,enum_:()=>gi,getObjectLikeUtils:()=>Te,getObjectUtils:()=>qe,getSchemaUtils:()=>D,isProperty:()=>Xe,lazy:()=>lp,lazyObject:()=>gp,list:()=>wi,number:()=>kp,object:()=>bi,objectWithoutOptionalProperties:()=>hp,optional:()=>wa,property:()=>up,record:()=>Ep,set:()=>Ap,string:()=>xp,stringLiteral:()=>wp,transform:()=>ya,undiscriminatedUnion:()=>Tp,union:()=>jp,unknown:()=>Rp,withParsedProperties:()=>Sa});var P={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function F(a,r){return `Expected ${r}. Received ${rh(a)}.`}function rh(a){if(Array.isArray(a))return "list";if(a===null)return "null";if(a instanceof BigInt)return "BigInt";switch(typeof a){case "string":return `"${a}"`;case "bigint":case "number":case "boolean":case "undefined":return `${a}`}return typeof a}function Z(a){return {...a,json:np(a.json),parse:np(a.parse)}}function np(a){return (r,e)=>{let t=a(r,e),{skipValidation:o=false}=e!=null?e:{};return !t.ok&&o?(console.warn(["Failed to validate.",...t.errors.map(n=>" - "+(n.path.length>0?`${n.path.join(".")}: ${n.message}`:n.message))].join(`
|
|
3
|
-
`)),{ok:true,value:r}):t}}function hi(a){return a.path.length===0?a.message:`${a.path.join(" -> ")}: ${a.message}`}var ur=class a extends Error{constructor(e){super(e.map(hi).join("; "));this.errors=e;Object.setPrototypeOf(this,a.prototype);}};var mr=class a extends Error{constructor(e){super(e.map(hi).join("; "));this.errors=e;Object.setPrototypeOf(this,a.prototype);}};function D(a){return {nullable:()=>th(a),optional:()=>wa(a),optionalNullable:()=>ih(a),transform:r=>ya(a,r),parseOrThrow:(r,e)=>{let t=a.parse(r,e);if(t.ok)return t.value;throw new mr(t.errors)},jsonOrThrow:(r,e)=>{let t=a.json(r,e);if(t.ok)return t.value;throw new ur(t.errors)}}}function th(a){let r={parse:(e,t)=>e==null?{ok:true,value:null}:a.parse(e,t),json:(e,t)=>e==null?{ok:true,value:null}:a.json(e,t),getType:()=>P.NULLABLE};return {...r,...D(r)}}function wa(a){let r={parse:(e,t)=>e==null?{ok:true,value:void 0}:a.parse(e,t),json:(e,t)=>t!=null&&t.omitUndefined&&e===void 0?{ok:true,value:void 0}:e==null?{ok:true,value:null}:a.json(e,t),getType:()=>P.OPTIONAL};return {...r,...D(r)}}function ih(a){let r={parse:(e,t)=>e===void 0?{ok:true,value:void 0}:e===null?{ok:true,value:null}:a.parse(e,t),json:(e,t)=>e===void 0?{ok:true,value:void 0}:e===null?{ok:true,value:null}:a.json(e,t),getType:()=>P.OPTIONAL_NULLABLE};return {...r,...D(r)}}function ya(a,r){let e={parse:(t,o)=>{let n=a.parse(t,o);return n.ok?{ok:true,value:r.transform(n.value)}:n},json:(t,o)=>{let n=r.untransform(t);return a.json(n,o)},getType:()=>a.getType()};return {...e,...D(e)}}function sp(){let a={parse:(r,{breadcrumbsPrefix:e=[]}={})=>typeof r=="bigint"?{ok:true,value:r}:typeof r=="number"?{ok:true,value:BigInt(r)}:{ok:false,errors:[{path:e,message:F(r,"bigint | number")}]},json:(r,{breadcrumbsPrefix:e=[]}={})=>typeof r!="bigint"?{ok:false,errors:[{path:e,message:F(r,"bigint")}]}:{ok:true,value:r},getType:()=>P.BIGINT};return {...Z(a),...D(a)}}var oh=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function cp(){let a={parse:(r,{breadcrumbsPrefix:e=[]}={})=>typeof r!="string"?{ok:false,errors:[{path:e,message:F(r,"string")}]}:oh.test(r)?{ok:true,value:new Date(r)}:{ok:false,errors:[{path:e,message:F(r,"ISO 8601 date string")}]},json:(r,{breadcrumbsPrefix:e=[]}={})=>r instanceof Date?{ok:true,value:r.toISOString()}:{ok:false,errors:[{path:e,message:F(r,"Date object")}]},getType:()=>P.DATE};return {...Z(a),...D(a)}}function ae(a,r){return ()=>{let e={parse:r,json:r,getType:()=>a};return {...Z(e),...D(e)}}}function gi(a){let r=new Set(a);return ae(P.ENUM,(t,{allowUnrecognizedEnumValues:o,breadcrumbsPrefix:n=[]}={})=>typeof t!="string"?{ok:false,errors:[{path:n,message:F(t,"string")}]}:!r.has(t)&&!o?{ok:false,errors:[{path:n,message:F(t,"enum")}]}:{ok:true,value:t})()}function lp(a){let r=_a(a);return {...r,...D(r)}}function _a(a){return {parse:(r,e)=>dr(a).parse(r,e),json:(r,e)=>dr(a).json(r,e),getType:()=>dr(a).getType()}}function dr(a){let r=a;return r.__zurg_memoized==null&&(r.__zurg_memoized=a()),r.__zurg_memoized}function Ir(a){return Object.entries(a)}function Nr(a,r){let e=new Set(r);return Object.entries(a).reduce((t,[o,n])=>(e.has(o)&&(t[o]=n),t),{})}function Ke(a){if(typeof a!="object"||a===null)return false;if(Object.getPrototypeOf(a)===null)return true;let r=a;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(a)===r}function Ur(a){return Object.keys(a)}function pp(a,r){let e=[],t=[];for(let o of a)r(o)?e.push(o):t.push(o);return [e,t]}function Te(a){return {withParsedProperties:r=>Sa(a,r)}}function Sa(a,r){let e={parse:(t,o)=>{let n=a.parse(t,o);if(!n.ok)return n;let s=Object.entries(r).reduce((c,[l,u])=>({...c,[l]:typeof u=="function"?u(n.value):u}),{});return {ok:true,value:{...n.value,...s}}},json:(t,o)=>{var c;if(!Ke(t))return {ok:false,errors:[{path:(c=o==null?void 0:o.breadcrumbsPrefix)!=null?c:[],message:F(t,"object")}]};let n=new Set(Object.keys(r)),s=Nr(t,Object.keys(t).filter(l=>!n.has(l)));return a.json(s,o)},getType:()=>a.getType()};return {...e,...D(e),...Te(e)}}function up(a,r){return {rawKey:a,valueSchema:r,isProperty:true}}function Xe(a){return a.isProperty}function bi(a){let r={_getRawProperties:()=>Object.entries(a).map(([e,t])=>Xe(t)?t.rawKey:e),_getParsedProperties:()=>Ur(a),parse:(e,t)=>{let o={},n=[];for(let[s,c]of Ir(a)){let l=Xe(c)?c.rawKey:s,u=Xe(c)?c.valueSchema:c,d={rawKey:l,parsedKey:s,valueSchema:u};o[l]=d,fp(u)&&n.push(l);}return mp({value:e,requiredKeys:n,getProperty:s=>{let c=o[s];if(c!=null)return {transformedKey:c.parsedKey,transform:l=>{var u;return c.valueSchema.parse(l,{...t,breadcrumbsPrefix:[...(u=t==null?void 0:t.breadcrumbsPrefix)!=null?u:[],s]})}}},unrecognizedObjectKeys:t==null?void 0:t.unrecognizedObjectKeys,skipValidation:t==null?void 0:t.skipValidation,breadcrumbsPrefix:t==null?void 0:t.breadcrumbsPrefix,omitUndefined:t==null?void 0:t.omitUndefined})},json:(e,t)=>{let o=[];for(let[n,s]of Ir(a)){let c=Xe(s)?s.valueSchema:s;fp(c)&&o.push(n);}return mp({value:e,requiredKeys:o,getProperty:n=>{let s=a[n];if(s!=null)return Xe(s)?{transformedKey:s.rawKey,transform:c=>{var l;return s.valueSchema.json(c,{...t,breadcrumbsPrefix:[...(l=t==null?void 0:t.breadcrumbsPrefix)!=null?l:[],n]})}}:{transformedKey:n,transform:c=>{var l;return s.json(c,{...t,breadcrumbsPrefix:[...(l=t==null?void 0:t.breadcrumbsPrefix)!=null?l:[],n]})}}},unrecognizedObjectKeys:t==null?void 0:t.unrecognizedObjectKeys,skipValidation:t==null?void 0:t.skipValidation,breadcrumbsPrefix:t==null?void 0:t.breadcrumbsPrefix,omitUndefined:t==null?void 0:t.omitUndefined})},getType:()=>P.OBJECT};return {...Z(r),...D(r),...Te(r),...qe(r)}}function mp({value:a,requiredKeys:r,getProperty:e,unrecognizedObjectKeys:t="fail",skipValidation:o=false,breadcrumbsPrefix:n=[]}){if(!Ke(a))return {ok:false,errors:[{path:n,message:F(a,"object")}]};let s=new Set(r),c=[],l={};for(let[u,d]of Object.entries(a)){let h=e(u);if(h!=null){s.delete(u);let b=h.transform(d);b.ok?l[h.transformedKey]=b.value:(l[u]=d,c.push(...b.errors));}else switch(t){case "fail":c.push({path:[...n,u],message:`Unexpected key "${u}"`});break;case "strip":break;case "passthrough":l[u]=d;break}}return c.push(...r.filter(u=>s.has(u)).map(u=>({path:n,message:`Missing required key "${u}"`}))),c.length===0||o?{ok:true,value:l}:{ok:false,errors:c}}function qe(a){return {extend:r=>{let e={_getParsedProperties:()=>[...a._getParsedProperties(),...r._getParsedProperties()],_getRawProperties:()=>[...a._getRawProperties(),...r._getRawProperties()],parse:(t,o)=>dp({extensionKeys:r._getRawProperties(),value:t,transformBase:n=>a.parse(n,o),transformExtension:n=>r.parse(n,o)}),json:(t,o)=>dp({extensionKeys:r._getParsedProperties(),value:t,transformBase:n=>a.json(n,o),transformExtension:n=>r.json(n,o)}),getType:()=>P.OBJECT};return {...e,...D(e),...Te(e),...qe(e)}},passthrough:()=>{let r={_getParsedProperties:()=>a._getParsedProperties(),_getRawProperties:()=>a._getRawProperties(),parse:(e,t)=>{let o=a.parse(e,{...t,unrecognizedObjectKeys:"passthrough"});return o.ok?{ok:true,value:{...e,...o.value}}:o},json:(e,t)=>{let o=a.json(e,{...t,unrecognizedObjectKeys:"passthrough"});return o.ok?{ok:true,value:{...e,...o.value}}:o},getType:()=>P.OBJECT};return {...r,...D(r),...Te(r),...qe(r)}}}}function dp({extensionKeys:a,value:r,transformBase:e,transformExtension:t}){let o=new Set(a),[n,s]=pp(Ur(r),u=>o.has(u)),c=e(Nr(r,s)),l=t(Nr(r,n));return c.ok&&l.ok?{ok:true,value:{...c.value,...l.value}}:{ok:false,errors:[...c.ok?[]:c.errors,...l.ok?[]:l.errors]}}function fp(a){return !ah(a)}function ah(a){switch(a.getType()){case P.ANY:case P.UNKNOWN:case P.OPTIONAL:case P.OPTIONAL_NULLABLE:return true;default:return false}}function hp(a){return bi(a)}function gp(a){let r={..._a(a),_getRawProperties:()=>dr(a)._getRawProperties(),_getParsedProperties:()=>dr(a)._getParsedProperties()};return {...r,...D(r),...Te(r),...qe(r)}}function wi(a){let r={parse:(e,t)=>bp(e,(o,n)=>{var s;return a.parse(o,{...t,breadcrumbsPrefix:[...(s=t==null?void 0:t.breadcrumbsPrefix)!=null?s:[],`[${n}]`]})}),json:(e,t)=>bp(e,(o,n)=>{var s;return a.json(o,{...t,breadcrumbsPrefix:[...(s=t==null?void 0:t.breadcrumbsPrefix)!=null?s:[],`[${n}]`]})}),getType:()=>P.LIST};return {...Z(r),...D(r)}}function bp(a,r){return Array.isArray(a)?a.map((t,o)=>r(t,o)).reduce((t,o)=>{if(t.ok&&o.ok)return {ok:true,value:[...t.value,o.value]};let n=[];return t.ok||n.push(...t.errors),o.ok||n.push(...o.errors),{ok:false,errors:n}},{ok:true,value:[]}):{ok:false,errors:[{message:F(a,"list"),path:[]}]}}function wp(a){return ae(P.STRING_LITERAL,(e,{breadcrumbsPrefix:t=[]}={})=>e===a?{ok:true,value:a}:{ok:false,errors:[{path:t,message:F(e,`"${a}"`)}]})()}function yp(a){return ae(P.BOOLEAN_LITERAL,(e,{breadcrumbsPrefix:t=[]}={})=>e===a?{ok:true,value:a}:{ok:false,errors:[{path:t,message:F(e,`${a.toString()}`)}]})()}var _p=ae(P.ANY,a=>({ok:true,value:a}));var Sp=ae(P.BOOLEAN,(a,{breadcrumbsPrefix:r=[]}={})=>typeof a=="boolean"?{ok:true,value:a}:{ok:false,errors:[{path:r,message:F(a,"boolean")}]});var kp=ae(P.NUMBER,(a,{breadcrumbsPrefix:r=[]}={})=>typeof a=="number"?{ok:true,value:a}:{ok:false,errors:[{path:r,message:F(a,"number")}]});var xp=ae(P.STRING,(a,{breadcrumbsPrefix:r=[]}={})=>typeof a=="string"?{ok:true,value:a}:{ok:false,errors:[{path:r,message:F(a,"string")}]});var Rp=ae(P.UNKNOWN,a=>({ok:true,value:a}));function Ep(a,r){let e={parse:(t,o)=>vp({value:t,isKeyNumeric:a.getType()===P.NUMBER,transformKey:n=>{var s;return a.parse(n,{...o,breadcrumbsPrefix:[...(s=o==null?void 0:o.breadcrumbsPrefix)!=null?s:[],`${n} (key)`]})},transformValue:(n,s)=>{var c;return r.parse(n,{...o,breadcrumbsPrefix:[...(c=o==null?void 0:o.breadcrumbsPrefix)!=null?c:[],`${s}`]})},breadcrumbsPrefix:o==null?void 0:o.breadcrumbsPrefix}),json:(t,o)=>vp({value:t,isKeyNumeric:a.getType()===P.NUMBER,transformKey:n=>{var s;return a.json(n,{...o,breadcrumbsPrefix:[...(s=o==null?void 0:o.breadcrumbsPrefix)!=null?s:[],`${n} (key)`]})},transformValue:(n,s)=>{var c;return r.json(n,{...o,breadcrumbsPrefix:[...(c=o==null?void 0:o.breadcrumbsPrefix)!=null?c:[],`${s}`]})},breadcrumbsPrefix:o==null?void 0:o.breadcrumbsPrefix}),getType:()=>P.RECORD};return {...Z(e),...D(e)}}function vp({value:a,isKeyNumeric:r,transformKey:e,transformValue:t,breadcrumbsPrefix:o=[]}){return Ke(a)?Ir(a).reduce((n,[s,c])=>{if(c===void 0)return n;let l=n,u=s;if(r){let w=s.length>0?Number(s):NaN;isNaN(w)||(u=w);}let d=e(u),h=t(c,u);if(l.ok&&d.ok&&h.ok)return {ok:true,value:{...l.value,[d.value]:h.value}};let b=[];return l.ok||b.push(...l.errors),d.ok||b.push(...d.errors),h.ok||b.push(...h.errors),{ok:false,errors:b}},{ok:true,value:{}}):{ok:false,errors:[{path:o,message:F(a,"object")}]}}function Ap(a){let r=wi(a),e={parse:(t,o)=>{let n=r.parse(t,o);return n.ok?{ok:true,value:new Set(n.value)}:n},json:(t,o)=>{var s;return t instanceof Set?r.json([...t],o):{ok:false,errors:[{path:(s=o==null?void 0:o.breadcrumbsPrefix)!=null?s:[],message:F(t,"Set")}]}},getType:()=>P.SET};return {...Z(e),...D(e)}}function Tp(a){let r={parse:(e,t)=>zp((o,n)=>o.parse(e,n),a,t),json:(e,t)=>zp((o,n)=>o.json(e,n),a,t),getType:()=>P.UNDISCRIMINATED_UNION};return {...Z(r),...D(r)}}function zp(a,r,e){let t=[];for(let[o,n]of r.entries()){let s=a(n,{...e,skipValidation:false});if(s.ok)return s;for(let c of s.errors)t.push({path:c.path,message:`[Variant ${o}] ${c.message}`});}return {ok:false,errors:t}}function Pp(a,r){return {parsedDiscriminant:a,rawDiscriminant:r}}function jp(a,r){let e=typeof a=="string"?a:a.rawDiscriminant,t=typeof a=="string"?a:a.parsedDiscriminant,o=gi(Ur(r)),n={parse:(s,c)=>Cp({value:s,discriminant:e,transformedDiscriminant:t,transformDiscriminantValue:l=>{var u;return o.parse(l,{allowUnrecognizedEnumValues:c==null?void 0:c.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(u=c==null?void 0:c.breadcrumbsPrefix)!=null?u:[],e]})},getAdditionalPropertiesSchema:l=>r[l],allowUnrecognizedUnionMembers:c==null?void 0:c.allowUnrecognizedUnionMembers,transformAdditionalProperties:(l,u)=>u.parse(l,c),breadcrumbsPrefix:c==null?void 0:c.breadcrumbsPrefix}),json:(s,c)=>Cp({value:s,discriminant:t,transformedDiscriminant:e,transformDiscriminantValue:l=>{var u;return o.json(l,{allowUnrecognizedEnumValues:c==null?void 0:c.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(u=c==null?void 0:c.breadcrumbsPrefix)!=null?u:[],t]})},getAdditionalPropertiesSchema:l=>r[l],allowUnrecognizedUnionMembers:c==null?void 0:c.allowUnrecognizedUnionMembers,transformAdditionalProperties:(l,u)=>u.json(l,c),breadcrumbsPrefix:c==null?void 0:c.breadcrumbsPrefix}),getType:()=>P.UNION};return {...Z(n),...D(n),...Te(n)}}function Cp({value:a,discriminant:r,transformedDiscriminant:e,transformDiscriminantValue:t,getAdditionalPropertiesSchema:o,allowUnrecognizedUnionMembers:n=false,transformAdditionalProperties:s,breadcrumbsPrefix:c=[]}){if(!Ke(a))return {ok:false,errors:[{path:c,message:F(a,"object")}]};let{[r]:l,...u}=a;if(l==null)return {ok:false,errors:[{path:c,message:`Missing discriminant ("${r}")`}]};let d=t(l);if(!d.ok)return {ok:false,errors:d.errors};let h=o(d.value);if(h==null)return n?{ok:true,value:{[e]:d.value,...u}}:{ok:false,errors:[{path:[...c,r],message:"Unexpected discriminant value"}]};let b=s(u,h);return b.ok?{ok:true,value:{[e]:l,...b.value}}:b}function nh(a){var r=[];if(a.length===0)return "";if(typeof a[0]!="string")throw new TypeError("Url must be a string. Received "+a[0]);if(a[0].match(/^[^/:]+:\/*$/)&&a.length>1){var e=a.shift();a[0]=e+a[0];}a[0].match(/^file:\/\/\//)?a[0]=a[0].replace(/^([^/:]+):\/*/,"$1:///"):a[0]=a[0].replace(/^([^/:]+):\/*/,"$1://");for(var t=0;t<a.length;t++){var o=a[t];if(typeof o!="string")throw new TypeError("Url must be a string. Received "+o);o!==""&&(t>0&&(o=o.replace(/^[\/]+/,"")),t<a.length-1?o=o.replace(/[\/]+$/,""):o=o.replace(/[\/]+$/,"/"),r.push(o));}var n=r.join("/");n=n.replace(/\/(\?|&|#[^!])/g,"$1");var s=n.split("?");return n=s.shift()+(s.length>0?"?":"")+s.join("&"),n}function k(){var a;return typeof arguments[0]=="object"?a=arguments[0]:a=[].slice.call(arguments),nh(a)}var ne={};$(ne,{AssistantMessage:()=>jn,AssistantMessageRole:()=>Cn,Attachment:()=>Va,AttachmentListRequestEntityType:()=>yi,AttachmentPage:()=>Ja,AuthDetailsHolder:()=>Ha,AutomationRuleEvaluator:()=>mh,AutomationRuleEvaluatorLlmAsJudge:()=>tn,AutomationRuleEvaluatorLlmAsJudgePublic:()=>Rt,AutomationRuleEvaluatorLlmAsJudgeWrite:()=>un,AutomationRuleEvaluatorObjectPublic:()=>kn,AutomationRuleEvaluatorPagePublic:()=>xn,AutomationRuleEvaluatorPublic:()=>Rn,AutomationRuleEvaluatorUpdate:()=>Pn,AutomationRuleEvaluatorUpdateLlmAsJudge:()=>zn,AutomationRuleEvaluatorUpdateUserDefinedMetricPython:()=>Tn,AutomationRuleEvaluatorUserDefinedMetricPython:()=>on,AutomationRuleEvaluatorUserDefinedMetricPythonPublic:()=>vt,AutomationRuleEvaluatorUserDefinedMetricPythonWrite:()=>dn,AutomationRuleEvaluatorWrite:()=>fn,AvgValueStatPublic:()=>tc,BatchDelete:()=>Q,BiInformation:()=>Da,BiInformationResponse:()=>St,CategoricalFeedbackDefinition:()=>cs,CategoricalFeedbackDefinitionCreate:()=>ms,CategoricalFeedbackDefinitionPublic:()=>Tt,CategoricalFeedbackDefinitionUpdate:()=>ks,CategoricalFeedbackDetail:()=>ss,CategoricalFeedbackDetailCreate:()=>us,CategoricalFeedbackDetailPublic:()=>gs,CategoricalFeedbackDetailUpdate:()=>Ss,ChatCompletionChoice:()=>Un,ChatCompletionRequest:()=>dt,ChatCompletionResponse:()=>Dn,ChunkedOutputJsonNode:()=>hh,ChunkedOutputJsonNodePublic:()=>Eh,ChunkedOutputJsonNodePublicType:()=>pc,ChunkedOutputJsonNodeType:()=>os,Column:()=>ts,ColumnCompare:()=>$n,ColumnCompareTypesItem:()=>Bn,ColumnPublic:()=>qn,ColumnPublicTypesItem:()=>Qn,ColumnTypesItem:()=>rs,Comment:()=>q,CommentCompare:()=>Vn,CommentPublic:()=>rr,CompleteMultipartUploadRequest:()=>Ji,CompleteMultipartUploadRequestEntityType:()=>Wa,CompletionTokensDetails:()=>Mn,CountValueStatPublic:()=>ic,CreatePromptVersionDetail:()=>Jr,DataPointNumberPublic:()=>js,Dataset:()=>dh,DatasetIdentifier:()=>bt,DatasetIdentifierPublic:()=>yt,DatasetItem:()=>Ln,DatasetItemBatch:()=>fh,DatasetItemBatchWrite:()=>ht,DatasetItemCompare:()=>Gn,DatasetItemCompareSource:()=>Jn,DatasetItemPageCompare:()=>Hn,DatasetItemPagePublic:()=>es,DatasetItemPublic:()=>zt,DatasetItemPublicSource:()=>Zn,DatasetItemSource:()=>On,DatasetItemStreamRequest:()=>_t,DatasetItemWrite:()=>Fa,DatasetItemWriteSource:()=>Ma,DatasetItemsDelete:()=>wt,DatasetPagePublic:()=>Yn,DatasetPublic:()=>wr,DatasetUpdate:()=>gt,DatasetWrite:()=>ft,DeleteAttachmentsRequest:()=>uh,DeleteAttachmentsRequestEntityType:()=>Xa,DeleteFeedbackScore:()=>Nt,DeleteTraceThreads:()=>ct,Delta:()=>Nn,DeltaRole:()=>In,DownloadAttachmentRequestEntityType:()=>_i,ErrorInfo:()=>Fe,ErrorInfoPublic:()=>Ut,ErrorInfoWrite:()=>Xr,ErrorMessage:()=>fe,ErrorMessageDetail:()=>Rh,ErrorMessageDetailed:()=>kh,ErrorMessagePublic:()=>bh,Experiment:()=>gh,ExperimentItem:()=>qr,ExperimentItemCompare:()=>Xn,ExperimentItemPublic:()=>At,ExperimentItemStreamRequest:()=>ot,ExperimentItemsBatch:()=>et,ExperimentItemsDelete:()=>rt,ExperimentPagePublic:()=>ns,ExperimentPublic:()=>yr,ExperimentWrite:()=>Qr,ExperimentsDelete:()=>tt,ExportTraceServiceRequest:()=>_h,Feedback:()=>wh,FeedbackCreate:()=>hs,FeedbackDefinitionPagePublic:()=>ys,FeedbackObjectPublic:()=>ws,FeedbackPublic:()=>_s,FeedbackScore:()=>Pe,FeedbackScoreAverage:()=>er,FeedbackScoreAverageDetailed:()=>Os,FeedbackScoreAveragePublic:()=>as,FeedbackScoreBatch:()=>Ot,FeedbackScoreBatchItem:()=>lc,FeedbackScoreBatchItemSource:()=>cc,FeedbackScoreCompare:()=>Kn,FeedbackScoreCompareSource:()=>Wn,FeedbackScoreNames:()=>Cs,FeedbackScorePublic:()=>Mt,FeedbackScorePublicSource:()=>qs,FeedbackScoreSource:()=>Aa,FeedbackUpdate:()=>vs,FindFeedbackDefinitionsRequestType:()=>Ri,FindFeedbackScoreNames1RequestType:()=>Ni,Function:()=>mt,FunctionCall:()=>De,GetSpanStatsRequestType:()=>Ui,GetSpansByProjectRequestType:()=>Ii,IdentifierPublic:()=>it,JsonNode:()=>I,JsonNodeCompare:()=>Wi,JsonNodeDetail:()=>ka,JsonNodePublic:()=>Se,JsonNodeWrite:()=>_e,JsonObjectSchema:()=>ut,JsonSchema:()=>Ia,JsonSchemaElement:()=>Bi,LlmAsJudgeCode:()=>kt,LlmAsJudgeCodePublic:()=>_n,LlmAsJudgeCodeWrite:()=>pn,LlmAsJudgeMessage:()=>qa,LlmAsJudgeMessagePublic:()=>bn,LlmAsJudgeMessagePublicRole:()=>gn,LlmAsJudgeMessageRole:()=>Qa,LlmAsJudgeMessageWrite:()=>sn,LlmAsJudgeMessageWriteRole:()=>nn,LlmAsJudgeModelParameters:()=>Za,LlmAsJudgeModelParametersPublic:()=>hn,LlmAsJudgeModelParametersWrite:()=>an,LlmAsJudgeOutputSchema:()=>rn,LlmAsJudgeOutputSchemaPublic:()=>yn,LlmAsJudgeOutputSchemaPublicType:()=>wn,LlmAsJudgeOutputSchemaType:()=>en,LlmAsJudgeOutputSchemaWrite:()=>ln,LlmAsJudgeOutputSchemaWriteType:()=>cn,LogItem:()=>En,LogItemLevel:()=>vn,LogPage:()=>An,Message:()=>Pa,MultipartUploadPart:()=>Ka,NumericalFeedbackDefinition:()=>ps,NumericalFeedbackDefinitionCreate:()=>fs,NumericalFeedbackDefinitionPublic:()=>Pt,NumericalFeedbackDefinitionUpdate:()=>Rs,NumericalFeedbackDetail:()=>ls,NumericalFeedbackDetailCreate:()=>ds,NumericalFeedbackDetailPublic:()=>bs,NumericalFeedbackDetailUpdate:()=>xs,PageColumns:()=>is,PercentageValueStatPublic:()=>ac,PercentageValues:()=>jt,PercentageValuesDetailed:()=>Ls,PercentageValuesPublic:()=>oc,Project:()=>Sh,ProjectDetailed:()=>Bs,ProjectMetricRequestPublic:()=>Br,ProjectMetricRequestPublicInterval:()=>Ti,ProjectMetricRequestPublicMetricType:()=>zi,ProjectMetricResponsePublic:()=>Ms,ProjectMetricResponsePublicInterval:()=>Ns,ProjectMetricResponsePublicMetricType:()=>Is,ProjectPagePublic:()=>Ts,ProjectPublic:()=>It,ProjectRetrieveDetailed:()=>$r,ProjectStatItemObjectPublic:()=>sc,ProjectStatsPublic:()=>Dt,ProjectStatsSummary:()=>Ds,ProjectStatsSummaryItem:()=>Fs,ProjectUpdate:()=>Lr,ProjectWrite:()=>Or,Prompt:()=>xh,PromptDetail:()=>Ws,PromptPagePublic:()=>Ys,PromptPublic:()=>Hs,PromptType:()=>$s,PromptUpdatable:()=>Wr,PromptVersion:()=>Js,PromptVersionDetail:()=>Me,PromptVersionDetailType:()=>xa,PromptVersionLink:()=>Ki,PromptVersionLinkPublic:()=>Xi,PromptVersionLinkWrite:()=>Oi,PromptVersionPagePublic:()=>Gs,PromptVersionPublic:()=>Xs,PromptVersionPublicType:()=>Ks,PromptVersionRetrieveDetail:()=>Kr,PromptVersionType:()=>Vs,PromptWrite:()=>Vr,PromptWriteType:()=>Ci,ProviderApiKey:()=>yh,ProviderApiKeyPagePublic:()=>As,ProviderApiKeyProvider:()=>zs,ProviderApiKeyPublic:()=>Ct,ProviderApiKeyPublicProvider:()=>Es,ProviderApiKeyUpdate:()=>Dr,ProviderApiKeyWrite:()=>Fr,ProviderApiKeyWriteProvider:()=>Ei,ResponseFormat:()=>Na,ResponseFormatType:()=>ja,ResultsNumberPublic:()=>Us,ScoreName:()=>Ps,Span:()=>Qs,SpanBatch:()=>vh,SpanBatchWrite:()=>Hr,SpanFilterPublic:()=>Ea,SpanFilterPublicOperator:()=>va,SpanPagePublic:()=>rc,SpanPublic:()=>Ft,SpanPublicType:()=>ec,SpanSearchStreamRequestPublic:()=>Zr,SpanSearchStreamRequestPublicType:()=>Mi,SpanType:()=>Zs,SpanUpdate:()=>Yr,SpanWrite:()=>Gr,SpanWriteType:()=>Ra,SpansCountResponse:()=>La,StartMultipartUploadRequest:()=>Mr,StartMultipartUploadRequestEntityType:()=>Si,StartMultipartUploadResponse:()=>Ga,StreamOptions:()=>Ca,Tool:()=>Ua,ToolCall:()=>Et,Trace:()=>uc,TraceBatch:()=>Ah,TraceBatchWrite:()=>nt,TraceCountResponse:()=>$a,TraceFilterPublic:()=>Ta,TraceFilterPublicOperator:()=>za,TracePagePublic:()=>dc,TracePublic:()=>Lt,TraceSearchStreamRequestPublic:()=>pt,TraceThread:()=>Bt,TraceThreadIdentifier:()=>lt,TraceThreadPage:()=>mc,TraceUpdate:()=>st,TraceWrite:()=>at,UploadAttachmentRequestEntityType:()=>ki,Usage:()=>Fn,UserDefinedMetricPythonCode:()=>xt,UserDefinedMetricPythonCodePublic:()=>Sn,UserDefinedMetricPythonCodeWrite:()=>mn,WorkspaceNameHolder:()=>Ya,WorkspaceSpansCount:()=>Oa,WorkspaceTraceCount:()=>Ba,attachments:()=>fr,chatCompletions:()=>$i,datasets:()=>Vi,experiments:()=>gr,feedbackDefinitions:()=>vi,llmProviderKey:()=>Ai,projects:()=>Pi,prompts:()=>ji,spans:()=>hr,traces:()=>br});var fr={};$(fr,{AttachmentListRequestEntityType:()=>yi,DownloadAttachmentRequestEntityType:()=>_i,StartMultipartUploadRequest:()=>Mr,StartMultipartUploadRequestEntityType:()=>Si,UploadAttachmentRequestEntityType:()=>ki,uploadAttachment:()=>xi});var yi=i.enum_(["trace","span"]);var _i=i.enum_(["trace","span"]);var Si=i.enum_(["trace","span"]);var ki=i.enum_(["trace","span"]);var xi={};$(xi,{Request:()=>sh});var sh=i.record(i.string(),i.unknown());var Mr=i.object({fileName:i.property("file_name",i.string()),numOfFileParts:i.property("num_of_file_parts",i.number()),mimeType:i.property("mime_type",i.string().optional()),projectName:i.property("project_name",i.string().optional()),entityType:i.property("entity_type",Si),entityId:i.property("entity_id",i.string()),path:i.string()});var vi={};$(vi,{FindFeedbackDefinitionsRequestType:()=>Ri});var Ri=i.enum_(["numerical","categorical"]);var Ai={};$(Ai,{ProviderApiKeyUpdate:()=>Dr,ProviderApiKeyWrite:()=>Fr,ProviderApiKeyWriteProvider:()=>Ei});var Ei=i.enum_(["openai","anthropic","gemini","openrouter"]);var Fr=i.object({provider:Ei,apiKey:i.property("api_key",i.string()),name:i.string().optional()});var Dr=i.object({apiKey:i.property("api_key",i.string()),name:i.string().optional()});var Pi={};$(Pi,{ProjectMetricRequestPublic:()=>Br,ProjectMetricRequestPublicInterval:()=>Ti,ProjectMetricRequestPublicMetricType:()=>zi,ProjectRetrieveDetailed:()=>$r,ProjectUpdate:()=>Lr,ProjectWrite:()=>Or});var zi=i.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST"]);var Ti=i.enum_(["HOURLY","DAILY","WEEKLY"]);var Or=i.object({name:i.string(),description:i.string().optional()});var Lr=i.object({name:i.string().optional(),description:i.string().optional()});var Br=i.object({metricType:i.property("metric_type",zi.optional()),interval:Ti.optional(),intervalStart:i.property("interval_start",i.date().optional()),intervalEnd:i.property("interval_end",i.date().optional())});var $r=i.object({name:i.string()});var ji={};$(ji,{CreatePromptVersionDetail:()=>Jr,PromptUpdatable:()=>Wr,PromptVersionRetrieveDetail:()=>Kr,PromptWrite:()=>Vr,PromptWriteType:()=>Ci});var Ci=i.enum_(["mustache","jinja2"]);var _e=i.record(i.string(),i.unknown());var Vr=i.object({id:i.string().optional(),name:i.string(),description:i.string().optional(),template:i.string().optional(),metadata:_e.optional(),changeDescription:i.property("change_description",i.string().optional()),type:Ci.optional()});var ka=i.record(i.string(),i.unknown());var xa=i.enum_(["mustache","jinja2"]);var Me=i.object({id:i.string().optional(),promptId:i.property("prompt_id",i.string().optional()),commit:i.string().optional(),template:i.string(),metadata:ka.optional(),type:xa.optional(),changeDescription:i.property("change_description",i.string().optional()),variables:i.list(i.string()).optional(),createdAt:i.property("created_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional())});var Jr=i.object({name:i.string(),version:Me});var Wr=i.object({name:i.string(),description:i.string().optional()});var Kr=i.object({name:i.string(),commit:i.string().optional()});var hr={};$(hr,{FindFeedbackScoreNames1RequestType:()=>Ni,GetSpanStatsRequestType:()=>Ui,GetSpansByProjectRequestType:()=>Ii,SpanBatchWrite:()=>Hr,SpanSearchStreamRequestPublic:()=>Zr,SpanSearchStreamRequestPublicType:()=>Mi,SpanUpdate:()=>Yr,findFeedbackScoreNames1:()=>Fi});var Ii=i.enum_(["general","tool","llm"]);var Ni=i.enum_(["general","tool","llm"]);var Ui=i.enum_(["general","tool","llm"]);var Mi=i.enum_(["general","tool","llm"]);var Fi={};$(Fi,{Response:()=>ch});var ch=i.list(i.string());var Ra=i.enum_(["general","tool","llm"]);var Xr=i.object({exceptionType:i.property("exception_type",i.string()),message:i.string().optional(),traceback:i.string()});var Gr=i.object({id:i.string().optional(),projectName:i.property("project_name",i.string().optional()),traceId:i.property("trace_id",i.string()),parentSpanId:i.property("parent_span_id",i.string().optional()),name:i.string(),type:Ra,startTime:i.property("start_time",i.date()),endTime:i.property("end_time",i.date().optional()),input:_e.optional(),output:_e.optional(),metadata:_e.optional(),model:i.string().optional(),provider:i.string().optional(),tags:i.list(i.string()).optional(),usage:i.record(i.string(),i.number()).optional(),errorInfo:i.property("error_info",Xr.optional()),totalEstimatedCost:i.property("total_estimated_cost",i.number().optional()),totalEstimatedCostVersion:i.property("total_estimated_cost_version",i.string().optional())});var Hr=i.object({spans:i.list(Gr)});var I=i.record(i.string(),i.unknown());var Fe=i.object({exceptionType:i.property("exception_type",i.string()),message:i.string().optional(),traceback:i.string()});var Yr=i.object({projectName:i.property("project_name",i.string().optional()),projectId:i.property("project_id",i.string().optional()),traceId:i.property("trace_id",i.string()),parentSpanId:i.property("parent_span_id",i.string().optional()),endTime:i.property("end_time",i.date().optional()),input:I.optional(),output:I.optional(),metadata:I.optional(),model:i.string().optional(),provider:i.string().optional(),tags:i.list(i.string()).optional(),usage:i.record(i.string(),i.number()).optional(),totalEstimatedCost:i.property("total_estimated_cost",i.number().optional()),errorInfo:i.property("error_info",Fe.optional())});var va=i.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Ea=i.object({field:i.string().optional(),operator:va.optional(),key:i.string().optional(),value:i.string().optional()});var Zr=i.object({traceId:i.property("trace_id",i.string().optional()),projectName:i.property("project_name",i.string().optional()),projectId:i.property("project_id",i.string().optional()),type:Mi.optional(),filters:i.list(Ea).optional(),limit:i.number().optional(),lastRetrievedId:i.property("last_retrieved_id",i.string().optional()),truncate:i.boolean().optional()});var gr={};$(gr,{ExperimentItemStreamRequest:()=>ot,ExperimentItemsBatch:()=>et,ExperimentItemsDelete:()=>rt,ExperimentWrite:()=>Qr,ExperimentsDelete:()=>tt,IdentifierPublic:()=>it,findFeedbackScoreNames:()=>Di});var Di={};$(Di,{Response:()=>lh});var lh=i.list(i.string());var Oi=i.object({id:i.string()});var Qr=i.object({id:i.string().optional(),datasetName:i.property("dataset_name",i.string()),name:i.string().optional(),metadata:_e.optional(),promptVersion:i.property("prompt_version",Oi.optional()),promptVersions:i.property("prompt_versions",i.list(Oi).optional())});var Aa=i.enum_(["ui","sdk","online_scoring"]);var Pe=i.object({name:i.string(),categoryName:i.property("category_name",i.string().optional()),value:i.number(),reason:i.string().optional(),source:Aa,createdAt:i.property("created_at",i.date().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional())});var q=i.object({id:i.string().optional(),text:i.string(),createdAt:i.property("created_at",i.date().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional())});var qr=i.object({id:i.string().optional(),experimentId:i.property("experiment_id",i.string()),datasetItemId:i.property("dataset_item_id",i.string()),traceId:i.property("trace_id",i.string()),input:I.optional(),output:I.optional(),feedbackScores:i.property("feedback_scores",i.list(Pe).optional()),comments:i.list(q).optional(),createdAt:i.property("created_at",i.date().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional())});var et=i.object({experimentItems:i.property("experiment_items",i.list(qr))});var rt=i.object({ids:i.list(i.string())});var tt=i.object({ids:i.list(i.string())});var it=i.object({name:i.string()});var ot=i.object({experimentName:i.property("experiment_name",i.string()),limit:i.number().optional(),lastRetrievedId:i.property("last_retrieved_id",i.string().optional()),truncate:i.boolean().optional()});var br={};$(br,{DeleteTraceThreads:()=>ct,TraceBatchWrite:()=>nt,TraceSearchStreamRequestPublic:()=>pt,TraceThreadIdentifier:()=>lt,TraceUpdate:()=>st,findFeedbackScoreNames2:()=>Li});var Li={};$(Li,{Response:()=>ph});var ph=i.list(i.string());var at=i.object({id:i.string().optional(),projectName:i.property("project_name",i.string().optional()),name:i.string(),startTime:i.property("start_time",i.date()),endTime:i.property("end_time",i.date().optional()),input:_e.optional(),output:_e.optional(),metadata:_e.optional(),tags:i.list(i.string()).optional(),errorInfo:i.property("error_info",Xr.optional()),threadId:i.property("thread_id",i.string().optional())});var nt=i.object({traces:i.list(at)});var st=i.object({projectName:i.property("project_name",i.string().optional()),projectId:i.property("project_id",i.string().optional()),endTime:i.property("end_time",i.date().optional()),input:I.optional(),output:I.optional(),metadata:I.optional(),tags:i.list(i.string()).optional(),errorInfo:i.property("error_info",Fe.optional()),threadId:i.property("thread_id",i.string().optional())});var ct=i.object({projectName:i.property("project_name",i.string().optional()),projectId:i.property("project_id",i.string().optional()),threadIds:i.property("thread_ids",i.list(i.string()))});var lt=i.object({projectId:i.property("project_id",i.string()),threadId:i.property("thread_id",i.string())});var za=i.enum_(["contains","not_contains","starts_with","ends_with","=","!=",">",">=","<","<=","is_empty","is_not_empty"]);var Ta=i.object({field:i.string().optional(),operator:za.optional(),key:i.string().optional(),value:i.string().optional()});var pt=i.object({projectName:i.property("project_name",i.string().optional()),projectId:i.property("project_id",i.string().optional()),filters:i.list(Ta).optional(),lastRetrievedId:i.property("last_retrieved_id",i.string().optional()),limit:i.number().optional(),truncate:i.boolean().optional()});var $i={};$($i,{ChatCompletionRequest:()=>dt});var Pa=i.record(i.string(),i.unknown());var Ca=i.object({includeUsage:i.property("include_usage",i.boolean().optional())});var ja=i.enum_(["text","json_object","json_schema"]);var Bi=i.object({type:i.string().optional()});var ut=i.object({type:i.string().optional(),description:i.string().optional(),properties:i.record(i.string(),Bi).optional(),required:i.list(i.string()).optional(),additionalProperties:i.boolean().optional(),defs:i.property("$defs",i.record(i.string(),Bi).optional())});var Ia=i.object({name:i.string().optional(),strict:i.boolean().optional(),schema:ut.optional()});var Na=i.object({type:ja.optional(),jsonSchema:i.property("json_schema",Ia.optional())});var mt=i.object({name:i.string().optional(),description:i.string().optional(),strict:i.boolean().optional(),parameters:ut.optional()});var Ua=i.object({type:i.stringLiteral("function").optional(),function:mt.optional()});var De=i.object({name:i.string().optional(),arguments:i.string().optional()});var dt=i.object({model:i.string().optional(),messages:i.list(Pa).optional(),temperature:i.number().optional(),topP:i.property("top_p",i.number().optional()),n:i.number().optional(),stream:i.boolean().optional(),streamOptions:i.property("stream_options",Ca.optional()),stop:i.list(i.string()).optional(),maxTokens:i.property("max_tokens",i.number().optional()),maxCompletionTokens:i.property("max_completion_tokens",i.number().optional()),presencePenalty:i.property("presence_penalty",i.number().optional()),frequencyPenalty:i.property("frequency_penalty",i.number().optional()),logitBias:i.property("logit_bias",i.record(i.string(),i.number()).optional()),user:i.string().optional(),responseFormat:i.property("response_format",Na.optional()),seed:i.number().optional(),tools:i.list(Ua).optional(),toolChoice:i.property("tool_choice",i.record(i.string(),i.unknown()).optional()),parallelToolCalls:i.property("parallel_tool_calls",i.boolean().optional()),functions:i.list(mt).optional(),functionCall:i.property("function_call",De.optional())});var Vi={};$(Vi,{DatasetIdentifier:()=>bt,DatasetIdentifierPublic:()=>yt,DatasetItemBatchWrite:()=>ht,DatasetItemStreamRequest:()=>_t,DatasetItemsDelete:()=>wt,DatasetUpdate:()=>gt,DatasetWrite:()=>ft});var ft=i.object({id:i.string().optional(),name:i.string(),description:i.string().optional()});var Ma=i.enum_(["manual","trace","span","sdk"]);var Fa=i.object({id:i.string().optional(),traceId:i.property("trace_id",i.string().optional()),spanId:i.property("span_id",i.string().optional()),source:Ma,data:I});var ht=i.object({datasetName:i.property("dataset_name",i.string().optional()),datasetId:i.property("dataset_id",i.string().optional()),items:i.list(Fa)});var gt=i.object({name:i.string(),description:i.string().optional()});var bt=i.object({datasetName:i.property("dataset_name",i.string())});var wt=i.object({itemIds:i.property("item_ids",i.list(i.string()))});var yt=i.object({datasetName:i.property("dataset_name",i.string())});var _t=i.object({datasetName:i.property("dataset_name",i.string()),lastRetrievedId:i.property("last_retrieved_id",i.string().optional()),steamLimit:i.property("steam_limit",i.number().optional())});var Da=i.object({workspaceId:i.property("workspace_id",i.string().optional()),user:i.string().optional(),count:i.number().optional()});var St=i.object({biInformation:i.property("bi_information",i.list(Da).optional())});var Oa=i.object({workspace:i.string().optional(),spanCount:i.property("span_count",i.number().optional())});var La=i.object({workspacesSpansCount:i.property("workspaces_spans_count",i.list(Oa).optional())});var Ba=i.object({workspace:i.string().optional(),traceCount:i.property("trace_count",i.number().optional())});var $a=i.object({workspacesTracesCount:i.property("workspaces_traces_count",i.list(Ba).optional())});var Va=i.object({link:i.string().optional(),fileName:i.property("file_name",i.string()),fileSize:i.property("file_size",i.number()),mimeType:i.property("mime_type",i.string())});var Ja=i.object({page:i.number().optional(),size:i.number().optional(),total:i.number().optional(),content:i.list(Va).optional(),sortableBy:i.list(i.string()).optional()});var fe=i.object({code:i.number().optional(),message:i.string().optional(),details:i.string().optional()});var Wa=i.enum_(["trace","span"]);var Ka=i.object({eTag:i.property("e_tag",i.string()),partNumber:i.property("part_number",i.number())});var Ji=i.object({fileName:i.property("file_name",i.string()),projectName:i.property("project_name",i.string().optional()),entityType:i.property("entity_type",Wa),entityId:i.property("entity_id",i.string()),containerId:i.property("container_id",i.string().optional()),fileSize:i.property("file_size",i.number()),mimeType:i.property("mime_type",i.string().optional()),uploadId:i.property("upload_id",i.string()),uploadedFileParts:i.property("uploaded_file_parts",i.list(Ka))});var Xa=i.enum_(["trace","span"]);var uh=i.object({fileNames:i.property("file_names",i.list(i.string())),entityType:i.property("entity_type",Xa),entityId:i.property("entity_id",i.string()),containerId:i.property("container_id",i.string())});var Ga=i.object({uploadId:i.property("upload_id",i.string()),preSignUrls:i.property("pre_sign_urls",i.list(i.string()))});var Ha=i.record(i.string(),i.unknown());var Ya=i.object({workspaceName:i.property("workspace_name",i.string().optional())});var Za=i.object({name:i.string(),temperature:i.number()});var Qa=i.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT"]);var qa=i.object({role:Qa,content:i.string()});var en=i.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var rn=i.object({name:i.string(),type:en,description:i.string()});var kt=i.object({model:Za,messages:i.list(qa),variables:i.record(i.string(),i.string()),schema:i.list(rn)});var tn=i.object({code:kt.optional()});var xt=i.object({metric:i.string(),arguments:i.record(i.string(),i.string())});var on=i.object({code:xt.optional()});var Ip=i.object({id:i.string().optional(),projectId:i.property("project_id",i.string().optional()),projectName:i.property("project_name",i.string().optional()),name:i.string(),samplingRate:i.property("sampling_rate",i.number().optional()),createdAt:i.property("created_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional()),action:i.stringLiteral("evaluator").optional()}),mh=i.union("type",{llm_as_judge:tn.extend(Ip),user_defined_metric_python:on.extend(Ip)}).transform({transform:a=>a,untransform:a=>a});var an=i.object({name:i.string(),temperature:i.number()});var nn=i.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT"]);var sn=i.object({role:nn,content:i.string()});var cn=i.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var ln=i.object({name:i.string(),type:cn,description:i.string()});var pn=i.object({model:an,messages:i.list(sn),variables:i.record(i.string(),i.string()),schema:i.list(ln)});var un=i.object({code:pn.optional()});var mn=i.object({metric:i.string(),arguments:i.record(i.string(),i.string())});var dn=i.object({code:mn.optional()});var Np=i.object({projectId:i.property("project_id",i.string().optional()),name:i.string(),samplingRate:i.property("sampling_rate",i.number().optional()),action:i.stringLiteral("evaluator").optional()}),fn=i.union("type",{llm_as_judge:un.extend(Np),user_defined_metric_python:dn.extend(Np)}).transform({transform:a=>a,untransform:a=>a});var Q=i.object({ids:i.list(i.string())});var hn=i.object({name:i.string(),temperature:i.number()});var gn=i.enum_(["SYSTEM","USER","AI","TOOL_EXECUTION_RESULT"]);var bn=i.object({role:gn,content:i.string()});var wn=i.enum_(["BOOLEAN","INTEGER","DOUBLE"]);var yn=i.object({name:i.string(),type:wn,description:i.string()});var _n=i.object({model:hn,messages:i.list(bn),variables:i.record(i.string(),i.string()),schema:i.list(yn)});var Rt=i.object({code:_n.optional()});var Sn=i.object({metric:i.string(),arguments:i.record(i.string(),i.string())});var vt=i.object({code:Sn.optional()});var Up=i.object({id:i.string().optional(),projectId:i.property("project_id",i.string().optional()),projectName:i.property("project_name",i.string().optional()),name:i.string(),samplingRate:i.property("sampling_rate",i.number().optional()),createdAt:i.property("created_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional()),action:i.stringLiteral("evaluator").optional()}),kn=i.union("type",{llm_as_judge:Rt.extend(Up),user_defined_metric_python:vt.extend(Up)}).transform({transform:a=>a,untransform:a=>a});var xn=i.object({page:i.number().optional(),size:i.number().optional(),total:i.number().optional(),content:i.list(kn).optional()});var Mp=i.object({id:i.string().optional(),projectId:i.property("project_id",i.string().optional()),projectName:i.property("project_name",i.string().optional()),name:i.string(),samplingRate:i.property("sampling_rate",i.number().optional()),createdAt:i.property("created_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional()),action:i.stringLiteral("evaluator").optional()}),Rn=i.union("type",{llm_as_judge:Rt.extend(Mp),user_defined_metric_python:vt.extend(Mp)}).transform({transform:a=>a,untransform:a=>a});var vn=i.enum_(["INFO","WARN","ERROR","DEBUG","TRACE"]);var En=i.object({timestamp:i.date().optional(),ruleId:i.property("rule_id",i.string().optional()),level:vn.optional(),message:i.string().optional(),markers:i.record(i.string(),i.string()).optional()});var An=i.object({content:i.list(En).optional(),page:i.number().optional(),size:i.number().optional(),total:i.number().optional()});var zn=i.object({code:kt.optional()});var Tn=i.object({code:xt.optional()});var Fp=i.object({name:i.string(),samplingRate:i.property("sampling_rate",i.number().optional()),projectId:i.property("project_id",i.string().optional()),action:i.stringLiteral("evaluator").optional()}),Pn=i.union("type",{llm_as_judge:zn.extend(Fp),user_defined_metric_python:Tn.extend(Fp)}).transform({transform:a=>a,untransform:a=>a});var Cn=i.enum_(["system","user","assistant","tool","function"]);var Et=i.object({id:i.string().optional(),index:i.number().optional(),type:i.stringLiteral("function").optional(),function:De.optional()});var jn=i.object({role:Cn.optional(),content:i.string().optional(),name:i.string().optional(),toolCalls:i.property("tool_calls",i.list(Et).optional()),refusal:i.boolean().optional(),functionCall:i.property("function_call",De.optional())});var In=i.enum_(["system","user","assistant","tool","function"]);var Nn=i.object({role:In.optional(),content:i.string().optional(),toolCalls:i.property("tool_calls",i.list(Et).optional()),functionCall:i.property("function_call",De.optional())});var Un=i.object({index:i.number().optional(),message:jn.optional(),delta:Nn.optional(),finishReason:i.property("finish_reason",i.string().optional())});var Mn=i.object({reasoningTokens:i.property("reasoning_tokens",i.number().optional())});var Fn=i.object({totalTokens:i.property("total_tokens",i.number().optional()),promptTokens:i.property("prompt_tokens",i.number().optional()),completionTokens:i.property("completion_tokens",i.number().optional()),completionTokensDetails:i.property("completion_tokens_details",Mn.optional())});var Dn=i.object({id:i.string().optional(),created:i.number().optional(),model:i.string().optional(),choices:i.list(Un).optional(),usage:Fn.optional(),systemFingerprint:i.property("system_fingerprint",i.string().optional())});var dh=i.object({id:i.string().optional(),name:i.string(),description:i.string().optional(),createdAt:i.property("created_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional()),experimentCount:i.property("experiment_count",i.number().optional()),datasetItemsCount:i.property("dataset_items_count",i.number().optional()),mostRecentExperimentAt:i.property("most_recent_experiment_at",i.date().optional()),lastCreatedExperimentAt:i.property("last_created_experiment_at",i.date().optional())});var On=i.enum_(["manual","trace","span","sdk"]);var Ln=i.object({id:i.string().optional(),traceId:i.property("trace_id",i.string().optional()),spanId:i.property("span_id",i.string().optional()),source:On,data:I,experimentItems:i.property("experiment_items",i.list(qr).optional()),createdAt:i.property("created_at",i.date().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional())});var fh=i.object({datasetName:i.property("dataset_name",i.string().optional()),datasetId:i.property("dataset_id",i.string().optional()),items:i.list(Ln)});var Bn=i.enum_(["string","number","object","boolean","array","null"]);var $n=i.object({name:i.string().optional(),types:i.list(Bn).optional(),filterFieldPrefix:i.property("filter_field_prefix",i.string().optional()),filterField:i.string().optional()});var Vn=i.object({id:i.string().optional(),text:i.string(),createdAt:i.property("created_at",i.date().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional())});var Jn=i.enum_(["manual","trace","span","sdk"]);var Wi=i.record(i.string(),i.unknown());var Wn=i.enum_(["ui","sdk","online_scoring"]);var Kn=i.object({name:i.string(),categoryName:i.property("category_name",i.string().optional()),value:i.number(),reason:i.string().optional(),source:Wn,createdAt:i.property("created_at",i.date().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional())});var Xn=i.object({id:i.string().optional(),experimentId:i.property("experiment_id",i.string()),datasetItemId:i.property("dataset_item_id",i.string()),traceId:i.property("trace_id",i.string()),input:Wi.optional(),output:Wi.optional(),feedbackScores:i.property("feedback_scores",i.list(Kn).optional()),comments:i.list(Vn).optional(),createdAt:i.property("created_at",i.date().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional())});var Gn=i.object({id:i.string().optional(),traceId:i.property("trace_id",i.string().optional()),spanId:i.property("span_id",i.string().optional()),source:Jn,data:I,experimentItems:i.property("experiment_items",i.list(Xn).optional()),createdAt:i.property("created_at",i.date().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional())});var Hn=i.object({content:i.list(Gn).optional(),page:i.number().optional(),size:i.number().optional(),total:i.number().optional(),columns:i.list($n).optional()});var wr=i.object({id:i.string().optional(),name:i.string(),description:i.string().optional(),createdAt:i.property("created_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional()),experimentCount:i.property("experiment_count",i.number().optional()),datasetItemsCount:i.property("dataset_items_count",i.number().optional()),mostRecentExperimentAt:i.property("most_recent_experiment_at",i.date().optional()),lastCreatedExperimentAt:i.property("last_created_experiment_at",i.date().optional())});var Yn=i.object({content:i.list(wr).optional(),page:i.number().optional(),size:i.number().optional(),total:i.number().optional()});var Zn=i.enum_(["manual","trace","span","sdk"]);var At=i.object({id:i.string().optional(),experimentId:i.property("experiment_id",i.string()),datasetItemId:i.property("dataset_item_id",i.string()),traceId:i.property("trace_id",i.string()),createdAt:i.property("created_at",i.date().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional())});var zt=i.object({id:i.string().optional(),traceId:i.property("trace_id",i.string().optional()),spanId:i.property("span_id",i.string().optional()),source:Zn,data:I,experimentItems:i.property("experiment_items",i.list(At).optional()),createdAt:i.property("created_at",i.date().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional())});var Qn=i.enum_(["string","number","object","boolean","array","null"]);var qn=i.object({name:i.string().optional(),types:i.list(Qn).optional(),filterFieldPrefix:i.property("filter_field_prefix",i.string().optional()),filterField:i.string().optional()});var es=i.object({content:i.list(zt).optional(),page:i.number().optional(),size:i.number().optional(),total:i.number().optional(),columns:i.list(qn).optional()});var rs=i.enum_(["string","number","object","boolean","array","null"]);var ts=i.object({name:i.string().optional(),types:i.list(rs).optional(),filterFieldPrefix:i.property("filter_field_prefix",i.string().optional()),filterField:i.string().optional()});var is=i.object({columns:i.list(ts).optional()});var os=i.object({typeName:i.string().optional()});var hh=i.object({type:os.optional(),closed:i.boolean().optional()});var er=i.object({name:i.string(),value:i.number()});var Ki=i.object({id:i.string(),commit:i.string().optional(),promptId:i.property("prompt_id",i.string().optional())});var gh=i.object({id:i.string().optional(),datasetName:i.property("dataset_name",i.string()),datasetId:i.property("dataset_id",i.string().optional()),name:i.string().optional(),metadata:I.optional(),feedbackScores:i.property("feedback_scores",i.list(er).optional()),comments:i.list(q).optional(),traceCount:i.property("trace_count",i.number().optional()),createdAt:i.property("created_at",i.date().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional()),promptVersion:i.property("prompt_version",Ki.optional()),promptVersions:i.property("prompt_versions",i.list(Ki).optional())});var rr=i.object({id:i.string().optional(),text:i.string(),createdAt:i.property("created_at",i.date().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional())});var Se=i.record(i.string(),i.unknown());var as=i.object({name:i.string(),value:i.number()});var Xi=i.object({id:i.string(),commit:i.string().optional(),promptId:i.property("prompt_id",i.string().optional())});var yr=i.object({id:i.string().optional(),datasetName:i.property("dataset_name",i.string()),datasetId:i.property("dataset_id",i.string().optional()),name:i.string().optional(),metadata:Se.optional(),feedbackScores:i.property("feedback_scores",i.list(as).optional()),comments:i.list(rr).optional(),traceCount:i.property("trace_count",i.number().optional()),createdAt:i.property("created_at",i.date().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional()),promptVersion:i.property("prompt_version",Xi.optional()),promptVersions:i.property("prompt_versions",i.list(Xi).optional())});var ns=i.object({page:i.number().optional(),size:i.number().optional(),total:i.number().optional(),content:i.list(yr).optional(),sortableBy:i.list(i.string()).optional()});var bh=i.object({code:i.number().optional(),message:i.string().optional(),details:i.string().optional()});var ss=i.object({categories:i.record(i.string(),i.number())});var cs=i.object({details:ss.optional(),createdAt:i.property("created_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional())});var ls=i.object({max:i.number(),min:i.number()});var ps=i.object({details:ls.optional(),createdAt:i.property("created_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional())});var Dp=i.object({id:i.string().optional(),name:i.string(),createdAt:i.date().optional(),createdBy:i.string().optional(),lastUpdatedAt:i.date().optional(),lastUpdatedBy:i.string().optional()}),wh=i.union("type",{numerical:ps.extend(Dp),categorical:cs.extend(Dp)}).transform({transform:a=>a,untransform:a=>a});var us=i.object({categories:i.record(i.string(),i.number())});var ms=i.object({details:us.optional()});var ds=i.object({max:i.number(),min:i.number()});var fs=i.object({details:ds.optional()});var Op=i.object({id:i.string().optional(),name:i.string()}),hs=i.union("type",{numerical:fs.extend(Op),categorical:ms.extend(Op)}).transform({transform:a=>a,untransform:a=>a});var gs=i.object({categories:i.record(i.string(),i.number())});var Tt=i.object({details:gs.optional(),createdAt:i.property("created_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional())});var bs=i.object({max:i.number(),min:i.number()});var Pt=i.object({details:bs.optional(),createdAt:i.property("created_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional())});var Lp=i.object({id:i.string().optional(),name:i.string(),createdAt:i.date().optional(),createdBy:i.string().optional(),lastUpdatedAt:i.date().optional(),lastUpdatedBy:i.string().optional()}),ws=i.union("type",{numerical:Pt.extend(Lp),categorical:Tt.extend(Lp)}).transform({transform:a=>a,untransform:a=>a});var ys=i.object({page:i.number().optional(),size:i.number().optional(),total:i.number().optional(),content:i.list(ws).optional()});var Bp=i.object({id:i.string().optional(),name:i.string(),createdAt:i.date().optional(),createdBy:i.string().optional(),lastUpdatedAt:i.date().optional(),lastUpdatedBy:i.string().optional()}),_s=i.union("type",{numerical:Pt.extend(Bp),categorical:Tt.extend(Bp)}).transform({transform:a=>a,untransform:a=>a});var Ss=i.object({categories:i.record(i.string(),i.number())});var ks=i.object({details:Ss.optional()});var xs=i.object({max:i.number(),min:i.number()});var Rs=i.object({details:xs.optional()});var $p=i.object({id:i.string().optional(),name:i.string()}),vs=i.union("type",{numerical:Rs.extend($p),categorical:ks.extend($p)}).transform({transform:a=>a,untransform:a=>a});var Es=i.enum_(["openai","anthropic","gemini","openrouter"]);var Ct=i.object({id:i.string().optional(),provider:Es,apiKey:i.property("api_key",i.string()),name:i.string().optional(),createdAt:i.property("created_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional())});var As=i.object({size:i.number().optional(),total:i.number().optional(),content:i.list(Ct).optional(),sortableBy:i.list(i.string()).optional()});var zs=i.enum_(["openai","anthropic","gemini","openrouter"]);var yh=i.object({id:i.string().optional(),provider:zs,apiKey:i.property("api_key",i.string()),name:i.string().optional(),createdAt:i.property("created_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional())});var _h=I;var jt=i.object({p50:i.number().optional(),p90:i.number().optional(),p99:i.number().optional()});var Sh=i.object({id:i.string().optional(),name:i.string(),description:i.string().optional(),createdAt:i.property("created_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional()),lastUpdatedTraceAt:i.property("last_updated_trace_at",i.date().optional()),feedbackScores:i.property("feedback_scores",i.list(er).optional()),duration:jt.optional(),totalEstimatedCost:i.property("total_estimated_cost",i.number().optional()),usage:i.record(i.string(),i.number()).optional(),traceCount:i.property("trace_count",i.number().optional())});var It=i.object({id:i.string().optional(),name:i.string(),description:i.string().optional(),createdAt:i.property("created_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional()),lastUpdatedTraceAt:i.property("last_updated_trace_at",i.date().optional())});var Ts=i.object({page:i.number().optional(),size:i.number().optional(),total:i.number().optional(),content:i.list(It).optional(),sortableBy:i.list(i.string()).optional()});var Ps=i.object({name:i.string().optional()});var Cs=i.object({scores:i.list(Ps).optional()});var js=i.object({time:i.date(),value:i.number().optional()});var Is=i.enum_(["FEEDBACK_SCORES","TRACE_COUNT","TOKEN_USAGE","DURATION","COST"]);var Ns=i.enum_(["HOURLY","DAILY","WEEKLY"]);var Us=i.object({name:i.string().optional(),data:i.list(js).optional()});var Ms=i.object({projectId:i.property("project_id",i.string().optional()),metricType:i.property("metric_type",Is.optional()),interval:Ns.optional(),results:i.list(Us).optional()});var Fs=i.object({projectId:i.property("project_id",i.string().optional()),feedbackScores:i.property("feedback_scores",i.list(er).optional()),duration:jt.optional(),totalEstimatedCost:i.property("total_estimated_cost",i.number().optional()),usage:i.record(i.string(),i.number()).optional(),traceCount:i.property("trace_count",i.number().optional())});var Ds=i.object({content:i.list(Fs).optional()});var Os=i.object({name:i.string(),value:i.number()});var Ls=i.object({p50:i.number().optional(),p90:i.number().optional(),p99:i.number().optional()});var Bs=i.object({id:i.string().optional(),name:i.string(),description:i.string().optional(),createdAt:i.property("created_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional()),lastUpdatedTraceAt:i.property("last_updated_trace_at",i.date().optional()),feedbackScores:i.property("feedback_scores",i.list(Os).optional()),duration:Ls.optional(),totalEstimatedCost:i.property("total_estimated_cost",i.number().optional()),usage:i.record(i.string(),i.number()).optional(),traceCount:i.property("trace_count",i.number().optional())});var kh=i.object({errors:i.list(i.string()).optional()});var $s=i.enum_(["mustache","jinja2"]);var Vs=i.enum_(["mustache","jinja2"]);var Js=i.object({id:i.string().optional(),promptId:i.property("prompt_id",i.string().optional()),commit:i.string().optional(),template:i.string(),metadata:I.optional(),type:Vs.optional(),changeDescription:i.property("change_description",i.string().optional()),variables:i.list(i.string()).optional(),createdAt:i.property("created_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional())});var xh=i.object({id:i.string().optional(),name:i.string(),description:i.string().optional(),template:i.string().optional(),metadata:I.optional(),changeDescription:i.property("change_description",i.string().optional()),type:$s.optional(),createdAt:i.property("created_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional()),versionCount:i.property("version_count",i.number().optional()),latestVersion:i.property("latest_version",Js.optional())});var Rh=i.object({code:i.number().optional(),message:i.string().optional(),details:i.string().optional()});var Ws=i.object({id:i.string().optional(),name:i.string(),description:i.string().optional(),createdAt:i.property("created_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional()),versionCount:i.property("version_count",i.number().optional()),latestVersion:i.property("latest_version",Me.optional())});var Ks=i.enum_(["mustache","jinja2"]);var Xs=i.object({id:i.string().optional(),promptId:i.property("prompt_id",i.string().optional()),commit:i.string().optional(),template:i.string(),metadata:Se.optional(),type:Ks.optional(),changeDescription:i.property("change_description",i.string().optional()),createdAt:i.property("created_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional())});var Gs=i.object({page:i.number().optional(),size:i.number().optional(),total:i.number().optional(),content:i.list(Xs).optional()});var Hs=i.object({id:i.string().optional(),name:i.string(),description:i.string().optional(),createdAt:i.property("created_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional()),versionCount:i.property("version_count",i.number().optional())});var Ys=i.object({page:i.number().optional(),size:i.number().optional(),total:i.number().optional(),content:i.list(Hs).optional()});var Zs=i.enum_(["general","tool","llm"]);var Qs=i.object({id:i.string().optional(),projectName:i.property("project_name",i.string().optional()),projectId:i.property("project_id",i.string().optional()),traceId:i.property("trace_id",i.string()),parentSpanId:i.property("parent_span_id",i.string().optional()),name:i.string(),type:Zs,startTime:i.property("start_time",i.date()),endTime:i.property("end_time",i.date().optional()),input:I.optional(),output:I.optional(),metadata:I.optional(),model:i.string().optional(),provider:i.string().optional(),tags:i.list(i.string()).optional(),usage:i.record(i.string(),i.number()).optional(),errorInfo:i.property("error_info",Fe.optional()),createdAt:i.property("created_at",i.date().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional()),feedbackScores:i.property("feedback_scores",i.list(Pe).optional()),comments:i.list(q).optional(),totalEstimatedCost:i.property("total_estimated_cost",i.number().optional()),totalEstimatedCostVersion:i.property("total_estimated_cost_version",i.string().optional()),duration:i.number().optional()});var vh=i.object({spans:i.list(Qs)});var Nt=i.object({name:i.string()});var Ut=i.object({exceptionType:i.property("exception_type",i.string()),message:i.string().optional(),traceback:i.string()});var qs=i.enum_(["ui","sdk","online_scoring"]);var Mt=i.object({name:i.string(),categoryName:i.property("category_name",i.string().optional()),value:i.number(),reason:i.string().optional(),source:qs,createdAt:i.property("created_at",i.date().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional())});var ec=i.enum_(["general","tool","llm"]);var Ft=i.object({id:i.string().optional(),projectName:i.property("project_name",i.string().optional()),projectId:i.property("project_id",i.string().optional()),traceId:i.property("trace_id",i.string()),parentSpanId:i.property("parent_span_id",i.string().optional()),name:i.string(),type:ec,startTime:i.property("start_time",i.date()),endTime:i.property("end_time",i.date().optional()),input:Se.optional(),output:Se.optional(),metadata:Se.optional(),model:i.string().optional(),provider:i.string().optional(),tags:i.list(i.string()).optional(),usage:i.record(i.string(),i.number()).optional(),errorInfo:i.property("error_info",Ut.optional()),createdAt:i.property("created_at",i.date().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional()),feedbackScores:i.property("feedback_scores",i.list(Mt).optional()),comments:i.list(rr).optional(),totalEstimatedCost:i.property("total_estimated_cost",i.number().optional()),totalEstimatedCostVersion:i.property("total_estimated_cost_version",i.string().optional()),duration:i.number().optional()});var rc=i.object({page:i.number().optional(),size:i.number().optional(),total:i.number().optional(),content:i.list(Ft).optional(),sortableBy:i.list(i.string()).optional()});var tc=i.object({value:i.number().optional()});var ic=i.object({value:i.number().optional()});var oc=i.object({p50:i.number().optional(),p90:i.number().optional(),p99:i.number().optional()});var ac=i.object({value:oc.optional()});var nc=i.object({name:i.string().optional()}),sc=i.union("type",{PERCENTAGE:ac.extend(nc),COUNT:ic.extend(nc),AVG:tc.extend(nc)}).transform({transform:a=>a,untransform:a=>a});var Dt=i.object({stats:i.list(sc).optional()});var cc=i.enum_(["ui","sdk","online_scoring"]);var lc=i.object({id:i.string(),projectName:i.property("project_name",i.string().optional()),name:i.string(),categoryName:i.property("category_name",i.string().optional()),value:i.number(),reason:i.string().optional(),source:cc});var Ot=i.object({scores:i.list(lc)});var pc=i.object({typeName:i.string().optional()});var Eh=i.object({type:pc.optional(),closed:i.boolean().optional()});var uc=i.object({id:i.string().optional(),projectName:i.property("project_name",i.string().optional()),projectId:i.property("project_id",i.string().optional()),name:i.string(),startTime:i.property("start_time",i.date()),endTime:i.property("end_time",i.date().optional()),input:I.optional(),output:I.optional(),metadata:I.optional(),tags:i.list(i.string()).optional(),errorInfo:i.property("error_info",Fe.optional()),usage:i.record(i.string(),i.number()).optional(),createdAt:i.property("created_at",i.date().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional()),feedbackScores:i.property("feedback_scores",i.list(Pe).optional()),comments:i.list(q).optional(),totalEstimatedCost:i.property("total_estimated_cost",i.number().optional()),spanCount:i.property("span_count",i.number().optional()),duration:i.number().optional(),threadId:i.property("thread_id",i.string().optional())});var Ah=i.object({traces:i.list(uc)});var Lt=i.object({id:i.string().optional(),projectId:i.property("project_id",i.string().optional()),name:i.string(),startTime:i.property("start_time",i.date()),endTime:i.property("end_time",i.date().optional()),input:Se.optional(),output:Se.optional(),metadata:Se.optional(),tags:i.list(i.string()).optional(),errorInfo:i.property("error_info",Ut.optional()),usage:i.record(i.string(),i.number()).optional(),createdAt:i.property("created_at",i.date().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),lastUpdatedBy:i.property("last_updated_by",i.string().optional()),feedbackScores:i.property("feedback_scores",i.list(Mt).optional()),comments:i.list(rr).optional(),totalEstimatedCost:i.property("total_estimated_cost",i.number().optional()),spanCount:i.property("span_count",i.number().optional()),duration:i.number().optional(),threadId:i.property("thread_id",i.string().optional())});var Bt=i.object({id:i.string().optional(),projectId:i.property("project_id",i.string().optional()),startTime:i.property("start_time",i.date().optional()),endTime:i.property("end_time",i.date().optional()),duration:i.number().optional(),firstMessage:i.property("first_message",I.optional()),lastMessage:i.property("last_message",I.optional()),numberOfMessages:i.property("number_of_messages",i.number().optional()),lastUpdatedAt:i.property("last_updated_at",i.date().optional()),createdBy:i.property("created_by",i.string().optional()),createdAt:i.property("created_at",i.date().optional())});var mc=i.object({page:i.number().optional(),size:i.number().optional(),total:i.number().optional(),content:i.list(Bt).optional()});var dc=i.object({page:i.number().optional(),size:i.number().optional(),total:i.number().optional(),content:i.list(Lt).optional(),sortableBy:i.list(i.string()).optional()});var Gi=class{constructor(r={}){this._options=r;}async getDatasetBiInfo(r){var t,o;let e=await S({url:k((o=(t=await p.get(this._options.baseUrl))!=null?t:await p.get(this._options.environment))!=null?o:_.Default,"v1/internal/usage/bi-datasets"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(e.ok)return St.parseOrThrow(e.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(e.error.reason==="status-code")throw new m({statusCode:e.error.statusCode,body:e.error.body});switch(e.error.reason){case "non-json":throw new m({statusCode:e.error.statusCode,body:e.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/internal/usage/bi-datasets.");case "unknown":throw new m({message:e.error.errorMessage})}}async getExperimentBiInfo(r){var t,o;let e=await S({url:k((o=(t=await p.get(this._options.baseUrl))!=null?t:await p.get(this._options.environment))!=null?o:_.Default,"v1/internal/usage/bi-experiments"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(e.ok)return St.parseOrThrow(e.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(e.error.reason==="status-code")throw new m({statusCode:e.error.statusCode,body:e.error.body});switch(e.error.reason){case "non-json":throw new m({statusCode:e.error.statusCode,body:e.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/internal/usage/bi-experiments.");case "unknown":throw new m({message:e.error.errorMessage})}}async getSpansCountForWorkspaces(r){var t,o;let e=await S({url:k((o=(t=await p.get(this._options.baseUrl))!=null?t:await p.get(this._options.environment))!=null?o:_.Default,"v1/internal/usage/workspace-span-counts"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(e.ok)return La.parseOrThrow(e.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(e.error.reason==="status-code")throw new m({statusCode:e.error.statusCode,body:e.error.body});switch(e.error.reason){case "non-json":throw new m({statusCode:e.error.statusCode,body:e.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/internal/usage/workspace-span-counts.");case "unknown":throw new m({message:e.error.errorMessage})}}async getTracesBiInfo(r){var t,o;let e=await S({url:k((o=(t=await p.get(this._options.baseUrl))!=null?t:await p.get(this._options.environment))!=null?o:_.Default,"v1/internal/usage/bi-traces"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(e.ok)return St.parseOrThrow(e.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(e.error.reason==="status-code")throw new m({statusCode:e.error.statusCode,body:e.error.body});switch(e.error.reason){case "non-json":throw new m({statusCode:e.error.statusCode,body:e.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/internal/usage/bi-traces.");case "unknown":throw new m({message:e.error.errorMessage})}}async getTracesCountForWorkspaces(r){var t,o;let e=await S({url:k((o=(t=await p.get(this._options.baseUrl))!=null?t:await p.get(this._options.environment))!=null?o:_.Default,"v1/internal/usage/workspace-trace-counts"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(e.ok)return $a.parseOrThrow(e.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(e.error.reason==="status-code")throw new m({statusCode:e.error.statusCode,body:e.error.body});switch(e.error.reason){case "non-json":throw new m({statusCode:e.error.statusCode,body:e.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/internal/usage/workspace-trace-counts.");case "unknown":throw new m({message:e.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await p.get(this._options.apiKey)}}};var Hi=class{constructor(r={}){this._options=r;}async attachmentList(r,e){var h,b;let{page:t,size:o,projectId:n,entityType:s,entityId:c,path:l}=r,u={};t!=null&&(u.page=t.toString()),o!=null&&(u.size=o.toString()),u.project_id=n,u.entity_type=yi.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"}),u.entity_id=c,u.path=l;let d=await S({url:k((b=(h=await p.get(this._options.baseUrl))!=null?h:await p.get(this._options.environment))!=null?b:_.Default,"v1/private/attachment/list"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(d.ok)return Ja.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(d.error.reason==="status-code")switch(d.error.statusCode){case 401:throw new Y(d.error.body);case 403:throw new ie(fe.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new m({statusCode:d.error.statusCode,body:d.error.body})}switch(d.error.reason){case "non-json":throw new m({statusCode:d.error.statusCode,body:d.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/attachment/list.");case "unknown":throw new m({message:d.error.errorMessage})}}async startMultiPartUpload(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/attachment/upload-complete"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:Ji.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")switch(t.error.statusCode){case 401:throw new Y(t.error.body);case 403:throw new ie(fe.parseOrThrow(t.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new m({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/attachment/upload-complete.");case "unknown":throw new m({message:t.error.errorMessage})}}}async deleteAttachments(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/attachment/delete"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:Ji.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")switch(t.error.statusCode){case 401:throw new Y(t.error.body);case 403:throw new ie(fe.parseOrThrow(t.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new m({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/attachment/delete.");case "unknown":throw new m({message:t.error.errorMessage})}}}async downloadAttachment(r,e){var h,b;let{workspaceName:t,containerId:o,entityType:n,entityId:s,fileName:c,mimeType:l}=r,u={};t!=null&&(u.workspace_name=t),u.container_id=o,u.entity_type=_i.jsonOrThrow(n,{unrecognizedObjectKeys:"strip"}),u.entity_id=s,u.file_name=c,u.mime_type=l;let d=await S({url:k((b=(h=await p.get(this._options.baseUrl))!=null?h:await p.get(this._options.environment))!=null?b:_.Default,"v1/private/attachment/download"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",queryParameters:u,requestType:"json",responseType:"streaming",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(d.ok)return d.body;if(d.error.reason==="status-code")switch(d.error.statusCode){case 401:throw new Y(d.error.body);case 403:throw new ie(fe.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new m({statusCode:d.error.statusCode,body:d.error.body})}switch(d.error.reason){case "non-json":throw new m({statusCode:d.error.statusCode,body:d.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/attachment/download.");case "unknown":throw new m({message:d.error.errorMessage})}}async startMultiPartUpload1(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/attachment/upload-start"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:Mr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(t.ok)return Ga.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(t.error.reason==="status-code")switch(t.error.statusCode){case 401:throw new Y(t.error.body);case 403:throw new ie(fe.parseOrThrow(t.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new m({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/attachment/upload-start.");case "unknown":throw new m({message:t.error.errorMessage})}}async uploadAttachment(r,e){var h,b;let{fileName:t,projectName:o,mimeType:n,entityType:s,entityId:c,body:l}=r,u={};u.file_name=t,o!=null&&(u.project_name=o),n!=null&&(u.mime_type=n),u.entity_type=ki.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"}),u.entity_id=c;let d=await S({url:k((b=(h=await p.get(this._options.baseUrl))!=null?h:await p.get(this._options.environment))!=null?b:_.Default,"v1/private/attachment/upload"),method:"PUT",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",queryParameters:u,requestType:"json",body:fr.uploadAttachment.Request.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!d.ok){if(d.error.reason==="status-code")switch(d.error.statusCode){case 401:throw new Y(d.error.body);case 403:throw new ie(fe.parseOrThrow(d.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new m({statusCode:d.error.statusCode,body:d.error.body})}switch(d.error.reason){case "non-json":throw new m({statusCode:d.error.statusCode,body:d.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling PUT /v1/private/attachment/upload.");case "unknown":throw new m({message:d.error.errorMessage})}}}async _getCustomAuthorizationHeaders(){return {Authorization:await p.get(this._options.apiKey)}}};var Yi=class{constructor(r={}){this._options=r;}async access(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/auth"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:Ha.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")switch(t.error.statusCode){case 401:throw new Y(t.error.body);case 403:throw new ie(fe.parseOrThrow(t.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new m({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/auth.");case "unknown":throw new m({message:t.error.errorMessage})}}}async getWorkspaceName(r){var t,o;let e=await S({url:k((o=(t=await p.get(this._options.baseUrl))!=null?t:await p.get(this._options.environment))!=null?o:_.Default,"v1/private/auth/workspace"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(e.ok)return Ya.parseOrThrow(e.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(e.error.reason==="status-code")switch(e.error.statusCode){case 401:throw new Y(e.error.body);case 403:throw new ie(fe.parseOrThrow(e.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new m({statusCode:e.error.statusCode,body:e.error.body})}switch(e.error.reason){case "non-json":throw new m({statusCode:e.error.statusCode,body:e.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/auth/workspace.");case "unknown":throw new m({message:e.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await p.get(this._options.apiKey)}}};var Zi=class{constructor(r={}){this._options=r;}async findEvaluators(r={},e){var u,d;let{projectId:t,name:o,page:n,size:s}=r,c={};t!=null&&(c.project_id=t),o!=null&&(c.name=o),n!=null&&(c.page=n.toString()),s!=null&&(c.size=s.toString());let l=await S({url:k((d=(u=await p.get(this._options.baseUrl))!=null?u:await p.get(this._options.environment))!=null?d:_.Default,"v1/private/automations/evaluators"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",queryParameters:c,requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(l.ok)return xn.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(l.error.reason==="status-code")throw new m({statusCode:l.error.statusCode,body:l.error.body});switch(l.error.reason){case "non-json":throw new m({statusCode:l.error.statusCode,body:l.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/automations/evaluators.");case "unknown":throw new m({message:l.error.errorMessage})}}async createAutomationRuleEvaluator(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/automations/evaluators"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:fn.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/automations/evaluators.");case "unknown":throw new m({message:t.error.errorMessage})}}}async deleteAutomationRuleEvaluatorBatch(r,e){var c,l;let{projectId:t,body:o}=r,n={};t!=null&&(n.project_id=t);let s=await S({url:k((l=(c=await p.get(this._options.baseUrl))!=null?c:await p.get(this._options.environment))!=null?l:_.Default,"v1/private/automations/evaluators/delete"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",queryParameters:n,requestType:"json",body:Q.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!s.ok){if(s.error.reason==="status-code")throw new m({statusCode:s.error.statusCode,body:s.error.body});switch(s.error.reason){case "non-json":throw new m({statusCode:s.error.statusCode,body:s.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/automations/evaluators/delete.");case "unknown":throw new m({message:s.error.errorMessage})}}}async getEvaluatorById(r,e={},t){var c,l;let{projectId:o}=e,n={};o!=null&&(n.project_id=o);let s=await S({url:k((l=(c=await p.get(this._options.baseUrl))!=null?c:await p.get(this._options.environment))!=null?l:_.Default,`v1/private/automations/evaluators/${encodeURIComponent(r)}`),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",queryParameters:n,requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(s.ok)return Rn.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(s.error.reason==="status-code")throw new m({statusCode:s.error.statusCode,body:s.error.body});switch(s.error.reason){case "non-json":throw new m({statusCode:s.error.statusCode,body:s.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/automations/evaluators/{id}.");case "unknown":throw new m({message:s.error.errorMessage})}}async updateAutomationRuleEvaluator(r,e,t){var n,s;let o=await S({url:k((s=(n=await p.get(this._options.baseUrl))!=null?n:await p.get(this._options.environment))!=null?s:_.Default,`v1/private/automations/evaluators/${encodeURIComponent(r)}`),method:"PATCH",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",body:Pn.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(!o.ok){if(o.error.reason==="status-code")throw new m({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling PATCH /v1/private/automations/evaluators/{id}.");case "unknown":throw new m({message:o.error.errorMessage})}}}async getEvaluatorLogsById(r,e={},t){var c,l;let{size:o}=e,n={};o!=null&&(n.size=o.toString());let s=await S({url:k((l=(c=await p.get(this._options.baseUrl))!=null?c:await p.get(this._options.environment))!=null?l:_.Default,`v1/private/automations/evaluators/${encodeURIComponent(r)}/logs`),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",queryParameters:n,requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(s.ok)return An.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(s.error.reason==="status-code")throw new m({statusCode:s.error.statusCode,body:s.error.body});switch(s.error.reason){case "non-json":throw new m({statusCode:s.error.statusCode,body:s.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/automations/evaluators/{id}/logs.");case "unknown":throw new m({message:s.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await p.get(this._options.apiKey)}}};var Qi=class{constructor(r={}){this._options=r;}async createChatCompletions(r={},e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/chat/completions"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:dt.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(t.ok)return Dn.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/chat/completions.");case "unknown":throw new m({message:t.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await p.get(this._options.apiKey)}}};var qi=class{constructor(r={}){this._options=r;}async findDatasets(r={},e){var h,b;let{page:t,size:o,withExperimentsOnly:n,promptId:s,name:c,sorting:l}=r,u={};t!=null&&(u.page=t.toString()),o!=null&&(u.size=o.toString()),n!=null&&(u.with_experiments_only=n.toString()),s!=null&&(u.prompt_id=s),c!=null&&(u.name=c),l!=null&&(u.sorting=l);let d=await S({url:k((b=(h=await p.get(this._options.baseUrl))!=null?h:await p.get(this._options.environment))!=null?b:_.Default,"v1/private/datasets"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(d.ok)return Yn.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(d.error.reason==="status-code")throw new m({statusCode:d.error.statusCode,body:d.error.body});switch(d.error.reason){case "non-json":throw new m({statusCode:d.error.statusCode,body:d.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/datasets.");case "unknown":throw new m({message:d.error.errorMessage})}}async createDataset(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/datasets"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:ft.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/datasets.");case "unknown":throw new m({message:t.error.errorMessage})}}}async createOrUpdateDatasetItems(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/datasets/items"),method:"PUT",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:ht.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling PUT /v1/private/datasets/items.");case "unknown":throw new m({message:t.error.errorMessage})}}}async getDatasetById(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,`v1/private/datasets/${encodeURIComponent(r)}`),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(t.ok)return wr.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/datasets/{id}.");case "unknown":throw new m({message:t.error.errorMessage})}}async updateDataset(r,e,t){var n,s;let o=await S({url:k((s=(n=await p.get(this._options.baseUrl))!=null?n:await p.get(this._options.environment))!=null?s:_.Default,`v1/private/datasets/${encodeURIComponent(r)}`),method:"PUT",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",body:gt.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(!o.ok){if(o.error.reason==="status-code")throw new m({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling PUT /v1/private/datasets/{id}.");case "unknown":throw new m({message:o.error.errorMessage})}}}async deleteDataset(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,`v1/private/datasets/${encodeURIComponent(r)}`),method:"DELETE",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling DELETE /v1/private/datasets/{id}.");case "unknown":throw new m({message:t.error.errorMessage})}}}async deleteDatasetByName(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/datasets/delete"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:bt.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/datasets/delete.");case "unknown":throw new m({message:t.error.errorMessage})}}}async deleteDatasetItems(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/datasets/items/delete"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:wt.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/datasets/items/delete.");case "unknown":throw new m({message:t.error.errorMessage})}}}async deleteDatasetsBatch(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/datasets/delete-batch"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:Q.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/datasets/delete-batch.");case "unknown":throw new m({message:t.error.errorMessage})}}}async findDatasetItemsWithExperimentItems(r,e,t){var h,b;let{page:o,size:n,experimentIds:s,filters:c,truncate:l}=e,u={};o!=null&&(u.page=o.toString()),n!=null&&(u.size=n.toString()),u.experiment_ids=s,c!=null&&(u.filters=c),l!=null&&(u.truncate=l.toString());let d=await S({url:k((b=(h=await p.get(this._options.baseUrl))!=null?h:await p.get(this._options.environment))!=null?b:_.Default,`v1/private/datasets/${encodeURIComponent(r)}/items/experiments/items`),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(d.ok)return Hn.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(d.error.reason==="status-code")throw new m({statusCode:d.error.statusCode,body:d.error.body});switch(d.error.reason){case "non-json":throw new m({statusCode:d.error.statusCode,body:d.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/datasets/{id}/items/experiments/items.");case "unknown":throw new m({message:d.error.errorMessage})}}async getDatasetByIdentifier(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/datasets/retrieve"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:yt.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(t.ok)return wr.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/datasets/retrieve.");case "unknown":throw new m({message:t.error.errorMessage})}}async getDatasetItemById(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,`v1/private/datasets/items/${encodeURIComponent(r)}`),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(t.ok)return zt.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/datasets/items/{itemId}.");case "unknown":throw new m({message:t.error.errorMessage})}}async getDatasetItems(r,e={},t){var u,d;let{page:o,size:n,truncate:s}=e,c={};o!=null&&(c.page=o.toString()),n!=null&&(c.size=n.toString()),s!=null&&(c.truncate=s.toString());let l=await S({url:k((d=(u=await p.get(this._options.baseUrl))!=null?u:await p.get(this._options.environment))!=null?d:_.Default,`v1/private/datasets/${encodeURIComponent(r)}/items`),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",queryParameters:c,requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(l.ok)return es.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(l.error.reason==="status-code")throw new m({statusCode:l.error.statusCode,body:l.error.body});switch(l.error.reason){case "non-json":throw new m({statusCode:l.error.statusCode,body:l.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/datasets/{id}/items.");case "unknown":throw new m({message:l.error.errorMessage})}}async getDatasetItemsOutputColumns(r,e={},t){var c,l;let{experimentIds:o}=e,n={};o!=null&&(n.experiment_ids=o);let s=await S({url:k((l=(c=await p.get(this._options.baseUrl))!=null?c:await p.get(this._options.environment))!=null?l:_.Default,`v1/private/datasets/${encodeURIComponent(r)}/items/experiments/items/output/columns`),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",queryParameters:n,requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(s.ok)return is.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(s.error.reason==="status-code")throw new m({statusCode:s.error.statusCode,body:s.error.body});switch(s.error.reason){case "non-json":throw new m({statusCode:s.error.statusCode,body:s.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/datasets/{id}/items/experiments/items/output/columns.");case "unknown":throw new m({message:s.error.errorMessage})}}async streamDatasetItems(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/datasets/items/stream"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:_t.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(t.ok)return t.body;if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/datasets/items/stream.");case "unknown":throw new m({message:t.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await p.get(this._options.apiKey)}}};var eo=class{constructor(r={}){this._options=r;}async findExperiments(r={},e){var b,w;let{page:t,size:o,datasetId:n,name:s,datasetDeleted:c,promptId:l,sorting:u}=r,d={};t!=null&&(d.page=t.toString()),o!=null&&(d.size=o.toString()),n!=null&&(d.datasetId=n),s!=null&&(d.name=s),c!=null&&(d.dataset_deleted=c.toString()),l!=null&&(d.prompt_id=l),u!=null&&(d.sorting=u);let h=await S({url:k((w=(b=await p.get(this._options.baseUrl))!=null?b:await p.get(this._options.environment))!=null?w:_.Default,"v1/private/experiments"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(h.ok)return ns.parseOrThrow(h.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(h.error.reason==="status-code")switch(h.error.statusCode){case 400:throw new X(h.error.body);default:throw new m({statusCode:h.error.statusCode,body:h.error.body})}switch(h.error.reason){case "non-json":throw new m({statusCode:h.error.statusCode,body:h.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/experiments.");case "unknown":throw new m({message:h.error.errorMessage})}}async createExperiment(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/experiments"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:Qr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/experiments.");case "unknown":throw new m({message:t.error.errorMessage})}}}async createExperimentItems(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/experiments/items"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:et.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/experiments/items.");case "unknown":throw new m({message:t.error.errorMessage})}}}async deleteExperimentItems(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/experiments/items/delete"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:rt.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/experiments/items/delete.");case "unknown":throw new m({message:t.error.errorMessage})}}}async deleteExperimentsById(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/experiments/delete"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:tt.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/experiments/delete.");case "unknown":throw new m({message:t.error.errorMessage})}}}async findFeedbackScoreNames(r={},e){var s,c;let{experimentIds:t}=r,o={};t!=null&&(o.experiment_ids=t);let n=await S({url:k((c=(s=await p.get(this._options.baseUrl))!=null?s:await p.get(this._options.environment))!=null?c:_.Default,"v1/private/experiments/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",queryParameters:o,requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(n.ok)return gr.findFeedbackScoreNames.Response.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(n.error.reason==="status-code")throw new m({statusCode:n.error.statusCode,body:n.error.body});switch(n.error.reason){case "non-json":throw new m({statusCode:n.error.statusCode,body:n.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/experiments/feedback-scores/names.");case "unknown":throw new m({message:n.error.errorMessage})}}async getExperimentById(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,`v1/private/experiments/${encodeURIComponent(r)}`),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(t.ok)return yr.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(t.error.reason==="status-code")switch(t.error.statusCode){case 404:throw new O(t.error.body);default:throw new m({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/experiments/{id}.");case "unknown":throw new m({message:t.error.errorMessage})}}async getExperimentByName(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/experiments/retrieve"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:it.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(t.ok)return yr.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(t.error.reason==="status-code")switch(t.error.statusCode){case 404:throw new O(t.error.body);default:throw new m({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/experiments/retrieve.");case "unknown":throw new m({message:t.error.errorMessage})}}async getExperimentItemById(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,`v1/private/experiments/items/${encodeURIComponent(r)}`),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(t.ok)return At.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(t.error.reason==="status-code")switch(t.error.statusCode){case 404:throw new O(t.error.body);default:throw new m({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/experiments/items/{id}.");case "unknown":throw new m({message:t.error.errorMessage})}}async streamExperimentItems(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/experiments/items/stream"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:ot.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(t.ok)return t.body;if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/experiments/items/stream.");case "unknown":throw new m({message:t.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await p.get(this._options.apiKey)}}};var ro=class{constructor(r={}){this._options=r;}async findFeedbackDefinitions(r={},e){var u,d;let{page:t,size:o,name:n,type:s}=r,c={};t!=null&&(c.page=t.toString()),o!=null&&(c.size=o.toString()),n!=null&&(c.name=n),s!=null&&(c.type=Ri.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"}));let l=await S({url:k((d=(u=await p.get(this._options.baseUrl))!=null?u:await p.get(this._options.environment))!=null?d:_.Default,"v1/private/feedback-definitions"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",queryParameters:c,requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(l.ok)return ys.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(l.error.reason==="status-code")throw new m({statusCode:l.error.statusCode,body:l.error.body});switch(l.error.reason){case "non-json":throw new m({statusCode:l.error.statusCode,body:l.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/feedback-definitions.");case "unknown":throw new m({message:l.error.errorMessage})}}async createFeedbackDefinition(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/feedback-definitions"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:hs.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/feedback-definitions.");case "unknown":throw new m({message:t.error.errorMessage})}}}async getFeedbackDefinitionById(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,`v1/private/feedback-definitions/${encodeURIComponent(r)}`),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(t.ok)return _s.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/feedback-definitions/{id}.");case "unknown":throw new m({message:t.error.errorMessage})}}async updateFeedbackDefinition(r,e,t){var n,s;let o=await S({url:k((s=(n=await p.get(this._options.baseUrl))!=null?n:await p.get(this._options.environment))!=null?s:_.Default,`v1/private/feedback-definitions/${encodeURIComponent(r)}`),method:"PUT",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",body:vs.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(!o.ok){if(o.error.reason==="status-code")throw new m({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling PUT /v1/private/feedback-definitions/{id}.");case "unknown":throw new m({message:o.error.errorMessage})}}}async deleteFeedbackDefinitionById(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,`v1/private/feedback-definitions/${encodeURIComponent(r)}`),method:"DELETE",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")switch(t.error.statusCode){case 409:throw new de(t.error.body);default:throw new m({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling DELETE /v1/private/feedback-definitions/{id}.");case "unknown":throw new m({message:t.error.errorMessage})}}}async deleteFeedbackDefinitionsBatch(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/feedback-definitions/delete"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:Q.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")switch(t.error.statusCode){case 409:throw new de(t.error.body);default:throw new m({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/feedback-definitions/delete.");case "unknown":throw new m({message:t.error.errorMessage})}}}async _getCustomAuthorizationHeaders(){return {Authorization:await p.get(this._options.apiKey)}}};var to=class{constructor(r={}){this._options=r;}async deleteLlmProviderApiKeysBatch(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/llm-provider-key/delete"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:Q.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/llm-provider-key/delete.");case "unknown":throw new m({message:t.error.errorMessage})}}}async findLlmProviderKeys(r){var t,o;let e=await S({url:k((o=(t=await p.get(this._options.baseUrl))!=null?t:await p.get(this._options.environment))!=null?o:_.Default,"v1/private/llm-provider-key"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(e.ok)return As.parseOrThrow(e.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(e.error.reason==="status-code")throw new m({statusCode:e.error.statusCode,body:e.error.body});switch(e.error.reason){case "non-json":throw new m({statusCode:e.error.statusCode,body:e.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/llm-provider-key.");case "unknown":throw new m({message:e.error.errorMessage})}}async storeLlmProviderApiKey(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/llm-provider-key"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:Fr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")switch(t.error.statusCode){case 401:throw new Y(t.error.body);case 403:throw new ie(fe.parseOrThrow(t.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));default:throw new m({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/llm-provider-key.");case "unknown":throw new m({message:t.error.errorMessage})}}}async getLlmProviderApiKeyById(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,`v1/private/llm-provider-key/${encodeURIComponent(r)}`),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(t.ok)return Ct.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(t.error.reason==="status-code")switch(t.error.statusCode){case 404:throw new O(t.error.body);default:throw new m({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/llm-provider-key/{id}.");case "unknown":throw new m({message:t.error.errorMessage})}}async updateLlmProviderApiKey(r,e,t){var n,s;let o=await S({url:k((s=(n=await p.get(this._options.baseUrl))!=null?n:await p.get(this._options.environment))!=null?s:_.Default,`v1/private/llm-provider-key/${encodeURIComponent(r)}`),method:"PATCH",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",body:Dr.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(!o.ok){if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new Y(o.error.body);case 403:throw new ie(fe.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]}));case 404:throw new O(o.error.body);default:throw new m({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling PATCH /v1/private/llm-provider-key/{id}.");case "unknown":throw new m({message:o.error.errorMessage})}}}async _getCustomAuthorizationHeaders(){return {Authorization:await p.get(this._options.apiKey)}}};var io=class{constructor(r={}){this._options=r;}async receiveProtobufTraces(r){var t,o;let e=await S({url:k((o=(t=await p.get(this._options.baseUrl))!=null?t:await p.get(this._options.environment))!=null?o:_.Default,"v1/private/otel/v1/traces"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(e.ok)return e.body;if(e.error.reason==="status-code")throw new m({statusCode:e.error.statusCode,body:e.error.body});switch(e.error.reason){case "non-json":throw new m({statusCode:e.error.statusCode,body:e.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/otel/v1/traces.");case "unknown":throw new m({message:e.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await p.get(this._options.apiKey)}}};var oo=class{constructor(r={}){this._options=r;}async findProjects(r={},e){var u,d;let{page:t,size:o,name:n,sorting:s}=r,c={};t!=null&&(c.page=t.toString()),o!=null&&(c.size=o.toString()),n!=null&&(c.name=n),s!=null&&(c.sorting=s);let l=await S({url:k((d=(u=await p.get(this._options.baseUrl))!=null?u:await p.get(this._options.environment))!=null?d:_.Default,"v1/private/projects"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",queryParameters:c,requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(l.ok)return Ts.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(l.error.reason==="status-code")throw new m({statusCode:l.error.statusCode,body:l.error.body});switch(l.error.reason){case "non-json":throw new m({statusCode:l.error.statusCode,body:l.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/projects.");case "unknown":throw new m({message:l.error.errorMessage})}}async createProject(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/projects"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:Or.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new X(t.error.body);case 422:throw new xe(t.error.body);default:throw new m({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/projects.");case "unknown":throw new m({message:t.error.errorMessage})}}}async getProjectById(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,`v1/private/projects/${encodeURIComponent(r)}`),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(t.ok)return It.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/projects/{id}.");case "unknown":throw new m({message:t.error.errorMessage})}}async deleteProjectById(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,`v1/private/projects/${encodeURIComponent(r)}`),method:"DELETE",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")switch(t.error.statusCode){case 409:throw new de(t.error.body);default:throw new m({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling DELETE /v1/private/projects/{id}.");case "unknown":throw new m({message:t.error.errorMessage})}}}async updateProject(r,e={},t){var n,s;let o=await S({url:k((s=(n=await p.get(this._options.baseUrl))!=null?n:await p.get(this._options.environment))!=null?s:_.Default,`v1/private/projects/${encodeURIComponent(r)}`),method:"PATCH",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",body:Lr.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(!o.ok){if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new X(o.error.body);case 422:throw new xe(o.error.body);default:throw new m({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling PATCH /v1/private/projects/{id}.");case "unknown":throw new m({message:o.error.errorMessage})}}}async deleteProjectsBatch(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/projects/delete"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:Q.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/projects/delete.");case "unknown":throw new m({message:t.error.errorMessage})}}}async findFeedbackScoreNamesByProjectIds(r={},e){var s,c;let{projectIds:t}=r,o={};t!=null&&(o.project_ids=t);let n=await S({url:k((c=(s=await p.get(this._options.baseUrl))!=null?s:await p.get(this._options.environment))!=null?c:_.Default,"v1/private/projects/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",queryParameters:o,requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(n.ok)return Cs.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(n.error.reason==="status-code")throw new m({statusCode:n.error.statusCode,body:n.error.body});switch(n.error.reason){case "non-json":throw new m({statusCode:n.error.statusCode,body:n.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/projects/feedback-scores/names.");case "unknown":throw new m({message:n.error.errorMessage})}}async getProjectMetrics(r,e={},t){var n,s;let o=await S({url:k((s=(n=await p.get(this._options.baseUrl))!=null?n:await p.get(this._options.environment))!=null?s:_.Default,`v1/private/projects/${encodeURIComponent(r)}/metrics`),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",body:Br.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(o.ok)return Ms.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new X(o.error.body);case 404:throw new O(o.error.body);default:throw new m({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/projects/{id}/metrics.");case "unknown":throw new m({message:o.error.errorMessage})}}async getProjectStats(r={},e){var u,d;let{page:t,size:o,name:n,sorting:s}=r,c={};t!=null&&(c.page=t.toString()),o!=null&&(c.size=o.toString()),n!=null&&(c.name=n),s!=null&&(c.sorting=s);let l=await S({url:k((d=(u=await p.get(this._options.baseUrl))!=null?u:await p.get(this._options.environment))!=null?d:_.Default,"v1/private/projects/stats"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",queryParameters:c,requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(l.ok)return Ds.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(l.error.reason==="status-code")throw new m({statusCode:l.error.statusCode,body:l.error.body});switch(l.error.reason){case "non-json":throw new m({statusCode:l.error.statusCode,body:l.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/projects/stats.");case "unknown":throw new m({message:l.error.errorMessage})}}async retrieveProject(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/projects/retrieve"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:$r.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(t.ok)return Bs.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new X(t.error.body);case 404:throw new O(t.error.body);case 422:throw new xe(t.error.body);default:throw new m({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/projects/retrieve.");case "unknown":throw new m({message:t.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await p.get(this._options.apiKey)}}};var ao=class{constructor(r={}){this._options=r;}async getPrompts(r={},e){var l,u;let{page:t,size:o,name:n}=r,s={};t!=null&&(s.page=t.toString()),o!=null&&(s.size=o.toString()),n!=null&&(s.name=n);let c=await S({url:k((u=(l=await p.get(this._options.baseUrl))!=null?l:await p.get(this._options.environment))!=null?u:_.Default,"v1/private/prompts"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(c.ok)return Ys.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(c.error.reason==="status-code")throw new m({statusCode:c.error.statusCode,body:c.error.body});switch(c.error.reason){case "non-json":throw new m({statusCode:c.error.statusCode,body:c.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/prompts.");case "unknown":throw new m({message:c.error.errorMessage})}}async createPrompt(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/prompts"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:Vr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new X(t.error.body);case 409:throw new de(t.error.body);case 422:throw new xe(t.error.body);default:throw new m({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/prompts.");case "unknown":throw new m({message:t.error.errorMessage})}}}async createPromptVersion(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/prompts/versions"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:Jr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(t.ok)return Me.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new X(t.error.body);case 409:throw new de(t.error.body);case 422:throw new xe(t.error.body);default:throw new m({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/prompts/versions.");case "unknown":throw new m({message:t.error.errorMessage})}}async getPromptById(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,`v1/private/prompts/${encodeURIComponent(r)}`),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(t.ok)return Ws.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(t.error.reason==="status-code")switch(t.error.statusCode){case 404:throw new O(t.error.body);default:throw new m({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/prompts/{id}.");case "unknown":throw new m({message:t.error.errorMessage})}}async updatePrompt(r,e,t){var n,s;let o=await S({url:k((s=(n=await p.get(this._options.baseUrl))!=null?n:await p.get(this._options.environment))!=null?s:_.Default,`v1/private/prompts/${encodeURIComponent(r)}`),method:"PUT",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",body:Wr.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(!o.ok){if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new X(o.error.body);case 404:throw new O(o.error.body);case 409:throw new de(o.error.body);case 422:throw new xe(o.error.body);default:throw new m({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling PUT /v1/private/prompts/{id}.");case "unknown":throw new m({message:o.error.errorMessage})}}}async deletePrompt(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,`v1/private/prompts/${encodeURIComponent(r)}`),method:"DELETE",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling DELETE /v1/private/prompts/{id}.");case "unknown":throw new m({message:t.error.errorMessage})}}}async deletePromptsBatch(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/prompts/delete"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:Q.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/prompts/delete.");case "unknown":throw new m({message:t.error.errorMessage})}}}async getPromptVersionById(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,`v1/private/prompts/versions/${encodeURIComponent(r)}`),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(t.ok)return Me.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(t.error.reason==="status-code")switch(t.error.statusCode){case 404:throw new O(t.error.body);default:throw new m({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/prompts/versions/{versionId}.");case "unknown":throw new m({message:t.error.errorMessage})}}async getPromptVersions(r,e={},t){var l,u;let{page:o,size:n}=e,s={};o!=null&&(s.page=o.toString()),n!=null&&(s.size=n.toString());let c=await S({url:k((u=(l=await p.get(this._options.baseUrl))!=null?l:await p.get(this._options.environment))!=null?u:_.Default,`v1/private/prompts/${encodeURIComponent(r)}/versions`),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(c.ok)return Gs.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(c.error.reason==="status-code")throw new m({statusCode:c.error.statusCode,body:c.error.body});switch(c.error.reason){case "non-json":throw new m({statusCode:c.error.statusCode,body:c.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/prompts/{id}/versions.");case "unknown":throw new m({message:c.error.errorMessage})}}async retrievePromptVersion(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/prompts/versions/retrieve"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:Kr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(t.ok)return Me.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new X(t.error.body);case 404:throw new O(t.error.body);case 422:throw new xe(t.error.body);default:throw new m({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/prompts/versions/retrieve.");case "unknown":throw new m({message:t.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await p.get(this._options.apiKey)}}};var no=class{constructor(r={}){this._options=r;}async addSpanComment(r,e,t){var n,s;let o=await S({url:k((s=(n=await p.get(this._options.baseUrl))!=null?n:await p.get(this._options.environment))!=null?s:_.Default,`v1/private/spans/${encodeURIComponent(r)}/comments`),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",body:q.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(!o.ok){if(o.error.reason==="status-code")throw new m({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/spans/{id}/comments.");case "unknown":throw new m({message:o.error.errorMessage})}}}async addSpanFeedbackScore(r,e,t){var n,s;let o=await S({url:k((s=(n=await p.get(this._options.baseUrl))!=null?n:await p.get(this._options.environment))!=null?s:_.Default,`v1/private/spans/${encodeURIComponent(r)}/feedback-scores`),method:"PUT",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",body:Pe.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(!o.ok){if(o.error.reason==="status-code")throw new m({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling PUT /v1/private/spans/{id}/feedback-scores.");case "unknown":throw new m({message:o.error.errorMessage})}}}async getSpansByProject(r={},e){var x,T;let{page:t,size:o,projectName:n,projectId:s,traceId:c,type:l,filters:u,truncate:d,sorting:h}=r,b={};t!=null&&(b.page=t.toString()),o!=null&&(b.size=o.toString()),n!=null&&(b.project_name=n),s!=null&&(b.project_id=s),c!=null&&(b.trace_id=c),l!=null&&(b.type=Ii.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"})),u!=null&&(b.filters=u),d!=null&&(b.truncate=d.toString()),h!=null&&(b.sorting=h);let w=await S({url:k((T=(x=await p.get(this._options.baseUrl))!=null?x:await p.get(this._options.environment))!=null?T:_.Default,"v1/private/spans"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",queryParameters:b,requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(w.ok)return rc.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(w.error.reason==="status-code")throw new m({statusCode:w.error.statusCode,body:w.error.body});switch(w.error.reason){case "non-json":throw new m({statusCode:w.error.statusCode,body:w.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/spans.");case "unknown":throw new m({message:w.error.errorMessage})}}async createSpan(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/spans"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:Gr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")switch(t.error.statusCode){case 409:throw new de(t.error.body);default:throw new m({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/spans.");case "unknown":throw new m({message:t.error.errorMessage})}}}async createSpans(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/spans/batch"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:Hr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/spans/batch.");case "unknown":throw new m({message:t.error.errorMessage})}}}async getSpanById(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,`v1/private/spans/${encodeURIComponent(r)}`),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(t.ok)return Ft.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(t.error.reason==="status-code")switch(t.error.statusCode){case 404:throw new O(t.error.body);default:throw new m({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/spans/{id}.");case "unknown":throw new m({message:t.error.errorMessage})}}async deleteSpanById(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,`v1/private/spans/${encodeURIComponent(r)}`),method:"DELETE",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")switch(t.error.statusCode){case 501:throw new jr(t.error.body);default:throw new m({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling DELETE /v1/private/spans/{id}.");case "unknown":throw new m({message:t.error.errorMessage})}}}async updateSpan(r,e,t){var n,s;let o=await S({url:k((s=(n=await p.get(this._options.baseUrl))!=null?n:await p.get(this._options.environment))!=null?s:_.Default,`v1/private/spans/${encodeURIComponent(r)}`),method:"PATCH",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",body:Yr.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(!o.ok){if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new O(o.error.body);default:throw new m({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling PATCH /v1/private/spans/{id}.");case "unknown":throw new m({message:o.error.errorMessage})}}}async deleteSpanComments(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/spans/comments/delete"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:Q.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/spans/comments/delete.");case "unknown":throw new m({message:t.error.errorMessage})}}}async deleteSpanFeedbackScore(r,e,t){var n,s;let o=await S({url:k((s=(n=await p.get(this._options.baseUrl))!=null?n:await p.get(this._options.environment))!=null?s:_.Default,`v1/private/spans/${encodeURIComponent(r)}/feedback-scores/delete`),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",body:Nt.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(!o.ok){if(o.error.reason==="status-code")throw new m({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/spans/{id}/feedback-scores/delete.");case "unknown":throw new m({message:o.error.errorMessage})}}}async findFeedbackScoreNames1(r={},e){var c,l;let{projectId:t,type:o}=r,n={};t!=null&&(n.project_id=t),o!=null&&(n.type=Ni.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}));let s=await S({url:k((l=(c=await p.get(this._options.baseUrl))!=null?c:await p.get(this._options.environment))!=null?l:_.Default,"v1/private/spans/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",queryParameters:n,requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(s.ok)return hr.findFeedbackScoreNames1.Response.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(s.error.reason==="status-code")throw new m({statusCode:s.error.statusCode,body:s.error.body});switch(s.error.reason){case "non-json":throw new m({statusCode:s.error.statusCode,body:s.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/spans/feedback-scores/names.");case "unknown":throw new m({message:s.error.errorMessage})}}async getSpanComment(r,e,t){var n,s;let o=await S({url:k((s=(n=await p.get(this._options.baseUrl))!=null?n:await p.get(this._options.environment))!=null?s:_.Default,`v1/private/spans/${encodeURIComponent(e)}/comments/${encodeURIComponent(r)}`),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(o.ok)return q.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new O(o.error.body);default:throw new m({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/spans/{spanId}/comments/{commentId}.");case "unknown":throw new m({message:o.error.errorMessage})}}async getSpanStats(r={},e){var d,h;let{projectId:t,projectName:o,traceId:n,type:s,filters:c}=r,l={};t!=null&&(l.project_id=t),o!=null&&(l.project_name=o),n!=null&&(l.trace_id=n),s!=null&&(l.type=Ui.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"})),c!=null&&(l.filters=c);let u=await S({url:k((h=(d=await p.get(this._options.baseUrl))!=null?d:await p.get(this._options.environment))!=null?h:_.Default,"v1/private/spans/stats"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(u.ok)return Dt.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(u.error.reason==="status-code")throw new m({statusCode:u.error.statusCode,body:u.error.body});switch(u.error.reason){case "non-json":throw new m({statusCode:u.error.statusCode,body:u.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/spans/stats.");case "unknown":throw new m({message:u.error.errorMessage})}}async scoreBatchOfSpans(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/spans/feedback-scores"),method:"PUT",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:Ot.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling PUT /v1/private/spans/feedback-scores.");case "unknown":throw new m({message:t.error.errorMessage})}}}async searchSpans(r={},e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/spans/search"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:Zr.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(t.ok)return t.body;if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new X(t.error.body);default:throw new m({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/spans/search.");case "unknown":throw new m({message:t.error.errorMessage})}}async updateSpanComment(r,e,t){var n,s;let o=await S({url:k((s=(n=await p.get(this._options.baseUrl))!=null?n:await p.get(this._options.environment))!=null?s:_.Default,`v1/private/spans/comments/${encodeURIComponent(r)}`),method:"PATCH",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",body:q.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(!o.ok){if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new O(o.error.body);default:throw new m({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling PATCH /v1/private/spans/comments/{commentId}.");case "unknown":throw new m({message:o.error.errorMessage})}}}async _getCustomAuthorizationHeaders(){return {Authorization:await p.get(this._options.apiKey)}}};var so=class{constructor(r={}){this._options=r;}async addTraceComment(r,e,t){var n,s;let o=await S({url:k((s=(n=await p.get(this._options.baseUrl))!=null?n:await p.get(this._options.environment))!=null?s:_.Default,`v1/private/traces/${encodeURIComponent(r)}/comments`),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",body:q.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(!o.ok){if(o.error.reason==="status-code")throw new m({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/traces/{id}/comments.");case "unknown":throw new m({message:o.error.errorMessage})}}}async addTraceFeedbackScore(r,e,t){var n,s;let o=await S({url:k((s=(n=await p.get(this._options.baseUrl))!=null?n:await p.get(this._options.environment))!=null?s:_.Default,`v1/private/traces/${encodeURIComponent(r)}/feedback-scores`),method:"PUT",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",body:Pe.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(!o.ok){if(o.error.reason==="status-code")throw new m({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling PUT /v1/private/traces/{id}/feedback-scores.");case "unknown":throw new m({message:o.error.errorMessage})}}}async getTracesByProject(r={},e){var b,w;let{page:t,size:o,projectName:n,projectId:s,filters:c,truncate:l,sorting:u}=r,d={};t!=null&&(d.page=t.toString()),o!=null&&(d.size=o.toString()),n!=null&&(d.project_name=n),s!=null&&(d.project_id=s),c!=null&&(d.filters=c),l!=null&&(d.truncate=l.toString()),u!=null&&(d.sorting=u);let h=await S({url:k((w=(b=await p.get(this._options.baseUrl))!=null?b:await p.get(this._options.environment))!=null?w:_.Default,"v1/private/traces"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(h.ok)return dc.parseOrThrow(h.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(h.error.reason==="status-code")throw new m({statusCode:h.error.statusCode,body:h.error.body});switch(h.error.reason){case "non-json":throw new m({statusCode:h.error.statusCode,body:h.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/traces.");case "unknown":throw new m({message:h.error.errorMessage})}}async createTrace(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/traces"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:at.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/traces.");case "unknown":throw new m({message:t.error.errorMessage})}}}async createTraces(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/traces/batch"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:nt.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/traces/batch.");case "unknown":throw new m({message:t.error.errorMessage})}}}async getTraceById(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,`v1/private/traces/${encodeURIComponent(r)}`),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(t.ok)return Lt.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/traces/{id}.");case "unknown":throw new m({message:t.error.errorMessage})}}async deleteTraceById(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,`v1/private/traces/${encodeURIComponent(r)}`),method:"DELETE",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling DELETE /v1/private/traces/{id}.");case "unknown":throw new m({message:t.error.errorMessage})}}}async updateTrace(r,e={},t){var n,s;let o=await S({url:k((s=(n=await p.get(this._options.baseUrl))!=null?n:await p.get(this._options.environment))!=null?s:_.Default,`v1/private/traces/${encodeURIComponent(r)}`),method:"PATCH",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",body:st.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(!o.ok){if(o.error.reason==="status-code")throw new m({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling PATCH /v1/private/traces/{id}.");case "unknown":throw new m({message:o.error.errorMessage})}}}async deleteTraceComments(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/traces/comments/delete"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:Q.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/traces/comments/delete.");case "unknown":throw new m({message:t.error.errorMessage})}}}async deleteTraceFeedbackScore(r,e,t){var n,s;let o=await S({url:k((s=(n=await p.get(this._options.baseUrl))!=null?n:await p.get(this._options.environment))!=null?s:_.Default,`v1/private/traces/${encodeURIComponent(r)}/feedback-scores/delete`),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",body:Nt.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(!o.ok){if(o.error.reason==="status-code")throw new m({statusCode:o.error.statusCode,body:o.error.body});switch(o.error.reason){case "non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/traces/{id}/feedback-scores/delete.");case "unknown":throw new m({message:o.error.errorMessage})}}}async deleteTraceThreads(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/traces/threads/delete"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:ct.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/traces/threads/delete.");case "unknown":throw new m({message:t.error.errorMessage})}}}async deleteTraces(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/traces/delete"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:Q.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/traces/delete.");case "unknown":throw new m({message:t.error.errorMessage})}}}async findFeedbackScoreNames2(r={},e){var s,c;let{projectId:t}=r,o={};t!=null&&(o.project_id=t);let n=await S({url:k((c=(s=await p.get(this._options.baseUrl))!=null?s:await p.get(this._options.environment))!=null?c:_.Default,"v1/private/traces/feedback-scores/names"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",queryParameters:o,requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(n.ok)return br.findFeedbackScoreNames2.Response.parseOrThrow(n.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(n.error.reason==="status-code")throw new m({statusCode:n.error.statusCode,body:n.error.body});switch(n.error.reason){case "non-json":throw new m({statusCode:n.error.statusCode,body:n.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/traces/feedback-scores/names.");case "unknown":throw new m({message:n.error.errorMessage})}}async getTraceStats(r={},e){var l,u;let{projectId:t,projectName:o,filters:n}=r,s={};t!=null&&(s.project_id=t),o!=null&&(s.project_name=o),n!=null&&(s.filters=n);let c=await S({url:k((u=(l=await p.get(this._options.baseUrl))!=null?l:await p.get(this._options.environment))!=null?u:_.Default,"v1/private/traces/stats"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(c.ok)return Dt.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(c.error.reason==="status-code")throw new m({statusCode:c.error.statusCode,body:c.error.body});switch(c.error.reason){case "non-json":throw new m({statusCode:c.error.statusCode,body:c.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/traces/stats.");case "unknown":throw new m({message:c.error.errorMessage})}}async getTraceComment(r,e,t){var n,s;let o=await S({url:k((s=(n=await p.get(this._options.baseUrl))!=null?n:await p.get(this._options.environment))!=null?s:_.Default,`v1/private/traces/${encodeURIComponent(e)}/comments/${encodeURIComponent(r)}`),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(o.ok)return q.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new O(o.error.body);default:throw new m({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/traces/{traceId}/comments/{commentId}.");case "unknown":throw new m({message:o.error.errorMessage})}}async getTraceThread(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/traces/threads/retrieve"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:lt.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(t.ok)return Bt.parseOrThrow(t.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(t.error.reason==="status-code")switch(t.error.statusCode){case 404:throw new O(t.error.body);default:throw new m({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/traces/threads/retrieve.");case "unknown":throw new m({message:t.error.errorMessage})}}async getTraceThreads(r={},e){var h,b;let{page:t,size:o,projectName:n,projectId:s,truncate:c,filters:l}=r,u={};t!=null&&(u.page=t.toString()),o!=null&&(u.size=o.toString()),n!=null&&(u.project_name=n),s!=null&&(u.project_id=s),c!=null&&(u.truncate=c.toString()),l!=null&&(u.filters=l);let d=await S({url:k((b=(h=await p.get(this._options.baseUrl))!=null?h:await p.get(this._options.environment))!=null?b:_.Default,"v1/private/traces/threads"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(d.ok)return mc.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:true,allowUnrecognizedEnumValues:true,breadcrumbsPrefix:["response"]});if(d.error.reason==="status-code")throw new m({statusCode:d.error.statusCode,body:d.error.body});switch(d.error.reason){case "non-json":throw new m({statusCode:d.error.statusCode,body:d.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/private/traces/threads.");case "unknown":throw new m({message:d.error.errorMessage})}}async scoreBatchOfTraces(r,e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/traces/feedback-scores"),method:"PUT",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:Ot.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!t.ok){if(t.error.reason==="status-code")throw new m({statusCode:t.error.statusCode,body:t.error.body});switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling PUT /v1/private/traces/feedback-scores.");case "unknown":throw new m({message:t.error.errorMessage})}}}async searchTraces(r={},e){var o,n;let t=await S({url:k((n=(o=await p.get(this._options.baseUrl))!=null?o:await p.get(this._options.environment))!=null?n:_.Default,"v1/private/traces/search"),method:"POST",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",requestType:"json",body:pt.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}),responseType:"streaming",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(t.ok)return t.body;if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new X(t.error.body);case 401:throw new Y(t.error.body);default:throw new m({statusCode:t.error.statusCode,body:t.error.body})}switch(t.error.reason){case "non-json":throw new m({statusCode:t.error.statusCode,body:t.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling POST /v1/private/traces/search.");case "unknown":throw new m({message:t.error.errorMessage})}}async updateTraceComment(r,e,t){var n,s;let o=await S({url:k((s=(n=await p.get(this._options.baseUrl))!=null?n:await p.get(this._options.environment))!=null?s:_.Default,`v1/private/traces/comments/${encodeURIComponent(r)}`),method:"PATCH",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...t==null?void 0:t.headers},contentType:"application/json",requestType:"json",body:q.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),timeoutMs:(t==null?void 0:t.timeoutInSeconds)!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t==null?void 0:t.maxRetries,withCredentials:true,abortSignal:t==null?void 0:t.abortSignal});if(!o.ok){if(o.error.reason==="status-code")switch(o.error.statusCode){case 404:throw new O(o.error.body);default:throw new m({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case "non-json":throw new m({statusCode:o.error.statusCode,body:o.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling PATCH /v1/private/traces/comments/{commentId}.");case "unknown":throw new m({message:o.error.errorMessage})}}}async _getCustomAuthorizationHeaders(){return {Authorization:await p.get(this._options.apiKey)}}};var co=class{constructor(r={}){this._options=r;}async datasetsRedirect(r,e){var l,u;let{datasetId:t,workspaceName:o,path:n}=r,s={};s.dataset_id=t,o!=null&&(s.workspace_name=o),s.path=n;let c=await S({url:k((u=(l=await p.get(this._options.baseUrl))!=null?l:await p.get(this._options.environment))!=null?u:_.Default,"v1/session/redirect/datasets"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!c.ok){if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new X(c.error.body);case 404:throw new O(c.error.body);default:throw new m({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case "non-json":throw new m({statusCode:c.error.statusCode,body:c.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/session/redirect/datasets.");case "unknown":throw new m({message:c.error.errorMessage})}}}async experimentsRedirect(r,e){var u,d;let{datasetId:t,experimentId:o,workspaceName:n,path:s}=r,c={};c.dataset_id=t,c.experiment_id=o,n!=null&&(c.workspace_name=n),c.path=s;let l=await S({url:k((d=(u=await p.get(this._options.baseUrl))!=null?u:await p.get(this._options.environment))!=null?d:_.Default,"v1/session/redirect/experiments"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",queryParameters:c,requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!l.ok){if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new X(l.error.body);case 404:throw new O(l.error.body);default:throw new m({statusCode:l.error.statusCode,body:l.error.body})}switch(l.error.reason){case "non-json":throw new m({statusCode:l.error.statusCode,body:l.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/session/redirect/experiments.");case "unknown":throw new m({message:l.error.errorMessage})}}}async projectsRedirect(r,e){var l,u;let{traceId:t,workspaceName:o,path:n}=r,s={};s.trace_id=t,o!=null&&(s.workspace_name=o),s.path=n;let c=await S({url:k((u=(l=await p.get(this._options.baseUrl))!=null?l:await p.get(this._options.environment))!=null?u:_.Default,"v1/session/redirect/projects"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...e==null?void 0:e.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:(e==null?void 0:e.timeoutInSeconds)!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e==null?void 0:e.maxRetries,withCredentials:true,abortSignal:e==null?void 0:e.abortSignal});if(!c.ok){if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new X(c.error.body);case 404:throw new O(c.error.body);default:throw new m({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case "non-json":throw new m({statusCode:c.error.statusCode,body:c.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /v1/session/redirect/projects.");case "unknown":throw new m({message:c.error.errorMessage})}}}async _getCustomAuthorizationHeaders(){return {Authorization:await p.get(this._options.apiKey)}}};var $t=class{constructor(r={}){this._options=r;}get systemUsage(){var r;return (r=this._systemUsage)!=null?r:this._systemUsage=new Gi(this._options)}get attachments(){var r;return (r=this._attachments)!=null?r:this._attachments=new Hi(this._options)}get check(){var r;return (r=this._check)!=null?r:this._check=new Yi(this._options)}get automationRuleEvaluators(){var r;return (r=this._automationRuleEvaluators)!=null?r:this._automationRuleEvaluators=new Zi(this._options)}get chatCompletions(){var r;return (r=this._chatCompletions)!=null?r:this._chatCompletions=new Qi(this._options)}get datasets(){var r;return (r=this._datasets)!=null?r:this._datasets=new qi(this._options)}get experiments(){var r;return (r=this._experiments)!=null?r:this._experiments=new eo(this._options)}get feedbackDefinitions(){var r;return (r=this._feedbackDefinitions)!=null?r:this._feedbackDefinitions=new ro(this._options)}get llmProviderKey(){var r;return (r=this._llmProviderKey)!=null?r:this._llmProviderKey=new to(this._options)}get openTelemetryIngestion(){var r;return (r=this._openTelemetryIngestion)!=null?r:this._openTelemetryIngestion=new io(this._options)}get projects(){var r;return (r=this._projects)!=null?r:this._projects=new oo(this._options)}get prompts(){var r;return (r=this._prompts)!=null?r:this._prompts=new ao(this._options)}get spans(){var r;return (r=this._spans)!=null?r:this._spans=new no(this._options)}get traces(){var r;return (r=this._traces)!=null?r:this._traces=new so(this._options)}get redirect(){var r;return (r=this._redirect)!=null?r:this._redirect=new co(this._options)}async isAlive(r){var t,o;let e=await S({url:k((o=(t=await p.get(this._options.baseUrl))!=null?t:await p.get(this._options.environment))!=null?o:_.Default,"is-alive/ping"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(e.ok)return e.body;if(e.error.reason==="status-code")throw new m({statusCode:e.error.statusCode,body:e.error.body});switch(e.error.reason){case "non-json":throw new m({statusCode:e.error.statusCode,body:e.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /is-alive/ping.");case "unknown":throw new m({message:e.error.errorMessage})}}async version(r){var t,o;let e=await S({url:k((o=(t=await p.get(this._options.baseUrl))!=null?t:await p.get(this._options.environment))!=null?o:_.Default,"is-alive/ver"),method:"GET",headers:{"Comet-Workspace":await p.get(this._options.workspaceName)!=null?await p.get(this._options.workspaceName):void 0,"X-Fern-Language":"JavaScript","X-Fern-Runtime":g.type,"X-Fern-Runtime-Version":g.version,...await this._getCustomAuthorizationHeaders(),...r==null?void 0:r.headers},contentType:"application/json",requestType:"json",timeoutMs:(r==null?void 0:r.timeoutInSeconds)!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r==null?void 0:r.maxRetries,withCredentials:true,abortSignal:r==null?void 0:r.abortSignal});if(e.ok)return e.body;if(e.error.reason==="status-code")throw new m({statusCode:e.error.statusCode,body:e.error.body});switch(e.error.reason){case "non-json":throw new m({statusCode:e.error.statusCode,body:e.error.rawBody});case "timeout":throw new y("Timeout exceeded when calling GET /is-alive/ver.");case "unknown":throw new m({message:e.error.errorMessage})}}async _getCustomAuthorizationHeaders(){return {Authorization:await p.get(this._options.apiKey)}}};var Vt=()=>xr.v7();var lo=class{constructor(r,e){this.data=r;this.opik=e;this.end=()=>this.update({endTime:new Date});this.score=r=>{var e;this.opik.spanFeedbackScoresBatchQueue.create({...r,projectName:(e=this.data.projectName)!=null?e:this.opik.config.projectName,id:this.data.id,source:"sdk"});};this.update=r=>{var t;let e={parentSpanId:this.data.parentSpanId,projectName:(t=this.data.projectName)!=null?t:this.opik.config.projectName,traceId:this.data.traceId,...r};return this.opik.spanBatchQueue.update(this.data.id,e),this.data={...this.data,...r},this};}};var po=class{constructor(r,e){this.data=r;this.opik=e;this.spans=[];this.end=()=>this.update({endTime:new Date});this.score=r=>{var e;this.opik.traceFeedbackScoresBatchQueue.create({...r,projectName:(e=this.data.projectName)!=null?e:this.opik.config.projectName,id:this.data.id,source:"sdk"});};this.span=r=>{var n,s;let e=(s=(n=this.data.projectName)!=null?n:r.projectName)!=null?s:this.opik.config.projectName,t={id:Vt(),startTime:new Date,...r,projectName:e,traceId:this.data.id};this.opik.spanBatchQueue.create(t);let o=new lo(t,this.opik);return this.spans.push(o),o};this.update=r=>{var t;let e={projectName:(t=this.data.projectName)!=null?t:this.opik.config.projectName,...r};return this.opik.traceBatchQueue.update(this.data.id,e),this.data={...this.data,...e},this};}};var Th=a=>a.replace("/api",""),Vp=({apiUrl:a,projectName:r,workspaceName:e})=>{let t=encodeURIComponent(r);return `${Th(a)}/${e}/redirect/projects?name=${t}`};var Ph=300,Ch=100,Jt=class{constructor({action:r,batchSize:e=Ch,delay:t,enableBatch:o,name:n="ActionQueue"}){this.timerId=null;this.promise=Promise.resolve();this.queue=new Map;this.debounceFlush=()=>{this.timerId&&clearTimeout(this.timerId),this.timerId=setTimeout(()=>this.flush(),this.delay);};this.add=(r,e)=>{if(this.queue.set(r,e),!this.enableBatch){this.flush();return}if(this.queue.size>=this.batchSize){this.flush();return}this.debounceFlush();};this.update=(r,e)=>{let t=this.queue.get(r);t&&(this.queue.set(r,{...t,...e}),this.debounceFlush());};this.flush=async()=>{if(this.queue.size===0)return this.promise;let r=new Map(this.queue);this.queue.clear(),U.debug(`Adding ${r.size} items to ${this.name} promise:`,r),this.promise=this.promise.finally(()=>(U.debug(`Flushing ${this.name}:`,r),this.action(r))).catch(e=>{U.error(`Failed to flush ${this.name}:`,e,r);}),await this.promise;};this.action=r,this.batchSize=e,this.delay=t,this.enableBatch=o,this.name=n;}},Ie=class{constructor({delay:r=Ph,enableCreateBatch:e=true,enableDeleteBatch:t=true,name:o="BatchQueue"}){this.create=r=>{let e=this.getId(r);this.createQueue.add(e,r);};this.get=async r=>{let e=this.createQueue.queue.get(r);return e||this.getEntity(r)};this.update=(r,e)=>{if(this.createQueue.queue.get(r)){this.createQueue.update(r,e);return}this.updateQueue.add(r,e);};this.delete=r=>{if(this.createQueue.queue.has(r)){this.createQueue.queue.delete(r);return}this.deleteQueue.add(r);};this.flush=async()=>{await this.createQueue.flush(),await this.updateQueue.flush(),await this.deleteQueue.flush();};this.name=o,this.createQueue=new Jt({action:async n=>{await this.createEntities(Array.from(n.values()));},delay:r,enableBatch:e,name:`${o}:createQueue`}),this.updateQueue=new Jt({action:async n=>{await this.createQueue.flush();let s=Array.from(n.entries());for(let[c,l]of s)await this.updateEntity(c,l);},delay:r,enableBatch:false,name:`${o}:updateQueue`}),this.deleteQueue=new Jt({action:async n=>{await this.createQueue.flush(),await this.updateQueue.flush(),await this.deleteEntities(Array.from(n.keys()));},delay:r,enableBatch:t,name:`${o}:deleteQueue`});}};var uo=class extends Ie{constructor(e,t){super({delay:t,enableDeleteBatch:false,name:"SpanBatchQueue"});this.api=e;}getId(e){return e.id}async createEntities(e){await this.api.spans.createSpans({spans:e});}async getEntity(e){return await this.api.spans.getSpanById(e)}async updateEntity(e,t){await this.api.spans.updateSpan(e,t);}async deleteEntities(e){for(let t of e)await this.api.spans.deleteSpanById(t);}};var mo=class extends Ie{constructor(e,t){super({delay:t,enableDeleteBatch:false,name:"SpanFeedbackScoresBatchQueue"});this.api=e;}getId(e){return {id:e.id,name:e.name}}async createEntities(e){await this.api.spans.scoreBatchOfSpans({scores:e});}async getEntity(){throw new Error("Not implemented")}async updateEntity(){throw new Error("Not implemented")}async deleteEntities(e){for(let t of e)await this.api.spans.deleteSpanFeedbackScore(t.id,{name:t.name});}};var fo=class extends Ie{constructor(e,t){super({delay:t,name:"TraceBatchQueue"});this.api=e;}getId(e){return e.id}async createEntities(e){await this.api.traces.createTraces({traces:e});}async getEntity(e){return await this.api.traces.getTraceById(e)}async updateEntity(e,t){await this.api.traces.updateTrace(e,t);}async deleteEntities(e){await this.api.traces.deleteTraces({ids:e});}};var ho=class extends Ie{constructor(e,t){super({delay:t,enableDeleteBatch:false,name:"TraceFeedbackScoresBatchQueue"});this.api=e;}getId(e){return {id:e.id,name:e.name}}async createEntities(e){await this.api.traces.scoreBatchOfTraces({scores:e});}async getEntity(){throw new Error("Not implemented")}async updateEntity(){throw new Error("Not implemented")}async deleteEntities(e){for(let t of e)await this.api.traces.deleteTraceFeedbackScore(t.id,{name:t.name});}};var tr=class{constructor(r){this.displayTraceLog=r=>{if(r===this.lastProjectNameLogged||!this.config.apiUrl)return;let e=Vp({apiUrl:this.config.apiUrl,projectName:r,workspaceName:this.config.workspaceName});U.info(`Started logging traces to the "${r}" project at ${ul(e)}`),this.lastProjectNameLogged=r;};this.trace=r=>{var o;U.debug("Creating new trace with data:",r);let e=(o=r.projectName)!=null?o:this.config.projectName,t=new po({id:Vt(),startTime:new Date,...r,projectName:e},this);return this.traceBatchQueue.create(t.data),U.debug("Trace added to the queue with ID:",t.data.id),this.displayTraceLog(e),t};this.flush=async()=>{U.debug("Starting flush operation");try{await this.traceBatchQueue.flush(),await this.spanBatchQueue.flush(),await this.traceFeedbackScoresBatchQueue.flush(),await this.spanFeedbackScoresBatchQueue.flush(),U.info("Successfully flushed all data to Opik");}catch(r){U.error("Error during flush operation:",{error:r instanceof Error?r.message:r});}};U.debug("Initializing OpikClient with config:",r),this.config=Cl(r),this.api=new $t({apiKey:this.config.apiKey,environment:this.config.apiUrl,workspaceName:this.config.workspaceName}),this.spanBatchQueue=new uo(this.api),this.traceBatchQueue=new fo(this.api),this.spanFeedbackScoresBatchQueue=new mo(this.api),this.traceFeedbackScoresBatchQueue=new ho(this.api);}};new async_hooks.AsyncLocalStorage;new tr;function Ih(a,r){function e(t,o){if(typeof t!="object"||t===null||t===void 0)return t;if(o>=r)return Array.isArray(t)?"[Array]":"[Object]";if(Array.isArray(t))return t.map(s=>e(s,o+1));let n={};for(let s of Object.keys(t))n[s]=e(t[s],o+1);return n}return JSON.stringify(e(a,0),null,2)}var Ne=class extends We{get lc_aliases(){return {additional_kwargs:"additional_kwargs",response_metadata:"response_metadata"}}get text(){return typeof this.content=="string"?this.content:""}getType(){return this._getType()}constructor(r,e){typeof r=="string"&&(r={content:r,additional_kwargs:e,response_metadata:{}}),r.additional_kwargs||(r.additional_kwargs={}),r.response_metadata||(r.response_metadata={}),super(r),Object.defineProperty(this,"lc_namespace",{enumerable:true,configurable:true,writable:true,value:["langchain_core","messages"]}),Object.defineProperty(this,"lc_serializable",{enumerable:true,configurable:true,writable:true,value:true}),Object.defineProperty(this,"content",{enumerable:true,configurable:true,writable:true,value:void 0}),Object.defineProperty(this,"name",{enumerable:true,configurable:true,writable:true,value:void 0}),Object.defineProperty(this,"additional_kwargs",{enumerable:true,configurable:true,writable:true,value:void 0}),Object.defineProperty(this,"response_metadata",{enumerable:true,configurable:true,writable:true,value:void 0}),Object.defineProperty(this,"id",{enumerable:true,configurable:true,writable:true,value:void 0}),this.name=r.name,this.content=r.content,this.additional_kwargs=r.additional_kwargs,this.response_metadata=r.response_metadata,this.id=r.id;}toDict(){return {type:this._getType(),data:this.toJSON().kwargs}}static lc_name(){return "BaseMessage"}get _printableFields(){return {id:this.id,content:this.content,name:this.name,additional_kwargs:this.additional_kwargs,response_metadata:this.response_metadata}}_updateId(r){this.id=r,this.lc_kwargs.id=r;}get[Symbol.toStringTag](){return this.constructor.lc_name()}[Symbol.for("nodejs.util.inspect.custom")](r){if(r===null)return this;let e=Ih(this._printableFields,Math.max(4,r));return `${this.constructor.lc_name()} ${e}`}};var ir=class extends Ne{static lc_name(){return "ToolMessage"}get lc_aliases(){return {tool_call_id:"tool_call_id"}}constructor(r,e,t){typeof r=="string"&&(r={content:r,name:t,tool_call_id:e}),super(r),Object.defineProperty(this,"lc_direct_tool_output",{enumerable:true,configurable:true,writable:true,value:true}),Object.defineProperty(this,"status",{enumerable:true,configurable:true,writable:true,value:void 0}),Object.defineProperty(this,"tool_call_id",{enumerable:true,configurable:true,writable:true,value:void 0}),Object.defineProperty(this,"artifact",{enumerable:true,configurable:true,writable:true,value:void 0}),this.tool_call_id=r.tool_call_id,this.artifact=r.artifact,this.status=r.status;}_getType(){return "tool"}static isInstance(r){return r._getType()==="tool"}get _printableFields(){return {...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}};je(wo());je(wo());je(xo());je(rd());new TextEncoder;var Zc={};$(Zc,{JsonPatchError:()=>G,_areEquals:()=>oi,applyOperation:()=>cr,applyPatch:()=>Go,applyReducer:()=>zy,deepClone:()=>Ey,getValueByPointer:()=>Ko,validate:()=>gd,validator:()=>Xo});var vy=Object.prototype.hasOwnProperty;function fd(a,r){return vy.call(a,r)}function hd(a){if(Array.isArray(a)){let e=new Array(a.length);for(let t=0;t<e.length;t++)e[t]=""+t;return e}if(Object.keys)return Object.keys(a);let r=[];for(let e in a)fd(a,e)&&r.push(e);return r}function Ae(a){switch(typeof a){case "object":return JSON.parse(JSON.stringify(a));case "undefined":return null;default:return a}}function Jo(a){let r=0,e=a.length,t;for(;r<e;){if(t=a.charCodeAt(r),t>=48&&t<=57){r++;continue}return false}return true}function ii(a){return a.replace(/~1/g,"/").replace(/~0/g,"~")}function Vo(a){if(a===void 0)return true;if(a){if(Array.isArray(a)){for(let e=0,t=a.length;e<t;e++)if(Vo(a[e]))return true}else if(typeof a=="object"){let e=hd(a),t=e.length;for(var r=0;r<t;r++)if(Vo(a[e[r]]))return true}}return false}function dd(a,r){let e=[a];for(let t in r){let o=typeof r[t]=="object"?JSON.stringify(r[t],null,2):r[t];typeof o!="undefined"&&e.push(`${t}: ${o}`);}return e.join(`
|
|
4
|
-
`)}var sr=class extends Error{constructor(r,e,t,o,n){super(dd(r,{name:e,index:t,operation:o,tree:n})),Object.defineProperty(this,"name",{enumerable:true,configurable:true,writable:true,value:e}),Object.defineProperty(this,"index",{enumerable:true,configurable:true,writable:true,value:t}),Object.defineProperty(this,"operation",{enumerable:true,configurable:true,writable:true,value:o}),Object.defineProperty(this,"tree",{enumerable:true,configurable:true,writable:true,value:n}),Object.setPrototypeOf(this,new.target.prototype),this.message=dd(r,{name:e,index:t,operation:o,tree:n});}};var G=sr,Ey=Ae,Rr={add:function(a,r,e){return a[r]=this.value,{newDocument:e}},remove:function(a,r,e){var t=a[r];return delete a[r],{newDocument:e,removed:t}},replace:function(a,r,e){var t=a[r];return a[r]=this.value,{newDocument:e,removed:t}},move:function(a,r,e){let t=Ko(e,this.path);t&&(t=Ae(t));let o=cr(e,{op:"remove",path:this.from}).removed;return cr(e,{op:"add",path:this.path,value:o}),{newDocument:e,removed:t}},copy:function(a,r,e){let t=Ko(e,this.from);return cr(e,{op:"add",path:this.path,value:Ae(t)}),{newDocument:e}},test:function(a,r,e){return {newDocument:e,test:oi(a[r],this.value)}},_get:function(a,r,e){return this.value=a[r],{newDocument:e}}},Ay={add:function(a,r,e){return Jo(r)?a.splice(r,0,this.value):a[r]=this.value,{newDocument:e,index:r}},remove:function(a,r,e){var t=a.splice(r,1);return {newDocument:e,removed:t[0]}},replace:function(a,r,e){var t=a[r];return a[r]=this.value,{newDocument:e,removed:t}},move:Rr.move,copy:Rr.copy,test:Rr.test,_get:Rr._get};function Ko(a,r){if(r=="")return a;var e={op:"_get",path:r};return cr(a,e),e.value}function cr(a,r,e=false,t=true,o=true,n=0){if(e&&(typeof e=="function"?e(r,0,a,r.path):Xo(r,0)),r.path===""){let s={newDocument:a};if(r.op==="add")return s.newDocument=r.value,s;if(r.op==="replace")return s.newDocument=r.value,s.removed=a,s;if(r.op==="move"||r.op==="copy")return s.newDocument=Ko(a,r.from),r.op==="move"&&(s.removed=a),s;if(r.op==="test"){if(s.test=oi(a,r.value),s.test===false)throw new G("Test operation failed","TEST_OPERATION_FAILED",n,r,a);return s.newDocument=a,s}else {if(r.op==="remove")return s.removed=a,s.newDocument=null,s;if(r.op==="_get")return r.value=a,s;if(e)throw new G("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",n,r,a);return s}}else {t||(a=Ae(a));let c=(r.path||"").split("/"),l=a,u=1,d=c.length,h,b,w;for(typeof e=="function"?w=e:w=Xo;;){if(b=c[u],b&&b.indexOf("~")!=-1&&(b=ii(b)),o&&(b=="__proto__"||b=="prototype"&&u>0&&c[u-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(e&&h===void 0&&(l[b]===void 0?h=c.slice(0,u).join("/"):u==d-1&&(h=r.path),h!==void 0&&w(r,0,a,h)),u++,Array.isArray(l)){if(b==="-")b=l.length;else {if(e&&!Jo(b))throw new G("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",n,r,a);Jo(b)&&(b=~~b);}if(u>=d){if(e&&r.op==="add"&&b>l.length)throw new G("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",n,r,a);let x=Ay[r.op].call(r,l,b,a);if(x.test===false)throw new G("Test operation failed","TEST_OPERATION_FAILED",n,r,a);return x}}else if(u>=d){let x=Rr[r.op].call(r,l,b,a);if(x.test===false)throw new G("Test operation failed","TEST_OPERATION_FAILED",n,r,a);return x}if(l=l[b],e&&u<d&&(!l||typeof l!="object"))throw new G("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",n,r,a)}}}function Go(a,r,e,t=true,o=true){if(e&&!Array.isArray(r))throw new G("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");t||(a=Ae(a));let n=new Array(r.length);for(let s=0,c=r.length;s<c;s++)n[s]=cr(a,r[s],e,true,o,s),a=n[s].newDocument;return n.newDocument=a,n}function zy(a,r,e){let t=cr(a,r);if(t.test===false)throw new G("Test operation failed","TEST_OPERATION_FAILED",e,r,a);return t.newDocument}function Xo(a,r,e,t){if(typeof a!="object"||a===null||Array.isArray(a))throw new G("Operation is not an object","OPERATION_NOT_AN_OBJECT",r,a,e);if(Rr[a.op]){if(typeof a.path!="string")throw new G("Operation `path` property is not a string","OPERATION_PATH_INVALID",r,a,e);if(a.path.indexOf("/")!==0&&a.path.length>0)throw new G('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",r,a,e);if((a.op==="move"||a.op==="copy")&&typeof a.from!="string")throw new G("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",r,a,e);if((a.op==="add"||a.op==="replace"||a.op==="test")&&a.value===void 0)throw new G("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",r,a,e);if((a.op==="add"||a.op==="replace"||a.op==="test")&&Vo(a.value))throw new G("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",r,a,e);if(e){if(a.op=="add"){var o=a.path.split("/").length,n=t.split("/").length;if(o!==n+1&&o!==n)throw new G("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",r,a,e)}else if(a.op==="replace"||a.op==="remove"||a.op==="_get"){if(a.path!==t)throw new G("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",r,a,e)}else if(a.op==="move"||a.op==="copy"){var s={op:"_get",path:a.from,value:void 0},c=gd([s],e);if(c&&c.name==="OPERATION_PATH_UNRESOLVABLE")throw new G("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",r,a,e)}}}else throw new G("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",r,a,e)}function gd(a,r,e){try{if(!Array.isArray(a))throw new G("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(r)Go(Ae(r),Ae(a),e||!0);else {e=e||Xo;for(var t=0;t<a.length;t++)e(a[t],t,r,void 0);}}catch(o){if(o instanceof G)return o;throw o}}function oi(a,r){if(a===r)return true;if(a&&r&&typeof a=="object"&&typeof r=="object"){var e=Array.isArray(a),t=Array.isArray(r),o,n,s;if(e&&t){if(n=a.length,n!=r.length)return false;for(o=n;o--!==0;)if(!oi(a[o],r[o]))return false;return true}if(e!=t)return false;var c=Object.keys(a);if(n=c.length,n!==Object.keys(r).length)return false;for(o=n;o--!==0;)if(!r.hasOwnProperty(c[o]))return false;for(o=n;o--!==0;)if(s=c[o],!oi(a[s],r[s]))return false;return true}return a!==a&&r!==r}({...Zc});var qc=je(_d());var {color:be}=qc.default;je(xo());je(wo());je(xo());new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var Ze=a=>typeof a=="object"&&a!==null,Xy=a=>Ze(a)&&"content"in a,Gy=a=>Ze(a)&&"messages"in a,Hy=a=>Ze(a)&&"value"in a,Yy=a=>Ze(a)&&"kwargs"in a,Tr=(...a)=>a.find(r=>r!=null),Pd=a=>Object.fromEntries(Object.entries(a).filter(([,r])=>!(r==null||Array.isArray(r)&&r.length===0||Ze(r)&&Object.keys(r).length===0))),Cd=a=>{try{return JSON.parse(a)}catch{return {value:a}}},ll=a=>{var o;let r=(o=a.name)!=null?o:a.getType();a.getType()==="human"?r="user":a.getType()==="ai"?r="assistant":a.getType()==="system"&&(r="system");let e={},t=a;return "tool_calls"in t&&(e.tool_calls=t.tool_calls),"status"in t&&(e.status=t.status),"artifact"in t&&(e.artifact=t.artifact),Pd({content:a.content,role:r,...e})},jd=a=>({messages:a.flatMap(e=>e.map(ll))}),Td=a=>"message"in a?ll(a.message):"text"in a&&a.text?a.text:a,Id=a=>({generations:a.flatMap(e=>Array.isArray(e)?e.map(Td):Td(e))}),Nd=a=>a instanceof ir?ll(a):void 0,Cr=(a,r,e)=>{let t=Pd({model:Tr(r==null?void 0:r.model,e==null?void 0:e.ls_model_name,a.name),temperature:Tr(r==null?void 0:r.temperature,e==null?void 0:e.ls_temperature),top_p:Tr(r==null?void 0:r.top_p,r==null?void 0:r.topP),top_k:Tr(r==null?void 0:r.top_k,r==null?void 0:r.topK),max_tokens:Tr(r==null?void 0:r.max_tokens,r==null?void 0:r.maxOutputTokens),frequency_penalty:r==null?void 0:r.frequency_penalty,presence_penalty:r==null?void 0:r.presence_penalty,response_format:r==null?void 0:r.response_format,tool_choice:r==null?void 0:r.tool_choice,function_call:r==null?void 0:r.function_call,n:r==null?void 0:r.n,stop:Tr(r==null?void 0:r.stop,r==null?void 0:r.stop_sequence)});return Object.keys(t).length?t:r},Pr=a=>{if(a==null)return {value:a};if(typeof a=="string"||typeof a=="number"||typeof a=="boolean")return {value:a};if(!Ze(a))return {value:a};if(Xy(a)&&a.content!==void 0){let r=a.content;return Ze(r)?r:{value:r}}if(Gy(a)&&a.messages!==void 0)return {messages:Array.isArray(a.messages)?a.messages.map(Pr):[Pr(a.messages)]};if(Hy(a)&&a.value!==void 0){let r=a.value;return Ze(r)?r:{value:r}}return Yy(a)&&a.kwargs!==void 0?Pr(a.kwargs):Object.fromEntries(Object.entries(a).map(([r,e])=>[r,Pr(e)]))},Ud=a=>{try{let r=(Array.isArray(a)?a:[a]).filter(e=>e!=null).flatMap(Pr);return r.length===1?r[0]:r.length>1?{values:r}:{}}catch(r){return console.warn("Error processing chain outputs:",r),{error:String(r)}}},Qo=a=>{try{let r=(Array.isArray(a)?a:[a]).filter(e=>e!=null).flatMap(Pr);return r.length===1?r[0]:r.length>1?{values:r}:{}}catch(r){return console.warn("Error processing chain inputs:",r),{error:String(r)}}};var pl=class extends Ue{constructor(e){var t;super();this.name="OpikCallbackHandler";this.spansMap=new Map;this.options={...e},this.client=(t=e==null?void 0:e.client)!=null?t:new tr,e!=null&&e.projectName&&(this.client.config.projectName=e==null?void 0:e.projectName);}startTracing({runId:e,parentRunId:t,name:o,input:n,tags:s,metadata:c,type:l}){let u=c==null?void 0:c.ls_provider,d=c==null?void 0:c.ls_model_name;if(!t&&e===this.rootTraceId)return;if(t||(this.rootTraceId=e,this.rootTrace=this.client.trace({name:o,input:n,tags:this.options.tags,metadata:c})),!this.rootTrace){U.debug(`handleChainStart error ${e} has no parent`);return}let h;this.rootTraceId&&this.rootTraceId!==t&&(h=t);let b=this.spansMap.get(e),w;b?w=b.update({input:Qo(n),tags:s,metadata:c,model:d,provider:u}):w=this.rootTrace.span({type:l||Qe.General,name:o,input:Qo(n),tags:s,metadata:c,model:d,provider:u,parentSpanId:h}),this.spansMap.set(e,w);}endTracing({runId:e,output:t,error:o,tags:n,usage:s,metadata:c}){var d,h;let l;o&&(U.debug(`End tracing because of error ${o.message}`),l={message:o.message,exceptionType:o.name,traceback:(d=o.stack)!=null?d:""});let u=this.spansMap.get(e);if(!u){U.debug(`handleChainEnd span ${e} has not found`);return}u.update({output:t,errorInfo:l,tags:n,usage:s,metadata:c}),u.end(),this.spansMap.delete(e),e===this.rootTraceId&&(this.rootTraceId=void 0,(h=this.rootTrace)==null||h.end(),this.rootTrace=void 0);}async handleChatModelStart(e,t,o,n,s,c,l,u){var d,h,b;U.debug(`handleChatModelStart runId - ${o}, parentRunId ${n}`),this.startTracing({runId:o,parentRunId:n,name:(h=u!=null?u:(d=e.id.at(-1))==null?void 0:d.toString())!=null?h:"Chat Model",type:Qe.Llm,input:jd(t),tags:c,metadata:{...l,...Cr(e,(s==null?void 0:s.invocation_params)||{},l),tools:(b=s==null?void 0:s.invocation_params)==null?void 0:b.tools}});}async handleLLMStart(e,t,o,n,s,c,l,u){var d,h;U.debug(`handleLLMStart runId - ${o}, parentRunId ${n}`),this.startTracing({runId:o,parentRunId:n,name:(h=u!=null?u:(d=e.id.at(-1))==null?void 0:d.toString())!=null?h:"LLM",type:Qe.Llm,input:{prompts:t},tags:c,metadata:{...l,...Cr(e,(s==null?void 0:s.invocation_params)||{},l)}});}async handleLLMError(e,t,o,n){U.debug(`handleLLMError runId - ${t}, parentRunId ${o}`),this.endTracing({runId:t,error:e,tags:n});}async handleLLMEnd(e,t,o,n){U.debug(`handleLLMEnd runId - ${t}, parentRunId ${o}`);let{llmOutput:s,generations:c,...l}=e,u=(s==null?void 0:s.tokenUsage)||(s==null?void 0:s.estimatedTokens)||{};this.endTracing({runId:t,output:Id(c),usage:{prompt_tokens:u.completionTokens,completion_tokens:u.promptTokens,total_tokens:u.totalTokens},tags:n,metadata:l});}async handleChainStart(e,t,o,n,s,c,l,u){var b,w;if(U.debug(`handleChainStart runId - ${o}, parentRunId ${n}`),s!=null&&s.includes("langsmith:hidden"))return;let d=(w=u!=null?u:(b=e.id.at(-1))==null?void 0:b.toString())!=null?w:"Chain",h={runId:o,parentRunId:n,name:d,input:Qo(t),tags:this.options.tags,metadata:{...c,...Cr(e,{},c)}};n||(h.metadata={...c,...this.options.metadata}),this.startTracing(h);}async handleChainError(e,t,o,n){U.debug(`handleChainError runId - ${t}, parentRunId ${o}`),this.endTracing({runId:t,tags:n,error:e});}async handleChainEnd(e,t,o,n){U.debug(`handleChainEnd runId - ${t}, parentRunId ${o}`),this.endTracing({runId:t,output:Ud(e),tags:n});}async handleToolStart(e,t,o,n,s,c,l){var u,d;U.debug(`handleToolStart runId - ${o}, parentRunId ${n}`),this.startTracing({runId:o,parentRunId:n,name:(d=l!=null?l:(u=e.id.at(-1))==null?void 0:u.toString())!=null?d:"Tool",input:Cd(t),tags:s,type:Qe.Tool,metadata:{...c,...Cr(e,{},c)}});}async handleToolError(e,t,o,n){U.debug(`handleToolError runId - ${t}, parentRunId ${o}`),this.endTracing({runId:t,tags:n,error:e});}async handleToolEnd(e,t,o,n){U.debug(`handleToolEnd runId - ${t}, parentRunId ${o}`),this.endTracing({runId:t,output:Nd(e),tags:n});}async handleAgentAction(e,t,o,n){U.debug(`handleAgentAction runId - ${t}, parentRunId ${o}`),this.startTracing({runId:t,parentRunId:o,name:e.tool,input:e,tags:n});}async handleAgentEnd(e,t,o,n){U.debug(`handleAgentEnd runId - ${t}, parentRunId ${o}`),this.endTracing({runId:t,output:e,tags:n});}async handleRetrieverStart(e,t,o,n,s,c,l){var u,d;U.debug(`handleRetrieverStart runId - ${o}, parentRunId ${n}`),this.startTracing({runId:o,parentRunId:n,name:(d=l!=null?l:(u=e.id.at(-1))==null?void 0:u.toString())!=null?d:"Retriever",type:Qe.Tool,input:{query:t},tags:s,metadata:{...c,...Cr(e,{},c)}});}async handleRetrieverEnd(e,t,o,n){U.debug(`handleRetrieverEnd runId - ${t}, parentRunId ${o}`),this.endTracing({runId:t,output:{documents:e},tags:n});}async handleRetrieverError(e,t,o,n){U.debug(`handleRetrieverError runId - ${t}, parentRunId ${o}`),this.endTracing({runId:t,error:e,tags:n});}async flushAsync(){return this.client.flush()}};/*! Bundled license information:
|
|
5
|
-
|
|
6
|
-
@langchain/core/dist/utils/fast-json-patch/src/helpers.js:
|
|
7
|
-
(*!
|
|
8
|
-
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
9
|
-
* (c) 2017-2022 Joachim Wester
|
|
10
|
-
* MIT licensed
|
|
11
|
-
*)
|
|
12
|
-
|
|
13
|
-
@langchain/core/dist/utils/fast-json-patch/src/duplex.js:
|
|
14
|
-
(*!
|
|
15
|
-
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
16
|
-
* (c) 2013-2021 Joachim Wester
|
|
17
|
-
* MIT license
|
|
18
|
-
*)
|
|
19
|
-
*/exports.OpikCallbackHandler=pl;
|