@grafana/faro-web-tracing 1.14.3 → 1.16.0

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 (44) hide show
  1. package/dist/bundle/faro-web-tracing.iife.js +1 -1
  2. package/dist/bundle/types/instrumentationUtils.d.ts +1 -1
  3. package/dist/bundle/types/semconv.d.ts +11 -0
  4. package/dist/bundle/types/types.d.ts +2 -3
  5. package/dist/cjs/faroMetaAttributesSpanProcessor.js +2 -4
  6. package/dist/cjs/faroMetaAttributesSpanProcessor.js.map +1 -1
  7. package/dist/cjs/faroTraceExporter.utils.js +1 -2
  8. package/dist/cjs/faroTraceExporter.utils.js.map +1 -1
  9. package/dist/cjs/faroUserActionSpanProcessor.js +2 -2
  10. package/dist/cjs/faroUserActionSpanProcessor.js.map +1 -1
  11. package/dist/cjs/faroXhrInstrumentation.js +8 -8
  12. package/dist/cjs/faroXhrInstrumentation.js.map +1 -1
  13. package/dist/cjs/getDefaultOTELInstrumentations.js +1 -2
  14. package/dist/cjs/getDefaultOTELInstrumentations.js.map +1 -1
  15. package/dist/cjs/instrumentation.js +4 -4
  16. package/dist/cjs/instrumentation.js.map +1 -1
  17. package/dist/cjs/instrumentationUtils.js +4 -5
  18. package/dist/cjs/instrumentationUtils.js.map +1 -1
  19. package/dist/cjs/sampler.js +1 -2
  20. package/dist/cjs/sampler.js.map +1 -1
  21. package/dist/cjs/semconv.js +15 -0
  22. package/dist/cjs/semconv.js.map +1 -0
  23. package/dist/cjs/sessionSpanProcessor.js +2 -4
  24. package/dist/cjs/sessionSpanProcessor.js.map +1 -1
  25. package/dist/cjs/types.js.map +1 -1
  26. package/dist/esm/faroMetaAttributesSpanProcessor.js +1 -3
  27. package/dist/esm/faroMetaAttributesSpanProcessor.js.map +1 -1
  28. package/dist/esm/faroTraceExporter.utils.js.map +1 -1
  29. package/dist/esm/faroUserActionSpanProcessor.js +3 -3
  30. package/dist/esm/faroUserActionSpanProcessor.js.map +1 -1
  31. package/dist/esm/faroXhrInstrumentation.js +8 -8
  32. package/dist/esm/faroXhrInstrumentation.js.map +1 -1
  33. package/dist/esm/instrumentation.js +3 -6
  34. package/dist/esm/instrumentation.js.map +1 -1
  35. package/dist/esm/instrumentationUtils.js.map +1 -1
  36. package/dist/esm/semconv.js +12 -0
  37. package/dist/esm/semconv.js.map +1 -0
  38. package/dist/esm/sessionSpanProcessor.js +1 -3
  39. package/dist/esm/sessionSpanProcessor.js.map +1 -1
  40. package/dist/esm/types.js.map +1 -1
  41. package/dist/types/instrumentationUtils.d.ts +1 -1
  42. package/dist/types/semconv.d.ts +11 -0
  43. package/dist/types/types.d.ts +2 -3
  44. package/package.json +11 -11
