@tanagram/lore 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +14 -0
  2. package/dist/index.js +95 -21
  3. package/package.json +3 -2
package/dist/index.js CHANGED
@@ -1,34 +1,108 @@
1
1
  #!/usr/bin/env node
2
- var on=Object.defineProperty;var cn=(r,t)=>{for(var n in t)on(r,n,{get:t[n],enumerable:!0})};import{pathToFileURL as Oc}from"node:url";var ln=/\d/,dn=["-","_","/","."];function pn(r=""){if(!ln.test(r))return r!==r.toLowerCase()}function It(r,t){let n=t??dn,s=[];if(!r||typeof r!="string")return s;let a="",o,c;for(let i of r){let d=n.includes(i);if(d===!0){s.push(a),a="",o=void 0;continue}let p=pn(i);if(c===!1){if(o===!1&&p===!0){s.push(a),a=i,o=p;continue}if(o===!0&&p===!1&&a.length>1){let u=a.at(-1);s.push(a.slice(0,Math.max(0,a.length-1))),a=u+i,o=p;continue}}a+=i,o=p,c=d}return s.push(a),s}function mn(r){return r?r[0].toUpperCase()+r.slice(1):""}function un(r){return r?r[0].toLowerCase()+r.slice(1):""}function hn(r,t){return r?(Array.isArray(r)?r:It(r)).map(n=>mn(t?.normalize?n.toLowerCase():n)).join(""):""}function Be(r,t){return un(hn(r||"",t))}function Ze(r,t){return r?(Array.isArray(r)?r:It(r)).map(n=>n.toLowerCase()).join(t??"-"):""}function Lt(r){return Ze(r||"","_")}import{parseArgs as fn}from"node:util";function Je(r){return Array.isArray(r)?r:r===void 0?[]:[r]}function mt(r,t=""){let n=[];for(let s of r)for(let[a,o]of s.entries())n[a]=Math.max(n[a]||0,o.length);return r.map(s=>s.map((a,o)=>t+a[o===0?"padStart":"padEnd"](n[o])).join(" ")).join(`
3
- `)}function B(r){return typeof r=="function"?r():r}var ie=class extends Error{code;constructor(r,t){super(r),this.name="CLIError",this.code=t}};function gn(r=[],t={}){let n=new Set(t.boolean||[]),s=new Set(t.string||[]),a=t.alias||{},o=t.default||{},c=new Map,i=new Map;for(let[v,k]of Object.entries(a)){let z=k;for(let F of z)c.set(v,F),i.has(F)||i.set(F,[]),i.get(F).push(v),c.set(F,v),i.has(v)||i.set(v,[]),i.get(v).push(F)}let d={};function p(v){if(n.has(v))return"boolean";let k=i.get(v)||[];for(let z of k)if(n.has(z))return"boolean";return"string"}function u(v){if(s.has(v))return!0;let k=i.get(v)||[];for(let z of k)if(s.has(z))return!0;return!1}let T=new Set([...n,...s,...Object.keys(a),...Object.values(a).flat(),...Object.keys(o)]);for(let v of T)d[v]||(d[v]={type:p(v),default:o[v]});for(let[v,k]of c.entries())v.length===1&&d[k]&&!d[k].short&&(d[k].short=v);let w=[],_={};for(let v=0;v<r.length;v++){let k=r[v];if(k==="--"){w.push(...r.slice(v));break}if(k.startsWith("--no-")){let z=k.slice(5);_[z]=!0;continue}w.push(k)}let P;try{P=fn({args:w,options:Object.keys(d).length>0?d:void 0,allowPositionals:!0,strict:!1})}catch{P={values:{},positionals:w}}let R={_:[]};R._=P.positionals;for(let[v,k]of Object.entries(P.values)){let z=k;p(v)==="boolean"&&typeof k=="string"?z=k!=="false":u(v)&&typeof k=="boolean"&&(z=""),R[v]=z}for(let[v]of Object.entries(_)){R[v]=!1;let k=c.get(v);k&&(R[k]=!1);let z=i.get(v);if(z)for(let F of z)R[F]=!1}for(let[v,k]of c.entries())R[v]!==void 0&&R[k]===void 0&&(R[k]=R[v]),R[k]!==void 0&&R[v]===void 0&&(R[v]=R[k]),R[v]!==R[k]&&o[k]===R[k]&&(R[k]=R[v]);return R}var yn=(()=>{let r=globalThis.process?.env??{};return r.NO_COLOR==="1"||r.TERM==="dumb"||r.TEST||r.CI})(),Ke=(r,t=39)=>n=>yn?n:`\x1B[${r}m${n}\x1B[${t}m`,Ge=Ke(1,22),M=Ke(36),Qe=Ke(90),He=Ke(4,24);function bn(r,t){let n={boolean:[],string:[],alias:{},default:{}},s=Bt(t);for(let i of s){if(i.type==="positional")continue;i.type==="string"||i.type==="enum"?n.string.push(i.name):i.type==="boolean"&&n.boolean.push(i.name),i.default!==void 0&&(n.default[i.name]=i.default),i.alias&&(n.alias[i.name]=i.alias);let d=Be(i.name),p=Ze(i.name);if(d!==i.name||p!==i.name){let u=Je(n.alias[i.name]||[]);d!==i.name&&!u.includes(d)&&u.push(d),p!==i.name&&!u.includes(p)&&u.push(p),u.length>0&&(n.alias[i.name]=u)}}let a=gn(r,n),[...o]=a._,c=new Proxy(a,{get(i,d){return i[d]??i[Be(d)]??i[Ze(d)]}});for(let[,i]of s.entries())if(i.type==="positional"){let d=o.shift();if(d!==void 0)c[i.name]=d;else{if(i.default===void 0&&i.required!==!1)throw new ie(`Missing required positional argument: ${i.name.toUpperCase()}`,"EARG");c[i.name]=i.default}}else if(i.type==="enum"){let d=c[i.name],p=i.options||[];if(d!==void 0&&p.length>0&&!p.includes(d))throw new ie(`Invalid value for argument: ${M(`--${i.name}`)} (${M(d)}). Expected one of: ${p.map(u=>M(u)).join(", ")}.`,"EARG")}else if(i.required&&c[i.name]===void 0)throw new ie(`Missing required argument: --${i.name}`,"EARG");return c}function Bt(r){let t=[];for(let[n,s]of Object.entries(r||{}))t.push({...s,name:n,alias:Je(s.alias)});return t}async function _n(r){return Promise.all(r.map(t=>B(t)))}async function We(r,t){let n=await B(r.args||{}),s=bn(t.rawArgs,n),a={rawArgs:t.rawArgs,args:s,data:t.data,cmd:r},o=await _n(r.plugins??[]),c,i;try{for(let u of o)await u.setup?.(a);typeof r.setup=="function"&&await r.setup(a);let p=await B(r.subCommands);if(p&&Object.keys(p).length>0){let u=vn(t.rawArgs,n),T=t.rawArgs[u];if(T){let w=await Nt(p,T);if(!w)throw new ie(`Unknown command ${M(T)}`,"E_UNKNOWN_COMMAND");await We(w,{rawArgs:t.rawArgs.slice(u+1)})}else{let w=await B(r.default);if(w){if(r.run)throw new ie("Cannot specify both 'run' and 'default' on the same command.","E_DEFAULT_CONFLICT");let _=await Nt(p,w);if(!_)throw new ie(`Default sub command ${M(w)} not found in subCommands.`,"E_UNKNOWN_COMMAND");await We(_,{rawArgs:t.rawArgs})}else if(!r.run)throw new ie("No command specified.","E_NO_COMMAND")}}typeof r.run=="function"&&(c=await r.run(a))}catch(p){i=p}let d=[];if(typeof r.cleanup=="function")try{await r.cleanup(a)}catch(p){d.push(p)}for(let p of[...o].reverse())try{await p.cleanup?.(a)}catch(u){d.push(u)}if(i)throw i;if(d.length===1)throw d[0];if(d.length>1)throw new Error("Multiple cleanup errors",{cause:d});return{result:c}}async function Nt(r,t){if(t in r)return B(r[t]);for(let n of Object.values(r)){let s=await B(n),a=await B(s?.meta);if(a?.alias&&Je(a.alias).includes(t))return s}}function vn(r,t){for(let n=0;n<r.length;n++){let s=r[n];if(s==="--")return-1;if(s.startsWith("-")){!s.includes("=")&&xn(s,t)&&n++;continue}return n}return-1}function xn(r,t){let n=r.replace(/^-{1,2}/,""),s=Be(n);for(let[a,o]of Object.entries(t))if(!(o.type!=="string"&&o.type!=="enum")&&(s===Be(a)||(Array.isArray(o.alias)?o.alias:o.alias?[o.alias]:[]).includes(n)))return!0;return!1}var Sn=/^no[-A-Z]/;async function $t(r,t){let n=await B(r.meta||{}),s=Bt(await B(r.args||{})),a=await B(t?.meta||{}),o=`${a.name?`${a.name} `:""}`+(n.name||process.argv[1]),c=[],i=[],d=[],p=[];for(let _ of s)if(_.type==="positional"){let P=_.name.toUpperCase(),R=_.required!==!1&&_.default===void 0;i.push([M(P+ut(_)),Ut(_,R)]),p.push(R?`<${P}>`:`[${P}]`)}else{let P=_.required===!0&&_.default===void 0,R=[...(_.alias||[]).map(v=>`-${v}`),`--${_.name}`].join(", ")+ut(_);if(c.push([M(R),Ut(_,P)]),_.type==="boolean"&&(_.default===!0||_.negativeDescription)&&!Sn.test(_.name)){let v=[...(_.alias||[]).map(k=>`--no-${k}`),`--no-${_.name}`].join(", ");c.push([M(v),[_.negativeDescription,P?Qe("(Required)"):""].filter(Boolean).join(" ")])}P&&p.push(`--${_.name}`+ut(_))}if(r.subCommands){let _=[],P=await B(r.subCommands);for(let[R,v]of Object.entries(P)){let k=await B((await B(v))?.meta);if(k?.hidden)continue;let z=Je(k?.alias),F=[R,...z].join(", ");d.push([M(F),k?.description||""]),_.push(R,...z)}p.push(_.join("|"))}let u=[],T=n.version||a.version;u.push(Qe(`${n.description} (${o+(T?` v${T}`:"")})`),"");let w=c.length>0||i.length>0;return u.push(`${He(Ge("USAGE"))} ${M(`${o}${w?" [OPTIONS]":""} ${p.join(" ")}`)}`,""),i.length>0&&(u.push(He(Ge("ARGUMENTS")),""),u.push(mt(i," ")),u.push("")),c.length>0&&(u.push(He(Ge("OPTIONS")),""),u.push(mt(c," ")),u.push("")),d.length>0&&(u.push(He(Ge("COMMANDS")),""),u.push(mt(d," ")),u.push("",`Use ${M(`${o} <command> --help`)} for more information about a command.`)),u.filter(_=>typeof _=="string").join(`
4
- `)}function ut(r){let t=r.valueHint?`=<${r.valueHint}>`:"",n=t||`=<${Lt(r.name)}>`;return!r.type||r.type==="positional"||r.type==="boolean"?t:r.type==="enum"&&r.options?.length?`=<${r.options.join("|")}>`:n}function Ut(r,t){let n=t?Qe("(Required)"):"",s=r.default===void 0?"":Qe(`(Default: ${r.default})`);return[r.description,n,s].filter(Boolean).join(" ")}var e={};cn(e,{BRAND:()=>Qn,DIRTY:()=>ce,EMPTY_PATH:()=>wn,INVALID:()=>y,NEVER:()=>Es,OK:()=>E,ParseStatus:()=>A,Schema:()=>S,ZodAny:()=>re,ZodArray:()=>X,ZodBigInt:()=>de,ZodBoolean:()=>pe,ZodBranded:()=>De,ZodCatch:()=>Se,ZodDate:()=>me,ZodDefault:()=>xe,ZodDiscriminatedUnion:()=>et,ZodEffects:()=>q,ZodEnum:()=>_e,ZodError:()=>N,ZodFirstPartyTypeKind:()=>b,ZodFunction:()=>rt,ZodIntersection:()=>ge,ZodIssueCode:()=>m,ZodLazy:()=>ye,ZodLiteral:()=>be,ZodMap:()=>Ee,ZodNaN:()=>Ie,ZodNativeEnum:()=>ve,ZodNever:()=>V,ZodNull:()=>he,ZodNullable:()=>H,ZodNumber:()=>le,ZodObject:()=>U,ZodOptional:()=>$,ZodParsedType:()=>f,ZodPipeline:()=>qe,ZodPromise:()=>ne,ZodReadonly:()=>ke,ZodRecord:()=>tt,ZodSchema:()=>S,ZodSet:()=>Oe,ZodString:()=>te,ZodSymbol:()=>ze,ZodTransformer:()=>q,ZodTuple:()=>G,ZodType:()=>S,ZodUndefined:()=>ue,ZodUnion:()=>fe,ZodUnknown:()=>Y,ZodVoid:()=>Ae,addIssueToContext:()=>h,any:()=>ns,array:()=>is,bigint:()=>Yn,boolean:()=>Jt,coerce:()=>As,custom:()=>Ht,date:()=>Xn,datetimeRegex:()=>Zt,defaultErrorMap:()=>J,discriminatedUnion:()=>ps,effect:()=>ks,enum:()=>vs,function:()=>ys,getErrorMap:()=>Re,getParsedType:()=>Z,instanceof:()=>Jn,intersection:()=>ms,isAborted:()=>Ye,isAsync:()=>Ce,isDirty:()=>Xe,isValid:()=>ee,late:()=>Wn,lazy:()=>bs,literal:()=>_s,makeIssue:()=>$e,map:()=>fs,nan:()=>Kn,nativeEnum:()=>xs,never:()=>as,null:()=>rs,nullable:()=>Ts,number:()=>Wt,object:()=>cs,objectUtil:()=>ht,oboolean:()=>zs,onumber:()=>Ps,optional:()=>js,ostring:()=>Cs,pipeline:()=>Rs,preprocess:()=>ws,promise:()=>Ss,quotelessJson:()=>kn,record:()=>hs,set:()=>gs,setErrorMap:()=>Tn,strictObject:()=>ls,string:()=>Qt,symbol:()=>es,transformer:()=>ks,tuple:()=>us,undefined:()=>ts,union:()=>ds,unknown:()=>ss,util:()=>j,void:()=>os});var j;(function(r){r.assertEqual=a=>{};function t(a){}r.assertIs=t;function n(a){throw new Error}r.assertNever=n,r.arrayToEnum=a=>{let o={};for(let c of a)o[c]=c;return o},r.getValidEnumValues=a=>{let o=r.objectKeys(a).filter(i=>typeof a[a[i]]!="number"),c={};for(let i of o)c[i]=a[i];return r.objectValues(c)},r.objectValues=a=>r.objectKeys(a).map(function(o){return a[o]}),r.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let o=[];for(let c in a)Object.prototype.hasOwnProperty.call(a,c)&&o.push(c);return o},r.find=(a,o)=>{for(let c of a)if(o(c))return c},r.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function s(a,o=" | "){return a.map(c=>typeof c=="string"?`'${c}'`:c).join(o)}r.joinValues=s,r.jsonStringifyReplacer=(a,o)=>typeof o=="bigint"?o.toString():o})(j||(j={}));var ht;(function(r){r.mergeShapes=(t,n)=>({...t,...n})})(ht||(ht={}));var f=j.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Z=r=>{switch(typeof r){case"undefined":return f.undefined;case"string":return f.string;case"number":return Number.isNaN(r)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(r)?f.array:r===null?f.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?f.promise:typeof Map<"u"&&r instanceof Map?f.map:typeof Set<"u"&&r instanceof Set?f.set:typeof Date<"u"&&r instanceof Date?f.date:f.object;default:return f.unknown}};var m=j.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),kn=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),N=class r extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){let n=t||function(o){return o.message},s={_errors:[]},a=o=>{for(let c of o.issues)if(c.code==="invalid_union")c.unionErrors.map(a);else if(c.code==="invalid_return_type")a(c.returnTypeError);else if(c.code==="invalid_arguments")a(c.argumentsError);else if(c.path.length===0)s._errors.push(n(c));else{let i=s,d=0;for(;d<c.path.length;){let p=c.path[d];d===c.path.length-1?(i[p]=i[p]||{_errors:[]},i[p]._errors.push(n(c))):i[p]=i[p]||{_errors:[]},i=i[p],d++}}};return a(this),s}static assert(t){if(!(t instanceof r))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,j.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){let n={},s=[];for(let a of this.issues)if(a.path.length>0){let o=a.path[0];n[o]=n[o]||[],n[o].push(t(a))}else s.push(t(a));return{formErrors:s,fieldErrors:n}}get formErrors(){return this.flatten()}};N.create=r=>new N(r);var jn=(r,t)=>{let n;switch(r.code){case m.invalid_type:r.received===f.undefined?n="Required":n=`Expected ${r.expected}, received ${r.received}`;break;case m.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(r.expected,j.jsonStringifyReplacer)}`;break;case m.unrecognized_keys:n=`Unrecognized key(s) in object: ${j.joinValues(r.keys,", ")}`;break;case m.invalid_union:n="Invalid input";break;case m.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${j.joinValues(r.options)}`;break;case m.invalid_enum_value:n=`Invalid enum value. Expected ${j.joinValues(r.options)}, received '${r.received}'`;break;case m.invalid_arguments:n="Invalid function arguments";break;case m.invalid_return_type:n="Invalid function return type";break;case m.invalid_date:n="Invalid date";break;case m.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(n=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?n=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?n=`Invalid input: must end with "${r.validation.endsWith}"`:j.assertNever(r.validation):r.validation!=="regex"?n=`Invalid ${r.validation}`:n="Invalid";break;case m.too_small:r.type==="array"?n=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?n=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?n=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?n=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?n=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:n="Invalid input";break;case m.too_big:r.type==="array"?n=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?n=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?n=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?n=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?n=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:n="Invalid input";break;case m.custom:n="Invalid input";break;case m.invalid_intersection_types:n="Intersection results could not be merged";break;case m.not_multiple_of:n=`Number must be a multiple of ${r.multipleOf}`;break;case m.not_finite:n="Number must be finite";break;default:n=t.defaultError,j.assertNever(r)}return{message:n}},J=jn;var Dt=J;function Tn(r){Dt=r}function Re(){return Dt}var $e=r=>{let{data:t,path:n,errorMaps:s,issueData:a}=r,o=[...n,...a.path||[]],c={...a,path:o};if(a.message!==void 0)return{...a,path:o,message:a.message};let i="",d=s.filter(p=>!!p).slice().reverse();for(let p of d)i=p(c,{data:t,defaultError:i}).message;return{...a,path:o,message:i}},wn=[];function h(r,t){let n=Re(),s=$e({issueData:t,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,n,n===J?void 0:J].filter(a=>!!a)});r.common.issues.push(s)}var A=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){let s=[];for(let a of n){if(a.status==="aborted")return y;a.status==="dirty"&&t.dirty(),s.push(a.value)}return{status:t.value,value:s}}static async mergeObjectAsync(t,n){let s=[];for(let a of n){let o=await a.key,c=await a.value;s.push({key:o,value:c})}return r.mergeObjectSync(t,s)}static mergeObjectSync(t,n){let s={};for(let a of n){let{key:o,value:c}=a;if(o.status==="aborted"||c.status==="aborted")return y;o.status==="dirty"&&t.dirty(),c.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof c.value<"u"||a.alwaysSet)&&(s[o.value]=c.value)}return{status:t.value,value:s}}},y=Object.freeze({status:"aborted"}),ce=r=>({status:"dirty",value:r}),E=r=>({status:"valid",value:r}),Ye=r=>r.status==="aborted",Xe=r=>r.status==="dirty",ee=r=>r.status==="valid",Ce=r=>typeof Promise<"u"&&r instanceof Promise;var g;(function(r){r.errToObj=t=>typeof t=="string"?{message:t}:t||{},r.toString=t=>typeof t=="string"?t:t?.message})(g||(g={}));var D=class{constructor(t,n,s,a){this._cachedPath=[],this.parent=t,this.data=n,this._path=s,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},qt=(r,t)=>{if(ee(t))return{success:!0,data:t.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new N(r.common.issues);return this._error=n,this._error}}};function x(r){if(!r)return{};let{errorMap:t,invalid_type_error:n,required_error:s,description:a}=r;if(t&&(n||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:a}:{errorMap:(c,i)=>{let{message:d}=r;return c.code==="invalid_enum_value"?{message:d??i.defaultError}:typeof i.data>"u"?{message:d??s??i.defaultError}:c.code!=="invalid_type"?{message:i.defaultError}:{message:d??n??i.defaultError}},description:a}}var S=class{get description(){return this._def.description}_getType(t){return Z(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Z(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new A,ctx:{common:t.parent.common,data:t.data,parsedType:Z(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if(Ce(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){let n=this._parse(t);return Promise.resolve(n)}parse(t,n){let s=this.safeParse(t,n);if(s.success)return s.data;throw s.error}safeParse(t,n){let s={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Z(t)},a=this._parseSync({data:t,path:s.path,parent:s});return qt(s,a)}"~validate"(t){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Z(t)};if(!this["~standard"].async)try{let s=this._parseSync({data:t,path:[],parent:n});return ee(s)?{value:s.value}:{issues:n.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(s=>ee(s)?{value:s.value}:{issues:n.common.issues})}async parseAsync(t,n){let s=await this.safeParseAsync(t,n);if(s.success)return s.data;throw s.error}async safeParseAsync(t,n){let s={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Z(t)},a=this._parse({data:t,path:s.path,parent:s}),o=await(Ce(a)?a:Promise.resolve(a));return qt(s,o)}refine(t,n){let s=a=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(a):n;return this._refinement((a,o)=>{let c=t(a),i=()=>o.addIssue({code:m.custom,...s(a)});return typeof Promise<"u"&&c instanceof Promise?c.then(d=>d?!0:(i(),!1)):c?!0:(i(),!1)})}refinement(t,n){return this._refinement((s,a)=>t(s)?!0:(a.addIssue(typeof n=="function"?n(s,a):n),!1))}_refinement(t){return new q({schema:this,typeName:b.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return $.create(this,this._def)}nullable(){return H.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return X.create(this)}promise(){return ne.create(this,this._def)}or(t){return fe.create([this,t],this._def)}and(t){return ge.create(this,t,this._def)}transform(t){return new q({...x(this._def),schema:this,typeName:b.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new xe({...x(this._def),innerType:this,defaultValue:n,typeName:b.ZodDefault})}brand(){return new De({typeName:b.ZodBranded,type:this,...x(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new Se({...x(this._def),innerType:this,catchValue:n,typeName:b.ZodCatch})}describe(t){let n=this.constructor;return new n({...this._def,description:t})}pipe(t){return qe.create(this,t)}readonly(){return ke.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Rn=/^c[^\s-]{8,}$/i,Cn=/^[0-9a-z]+$/,Pn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,zn=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,An=/^[a-z0-9_-]{21}$/i,En=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,On=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,In=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ln="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ft,Nn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Un=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Bn=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,$n=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Dn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,qn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Vt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Mn=new RegExp(`^${Vt}$`);function Ft(r){let t="[0-5]\\d";r.precision?t=`${t}\\.\\d{${r.precision}}`:r.precision==null&&(t=`${t}(\\.\\d+)?`);let n=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function Vn(r){return new RegExp(`^${Ft(r)}$`)}function Zt(r){let t=`${Vt}T${Ft(r)}`,n=[];return n.push(r.local?"Z?":"Z"),r.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Fn(r,t){return!!((t==="v4"||!t)&&Nn.test(r)||(t==="v6"||!t)&&Bn.test(r))}function Zn(r,t){if(!En.test(r))return!1;try{let[n]=r.split(".");if(!n)return!1;let s=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),a=JSON.parse(atob(s));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||t&&a.alg!==t)}catch{return!1}}function Gn(r,t){return!!((t==="v4"||!t)&&Un.test(r)||(t==="v6"||!t)&&$n.test(r))}var te=class r extends S{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==f.string){let o=this._getOrReturnCtx(t);return h(o,{code:m.invalid_type,expected:f.string,received:o.parsedType}),y}let s=new A,a;for(let o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(a=this._getOrReturnCtx(t,a),h(a,{code:m.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),s.dirty());else if(o.kind==="max")t.data.length>o.value&&(a=this._getOrReturnCtx(t,a),h(a,{code:m.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),s.dirty());else if(o.kind==="length"){let c=t.data.length>o.value,i=t.data.length<o.value;(c||i)&&(a=this._getOrReturnCtx(t,a),c?h(a,{code:m.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):i&&h(a,{code:m.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),s.dirty())}else if(o.kind==="email")In.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"email",code:m.invalid_string,message:o.message}),s.dirty());else if(o.kind==="emoji")ft||(ft=new RegExp(Ln,"u")),ft.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"emoji",code:m.invalid_string,message:o.message}),s.dirty());else if(o.kind==="uuid")zn.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"uuid",code:m.invalid_string,message:o.message}),s.dirty());else if(o.kind==="nanoid")An.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"nanoid",code:m.invalid_string,message:o.message}),s.dirty());else if(o.kind==="cuid")Rn.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"cuid",code:m.invalid_string,message:o.message}),s.dirty());else if(o.kind==="cuid2")Cn.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"cuid2",code:m.invalid_string,message:o.message}),s.dirty());else if(o.kind==="ulid")Pn.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"ulid",code:m.invalid_string,message:o.message}),s.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{a=this._getOrReturnCtx(t,a),h(a,{validation:"url",code:m.invalid_string,message:o.message}),s.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"regex",code:m.invalid_string,message:o.message}),s.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(a=this._getOrReturnCtx(t,a),h(a,{code:m.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),s.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(a=this._getOrReturnCtx(t,a),h(a,{code:m.invalid_string,validation:{startsWith:o.value},message:o.message}),s.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(a=this._getOrReturnCtx(t,a),h(a,{code:m.invalid_string,validation:{endsWith:o.value},message:o.message}),s.dirty()):o.kind==="datetime"?Zt(o).test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{code:m.invalid_string,validation:"datetime",message:o.message}),s.dirty()):o.kind==="date"?Mn.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{code:m.invalid_string,validation:"date",message:o.message}),s.dirty()):o.kind==="time"?Vn(o).test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{code:m.invalid_string,validation:"time",message:o.message}),s.dirty()):o.kind==="duration"?On.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"duration",code:m.invalid_string,message:o.message}),s.dirty()):o.kind==="ip"?Fn(t.data,o.version)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"ip",code:m.invalid_string,message:o.message}),s.dirty()):o.kind==="jwt"?Zn(t.data,o.alg)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"jwt",code:m.invalid_string,message:o.message}),s.dirty()):o.kind==="cidr"?Gn(t.data,o.version)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"cidr",code:m.invalid_string,message:o.message}),s.dirty()):o.kind==="base64"?Dn.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"base64",code:m.invalid_string,message:o.message}),s.dirty()):o.kind==="base64url"?qn.test(t.data)||(a=this._getOrReturnCtx(t,a),h(a,{validation:"base64url",code:m.invalid_string,message:o.message}),s.dirty()):j.assertNever(o);return{status:s.value,value:t.data}}_regex(t,n,s){return this.refinement(a=>t.test(a),{validation:n,code:m.invalid_string,...g.errToObj(s)})}_addCheck(t){return new r({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...g.errToObj(t)})}url(t){return this._addCheck({kind:"url",...g.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...g.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...g.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...g.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...g.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...g.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...g.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...g.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...g.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...g.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...g.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...g.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...g.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...g.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...g.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...g.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...g.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...g.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...g.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...g.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...g.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...g.errToObj(n)})}nonempty(t){return this.min(1,g.errToObj(t))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};te.create=r=>new te({checks:[],typeName:b.ZodString,coerce:r?.coerce??!1,...x(r)});function Hn(r,t){let n=(r.toString().split(".")[1]||"").length,s=(t.toString().split(".")[1]||"").length,a=n>s?n:s,o=Number.parseInt(r.toFixed(a).replace(".","")),c=Number.parseInt(t.toFixed(a).replace(".",""));return o%c/10**a}var le=class r extends S{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==f.number){let o=this._getOrReturnCtx(t);return h(o,{code:m.invalid_type,expected:f.number,received:o.parsedType}),y}let s,a=new A;for(let o of this._def.checks)o.kind==="int"?j.isInteger(t.data)||(s=this._getOrReturnCtx(t,s),h(s,{code:m.invalid_type,expected:"integer",received:"float",message:o.message}),a.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(s=this._getOrReturnCtx(t,s),h(s,{code:m.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(s=this._getOrReturnCtx(t,s),h(s,{code:m.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?Hn(t.data,o.value)!==0&&(s=this._getOrReturnCtx(t,s),h(s,{code:m.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(s=this._getOrReturnCtx(t,s),h(s,{code:m.not_finite,message:o.message}),a.dirty()):j.assertNever(o);return{status:a.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,g.toString(n))}gt(t,n){return this.setLimit("min",t,!1,g.toString(n))}lte(t,n){return this.setLimit("max",t,!0,g.toString(n))}lt(t,n){return this.setLimit("max",t,!1,g.toString(n))}setLimit(t,n,s,a){return new r({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:s,message:g.toString(a)}]})}_addCheck(t){return new r({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:g.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:g.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:g.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:g.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:g.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:g.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:g.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:g.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:g.toString(t)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&j.isInteger(t.value))}get isFinite(){let t=null,n=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(n===null||s.value>n)&&(n=s.value):s.kind==="max"&&(t===null||s.value<t)&&(t=s.value)}return Number.isFinite(n)&&Number.isFinite(t)}};le.create=r=>new le({checks:[],typeName:b.ZodNumber,coerce:r?.coerce||!1,...x(r)});var de=class r extends S{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==f.bigint)return this._getInvalidInput(t);let s,a=new A;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(s=this._getOrReturnCtx(t,s),h(s,{code:m.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(s=this._getOrReturnCtx(t,s),h(s,{code:m.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(s=this._getOrReturnCtx(t,s),h(s,{code:m.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):j.assertNever(o);return{status:a.value,value:t.data}}_getInvalidInput(t){let n=this._getOrReturnCtx(t);return h(n,{code:m.invalid_type,expected:f.bigint,received:n.parsedType}),y}gte(t,n){return this.setLimit("min",t,!0,g.toString(n))}gt(t,n){return this.setLimit("min",t,!1,g.toString(n))}lte(t,n){return this.setLimit("max",t,!0,g.toString(n))}lt(t,n){return this.setLimit("max",t,!1,g.toString(n))}setLimit(t,n,s,a){return new r({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:s,message:g.toString(a)}]})}_addCheck(t){return new r({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:g.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:g.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:g.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:g.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:g.toString(n)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};de.create=r=>new de({checks:[],typeName:b.ZodBigInt,coerce:r?.coerce??!1,...x(r)});var pe=class extends S{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==f.boolean){let s=this._getOrReturnCtx(t);return h(s,{code:m.invalid_type,expected:f.boolean,received:s.parsedType}),y}return E(t.data)}};pe.create=r=>new pe({typeName:b.ZodBoolean,coerce:r?.coerce||!1,...x(r)});var me=class r extends S{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==f.date){let o=this._getOrReturnCtx(t);return h(o,{code:m.invalid_type,expected:f.date,received:o.parsedType}),y}if(Number.isNaN(t.data.getTime())){let o=this._getOrReturnCtx(t);return h(o,{code:m.invalid_date}),y}let s=new A,a;for(let o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(a=this._getOrReturnCtx(t,a),h(a,{code:m.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),s.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(a=this._getOrReturnCtx(t,a),h(a,{code:m.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),s.dirty()):j.assertNever(o);return{status:s.value,value:new Date(t.data.getTime())}}_addCheck(t){return new r({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:g.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:g.toString(n)})}get minDate(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}};me.create=r=>new me({checks:[],coerce:r?.coerce||!1,typeName:b.ZodDate,...x(r)});var ze=class extends S{_parse(t){if(this._getType(t)!==f.symbol){let s=this._getOrReturnCtx(t);return h(s,{code:m.invalid_type,expected:f.symbol,received:s.parsedType}),y}return E(t.data)}};ze.create=r=>new ze({typeName:b.ZodSymbol,...x(r)});var ue=class extends S{_parse(t){if(this._getType(t)!==f.undefined){let s=this._getOrReturnCtx(t);return h(s,{code:m.invalid_type,expected:f.undefined,received:s.parsedType}),y}return E(t.data)}};ue.create=r=>new ue({typeName:b.ZodUndefined,...x(r)});var he=class extends S{_parse(t){if(this._getType(t)!==f.null){let s=this._getOrReturnCtx(t);return h(s,{code:m.invalid_type,expected:f.null,received:s.parsedType}),y}return E(t.data)}};he.create=r=>new he({typeName:b.ZodNull,...x(r)});var re=class extends S{constructor(){super(...arguments),this._any=!0}_parse(t){return E(t.data)}};re.create=r=>new re({typeName:b.ZodAny,...x(r)});var Y=class extends S{constructor(){super(...arguments),this._unknown=!0}_parse(t){return E(t.data)}};Y.create=r=>new Y({typeName:b.ZodUnknown,...x(r)});var V=class extends S{_parse(t){let n=this._getOrReturnCtx(t);return h(n,{code:m.invalid_type,expected:f.never,received:n.parsedType}),y}};V.create=r=>new V({typeName:b.ZodNever,...x(r)});var Ae=class extends S{_parse(t){if(this._getType(t)!==f.undefined){let s=this._getOrReturnCtx(t);return h(s,{code:m.invalid_type,expected:f.void,received:s.parsedType}),y}return E(t.data)}};Ae.create=r=>new Ae({typeName:b.ZodVoid,...x(r)});var X=class r extends S{_parse(t){let{ctx:n,status:s}=this._processInputParams(t),a=this._def;if(n.parsedType!==f.array)return h(n,{code:m.invalid_type,expected:f.array,received:n.parsedType}),y;if(a.exactLength!==null){let c=n.data.length>a.exactLength.value,i=n.data.length<a.exactLength.value;(c||i)&&(h(n,{code:c?m.too_big:m.too_small,minimum:i?a.exactLength.value:void 0,maximum:c?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),s.dirty())}if(a.minLength!==null&&n.data.length<a.minLength.value&&(h(n,{code:m.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),s.dirty()),a.maxLength!==null&&n.data.length>a.maxLength.value&&(h(n,{code:m.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),s.dirty()),n.common.async)return Promise.all([...n.data].map((c,i)=>a.type._parseAsync(new D(n,c,n.path,i)))).then(c=>A.mergeArray(s,c));let o=[...n.data].map((c,i)=>a.type._parseSync(new D(n,c,n.path,i)));return A.mergeArray(s,o)}get element(){return this._def.type}min(t,n){return new r({...this._def,minLength:{value:t,message:g.toString(n)}})}max(t,n){return new r({...this._def,maxLength:{value:t,message:g.toString(n)}})}length(t,n){return new r({...this._def,exactLength:{value:t,message:g.toString(n)}})}nonempty(t){return this.min(1,t)}};X.create=(r,t)=>new X({type:r,minLength:null,maxLength:null,exactLength:null,typeName:b.ZodArray,...x(t)});function Pe(r){if(r instanceof U){let t={};for(let n in r.shape){let s=r.shape[n];t[n]=$.create(Pe(s))}return new U({...r._def,shape:()=>t})}else return r instanceof X?new X({...r._def,type:Pe(r.element)}):r instanceof $?$.create(Pe(r.unwrap())):r instanceof H?H.create(Pe(r.unwrap())):r instanceof G?G.create(r.items.map(t=>Pe(t))):r}var U=class r extends S{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),n=j.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==f.object){let p=this._getOrReturnCtx(t);return h(p,{code:m.invalid_type,expected:f.object,received:p.parsedType}),y}let{status:s,ctx:a}=this._processInputParams(t),{shape:o,keys:c}=this._getCached(),i=[];if(!(this._def.catchall instanceof V&&this._def.unknownKeys==="strip"))for(let p in a.data)c.includes(p)||i.push(p);let d=[];for(let p of c){let u=o[p],T=a.data[p];d.push({key:{status:"valid",value:p},value:u._parse(new D(a,T,a.path,p)),alwaysSet:p in a.data})}if(this._def.catchall instanceof V){let p=this._def.unknownKeys;if(p==="passthrough")for(let u of i)d.push({key:{status:"valid",value:u},value:{status:"valid",value:a.data[u]}});else if(p==="strict")i.length>0&&(h(a,{code:m.unrecognized_keys,keys:i}),s.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let p=this._def.catchall;for(let u of i){let T=a.data[u];d.push({key:{status:"valid",value:u},value:p._parse(new D(a,T,a.path,u)),alwaysSet:u in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let p=[];for(let u of d){let T=await u.key,w=await u.value;p.push({key:T,value:w,alwaysSet:u.alwaysSet})}return p}).then(p=>A.mergeObjectSync(s,p)):A.mergeObjectSync(s,d)}get shape(){return this._def.shape()}strict(t){return g.errToObj,new r({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,s)=>{let a=this._def.errorMap?.(n,s).message??s.defaultError;return n.code==="unrecognized_keys"?{message:g.errToObj(t).message??a}:{message:a}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(t){return new r({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new r({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:b.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new r({...this._def,catchall:t})}pick(t){let n={};for(let s of j.objectKeys(t))t[s]&&this.shape[s]&&(n[s]=this.shape[s]);return new r({...this._def,shape:()=>n})}omit(t){let n={};for(let s of j.objectKeys(this.shape))t[s]||(n[s]=this.shape[s]);return new r({...this._def,shape:()=>n})}deepPartial(){return Pe(this)}partial(t){let n={};for(let s of j.objectKeys(this.shape)){let a=this.shape[s];t&&!t[s]?n[s]=a:n[s]=a.optional()}return new r({...this._def,shape:()=>n})}required(t){let n={};for(let s of j.objectKeys(this.shape))if(t&&!t[s])n[s]=this.shape[s];else{let o=this.shape[s];for(;o instanceof $;)o=o._def.innerType;n[s]=o}return new r({...this._def,shape:()=>n})}keyof(){return Gt(j.objectKeys(this.shape))}};U.create=(r,t)=>new U({shape:()=>r,unknownKeys:"strip",catchall:V.create(),typeName:b.ZodObject,...x(t)});U.strictCreate=(r,t)=>new U({shape:()=>r,unknownKeys:"strict",catchall:V.create(),typeName:b.ZodObject,...x(t)});U.lazycreate=(r,t)=>new U({shape:r,unknownKeys:"strip",catchall:V.create(),typeName:b.ZodObject,...x(t)});var fe=class extends S{_parse(t){let{ctx:n}=this._processInputParams(t),s=this._def.options;function a(o){for(let i of o)if(i.result.status==="valid")return i.result;for(let i of o)if(i.result.status==="dirty")return n.common.issues.push(...i.ctx.common.issues),i.result;let c=o.map(i=>new N(i.ctx.common.issues));return h(n,{code:m.invalid_union,unionErrors:c}),y}if(n.common.async)return Promise.all(s.map(async o=>{let c={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:c}),ctx:c}})).then(a);{let o,c=[];for(let d of s){let p={...n,common:{...n.common,issues:[]},parent:null},u=d._parseSync({data:n.data,path:n.path,parent:p});if(u.status==="valid")return u;u.status==="dirty"&&!o&&(o={result:u,ctx:p}),p.common.issues.length&&c.push(p.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;let i=c.map(d=>new N(d));return h(n,{code:m.invalid_union,unionErrors:i}),y}}get options(){return this._def.options}};fe.create=(r,t)=>new fe({options:r,typeName:b.ZodUnion,...x(t)});var K=r=>r instanceof ye?K(r.schema):r instanceof q?K(r.innerType()):r instanceof be?[r.value]:r instanceof _e?r.options:r instanceof ve?j.objectValues(r.enum):r instanceof xe?K(r._def.innerType):r instanceof ue?[void 0]:r instanceof he?[null]:r instanceof $?[void 0,...K(r.unwrap())]:r instanceof H?[null,...K(r.unwrap())]:r instanceof De||r instanceof ke?K(r.unwrap()):r instanceof Se?K(r._def.innerType):[],et=class r extends S{_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==f.object)return h(n,{code:m.invalid_type,expected:f.object,received:n.parsedType}),y;let s=this.discriminator,a=n.data[s],o=this.optionsMap.get(a);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(h(n,{code:m.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,s){let a=new Map;for(let o of n){let c=K(o.shape[t]);if(!c.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let i of c){if(a.has(i))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(i)}`);a.set(i,o)}}return new r({typeName:b.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:a,...x(s)})}};function gt(r,t){let n=Z(r),s=Z(t);if(r===t)return{valid:!0,data:r};if(n===f.object&&s===f.object){let a=j.objectKeys(t),o=j.objectKeys(r).filter(i=>a.indexOf(i)!==-1),c={...r,...t};for(let i of o){let d=gt(r[i],t[i]);if(!d.valid)return{valid:!1};c[i]=d.data}return{valid:!0,data:c}}else if(n===f.array&&s===f.array){if(r.length!==t.length)return{valid:!1};let a=[];for(let o=0;o<r.length;o++){let c=r[o],i=t[o],d=gt(c,i);if(!d.valid)return{valid:!1};a.push(d.data)}return{valid:!0,data:a}}else return n===f.date&&s===f.date&&+r==+t?{valid:!0,data:r}:{valid:!1}}var ge=class extends S{_parse(t){let{status:n,ctx:s}=this._processInputParams(t),a=(o,c)=>{if(Ye(o)||Ye(c))return y;let i=gt(o.value,c.value);return i.valid?((Xe(o)||Xe(c))&&n.dirty(),{status:n.value,value:i.data}):(h(s,{code:m.invalid_intersection_types}),y)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([o,c])=>a(o,c)):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};ge.create=(r,t,n)=>new ge({left:r,right:t,typeName:b.ZodIntersection,...x(n)});var G=class r extends S{_parse(t){let{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==f.array)return h(s,{code:m.invalid_type,expected:f.array,received:s.parsedType}),y;if(s.data.length<this._def.items.length)return h(s,{code:m.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&s.data.length>this._def.items.length&&(h(s,{code:m.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let o=[...s.data].map((c,i)=>{let d=this._def.items[i]||this._def.rest;return d?d._parse(new D(s,c,s.path,i)):null}).filter(c=>!!c);return s.common.async?Promise.all(o).then(c=>A.mergeArray(n,c)):A.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new r({...this._def,rest:t})}};G.create=(r,t)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new G({items:r,typeName:b.ZodTuple,rest:null,...x(t)})};var tt=class r extends S{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==f.object)return h(s,{code:m.invalid_type,expected:f.object,received:s.parsedType}),y;let a=[],o=this._def.keyType,c=this._def.valueType;for(let i in s.data)a.push({key:o._parse(new D(s,i,s.path,i)),value:c._parse(new D(s,s.data[i],s.path,i)),alwaysSet:i in s.data});return s.common.async?A.mergeObjectAsync(n,a):A.mergeObjectSync(n,a)}get element(){return this._def.valueType}static create(t,n,s){return n instanceof S?new r({keyType:t,valueType:n,typeName:b.ZodRecord,...x(s)}):new r({keyType:te.create(),valueType:t,typeName:b.ZodRecord,...x(n)})}},Ee=class extends S{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==f.map)return h(s,{code:m.invalid_type,expected:f.map,received:s.parsedType}),y;let a=this._def.keyType,o=this._def.valueType,c=[...s.data.entries()].map(([i,d],p)=>({key:a._parse(new D(s,i,s.path,[p,"key"])),value:o._parse(new D(s,d,s.path,[p,"value"]))}));if(s.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let d of c){let p=await d.key,u=await d.value;if(p.status==="aborted"||u.status==="aborted")return y;(p.status==="dirty"||u.status==="dirty")&&n.dirty(),i.set(p.value,u.value)}return{status:n.value,value:i}})}else{let i=new Map;for(let d of c){let p=d.key,u=d.value;if(p.status==="aborted"||u.status==="aborted")return y;(p.status==="dirty"||u.status==="dirty")&&n.dirty(),i.set(p.value,u.value)}return{status:n.value,value:i}}}};Ee.create=(r,t,n)=>new Ee({valueType:t,keyType:r,typeName:b.ZodMap,...x(n)});var Oe=class r extends S{_parse(t){let{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==f.set)return h(s,{code:m.invalid_type,expected:f.set,received:s.parsedType}),y;let a=this._def;a.minSize!==null&&s.data.size<a.minSize.value&&(h(s,{code:m.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),n.dirty()),a.maxSize!==null&&s.data.size>a.maxSize.value&&(h(s,{code:m.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());let o=this._def.valueType;function c(d){let p=new Set;for(let u of d){if(u.status==="aborted")return y;u.status==="dirty"&&n.dirty(),p.add(u.value)}return{status:n.value,value:p}}let i=[...s.data.values()].map((d,p)=>o._parse(new D(s,d,s.path,p)));return s.common.async?Promise.all(i).then(d=>c(d)):c(i)}min(t,n){return new r({...this._def,minSize:{value:t,message:g.toString(n)}})}max(t,n){return new r({...this._def,maxSize:{value:t,message:g.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};Oe.create=(r,t)=>new Oe({valueType:r,minSize:null,maxSize:null,typeName:b.ZodSet,...x(t)});var rt=class r extends S{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==f.function)return h(n,{code:m.invalid_type,expected:f.function,received:n.parsedType}),y;function s(i,d){return $e({data:i,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Re(),J].filter(p=>!!p),issueData:{code:m.invalid_arguments,argumentsError:d}})}function a(i,d){return $e({data:i,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Re(),J].filter(p=>!!p),issueData:{code:m.invalid_return_type,returnTypeError:d}})}let o={errorMap:n.common.contextualErrorMap},c=n.data;if(this._def.returns instanceof ne){let i=this;return E(async function(...d){let p=new N([]),u=await i._def.args.parseAsync(d,o).catch(_=>{throw p.addIssue(s(d,_)),p}),T=await Reflect.apply(c,this,u);return await i._def.returns._def.type.parseAsync(T,o).catch(_=>{throw p.addIssue(a(T,_)),p})})}else{let i=this;return E(function(...d){let p=i._def.args.safeParse(d,o);if(!p.success)throw new N([s(d,p.error)]);let u=Reflect.apply(c,this,p.data),T=i._def.returns.safeParse(u,o);if(!T.success)throw new N([a(u,T.error)]);return T.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new r({...this._def,args:G.create(t).rest(Y.create())})}returns(t){return new r({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,s){return new r({args:t||G.create([]).rest(Y.create()),returns:n||Y.create(),typeName:b.ZodFunction,...x(s)})}},ye=class extends S{get schema(){return this._def.getter()}_parse(t){let{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};ye.create=(r,t)=>new ye({getter:r,typeName:b.ZodLazy,...x(t)});var be=class extends S{_parse(t){if(t.data!==this._def.value){let n=this._getOrReturnCtx(t);return h(n,{received:n.data,code:m.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:t.data}}get value(){return this._def.value}};be.create=(r,t)=>new be({value:r,typeName:b.ZodLiteral,...x(t)});function Gt(r,t){return new _e({values:r,typeName:b.ZodEnum,...x(t)})}var _e=class r extends S{_parse(t){if(typeof t.data!="string"){let n=this._getOrReturnCtx(t),s=this._def.values;return h(n,{expected:j.joinValues(s),received:n.parsedType,code:m.invalid_type}),y}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let n=this._getOrReturnCtx(t),s=this._def.values;return h(n,{received:n.data,code:m.invalid_enum_value,options:s}),y}return E(t.data)}get options(){return this._def.values}get enum(){let t={};for(let n of this._def.values)t[n]=n;return t}get Values(){let t={};for(let n of this._def.values)t[n]=n;return t}get Enum(){let t={};for(let n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return r.create(t,{...this._def,...n})}exclude(t,n=this._def){return r.create(this.options.filter(s=>!t.includes(s)),{...this._def,...n})}};_e.create=Gt;var ve=class extends S{_parse(t){let n=j.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(t);if(s.parsedType!==f.string&&s.parsedType!==f.number){let a=j.objectValues(n);return h(s,{expected:j.joinValues(a),received:s.parsedType,code:m.invalid_type}),y}if(this._cache||(this._cache=new Set(j.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let a=j.objectValues(n);return h(s,{received:s.data,code:m.invalid_enum_value,options:a}),y}return E(t.data)}get enum(){return this._def.values}};ve.create=(r,t)=>new ve({values:r,typeName:b.ZodNativeEnum,...x(t)});var ne=class extends S{unwrap(){return this._def.type}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==f.promise&&n.common.async===!1)return h(n,{code:m.invalid_type,expected:f.promise,received:n.parsedType}),y;let s=n.parsedType===f.promise?n.data:Promise.resolve(n.data);return E(s.then(a=>this._def.type.parseAsync(a,{path:n.path,errorMap:n.common.contextualErrorMap})))}};ne.create=(r,t)=>new ne({type:r,typeName:b.ZodPromise,...x(t)});var q=class extends S{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===b.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:n,ctx:s}=this._processInputParams(t),a=this._def.effect||null,o={addIssue:c=>{h(s,c),c.fatal?n.abort():n.dirty()},get path(){return s.path}};if(o.addIssue=o.addIssue.bind(o),a.type==="preprocess"){let c=a.transform(s.data,o);if(s.common.async)return Promise.resolve(c).then(async i=>{if(n.value==="aborted")return y;let d=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return d.status==="aborted"?y:d.status==="dirty"?ce(d.value):n.value==="dirty"?ce(d.value):d});{if(n.value==="aborted")return y;let i=this._def.schema._parseSync({data:c,path:s.path,parent:s});return i.status==="aborted"?y:i.status==="dirty"?ce(i.value):n.value==="dirty"?ce(i.value):i}}if(a.type==="refinement"){let c=i=>{let d=a.refinement(i,o);if(s.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?y:(i.status==="dirty"&&n.dirty(),c(i.value),{status:n.value,value:i.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>i.status==="aborted"?y:(i.status==="dirty"&&n.dirty(),c(i.value).then(()=>({status:n.value,value:i.value}))))}if(a.type==="transform")if(s.common.async===!1){let c=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!ee(c))return y;let i=a.transform(c.value,o);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:i}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(c=>ee(c)?Promise.resolve(a.transform(c.value,o)).then(i=>({status:n.value,value:i})):y);j.assertNever(a)}};q.create=(r,t,n)=>new q({schema:r,typeName:b.ZodEffects,effect:t,...x(n)});q.createWithPreprocess=(r,t,n)=>new q({schema:t,effect:{type:"preprocess",transform:r},typeName:b.ZodEffects,...x(n)});var $=class extends S{_parse(t){return this._getType(t)===f.undefined?E(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};$.create=(r,t)=>new $({innerType:r,typeName:b.ZodOptional,...x(t)});var H=class extends S{_parse(t){return this._getType(t)===f.null?E(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};H.create=(r,t)=>new H({innerType:r,typeName:b.ZodNullable,...x(t)});var xe=class extends S{_parse(t){let{ctx:n}=this._processInputParams(t),s=n.data;return n.parsedType===f.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};xe.create=(r,t)=>new xe({innerType:r,typeName:b.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...x(t)});var Se=class extends S{_parse(t){let{ctx:n}=this._processInputParams(t),s={...n,common:{...n.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return Ce(a)?a.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new N(s.common.issues)},input:s.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new N(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};Se.create=(r,t)=>new Se({innerType:r,typeName:b.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...x(t)});var Ie=class extends S{_parse(t){if(this._getType(t)!==f.nan){let s=this._getOrReturnCtx(t);return h(s,{code:m.invalid_type,expected:f.nan,received:s.parsedType}),y}return{status:"valid",value:t.data}}};Ie.create=r=>new Ie({typeName:b.ZodNaN,...x(r)});var Qn=Symbol("zod_brand"),De=class extends S{_parse(t){let{ctx:n}=this._processInputParams(t),s=n.data;return this._def.type._parse({data:s,path:n.path,parent:n})}unwrap(){return this._def.type}},qe=class r extends S{_parse(t){let{status:n,ctx:s}=this._processInputParams(t);if(s.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?y:o.status==="dirty"?(n.dirty(),ce(o.value)):this._def.out._parseAsync({data:o.value,path:s.path,parent:s})})();{let a=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?y:a.status==="dirty"?(n.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:s.path,parent:s})}}static create(t,n){return new r({in:t,out:n,typeName:b.ZodPipeline})}},ke=class extends S{_parse(t){let n=this._def.innerType._parse(t),s=a=>(ee(a)&&(a.value=Object.freeze(a.value)),a);return Ce(n)?n.then(a=>s(a)):s(n)}unwrap(){return this._def.innerType}};ke.create=(r,t)=>new ke({innerType:r,typeName:b.ZodReadonly,...x(t)});function Mt(r,t){let n=typeof r=="function"?r(t):typeof r=="string"?{message:r}:r;return typeof n=="string"?{message:n}:n}function Ht(r,t={},n){return r?re.create().superRefine((s,a)=>{let o=r(s);if(o instanceof Promise)return o.then(c=>{if(!c){let i=Mt(t,s),d=i.fatal??n??!0;a.addIssue({code:"custom",...i,fatal:d})}});if(!o){let c=Mt(t,s),i=c.fatal??n??!0;a.addIssue({code:"custom",...c,fatal:i})}}):re.create()}var Wn={object:U.lazycreate},b;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(b||(b={}));var Jn=(r,t={message:`Input not instance of ${r.name}`})=>Ht(n=>n instanceof r,t),Qt=te.create,Wt=le.create,Kn=Ie.create,Yn=de.create,Jt=pe.create,Xn=me.create,es=ze.create,ts=ue.create,rs=he.create,ns=re.create,ss=Y.create,as=V.create,os=Ae.create,is=X.create,cs=U.create,ls=U.strictCreate,ds=fe.create,ps=et.create,ms=ge.create,us=G.create,hs=tt.create,fs=Ee.create,gs=Oe.create,ys=rt.create,bs=ye.create,_s=be.create,vs=_e.create,xs=ve.create,Ss=ne.create,ks=q.create,js=$.create,Ts=H.create,ws=q.createWithPreprocess,Rs=qe.create,Cs=()=>Qt().optional(),Ps=()=>Wt().optional(),zs=()=>Jt().optional(),As={string:r=>te.create({...r,coerce:!0}),number:r=>le.create({...r,coerce:!0}),boolean:r=>pe.create({...r,coerce:!0}),bigint:r=>de.create({...r,coerce:!0}),date:r=>me.create({...r,coerce:!0})};var Es=y;var Os=r=>typeof r?.safeParse=="function";var yt=r=>typeof r?.passthrough=="function";var Is=(r,t)=>yt(r)?yt(t)?r.merge(t):r:yt(t)?t:Object.assign({},r,t);var bl=e.object({name:e.literal("ZodError"),issues:e.array(e.object({path:e.array(e.union([e.string(),e.number()])),message:e.string().optional(),code:e.nativeEnum(e.ZodIssueCode)}).catchall(e.any()))}),Ls=Symbol("ContractNoBody"),Yt=r=>"method"in r&&"path"in r;var Xt=(r,t)=>Object.fromEntries(Object.entries(r).map(([n,s])=>{var a,o,c;return Yt(s)?[n,{...s,path:t?.pathPrefix?t.pathPrefix+s.path:s.path,headers:Is(t?.baseHeaders,s.headers),strictStatusCodes:(a=s.strictStatusCodes)!==null&&a!==void 0?a:t?.strictStatusCodes,validateResponseOnClient:(o=s.validateResponseOnClient)!==null&&o!==void 0?o:t?.validateResponseOnClient,responses:{...t?.commonResponses,...s.responses},metadata:t?.metadata?{...t?.metadata,...(c=s.metadata)!==null&&c!==void 0?c:{}}:s.metadata}]:[n,Xt(s,t)]})),bt=Symbol("ContractPlainType"),Q=()=>({router:(r,t)=>Xt(r,t),query:r=>r,mutation:r=>r,responses:r=>r,response:()=>bt,body:()=>bt,type:()=>bt,otherResponse:({contentType:r,body:t})=>({contentType:r,body:t}),noBody:()=>Ls}),Ns=({path:r,params:t})=>{let n=t;return r.replace(/\/?:([^/?]+)\??/g,(s,a)=>n[a]?`${s.startsWith("/")?"/":""}${n[a]}`:"")},Us=(r,t=!1)=>{let n=t?Bs(r):$s(r);return n?.length>0?"?"+n:""},Bs=r=>r?Object.entries(r).filter(([,t])=>t!==void 0).map(([t,n])=>{let s;return typeof n=="string"&&!["true","false","null"].includes(n.trim())&&isNaN(Number(n))?s=n:s=JSON.stringify(n),`${encodeURIComponent(t)}=${encodeURIComponent(s)}`}).join("&"):"",$s=r=>r?Object.keys(r).flatMap(t=>_t(t,r[t])).map(([t,n])=>`${encodeURIComponent(t)}=${encodeURIComponent(n)}`).join("&"):"",_t=(r,t)=>Array.isArray(t)?t.flatMap((n,s)=>_t(`${r}[${s}]`,n)):t instanceof Date?[[`${r}`,t.toISOString()]]:t===null?[[`${r}`,""]]:t===void 0?[]:typeof t=="object"?Object.keys(t).flatMap(n=>_t(`${r}[${n}]`,t[n])):[[`${r}`,`${t}`]];var vt=class extends Error{constructor(t,n){let s=n.join(",");super(`Server returned unexpected response. Expected one of: ${s} got: ${t.status}`),this.response=t}};var Ds=async({route:r,path:t,method:n,headers:s,body:a,validateResponse:o,fetchOptions:c})=>{let i=await fetch(t,{...c,method:n,headers:s,body:a}),d=i.headers.get("content-type");if(d?.includes("application/")&&d?.includes("json")){let p={status:i.status,body:await i.json(),headers:i.headers},u=r.responses[p.status];return(o??r.validateResponseOnClient)&&Os(u)?{...p,body:u.parse(p.body)}:p}return d?.includes("text/")?{status:i.status,body:await i.text(),headers:i.headers}:{status:i.status,body:await i.blob(),headers:i.headers}},qs=r=>{let t=new FormData,n=(s,a)=>{a instanceof File?t.append(s,a):t.append(s,JSON.stringify(a))};return Object.entries(r).forEach(([s,a])=>{if(Array.isArray(a))for(let o of a)n(s,o);else n(s,a)}),t},Kt=r=>Object.fromEntries(Object.entries(r).map(([t,n])=>[t.toLowerCase(),n])),Ms=r=>{let{path:t,clientArgs:n,route:s,body:a,query:o,extraInputArgs:c,headers:i,fetchOptions:d}=r,p=n.api||Ds,u=n.baseHeaders&&Object.fromEntries(Object.entries(n.baseHeaders).map(([_,P])=>typeof P=="function"?[_,P(r)]:[_,P])),T={...u&&Kt(u),...Kt(i)};Object.keys(T).forEach(_=>{T[_]===void 0&&delete T[_]});let w={route:s,path:t,method:s.method,headers:T,body:void 0,rawBody:a,rawQuery:o,contentType:void 0,validateResponse:n.validateResponse,fetchOptions:{...n.credentials&&{credentials:n.credentials},...d},...d?.signal&&{signal:d.signal},...d?.cache&&{cache:d.cache},...d&&"next"in d&&!!d?.next&&{next:d.next}};return s.method!=="GET"&&("contentType"in s&&s.contentType==="multipart/form-data"?w={...w,contentType:"multipart/form-data",body:a instanceof FormData?a:qs(a)}:"contentType"in s&&s.contentType==="application/x-www-form-urlencoded"?w={...w,contentType:"application/x-www-form-urlencoded",headers:{"content-type":"application/x-www-form-urlencoded",...w.headers},body:typeof a=="string"?a:new URLSearchParams(a)}:a!=null&&(w={...w,contentType:"application/json",headers:{"content-type":"application/json",...w.headers},body:JSON.stringify(a)})),p({...w,...c})},Vs=(r,t,n)=>{let{query:s,params:a,body:o,headers:c,extraHeaders:i,overrideClientOptions:d,fetchOptions:p,cache:u,next:T,...w}=n||{},_={...t,...d};return{path:Fs(s,_.baseUrl,a,r,!!_.jsonQuery),clientArgs:_,route:r,body:o,query:s,extraInputArgs:w,fetchOptions:{...u&&{cache:u},...T&&{next:T},...p},headers:{...i,...c}}},Fs=(r,t,n,s,a)=>{let o=Ns({path:s.path,params:n}),c=Us(r,a);return`${t}${o}${c}`},Zs=(r,t)=>{let n=Object.keys(r.responses);return async s=>{let a=Vs(r,t,s),o=await Ms(a);if(!t.throwOnUnknownStatus||n.includes(o.status.toString()))return o;throw new vt(o,n)}},xt=(r,t)=>Object.fromEntries(Object.entries(r).map(([n,s])=>Yt(s)?[n,Zs(s,t)]:[n,xt(s,t)]));var St=["free","creator","team"],er=typeof process<"u"&&process.env?.NODE_ENV!=="production",Gs={stripe:{plans:[{tier:"free",subjectType:"user",name:"Free",description:"Upload threads, share read-only links, and collaborate with your workspace. Shared links expire after 3 days.",price:0,priceId:null,features:[{name:"Thread uploads + public links"},{name:"Workspace membership"},{name:"Shared links live 3 days"}],entitlements:{skills:!1,workspaceScope:!1,review:!1,sharedThreadTtlDays:3}},{tier:"creator",subjectType:"user",name:"Creator",description:"For builders who share a lot. Permanent links and the Skills tab.",price:29,isFeatured:!0,priceId:er?"price_1TP9BSKwvRM43sh64waIrvjj":"price_1TPA2gKwvRM43sh6Kp4ZCpJZ",features:[{name:"Everything in Free"},{name:"Shared threads live forever"},{name:"Skills tab \u2014 tool usage across every thread"}],entitlements:{skills:!0,workspaceScope:!1,review:!1,sharedThreadTtlDays:null}},{tier:"team",subjectType:"organization",name:"Team",description:"GitHub for Prompts. Org-wide thread sharing plus the review surface.",price:19,minSeats:2,priceId:er?"price_1TP9MpKwvRM43sh6TBIFxVCd":"price_1TPA3CKwvRM43sh6k0bgPTsQ",features:[{name:"Everything in Creator"},{name:"Workspace-wide thread sharing"},{name:"Minimum 2 seats"},{name:"Review feature (beta)"}],entitlements:{skills:!0,workspaceScope:!0,review:!0,sharedThreadTtlDays:null}}]}};var tr=Gs.stripe.plans,vl=Object.freeze(Object.fromEntries(tr.map(r=>[r.tier,r])));var Hs=Q(),O=e.object({message:e.string()}),kt=e.record(e.unknown()),je=e.string().regex(/^doc_[0-9A-Za-z]{22}$/),nt=e.string().regex(/^proj_[0-9A-Za-z]{22}$/),Qs=["active","archived"],st=e.enum(Qs),rr=e.object({id:e.string().min(1),display_name:e.string().min(1)}),nr=e.object({id:nt,name:e.string().min(1)}),jt=e.object({id:je,title:e.string().min(1),status:st,author:rr,project:nr.nullable(),created_at:e.string().datetime(),updated_at:e.string().datetime(),archived_at:e.string().datetime().nullable()}),Ws=e.object({type:e.literal("list"),list_type:e.literal("doc"),objects:e.array(jt)}),Js=e.object({project_id:nt.optional(),status:st.optional()}),Ks=e.object({title:e.string().trim().min(1).max(300).optional(),prosemirror_json:kt.optional(),project_id:nt.nullable().optional()}),Ys=e.object({id:je,created_at:e.string().datetime()}),Xs=e.object({title:e.string().trim().min(1).max(300).optional(),prosemirror_json:kt.optional(),project_id:nt.nullable().optional(),status:st.optional()}).refine(r=>Object.keys(r).length>0,{message:"At least one field must be provided"}),ea=e.object({id:je,updated_at:e.string().datetime()}),ta=e.object({id:je,title:e.string().min(1),prosemirror_json:kt,status:st,author:rr,project:nr.nullable(),created_at:e.string().datetime(),updated_at:e.string().datetime(),archived_at:e.string().datetime().nullable()}),sr=Hs.router({listDocs:{method:"GET",path:"/docs",headers:e.object({authorization:e.string().min(1).optional()}),query:Js,responses:{200:Ws,401:O,403:O},summary:"List docs in the authenticated user\u2019s organization. Optional project_id filter scopes to a single project."},createDoc:{method:"POST",path:"/docs",headers:e.object({authorization:e.string().min(1).optional()}),body:Ks,responses:{201:Ys,401:O,403:O,404:O,422:O},summary:"Create a doc. If project_id is provided, the doc is scoped to that project; otherwise it lives at the workspace level."},getDoc:{method:"GET",path:"/docs/:docId",pathParams:e.object({docId:je}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:ta,401:O,403:O,404:O},summary:"Get a doc by id with its rich-text body and parent project (if any)"},updateDoc:{method:"PATCH",path:"/docs/:docId",pathParams:e.object({docId:je}),headers:e.object({authorization:e.string().min(1).optional()}),body:Xs,responses:{200:ea,401:O,403:O,404:O,422:O},summary:"Update a doc. If prosemirror_json changes, the server re-syncs lore.mention_references from mention nodes."},deleteDoc:{method:"DELETE",path:"/docs/:docId",pathParams:e.object({docId:je}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{204:e.object({}),401:O,403:O,404:O},summary:"Hard-delete a doc and any mention references it owns"}});var ra=Q(),C=e.object({message:e.string()}),Tt=e.record(e.unknown()),W=e.string().regex(/^proj_[0-9A-Za-z]{22}$/),na=["active","archived"],at=e.enum(na),wt=e.object({id:e.string().min(1),display_name:e.string().min(1)}),ar=e.object({thread_id:e.string().min(1),title:e.string().min(1),added_at:e.string().datetime(),added_by:wt}),sa=e.object({id:W,name:e.string().min(1),status:at,author:wt,thread_count:e.number().int().nonnegative(),doc_count:e.number().int().nonnegative(),created_at:e.string().datetime(),updated_at:e.string().datetime(),archived_at:e.string().datetime().nullable()}),aa=e.object({type:e.literal("list"),list_type:e.literal("project"),objects:e.array(sa)}),oa=e.object({status:at.optional()}),ia=e.object({name:e.string().trim().min(1).max(200),prosemirror_json:Tt.optional()}),ca=e.object({id:W,created_at:e.string().datetime()}),la=e.object({name:e.string().trim().min(1).max(200).optional(),prosemirror_json:Tt.optional()}).refine(r=>Object.keys(r).length>0,{message:"At least one field must be provided"}),da=e.object({id:W,updated_at:e.string().datetime()}),pa=e.object({archived:e.boolean()}),ma=e.object({id:W,status:at,archived_at:e.string().datetime().nullable()}),ua=e.object({id:W,name:e.string().min(1),prosemirror_json:Tt,status:at,author:wt,created_at:e.string().datetime(),updated_at:e.string().datetime(),archived_at:e.string().datetime().nullable(),threads:e.array(ar),docs:e.array(jt)}),ha=e.object({thread_id:e.string().min(1).max(64)}),fa=ar,or=ra.router({listProjects:{method:"GET",path:"/projects",headers:e.object({authorization:e.string().min(1).optional()}),query:oa,responses:{200:aa,401:C},summary:"List projects in the authenticated user\u2019s organization"},createProject:{method:"POST",path:"/projects",headers:e.object({authorization:e.string().min(1).optional()}),body:ia,responses:{201:ca,401:C,422:C},summary:"Create a new project in the authenticated user\u2019s organization"},getProject:{method:"GET",path:"/projects/:projectId",pathParams:e.object({projectId:W}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:ua,401:C,403:C,404:C},summary:"Get a project with its attached threads and child docs. The project description is the canonical mention source for project-scoped @-mentions."},updateProject:{method:"PATCH",path:"/projects/:projectId",pathParams:e.object({projectId:W}),headers:e.object({authorization:e.string().min(1).optional()}),body:la,responses:{200:da,401:C,403:C,404:C,422:C},summary:"Update a project\u2019s name or rich-text body. Body changes re-sync mention_references for source_kind=project."},archiveProject:{method:"POST",path:"/projects/:projectId/archive",pathParams:e.object({projectId:W}),headers:e.object({authorization:e.string().min(1).optional()}),body:pa,responses:{200:ma,401:C,403:C,404:C},summary:"Archive (soft-delete) or unarchive a project"},addProjectThread:{method:"POST",path:"/projects/:projectId/threads",pathParams:e.object({projectId:W}),headers:e.object({authorization:e.string().min(1).optional()}),body:ha,responses:{201:fa,401:C,403:C,404:C,409:C,422:C},summary:"Pin an existing visible thread to this project. Idempotent \u2014 re-adding returns the existing membership."},removeProjectThread:{method:"DELETE",path:"/projects/:projectId/threads/:threadId",pathParams:e.object({projectId:W,threadId:e.string().min(1).max(64)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{204:e.object({}),401:C,403:C,404:C},summary:"Remove a thread membership from a project"}});var ga=Q(),ot=e.object({message:e.string()}),ya=["thread","plan","doc","user"],it=e.enum(ya),ba=["doc","project"],_a=e.enum(ba),va=e.object({kind:it,id:e.string().min(1),title:e.string().min(1),href:e.string().min(1)}),xa=e.object({type:e.literal("list"),list_type:e.literal("mention"),objects:e.array(va)}),Sa=e.object({q:e.string().trim().min(1).max(50),kinds:e.string().optional().transform(r=>{if(!r)return;let t=r.split(",").map(n=>n.trim()).filter(n=>n.length>0);return t.length>0?t:void 0}).pipe(e.array(it).optional())}),ka=e.object({source_kind:_a,source_id:e.string().min(1),source_title:e.string().min(1),source_href:e.string().min(1),target_kind:it,target_id:e.string().min(1),created_at:e.string().datetime()}),ja=e.object({type:e.literal("list"),list_type:e.literal("backlink"),objects:e.array(ka)}),Ta=e.object({target_kind:it,target_id:e.string().min(1).max(64)}),ir=ga.router({searchMentions:{method:"GET",path:"/mentions/search",headers:e.object({authorization:e.string().min(1).optional()}),query:Sa,responses:{200:xa,401:ot,422:ot},summary:"Search threads, plans, files, and users by title/name for @-mention typeahead. Org-scoped, max 10 results across all kinds."},listBacklinks:{method:"GET",path:"/mentions/backlinks",headers:e.object({authorization:e.string().min(1).optional()}),query:Ta,responses:{200:ja,401:ot,403:ot},summary:"List every doc/project body in the caller\u2019s organization that mentions the given target. Newest-first."}});var wa=Q(),Ra=e.object({type:e.literal("list"),list_type:e.literal("thread"),has_more:e.boolean(),objects:e.array(e.unknown())}),se=e.object({message:e.string()}),cr=e.object({thread_id:e.string().min(1),is_favorited:e.boolean(),favorited_at:e.string().datetime().nullable()}),Ca=e.object({before:e.string().min(1).max(64).optional()}),lr=wa.router({addThreadFavorite:{method:"POST",path:"/threads/:id/favorite",pathParams:e.object({id:e.string().min(1).max(64)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{201:cr,401:se,403:se,404:se},summary:"Bookmark a thread for the authenticated user. Idempotent \u2014 re-favoriting returns the existing membership."},removeThreadFavorite:{method:"DELETE",path:"/threads/:id/favorite",pathParams:e.object({id:e.string().min(1).max(64)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{200:cr,401:se,403:se,404:se},summary:"Remove a thread bookmark for the authenticated user (no-op if absent)."},listFavoriteThreads:{method:"GET",path:"/favorites/threads",headers:e.object({authorization:e.string().min(1).optional()}),query:Ca,responses:{200:Ra,401:se,403:se},summary:"List threads the authenticated user has favorited, newest favorited first. Visibility filtering still applies \u2014 a thread the viewer can no longer see (e.g. visibility downgraded) is omitted from the list."}});var Pa=Q(),za=e.object({id:e.string().uuid(),role:e.enum(["user","assistant"]),content:e.string().min(1),timestamp:e.string().datetime()}),Aa=e.object({id:e.string().uuid(),title:e.string().min(1),author:e.string().min(1),authorAvatar:e.string().min(1).max(4),model:e.string().min(1),turnCount:e.number().int().nonnegative(),createdAt:e.string().datetime(),preview:e.string()}),Xl=Aa.extend({messages:e.array(za)}),l=e.object({message:e.string()}),Ea=/^[a-zA-Z0-9_-]{2,32}$/,yr=e.string().regex(Ea,"Handle must be 2\u201332 characters: letters, numbers, dashes, or underscores."),Rt=e.object({id:e.string(),first_name:e.string().min(1),last_name:e.string().min(1),display_name:e.string().min(1),stytch_id:e.string().nullable(),handle:e.string().nullable(),bio:e.string().max(280).nullable(),avatar_url:e.string().nullable(),banner_url:e.string().nullable(),share_new_threads_to_workspace:e.boolean(),experimental_features_enabled:e.boolean(),onboarded_at:e.string().nullable()}),Oa=e.object({stytchMemberId:e.string().min(1).optional(),emailAddress:e.string().email(),name:e.string().nullable(),user:Rt,is_admin:e.boolean()}),Ia=e.object({share_new_threads_to_workspace:e.boolean().optional(),experimental_features_enabled:e.boolean().optional(),onboarded_at:e.union([e.literal("now"),e.null()]).optional(),display_name:e.string().min(1).max(120).optional(),handle:yr.optional(),bio:e.string().max(280).nullable().optional(),avatar_storage_url:e.string().min(1).nullable().optional(),banner_storage_url:e.string().min(1).nullable().optional()}).refine(r=>Object.keys(r).length>0,{message:"At least one field must be provided"}),La=e.object({id:e.string(),display_name:e.string(),handle:e.string().nullable(),avatar_url:e.string().nullable(),visible_thread_count:e.number().int().nonnegative(),last_active_at:e.string().datetime().nullable()}),br=e.object({id:e.string().min(1),display_name:e.string().min(1),handle:e.string().nullable(),bio:e.string().max(280).nullable(),avatar_url:e.string().nullable(),banner_url:e.string().nullable(),organization_name:e.string().min(1).nullable(),created_at:e.string().min(1),visible_thread_count:e.number().int().nonnegative(),follower_count:e.number().int().nonnegative(),following_count:e.number().int().nonnegative(),published_project_count:e.number().int().nonnegative(),is_following:e.boolean(),is_self:e.boolean()}),Na=e.object({type:e.literal("list"),list_type:e.literal("organization_member"),objects:e.array(La)}),Ua=e.object({email_address:e.string().email()}),Ba=e.object({email_address:e.string().email(),member_id:e.string().min(1)}),$a=e.object({location:e.string().trim().min(1),contact:e.string().trim().email()}),Da=e.object({location:e.string().min(1),contact:e.string().email(),created_at:e.string().datetime()}),qa=e.object({first_name:e.string().min(1),last_name:e.string().min(1),display_name:e.string().min(1),stytch_id:e.string().min(1).optional()}),Ma=e.object({name:e.string().min(1),email_domains:e.array(e.string().min(1)).nonempty(),stytch_org_id:e.string().min(1)}),Va=e.object({user:qa,organization:Ma}),Fa=e.object({path_glob:e.string().min(1),name:e.string().min(1),description:e.string().min(1)}),Za=e.object({repo_origin_path:e.string().min(1),building_blocks:e.array(Fa)}),_r=e.string().regex(/^th_[0-9A-Za-z]{22}$/),lt=e.string().regex(/^tb_[0-9A-Za-z]{22}$/),Ga=e.object({id:_r,author:e.object({id:e.string().min(1),display_name:e.string().min(1)}),body:e.string(),created_at:e.string().datetime(),repo_origin_path:e.string().min(1),latest_revision_id:lt,revision_count:e.number().int().positive()}),Ha=e.object({id:e.string().min(1),display_name:e.string().min(1)}),Qa=e.object({id:e.string().min(1),author_id:e.string().min(1).nullable(),author:Ha.nullable(),created_at:e.string().datetime(),deleted_at:e.string().datetime().nullable(),content:e.string().min(1)}),Wa=e.object({id:e.string().min(1),thread_block_id:e.string().min(1),created_at:e.string().datetime(),resolved_at:e.string().datetime().nullable(),comments:e.array(Qa)}),Ja=e.object({thread_block_id:lt,from_position:e.number().int().positive(),to_position:e.number().int().positive(),selected_text:e.string().min(1),content:e.string().trim().min(1)}),Ka=e.object({id:e.string().min(1)}),Ya=e.object({content:e.string().trim().min(1)}),Xa=e.object({id:e.string().min(1)}),eo=e.object({content:e.string().trim().min(1)}),to=e.object({id:e.string().min(1)}),ro=e.object({content:e.string().trim().min(1)}),no=e.object({id:e.string().min(1)}),so=e.object({resolved:e.boolean()}),ao=e.object({id:e.string().min(1),resolved_at:e.string().datetime().nullable()}),oo=e.object({resolved:e.boolean()}),io=e.object({id:e.string().min(1),resolved_at:e.string().datetime().nullable()}),vr=e.record(e.unknown()),co=e.object({id:lt,body:e.string(),created_at:e.string().datetime(),prosemirror_json:vr,comment_threads:e.array(Wa)}),lo=e.object({id:_r,created_at:e.string().datetime(),repo_origin_path:e.string().min(1),author:e.object({id:e.string().min(1),display_name:e.string().min(1)}),latest_revision_id:lt,revision_count:e.number().int().positive(),revisions:e.array(co)}),po=e.object({type:e.literal("list"),list_type:e.literal("plan"),has_more:e.boolean(),objects:e.array(Ga)}),mo=e.object({before:e.string().min(1).optional(),after:e.string().min(1).optional(),author_id:e.string().min(1).optional(),repo_origin_path:e.string().min(1).optional()}),xr=e.object({id:e.string().min(1),organization_id:e.string().min(1),created_at:e.string().min(1),repo_origin_path:e.string().min(1),path_glob:e.string().min(1),name:e.string().min(1),description:e.string().min(1)}),uo=e.array(xr),ho=e.object({type:e.literal("list"),list_type:e.literal("building_block"),has_more:e.boolean(),objects:e.array(xr)}),fo=e.object({repo_origin_path:e.string().min(1),before:e.string().min(1).optional(),after:e.string().min(1).optional()}),go=e.enum(["thread","building_block"]),yo=e.object({repo_origin_path:e.string().min(1),sources:e.array(go).nonempty()}),bo=e.object({type:e.literal("list"),list_type:e.literal("repository"),has_more:e.boolean(),objects:e.array(yo)}),ae=e.enum(["claudeCode","codex","amp","cursor","unspecified"]),_o=["transcript","plan"],vo=e.enum(_o),xo=e.object({md5:e.string().min(1),harness:ae,filename:e.string().min(1).optional(),repo_origin_path:e.string().min(1).optional(),harness_internal_id:e.string().min(1).optional(),file_type:vo.optional()}).refine(r=>(r.filename?.trim().length??0)>0||(r.harness_internal_id?.trim().length??0)>0,{path:["harness_internal_id"],message:"filename or harness_internal_id is required"}),Pt=e.object({id:e.string().min(1),display_name:e.string().min(1)}),So=e.object({id:e.string().min(1),display_name:e.string().min(1)}),Sr=e.object({id:e.string().min(1),author_id:e.string().min(1).nullable(),author:So.nullable(),created_at:e.string().datetime(),deleted_at:e.string().datetime().nullable(),content:e.string().min(1)}),kr=e.object({id:e.string().min(1),thread_block_id:e.string().min(1),created_at:e.string().datetime(),resolved_at:e.string().datetime().nullable()}),ko=kr.extend({comments:e.array(Sr)}),Me=e.object({id:e.string().min(1),type:e.string().min(1),index_in_thread:e.number().int().nonnegative(),isCritiqued:e.boolean(),comment_threads:e.array(ko).optional()}).passthrough(),jr=e.object({type:e.literal("list"),list_type:e.literal("thread_block"),has_more:e.boolean(),objects:e.array(Me)}),dr=Me.extend({type:e.literal("plan"),prosemirror_json:vr,thread_file_id:e.string().min(1)}),jo=e.union([e.literal(-1),e.literal(1)]),Tr=e.union([e.literal(-1),e.literal(0),e.literal(1)]),pr=e.object({score:e.number().int(),up_count:e.number().int().nonnegative(),down_count:e.number().int().nonnegative(),viewer_vote:Tr}),To=e.object({value:jo}),wo=e.object({id:e.string().min(1),display_name:e.string().min(1),avatar_url:e.string().nullable()}),Te=e.object({id:e.string().min(1),thread_id:e.string().min(1),author_id:e.string().min(1).nullable(),author:wo.nullable(),parent_comment_id:e.string().min(1).nullable(),content:e.string(),created_at:e.string().datetime(),updated_at:e.string().datetime(),deleted_at:e.string().datetime().nullable()}),Ro=e.object({type:e.literal("list"),list_type:e.literal("thread_comment"),objects:e.array(Te)}),Co=e.object({content:e.string().trim().min(1).max(4e3),parent_comment_id:e.string().min(1).optional()}),Po=Te,zo=e.object({content:e.string().trim().min(1).max(4e3)}),Ao=Te,Eo=Te,ed=e.discriminatedUnion("kind",[e.object({kind:e.literal("created"),thread_id:e.string().min(1),actor_user_id:e.string().min(1),version:e.number(),comment:Te}),e.object({kind:e.literal("updated"),thread_id:e.string().min(1),actor_user_id:e.string().min(1),version:e.number(),comment:Te}),e.object({kind:e.literal("deleted"),thread_id:e.string().min(1),actor_user_id:e.string().min(1),version:e.number(),comment:Te})]),Oo=e.enum(["pending","generating","ready","failed"]),Io=e.enum(["pending","generating","ready","failed"]),Lo=e.enum(["pending","placeholder","ai","user"]),wr=e.enum(["pending","generating","ready","failed"]),No=e.enum(["asked","requested","decided","corrected","shared"]),Uo=e.object({id:e.string().min(1),kind:No,summary:e.string().min(1),block_id:e.string().min(1)}),Bo=e.object({type:e.literal("list"),list_type:e.literal("thread_decision"),status:wr,generated_at:e.string().nullable(),objects:e.array(Uo)}),Le=e.object({id:e.string().min(1),thread_file_id:e.string().min(1),organization_id:e.string().min(1),author:Pt,repo:e.string().min(1),title:e.string().min(1),started_at:e.string().min(1),blocks:jr,user_message_count:e.number().int().nonnegative(),files_touched:e.array(e.string()),skills_invoked:e.array(e.string()),harness:ae,transcript_parsing_state:e.enum(["pending","parsed","too_large_to_parse"]),visibility:e.enum(["private","workspace","public"]),has_plan:e.boolean().optional(),summary:e.string().nullable(),summary_status:Oo,summary_generated_at:e.string().nullable(),title_status:Io,title_generated_at:e.string().nullable(),title_source:Lo,decisions_status:wr,decisions_generated_at:e.string().nullable(),score:e.number().int(),up_count:e.number().int().nonnegative(),down_count:e.number().int().nonnegative(),viewer_vote:Tr,comment_count:e.number().int().nonnegative(),is_favorited:e.boolean()}),$o=e.object({storage_url:e.string().min(1)}),Do=e.object({storage_url:e.string(),harness:ae,thread:Le.nullable()}),qo=e.object({status:e.literal("complete"),thread_files:e.array(Do)}),Mo=e.object({id:e.string(),presigned_url:e.string().nullable(),presigned_url_expires_at:e.string().nullable(),storage_url:e.string(),harness:ae,expected_md5:e.string(),error:e.string().nullable(),thread:Le.nullable()}),Vo=e.object({id:e.string(),substrate:e.enum(["s3","filesystem"]),status:e.enum(["incomplete","locked_for_parsing","complete","error"]),thread_files:e.array(Mo)}),Fo=e.object({visibility:e.enum(["private","workspace","public"]).optional(),title:e.string().trim().min(1).max(200).optional()}).refine(r=>r.visibility!==void 0||r.title!==void 0,{message:"At least one of visibility or title must be provided"}),Zo=e.discriminatedUnion("visibility",[e.object({visibility:e.literal("private")}),e.object({visibility:e.literal("workspace")}),e.object({visibility:e.literal("public"),title:e.string().min(1),author_display_name:e.string().min(1),first_user_message:e.string().nullable(),summary:e.string().nullable(),started_at:e.string().min(1),harness:ae})]),Go=Le,mr=e.object({type:e.literal("list"),list_type:e.literal("thread"),has_more:e.boolean(),objects:e.array(Go)}),Ho=e.enum(["recent","popular"]),Qo=Le,Wo=e.object({type:e.literal("list"),list_type:e.literal("discover_thread"),has_more:e.boolean(),objects:e.array(Qo)}),Jo=e.object({before:e.string().min(1).optional(),after:e.string().min(1).optional(),sort:Ho.optional(),harness:ae.optional(),search:e.string().max(200).optional()}),Ko=e.object({thread_count:e.number().int().nonnegative(),author_count:e.number().int().nonnegative(),organization_count:e.number().int().nonnegative(),harness_breakdown:e.record(ae,e.number().int().nonnegative())}),Yo=e.object({id:e.string(),status:e.enum(["incomplete","locked_for_parsing","complete","error"]),created_at:e.string(),thread_count:e.number().int().nonnegative()}),Xo=e.object({type:e.literal("list"),list_type:e.literal("upload_session"),objects:e.array(Yo)}),ei=e.object({before:e.string().min(1).optional(),after:e.string().min(1).optional()}),ti=e.object({before:e.string().min(1).optional(),after:e.string().min(1).optional(),author_ids:e.string().min(1).optional(),created_at:e.string().min(1).optional(),filepath_prefixes:e.string().min(1).optional()}),ri=e.object({path:e.string().min(1),start_offset:e.number().int().nonnegative(),end_offset:e.number().int().positive()}),ni=e.object({name:e.string(),usage_count:e.number().int().nonnegative(),author_count:e.number().int().nonnegative(),first_used_at:e.string().nullable(),last_used_at:e.string().nullable(),usage_count_last_24h:e.number().int().nonnegative(),usage_count_last_7d:e.number().int().nonnegative()}),si=e.object({type:e.literal("list"),list_type:e.literal("skill"),objects:e.array(ni)}),ai=e.object({id:e.string(),title:e.string(),visibility:e.enum(["private","workspace","public"]),started_at:e.string(),author:Pt,skills_invoked:e.array(e.string())}),oi=e.object({name:e.string(),usage_count:e.number().int().nonnegative(),author_count:e.number().int().nonnegative(),first_used_at:e.string().nullable(),last_used_at:e.string().nullable(),threads:e.array(ai)}),ii=e.object({path:e.string().min(1),text:e.string().max(64e3)}),ci=e.enum(["text_edit","redact","delete_block"]),li=e.object({id:e.string(),thread_block_id:e.string(),editor:e.object({id:e.string(),display_name:e.string()}),kind:ci,path:e.string().nullable(),previous_text:e.string().nullable(),new_text:e.string().nullable(),created_at:e.string()}),di=e.object({type:e.literal("list"),list_type:e.literal("thread_block_edit"),objects:e.array(li)}),pi=e.object({organization_count:e.number().int().nonnegative(),user_count:e.number().int().nonnegative(),thread_count:e.number().int().nonnegative(),thread_count_last_24h:e.number().int().nonnegative(),user_count_last_24h:e.number().int().nonnegative()}),mi=e.object({id:e.string(),name:e.string(),email_domains:e.array(e.string()),stytch_org_id:e.string(),member_count:e.number().int().nonnegative(),thread_count:e.number().int().nonnegative(),default_thread_visibility:e.enum(["private","workspace","public"]),created_at:e.string()}),ui=e.object({type:e.literal("list"),list_type:e.literal("admin_organization"),objects:e.array(mi)}),Rr=e.object({id:e.string(),name:e.string()}),hi=e.object({id:e.string(),display_name:e.string(),stytch_id:e.string().nullable(),thread_count:e.number().int().nonnegative(),onboarded_at:e.string().nullable(),created_at:e.string(),organizations:e.array(Rr)}),fi=e.object({type:e.literal("list"),list_type:e.literal("admin_user"),objects:e.array(hi)}),gi=e.object({id:e.string(),title:e.string(),started_at:e.string(),created_at:e.string(),deleted_at:e.string().nullable(),visibility:e.enum(["private","workspace","public"]),harness:ae,author:Pt,organization:Rr}),yi=e.object({type:e.literal("list"),list_type:e.literal("admin_thread"),has_more:e.boolean(),objects:e.array(gi)}),bi=e.object({before:e.string().min(1).optional(),after:e.string().min(1).optional()}),ur=e.object({token:e.string().min(1),thread_id:e.string().min(1)}),_i=e.object({visitor:e.string().min(1).max(64).optional()}),vi=e.object({user_id:e.string(),display_name:e.string(),shares_sent:e.number().int().nonnegative(),unique_viewers:e.number().int().nonnegative(),attributed_signups:e.number().int().nonnegative()}),xi=e.object({window_days:e.number().int().positive(),shares_sent:e.number().int().nonnegative(),unique_viewers:e.number().int().nonnegative(),attributed_signups:e.number().int().nonnegative(),active_sharers:e.number().int().nonnegative(),k_factor:e.number().nullable(),shares_sent_sparkline:e.array(e.number().int().nonnegative()),top_sharers:e.array(vi)}),Si=e.object({windows:e.array(xi)}),ki=e.object({quoted_text:e.string().min(1),comment:e.string().nullable(),type:e.enum(["comment","highlight:trapdoor"])}),ji=kr,Ti=Sr.extend({comment_thread_id:e.string().min(1)}),wi=e.object({markdown:e.string().min(1)}),Ri=e.object({storage_url:e.string().min(1),thread_file_id:e.string().min(1),parsed_plan_block:dr,critiqued_plan_block:dr,annotations:e.array(ki),comment_threads:e.array(ji),comments:e.array(Ti)}),Ne=e.enum(St),Cr=e.object({skills:e.boolean(),workspace_scope:e.boolean(),review:e.boolean(),shared_thread_ttl_days:e.number().int().positive().nullable()}),Ct=e.object({subject_type:e.enum(["user","organization"]),subject_id:e.string().min(1),effective_plan:Ne,admin_override:Ne.nullable(),stripe_subscription_status:e.string().nullable(),cancel_at_period_end:e.boolean(),current_period_end:e.string().nullable(),seat_quantity:e.number().int().positive(),member_count:e.number().int().nonnegative().nullable(),features:Cr}),Ci=e.object({effective_plan:Ne,features:Cr,user:Ct,organization:Ct.nullable()}),Pi=e.object({plan:e.enum(["creator","team"]),seat_quantity:e.number().int().positive().optional()}),zi=e.object({checkout_url:e.string().min(1)}),Ai=e.object({portal_url:e.string().min(1)}),Ei=e.object({seat_quantity:e.number().int().positive()}),hr=e.object({plan:Ne.nullable()}),ct=e.object({subject_type:e.enum(["user","organization"]),subject_id:e.string().min(1),label:e.string().min(1),effective_plan:Ne,admin_override:Ne.nullable(),stripe_subscription_status:e.string().nullable(),seat_quantity:e.number().int().positive()}),Oi=e.object({users:e.array(ct),organizations:e.array(ct)}),Ii=e.object({id:e.string().min(1),display_name:e.string().min(1),handle:e.string().nullable(),avatar_url:e.string().nullable()}),Li=e.object({thread_id:e.string().min(1),title:e.string().min(1),author:Ii,last_active_at:e.string().datetime(),last_block_excerpt:e.string().nullable(),last_block_kind:e.string().min(1).nullable(),is_streaming:e.boolean()}),Ni=e.object({type:e.literal("list"),list_type:e.literal("live_thread"),objects:e.array(Li)}),Ui=e.object({thread_id:e.string().min(1)}),Bi=e.object({thread_id:e.string().min(1),last_seen_at:e.string().datetime(),started_at:e.string().datetime()}),$i=e.object({follower_id:e.string().min(1),followee_id:e.string().min(1),is_following:e.literal(!0),follower_count:e.number().int().nonnegative()}),Di=e.object({follower_id:e.string().min(1),followee_id:e.string().min(1),is_following:e.literal(!1),follower_count:e.number().int().nonnegative()}),Pr=e.object({id:e.string().min(1),display_name:e.string().min(1),handle:e.string().nullable(),avatar_url:e.string().nullable(),bio:e.string().max(280).nullable(),is_following:e.boolean(),is_self:e.boolean()}),fr=e.object({type:e.literal("list"),list_type:e.literal("user_follow"),objects:e.array(Pr)}),qi=e.object({date:e.string().regex(/^\d{4}-\d{2}-\d{2}$/),count:e.number().int().nonnegative()}),Mi=e.object({window_start:e.string().datetime(),window_end:e.string().datetime(),total_contributions:e.number().int().nonnegative(),days_active:e.number().int().nonnegative(),daily_average:e.number().nonnegative(),current_streak_days:e.number().int().nonnegative(),days:e.array(qi)}),Vi=e.object({type:e.literal("thread_created"),occurred_at:e.string().datetime(),id:e.string().min(1),thread:e.object({id:e.string().min(1),title:e.string(),visibility:e.enum(["private","workspace","public"])})}),Fi=e.object({type:e.literal("comment_posted"),occurred_at:e.string().datetime(),id:e.string().min(1),comment_excerpt:e.string(),thread:e.object({id:e.string().min(1),title:e.string(),visibility:e.enum(["private","workspace","public"])})}),Zi=e.object({type:e.literal("project_published"),occurred_at:e.string().datetime(),id:e.string().min(1),project:e.object({id:e.string().min(1),name:e.string().min(1)})}),Gi=e.object({type:e.literal("user_followed"),occurred_at:e.string().datetime(),id:e.string().min(1),followee:Pr}),Hi=e.discriminatedUnion("type",[Vi,Fi,Zi,Gi]),Qi=e.object({type:e.literal("list"),list_type:e.literal("user_activity"),objects:e.array(Hi)}),Wi=e.object({id:e.string().min(1),name:e.string().min(1),excerpt:e.string(),published_at:e.string().datetime(),updated_at:e.string().datetime()}),Ji=e.object({type:e.literal("list"),list_type:e.literal("profile_published_project"),objects:e.array(Wi)}),gr=e.object({id:e.string().min(1),published_at:e.string().datetime().nullable()}),Ki=e.enum(["avatar","banner"]),Yi=e.enum(["image/png","image/jpeg","image/webp","image/gif"]),Xi=e.object({kind:Ki,content_type:Yi,base64_data:e.string().min(1)}),ec=e.object({substrate:e.enum(["s3","filesystem"]),storage_url:e.string().min(1)}),tc=br,zr=Pa.router({health:{method:"GET",path:"/health",responses:{200:e.object({status:e.literal("ok")})},summary:"Health check"},whoAmI:{method:"GET",path:"/whoami",headers:e.object({authorization:e.string().min(1).optional(),"x-lore-referral-token":e.string().min(1).max(16).optional()}),responses:{200:Oa,401:l},summary:"Validate a Stytch B2B Bearer token and return member plus user fields"},recordHeartbeat:{method:"POST",path:"/heartbeat",headers:e.object({authorization:e.string().min(1).optional()}),body:Ui,responses:{200:Bi,401:l,403:l,404:l,422:l},summary:"Record (or refresh) a presence heartbeat for the authenticated user against one of their own threads. Idempotent; the daemon should call this every ~30s while a session is open."},listLiveThreads:{method:"GET",path:"/threads/live",headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:Ni,401:l,403:l},summary:"List teammates with activity in the last 5 minutes. Excludes the requester. Org-scoped, deduped per author, max 10."},listThreads:{method:"GET",path:"/threads",headers:e.object({authorization:e.string().min(1).optional()}),query:ti,responses:{200:mr,401:l},summary:"List threads visible to the authenticated user"},getThread:{method:"GET",path:"/threads/:id",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:Le,404:l},summary:"Load a visible thread by id"},getSimilarThreads:{method:"GET",path:"/threads/:id/similar",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:mr,404:l,409:l},summary:"List the top 20 visible threads with the closest summary embedding"},listThreadBlocks:{method:"GET",path:"/threads/:id/blocks",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),query:ei,responses:{200:jr,401:l},summary:"List blocks for a visible thread"},createThreadBlockCommentThread:{method:"POST",path:"/threads/:threadId/blocks/:blockId/comment-threads",pathParams:e.object({threadId:e.string().min(1),blockId:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:Ya,responses:{201:Xa,401:l,404:l},summary:"Create a new block-level comment thread on a visible thread block"},createThreadBlockComment:{method:"POST",path:"/threads/:threadId/blocks/:blockId/comment-threads/:commentThreadId/comments",pathParams:e.object({threadId:e.string().min(1),blockId:e.string().min(1),commentThreadId:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:ro,responses:{201:no,401:l,404:l,409:l},summary:"Reply to a block-level comment thread on a visible thread block"},updateThreadBlockCommentThread:{method:"PATCH",path:"/threads/:threadId/blocks/:blockId/comment-threads/:commentThreadId",pathParams:e.object({threadId:e.string().min(1),blockId:e.string().min(1),commentThreadId:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:oo,responses:{200:io,401:l,404:l},summary:"Resolve or reopen a block-level comment thread on a visible thread block"},listSkills:{method:"GET",path:"/skills",headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:si,401:l},summary:"Aggregate skill usage across threads the viewer can see"},getSkillDetail:{method:"GET",path:"/skills/:name",pathParams:e.object({name:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:oi,401:l,404:l},summary:"Per-skill detail: usage stats + visible threads that invoked it"},redactThreadBlock:{method:"POST",path:"/threads/:threadId/blocks/:blockId/redactions",pathParams:e.object({threadId:e.string().min(1),blockId:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:ri,responses:{200:Me,401:l,403:l,404:l,422:l},summary:"Permanently redact a character range within a text field of a thread block (author only)"},updateThreadBlockText:{method:"PATCH",path:"/threads/:threadId/blocks/:blockId/text",pathParams:e.object({threadId:e.string().min(1),blockId:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:ii,responses:{200:Me,401:l,403:l,404:l,422:l},summary:"Replace a single text leaf in a thread block with new content (author only)"},critiqueThreadBlock:{method:"POST",path:"/threads/:threadId/blocks/:blockId/critique",pathParams:e.object({threadId:e.string().min(1),blockId:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{200:Me,401:l,403:l,404:l,409:l,422:l},summary:"Critique a plan block once and persist its annotations as nested comment threads (author only)"},deleteThreadBlock:{method:"DELETE",path:"/threads/:threadId/blocks/:blockId",pathParams:e.object({threadId:e.string().min(1),blockId:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{204:e.null(),401:l,403:l,404:l},summary:"Soft-delete a thread block (author only)"},listThreadBlockEdits:{method:"GET",path:"/threads/:threadId/blocks/:blockId/edits",pathParams:e.object({threadId:e.string().min(1),blockId:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:di,401:l,404:l},summary:"List edits made to a thread block (visible to anyone who can see the thread)"},listThreadDecisions:{method:"GET",path:"/threads/:id/decisions",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:Bo,401:l,404:l},summary:"List AI-extracted user decisions for a thread, in chronological order"},updateThread:{method:"PATCH",path:"/threads/:id",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:Fo,responses:{200:Le,401:l,403:l,404:l},summary:"Update thread visibility (author only)"},deleteThread:{method:"DELETE",path:"/threads/:id",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{204:e.null(),401:l,403:l,404:l},summary:"Soft-delete a thread (author only)"},castThreadVote:{method:"PUT",path:"/threads/:id/vote",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:To,responses:{200:pr,401:l,403:l,404:l,422:l},summary:"Cast or change the caller's up/down vote on a public thread. Idempotent \u2014 re-casting the same value is a no-op."},clearThreadVote:{method:"DELETE",path:"/threads/:id/vote",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{200:pr,401:l,404:l},summary:"Clear the caller's vote on a thread. No-op when the caller hasn't voted."},listThreadComments:{method:"GET",path:"/threads/:threadId/comments",pathParams:e.object({threadId:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:Ro,403:l,404:l},summary:"List all (live + soft-deleted as tombstones) comments on a public thread, flat with parent_comment_id pointers."},createThreadComment:{method:"POST",path:"/threads/:threadId/comments",pathParams:e.object({threadId:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:Co,responses:{201:Po,401:l,403:l,404:l,422:l},summary:"Post a top-level or reply comment on a public thread."},updateThreadComment:{method:"PATCH",path:"/threads/:threadId/comments/:commentId",pathParams:e.object({threadId:e.string().min(1),commentId:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:zo,responses:{200:Ao,401:l,403:l,404:l,422:l},summary:"Edit your own thread comment (author only; rejects edits to soft-deleted rows)."},deleteThreadComment:{method:"DELETE",path:"/threads/:threadId/comments/:commentId",pathParams:e.object({threadId:e.string().min(1),commentId:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{200:Eo,401:l,403:l,404:l},summary:"Soft-delete your own thread comment (author only). Idempotent."},getThreadPreview:{method:"GET",path:"/threads/:id/preview",pathParams:e.object({id:e.string().min(1)}),responses:{200:Zo,404:l},summary:"Unauthenticated, visibility-redacted metadata for OG / social preview consumers"},createUser:{method:"POST",path:"/users",headers:e.object({authorization:e.string().min(1).optional()}),body:Va,responses:{201:Rt,401:l},summary:"Create a user record with ApiKey authentication"},getUser:{method:"GET",path:"/users/:id",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:br,404:l},summary:"Public profile for a user. Optional auth \u2014 unauthenticated viewers see only public thread metadata; signed-in viewers see counts scoped to the threads they'd normally be able to access."},updateCurrentUser:{method:"PATCH",path:"/users/me",headers:e.object({authorization:e.string().min(1).optional()}),body:Ia,responses:{200:Rt,401:l,409:l,422:l},summary:"Update the authenticated user profile"},getUserByHandle:{method:"GET",path:"/users/by-handle/:handle",pathParams:e.object({handle:yr}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:tc,404:l},summary:"Resolve a public profile by handle \u2014 same shape as GET /users/:id but keyed on the user's chosen handle."},listUserActivity:{method:"GET",path:"/users/:id/activity",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),query:e.object({limit:e.coerce.number().int().positive().max(100).optional()}),responses:{200:Qi,404:l},summary:"Reverse-chronological activity feed for a user, scoped to what the viewer can see (same visibility rules as listThreads)."},getUserContributions:{method:"GET",path:"/users/:id/contributions",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:Mi,404:l},summary:"Daily contribution counts for the trailing 365 days \u2014 counts thread blocks the user authored on threads visible to the viewer."},listUserFollowers:{method:"GET",path:"/users/:id/followers",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:fr,404:l},summary:"List the users following a given user."},listUserFollowing:{method:"GET",path:"/users/:id/following",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:fr,404:l},summary:"List the users a given user is following."},followUser:{method:"POST",path:"/users/:id/follow",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{200:$i,401:l,404:l,409:l,422:l},summary:"Follow another user. Idempotent \u2014 repeating the call is a no-op."},unfollowUser:{method:"DELETE",path:"/users/:id/follow",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{200:Di,401:l,404:l},summary:"Unfollow a user. Idempotent \u2014 repeating the call is a no-op."},listProfilePublishedProjects:{method:"GET",path:"/users/:id/projects",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:Ji,404:l},summary:"Projects the user has published to their public profile."},publishProject:{method:"POST",path:"/projects/:id/publish",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{200:gr,401:l,403:l,404:l},summary:"Publish a project to the author's public profile. Stamps published_at with `now()`. Author-only."},unpublishProject:{method:"DELETE",path:"/projects/:id/publish",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{200:gr,401:l,403:l,404:l},summary:"Remove a project from the author's public profile."},uploadProfileImage:{method:"POST",path:"/users/me/profile-image",headers:e.object({authorization:e.string().min(1).optional()}),body:Xi,responses:{200:ec,401:l,413:l,422:l},summary:"Upload an avatar or banner image (base64-encoded JSON body). The API streams the bytes to its configured storage substrate using its own credentials and returns the canonical storage URL the client passes to PATCH /users/me."},listOrganizationMembers:{method:"GET",path:"/organization/members",headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:Na,401:l},summary:"List members of the authenticated user\u2019s organization"},createOrganizationInvite:{method:"POST",path:"/organization/invites",headers:e.object({authorization:e.string().min(1).optional()}),body:Ua,responses:{201:Ba,401:l,403:l,409:l,422:l},summary:"Invite a teammate to the authenticated user\u2019s workspace via Stytch B2B"},listRepositories:{method:"GET",path:"/repositories",headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:bo,401:l,403:l},summary:"List repositories known to the authenticated user\u2019s organization across threads and building blocks"},createBuildingBlockSnapshots:{method:"POST",path:"/building_blocks",headers:e.object({authorization:e.string().min(1).optional()}),body:Za,responses:{201:uo,401:l,403:l},summary:"Create building block snapshots for the authenticated user\u2019s organization"},getPlan:{method:"GET",path:"/plans/:id",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:lo,401:l,403:l,404:l},summary:"Load a thread-backed plan container visible to the authenticated user, including all visible plan revisions in that thread"},createPlanCommentThread:{method:"POST",path:"/plans/:id/comment-threads",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:Ja,responses:{201:Ka,401:l,403:l,404:l,422:l},summary:"Create a new inline comment thread on a specific revision inside a thread-backed plan container"},createPlanComment:{method:"POST",path:"/plans/:id/comment-threads/:threadId/comments",pathParams:e.object({id:e.string().min(1),threadId:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:eo,responses:{201:to,401:l,403:l,404:l,409:l},summary:"Reply to an inline comment thread on a thread-backed plan container"},updatePlanCommentThread:{method:"PATCH",path:"/plans/:id/comment-threads/:threadId",pathParams:e.object({id:e.string().min(1),threadId:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:so,responses:{200:ao,401:l,403:l,404:l},summary:"Resolve or reopen an inline comment thread on a thread-backed plan container"},listPlans:{method:"GET",path:"/plans",headers:e.object({authorization:e.string().min(1).optional()}),query:mo,responses:{200:po,401:l,403:l},summary:"List thread-backed plan containers visible to the authenticated user in their organization, ordered by latest visible revision and optionally filtered by author or repository"},listBuildingBlockSnapshots:{method:"GET",path:"/building_blocks",headers:e.object({authorization:e.string().min(1).optional()}),query:fo,responses:{200:ho,401:l,403:l},summary:"List building block snapshots for the authenticated user\u2019s organization and repo origin path"},listUploadSessions:{method:"GET",path:"/upload_sessions",headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:Xo,401:l},summary:"List recent upload sessions for the authenticated user"},createUploadSession:{method:"POST",path:"/upload_sessions",headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({thread_files:e.array(xo).nonempty()}),responses:{201:Vo,400:l,401:l},summary:"Create an upload session with presigned URLs for file uploads"},completeUploadSession:{method:"POST",path:"/upload_sessions/:id/complete",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({thread_files:e.array($o).nonempty()}),responses:{200:qo,400:l,401:l,404:l,409:l,422:l},summary:"Complete an upload session after files have been uploaded to storage"},adminStats:{method:"GET",path:"/admin/stats",headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:pi,401:l,403:l},summary:"Cross-org operational counts. Tanagram admins only."},adminListOrganizations:{method:"GET",path:"/admin/organizations",headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:ui,401:l,403:l},summary:"List every organization with member and thread counts. Tanagram admins only."},adminListUsers:{method:"GET",path:"/admin/users",headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:fi,401:l,403:l},summary:"List every user with their org memberships and thread count. Tanagram admins only."},adminListThreads:{method:"GET",path:"/admin/threads",headers:e.object({authorization:e.string().min(1).optional()}),query:bi,responses:{200:yi,401:l,403:l},summary:"List live threads across every organization. Tanagram admins only."},adminHardDeleteThread:{method:"DELETE",path:"/admin/threads/:id",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{204:e.null(),401:l,403:l,404:l},summary:"Permanently remove a thread. Tanagram admins only."},listDiscoverThreads:{method:"GET",path:"/discover/threads",headers:e.object({authorization:e.string().min(1).optional()}),query:Jo,responses:{200:Wo},summary:"Feed of public threads with sort, harness filter, search, and cursor pagination. Auth is optional and populates viewer_vote."},discoverStats:{method:"GET",path:"/discover/stats",responses:{200:Ko},summary:"Unauthenticated rollup of public-thread counts for the Discover header."},createWaitlistEntry:{method:"POST",path:"/waitlist_entries",body:$a,responses:{201:Da,409:l},summary:"Create an unauthenticated waitlist entry keyed by (location, contact)."},createShareToken:{method:"POST",path:"/threads/:id/share-token",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({}).optional(),responses:{201:ur,401:l,403:l,404:l,409:l},summary:"Mint a short share-link token for a public thread. Author only. The token powers `/s/:token` short URLs and enables k-factor attribution."},resolveShareToken:{method:"GET",path:"/referrals/resolve/:token",pathParams:e.object({token:e.string().min(1).max(16)}),query:_i,responses:{200:ur,404:l},summary:"Resolve a share-link token to its thread and record the view. Unauthenticated by design."},adminGrowth:{method:"GET",path:"/admin/growth",headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:Si,401:l,403:l},summary:"Share-link k-factor, funnel, sparkline, and top sharers by window. Tanagram admins only."},adminRunCritiquePlayground:{method:"POST",path:"/admin/critique-playground/run",headers:e.object({authorization:e.string().min(1).optional()}),body:wi,responses:{200:Ri,401:l,403:l,409:l},summary:"Admin-only critique playground that saves markdown to a file:// plan artifact and returns parsed + critiqued plan blocks."},getBillingState:{method:"GET",path:"/billing/state",headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:Ci,401:l},summary:"Resolve the caller's plan, features, seat count, and any admin override."},createBillingCheckout:{method:"POST",path:"/billing/checkout",headers:e.object({authorization:e.string().min(1).optional()}),body:Pi,responses:{200:zi,400:l,401:l,403:l,503:l},summary:"Start a Stripe Checkout session for Creator ($29/mo) or Team ($19/seat/mo, min 2)."},createBillingPortal:{method:"POST",path:"/billing/portal",headers:e.object({authorization:e.string().min(1).optional()}),body:e.object({subject_type:e.enum(["user","organization"]).default("user")}).optional(),responses:{200:Ai,401:l,404:l,503:l},summary:"Open the Stripe customer portal so the subject can manage their subscription."},updateTeamSeats:{method:"PATCH",path:"/billing/team-seats",headers:e.object({authorization:e.string().min(1).optional()}),body:Ei,responses:{200:Ct,400:l,401:l,403:l,404:l,503:l},summary:"Adjust the caller-organization's Team seat quantity (admin of that org only)."},adminListBilling:{method:"GET",path:"/admin/billing",headers:e.object({authorization:e.string().min(1).optional()}),responses:{200:Oi,401:l,403:l},summary:"List every user and org with current plan + override for the admin panel."},adminSetUserPlanOverride:{method:"PUT",path:"/admin/billing/users/:id/override",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:hr,responses:{200:ct,401:l,403:l,404:l},summary:"Admin override for a user's plan tier. Null clears the override."},adminSetOrganizationPlanOverride:{method:"PUT",path:"/admin/billing/organizations/:id/override",pathParams:e.object({id:e.string().min(1)}),headers:e.object({authorization:e.string().min(1).optional()}),body:hr,responses:{200:ct,401:l,403:l,404:l},summary:"Admin override for an organization's plan tier. Null clears the override."},projects:or,docs:sr,mentions:ir,favorites:lr},{pathPrefix:"/api"});import Fe from"node:fs";import Lr from"node:path";import sc from"node:os";import Ir from"node:path";var rc="prod",Ar="0.1.7",nc=`@tanagram/lore/${Ar}`;function L(){return rc}function Er(){return Ar}function Or(){return nc}function Ve(){let r=L()==="dev"?".lore-dev":".lore";return Ir.join(sc.homedir(),r)}function dt(){return Ir.join(Ve(),"log.txt")}function pt(){return Lr.join(Ve(),"token")}function zt(){let r;try{r=Fe.readFileSync(pt(),"utf8")}catch(n){if(n&&typeof n=="object"&&"code"in n&&n.code==="ENOENT")return{token:"",source:"none"};throw n}let t=r.trim();return!t||oc(t,new Date)?{token:"",source:"none"}:{token:t,source:"file"}}function Nr(){return zt().token}function Ur(){return Fe.existsSync(pt())}function Br(r){let t=pt();Fe.mkdirSync(Lr.dirname(t),{recursive:!0,mode:448}),Fe.writeFileSync(t,r,{mode:384})}function $r(){try{Fe.rmSync(pt())}catch(r){if(r&&typeof r=="object"&&"code"in r&&r.code==="ENOENT")return;throw r}}function ac(r){let t=r.split(".");if(t.length<2)throw new Error("invalid JWT format");return JSON.parse(Buffer.from(t[1],"base64url").toString("utf8"))}function oc(r,t){let n;try{n=ac(r)}catch{return!1}let s=n["https://stytch.com/session"]?.expires_at;if(typeof s!="string")return!1;let a=Date.parse(s.trim());return Number.isNaN(a)?!1:t.getTime()>=a}var ic={dev:"http://localhost:4000",prod:"https://lore.tanagram.ai"};function Ue(r={}){let t=r.token??Nr();return xt(zr,{baseUrl:ic[L()],baseHeaders:{"User-Agent":Or(),...t?{authorization:`Bearer ${t}`}:{}}})}import qr from"node:fs";var Dr=!1;function cc(){Dr||(qr.mkdirSync(Ve(),{recursive:!0}),Dr=!0)}function lc(r){let t=typeof r=="string"?r:JSON.stringify(r);return/[\s"=]/.test(t)?JSON.stringify(t):t}function dc(r,t,n){let s=`${new Date().toISOString()} ${r} ${t}`;if(!n)return`${s}
5
- `;let a=Object.entries(n).map(([o,c])=>`${o}=${lc(c)}`).join(" ");return a?`${s} ${a}
6
- `:`${s}
7
- `}function At(r,t,n){let s=dc(r,t,n);cc(),qr.appendFileSync(dt(),s),L()==="dev"&&process.stderr.write(s)}var I={info(r,t){At("info",r,t)},warn(r,t){At("warn",r,t)},error(r,t){At("error",r,t)}};var Mr={meta:{name:"health",description:"Check API health"},async run({data:r}){I.info("command_start",{command:"health"});let n=await(r?.client??Ue()).health();if(n.status===200){console.log(n.body.status);return}throw I.error("health_failed",{status:n.status}),console.error(`health check failed: HTTP ${n.status}`),new Error(`health check failed: HTTP ${n.status}`)}};var Vr={meta:{name:"hello",description:"Print a friendly greeting"},run(){I.info("command_start",{command:"hello"}),console.log("hello world")}};import{spawn as mc}from"node:child_process";import Gr from"node:crypto";import uc from"node:http";var pc={dev:"http://localhost:8080",prod:"https://lore.tanagram.ai"};function Fr(){return pc[L()]}var hc=5*60*1e3;function fc(){return Gr.randomBytes(32).toString("base64url")}function gc(r){return Gr.createHash("sha256").update(r).digest("base64url")}function yc(r){let t;try{t=JSON.parse(Buffer.from(r.trim(),"base64url").toString("utf8"))}catch(n){throw new Error(`decoding: ${n instanceof Error?n.message:String(n)}`)}if(typeof t.session_jwt!="string"||!t.session_jwt)throw new Error("missing session token");if(typeof t.code_challenge!="string"||!t.code_challenge)throw new Error("missing code challenge");return{sessionJwt:t.session_jwt,codeChallenge:t.code_challenge}}function bc(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Zr(r,t,n){let s=t==="success";r.writeHead(200,{"Content-Type":"text/html"}),r.end(`<!DOCTYPE html>
2
+ var G9=Object.create;var o_=Object.defineProperty;var B9=Object.getOwnPropertyDescriptor;var j9=Object.getOwnPropertyNames;var H9=Object.getPrototypeOf,F9=Object.prototype.hasOwnProperty;var U=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var z=(t,e)=>()=>(t&&(e=t(t=0)),e);var E=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),sg=(t,e)=>{for(var n in e)o_(t,n,{get:e[n],enumerable:!0})},kC=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of j9(e))!F9.call(t,o)&&o!==n&&o_(t,o,{get:()=>e[o],enumerable:!(r=B9(e,o))||r.enumerable});return t};var K=(t,e,n)=>(n=t!=null?G9(H9(t)):{},kC(e||!t||!t.__esModule?o_(n,"default",{value:t,enumerable:!0}):n,t)),O=t=>kC(o_({},"__esModule",{value:!0}),t);var Oo,ig=z(()=>{Oo="1.9.1"});function V9(t){let e=new Set([t]),n=new Set,r=t.match(GC);if(!r)return()=>!1;let o={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(o.prerelease!=null)return function(c){return c===t};function s(a){return n.add(a),!1}function i(a){return e.add(a),!0}return function(c){if(e.has(c))return!0;if(n.has(c))return!1;let l=c.match(GC);if(!l)return s(c);let p={major:+l[1],minor:+l[2],patch:+l[3],prerelease:l[4]};return p.prerelease!=null||o.major!==p.major?s(c):o.major===0?o.minor===p.minor&&o.patch<=p.patch?i(c):s(c):o.minor<=p.minor?i(c):s(c)}}var GC,BC,jC=z(()=>{ig();GC=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;BC=V9(Oo)});function jr(t,e,n,r=!1){var o;let s=Sl[El]=(o=Sl[El])!==null&&o!==void 0?o:{version:Oo};if(!r&&s[t]){let i=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${t}`);return n.error(i.stack||i.message),!1}if(s.version!==Oo){let i=new Error(`@opentelemetry/api: Registration of version v${s.version} for ${t} does not match previously registered API v${Oo}`);return n.error(i.stack||i.message),!1}return s[t]=e,n.debug(`@opentelemetry/api: Registered a global for ${t} v${Oo}.`),!0}function Dn(t){var e,n;let r=(e=Sl[El])===null||e===void 0?void 0:e.version;if(!(!r||!BC(r)))return(n=Sl[El])===null||n===void 0?void 0:n[t]}function Hr(t,e){e.debug(`@opentelemetry/api: Unregistering a global for ${t} v${Oo}.`);let n=Sl[El];n&&delete n[t]}var q9,El,Sl,Ii=z(()=>{ig();jC();q9=Oo.split(".")[0],El=Symbol.for(`opentelemetry.js.api.${q9}`),Sl=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{}});function gl(t,e,n){let r=Dn("diag");if(r)return r[t](e,...n)}var s_,HC=z(()=>{Ii();s_=class{constructor(e){this._namespace=e.namespace||"DiagComponentLogger"}debug(...e){return gl("debug",this._namespace,e)}error(...e){return gl("error",this._namespace,e)}info(...e){return gl("info",this._namespace,e)}warn(...e){return gl("warn",this._namespace,e)}verbose(...e){return gl("verbose",this._namespace,e)}}});var dt,i_=z(()=>{(function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"})(dt||(dt={}))});function FC(t,e){t<dt.NONE?t=dt.NONE:t>dt.ALL&&(t=dt.ALL),e=e||{};function n(r,o){let s=e[r];return typeof s=="function"&&t>=o?s.bind(e):function(){}}return{error:n("error",dt.ERROR),warn:n("warn",dt.WARN),info:n("info",dt.INFO),debug:n("debug",dt.DEBUG),verbose:n("verbose",dt.VERBOSE)}}var VC=z(()=>{i_()});var $9,St,Oi=z(()=>{HC();VC();i_();Ii();$9="diag",St=class t{static instance(){return this._instance||(this._instance=new t),this._instance}constructor(){function e(o){return function(...s){let i=Dn("diag");if(i)return i[o](...s)}}let n=this,r=(o,s={logLevel:dt.INFO})=>{var i,a,c;if(o===n){let d=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return n.error((i=d.stack)!==null&&i!==void 0?i:d.message),!1}typeof s=="number"&&(s={logLevel:s});let l=Dn("diag"),p=FC((a=s.logLevel)!==null&&a!==void 0?a:dt.INFO,o);if(l&&!s.suppressOverrideMessage){let d=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";l.warn(`Current logger will be overwritten from ${d}`),p.warn(`Current logger will overwrite one already registered from ${d}`)}return jr("diag",p,n,!0)};n.setLogger=r,n.disable=()=>{Hr($9,n)},n.createComponentLogger=o=>new s_(o),n.verbose=e("verbose"),n.debug=e("debug"),n.info=e("info"),n.warn=e("warn"),n.error=e("error")}}});var a_,qC=z(()=>{a_=class t{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let n=this._entries.get(e);if(n)return Object.assign({},n)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(e,n){let r=new t(this._entries);return r._entries.set(e,n),r}removeEntry(e){let n=new t(this._entries);return n._entries.delete(e),n}removeEntries(...e){let n=new t(this._entries);for(let r of e)n._entries.delete(r);return n}clear(){return new t}}});var $C,YC=z(()=>{$C=Symbol("BaggageEntryMetadata")});function WC(t={}){return new a_(new Map(Object.entries(t)))}function zC(t){return typeof t!="string"&&(Y9.error(`Cannot create baggage metadata from unknown type: ${typeof t}`),t=""),{__TYPE__:$C,toString(){return t}}}var Y9,ag=z(()=>{Oi();qC();YC();Y9=St.instance()});function Un(t){return Symbol.for(t)}var cg,Wa,Al=z(()=>{cg=class t{constructor(e){let n=this;n._currentContext=e?new Map(e):new Map,n.getValue=r=>n._currentContext.get(r),n.setValue=(r,o)=>{let s=new t(n._currentContext);return s._currentContext.set(r,o),s},n.deleteValue=r=>{let o=new t(n._currentContext);return o._currentContext.delete(r),o}}},Wa=new cg});var ug,lg,c_,KC=z(()=>{ug=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],lg={};if(typeof console<"u"){let t=["error","warn","info","debug","trace","log"];for(let e of t)typeof console[e]=="function"&&(lg[e]=console[e])}c_=class{constructor(){function e(n){return function(...r){let o=lg[n];if(typeof o!="function"&&(o=lg.log),typeof o!="function"&&console&&(o=console[n],typeof o!="function"&&(o=console.log)),typeof o=="function")return o.apply(console,r)}}for(let n=0;n<ug.length;n++)this[ug[n].n]=e(ug[n].c)}}});function QC(){return Sg}var pg,za,dg,_g,fg,mg,Rl,hg,Tg,Eg,Sg,W9,z9,K9,Q9,X9,J9,Z9,gg=z(()=>{pg=class{constructor(){}createGauge(e,n){return z9}createHistogram(e,n){return K9}createCounter(e,n){return W9}createUpDownCounter(e,n){return Q9}createObservableGauge(e,n){return J9}createObservableCounter(e,n){return X9}createObservableUpDownCounter(e,n){return Z9}addBatchObservableCallback(e,n){}removeBatchObservableCallback(e){}},za=class{},dg=class extends za{add(e,n){}},_g=class extends za{add(e,n){}},fg=class extends za{record(e,n){}},mg=class extends za{record(e,n){}},Rl=class{addCallback(e){}removeCallback(e){}},hg=class extends Rl{},Tg=class extends Rl{},Eg=class extends Rl{},Sg=new pg,W9=new dg,z9=new fg,K9=new mg,Q9=new _g,X9=new hg,J9=new Tg,Z9=new Eg});var u_,XC=z(()=>{(function(t){t[t.INT=0]="INT",t[t.DOUBLE=1]="DOUBLE"})(u_||(u_={}))});var l_,p_,Ag=z(()=>{l_={get(t,e){if(t!=null)return t[e]},keys(t){return t==null?[]:Object.keys(t)}},p_={set(t,e,n){t!=null&&(t[e]=n)}}});var d_,JC=z(()=>{Al();d_=class{active(){return Wa}with(e,n,r,...o){return n.call(r,...o)}bind(e,n){return n}enable(){return this}disable(){return this}}});var Rg,eQ,Fr,yl=z(()=>{JC();Ii();Oi();Rg="context",eQ=new d_,Fr=class t{constructor(){}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalContextManager(e){return jr(Rg,e,St.instance())}active(){return this._getContextManager().active()}with(e,n,r,...o){return this._getContextManager().with(e,n,r,...o)}bind(e,n){return this._getContextManager().bind(e,n)}_getContextManager(){return Dn(Rg)||eQ}disable(){this._getContextManager().disable(),Hr(Rg,St.instance())}}});var Vt,yg=z(()=>{(function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"})(Vt||(Vt={}))});var Il,Ni,__,f_=z(()=>{yg();Il="0000000000000000",Ni="00000000000000000000000000000000",__={traceId:Ni,spanId:Il,traceFlags:Vt.NONE}});var Vr,m_=z(()=>{f_();Vr=class{constructor(e=__){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,n){return this}setAttributes(e){return this}addEvent(e,n){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,n){}}});function h_(t){return t.getValue(Ig)||void 0}function ZC(){return h_(Fr.getInstance().active())}function Ol(t,e){return t.setValue(Ig,e)}function eP(t){return t.deleteValue(Ig)}function tP(t,e){return Ol(t,new Vr(e))}function T_(t){var e;return(e=h_(t))===null||e===void 0?void 0:e.spanContext()}var Ig,Og=z(()=>{Al();m_();yl();Ig=Un("OpenTelemetry Context Key SPAN")});function nP(t,e){if(typeof t!="string"||t.length!==e)return!1;let n=0;for(let r=0;r<t.length;r+=4)n+=(E_[t.charCodeAt(r)]|0)+(E_[t.charCodeAt(r+1)]|0)+(E_[t.charCodeAt(r+2)]|0)+(E_[t.charCodeAt(r+3)]|0);return n===e}function Ng(t){return nP(t,32)&&t!==Ni}function bg(t){return nP(t,16)&&t!==Il}function No(t){return Ng(t.traceId)&&bg(t.spanId)}function rP(t){return new Vr(t)}var E_,S_=z(()=>{f_();m_();E_=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1])});function tQ(t){return t!==null&&typeof t=="object"&&"spanId"in t&&typeof t.spanId=="string"&&"traceId"in t&&typeof t.traceId=="string"&&"traceFlags"in t&&typeof t.traceFlags=="number"}var Cg,Ka,Pg=z(()=>{yl();Og();m_();S_();Cg=Fr.getInstance(),Ka=class{startSpan(e,n,r=Cg.active()){if(!!n?.root)return new Vr;let s=r&&T_(r);return tQ(s)&&No(s)?new Vr(s):new Vr}startActiveSpan(e,n,r,o){let s,i,a;if(arguments.length<2)return;arguments.length===2?a=n:arguments.length===3?(s=n,a=r):(s=n,i=r,a=o);let c=i??Cg.active(),l=this.startSpan(e,s,c),p=Ol(c,l);return Cg.with(p,a,void 0,l)}}});var nQ,Qa,Mg=z(()=>{Pg();nQ=new Ka,Qa=class{constructor(e,n,r,o){this._provider=e,this.name=n,this.version=r,this.options=o}startSpan(e,n,r){return this._getTracer().startSpan(e,n,r)}startActiveSpan(e,n,r,o){let s=this._getTracer();return Reflect.apply(s.startActiveSpan,s,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):nQ}}});var g_,oP=z(()=>{Pg();g_=class{getTracer(e,n,r){return new Ka}}});var rQ,bi,xg=z(()=>{Mg();oP();rQ=new g_,bi=class{getTracer(e,n,r){var o;return(o=this.getDelegateTracer(e,n,r))!==null&&o!==void 0?o:new Qa(this,e,n,r)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:rQ}setDelegate(e){this._delegate=e}getDelegateTracer(e,n,r){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getTracer(e,n,r)}}});var A_,sP=z(()=>{(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(A_||(A_={}))});var Ne,iP=z(()=>{(function(t){t[t.INTERNAL=0]="INTERNAL",t[t.SERVER=1]="SERVER",t[t.CLIENT=2]="CLIENT",t[t.PRODUCER=3]="PRODUCER",t[t.CONSUMER=4]="CONSUMER"})(Ne||(Ne={}))});var Be,aP=z(()=>{(function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"})(Be||(Be={}))});function cP(t){return iQ.test(t)}function uP(t){return aQ.test(t)&&!cQ.test(t)}var vg,oQ,sQ,iQ,aQ,cQ,lP=z(()=>{vg="[_0-9a-z-*/]",oQ=`[a-z]${vg}{0,255}`,sQ=`[a-z0-9]${vg}{0,240}@[a-z]${vg}{0,13}`,iQ=new RegExp(`^(?:${oQ}|${sQ})$`),aQ=/^[ -~]{0,255}[!-~]$/,cQ=/,|=/});var pP,uQ,dP,_P,R_,fP=z(()=>{lP();pP=32,uQ=512,dP=",",_P="=",R_=class t{constructor(e){this._internalState=new Map,e&&this._parse(e)}set(e,n){let r=this._clone();return r._internalState.has(e)&&r._internalState.delete(e),r._internalState.set(e,n),r}unset(e){let n=this._clone();return n._internalState.delete(e),n}get(e){return this._internalState.get(e)}serialize(){return Array.from(this._internalState.keys()).reduceRight((e,n)=>(e.push(n+_P+this.get(n)),e),[]).join(dP)}_parse(e){e.length>uQ||(this._internalState=e.split(dP).reduceRight((n,r)=>{let o=r.trim(),s=o.indexOf(_P);if(s!==-1){let i=o.slice(0,s),a=o.slice(s+1,r.length);cP(i)&&uP(a)&&n.set(i,a)}return n},new Map),this._internalState.size>pP&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,pP))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}}});function mP(t){return new R_(t)}var hP=z(()=>{fP()});var P,TP=z(()=>{yl();P=Fr.getInstance()});var wn,EP=z(()=>{Oi();wn=St.instance()});var Lg,SP,gP=z(()=>{gg();Lg=class{getMeter(e,n,r){return Sg}},SP=new Lg});var Dg,y_,AP=z(()=>{gP();Ii();Oi();Dg="metrics",y_=class t{constructor(){}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalMeterProvider(e){return jr(Dg,e,St.instance())}getMeterProvider(){return Dn(Dg)||SP}getMeter(e,n,r){return this.getMeterProvider().getMeter(e,n,r)}disable(){Hr(Dg,St.instance())}}});var Ug,RP=z(()=>{AP();Ug=y_.getInstance()});var I_,yP=z(()=>{I_=class{inject(e,n){}extract(e,n){return e}fields(){return[]}}});function kg(t){return t.getValue(wg)||void 0}function IP(){return kg(Fr.getInstance().active())}function OP(t,e){return t.setValue(wg,e)}function NP(t){return t.deleteValue(wg)}var wg,bP=z(()=>{yl();Al();wg=Un("OpenTelemetry Baggage Key")});var Gg,lQ,O_,CP=z(()=>{Ii();yP();Ag();bP();ag();Oi();Gg="propagation",lQ=new I_,O_=class t{constructor(){this.createBaggage=WC,this.getBaggage=kg,this.getActiveBaggage=IP,this.setBaggage=OP,this.deleteBaggage=NP}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalPropagator(e){return jr(Gg,e,St.instance())}inject(e,n,r=p_){return this._getGlobalPropagator().inject(e,n,r)}extract(e,n,r=l_){return this._getGlobalPropagator().extract(e,n,r)}fields(){return this._getGlobalPropagator().fields()}disable(){Hr(Gg,St.instance())}_getGlobalPropagator(){return Dn(Gg)||lQ}}});var Ar,PP=z(()=>{CP();Ar=O_.getInstance()});var Bg,N_,MP=z(()=>{Ii();xg();S_();Og();Oi();Bg="trace",N_=class t{constructor(){this._proxyTracerProvider=new bi,this.wrapSpanContext=rP,this.isSpanContextValid=No,this.deleteSpan=eP,this.getSpan=h_,this.getActiveSpan=ZC,this.getSpanContext=T_,this.setSpan=Ol,this.setSpanContext=tP}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalTracerProvider(e){let n=jr(Bg,this._proxyTracerProvider,St.instance());return n&&this._proxyTracerProvider.setDelegate(e),n}getTracerProvider(){return Dn(Bg)||this._proxyTracerProvider}getTracer(e,n){return this.getTracerProvider().getTracer(e,n)}disable(){Hr(Bg,St.instance()),this._proxyTracerProvider=new bi}}});var X,xP=z(()=>{MP();X=N_.getInstance()});var v={};sg(v,{DiagConsoleLogger:()=>c_,DiagLogLevel:()=>dt,INVALID_SPANID:()=>Il,INVALID_SPAN_CONTEXT:()=>__,INVALID_TRACEID:()=>Ni,ProxyTracer:()=>Qa,ProxyTracerProvider:()=>bi,ROOT_CONTEXT:()=>Wa,SamplingDecision:()=>A_,SpanKind:()=>Ne,SpanStatusCode:()=>Be,TraceFlags:()=>Vt,ValueType:()=>u_,baggageEntryMetadataFromString:()=>zC,context:()=>P,createContextKey:()=>Un,createNoopMeter:()=>QC,createTraceState:()=>mP,default:()=>pQ,defaultTextMapGetter:()=>l_,defaultTextMapSetter:()=>p_,diag:()=>wn,isSpanContextValid:()=>No,isValidSpanId:()=>bg,isValidTraceId:()=>Ng,metrics:()=>Ug,propagation:()=>Ar,trace:()=>X});var pQ,b=z(()=>{ag();Al();KC();i_();gg();XC();Ag();Mg();xg();sP();iP();aP();yg();hP();S_();f_();TP();EP();RP();PP();xP();pQ={context:P,diag:wn,metrics:Ug,propagation:Ar,trace:X}});var Nl=E(is=>{"use strict";Object.defineProperty(is,"__esModule",{value:!0});is.isTracingSuppressed=is.unsuppressTracing=is.suppressTracing=void 0;var dQ=(b(),O(v)),jg=(0,dQ.createContextKey)("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function _Q(t){return t.setValue(jg,!0)}is.suppressTracing=_Q;function fQ(t){return t.deleteValue(jg)}is.unsuppressTracing=fQ;function mQ(t){return t.getValue(jg)===!0}is.isTracingSuppressed=mQ});var Hg=E(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.BAGGAGE_MAX_TOTAL_LENGTH=qt.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=qt.BAGGAGE_MAX_NAME_VALUE_PAIRS=qt.BAGGAGE_HEADER=qt.BAGGAGE_ITEMS_SEPARATOR=qt.BAGGAGE_PROPERTIES_SEPARATOR=qt.BAGGAGE_KEY_PAIR_SEPARATOR=void 0;qt.BAGGAGE_KEY_PAIR_SEPARATOR="=";qt.BAGGAGE_PROPERTIES_SEPARATOR=";";qt.BAGGAGE_ITEMS_SEPARATOR=",";qt.BAGGAGE_HEADER="baggage";qt.BAGGAGE_MAX_NAME_VALUE_PAIRS=180;qt.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096;qt.BAGGAGE_MAX_TOTAL_LENGTH=8192});var Fg=E(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});qr.parseKeyPairsIntoRecord=qr.parsePairKeyValue=qr.getKeyPairs=qr.serializeKeyPairs=void 0;var hQ=(b(),O(v)),Xa=Hg();function TQ(t){return t.reduce((e,n)=>{let r=`${e}${e!==""?Xa.BAGGAGE_ITEMS_SEPARATOR:""}${n}`;return r.length>Xa.BAGGAGE_MAX_TOTAL_LENGTH?e:r},"")}qr.serializeKeyPairs=TQ;function EQ(t){return t.getAllEntries().map(([e,n])=>{let r=`${encodeURIComponent(e)}=${encodeURIComponent(n.value)}`;return n.metadata!==void 0&&(r+=Xa.BAGGAGE_PROPERTIES_SEPARATOR+n.metadata.toString()),r})}qr.getKeyPairs=EQ;function vP(t){if(!t)return;let e=t.indexOf(Xa.BAGGAGE_PROPERTIES_SEPARATOR),n=e===-1?t:t.substring(0,e),r=n.indexOf(Xa.BAGGAGE_KEY_PAIR_SEPARATOR);if(r<=0)return;let o=n.substring(0,r).trim(),s=n.substring(r+1).trim();if(!o||!s)return;let i,a;try{i=decodeURIComponent(o),a=decodeURIComponent(s)}catch{return}let c;if(e!==-1&&e<t.length-1){let l=t.substring(e+1);c=(0,hQ.baggageEntryMetadataFromString)(l)}return{key:i,value:a,metadata:c}}qr.parsePairKeyValue=vP;function SQ(t){let e={};return typeof t=="string"&&t.length>0&&t.split(Xa.BAGGAGE_ITEMS_SEPARATOR).forEach(n=>{let r=vP(n);r!==void 0&&r.value.length>0&&(e[r.key]=r.value)}),e}qr.parseKeyPairsIntoRecord=SQ});var LP=E(b_=>{"use strict";Object.defineProperty(b_,"__esModule",{value:!0});b_.W3CBaggagePropagator=void 0;var Vg=(b(),O(v)),gQ=Nl(),Ci=Hg(),qg=Fg(),$g=class{inject(e,n,r){let o=Vg.propagation.getBaggage(e);if(!o||(0,gQ.isTracingSuppressed)(e))return;let s=(0,qg.getKeyPairs)(o).filter(a=>a.length<=Ci.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,Ci.BAGGAGE_MAX_NAME_VALUE_PAIRS),i=(0,qg.serializeKeyPairs)(s);i.length>0&&r.set(n,Ci.BAGGAGE_HEADER,i)}extract(e,n,r){let o=r.get(n,Ci.BAGGAGE_HEADER),s=Array.isArray(o)?o.join(Ci.BAGGAGE_ITEMS_SEPARATOR):o;if(!s)return e;let i={};return s.length===0||(s.split(Ci.BAGGAGE_ITEMS_SEPARATOR).forEach(c=>{let l=(0,qg.parsePairKeyValue)(c);if(l){let p={value:l.value};l.metadata&&(p.metadata=l.metadata),i[l.key]=p}}),Object.entries(i).length===0)?e:Vg.propagation.setBaggage(e,Vg.propagation.createBaggage(i))}fields(){return[Ci.BAGGAGE_HEADER]}};b_.W3CBaggagePropagator=$g});var DP=E(C_=>{"use strict";Object.defineProperty(C_,"__esModule",{value:!0});C_.AnchoredClock=void 0;var Yg=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(e,n){this._monotonicClock=n,this._epochMillis=e.now(),this._performanceMillis=n.now()}now(){let e=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+e}};C_.AnchoredClock=Yg});var BP=E(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0});as.isAttributeValue=as.isAttributeKey=as.sanitizeAttributes=void 0;var UP=(b(),O(v));function AQ(t){let e={};if(typeof t!="object"||t==null)return e;for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;if(!wP(n)){UP.diag.warn(`Invalid attribute key: ${n}`);continue}let r=t[n];if(!kP(r)){UP.diag.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?e[n]=r.slice():e[n]=r}return e}as.sanitizeAttributes=AQ;function wP(t){return typeof t=="string"&&t!==""}as.isAttributeKey=wP;function kP(t){return t==null?!0:Array.isArray(t)?RQ(t):GP(typeof t)}as.isAttributeValue=kP;function RQ(t){let e;for(let n of t){if(n==null)continue;let r=typeof n;if(r!==e){if(!e){if(GP(r)){e=r;continue}return!1}return!1}}return!0}function GP(t){switch(t){case"number":case"boolean":case"string":return!0}return!1}});var Wg=E(P_=>{"use strict";Object.defineProperty(P_,"__esModule",{value:!0});P_.loggingErrorHandler=void 0;var yQ=(b(),O(v));function IQ(){return t=>{yQ.diag.error(OQ(t))}}P_.loggingErrorHandler=IQ;function OQ(t){return typeof t=="string"?t:JSON.stringify(NQ(t))}function NQ(t){let e={},n=t;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(r=>{if(e[r])return;let o=n[r];o&&(e[r]=String(o))}),n=Object.getPrototypeOf(n);return e}});var HP=E(Ja=>{"use strict";Object.defineProperty(Ja,"__esModule",{value:!0});Ja.globalErrorHandler=Ja.setGlobalErrorHandler=void 0;var bQ=Wg(),jP=(0,bQ.loggingErrorHandler)();function CQ(t){jP=t}Ja.setGlobalErrorHandler=CQ;function PQ(t){try{jP(t)}catch{}}Ja.globalErrorHandler=PQ});var $P=E($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.getStringListFromEnv=$r.getBooleanFromEnv=$r.getStringFromEnv=$r.getNumberFromEnv=void 0;var FP=(b(),O(v)),VP=U("util");function MQ(t){let e=process.env[t];if(e==null||e.trim()==="")return;let n=Number(e);if(isNaN(n)){FP.diag.warn(`Unknown value ${(0,VP.inspect)(e)} for ${t}, expected a number, using defaults`);return}return n}$r.getNumberFromEnv=MQ;function qP(t){let e=process.env[t];if(!(e==null||e.trim()===""))return e}$r.getStringFromEnv=qP;function xQ(t){let e=process.env[t]?.trim().toLowerCase();return e==null||e===""?!1:e==="true"?!0:(e==="false"||FP.diag.warn(`Unknown value ${(0,VP.inspect)(e)} for ${t}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}$r.getBooleanFromEnv=xQ;function vQ(t){return qP(t)?.split(",").map(e=>e.trim()).filter(e=>e!=="")}$r.getStringListFromEnv=vQ});var YP=E(M_=>{"use strict";Object.defineProperty(M_,"__esModule",{value:!0});M_._globalThis=void 0;M_._globalThis=globalThis});var WP=E(x_=>{"use strict";Object.defineProperty(x_,"__esModule",{value:!0});x_.VERSION=void 0;x_.VERSION="2.6.1"});function We(t){let e={},n=t.length;for(let r=0;r<n;r++){let o=t[r];o&&(e[String(o).toUpperCase().replace(/[-.]/g,"_")]=o)}return e}var zg=z(()=>{});var zP,KP,QP,XP,JP,ZP,eM,tM,nM,rM,oM,sM,iM,aM,cM,uM,lM,pM,dM,_M,fM,mM,hM,TM,EM,SM,gM,AM,RM,yM,IM,OM,NM,bM,CM,PM,MM,xM,vM,LM,DM,UM,wM,kM,GM,BM,jM,HM,FM,VM,qM,$M,YM,WM,zM,KM,QM,XM,JM,ZM,ex,tx,nx,rx,ox,sx,ix,ax,cx,ux,lx,px,dx,_x,fx,mx,hx,Tx,Ex,Sx,gx,Ax,Rx,yx,Ix,Ox,Nx,bx,Cx,Px,Mx,xx,vx,Lx,Dx,Ux,wx,kx,Gx,Bx,jx,Hx,Fx,Vx,qx,$x,Yx,Wx,zx,Kx,Qx,Xx,Jx,Zx,ev,tv,nv,rv,ov,sv,iv,av,cv,uv,lv,pv,dv,_v,LQ,Kg,DQ,UQ,wQ,kQ,Qg,GQ,BQ,jQ,HQ,FQ,VQ,qQ,$Q,YQ,WQ,zQ,KQ,QQ,XQ,JQ,ZQ,eX,tX,Xg,nX,rX,oX,sX,iX,aX,cX,uX,lX,pX,dX,_X,Jg,fX,mX,Zg,eA,hX,TX,EX,SX,gX,AX,RX,yX,IX,OX,NX,bX,CX,PX,MX,xX,vX,bl,Za,tA,LX,DX,Pi,UX,wX,kX,GX,nA,rA,BX,oA,jX,HX,FX,VX,qX,$X,YX,WX,zX,KX,QX,XX,JX,ZX,eJ,tJ,nJ,rJ,oJ,sJ,iJ,aJ,cJ,sA,uJ,lJ,pJ,dJ,_J,fJ,mJ,hJ,TJ,EJ,SJ,gJ,AJ,RJ,yJ,IJ,OJ,NJ,bJ,iA,CJ,aA,PJ,MJ,xJ,vJ,LJ,DJ,UJ,wJ,kJ,fv,mv,hv,Tv,Ev,Sv,gv,Av,Rv,yv,Iv,Ov,Nv,bv,Cv,Pv,Mv,xv,vv,Lv,Dv,Uv,wv,kv,Gv,Bv,jv,Hv,Fv,Vv,qv,$v,Yv,Wv,zv,Kv,Qv,Xv,Jv,Zv,eL,tL,nL,rL,oL,sL,iL,GJ,BJ,jJ,HJ,FJ,VJ,qJ,$J,YJ,WJ,zJ,KJ,QJ,XJ,JJ,ZJ,e5,t5,n5,r5,o5,s5,i5,a5,c5,u5,l5,p5,d5,_5,f5,m5,h5,T5,E5,S5,g5,A5,R5,y5,I5,O5,N5,b5,C5,P5,M5,x5,aL,cL,uL,lL,pL,dL,_L,fL,mL,hL,TL,v5,L5,D5,U5,w5,k5,G5,B5,j5,H5,F5,V5,EL,SL,gL,AL,RL,q5,$5,Y5,W5,z5,K5,yL,IL,OL,Q5,X5,J5,Z5,NL,bL,CL,PL,eZ,tZ,nZ,rZ,oZ,ML,xL,vL,LL,DL,UL,wL,sZ,iZ,aZ,cZ,uZ,lZ,pZ,dZ,kL,GL,BL,jL,HL,_Z,fZ,mZ,hZ,TZ,EZ,FL,VL,qL,$L,YL,WL,zL,KL,QL,XL,JL,ZL,e0,t0,n0,r0,o0,s0,i0,a0,c0,SZ,gZ,AZ,RZ,yZ,IZ,OZ,NZ,bZ,CZ,PZ,MZ,xZ,vZ,LZ,DZ,UZ,wZ,kZ,GZ,BZ,jZ,u0,l0,p0,d0,_0,HZ,FZ,VZ,qZ,$Z,YZ,f0,m0,WZ,zZ,KZ,h0,T0,QZ,XZ,JZ,E0,S0,g0,A0,R0,y0,I0,O0,N0,b0,C0,P0,M0,x0,v0,L0,D0,ZZ,e6,t6,n6,r6,o6,s6,i6,a6,c6,u6,l6,p6,d6,_6,f6,m6,h6,U0,w0,T6,E6,S6,k0=z(()=>{zg();zP="aws.lambda.invoked_arn",KP="db.system",QP="db.connection_string",XP="db.user",JP="db.jdbc.driver_classname",ZP="db.name",eM="db.statement",tM="db.operation",nM="db.mssql.instance_name",rM="db.cassandra.keyspace",oM="db.cassandra.page_size",sM="db.cassandra.consistency_level",iM="db.cassandra.table",aM="db.cassandra.idempotence",cM="db.cassandra.speculative_execution_count",uM="db.cassandra.coordinator.id",lM="db.cassandra.coordinator.dc",pM="db.hbase.namespace",dM="db.redis.database_index",_M="db.mongodb.collection",fM="db.sql.table",mM="exception.type",hM="exception.message",TM="exception.stacktrace",EM="exception.escaped",SM="faas.trigger",gM="faas.execution",AM="faas.document.collection",RM="faas.document.operation",yM="faas.document.time",IM="faas.document.name",OM="faas.time",NM="faas.cron",bM="faas.coldstart",CM="faas.invoked_name",PM="faas.invoked_provider",MM="faas.invoked_region",xM="net.transport",vM="net.peer.ip",LM="net.peer.port",DM="net.peer.name",UM="net.host.ip",wM="net.host.port",kM="net.host.name",GM="net.host.connection.type",BM="net.host.connection.subtype",jM="net.host.carrier.name",HM="net.host.carrier.mcc",FM="net.host.carrier.mnc",VM="net.host.carrier.icc",qM="peer.service",$M="enduser.id",YM="enduser.role",WM="enduser.scope",zM="thread.id",KM="thread.name",QM="code.function",XM="code.namespace",JM="code.filepath",ZM="code.lineno",ex="http.method",tx="http.url",nx="http.target",rx="http.host",ox="http.scheme",sx="http.status_code",ix="http.flavor",ax="http.user_agent",cx="http.request_content_length",ux="http.request_content_length_uncompressed",lx="http.response_content_length",px="http.response_content_length_uncompressed",dx="http.server_name",_x="http.route",fx="http.client_ip",mx="aws.dynamodb.table_names",hx="aws.dynamodb.consumed_capacity",Tx="aws.dynamodb.item_collection_metrics",Ex="aws.dynamodb.provisioned_read_capacity",Sx="aws.dynamodb.provisioned_write_capacity",gx="aws.dynamodb.consistent_read",Ax="aws.dynamodb.projection",Rx="aws.dynamodb.limit",yx="aws.dynamodb.attributes_to_get",Ix="aws.dynamodb.index_name",Ox="aws.dynamodb.select",Nx="aws.dynamodb.global_secondary_indexes",bx="aws.dynamodb.local_secondary_indexes",Cx="aws.dynamodb.exclusive_start_table",Px="aws.dynamodb.table_count",Mx="aws.dynamodb.scan_forward",xx="aws.dynamodb.segment",vx="aws.dynamodb.total_segments",Lx="aws.dynamodb.count",Dx="aws.dynamodb.scanned_count",Ux="aws.dynamodb.attribute_definitions",wx="aws.dynamodb.global_secondary_index_updates",kx="messaging.system",Gx="messaging.destination",Bx="messaging.destination_kind",jx="messaging.temp_destination",Hx="messaging.protocol",Fx="messaging.protocol_version",Vx="messaging.url",qx="messaging.message_id",$x="messaging.conversation_id",Yx="messaging.message_payload_size_bytes",Wx="messaging.message_payload_compressed_size_bytes",zx="messaging.operation",Kx="messaging.consumer_id",Qx="messaging.rabbitmq.routing_key",Xx="messaging.kafka.message_key",Jx="messaging.kafka.consumer_group",Zx="messaging.kafka.client_id",ev="messaging.kafka.partition",tv="messaging.kafka.tombstone",nv="rpc.system",rv="rpc.service",ov="rpc.method",sv="rpc.grpc.status_code",iv="rpc.jsonrpc.version",av="rpc.jsonrpc.request_id",cv="rpc.jsonrpc.error_code",uv="rpc.jsonrpc.error_message",lv="message.type",pv="message.id",dv="message.compressed_size",_v="message.uncompressed_size",LQ=zP,Kg=KP,DQ=QP,UQ=XP,wQ=JP,kQ=ZP,Qg=eM,GQ=tM,BQ=nM,jQ=rM,HQ=oM,FQ=sM,VQ=iM,qQ=aM,$Q=cM,YQ=uM,WQ=lM,zQ=pM,KQ=dM,QQ=_M,XQ=fM,JQ=mM,ZQ=hM,eX=TM,tX=EM,Xg=SM,nX=gM,rX=AM,oX=RM,sX=yM,iX=IM,aX=OM,cX=NM,uX=bM,lX=CM,pX=PM,dX=MM,_X=xM,Jg=vM,fX=LM,mX=DM,Zg=UM,eA=wM,hX=kM,TX=GM,EX=BM,SX=jM,gX=HM,AX=FM,RX=VM,yX=qM,IX=$M,OX=YM,NX=WM,bX=zM,CX=KM,PX=QM,MX=XM,xX=JM,vX=ZM,bl=ex,Za=tx,tA=nx,LX=rx,DX=ox,Pi=sx,UX=ix,wX=ax,kX=cx,GX=ux,nA=lx,rA=px,BX=dx,oA=_x,jX=fx,HX=mx,FX=hx,VX=Tx,qX=Ex,$X=Sx,YX=gx,WX=Ax,zX=Rx,KX=yx,QX=Ix,XX=Ox,JX=Nx,ZX=bx,eJ=Cx,tJ=Px,nJ=Mx,rJ=xx,oJ=vx,sJ=Lx,iJ=Dx,aJ=Ux,cJ=wx,sA=kx,uJ=Gx,lJ=Bx,pJ=jx,dJ=Hx,_J=Fx,fJ=Vx,mJ=qx,hJ=$x,TJ=Yx,EJ=Wx,SJ=zx,gJ=Kx,AJ=Qx,RJ=Xx,yJ=Jx,IJ=Zx,OJ=ev,NJ=tv,bJ=nv,iA=rv,CJ=ov,aA=sv,PJ=iv,MJ=av,xJ=cv,vJ=uv,LJ=lv,DJ=pv,UJ=dv,wJ=_v,kJ=We([zP,KP,QP,XP,JP,ZP,eM,tM,nM,rM,oM,sM,iM,aM,cM,uM,lM,pM,dM,_M,fM,mM,hM,TM,EM,SM,gM,AM,RM,yM,IM,OM,NM,bM,CM,PM,MM,xM,vM,LM,DM,UM,wM,kM,GM,BM,jM,HM,FM,VM,qM,$M,YM,WM,zM,KM,QM,XM,JM,ZM,ex,tx,nx,rx,ox,sx,ix,ax,cx,ux,lx,px,dx,_x,fx,mx,hx,Tx,Ex,Sx,gx,Ax,Rx,yx,Ix,Ox,Nx,bx,Cx,Px,Mx,xx,vx,Lx,Dx,Ux,wx,kx,Gx,Bx,jx,Hx,Fx,Vx,qx,$x,Yx,Wx,zx,Kx,Qx,Xx,Jx,Zx,ev,tv,nv,rv,ov,sv,iv,av,cv,uv,lv,pv,dv,_v]),fv="other_sql",mv="mssql",hv="mysql",Tv="oracle",Ev="db2",Sv="postgresql",gv="redshift",Av="hive",Rv="cloudscape",yv="hsqldb",Iv="progress",Ov="maxdb",Nv="hanadb",bv="ingres",Cv="firstsql",Pv="edb",Mv="cache",xv="adabas",vv="firebird",Lv="derby",Dv="filemaker",Uv="informix",wv="instantdb",kv="interbase",Gv="mariadb",Bv="netezza",jv="pervasive",Hv="pointbase",Fv="sqlite",Vv="sybase",qv="teradata",$v="vertica",Yv="h2",Wv="coldfusion",zv="cassandra",Kv="hbase",Qv="mongodb",Xv="redis",Jv="couchbase",Zv="couchdb",eL="cosmosdb",tL="dynamodb",nL="neo4j",rL="geode",oL="elasticsearch",sL="memcached",iL="cockroachdb",GJ=fv,BJ=mv,jJ=hv,HJ=Tv,FJ=Ev,VJ=Sv,qJ=gv,$J=Av,YJ=Rv,WJ=yv,zJ=Iv,KJ=Ov,QJ=Nv,XJ=bv,JJ=Cv,ZJ=Pv,e5=Mv,t5=xv,n5=vv,r5=Lv,o5=Dv,s5=Uv,i5=wv,a5=kv,c5=Gv,u5=Bv,l5=jv,p5=Hv,d5=Fv,_5=Vv,f5=qv,m5=$v,h5=Yv,T5=Wv,E5=zv,S5=Kv,g5=Qv,A5=Xv,R5=Jv,y5=Zv,I5=eL,O5=tL,N5=nL,b5=rL,C5=oL,P5=sL,M5=iL,x5=We([fv,mv,hv,Tv,Ev,Sv,gv,Av,Rv,yv,Iv,Ov,Nv,bv,Cv,Pv,Mv,xv,vv,Lv,Dv,Uv,wv,kv,Gv,Bv,jv,Hv,Fv,Vv,qv,$v,Yv,Wv,zv,Kv,Qv,Xv,Jv,Zv,eL,tL,nL,rL,oL,sL,iL]),aL="all",cL="each_quorum",uL="quorum",lL="local_quorum",pL="one",dL="two",_L="three",fL="local_one",mL="any",hL="serial",TL="local_serial",v5=aL,L5=cL,D5=uL,U5=lL,w5=pL,k5=dL,G5=_L,B5=fL,j5=mL,H5=hL,F5=TL,V5=We([aL,cL,uL,lL,pL,dL,_L,fL,mL,hL,TL]),EL="datasource",SL="http",gL="pubsub",AL="timer",RL="other",q5=EL,$5=SL,Y5=gL,W5=AL,z5=RL,K5=We([EL,SL,gL,AL,RL]),yL="insert",IL="edit",OL="delete",Q5=yL,X5=IL,J5=OL,Z5=We([yL,IL,OL]),NL="alibaba_cloud",bL="aws",CL="azure",PL="gcp",eZ=NL,tZ=bL,nZ=CL,rZ=PL,oZ=We([NL,bL,CL,PL]),ML="ip_tcp",xL="ip_udp",vL="ip",LL="unix",DL="pipe",UL="inproc",wL="other",sZ=ML,iZ=xL,aZ=vL,cZ=LL,uZ=DL,lZ=UL,pZ=wL,dZ=We([ML,xL,vL,LL,DL,UL,wL]),kL="wifi",GL="wired",BL="cell",jL="unavailable",HL="unknown",_Z=kL,fZ=GL,mZ=BL,hZ=jL,TZ=HL,EZ=We([kL,GL,BL,jL,HL]),FL="gprs",VL="edge",qL="umts",$L="cdma",YL="evdo_0",WL="evdo_a",zL="cdma2000_1xrtt",KL="hsdpa",QL="hsupa",XL="hspa",JL="iden",ZL="evdo_b",e0="lte",t0="ehrpd",n0="hspap",r0="gsm",o0="td_scdma",s0="iwlan",i0="nr",a0="nrnsa",c0="lte_ca",SZ=FL,gZ=VL,AZ=qL,RZ=$L,yZ=YL,IZ=WL,OZ=zL,NZ=KL,bZ=QL,CZ=XL,PZ=JL,MZ=ZL,xZ=e0,vZ=t0,LZ=n0,DZ=r0,UZ=o0,wZ=s0,kZ=i0,GZ=a0,BZ=c0,jZ=We([FL,VL,qL,$L,YL,WL,zL,KL,QL,XL,JL,ZL,e0,t0,n0,r0,o0,s0,i0,a0,c0]),u0="1.0",l0="1.1",p0="2.0",d0="SPDY",_0="QUIC",HZ=u0,FZ=l0,VZ=p0,qZ=d0,$Z=_0,YZ={HTTP_1_0:u0,HTTP_1_1:l0,HTTP_2_0:p0,SPDY:d0,QUIC:_0},f0="queue",m0="topic",WZ=f0,zZ=m0,KZ=We([f0,m0]),h0="receive",T0="process",QZ=h0,XZ=T0,JZ=We([h0,T0]),E0=0,S0=1,g0=2,A0=3,R0=4,y0=5,I0=6,O0=7,N0=8,b0=9,C0=10,P0=11,M0=12,x0=13,v0=14,L0=15,D0=16,ZZ=E0,e6=S0,t6=g0,n6=A0,r6=R0,o6=y0,s6=I0,i6=O0,a6=N0,c6=b0,u6=C0,l6=P0,p6=M0,d6=x0,_6=v0,f6=L0,m6=D0,h6={OK:E0,CANCELLED:S0,UNKNOWN:g0,INVALID_ARGUMENT:A0,DEADLINE_EXCEEDED:R0,NOT_FOUND:y0,ALREADY_EXISTS:I0,PERMISSION_DENIED:O0,RESOURCE_EXHAUSTED:N0,FAILED_PRECONDITION:b0,ABORTED:C0,OUT_OF_RANGE:P0,UNIMPLEMENTED:M0,INTERNAL:x0,UNAVAILABLE:v0,DATA_LOSS:L0,UNAUTHENTICATED:D0},U0="SENT",w0="RECEIVED",T6=U0,E6=w0,S6=We([U0,w0])});var G0=z(()=>{k0()});var B0,j0,H0,F0,V0,q0,$0,Y0,W0,z0,K0,Q0,X0,J0,Z0,eD,tD,nD,rD,oD,sD,iD,aD,cD,uD,lD,pD,dD,_D,fD,mD,hD,TD,ED,SD,gD,AD,RD,yD,ID,OD,ND,bD,CD,PD,MD,xD,vD,LD,DD,UD,wD,kD,GD,BD,jD,HD,FD,VD,qD,$D,YD,WD,zD,KD,QD,XD,JD,ZD,eU,tU,nU,rU,oU,sU,iU,aU,cU,uU,lU,pU,g6,A6,R6,y6,I6,O6,N6,b6,C6,P6,M6,x6,v6,L6,D6,U6,w6,k6,G6,B6,j6,H6,F6,V6,q6,$6,Y6,W6,z6,K6,Q6,X6,J6,Z6,e8,t8,n8,r8,o8,s8,i8,a8,c8,u8,l8,p8,d8,_8,f8,m8,h8,T8,E8,S8,g8,A8,R8,y8,I8,O8,N8,b8,C8,P8,M8,x8,v8,L8,D8,U8,w8,cA,k8,G8,B8,j8,H8,F8,V8,q8,$8,Y8,dU,_U,fU,mU,W8,z8,K8,Q8,X8,hU,TU,EU,SU,gU,AU,RU,yU,IU,OU,NU,bU,CU,PU,MU,xU,vU,J8,Z8,e7,t7,n7,r7,o7,s7,i7,a7,c7,u7,l7,p7,d7,_7,f7,m7,LU,DU,h7,T7,E7,UU,wU,kU,GU,BU,jU,HU,S7,g7,A7,R7,y7,I7,O7,N7,FU,VU,qU,$U,YU,WU,zU,KU,QU,XU,JU,b7,C7,P7,M7,x7,v7,L7,D7,U7,w7,k7,G7,ZU,ew,tw,nw,rw,ow,sw,iw,aw,cw,B7,j7,H7,F7,V7,q7,$7,Y7,W7,z7,K7,uw=z(()=>{zg();B0="cloud.provider",j0="cloud.account.id",H0="cloud.region",F0="cloud.availability_zone",V0="cloud.platform",q0="aws.ecs.container.arn",$0="aws.ecs.cluster.arn",Y0="aws.ecs.launchtype",W0="aws.ecs.task.arn",z0="aws.ecs.task.family",K0="aws.ecs.task.revision",Q0="aws.eks.cluster.arn",X0="aws.log.group.names",J0="aws.log.group.arns",Z0="aws.log.stream.names",eD="aws.log.stream.arns",tD="container.name",nD="container.id",rD="container.runtime",oD="container.image.name",sD="container.image.tag",iD="deployment.environment",aD="device.id",cD="device.model.identifier",uD="device.model.name",lD="faas.name",pD="faas.id",dD="faas.version",_D="faas.instance",fD="faas.max_memory",mD="host.id",hD="host.name",TD="host.type",ED="host.arch",SD="host.image.name",gD="host.image.id",AD="host.image.version",RD="k8s.cluster.name",yD="k8s.node.name",ID="k8s.node.uid",OD="k8s.namespace.name",ND="k8s.pod.uid",bD="k8s.pod.name",CD="k8s.container.name",PD="k8s.replicaset.uid",MD="k8s.replicaset.name",xD="k8s.deployment.uid",vD="k8s.deployment.name",LD="k8s.statefulset.uid",DD="k8s.statefulset.name",UD="k8s.daemonset.uid",wD="k8s.daemonset.name",kD="k8s.job.uid",GD="k8s.job.name",BD="k8s.cronjob.uid",jD="k8s.cronjob.name",HD="os.type",FD="os.description",VD="os.name",qD="os.version",$D="process.pid",YD="process.executable.name",WD="process.executable.path",zD="process.command",KD="process.command_line",QD="process.command_args",XD="process.owner",JD="process.runtime.name",ZD="process.runtime.version",eU="process.runtime.description",tU="service.name",nU="service.namespace",rU="service.instance.id",oU="service.version",sU="telemetry.sdk.name",iU="telemetry.sdk.language",aU="telemetry.sdk.version",cU="telemetry.auto.version",uU="webengine.name",lU="webengine.version",pU="webengine.description",g6=B0,A6=j0,R6=H0,y6=F0,I6=V0,O6=q0,N6=$0,b6=Y0,C6=W0,P6=z0,M6=K0,x6=Q0,v6=X0,L6=J0,D6=Z0,U6=eD,w6=tD,k6=nD,G6=rD,B6=oD,j6=sD,H6=iD,F6=aD,V6=cD,q6=uD,$6=lD,Y6=pD,W6=dD,z6=_D,K6=fD,Q6=mD,X6=hD,J6=TD,Z6=ED,e8=SD,t8=gD,n8=AD,r8=RD,o8=yD,s8=ID,i8=OD,a8=ND,c8=bD,u8=CD,l8=PD,p8=MD,d8=xD,_8=vD,f8=LD,m8=DD,h8=UD,T8=wD,E8=kD,S8=GD,g8=BD,A8=jD,R8=HD,y8=FD,I8=VD,O8=qD,N8=$D,b8=YD,C8=WD,P8=zD,M8=KD,x8=QD,v8=XD,L8=JD,D8=ZD,U8=eU,w8=tU,cA=nU,k8=rU,G8=oU,B8=sU,j8=iU,H8=aU,F8=cU,V8=uU,q8=lU,$8=pU,Y8=We([B0,j0,H0,F0,V0,q0,$0,Y0,W0,z0,K0,Q0,X0,J0,Z0,eD,tD,nD,rD,oD,sD,iD,aD,cD,uD,lD,pD,dD,_D,fD,mD,hD,TD,ED,SD,gD,AD,RD,yD,ID,OD,ND,bD,CD,PD,MD,xD,vD,LD,DD,UD,wD,kD,GD,BD,jD,HD,FD,VD,qD,$D,YD,WD,zD,KD,QD,XD,JD,ZD,eU,tU,nU,rU,oU,sU,iU,aU,cU,uU,lU,pU]),dU="alibaba_cloud",_U="aws",fU="azure",mU="gcp",W8=dU,z8=_U,K8=fU,Q8=mU,X8=We([dU,_U,fU,mU]),hU="alibaba_cloud_ecs",TU="alibaba_cloud_fc",EU="aws_ec2",SU="aws_ecs",gU="aws_eks",AU="aws_lambda",RU="aws_elastic_beanstalk",yU="azure_vm",IU="azure_container_instances",OU="azure_aks",NU="azure_functions",bU="azure_app_service",CU="gcp_compute_engine",PU="gcp_cloud_run",MU="gcp_kubernetes_engine",xU="gcp_cloud_functions",vU="gcp_app_engine",J8=hU,Z8=TU,e7=EU,t7=SU,n7=gU,r7=AU,o7=RU,s7=yU,i7=IU,a7=OU,c7=NU,u7=bU,l7=CU,p7=PU,d7=MU,_7=xU,f7=vU,m7=We([hU,TU,EU,SU,gU,AU,RU,yU,IU,OU,NU,bU,CU,PU,MU,xU,vU]),LU="ec2",DU="fargate",h7=LU,T7=DU,E7=We([LU,DU]),UU="amd64",wU="arm32",kU="arm64",GU="ia64",BU="ppc32",jU="ppc64",HU="x86",S7=UU,g7=wU,A7=kU,R7=GU,y7=BU,I7=jU,O7=HU,N7=We([UU,wU,kU,GU,BU,jU,HU]),FU="windows",VU="linux",qU="darwin",$U="freebsd",YU="netbsd",WU="openbsd",zU="dragonflybsd",KU="hpux",QU="aix",XU="solaris",JU="z_os",b7=FU,C7=VU,P7=qU,M7=$U,x7=YU,v7=WU,L7=zU,D7=KU,U7=QU,w7=XU,k7=JU,G7=We([FU,VU,qU,$U,YU,WU,zU,KU,QU,XU,JU]),ZU="cpp",ew="dotnet",tw="erlang",nw="go",rw="java",ow="nodejs",sw="php",iw="python",aw="ruby",cw="webjs",B7=ZU,j7=ew,H7=tw,F7=nw,V7=rw,q7=ow,$7=sw,Y7=iw,W7=aw,z7=cw,K7=We([ZU,ew,tw,nw,rw,ow,sw,iw,aw,cw])});var lw=z(()=>{uw()});var Q7,X7,J7,Z7,eee,tee,nee,ree,oee,see,iee,aee,cee,uee,lee,pee,dee,_ee,fee,mee,hee,Tee,Eee,See,gee,uA,lA,Aee,ec,Ree,pA,dA,yee,Mi,Iee,Oee,Nee,bee,Cee,Pee,Mee,xee,vee,Lee,_A,Dee,Uee,wee,kee,Gee,Bee,xi,jee,Hee,Fee,Vee,qee,$ee,Yee,Wee,zee,Kee,Qee,Xee,Jee,bo,Co,Zee,ete,tte,nte,rte,ote,ste,ite,ate,cte,ute,lte,pte,dte,_te,fte,fA,mA,mte,hA,TA,hte,Tte,Ete,Ste,gte,Ate,Rte,yte,Ite,Ote,Nte,bte,Cte,Pte,EA,SA,Mte,gA,xte,AA,vte,Lte,Dte,Ute,wte,kte,Gte,Bte,jte,Hte,Fte,Vte,qte,$te,Yte,Wte,zte,Kte,Qte,Xte,Jte,Zte,ene,tne,cs,nne,rne,one,RA,pw=z(()=>{Q7="aspnetcore.diagnostics.exception.result",X7="aborted",J7="handled",Z7="skipped",eee="unhandled",tee="aspnetcore.diagnostics.handler.type",nee="aspnetcore.rate_limiting.policy",ree="aspnetcore.rate_limiting.result",oee="acquired",see="endpoint_limiter",iee="global_limiter",aee="request_canceled",cee="aspnetcore.request.is_unhandled",uee="aspnetcore.routing.is_fallback",lee="aspnetcore.routing.match_status",pee="failure",dee="success",_ee="aspnetcore.user.is_authenticated",fee="client.address",mee="client.port",hee="code.column.number",Tee="code.file.path",Eee="code.function.name",See="code.line.number",gee="code.stacktrace",uA="db.collection.name",lA="db.namespace",Aee="db.operation.batch.size",ec="db.operation.name",Ree="db.query.summary",pA="db.query.text",dA="db.response.status_code",yee="db.stored_procedure.name",Mi="db.system.name",Iee="mariadb",Oee="microsoft.sql_server",Nee="mysql",bee="postgresql",Cee="dotnet.gc.heap.generation",Pee="gen0",Mee="gen1",xee="gen2",vee="loh",Lee="poh",_A="error.type",Dee="_OTHER",Uee="exception.escaped",wee="exception.message",kee="exception.stacktrace",Gee="exception.type",Bee=t=>`http.request.header.${t}`,xi="http.request.method",jee="_OTHER",Hee="CONNECT",Fee="DELETE",Vee="GET",qee="HEAD",$ee="OPTIONS",Yee="PATCH",Wee="POST",zee="PUT",Kee="TRACE",Qee="http.request.method_original",Xee="http.request.resend_count",Jee=t=>`http.response.header.${t}`,bo="http.response.status_code",Co="http.route",Zee="jvm.gc.action",ete="jvm.gc.name",tte="jvm.memory.pool.name",nte="jvm.memory.type",rte="heap",ote="non_heap",ste="jvm.thread.daemon",ite="jvm.thread.state",ate="blocked",cte="new",ute="runnable",lte="terminated",pte="timed_waiting",dte="waiting",_te="network.local.address",fte="network.local.port",fA="network.peer.address",mA="network.peer.port",mte="network.protocol.name",hA="network.protocol.version",TA="network.transport",hte="pipe",Tte="quic",Ete="tcp",Ste="udp",gte="unix",Ate="network.type",Rte="ipv4",yte="ipv6",Ite="otel.scope.name",Ote="otel.scope.version",Nte="otel.status_code",bte="ERROR",Cte="OK",Pte="otel.status_description",EA="server.address",SA="server.port",Mte="service.instance.id",gA="service.name",xte="service.namespace",AA="service.version",vte="signalr.connection.status",Lte="app_shutdown",Dte="normal_closure",Ute="timeout",wte="signalr.transport",kte="long_polling",Gte="server_sent_events",Bte="web_sockets",jte="telemetry.sdk.language",Hte="cpp",Fte="dotnet",Vte="erlang",qte="go",$te="java",Yte="nodejs",Wte="php",zte="python",Kte="ruby",Qte="rust",Xte="swift",Jte="webjs",Zte="telemetry.sdk.name",ene="telemetry.sdk.version",tne="url.fragment",cs="url.full",nne="url.path",rne="url.query",one="url.scheme",RA="user_agent.original"});var sne,ine,ane,cne,une,lne,pne,dne,_ne,fne,mne,hne,Tne,Ene,Sne,gne,Ane,Rne,yne,Ine,One,Nne,bne,Cne,Pne,Mne,xne,vne,Lne,Dne,Une,wne,kne,Gne,Bne,jne,Hne,Fne,Vne,qne,$ne,Yne,Wne,zne,Kne,Qne,Xne,Jne,Zne,ere,tre,dw=z(()=>{sne="aspnetcore.diagnostics.exceptions",ine="aspnetcore.rate_limiting.active_request_leases",ane="aspnetcore.rate_limiting.queued_requests",cne="aspnetcore.rate_limiting.request.time_in_queue",une="aspnetcore.rate_limiting.request_lease.duration",lne="aspnetcore.rate_limiting.requests",pne="aspnetcore.routing.match_attempts",dne="db.client.operation.duration",_ne="dotnet.assembly.count",fne="dotnet.exceptions",mne="dotnet.gc.collections",hne="dotnet.gc.heap.total_allocated",Tne="dotnet.gc.last_collection.heap.fragmentation.size",Ene="dotnet.gc.last_collection.heap.size",Sne="dotnet.gc.last_collection.memory.committed_size",gne="dotnet.gc.pause.time",Ane="dotnet.jit.compilation.time",Rne="dotnet.jit.compiled_il.size",yne="dotnet.jit.compiled_methods",Ine="dotnet.monitor.lock_contentions",One="dotnet.process.cpu.count",Nne="dotnet.process.cpu.time",bne="dotnet.process.memory.working_set",Cne="dotnet.thread_pool.queue.length",Pne="dotnet.thread_pool.thread.count",Mne="dotnet.thread_pool.work_item.count",xne="dotnet.timer.count",vne="http.client.request.duration",Lne="http.server.request.duration",Dne="jvm.class.count",Une="jvm.class.loaded",wne="jvm.class.unloaded",kne="jvm.cpu.count",Gne="jvm.cpu.recent_utilization",Bne="jvm.cpu.time",jne="jvm.gc.duration",Hne="jvm.memory.committed",Fne="jvm.memory.limit",Vne="jvm.memory.used",qne="jvm.memory.used_after_last_gc",$ne="jvm.thread.count",Yne="kestrel.active_connections",Wne="kestrel.active_tls_handshakes",zne="kestrel.connection.duration",Kne="kestrel.queued_connections",Qne="kestrel.queued_requests",Xne="kestrel.rejected_connections",Jne="kestrel.tls_handshake.duration",Zne="kestrel.upgraded_connections",ere="signalr.server.active_connections",tre="signalr.server.connection.duration"});var nre,_w=z(()=>{nre="exception"});var Ae={};sg(Ae,{ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_ABORTED:()=>X7,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_HANDLED:()=>J7,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_SKIPPED:()=>Z7,ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_UNHANDLED:()=>eee,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ACQUIRED:()=>oee,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ENDPOINT_LIMITER:()=>see,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_GLOBAL_LIMITER:()=>iee,ASPNETCORE_RATE_LIMITING_RESULT_VALUE_REQUEST_CANCELED:()=>aee,ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_FAILURE:()=>pee,ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_SUCCESS:()=>dee,ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT:()=>Q7,ATTR_ASPNETCORE_DIAGNOSTICS_HANDLER_TYPE:()=>tee,ATTR_ASPNETCORE_RATE_LIMITING_POLICY:()=>nee,ATTR_ASPNETCORE_RATE_LIMITING_RESULT:()=>ree,ATTR_ASPNETCORE_REQUEST_IS_UNHANDLED:()=>cee,ATTR_ASPNETCORE_ROUTING_IS_FALLBACK:()=>uee,ATTR_ASPNETCORE_ROUTING_MATCH_STATUS:()=>lee,ATTR_ASPNETCORE_USER_IS_AUTHENTICATED:()=>_ee,ATTR_CLIENT_ADDRESS:()=>fee,ATTR_CLIENT_PORT:()=>mee,ATTR_CODE_COLUMN_NUMBER:()=>hee,ATTR_CODE_FILE_PATH:()=>Tee,ATTR_CODE_FUNCTION_NAME:()=>Eee,ATTR_CODE_LINE_NUMBER:()=>See,ATTR_CODE_STACKTRACE:()=>gee,ATTR_DB_COLLECTION_NAME:()=>uA,ATTR_DB_NAMESPACE:()=>lA,ATTR_DB_OPERATION_BATCH_SIZE:()=>Aee,ATTR_DB_OPERATION_NAME:()=>ec,ATTR_DB_QUERY_SUMMARY:()=>Ree,ATTR_DB_QUERY_TEXT:()=>pA,ATTR_DB_RESPONSE_STATUS_CODE:()=>dA,ATTR_DB_STORED_PROCEDURE_NAME:()=>yee,ATTR_DB_SYSTEM_NAME:()=>Mi,ATTR_DOTNET_GC_HEAP_GENERATION:()=>Cee,ATTR_ERROR_TYPE:()=>_A,ATTR_EXCEPTION_ESCAPED:()=>Uee,ATTR_EXCEPTION_MESSAGE:()=>wee,ATTR_EXCEPTION_STACKTRACE:()=>kee,ATTR_EXCEPTION_TYPE:()=>Gee,ATTR_HTTP_REQUEST_HEADER:()=>Bee,ATTR_HTTP_REQUEST_METHOD:()=>xi,ATTR_HTTP_REQUEST_METHOD_ORIGINAL:()=>Qee,ATTR_HTTP_REQUEST_RESEND_COUNT:()=>Xee,ATTR_HTTP_RESPONSE_HEADER:()=>Jee,ATTR_HTTP_RESPONSE_STATUS_CODE:()=>bo,ATTR_HTTP_ROUTE:()=>Co,ATTR_JVM_GC_ACTION:()=>Zee,ATTR_JVM_GC_NAME:()=>ete,ATTR_JVM_MEMORY_POOL_NAME:()=>tte,ATTR_JVM_MEMORY_TYPE:()=>nte,ATTR_JVM_THREAD_DAEMON:()=>ste,ATTR_JVM_THREAD_STATE:()=>ite,ATTR_NETWORK_LOCAL_ADDRESS:()=>_te,ATTR_NETWORK_LOCAL_PORT:()=>fte,ATTR_NETWORK_PEER_ADDRESS:()=>fA,ATTR_NETWORK_PEER_PORT:()=>mA,ATTR_NETWORK_PROTOCOL_NAME:()=>mte,ATTR_NETWORK_PROTOCOL_VERSION:()=>hA,ATTR_NETWORK_TRANSPORT:()=>TA,ATTR_NETWORK_TYPE:()=>Ate,ATTR_OTEL_SCOPE_NAME:()=>Ite,ATTR_OTEL_SCOPE_VERSION:()=>Ote,ATTR_OTEL_STATUS_CODE:()=>Nte,ATTR_OTEL_STATUS_DESCRIPTION:()=>Pte,ATTR_SERVER_ADDRESS:()=>EA,ATTR_SERVER_PORT:()=>SA,ATTR_SERVICE_INSTANCE_ID:()=>Mte,ATTR_SERVICE_NAME:()=>gA,ATTR_SERVICE_NAMESPACE:()=>xte,ATTR_SERVICE_VERSION:()=>AA,ATTR_SIGNALR_CONNECTION_STATUS:()=>vte,ATTR_SIGNALR_TRANSPORT:()=>wte,ATTR_TELEMETRY_SDK_LANGUAGE:()=>jte,ATTR_TELEMETRY_SDK_NAME:()=>Zte,ATTR_TELEMETRY_SDK_VERSION:()=>ene,ATTR_URL_FRAGMENT:()=>tne,ATTR_URL_FULL:()=>cs,ATTR_URL_PATH:()=>nne,ATTR_URL_QUERY:()=>rne,ATTR_URL_SCHEME:()=>one,ATTR_USER_AGENT_ORIGINAL:()=>RA,AWSECSLAUNCHTYPEVALUES_EC2:()=>h7,AWSECSLAUNCHTYPEVALUES_FARGATE:()=>T7,AwsEcsLaunchtypeValues:()=>E7,CLOUDPLATFORMVALUES_ALIBABA_CLOUD_ECS:()=>J8,CLOUDPLATFORMVALUES_ALIBABA_CLOUD_FC:()=>Z8,CLOUDPLATFORMVALUES_AWS_EC2:()=>e7,CLOUDPLATFORMVALUES_AWS_ECS:()=>t7,CLOUDPLATFORMVALUES_AWS_EKS:()=>n7,CLOUDPLATFORMVALUES_AWS_ELASTIC_BEANSTALK:()=>o7,CLOUDPLATFORMVALUES_AWS_LAMBDA:()=>r7,CLOUDPLATFORMVALUES_AZURE_AKS:()=>a7,CLOUDPLATFORMVALUES_AZURE_APP_SERVICE:()=>u7,CLOUDPLATFORMVALUES_AZURE_CONTAINER_INSTANCES:()=>i7,CLOUDPLATFORMVALUES_AZURE_FUNCTIONS:()=>c7,CLOUDPLATFORMVALUES_AZURE_VM:()=>s7,CLOUDPLATFORMVALUES_GCP_APP_ENGINE:()=>f7,CLOUDPLATFORMVALUES_GCP_CLOUD_FUNCTIONS:()=>_7,CLOUDPLATFORMVALUES_GCP_CLOUD_RUN:()=>p7,CLOUDPLATFORMVALUES_GCP_COMPUTE_ENGINE:()=>l7,CLOUDPLATFORMVALUES_GCP_KUBERNETES_ENGINE:()=>d7,CLOUDPROVIDERVALUES_ALIBABA_CLOUD:()=>W8,CLOUDPROVIDERVALUES_AWS:()=>z8,CLOUDPROVIDERVALUES_AZURE:()=>K8,CLOUDPROVIDERVALUES_GCP:()=>Q8,CloudPlatformValues:()=>m7,CloudProviderValues:()=>X8,DBCASSANDRACONSISTENCYLEVELVALUES_ALL:()=>v5,DBCASSANDRACONSISTENCYLEVELVALUES_ANY:()=>j5,DBCASSANDRACONSISTENCYLEVELVALUES_EACH_QUORUM:()=>L5,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_ONE:()=>B5,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_QUORUM:()=>U5,DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_SERIAL:()=>F5,DBCASSANDRACONSISTENCYLEVELVALUES_ONE:()=>w5,DBCASSANDRACONSISTENCYLEVELVALUES_QUORUM:()=>D5,DBCASSANDRACONSISTENCYLEVELVALUES_SERIAL:()=>H5,DBCASSANDRACONSISTENCYLEVELVALUES_THREE:()=>G5,DBCASSANDRACONSISTENCYLEVELVALUES_TWO:()=>k5,DBSYSTEMVALUES_ADABAS:()=>t5,DBSYSTEMVALUES_CACHE:()=>e5,DBSYSTEMVALUES_CASSANDRA:()=>E5,DBSYSTEMVALUES_CLOUDSCAPE:()=>YJ,DBSYSTEMVALUES_COCKROACHDB:()=>M5,DBSYSTEMVALUES_COLDFUSION:()=>T5,DBSYSTEMVALUES_COSMOSDB:()=>I5,DBSYSTEMVALUES_COUCHBASE:()=>R5,DBSYSTEMVALUES_COUCHDB:()=>y5,DBSYSTEMVALUES_DB2:()=>FJ,DBSYSTEMVALUES_DERBY:()=>r5,DBSYSTEMVALUES_DYNAMODB:()=>O5,DBSYSTEMVALUES_EDB:()=>ZJ,DBSYSTEMVALUES_ELASTICSEARCH:()=>C5,DBSYSTEMVALUES_FILEMAKER:()=>o5,DBSYSTEMVALUES_FIREBIRD:()=>n5,DBSYSTEMVALUES_FIRSTSQL:()=>JJ,DBSYSTEMVALUES_GEODE:()=>b5,DBSYSTEMVALUES_H2:()=>h5,DBSYSTEMVALUES_HANADB:()=>QJ,DBSYSTEMVALUES_HBASE:()=>S5,DBSYSTEMVALUES_HIVE:()=>$J,DBSYSTEMVALUES_HSQLDB:()=>WJ,DBSYSTEMVALUES_INFORMIX:()=>s5,DBSYSTEMVALUES_INGRES:()=>XJ,DBSYSTEMVALUES_INSTANTDB:()=>i5,DBSYSTEMVALUES_INTERBASE:()=>a5,DBSYSTEMVALUES_MARIADB:()=>c5,DBSYSTEMVALUES_MAXDB:()=>KJ,DBSYSTEMVALUES_MEMCACHED:()=>P5,DBSYSTEMVALUES_MONGODB:()=>g5,DBSYSTEMVALUES_MSSQL:()=>BJ,DBSYSTEMVALUES_MYSQL:()=>jJ,DBSYSTEMVALUES_NEO4J:()=>N5,DBSYSTEMVALUES_NETEZZA:()=>u5,DBSYSTEMVALUES_ORACLE:()=>HJ,DBSYSTEMVALUES_OTHER_SQL:()=>GJ,DBSYSTEMVALUES_PERVASIVE:()=>l5,DBSYSTEMVALUES_POINTBASE:()=>p5,DBSYSTEMVALUES_POSTGRESQL:()=>VJ,DBSYSTEMVALUES_PROGRESS:()=>zJ,DBSYSTEMVALUES_REDIS:()=>A5,DBSYSTEMVALUES_REDSHIFT:()=>qJ,DBSYSTEMVALUES_SQLITE:()=>d5,DBSYSTEMVALUES_SYBASE:()=>_5,DBSYSTEMVALUES_TERADATA:()=>f5,DBSYSTEMVALUES_VERTICA:()=>m5,DB_SYSTEM_NAME_VALUE_MARIADB:()=>Iee,DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER:()=>Oee,DB_SYSTEM_NAME_VALUE_MYSQL:()=>Nee,DB_SYSTEM_NAME_VALUE_POSTGRESQL:()=>bee,DOTNET_GC_HEAP_GENERATION_VALUE_GEN0:()=>Pee,DOTNET_GC_HEAP_GENERATION_VALUE_GEN1:()=>Mee,DOTNET_GC_HEAP_GENERATION_VALUE_GEN2:()=>xee,DOTNET_GC_HEAP_GENERATION_VALUE_LOH:()=>vee,DOTNET_GC_HEAP_GENERATION_VALUE_POH:()=>Lee,DbCassandraConsistencyLevelValues:()=>V5,DbSystemValues:()=>x5,ERROR_TYPE_VALUE_OTHER:()=>Dee,EVENT_EXCEPTION:()=>nre,FAASDOCUMENTOPERATIONVALUES_DELETE:()=>J5,FAASDOCUMENTOPERATIONVALUES_EDIT:()=>X5,FAASDOCUMENTOPERATIONVALUES_INSERT:()=>Q5,FAASINVOKEDPROVIDERVALUES_ALIBABA_CLOUD:()=>eZ,FAASINVOKEDPROVIDERVALUES_AWS:()=>tZ,FAASINVOKEDPROVIDERVALUES_AZURE:()=>nZ,FAASINVOKEDPROVIDERVALUES_GCP:()=>rZ,FAASTRIGGERVALUES_DATASOURCE:()=>q5,FAASTRIGGERVALUES_HTTP:()=>$5,FAASTRIGGERVALUES_OTHER:()=>z5,FAASTRIGGERVALUES_PUBSUB:()=>Y5,FAASTRIGGERVALUES_TIMER:()=>W5,FaasDocumentOperationValues:()=>Z5,FaasInvokedProviderValues:()=>oZ,FaasTriggerValues:()=>K5,HOSTARCHVALUES_AMD64:()=>S7,HOSTARCHVALUES_ARM32:()=>g7,HOSTARCHVALUES_ARM64:()=>A7,HOSTARCHVALUES_IA64:()=>R7,HOSTARCHVALUES_PPC32:()=>y7,HOSTARCHVALUES_PPC64:()=>I7,HOSTARCHVALUES_X86:()=>O7,HTTPFLAVORVALUES_HTTP_1_0:()=>HZ,HTTPFLAVORVALUES_HTTP_1_1:()=>FZ,HTTPFLAVORVALUES_HTTP_2_0:()=>VZ,HTTPFLAVORVALUES_QUIC:()=>$Z,HTTPFLAVORVALUES_SPDY:()=>qZ,HTTP_REQUEST_METHOD_VALUE_CONNECT:()=>Hee,HTTP_REQUEST_METHOD_VALUE_DELETE:()=>Fee,HTTP_REQUEST_METHOD_VALUE_GET:()=>Vee,HTTP_REQUEST_METHOD_VALUE_HEAD:()=>qee,HTTP_REQUEST_METHOD_VALUE_OPTIONS:()=>$ee,HTTP_REQUEST_METHOD_VALUE_OTHER:()=>jee,HTTP_REQUEST_METHOD_VALUE_PATCH:()=>Yee,HTTP_REQUEST_METHOD_VALUE_POST:()=>Wee,HTTP_REQUEST_METHOD_VALUE_PUT:()=>zee,HTTP_REQUEST_METHOD_VALUE_TRACE:()=>Kee,HostArchValues:()=>N7,HttpFlavorValues:()=>YZ,JVM_MEMORY_TYPE_VALUE_HEAP:()=>rte,JVM_MEMORY_TYPE_VALUE_NON_HEAP:()=>ote,JVM_THREAD_STATE_VALUE_BLOCKED:()=>ate,JVM_THREAD_STATE_VALUE_NEW:()=>cte,JVM_THREAD_STATE_VALUE_RUNNABLE:()=>ute,JVM_THREAD_STATE_VALUE_TERMINATED:()=>lte,JVM_THREAD_STATE_VALUE_TIMED_WAITING:()=>pte,JVM_THREAD_STATE_VALUE_WAITING:()=>dte,MESSAGETYPEVALUES_RECEIVED:()=>E6,MESSAGETYPEVALUES_SENT:()=>T6,MESSAGINGDESTINATIONKINDVALUES_QUEUE:()=>WZ,MESSAGINGDESTINATIONKINDVALUES_TOPIC:()=>zZ,MESSAGINGOPERATIONVALUES_PROCESS:()=>XZ,MESSAGINGOPERATIONVALUES_RECEIVE:()=>QZ,METRIC_ASPNETCORE_DIAGNOSTICS_EXCEPTIONS:()=>sne,METRIC_ASPNETCORE_RATE_LIMITING_ACTIVE_REQUEST_LEASES:()=>ine,METRIC_ASPNETCORE_RATE_LIMITING_QUEUED_REQUESTS:()=>ane,METRIC_ASPNETCORE_RATE_LIMITING_REQUESTS:()=>lne,METRIC_ASPNETCORE_RATE_LIMITING_REQUEST_LEASE_DURATION:()=>une,METRIC_ASPNETCORE_RATE_LIMITING_REQUEST_TIME_IN_QUEUE:()=>cne,METRIC_ASPNETCORE_ROUTING_MATCH_ATTEMPTS:()=>pne,METRIC_DB_CLIENT_OPERATION_DURATION:()=>dne,METRIC_DOTNET_ASSEMBLY_COUNT:()=>_ne,METRIC_DOTNET_EXCEPTIONS:()=>fne,METRIC_DOTNET_GC_COLLECTIONS:()=>mne,METRIC_DOTNET_GC_HEAP_TOTAL_ALLOCATED:()=>hne,METRIC_DOTNET_GC_LAST_COLLECTION_HEAP_FRAGMENTATION_SIZE:()=>Tne,METRIC_DOTNET_GC_LAST_COLLECTION_HEAP_SIZE:()=>Ene,METRIC_DOTNET_GC_LAST_COLLECTION_MEMORY_COMMITTED_SIZE:()=>Sne,METRIC_DOTNET_GC_PAUSE_TIME:()=>gne,METRIC_DOTNET_JIT_COMPILATION_TIME:()=>Ane,METRIC_DOTNET_JIT_COMPILED_IL_SIZE:()=>Rne,METRIC_DOTNET_JIT_COMPILED_METHODS:()=>yne,METRIC_DOTNET_MONITOR_LOCK_CONTENTIONS:()=>Ine,METRIC_DOTNET_PROCESS_CPU_COUNT:()=>One,METRIC_DOTNET_PROCESS_CPU_TIME:()=>Nne,METRIC_DOTNET_PROCESS_MEMORY_WORKING_SET:()=>bne,METRIC_DOTNET_THREAD_POOL_QUEUE_LENGTH:()=>Cne,METRIC_DOTNET_THREAD_POOL_THREAD_COUNT:()=>Pne,METRIC_DOTNET_THREAD_POOL_WORK_ITEM_COUNT:()=>Mne,METRIC_DOTNET_TIMER_COUNT:()=>xne,METRIC_HTTP_CLIENT_REQUEST_DURATION:()=>vne,METRIC_HTTP_SERVER_REQUEST_DURATION:()=>Lne,METRIC_JVM_CLASS_COUNT:()=>Dne,METRIC_JVM_CLASS_LOADED:()=>Une,METRIC_JVM_CLASS_UNLOADED:()=>wne,METRIC_JVM_CPU_COUNT:()=>kne,METRIC_JVM_CPU_RECENT_UTILIZATION:()=>Gne,METRIC_JVM_CPU_TIME:()=>Bne,METRIC_JVM_GC_DURATION:()=>jne,METRIC_JVM_MEMORY_COMMITTED:()=>Hne,METRIC_JVM_MEMORY_LIMIT:()=>Fne,METRIC_JVM_MEMORY_USED:()=>Vne,METRIC_JVM_MEMORY_USED_AFTER_LAST_GC:()=>qne,METRIC_JVM_THREAD_COUNT:()=>$ne,METRIC_KESTREL_ACTIVE_CONNECTIONS:()=>Yne,METRIC_KESTREL_ACTIVE_TLS_HANDSHAKES:()=>Wne,METRIC_KESTREL_CONNECTION_DURATION:()=>zne,METRIC_KESTREL_QUEUED_CONNECTIONS:()=>Kne,METRIC_KESTREL_QUEUED_REQUESTS:()=>Qne,METRIC_KESTREL_REJECTED_CONNECTIONS:()=>Xne,METRIC_KESTREL_TLS_HANDSHAKE_DURATION:()=>Jne,METRIC_KESTREL_UPGRADED_CONNECTIONS:()=>Zne,METRIC_SIGNALR_SERVER_ACTIVE_CONNECTIONS:()=>ere,METRIC_SIGNALR_SERVER_CONNECTION_DURATION:()=>tre,MessageTypeValues:()=>S6,MessagingDestinationKindValues:()=>KZ,MessagingOperationValues:()=>JZ,NETHOSTCONNECTIONSUBTYPEVALUES_CDMA:()=>RZ,NETHOSTCONNECTIONSUBTYPEVALUES_CDMA2000_1XRTT:()=>OZ,NETHOSTCONNECTIONSUBTYPEVALUES_EDGE:()=>gZ,NETHOSTCONNECTIONSUBTYPEVALUES_EHRPD:()=>vZ,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_0:()=>yZ,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_A:()=>IZ,NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_B:()=>MZ,NETHOSTCONNECTIONSUBTYPEVALUES_GPRS:()=>SZ,NETHOSTCONNECTIONSUBTYPEVALUES_GSM:()=>DZ,NETHOSTCONNECTIONSUBTYPEVALUES_HSDPA:()=>NZ,NETHOSTCONNECTIONSUBTYPEVALUES_HSPA:()=>CZ,NETHOSTCONNECTIONSUBTYPEVALUES_HSPAP:()=>LZ,NETHOSTCONNECTIONSUBTYPEVALUES_HSUPA:()=>bZ,NETHOSTCONNECTIONSUBTYPEVALUES_IDEN:()=>PZ,NETHOSTCONNECTIONSUBTYPEVALUES_IWLAN:()=>wZ,NETHOSTCONNECTIONSUBTYPEVALUES_LTE:()=>xZ,NETHOSTCONNECTIONSUBTYPEVALUES_LTE_CA:()=>BZ,NETHOSTCONNECTIONSUBTYPEVALUES_NR:()=>kZ,NETHOSTCONNECTIONSUBTYPEVALUES_NRNSA:()=>GZ,NETHOSTCONNECTIONSUBTYPEVALUES_TD_SCDMA:()=>UZ,NETHOSTCONNECTIONSUBTYPEVALUES_UMTS:()=>AZ,NETHOSTCONNECTIONTYPEVALUES_CELL:()=>mZ,NETHOSTCONNECTIONTYPEVALUES_UNAVAILABLE:()=>hZ,NETHOSTCONNECTIONTYPEVALUES_UNKNOWN:()=>TZ,NETHOSTCONNECTIONTYPEVALUES_WIFI:()=>_Z,NETHOSTCONNECTIONTYPEVALUES_WIRED:()=>fZ,NETTRANSPORTVALUES_INPROC:()=>lZ,NETTRANSPORTVALUES_IP:()=>aZ,NETTRANSPORTVALUES_IP_TCP:()=>sZ,NETTRANSPORTVALUES_IP_UDP:()=>iZ,NETTRANSPORTVALUES_OTHER:()=>pZ,NETTRANSPORTVALUES_PIPE:()=>uZ,NETTRANSPORTVALUES_UNIX:()=>cZ,NETWORK_TRANSPORT_VALUE_PIPE:()=>hte,NETWORK_TRANSPORT_VALUE_QUIC:()=>Tte,NETWORK_TRANSPORT_VALUE_TCP:()=>Ete,NETWORK_TRANSPORT_VALUE_UDP:()=>Ste,NETWORK_TRANSPORT_VALUE_UNIX:()=>gte,NETWORK_TYPE_VALUE_IPV4:()=>Rte,NETWORK_TYPE_VALUE_IPV6:()=>yte,NetHostConnectionSubtypeValues:()=>jZ,NetHostConnectionTypeValues:()=>EZ,NetTransportValues:()=>dZ,OSTYPEVALUES_AIX:()=>U7,OSTYPEVALUES_DARWIN:()=>P7,OSTYPEVALUES_DRAGONFLYBSD:()=>L7,OSTYPEVALUES_FREEBSD:()=>M7,OSTYPEVALUES_HPUX:()=>D7,OSTYPEVALUES_LINUX:()=>C7,OSTYPEVALUES_NETBSD:()=>x7,OSTYPEVALUES_OPENBSD:()=>v7,OSTYPEVALUES_SOLARIS:()=>w7,OSTYPEVALUES_WINDOWS:()=>b7,OSTYPEVALUES_Z_OS:()=>k7,OTEL_STATUS_CODE_VALUE_ERROR:()=>bte,OTEL_STATUS_CODE_VALUE_OK:()=>Cte,OsTypeValues:()=>G7,RPCGRPCSTATUSCODEVALUES_ABORTED:()=>u6,RPCGRPCSTATUSCODEVALUES_ALREADY_EXISTS:()=>s6,RPCGRPCSTATUSCODEVALUES_CANCELLED:()=>e6,RPCGRPCSTATUSCODEVALUES_DATA_LOSS:()=>f6,RPCGRPCSTATUSCODEVALUES_DEADLINE_EXCEEDED:()=>r6,RPCGRPCSTATUSCODEVALUES_FAILED_PRECONDITION:()=>c6,RPCGRPCSTATUSCODEVALUES_INTERNAL:()=>d6,RPCGRPCSTATUSCODEVALUES_INVALID_ARGUMENT:()=>n6,RPCGRPCSTATUSCODEVALUES_NOT_FOUND:()=>o6,RPCGRPCSTATUSCODEVALUES_OK:()=>ZZ,RPCGRPCSTATUSCODEVALUES_OUT_OF_RANGE:()=>l6,RPCGRPCSTATUSCODEVALUES_PERMISSION_DENIED:()=>i6,RPCGRPCSTATUSCODEVALUES_RESOURCE_EXHAUSTED:()=>a6,RPCGRPCSTATUSCODEVALUES_UNAUTHENTICATED:()=>m6,RPCGRPCSTATUSCODEVALUES_UNAVAILABLE:()=>_6,RPCGRPCSTATUSCODEVALUES_UNIMPLEMENTED:()=>p6,RPCGRPCSTATUSCODEVALUES_UNKNOWN:()=>t6,RpcGrpcStatusCodeValues:()=>h6,SEMATTRS_AWS_DYNAMODB_ATTRIBUTES_TO_GET:()=>KX,SEMATTRS_AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS:()=>aJ,SEMATTRS_AWS_DYNAMODB_CONSISTENT_READ:()=>YX,SEMATTRS_AWS_DYNAMODB_CONSUMED_CAPACITY:()=>FX,SEMATTRS_AWS_DYNAMODB_COUNT:()=>sJ,SEMATTRS_AWS_DYNAMODB_EXCLUSIVE_START_TABLE:()=>eJ,SEMATTRS_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES:()=>JX,SEMATTRS_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES:()=>cJ,SEMATTRS_AWS_DYNAMODB_INDEX_NAME:()=>QX,SEMATTRS_AWS_DYNAMODB_ITEM_COLLECTION_METRICS:()=>VX,SEMATTRS_AWS_DYNAMODB_LIMIT:()=>zX,SEMATTRS_AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES:()=>ZX,SEMATTRS_AWS_DYNAMODB_PROJECTION:()=>WX,SEMATTRS_AWS_DYNAMODB_PROVISIONED_READ_CAPACITY:()=>qX,SEMATTRS_AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY:()=>$X,SEMATTRS_AWS_DYNAMODB_SCANNED_COUNT:()=>iJ,SEMATTRS_AWS_DYNAMODB_SCAN_FORWARD:()=>nJ,SEMATTRS_AWS_DYNAMODB_SEGMENT:()=>rJ,SEMATTRS_AWS_DYNAMODB_SELECT:()=>XX,SEMATTRS_AWS_DYNAMODB_TABLE_COUNT:()=>tJ,SEMATTRS_AWS_DYNAMODB_TABLE_NAMES:()=>HX,SEMATTRS_AWS_DYNAMODB_TOTAL_SEGMENTS:()=>oJ,SEMATTRS_AWS_LAMBDA_INVOKED_ARN:()=>LQ,SEMATTRS_CODE_FILEPATH:()=>xX,SEMATTRS_CODE_FUNCTION:()=>PX,SEMATTRS_CODE_LINENO:()=>vX,SEMATTRS_CODE_NAMESPACE:()=>MX,SEMATTRS_DB_CASSANDRA_CONSISTENCY_LEVEL:()=>FQ,SEMATTRS_DB_CASSANDRA_COORDINATOR_DC:()=>WQ,SEMATTRS_DB_CASSANDRA_COORDINATOR_ID:()=>YQ,SEMATTRS_DB_CASSANDRA_IDEMPOTENCE:()=>qQ,SEMATTRS_DB_CASSANDRA_KEYSPACE:()=>jQ,SEMATTRS_DB_CASSANDRA_PAGE_SIZE:()=>HQ,SEMATTRS_DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT:()=>$Q,SEMATTRS_DB_CASSANDRA_TABLE:()=>VQ,SEMATTRS_DB_CONNECTION_STRING:()=>DQ,SEMATTRS_DB_HBASE_NAMESPACE:()=>zQ,SEMATTRS_DB_JDBC_DRIVER_CLASSNAME:()=>wQ,SEMATTRS_DB_MONGODB_COLLECTION:()=>QQ,SEMATTRS_DB_MSSQL_INSTANCE_NAME:()=>BQ,SEMATTRS_DB_NAME:()=>kQ,SEMATTRS_DB_OPERATION:()=>GQ,SEMATTRS_DB_REDIS_DATABASE_INDEX:()=>KQ,SEMATTRS_DB_SQL_TABLE:()=>XQ,SEMATTRS_DB_STATEMENT:()=>Qg,SEMATTRS_DB_SYSTEM:()=>Kg,SEMATTRS_DB_USER:()=>UQ,SEMATTRS_ENDUSER_ID:()=>IX,SEMATTRS_ENDUSER_ROLE:()=>OX,SEMATTRS_ENDUSER_SCOPE:()=>NX,SEMATTRS_EXCEPTION_ESCAPED:()=>tX,SEMATTRS_EXCEPTION_MESSAGE:()=>ZQ,SEMATTRS_EXCEPTION_STACKTRACE:()=>eX,SEMATTRS_EXCEPTION_TYPE:()=>JQ,SEMATTRS_FAAS_COLDSTART:()=>uX,SEMATTRS_FAAS_CRON:()=>cX,SEMATTRS_FAAS_DOCUMENT_COLLECTION:()=>rX,SEMATTRS_FAAS_DOCUMENT_NAME:()=>iX,SEMATTRS_FAAS_DOCUMENT_OPERATION:()=>oX,SEMATTRS_FAAS_DOCUMENT_TIME:()=>sX,SEMATTRS_FAAS_EXECUTION:()=>nX,SEMATTRS_FAAS_INVOKED_NAME:()=>lX,SEMATTRS_FAAS_INVOKED_PROVIDER:()=>pX,SEMATTRS_FAAS_INVOKED_REGION:()=>dX,SEMATTRS_FAAS_TIME:()=>aX,SEMATTRS_FAAS_TRIGGER:()=>Xg,SEMATTRS_HTTP_CLIENT_IP:()=>jX,SEMATTRS_HTTP_FLAVOR:()=>UX,SEMATTRS_HTTP_HOST:()=>LX,SEMATTRS_HTTP_METHOD:()=>bl,SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH:()=>kX,SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED:()=>GX,SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH:()=>nA,SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED:()=>rA,SEMATTRS_HTTP_ROUTE:()=>oA,SEMATTRS_HTTP_SCHEME:()=>DX,SEMATTRS_HTTP_SERVER_NAME:()=>BX,SEMATTRS_HTTP_STATUS_CODE:()=>Pi,SEMATTRS_HTTP_TARGET:()=>tA,SEMATTRS_HTTP_URL:()=>Za,SEMATTRS_HTTP_USER_AGENT:()=>wX,SEMATTRS_MESSAGE_COMPRESSED_SIZE:()=>UJ,SEMATTRS_MESSAGE_ID:()=>DJ,SEMATTRS_MESSAGE_TYPE:()=>LJ,SEMATTRS_MESSAGE_UNCOMPRESSED_SIZE:()=>wJ,SEMATTRS_MESSAGING_CONSUMER_ID:()=>gJ,SEMATTRS_MESSAGING_CONVERSATION_ID:()=>hJ,SEMATTRS_MESSAGING_DESTINATION:()=>uJ,SEMATTRS_MESSAGING_DESTINATION_KIND:()=>lJ,SEMATTRS_MESSAGING_KAFKA_CLIENT_ID:()=>IJ,SEMATTRS_MESSAGING_KAFKA_CONSUMER_GROUP:()=>yJ,SEMATTRS_MESSAGING_KAFKA_MESSAGE_KEY:()=>RJ,SEMATTRS_MESSAGING_KAFKA_PARTITION:()=>OJ,SEMATTRS_MESSAGING_KAFKA_TOMBSTONE:()=>NJ,SEMATTRS_MESSAGING_MESSAGE_ID:()=>mJ,SEMATTRS_MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES:()=>EJ,SEMATTRS_MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES:()=>TJ,SEMATTRS_MESSAGING_OPERATION:()=>SJ,SEMATTRS_MESSAGING_PROTOCOL:()=>dJ,SEMATTRS_MESSAGING_PROTOCOL_VERSION:()=>_J,SEMATTRS_MESSAGING_RABBITMQ_ROUTING_KEY:()=>AJ,SEMATTRS_MESSAGING_SYSTEM:()=>sA,SEMATTRS_MESSAGING_TEMP_DESTINATION:()=>pJ,SEMATTRS_MESSAGING_URL:()=>fJ,SEMATTRS_NET_HOST_CARRIER_ICC:()=>RX,SEMATTRS_NET_HOST_CARRIER_MCC:()=>gX,SEMATTRS_NET_HOST_CARRIER_MNC:()=>AX,SEMATTRS_NET_HOST_CARRIER_NAME:()=>SX,SEMATTRS_NET_HOST_CONNECTION_SUBTYPE:()=>EX,SEMATTRS_NET_HOST_CONNECTION_TYPE:()=>TX,SEMATTRS_NET_HOST_IP:()=>Zg,SEMATTRS_NET_HOST_NAME:()=>hX,SEMATTRS_NET_HOST_PORT:()=>eA,SEMATTRS_NET_PEER_IP:()=>Jg,SEMATTRS_NET_PEER_NAME:()=>mX,SEMATTRS_NET_PEER_PORT:()=>fX,SEMATTRS_NET_TRANSPORT:()=>_X,SEMATTRS_PEER_SERVICE:()=>yX,SEMATTRS_RPC_GRPC_STATUS_CODE:()=>aA,SEMATTRS_RPC_JSONRPC_ERROR_CODE:()=>xJ,SEMATTRS_RPC_JSONRPC_ERROR_MESSAGE:()=>vJ,SEMATTRS_RPC_JSONRPC_REQUEST_ID:()=>MJ,SEMATTRS_RPC_JSONRPC_VERSION:()=>PJ,SEMATTRS_RPC_METHOD:()=>CJ,SEMATTRS_RPC_SERVICE:()=>iA,SEMATTRS_RPC_SYSTEM:()=>bJ,SEMATTRS_THREAD_ID:()=>bX,SEMATTRS_THREAD_NAME:()=>CX,SEMRESATTRS_AWS_ECS_CLUSTER_ARN:()=>N6,SEMRESATTRS_AWS_ECS_CONTAINER_ARN:()=>O6,SEMRESATTRS_AWS_ECS_LAUNCHTYPE:()=>b6,SEMRESATTRS_AWS_ECS_TASK_ARN:()=>C6,SEMRESATTRS_AWS_ECS_TASK_FAMILY:()=>P6,SEMRESATTRS_AWS_ECS_TASK_REVISION:()=>M6,SEMRESATTRS_AWS_EKS_CLUSTER_ARN:()=>x6,SEMRESATTRS_AWS_LOG_GROUP_ARNS:()=>L6,SEMRESATTRS_AWS_LOG_GROUP_NAMES:()=>v6,SEMRESATTRS_AWS_LOG_STREAM_ARNS:()=>U6,SEMRESATTRS_AWS_LOG_STREAM_NAMES:()=>D6,SEMRESATTRS_CLOUD_ACCOUNT_ID:()=>A6,SEMRESATTRS_CLOUD_AVAILABILITY_ZONE:()=>y6,SEMRESATTRS_CLOUD_PLATFORM:()=>I6,SEMRESATTRS_CLOUD_PROVIDER:()=>g6,SEMRESATTRS_CLOUD_REGION:()=>R6,SEMRESATTRS_CONTAINER_ID:()=>k6,SEMRESATTRS_CONTAINER_IMAGE_NAME:()=>B6,SEMRESATTRS_CONTAINER_IMAGE_TAG:()=>j6,SEMRESATTRS_CONTAINER_NAME:()=>w6,SEMRESATTRS_CONTAINER_RUNTIME:()=>G6,SEMRESATTRS_DEPLOYMENT_ENVIRONMENT:()=>H6,SEMRESATTRS_DEVICE_ID:()=>F6,SEMRESATTRS_DEVICE_MODEL_IDENTIFIER:()=>V6,SEMRESATTRS_DEVICE_MODEL_NAME:()=>q6,SEMRESATTRS_FAAS_ID:()=>Y6,SEMRESATTRS_FAAS_INSTANCE:()=>z6,SEMRESATTRS_FAAS_MAX_MEMORY:()=>K6,SEMRESATTRS_FAAS_NAME:()=>$6,SEMRESATTRS_FAAS_VERSION:()=>W6,SEMRESATTRS_HOST_ARCH:()=>Z6,SEMRESATTRS_HOST_ID:()=>Q6,SEMRESATTRS_HOST_IMAGE_ID:()=>t8,SEMRESATTRS_HOST_IMAGE_NAME:()=>e8,SEMRESATTRS_HOST_IMAGE_VERSION:()=>n8,SEMRESATTRS_HOST_NAME:()=>X6,SEMRESATTRS_HOST_TYPE:()=>J6,SEMRESATTRS_K8S_CLUSTER_NAME:()=>r8,SEMRESATTRS_K8S_CONTAINER_NAME:()=>u8,SEMRESATTRS_K8S_CRONJOB_NAME:()=>A8,SEMRESATTRS_K8S_CRONJOB_UID:()=>g8,SEMRESATTRS_K8S_DAEMONSET_NAME:()=>T8,SEMRESATTRS_K8S_DAEMONSET_UID:()=>h8,SEMRESATTRS_K8S_DEPLOYMENT_NAME:()=>_8,SEMRESATTRS_K8S_DEPLOYMENT_UID:()=>d8,SEMRESATTRS_K8S_JOB_NAME:()=>S8,SEMRESATTRS_K8S_JOB_UID:()=>E8,SEMRESATTRS_K8S_NAMESPACE_NAME:()=>i8,SEMRESATTRS_K8S_NODE_NAME:()=>o8,SEMRESATTRS_K8S_NODE_UID:()=>s8,SEMRESATTRS_K8S_POD_NAME:()=>c8,SEMRESATTRS_K8S_POD_UID:()=>a8,SEMRESATTRS_K8S_REPLICASET_NAME:()=>p8,SEMRESATTRS_K8S_REPLICASET_UID:()=>l8,SEMRESATTRS_K8S_STATEFULSET_NAME:()=>m8,SEMRESATTRS_K8S_STATEFULSET_UID:()=>f8,SEMRESATTRS_OS_DESCRIPTION:()=>y8,SEMRESATTRS_OS_NAME:()=>I8,SEMRESATTRS_OS_TYPE:()=>R8,SEMRESATTRS_OS_VERSION:()=>O8,SEMRESATTRS_PROCESS_COMMAND:()=>P8,SEMRESATTRS_PROCESS_COMMAND_ARGS:()=>x8,SEMRESATTRS_PROCESS_COMMAND_LINE:()=>M8,SEMRESATTRS_PROCESS_EXECUTABLE_NAME:()=>b8,SEMRESATTRS_PROCESS_EXECUTABLE_PATH:()=>C8,SEMRESATTRS_PROCESS_OWNER:()=>v8,SEMRESATTRS_PROCESS_PID:()=>N8,SEMRESATTRS_PROCESS_RUNTIME_DESCRIPTION:()=>U8,SEMRESATTRS_PROCESS_RUNTIME_NAME:()=>L8,SEMRESATTRS_PROCESS_RUNTIME_VERSION:()=>D8,SEMRESATTRS_SERVICE_INSTANCE_ID:()=>k8,SEMRESATTRS_SERVICE_NAME:()=>w8,SEMRESATTRS_SERVICE_NAMESPACE:()=>cA,SEMRESATTRS_SERVICE_VERSION:()=>G8,SEMRESATTRS_TELEMETRY_AUTO_VERSION:()=>F8,SEMRESATTRS_TELEMETRY_SDK_LANGUAGE:()=>j8,SEMRESATTRS_TELEMETRY_SDK_NAME:()=>B8,SEMRESATTRS_TELEMETRY_SDK_VERSION:()=>H8,SEMRESATTRS_WEBENGINE_DESCRIPTION:()=>$8,SEMRESATTRS_WEBENGINE_NAME:()=>V8,SEMRESATTRS_WEBENGINE_VERSION:()=>q8,SIGNALR_CONNECTION_STATUS_VALUE_APP_SHUTDOWN:()=>Lte,SIGNALR_CONNECTION_STATUS_VALUE_NORMAL_CLOSURE:()=>Dte,SIGNALR_CONNECTION_STATUS_VALUE_TIMEOUT:()=>Ute,SIGNALR_TRANSPORT_VALUE_LONG_POLLING:()=>kte,SIGNALR_TRANSPORT_VALUE_SERVER_SENT_EVENTS:()=>Gte,SIGNALR_TRANSPORT_VALUE_WEB_SOCKETS:()=>Bte,SemanticAttributes:()=>kJ,SemanticResourceAttributes:()=>Y8,TELEMETRYSDKLANGUAGEVALUES_CPP:()=>B7,TELEMETRYSDKLANGUAGEVALUES_DOTNET:()=>j7,TELEMETRYSDKLANGUAGEVALUES_ERLANG:()=>H7,TELEMETRYSDKLANGUAGEVALUES_GO:()=>F7,TELEMETRYSDKLANGUAGEVALUES_JAVA:()=>V7,TELEMETRYSDKLANGUAGEVALUES_NODEJS:()=>q7,TELEMETRYSDKLANGUAGEVALUES_PHP:()=>$7,TELEMETRYSDKLANGUAGEVALUES_PYTHON:()=>Y7,TELEMETRYSDKLANGUAGEVALUES_RUBY:()=>W7,TELEMETRYSDKLANGUAGEVALUES_WEBJS:()=>z7,TELEMETRY_SDK_LANGUAGE_VALUE_CPP:()=>Hte,TELEMETRY_SDK_LANGUAGE_VALUE_DOTNET:()=>Fte,TELEMETRY_SDK_LANGUAGE_VALUE_ERLANG:()=>Vte,TELEMETRY_SDK_LANGUAGE_VALUE_GO:()=>qte,TELEMETRY_SDK_LANGUAGE_VALUE_JAVA:()=>$te,TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS:()=>Yte,TELEMETRY_SDK_LANGUAGE_VALUE_PHP:()=>Wte,TELEMETRY_SDK_LANGUAGE_VALUE_PYTHON:()=>zte,TELEMETRY_SDK_LANGUAGE_VALUE_RUBY:()=>Kte,TELEMETRY_SDK_LANGUAGE_VALUE_RUST:()=>Qte,TELEMETRY_SDK_LANGUAGE_VALUE_SWIFT:()=>Xte,TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS:()=>Jte,TelemetrySdkLanguageValues:()=>K7});var le=z(()=>{G0();lw();pw();dw();_w()});var fw=E(v_=>{"use strict";Object.defineProperty(v_,"__esModule",{value:!0});v_.ATTR_PROCESS_RUNTIME_NAME=void 0;v_.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name"});var mw=E(D_=>{"use strict";Object.defineProperty(D_,"__esModule",{value:!0});D_.SDK_INFO=void 0;var rre=WP(),L_=(le(),O(Ae)),ore=fw();D_.SDK_INFO={[L_.ATTR_TELEMETRY_SDK_NAME]:"opentelemetry",[ore.ATTR_PROCESS_RUNTIME_NAME]:"node",[L_.ATTR_TELEMETRY_SDK_LANGUAGE]:L_.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[L_.ATTR_TELEMETRY_SDK_VERSION]:rre.VERSION}});var hw=E($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.otperformance=$t.SDK_INFO=$t._globalThis=$t.getStringListFromEnv=$t.getNumberFromEnv=$t.getBooleanFromEnv=$t.getStringFromEnv=void 0;var U_=$P();Object.defineProperty($t,"getStringFromEnv",{enumerable:!0,get:function(){return U_.getStringFromEnv}});Object.defineProperty($t,"getBooleanFromEnv",{enumerable:!0,get:function(){return U_.getBooleanFromEnv}});Object.defineProperty($t,"getNumberFromEnv",{enumerable:!0,get:function(){return U_.getNumberFromEnv}});Object.defineProperty($t,"getStringListFromEnv",{enumerable:!0,get:function(){return U_.getStringListFromEnv}});var sre=YP();Object.defineProperty($t,"_globalThis",{enumerable:!0,get:function(){return sre._globalThis}});var ire=mw();Object.defineProperty($t,"SDK_INFO",{enumerable:!0,get:function(){return ire.SDK_INFO}});$t.otperformance=performance});var yA=E(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.getStringListFromEnv=Yt.getNumberFromEnv=Yt.getStringFromEnv=Yt.getBooleanFromEnv=Yt.otperformance=Yt._globalThis=Yt.SDK_INFO=void 0;var vi=hw();Object.defineProperty(Yt,"SDK_INFO",{enumerable:!0,get:function(){return vi.SDK_INFO}});Object.defineProperty(Yt,"_globalThis",{enumerable:!0,get:function(){return vi._globalThis}});Object.defineProperty(Yt,"otperformance",{enumerable:!0,get:function(){return vi.otperformance}});Object.defineProperty(Yt,"getBooleanFromEnv",{enumerable:!0,get:function(){return vi.getBooleanFromEnv}});Object.defineProperty(Yt,"getStringFromEnv",{enumerable:!0,get:function(){return vi.getStringFromEnv}});Object.defineProperty(Yt,"getNumberFromEnv",{enumerable:!0,get:function(){return vi.getNumberFromEnv}});Object.defineProperty(Yt,"getStringListFromEnv",{enumerable:!0,get:function(){return vi.getStringListFromEnv}})});var gw=E(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.addHrTimes=be.isTimeInput=be.isTimeInputHrTime=be.hrTimeToMicroseconds=be.hrTimeToMilliseconds=be.hrTimeToNanoseconds=be.hrTimeToTimeStamp=be.hrTimeDuration=be.timeInputToHrTime=be.hrTime=be.getTimeOrigin=be.millisToHrTime=void 0;var w_=yA(),Tw=9,are=6,cre=Math.pow(10,are),k_=Math.pow(10,Tw);function Cl(t){let e=t/1e3,n=Math.trunc(e),r=Math.round(t%1e3*cre);return[n,r]}be.millisToHrTime=Cl;function ure(){return w_.otperformance.timeOrigin}be.getTimeOrigin=ure;function Ew(t){let e=Cl(w_.otperformance.timeOrigin),n=Cl(typeof t=="number"?t:w_.otperformance.now());return Sw(e,n)}be.hrTime=Ew;function lre(t){if(IA(t))return t;if(typeof t=="number")return t<w_.otperformance.timeOrigin?Ew(t):Cl(t);if(t instanceof Date)return Cl(t.getTime());throw TypeError("Invalid input type")}be.timeInputToHrTime=lre;function pre(t,e){let n=e[0]-t[0],r=e[1]-t[1];return r<0&&(n-=1,r+=k_),[n,r]}be.hrTimeDuration=pre;function dre(t){let e=Tw,n=`${"0".repeat(e)}${t[1]}Z`,r=n.substring(n.length-e-1);return new Date(t[0]*1e3).toISOString().replace("000Z",r)}be.hrTimeToTimeStamp=dre;function _re(t){return t[0]*k_+t[1]}be.hrTimeToNanoseconds=_re;function fre(t){return t[0]*1e3+t[1]/1e6}be.hrTimeToMilliseconds=fre;function mre(t){return t[0]*1e6+t[1]/1e3}be.hrTimeToMicroseconds=mre;function IA(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}be.isTimeInputHrTime=IA;function hre(t){return IA(t)||typeof t=="number"||t instanceof Date}be.isTimeInput=hre;function Sw(t,e){let n=[t[0]+e[0],t[1]+e[1]];return n[1]>=k_&&(n[1]-=k_,n[0]+=1),n}be.addHrTimes=Sw});var Aw=E(G_=>{"use strict";Object.defineProperty(G_,"__esModule",{value:!0});G_.unrefTimer=void 0;function Tre(t){typeof t!="number"&&t.unref()}G_.unrefTimer=Tre});var Rw=E(Pl=>{"use strict";Object.defineProperty(Pl,"__esModule",{value:!0});Pl.ExportResultCode=void 0;var Ere;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(Ere=Pl.ExportResultCode||(Pl.ExportResultCode={}))});var Iw=E(B_=>{"use strict";Object.defineProperty(B_,"__esModule",{value:!0});B_.CompositePropagator=void 0;var yw=(b(),O(v)),OA=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[],this._fields=Array.from(new Set(this._propagators.map(n=>typeof n.fields=="function"?n.fields():[]).reduce((n,r)=>n.concat(r),[])))}inject(e,n,r){for(let o of this._propagators)try{o.inject(e,n,r)}catch(s){yw.diag.warn(`Failed to inject with ${o.constructor.name}. Err: ${s.message}`)}}extract(e,n,r){return this._propagators.reduce((o,s)=>{try{return s.extract(o,n,r)}catch(i){yw.diag.warn(`Failed to extract with ${s.constructor.name}. Err: ${i.message}`)}return o},e)}fields(){return this._fields.slice()}};B_.CompositePropagator=OA});var Ow=E(tc=>{"use strict";Object.defineProperty(tc,"__esModule",{value:!0});tc.validateValue=tc.validateKey=void 0;var NA="[_0-9a-z-*/]",Sre=`[a-z]${NA}{0,255}`,gre=`[a-z0-9]${NA}{0,240}@[a-z]${NA}{0,13}`,Are=new RegExp(`^(?:${Sre}|${gre})$`),Rre=/^[ -~]{0,255}[!-~]$/,yre=/,|=/;function Ire(t){return Are.test(t)}tc.validateKey=Ire;function Ore(t){return Rre.test(t)&&!yre.test(t)}tc.validateValue=Ore});var CA=E(j_=>{"use strict";Object.defineProperty(j_,"__esModule",{value:!0});j_.TraceState=void 0;var Nw=Ow(),bw=32,Nre=512,Cw=",",Pw="=",bA=class t{_internalState=new Map;constructor(e){e&&this._parse(e)}set(e,n){let r=this._clone();return r._internalState.has(e)&&r._internalState.delete(e),r._internalState.set(e,n),r}unset(e){let n=this._clone();return n._internalState.delete(e),n}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,n)=>(e.push(n+Pw+this.get(n)),e),[]).join(Cw)}_parse(e){e.length>Nre||(this._internalState=e.split(Cw).reverse().reduce((n,r)=>{let o=r.trim(),s=o.indexOf(Pw);if(s!==-1){let i=o.slice(0,s),a=o.slice(s+1,r.length);(0,Nw.validateKey)(i)&&(0,Nw.validateValue)(a)&&n.set(i,a)}return n},new Map),this._internalState.size>bw&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,bw))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}};j_.TraceState=bA});var xw=E(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.W3CTraceContextPropagator=Wt.parseTraceParent=Wt.TRACE_STATE_HEADER=Wt.TRACE_PARENT_HEADER=void 0;var H_=(b(),O(v)),bre=Nl(),Cre=CA();Wt.TRACE_PARENT_HEADER="traceparent";Wt.TRACE_STATE_HEADER="tracestate";var Pre="00",Mre="(?!ff)[\\da-f]{2}",xre="(?![0]{32})[\\da-f]{32}",vre="(?![0]{16})[\\da-f]{16}",Lre="[\\da-f]{2}",Dre=new RegExp(`^\\s?(${Mre})-(${xre})-(${vre})-(${Lre})(-.*)?\\s?$`);function Mw(t){let e=Dre.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}Wt.parseTraceParent=Mw;var PA=class{inject(e,n,r){let o=H_.trace.getSpanContext(e);if(!o||(0,bre.isTracingSuppressed)(e)||!(0,H_.isSpanContextValid)(o))return;let s=`${Pre}-${o.traceId}-${o.spanId}-0${Number(o.traceFlags||H_.TraceFlags.NONE).toString(16)}`;r.set(n,Wt.TRACE_PARENT_HEADER,s),o.traceState&&r.set(n,Wt.TRACE_STATE_HEADER,o.traceState.serialize())}extract(e,n,r){let o=r.get(n,Wt.TRACE_PARENT_HEADER);if(!o)return e;let s=Array.isArray(o)?o[0]:o;if(typeof s!="string")return e;let i=Mw(s);if(!i)return e;i.isRemote=!0;let a=r.get(n,Wt.TRACE_STATE_HEADER);if(a){let c=Array.isArray(a)?a.join(","):a;i.traceState=new Cre.TraceState(typeof c=="string"?c:void 0)}return H_.trace.setSpanContext(e,i)}fields(){return[Wt.TRACE_PARENT_HEADER,Wt.TRACE_STATE_HEADER]}};Wt.W3CTraceContextPropagator=PA});var vw=E(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.getRPCMetadata=Rr.deleteRPCMetadata=Rr.setRPCMetadata=Rr.RPCType=void 0;var Ure=(b(),O(v)),MA=(0,Ure.createContextKey)("OpenTelemetry SDK Context Key RPC_METADATA"),wre;(function(t){t.HTTP="http"})(wre=Rr.RPCType||(Rr.RPCType={}));function kre(t,e){return t.setValue(MA,e)}Rr.setRPCMetadata=kre;function Gre(t){return t.deleteValue(MA)}Rr.deleteRPCMetadata=Gre;function Bre(t){return t.getValue(MA)}Rr.getRPCMetadata=Bre});var kw=E(F_=>{"use strict";Object.defineProperty(F_,"__esModule",{value:!0});F_.isPlainObject=void 0;var jre="[object Object]",Hre="[object Null]",Fre="[object Undefined]",Vre=Function.prototype,Lw=Vre.toString,qre=Lw.call(Object),$re=Object.getPrototypeOf,Dw=Object.prototype,Uw=Dw.hasOwnProperty,Li=Symbol?Symbol.toStringTag:void 0,ww=Dw.toString;function Yre(t){if(!Wre(t)||zre(t)!==jre)return!1;let e=$re(t);if(e===null)return!0;let n=Uw.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&Lw.call(n)===qre}F_.isPlainObject=Yre;function Wre(t){return t!=null&&typeof t=="object"}function zre(t){return t==null?t===void 0?Fre:Hre:Li&&Li in Object(t)?Kre(t):Qre(t)}function Kre(t){let e=Uw.call(t,Li),n=t[Li],r=!1;try{t[Li]=void 0,r=!0}catch{}let o=ww.call(t);return r&&(e?t[Li]=n:delete t[Li]),o}function Qre(t){return ww.call(t)}});var Fw=E($_=>{"use strict";Object.defineProperty($_,"__esModule",{value:!0});$_.merge=void 0;var Gw=kw(),Xre=20;function Jre(...t){let e=t.shift(),n=new WeakMap;for(;t.length>0;)e=jw(e,t.shift(),0,n);return e}$_.merge=Jre;function xA(t){return q_(t)?t.slice():t}function jw(t,e,n=0,r){let o;if(!(n>Xre)){if(n++,V_(t)||V_(e)||Hw(e))o=xA(e);else if(q_(t)){if(o=t.slice(),q_(e))for(let s=0,i=e.length;s<i;s++)o.push(xA(e[s]));else if(Ml(e)){let s=Object.keys(e);for(let i=0,a=s.length;i<a;i++){let c=s[i];o[c]=xA(e[c])}}}else if(Ml(t))if(Ml(e)){if(!Zre(t,e))return e;o=Object.assign({},t);let s=Object.keys(e);for(let i=0,a=s.length;i<a;i++){let c=s[i],l=e[c];if(V_(l))typeof l>"u"?delete o[c]:o[c]=l;else{let p=o[c],d=l;if(Bw(t,c,r)||Bw(e,c,r))delete o[c];else{if(Ml(p)&&Ml(d)){let _=r.get(p)||[],f=r.get(d)||[];_.push({obj:t,key:c}),f.push({obj:e,key:c}),r.set(p,_),r.set(d,f)}o[c]=jw(o[c],l,n,r)}}}}else o=e;return o}}function Bw(t,e,n){let r=n.get(t[e])||[];for(let o=0,s=r.length;o<s;o++){let i=r[o];if(i.key===e&&i.obj===t)return!0}return!1}function q_(t){return Array.isArray(t)}function Hw(t){return typeof t=="function"}function Ml(t){return!V_(t)&&!q_(t)&&!Hw(t)&&typeof t=="object"}function V_(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t>"u"||t instanceof Date||t instanceof RegExp||t===null}function Zre(t,e){return!(!(0,Gw.isPlainObject)(t)||!(0,Gw.isPlainObject)(e))}});var Vw=E(nc=>{"use strict";Object.defineProperty(nc,"__esModule",{value:!0});nc.callWithTimeout=nc.TimeoutError=void 0;var Y_=class t extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};nc.TimeoutError=Y_;function eoe(t,e){let n,r=new Promise(function(s,i){n=setTimeout(function(){i(new Y_("Operation timed out."))},e)});return Promise.race([t,r]).then(o=>(clearTimeout(n),o),o=>{throw clearTimeout(n),o})}nc.callWithTimeout=eoe});var $w=E(rc=>{"use strict";Object.defineProperty(rc,"__esModule",{value:!0});rc.isUrlIgnored=rc.urlMatches=void 0;function qw(t,e){return typeof e=="string"?t===e:!!t.match(e)}rc.urlMatches=qw;function toe(t,e){if(!e)return!1;for(let n of e)if(qw(t,n))return!0;return!1}rc.isUrlIgnored=toe});var Yw=E(W_=>{"use strict";Object.defineProperty(W_,"__esModule",{value:!0});W_.Deferred=void 0;var vA=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,n)=>{this._resolve=e,this._reject=n})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}};W_.Deferred=vA});var Ww=E(z_=>{"use strict";Object.defineProperty(z_,"__esModule",{value:!0});z_.BindOnceFuture=void 0;var noe=Yw(),LA=class{_isCalled=!1;_deferred=new noe.Deferred;_callback;_that;constructor(e,n){this._callback=e,this._that=n}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(n=>this._deferred.resolve(n),n=>this._deferred.reject(n))}catch(n){this._deferred.reject(n)}}return this._deferred.promise}};z_.BindOnceFuture=LA});var Kw=E(K_=>{"use strict";Object.defineProperty(K_,"__esModule",{value:!0});K_.diagLogLevelFromString=void 0;var Po=(b(),O(v)),zw={ALL:Po.DiagLogLevel.ALL,VERBOSE:Po.DiagLogLevel.VERBOSE,DEBUG:Po.DiagLogLevel.DEBUG,INFO:Po.DiagLogLevel.INFO,WARN:Po.DiagLogLevel.WARN,ERROR:Po.DiagLogLevel.ERROR,NONE:Po.DiagLogLevel.NONE};function roe(t){if(t==null)return;let e=zw[t.toUpperCase()];return e??(Po.diag.warn(`Unknown log level "${t}", expected one of ${Object.keys(zw)}, using default`),Po.DiagLogLevel.INFO)}K_.diagLogLevelFromString=roe});var Xw=E(Q_=>{"use strict";Object.defineProperty(Q_,"__esModule",{value:!0});Q_._export=void 0;var Qw=(b(),O(v)),ooe=Nl();function soe(t,e){return new Promise(n=>{Qw.context.with((0,ooe.suppressTracing)(Qw.context.active()),()=>{t.export(e,n)})})}Q_._export=soe});var Te=E(y=>{"use strict";Object.defineProperty(y,"__esModule",{value:!0});y.internal=y.diagLogLevelFromString=y.BindOnceFuture=y.urlMatches=y.isUrlIgnored=y.callWithTimeout=y.TimeoutError=y.merge=y.TraceState=y.unsuppressTracing=y.suppressTracing=y.isTracingSuppressed=y.setRPCMetadata=y.getRPCMetadata=y.deleteRPCMetadata=y.RPCType=y.parseTraceParent=y.W3CTraceContextPropagator=y.TRACE_STATE_HEADER=y.TRACE_PARENT_HEADER=y.CompositePropagator=y.otperformance=y.getStringListFromEnv=y.getNumberFromEnv=y.getBooleanFromEnv=y.getStringFromEnv=y._globalThis=y.SDK_INFO=y.parseKeyPairsIntoRecord=y.ExportResultCode=y.unrefTimer=y.timeInputToHrTime=y.millisToHrTime=y.isTimeInputHrTime=y.isTimeInput=y.hrTimeToTimeStamp=y.hrTimeToNanoseconds=y.hrTimeToMilliseconds=y.hrTimeToMicroseconds=y.hrTimeDuration=y.hrTime=y.getTimeOrigin=y.addHrTimes=y.loggingErrorHandler=y.setGlobalErrorHandler=y.globalErrorHandler=y.sanitizeAttributes=y.isAttributeValue=y.AnchoredClock=y.W3CBaggagePropagator=void 0;var ioe=LP();Object.defineProperty(y,"W3CBaggagePropagator",{enumerable:!0,get:function(){return ioe.W3CBaggagePropagator}});var aoe=DP();Object.defineProperty(y,"AnchoredClock",{enumerable:!0,get:function(){return aoe.AnchoredClock}});var Jw=BP();Object.defineProperty(y,"isAttributeValue",{enumerable:!0,get:function(){return Jw.isAttributeValue}});Object.defineProperty(y,"sanitizeAttributes",{enumerable:!0,get:function(){return Jw.sanitizeAttributes}});var Zw=HP();Object.defineProperty(y,"globalErrorHandler",{enumerable:!0,get:function(){return Zw.globalErrorHandler}});Object.defineProperty(y,"setGlobalErrorHandler",{enumerable:!0,get:function(){return Zw.setGlobalErrorHandler}});var coe=Wg();Object.defineProperty(y,"loggingErrorHandler",{enumerable:!0,get:function(){return coe.loggingErrorHandler}});var Qn=gw();Object.defineProperty(y,"addHrTimes",{enumerable:!0,get:function(){return Qn.addHrTimes}});Object.defineProperty(y,"getTimeOrigin",{enumerable:!0,get:function(){return Qn.getTimeOrigin}});Object.defineProperty(y,"hrTime",{enumerable:!0,get:function(){return Qn.hrTime}});Object.defineProperty(y,"hrTimeDuration",{enumerable:!0,get:function(){return Qn.hrTimeDuration}});Object.defineProperty(y,"hrTimeToMicroseconds",{enumerable:!0,get:function(){return Qn.hrTimeToMicroseconds}});Object.defineProperty(y,"hrTimeToMilliseconds",{enumerable:!0,get:function(){return Qn.hrTimeToMilliseconds}});Object.defineProperty(y,"hrTimeToNanoseconds",{enumerable:!0,get:function(){return Qn.hrTimeToNanoseconds}});Object.defineProperty(y,"hrTimeToTimeStamp",{enumerable:!0,get:function(){return Qn.hrTimeToTimeStamp}});Object.defineProperty(y,"isTimeInput",{enumerable:!0,get:function(){return Qn.isTimeInput}});Object.defineProperty(y,"isTimeInputHrTime",{enumerable:!0,get:function(){return Qn.isTimeInputHrTime}});Object.defineProperty(y,"millisToHrTime",{enumerable:!0,get:function(){return Qn.millisToHrTime}});Object.defineProperty(y,"timeInputToHrTime",{enumerable:!0,get:function(){return Qn.timeInputToHrTime}});var uoe=Aw();Object.defineProperty(y,"unrefTimer",{enumerable:!0,get:function(){return uoe.unrefTimer}});var loe=Rw();Object.defineProperty(y,"ExportResultCode",{enumerable:!0,get:function(){return loe.ExportResultCode}});var poe=Fg();Object.defineProperty(y,"parseKeyPairsIntoRecord",{enumerable:!0,get:function(){return poe.parseKeyPairsIntoRecord}});var Di=yA();Object.defineProperty(y,"SDK_INFO",{enumerable:!0,get:function(){return Di.SDK_INFO}});Object.defineProperty(y,"_globalThis",{enumerable:!0,get:function(){return Di._globalThis}});Object.defineProperty(y,"getStringFromEnv",{enumerable:!0,get:function(){return Di.getStringFromEnv}});Object.defineProperty(y,"getBooleanFromEnv",{enumerable:!0,get:function(){return Di.getBooleanFromEnv}});Object.defineProperty(y,"getNumberFromEnv",{enumerable:!0,get:function(){return Di.getNumberFromEnv}});Object.defineProperty(y,"getStringListFromEnv",{enumerable:!0,get:function(){return Di.getStringListFromEnv}});Object.defineProperty(y,"otperformance",{enumerable:!0,get:function(){return Di.otperformance}});var doe=Iw();Object.defineProperty(y,"CompositePropagator",{enumerable:!0,get:function(){return doe.CompositePropagator}});var X_=xw();Object.defineProperty(y,"TRACE_PARENT_HEADER",{enumerable:!0,get:function(){return X_.TRACE_PARENT_HEADER}});Object.defineProperty(y,"TRACE_STATE_HEADER",{enumerable:!0,get:function(){return X_.TRACE_STATE_HEADER}});Object.defineProperty(y,"W3CTraceContextPropagator",{enumerable:!0,get:function(){return X_.W3CTraceContextPropagator}});Object.defineProperty(y,"parseTraceParent",{enumerable:!0,get:function(){return X_.parseTraceParent}});var J_=vw();Object.defineProperty(y,"RPCType",{enumerable:!0,get:function(){return J_.RPCType}});Object.defineProperty(y,"deleteRPCMetadata",{enumerable:!0,get:function(){return J_.deleteRPCMetadata}});Object.defineProperty(y,"getRPCMetadata",{enumerable:!0,get:function(){return J_.getRPCMetadata}});Object.defineProperty(y,"setRPCMetadata",{enumerable:!0,get:function(){return J_.setRPCMetadata}});var DA=Nl();Object.defineProperty(y,"isTracingSuppressed",{enumerable:!0,get:function(){return DA.isTracingSuppressed}});Object.defineProperty(y,"suppressTracing",{enumerable:!0,get:function(){return DA.suppressTracing}});Object.defineProperty(y,"unsuppressTracing",{enumerable:!0,get:function(){return DA.unsuppressTracing}});var _oe=CA();Object.defineProperty(y,"TraceState",{enumerable:!0,get:function(){return _oe.TraceState}});var foe=Fw();Object.defineProperty(y,"merge",{enumerable:!0,get:function(){return foe.merge}});var ek=Vw();Object.defineProperty(y,"TimeoutError",{enumerable:!0,get:function(){return ek.TimeoutError}});Object.defineProperty(y,"callWithTimeout",{enumerable:!0,get:function(){return ek.callWithTimeout}});var tk=$w();Object.defineProperty(y,"isUrlIgnored",{enumerable:!0,get:function(){return tk.isUrlIgnored}});Object.defineProperty(y,"urlMatches",{enumerable:!0,get:function(){return tk.urlMatches}});var moe=Ww();Object.defineProperty(y,"BindOnceFuture",{enumerable:!0,get:function(){return moe.BindOnceFuture}});var hoe=Kw();Object.defineProperty(y,"diagLogLevelFromString",{enumerable:!0,get:function(){return hoe.diagLogLevelFromString}});var Toe=Xw();y.internal={_export:Toe._export}});var nk=E(Z_=>{"use strict";Object.defineProperty(Z_,"__esModule",{value:!0});Z_.VERSION=void 0;Z_.VERSION="0.214.0"});var rk=E(xl=>{"use strict";Object.defineProperty(xl,"__esModule",{value:!0});xl.SeverityNumber=void 0;var Eoe;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TRACE=1]="TRACE",t[t.TRACE2=2]="TRACE2",t[t.TRACE3=3]="TRACE3",t[t.TRACE4=4]="TRACE4",t[t.DEBUG=5]="DEBUG",t[t.DEBUG2=6]="DEBUG2",t[t.DEBUG3=7]="DEBUG3",t[t.DEBUG4=8]="DEBUG4",t[t.INFO=9]="INFO",t[t.INFO2=10]="INFO2",t[t.INFO3=11]="INFO3",t[t.INFO4=12]="INFO4",t[t.WARN=13]="WARN",t[t.WARN2=14]="WARN2",t[t.WARN3=15]="WARN3",t[t.WARN4=16]="WARN4",t[t.ERROR=17]="ERROR",t[t.ERROR2=18]="ERROR2",t[t.ERROR3=19]="ERROR3",t[t.ERROR4=20]="ERROR4",t[t.FATAL=21]="FATAL",t[t.FATAL2=22]="FATAL2",t[t.FATAL3=23]="FATAL3",t[t.FATAL4=24]="FATAL4"})(Eoe=xl.SeverityNumber||(xl.SeverityNumber={}))});var tf=E(oc=>{"use strict";Object.defineProperty(oc,"__esModule",{value:!0});oc.NOOP_LOGGER=oc.NoopLogger=void 0;var ef=class{emit(e){}};oc.NoopLogger=ef;oc.NOOP_LOGGER=new ef});var ok=E(Yr=>{"use strict";Object.defineProperty(Yr,"__esModule",{value:!0});Yr.API_BACKWARDS_COMPATIBILITY_VERSION=Yr.makeGetter=Yr._global=Yr.GLOBAL_LOGS_API_KEY=void 0;Yr.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");Yr._global=globalThis;function Soe(t,e,n){return r=>r===t?e:n}Yr.makeGetter=Soe;Yr.API_BACKWARDS_COMPATIBILITY_VERSION=1});var UA=E(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});sc.NOOP_LOGGER_PROVIDER=sc.NoopLoggerProvider=void 0;var goe=tf(),nf=class{getLogger(e,n,r){return new goe.NoopLogger}};sc.NoopLoggerProvider=nf;sc.NOOP_LOGGER_PROVIDER=new nf});var sk=E(rf=>{"use strict";Object.defineProperty(rf,"__esModule",{value:!0});rf.ProxyLogger=void 0;var Aoe=tf(),wA=class{constructor(e,n,r,o){this._provider=e,this.name=n,this.version=r,this.options=o}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Aoe.NOOP_LOGGER}};rf.ProxyLogger=wA});var ik=E(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});of.ProxyLoggerProvider=void 0;var Roe=UA(),yoe=sk(),kA=class{getLogger(e,n,r){var o;return(o=this._getDelegateLogger(e,n,r))!==null&&o!==void 0?o:new yoe.ProxyLogger(this,e,n,r)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:Roe.NOOP_LOGGER_PROVIDER}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,n,r){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(e,n,r)}};of.ProxyLoggerProvider=kA});var ck=E(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});sf.LogsAPI=void 0;var Xn=ok(),Ioe=UA(),ak=ik(),GA=class t{constructor(){this._proxyLoggerProvider=new ak.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return Xn._global[Xn.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(Xn._global[Xn.GLOBAL_LOGS_API_KEY]=(0,Xn.makeGetter)(Xn.API_BACKWARDS_COMPATIBILITY_VERSION,e,Ioe.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,n;return(n=(e=Xn._global[Xn.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(Xn._global,Xn.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(e,n,r){return this.getLoggerProvider().getLogger(e,n,r)}disable(){delete Xn._global[Xn.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new ak.ProxyLoggerProvider}};sf.LogsAPI=GA});var BA=E(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});Wr.logs=Wr.NoopLogger=Wr.NOOP_LOGGER=Wr.SeverityNumber=void 0;var Ooe=rk();Object.defineProperty(Wr,"SeverityNumber",{enumerable:!0,get:function(){return Ooe.SeverityNumber}});var uk=tf();Object.defineProperty(Wr,"NOOP_LOGGER",{enumerable:!0,get:function(){return uk.NOOP_LOGGER}});Object.defineProperty(Wr,"NoopLogger",{enumerable:!0,get:function(){return uk.NoopLogger}});var Noe=ck();Wr.logs=Noe.LogsAPI.getInstance()});var lk=E(ic=>{"use strict";Object.defineProperty(ic,"__esModule",{value:!0});ic.disableInstrumentations=ic.enableInstrumentations=void 0;function boe(t,e,n,r){for(let o=0,s=t.length;o<s;o++){let i=t[o];e&&i.setTracerProvider(e),n&&i.setMeterProvider(n),r&&i.setLoggerProvider&&i.setLoggerProvider(r),i.getConfig().enabled||i.enable()}}ic.enableInstrumentations=boe;function Coe(t){t.forEach(e=>e.disable())}ic.disableInstrumentations=Coe});var _k=E(af=>{"use strict";Object.defineProperty(af,"__esModule",{value:!0});af.registerInstrumentations=void 0;var pk=(b(),O(v)),Poe=BA(),dk=lk();function Moe(t){let e=t.tracerProvider||pk.trace.getTracerProvider(),n=t.meterProvider||pk.metrics.getMeterProvider(),r=t.loggerProvider||Poe.logs.getLoggerProvider(),o=t.instrumentations?.flat()??[];return(0,dk.enableInstrumentations)(o,e,n,r),()=>{(0,dk.disableInstrumentations)(o)}}af.registerInstrumentations=Moe});var Rk=E(cf=>{"use strict";Object.defineProperty(cf,"__esModule",{value:!0});cf.satisfies=void 0;var VA=(b(),O(v)),Ek=/^(?:v)?(?<version>(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*))(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<build>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,xoe=/^(?<op><|>|=|==|<=|>=|~|\^|~>)?\s*(?:v)?(?<version>(?<major>x|X|\*|0|[1-9]\d*)(?:\.(?<minor>x|X|\*|0|[1-9]\d*))?(?:\.(?<patch>x|X|\*|0|[1-9]\d*))?)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<build>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,voe={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function Loe(t,e,n){if(!Doe(t))return VA.diag.error(`Invalid version: ${t}`),!1;if(!e)return!0;e=e.replace(/([<>=~^]+)\s+/g,"$1");let r=Goe(t);if(!r)return!1;let o=[],s=Sk(r,e,o,n);return s&&!n?.includePrerelease?woe(r,o):s}cf.satisfies=Loe;function Doe(t){return typeof t=="string"&&Ek.test(t)}function Sk(t,e,n,r){if(e.includes("||")){let o=e.trim().split("||");for(let s of o)if(jA(t,s,n,r))return!0;return!1}else if(e.includes(" - "))e=sse(e,r);else if(e.includes(" ")){let o=e.trim().replace(/\s{2,}/g," ").split(" ");for(let s of o)if(!jA(t,s,n,r))return!1;return!0}return jA(t,e,n,r)}function jA(t,e,n,r){if(e=koe(e,r),e.includes(" "))return Sk(t,e,n,r);{let o=Boe(e);return n.push(o),Uoe(t,o)}}function Uoe(t,e){if(e.invalid)return!1;if(!e.version||FA(e.version))return!0;let n=mk(t.versionSegments||[],e.versionSegments||[]);if(n===0){let r=t.prereleaseSegments||[],o=e.prereleaseSegments||[];!r.length&&!o.length?n=0:!r.length&&o.length?n=1:r.length&&!o.length?n=-1:n=mk(r,o)}return voe[e.op]?.includes(n)}function woe(t,e){return t.prerelease?e.some(n=>n.prerelease&&n.version===t.version):!0}function koe(t,e){return t=t.trim(),t=rse(t,e),t=nse(t),t=ose(t,e),t=t.trim(),t}function sn(t){return!t||t.toLowerCase()==="x"||t==="*"}function Goe(t){let e=t.match(Ek);if(!e){VA.diag.error(`Invalid version: ${t}`);return}let n=e.groups.version,r=e.groups.prerelease,o=e.groups.build,s=n.split("."),i=r?.split(".");return{op:void 0,version:n,versionSegments:s,versionSegmentCount:s.length,prerelease:r,prereleaseSegments:i,prereleaseSegmentCount:i?i.length:0,build:o}}function Boe(t){if(!t)return{};let e=t.match(xoe);if(!e)return VA.diag.error(`Invalid range: ${t}`),{invalid:!0};let n=e.groups.op,r=e.groups.version,o=e.groups.prerelease,s=e.groups.build,i=r.split("."),a=o?.split(".");return n==="=="&&(n="="),{op:n||"=",version:r,versionSegments:i,versionSegmentCount:i.length,prerelease:o,prereleaseSegments:a,prereleaseSegmentCount:a?a.length:0,build:s}}function FA(t){return t==="*"||t==="x"||t==="X"}function fk(t){let e=parseInt(t,10);return isNaN(e)?t:e}function joe(t,e){if(typeof t==typeof e){if(typeof t=="number")return[t,e];if(typeof t=="string")return[t,e];throw new Error("Version segments can only be strings or numbers")}else return[String(t),String(e)]}function Hoe(t,e){if(FA(t)||FA(e))return 0;let[n,r]=joe(fk(t),fk(e));return n>r?1:n<r?-1:0}function mk(t,e){for(let n=0;n<Math.max(t.length,e.length);n++){let r=Hoe(t[n]||"0",e[n]||"0");if(r!==0)return r}return 0}var gk="[a-zA-Z0-9-]",Ak="0|[1-9]\\d*",Foe=`\\d*[a-zA-Z-]${gk}*`,Voe="((?:<|>)?=?)",hk=`(?:${Ak}|${Foe})`,qoe=`(?:-(${hk}(?:\\.${hk})*))`,Tk=`${gk}+`,$oe=`(?:\\+(${Tk}(?:\\.${Tk})*))`,HA=`${Ak}|x|X|\\*`,vl=`[v=\\s]*(${HA})(?:\\.(${HA})(?:\\.(${HA})(?:${qoe})?${$oe}?)?)?`,Yoe=`^${Voe}\\s*${vl}$`,Woe=new RegExp(Yoe),zoe=`^\\s*(${vl})\\s+-\\s+(${vl})\\s*$`,Koe=new RegExp(zoe),Qoe="(?:~>?)",Xoe=`^${Qoe}${vl}$`,Joe=new RegExp(Xoe),Zoe="(?:\\^)",ese=`^${Zoe}${vl}$`,tse=new RegExp(ese);function nse(t){let e=Joe;return t.replace(e,(n,r,o,s,i)=>{let a;return sn(r)?a="":sn(o)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:sn(s)?a=`>=${r}.${o}.0 <${r}.${+o+1}.0-0`:i?a=`>=${r}.${o}.${s}-${i} <${r}.${+o+1}.0-0`:a=`>=${r}.${o}.${s} <${r}.${+o+1}.0-0`,a})}function rse(t,e){let n=tse,r=e?.includePrerelease?"-0":"";return t.replace(n,(o,s,i,a,c)=>{let l;return sn(s)?l="":sn(i)?l=`>=${s}.0.0${r} <${+s+1}.0.0-0`:sn(a)?s==="0"?l=`>=${s}.${i}.0${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.0${r} <${+s+1}.0.0-0`:c?s==="0"?i==="0"?l=`>=${s}.${i}.${a}-${c} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a}-${c} <${+s+1}.0.0-0`:s==="0"?i==="0"?l=`>=${s}.${i}.${a}${r} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a} <${+s+1}.0.0-0`,l})}function ose(t,e){let n=Woe;return t.replace(n,(r,o,s,i,a,c)=>{let l=sn(s),p=l||sn(i),d=p||sn(a),_=d;return o==="="&&_&&(o=""),c=e?.includePrerelease?"-0":"",l?o===">"||o==="<"?r="<0.0.0-0":r="*":o&&_?(p&&(i=0),a=0,o===">"?(o=">=",p?(s=+s+1,i=0,a=0):(i=+i+1,a=0)):o==="<="&&(o="<",p?s=+s+1:i=+i+1),o==="<"&&(c="-0"),r=`${o+s}.${i}.${a}${c}`):p?r=`>=${s}.0.0${c} <${+s+1}.0.0-0`:d&&(r=`>=${s}.${i}.0${c} <${s}.${+i+1}.0-0`),r})}function sse(t,e){let n=Koe;return t.replace(n,(r,o,s,i,a,c,l,p,d,_,f,m)=>(sn(s)?o="":sn(i)?o=`>=${s}.0.0${e?.includePrerelease?"-0":""}`:sn(a)?o=`>=${s}.${i}.0${e?.includePrerelease?"-0":""}`:c?o=`>=${o}`:o=`>=${o}${e?.includePrerelease?"-0":""}`,sn(d)?p="":sn(_)?p=`<${+d+1}.0.0-0`:sn(f)?p=`<${d}.${+_+1}.0-0`:m?p=`<=${d}.${_}.${f}-${m}`:e?.includePrerelease?p=`<${d}.${_}.${+f+1}-0`:p=`<=${p}`,`${o} ${p}`.trim()))}});var qA=E(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.massUnwrap=vt.unwrap=vt.massWrap=vt.wrap=void 0;var an=console.error.bind(console);function Ll(t,e,n){let r=!!t[e]&&Object.prototype.propertyIsEnumerable.call(t,e);Object.defineProperty(t,e,{configurable:!0,enumerable:r,writable:!0,value:n})}var ise=(t,e,n)=>{if(!t||!t[e]){an("no original function "+String(e)+" to wrap");return}if(!n){an("no wrapper function"),an(new Error().stack);return}let r=t[e];if(typeof r!="function"||typeof n!="function"){an("original object and wrapper must be functions");return}let o=n(r,e);return Ll(o,"__original",r),Ll(o,"__unwrap",()=>{t[e]===o&&Ll(t,e,r)}),Ll(o,"__wrapped",!0),Ll(t,e,o),o};vt.wrap=ise;var ase=(t,e,n)=>{if(t)Array.isArray(t)||(t=[t]);else{an("must provide one or more modules to patch"),an(new Error().stack);return}if(!(e&&Array.isArray(e))){an("must provide one or more functions to wrap on modules");return}t.forEach(r=>{e.forEach(o=>{(0,vt.wrap)(r,o,n)})})};vt.massWrap=ase;var cse=(t,e)=>{if(!t||!t[e]){an("no function to unwrap."),an(new Error().stack);return}let n=t[e];if(!n.__unwrap)an("no original to unwrap to -- has "+String(e)+" already been unwrapped?");else{n.__unwrap();return}};vt.unwrap=cse;var use=(t,e)=>{if(t)Array.isArray(t)||(t=[t]);else{an("must provide one or more modules to patch"),an(new Error().stack);return}if(!(e&&Array.isArray(e))){an("must provide one or more functions to unwrap on modules");return}t.forEach(n=>{e.forEach(r=>{(0,vt.unwrap)(n,r)})})};vt.massUnwrap=use;function Dl(t){t&&t.logger&&(typeof t.logger!="function"?an("new logger isn't a function, not replacing"):an=t.logger)}vt.default=Dl;Dl.wrap=vt.wrap;Dl.massWrap=vt.massWrap;Dl.unwrap=vt.unwrap;Dl.massUnwrap=vt.massUnwrap});var yk=E(lf=>{"use strict";Object.defineProperty(lf,"__esModule",{value:!0});lf.InstrumentationAbstract=void 0;var $A=(b(),O(v)),lse=BA(),uf=qA(),YA=class{_config={};_tracer;_meter;_logger;_diag;instrumentationName;instrumentationVersion;constructor(e,n,r){this.instrumentationName=e,this.instrumentationVersion=n,this.setConfig(r),this._diag=$A.diag.createComponentLogger({namespace:e}),this._tracer=$A.trace.getTracer(e,n),this._meter=$A.metrics.getMeter(e,n),this._logger=lse.logs.getLogger(e,n),this._updateMetricInstruments()}_wrap=uf.wrap;_unwrap=uf.unwrap;_massWrap=uf.massWrap;_massUnwrap=uf.massUnwrap;get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let e=this.init()??[];return Array.isArray(e)?e:[e]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config={enabled:!0,...e}}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,n,r,o){if(e)try{e(r,o)}catch(s){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:n},s)}}};lf.InstrumentationAbstract=YA});var Ok=E((j0e,Ik)=>{var ac=1e3,cc=ac*60,uc=cc*60,Ui=uc*24,pse=Ui*7,dse=Ui*365.25;Ik.exports=function(t,e){e=e||{};var n=typeof t;if(n==="string"&&t.length>0)return _se(t);if(n==="number"&&isFinite(t))return e.long?mse(t):fse(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function _se(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*dse;case"weeks":case"week":case"w":return n*pse;case"days":case"day":case"d":return n*Ui;case"hours":case"hour":case"hrs":case"hr":case"h":return n*uc;case"minutes":case"minute":case"mins":case"min":case"m":return n*cc;case"seconds":case"second":case"secs":case"sec":case"s":return n*ac;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function fse(t){var e=Math.abs(t);return e>=Ui?Math.round(t/Ui)+"d":e>=uc?Math.round(t/uc)+"h":e>=cc?Math.round(t/cc)+"m":e>=ac?Math.round(t/ac)+"s":t+"ms"}function mse(t){var e=Math.abs(t);return e>=Ui?pf(t,e,Ui,"day"):e>=uc?pf(t,e,uc,"hour"):e>=cc?pf(t,e,cc,"minute"):e>=ac?pf(t,e,ac,"second"):t+" ms"}function pf(t,e,n,r){var o=e>=n*1.5;return Math.round(t/n)+" "+r+(o?"s":"")}});var WA=E((H0e,Nk)=>{function hse(t){n.debug=n,n.default=n,n.coerce=c,n.disable=i,n.enable=o,n.enabled=a,n.humanize=Ok(),n.destroy=l,Object.keys(t).forEach(p=>{n[p]=t[p]}),n.names=[],n.skips=[],n.formatters={};function e(p){let d=0;for(let _=0;_<p.length;_++)d=(d<<5)-d+p.charCodeAt(_),d|=0;return n.colors[Math.abs(d)%n.colors.length]}n.selectColor=e;function n(p){let d,_=null,f,m;function h(...T){if(!h.enabled)return;let S=h,R=Number(new Date),I=R-(d||R);S.diff=I,S.prev=d,S.curr=R,d=R,T[0]=n.coerce(T[0]),typeof T[0]!="string"&&T.unshift("%O");let x=0;T[0]=T[0].replace(/%([a-zA-Z%])/g,(B,se)=>{if(B==="%%")return"%";x++;let ve=n.formatters[se];if(typeof ve=="function"){let on=T[x];B=ve.call(S,on),T.splice(x,1),x--}return B}),n.formatArgs.call(S,T),(S.log||n.log).apply(S,T)}return h.namespace=p,h.useColors=n.useColors(),h.color=n.selectColor(p),h.extend=r,h.destroy=n.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>_!==null?_:(f!==n.namespaces&&(f=n.namespaces,m=n.enabled(p)),m),set:T=>{_=T}}),typeof n.init=="function"&&n.init(h),h}function r(p,d){let _=n(this.namespace+(typeof d>"u"?":":d)+p);return _.log=this.log,_}function o(p){n.save(p),n.namespaces=p,n.names=[],n.skips=[];let d=(typeof p=="string"?p:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let _ of d)_[0]==="-"?n.skips.push(_.slice(1)):n.names.push(_)}function s(p,d){let _=0,f=0,m=-1,h=0;for(;_<p.length;)if(f<d.length&&(d[f]===p[_]||d[f]==="*"))d[f]==="*"?(m=f,h=_,f++):(_++,f++);else if(m!==-1)f=m+1,h++,_=h;else return!1;for(;f<d.length&&d[f]==="*";)f++;return f===d.length}function i(){let p=[...n.names,...n.skips.map(d=>"-"+d)].join(",");return n.enable(""),p}function a(p){for(let d of n.skips)if(s(p,d))return!1;for(let d of n.names)if(s(p,d))return!0;return!1}function c(p){return p instanceof Error?p.stack||p.message:p}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}Nk.exports=hse});var bk=E((gn,df)=>{gn.formatArgs=Ese;gn.save=Sse;gn.load=gse;gn.useColors=Tse;gn.storage=Ase();gn.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();gn.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Tse(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Ese(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+df.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let n=0,r=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(n++,o==="%c"&&(r=n))}),t.splice(r,0,e)}gn.log=console.debug||console.log||(()=>{});function Sse(t){try{t?gn.storage.setItem("debug",t):gn.storage.removeItem("debug")}catch{}}function gse(){let t;try{t=gn.storage.getItem("debug")||gn.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function Ase(){try{return localStorage}catch{}}df.exports=WA()(gn);var{formatters:Rse}=df.exports;Rse.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Pk=E((F0e,Ck)=>{"use strict";Ck.exports=(t,e=process.argv)=>{let n=t.startsWith("-")?"":t.length===1?"-":"--",r=e.indexOf(n+t),o=e.indexOf("--");return r!==-1&&(o===-1||r<o)}});var vk=E((V0e,xk)=>{"use strict";var yse=U("os"),Mk=U("tty"),Jn=Pk(),{env:gt}=process,us;Jn("no-color")||Jn("no-colors")||Jn("color=false")||Jn("color=never")?us=0:(Jn("color")||Jn("colors")||Jn("color=true")||Jn("color=always"))&&(us=1);"FORCE_COLOR"in gt&&(gt.FORCE_COLOR==="true"?us=1:gt.FORCE_COLOR==="false"?us=0:us=gt.FORCE_COLOR.length===0?1:Math.min(parseInt(gt.FORCE_COLOR,10),3));function zA(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function KA(t,e){if(us===0)return 0;if(Jn("color=16m")||Jn("color=full")||Jn("color=truecolor"))return 3;if(Jn("color=256"))return 2;if(t&&!e&&us===void 0)return 0;let n=us||0;if(gt.TERM==="dumb")return n;if(process.platform==="win32"){let r=yse.release().split(".");return Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in gt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(r=>r in gt)||gt.CI_NAME==="codeship"?1:n;if("TEAMCITY_VERSION"in gt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(gt.TEAMCITY_VERSION)?1:0;if(gt.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in gt){let r=parseInt((gt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(gt.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(gt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(gt.TERM)||"COLORTERM"in gt?1:n}function Ise(t){let e=KA(t,t&&t.isTTY);return zA(e)}xk.exports={supportsColor:Ise,stdout:zA(KA(!0,Mk.isatty(1))),stderr:zA(KA(!0,Mk.isatty(2)))}});var Dk=E((At,ff)=>{var Ose=U("tty"),_f=U("util");At.init=vse;At.log=Pse;At.formatArgs=bse;At.save=Mse;At.load=xse;At.useColors=Nse;At.destroy=_f.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");At.colors=[6,2,3,4,5,1];try{let t=vk();t&&(t.stderr||t).level>=2&&(At.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}At.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{let n=e.substring(6).toLowerCase().replace(/_([a-z])/g,(o,s)=>s.toUpperCase()),r=process.env[e];return/^(yes|on|true|enabled)$/i.test(r)?r=!0:/^(no|off|false|disabled)$/i.test(r)?r=!1:r==="null"?r=null:r=Number(r),t[n]=r,t},{});function Nse(){return"colors"in At.inspectOpts?!!At.inspectOpts.colors:Ose.isatty(process.stderr.fd)}function bse(t){let{namespace:e,useColors:n}=this;if(n){let r=this.color,o="\x1B[3"+(r<8?r:"8;5;"+r),s=` ${o};1m${e} \x1B[0m`;t[0]=s+t[0].split(`
3
+ `).join(`
4
+ `+s),t.push(o+"m+"+ff.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=Cse()+e+" "+t[0]}function Cse(){return At.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Pse(...t){return process.stderr.write(_f.formatWithOptions(At.inspectOpts,...t)+`
5
+ `)}function Mse(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function xse(){return process.env.DEBUG}function vse(t){t.inspectOpts={};let e=Object.keys(At.inspectOpts);for(let n=0;n<e.length;n++)t.inspectOpts[e[n]]=At.inspectOpts[e[n]]}ff.exports=WA()(At);var{formatters:Lk}=ff.exports;Lk.o=function(t){return this.inspectOpts.colors=this.useColors,_f.inspect(t,this.inspectOpts).split(`
6
+ `).map(e=>e.trim()).join(" ")};Lk.O=function(t){return this.inspectOpts.colors=this.useColors,_f.inspect(t,this.inspectOpts)}});var Uk=E((q0e,QA)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?QA.exports=bk():QA.exports=Dk()});var mf=E(($0e,wk)=>{"use strict";var XA=U("path").sep;wk.exports=function(t){var e=t.split(XA),n=e.lastIndexOf("node_modules");if(n!==-1&&e[n+1]){for(var r=e[n+1][0]==="@",o=r?e[n+1]+"/"+e[n+2]:e[n+1],s=r?3:2,i="",a=n+s-1,c=0;c<=a;c++)c===a?i+=e[c]:i+=e[c]+XA;for(var l="",p=e.length-1,d=n+s;d<=p;d++)d===p?l+=e[d]:l+=e[d]+XA;return{name:o,basedir:i,path:l}}}});var wi=E((Y0e,eR)=>{"use strict";var lc=U("path"),yr=U("module"),ze=Uk()("require-in-the-middle"),Lse=mf();eR.exports=Ul;eR.exports.Hook=Ul;var JA,hf;if(yr.isBuiltin)hf=yr.isBuiltin;else if(yr.builtinModules)hf=t=>t.startsWith("node:")?!0:(JA===void 0&&(JA=new Set(yr.builtinModules)),JA.has(t));else throw new Error("'require-in-the-middle' requires Node.js >=v9.3.0 or >=v8.10.0");var Dse=/([/\\]index)?(\.js)?$/,ZA=class{constructor(){this._localCache=new Map,this._kRitmExports=Symbol("RitmExports")}has(e,n){if(this._localCache.has(e))return!0;if(n)return!1;{let r=U.cache[e];return!!(r&&this._kRitmExports in r)}}get(e,n){let r=this._localCache.get(e);if(r!==void 0)return r;if(!n){let o=U.cache[e];return o&&o[this._kRitmExports]}}set(e,n,r){r?this._localCache.set(e,n):e in U.cache?U.cache[e][this._kRitmExports]=n:(ze('non-core module is unexpectedly not in require.cache: "%s"',e),this._localCache.set(e,n))}};function Ul(t,e,n){if(!(this instanceof Ul))return new Ul(t,e,n);if(typeof t=="function"?(n=t,t=null,e=null):typeof e=="function"&&(n=e,e=null),typeof yr._resolveFilename!="function"){console.error("Error: Expected Module._resolveFilename to be a function (was: %s) - aborting!",typeof yr._resolveFilename),console.error("Please report this error as an issue related to Node.js %s at https://github.com/nodejs/require-in-the-middle/issues",process.version);return}this._cache=new ZA,this._unhooked=!1,this._origRequire=yr.prototype.require;let r=this,o=new Set,s=e?e.internals===!0:!1,i=Array.isArray(t);ze("registering require hook"),this._require=yr.prototype.require=function(c){return r._unhooked===!0?(ze("ignoring require call - module is soft-unhooked"),r._origRequire.apply(this,arguments)):a.call(this,arguments,!1)},typeof process.getBuiltinModule=="function"&&(this._origGetBuiltinModule=process.getBuiltinModule,this._getBuiltinModule=process.getBuiltinModule=function(c){return r._unhooked===!0?(ze("ignoring process.getBuiltinModule call - module is soft-unhooked"),r._origGetBuiltinModule.apply(this,arguments)):a.call(this,arguments,!0)});function a(c,l){let p=c[0],d=hf(p),_;if(d){if(_=p,p.startsWith("node:")){let R=p.slice(5);hf(R)&&(_=R)}}else{if(l)return ze("call to process.getBuiltinModule with unknown built-in id"),r._origGetBuiltinModule.apply(this,c);try{_=yr._resolveFilename(p,this)}catch(R){return ze('Module._resolveFilename("%s") threw %j, calling original Module.require',p,R.message),r._origRequire.apply(this,c)}}let f,m;if(ze("processing %s module require('%s'): %s",d===!0?"core":"non-core",p,_),r._cache.has(_,d)===!0)return ze("returning already patched cached module: %s",_),r._cache.get(_,d);let h=o.has(_);h===!1&&o.add(_);let T=l?r._origGetBuiltinModule.apply(this,c):r._origRequire.apply(this,c);if(h===!0)return ze("module is in the process of being patched already - ignoring: %s",_),T;if(o.delete(_),d===!0){if(i===!0&&t.includes(_)===!1)return ze("ignoring core module not on whitelist: %s",_),T;f=_}else if(i===!0&&t.includes(_)){let R=lc.parse(_);f=R.name,m=R.dir}else{let R=Lse(_);if(R===void 0)return ze("could not parse filename: %s",_),T;f=R.name,m=R.basedir;let I=Use(R);ze("resolved filename to module: %s (id: %s, resolved: %s, basedir: %s)",f,p,I,m);let x=!1;if(i){if(!p.startsWith(".")&&t.includes(p)&&(f=p,x=!0),!t.includes(f)&&!t.includes(I))return T;t.includes(I)&&I!==f&&(f=I,x=!0)}if(!x){let F;try{F=U.resolve(f,{paths:[m]})}catch{return ze("could not resolve module: %s",f),r._cache.set(_,T,d),T}if(F!==_)if(s===!0)f=f+lc.sep+lc.relative(m,_),ze("preparing to process require of internal file: %s",f);else return ze("ignoring require of non-main module file: %s",F),r._cache.set(_,T,d),T}}r._cache.set(_,T,d),ze("calling require hook: %s",f);let S=n(T,f,m);return r._cache.set(_,S,d),ze("returning module: %s",f),S}}Ul.prototype.unhook=function(){this._unhooked=!0,this._require===yr.prototype.require?(yr.prototype.require=this._origRequire,ze("require unhook successful")):ze("require unhook unsuccessful"),process.getBuiltinModule!==void 0&&(this._getBuiltinModule===process.getBuiltinModule?(process.getBuiltinModule=this._origGetBuiltinModule,ze("process.getBuiltinModule unhook successful")):ze("process.getBuiltinModule unhook unsuccessful"))};function Use(t){let e=lc.sep!=="/"?t.path.split(lc.sep).join("/"):t.path;return lc.posix.join(t.name,e).replace(Dse,"")}});var kk=E(ls=>{"use strict";Object.defineProperty(ls,"__esModule",{value:!0});ls.ModuleNameTrie=ls.ModuleNameSeparator=void 0;ls.ModuleNameSeparator="/";var Tf=class{hooks=[];children=new Map},tR=class{_trie=new Tf;_counter=0;insert(e){let n=this._trie;for(let r of e.moduleName.split(ls.ModuleNameSeparator)){let o=n.children.get(r);o||(o=new Tf,n.children.set(r,o)),n=o}n.hooks.push({hook:e,insertedId:this._counter++})}search(e,{maintainInsertionOrder:n,fullOnly:r}={}){let o=this._trie,s=[],i=!0;for(let a of e.split(ls.ModuleNameSeparator)){let c=o.children.get(a);if(!c){i=!1;break}r||s.push(...c.hooks),o=c}return r&&i&&s.push(...o.hooks),s.length===0?[]:s.length===1?[s[0].hook]:(n&&s.sort((a,c)=>a.insertedId-c.insertedId),s.map(({hook:a})=>a))}};ls.ModuleNameTrie=tR});var Bk=E(Ef=>{"use strict";Object.defineProperty(Ef,"__esModule",{value:!0});Ef.RequireInTheMiddleSingleton=void 0;var wse=wi(),Gk=U("path"),nR=kk(),kse=["afterEach","after","beforeEach","before","describe","it"].every(t=>typeof global[t]=="function"),rR=class t{_moduleNameTrie=new nR.ModuleNameTrie;static _instance;constructor(){this._initialize()}_initialize(){new wse.Hook(null,{internals:!0},(e,n,r)=>{let o=Gse(n),s=this._moduleNameTrie.search(o,{maintainInsertionOrder:!0,fullOnly:r===void 0});for(let{onRequire:i}of s)e=i(e,n,r);return e})}register(e,n){let r={moduleName:e,onRequire:n};return this._moduleNameTrie.insert(r),r}static getInstance(){return kse?new t:this._instance=this._instance??new t}};Ef.RequireInTheMiddleSingleton=rR;function Gse(t){return Gk.sep!==nR.ModuleNameSeparator?t.split(Gk.sep).join(nR.ModuleNameSeparator):t}});var qk=E(wl=>{var jk=[],oR=new WeakMap,Hk=new WeakMap,Fk=new Map,Vk=[],Bse={set(t,e,n){let r=oR.get(t),o=r&&r[e];return typeof o=="function"?o(n):!0},get(t,e){if(e===Symbol.toStringTag)return"Module";let n=Hk.get(t)[e];if(typeof n=="function")return n()},defineProperty(t,e,n){if(!("value"in n))throw new Error("Getters/setters are not supported for exports property descriptors.");let r=oR.get(t),o=r&&r[e];return typeof o=="function"?o(n.value):!0}};function jse(t,e,n,r,o){Fk.set(t,o),oR.set(e,n),Hk.set(e,r);let s=new Proxy(e,Bse);jk.forEach(i=>i(t,s,o)),Vk.push([t,s,o])}wl.register=jse;wl.importHooks=jk;wl.specifiers=Fk;wl.toHook=Vk});var cR=E((X0e,dc)=>{var $k=U("path"),Hse=mf(),{fileURLToPath:Fse}=U("url"),{MessageChannel:Vse}=U("worker_threads"),{isBuiltin:sR}=U("module");sR||(sR=()=>!0);var{importHooks:iR,specifiers:qse,toHook:$se}=qk();function Yk(t){iR.push(t),$se.forEach(([e,n,r])=>t(e,n,r))}function Wk(t){let e=iR.indexOf(t);e>-1&&iR.splice(e,1)}function pc(t,e,n,r){let o=t(e,n,r);o&&o!==e&&"default"in e&&(e.default=o)}var aR;function Yse(){let{port1:t,port2:e}=new Vse,n=0,r;aR=a=>{n++,t.postMessage(a)},t.on("message",()=>{n--,r&&n<=0&&r()}).unref();function o(){let a=setInterval(()=>{},1e3),c=new Promise(l=>{r=l}).then(()=>{clearInterval(a)});return n===0&&r(),c}let s=e;return{registerOptions:{data:{addHookMessagePort:s,include:[]},transferList:[s]},addHookMessagePort:s,waitForAllMessagesAcknowledged:o}}function kl(t,e,n){if(!(this instanceof kl))return new kl(t,e,n);typeof t=="function"?(n=t,t=null,e=null):typeof e=="function"&&(n=e,e=null);let r=e?e.internals===!0:!1;aR&&Array.isArray(t)&&aR(t),this._iitmHook=(o,s,i)=>{let a=o,c=a.startsWith("node:"),l,p;if(c){let d=o.slice(5);sR(d)&&(o=d)}else if(a.startsWith("file://")){let d=Error.stackTraceLimit;Error.stackTraceLimit=0;try{l=Fse(o),o=l}catch{}if(Error.stackTraceLimit=d,l){let _=Hse(l);_&&(o=_.name,p=_.basedir)}}if(t)for(let d of t)if(l&&d===l)pc(n,s,l,void 0);else if(d===o){if(!p)pc(n,s,o,p);else if(p.endsWith(qse.get(a)))pc(n,s,o,p);else if(r){let _=o+$k.sep+$k.relative(p,l);pc(n,s,_,p)}}else d===i&&pc(n,s,i,p);else pc(n,s,o,p)},Yk(this._iitmHook)}kl.prototype.unhook=function(){Wk(this._iitmHook)};dc.exports=kl;dc.exports.Hook=kl;dc.exports.addHook=Yk;dc.exports.removeHook=Wk;dc.exports.createAddHookMessageChannel=Yse});var uR=E(ps=>{"use strict";Object.defineProperty(ps,"__esModule",{value:!0});ps.isWrapped=ps.safeExecuteInTheMiddleAsync=ps.safeExecuteInTheMiddle=void 0;function Wse(t,e,n){let r,o;try{o=t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}ps.safeExecuteInTheMiddle=Wse;async function zse(t,e,n){let r,o;try{o=await t()}catch(s){r=s}finally{if(await e(r,o),r&&!n)throw r;return o}}ps.safeExecuteInTheMiddleAsync=zse;function Kse(t){return typeof t=="function"&&typeof t.__original=="function"&&typeof t.__unwrap=="function"&&t.__wrapped===!0}ps.isWrapped=Kse});var Qk=E(Sf=>{"use strict";Object.defineProperty(Sf,"__esModule",{value:!0});Sf.InstrumentationBase=void 0;var Gl=U("path"),zk=U("util"),Qse=Rk(),lR=qA(),Xse=yk(),Jse=Bk(),Zse=cR(),Bl=(b(),O(v)),eie=wi(),tie=U("fs"),nie=uR(),pR=class extends Xse.InstrumentationAbstract{_modules;_hooks=[];_requireInTheMiddleSingleton=Jse.RequireInTheMiddleSingleton.getInstance();_enabled=!1;constructor(e,n,r){super(e,n,r);let o=this.init();o&&!Array.isArray(o)&&(o=[o]),this._modules=o||[],this._config.enabled&&this.enable()}_wrap=(e,n,r)=>{if((0,nie.isWrapped)(e[n])&&this._unwrap(e,n),zk.types.isProxy(e)){let o=(0,lR.wrap)(Object.assign({},e),n,r);return Object.defineProperty(e,n,{value:o}),o}else return(0,lR.wrap)(e,n,r)};_unwrap=(e,n)=>zk.types.isProxy(e)?Object.defineProperty(e,n,{value:e[n]}):(0,lR.unwrap)(e,n);_massWrap=(e,n,r)=>{if(e)Array.isArray(e)||(e=[e]);else{Bl.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){Bl.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(o=>{n.forEach(s=>{this._wrap(o,s,r)})})};_massUnwrap=(e,n)=>{if(e)Array.isArray(e)||(e=[e]);else{Bl.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){Bl.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(r=>{n.forEach(o=>{this._unwrap(r,o)})})};_warnOnPreloadedModules(){let e=globalThis.require;!e?.resolve||!e?.cache||this._modules.forEach(n=>{let{name:r}=n;try{let o=e.resolve(r);e.cache[o]?.loaded&&this._diag.warn(`Module ${r} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${r}`)}catch{}})}_extractPackageVersion(e){try{let n=(0,tie.readFileSync)(Gl.join(e,"package.json"),{encoding:"utf8"}),r=JSON.parse(n).version;return typeof r=="string"?r:void 0}catch{Bl.diag.warn("Failed extracting version",e)}}_onRequire(e,n,r,o){if(!o)return typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for nodejs core module on require hook",{module:e.name}),e.patch(n)):n;let s=this._extractPackageVersion(o);if(e.moduleVersion=s,e.name===r)return Kk(e.supportedVersions,s,e.includePrerelease)&&typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for module on require hook",{module:e.name,version:e.moduleVersion,baseDir:o}),e.patch(n,e.moduleVersion)):n;let i=e.files??[],a=Gl.normalize(r);return i.filter(l=>l.name===a&&Kk(l.supportedVersions,s,e.includePrerelease)).reduce((l,p)=>(p.moduleExports=l,this._enabled?(this._diag.debug("Applying instrumentation patch for nodejs module file on require hook",{module:e.name,version:e.moduleVersion,fileName:p.name,baseDir:o}),p.patch(l,e.moduleVersion)):l),n)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let e of this._modules){typeof e.patch=="function"&&e.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module on instrumentation enabled",{module:e.name,version:e.moduleVersion}),e.patch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module file on instrumentation enabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.patch(n.moduleExports,e.moduleVersion))}return}this._warnOnPreloadedModules();for(let e of this._modules){let n=(i,a,c)=>{if(!c&&Gl.isAbsolute(a)){let l=Gl.parse(a);a=l.name,c=l.dir}return this._onRequire(e,i,a,c)},r=(i,a,c)=>this._onRequire(e,i,a,c),o=Gl.isAbsolute(e.name)?new eie.Hook([e.name],{internals:!0},r):this._requireInTheMiddleSingleton.register(e.name,r);this._hooks.push(o);let s=new Zse.Hook([e.name],{internals:!0},n);this._hooks.push(s)}}}disable(){if(this._enabled){this._enabled=!1;for(let e of this._modules){typeof e.unpatch=="function"&&e.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module on instrumentation disabled",{module:e.name,version:e.moduleVersion}),e.unpatch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module file on instrumentation disabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.unpatch(n.moduleExports,e.moduleVersion))}}}isEnabled(){return this._enabled}};Sf.InstrumentationBase=pR;function Kk(t,e,n){return typeof e>"u"?t.includes("*"):t.some(r=>(0,Qse.satisfies)(e,r,{includePrerelease:n}))}});var Xk=E(gf=>{"use strict";Object.defineProperty(gf,"__esModule",{value:!0});gf.normalize=void 0;var rie=U("path");Object.defineProperty(gf,"normalize",{enumerable:!0,get:function(){return rie.normalize}})});var Jk=E(_c=>{"use strict";Object.defineProperty(_c,"__esModule",{value:!0});_c.normalize=_c.InstrumentationBase=void 0;var oie=Qk();Object.defineProperty(_c,"InstrumentationBase",{enumerable:!0,get:function(){return oie.InstrumentationBase}});var sie=Xk();Object.defineProperty(_c,"normalize",{enumerable:!0,get:function(){return sie.normalize}})});var dR=E(fc=>{"use strict";Object.defineProperty(fc,"__esModule",{value:!0});fc.normalize=fc.InstrumentationBase=void 0;var Zk=Jk();Object.defineProperty(fc,"InstrumentationBase",{enumerable:!0,get:function(){return Zk.InstrumentationBase}});Object.defineProperty(fc,"normalize",{enumerable:!0,get:function(){return Zk.normalize}})});var eG=E(Af=>{"use strict";Object.defineProperty(Af,"__esModule",{value:!0});Af.InstrumentationNodeModuleDefinition=void 0;var _R=class{files;name;supportedVersions;patch;unpatch;constructor(e,n,r,o,s){this.files=s||[],this.name=e,this.supportedVersions=n,this.patch=r,this.unpatch=o}};Af.InstrumentationNodeModuleDefinition=_R});var tG=E(Rf=>{"use strict";Object.defineProperty(Rf,"__esModule",{value:!0});Rf.InstrumentationNodeModuleFile=void 0;var iie=dR(),fR=class{name;supportedVersions;patch;unpatch;constructor(e,n,r,o){this.name=(0,iie.normalize)(e),this.supportedVersions=n,this.patch=r,this.unpatch=o}};Rf.InstrumentationNodeModuleFile=fR});var nG=E(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.semconvStabilityFromStr=ki.SemconvStability=void 0;var yf;(function(t){t[t.STABLE=1]="STABLE",t[t.OLD=2]="OLD",t[t.DUPLICATE=3]="DUPLICATE"})(yf=ki.SemconvStability||(ki.SemconvStability={}));function aie(t,e){let n=yf.OLD,r=e?.split(",").map(o=>o.trim()).filter(o=>o!=="");for(let o of r??[])if(o.toLowerCase()===t+"/dup"){n=yf.DUPLICATE;break}else o.toLowerCase()===t&&(n=yf.STABLE);return n}ki.semconvStabilityFromStr=aie});var ne=E(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.semconvStabilityFromStr=tt.SemconvStability=tt.safeExecuteInTheMiddleAsync=tt.safeExecuteInTheMiddle=tt.isWrapped=tt.InstrumentationNodeModuleFile=tt.InstrumentationNodeModuleDefinition=tt.InstrumentationBase=tt.registerInstrumentations=void 0;var cie=_k();Object.defineProperty(tt,"registerInstrumentations",{enumerable:!0,get:function(){return cie.registerInstrumentations}});var uie=dR();Object.defineProperty(tt,"InstrumentationBase",{enumerable:!0,get:function(){return uie.InstrumentationBase}});var lie=eG();Object.defineProperty(tt,"InstrumentationNodeModuleDefinition",{enumerable:!0,get:function(){return lie.InstrumentationNodeModuleDefinition}});var pie=tG();Object.defineProperty(tt,"InstrumentationNodeModuleFile",{enumerable:!0,get:function(){return pie.InstrumentationNodeModuleFile}});var mR=uR();Object.defineProperty(tt,"isWrapped",{enumerable:!0,get:function(){return mR.isWrapped}});Object.defineProperty(tt,"safeExecuteInTheMiddle",{enumerable:!0,get:function(){return mR.safeExecuteInTheMiddle}});Object.defineProperty(tt,"safeExecuteInTheMiddleAsync",{enumerable:!0,get:function(){return mR.safeExecuteInTheMiddleAsync}});var rG=nG();Object.defineProperty(tt,"SemconvStability",{enumerable:!0,get:function(){return rG.SemconvStability}});Object.defineProperty(tt,"semconvStabilityFromStr",{enumerable:!0,get:function(){return rG.semconvStabilityFromStr}})});var oG=E(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});q.HTTP_FLAVOR_VALUE_HTTP_1_1=q.NET_TRANSPORT_VALUE_IP_UDP=q.NET_TRANSPORT_VALUE_IP_TCP=q.ATTR_NET_TRANSPORT=q.ATTR_NET_PEER_PORT=q.ATTR_NET_PEER_NAME=q.ATTR_NET_PEER_IP=q.ATTR_NET_HOST_PORT=q.ATTR_NET_HOST_NAME=q.ATTR_NET_HOST_IP=q.ATTR_HTTP_USER_AGENT=q.ATTR_HTTP_URL=q.ATTR_HTTP_TARGET=q.ATTR_HTTP_STATUS_CODE=q.ATTR_HTTP_SERVER_NAME=q.ATTR_HTTP_SCHEME=q.ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED=q.ATTR_HTTP_RESPONSE_CONTENT_LENGTH=q.ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED=q.ATTR_HTTP_REQUEST_CONTENT_LENGTH=q.ATTR_HTTP_METHOD=q.ATTR_HTTP_HOST=q.ATTR_HTTP_FLAVOR=q.ATTR_HTTP_CLIENT_IP=q.USER_AGENT_SYNTHETIC_TYPE_VALUE_TEST=q.USER_AGENT_SYNTHETIC_TYPE_VALUE_BOT=q.ATTR_USER_AGENT_SYNTHETIC_TYPE=void 0;q.ATTR_USER_AGENT_SYNTHETIC_TYPE="user_agent.synthetic.type";q.USER_AGENT_SYNTHETIC_TYPE_VALUE_BOT="bot";q.USER_AGENT_SYNTHETIC_TYPE_VALUE_TEST="test";q.ATTR_HTTP_CLIENT_IP="http.client_ip";q.ATTR_HTTP_FLAVOR="http.flavor";q.ATTR_HTTP_HOST="http.host";q.ATTR_HTTP_METHOD="http.method";q.ATTR_HTTP_REQUEST_CONTENT_LENGTH="http.request_content_length";q.ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED="http.request_content_length_uncompressed";q.ATTR_HTTP_RESPONSE_CONTENT_LENGTH="http.response_content_length";q.ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED="http.response_content_length_uncompressed";q.ATTR_HTTP_SCHEME="http.scheme";q.ATTR_HTTP_SERVER_NAME="http.server_name";q.ATTR_HTTP_STATUS_CODE="http.status_code";q.ATTR_HTTP_TARGET="http.target";q.ATTR_HTTP_URL="http.url";q.ATTR_HTTP_USER_AGENT="http.user_agent";q.ATTR_NET_HOST_IP="net.host.ip";q.ATTR_NET_HOST_NAME="net.host.name";q.ATTR_NET_HOST_PORT="net.host.port";q.ATTR_NET_PEER_IP="net.peer.ip";q.ATTR_NET_PEER_NAME="net.peer.name";q.ATTR_NET_PEER_PORT="net.peer.port";q.ATTR_NET_TRANSPORT="net.transport";q.NET_TRANSPORT_VALUE_IP_TCP="ip_tcp";q.NET_TRANSPORT_VALUE_IP_UDP="ip_udp";q.HTTP_FLAVOR_VALUE_HTTP_1_1="1.1"});var sG=E(jl=>{"use strict";Object.defineProperty(jl,"__esModule",{value:!0});jl.AttributeNames=void 0;var die;(function(t){t.HTTP_ERROR_NAME="http.error_name",t.HTTP_ERROR_MESSAGE="http.error_message",t.HTTP_STATUS_TEXT="http.status_text"})(die=jl.AttributeNames||(jl.AttributeNames={}))});var hR=E(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.DEFAULT_QUERY_STRINGS_TO_REDACT=zr.STR_REDACTED=zr.SYNTHETIC_BOT_NAMES=zr.SYNTHETIC_TEST_NAMES=void 0;zr.SYNTHETIC_TEST_NAMES=["alwayson"];zr.SYNTHETIC_BOT_NAMES=["googlebot","bingbot"];zr.STR_REDACTED="REDACTED";zr.DEFAULT_QUERY_STRINGS_TO_REDACT=["sig","Signature","AWSAccessKeyId","X-Goog-Signature"]});var aG=E((lDe,iG)=>{"use strict";var _ie=U("util");function TR(t,e){Error.captureStackTrace(this,TR),this.name=this.constructor.name,this.message=t,this.input=e}_ie.inherits(TR,Error);iG.exports=TR});var uG=E((pDe,cG)=>{"use strict";function fie(t){return t===34||t===40||t===41||t===44||t===47||t>=58&&t<=64||t>=91&&t<=93||t===123||t===125}function mie(t){return t===33||t>=35&&t<=39||t===42||t===43||t===45||t===46||t>=48&&t<=57||t>=65&&t<=90||t>=94&&t<=122||t===124||t===126}function hie(t){return t>=32&&t<=126}function Tie(t){return t>=128&&t<=255}cG.exports={isDelimiter:fie,isTokenChar:mie,isExtended:Tie,isPrint:hie}});var fG=E((dDe,_G)=>{"use strict";var Eie=U("util"),mc=aG(),If=uG(),Sie=If.isDelimiter,lG=If.isTokenChar,pG=If.isExtended,gie=If.isPrint;function dG(t){return t.replace(/\\(.)/g,"$1")}function Hl(t,e){return Eie.format("Unexpected character '%s' at index %d",t.charAt(e),e)}function Aie(t){for(var e=!1,n=!1,r=!1,o={},s=[],i=-1,a=-1,c,l,p=0;p<t.length;p++)if(l=t.charCodeAt(p),c===void 0){if(p!==0&&i===-1&&(l===32||l===9))continue;if(lG(l))i===-1&&(i=p);else if(l===61&&i!==-1)c=t.slice(i,p).toLowerCase(),i=-1;else throw new mc(Hl(t,p),t)}else if(n&&(l===9||gie(l)||pG(l)))n=!1;else if(lG(l)){if(a!==-1)throw new mc(Hl(t,p),t);i===-1&&(i=p)}else if(Sie(l)||pG(l))if(r)l===34?(r=!1,a=p):l===92?(i===-1&&(i=p),n=e=!0):i===-1&&(i=p);else if(l===34&&t.charCodeAt(p-1)===61)r=!0;else if((l===44||l===59)&&(i!==-1||a!==-1))i!==-1?(a===-1&&(a=p),o[c]=e?dG(t.slice(i,a)):t.slice(i,a)):o[c]="",l===44&&(s.push(o),o={}),c=void 0,i=a=-1;else throw new mc(Hl(t,p),t);else if(l===32||l===9){if(a!==-1)continue;if(r)i===-1&&(i=p);else if(i!==-1)a=p;else throw new mc(Hl(t,p),t)}else throw new mc(Hl(t,p),t);if(c===void 0||r||i===-1&&a===-1||l===32||l===9)throw new mc("Unexpected end of input",t);return i!==-1?(a===-1&&(a=p),o[c]=e?dG(t.slice(i,a)):t.slice(i,a)):o[c]="",s.push(o),s}_G.exports=Aie});var yG=E($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});$.headerCapture=$.getIncomingStableRequestMetricAttributesOnResponse=$.getIncomingRequestMetricAttributesOnResponse=$.getIncomingRequestAttributesOnResponse=$.getIncomingRequestMetricAttributes=$.getIncomingRequestAttributes=$.getRemoteClientAddress=$.getOutgoingStableRequestMetricAttributesOnResponse=$.getOutgoingRequestMetricAttributesOnResponse=$.getOutgoingRequestAttributesOnResponse=$.setAttributesFromHttpKind=$.getOutgoingRequestMetricAttributes=$.getOutgoingRequestAttributes=$.extractHostnameAndPort=$.isValidOptionsType=$.getRequestInfo=$.isCompressed=$.setResponseContentLengthAttribute=$.setRequestContentLengthAttribute=$.setSpanWithError=$.satisfiesPattern=$.parseResponseStatus=$.getAbsoluteUrl=void 0;var Fl=(b(),O(v)),ae=(le(),O(Ae)),V=oG(),mG=Te(),kn=ne(),Rie=U("url"),Nf=sG(),hG=hR(),Of=hR(),yie=fG(),Iie=(t,e,n="http:",r=Array.from(Of.DEFAULT_QUERY_STRINGS_TO_REDACT))=>{let o=t||{},s=o.protocol||n,i=(o.port||"").toString(),a=o.path||"/",c=o.host||o.hostname||e.host||"localhost";if(c.indexOf(":")===-1&&i&&i!=="80"&&i!=="443"&&(c+=`:${i}`),a.includes("?"))try{let p=new URL(a,"http://localhost"),d=r||[];for(let _ of d)p.searchParams.get(_)&&p.searchParams.set(_,Of.STR_REDACTED);a=`${p.pathname}${p.search}`}catch{}let l=o.auth?`${Of.STR_REDACTED}:${Of.STR_REDACTED}@`:"";return`${s}//${l}${c}${a}`};$.getAbsoluteUrl=Iie;var Oie=(t,e)=>{let n=t===Fl.SpanKind.CLIENT?400:500;return e&&e>=100&&e<n?Fl.SpanStatusCode.UNSET:Fl.SpanStatusCode.ERROR};$.parseResponseStatus=Oie;var Nie=(t,e)=>{if(typeof e=="string")return e===t;if(e instanceof RegExp)return e.test(t);if(typeof e=="function")return e(t);throw new TypeError("Pattern is in unsupported datatype")};$.satisfiesPattern=Nie;var bie=(t,e,n)=>{let r=e.message;n&kn.SemconvStability.OLD&&(t.setAttribute(Nf.AttributeNames.HTTP_ERROR_NAME,e.name),t.setAttribute(Nf.AttributeNames.HTTP_ERROR_MESSAGE,r)),n&kn.SemconvStability.STABLE&&t.setAttribute(ae.ATTR_ERROR_TYPE,e.name),t.setStatus({code:Fl.SpanStatusCode.ERROR,message:r}),t.recordException(e)};$.setSpanWithError=bie;var Cie=(t,e)=>{let n=EG(t.headers);n!==null&&((0,$.isCompressed)(t.headers)?e[V.ATTR_HTTP_REQUEST_CONTENT_LENGTH]=n:e[V.ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED]=n)};$.setRequestContentLengthAttribute=Cie;var Pie=(t,e)=>{let n=EG(t.headers);n!==null&&((0,$.isCompressed)(t.headers)?e[V.ATTR_HTTP_RESPONSE_CONTENT_LENGTH]=n:e[V.ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED]=n)};$.setResponseContentLengthAttribute=Pie;function EG(t){let e=t["content-length"];if(e===void 0)return null;let n=parseInt(e,10);return isNaN(n)?null:n}var Mie=t=>{let e=t["content-encoding"];return!!e&&e!=="identity"};$.isCompressed=Mie;function xie(t){let{hostname:e,pathname:n,port:r,username:o,password:s,search:i,protocol:a,hash:c,href:l,origin:p,host:d}=new URL(t),_={protocol:a,hostname:e&&e[0]==="["?e.slice(1,-1):e,hash:c,search:i,pathname:n,path:`${n||""}${i||""}`,href:l,origin:p,host:d};return r!==""&&(_.port=Number(r)),(o||s)&&(_.auth=`${decodeURIComponent(o)}:${decodeURIComponent(s)}`),_}var vie=(t,e,n)=>{let r,o,s,i=!1;if(typeof e=="string"){try{let c=xie(e);s=c,r=c.pathname||"/"}catch(c){i=!0,t.verbose("Unable to parse URL provided to HTTP request, using fallback to determine path. Original error:",c),s={path:e},r=s.path||"/"}o=`${s.protocol||"http:"}//${s.host}`,n!==void 0&&Object.assign(s,n)}else if(e instanceof Rie.URL)s={protocol:e.protocol,hostname:typeof e.hostname=="string"&&e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,path:`${e.pathname||""}${e.search||""}`},e.port!==""&&(s.port=Number(e.port)),(e.username||e.password)&&(s.auth=`${e.username}:${e.password}`),r=e.pathname,o=e.origin,n!==void 0&&Object.assign(s,n);else{s=Object.assign({protocol:e.host?"http:":void 0},e);let c=s.host||(s.port!=null?`${s.hostname}${s.port}`:s.hostname);if(o=`${s.protocol||"http:"}//${c}`,r=e.pathname,!r&&s.path)try{r=new URL(s.path,o).pathname||"/"}catch{r="/"}}let a=s.method?s.method.toUpperCase():"GET";return{origin:o,pathname:r,method:a,optionsParsed:s,invalidUrl:i}};$.getRequestInfo=vie;var Lie=t=>{if(!t)return!1;let e=typeof t;return e==="string"||e==="object"&&!Array.isArray(t)};$.isValidOptionsType=Lie;var Die=t=>{if(t.hostname&&t.port)return{hostname:t.hostname,port:t.port};let e=t.host?.match(/^([^:/ ]+)(:\d{1,5})?/)||null,n=t.hostname||(e===null?"localhost":e[1]),r=t.port;return r||(e&&e[2]?r=e[2].substring(1):r=t.protocol==="https:"?"443":"80"),{hostname:n,port:r}};$.extractHostnameAndPort=Die;var Uie=(t,e,n,r)=>{let o=e.hostname,s=e.port,i=t.method??"GET",a=AG(i),c=t.headers||{},l=c["user-agent"],p=(0,$.getAbsoluteUrl)(t,c,`${e.component}:`,e.redactedQueryParams),d={[V.ATTR_HTTP_URL]:p,[V.ATTR_HTTP_METHOD]:i,[V.ATTR_HTTP_TARGET]:t.path||"/",[V.ATTR_NET_PEER_NAME]:o,[V.ATTR_HTTP_HOST]:c.host??`${o}:${s}`},_={[ae.ATTR_HTTP_REQUEST_METHOD]:a,[ae.ATTR_SERVER_ADDRESS]:o,[ae.ATTR_SERVER_PORT]:Number(s),[ae.ATTR_URL_FULL]:p,[ae.ATTR_USER_AGENT_ORIGINAL]:l};switch(i!==a&&(_[ae.ATTR_HTTP_REQUEST_METHOD_ORIGINAL]=i),r&&l&&(_[V.ATTR_USER_AGENT_SYNTHETIC_TYPE]=SG(l)),l!==void 0&&(d[V.ATTR_HTTP_USER_AGENT]=l),n){case kn.SemconvStability.STABLE:return Object.assign(_,e.hookAttributes);case kn.SemconvStability.OLD:return Object.assign(d,e.hookAttributes)}return Object.assign(d,_,e.hookAttributes)};$.getOutgoingRequestAttributes=Uie;var wie=t=>{let e={};return e[V.ATTR_HTTP_METHOD]=t[V.ATTR_HTTP_METHOD],e[V.ATTR_NET_PEER_NAME]=t[V.ATTR_NET_PEER_NAME],e};$.getOutgoingRequestMetricAttributes=wie;var kie=(t,e)=>{t&&(e[V.ATTR_HTTP_FLAVOR]=t,t.toUpperCase()!=="QUIC"?e[V.ATTR_NET_TRANSPORT]=V.NET_TRANSPORT_VALUE_IP_TCP:e[V.ATTR_NET_TRANSPORT]=V.NET_TRANSPORT_VALUE_IP_UDP)};$.setAttributesFromHttpKind=kie;var SG=t=>{let e=String(t).toLowerCase();for(let n of hG.SYNTHETIC_TEST_NAMES)if(e.includes(n))return V.USER_AGENT_SYNTHETIC_TYPE_VALUE_TEST;for(let n of hG.SYNTHETIC_BOT_NAMES)if(e.includes(n))return V.USER_AGENT_SYNTHETIC_TYPE_VALUE_BOT},Gie=(t,e)=>{let{statusCode:n,statusMessage:r,httpVersion:o,socket:s}=t,i={},a={};if(n!=null&&(a[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]=n),s){let{remoteAddress:c,remotePort:l}=s;i[V.ATTR_NET_PEER_IP]=c,i[V.ATTR_NET_PEER_PORT]=l,a[ae.ATTR_NETWORK_PEER_ADDRESS]=c,a[ae.ATTR_NETWORK_PEER_PORT]=l,a[ae.ATTR_NETWORK_PROTOCOL_VERSION]=t.httpVersion}switch((0,$.setResponseContentLengthAttribute)(t,i),n&&(i[V.ATTR_HTTP_STATUS_CODE]=n,i[Nf.AttributeNames.HTTP_STATUS_TEXT]=(r||"").toUpperCase()),(0,$.setAttributesFromHttpKind)(o,i),e){case kn.SemconvStability.STABLE:return a;case kn.SemconvStability.OLD:return i}return Object.assign(i,a)};$.getOutgoingRequestAttributesOnResponse=Gie;var Bie=t=>{let e={};return e[V.ATTR_NET_PEER_PORT]=t[V.ATTR_NET_PEER_PORT],e[V.ATTR_HTTP_STATUS_CODE]=t[V.ATTR_HTTP_STATUS_CODE],e[V.ATTR_HTTP_FLAVOR]=t[V.ATTR_HTTP_FLAVOR],e};$.getOutgoingRequestMetricAttributesOnResponse=Bie;var jie=t=>{let e={};return t[ae.ATTR_NETWORK_PROTOCOL_VERSION]&&(e[ae.ATTR_NETWORK_PROTOCOL_VERSION]=t[ae.ATTR_NETWORK_PROTOCOL_VERSION]),t[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]&&(e[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]=t[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]),e};$.getOutgoingStableRequestMetricAttributesOnResponse=jie;function ds(t,e){let n=t.split(":");if(n.length===1)return e==="http"?{host:n[0],port:"80"}:e==="https"?{host:n[0],port:"443"}:{host:n[0]};if(n.length===2)return{host:n[0],port:n[1]};if(n[0].startsWith("[")){if(n[n.length-1].endsWith("]")){if(e==="http")return{host:t,port:"80"};if(e==="https")return{host:t,port:"443"}}else if(n[n.length-2].endsWith("]"))return{host:n.slice(0,-1).join(":"),port:n[n.length-1]}}return{host:t}}function Hie(t,e){let n=t.headers.forwarded;if(n){for(let s of RG(n))if(s.host)return ds(s.host,s.proto)}let r=t.headers["x-forwarded-host"];if(typeof r=="string")return typeof t.headers["x-forwarded-proto"]=="string"?ds(r,t.headers["x-forwarded-proto"]):Array.isArray(t.headers["x-forwarded-proto"])?ds(r,t.headers["x-forwarded-proto"][0]):ds(r);if(Array.isArray(r)&&typeof r[0]=="string"&&r[0].length>0)return typeof t.headers["x-forwarded-proto"]=="string"?ds(r[0],t.headers["x-forwarded-proto"]):Array.isArray(t.headers["x-forwarded-proto"])?ds(r[0],t.headers["x-forwarded-proto"][0]):ds(r[0]);let o=t.headers.host;return typeof o=="string"&&o.length>0?ds(o,e):null}function gG(t){let e=t.headers.forwarded;if(e){for(let o of RG(e))if(o.for)return TG(o.for)}let n=t.headers["x-forwarded-for"];if(n){let o;if(typeof n=="string"?o=n:Array.isArray(n)&&(o=n[0]),typeof o=="string")return o=o.split(",")[0].trim(),TG(o)}let r=t.socket.remoteAddress;return r||null}$.getRemoteClientAddress=gG;function TG(t){try{let{hostname:e}=new URL(`http://${t}`);return e.startsWith("[")&&e.endsWith("]")?e.slice(1,-1):e}catch{return t}}function Fie(t,e,n){try{if(e.headers.host)return new URL(e.url??"/",`${t}://${e.headers.host}`);{let r=new URL(e.url??"/",`${t}://localhost`);return{pathname:r.pathname,search:r.search,toString:function(){return r.pathname+r.search}}}}catch(r){return n.verbose("Unable to get URL from request",r),{}}}var Vie=(t,e,n)=>{let{component:r,enableSyntheticSourceDetection:o,hookAttributes:s,semconvStability:i,serverName:a}=e,{headers:c,httpVersion:l,method:p}=t,{host:d,"user-agent":_,"x-forwarded-for":f}=c,m=Fie(r,t,n),h,T;if(i!==kn.SemconvStability.OLD){let S=AG(p),R=Hie(t,r),I=gG(t);h={[ae.ATTR_HTTP_REQUEST_METHOD]:S,[ae.ATTR_URL_SCHEME]:r,[ae.ATTR_SERVER_ADDRESS]:R?.host,[ae.ATTR_NETWORK_PEER_ADDRESS]:t.socket.remoteAddress,[ae.ATTR_NETWORK_PEER_PORT]:t.socket.remotePort,[ae.ATTR_NETWORK_PROTOCOL_VERSION]:t.httpVersion,[ae.ATTR_USER_AGENT_ORIGINAL]:_},m.pathname!=null&&(h[ae.ATTR_URL_PATH]=m.pathname),m.search&&(h[ae.ATTR_URL_QUERY]=m.search.slice(1)),I!=null&&(h[ae.ATTR_CLIENT_ADDRESS]=I),R?.port!=null&&(h[ae.ATTR_SERVER_PORT]=Number(R.port)),p!==S&&(h[ae.ATTR_HTTP_REQUEST_METHOD_ORIGINAL]=p),o&&_&&(h[V.ATTR_USER_AGENT_SYNTHETIC_TYPE]=SG(_))}if(i!==kn.SemconvStability.STABLE){let S=d?.replace(/^(.*)(:[0-9]{1,5})/,"$1")||"localhost";T={[V.ATTR_HTTP_URL]:m.toString(),[V.ATTR_HTTP_HOST]:d,[V.ATTR_NET_HOST_NAME]:S,[V.ATTR_HTTP_METHOD]:p,[V.ATTR_HTTP_SCHEME]:r},typeof f=="string"&&(T[V.ATTR_HTTP_CLIENT_IP]=f.split(",")[0]),typeof a=="string"&&(T[V.ATTR_HTTP_SERVER_NAME]=a),m.pathname&&(T[V.ATTR_HTTP_TARGET]=m.pathname+m.search||"/"),_!==void 0&&(T[V.ATTR_HTTP_USER_AGENT]=_),(0,$.setRequestContentLengthAttribute)(t,T),(0,$.setAttributesFromHttpKind)(l,T)}switch(i){case kn.SemconvStability.STABLE:return Object.assign(h,s);case kn.SemconvStability.OLD:return Object.assign(T,s);default:return Object.assign(T,h,s)}};$.getIncomingRequestAttributes=Vie;var qie=t=>{let e={};return e[V.ATTR_HTTP_SCHEME]=t[V.ATTR_HTTP_SCHEME],e[V.ATTR_HTTP_METHOD]=t[V.ATTR_HTTP_METHOD],e[V.ATTR_NET_HOST_NAME]=t[V.ATTR_NET_HOST_NAME],e[V.ATTR_HTTP_FLAVOR]=t[V.ATTR_HTTP_FLAVOR],e};$.getIncomingRequestMetricAttributes=qie;var $ie=(t,e,n)=>{let{socket:r}=t,{statusCode:o,statusMessage:s}=e,i={[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]:o},a=(0,mG.getRPCMetadata)(Fl.context.active()),c={};if(r){let{localAddress:l,localPort:p,remoteAddress:d,remotePort:_}=r;c[V.ATTR_NET_HOST_IP]=l,c[V.ATTR_NET_HOST_PORT]=p,c[V.ATTR_NET_PEER_IP]=d,c[V.ATTR_NET_PEER_PORT]=_}switch(c[V.ATTR_HTTP_STATUS_CODE]=o,c[Nf.AttributeNames.HTTP_STATUS_TEXT]=(s||"").toUpperCase(),a?.type===mG.RPCType.HTTP&&a.route!==void 0&&(c[ae.ATTR_HTTP_ROUTE]=a.route,i[ae.ATTR_HTTP_ROUTE]=a.route),n){case kn.SemconvStability.STABLE:return i;case kn.SemconvStability.OLD:return c}return Object.assign(c,i)};$.getIncomingRequestAttributesOnResponse=$ie;var Yie=t=>{let e={};return e[V.ATTR_HTTP_STATUS_CODE]=t[V.ATTR_HTTP_STATUS_CODE],e[V.ATTR_NET_HOST_PORT]=t[V.ATTR_NET_HOST_PORT],t[ae.ATTR_HTTP_ROUTE]!==void 0&&(e[ae.ATTR_HTTP_ROUTE]=t[ae.ATTR_HTTP_ROUTE]),e};$.getIncomingRequestMetricAttributesOnResponse=Yie;var Wie=t=>{let e={};return t[ae.ATTR_HTTP_ROUTE]!==void 0&&(e[ae.ATTR_HTTP_ROUTE]=t[ae.ATTR_HTTP_ROUTE]),t[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]&&(e[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]=t[ae.ATTR_HTTP_RESPONSE_STATUS_CODE]),e};$.getIncomingStableRequestMetricAttributesOnResponse=Wie;function zie(t,e,n){let r=new Map;for(let o=0,s=e.length;o<s;o++){let i=e[o].toLowerCase();n&kn.SemconvStability.STABLE?r.set(i,i):r.set(i,i.replaceAll("-","_"))}return o=>{let s={};for(let i of r.keys()){let a=o(i);if(a===void 0)continue;let c=r.get(i),l=`http.${t}.header.${c}`;typeof a=="string"?s[l]=[a]:Array.isArray(a)?s[l]=a:s[l]=[a]}return s}}$.headerCapture=zie;var Kie=new Set(["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH","QUERY"]);function AG(t){if(t==null)return"GET";let e=t.toUpperCase();return Kie.has(e)?e:"_OTHER"}function RG(t){try{return yie(t)}catch{return[]}}});var IG=E(bf=>{"use strict";Object.defineProperty(bf,"__esModule",{value:!0});bf.HttpInstrumentation=void 0;var oe=(b(),O(v)),_s=Te(),Qie=U("url"),Xie=nk(),Rt=ne(),ER=U("events"),Le=(le(),O(Ae)),Ke=yG(),SR=class extends Rt.InstrumentationBase{_spanNotEnded=new WeakSet;_headerCapture;_httpPatched=!1;_httpsPatched=!1;_semconvStability=Rt.SemconvStability.OLD;constructor(e={}){super("@opentelemetry/instrumentation-http",Xie.VERSION,e),this._semconvStability=(0,Rt.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._headerCapture=this._createHeaderCapture(this._semconvStability)}_updateMetricInstruments(){this._oldHttpServerDurationHistogram=this.meter.createHistogram("http.server.duration",{description:"Measures the duration of inbound HTTP requests.",unit:"ms",valueType:oe.ValueType.DOUBLE}),this._oldHttpClientDurationHistogram=this.meter.createHistogram("http.client.duration",{description:"Measures the duration of outbound HTTP requests.",unit:"ms",valueType:oe.ValueType.DOUBLE}),this._stableHttpServerDurationHistogram=this.meter.createHistogram(Le.METRIC_HTTP_SERVER_REQUEST_DURATION,{description:"Duration of HTTP server requests.",unit:"s",valueType:oe.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10]}}),this._stableHttpClientDurationHistogram=this.meter.createHistogram(Le.METRIC_HTTP_CLIENT_REQUEST_DURATION,{description:"Duration of HTTP client requests.",unit:"s",valueType:oe.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10]}})}_recordServerDuration(e,n,r){this._semconvStability&Rt.SemconvStability.OLD&&this._oldHttpServerDurationHistogram.record(e,n),this._semconvStability&Rt.SemconvStability.STABLE&&this._stableHttpServerDurationHistogram.record(e/1e3,r)}_recordClientDuration(e,n,r){this._semconvStability&Rt.SemconvStability.OLD&&this._oldHttpClientDurationHistogram.record(e,n),this._semconvStability&Rt.SemconvStability.STABLE&&this._stableHttpClientDurationHistogram.record(e/1e3,r)}setConfig(e={}){super.setConfig(e),this._headerCapture=this._createHeaderCapture(this._semconvStability)}init(){return[this._getHttpsInstrumentation(),this._getHttpInstrumentation()]}_getHttpInstrumentation(){return new Rt.InstrumentationNodeModuleDefinition("http",["*"],e=>{if(this._httpPatched)return e;this._httpPatched=!0;let n=e[Symbol.toStringTag]==="Module";if(!this.getConfig().disableOutgoingRequestInstrumentation){let r=this._wrap(e,"request",this._getPatchOutgoingRequestFunction("http")),o=this._wrap(e,"get",this._getPatchOutgoingGetFunction(r));n&&(e.default.request=r,e.default.get=o)}return this.getConfig().disableIncomingRequestInstrumentation||this._wrap(e.Server.prototype,"emit",this._getPatchIncomingRequestFunction("http")),e},e=>{this._httpPatched=!1,e!==void 0&&(this.getConfig().disableOutgoingRequestInstrumentation||(this._unwrap(e,"request"),this._unwrap(e,"get")),this.getConfig().disableIncomingRequestInstrumentation||this._unwrap(e.Server.prototype,"emit"))})}_getHttpsInstrumentation(){return new Rt.InstrumentationNodeModuleDefinition("https",["*"],e=>{if(this._httpsPatched)return e;this._httpsPatched=!0;let n=e[Symbol.toStringTag]==="Module";if(!this.getConfig().disableOutgoingRequestInstrumentation){let r=this._wrap(e,"request",this._getPatchHttpsOutgoingRequestFunction("https")),o=this._wrap(e,"get",this._getPatchHttpsOutgoingGetFunction(r));n&&(e.default.request=r,e.default.get=o)}return this.getConfig().disableIncomingRequestInstrumentation||this._wrap(e.Server.prototype,"emit",this._getPatchIncomingRequestFunction("https")),e},e=>{this._httpsPatched=!1,e!==void 0&&(this.getConfig().disableOutgoingRequestInstrumentation||(this._unwrap(e,"request"),this._unwrap(e,"get")),this.getConfig().disableIncomingRequestInstrumentation||this._unwrap(e.Server.prototype,"emit"))})}_getPatchIncomingRequestFunction(e){return n=>this._incomingRequestFunction(e,n)}_getPatchOutgoingRequestFunction(e){return n=>this._outgoingRequestFunction(e,n)}_getPatchOutgoingGetFunction(e){return n=>function(o,...s){let i=e(o,...s);return i.end(),i}}_getPatchHttpsOutgoingRequestFunction(e){return n=>{let r=this;return function(s,...i){return e==="https"&&typeof s=="object"&&s?.constructor?.name!=="URL"&&(s=Object.assign({},s),r._setDefaultOptions(s)),r._getPatchOutgoingRequestFunction(e)(n)(s,...i)}}}_setDefaultOptions(e){e.protocol=e.protocol||"https:",e.port=e.port||443}_getPatchHttpsOutgoingGetFunction(e){return n=>{let r=this;return function(s,...i){return r._getPatchOutgoingGetFunction(e)(n)(s,...i)}}}_traceClientRequest(e,n,r,o,s){this.getConfig().requestHook&&this._callRequestHook(n,e);let i=!1;return e.prependListener("response",a=>{this._diag.debug("outgoingRequest on response()"),e.listenerCount("response")<=1&&a.resume();let c=(0,Ke.getOutgoingRequestAttributesOnResponse)(a,this._semconvStability);n.setAttributes(c),o=Object.assign(o,(0,Ke.getOutgoingRequestMetricAttributesOnResponse)(c)),s=Object.assign(s,(0,Ke.getOutgoingStableRequestMetricAttributesOnResponse)(c)),this.getConfig().responseHook&&this._callResponseHook(n,a),n.setAttributes(this._headerCapture.client.captureRequestHeaders(p=>e.getHeader(p))),n.setAttributes(this._headerCapture.client.captureResponseHeaders(p=>a.headers[p])),oe.context.bind(oe.context.active(),a);let l=()=>{if(this._diag.debug("outgoingRequest on end()"),i)return;i=!0;let p;a.aborted&&!a.complete?p={code:oe.SpanStatusCode.ERROR}:p={code:(0,Ke.parseResponseStatus)(oe.SpanKind.CLIENT,a.statusCode)},n.setStatus(p),this.getConfig().applyCustomAttributesOnSpan&&(0,Rt.safeExecuteInTheMiddle)(()=>this.getConfig().applyCustomAttributesOnSpan(n,e,a),()=>{},!0),this._closeHttpSpan(n,oe.SpanKind.CLIENT,r,o,s)};a.on("end",l),a.on(ER.errorMonitor,p=>{this._diag.debug("outgoingRequest on error()",p),!i&&(i=!0,this._onOutgoingRequestError(n,o,s,r,p))})}),e.on("close",()=>{this._diag.debug("outgoingRequest on request close()"),!(e.aborted||i)&&(i=!0,this._closeHttpSpan(n,oe.SpanKind.CLIENT,r,o,s))}),e.on(ER.errorMonitor,a=>{this._diag.debug("outgoingRequest on request error()",a),!i&&(i=!0,this._onOutgoingRequestError(n,o,s,r,a))}),this._diag.debug("http.ClientRequest return request"),e}_incomingRequestFunction(e,n){let r=this;return function(s,...i){if(s!=="request")return n.apply(this,[s,...i]);let a=i[0],c=i[1],l=a.method||"GET";if(r._diag.debug(`${e} instrumentation incomingRequest`),(0,Rt.safeExecuteInTheMiddle)(()=>r.getConfig().ignoreIncomingRequestHook?.(a),I=>{I!=null&&r._diag.error("caught ignoreIncomingRequestHook error: ",I)},!0))return oe.context.with((0,_s.suppressTracing)(oe.context.active()),()=>(oe.context.bind(oe.context.active(),a),oe.context.bind(oe.context.active(),c),n.apply(this,[s,...i])));let p=a.headers,d=(0,Ke.getIncomingRequestAttributes)(a,{component:e,serverName:r.getConfig().serverName,hookAttributes:r._callStartSpanHook(a,r.getConfig().startIncomingSpanHook),semconvStability:r._semconvStability,enableSyntheticSourceDetection:r.getConfig().enableSyntheticSourceDetection||!1},r._diag);Object.assign(d,r._headerCapture.server.captureRequestHeaders(I=>a.headers[I]));let _={kind:oe.SpanKind.SERVER,attributes:d},f=(0,_s.hrTime)(),m=(0,Ke.getIncomingRequestMetricAttributes)(d),h={[Le.ATTR_HTTP_REQUEST_METHOD]:d[Le.ATTR_HTTP_REQUEST_METHOD],[Le.ATTR_URL_SCHEME]:d[Le.ATTR_URL_SCHEME]};d[Le.ATTR_NETWORK_PROTOCOL_VERSION]&&(h[Le.ATTR_NETWORK_PROTOCOL_VERSION]=d[Le.ATTR_NETWORK_PROTOCOL_VERSION]);let T=oe.propagation.extract(oe.ROOT_CONTEXT,p),S=r._startHttpSpan(l,_,T),R={type:_s.RPCType.HTTP,span:S};return oe.context.with((0,_s.setRPCMetadata)(oe.trace.setSpan(T,S),R),()=>{oe.context.bind(oe.context.active(),a),oe.context.bind(oe.context.active(),c),r.getConfig().requestHook&&r._callRequestHook(S,a),r.getConfig().responseHook&&r._callResponseHook(S,c);let I=!1;return c.on("close",()=>{I||r._onServerResponseFinish(a,c,S,m,h,f)}),c.on(ER.errorMonitor,x=>{I=!0,r._onServerResponseError(S,m,h,f,x)}),(0,Rt.safeExecuteInTheMiddle)(()=>n.apply(this,[s,...i]),x=>{if(x)throw r._onServerResponseError(S,m,h,f,x),x})})}}_outgoingRequestFunction(e,n){let r=this;return function(s,...i){if(!(0,Ke.isValidOptionsType)(s))return n.apply(this,[s,...i]);let a=typeof i[0]=="object"&&(typeof s=="string"||s instanceof Qie.URL)?i.shift():void 0,{method:c,invalidUrl:l,optionsParsed:p}=(0,Ke.getRequestInfo)(r._diag,s,a);if((0,Rt.safeExecuteInTheMiddle)(()=>r.getConfig().ignoreOutgoingRequestHook?.(p),F=>{F!=null&&r._diag.error("caught ignoreOutgoingRequestHook error: ",F)},!0))return n.apply(this,[p,...i]);let{hostname:d,port:_}=(0,Ke.extractHostnameAndPort)(p),f=(0,Ke.getOutgoingRequestAttributes)(p,{component:e,port:_,hostname:d,hookAttributes:r._callStartSpanHook(p,r.getConfig().startOutgoingSpanHook),redactedQueryParams:r.getConfig().redactedQueryParams},r._semconvStability,r.getConfig().enableSyntheticSourceDetection||!1),m=(0,_s.hrTime)(),h=(0,Ke.getOutgoingRequestMetricAttributes)(f),T={[Le.ATTR_HTTP_REQUEST_METHOD]:f[Le.ATTR_HTTP_REQUEST_METHOD],[Le.ATTR_SERVER_ADDRESS]:f[Le.ATTR_SERVER_ADDRESS],[Le.ATTR_SERVER_PORT]:f[Le.ATTR_SERVER_PORT]};f[Le.ATTR_HTTP_RESPONSE_STATUS_CODE]&&(T[Le.ATTR_HTTP_RESPONSE_STATUS_CODE]=f[Le.ATTR_HTTP_RESPONSE_STATUS_CODE]),f[Le.ATTR_NETWORK_PROTOCOL_VERSION]&&(T[Le.ATTR_NETWORK_PROTOCOL_VERSION]=f[Le.ATTR_NETWORK_PROTOCOL_VERSION]);let S={kind:oe.SpanKind.CLIENT,attributes:f},R=r._startHttpSpan(c,S),I=oe.context.active(),x=oe.trace.setSpan(I,R);return p.headers?p.headers=Object.assign({},p.headers):p.headers={},oe.propagation.inject(x,p.headers),oe.context.with(x,()=>{let F=i[i.length-1];typeof F=="function"&&(i[i.length-1]=oe.context.bind(I,F));let B=(0,Rt.safeExecuteInTheMiddle)(()=>l?n.apply(this,[s,...i]):n.apply(this,[p,...i]),se=>{if(se)throw r._onOutgoingRequestError(R,h,T,m,se),se});return r._diag.debug(`${e} instrumentation outgoingRequest`),oe.context.bind(I,B),r._traceClientRequest(B,R,m,h,T)})}}_onServerResponseFinish(e,n,r,o,s,i){let a=(0,Ke.getIncomingRequestAttributesOnResponse)(e,n,this._semconvStability);o=Object.assign(o,(0,Ke.getIncomingRequestMetricAttributesOnResponse)(a)),s=Object.assign(s,(0,Ke.getIncomingStableRequestMetricAttributesOnResponse)(a)),r.setAttributes(this._headerCapture.server.captureResponseHeaders(l=>n.getHeader(l))),r.setAttributes(a).setStatus({code:(0,Ke.parseResponseStatus)(oe.SpanKind.SERVER,n.statusCode)});let c=a[Le.ATTR_HTTP_ROUTE];c&&r.updateName(`${e.method||"GET"} ${c}`),this.getConfig().applyCustomAttributesOnSpan&&(0,Rt.safeExecuteInTheMiddle)(()=>this.getConfig().applyCustomAttributesOnSpan(r,e,n),()=>{},!0),this._closeHttpSpan(r,oe.SpanKind.SERVER,i,o,s)}_onOutgoingRequestError(e,n,r,o,s){(0,Ke.setSpanWithError)(e,s,this._semconvStability),r[Le.ATTR_ERROR_TYPE]=s.name,this._closeHttpSpan(e,oe.SpanKind.CLIENT,o,n,r)}_onServerResponseError(e,n,r,o,s){(0,Ke.setSpanWithError)(e,s,this._semconvStability),r[Le.ATTR_ERROR_TYPE]=s.name,this._closeHttpSpan(e,oe.SpanKind.SERVER,o,n,r)}_startHttpSpan(e,n,r=oe.context.active()){let o=n.kind===oe.SpanKind.CLIENT?this.getConfig().requireParentforOutgoingSpans:this.getConfig().requireParentforIncomingSpans,s,i=oe.trace.getSpan(r);return o===!0&&(!i||!oe.trace.isSpanContextValid(i.spanContext()))?s=oe.trace.wrapSpanContext(oe.INVALID_SPAN_CONTEXT):o===!0&&i?.spanContext().isRemote?s=i:s=this.tracer.startSpan(e,n,r),this._spanNotEnded.add(s),s}_closeHttpSpan(e,n,r,o,s){if(!this._spanNotEnded.has(e))return;e.end(),this._spanNotEnded.delete(e);let i=(0,_s.hrTimeToMilliseconds)((0,_s.hrTimeDuration)(r,(0,_s.hrTime)()));n===oe.SpanKind.SERVER?this._recordServerDuration(i,o,s):n===oe.SpanKind.CLIENT&&this._recordClientDuration(i,o,s)}_callResponseHook(e,n){(0,Rt.safeExecuteInTheMiddle)(()=>this.getConfig().responseHook(e,n),()=>{},!0)}_callRequestHook(e,n){(0,Rt.safeExecuteInTheMiddle)(()=>this.getConfig().requestHook(e,n),()=>{},!0)}_callStartSpanHook(e,n){if(typeof n=="function")return(0,Rt.safeExecuteInTheMiddle)(()=>n(e),()=>{},!0)}_createHeaderCapture(e){let n=this.getConfig();return{client:{captureRequestHeaders:(0,Ke.headerCapture)("request",n.headersToSpanAttributes?.client?.requestHeaders??[],e),captureResponseHeaders:(0,Ke.headerCapture)("response",n.headersToSpanAttributes?.client?.responseHeaders??[],e)},server:{captureRequestHeaders:(0,Ke.headerCapture)("request",n.headersToSpanAttributes?.server?.requestHeaders??[],e),captureResponseHeaders:(0,Ke.headerCapture)("response",n.headersToSpanAttributes?.server?.responseHeaders??[],e)}}}};bf.HttpInstrumentation=SR});var OG=E(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});Cf.HttpInstrumentation=void 0;var Jie=IG();Object.defineProperty(Cf,"HttpInstrumentation",{enumerable:!0,get:function(){return Jie.HttpInstrumentation}})});var EI=E(jm=>{"use strict";Object.defineProperty(jm,"__esModule",{value:!0});jm.AbstractAsyncHooksContextManager=void 0;var Lpe=U("events"),Dpe=["addListener","on","once","prependListener","prependOnceListener"],TI=class{bind(e,n){return n instanceof Lpe.EventEmitter?this._bindEventEmitter(e,n):typeof n=="function"?this._bindFunction(e,n):n}_bindFunction(e,n){let r=this,o=function(...s){return r.with(e,()=>n.apply(this,s))};return Object.defineProperty(o,"length",{enumerable:!1,configurable:!0,writable:!1,value:n.length}),o}_bindEventEmitter(e,n){return this._getPatchMap(n)!==void 0||(this._createPatchMap(n),Dpe.forEach(o=>{n[o]!==void 0&&(n[o]=this._patchAddListener(n,n[o],e))}),typeof n.removeListener=="function"&&(n.removeListener=this._patchRemoveListener(n,n.removeListener)),typeof n.off=="function"&&(n.off=this._patchRemoveListener(n,n.off)),typeof n.removeAllListeners=="function"&&(n.removeAllListeners=this._patchRemoveAllListeners(n,n.removeAllListeners))),n}_patchRemoveListener(e,n){let r=this;return function(o,s){let i=r._getPatchMap(e)?.[o];if(i===void 0)return n.call(this,o,s);let a=i.get(s);return n.call(this,o,a||s)}}_patchRemoveAllListeners(e,n){let r=this;return function(o){let s=r._getPatchMap(e);return s!==void 0&&(arguments.length===0?r._createPatchMap(e):s[o]!==void 0&&delete s[o]),n.apply(this,arguments)}}_patchAddListener(e,n,r){let o=this;return function(s,i){if(o._wrapped)return n.call(this,s,i);let a=o._getPatchMap(e);a===void 0&&(a=o._createPatchMap(e));let c=a[s];c===void 0&&(c=new WeakMap,a[s]=c);let l=o.bind(r,i);c.set(i,l),o._wrapped=!0;try{return n.call(this,s,l)}finally{o._wrapped=!1}}}_createPatchMap(e){let n=Object.create(null);return e[this._kOtListeners]=n,n}_getPatchMap(e){return e[this._kOtListeners]}_kOtListeners=Symbol("OtListeners");_wrapped=!1};jm.AbstractAsyncHooksContextManager=TI});var PH=E(Hm=>{"use strict";Object.defineProperty(Hm,"__esModule",{value:!0});Hm.AsyncHooksContextManager=void 0;var Upe=(b(),O(v)),wpe=U("async_hooks"),kpe=EI(),SI=class extends kpe.AbstractAsyncHooksContextManager{_asyncHook;_contexts=new Map;_stack=[];constructor(){super(),this._asyncHook=wpe.createHook({init:this._init.bind(this),before:this._before.bind(this),after:this._after.bind(this),destroy:this._destroy.bind(this),promiseResolve:this._destroy.bind(this)})}active(){return this._stack[this._stack.length-1]??Upe.ROOT_CONTEXT}with(e,n,r,...o){this._enterContext(e);try{return n.call(r,...o)}finally{this._exitContext()}}enable(){return this._asyncHook.enable(),this}disable(){return this._asyncHook.disable(),this._contexts.clear(),this._stack=[],this}_init(e,n){if(n==="TIMERWRAP")return;let r=this._stack[this._stack.length-1];r!==void 0&&this._contexts.set(e,r)}_destroy(e){this._contexts.delete(e)}_before(e){let n=this._contexts.get(e);n!==void 0&&this._enterContext(n)}_after(){this._exitContext()}_enterContext(e){this._stack.push(e)}_exitContext(){this._stack.pop()}};Hm.AsyncHooksContextManager=SI});var MH=E(Fm=>{"use strict";Object.defineProperty(Fm,"__esModule",{value:!0});Fm.AsyncLocalStorageContextManager=void 0;var Gpe=(b(),O(v)),Bpe=U("async_hooks"),jpe=EI(),gI=class extends jpe.AbstractAsyncHooksContextManager{_asyncLocalStorage;constructor(){super(),this._asyncLocalStorage=new Bpe.AsyncLocalStorage}active(){return this._asyncLocalStorage.getStore()??Gpe.ROOT_CONTEXT}with(e,n,r,...o){let s=r==null?n:n.bind(r);return this._asyncLocalStorage.run(e,s,...o)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}};Fm.AsyncLocalStorageContextManager=gI});var xH=E(Kc=>{"use strict";Object.defineProperty(Kc,"__esModule",{value:!0});Kc.AsyncLocalStorageContextManager=Kc.AsyncHooksContextManager=void 0;var Hpe=PH();Object.defineProperty(Kc,"AsyncHooksContextManager",{enumerable:!0,get:function(){return Hpe.AsyncHooksContextManager}});var Fpe=MH();Object.defineProperty(Kc,"AsyncLocalStorageContextManager",{enumerable:!0,get:function(){return Fpe.AsyncLocalStorageContextManager}})});var AI=E(Qc=>{"use strict";Object.defineProperty(Qc,"__esModule",{value:!0});Qc._clearDefaultServiceNameCache=Qc.defaultServiceName=void 0;var Mp;function Vpe(){if(Mp===void 0)try{let t=globalThis.process.argv0;Mp=t?`unknown_service:${t}`:"unknown_service"}catch{Mp="unknown_service"}return Mp}Qc.defaultServiceName=Vpe;function qpe(){Mp=void 0}Qc._clearDefaultServiceNameCache=qpe});var vH=E(Vm=>{"use strict";Object.defineProperty(Vm,"__esModule",{value:!0});Vm.isPromiseLike=void 0;var $pe=t=>t!==null&&typeof t=="object"&&typeof t.then=="function";Vm.isPromiseLike=$pe});var II=E(to=>{"use strict";Object.defineProperty(to,"__esModule",{value:!0});to.defaultResource=to.emptyResource=to.resourceFromDetectedResource=to.resourceFromAttributes=void 0;var vp=(b(),O(v)),RI=Te(),sa=(le(),O(Ae)),Ype=AI(),xp=vH(),qm=class t{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,n){let r=new t({},n);return r._rawAttributes=LH(e),r._asyncAttributesPending=e.filter(([o,s])=>(0,xp.isPromiseLike)(s)).length>0,r}constructor(e,n){let r=e.attributes??{};this._rawAttributes=Object.entries(r).map(([o,s])=>((0,xp.isPromiseLike)(s)&&(this._asyncAttributesPending=!0),[o,s])),this._rawAttributes=LH(this._rawAttributes),this._schemaUrl=Qpe(n?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[n,r]=this._rawAttributes[e];this._rawAttributes[e]=[n,(0,xp.isPromiseLike)(r)?await r:r]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&vp.diag.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[n,r]of this._rawAttributes){if((0,xp.isPromiseLike)(r)){vp.diag.debug(`Unsettled resource attribute ${n} skipped`);continue}r!=null&&(e[n]??=r)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){if(e==null)return this;let n=Xpe(this,e),r=n?{schemaUrl:n}:void 0;return t.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],r)}};function yI(t,e){return qm.FromAttributeList(Object.entries(t),e)}to.resourceFromAttributes=yI;function Wpe(t,e){return new qm(t,e)}to.resourceFromDetectedResource=Wpe;function zpe(){return yI({})}to.emptyResource=zpe;function Kpe(){return yI({[sa.ATTR_SERVICE_NAME]:(0,Ype.defaultServiceName)(),[sa.ATTR_TELEMETRY_SDK_LANGUAGE]:RI.SDK_INFO[sa.ATTR_TELEMETRY_SDK_LANGUAGE],[sa.ATTR_TELEMETRY_SDK_NAME]:RI.SDK_INFO[sa.ATTR_TELEMETRY_SDK_NAME],[sa.ATTR_TELEMETRY_SDK_VERSION]:RI.SDK_INFO[sa.ATTR_TELEMETRY_SDK_VERSION]})}to.defaultResource=Kpe;function LH(t){return t.map(([e,n])=>(0,xp.isPromiseLike)(n)?[e,n.catch(r=>{vp.diag.debug("promise rejection for resource attribute: %s - %s",e,r)})]:[e,n])}function Qpe(t){if(typeof t=="string"||t===void 0)return t;vp.diag.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",t)}function Xpe(t,e){let n=t?.schemaUrl,r=e?.schemaUrl,o=n===void 0||n==="",s=r===void 0||r==="";if(o)return r;if(s||n===r)return n;vp.diag.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',n,r)}});var UH=E($m=>{"use strict";Object.defineProperty($m,"__esModule",{value:!0});$m.detectResources=void 0;var DH=(b(),O(v)),OI=II(),Jpe=(t={})=>(t.detectors||[]).map(n=>{try{let r=(0,OI.resourceFromDetectedResource)(n.detect(t));return DH.diag.debug(`${n.constructor.name} found resource.`,r),r}catch(r){return DH.diag.debug(`${n.constructor.name} failed: ${r.message}`),(0,OI.emptyResource)()}}).reduce((n,r)=>n.merge(r),(0,OI.emptyResource)());$m.detectResources=Jpe});var kH=E(Ym=>{"use strict";Object.defineProperty(Ym,"__esModule",{value:!0});Ym.envDetector=void 0;var Zpe=(b(),O(v)),ede=(le(),O(Ae)),wH=Te(),NI=class{_MAX_LENGTH=255;_COMMA_SEPARATOR=",";_LABEL_KEY_VALUE_SPLITTER="=";detect(e){let n={},r=(0,wH.getStringFromEnv)("OTEL_RESOURCE_ATTRIBUTES"),o=(0,wH.getStringFromEnv)("OTEL_SERVICE_NAME");if(r)try{let s=this._parseResourceAttributes(r);Object.assign(n,s)}catch(s){Zpe.diag.debug(`EnvDetector failed: ${s instanceof Error?s.message:s}`)}return o&&(n[ede.ATTR_SERVICE_NAME]=o),{attributes:n}}_parseResourceAttributes(e){if(!e)return{};let n={},r=e.split(this._COMMA_SEPARATOR);for(let o of r){let s=o.split(this._LABEL_KEY_VALUE_SPLITTER);if(s.length!==2)throw new Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${o}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);let[i,a]=s,c=i.trim(),l=a.trim();if(c.length===0)throw new Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${o}".`);let p,d;try{p=decodeURIComponent(c),d=decodeURIComponent(l)}catch(_){throw new Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${o}": ${_ instanceof Error?_.message:_}`)}if(p.length>this._MAX_LENGTH)throw new Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${p}".`);if(d.length>this._MAX_LENGTH)throw new Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${p}".`);n[p]=d}return n}};Ym.envDetector=new NI});var Lp=E(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.ATTR_WEBENGINE_VERSION=L.ATTR_WEBENGINE_NAME=L.ATTR_WEBENGINE_DESCRIPTION=L.ATTR_SERVICE_NAMESPACE=L.ATTR_SERVICE_INSTANCE_ID=L.ATTR_PROCESS_RUNTIME_VERSION=L.ATTR_PROCESS_RUNTIME_NAME=L.ATTR_PROCESS_RUNTIME_DESCRIPTION=L.ATTR_PROCESS_PID=L.ATTR_PROCESS_OWNER=L.ATTR_PROCESS_EXECUTABLE_PATH=L.ATTR_PROCESS_EXECUTABLE_NAME=L.ATTR_PROCESS_COMMAND_ARGS=L.ATTR_PROCESS_COMMAND=L.ATTR_OS_VERSION=L.ATTR_OS_TYPE=L.ATTR_K8S_POD_NAME=L.ATTR_K8S_NAMESPACE_NAME=L.ATTR_K8S_DEPLOYMENT_NAME=L.ATTR_K8S_CLUSTER_NAME=L.ATTR_HOST_TYPE=L.ATTR_HOST_NAME=L.ATTR_HOST_IMAGE_VERSION=L.ATTR_HOST_IMAGE_NAME=L.ATTR_HOST_IMAGE_ID=L.ATTR_HOST_ID=L.ATTR_HOST_ARCH=L.ATTR_CONTAINER_NAME=L.ATTR_CONTAINER_IMAGE_TAGS=L.ATTR_CONTAINER_IMAGE_NAME=L.ATTR_CONTAINER_ID=L.ATTR_CLOUD_REGION=L.ATTR_CLOUD_PROVIDER=L.ATTR_CLOUD_AVAILABILITY_ZONE=L.ATTR_CLOUD_ACCOUNT_ID=void 0;L.ATTR_CLOUD_ACCOUNT_ID="cloud.account.id";L.ATTR_CLOUD_AVAILABILITY_ZONE="cloud.availability_zone";L.ATTR_CLOUD_PROVIDER="cloud.provider";L.ATTR_CLOUD_REGION="cloud.region";L.ATTR_CONTAINER_ID="container.id";L.ATTR_CONTAINER_IMAGE_NAME="container.image.name";L.ATTR_CONTAINER_IMAGE_TAGS="container.image.tags";L.ATTR_CONTAINER_NAME="container.name";L.ATTR_HOST_ARCH="host.arch";L.ATTR_HOST_ID="host.id";L.ATTR_HOST_IMAGE_ID="host.image.id";L.ATTR_HOST_IMAGE_NAME="host.image.name";L.ATTR_HOST_IMAGE_VERSION="host.image.version";L.ATTR_HOST_NAME="host.name";L.ATTR_HOST_TYPE="host.type";L.ATTR_K8S_CLUSTER_NAME="k8s.cluster.name";L.ATTR_K8S_DEPLOYMENT_NAME="k8s.deployment.name";L.ATTR_K8S_NAMESPACE_NAME="k8s.namespace.name";L.ATTR_K8S_POD_NAME="k8s.pod.name";L.ATTR_OS_TYPE="os.type";L.ATTR_OS_VERSION="os.version";L.ATTR_PROCESS_COMMAND="process.command";L.ATTR_PROCESS_COMMAND_ARGS="process.command_args";L.ATTR_PROCESS_EXECUTABLE_NAME="process.executable.name";L.ATTR_PROCESS_EXECUTABLE_PATH="process.executable.path";L.ATTR_PROCESS_OWNER="process.owner";L.ATTR_PROCESS_PID="process.pid";L.ATTR_PROCESS_RUNTIME_DESCRIPTION="process.runtime.description";L.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name";L.ATTR_PROCESS_RUNTIME_VERSION="process.runtime.version";L.ATTR_SERVICE_INSTANCE_ID="service.instance.id";L.ATTR_SERVICE_NAMESPACE="service.namespace";L.ATTR_WEBENGINE_DESCRIPTION="webengine.description";L.ATTR_WEBENGINE_NAME="webengine.name";L.ATTR_WEBENGINE_VERSION="webengine.version"});var zm=E(Wm=>{"use strict";Object.defineProperty(Wm,"__esModule",{value:!0});Wm.execAsync=void 0;var tde=U("child_process"),nde=U("util");Wm.execAsync=nde.promisify(tde.exec)});var GH=E(Km=>{"use strict";Object.defineProperty(Km,"__esModule",{value:!0});Km.getMachineId=void 0;var rde=zm(),ode=(b(),O(v));async function sde(){try{let e=(await(0,rde.execAsync)('ioreg -rd1 -c "IOPlatformExpertDevice"')).stdout.split(`
7
+ `).find(r=>r.includes("IOPlatformUUID"));if(!e)return;let n=e.split('" = "');if(n.length===2)return n[1].slice(0,-1)}catch(t){ode.diag.debug(`error reading machine id: ${t}`)}}Km.getMachineId=sde});var BH=E(Qm=>{"use strict";Object.defineProperty(Qm,"__esModule",{value:!0});Qm.getMachineId=void 0;var ide=U("fs"),ade=(b(),O(v));async function cde(){let t=["/etc/machine-id","/var/lib/dbus/machine-id"];for(let e of t)try{return(await ide.promises.readFile(e,{encoding:"utf8"})).trim()}catch(n){ade.diag.debug(`error reading machine id: ${n}`)}}Qm.getMachineId=cde});var HH=E(Xm=>{"use strict";Object.defineProperty(Xm,"__esModule",{value:!0});Xm.getMachineId=void 0;var ude=U("fs"),lde=zm(),jH=(b(),O(v));async function pde(){try{return(await ude.promises.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(t){jH.diag.debug(`error reading machine id: ${t}`)}try{return(await(0,lde.execAsync)("kenv -q smbios.system.uuid")).stdout.trim()}catch(t){jH.diag.debug(`error reading machine id: ${t}`)}}Xm.getMachineId=pde});var VH=E(Jm=>{"use strict";Object.defineProperty(Jm,"__esModule",{value:!0});Jm.getMachineId=void 0;var FH=U("process"),dde=zm(),_de=(b(),O(v));async function fde(){let t="QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",e="%windir%\\System32\\REG.exe";FH.arch==="ia32"&&"PROCESSOR_ARCHITEW6432"in FH.env&&(e="%windir%\\sysnative\\cmd.exe /c "+e);try{let r=(await(0,dde.execAsync)(`${e} ${t}`)).stdout.split("REG_SZ");if(r.length===2)return r[1].trim()}catch(n){_de.diag.debug(`error reading machine id: ${n}`)}}Jm.getMachineId=fde});var qH=E(Zm=>{"use strict";Object.defineProperty(Zm,"__esModule",{value:!0});Zm.getMachineId=void 0;var mde=(b(),O(v));async function hde(){mde.diag.debug("could not read machine-id: unsupported platform")}Zm.getMachineId=hde});var $H=E(eh=>{"use strict";Object.defineProperty(eh,"__esModule",{value:!0});eh.getMachineId=void 0;var Tde=U("process"),ia;async function Ede(){if(!ia)switch(Tde.platform){case"darwin":ia=(await Promise.resolve().then(()=>K(GH()))).getMachineId;break;case"linux":ia=(await Promise.resolve().then(()=>K(BH()))).getMachineId;break;case"freebsd":ia=(await Promise.resolve().then(()=>K(HH()))).getMachineId;break;case"win32":ia=(await Promise.resolve().then(()=>K(VH()))).getMachineId;break;default:ia=(await Promise.resolve().then(()=>K(qH()))).getMachineId;break}return ia()}eh.getMachineId=Ede});var bI=E(Xc=>{"use strict";Object.defineProperty(Xc,"__esModule",{value:!0});Xc.normalizeType=Xc.normalizeArch=void 0;var Sde=t=>{switch(t){case"arm":return"arm32";case"ppc":return"ppc32";case"x64":return"amd64";default:return t}};Xc.normalizeArch=Sde;var gde=t=>{switch(t){case"sunos":return"solaris";case"win32":return"windows";default:return t}};Xc.normalizeType=gde});var WH=E(th=>{"use strict";Object.defineProperty(th,"__esModule",{value:!0});th.hostDetector=void 0;var CI=Lp(),YH=U("os"),Ade=$H(),Rde=bI(),PI=class{detect(e){return{attributes:{[CI.ATTR_HOST_NAME]:(0,YH.hostname)(),[CI.ATTR_HOST_ARCH]:(0,Rde.normalizeArch)((0,YH.arch)()),[CI.ATTR_HOST_ID]:(0,Ade.getMachineId)()}}}};th.hostDetector=new PI});var QH=E(nh=>{"use strict";Object.defineProperty(nh,"__esModule",{value:!0});nh.osDetector=void 0;var zH=Lp(),KH=U("os"),yde=bI(),MI=class{detect(e){return{attributes:{[zH.ATTR_OS_TYPE]:(0,yde.normalizeType)((0,KH.platform)()),[zH.ATTR_OS_VERSION]:(0,KH.release)()}}}};nh.osDetector=new MI});var XH=E(rh=>{"use strict";Object.defineProperty(rh,"__esModule",{value:!0});rh.processDetector=void 0;var Ide=(b(),O(v)),Ho=Lp(),Ode=U("os"),xI=class{detect(e){let n={[Ho.ATTR_PROCESS_PID]:process.pid,[Ho.ATTR_PROCESS_EXECUTABLE_NAME]:process.title,[Ho.ATTR_PROCESS_EXECUTABLE_PATH]:process.execPath,[Ho.ATTR_PROCESS_COMMAND_ARGS]:[process.argv[0],...process.execArgv,...process.argv.slice(1)],[Ho.ATTR_PROCESS_RUNTIME_VERSION]:process.versions.node,[Ho.ATTR_PROCESS_RUNTIME_NAME]:"nodejs",[Ho.ATTR_PROCESS_RUNTIME_DESCRIPTION]:"Node.js"};process.argv.length>1&&(n[Ho.ATTR_PROCESS_COMMAND]=process.argv[1]);try{let r=Ode.userInfo();n[Ho.ATTR_PROCESS_OWNER]=r.username}catch(r){Ide.diag.debug(`error obtaining process owner: ${r}`)}return{attributes:n}}};rh.processDetector=new xI});var JH=E(oh=>{"use strict";Object.defineProperty(oh,"__esModule",{value:!0});oh.serviceInstanceIdDetector=void 0;var Nde=Lp(),bde=U("crypto"),vI=class{detect(e){return{attributes:{[Nde.ATTR_SERVICE_INSTANCE_ID]:(0,bde.randomUUID)()}}}};oh.serviceInstanceIdDetector=new vI});var ZH=E(no=>{"use strict";Object.defineProperty(no,"__esModule",{value:!0});no.serviceInstanceIdDetector=no.processDetector=no.osDetector=no.hostDetector=void 0;var Cde=WH();Object.defineProperty(no,"hostDetector",{enumerable:!0,get:function(){return Cde.hostDetector}});var Pde=QH();Object.defineProperty(no,"osDetector",{enumerable:!0,get:function(){return Pde.osDetector}});var Mde=XH();Object.defineProperty(no,"processDetector",{enumerable:!0,get:function(){return Mde.processDetector}});var xde=JH();Object.defineProperty(no,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return xde.serviceInstanceIdDetector}})});var eF=E(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});ro.serviceInstanceIdDetector=ro.processDetector=ro.osDetector=ro.hostDetector=void 0;var sh=ZH();Object.defineProperty(ro,"hostDetector",{enumerable:!0,get:function(){return sh.hostDetector}});Object.defineProperty(ro,"osDetector",{enumerable:!0,get:function(){return sh.osDetector}});Object.defineProperty(ro,"processDetector",{enumerable:!0,get:function(){return sh.processDetector}});Object.defineProperty(ro,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return sh.serviceInstanceIdDetector}})});var tF=E(Jc=>{"use strict";Object.defineProperty(Jc,"__esModule",{value:!0});Jc.noopDetector=Jc.NoopDetector=void 0;var ih=class{detect(){return{attributes:{}}}};Jc.NoopDetector=ih;Jc.noopDetector=new ih});var nF=E(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.noopDetector=On.serviceInstanceIdDetector=On.processDetector=On.osDetector=On.hostDetector=On.envDetector=void 0;var vde=kH();Object.defineProperty(On,"envDetector",{enumerable:!0,get:function(){return vde.envDetector}});var ah=eF();Object.defineProperty(On,"hostDetector",{enumerable:!0,get:function(){return ah.hostDetector}});Object.defineProperty(On,"osDetector",{enumerable:!0,get:function(){return ah.osDetector}});Object.defineProperty(On,"processDetector",{enumerable:!0,get:function(){return ah.processDetector}});Object.defineProperty(On,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return ah.serviceInstanceIdDetector}});var Lde=tF();Object.defineProperty(On,"noopDetector",{enumerable:!0,get:function(){return Lde.noopDetector}})});var DI=E(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.defaultServiceName=Fe.emptyResource=Fe.defaultResource=Fe.resourceFromAttributes=Fe.serviceInstanceIdDetector=Fe.processDetector=Fe.osDetector=Fe.hostDetector=Fe.envDetector=Fe.detectResources=void 0;var Dde=UH();Object.defineProperty(Fe,"detectResources",{enumerable:!0,get:function(){return Dde.detectResources}});var Dp=nF();Object.defineProperty(Fe,"envDetector",{enumerable:!0,get:function(){return Dp.envDetector}});Object.defineProperty(Fe,"hostDetector",{enumerable:!0,get:function(){return Dp.hostDetector}});Object.defineProperty(Fe,"osDetector",{enumerable:!0,get:function(){return Dp.osDetector}});Object.defineProperty(Fe,"processDetector",{enumerable:!0,get:function(){return Dp.processDetector}});Object.defineProperty(Fe,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return Dp.serviceInstanceIdDetector}});var LI=II();Object.defineProperty(Fe,"resourceFromAttributes",{enumerable:!0,get:function(){return LI.resourceFromAttributes}});Object.defineProperty(Fe,"defaultResource",{enumerable:!0,get:function(){return LI.defaultResource}});Object.defineProperty(Fe,"emptyResource",{enumerable:!0,get:function(){return LI.emptyResource}});var Ude=AI();Object.defineProperty(Fe,"defaultServiceName",{enumerable:!0,get:function(){return Ude.defaultServiceName}})});var rF=E(ch=>{"use strict";Object.defineProperty(ch,"__esModule",{value:!0});ch.ExceptionEventName=void 0;ch.ExceptionEventName="exception"});var oF=E(uh=>{"use strict";Object.defineProperty(uh,"__esModule",{value:!0});uh.SpanImpl=void 0;var kt=(b(),O(v)),Gt=Te(),aa=(le(),O(Ae)),wde=rF(),UI=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:kt.SpanStatusCode.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){let n=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=Gt.otperformance.now(),this._performanceOffset=n-(this._performanceStartTime+Gt.otperformance.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let r of e.links)this.addLink(r);this.startTime=this._getTime(e.startTime??n),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,n){if(n==null||this._isSpanEnded())return this;if(e.length===0)return kt.diag.warn(`Invalid attribute key: ${e}`),this;if(!(0,Gt.isAttributeValue)(n))return kt.diag.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:r}=this._spanLimits,o=!Object.prototype.hasOwnProperty.call(this.attributes,e);return r!==void 0&&this._attributesCount>=r&&o?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(n),o&&this._attributesCount++,this)}setAttributes(e){for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&this.setAttribute(n,e[n]);return this}addEvent(e,n,r){if(this._isSpanEnded())return this;let{eventCountLimit:o}=this._spanLimits;if(o===0)return kt.diag.warn("No events allowed."),this._droppedEventsCount++,this;o!==void 0&&this.events.length>=o&&(this._droppedEventsCount===0&&kt.diag.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),(0,Gt.isTimeInput)(n)&&((0,Gt.isTimeInput)(r)||(r=n),n=void 0);let s=(0,Gt.sanitizeAttributes)(n),{attributePerEventCountLimit:i}=this._spanLimits,a={},c=0,l=0;for(let p in s){if(!Object.prototype.hasOwnProperty.call(s,p))continue;let d=s[p];if(i!==void 0&&l>=i){c++;continue}a[p]=this._truncateToSize(d),l++}return this.events.push({name:e,attributes:a,time:this._getTime(r),droppedAttributesCount:c}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:n}=this._spanLimits;if(n===0)return this._droppedLinksCount++,this;n!==void 0&&this.links.length>=n&&(this._droppedLinksCount===0&&kt.diag.debug("Dropping extra links."),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:r}=this._spanLimits,o=(0,Gt.sanitizeAttributes)(e.attributes),s={},i=0,a=0;for(let l in o){if(!Object.prototype.hasOwnProperty.call(o,l))continue;let p=o[l];if(r!==void 0&&a>=r){i++;continue}s[l]=this._truncateToSize(p),a++}let c={context:e.context};return a>0&&(c.attributes=s),i>0&&(c.droppedAttributesCount=i),this.links.push(c),this}addLinks(e){for(let n of e)this.addLink(n);return this}setStatus(e){if(this._isSpanEnded())return this;if(e.code===kt.SpanStatusCode.UNSET)return this;if(this.status.code===kt.SpanStatusCode.OK)return this;let n={code:e.code};return e.code===kt.SpanStatusCode.ERROR&&(typeof e.message=="string"?n.message=e.message:e.message!=null&&kt.diag.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=n,this}updateName(e){return this._isSpanEnded()?this:(this.name=e,this)}end(e){if(this._isSpanEnded()){kt.diag.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=(0,Gt.hrTimeDuration)(this.startTime,this.endTime),this._duration[0]<0&&(kt.diag.warn("Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.",this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&kt.diag.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&kt.diag.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e=="number"&&e<=Gt.otperformance.now())return(0,Gt.hrTime)(e+this._performanceOffset);if(typeof e=="number")return(0,Gt.millisToHrTime)(e);if(e instanceof Date)return(0,Gt.millisToHrTime)(e.getTime());if((0,Gt.isTimeInputHrTime)(e))return e;if(this._startTimeProvided)return(0,Gt.millisToHrTime)(Date.now());let n=Gt.otperformance.now()-this._performanceStartTime;return(0,Gt.addHrTimes)(this.startTime,(0,Gt.millisToHrTime)(n))}isRecording(){return this._ended===!1}recordException(e,n){let r={};typeof e=="string"?r[aa.ATTR_EXCEPTION_MESSAGE]=e:e&&(e.code?r[aa.ATTR_EXCEPTION_TYPE]=e.code.toString():e.name&&(r[aa.ATTR_EXCEPTION_TYPE]=e.name),e.message&&(r[aa.ATTR_EXCEPTION_MESSAGE]=e.message),e.stack&&(r[aa.ATTR_EXCEPTION_STACKTRACE]=e.stack)),r[aa.ATTR_EXCEPTION_TYPE]||r[aa.ATTR_EXCEPTION_MESSAGE]?this.addEvent(wde.ExceptionEventName,r,n):kt.diag.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);kt.diag.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,n){return e.length<=n?e:e.substring(0,n)}_truncateToSize(e){let n=this._attributeValueLengthLimit;return n<=0?(kt.diag.warn(`Attribute value limit must be positive, got ${n}`),e):typeof e=="string"?this._truncateToLimitUtil(e,n):Array.isArray(e)?e.map(r=>typeof r=="string"?this._truncateToLimitUtil(r,n):r):e}};uh.SpanImpl=UI});var Zc=E(Up=>{"use strict";Object.defineProperty(Up,"__esModule",{value:!0});Up.SamplingDecision=void 0;var kde;(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(kde=Up.SamplingDecision||(Up.SamplingDecision={}))});var ph=E(lh=>{"use strict";Object.defineProperty(lh,"__esModule",{value:!0});lh.AlwaysOffSampler=void 0;var Gde=Zc(),wI=class{shouldSample(){return{decision:Gde.SamplingDecision.NOT_RECORD}}toString(){return"AlwaysOffSampler"}};lh.AlwaysOffSampler=wI});var _h=E(dh=>{"use strict";Object.defineProperty(dh,"__esModule",{value:!0});dh.AlwaysOnSampler=void 0;var Bde=Zc(),kI=class{shouldSample(){return{decision:Bde.SamplingDecision.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}};dh.AlwaysOnSampler=kI});var jI=E(mh=>{"use strict";Object.defineProperty(mh,"__esModule",{value:!0});mh.ParentBasedSampler=void 0;var fh=(b(),O(v)),jde=Te(),sF=ph(),GI=_h(),BI=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||((0,jde.globalErrorHandler)(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new GI.AlwaysOnSampler),this._remoteParentSampled=e.remoteParentSampled??new GI.AlwaysOnSampler,this._remoteParentNotSampled=e.remoteParentNotSampled??new sF.AlwaysOffSampler,this._localParentSampled=e.localParentSampled??new GI.AlwaysOnSampler,this._localParentNotSampled=e.localParentNotSampled??new sF.AlwaysOffSampler}shouldSample(e,n,r,o,s,i){let a=fh.trace.getSpanContext(e);return!a||!(0,fh.isSpanContextValid)(a)?this._root.shouldSample(e,n,r,o,s,i):a.isRemote?a.traceFlags&fh.TraceFlags.SAMPLED?this._remoteParentSampled.shouldSample(e,n,r,o,s,i):this._remoteParentNotSampled.shouldSample(e,n,r,o,s,i):a.traceFlags&fh.TraceFlags.SAMPLED?this._localParentSampled.shouldSample(e,n,r,o,s,i):this._localParentNotSampled.shouldSample(e,n,r,o,s,i)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}};mh.ParentBasedSampler=BI});var FI=E(hh=>{"use strict";Object.defineProperty(hh,"__esModule",{value:!0});hh.TraceIdRatioBasedSampler=void 0;var Hde=(b(),O(v)),iF=Zc(),HI=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,n){return{decision:(0,Hde.isValidTraceId)(n)&&this._accumulate(n)<this._upperBound?iF.SamplingDecision.RECORD_AND_SAMPLED:iF.SamplingDecision.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!="number"||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let n=0;for(let r=0;r<e.length/8;r++){let o=r*8,s=parseInt(e.slice(o,o+8),16);n=(n^s)>>>0}return n}};hh.TraceIdRatioBasedSampler=HI});var $I=E(eu=>{"use strict";Object.defineProperty(eu,"__esModule",{value:!0});eu.buildSamplerFromEnv=eu.loadDefaultConfig=void 0;var qI=(b(),O(v)),oo=Te(),aF=ph(),VI=_h(),Th=jI(),cF=FI(),so;(function(t){t.AlwaysOff="always_off",t.AlwaysOn="always_on",t.ParentBasedAlwaysOff="parentbased_always_off",t.ParentBasedAlwaysOn="parentbased_always_on",t.ParentBasedTraceIdRatio="parentbased_traceidratio",t.TraceIdRatio="traceidratio"})(so||(so={}));var Eh=1;function Fde(){return{sampler:lF(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:(0,oo.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,oo.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??128},spanLimits:{attributeValueLengthLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??128,linkCountLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_LINK_COUNT_LIMIT")??128,eventCountLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_EVENT_COUNT_LIMIT")??128,attributePerEventCountLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT")??128,attributePerLinkCountLimit:(0,oo.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT")??128}}}eu.loadDefaultConfig=Fde;function lF(){let t=(0,oo.getStringFromEnv)("OTEL_TRACES_SAMPLER")??so.ParentBasedAlwaysOn;switch(t){case so.AlwaysOn:return new VI.AlwaysOnSampler;case so.AlwaysOff:return new aF.AlwaysOffSampler;case so.ParentBasedAlwaysOn:return new Th.ParentBasedSampler({root:new VI.AlwaysOnSampler});case so.ParentBasedAlwaysOff:return new Th.ParentBasedSampler({root:new aF.AlwaysOffSampler});case so.TraceIdRatio:return new cF.TraceIdRatioBasedSampler(uF());case so.ParentBasedTraceIdRatio:return new Th.ParentBasedSampler({root:new cF.TraceIdRatioBasedSampler(uF())});default:return qI.diag.error(`OTEL_TRACES_SAMPLER value "${t}" invalid, defaulting to "${so.ParentBasedAlwaysOn}".`),new Th.ParentBasedSampler({root:new VI.AlwaysOnSampler})}}eu.buildSamplerFromEnv=lF;function uF(){let t=(0,oo.getNumberFromEnv)("OTEL_TRACES_SAMPLER_ARG");return t==null?(qI.diag.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${Eh}.`),Eh):t<0||t>1?(qI.diag.error(`OTEL_TRACES_SAMPLER_ARG=${t} was given, but it is out of range ([0..1]), defaulting to ${Eh}.`),Eh):t}});var YI=E(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.reconfigureLimits=ir.mergeConfig=ir.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=ir.DEFAULT_ATTRIBUTE_COUNT_LIMIT=void 0;var pF=$I(),Sh=Te();ir.DEFAULT_ATTRIBUTE_COUNT_LIMIT=128;ir.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT=1/0;function Vde(t){let e={sampler:(0,pF.buildSamplerFromEnv)()},n=(0,pF.loadDefaultConfig)(),r=Object.assign({},n,e,t);return r.generalLimits=Object.assign({},n.generalLimits,t.generalLimits||{}),r.spanLimits=Object.assign({},n.spanLimits,t.spanLimits||{}),r}ir.mergeConfig=Vde;function qde(t){let e=Object.assign({},t.spanLimits);return e.attributeCountLimit=t.spanLimits?.attributeCountLimit??t.generalLimits?.attributeCountLimit??(0,Sh.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??(0,Sh.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??ir.DEFAULT_ATTRIBUTE_COUNT_LIMIT,e.attributeValueLengthLimit=t.spanLimits?.attributeValueLengthLimit??t.generalLimits?.attributeValueLengthLimit??(0,Sh.getNumberFromEnv)("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??(0,Sh.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??ir.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT,Object.assign({},t,{spanLimits:e})}ir.reconfigureLimits=qde});var dF=E(gh=>{"use strict";Object.defineProperty(gh,"__esModule",{value:!0});gh.BatchSpanProcessorBase=void 0;var tu=(b(),O(v)),Fo=Te(),WI=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e,n){this._exporter=e,this._maxExportBatchSize=typeof n?.maxExportBatchSize=="number"?n.maxExportBatchSize:(0,Fo.getNumberFromEnv)("OTEL_BSP_MAX_EXPORT_BATCH_SIZE")??512,this._maxQueueSize=typeof n?.maxQueueSize=="number"?n.maxQueueSize:(0,Fo.getNumberFromEnv)("OTEL_BSP_MAX_QUEUE_SIZE")??2048,this._scheduledDelayMillis=typeof n?.scheduledDelayMillis=="number"?n.scheduledDelayMillis:(0,Fo.getNumberFromEnv)("OTEL_BSP_SCHEDULE_DELAY")??5e3,this._exportTimeoutMillis=typeof n?.exportTimeoutMillis=="number"?n.exportTimeoutMillis:(0,Fo.getNumberFromEnv)("OTEL_BSP_EXPORT_TIMEOUT")??3e4,this._shutdownOnce=new Fo.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(tu.diag.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,n){}onEnd(e){this._shutdownOnce.isCalled||e.spanContext().traceFlags&tu.TraceFlags.SAMPLED&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&tu.diag.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(tu.diag.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,n)=>{let r=[],o=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let s=0,i=o;s<i;s++)r.push(this._flushOneBatch());Promise.all(r).then(()=>{e()}).catch(n)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,n)=>{let r=setTimeout(()=>{n(new Error("Timeout"))},this._exportTimeoutMillis);tu.context.with((0,Fo.suppressTracing)(tu.context.active()),()=>{let o;this._finishedSpans.length<=this._maxExportBatchSize?(o=this._finishedSpans,this._finishedSpans=[]):o=this._finishedSpans.splice(0,this._maxExportBatchSize);let s=()=>this._exporter.export(o,a=>{clearTimeout(r),a.code===Fo.ExportResultCode.SUCCESS?e():n(a.error??new Error("BatchSpanProcessor: span export failed"))}),i=null;for(let a=0,c=o.length;a<c;a++){let l=o[a];l.resource.asyncAttributesPending&&l.resource.waitForAsyncAttributes&&(i??=[],i.push(l.resource.waitForAsyncAttributes()))}i===null?s():Promise.all(i).then(s,a=>{(0,Fo.globalErrorHandler)(a),n(a)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(n=>{this._isExporting=!1,(0,Fo.globalErrorHandler)(n)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}};gh.BatchSpanProcessorBase=WI});var _F=E(Ah=>{"use strict";Object.defineProperty(Ah,"__esModule",{value:!0});Ah.BatchSpanProcessor=void 0;var $de=dF(),zI=class extends $de.BatchSpanProcessorBase{onShutdown(){}};Ah.BatchSpanProcessor=zI});var hF=E(yh=>{"use strict";Object.defineProperty(yh,"__esModule",{value:!0});yh.RandomIdGenerator=void 0;var Yde=8,mF=16,KI=class{generateTraceId=fF(mF);generateSpanId=fF(Yde)};yh.RandomIdGenerator=KI;var Rh=Buffer.allocUnsafe(mF);function fF(t){return function(){for(let n=0;n<t/4;n++)Rh.writeUInt32BE(Math.random()*2**32>>>0,n*4);for(let n=0;n<t&&!(Rh[n]>0);n++)n===t-1&&(Rh[t-1]=1);return Rh.toString("hex",0,t)}}});var TF=E(nu=>{"use strict";Object.defineProperty(nu,"__esModule",{value:!0});nu.RandomIdGenerator=nu.BatchSpanProcessor=void 0;var Wde=_F();Object.defineProperty(nu,"BatchSpanProcessor",{enumerable:!0,get:function(){return Wde.BatchSpanProcessor}});var zde=hF();Object.defineProperty(nu,"RandomIdGenerator",{enumerable:!0,get:function(){return zde.RandomIdGenerator}})});var QI=E(ru=>{"use strict";Object.defineProperty(ru,"__esModule",{value:!0});ru.RandomIdGenerator=ru.BatchSpanProcessor=void 0;var EF=TF();Object.defineProperty(ru,"BatchSpanProcessor",{enumerable:!0,get:function(){return EF.BatchSpanProcessor}});Object.defineProperty(ru,"RandomIdGenerator",{enumerable:!0,get:function(){return EF.RandomIdGenerator}})});var SF=E(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});io.METRIC_OTEL_SDK_SPAN_STARTED=io.METRIC_OTEL_SDK_SPAN_LIVE=io.ATTR_OTEL_SPAN_SAMPLING_RESULT=io.ATTR_OTEL_SPAN_PARENT_ORIGIN=void 0;io.ATTR_OTEL_SPAN_PARENT_ORIGIN="otel.span.parent.origin";io.ATTR_OTEL_SPAN_SAMPLING_RESULT="otel.span.sampling_result";io.METRIC_OTEL_SDK_SPAN_LIVE="otel.sdk.span.live";io.METRIC_OTEL_SDK_SPAN_STARTED="otel.sdk.span.started"});var gF=E(Oh=>{"use strict";Object.defineProperty(Oh,"__esModule",{value:!0});Oh.TracerMetrics=void 0;var Ih=Zc(),wp=SF(),XI=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(wp.METRIC_OTEL_SDK_SPAN_STARTED,{unit:"{span}",description:"The number of created spans."}),this.liveSpans=e.createUpDownCounter(wp.METRIC_OTEL_SDK_SPAN_LIVE,{unit:"{span}",description:"The number of currently live spans."})}startSpan(e,n){let r=Qde(n);if(this.startedSpans.add(1,{[wp.ATTR_OTEL_SPAN_PARENT_ORIGIN]:Kde(e),[wp.ATTR_OTEL_SPAN_SAMPLING_RESULT]:r}),n===Ih.SamplingDecision.NOT_RECORD)return()=>{};let o={[wp.ATTR_OTEL_SPAN_SAMPLING_RESULT]:r};return this.liveSpans.add(1,o),()=>{this.liveSpans.add(-1,o)}}};Oh.TracerMetrics=XI;function Kde(t){return t?t.isRemote?"remote":"local":"none"}function Qde(t){switch(t){case Ih.SamplingDecision.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case Ih.SamplingDecision.RECORD:return"RECORD_ONLY";case Ih.SamplingDecision.NOT_RECORD:return"DROP"}}});var AF=E(Nh=>{"use strict";Object.defineProperty(Nh,"__esModule",{value:!0});Nh.VERSION=void 0;Nh.VERSION="2.6.1"});var RF=E(Ch=>{"use strict";Object.defineProperty(Ch,"__esModule",{value:!0});Ch.Tracer=void 0;var Nt=(b(),O(v)),bh=Te(),Xde=oF(),Jde=YI(),Zde=QI(),e_e=gF(),t_e=AF(),JI=class{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,n,r,o){let s=(0,Jde.mergeConfig)(n);this._sampler=s.sampler,this._generalLimits=s.generalLimits,this._spanLimits=s.spanLimits,this._idGenerator=n.idGenerator||new Zde.RandomIdGenerator,this._resource=r,this._spanProcessor=o,this.instrumentationScope=e;let i=s.meterProvider?s.meterProvider.getMeter("@opentelemetry/sdk-trace",t_e.VERSION):Nt.createNoopMeter();this._tracerMetrics=new e_e.TracerMetrics(i)}startSpan(e,n={},r=Nt.context.active()){n.root&&(r=Nt.trace.deleteSpan(r));let o=Nt.trace.getSpan(r);if((0,bh.isTracingSuppressed)(r))return Nt.diag.debug("Instrumentation suppressed, returning Noop Span"),Nt.trace.wrapSpanContext(Nt.INVALID_SPAN_CONTEXT);let s=o?.spanContext(),i=this._idGenerator.generateSpanId(),a,c,l;!s||!Nt.trace.isSpanContextValid(s)?c=this._idGenerator.generateTraceId():(c=s.traceId,l=s.traceState,a=s);let p=n.kind??Nt.SpanKind.INTERNAL,d=(n.links??[]).map(I=>({context:I.context,attributes:(0,bh.sanitizeAttributes)(I.attributes)})),_=(0,bh.sanitizeAttributes)(n.attributes),f=this._sampler.shouldSample(r,c,e,p,_,d),m=this._tracerMetrics.startSpan(s,f.decision);l=f.traceState??l;let h=f.decision===Nt.SamplingDecision.RECORD_AND_SAMPLED?Nt.TraceFlags.SAMPLED:Nt.TraceFlags.NONE,T={traceId:c,spanId:i,traceFlags:h,traceState:l};if(f.decision===Nt.SamplingDecision.NOT_RECORD)return Nt.diag.debug("Recording is off, propagating context in a non-recording span"),Nt.trace.wrapSpanContext(T);let S=(0,bh.sanitizeAttributes)(Object.assign(_,f.attributes));return new Xde.SpanImpl({resource:this._resource,scope:this.instrumentationScope,context:r,spanContext:T,name:e,kind:p,links:d,parentSpanContext:a,attributes:S,startTime:n.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:m})}startActiveSpan(e,n,r,o){let s,i,a;if(arguments.length<2)return;arguments.length===2?a=n:arguments.length===3?(s=n,a=r):(s=n,i=r,a=o);let c=i??Nt.context.active(),l=this.startSpan(e,s,c),p=Nt.trace.setSpan(c,l);return Nt.context.with(p,a,void 0,l)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}};Ch.Tracer=JI});var yF=E(Ph=>{"use strict";Object.defineProperty(Ph,"__esModule",{value:!0});Ph.MultiSpanProcessor=void 0;var n_e=Te(),ZI=class{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(let n of this._spanProcessors)e.push(n.forceFlush());return new Promise(n=>{Promise.all(e).then(()=>{n()}).catch(r=>{(0,n_e.globalErrorHandler)(r||new Error("MultiSpanProcessor: forceFlush failed")),n()})})}onStart(e,n){for(let r of this._spanProcessors)r.onStart(e,n)}onEnding(e){for(let n of this._spanProcessors)n.onEnding&&n.onEnding(e)}onEnd(e){for(let n of this._spanProcessors)n.onEnd(e)}shutdown(){let e=[];for(let n of this._spanProcessors)e.push(n.shutdown());return new Promise((n,r)=>{Promise.all(e).then(()=>{n()},r)})}};Ph.MultiSpanProcessor=ZI});var IF=E(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});ca.BasicTracerProvider=ca.ForceFlushState=void 0;var r_e=Te(),o_e=DI(),s_e=RF(),i_e=$I(),a_e=yF(),c_e=YI(),ou;(function(t){t[t.resolved=0]="resolved",t[t.timeout=1]="timeout",t[t.error=2]="error",t[t.unresolved=3]="unresolved"})(ou=ca.ForceFlushState||(ca.ForceFlushState={}));var eO=class{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(e={}){let n=(0,r_e.merge)({},(0,i_e.loadDefaultConfig)(),(0,c_e.reconfigureLimits)(e));this._resource=n.resource??(0,o_e.defaultResource)(),this._config=Object.assign({},n,{resource:this._resource});let r=[];e.spanProcessors?.length&&r.push(...e.spanProcessors),this._activeSpanProcessor=new a_e.MultiSpanProcessor(r)}getTracer(e,n,r){let o=`${e}@${n||""}:${r?.schemaUrl||""}`;return this._tracers.has(o)||this._tracers.set(o,new s_e.Tracer({name:e,version:n,schemaUrl:r?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(o)}forceFlush(){let e=this._config.forceFlushTimeoutMillis,n=this._activeSpanProcessor._spanProcessors.map(r=>new Promise(o=>{let s,i=setTimeout(()=>{o(new Error(`Span processor did not completed within timeout period of ${e} ms`)),s=ou.timeout},e);r.forceFlush().then(()=>{clearTimeout(i),s!==ou.timeout&&(s=ou.resolved,o(s))}).catch(a=>{clearTimeout(i),s=ou.error,o(a)})}));return new Promise((r,o)=>{Promise.all(n).then(s=>{let i=s.filter(a=>a!==ou.resolved);i.length>0?o(i):r()}).catch(s=>o([s]))})}shutdown(){return this._activeSpanProcessor.shutdown()}};ca.BasicTracerProvider=eO});var OF=E(Mh=>{"use strict";Object.defineProperty(Mh,"__esModule",{value:!0});Mh.ConsoleSpanExporter=void 0;var tO=Te(),nO=class{export(e,n){return this._sendSpans(e,n)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,traceId:e.spanContext().traceId,parentSpanContext:e.parentSpanContext,traceState:e.spanContext().traceState?.serialize(),name:e.name,id:e.spanContext().spanId,kind:e.kind,timestamp:(0,tO.hrTimeToMicroseconds)(e.startTime),duration:(0,tO.hrTimeToMicroseconds)(e.duration),attributes:e.attributes,status:e.status,events:e.events,links:e.links}}_sendSpans(e,n){for(let r of e)console.dir(this._exportInfo(r),{depth:3});if(n)return n({code:tO.ExportResultCode.SUCCESS})}};Mh.ConsoleSpanExporter=nO});var bF=E(xh=>{"use strict";Object.defineProperty(xh,"__esModule",{value:!0});xh.InMemorySpanExporter=void 0;var NF=Te(),rO=class{_finishedSpans=[];_stopped=!1;export(e,n){if(this._stopped)return n({code:NF.ExportResultCode.FAILED,error:new Error("Exporter has been stopped")});this._finishedSpans.push(...e),setTimeout(()=>n({code:NF.ExportResultCode.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}};xh.InMemorySpanExporter=rO});var CF=E(Lh=>{"use strict";Object.defineProperty(Lh,"__esModule",{value:!0});Lh.SimpleSpanProcessor=void 0;var u_e=(b(),O(v)),vh=Te(),oO=class{_exporter;_shutdownOnce;_pendingExports;constructor(e){this._exporter=e,this._shutdownOnce=new vh.BindOnceFuture(this._shutdown,this),this._pendingExports=new Set}async forceFlush(){await Promise.all(Array.from(this._pendingExports)),this._exporter.forceFlush&&await this._exporter.forceFlush()}onStart(e,n){}onEnd(e){if(this._shutdownOnce.isCalled||!(e.spanContext().traceFlags&u_e.TraceFlags.SAMPLED))return;let n=this._doExport(e).catch(r=>(0,vh.globalErrorHandler)(r));this._pendingExports.add(n),n.finally(()=>this._pendingExports.delete(n))}async _doExport(e){e.resource.asyncAttributesPending&&await e.resource.waitForAsyncAttributes?.();let n=await vh.internal._export(this._exporter,[e]);if(n.code!==vh.ExportResultCode.SUCCESS)throw n.error??new Error(`SimpleSpanProcessor: span export failed (status ${n})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}};Lh.SimpleSpanProcessor=oO});var PF=E(Dh=>{"use strict";Object.defineProperty(Dh,"__esModule",{value:!0});Dh.NoopSpanProcessor=void 0;var sO=class{onStart(e,n){}onEnd(e){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}};Dh.NoopSpanProcessor=sO});var iO=E(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.SamplingDecision=Ce.TraceIdRatioBasedSampler=Ce.ParentBasedSampler=Ce.AlwaysOnSampler=Ce.AlwaysOffSampler=Ce.NoopSpanProcessor=Ce.SimpleSpanProcessor=Ce.InMemorySpanExporter=Ce.ConsoleSpanExporter=Ce.RandomIdGenerator=Ce.BatchSpanProcessor=Ce.BasicTracerProvider=void 0;var l_e=IF();Object.defineProperty(Ce,"BasicTracerProvider",{enumerable:!0,get:function(){return l_e.BasicTracerProvider}});var MF=QI();Object.defineProperty(Ce,"BatchSpanProcessor",{enumerable:!0,get:function(){return MF.BatchSpanProcessor}});Object.defineProperty(Ce,"RandomIdGenerator",{enumerable:!0,get:function(){return MF.RandomIdGenerator}});var p_e=OF();Object.defineProperty(Ce,"ConsoleSpanExporter",{enumerable:!0,get:function(){return p_e.ConsoleSpanExporter}});var d_e=bF();Object.defineProperty(Ce,"InMemorySpanExporter",{enumerable:!0,get:function(){return d_e.InMemorySpanExporter}});var __e=CF();Object.defineProperty(Ce,"SimpleSpanProcessor",{enumerable:!0,get:function(){return __e.SimpleSpanProcessor}});var f_e=PF();Object.defineProperty(Ce,"NoopSpanProcessor",{enumerable:!0,get:function(){return f_e.NoopSpanProcessor}});var m_e=ph();Object.defineProperty(Ce,"AlwaysOffSampler",{enumerable:!0,get:function(){return m_e.AlwaysOffSampler}});var h_e=_h();Object.defineProperty(Ce,"AlwaysOnSampler",{enumerable:!0,get:function(){return h_e.AlwaysOnSampler}});var T_e=jI();Object.defineProperty(Ce,"ParentBasedSampler",{enumerable:!0,get:function(){return T_e.ParentBasedSampler}});var E_e=FI();Object.defineProperty(Ce,"TraceIdRatioBasedSampler",{enumerable:!0,get:function(){return E_e.TraceIdRatioBasedSampler}});var S_e=Zc();Object.defineProperty(Ce,"SamplingDecision",{enumerable:!0,get:function(){return S_e.SamplingDecision}})});var rq=E(uu=>{"use strict";Object.defineProperty(uu,"__esModule",{value:!0});uu.PACKAGE_NAME=uu.PACKAGE_VERSION=void 0;uu.PACKAGE_VERSION="0.24.0";uu.PACKAGE_NAME="@opentelemetry/instrumentation-undici"});var sq=E(Kh=>{"use strict";Object.defineProperty(Kh,"__esModule",{value:!0});Kh.UndiciInstrumentation=void 0;var DO=U("diagnostics_channel"),Fme=U("url"),$p=ne(),qn=(b(),O(v)),zh=Te(),ot=(le(),O(Ae)),oq=rq(),UO=class extends $p.InstrumentationBase{_recordFromReq=new WeakMap;constructor(e={}){super(oq.PACKAGE_NAME,oq.PACKAGE_VERSION,e)}init(){}disable(){super.disable(),this._channelSubs.forEach(e=>e.unsubscribe()),this._channelSubs.length=0}enable(){super.enable(),this._channelSubs=this._channelSubs||[],!(this._channelSubs.length>0)&&(this.subscribeToChannel("undici:request:create",this.onRequestCreated.bind(this)),this.subscribeToChannel("undici:client:sendHeaders",this.onRequestHeaders.bind(this)),this.subscribeToChannel("undici:request:headers",this.onResponseHeaders.bind(this)),this.subscribeToChannel("undici:request:trailers",this.onDone.bind(this)),this.subscribeToChannel("undici:request:error",this.onError.bind(this)))}_updateMetricInstruments(){this._httpClientDurationHistogram=this.meter.createHistogram(ot.METRIC_HTTP_CLIENT_REQUEST_DURATION,{description:"Measures the duration of outbound HTTP requests.",unit:"s",valueType:qn.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10]}})}subscribeToChannel(e,n){let[r,o]=process.version.replace("v","").split(".").map(a=>Number(a)),s=r>18||r===18&&o>=19,i;if(s)DO.subscribe?.(e,n),i=()=>DO.unsubscribe?.(e,n);else{let a=DO.channel(e);a.subscribe(n),i=()=>a.unsubscribe(n)}this._channelSubs.push({name:e,unsubscribe:i})}parseRequestHeaders(e){let n=new Map;if(Array.isArray(e.headers))for(let r=0;r<e.headers.length;r+=2){let o=e.headers[r],s=e.headers[r+1];typeof o=="string"&&n.set(o.toLowerCase(),s)}else if(typeof e.headers=="string"){let r=e.headers.split(`\r
8
+ `);for(let o of r){if(!o)continue;let s=o.indexOf(":");if(s===-1)continue;let i=o.substring(0,s).toLowerCase(),a=o.substring(s+1).trim(),c=n.get(i);c&&Array.isArray(c)?c.push(a):c?n.set(i,[c,a]):n.set(i,a)}}return n}onRequestCreated({request:e}){let n=this.getConfig(),r=n.enabled!==!1;if((0,$p.safeExecuteInTheMiddle)(()=>!r||e.method==="CONNECT"||n.ignoreRequestHook?.(e),B=>B&&this._diag.error("caught ignoreRequestHook error: ",B),!0))return;let s=(0,zh.hrTime)(),i;try{i=new Fme.URL(e.path,e.origin)}catch(B){this._diag.warn("could not determine url.full:",B);return}let a=i.protocol.replace(":",""),c=this.getRequestMethod(e.method),l={[ot.ATTR_HTTP_REQUEST_METHOD]:c,[ot.ATTR_HTTP_REQUEST_METHOD_ORIGINAL]:e.method,[ot.ATTR_URL_FULL]:i.toString(),[ot.ATTR_URL_PATH]:i.pathname,[ot.ATTR_URL_QUERY]:i.search,[ot.ATTR_URL_SCHEME]:a},p={https:"443",http:"80"},d=i.hostname,_=i.port||p[a];l[ot.ATTR_SERVER_ADDRESS]=d,_&&!isNaN(Number(_))&&(l[ot.ATTR_SERVER_PORT]=Number(_));let m=this.parseRequestHeaders(e).get("user-agent");if(m){let B=Array.isArray(m)?m[m.length-1]:m;l[ot.ATTR_USER_AGENT_ORIGINAL]=B}let h=(0,$p.safeExecuteInTheMiddle)(()=>n.startSpanHook?.(e),B=>B&&this._diag.error("caught startSpanHook error: ",B),!0);h&&Object.entries(h).forEach(([B,se])=>{l[B]=se});let T=qn.context.active(),S=qn.trace.getSpan(T),R;n.requireParentforSpans&&(!S||!qn.trace.isSpanContextValid(S.spanContext()))?R=qn.trace.wrapSpanContext(qn.INVALID_SPAN_CONTEXT):R=this.tracer.startSpan(c==="_OTHER"?"HTTP":c,{kind:qn.SpanKind.CLIENT,attributes:l},T),(0,$p.safeExecuteInTheMiddle)(()=>n.requestHook?.(R,e),B=>B&&this._diag.error("caught requestHook error: ",B),!0);let I=qn.trace.setSpan(qn.context.active(),R),x={};qn.propagation.inject(I,x);let F=Object.entries(x);for(let B=0;B<F.length;B++){let[se,ve]=F[B];typeof e.addHeader=="function"?e.addHeader(se,ve):typeof e.headers=="string"?e.headers+=`${se}: ${ve}\r
9
+ `:Array.isArray(e.headers)&&e.headers.push(se,ve)}this._recordFromReq.set(e,{span:R,attributes:l,startTime:s})}onRequestHeaders({request:e,socket:n}){let r=this._recordFromReq.get(e);if(!r)return;let o=this.getConfig(),{span:s}=r,{remoteAddress:i,remotePort:a}=n,c={[ot.ATTR_NETWORK_PEER_ADDRESS]:i,[ot.ATTR_NETWORK_PEER_PORT]:a};if(o.headersToSpanAttributes?.requestHeaders){let l=new Set(o.headersToSpanAttributes.requestHeaders.map(d=>d.toLowerCase())),p=this.parseRequestHeaders(e);for(let[d,_]of p.entries())if(l.has(d)){let f=Array.isArray(_)?_:[_];c[`http.request.header.${d}`]=f}}s.setAttributes(c)}onResponseHeaders({request:e,response:n}){let r=this._recordFromReq.get(e);if(!r)return;let{span:o,attributes:s}=r,i={[ot.ATTR_HTTP_RESPONSE_STATUS_CODE]:n.statusCode},a=this.getConfig();if((0,$p.safeExecuteInTheMiddle)(()=>a.responseHook?.(o,{request:e,response:n}),c=>c&&this._diag.error("caught responseHook error: ",c),!0),a.headersToSpanAttributes?.responseHeaders){let c=new Set;a.headersToSpanAttributes?.responseHeaders.forEach(l=>c.add(l.toLowerCase()));for(let l=0;l<n.headers.length;l=l+2){let p=n.headers[l].toString().toLowerCase(),d=n.headers[l+1];if(c.has(p)){let _=`http.response.header.${p}`;Object.hasOwn(i,_)?i[_].push(d.toString()):i[_]=[d.toString()]}}}o.setAttributes(i),o.setStatus({code:n.statusCode>=400?qn.SpanStatusCode.ERROR:qn.SpanStatusCode.UNSET}),r.attributes=Object.assign(s,i)}onDone({request:e}){let n=this._recordFromReq.get(e);if(!n)return;let{span:r,attributes:o,startTime:s}=n;r.end(),this._recordFromReq.delete(e),this.recordRequestDuration(o,s)}onError({request:e,error:n}){let r=this._recordFromReq.get(e);if(!r)return;let{span:o,attributes:s,startTime:i}=r;o.recordException(n),o.setStatus({code:qn.SpanStatusCode.ERROR,message:n.message}),o.end(),this._recordFromReq.delete(e),s[ot.ATTR_ERROR_TYPE]=n.message,this.recordRequestDuration(s,i)}recordRequestDuration(e,n){let r={};[ot.ATTR_HTTP_RESPONSE_STATUS_CODE,ot.ATTR_HTTP_REQUEST_METHOD,ot.ATTR_SERVER_ADDRESS,ot.ATTR_SERVER_PORT,ot.ATTR_URL_SCHEME,ot.ATTR_ERROR_TYPE].forEach(i=>{i in e&&(r[i]=e[i])});let s=(0,zh.hrTimeToMilliseconds)((0,zh.hrTimeDuration)(n,(0,zh.hrTime)()))/1e3;this._httpClientDurationHistogram.record(s,r)}getRequestMethod(e){let n={CONNECT:!0,OPTIONS:!0,HEAD:!0,GET:!0,POST:!0,PUT:!0,PATCH:!0,DELETE:!0,TRACE:!0,QUERY:!0};return e.toUpperCase()in n?e.toUpperCase():"_OTHER"}};Kh.UndiciInstrumentation=UO});var iq=E(Qh=>{"use strict";Object.defineProperty(Qh,"__esModule",{value:!0});Qh.UndiciInstrumentation=void 0;var Vme=sq();Object.defineProperty(Qh,"UndiciInstrumentation",{enumerable:!0,get:function(){return Vme.UndiciInstrumentation}})});var Xh=E(Yp=>{"use strict";Object.defineProperty(Yp,"__esModule",{value:!0});Yp.ExpressLayerType=void 0;var Kme;(function(t){t.ROUTER="router",t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request_handler"})(Kme=Yp.ExpressLayerType||(Yp.ExpressLayerType={}))});var Jh=E(Wp=>{"use strict";Object.defineProperty(Wp,"__esModule",{value:!0});Wp.AttributeNames=void 0;var Qme;(function(t){t.EXPRESS_TYPE="express.type",t.EXPRESS_NAME="express.name"})(Qme=Wp.AttributeNames||(Wp.AttributeNames={}))});var wO=E(lu=>{"use strict";Object.defineProperty(lu,"__esModule",{value:!0});lu._LAYERS_STORE_PROPERTY=lu.kLayerPatched=void 0;lu.kLayerPatched=Symbol("express-layer-patched");lu._LAYERS_STORE_PROPERTY="__ot_middlewares"});var _q=E(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.getActualMatchedRoute=st.getConstructedRoute=st.getLayerPath=st.asErrorAndMessage=st.isLayerIgnored=st.getLayerMetadata=st.getRouterPath=st.storeLayerPath=void 0;var kO=Xh(),pu=Jh(),ua=wO(),Xme=(t,e)=>(Array.isArray(t[ua._LAYERS_STORE_PROPERTY])===!1&&Object.defineProperty(t,ua._LAYERS_STORE_PROPERTY,{enumerable:!1,value:[]}),e===void 0?{isLayerPathStored:!1}:(t[ua._LAYERS_STORE_PROPERTY].push(e),{isLayerPathStored:!0}));st.storeLayerPath=Xme;var Jme=(t,e)=>{let n=e.handle?.stack?.[0];return n?.route?.path?`${t}${n.route.path}`:n?.handle?.stack?(0,st.getRouterPath)(t,n):t};st.getRouterPath=Jme;var Zme=(t,e,n)=>{if(e.name==="router"){let r=(0,st.getRouterPath)("",e),o=r||n||t||"/";return{attributes:{[pu.AttributeNames.EXPRESS_NAME]:o,[pu.AttributeNames.EXPRESS_TYPE]:kO.ExpressLayerType.ROUTER},name:`router - ${o}`}}else return e.name==="bound dispatch"||e.name==="handle"?{attributes:{[pu.AttributeNames.EXPRESS_NAME]:(t||n)??"request handler",[pu.AttributeNames.EXPRESS_TYPE]:kO.ExpressLayerType.REQUEST_HANDLER},name:`request handler${e.path?` - ${t||n}`:""}`}:{attributes:{[pu.AttributeNames.EXPRESS_NAME]:e.name,[pu.AttributeNames.EXPRESS_TYPE]:kO.ExpressLayerType.MIDDLEWARE},name:`middleware - ${e.name}`}};st.getLayerMetadata=Zme;var ehe=(t,e)=>{if(typeof e=="string")return e===t;if(e instanceof RegExp)return e.test(t);if(typeof e=="function")return e(t);throw new TypeError("Pattern is in unsupported datatype")},the=(t,e,n)=>{if(Array.isArray(n?.ignoreLayersType)&&n?.ignoreLayersType?.includes(e))return!0;if(Array.isArray(n?.ignoreLayers)===!1)return!1;try{for(let r of n.ignoreLayers)if(ehe(t,r))return!0}catch{}return!1};st.isLayerIgnored=the;var nhe=t=>t instanceof Error?[t,t.message]:[String(t),String(t)];st.asErrorAndMessage=nhe;var rhe=t=>{let e=t[0];return Array.isArray(e)?e.map(n=>pq(n)||"").join(","):pq(e)};st.getLayerPath=rhe;var pq=t=>{if(typeof t=="string")return t;if(t instanceof RegExp||typeof t=="number")return t.toString()};function dq(t){let n=(Array.isArray(t[ua._LAYERS_STORE_PROPERTY])?t[ua._LAYERS_STORE_PROPERTY]:[]).filter(r=>r!=="/"&&r!=="/*");return n.length===1&&n[0]==="*"?"*":n.join("").replace(/\/{2,}/g,"/")}st.getConstructedRoute=dq;function ohe(t){let e=Array.isArray(t[ua._LAYERS_STORE_PROPERTY])?t[ua._LAYERS_STORE_PROPERTY]:[];if(e.length===0)return;if(e.every(s=>s==="/"))return t.originalUrl==="/"?"/":void 0;let n=dq(t);if(n==="*"||n.includes("/")&&(n.includes(",")||n.includes("\\")||n.includes("*")||n.includes("[")))return n;let r=n.startsWith("/")?n:`/${n}`;return r.length>0&&(t.originalUrl===r||t.originalUrl.startsWith(r)||she(r))?r:void 0}st.getActualMatchedRoute=ohe;function she(t){return t.includes(":")||t.includes("*")}});var fq=E(du=>{"use strict";Object.defineProperty(du,"__esModule",{value:!0});du.PACKAGE_NAME=du.PACKAGE_VERSION=void 0;du.PACKAGE_VERSION="0.62.0";du.PACKAGE_NAME="@opentelemetry/instrumentation-express"});var Sq=E(eT=>{"use strict";Object.defineProperty(eT,"__esModule",{value:!0});eT.ExpressInstrumentation=void 0;var mq=Te(),Nn=(b(),O(v)),hq=Xh(),Tq=Jh(),uo=_q(),Eq=fq(),_u=ne(),ihe=(le(),O(Ae)),Zh=wO(),GO=class extends _u.InstrumentationBase{constructor(e={}){super(Eq.PACKAGE_NAME,Eq.PACKAGE_VERSION,e)}init(){return[new _u.InstrumentationNodeModuleDefinition("express",[">=4.0.0 <6"],e=>{let n=typeof e?.Router?.prototype?.route=="function",r=n?e.Router.prototype:e.Router;return(0,_u.isWrapped)(r.route)&&this._unwrap(r,"route"),this._wrap(r,"route",this._getRoutePatch()),(0,_u.isWrapped)(r.use)&&this._unwrap(r,"use"),this._wrap(r,"use",this._getRouterUsePatch()),(0,_u.isWrapped)(e.application.use)&&this._unwrap(e.application,"use"),this._wrap(e.application,"use",this._getAppUsePatch(n)),e},e=>{if(e===void 0)return;let r=typeof e?.Router?.prototype?.route=="function"?e.Router.prototype:e.Router;this._unwrap(r,"route"),this._unwrap(r,"use"),this._unwrap(e.application,"use")})]}_getRoutePatch(){let e=this;return function(n){return function(...o){let s=n.apply(this,o),i=this.stack[this.stack.length-1];return e._applyPatch(i,(0,uo.getLayerPath)(o)),s}}}_getRouterUsePatch(){let e=this;return function(n){return function(...o){let s=n.apply(this,o),i=this.stack[this.stack.length-1];return e._applyPatch(i,(0,uo.getLayerPath)(o)),s}}}_getAppUsePatch(e){let n=this;return function(r){return function(...s){let i=e?this.router:this._router,a=r.apply(this,s);if(i){let c=i.stack[i.stack.length-1];n._applyPatch(c,(0,uo.getLayerPath)(s))}return a}}}_applyPatch(e,n){let r=this;e[Zh.kLayerPatched]!==!0&&(e[Zh.kLayerPatched]=!0,this._wrap(e,"handle",o=>{if(o.length===4)return o;let s=function(i,a){let{isLayerPathStored:c}=(0,uo.storeLayerPath)(i,n),l=(0,uo.getConstructedRoute)(i),p=(0,uo.getActualMatchedRoute)(i),d={[ihe.ATTR_HTTP_ROUTE]:p},_=(0,uo.getLayerMetadata)(l,e,n),f=_.attributes[Tq.AttributeNames.EXPRESS_TYPE],m=(0,mq.getRPCMetadata)(Nn.context.active());if(m?.type===mq.RPCType.HTTP&&(m.route=p),(0,uo.isLayerIgnored)(_.name,f,r.getConfig()))return f===hq.ExpressLayerType.MIDDLEWARE&&i[Zh._LAYERS_STORE_PROPERTY].pop(),o.apply(this,arguments);if(Nn.trace.getSpan(Nn.context.active())===void 0)return o.apply(this,arguments);let h=r._getSpanName({request:i,layerType:f,route:l},_.name),T=r.tracer.startSpan(h,{attributes:Object.assign(d,_.attributes)}),S=Nn.context.active(),R=Nn.trace.setSpan(S,T),{requestHook:I}=r.getConfig();I&&(0,_u.safeExecuteInTheMiddle)(()=>I(T,{request:i,layerType:f,route:l}),ve=>{ve&&Nn.diag.error("express instrumentation: request hook failed",ve)},!0);let x=!1;_.attributes[Tq.AttributeNames.EXPRESS_TYPE]===hq.ExpressLayerType.ROUTER&&(T.end(),x=!0,R=S);let F=()=>{x===!1&&(x=!0,T.end())},B=Array.from(arguments),se=B.findIndex(ve=>typeof ve=="function");se>=0&&(arguments[se]=function(){let ve=arguments[0],on=![void 0,null,"route","router"].includes(ve);if(!x&&on){let[$a,Ya]=(0,uo.asErrorAndMessage)(ve);T.recordException($a),T.setStatus({code:Nn.SpanStatusCode.ERROR,message:Ya})}x===!1&&(x=!0,i.res?.removeListener("finish",F),T.end()),!(i.route&&on)&&c&&i[Zh._LAYERS_STORE_PROPERTY].pop();let Io=B[se],ss=Nn.context.active(),yi=Nn.trace.getSpan(S),Et=yi?Nn.trace.setSpan(ss,yi):ss;return Nn.context.bind(Et,Io).apply(this,arguments)});try{return Nn.context.bind(R,o).apply(this,arguments)}catch(ve){let[on,Io]=(0,uo.asErrorAndMessage)(ve);throw T.recordException(on),T.setStatus({code:Nn.SpanStatusCode.ERROR,message:Io}),ve}finally{x||a.once("finish",F)}};for(let i in o)Object.defineProperty(s,i,{get(){return o[i]},set(a){o[i]=a}});return s}))}_getSpanName(e,n){let{spanNameHook:r}=this.getConfig();if(!(r instanceof Function))return n;try{return r(e,n)??n}catch(o){return Nn.diag.error("express instrumentation: error calling span name rewrite hook",o),n}}};eT.ExpressInstrumentation=GO});var gq=E(Hs=>{"use strict";Object.defineProperty(Hs,"__esModule",{value:!0});Hs.AttributeNames=Hs.ExpressLayerType=Hs.ExpressInstrumentation=void 0;var ahe=Sq();Object.defineProperty(Hs,"ExpressInstrumentation",{enumerable:!0,get:function(){return ahe.ExpressInstrumentation}});var che=Xh();Object.defineProperty(Hs,"ExpressLayerType",{enumerable:!0,get:function(){return che.ExpressLayerType}});var uhe=Jh();Object.defineProperty(Hs,"AttributeNames",{enumerable:!0,get:function(){return uhe.AttributeNames}})});var Oq=E(zp=>{"use strict";Object.defineProperty(zp,"__esModule",{value:!0});zp.SeverityNumber=void 0;var _he;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TRACE=1]="TRACE",t[t.TRACE2=2]="TRACE2",t[t.TRACE3=3]="TRACE3",t[t.TRACE4=4]="TRACE4",t[t.DEBUG=5]="DEBUG",t[t.DEBUG2=6]="DEBUG2",t[t.DEBUG3=7]="DEBUG3",t[t.DEBUG4=8]="DEBUG4",t[t.INFO=9]="INFO",t[t.INFO2=10]="INFO2",t[t.INFO3=11]="INFO3",t[t.INFO4=12]="INFO4",t[t.WARN=13]="WARN",t[t.WARN2=14]="WARN2",t[t.WARN3=15]="WARN3",t[t.WARN4=16]="WARN4",t[t.ERROR=17]="ERROR",t[t.ERROR2=18]="ERROR2",t[t.ERROR3=19]="ERROR3",t[t.ERROR4=20]="ERROR4",t[t.FATAL=21]="FATAL",t[t.FATAL2=22]="FATAL2",t[t.FATAL3=23]="FATAL3",t[t.FATAL4=24]="FATAL4"})(_he=zp.SeverityNumber||(zp.SeverityNumber={}))});var rT=E(fu=>{"use strict";Object.defineProperty(fu,"__esModule",{value:!0});fu.NOOP_LOGGER=fu.NoopLogger=void 0;var nT=class{emit(e){}};fu.NoopLogger=nT;fu.NOOP_LOGGER=new nT});var Nq=E(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.API_BACKWARDS_COMPATIBILITY_VERSION=lo.makeGetter=lo._global=lo.GLOBAL_LOGS_API_KEY=void 0;lo.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");lo._global=globalThis;function fhe(t,e,n){return r=>r===t?e:n}lo.makeGetter=fhe;lo.API_BACKWARDS_COMPATIBILITY_VERSION=1});var BO=E(mu=>{"use strict";Object.defineProperty(mu,"__esModule",{value:!0});mu.NOOP_LOGGER_PROVIDER=mu.NoopLoggerProvider=void 0;var mhe=rT(),oT=class{getLogger(e,n,r){return new mhe.NoopLogger}};mu.NoopLoggerProvider=oT;mu.NOOP_LOGGER_PROVIDER=new oT});var bq=E(sT=>{"use strict";Object.defineProperty(sT,"__esModule",{value:!0});sT.ProxyLogger=void 0;var hhe=rT(),jO=class{constructor(e,n,r,o){this._provider=e,this.name=n,this.version=r,this.options=o}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):hhe.NOOP_LOGGER}};sT.ProxyLogger=jO});var Cq=E(iT=>{"use strict";Object.defineProperty(iT,"__esModule",{value:!0});iT.ProxyLoggerProvider=void 0;var The=BO(),Ehe=bq(),HO=class{getLogger(e,n,r){var o;return(o=this._getDelegateLogger(e,n,r))!==null&&o!==void 0?o:new Ehe.ProxyLogger(this,e,n,r)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:The.NOOP_LOGGER_PROVIDER}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,n,r){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(e,n,r)}};iT.ProxyLoggerProvider=HO});var Mq=E(aT=>{"use strict";Object.defineProperty(aT,"__esModule",{value:!0});aT.LogsAPI=void 0;var ar=Nq(),She=BO(),Pq=Cq(),FO=class t{constructor(){this._proxyLoggerProvider=new Pq.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return ar._global[ar.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(ar._global[ar.GLOBAL_LOGS_API_KEY]=(0,ar.makeGetter)(ar.API_BACKWARDS_COMPATIBILITY_VERSION,e,She.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,n;return(n=(e=ar._global[ar.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(ar._global,ar.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(e,n,r){return this.getLoggerProvider().getLogger(e,n,r)}disable(){delete ar._global[ar.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new Pq.ProxyLoggerProvider}};aT.LogsAPI=FO});var VO=E(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});po.logs=po.NoopLogger=po.NOOP_LOGGER=po.SeverityNumber=void 0;var ghe=Oq();Object.defineProperty(po,"SeverityNumber",{enumerable:!0,get:function(){return ghe.SeverityNumber}});var xq=rT();Object.defineProperty(po,"NOOP_LOGGER",{enumerable:!0,get:function(){return xq.NOOP_LOGGER}});Object.defineProperty(po,"NoopLogger",{enumerable:!0,get:function(){return xq.NoopLogger}});var Ahe=Mq();po.logs=Ahe.LogsAPI.getInstance()});var vq=E(hu=>{"use strict";Object.defineProperty(hu,"__esModule",{value:!0});hu.disableInstrumentations=hu.enableInstrumentations=void 0;function Rhe(t,e,n,r){for(let o=0,s=t.length;o<s;o++){let i=t[o];e&&i.setTracerProvider(e),n&&i.setMeterProvider(n),r&&i.setLoggerProvider&&i.setLoggerProvider(r),i.getConfig().enabled||i.enable()}}hu.enableInstrumentations=Rhe;function yhe(t){t.forEach(e=>e.disable())}hu.disableInstrumentations=yhe});var Uq=E(cT=>{"use strict";Object.defineProperty(cT,"__esModule",{value:!0});cT.registerInstrumentations=void 0;var Lq=(b(),O(v)),Ihe=VO(),Dq=vq();function Ohe(t){let e=t.tracerProvider||Lq.trace.getTracerProvider(),n=t.meterProvider||Lq.metrics.getMeterProvider(),r=t.loggerProvider||Ihe.logs.getLoggerProvider(),o=t.instrumentations?.flat()??[];return(0,Dq.enableInstrumentations)(o,e,n,r),()=>{(0,Dq.disableInstrumentations)(o)}}cT.registerInstrumentations=Ohe});var qq=E(uT=>{"use strict";Object.defineProperty(uT,"__esModule",{value:!0});uT.satisfies=void 0;var WO=(b(),O(v)),jq=/^(?:v)?(?<version>(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*))(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<build>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,Nhe=/^(?<op><|>|=|==|<=|>=|~|\^|~>)?\s*(?:v)?(?<version>(?<major>x|X|\*|0|[1-9]\d*)(?:\.(?<minor>x|X|\*|0|[1-9]\d*))?(?:\.(?<patch>x|X|\*|0|[1-9]\d*))?)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<build>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,bhe={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function Che(t,e,n){if(!Phe(t))return WO.diag.error(`Invalid version: ${t}`),!1;if(!e)return!0;e=e.replace(/([<>=~^]+)\s+/g,"$1");let r=Lhe(t);if(!r)return!1;let o=[],s=Hq(r,e,o,n);return s&&!n?.includePrerelease?xhe(r,o):s}uT.satisfies=Che;function Phe(t){return typeof t=="string"&&jq.test(t)}function Hq(t,e,n,r){if(e.includes("||")){let o=e.trim().split("||");for(let s of o)if(qO(t,s,n,r))return!0;return!1}else if(e.includes(" - "))e=eTe(e,r);else if(e.includes(" ")){let o=e.trim().replace(/\s{2,}/g," ").split(" ");for(let s of o)if(!qO(t,s,n,r))return!1;return!0}return qO(t,e,n,r)}function qO(t,e,n,r){if(e=vhe(e,r),e.includes(" "))return Hq(t,e,n,r);{let o=Dhe(e);return n.push(o),Mhe(t,o)}}function Mhe(t,e){if(e.invalid)return!1;if(!e.version||YO(e.version))return!0;let n=kq(t.versionSegments||[],e.versionSegments||[]);if(n===0){let r=t.prereleaseSegments||[],o=e.prereleaseSegments||[];!r.length&&!o.length?n=0:!r.length&&o.length?n=1:r.length&&!o.length?n=-1:n=kq(r,o)}return bhe[e.op]?.includes(n)}function xhe(t,e){return t.prerelease?e.some(n=>n.prerelease&&n.version===t.version):!0}function vhe(t,e){return t=t.trim(),t=Jhe(t,e),t=Xhe(t),t=Zhe(t,e),t=t.trim(),t}function _n(t){return!t||t.toLowerCase()==="x"||t==="*"}function Lhe(t){let e=t.match(jq);if(!e){WO.diag.error(`Invalid version: ${t}`);return}let n=e.groups.version,r=e.groups.prerelease,o=e.groups.build,s=n.split("."),i=r?.split(".");return{op:void 0,version:n,versionSegments:s,versionSegmentCount:s.length,prerelease:r,prereleaseSegments:i,prereleaseSegmentCount:i?i.length:0,build:o}}function Dhe(t){if(!t)return{};let e=t.match(Nhe);if(!e)return WO.diag.error(`Invalid range: ${t}`),{invalid:!0};let n=e.groups.op,r=e.groups.version,o=e.groups.prerelease,s=e.groups.build,i=r.split("."),a=o?.split(".");return n==="=="&&(n="="),{op:n||"=",version:r,versionSegments:i,versionSegmentCount:i.length,prerelease:o,prereleaseSegments:a,prereleaseSegmentCount:a?a.length:0,build:s}}function YO(t){return t==="*"||t==="x"||t==="X"}function wq(t){let e=parseInt(t,10);return isNaN(e)?t:e}function Uhe(t,e){if(typeof t==typeof e){if(typeof t=="number")return[t,e];if(typeof t=="string")return[t,e];throw new Error("Version segments can only be strings or numbers")}else return[String(t),String(e)]}function whe(t,e){if(YO(t)||YO(e))return 0;let[n,r]=Uhe(wq(t),wq(e));return n>r?1:n<r?-1:0}function kq(t,e){for(let n=0;n<Math.max(t.length,e.length);n++){let r=whe(t[n]||"0",e[n]||"0");if(r!==0)return r}return 0}var Fq="[a-zA-Z0-9-]",Vq="0|[1-9]\\d*",khe=`\\d*[a-zA-Z-]${Fq}*`,Ghe="((?:<|>)?=?)",Gq=`(?:${Vq}|${khe})`,Bhe=`(?:-(${Gq}(?:\\.${Gq})*))`,Bq=`${Fq}+`,jhe=`(?:\\+(${Bq}(?:\\.${Bq})*))`,$O=`${Vq}|x|X|\\*`,Kp=`[v=\\s]*(${$O})(?:\\.(${$O})(?:\\.(${$O})(?:${Bhe})?${jhe}?)?)?`,Hhe=`^${Ghe}\\s*${Kp}$`,Fhe=new RegExp(Hhe),Vhe=`^\\s*(${Kp})\\s+-\\s+(${Kp})\\s*$`,qhe=new RegExp(Vhe),$he="(?:~>?)",Yhe=`^${$he}${Kp}$`,Whe=new RegExp(Yhe),zhe="(?:\\^)",Khe=`^${zhe}${Kp}$`,Qhe=new RegExp(Khe);function Xhe(t){let e=Whe;return t.replace(e,(n,r,o,s,i)=>{let a;return _n(r)?a="":_n(o)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:_n(s)?a=`>=${r}.${o}.0 <${r}.${+o+1}.0-0`:i?a=`>=${r}.${o}.${s}-${i} <${r}.${+o+1}.0-0`:a=`>=${r}.${o}.${s} <${r}.${+o+1}.0-0`,a})}function Jhe(t,e){let n=Qhe,r=e?.includePrerelease?"-0":"";return t.replace(n,(o,s,i,a,c)=>{let l;return _n(s)?l="":_n(i)?l=`>=${s}.0.0${r} <${+s+1}.0.0-0`:_n(a)?s==="0"?l=`>=${s}.${i}.0${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.0${r} <${+s+1}.0.0-0`:c?s==="0"?i==="0"?l=`>=${s}.${i}.${a}-${c} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a}-${c} <${+s+1}.0.0-0`:s==="0"?i==="0"?l=`>=${s}.${i}.${a}${r} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a} <${+s+1}.0.0-0`,l})}function Zhe(t,e){let n=Fhe;return t.replace(n,(r,o,s,i,a,c)=>{let l=_n(s),p=l||_n(i),d=p||_n(a),_=d;return o==="="&&_&&(o=""),c=e?.includePrerelease?"-0":"",l?o===">"||o==="<"?r="<0.0.0-0":r="*":o&&_?(p&&(i=0),a=0,o===">"?(o=">=",p?(s=+s+1,i=0,a=0):(i=+i+1,a=0)):o==="<="&&(o="<",p?s=+s+1:i=+i+1),o==="<"&&(c="-0"),r=`${o+s}.${i}.${a}${c}`):p?r=`>=${s}.0.0${c} <${+s+1}.0.0-0`:d&&(r=`>=${s}.${i}.0${c} <${s}.${+i+1}.0-0`),r})}function eTe(t,e){let n=qhe;return t.replace(n,(r,o,s,i,a,c,l,p,d,_,f,m)=>(_n(s)?o="":_n(i)?o=`>=${s}.0.0${e?.includePrerelease?"-0":""}`:_n(a)?o=`>=${s}.${i}.0${e?.includePrerelease?"-0":""}`:c?o=`>=${o}`:o=`>=${o}${e?.includePrerelease?"-0":""}`,_n(d)?p="":_n(_)?p=`<${+d+1}.0.0-0`:_n(f)?p=`<${d}.${+_+1}.0-0`:m?p=`<=${d}.${_}.${f}-${m}`:e?.includePrerelease?p=`<${d}.${_}.${+f+1}-0`:p=`<=${p}`,`${o} ${p}`.trim()))}});var zO=E(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.massUnwrap=Bt.unwrap=Bt.massWrap=Bt.wrap=void 0;var fn=console.error.bind(console);function Qp(t,e,n){let r=!!t[e]&&Object.prototype.propertyIsEnumerable.call(t,e);Object.defineProperty(t,e,{configurable:!0,enumerable:r,writable:!0,value:n})}var tTe=(t,e,n)=>{if(!t||!t[e]){fn("no original function "+String(e)+" to wrap");return}if(!n){fn("no wrapper function"),fn(new Error().stack);return}let r=t[e];if(typeof r!="function"||typeof n!="function"){fn("original object and wrapper must be functions");return}let o=n(r,e);return Qp(o,"__original",r),Qp(o,"__unwrap",()=>{t[e]===o&&Qp(t,e,r)}),Qp(o,"__wrapped",!0),Qp(t,e,o),o};Bt.wrap=tTe;var nTe=(t,e,n)=>{if(t)Array.isArray(t)||(t=[t]);else{fn("must provide one or more modules to patch"),fn(new Error().stack);return}if(!(e&&Array.isArray(e))){fn("must provide one or more functions to wrap on modules");return}t.forEach(r=>{e.forEach(o=>{(0,Bt.wrap)(r,o,n)})})};Bt.massWrap=nTe;var rTe=(t,e)=>{if(!t||!t[e]){fn("no function to unwrap."),fn(new Error().stack);return}let n=t[e];if(!n.__unwrap)fn("no original to unwrap to -- has "+String(e)+" already been unwrapped?");else{n.__unwrap();return}};Bt.unwrap=rTe;var oTe=(t,e)=>{if(t)Array.isArray(t)||(t=[t]);else{fn("must provide one or more modules to patch"),fn(new Error().stack);return}if(!(e&&Array.isArray(e))){fn("must provide one or more functions to unwrap on modules");return}t.forEach(n=>{e.forEach(r=>{(0,Bt.unwrap)(n,r)})})};Bt.massUnwrap=oTe;function Xp(t){t&&t.logger&&(typeof t.logger!="function"?fn("new logger isn't a function, not replacing"):fn=t.logger)}Bt.default=Xp;Xp.wrap=Bt.wrap;Xp.massWrap=Bt.massWrap;Xp.unwrap=Bt.unwrap;Xp.massUnwrap=Bt.massUnwrap});var $q=E(pT=>{"use strict";Object.defineProperty(pT,"__esModule",{value:!0});pT.InstrumentationAbstract=void 0;var KO=(b(),O(v)),sTe=VO(),lT=zO(),QO=class{_config={};_tracer;_meter;_logger;_diag;instrumentationName;instrumentationVersion;constructor(e,n,r){this.instrumentationName=e,this.instrumentationVersion=n,this.setConfig(r),this._diag=KO.diag.createComponentLogger({namespace:e}),this._tracer=KO.trace.getTracer(e,n),this._meter=KO.metrics.getMeter(e,n),this._logger=sTe.logs.getLogger(e,n),this._updateMetricInstruments()}_wrap=lT.wrap;_unwrap=lT.unwrap;_massWrap=lT.massWrap;_massUnwrap=lT.massUnwrap;get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let e=this.init()??[];return Array.isArray(e)?e:[e]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config={enabled:!0,...e}}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,n,r,o){if(e)try{e(r,o)}catch(s){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:n},s)}}};pT.InstrumentationAbstract=QO});var Yq=E(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});Fs.ModuleNameTrie=Fs.ModuleNameSeparator=void 0;Fs.ModuleNameSeparator="/";var dT=class{hooks=[];children=new Map},XO=class{_trie=new dT;_counter=0;insert(e){let n=this._trie;for(let r of e.moduleName.split(Fs.ModuleNameSeparator)){let o=n.children.get(r);o||(o=new dT,n.children.set(r,o)),n=o}n.hooks.push({hook:e,insertedId:this._counter++})}search(e,{maintainInsertionOrder:n,fullOnly:r}={}){let o=this._trie,s=[],i=!0;for(let a of e.split(Fs.ModuleNameSeparator)){let c=o.children.get(a);if(!c){i=!1;break}r||s.push(...c.hooks),o=c}return r&&i&&s.push(...o.hooks),s.length===0?[]:s.length===1?[s[0].hook]:(n&&s.sort((a,c)=>a.insertedId-c.insertedId),s.map(({hook:a})=>a))}};Fs.ModuleNameTrie=XO});var zq=E(_T=>{"use strict";Object.defineProperty(_T,"__esModule",{value:!0});_T.RequireInTheMiddleSingleton=void 0;var iTe=wi(),Wq=U("path"),JO=Yq(),aTe=["afterEach","after","beforeEach","before","describe","it"].every(t=>typeof global[t]=="function"),ZO=class t{_moduleNameTrie=new JO.ModuleNameTrie;static _instance;constructor(){this._initialize()}_initialize(){new iTe.Hook(null,{internals:!0},(e,n,r)=>{let o=cTe(n),s=this._moduleNameTrie.search(o,{maintainInsertionOrder:!0,fullOnly:r===void 0});for(let{onRequire:i}of s)e=i(e,n,r);return e})}register(e,n){let r={moduleName:e,onRequire:n};return this._moduleNameTrie.insert(r),r}static getInstance(){return aTe?new t:this._instance=this._instance??new t}};_T.RequireInTheMiddleSingleton=ZO;function cTe(t){return Wq.sep!==JO.ModuleNameSeparator?t.split(Wq.sep).join(JO.ModuleNameSeparator):t}});var Zq=E(Jp=>{var Kq=[],eN=new WeakMap,Qq=new WeakMap,Xq=new Map,Jq=[],uTe={set(t,e,n){let r=eN.get(t),o=r&&r[e];return typeof o=="function"?o(n):!0},get(t,e){if(e===Symbol.toStringTag)return"Module";let n=Qq.get(t)[e];if(typeof n=="function")return n()},defineProperty(t,e,n){if(!("value"in n))throw new Error("Getters/setters are not supported for exports property descriptors.");let r=eN.get(t),o=r&&r[e];return typeof o=="function"?o(n.value):!0}};function lTe(t,e,n,r,o){Xq.set(t,o),eN.set(e,n),Qq.set(e,r);let s=new Proxy(e,uTe);Kq.forEach(i=>i(t,s,o)),Jq.push([t,s,o])}Jp.register=lTe;Jp.importHooks=Kq;Jp.specifiers=Xq;Jp.toHook=Jq});var oN=E((hKe,Eu)=>{var e$=U("path"),pTe=mf(),{fileURLToPath:dTe}=U("url"),{MessageChannel:_Te}=U("worker_threads"),{isBuiltin:tN}=U("module");tN||(tN=()=>!0);var{importHooks:nN,specifiers:fTe,toHook:mTe}=Zq();function t$(t){nN.push(t),mTe.forEach(([e,n,r])=>t(e,n,r))}function n$(t){let e=nN.indexOf(t);e>-1&&nN.splice(e,1)}function Tu(t,e,n,r){let o=t(e,n,r);o&&o!==e&&"default"in e&&(e.default=o)}var rN;function hTe(){let{port1:t,port2:e}=new _Te,n=0,r;rN=a=>{n++,t.postMessage(a)},t.on("message",()=>{n--,r&&n<=0&&r()}).unref();function o(){let a=setInterval(()=>{},1e3),c=new Promise(l=>{r=l}).then(()=>{clearInterval(a)});return n===0&&r(),c}let s=e;return{registerOptions:{data:{addHookMessagePort:s,include:[]},transferList:[s]},addHookMessagePort:s,waitForAllMessagesAcknowledged:o}}function Zp(t,e,n){if(!(this instanceof Zp))return new Zp(t,e,n);typeof t=="function"?(n=t,t=null,e=null):typeof e=="function"&&(n=e,e=null);let r=e?e.internals===!0:!1;rN&&Array.isArray(t)&&rN(t),this._iitmHook=(o,s,i)=>{let a=o,c=a.startsWith("node:"),l,p;if(c){let d=o.slice(5);tN(d)&&(o=d)}else if(a.startsWith("file://")){let d=Error.stackTraceLimit;Error.stackTraceLimit=0;try{l=dTe(o),o=l}catch{}if(Error.stackTraceLimit=d,l){let _=pTe(l);_&&(o=_.name,p=_.basedir)}}if(t)for(let d of t)if(l&&d===l)Tu(n,s,l,void 0);else if(d===o){if(!p)Tu(n,s,o,p);else if(p.endsWith(fTe.get(a)))Tu(n,s,o,p);else if(r){let _=o+e$.sep+e$.relative(p,l);Tu(n,s,_,p)}}else d===i&&Tu(n,s,i,p);else Tu(n,s,o,p)},t$(this._iitmHook)}Zp.prototype.unhook=function(){n$(this._iitmHook)};Eu.exports=Zp;Eu.exports.Hook=Zp;Eu.exports.addHook=t$;Eu.exports.removeHook=n$;Eu.exports.createAddHookMessageChannel=hTe});var sN=E(Vs=>{"use strict";Object.defineProperty(Vs,"__esModule",{value:!0});Vs.isWrapped=Vs.safeExecuteInTheMiddleAsync=Vs.safeExecuteInTheMiddle=void 0;function TTe(t,e,n){let r,o;try{o=t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}Vs.safeExecuteInTheMiddle=TTe;async function ETe(t,e,n){let r,o;try{o=await t()}catch(s){r=s}finally{if(await e(r,o),r&&!n)throw r;return o}}Vs.safeExecuteInTheMiddleAsync=ETe;function STe(t){return typeof t=="function"&&typeof t.__original=="function"&&typeof t.__unwrap=="function"&&t.__wrapped===!0}Vs.isWrapped=STe});var s$=E(fT=>{"use strict";Object.defineProperty(fT,"__esModule",{value:!0});fT.InstrumentationBase=void 0;var ed=U("path"),r$=U("util"),gTe=qq(),iN=zO(),ATe=$q(),RTe=zq(),yTe=oN(),td=(b(),O(v)),ITe=wi(),OTe=U("fs"),NTe=sN(),aN=class extends ATe.InstrumentationAbstract{_modules;_hooks=[];_requireInTheMiddleSingleton=RTe.RequireInTheMiddleSingleton.getInstance();_enabled=!1;constructor(e,n,r){super(e,n,r);let o=this.init();o&&!Array.isArray(o)&&(o=[o]),this._modules=o||[],this._config.enabled&&this.enable()}_wrap=(e,n,r)=>{if((0,NTe.isWrapped)(e[n])&&this._unwrap(e,n),r$.types.isProxy(e)){let o=(0,iN.wrap)(Object.assign({},e),n,r);return Object.defineProperty(e,n,{value:o}),o}else return(0,iN.wrap)(e,n,r)};_unwrap=(e,n)=>r$.types.isProxy(e)?Object.defineProperty(e,n,{value:e[n]}):(0,iN.unwrap)(e,n);_massWrap=(e,n,r)=>{if(e)Array.isArray(e)||(e=[e]);else{td.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){td.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(o=>{n.forEach(s=>{this._wrap(o,s,r)})})};_massUnwrap=(e,n)=>{if(e)Array.isArray(e)||(e=[e]);else{td.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){td.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(r=>{n.forEach(o=>{this._unwrap(r,o)})})};_warnOnPreloadedModules(){this._modules.forEach(e=>{let{name:n}=e;try{let r=U.resolve(n);U.cache[r]&&this._diag.warn(`Module ${n} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${n}`)}catch{}})}_extractPackageVersion(e){try{let n=(0,OTe.readFileSync)(ed.join(e,"package.json"),{encoding:"utf8"}),r=JSON.parse(n).version;return typeof r=="string"?r:void 0}catch{td.diag.warn("Failed extracting version",e)}}_onRequire(e,n,r,o){if(!o)return typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for nodejs core module on require hook",{module:e.name}),e.patch(n)):n;let s=this._extractPackageVersion(o);if(e.moduleVersion=s,e.name===r)return o$(e.supportedVersions,s,e.includePrerelease)&&typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for module on require hook",{module:e.name,version:e.moduleVersion,baseDir:o}),e.patch(n,e.moduleVersion)):n;let i=e.files??[],a=ed.normalize(r);return i.filter(l=>l.name===a&&o$(l.supportedVersions,s,e.includePrerelease)).reduce((l,p)=>(p.moduleExports=l,this._enabled?(this._diag.debug("Applying instrumentation patch for nodejs module file on require hook",{module:e.name,version:e.moduleVersion,fileName:p.name,baseDir:o}),p.patch(l,e.moduleVersion)):l),n)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let e of this._modules){typeof e.patch=="function"&&e.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module on instrumentation enabled",{module:e.name,version:e.moduleVersion}),e.patch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module file on instrumentation enabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.patch(n.moduleExports,e.moduleVersion))}return}this._warnOnPreloadedModules();for(let e of this._modules){let n=(i,a,c)=>{if(!c&&ed.isAbsolute(a)){let l=ed.parse(a);a=l.name,c=l.dir}return this._onRequire(e,i,a,c)},r=(i,a,c)=>this._onRequire(e,i,a,c),o=ed.isAbsolute(e.name)?new ITe.Hook([e.name],{internals:!0},r):this._requireInTheMiddleSingleton.register(e.name,r);this._hooks.push(o);let s=new yTe.Hook([e.name],{internals:!0},n);this._hooks.push(s)}}}disable(){if(this._enabled){this._enabled=!1;for(let e of this._modules){typeof e.unpatch=="function"&&e.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module on instrumentation disabled",{module:e.name,version:e.moduleVersion}),e.unpatch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module file on instrumentation disabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.unpatch(n.moduleExports,e.moduleVersion))}}}isEnabled(){return this._enabled}};fT.InstrumentationBase=aN;function o$(t,e,n){return typeof e>"u"?t.includes("*"):t.some(r=>(0,gTe.satisfies)(e,r,{includePrerelease:n}))}});var i$=E(mT=>{"use strict";Object.defineProperty(mT,"__esModule",{value:!0});mT.normalize=void 0;var bTe=U("path");Object.defineProperty(mT,"normalize",{enumerable:!0,get:function(){return bTe.normalize}})});var a$=E(Su=>{"use strict";Object.defineProperty(Su,"__esModule",{value:!0});Su.normalize=Su.InstrumentationBase=void 0;var CTe=s$();Object.defineProperty(Su,"InstrumentationBase",{enumerable:!0,get:function(){return CTe.InstrumentationBase}});var PTe=i$();Object.defineProperty(Su,"normalize",{enumerable:!0,get:function(){return PTe.normalize}})});var cN=E(gu=>{"use strict";Object.defineProperty(gu,"__esModule",{value:!0});gu.normalize=gu.InstrumentationBase=void 0;var c$=a$();Object.defineProperty(gu,"InstrumentationBase",{enumerable:!0,get:function(){return c$.InstrumentationBase}});Object.defineProperty(gu,"normalize",{enumerable:!0,get:function(){return c$.normalize}})});var u$=E(hT=>{"use strict";Object.defineProperty(hT,"__esModule",{value:!0});hT.InstrumentationNodeModuleDefinition=void 0;var uN=class{files;name;supportedVersions;patch;unpatch;constructor(e,n,r,o,s){this.files=s||[],this.name=e,this.supportedVersions=n,this.patch=r,this.unpatch=o}};hT.InstrumentationNodeModuleDefinition=uN});var l$=E(TT=>{"use strict";Object.defineProperty(TT,"__esModule",{value:!0});TT.InstrumentationNodeModuleFile=void 0;var MTe=cN(),lN=class{name;supportedVersions;patch;unpatch;constructor(e,n,r,o){this.name=(0,MTe.normalize)(e),this.supportedVersions=n,this.patch=r,this.unpatch=o}};TT.InstrumentationNodeModuleFile=lN});var p$=E(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});la.semconvStabilityFromStr=la.SemconvStability=void 0;var ET;(function(t){t[t.STABLE=1]="STABLE",t[t.OLD=2]="OLD",t[t.DUPLICATE=3]="DUPLICATE"})(ET=la.SemconvStability||(la.SemconvStability={}));function xTe(t,e){let n=ET.OLD,r=e?.split(",").map(o=>o.trim()).filter(o=>o!=="");for(let o of r??[])if(o.toLowerCase()===t+"/dup"){n=ET.DUPLICATE;break}else o.toLowerCase()===t&&(n=ET.STABLE);return n}la.semconvStabilityFromStr=xTe});var _$=E(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.semconvStabilityFromStr=it.SemconvStability=it.safeExecuteInTheMiddleAsync=it.safeExecuteInTheMiddle=it.isWrapped=it.InstrumentationNodeModuleFile=it.InstrumentationNodeModuleDefinition=it.InstrumentationBase=it.registerInstrumentations=void 0;var vTe=Uq();Object.defineProperty(it,"registerInstrumentations",{enumerable:!0,get:function(){return vTe.registerInstrumentations}});var LTe=cN();Object.defineProperty(it,"InstrumentationBase",{enumerable:!0,get:function(){return LTe.InstrumentationBase}});var DTe=u$();Object.defineProperty(it,"InstrumentationNodeModuleDefinition",{enumerable:!0,get:function(){return DTe.InstrumentationNodeModuleDefinition}});var UTe=l$();Object.defineProperty(it,"InstrumentationNodeModuleFile",{enumerable:!0,get:function(){return UTe.InstrumentationNodeModuleFile}});var pN=sN();Object.defineProperty(it,"isWrapped",{enumerable:!0,get:function(){return pN.isWrapped}});Object.defineProperty(it,"safeExecuteInTheMiddle",{enumerable:!0,get:function(){return pN.safeExecuteInTheMiddle}});Object.defineProperty(it,"safeExecuteInTheMiddleAsync",{enumerable:!0,get:function(){return pN.safeExecuteInTheMiddleAsync}});var d$=p$();Object.defineProperty(it,"SemconvStability",{enumerable:!0,get:function(){return d$.SemconvStability}});Object.defineProperty(it,"semconvStabilityFromStr",{enumerable:!0,get:function(){return d$.semconvStabilityFromStr}})});var f$=E((bKe,wTe)=>{wTe.exports={name:"@fastify/otel",version:"0.18.0",description:"Official Fastify OpenTelemetry Instrumentation",main:"index.js",type:"commonjs",types:"types/index.d.ts",scripts:{lint:"eslint","lint:fix":"eslint --fix",test:"npm run test:all && npm run test:typescript","test:unit":"c8 --100 node --test","test:all":"npm run test:v4 && npm run test:v5","test:v4":"cross-env FASTIFY_VERSION=fastifyv4 npm run test:unit","test:v5":"cross-env FASTIFY_VERSION=fastify npm run test:unit","test:coverage":"c8 node --test && c8 report --reporter=html","test:typescript":"tsd"},repository:{type:"git",url:"git+https://github.com/fastify/otel.git"},keywords:["plugin","helper","fastify","instrumentation","otel","opentelemetry"],author:"Carlos Fuentes - @metcoder95 (https://metcoder.dev)",license:"MIT",bugs:{url:"https://github.com/fastify/otel/issues"},homepage:"https://github.com/fastify/otel#readme",funding:[{type:"github",url:"https://github.com/sponsors/fastify"},{type:"opencollective",url:"https://opencollective.com/fastify"}],devDependencies:{"@fastify/type-provider-typebox":"^6.1.0","@opentelemetry/context-async-hooks":"^2.0.0","@opentelemetry/contrib-test-utils":"^0.59.0","@opentelemetry/instrumentation-http":"^0.212.0","@opentelemetry/propagator-jaeger":"^2.0.0","@opentelemetry/sdk-trace-base":"^2.0.0","@opentelemetry/sdk-trace-node":"^2.2.0","@types/node":"^25.0.3",c8:"^11.0.0","cross-env":"^10.0.0",eslint:"^9.16.0",fastify:"^5.1.0","fastify-plugin":"^5.1.0",fastifyv4:"npm:fastify@^4.0.0",neostandard:"^0.12.0",tsd:"^0.33.0"},dependencies:{"@opentelemetry/core":"^2.0.0","@opentelemetry/instrumentation":"^0.212.0","@opentelemetry/semantic-conventions":"^1.28.0",minimatch:"^10.2.4"},peerDependencies:{"@opentelemetry/api":"^1.9.0"},tsd:{directory:"types"}}});var h$=E(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});pa.range=pa.balanced=void 0;var kTe=(t,e,n)=>{let r=t instanceof RegExp?m$(t,n):t,o=e instanceof RegExp?m$(e,n):e,s=r!==null&&o!=null&&(0,pa.range)(r,o,n);return s&&{start:s[0],end:s[1],pre:n.slice(0,s[0]),body:n.slice(s[0]+r.length,s[1]),post:n.slice(s[1]+o.length)}};pa.balanced=kTe;var m$=(t,e)=>{let n=e.match(t);return n?n[0]:null},GTe=(t,e,n)=>{let r,o,s,i,a,c=n.indexOf(t),l=n.indexOf(e,c+1),p=c;if(c>=0&&l>0){if(t===e)return[c,l];for(r=[],s=n.length;p>=0&&!a;){if(p===c)r.push(p),c=n.indexOf(t,p+1);else if(r.length===1){let d=r.pop();d!==void 0&&(a=[d,l])}else o=r.pop(),o!==void 0&&o<s&&(s=o,i=l),l=n.indexOf(e,p+1);p=c<l&&c>=0?c:l}r.length&&i!==void 0&&(a=[s,i])}return a};pa.range=GTe});var y$=E(Au=>{"use strict";Object.defineProperty(Au,"__esModule",{value:!0});Au.EXPANSION_MAX=void 0;Au.expand=XTe;var T$=h$(),E$="\0SLASH"+Math.random()+"\0",S$="\0OPEN"+Math.random()+"\0",_N="\0CLOSE"+Math.random()+"\0",g$="\0COMMA"+Math.random()+"\0",A$="\0PERIOD"+Math.random()+"\0",BTe=new RegExp(E$,"g"),jTe=new RegExp(S$,"g"),HTe=new RegExp(_N,"g"),FTe=new RegExp(g$,"g"),VTe=new RegExp(A$,"g"),qTe=/\\\\/g,$Te=/\\{/g,YTe=/\\}/g,WTe=/\\,/g,zTe=/\\\./g;Au.EXPANSION_MAX=1e5;function dN(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function KTe(t){return t.replace(qTe,E$).replace($Te,S$).replace(YTe,_N).replace(WTe,g$).replace(zTe,A$)}function QTe(t){return t.replace(BTe,"\\").replace(jTe,"{").replace(HTe,"}").replace(FTe,",").replace(VTe,".")}function R$(t){if(!t)return[""];let e=[],n=(0,T$.balanced)("{","}",t);if(!n)return t.split(",");let{pre:r,body:o,post:s}=n,i=r.split(",");i[i.length-1]+="{"+o+"}";let a=R$(s);return s.length&&(i[i.length-1]+=a.shift(),i.push.apply(i,a)),e.push.apply(e,i),e}function XTe(t,e={}){if(!t)return[];let{max:n=Au.EXPANSION_MAX}=e;return t.slice(0,2)==="{}"&&(t="\\{\\}"+t.slice(2)),nd(KTe(t),n,!0).map(QTe)}function JTe(t){return"{"+t+"}"}function ZTe(t){return/^-?0\d/.test(t)}function eEe(t,e){return t<=e}function tEe(t,e){return t>=e}function nd(t,e,n){let r=[],o=(0,T$.balanced)("{","}",t);if(!o)return[t];let s=o.pre,i=o.post.length?nd(o.post,e,!1):[""];if(/\$$/.test(o.pre))for(let a=0;a<i.length&&a<e;a++){let c=s+"{"+o.body+"}"+i[a];r.push(c)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(o.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(o.body),l=a||c,p=o.body.indexOf(",")>=0;if(!l&&!p)return o.post.match(/,(?!,).*\}/)?(t=o.pre+"{"+o.body+_N+o.post,nd(t,e,!0)):[t];let d;if(l)d=o.body.split(/\.\./);else if(d=R$(o.body),d.length===1&&d[0]!==void 0&&(d=nd(d[0],e,!1).map(JTe),d.length===1))return i.map(f=>o.pre+d[0]+f);let _;if(l&&d[0]!==void 0&&d[1]!==void 0){let f=dN(d[0]),m=dN(d[1]),h=Math.max(d[0].length,d[1].length),T=d.length===3&&d[2]!==void 0?Math.abs(dN(d[2])):1,S=eEe;m<f&&(T*=-1,S=tEe);let I=d.some(ZTe);_=[];for(let x=f;S(x,m);x+=T){let F;if(c)F=String.fromCharCode(x),F==="\\"&&(F="");else if(F=String(x),I){let B=h-F.length;if(B>0){let se=new Array(B+1).join("0");x<0?F="-"+se+F.slice(1):F=se+F}}_.push(F)}}else{_=[];for(let f=0;f<d.length;f++)_.push.apply(_,nd(d[f],e,!1))}for(let f=0;f<_.length;f++)for(let m=0;m<i.length&&r.length<e;m++){let h=s+_[f]+i[m];(!n||l||h)&&r.push(h)}}return r}});var I$=E(ST=>{"use strict";Object.defineProperty(ST,"__esModule",{value:!0});ST.assertValidPattern=void 0;var nEe=1024*64,rEe=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>nEe)throw new TypeError("pattern is too long")};ST.assertValidPattern=rEe});var N$=E(gT=>{"use strict";Object.defineProperty(gT,"__esModule",{value:!0});gT.parseClass=void 0;var oEe={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},rd=t=>t.replace(/[[\]\\-]/g,"\\$&"),sEe=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),O$=t=>t.join(""),iEe=(t,e)=>{let n=e;if(t.charAt(n)!=="[")throw new Error("not in a brace expression");let r=[],o=[],s=n+1,i=!1,a=!1,c=!1,l=!1,p=n,d="";e:for(;s<t.length;){let h=t.charAt(s);if((h==="!"||h==="^")&&s===n+1){l=!0,s++;continue}if(h==="]"&&i&&!c){p=s+1;break}if(i=!0,h==="\\"&&!c){c=!0,s++;continue}if(h==="["&&!c){for(let[T,[S,R,I]]of Object.entries(oEe))if(t.startsWith(T,s)){if(d)return["$.",!1,t.length-n,!0];s+=T.length,I?o.push(S):r.push(S),a=a||R;continue e}}if(c=!1,d){h>d?r.push(rd(d)+"-"+rd(h)):h===d&&r.push(rd(h)),d="",s++;continue}if(t.startsWith("-]",s+1)){r.push(rd(h+"-")),s+=2;continue}if(t.startsWith("-",s+1)){d=h,s+=2;continue}r.push(rd(h)),s++}if(p<s)return["",!1,0,!1];if(!r.length&&!o.length)return["$.",!1,t.length-n,!0];if(o.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!l){let h=r[0].length===2?r[0].slice(-1):r[0];return[sEe(h),!1,p-n,!1]}let _="["+(l?"^":"")+O$(r)+"]",f="["+(l?"":"^")+O$(o)+"]";return[r.length&&o.length?"("+_+"|"+f+")":r.length?_:f,a,p-n,!0]};gT.parseClass=iEe});var RT=E(AT=>{"use strict";Object.defineProperty(AT,"__esModule",{value:!0});AT.unescape=void 0;var aEe=(t,{windowsPathsNoEscape:e=!1,magicalBraces:n=!0}={})=>n?e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):e?t.replace(/\[([^\/\\{}])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1");AT.unescape=aEe});var hN=E(NT=>{"use strict";var bn;Object.defineProperty(NT,"__esModule",{value:!0});NT.AST=void 0;var cEe=N$(),yT=RT(),uEe=new Set(["!","?","+","*","@"]),fN=t=>uEe.has(t),b$=t=>fN(t.type),lEe=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),pEe=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),dEe=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),C$=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),_Ee="(?!(?:^|/)\\.\\.?(?:$|/))",IT="(?!\\.)",fEe=new Set(["[","."]),mEe=new Set(["..","."]),hEe=new Set("().*{}+?[]^$\\!"),TEe=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),mN="[^/]",P$=mN+"*?",M$=mN+"+?",EEe=0,OT=class{type;#n;#r;#o=!1;#e=[];#t;#a;#u;#c=!1;#s;#i;#l=!1;id=++EEe;get depth(){return(this.#t?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#n.id,parent:this.#t?.id,depth:this.depth,partsLength:this.#e.length,parts:this.#e}}constructor(e,n,r={}){this.type=e,e&&(this.#r=!0),this.#t=n,this.#n=this.#t?this.#t.#n:this,this.#s=this.#n===this?r:this.#n.#s,this.#u=this.#n===this?[]:this.#n.#u,e==="!"&&!this.#n.#c&&this.#u.push(this),this.#a=this.#t?this.#t.#e.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let e of this.#e)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#i!==void 0?this.#i:this.type?this.#i=this.type+"("+this.#e.map(e=>String(e)).join("|")+")":this.#i=this.#e.map(e=>String(e)).join("")}#T(){if(this!==this.#n)throw new Error("should only call on root");if(this.#c)return this;this.toString(),this.#c=!0;let e;for(;e=this.#u.pop();){if(e.type!=="!")continue;let n=e,r=n.#t;for(;r;){for(let o=n.#a+1;!r.type&&o<r.#e.length;o++)for(let s of e.#e){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(r.#e[o])}n=r,r=n.#t}}return this}push(...e){for(let n of e)if(n!==""){if(typeof n!="string"&&!(n instanceof bn&&n.#t===this))throw new Error("invalid part: "+n);this.#e.push(n)}}toJSON(){let e=this.type===null?this.#e.slice().map(n=>typeof n=="string"?n:n.toJSON()):[this.type,...this.#e.map(n=>n.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#n||this.#n.#c&&this.#t?.type==="!")&&e.push({}),e}isStart(){if(this.#n===this)return!0;if(!this.#t?.isStart())return!1;if(this.#a===0)return!0;let e=this.#t;for(let n=0;n<this.#a;n++){let r=e.#e[n];if(!(r instanceof bn&&r.type==="!"))return!1}return!0}isEnd(){if(this.#n===this||this.#t?.type==="!")return!0;if(!this.#t?.isEnd())return!1;if(!this.type)return this.#t?.isEnd();let e=this.#t?this.#t.#e.length:0;return this.#a===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let n=new bn(this.type,e);for(let r of this.#e)n.copyIn(r);return n}static#p(e,n,r,o,s){let i=o.maxExtglobRecursion??2,a=!1,c=!1,l=-1,p=!1;if(n.type===null){let h=r,T="";for(;h<e.length;){let S=e.charAt(h++);if(a||S==="\\"){a=!a,T+=S;continue}if(c){h===l+1?(S==="^"||S==="!")&&(p=!0):S==="]"&&!(h===l+2&&p)&&(c=!1),T+=S;continue}else if(S==="["){c=!0,l=h,p=!1,T+=S;continue}if(!o.noext&&fN(S)&&e.charAt(h)==="("&&s<=i){n.push(T),T="";let I=new bn(S,n);h=bn.#p(e,I,h,o,s+1),n.push(I);continue}T+=S}return n.push(T),h}let d=r+1,_=new bn(null,n),f=[],m="";for(;d<e.length;){let h=e.charAt(d++);if(a||h==="\\"){a=!a,m+=h;continue}if(c){d===l+1?(h==="^"||h==="!")&&(p=!0):h==="]"&&!(d===l+2&&p)&&(c=!1),m+=h;continue}else if(h==="["){c=!0,l=d,p=!1,m+=h;continue}if(!o.noext&&fN(h)&&e.charAt(d)==="("&&(s<=i||n&&n.#d(h))){let S=n&&n.#d(h)?0:1;_.push(m),m="";let R=new bn(h,_);_.push(R),d=bn.#p(e,R,d,o,s+S);continue}if(h==="|"){_.push(m),m="",f.push(_),_=new bn(null,n);continue}if(h===")")return m===""&&n.#e.length===0&&(n.#l=!0),_.push(m),m="",n.push(...f,_),d;m+=h}return n.type=null,n.#r=void 0,n.#e=[e.substring(r-1)],d}#E(e){return this.#f(e,pEe)}#f(e,n=lEe){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null)return!1;let r=e.#e[0];return!r||typeof r!="object"||r.type===null?!1:this.#d(r.type,n)}#d(e,n=dEe){return!!n.get(this.type)?.includes(e)}#S(e,n){let r=e.#e[0],o=new bn(null,r,this.options);o.#e.push(""),r.push(o),this.#m(e,n)}#m(e,n){let r=e.#e[0];this.#e.splice(n,1,...r.#e);for(let o of r.#e)typeof o=="object"&&(o.#t=this);this.#i=void 0}#g(e){return!!C$.get(this.type)?.has(e)}#A(e){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null||this.#e.length!==1)return!1;let n=e.#e[0];return!n||typeof n!="object"||n.type===null?!1:this.#g(n.type)}#R(e){let n=C$.get(this.type),r=e.#e[0],o=n?.get(r.type);if(!o)return!1;this.#e=r.#e;for(let s of this.#e)typeof s=="object"&&(s.#t=this);this.type=o,this.#i=void 0,this.#l=!1}static fromGlob(e,n={}){let r=new bn(null,void 0,n);return bn.#p(e,r,0,n,0),r}toMMPattern(){if(this!==this.#n)return this.#n.toMMPattern();let e=this.toString(),[n,r,o,s]=this.toRegExpSource();if(!(o||this.#r||this.#s.nocase&&!this.#s.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return r;let a=(this.#s.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${n}$`,a),{_src:n,_glob:e})}get options(){return this.#s}toRegExpSource(e){let n=e??!!this.#s.dot;if(this.#n===this&&(this.#_(),this.#T()),!b$(this)){let c=this.isStart()&&this.isEnd()&&!this.#e.some(f=>typeof f!="string"),l=this.#e.map(f=>{let[m,h,T,S]=typeof f=="string"?bn.#y(f,this.#r,c):f.toRegExpSource(e);return this.#r=this.#r||T,this.#o=this.#o||S,m}).join(""),p="";if(this.isStart()&&typeof this.#e[0]=="string"&&!(this.#e.length===1&&mEe.has(this.#e[0]))){let m=fEe,h=n&&m.has(l.charAt(0))||l.startsWith("\\.")&&m.has(l.charAt(2))||l.startsWith("\\.\\.")&&m.has(l.charAt(4)),T=!n&&!e&&m.has(l.charAt(0));p=h?_Ee:T?IT:""}let d="";return this.isEnd()&&this.#n.#c&&this.#t?.type==="!"&&(d="(?:$|\\/)"),[p+l+d,(0,yT.unescape)(l),this.#r=!!this.#r,this.#o]}let r=this.type==="*"||this.type==="+",o=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#h(n);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let c=this.toString(),l=this;return l.#e=[c],l.type=null,l.#r=void 0,[c,(0,yT.unescape)(this.toString()),!1,!1]}let i=!r||e||n||!IT?"":this.#h(!0);i===s&&(i=""),i&&(s=`(?:${s})(?:${i})*?`);let a="";if(this.type==="!"&&this.#l)a=(this.isStart()&&!n?IT:"")+M$;else{let c=this.type==="!"?"))"+(this.isStart()&&!n&&!e?IT:"")+P$+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&i?")":this.type==="*"&&i?")?":`)${this.type}`;a=o+s+c}return[a,(0,yT.unescape)(s),this.#r=!!this.#r,this.#o]}#_(){if(b$(this)){let e=0,n=!1;do{n=!0;for(let r=0;r<this.#e.length;r++){let o=this.#e[r];typeof o=="object"&&(o.#_(),this.#f(o)?(n=!1,this.#m(o,r)):this.#E(o)?(n=!1,this.#S(o,r)):this.#A(o)&&(n=!1,this.#R(o)))}}while(!n&&++e<10)}else for(let e of this.#e)typeof e=="object"&&e.#_();this.#i=void 0}#h(e){return this.#e.map(n=>{if(typeof n=="string")throw new Error("string type in extglob ast??");let[r,o,s,i]=n.toRegExpSource(e);return this.#o=this.#o||i,r}).filter(n=>!(this.isStart()&&this.isEnd())||!!n).join("|")}static#y(e,n,r=!1){let o=!1,s="",i=!1,a=!1;for(let c=0;c<e.length;c++){let l=e.charAt(c);if(o){o=!1,s+=(hEe.has(l)?"\\":"")+l;continue}if(l==="*"){if(a)continue;a=!0,s+=r&&/^[*]+$/.test(e)?M$:P$,n=!0;continue}else a=!1;if(l==="\\"){c===e.length-1?s+="\\\\":o=!0;continue}if(l==="["){let[p,d,_,f]=(0,cEe.parseClass)(e,c);if(_){s+=p,i=i||d,c+=_-1,n=n||f;continue}}if(l==="?"){s+=mN,n=!0;continue}s+=TEe(l)}return[s,(0,yT.unescape)(e),!!n,i]}};NT.AST=OT;bn=OT});var TN=E(bT=>{"use strict";Object.defineProperty(bT,"__esModule",{value:!0});bT.escape=void 0;var SEe=(t,{windowsPathsNoEscape:e=!1,magicalBraces:n=!1}={})=>n?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&");bT.escape=SEe});var k$=E(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.unescape=k.escape=k.AST=k.Minimatch=k.match=k.makeRe=k.braceExpand=k.defaults=k.filter=k.GLOBSTAR=k.sep=k.minimatch=void 0;var gEe=y$(),CT=I$(),L$=hN(),AEe=TN(),REe=RT(),yEe=(t,e,n={})=>((0,CT.assertValidPattern)(e),!n.nocomment&&e.charAt(0)==="#"?!1:new da(e,n).match(t));k.minimatch=yEe;var IEe=/^\*+([^+@!?\*\[\(]*)$/,OEe=t=>e=>!e.startsWith(".")&&e.endsWith(t),NEe=t=>e=>e.endsWith(t),bEe=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),CEe=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),PEe=/^\*+\.\*+$/,MEe=t=>!t.startsWith(".")&&t.includes("."),xEe=t=>t!=="."&&t!==".."&&t.includes("."),vEe=/^\.\*+$/,LEe=t=>t!=="."&&t!==".."&&t.startsWith("."),DEe=/^\*+$/,UEe=t=>t.length!==0&&!t.startsWith("."),wEe=t=>t.length!==0&&t!=="."&&t!=="..",kEe=/^\?+([^+@!?\*\[\(]*)?$/,GEe=([t,e=""])=>{let n=D$([t]);return e?(e=e.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(e)):n},BEe=([t,e=""])=>{let n=U$([t]);return e?(e=e.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(e)):n},jEe=([t,e=""])=>{let n=U$([t]);return e?r=>n(r)&&r.endsWith(e):n},HEe=([t,e=""])=>{let n=D$([t]);return e?r=>n(r)&&r.endsWith(e):n},D$=([t])=>{let e=t.length;return n=>n.length===e&&!n.startsWith(".")},U$=([t])=>{let e=t.length;return n=>n.length===e&&n!=="."&&n!==".."},w$=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",x$={win32:{sep:"\\"},posix:{sep:"/"}};k.sep=w$==="win32"?x$.win32.sep:x$.posix.sep;k.minimatch.sep=k.sep;k.GLOBSTAR=Symbol("globstar **");k.minimatch.GLOBSTAR=k.GLOBSTAR;var FEe="[^/]",VEe=FEe+"*?",qEe="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",$Ee="(?:(?!(?:\\/|^)\\.).)*?",YEe=(t,e={})=>n=>(0,k.minimatch)(n,t,e);k.filter=YEe;k.minimatch.filter=k.filter;var cr=(t,e={})=>Object.assign({},t,e),WEe=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return k.minimatch;let e=k.minimatch;return Object.assign((r,o,s={})=>e(r,o,cr(t,s)),{Minimatch:class extends e.Minimatch{constructor(o,s={}){super(o,cr(t,s))}static defaults(o){return e.defaults(cr(t,o)).Minimatch}},AST:class extends e.AST{constructor(o,s,i={}){super(o,s,cr(t,i))}static fromGlob(o,s={}){return e.AST.fromGlob(o,cr(t,s))}},unescape:(r,o={})=>e.unescape(r,cr(t,o)),escape:(r,o={})=>e.escape(r,cr(t,o)),filter:(r,o={})=>e.filter(r,cr(t,o)),defaults:r=>e.defaults(cr(t,r)),makeRe:(r,o={})=>e.makeRe(r,cr(t,o)),braceExpand:(r,o={})=>e.braceExpand(r,cr(t,o)),match:(r,o,s={})=>e.match(r,o,cr(t,s)),sep:e.sep,GLOBSTAR:k.GLOBSTAR})};k.defaults=WEe;k.minimatch.defaults=k.defaults;var zEe=(t,e={})=>((0,CT.assertValidPattern)(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:(0,gEe.expand)(t,{max:e.braceExpandMax}));k.braceExpand=zEe;k.minimatch.braceExpand=k.braceExpand;var KEe=(t,e={})=>new da(t,e).makeRe();k.makeRe=KEe;k.minimatch.makeRe=k.makeRe;var QEe=(t,e,n={})=>{let r=new da(e,n);return t=t.filter(o=>r.match(o)),r.options.nonull&&!t.length&&t.push(e),t};k.match=QEe;k.minimatch.match=k.match;var v$=/[?*]|[+@!]\(.*?\)|\[|\]/,XEe=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),da=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,n={}){(0,CT.assertValidPattern)(e),n=n||{},this.options=n,this.maxGlobstarRecursion=n.maxGlobstarRecursion??200,this.pattern=e,this.platform=n.platform||w$,this.isWindows=this.platform==="win32";let r="allowWindowsEscape";this.windowsPathsNoEscape=!!n.windowsPathsNoEscape||n[r]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!n.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!n.nonegate,this.comment=!1,this.empty=!1,this.partial=!!n.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=n.windowsNoMagicRoot!==void 0?n.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let n of e)if(typeof n!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,n=this.options;if(!n.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],n.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let r=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(r),this.debug(this.pattern,this.globParts);let o=this.globParts.map((s,i,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=s[0]===""&&s[1]===""&&(s[2]==="?"||!v$.test(s[2]))&&!v$.test(s[3]),l=/^[a-z]:/i.test(s[0]);if(c)return[...s.slice(0,4),...s.slice(4).map(p=>this.parse(p))];if(l)return[s[0],...s.slice(1).map(p=>this.parse(p))]}return s.map(c=>this.parse(c))});if(this.debug(this.pattern,o),this.set=o.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let i=this.set[s];i[0]===""&&i[1]===""&&this.globParts[s][2]==="?"&&typeof i[3]=="string"&&/^[a-z]:$/i.test(i[3])&&(i[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let r=0;r<e.length;r++)for(let o=0;o<e[r].length;o++)e[r][o]==="**"&&(e[r][o]="*");let{optimizationLevel:n=1}=this.options;return n>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):n>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(n=>{let r=-1;for(;(r=n.indexOf("**",r+1))!==-1;){let o=r;for(;n[o+1]==="**";)o++;o!==r&&n.splice(r,o-r)}return n})}levelOneOptimize(e){return e.map(n=>(n=n.reduce((r,o)=>{let s=r[r.length-1];return o==="**"&&s==="**"?r:o===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(r.pop(),r):(r.push(o),r)},[]),n.length===0?[""]:n))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let n=!1;do{if(n=!1,!this.preserveMultipleSlashes){for(let o=1;o<e.length-1;o++){let s=e[o];o===1&&s===""&&e[0]===""||(s==="."||s==="")&&(n=!0,e.splice(o,1),o--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(n=!0,e.pop())}let r=0;for(;(r=e.indexOf("..",r+1))!==-1;){let o=e[r-1];o&&o!=="."&&o!==".."&&o!=="**"&&(n=!0,e.splice(r-1,2),r-=2)}}while(n);return e.length===0?[""]:e}firstPhasePreProcess(e){let n=!1;do{n=!1;for(let r of e){let o=-1;for(;(o=r.indexOf("**",o+1))!==-1;){let i=o;for(;r[i+1]==="**";)i++;i>o&&r.splice(o+1,i-o);let a=r[o+1],c=r[o+2],l=r[o+3];if(a!==".."||!c||c==="."||c===".."||!l||l==="."||l==="..")continue;n=!0,r.splice(o,1);let p=r.slice(0);p[o]="**",e.push(p),o--}if(!this.preserveMultipleSlashes){for(let i=1;i<r.length-1;i++){let a=r[i];i===1&&a===""&&r[0]===""||(a==="."||a==="")&&(n=!0,r.splice(i,1),i--)}r[0]==="."&&r.length===2&&(r[1]==="."||r[1]==="")&&(n=!0,r.pop())}let s=0;for(;(s=r.indexOf("..",s+1))!==-1;){let i=r[s-1];if(i&&i!=="."&&i!==".."&&i!=="**"){n=!0;let c=s===1&&r[s+1]==="**"?["."]:[];r.splice(s-1,2,...c),r.length===0&&r.push(""),s-=2}}}}while(n);return e}secondPhasePreProcess(e){for(let n=0;n<e.length-1;n++)for(let r=n+1;r<e.length;r++){let o=this.partsMatch(e[n],e[r],!this.preserveMultipleSlashes);if(o){e[n]=[],e[r]=o;break}}return e.filter(n=>n.length)}partsMatch(e,n,r=!1){let o=0,s=0,i=[],a="";for(;o<e.length&&s<n.length;)if(e[o]===n[s])i.push(a==="b"?n[s]:e[o]),o++,s++;else if(r&&e[o]==="**"&&n[s]===e[o+1])i.push(e[o]),o++;else if(r&&n[s]==="**"&&e[o]===n[s+1])i.push(n[s]),s++;else if(e[o]==="*"&&n[s]&&(this.options.dot||!n[s].startsWith("."))&&n[s]!=="**"){if(a==="b")return!1;a="a",i.push(e[o]),o++,s++}else if(n[s]==="*"&&e[o]&&(this.options.dot||!e[o].startsWith("."))&&e[o]!=="**"){if(a==="a")return!1;a="b",i.push(n[s]),o++,s++}else return!1;return e.length===n.length&&i}parseNegate(){if(this.nonegate)return;let e=this.pattern,n=!1,r=0;for(let o=0;o<e.length&&e.charAt(o)==="!";o++)n=!n,r++;r&&(this.pattern=e.slice(r)),this.negate=n}matchOne(e,n,r=!1){let o=0,s=0;if(this.isWindows){let a=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),c=!a&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),l=typeof n[0]=="string"&&/^[a-z]:$/i.test(n[0]),p=!l&&n[0]===""&&n[1]===""&&n[2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3]),d=c?3:a?0:void 0,_=p?3:l?0:void 0;if(typeof d=="number"&&typeof _=="number"){let[f,m]=[e[d],n[_]];f.toLowerCase()===m.toLowerCase()&&(n[_]=f,s=_,o=d)}}let{optimizationLevel:i=1}=this.options;return i>=2&&(e=this.levelTwoFileOptimize(e)),n.includes(k.GLOBSTAR)?this.#n(e,n,r,o,s):this.#o(e,n,r,o,s)}#n(e,n,r,o,s){let i=n.indexOf(k.GLOBSTAR,s),a=n.lastIndexOf(k.GLOBSTAR),[c,l,p]=r?[n.slice(s,i),n.slice(i+1),[]]:[n.slice(s,i),n.slice(i+1,a),n.slice(a+1)];if(c.length){let R=e.slice(o,o+c.length);if(!this.#o(R,c,r,0,0))return!1;o+=c.length,s+=c.length}let d=0;if(p.length){if(p.length+o>e.length)return!1;let R=e.length-p.length;if(this.#o(e,p,r,R,0))d=p.length;else{if(e[e.length-1]!==""||o+p.length===e.length||(R--,!this.#o(e,p,r,R,0)))return!1;d=p.length+1}}if(!l.length){let R=!!d;for(let I=o;I<e.length-d;I++){let x=String(e[I]);if(R=!0,x==="."||x===".."||!this.options.dot&&x.startsWith("."))return!1}return r||R}let _=[[[],0]],f=_[0],m=0,h=[0];for(let R of l)R===k.GLOBSTAR?(h.push(m),f=[[],0],_.push(f)):(f[0].push(R),m++);let T=_.length-1,S=e.length-d;for(let R of _)R[1]=S-(h[T--]+R[0].length);return!!this.#r(e,_,o,0,r,0,!!d)}#r(e,n,r,o,s,i,a){let c=n[o];if(!c){for(let d=r;d<e.length;d++){a=!0;let _=e[d];if(_==="."||_===".."||!this.options.dot&&_.startsWith("."))return!1}return a}let[l,p]=c;for(;r<=p;){if(this.#o(e.slice(0,r+l.length),l,s,r,0)&&i<this.maxGlobstarRecursion){let f=this.#r(e,n,r+l.length,o+1,s,i+1,a);if(f!==!1)return f}let _=e[r];if(_==="."||_===".."||!this.options.dot&&_.startsWith("."))return!1;r++}return s||null}#o(e,n,r,o,s){let i,a,c,l;for(i=o,a=s,l=e.length,c=n.length;i<l&&a<c;i++,a++){this.debug("matchOne loop");let p=n[a],d=e[i];if(this.debug(n,p,d),p===!1||p===k.GLOBSTAR)return!1;let _;if(typeof p=="string"?(_=d===p,this.debug("string match",p,d,_)):(_=p.test(d),this.debug("pattern match",p,d,_)),!_)return!1}if(i===l&&a===c)return!0;if(i===l)return r;if(a===c)return i===l-1&&e[i]==="";throw new Error("wtf?")}braceExpand(){return(0,k.braceExpand)(this.pattern,this.options)}parse(e){(0,CT.assertValidPattern)(e);let n=this.options;if(e==="**")return k.GLOBSTAR;if(e==="")return"";let r,o=null;(r=e.match(DEe))?o=n.dot?wEe:UEe:(r=e.match(IEe))?o=(n.nocase?n.dot?CEe:bEe:n.dot?NEe:OEe)(r[1]):(r=e.match(kEe))?o=(n.nocase?n.dot?BEe:GEe:n.dot?jEe:HEe)(r):(r=e.match(PEe))?o=n.dot?xEe:MEe:(r=e.match(vEe))&&(o=LEe);let s=L$.AST.fromGlob(e,this.options).toMMPattern();return o&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:o}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let n=this.options,r=n.noglobstar?VEe:n.dot?qEe:$Ee,o=new Set(n.nocase?["i"]:[]),s=e.map(c=>{let l=c.map(d=>{if(d instanceof RegExp)for(let _ of d.flags.split(""))o.add(_);return typeof d=="string"?XEe(d):d===k.GLOBSTAR?k.GLOBSTAR:d._src});l.forEach((d,_)=>{let f=l[_+1],m=l[_-1];d!==k.GLOBSTAR||m===k.GLOBSTAR||(m===void 0?f!==void 0&&f!==k.GLOBSTAR?l[_+1]="(?:\\/|"+r+"\\/)?"+f:l[_]=r:f===void 0?l[_-1]=m+"(?:\\/|\\/"+r+")?":f!==k.GLOBSTAR&&(l[_-1]=m+"(?:\\/|\\/"+r+"\\/)"+f,l[_+1]=k.GLOBSTAR))});let p=l.filter(d=>d!==k.GLOBSTAR);if(this.partial&&p.length>=1){let d=[];for(let _=1;_<=p.length;_++)d.push(p.slice(0,_).join("/"));return"(?:"+d.join("|")+")"}return p.join("/")}).join("|"),[i,a]=e.length>1?["(?:",")"]:["",""];s="^"+i+s+a+"$",this.partial&&(s="^(?:\\/|"+i+s.slice(1,-1)+a+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...o].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,n=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&n)return!0;let r=this.options;this.isWindows&&(e=e.split("\\").join("/"));let o=this.slashSplit(e);this.debug(this.pattern,"split",o);let s=this.set;this.debug(this.pattern,"set",s);let i=o[o.length-1];if(!i)for(let a=o.length-2;!i&&a>=0;a--)i=o[a];for(let a=0;a<s.length;a++){let c=s[a],l=o;if(r.matchBase&&c.length===1&&(l=[i]),this.matchOne(l,c,n))return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}static defaults(e){return k.minimatch.defaults(e).Minimatch}};k.Minimatch=da;var JEe=hN();Object.defineProperty(k,"AST",{enumerable:!0,get:function(){return JEe.AST}});var ZEe=TN();Object.defineProperty(k,"escape",{enumerable:!0,get:function(){return ZEe.escape}});var eSe=RT();Object.defineProperty(k,"unescape",{enumerable:!0,get:function(){return eSe.unescape}});k.minimatch.AST=L$.AST;k.minimatch.Minimatch=da;k.minimatch.escape=AEe.escape;k.minimatch.unescape=REe.unescape});var q$=E((GKe,gN)=>{"use strict";var G$=U("node:diagnostics_channel"),{context:PT,trace:EN,SpanStatusCode:MT,propagation:SN,diag:tSe}=(b(),O(v)),{getRPCMetadata:nSe,RPCType:rSe}=Te(),{ATTR_HTTP_ROUTE:xT,ATTR_HTTP_RESPONSE_STATUS_CODE:B$,ATTR_HTTP_REQUEST_METHOD:oSe,ATTR_URL_PATH:sSe}=(le(),O(Ae)),{InstrumentationBase:iSe}=_$(),{version:aSe,name:j$}=f$(),cSe=">=4.0.0 <6",H$=["onRequest","preParsing","preValidation","preHandler","preSerialization","onSend","onResponse","onError"],Me={HOOK_NAME:"hook.name",FASTIFY_TYPE:"fastify.type",HOOK_CALLBACK_NAME:"hook.callback.name",ROOT:"fastify.root"},qs={ROUTE:"route-hook",INSTANCE:"hook",HANDLER:"request-handler"},qo="anonymous",$s=Symbol("fastify otel instance"),Ys=Symbol("fastify otel request spans"),od=Symbol("fastify otel request context"),F$=Symbol("fastify otel addhook original"),V$=Symbol("fastify otel setnotfound original"),sd=Symbol("fastify otel ignore path"),id=Symbol("fastify otel record exceptions"),vT=class extends iSe{logger=null;_requestHook=null;_lifecycleHook=null;constructor(e){if(super(j$,aSe,e),this.logger=tSe.createComponentLogger({namespace:j$}),this[sd]=null,this[id]=!0,e?.recordExceptions!=null){if(typeof e.recordExceptions!="boolean")throw new TypeError("recordExceptions must be a boolean");this[id]=e.recordExceptions}if(typeof e?.requestHook=="function"&&(this._requestHook=e.requestHook),typeof e?.lifecycleHook=="function"&&(this._lifecycleHook=e.lifecycleHook),e?.ignorePaths!=null||process.env.OTEL_FASTIFY_IGNORE_PATHS!=null){let n=e?.ignorePaths??process.env.OTEL_FASTIFY_IGNORE_PATHS;if((typeof n!="string"||n.length===0)&&typeof n!="function")throw new TypeError("ignorePaths must be a string or a function");let r=null;this[sd]=o=>typeof n=="function"?n(o):(r==null&&(r=k$().minimatch),r(o.url,n))}}enable(){return this._handleInitialization===void 0&&this.getConfig().registerOnInitialization&&(this._handleInitialization=e=>{this.plugin()(e.fastify,void 0,()=>{});let n=(r,o,s)=>{s()};n[Symbol.for("skip-override")]=!0,n[Symbol.for("fastify.display-name")]="@fastify/otel",e.fastify.register(n)},G$.subscribe("fastify.initialization",this._handleInitialization)),super.enable()}disable(){return this._handleInitialization&&(G$.unsubscribe("fastify.initialization",this._handleInitialization),this._handleInitialization=void 0),super.disable()}init(){return[]}plugin(){let e=this;return n[Symbol.for("skip-override")]=!0,n[Symbol.for("fastify.display-name")]="@fastify/otel",n[Symbol.for("plugin-meta")]={fastify:cSe,name:"@fastify/otel"},n;function n(r,o,s){r.decorate($s,e),r.decorate(F$,r.addHook),r.decorate(V$,r.setNotFoundHandler),r.decorateRequest("opentelemetry",function(){let f=this[od],m=this[Ys];return{enabled:this.routeOptions.config?.otel!==!1,span:m,tracer:e.tracer,context:f,inject:(h,T)=>SN.inject(f,h,T),extract:(h,T)=>SN.extract(f,h,T)}}),r.decorateRequest(Ys,null),r.decorateRequest(od,null),r.addHook("onRoute",function(f){if(e[sd]?.(f)===!0){e.logger.debug(`Ignoring route instrumentation ${f.method} ${f.url} because it matches the ignore path`);return}if(f.config?.otel===!1){e.logger.debug(`Ignoring route instrumentation ${f.method} ${f.url} because it is disabled`);return}for(let m of H$)if(f[m]!=null){let h=f[m];if(typeof h=="function")f[m]=d(h,m,{[Me.HOOK_NAME]:`${this.pluginName} - route -> ${m}`,[Me.FASTIFY_TYPE]:qs.ROUTE,[xT]:f.url,[Me.HOOK_CALLBACK_NAME]:h.name?.length>0?h.name:qo});else if(Array.isArray(h)){let T=[];for(let S of h)T.push(d(S,m,{[Me.HOOK_NAME]:`${this.pluginName} - route -> ${m}`,[Me.FASTIFY_TYPE]:qs.ROUTE,[xT]:f.url,[Me.HOOK_CALLBACK_NAME]:S.name?.length>0?S.name:qo}));f[m]=T}}f.onSend!=null?f.onSend=Array.isArray(f.onSend)?[...f.onSend,i]:[f.onSend,i]:f.onSend=i,f.onError!=null?f.onError=Array.isArray(f.onError)?[...f.onError,a]:[f.onError,a]:f.onError=a,f.handler=d(f.handler,"handler",{[Me.HOOK_NAME]:`${this.pluginName} - route-handler`,[Me.FASTIFY_TYPE]:qs.HANDLER,[xT]:f.url,[Me.HOOK_CALLBACK_NAME]:f.handler.name.length>0?f.handler.name:qo})}),r.addHook("onRequest",function(f,m,h){if(this[$s].isEnabled()===!1||f.routeOptions.config?.otel===!1)return h();if(this[$s][sd]?.({url:f.url,method:f.method})===!0)return this[$s].logger.debug(`Ignoring request ${f.method} ${f.url} because it matches the ignore path`),h();let T=PT.active();EN.getSpan(T)==null&&(T=SN.extract(T,f.headers));let S=nSe(T);f.routeOptions.url!=null&&S?.type===rSe.HTTP&&(S.route=f.routeOptions.url);let R={[Me.ROOT]:"@fastify/otel",[oSe]:f.method,[sSe]:f.url};f.routeOptions.url!=null&&(R[xT]=f.routeOptions.url);let I=this[$s].tracer.startSpan("request",{attributes:R},T);try{this[$s]._requestHook?.(I,f)}catch(x){this[$s].logger.error({err:x},"requestHook threw")}f[od]=EN.setSpan(T,I),f[Ys]=I,PT.with(f[od],()=>{h()})}),r.addHook("onResponse",function(f,m,h){let T=f[Ys];T!=null&&(T.setAttributes({[B$]:m.statusCode}),T.end()),f[Ys]=null,h()}),r.addHook=c,r.setNotFoundHandler=l,s();function i(_,f,m,h){let T=_[Ys];T!=null&&(f.statusCode>=500&&T.setStatus({code:MT.ERROR}),T.setAttributes({[B$]:f.statusCode}),T.end()),_[Ys]=null,h(null,m)}function a(_,f,m,h){let T=_[Ys];T!=null&&(T.setStatus({code:MT.ERROR,message:m.message}),e[id]!==!1&&T.recordException(m)),h()}function c(_,f){let m=this[F$];return H$.includes(_)?m.call(this,_,d(f,_,{[Me.HOOK_NAME]:`${this.pluginName} - ${_}`,[Me.FASTIFY_TYPE]:qs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:f.name?.length>0?f.name:qo})):m.call(this,_,f)}function l(_,f){let m=this[V$];typeof _=="function"?(f=d(_,"notFoundHandler",{[Me.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[Me.FASTIFY_TYPE]:qs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:_.name?.length>0?_.name:qo}),m.call(this,f)):(_.preValidation!=null&&(_.preValidation=d(_.preValidation,"notFoundHandler - preValidation",{[Me.HOOK_NAME]:`${this.pluginName} - not-found-handler - preValidation`,[Me.FASTIFY_TYPE]:qs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:_.preValidation.name?.length>0?_.preValidation.name:qo})),_.preHandler!=null&&(_.preHandler=d(_.preHandler,"notFoundHandler - preHandler",{[Me.HOOK_NAME]:`${this.pluginName} - not-found-handler - preHandler`,[Me.FASTIFY_TYPE]:qs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:_.preHandler.name?.length>0?_.preHandler.name:qo})),f=d(f,"notFoundHandler",{[Me.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[Me.FASTIFY_TYPE]:qs.INSTANCE,[Me.HOOK_CALLBACK_NAME]:f.name?.length>0?f.name:qo}),m.call(this,_,f))}function p(_){for(let f of _)if(f?.routeOptions&&f.url&&f.method)return f;return null}function d(_,f,m={}){return function(...T){let S=this[$s],R=p(T);if(R===null)return S.logger.debug(`Ignoring route instrumentation because ${f} was called without a Fastify request argument`),_.call(this,...T);if(S.isEnabled()===!1||R.routeOptions.config?.otel===!1)return S.logger.debug(`Ignoring route instrumentation ${R.routeOptions.method} ${R.routeOptions.url} because it is disabled`),_.call(this,...T);if(S[sd]?.({url:R.url,method:R.method})===!0)return S.logger.debug(`Ignoring route instrumentation ${R.routeOptions.method} ${R.routeOptions.url} because it matches the ignore path`),_.call(this,...T);let I=R[od]??PT.active(),x=_.name?.length>0?_.name:this.pluginName??qo,F=S.tracer.startSpan(`${f} - ${x}`,{attributes:m},I);if(S._lifecycleHook!=null)try{S._lifecycleHook(F,{hookName:f,request:R,handler:x})}catch(B){S.logger.error({err:B},"Execution of lifecycleHook failed")}return PT.with(EN.setSpan(I,F),function(){try{let B=_.call(this,...T);return typeof B?.then=="function"?B.then(se=>(F.end(),se),se=>(F.setStatus({code:MT.ERROR,message:se.message}),S[id]!==!1&&F.recordException(se),F.end(),Promise.reject(se))):(F.end(),B)}catch(B){throw F.setStatus({code:MT.ERROR,message:B.message}),S[id]!==!1&&F.recordException(B),F.end(),B}},this)}}}}};gN.exports=vT;gN.exports.FastifyOtelInstrumentation=vT});var yN=E(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.SpanNames=Dr.TokenKind=Dr.AllowedOperationTypes=void 0;var TSe;(function(t){t.QUERY="query",t.MUTATION="mutation",t.SUBSCRIPTION="subscription"})(TSe=Dr.AllowedOperationTypes||(Dr.AllowedOperationTypes={}));var ESe;(function(t){t.SOF="<SOF>",t.EOF="<EOF>",t.BANG="!",t.DOLLAR="$",t.AMP="&",t.PAREN_L="(",t.PAREN_R=")",t.SPREAD="...",t.COLON=":",t.EQUALS="=",t.AT="@",t.BRACKET_L="[",t.BRACKET_R="]",t.BRACE_L="{",t.PIPE="|",t.BRACE_R="}",t.NAME="Name",t.INT="Int",t.FLOAT="Float",t.STRING="String",t.BLOCK_STRING="BlockString",t.COMMENT="Comment"})(ESe=Dr.TokenKind||(Dr.TokenKind={}));var SSe;(function(t){t.EXECUTE="graphql.execute",t.PARSE="graphql.parse",t.RESOLVE="graphql.resolve",t.VALIDATE="graphql.validate",t.SCHEMA_VALIDATE="graphql.validateSchema",t.SCHEMA_PARSE="graphql.parseSchema"})(SSe=Dr.SpanNames||(Dr.SpanNames={}))});var IN=E(ld=>{"use strict";Object.defineProperty(ld,"__esModule",{value:!0});ld.AttributeNames=void 0;var gSe;(function(t){t.SOURCE="graphql.source",t.FIELD_NAME="graphql.field.name",t.FIELD_PATH="graphql.field.path",t.FIELD_TYPE="graphql.field.type",t.PARENT_NAME="graphql.parent.name",t.OPERATION_TYPE="graphql.operation.type",t.OPERATION_NAME="graphql.operation.name",t.VARIABLES="graphql.variables.",t.ERROR_VALIDATION_NAME="graphql.validation.error"})(gSe=ld.AttributeNames||(ld.AttributeNames={}))});var kT=E(Ru=>{"use strict";Object.defineProperty(Ru,"__esModule",{value:!0});Ru.OTEL_GRAPHQL_DATA_SYMBOL=Ru.OTEL_PATCHED_SYMBOL=void 0;Ru.OTEL_PATCHED_SYMBOL=Symbol.for("opentelemetry.patched");Ru.OTEL_GRAPHQL_DATA_SYMBOL=Symbol.for("opentelemetry.graphql_data")});var nY=E(GT=>{"use strict";Object.defineProperty(GT,"__esModule",{value:!0});GT.OPERATION_NOT_SUPPORTED=void 0;var o2e=kT();GT.OPERATION_NOT_SUPPORTED="Operation$operationName$not supported"});var hY=E(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.wrapFieldResolver=ht.wrapFields=ht.getSourceFromLocation=ht.getOperation=ht.endSpan=ht.addSpanSource=ht.addInputVariableAttributes=ht.isPromise=void 0;var yu=(b(),O(v)),Ws=yN(),fa=IN(),Yo=kT(),rY=Object.values(Ws.AllowedOperationTypes),ASe=t=>typeof t?.then=="function";ht.isPromise=ASe;var RSe=t=>typeof t=="object"&&t!==null;function ON(t,e,n){Array.isArray(n)?n.forEach((r,o)=>{ON(t,`${e}.${o}`,r)}):n instanceof Object?Object.entries(n).forEach(([r,o])=>{ON(t,`${e}.${r}`,o)}):t.setAttribute(`${fa.AttributeNames.VARIABLES}${String(e)}`,n)}function ySe(t,e){Object.entries(e).forEach(([n,r])=>{ON(t,n,r)})}ht.addInputVariableAttributes=ySe;function aY(t,e,n,r,o){let s=dY(e,n,r,o);t.setAttribute(fa.AttributeNames.SOURCE,s)}ht.addSpanSource=aY;function ISe(t,e,n,r,o){let s=cY(n,o);if(s)return{field:s,spanAdded:!1};let a=e().flatResolveSpans?lY(n):uY(n,o);return s={span:OSe(t,e,n,r,o,a)},CSe(n,o,s),{field:s,spanAdded:!0}}function OSe(t,e,n,r,o,s){let i={[fa.AttributeNames.FIELD_NAME]:r.fieldName,[fa.AttributeNames.FIELD_PATH]:o.join("."),[fa.AttributeNames.FIELD_TYPE]:r.returnType.toString(),[fa.AttributeNames.PARENT_NAME]:r.parentType.name},a=t.startSpan(`${Ws.SpanNames.RESOLVE} ${i[fa.AttributeNames.FIELD_PATH]}`,{attributes:i},s?yu.trace.setSpan(yu.context.active(),s):void 0),c=n[Yo.OTEL_GRAPHQL_DATA_SYMBOL].source,l=r.fieldNodes.find(p=>p.kind==="Field");return l&&aY(a,c.loc,e().allowValues,l.loc?.start,l.loc?.end),a}function NSe(t,e){e&&t.recordException(e),t.end()}ht.endSpan=NSe;function bSe(t,e){if(!(!t||!Array.isArray(t.definitions)))return e?t.definitions.filter(n=>rY.indexOf(n?.operation)!==-1).find(n=>e===n?.name?.value):t.definitions.find(n=>rY.indexOf(n?.operation)!==-1)}ht.getOperation=bSe;function CSe(t,e,n){return t[Yo.OTEL_GRAPHQL_DATA_SYMBOL].fields[e.join(".")]=n}function cY(t,e){return t[Yo.OTEL_GRAPHQL_DATA_SYMBOL].fields[e.join(".")]}function uY(t,e){for(let n=e.length-1;n>0;n--){let r=cY(t,e.slice(0,n));if(r)return r.span}return lY(t)}function lY(t){return t[Yo.OTEL_GRAPHQL_DATA_SYMBOL].span}function PSe(t,e){let n=[],r=e;for(;r;){let o=r.key;t&&typeof o=="number"&&(o="*"),n.push(String(o)),r=r.prev}return n.reverse()}function MSe(t){return pY(`
10
+ `,t)}function oY(t){return pY(" ",t)}function pY(t,e){let n="";for(let r=0;r<e;r++)n+=t;return n}var xSe=[Ws.TokenKind.FLOAT,Ws.TokenKind.STRING,Ws.TokenKind.INT,Ws.TokenKind.BLOCK_STRING];function dY(t,e=!1,n,r){let o="";if(t?.startToken){let s=typeof n=="number"?n:t.start,i=typeof r=="number"?r:t.end,a=t.startToken.next,c=1;for(;a;){if(a.start<s){a=a.next,c=a?.line;continue}if(a.end>i){a=a.next,c=a?.line;continue}let l=a.value||a.kind,p="";!e&&xSe.indexOf(a.kind)>=0&&(l="*"),a.kind===Ws.TokenKind.STRING&&(l=`"${l}"`),a.kind===Ws.TokenKind.EOF&&(l=""),a.line>c?(o+=MSe(a.line-c),c=a.line,p=oY(a.column-1)):a.line===a.prev?.line&&(p=oY(a.start-(a.prev?.end||0))),o+=p+l,a&&(a=a.next)}}return o}ht.getSourceFromLocation=dY;function _Y(t,e,n){if(!t||t[Yo.OTEL_PATCHED_SYMBOL])return;let r=t.getFields();t[Yo.OTEL_PATCHED_SYMBOL]=!0,Object.keys(r).forEach(o=>{let s=r[o];if(s&&(s.resolve&&(s.resolve=mY(e,n,s.resolve)),s.type)){let i=fY(s.type);for(let a of i)_Y(a,e,n)}})}ht.wrapFields=_Y;function fY(t){return"ofType"in t?fY(t.ofType):vSe(t)?t.getTypes():LSe(t)?[t]:[]}function vSe(t){return"getTypes"in t&&typeof t.getTypes=="function"}function LSe(t){return"getFields"in t&&typeof t.getFields=="function"}var sY=(t,e,n)=>{n&&(t.recordException(e),t.setStatus({code:yu.SpanStatusCode.ERROR,message:e.message}),t.end())},iY=(t,e)=>{e&&t.end()};function mY(t,e,n,r=!1){if(o[Yo.OTEL_PATCHED_SYMBOL]||typeof n!="function")return n;function o(s,i,a,c){if(!n)return;let l=e();if(l.ignoreTrivialResolveSpans&&r&&(RSe(s)||typeof s=="function")&&typeof s[c.fieldName]!="function")return n.call(this,s,i,a,c);if(!a[Yo.OTEL_GRAPHQL_DATA_SYMBOL])return n.call(this,s,i,a,c);let p=PSe(l.mergeItems,c&&c.path),d=p.filter(m=>typeof m=="string").length,_,f=!1;if(l.depth>=0&&l.depth<d)_=uY(a,p);else{let{field:m,spanAdded:h}=ISe(t,e,a,c,p);_=m.span,f=h}return yu.context.with(yu.trace.setSpan(yu.context.active(),_),()=>{try{let m=n.call(this,s,i,a,c);return(0,ht.isPromise)(m)?m.then(h=>(iY(_,f),h),h=>{throw sY(_,h,f),h}):(iY(_,f),m)}catch(m){throw sY(_,m,f),m}})}return o[Yo.OTEL_PATCHED_SYMBOL]=!0,o}ht.wrapFieldResolver=mY});var TY=E(Iu=>{"use strict";Object.defineProperty(Iu,"__esModule",{value:!0});Iu.PACKAGE_NAME=Iu.PACKAGE_VERSION=void 0;Iu.PACKAGE_VERSION="0.62.0";Iu.PACKAGE_NAME="@opentelemetry/instrumentation-graphql"});var gY=E(HT=>{"use strict";Object.defineProperty(HT,"__esModule",{value:!0});HT.GraphQLInstrumentation=void 0;var Wo=(b(),O(v)),ur=ne(),pd=yN(),BT=IN(),NN=kT(),DSe=nY(),Qt=hY(),EY=TY(),SY={mergeItems:!1,depth:-1,allowValues:!1,ignoreResolveSpans:!1},jT=[">=14.0.0 <17"],bN=class extends ur.InstrumentationBase{constructor(e={}){super(EY.PACKAGE_NAME,EY.PACKAGE_VERSION,{...SY,...e})}setConfig(e={}){super.setConfig({...SY,...e})}init(){let e=new ur.InstrumentationNodeModuleDefinition("graphql",jT);return e.files.push(this._addPatchingExecute()),e.files.push(this._addPatchingParser()),e.files.push(this._addPatchingValidate()),e}_addPatchingExecute(){return new ur.InstrumentationNodeModuleFile("graphql/execution/execute.js",jT,e=>((0,ur.isWrapped)(e.execute)&&this._unwrap(e,"execute"),this._wrap(e,"execute",this._patchExecute(e.defaultFieldResolver)),e),e=>{e&&this._unwrap(e,"execute")})}_addPatchingParser(){return new ur.InstrumentationNodeModuleFile("graphql/language/parser.js",jT,e=>((0,ur.isWrapped)(e.parse)&&this._unwrap(e,"parse"),this._wrap(e,"parse",this._patchParse()),e),e=>{e&&this._unwrap(e,"parse")})}_addPatchingValidate(){return new ur.InstrumentationNodeModuleFile("graphql/validation/validate.js",jT,e=>((0,ur.isWrapped)(e.validate)&&this._unwrap(e,"validate"),this._wrap(e,"validate",this._patchValidate()),e),e=>{e&&this._unwrap(e,"validate")})}_patchExecute(e){let n=this;return function(o){return function(){let i;if(arguments.length>=2){let l=arguments;i=n._wrapExecuteArgs(l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],e)}else{let l=arguments[0];i=n._wrapExecuteArgs(l.schema,l.document,l.rootValue,l.contextValue,l.variableValues,l.operationName,l.fieldResolver,l.typeResolver,e)}let a=(0,Qt.getOperation)(i.document,i.operationName),c=n._createExecuteSpan(a,i);return i.contextValue[NN.OTEL_GRAPHQL_DATA_SYMBOL]={source:i.document?i.document||i.document[NN.OTEL_GRAPHQL_DATA_SYMBOL]:void 0,span:c,fields:{}},Wo.context.with(Wo.trace.setSpan(Wo.context.active(),c),()=>(0,ur.safeExecuteInTheMiddle)(()=>o.apply(this,[i]),(l,p)=>{n._handleExecutionResult(c,l,p)}))}}}_handleExecutionResult(e,n,r){let o=this.getConfig();if(r===void 0||n){(0,Qt.endSpan)(e,n);return}if((0,Qt.isPromise)(r))r.then(s=>{if(typeof o.responseHook!="function"){(0,Qt.endSpan)(e);return}this._executeResponseHook(e,s)},s=>{(0,Qt.endSpan)(e,s)});else{if(typeof o.responseHook!="function"){(0,Qt.endSpan)(e);return}this._executeResponseHook(e,r)}}_executeResponseHook(e,n){let{responseHook:r}=this.getConfig();r&&(0,ur.safeExecuteInTheMiddle)(()=>{r(e,n)},o=>{o&&this._diag.error("Error running response hook",o),(0,Qt.endSpan)(e,void 0)},!0)}_patchParse(){let e=this;return function(r){return function(s,i){return e._parse(this,r,s,i)}}}_patchValidate(){let e=this;return function(r){return function(s,i,a,c,l){return e._validate(this,r,s,i,a,l,c)}}}_parse(e,n,r,o){let s=this.getConfig(),i=this.tracer.startSpan(pd.SpanNames.PARSE);return Wo.context.with(Wo.trace.setSpan(Wo.context.active(),i),()=>(0,ur.safeExecuteInTheMiddle)(()=>n.call(e,r,o),(a,c)=>{c&&((0,Qt.getOperation)(c)?c.loc&&(0,Qt.addSpanSource)(i,c.loc,s.allowValues):i.updateName(pd.SpanNames.SCHEMA_PARSE)),(0,Qt.endSpan)(i,a)}))}_validate(e,n,r,o,s,i,a){let c=this.tracer.startSpan(pd.SpanNames.VALIDATE,{});return Wo.context.with(Wo.trace.setSpan(Wo.context.active(),c),()=>(0,ur.safeExecuteInTheMiddle)(()=>n.call(e,r,o,s,a,i),(l,p)=>{o.loc||c.updateName(pd.SpanNames.SCHEMA_VALIDATE),p&&p.length&&c.recordException({name:BT.AttributeNames.ERROR_VALIDATION_NAME,message:JSON.stringify(p)}),(0,Qt.endSpan)(c,l)}))}_createExecuteSpan(e,n){let r=this.getConfig(),o=this.tracer.startSpan(pd.SpanNames.EXECUTE,{});if(e){let{operation:s,name:i}=e;o.setAttribute(BT.AttributeNames.OPERATION_TYPE,s);let a=i?.value;a?(o.setAttribute(BT.AttributeNames.OPERATION_NAME,a),o.updateName(`${s} ${a}`)):o.updateName(s)}else{let s=" ";n.operationName&&(s=` "${n.operationName}" `),s=DSe.OPERATION_NOT_SUPPORTED.replace("$operationName$",s),o.setAttribute(BT.AttributeNames.OPERATION_NAME,s)}return n.document?.loc&&(0,Qt.addSpanSource)(o,n.document.loc,r.allowValues),n.variableValues&&r.allowValues&&(0,Qt.addInputVariableAttributes)(o,n.variableValues),o}_wrapExecuteArgs(e,n,r,o,s,i,a,c,l){if(o||(o={}),o[NN.OTEL_GRAPHQL_DATA_SYMBOL]||this.getConfig().ignoreResolveSpans)return{schema:e,document:n,rootValue:r,contextValue:o,variableValues:s,operationName:i,fieldResolver:a,typeResolver:c};let p=a==null,d=a??l;return a=(0,Qt.wrapFieldResolver)(this.tracer,()=>this.getConfig(),d,p),e&&((0,Qt.wrapFields)(e.getQueryType(),this.tracer,()=>this.getConfig()),(0,Qt.wrapFields)(e.getMutationType(),this.tracer,()=>this.getConfig())),{schema:e,document:n,rootValue:r,contextValue:o,variableValues:s,operationName:i,fieldResolver:a,typeResolver:c}}};HT.GraphQLInstrumentation=bN});var AY=E(FT=>{"use strict";Object.defineProperty(FT,"__esModule",{value:!0});FT.GraphQLInstrumentation=void 0;var USe=gY();Object.defineProperty(FT,"GraphQLInstrumentation",{enumerable:!0,get:function(){return USe.GraphQLInstrumentation}})});var bY=E(VT=>{"use strict";Object.defineProperty(VT,"__esModule",{value:!0});VT.EVENT_LISTENERS_SET=void 0;VT.EVENT_LISTENERS_SET=Symbol("opentelemetry.instrumentation.kafkajs.eventListenersSet")});var CY=E(qT=>{"use strict";Object.defineProperty(qT,"__esModule",{value:!0});qT.bufferTextMapGetter=void 0;qT.bufferTextMapGetter={get(t,e){if(!t)return;let n=Object.keys(t);for(let r of n)if(r===e||r.toLowerCase()===e)return t[r]?.toString()},keys(t){return t?Object.keys(t):[]}}});var PY=E(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.METRIC_MESSAGING_PROCESS_DURATION=_e.METRIC_MESSAGING_CLIENT_SENT_MESSAGES=_e.METRIC_MESSAGING_CLIENT_OPERATION_DURATION=_e.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES=_e.MESSAGING_SYSTEM_VALUE_KAFKA=_e.MESSAGING_OPERATION_TYPE_VALUE_SEND=_e.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE=_e.MESSAGING_OPERATION_TYPE_VALUE_PROCESS=_e.ATTR_MESSAGING_SYSTEM=_e.ATTR_MESSAGING_OPERATION_TYPE=_e.ATTR_MESSAGING_OPERATION_NAME=_e.ATTR_MESSAGING_KAFKA_OFFSET=_e.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE=_e.ATTR_MESSAGING_KAFKA_MESSAGE_KEY=_e.ATTR_MESSAGING_DESTINATION_PARTITION_ID=_e.ATTR_MESSAGING_DESTINATION_NAME=_e.ATTR_MESSAGING_BATCH_MESSAGE_COUNT=void 0;_e.ATTR_MESSAGING_BATCH_MESSAGE_COUNT="messaging.batch.message_count";_e.ATTR_MESSAGING_DESTINATION_NAME="messaging.destination.name";_e.ATTR_MESSAGING_DESTINATION_PARTITION_ID="messaging.destination.partition.id";_e.ATTR_MESSAGING_KAFKA_MESSAGE_KEY="messaging.kafka.message.key";_e.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE="messaging.kafka.message.tombstone";_e.ATTR_MESSAGING_KAFKA_OFFSET="messaging.kafka.offset";_e.ATTR_MESSAGING_OPERATION_NAME="messaging.operation.name";_e.ATTR_MESSAGING_OPERATION_TYPE="messaging.operation.type";_e.ATTR_MESSAGING_SYSTEM="messaging.system";_e.MESSAGING_OPERATION_TYPE_VALUE_PROCESS="process";_e.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE="receive";_e.MESSAGING_OPERATION_TYPE_VALUE_SEND="send";_e.MESSAGING_SYSTEM_VALUE_KAFKA="kafka";_e.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES="messaging.client.consumed.messages";_e.METRIC_MESSAGING_CLIENT_OPERATION_DURATION="messaging.client.operation.duration";_e.METRIC_MESSAGING_CLIENT_SENT_MESSAGES="messaging.client.sent.messages";_e.METRIC_MESSAGING_PROCESS_DURATION="messaging.process.duration"});var MY=E(Ou=>{"use strict";Object.defineProperty(Ou,"__esModule",{value:!0});Ou.PACKAGE_NAME=Ou.PACKAGE_VERSION=void 0;Ou.PACKAGE_VERSION="0.23.0";Ou.PACKAGE_NAME="@opentelemetry/instrumentation-kafkajs"});var wY=E(YT=>{"use strict";Object.defineProperty(YT,"__esModule",{value:!0});YT.KafkaJsInstrumentation=void 0;var ye=(b(),O(v)),lr=ne(),Nu=(le(),O(Ae)),xY=bY(),vY=CY(),G=PY(),LY=MY();function $T(t,e,n){return r=>{t.add(e,{...n,...r?{[Nu.ATTR_ERROR_TYPE]:r}:{}})}}function DY(t,e,n){return r=>{t.record((Date.now()-e)/1e3,{...n,...r?{[Nu.ATTR_ERROR_TYPE]:r}:{}})}}var UY=[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10],CN=class extends lr.InstrumentationBase{constructor(e={}){super(LY.PACKAGE_NAME,LY.PACKAGE_VERSION,e)}_updateMetricInstruments(){this._clientDuration=this.meter.createHistogram(G.METRIC_MESSAGING_CLIENT_OPERATION_DURATION,{advice:{explicitBucketBoundaries:UY}}),this._sentMessages=this.meter.createCounter(G.METRIC_MESSAGING_CLIENT_SENT_MESSAGES),this._consumedMessages=this.meter.createCounter(G.METRIC_MESSAGING_CLIENT_CONSUMED_MESSAGES),this._processDuration=this.meter.createHistogram(G.METRIC_MESSAGING_PROCESS_DURATION,{advice:{explicitBucketBoundaries:UY}})}init(){let e=r=>{(0,lr.isWrapped)(r?.Kafka?.prototype.producer)&&this._unwrap(r.Kafka.prototype,"producer"),(0,lr.isWrapped)(r?.Kafka?.prototype.consumer)&&this._unwrap(r.Kafka.prototype,"consumer")};return new lr.InstrumentationNodeModuleDefinition("kafkajs",[">=0.3.0 <3"],r=>(e(r),this._wrap(r?.Kafka?.prototype,"producer",this._getProducerPatch()),this._wrap(r?.Kafka?.prototype,"consumer",this._getConsumerPatch()),r),e)}_getConsumerPatch(){let e=this;return n=>function(...o){let s=n.apply(this,o);return(0,lr.isWrapped)(s.run)&&e._unwrap(s,"run"),e._wrap(s,"run",e._getConsumerRunPatch()),e._setKafkaEventListeners(s),s}}_setKafkaEventListeners(e){e[xY.EVENT_LISTENERS_SET]||(e.events?.REQUEST&&e.on(e.events.REQUEST,this._recordClientDurationMetric.bind(this)),e[xY.EVENT_LISTENERS_SET]=!0)}_recordClientDurationMetric(e){let[n,r]=e.payload.broker.split(":");this._clientDuration.record(e.payload.duration/1e3,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:`${e.payload.apiName}`,[Nu.ATTR_SERVER_ADDRESS]:n,[Nu.ATTR_SERVER_PORT]:Number.parseInt(r,10)})}_getProducerPatch(){let e=this;return n=>function(...o){let s=n.apply(this,o);return(0,lr.isWrapped)(s.sendBatch)&&e._unwrap(s,"sendBatch"),e._wrap(s,"sendBatch",e._getSendBatchPatch()),(0,lr.isWrapped)(s.send)&&e._unwrap(s,"send"),e._wrap(s,"send",e._getSendPatch()),(0,lr.isWrapped)(s.transaction)&&e._unwrap(s,"transaction"),e._wrap(s,"transaction",e._getProducerTransactionPatch()),e._setKafkaEventListeners(s),s}}_getConsumerRunPatch(){let e=this;return n=>function(...o){let s=o[0];return s?.eachMessage&&((0,lr.isWrapped)(s.eachMessage)&&e._unwrap(s,"eachMessage"),e._wrap(s,"eachMessage",e._getConsumerEachMessagePatch())),s?.eachBatch&&((0,lr.isWrapped)(s.eachBatch)&&e._unwrap(s,"eachBatch"),e._wrap(s,"eachBatch",e._getConsumerEachBatchPatch())),n.call(this,s)}}_getConsumerEachMessagePatch(){let e=this;return n=>function(...o){let s=o[0],i=ye.propagation.extract(ye.ROOT_CONTEXT,s.message.headers,vY.bufferTextMapGetter),a=e._startConsumerSpan({topic:s.topic,message:s.message,operationType:G.MESSAGING_OPERATION_TYPE_VALUE_PROCESS,ctx:i,attributes:{[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.partition)}}),c=[DY(e._processDuration,Date.now(),{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"process",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.topic,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.partition)}),$T(e._consumedMessages,1,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"process",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.topic,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.partition)})],l=ye.context.with(ye.trace.setSpan(i,a),()=>n.apply(this,o));return e._endSpansOnPromise([a],c,l)}}_getConsumerEachBatchPatch(){return e=>{let n=this;return function(...o){let s=o[0],i=n._startConsumerSpan({topic:s.batch.topic,message:void 0,operationType:G.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,ctx:ye.ROOT_CONTEXT,attributes:{[G.ATTR_MESSAGING_BATCH_MESSAGE_COUNT]:s.batch.messages.length,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.batch.partition)}});return ye.context.with(ye.trace.setSpan(ye.context.active(),i),()=>{let a=Date.now(),c=[],l=[$T(n._consumedMessages,s.batch.messages.length,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"process",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.batch.topic,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.batch.partition)})];s.batch.messages.forEach(d=>{let _=ye.propagation.extract(ye.ROOT_CONTEXT,d.headers,vY.bufferTextMapGetter),f=ye.trace.getSpan(_)?.spanContext(),m;f&&(m={context:f}),c.push(n._startConsumerSpan({topic:s.batch.topic,message:d,operationType:G.MESSAGING_OPERATION_TYPE_VALUE_PROCESS,link:m,attributes:{[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.batch.partition)}})),l.push(DY(n._processDuration,a,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"process",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.batch.topic,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(s.batch.partition)}))});let p=e.apply(this,o);return c.unshift(i),n._endSpansOnPromise(c,l,p)})}}}_getProducerTransactionPatch(){let e=this;return n=>function(...o){let s=e.tracer.startSpan("transaction"),i=n.apply(this,o);return i.then(a=>{let c=a.send;a.send=function(...f){return ye.context.with(ye.trace.setSpan(ye.context.active(),s),()=>e._getSendPatch()(c).apply(this,f).catch(h=>{throw s.setStatus({code:ye.SpanStatusCode.ERROR,message:h?.message}),s.recordException(h),h}))};let l=a.sendBatch;a.sendBatch=function(...f){return ye.context.with(ye.trace.setSpan(ye.context.active(),s),()=>e._getSendBatchPatch()(l).apply(this,f).catch(h=>{throw s.setStatus({code:ye.SpanStatusCode.ERROR,message:h?.message}),s.recordException(h),h}))};let p=a.commit;a.commit=function(...f){let m=p.apply(this,f).then(()=>{s.setStatus({code:ye.SpanStatusCode.OK})});return e._endSpansOnPromise([s],[],m)};let d=a.abort;a.abort=function(...f){let m=d.apply(this,f);return e._endSpansOnPromise([s],[],m)}}).catch(a=>{s.setStatus({code:ye.SpanStatusCode.ERROR,message:a?.message}),s.recordException(a),s.end()}),i}}_getSendBatchPatch(){let e=this;return n=>function(...o){let i=o[0].topicMessages||[],a=[],c=[];i.forEach(p=>{p.messages.forEach(d=>{a.push(e._startProducerSpan(p.topic,d)),c.push($T(e._sentMessages,1,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"send",[G.ATTR_MESSAGING_DESTINATION_NAME]:p.topic,...d.partition!==void 0?{[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(d.partition)}:{}}))})});let l=n.apply(this,o);return e._endSpansOnPromise(a,c,l)}}_getSendPatch(){let e=this;return n=>function(...o){let s=o[0],i=s.messages.map(l=>e._startProducerSpan(s.topic,l)),a=s.messages.map(l=>$T(e._sentMessages,1,{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_OPERATION_NAME]:"send",[G.ATTR_MESSAGING_DESTINATION_NAME]:s.topic,...l.partition!==void 0?{[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:String(l.partition)}:{}})),c=n.apply(this,o);return e._endSpansOnPromise(i,a,c)}}_endSpansOnPromise(e,n,r){return Promise.resolve(r).then(o=>(n.forEach(s=>s()),o)).catch(o=>{let s,i=Nu.ERROR_TYPE_VALUE_OTHER;throw typeof o=="string"||o===void 0?s=o:typeof o=="object"&&Object.prototype.hasOwnProperty.call(o,"message")&&(s=o.message,i=o.constructor.name),n.forEach(a=>a(i)),e.forEach(a=>{a.setAttribute(Nu.ATTR_ERROR_TYPE,i),a.setStatus({code:ye.SpanStatusCode.ERROR,message:s})}),o}).finally(()=>{e.forEach(o=>o.end())})}_startConsumerSpan({topic:e,message:n,operationType:r,ctx:o,link:s,attributes:i}){let a=r===G.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE?"poll":r,c=this.tracer.startSpan(`${a} ${e}`,{kind:r===G.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE?ye.SpanKind.CLIENT:ye.SpanKind.CONSUMER,attributes:{...i,[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_DESTINATION_NAME]:e,[G.ATTR_MESSAGING_OPERATION_TYPE]:r,[G.ATTR_MESSAGING_OPERATION_NAME]:a,[G.ATTR_MESSAGING_KAFKA_MESSAGE_KEY]:n?.key?String(n.key):void 0,[G.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]:n?.key&&n.value===null?!0:void 0,[G.ATTR_MESSAGING_KAFKA_OFFSET]:n?.offset},links:s?[s]:[]},o),{consumerHook:l}=this.getConfig();return l&&n&&(0,lr.safeExecuteInTheMiddle)(()=>l(c,{topic:e,message:n}),p=>{p&&this._diag.error("consumerHook error",p)},!0),c}_startProducerSpan(e,n){let r=this.tracer.startSpan(`send ${e}`,{kind:ye.SpanKind.PRODUCER,attributes:{[G.ATTR_MESSAGING_SYSTEM]:G.MESSAGING_SYSTEM_VALUE_KAFKA,[G.ATTR_MESSAGING_DESTINATION_NAME]:e,[G.ATTR_MESSAGING_KAFKA_MESSAGE_KEY]:n.key?String(n.key):void 0,[G.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]:n.key&&n.value===null?!0:void 0,[G.ATTR_MESSAGING_DESTINATION_PARTITION_ID]:n.partition!==void 0?String(n.partition):void 0,[G.ATTR_MESSAGING_OPERATION_NAME]:"send",[G.ATTR_MESSAGING_OPERATION_TYPE]:G.MESSAGING_OPERATION_TYPE_VALUE_SEND}});n.headers=n.headers??{},ye.propagation.inject(ye.trace.setSpan(ye.context.active(),r),n.headers);let{producerHook:o}=this.getConfig();return o&&(0,lr.safeExecuteInTheMiddle)(()=>o(r,{topic:e,message:n}),s=>{s&&this._diag.error("producerHook error",s)},!0),r}};YT.KafkaJsInstrumentation=CN});var kY=E(WT=>{"use strict";Object.defineProperty(WT,"__esModule",{value:!0});WT.KafkaJsInstrumentation=void 0;var GSe=wY();Object.defineProperty(WT,"KafkaJsInstrumentation",{enumerable:!0,get:function(){return GSe.KafkaJsInstrumentation}})});var FY=E(bu=>{"use strict";Object.defineProperty(bu,"__esModule",{value:!0});bu.PACKAGE_NAME=bu.PACKAGE_VERSION=void 0;bu.PACKAGE_VERSION="0.58.0";bu.PACKAGE_NAME="@opentelemetry/instrumentation-lru-memoizer"});var YY=E(zT=>{"use strict";Object.defineProperty(zT,"__esModule",{value:!0});zT.LruMemoizerInstrumentation=void 0;var VY=(b(),O(v)),qY=ne(),$Y=FY(),PN=class extends qY.InstrumentationBase{constructor(e={}){super($Y.PACKAGE_NAME,$Y.PACKAGE_VERSION,e)}init(){return[new qY.InstrumentationNodeModuleDefinition("lru-memoizer",[">=1.3 <4"],e=>{let n=function(){let r=e.apply(this,arguments);return function(){let o=[...arguments],s=o.pop(),i=typeof s=="function"?VY.context.bind(VY.context.active(),s):s;return o.push(i),r.apply(this,o)}};return n.sync=e.sync,n},void 0)]}};zT.LruMemoizerInstrumentation=PN});var WY=E(KT=>{"use strict";Object.defineProperty(KT,"__esModule",{value:!0});KT.LruMemoizerInstrumentation=void 0;var jSe=YY();Object.defineProperty(KT,"LruMemoizerInstrumentation",{enumerable:!0,get:function(){return jSe.LruMemoizerInstrumentation}})});var JY=E(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.METRIC_DB_CLIENT_CONNECTIONS_USAGE=De.DB_SYSTEM_VALUE_MONGODB=De.DB_SYSTEM_NAME_VALUE_MONGODB=De.ATTR_NET_PEER_PORT=De.ATTR_NET_PEER_NAME=De.ATTR_DB_SYSTEM=De.ATTR_DB_STATEMENT=De.ATTR_DB_OPERATION=De.ATTR_DB_NAME=De.ATTR_DB_MONGODB_COLLECTION=De.ATTR_DB_CONNECTION_STRING=void 0;De.ATTR_DB_CONNECTION_STRING="db.connection_string";De.ATTR_DB_MONGODB_COLLECTION="db.mongodb.collection";De.ATTR_DB_NAME="db.name";De.ATTR_DB_OPERATION="db.operation";De.ATTR_DB_STATEMENT="db.statement";De.ATTR_DB_SYSTEM="db.system";De.ATTR_NET_PEER_NAME="net.peer.name";De.ATTR_NET_PEER_PORT="net.peer.port";De.DB_SYSTEM_NAME_VALUE_MONGODB="mongodb";De.DB_SYSTEM_VALUE_MONGODB="mongodb";De.METRIC_DB_CLIENT_CONNECTIONS_USAGE="db.client.connections.usage"});var ZY=E(dd=>{"use strict";Object.defineProperty(dd,"__esModule",{value:!0});dd.MongodbCommandType=void 0;var FSe;(function(t){t.CREATE_INDEXES="createIndexes",t.FIND_AND_MODIFY="findAndModify",t.IS_MASTER="isMaster",t.COUNT="count",t.AGGREGATE="aggregate",t.UNKNOWN="unknown"})(FSe=dd.MongodbCommandType||(dd.MongodbCommandType={}))});var eW=E(Cu=>{"use strict";Object.defineProperty(Cu,"__esModule",{value:!0});Cu.PACKAGE_NAME=Cu.PACKAGE_VERSION=void 0;Cu.PACKAGE_VERSION="0.67.0";Cu.PACKAGE_NAME="@opentelemetry/instrumentation-mongodb"});var rW=E(QT=>{"use strict";Object.defineProperty(QT,"__esModule",{value:!0});QT.MongoDBInstrumentation=void 0;var we=(b(),O(v)),fe=ne(),zo=(le(),O(Ae)),$n=JY(),ma=ZY(),tW=eW(),nW={requireParentSpan:!0},MN=class t extends fe.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(tW.PACKAGE_NAME,tW.PACKAGE_VERSION,{...nW,...e}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,fe.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,fe.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...nW,...e})}_updateMetricInstruments(){this._connectionsUsage=this.meter.createUpDownCounter($n.METRIC_DB_CLIENT_CONNECTIONS_USAGE,{description:"The number of connections that are currently in state described by the state attribute.",unit:"{connection}"})}_connCountAdd(e,n,r){this._connectionsUsage?.add(e,{"pool.name":n,state:r})}init(){let{v3PatchConnection:e,v3UnpatchConnection:n}=this._getV3ConnectionPatches(),{v4PatchConnect:r,v4UnpatchConnect:o}=this._getV4ConnectPatches(),{v4PatchConnectionCallback:s,v4PatchConnectionPromise:i,v4UnpatchConnection:a}=this._getV4ConnectionPatches(),{v4PatchConnectionPool:c,v4UnpatchConnectionPool:l}=this._getV4ConnectionPoolPatches(),{v4PatchSessions:p,v4UnpatchSessions:d}=this._getV4SessionsPatches();return[new fe.InstrumentationNodeModuleDefinition("mongodb",[">=3.3.0 <4"],void 0,void 0,[new fe.InstrumentationNodeModuleFile("mongodb/lib/core/wireprotocol/index.js",[">=3.3.0 <4"],e,n)]),new fe.InstrumentationNodeModuleDefinition("mongodb",[">=4.0.0 <8"],void 0,void 0,[new fe.InstrumentationNodeModuleFile("mongodb/lib/cmap/connection.js",[">=4.0.0 <6.4"],s,a),new fe.InstrumentationNodeModuleFile("mongodb/lib/cmap/connection.js",[">=6.4.0 <8"],i,a),new fe.InstrumentationNodeModuleFile("mongodb/lib/cmap/connection_pool.js",[">=4.0.0 <6.4"],c,l),new fe.InstrumentationNodeModuleFile("mongodb/lib/cmap/connect.js",[">=4.0.0 <8"],r,o),new fe.InstrumentationNodeModuleFile("mongodb/lib/sessions.js",[">=4.0.0 <8"],p,d)])]}_getV3ConnectionPatches(){return{v3PatchConnection:e=>((0,fe.isWrapped)(e.insert)&&this._unwrap(e,"insert"),this._wrap(e,"insert",this._getV3PatchOperation("insert")),(0,fe.isWrapped)(e.remove)&&this._unwrap(e,"remove"),this._wrap(e,"remove",this._getV3PatchOperation("remove")),(0,fe.isWrapped)(e.update)&&this._unwrap(e,"update"),this._wrap(e,"update",this._getV3PatchOperation("update")),(0,fe.isWrapped)(e.command)&&this._unwrap(e,"command"),this._wrap(e,"command",this._getV3PatchCommand()),(0,fe.isWrapped)(e.query)&&this._unwrap(e,"query"),this._wrap(e,"query",this._getV3PatchFind()),(0,fe.isWrapped)(e.getMore)&&this._unwrap(e,"getMore"),this._wrap(e,"getMore",this._getV3PatchCursor()),e),v3UnpatchConnection:e=>{e!==void 0&&(this._unwrap(e,"insert"),this._unwrap(e,"remove"),this._unwrap(e,"update"),this._unwrap(e,"command"),this._unwrap(e,"query"),this._unwrap(e,"getMore"))}}}_getV4SessionsPatches(){return{v4PatchSessions:e=>((0,fe.isWrapped)(e.acquire)&&this._unwrap(e,"acquire"),this._wrap(e.ServerSessionPool.prototype,"acquire",this._getV4AcquireCommand()),(0,fe.isWrapped)(e.release)&&this._unwrap(e,"release"),this._wrap(e.ServerSessionPool.prototype,"release",this._getV4ReleaseCommand()),e),v4UnpatchSessions:e=>{e!==void 0&&((0,fe.isWrapped)(e.acquire)&&this._unwrap(e,"acquire"),(0,fe.isWrapped)(e.release)&&this._unwrap(e,"release"))}}}_getV4AcquireCommand(){let e=this;return n=>function(){let o=this.sessions.length,s=n.call(this),i=this.sessions.length;return o===i?e._connCountAdd(1,e._poolName,"used"):o-1===i&&(e._connCountAdd(-1,e._poolName,"idle"),e._connCountAdd(1,e._poolName,"used")),s}}_getV4ReleaseCommand(){let e=this;return n=>function(o){let s=n.call(this,o);return e._connCountAdd(-1,e._poolName,"used"),e._connCountAdd(1,e._poolName,"idle"),s}}_getV4ConnectionPoolPatches(){return{v4PatchConnectionPool:e=>{let n=e.ConnectionPool.prototype;return(0,fe.isWrapped)(n.checkOut)&&this._unwrap(n,"checkOut"),this._wrap(n,"checkOut",this._getV4ConnectionPoolCheckOut()),e},v4UnpatchConnectionPool:e=>{e!==void 0&&this._unwrap(e.ConnectionPool.prototype,"checkOut")}}}_getV4ConnectPatches(){return{v4PatchConnect:e=>((0,fe.isWrapped)(e.connect)&&this._unwrap(e,"connect"),this._wrap(e,"connect",this._getV4ConnectCommand()),e),v4UnpatchConnect:e=>{e!==void 0&&this._unwrap(e,"connect")}}}_getV4ConnectionPoolCheckOut(){return e=>function(r){let o=we.context.bind(we.context.active(),r);return e.call(this,o)}}_getV4ConnectCommand(){let e=this;return n=>function(o,s){if(n.length===1){let a=n.call(this,o);return a&&typeof a.then=="function"&&a.then(()=>e.setPoolName(o),()=>{}),a}let i=function(a,c){if(a||!c){s(a,c);return}e.setPoolName(o),s(a,c)};return n.call(this,o,i)}}_getV4ConnectionPatches(){return{v4PatchConnectionCallback:e=>((0,fe.isWrapped)(e.Connection.prototype.command)&&this._unwrap(e.Connection.prototype,"command"),this._wrap(e.Connection.prototype,"command",this._getV4PatchCommandCallback()),e),v4PatchConnectionPromise:e=>((0,fe.isWrapped)(e.Connection.prototype.command)&&this._unwrap(e.Connection.prototype,"command"),this._wrap(e.Connection.prototype,"command",this._getV4PatchCommandPromise()),e),v4UnpatchConnection:e=>{e!==void 0&&this._unwrap(e.Connection.prototype,"command")}}}_getV3PatchOperation(e){let n=this;return r=>function(s,i,a,c,l){let p=we.trace.getSpan(we.context.active()),d=n._checkSkipInstrumentation(p),_=typeof c=="function"?c:l;if(d||typeof _!="function"||typeof a!="object")return typeof c=="function"?r.call(this,s,i,a,c):r.call(this,s,i,a,c,l);let f=n._getV3SpanAttributes(i,s,a[0],e),m=n._spanNameFromAttrs(f),h=n.tracer.startSpan(m,{kind:we.SpanKind.CLIENT,attributes:f}),T=n._patchEnd(h,_);return typeof c=="function"?r.call(this,s,i,a,T):r.call(this,s,i,a,c,T)}}_getV3PatchCommand(){let e=this;return n=>function(o,s,i,a,c){let l=we.trace.getSpan(we.context.active()),p=e._checkSkipInstrumentation(l),d=typeof a=="function"?a:c;if(p||typeof d!="function"||typeof i!="object")return typeof a=="function"?n.call(this,o,s,i,a):n.call(this,o,s,i,a,c);let _=t._getCommandType(i),f=_===ma.MongodbCommandType.UNKNOWN?void 0:_,m=e._getV3SpanAttributes(s,o,i,f),h=e._spanNameFromAttrs(m),T=e.tracer.startSpan(h,{kind:we.SpanKind.CLIENT,attributes:m}),S=e._patchEnd(T,d);return typeof a=="function"?n.call(this,o,s,i,S):n.call(this,o,s,i,a,S)}}_getV4PatchCommandCallback(){let e=this;return n=>function(o,s,i,a){let c=we.trace.getSpan(we.context.active()),l=e._checkSkipInstrumentation(c),p=a,d=Object.keys(s)[0];if(typeof s!="object"||s.ismaster||s.hello)return n.call(this,o,s,i,a);let _;if(!l){let m=e._getV4SpanAttributes(this,o,s,d),h=e._spanNameFromAttrs(m);_=e.tracer.startSpan(h,{kind:we.SpanKind.CLIENT,attributes:m})}let f=e._patchEnd(_,p,this.id,d);return n.call(this,o,s,i,f)}}_getV4PatchCommandPromise(){let e=this;return n=>function(...o){let[s,i]=o,a=we.trace.getSpan(we.context.active()),c=e._checkSkipInstrumentation(a),l=Object.keys(i)[0],p=()=>{};if(typeof i!="object"||i.ismaster||i.hello)return n.apply(this,o);let d;if(!c){let m=e._getV4SpanAttributes(this,s,i,l),h=e._spanNameFromAttrs(m);d=e.tracer.startSpan(h,{kind:we.SpanKind.CLIENT,attributes:m})}let _=e._patchEnd(d,p,this.id,l),f=n.apply(this,o);return f.then(m=>_(null,m),m=>_(m)),f}}_getV3PatchFind(){let e=this;return n=>function(o,s,i,a,c,l){let p=we.trace.getSpan(we.context.active()),d=e._checkSkipInstrumentation(p),_=typeof c=="function"?c:l;if(d||typeof _!="function"||typeof i!="object")return typeof c=="function"?n.call(this,o,s,i,a,c):n.call(this,o,s,i,a,c,l);let f=e._getV3SpanAttributes(s,o,i,"find"),m=e._spanNameFromAttrs(f),h=e.tracer.startSpan(m,{kind:we.SpanKind.CLIENT,attributes:f}),T=e._patchEnd(h,_);return typeof c=="function"?n.call(this,o,s,i,a,T):n.call(this,o,s,i,a,c,T)}}_getV3PatchCursor(){let e=this;return n=>function(o,s,i,a,c,l){let p=we.trace.getSpan(we.context.active()),d=e._checkSkipInstrumentation(p),_=typeof c=="function"?c:l;if(d||typeof _!="function")return typeof c=="function"?n.call(this,o,s,i,a,c):n.call(this,o,s,i,a,c,l);let f=e._getV3SpanAttributes(s,o,i.cmd,"getMore"),m=e._spanNameFromAttrs(f),h=e.tracer.startSpan(m,{kind:we.SpanKind.CLIENT,attributes:f}),T=e._patchEnd(h,_);return typeof c=="function"?n.call(this,o,s,i,a,T):n.call(this,o,s,i,a,c,T)}}static _getCommandType(e){return e.createIndexes!==void 0?ma.MongodbCommandType.CREATE_INDEXES:e.findandmodify!==void 0?ma.MongodbCommandType.FIND_AND_MODIFY:e.ismaster!==void 0?ma.MongodbCommandType.IS_MASTER:e.count!==void 0?ma.MongodbCommandType.COUNT:e.aggregate!==void 0?ma.MongodbCommandType.AGGREGATE:ma.MongodbCommandType.UNKNOWN}_getV4SpanAttributes(e,n,r,o){let s,i;if(e){let c=typeof e.address=="string"?e.address.split(":"):"";c.length===2&&(s=c[0],i=c[1])}let a;return r?.documents&&r.documents[0]?a=r.documents[0]:r?.cursors?a=r.cursors:a=r,this._getSpanAttributes(n.db,n.collection,s,i,a,o)}_getV3SpanAttributes(e,n,r,o){let s,i;if(n&&n.s&&(s=n.s.options?.host??n.s.host,i=(n.s.options?.port??n.s.port)?.toString(),s==null||i==null)){let p=n.description?.address;if(p){let d=p.split(":");s=d[0],i=d[1]}}let[a,c]=e.toString().split("."),l=r?.query??r?.q??r;return this._getSpanAttributes(a,c,s,i,l,o)}_getSpanAttributes(e,n,r,o,s,i){let a={};if(this._dbSemconvStability&fe.SemconvStability.OLD&&(a[$n.ATTR_DB_SYSTEM]=$n.DB_SYSTEM_VALUE_MONGODB,a[$n.ATTR_DB_NAME]=e,a[$n.ATTR_DB_MONGODB_COLLECTION]=n,a[$n.ATTR_DB_OPERATION]=i,a[$n.ATTR_DB_CONNECTION_STRING]=`mongodb://${r}:${o}/${e}`),this._dbSemconvStability&fe.SemconvStability.STABLE&&(a[zo.ATTR_DB_SYSTEM_NAME]=$n.DB_SYSTEM_NAME_VALUE_MONGODB,a[zo.ATTR_DB_NAMESPACE]=e,a[zo.ATTR_DB_OPERATION_NAME]=i,a[zo.ATTR_DB_COLLECTION_NAME]=n),r&&o){this._netSemconvStability&fe.SemconvStability.OLD&&(a[$n.ATTR_NET_PEER_NAME]=r),this._netSemconvStability&fe.SemconvStability.STABLE&&(a[zo.ATTR_SERVER_ADDRESS]=r);let c=parseInt(o,10);isNaN(c)||(this._netSemconvStability&fe.SemconvStability.OLD&&(a[$n.ATTR_NET_PEER_PORT]=c),this._netSemconvStability&fe.SemconvStability.STABLE&&(a[zo.ATTR_SERVER_PORT]=c))}if(s){let{dbStatementSerializer:c}=this.getConfig(),l=typeof c=="function"?c:this._defaultDbStatementSerializer.bind(this);(0,fe.safeExecuteInTheMiddle)(()=>{let p=l(s);this._dbSemconvStability&fe.SemconvStability.OLD&&(a[$n.ATTR_DB_STATEMENT]=p),this._dbSemconvStability&fe.SemconvStability.STABLE&&(a[zo.ATTR_DB_QUERY_TEXT]=p)},p=>{p&&this._diag.error("Error running dbStatementSerializer hook",p)},!0)}return a}_spanNameFromAttrs(e){let n;return this._dbSemconvStability&fe.SemconvStability.STABLE?n=[e[zo.ATTR_DB_OPERATION_NAME],e[zo.ATTR_DB_COLLECTION_NAME]].filter(r=>r).join(" ")||$n.DB_SYSTEM_NAME_VALUE_MONGODB:n=`mongodb.${e[$n.ATTR_DB_OPERATION]||"command"}`,n}_getDefaultDbStatementReplacer(){let e=new WeakSet;return(n,r)=>typeof r!="object"||!r?"?":e.has(r)?"[Circular]":(e.add(r),r)}_defaultDbStatementSerializer(e){let{enhancedDatabaseReporting:n}=this.getConfig();return n?JSON.stringify(e):JSON.stringify(e,this._getDefaultDbStatementReplacer())}_handleExecutionResult(e,n){let{responseHook:r}=this.getConfig();typeof r=="function"&&(0,fe.safeExecuteInTheMiddle)(()=>{r(e,{data:n})},o=>{o&&this._diag.error("Error running response hook",o)},!0)}_patchEnd(e,n,r,o){let s=we.context.active(),i=this,a=!1;return function(...l){if(!a){a=!0;let p=l[0];if(e){if(p instanceof Error)e.setStatus({code:we.SpanStatusCode.ERROR,message:p.message});else{let d=l[1];i._handleExecutionResult(e,d)}e.end()}o==="endSessions"&&i._connCountAdd(-1,i._poolName,"idle")}return we.context.with(s,()=>n.apply(this,l))}}setPoolName(e){let n=e.hostAddress?.host,r=e.hostAddress?.port,o=e.dbName,s=`mongodb://${n}:${r}/${o}`;this._poolName=s}_checkSkipInstrumentation(e){return this.getConfig().requireParentSpan===!0&&e===void 0}};QT.MongoDBInstrumentation=MN});var oW=E(_d=>{"use strict";Object.defineProperty(_d,"__esModule",{value:!0});_d.MongodbCommandType=void 0;var VSe;(function(t){t.CREATE_INDEXES="createIndexes",t.FIND_AND_MODIFY="findAndModify",t.IS_MASTER="isMaster",t.COUNT="count",t.UNKNOWN="unknown"})(VSe=_d.MongodbCommandType||(_d.MongodbCommandType={}))});var sW=E(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:!0});Pu.MongodbCommandType=Pu.MongoDBInstrumentation=void 0;var qSe=rW();Object.defineProperty(Pu,"MongoDBInstrumentation",{enumerable:!0,get:function(){return qSe.MongoDBInstrumentation}});var $Se=oW();Object.defineProperty(Pu,"MongodbCommandType",{enumerable:!0,get:function(){return $Se.MongodbCommandType}})});var vN=E(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.DB_SYSTEM_NAME_VALUE_MONGODB=at.ATTR_NET_PEER_PORT=at.ATTR_NET_PEER_NAME=at.ATTR_DB_USER=at.ATTR_DB_SYSTEM=at.ATTR_DB_STATEMENT=at.ATTR_DB_OPERATION=at.ATTR_DB_NAME=at.ATTR_DB_MONGODB_COLLECTION=void 0;at.ATTR_DB_MONGODB_COLLECTION="db.mongodb.collection";at.ATTR_DB_NAME="db.name";at.ATTR_DB_OPERATION="db.operation";at.ATTR_DB_STATEMENT="db.statement";at.ATTR_DB_SYSTEM="db.system";at.ATTR_DB_USER="db.user";at.ATTR_NET_PEER_NAME="net.peer.name";at.ATTR_NET_PEER_PORT="net.peer.port";at.DB_SYSTEM_NAME_VALUE_MONGODB="mongodb"});var dW=E(zs=>{"use strict";Object.defineProperty(zs,"__esModule",{value:!0});zs.handleCallbackResponse=zs.handlePromiseResponse=zs.getAttributesFromCollection=void 0;var lW=(b(),O(v)),md=ne(),fd=vN(),XT=(le(),O(Ae));function XSe(t,e,n){let r={};return e&md.SemconvStability.OLD&&(r[fd.ATTR_DB_MONGODB_COLLECTION]=t.name,r[fd.ATTR_DB_NAME]=t.conn.name,r[fd.ATTR_DB_USER]=t.conn.user),e&md.SemconvStability.STABLE&&(r[XT.ATTR_DB_COLLECTION_NAME]=t.name,r[XT.ATTR_DB_NAMESPACE]=t.conn.name),n&md.SemconvStability.OLD&&(r[fd.ATTR_NET_PEER_NAME]=t.conn.host,r[fd.ATTR_NET_PEER_PORT]=t.conn.port),n&md.SemconvStability.STABLE&&(r[XT.ATTR_SERVER_ADDRESS]=t.conn.host,r[XT.ATTR_SERVER_PORT]=t.conn.port),r}zs.getAttributesFromCollection=XSe;function pW(t,e={}){t.recordException(e),t.setStatus({code:lW.SpanStatusCode.ERROR,message:`${e.message} ${e.code?`
11
+ Mongoose Error Code: ${e.code}`:""}`})}function LN(t,e,n,r=void 0){n&&(0,md.safeExecuteInTheMiddle)(()=>n(t,{moduleVersion:r,response:e}),o=>{o&&lW.diag.error("mongoose instrumentation: responseHook error",o)},!0)}function JSe(t,e,n,r=void 0){return t instanceof Promise?t.then(o=>(LN(e,o,n,r),o)).catch(o=>{throw pW(e,o),o}).finally(()=>e.end()):(LN(e,t,n,r),e.end(),t)}zs.handlePromiseResponse=JSe;function ZSe(t,e,n,r,o,s,i=void 0){let a=0;return o.length===2?a=1:o.length===3&&(a=2),o[a]=(c,l)=>(c?pW(r,c):LN(r,l,s,i),r.end(),t(c,l)),e.apply(n,o)}zs.handleCallbackResponse=ZSe});var _W=E(Mu=>{"use strict";Object.defineProperty(Mu,"__esModule",{value:!0});Mu.PACKAGE_NAME=Mu.PACKAGE_VERSION=void 0;Mu.PACKAGE_VERSION="0.60.0";Mu.PACKAGE_NAME="@opentelemetry/instrumentation-mongoose"});var EW=E(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.MongooseInstrumentation=Cn._ALREADY_INSTRUMENTED=Cn._STORED_PARENT_SPAN=void 0;var Tt=(b(),O(v)),ege=Te(),DN=dW(),jt=ne(),fW=_W(),Ks=vN(),ha=(le(),O(Ae)),JT=["deleteOne","deleteMany","find","findOne","estimatedDocumentCount","countDocuments","distinct","where","$where","findOneAndUpdate","findOneAndDelete","findOneAndReplace"],tge=["remove","count","findOneAndRemove",...JT],nge=["count","findOneAndRemove",...JT],rge=[...JT];function mW(t){return t?t.startsWith("6.")||t.startsWith("5.")?tge:t.startsWith("7.")?nge:rge:JT}function hW(t){return t&&(t.startsWith("5.")||t.startsWith("6."))||!1}function TW(t){return!t||!t.startsWith("8.")?!1:parseInt(t.split(".")[1],10)>=21}Cn._STORED_PARENT_SPAN=Symbol("stored-parent-span");Cn._ALREADY_INSTRUMENTED=Symbol("already-instrumented");var UN=class extends jt.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(fW.PACKAGE_NAME,fW.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,jt.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,jt.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return new jt.InstrumentationNodeModuleDefinition("mongoose",[">=5.9.7 <10"],this.patch.bind(this),this.unpatch.bind(this))}patch(e,n){let r=e[Symbol.toStringTag]==="Module"?e.default:e;return this._wrap(r.Model.prototype,"save",this.patchOnModelMethods("save",n)),r.Model.prototype.$save=r.Model.prototype.save,hW(n)&&this._wrap(r.Model.prototype,"remove",this.patchOnModelMethods("remove",n)),TW(n)&&(this._wrap(r.Model.prototype,"updateOne",this._patchDocumentUpdateMethods("updateOne",n)),this._wrap(r.Model.prototype,"deleteOne",this._patchDocumentUpdateMethods("deleteOne",n))),this._wrap(r.Query.prototype,"exec",this.patchQueryExec(n)),this._wrap(r.Aggregate.prototype,"exec",this.patchAggregateExec(n)),mW(n).forEach(s=>{this._wrap(r.Query.prototype,s,this.patchAndCaptureSpanContext(s))}),this._wrap(r.Model,"aggregate",this.patchModelAggregate()),this._wrap(r.Model,"insertMany",this.patchModelStatic("insertMany",n)),this._wrap(r.Model,"bulkWrite",this.patchModelStatic("bulkWrite",n)),r}unpatch(e,n){let r=e[Symbol.toStringTag]==="Module"?e.default:e,o=mW(n);this._unwrap(r.Model.prototype,"save"),r.Model.prototype.$save=r.Model.prototype.save,hW(n)&&this._unwrap(r.Model.prototype,"remove"),TW(n)&&(this._unwrap(r.Model.prototype,"updateOne"),this._unwrap(r.Model.prototype,"deleteOne")),this._unwrap(r.Query.prototype,"exec"),this._unwrap(r.Aggregate.prototype,"exec"),o.forEach(s=>{this._unwrap(r.Query.prototype,s)}),this._unwrap(r.Model,"aggregate"),this._unwrap(r.Model,"insertMany"),this._unwrap(r.Model,"bulkWrite")}patchAggregateExec(e){let n=this;return r=>function(s){if(n.getConfig().requireParentSpan&&Tt.trace.getSpan(Tt.context.active())===void 0)return r.apply(this,arguments);let i=this[Cn._STORED_PARENT_SPAN],a={},{dbStatementSerializer:c}=n.getConfig();if(c){let p=c("aggregate",{options:this.options,aggregatePipeline:this._pipeline});n._dbSemconvStability&jt.SemconvStability.OLD&&(a[Ks.ATTR_DB_STATEMENT]=p),n._dbSemconvStability&jt.SemconvStability.STABLE&&(a[ha.ATTR_DB_QUERY_TEXT]=p)}let l=n._startSpan(this._model.collection,this._model?.modelName,"aggregate",a,i);return n._handleResponse(l,r,this,arguments,s,e)}}patchQueryExec(e){let n=this;return r=>function(s){if(this[Cn._ALREADY_INSTRUMENTED])return r.apply(this,arguments);if(n.getConfig().requireParentSpan&&Tt.trace.getSpan(Tt.context.active())===void 0)return r.apply(this,arguments);let i=this[Cn._STORED_PARENT_SPAN],a={},{dbStatementSerializer:c}=n.getConfig();if(c){let p=c(this.op,{condition:this.getFilter?.()??this._conditions,updates:this._update,options:this.getOptions?.()??this.options,fields:this._fields});n._dbSemconvStability&jt.SemconvStability.OLD&&(a[Ks.ATTR_DB_STATEMENT]=p),n._dbSemconvStability&jt.SemconvStability.STABLE&&(a[ha.ATTR_DB_QUERY_TEXT]=p)}let l=n._startSpan(this.mongooseCollection,this.model.modelName,this.op,a,i);return n._handleResponse(l,r,this,arguments,s,e)}}patchOnModelMethods(e,n){let r=this;return o=>function(i,a){if(r.getConfig().requireParentSpan&&Tt.trace.getSpan(Tt.context.active())===void 0)return o.apply(this,arguments);let c={document:this};i&&!(i instanceof Function)&&(c.options=i);let l={},{dbStatementSerializer:p}=r.getConfig();if(p){let _=p(e,c);r._dbSemconvStability&jt.SemconvStability.OLD&&(l[Ks.ATTR_DB_STATEMENT]=_),r._dbSemconvStability&jt.SemconvStability.STABLE&&(l[ha.ATTR_DB_QUERY_TEXT]=_)}let d=r._startSpan(this.constructor.collection,this.constructor.modelName,e,l);return i instanceof Function&&(a=i,i=void 0),r._handleResponse(d,o,this,arguments,a,n)}}_patchDocumentUpdateMethods(e,n){let r=this;return o=>function(i,a,c){if(r.getConfig().requireParentSpan&&Tt.trace.getSpan(Tt.context.active())===void 0)return o.apply(this,arguments);let l=c,p=i,d=a;typeof i=="function"?(l=i,p=void 0,d=void 0):typeof a=="function"&&(l=a,d=void 0);let _={},f=r.getConfig().dbStatementSerializer;if(f){let T=f(e,{condition:{_id:this._id},updates:p,options:d});r._dbSemconvStability&jt.SemconvStability.OLD&&(_[Ks.ATTR_DB_STATEMENT]=T),r._dbSemconvStability&jt.SemconvStability.STABLE&&(_[ha.ATTR_DB_QUERY_TEXT]=T)}let m=r._startSpan(this.constructor.collection,this.constructor.modelName,e,_),h=r._handleResponse(m,o,this,arguments,l,n);return h&&typeof h=="object"&&(h[Cn._ALREADY_INSTRUMENTED]=!0),h}}patchModelStatic(e,n){let r=this;return o=>function(i,a,c){if(r.getConfig().requireParentSpan&&Tt.trace.getSpan(Tt.context.active())===void 0)return o.apply(this,arguments);typeof a=="function"&&(c=a,a=void 0);let l={};switch(e){case"insertMany":l.documents=i;break;case"bulkWrite":l.operations=i;break;default:l.document=i;break}a!==void 0&&(l.options=a);let p={},{dbStatementSerializer:d}=r.getConfig();if(d){let f=d(e,l);r._dbSemconvStability&jt.SemconvStability.OLD&&(p[Ks.ATTR_DB_STATEMENT]=f),r._dbSemconvStability&jt.SemconvStability.STABLE&&(p[ha.ATTR_DB_QUERY_TEXT]=f)}let _=r._startSpan(this.collection,this.modelName,e,p);return r._handleResponse(_,o,this,arguments,c,n)}}patchModelAggregate(){let e=this;return n=>function(){let o=Tt.trace.getSpan(Tt.context.active()),s=e._callOriginalFunction(()=>n.apply(this,arguments));return s&&(s[Cn._STORED_PARENT_SPAN]=o),s}}patchAndCaptureSpanContext(e){let n=this;return r=>function(){return this[Cn._STORED_PARENT_SPAN]=Tt.trace.getSpan(Tt.context.active()),n._callOriginalFunction(()=>r.apply(this,arguments))}}_startSpan(e,n,r,o,s){let i={...o,...(0,DN.getAttributesFromCollection)(e,this._dbSemconvStability,this._netSemconvStability)};this._dbSemconvStability&jt.SemconvStability.OLD&&(i[Ks.ATTR_DB_OPERATION]=r,i[Ks.ATTR_DB_SYSTEM]="mongoose"),this._dbSemconvStability&jt.SemconvStability.STABLE&&(i[ha.ATTR_DB_OPERATION_NAME]=r,i[ha.ATTR_DB_SYSTEM_NAME]=Ks.DB_SYSTEM_NAME_VALUE_MONGODB);let a=this._dbSemconvStability&jt.SemconvStability.STABLE?`${r} ${e.name}`:`mongoose.${n}.${r}`;return this.tracer.startSpan(a,{kind:Tt.SpanKind.CLIENT,attributes:i},s?Tt.trace.setSpan(Tt.context.active(),s):void 0)}_handleResponse(e,n,r,o,s,i=void 0){let a=this;if(s instanceof Function)return a._callOriginalFunction(()=>(0,DN.handleCallbackResponse)(s,n,r,e,o,a.getConfig().responseHook,i));{let c=a._callOriginalFunction(()=>n.apply(r,o));return(0,DN.handlePromiseResponse)(c,e,a.getConfig().responseHook,i)}}_callOriginalFunction(e){return this.getConfig().suppressInternalInstrumentation?Tt.context.with((0,ege.suppressTracing)(Tt.context.active()),e):e()}};Cn.MongooseInstrumentation=UN});var SW=E(ZT=>{"use strict";Object.defineProperty(ZT,"__esModule",{value:!0});ZT.MongooseInstrumentation=void 0;var oge=EW();Object.defineProperty(ZT,"MongooseInstrumentation",{enumerable:!0,get:function(){return oge.MongooseInstrumentation}})});var IW=E(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.METRIC_DB_CLIENT_CONNECTIONS_USAGE=ct.DB_SYSTEM_VALUE_MYSQL=ct.ATTR_NET_PEER_PORT=ct.ATTR_NET_PEER_NAME=ct.ATTR_DB_USER=ct.ATTR_DB_SYSTEM=ct.ATTR_DB_STATEMENT=ct.ATTR_DB_NAME=ct.ATTR_DB_CONNECTION_STRING=void 0;ct.ATTR_DB_CONNECTION_STRING="db.connection_string";ct.ATTR_DB_NAME="db.name";ct.ATTR_DB_STATEMENT="db.statement";ct.ATTR_DB_SYSTEM="db.system";ct.ATTR_DB_USER="db.user";ct.ATTR_NET_PEER_NAME="net.peer.name";ct.ATTR_NET_PEER_PORT="net.peer.port";ct.DB_SYSTEM_VALUE_MYSQL="mysql";ct.METRIC_DB_CLIENT_CONNECTIONS_USAGE="db.client.connections.usage"});var OW=E(hd=>{"use strict";Object.defineProperty(hd,"__esModule",{value:!0});hd.AttributeNames=void 0;var ige;(function(t){t.MYSQL_VALUES="db.mysql.values"})(ige=hd.AttributeNames||(hd.AttributeNames={}))});var NW=E(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.getPoolNameOld=Xt.arrayStringifyHelper=Xt.getSpanName=Xt.getDbValues=Xt.getDbQueryText=Xt.getJDBCString=Xt.getConfig=void 0;function age(t){let{host:e,port:n,database:r,user:o}=t&&t.connectionConfig||t||{};return{host:e,port:n,database:r,user:o}}Xt.getConfig=age;function cge(t,e,n){let r=`jdbc:mysql://${t||"localhost"}`;return typeof e=="number"&&(r+=`:${e}`),typeof n=="string"&&(r+=`/${n}`),r}Xt.getJDBCString=cge;function uge(t){return typeof t=="string"?t:t.sql}Xt.getDbQueryText=uge;function lge(t,e){return wN(typeof t=="string"?e:e||t.values)}Xt.getDbValues=lge;function pge(t){let e=typeof t=="object"?t.sql:t,n=e?.indexOf(" ");return typeof n=="number"&&n!==-1?e?.substring(0,n):e}Xt.getSpanName=pge;function wN(t){return t?`[${t.toString()}]`:""}Xt.arrayStringifyHelper=wN;function dge(t){let e=t.config.connectionConfig,n="";return n+=e.host?`host: '${e.host}', `:"",n+=e.port?`port: ${e.port}, `:"",n+=e.database?`database: '${e.database}', `:"",n+=e.user?`user: '${e.user}'`:"",e.user||(n=n.substring(0,n.length-2)),n.trim()}Xt.getPoolNameOld=dge});var bW=E(xu=>{"use strict";Object.defineProperty(xu,"__esModule",{value:!0});xu.PACKAGE_NAME=xu.PACKAGE_VERSION=void 0;xu.PACKAGE_VERSION="0.60.0";xu.PACKAGE_NAME="@opentelemetry/instrumentation-mysql"});var PW=E(eE=>{"use strict";Object.defineProperty(eE,"__esModule",{value:!0});eE.MySQLInstrumentation=void 0;var Pn=(b(),O(v)),pr=ne(),vu=(le(),O(Ae)),Ko=IW(),_ge=OW(),Ta=NW(),CW=bW(),kN=class extends pr.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(CW.PACKAGE_NAME,CW.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,pr.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,pr.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}_updateMetricInstruments(){this._connectionsUsageOld=this.meter.createUpDownCounter(Ko.METRIC_DB_CLIENT_CONNECTIONS_USAGE,{description:"The number of connections that are currently in state described by the state attribute.",unit:"{connection}"})}_connCountAdd(e,n,r){this._connectionsUsageOld?.add(e,{state:r,name:n})}init(){return[new pr.InstrumentationNodeModuleDefinition("mysql",[">=2.0.0 <3"],e=>((0,pr.isWrapped)(e.createConnection)&&this._unwrap(e,"createConnection"),this._wrap(e,"createConnection",this._patchCreateConnection()),(0,pr.isWrapped)(e.createPool)&&this._unwrap(e,"createPool"),this._wrap(e,"createPool",this._patchCreatePool()),(0,pr.isWrapped)(e.createPoolCluster)&&this._unwrap(e,"createPoolCluster"),this._wrap(e,"createPoolCluster",this._patchCreatePoolCluster()),e),e=>{e!==void 0&&(this._unwrap(e,"createConnection"),this._unwrap(e,"createPool"),this._unwrap(e,"createPoolCluster"))})]}_patchCreateConnection(){return e=>{let n=this;return function(o){let s=e(...arguments);return n._wrap(s,"query",n._patchQuery(s)),s}}}_patchCreatePool(){return e=>{let n=this;return function(o){let s=e(...arguments);return n._wrap(s,"query",n._patchQuery(s)),n._wrap(s,"getConnection",n._patchGetConnection(s)),n._wrap(s,"end",n._patchPoolEnd(s)),n._setPoolCallbacks(s,""),s}}}_patchPoolEnd(e){return n=>{let r=this;return function(s){let i=e._allConnections.length,a=e._freeConnections.length,c=i-a,l=(0,Ta.getPoolNameOld)(e);r._connCountAdd(-c,l,"used"),r._connCountAdd(-a,l,"idle"),n.apply(e,arguments)}}}_patchCreatePoolCluster(){return e=>{let n=this;return function(o){let s=e(...arguments);return n._wrap(s,"getConnection",n._patchGetConnection(s)),n._wrap(s,"add",n._patchAdd(s)),s}}}_patchAdd(e){return n=>{let r=this;return function(s,i){if(!r._enabled)return r._unwrap(e,"add"),n.apply(e,arguments);n.apply(e,arguments);let a=e._nodes;if(a){let c=typeof s=="object"?"CLUSTER::"+e._lastId:String(s),l=a[c].pool;r._setPoolCallbacks(l,s)}}}}_patchGetConnection(e){return n=>{let r=this;return function(s,i,a){if(!r._enabled)return r._unwrap(e,"getConnection"),n.apply(e,arguments);if(arguments.length===1&&typeof s=="function"){let c=r._getConnectionCallbackPatchFn(s);return n.call(e,c)}if(arguments.length===2&&typeof i=="function"){let c=r._getConnectionCallbackPatchFn(i);return n.call(e,s,c)}if(arguments.length===3&&typeof a=="function"){let c=r._getConnectionCallbackPatchFn(a);return n.call(e,s,i,c)}return n.apply(e,arguments)}}}_getConnectionCallbackPatchFn(e){let n=this,r=Pn.context.active();return function(o,s){s&&((0,pr.isWrapped)(s.query)||n._wrap(s,"query",n._patchQuery(s))),typeof e=="function"&&Pn.context.with(r,e,this,o,s)}}_patchQuery(e){return n=>{let r=this;return function(o,s,i){if(!r._enabled)return r._unwrap(e,"query"),n.apply(e,arguments);let a={},{host:c,port:l,database:p,user:d}=(0,Ta.getConfig)(e.config),_=parseInt(l,10),f=(0,Ta.getDbQueryText)(o);r._dbSemconvStability&pr.SemconvStability.OLD&&(a[Ko.ATTR_DB_SYSTEM]=Ko.DB_SYSTEM_VALUE_MYSQL,a[Ko.ATTR_DB_CONNECTION_STRING]=(0,Ta.getJDBCString)(c,l,p),a[Ko.ATTR_DB_NAME]=p,a[Ko.ATTR_DB_USER]=d,a[Ko.ATTR_DB_STATEMENT]=f),r._dbSemconvStability&pr.SemconvStability.STABLE&&(a[vu.ATTR_DB_SYSTEM_NAME]=vu.DB_SYSTEM_NAME_VALUE_MYSQL,a[vu.ATTR_DB_NAMESPACE]=p,a[vu.ATTR_DB_QUERY_TEXT]=f),r._netSemconvStability&pr.SemconvStability.OLD&&(a[Ko.ATTR_NET_PEER_NAME]=c,isNaN(_)||(a[Ko.ATTR_NET_PEER_PORT]=_)),r._netSemconvStability&pr.SemconvStability.STABLE&&(a[vu.ATTR_SERVER_ADDRESS]=c,isNaN(_)||(a[vu.ATTR_SERVER_PORT]=_));let m=r.tracer.startSpan((0,Ta.getSpanName)(o),{kind:Pn.SpanKind.CLIENT,attributes:a});if(r.getConfig().enhancedDatabaseReporting){let S;Array.isArray(s)?S=s:arguments[2]&&(S=[s]),m.setAttribute(_ge.AttributeNames.MYSQL_VALUES,(0,Ta.getDbValues)(o,S))}let h=Array.from(arguments).findIndex(S=>typeof S=="function"),T=Pn.context.active();if(h===-1){let S=Pn.context.with(Pn.trace.setSpan(Pn.context.active(),m),()=>n.apply(e,arguments));return Pn.context.bind(T,S),S.on("error",R=>m.setStatus({code:Pn.SpanStatusCode.ERROR,message:R.message})).on("end",()=>{m.end()})}else return r._wrap(arguments,h,r._patchCallbackQuery(m,T)),Pn.context.with(Pn.trace.setSpan(Pn.context.active(),m),()=>n.apply(e,arguments))}}}_patchCallbackQuery(e,n){return r=>function(o,s,i){return o&&e.setStatus({code:Pn.SpanStatusCode.ERROR,message:o.message}),e.end(),Pn.context.with(n,()=>r(...arguments))}}_setPoolCallbacks(e,n){let r=n||(0,Ta.getPoolNameOld)(e);e.on("connection",o=>{this._connCountAdd(1,r,"idle")}),e.on("acquire",o=>{this._connCountAdd(-1,r,"idle"),this._connCountAdd(1,r,"used")}),e.on("release",o=>{this._connCountAdd(1,r,"idle"),this._connCountAdd(-1,r,"used")})}};eE.MySQLInstrumentation=kN});var MW=E(tE=>{"use strict";Object.defineProperty(tE,"__esModule",{value:!0});tE.MySQLInstrumentation=void 0;var fge=PW();Object.defineProperty(tE,"MySQLInstrumentation",{enumerable:!0,get:function(){return fge.MySQLInstrumentation}})});var GN=E(Ct=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.DB_SYSTEM_VALUE_MYSQL=Ct.ATTR_NET_PEER_PORT=Ct.ATTR_NET_PEER_NAME=Ct.ATTR_DB_USER=Ct.ATTR_DB_SYSTEM=Ct.ATTR_DB_STATEMENT=Ct.ATTR_DB_NAME=Ct.ATTR_DB_CONNECTION_STRING=void 0;Ct.ATTR_DB_CONNECTION_STRING="db.connection_string";Ct.ATTR_DB_NAME="db.name";Ct.ATTR_DB_STATEMENT="db.statement";Ct.ATTR_DB_SYSTEM="db.system";Ct.ATTR_DB_USER="db.user";Ct.ATTR_NET_PEER_NAME="net.peer.name";Ct.ATTR_NET_PEER_PORT="net.peer.port";Ct.DB_SYSTEM_VALUE_MYSQL="mysql"});var jN=E(nE=>{"use strict";Object.defineProperty(nE,"__esModule",{value:!0});nE.addSqlCommenterComment=void 0;var BN=(b(),O(v)),hge=Te();function Tge(t){let e=t.indexOf("--");if(e>=0)return!0;if(t.indexOf("/*")<0)return!1;let r=t.indexOf("*/");return e<r}function Ege(t){return encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}function Sge(t,e){if(typeof e!="string"||e.length===0||Tge(e))return e;let n=new hge.W3CTraceContextPropagator,r={};n.inject(BN.trace.setSpan(BN.ROOT_CONTEXT,t),r,BN.defaultTextMapSetter);let o=Object.keys(r).sort();if(o.length===0)return e;let s=o.map(i=>{let a=Ege(r[i]);return`${i}='${a}'`}).join(",");return`${e} /*${s}*/`}nE.addSqlCommenterComment=Sge});var UW=E(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.getConnectionPrototypeToInstrument=dr.once=dr.getSpanName=dr.getQueryText=dr.getConnectionAttributes=void 0;var Td=GN(),rE=ne(),HN=(le(),O(Ae));function gge(t,e,n){let{host:r,port:o,database:s,user:i}=Age(t),a={};e&rE.SemconvStability.OLD&&(a[Td.ATTR_DB_CONNECTION_STRING]=Rge(r,o,s),a[Td.ATTR_DB_NAME]=s,a[Td.ATTR_DB_USER]=i),e&rE.SemconvStability.STABLE&&(a[HN.ATTR_DB_NAMESPACE]=s);let c=parseInt(o,10);return n&rE.SemconvStability.OLD&&(a[Td.ATTR_NET_PEER_NAME]=r,isNaN(c)||(a[Td.ATTR_NET_PEER_PORT]=c)),n&rE.SemconvStability.STABLE&&(a[HN.ATTR_SERVER_ADDRESS]=r,isNaN(c)||(a[HN.ATTR_SERVER_PORT]=c)),a}dr.getConnectionAttributes=gge;function Age(t){let{host:e,port:n,database:r,user:o}=t&&t.connectionConfig||t||{};return{host:e,port:n,database:r,user:o}}function Rge(t,e,n){let r=`jdbc:mysql://${t||"localhost"}`;return typeof e=="number"&&(r+=`:${e}`),typeof n=="string"&&(r+=`/${n}`),r}function yge(t,e,n,r=!1,o=Ige){let[s,i]=typeof t=="string"?[t,n]:[t.sql,Oge(t)?n||t.values:n];try{return r?o(s):e&&i?e(s,i):s}catch{return"Could not determine the query due to an error in masking or formatting"}}dr.getQueryText=yge;function Ige(t){return t.replace(/\b\d+\b/g,"?").replace(/(["'])(?:(?=(\\?))\2.)*?\1/g,"?")}function Oge(t){return"values"in t}function Nge(t){let e=typeof t=="object"?t.sql:t,n=e?.indexOf(" ");return typeof n=="number"&&n!==-1?e?.substring(0,n):e}dr.getSpanName=Nge;var bge=t=>{let e=!1;return(...n)=>{if(!e)return e=!0,t(...n)}};dr.once=bge;function Cge(t){let e=t.prototype,n=Object.getPrototypeOf(e);return typeof n?.query=="function"&&typeof n?.execute=="function"?n:e}dr.getConnectionPrototypeToInstrument=Cge});var wW=E(Lu=>{"use strict";Object.defineProperty(Lu,"__esModule",{value:!0});Lu.PACKAGE_NAME=Lu.PACKAGE_VERSION=void 0;Lu.PACKAGE_VERSION="0.60.0";Lu.PACKAGE_NAME="@opentelemetry/instrumentation-mysql2"});var jW=E(oE=>{"use strict";Object.defineProperty(oE,"__esModule",{value:!0});oE.MySQL2Instrumentation=void 0;var kW=(b(),O(v)),Ur=ne(),FN=GN(),GW=jN(),Du=UW(),BW=wW(),VN=(le(),O(Ae)),qN=[">=1.4.2 <4"],$N=class extends Ur.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(BW.PACKAGE_NAME,BW.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Ur.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,Ur.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){let e;function n(s){!e&&s.format&&(e=s.format)}let r=s=>{(0,Ur.isWrapped)(s.query)&&this._unwrap(s,"query"),this._wrap(s,"query",this._patchQuery(e,!1)),(0,Ur.isWrapped)(s.execute)&&this._unwrap(s,"execute"),this._wrap(s,"execute",this._patchQuery(e,!0))},o=s=>{this._unwrap(s,"query"),this._unwrap(s,"execute")};return[new Ur.InstrumentationNodeModuleDefinition("mysql2",qN,s=>(n(s),s),()=>{},[new Ur.InstrumentationNodeModuleFile("mysql2/promise.js",qN,s=>(n(s),s),()=>{}),new Ur.InstrumentationNodeModuleFile("mysql2/lib/connection.js",qN,s=>{let i=(0,Du.getConnectionPrototypeToInstrument)(s);return r(i),s},s=>{if(s===void 0)return;let i=(0,Du.getConnectionPrototypeToInstrument)(s);o(i)})])]}_patchQuery(e,n){return r=>{let o=this;return function(s,i,a){let c;Array.isArray(i)?c=i:arguments[2]&&(c=[i]);let{maskStatement:l,maskStatementHook:p,responseHook:d}=o.getConfig(),_=(0,Du.getConnectionAttributes)(this.config,o._dbSemconvStability,o._netSemconvStability),f=(0,Du.getQueryText)(s,e,c,l,p);o._dbSemconvStability&Ur.SemconvStability.OLD&&(_[FN.ATTR_DB_SYSTEM]=FN.DB_SYSTEM_VALUE_MYSQL,_[FN.ATTR_DB_STATEMENT]=f),o._dbSemconvStability&Ur.SemconvStability.STABLE&&(_[VN.ATTR_DB_SYSTEM_NAME]=VN.DB_SYSTEM_NAME_VALUE_MYSQL,_[VN.ATTR_DB_QUERY_TEXT]=f);let m=o.tracer.startSpan((0,Du.getSpanName)(s),{kind:kW.SpanKind.CLIENT,attributes:_});!n&&o.getConfig().addSqlCommenterCommentToQueries&&(arguments[0]=s=typeof s=="string"?(0,GW.addSqlCommenterComment)(m,s):Object.assign(s,{sql:(0,GW.addSqlCommenterComment)(m,s.sql)}));let h=(0,Du.once)((T,S)=>{T?m.setStatus({code:kW.SpanStatusCode.ERROR,message:T.message}):typeof d=="function"&&(0,Ur.safeExecuteInTheMiddle)(()=>{d(m,{queryResults:S})},R=>{R&&o._diag.warn("Failed executing responseHook",R)},!0),m.end()});if(arguments.length===1){typeof s.onResult=="function"&&o._wrap(s,"onResult",o._patchCallbackQuery(h));let T=r.apply(this,arguments);return T.once("error",S=>{h(S)}).once("result",S=>{h(void 0,S)}),T}return typeof arguments[1]=="function"?o._wrap(arguments,1,o._patchCallbackQuery(h)):typeof arguments[2]=="function"&&o._wrap(arguments,2,o._patchCallbackQuery(h)),r.apply(this,arguments)}}}_patchCallbackQuery(e){return n=>function(r,o,s){return e(r,o),n(...arguments)}}};oE.MySQL2Instrumentation=$N});var HW=E(sE=>{"use strict";Object.defineProperty(sE,"__esModule",{value:!0});sE.MySQL2Instrumentation=void 0;var Pge=jW();Object.defineProperty(sE,"MySQL2Instrumentation",{enumerable:!0,get:function(){return Pge.MySQL2Instrumentation}})});var YW=E(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.DB_SYSTEM_VALUE_REDIS=Jt.DB_SYSTEM_NAME_VALUE_REDIS=Jt.ATTR_NET_PEER_PORT=Jt.ATTR_NET_PEER_NAME=Jt.ATTR_DB_SYSTEM=Jt.ATTR_DB_STATEMENT=Jt.ATTR_DB_CONNECTION_STRING=void 0;Jt.ATTR_DB_CONNECTION_STRING="db.connection_string";Jt.ATTR_DB_STATEMENT="db.statement";Jt.ATTR_DB_SYSTEM="db.system";Jt.ATTR_NET_PEER_NAME="net.peer.name";Jt.ATTR_NET_PEER_PORT="net.peer.port";Jt.DB_SYSTEM_NAME_VALUE_REDIS="redis";Jt.DB_SYSTEM_VALUE_REDIS="redis"});var WW=E(iE=>{"use strict";Object.defineProperty(iE,"__esModule",{value:!0});iE.endSpan=void 0;var xge=(b(),O(v)),vge=(t,e)=>{e&&(t.recordException(e),t.setStatus({code:xge.SpanStatusCode.ERROR,message:e.message})),t.end()};iE.endSpan=vge});var cE=E(aE=>{"use strict";Object.defineProperty(aE,"__esModule",{value:!0});aE.defaultDbStatementSerializer=void 0;var Lge=[{regex:/^ECHO/i,args:0},{regex:/^(LPUSH|MSET|PFA|PUBLISH|RPUSH|SADD|SET|SPUBLISH|XADD|ZADD)/i,args:1},{regex:/^(HSET|HMSET|LSET|LINSERT)/i,args:2},{regex:/^(ACL|BIT|B[LRZ]|CLIENT|CLUSTER|CONFIG|COMMAND|DECR|DEL|EVAL|EX|FUNCTION|GEO|GET|HINCR|HMGET|HSCAN|INCR|L[TRLM]|MEMORY|P[EFISTU]|RPOP|S[CDIMORSU]|XACK|X[CDGILPRT]|Z[CDILMPRS])/i,args:-1}],Dge=(t,e)=>{if(Array.isArray(e)&&e.length){let n=Lge.find(({regex:o})=>o.test(t))?.args??0,r=n>=0?e.slice(0,n):e;return e.length>r.length&&r.push(`[${e.length-n} other arguments]`),`${t} ${r.join(" ")}`}return t};aE.defaultDbStatementSerializer=Dge});var zW=E(Uu=>{"use strict";Object.defineProperty(Uu,"__esModule",{value:!0});Uu.PACKAGE_NAME=Uu.PACKAGE_VERSION=void 0;Uu.PACKAGE_VERSION="0.62.0";Uu.PACKAGE_NAME="@opentelemetry/instrumentation-ioredis"});var JW=E(uE=>{"use strict";Object.defineProperty(uE,"__esModule",{value:!0});uE.IORedisInstrumentation=void 0;var Qs=(b(),O(v)),Mn=ne(),Xs=(le(),O(Ae)),xn=YW(),KW=ne(),Ed=WW(),Uge=cE(),QW=zW(),XW={requireParentSpan:!0},YN=class extends Mn.InstrumentationBase{_netSemconvStability;_dbSemconvStability;constructor(e={}){super(QW.PACKAGE_NAME,QW.PACKAGE_VERSION,{...XW,...e}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Mn.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,Mn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...XW,...e})}init(){return[new Mn.InstrumentationNodeModuleDefinition("ioredis",[">=2.0.0 <6"],(e,n)=>{let r=e[Symbol.toStringTag]==="Module"?e.default:e;return(0,Mn.isWrapped)(r.prototype.sendCommand)&&this._unwrap(r.prototype,"sendCommand"),this._wrap(r.prototype,"sendCommand",this._patchSendCommand(n)),(0,Mn.isWrapped)(r.prototype.connect)&&this._unwrap(r.prototype,"connect"),this._wrap(r.prototype,"connect",this._patchConnection()),e},e=>{if(e===void 0)return;let n=e[Symbol.toStringTag]==="Module"?e.default:e;this._unwrap(n.prototype,"sendCommand"),this._unwrap(n.prototype,"connect")})]}_patchSendCommand(e){return n=>this._traceSendCommand(n,e)}_patchConnection(){return e=>this._traceConnection(e)}_traceSendCommand(e,n){let r=this;return function(o){if(arguments.length<1||typeof o!="object")return e.apply(this,arguments);let s=r.getConfig(),i=s.dbStatementSerializer||Uge.defaultDbStatementSerializer,a=Qs.trace.getSpan(Qs.context.active())===void 0;if(s.requireParentSpan===!0&&a)return e.apply(this,arguments);let c={},{host:l,port:p}=this.options,d=i(o.name,o.args);r._dbSemconvStability&Mn.SemconvStability.OLD&&(c[xn.ATTR_DB_SYSTEM]=xn.DB_SYSTEM_VALUE_REDIS,c[xn.ATTR_DB_STATEMENT]=d,c[xn.ATTR_DB_CONNECTION_STRING]=`redis://${l}:${p}`),r._dbSemconvStability&Mn.SemconvStability.STABLE&&(c[Xs.ATTR_DB_SYSTEM_NAME]=xn.DB_SYSTEM_NAME_VALUE_REDIS,c[Xs.ATTR_DB_QUERY_TEXT]=d),r._netSemconvStability&Mn.SemconvStability.OLD&&(c[xn.ATTR_NET_PEER_NAME]=l,c[xn.ATTR_NET_PEER_PORT]=p),r._netSemconvStability&Mn.SemconvStability.STABLE&&(c[Xs.ATTR_SERVER_ADDRESS]=l,c[Xs.ATTR_SERVER_PORT]=p);let _=r.tracer.startSpan(o.name,{kind:Qs.SpanKind.CLIENT,attributes:c}),{requestHook:f}=s;f&&(0,KW.safeExecuteInTheMiddle)(()=>f(_,{moduleVersion:n,cmdName:o.name,cmdArgs:o.args}),m=>{m&&Qs.diag.error("ioredis instrumentation: request hook failed",m)},!0);try{let m=e.apply(this,arguments),h=o.resolve;o.resolve=function(S){(0,KW.safeExecuteInTheMiddle)(()=>s.responseHook?.(_,o.name,o.args,S),R=>{R&&Qs.diag.error("ioredis instrumentation: response hook failed",R)},!0),(0,Ed.endSpan)(_,null),h(S)};let T=o.reject;return o.reject=function(S){(0,Ed.endSpan)(_,S),T(S)},m}catch(m){throw(0,Ed.endSpan)(_,m),m}}}_traceConnection(e){let n=this;return function(){let r=Qs.trace.getSpan(Qs.context.active())===void 0;if(n.getConfig().requireParentSpan===!0&&r)return e.apply(this,arguments);let o={},{host:s,port:i}=this.options;n._dbSemconvStability&Mn.SemconvStability.OLD&&(o[xn.ATTR_DB_SYSTEM]=xn.DB_SYSTEM_VALUE_REDIS,o[xn.ATTR_DB_STATEMENT]="connect",o[xn.ATTR_DB_CONNECTION_STRING]=`redis://${s}:${i}`),n._dbSemconvStability&Mn.SemconvStability.STABLE&&(o[Xs.ATTR_DB_SYSTEM_NAME]=xn.DB_SYSTEM_NAME_VALUE_REDIS,o[Xs.ATTR_DB_QUERY_TEXT]="connect"),n._netSemconvStability&Mn.SemconvStability.OLD&&(o[xn.ATTR_NET_PEER_NAME]=s,o[xn.ATTR_NET_PEER_PORT]=i),n._netSemconvStability&Mn.SemconvStability.STABLE&&(o[Xs.ATTR_SERVER_ADDRESS]=s,o[Xs.ATTR_SERVER_PORT]=i);let a=n.tracer.startSpan("connect",{kind:Qs.SpanKind.CLIENT,attributes:o});try{let c=e.apply(this,arguments);return(0,Ed.endSpan)(a,null),c}catch(c){throw(0,Ed.endSpan)(a,c),c}}}};uE.IORedisInstrumentation=YN});var ZW=E(lE=>{"use strict";Object.defineProperty(lE,"__esModule",{value:!0});lE.IORedisInstrumentation=void 0;var wge=JW();Object.defineProperty(lE,"IORedisInstrumentation",{enumerable:!0,get:function(){return wge.IORedisInstrumentation}})});var pE=E(wu=>{"use strict";Object.defineProperty(wu,"__esModule",{value:!0});wu.PACKAGE_NAME=wu.PACKAGE_VERSION=void 0;wu.PACKAGE_VERSION="0.62.0";wu.PACKAGE_NAME="@opentelemetry/instrumentation-redis"});var ez=E(Js=>{"use strict";Object.defineProperty(Js,"__esModule",{value:!0});Js.getTracedCreateStreamTrace=Js.getTracedCreateClient=Js.endSpan=void 0;var Sd=(b(),O(v)),kge=(t,e)=>{e&&t.setStatus({code:Sd.SpanStatusCode.ERROR,message:e.message}),t.end()};Js.endSpan=kge;var Gge=t=>function(){let n=t.apply(this,arguments);return Sd.context.bind(Sd.context.active(),n)};Js.getTracedCreateClient=Gge;var Bge=t=>function(){return Object.prototype.hasOwnProperty.call(this,"stream")||Object.defineProperty(this,"stream",{get(){return this._patched_redis_stream},set(n){Sd.context.bind(Sd.context.active(),n),this._patched_redis_stream=n}}),t.apply(this,arguments)};Js.getTracedCreateStreamTrace=Bge});var dE=E(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.DB_SYSTEM_VALUE_REDIS=Zt.DB_SYSTEM_NAME_VALUE_REDIS=Zt.ATTR_NET_PEER_PORT=Zt.ATTR_NET_PEER_NAME=Zt.ATTR_DB_SYSTEM=Zt.ATTR_DB_STATEMENT=Zt.ATTR_DB_CONNECTION_STRING=void 0;Zt.ATTR_DB_CONNECTION_STRING="db.connection_string";Zt.ATTR_DB_STATEMENT="db.statement";Zt.ATTR_DB_SYSTEM="db.system";Zt.ATTR_NET_PEER_NAME="net.peer.name";Zt.ATTR_NET_PEER_PORT="net.peer.port";Zt.DB_SYSTEM_NAME_VALUE_REDIS="redis";Zt.DB_SYSTEM_VALUE_REDIS="redis"});var nz=E(fE=>{"use strict";Object.defineProperty(fE,"__esModule",{value:!0});fE.RedisInstrumentationV2_V3=void 0;var Yn=ne(),_E=ez(),tz=pE(),gd=(b(),O(v)),Ad=(le(),O(Ae)),Ea=dE(),jge=cE(),WN=class t extends Yn.InstrumentationBase{static COMPONENT="redis";_semconvStability;constructor(e={}){super(tz.PACKAGE_NAME,tz.PACKAGE_VERSION,e),this._semconvStability=e.semconvStability?e.semconvStability:(0,Yn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig(e),this._semconvStability=e.semconvStability?e.semconvStability:(0,Yn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[new Yn.InstrumentationNodeModuleDefinition("redis",[">=2.6.0 <4"],e=>((0,Yn.isWrapped)(e.RedisClient.prototype.internal_send_command)&&this._unwrap(e.RedisClient.prototype,"internal_send_command"),this._wrap(e.RedisClient.prototype,"internal_send_command",this._getPatchInternalSendCommand()),(0,Yn.isWrapped)(e.RedisClient.prototype.create_stream)&&this._unwrap(e.RedisClient.prototype,"create_stream"),this._wrap(e.RedisClient.prototype,"create_stream",this._getPatchCreateStream()),(0,Yn.isWrapped)(e.createClient)&&this._unwrap(e,"createClient"),this._wrap(e,"createClient",this._getPatchCreateClient()),e),e=>{e!==void 0&&(this._unwrap(e.RedisClient.prototype,"internal_send_command"),this._unwrap(e.RedisClient.prototype,"create_stream"),this._unwrap(e,"createClient"))})]}_getPatchInternalSendCommand(){let e=this;return function(r){return function(s){if(arguments.length!==1||typeof s!="object")return r.apply(this,arguments);let i=e.getConfig(),a=gd.trace.getSpan(gd.context.active())===void 0;if(i.requireParentSpan===!0&&a)return r.apply(this,arguments);let c=i?.dbStatementSerializer||jge.defaultDbStatementSerializer,l={};e._semconvStability&Yn.SemconvStability.OLD&&Object.assign(l,{[Ea.ATTR_DB_SYSTEM]:Ea.DB_SYSTEM_VALUE_REDIS,[Ea.ATTR_DB_STATEMENT]:c(s.command,s.args)}),e._semconvStability&Yn.SemconvStability.STABLE&&Object.assign(l,{[Ad.ATTR_DB_SYSTEM_NAME]:Ea.DB_SYSTEM_NAME_VALUE_REDIS,[Ad.ATTR_DB_OPERATION_NAME]:s.command,[Ad.ATTR_DB_QUERY_TEXT]:c(s.command,s.args)});let p=e.tracer.startSpan(`${t.COMPONENT}-${s.command}`,{kind:gd.SpanKind.CLIENT,attributes:l});if(this.connection_options){let _={};e._semconvStability&Yn.SemconvStability.OLD&&Object.assign(_,{[Ea.ATTR_NET_PEER_NAME]:this.connection_options.host,[Ea.ATTR_NET_PEER_PORT]:this.connection_options.port}),e._semconvStability&Yn.SemconvStability.STABLE&&Object.assign(_,{[Ad.ATTR_SERVER_ADDRESS]:this.connection_options.host,[Ad.ATTR_SERVER_PORT]:this.connection_options.port}),p.setAttributes(_)}this.address&&e._semconvStability&Yn.SemconvStability.OLD&&p.setAttribute(Ea.ATTR_DB_CONNECTION_STRING,`redis://${this.address}`);let d=arguments[0].callback;if(d){let _=gd.context.active();arguments[0].callback=function(m,h){if(i?.responseHook){let T=i.responseHook;(0,Yn.safeExecuteInTheMiddle)(()=>{T(p,s.command,s.args,h)},S=>{S&&e._diag.error("Error executing responseHook",S)},!0)}return(0,_E.endSpan)(p,m),gd.context.with(_,d,this,...arguments)}}try{return r.apply(this,arguments)}catch(_){throw(0,_E.endSpan)(p,_),_}}}}_getPatchCreateClient(){return function(n){return(0,_E.getTracedCreateClient)(n)}}_getPatchCreateStream(){return function(n){return(0,_E.getTracedCreateStreamTrace)(n)}}};fE.RedisInstrumentationV2_V3=WN});var oz=E(mE=>{"use strict";Object.defineProperty(mE,"__esModule",{value:!0});mE.getClientAttributes=void 0;var zN=(le(),O(Ae)),ku=dE(),rz=ne();function Hge(t,e,n){let r={};return n&rz.SemconvStability.OLD&&Object.assign(r,{[ku.ATTR_DB_SYSTEM]:ku.DB_SYSTEM_VALUE_REDIS,[ku.ATTR_NET_PEER_NAME]:e?.socket?.host,[ku.ATTR_NET_PEER_PORT]:e?.socket?.port,[ku.ATTR_DB_CONNECTION_STRING]:Fge(t,e?.url)}),n&rz.SemconvStability.STABLE&&Object.assign(r,{[zN.ATTR_DB_SYSTEM_NAME]:ku.DB_SYSTEM_NAME_VALUE_REDIS,[zN.ATTR_SERVER_ADDRESS]:e?.socket?.host,[zN.ATTR_SERVER_PORT]:e?.socket?.port}),r}mE.getClientAttributes=Hge;function Fge(t,e){if(!(typeof e!="string"||!e))try{let n=new URL(e);return n.searchParams.delete("user_pwd"),n.username="",n.password="",n.href}catch(n){t.error("failed to sanitize redis connection url",n)}}});var cz=E(hE=>{"use strict";Object.defineProperty(hE,"__esModule",{value:!0});hE.RedisInstrumentationV4_V5=void 0;var _r=(b(),O(v)),xe=ne(),sz=oz(),Vge=cE(),iz=pE(),KN=(le(),O(Ae)),qge=dE(),Rd=Symbol("opentelemetry.instrumentation.redis.open_spans"),az=Symbol("opentelemetry.instrumentation.redis.multi_command_options"),QN=class t extends xe.InstrumentationBase{static COMPONENT="redis";_semconvStability;constructor(e={}){super(iz.PACKAGE_NAME,iz.PACKAGE_VERSION,e),this._semconvStability=e.semconvStability?e.semconvStability:(0,xe.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig(e),this._semconvStability=e.semconvStability?e.semconvStability:(0,xe.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[this._getInstrumentationNodeModuleDefinition("@redis/client"),this._getInstrumentationNodeModuleDefinition("@node-redis/client")]}_getInstrumentationNodeModuleDefinition(e){let n=new xe.InstrumentationNodeModuleFile(`${e}/dist/lib/commander.js`,["^1.0.0"],(s,i)=>{let a=s.transformCommandArguments;if(!a)return this._diag.error("internal instrumentation error, missing transformCommandArguments function"),s;let c=i?.startsWith("1.0.")?"extendWithCommands":"attachCommands";return(0,xe.isWrapped)(s?.[c])&&this._unwrap(s,c),this._wrap(s,c,this._getPatchExtendWithCommands(a)),s},s=>{(0,xe.isWrapped)(s?.extendWithCommands)&&this._unwrap(s,"extendWithCommands"),(0,xe.isWrapped)(s?.attachCommands)&&this._unwrap(s,"attachCommands")}),r=new xe.InstrumentationNodeModuleFile(`${e}/dist/lib/client/multi-command.js`,["^1.0.0","^5.0.0"],s=>{let i=s?.default?.prototype;return(0,xe.isWrapped)(i?.exec)&&this._unwrap(i,"exec"),this._wrap(i,"exec",this._getPatchMultiCommandsExec(!1)),(0,xe.isWrapped)(i?.execAsPipeline)&&this._unwrap(i,"execAsPipeline"),this._wrap(i,"execAsPipeline",this._getPatchMultiCommandsExec(!0)),(0,xe.isWrapped)(i?.addCommand)&&this._unwrap(i,"addCommand"),this._wrap(i,"addCommand",this._getPatchMultiCommandsAddCommand()),s},s=>{let i=s?.default?.prototype;(0,xe.isWrapped)(i?.exec)&&this._unwrap(i,"exec"),(0,xe.isWrapped)(i?.addCommand)&&this._unwrap(i,"addCommand")}),o=new xe.InstrumentationNodeModuleFile(`${e}/dist/lib/client/index.js`,["^1.0.0","^5.0.0"],s=>{let i=s?.default?.prototype;return i?.multi&&((0,xe.isWrapped)(i?.multi)&&this._unwrap(i,"multi"),this._wrap(i,"multi",this._getPatchRedisClientMulti())),i?.MULTI&&((0,xe.isWrapped)(i?.MULTI)&&this._unwrap(i,"MULTI"),this._wrap(i,"MULTI",this._getPatchRedisClientMulti())),(0,xe.isWrapped)(i?.sendCommand)&&this._unwrap(i,"sendCommand"),this._wrap(i,"sendCommand",this._getPatchRedisClientSendCommand()),this._wrap(i,"connect",this._getPatchedClientConnect()),s},s=>{let i=s?.default?.prototype;(0,xe.isWrapped)(i?.multi)&&this._unwrap(i,"multi"),(0,xe.isWrapped)(i?.MULTI)&&this._unwrap(i,"MULTI"),(0,xe.isWrapped)(i?.sendCommand)&&this._unwrap(i,"sendCommand")});return new xe.InstrumentationNodeModuleDefinition(e,["^1.0.0","^5.0.0"],s=>s,()=>{},[n,r,o])}_getPatchExtendWithCommands(e){let n=this;return function(o){return function(i){if(i?.BaseClass?.name!=="RedisClient")return o.apply(this,arguments);let a=i.executor;return i.executor=function(c,l){let p=e(c,l).args;return n._traceClientCommand(a,this,arguments,p)},o.apply(this,arguments)}}}_getPatchMultiCommandsExec(e){let n=this;return function(o){return function(){let i=o.apply(this,arguments);return typeof i?.then!="function"?(n._diag.error("non-promise result when patching exec/execAsPipeline"),i):i.then(a=>{let c=this[Rd];return n._endSpansWithRedisReplies(c,a,e),a}).catch(a=>{let c=this[Rd];if(!c)n._diag.error("cannot find open spans to end for multi/pipeline");else{let l=a.constructor.name==="MultiErrorReply"?a.replies:new Array(c.length).fill(a);n._endSpansWithRedisReplies(c,l,e)}return Promise.reject(a)})}}}_getPatchMultiCommandsAddCommand(){let e=this;return function(r){return function(s){return e._traceClientCommand(r,this,arguments,s)}}}_getPatchRedisClientMulti(){return function(n){return function(){let o=n.apply(this,arguments);return o[az]=this.options,o}}}_getPatchRedisClientSendCommand(){let e=this;return function(r){return function(s){return e._traceClientCommand(r,this,arguments,s)}}}_getPatchedClientConnect(){let e=this;return function(r){return function(){let s=this.options,i=(0,sz.getClientAttributes)(e._diag,s,e._semconvStability),a=e.tracer.startSpan(`${t.COMPONENT}-connect`,{kind:_r.SpanKind.CLIENT,attributes:i});return _r.context.with(_r.trace.setSpan(_r.context.active(),a),()=>r.apply(this)).then(l=>(a.end(),l)).catch(l=>(a.recordException(l),a.setStatus({code:_r.SpanStatusCode.ERROR,message:l.message}),a.end(),Promise.reject(l)))}}}_traceClientCommand(e,n,r,o){if(_r.trace.getSpan(_r.context.active())===void 0&&this.getConfig().requireParentSpan)return e.apply(n,r);let i=n.options||n[az],a=o[0],c=o.slice(1),l=this.getConfig().dbStatementSerializer||Vge.defaultDbStatementSerializer,p=(0,sz.getClientAttributes)(this._diag,i,this._semconvStability);this._semconvStability&xe.SemconvStability.STABLE&&(p[KN.ATTR_DB_OPERATION_NAME]=a);try{let f=l(a,c);f!=null&&(this._semconvStability&xe.SemconvStability.OLD&&(p[qge.ATTR_DB_STATEMENT]=f),this._semconvStability&xe.SemconvStability.STABLE&&(p[KN.ATTR_DB_QUERY_TEXT]=f))}catch(f){this._diag.error("dbStatementSerializer throw an exception",f,{commandName:a})}let d=this.tracer.startSpan(`${t.COMPONENT}-${a}`,{kind:_r.SpanKind.CLIENT,attributes:p}),_=_r.context.with(_r.trace.setSpan(_r.context.active(),d),()=>e.apply(n,r));if(typeof _?.then=="function")_.then(f=>{this._endSpanWithResponse(d,a,c,f,void 0)},f=>{this._endSpanWithResponse(d,a,c,null,f)});else{let f=_;f[Rd]=f[Rd]||[],f[Rd].push({span:d,commandName:a,commandArgs:c})}return _}_endSpansWithRedisReplies(e,n,r=!1){if(!e)return this._diag.error("cannot find open spans to end for redis multi/pipeline");if(n.length!==e.length)return this._diag.error("number of multi command spans does not match response from redis");let o=e.map(a=>a.commandName),i=o.every(a=>a===o[0])?(r?"PIPELINE ":"MULTI ")+o[0]:r?"PIPELINE":"MULTI";for(let a=0;a<e.length;a++){let{span:c,commandArgs:l}=e[a],p=n[a],[d,_]=p instanceof Error?[null,p]:[p,void 0];this._semconvStability&xe.SemconvStability.STABLE&&c.setAttribute(KN.ATTR_DB_OPERATION_NAME,i),this._endSpanWithResponse(c,o[a],l,d,_)}}_endSpanWithResponse(e,n,r,o,s){let{responseHook:i}=this.getConfig();if(!s&&i)try{i(e,n,r,o)}catch(a){this._diag.error("responseHook throw an exception",a)}s&&(e.recordException(s),e.setStatus({code:_r.SpanStatusCode.ERROR,message:s?.message})),e.end()}};hE.RedisInstrumentationV4_V5=QN});var pz=E(TE=>{"use strict";Object.defineProperty(TE,"__esModule",{value:!0});TE.RedisInstrumentation=void 0;var $ge=ne(),uz=pE(),Yge=nz(),Wge=cz(),lz={requireParentSpan:!1},XN=class extends $ge.InstrumentationBase{instrumentationV2_V3;instrumentationV4_V5;initialized=!1;constructor(e={}){let n={...lz,...e};super(uz.PACKAGE_NAME,uz.PACKAGE_VERSION,n),this.instrumentationV2_V3=new Yge.RedisInstrumentationV2_V3(this.getConfig()),this.instrumentationV4_V5=new Wge.RedisInstrumentationV4_V5(this.getConfig()),this.initialized=!0}setConfig(e={}){let n={...lz,...e};super.setConfig(n),this.initialized&&(this.instrumentationV2_V3.setConfig(n),this.instrumentationV4_V5.setConfig(n))}init(){}getModuleDefinitions(){return[...this.instrumentationV2_V3.getModuleDefinitions(),...this.instrumentationV4_V5.getModuleDefinitions()]}setTracerProvider(e){super.setTracerProvider(e),this.initialized&&(this.instrumentationV2_V3.setTracerProvider(e),this.instrumentationV4_V5.setTracerProvider(e))}enable(){super.enable(),this.initialized&&(this.instrumentationV2_V3.enable(),this.instrumentationV4_V5.enable())}disable(){super.disable(),this.initialized&&(this.instrumentationV2_V3.disable(),this.instrumentationV4_V5.disable())}};TE.RedisInstrumentation=XN});var dz=E(EE=>{"use strict";Object.defineProperty(EE,"__esModule",{value:!0});EE.RedisInstrumentation=void 0;var zge=pz();Object.defineProperty(EE,"RedisInstrumentation",{enumerable:!0,get:function(){return zge.RedisInstrumentation}})});var Rz=E(gE=>{"use strict";Object.defineProperty(gE,"__esModule",{value:!0});gE.EVENT_LISTENERS_SET=void 0;gE.EVENT_LISTENERS_SET=Symbol("opentelemetry.instrumentation.pg.eventListenersSet")});var eb=E(Od=>{"use strict";Object.defineProperty(Od,"__esModule",{value:!0});Od.AttributeNames=void 0;var tAe;(function(t){t.PG_VALUES="db.postgresql.values",t.PG_PLAN="db.postgresql.plan",t.IDLE_TIMEOUT_MILLIS="db.postgresql.idle.timeout.millis",t.MAX_CLIENT="db.postgresql.max.client"})(tAe=Od.AttributeNames||(Od.AttributeNames={}))});var tb=E(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS=Se.METRIC_DB_CLIENT_CONNECTION_COUNT=Se.DB_SYSTEM_VALUE_POSTGRESQL=Se.DB_CLIENT_CONNECTION_STATE_VALUE_USED=Se.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE=Se.ATTR_NET_PEER_PORT=Se.ATTR_NET_PEER_NAME=Se.ATTR_DB_USER=Se.ATTR_DB_SYSTEM=Se.ATTR_DB_STATEMENT=Se.ATTR_DB_NAME=Se.ATTR_DB_CONNECTION_STRING=Se.ATTR_DB_CLIENT_CONNECTION_STATE=Se.ATTR_DB_CLIENT_CONNECTION_POOL_NAME=void 0;Se.ATTR_DB_CLIENT_CONNECTION_POOL_NAME="db.client.connection.pool.name";Se.ATTR_DB_CLIENT_CONNECTION_STATE="db.client.connection.state";Se.ATTR_DB_CONNECTION_STRING="db.connection_string";Se.ATTR_DB_NAME="db.name";Se.ATTR_DB_STATEMENT="db.statement";Se.ATTR_DB_SYSTEM="db.system";Se.ATTR_DB_USER="db.user";Se.ATTR_NET_PEER_NAME="net.peer.name";Se.ATTR_NET_PEER_PORT="net.peer.port";Se.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE="idle";Se.DB_CLIENT_CONNECTION_STATE_VALUE_USED="used";Se.DB_SYSTEM_VALUE_POSTGRESQL="postgresql";Se.METRIC_DB_CLIENT_CONNECTION_COUNT="db.client.connection.count";Se.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS="db.client.connection.pending_requests"});var nb=E(Nd=>{"use strict";Object.defineProperty(Nd,"__esModule",{value:!0});Nd.SpanNames=void 0;var nAe;(function(t){t.QUERY_PREFIX="pg.query",t.CONNECT="pg.connect",t.POOL_CONNECT="pg-pool.connect"})(nAe=Nd.SpanNames||(Nd.SpanNames={}))});var Pz=E(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.sanitizedErrorMessage=me.isObjectWithTextString=me.getErrorMessage=me.patchClientConnectCallback=me.patchCallbackPGPool=me.updateCounter=me.getPoolName=me.patchCallback=me.handleExecutionResult=me.handleConfigQuery=me.shouldSkipInstrumentation=me.getSemanticAttributesFromPoolConnection=me.getSemanticAttributesFromConnection=me.getConnectionString=me.parseAndMaskConnectionString=me.parseNormalizedOperationName=me.getQuerySpanName=void 0;var Zs=(b(),O(v)),AE=eb(),fr=(le(),O(Ae)),Ve=tb(),Sa=ne(),yz=nb();function Iz(t,e){if(!e)return yz.SpanNames.QUERY_PREFIX;let n=typeof e.name=="string"&&e.name?e.name:Oz(e.text);return`${yz.SpanNames.QUERY_PREFIX}:${n}${t?` ${t}`:""}`}me.getQuerySpanName=Iz;function Oz(t){let e=t.trim(),n=e.indexOf(" "),r=n===-1?e:e.slice(0,n);return r=r.toUpperCase(),r.endsWith(";")?r.slice(0,-1):r}me.parseNormalizedOperationName=Oz;function Nz(t){try{let e=new URL(t);return e.username="",e.password="",e.toString()}catch{return"postgresql://localhost:5432/"}}me.parseAndMaskConnectionString=Nz;function rb(t){if("connectionString"in t&&t.connectionString)return Nz(t.connectionString);let e=t.host||"localhost",n=t.port||5432,r=t.database||"";return`postgresql://${e}:${n}/${r}`}me.getConnectionString=rb;function RE(t){if(Number.isInteger(t))return t}function bz(t,e){let n={};return e&Sa.SemconvStability.OLD&&(n={...n,[Ve.ATTR_DB_SYSTEM]:Ve.DB_SYSTEM_VALUE_POSTGRESQL,[Ve.ATTR_DB_NAME]:t.database,[Ve.ATTR_DB_CONNECTION_STRING]:rb(t),[Ve.ATTR_DB_USER]:t.user,[Ve.ATTR_NET_PEER_NAME]:t.host,[Ve.ATTR_NET_PEER_PORT]:RE(t.port)}),e&Sa.SemconvStability.STABLE&&(n={...n,[fr.ATTR_DB_SYSTEM_NAME]:fr.DB_SYSTEM_NAME_VALUE_POSTGRESQL,[fr.ATTR_DB_NAMESPACE]:t.namespace,[fr.ATTR_SERVER_ADDRESS]:t.host,[fr.ATTR_SERVER_PORT]:RE(t.port)}),n}me.getSemanticAttributesFromConnection=bz;function rAe(t,e){let n;try{n=t.connectionString?new URL(t.connectionString):void 0}catch{n=void 0}let r={[AE.AttributeNames.IDLE_TIMEOUT_MILLIS]:t.idleTimeoutMillis,[AE.AttributeNames.MAX_CLIENT]:t.maxClient};return e&Sa.SemconvStability.OLD&&(r={...r,[Ve.ATTR_DB_SYSTEM]:Ve.DB_SYSTEM_VALUE_POSTGRESQL,[Ve.ATTR_DB_NAME]:n?.pathname.slice(1)??t.database,[Ve.ATTR_DB_CONNECTION_STRING]:rb(t),[Ve.ATTR_NET_PEER_NAME]:n?.hostname??t.host,[Ve.ATTR_NET_PEER_PORT]:Number(n?.port)||RE(t.port),[Ve.ATTR_DB_USER]:n?.username??t.user}),e&Sa.SemconvStability.STABLE&&(r={...r,[fr.ATTR_DB_SYSTEM_NAME]:fr.DB_SYSTEM_NAME_VALUE_POSTGRESQL,[fr.ATTR_DB_NAMESPACE]:t.namespace,[fr.ATTR_SERVER_ADDRESS]:n?.hostname??t.host,[fr.ATTR_SERVER_PORT]:Number(n?.port)||RE(t.port)}),r}me.getSemanticAttributesFromPoolConnection=rAe;function oAe(t){return t.requireParentSpan===!0&&Zs.trace.getSpan(Zs.context.active())===void 0}me.shouldSkipInstrumentation=oAe;function sAe(t,e,n,r){let{connectionParameters:o}=this,s=o.database,i=Iz(s,r),a=t.startSpan(i,{kind:Zs.SpanKind.CLIENT,attributes:bz(o,n)});if(!r)return a;if(r.text&&(n&Sa.SemconvStability.OLD&&a.setAttribute(Ve.ATTR_DB_STATEMENT,r.text),n&Sa.SemconvStability.STABLE&&a.setAttribute(fr.ATTR_DB_QUERY_TEXT,r.text)),e.enhancedDatabaseReporting&&Array.isArray(r.values))try{let c=r.values.map(l=>l==null?"null":l instanceof Buffer?l.toString():typeof l=="object"?typeof l.toPostgres=="function"?l.toPostgres():JSON.stringify(l):l.toString());a.setAttribute(AE.AttributeNames.PG_VALUES,c)}catch(c){Zs.diag.error("failed to stringify ",r.values,c)}return typeof r.name=="string"&&a.setAttribute(AE.AttributeNames.PG_PLAN,r.name),a}me.handleConfigQuery=sAe;function Cz(t,e,n){typeof t.responseHook=="function"&&(0,Sa.safeExecuteInTheMiddle)(()=>{t.responseHook(e,{data:n})},r=>{r&&Zs.diag.error("Error running response hook",r)},!0)}me.handleExecutionResult=Cz;function iAe(t,e,n,r,o){return function(i,a){i?(Object.prototype.hasOwnProperty.call(i,"code")&&(r[fr.ATTR_ERROR_TYPE]=i.code),i instanceof Error&&e.recordException(yE(i)),e.setStatus({code:Zs.SpanStatusCode.ERROR,message:i.message})):Cz(t,e,a),o(),e.end(),n.call(this,i,a)}}me.patchCallback=iAe;function aAe(t){let e="";return e+=(t?.host?`${t.host}`:"unknown_host")+":",e+=(t?.port?`${t.port}`:"unknown_port")+"/",e+=t?.database?`${t.database}`:"unknown_database",e.trim()}me.getPoolName=aAe;function cAe(t,e,n,r,o){let s=e.totalCount,i=e.waitingCount,a=e.idleCount,c=s-a;return n.add(c-o.used,{[Ve.ATTR_DB_CLIENT_CONNECTION_STATE]:Ve.DB_CLIENT_CONNECTION_STATE_VALUE_USED,[Ve.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),n.add(a-o.idle,{[Ve.ATTR_DB_CLIENT_CONNECTION_STATE]:Ve.DB_CLIENT_CONNECTION_STATE_VALUE_IDLE,[Ve.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),r.add(i-o.pending,{[Ve.ATTR_DB_CLIENT_CONNECTION_POOL_NAME]:t}),{used:c,idle:a,pending:i}}me.updateCounter=cAe;function uAe(t,e){return function(r,o,s){r&&(r instanceof Error&&t.recordException(yE(r)),t.setStatus({code:Zs.SpanStatusCode.ERROR,message:r.message})),t.end(),e.call(this,r,o,s)}}me.patchCallbackPGPool=uAe;function lAe(t,e){return function(r){r&&(r instanceof Error&&t.recordException(yE(r)),t.setStatus({code:Zs.SpanStatusCode.ERROR,message:r.message})),t.end(),e.apply(this,arguments)}}me.patchClientConnectCallback=lAe;function pAe(t){return typeof t=="object"&&t!==null&&"message"in t?String(t.message):void 0}me.getErrorMessage=pAe;function dAe(t){return typeof t=="object"&&typeof t?.text=="string"}me.isObjectWithTextString=dAe;function yE(t){let e=t?.name??"PostgreSQLError",n=t?.code??"UNKNOWN";return`PostgreSQL error of type '${e}' occurred (code: ${n})`}me.sanitizedErrorMessage=yE});var Mz=E(Gu=>{"use strict";Object.defineProperty(Gu,"__esModule",{value:!0});Gu.PACKAGE_NAME=Gu.PACKAGE_VERSION=void 0;Gu.PACKAGE_VERSION="0.66.0";Gu.PACKAGE_NAME="@opentelemetry/instrumentation-pg"});var wz=E(OE=>{"use strict";Object.defineProperty(OE,"__esModule",{value:!0});OE.PgInstrumentation=void 0;var mn=ne(),Ie=(b(),O(v)),xz=Rz(),ke=Pz(),vz=jN(),Lz=Mz(),Dz=nb(),IE=Te(),wr=(le(),O(Ae)),bd=tb();function Bu(t){return t[Symbol.toStringTag]==="Module"?t.default:t}var ob=class extends mn.InstrumentationBase{_connectionsCounter={used:0,idle:0,pending:0};_semconvStability;constructor(e={}){super(Lz.PACKAGE_NAME,Lz.PACKAGE_VERSION,e),this._semconvStability=(0,mn.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}_updateMetricInstruments(){this._operationDuration=this.meter.createHistogram(wr.METRIC_DB_CLIENT_OPERATION_DURATION,{description:"Duration of database client operations.",unit:"s",valueType:Ie.ValueType.DOUBLE,advice:{explicitBucketBoundaries:[.001,.005,.01,.05,.1,.5,1,5,10]}}),this._connectionsCounter={idle:0,pending:0,used:0},this._connectionsCount=this.meter.createUpDownCounter(bd.METRIC_DB_CLIENT_CONNECTION_COUNT,{description:"The number of connections that are currently in state described by the state attribute.",unit:"{connection}"}),this._connectionPendingRequests=this.meter.createUpDownCounter(bd.METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS,{description:"The number of current pending requests for an open connection.",unit:"{connection}"})}init(){let e=[">=8.0.3 <9"],n=[">=2.0.0 <4"],r=new mn.InstrumentationNodeModuleFile("pg/lib/native/client.js",e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),o=new mn.InstrumentationNodeModuleFile("pg/lib/client.js",e,this._patchPgClient.bind(this),this._unpatchPgClient.bind(this)),s=new mn.InstrumentationNodeModuleDefinition("pg",e,a=>{let c=Bu(a);return this._patchPgClient(c.Client),a},a=>{let c=Bu(a);return this._unpatchPgClient(c.Client),a},[o,r]),i=new mn.InstrumentationNodeModuleDefinition("pg-pool",n,a=>{let c=Bu(a);return(0,mn.isWrapped)(c.prototype.connect)&&this._unwrap(c.prototype,"connect"),this._wrap(c.prototype,"connect",this._getPoolConnectPatch()),c},a=>{let c=Bu(a);(0,mn.isWrapped)(c.prototype.connect)&&this._unwrap(c.prototype,"connect")});return[s,i]}_patchPgClient(e){if(!e)return;let n=Bu(e);return(0,mn.isWrapped)(n.prototype.query)&&this._unwrap(n.prototype,"query"),(0,mn.isWrapped)(n.prototype.connect)&&this._unwrap(n.prototype,"connect"),this._wrap(n.prototype,"query",this._getClientQueryPatch()),this._wrap(n.prototype,"connect",this._getClientConnectPatch()),e}_unpatchPgClient(e){let n=Bu(e);return(0,mn.isWrapped)(n.prototype.query)&&this._unwrap(n.prototype,"query"),(0,mn.isWrapped)(n.prototype.connect)&&this._unwrap(n.prototype,"connect"),e}_getClientConnectPatch(){let e=this;return n=>function(o){let s=e.getConfig();if(ke.shouldSkipInstrumentation(s)||s.ignoreConnectSpans)return n.call(this,o);let i=e.tracer.startSpan(Dz.SpanNames.CONNECT,{kind:Ie.SpanKind.CLIENT,attributes:ke.getSemanticAttributesFromConnection(this,e._semconvStability)});if(o){let c=Ie.trace.getSpan(Ie.context.active());o=ke.patchClientConnectCallback(i,o),c&&(o=Ie.context.bind(Ie.context.active(),o))}let a=Ie.context.with(Ie.trace.setSpan(Ie.context.active(),i),()=>n.call(this,o));return Uz(i,a)}}recordOperationDuration(e,n){let r={},o=[wr.ATTR_DB_NAMESPACE,wr.ATTR_ERROR_TYPE,wr.ATTR_SERVER_PORT,wr.ATTR_SERVER_ADDRESS,wr.ATTR_DB_OPERATION_NAME];this._semconvStability&mn.SemconvStability.OLD&&o.push(bd.ATTR_DB_SYSTEM),this._semconvStability&mn.SemconvStability.STABLE&&o.push(wr.ATTR_DB_SYSTEM_NAME),o.forEach(i=>{i in e&&(r[i]=e[i])});let s=(0,IE.hrTimeToMilliseconds)((0,IE.hrTimeDuration)(n,(0,IE.hrTime)()))/1e3;this._operationDuration.record(s,r)}_getClientQueryPatch(){let e=this;return n=>(this._diag.debug("Patching pg.Client.prototype.query"),function(...o){if(ke.shouldSkipInstrumentation(e.getConfig()))return n.apply(this,o);let s=(0,IE.hrTime)(),i=o[0],a=typeof i=="string",c=ke.isObjectWithTextString(i),l=a?{text:i,values:Array.isArray(o[1])?o[1]:void 0}:c?{...i,name:i.name,text:i.text,values:i.values??(Array.isArray(o[1])?o[1]:void 0)}:void 0,p={[bd.ATTR_DB_SYSTEM]:bd.DB_SYSTEM_VALUE_POSTGRESQL,[wr.ATTR_DB_NAMESPACE]:this.database,[wr.ATTR_SERVER_PORT]:this.connectionParameters.port,[wr.ATTR_SERVER_ADDRESS]:this.connectionParameters.host};l?.text&&(p[wr.ATTR_DB_OPERATION_NAME]=ke.parseNormalizedOperationName(l?.text));let d=()=>{e.recordOperationDuration(p,s)},_=e.getConfig(),f=ke.handleConfigQuery.call(this,e.tracer,_,e._semconvStability,l);if(_.addSqlCommenterCommentToQueries&&(a?o[0]=(0,vz.addSqlCommenterComment)(f,i):c&&!("name"in i)&&(o[0]={...i,text:(0,vz.addSqlCommenterComment)(f,i.text)})),o.length>0){let T=Ie.trace.getSpan(Ie.context.active());if(typeof o[o.length-1]=="function")o[o.length-1]=ke.patchCallback(_,f,o[o.length-1],p,d),T&&(o[o.length-1]=Ie.context.bind(Ie.context.active(),o[o.length-1]));else if(typeof l?.callback=="function"){let S=ke.patchCallback(e.getConfig(),f,l.callback,p,d);T&&(S=Ie.context.bind(Ie.context.active(),S)),o[0].callback=S}}let{requestHook:m}=_;typeof m=="function"&&l&&(0,mn.safeExecuteInTheMiddle)(()=>{let{database:T,host:S,port:R,user:I}=this.connectionParameters;m(f,{connection:{database:T,host:S,port:R,user:I},query:{text:l.text,values:l.values,name:l.name}})},T=>{T&&e._diag.error("Error running query hook",T)},!0);let h;try{h=n.apply(this,o)}catch(T){throw T instanceof Error&&f.recordException(ke.sanitizedErrorMessage(T)),f.setStatus({code:Ie.SpanStatusCode.ERROR,message:ke.getErrorMessage(T)}),f.end(),T}return h instanceof Promise?h.then(T=>new Promise(S=>{ke.handleExecutionResult(e.getConfig(),f,T),d(),f.end(),S(T)})).catch(T=>new Promise((S,R)=>{T instanceof Error&&f.recordException(ke.sanitizedErrorMessage(T)),f.setStatus({code:Ie.SpanStatusCode.ERROR,message:T.message}),d(),f.end(),R(T)})):h})}_setPoolConnectEventListeners(e){if(e[xz.EVENT_LISTENERS_SET])return;let n=ke.getPoolName(e.options);e.on("connect",()=>{this._connectionsCounter=ke.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("acquire",()=>{this._connectionsCounter=ke.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("remove",()=>{this._connectionsCounter=ke.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e.on("release",()=>{this._connectionsCounter=ke.updateCounter(n,e,this._connectionsCount,this._connectionPendingRequests,this._connectionsCounter)}),e[xz.EVENT_LISTENERS_SET]=!0}_getPoolConnectPatch(){let e=this;return n=>function(o){let s=e.getConfig();if(ke.shouldSkipInstrumentation(s))return n.call(this,o);if(e._setPoolConnectEventListeners(this),s.ignoreConnectSpans)return n.call(this,o);let i=e.tracer.startSpan(Dz.SpanNames.POOL_CONNECT,{kind:Ie.SpanKind.CLIENT,attributes:ke.getSemanticAttributesFromPoolConnection(this.options,e._semconvStability)});if(o){let c=Ie.trace.getSpan(Ie.context.active());o=ke.patchCallbackPGPool(i,o),c&&(o=Ie.context.bind(Ie.context.active(),o))}let a=Ie.context.with(Ie.trace.setSpan(Ie.context.active(),i),()=>n.call(this,o));return Uz(i,a)}}};OE.PgInstrumentation=ob;function Uz(t,e){if(!(e instanceof Promise))return e;let n=e;return Ie.context.bind(Ie.context.active(),n.then(r=>(t.end(),r)).catch(r=>(r instanceof Error&&t.recordException(ke.sanitizedErrorMessage(r)),t.setStatus({code:Ie.SpanStatusCode.ERROR,message:ke.getErrorMessage(r)}),t.end(),Promise.reject(r))))}});var kz=E(ju=>{"use strict";Object.defineProperty(ju,"__esModule",{value:!0});ju.AttributeNames=ju.PgInstrumentation=void 0;var _Ae=wz();Object.defineProperty(ju,"PgInstrumentation",{enumerable:!0,get:function(){return _Ae.PgInstrumentation}});var fAe=eb();Object.defineProperty(ju,"AttributeNames",{enumerable:!0,get:function(){return fAe.AttributeNames}})});var $z=E(Cd=>{"use strict";Object.defineProperty(Cd,"__esModule",{value:!0});Cd.SeverityNumber=void 0;var SAe;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TRACE=1]="TRACE",t[t.TRACE2=2]="TRACE2",t[t.TRACE3=3]="TRACE3",t[t.TRACE4=4]="TRACE4",t[t.DEBUG=5]="DEBUG",t[t.DEBUG2=6]="DEBUG2",t[t.DEBUG3=7]="DEBUG3",t[t.DEBUG4=8]="DEBUG4",t[t.INFO=9]="INFO",t[t.INFO2=10]="INFO2",t[t.INFO3=11]="INFO3",t[t.INFO4=12]="INFO4",t[t.WARN=13]="WARN",t[t.WARN2=14]="WARN2",t[t.WARN3=15]="WARN3",t[t.WARN4=16]="WARN4",t[t.ERROR=17]="ERROR",t[t.ERROR2=18]="ERROR2",t[t.ERROR3=19]="ERROR3",t[t.ERROR4=20]="ERROR4",t[t.FATAL=21]="FATAL",t[t.FATAL2=22]="FATAL2",t[t.FATAL3=23]="FATAL3",t[t.FATAL4=24]="FATAL4"})(SAe=Cd.SeverityNumber||(Cd.SeverityNumber={}))});var bE=E(Hu=>{"use strict";Object.defineProperty(Hu,"__esModule",{value:!0});Hu.NOOP_LOGGER=Hu.NoopLogger=void 0;var NE=class{emit(e){}};Hu.NoopLogger=NE;Hu.NOOP_LOGGER=new NE});var PE=E(Fu=>{"use strict";Object.defineProperty(Fu,"__esModule",{value:!0});Fu.NOOP_LOGGER_PROVIDER=Fu.NoopLoggerProvider=void 0;var gAe=bE(),CE=class{getLogger(e,n,r){return new gAe.NoopLogger}};Fu.NoopLoggerProvider=CE;Fu.NOOP_LOGGER_PROVIDER=new CE});var cb=E(ME=>{"use strict";Object.defineProperty(ME,"__esModule",{value:!0});ME.ProxyLogger=void 0;var AAe=bE(),ab=class{constructor(e,n,r,o){this._provider=e,this.name=n,this.version=r,this.options=o}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):AAe.NOOP_LOGGER}};ME.ProxyLogger=ab});var lb=E(xE=>{"use strict";Object.defineProperty(xE,"__esModule",{value:!0});xE.ProxyLoggerProvider=void 0;var RAe=PE(),yAe=cb(),ub=class{getLogger(e,n,r){var o;return(o=this._getDelegateLogger(e,n,r))!==null&&o!==void 0?o:new yAe.ProxyLogger(this,e,n,r)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:RAe.NOOP_LOGGER_PROVIDER}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,n,r){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(e,n,r)}};xE.ProxyLoggerProvider=ub});var Yz=E(vE=>{"use strict";Object.defineProperty(vE,"__esModule",{value:!0});vE._globalThis=void 0;vE._globalThis=typeof globalThis=="object"?globalThis:global});var Wz=E(LE=>{"use strict";Object.defineProperty(LE,"__esModule",{value:!0});LE._globalThis=void 0;var IAe=Yz();Object.defineProperty(LE,"_globalThis",{enumerable:!0,get:function(){return IAe._globalThis}})});var zz=E(DE=>{"use strict";Object.defineProperty(DE,"__esModule",{value:!0});DE._globalThis=void 0;var OAe=Wz();Object.defineProperty(DE,"_globalThis",{enumerable:!0,get:function(){return OAe._globalThis}})});var Kz=E(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});_o.API_BACKWARDS_COMPATIBILITY_VERSION=_o.makeGetter=_o._global=_o.GLOBAL_LOGS_API_KEY=void 0;var NAe=zz();_o.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");_o._global=NAe._globalThis;function bAe(t,e,n){return r=>r===t?e:n}_o.makeGetter=bAe;_o.API_BACKWARDS_COMPATIBILITY_VERSION=1});var Xz=E(UE=>{"use strict";Object.defineProperty(UE,"__esModule",{value:!0});UE.LogsAPI=void 0;var mr=Kz(),CAe=PE(),Qz=lb(),pb=class t{constructor(){this._proxyLoggerProvider=new Qz.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return mr._global[mr.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(mr._global[mr.GLOBAL_LOGS_API_KEY]=(0,mr.makeGetter)(mr.API_BACKWARDS_COMPATIBILITY_VERSION,e,CAe.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,n;return(n=(e=mr._global[mr.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(mr._global,mr.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&n!==void 0?n:this._proxyLoggerProvider}getLogger(e,n,r){return this.getLoggerProvider().getLogger(e,n,r)}disable(){delete mr._global[mr.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new Qz.ProxyLoggerProvider}};UE.LogsAPI=pb});var db=E(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.logs=Pt.ProxyLoggerProvider=Pt.ProxyLogger=Pt.NoopLoggerProvider=Pt.NOOP_LOGGER_PROVIDER=Pt.NoopLogger=Pt.NOOP_LOGGER=Pt.SeverityNumber=void 0;var PAe=$z();Object.defineProperty(Pt,"SeverityNumber",{enumerable:!0,get:function(){return PAe.SeverityNumber}});var Jz=bE();Object.defineProperty(Pt,"NOOP_LOGGER",{enumerable:!0,get:function(){return Jz.NOOP_LOGGER}});Object.defineProperty(Pt,"NoopLogger",{enumerable:!0,get:function(){return Jz.NoopLogger}});var Zz=PE();Object.defineProperty(Pt,"NOOP_LOGGER_PROVIDER",{enumerable:!0,get:function(){return Zz.NOOP_LOGGER_PROVIDER}});Object.defineProperty(Pt,"NoopLoggerProvider",{enumerable:!0,get:function(){return Zz.NoopLoggerProvider}});var MAe=cb();Object.defineProperty(Pt,"ProxyLogger",{enumerable:!0,get:function(){return MAe.ProxyLogger}});var xAe=lb();Object.defineProperty(Pt,"ProxyLoggerProvider",{enumerable:!0,get:function(){return xAe.ProxyLoggerProvider}});var vAe=Xz();Pt.logs=vAe.LogsAPI.getInstance()});var eK=E(Vu=>{"use strict";Object.defineProperty(Vu,"__esModule",{value:!0});Vu.disableInstrumentations=Vu.enableInstrumentations=void 0;function LAe(t,e,n,r){for(let o=0,s=t.length;o<s;o++){let i=t[o];e&&i.setTracerProvider(e),n&&i.setMeterProvider(n),r&&i.setLoggerProvider&&i.setLoggerProvider(r),i.getConfig().enabled||i.enable()}}Vu.enableInstrumentations=LAe;function DAe(t){t.forEach(e=>e.disable())}Vu.disableInstrumentations=DAe});var rK=E(wE=>{"use strict";Object.defineProperty(wE,"__esModule",{value:!0});wE.registerInstrumentations=void 0;var tK=(b(),O(v)),UAe=db(),nK=eK();function wAe(t){let e=t.tracerProvider||tK.trace.getTracerProvider(),n=t.meterProvider||tK.metrics.getMeterProvider(),r=t.loggerProvider||UAe.logs.getLoggerProvider(),o=t.instrumentations?.flat()??[];return(0,nK.enableInstrumentations)(o,e,n,r),()=>{(0,nK.disableInstrumentations)(o)}}wE.registerInstrumentations=wAe});var dK=E(kE=>{"use strict";Object.defineProperty(kE,"__esModule",{value:!0});kE.satisfies=void 0;var hb=(b(),O(v)),cK=/^(?:v)?(?<version>(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*))(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<build>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,kAe=/^(?<op><|>|=|==|<=|>=|~|\^|~>)?\s*(?:v)?(?<version>(?<major>x|X|\*|0|[1-9]\d*)(?:\.(?<minor>x|X|\*|0|[1-9]\d*))?(?:\.(?<patch>x|X|\*|0|[1-9]\d*))?)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<build>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,GAe={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]};function BAe(t,e,n){if(!jAe(t))return hb.diag.error(`Invalid version: ${t}`),!1;if(!e)return!0;e=e.replace(/([<>=~^]+)\s+/g,"$1");let r=qAe(t);if(!r)return!1;let o=[],s=uK(r,e,o,n);return s&&!n?.includePrerelease?FAe(r,o):s}kE.satisfies=BAe;function jAe(t){return typeof t=="string"&&cK.test(t)}function uK(t,e,n,r){if(e.includes("||")){let o=e.trim().split("||");for(let s of o)if(_b(t,s,n,r))return!0;return!1}else if(e.includes(" - "))e=pRe(e,r);else if(e.includes(" ")){let o=e.trim().replace(/\s{2,}/g," ").split(" ");for(let s of o)if(!_b(t,s,n,r))return!1;return!0}return _b(t,e,n,r)}function _b(t,e,n,r){if(e=VAe(e,r),e.includes(" "))return uK(t,e,n,r);{let o=$Ae(e);return n.push(o),HAe(t,o)}}function HAe(t,e){if(e.invalid)return!1;if(!e.version||mb(e.version))return!0;let n=sK(t.versionSegments||[],e.versionSegments||[]);if(n===0){let r=t.prereleaseSegments||[],o=e.prereleaseSegments||[];!r.length&&!o.length?n=0:!r.length&&o.length?n=1:r.length&&!o.length?n=-1:n=sK(r,o)}return GAe[e.op]?.includes(n)}function FAe(t,e){return t.prerelease?e.some(n=>n.prerelease&&n.version===t.version):!0}function VAe(t,e){return t=t.trim(),t=uRe(t,e),t=cRe(t),t=lRe(t,e),t=t.trim(),t}function hn(t){return!t||t.toLowerCase()==="x"||t==="*"}function qAe(t){let e=t.match(cK);if(!e){hb.diag.error(`Invalid version: ${t}`);return}let n=e.groups.version,r=e.groups.prerelease,o=e.groups.build,s=n.split("."),i=r?.split(".");return{op:void 0,version:n,versionSegments:s,versionSegmentCount:s.length,prerelease:r,prereleaseSegments:i,prereleaseSegmentCount:i?i.length:0,build:o}}function $Ae(t){if(!t)return{};let e=t.match(kAe);if(!e)return hb.diag.error(`Invalid range: ${t}`),{invalid:!0};let n=e.groups.op,r=e.groups.version,o=e.groups.prerelease,s=e.groups.build,i=r.split("."),a=o?.split(".");return n==="=="&&(n="="),{op:n||"=",version:r,versionSegments:i,versionSegmentCount:i.length,prerelease:o,prereleaseSegments:a,prereleaseSegmentCount:a?a.length:0,build:s}}function mb(t){return t==="*"||t==="x"||t==="X"}function oK(t){let e=parseInt(t,10);return isNaN(e)?t:e}function YAe(t,e){if(typeof t==typeof e){if(typeof t=="number")return[t,e];if(typeof t=="string")return[t,e];throw new Error("Version segments can only be strings or numbers")}else return[String(t),String(e)]}function WAe(t,e){if(mb(t)||mb(e))return 0;let[n,r]=YAe(oK(t),oK(e));return n>r?1:n<r?-1:0}function sK(t,e){for(let n=0;n<Math.max(t.length,e.length);n++){let r=WAe(t[n]||"0",e[n]||"0");if(r!==0)return r}return 0}var lK="[a-zA-Z0-9-]",pK="0|[1-9]\\d*",zAe=`\\d*[a-zA-Z-]${lK}*`,KAe="((?:<|>)?=?)",iK=`(?:${pK}|${zAe})`,QAe=`(?:-(${iK}(?:\\.${iK})*))`,aK=`${lK}+`,XAe=`(?:\\+(${aK}(?:\\.${aK})*))`,fb=`${pK}|x|X|\\*`,Pd=`[v=\\s]*(${fb})(?:\\.(${fb})(?:\\.(${fb})(?:${QAe})?${XAe}?)?)?`,JAe=`^${KAe}\\s*${Pd}$`,ZAe=new RegExp(JAe),eRe=`^\\s*(${Pd})\\s+-\\s+(${Pd})\\s*$`,tRe=new RegExp(eRe),nRe="(?:~>?)",rRe=`^${nRe}${Pd}$`,oRe=new RegExp(rRe),sRe="(?:\\^)",iRe=`^${sRe}${Pd}$`,aRe=new RegExp(iRe);function cRe(t){let e=oRe;return t.replace(e,(n,r,o,s,i)=>{let a;return hn(r)?a="":hn(o)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:hn(s)?a=`>=${r}.${o}.0 <${r}.${+o+1}.0-0`:i?a=`>=${r}.${o}.${s}-${i} <${r}.${+o+1}.0-0`:a=`>=${r}.${o}.${s} <${r}.${+o+1}.0-0`,a})}function uRe(t,e){let n=aRe,r=e?.includePrerelease?"-0":"";return t.replace(n,(o,s,i,a,c)=>{let l;return hn(s)?l="":hn(i)?l=`>=${s}.0.0${r} <${+s+1}.0.0-0`:hn(a)?s==="0"?l=`>=${s}.${i}.0${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.0${r} <${+s+1}.0.0-0`:c?s==="0"?i==="0"?l=`>=${s}.${i}.${a}-${c} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a}-${c} <${+s+1}.0.0-0`:s==="0"?i==="0"?l=`>=${s}.${i}.${a}${r} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}${r} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a} <${+s+1}.0.0-0`,l})}function lRe(t,e){let n=ZAe;return t.replace(n,(r,o,s,i,a,c)=>{let l=hn(s),p=l||hn(i),d=p||hn(a),_=d;return o==="="&&_&&(o=""),c=e?.includePrerelease?"-0":"",l?o===">"||o==="<"?r="<0.0.0-0":r="*":o&&_?(p&&(i=0),a=0,o===">"?(o=">=",p?(s=+s+1,i=0,a=0):(i=+i+1,a=0)):o==="<="&&(o="<",p?s=+s+1:i=+i+1),o==="<"&&(c="-0"),r=`${o+s}.${i}.${a}${c}`):p?r=`>=${s}.0.0${c} <${+s+1}.0.0-0`:d&&(r=`>=${s}.${i}.0${c} <${s}.${+i+1}.0-0`),r})}function pRe(t,e){let n=tRe;return t.replace(n,(r,o,s,i,a,c,l,p,d,_,f,m)=>(hn(s)?o="":hn(i)?o=`>=${s}.0.0${e?.includePrerelease?"-0":""}`:hn(a)?o=`>=${s}.${i}.0${e?.includePrerelease?"-0":""}`:c?o=`>=${o}`:o=`>=${o}${e?.includePrerelease?"-0":""}`,hn(d)?p="":hn(_)?p=`<${+d+1}.0.0-0`:hn(f)?p=`<${d}.${+_+1}.0-0`:m?p=`<=${d}.${_}.${f}-${m}`:e?.includePrerelease?p=`<${d}.${_}.${+f+1}-0`:p=`<=${p}`,`${o} ${p}`.trim()))}});var Tb=E(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.massUnwrap=Ht.unwrap=Ht.massWrap=Ht.wrap=void 0;var Tn=console.error.bind(console);function Md(t,e,n){let r=!!t[e]&&Object.prototype.propertyIsEnumerable.call(t,e);Object.defineProperty(t,e,{configurable:!0,enumerable:r,writable:!0,value:n})}var dRe=(t,e,n)=>{if(!t||!t[e]){Tn("no original function "+String(e)+" to wrap");return}if(!n){Tn("no wrapper function"),Tn(new Error().stack);return}let r=t[e];if(typeof r!="function"||typeof n!="function"){Tn("original object and wrapper must be functions");return}let o=n(r,e);return Md(o,"__original",r),Md(o,"__unwrap",()=>{t[e]===o&&Md(t,e,r)}),Md(o,"__wrapped",!0),Md(t,e,o),o};Ht.wrap=dRe;var _Re=(t,e,n)=>{if(t)Array.isArray(t)||(t=[t]);else{Tn("must provide one or more modules to patch"),Tn(new Error().stack);return}if(!(e&&Array.isArray(e))){Tn("must provide one or more functions to wrap on modules");return}t.forEach(r=>{e.forEach(o=>{(0,Ht.wrap)(r,o,n)})})};Ht.massWrap=_Re;var fRe=(t,e)=>{if(!t||!t[e]){Tn("no function to unwrap."),Tn(new Error().stack);return}let n=t[e];if(!n.__unwrap)Tn("no original to unwrap to -- has "+String(e)+" already been unwrapped?");else{n.__unwrap();return}};Ht.unwrap=fRe;var mRe=(t,e)=>{if(t)Array.isArray(t)||(t=[t]);else{Tn("must provide one or more modules to patch"),Tn(new Error().stack);return}if(!(e&&Array.isArray(e))){Tn("must provide one or more functions to unwrap on modules");return}t.forEach(n=>{e.forEach(r=>{(0,Ht.unwrap)(n,r)})})};Ht.massUnwrap=mRe;function xd(t){t&&t.logger&&(typeof t.logger!="function"?Tn("new logger isn't a function, not replacing"):Tn=t.logger)}Ht.default=xd;xd.wrap=Ht.wrap;xd.massWrap=Ht.massWrap;xd.unwrap=Ht.unwrap;xd.massUnwrap=Ht.massUnwrap});var _K=E(BE=>{"use strict";Object.defineProperty(BE,"__esModule",{value:!0});BE.InstrumentationAbstract=void 0;var Eb=(b(),O(v)),hRe=db(),GE=Tb(),Sb=class{instrumentationName;instrumentationVersion;_config={};_tracer;_meter;_logger;_diag;constructor(e,n,r){this.instrumentationName=e,this.instrumentationVersion=n,this.setConfig(r),this._diag=Eb.diag.createComponentLogger({namespace:e}),this._tracer=Eb.trace.getTracer(e,n),this._meter=Eb.metrics.getMeter(e,n),this._logger=hRe.logs.getLogger(e,n),this._updateMetricInstruments()}_wrap=GE.wrap;_unwrap=GE.unwrap;_massWrap=GE.massWrap;_massUnwrap=GE.massUnwrap;get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let e=this.init()??[];return Array.isArray(e)?e:[e]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config={enabled:!0,...e}}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,n,r,o){if(e)try{e(r,o)}catch(s){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:n},s)}}};BE.InstrumentationAbstract=Sb});var fK=E(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});ti.ModuleNameTrie=ti.ModuleNameSeparator=void 0;ti.ModuleNameSeparator="/";var jE=class{hooks=[];children=new Map},gb=class{_trie=new jE;_counter=0;insert(e){let n=this._trie;for(let r of e.moduleName.split(ti.ModuleNameSeparator)){let o=n.children.get(r);o||(o=new jE,n.children.set(r,o)),n=o}n.hooks.push({hook:e,insertedId:this._counter++})}search(e,{maintainInsertionOrder:n,fullOnly:r}={}){let o=this._trie,s=[],i=!0;for(let a of e.split(ti.ModuleNameSeparator)){let c=o.children.get(a);if(!c){i=!1;break}r||s.push(...c.hooks),o=c}return r&&i&&s.push(...o.hooks),s.length===0?[]:s.length===1?[s[0].hook]:(n&&s.sort((a,c)=>a.insertedId-c.insertedId),s.map(({hook:a})=>a))}};ti.ModuleNameTrie=gb});var hK=E(HE=>{"use strict";Object.defineProperty(HE,"__esModule",{value:!0});HE.RequireInTheMiddleSingleton=void 0;var TRe=wi(),mK=U("path"),Ab=fK(),ERe=["afterEach","after","beforeEach","before","describe","it"].every(t=>typeof global[t]=="function"),Rb=class t{_moduleNameTrie=new Ab.ModuleNameTrie;static _instance;constructor(){this._initialize()}_initialize(){new TRe.Hook(null,{internals:!0},(e,n,r)=>{let o=SRe(n),s=this._moduleNameTrie.search(o,{maintainInsertionOrder:!0,fullOnly:r===void 0});for(let{onRequire:i}of s)e=i(e,n,r);return e})}register(e,n){let r={moduleName:e,onRequire:n};return this._moduleNameTrie.insert(r),r}static getInstance(){return ERe?new t:this._instance=this._instance??new t}};HE.RequireInTheMiddleSingleton=Rb;function SRe(t){return mK.sep!==Ab.ModuleNameSeparator?t.split(mK.sep).join(Ab.ModuleNameSeparator):t}});var yb=E(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.isWrapped=ni.safeExecuteInTheMiddleAsync=ni.safeExecuteInTheMiddle=void 0;function gRe(t,e,n){let r,o;try{o=t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}ni.safeExecuteInTheMiddle=gRe;async function ARe(t,e,n){let r,o;try{o=await t()}catch(s){r=s}finally{if(e(r,o),r&&!n)throw r;return o}}ni.safeExecuteInTheMiddleAsync=ARe;function RRe(t){return typeof t=="function"&&typeof t.__original=="function"&&typeof t.__unwrap=="function"&&t.__wrapped===!0}ni.isWrapped=RRe});var SK=E(FE=>{"use strict";Object.defineProperty(FE,"__esModule",{value:!0});FE.InstrumentationBase=void 0;var vd=U("path"),TK=U("util"),yRe=dK(),Ib=Tb(),IRe=_K(),ORe=hK(),NRe=oN(),Ld=(b(),O(v)),bRe=wi(),CRe=U("fs"),PRe=yb(),Ob=class extends IRe.InstrumentationAbstract{_modules;_hooks=[];_requireInTheMiddleSingleton=ORe.RequireInTheMiddleSingleton.getInstance();_enabled=!1;constructor(e,n,r){super(e,n,r);let o=this.init();o&&!Array.isArray(o)&&(o=[o]),this._modules=o||[],this._config.enabled&&this.enable()}_wrap=(e,n,r)=>{if((0,PRe.isWrapped)(e[n])&&this._unwrap(e,n),TK.types.isProxy(e)){let o=(0,Ib.wrap)(Object.assign({},e),n,r);return Object.defineProperty(e,n,{value:o}),o}else return(0,Ib.wrap)(e,n,r)};_unwrap=(e,n)=>TK.types.isProxy(e)?Object.defineProperty(e,n,{value:e[n]}):(0,Ib.unwrap)(e,n);_massWrap=(e,n,r)=>{if(e)Array.isArray(e)||(e=[e]);else{Ld.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){Ld.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(o=>{n.forEach(s=>{this._wrap(o,s,r)})})};_massUnwrap=(e,n)=>{if(e)Array.isArray(e)||(e=[e]);else{Ld.diag.error("must provide one or more modules to patch");return}if(!(n&&Array.isArray(n))){Ld.diag.error("must provide one or more functions to wrap on modules");return}e.forEach(r=>{n.forEach(o=>{this._unwrap(r,o)})})};_warnOnPreloadedModules(){this._modules.forEach(e=>{let{name:n}=e;try{let r=U.resolve(n);U.cache[r]&&this._diag.warn(`Module ${n} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${n}`)}catch{}})}_extractPackageVersion(e){try{let n=(0,CRe.readFileSync)(vd.join(e,"package.json"),{encoding:"utf8"}),r=JSON.parse(n).version;return typeof r=="string"?r:void 0}catch{Ld.diag.warn("Failed extracting version",e)}}_onRequire(e,n,r,o){if(!o)return typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for nodejs core module on require hook",{module:e.name}),e.patch(n)):n;let s=this._extractPackageVersion(o);if(e.moduleVersion=s,e.name===r)return EK(e.supportedVersions,s,e.includePrerelease)&&typeof e.patch=="function"&&(e.moduleExports=n,this._enabled)?(this._diag.debug("Applying instrumentation patch for module on require hook",{module:e.name,version:e.moduleVersion,baseDir:o}),e.patch(n,e.moduleVersion)):n;let i=e.files??[],a=vd.normalize(r);return i.filter(l=>l.name===a).filter(l=>EK(l.supportedVersions,s,e.includePrerelease)).reduce((l,p)=>(p.moduleExports=l,this._enabled?(this._diag.debug("Applying instrumentation patch for nodejs module file on require hook",{module:e.name,version:e.moduleVersion,fileName:p.name,baseDir:o}),p.patch(l,e.moduleVersion)):l),n)}enable(){if(!this._enabled){if(this._enabled=!0,this._hooks.length>0){for(let e of this._modules){typeof e.patch=="function"&&e.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module on instrumentation enabled",{module:e.name,version:e.moduleVersion}),e.patch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Applying instrumentation patch for nodejs module file on instrumentation enabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.patch(n.moduleExports,e.moduleVersion))}return}this._warnOnPreloadedModules();for(let e of this._modules){let n=(i,a,c)=>{if(!c&&vd.isAbsolute(a)){let l=vd.parse(a);a=l.name,c=l.dir}return this._onRequire(e,i,a,c)},r=(i,a,c)=>this._onRequire(e,i,a,c),o=vd.isAbsolute(e.name)?new bRe.Hook([e.name],{internals:!0},r):this._requireInTheMiddleSingleton.register(e.name,r);this._hooks.push(o);let s=new NRe.Hook([e.name],{internals:!1},n);this._hooks.push(s)}}}disable(){if(this._enabled){this._enabled=!1;for(let e of this._modules){typeof e.unpatch=="function"&&e.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module on instrumentation disabled",{module:e.name,version:e.moduleVersion}),e.unpatch(e.moduleExports,e.moduleVersion));for(let n of e.files)n.moduleExports&&(this._diag.debug("Removing instrumentation patch for nodejs module file on instrumentation disabled",{module:e.name,version:e.moduleVersion,fileName:n.name}),n.unpatch(n.moduleExports,e.moduleVersion))}}}isEnabled(){return this._enabled}};FE.InstrumentationBase=Ob;function EK(t,e,n){return typeof e>"u"?t.includes("*"):t.some(r=>(0,yRe.satisfies)(e,r,{includePrerelease:n}))}});var gK=E(VE=>{"use strict";Object.defineProperty(VE,"__esModule",{value:!0});VE.normalize=void 0;var MRe=U("path");Object.defineProperty(VE,"normalize",{enumerable:!0,get:function(){return MRe.normalize}})});var AK=E(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});qu.normalize=qu.InstrumentationBase=void 0;var xRe=SK();Object.defineProperty(qu,"InstrumentationBase",{enumerable:!0,get:function(){return xRe.InstrumentationBase}});var vRe=gK();Object.defineProperty(qu,"normalize",{enumerable:!0,get:function(){return vRe.normalize}})});var Nb=E($u=>{"use strict";Object.defineProperty($u,"__esModule",{value:!0});$u.normalize=$u.InstrumentationBase=void 0;var RK=AK();Object.defineProperty($u,"InstrumentationBase",{enumerable:!0,get:function(){return RK.InstrumentationBase}});Object.defineProperty($u,"normalize",{enumerable:!0,get:function(){return RK.normalize}})});var yK=E(qE=>{"use strict";Object.defineProperty(qE,"__esModule",{value:!0});qE.InstrumentationNodeModuleDefinition=void 0;var bb=class{name;supportedVersions;patch;unpatch;files;constructor(e,n,r,o,s){this.name=e,this.supportedVersions=n,this.patch=r,this.unpatch=o,this.files=s||[]}};qE.InstrumentationNodeModuleDefinition=bb});var IK=E($E=>{"use strict";Object.defineProperty($E,"__esModule",{value:!0});$E.InstrumentationNodeModuleFile=void 0;var LRe=Nb(),Cb=class{supportedVersions;patch;unpatch;name;constructor(e,n,r,o){this.supportedVersions=n,this.patch=r,this.unpatch=o,this.name=(0,LRe.normalize)(e)}};$E.InstrumentationNodeModuleFile=Cb});var OK=E(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});ga.semconvStabilityFromStr=ga.SemconvStability=void 0;var YE;(function(t){t[t.STABLE=1]="STABLE",t[t.OLD=2]="OLD",t[t.DUPLICATE=3]="DUPLICATE"})(YE=ga.SemconvStability||(ga.SemconvStability={}));function DRe(t,e){let n=YE.OLD,r=e?.split(",").map(o=>o.trim()).filter(o=>o!=="");for(let o of r??[])if(o.toLowerCase()===t+"/dup"){n=YE.DUPLICATE;break}else o.toLowerCase()===t&&(n=YE.STABLE);return n}ga.semconvStabilityFromStr=DRe});var bK=E(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.semconvStabilityFromStr=ut.SemconvStability=ut.safeExecuteInTheMiddleAsync=ut.safeExecuteInTheMiddle=ut.isWrapped=ut.InstrumentationNodeModuleFile=ut.InstrumentationNodeModuleDefinition=ut.InstrumentationBase=ut.registerInstrumentations=void 0;var URe=rK();Object.defineProperty(ut,"registerInstrumentations",{enumerable:!0,get:function(){return URe.registerInstrumentations}});var wRe=Nb();Object.defineProperty(ut,"InstrumentationBase",{enumerable:!0,get:function(){return wRe.InstrumentationBase}});var kRe=yK();Object.defineProperty(ut,"InstrumentationNodeModuleDefinition",{enumerable:!0,get:function(){return kRe.InstrumentationNodeModuleDefinition}});var GRe=IK();Object.defineProperty(ut,"InstrumentationNodeModuleFile",{enumerable:!0,get:function(){return GRe.InstrumentationNodeModuleFile}});var Pb=yb();Object.defineProperty(ut,"isWrapped",{enumerable:!0,get:function(){return Pb.isWrapped}});Object.defineProperty(ut,"safeExecuteInTheMiddle",{enumerable:!0,get:function(){return Pb.safeExecuteInTheMiddle}});Object.defineProperty(ut,"safeExecuteInTheMiddleAsync",{enumerable:!0,get:function(){return Pb.safeExecuteInTheMiddleAsync}});var NK=OK();Object.defineProperty(ut,"SemconvStability",{enumerable:!0,get:function(){return NK.SemconvStability}});Object.defineProperty(ut,"semconvStabilityFromStr",{enumerable:!0,get:function(){return NK.semconvStabilityFromStr}})});var kK=E(Wu=>{"use strict";Object.defineProperty(Wu,"__esModule",{value:!0});Wu.PACKAGE_NAME=Wu.PACKAGE_VERSION=void 0;Wu.PACKAGE_VERSION="0.60.0";Wu.PACKAGE_NAME="@opentelemetry/instrumentation-hapi"});var Lb=E(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.HapiLifecycleMethodNames=fo.HapiLayerType=fo.handlerPatched=fo.HapiComponentName=void 0;fo.HapiComponentName="@hapi/hapi";fo.handlerPatched=Symbol("hapi-handler-patched");fo.HapiLayerType={ROUTER:"router",PLUGIN:"plugin",EXT:"server.ext"};fo.HapiLifecycleMethodNames=new Set(["onPreAuth","onCredentials","onPostAuth","onPreHandler","onPostHandler","onPreResponse","onRequest"])});var GK=E(zE=>{"use strict";Object.defineProperty(zE,"__esModule",{value:!0});zE.ATTR_HTTP_METHOD=void 0;zE.ATTR_HTTP_METHOD="http.method"});var Db=E(Dd=>{"use strict";Object.defineProperty(Dd,"__esModule",{value:!0});Dd.AttributeNames=void 0;var eye;(function(t){t.HAPI_TYPE="hapi.type",t.PLUGIN_NAME="hapi.plugin.name",t.EXT_TYPE="server.ext.type"})(eye=Dd.AttributeNames||(Dd.AttributeNames={}))});var HK=E(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.getPluginFromInput=lt.getExtMetadata=lt.getRouteMetadata=lt.isPatchableExtMethod=lt.isDirectExtInput=lt.isLifecycleExtEventObj=lt.isLifecycleExtType=lt.getPluginName=void 0;var BK=(le(),O(Ae)),tye=GK(),Ud=Lb(),ri=Db(),jK=ne();function nye(t){return t.name?t.name:t.pkg.name}lt.getPluginName=nye;var rye=t=>typeof t=="string"&&Ud.HapiLifecycleMethodNames.has(t);lt.isLifecycleExtType=rye;var oye=t=>{let e=t?.type;return e!==void 0&&(0,lt.isLifecycleExtType)(e)};lt.isLifecycleExtEventObj=oye;var sye=t=>Array.isArray(t)&&t.length<=3&&(0,lt.isLifecycleExtType)(t[0])&&typeof t[1]=="function";lt.isDirectExtInput=sye;var iye=t=>!Array.isArray(t);lt.isPatchableExtMethod=iye;var aye=(t,e,n)=>{let r={[BK.ATTR_HTTP_ROUTE]:t.path};e&jK.SemconvStability.OLD&&(r[tye.ATTR_HTTP_METHOD]=t.method),e&jK.SemconvStability.STABLE&&(r[BK.ATTR_HTTP_REQUEST_METHOD]=t.method);let o;return n?(r[ri.AttributeNames.HAPI_TYPE]=Ud.HapiLayerType.PLUGIN,r[ri.AttributeNames.PLUGIN_NAME]=n,o=`${n}: route - ${t.path}`):(r[ri.AttributeNames.HAPI_TYPE]=Ud.HapiLayerType.ROUTER,o=`route - ${t.path}`),{attributes:r,name:o}};lt.getRouteMetadata=aye;var cye=(t,e,n)=>{let r=`ext - ${t}`;return n&&n!=="method"&&(r=`ext - ${t} - ${n}`),e?{attributes:{[ri.AttributeNames.EXT_TYPE]:t,[ri.AttributeNames.HAPI_TYPE]:Ud.HapiLayerType.EXT,[ri.AttributeNames.PLUGIN_NAME]:e},name:`${e}: ${r}`}:{attributes:{[ri.AttributeNames.EXT_TYPE]:t,[ri.AttributeNames.HAPI_TYPE]:Ud.HapiLayerType.EXT},name:r}};lt.getExtMetadata=cye;var uye=t=>"plugin"in t?"plugin"in t.plugin?t.plugin.plugin:t.plugin:t;lt.getPluginFromInput=uye});var qK=E(KE=>{"use strict";Object.defineProperty(KE,"__esModule",{value:!0});KE.HapiInstrumentation=void 0;var Wn=(b(),O(v)),FK=Te(),wd=ne(),VK=kK(),kd=Lb(),Qo=HK(),Ub=class extends wd.InstrumentationBase{_semconvStability;constructor(e={}){super(VK.PACKAGE_NAME,VK.PACKAGE_VERSION,e),this._semconvStability=(0,wd.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return new wd.InstrumentationNodeModuleDefinition(kd.HapiComponentName,[">=17.0.0 <22"],e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;return(0,wd.isWrapped)(n.server)||this._wrap(n,"server",this._getServerPatch.bind(this)),(0,wd.isWrapped)(n.Server)||this._wrap(n,"Server",this._getServerPatch.bind(this)),n},e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;this._massUnwrap([n],["server","Server"])})}_getServerPatch(e){let n=this,r=this;return function(s){let i=e.apply(this,[s]);return r._wrap(i,"route",a=>n._getServerRoutePatch.bind(n)(a)),r._wrap(i,"ext",a=>n._getServerExtPatch.bind(n)(a)),r._wrap(i,"register",n._getServerRegisterPatch.bind(n)),i}}_getServerRegisterPatch(e){let n=this;return function(o,s){if(Array.isArray(o))for(let i of o){let a=(0,Qo.getPluginFromInput)(i);n._wrapRegisterHandler(a)}else{let i=(0,Qo.getPluginFromInput)(o);n._wrapRegisterHandler(i)}return e.apply(this,[o,s])}}_getServerExtPatch(e,n){let r=this;return function(...s){if(Array.isArray(s[0])){let i=s[0];for(let a=0;a<i.length;a++){let c=i[a];if((0,Qo.isLifecycleExtType)(c.type)){let l=c,p=r._wrapExtMethods(l.method,c.type,n);l.method=p,i[a]=l}}return e.apply(this,s)}else if((0,Qo.isDirectExtInput)(s)){let i=s,a=i[1],c=r._wrapExtMethods(a,i[0],n);return e.apply(this,[i[0],c,i[2]])}else if((0,Qo.isLifecycleExtEventObj)(s[0])){let i=s[0],a=r._wrapExtMethods(i.method,i.type,n);return i.method=a,e.call(this,i)}return e.apply(this,s)}}_getServerRoutePatch(e,n){let r=this;return function(o){if(Array.isArray(o))for(let s=0;s<o.length;s++){let i=r._wrapRouteHandler.call(r,o[s],n);o[s]=i}else o=r._wrapRouteHandler.call(r,o,n);return e.apply(this,[o])}}_wrapRegisterHandler(e){let n=this,r=(0,Qo.getPluginName)(e),o=e.register,s=this,i=function(a,c){return s._wrap(a,"route",l=>n._getServerRoutePatch.bind(n)(l,r)),s._wrap(a,"ext",l=>n._getServerExtPatch.bind(n)(l,r)),o.call(this,a,c)};e.register=i}_wrapExtMethods(e,n,r){let o=this;if(e instanceof Array){for(let s=0;s<e.length;s++)e[s]=o._wrapExtMethods(e[s],n);return e}else if((0,Qo.isPatchableExtMethod)(e))return e[kd.handlerPatched]===!0?e:(e[kd.handlerPatched]=!0,async function(...i){if(Wn.trace.getSpan(Wn.context.active())===void 0)return await e.apply(this,i);let a=(0,Qo.getExtMetadata)(n,r,e.name),c=o.tracer.startSpan(a.name,{attributes:a.attributes});try{return await Wn.context.with(Wn.trace.setSpan(Wn.context.active(),c),e,void 0,...i)}catch(l){throw c.recordException(l),c.setStatus({code:Wn.SpanStatusCode.ERROR,message:l.message}),l}finally{c.end()}});return e}_wrapRouteHandler(e,n){let r=this;if(e[kd.handlerPatched]===!0)return e;e[kd.handlerPatched]=!0;let o=s=>async function(...i){if(Wn.trace.getSpan(Wn.context.active())===void 0)return await s.call(this,...i);let a=(0,FK.getRPCMetadata)(Wn.context.active());a?.type===FK.RPCType.HTTP&&(a.route=e.path);let c=(0,Qo.getRouteMetadata)(e,r._semconvStability,n),l=r.tracer.startSpan(c.name,{attributes:c.attributes});try{return await Wn.context.with(Wn.trace.setSpan(Wn.context.active(),l),()=>s.call(this,...i))}catch(p){throw l.recordException(p),l.setStatus({code:Wn.SpanStatusCode.ERROR,message:p.message}),p}finally{l.end()}};if(typeof e.handler=="function")e.handler=o(e.handler);else if(typeof e.options=="function"){let s=e.options;e.options=function(i){let a=s(i);return typeof a.handler=="function"&&(a.handler=o(a.handler)),a}}else typeof e.options?.handler=="function"&&(e.options.handler=o(e.options.handler));return e}};KE.HapiInstrumentation=Ub});var $K=E(zu=>{"use strict";Object.defineProperty(zu,"__esModule",{value:!0});zu.AttributeNames=zu.HapiInstrumentation=void 0;var lye=qK();Object.defineProperty(zu,"HapiInstrumentation",{enumerable:!0,get:function(){return lye.HapiInstrumentation}});var pye=Db();Object.defineProperty(zu,"AttributeNames",{enumerable:!0,get:function(){return pye.AttributeNames}})});var JE=E(Bd=>{"use strict";Object.defineProperty(Bd,"__esModule",{value:!0});Bd.KoaLayerType=void 0;var Tye;(function(t){t.ROUTER="router",t.MIDDLEWARE="middleware"})(Tye=Bd.KoaLayerType||(Bd.KoaLayerType={}))});var ZK=E(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});Ku.PACKAGE_NAME=Ku.PACKAGE_VERSION=void 0;Ku.PACKAGE_VERSION="0.62.0";Ku.PACKAGE_NAME="@opentelemetry/instrumentation-koa"});var wb=E(jd=>{"use strict";Object.defineProperty(jd,"__esModule",{value:!0});jd.AttributeNames=void 0;var Eye;(function(t){t.KOA_TYPE="koa.type",t.KOA_NAME="koa.name"})(Eye=jd.AttributeNames||(jd.AttributeNames={}))});var t2=E(Qu=>{"use strict";Object.defineProperty(Qu,"__esModule",{value:!0});Qu.isLayerIgnored=Qu.getMiddlewareMetadata=void 0;var e2=JE(),ZE=wb(),Sye=(le(),O(Ae)),gye=(t,e,n,r)=>n?{attributes:{[ZE.AttributeNames.KOA_NAME]:r?.toString(),[ZE.AttributeNames.KOA_TYPE]:e2.KoaLayerType.ROUTER,[Sye.ATTR_HTTP_ROUTE]:r?.toString()},name:t._matchedRouteName||`router - ${r}`}:{attributes:{[ZE.AttributeNames.KOA_NAME]:e.name??"middleware",[ZE.AttributeNames.KOA_TYPE]:e2.KoaLayerType.MIDDLEWARE},name:`middleware - ${e.name}`};Qu.getMiddlewareMetadata=gye;var Aye=(t,e)=>!!(Array.isArray(e?.ignoreLayersType)&&e?.ignoreLayersType?.includes(t));Qu.isLayerIgnored=Aye});var n2=E(eS=>{"use strict";Object.defineProperty(eS,"__esModule",{value:!0});eS.kLayerPatched=void 0;eS.kLayerPatched=Symbol("koa-layer-patched")});var c2=E(tS=>{"use strict";Object.defineProperty(tS,"__esModule",{value:!0});tS.KoaInstrumentation=void 0;var mo=(b(),O(v)),Hd=ne(),r2=JE(),o2=ZK(),s2=t2(),i2=Te(),a2=n2(),kb=class extends Hd.InstrumentationBase{constructor(e={}){super(o2.PACKAGE_NAME,o2.PACKAGE_VERSION,e)}init(){return new Hd.InstrumentationNodeModuleDefinition("koa",[">=2.0.0 <4"],e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;return n==null?n:((0,Hd.isWrapped)(n.prototype.use)&&this._unwrap(n.prototype,"use"),this._wrap(n.prototype,"use",this._getKoaUsePatch.bind(this)),e)},e=>{let n=e[Symbol.toStringTag]==="Module"?e.default:e;(0,Hd.isWrapped)(n.prototype.use)&&this._unwrap(n.prototype,"use")})}_getKoaUsePatch(e){let n=this;return function(o){let s;return o.router?s=n._patchRouterDispatch(o):s=n._patchLayer(o,!1),e.apply(this,[s])}}_patchRouterDispatch(e){mo.diag.debug("Patching @koa/router dispatch");let r=e.router?.stack??[];for(let o of r){let s=o.path,i=o.stack;for(let a=0;a<i.length;a++){let c=i[a];i[a]=this._patchLayer(c,!0,s)}}return e}_patchLayer(e,n,r){let o=n?r2.KoaLayerType.ROUTER:r2.KoaLayerType.MIDDLEWARE;return e[a2.kLayerPatched]===!0||(0,s2.isLayerIgnored)(o,this.getConfig())?e:e.constructor.name==="GeneratorFunction"||e.constructor.name==="AsyncGeneratorFunction"?(mo.diag.debug("ignoring generator-based Koa middleware layer"),e):(e[a2.kLayerPatched]=!0,mo.diag.debug("patching Koa middleware layer"),async(s,i)=>{if(mo.trace.getSpan(mo.context.active())===void 0)return e(s,i);let c=(0,s2.getMiddlewareMetadata)(s,e,n,r),l=this.tracer.startSpan(c.name,{attributes:c.attributes}),p=(0,i2.getRPCMetadata)(mo.context.active());p?.type===i2.RPCType.HTTP&&s._matchedRoute&&(p.route=s._matchedRoute.toString());let{requestHook:d}=this.getConfig();d&&(0,Hd.safeExecuteInTheMiddle)(()=>d(l,{context:s,middlewareLayer:e,layerType:o}),f=>{f&&mo.diag.error("koa instrumentation: request hook failed",f)},!0);let _=mo.trace.setSpan(mo.context.active(),l);return mo.context.with(_,async()=>{try{return await e(s,i)}catch(f){throw l.recordException(f),f}finally{l.end()}})})}};tS.KoaInstrumentation=kb});var u2=E(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.KoaLayerType=si.AttributeNames=si.KoaInstrumentation=void 0;var Rye=c2();Object.defineProperty(si,"KoaInstrumentation",{enumerable:!0,get:function(){return Rye.KoaInstrumentation}});var yye=wb();Object.defineProperty(si,"AttributeNames",{enumerable:!0,get:function(){return yye.AttributeNames}});var Iye=JE();Object.defineProperty(si,"KoaLayerType",{enumerable:!0,get:function(){return Iye.KoaLayerType}})});var Gb=E(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.ConnectNames=kr.ConnectTypes=kr.AttributeNames=void 0;var Nye;(function(t){t.CONNECT_TYPE="connect.type",t.CONNECT_NAME="connect.name"})(Nye=kr.AttributeNames||(kr.AttributeNames={}));var bye;(function(t){t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request_handler"})(bye=kr.ConnectTypes||(kr.ConnectTypes={}));var Cye;(function(t){t.MIDDLEWARE="middleware",t.REQUEST_HANDLER="request handler"})(Cye=kr.ConnectNames||(kr.ConnectNames={}))});var f2=E(Xu=>{"use strict";Object.defineProperty(Xu,"__esModule",{value:!0});Xu.PACKAGE_NAME=Xu.PACKAGE_VERSION=void 0;Xu.PACKAGE_VERSION="0.57.0";Xu.PACKAGE_NAME="@opentelemetry/instrumentation-connect"});var m2=E(nS=>{"use strict";Object.defineProperty(nS,"__esModule",{value:!0});nS._LAYERS_STORE_PROPERTY=void 0;nS._LAYERS_STORE_PROPERTY=Symbol("opentelemetry.instrumentation-connect.request-route-stack")});var h2=E(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});ai.generateRoute=ai.replaceCurrentStackRoute=ai.addNewStackLayer=void 0;var Pye=(b(),O(v)),ii=m2(),Mye=t=>{Array.isArray(t[ii._LAYERS_STORE_PROPERTY])===!1&&Object.defineProperty(t,ii._LAYERS_STORE_PROPERTY,{enumerable:!1,value:[]}),t[ii._LAYERS_STORE_PROPERTY].push("/");let e=t[ii._LAYERS_STORE_PROPERTY].length;return()=>{e===t[ii._LAYERS_STORE_PROPERTY].length?t[ii._LAYERS_STORE_PROPERTY].pop():Pye.diag.warn("Connect: Trying to pop the stack multiple time")}};ai.addNewStackLayer=Mye;var xye=(t,e)=>{e&&t[ii._LAYERS_STORE_PROPERTY].splice(-1,1,e)};ai.replaceCurrentStackRoute=xye;var vye=t=>t[ii._LAYERS_STORE_PROPERTY].reduce((e,n)=>e.replace(/\/+$/,"")+n);ai.generateRoute=vye});var S2=E(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.ConnectInstrumentation=ci.ANONYMOUS_NAME=void 0;var Lye=(b(),O(v)),T2=Te(),Ju=Gb(),E2=f2(),rS=ne(),Dye=(le(),O(Ae)),Bb=h2();ci.ANONYMOUS_NAME="anonymous";var jb=class extends rS.InstrumentationBase{constructor(e={}){super(E2.PACKAGE_NAME,E2.PACKAGE_VERSION,e)}init(){return[new rS.InstrumentationNodeModuleDefinition("connect",[">=3.0.0 <4"],e=>this._patchConstructor(e))]}_patchApp(e){(0,rS.isWrapped)(e.use)||this._wrap(e,"use",this._patchUse.bind(this)),(0,rS.isWrapped)(e.handle)||this._wrap(e,"handle",this._patchHandle.bind(this))}_patchConstructor(e){let n=this;return function(...r){let o=e.apply(this,r);return n._patchApp(o),o}}_patchNext(e,n){return function(o){let s=e.apply(this,[o]);return n(),s}}_startSpan(e,n){let r,o,s;e?(r=Ju.ConnectTypes.REQUEST_HANDLER,s=Ju.ConnectNames.REQUEST_HANDLER,o=e):(r=Ju.ConnectTypes.MIDDLEWARE,s=Ju.ConnectNames.MIDDLEWARE,o=n.name||ci.ANONYMOUS_NAME);let i=`${s} - ${o}`,a={attributes:{[Dye.ATTR_HTTP_ROUTE]:e.length>0?e:"/",[Ju.AttributeNames.CONNECT_TYPE]:r,[Ju.AttributeNames.CONNECT_NAME]:o}};return this.tracer.startSpan(i,a)}_patchMiddleware(e,n){let r=this,o=n.length===4;function s(){if(!r.isEnabled())return n.apply(this,arguments);let[i,a,c]=o?[1,2,3]:[0,1,2],l=arguments[i],p=arguments[a],d=arguments[c];(0,Bb.replaceCurrentStackRoute)(l,e);let _=(0,T2.getRPCMetadata)(Lye.context.active());e&&_?.type===T2.RPCType.HTTP&&(_.route=(0,Bb.generateRoute)(l));let f="";e?f=`request handler - ${e}`:f=`middleware - ${n.name||ci.ANONYMOUS_NAME}`;let m=r._startSpan(e,n);r._diag.debug("start span",f);let h=!1;function T(){h?r._diag.debug(`span ${m.name} - already finished`):(h=!0,r._diag.debug(`finishing span ${m.name}`),m.end()),p.removeListener("close",T)}return p.addListener("close",T),arguments[c]=r._patchNext(d,T),n.apply(this,arguments)}return Object.defineProperty(s,"length",{value:n.length,writable:!1,configurable:!0}),s}_patchUse(e){let n=this;return function(...r){let o=r[r.length-1],s=r[r.length-2]||"";return r[r.length-1]=n._patchMiddleware(s,o),e.apply(this,r)}}_patchHandle(e){let n=this;return function(){let[r,o]=[0,2],s=arguments[r],i=arguments[o],a=(0,Bb.addNewStackLayer)(s);return typeof i=="function"&&(arguments[o]=n._patchOut(i,a)),e.apply(this,arguments)}}_patchOut(e,n){return function(...o){return n(),Reflect.apply(e,this,o)}}};ci.ConnectInstrumentation=jb});var A2=E(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.ConnectTypes=hr.ConnectNames=hr.AttributeNames=hr.ANONYMOUS_NAME=hr.ConnectInstrumentation=void 0;var g2=S2();Object.defineProperty(hr,"ConnectInstrumentation",{enumerable:!0,get:function(){return g2.ConnectInstrumentation}});Object.defineProperty(hr,"ANONYMOUS_NAME",{enumerable:!0,get:function(){return g2.ANONYMOUS_NAME}});var Hb=Gb();Object.defineProperty(hr,"AttributeNames",{enumerable:!0,get:function(){return Hb.AttributeNames}});Object.defineProperty(hr,"ConnectNames",{enumerable:!0,get:function(){return Hb.ConnectNames}});Object.defineProperty(hr,"ConnectTypes",{enumerable:!0,get:function(){return Hb.ConnectTypes}})});var N2=E(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.DB_SYSTEM_VALUE_MSSQL=Mt.ATTR_NET_PEER_PORT=Mt.ATTR_NET_PEER_NAME=Mt.ATTR_DB_USER=Mt.ATTR_DB_SYSTEM=Mt.ATTR_DB_STATEMENT=Mt.ATTR_DB_SQL_TABLE=Mt.ATTR_DB_NAME=void 0;Mt.ATTR_DB_NAME="db.name";Mt.ATTR_DB_SQL_TABLE="db.sql.table";Mt.ATTR_DB_STATEMENT="db.statement";Mt.ATTR_DB_SYSTEM="db.system";Mt.ATTR_DB_USER="db.user";Mt.ATTR_NET_PEER_NAME="net.peer.name";Mt.ATTR_NET_PEER_PORT="net.peer.port";Mt.DB_SYSTEM_VALUE_MSSQL="mssql"});var b2=E(Zu=>{"use strict";Object.defineProperty(Zu,"__esModule",{value:!0});Zu.once=Zu.getSpanName=void 0;function wye(t,e,n,r){return t==="execBulkLoad"&&r&&e?`${t} ${r} ${e}`:t==="callProcedure"?e?`${t} ${n} ${e}`:`${t} ${n}`:e?`${t} ${e}`:`${t}`}Zu.getSpanName=wye;var kye=t=>{let e=!1;return(...n)=>{if(!e)return e=!0,t(...n)}};Zu.once=kye});var C2=E(el=>{"use strict";Object.defineProperty(el,"__esModule",{value:!0});el.PACKAGE_NAME=el.PACKAGE_VERSION=void 0;el.PACKAGE_VERSION="0.33.0";el.PACKAGE_NAME="@opentelemetry/instrumentation-tedious"});var L2=E(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});li.TediousInstrumentation=li.INJECTED_CTX=void 0;var tl=(b(),O(v)),Gye=U("events"),ho=ne(),Aa=(le(),O(Ae)),ui=N2(),P2=b2(),M2=C2(),v2=Symbol("opentelemetry.instrumentation-tedious.current-database");li.INJECTED_CTX=Symbol("opentelemetry.instrumentation-tedious.context-info-injected");var x2=["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"];function oS(t){Object.defineProperty(this,v2,{value:t,writable:!0})}var Fb=class t extends ho.InstrumentationBase{static COMPONENT="tedious";_netSemconvStability;_dbSemconvStability;constructor(e={}){super(M2.PACKAGE_NAME,M2.PACKAGE_VERSION,e),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,ho.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN),this._dbSemconvStability=(0,ho.semconvStabilityFromStr)("database",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}init(){return[new ho.InstrumentationNodeModuleDefinition(t.COMPONENT,[">=1.11.0 <20"],e=>{let n=e.Connection.prototype;for(let r of x2)(0,ho.isWrapped)(n[r])&&this._unwrap(n,r),this._wrap(n,r,this._patchQuery(r,e));return(0,ho.isWrapped)(n.connect)&&this._unwrap(n,"connect"),this._wrap(n,"connect",this._patchConnect),e},e=>{if(e===void 0)return;let n=e.Connection.prototype;for(let r of x2)this._unwrap(n,r);this._unwrap(n,"connect")})]}_patchConnect(e){return function(){return oS.call(this,this.config?.options?.database),this.removeListener("databaseChange",oS),this.on("databaseChange",oS),this.once("end",()=>{this.removeListener("databaseChange",oS)}),e.apply(this,arguments)}}_buildTraceparent(e){let n=e.spanContext();return`00-${n.traceId}-${n.spanId}-0${Number(n.traceFlags||tl.TraceFlags.NONE).toString(16)}`}_injectContextInfo(e,n,r){return new Promise(o=>{try{let s="set context_info @opentelemetry_traceparent",i=new n.Request(s,c=>{o()});Object.defineProperty(i,li.INJECTED_CTX,{value:!0});let a=Buffer.from(r,"utf8");i.addParameter("opentelemetry_traceparent",n.TYPES.VarBinary,a,{length:a.length}),e.execSql(i)}catch{o()}})}_shouldInjectFor(e){return e==="execSql"||e==="execSqlBatch"||e==="callProcedure"||e==="execute"}_patchQuery(e,n){return r=>{let o=this;function s(i){if(i?.[li.INJECTED_CTX])return r.apply(this,arguments);if(!(i instanceof Gye.EventEmitter))return o._diag.warn(`Unexpected invocation of patched ${e} method. Span not recorded`),r.apply(this,arguments);let a=0,c=0,l=()=>c++,p=()=>a++,d=this[v2],_=(x=>x.sqlTextOrProcedure==="sp_prepare"&&x.parametersByName?.stmt?.value?x.parametersByName.stmt.value:x.sqlTextOrProcedure)(i),f={};o._dbSemconvStability&ho.SemconvStability.OLD&&(f[ui.ATTR_DB_SYSTEM]=ui.DB_SYSTEM_VALUE_MSSQL,f[ui.ATTR_DB_NAME]=d,f[ui.ATTR_DB_USER]=this.config?.userName??this.config?.authentication?.options?.userName,f[ui.ATTR_DB_STATEMENT]=_,f[ui.ATTR_DB_SQL_TABLE]=i.table),o._dbSemconvStability&ho.SemconvStability.STABLE&&(f[Aa.ATTR_DB_NAMESPACE]=d,f[Aa.ATTR_DB_SYSTEM_NAME]=Aa.DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER,f[Aa.ATTR_DB_QUERY_TEXT]=_,f[Aa.ATTR_DB_COLLECTION_NAME]=i.table),o._netSemconvStability&ho.SemconvStability.OLD&&(f[ui.ATTR_NET_PEER_NAME]=this.config?.server,f[ui.ATTR_NET_PEER_PORT]=this.config?.options?.port),o._netSemconvStability&ho.SemconvStability.STABLE&&(f[Aa.ATTR_SERVER_ADDRESS]=this.config?.server,f[Aa.ATTR_SERVER_PORT]=this.config?.options?.port);let m=o.tracer.startSpan((0,P2.getSpanName)(e,d,_,i.table),{kind:tl.SpanKind.CLIENT,attributes:f}),h=(0,P2.once)(x=>{i.removeListener("done",l),i.removeListener("doneInProc",l),i.removeListener("doneProc",p),i.removeListener("error",h),this.removeListener("end",h),m.setAttribute("tedious.procedure_count",a),m.setAttribute("tedious.statement_count",c),x&&m.setStatus({code:tl.SpanStatusCode.ERROR,message:x.message}),m.end()});i.on("done",l),i.on("doneInProc",l),i.on("doneProc",p),i.once("error",h),this.on("end",h),typeof i.callback=="function"?o._wrap(i,"callback",o._patchCallbackQuery(h)):o._diag.error("Expected request.callback to be a function");let T=()=>tl.context.with(tl.trace.setSpan(tl.context.active(),m),r,this,...arguments);if(!(o.getConfig().enableTraceContextPropagation&&o._shouldInjectFor(e)))return T();let I=o._buildTraceparent(m);o._injectContextInfo(this,n,I).finally(T)}return Object.defineProperty(s,"length",{value:r.length,writable:!1}),s}}_patchCallbackQuery(e){return n=>function(r,o,s){return e(r),n.apply(this,arguments)}}};li.TediousInstrumentation=Fb});var D2=E(sS=>{"use strict";Object.defineProperty(sS,"__esModule",{value:!0});sS.TediousInstrumentation=void 0;var Bye=L2();Object.defineProperty(sS,"TediousInstrumentation",{enumerable:!0,get:function(){return Bye.TediousInstrumentation}})});var B2=E(nl=>{"use strict";Object.defineProperty(nl,"__esModule",{value:!0});nl.PACKAGE_NAME=nl.PACKAGE_VERSION=void 0;nl.PACKAGE_VERSION="0.57.0";nl.PACKAGE_NAME="@opentelemetry/instrumentation-generic-pool"});var H2=E(iS=>{"use strict";Object.defineProperty(iS,"__esModule",{value:!0});iS.GenericPoolInstrumentation=void 0;var rl=(b(),O(v)),Ra=ne(),j2=B2(),Vb="generic-pool",qb=class extends Ra.InstrumentationBase{_isDisabled=!1;constructor(e={}){super(j2.PACKAGE_NAME,j2.PACKAGE_VERSION,e)}init(){return[new Ra.InstrumentationNodeModuleDefinition(Vb,[">=3.0.0 <4"],e=>{let n=e.Pool;return(0,Ra.isWrapped)(n.prototype.acquire)&&this._unwrap(n.prototype,"acquire"),this._wrap(n.prototype,"acquire",this._acquirePatcher.bind(this)),e},e=>{let n=e.Pool;return this._unwrap(n.prototype,"acquire"),e}),new Ra.InstrumentationNodeModuleDefinition(Vb,[">=2.4.0 <3"],e=>{let n=e.Pool;return(0,Ra.isWrapped)(n.prototype.acquire)&&this._unwrap(n.prototype,"acquire"),this._wrap(n.prototype,"acquire",this._acquireWithCallbacksPatcher.bind(this)),e},e=>{let n=e.Pool;return this._unwrap(n.prototype,"acquire"),e}),new Ra.InstrumentationNodeModuleDefinition(Vb,[">=2.0.0 <2.4"],e=>(this._isDisabled=!1,(0,Ra.isWrapped)(e.Pool)&&this._unwrap(e,"Pool"),this._wrap(e,"Pool",this._poolWrapper.bind(this)),e),e=>(this._isDisabled=!0,e))]}_acquirePatcher(e){let n=this;return function(...o){let s=rl.context.active(),i=n.tracer.startSpan("generic-pool.acquire",{},s);return rl.context.with(rl.trace.setSpan(s,i),()=>e.call(this,...o).then(a=>(i.end(),a),a=>{throw i.recordException(a),i.end(),a}))}}_poolWrapper(e){let n=this;return function(){let o=e.apply(this,arguments);return n._wrap(o,"acquire",n._acquireWithCallbacksPatcher.bind(n)),o}}_acquireWithCallbacksPatcher(e){let n=this;return function(o,s){if(n._isDisabled)return e.call(this,o,s);let i=rl.context.active(),a=n.tracer.startSpan("generic-pool.acquire",{},i);return rl.context.with(rl.trace.setSpan(i,a),()=>{e.call(this,(c,l)=>{if(a.end(),o)return o(c,l)},s)})}}};iS.GenericPoolInstrumentation=qb});var F2=E(aS=>{"use strict";Object.defineProperty(aS,"__esModule",{value:!0});aS.GenericPoolInstrumentation=void 0;var Fye=H2();Object.defineProperty(aS,"GenericPoolInstrumentation",{enumerable:!0,get:function(){return Fye.GenericPoolInstrumentation}})});var $b=E(To=>{"use strict";Object.defineProperty(To,"__esModule",{value:!0});To.ATTR_NET_PEER_PORT=To.ATTR_NET_PEER_NAME=To.ATTR_MESSAGING_SYSTEM=To.ATTR_MESSAGING_OPERATION=void 0;To.ATTR_MESSAGING_OPERATION="messaging.operation";To.ATTR_MESSAGING_SYSTEM="messaging.system";To.ATTR_NET_PEER_NAME="net.peer.name";To.ATTR_NET_PEER_PORT="net.peer.port"});var Yb=E(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.ATTR_MESSAGING_CONVERSATION_ID=qe.OLD_ATTR_MESSAGING_MESSAGE_ID=qe.MESSAGING_DESTINATION_KIND_VALUE_TOPIC=qe.ATTR_MESSAGING_URL=qe.ATTR_MESSAGING_PROTOCOL_VERSION=qe.ATTR_MESSAGING_PROTOCOL=qe.MESSAGING_OPERATION_VALUE_PROCESS=qe.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY=qe.ATTR_MESSAGING_DESTINATION_KIND=qe.ATTR_MESSAGING_DESTINATION=void 0;qe.ATTR_MESSAGING_DESTINATION="messaging.destination";qe.ATTR_MESSAGING_DESTINATION_KIND="messaging.destination_kind";qe.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY="messaging.rabbitmq.routing_key";qe.MESSAGING_OPERATION_VALUE_PROCESS="process";qe.ATTR_MESSAGING_PROTOCOL="messaging.protocol";qe.ATTR_MESSAGING_PROTOCOL_VERSION="messaging.protocol_version";qe.ATTR_MESSAGING_URL="messaging.url";qe.MESSAGING_DESTINATION_KIND_VALUE_TOPIC="topic";qe.OLD_ATTR_MESSAGING_MESSAGE_ID="messaging.message_id";qe.ATTR_MESSAGING_CONVERSATION_ID="messaging.conversation_id"});var Wb=E(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});ya.DEFAULT_CONFIG=ya.EndOperation=void 0;var qye;(function(t){t.AutoAck="auto ack",t.Ack="ack",t.AckAll="ackAll",t.Reject="reject",t.Nack="nack",t.NackAll="nackAll",t.ChannelClosed="channel closed",t.ChannelError="channel error",t.InstrumentationTimeout="instrumentation timeout"})(qye=ya.EndOperation||(ya.EndOperation={}));ya.DEFAULT_CONFIG={consumeTimeoutMs:1e3*60,useLinksForConsume:!1}});var Q2=E($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.isConfirmChannelTracing=$e.unmarkConfirmChannelTracing=$e.markConfirmChannelTracing=$e.getConnectionAttributesFromUrl=$e.getConnectionAttributesFromServer=$e.normalizeExchange=$e.CONNECTION_ATTRIBUTES=$e.CHANNEL_CONSUME_TIMEOUT_TIMER=$e.CHANNEL_SPANS_NOT_ENDED=$e.MESSAGE_STORED_SPAN=void 0;var zb=(b(),O(v)),pi=ne(),cS=(le(),O(Ae)),Fd=$b(),uS=Yb();$e.MESSAGE_STORED_SPAN=Symbol("opentelemetry.amqplib.message.stored-span");$e.CHANNEL_SPANS_NOT_ENDED=Symbol("opentelemetry.amqplib.channel.spans-not-ended");$e.CHANNEL_CONSUME_TIMEOUT_TIMER=Symbol("opentelemetry.amqplib.channel.consumer-timeout-timer");$e.CONNECTION_ATTRIBUTES=Symbol("opentelemetry.amqplib.connection.attributes");var Kb=(0,zb.createContextKey)("opentelemetry.amqplib.channel.is-confirm-channel"),$ye=t=>t!==""?t:"<default>";$e.normalizeExchange=$ye;var Yye=t=>t.replace(/:[^:@/]*@/,":***@"),W2=(t,e)=>t||(e==="AMQP"?5672:5671),z2=t=>{let e=t||"amqp";return(e.endsWith(":")?e.substring(0,e.length-1):e).toUpperCase()},K2=t=>t||"localhost",Eo=(t,e,n,r)=>n?{[e]:n}:(zb.diag.error(`amqplib instrumentation: could not extract connection attribute ${r} from user supplied url`,{url:t}),{}),Wye=t=>{let e=t.serverProperties.product?.toLowerCase?.();return e?{[Fd.ATTR_MESSAGING_SYSTEM]:e}:{}};$e.getConnectionAttributesFromServer=Wye;var zye=(t,e)=>{let n={[uS.ATTR_MESSAGING_PROTOCOL_VERSION]:"0.9.1"};if(t=t||"amqp://localhost",typeof t=="object"){let r=t,o=z2(r?.protocol);Object.assign(n,{...Eo(t,uS.ATTR_MESSAGING_PROTOCOL,o,"protocol")});let s=K2(r?.hostname);e&pi.SemconvStability.OLD&&Object.assign(n,{...Eo(t,Fd.ATTR_NET_PEER_NAME,s,"hostname")}),e&pi.SemconvStability.STABLE&&Object.assign(n,{...Eo(t,cS.ATTR_SERVER_ADDRESS,s,"hostname")});let i=W2(r.port,o);e&pi.SemconvStability.OLD&&Object.assign(n,Eo(t,Fd.ATTR_NET_PEER_PORT,i,"port")),e&pi.SemconvStability.STABLE&&Object.assign(n,Eo(t,cS.ATTR_SERVER_PORT,i,"port"))}else{let r=Yye(t);n[uS.ATTR_MESSAGING_URL]=r;try{let o=new URL(r),s=z2(o.protocol);Object.assign(n,{...Eo(r,uS.ATTR_MESSAGING_PROTOCOL,s,"protocol")});let i=K2(o.hostname);e&pi.SemconvStability.OLD&&Object.assign(n,{...Eo(r,Fd.ATTR_NET_PEER_NAME,i,"hostname")}),e&pi.SemconvStability.STABLE&&Object.assign(n,{...Eo(r,cS.ATTR_SERVER_ADDRESS,i,"hostname")});let a=W2(o.port?parseInt(o.port):void 0,s);e&pi.SemconvStability.OLD&&Object.assign(n,Eo(r,Fd.ATTR_NET_PEER_PORT,a,"port")),e&pi.SemconvStability.STABLE&&Object.assign(n,Eo(r,cS.ATTR_SERVER_PORT,a,"port"))}catch(o){zb.diag.error("amqplib instrumentation: error while extracting connection details from connection url",{censoredUrl:r,err:o})}}return n};$e.getConnectionAttributesFromUrl=zye;var Kye=t=>t.setValue(Kb,!0);$e.markConfirmChannelTracing=Kye;var Qye=t=>t.deleteValue(Kb);$e.unmarkConfirmChannelTracing=Qye;var Xye=t=>t.getValue(Kb)===!0;$e.isConfirmChannelTracing=Xye});var X2=E(ol=>{"use strict";Object.defineProperty(ol,"__esModule",{value:!0});ol.PACKAGE_NAME=ol.PACKAGE_VERSION=void 0;ol.PACKAGE_VERSION="0.61.0";ol.PACKAGE_NAME="@opentelemetry/instrumentation-amqplib"});var Z2=E(dS=>{"use strict";Object.defineProperty(dS,"__esModule",{value:!0});dS.AmqplibInstrumentation=void 0;var Ge=(b(),O(v)),lS=Te(),Ee=ne(),Jye=$b(),zn=Yb(),En=Wb(),Ye=Q2(),J2=X2(),pS=[">=0.5.5 <1"],Qb=class extends Ee.InstrumentationBase{_netSemconvStability;constructor(e={}){super(J2.PACKAGE_NAME,J2.PACKAGE_VERSION,{...En.DEFAULT_CONFIG,...e}),this._setSemconvStabilityFromEnv()}_setSemconvStabilityFromEnv(){this._netSemconvStability=(0,Ee.semconvStabilityFromStr)("http",process.env.OTEL_SEMCONV_STABILITY_OPT_IN)}setConfig(e={}){super.setConfig({...En.DEFAULT_CONFIG,...e})}init(){let e=new Ee.InstrumentationNodeModuleFile("amqplib/lib/channel_model.js",pS,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),n=new Ee.InstrumentationNodeModuleFile("amqplib/lib/callback_model.js",pS,this.patchChannelModel.bind(this),this.unpatchChannelModel.bind(this)),r=new Ee.InstrumentationNodeModuleFile("amqplib/lib/connect.js",pS,this.patchConnect.bind(this),this.unpatchConnect.bind(this));return new Ee.InstrumentationNodeModuleDefinition("amqplib",pS,void 0,void 0,[e,r,n])}patchConnect(e){return e=this.unpatchConnect(e),(0,Ee.isWrapped)(e.connect)||this._wrap(e,"connect",this.getConnectPatch.bind(this)),e}unpatchConnect(e){return(0,Ee.isWrapped)(e.connect)&&this._unwrap(e,"connect"),e}patchChannelModel(e,n){return(0,Ee.isWrapped)(e.Channel.prototype.publish)||this._wrap(e.Channel.prototype,"publish",this.getPublishPatch.bind(this,n)),(0,Ee.isWrapped)(e.Channel.prototype.consume)||this._wrap(e.Channel.prototype,"consume",this.getConsumePatch.bind(this,n)),(0,Ee.isWrapped)(e.Channel.prototype.ack)||this._wrap(e.Channel.prototype,"ack",this.getAckPatch.bind(this,!1,En.EndOperation.Ack)),(0,Ee.isWrapped)(e.Channel.prototype.nack)||this._wrap(e.Channel.prototype,"nack",this.getAckPatch.bind(this,!0,En.EndOperation.Nack)),(0,Ee.isWrapped)(e.Channel.prototype.reject)||this._wrap(e.Channel.prototype,"reject",this.getAckPatch.bind(this,!0,En.EndOperation.Reject)),(0,Ee.isWrapped)(e.Channel.prototype.ackAll)||this._wrap(e.Channel.prototype,"ackAll",this.getAckAllPatch.bind(this,!1,En.EndOperation.AckAll)),(0,Ee.isWrapped)(e.Channel.prototype.nackAll)||this._wrap(e.Channel.prototype,"nackAll",this.getAckAllPatch.bind(this,!0,En.EndOperation.NackAll)),(0,Ee.isWrapped)(e.Channel.prototype.emit)||this._wrap(e.Channel.prototype,"emit",this.getChannelEmitPatch.bind(this)),(0,Ee.isWrapped)(e.ConfirmChannel.prototype.publish)||this._wrap(e.ConfirmChannel.prototype,"publish",this.getConfirmedPublishPatch.bind(this,n)),e}unpatchChannelModel(e){return(0,Ee.isWrapped)(e.Channel.prototype.publish)&&this._unwrap(e.Channel.prototype,"publish"),(0,Ee.isWrapped)(e.Channel.prototype.consume)&&this._unwrap(e.Channel.prototype,"consume"),(0,Ee.isWrapped)(e.Channel.prototype.ack)&&this._unwrap(e.Channel.prototype,"ack"),(0,Ee.isWrapped)(e.Channel.prototype.nack)&&this._unwrap(e.Channel.prototype,"nack"),(0,Ee.isWrapped)(e.Channel.prototype.reject)&&this._unwrap(e.Channel.prototype,"reject"),(0,Ee.isWrapped)(e.Channel.prototype.ackAll)&&this._unwrap(e.Channel.prototype,"ackAll"),(0,Ee.isWrapped)(e.Channel.prototype.nackAll)&&this._unwrap(e.Channel.prototype,"nackAll"),(0,Ee.isWrapped)(e.Channel.prototype.emit)&&this._unwrap(e.Channel.prototype,"emit"),(0,Ee.isWrapped)(e.ConfirmChannel.prototype.publish)&&this._unwrap(e.ConfirmChannel.prototype,"publish"),e}getConnectPatch(e){let n=this;return function(o,s,i){return e.call(this,o,s,function(a,c){if(a==null){let l=(0,Ye.getConnectionAttributesFromUrl)(o,n._netSemconvStability),p=(0,Ye.getConnectionAttributesFromServer)(c);c[Ye.CONNECTION_ATTRIBUTES]={...l,...p}}i.apply(this,arguments)})}}getChannelEmitPatch(e){let n=this;return function(o){if(o==="close"){n.endAllSpansOnChannel(this,!0,En.EndOperation.ChannelClosed,void 0);let s=this[Ye.CHANNEL_CONSUME_TIMEOUT_TIMER];s&&clearInterval(s),this[Ye.CHANNEL_CONSUME_TIMEOUT_TIMER]=void 0}else o==="error"&&n.endAllSpansOnChannel(this,!0,En.EndOperation.ChannelError,void 0);return e.apply(this,arguments)}}getAckAllPatch(e,n,r){let o=this;return function(i){return o.endAllSpansOnChannel(this,e,n,i),r.apply(this,arguments)}}getAckPatch(e,n,r){let o=this;return function(i,a,c){let l=this,p=n===En.EndOperation.Reject?a:c,d=l[Ye.CHANNEL_SPANS_NOT_ENDED]??[],_=d.findIndex(f=>f.msg===i);if(_<0)o.endConsumerSpan(i,e,n,p);else if(n!==En.EndOperation.Reject&&a){for(let f=0;f<=_;f++)o.endConsumerSpan(d[f].msg,e,n,p);d.splice(0,_+1)}else o.endConsumerSpan(i,e,n,p),d.splice(_,1);return r.apply(this,arguments)}}getConsumePatch(e,n){let r=this;return function(s,i,a){let c=this;if(!Object.prototype.hasOwnProperty.call(c,Ye.CHANNEL_SPANS_NOT_ENDED)){let{consumeTimeoutMs:p}=r.getConfig();if(p){let d=setInterval(()=>{r.checkConsumeTimeoutOnChannel(c)},p);d.unref(),c[Ye.CHANNEL_CONSUME_TIMEOUT_TIMER]=d}c[Ye.CHANNEL_SPANS_NOT_ENDED]=[]}let l=function(p){if(!p)return i.call(this,p);let d=p.properties.headers??{},_=Ge.propagation.extract(Ge.ROOT_CONTEXT,d),f=p.fields?.exchange,m;if(r._config.useLinksForConsume){let R=_?Ge.trace.getSpan(_)?.spanContext():void 0;_=void 0,R&&(m=[{context:R}])}let h=r.tracer.startSpan(`${s} process`,{kind:Ge.SpanKind.CONSUMER,attributes:{...c?.connection?.[Ye.CONNECTION_ATTRIBUTES],[zn.ATTR_MESSAGING_DESTINATION]:f,[zn.ATTR_MESSAGING_DESTINATION_KIND]:zn.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,[zn.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]:p.fields?.routingKey,[Jye.ATTR_MESSAGING_OPERATION]:zn.MESSAGING_OPERATION_VALUE_PROCESS,[zn.OLD_ATTR_MESSAGING_MESSAGE_ID]:p?.properties.messageId,[zn.ATTR_MESSAGING_CONVERSATION_ID]:p?.properties.correlationId},links:m},_),{consumeHook:T}=r.getConfig();T&&(0,Ee.safeExecuteInTheMiddle)(()=>T(h,{moduleVersion:e,msg:p}),R=>{R&&Ge.diag.error("amqplib instrumentation: consumerHook error",R)},!0),a?.noAck||(c[Ye.CHANNEL_SPANS_NOT_ENDED].push({msg:p,timeOfConsume:(0,lS.hrTime)()}),p[Ye.MESSAGE_STORED_SPAN]=h);let S=_||Ge.ROOT_CONTEXT;Ge.context.with(Ge.trace.setSpan(S,h),()=>{i.call(this,p)}),a?.noAck&&(r.callConsumeEndHook(h,p,!1,En.EndOperation.AutoAck),h.end())};return arguments[1]=l,n.apply(this,arguments)}}getConfirmedPublishPatch(e,n){let r=this;return function(s,i,a,c,l){let p=this,{span:d,modifiedOptions:_}=r.createPublishSpan(r,s,i,p,c),{publishHook:f}=r.getConfig();f&&(0,Ee.safeExecuteInTheMiddle)(()=>f(d,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:_,isConfirmChannel:!0}),S=>{S&&Ge.diag.error("amqplib instrumentation: publishHook error",S)},!0);let m=function(S,R){try{l?.call(this,S,R)}finally{let{publishConfirmHook:I}=r.getConfig();I&&(0,Ee.safeExecuteInTheMiddle)(()=>I(d,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:c,isConfirmChannel:!0,confirmError:S}),x=>{x&&Ge.diag.error("amqplib instrumentation: publishConfirmHook error",x)},!0),S&&d.setStatus({code:Ge.SpanStatusCode.ERROR,message:"message confirmation has been nack'ed"}),d.end()}},h=(0,Ye.markConfirmChannelTracing)(Ge.context.active()),T=[...arguments];return T[3]=_,T[4]=Ge.context.bind((0,Ye.unmarkConfirmChannelTracing)(Ge.trace.setSpan(h,d)),m),Ge.context.with(h,n.bind(this,...T))}}getPublishPatch(e,n){let r=this;return function(s,i,a,c){if((0,Ye.isConfirmChannelTracing)(Ge.context.active()))return n.apply(this,arguments);{let l=this,{span:p,modifiedOptions:d}=r.createPublishSpan(r,s,i,l,c),{publishHook:_}=r.getConfig();_&&(0,Ee.safeExecuteInTheMiddle)(()=>_(p,{moduleVersion:e,exchange:s,routingKey:i,content:a,options:d,isConfirmChannel:!1}),h=>{h&&Ge.diag.error("amqplib instrumentation: publishHook error",h)},!0);let f=[...arguments];f[3]=d;let m=n.apply(this,f);return p.end(),m}}}createPublishSpan(e,n,r,o,s){let i=(0,Ye.normalizeExchange)(n),a=e.tracer.startSpan(`publish ${i}`,{kind:Ge.SpanKind.PRODUCER,attributes:{...o.connection[Ye.CONNECTION_ATTRIBUTES],[zn.ATTR_MESSAGING_DESTINATION]:n,[zn.ATTR_MESSAGING_DESTINATION_KIND]:zn.MESSAGING_DESTINATION_KIND_VALUE_TOPIC,[zn.ATTR_MESSAGING_RABBITMQ_ROUTING_KEY]:r,[zn.OLD_ATTR_MESSAGING_MESSAGE_ID]:s?.messageId,[zn.ATTR_MESSAGING_CONVERSATION_ID]:s?.correlationId}}),c=s??{};return c.headers=c.headers??{},Ge.propagation.inject(Ge.trace.setSpan(Ge.context.active(),a),c.headers),{span:a,modifiedOptions:c}}endConsumerSpan(e,n,r,o){let s=e[Ye.MESSAGE_STORED_SPAN];s&&(n!==!1&&s.setStatus({code:Ge.SpanStatusCode.ERROR,message:r!==En.EndOperation.ChannelClosed&&r!==En.EndOperation.ChannelError?`${r} called on message${o===!0?" with requeue":o===!1?" without requeue":""}`:r}),this.callConsumeEndHook(s,e,n,r),s.end(),e[Ye.MESSAGE_STORED_SPAN]=void 0)}endAllSpansOnChannel(e,n,r,o){(e[Ye.CHANNEL_SPANS_NOT_ENDED]??[]).forEach(i=>{this.endConsumerSpan(i.msg,n,r,o)}),e[Ye.CHANNEL_SPANS_NOT_ENDED]=[]}callConsumeEndHook(e,n,r,o){let{consumeEndHook:s}=this.getConfig();s&&(0,Ee.safeExecuteInTheMiddle)(()=>s(e,{msg:n,rejected:r,endOperation:o}),i=>{i&&Ge.diag.error("amqplib instrumentation: consumerEndHook error",i)},!0)}checkConsumeTimeoutOnChannel(e){let n=(0,lS.hrTime)(),r=e[Ye.CHANNEL_SPANS_NOT_ENDED]??[],o,{consumeTimeoutMs:s}=this.getConfig();for(o=0;o<r.length;o++){let i=r[o],a=(0,lS.hrTimeDuration)(i.timeOfConsume,n);if((0,lS.hrTimeToMilliseconds)(a)<s)break;this.endConsumerSpan(i.msg,null,En.EndOperation.InstrumentationTimeout,!0)}r.splice(0,o)}};dS.AmqplibInstrumentation=Qb});var t4=E(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.EndOperation=di.DEFAULT_CONFIG=di.AmqplibInstrumentation=void 0;var Zye=Z2();Object.defineProperty(di,"AmqplibInstrumentation",{enumerable:!0,get:function(){return Zye.AmqplibInstrumentation}});var e4=Wb();Object.defineProperty(di,"DEFAULT_CONFIG",{enumerable:!0,get:function(){return e4.DEFAULT_CONFIG}});Object.defineProperty(di,"EndOperation",{enumerable:!0,get:function(){return e4.EndOperation}})});b();var tq=K(OG(),1);var C=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var J=globalThis;var pe="10.47.0";function cn(){return fs(J),J}function fs(t){let e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||pe,e[pe]=e[pe]||{}}function Ir(t,e,n=J){let r=n.__SENTRY__=n.__SENTRY__||{},o=r[pe]=r[pe]||{};return o[t]||(o[t]=e())}var Vl=["debug","info","warn","error","log","assert","trace"],Zie="Sentry Logger ",hc={};function Qe(t){if(!("console"in J))return t();let e=J.console,n={},r=Object.keys(hc);r.forEach(o=>{let s=hc[o];n[o]=e[o],e[o]=s});try{return t()}finally{r.forEach(o=>{e[o]=n[o]})}}function eae(){AR().enabled=!0}function tae(){AR().enabled=!1}function NG(){return AR().enabled}function nae(...t){gR("log",...t)}function rae(...t){gR("warn",...t)}function oae(...t){gR("error",...t)}function gR(t,...e){C&&NG()&&Qe(()=>{J.console[t](`${Zie}[${t}]:`,...e)})}function AR(){return C?Ir("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var g={enable:eae,disable:tae,isEnabled:NG,log:nae,warn:rae,error:oae};var Mf="?",bG=/\(error: (.*)\)/,CG=/captureMessage|captureException/;function xf(...t){let e=t.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,o=0)=>{let s=[],i=n.split(`
12
+ `);for(let a=r;a<i.length;a++){let c=i[a];c.length>1024&&(c=c.slice(0,1024));let l=bG.test(c)?c.replace(bG,"$1"):c;if(!l.match(/\S*Error: /)){for(let p of e){let d=p(l);if(d){s.push(d);break}}if(s.length>=50+o)break}}return PG(s.slice(o))}}function yR(t){return Array.isArray(t)?xf(...t):t}function PG(t){if(!t.length)return[];let e=Array.from(t);return/sentryWrapped/.test(Pf(e).function||"")&&e.pop(),e.reverse(),CG.test(Pf(e).function||"")&&(e.pop(),CG.test(Pf(e).function||"")&&e.pop()),e.slice(0,50).map(n=>({...n,filename:n.filename||Pf(e).filename,function:n.function||Mf}))}function Pf(t){return t[t.length-1]||{}}var RR="<anonymous>";function ql(t){try{return!t||typeof t!="function"?RR:t.name||RR}catch{return RR}}function vf(t){return"__v_isVNode"in t&&t.__v_isVNode?"[VueVNode]":"[VueViewModel]"}function MG(t){let e=t?.startsWith("file://")?t.slice(7):t;return e?.match(/\/[A-Z]:/)&&(e=e.slice(1)),e}var Lf={},xG={};function Tc(t,e){Lf[t]=Lf[t]||[],Lf[t].push(e)}function Ec(t,e){if(!xG[t]){xG[t]=!0;try{e()}catch(n){C&&g.error(`Error while instrumenting ${t}`,n)}}}function Sc(t,e){let n=t&&Lf[t];if(n)for(let r of n)try{r(e)}catch(o){C&&g.error(`Error while triggering instrumentation handler.
13
+ Type: ${t}
14
+ Name: ${ql(r)}
15
+ Error:`,o)}}var IR=null;function vG(t){let e="error";Tc(e,t),Ec(e,sae)}function sae(){IR=J.onerror,J.onerror=function(t,e,n,r,o){return Sc("error",{column:r,error:o,line:n,msg:t,url:e}),IR?IR.apply(this,arguments):!1},J.onerror.__SENTRY_INSTRUMENTED__=!0}var OR=null;function LG(t){let e="unhandledrejection";Tc(e,t),Ec(e,iae)}function iae(){OR=J.onunhandledrejection,J.onunhandledrejection=function(t){return Sc("unhandledrejection",t),OR?OR.apply(this,arguments):!0},J.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}var DG=Object.prototype.toString;function Kr(t){switch(DG.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Qr(t,Error)}}function Df(t,e){return DG.call(t)===`[object ${e}]`}function NR(t){return Df(t,"ErrorEvent")}function ms(t){return Df(t,"String")}function gc(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function $l(t){return t===null||gc(t)||typeof t!="object"&&typeof t!="function"}function Mo(t){return Df(t,"Object")}function bR(t){return typeof Event<"u"&&Qr(t,Event)}function CR(t){return typeof Element<"u"&&Qr(t,Element)}function PR(t){return Df(t,"RegExp")}function Lt(t){return!!(t?.then&&typeof t.then=="function")}function MR(t){return Mo(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function Qr(t,e){try{return t instanceof e}catch{return!1}}function Yl(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue||t.__v_isVNode))}var aae=J,cae=80;function UG(t,e={}){if(!t)return"<unknown>";try{let n=t,r=5,o=[],s=0,i=0,a=" > ",c=a.length,l,p=Array.isArray(e)?e:e.keyAttrs,d=!Array.isArray(e)&&e.maxStringLength||cae;for(;n&&s++<r&&(l=uae(n,p),!(l==="html"||s>1&&i+o.length*c+l.length>=d));)o.push(l),i+=l.length,n=n.parentNode;return o.reverse().join(a)}catch{return"<unknown>"}}function uae(t,e){let n=t,r=[];if(!n?.tagName)return"";if(aae.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());let o=e?.length?e.filter(s=>n.getAttribute(s)).map(s=>[s,n.getAttribute(s)]):null;if(o?.length)o.forEach(s=>{r.push(`[${s[0]}="${s[1]}"]`)});else{n.id&&r.push(`#${n.id}`);let s=n.className;if(s&&ms(s)){let i=s.split(/\s+/);for(let a of i)r.push(`.${a}`)}}for(let s of["aria-label","type","name","title","alt"]){let i=n.getAttribute(s);i&&r.push(`[${s}="${i}"]`)}return r.join("")}function xR(t,e,n){if(!(e in t))return;let r=t[e];if(typeof r!="function")return;let o=n(r);typeof o=="function"&&GG(o,r);try{t[e]=o}catch{C&&g.log(`Failed to replace method "${e}" in object`,t)}}function nt(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{C&&g.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function GG(t,e){try{let n=e.prototype||{};t.prototype=e.prototype=n,nt(t,"__sentry_original__",e)}catch{}}function vR(t){return t.__sentry_original__}function Uf(t){if(Kr(t))return{message:t.message,name:t.name,stack:t.stack,...kG(t)};if(bR(t)){let e={type:t.type,target:wG(t.target),currentTarget:wG(t.currentTarget),...kG(t)};return typeof CustomEvent<"u"&&Qr(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function wG(t){try{return CR(t)?UG(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function kG(t){return typeof t=="object"&&t!==null?Object.fromEntries(Object.entries(t)):{}}function LR(t){let e=Object.keys(Uf(t));return e.sort(),e[0]?e.join(", "):"[object has no keys]"}var Ac;function Gi(t){if(Ac!==void 0)return Ac?Ac(t):t();let e=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),n=J;return e in n&&typeof n[e]=="function"?(Ac=n[e],Ac(t)):(Ac=null,t())}function yt(){return Gi(()=>Math.random())}function Zn(){return Gi(()=>Date.now())}function hs(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function DR(t,e){let n=t,r=n.length;if(r<=150)return n;e>r&&(e=r);let o=Math.max(e-60,0);o<5&&(o=0);let s=Math.min(o+140,r);return s>r-5&&(s=r),s===r&&(o=Math.max(s-140,0)),n=n.slice(o,s),o>0&&(n=`'{snip} ${n}`),s<r&&(n+=" {snip}"),n}function UR(t,e){if(!Array.isArray(t))return"";let n=[];for(let r=0;r<t.length;r++){let o=t[r];try{Yl(o)?n.push(vf(o)):n.push(String(o))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function xo(t,e,n=!1){return ms(t)?PR(e)?e.test(t):ms(e)?n?t===e:t.includes(e):!1:!1}function Ts(t,e=[],n=!1){return e.some(r=>xo(t,r,n))}function lae(){let t=J;return t.crypto||t.msCrypto}var wR;function pae(){return yt()*16}function _t(t=lae()){try{if(t?.randomUUID)return Gi(()=>t.randomUUID()).replace(/-/g,"")}catch{}return wR||(wR="10000000100040008000"+1e11),wR.replace(/[018]/g,e=>(e^(pae()&15)>>e/4).toString(16))}function BG(t){return t.exception?.values?.[0]}function Es(t){let{message:e,event_id:n}=t;if(e)return e;let r=BG(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function GR(t,e,n){let r=t.exception=t.exception||{},o=r.values=r.values||[],s=o[0]=o[0]||{};s.value||(s.value=e||""),s.type||(s.type=n||"Error")}function Rc(t,e){let n=BG(t);if(!n)return;let r={type:"generic",handled:!0},o=n.mechanism;if(n.mechanism={...r,...o,...e},e&&"data"in e){let s={...o?.data,...e.data};n.mechanism.data=s}}var dae=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;function kR(t){return parseInt(t||"",10)}function BR(t){let e=t.match(dae)||[],n=kR(e[1]),r=kR(e[2]),o=kR(e[3]);return{buildmetadata:e[5],major:isNaN(n)?void 0:n,minor:isNaN(r)?void 0:r,patch:isNaN(o)?void 0:o,prerelease:e[4]}}function wf(t){if(jG(t))return!0;try{nt(t,"__sentry_captured__",!0)}catch{}return!1}function jG(t){try{return t.__sentry_captured__}catch{}}var FG=1e3;function vo(){return Zn()/FG}function _ae(){let{performance:t}=J;if(!t?.now||!t.timeOrigin)return vo;let e=t.timeOrigin;return()=>(e+Gi(()=>t.now()))/FG}var HG;function Ss(){return(HG??(HG=_ae()))()}function VG(t){let e=Ss(),n={sid:_t(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>fae(n)};return t&&Lo(n,t),n}function Lo(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||Ss(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:_t()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{let n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function qG(t,e){let n={};e?n={status:e}:t.status==="ok"&&(n={status:"exited"}),Lo(t,n)}function fae(t){return{sid:`${t.sid}`,init:t.init,started:new Date(t.started*1e3).toISOString(),timestamp:new Date(t.timestamp*1e3).toISOString(),status:t.status,errors:t.errors,did:typeof t.did=="number"||typeof t.did=="string"?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}}}function gs(t,e,n=2){if(!e||typeof e!="object"||n<=0)return e;if(t&&Object.keys(e).length===0)return t;let r={...t};for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=gs(r[o],e[o],n-1));return r}function zt(){return _t()}function Kt(){return _t().substring(16)}var jR="_sentrySpan";function Bi(t,e){e?nt(t,jR,e):delete t[jR]}function ji(t){return t[jR]}var mae=100,An=class t{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:zt(),sampleRand:yt()}}clone(){let e=new t;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._attributes={...this._attributes},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,e._conversationId=this._conversationId,Bi(e,ji(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Lo(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(e){return this._conversationId=e||void 0,this._notifyScopeListeners(),this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,n){return this.setTags({[e]:n})}setAttributes(e){return this._attributes={...this._attributes,...e},this._notifyScopeListeners(),this}setAttribute(e,n){return this.setAttributes({[e]:n})}removeAttribute(e){return e in this._attributes&&(delete this._attributes[e],this._notifyScopeListeners()),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,n){return this._extra={...this._extra,[e]:n},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;let n=typeof e=="function"?e(this):e,r=n instanceof t?n.getScopeData():Mo(n)?e:void 0,{tags:o,attributes:s,extra:i,user:a,contexts:c,level:l,fingerprint:p=[],propagationContext:d,conversationId:_}=r||{};return this._tags={...this._tags,...o},this._attributes={...this._attributes,...s},this._extra={...this._extra,...i},this._contexts={...this._contexts,...c},a&&Object.keys(a).length&&(this._user=a),l&&(this._level=l),p.length&&(this._fingerprint=p),d&&(this._propagationContext=d),_&&(this._conversationId=_),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,Bi(this,void 0),this._attachments=[],this.setPropagationContext({traceId:zt(),sampleRand:yt()}),this._notifyScopeListeners(),this}addBreadcrumb(e,n){let r=typeof n=="number"?n:mae;if(r<=0)return this;let o={timestamp:vo(),...e,message:e.message?hs(e.message,2048):e.message};return this._breadcrumbs.push(o),this._breadcrumbs.length>r&&(this._breadcrumbs=this._breadcrumbs.slice(-r),this._client?.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:ji(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=gs(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,n){let r=n?.event_id||_t();if(!this._client)return C&&g.warn("No client configured on scope - will not capture exception!"),r;let o=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:o,...n,event_id:r},this),r}captureMessage(e,n,r){let o=r?.event_id||_t();if(!this._client)return C&&g.warn("No client configured on scope - will not capture message!"),o;let s=r?.syntheticException??new Error(e);return this._client.captureMessage(e,n,{originalException:e,syntheticException:s,...r,event_id:o},this),o}captureEvent(e,n){let r=e.event_id||n?.event_id||_t();return this._client?(this._client.captureEvent(e,{...n,event_id:r},this),r):(C&&g.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}};function yc(){return Ir("defaultCurrentScope",()=>new An)}function er(){return Ir("defaultIsolationScope",()=>new An)}var $G=t=>t instanceof Promise&&!t[YG],YG=Symbol("chained PromiseLike"),kf=(t,e,n)=>{let r=t.then(o=>(e(o),o),o=>{throw n(o),o});return $G(r)&&$G(t)?r:hae(t,r)},hae=(t,e)=>{let n=!1;for(let r in t){if(r in e)continue;n=!0;let o=t[r];typeof o=="function"?Object.defineProperty(e,r,{value:(...s)=>o.apply(t,s),enumerable:!0,configurable:!0,writable:!0}):e[r]=o}return n&&Object.assign(e,{[YG]:!0}),e};var HR=class{constructor(e,n){let r;e?r=e:r=new An;let o;n?o=n:o=new An,this._stack=[{scope:r}],this._isolationScope=o}withScope(e){let n=this._pushScope(),r;try{r=e(n)}catch(o){throw this._popScope(),o}return Lt(r)?kf(r,()=>this._popScope(),()=>this._popScope()):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function Ic(){let t=cn(),e=fs(t);return e.stack=e.stack||new HR(yc(),er())}function Tae(t){return Ic().withScope(t)}function Eae(t,e){let n=Ic();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function WG(t){return Ic().withScope(()=>t(Ic().getIsolationScope()))}function zG(){return{withIsolationScope:WG,withScope:Tae,withSetScope:Eae,withSetIsolationScope:(t,e)=>WG(e),getCurrentScope:()=>Ic().getScope(),getIsolationScope:()=>Ic().getIsolationScope()}}function FR(t){let e=cn(),n=fs(e);n.acs=t}function Or(t){let e=fs(t);return e.acs?e.acs:zG()}var KG;function QG(){return KG?.()}function VR(){return KG!==void 0}function he(){let t=cn();return Or(t).getCurrentScope()}function ue(){let t=cn();return Or(t).getIsolationScope()}function Gf(){return Ir("globalScope",()=>new An)}function Gn(...t){let e=cn(),n=Or(e);if(t.length===2){let[r,o]=t;return r?n.withSetScope(r,o):n.withScope(o)}return n.withScope(t[0])}function Wl(...t){let e=cn(),n=Or(e);if(t.length===2){let[r,o]=t;return r?n.withSetIsolationScope(r,o):n.withIsolationScope(o)}return n.withIsolationScope(t[0])}function H(){return he().getClient()}function Hi(t){let e=QG();if(e)return{trace_id:e.traceId,span_id:e.spanId};let n=t.getPropagationContext(),{traceId:r,parentSpanId:o,propagationSpanId:s}=n,i={trace_id:r,span_id:s||Kt()};return o&&(i.parent_span_id=o),i}var Ue="sentry.source",Nr="sentry.sample_rate",qR="sentry.previous_trace_sample_rate",ee="sentry.op",W="sentry.origin";var $R="sentry.measurement_unit",YR="sentry.measurement_value",tr="sentry.custom_span_name",Oc="sentry.profile_id",Nc="sentry.exclusive_time",WR="cache.hit",zR="cache.key",KR="cache.item_size",QR="http.request.method",As="url.full";var XR="gen_ai.conversation.id";function Do(t){if(t<400&&t>=100)return{code:1};if(t>=400&&t<500)switch(t){case 401:return{code:2,message:"unauthenticated"};case 403:return{code:2,message:"permission_denied"};case 404:return{code:2,message:"not_found"};case 409:return{code:2,message:"already_exists"};case 413:return{code:2,message:"failed_precondition"};case 429:return{code:2,message:"resource_exhausted"};case 499:return{code:2,message:"cancelled"};default:return{code:2,message:"invalid_argument"}}if(t>=500&&t<600)switch(t){case 501:return{code:2,message:"unimplemented"};case 503:return{code:2,message:"unavailable"};case 504:return{code:2,message:"deadline_exceeded"};default:return{code:2,message:"internal_error"}}return{code:2,message:"internal_error"}}var XG="_sentryScope",JG="_sentryIsolationScope";function Sae(t){try{let e=J.WeakRef;if(typeof e=="function")return new e(t)}catch{}return t}function gae(t){if(t){if(typeof t=="object"&&"deref"in t&&typeof t.deref=="function")try{return t.deref()}catch{return}return t}}function zl(t,e,n){t&&(nt(t,JG,Sae(n)),nt(t,XG,e))}function br(t){let e=t;return{scope:e[XG],isolationScope:gae(e[JG])}}var Xr="sentry-";var eB=8192;function Uo(t){let e=Vi(t);if(!e)return;let n=Object.entries(e).reduce((r,[o,s])=>{if(o.startsWith(Xr)){let i=o.slice(Xr.length);r[i]=s}return r},{});if(Object.keys(n).length>0)return n}function Fi(t){if(!t)return;let e=Object.entries(t).reduce((n,[r,o])=>(o&&(n[`${Xr}${r}`]=o),n),{});return Bf(e)}function Vi(t){if(!(!t||!ms(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,n)=>{let r=ZG(n);return Object.entries(r).forEach(([o,s])=>{e[o]=s}),e},{}):ZG(t)}function ZG(t){return t.split(",").map(e=>{let n=e.indexOf("=");if(n===-1)return[];let r=e.slice(0,n),o=e.slice(n+1);return[r,o].map(s=>{try{return decodeURIComponent(s.trim())}catch{return}})}).reduce((e,[n,r])=>(n&&r&&(e[n]=r),e),{})}function Bf(t){if(Object.keys(t).length!==0)return Object.entries(t).reduce((e,[n,r],o)=>{let s=`${encodeURIComponent(n)}=${encodeURIComponent(r)}`,i=o===0?s:`${e},${s}`;return i.length>eB?(C&&g.warn(`Not adding key: ${n} with val: ${r} to baggage header due to exceeding baggage size limits.`),e):i},"")}var Aae=/^o(\d+)\./,Rae=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function yae(t){return t==="http"||t==="https"}function Bn(t,e=!1){let{host:n,path:r,pass:o,port:s,projectId:i,protocol:a,publicKey:c}=t;return`${a}://${c}${e&&o?`:${o}`:""}@${n}${s?`:${s}`:""}/${r&&`${r}/`}${i}`}function Iae(t){let e=Rae.exec(t);if(!e){Qe(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}let[n,r,o="",s="",i="",a=""]=e.slice(1),c="",l=a,p=l.split("/");if(p.length>1&&(c=p.slice(0,-1).join("/"),l=p.pop()),l){let d=l.match(/^\d+/);d&&(l=d[0])}return tB({host:s,pass:o,path:c,projectId:l,port:i,protocol:n,publicKey:r})}function tB(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function Oae(t){if(!C)return!0;let{port:e,projectId:n,protocol:r}=t;return["protocol","publicKey","host","projectId"].find(i=>t[i]?!1:(g.error(`Invalid Sentry Dsn: ${i} missing`),!0))?!1:n.match(/^\d+$/)?yae(r)?e&&isNaN(parseInt(e,10))?(g.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(g.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(g.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function Nae(t){return t.match(Aae)?.[1]}function jf(t){let e=t.getOptions(),{host:n}=t.getDsn()||{},r;return e.orgId?r=String(e.orgId):n&&(r=Nae(n)),r}function nB(t){let e=typeof t=="string"?Iae(t):tB(t);if(!(!e||!Oae(e)))return e}function jn(t){if(typeof t=="boolean")return Number(t);let e=typeof t=="string"?parseFloat(t):t;if(!(typeof e!="number"||isNaN(e)||e<0||e>1))return e}var Hf=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function rB(t){if(!t)return;let e=t.match(Hf);if(!e)return;let n;return e[3]==="1"?n=!0:e[3]==="0"&&(n=!1),{traceId:e[1],parentSampled:n,parentSpanId:e[2]}}function Kl(t,e){let n=rB(t),r=Uo(e);if(!n?.traceId)return{traceId:zt(),sampleRand:yt()};let o=bae(n,r);r&&(r.sample_rand=o.toString());let{traceId:s,parentSpanId:i,parentSampled:a}=n;return{traceId:s,parentSpanId:i,sampled:a,dsc:r||{},sampleRand:o}}function Rs(t=zt(),e=Kt(),n){let r="";return n!==void 0&&(r=n?"-1":"-0"),`${t}-${e}${r}`}function ys(t=zt(),e=Kt(),n){return`00-${t}-${e}-${n?"01":"00"}`}function bae(t,e){let n=jn(e?.sample_rand);if(n!==void 0)return n;let r=jn(e?.sample_rate);return r&&t?.parentSampled!==void 0?t.parentSampled?yt()*r:r+yt()*(1-r):yt()}function JR(t,e){let n=jf(t);return e&&n&&e!==n?(g.log(`Won't continue trace because org IDs don't match (incoming baggage: ${e}, SDK options: ${n})`),!1):(t.getOptions().strictTraceContinuation||!1)&&(e&&!n||!e&&n)?(g.log(`Starting a new trace because strict trace continuation is enabled but one org ID is missing (incoming baggage: ${e}, Sentry client: ${n})`),!1):!0}var Vf=0,qf=1,oB=!1;function iB(t){let{spanId:e,traceId:n}=t.spanContext(),{data:r,op:o,parent_span_id:s,status:i,origin:a,links:c}=Y(t);return{parent_span_id:s,span_id:e,trace_id:n,data:r,op:o,status:i,origin:a,links:c}}function Is(t){let{spanId:e,traceId:n,isRemote:r}=t.spanContext(),o=r?e:Y(t).parent_span_id,s=br(t).scope,i=r?s?.getPropagationContext().propagationSpanId||Kt():e;return{parent_span_id:o,span_id:i,trace_id:n}}function $f(t){let{traceId:e,spanId:n}=t.spanContext(),r=Cr(t);return Rs(e,n,r)}function aB(t){let{traceId:e,spanId:n}=t.spanContext(),r=Cr(t);return ys(e,n,r)}function qi(t){if(t&&t.length>0)return t.map(({context:{spanId:e,traceId:n,traceFlags:r,...o},attributes:s})=>({span_id:e,trace_id:n,sampled:r===qf,attributes:s,...o}))}function Rn(t){return typeof t=="number"?sB(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?sB(t.getTime()):Ss()}function sB(t){return t>9999999999?t/1e3:t}function Y(t){if(Mae(t))return t.getSpanJSON();let{spanId:e,traceId:n}=t.spanContext();if(Pae(t)){let{attributes:r,startTime:o,name:s,endTime:i,status:a,links:c}=t,l="parentSpanId"in t?t.parentSpanId:"parentSpanContext"in t?t.parentSpanContext?.spanId:void 0;return{span_id:e,trace_id:n,data:r,description:s,parent_span_id:l,start_timestamp:Rn(o),timestamp:Rn(i)||void 0,status:$i(a),op:r[ee],origin:r[W],links:qi(c)}}return{span_id:e,trace_id:n,start_timestamp:0,data:{}}}function Pae(t){let e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function Mae(t){return typeof t.getSpanJSON=="function"}function Cr(t){let{traceFlags:e}=t.spanContext();return e===qf}function $i(t){if(!(!t||t.code===0))return t.code===1?"ok":t.message||"internal_error"}var Ql="_sentryChildSpans",ZR="_sentryRootSpan";function bc(t,e){let n=t[ZR]||t;nt(e,ZR,n),t[Ql]?t[Ql].add(e):nt(t,Ql,new Set([e]))}function Yf(t){let e=new Set;function n(r){if(!e.has(r)&&Cr(r)){e.add(r);let o=r[Ql]?Array.from(r[Ql]):[];for(let s of o)n(s)}}return n(t),Array.from(e)}function je(t){return t[ZR]||t}function nr(){let t=cn(),e=Or(t);return e.getActiveSpan?e.getActiveSpan():ji(he())}function Xl(){oB||(Qe(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),oB=!0)}var cB=!1;function uB(){if(cB)return;function t(){let e=nr(),n=e&&je(e);if(n){let r="internal_error";C&&g.log(`[Tracing] Root span: ${r} -> Global error occurred`),n.setStatus({code:2,message:r})}}t.tag="sentry_tracingErrorCallback",cB=!0,vG(t),LG(t)}function Xe(t){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;let e=t||H()?.getOptions();return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}function lB(t){g.log(`Ignoring span ${t.op} - ${t.description} because it matches \`ignoreSpans\`.`)}function Jl(t,e){if(!e?.length||!t.description)return!1;for(let n of e){if(xae(n)){if(xo(t.description,n))return C&&lB(t),!0;continue}if(!n.name&&!n.op)continue;let r=n.name?xo(t.description,n.name):!0,o=n.op?t.op&&xo(t.op,n.op):!0;if(r&&o)return C&&lB(t),!0}return!1}function pB(t,e){let n=e.parent_span_id,r=e.span_id;if(n)for(let o of t)o.parent_span_id===r&&(o.parent_span_id=n)}function xae(t){return typeof t=="string"||t instanceof RegExp}var Cc="production";var dB="_frozenDsc";function Wf(t,e){nt(t,dB,e)}function ey(t,e){let n=e.getOptions(),{publicKey:r}=e.getDsn()||{},o={environment:n.environment||Cc,release:n.release,public_key:r,trace_id:t,org_id:jf(e)};return e.emit("createDsc",o),o}function Jr(t,e){let n=e.getPropagationContext();return n.dsc||ey(n.traceId,t)}function Je(t){let e=H();if(!e)return{};let n=je(t),r=Y(n),o=r.data,s=n.spanContext().traceState,i=s?.get("sentry.sample_rate")??o[Nr]??o[qR];function a(m){return(typeof i=="number"||typeof i=="string")&&(m.sample_rate=`${i}`),m}let c=n[dB];if(c)return a(c);let l=s?.get("sentry.dsc"),p=l&&Uo(l);if(p)return a(p);let d=ey(t.spanContext().traceId,e),_=o[Ue],f=r.description;return _!=="url"&&f&&(d.transaction=f),Xe()&&(d.sampled=String(Cr(n)),d.sample_rand=s?.get("sentry.sample_rand")??br(n).scope?.getPropagationContext().sampleRand.toString()),a(d),e.emit("createDsc",d,n),d}var Os=class{constructor(e={}){this._traceId=e.traceId||zt(),this._spanId=e.spanId||Kt()}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:Vf}}end(e){}setAttribute(e,n){return this}setAttributes(e){return this}setStatus(e){return this}updateName(e){return this}isRecording(){return!1}addEvent(e,n,r){return this}addLink(e){return this}addLinks(e){return this}recordException(e,n){}};function Pr(t,e=100,n=1/0){try{return ty("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function ny(t,e=3,n=100*1024){let r=Pr(t,e);return Uae(r)>n?ny(t,e-1,n):r}function ty(t,e,n=1/0,r=1/0,o=wae()){let[s,i]=o;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;let a=vae(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;let c=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:n;if(c===0)return a.replace("object ","");if(s(e))return"[Circular ~]";let l=e;if(l&&typeof l.toJSON=="function")try{let f=l.toJSON();return ty("",f,c-1,r,o)}catch{}let p=Array.isArray(e)?[]:{},d=0,_=Uf(e);for(let f in _){if(!Object.prototype.hasOwnProperty.call(_,f))continue;if(d>=r){p[f]="[MaxProperties ~]";break}let m=_[f];p[f]=ty(f,m,c-1,r,o),d++}return i(e),p}function vae(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(Yl(e))return vf(e);if(MR(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${ql(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;let n=Lae(e);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function Lae(t){let e=Object.getPrototypeOf(t);return e?.constructor?e.constructor.name:"null prototype"}function Dae(t){return~-encodeURI(t).split(/%..|./).length}function Uae(t){return Dae(JSON.stringify(t))}function wae(){let t=new WeakSet;function e(r){return t.has(r)?!0:(t.add(r),!1)}function n(r){t.delete(r)}return[e,n]}function un(t,e=[]){return[t,e]}function oy(t,e){let[n,r]=t;return[n,[...r,e]]}function Zl(t,e){let n=t[1];for(let r of n){let o=r[0].type;if(e(r,o))return!0}return!1}function sy(t,e){return Zl(t,(n,r)=>e.includes(r))}function ry(t){let e=fs(J);return e.encodePolyfill?e.encodePolyfill(t):new TextEncoder().encode(t)}function ep(t){let[e,n]=t,r=JSON.stringify(e);function o(s){typeof r=="string"?r=typeof s=="string"?r+s:[ry(r),s]:r.push(typeof s=="string"?ry(s):s)}for(let s of n){let[i,a]=s;if(o(`
16
+ ${JSON.stringify(i)}
17
+ `),typeof a=="string"||a instanceof Uint8Array)o(a);else{let c;try{c=JSON.stringify(a)}catch{c=JSON.stringify(Pr(a))}o(c)}}return typeof r=="string"?r:kae(r)}function kae(t){let e=t.reduce((o,s)=>o+s.length,0),n=new Uint8Array(e),r=0;for(let o of t)n.set(o,r),r+=o.length;return n}function iy(t){return[{type:"span"},t]}function ay(t){let e=typeof t.data=="string"?ry(t.data):t.data;return[{type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType},e]}var _B={sessions:"session",event:"error",client_report:"internal",user_report:"default",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",raw_security:"security",log:"log_item",trace_metric:"metric"};function Gae(t){return t in _B}function zf(t){return Gae(t)?_B[t]:t}function Kf(t){if(!t?.sdk)return;let{name:e,version:n}=t.sdk;return{name:e,version:n}}function cy(t,e,n,r){let o=t.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:t.event_id,sent_at:new Date().toISOString(),...e&&{sdk:e},...!!n&&r&&{dsn:Bn(r)},...o&&{trace:o}}}function Bae(t,e){if(!e)return t;let n=t.sdk||{};return t.sdk={...n,name:n.name||e.name,version:n.version||e.version,integrations:[...t.sdk?.integrations||[],...e.integrations||[]],packages:[...t.sdk?.packages||[],...e.packages||[]],settings:t.sdk?.settings||e.settings?{...t.sdk?.settings,...e.settings}:void 0},t}function fB(t,e,n,r){let o=Kf(n),s={sent_at:new Date().toISOString(),...o&&{sdk:o},...!!r&&e&&{dsn:Bn(e)}},i="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return un(s,[i])}function mB(t,e,n,r){let o=Kf(n),s=t.type&&t.type!=="replay_event"?t.type:"event";Bae(t,n?.sdk);let i=cy(t,o,r,e);return delete t.sdkProcessingMetadata,un(i,[[{type:s},t]])}function hB(t,e){function n(f){return!!f.trace_id&&!!f.public_key}let r=Je(t[0]),o=e?.getDsn(),s=e?.getOptions().tunnel,i={sent_at:new Date().toISOString(),...n(r)&&{trace:r},...!!s&&o&&{dsn:Bn(o)}},{beforeSendSpan:a,ignoreSpans:c}=e?.getOptions()||{},l=c?.length?t.filter(f=>!Jl(Y(f),c)):t,p=t.length-l.length;p&&e?.recordDroppedEvent("before_send","span",p);let d=a?f=>{let m=Y(f),h=a(m);return h||(Xl(),m)}:Y,_=[];for(let f of l){let m=d(f);m&&_.push(iy(m))}return un(i,_)}function tp(t){if(!C)return;let{description:e="< unknown name >",op:n="< unknown op >",parent_span_id:r}=Y(t),{spanId:o}=t.spanContext(),s=Cr(t),i=je(t),a=i===t,c=`[Tracing] Starting ${s?"sampled":"unsampled"} ${a?"root ":""}span`,l=[`op: ${n}`,`name: ${e}`,`ID: ${o}`];if(r&&l.push(`parent ID: ${r}`),!a){let{op:p,description:d}=Y(i);l.push(`root ID: ${i.spanContext().spanId}`),p&&l.push(`root op: ${p}`),d&&l.push(`root description: ${d}`)}g.log(`${c}
18
+ ${l.join(`
19
+ `)}`)}function np(t){if(!C)return;let{description:e="< unknown name >",op:n="< unknown op >"}=Y(t),{spanId:r}=t.spanContext(),s=je(t)===t,i=`[Tracing] Finishing "${n}" ${s?"root ":""}span "${e}" with ID ${r}`;g.log(i)}function Yi(t){if(!t||t.length===0)return;let e={};return t.forEach(n=>{let r=n.attributes||{},o=r[$R],s=r[YR];typeof o=="string"&&typeof s=="number"&&(e[n.name]={value:s,unit:o})}),e}var TB=1e3,Pc=class{constructor(e={}){this._traceId=e.traceId||zt(),this._spanId=e.spanId||Kt(),this._startTime=e.startTimestamp||Ss(),this._links=e.links,this._attributes={},this.setAttributes({[W]:"manual",[ee]:e.op,...e.attributes}),this._name=e.name,e.parentSpanId&&(this._parentSpanId=e.parentSpanId),"sampled"in e&&(this._sampled=e.sampled),e.endTimestamp&&(this._endTime=e.endTimestamp),this._events=[],this._isStandaloneSpan=e.isStandalone,this._endTime&&this._onSpanEnded()}addLink(e){return this._links?this._links.push(e):this._links=[e],this}addLinks(e){return this._links?this._links.push(...e):this._links=e,this}recordException(e,n){}spanContext(){let{_spanId:e,_traceId:n,_sampled:r}=this;return{spanId:e,traceId:n,traceFlags:r?qf:Vf}}setAttribute(e,n){return n===void 0?delete this._attributes[e]:this._attributes[e]=n,this}setAttributes(e){return Object.keys(e).forEach(n=>this.setAttribute(n,e[n])),this}updateStartTime(e){this._startTime=Rn(e)}setStatus(e){return this._status=e,this}updateName(e){return this._name=e,this.setAttribute(Ue,"custom"),this}end(e){this._endTime||(this._endTime=Rn(e),np(this),this._onSpanEnded())}getSpanJSON(){return{data:this._attributes,description:this._name,op:this._attributes[ee],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:$i(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[W],profile_id:this._attributes[Oc],exclusive_time:this._attributes[Nc],measurements:Yi(this._events),is_segment:this._isStandaloneSpan&&je(this)===this||void 0,segment_id:this._isStandaloneSpan?je(this).spanContext().spanId:void 0,links:qi(this._links)}}isRecording(){return!this._endTime&&!!this._sampled}addEvent(e,n,r){C&&g.log("[Tracing] Adding an event to span:",e);let o=EB(n)?n:r||Ss(),s=EB(n)?{}:n||{},i={name:e,time:Rn(o),attributes:s};return this._events.push(i),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){let e=H();if(e&&e.emit("spanEnd",this),!(this._isStandaloneSpan||this===je(this)))return;if(this._isStandaloneSpan){this._sampled?Hae(hB([this],e)):(C&&g.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled."),e&&e.recordDroppedEvent("sample_rate","span"));return}let r=this._convertSpanToTransaction();r&&(br(this).scope||he()).captureEvent(r)}_convertSpanToTransaction(){if(!SB(Y(this)))return;this._name||(C&&g.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this._name="<unlabeled transaction>");let{scope:e,isolationScope:n}=br(this),r=e?.getScopeData().sdkProcessingMetadata?.normalizedRequest;if(this._sampled!==!0)return;let s=Yf(this).filter(p=>p!==this&&!jae(p)).map(p=>Y(p)).filter(SB),i=this._attributes[Ue];delete this._attributes[tr],s.forEach(p=>{delete p.data[tr]});let a={contexts:{trace:iB(this)},spans:s.length>TB?s.sort((p,d)=>p.start_timestamp-d.start_timestamp).slice(0,TB):s,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:e,capturedSpanIsolationScope:n,dynamicSamplingContext:Je(this)},request:r,...i&&{transaction_info:{source:i}}},c=Yi(this._events);return c&&Object.keys(c).length&&(C&&g.log("[Measurements] Adding measurements to transaction event",JSON.stringify(c,void 0,2)),a.measurements=c),a}};function EB(t){return t&&typeof t=="number"||t instanceof Date||Array.isArray(t)}function SB(t){return!!t.start_timestamp&&!!t.timestamp&&!!t.span_id&&!!t.trace_id}function jae(t){return t instanceof Pc&&t.isStandaloneSpan()}function Hae(t){let e=H();if(!e)return;let n=t[1];if(!n||n.length===0){e.recordDroppedEvent("before_send","span");return}e.sendEnvelope(t)}function Mr(t,e,n=()=>{},r=()=>{}){let o;try{o=t()}catch(s){throw e(s),n(),s}return Fae(o,e,n,r)}function Fae(t,e,n,r){return Lt(t)?kf(t,o=>{n(),r(o)},o=>{e(o),n()}):(n(),r(t),t)}function rp(t,e,n){if(!Xe(t))return[!1];let r,o;typeof t.tracesSampler=="function"?(o=t.tracesSampler({...e,inheritOrSampleWith:a=>typeof e.parentSampleRate=="number"?e.parentSampleRate:typeof e.parentSampled=="boolean"?Number(e.parentSampled):a}),r=!0):e.parentSampled!==void 0?o=e.parentSampled:typeof t.tracesSampleRate<"u"&&(o=t.tracesSampleRate,r=!0);let s=jn(o);if(s===void 0)return C&&g.warn(`[Tracing] Discarding root span because of invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(o)} of type ${JSON.stringify(typeof o)}.`),[!1];if(!s)return C&&g.log(`[Tracing] Discarding transaction because ${typeof t.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0"}`),[!1,s,r];let i=n<s;return i||C&&g.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(o)})`),[i,s,r]}var Qf="__SENTRY_SUPPRESS_TRACING__";function xr(t,e){let n=op();if(n.startSpan)return n.startSpan(t,e);let r=ly(t),{forceTransaction:o,parentSpan:s,scope:i}=t,a=i?.clone();return Gn(a,()=>AB(s)(()=>{let l=he(),p=py(l,s),_=t.onlyIfParent&&!p?new Os:uy({parentSpan:p,spanArguments:r,forceTransaction:o,scope:l});return Bi(l,_),Mr(()=>e(_),()=>{let{status:f}=Y(_);_.isRecording()&&(!f||f==="ok")&&_.setStatus({code:2,message:"internal_error"})},()=>{_.end()})}))}function It(t,e){let n=op();if(n.startSpanManual)return n.startSpanManual(t,e);let r=ly(t),{forceTransaction:o,parentSpan:s,scope:i}=t,a=i?.clone();return Gn(a,()=>AB(s)(()=>{let l=he(),p=py(l,s),_=t.onlyIfParent&&!p?new Os:uy({parentSpan:p,spanArguments:r,forceTransaction:o,scope:l});return Bi(l,_),Mr(()=>e(_,()=>_.end()),()=>{let{status:f}=Y(_);_.isRecording()&&(!f||f==="ok")&&_.setStatus({code:2,message:"internal_error"})})}))}function Xf(t){let e=op();if(e.startInactiveSpan)return e.startInactiveSpan(t);let n=ly(t),{forceTransaction:r,parentSpan:o}=t;return(t.scope?i=>Gn(t.scope,i):o!==void 0?i=>Mc(o,i):i=>i())(()=>{let i=he(),a=py(i,o);return t.onlyIfParent&&!a?new Os:uy({parentSpan:a,spanArguments:n,forceTransaction:r,scope:i})})}function Mc(t,e){let n=op();return n.withActiveSpan?n.withActiveSpan(t,e):Gn(r=>(Bi(r,t||void 0),e(r)))}function xc(t){let e=op();return e.suppressTracing?e.suppressTracing(t):Gn(n=>{n.setSDKProcessingMetadata({[Qf]:!0});let r=t();return n.setSDKProcessingMetadata({[Qf]:void 0}),r})}function uy({parentSpan:t,spanArguments:e,forceTransaction:n,scope:r}){if(!Xe()){let i=new Os;if(n||!t){let a={sampled:"false",sample_rate:"0",transaction:e.name,...Je(i)};Wf(i,a)}return i}let o=ue(),s;if(t&&!n)s=Vae(t,r,e),bc(t,s);else if(t){let i=Je(t),{traceId:a,spanId:c}=t.spanContext(),l=Cr(t);s=gB({traceId:a,parentSpanId:c,...e},r,l),Wf(s,i)}else{let{traceId:i,dsc:a,parentSpanId:c,sampled:l}={...o.getPropagationContext(),...r.getPropagationContext()};s=gB({traceId:i,parentSpanId:c,...e},r,l),a&&Wf(s,a)}return tp(s),zl(s,r,o),s}function ly(t){let n={isStandalone:(t.experimental||{}).standalone,...t};if(t.startTime){let r={...n};return r.startTimestamp=Rn(t.startTime),delete r.startTime,r}return n}function op(){let t=cn();return Or(t)}function gB(t,e,n){let r=H(),o=r?.getOptions()||{},{name:s=""}=t,i={spanAttributes:{...t.attributes},spanName:s,parentSampled:n};r?.emit("beforeSampling",i,{decision:!1});let a=i.parentSampled??n,c=i.spanAttributes,l=e.getPropagationContext(),[p,d,_]=e.getScopeData().sdkProcessingMetadata[Qf]?[!1]:rp(o,{name:s,parentSampled:a,attributes:c,parentSampleRate:jn(l.dsc?.sample_rate)},l.sampleRand),f=new Pc({...t,attributes:{[Ue]:"custom",[Nr]:d!==void 0&&_?d:void 0,...c},sampled:p});return!p&&r&&(C&&g.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),r.recordDroppedEvent("sample_rate","transaction")),r&&r.emit("spanStart",f),f}function Vae(t,e,n){let{spanId:r,traceId:o}=t.spanContext(),s=e.getScopeData().sdkProcessingMetadata[Qf]?!1:Cr(t),i=s?new Pc({...n,parentSpanId:r,traceId:o,sampled:s}):new Os({traceId:o});bc(t,i);let a=H();return a&&(a.emit("spanStart",i),n.endTimestamp&&a.emit("spanEnd",i)),i}function py(t,e){if(e)return e;if(e===null)return;let n=ji(t);if(!n)return;let r=H();return(r?r.getOptions():{}).parentSpanIsAlwaysRootSpan?je(n):n}function AB(t){return t!==void 0?e=>Mc(t,e):e=>e()}var dy=0,RB=1,yB=2;function wo(t){return new Jf(e=>{e(t)})}function vc(t){return new Jf((e,n)=>{n(t)})}var Jf=class t{constructor(e){this._state=dy,this._handlers=[],this._runExecutor(e)}then(e,n){return new t((r,o)=>{this._handlers.push([!1,s=>{if(!e)r(s);else try{r(e(s))}catch(i){o(i)}},s=>{if(!n)o(s);else try{r(n(s))}catch(i){o(i)}}]),this._executeHandlers()})}catch(e){return this.then(n=>n,e)}finally(e){return new t((n,r)=>{let o,s;return this.then(i=>{s=!1,o=i,e&&e()},i=>{s=!0,o=i,e&&e()}).then(()=>{if(s){r(o);return}n(o)})})}_executeHandlers(){if(this._state===dy)return;let e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===RB&&n[1](this._value),this._state===yB&&n[2](this._value),n[0]=!0)})}_runExecutor(e){let n=(s,i)=>{if(this._state===dy){if(Lt(i)){i.then(r,o);return}this._state=s,this._value=i,this._executeHandlers()}},r=s=>{n(RB,s)},o=s=>{n(yB,s)};try{e(r,o)}catch(s){o(s)}}};function IB(t,e,n,r=0){try{let o=_y(e,n,t,r);return Lt(o)?o:wo(o)}catch(o){return vc(o)}}function _y(t,e,n,r){let o=n[r];if(!t||!o)return t;let s=o({...t},e);return C&&s===null&&g.log(`Event processor "${o.id||"?"}" dropped event`),Lt(s)?s.then(i=>_y(i,e,n,r+1)):_y(s,e,n,r+1)}var Wi,OB,NB,Ns;function bB(t){let e=J._sentryDebugIds,n=J._debugIds;if(!e&&!n)return{};let r=e?Object.keys(e):[],o=n?Object.keys(n):[];if(Ns&&r.length===OB&&o.length===NB)return Ns;OB=r.length,NB=o.length,Ns={},Wi||(Wi={});let s=(i,a)=>{for(let c of i){let l=a[c],p=Wi?.[c];if(p&&Ns&&l)Ns[p[0]]=l,Wi&&(Wi[c]=[p[0],l]);else if(l){let d=t(c);for(let _=d.length-1;_>=0;_--){let m=d[_]?.filename;if(m&&Ns&&Wi){Ns[m]=l,Wi[c]=[m,l];break}}}}};return e&&s(r,e),n&&s(o,n),Ns}function PB(t,e){let{fingerprint:n,span:r,breadcrumbs:o,sdkProcessingMetadata:s}=e;qae(t,e),r&&Wae(t,r),zae(t,n),$ae(t,o),Yae(t,s)}function CB(t,e){let{extra:n,tags:r,attributes:o,user:s,contexts:i,level:a,sdkProcessingMetadata:c,breadcrumbs:l,fingerprint:p,eventProcessors:d,attachments:_,propagationContext:f,transactionName:m,span:h}=e;sp(t,"extra",n),sp(t,"tags",r),sp(t,"attributes",o),sp(t,"user",s),sp(t,"contexts",i),t.sdkProcessingMetadata=gs(t.sdkProcessingMetadata,c,2),a&&(t.level=a),m&&(t.transactionName=m),h&&(t.span=h),l.length&&(t.breadcrumbs=[...t.breadcrumbs,...l]),p.length&&(t.fingerprint=[...t.fingerprint,...p]),d.length&&(t.eventProcessors=[...t.eventProcessors,...d]),_.length&&(t.attachments=[...t.attachments,..._]),t.propagationContext={...t.propagationContext,...f}}function sp(t,e,n){t[e]=gs(t[e],n,1)}function Zf(t,e){let n=Gf().getScopeData();return t&&CB(n,t.getScopeData()),e&&CB(n,e.getScopeData()),n}function qae(t,e){let{extra:n,tags:r,user:o,contexts:s,level:i,transactionName:a}=e;Object.keys(n).length&&(t.extra={...n,...t.extra}),Object.keys(r).length&&(t.tags={...r,...t.tags}),Object.keys(o).length&&(t.user={...o,...t.user}),Object.keys(s).length&&(t.contexts={...s,...t.contexts}),i&&(t.level=i),a&&t.type!=="transaction"&&(t.transaction=a)}function $ae(t,e){let n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}function Yae(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}function Wae(t,e){t.contexts={trace:Is(e),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:Je(e),...t.sdkProcessingMetadata};let n=je(e),r=Y(n).description;r&&!t.transaction&&t.type==="transaction"&&(t.transaction=r)}function zae(t,e){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint.length||delete t.fingerprint}function MB(t,e,n,r,o,s){let{normalizeDepth:i=3,normalizeMaxBreadth:a=1e3}=t,c={...e,event_id:e.event_id||n.event_id||_t(),timestamp:e.timestamp||vo()},l=n.integrations||t.integrations.map(S=>S.name);Kae(c,t),Jae(c,l),o&&o.emit("applyFrameMetadata",e),e.type===void 0&&Qae(c,t.stackParser);let p=ece(r,n.captureContext);n.mechanism&&Rc(c,n.mechanism);let d=o?o.getEventProcessors():[],_=Zf(s,p),f=[...n.attachments||[],..._.attachments];f.length&&(n.attachments=f),PB(c,_);let m=[...d,..._.eventProcessors];return(n.data&&n.data.__sentry__===!0?wo(c):IB(m,c,n)).then(S=>(S&&Xae(S),typeof i=="number"&&i>0?Zae(S,i,a):S))}function Kae(t,e){let{environment:n,release:r,dist:o,maxValueLength:s}=e;t.environment=t.environment||n||Cc,!t.release&&r&&(t.release=r),!t.dist&&o&&(t.dist=o);let i=t.request;i?.url&&s&&(i.url=hs(i.url,s)),s&&t.exception?.values?.forEach(a=>{a.value&&(a.value=hs(a.value,s))})}function Qae(t,e){let n=bB(e);t.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(o=>{o.filename&&(o.debug_id=n[o.filename])})})}function Xae(t){let e={};if(t.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(o=>{o.debug_id&&(o.abs_path?e[o.abs_path]=o.debug_id:o.filename&&(e[o.filename]=o.debug_id),delete o.debug_id)})}),Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];let n=t.debug_meta.images;Object.entries(e).forEach(([r,o])=>{n.push({type:"sourcemap",code_file:r,debug_id:o})})}function Jae(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function Zae(t,e,n){if(!t)return null;let r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(o=>({...o,...o.data&&{data:Pr(o.data,e,n)}}))},...t.user&&{user:Pr(t.user,e,n)},...t.contexts&&{contexts:Pr(t.contexts,e,n)},...t.extra&&{extra:Pr(t.extra,e,n)}};return t.contexts?.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=Pr(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map(o=>({...o,...o.data&&{data:Pr(o.data,e,n)}}))),t.contexts?.flags&&r.contexts&&(r.contexts.flags=Pr(t.contexts.flags,3,n)),r}function ece(t,e){if(!e)return t;let n=t?t.clone():new An;return n.update(e),n}function xB(t){if(t)return tce(t)?{captureContext:t}:rce(t)?{captureContext:t}:t}function tce(t){return t instanceof An||typeof t=="function"}var nce=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function rce(t){return Object.keys(t).some(e=>nce.includes(e))}function te(t,e){return he().captureException(t,xB(e))}function em(t,e){return he().captureEvent(t,e)}function tm(t,e){ue().setTag(t,e)}async function nm(t){let e=H();return e?e.flush(t):(C&&g.warn("Cannot flush events. No client defined."),Promise.resolve(!1))}async function rm(t){let e=H();return e?e.close(t):(C&&g.warn("Cannot flush events and disable SDK. No client defined."),Promise.resolve(!1))}function om(){let t=H();return t?.getOptions().enabled!==!1&&!!t?.getTransport()}function sm(t){let e=ue(),{user:n}=Zf(e,he()),{userAgent:r}=J.navigator||{},o=VG({user:n,...r&&{userAgent:r},...t}),s=e.getSession();return s?.status==="ok"&&Lo(s,{status:"exited"}),ip(),e.setSession(o),o}function ip(){let t=ue(),n=he().getSession()||t.getSession();n&&qG(n),oce(),t.setSession()}function oce(){let t=ue(),e=H(),n=t.getSession();n&&e&&e.captureSession(n)}var sce="7";function ice(t){let e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}function ace(t){return`${ice(t)}${t.projectId}/envelope/`}function cce(t,e){let n={sentry_version:sce};return t.publicKey&&(n.sentry_key=t.publicKey),e&&(n.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(n).toString()}function vB(t,e,n){return e||`${ace(t)}?${cce(t,n)}`}var fy=[];function uce(t){let e={};return t.forEach(n=>{let{name:r}=n,o=e[r];o&&!o.isDefaultInstance&&n.isDefaultInstance||(e[r]=n)}),Object.values(e)}function my(t){let e=t.defaultIntegrations||[],n=t.integrations;e.forEach(o=>{o.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...e,...n];else if(typeof n=="function"){let o=n(e);r=Array.isArray(o)?o:[o]}else r=e;return uce(r)}function LB(t,e){let n={};return e.forEach(r=>{r&&Ty(t,r,n)}),n}function hy(t,e){for(let n of e)n?.afterAllSetup&&n.afterAllSetup(t)}function Ty(t,e,n){if(n[e.name]){C&&g.log(`Integration skipped because it was already installed: ${e.name}`);return}if(n[e.name]=e,!fy.includes(e.name)&&typeof e.setupOnce=="function"&&(e.setupOnce(),fy.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){let r=e.preprocessEvent.bind(e);t.on("preprocessEvent",(o,s)=>r(o,s,t))}if(typeof e.processEvent=="function"){let r=e.processEvent.bind(e),o=Object.assign((s,i)=>r(s,i,t),{id:e.name});t.addEventProcessor(o)}C&&g.log(`Integration installed: ${e.name}`)}function DB(t,e){return e?Gn(e,()=>{let n=nr(),r=n?Is(n):Hi(e);return[n?Je(n):Jr(t,e),r]}):[void 0,void 0]}function lce(t){return[{type:"log",item_count:t.length,content_type:"application/vnd.sentry.items.log+json"},{items:t}]}function UB(t,e,n,r){let o={};return e?.sdk&&(o.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(o.dsn=Bn(r)),un(o,[lce(t)])}function Lc(t,e){let n=e??pce(t)??[];if(n.length===0)return;let r=t.getOptions(),o=UB(n,r._metadata,r.tunnel,t.getDsn());wB().set(t,[]),t.emit("flushLogs"),t.sendEnvelope(o)}function pce(t){return wB().get(t)}function wB(){return Ir("clientToLogBufferMap",()=>new WeakMap)}function dce(t){return[{type:"trace_metric",item_count:t.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{items:t}]}function kB(t,e,n,r){let o={};return e?.sdk&&(o.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(o.dsn=Bn(r)),un(o,[dce(t)])}function GB(t,e){let n=e??_ce(t)??[];if(n.length===0)return;let r=t.getOptions(),o=kB(n,r._metadata,r.tunnel,t.getDsn());BB().set(t,[]),t.emit("flushMetrics"),t.sendEnvelope(o)}function _ce(t){return BB().get(t)}function BB(){return Ir("clientToMetricBufferMap",()=>new WeakMap)}function im(t){return typeof t=="object"&&typeof t.unref=="function"&&t.unref(),t}var ap=Symbol.for("SentryBufferFullError");function Dc(t=100){let e=new Set;function n(){return e.size<t}function r(i){e.delete(i)}function o(i){if(!n())return vc(ap);let a=i();return e.add(a),a.then(()=>r(a),()=>r(a)),a}function s(i){if(!e.size)return wo(!0);let a=Promise.allSettled(Array.from(e)).then(()=>!0);if(!i)return a;let c=[a,new Promise(l=>im(setTimeout(()=>l(!1),i)))];return Promise.race(c)}return{get $(){return Array.from(e)},add:o,drain:s}}var fce=60*1e3;function mce(t,e=Zn()){let n=parseInt(`${t}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${t}`);return isNaN(r)?fce:r-e}function hce(t,e){return t[e]||t.all||0}function jB(t,e,n=Zn()){return hce(t,e)>n}function HB(t,{statusCode:e,headers:n},r=Zn()){let o={...t},s=n?.["x-sentry-rate-limits"],i=n?.["retry-after"];if(s)for(let a of s.trim().split(",")){let[c,l,,,p]=a.split(":",5),d=parseInt(c,10),_=(isNaN(d)?60:d)*1e3;if(!l)o.all=r+_;else for(let f of l.split(";"))f==="metric_bucket"?(!p||p.split(";").includes("custom"))&&(o[f]=r+_):o[f]=r+_}else i?o.all=r+mce(i,r):e===429&&(o.all=r+60*1e3);return o}var cp=64;function up(t,e,n=Dc(t.bufferSize||cp)){let r={},o=i=>n.drain(i);function s(i){let a=[];if(Zl(i,(d,_)=>{let f=zf(_);jB(r,f)?t.recordDroppedEvent("ratelimit_backoff",f):a.push(d)}),a.length===0)return Promise.resolve({});let c=un(i[0],a),l=d=>{if(sy(c,["client_report"])){C&&g.warn(`Dropping client report. Will not send outcomes (reason: ${d}).`);return}Zl(c,(_,f)=>{t.recordDroppedEvent(d,zf(f))})},p=()=>e({body:ep(c)}).then(d=>d.statusCode===413?(C&&g.error("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),l("send_error"),d):(C&&d.statusCode!==void 0&&(d.statusCode<200||d.statusCode>=300)&&g.warn(`Sentry responded with status code ${d.statusCode} to sent event.`),r=HB(r,d),d),d=>{throw l("network_error"),C&&g.error("Encountered error running transport request:",d),d});return n.add(p).then(d=>d,d=>{if(d===ap)return C&&g.error("Skipped sending event because buffer is full."),l("queue_overflow"),Promise.resolve({});throw d})}return{send:s,flush:o}}function FB(t,e,n){let r=[{type:"client_report"},{timestamp:n||vo(),discarded_events:t}];return un(e?{dsn:e}:{},[r])}function am(t){let e=[];t.message&&e.push(t.message);try{let n=t.exception.values[t.exception.values.length-1];n?.value&&(e.push(n.value),n.type&&e.push(`${n.type}: ${n.value}`))}catch{}return e}function VB(t){let{trace_id:e,parent_span_id:n,span_id:r,status:o,origin:s,data:i,op:a}=t.contexts?.trace??{};return{data:i??{},description:t.transaction,op:a,parent_span_id:n,span_id:r??"",start_timestamp:t.start_timestamp??0,status:o,timestamp:t.timestamp,trace_id:e??"",origin:s,profile_id:i?.[Oc],exclusive_time:i?.[Nc],measurements:t.measurements,is_segment:!0}}function qB(t){return{type:"transaction",timestamp:t.timestamp,start_timestamp:t.start_timestamp,transaction:t.description,contexts:{trace:{trace_id:t.trace_id,span_id:t.span_id,parent_span_id:t.parent_span_id,op:t.op,status:t.status,origin:t.origin,data:{...t.data,...t.profile_id&&{[Oc]:t.profile_id},...t.exclusive_time&&{[Nc]:t.exclusive_time}}}},measurements:t.measurements}}var $B="Not capturing exception because it's already been captured.",YB="Discarded session because of missing or non-string release",JB=Symbol.for("SentryInternalError"),ZB=Symbol.for("SentryDoNotSendEventError"),Tce=5e3;function cm(t){return{message:t,[JB]:!0}}function Ey(t){return{message:t,[ZB]:!0}}function WB(t){return!!t&&typeof t=="object"&&JB in t}function zB(t){return!!t&&typeof t=="object"&&ZB in t}function KB(t,e,n,r,o){let s=0,i,a=!1;t.on(n,()=>{s=0,clearTimeout(i),a=!1}),t.on(e,c=>{s+=r(c),s>=8e5?o(t):a||(a=!0,i=im(setTimeout(()=>{o(t)},Tce)))}),t.on("flush",()=>{o(t)})}var um=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=Dc(e.transportOptions?.bufferSize??cp),e.dsn?this._dsn=nB(e.dsn):C&&g.warn("No DSN provided, client will not send events."),this._dsn){let r=vB(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:r})}this._options.enableLogs=this._options.enableLogs??this._options._experiments?.enableLogs,this._options.enableLogs&&KB(this,"afterCaptureLog","flushLogs",Ace,Lc),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&KB(this,"afterCaptureMetric","flushMetrics",gce,GB)}captureException(e,n,r){let o=_t();if(wf(e))return C&&g.log($B),o;let s={event_id:o,...n};return this._process(()=>this.eventFromException(e,s).then(i=>this._captureEvent(i,s,r)).then(i=>i),"error"),s.event_id}captureMessage(e,n,r,o){let s={event_id:_t(),...r},i=gc(e)?e:String(e),a=$l(e),c=a?this.eventFromMessage(i,n,s):this.eventFromException(e,s);return this._process(()=>c.then(l=>this._captureEvent(l,s,o)),a?"unknown":"error"),s.event_id}captureEvent(e,n,r){let o=_t();if(n?.originalException&&wf(n.originalException))return C&&g.log($B),o;let s={event_id:o,...n},i=e.sdkProcessingMetadata||{},a=i.capturedSpanScope,c=i.capturedSpanIsolationScope,l=QB(e.type);return this._process(()=>this._captureEvent(e,s,a||r,c),l),s.event_id}captureSession(e){this.sendSession(e),Lo(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(e){let n=this._transport;if(!n)return!0;this.emit("flush");let r=await this._isClientDoneProcessing(e),o=await n.flush(e);return r&&o}async close(e){Lc(this);let n=await this.flush(e);return this.getOptions().enabled=!1,this.emit("close"),n}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){let n=this._integrations[e.name];Ty(this,e,this._integrations),n||hy(this,[e])}sendEvent(e,n={}){this.emit("beforeSendEvent",e,n);let r=mB(e,this._dsn,this._options._metadata,this._options.tunnel);for(let o of n.attachments||[])r=oy(r,ay(o));this.sendEnvelope(r).then(o=>this.emit("afterSendEvent",e,o))}sendSession(e){let{release:n,environment:r=Cc}=this._options;if("aggregates"in e){let s=e.attrs||{};if(!s.release&&!n){C&&g.warn(YB);return}s.release=s.release||n,s.environment=s.environment||r,e.attrs=s}else{if(!e.release&&!n){C&&g.warn(YB);return}e.release=e.release||n,e.environment=e.environment||r}this.emit("beforeSendSession",e);let o=fB(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(o)}recordDroppedEvent(e,n,r=1){if(this._options.sendClientReports){let o=`${e}:${n}`;C&&g.log(`Recording outcome: "${o}"${r>1?` (${r} times)`:""}`),this._outcomes[o]=(this._outcomes[o]||0)+r}}on(e,n){let r=this._hooks[e]=this._hooks[e]||new Set,o=(...s)=>n(...s);return r.add(o),()=>{r.delete(o)}}emit(e,...n){let r=this._hooks[e];r&&r.forEach(o=>o(...n))}async sendEnvelope(e){if(this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport)try{return await this._transport.send(e)}catch(n){return C&&g.error("Error while sending envelope:",n),{}}return C&&g.error("Transport disabled"),{}}dispose(){}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=LB(this,e),hy(this,e)}_updateSessionFromEvent(e,n){let r=n.level==="fatal",o=!1,s=n.exception?.values;if(s){o=!0,r=!1;for(let c of s)if(c.mechanism?.handled===!1){r=!0;break}}let i=e.status==="ok";(i&&e.errors===0||i&&r)&&(Lo(e,{...r&&{status:"crashed"},errors:e.errors||Number(o||r)}),this.captureSession(e))}async _isClientDoneProcessing(e){let n=0;for(;!e||n<e;){if(await new Promise(r=>setTimeout(r,1)),!this._numProcessing)return!0;n++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,n,r,o){let s=this.getOptions(),i=Object.keys(this._integrations);return!n.integrations&&i?.length&&(n.integrations=i),this.emit("preprocessEvent",e,n),e.type||o.setLastEventId(e.event_id||n.event_id),MB(s,e,n,r,this,o).then(a=>{if(a===null)return a;this.emit("postprocessEvent",a,n),a.contexts={trace:{...a.contexts?.trace,...Hi(r)},...a.contexts};let c=Jr(this,r);return a.sdkProcessingMetadata={dynamicSamplingContext:c,...a.sdkProcessingMetadata},a})}_captureEvent(e,n={},r=he(),o=ue()){return C&&Sy(e)&&g.log(`Captured error event \`${am(e)[0]||"<unknown>"}\``),this._processEvent(e,n,r,o).then(s=>s.event_id,s=>{C&&(zB(s)?g.log(s.message):WB(s)?g.warn(s.message):g.warn(s))})}_processEvent(e,n,r,o){let s=this.getOptions(),{sampleRate:i}=s,a=e1(e),c=Sy(e),p=`before send for type \`${e.type||"error"}\``,d=typeof i>"u"?void 0:jn(i);if(c&&typeof d=="number"&&yt()>d)return this.recordDroppedEvent("sample_rate","error"),vc(Ey(`Discarding event because it's not included in the random sample (sampling rate = ${i})`));let _=QB(e.type);return this._prepareEvent(e,n,r,o).then(f=>{if(f===null)throw this.recordDroppedEvent("event_processor",_),Ey("An event processor returned `null`, will not send event.");if(n.data?.__sentry__===!0)return f;let h=Sce(this,s,f,n);return Ece(h,p)}).then(f=>{if(f===null){if(this.recordDroppedEvent("before_send",_),a){let S=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",S)}throw Ey(`${p} returned \`null\`, will not send event.`)}let m=r.getSession()||o.getSession();if(c&&m&&this._updateSessionFromEvent(m,f),a){let T=f.sdkProcessingMetadata?.spanCountBeforeProcessing||0,S=f.spans?f.spans.length:0,R=T-S;R>0&&this.recordDroppedEvent("before_send","span",R)}let h=f.transaction_info;if(a&&h&&f.transaction!==e.transaction){let T="custom";f.transaction_info={...h,source:T}}return this.sendEvent(f,n),f}).then(null,f=>{throw zB(f)||WB(f)?f:(this.captureException(f,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:f}),cm(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
20
+ Reason: ${f}`))})}_process(e,n){this._numProcessing++,this._promiseBuffer.add(e).then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r===ap&&this.recordDroppedEvent("queue_overflow",n),r))}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.entries(e).map(([n,r])=>{let[o,s]=n.split(":");return{reason:o,category:s,quantity:r}})}_flushOutcomes(){C&&g.log("Flushing outcomes...");let e=this._clearOutcomes();if(e.length===0){C&&g.log("No outcomes to send");return}if(!this._dsn){C&&g.log("No dsn provided, will not send outcomes");return}C&&g.log("Sending outcomes:",e);let n=FB(e,this._options.tunnel&&Bn(this._dsn));this.sendEnvelope(n)}};function QB(t){return t==="replay_event"?"replay":t||"error"}function Ece(t,e){let n=`${e} must return \`null\` or a valid event.`;if(Lt(t))return t.then(r=>{if(!Mo(r)&&r!==null)throw cm(n);return r},r=>{throw cm(`${e} rejected with ${r}`)});if(!Mo(t)&&t!==null)throw cm(n);return t}function Sce(t,e,n,r){let{beforeSend:o,beforeSendTransaction:s,beforeSendSpan:i,ignoreSpans:a}=e,c=n;if(Sy(c)&&o)return o(c,r);if(e1(c)){if(i||a){let l=VB(c);if(a?.length&&Jl(l,a))return null;if(i){let p=i(l);p?c=gs(n,qB(p)):Xl()}if(c.spans){let p=[],d=c.spans;for(let f of d){if(a?.length&&Jl(f,a)){pB(d,f);continue}if(i){let m=i(f);m?p.push(m):(Xl(),p.push(f))}else p.push(f)}let _=c.spans.length-p.length;_&&t.recordDroppedEvent("before_send","span",_),c.spans=p}}if(s){if(c.spans){let l=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:l}}return s(c,r)}}return c}function Sy(t){return t.type===void 0}function e1(t){return t.type==="transaction"}function gce(t){let e=0;return t.name&&(e+=t.name.length*2),e+=8,e+t1(t.attributes)}function Ace(t){let e=0;return t.message&&(e+=t.message.length*2),e+t1(t.attributes)}function t1(t){if(!t)return 0;let e=0;return Object.values(t).forEach(n=>{Array.isArray(n)?e+=n.length*XB(n[0]):$l(n)?e+=XB(n):e+=100}),e}function XB(t){return typeof t=="string"?t.length*2:typeof t=="number"?8:typeof t=="boolean"?4:0}function n1(t,e,n,r,o){let s={sent_at:new Date().toISOString()};n?.sdk&&(s.sdk={name:n.sdk.name,version:n.sdk.version}),r&&o&&(s.dsn=Bn(o)),e&&(s.trace=e);let i=Rce(t);return un(s,[i])}function Rce(t){return[{type:"check_in"},t]}function r1(t){let e=t._metadata?.sdk,n=e?.name&&e?.version?`${e?.name}/${e?.version}`:void 0;t.transportOptions={...t.transportOptions,headers:{...n&&{"user-agent":n},...t.transportOptions?.headers}}}function o1(t,e){return t(e.stack||"",1)}function yce(t){return Kr(t)&&"__sentry_fetch_url_host__"in t&&typeof t.__sentry_fetch_url_host__=="string"}function Ice(t){return yce(t)?`${t.message} (${t.__sentry_fetch_url_host__})`:t.message}function gy(t,e){let n={type:e.name||e.constructor.name,value:Ice(e)},r=o1(t,e);return r.length&&(n.stacktrace={frames:r}),n}function Oce(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let n=t[e];if(n instanceof Error)return n}}function Nce(t){if("name"in t&&typeof t.name=="string"){let r=`'${t.name}' captured as exception`;return"message"in t&&typeof t.message=="string"&&(r+=` with message '${t.message}'`),r}else if("message"in t&&typeof t.message=="string")return t.message;let e=LR(t);if(NR(t))return`Event \`ErrorEvent\` captured as exception with message \`${t.message}\``;let n=bce(t);return`${n&&n!=="Object"?`'${n}'`:"Object"} captured as exception with keys: ${e}`}function bce(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function Cce(t,e,n,r){if(Kr(n))return[n,void 0];if(e.synthetic=!0,Mo(n)){let s=t?.getOptions().normalizeDepth,i={__serialized__:ny(n,s)},a=Oce(n);if(a)return[a,i];let c=Nce(n),l=r?.syntheticException||new Error(c);return l.message=c,[l,i]}let o=r?.syntheticException||new Error(n);return o.message=`${n}`,[o,void 0]}function s1(t,e,n,r){let s=r?.data&&r.data.mechanism||{handled:!0,type:"generic"},[i,a]=Cce(t,s,n,r),c={exception:{values:[gy(e,i)]}};return a&&(c.extra=a),GR(c,void 0,void 0),Rc(c,s),{...c,event_id:r?.event_id}}function i1(t,e,n="info",r,o){let s={event_id:r?.event_id,level:n};if(o&&r?.syntheticException){let i=o1(t,r.syntheticException);i.length&&(s.exception={values:[{value:e,stacktrace:{frames:i}}]},Rc(s,{synthetic:!0}))}if(gc(e)){let{__sentry_template_string__:i,__sentry_template_values__:a}=e;return s.logentry={message:i,params:a},s}return s.message=e,s}var lp=class extends um{constructor(e){uB(),r1(e),super(e),this._setUpMetricsProcessing()}eventFromException(e,n){let r=s1(this,this._options.stackParser,e,n);return r.level="error",wo(r)}eventFromMessage(e,n="info",r){return wo(i1(this._options.stackParser,e,n,r,this._options.attachStacktrace))}captureException(e,n,r){return a1(n),super.captureException(e,n,r)}captureEvent(e,n,r){return!e.type&&e.exception?.values&&e.exception.values.length>0&&a1(n),super.captureEvent(e,n,r)}captureCheckIn(e,n,r){let o="checkInId"in e&&e.checkInId?e.checkInId:_t();if(!this._isEnabled())return C&&g.warn("SDK not enabled, will not capture check-in."),o;let s=this.getOptions(),{release:i,environment:a,tunnel:c}=s,l={check_in_id:o,monitor_slug:e.monitorSlug,status:e.status,release:i,environment:a};"duration"in e&&(l.duration=e.duration),n&&(l.monitor_config={schedule:n.schedule,checkin_margin:n.checkinMargin,max_runtime:n.maxRuntime,timezone:n.timezone,failure_issue_threshold:n.failureIssueThreshold,recovery_threshold:n.recoveryThreshold});let[p,d]=DB(this,r);d&&(l.contexts={trace:d});let _=n1(l,p,this.getSdkMetadata(),c,this.getDsn());return C&&g.log("Sending checkin:",e.monitorSlug,e.status),this.sendEnvelope(_),o}dispose(){C&&g.log("Disposing client...");for(let e of Object.keys(this._hooks))this._hooks[e]?.clear();this._hooks={},this._eventProcessors.length=0,this._integrations={},this._outcomes={},this._transport=void 0,this._promiseBuffer=Dc(cp)}_prepareEvent(e,n,r,o){return this._options.platform&&(e.platform=e.platform||this._options.platform),this._options.runtime&&(e.contexts={...e.contexts,runtime:e.contexts?.runtime||this._options.runtime}),this._options.serverName&&(e.server_name=e.server_name||this._options.serverName),super._prepareEvent(e,n,r,o)}_setUpMetricsProcessing(){this.on("processMetric",e=>{this._options.serverName&&(e.attributes={"server.address":this._options.serverName,...e.attributes})})}};function a1(t){let e=ue().getScopeData().sdkProcessingMetadata.requestSession;if(e){let n=t?.mechanism?.handled??!0;n&&e.status!=="crashed"?e.status="errored":n||(e.status="crashed")}}var Ay=new Set;function Ry(t){t.forEach(e=>{Ay.add(e),C&&g.log(`AI provider "${e}" wrapping will be skipped`)})}function zi(t){return Ay.has(t)}function yy(){Ay.clear(),C&&g.log("Cleared AI provider skip registrations")}var Pce=new Set(["false","f","n","no","off","0"]),Mce=new Set(["true","t","y","yes","on","1"]);function Uc(t,e){let n=String(t).toLowerCase();return Pce.has(n)?!1:Mce.has(n)?!0:e?.strict?null:!!t}var xce="thismessage:/";function Iy(t){return"isRelative"in t}function pp(t,e){let n=t.indexOf("://")<=0&&t.indexOf("//")!==0,r=e??(n?xce:void 0);try{if("canParse"in URL&&!URL.canParse(t,r))return;let o=new URL(t,r);return n?{isRelative:n,pathname:o.pathname,search:o.search,hash:o.hash}:o}catch{}}function c1(t){if(Iy(t))return t.pathname;let e=new URL(t);return e.search="",e.hash="",["80","443"].includes(e.port)&&(e.port=""),e.password&&(e.password="%filtered%"),e.username&&(e.username="%filtered%"),e.toString()}function vce(t,e,n,r){let o=n?.method?.toUpperCase()??"GET",s=r||(t?e==="client"?c1(t):t.pathname:"/");return`${o} ${s}`}function Oy(t,e,n,r,o){let s={[W]:n,[Ue]:"url"};return o&&(s[e==="server"?"http.route":"url.template"]=o,s[Ue]="route"),r?.method&&(s[QR]=r.method.toUpperCase()),t&&(t.search&&(s["url.query"]=t.search),t.hash&&(s["url.fragment"]=t.hash),t.pathname&&(s["url.path"]=t.pathname,t.pathname==="/"&&(s[Ue]="route")),Iy(t)||(s[As]=t.href,t.port&&(s["url.port"]=t.port),t.protocol&&(s["url.scheme"]=t.protocol),t.hostname&&(s[e==="server"?"server.address":"url.domain"]=t.hostname))),[vce(t,e,r,o),s]}function bs(t){if(!t)return{};let e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};let n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:n,hash:r,relative:e[5]+n+r}}function ko(t){return t.split(/[?#]/,1)[0]}function Cs(t){let{protocol:e,host:n,path:r}=t,o=n?.replace(/^.*@/,"[filtered]:[filtered]@").replace(/(:80)$/,"").replace(/(:443)$/,"")||"";return`${e?`${e}://`:""}${o}${r}`}function wc(t,e=!0){if(t.startsWith("data:")){let n=t.match(/^data:([^;,]+)/),r=n?n[1]:"text/plain",o=t.includes(";base64,"),s=t.indexOf(","),i="";if(e&&s!==-1){let a=t.slice(s+1);i=a.length>10?`${a.slice(0,10)}... [truncated]`:a}return`data:${r}${o?",base64":""}${i?`,${i}`:""}`}return t}function Ki(t,e,n=[e],r="npm"){let o=(t._metadata=t._metadata||{}).sdk=t._metadata.sdk||{};o.name||(o.name=`sentry.javascript.${e}`,o.packages=n.map(s=>({name:`${r}:@sentry/${s}`,version:pe})),o.version=pe)}function kc(t={}){let e=t.client||H();if(!om()||!e)return{};let n=cn(),r=Or(n);if(r.getTraceData)return r.getTraceData(t);let o=t.scope||he(),s=t.span||nr();if(!s&&VR())return{};let i=s?$f(s):Lce(o),a=s?Je(s):Jr(e,o),c=Fi(a);if(!Hf.test(i))return g.warn("Invalid sentry-trace data. Cannot generate trace data"),{};let p={"sentry-trace":i,baggage:c};return t.propagateTraceparent&&(p.traceparent=s?aB(s):Dce(o)),p}function Lce(t){let{traceId:e,sampled:n,propagationSpanId:r}=t.getPropagationContext();return Rs(e,r,n)}function Dce(t){let{traceId:e,sampled:n,propagationSpanId:r}=t.getPropagationContext();return ys(e,r,n)}var u1="[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:";function Qi(t,e,n){if(typeof t!="string"||!e)return!0;let r=n?.get(t);if(r!==void 0)return C&&!r&&g.log(u1,t),r;let o=Ts(t,e);return n?.set(t,o),C&&!o&&g.log(u1,t),o}function Ny(t,e,n){let r,o,s,i=n?.maxWait?Math.max(n.maxWait,e):0,a=n?.setTimeoutImpl||setTimeout;function c(){return l(),r=t(),r}function l(){o!==void 0&&clearTimeout(o),s!==void 0&&clearTimeout(s),o=s=void 0}function p(){return o!==void 0||s!==void 0?c():r}function d(){return o&&clearTimeout(o),o=a(c,e),i&&s===void 0&&(s=a(c,i)),r}return d.cancel=l,d.flush=p,d}function _1(t){let e=Object.create(null);try{Object.entries(t).forEach(([n,r])=>{typeof r=="string"&&(e[n]=r)})}catch{}return e}function dp(t){let e=t.headers||{},r=(typeof e["x-forwarded-host"]=="string"?e["x-forwarded-host"]:void 0)||(typeof e.host=="string"?e.host:void 0),s=(typeof e["x-forwarded-proto"]=="string"?e["x-forwarded-proto"]:void 0)||t.protocol||(t.socket?.encrypted?"https":"http"),i=t.url||"",a=Uce({url:i,host:r,protocol:s}),c=t.body||void 0,l=t.cookies;return{url:a,method:t.method,query_string:f1(i),headers:_1(e),cookies:l,data:c}}function Uce({url:t,protocol:e,host:n}){if(t?.startsWith("http"))return t;if(t&&n)return`${e}://${n}${t}`}var l1=["auth","token","secret","session","password","passwd","pwd","key","jwt","bearer","sso","saml","csrf","xsrf","credentials","set-cookie","cookie"],wce=["x-forwarded-","-user"];function lm(t,e=!1,n="request"){let r={};try{Object.entries(t).forEach(([o,s])=>{if(s==null)return;let i=o.toLowerCase();if((i==="cookie"||i==="set-cookie")&&typeof s=="string"&&s!==""){let c=i==="set-cookie",l=s.indexOf(";"),p=c&&l!==-1?s.substring(0,l):s,d=c?[p]:p.split("; ");for(let _ of d){let f=_.indexOf("="),m=f!==-1?_.substring(0,f):_,h=f!==-1?_.substring(f+1):"",T=m.toLowerCase();d1(r,i,T,h,e,n)}}else d1(r,i,"",s,e,n)})}catch{}return r}function p1(t){return t.replace(/-/g,"_")}function d1(t,e,n,r,o,s){let i=kce(n||e,r,o);if(i==null)return;let a=`http.${s}.header.${p1(e)}${n?`.${p1(n)}`:""}`;t[a]=i}function kce(t,e,n){if(n?l1.some(o=>t.includes(o)):[...wce,...l1].some(o=>t.includes(o)))return"[Filtered]";if(Array.isArray(e))return e.map(o=>o!=null?String(o):o).join(";");if(typeof e=="string")return e}function f1(t){if(t)try{let e=new URL(t,"http://s.io").search.slice(1);return e.length?e:void 0}catch{return}}var Gce=100;function rr(t,e){let n=H(),r=ue();if(!n)return;let{beforeBreadcrumb:o=null,maxBreadcrumbs:s=Gce}=n.getOptions();if(s<=0)return;let a={timestamp:vo(),...t},c=o?Qe(()=>o(a,e)):a;c!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",c,e),r.addBreadcrumb(c,s))}var m1,Bce="FunctionToString",h1=new WeakMap,jce=()=>({name:Bce,setupOnce(){m1=Function.prototype.toString;try{Function.prototype.toString=function(...t){let e=vR(this),n=h1.has(H())&&e!==void 0?e:this;return m1.apply(n,t)}}catch{}},setup(t){h1.set(t,!0)}}),pm=jce;var Hce=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,/can't redefine non-configurable property "solana"/,/vv\(\)\.getRestrictions is not a function/,/Can't find variable: _AutofillCallbackHandler/,/Object Not Found Matching Id:\d+, MethodName:simulateEvent/,/^Java exception was raised during method invocation$/],Fce="EventFilters",by=(t={})=>{let e;return{name:Fce,setup(n){let r=n.getOptions();e=T1(t,r)},processEvent(n,r,o){if(!e){let s=o.getOptions();e=T1(t,s)}return Vce(n,e)?null:n}}},_m=(t={})=>({...by(t),name:"InboundFilters"});function T1(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:Hce],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function Vce(t,e){if(t.type){if(t.type==="transaction"&&$ce(t,e.ignoreTransactions))return C&&g.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
21
+ Event: ${Es(t)}`),!0}else{if(qce(t,e.ignoreErrors))return C&&g.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
22
+ Event: ${Es(t)}`),!0;if(Kce(t))return C&&g.warn(`Event dropped due to not having an error message, error type or stacktrace.
23
+ Event: ${Es(t)}`),!0;if(Yce(t,e.denyUrls))return C&&g.warn(`Event dropped due to being matched by \`denyUrls\` option.
24
+ Event: ${Es(t)}.
25
+ Url: ${dm(t)}`),!0;if(!Wce(t,e.allowUrls))return C&&g.warn(`Event dropped due to not being matched by \`allowUrls\` option.
26
+ Event: ${Es(t)}.
27
+ Url: ${dm(t)}`),!0}return!1}function qce(t,e){return e?.length?am(t).some(n=>Ts(n,e)):!1}function $ce(t,e){if(!e?.length)return!1;let n=t.transaction;return n?Ts(n,e):!1}function Yce(t,e){if(!e?.length)return!1;let n=dm(t);return n?Ts(n,e):!1}function Wce(t,e){if(!e?.length)return!0;let n=dm(t);return n?Ts(n,e):!0}function zce(t=[]){for(let e=t.length-1;e>=0;e--){let n=t[e];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function dm(t){try{let n=[...t.exception?.values??[]].reverse().find(r=>r.mechanism?.parent_id===void 0&&r.stacktrace?.frames?.length)?.stacktrace?.frames;return n?zce(n):null}catch{return C&&g.error(`Cannot extract url for event ${Es(t)}`),null}}function Kce(t){return t.exception?.values?.length?!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value):!1}function g1(t,e,n,r,o,s){if(!o.exception?.values||!s||!Qr(s.originalException,Error))return;let i=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;i&&(o.exception.values=Cy(t,e,r,s.originalException,n,o.exception.values,i,0))}function Cy(t,e,n,r,o,s,i,a){if(s.length>=n+1)return s;let c=[...s];if(Qr(r[o],Error)){E1(i,a,r);let l=t(e,r[o]),p=c.length;S1(l,o,p,a),c=Cy(t,e,n,r[o],o,[l,...c],l,p)}return A1(r)&&r.errors.forEach((l,p)=>{if(Qr(l,Error)){E1(i,a,r);let d=t(e,l),_=c.length;S1(d,`errors[${p}]`,_,a),c=Cy(t,e,n,l,o,[d,...c],d,_)}}),c}function A1(t){return Array.isArray(t.errors)}function E1(t,e,n){t.mechanism={handled:!0,type:"auto.core.linked_errors",...A1(n)&&{is_exception_group:!0},...t.mechanism,exception_id:e}}function S1(t,e,n,r){t.mechanism={handled:!0,...t.mechanism,type:"chained",source:e,exception_id:n,parent_id:r}}var Qce="cause",Xce=5,Jce="LinkedErrors",Zce=(t={})=>{let e=t.limit||Xce,n=t.key||Qce;return{name:Jce,preprocessEvent(r,o,s){let i=s.getOptions();g1(gy,i.stackParser,n,e,r,o)}}},fm=Zce;function R1(t){let e={},n=0;for(;n<t.length;){let r=t.indexOf("=",n);if(r===-1)break;let o=t.indexOf(";",n);if(o===-1)o=t.length;else if(o<r){n=t.lastIndexOf(";",r-1)+1;continue}let s=t.slice(n,r).trim();if(e[s]===void 0){let i=t.slice(r+1,o).trim();i.charCodeAt(0)===34&&(i=i.slice(1,-1));try{e[s]=i.indexOf("%")!==-1?decodeURIComponent(i):i}catch{e[s]=i}}n=o+1}return e}var Py=["X-Client-IP","X-Forwarded-For","Fly-Client-IP","CF-Connecting-IP","Fastly-Client-Ip","True-Client-Ip","X-Real-IP","X-Cluster-Client-IP","X-Forwarded","Forwarded-For","Forwarded","X-Vercel-Forwarded-For"];function y1(t){let e={};for(let s of Object.keys(t))e[s.toLowerCase()]=t[s];return Py.map(s=>{let i=e[s.toLowerCase()],a=Array.isArray(i)?i.join(";"):i;return s==="Forwarded"?eue(a):a?.split(",").map(c=>c.trim())}).reduce((s,i)=>i?s.concat(i):s,[]).find(s=>s!==null&&tue(s))||null}function eue(t){if(!t)return null;for(let e of t.split(";"))if(e.startsWith("for="))return e.slice(4);return null}function tue(t){return/(?:^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$)|(?:^(?:(?:[a-fA-F\d]{1,4}:){7}(?:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,2}|:)|(?:[a-fA-F\d]{1,4}:){4}(?:(?::[a-fA-F\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,3}|:)|(?:[a-fA-F\d]{1,4}:){3}(?:(?::[a-fA-F\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,4}|:)|(?:[a-fA-F\d]{1,4}:){2}(?:(?::[a-fA-F\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,5}|:)|(?:[a-fA-F\d]{1,4}:){1}(?:(?::[a-fA-F\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,6}|:)|(?::(?:(?::[a-fA-F\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,7}|:)))(?:%[0-9a-zA-Z]{1,})?$)/.test(t)}var nue={cookies:!0,data:!0,headers:!0,query_string:!0,url:!0},rue="RequestData",oue=(t={})=>{let e={...nue,...t.include};return{name:rue,processEvent(n,r,o){let{sdkProcessingMetadata:s={}}=n,{normalizedRequest:i,ipAddress:a}=s,c={...e,ip:e.ip??o.getOptions().sendDefaultPii};return i&&sue(n,i,{ipAddress:a},c),n}}},mm=oue;function sue(t,e,n,r){if(t.request={...t.request,...iue(e,r)},r.ip){let o=e.headers&&y1(e.headers)||n.ipAddress;o&&(t.user={...t.user,ip_address:o})}}function iue(t,e){let n={},r={...t.headers};if(e.headers&&(n.headers=r,e.cookies||delete r.cookie,e.ip||Py.forEach(o=>{delete r[o]})),n.method=t.method,e.url&&(n.url=t.url),e.cookies){let o=t.cookies||(r?.cookie?R1(r.cookie):void 0);n.cookies=o||{}}return e.query_string&&(n.query_string=t.query_string),e.data&&(n.data=t.data),n}function I1(t){let e="console";Tc(e,t),Ec(e,aue)}function aue(){"console"in J&&Vl.forEach(function(t){t in J.console&&xR(J.console,t,function(e){return hc[t]=e,function(...n){Sc("console",{args:n,level:t}),hc[t]?.apply(J.console,n)}})})}function O1(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}var cue=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function uue(t){let e=t.length>1024?`<truncated>${t.slice(-1024)}`:t,n=cue.exec(e);return n?n.slice(1):[]}function My(t){let e=uue(t),n=e[0]||"",r=e[1];return!n&&!r?".":(r&&(r=r.slice(0,r.length-1)),n+r)}var lue=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,hm=Symbol("sentryPostgresConnectionContext"),xy=Symbol.for("sentry.instrumented.postgresjs"),pue=Symbol.for("sentry.query.from.instrumented.sql");function Ly(t,e){return!t||typeof t!="function"?(C&&g.warn("instrumentPostgresJsSql: provided value is not a valid postgres.js sql instance"),t):vy(t,{requireParentSpan:!0,...e})}function vy(t,e,n){if(t[xy])return t;let r=new Proxy(t,{apply(o,s,i){let a=Reflect.apply(o,s,i);return a&&typeof a=="object"&&"handle"in a&&b1(a,r,e),a},get(o,s){let i=o[s];return typeof s!="string"||typeof i!="function"?i:s==="unsafe"||s==="file"?due(i,o,r,e):s==="begin"||s==="reserve"?_ue(i,o,r,e):i}});return n?r[hm]=n:Eue(t,r),t[xy]=!0,r[xy]=!0,r}function due(t,e,n,r){return function(...o){let s=Reflect.apply(t,e,o);return s&&typeof s=="object"&&"handle"in s&&b1(s,n,r),s}}function _ue(t,e,n,r){return function(...o){let s=n[hm];if(!(typeof o[o.length-1]=="function")){let p=Reflect.apply(t,e,o);return p&&typeof p.then=="function"?p.then(d=>vy(d,r,s)):p}let a=o.length===1?o[0]:o[1],c=function(p){let d=vy(p,r,s);return a(d)},l=o.length===1?[c]:[o[0],c];return Reflect.apply(t,e,l)}}function b1(t,e,n){if(t.handle?.__sentryWrapped)return;t[pue]=!0;let r=t.handle,o=async function(...s){if(!fue(n))return r.apply(this,s);let i=mue(t.strings),a=hue(i);return It({name:a||"postgresjs.query",op:"db"},c=>{c.setAttribute(W,"auto.db.postgresjs"),c.setAttributes({"db.system.name":"postgres","db.query.text":a});let l=e?e[hm]:void 0;if(Tue(c,l),n.requestHook)try{n.requestHook(c,a,l)}catch(d){c.setAttribute("sentry.hook.error","requestHook failed"),C&&g.error("Error in requestHook for PostgresJs instrumentation:",d)}let p=this;p.resolve=new Proxy(p.resolve,{apply:(d,_,f)=>{try{N1(c,a,f?.[0]?.command),c.end()}catch(m){C&&g.error("Error ending span in resolve callback:",m)}return Reflect.apply(d,_,f)}}),p.reject=new Proxy(p.reject,{apply:(d,_,f)=>{try{c.setStatus({code:2,message:f?.[0]?.message||"unknown_error"}),c.setAttribute("db.response.status_code",f?.[0]?.code||"unknown"),c.setAttribute("error.type",f?.[0]?.name||"unknown"),N1(c,a),c.end()}catch(m){C&&g.error("Error ending span in reject callback:",m)}return Reflect.apply(d,_,f)}});try{return r.apply(this,s)}catch(d){throw c.setStatus({code:2,message:d instanceof Error?d.message:"unknown_error"}),c.end(),d}})};o.__sentryWrapped=!0,t.handle=o}function fue(t){return nr()!==void 0||!t.requireParentSpan}function mue(t){if(t?.length)return t.length===1?t[0]||void 0:t.reduce((e,n,r)=>r===0?n:`${e}$${r}${n}`,"")}function hue(t){return t?t.replace(/--.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"").replace(/;\s*$/,"").replace(/\s+/g," ").trim().replace(/\bX'[0-9A-Fa-f]*'/gi,"?").replace(/\bB'[01]*'/gi,"?").replace(/'(?:[^']|'')*'/g,"?").replace(/\b0x[0-9A-Fa-f]+/gi,"?").replace(/\b(?:TRUE|FALSE)\b/gi,"?").replace(/-?\b\d+\.?\d*[eE][+-]?\d+\b/g,"?").replace(/-?\b\d+\.\d+\b/g,"?").replace(/-?\.\d+\b/g,"?").replace(/(?<!\$)-?\b\d+\b/g,"?").replace(/\bIN\b\s*\(\s*\?(?:\s*,\s*\?)*\s*\)/gi,"IN (?)").replace(/\bIN\b\s*\(\s*\$\d+(?:\s*,\s*\$\d+)*\s*\)/gi,"IN ($?)"):"Unknown SQL Query"}function Tue(t,e){if(e&&(e.ATTR_DB_NAMESPACE&&t.setAttribute("db.namespace",e.ATTR_DB_NAMESPACE),e.ATTR_SERVER_ADDRESS&&t.setAttribute("server.address",e.ATTR_SERVER_ADDRESS),e.ATTR_SERVER_PORT!==void 0)){let n=parseInt(e.ATTR_SERVER_PORT,10);isNaN(n)||t.setAttribute("server.port",n)}}function N1(t,e,n){if(n){t.setAttribute("db.operation.name",n);return}let r=e?.match(lue);r?.[1]&&t.setAttribute("db.operation.name",r[1].toUpperCase())}function Eue(t,e){let n=t;if(!n.options||typeof n.options!="object")return;let r=n.options,o=r.host?.[0]||"localhost",s=r.port?.[0]||5432,i={ATTR_DB_NAMESPACE:typeof r.database=="string"&&r.database!==""?r.database:void 0,ATTR_SERVER_ADDRESS:o,ATTR_SERVER_PORT:String(s)};e[hm]=i}var Sue="Console",Tm=(t={})=>{let e=new Set(t.levels||Vl);return{name:Sue,setup(n){I1(({args:r,level:o})=>{H()!==n||!e.has(o)||gue(o,r)})}}};function gue(t,e){let n={category:"console",data:{arguments:e,logger:"console"},level:O1(t),message:C1(e)};if(t==="assert")if(e[0]===!1){let r=e.slice(1);n.message=r.length>0?`Assertion failed: ${C1(r)}`:"Assertion failed",n.data.arguments=r}else return;rr(n,{input:e,level:t})}function C1(t){return"util"in J&&typeof J.util.format=="function"?J.util.format(...t):UR(t," ")}var Aue="ConversationId",Rue=()=>({name:Aue,setup(t){t.on("spanStart",e=>{let n=he().getScopeData(),r=ue().getScopeData(),o=n.conversationId||r.conversationId;o&&e.setAttribute(XR,o)})}}),Dy=Rue;var P1="gen_ai.prompt",Ps="gen_ai.system",He="gen_ai.request.model",Gc="gen_ai.request.stream",Ms="gen_ai.request.temperature",Bc="gen_ai.request.max_tokens",xs="gen_ai.request.frequency_penalty",jc="gen_ai.request.presence_penalty",vs="gen_ai.request.top_p",Em="gen_ai.request.top_k",M1="gen_ai.request.encoding_format",x1="gen_ai.request.dimensions",yn="gen_ai.response.finish_reasons",ft="gen_ai.response.model",or="gen_ai.response.id",v1="gen_ai.response.stop_reason",Pe="gen_ai.usage.input_tokens",Ze="gen_ai.usage.output_tokens",ln="gen_ai.usage.total_tokens",Dt="gen_ai.operation.name",pn="sentry.sdk_meta.gen_ai.input.messages.original_length",Ut="gen_ai.input.messages",L1="gen_ai.output.messages",Hn="gen_ai.system_instructions",rt="gen_ai.response.text",Zr="gen_ai.request.available_tools",Xi="gen_ai.response.streaming",Ot="gen_ai.response.tool_calls",Uy="gen_ai.agent.name",D1="gen_ai.pipeline.name",_p="gen_ai.conversation.id",U1="gen_ai.usage.cache_creation_input_tokens",w1="gen_ai.usage.cache_read_input_tokens",wy="gen_ai.usage.input_tokens.cache_write",Ls="gen_ai.usage.input_tokens.cached",Sm="gen_ai.invoke_agent",k1="gen_ai.generate_text",G1="gen_ai.stream_text",B1="gen_ai.generate_object",j1="gen_ai.stream_object",Hc="gen_ai.embeddings.input",H1="gen_ai.embeddings",F1="gen_ai.embeddings",V1="gen_ai.rerank",q1="gen_ai.execute_tool",Ji="gen_ai.tool.name",ky="gen_ai.tool.call.id",Gy="gen_ai.tool.type",gm="gen_ai.tool.input",Am="gen_ai.tool.output",$1="gen_ai.tool.description",By="openai.response.id",jy="openai.response.model",Hy="openai.response.timestamp",Y1="openai.usage.completion_tokens",W1="openai.usage.prompt_tokens",Fy="anthropic.response.timestamp";var fp=new Map,Vy=new Set(["ai.generateText","ai.streamText","ai.generateObject","ai.streamObject"]),qy=new Set(["ai.generateText.doGenerate","ai.streamText.doStream","ai.generateObject.doGenerate","ai.streamObject.doStream"]),z1=new Set(["ai.embed.doEmbed","ai.embedMany.doEmbed"]),K1=new Set(["ai.rerank.doRerank"]),Q1={"ai.embed.doEmbed":"embeddings","ai.embedMany.doEmbed":"embeddings","ai.rerank.doRerank":"rerank"};function Ds(t){return!t||typeof t!="object"?!1:Iue(t)||J1(t)||yue(t)||Z1(t)||ej(t)||Oue(t)||Nue(t)||bue(t)||Cue(t)||Pue(t)||Mue(t)||xue(t)}function yue(t){return"image_url"in t?typeof t.image_url=="string"?t.image_url.startsWith("data:"):X1(t):!1}function X1(t){return"image_url"in t&&!!t.image_url&&typeof t.image_url=="object"&&"url"in t.image_url&&typeof t.image_url.url=="string"&&t.image_url.url.startsWith("data:")}function Iue(t){return"type"in t&&typeof t.type=="string"&&"source"in t&&Ds(t.source)}function J1(t){return"inlineData"in t&&!!t.inlineData&&typeof t.inlineData=="object"&&"data"in t.inlineData&&typeof t.inlineData.data=="string"}function Z1(t){return"type"in t&&t.type==="input_audio"&&"input_audio"in t&&!!t.input_audio&&typeof t.input_audio=="object"&&"data"in t.input_audio&&typeof t.input_audio.data=="string"}function ej(t){return"type"in t&&t.type==="file"&&"file"in t&&!!t.file&&typeof t.file=="object"&&"file_data"in t.file&&typeof t.file.file_data=="string"}function Oue(t){return"media_type"in t&&typeof t.media_type=="string"&&"data"in t}function Nue(t){return"type"in t&&t.type==="file"&&"mediaType"in t&&typeof t.mediaType=="string"&&"data"in t&&typeof t.data=="string"&&!t.data.startsWith("http://")&&!t.data.startsWith("https://")}function bue(t){return"type"in t&&t.type==="image"&&"image"in t&&typeof t.image=="string"&&!t.image.startsWith("http://")&&!t.image.startsWith("https://")}function Cue(t){return"type"in t&&(t.type==="blob"||t.type==="base64")}function Pue(t){return"b64_json"in t}function Mue(t){return"type"in t&&"result"in t&&t.type==="image_generation"}function xue(t){return"uri"in t&&typeof t.uri=="string"&&t.uri.startsWith("data:")}var mp="[Blob substitute]",vue=["image_url","data","content","b64_json","result","uri","image"];function Zi(t){let e={...t};Ds(e.source)&&(e.source=Zi(e.source)),J1(t)&&(e.inlineData={...t.inlineData,data:mp}),X1(t)&&(e.image_url={...t.image_url,url:mp}),Z1(t)&&(e.input_audio={...t.input_audio,data:mp}),ej(t)&&(e.file={...t.file,file_data:mp});for(let n of vue)typeof e[n]=="string"&&(e[n]=mp);return e}var nj=2e4,Rm=t=>new TextEncoder().encode(t).length,Yy=t=>Rm(JSON.stringify(t));function ym(t,e){if(Rm(t)<=e)return t;let n=0,r=t.length,o="";for(;n<=r;){let s=Math.floor((n+r)/2),i=t.slice(0,s);Rm(i)<=e?(o=i,n=s+1):r=s-1}return o}function Lue(t){return typeof t=="string"?t:"text"in t&&typeof t.text=="string"?t.text:""}function tj(t,e){return typeof t=="string"?e:{...t,text:e}}function Due(t){return t!==null&&typeof t=="object"&&"content"in t&&typeof t.content=="string"}function rj(t){return t!==null&&typeof t=="object"&&"content"in t&&Array.isArray(t.content)}function oj(t){return t!==null&&typeof t=="object"&&"parts"in t&&Array.isArray(t.parts)&&t.parts.length>0}function Uue(t,e){let n={...t,content:""},r=Yy(n),o=e-r;if(o<=0)return[];let s=ym(t.content,o);return[{...t,content:s}]}function wue(t){return"parts"in t&&Array.isArray(t.parts)?{key:"parts",items:t.parts}:"content"in t&&Array.isArray(t.content)?{key:"content",items:t.content}:{key:null,items:[]}}function kue(t,e){let{key:n,items:r}=wue(t);if(n===null||r.length===0)return[];let o=r.map(c=>tj(c,"")),s=Yy({...t,[n]:o}),i=e-s;if(i<=0)return[];let a=[];for(let c of r){let l=Lue(c),p=Rm(l);if(p<=i)a.push(c),i-=p;else if(a.length===0){let d=ym(l,i);d&&a.push(tj(c,d));break}else break}return a.length<=0?[]:[{...t,[n]:a}]}function Gue(t,e){if(!t)return[];if(typeof t=="string"){let n=ym(t,e);return n?[n]:[]}return typeof t!="object"?[]:Due(t)?Uue(t,e):rj(t)||oj(t)?kue(t,e):[]}function $y(t){return t.map(n=>{let r;return n&&typeof n=="object"&&(rj(n)?r={...n,content:$y(n.content)}:"content"in n&&Ds(n.content)&&(r={...n,content:Zi(n.content)}),oj(n)&&(r={...r??n,parts:$y(n.parts)}),Ds(r)?r=Zi(r):Ds(n)&&(r=Zi(n))),r??n})}function Bue(t,e){if(!Array.isArray(t)||t.length===0)return t;let n=e-2,r=t[t.length-1],o=$y([r]),s=o[0];return Yy(s)<=n?o:Gue(s,n)}function Us(t){return Bue(t,nj)}function sj(t){return ym(t,nj)}function eo(t){let e=!!H()?.getOptions().sendDefaultPii;return{...t,recordInputs:t?.recordInputs??e,recordOutputs:t?.recordOutputs??e}}function Fc(t,e){return t?`${t}.${e}`:e}function hp(t,e,n,r,o){if(e!==void 0&&t.setAttributes({[Pe]:e}),n!==void 0&&t.setAttributes({[Ze]:n}),e!==void 0||n!==void 0||r!==void 0||o!==void 0){let s=(e??0)+(n??0)+(r??0)+(o??0);t.setAttributes({[ln]:s})}}function ea(t){if(typeof t=="string")return sj(t);if(Array.isArray(t)){let e=Us(t);return JSON.stringify(e)}return JSON.stringify(t)}function Fn(t){if(!Array.isArray(t))return{systemInstructions:void 0,filteredMessages:t};let e=t.findIndex(i=>i&&typeof i=="object"&&"role"in i&&i.role==="system");if(e===-1)return{systemInstructions:void 0,filteredMessages:t};let n=t[e],r=typeof n.content=="string"?n.content:n.content!==void 0?JSON.stringify(n.content):void 0;if(!r)return{systemInstructions:void 0,filteredMessages:t};let o=JSON.stringify([{type:"text",content:r}]),s=[...t.slice(0,e),...t.slice(e+1)];return{systemInstructions:o,filteredMessages:s}}async function jue(t,e,n){let r=t.catch(i=>{throw te(i,{mechanism:{handled:!1,type:n}}),i}),o=await e,s=await r;return s&&typeof s=="object"&&"data"in s?{...s,data:o}:o}function Vc(t,e,n){return Lt(t)?new Proxy(t,{get(r,o){let i=o in Promise.prototype||o===Symbol.toStringTag?e:r,a=Reflect.get(i,o);return o==="withResponse"&&typeof a=="function"?function(){let l=a.call(r);return jue(l,e,n)}:typeof a=="function"?a.bind(i):a}}):e}var Im="operation.name",ij="ai.operationId",Om="ai.prompt",aj="ai.schema",cj="ai.response.object",Wy="ai.values",zy="ai.response.text",Ky="ai.response.toolCalls",uj="ai.response.finishReason",ta="ai.prompt.messages",qc="ai.prompt.tools",Tp="ai.model.id",lj="ai.response.providerMetadata",pj="ai.usage.cachedInputTokens",dj="ai.telemetry.functionId",_j="ai.usage.completionTokens",fj="ai.usage.promptTokens",mj="ai.usage.tokens",Qy="ai.toolCall.name",Xy="ai.toolCall.id",hj="ai.toolCall.args",Tj="ai.toolCall.result";function Sj(t,e){let n=t.parent_span_id;if(!n)return;let r=t.data[Pe],o=t.data[Ze];if(typeof r=="number"||typeof o=="number"){let s=e.get(n)||{inputTokens:0,outputTokens:0};typeof r=="number"&&(s.inputTokens+=r),typeof o=="number"&&(s.outputTokens+=o),e.set(n,s)}}function Jy(t,e){let n=e.get(t.span_id);!n||!t.data||(n.inputTokens>0&&(t.data[Pe]=n.inputTokens),n.outputTokens>0&&(t.data[Ze]=n.outputTokens),(n.inputTokens>0||n.outputTokens>0)&&(t.data["gen_ai.usage.total_tokens"]=n.inputTokens+n.outputTokens))}function Hue(t){let e=new Map;for(let n of t){let r=n.data[Zr];if(typeof r=="string")try{let o=JSON.parse(r);for(let s of o)s.name&&s.description&&!e.has(s.name)&&e.set(s.name,s.description)}catch{}}return e}function gj(t,e){let n=Hue(t);for(let r of t){if(r.op==="gen_ai.execute_tool"){let o=r.data[Ji];if(typeof o=="string"){let s=n.get(o);s&&(r.data[$1]=s)}}r.op==="gen_ai.invoke_agent"&&Jy(r,e)}}function Zy(t){return fp.get(t)}function eI(t){fp.delete(t)}function Aj(t){let e=t.map(n=>{if(typeof n=="string")try{return JSON.parse(n)}catch{return n}return n});return JSON.stringify(e)}function Ej(t){return t.filter(e=>!!e&&typeof e=="object"&&"role"in e&&"content"in e)}function Fue(t){try{let e=JSON.parse(t);if(e&&typeof e=="object"){let{messages:n}=e,{prompt:r,system:o}=e,s=[];if(typeof o=="string"&&s.push({role:"system",content:o}),typeof n=="string")try{n=JSON.parse(n)}catch{}if(Array.isArray(n))return s.push(...Ej(n)),s;if(Array.isArray(r))return s.push(...Ej(r)),s;if(typeof r=="string"&&s.push({role:"user",content:r}),s.length>0)return s}}catch{}return[]}function Rj(t,e){if(typeof e[Om]=="string"&&!e[Ut]&&!e[ta]){let n=e[Om],r=Fue(n);if(r.length){let{systemInstructions:o,filteredMessages:s}=Fn(r);o&&t.setAttribute(Hn,o);let i=Array.isArray(s)?s.length:0,a=ea(s);t.setAttributes({[Om]:a,[Ut]:a,[pn]:i})}}else if(typeof e[ta]=="string")try{let n=JSON.parse(e[ta]);if(Array.isArray(n)){let{systemInstructions:r,filteredMessages:o}=Fn(n);r&&t.setAttribute(Hn,r);let s=Array.isArray(o)?o.length:0,i=ea(o);t.setAttributes({[ta]:i,[Ut]:i,[pn]:s})}}catch{}}function yj(t){switch(t){case"ai.generateText":case"ai.streamText":case"ai.generateObject":case"ai.streamObject":return Sm;case"ai.generateText.doGenerate":return k1;case"ai.streamText.doStream":return G1;case"ai.generateObject.doGenerate":return B1;case"ai.streamObject.doStream":return j1;case"ai.embed.doEmbed":return H1;case"ai.embedMany.doEmbed":return F1;case"ai.rerank.doRerank":return V1;case"ai.toolCall":return q1;default:return t.startsWith("ai.stream")?"ai.run":void 0}}function Vue(t){return Vy.has(t)?"invoke_agent":qy.has(t)?"generate_content":z1.has(t)?"embeddings":K1.has(t)?"rerank":t==="ai.toolCall"?"execute_tool":t}function que(t){let{data:e,description:n}=Y(t);if(n){if(e[Qy]&&e[Xy]&&n==="ai.toolCall"){Kue(t,e);return}!e[ij]&&!n.startsWith("ai.")||Que(t,n,e)}}function $ue(t){if(t.type==="transaction"&&t.spans){let e=new Map;for(let r of t.spans)zue(r),Sj(r,e);gj(t.spans,e);let n=t.contexts?.trace;n?.op==="gen_ai.invoke_agent"&&Jy(n,e)}return t}function Yue(t){if(typeof t!="string")return"stop";switch(t){case"tool-calls":return"tool_call";case"stop":case"length":case"content_filter":case"error":return t;default:return t}}function Wue(t){let e=t[zy],n=t[Ky],r=t[uj];if(e==null&&n==null)return;let o=[];if(typeof e=="string"&&e.length>0&&o.push({type:"text",content:e}),n!=null)try{let s=typeof n=="string"?JSON.parse(n):n;if(Array.isArray(s)){for(let i of s){let a=i.input??i.args;o.push({type:"tool_call",id:i.toolCallId,name:i.toolName,arguments:typeof a=="string"?a:JSON.stringify(a??{})})}delete t[Ky]}}catch{}if(o.length>0){let s={role:"assistant",parts:o,finish_reason:Yue(r)};t[L1]=JSON.stringify([s]),delete t[zy]}}function zue(t){let{data:e,origin:n}=t;if(n==="auto.vercelai.otel"){if(t.status&&t.status!=="ok"&&(t.status="internal_error"),wt(e,_j,Ze),wt(e,fj,Pe),wt(e,pj,Ls),wt(e,"ai.usage.inputTokens",Pe),wt(e,"ai.usage.outputTokens",Ze),wt(e,mj,Pe),wt(e,"ai.response.avgOutputTokensPerSecond","ai.response.avgCompletionTokensPerSecond"),typeof e[Pe]=="number"&&typeof e[Ls]=="number"&&(e[Pe]=e[Pe]+e[Ls]),typeof e[Pe]=="number"){let r=typeof e[Ze]=="number"?e[Ze]:0;e[ln]=r+e[Pe]}if(e[qc]&&Array.isArray(e[qc])&&(e[qc]=Aj(e[qc])),e[Im]){let r=Vue(e[Im]);e[Dt]=r,delete e[Im]}if(wt(e,ta,Ut),Wue(e),wt(e,cj,"gen_ai.response.object"),wt(e,qc,"gen_ai.request.available_tools"),wt(e,hj,gm),wt(e,Tj,Am),wt(e,aj,"gen_ai.request.schema"),wt(e,Tp,He),Array.isArray(e[Wy])){let r=e[Wy].map(o=>{try{return JSON.parse(o)}catch{return o}});e[Hc]=r.length===1?r[0]:JSON.stringify(r)}Xue(e);for(let r of Object.keys(e))r.startsWith("ai.")&&wt(e,r,`vercel.${r}`)}}function wt(t,e,n){t[e]!=null&&(t[n]=t[e],delete t[e])}function Kue(t,e){t.setAttribute(W,"auto.vercelai.otel"),t.setAttribute(ee,"gen_ai.execute_tool"),t.setAttribute(Dt,"execute_tool"),wt(e,Qy,Ji),wt(e,Xy,ky);let n=e[ky];typeof n=="string"&&fp.set(n,t.spanContext()),e[Gy]||t.setAttribute(Gy,"function");let r=e[Ji];r&&t.updateName(`execute_tool ${r}`)}function Que(t,e,n){t.setAttribute(W,"auto.vercelai.otel");let r=e.replace("ai.","");t.setAttribute("ai.pipeline.name",r),t.updateName(r);let o=n[dj];o&&typeof o=="string"&&t.setAttribute("gen_ai.function_id",o),Rj(t,n),n[Tp]&&!n[ft]&&t.setAttribute(ft,n[Tp]),t.setAttribute("ai.streaming",e.includes("stream"));let s=yj(e);if(s&&t.setAttribute(ee,s),Vy.has(e)){o&&typeof o=="string"?t.updateName(`invoke_agent ${o}`):t.updateName("invoke_agent");return}let i=n[Tp];if(i){let a=qy.has(e)?"generate_content":Q1[e];a&&t.updateName(`${a} ${i}`)}}function Nm(t){t.on("spanStart",que),t.addEventProcessor(Object.assign($ue,{id:"VercelAiEventProcessor"}))}function Xue(t){let e=t[lj];if(e)try{let n=JSON.parse(e),r=n.openai??n.azure;if(r&&(vr(t,Ls,r.cachedPromptTokens),vr(t,"gen_ai.usage.output_tokens.reasoning",r.reasoningTokens),vr(t,"gen_ai.usage.output_tokens.prediction_accepted",r.acceptedPredictionTokens),vr(t,"gen_ai.usage.output_tokens.prediction_rejected",r.rejectedPredictionTokens),t["gen_ai.conversation.id"]||vr(t,"gen_ai.conversation.id",r.responseId)),n.anthropic){let o=n.anthropic.usage?.cache_read_input_tokens??n.anthropic.cacheReadInputTokens;vr(t,Ls,o);let s=n.anthropic.usage?.cache_creation_input_tokens??n.anthropic.cacheCreationInputTokens;vr(t,wy,s)}n.bedrock?.usage&&(vr(t,Ls,n.bedrock.usage.cacheReadInputTokens),vr(t,wy,n.bedrock.usage.cacheWriteInputTokens)),n.deepseek&&(vr(t,Ls,n.deepseek.promptCacheHitTokens),vr(t,"gen_ai.usage.input_tokens.cache_miss",n.deepseek.promptCacheMissTokens))}catch{}}function vr(t,e,n){n!=null&&(t[e]=n)}var ws="OpenAI",Ij={"responses.create":{operation:"chat"},"chat.completions.create":{operation:"chat"},"embeddings.create":{operation:"embeddings"},"conversations.create":{operation:"chat"}},Jue=["response.output_item.added","response.function_call_arguments.delta","response.function_call_arguments.done","response.output_item.done"],Oj=["response.created","response.in_progress","response.failed","response.completed","response.incomplete","response.queued","response.output_text.delta",...Jue];function Nj(t){return t!==null&&typeof t=="object"&&"object"in t&&t.object==="chat.completion"}function bj(t){return t!==null&&typeof t=="object"&&"object"in t&&t.object==="response"}function Cj(t){if(t===null||typeof t!="object"||!("object"in t))return!1;let e=t;return e.object==="list"&&typeof e.model=="string"&&e.model.toLowerCase().includes("embedding")}function Pj(t){return t!==null&&typeof t=="object"&&"object"in t&&t.object==="conversation"}function Mj(t){return t!==null&&typeof t=="object"&&"type"in t&&typeof t.type=="string"&&t.type.startsWith("response.")}function xj(t){return t!==null&&typeof t=="object"&&"object"in t&&t.object==="chat.completion.chunk"}function vj(t,e,n){if(bm(t,e.id,e.model,e.created),e.usage&&Ep(t,e.usage.prompt_tokens,e.usage.completion_tokens,e.usage.total_tokens),Array.isArray(e.choices)){let r=e.choices.map(o=>o.finish_reason).filter(o=>o!==null);if(r.length>0&&t.setAttributes({[yn]:JSON.stringify(r)}),n){let o=e.choices.map(s=>s.message?.tool_calls).filter(s=>Array.isArray(s)&&s.length>0).flat();o.length>0&&t.setAttributes({[Ot]:JSON.stringify(o)})}}}function Lj(t,e,n){if(bm(t,e.id,e.model,e.created_at),e.status&&t.setAttributes({[yn]:JSON.stringify([e.status])}),e.usage&&Ep(t,e.usage.input_tokens,e.usage.output_tokens,e.usage.total_tokens),n){let r=e;if(Array.isArray(r.output)&&r.output.length>0){let o=r.output.filter(s=>typeof s=="object"&&s!==null&&s.type==="function_call");o.length>0&&t.setAttributes({[Ot]:JSON.stringify(o)})}}}function Dj(t,e){t.setAttributes({[jy]:e.model,[ft]:e.model}),e.usage&&Ep(t,e.usage.prompt_tokens,void 0,e.usage.total_tokens)}function Uj(t,e){let{id:n,created_at:r}=e;t.setAttributes({[By]:n,[or]:n,[_p]:n}),r&&t.setAttributes({[Hy]:new Date(r*1e3).toISOString()})}function Ep(t,e,n,r){e!==void 0&&t.setAttributes({[W1]:e,[Pe]:e}),n!==void 0&&t.setAttributes({[Y1]:n,[Ze]:n}),r!==void 0&&t.setAttributes({[ln]:r})}function bm(t,e,n,r){t.setAttributes({[By]:e,[or]:e}),t.setAttributes({[jy]:n,[ft]:n}),t.setAttributes({[Hy]:new Date(r*1e3).toISOString()})}function Zue(t){if("conversation"in t&&typeof t.conversation=="string")return t.conversation;if("previous_response_id"in t&&typeof t.previous_response_id=="string")return t.previous_response_id}function wj(t){let e={[He]:t.model??"unknown"};"temperature"in t&&(e[Ms]=t.temperature),"top_p"in t&&(e[vs]=t.top_p),"frequency_penalty"in t&&(e[xs]=t.frequency_penalty),"presence_penalty"in t&&(e[jc]=t.presence_penalty),"stream"in t&&(e[Gc]=t.stream),"encoding_format"in t&&(e[M1]=t.encoding_format),"dimensions"in t&&(e[x1]=t.dimensions);let n=Zue(t);return n&&(e[_p]=n),e}function ele(t,e){for(let n of t){let r=n.index;if(!(r===void 0||!n.function))if(!(r in e.chatCompletionToolCalls))e.chatCompletionToolCalls[r]={...n,function:{name:n.function.name,arguments:n.function.arguments||""}};else{let o=e.chatCompletionToolCalls[r];n.function.arguments&&o?.function&&(o.function.arguments+=n.function.arguments)}}}function tle(t,e,n){e.responseId=t.id??e.responseId,e.responseModel=t.model??e.responseModel,e.responseTimestamp=t.created??e.responseTimestamp,t.usage&&(e.promptTokens=t.usage.prompt_tokens,e.completionTokens=t.usage.completion_tokens,e.totalTokens=t.usage.total_tokens);for(let r of t.choices??[])n&&(r.delta?.content&&e.responseTexts.push(r.delta.content),r.delta?.tool_calls&&ele(r.delta.tool_calls,e)),r.finish_reason&&e.finishReasons.push(r.finish_reason)}function nle(t,e,n,r){if(!(t&&typeof t=="object")){e.eventTypes.push("unknown:non-object");return}if(t instanceof Error){r.setStatus({code:2,message:"internal_error"}),te(t,{mechanism:{handled:!1,type:"auto.ai.openai.stream-response"}});return}if(!("type"in t))return;let o=t;if(!Oj.includes(o.type)){e.eventTypes.push(o.type);return}if(n&&(o.type==="response.output_item.done"&&"item"in o&&e.responsesApiToolCalls.push(o.item),o.type==="response.output_text.delta"&&"delta"in o&&o.delta)){e.responseTexts.push(o.delta);return}if("response"in o){let{response:s}=o;e.responseId=s.id??e.responseId,e.responseModel=s.model??e.responseModel,e.responseTimestamp=s.created_at??e.responseTimestamp,s.usage&&(e.promptTokens=s.usage.input_tokens,e.completionTokens=s.usage.output_tokens,e.totalTokens=s.usage.total_tokens),s.status&&e.finishReasons.push(s.status),n&&s.output_text&&e.responseTexts.push(s.output_text)}}async function*kj(t,e,n){let r={eventTypes:[],responseTexts:[],finishReasons:[],responseId:"",responseModel:"",responseTimestamp:0,promptTokens:void 0,completionTokens:void 0,totalTokens:void 0,chatCompletionToolCalls:{},responsesApiToolCalls:[]};try{for await(let o of t)xj(o)?tle(o,r,n):Mj(o)&&nle(o,r,n,e),yield o}finally{bm(e,r.responseId,r.responseModel,r.responseTimestamp),Ep(e,r.promptTokens,r.completionTokens,r.totalTokens),e.setAttributes({[Xi]:!0}),r.finishReasons.length&&e.setAttributes({[yn]:JSON.stringify(r.finishReasons)}),n&&r.responseTexts.length&&e.setAttributes({[rt]:r.responseTexts.join("")});let s=[...Object.values(r.chatCompletionToolCalls),...r.responsesApiToolCalls];s.length>0&&e.setAttributes({[Ot]:JSON.stringify(s)}),e.end()}}function rle(t){let e=Array.isArray(t.tools)?t.tools:[],r=t.web_search_options&&typeof t.web_search_options=="object"?[{type:"web_search_options",...t.web_search_options}]:[],o=[...e,...r];if(o.length!==0)try{return JSON.stringify(o)}catch(s){C&&g.error("Failed to serialize OpenAI tools:",s);return}}function ole(t,e){let n={[Ps]:"openai",[Dt]:e,[W]:"auto.ai.openai"};if(t.length>0&&typeof t[0]=="object"&&t[0]!==null){let r=t[0],o=rle(r);o&&(n[Zr]=o),Object.assign(n,wj(r))}else n[He]="unknown";return n}function sle(t,e,n){if(!e||typeof e!="object")return;let r=e;if(Nj(r)){if(vj(t,r,n),n&&r.choices?.length){let o=r.choices.map(s=>s.message?.content||"");t.setAttributes({[rt]:JSON.stringify(o)})}}else bj(r)?(Lj(t,r,n),n&&r.output_text&&t.setAttributes({[rt]:r.output_text})):Cj(r)?Dj(t,r):Pj(r)&&Uj(t,r)}function Gj(t,e,n){if(n==="embeddings"&&"input"in e){let a=e.input;if(a==null||typeof a=="string"&&a.length===0||Array.isArray(a)&&a.length===0)return;t.setAttribute(Hc,typeof a=="string"?a:JSON.stringify(a));return}let r="input"in e?e.input:"messages"in e?e.messages:void 0;if(!r||Array.isArray(r)&&r.length===0)return;let{systemInstructions:o,filteredMessages:s}=Fn(r);o&&t.setAttribute(Hn,o);let i=ea(s);t.setAttribute(Ut,i),Array.isArray(s)?t.setAttribute(pn,s.length):t.setAttribute(pn,1)}function ile(t,e,n,r,o){return function(...i){let a=n.operation,c=ole(i,a),l=c[He]||"unknown",p=i[0],d=p&&typeof p=="object"&&p.stream===!0,_={name:`${a} ${l}`,op:`gen_ai.${a}`,attributes:c};if(d){let h,T=It(_,S=>(h=t.apply(r,i),o.recordInputs&&p&&Gj(S,p,a),(async()=>{try{let R=await h;return kj(R,S,o.recordOutputs??!1)}catch(R){throw S.setStatus({code:2,message:"internal_error"}),te(R,{mechanism:{handled:!1,type:"auto.ai.openai.stream",data:{function:e}}}),S.end(),R}})()));return Vc(h,T,"auto.ai.openai")}let f,m=xr(_,h=>(f=t.apply(r,i),o.recordInputs&&p&&Gj(h,p,a),f.then(T=>(sle(h,T,o.recordOutputs),T),T=>{throw te(T,{mechanism:{handled:!1,type:"auto.ai.openai",data:{function:e}}}),T})));return Vc(f,m,"auto.ai.openai")}}function Bj(t,e="",n){return new Proxy(t,{get(r,o){let s=r[o],i=Fc(e,String(o)),a=Ij[i];return typeof s=="function"&&a?ile(s,i,a,r,n):typeof s=="function"?s.bind(r):s&&typeof s=="object"?Bj(s,i,n):s}})}function Cm(t,e){return Bj(t,"",eo(e))}var ks="Anthropic_AI",jj={"messages.create":{operation:"chat"},"messages.stream":{operation:"chat",streaming:!0},"messages.countTokens":{operation:"chat"},"models.get":{operation:"models"},"completions.create":{operation:"chat"},"models.retrieve":{operation:"models"},"beta.messages.create":{operation:"chat"}};function Hj(t,e){if(Array.isArray(e)&&e.length===0)return;let{systemInstructions:n,filteredMessages:r}=Fn(e);n&&t.setAttributes({[Hn]:n});let o=Array.isArray(r)?r.length:1;t.setAttributes({[Ut]:ea(r),[pn]:o})}var ale={invalid_request_error:"invalid_argument",authentication_error:"unauthenticated",permission_error:"permission_denied",not_found_error:"not_found",request_too_large:"failed_precondition",rate_limit_error:"resource_exhausted",api_error:"internal_error",overloaded_error:"unavailable"};function tI(t){return t&&ale[t]||"internal_error"}function Fj(t,e){e.error&&(t.setStatus({code:2,message:tI(e.error.type)}),te(e.error,{mechanism:{handled:!1,type:"auto.ai.anthropic.anthropic_error"}}))}function Vj(t){let{system:e,messages:n,input:r}=t,o=typeof e=="string"?[{role:"system",content:t.system}]:[],s=Array.isArray(r)?r:r!=null?[r]:void 0,i=Array.isArray(n)?n:n!=null?[n]:[],a=s??i;return[...o,...a]}function cle(t,e){return"type"in t&&typeof t.type=="string"&&t.type==="error"?(e.setStatus({code:2,message:tI(t.error?.type)}),te(t.error,{mechanism:{handled:!1,type:"auto.ai.anthropic.anthropic_error"}}),!0):!1}function ule(t,e){if(t.type==="message_delta"&&t.usage&&"output_tokens"in t.usage&&typeof t.usage.output_tokens=="number"&&(e.completionTokens=t.usage.output_tokens),t.message){let n=t.message;n.id&&(e.responseId=n.id),n.model&&(e.responseModel=n.model),n.stop_reason&&e.finishReasons.push(n.stop_reason),n.usage&&(typeof n.usage.input_tokens=="number"&&(e.promptTokens=n.usage.input_tokens),typeof n.usage.cache_creation_input_tokens=="number"&&(e.cacheCreationInputTokens=n.usage.cache_creation_input_tokens),typeof n.usage.cache_read_input_tokens=="number"&&(e.cacheReadInputTokens=n.usage.cache_read_input_tokens))}}function lle(t,e){t.type!=="content_block_start"||typeof t.index!="number"||!t.content_block||(t.content_block.type==="tool_use"||t.content_block.type==="server_tool_use")&&(e.activeToolBlocks[t.index]={id:t.content_block.id,name:t.content_block.name,inputJsonParts:[]})}function ple(t,e,n){if(!(t.type!=="content_block_delta"||!t.delta)){if(typeof t.index=="number"&&"partial_json"in t.delta&&typeof t.delta.partial_json=="string"){let r=e.activeToolBlocks[t.index];r&&r.inputJsonParts.push(t.delta.partial_json)}n&&typeof t.delta.text=="string"&&e.responseTexts.push(t.delta.text)}}function dle(t,e){if(t.type!=="content_block_stop"||typeof t.index!="number")return;let n=e.activeToolBlocks[t.index];if(!n)return;let r=n.inputJsonParts.join(""),o;try{o=r?JSON.parse(r):{}}catch{o={__unparsed:r}}e.toolCalls.push({type:"tool_use",id:n.id,name:n.name,input:o}),delete e.activeToolBlocks[t.index]}function qj(t,e,n,r){!(t&&typeof t=="object")||cle(t,r)||(ule(t,e),lle(t,e),ple(t,e,n),dle(t,e))}function _le(t,e,n){e.isRecording()&&(t.responseId&&e.setAttributes({[or]:t.responseId}),t.responseModel&&e.setAttributes({[ft]:t.responseModel}),hp(e,t.promptTokens,t.completionTokens,t.cacheCreationInputTokens,t.cacheReadInputTokens),e.setAttributes({[Xi]:!0}),t.finishReasons.length>0&&e.setAttributes({[yn]:JSON.stringify(t.finishReasons)}),n&&t.responseTexts.length>0&&e.setAttributes({[rt]:t.responseTexts.join("")}),n&&t.toolCalls.length>0&&e.setAttributes({[Ot]:JSON.stringify(t.toolCalls)}),e.end())}async function*$j(t,e,n){let r={responseTexts:[],finishReasons:[],responseId:"",responseModel:"",promptTokens:void 0,completionTokens:void 0,cacheCreationInputTokens:void 0,cacheReadInputTokens:void 0,toolCalls:[],activeToolBlocks:{}};try{for await(let o of t)qj(o,r,n,e),yield o}finally{r.responseId&&e.setAttributes({[or]:r.responseId}),r.responseModel&&e.setAttributes({[ft]:r.responseModel}),hp(e,r.promptTokens,r.completionTokens,r.cacheCreationInputTokens,r.cacheReadInputTokens),e.setAttributes({[Xi]:!0}),r.finishReasons.length>0&&e.setAttributes({[yn]:JSON.stringify(r.finishReasons)}),n&&r.responseTexts.length>0&&e.setAttributes({[rt]:r.responseTexts.join("")}),n&&r.toolCalls.length>0&&e.setAttributes({[Ot]:JSON.stringify(r.toolCalls)}),e.end()}}function Yj(t,e,n){let r={responseTexts:[],finishReasons:[],responseId:"",responseModel:"",promptTokens:void 0,completionTokens:void 0,cacheCreationInputTokens:void 0,cacheReadInputTokens:void 0,toolCalls:[],activeToolBlocks:{}};return t.on("streamEvent",o=>{qj(o,r,n,e)}),t.on("message",()=>{_le(r,e,n)}),t.on("error",o=>{te(o,{mechanism:{handled:!1,type:"auto.ai.anthropic.stream_error"}}),e.isRecording()&&(e.setStatus({code:2,message:"internal_error"}),e.end())}),t}function fle(t,e,n){let r={[Ps]:"anthropic",[Dt]:n,[W]:"auto.ai.anthropic"};if(t.length>0&&typeof t[0]=="object"&&t[0]!==null){let o=t[0];o.tools&&Array.isArray(o.tools)&&(r[Zr]=JSON.stringify(o.tools)),r[He]=o.model??"unknown","temperature"in o&&(r[Ms]=o.temperature),"top_p"in o&&(r[vs]=o.top_p),"stream"in o&&(r[Gc]=o.stream),"top_k"in o&&(r[Em]=o.top_k),"frequency_penalty"in o&&(r[xs]=o.frequency_penalty),"max_tokens"in o&&(r[Bc]=o.max_tokens)}else e==="models.retrieve"||e==="models.get"?r[He]=t[0]:r[He]="unknown";return r}function nI(t,e){let n=Vj(e);Hj(t,n),"prompt"in e&&t.setAttributes({[P1]:JSON.stringify(e.prompt)})}function mle(t,e){if("content"in e&&Array.isArray(e.content)){t.setAttributes({[rt]:e.content.map(r=>r.text).filter(r=>!!r).join("")});let n=[];for(let r of e.content)(r.type==="tool_use"||r.type==="server_tool_use")&&n.push(r);n.length>0&&t.setAttributes({[Ot]:JSON.stringify(n)})}"completion"in e&&t.setAttributes({[rt]:e.completion}),"input_tokens"in e&&t.setAttributes({[rt]:JSON.stringify(e.input_tokens)})}function hle(t,e){"id"in e&&"model"in e&&(t.setAttributes({[or]:e.id,[ft]:e.model}),"created"in e&&typeof e.created=="number"&&t.setAttributes({[Fy]:new Date(e.created*1e3).toISOString()}),"created_at"in e&&typeof e.created_at=="number"&&t.setAttributes({[Fy]:new Date(e.created_at*1e3).toISOString()}),"usage"in e&&e.usage&&hp(t,e.usage.input_tokens,e.usage.output_tokens,e.usage.cache_creation_input_tokens,e.usage.cache_read_input_tokens))}function Tle(t,e,n){if(!(!e||typeof e!="object")){if("type"in e&&e.type==="error"){Fj(t,e);return}n&&mle(t,e),hle(t,e)}}function Wj(t,e,n){throw te(t,{mechanism:{handled:!1,type:"auto.ai.anthropic",data:{function:n}}}),e.isRecording()&&(e.setStatus({code:2,message:"internal_error"}),e.end()),t}function Ele(t,e,n,r,o,s,i,a,c,l,p){let d=o[He]??"unknown",_={name:`${s} ${d}`,op:`gen_ai.${s}`,attributes:o};if(l&&!p){let f,m=It(_,h=>(f=t.apply(n,r),c.recordInputs&&a&&nI(h,a),(async()=>{try{let T=await f;return $j(T,h,c.recordOutputs??!1)}catch(T){return Wj(T,h,i)}})()));return Vc(f,m,"auto.ai.anthropic")}else return It(_,f=>{try{c.recordInputs&&a&&nI(f,a);let m=e.apply(n,r);return Yj(m,f,c.recordOutputs??!1)}catch(m){return Wj(m,f,i)}})}function Sle(t,e,n,r,o){return new Proxy(t,{apply(s,i,a){let c=n.operation,l=fle(a,e,c),p=l[He]??"unknown",d=typeof a[0]=="object"?a[0]:void 0,_=!!d?.stream,f=n.streaming===!0;if(_||f)return Ele(t,s,r,a,l,c,e,d,o,_,f);let m,h=xr({name:`${c} ${p}`,op:`gen_ai.${c}`,attributes:l},T=>(m=s.apply(r,a),o.recordInputs&&d&&nI(T,d),m.then(S=>(Tle(T,S,o.recordOutputs),S),S=>{throw te(S,{mechanism:{handled:!1,type:"auto.ai.anthropic",data:{function:e}}}),S})));return Vc(m,h,"auto.ai.anthropic")}})}function zj(t,e="",n){return new Proxy(t,{get(r,o){let s=r[o],i=Fc(e,String(o)),a=jj[i];return typeof s=="function"&&a?Sle(s,i,a,r,n):typeof s=="function"?s.bind(r):s&&typeof s=="object"?zj(s,i,n):s}})}function Pm(t,e){return zj(t,"",eo(e))}var Gs="Google_GenAI",Kj={"models.generateContent":{operation:"generate_content"},"models.generateContentStream":{operation:"generate_content",streaming:!0},"models.embedContent":{operation:"embeddings"},"chats.create":{operation:"chat"},"chat.sendMessage":{operation:"chat"},"chat.sendMessageStream":{operation:"chat",streaming:!0}},Qj="google_genai",rI="chats.create",Xj="chat";function gle(t,e){let n=t?.promptFeedback;if(n?.blockReason){let r=n.blockReasonMessage??n.blockReason;return e.setStatus({code:2,message:"internal_error"}),te(`Content blocked: ${r}`,{mechanism:{handled:!1,type:"auto.ai.google_genai"}}),!0}return!1}function Ale(t,e){typeof t.responseId=="string"&&(e.responseId=t.responseId),typeof t.modelVersion=="string"&&(e.responseModel=t.modelVersion);let n=t.usageMetadata;n&&(typeof n.promptTokenCount=="number"&&(e.promptTokens=n.promptTokenCount),typeof n.candidatesTokenCount=="number"&&(e.completionTokens=n.candidatesTokenCount),typeof n.totalTokenCount=="number"&&(e.totalTokens=n.totalTokenCount))}function Rle(t,e,n){Array.isArray(t.functionCalls)&&e.toolCalls.push(...t.functionCalls);for(let r of t.candidates??[]){r?.finishReason&&!e.finishReasons.includes(r.finishReason)&&e.finishReasons.push(r.finishReason);for(let o of r?.content?.parts??[])n&&o.text&&e.responseTexts.push(o.text),o.functionCall&&e.toolCalls.push({type:"function",id:o.functionCall.id,name:o.functionCall.name,arguments:o.functionCall.args})}}function yle(t,e,n,r){!t||gle(t,r)||(Ale(t,e),Rle(t,e,n))}async function*Jj(t,e,n){let r={responseTexts:[],finishReasons:[],toolCalls:[]};try{for await(let o of t)yle(o,r,n,e),yield o}finally{let o={[Xi]:!0};r.responseId&&(o[or]=r.responseId),r.responseModel&&(o[ft]=r.responseModel),r.promptTokens!==void 0&&(o[Pe]=r.promptTokens),r.completionTokens!==void 0&&(o[Ze]=r.completionTokens),r.totalTokens!==void 0&&(o[ln]=r.totalTokens),r.finishReasons.length&&(o[yn]=JSON.stringify(r.finishReasons)),n&&r.responseTexts.length&&(o[rt]=r.responseTexts.join("")),n&&r.toolCalls.length&&(o[Ot]=JSON.stringify(r.toolCalls)),e.setAttributes(o),e.end()}}function $c(t,e="user"){return typeof t=="string"?[{role:e,content:t}]:Array.isArray(t)?t.flatMap(n=>$c(n,e)):typeof t!="object"||!t?[]:"role"in t&&typeof t.role=="string"?[t]:"parts"in t?[{...t,role:e}]:[{role:e,content:t}]}function Zj(t,e){if("model"in t&&typeof t.model=="string")return t.model;if(e&&typeof e=="object"){let n=e;if("model"in n&&typeof n.model=="string")return n.model;if("modelVersion"in n&&typeof n.modelVersion=="string")return n.modelVersion}return"unknown"}function Ile(t){let e={};return"temperature"in t&&typeof t.temperature=="number"&&(e[Ms]=t.temperature),"topP"in t&&typeof t.topP=="number"&&(e[vs]=t.topP),"topK"in t&&typeof t.topK=="number"&&(e[Em]=t.topK),"maxOutputTokens"in t&&typeof t.maxOutputTokens=="number"&&(e[Bc]=t.maxOutputTokens),"frequencyPenalty"in t&&typeof t.frequencyPenalty=="number"&&(e[xs]=t.frequencyPenalty),"presencePenalty"in t&&typeof t.presencePenalty=="number"&&(e[jc]=t.presencePenalty),e}function Ole(t,e,n){let r={[Ps]:Qj,[Dt]:t,[W]:"auto.ai.google_genai"};if(e){if(r[He]=Zj(e,n),"config"in e&&typeof e.config=="object"&&e.config){let o=e.config;if(Object.assign(r,Ile(o)),"tools"in o&&Array.isArray(o.tools)){let s=o.tools.flatMap(i=>i.functionDeclarations);r[Zr]=JSON.stringify(s)}}}else r[He]=Zj({},n);return r}function eH(t,e,n){if(n){let o=e.contents;o!=null&&t.setAttribute(Hc,typeof o=="string"?o:JSON.stringify(o));return}let r=[];if("config"in e&&e.config&&typeof e.config=="object"&&"systemInstruction"in e.config&&e.config.systemInstruction&&r.push(...$c(e.config.systemInstruction,"system")),"history"in e&&r.push(...$c(e.history,"user")),"contents"in e&&r.push(...$c(e.contents,"user")),"message"in e&&r.push(...$c(e.message,"user")),Array.isArray(r)&&r.length){let{systemInstructions:o,filteredMessages:s}=Fn(r);o&&t.setAttribute(Hn,o);let i=Array.isArray(s)?s.length:0;t.setAttributes({[pn]:i,[Ut]:JSON.stringify(Us(s))})}}function Nle(t,e,n){if(!(!e||typeof e!="object")){if(e.modelVersion&&t.setAttribute(ft,e.modelVersion),e.usageMetadata&&typeof e.usageMetadata=="object"){let r=e.usageMetadata;typeof r.promptTokenCount=="number"&&t.setAttributes({[Pe]:r.promptTokenCount}),typeof r.candidatesTokenCount=="number"&&t.setAttributes({[Ze]:r.candidatesTokenCount}),typeof r.totalTokenCount=="number"&&t.setAttributes({[ln]:r.totalTokenCount})}if(n&&Array.isArray(e.candidates)&&e.candidates.length>0){let r=e.candidates.map(o=>o.content?.parts&&Array.isArray(o.content.parts)?o.content.parts.map(s=>typeof s.text=="string"?s.text:"").filter(s=>s.length>0).join(""):"").filter(o=>o.length>0);r.length>0&&t.setAttributes({[rt]:r.join("")})}if(n&&e.functionCalls){let r=e.functionCalls;Array.isArray(r)&&r.length>0&&t.setAttributes({[Ot]:JSON.stringify(r)})}}}function tH(t,e,n,r,o){let s=e===rI,i=n.operation==="embeddings";return new Proxy(t,{apply(a,c,l){let p=n.operation,d=l[0],_=Ole(p,d,r),f=_[He]??"unknown";return n.streaming?It({name:`${p} ${f}`,op:`gen_ai.${p}`,attributes:_},async m=>{try{o.recordInputs&&d&&eH(m,d,i);let h=await a.apply(r,l);return Jj(h,m,!!o.recordOutputs)}catch(h){throw m.setStatus({code:2,message:"internal_error"}),te(h,{mechanism:{handled:!1,type:"auto.ai.google_genai",data:{function:e}}}),m.end(),h}}):xr({name:s?`${p} ${f} create`:`${p} ${f}`,op:`gen_ai.${p}`,attributes:_},m=>(o.recordInputs&&d&&eH(m,d,i),Mr(()=>a.apply(r,l),h=>{te(h,{mechanism:{handled:!1,type:"auto.ai.google_genai",data:{function:e}}})},()=>{},h=>{!s&&!i&&Nle(m,h,o.recordOutputs)})))}})}function oI(t,e="",n){return new Proxy(t,{get:(r,o,s)=>{let i=Reflect.get(r,o,s),a=Fc(e,String(o)),c=Kj[a];if(typeof i=="function"&&c){if(a===rI){let l=tH(i,a,c,r,n);return function(...d){let _=l(...d);return _&&typeof _=="object"?oI(_,Xj,n):_}}return tH(i,a,c,r,n)}return typeof i=="function"?i.bind(r):i&&typeof i=="object"?oI(i,a,n):i}})}function Mm(t,e){return oI(t,"",eo(e))}var xm="LangChain",na="auto.ai.langchain",nH={human:"user",ai:"assistant",assistant:"assistant",system:"system",function:"function",tool:"tool"};var sr=(t,e,n)=>{n!=null&&(t[e]=n)},Vn=(t,e,n)=>{let r=Number(n);Number.isNaN(r)||(t[e]=r)};function Go(t){if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}function Yc(t){if(Array.isArray(t))try{let e=t.map(n=>n&&typeof n=="object"&&Ds(n)?Zi(n):n);return JSON.stringify(e)}catch{return String(t)}return Go(t)}function Sp(t){let e=t.toLowerCase();return nH[e]??e}function rH(t){return t.includes("System")?"system":t.includes("Human")?"user":t.includes("AI")||t.includes("Assistant")?"assistant":t.includes("Function")?"function":t.includes("Tool")?"tool":"user"}function sI(t){if(!(!t||Array.isArray(t)))return t.invocation_params}function gp(t){return t.map(e=>{let n=e._getType;if(typeof n=="function"){let o=n.call(e);return{role:Sp(o),content:Yc(e.content)}}if(e.lc===1&&e.kwargs){let o=e.id,s=Array.isArray(o)&&o.length>0?o[o.length-1]:"",i=typeof s=="string"?rH(s):"user";return{role:Sp(i),content:Yc(e.kwargs?.content)}}if(e.type){let o=String(e.type).toLowerCase();return{role:Sp(o),content:Yc(e.content)}}if(e.role)return{role:Sp(String(e.role)),content:Yc(e.content)};let r=e.constructor?.name;return r&&r!=="Object"?{role:Sp(rH(r)),content:Yc(e.content)}:{role:"user",content:Yc(e.content)}})}function ble(t,e,n){let r={},o="kwargs"in t?t.kwargs:void 0,s=e?.temperature??n?.ls_temperature??o?.temperature;Vn(r,Ms,s);let i=e?.max_tokens??n?.ls_max_tokens??o?.max_tokens;Vn(r,Bc,i);let a=e?.top_p??o?.top_p;Vn(r,vs,a);let c=e?.frequency_penalty;Vn(r,xs,c);let l=e?.presence_penalty;return Vn(r,jc,l),e&&"stream"in e&&sr(r,Gc,!!e.stream),r}function oH(t,e,n,r,o){return{[Ps]:Go(t??"langchain"),[Dt]:"chat",[He]:Go(e),[W]:na,...ble(n,r,o)}}function sH(t,e,n,r,o){let s=o?.ls_provider,i=r?.model??o?.ls_model_name??"unknown",a=oH(s,i,t,r,o);if(n&&Array.isArray(e)&&e.length>0){sr(a,pn,e.length);let c=e.map(l=>({role:"user",content:l}));sr(a,Ut,Go(c))}return a}function iH(t,e,n,r,o){let s=o?.ls_provider??t.id?.[2],i=r?.model??o?.ls_model_name??"unknown",a=oH(s,i,t,r,o);if(n&&Array.isArray(e)&&e.length>0){let c=gp(e.flat()),{systemInstructions:l,filteredMessages:p}=Fn(c);l&&sr(a,Hn,l);let d=Array.isArray(p)?p.length:0;sr(a,pn,d);let _=Us(p);sr(a,Ut,Go(_))}return a}function Cle(t,e){let n=[],r=t.flat();for(let o of r){let s=o.message?.content;if(Array.isArray(s))for(let i of s){let a=i;a.type==="tool_use"&&n.push(a)}}n.length>0&&sr(e,Ot,Go(n))}function Ple(t,e){if(!t)return;let n=t.tokenUsage,r=t.usage;if(n)Vn(e,Pe,n.promptTokens),Vn(e,Ze,n.completionTokens),Vn(e,ln,n.totalTokens);else if(r){Vn(e,Pe,r.input_tokens),Vn(e,Ze,r.output_tokens);let o=Number(r.input_tokens),s=Number(r.output_tokens),i=(Number.isNaN(o)?0:o)+(Number.isNaN(s)?0:s);i>0&&Vn(e,ln,i),r.cache_creation_input_tokens!==void 0&&Vn(e,U1,r.cache_creation_input_tokens),r.cache_read_input_tokens!==void 0&&Vn(e,w1,r.cache_read_input_tokens)}}function aH(t,e){if(!t)return;let n={};if(Array.isArray(t.generations)){let l=t.generations.flat().map(p=>p.generationInfo?.finish_reason?p.generationInfo.finish_reason:p.generation_info?.finish_reason?p.generation_info.finish_reason:null).filter(p=>typeof p=="string");if(l.length>0&&sr(n,yn,Go(l)),Cle(t.generations,n),e){let p=t.generations.flat().map(d=>d.text??d.message?.content).filter(d=>typeof d=="string");p.length>0&&sr(n,rt,Go(p))}}Ple(t.llmOutput,n);let r=t.llmOutput,s=t.generations?.[0]?.[0]?.message,i=r?.model_name??r?.model??s?.response_metadata?.model_name;i&&sr(n,ft,i);let a=r?.id??s?.id;a&&sr(n,or,a);let c=r?.stop_reason??s?.response_metadata?.finish_reason;return c&&sr(n,v1,Go(c)),n}function vm(t={}){let{recordInputs:e,recordOutputs:n}=eo(t),r=new Map,o=i=>{let a=r.get(i);a?.isRecording()&&(a.end(),r.delete(i))},s={lc_serializable:!1,lc_namespace:["langchain_core","callbacks","sentry"],lc_secrets:void 0,lc_attributes:void 0,lc_aliases:void 0,lc_serializable_keys:void 0,lc_id:["langchain_core","callbacks","sentry"],lc_kwargs:{},name:"SentryCallbackHandler",ignoreLLM:!1,ignoreChain:!1,ignoreAgent:!1,ignoreRetriever:!1,ignoreCustomEvent:!1,raiseError:!1,awaitHandlers:!0,handleLLMStart(i,a,c,l,p,d,_,f){let m=sI(d),h=sH(i,a,e,m,_),T=h[He],S=h[Dt];It({name:`${S} ${T}`,op:"gen_ai.chat",attributes:{...h,[ee]:"gen_ai.chat"}},R=>(r.set(c,R),R))},handleChatModelStart(i,a,c,l,p,d,_,f){let m=sI(d),h=iH(i,a,e,m,_),T=h[He],S=h[Dt];It({name:`${S} ${T}`,op:"gen_ai.chat",attributes:{...h,[ee]:"gen_ai.chat"}},R=>(r.set(c,R),R))},handleLLMEnd(i,a,c,l,p){let d=r.get(a);if(d?.isRecording()){let _=aH(i,n);_&&d.setAttributes(_),o(a)}},handleLLMError(i,a){let c=r.get(a);c?.isRecording()&&(c.setStatus({code:2,message:"internal_error"}),o(a)),te(i,{mechanism:{handled:!1,type:`${na}.llm_error_handler`}})},handleChainStart(i,a,c,l,p,d,_,f){let m=f||i.name||"unknown_chain",h={[W]:"auto.ai.langchain","langchain.chain.name":m};e&&(h["langchain.chain.inputs"]=JSON.stringify(a)),It({name:`chain ${m}`,op:"gen_ai.invoke_agent",attributes:{...h,[ee]:"gen_ai.invoke_agent"}},T=>(r.set(c,T),T))},handleChainEnd(i,a){let c=r.get(a);c?.isRecording()&&(n&&c.setAttributes({"langchain.chain.outputs":JSON.stringify(i)}),o(a))},handleChainError(i,a){let c=r.get(a);c?.isRecording()&&(c.setStatus({code:2,message:"internal_error"}),o(a)),te(i,{mechanism:{handled:!1,type:`${na}.chain_error_handler`}})},handleToolStart(i,a,c,l){let p=i.name||"unknown_tool",d={[W]:na,[Ji]:p};e&&(d[gm]=a),It({name:`execute_tool ${p}`,op:"gen_ai.execute_tool",attributes:{...d,[ee]:"gen_ai.execute_tool"}},_=>(r.set(c,_),_))},handleToolEnd(i,a){let c=r.get(a);c?.isRecording()&&(n&&c.setAttributes({[Am]:JSON.stringify(i)}),o(a))},handleToolError(i,a){let c=r.get(a);c?.isRecording()&&(c.setStatus({code:2,message:"internal_error"}),o(a)),te(i,{mechanism:{handled:!1,type:`${na}.tool_error_handler`}})},copy(){return s},toJSON(){return{lc:1,type:"not_implemented",id:s.lc_id}},toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:s.lc_id}}};return s}var Lm="LangGraph",iI="auto.ai.langgraph";function Mle(t){if(!t||t.length===0)return null;let e=[];for(let n of t)if(n&&typeof n=="object"){let r=n.tool_calls;r&&Array.isArray(r)&&e.push(...r)}return e.length>0?e:null}function xle(t){let e=t,n=0,r=0,o=0;if(e.usage_metadata&&typeof e.usage_metadata=="object"){let s=e.usage_metadata;return typeof s.input_tokens=="number"&&(n=s.input_tokens),typeof s.output_tokens=="number"&&(r=s.output_tokens),typeof s.total_tokens=="number"&&(o=s.total_tokens),{inputTokens:n,outputTokens:r,totalTokens:o}}if(e.response_metadata&&typeof e.response_metadata=="object"){let s=e.response_metadata;if(s.tokenUsage&&typeof s.tokenUsage=="object"){let i=s.tokenUsage;typeof i.promptTokens=="number"&&(n=i.promptTokens),typeof i.completionTokens=="number"&&(r=i.completionTokens),typeof i.totalTokens=="number"&&(o=i.totalTokens)}}return{inputTokens:n,outputTokens:r,totalTokens:o}}function vle(t,e){let n=e;if(n.response_metadata&&typeof n.response_metadata=="object"){let r=n.response_metadata;r.model_name&&typeof r.model_name=="string"&&t.setAttribute(ft,r.model_name),r.finish_reason&&typeof r.finish_reason=="string"&&t.setAttribute(yn,[r.finish_reason])}}function cH(t){if(!t.builder?.nodes?.tools?.runnable?.tools)return null;let e=t.builder?.nodes?.tools?.runnable?.tools;return!e||!Array.isArray(e)||e.length===0?null:e.map(n=>({name:n.lc_kwargs?.name,description:n.lc_kwargs?.description,schema:n.lc_kwargs?.schema}))}function uH(t,e,n){let o=n?.messages;if(!o||!Array.isArray(o))return;let s=e?.length??0,i=o.length>s?o.slice(s):[];if(i.length===0)return;let a=Mle(i);a&&t.setAttribute(Ot,JSON.stringify(a));let c=gp(i);t.setAttribute(rt,JSON.stringify(c));let l=0,p=0,d=0;for(let _ of i){let f=xle(_);l+=f.inputTokens,p+=f.outputTokens,d+=f.totalTokens,vle(t,_)}l>0&&t.setAttribute(Pe,l),p>0&&t.setAttribute(Ze,p),d>0&&t.setAttribute(ln,d)}function aI(t,e){return new Proxy(t,{apply(n,r,o){return xr({op:"gen_ai.create_agent",name:"create_agent",attributes:{[W]:iI,[ee]:"gen_ai.create_agent",[Dt]:"create_agent"}},s=>{try{let i=Reflect.apply(n,r,o),a=o.length>0?o[0]:{};a?.name&&typeof a.name=="string"&&(s.setAttribute(Uy,a.name),s.updateName(`create_agent ${a.name}`));let c=i.invoke;return c&&typeof c=="function"&&(i.invoke=Lle(c.bind(i),i,a,e)),i}catch(i){throw s.setStatus({code:2,message:"internal_error"}),te(i,{mechanism:{handled:!1,type:"auto.ai.langgraph.error"}}),i}})}})}function Lle(t,e,n,r){return new Proxy(t,{apply(o,s,i){return xr({op:"gen_ai.invoke_agent",name:"invoke_agent",attributes:{[W]:iI,[ee]:Sm,[Dt]:"invoke_agent"}},async a=>{try{let c=n?.name;c&&typeof c=="string"&&(a.setAttribute(D1,c),a.setAttribute(Uy,c),a.updateName(`invoke_agent ${c}`));let d=(i.length>1?i[1]:void 0)?.configurable?.thread_id;d&&typeof d=="string"&&a.setAttribute(_p,d);let _=cH(e);_&&a.setAttribute(Zr,JSON.stringify(_));let f=r.recordInputs,m=r.recordOutputs,h=i.length>0?i[0]?.messages??[]:[];if(h&&f){let S=gp(h),{systemInstructions:R,filteredMessages:I}=Fn(S);R&&a.setAttribute(Hn,R);let x=Us(I),F=Array.isArray(I)?I.length:0;a.setAttributes({[Ut]:JSON.stringify(x),[pn]:F})}let T=await Reflect.apply(o,s,i);return m&&uH(a,h??null,T),T}catch(c){throw a.setStatus({code:2,message:"internal_error"}),te(c,{mechanism:{handled:!1,type:"auto.ai.langgraph.error"}}),c}})}})}function Dm(t,e){return t.compile=aI(t.compile,eo(e)),t}function Ap(t){if(t!==void 0)return t>=400&&t<500?"warning":t>=500?"error":void 0}function Rp(t,e,n){let r=t[e];if(typeof r=="function"){try{t[e]=n}catch{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0,enumerable:!0})}if(t.default===r)try{t.default=n}catch{Object.defineProperty(t,"default",{value:n,writable:!0,configurable:!0,enumerable:!0})}}}function pH(t,e=!1){return!(e||t&&!t.startsWith("/")&&!t.match(/^[A-Z]:/)&&!t.startsWith(".")&&!t.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&t!==void 0&&!t.includes("node_modules/")}function dH(t){let e=/^\s*[-]{4,}$/,n=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,r=/at (?:async )?(.+?) \(data:(.*?),/;return o=>{let s=o.match(r);if(s)return{filename:`<data:${s[2]}>`,function:s[1]};let i=o.match(n);if(i){let a,c,l,p,d;if(i[1]){l=i[1];let h=l.lastIndexOf(".");if(l[h-1]==="."&&h--,h>0){a=l.slice(0,h),c=l.slice(h+1);let T=a.indexOf(".Module");T>0&&(l=l.slice(T+1),a=a.slice(0,T))}p=void 0}c&&(p=a,d=c),c==="<anonymous>"&&(d=void 0,l=void 0),l===void 0&&(d=d||Mf,l=p?`${p}.${d}`:d);let _=MG(i[2]),f=i[5]==="native";!_&&i[5]&&!f&&(_=i[5]);let m=_?Dle(_):void 0;return{filename:m??_,module:m&&t?.(m),function:l,lineno:lH(i[3]),colno:lH(i[4]),in_app:pH(_||"",f)}}if(o.match(e))return{filename:o}}}function cI(t){return[90,dH(t)]}function lH(t){return parseInt(t||"",10)||void 0}function Dle(t){try{return decodeURI(t)}catch{return}}var In=class{constructor(e){this._maxSize=e,this._cache=new Map}get size(){return this._cache.size}get(e){let n=this._cache.get(e);if(n!==void 0)return this._cache.delete(e),this._cache.set(e,n),n}set(e,n){if(this._cache.size>=this._maxSize){let r=this._cache.keys().next().value;this._cache.delete(r)}this._cache.set(e,n)}remove(e){let n=this._cache.get(e);return n&&this._cache.delete(e),n}clear(){this._cache.clear()}keys(){return Array.from(this._cache.keys())}values(){let e=[];return this._cache.forEach(n=>e.push(n)),e}};var uI=K(ne(),1),yp={};function w(t,e,n){return n?rpe(t,e,n):npe(t,e)}function npe(t,e){return Object.assign(n=>{let r=yp[t];if(r)return n&&r.setConfig(n),r;let o=e(n);return yp[t]=o,(0,uI.registerInstrumentations)({instrumentations:[o]}),o},{id:t})}function rpe(t,e,n){return Object.assign(r=>{let o=n(r),s=yp[t];if(s)return s.setConfig(o),s;let i=new e(o);return yp[t]=i,(0,uI.registerInstrumentations)({instrumentations:[i]}),i},{id:t})}function Ip(t){let e=!1,n=[];if(!ope(t))e=!0;else{let o=t._wrap;t._wrap=(...s)=>(e=!0,n.forEach(i=>i()),n=[],o(...s))}return o=>{e?o():n.push(o)}}function ope(t){return typeof t._wrap=="function"}b();import{subscribe as spe}from"node:diagnostics_channel";var re=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var Um="@sentry/instrumentation-http";function _H(t,e,n,r){let o=0,s=[];re&&g.log(r,"Patching request.on");let i=new WeakMap,a=n==="small"?1e3:n==="medium"?1e4:1048576;try{t.on=new Proxy(t.on,{apply:(c,l,p)=>{let[d,_,...f]=p;if(d==="data"){re&&g.log(r,`Handling request.on("data") with maximum body size of ${a}b`);let m=new Proxy(_,{apply:(h,T,S)=>{try{let R=S[0],I=Buffer.from(R);o<a?(s.push(I),o+=I.byteLength):re&&g.log(r,`Dropping request body chunk because maximum body length of ${a}b is exceeded.`)}catch{re&&g.error(r,"Encountered error while storing body chunk.")}return Reflect.apply(h,T,S)}});return i.set(_,m),Reflect.apply(c,l,[d,m,...f])}return Reflect.apply(c,l,p)}}),t.off=new Proxy(t.off,{apply:(c,l,p)=>{let[,d]=p,_=i.get(d);if(_){i.delete(d);let f=p.slice();return f[1]=_,Reflect.apply(c,l,f)}return Reflect.apply(c,l,p)}}),t.on("end",()=>{try{let c=Buffer.concat(s).toString("utf-8");if(c){let p=Buffer.byteLength(c,"utf-8")>a?`${Buffer.from(c).subarray(0,a-3).toString("utf-8")}...`:c;e.setSDKProcessingMetadata({normalizedRequest:{data:p}})}}catch(c){re&&g.error(r,"Error building captured request body",c)}})}catch(c){re&&g.error(r,"Error patching request to capture body",c)}}var fH=Un("sentry_http_server_instrumented"),pI="Http.Server",lI=new Map,mH=new WeakSet;function hH(t,e){nt(t,"_startSpanCallback",new WeakRef(e))}var ipe=(t={})=>{let e={sessions:t.sessions??!0,sessionFlushingDelayMS:t.sessionFlushingDelayMS??6e4,maxRequestBodySize:t.maxRequestBodySize??"medium",ignoreRequestBody:t.ignoreRequestBody};return{name:pI,setupOnce(){spe("http.server.request.start",r=>{ape(r.server,e)})},afterAllSetup(n){re&&n.getIntegrationByName("Http")&&g.warn("It seems that you have manually added `httpServerIntegration` while `httpIntegration` is also present. Make sure to remove `httpServerIntegration` when adding `httpIntegration`.")}}},Op=ipe;function ape(t,{ignoreRequestBody:e,maxRequestBodySize:n,sessions:r,sessionFlushingDelayMS:o}){let s=t.emit;if(mH.has(s))return;let i=new Proxy(s,{apply(a,c,l){if(l[0]!=="request")return a.apply(c,l);let p=H();if(P.active().getValue(fH)||!p)return a.apply(c,l);re&&g.log(pI,"Handling incoming request");let d=ue().clone(),_=l[1],f=l[2],m=dp(_),h=_.ip||_.socket?.remoteAddress,T=_.url||"/";n!=="none"&&!e?.(T,_)&&_H(_,d,n,pI),d.setSDKProcessingMetadata({normalizedRequest:m,ipAddress:h});let S=(_.method||"GET").toUpperCase(),R=ko(T),I=`${S} ${R}`;return d.setTransactionName(I),r&&p&&cpe(p,{requestIsolationScope:d,response:f,sessionFlushingDelayMS:o??6e4}),Wl(d,()=>{let x={traceId:zt(),sampleRand:yt(),propagationSpanId:Kt()};he().setPropagationContext({...x}),d.setPropagationContext({...x});let F=Ar.extract(P.active(),m.headers).setValue(fH,!0);return P.with(F,()=>{p.emit("httpServerRequest",_,f,m);let B=_._startSpanCallback?.deref();return B?B(()=>a.apply(c,l)):a.apply(c,l)})})}});mH.add(i),t.emit=i}function cpe(t,{requestIsolationScope:e,response:n,sessionFlushingDelayMS:r}){e.setSDKProcessingMetadata({requestSession:{status:"ok"}}),n.once("close",()=>{let o=e.getScopeData().sdkProcessingMetadata.requestSession;if(t&&o){re&&g.log(`Recorded request session with status: ${o.status}`);let s=new Date;s.setSeconds(0,0);let i=s.toISOString(),a=lI.get(t),c=a?.[i]||{exited:0,crashed:0,errored:0};if(c[{ok:"exited",crashed:"crashed",errored:"errored"}[o.status]]++,a)a[i]=c;else{re&&g.log("Opened new request session aggregate.");let l={[i]:c};lI.set(t,l);let p=()=>{clearTimeout(_),d(),lI.delete(t);let f=Object.entries(l).map(([m,h])=>({started:m,exited:h.exited,errored:h.errored,crashed:h.crashed}));t.sendSession({aggregates:f})},d=t.on("flush",()=>{re&&g.log("Sending request session aggregate due to client flush"),p()}),_=setTimeout(()=>{re&&g.log("Sending request session aggregate due to flushing schedule"),p()},r).unref()}}})}b();var Bo=K(Te(),1);le();import{errorMonitor as upe}from"node:events";var TH="Http.ServerSpans",lpe=(t={})=>{let e=t.ignoreStaticAssets??!0,n=t.ignoreIncomingRequests,r=t.ignoreStatusCodes??[[401,404],[301,303],[305,399]],{onSpanCreated:o}=t,{requestHook:s,responseHook:i,applyCustomAttributesOnSpan:a}=t.instrumentation??{};return{name:TH,setup(c){typeof __SENTRY_TRACING__<"u"&&!__SENTRY_TRACING__||c.on("httpServerRequest",(l,p,d)=>{let _=l,f=p;hH(_,h=>{if(_pe(_,{ignoreStaticAssets:e,ignoreIncomingRequests:n}))return re&&g.log(TH,"Skipping span creation for incoming request",_.url),h();let T=d.url||_.url||"/",S=pp(T),R=_.headers,I=R["user-agent"],x=R["x-forwarded-for"],F=_.httpVersion,B=R.host,se=B?.replace(/^(.*)(:[0-9]{1,5})/,"$1")||"localhost",ve=c.tracer,on=T.startsWith("https")?"https":"http",Io=d.method||_.method?.toUpperCase()||"GET",ss=S?S.pathname:ko(T),yi=`${Io} ${ss}`,Et=ve.startSpan(yi,{kind:Ne.SERVER,attributes:{[ee]:"http.server",[W]:"auto.http.otel.http","sentry.http.prefetch":ppe(_)||void 0,"http.url":T,"http.method":d.method,"http.target":S?`${S.pathname}${S.search}`:ss,"http.host":B,"net.host.name":se,"http.client_ip":typeof x=="string"?x.split(",")[0]:void 0,"http.user_agent":I,"http.scheme":on,"http.flavor":F,"net.transport":F?.toUpperCase()==="QUIC"?"ip_udp":"ip_tcp",...fpe(_),...lm(d.headers||{},c.getOptions().sendDefaultPii??!1)}});s?.(Et,_),i?.(Et,f),a?.(Et,_,f),o?.(Et,_,f);let $a={type:Bo.RPCType.HTTP,span:Et};return P.with((0,Bo.setRPCMetadata)(X.setSpan(P.active(),Et),$a),()=>{P.bind(P.active(),_),P.bind(P.active(),f);let Ya=!1;function DC(r_){if(Ya)return;Ya=!0;let UC=Tpe(_,f);Et.setAttributes(UC),Et.setStatus(r_),Et.end();let wC=UC["http.route"];wC&&ue().setTransactionName(`${_.method?.toUpperCase()||"GET"} ${wC}`)}return f.on("close",()=>{DC(Do(f.statusCode))}),f.on(upe,()=>{let r_=Do(f.statusCode);DC(r_.code===2?r_:{code:2})}),h()})})})},processEvent(c){if(c.type==="transaction"){let l=c.contexts?.trace?.data?.["http.response.status_code"];if(typeof l=="number"&&Epe(l,r))return re&&g.log("Dropping transaction due to status code",l),null}return c},afterAllSetup(c){re&&(c.getIntegrationByName("Http")&&g.warn("It seems that you have manually added `httpServerSpansIntergation` while `httpIntegration` is also present. Make sure to remove `httpIntegration` when adding `httpServerSpansIntegration`."),c.getIntegrationByName("Http.Server")||g.error("It seems that you have manually added `httpServerSpansIntergation` without adding `httpServerIntegration`. This is a requiement for spans to be created - please add the `httpServerIntegration` integration."))}}},Np=lpe;function ppe(t){return t.headers["next-router-prefetch"]==="1"}function dpe(t){let e=ko(t);return!!(e.match(/\.(ico|png|jpg|jpeg|gif|svg|css|js|woff|woff2|ttf|eot|webp|avif)$/)||e.match(/^\/(robots\.txt|sitemap\.xml|manifest\.json|browserconfig\.xml)$/))}function _pe(t,{ignoreStaticAssets:e,ignoreIncomingRequests:n}){if((0,Bo.isTracingSuppressed)(P.active()))return!0;let r=t.url,o=t.method?.toUpperCase();return!!(o==="OPTIONS"||o==="HEAD"||!r||e&&o==="GET"&&dpe(r)||n?.(r,t))}function fpe(t){let e=mpe(t.headers);return e==null?{}:hpe(t.headers)?{"http.request_content_length":e}:{"http.request_content_length_uncompressed":e}}function mpe(t){let e=t["content-length"];if(e===void 0)return null;let n=parseInt(e,10);return isNaN(n)?null:n}function hpe(t){let e=t["content-encoding"];return!!e&&e!=="identity"}function Tpe(t,e){let{socket:n}=t,{statusCode:r,statusMessage:o}=e,s={[bo]:r,[Pi]:r,"http.status_text":o?.toUpperCase()},i=(0,Bo.getRPCMetadata)(P.active());if(n){let{localAddress:a,localPort:c,remoteAddress:l,remotePort:p}=n;s[Zg]=a,s[eA]=c,s[Jg]=l,s["net.peer.port"]=p}if(s[Pi]=r,s["http.status_text"]=(o||"").toUpperCase(),i?.type===Bo.RPCType.HTTP&&i.route!==void 0){let a=i.route;s[Co]=a}return s}function Epe(t,e){return e.some(n=>{if(typeof n=="number")return n===t;let[r,o]=n;return t>=r&&t<=o})}b();var AH=K(Te(),1),Cp=K(ne(),1);le();import{subscribe as dI,unsubscribe as _I}from"node:diagnostics_channel";import{errorMonitor as gH}from"node:events";function bp(t,e){if(!t)return e;let n=Vi(t),r=Vi(e);if(!r)return t;let o={},s={};for(let[c,l]of Object.entries(r))c.startsWith(Xr)?o[c]=l:s[c]=l;let i=Object.keys(o).length>0,a={};if(n)for(let[c,l]of Object.entries(n))i&&c.startsWith(Xr)||(a[c]=l);Object.assign(a,o);for(let[c,l]of Object.entries(s))a[c]||(a[c]=l);return Bf(a)}var Wc="@sentry/instrumentation-http";function EH(t,e){let n=Spe(t),r=e?.statusCode,o=Ap(r);rr({category:"http",data:{status_code:r,...n},type:"http",level:o},{event:"response",request:t,response:e})}function wm(t,e){let n=km(t),{tracePropagationTargets:r,propagateTraceparent:o}=H()?.getOptions()||{},s=Qi(n,r,e)?kc({propagateTraceparent:o}):void 0;if(!s)return;let{"sentry-trace":i,baggage:a,traceparent:c}=s;if(!t.getHeader("sentry-trace")){if(i)try{t.setHeader("sentry-trace",i),re&&g.log(Wc,"Added sentry-trace header to outgoing request")}catch(p){re&&g.error(Wc,"Failed to add sentry-trace header to outgoing request:",Kr(p)?p.message:"Unknown error")}if(c&&!t.getHeader("traceparent"))try{t.setHeader("traceparent",c),re&&g.log(Wc,"Added traceparent header to outgoing request")}catch(p){re&&g.error(Wc,"Failed to add traceparent header to outgoing request:",Kr(p)?p.message:"Unknown error")}if(a){let p=t.getHeader("baggage"),d=bp(p,a);if(d)try{t.setHeader("baggage",d),re&&g.log(Wc,"Added baggage header to outgoing request")}catch(_){re&&g.error(Wc,"Failed to add baggage header to outgoing request:",Kr(_)?_.message:"Unknown error")}}}}function Spe(t){try{let e=t.getHeader("host")||t.host,n=new URL(t.path,`${t.protocol}//${e}`),r=bs(n.toString()),o={url:Cs(r),"http.method":t.method||"GET"};return r.search&&(o["http.query"]=r.search),r.hash&&(o["http.fragment"]=r.hash),o}catch{return{}}}function SH(t){return{method:t.method,protocol:t.protocol,host:t.host,hostname:t.host,path:t.path,headers:t.getHeaders()}}function km(t){let e=t.getHeader("host")||t.host,n=t.protocol,r=t.path;return`${n}//${e}${r}`}var ra=class extends Cp.InstrumentationBase{constructor(e={}){super(Um,pe,e),this._propagationDecisionMap=new In(100),this._ignoreOutgoingRequestsMap=new WeakMap}init(){let e=!1,n=a=>{let c=a;this._onOutgoingRequestFinish(c.request,c.response)},r=a=>{let c=a;this._onOutgoingRequestFinish(c.request,void 0)},o=a=>{let c=a;this._onOutgoingRequestCreated(c.request)},s=a=>(e||(e=!0,dI("http.client.response.finish",n),dI("http.client.request.error",r),(this.getConfig().propagateTraceInOutgoingRequests||this.getConfig().createSpansForOutgoingRequests)&&dI("http.client.request.created",o)),a),i=()=>{_I("http.client.response.finish",n),_I("http.client.request.error",r),_I("http.client.request.created",o)};return[new Cp.InstrumentationNodeModuleDefinition("http",["*"],s,i),new Cp.InstrumentationNodeModuleDefinition("https",["*"],s,i)]}_startSpanForOutgoingRequest(e){let n=e.once,[r,o]=gpe(e),s=Xf({name:r,attributes:o,onlyIfParent:!0});this.getConfig().outgoingRequestHook?.(s,e);let i=new Proxy(n,{apply(l,p,d){let[_]=d;if(_!=="response")return l.apply(p,d);let f=P.active(),m=X.setSpan(f,s);return P.with(m,()=>l.apply(p,d))}});e.once=i;let a=!1,c=l=>{a||(a=!0,s.setStatus(l),s.end())};return e.prependListener("response",l=>{e.listenerCount("response")<=1&&l.resume(),P.bind(P.active(),l);let p=Ape(l);s.setAttributes(p),this.getConfig().outgoingResponseHook?.(s,l),this.getConfig().outgoingRequestApplyCustomAttributes?.(s,e,l);let d=(_=!1)=>{this._diag.debug("outgoingRequest on end()");let f=_||typeof l.statusCode!="number"||l.aborted&&!l.complete?{code:Be.ERROR}:Do(l.statusCode);c(f)};l.on("end",()=>{d()}),l.on(gH,_=>{this._diag.debug("outgoingRequest on response error()",_),d(!0)})}),e.on("close",()=>{c({code:Be.UNSET})}),e.on(gH,l=>{this._diag.debug("outgoingRequest on request error()",l),c({code:Be.ERROR})}),s}_onOutgoingRequestFinish(e,n){re&&g.log(Um,"Handling finished outgoing request");let r=this.getConfig().breadcrumbs,o=typeof r>"u"?!0:r,s=this._ignoreOutgoingRequestsMap.get(e)??this._shouldIgnoreOutgoingRequest(e);this._ignoreOutgoingRequestsMap.set(e,s),o&&!s&&EH(e,n)}_onOutgoingRequestCreated(e){re&&g.log(Um,"Handling outgoing request created");let n=this._ignoreOutgoingRequestsMap.get(e)??this._shouldIgnoreOutgoingRequest(e);if(this._ignoreOutgoingRequestsMap.set(e,n),n)return;let r=this.getConfig().createSpansForOutgoingRequests&&(this.getConfig().spans??!0),o=this.getConfig().propagateTraceInOutgoingRequests;if(r){let s=this._startSpanForOutgoingRequest(e);if(o&&s.isRecording()){let i=X.setSpan(P.active(),s);P.with(i,()=>{wm(e,this._propagationDecisionMap)})}else o&&wm(e,this._propagationDecisionMap)}else o&&wm(e,this._propagationDecisionMap)}_shouldIgnoreOutgoingRequest(e){if((0,AH.isTracingSuppressed)(P.active()))return!0;let n=this.getConfig().ignoreOutgoingRequests;if(!n)return!1;let r=SH(e),o=km(e);return n(o,r)}};function gpe(t){let e=km(t),[n,r]=Oy(pp(e),"client","auto.http.otel.http",t),o=t.getHeader("user-agent");return[n,{[ee]:"http.client","otel.kind":"CLIENT",[RA]:o,[cs]:e,"http.url":e,"http.method":t.method,"http.target":t.path||"/","net.peer.name":t.host,"http.host":t.getHeader("host"),...r}]}function Ape(t){let{statusCode:e,statusMessage:n,httpVersion:r,socket:o}=t,s=r.toUpperCase()!=="QUIC"?"ip_tcp":"ip_udp",i={[bo]:e,[hA]:r,"http.flavor":r,[TA]:s,"net.transport":s,"http.status_text":n?.toUpperCase(),"http.status_code":e,...Rpe(t)};if(o){let{remoteAddress:a,remotePort:c}=o;i[fA]=a,i[mA]=c,i["net.peer.ip"]=a,i["net.peer.port"]=c}return i}function Rpe(t){let e=ype(t.headers);return e==null?{}:Ipe(t.headers)?{[nA]:e}:{[rA]:e}}function ype(t){let e=t["content-length"];if(typeof e=="number")return e;if(typeof e!="string")return;let n=parseInt(e,10);if(!isNaN(n))return n}function Ipe(t){let e=t["content-encoding"];return!!e&&e!=="identity"}var RH="Http",Ope=w(`${RH}.sentry`,t=>new ra(t)),yH=(t={})=>{let e={sessions:t.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:t.sessionFlushingDelayMS,ignoreRequestBody:t.ignoreIncomingRequestBody,maxRequestBodySize:t.maxIncomingRequestBodySize},n={ignoreIncomingRequests:t.ignoreIncomingRequests,ignoreStaticAssets:t.ignoreStaticAssets,ignoreStatusCodes:t.dropSpansForIncomingRequestStatusCodes},r={breadcrumbs:t.breadcrumbs,propagateTraceInOutgoingRequests:t.tracePropagation??!0,ignoreOutgoingRequests:t.ignoreOutgoingRequests},o=Op(e),s=Np(n),i=t.spans??!1,a=t.disableIncomingRequestSpans??!1,c=i&&!a;return{name:RH,setup(l){c&&s.setup(l)},setupOnce(){o.setupOnce(),Ope(r)},processEvent(l){return s.processEvent(l)}}};b();var NH=K(Te(),1),bH=K(ne(),1);import*as zc from"diagnostics_channel";var Lr=BR(process.versions.node),jo=Lr.major,Pp=Lr.minor;var fI="sentry-trace",Gm="baggage",Npe="traceparent";function IH(t,e){let n=Bm(t.origin,t.path),{tracePropagationTargets:r,propagateTraceparent:o}=H()?.getOptions()||{},s=Qi(n,r,e)?kc({propagateTraceparent:o}):void 0;if(!s)return;let{"sentry-trace":i,baggage:a,traceparent:c}=s,l=Array.isArray(t.headers)?t.headers:bpe(t.headers);if(mI(l,fI),mI(l,Gm),o&&mI(l,Npe),!(hI(l,fI)!==-1)){i&&l.push(fI,i),c&&hI(l,"traceparent")===-1&&l.push("traceparent",c);let d=hI(l,Gm);if(a&&d===-1)l.push(Gm,a);else if(a){let _=l[d+1],f=bp(_,a);f&&(l[d+1]=f)}}Array.isArray(t.headers)||(t.headers=Cpe(l))}function bpe(t){let e=t.split(`\r
28
+ `),n=[];for(let r of e)try{let o=r.indexOf(":");if(o===-1)continue;let s=r.slice(0,o).trim(),i=r.slice(o+1).trim();s&&n.push(s,i)}catch{g.warn(`Failed to convert string request header to array header: ${r}`)}return n}function Cpe(t){let e=[];for(let n=0;n<t.length;n+=2){let r=t[n],o=t[n+1];!r||o==null||e.push(`${r}: ${o}`)}return e.length?e.join(`\r
29
+ `).concat(`\r
30
+ `):""}function mI(t,e){let n=-1;for(let r=0;r<t.length;r+=2){if(t[r]!==e)continue;if(n===-1){n=r;continue}let o=t[n+1];if(e===Gm&&o){let s=bp(t[r+1],o);s&&(t[n+1]=s)}t.splice(r,2),r-=2}}function hI(t,e){return t.findIndex((n,r)=>r%2===0&&n===e)}function OH(t,e){let n=Ppe(t),r=e.statusCode,o=Ap(r);rr({category:"http",data:{status_code:r,...n},type:"http",level:o},{event:"response",request:t,response:e})}function Ppe(t){try{let e=Bm(t.origin,t.path),n=bs(e),r={url:Cs(n),"http.method":t.method||"GET"};return n.search&&(r["http.query"]=n.search),n.hash&&(r["http.fragment"]=n.hash),r}catch{return{}}}function Bm(t,e="/"){try{return new URL(e,t).toString()}catch{let n=`${t}`;return n.endsWith("/")&&e.startsWith("/")?`${n}${e.slice(1)}`:!n.endsWith("/")&&!e.startsWith("/")?`${n}/${e}`:`${n}${e}`}}var oa=class extends bH.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-node-fetch",pe,e),this._channelSubs=[],this._propagationDecisionMap=new In(100),this._ignoreOutgoingRequestsMap=new WeakMap}init(){}disable(){super.disable(),this._channelSubs.forEach(e=>e.unsubscribe()),this._channelSubs=[]}enable(){super.enable(),this._channelSubs=this._channelSubs||[],!(this._channelSubs.length>0)&&(this._subscribeToChannel("undici:request:create",this._onRequestCreated.bind(this)),this._subscribeToChannel("undici:request:headers",this._onResponseHeaders.bind(this)))}_onRequestCreated({request:e}){let n=this.getConfig();if(!(n.enabled!==!1))return;let o=this._shouldIgnoreOutgoingRequest(e);this._ignoreOutgoingRequestsMap.set(e,o),!o&&n.tracePropagation!==!1&&IH(e,this._propagationDecisionMap)}_onResponseHeaders({request:e,response:n}){let r=this.getConfig();if(!(r.enabled!==!1))return;let s=r.breadcrumbs,i=typeof s>"u"?!0:s,a=this._ignoreOutgoingRequestsMap.get(e);i&&!a&&OH(e,n)}_subscribeToChannel(e,n){let r=jo>18||jo===18&&Pp>=19,o;if(r)zc.subscribe?.(e,n),o=()=>zc.unsubscribe?.(e,n);else{let s=zc.channel(e);s.subscribe(n),o=()=>s.unsubscribe(n)}this._channelSubs.push({name:e,unsubscribe:o})}_shouldIgnoreOutgoingRequest(e){if((0,NH.isTracingSuppressed)(P.active()))return!0;let n=Bm(e.origin,e.path),r=this.getConfig().ignoreOutgoingRequests;return typeof r!="function"||!n?!1:r(n)}};var Mpe="NodeFetch",xpe=w(`${Mpe}.sentry`,oa,t=>t),vpe=(t={})=>({name:"NodeFetch",setupOnce(){xpe(t)}}),CH=vpe;var lV=K(xH(),1);le();b();b();var dn=K(Te(),1),Bs=K(iO(),1),mO="sentry.parentIsRemote",au="sentry.graphql.operation";function hO(t){if("parentSpanId"in t)return t.parentSpanId;if("parentSpanContext"in t)return t.parentSpanContext?.spanId}function TO(t){let e=t;return!!e.attributes&&typeof e.attributes=="object"}function g_e(t){return typeof t.kind=="number"}function A_e(t){return!!t.status}function DF(t){return!!t.name}function R_e(t){if(!TO(t))return{};let e=t.attributes[cs]||t.attributes[Za],n={url:e,"http.method":t.attributes[xi]||t.attributes[bl]};!n["http.method"]&&n.url&&(n["http.method"]="GET");try{if(typeof e=="string"){let r=bs(e);n.url=Cs(r),r.search&&(n["http.query"]=r.search),r.hash&&(n["http.fragment"]=r.hash)}}catch{}return n}function y_e(t){return g_e(t)?t.kind:Ne.INTERNAL}var Uh="sentry-trace",aO="baggage",EO="sentry.dsc",SO="sentry.sampled_not_recording",UF="sentry.url",I_e="sentry.sample_rand",O_e="sentry.sample_rate",gO=Un("sentry_scopes"),cO=Un("sentry_fork_isolation_scope"),uO=Un("sentry_fork_set_scope"),lO=Un("sentry_fork_set_isolation_scope"),wF="_scopeContext";function cu(t){return t.getValue(gO)}function kF(t,e){return t.setValue(gO,e)}function N_e(t,e){nt(t,wF,e)}function Gp(t){return t[wF]}function iu(t){let{traceFlags:e,traceState:n}=t,r=n?n.get(SO)==="1":!1;if(e===Vt.SAMPLED)return!0;if(r)return!1;let o=n?n.get(EO):void 0,s=o?Uo(o):void 0;if(s?.sampled==="true")return!0;if(s?.sampled==="false")return!1}function GF(t,e,n){let r=e[xi]||e[bl];if(r)return C_e({attributes:e,name:t,kind:n},r);let o=e[Mi]||e[Kg],s=typeof e[ee]=="string"&&e[ee].startsWith("cache.");if(o&&!s)return b_e({attributes:e,name:t});let i=e[Ue]==="custom"?"custom":"route";if(e[iA])return{...kp(t,e,"route"),op:"rpc"};if(e[sA])return{...kp(t,e,i),op:"message"};let l=e[Xg];return l?{...kp(t,e,i),op:l.toString()}:{op:void 0,description:t,source:"custom"}}function BF(t){let e=TO(t)?t.attributes:{},n=DF(t)?t.name:"<unknown>",r=y_e(t);return GF(n,e,r)}function b_e({attributes:t,name:e}){let n=t[tr];if(typeof n=="string")return{op:"db",description:n,source:t[Ue]||"custom"};if(t[Ue]==="custom")return{op:"db",description:e,source:"custom"};let r=t[Qg];return{op:"db",description:r?r.toString():e,source:"task"}}function C_e({name:t,kind:e,attributes:n},r){let o=["http"];switch(e){case Ne.CLIENT:o.push("client");break;case Ne.SERVER:o.push("server");break}n["sentry.http.prefetch"]&&o.push("prefetch");let{urlPath:s,url:i,query:a,fragment:c,hasRoute:l}=M_e(n,e);if(!s)return{...kp(t,n),op:o.join(".")};let p=n[au],d=`${r} ${s}`,_=p?`${d} (${P_e(p)})`:d,f=l||s==="/"?"route":"url",m={};i&&(m.url=i),a&&(m["http.query"]=a),c&&(m["http.fragment"]=c);let h=e===Ne.CLIENT||e===Ne.SERVER,S=!`${n[W]||"manual"}`.startsWith("auto"),R=n[Ue]==="custom",I=n[tr],x=!R&&I==null&&(h||!S),{description:F,source:B}=x?{description:_,source:f}:kp(t,n);return{op:o.join("."),description:F,source:B,data:m}}function P_e(t){if(Array.isArray(t)){let e=t.slice().sort();return e.length<=5?e.join(", "):`${e.slice(0,5).join(", ")}, +${e.length-5}`}return`${t}`}function M_e(t,e){let n=t[tA],r=t[Za]||t[cs],o=t[Co],s=typeof r=="string"?bs(r):void 0,i=s?Cs(s):void 0,a=s?.search||void 0,c=s?.hash||void 0;return typeof o=="string"?{urlPath:o,url:i,query:a,fragment:c,hasRoute:!0}:e===Ne.SERVER&&typeof n=="string"?{urlPath:ko(n),url:i,query:a,fragment:c,hasRoute:!1}:s?{urlPath:i,url:i,query:a,fragment:c,hasRoute:!1}:typeof n=="string"?{urlPath:ko(n),url:i,query:a,fragment:c,hasRoute:!1}:{urlPath:void 0,url:i,query:a,fragment:c,hasRoute:!1}}function kp(t,e,n="custom"){let r=e[Ue]||n,o=e[tr];return o&&typeof o=="string"?{description:o,source:r}:{description:t,source:r}}function jF(t){t.on("createDsc",(e,n)=>{if(!n)return;let s=Y(n).data[Ue],{description:i}=DF(n)?BF(n):{description:void 0};if(s!=="url"&&i&&(e.transaction=i),Xe()){let a=iu(n.spanContext());e.sampled=a==null?void 0:String(a)}})}function HF(){return X.getActiveSpan()}var js=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function FF({dsc:t,sampled:e}){let n=t?Fi(t):void 0,r=new dn.TraceState,o=n?r.set(EO,n):r;return e===!1?o.set(SO,"1"):o}var VF=new Set;function qF(){return Array.from(VF)}function Bh(t){VF.add(t)}var wh=class extends dn.W3CBaggagePropagator{constructor(){super(),Bh("SentryPropagator"),this._urlMatchesTargetsMap=new In(100)}inject(e,n,r){if((0,dn.isTracingSuppressed)(e)){js&&g.log("[Tracing] Not injecting trace data for url because tracing is suppressed.");return}let o=X.getSpan(e),s=o&&D_e(o),{tracePropagationTargets:i,propagateTraceparent:a}=H()?.getOptions()||{};if(!Qi(s,i,this._urlMatchesTargetsMap)){js&&g.log("[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:",s);return}let c=v_e(n),l=L_e(n),p=Ar.getBaggage(e)||Ar.createBaggage({}),{dynamicSamplingContext:d,traceId:_,spanId:f,sampled:m}=$F(e);if(c){let h=Vi(c);h&&Object.entries(h).forEach(([T,S])=>{!l&&T.startsWith(Xr)||(p=p.setEntry(T,{value:S}))})}!l&&d&&(p=Object.entries(d).reduce((h,[T,S])=>S?h.setEntry(`${Xr}${T}`,{value:S}):h,p)),!l&&_&&_!==Ni&&(r.set(n,Uh,Rs(_,f,m)),a&&r.set(n,"traceparent",ys(_,f,m))),super.inject(Ar.setBaggage(e,p),n,r)}extract(e,n,r){let o=r.get(n,Uh),s=r.get(n,aO),i=o?Array.isArray(o)?o[0]:o:void 0;return WF(YF(e,{sentryTrace:i,baggage:s}))}fields(){return[Uh,aO,"traceparent"]}};function $F(t,e={}){let n=X.getSpan(t);if(n?.spanContext().isRemote){let a=n.spanContext();return{dynamicSamplingContext:Je(n),traceId:a.traceId,spanId:void 0,sampled:iu(a)}}if(n){let a=n.spanContext();return{dynamicSamplingContext:Je(n),traceId:a.traceId,spanId:a.spanId,sampled:iu(a)}}let r=e.scope||cu(t)?.scope||he(),o=e.client||H(),s=r.getPropagationContext();return{dynamicSamplingContext:o?Jr(o,r):void 0,traceId:s.traceId,spanId:s.propagationSpanId,sampled:s.sampled}}function YF(t,{sentryTrace:e,baggage:n}){let r=Kl(e,n),{traceId:o,parentSpanId:s,sampled:i,dsc:a}=r,c=H(),l=Uo(n);if(!s||c&&!JR(c,l?.org_id))return t;let p=U_e({traceId:o,spanId:s,sampled:i,dsc:a});return X.setSpanContext(t,p)}function x_e(t,e,n){let r=WF(YF(t,e));return P.with(r,n)}function WF(t){let e=cu(t),n={scope:e?e.scope:he().clone(),isolationScope:e?e.isolationScope:ue()};return kF(t,n)}function v_e(t){try{let e=t[aO];return Array.isArray(e)?e.join(","):e}catch{return}}function L_e(t){try{return t[Uh]}catch{return}}function D_e(t){let e=Y(t).data,n=e[Za]||e[cs];if(typeof n=="string")return n;let r=t.spanContext().traceState?.get(UF);if(r)return r}function U_e({spanId:t,traceId:e,sampled:n,dsc:r}){let o=FF({dsc:r,sampled:n});return{traceId:e,spanId:t,isRemote:!0,traceFlags:n?Vt.SAMPLED:Vt.NONE,traceState:o}}function zF(t,e,n){let r=QF(),{name:o,parentSpan:s}=t;return tV(s)(()=>{let a=ZF(t.scope,t.forceTransaction),l=t.onlyIfParent&&!X.getSpan(a)?(0,dn.suppressTracing)(a):a,p=XF(t);if(!Xe()){let d=(0,dn.isTracingSuppressed)(l)?l:(0,dn.suppressTracing)(l);return P.with(d,()=>r.startActiveSpan(o,p,d,_=>(pO(_),P.with(a,()=>Mr(()=>e(_),()=>{Y(_).status===void 0&&_.setStatus({code:Be.ERROR})},n?()=>_.end():void 0)))))}return r.startActiveSpan(o,p,l,d=>(pO(d),Mr(()=>e(d),()=>{Y(d).status===void 0&&d.setStatus({code:Be.ERROR})},n?()=>d.end():void 0)))})}function w_e(t,e){return zF(t,e,!0)}function k_e(t,e){return zF(t,n=>e(n,()=>n.end()),!1)}function G_e(t){let e=QF(),{name:n,parentSpan:r}=t;return tV(r)(()=>{let s=ZF(t.scope,t.forceTransaction),a=t.onlyIfParent&&!X.getSpan(s)?(0,dn.suppressTracing)(s):s,c=XF(t);Xe()||(a=(0,dn.isTracingSuppressed)(a)?a:(0,dn.suppressTracing)(a));let l=e.startSpan(n,c,a);return pO(l),l})}function KF(t,e){let n=t?X.setSpan(P.active(),t):X.deleteSpan(P.active());return P.with(n,()=>e(he()))}function QF(){return H()?.tracer||X.getTracer("@sentry/opentelemetry",pe)}function XF(t){let{startTime:e,attributes:n,kind:r,op:o,links:s}=t,i=typeof e=="number"?JF(e):e;return{attributes:o?{[ee]:o,...n}:n,kind:r,links:s,startTime:i}}function JF(t){return t<9999999999?t*1e3:t}function pO(t){let e=t.end.bind(t);t.end=n=>e(typeof n=="number"?JF(n):n)}function ZF(t,e){let n=B_e(t),r=X.getSpan(n);if(!r||!e)return n;let o=X.deleteSpan(n),{spanId:s,traceId:i}=r.spanContext(),a=iu(r.spanContext()),c=je(r),l=Je(c),p=FF({dsc:l,sampled:a}),d={traceId:i,spanId:s,isRemote:!0,traceFlags:a?Vt.SAMPLED:Vt.NONE,traceState:p};return X.setSpanContext(o,d)}function B_e(t){if(t){let e=Gp(t);if(e)return e}return P.active()}function j_e(t,e){return x_e(P.active(),t,e)}function H_e(t){let e=zt(),n=Kt(),r={traceId:e,spanId:n,isRemote:!0,traceFlags:Vt.NONE},o=X.setSpanContext(P.active(),r);return P.with(o,()=>(he().setPropagationContext({traceId:e,sampleRand:yt()}),t()))}function eV(t,e){let n=Gp(e),r=n&&X.getSpan(n),o=r?Is(r):Hi(e);return[r?Je(r):Jr(t,e),o]}function tV(t){return t!==void 0?e=>KF(t,e):e=>e()}function F_e(t){let e=(0,dn.suppressTracing)(P.active());return P.with(e,t)}function nV(t){t.on("preprocessEvent",e=>{let n=HF();if(!n||e.type==="transaction")return;e.contexts={trace:Is(n),...e.contexts};let r=je(n);return e.sdkProcessingMetadata={dynamicSamplingContext:Je(r),...e.sdkProcessingMetadata},e})}function V_e({span:t,scope:e,client:n,propagateTraceparent:r}={}){let o=(e&&Gp(e))??P.active();if(t){let{scope:p}=br(t);o=p&&Gp(p)||X.setSpan(P.active(),t)}let{traceId:s,spanId:i,sampled:a,dynamicSamplingContext:c}=$F(o,{scope:e,client:n}),l={"sentry-trace":Rs(s,i,a),baggage:Fi(c)};return r&&(l.traceparent=ys(s,i,a)),l}function rV(){function t(){let a=P.active(),c=cu(a);return c||{scope:yc(),isolationScope:er()}}function e(a){let c=P.active();return P.with(c,()=>a(s()))}function n(a,c){let l=Gp(a)||P.active();return P.with(l.setValue(uO,a),()=>c(a))}function r(a){let c=P.active();return P.with(c.setValue(cO,!0),()=>a(i()))}function o(a,c){let l=P.active();return P.with(l.setValue(lO,a),()=>c(i()))}function s(){return t().scope}function i(){return t().isolationScope}FR({withScope:e,withSetScope:n,withSetIsolationScope:o,withIsolationScope:r,getCurrentScope:s,getIsolationScope:i,startSpan:w_e,startSpanManual:k_e,startInactiveSpan:G_e,getActiveSpan:HF,suppressTracing:F_e,getTraceData:V_e,continueTrace:j_e,startNewTrace:H_e,withActiveSpan:KF})}function oV(t){class e extends t{constructor(...r){super(...r),Bh("SentryContextManager")}with(r,o,s,...i){let a=cu(r),c=a?.scope||he(),l=a?.isolationScope||ue(),p=r.getValue(cO)===!0,d=r.getValue(uO),_=r.getValue(lO),f=d||c.clone(),m=_||(p?l.clone():l),S=kF(r,{scope:f,isolationScope:m}).deleteValue(cO).deleteValue(uO).deleteValue(lO);return N_e(f,S),super.with(S,o,s,...i)}getAsyncLocalStorageLookup(){return{asyncLocalStorage:this._asyncLocalStorage,contextSymbol:gO}}}return e}function q_e(t){let e=new Map;for(let n of t)$_e(e,n);return Array.from(e,function([n,r]){return r})}function sV(t){return t.attributes[mO]===!0?void 0:hO(t)}function $_e(t,e){let n=e.spanContext().spanId,r=sV(e);if(!r){dO(t,{id:n,span:e,children:[]});return}let o=Y_e(t,r),s=dO(t,{id:n,span:e,parentNode:o,children:[]});o.children.push(s)}function Y_e(t,e){let n=t.get(e);return n||dO(t,{id:e,children:[]})}function dO(t,e){let n=t.get(e.id);return n?.span?n:n&&!n.span?(n.span=e.span,n.parentNode=e.parentNode,n):(t.set(e.id,e),e)}var iV={1:"cancelled",2:"unknown_error",3:"invalid_argument",4:"deadline_exceeded",5:"not_found",6:"already_exists",7:"permission_denied",8:"resource_exhausted",9:"failed_precondition",10:"aborted",11:"out_of_range",12:"unimplemented",13:"internal_error",14:"unavailable",15:"data_loss",16:"unauthenticated"},W_e=t=>Object.values(iV).includes(t);function aV(t){let e=TO(t)?t.attributes:{},n=A_e(t)?t.status:void 0;if(n){if(n.code===Be.OK)return{code:1};if(n.code===Be.ERROR){if(typeof n.message>"u"){let o=xF(e);if(o)return o}return n.message&&W_e(n.message)?{code:2,message:n.message}:{code:2,message:"internal_error"}}}let r=xF(e);return r||(n?.code===Be.UNSET?{code:1}:{code:2,message:"unknown_error"})}function xF(t){let e=t[bo]||t[Pi],n=t[aA],r=typeof e=="number"?e:typeof e=="string"?parseInt(e):void 0;if(typeof r=="number")return Do(r);if(typeof n=="string")return{code:2,message:iV[n]||"unknown_error"}}var vF=1e3,LF=300,_O=class{constructor(e){this._finishedSpanBucketSize=e?.timeout||LF,this._finishedSpanBuckets=new Array(this._finishedSpanBucketSize).fill(void 0),this._lastCleanupTimestampInS=Math.floor(Zn()/1e3),this._spansToBucketEntry=new WeakMap,this._sentSpans=new Map,this._debouncedFlush=Ny(this.flush.bind(this),1,{maxWait:100})}export(e){let n=Math.floor(Zn()/1e3);if(this._lastCleanupTimestampInS!==n){let i=0;this._finishedSpanBuckets.forEach((a,c)=>{a&&a.timestampInS<=n-this._finishedSpanBucketSize&&(i+=a.spans.size,this._finishedSpanBuckets[c]=void 0)}),i>0&&js&&g.log(`SpanExporter dropped ${i} spans because they were pending for more than ${this._finishedSpanBucketSize} seconds.`),this._lastCleanupTimestampInS=n}let r=n%this._finishedSpanBucketSize,o=this._finishedSpanBuckets[r]||{timestampInS:n,spans:new Set};this._finishedSpanBuckets[r]=o,o.spans.add(e),this._spansToBucketEntry.set(e,o);let s=sV(e);(!s||this._sentSpans.has(s))&&this._debouncedFlush()}flush(){let e=this._finishedSpanBuckets.flatMap(i=>i?Array.from(i.spans):[]);this._flushSentSpanCache();let n=this._maybeSend(e),r=n.size,o=e.length-r;js&&g.log(`SpanExporter exported ${r} spans, ${o} spans are waiting for their parent spans to finish`);let s=Zn()+LF*1e3;for(let i of n){this._sentSpans.set(i.spanContext().spanId,s);let a=this._spansToBucketEntry.get(i);a&&a.spans.delete(i)}this._debouncedFlush.cancel()}clear(){this._finishedSpanBuckets=this._finishedSpanBuckets.fill(void 0),this._sentSpans.clear(),this._debouncedFlush.cancel()}_maybeSend(e){let n=q_e(e),r=new Set,o=this._getCompletedRootNodes(n);for(let s of o){let i=s.span;r.add(i);let a=K_e(i);if(s.parentNode&&this._sentSpans.has(s.parentNode.id)){let p=a.contexts?.trace?.data;p&&(p["sentry.parent_span_already_sent"]=!0)}let c=a.spans||[];for(let p of s.children)fO(p,c,r);a.spans=c.length>vF?c.sort((p,d)=>p.start_timestamp-d.start_timestamp).slice(0,vF):c;let l=Yi(i.events);l&&(a.measurements=l),em(a)}return r}_flushSentSpanCache(){let e=Zn();for(let[n,r]of this._sentSpans.entries())r<=e&&this._sentSpans.delete(n)}_nodeIsCompletedRootNodeOrHasSentParent(e){return!!e.span&&(!e.parentNode||this._sentSpans.has(e.parentNode.id))}_getCompletedRootNodes(e){return e.filter(n=>this._nodeIsCompletedRootNodeOrHasSentParent(n))}};function z_e(t){let e=t.attributes,n=e[W],r=e[ee],o=e[Ue];return{origin:n,op:r,source:o}}function K_e(t){let{op:e,description:n,data:r,origin:o="manual",source:s}=cV(t),i=br(t),a=t.attributes[Nr],c={[Ue]:s,[Nr]:a,[ee]:e,[W]:o,...r,...uV(t.attributes)},{links:l}=t,{traceId:p,spanId:d}=t.spanContext(),_=hO(t),f=aV(t),m={parent_span_id:_,span_id:d,trace_id:p,data:c,origin:o,op:e,status:$i(f),links:qi(l)},h=c[bo],T=typeof h=="number"?{response:{status_code:h}}:void 0;return{contexts:{trace:m,otel:{resource:t.resource.attributes},...T},spans:[],start_timestamp:Rn(t.startTime),timestamp:Rn(t.endTime),transaction:n,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:i.scope,capturedSpanIsolationScope:i.isolationScope,sampleRate:a,dynamicSamplingContext:Je(t)},...s&&{transaction_info:{source:s}}}}function fO(t,e,n){let r=t.span;if(r&&n.add(r),!r){t.children.forEach(I=>{fO(I,e,n)});return}let s=r.spanContext().spanId,i=r.spanContext().traceId,a=hO(r),{attributes:c,startTime:l,endTime:p,links:d}=r,{op:_,description:f,data:m,origin:h="manual"}=cV(r),T={[W]:h,[ee]:_,...uV(c),...m},S=aV(r),R={span_id:s,trace_id:i,data:T,description:f,parent_span_id:a,start_timestamp:Rn(l),timestamp:Rn(p)||void 0,status:$i(S),op:_,origin:h,measurements:Yi(r.events),links:qi(d)};e.push(R),t.children.forEach(I=>{fO(I,e,n)})}function cV(t){let{op:e,source:n,origin:r}=z_e(t),{op:o,description:s,source:i,data:a}=BF(t),c=e||o,l=n||i,p={...a,...Q_e(t)};return{op:c,description:s,source:l,origin:r,data:p}}function uV(t){let e={...t};return delete e[Nr],delete e[mO],delete e[tr],e}function Q_e(t){let e=t.attributes,n={};t.kind!==Ne.INTERNAL&&(n["otel.kind"]=Ne[t.kind]);let r=e[Pi];r&&(n[bo]=r);let o=R_e(t);return o.url&&(n.url=o.url),o["http.query"]&&(n["http.query"]=o["http.query"].slice(1)),o["http.fragment"]&&(n["http.fragment"]=o["http.fragment"].slice(1)),n}function X_e(t,e){let n=X.getSpan(e),r=cu(e);n&&!n.spanContext().isRemote&&bc(n,t),n?.spanContext().isRemote&&t.setAttribute(mO,!0),e===Wa&&(r={scope:yc(),isolationScope:er()}),r&&zl(t,r.scope,r.isolationScope),tp(t),H()?.emit("spanStart",t)}function J_e(t){np(t),H()?.emit("spanEnd",t)}var kh=class{constructor(e){Bh("SentrySpanProcessor"),this._exporter=new _O(e)}async forceFlush(){this._exporter.flush()}async shutdown(){this._exporter.clear()}onStart(e,n){X_e(e,n)}onEnd(e){J_e(e),this._exporter.export(e)}},Gh=class{constructor(e){this._client=e,Bh("SentrySampler")}shouldSample(e,n,r,o,s,i){let a=this._client.getOptions(),c=tfe(e),l=c?.spanContext();if(!Xe(a))return su({decision:void 0,context:e,spanAttributes:s});let p=s[bl]||s[xi];if(o===Ne.CLIENT&&p&&(!c||l?.isRemote))return su({decision:void 0,context:e,spanAttributes:s});let d=c?Z_e(c,n,r):void 0;if(!(!c||l?.isRemote))return su({decision:d?Bs.SamplingDecision.RECORD_AND_SAMPLED:Bs.SamplingDecision.NOT_RECORD,context:e,spanAttributes:s});let{description:f,data:m,op:h}=GF(r,s,o),T={...m,...s};h&&(T[ee]=h);let S={decision:!0};if(this._client.emit("beforeSampling",{spanAttributes:T,spanName:f,parentSampled:d,parentContext:l},S),!S.decision)return su({decision:void 0,context:e,spanAttributes:s});let{isolationScope:R}=cu(e)??{},I=l?.traceState?l.traceState.get(EO):void 0,x=I?Uo(I):void 0,F=jn(x?.sample_rand)??yt(),[B,se,ve]=rp(a,{name:f,attributes:T,normalizedRequest:R?.getScopeData().sdkProcessingMetadata.normalizedRequest,parentSampled:d,parentSampleRate:jn(x?.sample_rate)},F),on=`${p}`.toUpperCase();return on==="OPTIONS"||on==="HEAD"?(js&&g.log(`[Tracing] Not sampling span because HTTP method is '${on}' for ${r}`),su({decision:Bs.SamplingDecision.NOT_RECORD,context:e,spanAttributes:s,sampleRand:F,downstreamTraceSampleRate:0})):(!B&&d===void 0&&(js&&g.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),this._client.recordDroppedEvent("sample_rate","transaction")),{...su({decision:B?Bs.SamplingDecision.RECORD_AND_SAMPLED:Bs.SamplingDecision.NOT_RECORD,context:e,spanAttributes:s,sampleRand:F,downstreamTraceSampleRate:ve?se:void 0}),attributes:{[Nr]:ve?se:void 0}})}toString(){return"SentrySampler"}};function Z_e(t,e,n){let r=t.spanContext();if(No(r)&&r.traceId===e){if(r.isRemote){let s=iu(t.spanContext());return js&&g.log(`[Tracing] Inheriting remote parent's sampled decision for ${n}: ${s}`),s}let o=iu(r);return js&&g.log(`[Tracing] Inheriting parent's sampled decision for ${n}: ${o}`),o}}function su({decision:t,context:e,spanAttributes:n,sampleRand:r,downstreamTraceSampleRate:o}){let s=efe(e,n);return o!==void 0&&(s=s.set(O_e,`${o}`)),r!==void 0&&(s=s.set(I_e,`${r}`)),t==null?{decision:Bs.SamplingDecision.NOT_RECORD,traceState:s}:t===Bs.SamplingDecision.NOT_RECORD?{decision:t,traceState:s.set(SO,"1")}:{decision:t,traceState:s}}function efe(t,e){let o=X.getSpan(t)?.spanContext()?.traceState||new dn.TraceState,s=e[Za]||e[cs];return s&&typeof s=="string"&&(o=o.set(UF,s)),o}function tfe(t){let e=X.getSpan(t);return e&&No(e.spanContext())?e:void 0}var AO=oV(lV.AsyncLocalStorageContextManager);b();function RO(){wn.disable(),wn.setLogger({error:g.error,warn:g.warn,info:g.log,debug:g.log,verbose:g.log},dt.DEBUG)}import*as yO from"node:diagnostics_channel";var nfe="ChildProcess",pV=(t={})=>({name:nfe,setup(){yO.channel("child_process").subscribe(e=>{e&&typeof e=="object"&&"process"in e&&rfe(e.process,t)}),yO.channel("worker_threads").subscribe(e=>{e&&typeof e=="object"&&"worker"in e&&ofe(e.worker,t)})}});function rfe(t,e){let n=!1,r;t.on("spawn",()=>{if(t.spawnfile==="/usr/bin/sw_vers"){n=!0;return}r={spawnfile:t.spawnfile},e.includeChildProcessArgs&&(r.spawnargs=t.spawnargs)}).on("exit",o=>{n||(n=!0,o!==null&&o!==0&&rr({category:"child_process",message:`Child process exited with code '${o}'`,level:o===0?"info":"warning",data:r}))}).on("error",o=>{n||(n=!0,rr({category:"child_process",message:`Child process errored with '${o.message}'`,level:"error",data:r}))})}function ofe(t,e){let n;t.on("online",()=>{n=t.threadId}).on("error",r=>{e.captureWorkerErrors!==!1?te(r,{mechanism:{type:"auto.child_process.worker_thread",handled:!1,data:{threadId:String(n)}}}):rr({category:"worker_thread",message:`Worker thread errored with '${r.message}'`,level:"error",data:{threadId:n}})})}import{execFile as sfe}from"node:child_process";import{readFile as ife,readdir as afe}from"node:fs";import*as bt from"node:os";import{join as cfe}from"node:path";import{promisify as _V}from"node:util";var ufe=_V(ife),lfe=_V(afe),pfe="Context",dfe=(t={})=>{let e,n={app:!0,os:!0,device:!0,culture:!0,cloudResource:!0,...t};async function r(s){e===void 0&&(e=o());let i=_fe(await e);return s.contexts={...s.contexts,app:{...i.app,...s.contexts?.app},os:{...i.os,...s.contexts?.os},device:{...i.device,...s.contexts?.device},culture:{...i.culture,...s.contexts?.culture},cloud_resource:{...i.cloud_resource,...s.contexts?.cloud_resource}},s}async function o(){let s={};if(n.os&&(s.os=await ffe()),n.app&&(s.app=hfe()),n.device&&(s.device=Tfe(n.device)),n.culture){let i=mfe();i&&(s.culture=i)}return n.cloudResource&&(s.cloud_resource=yfe()),s}return{name:pfe,processEvent(s){return r(s)}}},fV=dfe;function _fe(t){if(t.app?.app_memory&&(t.app.app_memory=process.memoryUsage().rss),t.app?.free_memory&&typeof process.availableMemory=="function"){let e=process.availableMemory?.();e!=null&&(t.app.free_memory=e)}return t.device?.free_memory&&(t.device.free_memory=bt.freemem()),t}async function ffe(){let t=bt.platform();switch(t){case"darwin":return Afe();case"linux":return Rfe();default:return{name:Efe[t]||t,version:bt.release()}}}function mfe(){try{if(typeof process.versions.icu!="string")return;let t=new Date(9e8);if(new Intl.DateTimeFormat("es",{month:"long"}).format(t)==="enero"){let n=Intl.DateTimeFormat().resolvedOptions();return{locale:n.locale,timezone:n.timeZone}}}catch{}}function hfe(){let t=process.memoryUsage().rss,n={app_start_time:new Date(Date.now()-process.uptime()*1e3).toISOString(),app_memory:t};if(typeof process.availableMemory=="function"){let r=process.availableMemory?.();r!=null&&(n.free_memory=r)}return n}function Tfe(t){let e={},n;try{n=bt.uptime()}catch{}if(typeof n=="number"&&(e.boot_time=new Date(Date.now()-n*1e3).toISOString()),e.arch=bt.arch(),(t===!0||t.memory)&&(e.memory_size=bt.totalmem(),e.free_memory=bt.freemem()),t===!0||t.cpu){let r=bt.cpus(),o=r?.[0];o&&(e.processor_count=r.length,e.cpu_description=o.model,e.processor_frequency=o.speed)}return e}var Efe={aix:"IBM AIX",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",win32:"Windows",ohos:"OpenHarmony",android:"Android"},Sfe=[{name:"fedora-release",distros:["Fedora"]},{name:"redhat-release",distros:["Red Hat Linux","Centos"]},{name:"redhat_version",distros:["Red Hat Linux"]},{name:"SuSE-release",distros:["SUSE Linux"]},{name:"lsb-release",distros:["Ubuntu Linux","Arch Linux"]},{name:"debian_version",distros:["Debian"]},{name:"debian_release",distros:["Debian"]},{name:"arch-release",distros:["Arch Linux"]},{name:"gentoo-release",distros:["Gentoo Linux"]},{name:"novell-release",distros:["SUSE Linux"]},{name:"alpine-release",distros:["Alpine Linux"]}],gfe={alpine:t=>t,arch:t=>ao(/distrib_release=(.*)/,t),centos:t=>ao(/release ([^ ]+)/,t),debian:t=>t,fedora:t=>ao(/release (..)/,t),mint:t=>ao(/distrib_release=(.*)/,t),red:t=>ao(/release ([^ ]+)/,t),suse:t=>ao(/VERSION = (.*)\n/,t),ubuntu:t=>ao(/distrib_release=(.*)/,t)};function ao(t,e){let n=t.exec(e);return n?n[1]:void 0}async function Afe(){let t={kernel_version:bt.release(),name:"Mac OS X",version:`10.${Number(bt.release().split(".")[0])-4}`};try{let e=await new Promise((n,r)=>{sfe("/usr/bin/sw_vers",(o,s)=>{if(o){r(o);return}n(s)})});t.name=ao(/^ProductName:\s+(.*)$/m,e),t.version=ao(/^ProductVersion:\s+(.*)$/m,e),t.build=ao(/^BuildVersion:\s+(.*)$/m,e)}catch{}return t}function dV(t){return t.split(" ")[0].toLowerCase()}async function Rfe(){let t={kernel_version:bt.release(),name:"Linux"};try{let e=await lfe("/etc"),n=Sfe.find(a=>e.includes(a.name));if(!n)return t;let r=cfe("/etc",n.name),o=(await ufe(r,{encoding:"utf-8"})).toLowerCase(),{distros:s}=n;t.name=s.find(a=>o.indexOf(dV(a))>=0)||s[0];let i=dV(t.name);t.version=gfe[i]?.(o)}catch{}return t}function yfe(){return process.env.VERCEL?{"cloud.provider":"vercel","cloud.region":process.env.VERCEL_REGION}:process.env.AWS_REGION?{"cloud.provider":"aws","cloud.region":process.env.AWS_REGION,"cloud.platform":process.env.AWS_EXECUTION_ENV}:process.env.GCP_PROJECT?{"cloud.provider":"gcp"}:process.env.ALIYUN_REGION_ID?{"cloud.provider":"alibaba_cloud","cloud.region":process.env.ALIYUN_REGION_ID}:process.env.WEBSITE_SITE_NAME&&process.env.REGION_NAME?{"cloud.provider":"azure","cloud.region":process.env.REGION_NAME}:process.env.IBM_CLOUD_REGION?{"cloud.provider":"ibm_cloud","cloud.region":process.env.IBM_CLOUD_REGION}:process.env.TENCENTCLOUD_REGION?{"cloud.provider":"tencent_cloud","cloud.region":process.env.TENCENTCLOUD_REGION,"cloud.account.id":process.env.TENCENTCLOUD_APPID,"cloud.availability_zone":process.env.TENCENTCLOUD_ZONE}:process.env.NETLIFY?{"cloud.provider":"netlify"}:process.env.FLY_REGION?{"cloud.provider":"fly.io","cloud.region":process.env.FLY_REGION}:process.env.DYNO?{"cloud.provider":"heroku"}:void 0}import{createReadStream as Ife}from"node:fs";import{createInterface as Ofe}from"node:readline";var IO=new In(10),TV=new In(20),Nfe=7,bfe="ContextLines",Cfe=1e3,Pfe=1e4;function Mfe(t,e,n){let r=t.get(e);return r===void 0?(t.set(e,n),n):r}function xfe(t){return!!(t.startsWith("node:")||t.endsWith(".min.js")||t.endsWith(".min.cjs")||t.endsWith(".min.mjs")||t.startsWith("data:"))}function vfe(t){return t.lineno!==void 0&&t.lineno>Pfe||t.colno!==void 0&&t.colno>Cfe}function Lfe(t,e){let n=IO.get(t);if(n===void 0)return!1;for(let r=e[0];r<=e[1];r++)if(n[r]===void 0)return!1;return!0}function Dfe(t,e){if(!t.length)return[];let n=0,r=t[0];if(typeof r!="number")return[];let o=hV(r,e),s=[];for(;;){if(n===t.length-1){s.push(o);break}let i=t[n+1];if(typeof i!="number")break;i<=o[1]?o[1]=i+e:(s.push(o),o=hV(i,e)),n++}return s}function Ufe(t,e,n){return new Promise((r,o)=>{let s=Ife(t),i=Ofe({input:s});function a(){s.destroy(),r()}let c=0,l=0,p=e[l];if(p===void 0){a();return}let d=p[0],_=p[1];function f(m){TV.set(t,1),re&&g.error(`Failed to read file: ${t}. Error: ${m}`),i.close(),i.removeAllListeners(),a()}s.on("error",f),i.on("error",f),i.on("close",a),i.on("line",m=>{if(c++,!(c<d)&&(n[c]=DR(m,0),c>=_)){if(l===e.length-1){i.close(),i.removeAllListeners();return}l++;let h=e[l];if(h===void 0){i.close(),i.removeAllListeners();return}d=h[0],_=h[1]}})})}async function wfe(t,e){let n={};if(e>0&&t.exception?.values){for(let s of t.exception.values)if(s.stacktrace?.frames?.length)for(let i=s.stacktrace.frames.length-1;i>=0;i--){let a=s.stacktrace.frames[i],c=a?.filename;if(!a||typeof c!="string"||typeof a.lineno!="number"||xfe(c)||vfe(a))continue;n[c]||(n[c]=[]),n[c].push(a.lineno)}}let r=Object.keys(n);if(r.length==0)return t;let o=[];for(let s of r){if(TV.get(s))continue;let i=n[s];if(!i)continue;i.sort((l,p)=>l-p);let a=Dfe(i,e);if(a.every(l=>Lfe(s,l)))continue;let c=Mfe(IO,s,{});o.push(Ufe(s,a,c))}if(await Promise.all(o).catch(()=>{re&&g.log("Failed to read one or more source files and resolve context lines")}),e>0&&t.exception?.values)for(let s of t.exception.values)s.stacktrace?.frames&&s.stacktrace.frames.length>0&&kfe(s.stacktrace.frames,e,IO);return t}function kfe(t,e,n){for(let r of t)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let o=n.get(r.filename);if(o===void 0)continue;Gfe(r.lineno,r,e,o)}}function mV(t){delete t.pre_context,delete t.context_line,delete t.post_context}function Gfe(t,e,n,r){if(e.lineno===void 0||r===void 0){re&&g.error("Cannot resolve context for frame with no lineno or file contents");return}e.pre_context=[];for(let s=EV(t,n);s<t;s++){let i=r[s];if(i===void 0){mV(e),re&&g.error(`Could not find line ${s} in file ${e.filename}`);return}e.pre_context.push(i)}if(r[t]===void 0){mV(e),re&&g.error(`Could not find line ${t} in file ${e.filename}`);return}e.context_line=r[t];let o=SV(t,n);e.post_context=[];for(let s=t+1;s<=o;s++){let i=r[s];if(i===void 0)break;e.post_context.push(i)}}function EV(t,e){return Math.max(1,t-e)}function SV(t,e){return t+e}function hV(t,e){return[EV(t,e),SV(t,e)]}var Bfe=(t={})=>{let e=t.frameContextLines!==void 0?t.frameContextLines:Nfe;return{name:bfe,processEvent(n){return wfe(n,e)}}},gV=Bfe;import{Worker as jfe}from"node:worker_threads";var jh;async function Hh(){if(jh===void 0)try{jh=!!(await import("node:inspector")).url()}catch{jh=!1}return jh}var Bp="__SENTRY_ERROR_LOCAL_VARIABLES__";function RV(t,e,n){let r=0,o=5,s=0;return setInterval(()=>{s===0?r>t&&(o*=2,n(o),o>86400&&(o=86400),s=o):(s-=1,s===0&&e()),r=0},1e3).unref(),()=>{r+=1}}function AV(t){return t!==void 0&&(t.length===0||t==="?"||t==="<anonymous>")}function Fh(t,e){return t===e||`Object.${t}`===e||t===`Object.${e}`||AV(t)&&AV(e)}var Hfe="LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjQ3LjAgKGE1YTRlNzMpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyBlfWZyb20ibm9kZTppbnNwZWN0b3IvcHJvbWlzZXMiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIHR9ZnJvbSJub2RlOndvcmtlcl90aHJlYWRzIjtjb25zdCBuPWdsb2JhbFRoaXMsaT17fTtjb25zdCBvPSJfX1NFTlRSWV9FUlJPUl9MT0NBTF9WQVJJQUJMRVNfXyI7Y29uc3QgYT10O2Z1bmN0aW9uIHMoLi4uZSl7YS5kZWJ1ZyYmZnVuY3Rpb24oZSl7aWYoISgiY29uc29sZSJpbiBuKSlyZXR1cm4gZSgpO2NvbnN0IHQ9bi5jb25zb2xlLG89e30sYT1PYmplY3Qua2V5cyhpKTthLmZvckVhY2goZT0+e2NvbnN0IG49aVtlXTtvW2VdPXRbZV0sdFtlXT1ufSk7dHJ5e3JldHVybiBlKCl9ZmluYWxseXthLmZvckVhY2goZT0+e3RbZV09b1tlXX0pfX0oKCk9PmNvbnNvbGUubG9nKCJbTG9jYWxWYXJpYWJsZXMgV29ya2VyXSIsLi4uZSkpfWFzeW5jIGZ1bmN0aW9uIGMoZSx0LG4saSl7Y29uc3Qgbz1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pO2lbbl09by5yZXN1bHQuZmlsdGVyKGU9PiJsZW5ndGgiIT09ZS5uYW1lJiYhaXNOYU4ocGFyc2VJbnQoZS5uYW1lLDEwKSkpLnNvcnQoKGUsdCk9PnBhcnNlSW50KGUubmFtZSwxMCktcGFyc2VJbnQodC5uYW1lLDEwKSkubWFwKGU9PmUudmFsdWU/LnZhbHVlKX1hc3luYyBmdW5jdGlvbiByKGUsdCxuLGkpe2NvbnN0IG89YXdhaXQgZS5wb3N0KCJSdW50aW1lLmdldFByb3BlcnRpZXMiLHtvYmplY3RJZDp0LG93blByb3BlcnRpZXM6ITB9KTtpW25dPW8ucmVzdWx0Lm1hcChlPT5bZS5uYW1lLGUudmFsdWU/LnZhbHVlXSkucmVkdWNlKChlLFt0LG5dKT0+KGVbdF09bixlKSx7fSl9ZnVuY3Rpb24gdShlLHQpe2UudmFsdWUmJigidmFsdWUiaW4gZS52YWx1ZT92b2lkIDA9PT1lLnZhbHVlLnZhbHVlfHxudWxsPT09ZS52YWx1ZS52YWx1ZT90W2UubmFtZV09YDwke2UudmFsdWUudmFsdWV9PmA6dFtlLm5hbWVdPWUudmFsdWUudmFsdWU6ImRlc2NyaXB0aW9uImluIGUudmFsdWUmJiJmdW5jdGlvbiIhPT1lLnZhbHVlLnR5cGU/dFtlLm5hbWVdPWA8JHtlLnZhbHVlLmRlc2NyaXB0aW9ufT5gOiJ1bmRlZmluZWQiPT09ZS52YWx1ZS50eXBlJiYodFtlLm5hbWVdPSI8dW5kZWZpbmVkPiIpKX1hc3luYyBmdW5jdGlvbiBsKGUsdCl7Y29uc3Qgbj1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pLGk9e307Zm9yKGNvbnN0IHQgb2Ygbi5yZXN1bHQpaWYodC52YWx1ZT8ub2JqZWN0SWQmJiJBcnJheSI9PT10LnZhbHVlLmNsYXNzTmFtZSl7Y29uc3Qgbj10LnZhbHVlLm9iamVjdElkO2F3YWl0IGMoZSxuLHQubmFtZSxpKX1lbHNlIGlmKHQudmFsdWU/Lm9iamVjdElkJiYiT2JqZWN0Ij09PXQudmFsdWUuY2xhc3NOYW1lKXtjb25zdCBuPXQudmFsdWUub2JqZWN0SWQ7YXdhaXQgcihlLG4sdC5uYW1lLGkpfWVsc2UgdC52YWx1ZSYmdSh0LGkpO3JldHVybiBpfWxldCBmOyhhc3luYyBmdW5jdGlvbigpe2NvbnN0IHQ9bmV3IGU7dC5jb25uZWN0VG9NYWluVGhyZWFkKCkscygiQ29ubmVjdGVkIHRvIG1haW4gdGhyZWFkIik7bGV0IG49ITE7dC5vbigiRGVidWdnZXIucmVzdW1lZCIsKCk9PntuPSExfSksdC5vbigiRGVidWdnZXIucGF1c2VkIixlPT57bj0hMCxhc3luYyBmdW5jdGlvbihlLHtyZWFzb246dCxkYXRhOntvYmplY3RJZDpufSxjYWxsRnJhbWVzOml9KXtpZigiZXhjZXB0aW9uIiE9PXQmJiJwcm9taXNlUmVqZWN0aW9uIiE9PXQpcmV0dXJuO2lmKGY/LigpLG51bGw9PW4pcmV0dXJuO2NvbnN0IGE9W107Zm9yKGxldCB0PTA7dDxpLmxlbmd0aDt0Kyspe2NvbnN0e3Njb3BlQ2hhaW46bixmdW5jdGlvbk5hbWU6byx0aGlzOnN9PWlbdF0sYz1uLmZpbmQoZT0+ImxvY2FsIj09PWUudHlwZSkscj0iZ2xvYmFsIiE9PXMuY2xhc3NOYW1lJiZzLmNsYXNzTmFtZT9gJHtzLmNsYXNzTmFtZX0uJHtvfWA6bztpZih2b2lkIDA9PT1jPy5vYmplY3Qub2JqZWN0SWQpYVt0XT17ZnVuY3Rpb246cn07ZWxzZXtjb25zdCBuPWF3YWl0IGwoZSxjLm9iamVjdC5vYmplY3RJZCk7YVt0XT17ZnVuY3Rpb246cix2YXJzOm59fX1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuY2FsbEZ1bmN0aW9uT24iLHtmdW5jdGlvbkRlY2xhcmF0aW9uOmBmdW5jdGlvbigpIHsgdGhpcy4ke299ID0gdGhpcy4ke299IHx8ICR7SlNPTi5zdHJpbmdpZnkoYSl9OyB9YCxzaWxlbnQ6ITAsb2JqZWN0SWQ6bn0pLGF3YWl0IGUucG9zdCgiUnVudGltZS5yZWxlYXNlT2JqZWN0Iix7b2JqZWN0SWQ6bn0pfSh0LGUucGFyYW1zKS50aGVuKGFzeW5jKCk9PntuJiZhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnJlc3VtZSIpfSxhc3luYyBlPT57biYmYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5yZXN1bWUiKX0pfSksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5lbmFibGUiKTtjb25zdCBpPSExIT09YS5jYXB0dXJlQWxsRXhjZXB0aW9ucztpZihhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnNldFBhdXNlT25FeGNlcHRpb25zIix7c3RhdGU6aT8iYWxsIjoidW5jYXVnaHQifSksaSl7Y29uc3QgZT1hLm1heEV4Y2VwdGlvbnNQZXJTZWNvbmR8fDUwO2Y9ZnVuY3Rpb24oZSx0LG4pe2xldCBpPTAsbz01LGE9MDtyZXR1cm4gc2V0SW50ZXJ2YWwoKCk9PnswPT09YT9pPmUmJihvKj0yLG4obyksbz44NjQwMCYmKG89ODY0MDApLGE9byk6KGEtPTEsMD09PWEmJnQoKSksaT0wfSwxZTMpLnVucmVmKCksKCk9PntpKz0xfX0oZSxhc3luYygpPT57cygiUmF0ZS1saW1pdCBsaWZ0ZWQuIiksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJhbGwifSl9LGFzeW5jIGU9PntzKGBSYXRlLWxpbWl0IGV4Y2VlZGVkLiBEaXNhYmxpbmcgY2FwdHVyaW5nIG9mIGNhdWdodCBleGNlcHRpb25zIGZvciAke2V9IHNlY29uZHMuYCksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJ1bmNhdWdodCJ9KX0pfX0pKCkuY2F0Y2goZT0+e3MoIkZhaWxlZCB0byBzdGFydCBkZWJ1Z2dlciIsZSl9KSxzZXRJbnRlcnZhbCgoKT0+e30sMWU0KTs=";function yV(...t){g.log("[LocalVariables]",...t)}var IV=(t={})=>{function e(s,i){let a=(s.stacktrace?.frames||[]).filter(c=>c.function!=="new Promise");for(let c=0;c<a.length;c++){let l=a.length-c-1,p=i[c],d=a[l];if(!d||!p)break;p.vars===void 0||d.in_app===!1&&t.includeOutOfAppFrames!==!0||!Fh(d.function,p.function)||(d.vars=p.vars)}}function n(s,i){if(i.originalException&&typeof i.originalException=="object"&&Bp in i.originalException&&Array.isArray(i.originalException[Bp])){for(let a of s.exception?.values||[])e(a,i.originalException[Bp]);i.originalException[Bp]=void 0}return s}async function r(){let s=await import("node:inspector");s.url()||s.open(0)}function o(s){let i=new jfe(new URL(`data:application/javascript;base64,${Hfe}`),{workerData:s,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on("exit",()=>{i.terminate()}),i.once("error",a=>{yV("Worker error",a)}),i.once("exit",a=>{yV("Worker exit",a)}),i.unref()}return{name:"LocalVariablesAsync",async setup(s){if(!s.getOptions().includeLocalVariables)return;if(await Hh()){g.warn("Local variables capture has been disabled because the debugger was already enabled");return}let a={...t,debug:g.isEnabled()};r().then(()=>{try{o(a)}catch(c){g.error("Failed to start worker",c)}},c=>{g.error("Failed to start inspector",c)})},processEvent(s,i){return n(s,i)}}};function OV(t){if(t!==void 0)return t.slice(-10).reduce((e,n)=>`${e},${n.function},${n.lineno},${n.colno}`,"")}function Ffe(t,e){if(e!==void 0)return OV(t(e,1))}function NV(t){let e=[],n=!1;function r(i){e=[],!n&&(n=!0,t(i))}e.push(r);function o(i){e.push(i)}function s(i){let a=e.pop()||r;try{a(i)}catch{r(i)}}return{add:o,next:s}}var OO=class t{constructor(e){this._session=e}static async create(e){if(e)return e;let n=await import("node:inspector");return new t(new n.Session)}configureAndConnect(e,n){this._session.connect(),this._session.on("Debugger.paused",r=>{e(r,()=>{this._session.post("Debugger.resume")})}),this._session.post("Debugger.enable"),this._session.post("Debugger.setPauseOnExceptions",{state:n?"all":"uncaught"})}setPauseOnExceptions(e){this._session.post("Debugger.setPauseOnExceptions",{state:e?"all":"uncaught"})}getLocalVariables(e,n){this._getProperties(e,r=>{let{add:o,next:s}=NV(n);for(let i of r)if(i.value?.objectId&&i.value.className==="Array"){let a=i.value.objectId;o(c=>this._unrollArray(a,i.name,c,s))}else if(i.value?.objectId&&i.value.className==="Object"){let a=i.value.objectId;o(c=>this._unrollObject(a,i.name,c,s))}else i.value&&o(a=>this._unrollOther(i,a,s));s({})})}_getProperties(e,n){this._session.post("Runtime.getProperties",{objectId:e,ownProperties:!0},(r,o)=>{n(r?[]:o.result)})}_unrollArray(e,n,r,o){this._getProperties(e,s=>{r[n]=s.filter(i=>i.name!=="length"&&!isNaN(parseInt(i.name,10))).sort((i,a)=>parseInt(i.name,10)-parseInt(a.name,10)).map(i=>i.value?.value),o(r)})}_unrollObject(e,n,r,o){this._getProperties(e,s=>{r[n]=s.map(i=>[i.name,i.value?.value]).reduce((i,[a,c])=>(i[a]=c,i),{}),o(r)})}_unrollOther(e,n,r){e.value&&("value"in e.value?e.value.value===void 0||e.value.value===null?n[e.name]=`<${e.value.value}>`:n[e.name]=e.value.value:"description"in e.value&&e.value.type!=="function"?n[e.name]=`<${e.value.description}>`:e.value.type==="undefined"&&(n[e.name]="<undefined>")),r(n)}},Vfe="LocalVariables",qfe=(t={},e)=>{let n=new In(20),r,o=!1;function s(l){let p=OV(l.stacktrace?.frames);if(p===void 0)return;let d=n.remove(p);if(d===void 0)return;let _=(l.stacktrace?.frames||[]).filter(f=>f.function!=="new Promise");for(let f=0;f<_.length;f++){let m=_.length-f-1,h=d[f],T=_[m];if(!T||!h)break;h.vars===void 0||T.in_app===!1&&t.includeOutOfAppFrames!==!0||!Fh(T.function,h.function)||(T.vars=h.vars)}}function i(l){for(let p of l.exception?.values||[])s(p);return l}let a;async function c(){let p=H()?.getOptions();if(!p?.includeLocalVariables)return;if(jo<18){g.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await Hh()){g.warn("Local variables capture has been disabled because the debugger was already enabled");return}try{let _=await OO.create(e),f=(h,{params:{reason:T,data:S,callFrames:R}},I)=>{if(T!=="exception"&&T!=="promiseRejection"){I();return}r?.();let x=Ffe(h,S.description);if(x==null){I();return}let{add:F,next:B}=NV(se=>{n.set(x,se),I()});for(let se=0;se<Math.min(R.length,5);se++){let{scopeChain:ve,functionName:on,this:Io}=R[se],ss=ve.find(Et=>Et.type==="local"),yi=Io.className==="global"||!Io.className?on:`${Io.className}.${on}`;if(ss?.object.objectId===void 0)F(Et=>{Et[se]={function:yi},B(Et)});else{let Et=ss.object.objectId;F($a=>_.getLocalVariables(Et,Ya=>{$a[se]={function:yi,vars:Ya},B($a)}))}}B([])},m=t.captureAllExceptions!==!1;if(_.configureAndConnect((h,T)=>f(p.stackParser,h,T),m),m){let h=t.maxExceptionsPerSecond||50;r=RV(h,()=>{g.log("Local variables rate-limit lifted."),_.setPauseOnExceptions(!0)},T=>{g.log(`Local variables rate-limit exceeded. Disabling capturing of caught exceptions for ${T} seconds.`),_.setPauseOnExceptions(!1)})}o=!0}catch(_){g.log("The `LocalVariables` integration failed to start.",_)}}return{name:Vfe,setupOnce(){a=c()},async processEvent(l){return await a,o?i(l):l},_getCachedFramesCount(){return n.size},_getFirstCachedFrame(){return n.values()[0]}}},bV=qfe;var CV=(t={})=>Lr.major<19?bV(t):IV(t);import{existsSync as $fe,readFileSync as vV}from"node:fs";import{dirname as Yfe,join as LV}from"node:path";function jp(){try{return typeof module<"u"&&typeof module.exports<"u"}catch{return!1}}var PV;function MV(){return jp()?!1:jo>=21||jo===20&&Pp>=6||jo===18&&Pp>=19?!0:(PV||(PV=!0,Qe(()=>{console.warn(`[Sentry] You are using Node.js v${process.versions.node} in ESM mode ("import syntax"). The Sentry Node.js SDK is not compatible with ESM in Node.js versions before 18.19.0 or before 20.6.0. Please either build your application with CommonJS ("require() syntax"), or upgrade your Node.js version.`)})),!1)}var NO,Wfe="Modules",zfe=typeof __SENTRY_SERVER_MODULES__>"u"?{}:__SENTRY_SERVER_MODULES__,Kfe=()=>({name:Wfe,processEvent(t){return t.modules={...t.modules,...xV()},t},getModules:xV}),DV=Kfe;function Qfe(){try{return U.cache?Object.keys(U.cache):[]}catch{return[]}}function Xfe(){return{...zfe,...eme(),...jp()?Jfe():{}}}function Jfe(){let t=U.main?.paths||[],e=Qfe(),n={},r=new Set;return e.forEach(o=>{let s=o,i=()=>{let a=s;if(s=Yfe(a),!s||a===s||r.has(a))return;if(t.indexOf(s)<0)return i();let c=LV(a,"package.json");if(r.add(a),!$fe(c))return i();try{let l=JSON.parse(vV(c,"utf8"));n[l.name]=l.version}catch{}};i()}),n}function xV(){return NO||(NO=Xfe()),NO}function Zfe(){try{let t=LV(process.cwd(),"package.json");return JSON.parse(vV(t,"utf8"))}catch{return{}}}function eme(){let t=Zfe();return{...t.dependencies,...t.devDependencies}}import{isMainThread as nme}from"worker_threads";var tme=2e3;function Hp(t){Qe(()=>{console.error(t)});let e=H();if(e===void 0){re&&g.warn("No NodeClient was defined, we are exiting the process now."),global.process.exit(1);return}let n=e.getOptions(),r=n?.shutdownTimeout&&n.shutdownTimeout>0?n.shutdownTimeout:tme;e.close(r).then(o=>{o||re&&g.warn("We reached the timeout for emptying the request buffer, still exiting now!"),global.process.exit(1)},o=>{re&&g.error(o)})}var rme="OnUncaughtException",UV=(t={})=>{let e={exitEvenIfOtherHandlersAreRegistered:!1,...t};return{name:rme,setup(n){nme&&global.process.on("uncaughtException",ome(n,e))}}};function ome(t,e){let r=!1,o=!1,s=!1,i,a=t.getOptions();return Object.assign(c=>{let l=Hp;e.onFatalError?l=e.onFatalError:a.onFatalError&&(l=a.onFatalError);let d=global.process.listeners("uncaughtException").filter(f=>f.name!=="domainUncaughtExceptionClear"&&f.tag!=="sentry_tracingErrorCallback"&&f._errorHandler!==!0).length===0,_=e.exitEvenIfOtherHandlersAreRegistered||d;r?_&&(s?(re&&g.warn("uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown"),Hp(c)):o||(o=!0,setTimeout(()=>{s||(s=!0,l(i,c))},2e3))):(i=c,r=!0,H()===t&&te(c,{originalException:c,captureContext:{level:"fatal"},mechanism:{handled:!1,type:"auto.node.onuncaughtexception"}}),!s&&_&&(s=!0,l(c)))},{_errorHandler:!0})}var sme="OnUnhandledRejection",ime=[{name:"AI_NoOutputGeneratedError"},{name:"AbortError"}],ame=(t={})=>{let e={mode:t.mode??"warn",ignore:[...ime,...t.ignore??[]]};return{name:sme,setup(n){global.process.on("unhandledRejection",pme(n,e))}}},wV=ame;function cme(t){if(typeof t!="object"||t===null)return{name:"",message:String(t??"")};let e=t,n=typeof e.name=="string"?e.name:"",r=typeof e.message=="string"?e.message:String(t);return{name:n,message:r}}function ume(t,e){let n=t.name===void 0||xo(e.name,t.name,!0),r=t.message===void 0||xo(e.message,t.message);return n&&r}function lme(t,e){let n=cme(e);return t.some(r=>ume(r,n))}function pme(t,e){return function(r,o){if(H()!==t||lme(e.ignore??[],r))return;let s=e.mode==="strict"?"fatal":"error",i=r&&typeof r=="object"?r._sentry_active_span:void 0;(i?c=>Mc(i,c):c=>c())(()=>{te(r,{originalException:o,captureContext:{extra:{unhandledPromiseRejection:!0},level:s},mechanism:{handled:!1,type:"auto.node.onunhandledrejection"}})}),dme(r,e.mode)}}function dme(t,e){let n="This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:";e==="warn"?Qe(()=>{console.warn(n),console.error(t&&typeof t=="object"&&"stack"in t?t.stack:t)}):e==="strict"&&(Qe(()=>{console.warn(n)}),Hp(t))}var _me="ProcessSession",kV=()=>({name:_me,setupOnce(){sm(),process.on("beforeExit",()=>{ue().getSession()?.status!=="ok"&&ip()})}});import*as GV from"node:http";var bO="Spotlight",fme=(t={})=>{let e={sidecarUrl:t.sidecarUrl||"http://localhost:8969/stream"};return{name:bO,setup(n){try{process.env.NODE_ENV&&process.env.NODE_ENV!=="development"&&g.warn("[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?")}catch{}mme(n,e)}}},BV=fme;function mme(t,e){let n=hme(e.sidecarUrl);if(!n)return;let r=0;t.on("beforeEnvelope",o=>{if(r>3){g.warn("[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests");return}let s=ep(o);xc(()=>{let i=GV.request({method:"POST",path:n.pathname,hostname:n.hostname,port:n.port,headers:{"Content-Type":"application/x-sentry-envelope"}},a=>{a.statusCode&&a.statusCode>=200&&a.statusCode<400&&(r=0),a.on("data",()=>{}),a.on("end",()=>{}),a.setEncoding("utf8")});i.on("error",()=>{r++,g.warn("[Spotlight] Failed to send envelope to Spotlight Sidecar")}),i.write(s),i.end()})})}function hme(t){try{return new URL(`${t}`)}catch{g.warn(`[Spotlight] Invalid sidecar URL: ${t}`);return}}import*as jV from"node:util";var Tme="NodeSystemError";function Eme(t){return!(t instanceof Error)||!("errno"in t)||typeof t.errno!="number"?!1:jV.getSystemErrorMap().has(t.errno)}var HV=(t={})=>({name:Tme,processEvent:(e,n,r)=>{if(!Eme(n.originalException))return e;let o=n.originalException,s={...o};!r.getOptions().sendDefaultPii&&t.includePaths!==!0&&(delete s.path,delete s.dest),e.contexts={...e.contexts,node_system_error:s};for(let i of e.exception?.values||[])i.value&&(o.path&&i.value.includes(o.path)&&(i.value=i.value.replace(`'${o.path}'`,"").trim()),o.dest&&i.value.includes(o.dest)&&(i.value=i.value.replace(`'${o.dest}'`,"").trim()));return e}});import*as gme from"node:http";import*as Ame from"node:https";import{Readable as Rme}from"node:stream";import{createGzip as yme}from"node:zlib";import*as Vo from"node:net";import*as PO from"node:tls";import*as CO from"node:http";var co=Symbol("AgentBaseInternalState"),Vh=class extends CO.Agent{constructor(e){super(e),this[co]={}}isSecureEndpoint(e){if(e){if(typeof e.secureEndpoint=="boolean")return e.secureEndpoint;if(typeof e.protocol=="string")return e.protocol==="https:"}let{stack:n}=new Error;return typeof n!="string"?!1:n.split(`
31
+ `).some(r=>r.indexOf("(https.js:")!==-1||r.indexOf("node:https:")!==-1)}createSocket(e,n,r){let o={...n,secureEndpoint:this.isSecureEndpoint(n)};Promise.resolve().then(()=>this.connect(e,o)).then(s=>{if(s instanceof CO.Agent)return s.addRequest(e,o);this[co].currentSocket=s,super.createSocket(e,n,r)},r)}createConnection(){let e=this[co].currentSocket;if(this[co].currentSocket=void 0,!e)throw new Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[co].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(e){this[co]&&(this[co].defaultPort=e)}get protocol(){return this[co].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(e){this[co]&&(this[co].protocol=e)}};function qh(...t){g.log("[https-proxy-agent:parse-proxy-response]",...t)}function FV(t){return new Promise((e,n)=>{let r=0,o=[];function s(){let p=t.read();p?l(p):t.once("readable",s)}function i(){t.removeListener("end",a),t.removeListener("error",c),t.removeListener("readable",s)}function a(){i(),qh("onend"),n(new Error("Proxy connection ended before receiving CONNECT response"))}function c(p){i(),qh("onerror %o",p),n(p)}function l(p){o.push(p),r+=p.length;let d=Buffer.concat(o,r),_=d.indexOf(`\r
32
+ \r
33
+ `);if(_===-1){qh("have not received end of HTTP headers yet..."),s();return}let f=d.subarray(0,_).toString("ascii").split(`\r
34
+ `),m=f.shift();if(!m)return t.destroy(),n(new Error("No header received from proxy CONNECT response"));let h=m.split(" "),T=+(h[1]||0),S=h.slice(2).join(" "),R={};for(let I of f){if(!I)continue;let x=I.indexOf(":");if(x===-1)return t.destroy(),n(new Error(`Invalid header from proxy CONNECT response: "${I}"`));let F=I.slice(0,x).toLowerCase(),B=I.slice(x+1).trimStart(),se=R[F];typeof se=="string"?R[F]=[se,B]:Array.isArray(se)?se.push(B):R[F]=B}qh("got proxy server response: %o %o",m,R),i(),e({connect:{statusCode:T,statusText:S,headers:R},buffered:d})}t.on("error",c),t.on("end",a),s()})}function Fp(...t){g.log("[https-proxy-agent]",...t)}var Vp=class extends Vh{static __initStatic(){this.protocols=["http","https"]}constructor(e,n){super(n),this.options={},this.proxy=typeof e=="string"?new URL(e):e,this.proxyHeaders=n?.headers??{},Fp("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let r=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),o=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...n?VV(n,"headers"):null,host:r,port:o}}async connect(e,n){let{proxy:r}=this;if(!n.host)throw new TypeError('No "host" provided');let o;if(r.protocol==="https:"){Fp("Creating `tls.Socket`: %o",this.connectOpts);let _=this.connectOpts.servername||this.connectOpts.host;o=PO.connect({...this.connectOpts,servername:_&&Vo.isIP(_)?void 0:_})}else Fp("Creating `net.Socket`: %o",this.connectOpts),o=Vo.connect(this.connectOpts);let s=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders},i=Vo.isIPv6(n.host)?`[${n.host}]`:n.host,a=`CONNECT ${i}:${n.port} HTTP/1.1\r
35
+ `;if(r.username||r.password){let _=`${decodeURIComponent(r.username)}:${decodeURIComponent(r.password)}`;s["Proxy-Authorization"]=`Basic ${Buffer.from(_).toString("base64")}`}s.Host=`${i}:${n.port}`,s["Proxy-Connection"]||(s["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let _ of Object.keys(s))a+=`${_}: ${s[_]}\r
36
+ `;let c=FV(o);o.write(`${a}\r
37
+ `);let{connect:l,buffered:p}=await c;if(e.emit("proxyConnect",l),this.emit("proxyConnect",l,e),l.statusCode===200){if(e.once("socket",Sme),n.secureEndpoint){Fp("Upgrading socket connection to TLS");let _=n.servername||n.host;return PO.connect({...VV(n,"host","path","port"),socket:o,servername:Vo.isIP(_)?void 0:_})}return o}o.destroy();let d=new Vo.Socket({writable:!1});return d.readable=!0,e.once("socket",_=>{Fp("Replaying proxy buffer for failed request"),_.push(p),_.push(null)}),d}};Vp.__initStatic();function Sme(t){t.resume()}function VV(t,...e){let n={},r;for(r in t)e.includes(r)||(n[r]=t[r]);return n}var Ime=1024*32;function Ome(t){return new Rme({read(){this.push(t),this.push(null)}})}function qV(t){let e;try{e=new URL(t.url)}catch{return Qe(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),up(t,()=>Promise.resolve({}))}let n=e.protocol==="https:",r=Nme(e,t.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),o=n?Ame:gme,s=t.keepAlive===void 0?!1:t.keepAlive,i=r?new Vp(r):new o.Agent({keepAlive:s,maxSockets:30,timeout:2e3}),a=bme(t,t.httpModule??o,i);return up(t,a)}function Nme(t,e){let{no_proxy:n}=process.env;if(!n?.split(",").some(o=>t.host.endsWith(o)||t.hostname.endsWith(o)))return e}function bme(t,e,n){let{hostname:r,pathname:o,port:s,protocol:i,search:a}=new URL(t.url);return function(l){return new Promise((p,d)=>{xc(()=>{let _=Ome(l.body),f={...t.headers};l.body.length>Ime&&(f["content-encoding"]="gzip",_=_.pipe(yme()));let m=r.startsWith("["),h=e.request({method:"POST",agent:n,headers:f,hostname:m?r.slice(1,-1):r,path:`${o}${a}`,port:s,protocol:i,ca:t.caCerts},T=>{T.on("data",()=>{}),T.on("end",()=>{}),T.setEncoding("utf8");let S=T.headers["retry-after"]??null,R=T.headers["x-sentry-rate-limits"]??null;p({statusCode:T.statusCode,headers:{"retry-after":S,"x-sentry-rate-limits":Array.isArray(R)?R[0]||null:R}})});h.on("error",d),_.pipe(h)})})}}function $V(t){if(t===!1)return!1;if(typeof t=="string")return t;let e=Uc(process.env.SENTRY_SPOTLIGHT,{strict:!0}),n=e===null&&process.env.SENTRY_SPOTLIGHT?process.env.SENTRY_SPOTLIGHT:void 0;return t===!0?n??!0:e??n}import{posix as Cme,sep as Pme}from"node:path";function YV(t){return t.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function WV(t=process.argv[1]?My(process.argv[1]):process.cwd(),e=Pme==="\\"){let n=e?YV(t):t;return r=>{if(!r)return;let o=e?YV(r):r,{dir:s,base:i,ext:a}=Cme.parse(o);(a===".js"||a===".mjs"||a===".cjs")&&(i=i.slice(0,a.length*-1));let c=decodeURIComponent(i);s||(s=".");let l=s.lastIndexOf("/node_modules");if(l>-1)return`${s.slice(l+14).replace(/\//g,".")}:${c}`;if(s.startsWith(n)){let p=s.slice(n.length+1).replace(/\//g,".");return p?`${p}:${c}`:c}return c}}function zV(t){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(J.SENTRY_RELEASE?.id)return J.SENTRY_RELEASE.id;let e=process.env.GITHUB_SHA||process.env.CI_MERGE_REQUEST_SOURCE_BRANCH_SHA||process.env.CI_BUILD_REF||process.env.CI_COMMIT_SHA||process.env.BITBUCKET_COMMIT,n=process.env.APPVEYOR_PULL_REQUEST_HEAD_COMMIT||process.env.APPVEYOR_REPO_COMMIT||process.env.CODEBUILD_RESOLVED_SOURCE_VERSION||process.env.AWS_COMMIT_ID||process.env.BUILD_SOURCEVERSION||process.env.GIT_CLONE_COMMIT_HASH||process.env.BUDDY_EXECUTION_REVISION||process.env.BUILDKITE_COMMIT||process.env.CIRCLE_SHA1||process.env.CIRRUS_CHANGE_IN_REPO||process.env.CF_REVISION||process.env.CM_COMMIT||process.env.CF_PAGES_COMMIT_SHA||process.env.DRONE_COMMIT_SHA||process.env.FC_GIT_COMMIT_SHA||process.env.HEROKU_TEST_RUN_COMMIT_VERSION||process.env.HEROKU_BUILD_COMMIT||process.env.HEROKU_SLUG_COMMIT||process.env.RAILWAY_GIT_COMMIT_SHA||process.env.RENDER_GIT_COMMIT||process.env.SEMAPHORE_GIT_SHA||process.env.TRAVIS_PULL_REQUEST_SHA||process.env.VERCEL_GIT_COMMIT_SHA||process.env.VERCEL_GITHUB_COMMIT_SHA||process.env.VERCEL_GITLAB_COMMIT_SHA||process.env.VERCEL_BITBUCKET_COMMIT_SHA||process.env.ZEIT_GITHUB_COMMIT_SHA||process.env.ZEIT_GITLAB_COMMIT_SHA||process.env.ZEIT_BITBUCKET_COMMIT_SHA,r=process.env.CI_COMMIT_ID||process.env.SOURCE_COMMIT||process.env.SOURCE_VERSION||process.env.GIT_COMMIT||process.env.COMMIT_REF||process.env.BUILD_VCS_NUMBER||process.env.CI_COMMIT_SHA;return e||n||r||t}var KV=xf(cI(WV()));b();var XV=K(ne(),1);import*as QV from"node:os";import{threadId as Mme,isMainThread as xme}from"worker_threads";var vme=6e4,$h=class extends lp{constructor(e){let n=e.includeServerName===!1?void 0:e.serverName||global.process.env.SENTRY_NAME||QV.hostname(),r={...e,platform:"node",runtime:e.runtime||{name:"node",version:global.process.version},serverName:n};e.openTelemetryInstrumentations&&(0,XV.registerInstrumentations)({instrumentations:e.openTelemetryInstrumentations}),Ki(r,"node"),g.log(`Initializing Sentry: process: ${process.pid}, thread: ${xme?"main":`worker-${Mme}`}.`),super(r),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{Lc(this)},n&&this.on("beforeCaptureLog",o=>{o.attributes={...o.attributes,"server.address":n}}),process.on("beforeExit",this._logOnExitFlushListener))}get tracer(){if(this._tracer)return this._tracer;let e="@sentry/node",n=pe,r=X.getTracer(e,n);return this._tracer=r,r}async flush(e){return await this.traceProvider?.forceFlush(),this.getOptions().sendClientReports&&this._flushOutcomes(),super.flush(e)}async close(e){this._clientReportInterval&&clearInterval(this._clientReportInterval),this._clientReportOnExitFlushListener&&process.off("beforeExit",this._clientReportOnExitFlushListener),this._logOnExitFlushListener&&process.off("beforeExit",this._logOnExitFlushListener);let n=await super.close(e);return this.traceProvider&&await this.traceProvider.shutdown(),n}startClientReportTracking(){let e=this.getOptions();e.sendClientReports&&(this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{re&&g.log("Flushing client reports based on interval."),this._flushOutcomes()},e.clientReportFlushInterval??vme).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener))}_setupIntegrations(){yy(),super._setupIntegrations()}_getTraceInfoFromScope(e){return e?eV(this,e):[void 0,void 0]}};var JV=K(cR(),1);import*as ZV from"module";function MO(){if(MV()&&!J._sentryEsmLoaderHookRegistered){J._sentryEsmLoaderHookRegistered=!0;try{let{addHookMessagePort:t}=(0,JV.createAddHookMessageChannel)();ZV.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:t,include:[]},transferList:[t]})}catch(t){g.warn("Failed to register 'import-in-the-middle' hook",t)}}}function Yh(){return[_m(),pm(),fm(),mm(),HV(),Dy(),Tm(),yH(),CH(),UV(),wV(),gV(),CV(),fV(),pV(),kV(),DV()]}function xO(t={}){return Lme(t,Yh)}function Lme(t={},e){let n=Dme(t,e);n.debug===!0&&(re?g.enable():Qe(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),n.registerEsmLoaderHooks!==!1&&MO(),rV(),he().update(n.initialScope),n.spotlight&&!n.integrations.some(({name:s})=>s===bO)&&n.integrations.push(BV({sidecarUrl:typeof n.spotlight=="string"?n.spotlight:void 0})),Ki(n,"node-core");let o=new $h(n);return he().setClient(o),o.init(),g.log(`SDK initialized from ${jp()?"CommonJS":"ESM"}`),o.startClientReportTracking(),kme(),jF(o),nV(o),process.env.VERCEL&&process.on("SIGTERM",async()=>{await o.flush(200)}),o}function vO(){if(!re)return;let t=qF(),e=["SentryContextManager","SentryPropagator"];Xe()&&e.push("SentrySpanProcessor");for(let n of e)t.includes(n)||g.error(`You have to set up the ${n}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);t.includes("SentrySampler")||g.warn("You have to set up the SentrySampler. Without this, the OpenTelemetry & Sentry integration may still work, but sample rates set for the Sentry SDK will not be respected. If you use a custom sampler, make sure to use `wrapSamplingDecision`.")}function Dme(t,e){let n=Ume(t.release),r=$V(t.spotlight),o=wme(t.tracesSampleRate),s={...t,dsn:t.dsn??process.env.SENTRY_DSN,environment:t.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:t.sendClientReports??!0,transport:t.transport??qV,stackParser:yR(t.stackParser||KV),release:n,tracesSampleRate:o,spotlight:r,debug:Uc(t.debug??process.env.SENTRY_DEBUG)},i=t.integrations,a=t.defaultIntegrations??e(s);return{...s,integrations:my({defaultIntegrations:a,integrations:i})}}function Ume(t){if(t!==void 0)return t;let e=zV();if(e!==void 0)return e}function wme(t){if(t!==void 0)return t;let e=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!e)return;let n=parseFloat(e);return isFinite(n)?n:void 0}function kme(){if(Uc(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let t=process.env.SENTRY_TRACE,e=process.env.SENTRY_BAGGAGE,n=Kl(t,e);he().setPropagationContext(n)}}function Re(t,e){t.setAttribute(W,e)}function qp(t){let e=t.protocol||"",n=t.hostname||t.host||"",r=!t.port||t.port===80||t.port===443||/^(.*):(\d+)$/.test(n)?"":`:${t.port}`,o=t.path?t.path:"/";return`${e}//${n}${r}${o}`}var LO="Http",eq="@opentelemetry_sentry-patched/instrumentation-http",Wh=Lr.major===22&&Lr.minor>=12||Lr.major===23&&Lr.minor>=2||Lr.major>=24,Gme=w(`${LO}.sentry`,t=>new ra(t)),Bme=w(LO,t=>{let e=new tq.HttpInstrumentation({...t,disableIncomingRequestInstrumentation:!0});try{e._diag=wn.createComponentLogger({namespace:eq}),e.instrumentationName=eq}catch{}try{let n={get:()=>!1,set:()=>{}};Object.defineProperty(e,"_httpPatched",n),Object.defineProperty(e,"_httpsPatched",n)}catch{}return e});function jme(t,e={}){return typeof t.spans=="boolean"?t.spans:!(e.skipOpenTelemetrySetup||!Xe(e)&&Wh)}var nq=(t={})=>{let e=t.spans??!0,n=t.disableIncomingRequestSpans,r={sessions:t.trackIncomingRequestsAsSessions,sessionFlushingDelayMS:t.sessionFlushingDelayMS,ignoreRequestBody:t.ignoreIncomingRequestBody,maxRequestBodySize:t.maxIncomingRequestBodySize},o={ignoreIncomingRequests:t.ignoreIncomingRequests,ignoreStaticAssets:t.ignoreStaticAssets,ignoreStatusCodes:t.dropSpansForIncomingRequestStatusCodes,instrumentation:t.instrumentation,onSpanCreated:t.incomingRequestSpanHook},s=Op(r),i=Np(o),a=e&&!n;return{name:LO,setup(c){let l=c.getOptions();a&&Xe(l)&&i.setup(c)},setupOnce(){let c=H()?.getOptions()||{},l=jme(t,c);s.setupOnce();let p={breadcrumbs:t.breadcrumbs,propagateTraceInOutgoingRequests:typeof t.tracePropagation=="boolean"?t.tracePropagation:Wh||!l,createSpansForOutgoingRequests:Wh,spans:t.spans,ignoreOutgoingRequests:t.ignoreOutgoingRequests,outgoingRequestHook:(d,_)=>{let f=qp(_);if(f.startsWith("data:")){let m=wc(f);d.setAttribute("http.url",m),d.setAttribute(As,m),d.updateName(`${_.method||"GET"} ${m}`)}t.instrumentation?.requestHook?.(d,_)},outgoingResponseHook:t.instrumentation?.responseHook,outgoingRequestApplyCustomAttributes:t.instrumentation?.applyCustomAttributesOnSpan};if(Gme(p),l){let d=Hme(t);Bme(d)}},processEvent(c){return i.processEvent(c)}}};function Hme(t={}){return{disableOutgoingRequestInstrumentation:Wh,ignoreOutgoingRequestHook:n=>{let r=qp(n);if(!r)return!1;let o=t.ignoreOutgoingRequests;return!!o?.(r,n)},requireParentforOutgoingSpans:!1,requestHook:(n,r)=>{Re(n,"auto.http.otel.http");let o=qp(r);if(o.startsWith("data:")){let s=wc(o);n.setAttribute("http.url",s),n.setAttribute(As,s),n.updateName(`${r.method||"GET"} ${s}`)}t.instrumentation?.requestHook?.(n,r)},responseHook:(n,r)=>{t.instrumentation?.responseHook?.(n,r)},applyCustomAttributesOnSpan:(n,r,o)=>{t.instrumentation?.applyCustomAttributesOnSpan?.(n,r,o)}}}var cq=K(iq(),1);var uq="NodeFetch",qme=w(uq,cq.UndiciInstrumentation,t=>zme(t)),$me=w(`${uq}.sentry`,oa,t=>t),Yme=(t={})=>({name:"NodeFetch",setupOnce(){Wme(t,H()?.getOptions())&&qme(t),$me(t)}}),lq=Yme;function aq(t,e="/"){let n=`${t}`;return n.endsWith("/")&&e.startsWith("/")?`${n}${e.slice(1)}`:!n.endsWith("/")&&!e.startsWith("/")?`${n}/${e}`:`${n}${e}`}function Wme(t,e={}){return typeof t.spans=="boolean"?t.spans:!e.skipOpenTelemetrySetup&&Xe(e)}function zme(t={}){return{requireParentforSpans:!1,ignoreRequestHook:n=>{let r=aq(n.origin,n.path),o=t.ignoreOutgoingRequests;return!!(o&&r&&o(r))},startSpanHook:n=>{let r=aq(n.origin,n.path);if(r.startsWith("data:")){let o=wc(r);return{[W]:"auto.http.otel.node_fetch","http.url":o,[As]:o,[tr]:`${n.method||"GET"} ${o}`}}return{[W]:"auto.http.otel.node_fetch"}},requestHook:t.requestHook,responseHook:t.responseHook,headersToSpanAttributes:t.headersToSpanAttributes}}var Aq=K(gq(),1);var mt=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var Rq="Express";function lhe(t){Re(t,"auto.http.otel.express");let e=Y(t).data,n=e["express.type"];n&&t.setAttribute(ee,`${n}.express`);let r=e["express.name"];typeof r=="string"&&t.updateName(r)}function phe(t,e){if(ue()===er())return mt&&g.warn("Isolation scope is still default isolation scope - skipping setting transactionName"),e;if(t.layerType==="request_handler"){let n=t.request,r=n.method?n.method.toUpperCase():"GET";ue().setTransactionName(`${r} ${t.route}`)}return e}var yq=w(Rq,()=>new Aq.ExpressInstrumentation({requestHook:t=>lhe(t),spanNameHook:(t,e)=>phe(t,e)})),dhe=()=>({name:Rq,setupOnce(){yq()}}),Iq=dhe;var Q$=K(q$(),1);import*as RN from"node:diagnostics_channel";b();var UT=K(Te(),1),_a=K(ne(),1);le();var $o;(function(t){let e="fastify.name";t.FASTIFY_NAME=e;let n="fastify.type";t.FASTIFY_TYPE=n;let r="hook.name";t.HOOK_NAME=r;let o="plugin.name";t.PLUGIN_NAME=o})($o||($o={}));var ad;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request_handler";t.REQUEST_HANDLER=n})(ad||(ad={}));var cd;(function(t){let e="middleware";t.MIDDLEWARE=e;let n="request handler";t.REQUEST_HANDLER=n})(cd||(cd={}));b();var ud=Symbol("opentelemetry.instrumentation.fastify.request_active_span");function AN(t,e,n,r={}){let o=e.startSpan(n,{attributes:r}),s=t[ud]||[];return s.push(o),Object.defineProperty(t,ud,{enumerable:!1,configurable:!0,value:s}),o}function LT(t,e){let n=t[ud]||[];n.length&&(n.forEach(r=>{e&&(r.setStatus({code:Be.ERROR,message:e.message}),r.recordException(e)),r.end()}),delete t[ud])}function Y$(t,e,n){let r,o;try{o=t(),$$(o)&&o.then(s=>e(void 0,s),s=>e(s))}catch(s){r=s}finally{if(!$$(o)&&(e(r,o),r))throw r;return o}}function $$(t){return typeof t=="object"&&t&&typeof Object.getOwnPropertyDescriptor(t,"then")?.value=="function"||!1}var uSe="0.1.0",lSe="@sentry/instrumentation-fastify-v3",W$="anonymous",pSe=new Set(["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError"]),DT=class extends _a.InstrumentationBase{constructor(e={}){super(lSe,uSe,e)}init(){return[new _a.InstrumentationNodeModuleDefinition("fastify",[">=3.0.0 <4"],e=>this._patchConstructor(e))]}_hookOnRequest(){let e=this;return function(r,o,s){if(!e.isEnabled())return s();e._wrap(o,"send",e._patchSend());let i=r,a=(0,UT.getRPCMetadata)(P.active()),c=i.routeOptions?i.routeOptions.url:r.routerPath;c&&a?.type===UT.RPCType.HTTP&&(a.route=c);let l=r.method||"GET";ue().setTransactionName(`${l} ${c}`),s()}}_wrapHandler(e,n,r,o){let s=this;return this._diag.debug("Patching fastify route.handler function"),function(...i){if(!s.isEnabled())return r.apply(this,i);let a=r.name||e||W$,c=`${cd.MIDDLEWARE} - ${a}`,l=i[1],p=AN(l,s.tracer,c,{[$o.FASTIFY_TYPE]:ad.MIDDLEWARE,[$o.PLUGIN_NAME]:e,[$o.HOOK_NAME]:n}),d=o&&i[i.length-1];return d&&(i[i.length-1]=function(..._){LT(l),d.apply(this,_)}),P.with(X.setSpan(P.active(),p),()=>Y$(()=>r.apply(this,i),_=>{_ instanceof Error&&(p.setStatus({code:Be.ERROR,message:_.message}),p.recordException(_)),o||LT(l)}))}}_wrapAddHook(){let e=this;return this._diag.debug("Patching fastify server.addHook function"),function(n){return function(...o){let s=o[0],i=o[1],a=this.pluginName;if(!pSe.has(s))return n.apply(this,o);let c=typeof o[o.length-1]=="function"&&i.constructor.name!=="AsyncFunction";return n.apply(this,[s,e._wrapHandler(a,s,i,c)])}}}_patchConstructor(e){let n=this;function r(...o){let s=e.fastify.apply(this,o);return s.addHook("onRequest",n._hookOnRequest()),s.addHook("preHandler",n._hookPreHandler()),dSe(),n._wrap(s,"addHook",n._wrapAddHook()),s}return e.errorCodes!==void 0&&(r.errorCodes=e.errorCodes),r.fastify=r,r.default=r,r}_patchSend(){let e=this;return this._diag.debug("Patching fastify reply.send function"),function(r){return function(...s){let i=s[0];return e.isEnabled()?(0,_a.safeExecuteInTheMiddle)(()=>r.apply(this,s),a=>{!a&&i instanceof Error&&(a=i),LT(this,a)}):r.apply(this,s)}}}_hookPreHandler(){let e=this;return this._diag.debug("Patching fastify preHandler function"),function(r,o,s){if(!e.isEnabled())return s();let i=r,a=i.routeOptions?.handler||i.context?.handler,c=a?.name.startsWith("bound ")?a.name.substring(6):a?.name,l=`${cd.REQUEST_HANDLER} - ${c||this.pluginName||W$}`,p={[$o.PLUGIN_NAME]:this.pluginName,[$o.FASTIFY_TYPE]:ad.REQUEST_HANDLER,[oA]:i.routeOptions?i.routeOptions.url:r.routerPath};c&&(p[$o.FASTIFY_NAME]=c);let d=AN(o,e.tracer,l,p);z$(d);let{requestHook:_}=e.getConfig();return _&&(0,_a.safeExecuteInTheMiddle)(()=>_(d,{request:r}),f=>{f&&e._diag.error("request hook failed",f)},!0),P.with(X.setSpan(P.active(),d),()=>{s()})}}};function dSe(){let t=H();t&&t.on("spanStart",e=>{z$(e)})}function z$(t){let e=Y(t).data,n=e["fastify.type"];if(e[ee]||!n)return;t.setAttributes({[W]:"auto.http.otel.fastify",[ee]:`${n}.fastify`});let r=e["fastify.name"]||e["plugin.name"]||e["hook.name"];if(typeof r=="string"){let o=r.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");t.updateName(o)}}var wT="Fastify",X$=w(`${wT}.v3`,()=>new DT);function _Se(){let t=H();if(t)return t.getIntegrationByName(wT)}function K$(t,e,n,r){let o=_Se()?.getShouldHandleError()||eY;if(r==="diagnostics-channel"&&(this.diagnosticsChannelExists=!0),this.diagnosticsChannelExists&&r==="onError-hook"){mt&&g.warn("Fastify error handler was already registered via diagnostics channel.","You can safely remove `setupFastifyErrorHandler` call and set `shouldHandleError` on the integration options.");return}o(t,e,n)&&te(t,{mechanism:{handled:!1,type:"auto.function.fastify"}})}var J$=w(`${wT}.v5`,()=>{let t=new Q$.FastifyOtelInstrumentation,e=t.plugin();return RN.subscribe("fastify.initialization",n=>{let r=n.fastify;r?.register(e).after(o=>{o?mt&&g.error("Failed to setup Fastify instrumentation",o):(mSe(),r&&hSe(r))})}),RN.subscribe("tracing:fastify.request.handler:error",n=>{let{error:r,request:o,reply:s}=n;K$.call(K$,r,o,s,"diagnostics-channel")}),t}),fSe=({shouldHandleError:t})=>{let e;return{name:wT,setupOnce(){e=t||eY,X$(),J$()},getShouldHandleError(){return e},setShouldHandleError(n){e=n}}},Z$=(t={})=>fSe(t);function eY(t,e,n){let r=n.statusCode;return r>=500||r<=299}function tY(t){let e=Y(t),n=e.description,r=e.data,o=r["fastify.type"],s=o==="hook",i=o===n?.startsWith("handler -"),a=n==="request"||o==="request-handler";if(r[ee]||!i&&!a&&!s)return;let c=s?"hook":i?"middleware":a?"request_handler":"<unknown>";t.setAttributes({[W]:"auto.http.otel.fastify",[ee]:`${c}.fastify`});let l=r["fastify.name"]||r["plugin.name"]||r["hook.name"];if(typeof l=="string"){let p=l.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");t.updateName(p)}}function mSe(){let t=H();t&&t.on("spanStart",e=>{tY(e)})}function hSe(t){t.addHook("onRequest",async(e,n)=>{if(e.opentelemetry){let{span:s}=e.opentelemetry();s&&tY(s)}let r=e.routeOptions?.url,o=e.method||"GET";ue().setTransactionName(`${o} ${r}`)})}b();var RY=K(AY(),1);var yY="Graphql",IY=w(yY,RY.GraphQLInstrumentation,t=>{let e=NY(t);return{...e,responseHook(n,r){Re(n,"auto.graphql.otel.graphql"),r.errors?.length&&!Y(n).status&&n.setStatus({code:Be.ERROR});let s=Y(n).data,i=s["graphql.operation.type"],a=s["graphql.operation.name"];if(e.useOperationNameForRootSpan&&i){let c=je(n),p=Y(c).data[au]||[],d=a?`${i} ${a}`:`${i}`;Array.isArray(p)?(p.push(d),c.setAttribute(au,p)):typeof p=="string"?c.setAttribute(au,[p,d]):c.setAttribute(au,d),Y(c).data["original-description"]||c.setAttribute("original-description",Y(c).description),c.updateName(`${Y(c).data["original-description"]} (${kSe(p)})`)}}}}),wSe=(t={})=>({name:yY,setupOnce(){IY(NY(t))}}),OY=wSe;function NY(t){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...t}}function kSe(t){if(Array.isArray(t)){let e=t.slice().sort();return e.length<=5?e.join(", "):`${e.slice(0,5).join(", ")}, +${e.length-5}`}return`${t}`}var GY=K(kY(),1);var BY="Kafka",jY=w(BY,()=>new GY.KafkaJsInstrumentation({consumerHook(t){Re(t,"auto.kafkajs.otel.consumer")},producerHook(t){Re(t,"auto.kafkajs.otel.producer")}})),BSe=()=>({name:BY,setupOnce(){jY()}}),HY=BSe;var zY=K(WY(),1);var KY="LruMemoizer",QY=w(KY,()=>new zY.LruMemoizerInstrumentation),HSe=()=>({name:KY,setupOnce(){QY()}}),XY=HSe;var iW=K(sW(),1);var aW="Mongo",cW=w(aW,()=>new iW.MongoDBInstrumentation({dbStatementSerializer:YSe,responseHook(t){Re(t,"auto.db.otel.mongo")}}));function YSe(t){let e=xN(t);return JSON.stringify(e)}function xN(t){if(Array.isArray(t))return t.map(e=>xN(e));if(WSe(t)){let e={};return Object.entries(t).map(([n,r])=>[n,xN(r)]).reduce((n,r)=>(KSe(r)&&(n[r[0]]=r[1]),n),e)}return"?"}function WSe(t){return typeof t=="object"&&t!==null&&!zSe(t)}function zSe(t){let e=!1;return typeof Buffer<"u"&&(e=Buffer.isBuffer(t)),e}function KSe(t){return Array.isArray(t)}var QSe=()=>({name:aW,setupOnce(){cW()}}),uW=QSe;var gW=K(SW(),1);var AW="Mongoose",RW=w(AW,()=>new gW.MongooseInstrumentation({responseHook(t){Re(t,"auto.db.otel.mongoose")}})),sge=()=>({name:AW,setupOnce(){RW()}}),yW=sge;var xW=K(MW(),1);var vW="Mysql",LW=w(vW,()=>new xW.MySQLInstrumentation({})),mge=()=>({name:vW,setupOnce(){LW()}}),DW=mge;var FW=K(HW(),1);var VW="Mysql2",qW=w(VW,()=>new FW.MySQL2Instrumentation({responseHook(t){Re(t,"auto.db.otel.mysql2")}})),Mge=()=>({name:VW,setupOnce(){qW()}}),$W=Mge;var Tz=K(ZW(),1),Ez=K(dz(),1);var Kge=["get","set","setex"],JN=["get","mget"],Qge=["set","setex"];function yd(t,e){return t.includes(e.toLowerCase())}function ZN(t){return yd(JN,t)?"cache.get":yd(Qge,t)?"cache.put":void 0}function Xge(t,e){return e.some(n=>t.startsWith(n))}function fz(t,e){try{if(e.length===0)return;let n=o=>typeof o=="string"||typeof o=="number"||Buffer.isBuffer(o)?[o.toString()]:Array.isArray(o)?_z(o.map(s=>n(s))):["<unknown>"],r=e[0];return yd(Kge,t)&&r!=null?n(r):_z(e.map(o=>n(o)))}catch{return}}function mz(t,e,n){if(!ZN(t))return!1;for(let r of e)if(Xge(r,n))return!0;return!1}function hz(t){let e=n=>{try{return Buffer.isBuffer(n)?n.byteLength:typeof n=="string"?n.length:typeof n=="number"?n.toString().length:n==null?0:JSON.stringify(n).length}catch{return}};return Array.isArray(t)?t.reduce((n,r)=>{let o=e(r);return typeof o=="number"?n!==void 0?n+o:o:n},0):e(t)}function _z(t){let e=[],n=r=>{r.forEach(o=>{Array.isArray(o)?n(o):e.push(o)})};return n(t),e}var SE="Redis",Id={},Sz=(t,e,n,r)=>{t.setAttribute(W,"auto.db.otel.redis");let o=fz(e,n),s=ZN(e);if(!o||!s||!Id.cachePrefixes||!mz(e,o,Id.cachePrefixes))return;let i=Y(t).data["net.peer.name"],a=Y(t).data["net.peer.port"];a&&i&&t.setAttributes({"network.peer.address":i,"network.peer.port":a});let c=hz(r);c&&t.setAttribute(KR,c),yd(JN,e)&&c!==void 0&&t.setAttribute(WR,c>0),t.setAttributes({[ee]:s,[zR]:o});let l=o.join(", ");t.updateName(Id.maxCacheKeyLength?hs(l,Id.maxCacheKeyLength):l)},Jge=w(`${SE}.IORedis`,()=>new Tz.IORedisInstrumentation({responseHook:Sz})),Zge=w(`${SE}.Redis`,()=>new Ez.RedisInstrumentation({responseHook:Sz})),gz=Object.assign(()=>{Jge(),Zge()},{id:SE}),eAe=(t={})=>({name:SE,setupOnce(){Id=t,gz()}}),Az=eAe;var Gz=K(kz(),1);var Bz="Postgres",jz=w(Bz,Gz.PgInstrumentation,t=>({requireParentSpan:!0,requestHook(e){Re(e,"auto.db.otel.postgres")},ignoreConnectSpans:t?.ignoreConnectSpans??!1})),mAe=t=>({name:Bz,setupOnce(){jz(t)}}),Hz=mAe;b();var ei=K(ne(),1);le();var ib="PostgresJs",Fz=[">=3.0.0 <4"],hAe=/^(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)/i,TAe=Symbol.for("sentry.query.from.instrumented.sql"),Vz=w(ib,t=>new sb({requireParentSpan:t?.requireParentSpan??!0,requestHook:t?.requestHook})),sb=class extends ei.InstrumentationBase{constructor(e){super("sentry-postgres-js",pe,e)}init(){let e=new ei.InstrumentationNodeModuleDefinition("postgres",Fz,n=>{try{return this._patchPostgres(n)}catch(r){return mt&&g.error("Failed to patch postgres module:",r),n}},n=>n);return["src","cf/src","cjs/src"].forEach(n=>{e.files.push(new ei.InstrumentationNodeModuleFile(`postgres/${n}/query.js`,Fz,this._patchQueryPrototype.bind(this),this._unpatchQueryPrototype.bind(this)))}),e}_patchPostgres(e){let n=typeof e=="function",r=n?e:e.default;if(typeof r!="function")return mt&&g.warn("postgres module does not export a function. Skipping instrumentation."),e;let o=this,s=function(...i){let a=Reflect.construct(r,i);if(!a||typeof a!="function")return mt&&g.warn("postgres() did not return a valid instance"),a;let c=o.getConfig();return Ly(a,{requireParentSpan:c.requireParentSpan,requestHook:c.requestHook})};Object.setPrototypeOf(s,r),Object.setPrototypeOf(s.prototype,r.prototype);for(let i of Object.getOwnPropertyNames(r))if(!["length","name","prototype"].includes(i)){let a=Object.getOwnPropertyDescriptor(r,i);a&&Object.defineProperty(s,i,a)}return n?s:(Rp(e,"default",s),e)}_shouldCreateSpans(){let e=this.getConfig();return X.getSpan(P.active())!==void 0||!e.requireParentSpan}_setOperationName(e,n,r){if(r){e.setAttribute(ec,r);return}let o=n?.match(hAe);o?.[1]&&e.setAttribute(ec,o[1].toUpperCase())}_reconstructQuery(e){if(e?.length)return e.length===1?e[0]||void 0:e.reduce((n,r,o)=>o===0?r:`${n}$${o}${r}`,"")}_sanitizeSqlQuery(e){return e?e.replace(/--.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"").replace(/;\s*$/,"").replace(/\s+/g," ").trim().replace(/\bX'[0-9A-Fa-f]*'/gi,"?").replace(/\bB'[01]*'/gi,"?").replace(/'(?:[^']|'')*'/g,"?").replace(/\b0x[0-9A-Fa-f]+/gi,"?").replace(/\b(?:TRUE|FALSE)\b/gi,"?").replace(/-?\b\d+\.?\d*[eE][+-]?\d+\b/g,"?").replace(/-?\b\d+\.\d+\b/g,"?").replace(/-?\.\d+\b/g,"?").replace(/(?<!\$)-?\b\d+\b/g,"?").replace(/\bIN\b\s*\(\s*\?(?:\s*,\s*\?)*\s*\)/gi,"IN (?)").replace(/\bIN\b\s*\(\s*\$\d+(?:\s*,\s*\$\d+)*\s*\)/gi,"IN ($?)"):"Unknown SQL Query"}_patchQueryPrototype(e){let n=this,r=e.Query.prototype.handle;return e.Query.prototype.handle=async function(...o){if(this[TAe])return r.apply(this,o);if(!n._shouldCreateSpans())return r.apply(this,o);let s=n._reconstructQuery(this.strings),i=n._sanitizeSqlQuery(s);return It({name:i||"postgresjs.query",op:"db"},a=>{Re(a,"auto.db.postgresjs"),a.setAttributes({[Mi]:"postgres",[pA]:i});let c=n.getConfig(),{requestHook:l}=c;l&&(0,ei.safeExecuteInTheMiddle)(()=>l(a,i,void 0),_=>{_&&(a.setAttribute("sentry.hook.error","requestHook failed"),mt&&g.error(`Error in requestHook for ${ib} integration:`,_))},!0);let p=this.resolve;this.resolve=new Proxy(p,{apply:(_,f,m)=>{try{n._setOperationName(a,i,m?.[0]?.command),a.end()}catch(h){mt&&g.error("Error ending span in resolve callback:",h)}return Reflect.apply(_,f,m)}});let d=this.reject;this.reject=new Proxy(d,{apply:(_,f,m)=>{try{a.setStatus({code:2,message:m?.[0]?.message||"unknown_error"}),a.setAttribute(dA,m?.[0]?.code||"unknown"),a.setAttribute(_A,m?.[0]?.name||"unknown"),n._setOperationName(a,i),a.end()}catch(h){mt&&g.error("Error ending span in reject callback:",h)}return Reflect.apply(_,f,m)}});try{return r.apply(this,o)}catch(_){throw a.setStatus({code:2,message:_ instanceof Error?_.message:"unknown_error"}),a.end(),_}})},e.Query.prototype.handle.__sentry_original__=r,e}_unpatchQueryPrototype(e){return e.Query.prototype.handle.__sentry_original__&&(e.Query.prototype.handle=e.Query.prototype.handle.__sentry_original__),e}},EAe=t=>({name:ib,setupOnce(){Vz(t)}}),qz=EAe;b();b();var WE=K(bK(),1);b();var BRe={name:"@prisma/instrumentation-contract",version:"7.6.0",description:"Shared types and utilities for Prisma instrumentation",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{require:{types:"./dist/index.d.ts",default:"./dist/index.js"},import:{types:"./dist/index.d.mts",default:"./dist/index.mjs"}}},license:"Apache-2.0",homepage:"https://www.prisma.io",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/instrumentation-contract"},bugs:"https://github.com/prisma/prisma/issues",scripts:{dev:"DEV=true tsx helpers/build.ts",build:"tsx helpers/build.ts",prepublishOnly:"pnpm run build",test:"vitest run"},files:["dist"],sideEffects:!1,devDependencies:{"@opentelemetry/api":"1.9.0"},peerDependencies:{"@opentelemetry/api":"^1.8"}},jRe=BRe.version.split(".")[0],Mb="PRISMA_INSTRUMENTATION",xb=`V${jRe}_PRISMA_INSTRUMENTATION`,Yu=globalThis;function HRe(){let t=Yu[xb];return t?.helper?t.helper:Yu[Mb]?.helper}function FRe(t){let e={helper:t};Yu[xb]=e,Yu[Mb]=e}function VRe(){delete Yu[xb],delete Yu[Mb]}var qRe=process.env.PRISMA_SHOW_ALL_TRACES==="true",$Re="00-10-10-00";function YRe(t){switch(t){case"client":return Ne.CLIENT;case"internal":default:return Ne.INTERNAL}}var WRe=class{tracerProvider;ignoreSpanTypes;constructor({tracerProvider:t,ignoreSpanTypes:e}){this.tracerProvider=t,this.ignoreSpanTypes=e}isEnabled(){return!0}getTraceParent(t){let e=X.getSpanContext(t??P.active());return e?`00-${e.traceId}-${e.spanId}-0${e.traceFlags}`:$Re}dispatchEngineSpans(t){let e=this.tracerProvider.getTracer("prisma"),n=new Map,r=t.filter(o=>o.parentId===null);for(let o of r)MK(e,o,t,n,this.ignoreSpanTypes)}getActiveContext(){return P.active()}runInChildSpan(t,e){if(typeof t=="string"&&(t={name:t}),t.internal&&!qRe)return e();let n=this.tracerProvider.getTracer("prisma"),r=t.context??this.getActiveContext(),o=`prisma:client:${t.name}`;if(xK(o,this.ignoreSpanTypes))return e();if(t.active===!1){let s=n.startSpan(o,t,r);return CK(s,e(s,r))}return n.startActiveSpan(o,t,s=>CK(s,e(s,r)))}};function MK(t,e,n,r,o){if(xK(e.name,o))return;let s={attributes:e.attributes,kind:YRe(e.kind),startTime:e.startTime};t.startActiveSpan(e.name,s,i=>{r.set(e.id,i.spanContext().spanId),e.links&&i.addLinks(e.links.flatMap(c=>{let l=r.get(c);return l?{context:{spanId:l,traceId:i.spanContext().traceId,traceFlags:i.spanContext().traceFlags}}:[]}));let a=n.filter(c=>c.parentId===e.id);for(let c of a)MK(t,c,n,r,o);i.end(e.endTime)})}function CK(t,e){return zRe(e)?e.then(n=>(t.end(),n),n=>{throw t.end(),n}):(t.end(),e)}function zRe(t){return t!=null&&typeof t.then=="function"}function xK(t,e){return e.some(n=>typeof n=="string"?n===t:n.test(t))}var vK={name:"@prisma/instrumentation",version:"7.6.0",description:"OpenTelemetry compliant instrumentation for Prisma Client",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{require:{types:"./dist/index.d.ts",default:"./dist/index.js"},import:{types:"./dist/index.d.ts",default:"./dist/index.mjs"}}},license:"Apache-2.0",homepage:"https://www.prisma.io",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/instrumentation"},bugs:"https://github.com/prisma/prisma/issues",devDependencies:{"@opentelemetry/api":"1.9.0","@prisma/instrumentation-contract":"workspace:*","@types/node":"~20.19.24",typescript:"5.4.5"},dependencies:{"@opentelemetry/instrumentation":"^0.207.0"},peerDependencies:{"@opentelemetry/api":"^1.8"},files:["dist"],keywords:["prisma","instrumentation","opentelemetry","otel"],scripts:{dev:"DEV=true tsx helpers/build.ts",build:"tsx helpers/build.ts",prepublishOnly:"pnpm run build",test:"vitest run"},sideEffects:!1},PK=vK.version,KRe=vK.name,QRe="@prisma/client",LK=class extends WE.InstrumentationBase{tracerProvider;constructor(t={}){super(KRe,PK,t)}setTracerProvider(t){this.tracerProvider=t}init(){return[new WE.InstrumentationNodeModuleDefinition(QRe,[PK])]}enable(){let t=this._config;FRe(new WRe({tracerProvider:this.tracerProvider??X.getTracerProvider(),ignoreSpanTypes:t.ignoreSpanTypes??[]}))}disable(){VRe()}isEnabled(){return HRe()!==void 0}};var DK="Prisma";function XRe(t){return!!t&&typeof t=="object"&&"dispatchEngineSpans"in t}function UK(){let t=globalThis.PRISMA_INSTRUMENTATION;return t&&typeof t=="object"&&"helper"in t?t.helper:void 0}var vb=class extends LK{constructor(e){super(e?.instrumentationConfig)}enable(){super.enable();let e=UK();XRe(e)&&(e.createEngineSpan=n=>{let r=X.getTracer("prismaV5Compatibility"),o=r._idGenerator;if(!o){Qe(()=>{console.warn("[Sentry] Could not find _idGenerator on tracer, skipping Prisma v5 compatibility - some Prisma spans may be missing!")});return}try{n.spans.forEach(s=>{let i=JRe(s.kind),a=s.parent_span_id,c=s.span_id,l=s.trace_id,p=s.links?.map(_=>({context:{traceId:_.trace_id,spanId:_.span_id,traceFlags:Vt.SAMPLED}})),d=X.setSpanContext(P.active(),{traceId:l,spanId:a,traceFlags:Vt.SAMPLED});P.with(d,()=>{let _={generateTraceId:()=>l,generateSpanId:()=>c};r._idGenerator=_,r.startSpan(s.name,{kind:i,links:p,startTime:s.start_time,attributes:s.attributes}).end(s.end_time),r._idGenerator=o})})}finally{r._idGenerator=o}})}};function JRe(t){switch(t){case"client":return Ne.CLIENT;case"internal":default:return Ne.INTERNAL}}var ZRe=w(DK,t=>new vb(t)),wK=t=>({name:DK,setupOnce(){ZRe(t)},setup(e){UK()&&e.on("spanStart",n=>{let r=Y(n);r.description?.startsWith("prisma:")&&n.setAttribute(W,"auto.db.otel.prisma"),r.description==="prisma:engine:db_query"&&r.data["db.query.text"]&&n.updateName(r.data["db.query.text"]),r.description==="prisma:engine:db_query"&&!r.data["db.system"]&&n.setAttribute("db.system","prisma")})}});var YK=K($K(),1);var WK="Hapi",zK=w(WK,()=>new YK.HapiInstrumentation),dye=()=>({name:WK,setupOnce(){zK()}}),KK=dye;le();var oi={HONO_TYPE:"hono.type",HONO_NAME:"hono.name"},Gd={MIDDLEWARE:"middleware",REQUEST_HANDLER:"request_handler"};b();var XE=K(ne(),1);var _ye="@sentry/instrumentation-hono",fye="0.0.1",QE=class extends XE.InstrumentationBase{constructor(e={}){super(_ye,fye,e)}init(){return[new XE.InstrumentationNodeModuleDefinition("hono",[">=4.0.0 <5"],e=>this._patch(e))]}_patch(e){let n=this;class r extends e.Hono{constructor(...s){super(...s),n._wrap(this,"get",n._patchHandler()),n._wrap(this,"post",n._patchHandler()),n._wrap(this,"put",n._patchHandler()),n._wrap(this,"delete",n._patchHandler()),n._wrap(this,"options",n._patchHandler()),n._wrap(this,"patch",n._patchHandler()),n._wrap(this,"all",n._patchHandler()),n._wrap(this,"on",n._patchOnHandler()),n._wrap(this,"use",n._patchMiddlewareHandler())}}try{e.Hono=r}catch{return{...e,Hono:r}}return e}_patchHandler(){let e=this;return function(n){return function(...o){if(typeof o[0]=="string"){let s=o[0];if(o.length===1)return n.apply(this,[s]);let i=o.slice(1);return n.apply(this,[s,...i.map(a=>e._wrapHandler(a))])}return n.apply(this,o.map(s=>e._wrapHandler(s)))}}}_patchOnHandler(){let e=this;return function(n){return function(...o){let s=o.slice(2);return n.apply(this,[...o.slice(0,2),...s.map(i=>e._wrapHandler(i))])}}}_patchMiddlewareHandler(){let e=this;return function(n){return function(...o){if(typeof o[0]=="string"){let s=o[0];if(o.length===1)return n.apply(this,[s]);let i=o.slice(1);return n.apply(this,[s,...i.map(a=>e._wrapHandler(a))])}return n.apply(this,o.map(s=>e._wrapHandler(s)))}}}_wrapHandler(e){let n=this;return function(r,o){if(!n.isEnabled())return e.apply(this,[r,o]);let s=r.req.path,i=n.tracer.startSpan(s);return P.with(X.setSpan(P.active(),i),()=>n._safeExecute(()=>{let a=e.apply(this,[r,o]);if(Lt(a))return a.then(c=>{let l=n._determineHandlerType(c);return i.setAttributes({[oi.HONO_TYPE]:l,[oi.HONO_NAME]:l===Gd.REQUEST_HANDLER?s:e.name||"anonymous"}),n.getConfig().responseHook?.(i),c});{let c=n._determineHandlerType(a);return i.setAttributes({[oi.HONO_TYPE]:c,[oi.HONO_NAME]:c===Gd.REQUEST_HANDLER?s:e.name||"anonymous"}),n.getConfig().responseHook?.(i),a}},()=>i.end(),a=>{n._handleError(i,a),i.end()}))}}_safeExecute(e,n,r){try{let o=e();return Lt(o)?o.then(()=>n(),s=>r(s)):n(),o}catch(o){throw r(o),o}}_determineHandlerType(e){return e===void 0?Gd.MIDDLEWARE:Gd.REQUEST_HANDLER}_handleError(e,n){n instanceof Error&&(e.setStatus({code:Be.ERROR,message:n.message}),e.recordException(n))}};var QK="Hono";function mye(t){let e=Y(t).data,n=e[oi.HONO_TYPE];if(e[ee]||!n)return;t.setAttributes({[W]:"auto.http.otel.hono",[ee]:`${n}.hono`});let r=e[oi.HONO_NAME];if(typeof r=="string"&&t.updateName(r),ue()===er()){mt&&g.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let o=e[Co],s=e[xi];typeof o=="string"&&typeof s=="string"&&ue().setTransactionName(`${s} ${o}`)}var XK=w(QK,()=>new QE({responseHook:t=>{mye(t)}})),hye=()=>({name:QK,setupOnce(){XK()}}),JK=hye;var l2=K(u2(),1);le();var p2="Koa",d2=w(p2,l2.KoaInstrumentation,(t={})=>({ignoreLayersType:t.ignoreLayersType,requestHook(e,n){Re(e,"auto.http.otel.koa");let r=Y(e).data,o=r["koa.type"];o&&e.setAttribute(ee,`${o}.koa`);let s=r["koa.name"];if(typeof s=="string"&&e.updateName(s||"< unknown >"),ue()===er()){mt&&g.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let i=r[Co],a=n.context?.request?.method?.toUpperCase()||"GET";i&&ue().setTransactionName(`${a} ${i}`)}})),Oye=(t={})=>({name:p2,setupOnce(){d2(t)}}),_2=Oye;var R2=K(A2(),1);var y2="Connect",I2=w(y2,()=>new R2.ConnectInstrumentation),Uye=()=>({name:y2,setupOnce(){I2()}}),O2=Uye;var U2=K(D2(),1);var jye=new Set(["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"]),w2="Tedious",k2=w(w2,()=>new U2.TediousInstrumentation({})),Hye=()=>{let t;return{name:w2,setupOnce(){let e=k2();t=Ip(e)},setup(e){t?.(()=>e.on("spanStart",n=>{let{description:r,data:o}=Y(n);if(!r||o["db.system"]!=="mssql")return;let s=r.split(" ")[0]||"";jye.has(s)&&n.setAttribute(W,"auto.db.otel.tedious")}))}}},G2=Hye;var V2=K(F2(),1);var q2="GenericPool",$2=w(q2,()=>new V2.GenericPoolInstrumentation({})),Vye=()=>{let t;return{name:q2,setupOnce(){let e=$2();t=Ip(e)},setup(e){t?.(()=>e.on("spanStart",n=>{let o=Y(n).description;(o==="generic-pool.aquire"||o==="generic-pool.acquire")&&n.setAttribute(W,"auto.db.otel.generic_pool")}))}}},Y2=Vye;var n4=K(t4(),1);var r4="Amqplib",eIe={consumeEndHook:t=>{Re(t,"auto.amqplib.otel.consumer")},publishHook:t=>{Re(t,"auto.amqplib.otel.publisher")}},o4=w(r4,()=>new n4.AmqplibInstrumentation(eIe)),tIe=()=>({name:r4,setupOnce(){o4()}}),s4=tIe;var Vd="VercelAI";var fS=K(ne(),1);var nIe=[">=3.0.0 <7"],i4=["generateText","streamText","generateObject","streamObject","embed","embedMany","rerank"];function rIe(t){if(typeof t!="object"||t===null)return!1;let e=t;return"type"in e&&"error"in e&&"toolName"in e&&"toolCallId"in e&&e.type==="tool-error"&&e.error instanceof Error}function oIe(t){if(typeof t!="object"||t===null||!("content"in t))return;let e=t;Array.isArray(e.content)&&(sIe(e.content),iIe(e.content))}function sIe(t){for(let e of t){if(!rIe(e))continue;let n=Zy(e.toolCallId);n?Gn(r=>{r.setContext("trace",{trace_id:n.traceId,span_id:n.spanId}),r.setTag("vercel.ai.tool.name",e.toolName),r.setTag("vercel.ai.tool.callId",e.toolCallId),r.setLevel("error"),te(e.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})}):Gn(r=>{r.setTag("vercel.ai.tool.name",e.toolName),r.setTag("vercel.ai.tool.callId",e.toolCallId),r.setLevel("error"),te(e.error,{mechanism:{type:"auto.vercelai.otel",handled:!1}})})}}function iIe(t){for(let e of t)typeof e=="object"&&e!==null&&"toolCallId"in e&&typeof e.toolCallId=="string"&&eI(e.toolCallId)}function aIe(t,e,n,r){let o=t?.recordInputs!==void 0?t.recordInputs:e.recordInputs!==void 0?e.recordInputs:n===!0?!0:r,s=t?.recordOutputs!==void 0?t.recordOutputs:e.recordOutputs!==void 0?e.recordOutputs:n===!0?!0:r;return{recordInputs:o,recordOutputs:s}}var _S=class t extends fS.InstrumentationBase{__init(){this._isPatched=!1}__init2(){this._callbacks=[]}constructor(e={}){super("@sentry/instrumentation-vercel-ai",pe,e),t.prototype.__init.call(this),t.prototype.__init2.call(this)}init(){return new fS.InstrumentationNodeModuleDefinition("ai",nIe,this._patch.bind(this))}callWhenPatched(e){this._isPatched?e():this._callbacks.push(e)}_patch(e){this._isPatched=!0,this._callbacks.forEach(r=>r()),this._callbacks=[];let n=r=>new Proxy(r,{apply:(o,s,i)=>{let a=i[0].experimental_telemetry||{},c=a.isEnabled,l=H(),p=l?.getIntegrationByName(Vd),d=p?.options,_=p?!!l?.getOptions().sendDefaultPii:!1,{recordInputs:f,recordOutputs:m}=aIe(d,a,c,_);return i[0].experimental_telemetry={...a,isEnabled:c!==void 0?c:!0,recordInputs:f,recordOutputs:m},Mr(()=>Reflect.apply(o,s,i),h=>{h&&typeof h=="object"&&nt(h,"_sentry_active_span",nr())},()=>{},h=>{oIe(h)})}});if(Object.prototype.toString.call(e)==="[object Module]"){for(let r of i4)e[r]!=null&&(e[r]=n(e[r]));return e}else{let r=i4.reduce((o,s)=>(e[s]!=null&&(o[s]=n(e[s])),o),{});return{...e,...r}}}};var a4=w(Vd,()=>new _S({}));function cIe(t){return!!t.getIntegrationByName("Modules")?.getModules?.()?.ai}var uIe=(t={})=>{let e;return{name:Vd,options:t,setupOnce(){e=a4()},afterAllSetup(n){t.force??cIe(n)?Nm(n):e?.callWhenPatched(()=>Nm(n))}}},c4=uIe;var hS=K(ne(),1);var lIe=[">=4.0.0 <7"],mS=class extends hS.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-openai",pe,e)}init(){return new hS.InstrumentationNodeModuleDefinition("openai",lIe,this._patch.bind(this))}_patch(e){let n=e;return n=this._patchClient(n,"OpenAI"),n=this._patchClient(n,"AzureOpenAI"),n}_patchClient(e,n){let r=e[n];if(!r)return e;let o=this.getConfig(),s=function(...i){if(zi(ws))return Reflect.construct(r,i);let a=Reflect.construct(r,i);return Cm(a,o)};Object.setPrototypeOf(s,r),Object.setPrototypeOf(s.prototype,r.prototype);for(let i of Object.getOwnPropertyNames(r))if(!["length","name","prototype"].includes(i)){let a=Object.getOwnPropertyDescriptor(r,i);a&&Object.defineProperty(s,i,a)}try{e[n]=s}catch{Object.defineProperty(e,n,{value:s,writable:!0,configurable:!0,enumerable:!0})}if(e.default===r)try{e.default=s}catch{Object.defineProperty(e,"default",{value:s,writable:!0,configurable:!0,enumerable:!0})}return e}};var u4=w(ws,t=>new mS(t)),pIe=(t={})=>({name:ws,setupOnce(){u4(t)}}),l4=pIe;var ES=K(ne(),1);var dIe=[">=0.19.2 <1.0.0"],TS=class extends ES.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-anthropic-ai",pe,e)}init(){return new ES.InstrumentationNodeModuleDefinition("@anthropic-ai/sdk",dIe,this._patch.bind(this))}_patch(e){let n=e.Anthropic,r=this.getConfig(),o=function(...s){if(zi(ks))return Reflect.construct(n,s);let i=Reflect.construct(n,s);return Pm(i,r)};Object.setPrototypeOf(o,n),Object.setPrototypeOf(o.prototype,n.prototype);for(let s of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(s)){let i=Object.getOwnPropertyDescriptor(n,s);i&&Object.defineProperty(o,s,i)}try{e.Anthropic=o}catch{Object.defineProperty(e,"Anthropic",{value:o,writable:!0,configurable:!0,enumerable:!0})}if(e.default===n)try{e.default=o}catch{Object.defineProperty(e,"default",{value:o,writable:!0,configurable:!0,enumerable:!0})}return e}};var p4=w(ks,t=>new TS(t)),_Ie=(t={})=>({name:ks,options:t,setupOnce(){p4(t)}}),d4=_Ie;var sl=K(ne(),1);var _4=[">=0.10.0 <2"],SS=class extends sl.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-google-genai",pe,e)}init(){return new sl.InstrumentationNodeModuleDefinition("@google/genai",_4,n=>this._patch(n),n=>n,[new sl.InstrumentationNodeModuleFile("@google/genai/dist/node/index.cjs",_4,n=>this._patch(n),n=>n)])}_patch(e){let n=e.GoogleGenAI,r=this.getConfig();if(typeof n!="function")return e;let o=function(...s){if(zi(Gs))return Reflect.construct(n,s);let i=Reflect.construct(n,s);return Mm(i,r)};Object.setPrototypeOf(o,n),Object.setPrototypeOf(o.prototype,n.prototype);for(let s of Object.getOwnPropertyNames(n))if(!["length","name","prototype"].includes(s)){let i=Object.getOwnPropertyDescriptor(n,s);i&&Object.defineProperty(o,s,i)}return Rp(e,"GoogleGenAI",o),e}};var f4=w(Gs,t=>new SS(t)),fIe=(t={})=>({name:Gs,setupOnce(){f4(t)}}),m4=fIe;var _i=K(ne(),1);var gS=[">=0.1.0 <2.0.0"];function mIe(t,e){return t?Array.isArray(t)?t.includes(e)?t:[...t,e]:typeof t=="object"?[t,e]:t:[e]}function hIe(t,e,n){return new Proxy(t,{apply(r,o,s){let a=s[1];(!a||typeof a!="object"||Array.isArray(a))&&(a={},s[1]=a);let c=a.callbacks,l=mIe(c,e);return a.callbacks=l,Reflect.apply(r,o,s)}})}var AS=class extends _i.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langchain",pe,e)}init(){let e=[],n=["@langchain/anthropic","@langchain/openai","@langchain/google-genai","@langchain/mistralai","@langchain/google-vertexai","@langchain/groq"];for(let r of n)e.push(new _i.InstrumentationNodeModuleDefinition(r,gS,this._patch.bind(this),o=>o,[new _i.InstrumentationNodeModuleFile(`${r}/dist/index.cjs`,gS,this._patch.bind(this),o=>o)]));return e.push(new _i.InstrumentationNodeModuleDefinition("langchain",gS,this._patch.bind(this),r=>r,[new _i.InstrumentationNodeModuleFile("langchain/dist/chat_models/universal.cjs",gS,this._patch.bind(this),r=>r)])),e}_patch(e){Ry([ws,ks,Gs]);let n=vm(this.getConfig());return this._patchRunnableMethods(e,n),e}_patchRunnableMethods(e,n){let r=["ChatAnthropic","ChatOpenAI","ChatGoogleGenerativeAI","ChatMistralAI","ChatVertexAI","ChatGroq","ConfigurableModel"],o=e.universal_exports??e,s=Object.values(o).find(c=>typeof c=="function"&&r.includes(c.name));if(!s)return;let i=s.prototype;if(i.__sentry_patched__)return;i.__sentry_patched__=!0;let a=["invoke","stream","batch"];for(let c of a){let l=i[c];typeof l=="function"&&(i[c]=hIe(l,n))}}};var h4=w(xm,t=>new AS(t)),TIe=(t={})=>({name:xm,setupOnce(){h4(t)}}),T4=TIe;var il=K(ne(),1);var E4=[">=0.0.0 <2.0.0"],RS=class extends il.InstrumentationBase{constructor(e={}){super("@sentry/instrumentation-langgraph",pe,e)}init(){return new il.InstrumentationNodeModuleDefinition("@langchain/langgraph",E4,this._patch.bind(this),n=>n,[new il.InstrumentationNodeModuleFile("@langchain/langgraph/dist/index.cjs",E4,this._patch.bind(this),n=>n)])}_patch(e){return e.StateGraph&&typeof e.StateGraph=="function"&&Dm(e.StateGraph.prototype,this.getConfig()),e}};var S4=w(Lm,t=>new RS(t)),EIe=(t={})=>({name:Lm,setupOnce(){S4(t)}}),g4=EIe;var C4=K(ne(),1);b();var Xo=K(ne(),1);le();import*as R4 from"node:net";function y4(t,e,n,r,o){let i=()=>{},a=o.firestoreSpanCreationHook;typeof a=="function"&&(i=p=>{(0,Xo.safeExecuteInTheMiddle)(()=>a(p),d=>{d&&wn.error(d?.message)},!0)});let c=new Xo.InstrumentationNodeModuleDefinition("@firebase/firestore",e,p=>A4(p,n,r,t,i)),l=["@firebase/firestore/dist/lite/index.node.cjs.js","@firebase/firestore/dist/lite/index.node.mjs.js","@firebase/firestore/dist/lite/index.rn.esm2017.js","@firebase/firestore/dist/lite/index.cjs.js"];for(let p of l)c.files.push(new Xo.InstrumentationNodeModuleFile(p,e,d=>A4(d,n,r,t,i),d=>I4(d,r)));return c}function A4(t,e,n,r,o){return I4(t,n),e(t,"addDoc",SIe(r,o)),e(t,"getDocs",AIe(r,o)),e(t,"setDoc",RIe(r,o)),e(t,"deleteDoc",gIe(r,o)),t}function I4(t,e){for(let n of["addDoc","getDocs","setDoc","deleteDoc"])(0,Xo.isWrapped)(t[n])&&e(t,n);return t}function SIe(t,e){return function(r){return function(o,s){let i=IS(t,"addDoc",o);return e(i),yS(i,()=>r(o,s))}}}function gIe(t,e){return function(r){return function(o){let s=IS(t,"deleteDoc",o.parent||o);return e(s),yS(s,()=>r(o))}}}function AIe(t,e){return function(r){return function(o){let s=IS(t,"getDocs",o);return e(s),yS(s,()=>r(o))}}}function RIe(t,e){return function(r){return function(o,s,i){let a=IS(t,"setDoc",o.parent||o);return e(a),yS(a,()=>typeof i<"u"?r(o,s,i):r(o,s))}}}function yS(t,e){return P.with(X.setSpan(P.active(),t),()=>(0,Xo.safeExecuteInTheMiddle)(()=>e(),n=>{n&&t.recordException(n),t.end()},!0))}function IS(t,e,n){let r=t.startSpan(`${e} ${n.path}`,{kind:Ne.CLIENT});return IIe(r,n),r.setAttribute(ec,e),r}function yIe(t){let e,n;if(typeof t.host=="string")if(t.host.startsWith("[")){if(t.host.endsWith("]"))e=t.host.replace(/^\[|\]$/g,"");else if(t.host.includes("]:")){let r=t.host.lastIndexOf(":");r!==-1&&(e=t.host.slice(1,r).replace(/^\[|\]$/g,""),n=t.host.slice(r+1))}}else if(R4.isIPv6(t.host))e=t.host;else{let r=t.host.lastIndexOf(":");r!==-1?(e=t.host.slice(0,r),n=t.host.slice(r+1)):e=t.host}return{address:e,port:n?parseInt(n,10):void 0}}function IIe(t,e){let n=e.firestore.app,r=n.options,s=(e.firestore.toJSON()||{}).settings||{},i={[uA]:e.path,[lA]:n.name,[Mi]:"firebase.firestore","firebase.firestore.type":e.type,"firebase.firestore.options.projectId":r.projectId,"firebase.firestore.options.appId":r.appId,"firebase.firestore.options.messagingSenderId":r.messagingSenderId,"firebase.firestore.options.storageBucket":r.storageBucket},{address:a,port:c}=yIe(s);a&&(i[EA]=a),c&&(i[SA]=c),t.setAttributes(i)}b();var Jo=K(ne(),1);function O4(t,e,n,r,o){let s=()=>{},i=()=>{},a=o.functions?.errorHook,c=o.functions?.requestHook,l=o.functions?.responseHook;typeof l=="function"&&(i=(_,f)=>{(0,Jo.safeExecuteInTheMiddle)(()=>l(_,f),m=>{m&&wn.error(m?.message)},!0)}),typeof c=="function"&&(s=_=>{(0,Jo.safeExecuteInTheMiddle)(()=>c(_),f=>{f&&wn.error(f?.message)},!0)});let p=new Jo.InstrumentationNodeModuleDefinition("firebase-functions",e);return[{name:"firebase-functions/lib/v2/providers/https.js",triggerType:"function"},{name:"firebase-functions/lib/v2/providers/firestore.js",triggerType:"firestore"},{name:"firebase-functions/lib/v2/providers/scheduler.js",triggerType:"scheduler"},{name:"firebase-functions/lib/v2/storage.js",triggerType:"storage"}].forEach(({name:_,triggerType:f})=>{p.files.push(new Jo.InstrumentationNodeModuleFile(_,e,m=>OIe(m,n,r,t,{requestHook:s,responseHook:i,errorHook:a},f),m=>N4(m,r)))}),p}function Sn(t,e,n){return function(o){return function(...s){let i=typeof s[0]=="function"?s[0]:s[1],a=typeof s[0]=="function"?void 0:s[0];if(!i)return o.call(this,...s);let c=async function(...l){let p=process.env.FUNCTION_TARGET||process.env.K_SERVICE||"unknown",d=t.startSpan(`firebase.function.${n}`,{kind:Ne.SERVER}),_={"faas.name":p,"faas.trigger":n,"faas.provider":"firebase"};return process.env.GCLOUD_PROJECT&&(_["cloud.project_id"]=process.env.GCLOUD_PROJECT),process.env.EVENTARC_CLOUD_EVENT_SOURCE&&(_["cloud.event_source"]=process.env.EVENTARC_CLOUD_EVENT_SOURCE),d.setAttributes(_),e?.requestHook?.(d),P.with(X.setSpan(P.active(),d),async()=>{let f,m;try{m=await i.apply(this,l)}catch(h){f=h}if(e?.responseHook?.(d,f),f&&d.recordException(f),d.end(),f)throw await e?.errorHook?.(d,f),f;return m})};return a?o.call(this,a,c):o.call(this,c)}}}function OIe(t,e,n,r,o,s){switch(N4(t,n),s){case"function":e(t,"onRequest",Sn(r,o,"http.request")),e(t,"onCall",Sn(r,o,"http.call"));break;case"firestore":e(t,"onDocumentCreated",Sn(r,o,"firestore.document.created")),e(t,"onDocumentUpdated",Sn(r,o,"firestore.document.updated")),e(t,"onDocumentDeleted",Sn(r,o,"firestore.document.deleted")),e(t,"onDocumentWritten",Sn(r,o,"firestore.document.written")),e(t,"onDocumentCreatedWithAuthContext",Sn(r,o,"firestore.document.created")),e(t,"onDocumentUpdatedWithAuthContext",Sn(r,o,"firestore.document.updated")),e(t,"onDocumentDeletedWithAuthContext",Sn(r,o,"firestore.document.deleted")),e(t,"onDocumentWrittenWithAuthContext",Sn(r,o,"firestore.document.written"));break;case"scheduler":e(t,"onSchedule",Sn(r,o,"scheduler.scheduled"));break;case"storage":e(t,"onObjectFinalized",Sn(r,o,"storage.object.finalized")),e(t,"onObjectArchived",Sn(r,o,"storage.object.archived")),e(t,"onObjectDeleted",Sn(r,o,"storage.object.deleted")),e(t,"onObjectMetadataUpdated",Sn(r,o,"storage.object.metadataUpdated"));break}return t}function N4(t,e){let n=["onSchedule","onRequest","onCall","onObjectFinalized","onObjectArchived","onObjectDeleted","onObjectMetadataUpdated","onDocumentCreated","onDocumentUpdated","onDocumentDeleted","onDocumentWritten","onDocumentCreatedWithAuthContext","onDocumentUpdatedWithAuthContext","onDocumentDeletedWithAuthContext","onDocumentWrittenWithAuthContext"];for(let r of n)(0,Jo.isWrapped)(t[r])&&e(t,r);return t}var b4={},NIe=[">=3.0.0 <5"],bIe=[">=6.0.0 <7"],OS=class extends C4.InstrumentationBase{constructor(e=b4){super("@sentry/instrumentation-firebase",pe,e)}setConfig(e={}){super.setConfig({...b4,...e})}init(){let e=[];return e.push(y4(this.tracer,NIe,this._wrap,this._unwrap,this.getConfig())),e.push(O4(this.tracer,bIe,this._wrap,this._unwrap,this.getConfig())),e}};var P4="Firebase",CIe={firestoreSpanCreationHook:t=>{Re(t,"auto.firebase.otel.firestore"),t.setAttribute(ee,"db.query")},functions:{requestHook:t=>{Re(t,"auto.firebase.otel.functions"),t.setAttribute(ee,"http.request")},errorHook:async(t,e)=>{e&&(te(e,{mechanism:{type:"auto.firebase.otel.functions",handled:!1}}),await nm(2e3))}}},M4=w(P4,()=>new OS(CIe)),PIe=()=>({name:P4,setupOnce(){M4()}}),x4=PIe;function v4(){return[Iq(),Z$(),OY(),JK(),uW(),yW(),DW(),$W(),Az(),Hz(),wK(),KK(),_2(),O2(),G2(),Y2(),HY(),s4(),XY(),T4(),g4(),c4(),l4(),d4(),m4(),qz(),x4()]}b();var NS=K(DI(),1),L4=K(iO(),1);le();var Xb=1e6;function D4(t,e={}){t.getOptions().debug&&RO();let[n,r]=MIe(t,e);t.traceProvider=n,t.asyncLocalStorageLookup=r}function MIe(t,e={}){let n=new L4.BasicTracerProvider({sampler:new Gh(t),resource:(0,NS.defaultResource)().merge((0,NS.resourceFromAttributes)({[gA]:"node",[cA]:"sentry",[AA]:pe})),forceFlushTimeoutMillis:500,spanProcessors:[new kh({timeout:xIe(t.getOptions().maxSpanWaitDuration)}),...e.spanProcessors||[]]});X.setGlobalTracerProvider(n),Ar.setGlobalPropagator(new wh);let r=new AO;return P.setGlobalContextManager(r),[n,r.getAsyncLocalStorageLookup()]}function xIe(t){if(t!=null){if(t>Xb)return mt&&g.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${Xb}`),Xb;if(t<=0||Number.isNaN(t)){mt&&g.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return t}}function U4(){return Yh().filter(e=>e.name!=="Http"&&e.name!=="NodeFetch").concat(nq(),lq())}function w4(t){return[...U4(),...Xe(t)?v4():[]]}function Jb(t={}){return vIe(t,w4)}function vIe(t={},e){Ki(t,"node");let n=xO({...t,defaultIntegrations:t.defaultIntegrations??e(t)});return n&&!t.skipOpenTelemetrySetup&&(D4(n,{spanProcessors:t.openTelemetrySpanProcessors}),vO()),n}var LIe="prod",G4="0.1.9",DIe=`@tanagram/lore/${G4}`;function xt(){return LIe}function bS(){return G4}function B4(){return DIe}Jb({dsn:"https://583674b382128b1b30b9fa1f0581daab@o4509017064472576.ingest.us.sentry.io/4511344717529088",environment:xt(),release:bS(),sendDefaultPii:!0});tm("service_name","lore-cli");import{pathToFileURL as fxe}from"node:url";var UIe=/\d/,wIe=["-","_","/","."];function kIe(t=""){if(!UIe.test(t))return t!==t.toLowerCase()}function j4(t,e){let n=e??wIe,r=[];if(!t||typeof t!="string")return r;let o="",s,i;for(let a of t){let c=n.includes(a);if(c===!0){r.push(o),o="",s=void 0;continue}let l=kIe(a);if(i===!1){if(s===!1&&l===!0){r.push(o),o=a,s=l;continue}if(s===!0&&l===!1&&o.length>1){let p=o.at(-1);r.push(o.slice(0,Math.max(0,o.length-1))),o=p+a,s=l;continue}}o+=a,s=l,i=c}return r.push(o),r}function GIe(t){return t?t[0].toUpperCase()+t.slice(1):""}function BIe(t){return t?t[0].toLowerCase()+t.slice(1):""}function jIe(t,e){return t?(Array.isArray(t)?t:j4(t)).map(n=>GIe(e?.normalize?n.toLowerCase():n)).join(""):""}function qd(t,e){return BIe(jIe(t||"",e))}function CS(t,e){return t?(Array.isArray(t)?t:j4(t)).map(n=>n.toLowerCase()).join(e??"-"):""}function H4(t){return CS(t||"","_")}import{parseArgs as HIe}from"node:util";function LS(t){return Array.isArray(t)?t:t===void 0?[]:[t]}function Zb(t,e=""){let n=[];for(let r of t)for(let[o,s]of r.entries())n[o]=Math.max(n[o]||0,s.length);return t.map(r=>r.map((o,s)=>e+o[s===0?"padStart":"padEnd"](n[s])).join(" ")).join(`
38
+ `)}function Kn(t){return typeof t=="function"?t():t}var Ia=class extends Error{code;constructor(t,e){super(t),this.name="CLIError",this.code=e}};function FIe(t=[],e={}){let n=new Set(e.boolean||[]),r=new Set(e.string||[]),o=e.alias||{},s=e.default||{},i=new Map,a=new Map;for(let[T,S]of Object.entries(o)){let R=S;for(let I of R)i.set(T,I),a.has(I)||a.set(I,[]),a.get(I).push(T),i.set(I,T),a.has(T)||a.set(T,[]),a.get(T).push(I)}let c={};function l(T){if(n.has(T))return"boolean";let S=a.get(T)||[];for(let R of S)if(n.has(R))return"boolean";return"string"}function p(T){if(r.has(T))return!0;let S=a.get(T)||[];for(let R of S)if(r.has(R))return!0;return!1}let d=new Set([...n,...r,...Object.keys(o),...Object.values(o).flat(),...Object.keys(s)]);for(let T of d)c[T]||(c[T]={type:l(T),default:s[T]});for(let[T,S]of i.entries())T.length===1&&c[S]&&!c[S].short&&(c[S].short=T);let _=[],f={};for(let T=0;T<t.length;T++){let S=t[T];if(S==="--"){_.push(...t.slice(T));break}if(S.startsWith("--no-")){let R=S.slice(5);f[R]=!0;continue}_.push(S)}let m;try{m=HIe({args:_,options:Object.keys(c).length>0?c:void 0,allowPositionals:!0,strict:!1})}catch{m={values:{},positionals:_}}let h={_:[]};h._=m.positionals;for(let[T,S]of Object.entries(m.values)){let R=S;l(T)==="boolean"&&typeof S=="string"?R=S!=="false":p(T)&&typeof S=="boolean"&&(R=""),h[T]=R}for(let[T]of Object.entries(f)){h[T]=!1;let S=i.get(T);S&&(h[S]=!1);let R=a.get(T);if(R)for(let I of R)h[I]=!1}for(let[T,S]of i.entries())h[T]!==void 0&&h[S]===void 0&&(h[S]=h[T]),h[S]!==void 0&&h[T]===void 0&&(h[T]=h[S]),h[T]!==h[S]&&s[S]===h[S]&&(h[S]=h[T]);return h}var VIe=(()=>{let t=globalThis.process?.env??{};return t.NO_COLOR==="1"||t.TERM==="dumb"||t.TEST||t.CI})(),DS=(t,e=39)=>n=>VIe?n:`\x1B[${t}m${n}\x1B[${e}m`,PS=DS(1,22),Gr=DS(36),xS=DS(90),MS=DS(4,24);function qIe(t,e){let n={boolean:[],string:[],alias:{},default:{}},r=q4(e);for(let a of r){if(a.type==="positional")continue;a.type==="string"||a.type==="enum"?n.string.push(a.name):a.type==="boolean"&&n.boolean.push(a.name),a.default!==void 0&&(n.default[a.name]=a.default),a.alias&&(n.alias[a.name]=a.alias);let c=qd(a.name),l=CS(a.name);if(c!==a.name||l!==a.name){let p=LS(n.alias[a.name]||[]);c!==a.name&&!p.includes(c)&&p.push(c),l!==a.name&&!p.includes(l)&&p.push(l),p.length>0&&(n.alias[a.name]=p)}}let o=FIe(t,n),[...s]=o._,i=new Proxy(o,{get(a,c){return a[c]??a[qd(c)]??a[CS(c)]}});for(let[,a]of r.entries())if(a.type==="positional"){let c=s.shift();if(c!==void 0)i[a.name]=c;else{if(a.default===void 0&&a.required!==!1)throw new Ia(`Missing required positional argument: ${a.name.toUpperCase()}`,"EARG");i[a.name]=a.default}}else if(a.type==="enum"){let c=i[a.name],l=a.options||[];if(c!==void 0&&l.length>0&&!l.includes(c))throw new Ia(`Invalid value for argument: ${Gr(`--${a.name}`)} (${Gr(c)}). Expected one of: ${l.map(p=>Gr(p)).join(", ")}.`,"EARG")}else if(a.required&&i[a.name]===void 0)throw new Ia(`Missing required argument: --${a.name}`,"EARG");return i}function q4(t){let e=[];for(let[n,r]of Object.entries(t||{}))e.push({...r,name:n,alias:LS(r.alias)});return e}async function $Ie(t){return Promise.all(t.map(e=>Kn(e)))}async function vS(t,e){let n=await Kn(t.args||{}),r=qIe(e.rawArgs,n),o={rawArgs:e.rawArgs,args:r,data:e.data,cmd:t},s=await $Ie(t.plugins??[]),i,a;try{for(let p of s)await p.setup?.(o);typeof t.setup=="function"&&await t.setup(o);let l=await Kn(t.subCommands);if(l&&Object.keys(l).length>0){let p=YIe(e.rawArgs,n),d=e.rawArgs[p];if(d){let _=await F4(l,d);if(!_)throw new Ia(`Unknown command ${Gr(d)}`,"E_UNKNOWN_COMMAND");await vS(_,{rawArgs:e.rawArgs.slice(p+1)})}else{let _=await Kn(t.default);if(_){if(t.run)throw new Ia("Cannot specify both 'run' and 'default' on the same command.","E_DEFAULT_CONFLICT");let f=await F4(l,_);if(!f)throw new Ia(`Default sub command ${Gr(_)} not found in subCommands.`,"E_UNKNOWN_COMMAND");await vS(f,{rawArgs:e.rawArgs})}else if(!t.run)throw new Ia("No command specified.","E_NO_COMMAND")}}typeof t.run=="function"&&(i=await t.run(o))}catch(l){a=l}let c=[];if(typeof t.cleanup=="function")try{await t.cleanup(o)}catch(l){c.push(l)}for(let l of[...s].reverse())try{await l.cleanup?.(o)}catch(p){c.push(p)}if(a)throw a;if(c.length===1)throw c[0];if(c.length>1)throw new Error("Multiple cleanup errors",{cause:c});return{result:i}}async function F4(t,e){if(e in t)return Kn(t[e]);for(let n of Object.values(t)){let r=await Kn(n),o=await Kn(r?.meta);if(o?.alias&&LS(o.alias).includes(e))return r}}function YIe(t,e){for(let n=0;n<t.length;n++){let r=t[n];if(r==="--")return-1;if(r.startsWith("-")){!r.includes("=")&&WIe(r,e)&&n++;continue}return n}return-1}function WIe(t,e){let n=t.replace(/^-{1,2}/,""),r=qd(n);for(let[o,s]of Object.entries(e))if(!(s.type!=="string"&&s.type!=="enum")&&(r===qd(o)||(Array.isArray(s.alias)?s.alias:s.alias?[s.alias]:[]).includes(n)))return!0;return!1}var zIe=/^no[-A-Z]/;async function $4(t,e){let n=await Kn(t.meta||{}),r=q4(await Kn(t.args||{})),o=await Kn(e?.meta||{}),s=`${o.name?`${o.name} `:""}`+(n.name||process.argv[1]),i=[],a=[],c=[],l=[];for(let f of r)if(f.type==="positional"){let m=f.name.toUpperCase(),h=f.required!==!1&&f.default===void 0;a.push([Gr(m+eC(f)),V4(f,h)]),l.push(h?`<${m}>`:`[${m}]`)}else{let m=f.required===!0&&f.default===void 0,h=[...(f.alias||[]).map(T=>`-${T}`),`--${f.name}`].join(", ")+eC(f);if(i.push([Gr(h),V4(f,m)]),f.type==="boolean"&&(f.default===!0||f.negativeDescription)&&!zIe.test(f.name)){let T=[...(f.alias||[]).map(S=>`--no-${S}`),`--no-${f.name}`].join(", ");i.push([Gr(T),[f.negativeDescription,m?xS("(Required)"):""].filter(Boolean).join(" ")])}m&&l.push(`--${f.name}`+eC(f))}if(t.subCommands){let f=[],m=await Kn(t.subCommands);for(let[h,T]of Object.entries(m)){let S=await Kn((await Kn(T))?.meta);if(S?.hidden)continue;let R=LS(S?.alias),I=[h,...R].join(", ");c.push([Gr(I),S?.description||""]),f.push(h,...R)}l.push(f.join("|"))}let p=[],d=n.version||o.version;p.push(xS(`${n.description} (${s+(d?` v${d}`:"")})`),"");let _=i.length>0||a.length>0;return p.push(`${MS(PS("USAGE"))} ${Gr(`${s}${_?" [OPTIONS]":""} ${l.join(" ")}`)}`,""),a.length>0&&(p.push(MS(PS("ARGUMENTS")),""),p.push(Zb(a," ")),p.push("")),i.length>0&&(p.push(MS(PS("OPTIONS")),""),p.push(Zb(i," ")),p.push("")),c.length>0&&(p.push(MS(PS("COMMANDS")),""),p.push(Zb(c," ")),p.push("",`Use ${Gr(`${s} <command> --help`)} for more information about a command.`)),p.filter(f=>typeof f=="string").join(`
39
+ `)}function eC(t){let e=t.valueHint?`=<${t.valueHint}>`:"",n=e||`=<${H4(t.name)}>`;return!t.type||t.type==="positional"||t.type==="boolean"?e:t.type==="enum"&&t.options?.length?`=<${t.options.join("|")}>`:n}function V4(t,e){let n=e?xS("(Required)"):"",r=t.default===void 0?"":xS(`(Default: ${t.default})`);return[t.description,n,r].filter(Boolean).join(" ")}import{execFile as mOe}from"node:child_process";import tn from"node:fs/promises";import hOe from"node:os";import So from"node:path";import{promisify as TOe}from"node:util";import Y4 from"node:os";import Oa from"node:path";function Zo(){let t=xt()==="dev"?".lore-dev":".lore";return Oa.join(Y4.homedir(),t)}function US(){return Oa.join(Zo(),"log.txt")}function tC(){return Oa.join(Zo(),"sync_state.json")}function wS(){return Oa.join(Zo(),"status.json")}function $d(){return Oa.join(Zo(),"install_source.json")}function Yd(){return Oa.join(Zo(),"bin","lore")}function Wd(){let t=xt();return t==="prod"?"ai.tanagram.lore":`ai.tanagram.lore.${t}`}function zd(){return Oa.join(Y4.homedir(),"Library","LaunchAgents",`${Wd()}.plist`)}import al from"node:fs/promises";import GS from"node:os";import en from"node:path";function fi(t,e){return t!==null&&typeof t=="object"&&"code"in t&&t.code===e}import z4 from"node:fs";var W4=null;function KIe(){let t=Zo();W4!==t&&(z4.mkdirSync(t,{recursive:!0}),W4=t)}function QIe(t){let e=typeof t=="string"?t:JSON.stringify(t);return/[\s"=]/.test(e)?JSON.stringify(e):e}function XIe(t,e,n){let r=`${new Date().toISOString()} ${t} ${e}`;if(!n)return`${r}
40
+ `;let o=Object.entries(n).map(([s,i])=>`${s}=${QIe(i)}`).join(" ");return o?`${r} ${o}
41
+ `:`${r}
42
+ `}function nC(t,e,n){let r=XIe(t,e,n);KIe(),z4.appendFileSync(US(),r),xt()==="dev"&&process.stderr.write(r)}var pt={info(t,e){nC("info",t,e)},warn(t,e){nC("warn",t,e)},error(t,e){nC("error",t,e)}};import JIe from"node:crypto";import Kd from"node:fs/promises";import ZIe from"node:os";import kS from"node:path";async function es(t){try{let e=await Kd.stat(t);return{exists:!0,size:e.size,modTimeUnixMs:e.mtime.getTime()}}catch(e){if(fi(e,"ENOENT"))return{exists:!1,size:0,modTimeUnixMs:0};throw e}}function rC(t,e){return t.exists!==e.exists?!0:t.exists?t.size!==e.size||t.modTimeUnixMs!==e.modTimeUnixMs:!1}async function oC(t){let e=await Kd.mkdtemp(kS.join(ZIe.tmpdir(),"lore-upload-")),n=kS.join(e,kS.basename(t));await Kd.copyFile(t,n);let r=await Kd.readFile(n);return{tempPath:n,md5:JIe.createHash("md5").update(r).digest("hex")}}async function K4(t){await Kd.rm(kS.dirname(t),{recursive:!0,force:!0})}import Q4 from"node:fs/promises";import Qd from"node:path";async function X4(t){let e=t.trim();if(!e)return null;for(;;){let n=Qd.join(e,".git","config");try{return await Q4.stat(n),n}catch{let r=Qd.dirname(e);if(r===e)return null;e=r}}}async function J4(t){let e=await X4(t);return e?Qd.dirname(Qd.dirname(e)):null}async function Z4(t){let e=await X4(Qd.resolve(t.trim()));if(!e)return"";let n;try{n=await Q4.readFile(e,"utf8")}catch{return""}let r=eOe(n),o=tOe(r);return o?`${o.owner}/${o.name}`:""}function eOe(t){let e=!1;for(let n of t.split(`
43
+ `)){let r=n.trim();if(!r||r.startsWith("#")||r.startsWith(";"))continue;if(r.startsWith("[")&&r.endsWith("]")){e=r==='[remote "origin"]';continue}if(!e)continue;let o=r.indexOf("=");if(!(o<0)&&r.slice(0,o).trim()==="url")return r.slice(o+1).trim()}return""}function tOe(t){let e=t.trim();if(!e)return null;let n="",r=/^(?:ssh:\/\/)?git@[^/:]+[:/](.+)$/.exec(e);if(r)n=r[1]??"";else try{n=new URL(e).pathname.replace(/^\/+/,"")}catch{n=e}n=n.replace(/\.git$/,"").replace(/^\/+|\/+$/g,"");let o=n.split("/").filter(Boolean);if(o.length<2)return null;let[s,i]=o.slice(-2);return!s||!i?null:{owner:s,name:i}}var nOe=60*60*1e3,iC=Symbol("missingSessionID"),n3={name:"claudeCode",historyFilePath:Xd,readUnuploadedEntries:r3,collectLocalFiles:oOe,buildPendingTranscriptWatches:sOe};function Xd(){return en.join(GS.homedir(),".claude","history.jsonl")}async function r3(t){let e=Xd(),n;try{n=await al.readFile(e,"utf8")}catch(r){if(fi(r,"ENOENT"))return[];throw r}return rOe(n,t)}function rOe(t,e,n=Xd()){let r=[],o=t.split(`
44
+ `);for(let i=0;i<o.length;i+=1){let a=o[i]?.trim();if(!a)continue;let c;try{c=JSON.parse(a)}catch(l){e3({historyPath:n,lineNumber:i+1,line:a,reason:"unparseable_json",error:l});continue}if(!dOe(c)){e3({historyPath:n,lineNumber:i+1,line:a,reason:"invalid_history_entry"});continue}r.push(c)}let s=r.findIndex(i=>i.timestamp>=e);return s>=0?r.slice(s):[]}function e3({historyPath:t,lineNumber:e,line:n,reason:r,error:o}){pt.warn("claude_history_entry_skipped",{history_path:t,line_number:e,history_line:n,reason:r,...o?{error:o instanceof Error?o.message:String(o)}:{}})}async function oOe(t){let e=[],n=new Array(t.length),r=new Set,o=new Set,s=[];try{for(let i=0;i<t.length;i+=1){let a=t[i],c=await o3(a);if(c===iC){let m=`__missing_session__:${a.project}:${a.timestamp}:${i}`;n[i]=m,r.add(m),o.add(m);continue}if(n[i]=c.key,o.has(c.key))continue;let l=await es(c.fullPath),p;try{p=await oC(c.fullPath)}catch(m){if(fi(m,"ENOENT")){r.add(c.key),o.add(c.key);continue}throw new Error(`read session transcript ${c.fullPath}: ${String(m)}`)}s.push(p.tempPath);let d=await Z4(a.project);e.push({key:c.key,filename:c.relativeFilename,sourcePath:c.fullPath,repoOriginPath:d,tempPath:p.tempPath,md5:p.md5,fileType:"transcript",harness:"claudeCode",harnessInternalId:a.sessionId?.trim()??"",watchedState:l}),o.add(c.key);let _=await al.readFile(p.tempPath,"utf8"),f=lOe(_);for(let m of f){let h;try{h=await pOe(m)}catch{continue}let T=`${c.key}::plan:${h}`;if(o.has(T))continue;let S=await es(h),R;try{R=await oC(h)}catch(I){if(fi(I,"ENOENT"))continue;throw new Error(`read plan file ${h}: ${String(I)}`)}s.push(R.tempPath),e.push({key:T,filename:h,sourcePath:h,repoOriginPath:d,tempPath:R.tempPath,md5:R.md5,fileType:"plan",harness:"claudeCode",harnessInternalId:h,watchedState:S}),o.add(T)}}}catch(i){throw await Promise.all(s.map(a=>al.rm(en.dirname(a),{recursive:!0,force:!0}))),i}return{entries:t,localFiles:e,entryFileKeys:n,skippedFileKeys:r}}async function sOe(t,e){let n=await r3(t),r=Date.now(),o=[],s=new Set;for(let i of n){let a=await o3(i);if(a===iC||s.has(a.fullPath))continue;let c=await es(a.fullPath);c.exists&&(o.push({sessionId:i.sessionId?.trim()??"",project:i.project,transcriptPath:a.fullPath,expiresAt:new Date(r+nOe),baseline:e.get(a.fullPath)??c}),s.add(a.fullPath))}return o.sort((i,a)=>i.transcriptPath.localeCompare(a.transcriptPath))}async function o3(t){let e=t.sessionId?.trim();if(!e)return iC;let n=cOe(),r=await iOe(t.project),o=null;for(let s of r){let i=aOe(s),a=en.posix.join(i,`${e}.jsonl`),c=en.join(n,...a.split("/")),l={fullPath:c,relativeFilename:a,key:a};o??=l;try{return await al.stat(c),l}catch(p){if(!fi(p,"ENOENT"))throw new Error(`stat session transcript ${c}: ${String(p)}`)}}if(!o)throw new Error("history entry is missing project path");return o}async function iOe(t){let e=en.normalize(t.trim());if(!e||e===".")throw new Error("history entry is missing project path");let n=[e],r=await J4(e);if(!r||r===e)return n;for(let o=en.dirname(e);o!==e&&(n.push(o),o!==r);)e=o,o=en.dirname(o);return n}function aOe(t){let e=en.normalize(t.trim());if(!e||e===".")throw new Error("history entry is missing project path");return e.split(en.sep).join("-")}function cOe(){return en.join(GS.homedir(),".claude","projects")}function uOe(){return en.join(GS.homedir(),".claude","plans")}function lOe(t){let e=[],n=new Set;for(let r of t.split(`
45
+ `)){let o=r.trim();if(!o)continue;let s;try{s=JSON.parse(o)}catch{break}if(s.type!=="assistant")continue;let i=s.message?.content;if(Array.isArray(i))for(let a of i){if(!sC(a)||a.type!=="tool_use"||a.name!=="ExitPlanMode"||!sC(a.input))continue;let c=a.input.planFilePath;if(typeof c!="string")continue;let l=c.trim();!l||n.has(l)||(e.push(l),n.add(l))}}return e}async function pOe(t){let e=t.trim();if(!e)throw new Error("plan file path is empty");let n=uOe(),r=n;try{r=await al.realpath(n)}catch{}if(e.startsWith("~/")&&(e=en.join(GS.homedir(),e.slice(2))),!en.isAbsolute(e))throw new Error(`plan file path must stay under ${n}`);if(e=en.normalize(e),!t3(e,n))throw new Error(`plan file path must stay under ${n}`);try{let o=await al.realpath(e);if(!t3(o,r))throw new Error(`plan file path must resolve under ${n}`)}catch(o){if(!fi(o,"ENOENT"))throw o}return e}function t3(t,e){let n=en.relative(e,t);return n===""||n!==".."&&!n.startsWith(`..${en.sep}`)}function dOe(t){return sC(t)&&typeof t.timestamp=="number"&&typeof t.project=="string"}function sC(t){return t!==null&&typeof t=="object"}import BS from"node:fs/promises";import _Oe from"node:path";var jS=class{status={};async markRunning(){let e=new Date().toISOString();this.status={pid:process.pid,state:"running",started_at:e,last_heartbeat_at:e},await this.persist()}async heartbeat(){this.status.pid=process.pid,this.status.last_heartbeat_at=new Date().toISOString(),await this.persist()}async markAuthenticated(){this.status.auth="logged_in",await this.heartbeat()}async markSyncSuccess(e){let n=new Date().toISOString();this.status.pid=process.pid,this.status.auth="logged_in",this.status.last_heartbeat_at=n,this.status.last_completed_at=n,this.status.last_success_at=n,this.status.last_error=void 0,this.status.last_thread_ids=[...e],await this.persist()}async setPendingWatchers(e){this.status.pid=process.pid,this.status.state="running",this.status.pending_watchers=e.map(n=>({session_id:n.sessionId||void 0,project:n.project||void 0,transcript_path:n.transcriptPath||void 0,expires_at:n.expiresAt.toISOString()})),await this.heartbeat()}async markLoggedOut(){let e=new Date().toISOString();this.status.pid=process.pid,this.status.state="logged_out",this.status.auth="logged_out",this.status.last_heartbeat_at=e,this.status.last_completed_at=e,this.status.last_error=void 0,this.status.last_thread_ids=void 0,this.status.pending_watchers=void 0,await this.persist()}async markSuccess(e){let n=new Date().toISOString();this.status.pid=process.pid,this.status.state="idle",this.status.auth="logged_in",this.status.last_heartbeat_at=n,this.status.last_completed_at=n,this.status.last_success_at=n,this.status.last_error=void 0,this.status.last_thread_ids=[...e],this.status.pending_watchers=void 0,await this.persist()}async markError(e){let n=new Date().toISOString();this.status.pid=process.pid,this.status.state="error",this.status.last_heartbeat_at=n,this.status.last_completed_at=n,this.status.last_error=e instanceof Error?e.message:String(e),this.status.pending_watchers=void 0,await this.persist()}async persist(){let e=wS();await BS.mkdir(_Oe.dirname(e),{recursive:!0,mode:448}),await BS.writeFile(e,`${JSON.stringify(fOe(this.status),null,2)}
46
+ `,{mode:384})}};async function s3(){try{return JSON.parse(await BS.readFile(wS(),"utf8"))}catch{return{}}}async function i3(){await BS.rm(wS(),{force:!0})}function fOe(t){return JSON.parse(JSON.stringify(t))}var EOe=TOe(mOe),SOe=2*60*1e3;async function cC(){lC();let t=await ROe(),e=await yOe(t);await bOe(t);let n=await AOe();return await u3(),await COe(n),await POe(),{plistPath:n,binaryPath:e}}async function a3(){lC(),await u3(),await tn.rm(zd(),{force:!0}),await tn.rm(Yd(),{force:!0}),await tn.rm($d(),{force:!0}),await i3()}async function c3(){lC();let t=zd(),e=Yd(),n=So.join(So.dirname($d()),"status.json"),r=$d(),o=await s3(),s=await l3(),i=await DOe(t),a=vOe(o,new Date),{health:c,healthy:l}=xOe(i,s,o,a);return{label:Wd(),enabled:i,loaded:s.loaded,running:s.running,healthy:l,health:c,heartbeat_fresh:a,plist_path:t,binary_path:e,status_path:n,install_source_path:r,...Object.keys(o).length>0?{status:o}:{}}}async function gOe(){let t=Yd(),e=Xd();return`<?xml version="1.0" encoding="UTF-8"?>
47
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
48
+ <plist version="1.0">
49
+ <dict>
50
+ <key>Label</key>
51
+ <string>${HS(Wd())}</string>
52
+ <key>ProgramArguments</key>
53
+ <array>
54
+ <string>${HS(t)}</string>
55
+ <string>_run_upload</string>
56
+ </array>
57
+ <key>RunAtLoad</key>
58
+ <true/>
59
+ <key>WatchPaths</key>
60
+ <array>
61
+ <string>${HS(e)}</string>
62
+ </array>
63
+ <key>ProcessType</key>
64
+ <string>Background</string>
65
+ <key>ThrottleInterval</key>
66
+ <integer>30</integer>
67
+ <key>EnvironmentVariables</key>
68
+ <dict>
69
+ <key>PATH</key>
70
+ <string>${HS(LOe())}</string>
71
+ </dict>
72
+ </dict>
73
+ </plist>
74
+ `}async function AOe(){let t=zd();return await tn.mkdir(So.dirname(t),{recursive:!0,mode:493}),await tn.writeFile(t,await gOe(),{mode:420}),t}async function ROe(){let t=process.argv[1];if(!t)throw new Error("resolve current executable: missing process argv[1]");return tn.realpath(t)}async function yOe(t){let e=Yd();await tn.mkdir(So.dirname(e),{recursive:!0,mode:448});let n=IOe(t);if(n.type==="write")return await tn.writeFile(e,n.contents,{mode:493}),await tn.chmod(e,493),e;if(await tn.realpath(e).catch(()=>"")!==t){let o=`${e}.tmp`;await tn.copyFile(t,o),await tn.chmod(o,493),await tn.rename(o,e)}return e}function IOe(t){return OOe(t)?{type:"write",contents:NOe(t)}:{type:"copy"}}function OOe(t){return t.endsWith(".ts")||t.endsWith(".tsx")}function NOe(t){let e=So.dirname(So.dirname(t)),n=So.join(e,"node_modules",".bin","tsx");return`#!/bin/sh
75
+ set -eu
76
+ cd ${aC(e)}
77
+ exec ${aC(n)} ${aC(t)} "$@"
78
+ `}function aC(t){return`'${t.replaceAll("'","'\\''")}'`}async function bOe(t){let e=$d();await tn.mkdir(So.dirname(e),{recursive:!0,mode:448}),await tn.writeFile(e,`${JSON.stringify({binary_path:t,updated_at:new Date().toISOString()},null,2)}
79
+ `,{mode:384})}async function u3(){try{await FS("bootout",uC(),zd())}catch(t){if(d3(t)||!(await l3().catch(()=>({loaded:!0}))).loaded)return;throw t}}async function COe(t){await FS("bootstrap",uC(),t)}async function POe(){await FS("kickstart","-k",p3())}async function l3(){try{let t=await FS("print",p3());return MOe(t)}catch(t){if(d3(t))return{loaded:!1,running:!1,pid:0,raw:""};throw t}}function MOe(t){let e={loaded:t.trim().length>0,running:!1,pid:0,raw:t},n;for(let r of t.split(`
80
+ `)){let o=r.trim();if(o.startsWith("state =")&&(n=o.slice(7).trim()==="running"),o.startsWith("pid =")){let s=Number.parseInt(o.slice(5).trim(),10);Number.isNaN(s)||(e.pid=s)}}return e.running=n??e.pid>0,e}async function FS(...t){try{let e=await EOe("launchctl",t);return`${e.stdout}${e.stderr}`.trim()}catch(e){if(UOe(e)){let n=`${e.stdout??""}${e.stderr??""}`.trim();throw new Error(n?`launchctl ${t.join(" ")}: ${e.message}: ${n}`:`launchctl ${t.join(" ")}: ${e.message}`)}throw e}}function xOe(t,e,n,r){return t?e.loaded?n.state==="logged_out"?{health:"logged_out",healthy:!1}:n.state==="error"?{health:"error",healthy:!1}:e.running?r?{health:"running",healthy:!0}:{health:"stale",healthy:!1}:n.last_heartbeat_at?{health:"healthy",healthy:!0}:{health:"waiting_for_first_run",healthy:!1}:{health:"not_loaded",healthy:!1}:{health:"disabled",healthy:!1}}function vOe(t,e){if(!t.last_heartbeat_at)return!1;let n=Date.parse(t.last_heartbeat_at);return Number.isNaN(n)?!1:n+SOe>=e.getTime()}function uC(){return`gui/${process.getuid?.()??hOe.userInfo().uid}`}function p3(){return`${uC()}/${Wd()}`}function LOe(){let t=["/opt/homebrew/bin","/usr/local/bin","/usr/bin","/bin","/usr/sbin","/sbin"];return Array.from(new Set([...process.env.PATH?.split(So.delimiter)??[],...t].filter(Boolean))).join(So.delimiter)}async function DOe(t){try{return await tn.stat(t),!0}catch{return!1}}function HS(t){return t.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&apos;")}function lC(){if(process.platform!=="darwin")throw new Error("Lore background uploads are currently supported only on macOS")}function d3(t){let e=t instanceof Error?t.message.toLowerCase():String(t).toLowerCase();return e.includes("could not find service")||e.includes("service could not be found")||e.includes("no such process")||e.includes("bad request")}function UOe(t){return t instanceof Error}var _3={meta:{name:"enable",description:"Install and start background uploads"},async run(){let{plistPath:t,binaryPath:e}=await cC();console.log("Lore background uploads enabled."),console.log(`LaunchAgent: ${t}`),console.log(`Stable binary: ${e}`)}},f3={meta:{name:"disable",description:"Stop and remove background uploads"},async run(){await a3(),console.log("Lore background uploads disabled.")}},m3={meta:{name:"restart",description:"Restart background uploads"},async run(){await cC(),console.log("Lore background uploads restarted.")}},h3={meta:{name:"status",description:"Show background upload status"},args:{json:{type:"boolean",description:"Output status as JSON"}},async run({args:t}){let e=await c3();if(t.json){console.log(JSON.stringify(e,null,2));return}console.log(`Lore: ${e.health}`),console.log(`Enabled: ${e.enabled}`),console.log(`Loaded: ${e.loaded}`),console.log(`Running: ${e.running}`),console.log(`Healthy: ${e.healthy}`),e.status?.last_heartbeat_at&&console.log(`Last heartbeat: ${e.status.last_heartbeat_at}`),e.status?.last_success_at&&console.log(`Last success: ${e.status.last_success_at}`),e.status?.last_error&&console.log(`Last error: ${e.status.last_error}`),console.log(`LaunchAgent: ${e.plist_path}`),console.log(`Stable binary: ${e.binary_path}`),console.log(`Status file: ${e.status_path}`)}};var u={};sg(u,{BRAND:()=>aNe,DIRTY:()=>Na,EMPTY_PATH:()=>BOe,INVALID:()=>Q,NEVER:()=>$Ne,OK:()=>nn,ParseStatus:()=>Ft,Schema:()=>ce,ZodAny:()=>Ti,ZodArray:()=>os,ZodBigInt:()=>Ca,ZodBoolean:()=>Pa,ZodBranded:()=>Zd,ZodCatch:()=>ja,ZodDate:()=>Ma,ZodDefault:()=>Ba,ZodDiscriminatedUnion:()=>$S,ZodEffects:()=>Sr,ZodEnum:()=>ka,ZodError:()=>vn,ZodFirstPartyTypeKind:()=>Z,ZodFunction:()=>WS,ZodIntersection:()=>Da,ZodIssueCode:()=>N,ZodLazy:()=>Ua,ZodLiteral:()=>wa,ZodMap:()=>_l,ZodNaN:()=>ml,ZodNativeEnum:()=>Ga,ZodNever:()=>Br,ZodNull:()=>va,ZodNullable:()=>Ro,ZodNumber:()=>ba,ZodObject:()=>Ln,ZodOptional:()=>Tr,ZodParsedType:()=>D,ZodPipeline:()=>e_,ZodPromise:()=>Ei,ZodReadonly:()=>Ha,ZodRecord:()=>YS,ZodSchema:()=>ce,ZodSet:()=>fl,ZodString:()=>hi,ZodSymbol:()=>pl,ZodTransformer:()=>Sr,ZodTuple:()=>Ao,ZodType:()=>ce,ZodUndefined:()=>xa,ZodUnion:()=>La,ZodUnknown:()=>rs,ZodVoid:()=>dl,addIssueToContext:()=>M,any:()=>hNe,array:()=>gNe,bigint:()=>pNe,boolean:()=>b3,coerce:()=>qNe,custom:()=>I3,date:()=>dNe,datetimeRegex:()=>R3,defaultErrorMap:()=>ts,discriminatedUnion:()=>INe,effect:()=>wNe,enum:()=>LNe,function:()=>MNe,getErrorMap:()=>cl,getParsedType:()=>go,instanceof:()=>uNe,intersection:()=>ONe,isAborted:()=>VS,isAsync:()=>ul,isDirty:()=>qS,isValid:()=>mi,late:()=>cNe,lazy:()=>xNe,literal:()=>vNe,makeIssue:()=>Jd,map:()=>CNe,nan:()=>lNe,nativeEnum:()=>DNe,never:()=>ENe,null:()=>mNe,nullable:()=>GNe,number:()=>N3,object:()=>ANe,objectUtil:()=>pC,oboolean:()=>VNe,onumber:()=>FNe,optional:()=>kNe,ostring:()=>HNe,pipeline:()=>jNe,preprocess:()=>BNe,promise:()=>UNe,quotelessJson:()=>wOe,record:()=>bNe,set:()=>PNe,setErrorMap:()=>GOe,strictObject:()=>RNe,string:()=>O3,symbol:()=>_Ne,transformer:()=>wNe,tuple:()=>NNe,undefined:()=>fNe,union:()=>yNe,unknown:()=>TNe,util:()=>de,void:()=>SNe});var de;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function n(o){throw new Error}t.assertNever=n,t.arrayToEnum=o=>{let s={};for(let i of o)s[i]=i;return s},t.getValidEnumValues=o=>{let s=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(let a of s)i[a]=o[a];return t.objectValues(i)},t.objectValues=o=>t.objectKeys(o).map(function(s){return o[s]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},t.find=(o,s)=>{for(let i of o)if(s(i))return i},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=r,t.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(de||(de={}));var pC;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(pC||(pC={}));var D=de.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),go=t=>{switch(typeof t){case"undefined":return D.undefined;case"string":return D.string;case"number":return Number.isNaN(t)?D.nan:D.number;case"boolean":return D.boolean;case"function":return D.function;case"bigint":return D.bigint;case"symbol":return D.symbol;case"object":return Array.isArray(t)?D.array:t===null?D.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?D.promise:typeof Map<"u"&&t instanceof Map?D.map:typeof Set<"u"&&t instanceof Set?D.set:typeof Date<"u"&&t instanceof Date?D.date:D.object;default:return D.unknown}};var N=de.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),wOe=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),vn=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(s){return s.message},r={_errors:[]},o=s=>{for(let i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,c=0;for(;c<i.path.length;){let l=i.path[c];c===i.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(n(i))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}};return o(this),r}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,de.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let o of this.issues)if(o.path.length>0){let s=o.path[0];n[s]=n[s]||[],n[s].push(e(o))}else r.push(e(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};vn.create=t=>new vn(t);var kOe=(t,e)=>{let n;switch(t.code){case N.invalid_type:t.received===D.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case N.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,de.jsonStringifyReplacer)}`;break;case N.unrecognized_keys:n=`Unrecognized key(s) in object: ${de.joinValues(t.keys,", ")}`;break;case N.invalid_union:n="Invalid input";break;case N.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${de.joinValues(t.options)}`;break;case N.invalid_enum_value:n=`Invalid enum value. Expected ${de.joinValues(t.options)}, received '${t.received}'`;break;case N.invalid_arguments:n="Invalid function arguments";break;case N.invalid_return_type:n="Invalid function return type";break;case N.invalid_date:n="Invalid date";break;case N.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:de.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case N.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case N.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case N.custom:n="Invalid input";break;case N.invalid_intersection_types:n="Intersection results could not be merged";break;case N.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case N.not_finite:n="Number must be finite";break;default:n=e.defaultError,de.assertNever(t)}return{message:n}},ts=kOe;var T3=ts;function GOe(t){T3=t}function cl(){return T3}var Jd=t=>{let{data:e,path:n,errorMaps:r,issueData:o}=t,s=[...n,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="",c=r.filter(l=>!!l).slice().reverse();for(let l of c)a=l(i,{data:e,defaultError:a}).message;return{...o,path:s,message:a}},BOe=[];function M(t,e){let n=cl(),r=Jd({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===ts?void 0:ts].filter(o=>!!o)});t.common.issues.push(r)}var Ft=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let o of n){if(o.status==="aborted")return Q;o.status==="dirty"&&e.dirty(),r.push(o.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let o of n){let s=await o.key,i=await o.value;r.push({key:s,value:i})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let o of n){let{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return Q;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(r[s.value]=i.value)}return{status:e.value,value:r}}},Q=Object.freeze({status:"aborted"}),Na=t=>({status:"dirty",value:t}),nn=t=>({status:"valid",value:t}),VS=t=>t.status==="aborted",qS=t=>t.status==="dirty",mi=t=>t.status==="valid",ul=t=>typeof Promise<"u"&&t instanceof Promise;var j;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(j||(j={}));var Er=class{constructor(e,n,r,o){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},E3=(t,e)=>{if(mi(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new vn(t.common.issues);return this._error=n,this._error}}};function ie(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:o}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(i,a)=>{let{message:c}=t;return i.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??r??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:c??n??a.defaultError}},description:o}}var ce=class{get description(){return this._def.description}_getType(e){return go(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:go(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ft,ctx:{common:e.parent.common,data:e.data,parsedType:go(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(ul(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:go(e)},o=this._parseSync({data:e,path:r.path,parent:r});return E3(r,o)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:go(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return mi(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>mi(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:go(e)},o=this._parse({data:e,path:r.path,parent:r}),s=await(ul(o)?o:Promise.resolve(o));return E3(r,s)}refine(e,n){let r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,s)=>{let i=e(o),a=()=>s.addIssue({code:N.custom,...r(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,o)=>e(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(e){return new Sr({schema:this,typeName:Z.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Tr.create(this,this._def)}nullable(){return Ro.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return os.create(this)}promise(){return Ei.create(this,this._def)}or(e){return La.create([this,e],this._def)}and(e){return Da.create(this,e,this._def)}transform(e){return new Sr({...ie(this._def),schema:this,typeName:Z.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new Ba({...ie(this._def),innerType:this,defaultValue:n,typeName:Z.ZodDefault})}brand(){return new Zd({typeName:Z.ZodBranded,type:this,...ie(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new ja({...ie(this._def),innerType:this,catchValue:n,typeName:Z.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return e_.create(this,e)}readonly(){return Ha.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},jOe=/^c[^\s-]{8,}$/i,HOe=/^[0-9a-z]+$/,FOe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,VOe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,qOe=/^[a-z0-9_-]{21}$/i,$Oe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,YOe=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,WOe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,zOe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",dC,KOe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,QOe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,XOe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,JOe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ZOe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,eNe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,g3="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",tNe=new RegExp(`^${g3}$`);function A3(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function nNe(t){return new RegExp(`^${A3(t)}$`)}function R3(t){let e=`${g3}T${A3(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function rNe(t,e){return!!((e==="v4"||!e)&&KOe.test(t)||(e==="v6"||!e)&&XOe.test(t))}function oNe(t,e){if(!$Oe.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function sNe(t,e){return!!((e==="v4"||!e)&&QOe.test(t)||(e==="v6"||!e)&&JOe.test(t))}var hi=class t extends ce{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==D.string){let s=this._getOrReturnCtx(e);return M(s,{code:N.invalid_type,expected:D.string,received:s.parsedType}),Q}let r=new Ft,o;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(o=this._getOrReturnCtx(e,o),M(o,{code:N.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(o=this._getOrReturnCtx(e,o),M(o,{code:N.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){let i=e.data.length>s.value,a=e.data.length<s.value;(i||a)&&(o=this._getOrReturnCtx(e,o),i?M(o,{code:N.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&M(o,{code:N.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")WOe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"email",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")dC||(dC=new RegExp(zOe,"u")),dC.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"emoji",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")VOe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"uuid",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")qOe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"nanoid",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")jOe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"cuid",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")HOe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"cuid2",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")FOe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"ulid",code:N.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),M(o,{validation:"url",code:N.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"regex",code:N.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(e,o),M(o,{code:N.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(o=this._getOrReturnCtx(e,o),M(o,{code:N.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(o=this._getOrReturnCtx(e,o),M(o,{code:N.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?R3(s).test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{code:N.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?tNe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{code:N.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?nNe(s).test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{code:N.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?YOe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"duration",code:N.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?rNe(e.data,s.version)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"ip",code:N.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?oNe(e.data,s.alg)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"jwt",code:N.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?sNe(e.data,s.version)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"cidr",code:N.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?ZOe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"base64",code:N.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?eNe.test(e.data)||(o=this._getOrReturnCtx(e,o),M(o,{validation:"base64url",code:N.invalid_string,message:s.message}),r.dirty()):de.assertNever(s);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(o=>e.test(o),{validation:n,code:N.invalid_string,...j.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...j.errToObj(e)})}url(e){return this._addCheck({kind:"url",...j.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...j.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...j.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...j.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...j.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...j.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...j.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...j.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...j.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...j.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...j.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...j.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...j.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...j.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...j.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...j.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...j.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...j.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...j.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...j.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...j.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...j.errToObj(n)})}nonempty(e){return this.min(1,j.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};hi.create=t=>new hi({checks:[],typeName:Z.ZodString,coerce:t?.coerce??!1,...ie(t)});function iNe(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,o=n>r?n:r,s=Number.parseInt(t.toFixed(o).replace(".","")),i=Number.parseInt(e.toFixed(o).replace(".",""));return s%i/10**o}var ba=class t extends ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==D.number){let s=this._getOrReturnCtx(e);return M(s,{code:N.invalid_type,expected:D.number,received:s.parsedType}),Q}let r,o=new Ft;for(let s of this._def.checks)s.kind==="int"?de.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),M(r,{code:N.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),M(r,{code:N.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),M(r,{code:N.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?iNe(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),M(r,{code:N.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),M(r,{code:N.not_finite,message:s.message}),o.dirty()):de.assertNever(s);return{status:o.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,j.toString(n))}gt(e,n){return this.setLimit("min",e,!1,j.toString(n))}lte(e,n){return this.setLimit("max",e,!0,j.toString(n))}lt(e,n){return this.setLimit("max",e,!1,j.toString(n))}setLimit(e,n,r,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:j.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:j.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:j.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:j.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:j.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:j.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:j.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:j.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:j.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:j.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&de.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};ba.create=t=>new ba({checks:[],typeName:Z.ZodNumber,coerce:t?.coerce||!1,...ie(t)});var Ca=class t extends ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==D.bigint)return this._getInvalidInput(e);let r,o=new Ft;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),M(r,{code:N.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),M(r,{code:N.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),M(r,{code:N.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):de.assertNever(s);return{status:o.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return M(n,{code:N.invalid_type,expected:D.bigint,received:n.parsedType}),Q}gte(e,n){return this.setLimit("min",e,!0,j.toString(n))}gt(e,n){return this.setLimit("min",e,!1,j.toString(n))}lte(e,n){return this.setLimit("max",e,!0,j.toString(n))}lt(e,n){return this.setLimit("max",e,!1,j.toString(n))}setLimit(e,n,r,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:j.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:j.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:j.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:j.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:j.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:j.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Ca.create=t=>new Ca({checks:[],typeName:Z.ZodBigInt,coerce:t?.coerce??!1,...ie(t)});var Pa=class extends ce{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==D.boolean){let r=this._getOrReturnCtx(e);return M(r,{code:N.invalid_type,expected:D.boolean,received:r.parsedType}),Q}return nn(e.data)}};Pa.create=t=>new Pa({typeName:Z.ZodBoolean,coerce:t?.coerce||!1,...ie(t)});var Ma=class t extends ce{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==D.date){let s=this._getOrReturnCtx(e);return M(s,{code:N.invalid_type,expected:D.date,received:s.parsedType}),Q}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return M(s,{code:N.invalid_date}),Q}let r=new Ft,o;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(o=this._getOrReturnCtx(e,o),M(o,{code:N.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(o=this._getOrReturnCtx(e,o),M(o,{code:N.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):de.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:j.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:j.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};Ma.create=t=>new Ma({checks:[],coerce:t?.coerce||!1,typeName:Z.ZodDate,...ie(t)});var pl=class extends ce{_parse(e){if(this._getType(e)!==D.symbol){let r=this._getOrReturnCtx(e);return M(r,{code:N.invalid_type,expected:D.symbol,received:r.parsedType}),Q}return nn(e.data)}};pl.create=t=>new pl({typeName:Z.ZodSymbol,...ie(t)});var xa=class extends ce{_parse(e){if(this._getType(e)!==D.undefined){let r=this._getOrReturnCtx(e);return M(r,{code:N.invalid_type,expected:D.undefined,received:r.parsedType}),Q}return nn(e.data)}};xa.create=t=>new xa({typeName:Z.ZodUndefined,...ie(t)});var va=class extends ce{_parse(e){if(this._getType(e)!==D.null){let r=this._getOrReturnCtx(e);return M(r,{code:N.invalid_type,expected:D.null,received:r.parsedType}),Q}return nn(e.data)}};va.create=t=>new va({typeName:Z.ZodNull,...ie(t)});var Ti=class extends ce{constructor(){super(...arguments),this._any=!0}_parse(e){return nn(e.data)}};Ti.create=t=>new Ti({typeName:Z.ZodAny,...ie(t)});var rs=class extends ce{constructor(){super(...arguments),this._unknown=!0}_parse(e){return nn(e.data)}};rs.create=t=>new rs({typeName:Z.ZodUnknown,...ie(t)});var Br=class extends ce{_parse(e){let n=this._getOrReturnCtx(e);return M(n,{code:N.invalid_type,expected:D.never,received:n.parsedType}),Q}};Br.create=t=>new Br({typeName:Z.ZodNever,...ie(t)});var dl=class extends ce{_parse(e){if(this._getType(e)!==D.undefined){let r=this._getOrReturnCtx(e);return M(r,{code:N.invalid_type,expected:D.void,received:r.parsedType}),Q}return nn(e.data)}};dl.create=t=>new dl({typeName:Z.ZodVoid,...ie(t)});var os=class t extends ce{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),o=this._def;if(n.parsedType!==D.array)return M(n,{code:N.invalid_type,expected:D.array,received:n.parsedType}),Q;if(o.exactLength!==null){let i=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(i||a)&&(M(n,{code:i?N.too_big:N.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(M(n,{code:N.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(M(n,{code:N.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,a)=>o.type._parseAsync(new Er(n,i,n.path,a)))).then(i=>Ft.mergeArray(r,i));let s=[...n.data].map((i,a)=>o.type._parseSync(new Er(n,i,n.path,a)));return Ft.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:j.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:j.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:j.toString(n)}})}nonempty(e){return this.min(1,e)}};os.create=(t,e)=>new os({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Z.ZodArray,...ie(e)});function ll(t){if(t instanceof Ln){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=Tr.create(ll(r))}return new Ln({...t._def,shape:()=>e})}else return t instanceof os?new os({...t._def,type:ll(t.element)}):t instanceof Tr?Tr.create(ll(t.unwrap())):t instanceof Ro?Ro.create(ll(t.unwrap())):t instanceof Ao?Ao.create(t.items.map(e=>ll(e))):t}var Ln=class t extends ce{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=de.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==D.object){let l=this._getOrReturnCtx(e);return M(l,{code:N.invalid_type,expected:D.object,received:l.parsedType}),Q}let{status:r,ctx:o}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Br&&this._def.unknownKeys==="strip"))for(let l in o.data)i.includes(l)||a.push(l);let c=[];for(let l of i){let p=s[l],d=o.data[l];c.push({key:{status:"valid",value:l},value:p._parse(new Er(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof Br){let l=this._def.unknownKeys;if(l==="passthrough")for(let p of a)c.push({key:{status:"valid",value:p},value:{status:"valid",value:o.data[p]}});else if(l==="strict")a.length>0&&(M(o,{code:N.unrecognized_keys,keys:a}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let p of a){let d=o.data[p];c.push({key:{status:"valid",value:p},value:l._parse(new Er(o,d,o.path,p)),alwaysSet:p in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let l=[];for(let p of c){let d=await p.key,_=await p.value;l.push({key:d,value:_,alwaysSet:p.alwaysSet})}return l}).then(l=>Ft.mergeObjectSync(r,l)):Ft.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return j.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let o=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:j.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Z.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of de.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of de.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return ll(this)}partial(e){let n={};for(let r of de.objectKeys(this.shape)){let o=this.shape[r];e&&!e[r]?n[r]=o:n[r]=o.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of de.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Tr;)s=s._def.innerType;n[r]=s}return new t({...this._def,shape:()=>n})}keyof(){return y3(de.objectKeys(this.shape))}};Ln.create=(t,e)=>new Ln({shape:()=>t,unknownKeys:"strip",catchall:Br.create(),typeName:Z.ZodObject,...ie(e)});Ln.strictCreate=(t,e)=>new Ln({shape:()=>t,unknownKeys:"strict",catchall:Br.create(),typeName:Z.ZodObject,...ie(e)});Ln.lazycreate=(t,e)=>new Ln({shape:t,unknownKeys:"strip",catchall:Br.create(),typeName:Z.ZodObject,...ie(e)});var La=class extends ce{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function o(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let i=s.map(a=>new vn(a.ctx.common.issues));return M(n,{code:N.invalid_union,unionErrors:i}),Q}if(n.common.async)return Promise.all(r.map(async s=>{let i={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(o);{let s,i=[];for(let c of r){let l={...n,common:{...n.common,issues:[]},parent:null},p=c._parseSync({data:n.data,path:n.path,parent:l});if(p.status==="valid")return p;p.status==="dirty"&&!s&&(s={result:p,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(c=>new vn(c));return M(n,{code:N.invalid_union,unionErrors:a}),Q}}get options(){return this._def.options}};La.create=(t,e)=>new La({options:t,typeName:Z.ZodUnion,...ie(e)});var ns=t=>t instanceof Ua?ns(t.schema):t instanceof Sr?ns(t.innerType()):t instanceof wa?[t.value]:t instanceof ka?t.options:t instanceof Ga?de.objectValues(t.enum):t instanceof Ba?ns(t._def.innerType):t instanceof xa?[void 0]:t instanceof va?[null]:t instanceof Tr?[void 0,...ns(t.unwrap())]:t instanceof Ro?[null,...ns(t.unwrap())]:t instanceof Zd||t instanceof Ha?ns(t.unwrap()):t instanceof ja?ns(t._def.innerType):[],$S=class t extends ce{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==D.object)return M(n,{code:N.invalid_type,expected:D.object,received:n.parsedType}),Q;let r=this.discriminator,o=n.data[r],s=this.optionsMap.get(o);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(M(n,{code:N.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Q)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let o=new Map;for(let s of n){let i=ns(s.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of i){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,s)}}return new t({typeName:Z.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:o,...ie(r)})}};function _C(t,e){let n=go(t),r=go(e);if(t===e)return{valid:!0,data:t};if(n===D.object&&r===D.object){let o=de.objectKeys(e),s=de.objectKeys(t).filter(a=>o.indexOf(a)!==-1),i={...t,...e};for(let a of s){let c=_C(t[a],e[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(n===D.array&&r===D.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let s=0;s<t.length;s++){let i=t[s],a=e[s],c=_C(i,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return n===D.date&&r===D.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Da=class extends ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=(s,i)=>{if(VS(s)||VS(i))return Q;let a=_C(s.value,i.value);return a.valid?((qS(s)||qS(i))&&n.dirty(),{status:n.value,value:a.data}):(M(r,{code:N.invalid_intersection_types}),Q)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,i])=>o(s,i)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Da.create=(t,e,n)=>new Da({left:t,right:e,typeName:Z.ZodIntersection,...ie(n)});var Ao=class t extends ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.array)return M(r,{code:N.invalid_type,expected:D.array,received:r.parsedType}),Q;if(r.data.length<this._def.items.length)return M(r,{code:N.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q;!this._def.rest&&r.data.length>this._def.items.length&&(M(r,{code:N.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let s=[...r.data].map((i,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Er(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(s).then(i=>Ft.mergeArray(n,i)):Ft.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Ao.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ao({items:t,typeName:Z.ZodTuple,rest:null,...ie(e)})};var YS=class t extends ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.object)return M(r,{code:N.invalid_type,expected:D.object,received:r.parsedType}),Q;let o=[],s=this._def.keyType,i=this._def.valueType;for(let a in r.data)o.push({key:s._parse(new Er(r,a,r.path,a)),value:i._parse(new Er(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Ft.mergeObjectAsync(n,o):Ft.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof ce?new t({keyType:e,valueType:n,typeName:Z.ZodRecord,...ie(r)}):new t({keyType:hi.create(),valueType:e,typeName:Z.ZodRecord,...ie(n)})}},_l=class extends ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.map)return M(r,{code:N.invalid_type,expected:D.map,received:r.parsedType}),Q;let o=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([a,c],l)=>({key:o._parse(new Er(r,a,r.path,[l,"key"])),value:s._parse(new Er(r,c,r.path,[l,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of i){let l=await c.key,p=await c.value;if(l.status==="aborted"||p.status==="aborted")return Q;(l.status==="dirty"||p.status==="dirty")&&n.dirty(),a.set(l.value,p.value)}return{status:n.value,value:a}})}else{let a=new Map;for(let c of i){let l=c.key,p=c.value;if(l.status==="aborted"||p.status==="aborted")return Q;(l.status==="dirty"||p.status==="dirty")&&n.dirty(),a.set(l.value,p.value)}return{status:n.value,value:a}}}};_l.create=(t,e,n)=>new _l({valueType:e,keyType:t,typeName:Z.ZodMap,...ie(n)});var fl=class t extends ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==D.set)return M(r,{code:N.invalid_type,expected:D.set,received:r.parsedType}),Q;let o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(M(r,{code:N.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(M(r,{code:N.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());let s=this._def.valueType;function i(c){let l=new Set;for(let p of c){if(p.status==="aborted")return Q;p.status==="dirty"&&n.dirty(),l.add(p.value)}return{status:n.value,value:l}}let a=[...r.data.values()].map((c,l)=>s._parse(new Er(r,c,r.path,l)));return r.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(e,n){return new t({...this._def,minSize:{value:e,message:j.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:j.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};fl.create=(t,e)=>new fl({valueType:t,minSize:null,maxSize:null,typeName:Z.ZodSet,...ie(e)});var WS=class t extends ce{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==D.function)return M(n,{code:N.invalid_type,expected:D.function,received:n.parsedType}),Q;function r(a,c){return Jd({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,cl(),ts].filter(l=>!!l),issueData:{code:N.invalid_arguments,argumentsError:c}})}function o(a,c){return Jd({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,cl(),ts].filter(l=>!!l),issueData:{code:N.invalid_return_type,returnTypeError:c}})}let s={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof Ei){let a=this;return nn(async function(...c){let l=new vn([]),p=await a._def.args.parseAsync(c,s).catch(f=>{throw l.addIssue(r(c,f)),l}),d=await Reflect.apply(i,this,p);return await a._def.returns._def.type.parseAsync(d,s).catch(f=>{throw l.addIssue(o(d,f)),l})})}else{let a=this;return nn(function(...c){let l=a._def.args.safeParse(c,s);if(!l.success)throw new vn([r(c,l.error)]);let p=Reflect.apply(i,this,l.data),d=a._def.returns.safeParse(p,s);if(!d.success)throw new vn([o(p,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Ao.create(e).rest(rs.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||Ao.create([]).rest(rs.create()),returns:n||rs.create(),typeName:Z.ZodFunction,...ie(r)})}},Ua=class extends ce{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};Ua.create=(t,e)=>new Ua({getter:t,typeName:Z.ZodLazy,...ie(e)});var wa=class extends ce{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return M(n,{received:n.data,code:N.invalid_literal,expected:this._def.value}),Q}return{status:"valid",value:e.data}}get value(){return this._def.value}};wa.create=(t,e)=>new wa({value:t,typeName:Z.ZodLiteral,...ie(e)});function y3(t,e){return new ka({values:t,typeName:Z.ZodEnum,...ie(e)})}var ka=class t extends ce{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return M(n,{expected:de.joinValues(r),received:n.parsedType,code:N.invalid_type}),Q}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return M(n,{received:n.data,code:N.invalid_enum_value,options:r}),Q}return nn(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};ka.create=y3;var Ga=class extends ce{_parse(e){let n=de.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==D.string&&r.parsedType!==D.number){let o=de.objectValues(n);return M(r,{expected:de.joinValues(o),received:r.parsedType,code:N.invalid_type}),Q}if(this._cache||(this._cache=new Set(de.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=de.objectValues(n);return M(r,{received:r.data,code:N.invalid_enum_value,options:o}),Q}return nn(e.data)}get enum(){return this._def.values}};Ga.create=(t,e)=>new Ga({values:t,typeName:Z.ZodNativeEnum,...ie(e)});var Ei=class extends ce{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==D.promise&&n.common.async===!1)return M(n,{code:N.invalid_type,expected:D.promise,received:n.parsedType}),Q;let r=n.parsedType===D.promise?n.data:Promise.resolve(n.data);return nn(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Ei.create=(t,e)=>new Ei({type:t,typeName:Z.ZodPromise,...ie(e)});var Sr=class extends ce{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=this._def.effect||null,s={addIssue:i=>{M(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){let i=o.transform(r.data,s);if(r.common.async)return Promise.resolve(i).then(async a=>{if(n.value==="aborted")return Q;let c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status==="aborted"?Q:c.status==="dirty"?Na(c.value):n.value==="dirty"?Na(c.value):c});{if(n.value==="aborted")return Q;let a=this._def.schema._parseSync({data:i,path:r.path,parent:r});return a.status==="aborted"?Q:a.status==="dirty"?Na(a.value):n.value==="dirty"?Na(a.value):a}}if(o.type==="refinement"){let i=a=>{let c=o.refinement(a,s);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Q:(a.status==="dirty"&&n.dirty(),i(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Q:(a.status==="dirty"&&n.dirty(),i(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!mi(i))return Q;let a=o.transform(i.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>mi(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:n.value,value:a})):Q);de.assertNever(o)}};Sr.create=(t,e,n)=>new Sr({schema:t,typeName:Z.ZodEffects,effect:e,...ie(n)});Sr.createWithPreprocess=(t,e,n)=>new Sr({schema:e,effect:{type:"preprocess",transform:t},typeName:Z.ZodEffects,...ie(n)});var Tr=class extends ce{_parse(e){return this._getType(e)===D.undefined?nn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Tr.create=(t,e)=>new Tr({innerType:t,typeName:Z.ZodOptional,...ie(e)});var Ro=class extends ce{_parse(e){return this._getType(e)===D.null?nn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ro.create=(t,e)=>new Ro({innerType:t,typeName:Z.ZodNullable,...ie(e)});var Ba=class extends ce{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===D.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};Ba.create=(t,e)=>new Ba({innerType:t,typeName:Z.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ie(e)});var ja=class extends ce{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ul(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new vn(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new vn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};ja.create=(t,e)=>new ja({innerType:t,typeName:Z.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ie(e)});var ml=class extends ce{_parse(e){if(this._getType(e)!==D.nan){let r=this._getOrReturnCtx(e);return M(r,{code:N.invalid_type,expected:D.nan,received:r.parsedType}),Q}return{status:"valid",value:e.data}}};ml.create=t=>new ml({typeName:Z.ZodNaN,...ie(t)});var aNe=Symbol("zod_brand"),Zd=class extends ce{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},e_=class t extends ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Q:s.status==="dirty"?(n.dirty(),Na(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{let o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Q:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:Z.ZodPipeline})}},Ha=class extends ce{_parse(e){let n=this._def.innerType._parse(e),r=o=>(mi(o)&&(o.value=Object.freeze(o.value)),o);return ul(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}};Ha.create=(t,e)=>new Ha({innerType:t,typeName:Z.ZodReadonly,...ie(e)});function S3(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function I3(t,e={},n){return t?Ti.create().superRefine((r,o)=>{let s=t(r);if(s instanceof Promise)return s.then(i=>{if(!i){let a=S3(e,r),c=a.fatal??n??!0;o.addIssue({code:"custom",...a,fatal:c})}});if(!s){let i=S3(e,r),a=i.fatal??n??!0;o.addIssue({code:"custom",...i,fatal:a})}}):Ti.create()}var cNe={object:Ln.lazycreate},Z;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Z||(Z={}));var uNe=(t,e={message:`Input not instance of ${t.name}`})=>I3(n=>n instanceof t,e),O3=hi.create,N3=ba.create,lNe=ml.create,pNe=Ca.create,b3=Pa.create,dNe=Ma.create,_Ne=pl.create,fNe=xa.create,mNe=va.create,hNe=Ti.create,TNe=rs.create,ENe=Br.create,SNe=dl.create,gNe=os.create,ANe=Ln.create,RNe=Ln.strictCreate,yNe=La.create,INe=$S.create,ONe=Da.create,NNe=Ao.create,bNe=YS.create,CNe=_l.create,PNe=fl.create,MNe=WS.create,xNe=Ua.create,vNe=wa.create,LNe=ka.create,DNe=Ga.create,UNe=Ei.create,wNe=Sr.create,kNe=Tr.create,GNe=Ro.create,BNe=Sr.createWithPreprocess,jNe=e_.create,HNe=()=>O3().optional(),FNe=()=>N3().optional(),VNe=()=>b3().optional(),qNe={string:t=>hi.create({...t,coerce:!0}),number:t=>ba.create({...t,coerce:!0}),boolean:t=>Pa.create({...t,coerce:!0}),bigint:t=>Ca.create({...t,coerce:!0}),date:t=>Ma.create({...t,coerce:!0})};var $Ne=Q;var YNe=t=>typeof t?.safeParse=="function";var fC=t=>typeof t?.passthrough=="function";var WNe=(t,e)=>fC(t)?fC(e)?t.merge(e):t:fC(e)?e:Object.assign({},t,e);var a5e=u.object({name:u.literal("ZodError"),issues:u.array(u.object({path:u.array(u.union([u.string(),u.number()])),message:u.string().optional(),code:u.nativeEnum(u.ZodIssueCode)}).catchall(u.any()))}),zNe=Symbol("ContractNoBody"),P3=t=>"method"in t&&"path"in t;var M3=(t,e)=>Object.fromEntries(Object.entries(t).map(([n,r])=>{var o,s,i;return P3(r)?[n,{...r,path:e?.pathPrefix?e.pathPrefix+r.path:r.path,headers:WNe(e?.baseHeaders,r.headers),strictStatusCodes:(o=r.strictStatusCodes)!==null&&o!==void 0?o:e?.strictStatusCodes,validateResponseOnClient:(s=r.validateResponseOnClient)!==null&&s!==void 0?s:e?.validateResponseOnClient,responses:{...e?.commonResponses,...r.responses},metadata:e?.metadata?{...e?.metadata,...(i=r.metadata)!==null&&i!==void 0?i:{}}:r.metadata}]:[n,M3(r,e)]})),mC=Symbol("ContractPlainType"),gr=()=>({router:(t,e)=>M3(t,e),query:t=>t,mutation:t=>t,responses:t=>t,response:()=>mC,body:()=>mC,type:()=>mC,otherResponse:({contentType:t,body:e})=>({contentType:t,body:e}),noBody:()=>zNe}),KNe=({path:t,params:e})=>{let n=e;return t.replace(/\/?:([^/?]+)\??/g,(r,o)=>n[o]?`${r.startsWith("/")?"/":""}${n[o]}`:"")},QNe=(t,e=!1)=>{let n=e?XNe(t):JNe(t);return n?.length>0?"?"+n:""},XNe=t=>t?Object.entries(t).filter(([,e])=>e!==void 0).map(([e,n])=>{let r;return typeof n=="string"&&!["true","false","null"].includes(n.trim())&&isNaN(Number(n))?r=n:r=JSON.stringify(n),`${encodeURIComponent(e)}=${encodeURIComponent(r)}`}).join("&"):"",JNe=t=>t?Object.keys(t).flatMap(e=>hC(e,t[e])).map(([e,n])=>`${encodeURIComponent(e)}=${encodeURIComponent(n)}`).join("&"):"",hC=(t,e)=>Array.isArray(e)?e.flatMap((n,r)=>hC(`${t}[${r}]`,n)):e instanceof Date?[[`${t}`,e.toISOString()]]:e===null?[[`${t}`,""]]:e===void 0?[]:typeof e=="object"?Object.keys(e).flatMap(n=>hC(`${t}[${n}]`,e[n])):[[`${t}`,`${e}`]];var TC=class extends Error{constructor(e,n){let r=n.join(",");super(`Server returned unexpected response. Expected one of: ${r} got: ${e.status}`),this.response=e}};var ZNe=async({route:t,path:e,method:n,headers:r,body:o,validateResponse:s,fetchOptions:i})=>{let a=await fetch(e,{...i,method:n,headers:r,body:o}),c=a.headers.get("content-type");if(c?.includes("application/")&&c?.includes("json")){let l={status:a.status,body:await a.json(),headers:a.headers},p=t.responses[l.status];return(s??t.validateResponseOnClient)&&YNe(p)?{...l,body:p.parse(l.body)}:l}return c?.includes("text/")?{status:a.status,body:await a.text(),headers:a.headers}:{status:a.status,body:await a.blob(),headers:a.headers}},ebe=t=>{let e=new FormData,n=(r,o)=>{o instanceof File?e.append(r,o):e.append(r,JSON.stringify(o))};return Object.entries(t).forEach(([r,o])=>{if(Array.isArray(o))for(let s of o)n(r,s);else n(r,o)}),e},C3=t=>Object.fromEntries(Object.entries(t).map(([e,n])=>[e.toLowerCase(),n])),tbe=t=>{let{path:e,clientArgs:n,route:r,body:o,query:s,extraInputArgs:i,headers:a,fetchOptions:c}=t,l=n.api||ZNe,p=n.baseHeaders&&Object.fromEntries(Object.entries(n.baseHeaders).map(([f,m])=>typeof m=="function"?[f,m(t)]:[f,m])),d={...p&&C3(p),...C3(a)};Object.keys(d).forEach(f=>{d[f]===void 0&&delete d[f]});let _={route:r,path:e,method:r.method,headers:d,body:void 0,rawBody:o,rawQuery:s,contentType:void 0,validateResponse:n.validateResponse,fetchOptions:{...n.credentials&&{credentials:n.credentials},...c},...c?.signal&&{signal:c.signal},...c?.cache&&{cache:c.cache},...c&&"next"in c&&!!c?.next&&{next:c.next}};return r.method!=="GET"&&("contentType"in r&&r.contentType==="multipart/form-data"?_={..._,contentType:"multipart/form-data",body:o instanceof FormData?o:ebe(o)}:"contentType"in r&&r.contentType==="application/x-www-form-urlencoded"?_={..._,contentType:"application/x-www-form-urlencoded",headers:{"content-type":"application/x-www-form-urlencoded",..._.headers},body:typeof o=="string"?o:new URLSearchParams(o)}:o!=null&&(_={..._,contentType:"application/json",headers:{"content-type":"application/json",..._.headers},body:JSON.stringify(o)})),l({..._,...i})},nbe=(t,e,n)=>{let{query:r,params:o,body:s,headers:i,extraHeaders:a,overrideClientOptions:c,fetchOptions:l,cache:p,next:d,..._}=n||{},f={...e,...c};return{path:rbe(r,f.baseUrl,o,t,!!f.jsonQuery),clientArgs:f,route:t,body:s,query:r,extraInputArgs:_,fetchOptions:{...p&&{cache:p},...d&&{next:d},...l},headers:{...a,...i}}},rbe=(t,e,n,r,o)=>{let s=KNe({path:r.path,params:n}),i=QNe(t,o);return`${e}${s}${i}`},obe=(t,e)=>{let n=Object.keys(t.responses);return async r=>{let o=nbe(t,e,r),s=await tbe(o);if(!e.throwOnUnknownStatus||n.includes(s.status.toString()))return s;throw new TC(s,n)}},EC=(t,e)=>Object.fromEntries(Object.entries(t).map(([n,r])=>P3(r)?[n,obe(r,e)]:[n,EC(r,e)]));var SC=["free","creator","team"],x3=typeof process<"u"&&process.env?.NODE_ENV!=="production",sbe={stripe:{plans:[{tier:"free",subjectType:"user",name:"Free",description:"Upload threads, share read-only links, and collaborate with your workspace. Shared links expire after 3 days.",price:0,priceId:null,features:[{name:"Thread uploads + public links"},{name:"Workspace membership"},{name:"Shared links live 3 days"}],entitlements:{skills:!1,workspaceScope:!1,review:!1,sharedThreadTtlDays:3}},{tier:"creator",subjectType:"user",name:"Creator",description:"For builders who share a lot. Permanent links and the Skills tab.",price:29,isFeatured:!0,priceId:x3?"price_1TP9BSKwvRM43sh64waIrvjj":"price_1TPA2gKwvRM43sh6Kp4ZCpJZ",features:[{name:"Everything in Free"},{name:"Shared threads live forever"},{name:"Skills tab \u2014 tool usage across every thread"}],entitlements:{skills:!0,workspaceScope:!1,review:!1,sharedThreadTtlDays:null}},{tier:"team",subjectType:"organization",name:"Team",description:"GitHub for Prompts. Org-wide thread sharing plus the review surface.",price:19,minSeats:2,priceId:x3?"price_1TP9MpKwvRM43sh6TBIFxVCd":"price_1TPA3CKwvRM43sh6k0bgPTsQ",features:[{name:"Everything in Creator"},{name:"Workspace-wide thread sharing"},{name:"Minimum 2 seats"},{name:"Review feature (beta)"}],entitlements:{skills:!0,workspaceScope:!0,review:!0,sharedThreadTtlDays:null}}]}};var v3=sbe.stripe.plans,u5e=Object.freeze(Object.fromEntries(v3.map(t=>[t.tier,t])));var ibe=gr(),rn=u.object({message:u.string()}),gC=u.record(u.unknown()),Fa=u.string().regex(/^doc_[0-9A-Za-z]{22}$/),zS=u.string().regex(/^proj_[0-9A-Za-z]{22}$/),abe=["active","archived"],KS=u.enum(abe),L3=u.object({id:u.string().min(1),display_name:u.string().min(1)}),D3=u.object({id:zS,name:u.string().min(1)}),AC=u.object({id:Fa,title:u.string().min(1),status:KS,author:L3,project:D3.nullable(),created_at:u.string().datetime(),updated_at:u.string().datetime(),archived_at:u.string().datetime().nullable()}),cbe=u.object({type:u.literal("list"),list_type:u.literal("doc"),objects:u.array(AC)}),ube=u.object({project_id:zS.optional(),status:KS.optional()}),lbe=u.object({title:u.string().trim().min(1).max(300).optional(),prosemirror_json:gC.optional(),project_id:zS.nullable().optional()}),pbe=u.object({id:Fa,created_at:u.string().datetime()}),dbe=u.object({title:u.string().trim().min(1).max(300).optional(),prosemirror_json:gC.optional(),project_id:zS.nullable().optional(),status:KS.optional()}).refine(t=>Object.keys(t).length>0,{message:"At least one field must be provided"}),_be=u.object({id:Fa,updated_at:u.string().datetime()}),fbe=u.object({id:Fa,title:u.string().min(1),prosemirror_json:gC,status:KS,author:L3,project:D3.nullable(),created_at:u.string().datetime(),updated_at:u.string().datetime(),archived_at:u.string().datetime().nullable()}),U3=ibe.router({listDocs:{method:"GET",path:"/docs",headers:u.object({authorization:u.string().min(1).optional()}),query:ube,responses:{200:cbe,401:rn,403:rn},summary:"List docs in the authenticated user\u2019s organization. Optional project_id filter scopes to a single project."},createDoc:{method:"POST",path:"/docs",headers:u.object({authorization:u.string().min(1).optional()}),body:lbe,responses:{201:pbe,401:rn,403:rn,404:rn,422:rn},summary:"Create a doc. If project_id is provided, the doc is scoped to that project; otherwise it lives at the workspace level."},getDoc:{method:"GET",path:"/docs/:docId",pathParams:u.object({docId:Fa}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:fbe,401:rn,403:rn,404:rn},summary:"Get a doc by id with its rich-text body and parent project (if any)"},updateDoc:{method:"PATCH",path:"/docs/:docId",pathParams:u.object({docId:Fa}),headers:u.object({authorization:u.string().min(1).optional()}),body:dbe,responses:{200:_be,401:rn,403:rn,404:rn,422:rn},summary:"Update a doc. If prosemirror_json changes, the server re-syncs lore.mention_references from mention nodes."},deleteDoc:{method:"DELETE",path:"/docs/:docId",pathParams:u.object({docId:Fa}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.object({}),401:rn,403:rn,404:rn},summary:"Hard-delete a doc and any mention references it owns"}});var mbe=gr(),et=u.object({message:u.string()}),RC=u.record(u.unknown()),yo=u.string().regex(/^proj_[0-9A-Za-z]{22}$/),hbe=["active","archived"],QS=u.enum(hbe),yC=u.object({id:u.string().min(1),display_name:u.string().min(1)}),w3=u.object({thread_id:u.string().min(1),title:u.string().min(1),added_at:u.string().datetime(),added_by:yC}),Tbe=u.object({id:yo,name:u.string().min(1),status:QS,author:yC,thread_count:u.number().int().nonnegative(),doc_count:u.number().int().nonnegative(),created_at:u.string().datetime(),updated_at:u.string().datetime(),archived_at:u.string().datetime().nullable()}),Ebe=u.object({type:u.literal("list"),list_type:u.literal("project"),objects:u.array(Tbe)}),Sbe=u.object({status:QS.optional()}),gbe=u.object({name:u.string().trim().min(1).max(200),prosemirror_json:RC.optional()}),Abe=u.object({id:yo,created_at:u.string().datetime()}),Rbe=u.object({name:u.string().trim().min(1).max(200).optional(),prosemirror_json:RC.optional()}).refine(t=>Object.keys(t).length>0,{message:"At least one field must be provided"}),ybe=u.object({id:yo,updated_at:u.string().datetime()}),Ibe=u.object({archived:u.boolean()}),Obe=u.object({id:yo,status:QS,archived_at:u.string().datetime().nullable()}),Nbe=u.object({id:yo,name:u.string().min(1),prosemirror_json:RC,status:QS,author:yC,created_at:u.string().datetime(),updated_at:u.string().datetime(),archived_at:u.string().datetime().nullable(),threads:u.array(w3),docs:u.array(AC)}),bbe=u.object({thread_id:u.string().min(1).max(64)}),Cbe=w3,k3=mbe.router({listProjects:{method:"GET",path:"/projects",headers:u.object({authorization:u.string().min(1).optional()}),query:Sbe,responses:{200:Ebe,401:et},summary:"List projects in the authenticated user\u2019s organization"},createProject:{method:"POST",path:"/projects",headers:u.object({authorization:u.string().min(1).optional()}),body:gbe,responses:{201:Abe,401:et,422:et},summary:"Create a new project in the authenticated user\u2019s organization"},getProject:{method:"GET",path:"/projects/:projectId",pathParams:u.object({projectId:yo}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:Nbe,401:et,403:et,404:et},summary:"Get a project with its attached threads and child docs. The project description is the canonical mention source for project-scoped @-mentions."},updateProject:{method:"PATCH",path:"/projects/:projectId",pathParams:u.object({projectId:yo}),headers:u.object({authorization:u.string().min(1).optional()}),body:Rbe,responses:{200:ybe,401:et,403:et,404:et,422:et},summary:"Update a project\u2019s name or rich-text body. Body changes re-sync mention_references for source_kind=project."},archiveProject:{method:"POST",path:"/projects/:projectId/archive",pathParams:u.object({projectId:yo}),headers:u.object({authorization:u.string().min(1).optional()}),body:Ibe,responses:{200:Obe,401:et,403:et,404:et},summary:"Archive (soft-delete) or unarchive a project"},addProjectThread:{method:"POST",path:"/projects/:projectId/threads",pathParams:u.object({projectId:yo}),headers:u.object({authorization:u.string().min(1).optional()}),body:bbe,responses:{201:Cbe,401:et,403:et,404:et,409:et,422:et},summary:"Pin an existing visible thread to this project. Idempotent \u2014 re-adding returns the existing membership."},removeProjectThread:{method:"DELETE",path:"/projects/:projectId/threads/:threadId",pathParams:u.object({projectId:yo,threadId:u.string().min(1).max(64)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.object({}),401:et,403:et,404:et},summary:"Remove a thread membership from a project"}});var Pbe=gr(),XS=u.object({message:u.string()}),Mbe=["thread","plan","doc","user"],JS=u.enum(Mbe),xbe=["doc","project"],vbe=u.enum(xbe),Lbe=u.object({kind:JS,id:u.string().min(1),title:u.string().min(1),href:u.string().min(1)}),Dbe=u.object({type:u.literal("list"),list_type:u.literal("mention"),objects:u.array(Lbe)}),Ube=u.object({q:u.string().trim().min(1).max(50),kinds:u.string().optional().transform(t=>{if(!t)return;let e=t.split(",").map(n=>n.trim()).filter(n=>n.length>0);return e.length>0?e:void 0}).pipe(u.array(JS).optional())}),wbe=u.object({source_kind:vbe,source_id:u.string().min(1),source_title:u.string().min(1),source_href:u.string().min(1),target_kind:JS,target_id:u.string().min(1),created_at:u.string().datetime()}),kbe=u.object({type:u.literal("list"),list_type:u.literal("backlink"),objects:u.array(wbe)}),Gbe=u.object({target_kind:JS,target_id:u.string().min(1).max(64)}),G3=Pbe.router({searchMentions:{method:"GET",path:"/mentions/search",headers:u.object({authorization:u.string().min(1).optional()}),query:Ube,responses:{200:Dbe,401:XS,422:XS},summary:"Search threads, plans, files, and users by title/name for @-mention typeahead. Org-scoped, max 10 results across all kinds."},listBacklinks:{method:"GET",path:"/mentions/backlinks",headers:u.object({authorization:u.string().min(1).optional()}),query:Gbe,responses:{200:kbe,401:XS,403:XS},summary:"List every doc/project body in the caller\u2019s organization that mentions the given target. Newest-first."}});var Bbe=gr(),jbe=u.object({type:u.literal("list"),list_type:u.literal("thread"),has_more:u.boolean(),objects:u.array(u.unknown())}),Si=u.object({message:u.string()}),B3=u.object({thread_id:u.string().min(1),is_favorited:u.boolean(),favorited_at:u.string().datetime().nullable()}),Hbe=u.object({before:u.string().min(1).max(64).optional()}),j3=Bbe.router({addThreadFavorite:{method:"POST",path:"/threads/:id/favorite",pathParams:u.object({id:u.string().min(1).max(64)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{201:B3,401:Si,403:Si,404:Si},summary:"Bookmark a thread for the authenticated user. Idempotent \u2014 re-favoriting returns the existing membership."},removeThreadFavorite:{method:"DELETE",path:"/threads/:id/favorite",pathParams:u.object({id:u.string().min(1).max(64)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:B3,401:Si,403:Si,404:Si},summary:"Remove a thread bookmark for the authenticated user (no-op if absent)."},listFavoriteThreads:{method:"GET",path:"/favorites/threads",headers:u.object({authorization:u.string().min(1).optional()}),query:Hbe,responses:{200:jbe,401:Si,403:Si},summary:"List threads the authenticated user has favorited, newest favorited first. Visibility filtering still applies \u2014 a thread the viewer can no longer see (e.g. visibility downgraded) is omitted from the list."}});var Fbe=gr(),IC=u.object({message:u.string()}),Vbe=u.object({id:u.string().min(1),title:u.string(),href:u.string().min(1),author_display_name:u.string().nullable(),author_handle:u.string().nullable()}),qbe=u.object({name:u.string().min(1),usage_count:u.number().int().nonnegative(),href:u.string().min(1)}),$be=u.object({id:u.string().min(1),display_name:u.string(),handle:u.string().nullable(),avatar_url:u.string().nullable(),href:u.string().min(1)}),Ybe=u.object({type:u.literal("global_search"),threads:u.array(Vbe),skills:u.array(qbe),people:u.array($be)}),Wbe=u.object({q:u.string().trim().min(1).max(80)}),H3=Fbe.router({globalSearch:{method:"GET",path:"/search",headers:u.object({authorization:u.string().min(1).optional()}),query:Wbe,responses:{200:Ybe,401:IC,403:IC,422:IC},summary:"Global navbar search across threads, skills, and people. Org-scoped, max 5 results per kind."}});var zbe=gr(),Kbe=u.object({id:u.string().uuid(),role:u.enum(["user","assistant"]),content:u.string().min(1),timestamp:u.string().datetime()}),Qbe=u.object({id:u.string().uuid(),title:u.string().min(1),author:u.string().min(1),authorAvatar:u.string().min(1).max(4),model:u.string().min(1),turnCount:u.number().int().nonnegative(),createdAt:u.string().datetime(),preview:u.string()}),Y5e=Qbe.extend({messages:u.array(Kbe)}),A=u.object({message:u.string()}),Xbe=/^[a-zA-Z0-9_-]{2,32}$/,K3=u.string().regex(Xbe,"Handle must be 2\u201332 characters: letters, numbers, dashes, or underscores."),OC=u.object({id:u.string(),first_name:u.string().min(1),last_name:u.string().min(1),display_name:u.string().min(1),stytch_id:u.string().nullable(),handle:u.string().nullable(),bio:u.string().max(280).nullable(),avatar_url:u.string().nullable(),banner_url:u.string().nullable(),share_new_threads_to_workspace:u.boolean(),experimental_features_enabled:u.boolean(),onboarded_at:u.string().nullable()}),Jbe=u.object({stytchMemberId:u.string().min(1).optional(),emailAddress:u.string().email(),name:u.string().nullable(),user:OC,is_admin:u.boolean()}),Zbe=u.object({share_new_threads_to_workspace:u.boolean().optional(),experimental_features_enabled:u.boolean().optional(),onboarded_at:u.union([u.literal("now"),u.null()]).optional(),display_name:u.string().min(1).max(120).optional(),handle:K3.optional(),bio:u.string().max(280).nullable().optional(),avatar_storage_url:u.string().min(1).nullable().optional(),banner_storage_url:u.string().min(1).nullable().optional()}).refine(t=>Object.keys(t).length>0,{message:"At least one field must be provided"}),eCe=u.object({id:u.string(),display_name:u.string(),handle:u.string().nullable(),avatar_url:u.string().nullable(),visible_thread_count:u.number().int().nonnegative(),last_active_at:u.string().datetime().nullable()}),Q3=u.object({id:u.string().min(1),display_name:u.string().min(1),handle:u.string().nullable(),bio:u.string().max(280).nullable(),avatar_url:u.string().nullable(),banner_url:u.string().nullable(),organization_name:u.string().min(1).nullable(),created_at:u.string().min(1),visible_thread_count:u.number().int().nonnegative(),follower_count:u.number().int().nonnegative(),following_count:u.number().int().nonnegative(),published_project_count:u.number().int().nonnegative(),is_following:u.boolean(),is_self:u.boolean()}),tCe=u.object({type:u.literal("list"),list_type:u.literal("organization_member"),objects:u.array(eCe)}),nCe=u.object({email_address:u.string().email()}),rCe=u.object({email_address:u.string().email(),member_id:u.string().min(1)}),oCe=u.object({location:u.string().trim().min(1),contact:u.string().trim().email()}),sCe=u.object({location:u.string().min(1),contact:u.string().email(),created_at:u.string().datetime()}),iCe=u.object({first_name:u.string().min(1),last_name:u.string().min(1),display_name:u.string().min(1),stytch_id:u.string().min(1).optional()}),aCe=u.object({name:u.string().min(1),email_domains:u.array(u.string().min(1)).nonempty(),stytch_org_id:u.string().min(1)}),cCe=u.object({user:iCe,organization:aCe}),uCe=u.object({path_glob:u.string().min(1),name:u.string().min(1),description:u.string().min(1)}),lCe=u.object({repo_origin_path:u.string().min(1),building_blocks:u.array(uCe)}),X3=u.string().regex(/^th_[0-9A-Za-z]{22}$/),eg=u.string().regex(/^tb_[0-9A-Za-z]{22}$/),pCe=u.object({id:X3,author:u.object({id:u.string().min(1),display_name:u.string().min(1)}),body:u.string(),created_at:u.string().datetime(),repo_origin_path:u.string().min(1),latest_revision_id:eg,revision_count:u.number().int().positive()}),dCe=u.object({id:u.string().min(1),display_name:u.string().min(1)}),_Ce=u.object({id:u.string().min(1),author_id:u.string().min(1).nullable(),author:dCe.nullable(),created_at:u.string().datetime(),deleted_at:u.string().datetime().nullable(),content:u.string().min(1)}),fCe=u.object({id:u.string().min(1),thread_block_id:u.string().min(1),created_at:u.string().datetime(),resolved_at:u.string().datetime().nullable(),comments:u.array(_Ce)}),mCe=u.object({thread_block_id:eg,from_position:u.number().int().positive(),to_position:u.number().int().positive(),selected_text:u.string().min(1),content:u.string().trim().min(1)}),hCe=u.object({id:u.string().min(1)}),TCe=u.object({content:u.string().trim().min(1)}),ECe=u.object({id:u.string().min(1)}),SCe=u.object({content:u.string().trim().min(1)}),gCe=u.object({id:u.string().min(1)}),ACe=u.object({content:u.string().trim().min(1)}),RCe=u.object({id:u.string().min(1)}),yCe=u.object({resolved:u.boolean()}),ICe=u.object({id:u.string().min(1),resolved_at:u.string().datetime().nullable()}),OCe=u.object({resolved:u.boolean()}),NCe=u.object({id:u.string().min(1),resolved_at:u.string().datetime().nullable()}),J3=u.record(u.unknown()),bCe=u.object({id:eg,body:u.string(),created_at:u.string().datetime(),prosemirror_json:J3,comment_threads:u.array(fCe)}),CCe=u.object({id:X3,created_at:u.string().datetime(),repo_origin_path:u.string().min(1),author:u.object({id:u.string().min(1),display_name:u.string().min(1)}),latest_revision_id:eg,revision_count:u.number().int().positive(),revisions:u.array(bCe)}),PCe=u.object({type:u.literal("list"),list_type:u.literal("plan"),has_more:u.boolean(),objects:u.array(pCe)}),MCe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional(),author_id:u.string().min(1).optional(),repo_origin_path:u.string().min(1).optional()}),Z3=u.object({id:u.string().min(1),organization_id:u.string().min(1),created_at:u.string().min(1),repo_origin_path:u.string().min(1),path_glob:u.string().min(1),name:u.string().min(1),description:u.string().min(1)}),xCe=u.array(Z3),vCe=u.object({type:u.literal("list"),list_type:u.literal("building_block"),has_more:u.boolean(),objects:u.array(Z3)}),LCe=u.object({repo_origin_path:u.string().min(1),before:u.string().min(1).optional(),after:u.string().min(1).optional()}),DCe=u.enum(["thread","building_block"]),UCe=u.object({repo_origin_path:u.string().min(1),sources:u.array(DCe).nonempty()}),wCe=u.object({type:u.literal("list"),list_type:u.literal("repository"),has_more:u.boolean(),objects:u.array(UCe)}),gi=u.enum(["claudeCode","codex","amp","cursor","unspecified"]),kCe=["transcript","plan"],GCe=u.enum(kCe),BCe=u.object({md5:u.string().min(1),harness:gi,filename:u.string().min(1).optional(),repo_origin_path:u.string().min(1).optional(),harness_internal_id:u.string().min(1).optional(),file_type:GCe.optional()}).refine(t=>(t.filename?.trim().length??0)>0||(t.harness_internal_id?.trim().length??0)>0,{path:["harness_internal_id"],message:"filename or harness_internal_id is required"}),bC=u.object({id:u.string().min(1),display_name:u.string().min(1)}),jCe=u.object({id:u.string().min(1),display_name:u.string().min(1)}),e9=u.object({id:u.string().min(1),author_id:u.string().min(1).nullable(),author:jCe.nullable(),created_at:u.string().datetime(),deleted_at:u.string().datetime().nullable(),content:u.string().min(1)}),t9=u.object({id:u.string().min(1),thread_block_id:u.string().min(1),created_at:u.string().datetime(),resolved_at:u.string().datetime().nullable()}),HCe=t9.extend({comments:u.array(e9)}),t_=u.object({id:u.string().min(1),type:u.string().min(1),index_in_thread:u.number().int().nonnegative(),isCritiqued:u.boolean(),comment_threads:u.array(HCe).optional()}).passthrough(),n9=u.object({type:u.literal("list"),list_type:u.literal("thread_block"),has_more:u.boolean(),objects:u.array(t_)}),F3=t_.extend({type:u.literal("plan"),prosemirror_json:J3,thread_file_id:u.string().min(1)}),FCe=u.union([u.literal(-1),u.literal(1)]),r9=u.union([u.literal(-1),u.literal(0),u.literal(1)]),V3=u.object({score:u.number().int(),up_count:u.number().int().nonnegative(),down_count:u.number().int().nonnegative(),viewer_vote:r9}),VCe=u.object({value:FCe}),qCe=u.object({id:u.string().min(1),display_name:u.string().min(1),avatar_url:u.string().nullable()}),Va=u.object({id:u.string().min(1),thread_id:u.string().min(1),author_id:u.string().min(1).nullable(),author:qCe.nullable(),parent_comment_id:u.string().min(1).nullable(),content:u.string(),created_at:u.string().datetime(),updated_at:u.string().datetime(),deleted_at:u.string().datetime().nullable()}),$Ce=u.object({type:u.literal("list"),list_type:u.literal("thread_comment"),objects:u.array(Va)}),YCe=u.object({content:u.string().trim().min(1).max(4e3),parent_comment_id:u.string().min(1).optional()}),WCe=Va,zCe=u.object({content:u.string().trim().min(1).max(4e3)}),KCe=Va,QCe=Va,W5e=u.discriminatedUnion("kind",[u.object({kind:u.literal("created"),thread_id:u.string().min(1),actor_user_id:u.string().min(1),version:u.number(),comment:Va}),u.object({kind:u.literal("updated"),thread_id:u.string().min(1),actor_user_id:u.string().min(1),version:u.number(),comment:Va}),u.object({kind:u.literal("deleted"),thread_id:u.string().min(1),actor_user_id:u.string().min(1),version:u.number(),comment:Va})]),XCe=u.enum(["pending","generating","ready","failed"]),JCe=u.enum(["pending","generating","ready","failed"]),ZCe=u.enum(["pending","placeholder","ai","user"]),o9=u.enum(["pending","generating","ready","failed"]),s9=u.enum(["pending","generating","ready","failed","disabled"]),i9=u.enum(["pending","generating","ready","failed"]),ePe=u.object({title:u.string().min(1),body:u.string().min(1),files:u.array(u.string()).optional()}),tPe=u.object({status:s9,url:u.string().nullable(),url_expires_at:u.string().nullable(),generated_at:u.string().nullable(),model:u.string().nullable()}),nPe=u.object({status:i9,steps:u.array(ePe),generated_at:u.string().nullable()}),rPe=u.object({remix_of_thread_id:u.string().nullable(),remix_count:u.number().int().nonnegative()}),oPe=u.object({cover:tPe,how_to:nPe,lineage:rPe}),sPe=u.enum(["asked","requested","decided","corrected","shared"]),iPe=u.object({id:u.string().min(1),kind:sPe,summary:u.string().min(1),block_id:u.string().min(1)}),aPe=u.object({type:u.literal("list"),list_type:u.literal("thread_decision"),status:o9,generated_at:u.string().nullable(),objects:u.array(iPe)}),hl=u.object({id:u.string().min(1),thread_file_id:u.string().min(1),organization_id:u.string().min(1),author:bC,repo:u.string().min(1),title:u.string().min(1),started_at:u.string().min(1),blocks:n9,user_message_count:u.number().int().nonnegative(),files_touched:u.array(u.string()),skills_invoked:u.array(u.string()),harness:gi,transcript_parsing_state:u.enum(["pending","parsed","too_large_to_parse"]),visibility:u.enum(["private","workspace","public"]),has_plan:u.boolean().optional(),summary:u.string().nullable(),summary_status:XCe,summary_generated_at:u.string().nullable(),title_status:JCe,title_generated_at:u.string().nullable(),title_source:ZCe,decisions_status:o9,decisions_generated_at:u.string().nullable(),score:u.number().int(),up_count:u.number().int().nonnegative(),down_count:u.number().int().nonnegative(),viewer_vote:r9,comment_count:u.number().int().nonnegative(),is_favorited:u.boolean(),card:oPe}),cPe=u.object({storage_url:u.string().min(1)}),uPe=u.object({storage_url:u.string(),harness:gi,thread:hl.nullable()}),lPe=u.object({status:u.literal("complete"),thread_files:u.array(uPe)}),pPe=u.object({id:u.string(),presigned_url:u.string().nullable(),presigned_url_expires_at:u.string().nullable(),storage_url:u.string(),harness:gi,expected_md5:u.string(),error:u.string().nullable(),thread:hl.nullable()}),dPe=u.object({id:u.string(),substrate:u.enum(["s3","filesystem"]),status:u.enum(["incomplete","locked_for_parsing","complete","error"]),thread_files:u.array(pPe)}),_Pe=u.object({visibility:u.enum(["private","workspace","public"]).optional(),title:u.string().trim().min(1).max(200).optional()}).refine(t=>t.visibility!==void 0||t.title!==void 0,{message:"At least one of visibility or title must be provided"}),fPe=u.discriminatedUnion("visibility",[u.object({visibility:u.literal("private")}),u.object({visibility:u.literal("workspace")}),u.object({visibility:u.literal("public"),title:u.string().min(1),author_display_name:u.string().min(1),first_user_message:u.string().nullable(),summary:u.string().nullable(),started_at:u.string().min(1),harness:gi})]),mPe=hl,q3=u.object({type:u.literal("list"),list_type:u.literal("thread"),has_more:u.boolean(),objects:u.array(mPe)}),hPe=u.enum(["recent","popular"]),TPe=hl,EPe=u.object({type:u.literal("list"),list_type:u.literal("discover_thread"),has_more:u.boolean(),objects:u.array(TPe)}),SPe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional(),sort:hPe.optional(),harness:gi.optional(),search:u.string().max(200).optional()}),gPe=u.object({thread_count:u.number().int().nonnegative(),author_count:u.number().int().nonnegative(),organization_count:u.number().int().nonnegative(),harness_breakdown:u.record(gi,u.number().int().nonnegative())}),APe=u.object({id:u.string(),status:u.enum(["incomplete","locked_for_parsing","complete","error"]),created_at:u.string(),thread_count:u.number().int().nonnegative()}),RPe=u.object({type:u.literal("list"),list_type:u.literal("upload_session"),objects:u.array(APe)}),yPe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional()}),IPe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional(),author_ids:u.string().min(1).optional(),created_at:u.string().min(1).optional(),filepath_prefixes:u.string().min(1).optional()}),OPe=u.object({path:u.string().min(1),start_offset:u.number().int().nonnegative(),end_offset:u.number().int().positive()}),NPe=u.object({name:u.string(),usage_count:u.number().int().nonnegative(),author_count:u.number().int().nonnegative(),first_used_at:u.string().nullable(),last_used_at:u.string().nullable(),usage_count_last_24h:u.number().int().nonnegative(),usage_count_last_7d:u.number().int().nonnegative()}),bPe=u.object({type:u.literal("list"),list_type:u.literal("skill"),objects:u.array(NPe)}),CPe=u.object({id:u.string(),title:u.string(),visibility:u.enum(["private","workspace","public"]),started_at:u.string(),author:bC,skills_invoked:u.array(u.string())}),PPe=u.object({name:u.string(),usage_count:u.number().int().nonnegative(),author_count:u.number().int().nonnegative(),first_used_at:u.string().nullable(),last_used_at:u.string().nullable(),threads:u.array(CPe)}),MPe=u.object({path:u.string().min(1),text:u.string().max(64e3)}),xPe=u.enum(["text_edit","redact","delete_block"]),vPe=u.object({id:u.string(),thread_block_id:u.string(),editor:u.object({id:u.string(),display_name:u.string()}),kind:xPe,path:u.string().nullable(),previous_text:u.string().nullable(),new_text:u.string().nullable(),created_at:u.string()}),LPe=u.object({type:u.literal("list"),list_type:u.literal("thread_block_edit"),objects:u.array(vPe)}),DPe=u.object({organization_count:u.number().int().nonnegative(),user_count:u.number().int().nonnegative(),thread_count:u.number().int().nonnegative(),thread_count_last_24h:u.number().int().nonnegative(),user_count_last_24h:u.number().int().nonnegative()}),UPe=u.object({id:u.string(),name:u.string(),email_domains:u.array(u.string()),stytch_org_id:u.string(),member_count:u.number().int().nonnegative(),thread_count:u.number().int().nonnegative(),default_thread_visibility:u.enum(["private","workspace","public"]),created_at:u.string()}),wPe=u.object({type:u.literal("list"),list_type:u.literal("admin_organization"),objects:u.array(UPe)}),a9=u.object({id:u.string(),name:u.string()}),kPe=u.object({id:u.string(),display_name:u.string(),stytch_id:u.string().nullable(),thread_count:u.number().int().nonnegative(),onboarded_at:u.string().nullable(),created_at:u.string(),organizations:u.array(a9)}),GPe=u.object({type:u.literal("list"),list_type:u.literal("admin_user"),objects:u.array(kPe)}),BPe=u.object({id:u.string(),title:u.string(),started_at:u.string(),created_at:u.string(),deleted_at:u.string().nullable(),visibility:u.enum(["private","workspace","public"]),harness:gi,author:bC,organization:a9}),jPe=u.object({type:u.literal("list"),list_type:u.literal("admin_thread"),has_more:u.boolean(),objects:u.array(BPe)}),HPe=u.object({before:u.string().min(1).optional(),after:u.string().min(1).optional()}),$3=u.object({token:u.string().min(1),thread_id:u.string().min(1)}),FPe=u.object({visitor:u.string().min(1).max(64).optional()}),VPe=u.object({user_id:u.string(),display_name:u.string(),shares_sent:u.number().int().nonnegative(),unique_viewers:u.number().int().nonnegative(),attributed_signups:u.number().int().nonnegative()}),qPe=u.object({window_days:u.number().int().positive(),shares_sent:u.number().int().nonnegative(),unique_viewers:u.number().int().nonnegative(),attributed_signups:u.number().int().nonnegative(),active_sharers:u.number().int().nonnegative(),k_factor:u.number().nullable(),shares_sent_sparkline:u.array(u.number().int().nonnegative()),top_sharers:u.array(VPe)}),$Pe=u.object({windows:u.array(qPe)}),YPe=u.object({quoted_text:u.string().min(1),comment:u.string().nullable(),type:u.enum(["comment","highlight:trapdoor"])}),WPe=t9,zPe=e9.extend({comment_thread_id:u.string().min(1)}),KPe=u.object({markdown:u.string().min(1)}),QPe=u.object({storage_url:u.string().min(1),thread_file_id:u.string().min(1),parsed_plan_block:F3,critiqued_plan_block:F3,annotations:u.array(YPe),comment_threads:u.array(WPe),comments:u.array(zPe)}),Tl=u.enum(SC),c9=u.object({skills:u.boolean(),workspace_scope:u.boolean(),review:u.boolean(),shared_thread_ttl_days:u.number().int().positive().nullable()}),NC=u.object({subject_type:u.enum(["user","organization"]),subject_id:u.string().min(1),effective_plan:Tl,admin_override:Tl.nullable(),stripe_subscription_status:u.string().nullable(),cancel_at_period_end:u.boolean(),current_period_end:u.string().nullable(),seat_quantity:u.number().int().positive(),member_count:u.number().int().nonnegative().nullable(),features:c9}),XPe=u.object({effective_plan:Tl,features:c9,user:NC,organization:NC.nullable()}),JPe=u.object({plan:u.enum(["creator","team"]),seat_quantity:u.number().int().positive().optional()}),ZPe=u.object({checkout_url:u.string().min(1)}),eMe=u.object({portal_url:u.string().min(1)}),tMe=u.object({seat_quantity:u.number().int().positive()}),Y3=u.object({plan:Tl.nullable()}),ZS=u.object({subject_type:u.enum(["user","organization"]),subject_id:u.string().min(1),label:u.string().min(1),effective_plan:Tl,admin_override:Tl.nullable(),stripe_subscription_status:u.string().nullable(),seat_quantity:u.number().int().positive()}),nMe=u.object({users:u.array(ZS),organizations:u.array(ZS)}),rMe=u.object({id:u.string().min(1),display_name:u.string().min(1),handle:u.string().nullable(),avatar_url:u.string().nullable()}),oMe=u.object({thread_id:u.string().min(1),title:u.string().min(1),author:rMe,last_active_at:u.string().datetime(),last_block_excerpt:u.string().nullable(),last_block_kind:u.string().min(1).nullable(),is_streaming:u.boolean()}),sMe=u.object({type:u.literal("list"),list_type:u.literal("live_thread"),objects:u.array(oMe)}),iMe=u.object({thread_id:u.string().min(1)}),aMe=u.object({thread_id:u.string().min(1),last_seen_at:u.string().datetime(),started_at:u.string().datetime()}),cMe=u.object({follower_id:u.string().min(1),followee_id:u.string().min(1),is_following:u.literal(!0),follower_count:u.number().int().nonnegative()}),uMe=u.object({follower_id:u.string().min(1),followee_id:u.string().min(1),is_following:u.literal(!1),follower_count:u.number().int().nonnegative()}),u9=u.object({id:u.string().min(1),display_name:u.string().min(1),handle:u.string().nullable(),avatar_url:u.string().nullable(),bio:u.string().max(280).nullable(),is_following:u.boolean(),is_self:u.boolean()}),W3=u.object({type:u.literal("list"),list_type:u.literal("user_follow"),objects:u.array(u9)}),lMe=u.object({date:u.string().regex(/^\d{4}-\d{2}-\d{2}$/),count:u.number().int().nonnegative()}),pMe=u.object({window_start:u.string().datetime(),window_end:u.string().datetime(),total_contributions:u.number().int().nonnegative(),days_active:u.number().int().nonnegative(),daily_average:u.number().nonnegative(),current_streak_days:u.number().int().nonnegative(),days:u.array(lMe)}),dMe=u.object({type:u.literal("thread_created"),occurred_at:u.string().datetime(),id:u.string().min(1),thread:u.object({id:u.string().min(1),title:u.string(),visibility:u.enum(["private","workspace","public"])})}),_Me=u.object({type:u.literal("comment_posted"),occurred_at:u.string().datetime(),id:u.string().min(1),comment_excerpt:u.string(),thread:u.object({id:u.string().min(1),title:u.string(),visibility:u.enum(["private","workspace","public"])})}),fMe=u.object({type:u.literal("project_published"),occurred_at:u.string().datetime(),id:u.string().min(1),project:u.object({id:u.string().min(1),name:u.string().min(1)})}),mMe=u.object({type:u.literal("user_followed"),occurred_at:u.string().datetime(),id:u.string().min(1),followee:u9}),hMe=u.discriminatedUnion("type",[dMe,_Me,fMe,mMe]),TMe=u.object({type:u.literal("list"),list_type:u.literal("user_activity"),objects:u.array(hMe)}),EMe=u.object({id:u.string().min(1),name:u.string().min(1),excerpt:u.string(),published_at:u.string().datetime(),updated_at:u.string().datetime()}),SMe=u.object({type:u.literal("list"),list_type:u.literal("profile_published_project"),objects:u.array(EMe)}),z3=u.object({id:u.string().min(1),published_at:u.string().datetime().nullable()}),gMe=u.enum(["avatar","banner"]),AMe=u.enum(["image/png","image/jpeg","image/webp","image/gif"]),RMe=u.object({kind:gMe,content_type:AMe,base64_data:u.string().min(1)}),yMe=u.object({substrate:u.enum(["s3","filesystem"]),storage_url:u.string().min(1)}),IMe=Q3,l9=zbe.router({health:{method:"GET",path:"/health",responses:{200:u.object({status:u.literal("ok")})},summary:"Health check"},whoAmI:{method:"GET",path:"/whoami",headers:u.object({authorization:u.string().min(1).optional(),"x-lore-referral-token":u.string().min(1).max(16).optional()}),responses:{200:Jbe,401:A},summary:"Validate a Stytch B2B Bearer token and return member plus user fields"},recordHeartbeat:{method:"POST",path:"/heartbeat",headers:u.object({authorization:u.string().min(1).optional()}),body:iMe,responses:{200:aMe,401:A,403:A,404:A,422:A},summary:"Record (or refresh) a presence heartbeat for the authenticated user against one of their own threads. Idempotent; the daemon should call this every ~30s while a session is open."},listLiveThreads:{method:"GET",path:"/threads/live",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:sMe,401:A,403:A},summary:"List teammates with activity in the last 5 minutes. Excludes the requester. Org-scoped, deduped per author, max 10."},listThreads:{method:"GET",path:"/threads",headers:u.object({authorization:u.string().min(1).optional()}),query:IPe,responses:{200:q3,401:A},summary:"List threads visible to the authenticated user"},getThread:{method:"GET",path:"/threads/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:hl,404:A},summary:"Load a visible thread by id"},getSimilarThreads:{method:"GET",path:"/threads/:id/similar",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:q3,404:A,409:A},summary:"List the top 20 visible threads with the closest summary embedding"},listThreadBlocks:{method:"GET",path:"/threads/:id/blocks",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),query:yPe,responses:{200:n9,401:A},summary:"List blocks for a visible thread"},createThreadBlockCommentThread:{method:"POST",path:"/threads/:threadId/blocks/:blockId/comment-threads",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:TCe,responses:{201:ECe,401:A,404:A},summary:"Create a new block-level comment thread on a visible thread block"},createThreadBlockComment:{method:"POST",path:"/threads/:threadId/blocks/:blockId/comment-threads/:commentThreadId/comments",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1),commentThreadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:ACe,responses:{201:RCe,401:A,404:A,409:A},summary:"Reply to a block-level comment thread on a visible thread block"},updateThreadBlockCommentThread:{method:"PATCH",path:"/threads/:threadId/blocks/:blockId/comment-threads/:commentThreadId",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1),commentThreadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:OCe,responses:{200:NCe,401:A,404:A},summary:"Resolve or reopen a block-level comment thread on a visible thread block"},listSkills:{method:"GET",path:"/skills",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:bPe,401:A},summary:"Aggregate skill usage across threads the viewer can see"},getSkillDetail:{method:"GET",path:"/skills/:name",pathParams:u.object({name:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:PPe,401:A,404:A},summary:"Per-skill detail: usage stats + visible threads that invoked it"},redactThreadBlock:{method:"POST",path:"/threads/:threadId/blocks/:blockId/redactions",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:OPe,responses:{200:t_,401:A,403:A,404:A,422:A},summary:"Permanently redact a character range within a text field of a thread block (author only)"},updateThreadBlockText:{method:"PATCH",path:"/threads/:threadId/blocks/:blockId/text",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:MPe,responses:{200:t_,401:A,403:A,404:A,422:A},summary:"Replace a single text leaf in a thread block with new content (author only)"},critiqueThreadBlock:{method:"POST",path:"/threads/:threadId/blocks/:blockId/critique",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:t_,401:A,403:A,404:A,409:A,422:A},summary:"Critique a plan block once and persist its annotations as nested comment threads (author only)"},deleteThreadBlock:{method:"DELETE",path:"/threads/:threadId/blocks/:blockId",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.null(),401:A,403:A,404:A},summary:"Soft-delete a thread block (author only)"},listThreadBlockEdits:{method:"GET",path:"/threads/:threadId/blocks/:blockId/edits",pathParams:u.object({threadId:u.string().min(1),blockId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:LPe,401:A,404:A},summary:"List edits made to a thread block (visible to anyone who can see the thread)"},listThreadDecisions:{method:"GET",path:"/threads/:id/decisions",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:aPe,401:A,404:A},summary:"List AI-extracted user decisions for a thread, in chronological order"},updateThread:{method:"PATCH",path:"/threads/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:_Pe,responses:{200:hl,401:A,403:A,404:A},summary:"Update thread visibility (author only)"},deleteThread:{method:"DELETE",path:"/threads/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.null(),401:A,403:A,404:A},summary:"Soft-delete a thread (author only)"},generateThreadCard:{method:"POST",path:"/threads/:id/card/generate",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:u.object({cover_status:s9,how_to_status:i9}),401:A,403:A,404:A,429:A.extend({retry_after_seconds:u.number().int().nonnegative()})},summary:"Enqueue cover image + how-to recipe generation for the thread. Author-only. Idempotent \u2014 recently-fired statuses are not double-enqueued. Rate-limited: at most one cover generation per minute per thread (cooldown begins when the previous cover finishes). Used to populate cards on legacy threads (created before Lore Cards) and to retry after a 'failed' status or opt back in from 'disabled'."},castThreadVote:{method:"PUT",path:"/threads/:id/vote",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:VCe,responses:{200:V3,401:A,403:A,404:A,422:A},summary:"Cast or change the caller's up/down vote on a public thread. Idempotent \u2014 re-casting the same value is a no-op."},clearThreadVote:{method:"DELETE",path:"/threads/:id/vote",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:V3,401:A,404:A},summary:"Clear the caller's vote on a thread. No-op when the caller hasn't voted."},listThreadComments:{method:"GET",path:"/threads/:threadId/comments",pathParams:u.object({threadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:$Ce,403:A,404:A},summary:"List all (live + soft-deleted as tombstones) comments on a public thread, flat with parent_comment_id pointers."},createThreadComment:{method:"POST",path:"/threads/:threadId/comments",pathParams:u.object({threadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:YCe,responses:{201:WCe,401:A,403:A,404:A,422:A},summary:"Post a top-level or reply comment on a public thread."},updateThreadComment:{method:"PATCH",path:"/threads/:threadId/comments/:commentId",pathParams:u.object({threadId:u.string().min(1),commentId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:zCe,responses:{200:KCe,401:A,403:A,404:A,422:A},summary:"Edit your own thread comment (author only; rejects edits to soft-deleted rows)."},deleteThreadComment:{method:"DELETE",path:"/threads/:threadId/comments/:commentId",pathParams:u.object({threadId:u.string().min(1),commentId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:QCe,401:A,403:A,404:A},summary:"Soft-delete your own thread comment (author only). Idempotent."},getThreadPreview:{method:"GET",path:"/threads/:id/preview",pathParams:u.object({id:u.string().min(1)}),responses:{200:fPe,404:A},summary:"Unauthenticated, visibility-redacted metadata for OG / social preview consumers"},createUser:{method:"POST",path:"/users",headers:u.object({authorization:u.string().min(1).optional()}),body:cCe,responses:{201:OC,401:A},summary:"Create a user record with ApiKey authentication"},getUser:{method:"GET",path:"/users/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:Q3,404:A},summary:"Public profile for a user. Optional auth \u2014 unauthenticated viewers see only public thread metadata; signed-in viewers see counts scoped to the threads they'd normally be able to access."},updateCurrentUser:{method:"PATCH",path:"/users/me",headers:u.object({authorization:u.string().min(1).optional()}),body:Zbe,responses:{200:OC,401:A,409:A,422:A},summary:"Update the authenticated user profile"},getUserByHandle:{method:"GET",path:"/users/by-handle/:handle",pathParams:u.object({handle:K3}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:IMe,404:A},summary:"Resolve a public profile by handle \u2014 same shape as GET /users/:id but keyed on the user's chosen handle."},listUserActivity:{method:"GET",path:"/users/:id/activity",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),query:u.object({limit:u.coerce.number().int().positive().max(100).optional()}),responses:{200:TMe,404:A},summary:"Reverse-chronological activity feed for a user, scoped to what the viewer can see (same visibility rules as listThreads)."},getUserContributions:{method:"GET",path:"/users/:id/contributions",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:pMe,404:A},summary:"Daily contribution counts for the trailing 365 days \u2014 counts thread blocks the user authored on threads visible to the viewer."},listUserFollowers:{method:"GET",path:"/users/:id/followers",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:W3,404:A},summary:"List the users following a given user."},listUserFollowing:{method:"GET",path:"/users/:id/following",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:W3,404:A},summary:"List the users a given user is following."},followUser:{method:"POST",path:"/users/:id/follow",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:cMe,401:A,404:A,409:A,422:A},summary:"Follow another user. Idempotent \u2014 repeating the call is a no-op."},unfollowUser:{method:"DELETE",path:"/users/:id/follow",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:uMe,401:A,404:A},summary:"Unfollow a user. Idempotent \u2014 repeating the call is a no-op."},listProfilePublishedProjects:{method:"GET",path:"/users/:id/projects",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:SMe,404:A},summary:"Projects the user has published to their public profile."},publishProject:{method:"POST",path:"/projects/:id/publish",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:z3,401:A,403:A,404:A},summary:"Publish a project to the author's public profile. Stamps published_at with `now()`. Author-only."},unpublishProject:{method:"DELETE",path:"/projects/:id/publish",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{200:z3,401:A,403:A,404:A},summary:"Remove a project from the author's public profile."},uploadProfileImage:{method:"POST",path:"/users/me/profile-image",headers:u.object({authorization:u.string().min(1).optional()}),body:RMe,responses:{200:yMe,401:A,413:A,422:A},summary:"Upload an avatar or banner image (base64-encoded JSON body). The API streams the bytes to its configured storage substrate using its own credentials and returns the canonical storage URL the client passes to PATCH /users/me."},listOrganizationMembers:{method:"GET",path:"/organization/members",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:tCe,401:A},summary:"List members of the authenticated user\u2019s organization"},createOrganizationInvite:{method:"POST",path:"/organization/invites",headers:u.object({authorization:u.string().min(1).optional()}),body:nCe,responses:{201:rCe,401:A,403:A,409:A,422:A},summary:"Invite a teammate to the authenticated user\u2019s workspace via Stytch B2B"},listRepositories:{method:"GET",path:"/repositories",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:wCe,401:A,403:A},summary:"List repositories known to the authenticated user\u2019s organization across threads and building blocks"},createBuildingBlockSnapshots:{method:"POST",path:"/building_blocks",headers:u.object({authorization:u.string().min(1).optional()}),body:lCe,responses:{201:xCe,401:A,403:A},summary:"Create building block snapshots for the authenticated user\u2019s organization"},getPlan:{method:"GET",path:"/plans/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:CCe,401:A,403:A,404:A},summary:"Load a thread-backed plan container visible to the authenticated user, including all visible plan revisions in that thread"},createPlanCommentThread:{method:"POST",path:"/plans/:id/comment-threads",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:mCe,responses:{201:hCe,401:A,403:A,404:A,422:A},summary:"Create a new inline comment thread on a specific revision inside a thread-backed plan container"},createPlanComment:{method:"POST",path:"/plans/:id/comment-threads/:threadId/comments",pathParams:u.object({id:u.string().min(1),threadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:SCe,responses:{201:gCe,401:A,403:A,404:A,409:A},summary:"Reply to an inline comment thread on a thread-backed plan container"},updatePlanCommentThread:{method:"PATCH",path:"/plans/:id/comment-threads/:threadId",pathParams:u.object({id:u.string().min(1),threadId:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:yCe,responses:{200:ICe,401:A,403:A,404:A},summary:"Resolve or reopen an inline comment thread on a thread-backed plan container"},listPlans:{method:"GET",path:"/plans",headers:u.object({authorization:u.string().min(1).optional()}),query:MCe,responses:{200:PCe,401:A,403:A},summary:"List thread-backed plan containers visible to the authenticated user in their organization, ordered by latest visible revision and optionally filtered by author or repository"},listBuildingBlockSnapshots:{method:"GET",path:"/building_blocks",headers:u.object({authorization:u.string().min(1).optional()}),query:LCe,responses:{200:vCe,401:A,403:A},summary:"List building block snapshots for the authenticated user\u2019s organization and repo origin path"},listUploadSessions:{method:"GET",path:"/upload_sessions",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:RPe,401:A},summary:"List recent upload sessions for the authenticated user"},createUploadSession:{method:"POST",path:"/upload_sessions",headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({thread_files:u.array(BCe).nonempty()}),responses:{201:dPe,400:A,401:A},summary:"Create an upload session with presigned URLs for file uploads"},completeUploadSession:{method:"POST",path:"/upload_sessions/:id/complete",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({thread_files:u.array(cPe).nonempty()}),responses:{200:lPe,400:A,401:A,404:A,409:A,422:A},summary:"Complete an upload session after files have been uploaded to storage"},adminStats:{method:"GET",path:"/admin/stats",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:DPe,401:A,403:A},summary:"Cross-org operational counts. Tanagram admins only."},adminListOrganizations:{method:"GET",path:"/admin/organizations",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:wPe,401:A,403:A},summary:"List every organization with member and thread counts. Tanagram admins only."},adminListUsers:{method:"GET",path:"/admin/users",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:GPe,401:A,403:A},summary:"List every user with their org memberships and thread count. Tanagram admins only."},adminListThreads:{method:"GET",path:"/admin/threads",headers:u.object({authorization:u.string().min(1).optional()}),query:HPe,responses:{200:jPe,401:A,403:A},summary:"List live threads across every organization. Tanagram admins only."},adminHardDeleteThread:{method:"DELETE",path:"/admin/threads/:id",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{204:u.null(),401:A,403:A,404:A},summary:"Permanently remove a thread. Tanagram admins only."},listDiscoverThreads:{method:"GET",path:"/discover/threads",headers:u.object({authorization:u.string().min(1).optional()}),query:SPe,responses:{200:EPe},summary:"Feed of public threads with sort, harness filter, search, and cursor pagination. Auth is optional and populates viewer_vote."},discoverStats:{method:"GET",path:"/discover/stats",responses:{200:gPe},summary:"Unauthenticated rollup of public-thread counts for the Discover header."},createWaitlistEntry:{method:"POST",path:"/waitlist_entries",body:oCe,responses:{201:sCe,409:A},summary:"Create an unauthenticated waitlist entry keyed by (location, contact)."},createShareToken:{method:"POST",path:"/threads/:id/share-token",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({}).optional(),responses:{201:$3,401:A,403:A,404:A,409:A},summary:"Mint a short share-link token for a public thread. Author only. The token powers `/s/:token` short URLs and enables k-factor attribution."},resolveShareToken:{method:"GET",path:"/referrals/resolve/:token",pathParams:u.object({token:u.string().min(1).max(16)}),query:FPe,responses:{200:$3,404:A},summary:"Resolve a share-link token to its thread and record the view. Unauthenticated by design."},adminGrowth:{method:"GET",path:"/admin/growth",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:$Pe,401:A,403:A},summary:"Share-link k-factor, funnel, sparkline, and top sharers by window. Tanagram admins only."},adminRunCritiquePlayground:{method:"POST",path:"/admin/critique-playground/run",headers:u.object({authorization:u.string().min(1).optional()}),body:KPe,responses:{200:QPe,401:A,403:A,409:A},summary:"Admin-only critique playground that saves markdown to a file:// plan artifact and returns parsed + critiqued plan blocks."},getBillingState:{method:"GET",path:"/billing/state",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:XPe,401:A},summary:"Resolve the caller's plan, features, seat count, and any admin override."},createBillingCheckout:{method:"POST",path:"/billing/checkout",headers:u.object({authorization:u.string().min(1).optional()}),body:JPe,responses:{200:ZPe,400:A,401:A,403:A,503:A},summary:"Start a Stripe Checkout session for Creator ($29/mo) or Team ($19/seat/mo, min 2)."},createBillingPortal:{method:"POST",path:"/billing/portal",headers:u.object({authorization:u.string().min(1).optional()}),body:u.object({subject_type:u.enum(["user","organization"]).default("user")}).optional(),responses:{200:eMe,401:A,404:A,503:A},summary:"Open the Stripe customer portal so the subject can manage their subscription."},updateTeamSeats:{method:"PATCH",path:"/billing/team-seats",headers:u.object({authorization:u.string().min(1).optional()}),body:tMe,responses:{200:NC,400:A,401:A,403:A,404:A,503:A},summary:"Adjust the caller-organization's Team seat quantity (admin of that org only)."},adminListBilling:{method:"GET",path:"/admin/billing",headers:u.object({authorization:u.string().min(1).optional()}),responses:{200:nMe,401:A,403:A},summary:"List every user and org with current plan + override for the admin panel."},adminSetUserPlanOverride:{method:"PUT",path:"/admin/billing/users/:id/override",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:Y3,responses:{200:ZS,401:A,403:A,404:A},summary:"Admin override for a user's plan tier. Null clears the override."},adminSetOrganizationPlanOverride:{method:"PUT",path:"/admin/billing/organizations/:id/override",pathParams:u.object({id:u.string().min(1)}),headers:u.object({authorization:u.string().min(1).optional()}),body:Y3,responses:{200:ZS,401:A,403:A,404:A},summary:"Admin override for an organization's plan tier. Null clears the override."},projects:k3,docs:U3,mentions:G3,favorites:j3,search:H3},{pathPrefix:"/api"});import n_ from"node:fs";import p9 from"node:path";function tg(){return p9.join(Zo(),"token")}function CC(){let t;try{t=n_.readFileSync(tg(),"utf8")}catch(n){if(n&&typeof n=="object"&&"code"in n&&n.code==="ENOENT")return{token:"",source:"none"};throw n}let e=t.trim();return!e||NMe(e,new Date)?{token:"",source:"none"}:{token:e,source:"file"}}function ng(){return CC().token}function d9(){return n_.existsSync(tg())}function _9(t){let e=tg();n_.mkdirSync(p9.dirname(e),{recursive:!0,mode:448}),n_.writeFileSync(e,t,{mode:384})}function f9(){try{n_.rmSync(tg())}catch(t){if(t&&typeof t=="object"&&"code"in t&&t.code==="ENOENT")return;throw t}}function OMe(t){let e=t.split(".");if(e.length<2)throw new Error("invalid JWT format");return JSON.parse(Buffer.from(e[1],"base64url").toString("utf8"))}function NMe(t,e){let n;try{n=OMe(t)}catch{return!1}let r=n["https://stytch.com/session"]?.expires_at;if(typeof r!="string")return!1;let o=Date.parse(r.trim());return Number.isNaN(o)?!1:e.getTime()>=o}var bMe={dev:"http://localhost:4000",prod:"https://lore.tanagram.ai"};function Ai(t={}){let e=t.token??ng();return EC(l9,{baseUrl:bMe[xt()],baseHeaders:{"User-Agent":B4(),...e?{authorization:`Bearer ${e}`}:{}}})}var m9={meta:{name:"health",description:"Check API health"},async run({data:t}){pt.info("command_start",{command:"health"});let n=await(t?.client??Ai()).health();if(n.status===200){console.log(n.body.status);return}throw pt.error("health_failed",{status:n.status}),console.error(`health check failed: HTTP ${n.status}`),new Error(`health check failed: HTTP ${n.status}`)}};var h9={meta:{name:"hello",description:"Print a friendly greeting"},run(){pt.info("command_start",{command:"hello"}),console.log("hello world")}};import{spawn as PMe}from"node:child_process";import S9 from"node:crypto";import MMe from"node:http";var CMe={dev:"http://localhost:8080",prod:"https://lore.tanagram.ai"};function T9(){return CMe[xt()]}var xMe=5*60*1e3;function vMe(){return S9.randomBytes(32).toString("base64url")}function LMe(t){return S9.createHash("sha256").update(t).digest("base64url")}function DMe(t){let e;try{e=JSON.parse(Buffer.from(t.trim(),"base64url").toString("utf8"))}catch(n){throw new Error(`decoding: ${n instanceof Error?n.message:String(n)}`)}if(typeof e.session_jwt!="string"||!e.session_jwt)throw new Error("missing session token");if(typeof e.code_challenge!="string"||!e.code_challenge)throw new Error("missing code challenge");return{sessionJwt:e.session_jwt,codeChallenge:e.code_challenge}}function UMe(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function E9(t,e,n){let r=e==="success";t.writeHead(200,{"Content-Type":"text/html"}),t.end(`<!DOCTYPE html>
8
81
  <html><head><meta charset="utf-8"><title>Lore CLI</title></head>
9
82
  <body style="font-family:system-ui;display:flex;justify-content:center;align-items:center;min-height:100vh;margin:0;background:#fafafa">
10
83
  <div style="text-align:center;max-width:400px;padding:40px;border:1px solid #e0e0e0;border-radius:10px;background:#fff;box-shadow:0 2px 10px rgba(0,0,0,0.1)">
11
- <div style="font-size:48px;margin-bottom:20px">${s?"\u2713":"\u2717"}</div>
12
- <h1 style="margin:0 0 10px">${s?"Authorization Complete":"Authorization Cancelled"}</h1>
13
- <p style="color:#666">${s?"You can close this window now.":bc(n??"Authorization was cancelled.")}</p>
84
+ <div style="font-size:48px;margin-bottom:20px">${r?"\u2713":"\u2717"}</div>
85
+ <h1 style="margin:0 0 10px">${r?"Authorization Complete":"Authorization Cancelled"}</h1>
86
+ <p style="color:#666">${r?"You can close this window now.":UMe(n??"Authorization was cancelled.")}</p>
14
87
  <p style="color:#999;font-size:14px">You can close this tab and return to your terminal.</p>
15
- </div></body></html>`)}async function _c(){let r,t=new Promise(o=>{r=o}),n=uc.createServer((o,c)=>{let i=new URL(o.url??"/","http://127.0.0.1");if(i.pathname!=="/callback"){c.writeHead(404),c.end();return}let d=i.searchParams.get("error");if(d){let u=i.searchParams.get("error_description")||d;Zr(c,"error",u),r?.({type:"error",description:u});return}let p=i.searchParams.get("code");if(p){Zr(c,"success"),r?.({type:"code",code:p});return}c.writeHead(400),c.end()});return await new Promise((o,c)=>{n.once("error",c),n.listen(0,"127.0.0.1",()=>{n.off("error",c),o()})}),{redirectURI:`http://127.0.0.1:${n.address().port}/callback`,waitForCallback(o){return new Promise((c,i)=>{let d=setTimeout(()=>{i(new Error("authorization timed out"))},o);t.then(p=>{clearTimeout(d),c(p)})})},close(){return new Promise((o,c)=>{n.close(i=>{if(i){c(i);return}o()})})}}}async function vc(r){let{command:t,args:n}=xc(process.platform,r);await new Promise((s,a)=>{let o=mc(t,n,{detached:!0,stdio:"ignore"});o.once("error",a),o.once("spawn",()=>{o.unref(),s()})})}function xc(r,t){return r==="win32"?{command:"rundll32",args:["url.dll,FileProtocolHandler",t]}:r==="darwin"?{command:"open",args:[t]}:{command:"xdg-open",args:[t]}}async function Sc(r){if(zt().source==="none")return!1;try{return(await r.whoAmI({headers:{}})).status===200}catch{return!1}}async function kc({client:r=Ue(),openBrowser:t=vc,setAccessToken:n=Br,webBaseURL:s=Fr(),timeoutMs:a=hc}={}){if(await Sc(r)){console.log(`
88
+ </div></body></html>`)}async function wMe(){let t,e=new Promise(s=>{t=s}),n=MMe.createServer((s,i)=>{let a=new URL(s.url??"/","http://127.0.0.1");if(a.pathname!=="/callback"){i.writeHead(404),i.end();return}let c=a.searchParams.get("error");if(c){let p=a.searchParams.get("error_description")||c;E9(i,"error",p),t?.({type:"error",description:p});return}let l=a.searchParams.get("code");if(l){E9(i,"success"),t?.({type:"code",code:l});return}i.writeHead(400),i.end()});return await new Promise((s,i)=>{n.once("error",i),n.listen(0,"127.0.0.1",()=>{n.off("error",i),s()})}),{redirectURI:`http://127.0.0.1:${n.address().port}/callback`,waitForCallback(s){return new Promise((i,a)=>{let c=setTimeout(()=>{a(new Error("authorization timed out"))},s);e.then(l=>{clearTimeout(c),i(l)})})},close(){return new Promise((s,i)=>{n.close(a=>{if(a){i(a);return}s()})})}}}async function kMe(t){let{command:e,args:n}=GMe(process.platform,t);await new Promise((r,o)=>{let s=PMe(e,n,{detached:!0,stdio:"ignore"});s.once("error",o),s.once("spawn",()=>{s.unref(),r()})})}function GMe(t,e){return t==="win32"?{command:"rundll32",args:["url.dll,FileProtocolHandler",e]}:t==="darwin"?{command:"open",args:[e]}:{command:"xdg-open",args:[e]}}async function BMe(t){if(CC().source==="none")return!1;try{return(await t.whoAmI({headers:{}})).status===200}catch{return!1}}async function jMe({client:t=Ai(),openBrowser:e=kMe,setAccessToken:n=_9,webBaseURL:r=T9(),timeoutMs:o=xMe}={}){if(await BMe(t)){console.log(`
16
89
  Already logged in. Use 'lore logout' if you want to sign out.
17
- `);return}let o=fc(),c=gc(o),i=await _c();try{let d=new URL("/cli-authorize",s);d.searchParams.set("redirect_uri",i.redirectURI),d.searchParams.set("code_challenge",c),d.searchParams.set("code_challenge_method","S256");try{await t(d.toString()),console.log(`
90
+ `);return}let s=vMe(),i=LMe(s),a=await wMe();try{let c=new URL("/cli-authorize",r);c.searchParams.set("redirect_uri",a.redirectURI),c.searchParams.set("code_challenge",i),c.searchParams.set("code_challenge_method","S256");try{await e(c.toString()),console.log(`
18
91
  Opening browser to log in...`),console.log(`
19
- If your browser didn't open, visit:`)}catch(T){I.warn("open_browser_failed",{error:T instanceof Error?T.message:String(T)}),console.log(`
20
- Visit this URL to log in:`)}console.log(` ${d.toString()}
21
- `),console.log(" Waiting for authorization. Click Authorize in your browser...");let p=await i.waitForCallback(a);if(p.type==="error")throw console.log(`
22
- Authorization denied: ${p.description}
23
- `),new Error(p.description);let u=yc(p.code);if(u.codeChallenge!==c)throw console.log(`
92
+ If your browser didn't open, visit:`)}catch(d){pt.warn("open_browser_failed",{error:d instanceof Error?d.message:String(d)}),console.log(`
93
+ Visit this URL to log in:`)}console.log(` ${c.toString()}
94
+ `),console.log(" Waiting for authorization. Click Authorize in your browser...");let l=await a.waitForCallback(o);if(l.type==="error")throw console.log(`
95
+ Authorization denied: ${l.description}
96
+ `),new Error(l.description);let p=DMe(l.code);if(p.codeChallenge!==i)throw console.log(`
24
97
  Authorization code verification failed.
25
- `),new Error("PKCE challenge mismatch");n(u.sessionJwt),console.log(`
98
+ `),new Error("PKCE challenge mismatch");n(p.sessionJwt),console.log(`
26
99
  Logged in successfully.
27
- `)}catch(d){throw d instanceof Error&&d.message==="authorization timed out"&&console.log(`
100
+ `)}catch(c){throw c instanceof Error&&c.message==="authorization timed out"&&console.log(`
28
101
  Authorization timed out. Please try again.
29
- `),d}finally{await i.close()}}var Hr={meta:{name:"login",description:"Authorize this CLI against your Lore workspace"},async run({data:r}){I.info("command_start",{command:"login"}),await kc({client:r?.client,openBrowser:r?.openBrowser,setAccessToken:r?.setAccessToken,webBaseURL:r?.webBaseURL,timeoutMs:r?.timeoutMs})}};var Qr={meta:{name:"logout",description:"Log out of your Lore workspace"},run(){I.info("command_start",{command:"logout"});let r=Ur();if($r(),!r){console.log(`
102
+ `),c}finally{await a.close()}}var g9={meta:{name:"login",description:"Authorize this CLI against your Lore workspace"},async run({data:t}){pt.info("command_start",{command:"login"}),await jMe({client:t?.client,openBrowser:t?.openBrowser,setAccessToken:t?.setAccessToken,webBaseURL:t?.webBaseURL,timeoutMs:t?.timeoutMs})}};var A9={meta:{name:"logout",description:"Log out of your Lore workspace"},run(){pt.info("command_start",{command:"logout"});let t=d9();if(f9(),!t){console.log(`
30
103
  Not currently logged in.
31
104
  `);return}console.log(`
32
105
  Logged out successfully.
33
- `)}};var Wr={meta:{name:"logs",description:"Print the path to the log file"},run(){I.info("command_start",{command:"logs"}),console.log(dt())}};import{promises as oe}from"node:fs";import jc from"node:os";import we from"node:path";import{fileURLToPath as Jr}from"node:url";function Et(){return we.join(jc.homedir(),".claude","skills")}function Kr(r){return r.map(t=>t.name).sort().join(", ")}function Yr(r){return r[0]?we.dirname(r[0].destination):Et()}async function Tc(r){try{return(await oe.stat(r)).isDirectory()}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function Xr(){let r=[Jr(new URL("../skills",import.meta.url)),Jr(new URL("../../skills",import.meta.url))];for(let t of r)if(await Tc(t))return t;throw new Error("bundled skills directory not found")}function wc(r,t){let n=r.match(/^(---\r?\n)([\s\S]*?)(\r?\n---(?:\r?\n|$))/);if(!n)throw new Error("skill file is missing frontmatter");let[,s,a,o]=n,c=a.replace(/^name: .*$/m,`name: ${t}`);if(c===a)throw new Error("skill file frontmatter is missing a name");return`${s}${c}${o}${r.slice(n[0].length)}`}async function Rc({destination:r=Et(),environment:t=L(),sourceDir:n}={}){let s=n??await Xr(),a=(await oe.readdir(s,{withFileTypes:!0})).filter(i=>i.isDirectory()),o=t==="prod"?"":`-${t}`,c=[];await oe.mkdir(r,{recursive:!0});for(let i of a){let d=`${i.name}${o}`,p=we.join(s,i.name),u=we.join(r,d);if(await oe.cp(p,u,{recursive:!0,force:!0}),o){let T=we.join(u,"SKILL.md"),w=await oe.readFile(T,"utf8");await oe.writeFile(T,wc(w,d))}c.push({name:d,source:p,destination:u})}return c}async function Cc({destination:r=Et(),environment:t=L(),sourceDir:n}={}){let s=n??await Xr(),a=(await oe.readdir(s,{withFileTypes:!0})).filter(i=>i.isDirectory()),o=t==="prod"?"":`-${t}`,c=[];for(let i of a){let d=`${i.name}${o}`,p=we.join(s,i.name),u=we.join(r,d);await oe.rm(u,{recursive:!0,force:!0}),c.push({name:d,source:p,destination:u})}return c}var en={meta:{name:"postinstall:install-skills",hidden:!0},args:{destination:{type:"positional",required:!1,description:"Install destination"}},async run({args:r}){let t=await Rc({destination:r.destination});console.log(`installed skills ${Kr(t)} to ${Yr(t)}`)}},tn={meta:{name:"postinstall:uninstall-skills",hidden:!0},args:{destination:{type:"positional",required:!1,description:"Install destination"}},async run({args:r}){let t=await Cc({destination:r.destination});console.log(`uninstalled skills ${Kr(t)} from ${Yr(t)}`)}};var rn={meta:{name:"whoami",description:"Print the authenticated Lore user",hidden:!0},async run({data:r}){I.info("command_start",{command:"whoami"});let n=await(r?.client??Ue()).whoAmI({headers:{}});if(n.status===200){console.log(n.body.emailAddress);return}throw console.error("Not authenticated. Run 'lore login' first."),new Error(`whoami failed: HTTP ${n.status}`)}};var Pc="phc_sMsUvf0nK50rZdztSlX9rDJqIreLcXj4dyGS0tORQpQ",zc="https://phe.tanagram.ai/capture/",Ac=2e3;function nn(r){return process.env[r]??""}function Ec(r,t){let n=[r,t].filter(Boolean);return n.length>0?n.join("@"):"unknown-cli-user"}async function sn({commandName:r,durationMs:t}){let n=nn("USER"),s=nn("HOST"),a=new AbortController,o=setTimeout(()=>a.abort(),Ac);try{await fetch(zc,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({api_key:Pc,event:"lore.cli.command_run",properties:{distinct_id:Ec(n,s),command_name:r,cli_version:Er(),duration_ms:Math.round(t),environment:L(),user:n,host:s}}),signal:a.signal})}catch(c){I.warn("posthog_capture_failed",{command:r,error:c instanceof Error?c.message:String(c)})}finally{clearTimeout(o)}}var an={hello:Vr,health:Mr,login:Hr,logout:Qr,whoami:rn,logs:Wr,"postinstall:install-skills":en,"postinstall:uninstall-skills":tn};function Ic(r){let t=r.find(n=>!n.startsWith("-"));return t||"hello"}var Lc={name:"cli-metrics",setup(r){r.data={...r.data,commandStartedAtMs:performance.now()}},async cleanup(r){let t=r.data?.commandStartedAtMs;if(typeof t!="number")return;let n=performance.now()-t;await(r.data?.captureCliCommandMetric??sn)({commandName:Ic(r.rawArgs),durationMs:n})}},Ot={meta:{name:"lore",description:"Lore CLI"},plugins:[Lc],subCommands:an,default:"hello"};function Nc(r){return r instanceof Error&&r.name==="CLIError"}function Uc(r){let t=r.find(s=>!s.startsWith("-")),n=t?an[t]:void 0;return n?[n,Ot]:[Ot,void 0]}async function Bc(r){try{if(r.includes("--help")||r.includes("-h")){console.log(await $t(...Uc(r)));return}await We(Ot,{rawArgs:r})}catch(t){Nc(t)||L()==="prod"&&t instanceof Error?console.error(t.message):console.error(t,`
34
- `),process.exit(1)}}process.argv[1]&&import.meta.url===Oc(process.argv[1]).href&&await Bc(process.argv.slice(2));export{Ot as mainCommand};
106
+ `)}};var R9={meta:{name:"logs",description:"Print the path to the log file"},run(){pt.info("command_start",{command:"logs"}),console.log(US())}};import{promises as Ri}from"node:fs";import HMe from"node:os";import qa from"node:path";import{fileURLToPath as y9}from"node:url";function PC(){return qa.join(HMe.homedir(),".claude","skills")}function I9(t){return t.map(e=>e.name).sort().join(", ")}function O9(t){return t[0]?qa.dirname(t[0].destination):PC()}async function FMe(t){try{return(await Ri.stat(t)).isDirectory()}catch(e){if(e.code==="ENOENT")return!1;throw e}}async function N9(){let t=[y9(new URL("../skills",import.meta.url)),y9(new URL("../../skills",import.meta.url))];for(let e of t)if(await FMe(e))return e;throw new Error("bundled skills directory not found")}function VMe(t,e){let n=t.match(/^(---\r?\n)([\s\S]*?)(\r?\n---(?:\r?\n|$))/);if(!n)throw new Error("skill file is missing frontmatter");let[,r,o,s]=n,i=o.replace(/^name: .*$/m,`name: ${e}`);if(i===o)throw new Error("skill file frontmatter is missing a name");return`${r}${i}${s}${t.slice(n[0].length)}`}async function qMe({destination:t=PC(),environment:e=xt(),sourceDir:n}={}){let r=n??await N9(),o=(await Ri.readdir(r,{withFileTypes:!0})).filter(a=>a.isDirectory()),s=e==="prod"?"":`-${e}`,i=[];await Ri.mkdir(t,{recursive:!0});for(let a of o){let c=`${a.name}${s}`,l=qa.join(r,a.name),p=qa.join(t,c);if(await Ri.cp(l,p,{recursive:!0,force:!0}),s){let d=qa.join(p,"SKILL.md"),_=await Ri.readFile(d,"utf8");await Ri.writeFile(d,VMe(_,c))}i.push({name:c,source:l,destination:p})}return i}async function $Me({destination:t=PC(),environment:e=xt(),sourceDir:n}={}){let r=n??await N9(),o=(await Ri.readdir(r,{withFileTypes:!0})).filter(a=>a.isDirectory()),s=e==="prod"?"":`-${e}`,i=[];for(let a of o){let c=`${a.name}${s}`,l=qa.join(r,a.name),p=qa.join(t,c);await Ri.rm(p,{recursive:!0,force:!0}),i.push({name:c,source:l,destination:p})}return i}var b9={meta:{name:"postinstall:install-skills",hidden:!0},args:{destination:{type:"positional",required:!1,description:"Install destination"}},async run({args:t}){let e=await qMe({destination:t.destination});console.log(`installed skills ${I9(e)} to ${O9(e)}`)}},C9={meta:{name:"postinstall:uninstall-skills",hidden:!0},args:{destination:{type:"positional",required:!1,description:"Install destination"}},async run({args:t}){let e=await $Me({destination:t.destination});console.log(`uninstalled skills ${I9(e)} from ${O9(e)}`)}};import rg from"node:fs/promises";import YMe from"node:path";import{setTimeout as xC}from"node:timers/promises";var WMe=1e3,zMe=2*60*1e3,KMe=1e3,QMe=250,og=class extends Error{constructor(){super("lore is logged out")}};async function M9(t={}){let e=await cxe(),n=t.recorder??new jS,r=t.adapter??n3,o=t.client??Ai();await n.markRunning();let s=[],i=e,a=new Map,c=!1;try{let l=await x9({lastUploadedTimestamp:e.latestUploadedTimestamp,adapter:r,client:o,recorder:n});if(s=l.threadIDs,i=l.syncState,a=l.watchBaselineOverrides,c=l.loggedOut,c||await n.markSyncSuccess(s),!c&&s.length>0){let p=await XMe({syncState:i,baselineOverrides:a,adapter:r,client:o,recorder:n});s=[...s,...p.threadIDs],i=p.syncState,c=p.loggedOut}return c?await n.markLoggedOut():await n.markSuccess(s),s}catch(l){throw await n.markError(l),l}}async function x9(t){let e=[],n={latestUploadedTimestamp:t.lastUploadedTimestamp},r=new Map,o=!1;try{let s=await JMe(t);e=s.threadIDs,n=s.syncState,r=s.watchBaselineOverrides}catch(s){if(s instanceof og)o=!0,e=[],r=new Map;else throw await P9(n),s}return await P9(n),{threadIDs:e,syncState:n,watchBaselineOverrides:r,loggedOut:o}}async function XMe(t){let e=t.adapter.historyFilePath(),n=await es(e),r=await t.adapter.buildPendingTranscriptWatches(t.syncState.latestUploadedTimestamp,t.baselineOverrides);if(await t.recorder.setPendingWatchers(r),r.length===0)return await t.recorder.setPendingWatchers([]),{threadIDs:[],syncState:t.syncState,loggedOut:!1};let o=[],s=t.syncState;try{for(;;){await xC(KMe),await t.recorder.heartbeat();let i=new Date,a=await es(e),c=rC(n,a);if(n=a,c||(c=await ixe(r)),!c){let p=axe(r,i);if(r=p.watchers,p.changed&&await t.recorder.setPendingWatchers(r),r.length===0)return{threadIDs:o,syncState:s,loggedOut:!1};continue}await xC(QMe);let l=await x9({lastUploadedTimestamp:s.latestUploadedTimestamp,adapter:t.adapter,client:t.client,recorder:t.recorder});if(s=l.syncState,l.loggedOut)return{threadIDs:o,syncState:s,loggedOut:!0};if(o.push(...l.threadIDs),await t.recorder.markSyncSuccess(l.threadIDs),l.threadIDs.length===0)return{threadIDs:o,syncState:s,loggedOut:!1};if(n=await es(e),r=await t.adapter.buildPendingTranscriptWatches(s.latestUploadedTimestamp,l.watchBaselineOverrides),await t.recorder.setPendingWatchers(r),r.length===0)return{threadIDs:o,syncState:s,loggedOut:!1}}}finally{await t.recorder.setPendingWatchers([])}}async function JMe(t){let e={latestUploadedTimestamp:t.lastUploadedTimestamp},n=await t.adapter.readUnuploadedEntries(t.lastUploadedTimestamp);if(n.length===0)return{threadIDs:[],syncState:e,watchBaselineOverrides:new Map};if(!ng())throw new og;await t.recorder.markAuthenticated();let o=await t.adapter.collectLocalFiles(n);try{if(o.localFiles.length===0)return e.latestUploadedTimestamp=MC(t.lastUploadedTimestamp,o.entries,o.entryFileKeys,o.skippedFileKeys),{threadIDs:[],syncState:e,watchBaselineOverrides:new Map};let s=await ZMe(t.client,o.localFiles);if(s.thread_files.length!==o.localFiles.length)throw new Error(`upload session returned ${s.thread_files.length} files for ${o.localFiles.length} local files`);let i=rxe(o.localFiles,s.thread_files),a=[],c=[],l=new Set;for(let m=0;m<s.thread_files.length;m+=1){let h=s.thread_files[m],T=i[m];if(!(!h||!T)){if(!h.presigned_url?.trim()){let S=h.error?.trim()||`upload session response missing presigned_url for ${T.filename}`;pt.info("run_upload_skip",{filename:T.filename,reason:S}),l.add(T.key);continue}a.push(h),c.push(T)}}for(let m=0;m<a.length;m+=1){let h=a[m],T=c[m];!h||!T||await exe(h.presigned_url??"",T.tempPath)}let p=[],d=new Map,_=new Set([...o.skippedFileKeys,...l]);if(a.length===0)return e.latestUploadedTimestamp=MC(t.lastUploadedTimestamp,o.entries,o.entryFileKeys,_),{threadIDs:p,syncState:e,watchBaselineOverrides:d};let f=await txe(t.client,s.id,a);if(f.thread_files.length!==c.length)throw new Error(`completed upload session returned ${f.thread_files.length} files for ${c.length} local files`);for(let m=0;m<f.thread_files.length;m+=1){await t.recorder.heartbeat();let h=f.thread_files[m],T=c[m];if(!h||!T)continue;let S=h.thread?.id?.trim()??"";if(!S){if(T.fileType==="plan"){_.add(T.key);continue}throw new Error(`complete upload session response missing thread for ${T.filename}`)}p.push(S),await nxe(t.client,S,t.recorder),_.add(T.key),T.sourcePath&&d.set(T.sourcePath,T.watchedState)}return e.latestUploadedTimestamp=MC(t.lastUploadedTimestamp,o.entries,o.entryFileKeys,_),{threadIDs:p,syncState:e,watchBaselineOverrides:d}}finally{await Promise.all(o.localFiles.map(s=>K4(s.tempPath)))}}async function ZMe(t,e){let n=e.map(o=>({md5:o.md5,harness:o.harness,filename:o.filename,repo_origin_path:o.repoOriginPath||void 0,file_type:o.fileType,harness_internal_id:o.harnessInternalId})),r=await t.createUploadSession({body:{thread_files:n}});if(r.status!==201)throw new Error(vC("create upload session",r.status,r.body));return r.body}async function exe(t,e){let n=await rg.readFile(e),r=await fetch(t,{method:"PUT",body:n,headers:{"content-length":String(n.length)}});if(!r.ok)throw new Error(`upload transcript: unexpected status ${r.status}: ${await r.text()}`)}async function txe(t,e,n){let r=n.map(s=>({storage_url:oxe(s)})),o=await t.completeUploadSession({params:{id:e},body:{thread_files:r}});if(o.status!==200)throw new Error(vC("complete upload session",o.status,o.body));return o.body}async function nxe(t,e,n,r={}){let o=r.timeoutMs??zMe,s=r.pollIntervalMs??WMe,i=Date.now();for(;;){await n.heartbeat();let a=await t.getThread({params:{id:e}});if(a.status!==200)throw new Error(vC(`get thread ${e}`,a.status,a.body));let c=a.body.transcript_parsing_state;if(c==="parsed"||c==="too_large_to_parse")return;if(c!=="pending"&&c!=="parsing")throw new Error(`unexpected transcript parsing state for thread ${e}: ${JSON.stringify(c)}`);let l=Date.now()-i;if(l>=o)throw new Error(`timed out waiting for thread ${e} parsing after ${o}ms`);await xC(Math.min(s,o-l))}}function rxe(t,e){let n=new Map;for(let r of t){let o=r.md5.trim().toLowerCase();n.set(o,[...n.get(o)??[],r])}return e.map((r,o)=>{let s=r.expected_md5?.trim();if(!s)throw new Error(`upload session response missing expected_md5 for thread_files[${o}]`);let i=s.toLowerCase(),a=n.get(i);if(!a||a.length===0)throw new Error(`upload session response returned unexpected expected_md5 ${s}`);let[c,...l]=a;if(!c)throw new Error(`upload session response returned unexpected expected_md5 ${s}`);return l.length===0?n.delete(i):n.set(i,l),c})}function MC(t,e,n,r){let o=t;for(let s=0;s<e.length;s+=1){let i=n[s];if(!i||!r.has(i))break;o=e[s]?.timestamp??o}return o}function oxe(t){if(!t.storage_url.trim())throw new Error("upload session response missing storage_url");return`s3://${sxe(t.presigned_url??"")}/${t.storage_url.replace(/^\/+/,"")}`}function sxe(t){let e;try{e=new URL(t)}catch(s){throw new Error(`parse presigned URL ${JSON.stringify(t)}: ${String(s)}`)}let n=e.hostname,r=n.indexOf(".s3");if(r>0)return n.slice(0,r);let o=e.pathname.replace(/^\/+|\/+$/g,"").split("/");if(o.length>=2&&o[0])return o[0];throw new Error(`could not determine S3 bucket from presigned URL ${JSON.stringify(t)}`)}async function ixe(t){for(let e of t){let n=await es(e.transcriptPath);if(rC(e.baseline,n))return!0}return!1}function axe(t,e){let n=t.filter(r=>e<r.expiresAt);return{watchers:n,changed:n.length!==t.length}}async function cxe(){try{return{latestUploadedTimestamp:JSON.parse(await rg.readFile(tC(),"utf8")).latestUploadedTimestamp??0}}catch{return{latestUploadedTimestamp:0}}}async function P9(t){let e=tC();await rg.mkdir(YMe.dirname(e),{recursive:!0,mode:448}),await rg.writeFile(e,`${JSON.stringify(t,null,2)}
107
+ `,{mode:384})}function vC(t,e,n){return uxe(n)&&typeof n.message=="string"?`${t} failed: HTTP ${e}: ${n.message}`:`${t} failed: HTTP ${e}`}function uxe(t){return t!==null&&typeof t=="object"}var v9={meta:{name:"_run_upload",hidden:!0},async run({data:t}){let e=await M9({client:t?.client,adapter:t?.adapter,recorder:t?.recorder});console.log(JSON.stringify(e))}};var L9={meta:{name:"whoami",description:"Print the authenticated Lore user",hidden:!0},async run({data:t}){pt.info("command_start",{command:"whoami"});let n=await(t?.client??Ai()).whoAmI({headers:{}});if(n.status===200){console.log(n.body.emailAddress);return}throw console.error("Not authenticated. Run 'lore login' first."),new Error(`whoami failed: HTTP ${n.status}`)}};var lxe="phc_sMsUvf0nK50rZdztSlX9rDJqIreLcXj4dyGS0tORQpQ",pxe="https://phe.tanagram.ai/capture/",dxe=2e3;function D9(t){return process.env[t]??""}function _xe(t,e){let n=[t,e].filter(Boolean);return n.length>0?n.join("@"):"unknown-cli-user"}async function U9({commandName:t,durationMs:e}){let n=D9("USER"),r=D9("HOST"),o=new AbortController,s=setTimeout(()=>o.abort(),dxe);try{await fetch(pxe,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({api_key:lxe,event:"lore.cli.command_run",properties:{distinct_id:_xe(n,r),command_name:t,cli_version:bS(),duration_ms:Math.round(e),environment:xt(),user:n,host:r}}),signal:o.signal})}catch(i){pt.warn("posthog_capture_failed",{command:t,error:i instanceof Error?i.message:String(i)})}finally{clearTimeout(s)}}var k9={hello:h9,health:m9,enable:_3,disable:f3,restart:m3,status:h3,login:g9,logout:A9,whoami:L9,logs:R9,_run_upload:v9,"postinstall:install-skills":b9,"postinstall:uninstall-skills":C9};function mxe(t){let e=t.find(n=>!n.startsWith("-"));return e||"hello"}var hxe={name:"cli-metrics",setup(t){t.data={...t.data,commandStartedAtMs:performance.now()}},async cleanup(t){let e=t.data?.commandStartedAtMs;if(typeof e!="number")return;let n=performance.now()-e;await(t.data?.captureCliCommandMetric??U9)({commandName:mxe(t.rawArgs),durationMs:n})}},LC={meta:{name:"lore",description:"Lore CLI"},plugins:[hxe],subCommands:k9,default:"hello"};function w9(t){return t instanceof Error&&t.name==="CLIError"}function Txe(t){let e=t.find(r=>!r.startsWith("-")),n=e?k9[e]:void 0;return n?[n,LC]:[LC,void 0]}async function Exe(t){try{if(t.includes("--help")||t.includes("-h")){console.log(await $4(...Txe(t)));return}await vS(LC,{rawArgs:t})}catch(e){if(w9(e)||xt()==="prod"&&e instanceof Error?console.error(e.message):console.error(e,`
108
+ `),!w9(e)){te(e),rm(2e3).catch(()=>{}).finally(()=>{process.exit(1)});return}process.exit(1)}}process.argv[1]&&import.meta.url===fxe(process.argv[1]).href&&await Exe(process.argv.slice(2));export{LC as mainCommand};