text: module.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=16)}([function(t,e,n){"use strict";function r(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0});var o=n(10);e.BinaryCarrier=o.default;var a=n(11);e.Tags=a;var i=n(2),s=n(7);e.Reference=s.default;var c=n(1);e.Span=c.default;var u=n(4);e.SpanContext=u.default;var p=n(3);e.Tracer=p.Tracer;var f=n(12);e.MockTracer=f.MockTracer,r(n(15)),r(n(6)),r(n(5)),i.initialize()},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(2),o=function(){function t(){}return t.prototype.context=function(){return this._context()},t.prototype.tracer=function(){return this._tracer()},t.prototype.setOperationName=function(t){return this._setOperationName(t),this},t.prototype.setBaggageItem=function(t,e){return this._setBaggageItem(t,e),this},t.prototype.getBaggageItem=function(t){return this._getBaggageItem(t)},t.prototype.setTag=function(t,e){var n;return this._addTags(((n={})[t]=e,n)),this},t.prototype.addTags=function(t){return this._addTags(t),this},t.prototype.log=function(t,e){return this._log(t,e),this},t.prototype.logEvent=function(t,e){return this._log({event:t,payload:e})},t.prototype.finish=function(t){this._finish(t)},t.prototype._context=function(){return r.spanContext},t.prototype._tracer=function(){return r.tracer},t.prototype._setOperationName=function(t){},t.prototype._setBaggageItem=function(t,e){},t.prototype._getBaggageItem=function(t){},t.prototype._addTags=function(t){},t.prototype._log=function(t,e){},t.prototype._finish=function(t){},t}();e.Span=o,e.default=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),o=n(4),a=n(3);e.tracer=null,e.spanContext=null,e.span=null,e.initialize=function(){e.tracer=new a.default,e.span=new r.default,e.spanContext=new o.default}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(5),o=n(2),a=n(1),i=function(){function t(){}return t.prototype.startSpan=function(t,e){if(void 0===e&&(e={}),e.childOf){var n=r.childOf(e.childOf);e.references?e.references.push(n):e.references=[n],delete e.childOf}return this._startSpan(t,e)},t.prototype.inject=function(t,e,n){return t instanceof a.default&&(t=t.context()),this._inject(t,e,n)},t.prototype.extract=function(t,e){return this._extract(t,e)},t.prototype._startSpan=function(t,e){return o.span},t.prototype._inject=function(t,e,n){},t.prototype._extract=function(t,e){return o.spanContext},t}();e.Tracer=i,e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(){}return t.prototype.toTraceId=function(){return""},t.prototype.toSpanId=function(){return""},t}();e.SpanContext=r,e.default=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(6),o=n(7),a=n(1);e.childOf=function(t){return t instanceof a.default&&(t=t.context()),new o.default(r.REFERENCE_CHILD_OF,t)},e.followsFrom=function(t){return t instanceof a.default&&(t=t.context()),new o.default(r.REFERENCE_FOLLOWS_FROM,t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FORMAT_BINARY="binary",e.FORMAT_TEXT_MAP="text_map",e.FORMAT_HTTP_HEADERS="http_headers",e.REFERENCE_CHILD_OF="child_of",e.REFERENCE_FOLLOWS_FROM="follows_from"},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),o=function(){function t(t,e){this._type=t,this._referencedContext=e instanceof r.default?e.context():e}return t.prototype.type=function(){return this._type},t.prototype.referencedContext=function(){return this._referencedContext},t}();e.default=o},function(t,e,n){"use strict";var r,o=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var a=function(t){function e(e){var n=t.call(this)||this;return n._span=e,n}return o(e,t),e.prototype.span=function(){return this._span},e}(n(0).SpanContext);e.MockContext=a,e.default=a},function(t,e,n){"use strict";var r,o=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var a=n(0),i=n(8),s=function(t){function e(e){var n=t.call(this)||this;return n._mockTracer=e,n._uuid=n._generateUUID(),n._startMs=Date.now(),n._finishMs=0,n._operationName="",n._tags={},n._logs=[],n}return o(e,t),e.prototype._context=function(){return new i.default(this)},e.prototype._setOperationName=function(t){this._operationName=t},e.prototype._addTags=function(t){for(var e=0,n=Object.keys(t);e<n.length;e++){var r=n[e];this._tags[r]=t[r]}},e.prototype._log=function(t,e){this._logs.push({fields:t,timestamp:e})},e.prototype._finish=function(t){this._finishMs=t||Date.now()},e.prototype.uuid=function(){return this._uuid},e.prototype.operationName=function(){return this._operationName},e.prototype.durationMs=function(){return this._finishMs-this._startMs},e.prototype.tags=function(){return this._tags},e.prototype.tracer=function(){return this._mockTracer},e.prototype._generateUUID=function(){return""+("00000000"+Math.abs(4294967295*Math.random()|0).toString(16)).substr(-8)+("00000000"+Math.abs(4294967295*Math.random()|0).toString(16)).substr(-8)},e.prototype.addReference=function(t){},e.prototype.debug=function(){var t={uuid:this._uuid,operation:this._operationName,millis:[this._finishMs-this._startMs,this._startMs,this._finishMs]};return Object.keys(this._tags).length&&(t.tags=this._tags),t},e}(a.Span);e.MockSpan=s,e.default=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){this.buffer=t};e.default=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SPAN_KIND="span.kind",e.SPAN_KIND_RPC_CLIENT="client",e.SPAN_KIND_RPC_SERVER="server",e.SPAN_KIND_MESSAGING_PRODUCER="producer",e.SPAN_KIND_MESSAGING_CONSUMER="consumer",e.ERROR="error",e.COMPONENT="component",e.SAMPLING_PRIORITY="sampling.priority",e.PEER_SERVICE="peer.service",e.PEER_HOSTNAME="peer.hostname",e.PEER_ADDRESS="peer.address",e.PEER_HOST_IPV4="peer.ipv4",e.PEER_HOST_IPV6="peer.ipv6",e.PEER_PORT="peer.port",e.HTTP_URL="http.url",e.HTTP_METHOD="http.method",e.HTTP_STATUS_CODE="http.status_code",e.MESSAGE_BUS_DESTINATION="message_bus.destination",e.DB_INSTANCE="db.instance",e.DB_STATEMENT="db.statement",e.DB_TYPE="db.type",e.DB_USER="db.user"},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(8);e.MockContext=r.default;var o=n(9);e.MockSpan=o.default;var a=n(13);e.MockTracer=a.default},function(t,e,n){"use strict";var r,o=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var a=n(0),i=n(14),s=n(9),c=function(t){function e(){var e=t.call(this)||this;return e._spans=[],e}return o(e,t),e.prototype._startSpan=function(t,e){var n=this._allocSpan();if(n.setOperationName(t),this._spans.push(n),e.references)for(var r=0,o=e.references;r<o.length;r++){var a=o[r];n.addReference(a)}return n._startStack=(new Error).stack,n},e.prototype._inject=function(t,e,n){throw new Error("NOT YET IMPLEMENTED")},e.prototype._extract=function(t,e){throw new Error("NOT YET IMPLEMENTED")},e.prototype._allocSpan=function(){return new s.default(this)},e.prototype.clear=function(){this._spans=[]},e.prototype.report=function(){return new i.default(this._spans)},e}(a.Tracer);e.MockTracer=c,e.default=c},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t){var e=this;this.spans=t,this.spansByUUID={},this.spansByTag={},this.debugSpans=[],this.unfinishedSpans=[],t.forEach((function(t){0===t._finishMs&&e.unfinishedSpans.push(t),e.spansByUUID[t.uuid()]=t,e.debugSpans.push(t.debug());var n=t.tags();Object.keys(n).forEach((function(r){var o=n[r];e.spansByTag[r]=e.spansByTag[r]||{},e.spansByTag[r][o]=e.spansByTag[r][o]||[],e.spansByTag[r][o].push(t)}))}))}return t.prototype.firstSpanWithTagValue=function(t,e){var n=this.spansByTag[t];if(!n)return null;var r=n[e];return r?r[0]:null},t}();e.MockReport=r,e.default=r},function(t,e,n){"use strict";var r,o=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var a=n(3),i=new a.default,s=null,c=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.startSpan=function(){var t=s||i;return t.startSpan.apply(t,arguments)},e.prototype.inject=function(){var t=s||i;return t.inject.apply(t,arguments)},e.prototype.extract=function(){var t=s||i;return t.extract.apply(t,arguments)},e}(a.default));e.initGlobalTracer=function(t){s=t},e.globalTracer=function(){return c}},function(t,e,n){"use strict";n.r(e);var r={};n.r(r),n.d(r,"I32",(function(){return $})),n.d(r,"I64",(function(){return tt})),n.d(r,"List",(function(){return et})),n.d(r,"String",(function(){return nt})),n.d(r,"toUTF8Array",(function(){return rt})),n.d(r,"Struct",(function(){return at})),n.d(r,"StructFieldType",(function(){return ot}));var o={};n.r(o),n.d(o,"BaseReporter",(function(){return M})),n.d(o,"DebugReporter",(function(){return L})),n.d(o,"WinstonReporter",(function(){return D})),n.d(o,"InMemoryReporter",(function(){return G})),n.d(o,"SpanFilterProxyReporter",(function(){return X})),n.d(o,"SpanComponentTagFilterProxyReporter",(function(){return z})),n.d(o,"ZipkinReporter",(function(){return W})),n.d(o,"toZipkinJSON",(function(){return Z})),n.d(o,"JaegerReporter",(function(){return ct})),n.d(o,"toJaegerThriftStructure",(function(){return pt})),n.d(o,"StalkCollectorReporter",(function(){return lt}));var a={};n.r(a),n.d(a,"Tag",(function(){return ht})),n.d(a,"default",(function(){return _t})),n.d(a,"getTags",(function(){return dt})),n.d(a,"Component",(function(){return yt})),n.d(a,"getComponent",(function(){return gt}));var i={};n.r(i),n.d(i,"Trace",(function(){return Tt})),n.d(i,"default",(function(){return mt})),n.d(i,"TraceAsync",(function(){return Ot})),n.d(i,"getTracer",(function(){return It})),n.d(i,"ChildOfHandler",(function(){return St})),n.d(i,"FollowFromHandler",(function(){return bt})),n.d(i,"NewTraceHandler",(function(){return Et}));var s={};n.r(s),n.d(s,"Trace",(function(){return i})),n.d(s,"Tag",(function(){return a}));var c={};n.r(c),n.d(c,"TextMapFormat",(function(){return I})),n.d(c,"JaegerFormat",(function(){return b})),n.d(c,"JaegerFormatName",(function(){return S})),n.d(c,"ZipkinB3Format",(function(){return P})),n.d(c,"ZipkinB3FormatName",(function(){return N}));var u={};n.r(u),n.d(u,"DebugNamespaceMatcher",(function(){return q})),n.d(u,"Thrift",(function(){return r}));var p={};n.r(p),n.d(p,"SpanContext",(function(){return d})),n.d(p,"Span",(function(){return T})),n.d(p,"Tracer",(function(){return j})),n.d(p,"formats",(function(){return c})),n.d(p,"reporters",(function(){return o})),n.d(p,"decorators",(function(){return s})),n.d(p,"utils",(function(){return u}));var f,l=n(0),h=(f=function(t,e){return(f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}f(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),_=function(){return(_=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}).apply(this,arguments)},d=function(t){function e(e,n){var r=t.call(this)||this;return r._baggageItems={},r._traceId=e,r._spanId=n,r}return h(e,t),e.prototype.toTraceId=function(){return this._traceId},e.prototype.toSpanId=function(){return this._spanId},e.prototype.toJSON=function(){return{traceId:this._traceId,spanId:this._spanId,baggageItems:this._baggageItems}},e.prototype.addBaggageItems=function(t){this._baggageItems=_(_({},this._baggageItems),t)},Object.defineProperty(e.prototype,"baggageItems",{get:function(){return this._baggageItems},enumerable:!0,configurable:!0}),e}(l.SpanContext),y=d,g=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)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),v=function(){return(v=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}).apply(this,arguments)},T=function(t){function e(e,n){var r=t.call(this)||this;return r._references=[],r._tags={},r._logs=[],r.__tracer=e,r.__context=n,r}return g(e,t),e.prototype.tracer=function(){return t.prototype.tracer.call(this)},e.prototype.start=function(t){this._startTime=t||Date.now()},e.prototype.addReference=function(t){this._references.push(t)},e.prototype.getTag=function(t){return this._tags[t]},e.prototype.toJSON=function(){return{context:this.__context,operationName:this._operationName,startTime:this._startTime,finishTime:this._finishTime,references:this._references.map((function(t){return{type:t.type(),referencedContext:t.referencedContext()}})),tags:this._tags,logs:this._logs}},e.fromJSON=function(t){var n=new y(t.context.traceId,t.context.spanId);n.addBaggageItems(t.context.baggageItems||{});var r=new e(null,n);return r._operationName=t.operationName,r._startTime=t.startTime,r._finishTime=t.finishTime,t.references&&t.references.length>0&&(r._references=t.references.map((function(t){var e=new y(t.referencedContext.traceId,t.referencedContext.spanId);return e.addBaggageItems(t.referencedContext.baggageItems||{}),new l.Reference(t.type,e)}))),r._tags=t.tags||{},r._logs=t.logs||[],r},e.prototype._context=function(){return this.__context},e.prototype._tracer=function(){return this.__tracer},e.prototype._setOperationName=function(t){this._operationName=t},e.prototype._addTags=function(t){this._tags=v(v({},this._tags),t)},e.prototype._log=function(t,e){var n=this,r={fields:t,timestamp:e||Date.now()};this._logs.push(r),this.__tracer.reporters.forEach((function(t){t.accepts.spanLog&&t.recieveSpanLog(n,r)}))},e.prototype._finish=function(t){var e=this;this._finishTime=t||Date.now(),this.__tracer.reporters.forEach((function(t){t.accepts.spanFinish&&t.recieveSpanFinish(e)}))},e.prototype._setBaggageItem=function(t,e){var n;this.__context.addBaggageItems(((n={})[t]=e,n))},e.prototype._getBaggageItem=function(t){return this.__context.baggageItems[t]},e}(l.Span),m=T,O={TRACE_ID:"X-Stalk-TraceId",SPAN_ID:"X-Stalk-SpanId",BAGGAGE_ITEM_PREFIX:"X-Stalk-BaggageItem-"},I={name:l.FORMAT_TEXT_MAP,inject:function(t,e){if(e&&"object"==typeof e)for(var n in e[O.TRACE_ID]=t.toTraceId(),e[O.SPAN_ID]=t.toSpanId(),t.baggageItems){var r=t.baggageItems[n];e[O.BAGGAGE_ITEM_PREFIX+n]=r}else console.error("Could not inject context to plain object, carrier is not object.",e)},extract:function(t){if(!t||"object"!=typeof t)return console.error("Could not extract context from carrier",t),null;var e,n,r={};for(var o in t){var a=o.toLowerCase();if(0==a.indexOf(O.BAGGAGE_ITEM_PREFIX.toLowerCase()))r[o.replace(new RegExp(O.BAGGAGE_ITEM_PREFIX,"ig"),"")]=t[o];else a==O.TRACE_ID.toLowerCase()?e=t[o]:a==O.SPAN_ID.toLowerCase()&&(n=t[o])}if(!e||!n)return null;var i=new d(e,n);return i.addBaggageItems(r),i}},w={IDENTITY:"uber-trace-id",BAGGAGE_ITEM_PREFIX:"uberctx-"},S="jaeger_format",b={name:S,inject:function(t,e){e&&"object"==typeof e?e[w.IDENTITY]=t.toTraceId()+":"+t.toSpanId()+":0:1":console.error("Could not inject context to plain object, carrier is not object.",e)},extract:function(t){if(!t||"object"!=typeof t)return console.error("Could not extract context from carrier",t),null;var e,n;for(var r in t)if(r.toLowerCase()==w.IDENTITY.toLowerCase()){var o=t[r].split(":");if(4!=o.length)continue;e=o[0],n=o[1]}return e&&n?new d(e,n):null}},E={TRACE_ID:"X-B3-TraceId",SPAN_ID:"X-B3-SpanId"},N="zipkin_b3_format",P={name:N,inject:function(t,e){e&&"object"==typeof e?(e[E.TRACE_ID]=t.toTraceId(),e[E.SPAN_ID]=t.toSpanId()):console.error("Could not inject context to plain object, carrier is not object.",e)},extract:function(t){if(!t||"object"!=typeof t)return console.error("Could not extract context from carrier",t),null;var e,n;for(var r in t){var o=r.toLowerCase();o==E.TRACE_ID.toLowerCase()?e=t[r]:o==E.SPAN_ID.toLowerCase()&&(n=t[r])}return e&&n?new d(e,n):null}},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)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),C=function(){return(C=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}).apply(this,arguments)},x=function(){return Math.random().toString(16).substring(2,10)+Math.random().toString(16).substring(2,10)},j=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._tags={},e._reporters=[],e}return R(e,t),Object.defineProperty(e.prototype,"reporters",{get:function(){return this._reporters},enumerable:!0,configurable:!0}),e.prototype.addTags=function(t){this._tags=C(C({},this._tags),t)},e.prototype.deleteTag=function(t){delete this._tags[t]},e.prototype.clearTags=function(t){this._tags={}},e.prototype.addReporter=function(t){this._reporters.push(t)},e.prototype.removeReporter=function(t){var e=this._reporters.indexOf(t);if(e>-1){var n=this._reporters[e];return this._reporters.splice(e,1),n.close(),!0}return!1},e.prototype.startSpan=function(e,n){return void 0===n&&(n={}),t.prototype.startSpan.call(this,e,n)},e.prototype._startSpan=function(t,e){var n=e.references?e.references[0]:null,r=n?n.referencedContext():null,o=r?r.toTraceId():x(),a=x(),i=new y(o,a);r&&r.baggageItems&&i.addBaggageItems(r.baggageItems);var s=new m(this,i);if(s.setOperationName(t),s.addTags(this._tags),e.tags&&s.addTags(e.tags),e.references)for(var c=0,u=e.references;c<u.length;c++){var p=u[c];s.addReference(p)}return s.start(e.startTime),this._reporters.forEach((function(t){t.accepts.spanCreate&&t.recieveSpanCreate(s)})),s},e.prototype._inject=function(t,e,n){switch(e){case l.FORMAT_HTTP_HEADERS:case l.FORMAT_TEXT_MAP:return I.inject(t,n);case S:return b.inject(t,n);case N:return P.inject(t,n);default:console.error('Could not inject context into carrier, unknown format "'+e+'"',n)}},e.prototype._extract=function(t,e){switch(t){case l.FORMAT_HTTP_HEADERS:case l.FORMAT_TEXT_MAP:return I.extract(e);case S:return b.extract(e);case N:return P.extract(e);default:console.error('Could not extract context from carrier, unknown carrier format "'+t+'"',e)}},e}(l.Tracer),M=function(){function t(){this.accepts={spanCreate:!1,spanLog:!1,spanFinish:!1}}return t.prototype.recieveSpanCreate=function(t){},t.prototype.recieveSpanLog=function(t,e){},t.prototype.recieveSpanFinish=function(t){},t.prototype.close=function(){},t}(),A=M,B=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)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),L=function(t){function e(e){var n=t.call(this)||this;return n.accepts={spanCreate:!1,spanLog:!0,spanFinish:!1},n.debugInstances={},n.debugFactory=e,n}return B(e,t),e.prototype.recieveSpanLog=function(t,e){var n=t.getTag(l.Tags.COMPONENT)||"NO-COMPONENT",r=this.debugInstances[n];r||(r=this.debugInstances[n]=this.debugFactory(n)),r(e.fields)},e.prototype.close=function(){for(var t in this.debugInstances){this.debugInstances[t].destroy()}this.debugInstances={}},e}(A),F=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)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),k=function(){return(k=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}).apply(this,arguments)},D=function(t){function e(e){var n=t.call(this)||this;return n.accepts={spanCreate:!1,spanLog:!0,spanFinish:!1},n.winstonLogger=e,n}return F(e,t),e.prototype.recieveSpanLog=function(t,e){this.winstonLogger.log(k({level:e.fields.level||"info",message:e.fields.message||""},e.fields))},e.prototype.close=function(){},e}(A),U=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)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),G=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.accepts={spanCreate:!0,spanLog:!1,spanFinish:!1},e.spans=[],e}return U(e,t),e.prototype.recieveSpanCreate=function(t){this.spans.push(t)},e.prototype.close=function(){this.spans=[]},e}(A),H=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)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),X=function(t){function e(e,n){var r=t.call(this)||this;return r._predicate=function(){return!0},r._target=e,"function"==typeof n&&(r._predicate=n),r.accepts.spanCreate=e.accepts.spanCreate,r.accepts.spanLog=e.accepts.spanLog,r.accepts.spanFinish=e.accepts.spanFinish,r}return H(e,t),e.prototype.recieveSpanCreate=function(t){return!!this.testSpan(t)&&this._target.recieveSpanCreate(t)},e.prototype.recieveSpanLog=function(t,e){return!!this.testSpan(t)&&this._target.recieveSpanLog(t,e)},e.prototype.recieveSpanFinish=function(t){return!!this.testSpan(t)&&this._target.recieveSpanFinish(t)},e.prototype.testSpan=function(t){return this._predicate(t)},e.prototype.close=function(){this._target.close(),this._target=null},e}(A),J=X,q=function(){function t(t){this.updateQuery(t)}return t.prototype.updateQuery=function(t){this._matchQuery=t,this.setupRegexes()},t.prototype.setupRegexes=function(){var t;this._regexes={names:[],skips:[]};var e=("string"==typeof this._matchQuery?this._matchQuery:"").split(/[\s,]+/),n=e.length;for(t=0;t<n;t++)if(e[t]){var r=e[t].replace(/\*/g,".*?");"-"===r[0]?this._regexes.skips.push(new RegExp("^"+r.substr(1)+"$")):this._regexes.names.push(new RegExp("^"+r+"$"))}},t.prototype.test=function(t){if("*"===t[t.length-1])return!0;var e,n;for(e=0,n=this._regexes.skips.length;e<n;e++)if(this._regexes.skips[e].test(t))return!1;for(e=0,n=this._regexes.names.length;e<n;e++)if(this._regexes.names[e].test(t))return!0;return!1},t}(),V=q,Y=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)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),z=function(t){function e(e,n){var r=t.call(this,e)||this;return r.matcher=new V(n),r}return Y(e,t),e.prototype.updateQuery=function(t){this.matcher.updateQuery(t)},e.prototype.testSpan=function(t){return this.matcher.test(t.getTag(l.Tags.COMPONENT))},e}(J),K=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)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Q=function(){return(Q=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}).apply(this,arguments)},W=function(t){function e(e){var n=t.call(this)||this;return n._tags={},n._spans=[],n._zipkinBaseUrl="http://localhost:9411",n._requestHeaders={},n._shouldConvertLogsToAnnotations=!0,n.accepts={spanCreate:!1,spanLog:!1,spanFinish:!0},n._localEndpoint=e.localEndpoint,"object"==typeof e.tags&&(n._tags=e.tags),n._zipkinBaseUrl=e.zipkinBaseUrl,n._fetch=e.fetch,n._requestHeaders=e.requestHeaders||{},n._requestHeaders=e.requestHeaders||{},"boolean"==typeof e.convertLogsToAnnotations&&(n._shouldConvertLogsToAnnotations=e.convertLogsToAnnotations),n}return K(e,t),e.prototype.recieveSpanFinish=function(t){var e=Z(t,this._shouldConvertLogsToAnnotations,this._tags);e.localEndpoint=this._localEndpoint,this._spans.push(e)},e.prototype.report=function(){var t=this,e=this._spans.slice();return this._fetch(this._zipkinBaseUrl+"/api/v2/spans",{method:"post",headers:Q({"Content-Type":"application/json"},this._requestHeaders),body:JSON.stringify(e)}).then((function(n){return n.ok&&e.forEach((function(e){var n=t._spans.indexOf(e);n>-1&&t._spans.splice(n,1)})),n}))},e}(M);function Z(t,e,n){void 0===e&&(e=!1),void 0===n&&(n={});var r=t.toJSON(),o={};for(var a in n)o[a]=r.tags[a]+"";for(var i in r.tags)o[i]=r.tags[i]+"";var s={traceId:r.context.toTraceId(),id:r.context.toSpanId(),name:r.operationName,timestamp:1e3*r.startTime,duration:1e3*(r.finishTime-r.startTime),tags:o};e&&(s.annotations=r.logs.map((function(t){var e="";return e=t.fields.level&&t.fields.message?"["+t.fields.level+"] "+t.fields.message:JSON.stringify(t.fields),{timestamp:1e3*(t.timestamp||0),value:e}})));var c=r.references.length>0?r.references[0].referencedContext.toSpanId():null;c&&(s.parentId=c);var u=r.tags[l.Tags.SPAN_KIND];return u&&(s.kind=u,delete s.tags[l.Tags.SPAN_KIND]),s}var $=function(){function t(t){if("number"!=typeof t)throw new Error('Unsupported number value "'+t+'"');this.value=t}return t.prototype.writeToBuffer=function(t,e){return new DataView(t,e,4).setUint32(0,this.value,!1),4},t.prototype.calculateByteLength=function(){return 4},t}(),tt=function(){function t(t){if("number"==typeof t)this.value=BigInt(t);else if("bigint"==typeof t)this.value=t;else{if("string"!=typeof t)throw new Error('Unsupported i64 value "'+t+'"');this.value=BigInt("0x"+t)}}return t.prototype.writeToBuffer=function(t,e){var n=new DataView(t,e,8);n.setUint32(0,0,!1),n.setUint32(4,0,!1);var r=this.value.toString(16);r.length%2&&(r="0"+r);for(var o=r.length/2,a=0,i=0,s=8-o;a<o;)n.setUint8(s+a,parseInt(r.slice(i,i+2),16)),a+=1,i+=2;return 8},t.prototype.calculateByteLength=function(){return 8},t.prototype.toJSON=function(){return this.value.toString(16)},t}(),et=function(){function t(t,e){this.elements=[],this.elements=t||[],this.elementType=e}return t.prototype.writeToBuffer=function(t,e){var n=new DataView(t,e);n.setUint8(0,this.elementType),n.setUint32(1,this.elements.length,!1);var r=5;return this.elements.forEach((function(n){if(!n.writeToBuffer)throw new Error('List elements must have "writeToBuffer" method');var o=n.writeToBuffer(t,e+r);r+=o})),r},t.prototype.calculateByteLength=function(){var t=0;return this.elements.forEach((function(e){t+=e.calculateByteLength()})),t+1+4},t}(),nt=function(){function t(t){if("string"!=typeof t)throw new Error('Unsupported string value "'+t+'"');this.value=t}return t.prototype.writeToBuffer=function(t,e){var n=rt(this.value),r=new DataView(t,e,n.length+4);r.setUint32(0,n.length);for(var o=0;o<n.length;o++)r.setUint8(4+o,n[o]);return n.length+4},t.prototype.calculateByteLength=function(){return 4+rt(this.value).length},t}();function rt(t){for(var e=[],n=0;n<t.length;n++){var r=t.charCodeAt(n);r<128?e.push(r):r<2048?e.push(192|r>>6,128|63&r):r<55296||r>=57344?e.push(224|r>>12,128|r>>6&63,128|63&r):(n++,r=65536+((1023&r)<<10|1023&t.charCodeAt(n)),e.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|63&r))}return e}var ot,at=function(){function t(t){this.fields=[],this.fields=t||[]}return t.prototype.writeToBuffer=function(t,e){var n=new DataView(t,e),r=0;return this.fields.forEach((function(o){if(n.setUint8(r,o.type),n.setInt16(r+1,o.id),o.value instanceof Uint8Array&&o.type==ot.I64)o.value.forEach((function(t,e){n.setUint8(r+3+e,t)})),r+=3+o.value.length;else{if(!o.value.writeToBuffer)throw console.log(o.value),new Error('Not supported field value "'+o.value+'"');var a=o.value.writeToBuffer(t,e+3+r);r+=3+a}})),n.setUint8(r,0),r+1},t.prototype.calculateByteLength=function(){var t=0;return this.fields.forEach((function(e){e.value instanceof Uint8Array&&e.type==ot.I64?t+=11:t+=3+e.value.calculateByteLength()})),1+t},t}();!function(t){t[t.BOOL=2]="BOOL",t[t.BYTE=3]="BYTE",t[t.DOUBLE=4]="DOUBLE",t[t.I16=6]="I16",t[t.I32=8]="I32",t[t.I64=10]="I64",t[t.STRING=11]="STRING",t[t.STRUCT=12]="STRUCT",t[t.MAP=13]="MAP",t[t.SET=14]="SET",t[t.LIST=15]="LIST"}(ot||(ot={}));var it=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)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),st=function(){return(st=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}).apply(this,arguments)},ct=function(t){function e(e){var n=t.call(this)||this;return n._spans=[],n._jaegerBaseUrl="http://localhost:14268",n._requestHeaders={},n.accepts={spanCreate:!1,spanLog:!1,spanFinish:!0},n._process=e.process,n._jaegerBaseUrl=e.jaegerBaseUrl,n._fetch=e.fetch,n._requestHeaders=e.requestHeaders||{},n}return it(e,t),e.prototype.recieveSpanFinish=function(t){var e=pt(t);this._spans.push(e)},e.prototype.report=function(){var t=this,e=this._spans.slice(),n=new et([],ot.STRUCT);for(var r in this._process.tags){var o=new at([{id:1,name:"key",type:ot.STRING,value:new nt(r)},{id:2,name:"vType",type:ot.I32,value:new $(0)},{id:3,name:"vStr",type:ot.STRING,value:new nt(this._process.tags[r]+"")}]);n.elements.push(o)}var a=new at([{id:1,name:"serviceName",type:ot.STRING,value:new nt(this._process.serviceName)},{id:2,name:"tags",type:ot.LIST,value:n}]),i=new et([],ot.STRUCT);i.elements=this._spans;var s=new at([{id:1,name:"process",type:ot.STRUCT,value:a},{id:2,name:"spans",type:ot.LIST,value:i}]),c=s.calculateByteLength(),u=new ArrayBuffer(c);return s.writeToBuffer(u,0),this._fetch(this._jaegerBaseUrl+"/api/traces",{method:"post",headers:st({"Content-Type":"application/x-thrift",Connection:"keep-alive"},this._requestHeaders),body:u}).then((function(n){return n.ok&&e.forEach((function(e){var n=t._spans.indexOf(e);n>-1&&t._spans.splice(n,1)})),n}))},e}(M),ut=new Uint8Array([0,0,0,0,0,0,0,0]);function pt(t){var e=t.toJSON(),n=new et([],ot.STRUCT);e.references.forEach((function(t){if(t.type!=l.REFERENCE_CHILD_OF&&t.type!=l.REFERENCE_FOLLOWS_FROM)throw new Error('Unsupported reference type "'+t.type+'"');var e=void 0;t.type==l.REFERENCE_CHILD_OF?(t.referencedContext.toSpanId(),e=0):t.type==l.REFERENCE_FOLLOWS_FROM&&(e=1);var r=new at([{id:1,name:"refType",type:ot.I32,value:new $(e)},{id:2,name:"traceIdLow",type:ot.I64,value:new tt(t.referencedContext.toTraceId())},{id:3,name:"traceIdHigh",type:ot.I64,value:ut},{id:4,name:"spanId",type:ot.I64,value:new tt(t.referencedContext.toSpanId())}]);n.elements.push(r)}));var r=new et([],ot.STRUCT);for(var o in e.tags){var a=new at([{id:1,name:"key",type:ot.STRING,value:new nt(o)},{id:2,name:"vType",type:ot.I32,value:new $(0)},{id:3,name:"vStr",type:ot.STRING,value:new nt(e.tags[o]+"")}]);r.elements.push(a)}var i=new et([],ot.STRUCT);return e.logs.forEach((function(t){var e=new et([],ot.STRUCT);for(var n in t.fields){var r=t.fields[n];if(r){"object"==typeof r&&(r=JSON.stringify(r));var o=new at([{id:1,name:"key",type:ot.STRING,value:new nt(n)},{id:2,name:"vType",type:ot.I32,value:new $(0)},{id:3,name:"vStr",type:ot.STRING,value:new nt(r+"")}]);e.elements.push(o)}}var a=new at([{id:1,name:"timestamp",type:ot.I64,value:new tt(BigInt(1e3*t.timestamp))},{id:2,name:"fields",type:ot.LIST,value:e}]);i.elements.push(a)})),new at([{id:1,name:"traceIdLow",type:ot.I64,value:new tt(e.context.toTraceId())},{id:2,name:"traceIdHigh",type:ot.I64,value:ut},{id:3,name:"spanId",type:ot.I64,value:new tt(e.context.toSpanId())},{id:4,name:"parentSpanId",type:ot.I64,value:ut},{id:5,name:"operationName",type:ot.STRING,value:new nt(e.operationName)},{id:6,name:"references",type:ot.LIST,value:n},{id:7,name:"flags",type:ot.I32,value:new $(0)},{id:8,name:"startTime",type:ot.I64,value:new tt(BigInt(1e3*e.startTime))},{id:9,name:"duration",type:ot.I64,value:new tt(1e3*(e.finishTime-e.startTime))},{id:10,name:"tags",type:ot.LIST,value:r},{id:11,name:"logs",type:ot.LIST,value:i}])}var ft=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)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),lt=function(t){function e(e){var n=t.call(this)||this;return n._tags={},n._spans=[],n._stalkCollectorApiRoot="http://localhost:7855",n.accepts={spanCreate:!1,spanLog:!1,spanFinish:!0},n._serviceName=e.serviceName,e.tags&&(n._tags=e.tags),n._stalkCollectorApiRoot=e.stalkCollectorApiRoot,n._fetch=e.fetch,n}return ft(e,t),e.prototype.recieveSpanFinish=function(t){this._spans.push(t.toJSON())},e.prototype.report=function(){var t=this,e=this._spans.slice();return this._fetch(this._stalkCollectorApiRoot+"/batch",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({serviceName:this._serviceName,tags:this._tags,spans:e})}).then((function(n){return n.ok&&e.forEach((function(e){var n=t._spans.indexOf(e);n>-1&&t._spans.splice(n,1)})),n}))},e}(M);function ht(t,e){return function(n){n.prototype["X-Stalk-Tags"]||(n.prototype["X-Stalk-Tags"]={}),n.prototype["X-Stalk-Tags"][t]=e}}var _t=ht;function dt(t){return t["X-Stalk-Tags"]}function yt(t){return ht(l.Tags.COMPONENT,t)}function gt(t){return dt(t)[l.Tags.COMPONENT]}var vt=function(){return(vt=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}).apply(this,arguments)};new l.Tracer;function Tt(t){return function(e,n,r){var o=r.value;t.operationName=t.operationName||n;var a=t;if(a.relation)switch(a.relation){case"childOf":a.handler=St;break;case"followsFrom":a.handler=bt;break;case"newTrace":a.handler=Et;break;default:throw new Error('Unexpected relation type "'+a.relation+'"')}if("function"!=typeof a.handler)throw new Error('Expected handler type "'+typeof a.handler+'"');return r.value=function(){for(var e,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];try{e=a.handler.apply(this,n)}catch(e){throw console.error('Unexpected error in traced method "'+t.operationName+'"s handler'),e}var i=dt(this);i&&e.addTags(i),e.setOperationName(t.operationName),n.splice(0,1,e);try{var s=o.apply(this,n);return t.autoFinish?"object"==typeof s&&s.then&&s.catch?s.then((function(t){return e.finish(),t})).catch((function(t){throw e.log({event:"error",error:t.message,message:t.message,stack:t.stack,"error.kind":t.name}),e.setTag(l.Tags.ERROR,!0),e.finish(),t})):(e.finish(),s):s}catch(t){throw e.log({event:"error",error:t.message||t.name,message:t.message,stack:t.stack,"error.kind":t.name}),e.setTag(l.Tags.ERROR,!0),e.finish(),t}},r}}var mt=Tt;function Ot(t){return Tt(vt(vt({},t),{autoFinish:!0}))}function It(t){if(function(t){return t&&t.tracer&&"function"==typeof t.tracer}(t))return t.tracer();var e=("undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}).opentracing;return e&&"function"==typeof e.globalTracer?e.globalTracer():l.globalTracer()}function wt(t){return t&&t.context&&"function"==typeof t.context}function St(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(!t)throw new Error("Traced method's first argument must be a span");if(!wt(t))throw new Error("Passed span is not OpenTracing-compatible, it does not context() method");var r=It(t);return r.startSpan("",{childOf:t.context()})}function bt(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(!t)throw new Error("Traced method's first argument must be a span");if(!wt(t))throw new Error("Passed span is not OpenTracing-compatible, it does not context() method");var r=It(t);return r.startSpan("",{references:[l.followsFrom(t.context())]})}function Et(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=It(null);return r.startSpan("",{})}n.d(e,"opentracing",(function(){return l})),n.d(e,"stalk",(function(){return p}))}]);