@@ -1 +1 @@
1
- var GrafanaFaroWebTracing=function(t,e){"use strict";var n="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{},r="1.9.0",o=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;var i=function(t){var e=new Set([t]),n=new Set,r=t.match(o);if(!r)return function(){return!1};var i=+r[1],a=+r[2],s=+r[3];if(null!=r[4])return function(e){return e===t};function u(t){return n.add(t),!1}function c(t){return e.add(t),!0}return function(t){if(e.has(t))return!0;if(n.has(t))return!1;var r=t.match(o);if(!r)return u(t);var l=+r[1],p=+r[2],f=+r[3];return null!=r[4]||i!==l?u(t):0===i?a===p&&s<=f?c(t):u(t):a<=p?c(t):u(t)}}(r),a=r.split(".")[0],s=Symbol.for("opentelemetry.js.api."+a),u=n;function c(t,e,n,o){var i;void 0===o&&(o=!1);var a=u[s]=null!==(i=u[s])&&void 0!==i?i:{version:r};if(!o&&a[t]){var c=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+t);return n.error(c.stack||c.message),!1}if(a.version!==r){c=new Error("@opentelemetry/api: Registration of version v"+a.version+" for "+t+" does not match previously registered API v"+r);return n.error(c.stack||c.message),!1}return a[t]=e,n.debug("@opentelemetry/api: Registered a global for "+t+" v"+r+"."),!0}function l(t){var e,n,r=null===(e=u[s])||void 0===e?void 0:e.version;if(r&&i(r))return null===(n=u[s])||void 0===n?void 0:n[t]}function p(t,e){e.debug("@opentelemetry/api: Unregistering a global for "+t+" v"+r+".");var n=u[s];n&&delete n[t]}var f,d=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},h=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},_=function(){function t(t){this._namespace=t.namespace||"DiagComponentLogger"}return t.prototype.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return v("debug",this._namespace,t)},t.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return v("error",this._namespace,t)},t.prototype.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return v("info",this._namespace,t)},t.prototype.warn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return v("warn",this._namespace,t)},t.prototype.verbose=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return v("verbose",this._namespace,t)},t}();function v(t,e,n){var r=l("diag");if(r)return n.unshift(e),r[t].apply(r,h([],d(n),!1))}!function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"}(f||(f={}));var y=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},g=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},E=function(){function t(){function t(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=l("diag");if(r)return r[t].apply(r,g([],y(e),!1))}}var e=this;e.setLogger=function(t,n){var r,o,i;if(void 0===n&&(n={logLevel:f.INFO}),t===e){var a=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return e.error(null!==(r=a.stack)&&void 0!==r?r:a.message),!1}"number"==typeof n&&(n={logLevel:n});var s=l("diag"),u=function(t,e){function n(n,r){var o=e[n];return"function"==typeof o&&t>=r?o.bind(e):function(){}}return t<f.NONE?t=f.NONE:t>f.ALL&&(t=f.ALL),e=e||{},{error:n("error",f.ERROR),warn:n("warn",f.WARN),info:n("info",f.INFO),debug:n("debug",f.DEBUG),verbose:n("verbose",f.VERBOSE)}}(null!==(o=n.logLevel)&&void 0!==o?o:f.INFO,t);if(s&&!n.suppressOverrideMessage){var p=null!==(i=(new Error).stack)&&void 0!==i?i:"<failed to generate stacktrace>";s.warn("Current logger will be overwritten from "+p),u.warn("Current logger will overwrite one already registered from "+p)}return c("diag",u,e,!0)},e.disable=function(){p("diag",e)},e.createComponentLogger=function(t){return new _(t)},e.verbose=t("verbose"),e.debug=t("debug"),e.info=t("info"),e.warn=t("warn"),e.error=t("error")}return t.instance=function(){return this._instance||(this._instance=new t),this._instance},t}(),T=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},m=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},S=function(){function t(t){this._entries=t?new Map(t):new Map}return t.prototype.getEntry=function(t){var e=this._entries.get(t);if(e)return Object.assign({},e)},t.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map((function(t){var e=T(t,2);return[e[0],e[1]]}))},t.prototype.setEntry=function(e,n){var r=new t(this._entries);return r._entries.set(e,n),r},t.prototype.removeEntry=function(e){var n=new t(this._entries);return n._entries.delete(e),n},t.prototype.removeEntries=function(){for(var e,n,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];var i=new t(this._entries);try{for(var a=m(r),s=a.next();!s.done;s=a.next()){var u=s.value;i._entries.delete(u)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}return i},t.prototype.clear=function(){return new t},t}(),O=Symbol("BaggageEntryMetadata"),b=E.instance();function R(t){return void 0===t&&(t={}),new S(new Map(Object.entries(t)))}function L(t){return Symbol.for(t)}var P,A,w=function t(e){var n=this;n._currentContext=e?new Map(e):new Map,n.getValue=function(t){return n._currentContext.get(t)},n.setValue=function(e,r){var o=new t(n._currentContext);return o._currentContext.set(e,r),o},n.deleteValue=function(e){var r=new t(n._currentContext);return r._currentContext.delete(e),r}},C=new w,N=(P=function(t,e){return P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},P(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}P(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),I=function(){function t(){}return t.prototype.createGauge=function(t,e){return G},t.prototype.createHistogram=function(t,e){return z},t.prototype.createCounter=function(t,e){return X},t.prototype.createUpDownCounter=function(t,e){return K},t.prototype.createObservableGauge=function(t,e){return W},t.prototype.createObservableCounter=function(t,e){return q},t.prototype.createObservableUpDownCounter=function(t,e){return Y},t.prototype.addBatchObservableCallback=function(t,e){},t.prototype.removeBatchObservableCallback=function(t){},t}(),x=function(){},M=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return N(e,t),e.prototype.add=function(t,e){},e}(x),D=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return N(e,t),e.prototype.add=function(t,e){},e}(x),U=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return N(e,t),e.prototype.record=function(t,e){},e}(x),j=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return N(e,t),e.prototype.record=function(t,e){},e}(x),B=function(){function t(){}return t.prototype.addCallback=function(t){},t.prototype.removeCallback=function(t){},t}(),k=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return N(e,t),e}(B),F=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return N(e,t),e}(B),H=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return N(e,t),e}(B),V=new I,X=new M,G=new U,z=new j,K=new D,q=new k,W=new F,Y=new H,$={get:function(t,e){if(null!=t)return t[e]},keys:function(t){return null==t?[]:Object.keys(t)}},Q={set:function(t,e,n){null!=t&&(t[e]=n)}},Z=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},J=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},tt=function(){function t(){}return t.prototype.active=function(){return C},t.prototype.with=function(t,e,n){for(var r=[],o=3;o<arguments.length;o++)r[o-3]=arguments[o];return e.call.apply(e,J([n],Z(r),!1))},t.prototype.bind=function(t,e){return e},t.prototype.enable=function(){return this},t.prototype.disable=function(){return this},t}(),et=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},nt=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},rt="context",ot=new tt,it=function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalContextManager=function(t){return c(rt,t,E.instance())},t.prototype.active=function(){return this._getContextManager().active()},t.prototype.with=function(t,e,n){for(var r,o=[],i=3;i<arguments.length;i++)o[i-3]=arguments[i];return(r=this._getContextManager()).with.apply(r,nt([t,e,n],et(o),!1))},t.prototype.bind=function(t,e){return this._getContextManager().bind(t,e)},t.prototype._getContextManager=function(){return l(rt)||ot},t.prototype.disable=function(){this._getContextManager().disable(),p(rt,E.instance())},t}();!function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"}(A||(A={}));var at="0000000000000000",st="00000000000000000000000000000000",ut={traceId:st,spanId:at,traceFlags:A.NONE},ct=function(){function t(t){void 0===t&&(t=ut),this._spanContext=t}return t.prototype.spanContext=function(){return this._spanContext},t.prototype.setAttribute=function(t,e){return this},t.prototype.setAttributes=function(t){return this},t.prototype.addEvent=function(t,e){return this},t.prototype.addLink=function(t){return this},t.prototype.addLinks=function(t){return this},t.prototype.setStatus=function(t){return this},t.prototype.updateName=function(t){return this},t.prototype.end=function(t){},t.prototype.isRecording=function(){return!1},t.prototype.recordException=function(t,e){},t}(),lt=L("OpenTelemetry Context Key SPAN");function pt(t){return t.getValue(lt)||void 0}function ft(){return pt(it.getInstance().active())}function dt(t,e){return t.setValue(lt,e)}function ht(t){return t.deleteValue(lt)}function _t(t,e){return dt(t,new ct(e))}function vt(t){var e;return null===(e=pt(t))||void 0===e?void 0:e.spanContext()}var yt=/^([0-9a-f]{32})$/i,gt=/^[0-9a-f]{16}$/i;function Et(t){return yt.test(t)&&t!==st}function Tt(t){return Et(t.traceId)&&(e=t.spanId,gt.test(e)&&e!==at);var e}function mt(t){return new ct(t)}var St=it.getInstance(),Ot=function(){function t(){}return t.prototype.startSpan=function(t,e,n){if(void 0===n&&(n=St.active()),Boolean(null==e?void 0:e.root))return new ct;var r,o=n&&vt(n);return"object"==typeof(r=o)&&"string"==typeof r.spanId&&"string"==typeof r.traceId&&"number"==typeof r.traceFlags&&Tt(o)?new ct(o):new ct},t.prototype.startActiveSpan=function(t,e,n,r){var o,i,a;if(!(arguments.length<2)){2===arguments.length?a=e:3===arguments.length?(o=e,a=n):(o=e,i=n,a=r);var s=null!=i?i:St.active(),u=this.startSpan(t,o,s),c=dt(s,u);return St.with(c,a,void 0,u)}},t}();var bt,Rt,Lt,Pt=new Ot,At=function(){function t(t,e,n,r){this._provider=t,this.name=e,this.version=n,this.options=r}return t.prototype.startSpan=function(t,e,n){return this._getTracer().startSpan(t,e,n)},t.prototype.startActiveSpan=function(t,e,n,r){var o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,arguments)},t.prototype._getTracer=function(){if(this._delegate)return this._delegate;var t=this._provider.getDelegateTracer(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):Pt},t}(),wt=new(function(){function t(){}return t.prototype.getTracer=function(t,e,n){return new Ot},t}()),Ct=function(){function t(){}return t.prototype.getTracer=function(t,e,n){var r;return null!==(r=this.getDelegateTracer(t,e,n))&&void 0!==r?r:new At(this,t,e,n)},t.prototype.getDelegate=function(){var t;return null!==(t=this._delegate)&&void 0!==t?t:wt},t.prototype.setDelegate=function(t){this._delegate=t},t.prototype.getDelegateTracer=function(t,e,n){var r;return null===(r=this._delegate)||void 0===r?void 0:r.getTracer(t,e,n)},t}();!function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"}(bt||(bt={})),function(t){t[t.INTERNAL=0]="INTERNAL",t[t.SERVER=1]="SERVER",t[t.CLIENT=2]="CLIENT",t[t.PRODUCER=3]="PRODUCER",t[t.CONSUMER=4]="CONSUMER"}(Rt||(Rt={})),function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"}(Lt||(Lt={}));var Nt=it.getInstance(),It=E.instance(),xt=new(function(){function t(){}return t.prototype.getMeter=function(t,e,n){return V},t}()),Mt="metrics",Dt=function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalMeterProvider=function(t){return c(Mt,t,E.instance())},t.prototype.getMeterProvider=function(){return l(Mt)||xt},t.prototype.getMeter=function(t,e,n){return this.getMeterProvider().getMeter(t,e,n)},t.prototype.disable=function(){p(Mt,E.instance())},t}().getInstance(),Ut=function(){function t(){}return t.prototype.inject=function(t,e){},t.prototype.extract=function(t,e){return t},t.prototype.fields=function(){return[]},t}(),jt=L("OpenTelemetry Baggage Key");function Bt(t){return t.getValue(jt)||void 0}function kt(){return Bt(it.getInstance().active())}function Ft(t,e){return t.setValue(jt,e)}function Ht(t){return t.deleteValue(jt)}var Vt="propagation",Xt=new Ut,Gt=function(){function t(){this.createBaggage=R,this.getBaggage=Bt,this.getActiveBaggage=kt,this.setBaggage=Ft,this.deleteBaggage=Ht}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalPropagator=function(t){return c(Vt,t,E.instance())},t.prototype.inject=function(t,e,n){return void 0===n&&(n=Q),this._getGlobalPropagator().inject(t,e,n)},t.prototype.extract=function(t,e,n){return void 0===n&&(n=$),this._getGlobalPropagator().extract(t,e,n)},t.prototype.fields=function(){return this._getGlobalPropagator().fields()},t.prototype.disable=function(){p(Vt,E.instance())},t.prototype._getGlobalPropagator=function(){return l(Vt)||Xt},t}(),zt=Gt.getInstance(),Kt="trace",qt=function(){function t(){this._proxyTracerProvider=new Ct,this.wrapSpanContext=mt,this.isSpanContextValid=Tt,this.deleteSpan=ht,this.getSpan=pt,this.getActiveSpan=ft,this.getSpanContext=vt,this.setSpan=dt,this.setSpanContext=_t}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalTracerProvider=function(t){var e=c(Kt,this._proxyTracerProvider,E.instance());return e&&this._proxyTracerProvider.setDelegate(t),e},t.prototype.getTracerProvider=function(){return l(Kt)||this._proxyTracerProvider},t.prototype.getTracer=function(t,e){return this.getTracerProvider().getTracer(t,e)},t.prototype.disable=function(){p(Kt,E.instance()),this._proxyTracerProvider=new Ct},t}().getInstance();const Wt=L("OpenTelemetry SDK Context Key SUPPRESS_TRACING");var Yt;!function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"}(Yt||(Yt={}));const $t="[_0-9a-z-*/]",Qt=new RegExp(`^(?:${`[a-z]${$t}{0,255}`}|${`[a-z0-9]${$t}{0,240}@[a-z]${$t}{0,13}`})$`),Zt=/^[ -~]{0,255}[!-~]$/,Jt=/,|=/;let te=class t{_internalState=new Map;constructor(t){t&&this._parse(t)}set(t,e){const n=this._clone();return n._internalState.has(t)&&n._internalState.delete(t),n._internalState.set(t,e),n}unset(t){const e=this._clone();return e._internalState.delete(t),e}get(t){return this._internalState.get(t)}serialize(){return this._keys().reduce(((t,e)=>(t.push(e+"="+this.get(e)),t)),[]).join(",")}_parse(t){t.length>512||(this._internalState=t.split(",").reverse().reduce(((t,e)=>{const n=e.trim(),r=n.indexOf("=");if(-1!==r){const o=n.slice(0,r),i=n.slice(r+1,e.length);(function(t){return Qt.test(t)})(o)&&function(t){return Zt.test(t)&&!Jt.test(t)}(i)&&t.set(o,i)}return t}),new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){const e=new t;return e._internalState=new Map(this._internalState),e}};const ee="traceparent",ne="tracestate",re=new RegExp("^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$");let oe=class{inject(t,e,n){const r=qt.getSpanContext(t);if(!r||function(t){return!0===t.getValue(Wt)}(t)||!Tt(r))return;const o=`00-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||A.NONE).toString(16)}`;n.set(e,ee,o),r.traceState&&n.set(e,ne,r.traceState.serialize())}extract(t,e,n){const r=n.get(e,ee);if(!r)return t;const o=Array.isArray(r)?r[0]:r;if("string"!=typeof o)return t;const i=function(t){const e=re.exec(t);return e?"00"===e[1]&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}:null}(o);if(!i)return t;i.isRemote=!0;const a=n.get(e,ne);if(a){const t=Array.isArray(a)?a.join(","):a;i.traceState=new te("string"==typeof t?t:void 0)}return qt.setSpanContext(t,i)}fields(){return[ee,ne]}};function ie(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if("function"==typeof e){var n=function t(){return this instanceof t?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})})),n}var ae,se={},ue={};function ce(){if(ae)return ue;function t(t){return Object.keys(t).map((n=>e(n,t[n])))}function e(t,e){return{key:t,value:n(e)}}function n(t){const r=typeof t;return"string"===r?{stringValue:t}:"number"===r?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:"boolean"===r?{boolValue:t}:t instanceof Uint8Array?{bytesValue:t}:Array.isArray(t)?{arrayValue:{values:t.map(n)}}:"object"===r&&null!=t?{kvlistValue:{values:Object.entries(t).map((([t,n])=>e(t,n)))}}:{}}return ae=1,Object.defineProperty(ue,"__esModule",{value:!0}),ue.toAnyValue=ue.toKeyValue=ue.toAttributes=ue.createInstrumentationScope=ue.createResource=void 0,ue.createResource=function(e){return{attributes:t(e.attributes),droppedAttributesCount:0}},ue.createInstrumentationScope=function(t){return{name:t.name,version:t.version}},ue.toAttributes=t,ue.toKeyValue=e,ue.toAnyValue=n,ue}var le={},pe=L("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function fe(t){return t.setValue(pe,!0)}function de(t){return!0===t.getValue(pe)}var he="=",_e=";",ve=",",ye="baggage",ge=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};function Ee(t){return t.reduce((function(t,e){var n=""+t+(""!==t?ve:"")+e;return n.length>8192?t:n}),"")}function Te(t){return t.getAllEntries().map((function(t){var e=ge(t,2),n=e[0],r=e[1],o=encodeURIComponent(n)+"="+encodeURIComponent(r.value);return void 0!==r.metadata&&(o+=_e+r.metadata.toString()),o}))}function me(t){var e=t.split(_e);if(!(e.length<=0)){var n=e.shift();if(n){var r=n.indexOf(he);if(!(r<=0)){var o,i,a=decodeURIComponent(n.substring(0,r).trim()),s=decodeURIComponent(n.substring(r+1).trim());return e.length>0&&("string"!=typeof(i=e.join(_e))&&(b.error("Cannot create baggage metadata from unknown type: "+typeof i),i=""),o={__TYPE__:O,toString:function(){return i}}),{key:a,value:s,metadata:o}}}}}var Se=function(){function t(){}return t.prototype.inject=function(t,e,n){var r=zt.getBaggage(t);if(r&&!de(t)){var o=Ee(Te(r).filter((function(t){return t.length<=4096})).slice(0,180));o.length>0&&n.set(e,ye,o)}},t.prototype.extract=function(t,e,n){var r=n.get(e,ye),o=Array.isArray(r)?r.join(ve):r;if(!o)return t;var i={};return 0===o.length?t:(o.split(ve).forEach((function(t){var e=me(t);if(e){var n={value:e.value};e.metadata&&(n.metadata=e.metadata),i[e.key]=n}})),0===Object.entries(i).length?t:zt.setBaggage(t,zt.createBaggage(i)))},t.prototype.fields=function(){return[ye]},t}(),Oe=function(){function t(t,e){this._monotonicClock=e,this._epochMillis=t.now(),this._performanceMillis=e.now()}return t.prototype.now=function(){var t=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+t},t}(),be=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Re=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};function Le(t){var e,n,r={};if("object"!=typeof t||null==t)return r;try{for(var o=be(Object.entries(t)),i=o.next();!i.done;i=o.next()){var a=Re(i.value,2),s=a[0],u=a[1];Pe(s)?Ae(u)?Array.isArray(u)?r[s]=u.slice():r[s]=u:It.warn("Invalid attribute value set for key: "+s):It.warn("Invalid attribute key: "+s)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}return r}function Pe(t){return"string"==typeof t&&t.length>0}function Ae(t){return null==t||(Array.isArray(t)?function(t){var e,n,r;try{for(var o=be(t),i=o.next();!i.done;i=o.next()){var a=i.value;if(null!=a){if(!r){if(we(a)){r=typeof a;continue}return!1}if(typeof a!==r)return!1}}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}return!0}(t):we(t))}function we(t){switch(typeof t){case"number":case"boolean":case"string":return!0}return!1}function Ce(){return function(t){It.error(function(t){return"string"==typeof t?t:JSON.stringify(function(t){var e={},n=t;for(;null!==n;)Object.getOwnPropertyNames(n).forEach((function(t){if(!e[t]){var r=n[t];r&&(e[t]=String(r))}})),n=Object.getPrototypeOf(n);return e}(t))}(t))}}var Ne,Ie=Ce();function xe(t){try{Ie(t)}catch(t){}}!function(t){t.AlwaysOff="always_off",t.AlwaysOn="always_on",t.ParentBasedAlwaysOff="parentbased_always_off",t.ParentBasedAlwaysOn="parentbased_always_on",t.ParentBasedTraceIdRatio="parentbased_traceidratio",t.TraceIdRatio="traceidratio"}(Ne||(Ne={}));var Me=",",De=["OTEL_SDK_DISABLED"];function Ue(t){return De.indexOf(t)>-1}var je=["OTEL_BSP_EXPORT_TIMEOUT","OTEL_BSP_MAX_EXPORT_BATCH_SIZE","OTEL_BSP_MAX_QUEUE_SIZE","OTEL_BSP_SCHEDULE_DELAY","OTEL_BLRP_EXPORT_TIMEOUT","OTEL_BLRP_MAX_EXPORT_BATCH_SIZE","OTEL_BLRP_MAX_QUEUE_SIZE","OTEL_BLRP_SCHEDULE_DELAY","OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT","OTEL_ATTRIBUTE_COUNT_LIMIT","OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT","OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT","OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT","OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT","OTEL_SPAN_EVENT_COUNT_LIMIT","OTEL_SPAN_LINK_COUNT_LIMIT","OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT","OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT","OTEL_EXPORTER_OTLP_TIMEOUT","OTEL_EXPORTER_OTLP_TRACES_TIMEOUT","OTEL_EXPORTER_OTLP_METRICS_TIMEOUT","OTEL_EXPORTER_OTLP_LOGS_TIMEOUT","OTEL_EXPORTER_JAEGER_AGENT_PORT"];function Be(t){return je.indexOf(t)>-1}var ke=["OTEL_NO_PATCH_MODULES","OTEL_PROPAGATORS","OTEL_SEMCONV_STABILITY_OPT_IN"];function Fe(t){return ke.indexOf(t)>-1}var He=1/0,Ve=128,Xe={OTEL_SDK_DISABLED:!1,CONTAINER_NAME:"",ECS_CONTAINER_METADATA_URI_V4:"",ECS_CONTAINER_METADATA_URI:"",HOSTNAME:"",KUBERNETES_SERVICE_HOST:"",NAMESPACE:"",OTEL_BSP_EXPORT_TIMEOUT:3e4,OTEL_BSP_MAX_EXPORT_BATCH_SIZE:512,OTEL_BSP_MAX_QUEUE_SIZE:2048,OTEL_BSP_SCHEDULE_DELAY:5e3,OTEL_BLRP_EXPORT_TIMEOUT:3e4,OTEL_BLRP_MAX_EXPORT_BATCH_SIZE:512,OTEL_BLRP_MAX_QUEUE_SIZE:2048,OTEL_BLRP_SCHEDULE_DELAY:5e3,OTEL_EXPORTER_JAEGER_AGENT_HOST:"",OTEL_EXPORTER_JAEGER_AGENT_PORT:6832,OTEL_EXPORTER_JAEGER_ENDPOINT:"",OTEL_EXPORTER_JAEGER_PASSWORD:"",OTEL_EXPORTER_JAEGER_USER:"",OTEL_EXPORTER_OTLP_ENDPOINT:"",OTEL_EXPORTER_OTLP_TRACES_ENDPOINT:"",OTEL_EXPORTER_OTLP_METRICS_ENDPOINT:"",OTEL_EXPORTER_OTLP_LOGS_ENDPOINT:"",OTEL_EXPORTER_OTLP_HEADERS:"",OTEL_EXPORTER_OTLP_TRACES_HEADERS:"",OTEL_EXPORTER_OTLP_METRICS_HEADERS:"",OTEL_EXPORTER_OTLP_LOGS_HEADERS:"",OTEL_EXPORTER_OTLP_TIMEOUT:1e4,OTEL_EXPORTER_OTLP_TRACES_TIMEOUT:1e4,OTEL_EXPORTER_OTLP_METRICS_TIMEOUT:1e4,OTEL_EXPORTER_OTLP_LOGS_TIMEOUT:1e4,OTEL_EXPORTER_ZIPKIN_ENDPOINT:"http://localhost:9411/api/v2/spans",OTEL_LOG_LEVEL:f.INFO,OTEL_NO_PATCH_MODULES:[],OTEL_PROPAGATORS:["tracecontext","baggage"],OTEL_RESOURCE_ATTRIBUTES:"",OTEL_SERVICE_NAME:"",OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT:He,OTEL_ATTRIBUTE_COUNT_LIMIT:Ve,OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT:He,OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT:Ve,OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT:He,OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT:Ve,OTEL_SPAN_EVENT_COUNT_LIMIT:128,OTEL_SPAN_LINK_COUNT_LIMIT:128,OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT:128,OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT:128,OTEL_TRACES_EXPORTER:"",OTEL_TRACES_SAMPLER:Ne.ParentBasedAlwaysOn,OTEL_TRACES_SAMPLER_ARG:"",OTEL_LOGS_EXPORTER:"",OTEL_EXPORTER_OTLP_INSECURE:"",OTEL_EXPORTER_OTLP_TRACES_INSECURE:"",OTEL_EXPORTER_OTLP_METRICS_INSECURE:"",OTEL_EXPORTER_OTLP_LOGS_INSECURE:"",OTEL_EXPORTER_OTLP_CERTIFICATE:"",OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE:"",OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE:"",OTEL_EXPORTER_OTLP_LOGS_CERTIFICATE:"",OTEL_EXPORTER_OTLP_COMPRESSION:"",OTEL_EXPORTER_OTLP_TRACES_COMPRESSION:"",OTEL_EXPORTER_OTLP_METRICS_COMPRESSION:"",OTEL_EXPORTER_OTLP_LOGS_COMPRESSION:"",OTEL_EXPORTER_OTLP_CLIENT_KEY:"",OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY:"",OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY:"",OTEL_EXPORTER_OTLP_LOGS_CLIENT_KEY:"",OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE:"",OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE:"",OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE:"",OTEL_EXPORTER_OTLP_LOGS_CLIENT_CERTIFICATE:"",OTEL_EXPORTER_OTLP_PROTOCOL:"http/protobuf",OTEL_EXPORTER_OTLP_TRACES_PROTOCOL:"http/protobuf",OTEL_EXPORTER_OTLP_METRICS_PROTOCOL:"http/protobuf",OTEL_EXPORTER_OTLP_LOGS_PROTOCOL:"http/protobuf",OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE:"cumulative",OTEL_SEMCONV_STABILITY_OPT_IN:[]};function Ge(t,e,n){if(void 0!==n[t]){var r=String(n[t]);e[t]="true"===r.toLowerCase()}}function ze(t,e,n,r,o){if(void 0===r&&(r=-1/0),void 0===o&&(o=1/0),void 0!==n[t]){var i=Number(n[t]);isNaN(i)||(e[t]=i<r?r:i>o?o:i)}}function Ke(t,e,n,r){void 0===r&&(r=Me);var o=n[t];"string"==typeof o&&(e[t]=o.split(r).map((function(t){return t.trim()})))}var qe={ALL:f.ALL,VERBOSE:f.VERBOSE,DEBUG:f.DEBUG,INFO:f.INFO,WARN:f.WARN,ERROR:f.ERROR,NONE:f.NONE};function We(t,e,n){var r=n[t];if("string"==typeof r){var o=qe[r.toUpperCase()];null!=o&&(e[t]=o)}}function Ye(t){var e={};for(var n in Xe){var r=n;if("OTEL_LOG_LEVEL"===r)We(r,e,t);else if(Ue(r))Ge(r,e,t);else if(Be(r))ze(r,e,t);else if(Fe(r))Ke(r,e,t);else{var o=t[r];null!=o&&(e[r]=String(o))}}return e}var $e="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{};function Qe(){var t=Ye($e);return Object.assign({},Xe,t)}function Ze(){return Ye($e)}function Je(t){return t>=48&&t<=57?t-48:t>=97&&t<=102?t-87:t-55}function tn(t){for(var e=new Uint8Array(t.length/2),n=0,r=0;r<t.length;r+=2){var o=Je(t.charCodeAt(r)),i=Je(t.charCodeAt(r+1));e[n++]=o<<4|i}return e}var en=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},nn=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))};var rn=function(){this.generateTraceId=an(16),this.generateSpanId=an(8)},on=Array(32);function an(t){return function(){for(var e=0;e<2*t;e++)on[e]=Math.floor(16*Math.random())+48,on[e]>=58&&(on[e]+=39);return String.fromCharCode.apply(null,on.slice(0,2*t))}}var sn,un=performance,cn="1.30.1",ln="exception.type",pn="exception.message",fn="http.method",dn="http.url",hn="http.host",_n="http.scheme",vn="http.status_code",yn="http.user_agent",gn="http.request_content_length_uncompressed",En="telemetry.sdk.name",Tn="telemetry.sdk.language",mn="telemetry.sdk.version",Sn=((sn={})[En]="opentelemetry",sn["process.runtime.name"]="browser",sn[Tn]="webjs",sn[mn]=cn,sn);function On(t){}var bn,Rn=Math.pow(10,6),Ln=Math.pow(10,9);function Pn(t){var e=t/1e3;return[Math.trunc(e),Math.round(t%1e3*Rn)]}function An(){var t=un.timeOrigin;if("number"!=typeof t){var e=un;t=e.timing&&e.timing.fetchStart}return t}function wn(t){return Dn(Pn(An()),Pn("number"==typeof t?t:un.now()))}function Cn(t){if(xn(t))return t;if("number"==typeof t)return t<An()?wn(t):Pn(t);if(t instanceof Date)return Pn(t.getTime());throw TypeError("Invalid input type")}function Nn(t,e){var n=e[0]-t[0],r=e[1]-t[1];return r<0&&(n-=1,r+=Ln),[n,r]}function In(t){return t[0]*Ln+t[1]}function xn(t){return Array.isArray(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]}function Mn(t){return xn(t)||"number"==typeof t||t instanceof Date}function Dn(t,e){var n=[t[0]+e[0],t[1]+e[1]];return n[1]>=Ln&&(n[1]-=Ln,n[0]+=1),n}!function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"}(bn||(bn={}));var Un=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},jn=function(){function t(t){var e;void 0===t&&(t={}),this._propagators=null!==(e=t.propagators)&&void 0!==e?e:[],this._fields=Array.from(new Set(this._propagators.map((function(t){return"function"==typeof t.fields?t.fields():[]})).reduce((function(t,e){return t.concat(e)}),[])))}return t.prototype.inject=function(t,e,n){var r,o;try{for(var i=Un(this._propagators),a=i.next();!a.done;a=i.next()){var s=a.value;try{s.inject(t,e,n)}catch(t){It.warn("Failed to inject with "+s.constructor.name+". Err: "+t.message)}}}catch(t){r={error:t}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}},t.prototype.extract=function(t,e,n){return this._propagators.reduce((function(t,r){try{return r.extract(t,e,n)}catch(t){It.warn("Failed to extract with "+r.constructor.name+". Err: "+t.message)}return t}),t)},t.prototype.fields=function(){return this._fields.slice()},t}(),Bn="[_0-9a-z-*/]",kn=new RegExp("^(?:"+("[a-z]"+Bn+"{0,255}")+"|"+("[a-z0-9]"+Bn+"{0,240}@[a-z]"+Bn+"{0,13}")+")$"),Fn=/^[ -~]{0,255}[!-~]$/,Hn=/,|=/;var Vn=function(){function t(t){this._internalState=new Map,t&&this._parse(t)}return t.prototype.set=function(t,e){var n=this._clone();return n._internalState.has(t)&&n._internalState.delete(t),n._internalState.set(t,e),n},t.prototype.unset=function(t){var e=this._clone();return e._internalState.delete(t),e},t.prototype.get=function(t){return this._internalState.get(t)},t.prototype.serialize=function(){var t=this;return this._keys().reduce((function(e,n){return e.push(n+"="+t.get(n)),e}),[]).join(",")},t.prototype._parse=function(t){t.length>512||(this._internalState=t.split(",").reverse().reduce((function(t,e){var n=e.trim(),r=n.indexOf("=");if(-1!==r){var o=n.slice(0,r),i=n.slice(r+1,e.length);(function(t){return kn.test(t)})(o)&&function(t){return Fn.test(t)&&!Hn.test(t)}(i)&&t.set(o,i)}return t}),new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))},t.prototype._keys=function(){return Array.from(this._internalState.keys()).reverse()},t.prototype._clone=function(){var e=new t;return e._internalState=new Map(this._internalState),e},t}(),Xn="traceparent",Gn="tracestate",zn=new RegExp("^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$");function Kn(t){var e=zn.exec(t);return e?"00"===e[1]&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}:null}var qn,Wn=function(){function t(){}return t.prototype.inject=function(t,e,n){var r=qt.getSpanContext(t);if(r&&!de(t)&&Tt(r)){var o="00-"+r.traceId+"-"+r.spanId+"-0"+Number(r.traceFlags||A.NONE).toString(16);n.set(e,Xn,o),r.traceState&&n.set(e,Gn,r.traceState.serialize())}},t.prototype.extract=function(t,e,n){var r=n.get(e,Xn);if(!r)return t;var o=Array.isArray(r)?r[0]:r;if("string"!=typeof o)return t;var i=Kn(o);if(!i)return t;i.isRemote=!0;var a=n.get(e,Gn);if(a){var s=Array.isArray(a)?a.join(","):a;i.traceState=new Vn("string"==typeof s?s:void 0)}return qt.setSpanContext(t,i)},t.prototype.fields=function(){return[Xn,Gn]},t}(),Yn=L("OpenTelemetry SDK Context Key RPC_METADATA");!function(t){t.HTTP="http"}(qn||(qn={}));var $n,Qn,Zn=function(){function t(){}return t.prototype.shouldSample=function(){return{decision:bt.NOT_RECORD}},t.prototype.toString=function(){return"AlwaysOffSampler"},t}(),Jn=function(){function t(){}return t.prototype.shouldSample=function(){return{decision:bt.RECORD_AND_SAMPLED}},t.prototype.toString=function(){return"AlwaysOnSampler"},t}(),tr=function(){function t(t){var e,n,r,o;this._root=t.root,this._root||(xe(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new Jn),this._remoteParentSampled=null!==(e=t.remoteParentSampled)&&void 0!==e?e:new Jn,this._remoteParentNotSampled=null!==(n=t.remoteParentNotSampled)&&void 0!==n?n:new Zn,this._localParentSampled=null!==(r=t.localParentSampled)&&void 0!==r?r:new Jn,this._localParentNotSampled=null!==(o=t.localParentNotSampled)&&void 0!==o?o:new Zn}return t.prototype.shouldSample=function(t,e,n,r,o,i){var a=qt.getSpanContext(t);return a&&Tt(a)?a.isRemote?a.traceFlags&A.SAMPLED?this._remoteParentSampled.shouldSample(t,e,n,r,o,i):this._remoteParentNotSampled.shouldSample(t,e,n,r,o,i):a.traceFlags&A.SAMPLED?this._localParentSampled.shouldSample(t,e,n,r,o,i):this._localParentNotSampled.shouldSample(t,e,n,r,o,i):this._root.shouldSample(t,e,n,r,o,i)},t.prototype.toString=function(){return"ParentBased{root="+this._root.toString()+", remoteParentSampled="+this._remoteParentSampled.toString()+", remoteParentNotSampled="+this._remoteParentNotSampled.toString()+", localParentSampled="+this._localParentSampled.toString()+", localParentNotSampled="+this._localParentNotSampled.toString()+"}"},t}(),er=function(){function t(t){void 0===t&&(t=0),this._ratio=t,this._ratio=this._normalize(t),this._upperBound=Math.floor(4294967295*this._ratio)}return t.prototype.shouldSample=function(t,e){return{decision:Et(e)&&this._accumulate(e)<this._upperBound?bt.RECORD_AND_SAMPLED:bt.NOT_RECORD}},t.prototype.toString=function(){return"TraceIdRatioBased{"+this._ratio+"}"},t.prototype._normalize=function(t){return"number"!=typeof t||isNaN(t)?0:t>=1?1:t<=0?0:t},t.prototype._accumulate=function(t){for(var e=0,n=0;n<t.length/8;n++){var r=8*n;e=(e^parseInt(t.slice(r,r+8),16))>>>0}return e},t}(),nr="[object Object]",rr="[object Null]",or="[object Undefined]",ir=Function.prototype.toString,ar=ir.call(Object),sr=($n=Object.getPrototypeOf,Qn=Object,function(t){return $n(Qn(t))}),ur=Object.prototype,cr=ur.hasOwnProperty,lr=Symbol?Symbol.toStringTag:void 0,pr=ur.toString;function fr(t){if(!function(t){return null!=t&&"object"==typeof t}(t)||function(t){if(null==t)return void 0===t?or:rr;return lr&&lr in Object(t)?function(t){var e=cr.call(t,lr),n=t[lr],r=!1;try{t[lr]=void 0,r=!0}catch(t){}var o=pr.call(t);r&&(e?t[lr]=n:delete t[lr]);return o}(t):function(t){return pr.call(t)}(t)}(t)!==nr)return!1;var e=sr(t);if(null===e)return!0;var n=cr.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&ir.call(n)===ar}var dr=20;function hr(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=t.shift(),r=new WeakMap;t.length>0;)n=vr(n,t.shift(),0,r);return n}function _r(t){return gr(t)?t.slice():t}function vr(t,e,n,r){var o;if(void 0===n&&(n=0),!(n>dr)){if(n++,mr(t)||mr(e)||Er(e))o=_r(e);else if(gr(t)){if(o=t.slice(),gr(e))for(var i=0,a=e.length;i<a;i++)o.push(_r(e[i]));else if(Tr(e))for(i=0,a=(s=Object.keys(e)).length;i<a;i++){o[u=s[i]]=_r(e[u])}}else if(Tr(t))if(Tr(e)){if(!function(t,e){if(!fr(t)||!fr(e))return!1;return!0}(t,e))return e;o=Object.assign({},t);var s;for(i=0,a=(s=Object.keys(e)).length;i<a;i++){var u,c=e[u=s[i]];if(mr(c))void 0===c?delete o[u]:o[u]=c;else{var l=o[u],p=c;if(yr(t,u,r)||yr(e,u,r))delete o[u];else{if(Tr(l)&&Tr(p)){var f=r.get(l)||[],d=r.get(p)||[];f.push({obj:t,key:u}),d.push({obj:e,key:u}),r.set(l,f),r.set(p,d)}o[u]=vr(o[u],c,n,r)}}}}else o=e;return o}}function yr(t,e,n){for(var r=n.get(t[e])||[],o=0,i=r.length;o<i;o++){var a=r[o];if(a.key===e&&a.obj===t)return!0}return!1}function gr(t){return Array.isArray(t)}function Er(t){return"function"==typeof t}function Tr(t){return!mr(t)&&!gr(t)&&!Er(t)&&"object"==typeof t}function mr(t){return"string"==typeof t||"number"==typeof t||"boolean"==typeof t||void 0===t||t instanceof Date||t instanceof RegExp||null===t}var Sr=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Or=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return Sr(e,t),e}(Error);var br=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};function Rr(t,e){return"string"==typeof e?t===e:!!t.match(e)}function Lr(t,e){var n,r;if(!e)return!1;try{for(var o=br(e),i=o.next();!i.done;i=o.next()){if(Rr(t,i.value))return!0}}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!1}var Pr=function(){function t(){var t=this;this._promise=new Promise((function(e,n){t._resolve=e,t._reject=n}))}return Object.defineProperty(t.prototype,"promise",{get:function(){return this._promise},enumerable:!1,configurable:!0}),t.prototype.resolve=function(t){this._resolve(t)},t.prototype.reject=function(t){this._reject(t)},t}(),Ar=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},wr=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},Cr=function(){function t(t,e){this._callback=t,this._that=e,this._isCalled=!1,this._deferred=new Pr}return Object.defineProperty(t.prototype,"isCalled",{get:function(){return this._isCalled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"promise",{get:function(){return this._deferred.promise},enumerable:!1,configurable:!0}),t.prototype.call=function(){for(var t,e=this,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];if(!this._isCalled){this._isCalled=!0;try{Promise.resolve((t=this._callback).call.apply(t,wr([this._that],Ar(n),!1))).then((function(t){return e._deferred.resolve(t)}),(function(t){return e._deferred.reject(t)}))}catch(t){this._deferred.reject(t)}}return this._deferred.promise},t}();var Nr,Ir,xr={getKeyPairs:Te,serializeKeyPairs:Ee,parseKeyPairsIntoRecord:function(t){return"string"!=typeof t||0===t.length?{}:t.split(ve).map((function(t){return me(t)})).filter((function(t){return void 0!==t&&t.value.length>0})).reduce((function(t,e){return t[e.key]=e.value,t}),{})},parsePairKeyValue:me},Mr={_export:function(t,e){return new Promise((function(n){Nt.with(fe(Nt.active()),(function(){t.export(e,(function(t){n(t)}))}))}))}},Dr=Object.freeze({__proto__:null,AlwaysOffSampler:Zn,AlwaysOnSampler:Jn,AnchoredClock:Oe,BindOnceFuture:Cr,CompositePropagator:jn,DEFAULT_ATTRIBUTE_COUNT_LIMIT:Ve,DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT:He,DEFAULT_ENVIRONMENT:Xe,DEFAULT_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT:128,DEFAULT_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT:128,get ExportResultCode(){return bn},ParentBasedSampler:tr,get RPCType(){return qn},RandomIdGenerator:rn,SDK_INFO:Sn,TRACE_PARENT_HEADER:Xn,TRACE_STATE_HEADER:Gn,TimeoutError:Or,TraceIdRatioBasedSampler:er,TraceState:Vn,get TracesSamplerValues(){return Ne},VERSION:cn,W3CBaggagePropagator:Se,W3CTraceContextPropagator:Wn,_globalThis:$e,addHrTimes:Dn,baggageUtils:xr,callWithTimeout:function(t,e){var n,r=new Promise((function(t,r){n=setTimeout((function(){r(new Or("Operation timed out."))}),e)}));return Promise.race([t,r]).then((function(t){return clearTimeout(n),t}),(function(t){throw clearTimeout(n),t}))},deleteRPCMetadata:function(t){return t.deleteValue(Yn)},getEnv:Qe,getEnvWithoutDefaults:Ze,getRPCMetadata:function(t){return t.getValue(Yn)},getTimeOrigin:An,globalErrorHandler:xe,hexToBase64:function(t){return btoa(String.fromCharCode.apply(String,nn([],en(tn(t)),!1)))},hexToBinary:tn,hrTime:wn,hrTimeDuration:Nn,hrTimeToMicroseconds:function(t){return 1e6*t[0]+t[1]/1e3},hrTimeToMilliseconds:function(t){return 1e3*t[0]+t[1]/1e6},hrTimeToNanoseconds:In,hrTimeToTimeStamp:function(t){var e=""+"0".repeat(9)+t[1]+"Z",n=e.substring(e.length-9-1);return new Date(1e3*t[0]).toISOString().replace("000Z",n)},internal:Mr,isAttributeKey:Pe,isAttributeValue:Ae,isTimeInput:Mn,isTimeInputHrTime:xn,isTracingSuppressed:de,isUrlIgnored:Lr,isWrapped:function(t){return"function"==typeof t&&"function"==typeof t.__original&&"function"==typeof t.__unwrap&&!0===t.__wrapped},loggingErrorHandler:Ce,merge:hr,millisToHrTime:Pn,otperformance:un,parseEnvironment:Ye,parseTraceParent:Kn,sanitizeAttributes:Le,setGlobalErrorHandler:function(t){Ie=t},setRPCMetadata:function(t,e){return t.setValue(Yn,e)},suppressTracing:fe,timeInputToHrTime:Cn,unrefTimer:On,unsuppressTracing:function(t){return t.deleteValue(pe)},urlMatches:Rr}),Ur=ie(Dr);function jr(){if(Nr)return le;Nr=1,Object.defineProperty(le,"__esModule",{value:!0}),le.getOtlpEncoder=le.encodeAsString=le.encodeAsLongBits=le.toLongBits=le.hrTimeToNanos=void 0;const t=Ur;function e(t){const e=BigInt(1e9);return BigInt(t[0])*e+BigInt(t[1])}function n(t){return{low:Number(BigInt.asUintN(32,t)),high:Number(BigInt.asUintN(32,t>>BigInt(32)))}}function r(t){return n(e(t))}function o(t){return e(t).toString()}le.hrTimeToNanos=e,le.toLongBits=n,le.encodeAsLongBits=r,le.encodeAsString=o;const i="undefined"!=typeof BigInt?o:t.hrTimeToNanoseconds;function a(t){return t}function s(e){if(void 0!==e)return(0,t.hexToBinary)(e)}const u={encodeHrTime:r,encodeSpanContext:t.hexToBinary,encodeOptionalSpanContext:s};return le.getOtlpEncoder=function(e){var n,o;if(void 0===e)return u;const c=null===(n=e.useLongBits)||void 0===n||n,l=null!==(o=e.useHex)&&void 0!==o&&o;return{encodeHrTime:c?r:i,encodeSpanContext:l?a:t.hexToBinary,encodeOptionalSpanContext:l?a:s}},le}function Br(){if(Ir)return se;Ir=1,Object.defineProperty(se,"__esModule",{value:!0}),se.createExportTraceServiceRequest=se.toOtlpSpanEvent=se.toOtlpLink=se.sdkSpanToOtlpSpan=void 0;const t=ce(),e=jr();function n(e,n){var i;const a=e.spanContext(),s=e.status;return{traceId:n.encodeSpanContext(a.traceId),spanId:n.encodeSpanContext(a.spanId),parentSpanId:n.encodeOptionalSpanContext(e.parentSpanId),traceState:null===(i=a.traceState)||void 0===i?void 0:i.serialize(),name:e.name,kind:null==e.kind?0:e.kind+1,startTimeUnixNano:n.encodeHrTime(e.startTime),endTimeUnixNano:n.encodeHrTime(e.endTime),attributes:(0,t.toAttributes)(e.attributes),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map((t=>o(t,n))),droppedEventsCount:e.droppedEventsCount,status:{code:s.code,message:s.message},links:e.links.map((t=>r(t,n))),droppedLinksCount:e.droppedLinksCount}}function r(e,n){var r;return{attributes:e.attributes?(0,t.toAttributes)(e.attributes):[],spanId:n.encodeSpanContext(e.context.spanId),traceId:n.encodeSpanContext(e.context.traceId),traceState:null===(r=e.context.traceState)||void 0===r?void 0:r.serialize(),droppedAttributesCount:e.droppedAttributesCount||0}}function o(e,n){return{attributes:e.attributes?(0,t.toAttributes)(e.attributes):[],name:e.name,timeUnixNano:n.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function i(e,r){const o=function(t){const e=new Map;for(const n of t){let t=e.get(n.resource);t||(t=new Map,e.set(n.resource,t));const r=`${n.instrumentationLibrary.name}@${n.instrumentationLibrary.version||""}:${n.instrumentationLibrary.schemaUrl||""}`;let o=t.get(r);o||(o=[],t.set(r,o)),o.push(n)}return e}(e),i=[],a=o.entries();let s=a.next();for(;!s.done;){const[e,o]=s.value,u=[],c=o.values();let l=c.next();for(;!l.done;){const e=l.value;if(e.length>0){const o=e.map((t=>n(t,r)));u.push({scope:(0,t.createInstrumentationScope)(e[0].instrumentationLibrary),spans:o,schemaUrl:e[0].instrumentationLibrary.schemaUrl})}l=c.next()}const p={resource:(0,t.createResource)(e),scopeSpans:u,schemaUrl:void 0};i.push(p),s=a.next()}return i}return se.sdkSpanToOtlpSpan=n,se.toOtlpLink=r,se.toOtlpSpanEvent=o,se.createExportTraceServiceRequest=function(t,n){return{resourceSpans:i(t,(0,e.getOtlpEncoder)(n))}},se}var kr,Fr=Br(),Hr={};function Vr(){return kr||(kr=1,function(t){var e;Object.defineProperty(t,"__esModule",{value:!0}),t.ESpanKind=void 0,(e=t.ESpanKind||(t.ESpanKind={}))[e.SPAN_KIND_UNSPECIFIED=0]="SPAN_KIND_UNSPECIFIED",e[e.SPAN_KIND_INTERNAL=1]="SPAN_KIND_INTERNAL",e[e.SPAN_KIND_SERVER=2]="SPAN_KIND_SERVER",e[e.SPAN_KIND_CLIENT=3]="SPAN_KIND_CLIENT",e[e.SPAN_KIND_PRODUCER=4]="SPAN_KIND_PRODUCER",e[e.SPAN_KIND_CONSUMER=5]="SPAN_KIND_CONSUMER"}(Hr)),Hr}var Xr=Vr();const Gr="user-action-end",zr="user-action-cancel";let Kr={};class qr{constructor(t){this.config=t}export(t,e){const n=Fr.createExportTraceServiceRequest(t,{useHex:!0,useLongBits:!1});this.config.api.pushTraces(n),function(t=[]){var e,n;for(const r of t){const{scopeSpans:t}=r;for(const r of t){const{scope:t,spans:o=[]}=r;for(const r of o){if(r.kind!==Xr.ESpanKind.SPAN_KIND_CLIENT)continue;const o={traceId:r.traceId.toString(),spanId:r.spanId.toString()},i={};for(const t of r.attributes)i[t.key]=String(Object.values(t.value)[0]);Number.isNaN(r.endTimeUnixNano)||Number.isNaN(r.startTimeUnixNano)||(i.duration_ns=String(Number(r.endTimeUnixNano)-Number(r.startTimeUnixNano)));const a=(null!==(e=null==t?void 0:t.name)&&void 0!==e?e:"").indexOf("-");let s="unknown";(null==t?void 0:t.name)&&(-1===a&&(s=null!==(n=t.name.split("/")[1])&&void 0!==n?n:t.name),a>-1&&(s=null==t?void 0:t.name.substring(a+1))),Kr.api.pushEvent(`faro.tracing.${s}`,i,void 0,{spanContext:o,timestampOverwriteMs:Number(r.endTimeUnixNano)/1e6,customPayloadTransformer:t=>{var e,n;return null!=i["faro.action.user.name"]&&null!=i["faro.action.user.parentId"]&&(t.action={name:i["faro.action.user.name"],parentId:i["faro.action.user.parentId"]},null===(e=t.attributes)||void 0===e||delete e["faro.action.user.name"],null===(n=t.attributes)||void 0===n||delete n["faro.action.user.parentId"]),t}})}}}}(n.resourceSpans),e({code:Yt.SUCCESS})}shutdown(){return Promise.resolve(void 0)}}var Wr="session.id";"function"==typeof SuppressedError&&SuppressedError;var Yr=function(){function t(){}return t.prototype.emit=function(t){},t}(),$r=new Yr,Qr=new(function(){function t(){}return t.prototype.getLogger=function(t,e,n){return new Yr},t}()),Zr=function(){function t(t,e,n,r){this._provider=t,this.name=e,this.version=n,this.options=r}return t.prototype.emit=function(t){this._getLogger().emit(t)},t.prototype._getLogger=function(){if(this._delegate)return this._delegate;var t=this._provider.getDelegateLogger(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):$r},t}(),Jr=function(){function t(){}return t.prototype.getLogger=function(t,e,n){var r;return null!==(r=this.getDelegateLogger(t,e,n))&&void 0!==r?r:new Zr(this,t,e,n)},t.prototype.getDelegate=function(){var t;return null!==(t=this._delegate)&&void 0!==t?t:Qr},t.prototype.setDelegate=function(t){this._delegate=t},t.prototype.getDelegateLogger=function(t,e,n){var r;return null===(r=this._delegate)||void 0===r?void 0:r.getLogger(t,e,n)},t}(),to="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{},eo=Symbol.for("io.opentelemetry.js.api.logs"),no=to;var ro,oo,io=function(){function t(){this._proxyLoggerProvider=new Jr}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalLoggerProvider=function(t){return no[eo]?this.getLoggerProvider():(no[eo]=(e=1,n=t,r=Qr,function(t){return t===e?n:r}),this._proxyLoggerProvider.setDelegate(t),t);var e,n,r},t.prototype.getLoggerProvider=function(){var t,e;return null!==(e=null===(t=no[eo])||void 0===t?void 0:t.call(no,1))&&void 0!==e?e:this._proxyLoggerProvider},t.prototype.getLogger=function(t,e,n){return this.getLoggerProvider().getLogger(t,e,n)},t.prototype.disable=function(){delete no[eo],this._proxyLoggerProvider=new Jr},t}(),ao=io.getInstance();var so=function(){if(oo)return ro;function t(t){return"function"==typeof t}oo=1;var e=console.error.bind(console);function n(t,e,n){var r=!!t[e]&&t.propertyIsEnumerable(e);Object.defineProperty(t,e,{configurable:!0,enumerable:r,writable:!0,value:n})}function r(n){n&&n.logger&&(t(n.logger)?e=n.logger:e("new logger isn't a function, not replacing"))}function o(r,o,i){if(r&&r[o]){if(!i)return e("no wrapper function"),void e((new Error).stack);if(t(r[o])&&t(i)){var a=r[o],s=i(a,o);return n(s,"__original",a),n(s,"__unwrap",(function(){r[o]===s&&n(r,o,a)})),n(s,"__wrapped",!0),n(r,o,s),s}e("original object and wrapper must be functions")}else e("no original function "+o+" to wrap")}function i(t,n){return t&&t[n]?t[n].__unwrap?t[n].__unwrap():void e("no original to unwrap to -- has "+n+" already been unwrapped?"):(e("no function to unwrap."),void e((new Error).stack))}return r.wrap=o,r.massWrap=function(t,n,r){if(!t)return e("must provide one or more modules to patch"),void e((new Error).stack);Array.isArray(t)||(t=[t]),n&&Array.isArray(n)?t.forEach((function(t){n.forEach((function(e){o(t,e,r)}))})):e("must provide one or more functions to wrap on modules")},r.unwrap=i,r.massUnwrap=function(t,n){if(!t)return e("must provide one or more modules to patch"),void e((new Error).stack);Array.isArray(t)||(t=[t]),n&&Array.isArray(n)?t.forEach((function(t){n.forEach((function(e){i(t,e)}))})):e("must provide one or more functions to unwrap on modules")},ro=r}(),uo=function(){return uo=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},uo.apply(this,arguments)},co=function(){function t(t,e,n){this.instrumentationName=t,this.instrumentationVersion=e,this._config={},this._wrap=so.wrap,this._unwrap=so.unwrap,this._massWrap=so.massWrap,this._massUnwrap=so.massUnwrap,this.setConfig(n),this._diag=It.createComponentLogger({namespace:t}),this._tracer=qt.getTracer(t,e),this._meter=Dt.getMeter(t,e),this._logger=ao.getLogger(t,e),this._updateMetricInstruments()}return Object.defineProperty(t.prototype,"meter",{get:function(){return this._meter},enumerable:!1,configurable:!0}),t.prototype.setMeterProvider=function(t){this._meter=t.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()},Object.defineProperty(t.prototype,"logger",{get:function(){return this._logger},enumerable:!1,configurable:!0}),t.prototype.setLoggerProvider=function(t){this._logger=t.getLogger(this.instrumentationName,this.instrumentationVersion)},t.prototype.getModuleDefinitions=function(){var t,e=null!==(t=this.init())&&void 0!==t?t:[];return Array.isArray(e)?e:[e]},t.prototype._updateMetricInstruments=function(){},t.prototype.getConfig=function(){return this._config},t.prototype.setConfig=function(t){this._config=uo({enabled:!0},t)},t.prototype.setTracerProvider=function(t){this._tracer=t.getTracer(this.instrumentationName,this.instrumentationVersion)},Object.defineProperty(t.prototype,"tracer",{get:function(){return this._tracer},enumerable:!1,configurable:!0}),t.prototype._runSpanCustomizationHook=function(t,e,n,r){if(t)try{t(n,r)}catch(t){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:e},t)}},t}(),lo=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),po=function(t){function e(e,n,r){var o=t.call(this,e,n,r)||this;return o._config.enabled&&o.enable(),o}return lo(e,t),e}(co);function fo(t,e,n){var r,o;try{o=t()}catch(t){r=t}finally{return e(r,o),o}}function ho(t){return"function"==typeof t&&"function"==typeof t.__original&&"function"==typeof t.__unwrap&&!0===t.__wrapped}var _o,vo=function(){return vo=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},vo.apply(this,arguments)},yo=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},go=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},Eo=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},To=function(){function t(t,e,n,r,o,i,a,s,u,c){void 0===a&&(a=[]),this.attributes={},this.links=[],this.events=[],this._droppedAttributesCount=0,this._droppedEventsCount=0,this._droppedLinksCount=0,this.status={code:Lt.UNSET},this.endTime=[0,0],this._ended=!1,this._duration=[-1,-1],this.name=n,this._spanContext=r,this.parentSpanId=i,this.kind=o,this.links=a;var l=Date.now();this._performanceStartTime=un.now(),this._performanceOffset=l-(this._performanceStartTime+An()),this._startTimeProvided=null!=s,this.startTime=this._getTime(null!=s?s:l),this.resource=t.resource,this.instrumentationLibrary=t.instrumentationLibrary,this._spanLimits=t.getSpanLimits(),this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit||0,null!=c&&this.setAttributes(c),this._spanProcessor=t.getActiveSpanProcessor(),this._spanProcessor.onStart(this,e)}return t.prototype.spanContext=function(){return this._spanContext},t.prototype.setAttribute=function(t,e){return null==e||this._isSpanEnded()?this:0===t.length?(It.warn("Invalid attribute key: "+t),this):Ae(e)?Object.keys(this.attributes).length>=this._spanLimits.attributeCountLimit&&!Object.prototype.hasOwnProperty.call(this.attributes,t)?(this._droppedAttributesCount++,this):(this.attributes[t]=this._truncateToSize(e),this):(It.warn("Invalid attribute value set for key: "+t),this)},t.prototype.setAttributes=function(t){var e,n;try{for(var r=yo(Object.entries(t)),o=r.next();!o.done;o=r.next()){var i=go(o.value,2),a=i[0],s=i[1];this.setAttribute(a,s)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return this},t.prototype.addEvent=function(t,e,n){if(this._isSpanEnded())return this;if(0===this._spanLimits.eventCountLimit)return It.warn("No events allowed."),this._droppedEventsCount++,this;this.events.length>=this._spanLimits.eventCountLimit&&(0===this._droppedEventsCount&&It.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),Mn(e)&&(Mn(n)||(n=e),e=void 0);var r=Le(e);return this.events.push({name:t,attributes:r,time:this._getTime(n),droppedAttributesCount:0}),this},t.prototype.addLink=function(t){return this.links.push(t),this},t.prototype.addLinks=function(t){var e;return(e=this.links).push.apply(e,Eo([],go(t),!1)),this},t.prototype.setStatus=function(t){return this._isSpanEnded()||(this.status=vo({},t),null!=this.status.message&&"string"!=typeof t.message&&(It.warn("Dropping invalid status.message of type '"+typeof t.message+"', expected 'string'"),delete this.status.message)),this},t.prototype.updateName=function(t){return this._isSpanEnded()||(this.name=t),this},t.prototype.end=function(t){this._isSpanEnded()?It.error(this.name+" "+this._spanContext.traceId+"-"+this._spanContext.spanId+" - You can only call end() on a span once."):(this._ended=!0,this.endTime=this._getTime(t),this._duration=Nn(this.startTime,this.endTime),this._duration[0]<0&&(It.warn("Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.",this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&It.warn("Dropped "+this._droppedEventsCount+" events because eventCountLimit reached"),this._spanProcessor.onEnd(this))},t.prototype._getTime=function(t){if("number"==typeof t&&t<=un.now())return wn(t+this._performanceOffset);if("number"==typeof t)return Pn(t);if(t instanceof Date)return Pn(t.getTime());if(xn(t))return t;if(this._startTimeProvided)return Pn(Date.now());var e=un.now()-this._performanceStartTime;return Dn(this.startTime,Pn(e))},t.prototype.isRecording=function(){return!1===this._ended},t.prototype.recordException=function(t,e){var n={};"string"==typeof t?n[pn]=t:t&&(t.code?n[ln]=t.code.toString():t.name&&(n[ln]=t.name),t.message&&(n[pn]=t.message),t.stack&&(n["exception.stacktrace"]=t.stack)),n[ln]||n[pn]?this.addEvent("exception",n,e):It.warn("Failed to record an exception "+t)},Object.defineProperty(t.prototype,"duration",{get:function(){return this._duration},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ended",{get:function(){return this._ended},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"droppedAttributesCount",{get:function(){return this._droppedAttributesCount},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"droppedEventsCount",{get:function(){return this._droppedEventsCount},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"droppedLinksCount",{get:function(){return this._droppedLinksCount},enumerable:!1,configurable:!0}),t.prototype._isSpanEnded=function(){return this._ended&&It.warn("Can not execute the operation on ended Span {traceId: "+this._spanContext.traceId+", spanId: "+this._spanContext.spanId+"}"),this._ended},t.prototype._truncateToLimitUtil=function(t,e){return t.length<=e?t:t.substring(0,e)},t.prototype._truncateToSize=function(t){var e=this,n=this._attributeValueLengthLimit;return n<=0?(It.warn("Attribute value limit must be positive, got "+n),t):"string"==typeof t?this._truncateToLimitUtil(t,n):Array.isArray(t)?t.map((function(t){return"string"==typeof t?e._truncateToLimitUtil(t,n):t})):t},t}();!function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"}(_o||(_o={}));var mo=function(){function t(){}return t.prototype.shouldSample=function(){return{decision:_o.NOT_RECORD}},t.prototype.toString=function(){return"AlwaysOffSampler"},t}(),So=function(){function t(){}return t.prototype.shouldSample=function(){return{decision:_o.RECORD_AND_SAMPLED}},t.prototype.toString=function(){return"AlwaysOnSampler"},t}(),Oo=function(){function t(t){var e,n,r,o;this._root=t.root,this._root||(xe(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new So),this._remoteParentSampled=null!==(e=t.remoteParentSampled)&&void 0!==e?e:new So,this._remoteParentNotSampled=null!==(n=t.remoteParentNotSampled)&&void 0!==n?n:new mo,this._localParentSampled=null!==(r=t.localParentSampled)&&void 0!==r?r:new So,this._localParentNotSampled=null!==(o=t.localParentNotSampled)&&void 0!==o?o:new mo}return t.prototype.shouldSample=function(t,e,n,r,o,i){var a=qt.getSpanContext(t);return a&&Tt(a)?a.isRemote?a.traceFlags&A.SAMPLED?this._remoteParentSampled.shouldSample(t,e,n,r,o,i):this._remoteParentNotSampled.shouldSample(t,e,n,r,o,i):a.traceFlags&A.SAMPLED?this._localParentSampled.shouldSample(t,e,n,r,o,i):this._localParentNotSampled.shouldSample(t,e,n,r,o,i):this._root.shouldSample(t,e,n,r,o,i)},t.prototype.toString=function(){return"ParentBased{root="+this._root.toString()+", remoteParentSampled="+this._remoteParentSampled.toString()+", remoteParentNotSampled="+this._remoteParentNotSampled.toString()+", localParentSampled="+this._localParentSampled.toString()+", localParentNotSampled="+this._localParentNotSampled.toString()+"}"},t}(),bo=function(){function t(t){void 0===t&&(t=0),this._ratio=t,this._ratio=this._normalize(t),this._upperBound=Math.floor(4294967295*this._ratio)}return t.prototype.shouldSample=function(t,e){return{decision:Et(e)&&this._accumulate(e)<this._upperBound?_o.RECORD_AND_SAMPLED:_o.NOT_RECORD}},t.prototype.toString=function(){return"TraceIdRatioBased{"+this._ratio+"}"},t.prototype._normalize=function(t){return"number"!=typeof t||isNaN(t)?0:t>=1?1:t<=0?0:t},t.prototype._accumulate=function(t){for(var e=0,n=0;n<t.length/8;n++){var r=8*n;e=(e^parseInt(t.slice(r,r+8),16))>>>0}return e},t}(),Ro=Ne.AlwaysOn,Lo=1;function Po(){var t=Qe();return{sampler:Ao(t),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:t.OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT,attributeCountLimit:t.OTEL_ATTRIBUTE_COUNT_LIMIT},spanLimits:{attributeValueLengthLimit:t.OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT,attributeCountLimit:t.OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT,linkCountLimit:t.OTEL_SPAN_LINK_COUNT_LIMIT,eventCountLimit:t.OTEL_SPAN_EVENT_COUNT_LIMIT,attributePerEventCountLimit:t.OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT,attributePerLinkCountLimit:t.OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT},mergeResourceWithDefaults:!0}}function Ao(t){switch(void 0===t&&(t=Qe()),t.OTEL_TRACES_SAMPLER){case Ne.AlwaysOn:return new So;case Ne.AlwaysOff:return new mo;case Ne.ParentBasedAlwaysOn:return new Oo({root:new So});case Ne.ParentBasedAlwaysOff:return new Oo({root:new mo});case Ne.TraceIdRatio:return new bo(wo(t));case Ne.ParentBasedTraceIdRatio:return new Oo({root:new bo(wo(t))});default:return It.error('OTEL_TRACES_SAMPLER value "'+t.OTEL_TRACES_SAMPLER+" invalid, defaulting to "+Ro+'".'),new So}}function wo(t){if(void 0===t.OTEL_TRACES_SAMPLER_ARG||""===t.OTEL_TRACES_SAMPLER_ARG)return It.error("OTEL_TRACES_SAMPLER_ARG is blank, defaulting to "+Lo+"."),Lo;var e=Number(t.OTEL_TRACES_SAMPLER_ARG);return isNaN(e)?(It.error("OTEL_TRACES_SAMPLER_ARG="+t.OTEL_TRACES_SAMPLER_ARG+" was given, but it is invalid, defaulting to "+Lo+"."),Lo):e<0||e>1?(It.error("OTEL_TRACES_SAMPLER_ARG="+t.OTEL_TRACES_SAMPLER_ARG+" was given, but it is out of range ([0..1]), defaulting to "+Lo+"."),Lo):e}var Co=function(){function t(t,e){this._exporter=t,this._isExporting=!1,this._finishedSpans=[],this._droppedSpansCount=0;var n=Qe();this._maxExportBatchSize="number"==typeof(null==e?void 0:e.maxExportBatchSize)?e.maxExportBatchSize:n.OTEL_BSP_MAX_EXPORT_BATCH_SIZE,this._maxQueueSize="number"==typeof(null==e?void 0:e.maxQueueSize)?e.maxQueueSize:n.OTEL_BSP_MAX_QUEUE_SIZE,this._scheduledDelayMillis="number"==typeof(null==e?void 0:e.scheduledDelayMillis)?e.scheduledDelayMillis:n.OTEL_BSP_SCHEDULE_DELAY,this._exportTimeoutMillis="number"==typeof(null==e?void 0:e.exportTimeoutMillis)?e.exportTimeoutMillis:n.OTEL_BSP_EXPORT_TIMEOUT,this._shutdownOnce=new Cr(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(It.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}return t.prototype.forceFlush=function(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()},t.prototype.onStart=function(t,e){},t.prototype.onEnd=function(t){this._shutdownOnce.isCalled||t.spanContext().traceFlags&A.SAMPLED&&this._addToBuffer(t)},t.prototype.shutdown=function(){return this._shutdownOnce.call()},t.prototype._shutdown=function(){var t=this;return Promise.resolve().then((function(){return t.onShutdown()})).then((function(){return t._flushAll()})).then((function(){return t._exporter.shutdown()}))},t.prototype._addToBuffer=function(t){if(this._finishedSpans.length>=this._maxQueueSize)return 0===this._droppedSpansCount&&It.debug("maxQueueSize reached, dropping spans"),void this._droppedSpansCount++;this._droppedSpansCount>0&&(It.warn("Dropped "+this._droppedSpansCount+" spans because maxQueueSize reached"),this._droppedSpansCount=0),this._finishedSpans.push(t),this._maybeStartTimer()},t.prototype._flushAll=function(){var t=this;return new Promise((function(e,n){for(var r=[],o=0,i=Math.ceil(t._finishedSpans.length/t._maxExportBatchSize);o<i;o++)r.push(t._flushOneBatch());Promise.all(r).then((function(){e()})).catch(n)}))},t.prototype._flushOneBatch=function(){var t=this;return this._clearTimer(),0===this._finishedSpans.length?Promise.resolve():new Promise((function(e,n){var r=setTimeout((function(){n(new Error("Timeout"))}),t._exportTimeoutMillis);Nt.with(fe(Nt.active()),(function(){var o;t._finishedSpans.length<=t._maxExportBatchSize?(o=t._finishedSpans,t._finishedSpans=[]):o=t._finishedSpans.splice(0,t._maxExportBatchSize);for(var i=function(){return t._exporter.export(o,(function(t){var o;clearTimeout(r),t.code===bn.SUCCESS?e():n(null!==(o=t.error)&&void 0!==o?o:new Error("BatchSpanProcessor: span export failed"))}))},a=null,s=0,u=o.length;s<u;s++){var c=o[s];c.resource.asyncAttributesPending&&c.resource.waitForAsyncAttributes&&(null!=a||(a=[]),a.push(c.resource.waitForAsyncAttributes()))}null===a?i():Promise.all(a).then(i,(function(t){xe(t),n(t)}))}))}))},t.prototype._maybeStartTimer=function(){var t=this;if(!this._isExporting){var e=function(){t._isExporting=!0,t._flushOneBatch().finally((function(){t._isExporting=!1,t._finishedSpans.length>0&&(t._clearTimer(),t._maybeStartTimer())})).catch((function(e){t._isExporting=!1,xe(e)}))};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();void 0===this._timer&&(this._timer=setTimeout((function(){return e()}),this._scheduledDelayMillis),this._timer)}},t.prototype._clearTimer=function(){void 0!==this._timer&&(clearTimeout(this._timer),this._timer=void 0)},t}(),No=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Io=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.onInit(n),r}return No(e,t),e.prototype.onInit=function(t){var e=this;!0!==(null==t?void 0:t.disableAutoFlushOnDocumentHide)&&"undefined"!=typeof document&&(this._visibilityChangeListener=function(){"hidden"===document.visibilityState&&e.forceFlush().catch((function(t){xe(t)}))},this._pageHideListener=function(){e.forceFlush().catch((function(t){xe(t)}))},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))},e.prototype.onShutdown=function(){"undefined"!=typeof document&&(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener("pagehide",this._pageHideListener))},e}(Co),xo=function(){this.generateTraceId=Do(16),this.generateSpanId=Do(8)},Mo=Array(32);function Do(t){return function(){for(var e=0;e<2*t;e++)Mo[e]=Math.floor(16*Math.random())+48,Mo[e]>=58&&(Mo[e]+=39);return String.fromCharCode.apply(null,Mo.slice(0,2*t))}}var Uo=function(){function t(t,e,n){this._tracerProvider=n;var r,o,i,a,s=(r=e,o={sampler:Ao()},i=Po(),(a=Object.assign({},i,o,r)).generalLimits=Object.assign({},i.generalLimits,r.generalLimits||{}),a.spanLimits=Object.assign({},i.spanLimits,r.spanLimits||{}),a);this._sampler=s.sampler,this._generalLimits=s.generalLimits,this._spanLimits=s.spanLimits,this._idGenerator=e.idGenerator||new xo,this.resource=n.resource,this.instrumentationLibrary=t}return t.prototype.startSpan=function(t,e,n){var r,o,i;void 0===e&&(e={}),void 0===n&&(n=Nt.active()),e.root&&(n=qt.deleteSpan(n));var a=qt.getSpan(n);if(de(n))return It.debug("Instrumentation suppressed, returning Noop Span"),qt.wrapSpanContext(ut);var s,u,c,l=null==a?void 0:a.spanContext(),p=this._idGenerator.generateSpanId();l&&qt.isSpanContextValid(l)?(s=l.traceId,u=l.traceState,c=l.spanId):s=this._idGenerator.generateTraceId();var f=null!==(r=e.kind)&&void 0!==r?r:Rt.INTERNAL,d=(null!==(o=e.links)&&void 0!==o?o:[]).map((function(t){return{context:t.context,attributes:Le(t.attributes)}})),h=Le(e.attributes),_=this._sampler.shouldSample(n,s,t,f,h,d);u=null!==(i=_.traceState)&&void 0!==i?i:u;var v={traceId:s,spanId:p,traceFlags:_.decision===bt.RECORD_AND_SAMPLED?A.SAMPLED:A.NONE,traceState:u};if(_.decision===bt.NOT_RECORD)return It.debug("Recording is off, propagating context in a non-recording span"),qt.wrapSpanContext(v);var y=Le(Object.assign(h,_.attributes));return new To(this,n,t,v,f,c,d,e.startTime,void 0,y)},t.prototype.startActiveSpan=function(t,e,n,r){var o,i,a;if(!(arguments.length<2)){2===arguments.length?a=e:3===arguments.length?(o=e,a=n):(o=e,i=n,a=r);var s=null!=i?i:Nt.active(),u=this.startSpan(t,o,s),c=qt.setSpan(s,u);return Nt.with(c,a,void 0,u)}},t.prototype.getGeneralLimits=function(){return this._generalLimits},t.prototype.getSpanLimits=function(){return this._spanLimits},t.prototype.getActiveSpanProcessor=function(){return this._tracerProvider.getActiveSpanProcessor()},t}();var jo,Bo=function(){return Bo=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},Bo.apply(this,arguments)},ko=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Fo=function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},Ho=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},Vo=function(){function t(t,e){var n,r=this;this._attributes=t,this.asyncAttributesPending=null!=e,this._syncAttributes=null!==(n=this._attributes)&&void 0!==n?n:{},this._asyncAttributesPromise=null==e?void 0:e.then((function(t){return r._attributes=Object.assign({},r._attributes,t),r.asyncAttributesPending=!1,t}),(function(t){return It.debug("a resource's async attributes promise rejected: %s",t),r.asyncAttributesPending=!1,{}}))}return t.empty=function(){return t.EMPTY},t.default=function(){var e;return new t(((e={})["service.name"]="unknown_service",e[Tn]=Sn[Tn],e[En]=Sn[En],e[mn]=Sn[mn],e))},Object.defineProperty(t.prototype,"attributes",{get:function(){var t;return this.asyncAttributesPending&&It.error("Accessing resource attributes before async attributes settled"),null!==(t=this._attributes)&&void 0!==t?t:{}},enumerable:!1,configurable:!0}),t.prototype.waitForAsyncAttributes=function(){return ko(this,void 0,void 0,(function(){return Fo(this,(function(t){switch(t.label){case 0:return this.asyncAttributesPending?[4,this._asyncAttributesPromise]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},t.prototype.merge=function(e){var n,r=this;if(!e)return this;var o=Bo(Bo({},this._syncAttributes),null!==(n=e._syncAttributes)&&void 0!==n?n:e.attributes);if(!this._asyncAttributesPromise&&!e._asyncAttributesPromise)return new t(o);var i=Promise.all([this._asyncAttributesPromise,e._asyncAttributesPromise]).then((function(t){var n,o=Ho(t,2),i=o[0],a=o[1];return Bo(Bo(Bo(Bo({},r._syncAttributes),i),null!==(n=e._syncAttributes)&&void 0!==n?n:e.attributes),a)}));return new t(o,i)},t.EMPTY=new t({}),t}(),Xo=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Go=function(){function t(t){this._spanProcessors=t}return t.prototype.forceFlush=function(){var t,e,n=[];try{for(var r=Xo(this._spanProcessors),o=r.next();!o.done;o=r.next()){var i=o.value;n.push(i.forceFlush())}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}return new Promise((function(t){Promise.all(n).then((function(){t()})).catch((function(e){xe(e||new Error("MultiSpanProcessor: forceFlush failed")),t()}))}))},t.prototype.onStart=function(t,e){var n,r;try{for(var o=Xo(this._spanProcessors),i=o.next();!i.done;i=o.next()){i.value.onStart(t,e)}}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}},t.prototype.onEnd=function(t){var e,n;try{for(var r=Xo(this._spanProcessors),o=r.next();!o.done;o=r.next()){o.value.onEnd(t)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}},t.prototype.shutdown=function(){var t,e,n=[];try{for(var r=Xo(this._spanProcessors),o=r.next();!o.done;o=r.next()){var i=o.value;n.push(i.shutdown())}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}return new Promise((function(t,e){Promise.all(n).then((function(){t()}),e)}))},t}(),zo=function(){function t(){}return t.prototype.onStart=function(t,e){},t.prototype.onEnd=function(t){},t.prototype.shutdown=function(){return Promise.resolve()},t.prototype.forceFlush=function(){return Promise.resolve()},t}(),Ko=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},qo=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))};!function(t){t[t.resolved=0]="resolved",t[t.timeout=1]="timeout",t[t.error=2]="error",t[t.unresolved=3]="unresolved"}(jo||(jo={}));var Wo,Yo,$o,Qo=function(){function t(t){var e,n;void 0===t&&(t={}),this._registeredSpanProcessors=[],this._tracers=new Map;var r=hr({},Po(),function(t){var e,n,r,o,i,a,s,u,c,l,p,f,d=Object.assign({},t.spanLimits),h=Ze();return d.attributeCountLimit=null!==(a=null!==(i=null!==(o=null!==(n=null===(e=t.spanLimits)||void 0===e?void 0:e.attributeCountLimit)&&void 0!==n?n:null===(r=t.generalLimits)||void 0===r?void 0:r.attributeCountLimit)&&void 0!==o?o:h.OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT)&&void 0!==i?i:h.OTEL_ATTRIBUTE_COUNT_LIMIT)&&void 0!==a?a:Ve,d.attributeValueLengthLimit=null!==(f=null!==(p=null!==(l=null!==(u=null===(s=t.spanLimits)||void 0===s?void 0:s.attributeValueLengthLimit)&&void 0!==u?u:null===(c=t.generalLimits)||void 0===c?void 0:c.attributeValueLengthLimit)&&void 0!==l?l:h.OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT)&&void 0!==p?p:h.OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT)&&void 0!==f?f:He,Object.assign({},t,{spanLimits:d})}(t));if(this.resource=null!==(e=r.resource)&&void 0!==e?e:Vo.empty(),r.mergeResourceWithDefaults&&(this.resource=Vo.default().merge(this.resource)),this._config=Object.assign({},r,{resource:this.resource}),null===(n=t.spanProcessors)||void 0===n?void 0:n.length)this._registeredSpanProcessors=qo([],Ko(t.spanProcessors),!1),this.activeSpanProcessor=new Go(this._registeredSpanProcessors);else{var o=this._buildExporterFromEnv();if(void 0!==o){var i=new Io(o);this.activeSpanProcessor=i}else this.activeSpanProcessor=new zo}}return t.prototype.getTracer=function(t,e,n){var r=t+"@"+(e||"")+":"+((null==n?void 0:n.schemaUrl)||"");return this._tracers.has(r)||this._tracers.set(r,new Uo({name:t,version:e,schemaUrl:null==n?void 0:n.schemaUrl},this._config,this)),this._tracers.get(r)},t.prototype.addSpanProcessor=function(t){0===this._registeredSpanProcessors.length&&this.activeSpanProcessor.shutdown().catch((function(t){return It.error("Error while trying to shutdown current span processor",t)})),this._registeredSpanProcessors.push(t),this.activeSpanProcessor=new Go(this._registeredSpanProcessors)},t.prototype.getActiveSpanProcessor=function(){return this.activeSpanProcessor},t.prototype.register=function(t){void 0===t&&(t={}),qt.setGlobalTracerProvider(this),void 0===t.propagator&&(t.propagator=this._buildPropagatorFromEnv()),t.contextManager&&Nt.setGlobalContextManager(t.contextManager),t.propagator&&zt.setGlobalPropagator(t.propagator)},t.prototype.forceFlush=function(){var t=this._config.forceFlushTimeoutMillis,e=this._registeredSpanProcessors.map((function(e){return new Promise((function(n){var r,o=setTimeout((function(){n(new Error("Span processor did not completed within timeout period of "+t+" ms")),r=jo.timeout}),t);e.forceFlush().then((function(){clearTimeout(o),r!==jo.timeout&&(r=jo.resolved,n(r))})).catch((function(t){clearTimeout(o),r=jo.error,n(t)}))}))}));return new Promise((function(t,n){Promise.all(e).then((function(e){var r=e.filter((function(t){return t!==jo.resolved}));r.length>0?n(r):t()})).catch((function(t){return n([t])}))}))},t.prototype.shutdown=function(){return this.activeSpanProcessor.shutdown()},t.prototype._getPropagator=function(t){var e;return null===(e=this.constructor._registeredPropagators.get(t))||void 0===e?void 0:e()},t.prototype._getSpanExporter=function(t){var e;return null===(e=this.constructor._registeredExporters.get(t))||void 0===e?void 0:e()},t.prototype._buildPropagatorFromEnv=function(){var t=this,e=Array.from(new Set(Qe().OTEL_PROPAGATORS)),n=e.map((function(e){var n=t._getPropagator(e);return n||It.warn('Propagator "'+e+'" requested through environment variable is unavailable.'),n})).reduce((function(t,e){return e&&t.push(e),t}),[]);return 0===n.length?void 0:1===e.length?n[0]:new jn({propagators:n})},t.prototype._buildExporterFromEnv=function(){var t=Qe().OTEL_TRACES_EXPORTER;if("none"!==t&&""!==t){var e=this._getSpanExporter(t);return e||It.error('Exporter "'+t+'" requested through environment variable is unavailable.'),e}},t._registeredPropagators=new Map([["tracecontext",function(){return new Wn}],["baggage",function(){return new Se}]]),t._registeredExporters=new Map,t}(),Zo=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},Jo=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},ti=function(){function t(){this._enabled=!1,this._currentContext=C}return t.prototype._bindFunction=function(t,e){void 0===t&&(t=C);var n=this,r=function(){for(var r=this,o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return n.with(t,(function(){return e.apply(r,o)}))};return Object.defineProperty(r,"length",{enumerable:!1,configurable:!0,writable:!1,value:e.length}),r},t.prototype.active=function(){return this._currentContext},t.prototype.bind=function(t,e){return void 0===t&&(t=this.active()),"function"==typeof e?this._bindFunction(t,e):e},t.prototype.disable=function(){return this._currentContext=C,this._enabled=!1,this},t.prototype.enable=function(){return this._enabled||(this._enabled=!0,this._currentContext=C),this},t.prototype.with=function(t,e,n){for(var r=[],o=3;o<arguments.length;o++)r[o-3]=arguments[o];var i=this._currentContext;this._currentContext=t||C;try{return e.call.apply(e,Jo([n],Zo(r),!1))}finally{this._currentContext=i}},t}(),ei=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ni=function(t){function e(e){void 0===e&&(e={});var n=t.call(this,e)||this;if(e.contextManager)throw"contextManager should be defined in register method not in constructor";if(e.propagator)throw"propagator should be defined in register method not in constructor";return n}return ei(e,t),e.prototype.register=function(e){void 0===e&&(e={}),void 0===e.contextManager&&(e.contextManager=new ti),e.contextManager&&e.contextManager.enable(),t.prototype.register.call(this,e)},e}(Qo);function ri(t,e){return e in t}function oi(t,e,n,r){var o=void 0,i=void 0;ri(n,e)&&"number"==typeof n[e]&&(o=n[e]);var a=Wo.FETCH_START;if(ri(n,a)&&"number"==typeof n[a]&&(i=n[a]),void 0!==o&&void 0!==i&&o>=i)return t.addEvent(e,o),t}function ii(t,e,n){void 0===n&&(n=!1),n||(oi(t,Wo.FETCH_START,e),oi(t,Wo.DOMAIN_LOOKUP_START,e),oi(t,Wo.DOMAIN_LOOKUP_END,e),oi(t,Wo.CONNECT_START,e),ri(e,"name")&&e.name.startsWith("https:")&&oi(t,Wo.SECURE_CONNECTION_START,e),oi(t,Wo.CONNECT_END,e),oi(t,Wo.REQUEST_START,e),oi(t,Wo.RESPONSE_START,e),oi(t,Wo.RESPONSE_END,e));var r=e[Wo.ENCODED_BODY_SIZE];void 0!==r&&t.setAttribute("http.response_content_length",r);var o=e[Wo.DECODED_BODY_SIZE];void 0!==o&&r!==o&&t.setAttribute("http.response_content_length_uncompressed",o)}function ai(){return"undefined"!=typeof location?location.origin:void 0}function si(t,e,n,r,o,i){void 0===o&&(o=new WeakSet);var a=ui(t),s=function(t,e,n,r,o,i){var a=In(e),s=In(n),u=r.filter((function(e){var n=In(Cn(e[Wo.FETCH_START])),r=In(Cn(e[Wo.RESPONSE_END]));return e.initiatorType.toLowerCase()===(i||"xmlhttprequest")&&e.name===t&&n>=a&&r<=s}));u.length>0&&(u=u.filter((function(t){return!o.has(t)})));return u}(t=a.toString(),e,n,r,o,i);if(0===s.length)return{mainRequest:void 0};if(1===s.length)return{mainRequest:s[0]};var u=function(t){return t.slice().sort((function(t,e){var n=t[Wo.FETCH_START],r=e[Wo.FETCH_START];return n>r?1:n<r?-1:0}))}(s);if(a.origin!==ai()&&u.length>1){var c=u[0],l=function(t,e,n){for(var r,o=In(n),i=In(Cn(e)),a=t[1],s=t.length,u=1;u<s;u++){var c=t[u],l=In(Cn(c[Wo.FETCH_START])),p=o-In(Cn(c[Wo.RESPONSE_END]));l>=i&&(!r||p<r)&&(r=p,a=c)}return a}(u,c[Wo.RESPONSE_END],n),p=c[Wo.RESPONSE_END];return l[Wo.FETCH_START]<p&&(l=c,c=void 0),{corsPreFlightRequest:c,mainRequest:l}}return{mainRequest:s[0]}}function ui(t){if("function"==typeof URL)return new URL(t,"undefined"!=typeof document?document.baseURI:"undefined"!=typeof location?location.href:void 0);var e=(Yo||(Yo=document.createElement("a")),Yo);return e.href=t,e}function ci(t,e){var n=e||[];return("string"==typeof n||n instanceof RegExp)&&(n=[n]),ui(t).origin===ai()||n.some((function(e){return Rr(t,e)}))}!function(t){t.CONNECT_END="connectEnd",t.CONNECT_START="connectStart",t.DECODED_BODY_SIZE="decodedBodySize",t.DOM_COMPLETE="domComplete",t.DOM_CONTENT_LOADED_EVENT_END="domContentLoadedEventEnd",t.DOM_CONTENT_LOADED_EVENT_START="domContentLoadedEventStart",t.DOM_INTERACTIVE="domInteractive",t.DOMAIN_LOOKUP_END="domainLookupEnd",t.DOMAIN_LOOKUP_START="domainLookupStart",t.ENCODED_BODY_SIZE="encodedBodySize",t.FETCH_START="fetchStart",t.LOAD_EVENT_END="loadEventEnd",t.LOAD_EVENT_START="loadEventStart",t.NAVIGATION_START="navigationStart",t.REDIRECT_END="redirectEnd",t.REDIRECT_START="redirectStart",t.REQUEST_START="requestStart",t.RESPONSE_END="responseEnd",t.RESPONSE_START="responseStart",t.SECURE_CONNECTION_START="secureConnectionStart",t.UNLOAD_EVENT_END="unloadEventEnd",t.UNLOAD_EVENT_START="unloadEventStart"}(Wo||(Wo={})),function(t){t.COMPONENT="component",t.HTTP_ERROR_NAME="http.error_name",t.HTTP_STATUS_TEXT="http.status_text"}($o||($o={}));var li=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},pi=function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},fi=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},di=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},hi=It.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-fetch/utils"});function _i(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(t[0]instanceof URL||"string"==typeof t[0]){var n=t[1];if(!(null==n?void 0:n.body))return Promise.resolve();if(n.body instanceof ReadableStream){var r=function(t){if(!t.pipeThrough)return hi.warn("Platform has ReadableStream but not pipeThrough!"),{body:t,length:Promise.resolve(void 0)};var e,n=0,r=new Promise((function(t){e=t})),o=new TransformStream({start:function(){},transform:function(t,e){return li(this,void 0,void 0,(function(){var r;return pi(this,(function(o){switch(o.label){case 0:return[4,t];case 1:return r=o.sent(),n+=r.byteLength,e.enqueue(t),[2]}}))}))},flush:function(){e(n)}});return{body:t.pipeThrough(o),length:r}}(n.body),o=r.body,i=r.length;return n.body=o,i}return Promise.resolve(function(t){if("undefined"!=typeof Document&&t instanceof Document)return(new XMLSerializer).serializeToString(document).length;if(t instanceof Blob)return t.size;if(void 0!==t.byteLength)return t.byteLength;if(t instanceof FormData)return function(t){var e,n,r=0;try{for(var o=fi(t.entries()),i=o.next();!i.done;i=o.next()){var a=di(i.value,2),s=a[0],u=a[1];r+=s.length,u instanceof Blob?r+=u.size:r+=u.length}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}return r}(t);if(t instanceof URLSearchParams)return yi(t.toString());if("string"==typeof t)return yi(t);return void hi.warn("unknown body type")}(n.body))}var a=t[0];return(null==a?void 0:a.body)?a.clone().text().then((function(t){return yi(t)})):Promise.resolve()}var vi=new TextEncoder;function yi(t){return vi.encode(t).byteLength}var gi,Ei,Ti="0.57.2",mi=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Si=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},Oi=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},bi="object"==typeof process&&"node"===(null===(gi=process.release)||void 0===gi?void 0:gi.name),Ri=function(t){function e(e){void 0===e&&(e={});var n=t.call(this,"@opentelemetry/instrumentation-fetch",Ti,e)||this;return n.component="fetch",n.version=Ti,n.moduleName=n.component,n._usedResources=new WeakSet,n._tasksCount=0,n}return mi(e,t),e.prototype.init=function(){},e.prototype._addChildSpan=function(t,e){var n=this.tracer.startSpan("CORS Preflight",{startTime:e[Wo.FETCH_START]},qt.setSpan(Nt.active(),t));ii(n,e,this.getConfig().ignoreNetworkEvents),n.end(e[Wo.RESPONSE_END])},e.prototype._addFinalSpanAttributes=function(t,e){var n=ui(e.url);t.setAttribute(vn,e.status),null!=e.statusText&&t.setAttribute($o.HTTP_STATUS_TEXT,e.statusText),t.setAttribute(hn,n.host),t.setAttribute(_n,n.protocol.replace(":","")),"undefined"!=typeof navigator&&t.setAttribute(yn,navigator.userAgent)},e.prototype._addHeaders=function(t,e){if(!ci(e,this.getConfig().propagateTraceHeaderCorsUrls)){var n={};return zt.inject(Nt.active(),n),void(Object.keys(n).length>0&&this._diag.debug("headers inject skipped due to CORS policy"))}if(t instanceof Request)zt.inject(Nt.active(),t.headers,{set:function(t,e,n){return t.set(e,"string"==typeof n?n:String(n))}});else if(t.headers instanceof Headers)zt.inject(Nt.active(),t.headers,{set:function(t,e,n){return t.set(e,"string"==typeof n?n:String(n))}});else if(t.headers instanceof Map)zt.inject(Nt.active(),t.headers,{set:function(t,e,n){return t.set(e,"string"==typeof n?n:String(n))}});else{n={};zt.inject(Nt.active(),n),t.headers=Object.assign({},n,t.headers||{})}},e.prototype._clearResources=function(){0===this._tasksCount&&this.getConfig().clearTimingResources&&(performance.clearResourceTimings(),this._usedResources=new WeakSet)},e.prototype._createSpan=function(t,e){var n;if(void 0===e&&(e={}),!Lr(t,this.getConfig().ignoreUrls)){var r=(e.method||"GET").toUpperCase(),o="HTTP "+r;return this.tracer.startSpan(o,{kind:Rt.CLIENT,attributes:(n={},n[$o.COMPONENT]=this.moduleName,n[fn]=r,n[dn]=t,n)})}this._diag.debug("ignoring span as url matches ignored url")},e.prototype._findResourceAndAddNetworkEvents=function(t,e,n){var r=e.entries;if(!r.length){if(!performance.getEntriesByType)return;r=performance.getEntriesByType("resource")}var o=si(e.spanUrl,e.startTime,n,r,this._usedResources,"fetch");if(o.mainRequest){var i=o.mainRequest;this._markResourceAsUsed(i);var a=o.corsPreFlightRequest;a&&(this._addChildSpan(t,a),this._markResourceAsUsed(a)),ii(t,i,this.getConfig().ignoreNetworkEvents)}},e.prototype._markResourceAsUsed=function(t){this._usedResources.add(t)},e.prototype._endSpan=function(t,e,n){var r=this,o=Pn(Date.now()),i=wn();this._addFinalSpanAttributes(t,n),setTimeout((function(){var n;null===(n=e.observer)||void 0===n||n.disconnect(),r._findResourceAndAddNetworkEvents(t,e,i),r._tasksCount--,r._clearResources(),t.end(o)}),300)},e.prototype._patchConstructor=function(){var t=this;return function(e){var n=t;return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var o=this,i=ui(t[0]instanceof Request?t[0].url:String(t[0])).href,a=t[0]instanceof Request?t[0]:t[1]||{},s=n._createSpan(i,a);if(!s)return e.apply(this,t);var u=n._prepareSpanData(i);function c(t,e){n._applyAttributesAfterFetch(t,a,e),n._endSpan(t,u,{status:e.status||0,statusText:e.message,url:i})}function l(t,e){n._applyAttributesAfterFetch(t,a,e),e.status>=200&&e.status<400?n._endSpan(t,u,e):n._endSpan(t,u,{status:e.status,statusText:e.statusText,url:i})}function p(t,e,n){try{var r=n.clone(),o=n.clone(),i=r.body;if(i){var a=i.getReader(),s=function(){a.read().then((function(e){e.done?l(t,o):s()}),(function(e){c(t,e)}))};s()}else l(t,n)}finally{e(n)}}function f(t,e,n){try{c(t,n)}finally{e(n)}}return n.getConfig().measureRequestSize&&_i.apply(void 0,Oi([],Si(t),!1)).then((function(t){t&&s.setAttribute(gn,t)})).catch((function(t){n._diag.warn("getFetchBodyLength",t)})),new Promise((function(t,r){return Nt.with(qt.setSpan(Nt.active(),s),(function(){return n._addHeaders(a,i),n._tasksCount++,e.apply(o,a instanceof Request?[a]:[i,a]).then(p.bind(o,s,t),f.bind(o,s,r))}))}))}}},e.prototype._applyAttributesAfterFetch=function(t,e,n){var r=this,o=this.getConfig().applyCustomAttributesOnSpan;o&&fo((function(){return o(t,e,n)}),(function(t){t&&r._diag.error("applyCustomAttributesOnSpan",t)}))},e.prototype._prepareSpanData=function(t){var e=wn(),n=[];if("function"!=typeof PerformanceObserver)return{entries:n,startTime:e,spanUrl:t};var r=new PerformanceObserver((function(e){e.getEntries().forEach((function(e){"fetch"===e.initiatorType&&e.name===t&&n.push(e)}))}));return r.observe({entryTypes:["resource"]}),{entries:n,observer:r,startTime:e,spanUrl:t}},e.prototype.enable=function(){bi?this._diag.warn("this instrumentation is intended for web usage only, it does not instrument Node.js's fetch()"):(ho(fetch)&&(this._unwrap($e,"fetch"),this._diag.debug("removing previous patch for constructor")),this._wrap($e,"fetch",this._patchConstructor()))},e.prototype.disable=function(){bi||(this._unwrap($e,"fetch"),this._usedResources=new WeakSet)},e}(po);!function(t){t.METHOD_OPEN="open",t.METHOD_SEND="send",t.EVENT_ABORT="abort",t.EVENT_ERROR="error",t.EVENT_LOAD="loaded",t.EVENT_TIMEOUT="timeout"}(Ei||(Ei={}));var Li=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Pi=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},Ai=It.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils"});function wi(t){return"undefined"!=typeof Document&&t instanceof Document?(new XMLSerializer).serializeToString(document).length:t instanceof Blob?t.size:void 0!==t.byteLength?t.byteLength:t instanceof FormData?function(t){var e,n,r=0;try{for(var o=Li(t.entries()),i=o.next();!i.done;i=o.next()){var a=Pi(i.value,2),s=a[0],u=a[1];r+=s.length,u instanceof Blob?r+=u.size:r+=u.length}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}return r}(t):t instanceof URLSearchParams?Ni(t.toString()):"string"==typeof t?Ni(t):void Ai.warn("unknown body type")}var Ci=new TextEncoder;function Ni(t){return Ci.encode(t).byteLength}var Ii,xi="0.57.2";!function(t){t.HTTP_STATUS_TEXT="http.status_text"}(Ii||(Ii={}));var Mi=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Di=function(t){function e(e){void 0===e&&(e={});var n=t.call(this,"@opentelemetry/instrumentation-xml-http-request",xi,e)||this;return n.component="xml-http-request",n.version=xi,n.moduleName=n.component,n._tasksCount=0,n._xhrMem=new WeakMap,n._usedResources=new WeakSet,n}return Mi(e,t),e.prototype.init=function(){},e.prototype._addHeaders=function(t,e){if(!ci(ui(e).href,this.getConfig().propagateTraceHeaderCorsUrls)){var n={};return zt.inject(Nt.active(),n),void(Object.keys(n).length>0&&this._diag.debug("headers inject skipped due to CORS policy"))}var r={};zt.inject(Nt.active(),r),Object.keys(r).forEach((function(e){t.setRequestHeader(e,String(r[e]))}))},e.prototype._addChildSpan=function(t,e){var n=this;Nt.with(qt.setSpan(Nt.active(),t),(function(){var t=n.tracer.startSpan("CORS Preflight",{startTime:e[Wo.FETCH_START]});ii(t,e,n.getConfig().ignoreNetworkEvents),t.end(e[Wo.RESPONSE_END])}))},e.prototype._addFinalSpanAttributes=function(t,e,n){if("string"==typeof n){var r=ui(n);void 0!==e.status&&t.setAttribute(vn,e.status),void 0!==e.statusText&&t.setAttribute(Ii.HTTP_STATUS_TEXT,e.statusText),t.setAttribute(hn,r.host),t.setAttribute(_n,r.protocol.replace(":","")),t.setAttribute(yn,navigator.userAgent)}},e.prototype._applyAttributesAfterXHR=function(t,e){var n=this,r=this.getConfig().applyCustomAttributesOnSpan;"function"==typeof r&&fo((function(){return r(t,e)}),(function(t){t&&n._diag.error("applyCustomAttributesOnSpan",t)}))},e.prototype._addResourceObserver=function(t,e){var n=this._xhrMem.get(t);n&&"function"==typeof PerformanceObserver&&"function"==typeof PerformanceResourceTiming&&(n.createdResources={observer:new PerformanceObserver((function(t){var r=t.getEntries(),o=ui(e);r.forEach((function(t){"xmlhttprequest"===t.initiatorType&&t.name===o.href&&n.createdResources&&n.createdResources.entries.push(t)}))})),entries:[]},n.createdResources.observer.observe({entryTypes:["resource"]}))},e.prototype._clearResources=function(){0===this._tasksCount&&this.getConfig().clearTimingResources&&(un.clearResourceTimings(),this._xhrMem=new WeakMap,this._usedResources=new WeakSet)},e.prototype._findResourceAndAddNetworkEvents=function(t,e,n,r,o){if(n&&r&&o&&t.createdResources){var i=t.createdResources.entries;i&&i.length||(i=un.getEntriesByType("resource"));var a=si(ui(n).href,r,o,i,this._usedResources);if(a.mainRequest){var s=a.mainRequest;this._markResourceAsUsed(s);var u=a.corsPreFlightRequest;u&&(this._addChildSpan(e,u),this._markResourceAsUsed(u)),ii(e,s,this.getConfig().ignoreNetworkEvents)}}},e.prototype._cleanPreviousSpanInformation=function(t){var e=this._xhrMem.get(t);if(e){var n=e.callbackToRemoveEvents;n&&n(),this._xhrMem.delete(t)}},e.prototype._createSpan=function(t,e,n){var r;if(!Lr(e,this.getConfig().ignoreUrls)){var o=n.toUpperCase(),i=this.tracer.startSpan(o,{kind:Rt.CLIENT,attributes:(r={},r[fn]=n,r[dn]=ui(e).toString(),r)});return i.addEvent(Ei.METHOD_OPEN),this._cleanPreviousSpanInformation(t),this._xhrMem.set(t,{span:i,spanUrl:e}),i}this._diag.debug("ignoring span as url matches ignored url")},e.prototype._markResourceAsUsed=function(t){this._usedResources.add(t)},e.prototype._patchOpen=function(){var t=this;return function(e){var n=t;return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var o=t[0],i=t[1];return n._createSpan(this,i,o),e.apply(this,t)}}},e.prototype._patchSend=function(){var t=this;function e(e,n){var r=t._xhrMem.get(n);if(r){r.status=n.status,r.statusText=n.statusText,t._xhrMem.delete(n),r.span&&t._applyAttributesAfterXHR(r.span,n);var o=wn(),i=Date.now();setTimeout((function(){!function(e,n,r,o){var i=n.callbackToRemoveEvents;"function"==typeof i&&i();var a=n.span,s=n.spanUrl,u=n.sendStartTime;a&&(t._findResourceAndAddNetworkEvents(n,a,s,u,r),a.addEvent(e,o),t._addFinalSpanAttributes(a,n,s),a.end(o),t._tasksCount--),t._clearResources()}(e,r,o,i)}),300)}}function n(){e(Ei.EVENT_ERROR,this)}function r(){e(Ei.EVENT_ABORT,this)}function o(){e(Ei.EVENT_TIMEOUT,this)}function i(){this.status<299?e(Ei.EVENT_LOAD,this):e(Ei.EVENT_ERROR,this)}return function(e){return function(){for(var a=this,s=[],u=0;u<arguments.length;u++)s[u]=arguments[u];var c=t._xhrMem.get(this);if(!c)return e.apply(this,s);var l=c.span,p=c.spanUrl;if(l&&p){if(t.getConfig().measureRequestSize&&(null==s?void 0:s[0])){var f=wi(s[0]);void 0!==f&&l.setAttribute(gn,f)}Nt.with(qt.setSpan(Nt.active(),l),(function(){t._tasksCount++,c.sendStartTime=wn(),l.addEvent(Ei.METHOD_SEND),a.addEventListener("abort",r),a.addEventListener("error",n),a.addEventListener("load",i),a.addEventListener("timeout",o),c.callbackToRemoveEvents=function(){!function(e){e.removeEventListener("abort",r),e.removeEventListener("error",n),e.removeEventListener("load",i),e.removeEventListener("timeout",o);var a=t._xhrMem.get(e);a&&(a.callbackToRemoveEvents=void 0)}(a),c.createdResources&&c.createdResources.observer.disconnect()},t._addHeaders(a,p),t._addResourceObserver(a,p)}))}return e.apply(this,s)}}},e.prototype.enable=function(){this._diag.debug("applying patch to",this.moduleName,this.version),ho(XMLHttpRequest.prototype.open)&&(this._unwrap(XMLHttpRequest.prototype,"open"),this._diag.debug("removing previous patch from method open")),ho(XMLHttpRequest.prototype.send)&&(this._unwrap(XMLHttpRequest.prototype,"send"),this._diag.debug("removing previous patch from method send")),this._wrap(XMLHttpRequest.prototype,"open",this._patchOpen()),this._wrap(XMLHttpRequest.prototype,"send",this._patchSend())},e.prototype.disable=function(){this._diag.debug("removing patch from",this.moduleName,this.version),this._unwrap(XMLHttpRequest.prototype,"open"),this._unwrap(XMLHttpRequest.prototype,"send"),this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet},e}(po);class Ui extends Di{constructor(t={}){super(t);this.parentCreateSpan=this._createSpan.bind(this)}_patchOpen(){return t=>{const e=this;return function(...n){const r=n[0];let o=n[1];return o instanceof URL&&(o=o.href),e.parentCreateSpan(this,o,r),t.apply(this,n)}}}}function ji(t,e,n){Bi(t,n instanceof Error?0:n.status)}function Bi(t,e){if(null==e)return;(0===e||e>=400&&e<600)&&t.setStatus({code:Lt.ERROR})}function ki(t){return(e,n,r)=>{ji(e,0,r),null==t||t(e,n,r)}}function Fi(t){return(e,n)=>{!function(t,e){Bi(t,e.status)}(e,n),null==t||t(e,n)}}function Hi(t={}){const{fetchInstrumentationOptions:e,xhrInstrumentationOptions:n}=t,r=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n}(t,["fetchInstrumentationOptions","xhrInstrumentationOptions"]),o=function(t,e){return Object.assign(Object.assign(Object.assign(Object.assign({},e),{ignoreNetworkEvents:!0}),t),{applyCustomAttributesOnSpan:ki(null==t?void 0:t.applyCustomAttributesOnSpan)})}(e,r),i=function(t,e){return Object.assign(Object.assign(Object.assign(Object.assign({},e),{ignoreNetworkEvents:!0}),t),{applyCustomAttributesOnSpan:Fi(null==t?void 0:t.applyCustomAttributesOnSpan)})}(n,r);return[new Ri(o),new Ui(i)]}class Vi{constructor(t,e){this.processor=t,this.metas=e}forceFlush(){return this.processor.forceFlush()}onStart(t,e){var n;const r=this.metas.value.session;(null==r?void 0:r.id)&&(t.attributes[Wr]=r.id,t.attributes.session_id=r.id);const o=null!==(n=this.metas.value.user)&&void 0!==n?n:{};o.email&&(t.attributes["user.email"]=o.email),o.id&&(t.attributes["user.id"]=o.id),o.username&&(t.attributes["user.name"]=o.username),o.fullName&&(t.attributes["user.full_name"]=o.fullName),o.roles&&(t.attributes["user.roles"]=o.roles.split(",").map((t=>t.trim()))),o.hash&&(t.attributes["user.hash"]=o.hash),this.processor.onStart(t,e)}onEnd(t){this.processor.onEnd(t)}shutdown(){return this.processor.shutdown()}}class Xi{constructor(t){this.processor=t,e.apiMessageBus.subscribe((t=>{"user-action-start"!==t.type?[Gr,zr].includes(t.type)&&(this.message=void 0):this.message=t}))}forceFlush(){return this.processor.forceFlush()}onStart(t,e){var n,r;t.kind===Rt.CLIENT&&this.message&&(t.attributes["faro.action.user.name"]=null===(n=this.message)||void 0===n?void 0:n.name,t.attributes["faro.action.user.parentId"]=null===(r=this.message)||void 0===r?void 0:r.parentId),this.processor.onStart(t,e)}onEnd(t){this.processor.onEnd(t)}shutdown(){return this.processor.shutdown()}}function Gi(t={}){var e;return"true"===(null===(e=t.attributes)||void 0===e?void 0:e.isSampled)?_o.RECORD_AND_SAMPLED:_o.NOT_RECORD}class zi extends e.BaseInstrumentation{constructor(t={}){super(),this.options=t,this.name="@grafana/faro-web-tracing",this.version=e.VERSION}initialize(){var t,e,n,r;const o=this.options,i={};this.config.app.name&&(i["service.name"]=this.config.app.name),this.config.app.namespace&&(i["service.namespace"]=this.config.app.namespace),this.config.app.version&&(i["service.version"]=this.config.app.version),this.config.app.environment&&(i["deployment.environment.name"]=this.config.app.environment,i["deployment.environment"]=this.config.app.environment),Object.assign(i,o.resourceAttributes);const a=Vo.default().merge(new Vo(i));new ni({resource:a,sampler:{shouldSample:()=>({decision:Gi(this.api.getSession())})},spanProcessors:[null!==(t=o.spanProcessor)&&void 0!==t?t:new Xi(new Vi(new Io(new qr({api:this.api}),{scheduledDelayMillis:zi.SCHEDULED_BATCH_DELAY_MS,maxExportBatchSize:30}),this.metas))]}).register({propagator:null!==(e=o.propagator)&&void 0!==e?e:new oe,contextManager:o.contextManager});const{propagateTraceHeaderCorsUrls:s,fetchInstrumentationOptions:u,xhrInstrumentationOptions:c}=null!==(n=this.options.instrumentationOptions)&&void 0!==n?n:{};!function(t){var e,n,r=t.tracerProvider||qt.getTracerProvider(),o=t.meterProvider||Dt.getMeterProvider(),i=t.loggerProvider||ao.getLoggerProvider(),a=null!==(n=null===(e=t.instrumentations)||void 0===e?void 0:e.flat())&&void 0!==n?n:[];(function(t,e,n,r){for(var o=0,i=t.length;o<i;o++){var a=t[o];e&&a.setTracerProvider(e),n&&a.setMeterProvider(n),r&&a.setLoggerProvider&&a.setLoggerProvider(r),a.getConfig().enabled||a.enable()}})(a,r,o,i)}({instrumentations:null!==(r=o.instrumentations)&&void 0!==r?r:Hi({ignoreUrls:this.getIgnoreUrls(),propagateTraceHeaderCorsUrls:s,fetchInstrumentationOptions:u,xhrInstrumentationOptions:c})}),this.api.initOTEL(qt,Nt)}getIgnoreUrls(){return this.transports.transports.flatMap((t=>t.getIgnoreUrls()))}}return zi.SCHEDULED_BATCH_DELAY_MS=1e3,t.FaroSessionSpanProcessor=class{constructor(t,e){this.processor=t,this.metas=e}forceFlush(){return this.processor.forceFlush()}onStart(t,e){const n=this.metas.value.session;(null==n?void 0:n.id)&&(t.attributes[Wr]=n.id,t.attributes.session_id=n.id),this.processor.onStart(t,e)}onEnd(t){this.processor.onEnd(t)}shutdown(){return this.processor.shutdown()}},t.FaroTraceExporter=qr,t.TracingInstrumentation=zi,t.fetchCustomAttributeFunctionWithDefaults=ki,t.getDefaultOTELInstrumentations=Hi,t.getSamplingDecision=Gi,t.setSpanStatusOnFetchError=ji,t}({},GrafanaFaroWebSdk);
1
+ var GrafanaFaroWebTracing=function(t,e){"use strict";var n="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{},r="1.9.0",o=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;var i=function(t){var e=new Set([t]),n=new Set,r=t.match(o);if(!r)return function(){return!1};var i=+r[1],s=+r[2],a=+r[3];if(null!=r[4])return function(e){return e===t};function u(t){return n.add(t),!1}function c(t){return e.add(t),!0}return function(t){if(e.has(t))return!0;if(n.has(t))return!1;var r=t.match(o);if(!r)return u(t);var l=+r[1],p=+r[2],d=+r[3];return null!=r[4]||i!==l?u(t):0===i?s===p&&a<=d?c(t):u(t):s<=p?c(t):u(t)}}(r),s=r.split(".")[0],a=Symbol.for("opentelemetry.js.api."+s),u=n;function c(t,e,n,o){var i;void 0===o&&(o=!1);var s=u[a]=null!==(i=u[a])&&void 0!==i?i:{version:r};if(!o&&s[t]){var c=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+t);return n.error(c.stack||c.message),!1}if(s.version!==r){c=new Error("@opentelemetry/api: Registration of version v"+s.version+" for "+t+" does not match previously registered API v"+r);return n.error(c.stack||c.message),!1}return s[t]=e,n.debug("@opentelemetry/api: Registered a global for "+t+" v"+r+"."),!0}function l(t){var e,n,r=null===(e=u[a])||void 0===e?void 0:e.version;if(r&&i(r))return null===(n=u[a])||void 0===n?void 0:n[t]}function p(t,e){e.debug("@opentelemetry/api: Unregistering a global for "+t+" v"+r+".");var n=u[a];n&&delete n[t]}var d,h=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},f=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},g=function(){function t(t){this._namespace=t.namespace||"DiagComponentLogger"}return t.prototype.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return m("debug",this._namespace,t)},t.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return m("error",this._namespace,t)},t.prototype.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return m("info",this._namespace,t)},t.prototype.warn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return m("warn",this._namespace,t)},t.prototype.verbose=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return m("verbose",this._namespace,t)},t}();function m(t,e,n){var r=l("diag");if(r)return n.unshift(e),r[t].apply(r,f([],h(n),!1))}!function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"}(d||(d={}));var _=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},v=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},y=function(){function t(){function t(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=l("diag");if(r)return r[t].apply(r,v([],_(e),!1))}}var e=this;e.setLogger=function(t,n){var r,o,i;if(void 0===n&&(n={logLevel:d.INFO}),t===e){var s=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return e.error(null!==(r=s.stack)&&void 0!==r?r:s.message),!1}"number"==typeof n&&(n={logLevel:n});var a=l("diag"),u=function(t,e){function n(n,r){var o=e[n];return"function"==typeof o&&t>=r?o.bind(e):function(){}}return t<d.NONE?t=d.NONE:t>d.ALL&&(t=d.ALL),e=e||{},{error:n("error",d.ERROR),warn:n("warn",d.WARN),info:n("info",d.INFO),debug:n("debug",d.DEBUG),verbose:n("verbose",d.VERBOSE)}}(null!==(o=n.logLevel)&&void 0!==o?o:d.INFO,t);if(a&&!n.suppressOverrideMessage){var p=null!==(i=(new Error).stack)&&void 0!==i?i:"<failed to generate stacktrace>";a.warn("Current logger will be overwritten from "+p),u.warn("Current logger will overwrite one already registered from "+p)}return c("diag",u,e,!0)},e.disable=function(){p("diag",e)},e.createComponentLogger=function(t){return new g(t)},e.verbose=t("verbose"),e.debug=t("debug"),e.info=t("info"),e.warn=t("warn"),e.error=t("error")}return t.instance=function(){return this._instance||(this._instance=new t),this._instance},t}(),b=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},S=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},E=function(){function t(t){this._entries=t?new Map(t):new Map}return t.prototype.getEntry=function(t){var e=this._entries.get(t);if(e)return Object.assign({},e)},t.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map((function(t){var e=b(t,2);return[e[0],e[1]]}))},t.prototype.setEntry=function(e,n){var r=new t(this._entries);return r._entries.set(e,n),r},t.prototype.removeEntry=function(e){var n=new t(this._entries);return n._entries.delete(e),n},t.prototype.removeEntries=function(){for(var e,n,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];var i=new t(this._entries);try{for(var s=S(r),a=s.next();!a.done;a=s.next()){var u=a.value;i._entries.delete(u)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}return i},t.prototype.clear=function(){return new t},t}(),T=Symbol("BaggageEntryMetadata"),w=y.instance();function C(t){return void 0===t&&(t={}),new E(new Map(Object.entries(t)))}function A(t){return Symbol.for(t)}var O,R,N=function t(e){var n=this;n._currentContext=e?new Map(e):new Map,n.getValue=function(t){return n._currentContext.get(t)},n.setValue=function(e,r){var o=new t(n._currentContext);return o._currentContext.set(e,r),o},n.deleteValue=function(e){var r=new t(n._currentContext);return r._currentContext.delete(e),r}},x=new N,P=(O=function(t,e){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},O(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}O(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),L=function(){function t(){}return t.prototype.createGauge=function(t,e){return z},t.prototype.createHistogram=function(t,e){return q},t.prototype.createCounter=function(t,e){return $},t.prototype.createUpDownCounter=function(t,e){return G},t.prototype.createObservableGauge=function(t,e){return W},t.prototype.createObservableCounter=function(t,e){return K},t.prototype.createObservableUpDownCounter=function(t,e){return X},t.prototype.addBatchObservableCallback=function(t,e){},t.prototype.removeBatchObservableCallback=function(t){},t}(),D=function(){},I=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e.prototype.add=function(t,e){},e}(D),M=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e.prototype.add=function(t,e){},e}(D),k=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e.prototype.record=function(t,e){},e}(D),j=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e.prototype.record=function(t,e){},e}(D),U=function(){function t(){}return t.prototype.addCallback=function(t){},t.prototype.removeCallback=function(t){},t}(),B=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e}(U),F=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e}(U),H=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e}(U),V=new L,$=new I,z=new k,q=new j,G=new M,K=new B,W=new F,X=new H,Q={get:function(t,e){if(null!=t)return t[e]},keys:function(t){return null==t?[]:Object.keys(t)}},Y={set:function(t,e,n){null!=t&&(t[e]=n)}},Z=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},J=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},tt=function(){function t(){}return t.prototype.active=function(){return x},t.prototype.with=function(t,e,n){for(var r=[],o=3;o<arguments.length;o++)r[o-3]=arguments[o];return e.call.apply(e,J([n],Z(r),!1))},t.prototype.bind=function(t,e){return e},t.prototype.enable=function(){return this},t.prototype.disable=function(){return this},t}(),et=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},nt=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},rt="context",ot=new tt,it=function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalContextManager=function(t){return c(rt,t,y.instance())},t.prototype.active=function(){return this._getContextManager().active()},t.prototype.with=function(t,e,n){for(var r,o=[],i=3;i<arguments.length;i++)o[i-3]=arguments[i];return(r=this._getContextManager()).with.apply(r,nt([t,e,n],et(o),!1))},t.prototype.bind=function(t,e){return this._getContextManager().bind(t,e)},t.prototype._getContextManager=function(){return l(rt)||ot},t.prototype.disable=function(){this._getContextManager().disable(),p(rt,y.instance())},t}();!function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"}(R||(R={}));var st="0000000000000000",at="00000000000000000000000000000000",ut={traceId:at,spanId:st,traceFlags:R.NONE},ct=function(){function t(t){void 0===t&&(t=ut),this._spanContext=t}return t.prototype.spanContext=function(){return this._spanContext},t.prototype.setAttribute=function(t,e){return this},t.prototype.setAttributes=function(t){return this},t.prototype.addEvent=function(t,e){return this},t.prototype.addLink=function(t){return this},t.prototype.addLinks=function(t){return this},t.prototype.setStatus=function(t){return this},t.prototype.updateName=function(t){return this},t.prototype.end=function(t){},t.prototype.isRecording=function(){return!1},t.prototype.recordException=function(t,e){},t}(),lt=A("OpenTelemetry Context Key SPAN");function pt(t){return t.getValue(lt)||void 0}function dt(){return pt(it.getInstance().active())}function ht(t,e){return t.setValue(lt,e)}function ft(t){return t.deleteValue(lt)}function gt(t,e){return ht(t,new ct(e))}function mt(t){var e;return null===(e=pt(t))||void 0===e?void 0:e.spanContext()}var _t=/^([0-9a-f]{32})$/i,vt=/^[0-9a-f]{16}$/i;function yt(t){return _t.test(t)&&t!==at}function bt(t){return yt(t.traceId)&&(e=t.spanId,vt.test(e)&&e!==st);var e}function St(t){return new ct(t)}var Et=it.getInstance(),Tt=function(){function t(){}return t.prototype.startSpan=function(t,e,n){if(void 0===n&&(n=Et.active()),Boolean(null==e?void 0:e.root))return new ct;var r,o=n&&mt(n);return"object"==typeof(r=o)&&"string"==typeof r.spanId&&"string"==typeof r.traceId&&"number"==typeof r.traceFlags&&bt(o)?new ct(o):new ct},t.prototype.startActiveSpan=function(t,e,n,r){var o,i,s;if(!(arguments.length<2)){2===arguments.length?s=e:3===arguments.length?(o=e,s=n):(o=e,i=n,s=r);var a=null!=i?i:Et.active(),u=this.startSpan(t,o,a),c=ht(a,u);return Et.with(c,s,void 0,u)}},t}();var wt,Ct,At,Ot=new Tt,Rt=function(){function t(t,e,n,r){this._provider=t,this.name=e,this.version=n,this.options=r}return t.prototype.startSpan=function(t,e,n){return this._getTracer().startSpan(t,e,n)},t.prototype.startActiveSpan=function(t,e,n,r){var o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,arguments)},t.prototype._getTracer=function(){if(this._delegate)return this._delegate;var t=this._provider.getDelegateTracer(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):Ot},t}(),Nt=new(function(){function t(){}return t.prototype.getTracer=function(t,e,n){return new Tt},t}()),xt=function(){function t(){}return t.prototype.getTracer=function(t,e,n){var r;return null!==(r=this.getDelegateTracer(t,e,n))&&void 0!==r?r:new Rt(this,t,e,n)},t.prototype.getDelegate=function(){var t;return null!==(t=this._delegate)&&void 0!==t?t:Nt},t.prototype.setDelegate=function(t){this._delegate=t},t.prototype.getDelegateTracer=function(t,e,n){var r;return null===(r=this._delegate)||void 0===r?void 0:r.getTracer(t,e,n)},t}();!function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"}(wt||(wt={})),function(t){t[t.INTERNAL=0]="INTERNAL",t[t.SERVER=1]="SERVER",t[t.CLIENT=2]="CLIENT",t[t.PRODUCER=3]="PRODUCER",t[t.CONSUMER=4]="CONSUMER"}(Ct||(Ct={})),function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"}(At||(At={}));var Pt=it.getInstance(),Lt=y.instance(),Dt=new(function(){function t(){}return t.prototype.getMeter=function(t,e,n){return V},t}()),It="metrics",Mt=function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalMeterProvider=function(t){return c(It,t,y.instance())},t.prototype.getMeterProvider=function(){return l(It)||Dt},t.prototype.getMeter=function(t,e,n){return this.getMeterProvider().getMeter(t,e,n)},t.prototype.disable=function(){p(It,y.instance())},t}().getInstance(),kt=function(){function t(){}return t.prototype.inject=function(t,e){},t.prototype.extract=function(t,e){return t},t.prototype.fields=function(){return[]},t}(),jt=A("OpenTelemetry Baggage Key");function Ut(t){return t.getValue(jt)||void 0}function Bt(){return Ut(it.getInstance().active())}function Ft(t,e){return t.setValue(jt,e)}function Ht(t){return t.deleteValue(jt)}var Vt="propagation",$t=new kt,zt=function(){function t(){this.createBaggage=C,this.getBaggage=Ut,this.getActiveBaggage=Bt,this.setBaggage=Ft,this.deleteBaggage=Ht}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalPropagator=function(t){return c(Vt,t,y.instance())},t.prototype.inject=function(t,e,n){return void 0===n&&(n=Y),this._getGlobalPropagator().inject(t,e,n)},t.prototype.extract=function(t,e,n){return void 0===n&&(n=Q),this._getGlobalPropagator().extract(t,e,n)},t.prototype.fields=function(){return this._getGlobalPropagator().fields()},t.prototype.disable=function(){p(Vt,y.instance())},t.prototype._getGlobalPropagator=function(){return l(Vt)||$t},t}(),qt=zt.getInstance(),Gt="trace",Kt=function(){function t(){this._proxyTracerProvider=new xt,this.wrapSpanContext=St,this.isSpanContextValid=bt,this.deleteSpan=ft,this.getSpan=pt,this.getActiveSpan=dt,this.getSpanContext=mt,this.setSpan=ht,this.setSpanContext=gt}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalTracerProvider=function(t){var e=c(Gt,this._proxyTracerProvider,y.instance());return e&&this._proxyTracerProvider.setDelegate(t),e},t.prototype.getTracerProvider=function(){return l(Gt)||this._proxyTracerProvider},t.prototype.getTracer=function(t,e){return this.getTracerProvider().getTracer(t,e)},t.prototype.disable=function(){p(Gt,y.instance()),this._proxyTracerProvider=new xt},t}().getInstance();const Wt=A("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function Xt(t){return t.setValue(Wt,!0)}function Qt(t){return!0===t.getValue(Wt)}const Yt="=",Zt=";",Jt=",",te="baggage";function ee(t){const e=t.split(Zt);if(e.length<=0)return;const n=e.shift();if(!n)return;const r=n.indexOf(Yt);if(r<=0)return;const o=decodeURIComponent(n.substring(0,r).trim()),i=decodeURIComponent(n.substring(r+1).trim());let s;var a;return e.length>0&&("string"!=typeof(a=e.join(Zt))&&(w.error("Cannot create baggage metadata from unknown type: "+typeof a),a=""),s={__TYPE__:T,toString:function(){return a}}),{key:o,value:i,metadata:s}}class ne{inject(t,e,n){const r=qt.getBaggage(t);if(!r||Qt(t))return;const o=function(t){return t.getAllEntries().map((([t,e])=>{let n=`${encodeURIComponent(t)}=${encodeURIComponent(e.value)}`;return void 0!==e.metadata&&(n+=Zt+e.metadata.toString()),n}))}(r).filter((t=>t.length<=4096)).slice(0,180),i=function(t){return t.reduce(((t,e)=>{const n=`${t}${""!==t?Jt:""}${e}`;return n.length>8192?t:n}),"")}(o);i.length>0&&n.set(e,te,i)}extract(t,e,n){const r=n.get(e,te),o=Array.isArray(r)?r.join(Jt):r;if(!o)return t;const i={};if(0===o.length)return t;return o.split(Jt).forEach((t=>{const e=ee(t);if(e){const t={value:e.value};e.metadata&&(t.metadata=e.metadata),i[e.key]=t}})),0===Object.entries(i).length?t:qt.setBaggage(t,qt.createBaggage(i))}fields(){return[te]}}function re(t){const e={};if("object"!=typeof t||null==t)return e;for(const[n,r]of Object.entries(t))oe(n)?ie(r)?Array.isArray(r)?e[n]=r.slice():e[n]=r:Lt.warn(`Invalid attribute value set for key: ${n}`):Lt.warn(`Invalid attribute key: ${n}`);return e}function oe(t){return"string"==typeof t&&t.length>0}function ie(t){return null==t||(Array.isArray(t)?function(t){let e;for(const n of t)if(null!=n){if(!e){if(se(n)){e=typeof n;continue}return!1}if(typeof n!==e)return!1}return!0}(t):se(t))}function se(t){switch(typeof t){case"number":case"boolean":case"string":return!0}return!1}function ae(){return t=>{Lt.error(function(t){return"string"==typeof t?t:JSON.stringify(function(t){const e={};let n=t;for(;null!==n;)Object.getOwnPropertyNames(n).forEach((t=>{if(e[t])return;const r=n[t];r&&(e[t]=String(r))})),n=Object.getPrototypeOf(n);return e}(t))}(t))}}let ue=ae();function ce(t){try{ue(t)}catch{}}function le(t){}const pe="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{},de=performance,he="exception.type",fe="exception.message",ge="http.method",me="http.url",_e="http.host",ve="http.scheme",ye="http.status_code",be="http.user_agent",Se="http.request_content_length_uncompressed",Ee="process.runtime.name",Te="telemetry.sdk.name",we="telemetry.sdk.language",Ce="telemetry.sdk.version",Ae="service.name",Oe="telemetry.sdk.language",Re="telemetry.sdk.name",Ne="telemetry.sdk.version",xe={[Te]:"opentelemetry",[Ee]:"browser",[we]:"webjs",[Ce]:"2.0.0"};function Pe(t){}const Le=Math.pow(10,6),De=Math.pow(10,9);function Ie(t){const e=t/1e3;return[Math.trunc(e),Math.round(t%1e3*Le)]}function Me(){let t=de.timeOrigin;if("number"!=typeof t){const e=de;t=e.timing&&e.timing.fetchStart}return t}function ke(t){return Ve(Ie(Me()),Ie("number"==typeof t?t:de.now()))}function je(t){if(Fe(t))return t;if("number"==typeof t)return t<Me()?ke(t):Ie(t);if(t instanceof Date)return Ie(t.getTime());throw TypeError("Invalid input type")}function Ue(t,e){let n=e[0]-t[0],r=e[1]-t[1];return r<0&&(n-=1,r+=De),[n,r]}function Be(t){return t[0]*De+t[1]}function Fe(t){return Array.isArray(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]}function He(t){return Fe(t)||"number"==typeof t||t instanceof Date}function Ve(t,e){const n=[t[0]+e[0],t[1]+e[1]];return n[1]>=De&&(n[1]-=De,n[0]+=1),n}var $e;!function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"}($e||($e={}));class ze{_propagators;_fields;constructor(t={}){this._propagators=t.propagators??[],this._fields=Array.from(new Set(this._propagators.map((t=>"function"==typeof t.fields?t.fields():[])).reduce(((t,e)=>t.concat(e)),[])))}inject(t,e,n){for(const r of this._propagators)try{r.inject(t,e,n)}catch(t){Lt.warn(`Failed to inject with ${r.constructor.name}. Err: ${t.message}`)}}extract(t,e,n){return this._propagators.reduce(((t,r)=>{try{return r.extract(t,e,n)}catch(t){Lt.warn(`Failed to extract with ${r.constructor.name}. Err: ${t.message}`)}return t}),t)}fields(){return this._fields.slice()}}const qe="[_0-9a-z-*/]",Ge=new RegExp(`^(?:${`[a-z]${qe}{0,255}`}|${`[a-z0-9]${qe}{0,240}@[a-z]${qe}{0,13}`})$`),Ke=/^[ -~]{0,255}[!-~]$/,We=/,|=/;class Xe{_internalState=new Map;constructor(t){t&&this._parse(t)}set(t,e){const n=this._clone();return n._internalState.has(t)&&n._internalState.delete(t),n._internalState.set(t,e),n}unset(t){const e=this._clone();return e._internalState.delete(t),e}get(t){return this._internalState.get(t)}serialize(){return this._keys().reduce(((t,e)=>(t.push(e+"="+this.get(e)),t)),[]).join(",")}_parse(t){t.length>512||(this._internalState=t.split(",").reverse().reduce(((t,e)=>{const n=e.trim(),r=n.indexOf("=");if(-1!==r){const o=n.slice(0,r),i=n.slice(r+1,e.length);(function(t){return Ge.test(t)})(o)&&function(t){return Ke.test(t)&&!We.test(t)}(i)&&t.set(o,i)}return t}),new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){const t=new Xe;return t._internalState=new Map(this._internalState),t}}const Qe="traceparent",Ye="tracestate",Ze=new RegExp("^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$");function Je(t){const e=Ze.exec(t);return e?"00"===e[1]&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}:null}class tn{inject(t,e,n){const r=Kt.getSpanContext(t);if(!r||Qt(t)||!bt(r))return;const o=`00-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||R.NONE).toString(16)}`;n.set(e,Qe,o),r.traceState&&n.set(e,Ye,r.traceState.serialize())}extract(t,e,n){const r=n.get(e,Qe);if(!r)return t;const o=Array.isArray(r)?r[0]:r;if("string"!=typeof o)return t;const i=Je(o);if(!i)return t;i.isRemote=!0;const s=n.get(e,Ye);if(s){const t=Array.isArray(s)?s.join(","):s;i.traceState=new Xe("string"==typeof t?t:void 0)}return Kt.setSpanContext(t,i)}fields(){return[Qe,Ye]}}const en=A("OpenTelemetry SDK Context Key RPC_METADATA");var nn;!function(t){t.HTTP="http"}(nn||(nn={}));const rn="[object Object]",on="[object Null]",sn="[object Undefined]",an=Function.prototype.toString,un=an.call(Object),cn=Object.getPrototypeOf,ln=Object.prototype,pn=ln.hasOwnProperty,dn=Symbol?Symbol.toStringTag:void 0,hn=ln.toString;function fn(t){if(!function(t){return null!=t&&"object"==typeof t}(t)||function(t){if(null==t)return void 0===t?sn:on;return dn&&dn in Object(t)?function(t){const e=pn.call(t,dn),n=t[dn];let r=!1;try{t[dn]=void 0,r=!0}catch(t){}const o=hn.call(t);r&&(e?t[dn]=n:delete t[dn]);return o}(t):function(t){return hn.call(t)}(t)}(t)!==rn)return!1;const e=cn(t);if(null===e)return!0;const n=pn.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&an.call(n)===un}const gn=20;function mn(...t){let e=t.shift();const n=new WeakMap;for(;t.length>0;)e=vn(e,t.shift(),0,n);return e}function _n(t){return bn(t)?t.slice():t}function vn(t,e,n=0,r){let o;if(!(n>gn)){if(n++,Tn(t)||Tn(e)||Sn(e))o=_n(e);else if(bn(t)){if(o=t.slice(),bn(e))for(let t=0,n=e.length;t<n;t++)o.push(_n(e[t]));else if(En(e)){const t=Object.keys(e);for(let n=0,r=t.length;n<r;n++){const r=t[n];o[r]=_n(e[r])}}}else if(En(t))if(En(e)){if(!function(t,e){if(!fn(t)||!fn(e))return!1;return!0}(t,e))return e;o=Object.assign({},t);const i=Object.keys(e);for(let s=0,a=i.length;s<a;s++){const a=i[s],u=e[a];if(Tn(u))void 0===u?delete o[a]:o[a]=u;else{const i=o[a],s=u;if(yn(t,a,r)||yn(e,a,r))delete o[a];else{if(En(i)&&En(s)){const n=r.get(i)||[],o=r.get(s)||[];n.push({obj:t,key:a}),o.push({obj:e,key:a}),r.set(i,n),r.set(s,o)}o[a]=vn(o[a],u,n,r)}}}}else o=e;return o}}function yn(t,e,n){const r=n.get(t[e])||[];for(let n=0,o=r.length;n<o;n++){const o=r[n];if(o.key===e&&o.obj===t)return!0}return!1}function bn(t){return Array.isArray(t)}function Sn(t){return"function"==typeof t}function En(t){return!Tn(t)&&!bn(t)&&!Sn(t)&&"object"==typeof t}function Tn(t){return"string"==typeof t||"number"==typeof t||"boolean"==typeof t||void 0===t||t instanceof Date||t instanceof RegExp||null===t}class wn extends Error{constructor(t){super(t),Object.setPrototypeOf(this,wn.prototype)}}function Cn(t,e){return"string"==typeof e?t===e:!!t.match(e)}function An(t,e){if(!e)return!1;for(const n of e)if(Cn(t,n))return!0;return!1}class On{_promise;_resolve;_reject;constructor(){this._promise=new Promise(((t,e)=>{this._resolve=t,this._reject=e}))}get promise(){return this._promise}resolve(t){this._resolve(t)}reject(t){this._reject(t)}}class Rn{_callback;_that;_isCalled=!1;_deferred=new On;constructor(t,e){this._callback=t,this._that=e}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...t){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...t)).then((t=>this._deferred.resolve(t)),(t=>this._deferred.reject(t)))}catch(t){this._deferred.reject(t)}}return this._deferred.promise}}const Nn={ALL:d.ALL,VERBOSE:d.VERBOSE,DEBUG:d.DEBUG,INFO:d.INFO,WARN:d.WARN,ERROR:d.ERROR,NONE:d.NONE};const xn={_export:function(t,e){return new Promise((n=>{Pt.with(Xt(Pt.active()),(()=>{t.export(e,(t=>{n(t)}))}))}))}};var Pn=Object.freeze({__proto__:null,AnchoredClock:class{_monotonicClock;_epochMillis;_performanceMillis;constructor(t,e){this._monotonicClock=e,this._epochMillis=t.now(),this._performanceMillis=e.now()}now(){const t=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+t}},BindOnceFuture:Rn,CompositePropagator:ze,get ExportResultCode(){return $e},get RPCType(){return nn},SDK_INFO:xe,TRACE_PARENT_HEADER:Qe,TRACE_STATE_HEADER:Ye,TimeoutError:wn,TraceState:Xe,W3CBaggagePropagator:ne,W3CTraceContextPropagator:tn,_globalThis:pe,addHrTimes:Ve,callWithTimeout:function(t,e){let n;const r=new Promise((function(t,r){n=setTimeout((function(){r(new wn("Operation timed out."))}),e)}));return Promise.race([t,r]).then((t=>(clearTimeout(n),t)),(t=>{throw clearTimeout(n),t}))},deleteRPCMetadata:function(t){return t.deleteValue(en)},diagLogLevelFromString:function(t){if(null==t)return;const e=Nn[t.toUpperCase()];return null==e?(Lt.warn(`Unknown log level "${t}", expected one of ${Object.keys(Nn)}, using default`),d.INFO):e},getBooleanFromEnv:function(t){},getNumberFromEnv:le,getRPCMetadata:function(t){return t.getValue(en)},getStringFromEnv:function(t){},getStringListFromEnv:function(t){},getTimeOrigin:Me,globalErrorHandler:ce,hrTime:ke,hrTimeDuration:Ue,hrTimeToMicroseconds:function(t){return 1e6*t[0]+t[1]/1e3},hrTimeToMilliseconds:function(t){return 1e3*t[0]+t[1]/1e6},hrTimeToNanoseconds:Be,hrTimeToTimeStamp:function(t){const e=`${"0".repeat(9)}${t[1]}Z`,n=e.substring(e.length-9-1);return new Date(1e3*t[0]).toISOString().replace("000Z",n)},internal:xn,isAttributeValue:ie,isTimeInput:He,isTimeInputHrTime:Fe,isTracingSuppressed:Qt,isUrlIgnored:An,loggingErrorHandler:ae,merge:mn,millisToHrTime:Ie,otperformance:de,parseKeyPairsIntoRecord:function(t){return"string"!=typeof t||0===t.length?{}:t.split(Jt).map((t=>ee(t))).filter((t=>void 0!==t&&t.value.length>0)).reduce(((t,e)=>(t[e.key]=e.value,t)),{})},parseTraceParent:Je,sanitizeAttributes:re,setGlobalErrorHandler:function(t){ue=t},setRPCMetadata:function(t,e){return t.setValue(en,e)},suppressTracing:Xt,timeInputToHrTime:je,unrefTimer:Pe,unsuppressTracing:function(t){return t.deleteValue(Wt)},urlMatches:Cn});function Ln(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if("function"==typeof e){var n=function t(){return this instanceof t?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})})),n}var Dn,In={},Mn={};function kn(){if(Dn)return Mn;function t(t){return Object.keys(t).map((n=>e(n,t[n])))}function e(t,e){return{key:t,value:n(e)}}function n(t){const r=typeof t;return"string"===r?{stringValue:t}:"number"===r?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:"boolean"===r?{boolValue:t}:t instanceof Uint8Array?{bytesValue:t}:Array.isArray(t)?{arrayValue:{values:t.map(n)}}:"object"===r&&null!=t?{kvlistValue:{values:Object.entries(t).map((([t,n])=>e(t,n)))}}:{}}return Dn=1,Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.toAnyValue=Mn.toKeyValue=Mn.toAttributes=Mn.createInstrumentationScope=Mn.createResource=void 0,Mn.createResource=function(e){return{attributes:t(e.attributes),droppedAttributesCount:0}},Mn.createInstrumentationScope=function(t){return{name:t.name,version:t.version}},Mn.toAttributes=t,Mn.toKeyValue=e,Mn.toAnyValue=n,Mn}var jn,Un,Bn,Fn={},Hn=Ln(Pn),Vn={};function $n(){if(jn)return Vn;function t(t){return t>=48&&t<=57?t-48:t>=97&&t<=102?t-87:t-55}return jn=1,Object.defineProperty(Vn,"__esModule",{value:!0}),Vn.hexToBinary=void 0,Vn.hexToBinary=function(e){const n=new Uint8Array(e.length/2);let r=0;for(let o=0;o<e.length;o+=2){const i=t(e.charCodeAt(o)),s=t(e.charCodeAt(o+1));n[r++]=i<<4|s}return n},Vn}function zn(){if(Un)return Fn;Un=1,Object.defineProperty(Fn,"__esModule",{value:!0}),Fn.getOtlpEncoder=Fn.encodeAsString=Fn.encodeAsLongBits=Fn.toLongBits=Fn.hrTimeToNanos=void 0;const t=Hn,e=$n();function n(t){const e=BigInt(1e9);return BigInt(t[0])*e+BigInt(t[1])}function r(t){return{low:Number(BigInt.asUintN(32,t)),high:Number(BigInt.asUintN(32,t>>BigInt(32)))}}function o(t){return r(n(t))}function i(t){return n(t).toString()}Fn.hrTimeToNanos=n,Fn.toLongBits=r,Fn.encodeAsLongBits=o,Fn.encodeAsString=i;const s="undefined"!=typeof BigInt?i:t.hrTimeToNanoseconds;function a(t){return t}function u(t){if(void 0!==t)return(0,e.hexToBinary)(t)}const c={encodeHrTime:o,encodeSpanContext:e.hexToBinary,encodeOptionalSpanContext:u};return Fn.getOtlpEncoder=function(t){if(void 0===t)return c;const n=t.useLongBits??!0,r=t.useHex??!1;return{encodeHrTime:n?o:s,encodeSpanContext:r?a:e.hexToBinary,encodeOptionalSpanContext:r?a:u}},Fn}function qn(){if(Bn)return In;Bn=1,Object.defineProperty(In,"__esModule",{value:!0}),In.createExportTraceServiceRequest=In.toOtlpSpanEvent=In.toOtlpLink=In.sdkSpanToOtlpSpan=void 0;const t=kn(),e=zn();function n(e,n){const i=e.spanContext(),s=e.status,a=e.parentSpanContext?.spanId?n.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:n.encodeSpanContext(i.traceId),spanId:n.encodeSpanContext(i.spanId),parentSpanId:a,traceState:i.traceState?.serialize(),name:e.name,kind:null==e.kind?0:e.kind+1,startTimeUnixNano:n.encodeHrTime(e.startTime),endTimeUnixNano:n.encodeHrTime(e.endTime),attributes:(0,t.toAttributes)(e.attributes),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map((t=>o(t,n))),droppedEventsCount:e.droppedEventsCount,status:{code:s.code,message:s.message},links:e.links.map((t=>r(t,n))),droppedLinksCount:e.droppedLinksCount}}function r(e,n){return{attributes:e.attributes?(0,t.toAttributes)(e.attributes):[],spanId:n.encodeSpanContext(e.context.spanId),traceId:n.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0}}function o(e,n){return{attributes:e.attributes?(0,t.toAttributes)(e.attributes):[],name:e.name,timeUnixNano:n.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function i(e,r){const o=function(t){const e=new Map;for(const n of t){let t=e.get(n.resource);t||(t=new Map,e.set(n.resource,t));const r=`${n.instrumentationScope.name}@${n.instrumentationScope.version||""}:${n.instrumentationScope.schemaUrl||""}`;let o=t.get(r);o||(o=[],t.set(r,o)),o.push(n)}return e}(e),i=[],s=o.entries();let a=s.next();for(;!a.done;){const[e,o]=a.value,u=[],c=o.values();let l=c.next();for(;!l.done;){const e=l.value;if(e.length>0){const o=e.map((t=>n(t,r)));u.push({scope:(0,t.createInstrumentationScope)(e[0].instrumentationScope),spans:o,schemaUrl:e[0].instrumentationScope.schemaUrl})}l=c.next()}const p={resource:(0,t.createResource)(e),scopeSpans:u,schemaUrl:void 0};i.push(p),a=s.next()}return i}return In.sdkSpanToOtlpSpan=n,In.toOtlpLink=r,In.toOtlpSpanEvent=o,In.createExportTraceServiceRequest=function(t,n){return{resourceSpans:i(t,(0,e.getOtlpEncoder)(n))}},In}var Gn,Kn=qn(),Wn={};function Xn(){return Gn||(Gn=1,function(t){var e;Object.defineProperty(t,"__esModule",{value:!0}),t.ESpanKind=void 0,(e=t.ESpanKind||(t.ESpanKind={}))[e.SPAN_KIND_UNSPECIFIED=0]="SPAN_KIND_UNSPECIFIED",e[e.SPAN_KIND_INTERNAL=1]="SPAN_KIND_INTERNAL",e[e.SPAN_KIND_SERVER=2]="SPAN_KIND_SERVER",e[e.SPAN_KIND_CLIENT=3]="SPAN_KIND_CLIENT",e[e.SPAN_KIND_PRODUCER=4]="SPAN_KIND_PRODUCER",e[e.SPAN_KIND_CONSUMER=5]="SPAN_KIND_CONSUMER"}(Wn)),Wn}var Qn=Xn();const Yn="user-action-end",Zn="user-action-cancel";let Jn={};class tr{constructor(t){this.config=t}export(t,e){const n=Kn.createExportTraceServiceRequest(t,{useHex:!0,useLongBits:!1});this.config.api.pushTraces(n),function(t=[]){var e,n;for(const r of t){const{scopeSpans:t}=r;for(const r of t){const{scope:t,spans:o=[]}=r;for(const r of o){if(r.kind!==Qn.ESpanKind.SPAN_KIND_CLIENT)continue;const o={traceId:r.traceId.toString(),spanId:r.spanId.toString()},i={};for(const t of r.attributes)i[t.key]=String(Object.values(t.value)[0]);Number.isNaN(r.endTimeUnixNano)||Number.isNaN(r.startTimeUnixNano)||(i.duration_ns=String(Number(r.endTimeUnixNano)-Number(r.startTimeUnixNano)));const s=(null!==(e=null==t?void 0:t.name)&&void 0!==e?e:"").indexOf("-");let a="unknown";(null==t?void 0:t.name)&&(-1===s&&(a=null!==(n=t.name.split("/")[1])&&void 0!==n?n:t.name),s>-1&&(a=null==t?void 0:t.name.substring(s+1))),Jn.api.pushEvent(`faro.tracing.${a}`,i,void 0,{spanContext:o,timestampOverwriteMs:Number(r.endTimeUnixNano)/1e6,customPayloadTransformer:t=>{var e,n;return null!=i["faro.action.user.name"]&&null!=i["faro.action.user.parentId"]&&(t.action={name:i["faro.action.user.name"],parentId:i["faro.action.user.parentId"]},null===(e=t.attributes)||void 0===e||delete e["faro.action.user.name"],null===(n=t.attributes)||void 0===n||delete n["faro.action.user.parentId"]),t}})}}}}(n.resourceSpans),e({code:$e.SUCCESS})}shutdown(){return Promise.resolve(void 0)}}const er="session.id";"function"==typeof SuppressedError&&SuppressedError;class nr{emit(t){}}const rr=new nr;const or=new class{getLogger(t,e,n){return new nr}};class ir{constructor(t,e,n,r){this._provider=t,this.name=e,this.version=n,this.options=r}emit(t){this._getLogger().emit(t)}_getLogger(){if(this._delegate)return this._delegate;const t=this._provider.getDelegateLogger(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):rr}}class sr{getLogger(t,e,n){var r;return null!==(r=this.getDelegateLogger(t,e,n))&&void 0!==r?r:new ir(this,t,e,n)}getDelegate(){var t;return null!==(t=this._delegate)&&void 0!==t?t:or}setDelegate(t){this._delegate=t}getDelegateLogger(t,e,n){var r;return null===(r=this._delegate)||void 0===r?void 0:r.getLogger(t,e,n)}}const ar="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{},ur=Symbol.for("io.opentelemetry.js.api.logs"),cr=ar;class lr{constructor(){this._proxyLoggerProvider=new sr}static getInstance(){return this._instance||(this._instance=new lr),this._instance}setGlobalLoggerProvider(t){return cr[ur]?this.getLoggerProvider():(cr[ur]=(e=1,n=t,r=or,t=>t===e?n:r),this._proxyLoggerProvider.setDelegate(t),t);var e,n,r}getLoggerProvider(){var t,e;return null!==(e=null===(t=cr[ur])||void 0===t?void 0:t.call(cr,1))&&void 0!==e?e:this._proxyLoggerProvider}getLogger(t,e,n){return this.getLoggerProvider().getLogger(t,e,n)}disable(){delete cr[ur],this._proxyLoggerProvider=new sr}}const pr=lr.getInstance();var dr,hr;var fr=function(){if(hr)return dr;function t(t){return"function"==typeof t}hr=1;var e=console.error.bind(console);function n(t,e,n){var r=!!t[e]&&t.propertyIsEnumerable(e);Object.defineProperty(t,e,{configurable:!0,enumerable:r,writable:!0,value:n})}function r(n){n&&n.logger&&(t(n.logger)?e=n.logger:e("new logger isn't a function, not replacing"))}function o(r,o,i){if(r&&r[o]){if(!i)return e("no wrapper function"),void e((new Error).stack);if(t(r[o])&&t(i)){var s=r[o],a=i(s,o);return n(a,"__original",s),n(a,"__unwrap",(function(){r[o]===a&&n(r,o,s)})),n(a,"__wrapped",!0),n(r,o,a),a}e("original object and wrapper must be functions")}else e("no original function "+o+" to wrap")}function i(t,n){return t&&t[n]?t[n].__unwrap?t[n].__unwrap():void e("no original to unwrap to -- has "+n+" already been unwrapped?"):(e("no function to unwrap."),void e((new Error).stack))}return r.wrap=o,r.massWrap=function(t,n,r){if(!t)return e("must provide one or more modules to patch"),void e((new Error).stack);Array.isArray(t)||(t=[t]),n&&Array.isArray(n)?t.forEach((function(t){n.forEach((function(e){o(t,e,r)}))})):e("must provide one or more functions to wrap on modules")},r.unwrap=i,r.massUnwrap=function(t,n){if(!t)return e("must provide one or more modules to patch"),void e((new Error).stack);Array.isArray(t)||(t=[t]),n&&Array.isArray(n)?t.forEach((function(t){n.forEach((function(e){i(t,e)}))})):e("must provide one or more functions to unwrap on modules")},dr=r}();class gr{instrumentationName;instrumentationVersion;_config={};_tracer;_meter;_logger;_diag;constructor(t,e,n){this.instrumentationName=t,this.instrumentationVersion=e,this.setConfig(n),this._diag=Lt.createComponentLogger({namespace:t}),this._tracer=Kt.getTracer(t,e),this._meter=Mt.getMeter(t,e),this._logger=pr.getLogger(t,e),this._updateMetricInstruments()}_wrap=fr.wrap;_unwrap=fr.unwrap;_massWrap=fr.massWrap;_massUnwrap=fr.massUnwrap;get meter(){return this._meter}setMeterProvider(t){this._meter=t.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(t){this._logger=t.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){const t=this.init()??[];return Array.isArray(t)?t:[t]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(t){this._config={enabled:!0,...t}}setTracerProvider(t){this._tracer=t.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(t,e,n,r){if(t)try{t(n,r)}catch(t){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:e},t)}}}class mr extends gr{constructor(t,e,n){super(t,e,n),this._config.enabled&&this.enable()}}function _r(t,e,n){let r,o;try{o=t()}catch(t){r=t}finally{return e(r,o),o}}function vr(t){return"function"==typeof t&&"function"==typeof t.__original&&"function"==typeof t.__unwrap&&!0===t.__wrapped}const yr=t=>null!==t&&"object"==typeof t&&"function"==typeof t.then;class br{_rawAttributes;_asyncAttributesPending=!1;_memoizedAttributes;static FromAttributeList(t){const e=new br({});return e._rawAttributes=t,e._asyncAttributesPending=t.filter((([t,e])=>yr(e))).length>0,e}constructor(t){const e=t.attributes??{};this._rawAttributes=Object.entries(e).map((([t,e])=>(yr(e)&&(this._asyncAttributesPending=!0),[t,e])))}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let t=0;t<this._rawAttributes.length;t++){const[e,n]=this._rawAttributes[t];try{this._rawAttributes[t]=[e,yr(n)?await n:n]}catch(n){Lt.debug("a resource's async attributes promise rejected: %s",n),this._rawAttributes[t]=[e,void 0]}}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&Lt.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;const t={};for(const[e,n]of this._rawAttributes)yr(n)?Lt.debug(`Unsettled resource attribute ${e} skipped`):null!=n&&(t[e]??=n);return this._asyncAttributesPending||(this._memoizedAttributes=t),t}getRawAttributes(){return this._rawAttributes}merge(t){return null==t?this:br.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()])}}function Sr(t){return br.FromAttributeList(Object.entries(t))}function Er(){return Sr({[Ae]:"unknown_service",[Oe]:xe[Oe],[Re]:xe[Re],[Ne]:xe[Ne]})}class Tr{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;name;status={code:At.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(t){const e=Date.now();this._spanContext=t.spanContext,this._performanceStartTime=de.now(),this._performanceOffset=e-(this._performanceStartTime+Me()),this._startTimeProvided=null!=t.startTime,this._spanLimits=t.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit||0,this._spanProcessor=t.spanProcessor,this.name=t.name,this.parentSpanContext=t.parentSpanContext,this.kind=t.kind,this.links=t.links||[],this.startTime=this._getTime(t.startTime??e),this.resource=t.resource,this.instrumentationScope=t.scope,null!=t.attributes&&this.setAttributes(t.attributes),this._spanProcessor.onStart(this,t.context)}spanContext(){return this._spanContext}setAttribute(t,e){if(null==e||this._isSpanEnded())return this;if(0===t.length)return Lt.warn(`Invalid attribute key: ${t}`),this;if(!ie(e))return Lt.warn(`Invalid attribute value set for key: ${t}`),this;const{attributeCountLimit:n}=this._spanLimits;return void 0!==n&&Object.keys(this.attributes).length>=n&&!Object.prototype.hasOwnProperty.call(this.attributes,t)?(this._droppedAttributesCount++,this):(this.attributes[t]=this._truncateToSize(e),this)}setAttributes(t){for(const[e,n]of Object.entries(t))this.setAttribute(e,n);return this}addEvent(t,e,n){if(this._isSpanEnded())return this;const{eventCountLimit:r}=this._spanLimits;if(0===r)return Lt.warn("No events allowed."),this._droppedEventsCount++,this;void 0!==r&&this.events.length>=r&&(0===this._droppedEventsCount&&Lt.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),He(e)&&(He(n)||(n=e),e=void 0);const o=re(e);return this.events.push({name:t,attributes:o,time:this._getTime(n),droppedAttributesCount:0}),this}addLink(t){return this.links.push(t),this}addLinks(t){return this.links.push(...t),this}setStatus(t){return this._isSpanEnded()||(this.status={...t},null!=this.status.message&&"string"!=typeof t.message&&(Lt.warn(`Dropping invalid status.message of type '${typeof t.message}', expected 'string'`),delete this.status.message)),this}updateName(t){return this._isSpanEnded()||(this.name=t),this}end(t){this._isSpanEnded()?Lt.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`):(this._ended=!0,this.endTime=this._getTime(t),this._duration=Ue(this.startTime,this.endTime),this._duration[0]<0&&(Lt.warn("Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.",this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&Lt.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._spanProcessor.onEnd(this))}_getTime(t){if("number"==typeof t&&t<=de.now())return ke(t+this._performanceOffset);if("number"==typeof t)return Ie(t);if(t instanceof Date)return Ie(t.getTime());if(Fe(t))return t;if(this._startTimeProvided)return Ie(Date.now());const e=de.now()-this._performanceStartTime;return Ve(this.startTime,Ie(e))}isRecording(){return!1===this._ended}recordException(t,e){const n={};"string"==typeof t?n[fe]=t:t&&(t.code?n[he]=t.code.toString():t.name&&(n[he]=t.name),t.message&&(n[fe]=t.message),t.stack&&(n["exception.stacktrace"]=t.stack)),n[he]||n[fe]?this.addEvent("exception",n,e):Lt.warn(`Failed to record an exception ${t}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){const t=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);Lt.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,t)}return this._ended}_truncateToLimitUtil(t,e){return t.length<=e?t:t.substring(0,e)}_truncateToSize(t){const e=this._attributeValueLengthLimit;return e<=0?(Lt.warn(`Attribute value limit must be positive, got ${e}`),t):"string"==typeof t?this._truncateToLimitUtil(t,e):Array.isArray(t)?t.map((t=>"string"==typeof t?this._truncateToLimitUtil(t,e):t)):t}}var wr;!function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"}(wr||(wr={}));class Cr{shouldSample(){return{decision:wr.NOT_RECORD}}toString(){return"AlwaysOffSampler"}}class Ar{shouldSample(){return{decision:wr.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}}class Or{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(t){this._root=t.root,this._root||(ce(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new Ar),this._remoteParentSampled=t.remoteParentSampled??new Ar,this._remoteParentNotSampled=t.remoteParentNotSampled??new Cr,this._localParentSampled=t.localParentSampled??new Ar,this._localParentNotSampled=t.localParentNotSampled??new Cr}shouldSample(t,e,n,r,o,i){const s=Kt.getSpanContext(t);return s&&bt(s)?s.isRemote?s.traceFlags&R.SAMPLED?this._remoteParentSampled.shouldSample(t,e,n,r,o,i):this._remoteParentNotSampled.shouldSample(t,e,n,r,o,i):s.traceFlags&R.SAMPLED?this._localParentSampled.shouldSample(t,e,n,r,o,i):this._localParentNotSampled.shouldSample(t,e,n,r,o,i):this._root.shouldSample(t,e,n,r,o,i)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}class Rr{_ratio;_upperBound;constructor(t=0){this._ratio=t,this._ratio=this._normalize(t),this._upperBound=Math.floor(4294967295*this._ratio)}shouldSample(t,e){return{decision:yt(e)&&this._accumulate(e)<this._upperBound?wr.RECORD_AND_SAMPLED:wr.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(t){return"number"!=typeof t||isNaN(t)?0:t>=1?1:t<=0?0:t}_accumulate(t){let e=0;for(let n=0;n<t.length/8;n++){const r=8*n;e=(e^parseInt(t.slice(r,r+8),16))>>>0}return e}}const Nr=1;function xr(){return{sampler:Pr(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}function Pr(){const t="parentbased_always_on";switch(t){case"always_on":return new Ar;case"always_off":return new Cr;case"parentbased_always_on":return new Or({root:new Ar});case"parentbased_always_off":return new Or({root:new Cr});case"traceidratio":return new Rr(Lr());case"parentbased_traceidratio":return new Or({root:new Rr(Lr())});default:return Lt.error(`OTEL_TRACES_SAMPLER value "${t}" invalid, defaulting to "parentbased_always_on".`),new Or({root:new Ar})}}function Lr(){return Lt.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${Nr}.`),Nr}const Dr=1/0;class Ir{_exporter;_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(t,e){this._exporter=t,this._maxExportBatchSize="number"==typeof e?.maxExportBatchSize?e.maxExportBatchSize:512,this._maxQueueSize="number"==typeof e?.maxQueueSize?e.maxQueueSize:2048,this._scheduledDelayMillis="number"==typeof e?.scheduledDelayMillis?e.scheduledDelayMillis:5e3,this._exportTimeoutMillis="number"==typeof e?.exportTimeoutMillis?e.exportTimeoutMillis:3e4,this._shutdownOnce=new Rn(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(Lt.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(t,e){}onEnd(t){this._shutdownOnce.isCalled||t.spanContext().traceFlags&R.SAMPLED&&this._addToBuffer(t)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then((()=>this.onShutdown())).then((()=>this._flushAll())).then((()=>this._exporter.shutdown()))}_addToBuffer(t){if(this._finishedSpans.length>=this._maxQueueSize)return 0===this._droppedSpansCount&&Lt.debug("maxQueueSize reached, dropping spans"),void this._droppedSpansCount++;this._droppedSpansCount>0&&(Lt.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(t),this._maybeStartTimer()}_flushAll(){return new Promise(((t,e)=>{const n=[];for(let t=0,e=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);t<e;t++)n.push(this._flushOneBatch());Promise.all(n).then((()=>{t()})).catch(e)}))}_flushOneBatch(){return this._clearTimer(),0===this._finishedSpans.length?Promise.resolve():new Promise(((t,e)=>{const n=setTimeout((()=>{e(new Error("Timeout"))}),this._exportTimeoutMillis);Pt.with(Xt(Pt.active()),(()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);const o=()=>this._exporter.export(r,(r=>{clearTimeout(n),r.code===$e.SUCCESS?t():e(r.error??new Error("BatchSpanProcessor: span export failed"))}));let i=null;for(let t=0,e=r.length;t<e;t++){const e=r[t];e.resource.asyncAttributesPending&&e.resource.waitForAsyncAttributes&&(i??=[],i.push(e.resource.waitForAsyncAttributes()))}null===i?o():Promise.all(i).then(o,(t=>{ce(t),e(t)}))}))}))}_maybeStartTimer(){if(this._isExporting)return;const t=()=>{this._isExporting=!0,this._flushOneBatch().finally((()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())})).catch((t=>{this._isExporting=!1,ce(t)}))};if(this._finishedSpans.length>=this._maxExportBatchSize)return t();void 0===this._timer&&(this._timer=setTimeout((()=>t()),this._scheduledDelayMillis),this._timer)}_clearTimer(){void 0!==this._timer&&(clearTimeout(this._timer),this._timer=void 0)}}class Mr extends Ir{_visibilityChangeListener;_pageHideListener;constructor(t,e){super(t,e),this.onInit(e)}onInit(t){!0!==t?.disableAutoFlushOnDocumentHide&&"undefined"!=typeof document&&(this._visibilityChangeListener=()=>{"hidden"===document.visibilityState&&this.forceFlush().catch((t=>{ce(t)}))},this._pageHideListener=()=>{this.forceFlush().catch((t=>{ce(t)}))},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))}onShutdown(){"undefined"!=typeof document&&(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener("pagehide",this._pageHideListener))}}class kr{generateTraceId=Ur(16);generateSpanId=Ur(8)}const jr=Array(32);function Ur(t){return function(){for(let e=0;e<2*t;e++)jr[e]=Math.floor(16*Math.random())+48,jr[e]>=58&&(jr[e]+=39);return String.fromCharCode.apply(null,jr.slice(0,2*t))}}class Br{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;constructor(t,e,n,r){const o=function(t){const e={sampler:Pr()},n=xr(),r=Object.assign({},n,e,t);return r.generalLimits=Object.assign({},n.generalLimits,t.generalLimits||{}),r.spanLimits=Object.assign({},n.spanLimits,t.spanLimits||{}),r}(e);this._sampler=o.sampler,this._generalLimits=o.generalLimits,this._spanLimits=o.spanLimits,this._idGenerator=e.idGenerator||new kr,this._resource=n,this._spanProcessor=r,this.instrumentationScope=t}startSpan(t,e={},n=Pt.active()){e.root&&(n=Kt.deleteSpan(n));const r=Kt.getSpan(n);if(Qt(n)){Lt.debug("Instrumentation suppressed, returning Noop Span");return Kt.wrapSpanContext(ut)}const o=r?.spanContext(),i=this._idGenerator.generateSpanId();let s,a,u;o&&Kt.isSpanContextValid(o)?(a=o.traceId,u=o.traceState,s=o):a=this._idGenerator.generateTraceId();const c=e.kind??Ct.INTERNAL,l=(e.links??[]).map((t=>({context:t.context,attributes:re(t.attributes)}))),p=re(e.attributes),d=this._sampler.shouldSample(n,a,t,c,p,l);u=d.traceState??u;const h={traceId:a,spanId:i,traceFlags:d.decision===wt.RECORD_AND_SAMPLED?R.SAMPLED:R.NONE,traceState:u};if(d.decision===wt.NOT_RECORD){Lt.debug("Recording is off, propagating context in a non-recording span");return Kt.wrapSpanContext(h)}const f=re(Object.assign(p,d.attributes));return new Tr({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:h,name:t,kind:c,links:l,parentSpanContext:s,attributes:f,startTime:e.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits})}startActiveSpan(t,e,n,r){let o,i,s;if(arguments.length<2)return;2===arguments.length?s=e:3===arguments.length?(o=e,s=n):(o=e,i=n,s=r);const a=i??Pt.active(),u=this.startSpan(t,o,a),c=Kt.setSpan(a,u);return Pt.with(c,s,void 0,u)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}class Fr{_spanProcessors;constructor(t){this._spanProcessors=t}forceFlush(){const t=[];for(const e of this._spanProcessors)t.push(e.forceFlush());return new Promise((e=>{Promise.all(t).then((()=>{e()})).catch((t=>{ce(t||new Error("MultiSpanProcessor: forceFlush failed")),e()}))}))}onStart(t,e){for(const n of this._spanProcessors)n.onStart(t,e)}onEnd(t){for(const e of this._spanProcessors)e.onEnd(t)}shutdown(){const t=[];for(const e of this._spanProcessors)t.push(e.shutdown());return new Promise(((e,n)=>{Promise.all(t).then((()=>{e()}),n)}))}}var Hr,Vr;!function(t){t[t.resolved=0]="resolved",t[t.timeout=1]="timeout",t[t.error=2]="error",t[t.unresolved=3]="unresolved"}(Hr||(Hr={}));class $r{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(t={}){const e=mn({},xr(),function(t){const e=Object.assign({},t.spanLimits);return e.attributeCountLimit=t.spanLimits?.attributeCountLimit??t.generalLimits?.attributeCountLimit??void 0??void 0??128,e.attributeValueLengthLimit=t.spanLimits?.attributeValueLengthLimit??t.generalLimits?.attributeValueLengthLimit??void 0??void 0??Dr,Object.assign({},t,{spanLimits:e})}(t));this._resource=e.resource??Er(),this._config=Object.assign({},e,{resource:this._resource});const n=[];t.spanProcessors?.length&&n.push(...t.spanProcessors),this._activeSpanProcessor=new Fr(n)}getTracer(t,e,n){const r=`${t}@${e||""}:${n?.schemaUrl||""}`;return this._tracers.has(r)||this._tracers.set(r,new Br({name:t,version:e,schemaUrl:n?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(r)}forceFlush(){const t=this._config.forceFlushTimeoutMillis,e=this._activeSpanProcessor._spanProcessors.map((e=>new Promise((n=>{let r;const o=setTimeout((()=>{n(new Error(`Span processor did not completed within timeout period of ${t} ms`)),r=Hr.timeout}),t);e.forceFlush().then((()=>{clearTimeout(o),r!==Hr.timeout&&(r=Hr.resolved,n(r))})).catch((t=>{clearTimeout(o),r=Hr.error,n(t)}))}))));return new Promise(((t,n)=>{Promise.all(e).then((e=>{const r=e.filter((t=>t!==Hr.resolved));r.length>0?n(r):t()})).catch((t=>n([t])))}))}shutdown(){return this._activeSpanProcessor.shutdown()}}class zr{_enabled=!1;_currentContext=x;_bindFunction(t=x,e){const n=this,r=function(...r){return n.with(t,(()=>e.apply(this,r)))};return Object.defineProperty(r,"length",{enumerable:!1,configurable:!0,writable:!1,value:e.length}),r}active(){return this._currentContext}bind(t,e){return void 0===t&&(t=this.active()),"function"==typeof e?this._bindFunction(t,e):e}disable(){return this._currentContext=x,this._enabled=!1,this}enable(){return this._enabled||(this._enabled=!0,this._currentContext=x),this}with(t,e,n,...r){const o=this._currentContext;this._currentContext=t||x;try{return e.call(n,...r)}finally{this._currentContext=o}}}class qr extends $r{constructor(t={}){super(t)}register(t={}){var e;Kt.setGlobalTracerProvider(this),null!==(e=t.propagator)&&(void 0!==e?qt.setGlobalPropagator(e):qt.setGlobalPropagator(new ze({propagators:[new tn,new ne]}))),function(t){if(null!==t){if(void 0===t){const t=new zr;return t.enable(),void Pt.setGlobalContextManager(t)}t.enable(),Pt.setGlobalContextManager(t)}}(t.contextManager)}}let Gr;function Kr(t,e,n,r=!0){if(!(o=n,i=e,!(i in o)||"number"!=typeof n[e]||r&&0===n[e]))return t.addEvent(e,n[e]);var o,i}function Wr(t,e,n=!1,r){void 0===r&&(r=0!==e[Vr.START_TIME]),n||(Kr(t,Vr.FETCH_START,e,r),Kr(t,Vr.DOMAIN_LOOKUP_START,e,r),Kr(t,Vr.DOMAIN_LOOKUP_END,e,r),Kr(t,Vr.CONNECT_START,e,r),Kr(t,Vr.SECURE_CONNECTION_START,e,r),Kr(t,Vr.CONNECT_END,e,r),Kr(t,Vr.REQUEST_START,e,r),Kr(t,Vr.RESPONSE_START,e,r),Kr(t,Vr.RESPONSE_END,e,r));const o=e[Vr.ENCODED_BODY_SIZE];void 0!==o&&t.setAttribute("http.response_content_length",o);const i=e[Vr.DECODED_BODY_SIZE];void 0!==i&&o!==i&&t.setAttribute("http.response_content_length_uncompressed",i)}function Xr(){return"undefined"!=typeof location?location.origin:void 0}function Qr(t,e,n,r,o=new WeakSet,i){const s=Yr(t),a=function(t,e,n,r,o,i){const s=Be(e),a=Be(n);let u=r.filter((e=>{const n=Be(je(e[Vr.FETCH_START])),r=Be(je(e[Vr.RESPONSE_END]));return e.initiatorType.toLowerCase()===(i||"xmlhttprequest")&&e.name===t&&n>=s&&r<=a}));u.length>0&&(u=u.filter((t=>!o.has(t))));return u}(t=s.toString(),e,n,r,o,i);if(0===a.length)return{mainRequest:void 0};if(1===a.length)return{mainRequest:a[0]};const u=function(t){return t.slice().sort(((t,e)=>{const n=t[Vr.FETCH_START],r=e[Vr.FETCH_START];return n>r?1:n<r?-1:0}))}(a);if(s.origin!==Xr()&&u.length>1){let t=u[0],e=function(t,e,n){const r=Be(n),o=Be(je(e));let i,s=t[1];const a=t.length;for(let e=1;e<a;e++){const n=t[e],a=Be(je(n[Vr.FETCH_START])),u=r-Be(je(n[Vr.RESPONSE_END]));a>=o&&(!i||u<i)&&(i=u,s=n)}return s}(u,t[Vr.RESPONSE_END],n);const r=t[Vr.RESPONSE_END];return e[Vr.FETCH_START]<r&&(e=t,t=void 0),{corsPreFlightRequest:t,mainRequest:e}}return{mainRequest:a[0]}}function Yr(t){if("function"==typeof URL)return new URL(t,"undefined"!=typeof document?document.baseURI:"undefined"!=typeof location?location.href:void 0);const e=(Gr||(Gr=document.createElement("a")),Gr);return e.href=t,e}function Zr(t,e){let n=e||[];("string"==typeof n||n instanceof RegExp)&&(n=[n]);return Yr(t).origin===Xr()||n.some((e=>Cn(t,e)))}var Jr;!function(t){t.CONNECT_END="connectEnd",t.CONNECT_START="connectStart",t.DECODED_BODY_SIZE="decodedBodySize",t.DOM_COMPLETE="domComplete",t.DOM_CONTENT_LOADED_EVENT_END="domContentLoadedEventEnd",t.DOM_CONTENT_LOADED_EVENT_START="domContentLoadedEventStart",t.DOM_INTERACTIVE="domInteractive",t.DOMAIN_LOOKUP_END="domainLookupEnd",t.DOMAIN_LOOKUP_START="domainLookupStart",t.ENCODED_BODY_SIZE="encodedBodySize",t.FETCH_START="fetchStart",t.LOAD_EVENT_END="loadEventEnd",t.LOAD_EVENT_START="loadEventStart",t.NAVIGATION_START="navigationStart",t.REDIRECT_END="redirectEnd",t.REDIRECT_START="redirectStart",t.REQUEST_START="requestStart",t.RESPONSE_END="responseEnd",t.RESPONSE_START="responseStart",t.SECURE_CONNECTION_START="secureConnectionStart",t.START_TIME="startTime",t.UNLOAD_EVENT_END="unloadEventEnd",t.UNLOAD_EVENT_START="unloadEventStart"}(Vr||(Vr={})),function(t){t.COMPONENT="component",t.HTTP_ERROR_NAME="http.error_name",t.HTTP_STATUS_TEXT="http.status_text"}(Jr||(Jr={}));const to=Lt.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-fetch/utils"});function eo(...t){if(t[0]instanceof URL||"string"==typeof t[0]){const e=t[1];if(!e?.body)return Promise.resolve();if(e.body instanceof ReadableStream){const{body:t,length:n}=function(t){if(!t.pipeThrough)return to.warn("Platform has ReadableStream but not pipeThrough!"),{body:t,length:Promise.resolve(void 0)};let e,n=0;const r=new Promise((t=>{e=t})),o=new TransformStream({start(){},async transform(t,e){const r=await t;n+=r.byteLength,e.enqueue(t)},flush(){e(n)}});return{body:t.pipeThrough(o),length:r}}(e.body);return e.body=t,n}return Promise.resolve(function(t){if(e=t,"undefined"!=typeof Document&&e instanceof Document)return(new XMLSerializer).serializeToString(document).length;var e;if("string"==typeof t)return ro(t);if(t instanceof Blob)return t.size;if(t instanceof FormData)return function(t){let e=0;for(const[n,r]of t.entries())e+=n.length,r instanceof Blob?e+=r.size:e+=r.length;return e}(t);if(t instanceof URLSearchParams)return ro(t.toString());if(void 0!==t.byteLength)return t.byteLength;return void to.warn("unknown body type")}(e.body))}{const e=t[0];return e?.body?e.clone().text().then((t=>ro(t))):Promise.resolve()}}const no=new TextEncoder;function ro(t){return no.encode(t).byteLength}const oo="0.200.0",io="object"==typeof process&&"node"===process.release?.name;class so extends mr{component="fetch";version=oo;moduleName=this.component;_usedResources=new WeakSet;_tasksCount=0;constructor(t={}){super("@opentelemetry/instrumentation-fetch",oo,t)}init(){}_addChildSpan(t,e){const n=this.tracer.startSpan("CORS Preflight",{startTime:e[Vr.FETCH_START]},Kt.setSpan(Pt.active(),t));Wr(n,e,this.getConfig().ignoreNetworkEvents),n.end(e[Vr.RESPONSE_END])}_addFinalSpanAttributes(t,e){const n=Yr(e.url);t.setAttribute(ye,e.status),null!=e.statusText&&t.setAttribute(Jr.HTTP_STATUS_TEXT,e.statusText),t.setAttribute(_e,n.host),t.setAttribute(ve,n.protocol.replace(":","")),"undefined"!=typeof navigator&&t.setAttribute(be,navigator.userAgent)}_addHeaders(t,e){if(!Zr(e,this.getConfig().propagateTraceHeaderCorsUrls)){const t={};return qt.inject(Pt.active(),t),void(Object.keys(t).length>0&&this._diag.debug("headers inject skipped due to CORS policy"))}if(t instanceof Request)qt.inject(Pt.active(),t.headers,{set:(t,e,n)=>t.set(e,"string"==typeof n?n:String(n))});else if(t.headers instanceof Headers)qt.inject(Pt.active(),t.headers,{set:(t,e,n)=>t.set(e,"string"==typeof n?n:String(n))});else if(t.headers instanceof Map)qt.inject(Pt.active(),t.headers,{set:(t,e,n)=>t.set(e,"string"==typeof n?n:String(n))});else{const e={};qt.inject(Pt.active(),e),t.headers=Object.assign({},e,t.headers||{})}}_clearResources(){0===this._tasksCount&&this.getConfig().clearTimingResources&&(performance.clearResourceTimings(),this._usedResources=new WeakSet)}_createSpan(t,e={}){if(An(t,this.getConfig().ignoreUrls))return void this._diag.debug("ignoring span as url matches ignored url");const n=(e.method||"GET").toUpperCase(),r=`HTTP ${n}`;return this.tracer.startSpan(r,{kind:Ct.CLIENT,attributes:{[Jr.COMPONENT]:this.moduleName,[ge]:n,[me]:t}})}_findResourceAndAddNetworkEvents(t,e,n){let r=e.entries;if(!r.length){if(!performance.getEntriesByType)return;r=performance.getEntriesByType("resource")}const o=Qr(e.spanUrl,e.startTime,n,r,this._usedResources,"fetch");if(o.mainRequest){const e=o.mainRequest;this._markResourceAsUsed(e);const n=o.corsPreFlightRequest;n&&(this._addChildSpan(t,n),this._markResourceAsUsed(n)),Wr(t,e,this.getConfig().ignoreNetworkEvents)}}_markResourceAsUsed(t){this._usedResources.add(t)}_endSpan(t,e,n){const r=Ie(Date.now()),o=ke();this._addFinalSpanAttributes(t,n),setTimeout((()=>{e.observer?.disconnect(),this._findResourceAndAddNetworkEvents(t,e,o),this._tasksCount--,this._clearResources(),t.end(r)}),300)}_patchConstructor(){return t=>{const e=this;return function(...n){const r=this,o=Yr(n[0]instanceof Request?n[0].url:String(n[0])).href,i=n[0]instanceof Request?n[0]:n[1]||{},s=e._createSpan(o,i);if(!s)return t.apply(this,n);const a=e._prepareSpanData(o);function u(t,n){e._applyAttributesAfterFetch(t,i,n),e._endSpan(t,a,{status:n.status||0,statusText:n.message,url:o})}function c(t,n){e._applyAttributesAfterFetch(t,i,n),n.status>=200&&n.status<400?e._endSpan(t,a,n):e._endSpan(t,a,{status:n.status,statusText:n.statusText,url:o})}function l(t,e,n){try{const e=n.clone().body;if(e){const r=e.getReader(),o=()=>{r.read().then((({done:e})=>{e?c(t,n):o()}),(e=>{u(t,e)}))};o()}else c(t,n)}finally{e(n)}}function p(t,e,n){try{u(t,n)}finally{e(n)}}return e.getConfig().measureRequestSize&&eo(...n).then((t=>{t&&s.setAttribute(Se,t)})).catch((t=>{e._diag.warn("getFetchBodyLength",t)})),new Promise(((n,a)=>Pt.with(Kt.setSpan(Pt.active(),s),(()=>(e._addHeaders(i,o),e._callRequestHook(s,i),e._tasksCount++,t.apply(r,i instanceof Request?[i]:[o,i]).then(l.bind(r,s,n),p.bind(r,s,a)))))))}}}_applyAttributesAfterFetch(t,e,n){const r=this.getConfig().applyCustomAttributesOnSpan;r&&_r((()=>r(t,e,n)),(t=>{t&&this._diag.error("applyCustomAttributesOnSpan",t)}))}_callRequestHook(t,e){const n=this.getConfig().requestHook;n&&_r((()=>n(t,e)),(t=>{t&&this._diag.error("requestHook",t)}))}_prepareSpanData(t){const e=ke(),n=[];if("function"!=typeof PerformanceObserver)return{entries:n,startTime:e,spanUrl:t};const r=new PerformanceObserver((e=>{e.getEntries().forEach((e=>{"fetch"===e.initiatorType&&e.name===t&&n.push(e)}))}));return r.observe({entryTypes:["resource"]}),{entries:n,observer:r,startTime:e,spanUrl:t}}enable(){io?this._diag.warn("this instrumentation is intended for web usage only, it does not instrument Node.js's fetch()"):(vr(fetch)&&(this._unwrap(pe,"fetch"),this._diag.debug("removing previous patch for constructor")),this._wrap(pe,"fetch",this._patchConstructor()))}disable(){io||(this._unwrap(pe,"fetch"),this._usedResources=new WeakSet)}}var ao;!function(t){t.METHOD_OPEN="open",t.METHOD_SEND="send",t.EVENT_ABORT="abort",t.EVENT_ERROR="error",t.EVENT_LOAD="loaded",t.EVENT_TIMEOUT="timeout"}(ao||(ao={}));const uo=Lt.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils"});function co(t){return e=t,"undefined"!=typeof Document&&e instanceof Document?(new XMLSerializer).serializeToString(document).length:"string"==typeof t?po(t):t instanceof Blob?t.size:t instanceof FormData?function(t){let e=0;for(const[n,r]of t.entries())e+=n.length,r instanceof Blob?e+=r.size:e+=r.length;return e}(t):t instanceof URLSearchParams?po(t.toString()):void 0!==t.byteLength?t.byteLength:void uo.warn("unknown body type");var e}const lo=new TextEncoder;function po(t){return lo.encode(t).byteLength}const ho="0.200.0";var fo;!function(t){t.HTTP_STATUS_TEXT="http.status_text"}(fo||(fo={}));class go extends mr{component="xml-http-request";version=ho;moduleName=this.component;_tasksCount=0;_xhrMem=new WeakMap;_usedResources=new WeakSet;constructor(t={}){super("@opentelemetry/instrumentation-xml-http-request",ho,t)}init(){}_addHeaders(t,e){if(!Zr(Yr(e).href,this.getConfig().propagateTraceHeaderCorsUrls)){const t={};return qt.inject(Pt.active(),t),void(Object.keys(t).length>0&&this._diag.debug("headers inject skipped due to CORS policy"))}const n={};qt.inject(Pt.active(),n),Object.keys(n).forEach((e=>{t.setRequestHeader(e,String(n[e]))}))}_addChildSpan(t,e){Pt.with(Kt.setSpan(Pt.active(),t),(()=>{const t=this.tracer.startSpan("CORS Preflight",{startTime:e[Vr.FETCH_START]});Wr(t,e,this.getConfig().ignoreNetworkEvents),t.end(e[Vr.RESPONSE_END])}))}_addFinalSpanAttributes(t,e,n){if("string"==typeof n){const r=Yr(n);void 0!==e.status&&t.setAttribute(ye,e.status),void 0!==e.statusText&&t.setAttribute(fo.HTTP_STATUS_TEXT,e.statusText),t.setAttribute(_e,r.host),t.setAttribute(ve,r.protocol.replace(":","")),t.setAttribute(be,navigator.userAgent)}}_applyAttributesAfterXHR(t,e){const n=this.getConfig().applyCustomAttributesOnSpan;"function"==typeof n&&_r((()=>n(t,e)),(t=>{t&&this._diag.error("applyCustomAttributesOnSpan",t)}))}_addResourceObserver(t,e){const n=this._xhrMem.get(t);n&&"function"==typeof PerformanceObserver&&"function"==typeof PerformanceResourceTiming&&(n.createdResources={observer:new PerformanceObserver((t=>{const r=t.getEntries(),o=Yr(e);r.forEach((t=>{"xmlhttprequest"===t.initiatorType&&t.name===o.href&&n.createdResources&&n.createdResources.entries.push(t)}))})),entries:[]},n.createdResources.observer.observe({entryTypes:["resource"]}))}_clearResources(){0===this._tasksCount&&this.getConfig().clearTimingResources&&(de.clearResourceTimings(),this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}_findResourceAndAddNetworkEvents(t,e,n,r,o){if(!(n&&r&&o&&t.createdResources))return;let i=t.createdResources.entries;i&&i.length||(i=de.getEntriesByType("resource"));const s=Qr(Yr(n).href,r,o,i,this._usedResources);if(s.mainRequest){const t=s.mainRequest;this._markResourceAsUsed(t);const n=s.corsPreFlightRequest;n&&(this._addChildSpan(e,n),this._markResourceAsUsed(n)),Wr(e,t,this.getConfig().ignoreNetworkEvents)}}_cleanPreviousSpanInformation(t){const e=this._xhrMem.get(t);if(e){const n=e.callbackToRemoveEvents;n&&n(),this._xhrMem.delete(t)}}_createSpan(t,e,n){if(An(e,this.getConfig().ignoreUrls))return void this._diag.debug("ignoring span as url matches ignored url");const r=n.toUpperCase(),o=this.tracer.startSpan(r,{kind:Ct.CLIENT,attributes:{[ge]:n,[me]:Yr(e).toString()}});return o.addEvent(ao.METHOD_OPEN),this._cleanPreviousSpanInformation(t),this._xhrMem.set(t,{span:o,spanUrl:e}),o}_markResourceAsUsed(t){this._usedResources.add(t)}_patchOpen(){return t=>{const e=this;return function(...n){const r=n[0],o=n[1];return e._createSpan(this,o,r),t.apply(this,n)}}}_patchSend(){const t=this;function e(e,n){const r=t._xhrMem.get(n);if(!r)return;r.status=n.status,r.statusText=n.statusText,t._xhrMem.delete(n),r.span&&t._applyAttributesAfterXHR(r.span,n);const o=ke(),i=Date.now();setTimeout((()=>{!function(e,n,r,o){const i=n.callbackToRemoveEvents;"function"==typeof i&&i();const{span:s,spanUrl:a,sendStartTime:u}=n;s&&(t._findResourceAndAddNetworkEvents(n,s,a,u,r),s.addEvent(e,o),t._addFinalSpanAttributes(s,n,a),s.end(o),t._tasksCount--),t._clearResources()}(e,r,o,i)}),300)}function n(){e(ao.EVENT_ERROR,this)}function r(){e(ao.EVENT_ABORT,this)}function o(){e(ao.EVENT_TIMEOUT,this)}function i(){this.status<299?e(ao.EVENT_LOAD,this):e(ao.EVENT_ERROR,this)}return e=>function(...s){const a=t._xhrMem.get(this);if(!a)return e.apply(this,s);const u=a.span,c=a.spanUrl;if(u&&c){if(t.getConfig().measureRequestSize&&s?.[0]){const t=co(s[0]);void 0!==t&&u.setAttribute(Se,t)}Pt.with(Kt.setSpan(Pt.active(),u),(()=>{t._tasksCount++,a.sendStartTime=ke(),u.addEvent(ao.METHOD_SEND),this.addEventListener("abort",r),this.addEventListener("error",n),this.addEventListener("load",i),this.addEventListener("timeout",o),a.callbackToRemoveEvents=()=>{!function(e){e.removeEventListener("abort",r),e.removeEventListener("error",n),e.removeEventListener("load",i),e.removeEventListener("timeout",o);const s=t._xhrMem.get(e);s&&(s.callbackToRemoveEvents=void 0)}(this),a.createdResources&&a.createdResources.observer.disconnect()},t._addHeaders(this,c),t._addResourceObserver(this,c)}))}return e.apply(this,s)}}enable(){this._diag.debug("applying patch to",this.moduleName,this.version),vr(XMLHttpRequest.prototype.open)&&(this._unwrap(XMLHttpRequest.prototype,"open"),this._diag.debug("removing previous patch from method open")),vr(XMLHttpRequest.prototype.send)&&(this._unwrap(XMLHttpRequest.prototype,"send"),this._diag.debug("removing previous patch from method send")),this._wrap(XMLHttpRequest.prototype,"open",this._patchOpen()),this._wrap(XMLHttpRequest.prototype,"send",this._patchSend())}disable(){this._diag.debug("removing patch from",this.moduleName,this.version),this._unwrap(XMLHttpRequest.prototype,"open"),this._unwrap(XMLHttpRequest.prototype,"send"),this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet}}class mo extends go{constructor(t={}){super(t);this.parentCreateSpan=this._createSpan.bind(this)}_patchOpen(){return t=>{const n=this;return function(...r){try{const t=r[0];let o=e.getUrlFromResource(r[1]);n.parentCreateSpan(this,o,t)}catch(t){e.faro.internalLogger.error(t)}return t.apply(this,r)}}}}function _o(t,e,n){vo(t,n instanceof Error?0:n.status)}function vo(t,e){if(null==e)return;(0===e||e>=400&&e<600)&&t.setStatus({code:At.ERROR})}function yo(t){return(e,n,r)=>{_o(e,0,r),null==t||t(e,n,r)}}function bo(t){return(e,n)=>{!function(t,e){vo(t,e.status)}(e,n),null==t||t(e,n)}}function So(t={}){const{fetchInstrumentationOptions:e,xhrInstrumentationOptions:n}=t,r=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n}(t,["fetchInstrumentationOptions","xhrInstrumentationOptions"]),o=function(t,e){return Object.assign(Object.assign(Object.assign(Object.assign({},e),{ignoreNetworkEvents:!0}),t),{applyCustomAttributesOnSpan:yo(null==t?void 0:t.applyCustomAttributesOnSpan)})}(e,r),i=function(t,e){return Object.assign(Object.assign(Object.assign(Object.assign({},e),{ignoreNetworkEvents:!0}),t),{applyCustomAttributesOnSpan:bo(null==t?void 0:t.applyCustomAttributesOnSpan)})}(n,r);return[new so(o),new mo(i)]}class Eo{constructor(t,e){this.processor=t,this.metas=e}forceFlush(){return this.processor.forceFlush()}onStart(t,e){var n;const r=this.metas.value.session;(null==r?void 0:r.id)&&(t.attributes[er]=r.id,t.attributes.session_id=r.id);const o=null!==(n=this.metas.value.user)&&void 0!==n?n:{};o.email&&(t.attributes["user.email"]=o.email),o.id&&(t.attributes["user.id"]=o.id),o.username&&(t.attributes["user.name"]=o.username),o.fullName&&(t.attributes["user.full_name"]=o.fullName),o.roles&&(t.attributes["user.roles"]=o.roles.split(",").map((t=>t.trim()))),o.hash&&(t.attributes["user.hash"]=o.hash),this.processor.onStart(t,e)}onEnd(t){this.processor.onEnd(t)}shutdown(){return this.processor.shutdown()}}class To{constructor(t){this.processor=t,e.apiMessageBus.subscribe((t=>{"user-action-start"!==t.type?[Yn,Zn].includes(t.type)&&(this.message=void 0):this.message=t}))}forceFlush(){return this.processor.forceFlush()}onStart(t,e){var n,r;t.kind===Ct.CLIENT&&this.message&&(t.attributes["faro.action.user.name"]=null===(n=this.message)||void 0===n?void 0:n.name,t.attributes["faro.action.user.parentId"]=null===(r=this.message)||void 0===r?void 0:r.parentId),this.processor.onStart(t,e)}onEnd(t){this.processor.onEnd(t)}shutdown(){return this.processor.shutdown()}}function wo(t={}){var e;return"true"===(null===(e=t.attributes)||void 0===e?void 0:e.isSampled)?wr.RECORD_AND_SAMPLED:wr.NOT_RECORD}class Co extends e.BaseInstrumentation{constructor(t={}){super(),this.options=t,this.name="@grafana/faro-web-tracing",this.version=e.VERSION}initialize(){var t,e,n,r;const o=this.options,i={};this.config.app.name&&(i[Ae]=this.config.app.name),this.config.app.namespace&&(i["service.namespace"]=this.config.app.namespace),this.config.app.version&&(i["service.version"]=this.config.app.version),this.config.app.environment&&(i["deployment.environment.name"]=this.config.app.environment,i["deployment.environment"]=this.config.app.environment),Object.assign(i,o.resourceAttributes);const s=Er().merge(Sr(i));new qr({resource:s,sampler:{shouldSample:()=>({decision:wo(this.api.getSession())})},spanProcessors:[null!==(t=o.spanProcessor)&&void 0!==t?t:new To(new Eo(new Mr(new tr({api:this.api}),{scheduledDelayMillis:Co.SCHEDULED_BATCH_DELAY_MS,maxExportBatchSize:30}),this.metas))]}).register({propagator:null!==(e=o.propagator)&&void 0!==e?e:new tn,contextManager:o.contextManager});const{propagateTraceHeaderCorsUrls:a,fetchInstrumentationOptions:u,xhrInstrumentationOptions:c}=null!==(n=this.options.instrumentationOptions)&&void 0!==n?n:{};!function(t){const e=t.tracerProvider||Kt.getTracerProvider(),n=t.meterProvider||Mt.getMeterProvider(),r=t.loggerProvider||pr.getLoggerProvider(),o=t.instrumentations?.flat()??[];(function(t,e,n,r){for(let o=0,i=t.length;o<i;o++){const i=t[o];e&&i.setTracerProvider(e),n&&i.setMeterProvider(n),r&&i.setLoggerProvider&&i.setLoggerProvider(r),i.getConfig().enabled||i.enable()}})(o,e,n,r)}({instrumentations:null!==(r=o.instrumentations)&&void 0!==r?r:So({ignoreUrls:this.getIgnoreUrls(),propagateTraceHeaderCorsUrls:a,fetchInstrumentationOptions:u,xhrInstrumentationOptions:c})}),this.api.initOTEL(Kt,Pt)}getIgnoreUrls(){return this.transports.transports.flatMap((t=>t.getIgnoreUrls()))}}return Co.SCHEDULED_BATCH_DELAY_MS=1e3,t.FaroSessionSpanProcessor=class{constructor(t,e){this.processor=t,this.metas=e}forceFlush(){return this.processor.forceFlush()}onStart(t,e){const n=this.metas.value.session;(null==n?void 0:n.id)&&(t.attributes[er]=n.id,t.attributes.session_id=n.id),this.processor.onStart(t,e)}onEnd(t){this.processor.onEnd(t)}shutdown(){return this.processor.shutdown()}},t.FaroTraceExporter=tr,t.TracingInstrumentation=Co,t.fetchCustomAttributeFunctionWithDefaults=yo,t.getDefaultOTELInstrumentations=So,t.getSamplingDecision=wo,t.setSpanStatusOnFetchError=_o,t}({},GrafanaFaroWebSdk);
@@ -1,4 +1,4 @@
1
- import { Span } from '@opentelemetry/api';
1
+ import type { Span } from '@opentelemetry/api';
2
2
  import type { FetchCustomAttributeFunction } from '@opentelemetry/instrumentation-fetch';
3
3
  import type { XHRCustomAttributeFunction } from '@opentelemetry/instrumentation-xml-http-request';
4
4
  export interface FetchError {
@@ -0,0 +1,11 @@
1
+ /**
2
+ Unstable SemConv
3
+ Because the "incubating" entry-point may include breaking changes in minor versions,
4
+ it is recommended that instrumentation libraries not import @opentelemetry/semantic-conventions/incubating in runtime code,
5
+ but instead copy relevant definitions into their own code base. (This is the same recommendation as for other languages.)
6
+
7
+ See: https://www.npmjs.com/package/@opentelemetry/semantic-conventions#:~:text=%7D)%3B-,Unstable%20SemConv,-Because%20the%20%22incubating
8
+ */
9
+ export declare const ATTR_SESSION_ID = "session.id";
10
+ export declare const ATTR_DEPLOYMENT_ENVIRONMENT_NAME = "deployment.environment.name";
11
+ export declare const ATTR_SERVICE_NAMESPACE = "service.namespace";
@@ -1,8 +1,7 @@
1
- import type { ContextManager, TextMapPropagator } from '@opentelemetry/api';
1
+ import type { Attributes, ContextManager, TextMapPropagator } from '@opentelemetry/api';
2
2
  import type { Instrumentation } from '@opentelemetry/instrumentation';
3
3
  import type { FetchCustomAttributeFunction } from '@opentelemetry/instrumentation-fetch';
4
4
  import type { XHRCustomAttributeFunction } from '@opentelemetry/instrumentation-xml-http-request';
5
- import type { ResourceAttributes } from '@opentelemetry/resources';
6
5
  import type { SpanProcessor } from '@opentelemetry/sdk-trace-web';
7
6
  import type { Patterns } from '@grafana/faro-core';
8
7
  import type { API } from '@grafana/faro-web-sdk';
@@ -11,7 +10,7 @@ export interface FaroTraceExporterConfig {
11
10
  api: API;
12
11
  }
13
12
  export interface TracingInstrumentationOptions {
14
- resourceAttributes?: ResourceAttributes;
13
+ resourceAttributes?: Attributes;
15
14
  propagator?: TextMapPropagator;
16
15
  contextManager?: ContextManager;
17
16
  instrumentations?: InstrumentationOption[];
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FaroMetaAttributesSpanProcessor = void 0;
4
- // False positive. Package can be resolved.
5
- // eslint-disable-next-line import/no-unresolved
6
- var incubating_1 = require("@opentelemetry/semantic-conventions/incubating");
4
+ var semconv_1 = require("./semconv");
7
5
  var FaroMetaAttributesSpanProcessor = /** @class */ (function () {
8
6
  function FaroMetaAttributesSpanProcessor(processor, metas) {
9
7
  this.processor = processor;
@@ -16,7 +14,7 @@ var FaroMetaAttributesSpanProcessor = /** @class */ (function () {
16
14
  var _a;
17
15
  var session = this.metas.value.session;
18
16
  if (session === null || session === void 0 ? void 0 : session.id) {
19
- span.attributes[incubating_1.ATTR_SESSION_ID] = session.id;
17
+ span.attributes[semconv_1.ATTR_SESSION_ID] = session.id;
20
18
  /**
21
19
  * @deprecated will be removed in the future and has been replaced by ATTR_SESSION_ID (session.id)
22
20
  */
@@ -1 +1 @@
1
- {"version":3,"file":"faroMetaAttributesSpanProcessor.js","sourceRoot":"","sources":["../../src/faroMetaAttributesSpanProcessor.ts"],"names":[],"mappings":";;;AAEA,2CAA2C;AAC3C,gDAAgD;AAChD,6EAAiF;AAIjF;IACE,yCACU,SAAwB,EACxB,KAAY;QADZ,cAAS,GAAT,SAAS,CAAe;QACxB,UAAK,GAAL,KAAK,CAAO;IACnB,CAAC;IAEJ,oDAAU,GAAV;QACE,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC;IAED,iDAAO,GAAP,UAAQ,IAAU,EAAE,aAAsB;;QACxC,IAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC;QAEzC,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,EAAE,EAAE;YACf,IAAI,CAAC,UAAU,CAAC,4BAAe,CAAC,GAAG,OAAO,CAAC,EAAE,CAAC;YAC9C;;eAEG;YACH,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,EAAE,CAAC;SAC5C;QAED,IAAM,IAAI,GAAG,MAAA,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,mCAAI,EAAE,CAAC;QAEzC,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;SAC5C;QAED,IAAI,IAAI,CAAC,EAAE,EAAE;YACX,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;SACtC;QAED,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;SAC9C;QAED,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;SACnD;QAED,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,IAAI,EAAE,EAAX,CAAW,CAAC,CAAC;SAClF;QAED,IAAI,IAAI,CAAC,IAAI,EAAE;YACb,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC;SAC1C;QAED,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAC9C,CAAC;IAED,+CAAK,GAAL,UAAM,IAAkB;QACtB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED,kDAAQ,GAAR;QACE,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;IACnC,CAAC;IACH,sCAAC;AAAD,CAAC,AAzDD,IAyDC;AAzDY,0EAA+B","sourcesContent":["import type { Context } from '@opentelemetry/api';\nimport type { ReadableSpan, Span, SpanProcessor } from '@opentelemetry/sdk-trace-web';\n// False positive. Package can be resolved.\n// eslint-disable-next-line import/no-unresolved\nimport { ATTR_SESSION_ID } from '@opentelemetry/semantic-conventions/incubating';\n\nimport type { Metas } from '@grafana/faro-web-sdk';\n\nexport class FaroMetaAttributesSpanProcessor implements SpanProcessor {\n constructor(\n private processor: SpanProcessor,\n private metas: Metas\n ) {}\n\n forceFlush(): Promise<void> {\n return this.processor.forceFlush();\n }\n\n onStart(span: Span, parentContext: Context): void {\n const session = this.metas.value.session;\n\n if (session?.id) {\n span.attributes[ATTR_SESSION_ID] = session.id;\n /**\n * @deprecated will be removed in the future and has been replaced by ATTR_SESSION_ID (session.id)\n */\n span.attributes['session_id'] = session.id;\n }\n\n const user = this.metas.value.user ?? {};\n\n if (user.email) {\n span.attributes['user.email'] = user.email;\n }\n\n if (user.id) {\n span.attributes['user.id'] = user.id;\n }\n\n if (user.username) {\n span.attributes['user.name'] = user.username;\n }\n\n if (user.fullName) {\n span.attributes['user.full_name'] = user.fullName;\n }\n\n if (user.roles) {\n span.attributes['user.roles'] = user.roles.split(',').map((role) => role.trim());\n }\n\n if (user.hash) {\n span.attributes['user.hash'] = user.hash;\n }\n\n this.processor.onStart(span, parentContext);\n }\n\n onEnd(span: ReadableSpan): void {\n this.processor.onEnd(span);\n }\n\n shutdown(): Promise<void> {\n return this.processor.shutdown();\n }\n}\n"]}
1
+ {"version":3,"file":"faroMetaAttributesSpanProcessor.js","sourceRoot":"","sources":["../../src/faroMetaAttributesSpanProcessor.ts"],"names":[],"mappings":";;;AAKA,qCAA4C;AAE5C;IACE,yCACU,SAAwB,EACxB,KAAY;QADZ,cAAS,GAAT,SAAS,CAAe;QACxB,UAAK,GAAL,KAAK,CAAO;IACnB,CAAC;IAEJ,oDAAU,GAAV;QACE,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC;IAED,iDAAO,GAAP,UAAQ,IAAU,EAAE,aAAsB;;QACxC,IAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC;QAEzC,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,EAAE,EAAE,CAAC;YAChB,IAAI,CAAC,UAAU,CAAC,yBAAe,CAAC,GAAG,OAAO,CAAC,EAAE,CAAC;YAC9C;;eAEG;YACH,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,EAAE,CAAC;QAC7C,CAAC;QAED,IAAM,IAAI,GAAG,MAAA,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,mCAAI,EAAE,CAAC;QAEzC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;QAC7C,CAAC;QAED,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC;YACZ,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;QACvC,CAAC;QAED,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/C,CAAC;QAED,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;QACpD,CAAC;QAED,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,IAAI,EAAE,EAAX,CAAW,CAAC,CAAC;QACnF,CAAC;QAED,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC;QAC3C,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAC9C,CAAC;IAED,+CAAK,GAAL,UAAM,IAAkB;QACtB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED,kDAAQ,GAAR;QACE,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;IACnC,CAAC;IACH,sCAAC;AAAD,CAAC,AAzDD,IAyDC;AAzDY,0EAA+B","sourcesContent":["import type { Context } from '@opentelemetry/api';\nimport type { ReadableSpan, Span, SpanProcessor } from '@opentelemetry/sdk-trace-web';\n\nimport type { Metas } from '@grafana/faro-web-sdk';\n\nimport { ATTR_SESSION_ID } from './semconv';\n\nexport class FaroMetaAttributesSpanProcessor implements SpanProcessor {\n constructor(\n private processor: SpanProcessor,\n private metas: Metas\n ) {}\n\n forceFlush(): Promise<void> {\n return this.processor.forceFlush();\n }\n\n onStart(span: Span, parentContext: Context): void {\n const session = this.metas.value.session;\n\n if (session?.id) {\n span.attributes[ATTR_SESSION_ID] = session.id;\n /**\n * @deprecated will be removed in the future and has been replaced by ATTR_SESSION_ID (session.id)\n */\n span.attributes['session_id'] = session.id;\n }\n\n const user = this.metas.value.user ?? {};\n\n if (user.email) {\n span.attributes['user.email'] = user.email;\n }\n\n if (user.id) {\n span.attributes['user.id'] = user.id;\n }\n\n if (user.username) {\n span.attributes['user.name'] = user.username;\n }\n\n if (user.fullName) {\n span.attributes['user.full_name'] = user.fullName;\n }\n\n if (user.roles) {\n span.attributes['user.roles'] = user.roles.split(',').map((role) => role.trim());\n }\n\n if (user.hash) {\n span.attributes['user.hash'] = user.hash;\n }\n\n this.processor.onStart(span, parentContext);\n }\n\n onEnd(span: ReadableSpan): void {\n this.processor.onEnd(span);\n }\n\n shutdown(): Promise<void> {\n return this.processor.shutdown();\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sendFaroEvents = void 0;
3
+ exports.sendFaroEvents = sendFaroEvents;
4
4
  var internal_types_1 = require("@opentelemetry/otlp-transformer/build/src/trace/internal-types");
5
5
  var faro_core_1 = require("@grafana/faro-core");
6
6
  var DURATION_NS_KEY = 'duration_ns';
@@ -66,5 +66,4 @@ function sendFaroEvents(resourceSpans) {
66
66
  }
67
67
  }
68
68
  }
69
- exports.sendFaroEvents = sendFaroEvents;
70
69
  //# sourceMappingURL=faroTraceExporter.utils.js.map