@yukino.js/yukino 0.0.21-dev → 0.0.22

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 (71) hide show
  1. package/README.md +1 -1
  2. package/dist/{anthropic-LB4T3BEN.js → anthropic-5FTO3Q7W.js} +1 -1
  3. package/dist/browser/dist/static/{highlight-KNDEBJWF.js → highlight-7IMT657L.js} +9 -9
  4. package/dist/browser/dist/static/index.css +2 -2
  5. package/dist/browser/dist/static/index.js +81 -75
  6. package/dist/browser/dist/static/webapi-433PWHPB.js +4 -0
  7. package/dist/{chunk-NPIMUWFO.js → chunk-3FNHYMQD.js} +1 -1
  8. package/dist/{chunk-D6YQITPD.js → chunk-4UBQFHOG.js} +1 -1
  9. package/dist/{chunk-N7G2FDAI.js → chunk-5JFKXDO6.js} +1 -1
  10. package/dist/chunk-6YD572HB.js +4 -0
  11. package/dist/{chunk-XDERLDVW.js → chunk-7R67JSKQ.js} +1 -1
  12. package/dist/{chunk-FNQMXCCE.js → chunk-D5XGRVMZ.js} +1 -1
  13. package/dist/{chunk-WKKH2UE5.js → chunk-FOFOAOHI.js} +1 -1
  14. package/dist/{chunk-QYUIIFJY.js → chunk-GQKXEVHQ.js} +1 -1
  15. package/dist/{chunk-5D3QKHYQ.js → chunk-HNVICTWL.js} +1 -1
  16. package/dist/{chunk-7WP7SERS.js → chunk-HQ6FH7CR.js} +1 -1
  17. package/dist/{chunk-P6K7EQHF.js → chunk-I2KB6I3D.js} +2 -2
  18. package/dist/chunk-KBRCX7GE.js +30 -0
  19. package/dist/chunk-LLPVYWAK.js +10 -0
  20. package/dist/{chunk-2N7OIUQW.js → chunk-TVVVY2T4.js} +173 -173
  21. package/dist/{chunk-6SWKDCK3.js → chunk-WXCPYSJ3.js} +1 -1
  22. package/dist/{chunk-57IGGFHK.js → chunk-XB5QPPSI.js} +1 -1
  23. package/dist/{chunk-EQABLL4S.js → chunk-YWUBKWGK.js} +1 -1
  24. package/dist/{devtools-UVGRIXO2.js → devtools-BODX7K3L.js} +1 -1
  25. package/dist/{esm-HB7M3TZY.js → esm-4BJKCG42.js} +1 -1
  26. package/dist/{esm-63A57VQM.js → esm-AWTGQAUK.js} +1 -1
  27. package/dist/{esm-FURF4AWD.js → esm-JKMLEWEU.js} +1 -1
  28. package/dist/{esm-46K5BSA6.js → esm-MG7NDA4I.js} +1 -1
  29. package/dist/{esm-73AG4F4H.js → esm-NCNRWOJD.js} +1 -1
  30. package/dist/{esm-QAEO3U72.js → esm-QVP2GBDR.js} +1 -1
  31. package/dist/esm-ZR7DS25X.js +225 -0
  32. package/dist/file-type-Z4DPJWZH.js +12 -0
  33. package/dist/getMachineId-bsd-RSPO2LUX.js +4 -0
  34. package/dist/getMachineId-bsd-YMN7H6LU.js +4 -0
  35. package/dist/getMachineId-darwin-AOWQPOSH.js +5 -0
  36. package/dist/getMachineId-darwin-FEQVNOUN.js +5 -0
  37. package/dist/{getMachineId-win-2ZKMVYDE.js → getMachineId-win-H5SABCRW.js} +1 -1
  38. package/dist/{getMachineId-win-JOM5JSRW.js → getMachineId-win-RV3BPBHF.js} +1 -1
  39. package/dist/image-worker.js +1 -1
  40. package/dist/lib/{chunk-XVXFUSSS.js → chunk-IOPSBIYR.js} +1 -1
  41. package/dist/lib/index.d.ts +802 -802
  42. package/dist/lib/index.js +19 -17
  43. package/dist/lib/{providers-2NPR2VR4.js → providers-U3O7GOPH.js} +1 -1
  44. package/dist/{main-OMIZDIYB.js → main-BIBLUWZX.js} +219 -213
  45. package/dist/main.js +2 -2
  46. package/dist/{openai-UOCUBMFA.js → openai-AYEJOJTA.js} +1 -1
  47. package/dist/{providers-G5SKN22T.js → providers-USI6GYZC.js} +9 -9
  48. package/dist/{server-Z742CQSK.js → server-RGAJNHA4.js} +1 -1
  49. package/dist/{server-ESDMJACZ.js → server-XHQ7YJGI.js} +2 -2
  50. package/dist/{src-CHQYSTW5.js → src-E2NOTM6J.js} +1 -1
  51. package/dist/{src-HH6MC5CF.js → src-EBGRLYAR.js} +1 -1
  52. package/dist/{src-YWYPK5QA.js → src-HBBKRA75.js} +1 -1
  53. package/dist/src-P77FB5XW.js +12 -0
  54. package/dist/{turndown.es-NQ3KDXM7.js → turndown.es-E6SHSU5B.js} +13 -13
  55. package/package.json +2 -2
  56. package/dist/browser/dist/static/webapi-HZESKPJE.js +0 -4
  57. package/dist/chunk-5AOJ5ZSQ.js +0 -30
  58. package/dist/chunk-VM4YKTHC.js +0 -10
  59. package/dist/chunk-WKTO7XPO.js +0 -4
  60. package/dist/esm-6D27H27M.js +0 -225
  61. package/dist/file-type-PSFVPAEH.js +0 -12
  62. package/dist/getMachineId-bsd-2MDOCJCH.js +0 -4
  63. package/dist/getMachineId-bsd-L5XEQF74.js +0 -4
  64. package/dist/getMachineId-darwin-SMQEPEZ2.js +0 -5
  65. package/dist/getMachineId-darwin-V3OSZDJX.js +0 -5
  66. package/dist/src-P2WNZ6IY.js +0 -12
  67. /package/dist/{chunk-HKQWGX5S.js → chunk-UJIMMEIV.js} +0 -0
  68. /package/dist/{getMachineId-linux-OWR5YFVH.js → getMachineId-linux-337SESKP.js} +0 -0
  69. /package/dist/{getMachineId-linux-C4WJW6ZL.js → getMachineId-linux-P6HXMSZR.js} +0 -0
  70. /package/dist/{getMachineId-unsupported-M7AEHRA4.js → getMachineId-unsupported-52TDEFNE.js} +0 -0
  71. /package/dist/{getMachineId-unsupported-J7U5FNFT.js → getMachineId-unsupported-FWRH7XFO.js} +0 -0
