@yukino.js/yukino 0.0.13 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/README.md +13 -11
  2. package/dist/a2a-ANR7PFD4.js +15 -0
  3. package/dist/acp-4E7R254I.js +14 -0
  4. package/dist/{anthropic-74ALYMH2.js → anthropic-ZO73YJFY.js} +1 -1
  5. package/dist/browser/dist/index.html +44 -0
  6. package/dist/browser/dist/static/index.css +2 -0
  7. package/dist/browser/dist/static/index.js +203 -0
  8. package/dist/bwrap-LVIPV72Q.js +0 -0
  9. package/dist/chunk-3KKA6537.js +0 -0
  10. package/dist/chunk-3RH3COZW.js +365 -0
  11. package/dist/chunk-4JHZPFU6.js +67 -0
  12. package/dist/chunk-7MKA3SHV.js +0 -0
  13. package/dist/{chunk-OREDGNI6.js → chunk-B2RNOTT5.js} +1 -1
  14. package/dist/{chunk-APJAUOF6.js → chunk-C56EKYBO.js} +1 -1
  15. package/dist/{chunk-WGFROGUC.js → chunk-CKOUBYG6.js} +0 -0
  16. package/dist/{chunk-6JUOKMSJ.js → chunk-CW6G3RYM.js} +1 -1
  17. package/dist/{chunk-556TRLPT.js → chunk-CWWRUTF2.js} +1 -1
  18. package/dist/chunk-DVB57IVG.js +18 -0
  19. package/dist/chunk-ETZPOVUC.js +4 -0
  20. package/dist/chunk-F3JTT3TI.js +110 -0
  21. package/dist/chunk-FC2LG24U.js +4 -0
  22. package/dist/chunk-FNQMXCCE.js +4 -0
  23. package/dist/chunk-HWCLMDQF.js +0 -0
  24. package/dist/chunk-I74AL3PF.js +0 -0
  25. package/dist/chunk-IOMQY54U.js +967 -0
  26. package/dist/chunk-IQT2IFSO.js +4 -0
  27. package/dist/chunk-K45OXLJJ.js +16 -0
  28. package/dist/chunk-KJJYW5IY.js +0 -0
  29. package/dist/chunk-LCWNSYZU.js +0 -0
  30. package/dist/chunk-LR4ZNAAM.js +4 -0
  31. package/dist/chunk-LTMY67B2.js +5 -0
  32. package/dist/chunk-MDPSQ6L7.js +0 -0
  33. package/dist/chunk-MQAQBW7F.js +0 -0
  34. package/dist/{chunk-NEU4ER5V.js → chunk-NSNTZXFL.js} +1 -1
  35. package/dist/chunk-P6DHMU7R.js +0 -0
  36. package/dist/chunk-VCIRD267.js +0 -0
  37. package/dist/chunk-VM4YKTHC.js +0 -0
  38. package/dist/chunk-VU3JWAJR.js +0 -0
  39. package/dist/chunk-W4GMCNWF.js +0 -0
  40. package/dist/chunk-XY7ZFVZL.js +4 -0
  41. package/dist/devtools-UVGRIXO2.js +0 -0
  42. package/dist/{esm-HW2JMFYC.js → esm-2JJG3HR7.js} +1 -1
  43. package/dist/esm-7DWXO52B.js +4 -0
  44. package/dist/{esm-6L5BJ5GT.js → esm-EOOB75BT.js} +1 -1
  45. package/dist/{esm-DIYJ5HX6.js → esm-H73EL6IR.js} +1 -1
  46. package/dist/{esm-YKAO4ES6.js → esm-IBZKE3IU.js} +1 -1
  47. package/dist/esm-W4NAAZTQ.js +225 -0
  48. package/dist/{esm-RPR2GBJ2.js → esm-Y237QNPJ.js} +1 -1
  49. package/dist/getMachineId-bsd-A3UCSHLE.js +4 -0
  50. package/dist/getMachineId-bsd-E27XJQLX.js +0 -0
  51. package/dist/getMachineId-darwin-35UPAIXP.js +0 -0
  52. package/dist/getMachineId-darwin-MWJEU7OI.js +5 -0
  53. package/dist/getMachineId-linux-FNSLKUDN.js +4 -0
  54. package/dist/getMachineId-linux-MKXIYT6A.js +0 -0
  55. package/dist/getMachineId-unsupported-PKQWB2OJ.js +4 -0
  56. package/dist/getMachineId-unsupported-ZXVGGFX2.js +0 -0
  57. package/dist/getMachineId-win-3A667JT3.js +4 -0
  58. package/dist/getMachineId-win-RNVIYJG5.js +0 -0
  59. package/dist/lib/{anthropic-EQRUGP2C.js → anthropic-SQBOFRPQ.js} +4 -4
  60. package/dist/lib/{chunk-EGT7BJRD.js → chunk-AW2577J5.js} +2 -2
  61. package/dist/lib/{chunk-JYCSWXCR.js → chunk-GPJL4PLE.js} +2 -2
  62. package/dist/lib/{chunk-UBVKYJFI.js → chunk-IHVYAEY2.js} +1058 -522
  63. package/dist/lib/{chunk-CDMR25FD.js → chunk-U3OT4POQ.js} +3 -3
  64. package/dist/lib/{chunk-HUTUNNDX.js → chunk-WNGF7243.js} +0 -1
  65. package/dist/lib/{chunk-FUJDUZTH.js → chunk-WXR5HNB4.js} +1 -1
  66. package/dist/lib/{chunk-WWCSFKMR.js → chunk-XS3GONYN.js} +2 -11
  67. package/dist/lib/index.d.ts +98 -282
  68. package/dist/lib/index.js +1092 -2409
  69. package/dist/lib/{openai-B3I5WBFT.js → openai-UV4KFNQV.js} +3 -3
  70. package/dist/lib/{providers-EJ4VBHNP.js → providers-77VBEX3K.js} +2 -2
  71. package/dist/lib/{tool-filter-TURPCYFR.js → tool-filter-MLYQGWM5.js} +3 -3
  72. package/dist/{main-JEEKFCGX.js → main-653YZQHY.js} +228 -232
  73. package/dist/main.js +2 -2
  74. package/dist/node-634LOHDX.js +0 -0
  75. package/dist/{openai-7C6BVQ7M.js → openai-FKLMHNNC.js} +1 -1
  76. package/dist/providers-4IU7SUEQ.js +4 -0
  77. package/dist/seatbelt-UO7HGD4Z.js +0 -0
  78. package/dist/server-4NHV4RJL.js +4 -0
  79. package/dist/slim-Q56GHZZP.js +0 -0
  80. package/dist/{src-JBRNH4FA.js → src-DEVJGNXS.js} +1 -1
  81. package/dist/{src-X6JWWHHT.js → src-EMFESWQS.js} +1 -1
  82. package/dist/{src-R4BSSIJJ.js → src-GG4YROJH.js} +1 -1
  83. package/dist/{src-43CPCEK2.js → src-JFAO2DGP.js} +1 -1
  84. package/dist/tool-filter-LJTLMGFP.js +4 -0
  85. package/dist/turndown.es-NQ3KDXM7.js +0 -0
  86. package/package.json +22 -21
  87. package/dist/a2a-DKWMWGID.js +0 -14
  88. package/dist/acp-RL6DKS3R.js +0 -14
  89. package/dist/chunk-2LHY3FND.js +0 -67
  90. package/dist/chunk-3QL446GD.js +0 -4
  91. package/dist/chunk-6FSIG63T.js +0 -364
  92. package/dist/chunk-A5G5NTDB.js +0 -1015
  93. package/dist/chunk-A7CJPQC5.js +0 -5
  94. package/dist/chunk-AGSYLE4E.js +0 -16
  95. package/dist/chunk-CJSMVCUF.js +0 -6
  96. package/dist/chunk-CU3IISCC.js +0 -4
  97. package/dist/chunk-HMZQYFYG.js +0 -4
  98. package/dist/chunk-JFKC4VCA.js +0 -4
  99. package/dist/chunk-KCMBAHWU.js +0 -4
  100. package/dist/chunk-SCR7NDDL.js +0 -63
  101. package/dist/esm-57CJEGGK.js +0 -4
  102. package/dist/esm-YOQPBF42.js +0 -225
  103. package/dist/fe/dist/index.html +0 -21
  104. package/dist/fe/dist/static/index.css +0 -2
  105. package/dist/fe/dist/static/index.js +0 -203
  106. package/dist/providers-U23PWAHG.js +0 -4
  107. package/dist/server-EOSEQPNY.js +0 -4
  108. package/dist/tool-filter-UDSHRE5F.js +0 -4
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __yukinoCreateRequire } from "node:module";
3
- const require = __yukinoCreateRequire(import.meta.url);
4
- import{a as _}from"./chunk-MQAQBW7F.js";import{b}from"./chunk-HWCLMDQF.js";import{C as r,b as x}from"./chunk-W4GMCNWF.js";function m(){return b("config.yaml")}var g=["off","minimal","low","medium","high","xhigh","max"],p=r.enum(["none","minimal","low","medium","high","xhigh","max"]),D=r.enum(["low","medium","high","xhigh","max"]),M=r.strictObject({off:r.literal("none").nullable().optional(),minimal:p.nullable().optional(),low:p.nullable().optional(),medium:p.nullable().optional(),high:p.nullable().optional(),xhigh:p.nullable().optional(),max:p.nullable().optional()}),y=r.looseObject({name:r.string(),protocol:r.enum(["anthropic","openai","openai-compat"]),base_url:r.string(),model:r.string(),api_key:r.string().optional(),thinking:r.enum(g).optional(),reasoning:r.boolean().optional(),thinking_level_map:M.optional(),thinking_mode:r.enum(["budget","adaptive"]).optional(),context_window:r.coerce.number().optional(),max_output_tokens:r.coerce.number().optional()});function ue(e,n){return e[n]??e[0]}var K="high",d=1e6,h=128e3,V={minimal:1024,low:2048,medium:8192,high:16384,xhigh:32768,max:65536},$=1024,F=1024;function ae(e){return g.some(n=>n===e)}function v(e){return B(e,e.thinking??K)}function fe(e){return e==="off"?0:V[e]}function w(e,n){if(n?.reasoning===!1)return null;if(e==="off")return"none";let t=n?.thinking_level_map?.[e];if(t!==void 0)return t;if(n?.protocol==="anthropic"&&n.thinking_mode==="adaptive"){if(e==="minimal")return"low";if(e==="xhigh")return"high"}return(n?.protocol==="openai"||n?.protocol==="openai-compat")&&(e==="xhigh"||e==="max")?"high":e}function G(e,n){let t=D.safeParse(w(e,n));return t.success?t.data:null}function H(e){return e.reasoning===!1||e.protocol==="anthropic"&&e.thinking_mode!=="adaptive"&&P(e)<$+F?["off"]:g.filter(n=>{if(n==="off")return!0;if(e.protocol==="anthropic"&&e.thinking_mode==="adaptive")return G(n,e)!==null;let t=w(n,e);return!(t===null||t==="none"||(e.protocol==="openai"||e.protocol==="openai-compat")&&(n==="xhigh"||n==="max")&&e.thinking_level_map?.[n]===void 0)})}function B(e,n){let t=H(e),o="off";for(let s of g)if(t.includes(s)&&(o=s),s===n)break;return o}function ce(e){return{...e,thinking:v(e),context_window:E(e),max_output_tokens:P(e)}}function E(e){return Number.isSafeInteger(e.context_window)&&(e.context_window??0)>0?e.context_window??d:d}function P(e){let n=e.max_output_tokens,t=Number.isSafeInteger(n)&&(n??0)>0?n??h:h;return Math.min(t,E(e))}import{randomUUID as W}from"crypto";import{existsSync as N,mkdirSync as X,readFileSync as q,renameSync as Z,unlinkSync as J,writeFileSync as Q}from"fs";import{dirname as Y,join as ee}from"path";var L=(e,n,t)=>r.preprocess(o=>o===void 0||typeof o=="string"&&!o.trim()?e:o,r.union([r.number(),r.string().trim().regex(/^\d+$/,"Enter a whole number").transform(Number)]).pipe(r.number().int().min(n).max(t))),ne=y.extend({name:r.string().trim().min(1,"Name is required"),base_url:r.url("Enter a valid HTTP(S) URL").refine(e=>/^https?:\/\//i.test(e),"Use an HTTP(S) URL"),api_key:r.string().trim().min(1,"API key is required"),model:r.string().trim().min(1,"Model is required"),thinking:r.enum(g).optional(),context_window:L(d,1e3,1e7),max_output_tokens:L(h,1,1e6)}).refine(e=>e.max_output_tokens<=e.context_window,{path:["max_output_tokens"],message:"Max output tokens must not exceed the context window"}).transform(e=>({...e,thinking:v(e)}));function k(e){if(!N(e))return{};let n;try{n=_.load(q(e,"utf-8"))}catch{throw new Error(`Unable to read existing ${e}; it has not been changed.`)}return r.record(r.string(),r.unknown()).parse(n??{})}function T(e,n){let t=Y(e);X(t,{recursive:!0});let o=ee(t,`.config-${W()}.tmp`);try{Q(o,_.dump(n,{lineWidth:-1,noRefs:!0}),{encoding:"utf-8",mode:384,flag:"wx"}),Z(o,e)}finally{N(o)&&J(o)}}function _e(e,n){let t=ne.parse(e),o=m(),s=k(o),f=[...r.array(r.record(r.string(),r.unknown())).parse(s.providers??[])];for(let c of n)f.some(z=>z.base_url===c.base_url)||f.push({...c});let i=[],a=!1;for(let c of f){if(c.base_url!==t.base_url){i.push(c);continue}a||(a=!0,i.push(t))}a||i.push(t);let j=i.map(c=>y.parse(c));return T(o,{...s,providers:i}),{provider:t,providers:j,replaced:a,path:o}}function A(e,n,t){let o=m(),s=k(o),u=r.array(r.record(r.string(),r.unknown())).parse(s.providers??[]),f=u.filter(a=>a.base_url===e);if(f.length===0)throw new Error(`Provider with base URL "${e}" not found in ${o}.`);let i=f.filter(a=>a[n]!==t);if(i.length!==0){for(let a of i)a[n]=t;T(o,{...s,providers:u})}}function ye(e,n){A(e,"thinking",n)}function ve(e,n){A(e,"model",n)}function ke(e){let n=m(),t=k(n);t.default_provider!==e&&T(n,{...t,default_provider:e})}var te="Tool execution was interrupted. The tool may or may not have completed; verify before relying on its effects.",Se="The user rejected this tool use. Nothing was changed (for file edits, the new content was NOT written).";function be(e){let n=[];for(let t=0;t<e.length;t++){let o=e[t];if(o.role==="assistant"&&o.toolUses?.length){n.push(o);let s=new Set(o.toolUses.map(i=>i.toolUseId)),u=[],f=[];for(;t+1<e.length;){let i=e[t+1];if(i.role!=="user"||!i.toolResults?.length||i.toolUses?.length)break;t++,f.push(i);for(let a of i.toolResults)s.delete(a.toolUseId)&&u.push(a)}for(let i of s)u.push({toolUseId:i,content:te,isError:!0});n.push({...f[0]??{role:"user",content:""},toolResults:u});for(let i of f.slice(1))(i.content.length>0||i.thinkingBlocks?.length)&&n.push({...i,toolResults:[]});continue}if((o.toolResults?.length??0)>0){if(o.content.length===0&&!o.toolUses?.length&&!o.thinkingBlocks?.length)continue;n.push({...o,toolResults:[]})}else n.push(o)}return n}var l=class extends Error{constructor(n){super(n),this.name="LLMError"}},C=class extends l{constructor(n){super(n),this.name="AuthenticationError"}},O=class extends l{retryAfter;constructor(n,t){super(n),this.name="RateLimitError",this.retryAfter=t}},U=class extends l{constructor(n){super(n),this.name="NetworkError"}},I=class extends l{constructor(t,o){super(t);this.retryAfter=o;this.name="ServerError"}retryAfter},R=class extends l{constructor(n){super(n),this.name="ContextTooLongError"}};function Ee(e){return/context_length_exceeded/i.test(e)||/maximum\s+context\s+length/i.test(e)||/prompts?\s+(?:is\s+)?too\s+long/i.test(e)}function S(e){return!!e._zod}function Ge(e,n){return S(e)?x(e,n):e.safeParse(n)}function He(e){if(!e)return;let n;if(S(e)?n=e._zod?.def?.shape:n=e.shape,!!n){if(typeof n=="function")try{return n()}catch{return}return n}}function re(e){return e.length===0?"object root":e.reduce((n,t,o)=>o===0?String(t):typeof t=="number"?`${n}[${t}]`:`${n}.${t}`,"")}function Be(e){if(e&&typeof e=="object"){if("issues"in e&&Array.isArray(e.issues)&&e.issues.length>0)return e.issues.map(n=>n.path?.length?`${n.message} at ${re(n.path)}`:n.message).join(`
5
- `);if("message"in e&&typeof e.message=="string")return e.message;try{return JSON.stringify(e)}catch{return String(e)}}return String(e)}function We(e){if(S(e)){let u=e._zod?.def;if(u){if(u.value!==void 0)return u.value;if(Array.isArray(u.values)&&u.values.length>0)return u.values[0]}}let t=e._def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}let o=e.value;if(o!==void 0)return o}export{Ge as a,He as b,Be as c,We as d,m as e,g as f,y as g,ue as h,K as i,d as j,h as k,F as l,ae as m,v as n,fe as o,w as p,G as q,H as r,B as s,ce as t,E as u,P as v,ne as w,_e as x,ye as y,ve as z,ke as A,Se as B,be as C,l as D,C as E,O as F,U as G,I as H,R as I,Ee as J};
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __yukinoCreateRequire } from "node:module";
3
- const require = __yukinoCreateRequire(import.meta.url);
4
- import{A as Ie,E as w,K as Oe,M as R,O as Ce,P as kr,g as jt,t as L,u as Kt,w as Ne,y as Y}from"./chunk-CU3IISCC.js";import{e as at,f as C,o as ct,p as m,u as g}from"./chunk-VCIRD267.js";import{b as u,d as Gr}from"./chunk-7MKA3SHV.js";function lt(i){let t=Object.keys(i);return t.length===0?"":(t=t.sort(),JSON.stringify(t.map(e=>[e,i[e]])))}function Re(i){return`${i.name}:${i.version??""}:${i.schemaUrl??""}`}function A(i,t){let e,r=new Promise(function(n,a){e=setTimeout(function(){a(new v("Operation timed out."))},t)});return Promise.race([i,r]).then(s=>(clearTimeout(e),s),s=>{throw clearTimeout(e),s})}function ve(i,t){if(i.size!==t.size)return!1;for(let e of i)if(!t.has(e))return!1;return!0}function Pe(i,t){let e=0,r=i.length-1,s=i.length;for(;r>=e;){let n=e+Math.trunc((r-e)/2);i[n]<t?e=n+1:(s=n,r=n-1)}return s}function Le(i,t){return i.toLowerCase()===t.toLowerCase()}var v,S=u(()=>{"use strict";v=class i extends Error{constructor(t){super(t),Object.setPrototypeOf(this,i.prototype)}}});var y,ut=u(()=>{"use strict";(function(i){i[i.DELTA=0]="DELTA",i[i.CUMULATIVE=1]="CUMULATIVE"})(y||(y={}))});var f,U=u(()=>{"use strict";(function(i){i[i.DROP=0]="DROP",i[i.SUM=1]="SUM",i[i.LAST_VALUE=2]="LAST_VALUE",i[i.HISTOGRAM=3]="HISTOGRAM",i[i.EXPONENTIAL_HISTOGRAM=4]="EXPONENTIAL_HISTOGRAM"})(f||(f={}))});var q,Ue=u(()=>{"use strict";U();q=class{kind=f.DROP;createAccumulation(){}merge(t,e){}diff(t,e){}toMetricData(t,e,r,s){}}});var h,x,E=u(()=>{"use strict";(function(i){i.COUNTER="COUNTER",i.GAUGE="GAUGE",i.HISTOGRAM="HISTOGRAM",i.UP_DOWN_COUNTER="UP_DOWN_COUNTER",i.OBSERVABLE_COUNTER="OBSERVABLE_COUNTER",i.OBSERVABLE_GAUGE="OBSERVABLE_GAUGE",i.OBSERVABLE_UP_DOWN_COUNTER="OBSERVABLE_UP_DOWN_COUNTER"})(h||(h={}));(function(i){i[i.HISTOGRAM=0]="HISTOGRAM",i[i.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",i[i.GAUGE=2]="GAUGE",i[i.SUM=3]="SUM"})(x||(x={}))});function Vr(i){let t=i.map(()=>0);return t.push(0),{buckets:{boundaries:i,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var B,G,Be=u(()=>{"use strict";U();E();S();B=class{startTime;_boundaries;_recordMinMax;_current;constructor(t,e,r=!0,s=Vr(e)){this.startTime=t,this._boundaries=e,this._recordMinMax=r,this._current=s}record(t){if(Number.isNaN(t))return;this._current.count+=1,this._current.sum+=t,this._recordMinMax&&(this._current.min=Math.min(t,this._current.min),this._current.max=Math.max(t,this._current.max),this._current.hasMinMax=!0);let e=Pe(this._boundaries,t);this._current.buckets.counts[e]+=1}setStartTime(t){this.startTime=t}toPointValue(){return this._current}},G=class{kind=f.HISTOGRAM;_boundaries;_recordMinMax;constructor(t,e){this._boundaries=t,this._recordMinMax=e}createAccumulation(t){return new B(t,this._boundaries,this._recordMinMax)}merge(t,e){let r=t.toPointValue(),s=e.toPointValue(),n=r.buckets.counts,a=s.buckets.counts,o=new Array(n.length);for(let _=0;_<n.length;_++)o[_]=n[_]+a[_];let l=1/0,c=-1/0;return this._recordMinMax&&(r.hasMinMax&&s.hasMinMax?(l=Math.min(r.min,s.min),c=Math.max(r.max,s.max)):r.hasMinMax?(l=r.min,c=r.max):s.hasMinMax&&(l=s.min,c=s.max)),new B(t.startTime,r.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:r.buckets.boundaries,counts:o},count:r.count+s.count,sum:r.sum+s.sum,hasMinMax:this._recordMinMax&&(r.hasMinMax||s.hasMinMax),min:l,max:c})}diff(t,e){let r=t.toPointValue(),s=e.toPointValue(),n=r.buckets.counts,a=s.buckets.counts,o=new Array(n.length);for(let l=0;l<n.length;l++)o[l]=a[l]-n[l];return new B(e.startTime,r.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:r.buckets.boundaries,counts:o},count:s.count-r.count,sum:s.sum-r.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(t,e,r,s){return{descriptor:t,aggregationTemporality:e,dataPointType:x.HISTOGRAM,dataPoints:r.map(([n,a])=>{let o=a.toPointValue(),l=t.type===h.GAUGE||t.type===h.UP_DOWN_COUNTER||t.type===h.OBSERVABLE_GAUGE||t.type===h.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:n,startTime:a.startTime,endTime:s,value:{min:o.hasMinMax?o.min:void 0,max:o.hasMinMax?o.max:void 0,sum:l?void 0:o.sum,buckets:o.buckets,count:o.count}}})}}}});var j,Jt,Ge=u(()=>{"use strict";j=class i{backing;indexBase;indexStart;indexEnd;constructor(t=new Jt,e=0,r=0,s=0){this.backing=t,this.indexBase=e,this.indexStart=r,this.indexEnd=s}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(t,e)=>this.at(e))}at(t){let e=this.indexBase-this.indexStart;return t<e&&(t+=this.backing.length),t-=e,this.backing.countAt(t)}incrementBucket(t,e){this.backing.increment(t,e)}decrementBucket(t,e){this.backing.decrement(t,e)}trim(){for(let t=0;t<this.length;t++)if(this.at(t)!==0){this.indexStart+=t;break}else if(t===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let t=this.length-1;t>=0;t--)if(this.at(t)!==0){this.indexEnd-=this.length-t-1;break}this._rotate()}downscale(t){this._rotate();let e=1+this.indexEnd-this.indexStart,r=1<<t,s=0,n=0;for(let a=this.indexStart;a<=this.indexEnd;){let o=a%r;o<0&&(o+=r);for(let l=o;l<r&&s<e;l++)this._relocateBucket(n,s),s++,a++;n++}this.indexStart>>=t,this.indexEnd>>=t,this.indexBase=this.indexStart}clone(){return new i(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let t=this.indexBase-this.indexStart;t!==0&&(t>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,t),this.backing.reverse(t,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+t)),this.indexBase=this.indexStart)}_relocateBucket(t,e){t!==e&&this.incrementBucket(t,this.backing.emptyBucket(e))}},Jt=class i{_counts;constructor(t=[0]){this._counts=t}get length(){return this._counts.length}countAt(t){return this._counts[t]}growTo(t,e,r){let s=new Array(t).fill(0);s.splice(r,this._counts.length-e,...this._counts.slice(e)),s.splice(0,e,...this._counts.slice(0,e)),this._counts=s}reverse(t,e){let r=Math.floor((t+e)/2)-t;for(let s=0;s<r;s++){let n=this._counts[t+s];this._counts[t+s]=this._counts[e-s-1],this._counts[e-s-1]=n}}emptyBucket(t){let e=this._counts[t];return this._counts[t]=0,e}increment(t,e){this._counts[t]+=e}decrement(t,e){this._counts[t]>=e?this._counts[t]-=e:this._counts[t]=0}clone(){return new i([...this._counts])}}});function ke(i){return Zt.setFloat64(0,i),{hi:Zt.getUint32(0),lo:Zt.getUint32(4)}}function ht(i){let{hi:t}=ke(i);return((t&2146435072)>>20)-1023}function mt(i){let{hi:t,lo:e}=ke(i);return(t&1048575)===0&&e===0}var K,Zt,Qt=u(()=>{"use strict";K=Math.pow(2,-1022),Zt=new DataView(new ArrayBuffer(8))});function J(i,t){return i===0||i===Number.POSITIVE_INFINITY||i===Number.NEGATIVE_INFINITY||Number.isNaN(i)?i:i*Math.pow(2,t)}function Fe(i){return i--,i|=i>>1,i|=i>>2,i|=i>>4,i|=i>>8,i|=i>>16,i++,i}var _t=u(()=>{"use strict"});var T,dt=u(()=>{"use strict";T=class extends Error{}});var pt,$e=u(()=>{"use strict";Qt();_t();dt();pt=class{_shift;constructor(t){this._shift=-t}mapToIndex(t){if(t<K)return this._minNormalLowerBoundaryIndex();let e=ht(t),r=mt(t)?-1:0;return e+r>>this._shift}lowerBoundary(t){let e=this._minNormalLowerBoundaryIndex();if(t<e)throw new T(`underflow: ${t} is < minimum lower boundary: ${e}`);let r=this._maxNormalLowerBoundaryIndex();if(t>r)throw new T(`overflow: ${t} is > maximum lower boundary: ${r}`);return J(1,t<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let t=-1022>>this._shift;return this._shift<2&&t--,t}_maxNormalLowerBoundaryIndex(){return 1023>>this._shift}}});var gt,ze=u(()=>{"use strict";Qt();_t();dt();gt=class{_scale;_scaleFactor;_inverseFactor;constructor(t){this._scale=t,this._scaleFactor=J(Math.LOG2E,t),this._inverseFactor=J(Math.LN2,-t)}mapToIndex(t){if(t<=K)return this._minNormalLowerBoundaryIndex()-1;if(mt(t))return(ht(t)<<this._scale)-1;let e=Math.floor(Math.log(t)*this._scaleFactor),r=this._maxNormalLowerBoundaryIndex();return e>=r?r:e}lowerBoundary(t){let e=this._maxNormalLowerBoundaryIndex();if(t>=e){if(t===e)return 2*Math.exp((t-(1<<this._scale))/this._scaleFactor);throw new T(`overflow: ${t} is > maximum lower boundary: ${e}`)}let r=this._minNormalLowerBoundaryIndex();if(t<=r){if(t===r)return K;if(t===r-1)return Math.exp((t+(1<<this._scale))/this._scaleFactor)/2;throw new T(`overflow: ${t} is < minimum lower boundary: ${r}`)}return Math.exp(t*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return-1022<<this._scale}_maxNormalLowerBoundaryIndex(){return(1024<<this._scale)-1}}});function re(i){if(i>Xe||i<He)throw new T(`expected scale >= ${He} && <= ${Xe}, got: ${i}`);return Fr[i+10]}var He,Xe,Fr,We=u(()=>{"use strict";$e();ze();dt();He=-10,Xe=20,Fr=Array.from({length:31},(i,t)=>t>10?new gt(t-10):new pt(t-10))});var k,Dr,$r,ie,ft,Z,Ye=u(()=>{"use strict";U();E();g();Ge();We();_t();k=class i{static combine(t,e){return new i(Math.min(t.low,e.low),Math.max(t.high,e.high))}low;high;constructor(t,e){this.low=t,this.high=e}},Dr=20,$r=160,ie=2,ft=class i{startTime;_maxSize;_recordMinMax;_sum;_count;_zeroCount;_min;_max;_positive;_negative;_mapping;constructor(t,e=$r,r=!0,s=0,n=0,a=0,o=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,c=new j,_=new j,O=re(Dr)){this.startTime=t,this._maxSize=e,this._recordMinMax=r,this._sum=s,this._count=n,this._zeroCount=a,this._min=o,this._max=l,this._positive=c,this._negative=_,this._mapping=O,this._maxSize<ie&&(m.warn(`Exponential Histogram Max Size set to ${this._maxSize}, changing to the minimum size of: ${ie}`),this._maxSize=ie)}record(t){this.updateByIncrement(t,1)}setStartTime(t){this.startTime=t}toPointValue(){return{hasMinMax:this._recordMinMax,min:this.min,max:this.max,sum:this.sum,positive:{offset:this.positive.offset,bucketCounts:this.positive.counts()},negative:{offset:this.negative.offset,bucketCounts:this.negative.counts()},count:this.count,scale:this.scale,zeroCount:this.zeroCount}}get sum(){return this._sum}get min(){return this._min}get max(){return this._max}get count(){return this._count}get zeroCount(){return this._zeroCount}get scale(){return this._count===this._zeroCount?0:this._mapping.scale}get positive(){return this._positive}get negative(){return this._negative}updateByIncrement(t,e){if(Number.isFinite(t)){if(t>this._max&&(this._max=t),t<this._min&&(this._min=t),this._count+=e,t===0){this._zeroCount+=e;return}this._sum+=t*e,t>0?this._updateBuckets(this._positive,t,e):this._updateBuckets(this._negative,-t,e)}}merge(t){this._count===0?(this._min=t.min,this._max=t.max):t.count!==0&&(t.min<this.min&&(this._min=t.min),t.max>this.max&&(this._max=t.max)),this.startTime=t.startTime,this._sum+=t.sum,this._count+=t.count,this._zeroCount+=t.zeroCount;let e=this._minScale(t);this._downscale(this.scale-e),this._mergeBuckets(this.positive,t,t.positive,e),this._mergeBuckets(this.negative,t,t.negative,e)}diff(t){this._min=1/0,this._max=-1/0,this._sum-=t.sum,this._count-=t.count,this._zeroCount-=t.zeroCount;let e=this._minScale(t);this._downscale(this.scale-e),this._diffBuckets(this.positive,t,t.positive,e),this._diffBuckets(this.negative,t,t.negative,e)}clone(){return new i(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)}_updateBuckets(t,e,r){let s=this._mapping.mapToIndex(e),n=!1,a=0,o=0;if(t.length===0?(t.indexStart=s,t.indexEnd=t.indexStart,t.indexBase=t.indexStart):s<t.indexStart&&t.indexEnd-s>=this._maxSize?(n=!0,o=s,a=t.indexEnd):s>t.indexEnd&&s-t.indexStart>=this._maxSize&&(n=!0,o=t.indexStart,a=s),n){let l=this._changeScale(a,o);this._downscale(l),s=this._mapping.mapToIndex(e)}this._incrementIndexBy(t,s,r)}_incrementIndexBy(t,e,r){if(r===0)return;if(t.length===0&&(t.indexStart=t.indexEnd=t.indexBase=e),e<t.indexStart){let n=t.indexEnd-e;n>=t.backing.length&&this._grow(t,n+1),t.indexStart=e}else if(e>t.indexEnd){let n=e-t.indexStart;n>=t.backing.length&&this._grow(t,n+1),t.indexEnd=e}let s=e-t.indexBase;s<0&&(s+=t.backing.length),t.incrementBucket(s,r)}_grow(t,e){let r=t.backing.length,s=t.indexBase-t.indexStart,n=r-s,a=Fe(e);a>this._maxSize&&(a=this._maxSize);let o=a-s;t.backing.growTo(a,n,o)}_changeScale(t,e){let r=0;for(;t-e>=this._maxSize;)t>>=1,e>>=1,r++;return r}_downscale(t){if(t===0)return;if(t<0)throw new Error(`impossible change of scale: ${this.scale}`);let e=this._mapping.scale-t;this._positive.downscale(t),this._negative.downscale(t),this._mapping=re(e)}_minScale(t){let e=Math.min(this.scale,t.scale),r=k.combine(this._highLowAtScale(this.positive,this.scale,e),this._highLowAtScale(t.positive,t.scale,e)),s=k.combine(this._highLowAtScale(this.negative,this.scale,e),this._highLowAtScale(t.negative,t.scale,e));return Math.min(e-this._changeScale(r.high,r.low),e-this._changeScale(s.high,s.low))}_highLowAtScale(t,e,r){if(t.length===0)return new k(0,-1);let s=e-r;return new k(t.indexStart>>s,t.indexEnd>>s)}_mergeBuckets(t,e,r,s){let n=r.offset,a=e.scale-s;for(let o=0;o<r.length;o++)this._incrementIndexBy(t,n+o>>a,r.at(o))}_diffBuckets(t,e,r,s){let n=r.offset,a=e.scale-s;for(let o=0;o<r.length;o++){let c=(n+o>>a)-t.indexBase;c<0&&(c+=t.backing.length),t.decrementBucket(c,r.at(o))}t.trim()}},Z=class{kind=f.EXPONENTIAL_HISTOGRAM;_maxSize;_recordMinMax;constructor(t,e){this._maxSize=t,this._recordMinMax=e}createAccumulation(t){return new ft(t,this._maxSize,this._recordMinMax)}merge(t,e){let r=e.clone();return r.merge(t),r}diff(t,e){let r=e.clone();return r.diff(t),r}toMetricData(t,e,r,s){return{descriptor:t,aggregationTemporality:e,dataPointType:x.EXPONENTIAL_HISTOGRAM,dataPoints:r.map(([n,a])=>{let o=a.toPointValue(),l=t.type===h.GAUGE||t.type===h.UP_DOWN_COUNTER||t.type===h.OBSERVABLE_GAUGE||t.type===h.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:n,startTime:a.startTime,endTime:s,value:{min:o.hasMinMax?o.min:void 0,max:o.hasMinMax?o.max:void 0,sum:l?void 0:o.sum,positive:{offset:o.positive.offset,bucketCounts:o.positive.bucketCounts},negative:{offset:o.negative.offset,bucketCounts:o.negative.bucketCounts},count:o.count,scale:o.scale,zeroCount:o.zeroCount}}})}}}});var V,Q,qe=u(()=>{"use strict";U();R();E();V=class{startTime;_current;sampleTime;constructor(t,e=0,r=[0,0]){this.startTime=t,this._current=e,this.sampleTime=r}record(t){this._current=t,this.sampleTime=L(Date.now())}setStartTime(t){this.startTime=t}toPointValue(){return this._current}},Q=class{kind=f.LAST_VALUE;createAccumulation(t){return new V(t)}merge(t,e){let r=Y(e.sampleTime)>=Y(t.sampleTime)?e:t;return new V(t.startTime,r.toPointValue(),r.sampleTime)}diff(t,e){let r=Y(e.sampleTime)>=Y(t.sampleTime)?e:t;return new V(e.startTime,r.toPointValue(),r.sampleTime)}toMetricData(t,e,r,s){return{descriptor:t,aggregationTemporality:e,dataPointType:x.GAUGE,dataPoints:r.map(([n,a])=>({attributes:n,startTime:a.startTime,endTime:s,value:a.toPointValue()}))}}}});var b,F,je=u(()=>{"use strict";U();E();b=class{startTime;monotonic;_current;reset;constructor(t,e,r=0,s=!1){this.startTime=t,this.monotonic=e,this._current=r,this.reset=s}record(t){this.monotonic&&t<0||(this._current+=t)}setStartTime(t){this.startTime=t}toPointValue(){return this._current}},F=class{kind=f.SUM;monotonic;constructor(t){this.monotonic=t}createAccumulation(t){return new b(t,this.monotonic)}merge(t,e){let r=t.toPointValue(),s=e.toPointValue();return e.reset?new b(e.startTime,this.monotonic,s,e.reset):new b(t.startTime,this.monotonic,r+s)}diff(t,e){let r=t.toPointValue(),s=e.toPointValue();return this.monotonic&&r>s?new b(e.startTime,this.monotonic,s,!0):new b(e.startTime,this.monotonic,s-r)}toMetricData(t,e,r,s){return{descriptor:t,aggregationTemporality:e,dataPointType:x.SUM,dataPoints:r.map(([n,a])=>({attributes:n,startTime:a.startTime,endTime:s,value:a.toPointValue()})),isMonotonic:this.monotonic}}}});var Ke=u(()=>{"use strict";Ue();Be();Ye();qe();je()});var se,oe,ne,ae,tt,et,ce,ue,he,me,_e,Hi,Je,Ze=u(()=>{"use strict";g();Ke();E();se=class i{static DEFAULT_INSTANCE=new q;createAggregator(t){return i.DEFAULT_INSTANCE}},oe=class i{static MONOTONIC_INSTANCE=new F(!0);static NON_MONOTONIC_INSTANCE=new F(!1);createAggregator(t){switch(t.type){case h.COUNTER:case h.OBSERVABLE_COUNTER:case h.HISTOGRAM:return i.MONOTONIC_INSTANCE;default:return i.NON_MONOTONIC_INSTANCE}}},ne=class i{static DEFAULT_INSTANCE=new Q;createAggregator(t){return i.DEFAULT_INSTANCE}},ae=class i{static DEFAULT_INSTANCE=new G([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0);createAggregator(t){return i.DEFAULT_INSTANCE}},tt=class{_boundaries;_recordMinMax;constructor(t,e=!0){if(t==null)throw new Error("ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array");t=t.concat(),t=t.sort((n,a)=>n-a);let r=t.lastIndexOf(-1/0),s=t.indexOf(1/0);s===-1&&(s=void 0),this._boundaries=t.slice(r+1,s),this._recordMinMax=e}createAggregator(t){return new G(this._boundaries,this._recordMinMax)}},et=class{_maxSize;_recordMinMax;constructor(t=160,e=!0){this._maxSize=t,this._recordMinMax=e}createAggregator(t){return new Z(this._maxSize,this._recordMinMax)}},ce=class{_resolve(t){switch(t.type){case h.COUNTER:case h.UP_DOWN_COUNTER:case h.OBSERVABLE_COUNTER:case h.OBSERVABLE_UP_DOWN_COUNTER:return he;case h.GAUGE:case h.OBSERVABLE_GAUGE:return me;case h.HISTOGRAM:return t.advice.explicitBucketBoundaries?new tt(t.advice.explicitBucketBoundaries):_e}return m.warn(`Unable to recognize instrument type: ${t.type}`),ue}createAggregator(t){return this._resolve(t).createAggregator(t)}},ue=new se,he=new oe,me=new ne,_e=new ae,Hi=new et,Je=new ce});function xt(i){switch(i.type){case d.DEFAULT:return Je;case d.DROP:return ue;case d.SUM:return he;case d.LAST_VALUE:return me;case d.EXPONENTIAL_HISTOGRAM:{let t=i;return new et(t.options?.maxSize,t.options?.recordMinMax)}case d.EXPLICIT_BUCKET_HISTOGRAM:{let t=i;return t.options==null?_e:new tt(t.options?.boundaries,t.options?.recordMinMax)}default:throw new Error("Unsupported Aggregation")}}var d,rt=u(()=>{"use strict";Ze();(function(i){i[i.DEFAULT=0]="DEFAULT",i[i.DROP=1]="DROP",i[i.SUM=2]="SUM",i[i.LAST_VALUE=3]="LAST_VALUE",i[i.EXPLICIT_BUCKET_HISTOGRAM=4]="EXPLICIT_BUCKET_HISTOGRAM",i[i.EXPONENTIAL_HISTOGRAM=5]="EXPONENTIAL_HISTOGRAM"})(d||(d={}))});var Qe,St,de=u(()=>{"use strict";ut();rt();Qe=i=>({type:d.DEFAULT}),St=i=>y.CUMULATIVE});var tr,er,rr,ir,sr,pe=u(()=>{"use strict";tr="otel.component.name",er="otel.component.type",rr="periodic_metric_reader",ir="otel.sdk.metric_reader.collection.duration",sr="error.type"});var or,it,nr=u(()=>{"use strict";pe();or=new Map,it=class{collectionDuration;standardAttrs;constructor(t,e){let r=or.get(t)??0;or.set(t,r+1),this.standardAttrs={[er]:t,[tr]:`${t}/${r}`},this.collectionDuration=e.createHistogram(ir,{unit:"s",description:"The duration of the collect operation of the metric reader.",advice:{explicitBucketBoundaries:[]}})}recordCollection(t,e){let r=e?{...this.standardAttrs,[sr]:e}:this.standardAttrs;this.collectionDuration.record(t,r)}}});var ar,cr=u(()=>{"use strict";ar="2.11.0"});var N,Tt=u(()=>{"use strict";g();S();de();nr();cr();R();N=class{_shutdown=!1;_metricProducers;_sdkMetricProducer;_selfObsMetrics;_aggregationTemporalitySelector;_aggregationSelector;_cardinalitySelector;_otelComponentType;constructor(t){this._aggregationSelector=t?.aggregationSelector??Qe,this._aggregationTemporalitySelector=t?.aggregationTemporalitySelector??St,this._metricProducers=t?.metricProducers??[],this._cardinalitySelector=t?.cardinalitySelector,this._otelComponentType=t?.otelComponentType??this.constructor.name,this._selfObsMetrics=new it(this._otelComponentType,at())}setMetricProducer(t){if(this._sdkMetricProducer)throw new Error("MetricReader can not be bound to a MeterProvider again.");this._sdkMetricProducer=t,this.onInitialized()}_setSelfObsMeterProvider(t){let e=t.getMeter("@opentelemetry/sdk-metrics",ar);this._selfObsMetrics=new it(this._otelComponentType,e)}selectAggregation(t){return this._aggregationSelector(t)}selectAggregationTemporality(t){return this._aggregationTemporalitySelector(t)}selectCardinalityLimit(t){return this._cardinalitySelector?this._cardinalitySelector(t):2e3}onInitialized(){}async collect(t){if(this._sdkMetricProducer===void 0)throw new Error("MetricReader is not bound to a MetricProducer");if(this._shutdown)throw new Error("MetricReader is shutdown");let e=Kt(),[r,...s]=await Promise.all([this._sdkMetricProducer.collect({timeoutMillis:t?.timeoutMillis}),...this._metricProducers.map(_=>_.collect({timeoutMillis:t?.timeoutMillis}))]),n=Kt(),a=r.errors.concat(s.flatMap(_=>_.errors)),o=Ie(Ne(e,n));this._selfObsMetrics.recordCollection(o,a.length>0?a[0].name??"collect_error":void 0);let l=r.resourceMetrics.resource,c=r.resourceMetrics.scopeMetrics.concat(s.flatMap(_=>_.resourceMetrics.scopeMetrics));return{resourceMetrics:{resource:l,scopeMetrics:c},errors:a}}async shutdown(t){if(this._shutdown){m.error("Cannot call shutdown twice.");return}t?.timeoutMillis==null?await this.onShutdown():await A(this.onShutdown(),t.timeoutMillis),this._shutdown=!0}async forceFlush(t){if(this._shutdown){m.warn("Cannot forceFlush on already shutdown MetricReader.");return}if(t?.timeoutMillis==null){await this.onForceFlush();return}await A(this.onForceFlush(),t.timeoutMillis)}}});function lr(i,t){if(!Number.isInteger(t)||t<=0)throw new Error("maxExportBatchSize must be a positive integer");let e=[],r=0,s=[];function n(){s.length>0&&(e.push({resource:i.resource,scopeMetrics:s}),s=[],r=0)}for(let a of i.scopeMetrics){let o=null;for(let l of a.metrics){let c=l.dataPoints;if(c.length===0){o||(o={scope:a.scope,metrics:[]},s.push(o)),o.metrics.push(l);continue}let _=0;for(;_<c.length;){let O=t-r,P=Math.min(O,c.length-_);o||(o={scope:a.scope,metrics:[]},s.push(o));let Br={...l,dataPoints:c.slice(_,_+P)};o.metrics.push(Br),_+=P,r+=P,r===t&&(n(),o=null)}}}return n(),e}var ur=u(()=>{"use strict"});var Mt,hr=u(()=>{"use strict";g();R();Tt();S();E();ur();pe();Mt=class extends N{_interval;_exporter;_exportInterval;_exportTimeout;_maxExportBatchSize;_ongoingExportPromise=null;constructor(t){let{exporter:e,exportIntervalMillis:r=6e4,metricProducers:s,cardinalityLimits:n,maxExportBatchSize:a}=t,{exportTimeoutMillis:o=3e4}=t;if(super({aggregationSelector:e.selectAggregation?.bind(e),aggregationTemporalitySelector:e.selectAggregationTemporality?.bind(e),otelComponentType:rr,metricProducers:s,cardinalitySelector:l=>{let c={default:2e3,...n};switch(l){case h.COUNTER:return c.counter??c.default;case h.GAUGE:return c.gauge??c.default;case h.HISTOGRAM:return c.histogram??c.default;case h.OBSERVABLE_COUNTER:return c.observableCounter??c.default;case h.OBSERVABLE_UP_DOWN_COUNTER:return c.observableUpDownCounter??c.default;case h.OBSERVABLE_GAUGE:return c.observableGauge??c.default;case h.UP_DOWN_COUNTER:return c.upDownCounter??c.default;default:return c.default}}}),r<=0)throw Error("exportIntervalMillis must be greater than 0");if(o<=0)throw Error("exportTimeoutMillis must be greater than 0");if(a!==void 0&&(!Number.isInteger(a)||a<=0))throw Error("maxExportBatchSize must be a positive integer");if(r<o){if("exportIntervalMillis"in t&&"exportTimeoutMillis"in t)throw Error("exportIntervalMillis must be greater than or equal to exportTimeoutMillis");m.info(`Timeout of ${o} exceeds the interval of ${r}. Clamping timeout to interval duration.`),o=r}this._exportInterval=r,this._exportTimeout=o,this._exporter=e,this._maxExportBatchSize=a}async _runOnce(){try{await this._doRun()}catch(t){jt(t)}}async _doRun(){if(this._ongoingExportPromise){m.debug("PeriodicExportingMetricReader: export already in progress, skipping");return}let t=async()=>{let{resourceMetrics:e,errors:r}=await this.collect({timeoutMillis:this._exportTimeout});if(r.length>0&&m.error("PeriodicExportingMetricReader: metrics collection errors",...r),e.resource.asyncAttributesPending)try{await e.resource.waitForAsyncAttributes?.()}catch(a){m.debug("Error while resolving async portion of resource: ",a),jt(a)}if(e.scopeMetrics.length===0)return;let s=this._maxExportBatchSize?lr(e,this._maxExportBatchSize):[e],n=null;for(let a of s)try{let o=await A(Oe._export(this._exporter,a),this._exportTimeout);o.code!==w.SUCCESS&&(n=new Error(`PeriodicExportingMetricReader: metrics export failed (error ${o.error})`))}catch(o){if(o instanceof v){m.error(`PeriodicExportingMetricReader: metrics export timed out after ${this._exportTimeout}ms`);break}else m.error("PeriodicExportingMetricReader: metrics export threw error",o),n=o instanceof Error?o:new Error(String(o))}if(n)throw n};this._ongoingExportPromise=t();try{await this._ongoingExportPromise}finally{this._ongoingExportPromise=null}}onInitialized(){this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),typeof this._interval!="number"&&this._interval.unref()}async onForceFlush(){await this._awaitOngoingExport(),this._ongoingExportPromise?await this._awaitOngoingExport():await this._runOnce(),await this._exporter.forceFlush()}async _awaitOngoingExport(){if(this._ongoingExportPromise){m.debug("PeriodicExportingMetricReader: export already in progress, awaiting ongoing export");try{await this._ongoingExportPromise}catch{}}}async onShutdown(){this._interval&&clearInterval(this._interval),await this.onForceFlush(),await this._exporter.shutdown()}}});var Et,mr=u(()=>{"use strict";R();de();Et=class i{_shutdown=!1;_temporalitySelector;constructor(t){this._temporalitySelector=t?.temporalitySelector??St}export(t,e){if(this._shutdown){e({code:w.FAILED});return}return i._sendMetrics(t,e)}forceFlush(){return Promise.resolve()}selectAggregationTemporality(t){return this._temporalitySelector(t)}shutdown(){return this._shutdown=!0,Promise.resolve()}static _sendMetrics(t,e){for(let r of t.scopeMetrics)for(let s of r.metrics)console.dir({descriptor:s.descriptor,dataPointType:s.dataPointType,dataPoints:s.dataPoints},{depth:null});e({code:w.SUCCESS})}}});var wt,_r=u(()=>{"use strict";wt=class{_registeredViews=[];addView(t){this._registeredViews.push(t)}findViews(t,e){return this._registeredViews.filter(s=>this._matchInstrument(s.instrumentSelector,t)&&this._matchMeter(s.meterSelector,e))}_matchInstrument(t,e){return(t.getType()===void 0||e.type===t.getType())&&t.getNameFilter().match(e.name)&&t.getUnitFilter().match(e.unit)}_matchMeter(t,e){return t.getNameFilter().match(e.name)&&(e.version===void 0||t.getVersionFilter().match(e.version))&&(e.schemaUrl===void 0||t.getSchemaUrlFilter().match(e.schemaUrl))}}});function M(i,t,e){return Hr(i)||m.warn(`Invalid metric name: "${i}". The metric name should be a ASCII string with a length no greater than 255 characters.`),{name:i,type:t,description:e?.description??"",unit:e?.unit??"",valueType:e?.valueType??C.DOUBLE,advice:e?.advice??{}}}function dr(i,t){return{name:i.name??t.name,description:i.description??t.description,type:t.type,unit:t.unit,valueType:t.valueType,advice:t.advice}}function pr(i,t){return Le(i.name,t.name)&&i.unit===t.unit&&i.type===t.type&&i.valueType===t.valueType}function Hr(i){return zr.test(i)}var zr,st=u(()=>{"use strict";g();S();zr=/^[a-z][a-z0-9_.\-/]{0,254}$/i});function ot(i){return i instanceof $}var D,At,yt,bt,Nt,$,It,Ot,Ct,Rt=u(()=>{"use strict";g();D=class{_writableMetricStorage;_descriptor;constructor(t,e){this._writableMetricStorage=t,this._descriptor=e}_record(t,e={},r){if(typeof t!="number"){m.warn(`non-number value provided to metric ${this._descriptor.name}: ${t}`);return}this._descriptor.valueType===C.INT&&!Number.isInteger(t)&&(m.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||this._writableMetricStorage.record(t,e,r,Date.now())}},At=class extends D{add(t,e,r){this._record(t,e,r)}},yt=class extends D{add(t,e,r){if(t<0){m.warn(`negative value provided to counter ${this._descriptor.name}: ${t}`);return}this._record(t,e,r)}},bt=class extends D{record(t,e,r){this._record(t,e,r)}},Nt=class extends D{record(t,e,r){if(t<0){m.warn(`negative value provided to histogram ${this._descriptor.name}: ${t}`);return}this._record(t,e,r)}},$=class{_metricStorages;_descriptor;_observableRegistry;constructor(t,e,r){this._descriptor=t,this._metricStorages=e,this._observableRegistry=r}addCallback(t){this._observableRegistry.addCallback(t,this)}removeCallback(t){this._observableRegistry.removeCallback(t,this)}},It=class extends ${},Ot=class extends ${},Ct=class extends ${}});var vt,gr=u(()=>{"use strict";st();Rt();E();vt=class{_meterSharedState;constructor(t){this._meterSharedState=t}createGauge(t,e){let r=M(t,h.GAUGE,e),s=this._meterSharedState.registerMetricStorage(r);return new bt(s,r)}createHistogram(t,e){let r=M(t,h.HISTOGRAM,e),s=this._meterSharedState.registerMetricStorage(r);return new Nt(s,r)}createCounter(t,e){let r=M(t,h.COUNTER,e),s=this._meterSharedState.registerMetricStorage(r);return new yt(s,r)}createUpDownCounter(t,e){let r=M(t,h.UP_DOWN_COUNTER,e),s=this._meterSharedState.registerMetricStorage(r);return new At(s,r)}createObservableGauge(t,e){let r=M(t,h.OBSERVABLE_GAUGE,e),s=this._meterSharedState.registerAsyncMetricStorage(r);return new Ot(r,s,this._meterSharedState.observableRegistry)}createObservableCounter(t,e){let r=M(t,h.OBSERVABLE_COUNTER,e),s=this._meterSharedState.registerAsyncMetricStorage(r);return new It(r,s,this._meterSharedState.observableRegistry)}createObservableUpDownCounter(t,e){let r=M(t,h.OBSERVABLE_UP_DOWN_COUNTER,e),s=this._meterSharedState.registerAsyncMetricStorage(r);return new Ct(r,s,this._meterSharedState.observableRegistry)}addBatchObservableCallback(t,e){this._meterSharedState.observableRegistry.addBatchCallback(t,e)}removeBatchObservableCallback(t,e){this._meterSharedState.observableRegistry.removeBatchCallback(t,e)}}});var z,ge=u(()=>{"use strict";st();z=class{_instrumentDescriptor;constructor(t){this._instrumentDescriptor=t}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(t){this._instrumentDescriptor=M(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:t,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}}});var fe,p,nt=u(()=>{"use strict";S();fe=class{_valueMap=new Map;_keyMap=new Map;_hash;constructor(t){this._hash=t}get(t,e){return e??=this._hash(t),this._valueMap.get(e)}getOrDefault(t,e){let r=this._hash(t);if(this._valueMap.has(r))return this._valueMap.get(r);let s=e();return this._keyMap.has(r)||this._keyMap.set(r,t),this._valueMap.set(r,s),s}set(t,e,r){r??=this._hash(t),this._keyMap.has(r)||this._keyMap.set(r,t),this._valueMap.set(r,e)}has(t,e){return e??=this._hash(t),this._valueMap.has(e)}*keys(){let t=this._keyMap.entries(),e=t.next();for(;e.done!==!0;)yield[e.value[1],e.value[0]],e=t.next()}*entries(){let t=this._valueMap.entries(),e=t.next();for(;e.done!==!0;)yield[this._keyMap.get(e.value[0]),e.value[1],e.value[0]],e=t.next()}get size(){return this._valueMap.size}},p=class extends fe{constructor(){super(lt)}}});var H,xe=u(()=>{"use strict";R();S();nt();H=class{_activeCollectionStorage=new p;_cumulativeMemoStorage=new p;_cardinalityLimit;_overflowAttributes={"otel.metric.overflow":!0};_overflowHashCode;_aggregator;constructor(t,e){this._aggregator=t,this._cardinalityLimit=(e??2e3)-1,this._overflowHashCode=lt(this._overflowAttributes)}record(t,e,r){let s=this._activeCollectionStorage.get(e);if(!s){let n=L(r);if(this._activeCollectionStorage.size>=this._cardinalityLimit){this._activeCollectionStorage.getOrDefault(this._overflowAttributes,()=>this._aggregator.createAccumulation(n))?.record(t);return}s=this._aggregator.createAccumulation(n),this._activeCollectionStorage.set(e,s)}s?.record(t)}batchCumulate(t,e){for(let[r,s,n]of t.entries()){let a=r,o=n,l=this._aggregator.createAccumulation(e);l?.record(s);let c=l;if(this._cumulativeMemoStorage.has(a,o)){let _=this._cumulativeMemoStorage.get(a,o);c=this._aggregator.diff(_,l)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit&&(a=this._overflowAttributes,o=this._overflowHashCode,this._cumulativeMemoStorage.has(a,o))){let _=this._cumulativeMemoStorage.get(a,o);c=this._aggregator.diff(_,l)}if(this._activeCollectionStorage.has(a,o)){let _=this._activeCollectionStorage.get(a,o);c=this._aggregator.merge(_,c)}this._cumulativeMemoStorage.set(a,l,o),this._activeCollectionStorage.set(a,c,o)}}collect(){let t=this._activeCollectionStorage;return this._activeCollectionStorage=new p,t}}});function Xr(i){return Array.from(i.entries())}var X,Se=u(()=>{"use strict";ut();nt();X=class i{_aggregator;_unreportedAccumulations=new Map;_reportHistory=new Map;constructor(t,e){this._aggregator=t,e.forEach(r=>{this._unreportedAccumulations.set(r,[])})}buildMetrics(t,e,r,s){this._stashAccumulations(r);let n=this._getMergedUnreportedAccumulations(t),a=n,o;if(this._reportHistory.has(t)){let c=this._reportHistory.get(t),_=c.collectionTime;o=c.aggregationTemporality,o===y.CUMULATIVE?a=i.merge(c.accumulations,n,this._aggregator):a=i.calibrateStartTime(c.accumulations,n,_)}else o=t.selectAggregationTemporality(e.type);this._reportHistory.set(t,{accumulations:a,collectionTime:s,aggregationTemporality:o});let l=Xr(a);if(l.length!==0)return this._aggregator.toMetricData(e,o,l,s)}_stashAccumulations(t){let e=this._unreportedAccumulations.keys();for(let r of e){let s=this._unreportedAccumulations.get(r);s===void 0&&(s=[],this._unreportedAccumulations.set(r,s)),s.push(t)}}_getMergedUnreportedAccumulations(t){let e=new p,r=this._unreportedAccumulations.get(t);if(this._unreportedAccumulations.set(t,[]),r===void 0)return e;for(let s of r)e=i.merge(e,s,this._aggregator);return e}static merge(t,e,r){let s=t,n=e.entries(),a=n.next();for(;a.done!==!0;){let[o,l,c]=a.value;if(t.has(o,c)){let _=t.get(o,c),O=r.merge(_,l);s.set(o,O,c)}else s.set(o,l,c);a=n.next()}return s}static calibrateStartTime(t,e,r){for(let[s,n]of t.keys())e.get(s,n)?.setStartTime(r);return e}}});var Pt,fr=u(()=>{"use strict";ge();xe();Se();nt();Pt=class extends z{_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;_attributesProcessor;constructor(t,e,r,s,n){super(t),this._aggregationCardinalityLimit=n,this._deltaMetricStorage=new H(e,this._aggregationCardinalityLimit),this._temporalMetricStorage=new X(e,s),this._attributesProcessor=r}record(t,e){if(this._attributesProcessor===void 0){this._deltaMetricStorage.batchCumulate(t,e);return}let r=new p;for(let[s,n]of t.entries())r.set(this._attributesProcessor.process(s),n);this._deltaMetricStorage.batchCumulate(r,e)}collect(t,e){let r=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(t,this._instrumentDescriptor,r,e)}}});function Te(i,t){let e="";return i.unit!==t.unit&&(e+=` - Unit '${i.unit}' does not match '${t.unit}'
5
- `),i.type!==t.type&&(e+=` - Type '${i.type}' does not match '${t.type}'
6
- `),i.valueType!==t.valueType&&(e+=` - Value Type '${i.valueType}' does not match '${t.valueType}'
7
- `),i.description!==t.description&&(e+=` - Description '${i.description}' does not match '${t.description}'
8
- `),e}function Wr(i,t){return` - use valueType '${i.valueType}' on instrument creation or use an instrument name other than '${t.name}'`}function Yr(i,t){return` - use unit '${i.unit}' on instrument creation or use an instrument name other than '${t.name}'`}function qr(i,t){let e={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(e);return` - create a new view with a name other than '${i.name}' and InstrumentSelector '${r}'`}function jr(i,t){let e={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(e);return` - create a new view with a name other than '${i.name}' and InstrumentSelector '${r}'
9
- - OR - create a new view with the name ${i.name} and description '${i.description}' and InstrumentSelector ${r}
10
- - OR - create a new view with the name ${t.name} and description '${i.description}' and InstrumentSelector ${r}`}function Me(i,t){return i.valueType!==t.valueType?Wr(i,t):i.unit!==t.unit?Yr(i,t):i.type!==t.type?qr(i,t):i.description!==t.description?jr(i,t):""}var xr=u(()=>{"use strict"});var Lt,Sr=u(()=>{"use strict";st();g();xr();Lt=class i{_sharedRegistry=new Map;_perCollectorRegistry=new Map;static create(){return new i}getStorages(t){let e=[];for(let s of this._sharedRegistry.values())e=e.concat(s);let r=this._perCollectorRegistry.get(t);if(r!=null)for(let s of r.values())e=e.concat(s);return e}register(t){this._registerStorage(t,this._sharedRegistry)}registerForCollector(t,e){let r=this._perCollectorRegistry.get(t);r==null&&(r=new Map,this._perCollectorRegistry.set(t,r)),this._registerStorage(e,r)}findOrUpdateCompatibleStorage(t){let e=this._sharedRegistry.get(t.name);return e===void 0?null:this._findOrUpdateCompatibleStorage(t,e)}findOrUpdateCompatibleCollectorStorage(t,e){let r=this._perCollectorRegistry.get(t);if(r===void 0)return null;let s=r.get(e.name);return s===void 0?null:this._findOrUpdateCompatibleStorage(e,s)}_registerStorage(t,e){let r=t.getInstrumentDescriptor(),s=e.get(r.name);if(s===void 0){e.set(r.name,[t]);return}s.push(t)}_findOrUpdateCompatibleStorage(t,e){let r=null;for(let s of e){let n=s.getInstrumentDescriptor();pr(n,t)?(n.description!==t.description&&(t.description.length>n.description.length&&s.updateDescription(t.description),m.warn("A view or instrument with the name ",t.name,` has already been registered, but has a different description and is incompatible with another registered view.
11
- `,`Details:
12
- `,Te(n,t),`The longer description will be used.
13
- To resolve the conflict:`,Me(n,t))),r=s):m.warn("A view or instrument with the name ",t.name,` has already been registered and is incompatible with another registered view.
14
- `,`Details:
15
- `,Te(n,t),`To resolve the conflict:
16
- `,Me(n,t))}return r}}});var Ut,Tr=u(()=>{"use strict";g();Ut=class{_backingStorages;hasAttributeProcessor;constructor(t){this._backingStorages=t,this.hasAttributeProcessor=t.some(e=>e.hasAttributeProcessor)}record(t,e,r,s){this.hasAttributeProcessor&&r===void 0&&(r=ct.active());let n=this._backingStorages;for(let a=0;a<n.length;a++)n[a].record(t,e,r,s)}}});var Bt,Gt,Mr=u(()=>{"use strict";g();nt();Rt();Bt=class{_buffer=new p;_instrumentName;_valueType;constructor(t,e){this._instrumentName=t,this._valueType=e}observe(t,e={}){if(typeof t!="number"){m.warn(`non-number value provided to metric ${this._instrumentName}: ${t}`);return}this._valueType===C.INT&&!Number.isInteger(t)&&(m.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||this._buffer.set(e,t)}},Gt=class{_buffer=new Map;observe(t,e,r={}){if(!ot(t))return;let s=this._buffer.get(t);if(s==null&&(s=new p,this._buffer.set(t,s)),typeof e!="number"){m.warn(`non-number value provided to metric ${t._descriptor.name}: ${e}`);return}t._descriptor.valueType===C.INT&&!Number.isInteger(e)&&(m.warn(`INT value type cannot accept a floating-point value for ${t._descriptor.name}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||s.set(r,e)}}});var kt,Er=u(()=>{"use strict";g();Rt();Mr();S();kt=class{_callbacks=[];_batchCallbacks=[];addCallback(t,e){this._findCallback(t,e)>=0||this._callbacks.push({callback:t,instrument:e})}removeCallback(t,e){let r=this._findCallback(t,e);r<0||this._callbacks.splice(r,1)}addBatchCallback(t,e){let r=new Set(e.filter(ot));if(r.size===0){m.error("BatchObservableCallback is not associated with valid instruments",e);return}this._findBatchCallback(t,r)>=0||this._batchCallbacks.push({callback:t,instruments:r})}removeBatchCallback(t,e){let r=new Set(e.filter(ot)),s=this._findBatchCallback(t,r);s<0||this._batchCallbacks.splice(s,1)}async observe(t,e){let r=this._observeCallbacks(t,e),s=this._observeBatchCallbacks(t,e);return(await Promise.allSettled([...r,...s])).filter(o=>o.status==="rejected").map(o=>o.reason)}_observeCallbacks(t,e){return this._callbacks.map(async({callback:r,instrument:s})=>{let n=new Bt(s._descriptor.name,s._descriptor.valueType),a=Promise.resolve(r(n));e!=null&&(a=A(a,e)),await a,s._metricStorages.forEach(o=>{o.record(n._buffer,t)})})}_observeBatchCallbacks(t,e){return this._batchCallbacks.map(async({callback:r,instruments:s})=>{let n=new Gt,a=Promise.resolve(r(n));e!=null&&(a=A(a,e)),await a,s.forEach(o=>{let l=n._buffer.get(o);l!=null&&o._metricStorages.forEach(c=>{c.record(l,t)})})})}_findCallback(t,e){return this._callbacks.findIndex(r=>r.callback===t&&r.instrument===e)}_findBatchCallback(t,e){return this._batchCallbacks.findIndex(r=>r.callback===t&&ve(r.instruments,e))}}});var Vt,wr=u(()=>{"use strict";g();ge();xe();Se();Vt=class extends z{_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;_attributesProcessor;constructor(t,e,r,s,n){super(t),this._aggregationCardinalityLimit=n,this._deltaMetricStorage=new H(e,this._aggregationCardinalityLimit),this._temporalMetricStorage=new X(e,s),this._attributesProcessor=r,this.hasAttributeProcessor=r!==void 0}hasAttributeProcessor;record(t,e,r,s){this._attributesProcessor!==void 0&&(e=this._attributesProcessor.process(e,r??ct.active())),this._deltaMetricStorage.record(t,e,s)}collect(t,e){let r=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(t,this._instrumentDescriptor,r,e)}}});var Ft,Ar=u(()=>{"use strict";st();gr();fr();Sr();Tr();Er();wr();Ft=class{metricStorageRegistry=new Lt;observableRegistry=new kt;meter;_meterProviderSharedState;_instrumentationScope;constructor(t,e){this.meter=new vt(this),this._meterProviderSharedState=t,this._instrumentationScope=e}registerMetricStorage(t){let e=this._registerMetricStorage(t,Vt);return e.length===1?e[0]:new Ut(e)}registerAsyncMetricStorage(t){return this._registerMetricStorage(t,Pt)}async collect(t,e,r){let s=await this.observableRegistry.observe(e,r?.timeoutMillis),n=this.metricStorageRegistry.getStorages(t);if(n.length===0)return null;let a=[];return n.forEach(o=>{let l=o.collect(t,e);l!=null&&a.push(l)}),a.length===0?{errors:s}:{scopeMetrics:{scope:this._instrumentationScope,metrics:a},errors:s}}_registerMetricStorage(t,e){let s=this._meterProviderSharedState.viewRegistry.findViews(t,this._instrumentationScope).map(n=>{let a=dr(n,t),o=this.metricStorageRegistry.findOrUpdateCompatibleStorage(a);if(o!=null)return o;let l=n.aggregation.createAggregator(a),c=new e(a,l,n.attributesProcessor,this._meterProviderSharedState.metricCollectors,n.aggregationCardinalityLimit);return this.metricStorageRegistry.register(c),c});if(s.length===0){let a=this._meterProviderSharedState.selectAggregations(t.type).map(([o,l])=>{let c=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(o,t);if(c!=null)return c;let _=l.createAggregator(t),O=o.selectCardinalityLimit(t.type),P=new e(t,_,void 0,[o],O);return this.metricStorageRegistry.registerForCollector(o,P),P});s=s.concat(a)}return s}}});var Dt,yr=u(()=>{"use strict";S();_r();Ar();rt();Dt=class{viewRegistry=new wt;metricCollectors=[];meterSharedStates=new Map;resource;constructor(t){this.resource=t}getMeterSharedState(t){let e=Re(t),r=this.meterSharedStates.get(e);return r==null&&(r=new Ft(this,t),this.meterSharedStates.set(e,r)),r}selectAggregations(t){let e=[];for(let r of this.metricCollectors)e.push([r,xt(r.selectAggregation(t))]);return e}}});var $t,br=u(()=>{"use strict";R();$t=class{_sharedState;_metricReader;constructor(t,e){this._sharedState=t,this._metricReader=e}async collect(t){let e=L(Date.now()),r=[],s=[],n=Array.from(this._sharedState.meterSharedStates.values()).map(async a=>{let o=await a.collect(this,e,t);o?.scopeMetrics!=null&&r.push(o.scopeMetrics),o?.errors!=null&&s.push(...o.errors)});return await Promise.all(n),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:r},errors:s}}async forceFlush(t){await this._metricReader.forceFlush(t)}async shutdown(t){await this._metricReader.shutdown(t)}selectAggregationTemporality(t){return this._metricReader.selectAggregationTemporality(t)}selectAggregation(t){return this._metricReader.selectAggregation(t)}selectCardinalityLimit(t){return this._metricReader.selectCardinalityLimit?.(t)??2e3}}});var Kr,W,I,zt=u(()=>{"use strict";Kr=/[\^$\\.+?()[\]{}|]/g,W=class i{_matchAll;_regexp;constructor(t){t==="*"?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(i.escapePattern(t)))}match(t){return this._matchAll?!0:this._regexp.test(t)}static escapePattern(t){return`^${t.replace(Kr,"\\$&").replace("*",".*")}$`}static hasWildcard(t){return t.includes("*")}},I=class{_matchAll;_pattern;constructor(t){this._matchAll=t===void 0,this._pattern=t}match(t){return!!(this._matchAll||t===this._pattern)}}});function Nr(){return Jr}function Ir(i){return new we(i)}function Or(i){return new Ae(i)}function Cr(i){return new ye(i)}var Ee,we,Ae,ye,Jr,be=u(()=>{"use strict";Ee=class{process(t,e){return t}},we=class{_processors;constructor(t){this._processors=t}process(t,e){let r=t;for(let s of this._processors)r=s.process(r,e);return r}},Ae=class{_allowedAttributeNames;constructor(t){this._allowedAttributeNames=new Set(t)}process(t,e){let r={};for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&this._allowedAttributeNames.has(s)&&(r[s]=t[s]);return r}},ye=class{_deniedAttributeNames;constructor(t){this._deniedAttributeNames=new Set(t)}process(t,e){let r={};for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&!this._deniedAttributeNames.has(s)&&(r[s]=t[s]);return r}};Jr=new Ee});var Ht,Rr=u(()=>{"use strict";zt();Ht=class{_nameFilter;_type;_unitFilter;constructor(t){this._nameFilter=new W(t?.name??"*"),this._type=t?.type,this._unitFilter=new I(t?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}}});var Xt,vr=u(()=>{"use strict";zt();Xt=class{_nameFilter;_versionFilter;_schemaUrlFilter;constructor(t){this._nameFilter=new I(t?.name),this._versionFilter=new I(t?.version),this._schemaUrlFilter=new I(t?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}}});function Zr(i){return i.instrumentName==null&&i.instrumentType==null&&i.instrumentUnit==null&&i.meterName==null&&i.meterVersion==null&&i.meterSchemaUrl==null}function Qr(i){if(Zr(i))throw new Error("Cannot create view with no selector arguments supplied");if(i.name!=null&&(i?.instrumentName==null||W.hasWildcard(i.instrumentName)))throw new Error("Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.")}var Wt,Pr=u(()=>{"use strict";zt();be();Rr();vr();rt();Wt=class{name;description;aggregation;attributesProcessor;instrumentSelector;meterSelector;aggregationCardinalityLimit;constructor(t){Qr(t),t.attributesProcessors!=null?this.attributesProcessor=Ir(t.attributesProcessors):this.attributesProcessor=Nr(),this.name=t.name,this.description=t.description,this.aggregation=xt(t.aggregation??{type:d.DEFAULT}),this.instrumentSelector=new Ht({name:t.instrumentName,type:t.instrumentType,unit:t.instrumentUnit}),this.meterSelector=new Xt({name:t.meterName,version:t.meterVersion,schemaUrl:t.meterSchemaUrl}),this.aggregationCardinalityLimit=t.aggregationCardinalityLimit}}});var Yt,Lr=u(()=>{"use strict";g();kr();Tt();yr();br();Pr();Yt=class{_sharedState;_shutdown=!1;constructor(t){if(this._sharedState=new Dt(t?.resource??Ce()),t?.views!=null&&t.views.length>0)for(let e of t.views)this._sharedState.viewRegistry.addView(new Wt(e));if(t?.readers!=null&&t.readers.length>0)for(let e of t.readers){let r=new $t(this._sharedState,e);e.setMetricProducer(r),this._sharedState.metricCollectors.push(r),t.sdkMetricsEnabled&&e instanceof N&&e._setSelfObsMeterProvider(this)}}getMeter(t,e="",r={}){return this._shutdown?(m.warn("A shutdown MeterProvider cannot provide a Meter"),at()):this._sharedState.getMeterSharedState({name:t,version:e,schemaUrl:r.schemaUrl}).meter}async shutdown(t){if(this._shutdown){m.warn("shutdown may only be called once per MeterProvider");return}this._shutdown=!0,await Promise.all(this._sharedState.metricCollectors.map(e=>e.shutdown(t)))}async forceFlush(t){if(this._shutdown){m.warn("invalid attempt to force flush after MeterProvider shutdown");return}await Promise.all(this._sharedState.metricCollectors.map(e=>e.forceFlush(t)))}}});var qt,Ur=u(()=>{"use strict";R();qt=class{_shutdown=!1;_aggregationTemporality;_metrics=[];constructor(t){this._aggregationTemporality=t}export(t,e){if(this._shutdown){setTimeout(()=>e({code:w.FAILED}),0);return}this._metrics.push(t),setTimeout(()=>e({code:w.SUCCESS}),0)}getMetrics(){return this._metrics}forceFlush(){return Promise.resolve()}reset(){this._metrics=[]}selectAggregationTemporality(t){return this._aggregationTemporality}shutdown(){return this._shutdown=!0,Promise.resolve()}}});var ti={};Gr(ti,{AggregationTemporality:()=>y,AggregationType:()=>d,ConsoleMetricExporter:()=>Et,DataPointType:()=>x,InMemoryMetricExporter:()=>qt,InstrumentType:()=>h,MeterProvider:()=>Yt,MetricReader:()=>N,PeriodicExportingMetricReader:()=>Mt,TimeoutError:()=>v,createAllowListAttributesProcessor:()=>Or,createDenyListAttributesProcessor:()=>Cr});var ei=u(()=>{"use strict";ut();E();Tt();hr();Ur();mr();Lr();rt();be();S()});export{y as a,h as b,x as c,d,Mt as e,Et as f,Yt as g,ti as h,ei as i};