@grafana/faro-web-tracing 1.13.3 → 1.14.1

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.
@@ -1,7 +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,h=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},d=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 g("debug",this._namespace,t)},t.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return g("error",this._namespace,t)},t.prototype.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return g("info",this._namespace,t)},t.prototype.warn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return g("warn",this._namespace,t)},t.prototype.verbose=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return g("verbose",this._namespace,t)},t}();function g(t,e,n){var r=l("diag");if(r)return n.unshift(e),r[t].apply(r,d([],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"}(f||(f={}));var v=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},y=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,y([],v(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}(),b=Symbol("BaggageEntryMetadata"),O=E.instance();function R(t){return void 0===t&&(t={}),new S(new Map(Object.entries(t)))}function P(t){return Symbol.for(t)}var L,w,A=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 A,N=(L=function(t,e){return L=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])},L(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}L(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 V},t.prototype.createHistogram=function(t,e){return G},t.prototype.createCounter=function(t,e){return F},t.prototype.createUpDownCounter=function(t,e){return X},t.prototype.createObservableGauge=function(t,e){return K},t.prototype.createObservableCounter=function(t,e){return q},t.prototype.createObservableUpDownCounter=function(t,e){return W},t.prototype.addBatchObservableCallback=function(t,e){},t.prototype.removeBatchObservableCallback=function(t){},t}(),k=function(){},D=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return N(e,t),e.prototype.add=function(t,e){},e}(k),x=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return N(e,t),e.prototype.add=function(t,e){},e}(k),M=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return N(e,t),e.prototype.record=function(t,e){},e}(k),j=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return N(e,t),e.prototype.record=function(t,e){},e}(k),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 N(e,t),e}(U),z=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return N(e,t),e}(U),Z=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return N(e,t),e}(U),H=new I,F=new D,V=new M,G=new j,X=new x,q=new B,K=new z,W=new Z,Y={get:function(t,e){if(null!=t)return t[e]},keys:function(t){return null==t?[]:Object.keys(t)}},$={set:function(t,e,n){null!=t&&(t[e]=n)}},Q=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],Q(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"}(w||(w={}));var at="0000000000000000",st="00000000000000000000000000000000",ut={traceId:st,spanId:at,traceFlags:w.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=P("OpenTelemetry Context Key SPAN");function pt(t){return t.getValue(lt)||void 0}function ft(){return pt(it.getInstance().active())}function ht(t,e){return t.setValue(lt,e)}function dt(t){return t.deleteValue(lt)}function _t(t,e){return ht(t,new ct(e))}function gt(t){var e;return null===(e=pt(t))||void 0===e?void 0:e.spanContext()}var vt=/^([0-9a-f]{32})$/i,yt=/^[0-9a-f]{16}$/i;function Et(t){return vt.test(t)&&t!==st}function Tt(t){return Et(t.traceId)&&(e=t.spanId,yt.test(e)&&e!==at);var e}function mt(t){return new ct(t)}var St=it.getInstance(),bt=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&&gt(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=ht(s,u);return St.with(c,a,void 0,u)}},t}();var Ot,Rt,Pt,Lt=new bt,wt=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):Lt},t}(),At=new(function(){function t(){}return t.prototype.getTracer=function(t,e,n){return new bt},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 wt(this,t,e,n)},t.prototype.getDelegate=function(){var t;return null!==(t=this._delegate)&&void 0!==t?t:At},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"}(Ot||(Ot={})),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"}(Pt||(Pt={}));var Nt=it.getInstance(),It=E.instance(),kt=new(function(){function t(){}return t.prototype.getMeter=function(t,e,n){return H},t}()),Dt="metrics",xt=function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalMeterProvider=function(t){return c(Dt,t,E.instance())},t.prototype.getMeterProvider=function(){return l(Dt)||kt},t.prototype.getMeter=function(t,e,n){return this.getMeterProvider().getMeter(t,e,n)},t.prototype.disable=function(){p(Dt,E.instance())},t}().getInstance(),Mt=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=P("OpenTelemetry Baggage Key");function Ut(t){return t.getValue(jt)||void 0}function Bt(){return Ut(it.getInstance().active())}function zt(t,e){return t.setValue(jt,e)}function Zt(t){return t.deleteValue(jt)}var Ht="propagation",Ft=new Mt,Vt=function(){function t(){this.createBaggage=R,this.getBaggage=Ut,this.getActiveBaggage=Bt,this.setBaggage=zt,this.deleteBaggage=Zt}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalPropagator=function(t){return c(Ht,t,E.instance())},t.prototype.inject=function(t,e,n){return void 0===n&&(n=$),this._getGlobalPropagator().inject(t,e,n)},t.prototype.extract=function(t,e,n){return void 0===n&&(n=Y),this._getGlobalPropagator().extract(t,e,n)},t.prototype.fields=function(){return this._getGlobalPropagator().fields()},t.prototype.disable=function(){p(Ht,E.instance())},t.prototype._getGlobalPropagator=function(){return l(Ht)||Ft},t}(),Gt=Vt.getInstance(),Xt="trace",qt=function(){function t(){this._proxyTracerProvider=new Ct,this.wrapSpanContext=mt,this.isSpanContextValid=Tt,this.deleteSpan=dt,this.getSpan=pt,this.getActiveSpan=ft,this.getSpanContext=gt,this.setSpan=ht,this.setSpanContext=_t}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalTracerProvider=function(t){var e=c(Xt,this._proxyTracerProvider,E.instance());return e&&this._proxyTracerProvider.setDelegate(t),e},t.prototype.getTracerProvider=function(){return l(Xt)||this._proxyTracerProvider},t.prototype.getTracer=function(t,e){return this.getTracerProvider().getTracer(t,e)},t.prototype.disable=function(){p(Xt,E.instance()),this._proxyTracerProvider=new Ct},t}().getInstance(),Kt=P("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function Wt(t){return t.setValue(Kt,!0)}function Yt(t){return!0===t.getValue(Kt)}var $t="=",Qt=";",Jt=",",te="baggage",ee=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 ne(t){return t.reduce((function(t,e){var n=""+t+(""!==t?Jt:"")+e;return n.length>8192?t:n}),"")}function re(t){return t.getAllEntries().map((function(t){var e=ee(t,2),n=e[0],r=e[1],o=encodeURIComponent(n)+"="+encodeURIComponent(r.value);return void 0!==r.metadata&&(o+=Qt+r.metadata.toString()),o}))}function oe(t){var e=t.split(Qt);if(!(e.length<=0)){var n=e.shift();if(n){var r=n.indexOf($t);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(Qt))&&(O.error("Cannot create baggage metadata from unknown type: "+typeof i),i=""),o={__TYPE__:b,toString:function(){return i}}),{key:a,value:s,metadata:o}}}}}var ie=function(){function t(){}return t.prototype.inject=function(t,e,n){var r=Gt.getBaggage(t);if(r&&!Yt(t)){var o=ne(re(r).filter((function(t){return t.length<=4096})).slice(0,180));o.length>0&&n.set(e,te,o)}},t.prototype.extract=function(t,e,n){var r=n.get(e,te),o=Array.isArray(r)?r.join(Jt):r;if(!o)return t;var i={};return 0===o.length?t:(o.split(Jt).forEach((function(t){var e=oe(t);if(e){var n={value:e.value};e.metadata&&(n.metadata=e.metadata),i[e.key]=n}})),0===Object.entries(i).length?t:Gt.setBaggage(t,Gt.createBaggage(i)))},t.prototype.fields=function(){return[te]},t}(),ae=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}(),se=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.")},ue=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 ce(t){var e,n,r={};if("object"!=typeof t||null==t)return r;try{for(var o=se(Object.entries(t)),i=o.next();!i.done;i=o.next()){var a=ue(i.value,2),s=a[0],u=a[1];le(s)?pe(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 le(t){return"string"==typeof t&&t.length>0}function pe(t){return null==t||(Array.isArray(t)?function(t){var e,n,r;try{for(var o=se(t),i=o.next();!i.done;i=o.next()){var a=i.value;if(null!=a){if(!r){if(fe(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):fe(t))}function fe(t){switch(typeof t){case"number":case"boolean":case"string":return!0}return!1}function he(){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 de,_e=he();function ge(t){try{_e(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"}(de||(de={}));var ve=",",ye=["OTEL_SDK_DISABLED"];function Ee(t){return ye.indexOf(t)>-1}var Te=["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 me(t){return Te.indexOf(t)>-1}var Se=["OTEL_NO_PATCH_MODULES","OTEL_PROPAGATORS","OTEL_SEMCONV_STABILITY_OPT_IN"];function be(t){return Se.indexOf(t)>-1}var Oe=1/0,Re=128,Pe={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:Oe,OTEL_ATTRIBUTE_COUNT_LIMIT:Re,OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT:Oe,OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT:Re,OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT:Oe,OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT:Re,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:de.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 Le(t,e,n){if(void 0!==n[t]){var r=String(n[t]);e[t]="true"===r.toLowerCase()}}function we(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 Ae(t,e,n,r){void 0===r&&(r=ve);var o=n[t];"string"==typeof o&&(e[t]=o.split(r).map((function(t){return t.trim()})))}var Ce={ALL:f.ALL,VERBOSE:f.VERBOSE,DEBUG:f.DEBUG,INFO:f.INFO,WARN:f.WARN,ERROR:f.ERROR,NONE:f.NONE};function Ne(t,e,n){var r=n[t];if("string"==typeof r){var o=Ce[r.toUpperCase()];null!=o&&(e[t]=o)}}function Ie(t){var e={};for(var n in Pe){var r=n;if("OTEL_LOG_LEVEL"===r)Ne(r,e,t);else if(Ee(r))Le(r,e,t);else if(me(r))we(r,e,t);else if(be(r))Ae(r,e,t);else{var o=t[r];null!=o&&(e[r]=String(o))}}return e}var ke="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{};function De(){var t=Ie(ke);return Object.assign({},Pe,t)}function xe(){return Ie(ke)}function Me(t){return t>=48&&t<=57?t-48:t>=97&&t<=102?t-87:t-55}function je(t){for(var e=new Uint8Array(t.length/2),n=0,r=0;r<t.length;r+=2){var o=Me(t.charCodeAt(r)),i=Me(t.charCodeAt(r+1));e[n++]=o<<4|i}return e}var Ue=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},Be=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 ze=function(){this.generateTraceId=He(16),this.generateSpanId=He(8)},Ze=Array(32);function He(t){return function(){for(var e=0;e<2*t;e++)Ze[e]=Math.floor(16*Math.random())+48,Ze[e]>=58&&(Ze[e]+=39);return String.fromCharCode.apply(null,Ze.slice(0,2*t))}}var Fe,Ve=performance,Ge="1.30.1",Xe="exception.type",qe="exception.message",Ke="http.method",We="http.url",Ye="http.host",$e="http.scheme",Qe="http.status_code",Je="http.user_agent",tn="http.request_content_length_uncompressed",en="telemetry.sdk.name",nn="telemetry.sdk.language",rn="telemetry.sdk.version",on=((Fe={})[en]="opentelemetry",Fe["process.runtime.name"]="browser",Fe[nn]="webjs",Fe[rn]=Ge,Fe);function an(t){}var sn,un=Math.pow(10,6),cn=Math.pow(10,9);function ln(t){var e=t/1e3;return[Math.trunc(e),Math.round(t%1e3*un)]}function pn(){var t=Ve.timeOrigin;if("number"!=typeof t){var e=Ve;t=e.timing&&e.timing.fetchStart}return t}function fn(t){return yn(ln(pn()),ln("number"==typeof t?t:Ve.now()))}function hn(t){if(gn(t))return t;if("number"==typeof t)return t<pn()?fn(t):ln(t);if(t instanceof Date)return ln(t.getTime());throw TypeError("Invalid input type")}function dn(t,e){var n=e[0]-t[0],r=e[1]-t[1];return r<0&&(n-=1,r+=cn),[n,r]}function _n(t){return t[0]*cn+t[1]}function gn(t){return Array.isArray(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]}function vn(t){return gn(t)||"number"==typeof t||t instanceof Date}function yn(t,e){var n=[t[0]+e[0],t[1]+e[1]];return n[1]>=cn&&(n[1]-=cn,n[0]+=1),n}!function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"}(sn||(sn={}));var En=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.")},Tn=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=En(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}(),mn="[_0-9a-z-*/]",Sn=new RegExp("^(?:"+("[a-z]"+mn+"{0,255}")+"|"+("[a-z0-9]"+mn+"{0,240}@[a-z]"+mn+"{0,13}")+")$"),bn=/^[ -~]{0,255}[!-~]$/,On=/,|=/;var Rn=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 Sn.test(t)})(o)&&function(t){return bn.test(t)&&!On.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}(),Pn="traceparent",Ln="tracestate",wn=new RegExp("^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$");function An(t){var e=wn.exec(t);return e?"00"===e[1]&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}:null}var Cn,Nn=function(){function t(){}return t.prototype.inject=function(t,e,n){var r=qt.getSpanContext(t);if(r&&!Yt(t)&&Tt(r)){var o="00-"+r.traceId+"-"+r.spanId+"-0"+Number(r.traceFlags||w.NONE).toString(16);n.set(e,Pn,o),r.traceState&&n.set(e,Ln,r.traceState.serialize())}},t.prototype.extract=function(t,e,n){var r=n.get(e,Pn);if(!r)return t;var o=Array.isArray(r)?r[0]:r;if("string"!=typeof o)return t;var i=An(o);if(!i)return t;i.isRemote=!0;var a=n.get(e,Ln);if(a){var s=Array.isArray(a)?a.join(","):a;i.traceState=new Rn("string"==typeof s?s:void 0)}return qt.setSpanContext(t,i)},t.prototype.fields=function(){return[Pn,Ln]},t}(),In=P("OpenTelemetry SDK Context Key RPC_METADATA");!function(t){t.HTTP="http"}(Cn||(Cn={}));var kn,Dn,xn=function(){function t(){}return t.prototype.shouldSample=function(){return{decision:Ot.NOT_RECORD}},t.prototype.toString=function(){return"AlwaysOffSampler"},t}(),Mn=function(){function t(){}return t.prototype.shouldSample=function(){return{decision:Ot.RECORD_AND_SAMPLED}},t.prototype.toString=function(){return"AlwaysOnSampler"},t}(),jn=function(){function t(t){var e,n,r,o;this._root=t.root,this._root||(ge(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new Mn),this._remoteParentSampled=null!==(e=t.remoteParentSampled)&&void 0!==e?e:new Mn,this._remoteParentNotSampled=null!==(n=t.remoteParentNotSampled)&&void 0!==n?n:new xn,this._localParentSampled=null!==(r=t.localParentSampled)&&void 0!==r?r:new Mn,this._localParentNotSampled=null!==(o=t.localParentNotSampled)&&void 0!==o?o:new xn}return t.prototype.shouldSample=function(t,e,n,r,o,i){var a=qt.getSpanContext(t);return a&&Tt(a)?a.isRemote?a.traceFlags&w.SAMPLED?this._remoteParentSampled.shouldSample(t,e,n,r,o,i):this._remoteParentNotSampled.shouldSample(t,e,n,r,o,i):a.traceFlags&w.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}(),Un=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?Ot.RECORD_AND_SAMPLED:Ot.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}(),Bn="[object Object]",zn="[object Null]",Zn="[object Undefined]",Hn=Function.prototype.toString,Fn=Hn.call(Object),Vn=(kn=Object.getPrototypeOf,Dn=Object,function(t){return kn(Dn(t))}),Gn=Object.prototype,Xn=Gn.hasOwnProperty,qn=Symbol?Symbol.toStringTag:void 0,Kn=Gn.toString;function Wn(t){if(!function(t){return null!=t&&"object"==typeof t}(t)||function(t){if(null==t)return void 0===t?Zn:zn;return qn&&qn in Object(t)?function(t){var e=Xn.call(t,qn),n=t[qn],r=!1;try{t[qn]=void 0,r=!0}catch(t){}var o=Kn.call(t);r&&(e?t[qn]=n:delete t[qn]);return o}(t):function(t){return Kn.call(t)}(t)}(t)!==Bn)return!1;var e=Vn(t);if(null===e)return!0;var n=Xn.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Hn.call(n)===Fn}var Yn=20;function $n(){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=Jn(n,t.shift(),0,r);return n}function Qn(t){return er(t)?t.slice():t}function Jn(t,e,n,r){var o;if(void 0===n&&(n=0),!(n>Yn)){if(n++,or(t)||or(e)||nr(e))o=Qn(e);else if(er(t)){if(o=t.slice(),er(e))for(var i=0,a=e.length;i<a;i++)o.push(Qn(e[i]));else if(rr(e))for(i=0,a=(s=Object.keys(e)).length;i<a;i++){o[u=s[i]]=Qn(e[u])}}else if(rr(t))if(rr(e)){if(!function(t,e){if(!Wn(t)||!Wn(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(or(c))void 0===c?delete o[u]:o[u]=c;else{var l=o[u],p=c;if(tr(t,u,r)||tr(e,u,r))delete o[u];else{if(rr(l)&&rr(p)){var f=r.get(l)||[],h=r.get(p)||[];f.push({obj:t,key:u}),h.push({obj:e,key:u}),r.set(l,f),r.set(p,h)}o[u]=Jn(o[u],c,n,r)}}}}else o=e;return o}}function tr(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 er(t){return Array.isArray(t)}function nr(t){return"function"==typeof t}function rr(t){return!or(t)&&!er(t)&&!nr(t)&&"object"==typeof t}function or(t){return"string"==typeof t||"number"==typeof t||"boolean"==typeof t||void 0===t||t instanceof Date||t instanceof RegExp||null===t}var ir=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)}}(),ar=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return ir(e,t),e}(Error);var sr=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 ur(t,e){return"string"==typeof e?t===e:!!t.match(e)}function cr(t,e){var n,r;if(!e)return!1;try{for(var o=sr(e),i=o.next();!i.done;i=o.next()){if(ur(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 lr=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}(),pr=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},fr=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))},hr=function(){function t(t,e){this._callback=t,this._that=e,this._isCalled=!1,this._deferred=new lr}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,fr([this._that],pr(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 dr={getKeyPairs:re,serializeKeyPairs:ne,parseKeyPairsIntoRecord:function(t){return"string"!=typeof t||0===t.length?{}:t.split(Jt).map((function(t){return oe(t)})).filter((function(t){return void 0!==t&&t.value.length>0})).reduce((function(t,e){return t[e.key]=e.value,t}),{})},parsePairKeyValue:oe},_r={_export:function(t,e){return new Promise((function(n){Nt.with(Wt(Nt.active()),(function(){t.export(e,(function(t){n(t)}))}))}))}},gr=Object.freeze({__proto__:null,AlwaysOffSampler:xn,AlwaysOnSampler:Mn,AnchoredClock:ae,BindOnceFuture:hr,CompositePropagator:Tn,DEFAULT_ATTRIBUTE_COUNT_LIMIT:Re,DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT:Oe,DEFAULT_ENVIRONMENT:Pe,DEFAULT_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT:128,DEFAULT_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT:128,get ExportResultCode(){return sn},ParentBasedSampler:jn,get RPCType(){return Cn},RandomIdGenerator:ze,SDK_INFO:on,TRACE_PARENT_HEADER:Pn,TRACE_STATE_HEADER:Ln,TimeoutError:ar,TraceIdRatioBasedSampler:Un,TraceState:Rn,get TracesSamplerValues(){return de},VERSION:Ge,W3CBaggagePropagator:ie,W3CTraceContextPropagator:Nn,_globalThis:ke,addHrTimes:yn,baggageUtils:dr,callWithTimeout:function(t,e){var n,r=new Promise((function(t,r){n=setTimeout((function(){r(new ar("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(In)},getEnv:De,getEnvWithoutDefaults:xe,getRPCMetadata:function(t){return t.getValue(In)},getTimeOrigin:pn,globalErrorHandler:ge,hexToBase64:function(t){return btoa(String.fromCharCode.apply(String,Be([],Ue(je(t)),!1)))},hexToBinary:je,hrTime:fn,hrTimeDuration:dn,hrTimeToMicroseconds:function(t){return 1e6*t[0]+t[1]/1e3},hrTimeToMilliseconds:function(t){return 1e3*t[0]+t[1]/1e6},hrTimeToNanoseconds:_n,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:_r,isAttributeKey:le,isAttributeValue:pe,isTimeInput:vn,isTimeInputHrTime:gn,isTracingSuppressed:Yt,isUrlIgnored:cr,isWrapped:function(t){return"function"==typeof t&&"function"==typeof t.__original&&"function"==typeof t.__unwrap&&!0===t.__wrapped},loggingErrorHandler:he,merge:$n,millisToHrTime:ln,otperformance:Ve,parseEnvironment:Ie,parseTraceParent:An,sanitizeAttributes:ce,setGlobalErrorHandler:function(t){_e=t},setRPCMetadata:function(t,e){return t.setValue(In,e)},suppressTracing:Wt,timeInputToHrTime:hn,unrefTimer:an,unsuppressTracing:function(t){return t.deleteValue(Kt)},urlMatches:ur});function vr(t){if(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 yr,Er={},Tr={};function mr(){if(yr)return Tr;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 yr=1,Object.defineProperty(Tr,"__esModule",{value:!0}),Tr.toAnyValue=Tr.toKeyValue=Tr.toAttributes=Tr.createInstrumentationScope=Tr.createResource=void 0,Tr.createResource=function(e){return{attributes:t(e.attributes),droppedAttributesCount:0}},Tr.createInstrumentationScope=function(t){return{name:t.name,version:t.version}},Tr.toAttributes=t,Tr.toKeyValue=e,Tr.toAnyValue=n,Tr}var Sr,br,Or={},Rr=vr(gr);function Pr(){if(Sr)return Or;Sr=1,Object.defineProperty(Or,"__esModule",{value:!0}),Or.getOtlpEncoder=Or.encodeAsString=Or.encodeAsLongBits=Or.toLongBits=Or.hrTimeToNanos=void 0;const t=Rr;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()}Or.hrTimeToNanos=e,Or.toLongBits=n,Or.encodeAsLongBits=r,Or.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 Or.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}},Or}function Lr(){if(br)return Er;br=1,Object.defineProperty(Er,"__esModule",{value:!0}),Er.createExportTraceServiceRequest=Er.toOtlpSpanEvent=Er.toOtlpLink=Er.sdkSpanToOtlpSpan=void 0;const t=mr(),e=Pr();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 Er.sdkSpanToOtlpSpan=n,Er.toOtlpLink=r,Er.toOtlpSpanEvent=o,Er.createExportTraceServiceRequest=function(t,n){return{resourceSpans:i(t,(0,e.getOtlpEncoder)(n))}},Er}var wr,Ar=Lr(),Cr={};function Nr(){return wr||(wr=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"}(Cr)),Cr}var Ir=Nr();let kr={};class Dr{constructor(t){this.config=t}export(t,e){const n=Ar.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!==Ir.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})}}}}(n.resourceSpans),e({code:sn.SUCCESS})}shutdown(){return Promise.resolve(void 0)}}class xr{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["session.id"]=n.id,t.attributes.session_id=n.id),this.processor.onStart(t,e)}onEnd(t){this.processor.onEnd(t)}shutdown(){return this.processor.shutdown()}}"function"==typeof SuppressedError&&SuppressedError;var Mr=function(){function t(){}return t.prototype.emit=function(t){},t}(),jr=new Mr,Ur=new(function(){function t(){}return t.prototype.getLogger=function(t,e,n){return new Mr},t}()),Br=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):jr},t}(),zr=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 Br(this,t,e,n)},t.prototype.getDelegate=function(){var t;return null!==(t=this._delegate)&&void 0!==t?t:Ur},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}(),Zr="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{},Hr=Symbol.for("io.opentelemetry.js.api.logs"),Fr=Zr;var Vr,Gr,Xr=function(){function t(){this._proxyLoggerProvider=new zr}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalLoggerProvider=function(t){return Fr[Hr]?this.getLoggerProvider():(Fr[Hr]=(e=1,n=t,r=Ur,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=Fr[Hr])||void 0===t?void 0:t.call(Fr,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 Fr[Hr],this._proxyLoggerProvider=new zr},t}(),qr=Xr.getInstance();var Kr=function(){if(Gr)return Vr;function t(t){return"function"==typeof t}Gr=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")},Vr=r}(),Wr=function(){return Wr=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},Wr.apply(this,arguments)},Yr=function(){function t(t,e,n){this.instrumentationName=t,this.instrumentationVersion=e,this._config={},this._wrap=Kr.wrap,this._unwrap=Kr.unwrap,this._massWrap=Kr.massWrap,this._massUnwrap=Kr.massUnwrap,this.setConfig(n),this._diag=It.createComponentLogger({namespace:t}),this._tracer=qt.getTracer(t,e),this._meter=xt.getMeter(t,e),this._logger=qr.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=Wr({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}(),$r=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)}}(),Qr=function(t){function e(e,n,r){var o=t.call(this,e,n,r)||this;return o._config.enabled&&o.enable(),o}return $r(e,t),e}(Yr);function Jr(t,e,n){var r,o;try{o=t()}catch(t){r=t}finally{return e(r,o),o}}function to(t){return"function"==typeof t&&"function"==typeof t.__original&&"function"==typeof t.__unwrap&&!0===t.__wrapped}var eo,no=function(){return no=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},no.apply(this,arguments)},ro=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.")},oo=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},io=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))},ao=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:Pt.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=Ve.now(),this._performanceOffset=l-(this._performanceStartTime+pn()),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):pe(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=ro(Object.entries(t)),o=r.next();!o.done;o=r.next()){var i=oo(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++),vn(e)&&(vn(n)||(n=e),e=void 0);var r=ce(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,io([],oo(t),!1)),this},t.prototype.setStatus=function(t){return this._isSpanEnded()||(this.status=no({},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=dn(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<=Ve.now())return fn(t+this._performanceOffset);if("number"==typeof t)return ln(t);if(t instanceof Date)return ln(t.getTime());if(gn(t))return t;if(this._startTimeProvided)return ln(Date.now());var e=Ve.now()-this._performanceStartTime;return yn(this.startTime,ln(e))},t.prototype.isRecording=function(){return!1===this._ended},t.prototype.recordException=function(t,e){var n={};"string"==typeof t?n[qe]=t:t&&(t.code?n[Xe]=t.code.toString():t.name&&(n[Xe]=t.name),t.message&&(n[qe]=t.message),t.stack&&(n["exception.stacktrace"]=t.stack)),n[Xe]||n[qe]?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"}(eo||(eo={}));var so=function(){function t(){}return t.prototype.shouldSample=function(){return{decision:eo.NOT_RECORD}},t.prototype.toString=function(){return"AlwaysOffSampler"},t}(),uo=function(){function t(){}return t.prototype.shouldSample=function(){return{decision:eo.RECORD_AND_SAMPLED}},t.prototype.toString=function(){return"AlwaysOnSampler"},t}(),co=function(){function t(t){var e,n,r,o;this._root=t.root,this._root||(ge(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new uo),this._remoteParentSampled=null!==(e=t.remoteParentSampled)&&void 0!==e?e:new uo,this._remoteParentNotSampled=null!==(n=t.remoteParentNotSampled)&&void 0!==n?n:new so,this._localParentSampled=null!==(r=t.localParentSampled)&&void 0!==r?r:new uo,this._localParentNotSampled=null!==(o=t.localParentNotSampled)&&void 0!==o?o:new so}return t.prototype.shouldSample=function(t,e,n,r,o,i){var a=qt.getSpanContext(t);return a&&Tt(a)?a.isRemote?a.traceFlags&w.SAMPLED?this._remoteParentSampled.shouldSample(t,e,n,r,o,i):this._remoteParentNotSampled.shouldSample(t,e,n,r,o,i):a.traceFlags&w.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}(),lo=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?eo.RECORD_AND_SAMPLED:eo.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}(),po=de.AlwaysOn,fo=1;function ho(){var t=De();return{sampler:_o(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 _o(t){switch(void 0===t&&(t=De()),t.OTEL_TRACES_SAMPLER){case de.AlwaysOn:return new uo;case de.AlwaysOff:return new so;case de.ParentBasedAlwaysOn:return new co({root:new uo});case de.ParentBasedAlwaysOff:return new co({root:new so});case de.TraceIdRatio:return new lo(go(t));case de.ParentBasedTraceIdRatio:return new co({root:new lo(go(t))});default:return It.error('OTEL_TRACES_SAMPLER value "'+t.OTEL_TRACES_SAMPLER+" invalid, defaulting to "+po+'".'),new uo}}function go(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 "+fo+"."),fo;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 "+fo+"."),fo):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 "+fo+"."),fo):e}var vo=function(){function t(t,e){this._exporter=t,this._isExporting=!1,this._finishedSpans=[],this._droppedSpansCount=0;var n=De();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 hr(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&w.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(Wt(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===sn.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){ge(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,ge(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}(),yo=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)}}(),Eo=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.onInit(n),r}return yo(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){ge(t)}))},this._pageHideListener=function(){e.forceFlush().catch((function(t){ge(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}(vo),To=function(){this.generateTraceId=So(16),this.generateSpanId=So(8)},mo=Array(32);function So(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 bo=function(){function t(t,e,n){this._tracerProvider=n;var r,o,i,a,s=(r=e,o={sampler:_o()},i=ho(),(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 To,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(Yt(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,h=(null!==(o=e.links)&&void 0!==o?o:[]).map((function(t){return{context:t.context,attributes:ce(t.attributes)}})),d=ce(e.attributes),_=this._sampler.shouldSample(n,s,t,f,d,h);u=null!==(i=_.traceState)&&void 0!==i?i:u;var g={traceId:s,spanId:p,traceFlags:_.decision===Ot.RECORD_AND_SAMPLED?w.SAMPLED:w.NONE,traceState:u};if(_.decision===Ot.NOT_RECORD)return It.debug("Recording is off, propagating context in a non-recording span"),qt.wrapSpanContext(g);var v=ce(Object.assign(d,_.attributes));return new ao(this,n,t,g,f,c,h,e.startTime,void 0,v)},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 Oo,Ro=function(){return Ro=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},Ro.apply(this,arguments)},Po=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())}))},Lo=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])}}},wo=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},Ao=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[nn]=on[nn],e[en]=on[en],e[rn]=on[rn],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 Po(this,void 0,void 0,(function(){return Lo(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=Ro(Ro({},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=wo(t,2),i=o[0],a=o[1];return Ro(Ro(Ro(Ro({},r._syncAttributes),i),null!==(n=e._syncAttributes)&&void 0!==n?n:e.attributes),a)}));return new t(o,i)},t.EMPTY=new t({}),t}(),Co=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.")},No=function(){function t(t){this._spanProcessors=t}return t.prototype.forceFlush=function(){var t,e,n=[];try{for(var r=Co(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){ge(e||new Error("MultiSpanProcessor: forceFlush failed")),t()}))}))},t.prototype.onStart=function(t,e){var n,r;try{for(var o=Co(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=Co(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=Co(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}(),Io=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},Do=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"}(Oo||(Oo={}));var xo,Mo,jo,Uo=function(){function t(t){var e,n;void 0===t&&(t={}),this._registeredSpanProcessors=[],this._tracers=new Map;var r=$n({},ho(),function(t){var e,n,r,o,i,a,s,u,c,l,p,f,h=Object.assign({},t.spanLimits),d=xe();return h.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:d.OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT)&&void 0!==i?i:d.OTEL_ATTRIBUTE_COUNT_LIMIT)&&void 0!==a?a:Re,h.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:d.OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT)&&void 0!==p?p:d.OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT)&&void 0!==f?f:Oe,Object.assign({},t,{spanLimits:h})}(t));if(this.resource=null!==(e=r.resource)&&void 0!==e?e:Ao.empty(),r.mergeResourceWithDefaults&&(this.resource=Ao.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=Do([],ko(t.spanProcessors),!1),this.activeSpanProcessor=new No(this._registeredSpanProcessors);else{var o=this._buildExporterFromEnv();if(void 0!==o){var i=new Eo(o);this.activeSpanProcessor=i}else this.activeSpanProcessor=new Io}}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 bo({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 No(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&&Gt.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=Oo.timeout}),t);e.forceFlush().then((function(){clearTimeout(o),r!==Oo.timeout&&(r=Oo.resolved,n(r))})).catch((function(t){clearTimeout(o),r=Oo.error,n(t)}))}))}));return new Promise((function(t,n){Promise.all(e).then((function(e){var r=e.filter((function(t){return t!==Oo.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(De().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 Tn({propagators:n})},t.prototype._buildExporterFromEnv=function(){var t=De().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 Nn}],["baggage",function(){return new ie}]]),t._registeredExporters=new Map,t}(),Bo=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},zo=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))},Zo=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,zo([n],Bo(r),!1))}finally{this._currentContext=i}},t}(),Ho=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)}}(),Fo=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 Ho(e,t),e.prototype.register=function(e){void 0===e&&(e={}),void 0===e.contextManager&&(e.contextManager=new Zo),e.contextManager&&e.contextManager.enable(),t.prototype.register.call(this,e)},e}(Uo);function Vo(t,e){return e in t}function Go(t,e,n,r){var o=void 0,i=void 0;Vo(n,e)&&"number"==typeof n[e]&&(o=n[e]);var a=xo.FETCH_START;if(Vo(n,a)&&"number"==typeof n[a]&&(i=n[a]),void 0!==o&&void 0!==i&&o>=i)return t.addEvent(e,o),t}function Xo(t,e,n){void 0===n&&(n=!1),n||(Go(t,xo.FETCH_START,e),Go(t,xo.DOMAIN_LOOKUP_START,e),Go(t,xo.DOMAIN_LOOKUP_END,e),Go(t,xo.CONNECT_START,e),Vo(e,"name")&&e.name.startsWith("https:")&&Go(t,xo.SECURE_CONNECTION_START,e),Go(t,xo.CONNECT_END,e),Go(t,xo.REQUEST_START,e),Go(t,xo.RESPONSE_START,e),Go(t,xo.RESPONSE_END,e));var r=e[xo.ENCODED_BODY_SIZE];void 0!==r&&t.setAttribute("http.response_content_length",r);var o=e[xo.DECODED_BODY_SIZE];void 0!==o&&r!==o&&t.setAttribute("http.response_content_length_uncompressed",o)}function qo(){return"undefined"!=typeof location?location.origin:void 0}function Ko(t,e,n,r,o,i){void 0===o&&(o=new WeakSet);var a=Wo(t),s=function(t,e,n,r,o,i){var a=_n(e),s=_n(n),u=r.filter((function(e){var n=_n(hn(e[xo.FETCH_START])),r=_n(hn(e[xo.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[xo.FETCH_START],r=e[xo.FETCH_START];return n>r?1:n<r?-1:0}))}(s);if(a.origin!==qo()&&u.length>1){var c=u[0],l=function(t,e,n){for(var r,o=_n(n),i=_n(hn(e)),a=t[1],s=t.length,u=1;u<s;u++){var c=t[u],l=_n(hn(c[xo.FETCH_START])),p=o-_n(hn(c[xo.RESPONSE_END]));l>=i&&(!r||p<r)&&(r=p,a=c)}return a}(u,c[xo.RESPONSE_END],n),p=c[xo.RESPONSE_END];return l[xo.FETCH_START]<p&&(l=c,c=void 0),{corsPreFlightRequest:c,mainRequest:l}}return{mainRequest:s[0]}}function Wo(t){if("function"==typeof URL)return new URL(t,"undefined"!=typeof document?document.baseURI:"undefined"!=typeof location?location.href:void 0);var e=(Mo||(Mo=document.createElement("a")),Mo);return e.href=t,e}function Yo(t,e){var n=e||[];return("string"==typeof n||n instanceof RegExp)&&(n=[n]),Wo(t).origin===qo()||n.some((function(e){return ur(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"}(xo||(xo={})),function(t){t.COMPONENT="component",t.HTTP_ERROR_NAME="http.error_name",t.HTTP_STATUS_TEXT="http.status_text"}(jo||(jo={}));var $o=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())}))},Qo=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])}}},Jo=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.")},ti=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},ei=It.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-fetch/utils"});function ni(){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 ei.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 $o(this,void 0,void 0,(function(){var r;return Qo(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=Jo(t.entries()),i=o.next();!i.done;i=o.next()){var a=ti(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 oi(t.toString());if("string"==typeof t)return oi(t);return void ei.warn("unknown body type")}(n.body))}var a=t[0];return(null==a?void 0:a.body)?a.clone().text().then((function(t){return oi(t)})):Promise.resolve()}var ri=new TextEncoder;function oi(t){return ri.encode(t).byteLength}var ii,ai,si="0.57.1",ui=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)}}(),ci=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},li=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))},pi="object"==typeof process&&"node"===(null===(ii=process.release)||void 0===ii?void 0:ii.name),fi=function(t){function e(e){void 0===e&&(e={});var n=t.call(this,"@opentelemetry/instrumentation-fetch",si,e)||this;return n.component="fetch",n.version=si,n.moduleName=n.component,n._usedResources=new WeakSet,n._tasksCount=0,n}return ui(e,t),e.prototype.init=function(){},e.prototype._addChildSpan=function(t,e){var n=this.tracer.startSpan("CORS Preflight",{startTime:e[xo.FETCH_START]},qt.setSpan(Nt.active(),t));Xo(n,e,this.getConfig().ignoreNetworkEvents),n.end(e[xo.RESPONSE_END])},e.prototype._addFinalSpanAttributes=function(t,e){var n=Wo(e.url);t.setAttribute(Qe,e.status),null!=e.statusText&&t.setAttribute(jo.HTTP_STATUS_TEXT,e.statusText),t.setAttribute(Ye,n.host),t.setAttribute($e,n.protocol.replace(":","")),"undefined"!=typeof navigator&&t.setAttribute(Je,navigator.userAgent)},e.prototype._addHeaders=function(t,e){if(!Yo(e,this.getConfig().propagateTraceHeaderCorsUrls)){var n={};return Gt.inject(Nt.active(),n),void(Object.keys(n).length>0&&this._diag.debug("headers inject skipped due to CORS policy"))}if(t instanceof Request)Gt.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)Gt.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)Gt.inject(Nt.active(),t.headers,{set:function(t,e,n){return t.set(e,"string"==typeof n?n:String(n))}});else{n={};Gt.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={}),!cr(t,this.getConfig().ignoreUrls)){var r=(e.method||"GET").toUpperCase(),o="HTTP "+r;return this.tracer.startSpan(o,{kind:Rt.CLIENT,attributes:(n={},n[jo.COMPONENT]=this.moduleName,n[Ke]=r,n[We]=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=Ko(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)),Xo(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=ln(Date.now()),i=fn();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=Wo(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&&ni.apply(void 0,li([],ci(t),!1)).then((function(t){t&&s.setAttribute(tn,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&&Jr((function(){return o(t,e,n)}),(function(t){t&&r._diag.error("applyCustomAttributesOnSpan",t)}))},e.prototype._prepareSpanData=function(t){var e=fn(),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(){pi?this._diag.warn("this instrumentation is intended for web usage only, it does not instrument Node.js's fetch()"):(to(fetch)&&(this._unwrap(ke,"fetch"),this._diag.debug("removing previous patch for constructor")),this._wrap(ke,"fetch",this._patchConstructor()))},e.prototype.disable=function(){pi||(this._unwrap(ke,"fetch"),this._usedResources=new WeakSet)},e}(Qr);!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"}(ai||(ai={}));var hi=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},_i=It.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils"});function gi(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=hi(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):t instanceof URLSearchParams?yi(t.toString()):"string"==typeof t?yi(t):void _i.warn("unknown body type")}var vi=new TextEncoder;function yi(t){return vi.encode(t).byteLength}var Ei,Ti="0.57.1";!function(t){t.HTTP_STATUS_TEXT="http.status_text"}(Ei||(Ei={}));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)}}(),Si=function(t){function e(e){void 0===e&&(e={});var n=t.call(this,"@opentelemetry/instrumentation-xml-http-request",Ti,e)||this;return n.component="xml-http-request",n.version=Ti,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(!Yo(Wo(e).href,this.getConfig().propagateTraceHeaderCorsUrls)){var n={};return Gt.inject(Nt.active(),n),void(Object.keys(n).length>0&&this._diag.debug("headers inject skipped due to CORS policy"))}var r={};Gt.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[xo.FETCH_START]});Xo(t,e,n.getConfig().ignoreNetworkEvents),t.end(e[xo.RESPONSE_END])}))},e.prototype._addFinalSpanAttributes=function(t,e,n){if("string"==typeof n){var r=Wo(n);void 0!==e.status&&t.setAttribute(Qe,e.status),void 0!==e.statusText&&t.setAttribute(Ei.HTTP_STATUS_TEXT,e.statusText),t.setAttribute(Ye,r.host),t.setAttribute($e,r.protocol.replace(":","")),t.setAttribute(Je,navigator.userAgent)}},e.prototype._applyAttributesAfterXHR=function(t,e){var n=this,r=this.getConfig().applyCustomAttributesOnSpan;"function"==typeof r&&Jr((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=Wo(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&&(Ve.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=Ve.getEntriesByType("resource"));var a=Ko(Wo(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)),Xo(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(!cr(e,this.getConfig().ignoreUrls)){var o=n.toUpperCase(),i=this.tracer.startSpan(o,{kind:Rt.CLIENT,attributes:(r={},r[Ke]=n,r[We]=Wo(e).toString(),r)});return i.addEvent(ai.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=fn(),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(ai.EVENT_ERROR,this)}function r(){e(ai.EVENT_ABORT,this)}function o(){e(ai.EVENT_TIMEOUT,this)}function i(){this.status<299?e(ai.EVENT_LOAD,this):e(ai.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=gi(s[0]);void 0!==f&&l.setAttribute(tn,f)}Nt.with(qt.setSpan(Nt.active(),l),(function(){t._tasksCount++,c.sendStartTime=fn(),l.addEvent(ai.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),to(XMLHttpRequest.prototype.open)&&(this._unwrap(XMLHttpRequest.prototype,"open"),this._diag.debug("removing previous patch from method open")),to(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}(Qr);class bi extends Si{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 Oi(t,e,n){Ri(t,n instanceof Error?0:n.status)}function Ri(t,e){if(null==e)return;(0===e||e>=400&&e<600)&&t.setStatus({code:Pt.ERROR})}function Pi(t){return(e,n,r)=>{Oi(e,0,r),null==t||t(e,n,r)}}function Li(t){return(e,n)=>{!function(t,e){Ri(t,e.status)}(e,n),null==t||t(e,n)}}function wi(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:Pi(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:Li(null==t?void 0:t.applyCustomAttributesOnSpan)})}(n,r);return[new fi(o),new bi(i)]}var Ai,Ci="OT_ZONE_CONTEXT",Ni=function(){function t(){this._enabled=!1,this._zoneCounter=0}return t.prototype._activeContextFromZone=function(t){return t&&t.get(Ci)||C},t.prototype._bindFunction=function(t,e){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._bindListener=function(t,e){var n=e;return void 0!==n.__ot_listeners||(n.__ot_listeners={},"function"==typeof n.addEventListener&&(n.addEventListener=this._patchAddEventListener(n,n.addEventListener,t)),"function"==typeof n.removeEventListener&&(n.removeEventListener=this._patchRemoveEventListener(n,n.removeEventListener))),e},t.prototype._createZoneName=function(){this._zoneCounter++;var t=Math.random();return this._zoneCounter+"-"+t},t.prototype._createZone=function(t,e){var n;return Zone.current.fork({name:t,properties:(n={},n[Ci]=e,n)})},t.prototype._getActiveZone=function(){return Zone.current},t.prototype._patchAddEventListener=function(t,e,n){var r=this;return function(o,i,a){void 0===t.__ot_listeners&&(t.__ot_listeners={});var s=t.__ot_listeners[o];void 0===s&&(s=new WeakMap,t.__ot_listeners[o]=s);var u=r.bind(n,i);return s.set(i,u),e.call(this,o,u,a)}},t.prototype._patchRemoveEventListener=function(t,e){return function(n,r){if(void 0===t.__ot_listeners||void 0===t.__ot_listeners[n])return e.call(this,n,r);var o=t.__ot_listeners[n],i=o.get(r);return o.delete(r),e.call(this,n,i||r)}},t.prototype.active=function(){if(!this._enabled)return C;var t=this._getActiveZone(),e=this._activeContextFromZone(t);return e||C},t.prototype.bind=function(t,e){return void 0===t&&(t=this.active()),"function"==typeof e?this._bindFunction(t,e):(void 0===(n=e)&&(n={}),"function"==typeof n.addEventListener&&"function"==typeof n.removeEventListener&&this._bindListener(t,e),e);var n},t.prototype.disable=function(){return this._enabled=!1,this},t.prototype.enable=function(){return this._enabled=!0,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._createZoneName();return this._createZone(i,t).run(e,n,r)},t}(),Ii={};function ki(t={}){var e;return"true"===(null===(e=t.attributes)||void 0===e?void 0:e.isSampled)?eo.RECORD_AND_SAMPLED:eo.NOT_RECORD}!function(){if(Ai)return Ii;Ai=1;
2
- /**
3
- * @license Angular v<unknown>
4
- * (c) 2010-2024 Google LLC. https://angular.io/
5
- * License: MIT
6
- */
7
- const t=globalThis;function e(e){return(t.__Zone_symbol_prefix||"__zone_symbol__")+e}function n(){const n=t.performance;function r(t){n&&n.mark&&n.mark(t)}function o(t,e){n&&n.measure&&n.measure(t,e)}r("Zone");class i{static{this.__symbol__=e}static assertZonePatched(){if(t.Promise!==w.ZoneAwarePromise)throw new Error("Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.\nMost likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)")}static get root(){let t=i.current;for(;t.parent;)t=t.parent;return t}static get current(){return C.zone}static get currentTask(){return N}static __load_patch(n,a,s=!1){if(w.hasOwnProperty(n)){const r=!0===t[e("forceDuplicateZoneCheck")];if(!s&&r)throw Error("Already loaded patch: "+n)}else if(!t["__Zone_disable_"+n]){const e="Zone:"+n;r(e),w[n]=a(t,i,A),o(e,e)}}get parent(){return this._parent}get name(){return this._name}constructor(t,e){this._parent=t,this._name=e?e.name||"unnamed":"<root>",this._properties=e&&e.properties||{},this._zoneDelegate=new s(this,this._parent&&this._parent._zoneDelegate,e)}get(t){const e=this.getZoneWith(t);if(e)return e._properties[t]}getZoneWith(t){let e=this;for(;e;){if(e._properties.hasOwnProperty(t))return e;e=e._parent}return null}fork(t){if(!t)throw new Error("ZoneSpec required!");return this._zoneDelegate.fork(this,t)}wrap(t,e){if("function"!=typeof t)throw new Error("Expecting function got: "+t);const n=this._zoneDelegate.intercept(this,t,e),r=this;return function(){return r.runGuarded(n,this,arguments,e)}}run(t,e,n,r){C={parent:C,zone:this};try{return this._zoneDelegate.invoke(this,t,e,n,r)}finally{C=C.parent}}runGuarded(t,e=null,n,r){C={parent:C,zone:this};try{try{return this._zoneDelegate.invoke(this,t,e,n,r)}catch(t){if(this._zoneDelegate.handleError(this,t))throw t}}finally{C=C.parent}}runTask(t,e,n){if(t.zone!=this)throw new Error("A task can only be run in the zone of creation! (Creation: "+(t.zone||y).name+"; Execution: "+this.name+")");const r=t,{type:o,data:{isPeriodic:i=!1,isRefreshable:a=!1}={}}=t;if(t.state===E&&(o===L||o===P))return;const s=t.state!=S;s&&r._transitionTo(S,m);const u=N;N=r,C={parent:C,zone:this};try{o!=P||!t.data||i||a||(t.cancelFn=void 0);try{return this._zoneDelegate.invokeTask(this,r,e,n)}catch(t){if(this._zoneDelegate.handleError(this,t))throw t}}finally{const e=t.state;if(e!==E&&e!==O)if(o==L||i||a&&e===T)s&&r._transitionTo(m,S,T);else{const t=r._zoneDelegates;this._updateTaskCount(r,-1),s&&r._transitionTo(E,S,E),a&&(r._zoneDelegates=t)}C=C.parent,N=u}}scheduleTask(t){if(t.zone&&t.zone!==this){let e=this;for(;e;){if(e===t.zone)throw Error(`can not reschedule task to ${this.name} which is descendants of the original zone ${t.zone.name}`);e=e.parent}}t._transitionTo(T,E);const e=[];t._zoneDelegates=e,t._zone=this;try{t=this._zoneDelegate.scheduleTask(this,t)}catch(e){throw t._transitionTo(O,T,E),this._zoneDelegate.handleError(this,e),e}return t._zoneDelegates===e&&this._updateTaskCount(t,1),t.state==T&&t._transitionTo(m,T),t}scheduleMicroTask(t,e,n,r){return this.scheduleTask(new u(R,t,e,n,r,void 0))}scheduleMacroTask(t,e,n,r,o){return this.scheduleTask(new u(P,t,e,n,r,o))}scheduleEventTask(t,e,n,r,o){return this.scheduleTask(new u(L,t,e,n,r,o))}cancelTask(t){if(t.zone!=this)throw new Error("A task can only be cancelled in the zone of creation! (Creation: "+(t.zone||y).name+"; Execution: "+this.name+")");if(t.state===m||t.state===S){t._transitionTo(b,m,S);try{this._zoneDelegate.cancelTask(this,t)}catch(e){throw t._transitionTo(O,b),this._zoneDelegate.handleError(this,e),e}return this._updateTaskCount(t,-1),t._transitionTo(E,b),t.runCount=-1,t}}_updateTaskCount(t,e){const n=t._zoneDelegates;-1==e&&(t._zoneDelegates=null);for(let r=0;r<n.length;r++)n[r]._updateTaskCount(t.type,e)}}const a={name:"",onHasTask:(t,e,n,r)=>t.hasTask(n,r),onScheduleTask:(t,e,n,r)=>t.scheduleTask(n,r),onInvokeTask:(t,e,n,r,o,i)=>t.invokeTask(n,r,o,i),onCancelTask:(t,e,n,r)=>t.cancelTask(n,r)};class s{get zone(){return this._zone}constructor(t,e,n){this._taskCounts={microTask:0,macroTask:0,eventTask:0},this._zone=t,this._parentDelegate=e,this._forkZS=n&&(n&&n.onFork?n:e._forkZS),this._forkDlgt=n&&(n.onFork?e:e._forkDlgt),this._forkCurrZone=n&&(n.onFork?this._zone:e._forkCurrZone),this._interceptZS=n&&(n.onIntercept?n:e._interceptZS),this._interceptDlgt=n&&(n.onIntercept?e:e._interceptDlgt),this._interceptCurrZone=n&&(n.onIntercept?this._zone:e._interceptCurrZone),this._invokeZS=n&&(n.onInvoke?n:e._invokeZS),this._invokeDlgt=n&&(n.onInvoke?e:e._invokeDlgt),this._invokeCurrZone=n&&(n.onInvoke?this._zone:e._invokeCurrZone),this._handleErrorZS=n&&(n.onHandleError?n:e._handleErrorZS),this._handleErrorDlgt=n&&(n.onHandleError?e:e._handleErrorDlgt),this._handleErrorCurrZone=n&&(n.onHandleError?this._zone:e._handleErrorCurrZone),this._scheduleTaskZS=n&&(n.onScheduleTask?n:e._scheduleTaskZS),this._scheduleTaskDlgt=n&&(n.onScheduleTask?e:e._scheduleTaskDlgt),this._scheduleTaskCurrZone=n&&(n.onScheduleTask?this._zone:e._scheduleTaskCurrZone),this._invokeTaskZS=n&&(n.onInvokeTask?n:e._invokeTaskZS),this._invokeTaskDlgt=n&&(n.onInvokeTask?e:e._invokeTaskDlgt),this._invokeTaskCurrZone=n&&(n.onInvokeTask?this._zone:e._invokeTaskCurrZone),this._cancelTaskZS=n&&(n.onCancelTask?n:e._cancelTaskZS),this._cancelTaskDlgt=n&&(n.onCancelTask?e:e._cancelTaskDlgt),this._cancelTaskCurrZone=n&&(n.onCancelTask?this._zone:e._cancelTaskCurrZone),this._hasTaskZS=null,this._hasTaskDlgt=null,this._hasTaskDlgtOwner=null,this._hasTaskCurrZone=null;const r=n&&n.onHasTask,o=e&&e._hasTaskZS;(r||o)&&(this._hasTaskZS=r?n:a,this._hasTaskDlgt=e,this._hasTaskDlgtOwner=this,this._hasTaskCurrZone=this._zone,n.onScheduleTask||(this._scheduleTaskZS=a,this._scheduleTaskDlgt=e,this._scheduleTaskCurrZone=this._zone),n.onInvokeTask||(this._invokeTaskZS=a,this._invokeTaskDlgt=e,this._invokeTaskCurrZone=this._zone),n.onCancelTask||(this._cancelTaskZS=a,this._cancelTaskDlgt=e,this._cancelTaskCurrZone=this._zone))}fork(t,e){return this._forkZS?this._forkZS.onFork(this._forkDlgt,this.zone,t,e):new i(t,e)}intercept(t,e,n){return this._interceptZS?this._interceptZS.onIntercept(this._interceptDlgt,this._interceptCurrZone,t,e,n):e}invoke(t,e,n,r,o){return this._invokeZS?this._invokeZS.onInvoke(this._invokeDlgt,this._invokeCurrZone,t,e,n,r,o):e.apply(n,r)}handleError(t,e){return!this._handleErrorZS||this._handleErrorZS.onHandleError(this._handleErrorDlgt,this._handleErrorCurrZone,t,e)}scheduleTask(t,e){let n=e;if(this._scheduleTaskZS)this._hasTaskZS&&n._zoneDelegates.push(this._hasTaskDlgtOwner),n=this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt,this._scheduleTaskCurrZone,t,e),n||(n=e);else if(e.scheduleFn)e.scheduleFn(e);else{if(e.type!=R)throw new Error("Task is missing scheduleFn.");g(e)}return n}invokeTask(t,e,n,r){return this._invokeTaskZS?this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt,this._invokeTaskCurrZone,t,e,n,r):e.callback.apply(n,r)}cancelTask(t,e){let n;if(this._cancelTaskZS)n=this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt,this._cancelTaskCurrZone,t,e);else{if(!e.cancelFn)throw Error("Task is not cancelable");n=e.cancelFn(e)}return n}hasTask(t,e){try{this._hasTaskZS&&this._hasTaskZS.onHasTask(this._hasTaskDlgt,this._hasTaskCurrZone,t,e)}catch(e){this.handleError(t,e)}}_updateTaskCount(t,e){const n=this._taskCounts,r=n[t],o=n[t]=r+e;if(o<0)throw new Error("More tasks executed then were scheduled.");if(0==r||0==o){const e={microTask:n.microTask>0,macroTask:n.macroTask>0,eventTask:n.eventTask>0,change:t};this.hasTask(this._zone,e)}}}class u{constructor(e,n,r,o,i,a){if(this._zone=null,this.runCount=0,this._zoneDelegates=null,this._state="notScheduled",this.type=e,this.source=n,this.data=o,this.scheduleFn=i,this.cancelFn=a,!r)throw new Error("callback is not defined");this.callback=r;const s=this;e===L&&o&&o.useG?this.invoke=u.invokeTask:this.invoke=function(){return u.invokeTask.call(t,s,this,arguments)}}static invokeTask(t,e,n){t||(t=this),I++;try{return t.runCount++,t.zone.runTask(t,e,n)}finally{1==I&&v(),I--}}get zone(){return this._zone}get state(){return this._state}cancelScheduleRequest(){this._transitionTo(E,T)}_transitionTo(t,e,n){if(this._state!==e&&this._state!==n)throw new Error(`${this.type} '${this.source}': can not transition to '${t}', expecting state '${e}'${n?" or '"+n+"'":""}, was '${this._state}'.`);this._state=t,t==E&&(this._zoneDelegates=null)}toString(){return this.data&&void 0!==this.data.handleId?this.data.handleId.toString():Object.prototype.toString.call(this)}toJSON(){return{type:this.type,state:this.state,source:this.source,zone:this.zone.name,runCount:this.runCount}}}const c=e("setTimeout"),l=e("Promise"),p=e("then");let f,h=[],d=!1;function _(e){if(f||t[l]&&(f=t[l].resolve(0)),f){let t=f[p];t||(t=f.then),t.call(f,e)}else t[c](e,0)}function g(t){0===I&&0===h.length&&_(v),t&&h.push(t)}function v(){if(!d){for(d=!0;h.length;){const t=h;h=[];for(let e=0;e<t.length;e++){const n=t[e];try{n.zone.runTask(n,null,null)}catch(t){A.onUnhandledError(t)}}}A.microtaskDrainDone(),d=!1}}const y={name:"NO ZONE"},E="notScheduled",T="scheduling",m="scheduled",S="running",b="canceling",O="unknown",R="microTask",P="macroTask",L="eventTask",w={},A={symbol:e,currentZoneFrame:()=>C,onUnhandledError:k,microtaskDrainDone:k,scheduleMicroTask:g,showUncaughtError:()=>!i[e("ignoreConsoleErrorUncaughtError")],patchEventTarget:()=>[],patchOnProperties:k,patchMethod:()=>k,bindArguments:()=>[],patchThen:()=>k,patchMacroTask:()=>k,patchEventPrototype:()=>k,isIEOrEdge:()=>!1,getGlobalObjects:()=>{},ObjectDefineProperty:()=>k,ObjectGetOwnPropertyDescriptor:()=>{},ObjectCreate:()=>{},ArraySlice:()=>[],patchClass:()=>k,wrapWithCurrentZone:()=>k,filterProperties:()=>[],attachOriginToPatched:()=>k,_redefineProperty:()=>k,patchCallbacks:()=>k,nativeScheduleMicroTask:_};let C={parent:null,zone:new i(null,null)},N=null,I=0;function k(){}return o("Zone","Zone"),i}const r=Object.getOwnPropertyDescriptor,o=Object.defineProperty,i=Object.getPrototypeOf,a=Object.create,s=Array.prototype.slice,u="addEventListener",c="removeEventListener",l=e(u),p=e(c),f="true",h="false",d=e("");function _(t,e){return Zone.current.wrap(t,e)}function g(t,e,n,r,o){return Zone.current.scheduleMacroTask(t,e,n,r,o)}const v=e,y="undefined"!=typeof window,E=y?window:void 0,T=y&&E||globalThis,m="removeAttribute";function S(t,e){for(let n=t.length-1;n>=0;n--)"function"==typeof t[n]&&(t[n]=_(t[n],e+"_"+n));return t}function b(t){return!t||!1!==t.writable&&!("function"==typeof t.get&&void 0===t.set)}const O="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,R=!("nw"in T)&&void 0!==T.process&&"[object process]"===T.process.toString(),P=!R&&!O&&!(!y||!E.HTMLElement),L=void 0!==T.process&&"[object process]"===T.process.toString()&&!O&&!(!y||!E.HTMLElement),w={},A=v("enable_beforeunload"),C=function(t){if(!(t=t||T.event))return;let e=w[t.type];e||(e=w[t.type]=v("ON_PROPERTY"+t.type));const n=this||t.target||T,r=n[e];let o;if(P&&n===E&&"error"===t.type){const e=t;o=r&&r.call(this,e.message,e.filename,e.lineno,e.colno,e.error),!0===o&&t.preventDefault()}else o=r&&r.apply(this,arguments),"beforeunload"===t.type&&T[A]&&"string"==typeof o?t.returnValue=o:null==o||o||t.preventDefault();return o};function N(t,e,n){let i=r(t,e);if(!i&&n){r(n,e)&&(i={enumerable:!0,configurable:!0})}if(!i||!i.configurable)return;const a=v("on"+e+"patched");if(t.hasOwnProperty(a)&&t[a])return;delete i.writable,delete i.value;const s=i.get,u=i.set,c=e.slice(2);let l=w[c];l||(l=w[c]=v("ON_PROPERTY"+c)),i.set=function(e){let n=this;if(n||t!==T||(n=T),!n)return;"function"==typeof n[l]&&n.removeEventListener(c,C),u&&u.call(n,null),n[l]=e,"function"==typeof e&&n.addEventListener(c,C,!1)},i.get=function(){let n=this;if(n||t!==T||(n=T),!n)return null;const r=n[l];if(r)return r;if(s){let t=s.call(this);if(t)return i.set.call(this,t),"function"==typeof n[m]&&n.removeAttribute(e),t}return null},o(t,e,i),t[a]=!0}function I(t,e,n){if(e)for(let r=0;r<e.length;r++)N(t,"on"+e[r],n);else{const e=[];for(const n in t)"on"==n.slice(0,2)&&e.push(n);for(let r=0;r<e.length;r++)N(t,e[r],n)}}const k=v("originalInstance");function D(t){const e=T[t];if(!e)return;T[v(t)]=e,T[t]=function(){const n=S(arguments,t);switch(n.length){case 0:this[k]=new e;break;case 1:this[k]=new e(n[0]);break;case 2:this[k]=new e(n[0],n[1]);break;case 3:this[k]=new e(n[0],n[1],n[2]);break;case 4:this[k]=new e(n[0],n[1],n[2],n[3]);break;default:throw new Error("Arg list too long.")}},j(T[t],e);const n=new e((function(){}));let r;for(r in n)"XMLHttpRequest"===t&&"responseBlob"===r||function(e){"function"==typeof n[e]?T[t].prototype[e]=function(){return this[k][e].apply(this[k],arguments)}:o(T[t].prototype,e,{set:function(n){"function"==typeof n?(this[k][e]=_(n,t+"."+e),j(this[k][e],n)):this[k][e]=n},get:function(){return this[k][e]}})}(r);for(r in e)"prototype"!==r&&e.hasOwnProperty(r)&&(T[t][r]=e[r])}function x(t,e,n){let o=t;for(;o&&!o.hasOwnProperty(e);)o=i(o);!o&&t[e]&&(o=t);const a=v(e);let s=null;if(o&&(!(s=o[a])||!o.hasOwnProperty(a))){s=o[a]=o[e];if(b(o&&r(o,e))){const t=n(s,a,e);o[e]=function(){return t(this,arguments)},j(o[e],s)}}return s}function M(t,e,n){let r=null;function o(t){const e=t.data;return e.args[e.cbIdx]=function(){t.invoke.apply(this,arguments)},r.apply(e.target,e.args),t}r=x(t,e,(t=>function(e,r){const i=n(e,r);return i.cbIdx>=0&&"function"==typeof r[i.cbIdx]?g(i.name,r[i.cbIdx],i,o):t.apply(e,r)}))}function j(t,e){t[v("OriginalDelegate")]=e}let U=!1,B=!1;function z(){try{const t=E.navigator.userAgent;if(-1!==t.indexOf("MSIE ")||-1!==t.indexOf("Trident/"))return!0}catch(t){}return!1}function Z(){if(U)return B;U=!0;try{const t=E.navigator.userAgent;-1===t.indexOf("MSIE ")&&-1===t.indexOf("Trident/")&&-1===t.indexOf("Edge/")||(B=!0)}catch(t){}return B}function H(t){return"function"==typeof t}function F(t){return"number"==typeof t}let V=!1;if("undefined"!=typeof window)try{const t=Object.defineProperty({},"passive",{get:function(){V=!0}});window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(t){V=!1}const G={useG:!0},X={},q={},K=new RegExp("^"+d+"(\\w+)(true|false)$"),W=v("propagationStopped");function Y(t,e){const n=(e?e(t):t)+h,r=(e?e(t):t)+f,o=d+n,i=d+r;X[t]={},X[t][h]=o,X[t][f]=i}function $(t,e,n,r){const o=r&&r.add||u,a=r&&r.rm||c,s=r&&r.listeners||"eventListeners",l=r&&r.rmAll||"removeAllListeners",p=v(o),_="."+o+":",g="prependListener",y="."+g+":",E=function(t,e,n){if(t.isRemoved)return;const r=t.callback;let o;"object"==typeof r&&r.handleEvent&&(t.callback=t=>r.handleEvent(t),t.originalDelegate=r);try{t.invoke(t,e,[n])}catch(t){o=t}const i=t.options;if(i&&"object"==typeof i&&i.once){const r=t.originalDelegate?t.originalDelegate:t.callback;e[a].call(e,n.type,r,i)}return o};function T(n,r,o){if(!(r=r||t.event))return;const i=n||r.target||t,a=i[X[r.type][o?f:h]];if(a){const t=[];if(1===a.length){const e=E(a[0],i,r);e&&t.push(e)}else{const e=a.slice();for(let n=0;n<e.length&&(!r||!0!==r[W]);n++){const o=E(e[n],i,r);o&&t.push(o)}}if(1===t.length)throw t[0];for(let n=0;n<t.length;n++){const r=t[n];e.nativeScheduleMicroTask((()=>{throw r}))}}}const m=function(t){return T(this,t,!1)},S=function(t){return T(this,t,!0)};function b(e,n){if(!e)return!1;let r=!0;n&&void 0!==n.useG&&(r=n.useG);const u=n&&n.vh;let c=!0;n&&void 0!==n.chkDup&&(c=n.chkDup);let E=!1;n&&void 0!==n.rt&&(E=n.rt);let T=e;for(;T&&!T.hasOwnProperty(o);)T=i(T);if(!T&&e[o]&&(T=e),!T)return!1;if(T[p])return!1;const b=n&&n.eventNameToString,O={},P=T[p]=T[o],L=T[v(a)]=T[a],w=T[v(s)]=T[s],A=T[v(l)]=T[l];let C;n&&n.prepend&&(C=T[v(n.prepend)]=T[n.prepend]);const N=function(t){return C.call(O.target,O.eventName,t.invoke,O.options)},I=r?function(t){if(!O.isExisting)return P.call(O.target,O.eventName,O.capture?S:m,O.options)}:function(t){return P.call(O.target,O.eventName,t.invoke,O.options)},k=r?function(t){if(!t.isRemoved){const e=X[t.eventName];let n;e&&(n=e[t.capture?f:h]);const r=n&&t.target[n];if(r)for(let e=0;e<r.length;e++){if(r[e]===t){r.splice(e,1),t.isRemoved=!0,t.removeAbortListener&&(t.removeAbortListener(),t.removeAbortListener=null),0===r.length&&(t.allRemoved=!0,t.target[n]=null);break}}}if(t.allRemoved)return L.call(t.target,t.eventName,t.capture?S:m,t.options)}:function(t){return L.call(t.target,t.eventName,t.invoke,t.options)},D=n&&n.diff?n.diff:function(t,e){const n=typeof e;return"function"===n&&t.callback===e||"object"===n&&t.originalDelegate===e},x=Zone[v("UNPATCHED_EVENTS")],M=t[v("PASSIVE_EVENTS")];const U=function(e,o,i,a,s=!1,l=!1){return function(){const p=this||t;let d=arguments[0];n&&n.transferEventName&&(d=n.transferEventName(d));let _=arguments[1];if(!_)return e.apply(this,arguments);if(R&&"uncaughtException"===d)return e.apply(this,arguments);let g=!1;if("function"!=typeof _){if(!_.handleEvent)return e.apply(this,arguments);g=!0}if(u&&!u(e,_,p,arguments))return;const v=V&&!!M&&-1!==M.indexOf(d),y=function(t){if("object"==typeof t&&null!==t){const e={...t};return t.signal&&(e.signal=t.signal),e}return t}(function(t,e){return!V&&"object"==typeof t&&t?!!t.capture:V&&e?"boolean"==typeof t?{capture:t,passive:!0}:t?"object"==typeof t&&!1!==t.passive?{...t,passive:!0}:t:{passive:!0}:t}(arguments[2],v)),E=y?.signal;if(E?.aborted)return;if(x)for(let t=0;t<x.length;t++)if(d===x[t])return v?e.call(p,d,_,y):e.apply(this,arguments);const T=!!y&&("boolean"==typeof y||y.capture),m=!(!y||"object"!=typeof y)&&y.once,S=Zone.current;let P=X[d];P||(Y(d,b),P=X[d]);const L=P[T?f:h];let w,A=p[L],C=!1;if(A){if(C=!0,c)for(let t=0;t<A.length;t++)if(D(A[t],_))return}else A=p[L]=[];const N=p.constructor.name,I=q[N];I&&(w=I[d]),w||(w=N+o+(b?b(d):d)),O.options=y,m&&(O.options.once=!1),O.target=p,O.capture=T,O.eventName=d,O.isExisting=C;const k=r?G:void 0;k&&(k.taskData=O),E&&(O.options.signal=void 0);const j=S.scheduleEventTask(w,_,k,i,a);if(E){O.options.signal=E;const t=()=>j.zone.cancelTask(j);e.call(E,"abort",t,{once:!0}),j.removeAbortListener=()=>E.removeEventListener("abort",t)}return O.target=null,k&&(k.taskData=null),m&&(O.options.once=!0),(V||"boolean"!=typeof j.options)&&(j.options=y),j.target=p,j.capture=T,j.eventName=d,g&&(j.originalDelegate=_),l?A.unshift(j):A.push(j),s?p:void 0}};return T[o]=U(P,_,I,k,E),C&&(T[g]=U(C,y,N,k,E,!0)),T[a]=function(){const e=this||t;let r=arguments[0];n&&n.transferEventName&&(r=n.transferEventName(r));const o=arguments[2],i=!!o&&("boolean"==typeof o||o.capture),a=arguments[1];if(!a)return L.apply(this,arguments);if(u&&!u(L,a,e,arguments))return;const s=X[r];let c;s&&(c=s[i?f:h]);const l=c&&e[c];if(l)for(let t=0;t<l.length;t++){const n=l[t];if(D(n,a)){if(l.splice(t,1),n.isRemoved=!0,0===l.length&&(n.allRemoved=!0,e[c]=null,!i&&"string"==typeof r)){e[d+"ON_PROPERTY"+r]=null}return n.zone.cancelTask(n),E?e:void 0}}return L.apply(this,arguments)},T[s]=function(){const e=this||t;let r=arguments[0];n&&n.transferEventName&&(r=n.transferEventName(r));const o=[],i=Q(e,b?b(r):r);for(let t=0;t<i.length;t++){const e=i[t];let n=e.originalDelegate?e.originalDelegate:e.callback;o.push(n)}return o},T[l]=function(){const e=this||t;let r=arguments[0];if(r){n&&n.transferEventName&&(r=n.transferEventName(r));const t=X[r];if(t){const n=t[h],o=t[f],i=e[n],s=e[o];if(i){const t=i.slice();for(let e=0;e<t.length;e++){const n=t[e];let o=n.originalDelegate?n.originalDelegate:n.callback;this[a].call(this,r,o,n.options)}}if(s){const t=s.slice();for(let e=0;e<t.length;e++){const n=t[e];let o=n.originalDelegate?n.originalDelegate:n.callback;this[a].call(this,r,o,n.options)}}}}else{const t=Object.keys(e);for(let e=0;e<t.length;e++){const n=t[e],r=K.exec(n);let o=r&&r[1];o&&"removeListener"!==o&&this[l].call(this,o)}this[l].call(this,"removeListener")}if(E)return this},j(T[o],P),j(T[a],L),A&&j(T[l],A),w&&j(T[s],w),!0}let O=[];for(let t=0;t<n.length;t++)O[t]=b(n[t],r);return O}function Q(t,e){if(!e){const n=[];for(let r in t){const o=K.exec(r);let i=o&&o[1];if(i&&(!e||i===e)){const e=t[r];if(e)for(let t=0;t<e.length;t++)n.push(e[t])}}return n}let n=X[e];n||(Y(e),n=X[e]);const r=t[n[h]],o=t[n[f]];return r?o?r.concat(o):r.slice():o?o.slice():[]}function J(t,e){const n=t.Event;n&&n.prototype&&e.patchMethod(n.prototype,"stopImmediatePropagation",(t=>function(e,n){e[W]=!0,t&&t.apply(e,n)}))}function tt(t,e){e.patchMethod(t,"queueMicrotask",(t=>function(t,e){Zone.current.scheduleMicroTask("queueMicrotask",e[0])}))}const et=v("zoneTask");function nt(t,e,n,r){let o=null,i=null;n+=r;const a={};function s(e){const n=e.data;n.args[0]=function(){return e.invoke.apply(this,arguments)};const r=o.apply(t,n.args);return F(r)?n.handleId=r:(n.handle=r,n.isRefreshable=H(r.refresh)),e}function u(e){const{handle:n,handleId:r}=e.data;return i.call(t,n??r)}o=x(t,e+=r,(n=>function(o,i){if(H(i[0])){const t={isRefreshable:!1,isPeriodic:"Interval"===r,delay:"Timeout"===r||"Interval"===r?i[1]||0:void 0,args:i},n=i[0];i[0]=function(){try{return n.apply(this,arguments)}finally{const{handle:e,handleId:n,isPeriodic:r,isRefreshable:o}=t;r||o||(n?delete a[n]:e&&(e[et]=null))}};const o=g(e,i[0],t,s,u);if(!o)return o;const{handleId:c,handle:l,isRefreshable:p,isPeriodic:f}=o.data;if(c)a[c]=o;else if(l&&(l[et]=o,p&&!f)){const t=l.refresh;l.refresh=function(){const{zone:e,state:n}=o;return"notScheduled"===n?(o._state="scheduled",e._updateTaskCount(o,1)):"running"===n&&(o._state="scheduling"),t.call(this)}}return l??c??o}return n.apply(t,i)})),i=x(t,n,(e=>function(n,r){const o=r[0];let i;F(o)?(i=a[o],delete a[o]):(i=o?.[et],i?o[et]=null:i=o),i?.type?i.cancelFn&&i.zone.cancelTask(i):e.apply(t,r)}))}function rt(t,e){if(Zone[e.symbol("patchEventTarget")])return;const{eventNames:n,zoneSymbolEventNames:r,TRUE_STR:o,FALSE_STR:i,ZONE_SYMBOL_PREFIX:a}=e.getGlobalObjects();for(let t=0;t<n.length;t++){const e=n[t],s=a+(e+i),u=a+(e+o);r[e]={},r[e][i]=s,r[e][o]=u}const s=t.EventTarget;return s&&s.prototype?(e.patchEventTarget(t,e,[s&&s.prototype]),!0):void 0}function ot(t,e,n){if(!n||0===n.length)return e;const r=n.filter((e=>e.target===t));if(!r||0===r.length)return e;const o=r[0].ignoreProperties;return e.filter((t=>-1===o.indexOf(t)))}function it(t,e,n,r){if(!t)return;I(t,ot(t,e,n),r)}function at(t){return Object.getOwnPropertyNames(t).filter((t=>t.startsWith("on")&&t.length>2)).map((t=>t.substring(2)))}function st(t,e){if(R&&!L)return;if(Zone[t.symbol("patchEvents")])return;const n=e.__Zone_ignore_on_properties;let r=[];if(P){const t=window;r=r.concat(["Document","SVGElement","Element","HTMLElement","HTMLBodyElement","HTMLMediaElement","HTMLFrameSetElement","HTMLFrameElement","HTMLIFrameElement","HTMLMarqueeElement","Worker"]);const e=z()?[{target:t,ignoreProperties:["error"]}]:[];it(t,at(t),n?n.concat(e):n,i(t))}r=r.concat(["XMLHttpRequest","XMLHttpRequestEventTarget","IDBIndex","IDBRequest","IDBOpenDBRequest","IDBDatabase","IDBTransaction","IDBCursor","WebSocket"]);for(let t=0;t<r.length;t++){const o=e[r[t]];o&&o.prototype&&it(o.prototype,at(o.prototype),n)}}function ut(t){t.__load_patch("ZoneAwarePromise",((t,e,n)=>{const r=Object.getOwnPropertyDescriptor,o=Object.defineProperty;const i=n.symbol,a=[],s=!1!==t[i("DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION")],u=i("Promise"),c=i("then"),l="__creationTrace__";n.onUnhandledError=t=>{if(n.showUncaughtError()){const e=t&&t.rejection;e?console.error("Unhandled Promise rejection:",e instanceof Error?e.message:e,"; Zone:",t.zone.name,"; Task:",t.task&&t.task.source,"; Value:",e,e instanceof Error?e.stack:void 0):console.error(t)}},n.microtaskDrainDone=()=>{for(;a.length;){const t=a.shift();try{t.zone.runGuarded((()=>{if(t.throwOriginal)throw t.rejection;throw t}))}catch(t){f(t)}}};const p=i("unhandledPromiseRejectionHandler");function f(t){n.onUnhandledError(t);try{const n=e[p];"function"==typeof n&&n.call(this,t)}catch(t){}}function h(t){return t&&t.then}function d(t){return t}function _(t){return j.reject(t)}const g=i("state"),v=i("value"),y=i("finally"),E=i("parentPromiseValue"),T=i("parentPromiseState"),m="Promise.then",S=null,b=!0,O=!1,R=0;function P(t,e){return n=>{try{C(t,e,n)}catch(e){C(t,!1,e)}}}const L=function(){let t=!1;return function(e){return function(){t||(t=!0,e.apply(null,arguments))}}},w="Promise resolved with itself",A=i("currentTaskTrace");function C(t,r,i){const u=L();if(t===i)throw new TypeError(w);if(t[g]===S){let c=null;try{"object"!=typeof i&&"function"!=typeof i||(c=i&&i.then)}catch(e){return u((()=>{C(t,!1,e)}))(),t}if(r!==O&&i instanceof j&&i.hasOwnProperty(g)&&i.hasOwnProperty(v)&&i[g]!==S)I(i),C(t,i[g],i[v]);else if(r!==O&&"function"==typeof c)try{c.call(i,u(P(t,r)),u(P(t,!1)))}catch(e){u((()=>{C(t,!1,e)}))()}else{t[g]=r;const u=t[v];if(t[v]=i,t[y]===y&&r===b&&(t[g]=t[T],t[v]=t[E]),r===O&&i instanceof Error){const t=e.currentTask&&e.currentTask.data&&e.currentTask.data[l];t&&o(i,A,{configurable:!0,enumerable:!1,writable:!0,value:t})}for(let e=0;e<u.length;)k(t,u[e++],u[e++],u[e++],u[e++]);if(0==u.length&&r==O){t[g]=R;let r=i;try{throw new Error("Uncaught (in promise): "+function(t){if(t&&t.toString===Object.prototype.toString){return(t.constructor&&t.constructor.name||"")+": "+JSON.stringify(t)}return t?t.toString():Object.prototype.toString.call(t)}(i)+(i&&i.stack?"\n"+i.stack:""))}catch(t){r=t}s&&(r.throwOriginal=!0),r.rejection=i,r.promise=t,r.zone=e.current,r.task=e.currentTask,a.push(r),n.scheduleMicroTask()}}}return t}const N=i("rejectionHandledHandler");function I(t){if(t[g]===R){try{const n=e[N];n&&"function"==typeof n&&n.call(this,{rejection:t[v],promise:t})}catch(t){}t[g]=O;for(let e=0;e<a.length;e++)t===a[e].promise&&a.splice(e,1)}}function k(t,e,n,r,o){I(t);const i=t[g],a=i?"function"==typeof r?r:d:"function"==typeof o?o:_;e.scheduleMicroTask(m,(()=>{try{const r=t[v],o=!!n&&y===n[y];o&&(n[E]=r,n[T]=i);const s=e.run(a,void 0,o&&a!==_&&a!==d?[]:[r]);C(n,!0,s)}catch(t){C(n,!1,t)}}),n)}const D=function(){},M=t.AggregateError;class j{static toString(){return"function ZoneAwarePromise() { [native code] }"}static resolve(t){return t instanceof j?t:C(new this(null),b,t)}static reject(t){return C(new this(null),O,t)}static withResolvers(){const t={};return t.promise=new j(((e,n)=>{t.resolve=e,t.reject=n})),t}static any(t){if(!t||"function"!=typeof t[Symbol.iterator])return Promise.reject(new M([],"All promises were rejected"));const e=[];let n=0;try{for(let r of t)n++,e.push(j.resolve(r))}catch(t){return Promise.reject(new M([],"All promises were rejected"))}if(0===n)return Promise.reject(new M([],"All promises were rejected"));let r=!1;const o=[];return new j(((t,i)=>{for(let a=0;a<e.length;a++)e[a].then((e=>{r||(r=!0,t(e))}),(t=>{o.push(t),n--,0===n&&(r=!0,i(new M(o,"All promises were rejected")))}))}))}static race(t){let e,n,r=new this(((t,r)=>{e=t,n=r}));function o(t){e(t)}function i(t){n(t)}for(let e of t)h(e)||(e=this.resolve(e)),e.then(o,i);return r}static all(t){return j.allWithCallback(t)}static allSettled(t){return(this&&this.prototype instanceof j?this:j).allWithCallback(t,{thenCallback:t=>({status:"fulfilled",value:t}),errorCallback:t=>({status:"rejected",reason:t})})}static allWithCallback(t,e){let n,r,o=new this(((t,e)=>{n=t,r=e})),i=2,a=0;const s=[];for(let o of t){h(o)||(o=this.resolve(o));const t=a;try{o.then((r=>{s[t]=e?e.thenCallback(r):r,i--,0===i&&n(s)}),(o=>{e?(s[t]=e.errorCallback(o),i--,0===i&&n(s)):r(o)}))}catch(t){r(t)}i++,a++}return i-=2,0===i&&n(s),o}constructor(t){const e=this;if(!(e instanceof j))throw new Error("Must be an instanceof Promise.");e[g]=S,e[v]=[];try{const n=L();t&&t(n(P(e,b)),n(P(e,O)))}catch(t){C(e,!1,t)}}get[Symbol.toStringTag](){return"Promise"}get[Symbol.species](){return j}then(t,n){let r=this.constructor?.[Symbol.species];r&&"function"==typeof r||(r=this.constructor||j);const o=new r(D),i=e.current;return this[g]==S?this[v].push(i,o,t,n):k(this,i,o,t,n),o}catch(t){return this.then(null,t)}finally(t){let n=this.constructor?.[Symbol.species];n&&"function"==typeof n||(n=j);const r=new n(D);r[y]=y;const o=e.current;return this[g]==S?this[v].push(o,r,t,t):k(this,o,r,t,t),r}}j.resolve=j.resolve,j.reject=j.reject,j.race=j.race,j.all=j.all;const U=t[u]=t.Promise;t.Promise=j;const B=i("thenPatched");function z(t){const e=t.prototype,n=r(e,"then");if(n&&(!1===n.writable||!n.configurable))return;const o=e.then;e[c]=o,t.prototype.then=function(t,e){return new j(((t,e)=>{o.call(this,t,e)})).then(t,e)},t[B]=!0}return n.patchThen=z,U&&(z(U),x(t,"fetch",(t=>{return e=t,function(t,n){let r=e.apply(t,n);if(r instanceof j)return r;let o=r.constructor;return o[B]||z(o),r};var e}))),Promise[e.__symbol__("uncaughtPromiseErrors")]=a,j}))}function ct(t,e,n,r,o){const i=Zone.__symbol__(r);if(e[i])return;const a=e[i]=e[r];e[r]=function(i,s,u){return s&&s.prototype&&o.forEach((function(e){const o=`${n}.${r}::`+e,i=s.prototype;try{if(i.hasOwnProperty(e)){const n=t.ObjectGetOwnPropertyDescriptor(i,e);n&&n.value?(n.value=t.wrapWithCurrentZone(n.value,o),t._redefineProperty(s.prototype,e,n)):i[e]&&(i[e]=t.wrapWithCurrentZone(i[e],o))}else i[e]&&(i[e]=t.wrapWithCurrentZone(i[e],o))}catch{}})),a.call(e,i,s,u)},t.attachOriginToPatched(e[r],a)}const lt=function(){const t=globalThis,r=!0===t[e("forceDuplicateZoneCheck")];if(t.Zone&&(r||"function"!=typeof t.Zone.__symbol__))throw new Error("Zone already loaded.");return t.Zone??=n(),t.Zone}();(function(t){ut(t),function(t){t.__load_patch("toString",(t=>{const e=Function.prototype.toString,n=v("OriginalDelegate"),r=v("Promise"),o=v("Error"),i=function(){if("function"==typeof this){const i=this[n];if(i)return"function"==typeof i?e.call(i):Object.prototype.toString.call(i);if(this===Promise){const n=t[r];if(n)return e.call(n)}if(this===Error){const n=t[o];if(n)return e.call(n)}}return e.call(this)};i[n]=e,Function.prototype.toString=i;const a=Object.prototype.toString;Object.prototype.toString=function(){return"function"==typeof Promise&&this instanceof Promise?"[object Promise]":a.call(this)}}))}(t),function(t){t.__load_patch("util",((t,e,n)=>{const i=at(t);n.patchOnProperties=I,n.patchMethod=x,n.bindArguments=S,n.patchMacroTask=M;const l=e.__symbol__("BLACK_LISTED_EVENTS"),p=e.__symbol__("UNPATCHED_EVENTS");t[p]&&(t[l]=t[p]),t[l]&&(e[l]=e[p]=t[l]),n.patchEventPrototype=J,n.patchEventTarget=$,n.isIEOrEdge=Z,n.ObjectDefineProperty=o,n.ObjectGetOwnPropertyDescriptor=r,n.ObjectCreate=a,n.ArraySlice=s,n.patchClass=D,n.wrapWithCurrentZone=_,n.filterProperties=ot,n.attachOriginToPatched=j,n._redefineProperty=Object.defineProperty,n.patchCallbacks=ct,n.getGlobalObjects=()=>({globalSources:q,zoneSymbolEventNames:X,eventNames:i,isBrowser:P,isMix:L,isNode:R,TRUE_STR:f,FALSE_STR:h,ZONE_SYMBOL_PREFIX:d,ADD_EVENT_LISTENER_STR:u,REMOVE_EVENT_LISTENER_STR:c})}))}(t)})(lt),function(t){t.__load_patch("legacy",(e=>{const n=e[t.__symbol__("legacyPatch")];n&&n()})),t.__load_patch("timers",(t=>{const e="set",n="clear";nt(t,e,n,"Timeout"),nt(t,e,n,"Interval"),nt(t,e,n,"Immediate")})),t.__load_patch("requestAnimationFrame",(t=>{nt(t,"request","cancel","AnimationFrame"),nt(t,"mozRequest","mozCancel","AnimationFrame"),nt(t,"webkitRequest","webkitCancel","AnimationFrame")})),t.__load_patch("blocking",((t,e)=>{const n=["alert","prompt","confirm"];for(let r=0;r<n.length;r++){x(t,n[r],((n,r,o)=>function(r,i){return e.current.run(n,t,i,o)}))}})),t.__load_patch("EventTarget",((t,e,n)=>{!function(t,e){e.patchEventPrototype(t,e)}(t,n),rt(t,n);const r=t.XMLHttpRequestEventTarget;r&&r.prototype&&n.patchEventTarget(t,n,[r.prototype])})),t.__load_patch("MutationObserver",((t,e,n)=>{D("MutationObserver"),D("WebKitMutationObserver")})),t.__load_patch("IntersectionObserver",((t,e,n)=>{D("IntersectionObserver")})),t.__load_patch("FileReader",((t,e,n)=>{D("FileReader")})),t.__load_patch("on_property",((t,e,n)=>{st(n,t)})),t.__load_patch("customElements",((t,e,n)=>{!function(t,e){const{isBrowser:n,isMix:r}=e.getGlobalObjects();if(!n&&!r||!t.customElements||!("customElements"in t))return;e.patchCallbacks(e,t.customElements,"customElements","define",["connectedCallback","disconnectedCallback","adoptedCallback","attributeChangedCallback","formAssociatedCallback","formDisabledCallback","formResetCallback","formStateRestoreCallback"])}(t,n)})),t.__load_patch("XHR",((t,e)=>{!function(t){const u=t.XMLHttpRequest;if(!u)return;const c=u.prototype;let f=c[l],h=c[p];if(!f){const e=t.XMLHttpRequestEventTarget;if(e){const t=e.prototype;f=t[l],h=t[p]}}const d="readystatechange",_="scheduled";function y(t){const r=t.data,a=r.target;a[i]=!1,a[s]=!1;const u=a[o];f||(f=a[l],h=a[p]),u&&h.call(a,d,u);const c=a[o]=()=>{if(a.readyState===a.DONE)if(!r.aborted&&a[i]&&t.state===_){const n=a[e.__symbol__("loadfalse")];if(0!==a.status&&n&&n.length>0){const o=t.invoke;t.invoke=function(){const n=a[e.__symbol__("loadfalse")];for(let e=0;e<n.length;e++)n[e]===t&&n.splice(e,1);r.aborted||t.state!==_||o.call(t)},n.push(t)}else t.invoke()}else r.aborted||!1!==a[i]||(a[s]=!0)};f.call(a,d,c);return a[n]||(a[n]=t),O.apply(a,r.args),a[i]=!0,t}function E(){}function T(t){const e=t.data;return e.aborted=!0,R.apply(e.target,e.args)}const m=x(c,"open",(()=>function(t,e){return t[r]=0==e[2],t[a]=e[1],m.apply(t,e)})),S=v("fetchTaskAborting"),b=v("fetchTaskScheduling"),O=x(c,"send",(()=>function(t,n){if(!0===e.current[b])return O.apply(t,n);if(t[r])return O.apply(t,n);{const e={target:t,url:t[a],isPeriodic:!1,args:n,aborted:!1},r=g("XMLHttpRequest.send",E,e,y,T);t&&!0===t[s]&&!e.aborted&&r.state===_&&r.invoke()}})),R=x(c,"abort",(()=>function(t,r){const o=t[n];if(o&&"string"==typeof o.type){if(null==o.cancelFn||o.data&&o.data.aborted)return;o.zone.cancelTask(o)}else if(!0===e.current[S])return R.apply(t,r)}))}(t);const n=v("xhrTask"),r=v("xhrSync"),o=v("xhrListener"),i=v("xhrScheduled"),a=v("xhrURL"),s=v("xhrErrorBeforeScheduled")})),t.__load_patch("geolocation",(t=>{t.navigator&&t.navigator.geolocation&&function(t,e){const n=t.constructor.name;for(let o=0;o<e.length;o++){const i=e[o],a=t[i];if(a){if(!b(r(t,i)))continue;t[i]=(t=>{const e=function(){return t.apply(this,S(arguments,n+"."+i))};return j(e,t),e})(a)}}}(t.navigator.geolocation,["getCurrentPosition","watchPosition"])})),t.__load_patch("PromiseRejectionEvent",((t,e)=>{function n(e){return function(n){Q(t,e).forEach((r=>{const o=t.PromiseRejectionEvent;if(o){const t=new o(e,{promise:n.promise,reason:n.rejection});r.invoke(t)}}))}}t.PromiseRejectionEvent&&(e[v("unhandledPromiseRejectionHandler")]=n("unhandledrejection"),e[v("rejectionHandledHandler")]=n("rejectionhandled"))})),t.__load_patch("queueMicrotask",((t,e,n)=>{tt(t,n)}))}(lt)}();class Di 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,o;const i=this.options,a={};this.config.app.name&&(a["service.name"]=this.config.app.name),this.config.app.namespace&&(a["service.namespace"]=this.config.app.namespace),this.config.app.version&&(a["service.version"]=this.config.app.version),this.config.app.environment&&(a["deployment.environment.name"]=this.config.app.environment,a["deployment.environment"]=this.config.app.environment),Object.assign(a,i.resourceAttributes);const s=Ao.default().merge(new Ao(a)),u=new Fo({resource:s,sampler:{shouldSample:()=>({decision:ki(this.api.getSession())})}});u.addSpanProcessor(null!==(t=i.spanProcessor)&&void 0!==t?t:new xr(new Eo(new Dr({api:this.api}),{scheduledDelayMillis:Di.SCHEDULED_BATCH_DELAY_MS,maxExportBatchSize:30}),this.metas)),u.register({propagator:null!==(e=i.propagator)&&void 0!==e?e:new Nn,contextManager:null!==(n=i.contextManager)&&void 0!==n?n:new Ni});const{propagateTraceHeaderCorsUrls:c,fetchInstrumentationOptions:l,xhrInstrumentationOptions:p}=null!==(r=this.options.instrumentationOptions)&&void 0!==r?r:{};!function(t){var e,n,r=t.tracerProvider||qt.getTracerProvider(),o=t.meterProvider||xt.getMeterProvider(),i=t.loggerProvider||qr.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!==(o=i.instrumentations)&&void 0!==o?o:wi({ignoreUrls:this.getIgnoreUrls(),propagateTraceHeaderCorsUrls:c,fetchInstrumentationOptions:l,xhrInstrumentationOptions:p})}),this.api.initOTEL(qt,Nt)}getIgnoreUrls(){return this.transports.transports.flatMap((t=>t.getIgnoreUrls()))}}return Di.SCHEDULED_BATCH_DELAY_MS=1e3,t.FaroSessionSpanProcessor=xr,t.FaroTraceExporter=Dr,t.TracingInstrumentation=Di,t.fetchCustomAttributeFunctionWithDefaults=Pi,t.getDefaultOTELInstrumentations=wi,t.getSamplingDecision=ki,t.setSpanStatusOnFetchError=Oi,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],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},E=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(){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,E([],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=g.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),H=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return N(e,t),e}(B),V=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return N(e,t),e}(B),F=new I,X=new M,G=new U,z=new j,K=new D,q=new k,W=new H,Y=new V,Q={get:function(t,e){if(null!=t)return t[e]},keys:function(t){return null==t?[]:Object.keys(t)}},Z={set:function(t,e,n){null!=t&&(t[e]=n)}},$=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],$(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,g.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,g.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,Et=/^[0-9a-f]{16}$/i;function gt(t){return yt.test(t)&&t!==st}function Tt(t){return gt(t.traceId)&&(e=t.spanId,Et.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=g.instance(),xt=new(function(){function t(){}return t.prototype.getMeter=function(t,e,n){return F},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,g.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,g.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 Ht(t,e){return t.setValue(jt,e)}function Vt(t){return t.deleteValue(jt)}var Ft="propagation",Xt=new Ut,Gt=function(){function t(){this.createBaggage=R,this.getBaggage=Bt,this.getActiveBaggage=kt,this.setBaggage=Ht,this.deleteBaggage=Vt}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalPropagator=function(t){return c(Ft,t,g.instance())},t.prototype.inject=function(t,e,n){return void 0===n&&(n=Z),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(Ft,g.instance())},t.prototype._getGlobalPropagator=function(){return l(Ft)||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,g.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,g.instance()),this._proxyTracerProvider=new Ct},t}().getInstance(),Wt=L("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function Yt(t){return t.setValue(Wt,!0)}function Qt(t){return!0===t.getValue(Wt)}var Zt="=",$t=";",Jt=",",te="baggage",ee=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 ne(t){return t.reduce((function(t,e){var n=""+t+(""!==t?Jt:"")+e;return n.length>8192?t:n}),"")}function re(t){return t.getAllEntries().map((function(t){var e=ee(t,2),n=e[0],r=e[1],o=encodeURIComponent(n)+"="+encodeURIComponent(r.value);return void 0!==r.metadata&&(o+=$t+r.metadata.toString()),o}))}function oe(t){var e=t.split($t);if(!(e.length<=0)){var n=e.shift();if(n){var r=n.indexOf(Zt);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($t))&&(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 ie=function(){function t(){}return t.prototype.inject=function(t,e,n){var r=zt.getBaggage(t);if(r&&!Qt(t)){var o=ne(re(r).filter((function(t){return t.length<=4096})).slice(0,180));o.length>0&&n.set(e,te,o)}},t.prototype.extract=function(t,e,n){var r=n.get(e,te),o=Array.isArray(r)?r.join(Jt):r;if(!o)return t;var i={};return 0===o.length?t:(o.split(Jt).forEach((function(t){var e=oe(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[te]},t}(),ae=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}(),se=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.")},ue=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 ce(t){var e,n,r={};if("object"!=typeof t||null==t)return r;try{for(var o=se(Object.entries(t)),i=o.next();!i.done;i=o.next()){var a=ue(i.value,2),s=a[0],u=a[1];le(s)?pe(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 le(t){return"string"==typeof t&&t.length>0}function pe(t){return null==t||(Array.isArray(t)?function(t){var e,n,r;try{for(var o=se(t),i=o.next();!i.done;i=o.next()){var a=i.value;if(null!=a){if(!r){if(fe(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):fe(t))}function fe(t){switch(typeof t){case"number":case"boolean":case"string":return!0}return!1}function de(){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 he,_e=de();function ve(t){try{_e(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"}(he||(he={}));var ye=",",Ee=["OTEL_SDK_DISABLED"];function ge(t){return Ee.indexOf(t)>-1}var Te=["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 me(t){return Te.indexOf(t)>-1}var Se=["OTEL_NO_PATCH_MODULES","OTEL_PROPAGATORS","OTEL_SEMCONV_STABILITY_OPT_IN"];function Oe(t){return Se.indexOf(t)>-1}var be=1/0,Re=128,Le={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:be,OTEL_ATTRIBUTE_COUNT_LIMIT:Re,OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT:be,OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT:Re,OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT:be,OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT:Re,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:he.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 Pe(t,e,n){if(void 0!==n[t]){var r=String(n[t]);e[t]="true"===r.toLowerCase()}}function Ae(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 we(t,e,n,r){void 0===r&&(r=ye);var o=n[t];"string"==typeof o&&(e[t]=o.split(r).map((function(t){return t.trim()})))}var Ce={ALL:f.ALL,VERBOSE:f.VERBOSE,DEBUG:f.DEBUG,INFO:f.INFO,WARN:f.WARN,ERROR:f.ERROR,NONE:f.NONE};function Ne(t,e,n){var r=n[t];if("string"==typeof r){var o=Ce[r.toUpperCase()];null!=o&&(e[t]=o)}}function Ie(t){var e={};for(var n in Le){var r=n;if("OTEL_LOG_LEVEL"===r)Ne(r,e,t);else if(ge(r))Pe(r,e,t);else if(me(r))Ae(r,e,t);else if(Oe(r))we(r,e,t);else{var o=t[r];null!=o&&(e[r]=String(o))}}return e}var xe="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{};function Me(){var t=Ie(xe);return Object.assign({},Le,t)}function De(){return Ie(xe)}function Ue(t){return t>=48&&t<=57?t-48:t>=97&&t<=102?t-87:t-55}function je(t){for(var e=new Uint8Array(t.length/2),n=0,r=0;r<t.length;r+=2){var o=Ue(t.charCodeAt(r)),i=Ue(t.charCodeAt(r+1));e[n++]=o<<4|i}return e}var Be=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},ke=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 He=function(){this.generateTraceId=Fe(16),this.generateSpanId=Fe(8)},Ve=Array(32);function Fe(t){return function(){for(var e=0;e<2*t;e++)Ve[e]=Math.floor(16*Math.random())+48,Ve[e]>=58&&(Ve[e]+=39);return String.fromCharCode.apply(null,Ve.slice(0,2*t))}}var Xe,Ge=performance,ze="1.30.1",Ke="exception.type",qe="exception.message",We="http.method",Ye="http.url",Qe="http.host",Ze="http.scheme",$e="http.status_code",Je="http.user_agent",tn="http.request_content_length_uncompressed",en="telemetry.sdk.name",nn="telemetry.sdk.language",rn="telemetry.sdk.version",on=((Xe={})[en]="opentelemetry",Xe["process.runtime.name"]="browser",Xe[nn]="webjs",Xe[rn]=ze,Xe);function an(t){}var sn,un=Math.pow(10,6),cn=Math.pow(10,9);function ln(t){var e=t/1e3;return[Math.trunc(e),Math.round(t%1e3*un)]}function pn(){var t=Ge.timeOrigin;if("number"!=typeof t){var e=Ge;t=e.timing&&e.timing.fetchStart}return t}function fn(t){return En(ln(pn()),ln("number"==typeof t?t:Ge.now()))}function dn(t){if(vn(t))return t;if("number"==typeof t)return t<pn()?fn(t):ln(t);if(t instanceof Date)return ln(t.getTime());throw TypeError("Invalid input type")}function hn(t,e){var n=e[0]-t[0],r=e[1]-t[1];return r<0&&(n-=1,r+=cn),[n,r]}function _n(t){return t[0]*cn+t[1]}function vn(t){return Array.isArray(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]}function yn(t){return vn(t)||"number"==typeof t||t instanceof Date}function En(t,e){var n=[t[0]+e[0],t[1]+e[1]];return n[1]>=cn&&(n[1]-=cn,n[0]+=1),n}!function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"}(sn||(sn={}));var gn=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.")},Tn=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=gn(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}(),mn="[_0-9a-z-*/]",Sn=new RegExp("^(?:"+("[a-z]"+mn+"{0,255}")+"|"+("[a-z0-9]"+mn+"{0,240}@[a-z]"+mn+"{0,13}")+")$"),On=/^[ -~]{0,255}[!-~]$/,bn=/,|=/;var Rn=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 Sn.test(t)})(o)&&function(t){return On.test(t)&&!bn.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}(),Ln="traceparent",Pn="tracestate",An=new RegExp("^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$");function wn(t){var e=An.exec(t);return e?"00"===e[1]&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}:null}var Cn,Nn=function(){function t(){}return t.prototype.inject=function(t,e,n){var r=qt.getSpanContext(t);if(r&&!Qt(t)&&Tt(r)){var o="00-"+r.traceId+"-"+r.spanId+"-0"+Number(r.traceFlags||A.NONE).toString(16);n.set(e,Ln,o),r.traceState&&n.set(e,Pn,r.traceState.serialize())}},t.prototype.extract=function(t,e,n){var r=n.get(e,Ln);if(!r)return t;var o=Array.isArray(r)?r[0]:r;if("string"!=typeof o)return t;var i=wn(o);if(!i)return t;i.isRemote=!0;var a=n.get(e,Pn);if(a){var s=Array.isArray(a)?a.join(","):a;i.traceState=new Rn("string"==typeof s?s:void 0)}return qt.setSpanContext(t,i)},t.prototype.fields=function(){return[Ln,Pn]},t}(),In=L("OpenTelemetry SDK Context Key RPC_METADATA");!function(t){t.HTTP="http"}(Cn||(Cn={}));var xn,Mn,Dn=function(){function t(){}return t.prototype.shouldSample=function(){return{decision:bt.NOT_RECORD}},t.prototype.toString=function(){return"AlwaysOffSampler"},t}(),Un=function(){function t(){}return t.prototype.shouldSample=function(){return{decision:bt.RECORD_AND_SAMPLED}},t.prototype.toString=function(){return"AlwaysOnSampler"},t}(),jn=function(){function t(t){var e,n,r,o;this._root=t.root,this._root||(ve(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new Un),this._remoteParentSampled=null!==(e=t.remoteParentSampled)&&void 0!==e?e:new Un,this._remoteParentNotSampled=null!==(n=t.remoteParentNotSampled)&&void 0!==n?n:new Dn,this._localParentSampled=null!==(r=t.localParentSampled)&&void 0!==r?r:new Un,this._localParentNotSampled=null!==(o=t.localParentNotSampled)&&void 0!==o?o:new Dn}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}(),Bn=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:gt(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}(),kn="[object Object]",Hn="[object Null]",Vn="[object Undefined]",Fn=Function.prototype.toString,Xn=Fn.call(Object),Gn=(xn=Object.getPrototypeOf,Mn=Object,function(t){return xn(Mn(t))}),zn=Object.prototype,Kn=zn.hasOwnProperty,qn=Symbol?Symbol.toStringTag:void 0,Wn=zn.toString;function Yn(t){if(!function(t){return null!=t&&"object"==typeof t}(t)||function(t){if(null==t)return void 0===t?Vn:Hn;return qn&&qn in Object(t)?function(t){var e=Kn.call(t,qn),n=t[qn],r=!1;try{t[qn]=void 0,r=!0}catch(t){}var o=Wn.call(t);r&&(e?t[qn]=n:delete t[qn]);return o}(t):function(t){return Wn.call(t)}(t)}(t)!==kn)return!1;var e=Gn(t);if(null===e)return!0;var n=Kn.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Fn.call(n)===Xn}var Qn=20;function Zn(){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=Jn(n,t.shift(),0,r);return n}function $n(t){return er(t)?t.slice():t}function Jn(t,e,n,r){var o;if(void 0===n&&(n=0),!(n>Qn)){if(n++,or(t)||or(e)||nr(e))o=$n(e);else if(er(t)){if(o=t.slice(),er(e))for(var i=0,a=e.length;i<a;i++)o.push($n(e[i]));else if(rr(e))for(i=0,a=(s=Object.keys(e)).length;i<a;i++){o[u=s[i]]=$n(e[u])}}else if(rr(t))if(rr(e)){if(!function(t,e){if(!Yn(t)||!Yn(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(or(c))void 0===c?delete o[u]:o[u]=c;else{var l=o[u],p=c;if(tr(t,u,r)||tr(e,u,r))delete o[u];else{if(rr(l)&&rr(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]=Jn(o[u],c,n,r)}}}}else o=e;return o}}function tr(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 er(t){return Array.isArray(t)}function nr(t){return"function"==typeof t}function rr(t){return!or(t)&&!er(t)&&!nr(t)&&"object"==typeof t}function or(t){return"string"==typeof t||"number"==typeof t||"boolean"==typeof t||void 0===t||t instanceof Date||t instanceof RegExp||null===t}var ir=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)}}(),ar=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return ir(e,t),e}(Error);var sr=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 ur(t,e){return"string"==typeof e?t===e:!!t.match(e)}function cr(t,e){var n,r;if(!e)return!1;try{for(var o=sr(e),i=o.next();!i.done;i=o.next()){if(ur(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 lr=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}(),pr=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},fr=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))},dr=function(){function t(t,e){this._callback=t,this._that=e,this._isCalled=!1,this._deferred=new lr}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,fr([this._that],pr(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 hr={getKeyPairs:re,serializeKeyPairs:ne,parseKeyPairsIntoRecord:function(t){return"string"!=typeof t||0===t.length?{}:t.split(Jt).map((function(t){return oe(t)})).filter((function(t){return void 0!==t&&t.value.length>0})).reduce((function(t,e){return t[e.key]=e.value,t}),{})},parsePairKeyValue:oe},_r={_export:function(t,e){return new Promise((function(n){Nt.with(Yt(Nt.active()),(function(){t.export(e,(function(t){n(t)}))}))}))}},vr=Object.freeze({__proto__:null,AlwaysOffSampler:Dn,AlwaysOnSampler:Un,AnchoredClock:ae,BindOnceFuture:dr,CompositePropagator:Tn,DEFAULT_ATTRIBUTE_COUNT_LIMIT:Re,DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT:be,DEFAULT_ENVIRONMENT:Le,DEFAULT_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT:128,DEFAULT_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT:128,get ExportResultCode(){return sn},ParentBasedSampler:jn,get RPCType(){return Cn},RandomIdGenerator:He,SDK_INFO:on,TRACE_PARENT_HEADER:Ln,TRACE_STATE_HEADER:Pn,TimeoutError:ar,TraceIdRatioBasedSampler:Bn,TraceState:Rn,get TracesSamplerValues(){return he},VERSION:ze,W3CBaggagePropagator:ie,W3CTraceContextPropagator:Nn,_globalThis:xe,addHrTimes:En,baggageUtils:hr,callWithTimeout:function(t,e){var n,r=new Promise((function(t,r){n=setTimeout((function(){r(new ar("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(In)},getEnv:Me,getEnvWithoutDefaults:De,getRPCMetadata:function(t){return t.getValue(In)},getTimeOrigin:pn,globalErrorHandler:ve,hexToBase64:function(t){return btoa(String.fromCharCode.apply(String,ke([],Be(je(t)),!1)))},hexToBinary:je,hrTime:fn,hrTimeDuration:hn,hrTimeToMicroseconds:function(t){return 1e6*t[0]+t[1]/1e3},hrTimeToMilliseconds:function(t){return 1e3*t[0]+t[1]/1e6},hrTimeToNanoseconds:_n,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:_r,isAttributeKey:le,isAttributeValue:pe,isTimeInput:yn,isTimeInputHrTime:vn,isTracingSuppressed:Qt,isUrlIgnored:cr,isWrapped:function(t){return"function"==typeof t&&"function"==typeof t.__original&&"function"==typeof t.__unwrap&&!0===t.__wrapped},loggingErrorHandler:de,merge:Zn,millisToHrTime:ln,otperformance:Ge,parseEnvironment:Ie,parseTraceParent:wn,sanitizeAttributes:ce,setGlobalErrorHandler:function(t){_e=t},setRPCMetadata:function(t,e){return t.setValue(In,e)},suppressTracing:Yt,timeInputToHrTime:dn,unrefTimer:an,unsuppressTracing:function(t){return t.deleteValue(Wt)},urlMatches:ur});function yr(t){if(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 Er,gr={},Tr={};function mr(){if(Er)return Tr;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 Er=1,Object.defineProperty(Tr,"__esModule",{value:!0}),Tr.toAnyValue=Tr.toKeyValue=Tr.toAttributes=Tr.createInstrumentationScope=Tr.createResource=void 0,Tr.createResource=function(e){return{attributes:t(e.attributes),droppedAttributesCount:0}},Tr.createInstrumentationScope=function(t){return{name:t.name,version:t.version}},Tr.toAttributes=t,Tr.toKeyValue=e,Tr.toAnyValue=n,Tr}var Sr,Or,br={},Rr=yr(vr);function Lr(){if(Sr)return br;Sr=1,Object.defineProperty(br,"__esModule",{value:!0}),br.getOtlpEncoder=br.encodeAsString=br.encodeAsLongBits=br.toLongBits=br.hrTimeToNanos=void 0;const t=Rr;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()}br.hrTimeToNanos=e,br.toLongBits=n,br.encodeAsLongBits=r,br.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 br.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}},br}function Pr(){if(Or)return gr;Or=1,Object.defineProperty(gr,"__esModule",{value:!0}),gr.createExportTraceServiceRequest=gr.toOtlpSpanEvent=gr.toOtlpLink=gr.sdkSpanToOtlpSpan=void 0;const t=mr(),e=Lr();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 gr.sdkSpanToOtlpSpan=n,gr.toOtlpLink=r,gr.toOtlpSpanEvent=o,gr.createExportTraceServiceRequest=function(t,n){return{resourceSpans:i(t,(0,e.getOtlpEncoder)(n))}},gr}var Ar,wr=Pr(),Cr={};function Nr(){return Ar||(Ar=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"}(Cr)),Cr}var Ir=Nr();let xr={};class Mr{constructor(t){this.config=t}export(t,e){const n=wr.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!==Ir.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))),xr.api.pushEvent(`faro.tracing.${s}`,i,void 0,{spanContext:o})}}}}(n.resourceSpans),e({code:sn.SUCCESS})}shutdown(){return Promise.resolve(void 0)}}var Dr="session.id";"function"==typeof SuppressedError&&SuppressedError;var Ur=function(){function t(){}return t.prototype.emit=function(t){},t}(),jr=new Ur,Br=new(function(){function t(){}return t.prototype.getLogger=function(t,e,n){return new Ur},t}()),kr=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):jr},t}(),Hr=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 kr(this,t,e,n)},t.prototype.getDelegate=function(){var t;return null!==(t=this._delegate)&&void 0!==t?t:Br},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}(),Vr="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{},Fr=Symbol.for("io.opentelemetry.js.api.logs"),Xr=Vr;var Gr,zr,Kr=function(){function t(){this._proxyLoggerProvider=new Hr}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalLoggerProvider=function(t){return Xr[Fr]?this.getLoggerProvider():(Xr[Fr]=(e=1,n=t,r=Br,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=Xr[Fr])||void 0===t?void 0:t.call(Xr,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 Xr[Fr],this._proxyLoggerProvider=new Hr},t}(),qr=Kr.getInstance();var Wr=function(){if(zr)return Gr;function t(t){return"function"==typeof t}zr=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")},Gr=r}(),Yr=function(){return Yr=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},Yr.apply(this,arguments)},Qr=function(){function t(t,e,n){this.instrumentationName=t,this.instrumentationVersion=e,this._config={},this._wrap=Wr.wrap,this._unwrap=Wr.unwrap,this._massWrap=Wr.massWrap,this._massUnwrap=Wr.massUnwrap,this.setConfig(n),this._diag=It.createComponentLogger({namespace:t}),this._tracer=qt.getTracer(t,e),this._meter=Dt.getMeter(t,e),this._logger=qr.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=Yr({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}(),Zr=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)}}(),$r=function(t){function e(e,n,r){var o=t.call(this,e,n,r)||this;return o._config.enabled&&o.enable(),o}return Zr(e,t),e}(Qr);function Jr(t,e,n){var r,o;try{o=t()}catch(t){r=t}finally{return e(r,o),o}}function to(t){return"function"==typeof t&&"function"==typeof t.__original&&"function"==typeof t.__unwrap&&!0===t.__wrapped}var eo,no=function(){return no=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},no.apply(this,arguments)},ro=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.")},oo=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},io=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))},ao=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=Ge.now(),this._performanceOffset=l-(this._performanceStartTime+pn()),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):pe(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=ro(Object.entries(t)),o=r.next();!o.done;o=r.next()){var i=oo(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++),yn(e)&&(yn(n)||(n=e),e=void 0);var r=ce(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,io([],oo(t),!1)),this},t.prototype.setStatus=function(t){return this._isSpanEnded()||(this.status=no({},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=hn(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<=Ge.now())return fn(t+this._performanceOffset);if("number"==typeof t)return ln(t);if(t instanceof Date)return ln(t.getTime());if(vn(t))return t;if(this._startTimeProvided)return ln(Date.now());var e=Ge.now()-this._performanceStartTime;return En(this.startTime,ln(e))},t.prototype.isRecording=function(){return!1===this._ended},t.prototype.recordException=function(t,e){var n={};"string"==typeof t?n[qe]=t:t&&(t.code?n[Ke]=t.code.toString():t.name&&(n[Ke]=t.name),t.message&&(n[qe]=t.message),t.stack&&(n["exception.stacktrace"]=t.stack)),n[Ke]||n[qe]?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"}(eo||(eo={}));var so=function(){function t(){}return t.prototype.shouldSample=function(){return{decision:eo.NOT_RECORD}},t.prototype.toString=function(){return"AlwaysOffSampler"},t}(),uo=function(){function t(){}return t.prototype.shouldSample=function(){return{decision:eo.RECORD_AND_SAMPLED}},t.prototype.toString=function(){return"AlwaysOnSampler"},t}(),co=function(){function t(t){var e,n,r,o;this._root=t.root,this._root||(ve(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new uo),this._remoteParentSampled=null!==(e=t.remoteParentSampled)&&void 0!==e?e:new uo,this._remoteParentNotSampled=null!==(n=t.remoteParentNotSampled)&&void 0!==n?n:new so,this._localParentSampled=null!==(r=t.localParentSampled)&&void 0!==r?r:new uo,this._localParentNotSampled=null!==(o=t.localParentNotSampled)&&void 0!==o?o:new so}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}(),lo=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:gt(e)&&this._accumulate(e)<this._upperBound?eo.RECORD_AND_SAMPLED:eo.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}(),po=he.AlwaysOn,fo=1;function ho(){var t=Me();return{sampler:_o(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 _o(t){switch(void 0===t&&(t=Me()),t.OTEL_TRACES_SAMPLER){case he.AlwaysOn:return new uo;case he.AlwaysOff:return new so;case he.ParentBasedAlwaysOn:return new co({root:new uo});case he.ParentBasedAlwaysOff:return new co({root:new so});case he.TraceIdRatio:return new lo(vo(t));case he.ParentBasedTraceIdRatio:return new co({root:new lo(vo(t))});default:return It.error('OTEL_TRACES_SAMPLER value "'+t.OTEL_TRACES_SAMPLER+" invalid, defaulting to "+po+'".'),new uo}}function vo(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 "+fo+"."),fo;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 "+fo+"."),fo):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 "+fo+"."),fo):e}var yo=function(){function t(t,e){this._exporter=t,this._isExporting=!1,this._finishedSpans=[],this._droppedSpansCount=0;var n=Me();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 dr(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(Yt(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===sn.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){ve(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,ve(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}(),Eo=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)}}(),go=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.onInit(n),r}return Eo(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){ve(t)}))},this._pageHideListener=function(){e.forceFlush().catch((function(t){ve(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}(yo),To=function(){this.generateTraceId=So(16),this.generateSpanId=So(8)},mo=Array(32);function So(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 Oo=function(){function t(t,e,n){this._tracerProvider=n;var r,o,i,a,s=(r=e,o={sampler:_o()},i=ho(),(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 To,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(Qt(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:ce(t.attributes)}})),h=ce(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=ce(Object.assign(h,_.attributes));return new ao(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 bo,Ro=function(){return Ro=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},Ro.apply(this,arguments)},Lo=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())}))},Po=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])}}},Ao=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},wo=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[nn]=on[nn],e[en]=on[en],e[rn]=on[rn],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 Lo(this,void 0,void 0,(function(){return Po(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=Ro(Ro({},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=Ao(t,2),i=o[0],a=o[1];return Ro(Ro(Ro(Ro({},r._syncAttributes),i),null!==(n=e._syncAttributes)&&void 0!==n?n:e.attributes),a)}));return new t(o,i)},t.EMPTY=new t({}),t}(),Co=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.")},No=function(){function t(t){this._spanProcessors=t}return t.prototype.forceFlush=function(){var t,e,n=[];try{for(var r=Co(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){ve(e||new Error("MultiSpanProcessor: forceFlush failed")),t()}))}))},t.prototype.onStart=function(t,e){var n,r;try{for(var o=Co(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=Co(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=Co(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}(),Io=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}(),xo=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},Mo=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"}(bo||(bo={}));var Do,Uo,jo,Bo=function(){function t(t){var e,n;void 0===t&&(t={}),this._registeredSpanProcessors=[],this._tracers=new Map;var r=Zn({},ho(),function(t){var e,n,r,o,i,a,s,u,c,l,p,f,d=Object.assign({},t.spanLimits),h=De();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:Re,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:be,Object.assign({},t,{spanLimits:d})}(t));if(this.resource=null!==(e=r.resource)&&void 0!==e?e:wo.empty(),r.mergeResourceWithDefaults&&(this.resource=wo.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=Mo([],xo(t.spanProcessors),!1),this.activeSpanProcessor=new No(this._registeredSpanProcessors);else{var o=this._buildExporterFromEnv();if(void 0!==o){var i=new go(o);this.activeSpanProcessor=i}else this.activeSpanProcessor=new Io}}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 Oo({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 No(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=bo.timeout}),t);e.forceFlush().then((function(){clearTimeout(o),r!==bo.timeout&&(r=bo.resolved,n(r))})).catch((function(t){clearTimeout(o),r=bo.error,n(t)}))}))}));return new Promise((function(t,n){Promise.all(e).then((function(e){var r=e.filter((function(t){return t!==bo.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(Me().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 Tn({propagators:n})},t.prototype._buildExporterFromEnv=function(){var t=Me().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 Nn}],["baggage",function(){return new ie}]]),t._registeredExporters=new Map,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},Ho=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))},Vo=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,Ho([n],ko(r),!1))}finally{this._currentContext=i}},t}(),Fo=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)}}(),Xo=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 Fo(e,t),e.prototype.register=function(e){void 0===e&&(e={}),void 0===e.contextManager&&(e.contextManager=new Vo),e.contextManager&&e.contextManager.enable(),t.prototype.register.call(this,e)},e}(Bo);function Go(t,e){return e in t}function zo(t,e,n,r){var o=void 0,i=void 0;Go(n,e)&&"number"==typeof n[e]&&(o=n[e]);var a=Do.FETCH_START;if(Go(n,a)&&"number"==typeof n[a]&&(i=n[a]),void 0!==o&&void 0!==i&&o>=i)return t.addEvent(e,o),t}function Ko(t,e,n){void 0===n&&(n=!1),n||(zo(t,Do.FETCH_START,e),zo(t,Do.DOMAIN_LOOKUP_START,e),zo(t,Do.DOMAIN_LOOKUP_END,e),zo(t,Do.CONNECT_START,e),Go(e,"name")&&e.name.startsWith("https:")&&zo(t,Do.SECURE_CONNECTION_START,e),zo(t,Do.CONNECT_END,e),zo(t,Do.REQUEST_START,e),zo(t,Do.RESPONSE_START,e),zo(t,Do.RESPONSE_END,e));var r=e[Do.ENCODED_BODY_SIZE];void 0!==r&&t.setAttribute("http.response_content_length",r);var o=e[Do.DECODED_BODY_SIZE];void 0!==o&&r!==o&&t.setAttribute("http.response_content_length_uncompressed",o)}function qo(){return"undefined"!=typeof location?location.origin:void 0}function Wo(t,e,n,r,o,i){void 0===o&&(o=new WeakSet);var a=Yo(t),s=function(t,e,n,r,o,i){var a=_n(e),s=_n(n),u=r.filter((function(e){var n=_n(dn(e[Do.FETCH_START])),r=_n(dn(e[Do.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[Do.FETCH_START],r=e[Do.FETCH_START];return n>r?1:n<r?-1:0}))}(s);if(a.origin!==qo()&&u.length>1){var c=u[0],l=function(t,e,n){for(var r,o=_n(n),i=_n(dn(e)),a=t[1],s=t.length,u=1;u<s;u++){var c=t[u],l=_n(dn(c[Do.FETCH_START])),p=o-_n(dn(c[Do.RESPONSE_END]));l>=i&&(!r||p<r)&&(r=p,a=c)}return a}(u,c[Do.RESPONSE_END],n),p=c[Do.RESPONSE_END];return l[Do.FETCH_START]<p&&(l=c,c=void 0),{corsPreFlightRequest:c,mainRequest:l}}return{mainRequest:s[0]}}function Yo(t){if("function"==typeof URL)return new URL(t,"undefined"!=typeof document?document.baseURI:"undefined"!=typeof location?location.href:void 0);var e=(Uo||(Uo=document.createElement("a")),Uo);return e.href=t,e}function Qo(t,e){var n=e||[];return("string"==typeof n||n instanceof RegExp)&&(n=[n]),Yo(t).origin===qo()||n.some((function(e){return ur(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"}(Do||(Do={})),function(t){t.COMPONENT="component",t.HTTP_ERROR_NAME="http.error_name",t.HTTP_STATUS_TEXT="http.status_text"}(jo||(jo={}));var Zo=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())}))},$o=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])}}},Jo=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.")},ti=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},ei=It.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-fetch/utils"});function ni(){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 ei.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 Zo(this,void 0,void 0,(function(){var r;return $o(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=Jo(t.entries()),i=o.next();!i.done;i=o.next()){var a=ti(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 oi(t.toString());if("string"==typeof t)return oi(t);return void ei.warn("unknown body type")}(n.body))}var a=t[0];return(null==a?void 0:a.body)?a.clone().text().then((function(t){return oi(t)})):Promise.resolve()}var ri=new TextEncoder;function oi(t){return ri.encode(t).byteLength}var ii,ai,si="0.57.2",ui=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)}}(),ci=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},li=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))},pi="object"==typeof process&&"node"===(null===(ii=process.release)||void 0===ii?void 0:ii.name),fi=function(t){function e(e){void 0===e&&(e={});var n=t.call(this,"@opentelemetry/instrumentation-fetch",si,e)||this;return n.component="fetch",n.version=si,n.moduleName=n.component,n._usedResources=new WeakSet,n._tasksCount=0,n}return ui(e,t),e.prototype.init=function(){},e.prototype._addChildSpan=function(t,e){var n=this.tracer.startSpan("CORS Preflight",{startTime:e[Do.FETCH_START]},qt.setSpan(Nt.active(),t));Ko(n,e,this.getConfig().ignoreNetworkEvents),n.end(e[Do.RESPONSE_END])},e.prototype._addFinalSpanAttributes=function(t,e){var n=Yo(e.url);t.setAttribute($e,e.status),null!=e.statusText&&t.setAttribute(jo.HTTP_STATUS_TEXT,e.statusText),t.setAttribute(Qe,n.host),t.setAttribute(Ze,n.protocol.replace(":","")),"undefined"!=typeof navigator&&t.setAttribute(Je,navigator.userAgent)},e.prototype._addHeaders=function(t,e){if(!Qo(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={}),!cr(t,this.getConfig().ignoreUrls)){var r=(e.method||"GET").toUpperCase(),o="HTTP "+r;return this.tracer.startSpan(o,{kind:Rt.CLIENT,attributes:(n={},n[jo.COMPONENT]=this.moduleName,n[We]=r,n[Ye]=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=Wo(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)),Ko(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=ln(Date.now()),i=fn();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=Yo(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&&ni.apply(void 0,li([],ci(t),!1)).then((function(t){t&&s.setAttribute(tn,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&&Jr((function(){return o(t,e,n)}),(function(t){t&&r._diag.error("applyCustomAttributesOnSpan",t)}))},e.prototype._prepareSpanData=function(t){var e=fn(),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(){pi?this._diag.warn("this instrumentation is intended for web usage only, it does not instrument Node.js's fetch()"):(to(fetch)&&(this._unwrap(xe,"fetch"),this._diag.debug("removing previous patch for constructor")),this._wrap(xe,"fetch",this._patchConstructor()))},e.prototype.disable=function(){pi||(this._unwrap(xe,"fetch"),this._usedResources=new WeakSet)},e}($r);!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"}(ai||(ai={}));var di=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.")},hi=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},_i=It.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils"});function vi(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=di(t.entries()),i=o.next();!i.done;i=o.next()){var a=hi(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?Ei(t.toString()):"string"==typeof t?Ei(t):void _i.warn("unknown body type")}var yi=new TextEncoder;function Ei(t){return yi.encode(t).byteLength}var gi,Ti="0.57.2";!function(t){t.HTTP_STATUS_TEXT="http.status_text"}(gi||(gi={}));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)}}(),Si=function(t){function e(e){void 0===e&&(e={});var n=t.call(this,"@opentelemetry/instrumentation-xml-http-request",Ti,e)||this;return n.component="xml-http-request",n.version=Ti,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(!Qo(Yo(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[Do.FETCH_START]});Ko(t,e,n.getConfig().ignoreNetworkEvents),t.end(e[Do.RESPONSE_END])}))},e.prototype._addFinalSpanAttributes=function(t,e,n){if("string"==typeof n){var r=Yo(n);void 0!==e.status&&t.setAttribute($e,e.status),void 0!==e.statusText&&t.setAttribute(gi.HTTP_STATUS_TEXT,e.statusText),t.setAttribute(Qe,r.host),t.setAttribute(Ze,r.protocol.replace(":","")),t.setAttribute(Je,navigator.userAgent)}},e.prototype._applyAttributesAfterXHR=function(t,e){var n=this,r=this.getConfig().applyCustomAttributesOnSpan;"function"==typeof r&&Jr((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=Yo(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&&(Ge.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=Ge.getEntriesByType("resource"));var a=Wo(Yo(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)),Ko(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(!cr(e,this.getConfig().ignoreUrls)){var o=n.toUpperCase(),i=this.tracer.startSpan(o,{kind:Rt.CLIENT,attributes:(r={},r[We]=n,r[Ye]=Yo(e).toString(),r)});return i.addEvent(ai.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=fn(),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(ai.EVENT_ERROR,this)}function r(){e(ai.EVENT_ABORT,this)}function o(){e(ai.EVENT_TIMEOUT,this)}function i(){this.status<299?e(ai.EVENT_LOAD,this):e(ai.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=vi(s[0]);void 0!==f&&l.setAttribute(tn,f)}Nt.with(qt.setSpan(Nt.active(),l),(function(){t._tasksCount++,c.sendStartTime=fn(),l.addEvent(ai.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),to(XMLHttpRequest.prototype.open)&&(this._unwrap(XMLHttpRequest.prototype,"open"),this._diag.debug("removing previous patch from method open")),to(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}($r);class Oi extends Si{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 bi(t,e,n){Ri(t,n instanceof Error?0:n.status)}function Ri(t,e){if(null==e)return;(0===e||e>=400&&e<600)&&t.setStatus({code:Lt.ERROR})}function Li(t){return(e,n,r)=>{bi(e,0,r),null==t||t(e,n,r)}}function Pi(t){return(e,n)=>{!function(t,e){Ri(t,e.status)}(e,n),null==t||t(e,n)}}function Ai(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:Li(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:Pi(null==t?void 0:t.applyCustomAttributesOnSpan)})}(n,r);return[new fi(o),new Oi(i)]}class wi{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[Dr]=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()}}function Ci(t={}){var e;return"true"===(null===(e=t.attributes)||void 0===e?void 0:e.isSampled)?eo.RECORD_AND_SAMPLED:eo.NOT_RECORD}class Ni 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=wo.default().merge(new wo(i));new Xo({resource:a,sampler:{shouldSample:()=>({decision:Ci(this.api.getSession())})},spanProcessors:[null!==(t=o.spanProcessor)&&void 0!==t?t:new wi(new go(new Mr({api:this.api}),{scheduledDelayMillis:Ni.SCHEDULED_BATCH_DELAY_MS,maxExportBatchSize:30}),this.metas)]}).register({propagator:null!==(e=o.propagator)&&void 0!==e?e:new Nn,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||qr.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:Ai({ignoreUrls:this.getIgnoreUrls(),propagateTraceHeaderCorsUrls:s,fetchInstrumentationOptions:u,xhrInstrumentationOptions:c})}),this.api.initOTEL(qt,Nt)}getIgnoreUrls(){return this.transports.transports.flatMap((t=>t.getIgnoreUrls()))}}return Ni.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[Dr]=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=Mr,t.TracingInstrumentation=Ni,t.fetchCustomAttributeFunctionWithDefaults=Li,t.getDefaultOTELInstrumentations=Ai,t.getSamplingDecision=Ci,t.setSpanStatusOnFetchError=bi,t}({},GrafanaFaroWebSdk);
@@ -0,0 +1,12 @@
1
+ import type { Context } from '@opentelemetry/api';
2
+ import type { ReadableSpan, Span, SpanProcessor } from '@opentelemetry/sdk-trace-web';
3
+ import type { Metas } from '@grafana/faro-web-sdk';
4
+ export declare class FaroMetaAttributesSpanProcessor implements SpanProcessor {
5
+ private processor;
6
+ private metas;
7
+ constructor(processor: SpanProcessor, metas: Metas);
8
+ forceFlush(): Promise<void>;
9
+ onStart(span: Span, parentContext: Context): void;
10
+ onEnd(span: ReadableSpan): void;
11
+ shutdown(): Promise<void>;
12
+ }
@@ -1,6 +1,10 @@
1
1
  import type { Context } from '@opentelemetry/api';
2
2
  import type { ReadableSpan, Span, SpanProcessor } from '@opentelemetry/sdk-trace-web';
3
3
  import type { Metas } from '@grafana/faro-web-sdk';
4
+ /**
5
+ * @deprecated
6
+ * please use FaroMetaAttributesSpanProcessor instead
7
+ */
4
8
  export declare class FaroSessionSpanProcessor implements SpanProcessor {
5
9
  private processor;
6
10
  private metas;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
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");
7
+ var FaroMetaAttributesSpanProcessor = /** @class */ (function () {
8
+ function FaroMetaAttributesSpanProcessor(processor, metas) {
9
+ this.processor = processor;
10
+ this.metas = metas;
11
+ }
12
+ FaroMetaAttributesSpanProcessor.prototype.forceFlush = function () {
13
+ return this.processor.forceFlush();
14
+ };
15
+ FaroMetaAttributesSpanProcessor.prototype.onStart = function (span, parentContext) {
16
+ var _a;
17
+ var session = this.metas.value.session;
18
+ if (session === null || session === void 0 ? void 0 : session.id) {
19
+ span.attributes[incubating_1.ATTR_SESSION_ID] = session.id;
20
+ /**
21
+ * @deprecated will be removed in the future and has been replaced by ATTR_SESSION_ID (session.id)
22
+ */
23
+ span.attributes['session_id'] = session.id;
24
+ }
25
+ var user = (_a = this.metas.value.user) !== null && _a !== void 0 ? _a : {};
26
+ if (user.email) {
27
+ span.attributes['user.email'] = user.email;
28
+ }
29
+ if (user.id) {
30
+ span.attributes['user.id'] = user.id;
31
+ }
32
+ if (user.username) {
33
+ span.attributes['user.name'] = user.username;
34
+ }
35
+ if (user.fullName) {
36
+ span.attributes['user.full_name'] = user.fullName;
37
+ }
38
+ if (user.roles) {
39
+ span.attributes['user.roles'] = user.roles.split(',').map(function (role) { return role.trim(); });
40
+ }
41
+ if (user.hash) {
42
+ span.attributes['user.hash'] = user.hash;
43
+ }
44
+ this.processor.onStart(span, parentContext);
45
+ };
46
+ FaroMetaAttributesSpanProcessor.prototype.onEnd = function (span) {
47
+ this.processor.onEnd(span);
48
+ };
49
+ FaroMetaAttributesSpanProcessor.prototype.shutdown = function () {
50
+ return this.processor.shutdown();
51
+ };
52
+ return FaroMetaAttributesSpanProcessor;
53
+ }());
54
+ exports.FaroMetaAttributesSpanProcessor = FaroMetaAttributesSpanProcessor;
55
+ //# sourceMappingURL=faroMetaAttributesSpanProcessor.js.map
@@ -0,0 +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"]}
@@ -17,7 +17,6 @@ var __extends = (this && this.__extends) || (function () {
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.TracingInstrumentation = void 0;
19
19
  var api_1 = require("@opentelemetry/api");
20
- var context_zone_1 = require("@opentelemetry/context-zone");
21
20
  var core_1 = require("@opentelemetry/core");
22
21
  var instrumentation_1 = require("@opentelemetry/instrumentation");
23
22
  var resources_1 = require("@opentelemetry/resources");
@@ -25,10 +24,10 @@ var sdk_trace_web_1 = require("@opentelemetry/sdk-trace-web");
25
24
  var semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
26
25
  var incubating_1 = require("@opentelemetry/semantic-conventions/incubating");
27
26
  var faro_web_sdk_1 = require("@grafana/faro-web-sdk");
27
+ var faroMetaAttributesSpanProcessor_1 = require("./faroMetaAttributesSpanProcessor");
28
28
  var faroTraceExporter_1 = require("./faroTraceExporter");
29
29
  var getDefaultOTELInstrumentations_1 = require("./getDefaultOTELInstrumentations");
30
30
  var sampler_1 = require("./sampler");
31
- var sessionSpanProcessor_1 = require("./sessionSpanProcessor");
32
31
  // the providing of app name here is not great
33
32
  // should delay initialization and provide the full Faro config,
34
33
  // taking app name from it
@@ -44,7 +43,7 @@ var TracingInstrumentation = /** @class */ (function (_super) {
44
43
  }
45
44
  TracingInstrumentation.prototype.initialize = function () {
46
45
  var _this = this;
47
- var _a, _b, _c, _d, _e;
46
+ var _a, _b, _c, _d;
48
47
  var options = this.options;
49
48
  var attributes = {};
50
49
  if (this.config.app.name) {
@@ -74,18 +73,20 @@ var TracingInstrumentation = /** @class */ (function (_super) {
74
73
  };
75
74
  },
76
75
  },
76
+ spanProcessors: [
77
+ (_a = options.spanProcessor) !== null && _a !== void 0 ? _a : new faroMetaAttributesSpanProcessor_1.FaroMetaAttributesSpanProcessor(new sdk_trace_web_1.BatchSpanProcessor(new faroTraceExporter_1.FaroTraceExporter({ api: this.api }), {
78
+ scheduledDelayMillis: TracingInstrumentation.SCHEDULED_BATCH_DELAY_MS,
79
+ maxExportBatchSize: 30,
80
+ }), this.metas),
81
+ ],
77
82
  });
78
- provider.addSpanProcessor((_a = options.spanProcessor) !== null && _a !== void 0 ? _a : new sessionSpanProcessor_1.FaroSessionSpanProcessor(new sdk_trace_web_1.BatchSpanProcessor(new faroTraceExporter_1.FaroTraceExporter({ api: this.api }), {
79
- scheduledDelayMillis: TracingInstrumentation.SCHEDULED_BATCH_DELAY_MS,
80
- maxExportBatchSize: 30,
81
- }), this.metas));
82
83
  provider.register({
83
84
  propagator: (_b = options.propagator) !== null && _b !== void 0 ? _b : new core_1.W3CTraceContextPropagator(),
84
- contextManager: (_c = options.contextManager) !== null && _c !== void 0 ? _c : new context_zone_1.ZoneContextManager(),
85
+ contextManager: options.contextManager,
85
86
  });
86
- var _f = (_d = this.options.instrumentationOptions) !== null && _d !== void 0 ? _d : {}, propagateTraceHeaderCorsUrls = _f.propagateTraceHeaderCorsUrls, fetchInstrumentationOptions = _f.fetchInstrumentationOptions, xhrInstrumentationOptions = _f.xhrInstrumentationOptions;
87
+ var _e = (_c = this.options.instrumentationOptions) !== null && _c !== void 0 ? _c : {}, propagateTraceHeaderCorsUrls = _e.propagateTraceHeaderCorsUrls, fetchInstrumentationOptions = _e.fetchInstrumentationOptions, xhrInstrumentationOptions = _e.xhrInstrumentationOptions;
87
88
  (0, instrumentation_1.registerInstrumentations)({
88
- instrumentations: (_e = options.instrumentations) !== null && _e !== void 0 ? _e : (0, getDefaultOTELInstrumentations_1.getDefaultOTELInstrumentations)({
89
+ instrumentations: (_d = options.instrumentations) !== null && _d !== void 0 ? _d : (0, getDefaultOTELInstrumentations_1.getDefaultOTELInstrumentations)({
89
90
  ignoreUrls: this.getIgnoreUrls(),
90
91
  propagateTraceHeaderCorsUrls: propagateTraceHeaderCorsUrls,
91
92
  fetchInstrumentationOptions: fetchInstrumentationOptions,
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../src/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,0CAAoD;AACpD,4DAAiE;AACjE,4CAAgE;AAChE,kEAA0E;AAC1E,sDAAwE;AACxE,8DAAqF;AACrF,4EAI6C;AAC7C,6EAKwD;AAExD,sDAAgF;AAEhF,yDAAwD;AACxD,mFAAkF;AAClF,qCAAgD;AAChD,+DAAkE;AAGlE,8CAA8C;AAC9C,gEAAgE;AAChE,0BAA0B;AAE1B;IAA4C,0CAAmB;IAM7D,gCAAoB,OAA2C;QAA3C,wBAAA,EAAA,YAA2C;QAA/D,YACE,iBAAO,SACR;QAFmB,aAAO,GAAP,OAAO,CAAoC;QAL/D,UAAI,GAAG,2BAA2B,CAAC;QACnC,aAAO,GAAG,sBAAO,CAAC;;IAMlB,CAAC;IAED,2CAAU,GAAV;QAAA,iBAsEC;;QArEC,IAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,IAAM,UAAU,GAAuB,EAAE,CAAC;QAE1C,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE;YACxB,UAAU,CAAC,wCAAiB,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;SACtD;QAED,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE;YAC7B,UAAU,CAAC,mCAAsB,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC;SAChE;QAED,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE;YAC3B,UAAU,CAAC,2CAAoB,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC;SAC5D;QAED,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE;YAC/B,UAAU,CAAC,6CAAgC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC;YAC3E;;eAEG;YACH,UAAU,CAAC,yDAAkC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC;SAC9E;QAED,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAEtD,IAAM,QAAQ,GAAG,oBAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,oBAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;QAEpE,IAAM,QAAQ,GAAG,IAAI,iCAAiB,CAAC;YACrC,QAAQ,UAAA;YACR,OAAO,EAAE;gBACP,YAAY,EAAE;oBACZ,OAAO;wBACL,QAAQ,EAAE,IAAA,6BAAmB,EAAC,KAAI,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;qBACrD,CAAC;gBACJ,CAAC;aACF;SACF,CAAC,CAAC;QAEH,QAAQ,CAAC,gBAAgB,CACvB,MAAA,OAAO,CAAC,aAAa,mCACnB,IAAI,+CAAwB,CAC1B,IAAI,kCAAkB,CAAC,IAAI,qCAAiB,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE;YAC/D,oBAAoB,EAAE,sBAAsB,CAAC,wBAAwB;YACrE,kBAAkB,EAAE,EAAE;SACvB,CAAC,EACF,IAAI,CAAC,KAAK,CACX,CACJ,CAAC;QAEF,QAAQ,CAAC,QAAQ,CAAC;YAChB,UAAU,EAAE,MAAA,OAAO,CAAC,UAAU,mCAAI,IAAI,gCAAyB,EAAE;YACjE,cAAc,EAAE,MAAA,OAAO,CAAC,cAAc,mCAAI,IAAI,iCAAkB,EAAE;SACnE,CAAC,CAAC;QAEG,IAAA,KACJ,MAAA,IAAI,CAAC,OAAO,CAAC,sBAAsB,mCAAI,EAAE,EADnC,4BAA4B,kCAAA,EAAE,2BAA2B,iCAAA,EAAE,yBAAyB,+BACjD,CAAC;QAE5C,IAAA,0CAAwB,EAAC;YACvB,gBAAgB,EACd,MAAA,OAAO,CAAC,gBAAgB,mCACxB,IAAA,+DAA8B,EAAC;gBAC7B,UAAU,EAAE,IAAI,CAAC,aAAa,EAAE;gBAChC,4BAA4B,8BAAA;gBAC5B,2BAA2B,6BAAA;gBAC3B,yBAAyB,2BAAA;aAC1B,CAAC;SACL,CAAC,CAAC;QAEH,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,WAAK,EAAE,aAAO,CAAC,CAAC;IACpC,CAAC;IAEO,8CAAa,GAArB;QACE,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,UAAC,SAAoB,IAAK,OAAA,SAAS,CAAC,aAAa,EAAE,EAAzB,CAAyB,CAAC,CAAC;IACjG,CAAC;IAhFM,+CAAwB,GAAG,IAAI,CAAC;IAiFzC,6BAAC;CAAA,AArFD,CAA4C,kCAAmB,GAqF9D;AArFY,wDAAsB","sourcesContent":["import { context, trace } from '@opentelemetry/api';\nimport { ZoneContextManager } from '@opentelemetry/context-zone';\nimport { W3CTraceContextPropagator } from '@opentelemetry/core';\nimport { registerInstrumentations } from '@opentelemetry/instrumentation';\nimport { Resource, ResourceAttributes } from '@opentelemetry/resources';\nimport { BatchSpanProcessor, WebTracerProvider } from '@opentelemetry/sdk-trace-web';\nimport {\n ATTR_SERVICE_NAME,\n ATTR_SERVICE_VERSION,\n SEMRESATTRS_DEPLOYMENT_ENVIRONMENT,\n} from '@opentelemetry/semantic-conventions';\nimport {\n ATTR_DEPLOYMENT_ENVIRONMENT_NAME,\n ATTR_SERVICE_NAMESPACE,\n // False positive. Package can be resolved.\n // eslint-disable-next-line import/no-unresolved\n} from '@opentelemetry/semantic-conventions/incubating';\n\nimport { BaseInstrumentation, Transport, VERSION } from '@grafana/faro-web-sdk';\n\nimport { FaroTraceExporter } from './faroTraceExporter';\nimport { getDefaultOTELInstrumentations } from './getDefaultOTELInstrumentations';\nimport { getSamplingDecision } from './sampler';\nimport { FaroSessionSpanProcessor } from './sessionSpanProcessor';\nimport type { TracingInstrumentationOptions } from './types';\n\n// the providing of app name here is not great\n// should delay initialization and provide the full Faro config,\n// taking app name from it\n\nexport class TracingInstrumentation extends BaseInstrumentation {\n name = '@grafana/faro-web-tracing';\n version = VERSION;\n\n static SCHEDULED_BATCH_DELAY_MS = 1000;\n\n constructor(private options: TracingInstrumentationOptions = {}) {\n super();\n }\n\n initialize(): void {\n const options = this.options;\n const attributes: ResourceAttributes = {};\n\n if (this.config.app.name) {\n attributes[ATTR_SERVICE_NAME] = this.config.app.name;\n }\n\n if (this.config.app.namespace) {\n attributes[ATTR_SERVICE_NAMESPACE] = this.config.app.namespace;\n }\n\n if (this.config.app.version) {\n attributes[ATTR_SERVICE_VERSION] = this.config.app.version;\n }\n\n if (this.config.app.environment) {\n attributes[ATTR_DEPLOYMENT_ENVIRONMENT_NAME] = this.config.app.environment;\n /**\n * @deprecated will be removed in the future and has been replaced by ATTR_DEPLOYMENT_ENVIRONMENT_NAME (deployment.environment.name)\n */\n attributes[SEMRESATTRS_DEPLOYMENT_ENVIRONMENT] = this.config.app.environment;\n }\n\n Object.assign(attributes, options.resourceAttributes);\n\n const resource = Resource.default().merge(new Resource(attributes));\n\n const provider = new WebTracerProvider({\n resource,\n sampler: {\n shouldSample: () => {\n return {\n decision: getSamplingDecision(this.api.getSession()),\n };\n },\n },\n });\n\n provider.addSpanProcessor(\n options.spanProcessor ??\n new FaroSessionSpanProcessor(\n new BatchSpanProcessor(new FaroTraceExporter({ api: this.api }), {\n scheduledDelayMillis: TracingInstrumentation.SCHEDULED_BATCH_DELAY_MS,\n maxExportBatchSize: 30,\n }),\n this.metas\n )\n );\n\n provider.register({\n propagator: options.propagator ?? new W3CTraceContextPropagator(),\n contextManager: options.contextManager ?? new ZoneContextManager(),\n });\n\n const { propagateTraceHeaderCorsUrls, fetchInstrumentationOptions, xhrInstrumentationOptions } =\n this.options.instrumentationOptions ?? {};\n\n registerInstrumentations({\n instrumentations:\n options.instrumentations ??\n getDefaultOTELInstrumentations({\n ignoreUrls: this.getIgnoreUrls(),\n propagateTraceHeaderCorsUrls,\n fetchInstrumentationOptions,\n xhrInstrumentationOptions,\n }),\n });\n\n this.api.initOTEL(trace, context);\n }\n\n private getIgnoreUrls(): Array<string | RegExp> {\n return this.transports.transports.flatMap((transport: Transport) => transport.getIgnoreUrls());\n }\n}\n"]}
1
+ {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../src/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,0CAAoD;AACpD,4CAAgE;AAChE,kEAA0E;AAC1E,sDAAwE;AACxE,8DAAqF;AACrF,4EAI6C;AAC7C,6EAKwD;AAExD,sDAAgF;AAEhF,qFAAoF;AACpF,yDAAwD;AACxD,mFAAkF;AAClF,qCAAgD;AAGhD,8CAA8C;AAC9C,gEAAgE;AAChE,0BAA0B;AAE1B;IAA4C,0CAAmB;IAM7D,gCAAoB,OAA2C;QAA3C,wBAAA,EAAA,YAA2C;QAA/D,YACE,iBAAO,SACR;QAFmB,aAAO,GAAP,OAAO,CAAoC;QAL/D,UAAI,GAAG,2BAA2B,CAAC;QACnC,aAAO,GAAG,sBAAO,CAAC;;IAMlB,CAAC;IAED,2CAAU,GAAV;QAAA,iBAqEC;;QApEC,IAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,IAAM,UAAU,GAAuB,EAAE,CAAC;QAE1C,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE;YACxB,UAAU,CAAC,wCAAiB,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;SACtD;QAED,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE;YAC7B,UAAU,CAAC,mCAAsB,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC;SAChE;QAED,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE;YAC3B,UAAU,CAAC,2CAAoB,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC;SAC5D;QAED,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE;YAC/B,UAAU,CAAC,6CAAgC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC;YAC3E;;eAEG;YACH,UAAU,CAAC,yDAAkC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC;SAC9E;QAED,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAEtD,IAAM,QAAQ,GAAG,oBAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,oBAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;QAEpE,IAAM,QAAQ,GAAG,IAAI,iCAAiB,CAAC;YACrC,QAAQ,UAAA;YACR,OAAO,EAAE;gBACP,YAAY,EAAE;oBACZ,OAAO;wBACL,QAAQ,EAAE,IAAA,6BAAmB,EAAC,KAAI,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;qBACrD,CAAC;gBACJ,CAAC;aACF;YACD,cAAc,EAAE;gBACd,MAAA,OAAO,CAAC,aAAa,mCACnB,IAAI,iEAA+B,CACjC,IAAI,kCAAkB,CAAC,IAAI,qCAAiB,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE;oBAC/D,oBAAoB,EAAE,sBAAsB,CAAC,wBAAwB;oBACrE,kBAAkB,EAAE,EAAE;iBACvB,CAAC,EACF,IAAI,CAAC,KAAK,CACX;aACJ;SACF,CAAC,CAAC;QAEH,QAAQ,CAAC,QAAQ,CAAC;YAChB,UAAU,EAAE,MAAA,OAAO,CAAC,UAAU,mCAAI,IAAI,gCAAyB,EAAE;YACjE,cAAc,EAAE,OAAO,CAAC,cAAc;SACvC,CAAC,CAAC;QAEG,IAAA,KACJ,MAAA,IAAI,CAAC,OAAO,CAAC,sBAAsB,mCAAI,EAAE,EADnC,4BAA4B,kCAAA,EAAE,2BAA2B,iCAAA,EAAE,yBAAyB,+BACjD,CAAC;QAE5C,IAAA,0CAAwB,EAAC;YACvB,gBAAgB,EACd,MAAA,OAAO,CAAC,gBAAgB,mCACxB,IAAA,+DAA8B,EAAC;gBAC7B,UAAU,EAAE,IAAI,CAAC,aAAa,EAAE;gBAChC,4BAA4B,8BAAA;gBAC5B,2BAA2B,6BAAA;gBAC3B,yBAAyB,2BAAA;aAC1B,CAAC;SACL,CAAC,CAAC;QAEH,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,WAAK,EAAE,aAAO,CAAC,CAAC;IACpC,CAAC;IAEO,8CAAa,GAArB;QACE,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,UAAC,SAAoB,IAAK,OAAA,SAAS,CAAC,aAAa,EAAE,EAAzB,CAAyB,CAAC,CAAC;IACjG,CAAC;IA/EM,+CAAwB,GAAG,IAAI,CAAC;IAgFzC,6BAAC;CAAA,AApFD,CAA4C,kCAAmB,GAoF9D;AApFY,wDAAsB","sourcesContent":["import { context, trace } from '@opentelemetry/api';\nimport { W3CTraceContextPropagator } from '@opentelemetry/core';\nimport { registerInstrumentations } from '@opentelemetry/instrumentation';\nimport { Resource, ResourceAttributes } from '@opentelemetry/resources';\nimport { BatchSpanProcessor, WebTracerProvider } from '@opentelemetry/sdk-trace-web';\nimport {\n ATTR_SERVICE_NAME,\n ATTR_SERVICE_VERSION,\n SEMRESATTRS_DEPLOYMENT_ENVIRONMENT,\n} from '@opentelemetry/semantic-conventions';\nimport {\n ATTR_DEPLOYMENT_ENVIRONMENT_NAME,\n ATTR_SERVICE_NAMESPACE,\n // False positive. Package can be resolved.\n // eslint-disable-next-line import/no-unresolved\n} from '@opentelemetry/semantic-conventions/incubating';\n\nimport { BaseInstrumentation, Transport, VERSION } from '@grafana/faro-web-sdk';\n\nimport { FaroMetaAttributesSpanProcessor } from './faroMetaAttributesSpanProcessor';\nimport { FaroTraceExporter } from './faroTraceExporter';\nimport { getDefaultOTELInstrumentations } from './getDefaultOTELInstrumentations';\nimport { getSamplingDecision } from './sampler';\nimport type { TracingInstrumentationOptions } from './types';\n\n// the providing of app name here is not great\n// should delay initialization and provide the full Faro config,\n// taking app name from it\n\nexport class TracingInstrumentation extends BaseInstrumentation {\n name = '@grafana/faro-web-tracing';\n version = VERSION;\n\n static SCHEDULED_BATCH_DELAY_MS = 1000;\n\n constructor(private options: TracingInstrumentationOptions = {}) {\n super();\n }\n\n initialize(): void {\n const options = this.options;\n const attributes: ResourceAttributes = {};\n\n if (this.config.app.name) {\n attributes[ATTR_SERVICE_NAME] = this.config.app.name;\n }\n\n if (this.config.app.namespace) {\n attributes[ATTR_SERVICE_NAMESPACE] = this.config.app.namespace;\n }\n\n if (this.config.app.version) {\n attributes[ATTR_SERVICE_VERSION] = this.config.app.version;\n }\n\n if (this.config.app.environment) {\n attributes[ATTR_DEPLOYMENT_ENVIRONMENT_NAME] = this.config.app.environment;\n /**\n * @deprecated will be removed in the future and has been replaced by ATTR_DEPLOYMENT_ENVIRONMENT_NAME (deployment.environment.name)\n */\n attributes[SEMRESATTRS_DEPLOYMENT_ENVIRONMENT] = this.config.app.environment;\n }\n\n Object.assign(attributes, options.resourceAttributes);\n\n const resource = Resource.default().merge(new Resource(attributes));\n\n const provider = new WebTracerProvider({\n resource,\n sampler: {\n shouldSample: () => {\n return {\n decision: getSamplingDecision(this.api.getSession()),\n };\n },\n },\n spanProcessors: [\n options.spanProcessor ??\n new FaroMetaAttributesSpanProcessor(\n new BatchSpanProcessor(new FaroTraceExporter({ api: this.api }), {\n scheduledDelayMillis: TracingInstrumentation.SCHEDULED_BATCH_DELAY_MS,\n maxExportBatchSize: 30,\n }),\n this.metas\n ),\n ],\n });\n\n provider.register({\n propagator: options.propagator ?? new W3CTraceContextPropagator(),\n contextManager: options.contextManager,\n });\n\n const { propagateTraceHeaderCorsUrls, fetchInstrumentationOptions, xhrInstrumentationOptions } =\n this.options.instrumentationOptions ?? {};\n\n registerInstrumentations({\n instrumentations:\n options.instrumentations ??\n getDefaultOTELInstrumentations({\n ignoreUrls: this.getIgnoreUrls(),\n propagateTraceHeaderCorsUrls,\n fetchInstrumentationOptions,\n xhrInstrumentationOptions,\n }),\n });\n\n this.api.initOTEL(trace, context);\n }\n\n private getIgnoreUrls(): Array<string | RegExp> {\n return this.transports.transports.flatMap((transport: Transport) => transport.getIgnoreUrls());\n }\n}\n"]}
@@ -4,6 +4,10 @@ exports.FaroSessionSpanProcessor = void 0;
4
4
  // False positive. Package can be resolved.
5
5
  // eslint-disable-next-line import/no-unresolved
6
6
  var incubating_1 = require("@opentelemetry/semantic-conventions/incubating");
7
+ /**
8
+ * @deprecated
9
+ * please use FaroMetaAttributesSpanProcessor instead
10
+ */
7
11
  var FaroSessionSpanProcessor = /** @class */ (function () {
8
12
  function FaroSessionSpanProcessor(processor, metas) {
9
13
  this.processor = processor;
@@ -1 +1 @@
1
- {"version":3,"file":"sessionSpanProcessor.js","sourceRoot":"","sources":["../../src/sessionSpanProcessor.ts"],"names":[],"mappings":";;;AAEA,2CAA2C;AAC3C,gDAAgD;AAChD,6EAAiF;AAIjF;IACE,kCACU,SAAwB,EACxB,KAAY;QADZ,cAAS,GAAT,SAAS,CAAe;QACxB,UAAK,GAAL,KAAK,CAAO;IACnB,CAAC;IAEJ,6CAAU,GAAV;QACE,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC;IAED,0CAAO,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,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAC9C,CAAC;IAED,wCAAK,GAAL,UAAM,IAAkB;QACtB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED,2CAAQ,GAAR;QACE,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;IACnC,CAAC;IACH,+BAAC;AAAD,CAAC,AA/BD,IA+BC;AA/BY,4DAAwB","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 FaroSessionSpanProcessor 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 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":"sessionSpanProcessor.js","sourceRoot":"","sources":["../../src/sessionSpanProcessor.ts"],"names":[],"mappings":";;;AAEA,2CAA2C;AAC3C,gDAAgD;AAChD,6EAAiF;AAIjF;;;GAGG;AACH;IACE,kCACU,SAAwB,EACxB,KAAY;QADZ,cAAS,GAAT,SAAS,CAAe;QACxB,UAAK,GAAL,KAAK,CAAO;IACnB,CAAC;IAEJ,6CAAU,GAAV;QACE,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC;IAED,0CAAO,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,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAC9C,CAAC;IAED,wCAAK,GAAL,UAAM,IAAkB;QACtB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED,2CAAQ,GAAR;QACE,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;IACnC,CAAC;IACH,+BAAC;AAAD,CAAC,AA/BD,IA+BC;AA/BY,4DAAwB","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\n/**\n * @deprecated\n * please use FaroMetaAttributesSpanProcessor instead\n */\nexport class FaroSessionSpanProcessor 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 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"]}
@@ -0,0 +1,50 @@
1
+ // False positive. Package can be resolved.
2
+ // eslint-disable-next-line import/no-unresolved
3
+ import { ATTR_SESSION_ID } from '@opentelemetry/semantic-conventions/incubating';
4
+ export class FaroMetaAttributesSpanProcessor {
5
+ constructor(processor, metas) {
6
+ this.processor = processor;
7
+ this.metas = metas;
8
+ }
9
+ forceFlush() {
10
+ return this.processor.forceFlush();
11
+ }
12
+ onStart(span, parentContext) {
13
+ var _a;
14
+ const session = this.metas.value.session;
15
+ if (session === null || session === void 0 ? void 0 : session.id) {
16
+ span.attributes[ATTR_SESSION_ID] = session.id;
17
+ /**
18
+ * @deprecated will be removed in the future and has been replaced by ATTR_SESSION_ID (session.id)
19
+ */
20
+ span.attributes['session_id'] = session.id;
21
+ }
22
+ const user = (_a = this.metas.value.user) !== null && _a !== void 0 ? _a : {};
23
+ if (user.email) {
24
+ span.attributes['user.email'] = user.email;
25
+ }
26
+ if (user.id) {
27
+ span.attributes['user.id'] = user.id;
28
+ }
29
+ if (user.username) {
30
+ span.attributes['user.name'] = user.username;
31
+ }
32
+ if (user.fullName) {
33
+ span.attributes['user.full_name'] = user.fullName;
34
+ }
35
+ if (user.roles) {
36
+ span.attributes['user.roles'] = user.roles.split(',').map((role) => role.trim());
37
+ }
38
+ if (user.hash) {
39
+ span.attributes['user.hash'] = user.hash;
40
+ }
41
+ this.processor.onStart(span, parentContext);
42
+ }
43
+ onEnd(span) {
44
+ this.processor.onEnd(span);
45
+ }
46
+ shutdown() {
47
+ return this.processor.shutdown();
48
+ }
49
+ }
50
+ //# sourceMappingURL=faroMetaAttributesSpanProcessor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"faroMetaAttributesSpanProcessor.js","sourceRoot":"","sources":["../../src/faroMetaAttributesSpanProcessor.ts"],"names":[],"mappings":"AAEA,2CAA2C;AAC3C,gDAAgD;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AAIjF,MAAM,OAAO,+BAA+B;IAC1C,YACU,SAAwB,EACxB,KAAY;QADZ,cAAS,GAAT,SAAS,CAAe;QACxB,UAAK,GAAL,KAAK,CAAO;IACnB,CAAC;IAEJ,UAAU;QACR,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC;IAED,OAAO,CAAC,IAAU,EAAE,aAAsB;;QACxC,MAAM,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,eAAe,CAAC,GAAG,OAAO,CAAC,EAAE,CAAC;YAC9C;;eAEG;YACH,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,EAAE,CAAC;SAC5C;QAED,MAAM,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,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,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,KAAK,CAAC,IAAkB;QACtB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;IACnC,CAAC;CACF","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,5 +1,4 @@
1
1
  import { context, trace } from '@opentelemetry/api';
2
- import { ZoneContextManager } from '@opentelemetry/context-zone';
3
2
  import { W3CTraceContextPropagator } from '@opentelemetry/core';
4
3
  import { registerInstrumentations } from '@opentelemetry/instrumentation';
5
4
  import { Resource } from '@opentelemetry/resources';
@@ -10,10 +9,10 @@ import { ATTR_DEPLOYMENT_ENVIRONMENT_NAME, ATTR_SERVICE_NAMESPACE,
10
9
  // eslint-disable-next-line import/no-unresolved
11
10
  } from '@opentelemetry/semantic-conventions/incubating';
12
11
  import { BaseInstrumentation, VERSION } from '@grafana/faro-web-sdk';
12
+ import { FaroMetaAttributesSpanProcessor } from './faroMetaAttributesSpanProcessor';
13
13
  import { FaroTraceExporter } from './faroTraceExporter';
14
14
  import { getDefaultOTELInstrumentations } from './getDefaultOTELInstrumentations';
15
15
  import { getSamplingDecision } from './sampler';
16
- import { FaroSessionSpanProcessor } from './sessionSpanProcessor';
17
16
  // the providing of app name here is not great
18
17
  // should delay initialization and provide the full Faro config,
19
18
  // taking app name from it
@@ -25,7 +24,7 @@ export class TracingInstrumentation extends BaseInstrumentation {
25
24
  this.version = VERSION;
26
25
  }
27
26
  initialize() {
28
- var _a, _b, _c, _d, _e;
27
+ var _a, _b, _c, _d;
29
28
  const options = this.options;
30
29
  const attributes = {};
31
30
  if (this.config.app.name) {
@@ -55,18 +54,20 @@ export class TracingInstrumentation extends BaseInstrumentation {
55
54
  };
56
55
  },
57
56
  },
57
+ spanProcessors: [
58
+ (_a = options.spanProcessor) !== null && _a !== void 0 ? _a : new FaroMetaAttributesSpanProcessor(new BatchSpanProcessor(new FaroTraceExporter({ api: this.api }), {
59
+ scheduledDelayMillis: TracingInstrumentation.SCHEDULED_BATCH_DELAY_MS,
60
+ maxExportBatchSize: 30,
61
+ }), this.metas),
62
+ ],
58
63
  });
59
- provider.addSpanProcessor((_a = options.spanProcessor) !== null && _a !== void 0 ? _a : new FaroSessionSpanProcessor(new BatchSpanProcessor(new FaroTraceExporter({ api: this.api }), {
60
- scheduledDelayMillis: TracingInstrumentation.SCHEDULED_BATCH_DELAY_MS,
61
- maxExportBatchSize: 30,
62
- }), this.metas));
63
64
  provider.register({
64
65
  propagator: (_b = options.propagator) !== null && _b !== void 0 ? _b : new W3CTraceContextPropagator(),
65
- contextManager: (_c = options.contextManager) !== null && _c !== void 0 ? _c : new ZoneContextManager(),
66
+ contextManager: options.contextManager,
66
67
  });
67
- const { propagateTraceHeaderCorsUrls, fetchInstrumentationOptions, xhrInstrumentationOptions } = (_d = this.options.instrumentationOptions) !== null && _d !== void 0 ? _d : {};
68
+ const { propagateTraceHeaderCorsUrls, fetchInstrumentationOptions, xhrInstrumentationOptions } = (_c = this.options.instrumentationOptions) !== null && _c !== void 0 ? _c : {};
68
69
  registerInstrumentations({
69
- instrumentations: (_e = options.instrumentations) !== null && _e !== void 0 ? _e : getDefaultOTELInstrumentations({
70
+ instrumentations: (_d = options.instrumentations) !== null && _d !== void 0 ? _d : getDefaultOTELInstrumentations({
70
71
  ignoreUrls: this.getIgnoreUrls(),
71
72
  propagateTraceHeaderCorsUrls,
72
73
  fetchInstrumentationOptions,
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../src/instrumentation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAsB,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,kCAAkC,GACnC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,gCAAgC,EAChC,sBAAsB;AACtB,2CAA2C;AAC3C,gDAAgD;EACjD,MAAM,gDAAgD,CAAC;AAExD,OAAO,EAAE,mBAAmB,EAAa,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAGlE,8CAA8C;AAC9C,gEAAgE;AAChE,0BAA0B;AAE1B,MAAM,OAAO,sBAAuB,SAAQ,mBAAmB;IAM7D,YAAoB,UAAyC,EAAE;QAC7D,KAAK,EAAE,CAAC;QADU,YAAO,GAAP,OAAO,CAAoC;QAL/D,SAAI,GAAG,2BAA2B,CAAC;QACnC,YAAO,GAAG,OAAO,CAAC;IAMlB,CAAC;IAED,UAAU;;QACR,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,MAAM,UAAU,GAAuB,EAAE,CAAC;QAE1C,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE;YACxB,UAAU,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;SACtD;QAED,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE;YAC7B,UAAU,CAAC,sBAAsB,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC;SAChE;QAED,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE;YAC3B,UAAU,CAAC,oBAAoB,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC;SAC5D;QAED,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE;YAC/B,UAAU,CAAC,gCAAgC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC;YAC3E;;eAEG;YACH,UAAU,CAAC,kCAAkC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC;SAC9E;QAED,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAEtD,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;QAEpE,MAAM,QAAQ,GAAG,IAAI,iBAAiB,CAAC;YACrC,QAAQ;YACR,OAAO,EAAE;gBACP,YAAY,EAAE,GAAG,EAAE;oBACjB,OAAO;wBACL,QAAQ,EAAE,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;qBACrD,CAAC;gBACJ,CAAC;aACF;SACF,CAAC,CAAC;QAEH,QAAQ,CAAC,gBAAgB,CACvB,MAAA,OAAO,CAAC,aAAa,mCACnB,IAAI,wBAAwB,CAC1B,IAAI,kBAAkB,CAAC,IAAI,iBAAiB,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE;YAC/D,oBAAoB,EAAE,sBAAsB,CAAC,wBAAwB;YACrE,kBAAkB,EAAE,EAAE;SACvB,CAAC,EACF,IAAI,CAAC,KAAK,CACX,CACJ,CAAC;QAEF,QAAQ,CAAC,QAAQ,CAAC;YAChB,UAAU,EAAE,MAAA,OAAO,CAAC,UAAU,mCAAI,IAAI,yBAAyB,EAAE;YACjE,cAAc,EAAE,MAAA,OAAO,CAAC,cAAc,mCAAI,IAAI,kBAAkB,EAAE;SACnE,CAAC,CAAC;QAEH,MAAM,EAAE,4BAA4B,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,GAC5F,MAAA,IAAI,CAAC,OAAO,CAAC,sBAAsB,mCAAI,EAAE,CAAC;QAE5C,wBAAwB,CAAC;YACvB,gBAAgB,EACd,MAAA,OAAO,CAAC,gBAAgB,mCACxB,8BAA8B,CAAC;gBAC7B,UAAU,EAAE,IAAI,CAAC,aAAa,EAAE;gBAChC,4BAA4B;gBAC5B,2BAA2B;gBAC3B,yBAAyB;aAC1B,CAAC;SACL,CAAC,CAAC;QAEH,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACpC,CAAC;IAEO,aAAa;QACnB,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,SAAoB,EAAE,EAAE,CAAC,SAAS,CAAC,aAAa,EAAE,CAAC,CAAC;IACjG,CAAC;;AAhFM,+CAAwB,GAAG,IAAI,CAAC","sourcesContent":["import { context, trace } from '@opentelemetry/api';\nimport { ZoneContextManager } from '@opentelemetry/context-zone';\nimport { W3CTraceContextPropagator } from '@opentelemetry/core';\nimport { registerInstrumentations } from '@opentelemetry/instrumentation';\nimport { Resource, ResourceAttributes } from '@opentelemetry/resources';\nimport { BatchSpanProcessor, WebTracerProvider } from '@opentelemetry/sdk-trace-web';\nimport {\n ATTR_SERVICE_NAME,\n ATTR_SERVICE_VERSION,\n SEMRESATTRS_DEPLOYMENT_ENVIRONMENT,\n} from '@opentelemetry/semantic-conventions';\nimport {\n ATTR_DEPLOYMENT_ENVIRONMENT_NAME,\n ATTR_SERVICE_NAMESPACE,\n // False positive. Package can be resolved.\n // eslint-disable-next-line import/no-unresolved\n} from '@opentelemetry/semantic-conventions/incubating';\n\nimport { BaseInstrumentation, Transport, VERSION } from '@grafana/faro-web-sdk';\n\nimport { FaroTraceExporter } from './faroTraceExporter';\nimport { getDefaultOTELInstrumentations } from './getDefaultOTELInstrumentations';\nimport { getSamplingDecision } from './sampler';\nimport { FaroSessionSpanProcessor } from './sessionSpanProcessor';\nimport type { TracingInstrumentationOptions } from './types';\n\n// the providing of app name here is not great\n// should delay initialization and provide the full Faro config,\n// taking app name from it\n\nexport class TracingInstrumentation extends BaseInstrumentation {\n name = '@grafana/faro-web-tracing';\n version = VERSION;\n\n static SCHEDULED_BATCH_DELAY_MS = 1000;\n\n constructor(private options: TracingInstrumentationOptions = {}) {\n super();\n }\n\n initialize(): void {\n const options = this.options;\n const attributes: ResourceAttributes = {};\n\n if (this.config.app.name) {\n attributes[ATTR_SERVICE_NAME] = this.config.app.name;\n }\n\n if (this.config.app.namespace) {\n attributes[ATTR_SERVICE_NAMESPACE] = this.config.app.namespace;\n }\n\n if (this.config.app.version) {\n attributes[ATTR_SERVICE_VERSION] = this.config.app.version;\n }\n\n if (this.config.app.environment) {\n attributes[ATTR_DEPLOYMENT_ENVIRONMENT_NAME] = this.config.app.environment;\n /**\n * @deprecated will be removed in the future and has been replaced by ATTR_DEPLOYMENT_ENVIRONMENT_NAME (deployment.environment.name)\n */\n attributes[SEMRESATTRS_DEPLOYMENT_ENVIRONMENT] = this.config.app.environment;\n }\n\n Object.assign(attributes, options.resourceAttributes);\n\n const resource = Resource.default().merge(new Resource(attributes));\n\n const provider = new WebTracerProvider({\n resource,\n sampler: {\n shouldSample: () => {\n return {\n decision: getSamplingDecision(this.api.getSession()),\n };\n },\n },\n });\n\n provider.addSpanProcessor(\n options.spanProcessor ??\n new FaroSessionSpanProcessor(\n new BatchSpanProcessor(new FaroTraceExporter({ api: this.api }), {\n scheduledDelayMillis: TracingInstrumentation.SCHEDULED_BATCH_DELAY_MS,\n maxExportBatchSize: 30,\n }),\n this.metas\n )\n );\n\n provider.register({\n propagator: options.propagator ?? new W3CTraceContextPropagator(),\n contextManager: options.contextManager ?? new ZoneContextManager(),\n });\n\n const { propagateTraceHeaderCorsUrls, fetchInstrumentationOptions, xhrInstrumentationOptions } =\n this.options.instrumentationOptions ?? {};\n\n registerInstrumentations({\n instrumentations:\n options.instrumentations ??\n getDefaultOTELInstrumentations({\n ignoreUrls: this.getIgnoreUrls(),\n propagateTraceHeaderCorsUrls,\n fetchInstrumentationOptions,\n xhrInstrumentationOptions,\n }),\n });\n\n this.api.initOTEL(trace, context);\n }\n\n private getIgnoreUrls(): Array<string | RegExp> {\n return this.transports.transports.flatMap((transport: Transport) => transport.getIgnoreUrls());\n }\n}\n"]}
1
+ {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../src/instrumentation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAsB,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,kCAAkC,GACnC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,gCAAgC,EAChC,sBAAsB;AACtB,2CAA2C;AAC3C,gDAAgD;EACjD,MAAM,gDAAgD,CAAC;AAExD,OAAO,EAAE,mBAAmB,EAAa,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhF,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAGhD,8CAA8C;AAC9C,gEAAgE;AAChE,0BAA0B;AAE1B,MAAM,OAAO,sBAAuB,SAAQ,mBAAmB;IAM7D,YAAoB,UAAyC,EAAE;QAC7D,KAAK,EAAE,CAAC;QADU,YAAO,GAAP,OAAO,CAAoC;QAL/D,SAAI,GAAG,2BAA2B,CAAC;QACnC,YAAO,GAAG,OAAO,CAAC;IAMlB,CAAC;IAED,UAAU;;QACR,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,MAAM,UAAU,GAAuB,EAAE,CAAC;QAE1C,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE;YACxB,UAAU,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;SACtD;QAED,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE;YAC7B,UAAU,CAAC,sBAAsB,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC;SAChE;QAED,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE;YAC3B,UAAU,CAAC,oBAAoB,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC;SAC5D;QAED,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE;YAC/B,UAAU,CAAC,gCAAgC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC;YAC3E;;eAEG;YACH,UAAU,CAAC,kCAAkC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC;SAC9E;QAED,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAEtD,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;QAEpE,MAAM,QAAQ,GAAG,IAAI,iBAAiB,CAAC;YACrC,QAAQ;YACR,OAAO,EAAE;gBACP,YAAY,EAAE,GAAG,EAAE;oBACjB,OAAO;wBACL,QAAQ,EAAE,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;qBACrD,CAAC;gBACJ,CAAC;aACF;YACD,cAAc,EAAE;gBACd,MAAA,OAAO,CAAC,aAAa,mCACnB,IAAI,+BAA+B,CACjC,IAAI,kBAAkB,CAAC,IAAI,iBAAiB,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE;oBAC/D,oBAAoB,EAAE,sBAAsB,CAAC,wBAAwB;oBACrE,kBAAkB,EAAE,EAAE;iBACvB,CAAC,EACF,IAAI,CAAC,KAAK,CACX;aACJ;SACF,CAAC,CAAC;QAEH,QAAQ,CAAC,QAAQ,CAAC;YAChB,UAAU,EAAE,MAAA,OAAO,CAAC,UAAU,mCAAI,IAAI,yBAAyB,EAAE;YACjE,cAAc,EAAE,OAAO,CAAC,cAAc;SACvC,CAAC,CAAC;QAEH,MAAM,EAAE,4BAA4B,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,GAC5F,MAAA,IAAI,CAAC,OAAO,CAAC,sBAAsB,mCAAI,EAAE,CAAC;QAE5C,wBAAwB,CAAC;YACvB,gBAAgB,EACd,MAAA,OAAO,CAAC,gBAAgB,mCACxB,8BAA8B,CAAC;gBAC7B,UAAU,EAAE,IAAI,CAAC,aAAa,EAAE;gBAChC,4BAA4B;gBAC5B,2BAA2B;gBAC3B,yBAAyB;aAC1B,CAAC;SACL,CAAC,CAAC;QAEH,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACpC,CAAC;IAEO,aAAa;QACnB,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,SAAoB,EAAE,EAAE,CAAC,SAAS,CAAC,aAAa,EAAE,CAAC,CAAC;IACjG,CAAC;;AA/EM,+CAAwB,GAAG,IAAI,CAAC","sourcesContent":["import { context, trace } from '@opentelemetry/api';\nimport { W3CTraceContextPropagator } from '@opentelemetry/core';\nimport { registerInstrumentations } from '@opentelemetry/instrumentation';\nimport { Resource, ResourceAttributes } from '@opentelemetry/resources';\nimport { BatchSpanProcessor, WebTracerProvider } from '@opentelemetry/sdk-trace-web';\nimport {\n ATTR_SERVICE_NAME,\n ATTR_SERVICE_VERSION,\n SEMRESATTRS_DEPLOYMENT_ENVIRONMENT,\n} from '@opentelemetry/semantic-conventions';\nimport {\n ATTR_DEPLOYMENT_ENVIRONMENT_NAME,\n ATTR_SERVICE_NAMESPACE,\n // False positive. Package can be resolved.\n // eslint-disable-next-line import/no-unresolved\n} from '@opentelemetry/semantic-conventions/incubating';\n\nimport { BaseInstrumentation, Transport, VERSION } from '@grafana/faro-web-sdk';\n\nimport { FaroMetaAttributesSpanProcessor } from './faroMetaAttributesSpanProcessor';\nimport { FaroTraceExporter } from './faroTraceExporter';\nimport { getDefaultOTELInstrumentations } from './getDefaultOTELInstrumentations';\nimport { getSamplingDecision } from './sampler';\nimport type { TracingInstrumentationOptions } from './types';\n\n// the providing of app name here is not great\n// should delay initialization and provide the full Faro config,\n// taking app name from it\n\nexport class TracingInstrumentation extends BaseInstrumentation {\n name = '@grafana/faro-web-tracing';\n version = VERSION;\n\n static SCHEDULED_BATCH_DELAY_MS = 1000;\n\n constructor(private options: TracingInstrumentationOptions = {}) {\n super();\n }\n\n initialize(): void {\n const options = this.options;\n const attributes: ResourceAttributes = {};\n\n if (this.config.app.name) {\n attributes[ATTR_SERVICE_NAME] = this.config.app.name;\n }\n\n if (this.config.app.namespace) {\n attributes[ATTR_SERVICE_NAMESPACE] = this.config.app.namespace;\n }\n\n if (this.config.app.version) {\n attributes[ATTR_SERVICE_VERSION] = this.config.app.version;\n }\n\n if (this.config.app.environment) {\n attributes[ATTR_DEPLOYMENT_ENVIRONMENT_NAME] = this.config.app.environment;\n /**\n * @deprecated will be removed in the future and has been replaced by ATTR_DEPLOYMENT_ENVIRONMENT_NAME (deployment.environment.name)\n */\n attributes[SEMRESATTRS_DEPLOYMENT_ENVIRONMENT] = this.config.app.environment;\n }\n\n Object.assign(attributes, options.resourceAttributes);\n\n const resource = Resource.default().merge(new Resource(attributes));\n\n const provider = new WebTracerProvider({\n resource,\n sampler: {\n shouldSample: () => {\n return {\n decision: getSamplingDecision(this.api.getSession()),\n };\n },\n },\n spanProcessors: [\n options.spanProcessor ??\n new FaroMetaAttributesSpanProcessor(\n new BatchSpanProcessor(new FaroTraceExporter({ api: this.api }), {\n scheduledDelayMillis: TracingInstrumentation.SCHEDULED_BATCH_DELAY_MS,\n maxExportBatchSize: 30,\n }),\n this.metas\n ),\n ],\n });\n\n provider.register({\n propagator: options.propagator ?? new W3CTraceContextPropagator(),\n contextManager: options.contextManager,\n });\n\n const { propagateTraceHeaderCorsUrls, fetchInstrumentationOptions, xhrInstrumentationOptions } =\n this.options.instrumentationOptions ?? {};\n\n registerInstrumentations({\n instrumentations:\n options.instrumentations ??\n getDefaultOTELInstrumentations({\n ignoreUrls: this.getIgnoreUrls(),\n propagateTraceHeaderCorsUrls,\n fetchInstrumentationOptions,\n xhrInstrumentationOptions,\n }),\n });\n\n this.api.initOTEL(trace, context);\n }\n\n private getIgnoreUrls(): Array<string | RegExp> {\n return this.transports.transports.flatMap((transport: Transport) => transport.getIgnoreUrls());\n }\n}\n"]}
@@ -1,6 +1,10 @@
1
1
  // False positive. Package can be resolved.
2
2
  // eslint-disable-next-line import/no-unresolved
3
3
  import { ATTR_SESSION_ID } from '@opentelemetry/semantic-conventions/incubating';
4
+ /**
5
+ * @deprecated
6
+ * please use FaroMetaAttributesSpanProcessor instead
7
+ */
4
8
  export class FaroSessionSpanProcessor {
5
9
  constructor(processor, metas) {
6
10
  this.processor = processor;
@@ -1 +1 @@
1
- {"version":3,"file":"sessionSpanProcessor.js","sourceRoot":"","sources":["../../src/sessionSpanProcessor.ts"],"names":[],"mappings":"AAEA,2CAA2C;AAC3C,gDAAgD;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AAIjF,MAAM,OAAO,wBAAwB;IACnC,YACU,SAAwB,EACxB,KAAY;QADZ,cAAS,GAAT,SAAS,CAAe;QACxB,UAAK,GAAL,KAAK,CAAO;IACnB,CAAC;IAEJ,UAAU;QACR,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC;IAED,OAAO,CAAC,IAAU,EAAE,aAAsB;QACxC,MAAM,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,eAAe,CAAC,GAAG,OAAO,CAAC,EAAE,CAAC;YAC9C;;eAEG;YACH,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,EAAE,CAAC;SAC5C;QAED,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,IAAkB;QACtB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;IACnC,CAAC;CACF","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 FaroSessionSpanProcessor 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 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":"sessionSpanProcessor.js","sourceRoot":"","sources":["../../src/sessionSpanProcessor.ts"],"names":[],"mappings":"AAEA,2CAA2C;AAC3C,gDAAgD;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AAIjF;;;GAGG;AACH,MAAM,OAAO,wBAAwB;IACnC,YACU,SAAwB,EACxB,KAAY;QADZ,cAAS,GAAT,SAAS,CAAe;QACxB,UAAK,GAAL,KAAK,CAAO;IACnB,CAAC;IAEJ,UAAU;QACR,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC;IAED,OAAO,CAAC,IAAU,EAAE,aAAsB;QACxC,MAAM,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,eAAe,CAAC,GAAG,OAAO,CAAC,EAAE,CAAC;YAC9C;;eAEG;YACH,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,EAAE,CAAC;SAC5C;QAED,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,IAAkB;QACtB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;IACnC,CAAC;CACF","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\n/**\n * @deprecated\n * please use FaroMetaAttributesSpanProcessor instead\n */\nexport class FaroSessionSpanProcessor 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 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"]}
@@ -0,0 +1,12 @@
1
+ import type { Context } from '@opentelemetry/api';
2
+ import type { ReadableSpan, Span, SpanProcessor } from '@opentelemetry/sdk-trace-web';
3
+ import type { Metas } from '@grafana/faro-web-sdk';
4
+ export declare class FaroMetaAttributesSpanProcessor implements SpanProcessor {
5
+ private processor;
6
+ private metas;
7
+ constructor(processor: SpanProcessor, metas: Metas);
8
+ forceFlush(): Promise<void>;
9
+ onStart(span: Span, parentContext: Context): void;
10
+ onEnd(span: ReadableSpan): void;
11
+ shutdown(): Promise<void>;
12
+ }
@@ -1,6 +1,10 @@
1
1
  import type { Context } from '@opentelemetry/api';
2
2
  import type { ReadableSpan, Span, SpanProcessor } from '@opentelemetry/sdk-trace-web';
3
3
  import type { Metas } from '@grafana/faro-web-sdk';
4
+ /**
5
+ * @deprecated
6
+ * please use FaroMetaAttributesSpanProcessor instead
7
+ */
4
8
  export declare class FaroSessionSpanProcessor implements SpanProcessor {
5
9
  private processor;
6
10
  private metas;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/faro-web-tracing",
3
- "version": "1.13.3",
3
+ "version": "1.14.1",
4
4
  "description": "Faro web tracing implementation.",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -55,9 +55,8 @@
55
55
  "quality:circular-deps": "madge --circular ."
56
56
  },
57
57
  "dependencies": {
58
- "@grafana/faro-web-sdk": "^1.13.3",
58
+ "@grafana/faro-web-sdk": "^1.14.1",
59
59
  "@opentelemetry/api": "^1.9.0",
60
- "@opentelemetry/context-zone": "1.30.1",
61
60
  "@opentelemetry/core": "^1.30.0",
62
61
  "@opentelemetry/exporter-trace-otlp-http": "^0.57.0",
63
62
  "@opentelemetry/instrumentation": "^0.57.0",
@@ -71,5 +70,5 @@
71
70
  "publishConfig": {
72
71
  "access": "public"
73
72
  },
74
- "gitHead": "4b4b38438abc72a7992bac93c7f23ac1793a9285"
73
+ "gitHead": "b44d0c2a52419786a497fbf3f47b781d27cc0982"
75
74
  }