@sumologic/opentelemetry-rum
Version:
Adds OpenTelemetry tracing auto-instrumentation in the browser. Collects spans on network events and sends them to Sumo Logic.
1 lines • 147 kB
JavaScript
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{},e="1.8.0",n=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;var r=function(t){var e=new Set([t]),r=new Set,i=t.match(n);if(!i)return function(){return!1};var o=+i[1],s=+i[2],a=+i[3];if(null!=i[4])return function(e){return e===t};function u(t){return r.add(t),!1}function c(t){return e.add(t),!0}return function(t){if(e.has(t))return!0;if(r.has(t))return!1;var i=t.match(n);if(!i)return u(t);var l=+i[1],d=+i[2],p=+i[3];return null!=i[4]||o!==l?u(t):0===o?s===d&&a<=p?c(t):u(t):s<=d?c(t):u(t)}}(e),i=e.split(".")[0],o=Symbol.for("opentelemetry.js.api."+i),s=t;function a(t,n,r,i){var a;void 0===i&&(i=!1);var u=s[o]=null!==(a=s[o])&&void 0!==a?a:{version:e};if(!i&&u[t]){var c=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+t);return r.error(c.stack||c.message),!1}if(u.version!==e){c=new Error("@opentelemetry/api: Registration of version v"+u.version+" for "+t+" does not match previously registered API v"+e);return r.error(c.stack||c.message),!1}return u[t]=n,r.debug("@opentelemetry/api: Registered a global for "+t+" v"+e+"."),!0}function u(t){var e,n,i=null===(e=s[o])||void 0===e?void 0:e.version;if(i&&r(i))return null===(n=s[o])||void 0===n?void 0:n[t]}function c(t,n){n.debug("@opentelemetry/api: Unregistering a global for "+t+" v"+e+".");var r=s[o];r&&delete r[t]}var l,d=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},p=function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))},h=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 f("debug",this._namespace,t)},t.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return f("error",this._namespace,t)},t.prototype.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return f("info",this._namespace,t)},t.prototype.warn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return f("warn",this._namespace,t)},t.prototype.verbose=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return f("verbose",this._namespace,t)},t}();function f(t,e,n){var r=u("diag");if(r)return n.unshift(e),r[t].apply(r,p([],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"}(l||(l={}));var _=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},m=function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);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=u("diag");if(r)return r[t].apply(r,m([],_(e),!1))}}var e=this;e.setLogger=function(t,n){var r,i,o;if(void 0===n&&(n={logLevel:l.INFO}),t===e){var s=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return e.error(null!==(r=s.stack)&&void 0!==r?r:s.message),!1}"number"==typeof n&&(n={logLevel:n});var c=u("diag"),d=function(t,e){function n(n,r){var i=e[n];return"function"==typeof i&&t>=r?i.bind(e):function(){}}return t<l.NONE?t=l.NONE:t>l.ALL&&(t=l.ALL),e=e||{},{error:n("error",l.ERROR),warn:n("warn",l.WARN),info:n("info",l.INFO),debug:n("debug",l.DEBUG),verbose:n("verbose",l.VERBOSE)}}(null!==(i=n.logLevel)&&void 0!==i?i:l.INFO,t);if(c&&!n.suppressOverrideMessage){var p=null!==(o=(new Error).stack)&&void 0!==o?o:"<failed to generate stacktrace>";c.warn("Current logger will be overwritten from "+p),d.warn("Current logger will overwrite one already registered from "+p)}return a("diag",d,e,!0)},e.disable=function(){c("diag",e)},e.createComponentLogger=function(t){return new h(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}(),g=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},T=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.")},v=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=g(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=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var o=new t(this._entries);try{for(var s=T(r),a=s.next();!a.done;a=s.next()){var u=a.value;o._entries.delete(u)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}return o},t.prototype.clear=function(){return new t},t}(),y=Symbol("BaggageEntryMetadata"),b=E.instance();function S(t){return void 0===t&&(t={}),new v(new Map(Object.entries(t)))}function O(t){return"string"!=typeof t&&(b.error("Cannot create baggage metadata from unknown type: "+typeof t),t=""),{__TYPE__:y,toString:function(){return t}}}function R(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 i=new t(n._currentContext);return i._currentContext.set(e,r),i},n.deleteValue=function(e){var r=new t(n._currentContext);return r._currentContext.delete(e),r}},N=new A,P=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],C=function(){function t(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(console){var r=console[t];if("function"!=typeof r&&(r=console.log),"function"==typeof r)return r.apply(console,e)}}}for(var e=0;e<P.length;e++)this[P[e].n]=t(P[e].c)},I=(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)}),x=function(){function t(){}return t.prototype.createHistogram=function(t,e){return X},t.prototype.createCounter=function(t,e){return G},t.prototype.createUpDownCounter=function(t,e){return z},t.prototype.createObservableGauge=function(t,e){return q},t.prototype.createObservableCounter=function(t,e){return $},t.prototype.createObservableUpDownCounter=function(t,e){return W},t.prototype.addBatchObservableCallback=function(t,e){},t.prototype.removeBatchObservableCallback=function(t){},t}(),M=function(){},U=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.add=function(t,e){},e}(M),D=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.add=function(t,e){},e}(M),k=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.record=function(t,e){},e}(M),B=function(){function t(){}return t.prototype.addCallback=function(t){},t.prototype.removeCallback=function(t){},t}(),j=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e}(B),H=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e}(B),F=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e}(B),V=new x,G=new U,X=new k,z=new D,$=new j,q=new H,W=new F;!function(t){t[t.INT=0]="INT",t[t.DOUBLE=1]="DOUBLE"}(w||(w={}));var K,Y={get:function(t,e){if(null!=t)return t[e]},keys:function(t){return null==t?[]:Object.keys(t)}},Q={set:function(t,e,n){null!=t&&(t[e]=n)}},Z=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},J=function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))},tt=function(){function t(){}return t.prototype.active=function(){return N},t.prototype.with=function(t,e,n){for(var r=[],i=3;i<arguments.length;i++)r[i-3]=arguments[i];return e.call.apply(e,J([n],Z(r),!1))},t.prototype.bind=function(t,e){return e},t.prototype.enable=function(){return this},t.prototype.disable=function(){return this},t}(),et=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},nt=function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))},rt="context",it=new tt,ot=function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalContextManager=function(t){return a(rt,t,E.instance())},t.prototype.active=function(){return this._getContextManager().active()},t.prototype.with=function(t,e,n){for(var r,i=[],o=3;o<arguments.length;o++)i[o-3]=arguments[o];return(r=this._getContextManager()).with.apply(r,nt([t,e,n],et(i),!1))},t.prototype.bind=function(t,e){return this._getContextManager().bind(t,e)},t.prototype._getContextManager=function(){return u(rt)||it},t.prototype.disable=function(){this._getContextManager().disable(),c(rt,E.instance())},t}();!function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"}(K||(K={}));var st="0000000000000000",at="00000000000000000000000000000000",ut={traceId:at,spanId:st,traceFlags:K.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.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=R("OpenTelemetry Context Key SPAN");function dt(t){return t.getValue(lt)||void 0}function pt(){return dt(ot.getInstance().active())}function ht(t,e){return t.setValue(lt,e)}function ft(t){return t.deleteValue(lt)}function _t(t,e){return ht(t,new ct(e))}function mt(t){var e;return null===(e=dt(t))||void 0===e?void 0:e.spanContext()}var Et=/^([0-9a-f]{32})$/i,gt=/^[0-9a-f]{16}$/i;function Tt(t){return Et.test(t)&&t!==at}function vt(t){return gt.test(t)&&t!==st}function yt(t){return Tt(t.traceId)&&vt(t.spanId)}function bt(t){return new ct(t)}var St=ot.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,i=n&&mt(n);return"object"==typeof(r=i)&&"string"==typeof r.spanId&&"string"==typeof r.traceId&&"number"==typeof r.traceFlags&&yt(i)?new ct(i):new ct},t.prototype.startActiveSpan=function(t,e,n,r){var i,o,s;if(!(arguments.length<2)){2===arguments.length?s=e:3===arguments.length?(i=e,s=n):(i=e,o=n,s=r);var a=null!=o?o:St.active(),u=this.startSpan(t,i,a),c=ht(a,u);return St.with(c,s,void 0,u)}},t}();var Rt,Lt,wt,At=new Ot,Nt=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 i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,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):At},t}(),Pt=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 Nt(this,t,e,n)},t.prototype.getDelegate=function(){var t;return null!==(t=this._delegate)&&void 0!==t?t:Pt},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"}(Rt||(Rt={})),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"}(Lt||(Lt={})),function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"}(wt||(wt={}));var It="[_0-9a-z-*/]",xt=new RegExp("^(?:"+("[a-z]"+It+"{0,255}")+"|"+("[a-z0-9]"+It+"{0,240}@[a-z]"+It+"{0,13}")+")$"),Mt=/^[ -~]{0,255}[!-~]$/,Ut=/,|=/;var Dt=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 i=n.slice(0,r),o=n.slice(r+1,e.length);(function(t){return xt.test(t)})(i)&&function(t){return Mt.test(t)&&!Ut.test(t)}(o)&&t.set(i,o)}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}();var kt=ot.getInstance(),Bt=E.instance(),jt=new(function(){function t(){}return t.prototype.getMeter=function(t,e,n){return V},t}()),Ht="metrics",Ft=function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalMeterProvider=function(t){return a(Ht,t,E.instance())},t.prototype.getMeterProvider=function(){return u(Ht)||jt},t.prototype.getMeter=function(t,e,n){return this.getMeterProvider().getMeter(t,e,n)},t.prototype.disable=function(){c(Ht,E.instance())},t}(),Vt=Ft.getInstance(),Gt=function(){function t(){}return t.prototype.inject=function(t,e){},t.prototype.extract=function(t,e){return t},t.prototype.fields=function(){return[]},t}(),Xt=R("OpenTelemetry Baggage Key");function zt(t){return t.getValue(Xt)||void 0}function $t(){return zt(ot.getInstance().active())}function qt(t,e){return t.setValue(Xt,e)}function Wt(t){return t.deleteValue(Xt)}var Kt="propagation",Yt=new Gt,Qt=function(){function t(){this.createBaggage=S,this.getBaggage=zt,this.getActiveBaggage=$t,this.setBaggage=qt,this.deleteBaggage=Wt}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalPropagator=function(t){return a(Kt,t,E.instance())},t.prototype.inject=function(t,e,n){return void 0===n&&(n=Q),this._getGlobalPropagator().inject(t,e,n)},t.prototype.extract=function(t,e,n){return void 0===n&&(n=Y),this._getGlobalPropagator().extract(t,e,n)},t.prototype.fields=function(){return this._getGlobalPropagator().fields()},t.prototype.disable=function(){c(Kt,E.instance())},t.prototype._getGlobalPropagator=function(){return u(Kt)||Yt},t}(),Zt=Qt.getInstance(),Jt="trace",te=function(){function t(){this._proxyTracerProvider=new Ct,this.wrapSpanContext=bt,this.isSpanContextValid=yt,this.deleteSpan=ft,this.getSpan=dt,this.getActiveSpan=pt,this.getSpanContext=mt,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=a(Jt,this._proxyTracerProvider,E.instance());return e&&this._proxyTracerProvider.setDelegate(t),e},t.prototype.getTracerProvider=function(){return u(Jt)||this._proxyTracerProvider},t.prototype.getTracer=function(t,e){return this.getTracerProvider().getTracer(t,e)},t.prototype.disable=function(){c(Jt,E.instance()),this._proxyTracerProvider=new Ct},t}(),ee=te.getInstance(),ne={context:kt,diag:Bt,metrics:Vt,propagation:Zt,trace:ee},re=Object.freeze({__proto__:null,context:kt,diag:Bt,metrics:Vt,propagation:Zt,trace:ee,default:ne,baggageEntryMetadataFromString:O,createContextKey:R,ROOT_CONTEXT:N,DiagConsoleLogger:C,get DiagLogLevel(){return l},createNoopMeter:function(){return V},get ValueType(){return w},defaultTextMapGetter:Y,defaultTextMapSetter:Q,ProxyTracer:Nt,ProxyTracerProvider:Ct,get SamplingDecision(){return Rt},get SpanKind(){return Lt},get SpanStatusCode(){return wt},get TraceFlags(){return K},createTraceState:function(t){return new Dt(t)},isSpanContextValid:yt,isValidTraceId:Tt,isValidSpanId:vt,INVALID_SPANID:st,INVALID_TRACEID:at,INVALID_SPAN_CONTEXT:ut}),ie=R("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function oe(t){return!0===t.getValue(ie)}var se=",",ae="baggage",ue=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s};function ce(t){var e=t.split(";");if(!(e.length<=0)){var n=e.shift();if(n){var r=n.indexOf("=");if(!(r<=0)){var i,o=decodeURIComponent(n.substring(0,r).trim()),s=decodeURIComponent(n.substring(r+1).trim());return e.length>0&&(i=O(e.join(";"))),{key:o,value:s,metadata:i}}}}}function le(t){return"string"!=typeof t||0===t.length?{}:t.split(se).map(function(t){return ce(t)}).filter(function(t){return void 0!==t&&t.value.length>0}).reduce(function(t,e){return t[e.key]=e.value,t},{})}var de=function(){function t(){}return t.prototype.inject=function(t,e,n){var r=Zt.getBaggage(t);if(r&&!oe(t)){var i=function(t){return t.getAllEntries().map(function(t){var e=ue(t,2),n=e[0],r=e[1],i=encodeURIComponent(n)+"="+encodeURIComponent(r.value);return void 0!==r.metadata&&(i+=";"+r.metadata.toString()),i})}(r).filter(function(t){return t.length<=4096}).slice(0,180),o=function(t){return t.reduce(function(t,e){var n=""+t+(""!==t?se:"")+e;return n.length>8192?t:n},"")}(i);o.length>0&&n.set(e,ae,o)}},t.prototype.extract=function(t,e,n){var r=n.get(e,ae),i=Array.isArray(r)?r.join(se):r;if(!i)return t;var o={};return 0===i.length?t:(i.split(se).forEach(function(t){var e=ce(t);if(e){var n={value:e.value};e.metadata&&(n.metadata=e.metadata),o[e.key]=n}}),0===Object.entries(o).length?t:Zt.setBaggage(t,Zt.createBaggage(o)))},t.prototype.fields=function(){return[ae]},t}(),pe=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.")},he=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s};function fe(t){var e,n,r={};if("object"!=typeof t||null==t)return r;try{for(var i=pe(Object.entries(t)),o=i.next();!o.done;o=i.next()){var s=he(o.value,2),a=s[0],u=s[1];_e(a)?me(u)?Array.isArray(u)?r[a]=u.slice():r[a]=u:Bt.warn("Invalid attribute value set for key: "+a):Bt.warn("Invalid attribute key: "+a)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}function _e(t){return"string"==typeof t&&t.length>0}function me(t){return null==t||(Array.isArray(t)?function(t){var e,n,r;try{for(var i=pe(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(null!=s){if(!r){if(Ee(s)){r=typeof s;continue}return!1}if(typeof s!==r)return!1}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return!0}(t):Ee(t))}function Ee(t){switch(typeof t){case"number":case"boolean":case"string":return!0}return!1}var ge,Te=function(t){Bt.error(function(t){return"string"==typeof t?t:JSON.stringify(function(t){for(var e={},n=t;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))};function ve(t){try{Te(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"}(ge||(ge={}));var ye="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{},be=["OTEL_SDK_DISABLED"];function Se(t){return be.indexOf(t)>-1}var Oe=["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 Re(t){return Oe.indexOf(t)>-1}var Le=["OTEL_NO_PATCH_MODULES","OTEL_PROPAGATORS"];function we(t){return Le.indexOf(t)>-1}var Ae=1/0,Ne=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:l.INFO,OTEL_NO_PATCH_MODULES:[],OTEL_PROPAGATORS:["tracecontext","baggage"],OTEL_RESOURCE_ATTRIBUTES:"",OTEL_SERVICE_NAME:"",OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT:Ae,OTEL_ATTRIBUTE_COUNT_LIMIT:Ne,OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT:Ae,OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT:Ne,OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT:Ae,OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT:Ne,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:ge.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"};function Ce(t,e,n){if(void 0!==n[t]){var r=String(n[t]);e[t]="true"===r.toLowerCase()}}function Ie(t,e,n,r,i){if(void 0===r&&(r=-1/0),void 0===i&&(i=1/0),void 0!==n[t]){var o=Number(n[t]);isNaN(o)||(e[t]=o<r?r:o>i?i:o)}}function xe(t,e,n,r){void 0===r&&(r=",");var i=n[t];"string"==typeof i&&(e[t]=i.split(r).map(function(t){return t.trim()}))}var Me={ALL:l.ALL,VERBOSE:l.VERBOSE,DEBUG:l.DEBUG,INFO:l.INFO,WARN:l.WARN,ERROR:l.ERROR,NONE:l.NONE};function Ue(t,e,n){var r=n[t];if("string"==typeof r){var i=Me[r.toUpperCase()];null!=i&&(e[t]=i)}}function De(t){var e={};for(var n in Pe){var r=n;if("OTEL_LOG_LEVEL"===r)Ue(r,e,t);else if(Se(r))Ce(r,e,t);else if(Re(r))Ie(r,e,t);else if(we(r))xe(r,e,t);else{var i=t[r];null!=i&&(e[r]=String(i))}}return e}function ke(){var t=De(ye);return Object.assign({},Pe,t)}function Be(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 i=Be(t.charCodeAt(r)),o=Be(t.charCodeAt(r+1));e[n++]=i<<4|o}return e}var He=function(){this.generateTraceId=Ve(16),this.generateSpanId=Ve(8)},Fe=Array(32);function Ve(t){return function(){for(var e=0;e<2*t;e++)Fe[e]=Math.floor(16*Math.random())+48,Fe[e]>=58&&(Fe[e]+=39);return String.fromCharCode.apply(null,Fe.slice(0,2*t))}}var Ge=performance;function Xe(t){for(var e={},n=t.length,r=0;r<n;r++){var i=t[r];i&&(e[String(i).toUpperCase().replace(/[-.]/g,"_")]=i)}return e}var ze,$e=Xe(["aws.lambda.invoked_arn","db.system","db.connection_string","db.user","db.jdbc.driver_classname","db.name","db.statement","db.operation","db.mssql.instance_name","db.cassandra.keyspace","db.cassandra.page_size","db.cassandra.consistency_level","db.cassandra.table","db.cassandra.idempotence","db.cassandra.speculative_execution_count","db.cassandra.coordinator.id","db.cassandra.coordinator.dc","db.hbase.namespace","db.redis.database_index","db.mongodb.collection","db.sql.table","exception.type","exception.message","exception.stacktrace","exception.escaped","faas.trigger","faas.execution","faas.document.collection","faas.document.operation","faas.document.time","faas.document.name","faas.time","faas.cron","faas.coldstart","faas.invoked_name","faas.invoked_provider","faas.invoked_region","net.transport","net.peer.ip","net.peer.port","net.peer.name","net.host.ip","net.host.port","net.host.name","net.host.connection.type","net.host.connection.subtype","net.host.carrier.name","net.host.carrier.mcc","net.host.carrier.mnc","net.host.carrier.icc","peer.service","enduser.id","enduser.role","enduser.scope","thread.id","thread.name","code.function","code.namespace","code.filepath","code.lineno","http.method","http.url","http.target","http.host","http.scheme","http.status_code","http.flavor","http.user_agent","http.request_content_length","http.request_content_length_uncompressed","http.response_content_length","http.response_content_length_uncompressed","http.server_name","http.route","http.client_ip","aws.dynamodb.table_names","aws.dynamodb.consumed_capacity","aws.dynamodb.item_collection_metrics","aws.dynamodb.provisioned_read_capacity","aws.dynamodb.provisioned_write_capacity","aws.dynamodb.consistent_read","aws.dynamodb.projection","aws.dynamodb.limit","aws.dynamodb.attributes_to_get","aws.dynamodb.index_name","aws.dynamodb.select","aws.dynamodb.global_secondary_indexes","aws.dynamodb.local_secondary_indexes","aws.dynamodb.exclusive_start_table","aws.dynamodb.table_count","aws.dynamodb.scan_forward","aws.dynamodb.segment","aws.dynamodb.total_segments","aws.dynamodb.count","aws.dynamodb.scanned_count","aws.dynamodb.attribute_definitions","aws.dynamodb.global_secondary_index_updates","messaging.system","messaging.destination","messaging.destination_kind","messaging.temp_destination","messaging.protocol","messaging.protocol_version","messaging.url","messaging.message_id","messaging.conversation_id","messaging.message_payload_size_bytes","messaging.message_payload_compressed_size_bytes","messaging.operation","messaging.consumer_id","messaging.rabbitmq.routing_key","messaging.kafka.message_key","messaging.kafka.consumer_group","messaging.kafka.client_id","messaging.kafka.partition","messaging.kafka.tombstone","rpc.system","rpc.service","rpc.method","rpc.grpc.status_code","rpc.jsonrpc.version","rpc.jsonrpc.request_id","rpc.jsonrpc.error_code","rpc.jsonrpc.error_message","message.type","message.id","message.compressed_size","message.uncompressed_size"]),qe=Xe(["cloud.provider","cloud.account.id","cloud.region","cloud.availability_zone","cloud.platform","aws.ecs.container.arn","aws.ecs.cluster.arn","aws.ecs.launchtype","aws.ecs.task.arn","aws.ecs.task.family","aws.ecs.task.revision","aws.eks.cluster.arn","aws.log.group.names","aws.log.group.arns","aws.log.stream.names","aws.log.stream.arns","container.name","container.id","container.runtime","container.image.name","container.image.tag","deployment.environment","device.id","device.model.identifier","device.model.name","faas.name","faas.id","faas.version","faas.instance","faas.max_memory","host.id","host.name","host.type","host.arch","host.image.name","host.image.id","host.image.version","k8s.cluster.name","k8s.node.name","k8s.node.uid","k8s.namespace.name","k8s.pod.uid","k8s.pod.name","k8s.container.name","k8s.replicaset.uid","k8s.replicaset.name","k8s.deployment.uid","k8s.deployment.name","k8s.statefulset.uid","k8s.statefulset.name","k8s.daemonset.uid","k8s.daemonset.name","k8s.job.uid","k8s.job.name","k8s.cronjob.uid","k8s.cronjob.name","os.type","os.description","os.name","os.version","process.pid","process.executable.name","process.executable.path","process.command","process.command_line","process.command_args","process.owner","process.runtime.name","process.runtime.version","process.runtime.description","service.name","service.namespace","service.instance.id","service.version","telemetry.sdk.name","telemetry.sdk.language","telemetry.sdk.version","telemetry.auto.version","webengine.name","webengine.version","webengine.description"]),We=Xe(["cpp","dotnet","erlang","go","java","nodejs","php","python","ruby","webjs"]),Ke=((ze={})[qe.TELEMETRY_SDK_NAME]="opentelemetry",ze[qe.PROCESS_RUNTIME_NAME]="browser",ze[qe.TELEMETRY_SDK_LANGUAGE]=We.WEBJS,ze[qe.TELEMETRY_SDK_VERSION]="1.22.0",ze);var Ye,Qe=Math.pow(10,6),Ze=Math.pow(10,9);function Je(t){var e=t/1e3;return[Math.trunc(e),Math.round(t%1e3*Qe)]}function tn(){var t=Ge.timeOrigin;if("number"!=typeof t){var e=Ge;t=e.timing&&e.timing.fetchStart}return t}function en(t){return un(Je(tn()),Je("number"==typeof t?t:Ge.now()))}function nn(t){if(sn(t))return t;if("number"==typeof t)return t<tn()?en(t):Je(t);if(t instanceof Date)return Je(t.getTime());throw TypeError("Invalid input type")}function rn(t){return t[0]*Ze+t[1]}function on(t){return 1e6*t[0]+t[1]/1e3}function sn(t){return Array.isArray(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]}function an(t){return sn(t)||"number"==typeof t||t instanceof Date}function un(t,e){var n=[t[0]+e[0],t[1]+e[1]];return n[1]>=Ze&&(n[1]-=Ze,n[0]+=1),n}!function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"}(Ye||(Ye={}));var cn=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.")},ln=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,i;try{for(var o=cn(this._propagators),s=o.next();!s.done;s=o.next()){var a=s.value;try{a.inject(t,e,n)}catch(t){Bt.warn("Failed to inject with "+a.constructor.name+". Err: "+t.message)}}}catch(t){r={error:t}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}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){Bt.warn("Failed to inject with "+r.constructor.name+". Err: "+t.message)}return t},t)},t.prototype.fields=function(){return this._fields.slice()},t}(),dn="[_0-9a-z-*/]",pn=new RegExp("^(?:"+("[a-z]"+dn+"{0,255}")+"|"+("[a-z0-9]"+dn+"{0,240}@[a-z]"+dn+"{0,13}")+")$"),hn=/^[ -~]{0,255}[!-~]$/,fn=/,|=/;var _n=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 i=n.slice(0,r),o=n.slice(r+1,e.length);(function(t){return pn.test(t)})(i)&&function(t){return hn.test(t)&&!fn.test(t)}(o)&&t.set(i,o)}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}(),mn="traceparent",En="tracestate",gn=new RegExp("^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$");var Tn,vn,yn=function(){function t(){}return t.prototype.inject=function(t,e,n){var r=ee.getSpanContext(t);if(r&&!oe(t)&&yt(r)){var i="00-"+r.traceId+"-"+r.spanId+"-0"+Number(r.traceFlags||K.NONE).toString(16);n.set(e,mn,i),r.traceState&&n.set(e,En,r.traceState.serialize())}},t.prototype.extract=function(t,e,n){var r=n.get(e,mn);if(!r)return t;var i=Array.isArray(r)?r[0]:r;if("string"!=typeof i)return t;var o=function(t){var e=gn.exec(t);return e?"00"===e[1]&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}:null}(i);if(!o)return t;o.isRemote=!0;var s=n.get(e,En);if(s){var a=Array.isArray(s)?s.join(","):s;o.traceState=new _n("string"==typeof a?a:void 0)}return ee.setSpanContext(t,o)},t.prototype.fields=function(){return[mn,En]},t}(),bn="[object Null]",Sn="[object Undefined]",On=Function.prototype.toString,Rn=On.call(Object),Ln=(Tn=Object.getPrototypeOf,vn=Object,function(t){return Tn(vn(t))}),wn=Object.prototype,An=wn.hasOwnProperty,Nn=Symbol?Symbol.toStringTag:void 0,Pn=wn.toString;function Cn(t){if(!function(t){return null!=t&&"object"==typeof t}(t)||"[object Object]"!==function(t){if(null==t)return void 0===t?Sn:bn;return Nn&&Nn in Object(t)?function(t){var e=An.call(t,Nn),n=t[Nn],r=!1;try{t[Nn]=void 0,r=!0}catch(t){}var i=Pn.call(t);r&&(e?t[Nn]=n:delete t[Nn]);return i}(t):function(t){return Pn.call(t)}(t)}(t))return!1;var e=Ln(t);if(null===e)return!0;var n=An.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&On.call(n)===Rn}function In(t){return Un(t)?t.slice():t}function xn(t,e,n,r){var i;if(void 0===n&&(n=0),!(n>20)){if(n++,Bn(t)||Bn(e)||Dn(e))i=In(e);else if(Un(t)){if(i=t.slice(),Un(e))for(var o=0,s=e.length;o<s;o++)i.push(In(e[o]));else if(kn(e))for(o=0,s=(a=Object.keys(e)).length;o<s;o++){i[u=a[o]]=In(e[u])}}else if(kn(t))if(kn(e)){if(!function(t,e){if(!Cn(t)||!Cn(e))return!1;return!0}(t,e))return e;i=Object.assign({},t);var a;for(o=0,s=(a=Object.keys(e)).length;o<s;o++){var u,c=e[u=a[o]];if(Bn(c))void 0===c?delete i[u]:i[u]=c;else{var l=i[u],d=c;if(Mn(t,u,r)||Mn(e,u,r))delete i[u];else{if(kn(l)&&kn(d)){var p=r.get(l)||[],h=r.get(d)||[];p.push({obj:t,key:u}),h.push({obj:e,key:u}),r.set(l,p),r.set(d,h)}i[u]=xn(i[u],c,n,r)}}}}else i=e;return i}}function Mn(t,e,n){for(var r=n.get(t[e])||[],i=0,o=r.length;i<o;i++){var s=r[i];if(s.key===e&&s.obj===t)return!0}return!1}function Un(t){return Array.isArray(t)}function Dn(t){return"function"==typeof t}function kn(t){return!Bn(t)&&!Un(t)&&!Dn(t)&&"object"==typeof t}function Bn(t){return"string"==typeof t||"number"==typeof t||"boolean"==typeof t||void 0===t||t instanceof Date||t instanceof RegExp||null===t}var jn=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 Hn(t,e){return"string"==typeof e?t===e:!!t.match(e)}function Fn(t,e){var n,r;if(!e)return!1;try{for(var i=jn(e),o=i.next();!o.done;o=i.next()){if(Hn(t,o.value))return!0}}catch(t){n={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!1}var Vn,Gn=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}(),Xn=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},zn=function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))},$n=function(){function t(t,e){this._callback=t,this._that=e,this._isCalled=!1,this._deferred=new Gn}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,zn([this._that],Xn(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}(),qn=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.")},Wn=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},Kn=function(){function t(t,e,n,r,i,o,s,a,u,c){void 0===s&&(s=[]),this.attributes={},this.links=[],this.events=[],this._droppedAttributesCount=0,this._droppedEventsCount=0,this._droppedLinksCount=0,this.status={code:wt.UNSET},this.endTime=[0,0],this._ended=!1,this._duration=[-1,-1],this.name=n,this._spanContext=r,this.parentSpanId=o,this.kind=i,this.links=s;var l=Date.now();this._performanceStartTime=Ge.now(),this._performanceOffset=l-(this._performanceStartTime+tn()),this._startTimeProvided=null!=a,this.startTime=this._getTime(null!=a?a: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?(Bt.warn("Invalid attribute key: "+t),this):me(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):(Bt.warn("Invalid attribute value set for key: "+t),this)},t.prototype.setAttributes=function(t){var e,n;try{for(var r=qn(Object.entries(t)),i=r.next();!i.done;i=r.next()){var o=Wn(i.value,2),s=o[0],a=o[1];this.setAttribute(s,a)}}catch(t){e={error:t}}finally{try{i&&!i.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 Bt.warn("No events allowed."),this._droppedEventsCount++,this;this.events.length>=this._spanLimits.eventCountLimit&&(0===this._droppedEventsCount&&Bt.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),an(e)&&(an(n)||(n=e),e=void 0);var r=fe(e);return this.events.push({name:t,attributes:r,time:this._getTime(n),droppedAttributesCount:0}),this},t.prototype.setStatus=function(t){return this._isSpanEnded()||(this.status=t),this},t.prototype.updateName=function(t){return this._isSpanEnded()||(this.name=t),this},t.prototype.end=function(t){this._isSpanEnded()?Bt.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=function(t,e){var n=e[0]-t[0],r=e[1]-t[1];return r<0&&(n-=1,r+=Ze),[n,r]}(this.startTime,this.endTime),this._duration[0]<0&&(Bt.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&&Bt.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 en(t+this._performanceOffset);if("number"==typeof t)return Je(t);if(t instanceof Date)return Je(t.getTime());if(sn(t))return t;if(this._startTimeProvided)return Je(Date.now());var e=Ge.now()-this._performanceStartTime;return un(this.startTime,Je(e))},t.prototype.isRecording=function(){return!1===this._ended},t.prototype.recordException=function(t,e){var n={};"string"==typeof t?n[$e.EXCEPTION_MESSAGE]=t:t&&(t.code?n[$e.EXCEPTION_TYPE]=t.code.toString():t.name&&(n[$e.EXCEPTION_TYPE]=t.name),t.message&&(n[$e.EXCEPTION_MESSAGE]=t.message),t.stack&&(n[$e.EXCEPTION_STACKTRACE]=t.stack)),n[$e.EXCEPTION_TYPE]||n[$e.EXCEPTION_MESSAGE]?this.addEvent("exception",n,e):Bt.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&&Bt.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.substr(0,e)},t.prototype._truncateToSize=function(t){var e=this,n=this._attributeValueLengthLimit;return n<=0?(Bt.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"}(Vn||(Vn={}));var Yn=function(){function t(){}return t.prototype.shouldSample=function(){return{decision:Vn.NOT_RECORD}},t.prototype.toString=function(){return"AlwaysOffSampler"},t}(),Qn=function(){function t(){}return t.prototype.shouldSample=function(){return{decision:Vn.RECORD_AND_SAMPLED}},t.prototype.toString=function(){return"AlwaysOnSampler"},t}(),Zn=function(){function t(t){var e,n,r,i;this._root=t.root,this._root||(ve(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new Qn),this._remoteParentSampled=null!==(e=t.remoteParentSampled)&&void 0!==e?e:new Qn,this._remoteParentNotSampled=null!==(n=t.remoteParentNotSampled)&&void 0!==n?n:new Yn,this._localParentSampled=null!==(r=t.localParentSampled)&&void 0!==r?r:new Qn,this._localParentNotSampled=null!==(i=t.localParentNotSampled)&&void 0!==i?i:new Yn}return t.prototype.shouldSample=function(t,e,n,r,i,o){var s=ee.getSpanContext(t);return s&&yt(s)?s.isRemote?s.traceFlags&K.SAMPLED?this._remoteParentSampled.shouldSample(t,e,n,r,i,o):this._remoteParentNotSampled.shouldSample(t,e,n,r,i,o):s.traceFlags&K.SAMPLED?this._localParentSampled.shouldSample(t,e,n,r,i,o):this._localParentNotSampled.shouldSample(t,e,n,r,i,o):this._root.shouldSample(t,e,n,r,i,o)},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}(),Jn=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:Tt(e)&&this._accumulate(e)<this._upperBound?Vn.RECORD_AND_SAMPLED:Vn.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}(),tr=ke(),er=ge.AlwaysOn;function nr(){return{sampler:rr(tr),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:ke().OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT,attributeCountLimit:ke().OTEL_ATTRIBUTE_COUNT_LIMIT},spanLimits:{attributeValueLengthLimit:ke().OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT,attributeCountLimit:ke().OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT,linkCountLimit:ke().OTEL_SPAN_LINK_COUNT_LIMIT,eventCountLimit:ke().OTEL_SPAN_EVENT_COUNT_LIMIT,attributePerEventCountLimit:ke().OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT,attributePerLinkCountLimit:ke().OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT}}}function rr(t){switch(void 0===t&&(t=ke()),t.OTEL_TRACES_SAMPLER){case ge.AlwaysOn:return new Qn;case ge.AlwaysOff:return new Yn;case ge.ParentBasedAlwaysOn:return new Zn({root:new Qn});case ge.ParentBasedAlwaysOff:return new Zn({root:new Yn});case ge.TraceIdRatio:return new Jn(ir(t));case ge.ParentBasedTraceIdRatio:return new Zn({root:new Jn(ir(t))});default:return Bt.error('OTEL_TRACES_SAMPLER value "'+t