@@ -0,0 +1,4 @@
1
+ import{b as Nr,d as E,e as u,f as P,g as k}from"./chunk-OR5FHECQ.js";var se=new TextEncoder,Ue=new TextDecoder,_e=new TextDecoder("utf-8",{fatal:!0}),At=2**32;function B(...t){let e=t.reduce((o,{length:i})=>o+i,0),r=new Uint8Array(e),n=0;for(let o of t)r.set(o,n),n+=o.length;return r}function rr(t,e,r){if(e<0||e>=At)throw new RangeError(`value must be >= 0 and <= ${At-1}. Received ${e}`);t.set([e>>>24,e>>>16,e>>>8,e&255],r)}function nr(t){let e=Math.floor(t/At),r=t%At,n=new Uint8Array(8);return rr(n,e,0),rr(n,r,4),n}function Jt(t){let e=new Uint8Array(4);return rr(e,t),e}var Cn=/[^\x00-\x7f]/;function R(t){if(typeof t=="string"&&t.length>=128){if(Cn.test(t))throw new TypeError("non-ASCII string encountered in encode()");return se.encode(t)}let e=new Uint8Array(t.length);for(let r=0;r<t.length;r++){let n=t.charCodeAt(r);if(n>127)throw new TypeError("non-ASCII string encountered in encode()");e[r]=n}return e}function Kt(t,e=!1){if(Uint8Array.prototype.toBase64)return t.toBase64({alphabet:e?"base64url":"base64",omitPadding:e});let r=32768,n=[];for(let i=0;i<t.length;i+=r)n.push(String.fromCharCode.apply(null,t.subarray(i,i+r)));let o=btoa(n.join(""));return e?o.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"):o}function Ct(t,e=!1){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(t,{alphabet:e?"base64url":"base64"});if(e){if(t.includes("+")||t.includes("/"))throw new TypeError("Invalid base64url");t=t.replace(/-/g,"+").replace(/_/g,"/")}let r=atob(t),n=new Uint8Array(r.length);for(let o=0;o<r.length;o++)n[o]=r.charCodeAt(o);return n}async function Wt(t,e){let r=`SHA-${t.slice(-3)}`;return new Uint8Array(await crypto.subtle.digest(r,e))}var Mr={};Nr(Mr,{JOSEAlgNotAllowed:()=>ce,JOSEError:()=>H,JOSENotSupported:()=>A,JWEDecryptionFailed:()=>ee,JWEInvalid:()=>p,JWKInvalid:()=>Ce,JWKSInvalid:()=>fe,JWKSMultipleMatchingKeys:()=>Re,JWKSNoMatchingKey:()=>le,JWKSTimeout:()=>De,JWSInvalid:()=>l,JWSSignatureVerificationFailed:()=>te,JWTClaimValidationFailed:()=>V,JWTExpired:()=>Ke,JWTInvalid:()=>I});var H=class extends Error{constructor(r,n){super(r,n);E(this,"code","ERR_JOSE_GENERIC");this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}};E(H,"code","ERR_JOSE_GENERIC");var V=class extends H{constructor(r,n,o="unspecified",i="unspecified"){super(r,{cause:{claim:o,reason:i,payload:n}});E(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");E(this,"claim");E(this,"reason");E(this,"payload");this.claim=o,this.reason=i,this.payload=n}};E(V,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");var Ke=class extends H{constructor(r,n,o="unspecified",i="unspecified"){super(r,{cause:{claim:o,reason:i,payload:n}});E(this,"code","ERR_JWT_EXPIRED");E(this,"claim");E(this,"reason");E(this,"payload");this.claim=o,this.reason=i,this.payload=n}};E(Ke,"code","ERR_JWT_EXPIRED");var ce=class extends H{constructor(){super(...arguments);E(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}};E(ce,"code","ERR_JOSE_ALG_NOT_ALLOWED");var A=class extends H{constructor(){super(...arguments);E(this,"code","ERR_JOSE_NOT_SUPPORTED")}};E(A,"code","ERR_JOSE_NOT_SUPPORTED");var ee=class extends H{constructor(r="decryption operation failed",n){super(r,n);E(this,"code","ERR_JWE_DECRYPTION_FAILED")}};E(ee,"code","ERR_JWE_DECRYPTION_FAILED");var p=class extends H{constructor(){super(...arguments);E(this,"code","ERR_JWE_INVALID")}};E(p,"code","ERR_JWE_INVALID");var l=class extends H{constructor(){super(...arguments);E(this,"code","ERR_JWS_INVALID")}};E(l,"code","ERR_JWS_INVALID");var I=class extends H{constructor(){super(...arguments);E(this,"code","ERR_JWT_INVALID")}};E(I,"code","ERR_JWT_INVALID");var Ce=class extends H{constructor(){super(...arguments);E(this,"code","ERR_JWK_INVALID")}};E(Ce,"code","ERR_JWK_INVALID");var fe=class extends H{constructor(){super(...arguments);E(this,"code","ERR_JWKS_INVALID")}};E(fe,"code","ERR_JWKS_INVALID");var le=class extends H{constructor(r="no applicable key found in the JSON Web Key Set",n){super(r,n);E(this,"code","ERR_JWKS_NO_MATCHING_KEY")}};E(le,"code","ERR_JWKS_NO_MATCHING_KEY");var jr,Br,Re=class extends(Br=H,jr=Symbol.asyncIterator,Br){constructor(r="multiple matching keys found in the JSON Web Key Set",n){super(r,n);E(this,jr,async function*(){});E(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}};E(Re,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");var De=class extends H{constructor(r="request timed out",n){super(r,n);E(this,"code","ERR_JWKS_TIMEOUT")}};E(De,"code","ERR_JWKS_TIMEOUT");var te=class extends H{constructor(r="signature verification failed",n){super(r,n);E(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}};E(te,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");var or={};Nr(or,{decode:()=>re,encode:()=>W});var Wn="The input to be decoded is not correctly encoded.";function re(t){try{return Ct(typeof t=="string"?t:Ue.decode(t),!0)}catch(e){throw new TypeError(Wn,{cause:e})}}function W(t){return Kt(typeof t=="string"?se.encode(t):t,!0)}function O(t,e){if(!(t instanceof Uint8Array))throw new TypeError(`${e} must be an instance of Uint8Array`)}function b(t){if(typeof t!="object"||t===null||Object.prototype.toString.call(t)!=="[object Object]")return!1;let e=Object.getPrototypeOf(t);return e===null||Object.getPrototypeOf(e)===null}function Pt(t){return b(t)&&Array.isArray(t.keys)&&Array.from(t.keys).every(b)}function he(...t){let e=new Set;for(let r of t)if(r)for(let n of Object.keys(r)){if(e.has(n))return!1;e.add(n)}return!0}function K(t,e){if(t!==void 0)throw new TypeError(`${e} can only be called once`)}function N(t,e,r){try{return re(t)}catch(n){throw new r(`Failed to base64url decode the ${e}`,{cause:n})}}function It(t,e,r){try{return R(t)}catch(n){throw new r(`The ${e} is not a valid base64url string`,{cause:n})}}function we(t,e,r){let n;try{n=JSON.parse(_e.decode(re(t)))}catch(o){throw new e(r,{cause:o})}if(!b(n))throw new e(r);return n}var Ne={__proto__:null,b64:!0},Tt={__proto__:null};function ct(t,e){if(e!==void 0&&(!Array.isArray(e)||e.some(r=>typeof r!="string")))throw new TypeError(`"${t}" option must be an array of strings`);return e===void 0?void 0:new Set(e)}function kt(t,e){let{crit:r}=e??{};if(Array.isArray(r)&&new Set(r).size!==r.length)throw new t('"crit" (Critical) Header Parameter MUST NOT contain duplicate values')}function ne(t,e,r,n,o){if(o.crit!==void 0&&n?.crit===void 0)throw new t('"crit" (Critical) Header Parameter MUST be integrity protected');if(!n||n.crit===void 0)return[];if(!Array.isArray(n.crit)||n.crit.length===0||n.crit.some(a=>typeof a!="string"||a.length===0))throw new t('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i=r===void 0?e:{__proto__:null,...r,...e};for(let a of n.crit){if(!(a in i))throw new A(`Extension Header Parameter "${a}" is not recognized`);if(!Object.hasOwn(o,a)||o[a]===void 0)throw new t(`Extension Header Parameter "${a}" is missing`);if(i[a]&&(!Object.hasOwn(n,a)||n[a]===void 0))throw new t(`Extension Header Parameter "${a}" MUST be integrity protected`)}return n.crit}function je(t,e){if(e.includes("b64")){let r=t.b64;if(typeof r!="boolean")throw new l('The "b64" (base64url-encode payload) Header Parameter must be a boolean');return r}return!0}function We(t,e){let r,n;try{r=JSON.stringify(e),n=JSON.parse(r)}catch(o){throw new t("JOSE Header is not valid JSON",{cause:o})}if(!b(n))throw new t("JOSE Header is not a JSON object");return[n,r]}var Pn=t=>t[Symbol.toStringTag],In=(t,e,r)=>{let{alg:n}=t;if(e.use!==void 0){let o=r==="sign"||r==="verify"?"sig":"enc";if(e.use!==o)throw new TypeError(`Invalid key for this operation, its "use" must be "${o}" when present`)}if(e.alg!==void 0&&e.alg!==n)throw new TypeError(`Invalid key for this operation, its "alg" must be "${n}" when present`);if(Array.isArray(e.key_ops)){let o=r==="encrypt"||r==="decrypt"?t.ops?.[r==="encrypt"?0:1]:r;if(o&&!e.key_ops.includes(o))throw new TypeError(`Invalid key for this operation, its "key_ops" must include "${o}" when present`)}};async function F(t,e,r){let{alg:n,secret:o}=t,i=r==="decrypt"||r==="sign";if(o&&e instanceof Uint8Array)return e;let a,s;if(b(e)){if(a=dt(e),typeof a.kty!="string")throw Lr(n,e,o);if(!(o?a.kty==="oct"&&typeof a.k=="string":a.kty!=="oct"&&(i?a.kty==="AKP"&&typeof a.priv=="string"||typeof a.d=="string":a.d===void 0&&a.priv===void 0)))throw new TypeError(o?'JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present':`JSON Web Key for this operation must be a ${i?"private":"public"} JWK`);if(In(t,a,r),a.kty==="oct")return re(a.k);if(!Object.isFrozen(e)){let{key_ops:d}=e;Array.isArray(d)&&Object.freeze(d),Object.freeze(e)}}else{if(!ar(e))throw Lr(n,e,o);let d=o?"secret":i?"private":"public";if(e.type!==d&&(o||["secret","public","private"].includes(e.type)))throw new TypeError(`${Pn(e)} instances must be of type "${d}" for the ${n} algorithm`);if(oe(e))return e;if(s=e,s.type==="secret")return s.export()}ir||(ir=new WeakMap);let y=e,c=ir.get(y);if(c?.[n])return c[n];if(c||ir.set(y,c={}),s&&typeof s.toCryptoKey=="function"){let d=s.type==="public",f=Tn[s.asymmetricKeyDetails?.namedCurve],m=t.resolve?.({crv:f,asymmetricKeyType:s.asymmetricKeyType})??t.subtle;return c[n]=s.toCryptoKey(m,d,t.usages[d?0:1])}return a??(a=s.export({format:"jwk"})),a.alg=n,c[n]=await ie(t,a)}var ir,Tn={__proto__:null,prime256v1:"P-256",secp384r1:"P-384",secp521r1:"P-521"};function Ht(t){if(!oe(t))throw new Error("CryptoKey instance expected")}var oe=t=>{if(t?.[Symbol.toStringTag]==="CryptoKey")return!0;try{return t instanceof CryptoKey}catch{return!1}},pt=t=>t?.[Symbol.toStringTag]==="KeyObject",ar=t=>oe(t)||pt(t);function $r(t,e,...r){if(r.length>2){let n=r.pop();t+=`one of type ${r.join(", ")}, or ${n}.`}else r.length===2?t+=`one of type ${r[0]} or ${r[1]}.`:t+=`of type ${r[0]}.`;return e==null?t+=` Received ${e}`:typeof e=="function"&&e.name?t+=` Received function ${e.name}`:typeof e=="object"&&e!=null&&e.constructor?.name&&(t+=` Received an instance of ${e.constructor.name}`),t}var X=(t,...e)=>$r("Key must be ",t,...e);function Lr(t,e,r){let n=["CryptoKey","KeyObject","JSON Web Key"];return r&&n.push("Uint8Array"),new TypeError($r(`Key for the ${t} algorithm must be `,e,...n))}var xt=(t,e="algorithm.name")=>new TypeError(`CryptoKey does not support this operation, its ${e} must be ${t}`);function sr(t,e){if(e&&!t.usages.includes(e))throw new TypeError(`CryptoKey does not support this operation, its usages must include ${e}.`)}function Be(t,e){let{modulusLength:r}=e.algorithm;if(typeof r!="number"||r<2048)throw new TypeError(`${t} requires key modulusLength to be 2048 bits or larger`)}function cr(t,e,r){let n=t.algorithm;if(n.name!==e.name)throw xt(e.name);if(e.hash&&n.hash?.name!==e.hash)throw xt(e.hash,"algorithm.hash");if(e.namedCurve&&n.namedCurve!==e.namedCurve)throw xt(e.namedCurve,"algorithm.namedCurve");if(e.length!==void 0&&n.length!==e.length)throw xt(e.length,"algorithm.length");sr(t,r)}function Me(t){return{__proto__:null,...t}}function dt(t){let e=Me(t);if(e.ext!==void 0&&typeof e.ext!="boolean")throw new TypeError('"ext" (Extractable) Parameter must be a boolean');if(e.key_ops!==void 0){let r=e.key_ops,n=Array.isArray(r)?[...r]:void 0;if(!n||n.some(o=>typeof o!="string")||new Set(n).size!==n.length)throw new TypeError('"key_ops" (Key Operations) Parameter must be an array of unique strings');e.key_ops=n}return e}function ge(t){if(t!==void 0&&typeof t!="boolean")throw new TypeError('"extractable" option must be a boolean');return t}async function ie(t,e,r){if(!t.kty.includes(e.kty))throw new A('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');let n=t.resolve?.({kty:e.kty,crv:e.crv})??t.subtle,o=!!(e.d||e.priv),i={...e,ext:r??e.ext};return i.kty!=="AKP"&&delete i.alg,delete i.use,crypto.subtle.importKey("jwk",i,n,i.ext??!o,e.key_ops??t.usages[o?1:0])}async function q(t,e,r,n=!1){return t instanceof Uint8Array&&(t=await crypto.subtle.importKey("raw",t,e,n,[r])),cr(t,e,r),t}var Pe=t=>crypto.getRandomValues(new Uint8Array(t.cekBits>>3));function Ot(t,e){let r=t.byteLength<<3;if(r!==e)throw new p(`Invalid Content Encryption Key length. Expected ${e} bits, got ${r} bits`)}var kn=t=>crypto.getRandomValues(new Uint8Array(t.ivBits>>3));function Vr(t,e){if(e.length<<3!==t.ivBits)throw new p("Invalid Initialization Vector length")}async function Gr(t,e,r){if(!(e instanceof Uint8Array))throw new TypeError(X(e,"Uint8Array"));let n=t.cekBits>>1,o=await crypto.subtle.importKey("raw",e.subarray(n>>3),"AES-CBC",!1,[r]),i=await crypto.subtle.importKey("raw",e.subarray(0,n>>3),{hash:`SHA-${n<<1}`,name:"HMAC"},!1,["sign"]);return[o,i,n]}async function zr(t,e,r){return new Uint8Array((await crypto.subtle.sign("HMAC",t,e)).slice(0,r>>3))}async function xn(t,e,r,n,o){let[i,a,s]=await Gr(t,r,"encrypt"),y=new Uint8Array(await crypto.subtle.encrypt({iv:n,name:"AES-CBC"},i,e)),c=nr(o.length*8),d=B(o,n,y,c),f=await zr(a,d,s);return{ciphertext:y,tag:f,iv:n}}async function Hn(t,e){let r={name:"HMAC",hash:"SHA-256"},n=await crypto.subtle.generateKey(r,!1,["sign","verify"]),o=await crypto.subtle.sign(r,n,t);return crypto.subtle.verify(r,n,o,e)}async function On(t,e,r,n,o,i){let[a,s,y]=await Gr(t,e,"decrypt"),c=nr(i.length*8),d=B(i,n,r,c),f=await zr(s,d,y);try{if(await Hn(o,f))return new Uint8Array(await crypto.subtle.decrypt({iv:n,name:"AES-CBC"},a,r))}catch{}throw new ee}async function Ut(t,e,r,n,o){if(!oe(r)&&!(r instanceof Uint8Array))throw new TypeError(X(r,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(n?Vr(t,n):n=kn(t),r instanceof Uint8Array&&Ot(r,t.cekBits),t.cbc)return xn(t,e,r,n,o);let i=await q(r,t.subtle,"encrypt"),a=new Uint8Array(await crypto.subtle.encrypt({additionalData:o,iv:n,name:"AES-GCM",tagLength:128},i,e));return{ciphertext:a.subarray(0,-16),tag:a.subarray(-16),iv:n}}async function _t(t,e,r,n,o,i){if(!oe(e)&&!(e instanceof Uint8Array))throw new TypeError(X(e,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(!n)throw new p("JWE Initialization Vector missing");if(!o)throw new p("JWE Authentication Tag missing");if(!t.cbc&&o.length!==16)throw new p("Invalid Authentication Tag length");if(Vr(t,n),e instanceof Uint8Array&&Ot(e,t.cekBits),t.cbc)return On(t,e,r,n,o,i);let a=await q(e,t.subtle,"decrypt");try{return new Uint8Array(await crypto.subtle.decrypt({additionalData:i,iv:n,name:"AES-GCM",tagLength:128},a,B(r,o)))}catch{throw new ee}}function ut(t){let e={__proto__:null};for(let r in t)e[r]={...t[r],alg:r};return e}var Un=[["encrypt","wrapKey"],["decrypt","unwrapKey"]],_n=[[],["deriveBits"]],Nt=[[],[]];function Rt(t){return{kty:["RSA"],mode:"key-encryption",subtle:{name:"RSA-OAEP",hash:`SHA-${t}`},usages:Un,ops:["wrapKey","unwrapKey"]}}function Dt(t){return{kty:["EC","OKP"],mode:t,subtle:{name:"ECDH"},resolve:({kty:e,crv:r,asymmetricKeyType:n})=>{if(r==="X25519"||n==="x25519")return{name:"X25519"};if(e==="OKP")throw new A('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');return{name:"ECDH",namedCurve:r}},usages:_n,ops:[void 0,"deriveBits"]}}function Le(t,e=!1){return{kty:["oct"],mode:"key-wrapping",secret:!0,subtle:{name:e?"AES-GCM":"AES-KW",length:t},usages:Nt,ops:e?["encrypt","decrypt"]:["wrapKey","unwrapKey"]}}function pr(){return{kty:["oct"],mode:"key-wrapping",secret:!0,subtle:{name:"PBKDF2"},usages:Nt,ops:["deriveBits","deriveBits"]}}var pe=ut({dir:{kty:["oct"],mode:"direct-encryption",secret:!0,subtle:{name:"AES-GCM"},usages:Nt,ops:["encrypt","decrypt"]},"RSA-OAEP":Rt(1),"RSA-OAEP-256":Rt(256),"RSA-OAEP-384":Rt(384),"RSA-OAEP-512":Rt(512),"ECDH-ES":Dt("direct-key-agreement"),"ECDH-ES+A128KW":Dt("key-agreement-with-key-wrapping"),"ECDH-ES+A192KW":Dt("key-agreement-with-key-wrapping"),"ECDH-ES+A256KW":Dt("key-agreement-with-key-wrapping"),A128KW:Le(128),A192KW:Le(192),A256KW:Le(256),A128GCMKW:Le(128,!0),A192GCMKW:Le(192,!0),A256GCMKW:Le(256,!0),"PBES2-HS256+A128KW":pr(),"PBES2-HS384+A192KW":pr(),"PBES2-HS512+A256KW":pr()}),Rn=["encrypt","decrypt"];function $e(t,e=!1){return{kty:["oct"],secret:!0,subtle:{name:e?"AES-CBC":"AES-GCM",length:t},usages:Nt,ops:Rn,cekBits:t,ivBits:e?128:96,cbc:e}}var Dn=ut({A128GCM:$e(128),A192GCM:$e(192),A256GCM:$e(256),"A128CBC-HS256":$e(256,!0),"A192CBC-HS384":$e(384,!0),"A256CBC-HS512":$e(512,!0)});function Fr(t,e){throw new A(`Invalid or unsupported "${t}" (JWE ${e}) header value`)}function Y(t){return(typeof t=="string"?pe[t]:void 0)??Fr("alg","Algorithm")}function Z(t){return t.mode==="key-wrapping"||t.mode==="key-encryption"||t.mode==="key-agreement-with-key-wrapping"}function Ie(t){return(typeof t=="string"?Dn[t]:void 0)??Fr("enc","Encryption Algorithm")}function Xr(t,e){if(t.algorithm.name!=="ECDH"&&t.algorithm.name!=="X25519")throw new TypeError("CryptoKey does not support this operation, its algorithm.name must be ECDH or X25519");sr(t,e)}async function Nn(t,e,r){let n=await q(e,Y(t).subtle,"wrapKey",!0),o=await crypto.subtle.importKey("raw",r,{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.wrapKey("raw",o,n,"AES-KW"))}async function jn(t,e,r){let n=await q(e,Y(t).subtle,"unwrapKey",!0),o=await crypto.subtle.unwrapKey("raw",r,n,"AES-KW",{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.exportKey("raw",o))}function Yr(t,e,r){cr(e,Y(t).subtle,r),Be(t,e)}async function Zr(t,e,r,n){if(!(t instanceof Uint8Array)||t.length<8)throw new p("PBES2 Salt Input must be 8 or more octets");if(!Number.isSafeInteger(r)||Math.sign(r)!==1)throw new p("PBES2 Count Input must be a positive integer");let o=B(R(e),Uint8Array.of(0),t),i=parseInt(e.slice(13,16),10),a={hash:`SHA-${e.slice(8,11)}`,iterations:r,name:"PBKDF2",salt:o},s=await q(n,Y(e).subtle,"deriveBits");return new Uint8Array(await crypto.subtle.deriveBits(a,s,i))}function dr(t){return B(Jt(t.length),t)}async function Bn(t,e,r){let n=e>>3,o=32,i=Math.ceil(n/o),a=new Uint8Array(i*o);for(let s=1;s<=i;s++){let y=await Wt("sha256",B(Jt(s),t,r));a.set(y,(s-1)*o)}return a.slice(0,n)}async function Qr(t,e,r,n,o=new Uint8Array,i=new Uint8Array){Xr(t),Xr(e,"deriveBits");let a=B(dr(R(r)),dr(o),dr(i),Jt(n)),s=new Uint8Array(await crypto.subtle.deriveBits({name:t.algorithm.name,public:t},e,t.algorithm.name==="X25519"?256:Math.ceil(parseInt(t.algorithm.namedCurve.slice(-3),10)/8)<<3));return Bn(s,n,a)}function en(t){Ht(t);let e=t.algorithm.namedCurve;if(e!=="P-256"&&e!=="P-384"&&e!=="P-521"&&t.algorithm.name!=="X25519")throw new A("ECDH with the provided key is not allowed or not supported by your javascript runtime")}function jt(t,e){let r=t[e];if(r!==void 0){if(typeof r!="string")throw new p(`JOSE Header "${e}" (Agreement Party${e==="apu"?"U":"V"}Info) invalid`);return N(r,e,p)}}function tn(t,e){if(!(t===void 0||e===void 0||t.byteLength!==e.byteLength)){for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return;throw new p('JOSE Header "apu" and "apv" values must be distinct')}}function Mn(t){if(t===void 0)throw new p("JWE Encrypted Key missing")}function qr(t){if(t!==void 0)throw new p("Encountered unexpected JWE Encrypted Key")}function rn(t){if(t!==void 0&&t!==1/0&&(!Number.isSafeInteger(t)||t<1))throw new TypeError("maxPBES2Count must be a positive safe integer or Infinity")}async function nn(t,e,r,n,o,i){let{alg:a}=t,s=t.mode;if(s==="direct-encryption")return qr(n),r;let y=s==="direct-key-agreement";switch(y?qr(n):Mn(n),t.subtle.name){case"ECDH":{let{epk:c}=o;if(!b(c)||["d","k","p","q","dp","dq","qi","oth","priv"].some(h=>Object.hasOwn(c,h)))throw new p('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');en(r);let d=await ie(t,c),f=jt(o,"apu"),m=jt(o,"apv");tn(f,m);let w=await Qr(d,r,y?e.alg:a,y?e.cekBits:parseInt(a.slice(-5,-2),10),f,m);if(y)return w;r=w;break}case"RSA-OAEP":return Ht(r),Yr(a,r,"decrypt"),new Uint8Array(await crypto.subtle.decrypt("RSA-OAEP",r,n));case"PBKDF2":{if(typeof o.p2c!="number")throw new p('JOSE Header "p2c" (PBES2 Count) missing or invalid');let c=i??1e4;if(o.p2c>c)throw new p('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if(typeof o.p2s!="string")throw new p('JOSE Header "p2s" (PBES2 Salt) missing or invalid');let d=N(o.p2s,"p2s",p);r=await Zr(d,a,o.p2c,r);break}case"AES-GCM":{if(typeof o.iv!="string")throw new p('JOSE Header "iv" (Initialization Vector) missing or invalid');if(typeof o.tag!="string")throw new p('JOSE Header "tag" (Authentication Tag) missing or invalid');let c=N(o.iv,"iv",p),d=N(o.tag,"tag",p);if(c.byteLength!==12)throw new p("Invalid Initialization Vector length");if(d.byteLength!==16)throw new p("Invalid Authentication Tag length");return _t(Ie(a.slice(0,-2)),r,n,c,d,new Uint8Array)}}return jn(a.slice(-6),r,n)}async function Bt(t,e,r,n,o,i={}){let{alg:a,mode:s}=t,y=Z(t);if(o!==void 0&&!y)throw new TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${a}`);let c=await F(s==="direct-encryption"?e:t,r,"encrypt");if(s==="direct-encryption")return[c,void 0,void 0];let d=y?o??Pe(e):void 0;d&&Ot(d,e.cekBits);let f,m;switch(t.subtle.name){case"ECDH":{en(c);let{apu:w,apv:h}=i;w!==void 0&&O(w,'"apu"'),h!==void 0&&O(h,'"apv"');let J=w??jt(n,"apu"),C=h??jt(n,"apv");tn(J,C);let g;i.epk!==void 0?g=await F(t,i.epk,"decrypt"):g=(await crypto.subtle.generateKey(c.algorithm,!0,["deriveBits"])).privateKey;let v=crypto.subtle,S=g;if(!S.extractable){if(typeof v.getPublicKey!="function")throw new TypeError('CryptoKey for "epk" must be extractable');S=await v.getPublicKey(g,[])}let{x:T,y:x,crv:D,kty:j}=await v.exportKey("jwk",S),U=s==="direct-key-agreement",ae=await Qr(c,g,U?e.alg:a,U?e.cekBits:parseInt(a.slice(-5,-2),10),J,C),L={x:T,crv:D,kty:j};if(j==="EC"&&(L.y=x),m={epk:L},w!==void 0&&(m.apu=W(w)),h!==void 0&&(m.apv=W(h)),U)return[ae,void 0,m];c=ae;break}case"RSA-OAEP":{Ht(c),Yr(a,c,"encrypt"),f=new Uint8Array(await crypto.subtle.encrypt("RSA-OAEP",c,d));break}case"PBKDF2":{let{p2c:w=2048,p2s:h=crypto.getRandomValues(new Uint8Array(16))}=i;c=await Zr(h,a,w,c),m={p2c:w,p2s:W(h)};break}case"AES-GCM":{let w=i.iv===void 0?crypto.getRandomValues(new Uint8Array(12)):i.iv;if(!(w instanceof Uint8Array))throw new TypeError('"iv" must be an instance of Uint8Array');let h=await Ut(Ie(a.slice(0,-2)),d,c,w,new Uint8Array);f=h.ciphertext,m={iv:W(h.iv),tag:W(h.tag)}}}if(f??(f=await Nn(a.slice(-6),c,d)),!(f instanceof Uint8Array)||!f.byteLength)throw new TypeError("JWE key management algorithm did not produce an Encrypted Key");return[d,f,m]}function Mt(t,e){if(t.zip!==void 0&&t.zip!=="DEF")throw new A('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(t.zip!==void 0&&!e?.zip)throw new p('JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.')}function on(t){if(typeof globalThis[t]>"u")throw new A(`JWE "zip" (Compression Algorithm) Header Parameter requires the ${t} API.`)}async function an(t,e,r=1/0){let n=t.writable.getWriter();n.write(e).catch(()=>{}),n.close().catch(()=>{});let o=[],i=0,a=t.readable.getReader();for(;;){let{value:s,done:y}=await a.read();if(y)break;if(o.push(s),i+=s.byteLength,r!==1/0&&i>r)throw await a.cancel().catch(()=>{}),new p("Decompressed plaintext exceeded the configured limit")}return B(...o)}async function sn(t){return on("CompressionStream"),an(new CompressionStream("deflate-raw"),t)}async function cn(t,e){return on("DecompressionStream"),an(new DecompressionStream("deflate-raw"),t,e)}function Lt(t){let{aad:e,ciphertext:r,iv:n,protected:o,tag:i,unprotected:a}=t;if(n!==void 0&&(typeof n!="string"||!n))throw new p("JWE Initialization Vector incorrect type");if(typeof r!="string")throw new p("JWE Ciphertext missing or incorrect type");if(i!==void 0&&(typeof i!="string"||!i))throw new p("JWE Authentication Tag incorrect type");if(o!==void 0&&typeof o!="string")throw new p("JWE Protected Header incorrect type");if(e!==void 0&&(typeof e!="string"||!e))throw new p("JWE AAD incorrect type");if(a!==void 0&&!b(a))throw new p("JWE Shared Unprotected Header incorrect type");return{aad:e,ciphertext:r,iv:n,protected:o,tag:i,unprotected:a===void 0?void 0:{...a}}}function $t(t){let e,r;try{let{header:n}=t;if(b(n)){r=n.alg;let i=Object.keys(n);i.includes("alg")||(r=void 0),e=Object.fromEntries(i.map(a=>[a,a==="alg"?r:n[a]]))}else e=n;let{encrypted_key:o}=t;return[{encrypted_key:o,header:e},r]}catch(n){return[void 0,r,n]}}function Vt(t){let{encrypted_key:e,header:r}=t;if(e!==void 0&&typeof e!="string")throw new p("JWE Encrypted Key incorrect type");if(r!==void 0&&!b(r))throw new p("JWE Per-Recipient Unprotected Header incorrect type");if(t.protected===void 0&&r===void 0&&t.unprotected===void 0)throw new p("JOSE Header missing")}function ur(t){let{protected:e,ciphertext:r,iv:n,tag:o,aad:i}=t,a;return e!==void 0&&(a=we(e,p,"JWE Protected Header is invalid")),[a,N(r,"ciphertext",p),n!==void 0?N(n,"iv",p):void 0,o!==void 0?N(o,"tag",p):void 0,It((e??"")+(i!==void 0?`.${i}`:""),"aad",p)]}function Ee(t){let e=t&&ct("keyManagementAlgorithms",t.keyManagementAlgorithms),r=t&&ct("contentEncryptionAlgorithms",t.contentEncryptionAlgorithms),{crit:n,maxPBES2Count:o,maxDecompressedLength:i}=t??{};rn(o);let a=i??25e4;if(a!==0&&a!==1/0&&(!Number.isSafeInteger(a)||a<1))throw new TypeError("maxDecompressedLength must be 0, a positive safe integer, or Infinity");return[e,r,n,o,i]}async function yt(t,e,r,n=ur(t)){let[o,i,a,s,y]=n,{header:c,unprotected:d,aad:f}=t,m;if(c!==void 0||d!==void 0){if(!he(o,c,d))throw new p("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");m={...o,...c,...d}}else m=o??{};let[w,h,J,C,g]=e,{encrypted_key:v}=t;ne(p,Tt,J,o,m),Mt(m,o);let{alg:S,enc:T}=m;if(typeof S!="string"||!S)throw new p("missing JWE Algorithm (alg) in JWE Header");let x=pe[S];if(v===""&&(!x||!Z(x)))throw new p("JWE Encrypted Key incorrect type");let D=x?.mode==="integrated-encryption";if(!D&&(typeof T!="string"||!T))throw new p("missing JWE Encryption Algorithm (enc) in JWE Header");if(w&&!w.has(S)||!w&&S.startsWith("PBES2"))throw new ce('"alg" (Algorithm) Header Parameter value not allowed');let j;if(D){if(T!==void 0)throw new p('JWE "enc" (Encryption Algorithm) Header Parameter must not be present for integrated encryption');if(a?.byteLength)throw new p("JWE Initialization Vector must be empty for integrated encryption");if(s?.byteLength)throw new p("JWE Authentication Tag must be empty for integrated encryption")}else{if(h&&!h.has(T))throw new ce('"enc" (Encryption Algorithm) Header Parameter value not allowed');j=Ie(T)}let U;if(v!==void 0)try{U=N(v,"encrypted_key",p)}catch(z){if(!x||!Z(x))throw z;U=new Uint8Array}let ae=!1;typeof r=="function"&&(r=await r(o,t),ae=!0);let L=x??Y(S);Z(L)&&U===void 0&&(U=new Uint8Array);let Je=await F(L.mode==="direct-encryption"?j:L,r,"decrypt"),$;if(L.mode==="integrated-encryption")$=await L.decrypt(Je,U,i,y,o,m);else{let z=j,Q;try{Q=await nn(L,z,Je,U,m,C),Z(L)&&Q instanceof Uint8Array&&Q.byteLength<<3!==z.cekBits&&(Q=Pe(z))}catch(St){if(St instanceof TypeError||St instanceof p||St instanceof A)throw St;Q=Pe(z)}$=await _t(z,Q,i,a,s,y)}if(m.zip==="DEF"){let z=g??25e4;if(z===0)throw new A('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');$=await cn($,z).catch(Q=>{throw Q instanceof p?Q:new p("Failed to decompress plaintext",{cause:Q})})}return{plaintext:$,...o&&{protectedHeader:o},...f!==void 0&&{additionalAuthenticatedData:N(f,"aad",p)},...d&&{sharedUnprotectedHeader:d},...c&&{unprotectedHeader:c},...ae&&{key:Je}}}async function Gt(t,e,r){if(t instanceof Uint8Array&&(t=Ue.decode(t)),typeof t!="string")throw new p("Compact JWE must be a string or Uint8Array");let{0:n,1:o,2:i,3:a,4:s,length:y}=t.split(".");if(y!==5)throw new p("Invalid Compact JWE");return yt({ciphertext:a,iv:i||void 0,protected:n,tag:s||void 0,encrypted_key:o||void 0},e,r)}async function Ln(t,e,r){return Gt(t,Ee(r),e)}async function $n(t,e,r){if(!b(t))throw new p("Flattened JWE must be an object");let n=Lt(t),[o,,i]=$t(t);if(!o)throw i;let a={...n,...o};return Vt(a),yt(a,Ee(r),e)}async function Vn(t,e,r){if(!b(t))throw new p("General JWE must be an object");let n=t.recipients;if(!Array.isArray(n))throw new p("JWE Recipients missing or incorrect type");let o=Array.from(n);if(!o.every(b))throw new p("JWE Recipients missing or incorrect type");if(!o.length)throw new p("JWE Recipients has no members");let i=Ee(r),a,s;try{a=Lt(t),s=ur(a)}catch{throw new ee}let y=o.map(c=>$t(c));if(o.length>1)for(let[,c]of y){let d=s[0]?.alg??c??a.unprotected?.alg,f=typeof d=="string"?pe[d]:void 0;if(f&&!Z(f))throw new p(`"${d}" alg may only have a single recipient`)}for(let[c]of y)if(c)try{let d={...a,...c};return Vt(d),await yt(d,i,e,s)}catch{}throw new ee}function zt(t,e,r){if(!he(t,e,r))throw new p("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint")}function yr(t,e,r=!1){if(!t[1]&&!t[2]&&!t[3])throw new p("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");e!==void 0&&(t[8]=e?.crit);let[,n,o,i,a,s,y,c,d]=t;if(a!==void 0&&O(a,"JWE Additional Authenticated Data"),s!==void 0&&O(s,"JWE Content Encryption Key"),y!==void 0&&O(y,"JWE Initialization Vector"),!r&&n!==void 0&&(n=We(p,n)[0],t[1]=n),o!==void 0&&(o=We(p,o)[0],t[2]=o),!r&&i!==void 0&&(i=We(p,i)[0],t[3]=i),c!==void 0&&!b(c))throw new TypeError("JWE Key Management Parameters must be an object");zt(n,o,i);let f={...n,...o,...i};kt(p,n),ne(p,Tt,d,n,f),Mt(f,n);let{alg:m,enc:w}=f;if(typeof m!="string"||!m)throw new p('JWE "alg" (Algorithm) Header Parameter missing or invalid');let h=pe[m];if(h?.mode==="integrated-encryption"){if(w!==void 0)throw new p('JWE "enc" (Encryption Algorithm) Header Parameter must not be present for integrated encryption');if(s!==void 0)throw new TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${m}`);if(y!==void 0)throw new TypeError(`setInitializationVector cannot be called with JWE "alg" (Algorithm) Header ${m}`);return[f,void 0,h]}if(typeof w!="string"||!w)throw new p('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');return[f,Ie(w),h]}async function mr(t,e,r){let[n,o,i]=e,[a,s,y,c,d,f,m,w,,h]=t,J=s,C=y,g=i??Y(n.alg),v,S,T;g.mode==="integrated-encryption"?T=await F(g,r,"encrypt"):[T,v,S]=await Bt(g,o,r,n,f,w),S&&(h?C=C?{...C,...S}:S:J=J?{...J,...S}:S,zt(J,C,c));let x=J?W(JSON.stringify(J)):"",D=d?.byteLength?W(d):void 0,j=R(D?`${x}.${D}`:x),U=a;n.zip==="DEF"&&(U=await sn(U).catch(z=>{throw new p("Failed to compress plaintext",{cause:z})}));let ae,L,Je;g.mode==="integrated-encryption"?[v,ae]=await g.encrypt(T,U,j,J,n,w):{ciphertext:ae,tag:L,iv:Je}=await Ut(o,U,T,m,j);let $={ciphertext:W(ae)};return Je&&($.iv=W(Je)),L&&($.tag=W(L)),v?.byteLength&&($.encrypted_key=W(v)),D&&($.aad=D),J&&($.protected=x),c&&($.unprotected=c),C&&($.header=C),$}async function Ve(t,e,r){return mr(t,yr(t,r),e)}function Ft(t){return[t.protected,t.encrypted_key,t.iv,t.ciphertext,t.tag].join(".")}var Te,fr=class{constructor(e,r,n){P(this,Te);E(this,"state");k(this,Te,e),this.state=[void 0,void 0,r,n]}setUnprotectedHeader(e){return K(this.state[0],"setUnprotectedHeader"),this.state[0]=e,this}setKeyManagementParameters(e){return K(this.state[1],"setKeyManagementParameters"),this.state[1]=e,this}addRecipient(...e){return u(this,Te).addRecipient(...e)}encrypt(...e){return u(this,Te).encrypt(...e)}done(){return u(this,Te)}};Te=new WeakMap;var Ge,ke,ze,Fe,mt,lr=class{constructor(e){P(this,Ge);P(this,ke,[]);P(this,ze);P(this,Fe);P(this,mt);k(this,Ge,e)}addRecipient(e,r){let n=new fr(this,e,r?.crit);return u(this,ke).push(n),n}setProtectedHeader(e){return K(u(this,ze),"setProtectedHeader"),k(this,ze,e),this}setSharedUnprotectedHeader(e){return K(u(this,Fe),"setSharedUnprotectedHeader"),k(this,Fe,e),this}setAdditionalAuthenticatedData(e){return k(this,mt,e),this}async encrypt(){if(!u(this,ke).length)throw new p("at least one recipient must be added");O(u(this,Ge),"plaintext");let e=u(this,ke).length>1,r,n=u(this,ze),o=u(this,Fe),i=[];for(let h of u(this,ke)){let[J,C,g,v]=h.state,S=[u(this,Ge),n,J,o,u(this,mt),void 0,void 0,C,v,e],T=yr(S,void 0,i.length>0);i.length||(n=S[1],o=S[3]),i.push([S,T,g]);let[{alg:x,enc:D},,j]=T;if(e&&j&&!Z(j))throw new p(`"${x}" alg may only have a single recipient`);if(!r)r=D;else if(r!==D)throw new p('JWE "enc" (Encryption Algorithm) Header Parameter must be the same for all recipients')}for(let[,h]of i)h[2]??(h[2]=Y(h[0].alg));let[a,s,y]=i[0],c=e?Pe(s[1]):void 0;a[5]=c;let{encrypted_key:d,header:f,...m}=await mr(a,s,y),w={...m,recipients:[{}]};d&&(w.recipients[0].encrypted_key=d),f&&(w.recipients[0].header=f);for(let h=1;h<i.length;h++){let[J,[C,g,v],S]=i[h],T=J[2],[,x,D]=await Bt(v,g,S,C,c,J[7]),j={encrypted_key:W(x)};if(T||D){let U={...T,...D};D&&zt(J[1],U,J[3]),j.header=U}w.recipients.push(j)}return w}};Ge=new WeakMap,ke=new WeakMap,ze=new WeakMap,Fe=new WeakMap,mt=new WeakMap;var ft=[["verify"],["sign"]];function hr(t){let e={name:"HMAC",hash:`SHA-${t}`};return{kty:["oct"],secret:!0,subtle:e,signing:e,usages:ft}}function Xe(t,e){let r={name:e?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:`SHA-${t}`};return{kty:["RSA"],subtle:r,signing:e?{...r,saltLength:e}:r,usages:ft,minRsaBits:2048}}function wr(t,e){return{kty:["EC"],crv:t,subtle:{name:"ECDSA",namedCurve:t},signing:{name:"ECDSA",hash:`SHA-${e}`},usages:ft}}function pn(){let t={name:"Ed25519"};return{kty:["OKP"],crv:"Ed25519",subtle:t,signing:t,usages:ft}}function gr(t){let e={name:`ML-DSA-${t}`};return{kty:["AKP"],subtle:e,signing:e,usages:ft}}var lt=ut({HS256:hr(256),HS384:hr(384),HS512:hr(512),RS256:Xe(256),RS384:Xe(384),RS512:Xe(512),PS256:Xe(256,32),PS384:Xe(384,48),PS512:Xe(512,64),ES256:wr("P-256",256),ES384:wr("P-384",384),ES512:wr("P-521",512),EdDSA:pn(),Ed25519:pn(),"ML-DSA-44":gr(44),"ML-DSA-65":gr(65),"ML-DSA-87":gr(87)});function qe(t){let e=typeof t=="string"?lt[t]:void 0;if(!e)throw new A(`alg ${t} is not supported either by JOSE or your javascript runtime`);return e}function Xt(t,e){let r=t.protected,n=t.header,o=b(n)?{...n}:n,i=e?e[0]:t.payload;!e&&i instanceof Uint8Array&&(i=new Uint8Array(i));let a=t.signature,s={payload:i,signature:a};if(r!==void 0&&(s.protected=r),n!==void 0&&(s.header=o),r===void 0&&o===void 0)throw new l('Flattened JWS must have either of the "protected" or "header" members');if(r!==void 0&&typeof r!="string")throw new l("JWS Protected Header incorrect type");if(i===void 0)throw new l("JWS Payload missing");if(typeof a!="string")throw new l("JWS Signature missing or incorrect type");if(o!==void 0&&!b(o))throw new l("JWS Unprotected Header incorrect type");return s}function be(t){return[t&&ct("algorithms",t.algorithms),t?.crit]}function Er(t){return t===void 0?{}:we(t,l,"JWS Protected Header is invalid")}function qt(t){let e=/[\p{Cs}\p{Cn}]/u.exec(t)?.[0];if(e!==void 0)throw new l(/\p{Cs}/u.test(e)?"JWS Payload must be a well-formed Unicode string":"JWS Payload must not contain unassigned Unicode code points");return se.encode(t)}function Gn(t){try{return R(t)}catch(e){throw new l("JWS Compact Serialization payload must use only ASCII characters",{cause:e})}}async function ht(t,e,r,n,o){let{protected:i,header:a,payload:s}=t,y=o??Er(i);if(!he(y,a))throw new l("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let c={...y,...a},d=je(y,ne(l,Ne,e[1],y,c)),{alg:f}=c;if(typeof f!="string"||!f)throw new l('JWS "alg" (Algorithm) Header Parameter missing or invalid');if(e[0]&&!e[0].has(f))throw new ce('"alg" (Algorithm) Header Parameter value not allowed');if(d){if(typeof s!="string")throw new l("JWS Payload must be a string")}else if(typeof s!="string"&&!(s instanceof Uint8Array))throw new l("JWS Payload must be a string or an Uint8Array instance");let m=d||typeof s!="string"?s:n(s),w=!1;typeof r=="function"&&(r=await r(y,t),w=!0);let h=qe(f),J=B(i!==void 0?R(i):new Uint8Array,R("."),typeof m=="string"?e[2]??(e[2]=It(m,"payload",l)):m),C=N(t.signature,"signature",l),g=await F(h,r,"verify"),v=await q(g,h.subtle,"verify");h.minRsaBits&&Be(h.alg,v);let S=!1;try{S=await crypto.subtle.verify(h.signing,v,C,J)}catch(x){throw new te(void 0,{cause:x})}if(!S)throw new te;let T={payload:typeof m=="string"?N(m,"payload",l):m};return i!==void 0&&(T.protectedHeader=y),a!==void 0&&(T.unprotectedHeader=a),w?[{...T,key:g},d]:[T,d]}async function Yt(t,e,r){if(t instanceof Uint8Array&&(t=Ue.decode(t)),typeof t!="string")throw new l("Compact JWS must be a string or Uint8Array");let{0:n,1:o,2:i,length:a}=t.split(".");if(a!==3)throw new l("Invalid Compact JWS");return ht({payload:o,protected:n,signature:i},e,r,Gn)}async function zn(t,e,r){let[n]=await Yt(t,be(r),e);return n}async function Fn(t,e,r){if(!b(t))throw new l("Flattened JWS must be an object");let n=Xt(t),[o]=await ht(n,be(r),e,qt);return o}function Xn(t,e){try{let r=Xt(t,[e]),n=Er(r.protected),{b64:o,crit:i}=n;return[r,n,Array.isArray(i)&&i.includes("b64")?typeof o=="boolean"?o?1:2:0:1]}catch{return}}async function qn(t,e,r){if(!b(t))throw new l("General JWS must be an object");let{signatures:n,payload:o}=t;if(!Array.isArray(n))throw new l("JWS Signatures missing or incorrect type");let i=Array.from(n);if(!i.every(b))throw new l("JWS Signatures missing or incorrect type");if(o===void 0)throw new te;let a=be(r),s=o instanceof Uint8Array?new Uint8Array(o):o,y=i.map(d=>Xn(d,s)).filter(d=>d!==void 0),c=0;for(let[,,d]of y)if(c|=d,c===3)throw new l("inconsistent use of JWS Unencoded Payload (RFC7797)");for(let d of y)try{let[f]=await ht(d[0],a,e,qt,d[1]);return f}catch{}throw new te}var wt=t=>Math.floor(t.getTime()/1e3),Yn={s:1,m:60,h:3600,d:86400,w:604800,y:31557600},Zn=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,Ye="check_failed";function br(){throw new TypeError("Invalid time period format")}function Zt(t){typeof t!="string"&&br();let e=Zn.exec(t);(!e||e[4]&&e[1])&&br();let r=parseFloat(e[2]),n=Math.round(r*Yn[e[3][0].toLowerCase()]);return Number.isFinite(n)||br(),e[1]==="-"||e[4]==="ago"?-n:n}function Ze(t,e){if(!Number.isFinite(e))throw new TypeError(`Invalid ${t} input`);return e}function vr(t,e){if(typeof e!="string")throw new TypeError(`"${t}" claim must be a string`)}function Qn(t){if(typeof t!="string"&&(!Array.isArray(t)||Array.from(t).some(e=>typeof e!="string")))throw new TypeError('"aud" claim must be a string or an array of strings')}function Sr(t,e){return typeof t=="number"?Ze(e,t):t instanceof Date?Ze(e,wt(t)):wt(new Date)+Zt(t)}var dn=t=>{let e=t.toLowerCase();return t.includes("/")?e:`application/${e}`},eo=(t,e)=>typeof t=="string"?e.includes(t):Array.isArray(t)?e.some(r=>t.includes(r)):!1;function Ar(t,e,r=!1){let n=t[e];if(!(n===void 0&&!r)){if(typeof n!="number")throw new V(`"${e}" claim must be a number`,t,e,"invalid");return n}}function Jr(t,e){throw new V(`unexpected "${e}" claim value`,t,e,Ye)}function Qe(t,e,r={}){let n;try{n=JSON.parse(_e.decode(e))}catch(v){throw new I("JWT Claims Set must be a top-level JSON object",{cause:v})}if(!b(n))throw new I("JWT Claims Set must be a top-level JSON object");let{typ:o}=r;if(o!==void 0&&(typeof t.typ!="string"||dn(t.typ)!==dn(o)))throw new V('unexpected "typ" JWT header value',n,"typ",Ye);let{requiredClaims:i=[],issuer:a,subject:s,audience:y,maxTokenAge:c}=r,d=[...i];c!==void 0&&d.push("iat"),y!==void 0&&d.push("aud"),s!==void 0&&d.push("sub"),a!==void 0&&d.push("iss");for(let v of new Set(d.reverse()))if(!Object.hasOwn(n,v))throw new V(`missing required "${v}" claim`,n,v,"missing");a!==void 0&&!(Array.isArray(a)?a:[a]).includes(n.iss)&&Jr(n,"iss"),s!==void 0&&n.sub!==s&&Jr(n,"sub"),y!==void 0&&!eo(n.aud,typeof y=="string"?[y]:y)&&Jr(n,"aud");let{clockTolerance:f}=r,m=0;if(typeof f=="string")m=Zt(f);else if(f!==void 0){if(typeof f!="number")throw new TypeError("Invalid clockTolerance option type");m=f}if(Ze("clockTolerance option",m),m<0)throw new TypeError("Invalid clockTolerance option input");let{currentDate:w}=r,h=Ze("currentDate option",wt(w===void 0?new Date:w)),J=Ar(n,"iat",c!==void 0),C=Ar(n,"nbf");if(C!==void 0&&C>h+m)throw new V('"nbf" claim timestamp check failed',n,"nbf",Ye);let g=Ar(n,"exp");if(g!==void 0&&g<=h-m)throw new Ke('"exp" claim timestamp check failed',n,"exp",Ye);if(c!==void 0){let v=h-J,S=Ze("maxTokenAge option",typeof c=="number"?c:Zt(c));if(S<0)throw new TypeError("Invalid maxTokenAge option input");if(v-m>S)throw new Ke('"iat" claim timestamp check failed (too far in the past)',n,"iat",Ye);if(v<-m)throw new V('"iat" claim timestamp check failed (it should be in the past)',n,"iat",Ye)}return n}var un;function de(t){return un.get(t)}function et(t){let e=de(t);for(let r of["iat","nbf","exp"]){let n=e[r];if(typeof n=="number"&&!Number.isFinite(n))throw new TypeError(`"${r}" claim must be a finite number`)}return se.encode(JSON.stringify(e))}function Qt(t,e){return de(t)[e]}var ve=class{constructor(e={}){if(!b(e))throw new TypeError("JWT Claims Set MUST be an object");(un||(un=new WeakMap)).set(this,structuredClone(e))}setIssuer(e){return vr("iss",e),de(this).iss=e,this}setSubject(e){return vr("sub",e),de(this).sub=e,this}setAudience(e){return Qn(e),de(this).aud=e,this}setJti(e){return vr("jti",e),de(this).jti=e,this}setNotBefore(e){return de(this).nbf=Sr(e,"setNotBefore"),this}setExpirationTime(e){return de(this).exp=Sr(e,"setExpirationTime"),this}setIssuedAt(e){let r=de(this);return e===void 0?r.iat=wt(new Date):typeof e=="string"?r.iat=Ze("setIssuedAt",wt(new Date)+Zt(e)):r.iat=Sr(e,"setIssuedAt"),this}};async function to(t,e,r){let[n,o]=await Yt(t,be(r),e);if(!o)throw new I("JWTs MUST NOT use unencoded payload");let i=Qe(n.protectedHeader,n.payload,r);return{...n,payload:i}}async function ro(t,e,r){let{plaintext:n,...o}=await Gt(t,Ee(r),e),{protectedHeader:i}=o,a=Qe(i,n,r);for(let s of["iss","sub","aud"])if(i[s]!==void 0&&(s==="aud"?JSON.stringify(i.aud)!==JSON.stringify(a.aud):i[s]!==a[s]))throw new V(`replicated "${s}" claim header parameter mismatch`,a,s,"mismatch");return{payload:a,...o}}var G,Kr=class{constructor(e){P(this,G);O(e,"plaintext"),k(this,G,[e])}setContentEncryptionKey(e){return K(u(this,G)[5],"setContentEncryptionKey"),u(this,G)[5]=e,this}setInitializationVector(e){return K(u(this,G)[6],"setInitializationVector"),u(this,G)[6]=e,this}setProtectedHeader(e){return K(u(this,G)[1],"setProtectedHeader"),u(this,G)[1]=e,this}setKeyManagementParameters(e){return K(u(this,G)[7],"setKeyManagementParameters"),u(this,G)[7]=e,this}async encrypt(e,r){return Ft(await Ve([...u(this,G)],e,r))}};G=new WeakMap;var _,Cr=class{constructor(e){P(this,_);O(e,"plaintext"),k(this,_,[e])}setKeyManagementParameters(e){return K(u(this,_)[7],"setKeyManagementParameters"),u(this,_)[7]=e,this}setProtectedHeader(e){return K(u(this,_)[1],"setProtectedHeader"),u(this,_)[1]=e,this}setSharedUnprotectedHeader(e){return K(u(this,_)[3],"setSharedUnprotectedHeader"),u(this,_)[3]=e,this}setUnprotectedHeader(e){return K(u(this,_)[2],"setUnprotectedHeader"),u(this,_)[2]=e,this}setAdditionalAuthenticatedData(e){return u(this,_)[4]=e,this}setContentEncryptionKey(e){return K(u(this,_)[5],"setContentEncryptionKey"),u(this,_)[5]=e,this}setInitializationVector(e){return K(u(this,_)[6],"setInitializationVector"),u(this,_)[6]=e,this}async encrypt(e,r){return Ve([...u(this,_)],e,r)}};_=new WeakMap;async function gt(t,e,r){let[n,o,i,a]=t,s="";if(o!==void 0){let g=We(l,o);o=g[0],s=W(g[1])}if(i!==void 0&&(i=We(l,i)[0]),!o&&!i)throw new l("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!he(o,i))throw new l("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let y={...o,...i};kt(l,o);let c=je(o,ne(l,Ne,a,o,y));c||r?.();let{alg:d}=y;if(typeof d!="string"||!d)throw new l('JWS "alg" (Algorithm) Header Parameter missing or invalid');let f=qe(d),m="",w=n,h;if(c){let g=t[4];g?(m=g[0]??(g[0]=W(n)),w=g[1]??(g[1]=R(m))):(m=W(n),h=se.encode(`${s}.${m}`))}h??(h=B(R(s),R("."),w));let J=await q(await F(f,e,"sign"),f.subtle,"sign");f.minRsaBits&&Be(f.alg,J);let C={signature:W(new Uint8Array(await crypto.subtle.sign(f.signing,J,h))),payload:m};return o&&(C.protected=s),i&&(C.header=i),[C,c]}async function er(t,e,r,n,o){let[i]=await gt([t,e,void 0,r],n,o);return`${i.protected}.${i.payload}.${i.signature}`}var Et,tt,Wr=class{constructor(e){P(this,Et);P(this,tt);O(e,"payload"),k(this,Et,e)}setProtectedHeader(e){return K(u(this,tt),"setProtectedHeader"),k(this,tt,e),this}async sign(e,r){return er(u(this,Et),u(this,tt),r?.crit,e,()=>{throw new TypeError("use the flattened module for creating JWS with b64: false")})}};Et=new WeakMap,tt=new WeakMap;var ue,Pr=class{constructor(e){P(this,ue);O(e,"payload"),k(this,ue,[e])}setProtectedHeader(e){return K(u(this,ue)[1],"setProtectedHeader"),u(this,ue)[1]=e,this}setUnprotectedHeader(e){return K(u(this,ue)[2],"setUnprotectedHeader"),u(this,ue)[2]=e,this}async sign(e,r){let n=[...u(this,ue)];n[3]=r?.crit;let[o]=await gt(n,e);return o}};ue=new WeakMap;var xe,Ir=class{constructor(e,r,n){P(this,xe);E(this,"state");k(this,xe,e),this.state=[void 0,void 0,r,n?.crit]}setProtectedHeader(e){return K(this.state[0],"setProtectedHeader"),this.state[0]=e,this}setUnprotectedHeader(e){return K(this.state[1],"setUnprotectedHeader"),this.state[1]=e,this}addSignature(...e){return u(this,xe).addSignature(...e)}sign(...e){return u(this,xe).sign(...e)}done(){return u(this,xe)}};xe=new WeakMap;var rt,nt,Tr=class{constructor(e){P(this,rt);P(this,nt,[]);k(this,rt,e)}addSignature(e,r){let n=new Ir(this,e,r);return u(this,nt).push(n),n}async sign(){if(!u(this,nt).length)throw new l("at least one signature must be added");O(u(this,rt),"payload");let e={signatures:[],payload:""},r=[],n;for(let o of u(this,nt)){let[i,a,s,y]=o.state,[{payload:c,...d},f]=await gt([u(this,rt),i,a,y,r],s);if(n===void 0)n=f,e.payload=c;else if(n!==f)throw new l("inconsistent use of JWS Unencoded Payload (RFC7797)");e.signatures.push(d)}return e}};rt=new WeakMap,nt=new WeakMap;var no=ve,ot,kr=class extends no{constructor(){super(...arguments);P(this,ot)}setProtectedHeader(r){return K(u(this,ot),"setProtectedHeader"),k(this,ot,r),this}async sign(r,n){return er(et(this),u(this,ot),n?.crit,r,()=>{throw new I("JWTs MUST NOT use unencoded payload")})}};ot=new WeakMap;var oo=ve,M,it,at,st,xr=class extends oo{constructor(){super(...arguments);P(this,M,[void 0]);P(this,it);P(this,at);P(this,st)}setProtectedHeader(r){return K(u(this,M)[1],"setProtectedHeader"),u(this,M)[1]=r,this}setKeyManagementParameters(r){return K(u(this,M)[7],"setKeyManagementParameters"),u(this,M)[7]=r,this}setContentEncryptionKey(r){return K(u(this,M)[5],"setContentEncryptionKey"),u(this,M)[5]=r,this}setInitializationVector(r){return K(u(this,M)[6],"setInitializationVector"),u(this,M)[6]=r,this}replicateIssuerAsHeader(){return k(this,it,!0),this}replicateSubjectAsHeader(){return k(this,at,!0),this}replicateAudienceAsHeader(){return k(this,st,!0),this}async encrypt(r,n){let o=et(this);u(this,M)[1]&&(u(this,it)||u(this,at)||u(this,st))&&(u(this,M)[1]={...u(this,M)[1],iss:u(this,it)?Qt(this,"iss"):void 0,sub:u(this,at)?Qt(this,"sub"):void 0,aud:u(this,st)?Qt(this,"aud"):void 0});let i=[...u(this,M)];return i[0]=o,Ft(await Ve(i,r,n))}};M=new WeakMap,it=new WeakMap,at=new WeakMap,st=new WeakMap;var Se='"alg" (Algorithm)';function He(t='JWK "alg" (Algorithm) Parameter'){throw new A(`Invalid or unsupported ${t} value`)}function Oe(t,e){return(typeof t=="string"?lt[t]??pe[t]:void 0)??He(e)}var io=(t,e)=>{let r=(t.match(/.{1,64}/g)||[]).join(`
2
+ `);return`-----BEGIN ${e}-----
3
+ ${r}
4
+ -----END ${e}-----`},mn=async(t,e,r)=>{if(pt(r)){if(r.type!==t)throw new TypeError(`key is not a ${t} key`);return r.export({format:"pem",type:e})}if(!oe(r))throw new TypeError(X(r,"CryptoKey","KeyObject"));if(!r.extractable)throw new TypeError("CryptoKey is not extractable");if(r.type!==t)throw new TypeError(`key is not a ${t} key`);return io(Kt(new Uint8Array(await crypto.subtle.exportKey(e,r))),`${t.toUpperCase()} KEY`)},fn=t=>mn("public","spki",t),ln=t=>mn("private","pkcs8",t),bt=(t,e)=>{if(t.byteLength!==e.length)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0},hn=t=>({data:t,pos:0}),Hr=t=>{let e=t.data[t.pos++];if(e===void 0)throw new Error("Unexpected end of ASN.1 input");return e},ye=t=>{let e=Hr(t);if(e&128){let r=e&127,n=0;for(let o=0;o<r;o++)n=n<<8|Hr(t);return n}return e},yn=(t,e=1)=>{for(;e-- >0;){t.pos++;let r=ye(t);t.pos+=r}},Ae=(t,e,r)=>{if(Hr(t)!==e)throw new Error(r)},wn=(t,e)=>{if(e<0||t.pos+e>t.data.length)throw new Error("Unexpected end of ASN.1 input");let r=t.data.subarray(t.pos,t.pos+e);return t.pos+=e,r},ao=t=>{Ae(t,6,"Expected algorithm OID");let e=ye(t);return wn(t,e)};function so(t,e){if(Ae(t,48,`Invalid ${e==="spki"?"SPKI":"PKCS#8"} structure`),ye(t),e==="pkcs8"){Ae(t,2,"Expected version field");let r=ye(t);t.pos+=r}Ae(t,48,"Expected algorithm identifier"),ye(t)}var co=t=>{let e=ao(t);if(bt(e,[43,101,110]))return"X25519";if(!bt(e,[42,134,72,206,61,2,1]))throw new Error("Unsupported key algorithm");Ae(t,6,"Expected curve OID");let r=ye(t),n=wn(t,r);if(bt(n,[42,134,72,206,61,3,1,7]))return"P-256";if(bt(n,[43,129,4,0,34]))return"P-384";if(bt(n,[43,129,4,0,35]))return"P-521";throw new Error("Unsupported named curve")},Or=async(t,e,r,n)=>{let o=ge(n?.extractable),i=Oe(r,Se);i.secret&&He(Se);let a=t==="spki",s;if(i.resolve)try{let y=hn(e);so(y,t),s=i.resolve({crv:co(y)})}catch(y){throw new A("Invalid or unsupported key format",{cause:y})}else s=i.subtle;return crypto.subtle.importKey(t,e,s,o??a,i.usages[a?0:1])},Ur=(t,e)=>Ct(t.replace(e,"")),gn=(t,e,r)=>{let n=Ur(t,/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g);return Or("pkcs8",n,e,r)},En=(t,e,r)=>{let n=Ur(t,/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g);return Or("spki",n,e,r)};function po(t){let e=hn(t);Ae(e,48,"Invalid certificate structure");let r=ye(e);if(r<0||e.pos+r>e.data.length)throw new Error("Unexpected end of ASN.1 input");Ae(e,48,"Invalid tbsCertificate structure"),ye(e),t[e.pos]===160?yn(e,6):yn(e,5);let n=e.pos;Ae(e,48,"Invalid SPKI structure");let o=ye(e);return t.subarray(n,n+o+(e.pos-n))}var bn=(t,e,r)=>{let n;try{let o=Ur(t,/(?:-----(?:BEGIN|END) CERTIFICATE-----|\s)/g);n=po(o)}catch(o){throw new TypeError("Failed to parse the X.509 certificate",{cause:o})}return Or("spki",n,e,r)};function uo(t){return fn(t)}function yo(t){return ln(t)}async function _r(t){if(pt(t))if(t.type==="secret")t=t.export();else return t.export({format:"jwk"});if(t instanceof Uint8Array)return{kty:"oct",k:W(t)};if(!oe(t))throw new TypeError(X(t,"CryptoKey","KeyObject","Uint8Array"));if(!t.extractable)throw new TypeError("non-extractable CryptoKey cannot be exported as a JWK");let e=await crypto.subtle.exportKey("jwk",t);delete e.ext,delete e.key_ops,delete e.use,e.kty!=="AKP"&&delete e.alg;for(let r of Object.keys(e))e[r]===void 0&&delete e[r];return e}var me=(t,e)=>{if(typeof t!="string"||!t)throw new Ce(`${e} missing or invalid`)};async function vn(t,e){let r;if(b(t)){if(r=Me(t),typeof r.kty!="string")throw new TypeError(X(t,"CryptoKey","KeyObject","JSON Web Key"))}else if(ar(t))r=Me(await _r(t));else throw new TypeError(X(t,"CryptoKey","KeyObject","JSON Web Key"));if(e??(e="sha256"),e!=="sha256"&&e!=="sha384"&&e!=="sha512")throw new TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"');let n;switch(r.kty){case"AKP":me(r.alg,'"alg" (Algorithm) Parameter'),me(r.pub,'"pub" (Public key) Parameter'),n={alg:r.alg,kty:r.kty,pub:r.pub};break;case"EC":me(r.crv,'"crv" (Curve) Parameter'),me(r.x,'"x" (X Coordinate) Parameter'),me(r.y,'"y" (Y Coordinate) Parameter'),n={crv:r.crv,kty:r.kty,x:r.x,y:r.y};break;case"OKP":me(r.crv,'"crv" (Subtype of Key Pair) Parameter'),me(r.x,'"x" (Public Key) Parameter'),n={crv:r.crv,kty:r.kty,x:r.x};break;case"RSA":me(r.e,'"e" (Exponent) Parameter'),me(r.n,'"n" (Modulus) Parameter'),n={e:r.e,kty:r.kty,n:r.n};break;case"oct":if(typeof r.k!="string")throw new Ce('"k" (Key Value) Parameter missing or invalid');n={k:r.k,kty:r.kty};break;default:throw new A('"kty" (Key Type) Parameter missing or unsupported')}let o=R(JSON.stringify(n));return W(await Wt(e,o))}async function mo(t,e){e??(e="sha256");let r=await vn(t,e);return`urn:ietf:params:oauth:jwk-thumbprint:sha-${e.slice(-3)}:${r}`}async function fo(t,e){let r={...t,...e?.header};if(!b(r.jwk))throw new l('"jwk" (JSON Web Key) Header Parameter must be a JSON object');let n;try{n=dt(r.jwk)}catch(a){throw new l("Invalid Embedded JWK",{cause:a})}let o=qe(r.alg);if(n.use!==void 0&&n.use!=="sig")throw new l('Invalid Embedded JWK, its "use" must be "sig" when present');if(n.alg!==void 0&&n.alg!==o.alg)throw new l(`Invalid Embedded JWK, its "alg" must be "${o.alg}" when present`);let i=await ie(o,n,!0);if(i.type!=="public")throw new l('"jwk" (JSON Web Key) Header Parameter must be a public key');return i}function lo(t,e,r,n){let{kty:o,key_ops:i,ext:a,kid:s,alg:y,use:c,crv:d}=t;return(a===void 0||typeof a=="boolean")&&(i===void 0||Array.isArray(i)&&i.every((f,m)=>typeof f=="string"&&i.indexOf(f)===m)&&i.includes("verify"))&&e.kty.includes(o)&&(n===void 0||typeof n=="string"&&n===s)&&(y===void 0?o!=="AKP":r===y)&&(c===void 0||c==="sig")&&(!e.crv||d===e.crv)}async function Sn(t,e,r){let n=t.get(e)||t.set(e,{}).get(e),{alg:o}=r;if(n[o]===void 0){let i=ie(r,e,!0).then(a=>{if(a.type!=="public")throw new fe("JSON Web Key Set members must be public keys");return n[o]=a,a}).catch(a=>{throw n[o]===i&&delete n[o],a});n[o]=i}return n[o]}function tr(t){let e;try{e=structuredClone(t)}catch(o){throw new fe("JSON Web Key Set malformed",{cause:o})}if(!Pt(e))throw new fe("JSON Web Key Set malformed");let r=e.keys.map(o=>{let i=Me(o);return Array.isArray(i.key_ops)&&(i.key_ops=[...i.key_ops]),i}),n=new WeakMap;return Object.defineProperty(async(o,i)=>{let{alg:a,kid:s}={...o,...i?.header},y=typeof a=="string"?lt[a]:void 0;if(!y||y.secret)throw new A('Unsupported "alg" value for a JSON Web Key Set');let c=e.keys.filter((m,w)=>lo(r[w],y,a,s)),{0:d,length:f}=c;if(!f)throw new le;if(f!==1){let m=new Re;throw m[Symbol.asyncIterator]=async function*(){for(let w of c)try{yield await Sn(n,w,y)}catch{}},m}return Sn(n,d,y)},"jwks",{value:()=>structuredClone(e)})}function ho(){return typeof WebSocketPair<"u"||typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"||typeof EdgeRuntime<"u"&&EdgeRuntime==="vercel"}var Rr;(typeof navigator>"u"||!navigator.userAgent?.startsWith?.("Mozilla/5.0 "))&&(Rr="jose/v6.2.17");var Jn=Symbol();async function wo(t,e,r,n=fetch){let o=await n(t,{method:"GET",signal:r,redirect:"manual",headers:e}).catch(i=>{throw i.name==="TimeoutError"?new De(void 0,{cause:i}):i});if(o.status!==200)throw new H("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await o.json()}catch(i){throw new H("Failed to parse the JSON Web Key Set HTTP response as JSON",{cause:i})}}var Kn=Symbol();function vt(t,e){return Number.isFinite(t)&&Date.now()<t+e}function An(t,e,r){if(Number.isNaN(t))throw new TypeError(`"${r}" option must not be NaN`);if(typeof t=="number"&&t<0)throw new TypeError(`"${r}" option must not be negative`);return typeof t=="number"?t:e}function go(t,e){if(!(t instanceof URL))throw new TypeError("url must be an instance of URL");let r=new URL(t.href).href,n=e??{},o=n.timeoutDuration;if(typeof o=="number"&&(!Number.isInteger(o)||o<0))throw new TypeError('"timeoutDuration" option must be a non-negative integer');let i=typeof o=="number"?o:5e3,a=An(n.cooldownDuration,3e4,"cooldownDuration"),s=An(n.cacheMaxAge,6e5,"cacheMaxAge"),y=new Headers(n.headers);Rr&&!y.has("User-Agent")&&y.set("User-Agent",Rr),y.has("accept")||y.set("accept","application/json, application/jwk-set+json");let c=n[Jn],d=n[Kn],f,m,w=0,h=0,J;if(d&&typeof d=="object"){let{uat:g,jwks:v}=d;vt(g,s)&&Pt(v)&&(f=g,J=tr(v))}let C=async()=>{if(m&&ho()&&(m=void 0),!m){let g=++w,v=m=wo(r,y,AbortSignal.timeout(i),c).then(S=>{let T=tr(S);if(g<=h)return;J=T;let x=Date.now();d&&(d.uat=x,d.jwks=S),f=x,h=g}).finally(()=>{m===v&&(m=void 0)})}await m};return Object.defineProperties(async(g,v)=>{(!J||!vt(f,s))&&await C();try{return await J(g,v)}catch(S){if(S instanceof le&&!vt(f,a))return await C(),J(g,v);throw S}},{coolingDown:{get:()=>vt(f,a),enumerable:!0},fresh:{get:()=>vt(f,s),enumerable:!0},reload:{value:C,enumerable:!0},reloading:{get:()=>!!m,enumerable:!0},jwks:{value:()=>J?.jwks(),enumerable:!0}})}var Eo=ve,Dr=class extends Eo{encode(){let e=W(JSON.stringify({alg:"none"})),r=W(et(this));return`${e}.${r}.`}static decode(e,r){if(typeof e!="string")throw new I("Unsecured JWT must be a string");let{0:n,1:o,2:i,length:a}=e.split(".");if(a!==3||i!=="")throw new I("Invalid Unsecured JWT");let s,y;try{s=we(n,l,"JWS Protected Header is invalid");let c=ne(l,Ne,void 0,s,s);y=je(s,c)}catch(c){throw c instanceof l?new I("Invalid Unsecured JWT",{cause:c}):c}if(s.alg!=="none")throw new I("Invalid Unsecured JWT");if(!y)throw new I("JWTs MUST NOT use unencoded payload");return{payload:Qe(s,N(o,"payload",I),r),header:s}}};async function bo(t,e,r){if(typeof t!="string"||t.indexOf("-----BEGIN PUBLIC KEY-----")!==0)throw new TypeError('"spki" must be SPKI formatted string');return En(t,e,r)}async function vo(t,e,r){if(typeof t!="string"||t.indexOf("-----BEGIN CERTIFICATE-----")!==0)throw new TypeError('"x509" must be X.509 formatted string');return bn(t,e,r)}async function So(t,e,r){if(typeof t!="string"||t.indexOf("-----BEGIN PRIVATE KEY-----")!==0)throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return gn(t,e,r)}async function Ao(t,e,r){if(!b(t))throw new TypeError("JWK must be an object");let n=dt(t),o=ge(r?.extractable),{alg:i}=n;if(e??(e=i),n.kty!=="oct"&&!e)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');switch(n.kty){case"oct":if(typeof n.k!="string")throw new TypeError('missing "k" (Key Value) Parameter value');return re(n.k);case"AKP":{if(typeof i!="string"||!i)throw new TypeError('missing "alg" (Algorithm) Parameter value');if(e!==i)throw new TypeError("JWK alg and alg option value mismatch");return ie(Oe(e),n,o)}case"RSA":case"EC":case"OKP":return ie(Oe(e),n,o);default:throw new A('Unsupported "kty" (Key Type) Parameter value')}}function Jo(t){let e;if(typeof t=="string"){let n=t.split(".");(n.length===3||n.length===5)&&([e]=n)}else if(typeof t=="object"&&t)if("protected"in t)e=t.protected;else throw new TypeError("Token does not contain a Protected Header");let r="Invalid Token or Protected Header formatting";if(typeof e!="string"||!e)throw new TypeError(r);return we(e,TypeError,r)}function Ko(t){if(typeof t!="string")throw new I("JWTs must use Compact JWS serialization, JWT must be a string");let{1:e,length:r}=t.split(".");if(r===5)throw new I("Only JWTs using Compact JWS serialization can be decoded");if(r!==3)throw new I("Invalid JWT");if(!e)throw new I("JWTs must contain a payload");let n;try{n=re(e)}catch(i){throw new I("Failed to base64url decode the payload",{cause:i})}let o;try{o=JSON.parse(_e.decode(n))}catch(i){throw new I("Failed to parse the decoded payload as JSON",{cause:i})}if(!b(o))throw new I("Invalid JWT Claims Set");return o}function Co(t){let e=t?.modulusLength??2048;if(typeof e!="number"||!Number.isInteger(e)||e<2048)throw new A("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");return e}async function Wo(t,e){let r=ge(e?.extractable),n=Oe(t,Se);n.secret&&He(Se);let o;if(n.resolve){let i=e?.crv??"P-256";if(!["P-256","P-384","P-521","X25519"].includes(i))throw new A("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, and X25519");o=n.resolve({crv:i})}else{if(n.crv!==void 0&&e?.crv!==void 0&&e.crv!==n.crv)throw new A(`Invalid or unsupported crv option provided, the only supported value for ${t} is ${n.crv}`);o=n.kty[0]==="RSA"?{...n.subtle,publicExponent:Uint8Array.of(1,0,1),modulusLength:Co(e)}:n.subtle}return crypto.subtle.generateKey(o,r??!1,[...n.usages[1],...n.usages[0]])}async function Po(t,e){let r=ge(e?.extractable),n,o,i;switch(t){case"HS256":case"HS384":case"HS512":n=+t.slice(-3),o={name:"HMAC",hash:`SHA-${n}`,length:n},i=["sign","verify"];break;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return crypto.getRandomValues(new Uint8Array(+t.slice(-3)>>3));case"A128KW":case"A192KW":case"A256KW":n=+t.slice(1,4),o={name:"AES-KW",length:n},i=["wrapKey","unwrapKey"];break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":case"A128GCM":case"A192GCM":case"A256GCM":n=+t.slice(1,4),o={name:"AES-GCM",length:n},i=["encrypt","decrypt"];break;default:He(Se)}return crypto.subtle.generateKey(o,r??!1,i)}var Dc="WebCryptoAPI";export{Kr as CompactEncrypt,Wr as CompactSign,fo as EmbeddedJWK,xr as EncryptJWT,Cr as FlattenedEncrypt,Pr as FlattenedSign,lr as GeneralEncrypt,Tr as GeneralSign,kr as SignJWT,Dr as UnsecuredJWT,or as base64url,vn as calculateJwkThumbprint,mo as calculateJwkThumbprintUri,Ln as compactDecrypt,zn as compactVerify,tr as createLocalJWKSet,go as createRemoteJWKSet,Dc as cryptoRuntime,Jn as customFetch,Ko as decodeJwt,Jo as decodeProtectedHeader,Mr as errors,_r as exportJWK,yo as exportPKCS8,uo as exportSPKI,$n as flattenedDecrypt,Fn as flattenedVerify,Vn as generalDecrypt,qn as generalVerify,Wo as generateKeyPair,Po as generateSecret,Ao as importJWK,So as importPKCS8,bo as importSPKI,vo as importX509,Kn as jwksCache,ro as jwtDecrypt,to as jwtVerify};
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __yukinoCreateRequire } from "node:module";
3
3
  const require = __yukinoCreateRequire(import.meta.url);
4
- import{b as V,d as Qt,e as A,f as St,h as Zt,i as te,k as ee,l as y,p as G,q as M,s as L,x as oe}from"./chunk-WKKH2UE5.js";import{d as Kt,e as B,n as p,q as h}from"./chunk-456FRBGE.js";import{b as a,d as _t}from"./chunk-7MKA3SHV.js";var v,ne=a(()=>{"use strict";(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"})(v||(v={}))});function Xo(){return bt}var $,bt,Z=a(()=>{"use strict";$=class{emit(e){}enabled(){return!1}},bt=new $});function se(t,e,o){return n=>n===t?e:o}var q,F,Lt,re=a(()=>{"use strict";q=Symbol.for("io.opentelemetry.js.api.logs"),F=globalThis;Lt=1});var At,tt,Rt=a(()=>{"use strict";Z();At=class{getLogger(e,o,n){return new $}},tt=new At});var et,ie=a(()=>{"use strict";Z();et=class{constructor(e,o,n,s){this._provider=e,this.name=o,this.version=n,this.options=s}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(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):bt}}});var W,ae=a(()=>{"use strict";Rt();ie();W=class{getLogger(e,o,n){var s;return(s=this._getDelegateLogger(e,o,n))!==null&&s!==void 0?s:new et(this,e,o,n)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:tt}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,o,n){var s;return(s=this._delegate)===null||s===void 0?void 0:s.getLogger(e,o,n)}}});var ot,ce=a(()=>{"use strict";re();Rt();ae();ot=class t{constructor(){this._proxyLoggerProvider=new W}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return F[q]?this.getLoggerProvider():(F[q]=se(Lt,e,tt),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,o;return(o=(e=F[q])===null||e===void 0?void 0:e.call(F,Lt))!==null&&o!==void 0?o:this._proxyLoggerProvider}getLogger(e,o,n){return this.getLoggerProvider().getLogger(e,o,n)}disable(){delete F[q],this._proxyLoggerProvider=new W}}});var Fs,ue=a(()=>{"use strict";ne();Z();ce();Fs=ot.getInstance()});var nt,pe=a(()=>{"use strict";nt=class{_delegate;constructor(e){this._delegate=e}export(e,o){this._delegate.export(e,o)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}setMetrics(e){this._delegate.setMetrics(e)}}});var st,fe=a(()=>{"use strict";(function(t){t.NONE="none",t.GZIP="gzip"})(st||(st={}))});var S,X=a(()=>{"use strict";S=class extends Error{code;name="OTLPExporterError";data;constructor(e,o,n){super(e),this.data=n,this.code=o}}});function Jo(t){if(Number.isFinite(t)&&t>0)return t;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${t}')`)}function rt(t){if(t!=null)return async()=>t}function it(t,e,o){return{timeoutMillis:Jo(t.timeoutMillis??e.timeoutMillis??o.timeoutMillis),concurrencyLimit:t.concurrencyLimit??e.concurrencyLimit??o.concurrencyLimit,compression:t.compression??e.compression??o.compression}}function at(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none"}}var J=a(()=>{"use strict"});function ct(t){return new Ot(t.concurrencyLimit)}var Ot,yt=a(()=>{"use strict";Ot=class{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(e);let o=()=>{let n=this._sendingPromises.indexOf(e);this._sendingPromises.splice(n,1)};e.then(o,o)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}});function jo(t){return Object.prototype.hasOwnProperty.call(t,"partialSuccess")}function le(){return{handleResponse(t){t==null||!jo(t)||t.partialSuccess==null||Object.keys(t.partialSuccess).length===0||p.warn("Received Partial Success response:",JSON.stringify(t.partialSuccess))}}}var de=a(()=>{"use strict";h()});function ut(t,e){return new Pt(t.transport,t.serializer,le(),t.promiseHandler,t.metrics,e.timeout)}var Pt,It=a(()=>{"use strict";G();X();de();h();Pt=class{_metrics;_diagLogger;_transport;_serializer;_responseHandler;_promiseQueue;_timeout;constructor(e,o,n,s,r,i){this._transport=e,this._serializer=o,this._responseHandler=n,this._promiseQueue=s,this._timeout=i,this._diagLogger=p.createComponentLogger({namespace:"OTLPExportDelegate"}),this._metrics=r}export(e,o){if(this._diagLogger.debug("items to be sent",e),this._promiseQueue.hasReachedLimit()){o({code:y.FAILED,error:new Error("Concurrent export limit reached")});return}let n=this._serializer.serializeRequest(e);if(n==null){o({code:y.FAILED,error:new Error("Nothing to send")});return}let s=this._metrics.startExport(e);this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(r=>{if(r.status==="success"){if(s(void 0),r.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(r.data))}catch(i){this._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",i,r.data)}o({code:y.SUCCESS});return}else if(r.status==="failure"&&r.error){s(r.error),o({code:y.FAILED,error:r.error});return}else r.status==="retryable"?(s("export_max_retries"),o({code:y.FAILED,error:r.error??new S("Export failed with retryable status")})):(s("export_failed"),o({code:y.FAILED,error:new S("Export failed with unknown error")}))},r=>{s(r),o({code:y.FAILED,error:r})}))}forceFlush(){return this._promiseQueue.awaitAll()}setMetrics(e){this._metrics=e}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}}});function me(t,e,o,n){return ut({transport:n,serializer:e,promiseHandler:ct(t),metrics:o},{timeout:t.timeoutMillis})}var he=a(()=>{"use strict";yt();It()});var Ct,ge,Te,xe,Ee,_e,Dt=a(()=>{"use strict";Ct="http.response.status_code",ge="otel.component.name",Te="otel.component.type",xe="server.address",Ee="server.port",_e="error.type"});var pt,Mt=a(()=>{"use strict";pt="0.222.0"});var Se,N,Ft=a(()=>{"use strict";h();G();Dt();Mt();Se=new Map,N=class{inflight;exported;duration;standardAttrs;responseAttributesFromError;helper;constructor(e){let{componentType:o,metricsHelper:n,meterProvider:s,url:r,responseAttributesFromError:i}=e;this.responseAttributesFromError=i;let u=s?s.getMeter("@opentelemetry/otlp-exporter",pt):Kt(),c=Se.get(o)??0;if(Se.set(o,c+1),this.standardAttrs={[Te]:o,[ge]:`${o}/${c}`},r){let d=r;r.includes("://")||(d=`http://${r}`);try{let m=new URL(d);this.standardAttrs[xe]=m.hostname;let l;m.port?l=Number(m.port):m.protocol==="http:"?l=80:m.protocol==="https:"&&(l=443),typeof l=="number"&&(this.standardAttrs[Ee]=l)}catch{}}this.helper=n,this.inflight=u.createUpDownCounter(`otel.sdk.exporter.${this.helper.name}.inflight`,{unit:`{${this.helper.name}}`,description:`The number of ${this.helper.name}s which were passed to the exporter, but that have not been exported yet (neither successful, nor failed).`}),this.exported=u.createCounter(`otel.sdk.exporter.${this.helper.name}.exported`,{unit:`{${this.helper.name}}`,description:`The number of ${this.helper.name}s for which the export has finished, either successful or failed.`}),this.duration=u.createHistogram("otel.sdk.exporter.operation.duration",{unit:"s",description:"The duration of exporting a batch of telemetry records.",advice:{explicitBucketBoundaries:[]}})}startExport(e){let o=this.helper.countItems(e),n=St();return this.inflight.add(o,this.standardAttrs),s=>{let r=St();this.inflight.add(-o,this.standardAttrs);let i=s?{...this.standardAttrs,[_e]:s instanceof Error?s.name:"export_failed"}:this.standardAttrs;this.exported.add(o,i);let u={...i,...this.responseAttributesFromError(s)},c=ee(Zt(n,r))/1e3;this.duration.record(c,u)}}}});var Yo={};_t(Yo,{CompressionAlgorithm:()=>st,ExporterMetrics:()=>N,OTLPExporterBase:()=>nt,OTLPExporterError:()=>S,createOtlpNetworkExportDelegate:()=>me,getSharedConfigurationDefaults:()=>at,mergeOtlpSharedConfigurationWithDefaults:()=>it});var Ko=a(()=>{"use strict";pe();X();J();fe();he();Ft()});var be,Le=a(()=>{"use strict";be={name:"metric_data_point",countItems:t=>{let e=0;for(let o of t.scopeMetrics)for(let n of o.metrics)e+=n.dataPoints.length;return e}}});var Ae,Re=a(()=>{"use strict";Ae={name:"span",countItems:t=>t.length}});var Oe,ye=a(()=>{"use strict";Oe={name:"log",countItems:t=>t.length}});function R(t){return t<0?10:t<128?1:t<16384?2:t<2097152?3:t<268435456?4:t<34359738368?5:t<4398046511104?6:t<562949953421312?7:t<72057594037927940?8:9}var Nt=a(()=>{"use strict"});var Qo,j,P,ft=a(()=>{"use strict";h();Nt();Qo="ProtobufWriter: estimated size was too small, growing buffer.",j=1,P=class{_buffer;_textEncoder;_dataView;pos=0;constructor(e=65536){this._buffer=new Uint8Array(e),this._textEncoder=new TextEncoder,this._dataView=new DataView(this._buffer.buffer,this._buffer.byteOffset)}_ensureCapacity(e){let o=this.pos+e;if(o<=this._buffer.length)return;p.debug(Qo);let n=this._buffer.length*2;for(;n<o;)n*=2;let s=new Uint8Array(n);s.set(this._buffer),this._buffer=s,this._dataView=new DataView(this._buffer.buffer,this._buffer.byteOffset)}finish(){return this._buffer.subarray(0,this.pos)}startLengthDelimited(){let e=this.pos;return this._ensureCapacity(j),this.pos+=j,e}finishLengthDelimited(e,o){let n=o>>>0,s=R(n);if(s>j){let i=s-j;this._ensureCapacity(i),this._buffer.copyWithin(e+s,e+j,this.pos),this.pos+=i}let r=e;n<128?this._buffer[r]=n:n<16384?(this._buffer[r++]=n&127|128,this._buffer[r]=n>>>7):n<2097152?(this._buffer[r++]=n&127|128,this._buffer[r++]=n>>>7&127|128,this._buffer[r]=n>>>14):n<268435456?(this._buffer[r++]=n&127|128,this._buffer[r++]=n>>>7&127|128,this._buffer[r++]=n>>>14&127|128,this._buffer[r]=n>>>21):(this._buffer[r++]=n&127|128,this._buffer[r++]=n>>>7&127|128,this._buffer[r++]=n>>>14&127|128,this._buffer[r++]=n>>>21&127|128,this._buffer[r]=n>>>28)}writeSint32(e){this.writeVarint((e<<1^e>>31)>>>0)}writeSfixed64(e){let o,n;if(e>=0)o=e>>>0,n=e/4294967296>>>0;else{let s=Math.abs(e);o=s>>>0,n=s/4294967296>>>0,o=~o>>>0,n=~n>>>0,o=o+1>>>0,o===0&&(n=n+1>>>0)}this.writeFixed64(o,n)}writeVarint(e){if(this._ensureCapacity(R(e)),e>=0&&e<=4294967295){let o=e>>>0;for(;o>127;)this._buffer[this.pos++]=o&127|128,o>>>=7;this._buffer[this.pos++]=o}else{let o,n;if(e>=0)o=e>>>0,n=e/4294967296>>>0;else{let s=Math.abs(e);o=s>>>0,n=s/4294967296>>>0,o=~o>>>0,n=~n>>>0,o=o+1>>>0,o===0&&(n=n+1>>>0)}for(;n>0||o>127;)this._buffer[this.pos++]=o&127|128,o=(o>>>7|n<<25)>>>0,n>>>=7;this._buffer[this.pos++]=o&127}}writeFixed32(e){this._ensureCapacity(4);let o=e>>>0;this._buffer[this.pos++]=o&255,this._buffer[this.pos++]=o>>>8&255,this._buffer[this.pos++]=o>>>16&255,this._buffer[this.pos++]=o>>>24&255}writeFixed64(e,o){this._ensureCapacity(8);let n=e>>>0,s=o>>>0;this._buffer[this.pos++]=n&255,this._buffer[this.pos++]=n>>>8&255,this._buffer[this.pos++]=n>>>16&255,this._buffer[this.pos++]=n>>>24&255,this._buffer[this.pos++]=s&255,this._buffer[this.pos++]=s>>>8&255,this._buffer[this.pos++]=s>>>16&255,this._buffer[this.pos++]=s>>>24&255}writeBytes(e){this.writeVarint(e.length),this._ensureCapacity(e.length),this._buffer.set(e,this.pos),this.pos+=e.length}writeTag(e,o){this.writeVarint(e<<3|o)}writeDouble(e){this._ensureCapacity(8),this._dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeString(e){let o=!0,n=e.length;for(let s=0;s<n;s++)if(e.charCodeAt(s)>127){o=!1;break}if(o){this.writeVarint(n),this._ensureCapacity(n);for(let s=0;s<n;s++)this._buffer[this.pos++]=e.charCodeAt(s)}else{let s=this._textEncoder.encode(e);this.writeBytes(s)}}}});function Pe(t){return t>=48&&t<=57?t-48:t>=97&&t<=102?t-87:t-55}function O(t){let e=new Uint8Array(t.length/2),o=0;for(let n=0;n<t.length;n+=2){let s=Pe(t.charCodeAt(n)),r=Pe(t.charCodeAt(n+1));e[o++]=s<<4|r}return e}var Ut=a(()=>{"use strict"});function g(t,e){let o=e[0],n=e[1],s=1e9,r=o&65535,i=o/65536>>>0,u=r*s,c=i*s,d=u>>>0,m=Math.floor(u/4294967296),l=(c&65535)*65536>>>0,f=c/65536>>>0,E=d+l+n,D=E>>>0,_=Math.floor(E/4294967296),Et=m+f+_>>>0;t.writeFixed64(D,Et)}function T(t,e,o){for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let s=e[n];t.writeTag(o,2);let r=t.startLengthDelimited(),i=t.pos;Zo(t,n,s),t.finishLengthDelimited(r,t.pos-i)}}function Zo(t,e,o){t.writeTag(1,2),t.writeString(e),t.writeTag(2,2);let n=t.startLengthDelimited(),s=t.pos;Y(t,o),t.finishLengthDelimited(n,t.pos-s)}function Y(t,e){let o=typeof e;if(o==="string")t.writeTag(1,2),t.writeString(e);else if(o==="boolean")t.writeTag(2,0),t.writeVarint(e?1:0);else if(o==="number"){let n=e;Number.isInteger(n)&&n>=tn&&n<en?(t.writeTag(3,0),t.writeVarint(n)):(t.writeTag(4,1),t.writeDouble(n))}else if(e instanceof Uint8Array)t.writeTag(7,2),t.writeBytes(e);else if(Array.isArray(e)){t.writeTag(5,2);let n=t.startLengthDelimited(),s=t.pos;for(let r of e){t.writeTag(1,2);let i=t.startLengthDelimited(),u=t.pos;Y(t,r),t.finishLengthDelimited(i,t.pos-u)}t.finishLengthDelimited(n,t.pos-s)}else if(o==="object"&&e!=null){t.writeTag(6,2);let n=t.startLengthDelimited(),s=t.pos,r=e;for(let i in r){if(!Object.prototype.hasOwnProperty.call(r,i))continue;let u=r[i];t.writeTag(1,2);let c=t.startLengthDelimited(),d=t.pos;t.writeTag(1,2),t.writeString(i),t.writeTag(2,2);let m=t.startLengthDelimited(),l=t.pos;Y(t,u),t.finishLengthDelimited(m,t.pos-l),t.finishLengthDelimited(c,t.pos-d)}t.finishLengthDelimited(n,t.pos-s)}}function U(t,e,o){t.writeTag(o,2);let n=t.startLengthDelimited(),s=t.pos;t.writeTag(1,2),t.writeString(e.name),e.version&&(t.writeTag(2,2),t.writeString(e.version)),e.attributes&&T(t,e.attributes,3),e.droppedAttributesCount&&(t.writeTag(4,0),t.writeVarint(e.droppedAttributesCount)),t.finishLengthDelimited(n,t.pos-s)}function z(t,e,o){t.writeTag(o,2);let n=t.startLengthDelimited(),s=t.pos;e.attributes&&T(t,e.attributes,1),t.writeTag(2,0),t.writeVarint(0),t.finishLengthDelimited(n,t.pos-s)}var tn,en,lt=a(()=>{"use strict";tn=-(2**63),en=2**63});function on(t){let e=t.length,o=0;for(let n=0;n<e;n++){let s=t.charCodeAt(n);s<128?o+=1:s<2048?o+=2:s<55296||s>=57344?o+=3:(n++,o+=4)}return o}var I,dt=a(()=>{"use strict";Nt();I=class{pos=0;startLengthDelimited(){return this.pos}finishLengthDelimited(e,o){this.pos+=R(o)}writeVarint(e){this.pos+=R(e)}writeSint32(e){this.pos+=R((e<<1^e>>31)>>>0)}writeSfixed64(e){this.pos+=8}writeFixed32(e){this.pos+=4}writeFixed64(e,o){this.pos+=8}writeBytes(e){this.pos+=R(e.length),this.pos+=e.length}writeTag(e,o){this.writeVarint(e<<3|o)}writeDouble(e){this.pos+=8}writeString(e){let o=on(e);this.pos+=R(o),this.pos+=o}}});function nn(t,e){let o=t.startLengthDelimited(),n=t.pos;if(t.writeTag(1,1),g(t,e.hrTime),e.severityNumber!==void 0&&e.severityNumber!==v.UNSPECIFIED&&(t.writeTag(2,0),t.writeVarint(e.severityNumber)),e.severityText&&(t.writeTag(3,2),t.writeString(e.severityText)),e.body!==void 0){t.writeTag(5,2);let s=t.startLengthDelimited(),r=t.pos;Y(t,e.body),t.finishLengthDelimited(s,t.pos-r)}e.attributes&&T(t,e.attributes,6),t.writeTag(7,0),t.writeVarint(e.droppedAttributesCount),e.spanContext?.traceFlags&&(t.writeTag(8,5),t.writeFixed32(e.spanContext.traceFlags)),e.spanContext?.traceId&&(t.writeTag(9,2),t.writeBytes(O(e.spanContext.traceId))),e.spanContext?.spanId&&(t.writeTag(10,2),t.writeBytes(O(e.spanContext.spanId))),t.writeTag(11,1),g(t,e.hrTimeObserved),e.eventName&&(t.writeTag(12,2),t.writeString(e.eventName)),t.finishLengthDelimited(o,t.pos-n)}function sn(t,e,o){let n=t.startLengthDelimited(),s=t.pos;U(t,e,1);for(let r of o)t.writeTag(2,2),nn(t,r);e.schemaUrl&&(t.writeTag(3,2),t.writeString(e.schemaUrl)),t.finishLengthDelimited(n,t.pos-s)}function Ie(t,e,o){let n=t.startLengthDelimited(),s=t.pos;z(t,e,1);for(let r of o.values()){t.writeTag(2,2);let i=r[0].instrumentationScope;sn(t,i,r)}e.schemaUrl&&(t.writeTag(3,2),t.writeString(e.schemaUrl)),t.finishLengthDelimited(n,t.pos-s)}function rn(t){let e=new Map;for(let o of t){let n=o.resource,s=o.instrumentationScope,r=e.get(n);r||(r=new Map,e.set(n,r));let i=r.get(s);i||(i=[],r.set(s,i)),i.push(o)}return e}function Ce(t){let e=rn(t),o=new I;for(let[s,r]of e)o.writeTag(1,2),Ie(o,s,r);let n=new P(o.pos);for(let[s,r]of e)n.writeTag(1,2),Ie(n,s,r);return n.finish()}var De=a(()=>{"use strict";ft();Ut();ue();lt();dt()});var b,mt=a(()=>{"use strict";b=class{pos=0;_buf;_textDecoder;constructor(e){this._buf=e,this._textDecoder=new TextDecoder}isAtEnd(){return this.pos>=this._buf.length}readTag(){let e=this.readVarint();return{fieldNumber:e>>>3,wireType:e&7}}readVarint(){let e=0,o=0,n=!1;for(;this.pos<this._buf.length;){let s=this._buf[this.pos++];if(e+=(s&127)*Math.pow(2,o),o+=7,(s&128)===0){n=!0;break}}if(!n)throw new Error("Truncated buffer: unexpected end of data while reading varint");return e}readBytes(){let e=this.readVarint();if(this.pos+e>this._buf.length)throw new Error(`Truncated buffer: expected ${e} bytes at position ${this.pos}, but only ${this._buf.length-this.pos} available`);let o=this._buf.subarray(this.pos,this.pos+e);return this.pos+=e,o}readString(){return this._textDecoder.decode(this.readBytes())}skip(e){switch(e){case 0:this.readVarint();break;case 1:this.pos+=8;break;case 2:this.readBytes();break;case 5:this.pos+=4;break;default:throw new Error(`Unknown wire type ${e}, cannot safely skip`)}}}});function an(t){let e=new b(t),o={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:s}=e.readTag();switch(n){case 1:s===0?o.rejectedLogRecords=e.readVarint():e.skip(s);break;case 2:s===2?o.errorMessage=e.readString():e.skip(s);break;default:e.skip(s);break}}return o}function Me(t){let e=new b(t),o={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:s}=e.readTag();n===1&&s===2?o.partialSuccess=an(e.readBytes()):e.skip(s)}return o}var Fe=a(()=>{"use strict";mt()});var zt,Ne=a(()=>{"use strict";De();Fe();zt={serializeRequest:t=>Ce(t),deserializeResponse:t=>Me(t)}});var Ue=a(()=>{"use strict";Ne()});function He(t,e,o){let n=t.startLengthDelimited(),s=t.pos;t.writeTag(2,1),g(t,e.startTime),t.writeTag(3,1),g(t,e.endTime),o===B.INT?(t.writeTag(6,1),t.writeSfixed64(e.value)):(t.writeTag(4,1),t.writeDouble(e.value)),e.attributes&&T(t,e.attributes,7),t.finishLengthDelimited(n,t.pos-s)}function cn(t,e){let o=t.startLengthDelimited(),n=t.pos,s=e.value;if(t.writeTag(2,1),g(t,e.startTime),t.writeTag(3,1),g(t,e.endTime),t.writeTag(4,1),t.writeFixed64(s.count>>>0,s.count/4294967296>>>0),s.sum!==void 0&&(t.writeTag(5,1),t.writeDouble(s.sum)),s.buckets.counts.length>0){t.writeTag(6,2);let r=t.startLengthDelimited(),i=t.pos;for(let u of s.buckets.counts)t.writeFixed64(u>>>0,u/4294967296>>>0);t.finishLengthDelimited(r,t.pos-i)}if(s.buckets.boundaries.length>0){t.writeTag(7,2);let r=t.startLengthDelimited(),i=t.pos;for(let u of s.buckets.boundaries)t.writeDouble(u);t.finishLengthDelimited(r,t.pos-i)}e.attributes&&T(t,e.attributes,9),s.min!==void 0&&(t.writeTag(11,1),t.writeDouble(s.min)),s.max!==void 0&&(t.writeTag(12,1),t.writeDouble(s.max)),t.finishLengthDelimited(o,t.pos-n)}function ze(t,e,o){let n=t.startLengthDelimited(),s=t.pos;if(e!==0&&(t.writeTag(1,0),t.writeSint32(e)),o.length>0){t.writeTag(2,2);let r=t.startLengthDelimited(),i=t.pos;for(let u of o)t.writeVarint(u);t.finishLengthDelimited(r,t.pos-i)}t.finishLengthDelimited(n,t.pos-s)}function un(t,e){let o=t.startLengthDelimited(),n=t.pos,s=e.value;e.attributes&&T(t,e.attributes,1),t.writeTag(2,1),g(t,e.startTime),t.writeTag(3,1),g(t,e.endTime),t.writeTag(4,1),t.writeFixed64(s.count>>>0,s.count/4294967296>>>0),s.sum!==void 0&&(t.writeTag(5,1),t.writeDouble(s.sum)),s.scale!==0&&(t.writeTag(6,0),t.writeSint32(s.scale)),t.writeTag(7,1),t.writeFixed64(s.zeroCount>>>0,s.zeroCount/4294967296>>>0),t.writeTag(8,2),ze(t,s.positive.offset,s.positive.bucketCounts),t.writeTag(9,2),ze(t,s.negative.offset,s.negative.bucketCounts),s.min!==void 0&&(t.writeTag(12,1),t.writeDouble(s.min)),s.max!==void 0&&(t.writeTag(13,1),t.writeDouble(s.max)),t.finishLengthDelimited(o,t.pos-n)}function pn(t,e){let o=t.startLengthDelimited(),n=t.pos;switch(t.writeTag(1,2),t.writeString(e.descriptor.name),e.descriptor.description&&(t.writeTag(2,2),t.writeString(e.descriptor.description)),e.descriptor.unit&&(t.writeTag(3,2),t.writeString(e.descriptor.unit)),e.dataPointType){case L.GAUGE:t.writeTag(5,2),fn(t,e);break;case L.SUM:t.writeTag(7,2),ln(t,e);break;case L.HISTOGRAM:t.writeTag(9,2),dn(t,e);break;case L.EXPONENTIAL_HISTOGRAM:t.writeTag(10,2),mn(t,e);break;default:{let s=e}}t.finishLengthDelimited(o,t.pos-n)}function fn(t,e){let o=t.startLengthDelimited(),n=t.pos;for(let s of e.dataPoints)t.writeTag(1,2),He(t,s,e.descriptor.valueType);t.finishLengthDelimited(o,t.pos-n)}function ln(t,e){let o=t.startLengthDelimited(),n=t.pos;for(let r of e.dataPoints)t.writeTag(1,2),He(t,r,e.descriptor.valueType);let s=wt(e.aggregationTemporality);s!==0&&(t.writeTag(2,0),t.writeVarint(s)),e.isMonotonic&&(t.writeTag(3,0),t.writeVarint(1)),t.finishLengthDelimited(o,t.pos-n)}function dn(t,e){let o=t.startLengthDelimited(),n=t.pos;for(let r of e.dataPoints)t.writeTag(1,2),cn(t,r);let s=wt(e.aggregationTemporality);s!==0&&(t.writeTag(2,0),t.writeVarint(s)),t.finishLengthDelimited(o,t.pos-n)}function mn(t,e){let o=t.startLengthDelimited(),n=t.pos;for(let r of e.dataPoints)t.writeTag(1,2),un(t,r);let s=wt(e.aggregationTemporality);s!==0&&(t.writeTag(2,0),t.writeVarint(s)),t.finishLengthDelimited(o,t.pos-n)}function hn(t,e){let o=t.startLengthDelimited(),n=t.pos;U(t,e.scope,1);for(let s of e.metrics)t.writeTag(2,2),pn(t,s);e.scope.schemaUrl&&(t.writeTag(3,2),t.writeString(e.scope.schemaUrl)),t.finishLengthDelimited(o,t.pos-n)}function we(t,e){let o=t.startLengthDelimited(),n=t.pos;z(t,e.resource,1);for(let s of e.scopeMetrics)t.writeTag(2,2),hn(t,s);e.resource.schemaUrl&&(t.writeTag(3,2),t.writeString(e.resource.schemaUrl)),t.finishLengthDelimited(o,t.pos-n)}function wt(t){switch(t){case M.DELTA:return 1;case M.CUMULATIVE:return 2;default:return 0}}function ke(t){let e=new I;e.writeTag(1,2),we(e,t);let o=new P(e.pos);return o.writeTag(1,2),we(o,t),o.finish()}var Be=a(()=>{"use strict";h();oe();lt();dt();ft()});function gn(t){let e=new b(t),o={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:s}=e.readTag();switch(n){case 1:s===0?o.rejectedDataPoints=e.readVarint():e.skip(s);break;case 2:s===2?o.errorMessage=e.readString():e.skip(s);break;default:e.skip(s);break}}return o}function Ve(t){let e=new b(t),o={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:s}=e.readTag();n===1&&s===2?o.partialSuccess=gn(e.readBytes()):e.skip(s)}return o}var Ge=a(()=>{"use strict";mt()});var Ht,ve=a(()=>{"use strict";Be();Ge();Ht={serializeRequest:t=>ke(t),deserializeResponse:t=>Ve(t)}});var $e=a(()=>{"use strict";ve()});function We(t,e){let o=t&255|Tn;return e&&(o|=xn),o}function En(t,e){let o=t.startLengthDelimited(),n=t.pos;e.message&&(t.writeTag(2,2),t.writeString(e.message)),t.writeTag(3,0),t.writeVarint(e.code),t.finishLengthDelimited(o,t.pos-n)}function _n(t,e){let o=t.startLengthDelimited(),n=t.pos;t.writeTag(1,1),g(t,e.time),t.writeTag(2,2),t.writeString(e.name),e.attributes&&T(t,e.attributes,3),t.writeTag(4,0),t.writeVarint(e.droppedAttributesCount||0),t.finishLengthDelimited(o,t.pos-n)}function Sn(t,e){let o=t.startLengthDelimited(),n=t.pos,s=e.context;t.writeTag(1,2),t.writeBytes(O(s.traceId)),t.writeTag(2,2),t.writeBytes(O(s.spanId));let r=s.traceState?.serialize();r&&(t.writeTag(3,2),t.writeString(r)),e.attributes&&T(t,e.attributes,4),t.writeTag(5,0),t.writeVarint(e.droppedAttributesCount||0);let i=We(s.traceFlags,s.isRemote);i&&(t.writeTag(6,5),t.writeFixed32(i)),t.finishLengthDelimited(o,t.pos-n)}function bn(t,e){let o=t.startLengthDelimited(),n=t.pos,s=e.spanContext();t.writeTag(1,2),t.writeBytes(O(s.traceId)),t.writeTag(2,2),t.writeBytes(O(s.spanId));let r=s.traceState?.serialize();r&&(t.writeTag(3,2),t.writeString(r)),e.parentSpanContext?.spanId&&(t.writeTag(4,2),t.writeBytes(O(e.parentSpanContext.spanId))),t.writeTag(5,2),t.writeString(e.name);let i=e.kind==null?0:e.kind+1;i!==0&&(t.writeTag(6,0),t.writeVarint(i)),t.writeTag(7,1),g(t,e.startTime),t.writeTag(8,1),g(t,e.endTime),e.attributes&&T(t,e.attributes,9),t.writeTag(10,0),t.writeVarint(e.droppedAttributesCount);for(let c of e.events)t.writeTag(11,2),_n(t,c);t.writeTag(12,0),t.writeVarint(e.droppedEventsCount);for(let c of e.links)t.writeTag(13,2),Sn(t,c);t.writeTag(14,0),t.writeVarint(e.droppedLinksCount),t.writeTag(15,2),En(t,e.status);let u=We(s.traceFlags,e.parentSpanContext?.isRemote);u&&(t.writeTag(16,5),t.writeFixed32(u)),t.finishLengthDelimited(o,t.pos-n)}function Ln(t,e,o){let n=t.startLengthDelimited(),s=t.pos;U(t,e,1);for(let r of o)t.writeTag(2,2),bn(t,r);e.schemaUrl&&(t.writeTag(3,2),t.writeString(e.schemaUrl)),t.finishLengthDelimited(n,t.pos-s)}function qe(t,e,o){let n=t.startLengthDelimited(),s=t.pos;z(t,e,1);for(let r of o.values()){t.writeTag(2,2);let i=r[0].instrumentationScope;Ln(t,i,r)}e.schemaUrl&&(t.writeTag(3,2),t.writeString(e.schemaUrl)),t.finishLengthDelimited(n,t.pos-s)}function An(t){let e=new Map;for(let o of t){let n=o.resource,s=o.instrumentationScope,r=e.get(n);r||(r=new Map,e.set(n,r));let i=r.get(s);i||(i=[],r.set(s,i)),i.push(o)}return e}function Xe(t){let e=An(t),o=new I;for(let[s,r]of e)o.writeTag(1,2),qe(o,s,r);let n=new P(o.pos);for(let[s,r]of e)n.writeTag(1,2),qe(n,s,r);return n.finish()}var Tn,xn,Je=a(()=>{"use strict";ft();Ut();lt();dt();Tn=256,xn=512});function Rn(t){let e=new b(t),o={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:s}=e.readTag();switch(n){case 1:s===0?o.rejectedSpans=e.readVarint():e.skip(s);break;case 2:s===2?o.errorMessage=e.readString():e.skip(s);break;default:e.skip(s);break}}return o}function je(t){let e=new b(t),o={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:s}=e.readTag();n===1&&s===2?o.partialSuccess=Rn(e.readBytes()):e.skip(s)}return o}var Ye=a(()=>{"use strict";mt()});var kt,Ke=a(()=>{"use strict";Je();Ye();kt={serializeRequest:t=>Xe(t),deserializeResponse:t=>je(t)}});var Qe=a(()=>{"use strict";Ke()});function w(t,e){let o={attributes:x(t.attributes,e),droppedAttributesCount:0},n=t.schemaUrl;return n&&n!==""&&(o.schemaUrl=n),o}function H(t,e){let o={name:t.name,version:t.version};return t.attributes&&Object.keys(t.attributes).length>0&&(o.attributes=x(t.attributes,e),o.droppedAttributesCount=t.droppedAttributesCount??0),o}function x(t,e){return Object.keys(t).map(o=>On(o,t[o],e))}function On(t,e,o){return{key:t,value:K(e,o)}}function K(t,e){let o=typeof t;if(o==="string")return{stringValue:t};if(o==="number")return Number.isInteger(t)?{intValue:t}:{doubleValue:t};if(o==="boolean")return{boolValue:t};if(t instanceof Uint8Array)return{bytesValue:e.encodeUint8Array(t)};if(Array.isArray(t)){let n=new Array(t.length);for(let s=0;s<t.length;s++)n[s]=K(t[s],e);return{arrayValue:{values:n}}}if(o==="object"&&t!=null){let n=Object.keys(t),s=new Array(n.length);for(let r=0;r<n.length;r++)s[r]={key:n[r],value:K(t[n[r]],e)};return{kvlistValue:{values:s}}}return{}}var ht=a(()=>{"use strict"});function Ze(t,e){return{resourceLogs:Pn(t,e)}}function yn(t){let e=new Map;for(let o of t){let{resource:n,instrumentationScope:s}=o,r=e.get(n);r||(r=new Map,e.set(n,r));let i=r.get(s);i||(i=[],r.set(s,i)),i.push(o)}return e}function Pn(t,e){let o=yn(t);return Array.from(o,([n,s])=>{let r=w(n,e);return{resource:r,scopeLogs:Array.from(s,([,i])=>({scope:H(i[0].instrumentationScope,e),logRecords:i.map(u=>In(u,e)),schemaUrl:i[0].instrumentationScope.schemaUrl})),schemaUrl:r.schemaUrl}})}function In(t,e){return{timeUnixNano:e.encodeHrTime(t.hrTime),observedTimeUnixNano:e.encodeHrTime(t.hrTimeObserved),severityNumber:t.severityNumber,severityText:t.severityText,body:K(t.body,e),eventName:t.eventName,attributes:x(t.attributes,e),droppedAttributesCount:t.droppedAttributesCount,flags:t.spanContext?.traceFlags,traceId:e.encodeOptionalSpanContext(t.spanContext?.traceId),spanId:e.encodeOptionalSpanContext(t.spanContext?.spanId)}}var to=a(()=>{"use strict";ht()});function Cn(t){let e=BigInt(1e9);return BigInt(Math.trunc(t[0]))*e+BigInt(Math.trunc(t[1]))}function Dn(t){return Cn(t).toString()}function eo(t){return t}var Mn,k,gt=a(()=>{"use strict";G();Mn=typeof BigInt<"u"?Dn:te;k={encodeHrTime:Mn,encodeSpanContext:eo,encodeOptionalSpanContext:eo,encodeUint8Array:t=>{if(typeof Buffer<"u")return Buffer.from(t).toString("base64");let e=new Array(t.length);for(let o=0;o<t.length;o++)e[o]=String.fromCharCode(t[o]);return btoa(e.join(""))}}});var Bt,oo=a(()=>{"use strict";to();gt();h();Bt={serializeRequest:t=>{let e=Ze(t,k);return new TextEncoder().encode(JSON.stringify(e))},deserializeResponse:t=>{if(t.length===0)return{};let e=new TextDecoder;try{return JSON.parse(e.decode(t))}catch(o){return p.warn(`Failed to parse logs export response: ${o.message}. Returning empty response`),{}}}}});var no=a(()=>{"use strict";oo()});var Q,so=a(()=>{"use strict";(function(t){t[t.AGGREGATION_TEMPORALITY_UNSPECIFIED=0]="AGGREGATION_TEMPORALITY_UNSPECIFIED",t[t.AGGREGATION_TEMPORALITY_DELTA=1]="AGGREGATION_TEMPORALITY_DELTA",t[t.AGGREGATION_TEMPORALITY_CUMULATIVE=2]="AGGREGATION_TEMPORALITY_CUMULATIVE"})(Q||(Q={}))});function Fn(t,e){let o=w(t.resource,e);return{resource:o,schemaUrl:o.schemaUrl,scopeMetrics:Nn(t.scopeMetrics,e)}}function Nn(t,e){return Array.from(t.map(o=>({scope:H(o.scope,e),metrics:o.metrics.map(n=>Un(n,e)),schemaUrl:o.scope.schemaUrl})))}function Un(t,e){let o={name:t.descriptor.name,description:t.descriptor.description,unit:t.descriptor.unit},n=kn(t.aggregationTemporality);switch(t.dataPointType){case L.SUM:o.sum={aggregationTemporality:n,isMonotonic:t.isMonotonic,dataPoints:ro(t,e)};break;case L.GAUGE:o.gauge={dataPoints:ro(t,e)};break;case L.HISTOGRAM:o.histogram={aggregationTemporality:n,dataPoints:wn(t,e)};break;case L.EXPONENTIAL_HISTOGRAM:o.exponentialHistogram={aggregationTemporality:n,dataPoints:Hn(t,e)};break}return o}function zn(t,e,o){let n={attributes:x(t.attributes,o),startTimeUnixNano:o.encodeHrTime(t.startTime),timeUnixNano:o.encodeHrTime(t.endTime)};switch(e){case B.INT:n.asInt=t.value;break;case B.DOUBLE:n.asDouble=t.value;break}return n}function ro(t,e){return t.dataPoints.map(o=>zn(o,t.descriptor.valueType,e))}function wn(t,e){return t.dataPoints.map(o=>{let n=o.value;return{attributes:x(o.attributes,e),bucketCounts:n.buckets.counts,explicitBounds:n.buckets.boundaries,count:n.count,sum:n.sum,min:n.min,max:n.max,startTimeUnixNano:e.encodeHrTime(o.startTime),timeUnixNano:e.encodeHrTime(o.endTime)}})}function Hn(t,e){return t.dataPoints.map(o=>{let n=o.value;return{attributes:x(o.attributes,e),count:n.count,min:n.min,max:n.max,sum:n.sum,positive:{offset:n.positive.offset,bucketCounts:n.positive.bucketCounts},negative:{offset:n.negative.offset,bucketCounts:n.negative.bucketCounts},scale:n.scale,zeroCount:n.zeroCount,startTimeUnixNano:e.encodeHrTime(o.startTime),timeUnixNano:e.encodeHrTime(o.endTime)}})}function kn(t){switch(t){case M.DELTA:return Q.AGGREGATION_TEMPORALITY_DELTA;case M.CUMULATIVE:return Q.AGGREGATION_TEMPORALITY_CUMULATIVE}}function io(t,e){return{resourceMetrics:t.map(o=>Fn(o,e))}}var ao=a(()=>{"use strict";h();oe();so();ht()});var Vt,co=a(()=>{"use strict";ao();gt();h();Vt={serializeRequest:t=>{let e=io([t],k);return new TextEncoder().encode(JSON.stringify(e))},deserializeResponse:t=>{if(t.length===0)return{};let e=new TextDecoder;try{return JSON.parse(e.decode(t))}catch(o){return p.warn(`Failed to parse metrics export response: ${o.message}. Returning empty response`),{}}}}});var uo=a(()=>{"use strict";co()});function po(t,e){let o=t&255|Bn;return e&&(o|=Vn),o}function Gn(t,e){let o=t.spanContext(),n=t.status,s=t.parentSpanContext?.spanId?e.encodeSpanContext(t.parentSpanContext?.spanId):void 0;return{traceId:e.encodeSpanContext(o.traceId),spanId:e.encodeSpanContext(o.spanId),parentSpanId:s,traceState:o.traceState?.serialize(),name:t.name,kind:t.kind==null?0:t.kind+1,startTimeUnixNano:e.encodeHrTime(t.startTime),endTimeUnixNano:e.encodeHrTime(t.endTime),attributes:x(t.attributes,e),droppedAttributesCount:t.droppedAttributesCount,events:t.events.map(r=>$n(r,e)),droppedEventsCount:t.droppedEventsCount,status:{code:n.code,message:n.message},links:t.links.map(r=>vn(r,e)),droppedLinksCount:t.droppedLinksCount,flags:po(o.traceFlags,t.parentSpanContext?.isRemote)}}function vn(t,e){return{attributes:t.attributes?x(t.attributes,e):[],spanId:e.encodeSpanContext(t.context.spanId),traceId:e.encodeSpanContext(t.context.traceId),traceState:t.context.traceState?.serialize(),droppedAttributesCount:t.droppedAttributesCount||0,flags:po(t.context.traceFlags,t.context.isRemote)}}function $n(t,e){return{attributes:t.attributes?x(t.attributes,e):[],name:t.name,timeUnixNano:e.encodeHrTime(t.time),droppedAttributesCount:t.droppedAttributesCount||0}}function fo(t,e){return{resourceSpans:Wn(t,e)}}function qn(t){let e=new Map;for(let o of t){let n=e.get(o.resource);n||(n=new Map,e.set(o.resource,n));let s=`${o.instrumentationScope.name}@${o.instrumentationScope.version||""}:${o.instrumentationScope.schemaUrl||""}`,r=n.get(s);r||(r=[],n.set(s,r)),r.push(o)}return e}function Wn(t,e){let o=qn(t),n=[],s=o.entries(),r=s.next();for(;!r.done;){let[i,u]=r.value,c=[],d=u.values(),m=d.next();for(;!m.done;){let E=m.value;if(E.length>0){let D=E.map(_=>Gn(_,e));c.push({scope:H(E[0].instrumentationScope,e),spans:D,schemaUrl:E[0].instrumentationScope.schemaUrl})}m=d.next()}let l=w(i,e),f={resource:l,scopeSpans:c,schemaUrl:l.schemaUrl};n.push(f),r=s.next()}return n}var Bn,Vn,lo=a(()=>{"use strict";ht();Bn=256,Vn=512});var Gt,mo=a(()=>{"use strict";lo();gt();h();Gt={serializeRequest:t=>{let e=fo(t,k);return new TextEncoder().encode(JSON.stringify(e))},deserializeResponse:t=>{if(t.length===0)return{};let e=new TextDecoder;try{return JSON.parse(e.decode(t))}catch(o){return p.warn(`Failed to parse trace export response: ${o.message}. Returning empty response`),{}}}}});var ho=a(()=>{"use strict";mo()});var Xn={};_t(Xn,{JsonLogsSerializer:()=>Bt,JsonMetricsSerializer:()=>Vt,JsonTraceSerializer:()=>Gt,LogsExporterMetricsHelper:()=>Oe,MetricsExporterMetricsHelper:()=>be,ProtobufLogsSerializer:()=>zt,ProtobufMetricsSerializer:()=>Ht,ProtobufTraceSerializer:()=>kt,TraceExporterMetricsHelper:()=>Ae});var Jn=a(()=>{"use strict";Le();Re();ye();Ue();$e();Qe();no();uo();ho()});function vt(t){return t===429||t===502||t===503||t===504}function $t(t){if(t==null)return;let e=Number.parseInt(t,10);if(Number.isInteger(e))return e>0?e*1e3:-1;let o=new Date(t).getTime()-Date.now();return o>=0?o:0}var go=a(()=>{"use strict"});import*as Eo from"zlib";import{Readable as jn}from"stream";function _o(t,e,o,n,s,r,i,u){return new Promise(c=>{let d=new URL(e);s?o["User-Agent"]=`${s} ${To}`:o["User-Agent"]=To;let l=t(d,{method:"POST",headers:o,agent:r},f=>{let E=[],D=0;f.on("data",_=>{if(D+=_.length,D>xo){let Et=new Error(`OTLP export response body exceeded size limit of ${xo} bytes`);c({status:"failure",error:Et}),f.destroy();return}E.push(_)}),f.on("end",()=>{if(f.statusCode&&f.statusCode<=299)c({status:"success",data:Buffer.concat(E)});else if(f.statusCode&&vt(f.statusCode))c({status:"retryable",retryInMillis:$t(f.headers["retry-after"])});else{let _=new S(f.statusMessage,f.statusCode,Buffer.concat(E).toString());c({status:"failure",error:_})}}),f.on("error",_=>{f.statusCode&&f.statusCode<=299?c({status:"success"}):f.statusCode&&vt(f.statusCode)?c({status:"retryable",error:_,retryInMillis:$t(f.headers["retry-after"])}):c({status:"failure",error:_})})});l.setTimeout(u,()=>{l.destroy(),c({status:"retryable",error:new Error("Request timed out")})}),l.on("error",f=>{Qn(f)?c({status:"retryable",error:f}):c({status:"failure",error:f})}),Yn(l,n,i,f=>{c({status:"failure",error:f})})})}function Yn(t,e,o,n){let s=Kn(o);e==="gzip"&&(t.setHeader("Content-Encoding","gzip"),s=s.on("error",n).pipe(Eo.createGzip()).on("error",n)),s.pipe(t).on("error",n)}function Kn(t){let e=new jn;return e.push(t),e.push(null),e}function Qn(t){let e=new Set(["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT","EAI_AGAIN","ENOTFOUND","ENETUNREACH","EHOSTUNREACH"]);return"code"in t&&typeof t.code=="string"?e.has(t.code):!1}var To,xo,So=a(()=>{"use strict";go();X();Mt();To=`OTel-OTLP-Exporter-JavaScript/${pt}`,xo=4*1024*1024});async function Zn(t){let e=t==="http:"?import("http"):import("https"),{request:o}=await e;return o}function bo(t){return new qt(t)}var qt,Lo=a(()=>{"use strict";So();qt=class{_utils=null;_parameters;constructor(e){this._parameters=e}async send(e,o){let{agent:n,request:s}=await this._loadUtils(),r=await this._parameters.headers();return _o(s,this._parameters.url,r,this._parameters.compression,this._parameters.userAgent,n,e,o)}shutdown(){}async _loadUtils(){let e=this._utils;if(e===null){let o=new URL(this._parameters.url).protocol,[n,s]=await Promise.all([this._parameters.agentFactory(o),Zn(o)]);e=this._utils={agent:n,request:s}}return e}}});function ns(){return Math.random()*(2*Ao)-Ao}function Ro(t){return new Xt(t.transport)}var Wt,ts,es,os,Ao,Xt,Oo=a(()=>{"use strict";h();Wt=5,ts=1e3,es=5e3,os=1.5,Ao=.2;Xt=class{_transport;constructor(e){this._transport=e}retry(e,o,n){return new Promise((s,r)=>{setTimeout(()=>{this._transport.send(e,o).then(s,r)},n)})}async send(e,o){let n=Wt,s=ts,r=Date.now()+o,i=await this._transport.send(e,o);for(;i.status==="retryable"&&n>0;){n--;let u=Math.max(Math.min(s*(1+ns()),es),0);s=s*os;let c=i.retryInMillis??u,d=r-Date.now();if(c>d)return p.info(`Export retry time ${Math.round(c)}ms exceeds remaining timeout ${Math.round(d)}ms, not retrying further.`),i;p.verbose(`Scheduling export retry in ${Math.round(c)}ms`),i=await this.retry(e,d,c)}return i.status==="success"?p.verbose(`Export succeeded after ${Wt-n} retry attempts.`):i.status==="retryable"?p.info(`Export failed after maximum retry attempts (${Wt}).`):p.info(`Export failed with non-retryable error: ${i.error}`),i}shutdown(){return this._transport.shutdown()}}});function Jt(t,e,o,n){return new N({componentType:t,metricsHelper:e,url:o,meterProvider:n,responseAttributesFromError:s=>s?s instanceof S?{[Ct]:s.code}:{}:{[Ct]:200}})}function yo(t,e,o,n,s){return ut({transport:Ro({transport:bo(t)}),serializer:e,promiseHandler:ct(t),metrics:Jt(o,n,t.url,s)},{timeout:t.timeoutMillis})}var Po=a(()=>{"use strict";It();Lo();yt();Oo();X();Dt();Ft()});function Io(t){let e={};return Object.entries(t??{}).forEach(([o,n])=>{typeof n<"u"?e[o]=String(n):p.warn(`Header "${o}" has invalid value (${n}) and will be ignored`)}),e}var Co=a(()=>{"use strict";h()});function ss(t,e,o){return async()=>{let n={...await o()},s={};return e!=null&&Object.assign(s,await e()),t!=null&&Object.assign(s,Io(await t())),Object.assign(s,n)}}function rs(t){if(t!=null)try{let e=globalThis.location?.href;return new URL(t,e).href}catch{throw new Error(`Configuration: Could not parse user-provided export URL: '${t}'`)}}function Do(t,e,o){return{...it(t,e,o),headers:ss(t.headers,e.headers,o.headers),url:rs(t.url)??e.url??o.url}}function Mo(t,e){return{...at(),headers:async()=>t,url:"http://localhost:4318/"+e}}var Fo=a(()=>{"use strict";J();Co()});function C(t){return async e=>{let o=e==="http:",n=o?import("http"):import("https"),{Agent:s}=await n;if(o){let{ca:r,cert:i,key:u,...c}=t;return new s(c)}return new s(t)}}function No(t,e,o){return{...Do(t,e,o),agentFactory:t.agentFactory??e.agentFactory??o.agentFactory,userAgent:t.userAgent}}function Uo(t,e){return{...Mo(t,e),agentFactory:C({keepAlive:!0})}}var Tt=a(()=>{"use strict";Fo()});function zo(t){let e=Qt(t);if(e!=null){if(Number.isFinite(e)&&e>0)return e;p.warn(`Configuration: ${t} is invalid, expected number greater than 0 (actual: ${e})`)}}function is(t){let e=zo(`OTEL_EXPORTER_OTLP_${t}_TIMEOUT`),o=zo("OTEL_EXPORTER_OTLP_TIMEOUT");return e??o}function wo(t){let e=A(t)?.trim();if(e==null||e==="none"||e==="gzip")return e;p.warn(`Configuration: ${t} is invalid, expected 'none' or 'gzip' (actual: '${e}')`)}function as(t){let e=wo(`OTEL_EXPORTER_OTLP_${t}_COMPRESSION`),o=wo("OTEL_EXPORTER_OTLP_COMPRESSION");return e??o}function xt(t){return{timeoutMillis:is(t),compression:as(t)}}var jt=a(()=>{"use strict";G();h()});var cs={};_t(cs,{convertLegacyHttpOptions:()=>Ho,createOtlpHttpExportDelegate:()=>yo,createOtlpHttpExporterMetrics:()=>Jt,getSharedConfigurationFromEnvironment:()=>xt,httpAgentFactoryFromOptions:()=>C});var Bo=a(()=>{"use strict";Tt();Po();jt();ko()});import*as Vo from"fs";import*as Go from"path";function us(t){let e=A(`OTEL_EXPORTER_OTLP_${t}_HEADERS`),o=A("OTEL_EXPORTER_OTLP_HEADERS"),n=V(e),s=V(o);if(!(Object.keys(n).length===0&&Object.keys(s).length===0))return Object.assign({},V(o),V(e))}function ps(t){try{return new URL(t).toString()}catch{p.warn(`Configuration: Could not parse environment-provided export URL: '${t}', falling back to undefined`);return}}function fs(t,e){try{new URL(t)}catch{p.warn(`Configuration: Could not parse environment-provided export URL: '${t}', falling back to undefined`);return}t.endsWith("/")||(t=t+"/"),t+=e;try{new URL(t)}catch{p.warn(`Configuration: Provided URL appended with '${e}' is not a valid URL, using 'undefined' instead of '${t}'`);return}return t}function ls(t){let e=A("OTEL_EXPORTER_OTLP_ENDPOINT");if(e!==void 0)return fs(e,t)}function ds(t){let e=A(`OTEL_EXPORTER_OTLP_${t}_ENDPOINT`);if(e!==void 0)return ps(e)}function Yt(t,e,o){let n=A(t),s=A(e),r=n??s;if(r!=null)try{return Vo.readFileSync(Go.resolve(process.cwd(),r))}catch{p.warn(o);return}else return}function ms(t){return Yt(`OTEL_EXPORTER_OTLP_${t}_CLIENT_CERTIFICATE`,"OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE","Failed to read client certificate chain file")}function hs(t){return Yt(`OTEL_EXPORTER_OTLP_${t}_CLIENT_KEY`,"OTEL_EXPORTER_OTLP_CLIENT_KEY","Failed to read client certificate private key file")}function gs(t){return Yt(`OTEL_EXPORTER_OTLP_${t}_CERTIFICATE`,"OTEL_EXPORTER_OTLP_CERTIFICATE","Failed to read root certificate file")}function vo(t,e){return{...xt(t),url:ds(t)??ls(e),headers:rt(us(t)),agentFactory:C({keepAlive:!0,ca:gs(t),cert:ms(t),key:hs(t)})}}var $o=a(()=>{"use strict";G();h();jt();J();Tt()});function qo(t){return typeof t.headers=="function"?t.headers:rt(t.headers)}var Wo=a(()=>{"use strict";J()});function Ts(t){if(typeof t.httpAgentOptions=="function")return t.httpAgentOptions;let e=t.httpAgentOptions;if(t.keepAlive!=null&&(e={keepAlive:t.keepAlive,...e}),e!=null)return C(e)}function Ho(t,e,o,n){return t.metadata&&p.warn("Metadata cannot be set when using http"),No({url:t.url,headers:qo(t),concurrencyLimit:t.concurrencyLimit,timeoutMillis:t.timeoutMillis,compression:t.compression,agentFactory:Ts(t),userAgent:t.userAgent},vo(e,o),Uo(n,o))}var ko=a(()=>{"use strict";h();Tt();Bo();$o();Wo()});export{nt as a,st as b,Yo as c,Ko as d,be as e,Ae as f,Oe as g,v as h,Xo as i,ue as j,zt as k,Ht as l,kt as m,Bt as n,Vt as o,Gt as p,Xn as q,Jn as r,Jt as s,yo as t,Ho as u,cs as v,Bo as w};
4
+ import{b as V,d as Qt,e as A,f as St,h as Zt,i as te,k as ee,l as y,p as G,q as M,s as L,x as oe}from"./chunk-FOFOAOHI.js";import{d as Kt,e as B,n as p,q as h}from"./chunk-456FRBGE.js";import{b as a,d as _t}from"./chunk-7MKA3SHV.js";var v,ne=a(()=>{"use strict";(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"})(v||(v={}))});function Xo(){return bt}var $,bt,Z=a(()=>{"use strict";$=class{emit(e){}enabled(){return!1}},bt=new $});function se(t,e,o){return n=>n===t?e:o}var q,F,Lt,re=a(()=>{"use strict";q=Symbol.for("io.opentelemetry.js.api.logs"),F=globalThis;Lt=1});var At,tt,Rt=a(()=>{"use strict";Z();At=class{getLogger(e,o,n){return new $}},tt=new At});var et,ie=a(()=>{"use strict";Z();et=class{constructor(e,o,n,s){this._provider=e,this.name=o,this.version=n,this.options=s}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(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):bt}}});var W,ae=a(()=>{"use strict";Rt();ie();W=class{getLogger(e,o,n){var s;return(s=this._getDelegateLogger(e,o,n))!==null&&s!==void 0?s:new et(this,e,o,n)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:tt}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,o,n){var s;return(s=this._delegate)===null||s===void 0?void 0:s.getLogger(e,o,n)}}});var ot,ce=a(()=>{"use strict";re();Rt();ae();ot=class t{constructor(){this._proxyLoggerProvider=new W}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return F[q]?this.getLoggerProvider():(F[q]=se(Lt,e,tt),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,o;return(o=(e=F[q])===null||e===void 0?void 0:e.call(F,Lt))!==null&&o!==void 0?o:this._proxyLoggerProvider}getLogger(e,o,n){return this.getLoggerProvider().getLogger(e,o,n)}disable(){delete F[q],this._proxyLoggerProvider=new W}}});var Fs,ue=a(()=>{"use strict";ne();Z();ce();Fs=ot.getInstance()});var nt,pe=a(()=>{"use strict";nt=class{_delegate;constructor(e){this._delegate=e}export(e,o){this._delegate.export(e,o)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}setMetrics(e){this._delegate.setMetrics(e)}}});var st,fe=a(()=>{"use strict";(function(t){t.NONE="none",t.GZIP="gzip"})(st||(st={}))});var S,X=a(()=>{"use strict";S=class extends Error{code;name="OTLPExporterError";data;constructor(e,o,n){super(e),this.data=n,this.code=o}}});function Jo(t){if(Number.isFinite(t)&&t>0)return t;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${t}')`)}function rt(t){if(t!=null)return async()=>t}function it(t,e,o){return{timeoutMillis:Jo(t.timeoutMillis??e.timeoutMillis??o.timeoutMillis),concurrencyLimit:t.concurrencyLimit??e.concurrencyLimit??o.concurrencyLimit,compression:t.compression??e.compression??o.compression}}function at(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none"}}var J=a(()=>{"use strict"});function ct(t){return new Ot(t.concurrencyLimit)}var Ot,yt=a(()=>{"use strict";Ot=class{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(e);let o=()=>{let n=this._sendingPromises.indexOf(e);this._sendingPromises.splice(n,1)};e.then(o,o)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}});function jo(t){return Object.prototype.hasOwnProperty.call(t,"partialSuccess")}function le(){return{handleResponse(t){t==null||!jo(t)||t.partialSuccess==null||Object.keys(t.partialSuccess).length===0||p.warn("Received Partial Success response:",JSON.stringify(t.partialSuccess))}}}var de=a(()=>{"use strict";h()});function ut(t,e){return new Pt(t.transport,t.serializer,le(),t.promiseHandler,t.metrics,e.timeout)}var Pt,It=a(()=>{"use strict";G();X();de();h();Pt=class{_metrics;_diagLogger;_transport;_serializer;_responseHandler;_promiseQueue;_timeout;constructor(e,o,n,s,r,i){this._transport=e,this._serializer=o,this._responseHandler=n,this._promiseQueue=s,this._timeout=i,this._diagLogger=p.createComponentLogger({namespace:"OTLPExportDelegate"}),this._metrics=r}export(e,o){if(this._diagLogger.debug("items to be sent",e),this._promiseQueue.hasReachedLimit()){o({code:y.FAILED,error:new Error("Concurrent export limit reached")});return}let n=this._serializer.serializeRequest(e);if(n==null){o({code:y.FAILED,error:new Error("Nothing to send")});return}let s=this._metrics.startExport(e);this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(r=>{if(r.status==="success"){if(s(void 0),r.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(r.data))}catch(i){this._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",i,r.data)}o({code:y.SUCCESS});return}else if(r.status==="failure"&&r.error){s(r.error),o({code:y.FAILED,error:r.error});return}else r.status==="retryable"?(s("export_max_retries"),o({code:y.FAILED,error:r.error??new S("Export failed with retryable status")})):(s("export_failed"),o({code:y.FAILED,error:new S("Export failed with unknown error")}))},r=>{s(r),o({code:y.FAILED,error:r})}))}forceFlush(){return this._promiseQueue.awaitAll()}setMetrics(e){this._metrics=e}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}}});function me(t,e,o,n){return ut({transport:n,serializer:e,promiseHandler:ct(t),metrics:o},{timeout:t.timeoutMillis})}var he=a(()=>{"use strict";yt();It()});var Ct,ge,Te,xe,Ee,_e,Dt=a(()=>{"use strict";Ct="http.response.status_code",ge="otel.component.name",Te="otel.component.type",xe="server.address",Ee="server.port",_e="error.type"});var pt,Mt=a(()=>{"use strict";pt="0.222.0"});var Se,N,Ft=a(()=>{"use strict";h();G();Dt();Mt();Se=new Map,N=class{inflight;exported;duration;standardAttrs;responseAttributesFromError;helper;constructor(e){let{componentType:o,metricsHelper:n,meterProvider:s,url:r,responseAttributesFromError:i}=e;this.responseAttributesFromError=i;let u=s?s.getMeter("@opentelemetry/otlp-exporter",pt):Kt(),c=Se.get(o)??0;if(Se.set(o,c+1),this.standardAttrs={[Te]:o,[ge]:`${o}/${c}`},r){let d=r;r.includes("://")||(d=`http://${r}`);try{let m=new URL(d);this.standardAttrs[xe]=m.hostname;let l;m.port?l=Number(m.port):m.protocol==="http:"?l=80:m.protocol==="https:"&&(l=443),typeof l=="number"&&(this.standardAttrs[Ee]=l)}catch{}}this.helper=n,this.inflight=u.createUpDownCounter(`otel.sdk.exporter.${this.helper.name}.inflight`,{unit:`{${this.helper.name}}`,description:`The number of ${this.helper.name}s which were passed to the exporter, but that have not been exported yet (neither successful, nor failed).`}),this.exported=u.createCounter(`otel.sdk.exporter.${this.helper.name}.exported`,{unit:`{${this.helper.name}}`,description:`The number of ${this.helper.name}s for which the export has finished, either successful or failed.`}),this.duration=u.createHistogram("otel.sdk.exporter.operation.duration",{unit:"s",description:"The duration of exporting a batch of telemetry records.",advice:{explicitBucketBoundaries:[]}})}startExport(e){let o=this.helper.countItems(e),n=St();return this.inflight.add(o,this.standardAttrs),s=>{let r=St();this.inflight.add(-o,this.standardAttrs);let i=s?{...this.standardAttrs,[_e]:s instanceof Error?s.name:"export_failed"}:this.standardAttrs;this.exported.add(o,i);let u={...i,...this.responseAttributesFromError(s)},c=ee(Zt(n,r))/1e3;this.duration.record(c,u)}}}});var Yo={};_t(Yo,{CompressionAlgorithm:()=>st,ExporterMetrics:()=>N,OTLPExporterBase:()=>nt,OTLPExporterError:()=>S,createOtlpNetworkExportDelegate:()=>me,getSharedConfigurationDefaults:()=>at,mergeOtlpSharedConfigurationWithDefaults:()=>it});var Ko=a(()=>{"use strict";pe();X();J();fe();he();Ft()});var be,Le=a(()=>{"use strict";be={name:"metric_data_point",countItems:t=>{let e=0;for(let o of t.scopeMetrics)for(let n of o.metrics)e+=n.dataPoints.length;return e}}});var Ae,Re=a(()=>{"use strict";Ae={name:"span",countItems:t=>t.length}});var Oe,ye=a(()=>{"use strict";Oe={name:"log",countItems:t=>t.length}});function R(t){return t<0?10:t<128?1:t<16384?2:t<2097152?3:t<268435456?4:t<34359738368?5:t<4398046511104?6:t<562949953421312?7:t<72057594037927940?8:9}var Nt=a(()=>{"use strict"});var Qo,j,P,ft=a(()=>{"use strict";h();Nt();Qo="ProtobufWriter: estimated size was too small, growing buffer.",j=1,P=class{_buffer;_textEncoder;_dataView;pos=0;constructor(e=65536){this._buffer=new Uint8Array(e),this._textEncoder=new TextEncoder,this._dataView=new DataView(this._buffer.buffer,this._buffer.byteOffset)}_ensureCapacity(e){let o=this.pos+e;if(o<=this._buffer.length)return;p.debug(Qo);let n=this._buffer.length*2;for(;n<o;)n*=2;let s=new Uint8Array(n);s.set(this._buffer),this._buffer=s,this._dataView=new DataView(this._buffer.buffer,this._buffer.byteOffset)}finish(){return this._buffer.subarray(0,this.pos)}startLengthDelimited(){let e=this.pos;return this._ensureCapacity(j),this.pos+=j,e}finishLengthDelimited(e,o){let n=o>>>0,s=R(n);if(s>j){let i=s-j;this._ensureCapacity(i),this._buffer.copyWithin(e+s,e+j,this.pos),this.pos+=i}let r=e;n<128?this._buffer[r]=n:n<16384?(this._buffer[r++]=n&127|128,this._buffer[r]=n>>>7):n<2097152?(this._buffer[r++]=n&127|128,this._buffer[r++]=n>>>7&127|128,this._buffer[r]=n>>>14):n<268435456?(this._buffer[r++]=n&127|128,this._buffer[r++]=n>>>7&127|128,this._buffer[r++]=n>>>14&127|128,this._buffer[r]=n>>>21):(this._buffer[r++]=n&127|128,this._buffer[r++]=n>>>7&127|128,this._buffer[r++]=n>>>14&127|128,this._buffer[r++]=n>>>21&127|128,this._buffer[r]=n>>>28)}writeSint32(e){this.writeVarint((e<<1^e>>31)>>>0)}writeSfixed64(e){let o,n;if(e>=0)o=e>>>0,n=e/4294967296>>>0;else{let s=Math.abs(e);o=s>>>0,n=s/4294967296>>>0,o=~o>>>0,n=~n>>>0,o=o+1>>>0,o===0&&(n=n+1>>>0)}this.writeFixed64(o,n)}writeVarint(e){if(this._ensureCapacity(R(e)),e>=0&&e<=4294967295){let o=e>>>0;for(;o>127;)this._buffer[this.pos++]=o&127|128,o>>>=7;this._buffer[this.pos++]=o}else{let o,n;if(e>=0)o=e>>>0,n=e/4294967296>>>0;else{let s=Math.abs(e);o=s>>>0,n=s/4294967296>>>0,o=~o>>>0,n=~n>>>0,o=o+1>>>0,o===0&&(n=n+1>>>0)}for(;n>0||o>127;)this._buffer[this.pos++]=o&127|128,o=(o>>>7|n<<25)>>>0,n>>>=7;this._buffer[this.pos++]=o&127}}writeFixed32(e){this._ensureCapacity(4);let o=e>>>0;this._buffer[this.pos++]=o&255,this._buffer[this.pos++]=o>>>8&255,this._buffer[this.pos++]=o>>>16&255,this._buffer[this.pos++]=o>>>24&255}writeFixed64(e,o){this._ensureCapacity(8);let n=e>>>0,s=o>>>0;this._buffer[this.pos++]=n&255,this._buffer[this.pos++]=n>>>8&255,this._buffer[this.pos++]=n>>>16&255,this._buffer[this.pos++]=n>>>24&255,this._buffer[this.pos++]=s&255,this._buffer[this.pos++]=s>>>8&255,this._buffer[this.pos++]=s>>>16&255,this._buffer[this.pos++]=s>>>24&255}writeBytes(e){this.writeVarint(e.length),this._ensureCapacity(e.length),this._buffer.set(e,this.pos),this.pos+=e.length}writeTag(e,o){this.writeVarint(e<<3|o)}writeDouble(e){this._ensureCapacity(8),this._dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeString(e){let o=!0,n=e.length;for(let s=0;s<n;s++)if(e.charCodeAt(s)>127){o=!1;break}if(o){this.writeVarint(n),this._ensureCapacity(n);for(let s=0;s<n;s++)this._buffer[this.pos++]=e.charCodeAt(s)}else{let s=this._textEncoder.encode(e);this.writeBytes(s)}}}});function Pe(t){return t>=48&&t<=57?t-48:t>=97&&t<=102?t-87:t-55}function O(t){let e=new Uint8Array(t.length/2),o=0;for(let n=0;n<t.length;n+=2){let s=Pe(t.charCodeAt(n)),r=Pe(t.charCodeAt(n+1));e[o++]=s<<4|r}return e}var Ut=a(()=>{"use strict"});function g(t,e){let o=e[0],n=e[1],s=1e9,r=o&65535,i=o/65536>>>0,u=r*s,c=i*s,d=u>>>0,m=Math.floor(u/4294967296),l=(c&65535)*65536>>>0,f=c/65536>>>0,E=d+l+n,D=E>>>0,_=Math.floor(E/4294967296),Et=m+f+_>>>0;t.writeFixed64(D,Et)}function T(t,e,o){for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let s=e[n];t.writeTag(o,2);let r=t.startLengthDelimited(),i=t.pos;Zo(t,n,s),t.finishLengthDelimited(r,t.pos-i)}}function Zo(t,e,o){t.writeTag(1,2),t.writeString(e),t.writeTag(2,2);let n=t.startLengthDelimited(),s=t.pos;Y(t,o),t.finishLengthDelimited(n,t.pos-s)}function Y(t,e){let o=typeof e;if(o==="string")t.writeTag(1,2),t.writeString(e);else if(o==="boolean")t.writeTag(2,0),t.writeVarint(e?1:0);else if(o==="number"){let n=e;Number.isInteger(n)&&n>=tn&&n<en?(t.writeTag(3,0),t.writeVarint(n)):(t.writeTag(4,1),t.writeDouble(n))}else if(e instanceof Uint8Array)t.writeTag(7,2),t.writeBytes(e);else if(Array.isArray(e)){t.writeTag(5,2);let n=t.startLengthDelimited(),s=t.pos;for(let r of e){t.writeTag(1,2);let i=t.startLengthDelimited(),u=t.pos;Y(t,r),t.finishLengthDelimited(i,t.pos-u)}t.finishLengthDelimited(n,t.pos-s)}else if(o==="object"&&e!=null){t.writeTag(6,2);let n=t.startLengthDelimited(),s=t.pos,r=e;for(let i in r){if(!Object.prototype.hasOwnProperty.call(r,i))continue;let u=r[i];t.writeTag(1,2);let c=t.startLengthDelimited(),d=t.pos;t.writeTag(1,2),t.writeString(i),t.writeTag(2,2);let m=t.startLengthDelimited(),l=t.pos;Y(t,u),t.finishLengthDelimited(m,t.pos-l),t.finishLengthDelimited(c,t.pos-d)}t.finishLengthDelimited(n,t.pos-s)}}function U(t,e,o){t.writeTag(o,2);let n=t.startLengthDelimited(),s=t.pos;t.writeTag(1,2),t.writeString(e.name),e.version&&(t.writeTag(2,2),t.writeString(e.version)),e.attributes&&T(t,e.attributes,3),e.droppedAttributesCount&&(t.writeTag(4,0),t.writeVarint(e.droppedAttributesCount)),t.finishLengthDelimited(n,t.pos-s)}function z(t,e,o){t.writeTag(o,2);let n=t.startLengthDelimited(),s=t.pos;e.attributes&&T(t,e.attributes,1),t.writeTag(2,0),t.writeVarint(0),t.finishLengthDelimited(n,t.pos-s)}var tn,en,lt=a(()=>{"use strict";tn=-(2**63),en=2**63});function on(t){let e=t.length,o=0;for(let n=0;n<e;n++){let s=t.charCodeAt(n);s<128?o+=1:s<2048?o+=2:s<55296||s>=57344?o+=3:(n++,o+=4)}return o}var I,dt=a(()=>{"use strict";Nt();I=class{pos=0;startLengthDelimited(){return this.pos}finishLengthDelimited(e,o){this.pos+=R(o)}writeVarint(e){this.pos+=R(e)}writeSint32(e){this.pos+=R((e<<1^e>>31)>>>0)}writeSfixed64(e){this.pos+=8}writeFixed32(e){this.pos+=4}writeFixed64(e,o){this.pos+=8}writeBytes(e){this.pos+=R(e.length),this.pos+=e.length}writeTag(e,o){this.writeVarint(e<<3|o)}writeDouble(e){this.pos+=8}writeString(e){let o=on(e);this.pos+=R(o),this.pos+=o}}});function nn(t,e){let o=t.startLengthDelimited(),n=t.pos;if(t.writeTag(1,1),g(t,e.hrTime),e.severityNumber!==void 0&&e.severityNumber!==v.UNSPECIFIED&&(t.writeTag(2,0),t.writeVarint(e.severityNumber)),e.severityText&&(t.writeTag(3,2),t.writeString(e.severityText)),e.body!==void 0){t.writeTag(5,2);let s=t.startLengthDelimited(),r=t.pos;Y(t,e.body),t.finishLengthDelimited(s,t.pos-r)}e.attributes&&T(t,e.attributes,6),t.writeTag(7,0),t.writeVarint(e.droppedAttributesCount),e.spanContext?.traceFlags&&(t.writeTag(8,5),t.writeFixed32(e.spanContext.traceFlags)),e.spanContext?.traceId&&(t.writeTag(9,2),t.writeBytes(O(e.spanContext.traceId))),e.spanContext?.spanId&&(t.writeTag(10,2),t.writeBytes(O(e.spanContext.spanId))),t.writeTag(11,1),g(t,e.hrTimeObserved),e.eventName&&(t.writeTag(12,2),t.writeString(e.eventName)),t.finishLengthDelimited(o,t.pos-n)}function sn(t,e,o){let n=t.startLengthDelimited(),s=t.pos;U(t,e,1);for(let r of o)t.writeTag(2,2),nn(t,r);e.schemaUrl&&(t.writeTag(3,2),t.writeString(e.schemaUrl)),t.finishLengthDelimited(n,t.pos-s)}function Ie(t,e,o){let n=t.startLengthDelimited(),s=t.pos;z(t,e,1);for(let r of o.values()){t.writeTag(2,2);let i=r[0].instrumentationScope;sn(t,i,r)}e.schemaUrl&&(t.writeTag(3,2),t.writeString(e.schemaUrl)),t.finishLengthDelimited(n,t.pos-s)}function rn(t){let e=new Map;for(let o of t){let n=o.resource,s=o.instrumentationScope,r=e.get(n);r||(r=new Map,e.set(n,r));let i=r.get(s);i||(i=[],r.set(s,i)),i.push(o)}return e}function Ce(t){let e=rn(t),o=new I;for(let[s,r]of e)o.writeTag(1,2),Ie(o,s,r);let n=new P(o.pos);for(let[s,r]of e)n.writeTag(1,2),Ie(n,s,r);return n.finish()}var De=a(()=>{"use strict";ft();Ut();ue();lt();dt()});var b,mt=a(()=>{"use strict";b=class{pos=0;_buf;_textDecoder;constructor(e){this._buf=e,this._textDecoder=new TextDecoder}isAtEnd(){return this.pos>=this._buf.length}readTag(){let e=this.readVarint();return{fieldNumber:e>>>3,wireType:e&7}}readVarint(){let e=0,o=0,n=!1;for(;this.pos<this._buf.length;){let s=this._buf[this.pos++];if(e+=(s&127)*Math.pow(2,o),o+=7,(s&128)===0){n=!0;break}}if(!n)throw new Error("Truncated buffer: unexpected end of data while reading varint");return e}readBytes(){let e=this.readVarint();if(this.pos+e>this._buf.length)throw new Error(`Truncated buffer: expected ${e} bytes at position ${this.pos}, but only ${this._buf.length-this.pos} available`);let o=this._buf.subarray(this.pos,this.pos+e);return this.pos+=e,o}readString(){return this._textDecoder.decode(this.readBytes())}skip(e){switch(e){case 0:this.readVarint();break;case 1:this.pos+=8;break;case 2:this.readBytes();break;case 5:this.pos+=4;break;default:throw new Error(`Unknown wire type ${e}, cannot safely skip`)}}}});function an(t){let e=new b(t),o={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:s}=e.readTag();switch(n){case 1:s===0?o.rejectedLogRecords=e.readVarint():e.skip(s);break;case 2:s===2?o.errorMessage=e.readString():e.skip(s);break;default:e.skip(s);break}}return o}function Me(t){let e=new b(t),o={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:s}=e.readTag();n===1&&s===2?o.partialSuccess=an(e.readBytes()):e.skip(s)}return o}var Fe=a(()=>{"use strict";mt()});var zt,Ne=a(()=>{"use strict";De();Fe();zt={serializeRequest:t=>Ce(t),deserializeResponse:t=>Me(t)}});var Ue=a(()=>{"use strict";Ne()});function He(t,e,o){let n=t.startLengthDelimited(),s=t.pos;t.writeTag(2,1),g(t,e.startTime),t.writeTag(3,1),g(t,e.endTime),o===B.INT?(t.writeTag(6,1),t.writeSfixed64(e.value)):(t.writeTag(4,1),t.writeDouble(e.value)),e.attributes&&T(t,e.attributes,7),t.finishLengthDelimited(n,t.pos-s)}function cn(t,e){let o=t.startLengthDelimited(),n=t.pos,s=e.value;if(t.writeTag(2,1),g(t,e.startTime),t.writeTag(3,1),g(t,e.endTime),t.writeTag(4,1),t.writeFixed64(s.count>>>0,s.count/4294967296>>>0),s.sum!==void 0&&(t.writeTag(5,1),t.writeDouble(s.sum)),s.buckets.counts.length>0){t.writeTag(6,2);let r=t.startLengthDelimited(),i=t.pos;for(let u of s.buckets.counts)t.writeFixed64(u>>>0,u/4294967296>>>0);t.finishLengthDelimited(r,t.pos-i)}if(s.buckets.boundaries.length>0){t.writeTag(7,2);let r=t.startLengthDelimited(),i=t.pos;for(let u of s.buckets.boundaries)t.writeDouble(u);t.finishLengthDelimited(r,t.pos-i)}e.attributes&&T(t,e.attributes,9),s.min!==void 0&&(t.writeTag(11,1),t.writeDouble(s.min)),s.max!==void 0&&(t.writeTag(12,1),t.writeDouble(s.max)),t.finishLengthDelimited(o,t.pos-n)}function ze(t,e,o){let n=t.startLengthDelimited(),s=t.pos;if(e!==0&&(t.writeTag(1,0),t.writeSint32(e)),o.length>0){t.writeTag(2,2);let r=t.startLengthDelimited(),i=t.pos;for(let u of o)t.writeVarint(u);t.finishLengthDelimited(r,t.pos-i)}t.finishLengthDelimited(n,t.pos-s)}function un(t,e){let o=t.startLengthDelimited(),n=t.pos,s=e.value;e.attributes&&T(t,e.attributes,1),t.writeTag(2,1),g(t,e.startTime),t.writeTag(3,1),g(t,e.endTime),t.writeTag(4,1),t.writeFixed64(s.count>>>0,s.count/4294967296>>>0),s.sum!==void 0&&(t.writeTag(5,1),t.writeDouble(s.sum)),s.scale!==0&&(t.writeTag(6,0),t.writeSint32(s.scale)),t.writeTag(7,1),t.writeFixed64(s.zeroCount>>>0,s.zeroCount/4294967296>>>0),t.writeTag(8,2),ze(t,s.positive.offset,s.positive.bucketCounts),t.writeTag(9,2),ze(t,s.negative.offset,s.negative.bucketCounts),s.min!==void 0&&(t.writeTag(12,1),t.writeDouble(s.min)),s.max!==void 0&&(t.writeTag(13,1),t.writeDouble(s.max)),t.finishLengthDelimited(o,t.pos-n)}function pn(t,e){let o=t.startLengthDelimited(),n=t.pos;switch(t.writeTag(1,2),t.writeString(e.descriptor.name),e.descriptor.description&&(t.writeTag(2,2),t.writeString(e.descriptor.description)),e.descriptor.unit&&(t.writeTag(3,2),t.writeString(e.descriptor.unit)),e.dataPointType){case L.GAUGE:t.writeTag(5,2),fn(t,e);break;case L.SUM:t.writeTag(7,2),ln(t,e);break;case L.HISTOGRAM:t.writeTag(9,2),dn(t,e);break;case L.EXPONENTIAL_HISTOGRAM:t.writeTag(10,2),mn(t,e);break;default:{let s=e}}t.finishLengthDelimited(o,t.pos-n)}function fn(t,e){let o=t.startLengthDelimited(),n=t.pos;for(let s of e.dataPoints)t.writeTag(1,2),He(t,s,e.descriptor.valueType);t.finishLengthDelimited(o,t.pos-n)}function ln(t,e){let o=t.startLengthDelimited(),n=t.pos;for(let r of e.dataPoints)t.writeTag(1,2),He(t,r,e.descriptor.valueType);let s=wt(e.aggregationTemporality);s!==0&&(t.writeTag(2,0),t.writeVarint(s)),e.isMonotonic&&(t.writeTag(3,0),t.writeVarint(1)),t.finishLengthDelimited(o,t.pos-n)}function dn(t,e){let o=t.startLengthDelimited(),n=t.pos;for(let r of e.dataPoints)t.writeTag(1,2),cn(t,r);let s=wt(e.aggregationTemporality);s!==0&&(t.writeTag(2,0),t.writeVarint(s)),t.finishLengthDelimited(o,t.pos-n)}function mn(t,e){let o=t.startLengthDelimited(),n=t.pos;for(let r of e.dataPoints)t.writeTag(1,2),un(t,r);let s=wt(e.aggregationTemporality);s!==0&&(t.writeTag(2,0),t.writeVarint(s)),t.finishLengthDelimited(o,t.pos-n)}function hn(t,e){let o=t.startLengthDelimited(),n=t.pos;U(t,e.scope,1);for(let s of e.metrics)t.writeTag(2,2),pn(t,s);e.scope.schemaUrl&&(t.writeTag(3,2),t.writeString(e.scope.schemaUrl)),t.finishLengthDelimited(o,t.pos-n)}function we(t,e){let o=t.startLengthDelimited(),n=t.pos;z(t,e.resource,1);for(let s of e.scopeMetrics)t.writeTag(2,2),hn(t,s);e.resource.schemaUrl&&(t.writeTag(3,2),t.writeString(e.resource.schemaUrl)),t.finishLengthDelimited(o,t.pos-n)}function wt(t){switch(t){case M.DELTA:return 1;case M.CUMULATIVE:return 2;default:return 0}}function ke(t){let e=new I;e.writeTag(1,2),we(e,t);let o=new P(e.pos);return o.writeTag(1,2),we(o,t),o.finish()}var Be=a(()=>{"use strict";h();oe();lt();dt();ft()});function gn(t){let e=new b(t),o={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:s}=e.readTag();switch(n){case 1:s===0?o.rejectedDataPoints=e.readVarint():e.skip(s);break;case 2:s===2?o.errorMessage=e.readString():e.skip(s);break;default:e.skip(s);break}}return o}function Ve(t){let e=new b(t),o={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:s}=e.readTag();n===1&&s===2?o.partialSuccess=gn(e.readBytes()):e.skip(s)}return o}var Ge=a(()=>{"use strict";mt()});var Ht,ve=a(()=>{"use strict";Be();Ge();Ht={serializeRequest:t=>ke(t),deserializeResponse:t=>Ve(t)}});var $e=a(()=>{"use strict";ve()});function We(t,e){let o=t&255|Tn;return e&&(o|=xn),o}function En(t,e){let o=t.startLengthDelimited(),n=t.pos;e.message&&(t.writeTag(2,2),t.writeString(e.message)),t.writeTag(3,0),t.writeVarint(e.code),t.finishLengthDelimited(o,t.pos-n)}function _n(t,e){let o=t.startLengthDelimited(),n=t.pos;t.writeTag(1,1),g(t,e.time),t.writeTag(2,2),t.writeString(e.name),e.attributes&&T(t,e.attributes,3),t.writeTag(4,0),t.writeVarint(e.droppedAttributesCount||0),t.finishLengthDelimited(o,t.pos-n)}function Sn(t,e){let o=t.startLengthDelimited(),n=t.pos,s=e.context;t.writeTag(1,2),t.writeBytes(O(s.traceId)),t.writeTag(2,2),t.writeBytes(O(s.spanId));let r=s.traceState?.serialize();r&&(t.writeTag(3,2),t.writeString(r)),e.attributes&&T(t,e.attributes,4),t.writeTag(5,0),t.writeVarint(e.droppedAttributesCount||0);let i=We(s.traceFlags,s.isRemote);i&&(t.writeTag(6,5),t.writeFixed32(i)),t.finishLengthDelimited(o,t.pos-n)}function bn(t,e){let o=t.startLengthDelimited(),n=t.pos,s=e.spanContext();t.writeTag(1,2),t.writeBytes(O(s.traceId)),t.writeTag(2,2),t.writeBytes(O(s.spanId));let r=s.traceState?.serialize();r&&(t.writeTag(3,2),t.writeString(r)),e.parentSpanContext?.spanId&&(t.writeTag(4,2),t.writeBytes(O(e.parentSpanContext.spanId))),t.writeTag(5,2),t.writeString(e.name);let i=e.kind==null?0:e.kind+1;i!==0&&(t.writeTag(6,0),t.writeVarint(i)),t.writeTag(7,1),g(t,e.startTime),t.writeTag(8,1),g(t,e.endTime),e.attributes&&T(t,e.attributes,9),t.writeTag(10,0),t.writeVarint(e.droppedAttributesCount);for(let c of e.events)t.writeTag(11,2),_n(t,c);t.writeTag(12,0),t.writeVarint(e.droppedEventsCount);for(let c of e.links)t.writeTag(13,2),Sn(t,c);t.writeTag(14,0),t.writeVarint(e.droppedLinksCount),t.writeTag(15,2),En(t,e.status);let u=We(s.traceFlags,e.parentSpanContext?.isRemote);u&&(t.writeTag(16,5),t.writeFixed32(u)),t.finishLengthDelimited(o,t.pos-n)}function Ln(t,e,o){let n=t.startLengthDelimited(),s=t.pos;U(t,e,1);for(let r of o)t.writeTag(2,2),bn(t,r);e.schemaUrl&&(t.writeTag(3,2),t.writeString(e.schemaUrl)),t.finishLengthDelimited(n,t.pos-s)}function qe(t,e,o){let n=t.startLengthDelimited(),s=t.pos;z(t,e,1);for(let r of o.values()){t.writeTag(2,2);let i=r[0].instrumentationScope;Ln(t,i,r)}e.schemaUrl&&(t.writeTag(3,2),t.writeString(e.schemaUrl)),t.finishLengthDelimited(n,t.pos-s)}function An(t){let e=new Map;for(let o of t){let n=o.resource,s=o.instrumentationScope,r=e.get(n);r||(r=new Map,e.set(n,r));let i=r.get(s);i||(i=[],r.set(s,i)),i.push(o)}return e}function Xe(t){let e=An(t),o=new I;for(let[s,r]of e)o.writeTag(1,2),qe(o,s,r);let n=new P(o.pos);for(let[s,r]of e)n.writeTag(1,2),qe(n,s,r);return n.finish()}var Tn,xn,Je=a(()=>{"use strict";ft();Ut();lt();dt();Tn=256,xn=512});function Rn(t){let e=new b(t),o={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:s}=e.readTag();switch(n){case 1:s===0?o.rejectedSpans=e.readVarint():e.skip(s);break;case 2:s===2?o.errorMessage=e.readString():e.skip(s);break;default:e.skip(s);break}}return o}function je(t){let e=new b(t),o={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:s}=e.readTag();n===1&&s===2?o.partialSuccess=Rn(e.readBytes()):e.skip(s)}return o}var Ye=a(()=>{"use strict";mt()});var kt,Ke=a(()=>{"use strict";Je();Ye();kt={serializeRequest:t=>Xe(t),deserializeResponse:t=>je(t)}});var Qe=a(()=>{"use strict";Ke()});function w(t,e){let o={attributes:x(t.attributes,e),droppedAttributesCount:0},n=t.schemaUrl;return n&&n!==""&&(o.schemaUrl=n),o}function H(t,e){let o={name:t.name,version:t.version};return t.attributes&&Object.keys(t.attributes).length>0&&(o.attributes=x(t.attributes,e),o.droppedAttributesCount=t.droppedAttributesCount??0),o}function x(t,e){return Object.keys(t).map(o=>On(o,t[o],e))}function On(t,e,o){return{key:t,value:K(e,o)}}function K(t,e){let o=typeof t;if(o==="string")return{stringValue:t};if(o==="number")return Number.isInteger(t)?{intValue:t}:{doubleValue:t};if(o==="boolean")return{boolValue:t};if(t instanceof Uint8Array)return{bytesValue:e.encodeUint8Array(t)};if(Array.isArray(t)){let n=new Array(t.length);for(let s=0;s<t.length;s++)n[s]=K(t[s],e);return{arrayValue:{values:n}}}if(o==="object"&&t!=null){let n=Object.keys(t),s=new Array(n.length);for(let r=0;r<n.length;r++)s[r]={key:n[r],value:K(t[n[r]],e)};return{kvlistValue:{values:s}}}return{}}var ht=a(()=>{"use strict"});function Ze(t,e){return{resourceLogs:Pn(t,e)}}function yn(t){let e=new Map;for(let o of t){let{resource:n,instrumentationScope:s}=o,r=e.get(n);r||(r=new Map,e.set(n,r));let i=r.get(s);i||(i=[],r.set(s,i)),i.push(o)}return e}function Pn(t,e){let o=yn(t);return Array.from(o,([n,s])=>{let r=w(n,e);return{resource:r,scopeLogs:Array.from(s,([,i])=>({scope:H(i[0].instrumentationScope,e),logRecords:i.map(u=>In(u,e)),schemaUrl:i[0].instrumentationScope.schemaUrl})),schemaUrl:r.schemaUrl}})}function In(t,e){return{timeUnixNano:e.encodeHrTime(t.hrTime),observedTimeUnixNano:e.encodeHrTime(t.hrTimeObserved),severityNumber:t.severityNumber,severityText:t.severityText,body:K(t.body,e),eventName:t.eventName,attributes:x(t.attributes,e),droppedAttributesCount:t.droppedAttributesCount,flags:t.spanContext?.traceFlags,traceId:e.encodeOptionalSpanContext(t.spanContext?.traceId),spanId:e.encodeOptionalSpanContext(t.spanContext?.spanId)}}var to=a(()=>{"use strict";ht()});function Cn(t){let e=BigInt(1e9);return BigInt(Math.trunc(t[0]))*e+BigInt(Math.trunc(t[1]))}function Dn(t){return Cn(t).toString()}function eo(t){return t}var Mn,k,gt=a(()=>{"use strict";G();Mn=typeof BigInt<"u"?Dn:te;k={encodeHrTime:Mn,encodeSpanContext:eo,encodeOptionalSpanContext:eo,encodeUint8Array:t=>{if(typeof Buffer<"u")return Buffer.from(t).toString("base64");let e=new Array(t.length);for(let o=0;o<t.length;o++)e[o]=String.fromCharCode(t[o]);return btoa(e.join(""))}}});var Bt,oo=a(()=>{"use strict";to();gt();h();Bt={serializeRequest:t=>{let e=Ze(t,k);return new TextEncoder().encode(JSON.stringify(e))},deserializeResponse:t=>{if(t.length===0)return{};let e=new TextDecoder;try{return JSON.parse(e.decode(t))}catch(o){return p.warn(`Failed to parse logs export response: ${o.message}. Returning empty response`),{}}}}});var no=a(()=>{"use strict";oo()});var Q,so=a(()=>{"use strict";(function(t){t[t.AGGREGATION_TEMPORALITY_UNSPECIFIED=0]="AGGREGATION_TEMPORALITY_UNSPECIFIED",t[t.AGGREGATION_TEMPORALITY_DELTA=1]="AGGREGATION_TEMPORALITY_DELTA",t[t.AGGREGATION_TEMPORALITY_CUMULATIVE=2]="AGGREGATION_TEMPORALITY_CUMULATIVE"})(Q||(Q={}))});function Fn(t,e){let o=w(t.resource,e);return{resource:o,schemaUrl:o.schemaUrl,scopeMetrics:Nn(t.scopeMetrics,e)}}function Nn(t,e){return Array.from(t.map(o=>({scope:H(o.scope,e),metrics:o.metrics.map(n=>Un(n,e)),schemaUrl:o.scope.schemaUrl})))}function Un(t,e){let o={name:t.descriptor.name,description:t.descriptor.description,unit:t.descriptor.unit},n=kn(t.aggregationTemporality);switch(t.dataPointType){case L.SUM:o.sum={aggregationTemporality:n,isMonotonic:t.isMonotonic,dataPoints:ro(t,e)};break;case L.GAUGE:o.gauge={dataPoints:ro(t,e)};break;case L.HISTOGRAM:o.histogram={aggregationTemporality:n,dataPoints:wn(t,e)};break;case L.EXPONENTIAL_HISTOGRAM:o.exponentialHistogram={aggregationTemporality:n,dataPoints:Hn(t,e)};break}return o}function zn(t,e,o){let n={attributes:x(t.attributes,o),startTimeUnixNano:o.encodeHrTime(t.startTime),timeUnixNano:o.encodeHrTime(t.endTime)};switch(e){case B.INT:n.asInt=t.value;break;case B.DOUBLE:n.asDouble=t.value;break}return n}function ro(t,e){return t.dataPoints.map(o=>zn(o,t.descriptor.valueType,e))}function wn(t,e){return t.dataPoints.map(o=>{let n=o.value;return{attributes:x(o.attributes,e),bucketCounts:n.buckets.counts,explicitBounds:n.buckets.boundaries,count:n.count,sum:n.sum,min:n.min,max:n.max,startTimeUnixNano:e.encodeHrTime(o.startTime),timeUnixNano:e.encodeHrTime(o.endTime)}})}function Hn(t,e){return t.dataPoints.map(o=>{let n=o.value;return{attributes:x(o.attributes,e),count:n.count,min:n.min,max:n.max,sum:n.sum,positive:{offset:n.positive.offset,bucketCounts:n.positive.bucketCounts},negative:{offset:n.negative.offset,bucketCounts:n.negative.bucketCounts},scale:n.scale,zeroCount:n.zeroCount,startTimeUnixNano:e.encodeHrTime(o.startTime),timeUnixNano:e.encodeHrTime(o.endTime)}})}function kn(t){switch(t){case M.DELTA:return Q.AGGREGATION_TEMPORALITY_DELTA;case M.CUMULATIVE:return Q.AGGREGATION_TEMPORALITY_CUMULATIVE}}function io(t,e){return{resourceMetrics:t.map(o=>Fn(o,e))}}var ao=a(()=>{"use strict";h();oe();so();ht()});var Vt,co=a(()=>{"use strict";ao();gt();h();Vt={serializeRequest:t=>{let e=io([t],k);return new TextEncoder().encode(JSON.stringify(e))},deserializeResponse:t=>{if(t.length===0)return{};let e=new TextDecoder;try{return JSON.parse(e.decode(t))}catch(o){return p.warn(`Failed to parse metrics export response: ${o.message}. Returning empty response`),{}}}}});var uo=a(()=>{"use strict";co()});function po(t,e){let o=t&255|Bn;return e&&(o|=Vn),o}function Gn(t,e){let o=t.spanContext(),n=t.status,s=t.parentSpanContext?.spanId?e.encodeSpanContext(t.parentSpanContext?.spanId):void 0;return{traceId:e.encodeSpanContext(o.traceId),spanId:e.encodeSpanContext(o.spanId),parentSpanId:s,traceState:o.traceState?.serialize(),name:t.name,kind:t.kind==null?0:t.kind+1,startTimeUnixNano:e.encodeHrTime(t.startTime),endTimeUnixNano:e.encodeHrTime(t.endTime),attributes:x(t.attributes,e),droppedAttributesCount:t.droppedAttributesCount,events:t.events.map(r=>$n(r,e)),droppedEventsCount:t.droppedEventsCount,status:{code:n.code,message:n.message},links:t.links.map(r=>vn(r,e)),droppedLinksCount:t.droppedLinksCount,flags:po(o.traceFlags,t.parentSpanContext?.isRemote)}}function vn(t,e){return{attributes:t.attributes?x(t.attributes,e):[],spanId:e.encodeSpanContext(t.context.spanId),traceId:e.encodeSpanContext(t.context.traceId),traceState:t.context.traceState?.serialize(),droppedAttributesCount:t.droppedAttributesCount||0,flags:po(t.context.traceFlags,t.context.isRemote)}}function $n(t,e){return{attributes:t.attributes?x(t.attributes,e):[],name:t.name,timeUnixNano:e.encodeHrTime(t.time),droppedAttributesCount:t.droppedAttributesCount||0}}function fo(t,e){return{resourceSpans:Wn(t,e)}}function qn(t){let e=new Map;for(let o of t){let n=e.get(o.resource);n||(n=new Map,e.set(o.resource,n));let s=`${o.instrumentationScope.name}@${o.instrumentationScope.version||""}:${o.instrumentationScope.schemaUrl||""}`,r=n.get(s);r||(r=[],n.set(s,r)),r.push(o)}return e}function Wn(t,e){let o=qn(t),n=[],s=o.entries(),r=s.next();for(;!r.done;){let[i,u]=r.value,c=[],d=u.values(),m=d.next();for(;!m.done;){let E=m.value;if(E.length>0){let D=E.map(_=>Gn(_,e));c.push({scope:H(E[0].instrumentationScope,e),spans:D,schemaUrl:E[0].instrumentationScope.schemaUrl})}m=d.next()}let l=w(i,e),f={resource:l,scopeSpans:c,schemaUrl:l.schemaUrl};n.push(f),r=s.next()}return n}var Bn,Vn,lo=a(()=>{"use strict";ht();Bn=256,Vn=512});var Gt,mo=a(()=>{"use strict";lo();gt();h();Gt={serializeRequest:t=>{let e=fo(t,k);return new TextEncoder().encode(JSON.stringify(e))},deserializeResponse:t=>{if(t.length===0)return{};let e=new TextDecoder;try{return JSON.parse(e.decode(t))}catch(o){return p.warn(`Failed to parse trace export response: ${o.message}. Returning empty response`),{}}}}});var ho=a(()=>{"use strict";mo()});var Xn={};_t(Xn,{JsonLogsSerializer:()=>Bt,JsonMetricsSerializer:()=>Vt,JsonTraceSerializer:()=>Gt,LogsExporterMetricsHelper:()=>Oe,MetricsExporterMetricsHelper:()=>be,ProtobufLogsSerializer:()=>zt,ProtobufMetricsSerializer:()=>Ht,ProtobufTraceSerializer:()=>kt,TraceExporterMetricsHelper:()=>Ae});var Jn=a(()=>{"use strict";Le();Re();ye();Ue();$e();Qe();no();uo();ho()});function vt(t){return t===429||t===502||t===503||t===504}function $t(t){if(t==null)return;let e=Number.parseInt(t,10);if(Number.isInteger(e))return e>0?e*1e3:-1;let o=new Date(t).getTime()-Date.now();return o>=0?o:0}var go=a(()=>{"use strict"});import*as Eo from"zlib";import{Readable as jn}from"stream";function _o(t,e,o,n,s,r,i,u){return new Promise(c=>{let d=new URL(e);s?o["User-Agent"]=`${s} ${To}`:o["User-Agent"]=To;let l=t(d,{method:"POST",headers:o,agent:r},f=>{let E=[],D=0;f.on("data",_=>{if(D+=_.length,D>xo){let Et=new Error(`OTLP export response body exceeded size limit of ${xo} bytes`);c({status:"failure",error:Et}),f.destroy();return}E.push(_)}),f.on("end",()=>{if(f.statusCode&&f.statusCode<=299)c({status:"success",data:Buffer.concat(E)});else if(f.statusCode&&vt(f.statusCode))c({status:"retryable",retryInMillis:$t(f.headers["retry-after"])});else{let _=new S(f.statusMessage,f.statusCode,Buffer.concat(E).toString());c({status:"failure",error:_})}}),f.on("error",_=>{f.statusCode&&f.statusCode<=299?c({status:"success"}):f.statusCode&&vt(f.statusCode)?c({status:"retryable",error:_,retryInMillis:$t(f.headers["retry-after"])}):c({status:"failure",error:_})})});l.setTimeout(u,()=>{l.destroy(),c({status:"retryable",error:new Error("Request timed out")})}),l.on("error",f=>{Qn(f)?c({status:"retryable",error:f}):c({status:"failure",error:f})}),Yn(l,n,i,f=>{c({status:"failure",error:f})})})}function Yn(t,e,o,n){let s=Kn(o);e==="gzip"&&(t.setHeader("Content-Encoding","gzip"),s=s.on("error",n).pipe(Eo.createGzip()).on("error",n)),s.pipe(t).on("error",n)}function Kn(t){let e=new jn;return e.push(t),e.push(null),e}function Qn(t){let e=new Set(["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT","EAI_AGAIN","ENOTFOUND","ENETUNREACH","EHOSTUNREACH"]);return"code"in t&&typeof t.code=="string"?e.has(t.code):!1}var To,xo,So=a(()=>{"use strict";go();X();Mt();To=`OTel-OTLP-Exporter-JavaScript/${pt}`,xo=4*1024*1024});async function Zn(t){let e=t==="http:"?import("http"):import("https"),{request:o}=await e;return o}function bo(t){return new qt(t)}var qt,Lo=a(()=>{"use strict";So();qt=class{_utils=null;_parameters;constructor(e){this._parameters=e}async send(e,o){let{agent:n,request:s}=await this._loadUtils(),r=await this._parameters.headers();return _o(s,this._parameters.url,r,this._parameters.compression,this._parameters.userAgent,n,e,o)}shutdown(){}async _loadUtils(){let e=this._utils;if(e===null){let o=new URL(this._parameters.url).protocol,[n,s]=await Promise.all([this._parameters.agentFactory(o),Zn(o)]);e=this._utils={agent:n,request:s}}return e}}});function ns(){return Math.random()*(2*Ao)-Ao}function Ro(t){return new Xt(t.transport)}var Wt,ts,es,os,Ao,Xt,Oo=a(()=>{"use strict";h();Wt=5,ts=1e3,es=5e3,os=1.5,Ao=.2;Xt=class{_transport;constructor(e){this._transport=e}retry(e,o,n){return new Promise((s,r)=>{setTimeout(()=>{this._transport.send(e,o).then(s,r)},n)})}async send(e,o){let n=Wt,s=ts,r=Date.now()+o,i=await this._transport.send(e,o);for(;i.status==="retryable"&&n>0;){n--;let u=Math.max(Math.min(s*(1+ns()),es),0);s=s*os;let c=i.retryInMillis??u,d=r-Date.now();if(c>d)return p.info(`Export retry time ${Math.round(c)}ms exceeds remaining timeout ${Math.round(d)}ms, not retrying further.`),i;p.verbose(`Scheduling export retry in ${Math.round(c)}ms`),i=await this.retry(e,d,c)}return i.status==="success"?p.verbose(`Export succeeded after ${Wt-n} retry attempts.`):i.status==="retryable"?p.info(`Export failed after maximum retry attempts (${Wt}).`):p.info(`Export failed with non-retryable error: ${i.error}`),i}shutdown(){return this._transport.shutdown()}}});function Jt(t,e,o,n){return new N({componentType:t,metricsHelper:e,url:o,meterProvider:n,responseAttributesFromError:s=>s?s instanceof S?{[Ct]:s.code}:{}:{[Ct]:200}})}function yo(t,e,o,n,s){return ut({transport:Ro({transport:bo(t)}),serializer:e,promiseHandler:ct(t),metrics:Jt(o,n,t.url,s)},{timeout:t.timeoutMillis})}var Po=a(()=>{"use strict";It();Lo();yt();Oo();X();Dt();Ft()});function Io(t){let e={};return Object.entries(t??{}).forEach(([o,n])=>{typeof n<"u"?e[o]=String(n):p.warn(`Header "${o}" has invalid value (${n}) and will be ignored`)}),e}var Co=a(()=>{"use strict";h()});function ss(t,e,o){return async()=>{let n={...await o()},s={};return e!=null&&Object.assign(s,await e()),t!=null&&Object.assign(s,Io(await t())),Object.assign(s,n)}}function rs(t){if(t!=null)try{let e=globalThis.location?.href;return new URL(t,e).href}catch{throw new Error(`Configuration: Could not parse user-provided export URL: '${t}'`)}}function Do(t,e,o){return{...it(t,e,o),headers:ss(t.headers,e.headers,o.headers),url:rs(t.url)??e.url??o.url}}function Mo(t,e){return{...at(),headers:async()=>t,url:"http://localhost:4318/"+e}}var Fo=a(()=>{"use strict";J();Co()});function C(t){return async e=>{let o=e==="http:",n=o?import("http"):import("https"),{Agent:s}=await n;if(o){let{ca:r,cert:i,key:u,...c}=t;return new s(c)}return new s(t)}}function No(t,e,o){return{...Do(t,e,o),agentFactory:t.agentFactory??e.agentFactory??o.agentFactory,userAgent:t.userAgent}}function Uo(t,e){return{...Mo(t,e),agentFactory:C({keepAlive:!0})}}var Tt=a(()=>{"use strict";Fo()});function zo(t){let e=Qt(t);if(e!=null){if(Number.isFinite(e)&&e>0)return e;p.warn(`Configuration: ${t} is invalid, expected number greater than 0 (actual: ${e})`)}}function is(t){let e=zo(`OTEL_EXPORTER_OTLP_${t}_TIMEOUT`),o=zo("OTEL_EXPORTER_OTLP_TIMEOUT");return e??o}function wo(t){let e=A(t)?.trim();if(e==null||e==="none"||e==="gzip")return e;p.warn(`Configuration: ${t} is invalid, expected 'none' or 'gzip' (actual: '${e}')`)}function as(t){let e=wo(`OTEL_EXPORTER_OTLP_${t}_COMPRESSION`),o=wo("OTEL_EXPORTER_OTLP_COMPRESSION");return e??o}function xt(t){return{timeoutMillis:is(t),compression:as(t)}}var jt=a(()=>{"use strict";G();h()});var cs={};_t(cs,{convertLegacyHttpOptions:()=>Ho,createOtlpHttpExportDelegate:()=>yo,createOtlpHttpExporterMetrics:()=>Jt,getSharedConfigurationFromEnvironment:()=>xt,httpAgentFactoryFromOptions:()=>C});var Bo=a(()=>{"use strict";Tt();Po();jt();ko()});import*as Vo from"fs";import*as Go from"path";function us(t){let e=A(`OTEL_EXPORTER_OTLP_${t}_HEADERS`),o=A("OTEL_EXPORTER_OTLP_HEADERS"),n=V(e),s=V(o);if(!(Object.keys(n).length===0&&Object.keys(s).length===0))return Object.assign({},V(o),V(e))}function ps(t){try{return new URL(t).toString()}catch{p.warn(`Configuration: Could not parse environment-provided export URL: '${t}', falling back to undefined`);return}}function fs(t,e){try{new URL(t)}catch{p.warn(`Configuration: Could not parse environment-provided export URL: '${t}', falling back to undefined`);return}t.endsWith("/")||(t=t+"/"),t+=e;try{new URL(t)}catch{p.warn(`Configuration: Provided URL appended with '${e}' is not a valid URL, using 'undefined' instead of '${t}'`);return}return t}function ls(t){let e=A("OTEL_EXPORTER_OTLP_ENDPOINT");if(e!==void 0)return fs(e,t)}function ds(t){let e=A(`OTEL_EXPORTER_OTLP_${t}_ENDPOINT`);if(e!==void 0)return ps(e)}function Yt(t,e,o){let n=A(t),s=A(e),r=n??s;if(r!=null)try{return Vo.readFileSync(Go.resolve(process.cwd(),r))}catch{p.warn(o);return}else return}function ms(t){return Yt(`OTEL_EXPORTER_OTLP_${t}_CLIENT_CERTIFICATE`,"OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE","Failed to read client certificate chain file")}function hs(t){return Yt(`OTEL_EXPORTER_OTLP_${t}_CLIENT_KEY`,"OTEL_EXPORTER_OTLP_CLIENT_KEY","Failed to read client certificate private key file")}function gs(t){return Yt(`OTEL_EXPORTER_OTLP_${t}_CERTIFICATE`,"OTEL_EXPORTER_OTLP_CERTIFICATE","Failed to read root certificate file")}function vo(t,e){return{...xt(t),url:ds(t)??ls(e),headers:rt(us(t)),agentFactory:C({keepAlive:!0,ca:gs(t),cert:ms(t),key:hs(t)})}}var $o=a(()=>{"use strict";G();h();jt();J();Tt()});function qo(t){return typeof t.headers=="function"?t.headers:rt(t.headers)}var Wo=a(()=>{"use strict";J()});function Ts(t){if(typeof t.httpAgentOptions=="function")return t.httpAgentOptions;let e=t.httpAgentOptions;if(t.keepAlive!=null&&(e={keepAlive:t.keepAlive,...e}),e!=null)return C(e)}function Ho(t,e,o,n){return t.metadata&&p.warn("Metadata cannot be set when using http"),No({url:t.url,headers:qo(t),concurrencyLimit:t.concurrencyLimit,timeoutMillis:t.timeoutMillis,compression:t.compression,agentFactory:Ts(t),userAgent:t.userAgent},vo(e,o),Uo(n,o))}var ko=a(()=>{"use strict";h();Tt();Bo();$o();Wo()});export{nt as a,st as b,Yo as c,Ko as d,be as e,Ae as f,Oe as g,v as h,Xo as i,ue as j,zt as k,Ht as l,kt as m,Bt as n,Vt as o,Gt as p,Xn as q,Jn as r,Jt as s,yo as t,Ho as u,cs as v,Bo as w};
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __yukinoCreateRequire } from "node:module";
3
3
  const require = __yukinoCreateRequire(import.meta.url);
4
- import*as o from"child_process";import*as s from"util";var c=s.promisify(o.exec);export{c as a};
4
+ import*as e from"child_process";import*as c from"util";var i=c.promisify(e.exec),s=c.promisify(e.execFile);export{i as a,s as b};
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __yukinoCreateRequire } from "node:module";
3
3
  const require = __yukinoCreateRequire(import.meta.url);
4
- import{a as t,d as O,f as o,p,r as P,t as T,u as E,w as s}from"./chunk-NPIMUWFO.js";O();P();s();var _="otlp_http_span_exporter";var r=class extends t{constructor(e={}){super(T(E(e,"TRACES","v1/traces",{"Content-Type":"application/json"}),p,_,o,e.selfObsMeterProvider))}};export{r as a};
4
+ import{a as t,d as O,f as o,p,r as P,t as T,u as E,w as s}from"./chunk-3FNHYMQD.js";O();P();s();var _="otlp_http_span_exporter";var r=class extends t{constructor(e={}){super(T(E(e,"TRACES","v1/traces",{"Content-Type":"application/json"}),p,_,o,e.selfObsMeterProvider))}};export{r as a};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __yukinoCreateRequire } from "node:module";
3
+ const require = __yukinoCreateRequire(import.meta.url);
4
+ var t="yukino",T="@yukino.js/yukino",E="none",_="console",e="otlp",n="prometheus",O="grpc",r="http/json",o="http/protobuf",R=o,s="agent",c="generation",p="tool",L="DEFAULT",N="ERROR",x="error.type",A="yukino.mode",I="session.hash",S="token.type",i="yukino.agent.runs",u="yukino.agent.duration",k="yukino.llm.requests",M="yukino.llm.tokens",P="yukino.llm.time_to_first_token",l="yukino.llm.duration",y="yukino.tool.calls",U="yukino.tool.duration",C="yukino.agent.run",a="yukino.llm.generate",D="yukino.tool.execute",B="yukino.error",V="yukino.llm.error",G="yukino.tool.error",d="ms",m=0,H="Tool returned an error",g="[redacted]",h=/(?:authorization|api[_-]?key|password|secret|credential|(?:^|[_-])token(?:$|[_-])|access[_-]?token|refresh[_-]?token|private[_-]?key|(?:^|[_-])dsn(?:$|[_-])|^(?:cookie|set-cookie)$)/iu;export{t as a,T as b,E as c,_ as d,e,n as f,O as g,r as h,o as i,R as j,s as k,c as l,p as m,L as n,N as o,x as p,A as q,I as r,S as s,i as t,u,k as v,M as w,P as x,l as y,y as z,U as A,C as B,a as C,D,B as E,V as F,G,d as H,m as I,H as J,g as K,h as L};