clockworklabs_spacetimedb/d3-flamegraph-base.html
Mazdak Farrokhzad 7138defc6e
Make all VmMetrics for the reducers and views of a module in InstanceCommon::new (#4106)
# Description of Changes

With this PR, all `VmMetrics` for all the reducers and views of a module
are made in `InstanceCommon::new`
so that they are never made in `call_{reducer/view}_with_tx`.

Here's a flamegraph before this PR, zooming in on the smaller
`call_reducer_with_tx`

<img width="1877" height="617" alt="image"
src="https://github.com/user-attachments/assets/9751c066-2bf0-4ded-a091-afa7d3b5dd75"
/>

And after, for the same `call_reducer_with_tx`:

<img width="1883" height="610" alt="image"
src="https://github.com/user-attachments/assets/27083acd-d4c9-4b69-94c7-c26c7f1e7cef"
/>

Here are the performance numbers:
```
wasm, index=hash, branch=master, commit = af4d3f39e485435426b7f9182885175e57aafe44
ran for 10.097515999 seconds
completed 1310720
throughput was 129806.18204812016 TPS

wasm, index=hash, branch=master, commit = bac3d2a5a928af896d315fcfdf709d42e3577b66
ran for 10.842949063 seconds
completed 1474560
throughput was 135992.52301495385 TPS
```

As you can see, this is a gain of about 6k TPS on the phoenix_nap
machine.

The second commit also adds the `d3-flamegraph-base.html` and stuff to
`.gitignore` to facilitate taking flamegraphs.

# API and ABI breaking changes

None

# Expected complexity level and risk

1, trivial changes that are not load bearing.
2026-01-26 10:18:08 +00:00

31 lines
65 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Flame Graph</title>
<meta name="template_version" content="4.1.3"><script>(()=>{"use strict";var t={591:(t,n,e)=>{e.d(n,{Z:()=>u});var r=e(558),i=e.n(r),o=e(361),a=e.n(o)()(i());a.push([t.id,".d3-flame-graph rect {\n stroke: #EEEEEE;\n fill-opacity: .8;\n}\n\n.d3-flame-graph rect:hover {\n stroke: #474747;\n stroke-width: 0.5;\n cursor: pointer;\n}\n\n.d3-flame-graph-label {\n pointer-events: none;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n font-size: 12px;\n font-family: Verdana;\n margin-left: 4px;\n margin-right: 4px;\n line-height: 1.5;\n padding: 0 0 0;\n font-weight: 400;\n color: black;\n text-align: left;\n}\n\n.d3-flame-graph .fade {\n opacity: 0.6 !important;\n}\n\n.d3-flame-graph .title {\n font-size: 20px;\n font-family: Verdana;\n}\n\n.d3-flame-graph-tip {\n background-color: black;\n border: none;\n border-radius: 3px;\n padding: 5px 10px 5px 10px;\n min-width: 250px;\n text-align: left;\n color: white;\n z-index: 10;\n}",""]);const u=a},891:(t,n,e)=>{e.d(n,{Z:()=>u});var r=e(558),i=e.n(r),o=e(361),a=e.n(o)()(i());a.push([t.id,"#controls button, #controls form {\n display: inline;\n}\n\n#content {\n margin: 0 auto;\n padding: 0 30px 20px;\n}\n\n#details {\n margin-top: 20px;\n height: 1.2em;\n}\n",""]);const u=a},361:t=>{t.exports=function(t){var n=[];return n.toString=function(){return this.map((function(n){var e="",r=void 0!==n[5];return n[4]&&(e+="@supports (".concat(n[4],") {")),n[2]&&(e+="@media ".concat(n[2]," {")),r&&(e+="@layer".concat(n[5].length>0?" ".concat(n[5]):""," {")),e+=t(n),r&&(e+="}"),n[2]&&(e+="}"),n[4]&&(e+="}"),e})).join("")},n.i=function(t,e,r,i,o){"string"==typeof t&&(t=[[null,t,void 0]]);var a={};if(r)for(var u=0;u<this.length;u++){var l=this[u][0];null!=l&&(a[l]=!0)}for(var s=0;s<t.length;s++){var c=[].concat(t[s]);r&&a[c[0]]||(void 0!==o&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=o),e&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=e):c[2]=e),i&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=i):c[4]="".concat(i)),n.push(c))}},n}},558:t=>{t.exports=function(t){return t[1]}},487:t=>{var n=[];function e(t){for(var e=-1,r=0;r<n.length;r++)if(n[r].identifier===t){e=r;break}return e}function r(t,r){for(var o={},a=[],u=0;u<t.length;u++){var l=t[u],s=r.base?l[0]+r.base:l[0],c=o[s]||0,h="".concat(s," ").concat(c);o[s]=c+1;var f=e(h),p={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==f)n[f].references++,n[f].updater(p);else{var d=i(p,r);r.byIndex=u,n.splice(u,0,{identifier:h,updater:d,references:1})}a.push(h)}return a}function i(t,n){var e=n.domAPI(n);return e.update(t),function(n){if(n){if(n.css===t.css&&n.media===t.media&&n.sourceMap===t.sourceMap&&n.supports===t.supports&&n.layer===t.layer)return;e.update(t=n)}else e.remove()}}t.exports=function(t,i){var o=r(t=t||[],i=i||{});return function(t){t=t||[];for(var a=0;a<o.length;a++){var u=e(o[a]);n[u].references--}for(var l=r(t,i),s=0;s<o.length;s++){var c=e(o[s]);0===n[c].references&&(n[c].updater(),n.splice(c,1))}o=l}}},52:t=>{var n={};t.exports=function(t,e){var r=function(t){if(void 0===n[t]){var e=document.querySelector(t);if(window.HTMLIFrameElement&&e instanceof window.HTMLIFrameElement)try{e=e.contentDocument.head}catch(t){e=null}n[t]=e}return n[t]}(t);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(e)}},469:t=>{t.exports=function(t){var n=document.createElement("style");return t.setAttributes(n,t.attributes),t.insert(n,t.options),n}},10:(t,n,e)=>{t.exports=function(t){var n=e.nc;n&&t.setAttribute("nonce",n)}},631:t=>{t.exports=function(t){var n=t.insertStyleElement(t);return{update:function(e){!function(t,n,e){var r="";e.supports&&(r+="@supports (".concat(e.supports,") {")),e.media&&(r+="@media ".concat(e.media," {"));var i=void 0!==e.layer;i&&(r+="@layer".concat(e.layer.length>0?" ".concat(e.layer):""," {")),r+=e.css,i&&(r+="}"),e.media&&(r+="}"),e.supports&&(r+="}");var o=e.sourceMap;o&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),n.styleTagTransform(r,t,n.options)}(n,t,e)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(n)}}}},329:t=>{t.exports=function(t,n){if(n.styleSheet)n.styleSheet.cssText=t;else{for(;n.firstChild;)n.removeChild(n.firstChild);n.appendChild(document.createTextNode(t))}}}},n={};function e(r){var i=n[r];if(void 0!==i)return i.exports;var o=n[r]={id:r,exports:{}};return t[r](o,o.exports,e),o.exports}e.n=t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},e.d=(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},e.o=(t,n)=>Object.prototype.hasOwnProperty.call(t,n),(()=>{function t(){}function n(n){return null==n?t:function(){return this.querySelector(n)}}function r(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function i(){return[]}function o(t){return null==t?i:function(){return this.querySelectorAll(t)}}function a(t){return function(){return this.matches(t)}}function u(t){return function(n){return n.matches(t)}}var l=Array.prototype.find;function s(){return this.firstElementChild}var c=Array.prototype.filter;function h(){return Array.from(this.children)}function f(t){return new Array(t.length)}function p(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function d(t){return function(){return t}}function g(t,n,e,r,i,o){for(var a,u=0,l=n.length,s=o.length;u<s;++u)(a=n[u])?(a.__data__=o[u],r[u]=a):e[u]=new p(t,o[u]);for(;u<l;++u)(a=n[u])&&(i[u]=a)}function v(t,n,e,r,i,o,a){var u,l,s,c=new Map,h=n.length,f=o.length,d=new Array(h);for(u=0;u<h;++u)(l=n[u])&&(d[u]=s=a.call(l,l.__data__,u,n)+"",c.has(s)?i[u]=l:c.set(s,l));for(u=0;u<f;++u)s=a.call(t,o[u],u,o)+"",(l=c.get(s))?(r[u]=l,l.__data__=o[u],c.delete(s)):e[u]=new p(t,o[u]);for(u=0;u<h;++u)(l=n[u])&&c.get(d[u])===l&&(i[u]=l)}function m(t){return t.__data__}function y(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function w(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}p.prototype={constructor:p,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var _="http://www.w3.org/1999/xhtml";const x={svg:"http://www.w3.org/2000/svg",xhtml:_,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function b(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),x.hasOwnProperty(n)?{space:x[n],local:t}:t}function M(t){return function(){this.removeAttribute(t)}}function A(t){return function(){this.removeAttributeNS(t.space,t.local)}}function N(t,n){return function(){this.setAttribute(t,n)}}function E(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function k(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function S(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function C(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function I(t){return function(){this.style.removeProperty(t)}}function B(t,n,e){return function(){this.style.setProperty(t,n,e)}}function T(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function L(t,n){return t.style.getPropertyValue(n)||C(t).getComputedStyle(t,null).getPropertyValue(n)}function O(t){return function(){delete this[t]}}function P(t,n){return function(){this[t]=n}}function j(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function q(t){return t.trim().split(/^|\s+/)}function H(t){return t.classList||new z(t)}function z(t){this._node=t,this._names=q(t.getAttribute("class")||"")}function D(t,n){for(var e=H(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function R(t,n){for(var e=H(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function Z(t){return function(){D(this,t)}}function V(t){return function(){R(this,t)}}function X(t,n){return function(){(n.apply(this,arguments)?D:R)(this,t)}}function $(){this.textContent=""}function F(t){return function(){this.textContent=t}}function G(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function Y(){this.innerHTML=""}function U(t){return function(){this.innerHTML=t}}function W(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function J(){this.nextSibling&&this.parentNode.appendChild(this)}function K(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Q(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===_&&n.documentElement.namespaceURI===_?n.createElement(t):n.createElementNS(e,t)}}function tt(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function nt(t){var n=b(t);return(n.local?tt:Q)(n)}function et(){return null}function rt(){var t=this.parentNode;t&&t.removeChild(this)}function it(){var t=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function ot(){var t=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function at(t){return t.trim().split(/^|\s+/).map((function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}))}function ut(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r<o;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.options);++i?n.length=i:delete this.__on}}}function lt(t,n,e){return function(){var r,i=this.__on,o=function(t){return function(n){t.call(this,n,this.__data__)}}(n);if(i)for(var a=0,u=i.length;a<u;++a)if((r=i[a]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=e),void(r.value=n);this.addEventListener(t.type,o,e),r={type:t.type,name:t.name,value:n,listener:o,options:e},i?i.push(r):this.__on=[r]}}function st(t,n,e){var r=C(t),i=r.CustomEvent;"function"==typeof i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}function ct(t,n){return function(){return st(this,t,n)}}function ht(t,n){return function(){return st(this,t,n.apply(this,arguments))}}z.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var ft=[null];function pt(t,n){this._groups=t,this._parents=n}function dt(){return new pt([[document.documentElement]],ft)}pt.prototype=dt.prototype={constructor:pt,select:function(t){"function"!=typeof t&&(t=n(t));for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o)for(var a,u,l=e[o],s=l.length,c=i[o]=new Array(s),h=0;h<s;++h)(a=l[h])&&(u=t.call(a,a.__data__,h,l))&&("__data__"in a&&(u.__data__=a.__data__),c[h]=u);return new pt(i,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){return r(t.apply(this,arguments))}}(t):o(t);for(var n=this._groups,e=n.length,i=[],a=[],u=0;u<e;++u)for(var l,s=n[u],c=s.length,h=0;h<c;++h)(l=s[h])&&(i.push(t.call(l,l.__data__,h,s)),a.push(l));return new pt(i,a)},selectChild:function(t){return this.select(null==t?s:function(t){return function(){return l.call(this.children,t)}}("function"==typeof t?t:u(t)))},selectChildren:function(t){return this.selectAll(null==t?h:function(t){return function(){return c.call(this.children,t)}}("function"==typeof t?t:u(t)))},filter:function(t){"function"!=typeof t&&(t=a(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,u=n[i],l=u.length,s=r[i]=[],c=0;c<l;++c)(o=u[c])&&t.call(o,o.__data__,c,u)&&s.push(o);return new pt(r,this._parents)},data:function(t,n){if(!arguments.length)return Array.from(this,m);var e=n?v:g,r=this._parents,i=this._groups;"function"!=typeof t&&(t=d(t));for(var o=i.length,a=new Array(o),u=new Array(o),l=new Array(o),s=0;s<o;++s){var c=r[s],h=i[s],f=h.length,p=y(t.call(c,c&&c.__data__,s,r)),w=p.length,_=u[s]=new Array(w),x=a[s]=new Array(w),b=l[s]=new Array(f);e(c,h,_,x,b,p,n);for(var M,A,N=0,E=0;N<w;++N)if(M=_[N]){for(N>=E&&(E=N+1);!(A=x[E])&&++E<w;);M._next=A||null}}return(a=new pt(a,r))._enter=u,a._exit=l,a},enter:function(){return new pt(this._enter||this._groups.map(f),this._parents)},exit:function(){return new pt(this._exit||this._groups.map(f),this._parents)},join:function(t,n,e){var r=this.enter(),i=this,o=this.exit();return"function"==typeof t?(r=t(r))&&(r=r.selection()):r=r.append(t+""),null!=n&&(i=n(i))&&(i=i.selection()),null==e?o.remove():e(o),r&&i?r.merge(i).order():i},merge:function(t){for(var n=t.selection?t.selection():t,e=this._groups,r=n._groups,i=e.length,o=r.length,a=Math.min(i,o),u=new Array(i),l=0;l<a;++l)for(var s,c=e[l],h=r[l],f=c.length,p=u[l]=new Array(f),d=0;d<f;++d)(s=c[d]||h[d])&&(p[d]=s);for(;l<i;++l)u[l]=e[l];return new pt(u,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,a=i[o];--o>=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=w);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var a,u=e[o],l=u.length,s=i[o]=new Array(l),c=0;c<l;++c)(a=u[c])&&(s[c]=a);s.sort(n)}return new pt(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){let t=0;for(const n of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i,o=n[e],a=0,u=o.length;a<u;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,n){var e=b(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((null==n?e.local?A:M:"function"==typeof n?e.local?S:k:e.local?E:N)(e,n))},style:function(t,n,e){return arguments.length>1?this.each((null==n?I:"function"==typeof n?T:B)(t,n,null==e?"":e)):L(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?O:"function"==typeof n?j:P)(t,n)):this.node()[t]},classed:function(t,n){var e=q(t+"");if(arguments.length<2){for(var r=H(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?X:n?Z:V)(e,n))},text:function(t){return arguments.length?this.each(null==t?$:("function"==typeof t?G:F)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?Y:("function"==typeof t?W:U)(t)):this.node().innerHTML},raise:function(){return this.each(J)},lower:function(){return this.each(K)},append:function(t){var n="function"==typeof t?t:nt(t);return this.select((function(){return this.appendChild(n.apply(this,arguments))}))},insert:function(t,e){var r="function"==typeof t?t:nt(t),i=null==e?et:"function"==typeof e?e:n(e);return this.select((function(){return this.insertBefore(r.apply(this,arguments),i.apply(this,arguments)||null)}))},remove:function(){return this.each(rt)},clone:function(t){return this.select(t?ot:it)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,n,e){var r,i,o=at(t+""),a=o.length;if(!(arguments.length<2)){for(u=n?lt:ut,r=0;r<a;++r)this.each(u(o[r],n,e));return this}var u=this.node().__on;if(u)for(var l,s=0,c=u.length;s<c;++s)for(r=0,l=u[s];r<a;++r)if((i=o[r]).type===l.type&&i.name===l.name)return l.value},dispatch:function(t,n){return this.each(("function"==typeof n?ht:ct)(t,n))},[Symbol.iterator]:function*(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r,i=t[n],o=0,a=i.length;o<a;++o)(r=i[o])&&(yield r)}};const gt=dt;function vt(t){return"string"==typeof t?new pt([[document.querySelector(t)]],[document.documentElement]):new pt([[t]],ft)}function mt(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}function yt(t){return(t=mt(Math.abs(t)))?t[1]:NaN}var wt,_t=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function xt(t){if(!(n=_t.exec(t)))throw new Error("invalid format: "+t);var n;return new bt({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}function bt(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Mt(t,n){var e=mt(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}xt.prototype=bt.prototype,bt.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const At={"%":(t,n)=>(100*t).toFixed(n),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,n)=>t.toExponential(n),f:(t,n)=>t.toFixed(n),g:(t,n)=>t.toPrecision(n),o:t=>Math.round(t).toString(8),p:(t,n)=>Mt(100*t,n),r:Mt,s:function(t,n){var e=mt(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(wt=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+mt(t,Math.max(0,n+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Nt(t){return t}var Et,kt,St,Ct=Array.prototype.map,It=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Bt(t,n){return null==t||null==n?NaN:t<n?-1:t>n?1:t>=n?0:NaN}function Tt(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function Lt(t){var n=0,e=t.children,r=e&&e.length;if(r)for(;--r>=0;)n+=e[r].value;else n=1;t.value=n}function Ot(t,n){t instanceof Map?(t=[void 0,t],void 0===n&&(n=jt)):void 0===n&&(n=Pt);for(var e,r,i,o,a,u=new zt(t),l=[u];e=l.pop();)if((i=n(e.data))&&(a=(i=Array.from(i)).length))for(e.children=i,o=a-1;o>=0;--o)l.push(r=i[o]=new zt(i[o])),r.parent=e,r.depth=e.depth+1;return u.eachBefore(Ht)}function Pt(t){return t.children}function jt(t){return Array.isArray(t)?t[1]:null}function qt(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function Ht(t){var n=0;do{t.height=n}while((t=t.parent)&&t.height<++n)}function zt(t){this.data=t,this.depth=this.height=0,this.parent=null}Et=function(t){var n,e,r=void 0===t.grouping||void 0===t.thousands?Nt:(n=Ct.call(t.grouping,Number),e=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,u=n[0],l=0;i>0&&u>0&&(l+u+1>r&&(u=Math.max(1,r-l)),o.push(t.substring(i-=u,i+u)),!((l+=u+1)>r));)u=n[a=(a+1)%n.length];return o.reverse().join(e)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",u=void 0===t.numerals?Nt:function(t){return function(n){return n.replace(/[0-9]/g,(function(n){return t[+n]}))}}(Ct.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",s=void 0===t.minus?"":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function h(t){var n=(t=xt(t)).fill,e=t.align,h=t.sign,f=t.symbol,p=t.zero,d=t.width,g=t.comma,v=t.precision,m=t.trim,y=t.type;"n"===y?(g=!0,y="g"):At[y]||(void 0===v&&(v=12),m=!0,y="g"),(p||"0"===n&&"="===e)&&(p=!0,n="0",e="=");var w="$"===f?i:"#"===f&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",_="$"===f?o:/[%p]/.test(y)?l:"",x=At[y],b=/[defgprs%]/.test(y);function M(t){var i,o,l,f=w,M=_;if("c"===y)M=x(t)+M,t="";else{var A=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:x(Math.abs(t),v),m&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r<e;++r)switch(t[r]){case".":i=n=r;break;case"0":0===i&&(i=r),n=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),A&&0==+t&&"+"!==h&&(A=!1),f=(A?"("===h?h:s:"-"===h||"("===h?"":h)+f,M=("s"===y?It[8+wt/3]:"")+M+(A&&"("===h?")":""),b)for(i=-1,o=t.length;++i<o;)if(48>(l=t.charCodeAt(i))||l>57){M=(46===l?a+t.slice(i+1):t.slice(i))+M,t=t.slice(0,i);break}}g&&!p&&(t=r(t,1/0));var N=f.length+t.length+M.length,E=N<d?new Array(d-N+1).join(n):"";switch(g&&p&&(t=r(E+t,E.length?d-M.length:1/0),E=""),e){case"<":t=f+t+M+E;break;case"=":t=f+E+t+M;break;case"^":t=E.slice(0,N=E.length>>1)+f+t+M+E.slice(N);break;default:t=E+f+t+M}return u(t)}return v=void 0===v?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v)),M.toString=function(){return t+""},M}return{format:h,formatPrefix:function(t,n){var e=h(((t=xt(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(yt(n)/3))),i=Math.pow(10,-r),o=It[8+r/3];return function(t){return e(i*t)+o}}}}({thousands:",",grouping:[3],currency:["$",""]}),kt=Et.format,St=Et.formatPrefix,zt.prototype=Ot.prototype={constructor:zt,count:function(){return this.eachAfter(Lt)},each:function(t,n){let e=-1;for(const r of this)t.call(n,r,++e,this);return this},eachAfter:function(t,n){for(var e,r,i,o=this,a=[o],u=[],l=-1;o=a.pop();)if(u.push(o),e=o.children)for(r=0,i=e.length;r<i;++r)a.push(e[r]);for(;o=u.pop();)t.call(n,o,++l,this);return this},eachBefore:function(t,n){for(var e,r,i=this,o=[i],a=-1;i=o.pop();)if(t.call(n,i,++a,this),e=i.children)for(r=e.length-1;r>=0;--r)o.push(e[r]);return this},find:function(t,n){let e=-1;for(const r of this)if(t.call(n,r,++e,this))return r},sum:function(t){return this.eachAfter((function(n){for(var e=+t(n.data)||0,r=n.children,i=r&&r.length;--i>=0;)e+=r[i].value;n.value=e}))},sort:function(t){return this.eachBefore((function(n){n.children&&n.children.sort(t)}))},path:function(t){for(var n=this,e=function(t,n){if(t===n)return t;var e=t.ancestors(),r=n.ancestors(),i=null;for(t=e.pop(),n=r.pop();t===n;)i=t,t=e.pop(),n=r.pop();return i}(n,t),r=[n];n!==e;)n=n.parent,r.push(n);for(var i=r.length;t!==e;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,n=[t];t=t.parent;)n.push(t);return n},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore((function(n){n.children||t.push(n)})),t},links:function(){var t=this,n=[];return t.each((function(e){e!==t&&n.push({source:e.parent,target:e})})),n},copy:function(){return Ot(this).eachBefore(qt)},[Symbol.iterator]:function*(){var t,n,e,r,i=this,o=[i];do{for(t=o.reverse(),o=[];i=t.pop();)if(yield i,n=i.children)for(e=0,r=n.length;e<r;++e)o.push(n[e])}while(o.length)}};var Dt=Math.sqrt(50),Rt=Math.sqrt(10),Zt=Math.sqrt(2);function Vt(t,n,e){var r=(n-t)/Math.max(0,e),i=Math.floor(Math.log(r)/Math.LN10),o=r/Math.pow(10,i);return i>=0?(o>=Dt?10:o>=Rt?5:o>=Zt?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=Dt?10:o>=Rt?5:o>=Zt?2:1)}function Xt(t){let n=t,e=t,r=t;function i(t,n,i=0,o=t.length){if(i<o){if(0!==e(n,n))return o;do{const e=i+o>>>1;r(t[e],n)<0?i=e+1:o=e}while(i<o)}return i}return 2!==t.length&&(n=(n,e)=>t(n)-e,e=Bt,r=(n,e)=>Bt(t(n),e)),{left:i,center:function(t,e,r=0,o=t.length){const a=i(t,e,r,o-1);return a>r&&n(t[a-1],e)>-n(t[a],e)?a-1:a},right:function(t,n,i=0,o=t.length){if(i<o){if(0!==e(n,n))return o;do{const e=i+o>>>1;r(t[e],n)<=0?i=e+1:o=e}while(i<o)}return i}}}const $t=Xt(Bt),Ft=$t.right,Gt=($t.left,Xt((function(t){return null===t?NaN:+t})).center,Ft);function Yt(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function Ut(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function Wt(){}var Jt=.7,Kt=1/Jt,Qt="\\s*([+-]?\\d+)\\s*",tn="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",nn="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",en=/^#([0-9a-f]{3,8})$/,rn=new RegExp("^rgb\\("+[Qt,Qt,Qt]+"\\)$"),on=new RegExp("^rgb\\("+[nn,nn,nn]+"\\)$"),an=new RegExp("^rgba\\("+[Qt,Qt,Qt,tn]+"\\)$"),un=new RegExp("^rgba\\("+[nn,nn,nn,tn]+"\\)$"),ln=new RegExp("^hsl\\("+[tn,nn,nn]+"\\)$"),sn=new RegExp("^hsla\\("+[tn,nn,nn,tn]+"\\)$"),cn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function hn(){return this.rgb().formatHex()}function fn(){return this.rgb().formatRgb()}function pn(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=en.exec(t))?(e=n[1].length,n=parseInt(n[1],16),6===e?dn(n):3===e?new yn(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?gn(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?gn(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=rn.exec(t))?new yn(n[1],n[2],n[3],1):(n=on.exec(t))?new yn(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=an.exec(t))?gn(n[1],n[2],n[3],n[4]):(n=un.exec(t))?gn(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=ln.exec(t))?bn(n[1],n[2]/100,n[3]/100,1):(n=sn.exec(t))?bn(n[1],n[2]/100,n[3]/100,n[4]):cn.hasOwnProperty(t)?dn(cn[t]):"transparent"===t?new yn(NaN,NaN,NaN,0):null}function dn(t){return new yn(t>>16&255,t>>8&255,255&t,1)}function gn(t,n,e,r){return r<=0&&(t=n=e=NaN),new yn(t,n,e,r)}function vn(t){return t instanceof Wt||(t=pn(t)),t?new yn((t=t.rgb()).r,t.g,t.b,t.opacity):new yn}function mn(t,n,e,r){return 1===arguments.length?vn(t):new yn(t,n,e,null==r?1:r)}function yn(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function wn(){return"#"+xn(this.r)+xn(this.g)+xn(this.b)}function _n(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function xn(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function bn(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new An(t,n,e,r)}function Mn(t){if(t instanceof An)return new An(t.h,t.s,t.l,t.opacity);if(t instanceof Wt||(t=pn(t)),!t)return new An;if(t instanceof An)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),a=NaN,u=o-i,l=(o+i)/2;return u?(a=n===o?(e-r)/u+6*(e<r):e===o?(r-n)/u+2:(n-e)/u+4,u/=l<.5?o+i:2-o-i,a*=60):u=l>0&&l<1?0:a,new An(a,u,l,t.opacity)}function An(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Nn(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}function En(t,n,e,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*n+(4-6*o+3*a)*e+(1+3*t+3*o-3*a)*r+a*i)/6}Yt(Wt,pn,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:hn,formatHex:hn,formatHsl:function(){return Mn(this).formatHsl()},formatRgb:fn,toString:fn}),Yt(yn,mn,Ut(Wt,{brighter:function(t){return t=null==t?Kt:Math.pow(Kt,t),new yn(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?Jt:Math.pow(Jt,t),new yn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:wn,formatHex:wn,formatRgb:_n,toString:_n})),Yt(An,(function(t,n,e,r){return 1===arguments.length?Mn(t):new An(t,n,e,null==r?1:r)}),Ut(Wt,{brighter:function(t){return t=null==t?Kt:Math.pow(Kt,t),new An(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?Jt:Math.pow(Jt,t),new An(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new yn(Nn(t>=240?t-240:t+120,i,r),Nn(t,i,r),Nn(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));const kn=t=>()=>t;function Sn(t,n){var e=n-t;return e?function(t,n){return function(e){return t+e*n}}(t,e):kn(isNaN(t)?n:t)}const Cn=function t(n){var e=function(t){return 1==(t=+t)?Sn:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):kn(isNaN(n)?e:n)}}(n);function r(t,n){var r=e((t=mn(t)).r,(n=mn(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),a=Sn(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=a(n),t+""}}return r.gamma=t,r}(1);function In(t){return function(n){var e,r,i=n.length,o=new Array(i),a=new Array(i),u=new Array(i);for(e=0;e<i;++e)r=mn(n[e]),o[e]=r.r||0,a[e]=r.g||0,u[e]=r.b||0;return o=t(o),a=t(a),u=t(u),r.opacity=1,function(t){return r.r=o(t),r.g=a(t),r.b=u(t),r+""}}}function Bn(t,n){var e,r=n?n.length:0,i=t?Math.min(r,t.length):0,o=new Array(i),a=new Array(r);for(e=0;e<i;++e)o[e]=zn(t[e],n[e]);for(;e<r;++e)a[e]=n[e];return function(t){for(e=0;e<i;++e)a[e]=o[e](t);return a}}function Tn(t,n){var e=new Date;return t=+t,n=+n,function(r){return e.setTime(t*(1-r)+n*r),e}}function Ln(t,n){return t=+t,n=+n,function(e){return t*(1-e)+n*e}}function On(t,n){var e,r={},i={};for(e in null!==t&&"object"==typeof t||(t={}),null!==n&&"object"==typeof n||(n={}),n)e in t?r[e]=zn(t[e],n[e]):i[e]=n[e];return function(t){for(e in r)i[e]=r[e](t);return i}}In((function(t){var n=t.length-1;return function(e){var r=e<=0?e=0:e>=1?(e=1,n-1):Math.floor(e*n),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,u=r<n-1?t[r+2]:2*o-i;return En((e-r/n)*n,a,i,o,u)}})),In((function(t){var n=t.length;return function(e){var r=Math.floor(((e%=1)<0?++e:e)*n),i=t[(r+n-1)%n],o=t[r%n],a=t[(r+1)%n],u=t[(r+2)%n];return En((e-r/n)*n,i,o,a,u)}}));var Pn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,jn=new RegExp(Pn.source,"g");function qn(t,n){var e,r,i,o=Pn.lastIndex=jn.lastIndex=0,a=-1,u=[],l=[];for(t+="",n+="";(e=Pn.exec(t))&&(r=jn.exec(n));)(i=r.index)>o&&(i=n.slice(o,i),u[a]?u[a]+=i:u[++a]=i),(e=e[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,l.push({i:a,x:Ln(e,r)})),o=jn.lastIndex;return o<n.length&&(i=n.slice(o),u[a]?u[a]+=i:u[++a]=i),u.length<2?l[0]?function(t){return function(n){return t(n)+""}}(l[0].x):function(t){return function(){return t}}(n):(n=l.length,function(t){for(var e,r=0;r<n;++r)u[(e=l[r]).i]=e.x(t);return u.join("")})}function Hn(t,n){n||(n=[]);var e,r=t?Math.min(n.length,t.length):0,i=n.slice();return function(o){for(e=0;e<r;++e)i[e]=t[e]*(1-o)+n[e]*o;return i}}function zn(t,n){var e,r,i=typeof n;return null==n||"boolean"===i?kn(n):("number"===i?Ln:"string"===i?(e=pn(n))?(n=e,Cn):qn:n instanceof pn?Cn:n instanceof Date?Tn:(r=n,!ArrayBuffer.isView(r)||r instanceof DataView?Array.isArray(n)?Bn:"function"!=typeof n.valueOf&&"function"!=typeof n.toString||isNaN(n)?On:Ln:Hn))(t,n)}function Dn(t,n){return t=+t,n=+n,function(e){return Math.round(t*(1-e)+n*e)}}function Rn(t){return+t}var Zn=[0,1];function Vn(t){return t}function Xn(t,n){return(n-=t=+t)?function(e){return(e-t)/n}:(e=isNaN(n)?NaN:.5,function(){return e});var e}function $n(t,n,e){var r=t[0],i=t[1],o=n[0],a=n[1];return i<r?(r=Xn(i,r),o=e(a,o)):(r=Xn(r,i),o=e(o,a)),function(t){return o(r(t))}}function Fn(t,n,e){var r=Math.min(t.length,n.length)-1,i=new Array(r),o=new Array(r),a=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),n=n.slice().reverse());++a<r;)i[a]=Xn(t[a],t[a+1]),o[a]=e(n[a],n[a+1]);return function(n){var e=Gt(t,n,1,r)-1;return o[e](i[e](n))}}function Gn(t,n){return n.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Yn(){return function(){var t,n,e,r,i,o,a=Zn,u=Zn,l=zn,s=Vn;function c(){var t,n,e,l=Math.min(a.length,u.length);return s!==Vn&&(t=a[0],n=a[l-1],t>n&&(e=t,t=n,n=e),s=function(e){return Math.max(t,Math.min(n,e))}),r=l>2?Fn:$n,i=o=null,h}function h(n){return null==n||isNaN(n=+n)?e:(i||(i=r(a.map(t),u,l)))(t(s(n)))}return h.invert=function(e){return s(n((o||(o=r(u,a.map(t),Ln)))(e)))},h.domain=function(t){return arguments.length?(a=Array.from(t,Rn),c()):a.slice()},h.range=function(t){return arguments.length?(u=Array.from(t),c()):u.slice()},h.rangeRound=function(t){return u=Array.from(t),l=Dn,c()},h.clamp=function(t){return arguments.length?(s=!!t||Vn,c()):s!==Vn},h.interpolate=function(t){return arguments.length?(l=t,c()):l},h.unknown=function(t){return arguments.length?(e=t,h):e},function(e,r){return t=e,n=r,c()}}()(Vn,Vn)}function Un(t,n){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(n).domain(t)}return this}function Wn(t){var n=t.domain;return t.ticks=function(t){var e=n();return function(t,n,e){var r,i,o,a,u=-1;if(e=+e,(t=+t)==(n=+n)&&e>0)return[t];if((r=n<t)&&(i=t,t=n,n=i),0===(a=Vt(t,n,e))||!isFinite(a))return[];if(a>0){let e=Math.round(t/a),r=Math.round(n/a);for(e*a<t&&++e,r*a>n&&--r,o=new Array(i=r-e+1);++u<i;)o[u]=(e+u)*a}else{a=-a;let e=Math.round(t*a),r=Math.round(n*a);for(e/a<t&&++e,r/a>n&&--r,o=new Array(i=r-e+1);++u<i;)o[u]=(e+u)/a}return r&&o.reverse(),o}(e[0],e[e.length-1],null==t?10:t)},t.tickFormat=function(t,e){var r=n();return function(t,n,e,r){var i,o=function(t,n,e){var r=Math.abs(n-t)/Math.max(0,e),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=Dt?i*=10:o>=Rt?i*=5:o>=Zt&&(i*=2),n<t?-i:i}(t,n,e);switch((r=xt(null==r?",f":r)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(n));return null!=r.precision||isNaN(i=function(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(yt(n)/3)))-yt(Math.abs(t)))}(o,a))||(r.precision=i),St(r,a);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=function(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,yt(n)-yt(t))+1}(o,Math.max(Math.abs(t),Math.abs(n))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=function(t){return Math.max(0,-yt(Math.abs(t)))}(o))||(r.precision=i-2*("%"===r.type))}return kt(r)}(r[0],r[r.length-1],null==t?10:t,e)},t.nice=function(e){null==e&&(e=10);var r,i,o=n(),a=0,u=o.length-1,l=o[a],s=o[u],c=10;for(s<l&&(i=l,l=s,s=i,i=a,a=u,u=i);c-- >0;){if((i=Vt(l,s,e))===r)return o[a]=l,o[u]=s,n(o);if(i>0)l=Math.floor(l/i)*i,s=Math.ceil(s/i)*i;else{if(!(i<0))break;l=Math.ceil(l*i)/i,s=Math.floor(s*i)/i}r=i}return t},t}function Jn(){var t=Yn();return t.copy=function(){return Gn(t,Jn())},Un.apply(t,arguments),Wn(t)}function Kn(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Qn={value:()=>{}};function te(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new ne(r)}function ne(t){this._=t}function ee(t,n){return t.trim().split(/^|\s+/).map((function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))}function re(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function ie(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=Qn,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}ne.prototype=te.prototype={constructor:ne,on:function(t,n){var e,r=this._,i=ee(t+"",r),o=-1,a=i.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++o<a;)if(e=(t=i[o]).type)r[e]=ie(r[e],t.name,n);else if(null==n)for(e in r)r[e]=ie(r[e],t.name,null);return this}for(;++o<a;)if((e=(t=i[o]).type)&&(e=re(r[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new ne(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};const oe=te;var ae,ue,le=0,se=0,ce=0,he=0,fe=0,pe=0,de="object"==typeof performance&&performance.now?performance:Date,ge="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function ve(){return fe||(ge(me),fe=de.now()+pe)}function me(){fe=0}function ye(){this._call=this._time=this._next=null}function we(t,n,e){var r=new ye;return r.restart(t,n,e),r}function _e(){fe=(he=de.now())+pe,le=se=0;try{!function(){ve(),++le;for(var t,n=ae;n;)(t=fe-n._time)>=0&&n._call.call(void 0,t),n=n._next;--le}()}finally{le=0,function(){for(var t,n,e=ae,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:ae=n);ue=t,be(r)}(),fe=0}}function xe(){var t=de.now(),n=t-he;n>1e3&&(pe-=n,he=t)}function be(t){le||(se&&(se=clearTimeout(se)),t-fe>24?(t<1/0&&(se=setTimeout(_e,t-de.now()-pe)),ce&&(ce=clearInterval(ce))):(ce||(he=de.now(),ce=setInterval(xe,1e3)),le=1,ge(_e)))}function Me(t,n,e){var r=new ye;return n=null==n?0:+n,r.restart((e=>{r.stop(),t(e+n)}),n,e),r}ye.prototype=we.prototype={constructor:ye,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?ve():+e)+(null==n?0:+n),this._next||ue===this||(ue?ue._next=this:ae=this,ue=this),this._call=t,this._time=e,be()},stop:function(){this._call&&(this._call=null,this._time=1/0,be())}};var Ae=oe("start","end","cancel","interrupt"),Ne=[];function Ee(t,n,e,r,i,o){var a=t.__transition;if(a){if(e in a)return}else t.__transition={};!function(t,n,e){var r,i=t.__transition;function o(l){var s,c,h,f;if(1!==e.state)return u();for(s in i)if((f=i[s]).name===e.name){if(3===f.state)return Me(o);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[s]):+s<n&&(f.state=6,f.timer.stop(),f.on.call("cancel",t,t.__data__,f.index,f.group),delete i[s])}if(Me((function(){3===e.state&&(e.state=4,e.timer.restart(a,e.delay,e.time),a(l))})),e.state=2,e.on.call("start",t,t.__data__,e.index,e.group),2===e.state){for(e.state=3,r=new Array(h=e.tween.length),s=0,c=-1;s<h;++s)(f=e.tween[s].value.call(t,t.__data__,e.index,e.group))&&(r[++c]=f);r.length=c+1}}function a(n){for(var i=n<e.duration?e.ease.call(null,n/e.duration):(e.timer.restart(u),e.state=5,1),o=-1,a=r.length;++o<a;)r[o].call(t,i);5===e.state&&(e.on.call("end",t,t.__data__,e.index,e.group),u())}function u(){for(var r in e.state=6,e.timer.stop(),delete i[n],i)return;delete t.__transition}i[n]=e,e.timer=we((function(t){e.state=1,e.timer.restart(o,e.delay,e.time),e.delay<=t&&o(t-e.delay)}),0,e.time)}(t,e,{name:n,index:r,group:i,on:Ae,tween:Ne,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:0})}function ke(t,n){var e=Ce(t,n);if(e.state>0)throw new Error("too late; already scheduled");return e}function Se(t,n){var e=Ce(t,n);if(e.state>3)throw new Error("too late; already running");return e}function Ce(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}var Ie,Be=180/Math.PI,Te={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Le(t,n,e,r,i,o){var a,u,l;return(a=Math.sqrt(t*t+n*n))&&(t/=a,n/=a),(l=t*e+n*r)&&(e-=t*l,r-=n*l),(u=Math.sqrt(e*e+r*r))&&(e/=u,r/=u,l/=u),t*r<n*e&&(t=-t,n=-n,l=-l,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(n,t)*Be,skewX:Math.atan(l)*Be,scaleX:a,scaleY:u}}function Oe(t,n,e,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var u=[],l=[];return o=t(o),a=t(a),function(t,r,i,o,a,u){if(t!==i||r!==o){var l=a.push("translate(",null,n,null,e);u.push({i:l-4,x:Ln(t,i)},{i:l-2,x:Ln(r,o)})}else(i||o)&&a.push("translate("+i+n+o+e)}(o.translateX,o.translateY,a.translateX,a.translateY,u,l),function(t,n,e,o){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:Ln(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(o.rotate,a.rotate,u,l),function(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:Ln(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(o.skewX,a.skewX,u,l),function(t,n,e,r,o,a){if(t!==e||n!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:Ln(t,e)},{i:u-2,x:Ln(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,u,l),o=a=null,function(t){for(var n,e=-1,r=l.length;++e<r;)u[(n=l[e]).i]=n.x(t);return u.join("")}}}var Pe=Oe((function(t){const n=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return n.isIdentity?Te:Le(n.a,n.b,n.c,n.d,n.e,n.f)}),"px, ","px)","deg)"),je=Oe((function(t){return null==t?Te:(Ie||(Ie=document.createElementNS("http://www.w3.org/2000/svg","g")),Ie.setAttribute("transform",t),(t=Ie.transform.baseVal.consolidate())?Le((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):Te)}),", ",")",")");function qe(t,n){var e,r;return function(){var i=Se(this,t),o=i.tween;if(o!==e)for(var a=0,u=(r=e=o).length;a<u;++a)if(r[a].name===n){(r=r.slice()).splice(a,1);break}i.tween=r}}function He(t,n,e){var r,i;if("function"!=typeof e)throw new Error;return function(){var o=Se(this,t),a=o.tween;if(a!==r){i=(r=a).slice();for(var u={name:n,value:e},l=0,s=i.length;l<s;++l)if(i[l].name===n){i[l]=u;break}l===s&&i.push(u)}o.tween=i}}function ze(t,n,e){var r=t._id;return t.each((function(){var t=Se(this,r);(t.value||(t.value={}))[n]=e.apply(this,arguments)})),function(t){return Ce(t,r).value[n]}}function De(t,n){var e;return("number"==typeof n?Ln:n instanceof pn?Cn:(e=pn(n))?(n=e,Cn):qn)(t,n)}function Re(t){return function(){this.removeAttribute(t)}}function Ze(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Ve(t,n,e){var r,i,o=e+"";return function(){var a=this.getAttribute(t);return a===o?null:a===r?i:i=n(r=a,e)}}function Xe(t,n,e){var r,i,o=e+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===o?null:a===r?i:i=n(r=a,e)}}function $e(t,n,e){var r,i,o;return function(){var a,u,l=e(this);if(null!=l)return(a=this.getAttribute(t))===(u=l+"")?null:a===r&&u===i?o:(i=u,o=n(r=a,l));this.removeAttribute(t)}}function Fe(t,n,e){var r,i,o;return function(){var a,u,l=e(this);if(null!=l)return(a=this.getAttributeNS(t.space,t.local))===(u=l+"")?null:a===r&&u===i?o:(i=u,o=n(r=a,l));this.removeAttributeNS(t.space,t.local)}}function Ge(t,n){return function(e){this.setAttribute(t,n.call(this,e))}}function Ye(t,n){return function(e){this.setAttributeNS(t.space,t.local,n.call(this,e))}}function Ue(t,n){var e,r;function i(){var i=n.apply(this,arguments);return i!==r&&(e=(r=i)&&Ye(t,i)),e}return i._value=n,i}function We(t,n){var e,r;function i(){var i=n.apply(this,arguments);return i!==r&&(e=(r=i)&&Ge(t,i)),e}return i._value=n,i}function Je(t,n){return function(){ke(this,t).delay=+n.apply(this,arguments)}}function Ke(t,n){return n=+n,function(){ke(this,t).delay=n}}function Qe(t,n){return function(){Se(this,t).duration=+n.apply(this,arguments)}}function tr(t,n){return n=+n,function(){Se(this,t).duration=n}}function nr(t,n){if("function"!=typeof n)throw new Error;return function(){Se(this,t).ease=n}}function er(t,n,e){var r,i,o=function(t){return(t+"").trim().split(/^|\s+/).every((function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||"start"===t}))}(n)?ke:Se;return function(){var a=o(this,t),u=a.on;u!==r&&(i=(r=u).copy()).on(n,e),a.on=i}}var rr=gt.prototype.constructor;function ir(t){return function(){this.style.removeProperty(t)}}function or(t,n,e){return function(r){this.style.setProperty(t,n.call(this,r),e)}}function ar(t,n,e){var r,i;function o(){var o=n.apply(this,arguments);return o!==i&&(r=(i=o)&&or(t,o,e)),r}return o._value=n,o}function ur(t){return function(n){this.textContent=t.call(this,n)}}function lr(t){var n,e;function r(){var r=t.apply(this,arguments);return r!==e&&(n=(e=r)&&ur(r)),n}return r._value=t,r}var sr=0;function cr(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function hr(){return++sr}var fr=gt.prototype;cr.prototype=function(t){return gt().transition(t)}.prototype={constructor:cr,select:function(t){var e=this._name,r=this._id;"function"!=typeof t&&(t=n(t));for(var i=this._groups,o=i.length,a=new Array(o),u=0;u<o;++u)for(var l,s,c=i[u],h=c.length,f=a[u]=new Array(h),p=0;p<h;++p)(l=c[p])&&(s=t.call(l,l.__data__,p,c))&&("__data__"in l&&(s.__data__=l.__data__),f[p]=s,Ee(f[p],e,r,p,f,Ce(l,r)));return new cr(a,this._parents,e,r)},selectAll:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=o(t));for(var r=this._groups,i=r.length,a=[],u=[],l=0;l<i;++l)for(var s,c=r[l],h=c.length,f=0;f<h;++f)if(s=c[f]){for(var p,d=t.call(s,s.__data__,f,c),g=Ce(s,e),v=0,m=d.length;v<m;++v)(p=d[v])&&Ee(p,n,e,v,d,g);a.push(d),u.push(s)}return new cr(a,u,n,e)},selectChild:fr.selectChild,selectChildren:fr.selectChildren,filter:function(t){"function"!=typeof t&&(t=a(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,u=n[i],l=u.length,s=r[i]=[],c=0;c<l;++c)(o=u[c])&&t.call(o,o.__data__,c,u)&&s.push(o);return new cr(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),a=new Array(r),u=0;u<o;++u)for(var l,s=n[u],c=e[u],h=s.length,f=a[u]=new Array(h),p=0;p<h;++p)(l=s[p]||c[p])&&(f[p]=l);for(;u<r;++u)a[u]=n[u];return new cr(a,this._parents,this._name,this._id)},selection:function(){return new rr(this._groups,this._parents)},transition:function(){for(var t=this._name,n=this._id,e=hr(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a,u=r[o],l=u.length,s=0;s<l;++s)if(a=u[s]){var c=Ce(a,n);Ee(a,t,e,s,u,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new cr(r,this._parents,t,e)},call:fr.call,nodes:fr.nodes,node:fr.node,size:fr.size,empty:fr.empty,each:fr.each,on:function(t,n){var e=this._id;return arguments.length<2?Ce(this.node(),e).on.on(t):this.each(er(e,t,n))},attr:function(t,n){var e=b(t),r="transform"===e?je:De;return this.attrTween(t,"function"==typeof n?(e.local?Fe:$e)(e,r,ze(this,"attr."+t,n)):null==n?(e.local?Ze:Re)(e):(e.local?Xe:Ve)(e,r,n))},attrTween:function(t,n){var e="attr."+t;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(null==n)return this.tween(e,null);if("function"!=typeof n)throw new Error;var r=b(t);return this.tween(e,(r.local?Ue:We)(r,n))},style:function(t,n,e){var r="transform"==(t+="")?Pe:De;return null==n?this.styleTween(t,function(t,n){var e,r,i;return function(){var o=L(this,t),a=(this.style.removeProperty(t),L(this,t));return o===a?null:o===e&&a===r?i:i=n(e=o,r=a)}}(t,r)).on("end.style."+t,ir(t)):"function"==typeof n?this.styleTween(t,function(t,n,e){var r,i,o;return function(){var a=L(this,t),u=e(this),l=u+"";return null==u&&(this.style.removeProperty(t),l=u=L(this,t)),a===l?null:a===r&&l===i?o:(i=l,o=n(r=a,u))}}(t,r,ze(this,"style."+t,n))).each(function(t,n){var e,r,i,o,a="style."+n,u="end."+a;return function(){var l=Se(this,t),s=l.on,c=null==l.value[a]?o||(o=ir(n)):void 0;s===e&&i===c||(r=(e=s).copy()).on(u,i=c),l.on=r}}(this._id,t)):this.styleTween(t,function(t,n,e){var r,i,o=e+"";return function(){var a=L(this,t);return a===o?null:a===r?i:i=n(r=a,e)}}(t,r,n),e).on("end.style."+t,null)},styleTween:function(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,ar(t,n,null==e?"":e))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var n=t(this);this.textContent=null==n?"":n}}(ze(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;return this.tween(n,lr(t))},remove:function(){return this.on("end.remove",function(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}(this._id))},tween:function(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,i=Ce(this.node(),e).tween,o=0,a=i.length;o<a;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==n?qe:He)(e,t,n))},delay:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?Je:Ke)(n,t)):Ce(this.node(),n).delay},duration:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?Qe:tr)(n,t)):Ce(this.node(),n).duration},ease:function(t){var n=this._id;return arguments.length?this.each(nr(n,t)):Ce(this.node(),n).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,n){return function(){var e=n.apply(this,arguments);if("function"!=typeof e)throw new Error;Se(this,t).ease=e}}(this._id,t))},end:function(){var t,n,e=this,r=e._id,i=e.size();return new Promise((function(o,a){var u={value:a},l={value:function(){0==--i&&o()}};e.each((function(){var e=Se(this,r),i=e.on;i!==t&&((n=(t=i).copy())._.cancel.push(u),n._.interrupt.push(u),n._.end.push(l)),e.on=n})),0===i&&o()}))},[Symbol.iterator]:fr[Symbol.iterator]};var pr={time:null,delay:0,duration:250,ease:Kn};function dr(t,n){for(var e;!(e=t.__transition)||!(e=e[n]);)if(!(t=t.parentNode))throw new Error(`transition ${n} not found`);return e}function gr(t){let n=0;if(t){const e=t.split("`");e.length>1&&(t=e[e.length-1]),n=function(t){let n=0,e=0,r=1;if(t){for(let i=0;i<t.length&&!(i>6);i++)n+=r*(t.charCodeAt(i)%10),e+=9*r,r*=.7;e>0&&(n/=e)}return n}(t=t.split("(")[0])}return n}function vr(t,n){let e,r,i;return"red"===t?(e=200+Math.round(55*n),r=50+Math.round(80*n),i=r):"orange"===t?(e=190+Math.round(65*n),r=90+Math.round(65*n),i=0):"yellow"===t?(e=175+Math.round(55*n),r=e,i=50+Math.round(20*n)):"green"===t?(e=50+Math.round(60*n),r=200+Math.round(55*n),i=e):"pastelgreen"===t?(e=163+Math.round(75*n),r=195+Math.round(49*n),i=72+Math.round(149*n)):"blue"===t?(e=91+Math.round(126*n),r=156+Math.round(76*n),i=221+Math.round(26*n)):"aqua"===t?(e=50+Math.round(60*n),r=165+Math.round(55*n),i=r):"cold"===t?(e=0+Math.round(55*(1-n)),r=0+Math.round(230*(1-n)),i=200+Math.round(55*n)):(e=200+Math.round(55*n),r=0+Math.round(230*(1-n)),i=0+Math.round(55*(1-n))),"rgb("+e+","+r+","+i+")"}function mr(){let t=960,n=null,e=18,r=null,i=null,o="",a=750,u=Kn,l=!1,s=!1,c=null,h=null,f=0,p=null,d=null,g=!1,v=!1,m=!1,y=null,w=!1,_=null,x=function(t){return t.data.n||t.data.name},b=function(t){return"v"in t?t.v:t.value},M=function(t){return t.c||t.children},A=function(t){return t.data.l||t.data.libtype},N=function(t){return"d"in t.data?t.data.d:t.data.delta},E=function(t,n,e){d=()=>{p&&(p.textContent="search: "+n+" of "+e+" total samples ( "+kt(".3f")(n/e*100,3)+"%)")},d()};const k=E;let S=(t,n,e=!1)=>{if(!n)return!1;let r=x(t);e&&(n=n.toLowerCase(),r=r.toLowerCase());const i=new RegExp(n);return void 0!==r&&r&&r.match(i)};const C=S;let I=function(t){p&&(t?p.textContent=t:"function"==typeof d?d():p.textContent="")};const B=I;let T=function(t){return x(t)+" ("+kt(".3f")(100*(t.x1-t.x0),3)+"%, "+b(t)+" samples)"},L=function(t){return t.highlight?"#E600E6":function(t,n){let e=_||"warm";_||void 0===n||""===n||(e="red",void 0!==t&&t&&t.match(/::/)&&(e="yellow"),"kernel"===n?e="orange":"jit"===n?e="green":"inlined"===n&&(e="aqua"));return vr(e,gr(t))}(x(t),A(t))};const O=L;function P(t){t.data.fade=!1,t.data.hide=!1,t.children&&t.children.forEach(P)}function j(t){t.parent&&(t.parent.data.fade=!0,j(t.parent))}function q(t){if(i&&i.hide(),function(t){let n,e,r,i=t,o=i.parent;for(;o;){for(n=o.children,e=n.length;e--;)r=n[e],r!==i&&(r.data.hide=!0);i=o,o=i.parent}}(t),P(t),j(t),Z(),m){const n=vt(this).select("svg")._groups[0][0].parentNode.offsetTop,r=(window.innerHeight-n)/e,i=(t.height-r+10)*e;window.scrollTo({top:n+i,left:0,behavior:"smooth"})}"function"==typeof c&&c(t)}function H(t,n){if(t.id===n)return t;{const e=M(t);if(e)for(let t=0;t<e.length;t++){const r=H(e[t],n);if(r)return r}}}function z(t){t.highlight=!1,M(t)&&M(t).forEach((function(t){z(t)}))}function D(t,n){return"function"==typeof l?l(t,n):l?Bt(x(t),x(n)):void 0}const R=function(){var t=1,n=1,e=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=e,i.x1=t,i.y1=n/o,i.eachBefore(function(t,n){return function(r){r.children&&function(t,n,e,r,i){for(var o,a=t.children,u=-1,l=a.length,s=t.value&&(r-n)/t.value;++u<l;)(o=a[u]).y0=e,o.y1=i,o.x0=n,o.x1=n+=o.value*s}(r,r.x0,t*(r.depth+1)/n,r.x1,t*(r.depth+2)/n);var i=r.x0,o=r.y0,a=r.x1-e,u=r.y1-e;a<i&&(i=a=(i+a)/2),u<o&&(o=u=(o+u)/2),r.x0=i,r.y0=o,r.x1=a,r.y1=u}}(n,o)),r&&i.eachBefore(Tt),i}return i.round=function(t){return arguments.length?(r=!!t,i):r},i.size=function(e){return arguments.length?(t=+e[0],n=+e[1],i):[t,n]},i.padding=function(t){return arguments.length?(e=+t,i):e},i}();function Z(){r.each((function(r){const o=Jn().range([0,t]),c=Jn().range([0,e]);X(r),l&&r.sort(D),R(r);const p=t/(r.x1-r.x0);function d(t){return(t.x1-t.x0)*p}const g=function(n){let e=n.descendants();if(f>0){const r=t/(n.x1-n.x0);e=e.filter((function(t){return(t.x1-t.x0)*r>f}))}return e}(r),m=vt(this).select("svg");m.attr("width",t);let w=m.selectAll("g").data(g,(function(t){return t.id}));if(!n||v){const t=Math.max.apply(null,g.map((function(t){return t.depth})));n=(t+3)*e,n<y&&(n=y),m.attr("height",n)}w.transition().duration(a).ease(u).attr("transform",(function(t){return"translate("+o(t.x0)+","+(s?c(t.depth):n-c(t.depth)-e)+")"})),w.select("rect").transition().duration(a).ease(u).attr("width",d);const _=w.enter().append("svg:g").attr("transform",(function(t){return"translate("+o(t.x0)+","+(s?c(t.depth):n-c(t.depth)-e)+")"}));_.append("svg:rect").transition().delay(a/2).attr("width",d),i||_.append("svg:title"),_.append("foreignObject").append("xhtml:div"),w=m.selectAll("g").data(g,(function(t){return t.id})),w.attr("width",d).attr("height",(function(t){return e})).attr("name",(function(t){return x(t)})).attr("class",(function(t){return t.data.fade?"frame fade":"frame"})),w.select("rect").attr("height",(function(t){return e})).attr("fill",(function(t){return L(t)})),i||w.select("title").text(T),w.select("foreignObject").attr("width",d).attr("height",(function(t){return e})).select("div").attr("class","d3-flame-graph-label").style("display",(function(t){return d(t)<35?"none":"block"})).transition().delay(a).text(x),w.on("click",((t,n)=>{q(n)})),w.exit().remove(),w.on("mouseover",(function(t,n){i&&i.show(n,this),I(T(n)),"function"==typeof h&&h(n)})).on("mouseout",(function(){i&&i.hide(),I(null)}))}))}function V(t,n){n.forEach((function(n){const e=t.find((function(t){return t.name===n.name}));e?(e.value+=n.value,n.children&&(e.children||(e.children=[]),V(e.children,n.children))):t.push(n)}))}function X(t){let n,e,r,i,o,a,u,l;const s=[],c=[],h=[],f=!g;let p=t.data;for(p.hide?(t.value=0,e=t.children,e&&h.push(e)):(t.value=p.fade?0:b(p),s.push(t));n=s.pop();)if(e=n.children,e&&(o=e.length)){for(i=0;o--;)u=e[o],p=u.data,p.hide?(u.value=0,r=u.children,r&&h.push(r)):(p.fade?u.value=0:(l=b(p),u.value=l,i+=l),s.push(u));f&&n.value&&(n.value-=i),c.push(e)}for(o=c.length;o--;){for(e=c[o],i=0,a=e.length;a--;)i+=e[a].value;e[0].parent.value+=i}for(;h.length;)for(e=h.pop(),a=e.length;a--;)u=e[a],u.value=0,r=u.children,r&&h.push(r)}function $(){r.datum((t=>{if("Node"!==t.constructor.name){const n=Ot(t,M);return function(t){let n=0;!function(t,n){n(t);let e=t.children;if(e){const t=[e];let r,i,o;for(;t.length;)for(e=t.pop(),r=e.length;r--;)i=e[r],n(i),o=i.children,o&&t.push(o)}}(t,(function(t){t.id=n++}))}(n),X(n),n.originalValue=n.value,w&&n.eachAfter((t=>{let n=N(t);const e=t.children;let r=e&&e.length;for(;--r>=0;)n+=e[r].delta;t.delta=n})),n}}))}function F(e){if(!arguments.length)return F;r=e,$(),r.each((function(e){if(0===vt(this).select("svg").size()){const e=vt(this).append("svg:svg").attr("width",t).attr("class","partition d3-flame-graph");n&&(n<y&&(n=y),e.attr("height",n)),e.append("svg:text").attr("class","title").attr("text-anchor","middle").attr("y","25").attr("x",t/2).attr("fill","#808080").text(o),i&&e.call(i)}})),Z()}return F.height=function(t){return arguments.length?(n=t,F):n},F.minHeight=function(t){return arguments.length?(y=t,F):y},F.width=function(n){return arguments.length?(t=n,F):t},F.cellHeight=function(t){return arguments.length?(e=t,F):e},F.tooltip=function(t){return arguments.length?("function"==typeof t&&(i=t),F):i},F.title=function(t){return arguments.length?(o=t,F):o},F.transitionDuration=function(t){return arguments.length?(a=t,F):a},F.transitionEase=function(t){return arguments.length?(u=t,F):u},F.sort=function(t){return arguments.length?(l=t,F):l},F.inverted=function(t){return arguments.length?(s=t,F):s},F.computeDelta=function(t){return arguments.length?(w=t,F):w},F.setLabelHandler=function(t){return arguments.length?(T=t,F):T},F.label=F.setLabelHandler,F.search=function(t){const n=[];let e=0,i=0;r.each((function(r){const o=function(t,n){const e=[];let r=0;return function t(i,o){let a=!1;S(i,n)?(i.highlight=!0,a=!0,o||(r+=b(i)),e.push(i)):i.highlight=!1,M(i)&&M(i).forEach((function(n){t(n,o||a)}))}(t,!1),[e,r]}(r,t);n.push(...o[0]),e+=o[1],i+=r.originalValue})),E(n,e,i),Z()},F.findById=function(t){if(null==t)return null;let n=null;return r.each((function(e){null===n&&(n=H(e,t))})),n},F.clear=function(){I(null),r.each((function(t){z(t),Z()}))},F.zoomTo=function(t){q(t)},F.resetZoom=function(){r.each((function(t){q(t)}))},F.onClick=function(t){return arguments.length?(c=t,F):c},F.onHover=function(t){return arguments.length?(h=t,F):h},F.merge=function(t){return r?(this.resetZoom(),d=null,I(null),r.datum((n=>(V([n.data],[t]),n.data))),$(),Z(),F):F},F.update=function(t){return r?(t&&(r.datum(t),$()),Z(),F):F},F.destroy=function(){return r?(i&&(i.hide(),"function"==typeof i.destroy&&i.destroy()),r.selectAll("svg").remove(),F):F},F.setColorMapper=function(t){return arguments.length?(L=n=>{const e=O(n);return t(n,e)},F):(L=O,F)},F.color=F.setColorMapper,F.setColorHue=function(t){return arguments.length?(_=t,F):(_=null,F)},F.minFrameSize=function(t){return arguments.length?(f=t,F):f},F.setDetailsElement=function(t){return arguments.length?(p=t,F):p},F.details=F.setDetailsElement,F.selfValue=function(t){return arguments.length?(g=t,F):g},F.resetHeightOnZoom=function(t){return arguments.length?(v=t,F):v},F.scrollOnZoom=function(t){return arguments.length?(m=t,F):m},F.getName=function(t){return arguments.length?(x=t,F):x},F.getValue=function(t){return arguments.length?(b=t,F):b},F.getChildren=function(t){return arguments.length?(M=t,F):M},F.getLibtype=function(t){return arguments.length?(A=t,F):A},F.getDelta=function(t){return arguments.length?(N=t,F):N},F.setSearchHandler=function(t){return arguments.length?(E=t,F):(E=k,F)},F.setDetailsHandler=function(t){return arguments.length?(I=t,F):(I=B,F)},F.setSearchMatch=function(t){return arguments.length?(S=t,F):(S=C,F)},F}gt.prototype.interrupt=function(t){return this.each((function(){!function(t,n){var e,r,i,o=t.__transition,a=!0;if(o){for(i in n=null==n?null:n+"",o)(e=o[i]).name===n?(r=e.state>2&&e.state<5,e.state=6,e.timer.stop(),e.on.call(r?"interrupt":"cancel",t,t.__data__,e.index,e.group),delete o[i]):a=!1;a&&delete t.__transition}}(this,t)}))},gt.prototype.transition=function(t){var n,e;t instanceof cr?(n=t._id,t=t._name):(n=hr(),(e=pr).time=ve(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a,u=r[o],l=u.length,s=0;s<l;++s)(a=u[s])&&Ee(a,t,n,s,u,e||dr(a,n));return new cr(r,this._parents,t,n)};var yr=e(487),wr=e.n(yr),_r=e(631),xr=e.n(_r),br=e(52),Mr=e.n(br),Ar=e(10),Nr=e.n(Ar),Er=e(469),kr=e.n(Er),Sr=e(329),Cr=e.n(Sr),Ir=e(591),Br={};Br.styleTagTransform=Cr(),Br.setAttributes=Nr(),Br.insert=Mr().bind(null,"head"),Br.domAPI=xr(),Br.insertStyleElement=kr(),wr()(Ir.Z,Br),Ir.Z&&Ir.Z.locals&&Ir.Z.locals;var Tr=e(891),Lr={};Lr.styleTagTransform=Cr(),Lr.setAttributes=Nr(),Lr.insert=Mr().bind(null,"head"),Lr.domAPI=xr(),Lr.insertStyleElement=kr(),wr()(Tr.Z,Lr),Tr.Z&&Tr.Z.locals&&Tr.Z.locals;class Or{constructor(t,n){this.stacks=t||{name:"Stacks were not loaded.",value:0,children:[]},this.options=n||{},this.options.context&&""!==this.options.context||(this.options.context="No context information available."),this.context=document.getElementById("context"),this.chart=document.getElementById("chart"),this.details=document.getElementById("details"),this.contextBtn=document.getElementById("context-button"),this.resetBtn=document.getElementById("reset-button"),this.clearBtn=document.getElementById("clear-button"),this.searchForm=document.getElementById("search-form"),this.searchInput=document.getElementById("search-input")}handleSearch(){""===this.searchInput.value?this.flameGraph.clear():this.flameGraph.search(this.searchInput.value)}toggleContextInfo(){"none"===this.context.style.display?(this.chart.style.display="none",this.context.style.display="block"):(this.context.style.display="none",this.chart.style.display="block")}handleResetZoom(){this.flameGraph.resetZoom()}handleClear(){this.searchInput.value="",this.flameGraph.clear()}handleWindowResize(){var t=this.chart.clientWidth,n=document.getElementsByClassName("d3-flame-graph");n.length>0&&n[0].setAttribute("width",t),this.flameGraph.width(t),this.flameGraph.resetZoom()}sortByValue(t,n){return t.value===n.value?0:t.value<n.value?1:-1}colorSchemeColorMapper(t,n,e,r){if(e.highlight)return"#E600E6";if("blue-green"===this.options.colorscheme){const r=t(e),i=n(e),o=gr(r);return"root"===i?"rgb(217,75,75)":vr("kernel"===i?"blue":"pastelgreen",o)}return r}init(){this.flameGraph=mr().width(this.chart.clientWidth).cellHeight(16).minFrameSize(5).sort(this.sortByValue).selfValue(!0).resetHeightOnZoom(!0).scrollOnZoom(!0).setDetailsElement(this.details);const t=this.flameGraph.getName(),n=this.flameGraph.getLibtype();this.flameGraph.setColorMapper(this.colorSchemeColorMapper.bind(this,t,n)),this.contextBtn.addEventListener("click",this.toggleContextInfo.bind(this)),this.resetBtn.addEventListener("click",this.handleResetZoom.bind(this)),this.clearBtn.addEventListener("click",this.handleClear.bind(this)),this.searchForm.addEventListener("submit",(t=>{t.preventDefault(),this.handleSearch()})),this.searchInput.addEventListener("blur",this.handleSearch.bind(this)),window.addEventListener("resize",this.handleWindowResize.bind(this),!0),this.context.textContent=this.options.context,this.details.textContent="",vt(this.chart).datum(this.stacks).call(this.flameGraph)}}window.flamegraph=(t,n)=>{new Or(t,n).init()}})()})();</script></head>
<body>
<div id="controls">
<button id="context-button" type="button">Context</button>
<button id="reset-button" type="button">Reset Zoom</button>
<button id="clear-button" type="button">Clear</button>
<form id="search-form">
<input id="search-input" type="text" name="search">
<input type="submit" value="Search">
</form>
</div>
<div id="content">
<pre id="context" style="display: none"></pre>
<div id="chart"></div>
<div id="details">Loading Flame Graph...</div>
</div>
<script>
const stacks = [/** @flamegraph_json **/];
const options = [/** @options_json **/];
flamegraph(stacks[0], options[0]);
</script>
</body>
</html>