/*! Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one or more contributor license agreements. * Licensed under the Elastic License 2.0; you may not use this file except in compliance with the Elastic License 2.0. */ (window.profiling_bundle_jsonpfunction=window.profiling_bundle_jsonpfunction||[]).push([[1],Array(39).concat([function(e,t,n){e.exports=n(8)(1466)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.apS=t.apSW=t.bind=t.bindW=t.bindTo=t.exists=t.elem=t.toError=t.either=t.getValidationMonoid=t.MonadThrow=t.ChainRec=t.Extend=t.Alt=t.Bifunctor=t.Traversable=t.Foldable=t.Monad=t.Applicative=t.Functor=t.getValidationSemigroup=t.getValidation=t.getAltValidation=t.getApplicativeValidation=t.getWitherable=t.getFilterable=t.getApplyMonoid=t.getApplySemigroup=t.getSemigroup=t.getEq=t.getShow=t.URI=t.throwError=t.sequence=t.traverse=t.reduceRight=t.foldMap=t.reduce=t.duplicate=t.extend=t.alt=t.flatten=t.chainFirst=t.chainFirstW=t.chain=t.chainW=t.of=t.apSecond=t.apFirst=t.ap=t.apW=t.mapLeft=t.bimap=t.map=t.filterOrElse=t.orElse=t.swap=t.getOrElse=t.getOrElseW=t.fold=t.fromPredicate=t.fromOption=t.stringifyJSON=t.parseJSON=t.tryCatch=t.fromNullable=t.right=t.left=t.isRight=t.isLeft=void 0;var r=n(48),i=n(41);function a(e,n){try{return t.right(e())}catch(e){return t.left(n(e))}}t.isLeft=function(e){return"Left"===e._tag},t.isRight=function(e){return"Right"===e._tag},t.left=function(e){return{_tag:"Left",left:e}},t.right=function(e){return{_tag:"Right",right:e}},t.fromNullable=function(e){return function(n){return null==n?t.left(e):t.right(n)}},t.tryCatch=a,t.parseJSON=function(e,t){return a((function(){return JSON.parse(e)}),t)},t.stringifyJSON=function(e,t){return a((function(){return JSON.stringify(e)}),t)},t.fromOption=function(e){return function(n){return"None"===n._tag?t.left(e()):t.right(n.value)}},t.fromPredicate=function(e,n){return function(r){return e(r)?t.right(r):t.left(n(r))}},t.fold=function(e,n){return function(r){return t.isLeft(r)?e(r.left):n(r.right)}},t.getOrElseW=function(e){return function(n){return t.isLeft(n)?e(n.left):n.right}},t.getOrElse=t.getOrElseW,t.swap=function(e){return t.isLeft(e)?t.right(e.left):t.left(e.right)},t.orElse=function(e){return function(n){return t.isLeft(n)?e(n.left):n}},t.filterOrElse=function(e,n){return t.chain((function(r){return e(r)?t.right(r):t.left(n(r))}))};var o=function(e,n){return i.pipe(e,t.map(n))},s=function(e,n){return i.pipe(e,t.ap(n))},u=function(e,n){return i.pipe(e,t.chain(n))},l=function(e,n,r){return i.pipe(e,t.reduce(n,r))},c=function(e){return function(n,r){var a=t.foldMap(e);return i.pipe(n,a(r))}},f=function(e,n,r){return i.pipe(e,t.reduceRight(n,r))},p=function(e){var n=t.traverse(e);return function(e,t){return i.pipe(e,n(t))}},h=function(e,n,r){return i.pipe(e,t.bimap(n,r))},d=function(e,n){return i.pipe(e,t.mapLeft(n))},g=function(e,n){return i.pipe(e,t.alt(n))},m=function(e,n){return i.pipe(e,t.extend(n))},b=function(e,n){return r.tailRec(n(e),(function(e){return t.isLeft(e)?t.right(t.left(e.left)):t.isLeft(e.right)?t.left(n(e.right.left)):t.right(t.right(e.right.right))}))};function x(e){return{concat:function(n,r){return t.isLeft(n)?n:t.isLeft(r)?r:t.right(e.concat(n.right,r.right))}}}function v(e){var n=t.left(e.empty);return{URI:t.URI,_E:void 0,map:o,compact:function(e){return t.isLeft(e)?e:"None"===e.right._tag?n:t.right(e.right.value)},separate:function(e){return t.isLeft(e)?{left:e,right:e}:t.isLeft(e.right)?{left:t.right(e.right.left),right:n}:{left:n,right:t.right(e.right.right)}},filter:function(e,r){return t.isLeft(e)||r(e.right)?e:n},filterMap:function(e,r){if(t.isLeft(e))return e;var i=r(e.right);return"None"===i._tag?n:t.right(i.value)},partition:function(e,r){return t.isLeft(e)?{left:e,right:e}:r(e.right)?{left:n,right:t.right(e.right)}:{left:t.right(e.right),right:n}},partitionMap:function(e,r){if(t.isLeft(e))return{left:e,right:e};var i=r(e.right);return t.isLeft(i)?{left:t.right(i.left),right:n}:{left:n,right:t.right(i.right)}}}}function y(e){return{URI:t.URI,_E:void 0,map:o,ap:function(n,r){return t.isLeft(n)?t.isLeft(r)?t.left(e.concat(n.left,r.left)):n:t.isLeft(r)?r:t.right(n.right(r.right))},of:t.of}}function j(e){return{URI:t.URI,_E:void 0,map:o,alt:function(n,r){if(t.isRight(n))return n;var i=r();return t.isLeft(i)?t.left(e.concat(n.left,i.left)):i}}}function O(e,n){return{concat:function(r,i){return t.isLeft(r)?t.isLeft(i)?t.left(e.concat(r.left,i.left)):r:t.isLeft(i)?i:t.right(n.concat(r.right,i.right))}}}t.map=function(e){return function(n){return t.isLeft(n)?n:t.right(e(n.right))}},t.bimap=function(e,n){return function(r){return t.isLeft(r)?t.left(e(r.left)):t.right(n(r.right))}},t.mapLeft=function(e){return function(n){return t.isLeft(n)?t.left(e(n.left)):n}},t.apW=function(e){return function(n){return t.isLeft(n)?n:t.isLeft(e)?e:t.right(n.right(e.right))}},t.ap=t.apW,t.apFirst=function(e){return i.flow(t.map((function(e){return function(){return e}})),t.ap(e))},t.apSecond=function(e){return i.flow(t.map((function(){return function(e){return e}})),t.ap(e))},t.of=t.right,t.chainW=function(e){return function(n){return t.isLeft(n)?n:e(n.right)}},t.chain=t.chainW,t.chainFirstW=function(e){return function(n){return i.pipe(n,t.chainW((function(n){return i.pipe(e(n),t.map((function(){return n})))})))}},t.chainFirst=t.chainFirstW,t.flatten=t.chain(i.identity),t.alt=function(e){return function(n){return t.isLeft(n)?e():n}},t.extend=function(e){return function(n){return t.isLeft(n)?n:t.right(e(n))}},t.duplicate=t.extend(i.identity),t.reduce=function(e,n){return function(r){return t.isLeft(r)?e:n(e,r.right)}},t.foldMap=function(e){return function(n){return function(r){return t.isLeft(r)?e.empty:n(r.right)}}},t.reduceRight=function(e,n){return function(r){return t.isLeft(r)?e:n(r.right,e)}},t.traverse=function(e){return function(n){return function(r){return t.isLeft(r)?e.of(t.left(r.left)):e.map(n(r.right),t.right)}}},t.sequence=function(e){return function(n){return t.isLeft(n)?e.of(t.left(n.left)):e.map(n.right,t.right)}},t.throwError=t.left,t.URI="Either",t.getShow=function(e,n){return{show:function(r){return t.isLeft(r)?"left("+e.show(r.left)+")":"right("+n.show(r.right)+")"}}},t.getEq=function(e,n){return{equals:function(r,i){return r===i||(t.isLeft(r)?t.isLeft(i)&&e.equals(r.left,i.left):t.isRight(i)&&n.equals(r.right,i.right))}}},t.getSemigroup=function(e){return{concat:function(n,r){return t.isLeft(r)?n:t.isLeft(n)?r:t.right(e.concat(n.right,r.right))}}},t.getApplySemigroup=x,t.getApplyMonoid=function(e){return{concat:x(e).concat,empty:t.right(e.empty)}},t.getFilterable=v,t.getWitherable=function(e){var n=v(e);return{URI:t.URI,_E:void 0,map:o,compact:n.compact,separate:n.separate,filter:n.filter,filterMap:n.filterMap,partition:n.partition,partitionMap:n.partitionMap,traverse:p,sequence:t.sequence,reduce:l,foldMap:c,reduceRight:f,wither:function(e){var t=p(e);return function(r,i){return e.map(t(r,i),n.compact)}},wilt:function(e){var t=p(e);return function(r,i){return e.map(t(r,i),n.separate)}}}},t.getApplicativeValidation=y,t.getAltValidation=j,t.getValidation=function(e){var n=y(e),r=j(e);return{URI:t.URI,_E:void 0,map:o,of:t.of,chain:u,bimap:h,mapLeft:d,reduce:l,foldMap:c,reduceRight:f,extend:m,traverse:p,sequence:t.sequence,chainRec:b,throwError:t.throwError,ap:n.ap,alt:r.alt}},t.getValidationSemigroup=O,t.Functor={URI:t.URI,map:o},t.Applicative={URI:t.URI,map:o,ap:s,of:t.of},t.Monad={URI:t.URI,map:o,ap:s,of:t.of,chain:u},t.Foldable={URI:t.URI,reduce:l,foldMap:c,reduceRight:f},t.Traversable={URI:t.URI,map:o,reduce:l,foldMap:c,reduceRight:f,traverse:p,sequence:t.sequence},t.Bifunctor={URI:t.URI,bimap:h,mapLeft:d},t.Alt={URI:t.URI,map:o,alt:g},t.Extend={URI:t.URI,map:o,extend:m},t.ChainRec={URI:t.URI,map:o,ap:s,chain:u,chainRec:b},t.MonadThrow={URI:t.URI,map:o,ap:s,of:t.of,chain:u,throwError:t.throwError},t.getValidationMonoid=function(e,n){return{concat:O(e,n).concat,empty:t.right(n.empty)}},t.either={URI:t.URI,map:o,of:t.of,ap:s,chain:u,reduce:l,foldMap:c,reduceRight:f,traverse:p,sequence:t.sequence,bimap:h,mapLeft:d,alt:g,extend:m,chainRec:b,throwError:t.throwError},t.toError=function(e){return e instanceof Error?e:new Error(String(e))},t.elem=function(e){return function(n,r){return!t.isLeft(r)&&e.equals(n,r.right)}},t.exists=function(e){return function(n){return!t.isLeft(n)&&e(n.right)}},t.bindTo=function(e){return t.map(i.bindTo_(e))},t.bindW=function(e,n){return t.chainW((function(r){return i.pipe(n(r),t.map((function(t){return i.bind_(r,e,t)})))}))},t.bind=t.bindW,t.apSW=function(e,n){return i.flow(t.map((function(t){return function(n){return i.bind_(t,e,n)}})),t.apW(n))},t.apS=t.apSW},function(e,t,n){"use strict";function r(e){return e}function i(e){throw new Error("Called `absurd` function which should be uncallable")}Object.defineProperty(t,"__esModule",{value:!0}),t.bindTo_=t.bind_=t.hole=t.pipe=t.untupled=t.tupled=t.absurd=t.decrement=t.increment=t.tuple=t.flow=t.flip=t.constVoid=t.constUndefined=t.constNull=t.constFalse=t.constTrue=t.constant=t.not=t.unsafeCoerce=t.identity=void 0,t.identity=r,t.unsafeCoerce=r,t.not=function(e){return function(t){return!e(t)}},t.constant=function(e){return function(){return e}},t.constTrue=function(){return!0},t.constFalse=function(){return!1},t.constNull=function(){return null},t.constUndefined=function(){},t.constVoid=function(){},t.flip=function(e){return function(t,n){return e(n,t)}},t.flow=function(e,t,n,r,i,a,o,s,u){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return n(t(e.apply(this,arguments)))};case 4:return function(){return r(n(t(e.apply(this,arguments))))};case 5:return function(){return i(r(n(t(e.apply(this,arguments)))))};case 6:return function(){return a(i(r(n(t(e.apply(this,arguments))))))};case 7:return function(){return o(a(i(r(n(t(e.apply(this,arguments)))))))};case 8:return function(){return s(o(a(i(r(n(t(e.apply(this,arguments))))))))};case 9:return function(){return u(s(o(a(i(r(n(t(e.apply(this,arguments)))))))))}}},t.tuple=function(){for(var e=[],t=0;tconsole.error("SEMVER",...e):()=>{};e.exports=n}).call(this,n(60))},function(e,t){const n=Number.MAX_SAFE_INTEGER||9007199254740991;e.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:n,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}},function(e,t,n){"use strict";var r=n(65),i=n(66);function a(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=v,t.resolve=function(e,t){return v(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?v(e,!1,!0).resolveObject(t):t},t.format=function(e){return i.isString(e)&&(e=v(e)),e instanceof a?e.format():a.prototype.format.call(e)},t.Url=a;var o=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,l=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(l),f=["%","/","?",";","#"].concat(c),p=["/","?","#"],h=/^[+a-z0-9A-Z_-]{0,63}$/,d=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,g={javascript:!0,"javascript:":!0},m={javascript:!0,"javascript:":!0},b={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},x=n(67);function v(e,t,n){if(e&&i.isObject(e)&&e instanceof a)return e;var r=new a;return r.parse(e,t,n),r}a.prototype.parse=function(e,t,n){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var a=e.indexOf("?"),s=-1!==a&&a127?N+="x":N+=_[L];if(!N.match(h)){var A=C.slice(0,T),z=C.slice(T+1),P=_.match(d);P&&(A.push(P[1]),z.unshift(P[2])),z.length&&(v="/"+z.join(".")+v),this.hostname=A.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=r.toASCII(this.hostname));var D=this.port?":"+this.port:"",U=this.hostname||"";this.host=U+D,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==v[0]&&(v="/"+v))}if(!g[O])for(T=0,F=c.length;T0)&&n.host.split("@"))&&(n.auth=I.shift(),n.host=n.hostname=I.shift())),n.search=e.search,n.query=e.query,i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!E.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var w=E.slice(-1)[0],M=(n.host||e.host||E.length>1)&&("."===w||".."===w)||""===w,T=0,k=E.length;k>=0;k--)"."===(w=E[k])?E.splice(k,1):".."===w?(E.splice(k,1),T++):T&&(E.splice(k,1),T--);if(!j&&!O)for(;T--;T)E.unshift("..");!j||""===E[0]||E[0]&&"/"===E[0].charAt(0)||E.unshift(""),M&&"/"!==E.join("/").substr(-1)&&E.push("");var I,C=""===E[0]||E[0]&&"/"===E[0].charAt(0);return S&&(n.hostname=n.host=C?"":E.length?E.shift():"",(I=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=I.shift(),n.host=n.hostname=I.shift())),(j=j||n.host&&E.length)&&!C&&E.unshift(""),E.length?n.pathname=E.join("/"):(n.pathname=null,n.path=null),i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},a.prototype.parseHost=function(){var e=this.host,t=s.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(18),i="undefined"!=typeof window?r.useLayoutEffect:r.useEffect;t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tailRec=void 0,t.tailRec=function(e,t){for(var n=t(e);"Left"===n._tag;)n=t(n.left);return n.right}},function(e,t,n){"use strict";e.exports=n(50)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(35),a=(r=n(18))&&"object"==typeof r&&"default"in r?r.default:r;function o(){return(o=Object.assign||function(e){for(var t=1;t0?"Infinity":"-Infinity")+" supplied to "+e.context.map((function(e){return e.key+": "+e.type.name})).join("/");var t}function o(e){return e.map(a)}function s(){return["No errors!"]}t.failure=o,t.success=s,t.PathReporter={report:i.fold(o,s)}},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},r(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),a=this&&this.__assign||function(){return a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n"},t.getContextEntry=function(e,t){return{key:e,type:t}},t.appendContext=function(e,t,n,r){for(var i=e.length,a=Array(i+1),o=0;o"),new F(n,(function(n){return t.UnknownArray.is(n)&&n.every(e.is)}),(function(n,r){return u(t.UnknownArray.validate(n,r),(function(n){for(var i=n.length,a=n,s=[],u=0;u0?t.failures(s):t.success(a)}))}),e.encode===t.identity?t.identity:function(t){return t.map(e.encode)},e)};var _=function(e){function t(t,n,r,i,a){var o=e.call(this,t,n,r,i)||this;return o.props=a,o._tag="InterfaceType",o}return i(t,e),t}(l);t.InterfaceType=_;var N=function(e){return Object.keys(e).map((function(t){return t+": "+e[t].name})).join(", ")},L=function(e){for(var n=0;n0?t.failures(l):t.success(u)}))}),L(i)?t.identity:function(e){for(var n=a({},e),o=0;o"};t.partial=function(e,n){void 0===n&&(n=z(R(e)));var r=Object.keys(e),i=r.map((function(t){return e[t]})),s=r.length;return new A(n,(function(n){if(t.UnknownRecord.is(n)){for(var i=0;i0?t.failures(l):t.success(u)}))}),L(i)?t.identity:function(e){for(var t=a({},e),n=0;n0?t.failures(s):t.success(f?a:r)}return p(n)&&Array.isArray(r)?t.success(r):t.failure(r,i)}),e.encode===t.identity&&n.encode===t.identity?t.identity:function(t){for(var r={},i=Object.keys(t),a=i.length,o=0;o0){var i=r[0],a=r[1],s=a.length,l=function(e){for(var t=0;t0?t.failures(s):t.success($(n,a))},0===e.length?t.identity:function(t){return $(t,e.map((function(e){return e.encode(t)})))},e)};var B=function(e){function t(t,n,r,i,a){var o=e.call(this,t,n,r,i)||this;return o.types=a,o._tag="TupleType",o}return i(t,e),t}(l);t.TupleType=B,t.tuple=function(e,n){void 0===n&&(n="["+e.map((function(e){return e.name})).join(", ")+"]");var r=e.length;return new B(n,(function(n){return t.UnknownArray.is(n)&&n.length===r&&e.every((function(e,t){return e.is(n[t])}))}),(function(n,i){return u(t.UnknownArray.validate(n,i),(function(n){for(var a=n.length>r?n.slice(0,r):n,s=[],u=0;u0?t.failures(s):t.success(a)}))}),L(e)?t.identity:function(t){return e.map((function(e,n){return e.encode(t[n])}))},e)};var G=function(e){function t(t,n,r,i,a){var o=e.call(this,t,n,r,i)||this;return o.type=a,o._tag="ReadonlyType",o}return i(t,e),t}(l);t.ReadonlyType=G,t.readonly=function(e,n){return void 0===n&&(n="Readonly<"+e.name+">"),new G(n,e.is,(function(t,n){return s(e.validate(t,n),(function(e){return e}))}),e.encode===t.identity?t.identity:e.encode,e)};var V=function(e){function t(t,n,r,i,a){var o=e.call(this,t,n,r,i)||this;return o.type=a,o._tag="ReadonlyArrayType",o}return i(t,e),t}(l);t.ReadonlyArrayType=V,t.readonlyArray=function(e,n){void 0===n&&(n="ReadonlyArray<"+e.name+">");var r=t.array(e);return new V(n,r.is,(function(e,t){return s(r.validate(e,t),(function(e){return e}))}),r.encode,e)},t.strict=function(e,n){return t.exact(t.type(e),n)};var W=function(e){function t(t,n,r,i,a,o){var s=e.call(this,t,n,r,i,a)||this;return s.tag=o,s}return i(t,e),t}(D);t.TaggedUnionType=W,t.taggedUnion=function(e,n,r){void 0===r&&(r=U(n));var i=t.union(n,r);return i instanceof W?i:(console.warn("[io-ts] Cannot build a tagged union for "+r+", returning a de-optimized union"),new W(r,i.is,i.validate,i.encode,n,e))};var H=function(e){function t(t,n,r,i,a){var o=e.call(this,t,n,r,i)||this;return o.type=a,o._tag="ExactType",o}return i(t,e),t}(l);t.ExactType=H;var Y=function(e){switch(e._tag){case"RefinementType":case"ReadonlyType":return Y(e.type);case"InterfaceType":case"StrictType":case"PartialType":return e.props;case"IntersectionType":return e.types.reduce((function(e,t){return Object.assign(e,Y(t))}),{})}},X=function(e,t){for(var n=Object.getOwnPropertyNames(e),r=!1,i={},a=0;a"}(e));var r=Y(e);return new H(n,e.is,(function(n,i){return u(t.UnknownRecord.validate(n,i),(function(){return s(e.validate(n,i),(function(e){return X(e,r)}))}))}),(function(t){return e.encode(X(t,r))}),e)},t.getValidationError=function(e,t){return{value:e,context:t}},t.getDefaultContext=function(e){return[{key:"",type:e}]};var K=function(e){function n(){var n=e.call(this,"never",(function(e){return!1}),(function(e,n){return t.failure(e,n)}),(function(){throw new Error("cannot encode never")}))||this;return n._tag="NeverType",n}return i(n,e),n}(l);t.NeverType=K,t.never=new K;var Z=function(e){function n(){var n=e.call(this,"any",(function(e){return!0}),t.success,t.identity)||this;return n._tag="AnyType",n}return i(n,e),n}(l);t.AnyType=Z,t.any=new Z,t.Dictionary=t.UnknownRecord;var J=function(e){function n(){var n=e.call(this,"object",(function(e){return null!==e&&"object"==typeof e}),(function(e,r){return n.is(e)?t.success(e):t.failure(e,r)}),t.identity)||this;return n._tag="ObjectType",n}return i(n,e),n}(l);function Q(e,n,r){return void 0===r&&(r="("+e.name+" | "+t.getFunctionName(n)+")"),new M(r,(function(t){return e.is(t)&&n(t)}),(function(r,i){return u(e.validate(r,i),(function(e){return n(e)?t.success(e):t.failure(e,i)}))}),e.encode,e,n)}t.ObjectType=J,t.object=new J,t.refinement=Q,t.Integer=Q(t.number,Number.isInteger,"Integer"),t.dictionary=t.record;var ee=function(e){function t(t,n,r,i,a){var o=e.call(this,t,n,r,i)||this;return o.props=a,o._tag="StrictType",o}return i(t,e),t}(l);t.StrictType=ee,t.clean=function(e){return e},t.alias=function(e){return function(){return e}};var te=function(e){return e.length>0};function ne(e,t){for(var n=[],r=0,i=e;rt?1:e>=t?0:NaN}function b(e){return null===e?NaN:+e}function x(e){return!isNaN(e)}function v(e){return{left:function(t,n,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);r>>1;e(t[a],n)<0?r=a+1:i=a}return r},right:function(t,n,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);r>>1;e(t[a],n)>0?i=a:r=a+1}return r}}}a.ascending=m,a.descending=function(e,t){return te?1:t>=e?0:NaN},a.min=function(e,t){var n,r,i=-1,a=e.length;if(1===arguments.length){for(;++i=r){n=r;break}for(;++ir&&(n=r)}else{for(;++i=r){n=r;break}for(;++ir&&(n=r)}return n},a.max=function(e,t){var n,r,i=-1,a=e.length;if(1===arguments.length){for(;++i=r){n=r;break}for(;++in&&(n=r)}else{for(;++i=r){n=r;break}for(;++in&&(n=r)}return n},a.extent=function(e,t){var n,r,i,a=-1,o=e.length;if(1===arguments.length){for(;++a=r){n=i=r;break}for(;++ar&&(n=r),i=r){n=i=r;break}for(;++ar&&(n=r),i1)return o/(u-1)},a.deviation=function(){var e=a.variance.apply(this,arguments);return e?Math.sqrt(e):e};var y=v(m);function j(e){return e.length}a.bisectLeft=y.left,a.bisect=a.bisectRight=y.right,a.bisector=function(e){return v(1===e.length?function(t,n){return m(e(t),n)}:e)},a.shuffle=function(e,t,n){(a=arguments.length)<3&&(n=e.length,a<2&&(t=0));for(var r,i,a=n-t;a;)i=Math.random()*a--|0,r=e[a+t],e[a+t]=e[i+t],e[i+t]=r;return e},a.permute=function(e,t){for(var n=t.length,r=new Array(n);n--;)r[n]=e[t[n]];return r},a.pairs=function(e){for(var t=0,n=e.length-1,r=e[0],i=new Array(n<0?0:n);t=0;)for(t=(r=e[i]).length;--t>=0;)n[--o]=r[t];return n};var O=Math.abs;function E(e,t){for(var n in t)Object.defineProperty(e.prototype,n,{value:t[n],enumerable:!1})}function S(){this._=Object.create(null)}a.range=function(e,t,n){if(arguments.length<3&&(n=1,arguments.length<2&&(t=e,e=0)),(t-e)/n==1/0)throw new Error("infinite range");var r,i=[],a=function(e){for(var t=1;e*t%1;)t*=10;return t}(O(n)),o=-1;if(e*=a,t*=a,(n*=a)<0)for(;(r=e+n*++o)>t;)i.push(r/a);else for(;(r=e+n*++o)=r.length)return t?t.call(n,a):e?a.sort(e):a;for(var u,l,c,f,p=-1,h=a.length,d=r[s++],g=new S;++p=r.length)return e;var n=[],a=i[t++];return e.forEach((function(e,r){n.push({key:e,values:s(r,t)})})),a?n.sort((function(e,t){return a(e.key,t.key)})):n}return n.map=function(e,t){return o(t,e,0)},n.entries=function(e){return s(o(a.map,e,0),0)},n.key=function(e){return r.push(e),n},n.sortKeys=function(e){return i[r.length-1]=e,n},n.sortValues=function(t){return e=t,n},n.rollup=function(e){return t=e,n},n},a.set=function(e){var t=new L;if(e)for(var n=0,r=e.length;n=0&&(r=e.slice(n+1),e=e.slice(0,n)),e)return arguments.length<2?this[e].on(r):this[e].on(r,t);if(2===arguments.length){if(null==t)for(e in this)this.hasOwnProperty(e)&&this[e].on(r,null);return this}},a.event=null,a.requote=function(e){return e.replace(V,"\\$&")};var V=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,W={}.__proto__?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)e[n]=t[n]};function H(e){return W(e,Z),e}var Y=function(e,t){return t.querySelector(e)},X=function(e,t){return t.querySelectorAll(e)},K=function(e,t){var n=e.matches||e[z(e,"matchesSelector")];return K=function(e,t){return n.call(e,t)},K(e,t)};"function"==typeof Sizzle&&(Y=function(e,t){return Sizzle(e,t)[0]||null},X=Sizzle,K=Sizzle.matchesSelector),a.selection=function(){return a.select(u.documentElement)};var Z=a.selection.prototype=[];function J(e){return"function"==typeof e?e:function(){return Y(e,this)}}function Q(e){return"function"==typeof e?e:function(){return X(e,this)}}Z.select=function(e){var t,n,r,i,a=[];e=J(e);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(n=e.slice(0,t))&&(e=e.slice(t+1)),te.hasOwnProperty(n)?{space:te[n],local:e}:e}},Z.attr=function(e,t){if(arguments.length<2){if("string"==typeof e){var n=this.node();return(e=a.ns.qualify(e)).local?n.getAttributeNS(e.space,e.local):n.getAttribute(e)}for(t in e)this.each(ne(t,e[t]));return this}return this.each(ne(e,t))},Z.classed=function(e,t){if(arguments.length<2){if("string"==typeof e){var n=this.node(),r=(e=ae(e)).length,i=-1;if(t=n.classList){for(;++i=0;)(n=r[i])&&(a&&a!==n.nextSibling&&a.parentNode.insertBefore(n,a),a=n);return this},Z.sort=function(e){e=de.apply(this,arguments);for(var t=-1,n=this.length;++t0&&(e=e.slice(0,i));var u=ve.get(e);function l(){var t=this[r];t&&(this.removeEventListener(e,t,t.$),delete this[r])}return u&&(e=u,o=je),i?t?function(){var i=o(t,s(arguments));l.call(this),this.addEventListener(e,this[r]=i,i.$=n),i._=t}:l:t?D:function(){var t,n=new RegExp("^__on([^.]+)"+a.requote(e)+"$");for(var r in this)if(t=r.match(n)){var i=this[r];this.removeEventListener(t[1],i,i.$),delete this[r]}}}a.selection.enter=me,a.selection.enter.prototype=be,be.append=Z.append,be.empty=Z.empty,be.node=Z.node,be.call=Z.call,be.size=Z.size,be.select=function(e){for(var t,n,r,i,a,o=[],s=-1,u=this.length;++s=r&&(r=t+1);!(o=s[r])&&++r0?1:e<0?-1:0}function ze(e,t,n){return(t[0]-e[0])*(n[1]-e[1])-(t[1]-e[1])*(n[0]-e[0])}function Pe(e){return e>1?0:e<-1?Ce:Math.acos(e)}function De(e){return e>1?Ne:e<-1?-Ne:Math.asin(e)}function Ue(e){return((e=Math.exp(e))+1/e)/2}function qe(e){return(e=Math.sin(e/2))*e}var $e=Math.SQRT2;a.interpolateZoom=function(e,t){var n,r,i=e[0],a=e[1],o=e[2],s=t[0],u=t[1],l=t[2],c=s-i,f=u-a,p=c*c+f*f;if(p0&&(e=e.transition().duration(g)),e.call(O.event)}function T(){s&&s.domain(o.range().map((function(e){return(e-p.x)/p.k})).map(o.invert)),f&&f.domain(l.range().map((function(e){return(e-p.y)/p.k})).map(l.invert))}function k(e){m++||e({type:"zoomstart"})}function I(e){T(),e({type:"zoom",scale:p.k,translate:[p.x,p.y]})}function C(e){--m||(e({type:"zoomend"}),t=null)}function F(){var e=this,t=j.of(e,arguments),n=0,r=a.select(c(e)).on(x,(function(){n=1,w(a.mouse(e),i),I(t)})).on(v,(function(){r.on(x,null).on(v,null),o(n),C(t)})),i=E(a.mouse(e)),o=Se(e);Cs.call(e),k(t)}function _(){var e,t=this,n=j.of(t,arguments),r={},o=0,s=".zoom-"+a.event.changedTouches[0].identifier,u="touchmove"+s,l="touchend"+s,c=[],f=a.select(t),h=Se(t);function d(){var n=a.touches(t);return e=p.k,n.forEach((function(e){e.identifier in r&&(r[e.identifier]=E(e))})),n}function g(){var e=a.event.target;a.select(e).on(u,m).on(l,x),c.push(e);for(var n=a.event.changedTouches,s=0,f=n.length;s1){b=h[0];var v=h[1],y=b[0]-v[0],j=b[1]-v[1];o=y*y+j*j}}function m(){var s,u,l,c,f=a.touches(t);Cs.call(t);for(var p=0,h=f.length;p360?e-=360:e<0&&(e+=360),e<60?r+(i-r)*e/60:e<180?i:e<240?r+(i-r)*(240-e)/60:r}(e))}return e=isNaN(e)?0:(e%=360)<0?e+360:e,t=isNaN(t)||t<0?0:t>1?1:t,r=2*(n=n<0?0:n>1?1:n)-(i=n<=.5?n*(1+t):n+t-n*t),new lt(a(e+120),a(e),a(e-120))}function Ke(e,t,n){return this instanceof Ke?(this.h=+e,this.c=+t,void(this.l=+n)):arguments.length<2?e instanceof Ke?new Ke(e.h,e.c,e.l):function(e,t,n){return e>0?new Ke(Math.atan2(n,t)*Re,Math.sqrt(t*t+n*n),e):new Ke(NaN,NaN,e)}(e instanceof Qe?e.l:(e=mt((e=a.rgb(e)).r,e.g,e.b)).l,e.a,e.b):new Ke(e,t,n)}Ye.brighter=function(e){return e=Math.pow(.7,arguments.length?e:1),new He(this.h,this.s,this.l/e)},Ye.darker=function(e){return e=Math.pow(.7,arguments.length?e:1),new He(this.h,this.s,e*this.l)},Ye.rgb=function(){return Xe(this.h,this.s,this.l)},a.hcl=Ke;var Ze=Ke.prototype=new We;function Je(e,t,n){return isNaN(e)&&(e=0),isNaN(t)&&(t=0),new Qe(n,Math.cos(e*=Le)*t,Math.sin(e)*t)}function Qe(e,t,n){return this instanceof Qe?(this.l=+e,this.a=+t,void(this.b=+n)):arguments.length<2?e instanceof Qe?new Qe(e.l,e.a,e.b):e instanceof Ke?Je(e.h,e.c,e.l):mt((e=lt(e)).r,e.g,e.b):new Qe(e,t,n)}Ze.brighter=function(e){return new Ke(this.h,this.c,Math.min(100,this.l+et*(arguments.length?e:1)))},Ze.darker=function(e){return new Ke(this.h,this.c,Math.max(0,this.l-et*(arguments.length?e:1)))},Ze.rgb=function(){return Je(this.h,this.c,this.l).rgb()},a.lab=Qe;var et=18,tt=.95047,nt=1,rt=1.08883,it=Qe.prototype=new We;function at(e,t,n){var r=(e+16)/116,i=r+t/500,a=r-n/200;return new lt(ut(3.2404542*(i=ot(i)*tt)-1.5371385*(r=ot(r)*nt)-.4985314*(a=ot(a)*rt)),ut(-.969266*i+1.8760108*r+.041556*a),ut(.0556434*i-.2040259*r+1.0572252*a))}function ot(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function st(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function ut(e){return Math.round(255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function lt(e,t,n){return this instanceof lt?(this.r=~~e,this.g=~~t,void(this.b=~~n)):arguments.length<2?e instanceof lt?new lt(e.r,e.g,e.b):dt(""+e,lt,Xe):new lt(e,t,n)}function ct(e){return new lt(e>>16,e>>8&255,255&e)}function ft(e){return ct(e)+""}it.brighter=function(e){return new Qe(Math.min(100,this.l+et*(arguments.length?e:1)),this.a,this.b)},it.darker=function(e){return new Qe(Math.max(0,this.l-et*(arguments.length?e:1)),this.a,this.b)},it.rgb=function(){return at(this.l,this.a,this.b)},a.rgb=lt;var pt=lt.prototype=new We;function ht(e){return e<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function dt(e,t,n){var r,i,a,o=0,s=0,u=0;if(r=/([a-z]+)\((.*)\)/.exec(e=e.toLowerCase()))switch(i=r[2].split(","),r[1]){case"hsl":return n(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return t(xt(i[0]),xt(i[1]),xt(i[2]))}return(a=vt.get(e))?t(a.r,a.g,a.b):(null==e||"#"!==e.charAt(0)||isNaN(a=parseInt(e.slice(1),16))||(4===e.length?(o=(3840&a)>>4,o|=o>>4,s=240&a,s|=s>>4,u=15&a,u|=u<<4):7===e.length&&(o=(16711680&a)>>16,s=(65280&a)>>8,u=255&a)),t(o,s,u))}function gt(e,t,n){var r,i,a=Math.min(e/=255,t/=255,n/=255),o=Math.max(e,t,n),s=o-a,u=(o+a)/2;return s?(i=u<.5?s/(o+a):s/(2-o-a),r=e==o?(t-n)/s+(t0&&u<1?0:r),new He(r,i,u)}function mt(e,t,n){var r=st((.4124564*(e=bt(e))+.3575761*(t=bt(t))+.1804375*(n=bt(n)))/tt),i=st((.2126729*e+.7151522*t+.072175*n)/nt);return Qe(116*i-16,500*(r-i),200*(i-st((.0193339*e+.119192*t+.9503041*n)/rt)))}function bt(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function xt(e){var t=parseFloat(e);return"%"===e.charAt(e.length-1)?Math.round(2.55*t):t}pt.brighter=function(e){e=Math.pow(.7,arguments.length?e:1);var t=this.r,n=this.g,r=this.b,i=30;return t||n||r?(t&&t=200&&t<300||304===t){try{e=n.call(i,l)}catch(e){return void o.error.call(i,e)}o.load.call(i,e)}else o.error.call(i,l)}return this.XDomainRequest&&!("withCredentials"in l)&&/^(http(s)?:)?\/\//.test(e)&&(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=f:l.onreadystatechange=function(){l.readyState>3&&f()},l.onprogress=function(e){var t=a.event;a.event=e;try{o.progress.call(i,l)}finally{a.event=t}},i.header=function(e,t){return e=(e+"").toLowerCase(),arguments.length<2?u[e]:(null==t?delete u[e]:u[e]=t+"",i)},i.mimeType=function(e){return arguments.length?(t=null==e?null:e+"",i):t},i.responseType=function(e){return arguments.length?(c=e,i):c},i.response=function(e){return n=e,i},["get","post"].forEach((function(e){i[e]=function(){return i.send.apply(i,[e].concat(s(arguments)))}})),i.send=function(n,r,a){if(2===arguments.length&&"function"==typeof r&&(a=r,r=null),l.open(n,e,!0),null==t||"accept"in u||(u.accept=t+",*/*"),l.setRequestHeader)for(var s in u)l.setRequestHeader(s,u[s]);return null!=t&&l.overrideMimeType&&l.overrideMimeType(t),null!=c&&(l.responseType=c),null!=a&&i.on("error",a).on("load",(function(e){a(null,e)})),o.beforesend.call(i,l),l.send(null==r?null:r),i},i.abort=function(){return l.abort(),i},a.rebind(i,o,"on"),null==r?i:i.get(function(e){return 1===e.length?function(t,n){e(null==t?n:null)}:e}(r))}vt.forEach((function(e,t){vt.set(e,ct(t))})),a.functor=yt,a.xhr=jt(R),a.dsv=function(e,t){var n=new RegExp('["'+e+"\n]"),r=e.charCodeAt(0);function i(e,n,r){arguments.length<3&&(r=n,n=null);var i=Ot(e,t,null==n?a:o(n),r);return i.row=function(e){return arguments.length?i.response(null==(n=e)?a:o(e)):n},i}function a(e){return i.parse(e.responseText)}function o(e){return function(t){return i.parse(t.responseText,e)}}function s(t){return t.map(u).join(e)}function u(e){return n.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}return i.parse=function(e,t){var n;return i.parseRows(e,(function(e,r){if(n)return n(e,r-1);var i=new Function("d","return {"+e.map((function(e,t){return JSON.stringify(e)+": d["+t+"]"})).join(",")+"}");n=t?function(e,n){return t(i(e),n)}:i}))},i.parseRows=function(e,t){var n,i,a={},o={},s=[],u=e.length,l=0,c=0;function f(){if(l>=u)return o;if(i)return i=!1,a;var t=l;if(34===e.charCodeAt(t)){for(var n=t;n++24?(isFinite(t)&&(clearTimeout(Mt),Mt=setTimeout(It,t)),wt=0):(wt=1,Tt(It))}function Ct(){for(var e=Date.now(),t=Et;t;)e>=t.t&&t.c(e-t.t)&&(t.c=null),t=t.n;return e}function Ft(){for(var e,t=Et,n=1/0;t;)t.c?(t.t8?function(e){return e/n}:function(e){return e*n},symbol:e}}));function Lt(e){var t=e.decimal,n=e.thousands,r=e.grouping,i=e.currency,o=r&&n?function(e,t){for(var i=e.length,a=[],o=0,s=r[0],u=0;i>0&&s>0&&(u+s+1>t&&(s=Math.max(1,t-u)),a.push(e.substring(i-=s,i+s)),!((u+=s+1)>t));)s=r[o=(o+1)%r.length];return a.reverse().join(n)}:R;return function(e){var n=Rt.exec(e),r=n[1]||" ",s=n[2]||">",u=n[3]||"-",l=n[4]||"",c=n[5],f=+n[6],p=n[7],h=n[8],d=n[9],g=1,m="",b="",x=!1,v=!0;switch(h&&(h=+h.substring(1)),(c||"0"===r&&"="===s)&&(c=r="0",s="="),d){case"n":p=!0,d="g";break;case"%":g=100,b="%",d="f";break;case"p":g=100,b="%",d="r";break;case"b":case"o":case"x":case"X":"#"===l&&(m="0"+d.toLowerCase());case"c":v=!1;case"d":x=!0,h=0;break;case"s":g=-1,d="r"}"$"===l&&(m=i[0],b=i[1]),"r"!=d||h||(d="g"),null!=h&&("g"==d?h=Math.max(1,Math.min(21,h)):"e"!=d&&"f"!=d||(h=Math.max(0,Math.min(20,h)))),d=At.get(d)||zt;var y=c&&p;return function(e){var n=b;if(x&&e%1)return"";var i=e<0||0===e&&1/e<0?(e=-e,"-"):"-"===u?"":u;if(g<0){var l=a.formatPrefix(e,h);e=l.scale(e),n=l.symbol+b}else e*=g;var j,O,E=(e=d(e,h)).lastIndexOf(".");if(E<0){var S=v?e.lastIndexOf("e"):-1;S<0?(j=e,O=""):(j=e.substring(0,S),O=e.substring(S))}else j=e.substring(0,E),O=t+e.substring(E+1);!c&&p&&(j=o(j,1/0));var w=m.length+j.length+O.length+(y?0:i.length),M=w"===s?M+i+e:"^"===s?M.substring(0,w>>=1)+i+e+M.substring(w):i+(y?e:M+e))+n}}}a.formatPrefix=function(e,t){var n=0;return(e=+e)&&(e<0&&(e*=-1),t&&(e=a.round(e,_t(e,t))),n=1+Math.floor(1e-12+Math.log(e)/Math.LN10),n=Math.max(-24,Math.min(24,3*Math.floor((n-1)/3)))),Nt[8+n/3]};var Rt=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,At=a.map({b:function(e){return e.toString(2)},c:function(e){return String.fromCharCode(e)},o:function(e){return e.toString(8)},x:function(e){return e.toString(16)},X:function(e){return e.toString(16).toUpperCase()},g:function(e,t){return e.toPrecision(t)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},r:function(e,t){return(e=a.round(e,_t(e,t))).toFixed(Math.max(0,Math.min(20,_t(e*(1+1e-15),t))))}});function zt(e){return e+""}var Pt=a.time={},Dt=Date;function Ut(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}Ut.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){qt.setUTCDate.apply(this._,arguments)},setDay:function(){qt.setUTCDay.apply(this._,arguments)},setFullYear:function(){qt.setUTCFullYear.apply(this._,arguments)},setHours:function(){qt.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){qt.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){qt.setUTCMinutes.apply(this._,arguments)},setMonth:function(){qt.setUTCMonth.apply(this._,arguments)},setSeconds:function(){qt.setUTCSeconds.apply(this._,arguments)},setTime:function(){qt.setTime.apply(this._,arguments)}};var qt=Date.prototype;function $t(e,t,n){function r(t){var n=e(t),r=a(n,1);return t-n1)for(;o=l)return-1;if(37===(i=t.charCodeAt(s++))){if(o=t.charAt(s++),!(a=O[o in Vt?t.charAt(s++):o])||(r=a(e,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}c.utc=function(e){var t=c(e);function n(e){try{var n=new(Dt=Ut);return n._=e,t(n)}finally{Dt=Date}}return n.parse=function(e){try{Dt=Ut;var n=t.parse(e);return n&&n._}finally{Dt=Date}},n.toString=t.toString,n},c.multi=c.utc.multi=hn;var p=a.map(),h=Xt(o),d=Kt(o),g=Xt(s),m=Kt(s),b=Xt(u),x=Kt(u),v=Xt(l),y=Kt(l);i.forEach((function(e,t){p.set(e.toLowerCase(),t)}));var j={a:function(e){return s[e.getDay()]},A:function(e){return o[e.getDay()]},b:function(e){return l[e.getMonth()]},B:function(e){return u[e.getMonth()]},c:c(t),d:function(e,t){return Yt(e.getDate(),t,2)},e:function(e,t){return Yt(e.getDate(),t,2)},H:function(e,t){return Yt(e.getHours(),t,2)},I:function(e,t){return Yt(e.getHours()%12||12,t,2)},j:function(e,t){return Yt(1+Pt.dayOfYear(e),t,3)},L:function(e,t){return Yt(e.getMilliseconds(),t,3)},m:function(e,t){return Yt(e.getMonth()+1,t,2)},M:function(e,t){return Yt(e.getMinutes(),t,2)},p:function(e){return i[+(e.getHours()>=12)]},S:function(e,t){return Yt(e.getSeconds(),t,2)},U:function(e,t){return Yt(Pt.sundayOfYear(e),t,2)},w:function(e){return e.getDay()},W:function(e,t){return Yt(Pt.mondayOfYear(e),t,2)},x:c(n),X:c(r),y:function(e,t){return Yt(e.getFullYear()%100,t,2)},Y:function(e,t){return Yt(e.getFullYear()%1e4,t,4)},Z:fn,"%":function(){return"%"}},O={a:function(e,t,n){g.lastIndex=0;var r=g.exec(t.slice(n));return r?(e.w=m.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(e,t,n){h.lastIndex=0;var r=h.exec(t.slice(n));return r?(e.w=d.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(e,t,n){v.lastIndex=0;var r=v.exec(t.slice(n));return r?(e.m=y.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(e,t,n){b.lastIndex=0;var r=b.exec(t.slice(n));return r?(e.m=x.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(e,t,n){return f(e,j.c.toString(),t,n)},d:an,e:an,H:sn,I:sn,j:on,L:cn,m:rn,M:un,p:function(e,t,n){var r=p.get(t.slice(n,n+=2).toLowerCase());return null==r?-1:(e.p=r,n)},S:ln,U:Jt,w:Zt,W:Qt,x:function(e,t,n){return f(e,j.x.toString(),t,n)},X:function(e,t,n){return f(e,j.X.toString(),t,n)},y:tn,Y:en,Z:nn,"%":pn};return c}Pt.year=$t((function(e){return(e=Pt.day(e)).setMonth(0,1),e}),(function(e,t){e.setFullYear(e.getFullYear()+t)}),(function(e){return e.getFullYear()})),Pt.years=Pt.year.range,Pt.years.utc=Pt.year.utc.range,Pt.day=$t((function(e){var t=new Dt(2e3,0);return t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t}),(function(e,t){e.setDate(e.getDate()+t)}),(function(e){return e.getDate()-1})),Pt.days=Pt.day.range,Pt.days.utc=Pt.day.utc.range,Pt.dayOfYear=function(e){var t=Pt.year(e);return Math.floor((e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach((function(e,t){t=7-t;var n=Pt[e]=$t((function(e){return(e=Pt.day(e)).setDate(e.getDate()-(e.getDay()+t)%7),e}),(function(e,t){e.setDate(e.getDate()+7*Math.floor(t))}),(function(e){var n=Pt.year(e).getDay();return Math.floor((Pt.dayOfYear(e)+(n+t)%7)/7)-(n!==t)}));Pt[e+"s"]=n.range,Pt[e+"s"].utc=n.utc.range,Pt[e+"OfYear"]=function(e){var n=Pt.year(e).getDay();return Math.floor((Pt.dayOfYear(e)+(n+t)%7)/7)}})),Pt.week=Pt.sunday,Pt.weeks=Pt.sunday.range,Pt.weeks.utc=Pt.sunday.utc.range,Pt.weekOfYear=Pt.sundayOfYear;var Vt={"-":"",_:" ",0:"0"},Wt=/^\s*\d+/,Ht=/^%/;function Yt(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",a=i.length;return r+(a68?1900:2e3),n+i[0].length):-1}function nn(e,t,n){return/^[+-]\d{4}$/.test(t=t.slice(n,n+5))?(e.Z=-t,n+5):-1}function rn(e,t,n){Wt.lastIndex=0;var r=Wt.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function an(e,t,n){Wt.lastIndex=0;var r=Wt.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function on(e,t,n){Wt.lastIndex=0;var r=Wt.exec(t.slice(n,n+3));return r?(e.j=+r[0],n+r[0].length):-1}function sn(e,t,n){Wt.lastIndex=0;var r=Wt.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function un(e,t,n){Wt.lastIndex=0;var r=Wt.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function ln(e,t,n){Wt.lastIndex=0;var r=Wt.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function cn(e,t,n){Wt.lastIndex=0;var r=Wt.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function fn(e){var t=e.getTimezoneOffset(),n=t>0?"-":"+",r=O(t)/60|0,i=O(t)%60;return n+Yt(r,"0",2)+Yt(i,"0",2)}function pn(e,t,n){Ht.lastIndex=0;var r=Ht.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function hn(e){for(var t=e.length,n=-1;++n=0?1:-1,s=o*a,u=Math.cos(t),l=Math.sin(t),c=i*l,f=r*u+c*Math.cos(s),p=c*o*Math.sin(s);Rn.add(Math.atan2(p,f)),n=e,r=u,i=l}An.point=function(o,s){An.point=a,n=(e=o)*Le,r=Math.cos(s=(t=s)*Le/2+Ce/4),i=Math.sin(s)},An.lineEnd=function(){a(e,t)}}function Pn(e){var t=e[0],n=e[1],r=Math.cos(n);return[r*Math.cos(t),r*Math.sin(t),Math.sin(n)]}function Dn(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Un(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function qn(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function $n(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Bn(e){var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function Gn(e){return[Math.atan2(e[1],e[0]),De(e[2])]}function Vn(e,t){return O(e[0]-t[0])ke?r=90:l<-ke&&(t=-90),f[0]=e,f[1]=n}};function h(i,a){c.push(f=[e=i,n=i]),ar&&(r=a)}function d(a,o){var s=Pn([a*Le,o*Le]);if(u){var l=Un(u,s),c=Un([l[1],-l[0],0],l);Bn(c),c=Gn(c);var f=a-i,p=f>0?1:-1,d=c[0]*Re*p,g=O(f)>180;if(g^(p*ir&&(r=m);else if(g^(p*i<(d=(d+360)%360-180)&&dr&&(r=o);g?ay(e,n)&&(n=a):y(a,n)>y(e,n)&&(e=a):n>=e?(an&&(n=a)):a>i?y(e,a)>y(e,n)&&(n=a):y(a,n)>y(e,n)&&(e=a)}else h(a,o);u=s,i=a}function g(){p.point=d}function m(){f[0]=e,f[1]=n,p.point=h,u=null}function b(e,t){if(u){var n=e-i;l+=O(n)>180?n+(n>0?360:-360):n}else o=e,s=t;An.point(e,t),d(e,t)}function x(){An.lineStart()}function v(){b(o,s),An.lineEnd(),O(l)>ke&&(e=-(n=180)),f[0]=e,f[1]=n,u=null}function y(e,t){return(t-=e)<0?t+360:t}function j(e,t){return e[0]-t[0]}function E(e,t){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:ey(g[0],g[1])&&(g[1]=h[1]),y(h[0],g[1])>y(g[0],g[1])&&(g[0]=h[0])):s.push(g=h);for(var u,l,h,d=-1/0,g=(o=0,s[l=s.length-1]);o<=l;g=h,++o)h=s[o],(u=y(g[1],h[0]))>d&&(d=u,e=h[0],n=g[1])}return c=f=null,e===1/0||t===1/0?[[NaN,NaN],[NaN,NaN]]:[[e,t],[n,r]]}}(),a.geo.centroid=function(e){Sn=wn=Mn=Tn=kn=In=Cn=Fn=_n=Nn=Ln=0,a.geo.stream(e,Wn);var t=_n,n=Nn,r=Ln,i=t*t+n*n+r*r;return i=0;--s)i.point((f=c[s])[0],f[1]);else r(h.x,h.p.x,-1,i);h=h.p}c=(h=h.o).z,d=!d}while(!h.v);i.lineEnd()}}}function tr(e){if(t=e.length){for(var t,n,r=0,i=e[0];++r=0?1:-1,E=O*j,S=E>Ce,w=d*v;if(Rn.add(Math.atan2(w*O*Math.sin(E),g*y+w*Math.cos(E))),a+=S?j+O*Fe:j,S^p>=n^b>=n){var M=Un(Pn(f),Pn(e));Bn(M);var T=Un(i,M);Bn(T);var k=(S^j>=0?-1:1)*De(T[2]);(r>k||r===k&&(M[0]||M[1]))&&(o+=S^j>=0?1:-1)}if(!m++)break;p=b,d=v,g=y,f=e}}return(a<-ke||a0){for(v||(o.polygonStart(),v=!0),o.lineStart();++a1&&2&t&&n.push(n.pop().concat(n.shift())),s.push(n.filter(ir))}return c}}function ir(e){return e.length>1}function ar(){var e,t=[];return{lineStart:function(){t.push(e=[])},point:function(t,n){e.push([t,n])},lineEnd:D,buffer:function(){var n=t;return t=[],e=null,n},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function or(e,t){return((e=e.x)[0]<0?e[1]-Ne-ke:Ne-e[1])-((t=t.x)[0]<0?t[1]-Ne-ke:Ne-t[1])}var sr=rr(Qn,(function(e){var t,n=NaN,r=NaN,i=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(a,o){var s=a>0?Ce:-Ce,u=O(a-n);O(u-Ce)0?Ne:-Ne),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(s,r),e.point(a,r),t=0):i!==s&&u>=Ce&&(O(n-i)ke?Math.atan((Math.sin(t)*(a=Math.cos(r))*Math.sin(n)-Math.sin(r)*(i=Math.cos(t))*Math.sin(e))/(i*a*o)):(t+r)/2}(n,r,a,o),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(s,r),t=0),e.point(n=a,r=o),i=s},lineEnd:function(){e.lineEnd(),n=r=NaN},clean:function(){return 2-t}}}),(function(e,t,n,r){var i;if(null==e)i=n*Ne,r.point(-Ce,i),r.point(0,i),r.point(Ce,i),r.point(Ce,0),r.point(Ce,-i),r.point(0,-i),r.point(-Ce,-i),r.point(-Ce,0),r.point(-Ce,i);else if(O(e[0]-t[0])>ke){var a=e[0]0)){if(a/=p,p<0){if(a0){if(a>f)return;a>c&&(c=a)}if(a=n-u,p||!(a<0)){if(a/=p,p<0){if(a>f)return;a>c&&(c=a)}else if(p>0){if(a0)){if(a/=h,h<0){if(a0){if(a>f)return;a>c&&(c=a)}if(a=r-l,h||!(a<0)){if(a/=h,h<0){if(a>f)return;a>c&&(c=a)}else if(h>0){if(a0&&(i.a={x:u+c*p,y:l+c*h}),f<1&&(i.b={x:u+f*p,y:l+f*h}),i}}}}}}var lr=1e9;function cr(e,t,n,r){return function(u){var l,c,f,p,h,d,g,m,b,x,v,y=u,j=ar(),O=ur(e,t,n,r),E={point:M,lineStart:function(){E.point=T,c&&c.push(f=[]),x=!0,b=!1,g=m=NaN},lineEnd:function(){l&&(T(p,h),d&&b&&j.rejoin(),l.push(j.buffer())),E.point=M,b&&u.lineEnd()},polygonStart:function(){u=j,l=[],c=[],v=!0},polygonEnd:function(){u=y,l=a.merge(l);var t=function(e){for(var t=0,n=c.length,r=e[1],i=0;ir&&ze(l,a,e)>0&&++t:a[1]<=r&&ze(l,a,e)<0&&--t,l=a;return 0!==t}([e,r]),n=v&&t,i=l.length;(n||i)&&(u.polygonStart(),n&&(u.lineStart(),S(null,null,1,u),u.lineEnd()),i&&er(l,o,t,S,u),u.polygonEnd()),l=c=f=null}};function S(a,o,u,l){var c=0,f=0;if(null==a||(c=i(a,u))!==(f=i(o,u))||s(a,o)<0^u>0)do{l.point(0===c||3===c?e:n,c>1?r:t)}while((c=(c+u+4)%4)!==f);else l.point(o[0],o[1])}function w(i,a){return e<=i&&i<=n&&t<=a&&a<=r}function M(e,t){w(e,t)&&u.point(e,t)}function T(e,t){var n=w(e=Math.max(-lr,Math.min(lr,e)),t=Math.max(-lr,Math.min(lr,t)));if(c&&f.push([e,t]),x)p=e,h=t,d=n,x=!1,n&&(u.lineStart(),u.point(e,t));else if(n&&b)u.point(e,t);else{var r={a:{x:g,y:m},b:{x:e,y:t}};O(r)?(b||(u.lineStart(),u.point(r.a.x,r.a.y)),u.point(r.b.x,r.b.y),n||u.lineEnd(),v=!1):n&&(u.lineStart(),u.point(e,t),v=!1)}g=e,m=t,b=n}return E};function i(r,i){return O(r[0]-e)0?0:3:O(r[0]-n)0?2:1:O(r[1]-t)0?1:0:i>0?3:2}function o(e,t){return s(e.x,t.x)}function s(e,t){var n=i(e,1),r=i(t,1);return n!==r?n-r:0===n?t[1]-e[1]:1===n?e[0]-t[0]:2===n?e[1]-t[1]:t[0]-e[0]}}function fr(e){var t=0,n=Ce/3,r=Rr(e),i=r(t,n);return i.parallels=function(e){return arguments.length?r(t=e[0]*Ce/180,n=e[1]*Ce/180):[t/Ce*180,n/Ce*180]},i}function pr(e,t){var n=Math.sin(e),r=(n+Math.sin(t))/2,i=1+n*(2*r-n),a=Math.sqrt(i)/r;function o(e,t){var n=Math.sqrt(i-2*r*Math.sin(t))/r;return[n*Math.sin(e*=r),a-n*Math.cos(e)]}return o.invert=function(e,t){var n=a-t;return[Math.atan2(e,n)/r,De((i-(e*e+n*n)*r*r)/(2*r))]},o}a.geo.clipExtent=function(){var e,t,n,r,i,a,o={stream:function(e){return i&&(i.valid=!1),(i=a(e)).valid=!0,i},extent:function(s){return arguments.length?(a=cr(e=+s[0][0],t=+s[0][1],n=+s[1][0],r=+s[1][1]),i&&(i.valid=!1,i=null),o):[[e,t],[n,r]]}};return o.extent([[0,0],[960,500]])},(a.geo.conicEqualArea=function(){return fr(pr)}).raw=pr,a.geo.albers=function(){return a.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},a.geo.albersUsa=function(){var e,t,n,r,i=a.geo.albers(),o=a.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=a.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),u={point:function(t,n){e=[t,n]}};function l(i){var a=i[0],o=i[1];return e=null,t(a,o),e||(n(a,o),e)||r(a,o),e}return l.invert=function(e){var t=i.scale(),n=i.translate(),r=(e[0]-n[0])/t,a=(e[1]-n[1])/t;return(a>=.12&&a<.234&&r>=-.425&&r<-.214?o:a>=.166&&a<.234&&r>=-.214&&r<-.115?s:i).invert(e)},l.stream=function(e){var t=i.stream(e),n=o.stream(e),r=s.stream(e);return{point:function(e,i){t.point(e,i),n.point(e,i),r.point(e,i)},sphere:function(){t.sphere(),n.sphere(),r.sphere()},lineStart:function(){t.lineStart(),n.lineStart(),r.lineStart()},lineEnd:function(){t.lineEnd(),n.lineEnd(),r.lineEnd()},polygonStart:function(){t.polygonStart(),n.polygonStart(),r.polygonStart()},polygonEnd:function(){t.polygonEnd(),n.polygonEnd(),r.polygonEnd()}}},l.precision=function(e){return arguments.length?(i.precision(e),o.precision(e),s.precision(e),l):i.precision()},l.scale=function(e){return arguments.length?(i.scale(e),o.scale(.35*e),s.scale(e),l.translate(i.translate())):i.scale()},l.translate=function(e){if(!arguments.length)return i.translate();var a=i.scale(),c=+e[0],f=+e[1];return t=i.translate(e).clipExtent([[c-.455*a,f-.238*a],[c+.455*a,f+.238*a]]).stream(u).point,n=o.translate([c-.307*a,f+.201*a]).clipExtent([[c-.425*a+ke,f+.12*a+ke],[c-.214*a-ke,f+.234*a-ke]]).stream(u).point,r=s.translate([c-.205*a,f+.212*a]).clipExtent([[c-.214*a+ke,f+.166*a+ke],[c-.115*a-ke,f+.234*a-ke]]).stream(u).point,l},l.scale(1070)};var hr,dr,gr,mr,br,xr,vr={point:D,lineStart:D,lineEnd:D,polygonStart:function(){dr=0,vr.lineStart=yr},polygonEnd:function(){vr.lineStart=vr.lineEnd=vr.point=D,hr+=O(dr/2)}};function yr(){var e,t,n,r;function i(e,t){dr+=r*e-n*t,n=e,r=t}vr.point=function(a,o){vr.point=i,e=n=a,t=r=o},vr.lineEnd=function(){i(e,t)}}var jr={point:function(e,t){ebr&&(br=e),txr&&(xr=t)},lineStart:D,lineEnd:D,polygonStart:D,polygonEnd:D};function Or(){var e=Er(4.5),t=[],n={point:r,lineStart:function(){n.point=i},lineEnd:o,polygonStart:function(){n.lineEnd=s},polygonEnd:function(){n.lineEnd=o,n.point=r},pointRadius:function(t){return e=Er(t),n},result:function(){if(t.length){var e=t.join("");return t=[],e}}};function r(n,r){t.push("M",n,",",r,e)}function i(e,r){t.push("M",e,",",r),n.point=a}function a(e,n){t.push("L",e,",",n)}function o(){n.point=r}function s(){t.push("Z")}return n}function Er(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+-2*e+"a"+e+","+e+" 0 1,1 0,"+2*e+"z"}var Sr,wr={point:Mr,lineStart:Tr,lineEnd:kr,polygonStart:function(){wr.lineStart=Ir},polygonEnd:function(){wr.point=Mr,wr.lineStart=Tr,wr.lineEnd=kr}};function Mr(e,t){Mn+=e,Tn+=t,++kn}function Tr(){var e,t;function n(n,r){var i=n-e,a=r-t,o=Math.sqrt(i*i+a*a);In+=o*(e+n)/2,Cn+=o*(t+r)/2,Fn+=o,Mr(e=n,t=r)}wr.point=function(r,i){wr.point=n,Mr(e=r,t=i)}}function kr(){wr.point=Mr}function Ir(){var e,t,n,r;function i(e,t){var i=e-n,a=t-r,o=Math.sqrt(i*i+a*a);In+=o*(n+e)/2,Cn+=o*(r+t)/2,Fn+=o,_n+=(o=r*e-n*t)*(n+e),Nn+=o*(r+t),Ln+=3*o,Mr(n=e,r=t)}wr.point=function(a,o){wr.point=i,Mr(e=n=a,t=r=o)},wr.lineEnd=function(){i(e,t)}}function Cr(e){var t=4.5,n={point:r,lineStart:function(){n.point=i},lineEnd:o,polygonStart:function(){n.lineEnd=s},polygonEnd:function(){n.lineEnd=o,n.point=r},pointRadius:function(e){return t=e,n},result:D};function r(n,r){e.moveTo(n+t,r),e.arc(n,r,t,0,Fe)}function i(t,r){e.moveTo(t,r),n.point=a}function a(t,n){e.lineTo(t,n)}function o(){n.point=r}function s(){e.closePath()}return n}function Fr(e){var t=.5,n=Math.cos(30*Le),r=16;function i(e){return(r?o:a)(e)}function a(t){return Nr(t,(function(n,r){n=e(n,r),t.point(n[0],n[1])}))}function o(t){var n,i,a,o,u,l,c,f,p,h,d,g,m={point:b,lineStart:x,lineEnd:y,polygonStart:function(){t.polygonStart(),m.lineStart=j},polygonEnd:function(){t.polygonEnd(),m.lineStart=x}};function b(n,r){n=e(n,r),t.point(n[0],n[1])}function x(){f=NaN,m.point=v,t.lineStart()}function v(n,i){var a=Pn([n,i]),o=e(n,i);s(f,p,c,h,d,g,f=o[0],p=o[1],c=n,h=a[0],d=a[1],g=a[2],r,t),t.point(f,p)}function y(){m.point=b,t.lineEnd()}function j(){x(),m.point=O,m.lineEnd=E}function O(e,t){v(n=e,t),i=f,a=p,o=h,u=d,l=g,m.point=v}function E(){s(f,p,c,h,d,g,i,a,n,o,u,l,r,t),m.lineEnd=y,y()}return m}function s(r,i,a,o,u,l,c,f,p,h,d,g,m,b){var x=c-r,v=f-i,y=x*x+v*v;if(y>4*t&&m--){var j=o+h,E=u+d,S=l+g,w=Math.sqrt(j*j+E*E+S*S),M=Math.asin(S/=w),T=O(O(S)-1)t||O((x*F+v*_)/y-.5)>.3||o*h+u*d+l*g0&&16,i):Math.sqrt(t)},i}function _r(e){this.stream=e}function Nr(e,t){return{point:t,sphere:function(){e.sphere()},lineStart:function(){e.lineStart()},lineEnd:function(){e.lineEnd()},polygonStart:function(){e.polygonStart()},polygonEnd:function(){e.polygonEnd()}}}function Lr(e){return Rr((function(){return e}))()}function Rr(e){var t,n,r,i,o,s,u=Fr((function(e,n){return[(e=t(e,n))[0]*l+i,o-e[1]*l]})),l=150,c=480,f=250,p=0,h=0,d=0,g=0,m=0,b=sr,x=R,v=null,y=null;function j(e){return[(e=r(e[0]*Le,e[1]*Le))[0]*l+i,o-e[1]*l]}function E(e){return(e=r.invert((e[0]-i)/l,(o-e[1])/l))&&[e[0]*Re,e[1]*Re]}function S(){r=Jn(n=Dr(d,g,m),t);var e=t(p,h);return i=c-e[0]*l,o=f+e[1]*l,w()}function w(){return s&&(s.valid=!1,s=null),j}return j.stream=function(e){return s&&(s.valid=!1),(s=Ar(b(n,u(x(e))))).valid=!0,s},j.clipAngle=function(e){return arguments.length?(b=null==e?(v=e,sr):function(e){var t=Math.cos(e),n=t>0,r=O(t)>ke;return rr(i,(function(e){var t,s,u,l,c;return{lineStart:function(){l=u=!1,c=1},point:function(f,p){var h,d=[f,p],g=i(f,p),m=n?g?0:o(f,p):g?o(f+(f<0?Ce:-Ce),p):0;if(!t&&(l=u=g)&&e.lineStart(),g!==u&&(h=a(t,d),(Vn(t,h)||Vn(d,h))&&(d[0]+=ke,d[1]+=ke,g=i(d[0],d[1]))),g!==u)c=0,g?(e.lineStart(),h=a(d,t),e.point(h[0],h[1])):(h=a(t,d),e.point(h[0],h[1]),e.lineEnd()),t=h;else if(r&&t&&n^g){var b;m&s||!(b=a(d,t,!0))||(c=0,n?(e.lineStart(),e.point(b[0][0],b[0][1]),e.point(b[1][0],b[1][1]),e.lineEnd()):(e.point(b[1][0],b[1][1]),e.lineEnd(),e.lineStart(),e.point(b[0][0],b[0][1])))}!g||t&&Vn(t,d)||e.point(d[0],d[1]),t=d,u=g,s=m},lineEnd:function(){u&&e.lineEnd(),t=null},clean:function(){return c|(l&&u)<<1}}}),Br(e,6*Le),n?[0,-e]:[-Ce,e-Ce]);function i(e,n){return Math.cos(e)*Math.cos(n)>t}function a(e,n,r){var i=[1,0,0],a=Un(Pn(e),Pn(n)),o=Dn(a,a),s=a[0],u=o-s*s;if(!u)return!r&&e;var l=t*o/u,c=-t*s/u,f=Un(i,a),p=$n(i,l);qn(p,$n(a,c));var h=f,d=Dn(p,h),g=Dn(h,h),m=d*d-g*(Dn(p,p)-1);if(!(m<0)){var b=Math.sqrt(m),x=$n(h,(-d-b)/g);if(qn(x,p),x=Gn(x),!r)return x;var v,y=e[0],j=n[0],E=e[1],S=n[1];j0^x[1]<(O(x[0]-y)Ce^(y<=x[0]&&x[0]<=j)){var T=$n(h,(-d+b)/g);return qn(T,p),[x,Gn(T)]}}}function o(t,r){var i=n?e:Ce-e,a=0;return t<-i?a|=1:t>i&&(a|=2),r<-i?a|=4:r>i&&(a|=8),a}}((v=+e)*Le),w()):v},j.clipExtent=function(e){return arguments.length?(y=e,x=e?cr(e[0][0],e[0][1],e[1][0],e[1][1]):R,w()):y},j.scale=function(e){return arguments.length?(l=+e,S()):l},j.translate=function(e){return arguments.length?(c=+e[0],f=+e[1],S()):[c,f]},j.center=function(e){return arguments.length?(p=e[0]%360*Le,h=e[1]%360*Le,S()):[p*Re,h*Re]},j.rotate=function(e){return arguments.length?(d=e[0]%360*Le,g=e[1]%360*Le,m=e.length>2?e[2]%360*Le:0,S()):[d*Re,g*Re,m*Re]},a.rebind(j,u,"precision"),function(){return t=e.apply(this,arguments),j.invert=t.invert&&E,S()}}function Ar(e){return Nr(e,(function(t,n){e.point(t*Le,n*Le)}))}function zr(e,t){return[e,t]}function Pr(e,t){return[e>Ce?e-Fe:e<-Ce?e+Fe:e,t]}function Dr(e,t,n){return e?t||n?Jn(qr(e),$r(t,n)):qr(e):t||n?$r(t,n):Pr}function Ur(e){return function(t,n){return[(t+=e)>Ce?t-Fe:t<-Ce?t+Fe:t,n]}}function qr(e){var t=Ur(e);return t.invert=Ur(-e),t}function $r(e,t){var n=Math.cos(e),r=Math.sin(e),i=Math.cos(t),a=Math.sin(t);function o(e,t){var o=Math.cos(t),s=Math.cos(e)*o,u=Math.sin(e)*o,l=Math.sin(t),c=l*n+s*r;return[Math.atan2(u*i-c*a,s*n-l*r),De(c*i+u*a)]}return o.invert=function(e,t){var o=Math.cos(t),s=Math.cos(e)*o,u=Math.sin(e)*o,l=Math.sin(t),c=l*i-u*a;return[Math.atan2(u*i+l*a,s*n+c*r),De(c*n-s*r)]},o}function Br(e,t){var n=Math.cos(e),r=Math.sin(e);return function(i,a,o,s){var u=o*t;null!=i?(i=Gr(n,i),a=Gr(n,a),(o>0?ia)&&(i+=o*Fe)):(i=e+o*Fe,a=e-.5*u);for(var l,c=i;o>0?c>a:c2?e[2]*Le:0),t.invert=function(t){return(t=e.invert(t[0]*Le,t[1]*Le))[0]*=Re,t[1]*=Re,t},t},Pr.invert=zr,a.geo.circle=function(){var e,t,n=[0,0],r=6;function i(){var e="function"==typeof n?n.apply(this,arguments):n,r=Dr(-e[0]*Le,-e[1]*Le,0).invert,i=[];return t(null,null,1,{point:function(e,t){i.push(e=r(e,t)),e[0]*=Re,e[1]*=Re}}),{type:"Polygon",coordinates:[i]}}return i.origin=function(e){return arguments.length?(n=e,i):n},i.angle=function(n){return arguments.length?(t=Br((e=+n)*Le,r*Le),i):e},i.precision=function(n){return arguments.length?(t=Br(e*Le,(r=+n)*Le),i):r},i.angle(90)},a.geo.distance=function(e,t){var n,r=(t[0]-e[0])*Le,i=e[1]*Le,a=t[1]*Le,o=Math.sin(r),s=Math.cos(r),u=Math.sin(i),l=Math.cos(i),c=Math.sin(a),f=Math.cos(a);return Math.atan2(Math.sqrt((n=f*o)*n+(n=l*c-u*f*s)*n),u*c+l*f*s)},a.geo.graticule=function(){var e,t,n,r,i,o,s,u,l,c,f,p,h=10,d=h,g=90,m=360,b=2.5;function x(){return{type:"MultiLineString",coordinates:v()}}function v(){return a.range(Math.ceil(r/g)*g,n,g).map(f).concat(a.range(Math.ceil(u/m)*m,s,m).map(p)).concat(a.range(Math.ceil(t/h)*h,e,h).filter((function(e){return O(e%g)>ke})).map(l)).concat(a.range(Math.ceil(o/d)*d,i,d).filter((function(e){return O(e%m)>ke})).map(c))}return x.lines=function(){return v().map((function(e){return{type:"LineString",coordinates:e}}))},x.outline=function(){return{type:"Polygon",coordinates:[f(r).concat(p(s).slice(1),f(n).reverse().slice(1),p(u).reverse().slice(1))]}},x.extent=function(e){return arguments.length?x.majorExtent(e).minorExtent(e):x.minorExtent()},x.majorExtent=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],u=+e[0][1],s=+e[1][1],r>n&&(e=r,r=n,n=e),u>s&&(e=u,u=s,s=e),x.precision(b)):[[r,u],[n,s]]},x.minorExtent=function(n){return arguments.length?(t=+n[0][0],e=+n[1][0],o=+n[0][1],i=+n[1][1],t>e&&(n=t,t=e,e=n),o>i&&(n=o,o=i,i=n),x.precision(b)):[[t,o],[e,i]]},x.step=function(e){return arguments.length?x.majorStep(e).minorStep(e):x.minorStep()},x.majorStep=function(e){return arguments.length?(g=+e[0],m=+e[1],x):[g,m]},x.minorStep=function(e){return arguments.length?(h=+e[0],d=+e[1],x):[h,d]},x.precision=function(a){return arguments.length?(b=+a,l=Vr(o,i,90),c=Wr(t,e,b),f=Vr(u,s,90),p=Wr(r,n,b),x):b},x.majorExtent([[-180,-90+ke],[180,90-ke]]).minorExtent([[-180,-80-ke],[180,80+ke]])},a.geo.greatArc=function(){var e,t,n=Hr,r=Yr;function i(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),t||r.apply(this,arguments)]}}return i.distance=function(){return a.geo.distance(e||n.apply(this,arguments),t||r.apply(this,arguments))},i.source=function(t){return arguments.length?(n=t,e="function"==typeof t?null:t,i):n},i.target=function(e){return arguments.length?(r=e,t="function"==typeof e?null:e,i):r},i.precision=function(){return arguments.length?i:0},i},a.geo.interpolate=function(e,t){return n=e[0]*Le,r=e[1]*Le,i=t[0]*Le,a=t[1]*Le,o=Math.cos(r),s=Math.sin(r),u=Math.cos(a),l=Math.sin(a),c=o*Math.cos(n),f=o*Math.sin(n),p=u*Math.cos(i),h=u*Math.sin(i),d=2*Math.asin(Math.sqrt(qe(a-r)+o*u*qe(i-n))),g=1/Math.sin(d),(m=d?function(e){var t=Math.sin(e*=d)*g,n=Math.sin(d-e)*g,r=n*c+t*p,i=n*f+t*h,a=n*s+t*l;return[Math.atan2(i,r)*Re,Math.atan2(a,Math.sqrt(r*r+i*i))*Re]}:function(){return[n*Re,r*Re]}).distance=d,m;var n,r,i,a,o,s,u,l,c,f,p,h,d,g,m},a.geo.length=function(e){return Sr=0,a.geo.stream(e,Xr),Sr};var Xr={sphere:D,point:D,lineStart:function(){var e,t,n;function r(r,i){var a=Math.sin(i*=Le),o=Math.cos(i),s=O((r*=Le)-e),u=Math.cos(s);Sr+=Math.atan2(Math.sqrt((s=o*Math.sin(s))*s+(s=n*a-t*o*u)*s),t*a+n*o*u),e=r,t=a,n=o}Xr.point=function(i,a){e=i*Le,t=Math.sin(a*=Le),n=Math.cos(a),Xr.point=r},Xr.lineEnd=function(){Xr.point=Xr.lineEnd=D}},lineEnd:D,polygonStart:D,polygonEnd:D};function Kr(e,t){function n(t,n){var r=Math.cos(t),i=Math.cos(n),a=e(r*i);return[a*i*Math.sin(t),a*Math.sin(n)]}return n.invert=function(e,n){var r=Math.sqrt(e*e+n*n),i=t(r),a=Math.sin(i),o=Math.cos(i);return[Math.atan2(e*a,r*o),Math.asin(r&&n*a/r)]},n}var Zr=Kr((function(e){return Math.sqrt(2/(1+e))}),(function(e){return 2*Math.asin(e/2)}));(a.geo.azimuthalEqualArea=function(){return Lr(Zr)}).raw=Zr;var Jr=Kr((function(e){var t=Math.acos(e);return t&&t/Math.sin(t)}),R);function Qr(e,t){var n=Math.cos(e),r=function(e){return Math.tan(Ce/4+e/2)},i=e===t?Math.sin(e):Math.log(n/Math.cos(t))/Math.log(r(t)/r(e)),a=n*Math.pow(r(e),i)/i;if(!i)return ni;function o(e,t){a>0?t<-Ne+ke&&(t=-Ne+ke):t>Ne-ke&&(t=Ne-ke);var n=a/Math.pow(r(t),i);return[n*Math.sin(i*e),a-n*Math.cos(i*e)]}return o.invert=function(e,t){var n=a-t,r=Ae(i)*Math.sqrt(e*e+n*n);return[Math.atan2(e,n)/i,2*Math.atan(Math.pow(a/r,1/i))-Ne]},o}function ei(e,t){var n=Math.cos(e),r=e===t?Math.sin(e):(n-Math.cos(t))/(t-e),i=n/r+e;if(O(r)1&&ze(e[n[r-2]],e[n[r-1]],e[i])<=0;)--r;n[r++]=i}return n.slice(0,r)}function ci(e,t){return e[0]-t[0]||e[1]-t[1]}(a.geo.stereographic=function(){return Lr(ai)}).raw=ai,oi.invert=function(e,t){return[-t,2*Math.atan(Math.exp(e))-Ne]},(a.geo.transverseMercator=function(){var e=ri(oi),t=e.center,n=e.rotate;return e.center=function(e){return e?t([-e[1],e[0]]):[(e=t())[1],-e[0]]},e.rotate=function(e){return e?n([e[0],e[1],e.length>2?e[2]+90:90]):[(e=n())[0],e[1],e[2]-90]},n([0,0,90])}).raw=oi,a.geom={},a.geom.hull=function(e){var t=si,n=ui;if(arguments.length)return r(e);function r(e){if(e.length<3)return[];var r,i=yt(t),a=yt(n),o=e.length,s=[],u=[];for(r=0;r=0;--r)h.push(e[s[l[r]][2]]);for(r=+f;rke)s=s.L;else{if(!((i=a-ki(s,o))>ke)){r>-ke?(t=s.P,n=s):i>-ke?(t=s,n=s.N):t=n=s;break}if(!s.R){t=s;break}s=s.R}var u=Ei(e);if(bi.insert(t,u),t||n){if(t===n)return Ni(t),n=Ei(t.site),bi.insert(u,n),u.edge=n.edge=Ai(t.site,u.site),_i(t),void _i(n);if(n){Ni(t),Ni(n);var l=t.site,c=l.x,f=l.y,p=e.x-c,h=e.y-f,d=n.site,g=d.x-c,m=d.y-f,b=2*(p*m-h*g),x=p*p+h*h,v=g*g+m*m,y={x:(m*x-h*v)/b+c,y:(p*v-g*x)/b+f};zi(n.edge,l,d,y),u.edge=Ai(l,e,null,y),n.edge=Ai(e,d,null,y),_i(t),_i(n)}else u.edge=Ai(t.site,u.site)}}function Ti(e,t){var n=e.site,r=n.x,i=n.y,a=i-t;if(!a)return r;var o=e.P;if(!o)return-1/0;var s=(n=o.site).x,u=n.y,l=u-t;if(!l)return s;var c=s-r,f=1/a-1/l,p=c/l;return f?(-p+Math.sqrt(p*p-2*f*(c*c/(-2*l)-u+l/2+i-a/2)))/f+r:(r+s)/2}function ki(e,t){var n=e.N;if(n)return Ti(n,t);var r=e.site;return r.y===t?r.x:1/0}function Ii(e){this.site=e,this.edges=[]}function Ci(e,t){return t.angle-e.angle}function Fi(){Ui(this),this.x=this.y=this.arc=this.site=this.cy=null}function _i(e){var t=e.P,n=e.N;if(t&&n){var r=t.site,i=e.site,a=n.site;if(r!==a){var o=i.x,s=i.y,u=r.x-o,l=r.y-s,c=a.x-o,f=2*(u*(m=a.y-s)-l*c);if(!(f>=-Ie)){var p=u*u+l*l,h=c*c+m*m,d=(m*p-l*h)/f,g=(u*h-c*p)/f,m=g+s,b=ji.pop()||new Fi;b.arc=e,b.site=i,b.x=d+o,b.y=m+Math.sqrt(d*d+g*g),b.cy=m,e.circle=b;for(var x=null,v=vi._;v;)if(b.y=s)return;if(p>d){if(a){if(a.y>=l)return}else a={x:m,y:u};n={x:m,y:l}}else{if(a){if(a.y1)if(p>d){if(a){if(a.y>=l)return}else a={x:(u-i)/r,y:u};n={x:(l-i)/r,y:l}}else{if(a){if(a.y=s)return}else a={x:o,y:r*o+i};n={x:s,y:r*s+i}}else{if(a){if(a.xke||O(i-n)>ke)&&(s.splice(o,0,new Pi((b=a.site,x=c,v=O(r-f)ke?{x:f,y:O(t-f)ke?{x:O(n-d)ke?{x:p,y:O(t-p)ke?{x:O(n-h)=n&&l.x<=i&&l.y>=r&&l.y<=o?[[n,o],[i,o],[i,r],[n,r]]:[]).point=e[s]})),t}function s(e){return e.map((function(e,t){return{x:Math.round(r(e,t)/ke)*ke,y:Math.round(i(e,t)/ke)*ke,i:t}}))}return o.links=function(e){return Gi(s(e)).edges.filter((function(e){return e.l&&e.r})).map((function(t){return{source:e[t.l.i],target:e[t.r.i]}}))},o.triangles=function(e){var t=[];return Gi(s(e)).cells.forEach((function(n,r){for(var i,a,o,s,u=n.site,l=n.edges.sort(Ci),c=-1,f=l.length,p=l[f-1].edge,h=p.l===u?p.r:p.l;++ca&&(i=t.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(n=n[0])===(r=r[0])?s[o]?s[o]+=r:s[++o]=r:(s[++o]=null,u.push({i:o,x:Ji(n,r)})),a=ta.lastIndex;return ag&&(g=u.x),u.y>m&&(m=u.y),l.push(u.x),c.push(u.y);else for(f=0;fg&&(g=v),y>m&&(m=y),l.push(v),c.push(y)}var j=g-h,E=m-d;function S(e,t,n,r,i,a,o,s){if(!isNaN(n)&&!isNaN(r))if(e.leaf){var u=e.x,l=e.y;if(null!=u)if(O(u-n)+O(l-r)<.01)w(e,t,n,r,i,a,o,s);else{var c=e.point;e.x=e.y=e.point=null,w(e,c,u,l,i,a,o,s),w(e,t,n,r,i,a,o,s)}else e.x=n,e.y=r,e.point=t}else w(e,t,n,r,i,a,o,s)}function w(e,t,n,r,i,a,o,s){var u=.5*(i+o),l=.5*(a+s),c=n>=u,f=r>=l,p=f<<1|c;e.leaf=!1,c?i=u:o=u,f?a=l:s=l,S(e=e.nodes[p]||(e.nodes[p]={leaf:!0,nodes:[],point:null,x:null,y:null}),t,n,r,i,a,o,s)}j>E?m=d+j:g=h+E;var M={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(e){S(M,e,+b(e,++f),+x(e,f),h,d,g,m)}};if(M.visit=function(e){Xi(e,M,h,d,g,m)},M.find=function(e){return function(e,t,n,r,i,a,o){var s,u=1/0;return function e(l,c,f,p,h){if(!(c>a||f>o||p=j)<<1|t>=y,E=O+4;O=0&&!(n=a.interpolators[r](e,t)););return n}function ra(e,t){var n,r=[],i=[],a=e.length,o=t.length,s=Math.min(e.length,t.length);for(n=0;n=1)return 1;var t=e*e,n=t*e;return 4*(e<.5?n:3*(e-t)+n-.75)}function pa(e){return 1-Math.cos(e*Ne)}function ha(e){return Math.pow(2,10*(e-1))}function da(e){return 1-Math.sqrt(1-e*e)}function ga(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function ma(e,t){return t-=e,function(n){return Math.round(e+t*n)}}function ba(e){var t,n,r,i=[e.a,e.b],a=[e.c,e.d],o=va(i),s=xa(i,a),u=va(((t=a)[0]+=(r=-s)*(n=i)[0],t[1]+=r*n[1],t))||0;i[0]*a[1]=0?e.slice(0,n):e,i=n>=0?e.slice(n+1):"in";return r=aa.get(r)||ia,i=oa.get(i)||R,t=i(r.apply(null,o.call(arguments,1))),function(e){return e<=0?0:e>=1?1:t(e)}},a.interpolateHcl=function(e,t){e=a.hcl(e),t=a.hcl(t);var n=e.h,r=e.c,i=e.l,o=t.h-n,s=t.c-r,u=t.l-i;return isNaN(s)&&(s=0,r=isNaN(r)?t.c:r),isNaN(o)?(o=0,n=isNaN(n)?t.h:n):o>180?o-=360:o<-180&&(o+=360),function(e){return Je(n+o*e,r+s*e,i+u*e)+""}},a.interpolateHsl=function(e,t){e=a.hsl(e),t=a.hsl(t);var n=e.h,r=e.s,i=e.l,o=t.h-n,s=t.s-r,u=t.l-i;return isNaN(s)&&(s=0,r=isNaN(r)?t.s:r),isNaN(o)?(o=0,n=isNaN(n)?t.h:n):o>180?o-=360:o<-180&&(o+=360),function(e){return Xe(n+o*e,r+s*e,i+u*e)+""}},a.interpolateLab=function(e,t){e=a.lab(e),t=a.lab(t);var n=e.l,r=e.a,i=e.b,o=t.l-n,s=t.a-r,u=t.b-i;return function(e){return at(n+o*e,r+s*e,i+u*e)+""}},a.interpolateRound=ma,a.transform=function(e){var t=u.createElementNS(a.ns.prefix.svg,"g");return(a.transform=function(e){if(null!=e){t.setAttribute("transform",e);var n=t.transform.baseVal.consolidate()}return new ba(n?n.matrix:ya)})(e)},ba.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var ya={a:1,b:0,c:0,d:1,e:0,f:0};function ja(e){return e.length?e.pop()+",":""}function Oa(e,t){var n=[],r=[];return e=a.transform(e),t=a.transform(t),function(e,t,n,r){if(e[0]!==t[0]||e[1]!==t[1]){var i=n.push("translate(",null,",",null,")");r.push({i:i-4,x:Ji(e[0],t[0])},{i:i-2,x:Ji(e[1],t[1])})}else(t[0]||t[1])&&n.push("translate("+t+")")}(e.translate,t.translate,n,r),function(e,t,n,r){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),r.push({i:n.push(ja(n)+"rotate(",null,")")-2,x:Ji(e,t)})):t&&n.push(ja(n)+"rotate("+t+")")}(e.rotate,t.rotate,n,r),function(e,t,n,r){e!==t?r.push({i:n.push(ja(n)+"skewX(",null,")")-2,x:Ji(e,t)}):t&&n.push(ja(n)+"skewX("+t+")")}(e.skew,t.skew,n,r),function(e,t,n,r){if(e[0]!==t[0]||e[1]!==t[1]){var i=n.push(ja(n)+"scale(",null,",",null,")");r.push({i:i-4,x:Ji(e[0],t[0])},{i:i-2,x:Ji(e[1],t[1])})}else 1===t[0]&&1===t[1]||n.push(ja(n)+"scale("+t+")")}(e.scale,t.scale,n,r),e=t=null,function(e){for(var t,i=-1,a=r.length;++i0?n=t:(e.c=null,e.t=NaN,e=null,u.end({type:"end",alpha:n=0})):t>0&&(u.start({type:"start",alpha:n=t}),e=kt(s.tick)),s):n},s.start=function(){var e,t,n,a=b.length,u=x.length,c=l[0],d=l[1];for(e=0;e=0;)n.push(i[r])}function za(e,t){for(var n=[e],r=[];null!=(e=n.pop());)if(r.push(e),(a=e.children)&&(i=a.length))for(var i,a,o=-1;++o=0;)o.push(c=l[u]),c.parent=a,c.depth=a.depth+1;n&&(a.value=0),a.children=l}else n&&(a.value=+n.call(r,a,a.depth)||0),delete a.children;return za(i,(function(t){var r,i;e&&(r=t.children)&&r.sort(e),n&&(i=t.parent)&&(i.value+=t.value)})),s}return r.sort=function(t){return arguments.length?(e=t,r):e},r.children=function(e){return arguments.length?(t=e,r):t},r.value=function(e){return arguments.length?(n=e,r):n},r.revalue=function(e){return n&&(Aa(e,(function(e){e.children&&(e.value=0)})),za(e,(function(e){var t;e.children||(e.value=+n.call(r,e,e.depth)||0),(t=e.parent)&&(t.value+=e.value)}))),e},r},a.layout.partition=function(){var e=a.layout.hierarchy(),t=[1,1];function n(e,t,r,i){var a=e.children;if(e.x=t,e.y=e.depth*i,e.dx=r,e.dy=i,a&&(o=a.length)){var o,s,u,l=-1;for(r=e.value?r/e.value:0;++ls&&(s=r),o.push(r)}for(n=0;ni&&(r=n,i=t);return r}function Za(e){return e.reduce(Ja,0)}function Ja(e,t){return e+t[1]}function Qa(e,t){return eo(e,Math.ceil(Math.log(t.length)/Math.LN2+1))}function eo(e,t){for(var n=-1,r=+e[0],i=(e[1]-r)/t,a=[];++n<=t;)a[n]=i*n+r;return a}function to(e){return[a.min(e),a.max(e)]}function no(e,t){return e.value-t.value}function ro(e,t){var n=e._pack_next;e._pack_next=t,t._pack_prev=e,t._pack_next=n,n._pack_prev=t}function io(e,t){e._pack_next=t,t._pack_prev=e}function ao(e,t){var n=t.x-e.x,r=t.y-e.y,i=e.r+t.r;return.999*i*i>n*n+r*r}function oo(e){if((t=e.children)&&(u=t.length)){var t,n,r,i,a,o,s,u,l=1/0,c=-1/0,f=1/0,p=-1/0;if(t.forEach(so),(n=t[0]).x=-n.r,n.y=0,v(n),u>1&&((r=t[1]).x=r.r,r.y=0,v(r),u>2))for(co(n,r,i=t[2]),v(i),ro(n,i),n._pack_prev=i,ro(i,r),r=n._pack_next,a=3;a0)for(o=-1;++o=f[0]&&u<=f[1]&&((s=l[a.bisect(p,u,1,d)-1]).y+=g,s.push(i[o]));return l}return i.value=function(e){return arguments.length?(t=e,i):t},i.range=function(e){return arguments.length?(n=yt(e),i):n},i.bins=function(e){return arguments.length?(r="number"==typeof e?function(t){return eo(t,e)}:yt(e),i):r},i.frequency=function(t){return arguments.length?(e=!!t,i):e},i},a.layout.pack=function(){var e,t=a.layout.hierarchy().sort(no),n=0,r=[1,1];function i(i,a){var o=t.call(this,i,a),s=o[0],u=r[0],l=r[1],c=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,za(s,(function(e){e.r=+c(e.value)})),za(s,oo),n){var f=n*(e?1:Math.max(2*s.r/u,2*s.r/l))/2;za(s,(function(e){e.r+=f})),za(s,oo),za(s,(function(e){e.r-=f}))}return lo(s,u/2,l/2,e?1:1/Math.max(2*s.r/u,2*s.r/l)),o}return i.size=function(e){return arguments.length?(r=e,i):r},i.radius=function(t){return arguments.length?(e=null==t||"function"==typeof t?t:+t,i):e},i.padding=function(e){return arguments.length?(n=+e,i):n},Ra(i,t)},a.layout.tree=function(){var e=a.layout.hierarchy().sort(null).value(null),t=fo,n=[1,1],r=null;function i(i,a){var l=e.call(this,i,a),c=l[0],f=function(e){for(var t,n={A:null,children:[e]},r=[n];null!=(t=r.pop());)for(var i,a=t.children,o=0,s=a.length;oh.x&&(h=e),e.depth>d.depth&&(d=e)}));var g=t(p,h)/2-p.x,m=n[0]/(h.x+t(h,p)/2+g),b=n[1]/(d.depth||1);Aa(c,(function(e){e.x=(e.x+g)*m,e.y=e.depth*b}))}return l}function o(e){var n=e.children,r=e.parent.children,i=e.i?r[e.i-1]:null;if(n.length){!function(e){for(var t,n=0,r=0,i=e.children,a=i.length;--a>=0;)(t=i[a]).z+=n,t.m+=n,n+=t.s+(r+=t.c)}(e);var a=(n[0].z+n[n.length-1].z)/2;i?(e.z=i.z+t(e._,i._),e.m=e.z-a):e.z=a}else i&&(e.z=i.z+t(e._,i._));e.parent.A=function(e,n,r){if(n){for(var i,a=e,o=e,s=n,u=a.parent.children[0],l=a.m,c=o.m,f=s.m,p=u.m;s=ho(s),a=po(a),s&&a;)u=po(u),(o=ho(o)).a=e,(i=s.z+f-a.z-l+t(s._,a._))>0&&(go(mo(s,e,r),e,i),l+=i,c+=i),f+=s.m,l+=a.m,p+=u.m,c+=o.m;s&&!ho(o)&&(o.t=s,o.m+=f-c),a&&!po(u)&&(u.t=a,u.m+=l-p,r=e)}return r}(e,i,e.parent.A||r[0])}function s(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function u(e){e.x*=n[0],e.y=e.depth*n[1]}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(e){return arguments.length?(r=null==(n=e)?u:null,i):r?null:n},i.nodeSize=function(e){return arguments.length?(r=null==(n=e)?null:u,i):r?n:null},Ra(i,e)},a.layout.cluster=function(){var e=a.layout.hierarchy().sort(null).value(null),t=fo,n=[1,1],r=!1;function i(i,o){var s,u=e.call(this,i,o),l=u[0],c=0;za(l,(function(e){var n=e.children;n&&n.length?(e.x=function(e){return e.reduce((function(e,t){return e+t.x}),0)/e.length}(n),e.y=function(e){return 1+a.max(e,(function(e){return e.y}))}(n)):(e.x=s?c+=t(e,s):0,e.y=0,s=e)}));var f=bo(l),p=xo(l),h=f.x-t(f,p)/2,d=p.x+t(p,f)/2;return za(l,r?function(e){e.x=(e.x-l.x)*n[0],e.y=(l.y-e.y)*n[1]}:function(e){e.x=(e.x-h)/(d-h)*n[0],e.y=(1-(l.y?e.y/l.y:1))*n[1]}),u}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(e){return arguments.length?(r=null==(n=e),i):r?null:n},i.nodeSize=function(e){return arguments.length?(r=null!=(n=e),i):r?n:null},Ra(i,e)},a.layout.treemap=function(){var e,t=a.layout.hierarchy(),n=Math.round,r=[1,1],i=null,o=vo,s=!1,u="squarify",l=.5*(1+Math.sqrt(5));function c(e,t){for(var n,r,i=-1,a=e.length;++i0;)s.push(n=l[i-1]),s.area+=n.area,"squarify"!==u||(r=h(s,g))<=p?(l.pop(),p=r):(s.area-=s.pop().area,d(s,g,a,!1),g=Math.min(a.dx,a.dy),s.length=s.area=0,p=1/0);s.length&&(d(s,g,a,!0),s.length=s.area=0),t.forEach(f)}}function p(e){var t=e.children;if(t&&t.length){var n,r=o(e),i=t.slice(),a=[];for(c(i,r.dx*r.dy/e.value),a.area=0;n=i.pop();)a.push(n),a.area+=n.area,null!=n.z&&(d(a,n.z?r.dx:r.dy,r,!i.length),a.length=a.area=0);t.forEach(p)}}function h(e,t){for(var n,r=e.area,i=0,a=1/0,o=-1,s=e.length;++oi&&(i=n));return t*=t,(r*=r)?Math.max(t*i*l/r,r/(t*a*l)):1/0}function d(e,t,r,i){var a,o=-1,s=e.length,u=r.x,l=r.y,c=t?n(e.area/t):0;if(t==r.dx){for((i||c>r.dy)&&(c=r.dy);++or.dx)&&(c=r.dx);++o1);return e+t*n*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var e=a.random.normal.apply(a,arguments);return function(){return Math.exp(e())}},bates:function(e){var t=a.random.irwinHall(e);return function(){return t()/e}},irwinHall:function(e){return function(){for(var t=0,n=0;n2?To:Eo,u=r?Sa:Ea;return i=o(e,t,u,n),a=o(t,e,u,na),s}function s(e){return i(e)}return s.invert=function(e){return a(e)},s.domain=function(t){return arguments.length?(e=t.map(Number),o()):e},s.range=function(e){return arguments.length?(t=e,o()):t},s.rangeRound=function(e){return s.range(e).interpolate(ma)},s.clamp=function(e){return arguments.length?(r=e,o()):r},s.interpolate=function(e){return arguments.length?(n=e,o()):n},s.ticks=function(t){return _o(e,t)},s.tickFormat=function(t,n){return No(e,t,n)},s.nice=function(t){return Co(e,t),o()},s.copy=function(){return ko(e,t,n,r)},o()}function Io(e,t){return a.rebind(e,t,"range","rangeRound","interpolate","clamp")}function Co(e,t){return So(e,wo(Fo(e,t)[2])),So(e,wo(Fo(e,t)[2])),e}function Fo(e,t){null==t&&(t=10);var n=jo(e),r=n[1]-n[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),a=t/r*i;return a<=.15?i*=10:a<=.35?i*=5:a<=.75&&(i*=2),n[0]=Math.ceil(n[0]/i)*i,n[1]=Math.floor(n[1]/i)*i+.5*i,n[2]=i,n}function _o(e,t){return a.range.apply(a,Fo(e,t))}function No(e,t,n){var r=Fo(e,t);if(n){var i=Rt.exec(n);if(i.shift(),"s"===i[8]){var o=a.formatPrefix(Math.max(O(r[0]),O(r[1])));return i[7]||(i[7]="."+Ro(o.scale(r[2]))),i[8]="f",n=a.format(i.join("")),function(e){return n(o.scale(e))+o.symbol}}i[7]||(i[7]="."+function(e,t){var n=Ro(t[2]);return e in Lo?Math.abs(n-Ro(Math.max(O(t[0]),O(t[1]))))+ +("e"!==e):n-2*("%"===e)}(i[8],r)),n=i.join("")}else n=",."+Ro(r[2])+"f";return a.format(n)}a.scale.linear=function(){return ko([0,1],[0,1],na,!1)};var Lo={s:1,g:1,p:1,r:1,e:1};function Ro(e){return-Math.floor(Math.log(e)/Math.LN10+.01)}function Ao(e,t,n,r){function i(e){return(n?Math.log(e<0?0:e):-Math.log(e>0?0:-e))/Math.log(t)}function o(e){return n?Math.pow(t,e):-Math.pow(t,-e)}function s(t){return e(i(t))}return s.invert=function(t){return o(e.invert(t))},s.domain=function(t){return arguments.length?(n=t[0]>=0,e.domain((r=t.map(Number)).map(i)),s):r},s.base=function(n){return arguments.length?(t=+n,e.domain(r.map(i)),s):t},s.nice=function(){var t=So(r.map(i),n?Math:Po);return e.domain(t),r=t.map(o),s},s.ticks=function(){var e=jo(r),a=[],s=e[0],u=e[1],l=Math.floor(i(s)),c=Math.ceil(i(u)),f=t%1?2:t;if(isFinite(c-l)){if(n){for(;l0;p--)a.push(o(l)*p);for(l=0;a[l]u;c--);a=a.slice(l,c)}return a},s.tickFormat=function(e,n){if(!arguments.length)return zo;arguments.length<2?n=zo:"function"!=typeof n&&(n=a.format(n));var r=Math.max(1,t*e/s.ticks().length);return function(e){var a=e/o(Math.round(i(e)));return a*t0?n[r-1]:e[0],rf?0:1;if(l=_e)return u(l,h)+(s?u(s,1-h):"")+"Z";var d,g,m,b,x,v,y,j,O,E,S,w,M=0,T=0,k=[];if((b=(+o.apply(this,arguments)||0)/2)&&(m=r===Zo?Math.sqrt(s*s+l*l):+r.apply(this,arguments),h||(T*=-1),l&&(T=De(m/l*Math.sin(b))),s&&(M=De(m/s*Math.sin(b)))),l){x=l*Math.cos(c+T),v=l*Math.sin(c+T),y=l*Math.cos(f-T),j=l*Math.sin(f-T);var I=Math.abs(f-c-2*T)<=Ce?0:1;if(T&&rs(x,v,y,j)===h^I){var C=(c+f)/2;x=l*Math.cos(C),v=l*Math.sin(C),y=j=null}}else x=v=0;if(s){O=s*Math.cos(f-M),E=s*Math.sin(f-M),S=s*Math.cos(c+M),w=s*Math.sin(c+M);var F=Math.abs(c-f+2*M)<=Ce?0:1;if(M&&rs(O,E,S,w)===1-h^F){var _=(c+f)/2;O=s*Math.cos(_),E=s*Math.sin(_),S=w=null}}else O=E=0;if(p>ke&&(d=Math.min(Math.abs(l-s)/2,+n.apply(this,arguments)))>.001){g=s0?0:1}function is(e,t,n,r,i){var a=e[0]-t[0],o=e[1]-t[1],s=(i?r:-r)/Math.sqrt(a*a+o*o),u=s*o,l=-s*a,c=e[0]+u,f=e[1]+l,p=t[0]+u,h=t[1]+l,d=(c+p)/2,g=(f+h)/2,m=p-c,b=h-f,x=m*m+b*b,v=n-r,y=c*h-p*f,j=(b<0?-1:1)*Math.sqrt(Math.max(0,v*v*x-y*y)),O=(y*b-m*j)/x,E=(-y*m-b*j)/x,S=(y*b+m*j)/x,w=(-y*m+b*j)/x,M=O-d,T=E-g,k=S-d,I=w-g;return M*M+T*T>k*k+I*I&&(O=S,E=w),[[O-u,E-l],[O*n/v,E*n/v]]}function as(e){var t=si,n=ui,r=Qn,i=ss,a=i.key,o=.7;function s(a){var s,u=[],l=[],c=-1,f=a.length,p=yt(t),h=yt(n);function d(){u.push("M",i(e(l),o))}for(;++c1&&i.push("H",r[0]),i.join("")},"step-before":ls,"step-after":cs,basis:hs,"basis-open":function(e){if(e.length<4)return ss(e);for(var t,n=[],r=-1,i=e.length,a=[0],o=[0];++r<3;)t=e[r],a.push(t[0]),o.push(t[1]);for(n.push(ds(bs,a)+","+ds(bs,o)),--r;++r9&&(i=3*t/Math.sqrt(i),o[s]=i*n,o[s+1]=i*r);for(s=-1;++s<=u;)i=(e[Math.min(u,s+1)][0]-e[Math.max(0,s-1)][0])/(6*(1+o[s]*o[s])),a.push([i||0,o[s]*i||0]);return a}(e))}});function ss(e){return e.length>1?e.join("L"):e+"Z"}function us(e){return e.join("L")+"Z"}function ls(e){for(var t=0,n=e.length,r=e[0],i=[r[0],",",r[1]];++t1){s=t[1],a=e[u],u++,r+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(a[0]-s[0])+","+(a[1]-s[1])+","+a[0]+","+a[1];for(var l=2;lCe)+",1 "+t}function u(e,t,n,r){return"Q 0,0 "+r}return a.radius=function(e){return arguments.length?(n=yt(e),a):n},a.source=function(t){return arguments.length?(e=yt(t),a):e},a.target=function(e){return arguments.length?(t=yt(e),a):t},a.startAngle=function(e){return arguments.length?(r=yt(e),a):r},a.endAngle=function(e){return arguments.length?(i=yt(e),a):i},a},a.svg.diagonal=function(){var e=Hr,t=Yr,n=Es;function r(r,i){var a=e.call(this,r,i),o=t.call(this,r,i),s=(a.y+o.y)/2,u=[a,{x:a.x,y:s},{x:o.x,y:s},o];return"M"+(u=u.map(n))[0]+"C"+u[1]+" "+u[2]+" "+u[3]}return r.source=function(t){return arguments.length?(e=yt(t),r):e},r.target=function(e){return arguments.length?(t=yt(e),r):t},r.projection=function(e){return arguments.length?(n=e,r):n},r},a.svg.diagonal.radial=function(){var e=a.svg.diagonal(),t=Es,n=e.projection;return e.projection=function(e){return arguments.length?n(function(e){return function(){var t=e.apply(this,arguments),n=t[0],r=t[1]-Ne;return[n*Math.cos(r),n*Math.sin(r)]}}(t=e)):t},e},a.svg.symbol=function(){var e=ws,t=Ss;function n(n,r){return(Ts.get(e.call(this,n,r))||Ms)(t.call(this,n,r))}return n.type=function(t){return arguments.length?(e=yt(t),n):e},n.size=function(e){return arguments.length?(t=yt(e),n):t},n};var Ts=a.map({circle:Ms,cross:function(e){var t=Math.sqrt(e/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(e){var t=Math.sqrt(e/(2*Is)),n=t*Is;return"M0,"+-t+"L"+n+",0 0,"+t+" "+-n+",0Z"},square:function(e){var t=Math.sqrt(e)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(e){var t=Math.sqrt(e/ks),n=t*ks/2;return"M0,"+n+"L"+t+","+-n+" "+-t+","+-n+"Z"},"triangle-up":function(e){var t=Math.sqrt(e/ks),n=t*ks/2;return"M0,"+-n+"L"+t+","+n+" "+-t+","+n+"Z"}});a.svg.symbolTypes=Ts.keys();var ks=Math.sqrt(3),Is=Math.tan(30*Le);Z.transition=function(e){for(var t,n,r=Ns||++As,i=Ds(e),a=[],o=Ls||{time:Date.now(),ease:fa,delay:0,duration:250},s=-1,u=this.length;++s0;)l[--p].call(e,o);if(a>=1)return f.event&&f.event.end.call(e,e.__data__,t),--c.count?delete c[r]:delete e[n],1}f||(a=i.time,o=kt((function(e){var t=f.delay;if(o.t=t+a,t<=e)return p(e-t);o.c=p}),0,a),f=c[r]={tween:new S,time:a,timer:o,delay:i.delay,duration:i.duration,ease:i.ease,index:t},i=null,++c.count)}Rs.call=Z.call,Rs.empty=Z.empty,Rs.node=Z.node,Rs.size=Z.size,a.transition=function(e,t){return e&&e.transition?Ns?e.transition(t):e:a.selection().transition(e)},a.transition.prototype=Rs,Rs.select=function(e){var t,n,r,i=this.id,a=this.namespace,o=[];e=J(e);for(var s=-1,u=this.length;++srect,.s>rect").attr("width",o[1]-o[0])}function g(e){e.select(".extent").attr("y",s[0]),e.selectAll(".extent,.e>rect,.w>rect").attr("height",s[1]-s[0])}function m(){var f,m,b=this,x=a.select(a.event.target),v=n.of(b,arguments),y=a.select(b),j=x.datum(),O=!/^(n|s)$/.test(j)&&r,E=!/^(e|w)$/.test(j)&&i,S=x.classed("extent"),w=Se(b),M=a.mouse(b),T=a.select(c(b)).on("keydown.brush",(function(){32==a.event.keyCode&&(S||(f=null,M[0]-=o[1],M[1]-=s[1],S=2),$())})).on("keyup.brush",(function(){32==a.event.keyCode&&2==S&&(M[0]+=o[1],M[1]+=s[1],S=0,$())}));if(a.event.changedTouches?T.on("touchmove.brush",C).on("touchend.brush",_):T.on("mousemove.brush",C).on("mouseup.brush",_),y.interrupt().selectAll("*").interrupt(),S)M[0]=o[0]-M[0],M[1]=s[0]-M[1];else if(j){var k=+/w$/.test(j),I=+/^n/.test(j);m=[o[1-k]-M[0],s[1-I]-M[1]],M[0]=o[k],M[1]=s[I]}else a.event.altKey&&(f=M.slice());function C(){var e=a.mouse(b),t=!1;m&&(e[0]+=m[0],e[1]+=m[1]),S||(a.event.altKey?(f||(f=[(o[0]+o[1])/2,(s[0]+s[1])/2]),M[0]=o[+(e[0]1?{floor:function(t){for(;s(t=e.floor(t));)t=Js(t-1);return t},ceil:function(t){for(;s(t=e.ceil(t));)t=Js(+t+1);return t}}:e))},r.ticks=function(e,t){var n=jo(r.domain()),a=null==e?i(n,10):"number"==typeof e?i(n,e):!e.range&&[{range:e},t];return a&&(e=a[0],t=a[1]),e.range(n[0],Js(+n[1]+1),t<1?1:t)},r.tickFormat=function(){return n},r.copy=function(){return Zs(e.copy(),t,n)},Io(r,e)}function Js(e){return new Date(e)}Hs.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Ks:Xs,Ks.parse=function(e){var t=new Date(e);return isNaN(t)?null:t},Ks.toString=Xs.toString,Pt.second=$t((function(e){return new Dt(1e3*Math.floor(e/1e3))}),(function(e,t){e.setTime(e.getTime()+1e3*Math.floor(t))}),(function(e){return e.getSeconds()})),Pt.seconds=Pt.second.range,Pt.seconds.utc=Pt.second.utc.range,Pt.minute=$t((function(e){return new Dt(6e4*Math.floor(e/6e4))}),(function(e,t){e.setTime(e.getTime()+6e4*Math.floor(t))}),(function(e){return e.getMinutes()})),Pt.minutes=Pt.minute.range,Pt.minutes.utc=Pt.minute.utc.range,Pt.hour=$t((function(e){var t=e.getTimezoneOffset()/60;return new Dt(36e5*(Math.floor(e/36e5-t)+t))}),(function(e,t){e.setTime(e.getTime()+36e5*Math.floor(t))}),(function(e){return e.getHours()})),Pt.hours=Pt.hour.range,Pt.hours.utc=Pt.hour.utc.range,Pt.month=$t((function(e){return(e=Pt.day(e)).setDate(1),e}),(function(e,t){e.setMonth(e.getMonth()+t)}),(function(e){return e.getMonth()})),Pt.months=Pt.month.range,Pt.months.utc=Pt.month.utc.range;var Qs=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],eu=[[Pt.second,1],[Pt.second,5],[Pt.second,15],[Pt.second,30],[Pt.minute,1],[Pt.minute,5],[Pt.minute,15],[Pt.minute,30],[Pt.hour,1],[Pt.hour,3],[Pt.hour,6],[Pt.hour,12],[Pt.day,1],[Pt.day,2],[Pt.week,1],[Pt.month,1],[Pt.month,3],[Pt.year,1]],tu=Hs.multi([[".%L",function(e){return e.getMilliseconds()}],[":%S",function(e){return e.getSeconds()}],["%I:%M",function(e){return e.getMinutes()}],["%I %p",function(e){return e.getHours()}],["%a %d",function(e){return e.getDay()&&1!=e.getDate()}],["%b %d",function(e){return 1!=e.getDate()}],["%B",function(e){return e.getMonth()}],["%Y",Qn]]),nu={range:function(e,t,n){return a.range(Math.ceil(e/n)*n,+t,n).map(Js)},floor:R,ceil:R};eu.year=Pt.year,Pt.scale=function(){return Zs(a.scale.linear(),eu,tu)};var ru=eu.map((function(e){return[e[0].utc,e[1]]})),iu=Ys.multi([[".%L",function(e){return e.getUTCMilliseconds()}],[":%S",function(e){return e.getUTCSeconds()}],["%I:%M",function(e){return e.getUTCMinutes()}],["%I %p",function(e){return e.getUTCHours()}],["%a %d",function(e){return e.getUTCDay()&&1!=e.getUTCDate()}],["%b %d",function(e){return 1!=e.getUTCDate()}],["%B",function(e){return e.getUTCMonth()}],["%Y",Qn]]);function au(e){return JSON.parse(e.responseText)}function ou(e){var t=u.createRange();return t.selectNode(u.body),t.createContextualFragment(e.responseText)}ru.year=Pt.year.utc,Pt.scale.utc=function(){return Zs(a.scale.linear(),ru,iu)},a.text=jt((function(e){return e.responseText})),a.json=function(e,t){return Ot(e,"application/json",au,t)},a.html=function(e,t){return Ot(e,"text/html",ou,t)},a.xml=jt((function(e){return e.responseXML})),this.d3=a,void 0===(i="function"==typeof(r=a)?r.call(t,n,t,e):r)||(e.exports=i)}()},function(e,t,n){const r=n(59);e.exports=(e,t)=>new r(e,t).major},function(e,t,n){const r=n(44),{MAX_LENGTH:i,MAX_SAFE_INTEGER:a}=n(45),{safeRe:o,t:s}=n(61),u=n(62),{compareIdentifiers:l}=n(63);class SemVer{constructor(e,t){if(t=u(t),e instanceof SemVer){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>i)throw new TypeError(`version is longer than ${i} characters`);r("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const n=e.trim().match(t.loose?o[s.LOOSE]:o[s.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>a||this.major<0)throw new TypeError("Invalid major version");if(this.minor>a||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>a||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t=0;)"number"==typeof this.prerelease[r]&&(this.prerelease[r]++,r=-2);if(-1===r){if(t===this.prerelease.join(".")&&!1===n)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let r=[t,e];!1===n&&(r=[t]),0===l(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}e.exports=SemVer},function(e,t,n){e.exports=n(8)(448)},function(e,t,n){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:a}=n(45),o=n(44),s=(t=e.exports={}).re=[],u=t.safeRe=[],l=t.src=[],c=t.t={};let f=0;const p="[a-zA-Z0-9-]",h=[["\\s",1],["\\d",a],[p,i]],d=(e,t,n)=>{const r=(e=>{for(const[t,n]of h)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e})(t),i=f++;o(e,i,t),c[e]=i,l[i]=t,s[i]=new RegExp(t,n?"g":void 0),u[i]=new RegExp(r,n?"g":void 0)};d("NUMERICIDENTIFIER","0|[1-9]\\d*"),d("NUMERICIDENTIFIERLOOSE","\\d+"),d("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${p}*`),d("MAINVERSION",`(${l[c.NUMERICIDENTIFIER]})\\.(${l[c.NUMERICIDENTIFIER]})\\.(${l[c.NUMERICIDENTIFIER]})`),d("MAINVERSIONLOOSE",`(${l[c.NUMERICIDENTIFIERLOOSE]})\\.(${l[c.NUMERICIDENTIFIERLOOSE]})\\.(${l[c.NUMERICIDENTIFIERLOOSE]})`),d("PRERELEASEIDENTIFIER",`(?:${l[c.NUMERICIDENTIFIER]}|${l[c.NONNUMERICIDENTIFIER]})`),d("PRERELEASEIDENTIFIERLOOSE",`(?:${l[c.NUMERICIDENTIFIERLOOSE]}|${l[c.NONNUMERICIDENTIFIER]})`),d("PRERELEASE",`(?:-(${l[c.PRERELEASEIDENTIFIER]}(?:\\.${l[c.PRERELEASEIDENTIFIER]})*))`),d("PRERELEASELOOSE",`(?:-?(${l[c.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[c.PRERELEASEIDENTIFIERLOOSE]})*))`),d("BUILDIDENTIFIER",`${p}+`),d("BUILD",`(?:\\+(${l[c.BUILDIDENTIFIER]}(?:\\.${l[c.BUILDIDENTIFIER]})*))`),d("FULLPLAIN",`v?${l[c.MAINVERSION]}${l[c.PRERELEASE]}?${l[c.BUILD]}?`),d("FULL",`^${l[c.FULLPLAIN]}$`),d("LOOSEPLAIN",`[v=\\s]*${l[c.MAINVERSIONLOOSE]}${l[c.PRERELEASELOOSE]}?${l[c.BUILD]}?`),d("LOOSE",`^${l[c.LOOSEPLAIN]}$`),d("GTLT","((?:<|>)?=?)"),d("XRANGEIDENTIFIERLOOSE",`${l[c.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),d("XRANGEIDENTIFIER",`${l[c.NUMERICIDENTIFIER]}|x|X|\\*`),d("XRANGEPLAIN",`[v=\\s]*(${l[c.XRANGEIDENTIFIER]})(?:\\.(${l[c.XRANGEIDENTIFIER]})(?:\\.(${l[c.XRANGEIDENTIFIER]})(?:${l[c.PRERELEASE]})?${l[c.BUILD]}?)?)?`),d("XRANGEPLAINLOOSE",`[v=\\s]*(${l[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[c.XRANGEIDENTIFIERLOOSE]})(?:${l[c.PRERELEASELOOSE]})?${l[c.BUILD]}?)?)?`),d("XRANGE",`^${l[c.GTLT]}\\s*${l[c.XRANGEPLAIN]}$`),d("XRANGELOOSE",`^${l[c.GTLT]}\\s*${l[c.XRANGEPLAINLOOSE]}$`),d("COERCE",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?(?:$|[^\\d])`),d("COERCERTL",l[c.COERCE],!0),d("LONETILDE","(?:~>?)"),d("TILDETRIM",`(\\s*)${l[c.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",d("TILDE",`^${l[c.LONETILDE]}${l[c.XRANGEPLAIN]}$`),d("TILDELOOSE",`^${l[c.LONETILDE]}${l[c.XRANGEPLAINLOOSE]}$`),d("LONECARET","(?:\\^)"),d("CARETTRIM",`(\\s*)${l[c.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",d("CARET",`^${l[c.LONECARET]}${l[c.XRANGEPLAIN]}$`),d("CARETLOOSE",`^${l[c.LONECARET]}${l[c.XRANGEPLAINLOOSE]}$`),d("COMPARATORLOOSE",`^${l[c.GTLT]}\\s*(${l[c.LOOSEPLAIN]})$|^$`),d("COMPARATOR",`^${l[c.GTLT]}\\s*(${l[c.FULLPLAIN]})$|^$`),d("COMPARATORTRIM",`(\\s*)${l[c.GTLT]}\\s*(${l[c.LOOSEPLAIN]}|${l[c.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",d("HYPHENRANGE",`^\\s*(${l[c.XRANGEPLAIN]})\\s+-\\s+(${l[c.XRANGEPLAIN]})\\s*$`),d("HYPHENRANGELOOSE",`^\\s*(${l[c.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[c.XRANGEPLAINLOOSE]})\\s*$`),d("STAR","(<|>)?=?\\s*\\*"),d("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),d("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},function(e,t){const n=Object.freeze({loose:!0}),r=Object.freeze({});e.exports=e=>e?"object"!=typeof e?n:e:r},function(e,t){const n=/^[0-9]+$/,r=(e,t)=>{const r=n.test(e),i=n.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:er(t,e)}},function(e,t,n){e.exports=n(8)(169)},function(e,t,n){e.exports=n(8)(2947)},function(e,t,n){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){"use strict";t.decode=t.parse=n(68),t.encode=t.stringify=n(69)},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,a){t=t||"&",n=n||"=";var o={};if("string"!=typeof e||0===e.length)return o;var s=/\+/g;e=e.split(t);var u=1e3;a&&"number"==typeof a.maxKeys&&(u=a.maxKeys);var l=e.length;u>0&&l>u&&(l=u);for(var c=0;c=0?(f=g.substr(0,m),p=g.substr(m+1)):(f=g,p=""),h=decodeURIComponent(f),d=decodeURIComponent(p),r(o,h)?i(o[h])?o[h].push(d):o[h]=[o[h],d]:o[h]=d}return o};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,s){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?a(o(e),(function(o){var s=encodeURIComponent(r(o))+n;return i(e[o])?a(e[o],(function(e){return s+encodeURIComponent(r(e))})).join(t):s+encodeURIComponent(r(e[o]))})).join(t):s?encodeURIComponent(r(s))+n+encodeURIComponent(r(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function a(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r{const{navigateToUrl:n,currentAppId:r}=t;return Object(l.jsx)(c.Provider,{value:{navigateToUrl:n,currentAppId:r}},e)},p=({children:e,coreStart:t})=>{const{navigateToUrl:n,currentAppId$:r}=t.application,i=u()(r,void 0);return Object(l.jsx)(c.Provider,{value:{navigateToUrl:n,currentAppId:i}},e)};var h=n(20),d=n(39),g=n.n(d);const m={name:"36bnqj",styles:"display:flex;flex:1"},b=({children:e,navigateToUrl:t,currentAppId:n})=>{const r=Object(a.useRef)(null),i=Object(a.useCallback)((e=>(({event:e,container:t,navigateToUrl:n,currentAppId:r})=>{if(!t||!r)return;const i=((e,t)=>{let n=e;do{var r,i;if("a"===(null===(r=n)||void 0===r?void 0:r.tagName.toLowerCase()))return n;const e=null===(i=n)||void 0===i?void 0:i.parentElement;if(!e||e===document.body||e===t)break;n=e}while(parent||parent!==document.body||parent!==t)})(e.target,t);if(!i)return;const a=i.href,o=""===i.target||"_self"===i.target,s=0===e.button;a&&o&&s&&!e.defaultPrevented&&!(e=>e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)(e)&&(e.preventDefault(),n(i.href))})({event:e,currentAppId:n,navigateToUrl:t,container:r.current})),[n,t]);return Object(l.jsx)("div",{onClick:i,ref:r,css:m},e)},x=({children:e})=>Object(l.jsx)(b,function(){const e=Object(a.useContext)(c);if(!e)throw new Error("RedirectAppLinksContext is missing. Ensure your component or React root is wrapped with RedirectAppLinksProvider.");return e}(),e),v=({children:e,...t})=>{const n=Object(l.jsx)(x,null,e);if(void 0!==t.coreStart){const{coreStart:e}=t;return Object(l.jsx)(p,{coreStart:e},n)}const{navigateToUrl:r,currentAppId:i}=t;return Object(l.jsx)(f,{currentAppId:i,navigateToUrl:r},n)};var y=n(21),j=n(7),O=n(40);function E(...e){return{...new y.Type("merge",(t=>e.every((e=>e.is(t)))),((t,n)=>{const r=[],i=[];e.map(((e,r)=>e.validate(t,n.concat({key:String(r),type:e,actual:t})))).forEach((e=>{Object(O.isLeft)(e)?r.push(...e.left):i.push(e.right)}));const a=Object(j.merge)({},...i);return r.length>0?y.failures(r):y.success(a)}),(t=>e.reduce(((e,t)=>t.encode(e)),t))),_tag:"MergeType",types:e}}const S=["StringType","NumberType","BooleanType","ArrayType","DictionaryType","InterfaceType","PartialType","UnionType","IntersectionType","MergeType"],w=e=>"_tag"in e&&S.includes(e._tag);function M(e){if(!w(e))return e;switch(e._tag){case"ArrayType":return y.array(M(e.type));case"DictionaryType":return y.dictionary(e.domain,M(e.codomain));case"InterfaceType":return y.exact(y.interface(Object(j.mapValues)(e.props,M)));case"PartialType":return y.exact(y.partial(Object(j.mapValues)(e.props,M)));case"IntersectionType":return y.intersection(e.types.map(M));case"UnionType":return y.union(e.types.map(M));case"MergeType":return E(M(e.types[0]),M(e.types[1]));default:return e}}const T=e=>""===e;y.brand(y.string,(e=>{return!T(t=e)&&!t.includes(" ")&&!t.split(",").some(T);var t}),"IndexPattern"),new y.Type("JSON",y.any.is,((e,t)=>O.either.chain(y.string.validate(e,t),(n=>{try{return y.success(JSON.parse(n))}catch(n){return y.failure(e,t)}}))),(e=>JSON.stringify(e))),new y.Type("isoToEpochRt",y.number.is,((e,t)=>O.either.chain(y.string.validate(e,t),(n=>{const r=new Date(n).getTime();return isNaN(r)?y.failure(e,t):y.success(r)}))),(e=>new Date(e).toISOString()));const k=new y.Type("ToNumber",y.number.is,((e,t)=>{const n=Number(e);return isNaN(n)?y.failure(e,t):y.success(n)}),y.identity);new y.Type("ToBoolean",y.boolean.is,(e=>{let t;return t="string"==typeof e?"true"===e:!!e,y.success(t)}),y.identity),y.brand(y.string,(e=>e.length>0),"NonEmptyString");var I=n(42),C=n(30),F=n.n(C);y.brand(y.string,(e=>F()(e,!0).isValid()),"Date");var _=n(34),N=n.n(_);new y.Type("datemath",y.string.is,((e,t)=>Object(I.pipe)(y.string.validate(e,t),Object(O.chain)((e=>(e=>{const t=N.a.parse(e);return!(!t||!t.isValid())})(e)?y.success(e):y.failure(e,t))))),String),n(41);var L=n(51),R=n(3),A=n.n(R),z=n(49);function P(e){return e.replace(/(?:{([^\/]+)})/g,":$1")}class NotFoundRouteException extends Error{constructor(e){super(e)}}const D=Object(a.createContext)(void 0);function U({element:e,children:t}){return Object(l.jsx)(D.Provider,{value:{element:e}},t)}function q(){const e=Object(a.useContext)(D);if(!e)throw new Error("Outlet context not available");return e.element||null}const $=Object(a.createContext)(void 0),B=({match:e,element:t,children:n})=>Object(l.jsx)($.Provider,{value:{match:e,element:t}},Object(l.jsx)(U,{element:t},n));var G=n(22);const V=Object(a.createContext)(void 0),W=({router:e,children:t})=>Object(l.jsx)(V.Provider,{value:e},t);function H(){const e=Object(a.useContext)(V);if(!e)throw new Error("Router not found in context");return e}function Y(e){const t=H(),n=Object(G.useLocation)();return Object(a.useMemo)((()=>void 0===e?t.matchRoutes(n):t.matchRoutes(e,n)),[e,t,n])}function X(){return Y().concat().reverse().reduce(((e,t)=>{const{element:n}=t.route;return Object(l.jsx)(B,{match:t,element:e},n)}),Object(l.jsx)(o.a.Fragment,null))}n(53);var K=n(31);const Z=({children:e,...t})=>Object(l.jsx)(G.Router,t,Object(l.jsx)(K.CompatRouter,null,e));function J({children:e,router:t,history:n}){return Object(l.jsx)(Z,{history:n},Object(l.jsx)(W,{router:t},e))}function Q(...e){const t=H(),n=Object(G.useLocation)();let r=!1;const i=e[e.length-1];"boolean"==typeof i&&(r=i,e.pop());const a=[...e,n,r];return t.getParams(...a)}var ee=n(36),te=n.n(ee),ne=n(25),re=n(28),ie=n(2),ae=n(29),oe=n(37);const se=Object(a.createContext)(void 0),ue=se.Provider;function le(){const e=Object(a.useContext)(se);if(!e)throw new Error("ProfilingDependenciesContext not found");return e}const ce=["fetch","get","post","put","delete","patch"];function fe(e){const t=Object(a.useRef)(new AbortController),{start:{core:{http:n}}}=le(),r=Object(a.useMemo)((()=>{t.current.abort(),t.current=new AbortController;const e={};for(const r of ce)e[r]=(e,i)=>n[r](e,{...i,signal:t.current.signal}).catch((e=>{if("AbortError"===e.name)return new Promise((()=>{}));throw e}));return{...n,...e}}),[n,...e]);return Object(a.useEffect)((()=>()=>{t.current.abort()}),[]),r}let pe;!function(e){e.Loading="loading",e.Init="init",e.Settled="settled"}(pe||(pe={}));const he=(e,t)=>{const[n,r]=Object(a.useState)(0),i=Object(a.useCallback)((()=>{r((e=>e+1))}),[]),[o,s]=Object(a.useState)({status:pe.Init,refresh:i}),{data:u,error:l}=o,c=fe(t);return Object(a.useEffect)((()=>{const t=e({http:c});void 0!==t?(s({status:pe.Loading,data:u,error:l,refresh:i}),t.then((e=>{s({status:pe.Settled,data:e,refresh:i})})),t.catch((e=>{if(!(e instanceof oe.AbortError))throw s({status:pe.Settled,error:e,refresh:i}),e}))):s({status:pe.Init,data:void 0,error:void 0,refresh:i})}),[c,n,...t]),o};n(6);var de=n(5);let ge;!function(e){e.Rank="rank",e.Frame="frame",e.Samples="samples",e.SelfCPU="selfCPU",e.TotalCPU="totalCPU",e.Diff="diff",e.AnnualizedCo2="annualizedCo2",e.AnnualizedDollarCost="annualizedDollarCost"}(ge||(ge={}));const me=y.union([y.literal(ge.Rank),y.literal(ge.Frame),y.literal(ge.Samples),y.literal(ge.SelfCPU),y.literal(ge.TotalCPU),y.literal(ge.Diff),y.literal(ge.AnnualizedCo2),y.literal(ge.AnnualizedDollarCost)]);let be,xe,ve,ye;!function(e){e.Timestamp="@timestamp",e.ContainerName="container.name",e.ProcessThreadName="process.thread.name",e.StacktraceCount="Stacktrace.count",e.HostID="host.id",e.HostName="host.name",e.HostIP="host.ip",e.OrchestratorResourceName="orchestrator.resource.name",e.ServiceName="service.name",e.StacktraceID="Stacktrace.id",e.StacktraceFrameIDs="Stacktrace.frame.ids",e.StacktraceFrameTypes="Stacktrace.frame.types",e.StackframeFileName="Stackframe.file.name",e.StackframeFunctionName="Stackframe.function.name",e.StackframeLineNumber="Stackframe.line.number",e.StackframeFunctionOffset="Stackframe.function.offset",e.ExecutableBuildID="Executable.build.id",e.ExecutableFileName="Executable.file.name"}(be||(be={})),function(e){e.StackTraces="stackTraces",e.Percentage="percentage"}(xe||(xe={})),function(e){e.Containers="containers",e.Deployments="deployments",e.Threads="threads",e.Hosts="hosts",e.Traces="traces"}(ve||(ve={})),function(e){e.All="all",e.Hot="hot",e.Warm="warm",e.Cold="cold",e.Frozen="frozen"}(ye||(ye={}));const je=y.type({indexLifecyclePhase:y.union([y.literal(ye.All),y.literal(ye.Hot),y.literal(ye.Warm),y.literal(ye.Cold),y.literal(ye.Frozen)])});let Oe,Ee;ye.Hot,ye.Warm,ye.Cold,ye.Frozen,function(e){e.Absolute="absolute",e.Relative="relative"}(Oe||(Oe={})),function(e){e.Scale="scale",e.Time="time"}(Ee||(Ee={}));const Se=ie.i18n.translate("xpack.profiling.normalizationMenu.scale",{defaultMessage:"Scale factor"}),we=ie.i18n.translate("xpack.profiling.normalizationMenu.time",{defaultMessage:"Time"}),Me=ie.i18n.translate("xpack.profiling.normalizationMenu.normalizeBy",{defaultMessage:"Normalize by"});var Te={name:"1bbwyjf",styles:".euiFormLabel{max-width:none;}"};function ke(e){const[t,n]=Object(a.useState)(!1),r=Object(h.useEuiTheme)(),i=Object(h.useGeneratedHtmlId)({prefix:"baselineScaleFactor"}),o=Object(h.useGeneratedHtmlId)({prefix:"comparisonScaleFactor"}),[s,u]=Object(a.useState)(e.mode),[c,f]=Object(a.useState)(e.options);Object(a.useEffect)((()=>{u(e.mode),f(e.options)}),[e.mode,e.options]);const{baseline:p,comparison:d}=s===Ee.Time?{comparison:c.comparisonTime,baseline:c.baselineTime}:{comparison:c.comparisonScale,baseline:c.baselineScale};return Object(l.jsx)(h.EuiPopover,{anchorPosition:"downRight",initialFocus:`#${i}`,button:Object(l.jsx)(h.EuiFormControlLayout,{onClick:()=>{n((e=>!e))},compressed:!0,prepend:Me,append:Object(l.jsx)(h.EuiButtonIcon,{iconType:"arrowDown","aria-label":ie.i18n.translate("xpack.profiling.normalizationMenu.menuPopoverButtonAriaLabel",{defaultMessage:"Open normalization menu"})}),css:Te},Object(l.jsx)(h.EuiFlexItem,{style:{height:"100%",justifyContent:"center",backgroundColor:r.euiTheme.colors.ghost,padding:"0 16px"}},e.mode===Ee.Scale?Se:we)),isOpen:t,closePopover:()=>n(!1)},Object(l.jsx)(h.EuiFlexGroup,{justifyContent:"spaceBetween"},Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(h.EuiTitle,{size:"xxs"},Object(l.jsx)("h4",null,Me))),Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiIconTip,{content:Object(l.jsx)(h.EuiFlexGroup,{direction:"column",gutterSize:"s"},Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)("span",null,ie.i18n.translate("xpack.profiling.normalizationMenu.normalizeByTimeTooltip",{defaultMessage:"Select Normalize by Scale factor and set your Baseline and Comparison scale factors to compare a set of machines of different sizes. For example, you can compare a deployment of 10% of machines to a deployment of 90% of machines."}))),Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)("span",null,ie.i18n.translate("xpack.profiling.normalizationMenu.normalizeByScaleTooltip",{defaultMessage:"Select Normalize by Time to compare a set of machines across different time periods. For example, if you compare the last hour to the last 24 hours, the shorter timeframe (1 hour) is multiplied to match the longer timeframe (24 hours)."})))),position:"right"}))),Object(l.jsx)(h.EuiHorizontalRule,{margin:"s"}),Object(l.jsx)(h.EuiButtonGroup,{buttonSize:"compressed",isFullWidth:!0,onChange:(e,t)=>{u(e)},legend:ie.i18n.translate("xpack.profiling.normalizationMode.selectModeLegend",{defaultMessage:"Select a normalization mode for the flamegraph"}),idSelected:s,options:[{id:Ee.Scale,label:Se},{id:Ee.Time,label:we}]}),Object(l.jsx)(h.EuiSpacer,{size:"m"}),Object(l.jsx)(h.EuiTitle,{size:"xxxs"},Object(l.jsx)("h6",null,ie.i18n.translate("xpack.profiling.normalizationMenu.baseline",{defaultMessage:"Baseline"}))),Object(l.jsx)(h.EuiSpacer,{size:"s"}),Object(l.jsx)(h.EuiFormControlLayout,{fullWidth:!0,prepend:Object(l.jsx)(h.EuiFormLabel,{htmlFor:i},Se)},Object(l.jsx)(h.EuiFieldNumber,{controlOnly:!0,id:i,value:p,onChange:e=>{s===Ee.Scale&&f((t=>({...t,baselineScale:e.target.valueAsNumber})))},disabled:s===Ee.Time})),Object(l.jsx)(h.EuiSpacer,{size:"m"}),Object(l.jsx)(h.EuiTitle,{size:"xxxs"},Object(l.jsx)("h6",null,ie.i18n.translate("xpack.profiling.normalizationMenu.comparison",{defaultMessage:"Comparison"}))),Object(l.jsx)(h.EuiSpacer,{size:"s"}),Object(l.jsx)(h.EuiFormControlLayout,{fullWidth:!0,prepend:Object(l.jsx)(h.EuiFormLabel,{htmlFor:o},Se)},Object(l.jsx)(h.EuiFieldNumber,{controlOnly:!0,id:o,value:d,onChange:e=>{s===Ee.Scale&&f((t=>({...t,comparisonScale:e.target.valueAsNumber})))},disabled:s===Ee.Time})),Object(l.jsx)(h.EuiSpacer,{size:"m"}),Object(l.jsx)(h.EuiButton,{onClick:()=>{e.onChange(s,c),n(!1)},fullWidth:!0},ie.i18n.translate("xpack.profiling.normalizationMenu.applyChanges",{defaultMessage:"Apply changes"})))}function Ie({pathname:e}){const{location:t}=Object(G.useHistory)();return Object(l.jsx)(G.Redirect,{to:{pathname:e,search:t.search}})}function Ce(e,...t){return Q(e,...t)}function Fe(){return function(){const e=Object(j.last)(Y()),t=H();if(!e)throw new NotFoundRouteException("No route was matched");return t.getRoutePath(e.route)}()}const _e=o.a.createContext(void 0);function Ne({children:e}){const[t,n]=Object(a.useState)(Object(j.uniqueId)()),r=Object(a.useMemo)((()=>({timeRangeId:t,refresh:()=>{n(Object(j.uniqueId)())}})),[t]);return Object(l.jsx)(_e.Provider,{value:r},e)}function Le(){const e=Object(a.useContext)(_e);if(!e)throw new Error("TimeRangeContext was not provided");return e}var Re=n(38),Ae=n(9);function ze({kuery:e,rangeFrom:t,rangeTo:n,onQuerySubmit:r,onRefresh:i,onRefreshClick:o,showSubmitButton:s=!0,dataTestSubj:u="profilingUnifiedSearchBar"}){const{start:{dataViews:c}}=le(),[f,p]=Object(a.useState)();Object(a.useEffect)((()=>{c.create({title:Ae.a}).then((e=>p(e)))}),[c]);const h={language:"kuery",query:e};return Object(l.jsx)(Re.SearchBar,{onQuerySubmit:({dateRange:i,query:a})=>{i.from!==t||i.to!==n||(null==a?void 0:a.query)!==e?r({dateRange:i,query:a}):o()},showQueryInput:!0,showDatePicker:!0,showFilterBar:!1,showSaveQuery:!1,submitButtonStyle:s?"auto":"iconOnly",query:h,dateRangeFrom:t,dateRangeTo:n,indexPatterns:Object(j.compact)([f]),onRefresh:i,displayStyle:"inPage",dataTestSubj:u})}function Pe({showSubmitButton:e}){const{start:{data:t}}=le(),n=Cn(),r=Fe(),{path:i,query:o}=Ce("/*");if(!("rangeFrom"in o))throw new Error("Range query parameters are missing");const{rangeFrom:s,rangeTo:u,kuery:c}=o,{refresh:f}=Le();return Object(a.useEffect)((()=>{s&&u&&t.query.timefilter.timefilter.setTime({from:s,to:u})}),[s,u,t]),Object(l.jsx)(ze,{kuery:c,rangeFrom:s,rangeTo:u,onQuerySubmit:e=>{var t;n.push(r,{path:i,query:{...o,kuery:String((null===(t=e.query)||void 0===t?void 0:t.query)||""),rangeFrom:e.dateRange.from,rangeTo:e.dateRange.to}})},onRefresh:e=>{n.push(r,{path:i,query:{...o,rangeFrom:e.dateRange.from,rangeTo:e.dateRange.to}})},onRefreshClick:()=>{f()},showSubmitButton:e})}const De=o.a.createContext(void 0);function Ue({children:e}){const[t,n]=Object(a.useState)();return Object(l.jsx)(De.Provider,{value:{profilingSetupStatus:t,setProfilingSetupStatus:n}},e)}function qe(){const e=Object(a.useContext)(De);if(!e)throw new Error("ProfilingSetupStatusContext not found");return e}const $e="https://ela.st/profiling-feedback";function Be({children:e,tabs:t=[],hideSearchBar:n=!1,noDataConfig:r,restrictWidth:i=!1,pageTitle:o=ie.i18n.translate("xpack.profiling.appPageTemplate.pageTitle",{defaultMessage:"Universal Profiling"}),showBetaBadge:s=!1}){const{start:{observabilityShared:u}}=le(),[c,f]=function(e,t){const[n,r]=Object(a.useState)(0),i=Object(a.useMemo)((()=>function(e,t){const n=window.localStorage.getItem(e);if(null!==n)try{return JSON.parse(n)}catch(t){window.localStorage.removeItem(e),console.log(`Unable to decode: ${e}`)}return t}(e,t)),[e,n,t]);return Object(a.useEffect)((()=>{function t(t){t.key===e&&r(n+1)}return window.addEventListener("storage",t),()=>{window.removeEventListener("storage",t)}}),[e,r,n]),[i,t=>{void 0===t?window.localStorage.removeItem(e):(window.localStorage.setItem(e,JSON.stringify(t)),r(n+1))}]}("profiling.privilegesWarningDismissed",!1),{profilingSetupStatus:p}=qe(),{PageTemplate:d}=u.navigation,g=Object(G.useHistory)();return Object(a.useEffect)((()=>{window.scrollTo(0,0)}),[g.location.pathname]),Object(l.jsx)(d,{noDataConfig:r,pageHeader:{"data-test-subj":"profilingPageTemplate",rightSideItems:[Object(l.jsx)(h.EuiButton,{href:$e,target:"_blank",color:"warning",iconType:"editorComment"},ie.i18n.translate("xpack.profiling.header.giveFeedbackLink",{defaultMessage:"Give feedback"}))],pageTitle:Object(l.jsx)(h.EuiFlexGroup,{gutterSize:"s",alignItems:"baseline"},Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)("h1",null,o)),s&&Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiBetaBadge,{label:"Beta",color:"hollow",tooltipContent:ie.i18n.translate("xpack.profiling.header.betaBadgeTooltip",{defaultMessage:"This module is not GA. Please help us by reporting any bugs."})}))),tabs:t},restrictWidth:i,pageSectionProps:{contentProps:{style:{display:"flex",flexGrow:1}}}},Object(l.jsx)(h.EuiFlexGroup,{direction:"column",style:{maxWidth:"100%"}},!n&&Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiPanel,{hasShadow:!1,color:"subdued"},Object(l.jsx)(Pe,null),Object(l.jsx)(h.EuiHorizontalRule,null))),!0===(null==p?void 0:p.unauthorized)&&!0!==c?Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiCallOut,{iconType:"warning",title:ie.i18n.translate("xpack.profiling.privilegesWarningTitle",{defaultMessage:"User privilege limitation"})},Object(l.jsx)("p",null,ie.i18n.translate("xpack.profiling.privilegesWarningDescription",{defaultMessage:"Due to privileges issues we could not check the Universal Profiling status. If you encounter any issues or if data fails to load, please contact your administrator for assistance."})),Object(l.jsx)(h.EuiButton,{onClick:()=>{f(!0)}},ie.i18n.translate("xpack.profiling.dismissPrivilegesCallout",{defaultMessage:"Dismiss"})))):null,Object(l.jsx)(h.EuiFlexItem,null,e)))}function Ge({children:e,status:t,error:n,mono:r,size:i,style:a,alignTop:o}){return t!==pe.Settled||n?Object(l.jsx)(h.EuiFlexGroup,{alignItems:o?"flexStart":"center",justifyContent:"center",direction:"row",style:a,gutterSize:"none"},Object(l.jsx)(h.EuiFlexItem,{grow:!1,style:{alignContent:"center"}},n&&t===pe.Settled?Object(l.jsx)(h.EuiFlexGroup,{direction:"row",gutterSize:"xs",alignItems:"center"},Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(h.EuiIcon,{type:"warning",color:"warning"})),Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(h.EuiText,{style:{whiteSpace:"nowrap"}},ie.i18n.translate("xpack.profiling.asyncComponent.errorLoadingData",{defaultMessage:"Could not load data"})))):Object(l.jsx)(h.EuiLoadingChart,{mono:r,size:i}))):e}var Ve=n(23),We=n(57),He=n.n(We);const Ye={[de.b.Unsymbolized]:[16614532,16620957,16692661,16699086],[de.b.Python]:[16559723,16629385,16633510,16703428],[de.b.PHP]:[16571266,16638619,16640436,16708045],[de.b.Native]:[7196892,9099747,11002858,12971249],[de.b.Kernel]:[8167167,9875967,11585023,13359359],[de.b.JVM]:[6673324,8707261,10741197,12709342],[de.b.Ruby]:[14131196,14660349,15189501,15718910],[de.b.Perl]:[16354233,16425671,16497109,16634339],[de.b.JavaScript]:[13353955,14012392,14670830,15394803],[de.b.PHPJIT]:[13433986,13761678,14089371,14417063]};function Xe(e){return[Math.floor(e/65536)/255,Math.floor(e/256)%256/255,e%256/255,1]}function Ke(e,t,n){return(e-t)/(n-t)}const Ze={label:[],value:new Float64Array,color:new Float32Array,position0:new Float32Array,position1:new Float32Array,size0:new Float32Array,size1:new Float32Array};function Je(e){return isNaN(e)?Ae.b:0===e?"0":(e=Math.round(100*e)/100,Math.abs(e)<.01?"~0.00":Math.abs(e)<1e3?e.toString():Math.abs(e)<1e6?`${Je(e/1e3)}k`:Math.abs(e)<1e9?`${Je(e/1e6)}m`:`${Je(e/1e9)}b`)}function Qe(e){return`${Je(100*e)}%`}function et({legendItems:e}){return Object(l.jsx)(h.EuiFlexGroup,{direction:"row",gutterSize:"m"},e.map((({color:e,label:t})=>Object(l.jsx)(h.EuiFlexItem,{key:t,grow:!1},Object(l.jsx)(h.EuiFlexGroup,{direction:"row",gutterSize:"xs"},Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiIcon,{type:"dot",color:e})),Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiText,{size:"xs"},t)))))))}function tt({legendItems:e,asScale:t}){return t?Object(l.jsx)(h.EuiFlexGroup,{direction:"column",alignItems:"flexStart"},Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiFlexGroup,{direction:"column",gutterSize:"s"},Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiFlexGroup,{direction:"row"},Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(h.EuiText,{textAlign:"center",size:"s"},ie.i18n.translate("xpack.profiling.flameGraphLegend.improvement",{defaultMessage:"Improvement"}))),Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(h.EuiText,{textAlign:"center",size:"s"},ie.i18n.translate("xpack.profiling.flameGraphLegend.regression",{defaultMessage:"Regression"}))))),Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(h.EuiFlexGroup,{direction:"row"},Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiFlexGroup,{direction:"row",gutterSize:"s"},Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiText,{size:"s"},"+",Qe(1))),Object(l.jsx)(h.EuiFlexItem,{style:{width:20*e.length}},Object(l.jsx)(h.EuiFlexGroup,{direction:"row",gutterSize:"none"},e.map((({color:e,label:t})=>Object(l.jsx)(h.EuiFlexItem,{key:t,style:{backgroundColor:e,justifyContent:"center"}},t?Object(l.jsx)(h.EuiText,{size:"xs",style:{verticalAlign:"center",whiteSpace:"nowrap",paddingLeft:8,paddingRight:8}},t):""))))),Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiText,{size:"s"},Qe(-1)))))))))):Object(l.jsx)(et,{legendItems:e})}function nt({children:e}){return Object(l.jsx)(h.EuiFlexGroup,{direction:"column",gutterSize:"m"},Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(h.EuiFlexGroup,{direction:"row",gutterSize:"s",alignItems:"center"},Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiTitle,{size:"xs"},Object(l.jsx)("h2",null,ie.i18n.translate("xpack.profiling.flameGraphInformationWindowTitle",{defaultMessage:"Frame information"})))))),Object(l.jsx)(h.EuiFlexItem,null,e))}const rt=31536e3,it=7,at=.379069,ot=1.7,st=.0425;function ut({countInclusive:e,countExclusive:t,totalSamples:n,totalSeconds:r}){return{totalSamples:lt({samples:n,totalSamples:n,totalSeconds:r}),totalCPU:lt({samples:e,totalSamples:n,totalSeconds:r}),selfCPU:lt({samples:t,totalSamples:n,totalSeconds:r})}}function lt({samples:e,totalSamples:t,totalSeconds:n}){const r=rt/n,i=e/t,a=t/20*i,o=a/3600,s=it*o/1e3*at*ot,u=o*st;return{percentage:i,coreSeconds:a,annualizedCoreSeconds:a*r,co2:s,annualizedCo2:s*r,dollarCost:u,annualizedDollarCost:u*r}}function ct(e,t="$"){return`${t}${Je(e)}`}function ft(e){return 0===e?ie.i18n.translate("xpack.profiling.zeroSeconds",{defaultMessage:"0 seconds"}):F.a.duration(1e3*e).humanize()}F.a.relativeTimeRounding((e=>Math.round(e*Math.pow(10,2))/Math.pow(10,2))),F.a.relativeTimeThreshold("y",365),F.a.relativeTimeThreshold("M",12),F.a.relativeTimeThreshold("w",4),F.a.relativeTimeThreshold("d",31),F.a.relativeTimeThreshold("h",24),F.a.relativeTimeThreshold("m",60),F.a.relativeTimeThreshold("s",60),F.a.relativeTimeThreshold("ss",0);const pt=.45359237;function ht(e){return`${Je(e)} lbs / ${Je(Number(e*pt))} kg`}const dt={self:{label:ie.i18n.translate("xpack.profiling.cpu.self.label",{defaultMessage:"Self CPU"}),hint:ie.i18n.translate("xpack.profiling.cpu.self.hint",{defaultMessage:"Indicates how much CPU time was spent by the code in the function body, excluding the work done by functions that were called by it"})},total:{label:ie.i18n.translate("xpack.profiling.cpu.total.label",{defaultMessage:"Total CPU"}),hint:ie.i18n.translate("xpack.profiling.cpu.total.hint",{defaultMessage:"Indicates how much CPU time was spent by the function and any functions called by it"})}};function gt({iconSize:e,labelSize:t,labelStyle:n,type:r}){const{label:i,hint:a}=dt[r];return Object(l.jsx)(h.EuiFlexGroup,{gutterSize:"xs",style:{flexGrow:0}},Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiText,{size:t,style:n},i)),Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiToolTip,{content:a},Object(l.jsx)(h.EuiIcon,{type:"questionInCircle",size:e}))))}function mt({rows:e,prependString:t="",...n}){return Object(l.jsx)(h.EuiFlexGroup,{direction:"column",gutterSize:"s"},e.map(((r,i)=>Object(l.jsx)(o.a.Fragment,{key:i},Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(h.EuiFlexGroup,{direction:"row"},Object(l.jsx)(h.EuiFlexItem,{grow:!0,style:{display:"flex",flexDirection:"row"}},r.label,":"),Object(l.jsx)(h.EuiFlexItem,{grow:!1,style:{alignSelf:"flex-end",overflowWrap:"anywhere"},"data-test-subj":`${n["data-test-subj"]}_${r["data-test-subj"]}`},t,r.value))),i{if(null!=e&&e.functionName&&e.exeFileName){const t=e.functionName,n=e.exeFileName,r=(new Date).toISOString();return[{"@timestamp":r,message:{role:re.MessageRole.System,content:"You are perf-gpt, a helpful assistant for performance analysis and optimisation\n of software. Answer as concisely as possible."}},{"@timestamp":r,message:{role:re.MessageRole.User,content:`I am a software engineer. I am trying to understand what a function in a particular\n software library does.\n \n The library is: ${n}\n The function is: ${t}\n \n Your have two tasks. Your first task is to desribe what the library is and what its use cases are, and to\n describe what the function does. The output format should look as follows:\n \n Library description: Provide a concise description of the library\n Library use-cases: Provide a concise description of what the library is typically used for.\n Function description: Provide a concise, technical, description of what the function does.\n \n Assume the function ${t} from the library ${n} is consuming significant CPU resources.\n Your second task is to suggest ways to optimize or improve the system that involve the ${t} function from the\n ${n} library. Types of improvements that would be useful to me are improvements that result in:\n \n - Higher performance so that the system runs faster or uses less CPU\n - Better memory efficient so that the system uses less RAM\n - Better storage efficient so that the system stores less data on disk.\n - Better network I/O efficiency so that less data is sent over the network\n - Better disk I/O efficiency so that less data is read and written from disk\n \n Make up to five suggestions. Your suggestions must meet all of the following criteria:\n 1. Your suggestions should detailed, technical and include concrete examples.\n 2. Your suggestions should be specific to improving performance of a system in which the ${t} function from\n the ${n} library is consuming significant CPU.\n 3. If you suggest replacing the function or library with a more efficient replacement you must suggest at least\n one concrete replacement.\n \n If you know of fewer than five ways to improve the performance of a system in which the ${t} function from the\n ${n} library is consuming significant CPU, then provide fewer than five suggestions. If you do not know of any\n way in which to improve the performance then say "I do not know how to improve the performance of systems where\n this function is consuming a significant amount of CPU".\n \n Do not suggest using a CPU profiler. I have already profiled my code. The profiler I used is Elastic Universal Profiler.\n If there is specific information I should look for in the profiler output then tell me what information to look for\n in the output of Elastic Universal Profiler.\n \n You must not include URLs, web addresses or websites of any kind in your output.\n \n If you have suggestions, the output format should look as follows:\n \n Here are some suggestions as to how you might optimize your system if ${t} in ${n} is consuming\n significant CPU resources:\n 1. Insert first suggestion\n 2. Insert second suggestion`}}]}}),[null==e?void 0:e.functionName,null==e?void 0:e.exeFileName]);if(!e)return Object(l.jsx)(nt,null,Object(l.jsx)(h.EuiText,null,ie.i18n.translate("xpack.profiling.frameInformationWindow.selectFrame",{defaultMessage:"Click on a frame to display more information"})));const s=Object(de.k)({sourceFilename:e.sourceFileName,sourceLine:e.sourceLine,exeFileName:e.exeFileName}),{fileID:u,frameType:c,exeFileName:f,addressOrLine:p,functionName:d,sourceFileName:g,sourceLine:m,countInclusive:b,countExclusive:x}=e,v=function({fileID:e,frameType:t,exeFileName:n,addressOrLine:r,functionName:i,sourceFileName:a,sourceLine:o}){const s=""===e&&0===r?"root":n,u=o>0?`#${o}`:"",l=[];return s?l.push({"data-test-subj":"executable",label:ie.i18n.translate("xpack.profiling.flameGraphInformationWindow.executableLabel",{defaultMessage:"Executable"}),value:s}):l.push({"data-test-subj":"frameType",label:ie.i18n.translate("xpack.profiling.flameGraphInformationWindow.frameTypeLabel",{defaultMessage:"Frame type"}),value:Object(de.d)(t)}),l.push({"data-test-subj":"function",label:ie.i18n.translate("xpack.profiling.flameGraphInformationWindow.functionLabel",{defaultMessage:"Function"}),value:i||Ae.b}),l.push({"data-test-subj":"sourceFile",label:ie.i18n.translate("xpack.profiling.flameGraphInformationWindow.sourceFileLabel",{defaultMessage:"Source file"}),value:a?`${a}${u}`:Ae.b}),l}({fileID:u,frameType:c,exeFileName:f,addressOrLine:p,functionName:d,sourceFileName:g,sourceLine:m}),y=function({countInclusive:e,countExclusive:t,totalSamples:n,totalSeconds:r}){const{selfCPU:i,totalCPU:a}=ut({countInclusive:e,countExclusive:t,totalSamples:n,totalSeconds:r});return[{"data-test-subj":"totalCPU",label:Object(l.jsx)(gt,{type:"total",labelSize:"s",iconSize:"s"}),value:Qe(a.percentage)},{"data-test-subj":"selfCPU",label:Object(l.jsx)(gt,{type:"self",labelSize:"s",iconSize:"s"}),value:Qe(i.percentage)},{"data-test-subj":"samples",label:ie.i18n.translate("xpack.profiling.flameGraphInformationWindow.samplesInclusiveLabel",{defaultMessage:"Samples"}),value:Je(e)},{"data-test-subj":"selfSamples",label:ie.i18n.translate("xpack.profiling.flameGraphInformationWindow.samplesExclusiveLabel",{defaultMessage:"Samples (excl. children)"}),value:Je(t)},{"data-test-subj":"coreSeconds",label:ie.i18n.translate("xpack.profiling.flameGraphInformationWindow.coreSecondsInclusiveLabel",{defaultMessage:"Core-seconds"}),value:ft(a.coreSeconds)},{"data-test-subj":"selfCoreSeconds",label:ie.i18n.translate("xpack.profiling.flameGraphInformationWindow.coreSecondsExclusiveLabel",{defaultMessage:"Core-seconds (excl. children)"}),value:ft(i.coreSeconds)},{"data-test-subj":"annualizedCoreSeconds",label:ie.i18n.translate("xpack.profiling.flameGraphInformationWindow.annualizedCoreSecondsInclusiveLabel",{defaultMessage:"Annualized core-seconds"}),value:ft(a.annualizedCoreSeconds)},{"data-test-subj":"annualizedSelfCoreSeconds",label:ie.i18n.translate("xpack.profiling.flameGraphInformationWindow.annualizedCoreSecondsExclusiveLabel",{defaultMessage:"Annualized core-seconds (excl. children)"}),value:ft(i.annualizedCoreSeconds)},{"data-test-subj":"co2Emission",label:ie.i18n.translate("xpack.profiling.flameGraphInformationWindow.co2EmissionInclusiveLabel",{defaultMessage:"CO2 emission"}),value:ht(a.co2)},{"data-test-subj":"selfCo2Emission",label:ie.i18n.translate("xpack.profiling.flameGraphInformationWindow.co2EmissionExclusiveLabel",{defaultMessage:"CO2 emission (excl. children)"}),value:ht(i.co2)},{"data-test-subj":"annualizedCo2Emission",label:ie.i18n.translate("xpack.profiling.flameGraphInformationWindow.annualizedCo2InclusiveLabel",{defaultMessage:"Annualized CO2"}),value:ht(a.annualizedCo2)},{"data-test-subj":"annualizedSelfCo2Emission",label:ie.i18n.translate("xpack.profiling.flameGraphInformationWindow.annualizedCo2ExclusiveLabel",{defaultMessage:"Annualized CO2 (excl. children)"}),value:ht(i.annualizedCo2)},{"data-test-subj":"dollarCost",label:ie.i18n.translate("xpack.profiling.flameGraphInformationWindow.dollarCostInclusiveLabel",{defaultMessage:"Dollar cost"}),value:ct(a.dollarCost)},{"data-test-subj":"selfDollarCost",label:ie.i18n.translate("xpack.profiling.flameGraphInformationWindow.dollarCostExclusiveLabel",{defaultMessage:"Dollar cost (excl. children)"}),value:ct(i.dollarCost)},{"data-test-subj":"annualizedDollarCost",label:ie.i18n.translate("xpack.profiling.flameGraphInformationWindow.annualizedDollarCostInclusiveLabel",{defaultMessage:"Annualized dollar cost"}),value:ct(a.annualizedDollarCost)},{"data-test-subj":"annualizedSelfDollarCost",label:ie.i18n.translate("xpack.profiling.flameGraphInformationWindow.annualizedDollarCostExclusiveLabel",{defaultMessage:"Annualized dollar cost (excl. children)"}),value:ct(i.annualizedDollarCost)}]}({countInclusive:b,countExclusive:x,totalSamples:t,totalSeconds:n});return Object(l.jsx)(nt,null,Object(l.jsx)(h.EuiFlexGroup,{direction:"column"},Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(mt,{"data-test-subj":"informationRows",rows:v})),r.isEnabled()&&i?Object(l.jsx)(o.a.Fragment,null,Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(re.ContextualInsight,{messages:i,title:ie.i18n.translate("xpack.profiling.frameInformationWindow.optimizeFunction",{defaultMessage:"Optimize function"})}))):void 0,s!==de.a.SYMBOLIZED&&Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(yt,{frameType:e.frameType})),Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(h.EuiFlexGroup,{direction:"column"},Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(h.EuiTitle,{size:"xxs"},Object(l.jsx)("h2",null,ie.i18n.translate("xpack.profiling.frameInformationWindow.impactEstimatesTitle",{defaultMessage:"Impact estimates"})))),Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(mt,{"data-test-subj":"impactEstimates",rows:y}))))))}function Ot({onClose:e,...t}){return Object(l.jsx)(h.EuiFlyout,{onClose:e,size:"m"},Object(l.jsx)(h.EuiFlyoutBody,null,Object(l.jsx)(jt,t)))}function Et({value:e,label:t,comparison:n,formatDifferenceAsPercentage:r,showDifference:i,formatValue:a,prependValue:o=""}){const s=`${o}${a?a(Math.abs(e)):e.toString()}`,u=a&&Object(j.isNumber)(n)?a(n):null==n?void 0:n.toString();let c,f="",p="";return Object(j.isNumber)(n)&&i&&(p=e0?"+":c<0?"-":"")+Qe(Math.abs(c))+")"):(c=1-n/e,f="("+(c>0?"-":c<0?"+":"")+Qe(Math.abs(c))+")"),Math.abs(c)<1e-4&&(f="")),Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(h.EuiFlexGroup,{direction:"row",gutterSize:"xs"},Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiText,{size:"xs"},Object(l.jsx)("strong",{style:{display:"flex"}},t,":"))),Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(h.EuiText,{size:"xs"},void 0!==n?ie.i18n.translate("xpack.profiling.flameGraphTooltip.valueLabel",{defaultMessage:"{value} vs {comparison}",values:{value:s,comparison:u}}):s,Object(l.jsx)(h.EuiTextColor,{color:p}," ",f)))))}function St({isRoot:e,label:t,countInclusive:n,countExclusive:r,totalSamples:i,totalSeconds:a,baselineScaleFactor:s,comparisonScaleFactor:u,comparisonCountInclusive:c,comparisonCountExclusive:f,comparisonTotalSamples:p,comparisonTotalSeconds:d,onShowMoreClick:g}){const m=Object(h.useEuiTheme)(),b=ut({countExclusive:r,countInclusive:n,totalSamples:i,totalSeconds:a}),x=Object(j.isNumber)(f)&&Object(j.isNumber)(c)&&Object(j.isNumber)(p)&&Object(j.isNumber)(d)?ut({countExclusive:f,countInclusive:c,totalSamples:p,totalSeconds:d}):void 0;return Object(l.jsx)(Ve.TooltipContainer,null,Object(l.jsx)(h.EuiPanel,{paddingSize:"s"},Object(l.jsx)(h.EuiFlexGroup,{direction:"column",gutterSize:"xs"},Object(l.jsx)(h.EuiFlexItem,null,t),Object(l.jsx)(h.EuiHorizontalRule,{margin:"none",style:{background:m.euiTheme.border.color}}),!1===e&&Object(l.jsx)(o.a.Fragment,null,Object(l.jsx)(Et,{label:Object(l.jsx)(gt,{type:"total",labelSize:"xs",iconSize:"s",labelStyle:{fontWeight:"bold"}}),value:b.totalCPU.percentage,comparison:null==x?void 0:x.totalCPU.percentage,formatValue:Qe,showDifference:!0,formatDifferenceAsPercentage:!0}),Object(l.jsx)(Et,{label:Object(l.jsx)(gt,{type:"self",labelSize:"xs",iconSize:"s",labelStyle:{fontWeight:"bold"}}),value:b.selfCPU.percentage,comparison:null==x?void 0:x.selfCPU.percentage,showDifference:!0,formatDifferenceAsPercentage:!0,formatValue:Qe})),Object(l.jsx)(Et,{label:ie.i18n.translate("xpack.profiling.flameGraphTooltip.samplesLabel",{defaultMessage:"Samples"}),value:Object(j.isNumber)(s)?n*s:n,comparison:Object(j.isNumber)(c)&&Object(j.isNumber)(u)?c*u:void 0,showDifference:!0,formatDifferenceAsPercentage:!1}),Object(l.jsx)(Et,{label:ie.i18n.translate("xpack.profiling.flameGraphTooltip.annualizedCo2",{defaultMessage:"Annualized CO2"}),value:b.totalCPU.annualizedCo2,comparison:null==x?void 0:x.totalCPU.annualizedCo2,formatValue:ht,showDifference:!0,formatDifferenceAsPercentage:!1}),Object(l.jsx)(Et,{label:ie.i18n.translate("xpack.profiling.flameGraphTooltip.annualizedDollarCost",{defaultMessage:"Annualized dollar cost"}),value:b.totalCPU.annualizedDollarCost,comparison:null==x?void 0:x.totalCPU.annualizedDollarCost,formatValue:ct,showDifference:!0,formatDifferenceAsPercentage:!1}),g&&Object(l.jsx)(o.a.Fragment,null,Object(l.jsx)(h.EuiHorizontalRule,{margin:"none",style:{background:m.euiTheme.border.color}}),Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(h.EuiButtonEmpty,{size:"s",iconType:"inspect",onClick:g},Object(l.jsx)(h.EuiText,{size:"xs"},ie.i18n.translate("xpack.profiling.flameGraphTooltip.showMoreButton",{defaultMessage:"Show more information"})))),Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(h.EuiFlexGroup,{gutterSize:"xs"},Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiIcon,{type:"iInCircle"})),Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiText,{color:"subdued",size:"xs"},ie.i18n.translate("xpack.profiling.flameGraphTooltip.rightClickTip",{defaultMessage:"Right-click to pin tooltip"})))))))))}function wt({id:e,comparisonMode:t,primaryFlamegraph:n,comparisonFlamegraph:r,baseline:i,comparison:s,showInformationWindow:u,toggleShowInformationWindow:c,searchText:f,onChangeSearchText:p}){var d;const g=Object(h.useEuiTheme)(),m=Object(ne.useUiTracker)({app:"profiling"}),b=Object(a.useMemo)((()=>function({primaryFlamegraph:e,comparisonFlamegraph:t,colorSuccess:n,colorDanger:r,colorNeutral:i,comparisonMode:a=Oe.Absolute,comparison:o,baseline:s}){const u={};if(!e||!e.Label||0===e.Label.length)return{key:Object(j.uniqueId)(),viewModel:Ze,comparisonNodesById:u,legendItems:[]};const l=function(e,t=!0){const n=e.Size,r=new Float32Array(n),i=new Float32Array(n),a=[{x:0,depth:1,node:0}];for(;a.length>0;){const{x:t,depth:n,node:o}=a.pop();r[o]=t,i[o]=n;const s=e.Edges[o].sort(((t,n)=>e.CountInclusive[t]>e.CountInclusive[n]?-1:e.CountInclusive[t]=0;r--)u-=e.CountInclusive[s[r]],a.push({x:t+u,depth:n+1,node:s[r]})}const o=new Float32Array(4*n);if(t)for(let t=0;tt>e?t:e),0);for(let e=0;e=0?f(e):p(Math.abs(e))}c=Object(j.range)(1,-1,-.2).concat(-1).map((e=>{const t=Math.round(100*e)/100;return{color:h(t),label:0===t?ie.i18n.translate("xpack.profiling.flamegraphModel.noChange",{defaultMessage:"No change"}):""}})),t.ID.forEach(((e,n)=>{u[e]={CountInclusive:t.CountInclusive[n],CountExclusive:t.CountExclusive[n]}}));const d=Object(j.sum)(e.CountExclusive),g=Object(j.sum)(t.CountExclusive),m=a===Oe.Relative?1:(null!=o?o:1)/(null!=s?s:1);e.ID.forEach(((t,n)=>{var r;const i=e.CountInclusive[n],o=null===(r=u[t])||void 0===r?void 0:r.CountInclusive,s=a===Oe.Absolute?i:i/d,c=a===Oe.Absolute?o:(null!=o?o:0)/g,f=a===Oe.Absolute?d:s,p=function(e,t,n=e){return void 0===t?1:Object(j.clamp)((e-t)/n,-1,1)}(s,void 0===c?void 0:c*m,f),b=h(p),x=Xe(Number(b.replace("#","0x")));l.color.set(x,4*n)}))}else{const b=new Set([...e.FrameType]);c=Object(j.compact)(Object.entries(Ye).map((([e,t])=>{const n=Number(e);return b.has(n)?{color:`#${t[0].toString(16)}`,label:Object(de.d)(n)}:void 0})))}return{key:Object(j.uniqueId)(),viewModel:l,comparisonNodesById:u,legendItems:c}}({primaryFlamegraph:n,comparisonFlamegraph:r,colorSuccess:g.euiTheme.colors.success,colorDanger:g.euiTheme.colors.danger,colorNeutral:g.euiTheme.colors.lightShade,comparisonMode:t,baseline:i,comparison:s})),[n,r,g.euiTheme.colors.success,g.euiTheme.colors.danger,g.euiTheme.colors.lightShade,t,i,s]),x=b.viewModel.value[0],[v,y]=Object(a.useState)(void 0),O=n&&void 0!==v?{fileID:n.FileID[v],frameType:n.FrameType[v],exeFileName:n.ExeFilename[v],addressOrLine:n.AddressOrLine[v],functionName:n.FunctionName[v],sourceFileName:n.SourceFilename[v],sourceLine:n.SourceLine[v],countInclusive:n.CountInclusive[v],countExclusive:n.CountExclusive[v]}:void 0;return Object(a.useEffect)((()=>{y(void 0)}),[b.key]),Object(l.jsx)(o.a.Fragment,null,Object(l.jsx)(h.EuiFlexGroup,{direction:"column"},Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(h.EuiFlexGroup,{direction:"row"},b.viewModel.label.length>0&&Object(l.jsx)(h.EuiFlexItem,{grow:!0},Object(l.jsx)(Ve.Chart,{key:b.key},Object(l.jsx)(Ve.Settings,{theme:{chartMargins:{top:0,left:0,bottom:0,right:0},chartPaddings:{left:0,right:0,top:0,bottom:0},tooltip:{maxWidth:500}},onElementClick:e=>{const t=e[0];Number.isNaN(null==t?void 0:t.vmIndex)?y(void 0):y(t.vmIndex)}}),Object(l.jsx)(Ve.Tooltip,{actions:[{label:"",onSelect:()=>{}}],customTooltip:e=>{if(!n)return Object(l.jsx)(o.a.Fragment,null);const t=e.values[0].valueAccessor,a=n.Label[t],f=n.CountInclusive[t],p=n.CountExclusive[t],h=n.TotalSeconds,d=n.ID[t],g=b.comparisonNodesById[d];return Object(l.jsx)(St,{isRoot:0===t,label:a,countInclusive:f,countExclusive:p,totalSamples:x,totalSeconds:h,comparisonCountInclusive:null==g?void 0:g.CountInclusive,comparisonCountExclusive:null==g?void 0:g.CountExclusive,comparisonTotalSamples:null==r?void 0:r.CountInclusive[0],comparisonTotalSeconds:null==r?void 0:r.TotalSeconds,baselineScaleFactor:i,comparisonScaleFactor:s,onShowMoreClick:()=>{m({metric:"flamegraph_node_details_click"}),u||c(),y(t)}})}}),Object(l.jsx)(Ve.Flame,{id:e,columnarData:b.viewModel,valueAccessor:e=>e.value,valueFormatter:e=>`${e}`,animation:{duration:100},controlProviderCallback:{},search:f?{text:f}:void 0,onSearchTextChange:p}))))),Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(tt,{legendItems:b.legendItems,asScale:!!r}))),u&&Object(l.jsx)(Ot,{onClose:c,frame:O,totalSeconds:null!==(d=null==n?void 0:n.TotalSeconds)&&void 0!==d?d:0,totalSamples:x}))}!function(e){e.Kubernetes="kubernetes",e.Docker="docker",e.Binary="binary",e.Deb="deb",e.RPM="rpm",e.ElasticAgentIntegration="elasticAgentIntegration",e.Symbols="symbols"}(vt||(vt={}));var Mt=n(64),Tt=n.n(Mt);function kt(e,t={}){if(e){const n=Tt.a.parse(e,t);if(n&&n.isValid())return n.toDate()}}function It({rangeFrom:e,rangeTo:t,optional:n}){const r=Le(),{start:i,end:o}=Object(a.useMemo)((()=>function({state:e={},rangeFrom:t,rangeTo:n}){if(e.rangeFrom===t&&e.rangeTo===n)return{start:e.start,end:e.end};const r=kt(t),i=kt(n,{roundUp:!0});return r&&i?{start:r.toISOString(),end:i.toISOString()}:{start:e.start,end:e.end}}({state:{},rangeFrom:e,rangeTo:t})),[e,t,r.timeRangeId]);if(!(i&&o||n))throw new Error("start and/or end were unexpectedly not set");return{start:i,end:o,inSeconds:{start:i?new Date(i).getTime()/1e3:void 0,end:o?new Date(o).getTime()/1e3:void 0},timeRangeId:r.timeRangeId}}const Ct=(e,t)=>{const{timeRangeId:n}=Le();return he(e,t.concat(n))};function Ft(){const{path:e,query:t,query:{comparisonKuery:n,comparisonRangeFrom:r,comparisonRangeTo:i}}=Q("/flamegraphs/differential","/functions/differential"),{refresh:a}=Le(),o=Cn(),s=Fe();function u(n){var r,i;"/flamegraphs/differential"===s?o.push(s,{path:e,query:{...t,comparisonRangeFrom:n.rangeFrom,comparisonRangeTo:n.rangeTo,comparisonKuery:null!==(r=n.kuery)&&void 0!==r?r:t.comparisonKuery}}):o.push(s,{path:e,query:{...t,comparisonRangeFrom:n.rangeFrom,comparisonRangeTo:n.rangeTo,comparisonKuery:null!==(i=n.kuery)&&void 0!==i?i:t.comparisonKuery}})}let c,f;return"/flamegraphs/differential"===s?(c=ie.i18n.translate("xpack.profiling.comparisonSearch.baselineTitleFlamegraph",{defaultMessage:"Baseline flamegraph"}),f=ie.i18n.translate("xpack.profiling.comparisonSearch.comparisonTitleFlamegraph",{defaultMessage:"Comparison flamegraph"})):(c=ie.i18n.translate("xpack.profiling.comparisonSearch.baselineTitleFunctions",{defaultMessage:"Baseline functions"}),f=ie.i18n.translate("xpack.profiling.comparisonSearch.comparisonTitleFunctions",{defaultMessage:"Comparison functions"})),Object(l.jsx)(h.EuiFlexGroup,{direction:"row",gutterSize:"xs",alignItems:"flexEnd"},Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(h.EuiTitle,{size:"xxs"},Object(l.jsx)("h3",null,c)),Object(l.jsx)(h.EuiSpacer,{size:"s"}),Object(l.jsx)(Pe,{showSubmitButton:!1})),Object(l.jsx)(h.EuiFlexItem,{grow:!1,style:{padding:"0 8px"}},Object(l.jsx)(h.EuiToolTip,{position:"top",content:"Swap sides"},Object(l.jsx)(h.EuiButtonIcon,{iconType:"merge",size:"m",onClick:()=>{const a={...t,rangeFrom:r,rangeTo:i,kuery:n,comparisonRangeFrom:t.rangeFrom,comparisonRangeTo:t.rangeTo,comparisonKuery:t.kuery};o.push(s,{path:e,query:a})}}))),Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(h.EuiTitle,{size:"xxs"},Object(l.jsx)("h3",null,f)),Object(l.jsx)(h.EuiSpacer,{size:"s"}),Object(l.jsx)(ze,{kuery:n,rangeFrom:r,rangeTo:i,showSubmitButton:!1,onQuerySubmit:e=>{var t;u({kuery:String((null===(t=e.query)||void 0===t?void 0:t.query)||""),rangeFrom:e.dateRange.from,rangeTo:e.dateRange.to})},onRefresh:e=>{u({rangeFrom:e.dateRange.from,rangeTo:e.dateRange.to})},onRefreshClick:()=>{a()},dataTestSubj:"profilingComparisonUnifiedSearchBar"})))}function _t({comparisonMode:e,onChange:t}){return Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiFlexGroup,{direction:"row",gutterSize:"m",alignItems:"center"},Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiTitle,{size:"xxs"},Object(l.jsx)("h3",null,ie.i18n.translate("xpack.profiling.differentialComparisonMode.title",{defaultMessage:"Format"})))),Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiButtonGroup,{legend:ie.i18n.translate("xpack.profiling.differentialComparisonMode.legend",{defaultMessage:"This switch allows you to switch between an absolute and relative comparison between both graphs"}),type:"single",buttonSize:"s",idSelected:e,onChange:e=>{t(e)},options:[{id:Oe.Absolute,label:ie.i18n.translate("xpack.profiling.differentialComparisonMode.absoluteButtonLabel",{defaultMessage:"Abs"})},{id:Oe.Relative,label:ie.i18n.translate("xpack.profiling.differentialComparisonMode.relativeButtonLabel",{defaultMessage:"Rel"})}]}))))}function Nt({comparisonMode:e,normalizationMode:t,normalizationOptions:n}){const{path:r,query:i}=Ce("/flamegraphs/*"),a=Fe(),o=Cn();return Object(l.jsx)(h.EuiPanel,{hasShadow:!1,color:"subdued"},Object(l.jsx)(Ft,null),Object(l.jsx)(h.EuiHorizontalRule,null),Object(l.jsx)(h.EuiFlexGroup,{direction:"row"},Object(l.jsx)(_t,{comparisonMode:e,onChange:function(e){"comparisonRangeFrom"in i&&o.push(a,{path:r,query:{...i,...e===Oe.Absolute?{comparisonMode:Oe.Absolute,normalizationMode:t}:{comparisonMode:Oe.Relative}}})}}),e===Oe.Absolute&&Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiFlexGroup,{direction:"row",gutterSize:"m",alignItems:"center"},Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(ke,{onChange:function(e,t){o.push(a,{path:a,query:e===Ee.Scale?{...i,baseline:t.baselineScale,comparison:t.comparisonScale,normalizationMode:e}:{...i,normalizationMode:e}})},mode:t,options:n}))))))}function Lt({label:e,hint:t,iconSize:n,labelSize:r,labelStyle:i}){return Object(l.jsx)(h.EuiFlexGroup,{gutterSize:"xs",style:{flexGrow:0},alignItems:"center"},Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiText,{size:r,style:i},e)),Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiToolTip,{content:t},Object(l.jsx)(h.EuiIcon,{type:"questionInCircle",size:n}))))}function Rt({calleeFunctionName:e}){return Object(l.jsx)(h.EuiText,{size:"s",style:{fontWeight:"bold",overflowWrap:"anywhere"}},e)}function At({frame:e,onFrameClick:t}){const n=Object(de.h)(e);return Object(l.jsx)(h.EuiFlexGroup,{direction:"column",gutterSize:"xs"},Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)("div",null,t?Object(l.jsx)(h.EuiLink,{onClick:function(){t&&t(n)}},Object(l.jsx)(Rt,{calleeFunctionName:n})):Object(l.jsx)(Rt,{calleeFunctionName:n}))),Object(l.jsx)(h.EuiFlexItem,{style:{overflowWrap:"anywhere"}},Object(l.jsx)(h.EuiText,{size:"s"},Object(de.j)(e)||"‎")))}function zt(e){if(0===e)return{color:"text",label:"0%",icon:void 0};const t=e<0?"success":"danger",n=e<0?"sortUp":"sortDown",r=Math.abs(e)<=.01?"<0.01":Math.abs(e).toFixed(2);return isFinite(e)?{color:t,label:`${r}%`,icon:n}:{color:"text",label:void 0,icon:void 0}}function Pt({value:e,scaleFactor:t=1}){return e*t}function Dt({baselineValue:e,baselineScaleFactor:t,comparisonValue:n,comparisonScaleFactor:r,formatValue:i}){const a=Pt({value:e,scaleFactor:t}),o=i?i(a):a.toLocaleString();if(0===n)return{baseValue:o};const s=Pt({value:n,scaleFactor:r}),u=s-a,l=u/(s-u)*100,{color:c,icon:f,label:p}=zt(l);return{baseValue:o,comparisonValue:i?i(s):s.toLocaleString(),percentDiffDelta:l,color:c,icon:f,label:p}}function Ut({value:e,prepend:t,append:n}){const{label:r,color:i,icon:a}=zt(e);return Object(l.jsx)(h.EuiTextColor,{color:i},t,a&&Object(l.jsx)(h.EuiIcon,{type:a,size:"s",color:i}),r,n)}function qt({cpu:e,diffCPU:t}){const n=`${e.toFixed(2)}%`;return void 0===t||0===t?Object(l.jsx)(o.a.Fragment,null,n):Object(l.jsx)(h.EuiFlexGroup,{direction:"column",gutterSize:"none"},Object(l.jsx)(h.EuiFlexItem,null,n),Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(Ut,{value:t,prepend:"(",append:")"})))}function $t({samples:e,diffSamples:t,totalSamples:n}){const r=e.toLocaleString();if(void 0===t||0===t||0===n)return Object(l.jsx)(o.a.Fragment,null,r);const i=t/(e-t)*100,a=t/n*100;return Object(l.jsx)(h.EuiFlexGroup,{direction:"column",gutterSize:"none"},Object(l.jsx)(h.EuiFlexItem,null,r),Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(Ut,{value:i,append:" rel"})),Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(Ut,{value:a,append:" abs"})))}function Bt({functionRow:e,columnId:t,totalCount:n,onFrameClick:r,setCellProps:i}){var a,o,s,u;const c=Object(h.useEuiTheme)(),f=Object(h.useEuiBackgroundColor)("success"),p=Object(h.useEuiBackgroundColor)("danger");if(t===ge.Diff){if(!e.diff)return Object(l.jsx)(h.EuiText,{size:"xs",color:c.euiTheme.colors.primaryText},ie.i18n.translate("xpack.profiling.functionsView.newLabel",{defaultMessage:"New"}));if(0===e.diff.rank)return null;const t=e.diff.rank>0?"success":"danger";return i({style:{backgroundColor:"success"===t?f:p}}),Object(l.jsx)(h.EuiFlexGroup,{direction:"row",gutterSize:"xs"},Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiIcon,{type:e.diff.rank>0?"sortUp":"sortDown",color:t})),Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiText,{size:"s"},Math.abs(e.diff.rank))))}return t===ge.Rank?Object(l.jsx)("div",null,e.rank):t===ge.Frame?Object(l.jsx)(At,{frame:e.frame,onFrameClick:r}):t===ge.Samples?(i({css:{textAlign:"right"}}),Object(l.jsx)($t,{samples:e.samples,diffSamples:null===(d=e.diff)||void 0===d?void 0:d.samples,totalSamples:n})):t===ge.SelfCPU?Object(l.jsx)(qt,{cpu:e.selfCPUPerc,diffCPU:null===(g=e.diff)||void 0===g?void 0:g.selfCPUPerc}):t===ge.TotalCPU?Object(l.jsx)(qt,{cpu:e.totalCPUPerc,diffCPU:null===(m=e.diff)||void 0===m?void 0:m.totalCPUPerc}):t===ge.AnnualizedCo2&&null!==(a=e.impactEstimates)&&void 0!==a&&null!==(o=a.selfCPU)&&void 0!==o&&o.annualizedCo2?Object(l.jsx)("div",null,ht(e.impactEstimates.selfCPU.annualizedCo2)):t===ge.AnnualizedDollarCost&&null!==(s=e.impactEstimates)&&void 0!==s&&null!==(u=s.selfCPU)&&void 0!==u&&u.annualizedDollarCost?Object(l.jsx)("div",null,ct(e.impactEstimates.selfCPU.annualizedDollarCost)):null;var d,g,m}const Gt=Object(a.forwardRef)((({topNFunctions:e,comparisonTopNFunctions:t,totalSeconds:n,isDifferentialView:r,baselineScaleFactor:i,comparisonScaleFactor:s,onFrameClick:u,onScroll:c,showDiffColumn:f=!1,pageIndex:p,onChangePage:d,sortField:g,sortDirection:m,onChangeSort:b,dataTestSubj:x="topNFunctionsGrid"},v)=>{const[y,O]=Object(a.useState)(),E=Object(ne.useUiTracker)({app:"profiling"}),S=Object(a.useMemo)((()=>e&&e.TotalCount?e.TotalCount:0),[e]),w=Object(a.useMemo)((()=>function({baselineScaleFactor:e,comparisonScaleFactor:t,comparisonTopNFunctions:n,topNFunctions:r,totalSeconds:i}){if(!r||!r.TotalCount||0===r.TotalCount)return[];const a=n?Object(j.keyBy)(n.TopN,"Id"):{};return r.TopN.filter((e=>e.CountExclusive>0)).map(((o,s)=>{const u=null==a?void 0:a[o.Id],l=Pt({value:o.CountExclusive,scaleFactor:e}),c=o.CountInclusive/r.TotalCount*100,f=o.CountExclusive/r.TotalCount*100,p=i>0?ut({countExclusive:o.CountExclusive,countInclusive:o.CountInclusive,totalSamples:r.TotalCount,totalSeconds:i}):void 0;return{rank:o.Rank,frame:o.Frame,samples:l,selfCPUPerc:f,totalCPUPerc:c,selfCPU:o.CountExclusive,totalCPU:o.CountInclusive,impactEstimates:p,diff:function(){if(n&&u){const e=Pt({value:u.CountExclusive,scaleFactor:t}),r=l-e;return{rank:o.Rank-u.Rank,samples:r,selfCPU:u.CountExclusive,totalCPU:u.CountInclusive,selfCPUPerc:f-u.CountExclusive/n.TotalCount*100,totalCPUPerc:c-u.CountInclusive/n.TotalCount*100}}}()}}))}({baselineScaleFactor:i,comparisonScaleFactor:s,comparisonTopNFunctions:t,topNFunctions:e,totalSeconds:n})),[i,s,t,e,n]),{columns:M,leadingControlColumns:T}=Object(a.useMemo)((()=>{const e=[{id:ge.Rank,initialWidth:r?50:90,displayAsText:ie.i18n.translate("xpack.profiling.functionsView.rankColumnLabel",{defaultMessage:"Rank"})},{id:ge.Frame,displayAsText:ie.i18n.translate("xpack.profiling.functionsView.functionColumnLabel",{defaultMessage:"Function"})},{id:ge.Samples,initialWidth:r?100:200,schema:"samples",display:Object(l.jsx)(Lt,{label:ie.i18n.translate("xpack.profiling.functionsView.samplesColumnLabel",{defaultMessage:"Samples"}),hint:ie.i18n.translate("xpack.profiling.functionsView.samplesColumnLabel.hint",{defaultMessage:"Estimated values"}),labelSize:"s",labelStyle:{fontWeight:700},iconSize:"s"})},{id:ge.SelfCPU,initialWidth:r?100:200,display:Object(l.jsx)(gt,{type:"self",labelSize:"s",labelStyle:{fontWeight:700},iconSize:"s"})},{id:ge.TotalCPU,initialWidth:r?100:200,display:Object(l.jsx)(gt,{type:"total",labelSize:"s",labelStyle:{fontWeight:700},iconSize:"s"})}],t=[];return f&&e.push({initialWidth:60,id:ge.Diff,displayAsText:ie.i18n.translate("xpack.profiling.functionsView.diffColumnLabel",{defaultMessage:"Diff"})}),r||(e.push({id:ge.AnnualizedCo2,initialWidth:r?100:200,schema:"numeric",display:Object(l.jsx)(Lt,{label:ie.i18n.translate("xpack.profiling.functionsView.annualizedCo2",{defaultMessage:"Annualized CO2"}),hint:ie.i18n.translate("xpack.profiling.functionsView.annualizedCo2.hint",{defaultMessage:"Indicates the CO2 emission of the function and any functions called by it."}),labelSize:"s",labelStyle:{fontWeight:700},iconSize:"s"})},{id:ge.AnnualizedDollarCost,initialWidth:r?100:200,display:Object(l.jsx)(Lt,{label:ie.i18n.translate("xpack.profiling.functionsView.annualizedDollarCost",{defaultMessage:"Annualized dollar cost"}),hint:ie.i18n.translate("xpack.profiling.functionsView.annualizedDollarCost.hint",{defaultMessage:"Indicates the Dollar cost of the function and any functions called by it."}),labelSize:"s",labelStyle:{fontWeight:700},iconSize:"s"})}),t.push({id:"actions",width:40,headerCellRender:()=>Object(l.jsx)(h.EuiScreenReaderOnly,null,Object(l.jsx)("span",null,"Controls")),rowCellRender:function({rowIndex:e}){return Object(l.jsx)(h.EuiButtonIcon,{"aria-label":"Show actions",iconType:"expand",color:"text",onClick:function(){E({metric:"topN_function_details_click"}),O(w[e])}})}})),{columns:e,leadingControlColumns:t}}),[r,w,f,E]),[k,I]=Object(a.useState)(M.map((({id:e})=>e)));return Object(l.jsx)(o.a.Fragment,null,Object(l.jsx)(h.EuiDataGrid,{"data-test-subj":x,ref:v,"aria-label":"TopN functions",columns:M,columnVisibility:{visibleColumns:k,setVisibleColumns:I},rowCount:S>100?100:S,renderCellValue:function({rowIndex:e,columnId:t,setCellProps:n}){const r=w[e];return r?Object(l.jsx)(Bt,{functionRow:r,columnId:t,totalCount:S,onFrameClick:u,setCellProps:n}):null},inMemory:{level:"sorting"},sorting:{columns:[{id:g,direction:m}],onSort:function(e){const t=Object(j.last)(e);t&&b(t)}},leadingControlColumns:T,pagination:{pageIndex:p,pageSize:50,onChangeItemsPerPage:()=>{},onChangePage:d},rowHeightsOptions:{defaultHeight:"auto"},toolbarVisibility:{showColumnSelector:!1,showKeyboardShortcuts:!r,showDisplaySelector:!r,showFullScreenSelector:!r,showSortSelector:!1},virtualizationOptions:{onScroll:c},schemaDetectors:[{type:"samples",comparator:(e,t,n)=>{const r=parseFloat(e.replace(/,/g,"")),i=parseFloat(t.replace(/,/g,""));return ri?"desc"===n?-1:1:0},detector:e=>1,icon:"",sortTextAsc:"Low-High",sortTextDesc:"High-Low"}]}),y&&Object(l.jsx)(Ot,{onClose:()=>{O(void 0)},frame:{addressOrLine:y.frame.AddressOrLine,countExclusive:y.selfCPU,countInclusive:y.totalCPU,exeFileName:y.frame.ExeFileName,fileID:y.frame.FileID,frameType:y.frame.FrameType,functionName:y.frame.FunctionName,sourceFileName:y.frame.SourceFilename,sourceLine:y.frame.SourceLine},totalSeconds:n,totalSamples:S}))}));function Vt({title:e}){return Object(l.jsx)(h.EuiText,{style:{fontWeight:"bold"},textAlign:"left"},e)}function Wt({id:e,value:t,icon:n,color:r}){return Object(l.jsx)(h.EuiFlexGroup,{gutterSize:"s",justifyContent:"flexEnd"},n?Object(l.jsx)(h.EuiFlexItem,{grow:!1,style:{justifyContent:"center"}},Object(l.jsx)(h.EuiIcon,{"data-test-subj":`${e}_${n}_${r}`,type:n,color:r,size:"l"})):null,Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiTextColor,{style:{fontWeight:"bold"},color:r,"data-test-subj":`${e}_value`},t)))}function Ht({id:e,baseValue:t,baseIcon:n,baseColor:r,comparisonValue:i,title:a,isLoading:s,comparisonPerc:u,comparisonColor:c,comparisonIcon:f,titleHint:p}){return Object(l.jsx)(h.EuiPanel,{hasShadow:!1},Object(l.jsx)(h.EuiStat,{title:Object(l.jsx)(Wt,{id:e,value:t,color:r,icon:n}),titleSize:"m",description:Object(l.jsx)(o.a.Fragment,null,p?Object(l.jsx)(h.EuiFlexGroup,{gutterSize:"s"},Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(Vt,{title:a})),Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiToolTip,{content:p},Object(l.jsx)(h.EuiIcon,{type:"questionInCircle"})))):Object(l.jsx)(Vt,{title:a}),Object(l.jsx)(h.EuiSpacer,null)),textAlign:"right",isLoading:s},!s&&i?Object(l.jsx)(h.EuiText,{color:c},f?Object(l.jsx)(h.EuiIcon,{"data-test-subj":`${e}_comparison_${f}_${c}`,type:f}):null,Object(l.jsx)("span",{"data-test-subj":`${e}_comparison_value`},(d=i,(g=u)?`${d} (${g})`:`${d}`))):null));var d,g}const Yt=ie.i18n.translate("xpack.profiling.diffTopNFunctions.estimatedValue",{defaultMessage:"Estimated value"});function Xt({baselineTopNFunctions:e,comparisonTopNFunctions:t,baselineScaleFactor:n=1,comparisonScaleFactor:r=1,isLoading:i,baselineDuration:o,comparisonDuration:s}){const u=e?e.TotalCount*n:0,c=t?t.TotalCount*r:0,{co2EmissionDiff:f,costImpactDiff:p,totalSamplesDiff:d}=Object(a.useMemo)((()=>{var n;const r=e?ut({countExclusive:e.selfCPU,countInclusive:e.totalCPU,totalSamples:e.TotalCount,totalSeconds:o}):void 0,i=t?ut({countExclusive:t.selfCPU,countInclusive:t.totalCPU,totalSamples:t.TotalCount,totalSeconds:s}):void 0;return{totalSamplesDiff:Dt({baselineValue:u||0,comparisonValue:c||0}),co2EmissionDiff:Dt({baselineValue:(null==r||null===(n=r.totalSamples)||void 0===n?void 0:n.annualizedCo2)||0,comparisonValue:(null==i?void 0:i.totalSamples.annualizedCo2)||0,formatValue:ht}),costImpactDiff:Dt({baselineValue:(null==r?void 0:r.totalSamples.annualizedDollarCost)||0,comparisonValue:(null==i?void 0:i.totalSamples.annualizedDollarCost)||0,formatValue:ct})}}),[o,u,e,s,c,t]),m=[{id:"overallPerformance",title:ie.i18n.translate("xpack.profiling.diffTopNFunctions.summary.performance",{defaultMessage:"{label} overall performance by",values:{label:i||void 0===d.percentDiffDelta||void 0===d.label?"Gained/Lost":(null==d?void 0:d.percentDiffDelta)>0?"Lost":"Gained"}}),baseValue:d.label||"0%",baseIcon:d.icon,baseColor:d.color,titleHint:Yt},{id:"annualizedCo2",title:ie.i18n.translate("xpack.profiling.diffTopNFunctions.summary.co2",{defaultMessage:"Annualized CO2 emission impact"}),baseValue:f.baseValue,comparisonValue:f.comparisonValue,comparisonIcon:f.icon,comparisonColor:f.color,comparisonPerc:f.label,titleHint:Yt},{id:"annualizedCost",title:ie.i18n.translate("xpack.profiling.diffTopNFunctions.summary.cost",{defaultMessage:"Annualized cost impact"}),baseValue:p.baseValue,comparisonValue:p.comparisonValue,comparisonIcon:p.icon,comparisonColor:p.color,comparisonPerc:p.label,titleHint:Yt},{id:"totalNumberOfSamples",title:ie.i18n.translate("xpack.profiling.diffTopNFunctions.summary.samples",{defaultMessage:"Total number of samples"}),baseValue:d.baseValue,comparisonValue:d.comparisonValue,comparisonIcon:d.icon,comparisonColor:d.color,comparisonPerc:d.label,titleHint:Yt}];return Object(l.jsx)(h.EuiFlexGroup,{direction:"row"},m.map(((e,t)=>Object(l.jsx)(h.EuiFlexItem,{key:t},Object(l.jsx)(Ht,g()({},e,{isLoading:i}))))))}const Kt=ie.i18n.translate("xpack.profiling.topn.otherBucketLabel",{defaultMessage:"Other"});function Zt({category:e,subChartSize:t,colors:n}){return n[(e=>{let n=0;for(let t=0;t0?Object(l.jsx)(o.a.Fragment,null,Object(l.jsx)(h.EuiFlexItem,{style:{backgroundColor:x.euiTheme.colors.lightestShade,padding:x.euiTheme.size.m}},Object(l.jsx)(h.EuiFlexGroup,{direction:"column",gutterSize:"none"},M.map(((e,t)=>Object(l.jsx)(o.a.Fragment,null,Object(l.jsx)(h.EuiFlexItem,{grow:!1,key:e.FrameID},Object(l.jsx)(h.EuiFlexGroup,{direction:"row",alignItems:"center"},Object(l.jsx)(h.EuiFlexItem,{grow:!1},f.indexOf(e)+1),Object(l.jsx)(h.EuiFlexItem,{grow:!0},Object(l.jsx)(At,{frame:e})))),tnull==p?void 0:p()},Object(l.jsx)(h.EuiText,{size:"s"},r)):n===Kt?Object(l.jsx)(h.EuiText,{size:"s"},r):Object(l.jsx)(h.EuiLink,{href:O},Object(l.jsx)(h.EuiText,{size:"s"},r))),Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiFlexGroup,{direction:"column",gutterSize:"xs",alignItems:"flexEnd"},b?Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(h.EuiText,{size:"m"},Qe(b.Percentage/100))):null,Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(h.EuiText,{size:b?"xs":"s"},b?ie.i18n.translate("xpack.profiling.stackFrames.subChart.avg",{defaultMessage:"avg. {percentage}",values:{percentage:Qe(i/100)}}):Qe(i/100))))))),Object(l.jsx)(h.EuiFlexItem,{grow:!1,style:{position:"relative"}},Object(l.jsx)(Ve.Chart,{size:{height:a,width:u}},Object(l.jsx)(Ve.Tooltip,{showNullValues:!1}),Object(l.jsx)(Ve.Settings,{showLegend:!1,baseTheme:w,theme:S}),Object(l.jsx)(Ve.AreaSeries,{id:n,name:n,data:s,xAccessor:"Timestamp",yAccessors:["Count"],xScaleType:Ve.ScaleType.Time,timeZone:E,yScaleType:Ve.ScaleType.Linear,curve:Ve.CurveType.CURVE_STEP_AFTER,color:t}),b?Object(l.jsx)(Ve.LineAnnotation,{id:"highlighted_sample",domainType:Ve.AnnotationDomainType.XDomain,dataValues:[{dataValue:b.Timestamp}],style:{line:{strokeWidth:2,dash:[4,4],opacity:.5}},marker:Object(l.jsx)(h.EuiIcon,{type:"dot"}),markerPosition:Ve.Position.Top,hideTooltips:!0}):null,c?Object(l.jsx)(Ve.Axis,{id:"bottom-axis",position:"bottom",tickFormat:Object(Ve.timeFormatter)("YYYY-MM-DD HH:mm:ss")}):null,Object(l.jsx)(Ve.Axis,{id:"left-axis",position:"left",gridLine:{visible:!0},tickFormat:e=>c?Number(e).toFixed(0):"",style:c?{}:{tickLine:{visible:!1},tickLabel:{visible:!1},axisTitle:{visible:!1}}})),c?null:Object(l.jsx)("div",{style:{position:"absolute",top:0,left:0,backgroundColor:"rgba(255, 255, 255, 0.75)"}},b?Je(b.Count):ie.i18n.translate("xpack.profiling.maxValue",{defaultMessage:"Max: {max}",values:{max:Je(Math.max(...s.map((e=>{var t;return null!==(t=e.Count)&&void 0!==t?t:0}))))}}))),k)}const on=({limit:e,charts:t,showFrames:n})=>{var r;const i=Math.min(e,null!==(r=t.length)&&void 0!==r?r:0),s=Math.min(i,t.length),[u,c]=Object(a.useState)(void 0);return Object(l.jsx)(o.a.Fragment,null,Object(l.jsx)(h.EuiSpacer,null),Object(l.jsx)(h.EuiTitle,{size:"s"},Object(l.jsx)("h1",null,"Top ",t.length)),Object(l.jsx)(h.EuiSpacer,null),Object(l.jsx)(h.EuiFlexGrid,{columns:2,gutterSize:"m"},Object(j.take)(t,s).map(((e,t)=>Object(l.jsx)(h.EuiFlexItem,{key:t},Object(l.jsx)(h.EuiPanel,{paddingSize:"none"},Object(l.jsx)(an,{index:e.Index,color:e.Color,category:e.Category,label:e.Label,percentage:e.Percentage,metadata:e.Metadata,height:200,data:e.Series,sample:null,showAxes:!0,onShowMoreClick:()=>{c(e)},showFrames:n,padTitle:!0})))))),u&&Object(l.jsx)(h.EuiFlyout,{onClose:()=>{c(void 0)}},Object(l.jsx)(an,{style:{overflow:"auto"},index:u.Index,color:u.Color,category:u.Category,label:u.Label,percentage:u.Percentage,metadata:u.Metadata,height:200,data:u.Series,sample:null,showAxes:!0,onShowMoreClick:null,showFrames:n,padTitle:!0})))},sn=224;function un({height:e,asPercentages:t,onBrushEnd:n,charts:r,showFrames:i,onClick:o}){const s=Object(a.useMemo)((()=>Object(j.keyBy)(r,"Category")),[r]),u=Qt(),[c,f]=Object(a.useState)(),{chartsBaseTheme:p,chartsTheme:d}=tn();return Object(l.jsx)(Ve.Chart,{size:{height:e}},Object(l.jsx)(Ve.Settings,{showLegend:!1,brushAxis:Ve.BrushAxis.X,onBrushEnd:e=>{const t=new Date(e.x[0]).toISOString(),r=new Date(e.x[1]).toISOString();n({rangeFrom:t,rangeTo:r})},baseTheme:p,theme:d,onElementOver:e=>{const[t]=e[0];f(t.datum)},onElementClick:o?e=>{const[t]=e[0],n=t.datum;o(n.Category)}:void 0,onElementOut:()=>{f(void 0)}}),Object(l.jsx)(Ve.Tooltip,{customTooltip:function(){if(!c)return null;const e=s[c.Category];return e?Object(l.jsx)(Ve.TooltipContainer,null,Object(l.jsx)(h.EuiPanel,null,Object(l.jsx)(an,{index:e.Index,color:e.Color,category:e.Category,label:e.Label,data:e.Series,percentage:e.Percentage,sample:c,showFrames:i,metadata:[],height:128,width:sn,showAxes:!1,onShowMoreClick:null,padTitle:!1}))):null}}),r.map((e=>Object(l.jsx)(Ve.HistogramBarSeries,{key:e.Category,id:e.Category,name:e.Label,data:e.Series,color:e.Color,xAccessor:"Timestamp",yAccessors:["Count"],stackMode:t?Ve.StackMode.Percentage:void 0,xScaleType:Ve.ScaleType.Time,timeZone:u}))),Object(l.jsx)(Ve.Axis,{id:"bottom-axis",position:"bottom",tickFormat:Object(Ve.timeFormatter)("YYYY-MM-DD HH:mm:ss")}),Object(l.jsx)(Ve.Axis,{id:"left-axis",position:"left",gridLine:{visible:!0},tickFormat:e=>t?Qe(e):e.toFixed(0)}))}var ln=n(24);function cn(e){switch(e){case"events":return ie.i18n.translate("xpack.profiling.storageExplorer.dataBreakdown.chart.samples",{defaultMessage:"Samples"});case"executables":return ie.i18n.translate("xpack.profiling.storageExplorer.dataBreakdown.chart.executables",{defaultMessage:"Executables"});case"metrics":return ie.i18n.translate("xpack.profiling.storageExplorer.dataBreakdown.chart.metrics",{defaultMessage:"Metrics"});case"stackframes":return ie.i18n.translate("xpack.profiling.storageExplorer.dataBreakdown.chart.stackframes",{defaultMessage:"Stackframes"});case"stacktraces":return ie.i18n.translate("xpack.profiling.storageExplorer.dataBreakdown.chart.stacktraces",{defaultMessage:"Stacktraces"})}}function fn({data:e=[]}){const t=Object(h.useEuiTheme)(),{chartsBaseTheme:n,chartsTheme:r}=tn(),i=Object(h.euiPaletteColorBlind)(),a=e.map((e=>{const{indexName:t,...n}=e;return{key:cn(e.indexName),...n}}));return Object(l.jsx)("div",{style:{backgroundColor:t.euiTheme.colors.lightestShade,height:"100%",display:"flex",justifyContent:"center",alignItems:"center"}},a.length?Object(l.jsx)(Ve.Chart,{size:{height:250,width:400}},Object(l.jsx)(Ve.Settings,{showLegend:!0,legendPosition:Ve.Position.Right,baseTheme:n,theme:{...r,background:{color:"transparent"}}}),Object(l.jsx)(Ve.Partition,{layout:"sunburst",id:"spec_1",data:a,valueAccessor:e=>Number(e.sizeInBytes),valueGetter:"percent",valueFormatter:e=>Object(ln.asDynamicBytes)(e),layers:[{groupByRollup:e=>e.key,shape:{fillColor:(e,t)=>i[t]}}]})):Object(l.jsx)("div",{style:{height:250,display:"flex",justifyContent:"center",alignItems:"center"}},Object(l.jsx)(h.EuiText,{color:"subdued",size:"s"},ie.i18n.translate("xpack.profiling.storageExplorer.dataBreakdown.noDataToDisplay",{defaultMessage:"No data to display"}))))}const pn={events:ie.i18n.translate("xpack.profiling.storageExplorer.dataBreakdown.events.hint",{defaultMessage:"Universal Profiling samples linearly correlate with the probabilistic profiling value. The lower the probabilistic profiling value, the fewer samples are collected."})};function hn({data:e=[]}){return Object(l.jsx)(h.EuiFlexGroup,{gutterSize:"s",direction:"column"},["stackframes","stacktraces","executables","metrics","events"].map((t=>{const n=e.find((e=>e.indexName===t));return Object(l.jsx)(h.EuiFlexItem,{grow:!1,key:t},Object(l.jsx)(dn,{indexName:t,docCount:null==n?void 0:n.docCount,sizeInBytes:null==n?void 0:n.sizeInBytes,hint:pn[t]}))})))}function dn({indexName:e,docCount:t,sizeInBytes:n,hint:r}){const i=Object(h.useEuiTheme)(),a=cn(e);return Object(l.jsx)(o.a.Fragment,null,Object(l.jsx)(h.EuiFlexGroup,{responsive:!1},Object(l.jsx)(h.EuiFlexItem,null,r?Object(l.jsx)(Lt,{label:a,hint:r,labelSize:"xs",labelStyle:{fontWeight:"bold"}}):Object(l.jsx)(h.EuiText,{style:{fontWeight:"bold"},size:"xs"},a)),Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(h.EuiText,{style:{fontWeight:"bold"},size:"xs"},ie.i18n.translate("xpack.profiling.storageExplorer.dataBreakdown.size",{defaultMessage:"Size"})))),Object(l.jsx)(h.EuiFlexGroup,{responsive:!1,style:{backgroundColor:i.euiTheme.colors.lightestShade,height:41,alignItems:"center",borderTop:`${i.euiTheme.border.width.thin} solid ${i.euiTheme.border.color}`,borderBottom:`${i.euiTheme.border.width.thin} solid ${i.euiTheme.border.color}`}},Object(l.jsx)(h.EuiFlexItem,{style:{paddingLeft:8},"data-test-subj":`${e}_docSize`},void 0!==t?Object(ln.asInteger)(t):Object(l.jsx)(h.EuiText,{color:"subdued",size:"s"},Ae.b)),Object(l.jsx)(h.EuiFlexItem,{style:{paddingLeft:8},"data-test-subj":`${e}_size`},n?Object(ln.asDynamicBytes)(n):Object(l.jsx)(h.EuiText,{color:"subdued",size:"s"},Ae.b))))}const gn={sort:{field:"sizeInBytes",direction:"desc"}};function mn({data:e=[]}){const[t,n]=Object(a.useState)({pageIndex:0}),r=Object(a.useMemo)((()=>[{field:"indexName",name:ie.i18n.translate("xpack.profiling.storageExplorer.dataBreakdown.storageDetailsTable.index",{defaultMessage:"Index"}),sortable:!0},{field:"primaryShardsCount",width:"150px",name:ie.i18n.translate("xpack.profiling.storageExplorer.dataBreakdown.storageDetailsTable.primaries",{defaultMessage:"Primaries"}),render:(e,{primaryShardsCount:t})=>null!=t?t:Ae.b,sortable:!0},{field:"replicaShardsCount",width:"150px",name:ie.i18n.translate("xpack.profiling.storageExplorer.dataBreakdown.storageDetailsTable.replicas",{defaultMessage:"Replicas"}),render:(e,{replicaShardsCount:t})=>null!=t?t:Ae.b,sortable:!0},{field:"docCount",width:"150px",name:ie.i18n.translate("xpack.profiling.storageExplorer.dataBreakdown.storageDetailsTable.docCount",{defaultMessage:"Doc count"}),sortable:!0,render:(e,{docCount:t})=>t?Object(ln.asInteger)(t):Ae.b},{field:"sizeInBytes",width:"150px",name:ie.i18n.translate("xpack.profiling.storageExplorer.dataBreakdown.storageDetailsTable.storageSize",{defaultMessage:"Storage size"}),sortable:!0,render:(e,{sizeInBytes:t})=>t?Object(ln.asDynamicBytes)(t):Ae.b},{field:"dataStream",name:ie.i18n.translate("xpack.profiling.storageExplorer.dataBreakdown.storageDetailsTable.dataStream",{defaultMessage:"Data stream"}),sortable:!0,render:(e,{dataStream:t})=>null!=t?t:Ae.b},{field:"lifecyclePhase",width:"150px",name:ie.i18n.translate("xpack.profiling.storageExplorer.dataBreakdown.storageDetailsTable.lifecyclePhase",{defaultMessage:"Lifecycle phase"}),sortable:!0,render:(e,{lifecyclePhase:t})=>null!=t?t:Ae.b}]),[]);return Object(l.jsx)(o.a.Fragment,null,Object(l.jsx)(h.EuiTitle,{size:"xxxs"},Object(l.jsx)(h.EuiText,null,ie.i18n.translate("xpack.profiling.storageExplorer.dataBreakdown.storageDetailsTable.title",{defaultMessage:"Indices breakdown"}))),Object(l.jsx)(h.EuiInMemoryTable,{items:e,columns:r,sorting:gn,pagination:{pageSize:10,showPerPageOptions:!1,...t},onTableChange:function({page:{index:e}}){n({pageIndex:e})}}))}function bn(){var e,t,n;const r=Object(h.useEuiTheme)(),{query:i}=Ce("/storage-explorer"),{indexLifecyclePhase:a}=i,{services:{fetchStorageExplorerIndicesStorageDetails:s}}=le(),u=Ct((({http:e})=>s({http:e,indexLifecyclePhase:a})),[s,a]);return Object(l.jsx)(o.a.Fragment,null,Object(l.jsx)(h.EuiTitle,null,Object(l.jsx)(h.EuiText,null,ie.i18n.translate("xpack.profiling.storageExplorer.dataBreakdown.title",{defaultMessage:"Data breakdown"}))),Object(l.jsx)(h.EuiSpacer,null),Object(l.jsx)(h.EuiPanel,{hasShadow:!1,hasBorder:!0},Object(l.jsx)(Ge,g()({size:"xl"},u,{style:{height:400}}),Object(l.jsx)(h.EuiFlexGroup,{direction:"column"},Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(h.EuiFlexGroup,{direction:"row",gutterSize:"none"},Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(fn,{data:null===(e=u.data)||void 0===e?void 0:e.storageDetailsGroupedByIndex})),Object(l.jsx)(h.EuiFlexItem,{grow:!1,style:{width:r.euiTheme.border.width.thin,backgroundColor:r.euiTheme.border.color,marginLeft:64,marginRight:64}}),Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(hn,{data:null===(t=u.data)||void 0===t?void 0:t.storageDetailsGroupedByIndex})))),Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(mn,{data:null===(n=u.data)||void 0===n?void 0:n.storageDetailsPerIndex}))))))}function xn({totalNumberOfDistinctProbabilisticValues:e}){const{docLinks:t}=le().start.core;return Object(l.jsx)(h.EuiCallOut,{title:ie.i18n.translate("xpack.profiling.storageExplorer.distinctProbabilisticProfilingValues.title",{defaultMessage:"We've identified {count} distinct probabilistic profiling values. Make sure to update them.",values:{count:e}}),color:"warning",iconType:"warning"},Object(l.jsx)(h.EuiText,{size:"s",color:"subdued"},ie.i18n.translate("xpack.profiling.storageExplorer.distinctProbabilisticProfilingValues.description",{defaultMessage:"We recommend using a consistent probabilistic value for each project for more efficient storage, cost management, and to maintain good statistical accuracy."})),Object(l.jsx)(h.EuiSpacer,null),Object(l.jsx)(h.EuiButton,{href:`${t.ELASTIC_WEBSITE_URL}/guide/en/observability/${t.DOC_LINK_VERSION}/profiling-probabilistic-profiling.html`,color:"warning",target:"_blank"},ie.i18n.translate("xpack.profiling.storageExplorer.distinctProbabilisticProfilingValues.button",{defaultMessage:"Learn how"})))}const vn={sort:{field:"hostName",direction:"desc"}};function yn({data:e=[],hasDistinctProbabilisticValues:t}){const{query:n}=Ce("/storage-explorer"),{rangeFrom:r,rangeTo:i}=n,o=Cn(),[s,u]=Object(a.useState)({pageIndex:0}),c=e.reduce(((e,t)=>{var n;const r=t.projectId,i=null!==(n=e[r])&&void 0!==n?n:0;return{...e,[r]:i+1}}),{}),f=Object(a.useMemo)((()=>[...t?[{field:"distinctProbabilisticWarning",width:"30",name:"",sortable:!0,render:(e,t)=>{if(c[t.projectId]>1)return Object(l.jsx)(h.EuiToolTip,{content:ie.i18n.translate("xpack.profiling.storageExplorer.hostsTable.distinctProbabilisticValues",{defaultMessage:"We've identified distinct probabilistic profiling values for the same project"})},Object(l.jsx)(h.EuiIcon,{type:"warning",color:"warning"}))}}]:[],{field:"projectId",width:"100",name:ie.i18n.translate("xpack.profiling.storageExplorer.hostsTable.projectId",{defaultMessage:"Project ID"}),sortable:!0},{field:"hostName",name:Object(l.jsx)(Lt,{label:ie.i18n.translate("xpack.profiling.storageExplorer.hostsTable.host",{defaultMessage:"Host"}),hint:ie.i18n.translate("xpack.profiling.storageExplorer.hostsTable.host.hint",{defaultMessage:"host.name[host.id]"}),labelSize:"xs",labelStyle:{fontWeight:700},iconSize:"s"}),sortable:!0,render:(e,t)=>Object(l.jsx)(h.EuiLink,{"data-test-subj":`hostId_${t.hostId}`,className:"eui-textTruncate",href:o.link("/flamegraphs/flamegraph",{query:{rangeFrom:r,rangeTo:i,kuery:`host.id: "${t.hostId}"`}})},`${t.hostName} [${t.hostId}]`)},{field:"probabilisticValues",name:ie.i18n.translate("xpack.profiling.storageExplorer.hostsTable.probabilisticValues",{defaultMessage:"Probabilistic Profiling values"}),sortable:!0,render:e=>Object(l.jsx)(h.EuiFlexGroup,{gutterSize:"s"},e.map(((e,t)=>Object(l.jsx)(h.EuiFlexItem,{key:t,grow:!1},e.date?Object(l.jsx)(h.EuiToolTip,{content:ie.i18n.translate("xpack.profiling.storageExplorer.hostsTable.probabilisticProfilingValues",{defaultMessage:"Introduced on {date}",values:{date:Object(ln.asAbsoluteDateTime)(e.date)}})},Object(l.jsx)(h.EuiBadge,{color:"hollow",isDisabled:t>0},e.value)):Object(l.jsx)(h.EuiBadge,{color:"hollow",isDisabled:t>0},e.value)))))},{field:"totalMetricsSize",name:ie.i18n.translate("xpack.profiling.storageExplorer.hostsTable.metricsData",{defaultMessage:"Metrics data"}),sortable:!0,width:"200",render:e=>Object(ln.asDynamicBytes)(e)},{field:"totalEventsSize",name:ie.i18n.translate("xpack.profiling.storageExplorer.hostsTable.samplesData",{defaultMessage:"Samples data"}),sortable:!0,width:"200",render:e=>Object(ln.asDynamicBytes)(e)},{field:"totalSize",name:Object(l.jsx)(Lt,{label:ie.i18n.translate("xpack.profiling.storageExplorer.hostsTable.totalData",{defaultMessage:"Total data"}),hint:ie.i18n.translate("xpack.profiling.storageExplorer.hostsTable.totalData.hint",{defaultMessage:"The combined value of Universal Profiling metrics and samples."}),labelSize:"xs",labelStyle:{fontWeight:700},iconSize:"s"}),sortable:!0,width:"200",render:e=>Object(ln.asDynamicBytes)(e)}]),[t,c,o,r,i]);return Object(l.jsx)(h.EuiInMemoryTable,{items:e,columns:f,sorting:vn,pagination:{pageSize:10,showPerPageOptions:!1,...s},onTableChange:function({page:{index:e}}){u({pageIndex:e})}})}function jn({data:e=[]}){const{chartsBaseTheme:t,chartsTheme:n}=tn(),r=Qt(),i=Object(a.useMemo)((()=>{var t;return null!==(t=e.map((({hostId:e,hostName:t,timeseries:n})=>({data:null!=n?n:[],type:"area",title:`${t} [${e}]`}))))&&void 0!==t?t:[]}),[e]),o=i.flatMap((({data:e})=>e.map((({x:e})=>e)))),s=Math.min(...o),u=Math.max(...o),c=Object(Ve.niceTimeFormatter)([s,u]);return Object(l.jsx)(Ve.Chart,{size:{height:400}},Object(l.jsx)(Ve.Settings,{showLegend:!0,legendPosition:Ve.Position.Right,baseTheme:t,theme:n}),Object(l.jsx)(Ve.Axis,{id:"x-axis",position:Ve.Position.Bottom,showOverlappingTicks:!0,tickFormat:c,gridLine:{visible:!1}}),Object(l.jsx)(Ve.Axis,{id:"y-axis",position:Ve.Position.Left,gridLine:{visible:!0},tickFormat:ln.asDynamicBytes}),i.map((e=>Object(l.jsx)(Ve.AreaSeries,{timeZone:r,key:e.title,id:e.title,xScaleType:Ve.ScaleType.Time,yScaleType:Ve.ScaleType.Linear,xAccessor:"x",yAccessors:["y"],data:e.data,stackAccessors:["x"]}))))}function On({hasDistinctProbabilisticValues:e}){var t,n;const{query:r}=Ce("/storage-explorer"),{rangeFrom:i,rangeTo:a,kuery:s,indexLifecyclePhase:u}=r,c=It({rangeFrom:i,rangeTo:a}),{services:{fetchStorageExplorerHostStorageDetails:f}}=le(),p=Ct((({http:e})=>f({http:e,timeFrom:c.inSeconds.start,timeTo:c.inSeconds.end,kuery:s,indexLifecyclePhase:u})),[f,c.inSeconds.start,c.inSeconds.end,s,u]);return Object(l.jsx)(o.a.Fragment,null,Object(l.jsx)(h.EuiTitle,null,Object(l.jsx)(h.EuiText,null,ie.i18n.translate("xpack.profiling.storageExplorer.hostBreakdown.title",{defaultMessage:"Host agent breakdown"}),Object(l.jsx)(h.EuiToolTip,{content:ie.i18n.translate("xpack.profiling.storageExplorer.hostBreakdown.title.hint",{defaultMessage:"This graph shows the combined values of Universal Profiling samples and metrics. host.name[host.id]."})},Object(l.jsx)(h.EuiIcon,{type:"questionInCircle",style:{marginLeft:4}})))),Object(l.jsx)(h.EuiSpacer,null),Object(l.jsx)(h.EuiPanel,{hasShadow:!1,hasBorder:!0},Object(l.jsx)(Ge,g()({size:"xl"},p,{style:{height:400}}),Object(l.jsx)(h.EuiFlexGroup,{direction:"column"},Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(jn,{data:null===(t=p.data)||void 0===t?void 0:t.hostDetailsTimeseries})),Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(yn,{data:null===(n=p.data)||void 0===n?void 0:n.hostDetails,hasDistinctProbabilisticValues:e}))))))}function En(){const e=Cn(),{query:t}=Ce("/storage-explorer"),{indexLifecyclePhase:n}=t,r=[{value:ye.All,label:ie.i18n.translate("xpack.profiling.storageExplorer.indexLifecyclePhase.all.label",{defaultMessage:"All"}),description:ie.i18n.translate("xpack.profiling.storageExplorer.indexLifecyclePhase.all.description",{defaultMessage:"Search data in all lifecycle phases."})},{value:ye.Hot,label:ie.i18n.translate("xpack.profiling.storageExplorer.indexLifecyclePhase.hot.label",{defaultMessage:"Hot"}),description:ie.i18n.translate("xpack.profiling.storageExplorer.indexLifecyclePhase.hot.description",{defaultMessage:"Holds your most-recent, most-frequently-searched data."})},{value:ye.Warm,label:ie.i18n.translate("xpack.profiling.storageExplorer.indexLifecyclePhase.warm.label",{defaultMessage:"Warm"}),description:ie.i18n.translate("xpack.profiling.storageExplorer.indexLifecyclePhase.warm.description",{defaultMessage:"Holds data from recent weeks. Updates are still allowed, but likely infrequent."})},{value:ye.Cold,label:ie.i18n.translate("xpack.profiling.storageExplorer.indexLifecyclePhase.cold.label",{defaultMessage:"Cold"}),description:ie.i18n.translate("xpack.profiling.storageExplorer.indexLifecyclePhase.cold.description",{defaultMessage:"While still searchable, this tier is typically optimized for lower storage costs rather than search speed."})},{value:ye.Frozen,label:ie.i18n.translate("xpack.profiling.storageExplorer.indexLifecyclePhase.frozen.label",{defaultMessage:"Frozen"}),description:ie.i18n.translate("xpack.profiling.storageExplorer.indexLifecyclePhase.frozen.description",{defaultMessage:"Holds data that are no longer being queried, or being queried rarely."})}].map((({value:e,label:t,description:n})=>({value:e,inputDisplay:t,dropdownDisplay:Object(l.jsx)(o.a.Fragment,null,Object(l.jsx)("strong",null,t),Object(l.jsx)(h.EuiText,{size:"s",color:"subdued"},Object(l.jsx)("p",null,n)))})));return Object(l.jsx)(h.EuiSuperSelect,{prepend:ie.i18n.translate("xpack.profiling.storageExplorer.indexLifecyclePhase.label",{defaultMessage:"Index lifecycle phase"}),options:r,valueOfSelected:n,onChange:n=>{e.push("/storage-explorer",{path:{},query:{...t,indexLifecyclePhase:n}})},hasDividers:!0,style:{minWidth:200}})}function Sn({data:e,isLoading:t}){const{query:n}=Ce("/storage-explorer"),{rangeFrom:r,rangeTo:i,kuery:a}=n,o=Cn(),{start:{core:s}}=le(),u=[{dataTestSubj:"totalData",title:ie.i18n.translate("xpack.profiling.storageExplorer.summary.totalData",{defaultMessage:"Total data"}),value:null!=e&&e.totalProfilingSizeBytes?Object(ln.asDynamicBytes)(null==e?void 0:e.totalProfilingSizeBytes):void 0,hint:ie.i18n.translate("xpack.profiling.storageExplorer.summary.totalData.hint",{defaultMessage:"Total storage size of all Universal Profiling indices including replicas, ignoring the filter settings."})},{dataTestSubj:"dailyDataGeneration",title:ie.i18n.translate("xpack.profiling.storageExplorer.summary.dailyDataGeneration",{defaultMessage:"Daily data generation"}),value:null!=e&&e.dailyDataGenerationBytes?Object(ln.asDynamicBytes)(null==e?void 0:e.dailyDataGenerationBytes):void 0},{dataTestSubj:"totalDebugSymbolsSize",title:ie.i18n.translate("xpack.profiling.storageExplorer.summary.totalDebugSymbolsSize",{defaultMessage:"Total debug symbols size"}),value:null!=e&&e.totalSymbolsSizeBytes?Object(ln.asDynamicBytes)(null==e?void 0:e.totalSymbolsSizeBytes):void 0,hint:ie.i18n.translate("xpack.profiling.storageExplorer.summary.totalDebugSymbolsSize.hint",{defaultMessage:"The total sum of private and public debug symbols."})},{dataTestSubj:"diskSpaceUsed",title:ie.i18n.translate("xpack.profiling.storageExplorer.summary.discSpaceUsed",{defaultMessage:"Disk space used"}),value:null!=e&&e.diskSpaceUsedPct?Qe(null==e?void 0:e.diskSpaceUsedPct):void 0,hint:ie.i18n.translate("xpack.profiling.storageExplorer.summary.discSpaceUsed.hint",{defaultMessage:"The percentage of the storage capacity that is currently used by all of the Universal Profiling indices compared to the maximum storage capacity currently configured for Elasticsearch."})},{dataTestSubj:"numberOfHostsAgents",title:ie.i18n.translate("xpack.profiling.storageExplorer.summary.numberOfHosts",{defaultMessage:"Number of host agents"}),value:null==e?void 0:e.totalNumberOfHosts,hint:ie.i18n.translate("xpack.profiling.storageExplorer.summary.numberOfHosts.hint",{defaultMessage:"Total number of Universal Profiling host agents reporting into the deployment."})}];return Object(l.jsx)(h.EuiPanel,{hasShadow:!1,hasBorder:!0},Object(l.jsx)(h.EuiFlexGroup,{justifyContent:"spaceBetween"},u.map(((e,n)=>Object(l.jsx)(h.EuiFlexItem,{grow:!1,key:n},Object(l.jsx)(h.EuiStat,{description:e.hint?Object(l.jsx)(Lt,{label:e.title,hint:e.hint,labelSize:"xs"}):Object(l.jsx)(h.EuiText,{size:"xs"},e.title),titleSize:"s",title:Object(l.jsx)("span",{"data-test-subj":e.dataTestSubj},e.value),isLoading:t})))),Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiFlexGroup,{direction:"column"},Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiLink,{href:o.link("/stacktraces/{topNType}",{path:{topNType:ve.Hosts},query:{rangeFrom:r,rangeTo:i,kuery:a,limit:10,displayAs:xe.StackTraces}})},ie.i18n.translate("xpack.profiling.storageExplorer.summary.universalProfilingLink",{defaultMessage:"Go to Universal Profiling"}))),Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiLink,{href:s.http.basePath.prepend("/app/management/data/index_management/data_streams")},ie.i18n.translate("xpack.profiling.storageExplorer.summary.indexManagement",{defaultMessage:"Go to Index Management"})))))))}const wn=Object(a.createContext)(void 0);function Mn({children:e}){const[,t]=Object(a.useState)({}),n=Object(a.useMemo)((()=>new Map),[]),r=Y(),i=Object(a.useMemo)((()=>({set(e,r){Object(j.isEqual)(n.get(e),r)||(n.set(e,r),t({}))},unset(e){n.has(e)&&(n.delete(e),t({}))},getBreadcrumbs:e=>Object(j.compact)(e.flatMap((e=>n.get(e.route))))})),[n]),o=i.getBreadcrumbs(r).map(((e,t,n)=>({text:e.title,...t===n.length-1?{}:{href:e.href}})));return Object(ne.useBreadcrumbs)(o),Object(l.jsx)(wn.Provider,{value:i},e)}const Tn=({title:e,href:t,children:n})=>{const{start:{core:r}}=le();return function(e){const t=Object(a.useContext)(wn);if(!t)throw new Error("Missing Breadcrumb API in context");const{match:n}=(()=>{const e=Object(a.useContext)($);if(!e)throw new Error("No match was found in context");return e})(),r=Object(a.useRef)(null==n?void 0:n.route);Object(a.useEffect)((()=>(r.current&&r.current!==(null==n?void 0:n.route)&&t.unset(r.current),r.current=null==n?void 0:n.route,r.current&&t.set(r.current,Object(j.castArray)(e)),()=>{r.current&&t.unset(r.current)})),[r.current,null==n?void 0:n.route])}({title:e,href:r.http.basePath.prepend("/app/profiling/"+t)}),n},kn={"/":{element:Object(l.jsx)(Tn,{title:ie.i18n.translate("xpack.profiling.breadcrumb.profiling",{defaultMessage:"Universal Profiling"}),href:"/"},Object(l.jsx)(q,null)),children:{"/add-data-instructions":{element:Object(l.jsx)((function(){var e,t,n,r;const{query:i}=Ce("/add-data-instructions"),{selectedTab:a}=i,s=Cn(),u=Fe(),{services:{setupDataCollectionInstructions:c},start:{core:f}}=le(),{data:p,status:d}=he((({http:e})=>c({http:e})),[c]),g=null==p||null===(e=p.collector)||void 0===e?void 0:e.secretToken,m=null==p||null===(t=p.collector)||void 0===t?void 0:t.host,b=null==p||null===(n=p.symbolizer)||void 0===n?void 0:n.host,x=null==p?void 0:p.stackVersion,v=x?xt()(x).toString():void 0,y=[{key:vt.Kubernetes,title:ie.i18n.translate("xpack.profiling.tabs.kubernetesTitle",{defaultMessage:"Kubernetes"}),steps:[{title:ie.i18n.translate("xpack.profiling.tabs.kubernetesRepositoryStep",{defaultMessage:"Configure the Universal Profiling host-agent Helm repository:"}),content:Object(l.jsx)(h.EuiCodeBlock,{paddingSize:"s",isCopyable:!0},"helm repo add elastic https://helm.elastic.co")},{title:ie.i18n.translate("xpack.profiling.tabs.kubernetesInstallStep",{defaultMessage:"Install host-agent via Helm:"}),content:Object(l.jsx)(h.EuiCodeBlock,{paddingSize:"s",isCopyable:!0},`helm install --create-namespace -n=universal-profiling universal-profiling-agent \\\n--set "projectID=1,secretToken=${g}" \\\n--set "collectionAgentHostPort=${m}" \\\n--set "version=${x}" \\\n--version=${x} \\\nelastic/pf-host-agent`)},{title:ie.i18n.translate("xpack.profiling.tabs.kubernetesValidationStep",{defaultMessage:"Validate the host-agent pods are running:"}),content:Object(l.jsx)(h.EuiCodeBlock,{paddingSize:"s",isCopyable:!0},"kubectl -n universal-profiling get pods")},{title:ie.i18n.translate("xpack.profiling.tabs.postValidationStep",{defaultMessage:"Use the Helm install output to get host-agent logs and spot potential errors"}),content:Object(l.jsx)(o.a.Fragment,null)}]},{key:vt.Docker,title:ie.i18n.translate("xpack.profiling.tabs.dockerTitle",{defaultMessage:"Docker"}),steps:[{title:ie.i18n.translate("xpack.profiling.tabs.dockerRunContainerStep",{defaultMessage:"Run the Universal Profiling container:"}),content:Object(l.jsx)(h.EuiCodeBlock,{paddingSize:"s",isCopyable:!0},`docker run --name pf-host-agent --privileged --pid=host -v /etc/machine-id:/etc/machine-id:ro \\\n-v /var/run/docker.sock:/var/run/docker.sock -v /sys/kernel/debug:/sys/kernel/debug:ro \\\ndocker.elastic.co/observability/profiling-agent:${x} /root/pf-host-agent \\\n-project-id=1 -secret-token=${g} \\\n-collection-agent=${m}`)}]},{key:vt.Binary,title:ie.i18n.translate("xpack.profiling.tabs.binaryTitle",{defaultMessage:"Binary"}),steps:[{title:ie.i18n.translate("xpack.profiling.tabs.binaryDownloadStep",{defaultMessage:"Download the binary for the right architecture:"}),content:Object(l.jsx)(h.EuiText,null,Object(l.jsx)("b",null,"For x86_64:"),Object(l.jsx)(h.EuiSpacer,{size:"s"}),Object(l.jsx)(h.EuiCodeBlock,{paddingSize:"s",isCopyable:!0},`wget -O pf-host-agent.tgz "https://artifacts.elastic.co/downloads/prodfiler/pf-host-agent-${x}-linux-x86_64.tar.gz" && tar xzf pf-host-agent.tgz`),Object(l.jsx)(h.EuiSpacer,{size:"m"}),Object(l.jsx)("b",null,"For ARM64:"),Object(l.jsx)(h.EuiSpacer,{size:"s"}),Object(l.jsx)(h.EuiCodeBlock,{paddingSize:"s",isCopyable:!0},`wget -O pf-host-agent.tgz "https://artifacts.elastic.co/downloads/prodfiler/pf-host-agent-${x}-linux-arm64.tar.gz" && tar xzf pf-host-agent.tgz`))},{title:ie.i18n.translate("xpack.profiling.tabs.binaryGrantPermissionStep",{defaultMessage:"Grant executable permissions:"}),content:Object(l.jsx)(h.EuiCodeBlock,{paddingSize:"s",isCopyable:!0},"chmod +x pf-host-agent/pf-host-agent")},{title:ie.i18n.translate("xpack.profiling.tabs.binaryRunHostAgentStep",{defaultMessage:"Run the Universal Profiling host-agent (requires root privileges):"}),content:Object(l.jsx)(h.EuiCodeBlock,{paddingSize:"s",isCopyable:!0},`sudo pf-host-agent/pf-host-agent -project-id=1 -secret-token=${g} -collection-agent=${m}`)}]},{key:vt.Deb,title:ie.i18n.translate("xpack.profiling.tabs.debTitle",{defaultMessage:"DEB Package"}),steps:[{title:ie.i18n.translate("xpack.profiling.tabs.debConfigureRepoStep",{defaultMessage:"Configure the apt repository (requires root privileges):"}),content:Object(l.jsx)(h.EuiCodeBlock,{paddingSize:"s",isCopyable:!0},`wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -\nsudo apt-get install apt-transport-https\necho "deb https://artifacts.elastic.co/packages/${v}.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-${v}.x.list\n`)},{title:ie.i18n.translate("xpack.profiling.tabs.debInstallPackageStep",{defaultMessage:"Install the DEB package (requires root privileges):"}),content:Object(l.jsx)(h.EuiCodeBlock,{paddingSize:"s",isCopyable:!0},"sudo apt-get update && sudo apt-get install pf-host-agent")},{title:ie.i18n.translate("xpack.profiling.tabs.debEditConfigStep",{defaultMessage:"Edit the configuration (requires root privileges):"}),content:Object(l.jsx)(h.EuiCodeBlock,{paddingSize:"s",isCopyable:!0},`echo -e "project-id 1\nsecret-token ${g}\ncollection-agent ${m}" | sudo tee -a /etc/Elastic/universal-profiling/pf-host-agent.conf`)},{title:ie.i18n.translate("xpack.profiling.tabs.debStartSystemdServiceStep",{defaultMessage:"Start the Universal Profiling systemd service (requires root privileges):"}),content:Object(l.jsx)(h.EuiCodeBlock,{paddingSize:"s",isCopyable:!0},"sudo systemctl enable pf-host-agent && sudo systemctl restart pf-host-agent")}]},{key:vt.RPM,title:ie.i18n.translate("xpack.profiling.tabs.rpmTitle",{defaultMessage:"RPM Package"}),steps:[{title:ie.i18n.translate("xpack.profiling.tabs.rpmConfigureRepoStep",{defaultMessage:"Configure the yum repository (requires root privileges):"}),content:Object(l.jsx)(h.EuiCodeBlock,{paddingSize:"s",isCopyable:!0},`sudo rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch\ncat < /etc/yum.repos.d/elastic.repo\n[elastic-${v}.x]\nname=Elastic repository for ${v}.x packages\nbaseurl=https://artifacts.elastic.co/packages/${v}.x/yum\ngpgcheck=1\ngpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch\nenabled=1\nautorefresh=1\ntype=rpm-md\nEOF`)},{title:ie.i18n.translate("xpack.profiling.tabs.rpmInstallPackageStep",{defaultMessage:"Install the RPM package (requires root privileges):"}),content:Object(l.jsx)(h.EuiCodeBlock,{paddingSize:"s",isCopyable:!0},"sudo yum install pf-host-agent")},{title:ie.i18n.translate("xpack.profiling.tabs.rpmEditConfigStep",{defaultMessage:"Edit the configuration (requires root privileges):"}),content:Object(l.jsx)(h.EuiCodeBlock,{paddingSize:"s",isCopyable:!0},`echo -e "project-id 1\nsecret-token ${g}\ncollection-agent ${m}" | sudo tee -a /etc/Elastic/universal-profiling/pf-host-agent.conf`)},{title:ie.i18n.translate("xpack.profiling.tabs.rpmStartSystemdServiceStep",{defaultMessage:"Start the Universal Profiling systemd service (requires root privileges):"}),content:Object(l.jsx)(h.EuiCodeBlock,{paddingSize:"s",isCopyable:!0},"sudo systemctl enable pf-host-agent && sudo systemctl restart pf-host-agent")}]},{key:vt.ElasticAgentIntegration,title:ie.i18n.translate("xpack.profiling.tabs.elasticAgentIntegration.title",{defaultMessage:"Elastic Agent Integration"}),steps:[{title:ie.i18n.translate("xpack.profiling.tabs.elasticAgentIntegration.step1",{defaultMessage:"Copy credentials"}),content:Object(l.jsx)(o.a.Fragment,null,Object(l.jsx)(h.EuiText,null,ie.i18n.translate("xpack.profiling.tabs.elasticAgentIntegration.step1.hint",{defaultMessage:"You'll need these credentials to set up Universal Profiling. Please save them in a secure location, as they will be required in the subsequent step."})),Object(l.jsx)(h.EuiSpacer,null),Object(l.jsx)(h.EuiText,{style:{fontWeight:"bold"},size:"s"},ie.i18n.translate("xpack.profiling.tabs.elasticAgentIntegration.step1.secretToken",{defaultMessage:"Secret token:"})),Object(l.jsx)(h.EuiCodeBlock,{paddingSize:"s",isCopyable:!0},g),Object(l.jsx)(h.EuiSpacer,{size:"s"}),Object(l.jsx)(h.EuiText,{style:{fontWeight:"bold"},size:"s"},ie.i18n.translate("xpack.profiling.tabs.elasticAgentIntegration.step1.collectionAgentUrl",{defaultMessage:"Universal Profiling Collector URL:"})),Object(l.jsx)(h.EuiCodeBlock,{paddingSize:"s",isCopyable:!0},m))},{title:ie.i18n.translate("xpack.profiling.tabs.elasticAgentIntegration.step2",{defaultMessage:"Fleet"}),content:Object(l.jsx)(h.EuiButton,{iconType:"gear",fill:!0,href:`${f.http.basePath.prepend(`/app/integrations/detail/profiler_agent-${null==p?void 0:p.profilerAgent.version}/overview`)}`},ie.i18n.translate("xpack.profiling.tabs.elasticAgentIntegration.step2.button",{defaultMessage:"Manage Universal Profiling agent in Fleet"}))}]},{key:vt.Symbols,title:ie.i18n.translate("xpack.profiling.tabs.symbols.title",{defaultMessage:"Upload Symbols"}),steps:[{title:ie.i18n.translate("xpack.profiling.tabs.symbols.step1",{defaultMessage:"Download and extract symbtool"}),content:Object(l.jsx)(h.EuiText,null,Object(l.jsx)("b",null,"For x86_64:"),Object(l.jsx)(h.EuiSpacer,{size:"s"}),Object(l.jsx)(h.EuiCodeBlock,{paddingSize:"s",isCopyable:!0},`wget -O symbtool-amd64.tgz "https://artifacts.elastic.co/downloads/prodfiler/symbtool-${x}-linux-x86_64.tar.gz" && tar xzf symbtool-amd64.tgz && cd symbtool-*-linux-x86_64`),Object(l.jsx)(h.EuiSpacer,{size:"m"}),Object(l.jsx)("b",null,"For ARM64:"),Object(l.jsx)(h.EuiSpacer,{size:"s"}),Object(l.jsx)(h.EuiCodeBlock,{paddingSize:"s",isCopyable:!0},`wget -O symbtool-arm64.tgz "https://artifacts.elastic.co/downloads/prodfiler/pf-host-agent-${x}-linux-arm64.tar.gz" && tar xzf symbtool-arm64.tgz && cd symbtool-*-linux-arm64`))},{title:ie.i18n.translate("xpack.profiling.tabs.symbols.step2",{defaultMessage:"Generate an Elasticsearch token"}),content:Object(l.jsx)(h.EuiText,null,Object(l.jsx)(h.EuiLink,{target:"_blank",href:"https://www.elastic.co/guide/en/kibana/master/api-keys.html"},ie.i18n.translate("xpack.profiling.tabs.symbols.step2.instructions",{defaultMessage:"Instructions here"})))},{title:ie.i18n.translate("xpack.profiling.tabs.symbols.step3",{defaultMessage:"Upload symbols"}),content:Object(l.jsx)("div",null,Object(l.jsx)(h.EuiCodeBlock,{paddingSize:"s",isCopyable:!0},`./symbtool push-symbols executable -u "${b}" -t -e `),Object(l.jsx)(h.EuiSpacer,{size:"m"}),Object(l.jsx)(h.EuiText,null,Object(l.jsx)(ae.FormattedMessage,{id:"xpack.profiling.tabs.symbols.step3.replace",defaultMessage:"Replace {es_token} etc. with the actual values. You can pass {help} to obtain a list of other arguments.",values:{es_token:Object(l.jsx)(h.EuiCode,null,""),help:Object(l.jsx)(h.EuiCode,null,"--help")}})),Object(l.jsx)(h.EuiSpacer,{size:"s"}),Object(l.jsx)(h.EuiText,null,Object(l.jsx)(ae.FormattedMessage,{id:"xpack.profiling.tabs.symbols.step3.doc-ref",defaultMessage:"Documentation for more advanced uses cases is available in {link}.",values:{link:Object(l.jsx)(h.EuiLink,{target:"_blank",href:`${f.docLinks.ELASTIC_WEBSITE_URL}/guide/en/observability/${f.docLinks.DOC_LINK_VERSION}/profiling-add-symbols.html`},ie.i18n.translate("xpack.profiling.tabs.symbols.step3.doc-ref.link",{defaultMessage:"the corresponding documentation page"}))}})))}]}],j=null!==(r=y.find((e=>e.key===a)).steps)&&void 0!==r?r:[],O=d===pe.Loading;return Object(l.jsx)(Be,{tabs:[],restrictWidth:!0,hideSearchBar:!0,pageTitle:Object(l.jsx)(h.EuiFlexGroup,{direction:"row",alignItems:"center"},Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiIcon,{type:"logoObservability",size:"m"})),Object(l.jsx)(h.EuiFlexItem,{grow:!1},ie.i18n.translate("xpack.profiling.noDataPage.pageTitle",{defaultMessage:"Add profiling data"})),O?Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(h.EuiLoadingSpinner,null)):null)},O?Object(l.jsx)(o.a.Fragment,null):Object(l.jsx)(o.a.Fragment,null,Object(l.jsx)(h.EuiCallOut,{color:"warning",iconType:"help",title:Object(l.jsx)(ae.FormattedMessage,{id:"xpack.profiling.tabs.debWarning",defaultMessage:"Due to a {linuxLink} which impacts stability, the profiling agent will refuse to run on kernel versions {versionFrom} to {versionTo}. Refer to {debianLink} and {fedoraLink} to learn more. If you are running such a kernel with a backported fix, please refer to {advancedLink} for instructions to override the precautionary measure.",values:{versionFrom:Object(l.jsx)("strong",null,"5.19"),versionTo:Object(l.jsx)("strong",null,"6.4"),linuxLink:Object(l.jsx)(h.EuiLink,{target:"_blank",href:"https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d319f344561de23e810515d109c7278919bff7b0"},ie.i18n.translate("xpack.profiling.tabs.debWarning.linuxLink",{defaultMessage:"Linux kernel bug"})),debianLink:Object(l.jsx)(h.EuiLink,{target:"_blank",href:"https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1033398"},ie.i18n.translate("xpack.profiling.tabs.debWarning.debianLink",{defaultMessage:"Debian"})),fedoraLink:Object(l.jsx)(h.EuiLink,{target:"_blank",href:"https://bugzilla.redhat.com/show_bug.cgi?id=2211455"},ie.i18n.translate("xpack.profiling.tabs.debWarning.fedoraLink",{defaultMessage:"Fedora/CentOS"})),advancedLink:Object(l.jsx)(h.EuiLink,{target:"_blank",href:`${f.docLinks.ELASTIC_WEBSITE_URL}/guide/en/observability/${f.docLinks.DOC_LINK_VERSION}/profiling-advanced-configuration.html`},ie.i18n.translate("xpack.profiling.tabs.debWarning.advancedLink",{defaultMessage:"Advanced configuration"}))}})}),Object(l.jsx)(h.EuiSpacer,null),Object(l.jsx)(h.EuiText,null,ie.i18n.translate("xpack.profiling.noDataPage.addDataTitle",{defaultMessage:"Select an option below to deploy the host-agent."})),Object(l.jsx)(h.EuiSpacer,null),Object(l.jsx)(h.EuiSplitPanel.Outer,null,Object(l.jsx)(h.EuiPanel,{hasBorder:!1,hasShadow:!1,grow:!1,paddingSize:"none"},Object(l.jsx)(h.EuiSplitPanel.Inner,{color:"subdued",paddingSize:"none"},Object(l.jsx)(h.EuiTabs,{style:{padding:"0 24px"}},y.map((e=>Object(l.jsx)(h.EuiTab,{key:e.key,onClick:()=>{s.push(u,{path:{},query:{selectedTab:e.key}})},isSelected:e.key===a},e.title))))),Object(l.jsx)(h.EuiSplitPanel.Inner,{style:{padding:"0 24px"}},Object(l.jsx)(h.EuiSpacer,{size:"xxl"}),Object(l.jsx)(h.EuiSteps,{steps:j.map((e=>({title:e.title,children:e.content,status:"incomplete"})))}))))))}),null),params:y.type({query:y.type({selectedTab:y.union([y.literal(vt.Binary),y.literal(vt.Deb),y.literal(vt.Docker),y.literal(vt.ElasticAgentIntegration),y.literal(vt.Kubernetes),y.literal(vt.RPM),y.literal(vt.Symbols)])})}),defaults:{query:{selectedTab:vt.Kubernetes}}},"/delete_data_instructions":{element:Object(l.jsx)((function(){const{start:{core:{docLinks:e}}}=le();return Object(l.jsx)(Be,{tabs:[],restrictWidth:!0,hideSearchBar:!0},Object(l.jsx)("div",{style:{display:"flex",flexGrow:1,justifyContent:"center",alignItems:"center"}},Object(l.jsx)(h.EuiCard,{style:{flexGrow:0,maxWidth:"500px"},icon:Object(l.jsx)(h.EuiIcon,{color:"danger",size:"xxl",type:"warning"}),title:"You have existing profiling data",description:"To proceed with the Universal Profiling setup, please delete existing profiling data following the steps described in the link below.",footer:Object(l.jsx)("div",null,Object(l.jsx)(h.EuiLink,{href:`${e.ELASTIC_WEBSITE_URL}/guide/en/observability/${e.DOC_LINK_VERSION}/profiling-upgrade.html#profiling-delete-data`,target:"_blank"},"Delete existing profiling data"))})))}),null)},"/":{children:{"/stacktraces/{topNType}":{element:Object(l.jsx)((function(){var e,t,n;const r=Fe(),i=Cn(),{path:a,query:o,path:{topNType:s},query:{rangeFrom:u,rangeTo:c,kuery:f,displayAs:p,limit:d}}=Ce("/stacktraces/{topNType}"),m=d||10,b=function({path:e,query:t,profilingRouter:n}){return[{label:ie.i18n.translate("xpack.profiling.stackTracesView.threadsTabLabel",{defaultMessage:"Threads"}),topNType:ve.Threads},{label:ie.i18n.translate("xpack.profiling.stackTracesView.tracesTabLabel",{defaultMessage:"Traces"}),topNType:ve.Traces},{label:ie.i18n.translate("xpack.profiling.stackTracesView.hostsTabLabel",{defaultMessage:"Hosts"}),topNType:ve.Hosts},{label:ie.i18n.translate("xpack.profiling.stackTracesView.deploymentsTabLabel",{defaultMessage:"Deployments"}),topNType:ve.Deployments},{label:ie.i18n.translate("xpack.profiling.stackTracesView.containersTabLabel",{defaultMessage:"Containers"}),topNType:ve.Containers}].map((r=>({label:r.label,isSelected:r.topNType===e.topNType,href:n.link("/stacktraces/{topNType}",{path:{topNType:r.topNType},query:t})})))}({path:a,query:o,profilingRouter:i}),{services:{fetchTopN:x}}=le(),v=It({rangeFrom:u,rangeTo:c}),y=Ct((({http:e})=>s?x({http:e,type:s,timeFrom:v.inSeconds.start,timeTo:v.inSeconds.end,kuery:f}).then((e=>{const t=e.TotalCount,n=function({samples:e,totalCount:t,metadata:n,labels:r}){const i=new Map;for(let t=0;te+(null!=t?t:0)),0);a.push({Category:e,Label:r[e]||e,Percentage:i/t*100,Series:s,Metadata:null!==(o=n[e])&&void 0!==o?o:[]})}const s=Object(h.euiPaletteColorBlind)({rotations:Math.ceil(a.length/10)});return Object(j.orderBy)(a,["Percentage","Category"],["desc","asc"]).map(((e,t)=>({...e,Color:Zt({category:e.Category,colors:s,subChartSize:a.length}),Index:t+1,Series:e.Series.map((t=>({...t,Category:e.Category})))})))}({samples:e.TopN,totalCount:t,metadata:e.Metadata,labels:e.Labels});return{charts:n}})):Promise.resolve({charts:[],metadata:{}})),[s,v.inSeconds.start,v.inSeconds.end,x,f]),{data:O}=y;return Object(l.jsx)(Be,{tabs:b},Object(l.jsx)(h.EuiFlexGroup,{direction:"column"},Object(l.jsx)(h.EuiFlexItem,{grow:!0},Object(l.jsx)(h.EuiPanel,null,Object(l.jsx)(h.EuiFlexGroup,{direction:"column",gutterSize:"m"},Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(h.EuiButtonGroup,{idSelected:p,type:"single",onChange:e=>{i.push(r,{path:a,query:{...o,displayAs:e}})},options:[{id:xe.StackTraces,iconType:"visLine",label:ie.i18n.translate("xpack.profiling.stackTracesView.stackTracesCountButton",{defaultMessage:"Stack traces"})},{id:xe.Percentage,iconType:"percent",label:ie.i18n.translate("xpack.profiling.stackTracesView.percentagesButton",{defaultMessage:"Percentages"})}],legend:ie.i18n.translate("xpack.profiling.stackTracesView.displayOptionLegend",{defaultMessage:"Display option"})})),Object(l.jsx)(h.EuiFlexItem,{style:{alignContent:"center"}},Object(l.jsx)(Ge,g()({size:"xl"},y,{style:{height:400}}),Object(l.jsx)(un,{height:400,charts:null!==(e=null==O?void 0:O.charts)&&void 0!==e?e:[],asPercentages:p===xe.Percentage,onBrushEnd:e=>{i.push(r,{path:a,query:{...o,rangeFrom:e.rangeFrom,rangeTo:e.rangeTo}})},showFrames:s===ve.Traces,onClick:s===ve.Threads?function(e){i.push("/stacktraces/{topNType}",nn({query:o,topNType:a.topNType,category:e}))}:void 0})))))),Object(l.jsx)(h.EuiFlexItem,{grow:!0},Object(l.jsx)(Ge,g()({size:"m",mono:!0},y,{style:{minHeight:200}}),Object(l.jsx)(on,{charts:null!==(t=null==O?void 0:O.charts)&&void 0!==t?t:[],limit:m,showFrames:s===ve.Traces}))),(null!==(n=null==O?void 0:O.charts.length)&&void 0!==n?n:0)>m&&Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(h.EuiButton,{onClick:()=>{i.push(r,{path:a,query:{...o,limit:m+10}})}},ie.i18n.translate("xpack.profiling.stackTracesView.showMoreButton",{defaultMessage:"Show more"})))))}),null),params:y.type({path:y.type({topNType:y.union([y.literal(ve.Containers),y.literal(ve.Deployments),y.literal(ve.Hosts),y.literal(ve.Threads),y.literal(ve.Traces)])}),query:y.type({displayAs:y.union([y.literal(xe.StackTraces),y.literal(xe.Percentage)]),limit:k})}),defaults:{query:{displayAs:xe.StackTraces,limit:"10"}}},"/stacktraces":{element:Object(l.jsx)(Ie,{pathname:"/stacktraces/threads"})},"/flamegraphs":{element:Object(l.jsx)(Tn,{title:ie.i18n.translate("xpack.profiling.breadcrumb.flamegraphs",{defaultMessage:"Flamegraphs"}),href:"/flamegraphs/flamegraph"},Object(l.jsx)((function({children:e}){const{query:t}=Ce("/flamegraphs/*"),n=Fe(),r=Cn();if("/flamegraphs"===n)return Object(l.jsx)(Ie,{pathname:"/flamegraphs/flamegraph"});const i="/flamegraphs/differential"===n,a=[{label:ie.i18n.translate("xpack.profiling.flameGraphsView.flameGraphTabLabel",{defaultMessage:"Flamegraph"}),isSelected:!i,href:r.link("/flamegraphs/flamegraph",{query:t})},{label:ie.i18n.translate("xpack.profiling.flameGraphsView.differentialFlameGraphTabLabel",{defaultMessage:"Differential flamegraph"}),isSelected:i,href:r.link("/flamegraphs/differential",{query:{...t,comparisonRangeFrom:t.rangeFrom,comparisonRangeTo:t.rangeTo,comparisonKuery:t.kuery}})}];return Object(l.jsx)(Be,{tabs:a,hideSearchBar:i},e)}),null,Object(l.jsx)(q,null))),children:{"/flamegraphs/flamegraph":{element:Object(l.jsx)(Tn,{title:ie.i18n.translate("xpack.profiling.breadcrumb.flamegraph",{defaultMessage:"Flamegraph"}),href:"/flamegraphs/flamegraph"},Object(l.jsx)((function(){const{query:e,query:{rangeFrom:t,rangeTo:n,kuery:r,searchText:i}}=Ce("/flamegraphs/flamegraph"),o=It({rangeFrom:t,rangeTo:n}),{services:{fetchElasticFlamechart:s}}=le(),u=Ct((({http:e})=>s({http:e,timeFrom:o.inSeconds.start,timeTo:o.inSeconds.end,kuery:r})),[o.inSeconds.start,o.inSeconds.end,r,s]),{data:c}=u,f=Fe(),p=Cn(),[d,m]=Object(a.useState)(!1);return Object(l.jsx)(h.EuiFlexGroup,{direction:"column"},Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(Ge,g()({},u,{style:{height:"100%"},size:"xl"}),Object(l.jsx)(wt,{id:"flamechart",primaryFlamegraph:c,showInformationWindow:d,toggleShowInformationWindow:function(){m((e=>!e))},searchText:i,onChangeSearchText:function(t){p.push(f,{query:{...e,searchText:t}})}}))))}),null)),params:y.type({query:y.partial({searchText:y.string})})},"/flamegraphs/differential":{element:Object(l.jsx)(Tn,{title:ie.i18n.translate("xpack.profiling.breadcrumb.differentialFlamegraph",{defaultMessage:"Differential flamegraph"}),href:"/flamegraphs/differential"},Object(l.jsx)((function(){const{query:e,query:{rangeFrom:t,rangeTo:n,kuery:r,comparisonRangeFrom:i,comparisonRangeTo:o,comparisonKuery:s,comparisonMode:u,baseline:c=1,comparison:f=1,normalizationMode:p,searchText:d}}=Ce("/flamegraphs/differential"),m=Fe(),b=Cn(),[x,v]=Object(a.useState)(!1),y=It({rangeFrom:t,rangeTo:n}),j=It({rangeFrom:i,rangeTo:o,optional:!0}),{services:{fetchElasticFlamechart:O}}=le(),E=Ct((({http:e})=>Promise.all([O({http:e,timeFrom:y.inSeconds.start,timeTo:y.inSeconds.end,kuery:r}),j.inSeconds.start&&j.inSeconds.end?O({http:e,timeFrom:j.inSeconds.start,timeTo:j.inSeconds.end,kuery:s}):Promise.resolve(void 0)]).then((([e,t])=>({primaryFlamegraph:e,comparisonFlamegraph:t})))),[y.inSeconds.start,y.inSeconds.end,r,j.inSeconds.start,j.inSeconds.end,s,O]),S=(y.inSeconds.end-y.inSeconds.start)/((new Date(j.end).getTime()-new Date(j.start).getTime())/1e3),w={baselineScale:c,baselineTime:1,comparisonScale:f,comparisonTime:S},{data:M}=E,T=p===Ee.Time;return Object(l.jsx)(h.EuiFlexGroup,{direction:"column"},Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiPanel,{hasShadow:!1,color:"subdued"},Object(l.jsx)(Nt,{comparisonMode:u,normalizationMode:p,normalizationOptions:w}))),Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(Ge,g()({},E,{style:{height:"100%"},size:"xl"}),Object(l.jsx)(wt,{id:"flamechart",primaryFlamegraph:null==M?void 0:M.primaryFlamegraph,comparisonFlamegraph:null==M?void 0:M.comparisonFlamegraph,comparisonMode:u,baseline:T?1:c,comparison:T?S:f,showInformationWindow:x,toggleShowInformationWindow:function(){v((e=>!e))},searchText:d,onChangeSearchText:function(t){b.push(m,{query:{...e,searchText:t}})}}))))}),null)),params:y.type({query:y.intersection([y.type({comparisonRangeFrom:y.string,comparisonRangeTo:y.string,comparisonKuery:y.string,comparisonMode:y.union([y.literal(Oe.Absolute),y.literal(Oe.Relative)]),normalizationMode:y.union([y.literal(Ee.Scale),y.literal(Ee.Time)])}),y.partial({baseline:k,comparison:k,searchText:y.string})])}),defaults:{query:{comparisonRangeFrom:"now-15m",comparisonRangeTo:"now",comparisonKuery:"",comparisonMode:Oe.Absolute,normalizationMode:Ee.Time}}}}},"/functions":{element:Object(l.jsx)(Tn,{title:ie.i18n.translate("xpack.profiling.breadcrumb.functions",{defaultMessage:"Functions"}),href:"/functions/topn"},Object(l.jsx)((function({children:e}){const{query:t}=Ce("/functions/*"),n=Fe(),r=Cn();if("/functions"===n)return Object(l.jsx)(Ie,{pathname:"/functions/topn"});const i="/functions/differential"===n,a=[{label:ie.i18n.translate("xpack.profiling.functionsView.functionsTabLabel",{defaultMessage:"TopN functions"}),isSelected:!i,href:r.link("/functions/topn",{query:t})},{label:ie.i18n.translate("xpack.profiling.functionsView.differentialFunctionsTabLabel",{defaultMessage:"Differential TopN functions"}),isSelected:i,href:r.link("/functions/differential",{query:{...t,comparisonRangeFrom:t.rangeFrom,comparisonRangeTo:t.rangeTo,comparisonKuery:t.kuery,normalizationMode:"normalizationMode"in t?t.normalizationMode:Ee.Time}})}];return Object(l.jsx)(Be,{tabs:a,hideSearchBar:i},e)}),null,Object(l.jsx)(q,null))),params:y.type({query:y.type({sortField:me,sortDirection:y.union([y.literal("asc"),y.literal("desc")])})}),defaults:{query:{sortField:ge.Rank,sortDirection:"asc"}},children:{"/functions/topn":{element:Object(l.jsx)(Tn,{title:ie.i18n.translate("xpack.profiling.breadcrumb.topnFunctions",{defaultMessage:"Top N"}),href:"/functions/topn"},Object(l.jsx)((function(){const{query:e}=Ce("/functions/topn"),{rangeFrom:t,rangeTo:n,kuery:r,sortDirection:i,sortField:a,pageIndex:s=0}=e,u=It({rangeFrom:t,rangeTo:n}),{services:{fetchTopNFunctions:c}}=le(),f=Ct((({http:e})=>c({http:e,timeFrom:u.inSeconds.start,timeTo:u.inSeconds.end,startIndex:0,endIndex:1e5,kuery:r})),[u.inSeconds.start,u.inSeconds.end,r,c]),p=Cn();return Object(l.jsx)(o.a.Fragment,null,Object(l.jsx)(h.EuiFlexGroup,{direction:"column"},Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(h.EuiFlexGroup,{direction:"column",gutterSize:"s"},Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(Ge,g()({},f,{size:"xl",alignTop:!0}),Object(l.jsx)(Gt,{topNFunctions:f.data,totalSeconds:u.inSeconds.end-u.inSeconds.start,isDifferentialView:!1,onFrameClick:function(t){p.push("/flamegraphs/flamegraph",{path:{},query:{...e,searchText:t}})},pageIndex:s,onChangePage:function(t){p.push("/functions/topn",{path:{},query:{...e,pageIndex:t}})},sortField:a,sortDirection:i,onChangeSort:function(t){p.push("/functions/topn",{path:{},query:{...e,sortField:t.id,sortDirection:t.direction}})}})))))))}),null)),params:y.type({query:y.partial({pageIndex:k})})},"/functions/differential":{element:Object(l.jsx)(Tn,{title:ie.i18n.translate("xpack.profiling.breadcrumb.differentialFunctions",{defaultMessage:"Differential Top N"}),href:"/functions/differential"},Object(l.jsx)((function(){const e=Object(a.useRef)(null),t=Object(a.useRef)(null),{query:n}=Ce("/functions/differential"),{rangeFrom:r,rangeTo:i,kuery:s,sortDirection:u,sortField:c,comparisonKuery:f,normalizationMode:p,comparisonRangeFrom:d,comparisonRangeTo:m,baseline:b=1,comparison:x=1,pageIndex:v=0}=n,y=It({rangeFrom:r,rangeTo:i}),j=It({rangeFrom:d,rangeTo:m,optional:!0}),O=y.inSeconds.end-y.inSeconds.start,E=(new Date(j.end).getTime()-new Date(j.start).getTime())/1e3,S=O/E,w={baselineScale:b,baselineTime:1,comparisonScale:x,comparisonTime:S},{services:{fetchTopNFunctions:M}}=le(),T=Ct((({http:e})=>M({http:e,timeFrom:y.inSeconds.start,timeTo:y.inSeconds.end,startIndex:0,endIndex:1e5,kuery:s})),[y.inSeconds.start,y.inSeconds.end,s,M]),k=Ct((({http:e})=>{if(j.inSeconds.start&&j.inSeconds.end)return M({http:e,timeFrom:j.inSeconds.start,timeTo:j.inSeconds.end,startIndex:0,endIndex:1e5,kuery:f})}),[j.inSeconds.start,j.inSeconds.end,f,M]),I=Fe(),C=Cn(),F=p===Ee.Time;function _(e){C.push("/flamegraphs/flamegraph",{path:{},query:{...n,searchText:e}})}function N(e){C.push("/functions/differential",{path:{},query:{...n,pageIndex:e}})}function L(e){C.push("/functions/differential",{path:{},query:{...n,sortField:e.id,sortDirection:e.direction}})}return Object(l.jsx)(o.a.Fragment,null,Object(l.jsx)(h.EuiFlexGroup,{direction:"column"},Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiPanel,{hasShadow:!1,color:"subdued"},Object(l.jsx)(Ft,null),Object(l.jsx)(h.EuiHorizontalRule,null),Object(l.jsx)(ke,{mode:p,options:w,onChange:function(e,t){C.push(I,{path:I,query:e===Ee.Scale?{...n,baseline:t.baselineScale,comparison:t.comparisonScale,normalizationMode:e}:{...n,normalizationMode:e}})}}),Object(l.jsx)(h.EuiSpacer,null),Object(l.jsx)(Xt,{baselineTopNFunctions:T.data,comparisonTopNFunctions:k.data,baselineScaleFactor:F?1:b,comparisonScaleFactor:F?S:x,isLoading:T.status===pe.Loading||k.status===pe.Loading,baselineDuration:O,comparisonDuration:E}))),Object(l.jsx)(h.EuiFlexItem,{grow:!1}),Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(h.EuiFlexGroup,{direction:"row",gutterSize:"s"},Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(Ge,g()({},T,{size:"xl",alignTop:!0}),Object(l.jsx)(Gt,{ref:e,topNFunctions:T.data,totalSeconds:y.inSeconds.end-y.inSeconds.start,isDifferentialView:!0,onFrameClick:_,baselineScaleFactor:F?1:b,onScroll:function(e){var n;null!=t&&null!==(n=t.current)&&void 0!==n&&n.scrollTo&&t.current.scrollTo({scrollTop:e.scrollTop})},pageIndex:v,onChangePage:N,sortField:c,sortDirection:u,onChangeSort:L}))),j.inSeconds.start&&j.inSeconds.end?Object(l.jsx)(h.EuiFlexItem,null,Object(l.jsx)(Ge,g()({},k,{size:"xl",alignTop:!0}),Object(l.jsx)(Gt,{ref:t,topNFunctions:k.data,baselineScaleFactor:F?S:x,comparisonTopNFunctions:T.data,comparisonScaleFactor:F?1:b,totalSeconds:O,isDifferentialView:!0,onFrameClick:_,onScroll:function(t){var n;null!=e&&null!==(n=e.current)&&void 0!==n&&n.scrollTo&&e.current.scrollTo({scrollTop:t.scrollTop})},showDiffColumn:!0,pageIndex:v,onChangePage:N,sortField:c,sortDirection:u,onChangeSort:L,dataTestSubj:"TopNFunctionsComparisonGrid"}))):null))))}),null)),params:y.type({query:y.intersection([y.type({comparisonRangeFrom:y.string,comparisonRangeTo:y.string,comparisonKuery:y.string,normalizationMode:y.union([y.literal(Ee.Scale),y.literal(Ee.Time)])}),y.partial({baseline:k,comparison:k,pageIndex:k})])}),defaults:{query:{comparisonRangeFrom:"now-15m",comparisonRangeTo:"now",comparisonKuery:"",normalizationMode:Ee.Time}}}}},"/storage-explorer":{element:Object(l.jsx)(Tn,{title:ie.i18n.translate("xpack.profiling.breadcrumb.storageExplorer",{defaultMessage:"Storage explorer"}),href:"/storage-explorer"},Object(l.jsx)((function(){var e;const{query:t}=Ce("/storage-explorer"),{rangeFrom:n,rangeTo:r,kuery:i,indexLifecyclePhase:o}=t,s=It({rangeFrom:n,rangeTo:r}),[u,c]=Object(a.useState)("host_breakdown"),{services:{fetchStorageExplorerSummary:f}}=le(),p=Ct((({http:e})=>f({http:e,timeFrom:s.inSeconds.start,timeTo:s.inSeconds.end,kuery:i,indexLifecyclePhase:o})),[f,s.inSeconds.start,s.inSeconds.end,i,o]),d=(null===(e=p.data)||void 0===e?void 0:e.totalNumberOfDistinctProbabilisticValues)||0,g=d>1;return Object(l.jsx)(Be,{hideSearchBar:!0,pageTitle:ie.i18n.translate("xpack.profiling.storageExplorer.title",{defaultMessage:"Storage Explorer"}),showBetaBadge:!0},Object(l.jsx)(h.EuiFlexGroup,{direction:"column"},Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiPanel,{hasShadow:!1,color:"subdued"},Object(l.jsx)(Pe,null),Object(l.jsx)(h.EuiHorizontalRule,null),Object(l.jsx)("div",{style:{display:"flex",justifyContent:"flex-end"}},Object(l.jsx)(En,null)))),g&&Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(xn,{totalNumberOfDistinctProbabilisticValues:d})),Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(Sn,{data:p.data,isLoading:p.status===pe.Loading})),Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiTabs,null,Object(l.jsx)(h.EuiTab,{onClick:()=>{c("host_breakdown")},isSelected:"host_breakdown"===u},ie.i18n.translate("xpack.profiling.storageExplorer.tabs.hostBreakdown",{defaultMessage:"Host agent breakdown"})),Object(l.jsx)(h.EuiTab,{onClick:()=>{c("data_breakdown")},isSelected:"data_breakdown"===u},ie.i18n.translate("xpack.profiling.storageExplorer.tabs.dataBreakdown",{defaultMessage:"Data breakdown"})))),"host_breakdown"===u?Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(On,{hasDistinctProbabilisticValues:g})):null,"data_breakdown"===u?Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(bn,null)):null))}),null)),params:y.type({query:je}),defaults:{query:{indexLifecyclePhase:ye.All}}},"/":{element:Object(l.jsx)(Ie,{pathname:"/stacktraces/threads"})}},element:Object(l.jsx)(q,null),params:y.type({query:y.type({rangeFrom:y.string,rangeTo:y.string,kuery:y.string})}),defaults:{query:{kuery:""}}}}}},In=function(e){const t=new Map,n=new Map,r=Object.entries(e).map((([e,t])=>i({...t,path:e})));function i(e){var r,a,o;const s={component:()=>e.element,routes:null!==(r=null===(a=Object.entries(null!==(o=e.children)&&void 0!==o?o:{}))||void 0===a?void 0:a.map((([e,t])=>i({...t,path:e}))))&&void 0!==r?r:[],exact:!e.children||0===Object.values(e.children).length,path:P(e.path)};return t.set(s,e),n.set(e,s),s}function a(e){const n=Object(z.matchRoutes)(r,P(e));if(!n.length)throw new Error(`No matching route found for ${e}`);return n.map((e=>t.get(e.route)))}const o=(...e)=>{let n=!1;"boolean"==typeof e[e.length-1]&&(n=e[e.length-1],e.pop());const i=e[e.length-1];e.pop();let a=e;0===a.length&&(a=[i.pathname||"/"]);let o=[],s=-1;const u=a.map((t=>{const n=t.endsWith("/*")||0===e.length?1:0;return{length:t.length,greedy:n,path:t}})),l=Object(j.orderBy)(u,["greedy","length"],["desc","desc"]);for(const{path:e,greedy:t}of l){if(o=Object(z.matchRoutes)(r,P(i.pathname)),s=t?o.length-1:Object(j.findLastIndex)(o,(t=>t.route.path===P(e))),-1!==s)break;s=-1}if(-1===s){if(n)return[];let e;throw e=1===a.length?`${a[0]} does not match current path ${i.pathname}`:`None of ${a.join(", ")} match current path ${i.pathname}`,new Error(e)}if(!o.some((e=>e.match.isExact)))throw new NotFoundRouteException("No route was matched");return o.slice(0,s+1).map((e=>{const n=t.get(e.route);if(null!=n&&n.params){var r;const t=M(n.params).decode(Object(j.merge)({},null!==(r=n.defaults)&&void 0!==r?r:{},{path:e.match.params,query:A.a.parse(i.search,{decode:!0})}));if(Object(O.isLeft)(t))throw new Error(L.PathReporter.report(t).join("\n"));return{match:{...e.match,params:t.right},route:n}}return{match:{...e.match,params:{path:{},query:{}}},route:n}}))};return{link:(e,...t)=>((e,...t)=>{const n=t[0],r=Object(j.merge)({path:{},query:{}},n),i=a(e=e.split("/").map((e=>{const t=e.match(/(?:{([a-zA-Z]+)})/);return t?r.path[t[1]]:e})).join("/")),o=E(...Object(j.compact)(i.map((e=>e.params)))),s=Object(j.merge)({},...i.map((e=>{var t;return null!==(t=e.defaults)&&void 0!==t?t:{}})),r),u=o.decode(s);if(Object(O.isLeft)(u))throw new Error(L.PathReporter.report(u).join("\n"));return A.a.stringifyUrl({url:e,query:s.query},{encode:!0})})(e,...t),getParams:(...e)=>{const t=o(...e);return t.length?Object(j.merge)({path:{},query:{}},...t.map((e=>{var t,n;return Object(j.merge)({},null!==(t=null===(n=e.route)||void 0===n?void 0:n.defaults)&&void 0!==t?t:{},e.match.params)}))):void 0},matchRoutes:(...e)=>o(...e),getRoutePath:e=>e.path,getRoutesToMatch:e=>a(e)}}(kn);function Cn(){const e=Object(G.useHistory)(),{start:{core:t}}=le(),n=(...e)=>In.link(...e);return{...In,push:(...t)=>{const r=n(...t);e.push(r)},replace:(t,...r)=>{const i=n(t,...r);e.replace(i)},link:(e,...r)=>t.http.basePath.prepend("/app/profiling"+n(e,...r))}}var Fn=n(46),_n=n.n(Fn);const Nn="/app/management/stack/license_management";function Ln(){const{core:e}=le().start,t=_n.a.format({pathname:e.http.basePath.prepend(Nn)});return Object(l.jsx)(h.EuiEmptyPrompt,{iconType:"logoObservability",iconColor:"warning",title:Object(l.jsx)("h1",null,ie.i18n.translate("xpack.profiling.invalidLicense.message",{defaultMessage:"To access Universal Profiling, upgrade to an Enterprise subscription"})),body:Object(l.jsx)("p",null,ie.i18n.translate("xpack.profiling.invalidLicense.description",{defaultMessage:"You must have an Enterprise subscription to use Universal Profiling features."})),actions:[Object(l.jsx)(h.EuiButton,{href:t,fill:!0},ie.i18n.translate("xpack.profiling.invalidLicense.subscriptionManagementLink",{defaultMessage:"Upgrade subscription"}))]})}const Rn=o.a.createContext(void 0);function An({children:e}){const{license$:t}=le().setup.licensing,n=u()(t);return!1===(null==n?void 0:n.isActive)?Object(l.jsx)(Be,{hideSearchBar:!0,tabs:[]},Object(l.jsx)(Ln,null)):Object(l.jsx)(Rn.Provider,{value:n,children:e})}function zn({children:e}){const{start:{core:t},services:{fetchHasSetup:n,postSetupResources:r}}=le(),{setProfilingSetupStatus:i}=qe(),s=Object(a.useContext)(Rn),u=Cn(),c=Object(G.useHistory)(),{docLinks:f,notifications:p}=t,[d,g]=Object(a.useState)(!1),{status:m,data:b,error:x,refresh:v}=he((({http:e})=>n({http:e})),[n]);m===pe.Settled&&i(b);const y=fe([]);if(null==s||!s.hasAtLeast("enterprise"))return Object(l.jsx)(Be,{hideSearchBar:!0,tabs:[]},Object(l.jsx)(Ln,null));if(m!==pe.Settled)return Object(l.jsx)(Be,{hideSearchBar:!0,tabs:[]},Object(l.jsx)(h.EuiFlexGroup,{alignItems:"center",justifyContent:"center"},Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiLoadingSpinner,{size:"xxl"})),Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiText,null,ie.i18n.translate("xpack.profiling.noDataConfig.loading.loaderText",{defaultMessage:"Loading data sources"})))));if(m===pe.Settled&&!0!==(null==b?void 0:b.has_setup)&&!1===(null==b?void 0:b.pre_8_9_1_data)||x)return Object(l.jsx)(Be,{tabs:[],noDataConfig:{docsLink:`${f.ELASTIC_WEBSITE_URL}/guide/en/observability/${f.DOC_LINK_VERSION}/profiling-get-started.html`,logo:"logoObservability",pageTitle:ie.i18n.translate("xpack.profiling.noDataConfig.pageTitle",{defaultMessage:"Universal Profiling"}),action:{elasticAgent:{description:Object(l.jsx)(h.EuiFlexGrid,{gutterSize:"s"},Object(l.jsx)(h.EuiText,null,ie.i18n.translate("xpack.profiling.noDataConfig.action.title",{defaultMessage:"Universal Profiling provides fleet-wide, whole-system, continuous profiling with zero instrumentation.\n Understand what lines of code are consuming compute resources, at all times, and across your entire infrastructure."})),Object(l.jsx)(h.EuiCallOut,{size:"s",color:"warning",title:ie.i18n.translate("xpack.profiling.noDataConfig.action.permissionsWarning",{defaultMessage:"To setup Universal Profiling, you must be logged in as a superuser."})}),Object(l.jsx)(h.EuiText,{size:"xs"},Object(l.jsx)("ul",null,Object(l.jsx)("li",null,Object(l.jsx)(ae.FormattedMessage,{id:"xpack.profiling.noDataConfig.action.dataRetention",defaultMessage:"Normal data storage costs apply for profiling data stored in Elasticsearch. Learn more about {dataRetentionLink}.",values:{dataRetentionLink:Object(l.jsx)(h.EuiLink,{href:`${f.ELASTIC_WEBSITE_URL}/guide/en/elasticsearch/reference/${f.DOC_LINK_VERSION}/set-up-lifecycle-policy.html`,target:"_blank"},ie.i18n.translate("xpack.profiling.noDataConfig.action.dataRetention.link",{defaultMessage:"controlling data retention"}))}})))),Object(l.jsx)(h.EuiText,{size:"xs"})),onClick:e=>{e.preventDefault()},button:Object(l.jsx)(h.EuiButton,{disabled:d,onClick:e=>{e.preventDefault(),g(!0),r({http:y}).then((()=>v())).catch((e=>{var t,n,r;const i=null!==(t=null!==(n=null==e||null===(r=e.body)||void 0===r?void 0:r.message)&&void 0!==n?n:e.message)&&void 0!==t?t:String(e);p.toasts.addError(e,{title:ie.i18n.translate("xpack.profiling.checkSetup.setupFailureToastTitle",{defaultMessage:"Failed to complete setup"}),toastMessage:i})})).finally((()=>{g(!1)}))},fill:!0,isLoading:d},d?ie.i18n.translate("xpack.profiling.noDataConfig.action.buttonLoadingLabel",{defaultMessage:"Setting up Universal Profiling..."}):ie.i18n.translate("xpack.profiling.noDataConfig.action.buttonLabel",{defaultMessage:"Set up Universal Profiling"}))}},solution:ie.i18n.translate("xpack.profiling.noDataConfig.solutionName",{defaultMessage:"Universal Profiling"})},hideSearchBar:!0},Object(l.jsx)(o.a.Fragment,null));if(!0===(null==b?void 0:b.has_data)&&!1===(null==b?void 0:b.pre_8_9_1_data)||"/add-data-instructions"===c.location.pathname||"/delete_data_instructions"===c.location.pathname)return e;if(!0===(null==b?void 0:b.pre_8_9_1_data))return u.push("/delete_data_instructions",{path:{},query:{}}),null;if(m===pe.Settled&&!0===(null==b?void 0:b.has_setup)&&!1===(null==b?void 0:b.has_data))return u.push("/add-data-instructions",{path:{},query:{selectedTab:vt.Kubernetes}}),null;throw new Error("Invalid state")}function Pn({children:e}){const{redirect:t,isDateRangeSet:n,skipDataRangeSet:r}=function(){const e=Object(G.useHistory)(),t=Object(G.useLocation)(),n=A.a.parse(t.search),{start:{core:r,data:i}}=le(),a=r.uiSettings.get(Jt.UI_SETTINGS.TIMEPICKER_TIME_DEFAULTS),o=i.query.timefilter.timefilter.getTime();return{isDateRangeSet:"rangeFrom"in n&&"rangeTo"in n,redirect:()=>{var r,i;const s={rangeFrom:null!==(r=o.from)&&void 0!==r?r:a.from,rangeTo:null!==(i=o.to)&&void 0!==i?i:a.to,...n};e.replace({...t,search:A.a.stringify(s)})},skipDataRangeSet:"/add-data-instructions"===e.location.pathname}}();return n||r?e:(t(),null)}function Dn(){const e=Cn(),t=Object(G.useHistory)();return Object(l.jsx)(h.EuiHeaderLinks,{gutterSize:"xs"},Object(l.jsx)(h.EuiToolTip,{content:ie.i18n.translate("xpack.profiling.header.storageExplorerLink.tooltip",{defaultMessage:"This module is not GA. Please help us by reporting any bugs."})},Object(l.jsx)(h.EuiHeaderLink,{color:"text",onClick:()=>{const e=A.a.parse(window.location.search),n=_n.a.format({pathname:"/storage-explorer",query:{kuery:e.kuery,rangeFrom:e.rangeFrom||"now-15m",rangeTo:e.rangeTo||"now"}});t.push(n)}},Object(l.jsx)(h.EuiFlexGroup,{direction:"row",gutterSize:"s",alignItems:"center"},Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiIcon,{type:"beta"})),Object(l.jsx)(h.EuiFlexItem,{grow:!1},ie.i18n.translate("xpack.profiling.headerActionMenu.storageExplorer",{defaultMessage:"Storage Explorer"}))))),Object(l.jsx)(h.EuiHeaderLink,{href:e.link("/add-data-instructions",{query:{selectedTab:vt.Kubernetes}}),color:"primary"},Object(l.jsx)(h.EuiFlexGroup,{direction:"row",gutterSize:"s",alignItems:"center"},Object(l.jsx)(h.EuiFlexItem,{grow:!1},Object(l.jsx)(h.EuiIcon,{type:"indexOpen"})),Object(l.jsx)(h.EuiFlexItem,{grow:!1},ie.i18n.translate("xpack.profiling.headerActionMenu.addData",{defaultMessage:"Add Data"})))),Object(l.jsx)(re.ObservabilityAIAssistantActionMenuItem,null))}var Un=n(1),qn=n.n(Un);const $n=ie.i18n.translate("sharedUXPackages.prompt.errors.notFound.title",{defaultMessage:"Page not found"}),Bn=ie.i18n.translate("sharedUXPackages.prompt.errors.notFound.body",{defaultMessage:"Sorry, the page you're looking for can't be found. It might have been removed or renamed, or maybe it never existed at all."}),Gn=ie.i18n.translate("sharedUXPackages.prompt.errors.notFound.goBacklabel",{defaultMessage:"Go back"}),Vn=({actions:e,title:t,body:r})=>{const{colorMode:i}=Object(h.useEuiTheme)(),[o,s]=Object(a.useState)(),u=Object(a.useCallback)((()=>history.back()),[]),c=Object(a.useMemo)((()=>[Object(l.jsx)(h.EuiButtonEmpty,{iconType:"arrowLeft",flush:"both",onClick:u},Gn)]),[u]);Object(a.useEffect)((()=>{(async()=>{if("DARK"===i){const{default:e}=await n.e(2).then(n.t.bind(null,70,7));s(e)}else{const{default:e}=await n.e(3).then(n.t.bind(null,71,7));s(e)}})()}),[i]);const f=o?Object(l.jsx)(h.EuiImage,{src:o,alt:""}):null;return Object(l.jsx)(h.EuiEmptyPrompt,{color:"subdued",titleSize:"m",icon:f,title:"string"!=typeof t&&t?t:Object(l.jsx)("h2",null,null!=t?t:$n),body:null!=r?r:Bn,actions:null!=e?e:c})};function Wn({children:e}){const t=Object(G.useLocation)();return Object(l.jsx)(router_error_boundary_ErrorBoundary,{key:t.pathname},e)}class router_error_boundary_ErrorBoundary extends o.a.Component{constructor(...e){super(...e),qn()(this,"state",{error:void 0})}static getDerivedStateFromError(e){return{error:e}}render(){return this.state.error?Object(l.jsx)(Yn,{error:this.state.error}):this.props.children}}const Hn={pageTitle:ie.i18n.translate("xpack.profiling.universalProfiling",{defaultMessage:"Universal Profiling"})};function Yn({error:e}){const{services:t}=Object(r.useKibana)(),{observabilityShared:n}=t,i=n.navigation.PageTemplate;return e instanceof NotFoundRouteException?Object(l.jsx)(i,{pageHeader:Hn},Object(l.jsx)(Vn,null)):Object(l.jsx)(i,{pageHeader:Hn},Object(l.jsx)(h.EuiErrorBoundary,null,Object(l.jsx)(Xn,{error:e})))}function Xn({error:e}){throw e}const Kn=new i.Storage(localStorage);function Zn({theme$:e,setHeaderActionMenu:t}){return Object(l.jsx)(ne.HeaderMenuPortal,{setHeaderActionMenu:t,theme$:e},Object(l.jsx)(Dn,null))}function Jn({coreStart:e,coreSetup:t,pluginsStart:n,pluginsSetup:i,profilingFetchServices:s,theme$:u,history:c,setHeaderActionMenu:f}){const p=e.i18n,h=Object(a.useMemo)((()=>({start:{core:e,...n},setup:{core:t,...i},services:s})),[e,t,n,i,s]);return Object(l.jsx)(r.KibanaThemeProvider,{theme$:u},Object(l.jsx)(r.KibanaContextProvider,{services:{...e,...n,storage:Kn}},Object(l.jsx)(p.Context,null,Object(l.jsx)(re.ObservabilityAIAssistantProvider,{value:n.observabilityAIAssistant},Object(l.jsx)(v,{coreStart:e,currentAppId:"profiling"},Object(l.jsx)(J,{router:In,history:c},Object(l.jsx)(Wn,null,Object(l.jsx)(Ne,null,Object(l.jsx)(ue,{value:h},Object(l.jsx)(Ue,null,Object(l.jsx)(An,null,Object(l.jsx)(o.a.Fragment,null,Object(l.jsx)(zn,null,Object(l.jsx)(Pn,null,Object(l.jsx)(Mn,null,Object(l.jsx)(X,null)))),Object(l.jsx)(Zn,{setHeaderActionMenu:f,theme$:u})))))))))))))}const Qn=(e,t)=>(te.a.render(Object(l.jsx)(Jn,e),t),()=>te.a.unmountComponentAtNode(t))}])]);