humemory 0.2.16 → 0.2.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +3 -3
- package/CHANGELOG.md +66 -0
- package/README.md +26 -2
- package/dist/agent/mcp-client-setup.d.ts +3 -1
- package/dist/agent/mcp-client-setup.js +85 -8
- package/dist/api/intentions-routes.js +4 -1
- package/dist/cli/index.js +14 -8
- package/dist/core/cue-arg.js +3 -0
- package/dist/core/cues.js +2 -0
- package/package.json +14 -14
- package/public/app/galaxy-bnqbm7cf.js +10 -0
- package/public/app/{index-gbfwa9vq.js → index-18hnqcxx.js} +1 -1
- package/public/app/index-23jznef0.js +2 -0
- package/public/app/{index-0fw784fa.js → index-5gn06sf9.js} +6 -6
- package/public/app/{index-5kwkpwkp.js → index-xv716176.js} +1 -1
- package/public/app/index.html +1 -1
- package/public/app/{promenade-fa0tb6jx.js → promenade-b9k933ve.js} +1 -1
- package/public/app/river-h2jckhks.js +5 -0
- package/src/agent/mcp-client-setup.ts +84 -10
- package/src/api/intentions-routes.ts +4 -0
- package/src/cli/index.ts +14 -8
- package/src/core/cue-arg.ts +2 -0
- package/src/core/cues.ts +1 -0
- package/public/app/galaxy-cgbkc6e1.js +0 -10
- package/public/app/index-epqg22cp.js +0 -1
- package/public/app/river-01hs4f06.js +0 -5
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as Z6,b as E6}from"./index-pbd5t4dj.js";import{j as V6,n as XX,p as JX,q as KX}from"./index-23jznef0.js";import{u as VX,v as C6}from"./index-18hnqcxx.js";import{E as EX}from"./index-xv716176.js";function q0(X,J){return X==null||J==null?NaN:X<J?-1:X>J?1:X>=J?0:NaN}function HX(X,J){return X==null||J==null?NaN:J<X?-1:J>X?1:J>=X?0:NaN}function h0(X){let J,K,G;if(X.length!==2)J=q0,K=(E,V)=>q0(X(E),V),G=(E,V)=>X(E)-V;else J=X===q0||X===HX?X:NX,K=X,G=X;function Q(E,V,Z=0,N=E.length){if(Z<N){if(J(V,V)!==0)return N;do{let U=Z+N>>>1;if(K(E[U],V)<0)Z=U+1;else N=U}while(Z<N)}return Z}function A(E,V,Z=0,N=E.length){if(Z<N){if(J(V,V)!==0)return N;do{let U=Z+N>>>1;if(K(E[U],V)<=0)Z=U+1;else N=U}while(Z<N)}return Z}function B(E,V,Z=0,N=E.length){let U=Q(E,V,Z,N-1);return U>Z&&G(E[U-1],V)>-G(E[U],V)?U-1:U}return{left:Q,center:B,right:A}}function NX(){return 0}function UX(X){return X===null?NaN:+X}var U6=h0(q0),z6=U6.right,BJ=U6.left,ZJ=h0(UX).center;var EJ=P6($6),VJ=P6(zX);function P6(X){return function(J,K,G=K){if(!((K=+K)>=0))throw RangeError("invalid rx");if(!((G=+G)>=0))throw RangeError("invalid ry");let{data:Q,width:A,height:B}=J;if(!((A=Math.floor(A))>=0))throw RangeError("invalid width");if(!((B=Math.floor(B!==void 0?B:Q.length/A))>=0))throw RangeError("invalid height");if(!A||!B||!K&&!G)return J;let E=K&&X(K),V=G&&X(G),Z=Q.slice();if(E&&V)U0(E,Z,Q,A,B),U0(E,Q,Z,A,B),U0(E,Z,Q,A,B),z0(V,Q,Z,A,B),z0(V,Z,Q,A,B),z0(V,Q,Z,A,B);else if(E)U0(E,Q,Z,A,B),U0(E,Z,Q,A,B),U0(E,Q,Z,A,B);else if(V)z0(V,Q,Z,A,B),z0(V,Z,Q,A,B),z0(V,Q,Z,A,B);return J}}function U0(X,J,K,G,Q){for(let A=0,B=G*Q;A<B;)X(J,K,A,A+=G,1)}function z0(X,J,K,G,Q){for(let A=0,B=G*Q;A<G;++A)X(J,K,A,A+B,G)}function zX(X){let J=$6(X);return(K,G,Q,A,B)=>{Q<<=2,A<<=2,B<<=2,J(K,G,Q+0,A+0,B),J(K,G,Q+1,A+1,B),J(K,G,Q+2,A+2,B),J(K,G,Q+3,A+3,B)}}function $6(X){let J=Math.floor(X);if(J===X)return PX(X);let K=X-J,G=2*X+1;return(Q,A,B,E,V)=>{if(!((E-=V)>=B))return;let Z=J*A[B],N=V*J,U=N+V;for(let H=B,$=B+N;H<$;H+=V)Z+=A[Math.min(E,H)];for(let H=B,$=E;H<=$;H+=V)Z+=A[Math.min(E,H+N)],Q[H]=(Z+K*(A[Math.max(B,H-U)]+A[Math.min(E,H+U)]))/G,Z-=A[Math.max(B,H-N)]}}function PX(X){let J=2*X+1;return(K,G,Q,A,B)=>{if(!((A-=B)>=Q))return;let E=X*G[Q],V=B*X;for(let Z=Q,N=Q+V;Z<N;Z+=B)E+=G[Math.min(A,Z)];for(let Z=Q,N=A;Z<=N;Z+=B)E+=G[Math.min(A,Z+V)],K[Z]=E/J,E-=G[Math.max(Q,Z-V)]}}var $X=Array.prototype,CJ=$X.slice;var OX=Math.sqrt(50),YX=Math.sqrt(10),qX=Math.sqrt(2);function b0(X,J,K){let G=(J-X)/Math.max(0,K),Q=Math.floor(Math.log10(G)),A=G/Math.pow(10,Q),B=A>=OX?10:A>=YX?5:A>=qX?2:1,E,V,Z;if(Q<0){if(Z=Math.pow(10,-Q)/B,E=Math.round(X*Z),V=Math.round(J*Z),E/Z<X)++E;if(V/Z>J)--V;Z=-Z}else{if(Z=Math.pow(10,Q)*B,E=Math.round(X/Z),V=Math.round(J/Z),E*Z<X)++E;if(V*Z>J)--V}if(V<E&&0.5<=K&&K<2)return b0(X,J,K*2);return[E,V,Z]}function O6(X,J,K){if(J=+J,X=+X,K=+K,!(K>0))return[];if(X===J)return[X];let G=J<X,[Q,A,B]=G?b0(J,X,K):b0(X,J,K);if(!(A>=Q))return[];let E=A-Q+1,V=Array(E);if(G)if(B<0)for(let Z=0;Z<E;++Z)V[Z]=(A-Z)/-B;else for(let Z=0;Z<E;++Z)V[Z]=(A-Z)*B;else if(B<0)for(let Z=0;Z<E;++Z)V[Z]=(Q+Z)/-B;else for(let Z=0;Z<E;++Z)V[Z]=(Q+Z)*B;return V}function k0(X,J,K){return J=+J,X=+X,K=+K,b0(X,J,K)[2]}function F0(X,J,K){J=+J,X=+X,K=+K;let G=J<X,Q=G?k0(J,X,K):k0(X,J,K);return(G?-1:1)*(Q<0?1/-Q:Q)}function Y6(X,J){let K;if(J===void 0){for(let G of X)if(G!=null&&(K<G||K===void 0&&G>=G))K=G}else{let G=-1;for(let Q of X)if((Q=J(Q,++G,X))!=null&&(K<Q||K===void 0&&Q>=Q))K=Q}return K}function q6(X,J){let K;if(J===void 0){for(let G of X)if(G!=null&&(K>G||K===void 0&&G>=G))K=G}else{let G=-1;for(let Q of X)if((Q=J(Q,++G,X))!=null&&(K>Q||K===void 0&&Q>=Q))K=Q}return K}var HJ=FX(Math.random);function FX(X){return function(K,G=0,Q=K.length){let A=Q-(G=+G);while(A){let B=X()*A--|0,E=K[A+G];K[A+G]=K[B+G],K[B+G]=E}return K}}function LX(X){return X}var c0=1,u0=2,d0=3,L0=4,F6=0.000001;function WX(X){return"translate("+X+",0)"}function RX(X){return"translate(0,"+X+")"}function DX(X){return(J)=>+X(J)}function jX(X,J){if(J=Math.max(0,X.bandwidth()-J*2)/2,X.round())J=Math.round(J);return(K)=>+X(K)+J}function MX(){return!this.__axis}function L6(X,J){var K=[],G=null,Q=null,A=6,B=6,E=3,V=typeof window<"u"&&window.devicePixelRatio>1?0:0.5,Z=X===c0||X===L0?-1:1,N=X===L0||X===u0?"x":"y",U=X===c0||X===d0?WX:RX;function H($){var _=G==null?J.ticks?J.ticks.apply(J,K):J.domain():G,I=Q==null?J.tickFormat?J.tickFormat.apply(J,K):LX:Q,w=Math.max(A,0)+E,y=J.range(),x=+y[0]+V,R=+y[y.length-1]+V,D=(J.bandwidth?jX:DX)(J.copy(),V),f=$.selection?$.selection():$,z=f.selectAll(".domain").data([null]),q=f.selectAll(".tick").data(_,J).order(),v=q.exit(),r=q.enter().append("g").attr("class","tick"),p=q.select("line"),o=q.select("text");if(z=z.merge(z.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),q=q.merge(r),p=p.merge(r.append("line").attr("stroke","currentColor").attr(N+"2",Z*A)),o=o.merge(r.append("text").attr("fill","currentColor").attr(N,Z*w).attr("dy",X===c0?"0em":X===d0?"0.71em":"0.32em")),$!==f)z=z.transition($),q=q.transition($),p=p.transition($),o=o.transition($),v=v.transition($).attr("opacity",F6).attr("transform",function(O){return isFinite(O=D(O))?U(O+V):this.getAttribute("transform")}),r.attr("opacity",F6).attr("transform",function(O){var b=this.parentNode.__axis;return U((b&&isFinite(b=b(O))?b:D(O))+V)});v.remove(),z.attr("d",X===L0||X===u0?B?"M"+Z*B+","+x+"H"+V+"V"+R+"H"+Z*B:"M"+V+","+x+"V"+R:B?"M"+x+","+Z*B+"V"+V+"H"+R+"V"+Z*B:"M"+x+","+V+"H"+R),q.attr("opacity",1).attr("transform",function(O){return U(D(O)+V)}),p.attr(N+"2",Z*A),o.attr(N,Z*w).text(I),f.filter(MX).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",X===u0?"start":X===L0?"end":"middle"),f.each(function(){this.__axis=D})}return H.scale=function($){return arguments.length?(J=$,H):J},H.ticks=function(){return K=Array.from(arguments),H},H.tickArguments=function($){return arguments.length?(K=$==null?[]:Array.from($),H):K.slice()},H.tickValues=function($){return arguments.length?(G=$==null?null:Array.from($),H):G&&G.slice()},H.tickFormat=function($){return arguments.length?(Q=$,H):Q},H.tickSize=function($){return arguments.length?(A=B=+$,H):A},H.tickSizeInner=function($){return arguments.length?(A=+$,H):A},H.tickSizeOuter=function($){return arguments.length?(B=+$,H):B},H.tickPadding=function($){return arguments.length?(E=+$,H):E},H.offset=function($){return arguments.length?(V=+$,H):V},H}function W6(X){return L6(d0,X)}function R6(X){return L6(L0,X)}function TX(X){return Math.abs(X=Math.round(X))>=1000000000000000000000?X.toLocaleString("en").replace(/,/g,""):X.toString(10)}function y0(X,J){if(!isFinite(X)||X===0)return null;var K=(X=J?X.toExponential(J-1):X.toExponential()).indexOf("e"),G=X.slice(0,K);return[G.length>1?G[0]+G.slice(2):G,+X.slice(K+1)]}function P0(X){return X=y0(Math.abs(X)),X?X[1]:NaN}function IX(X,J){return function(K,G){var Q=K.length,A=[],B=0,E=X[0],V=0;while(Q>0&&E>0){if(V+E+1>G)E=Math.max(1,G-V);if(A.push(K.substring(Q-=E,Q+E)),(V+=E+1)>G)break;E=X[B=(B+1)%X.length]}return A.reverse().join(J)}}function wX(X){return function(J){return J.replace(/[0-9]/g,function(K){return X[+K]})}}var SX=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function W0(X){if(!(J=SX.exec(X)))throw Error("invalid format: "+X);var J;return new o0({fill:J[1],align:J[2],sign:J[3],symbol:J[4],zero:J[5],width:J[6],comma:J[7],precision:J[8]&&J[8].slice(1),trim:J[9],type:J[10]})}W0.prototype=o0.prototype;function o0(X){this.fill=X.fill===void 0?" ":X.fill+"",this.align=X.align===void 0?">":X.align+"",this.sign=X.sign===void 0?"-":X.sign+"",this.symbol=X.symbol===void 0?"":X.symbol+"",this.zero=!!X.zero,this.width=X.width===void 0?void 0:+X.width,this.comma=!!X.comma,this.precision=X.precision===void 0?void 0:+X.precision,this.trim=!!X.trim,this.type=X.type===void 0?"":X.type+""}o0.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function _X(X){X:for(var J=X.length,K=1,G=-1,Q;K<J;++K)switch(X[K]){case".":G=Q=K;break;case"0":if(G===0)G=K;Q=K;break;default:if(!+X[K])break X;if(G>0)G=0;break}return G>0?X.slice(0,G)+X.slice(Q+1):X}var x0;function bX(X,J){var K=y0(X,J);if(!K)return x0=void 0,X.toPrecision(J);var G=K[0],Q=K[1],A=Q-(x0=Math.max(-8,Math.min(8,Math.floor(Q/3)))*3)+1,B=G.length;return A===B?G:A>B?G+Array(A-B+1).join("0"):A>0?G.slice(0,A)+"."+G.slice(A):"0."+Array(1-A).join("0")+y0(X,Math.max(0,J+A-1))[0]}function D6(X,J){var K=y0(X,J);if(!K)return X+"";var G=K[0],Q=K[1];return Q<0?"0."+Array(-Q).join("0")+G:G.length>Q+1?G.slice(0,Q+1)+"."+G.slice(Q+1):G+Array(Q-G.length+2).join("0")}var j6={"%":(X,J)=>(X*100).toFixed(J),b:(X)=>Math.round(X).toString(2),c:(X)=>X+"",d:TX,e:(X,J)=>X.toExponential(J),f:(X,J)=>X.toFixed(J),g:(X,J)=>X.toPrecision(J),o:(X)=>Math.round(X).toString(8),p:(X,J)=>D6(X*100,J),r:D6,s:bX,X:(X)=>Math.round(X).toString(16).toUpperCase(),x:(X)=>Math.round(X).toString(16)};function M6(X){return X}var T6=Array.prototype.map,I6=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function kX(X){var J=X.grouping===void 0||X.thousands===void 0?M6:IX(T6.call(X.grouping,Number),X.thousands+""),K=X.currency===void 0?"":X.currency[0]+"",G=X.currency===void 0?"":X.currency[1]+"",Q=X.decimal===void 0?".":X.decimal+"",A=X.numerals===void 0?M6:wX(T6.call(X.numerals,String)),B=X.percent===void 0?"%":X.percent+"",E=X.minus===void 0?"−":X.minus+"",V=X.nan===void 0?"NaN":X.nan+"";function Z(U,H){U=W0(U);var{fill:$,align:_,sign:I,symbol:w,zero:y,width:x,comma:R,precision:D,trim:f,type:z}=U;if(z==="n")R=!0,z="g";else if(!j6[z])D===void 0&&(D=12),f=!0,z="g";if(y||$==="0"&&_==="=")y=!0,$="0",_="=";var q=(H&&H.prefix!==void 0?H.prefix:"")+(w==="$"?K:w==="#"&&/[boxX]/.test(z)?"0"+z.toLowerCase():""),v=(w==="$"?G:/[%p]/.test(z)?B:"")+(H&&H.suffix!==void 0?H.suffix:""),r=j6[z],p=/[defgprs%]/.test(z);D=D===void 0?6:/[gprs]/.test(z)?Math.max(1,Math.min(21,D)):Math.max(0,Math.min(20,D));function o(O){var b=q,k=v,W,h,c;if(z==="c")k=r(O)+k,O="";else{O=+O;var l=O<0||1/O<0;if(O=isNaN(O)?V:r(Math.abs(O),D),f)O=_X(O);if(l&&+O===0&&I!=="+")l=!1;if(b=(l?I==="("?I:E:I==="-"||I==="("?"":I)+b,k=(z==="s"&&!isNaN(O)&&x0!==void 0?I6[8+x0/3]:"")+k+(l&&I==="("?")":""),p){W=-1,h=O.length;while(++W<h)if(c=O.charCodeAt(W),48>c||c>57){k=(c===46?Q+O.slice(W+1):O.slice(W))+k,O=O.slice(0,W);break}}}if(R&&!y)O=J(O,1/0);var T=b.length+O.length+k.length,M=T<x?Array(x-T+1).join($):"";if(R&&y)O=J(M+O,M.length?x-k.length:1/0),M="";switch(_){case"<":O=b+O+k+M;break;case"=":O=b+M+O+k;break;case"^":O=M.slice(0,T=M.length>>1)+b+O+k+M.slice(T);break;default:O=M+b+O+k;break}return A(O)}return o.toString=function(){return U+""},o}function N(U,H){var $=Math.max(-8,Math.min(8,Math.floor(P0(H)/3)))*3,_=Math.pow(10,-$),I=Z((U=W0(U),U.type="f",U),{suffix:I6[8+$/3]});return function(w){return I(_*w)}}return{format:Z,formatPrefix:N}}var g0,l0,n0;hX({thousands:",",grouping:[3],currency:["$",""]});function hX(X){return g0=kX(X),l0=g0.format,n0=g0.formatPrefix,g0}function w6(X){return Math.max(0,-P0(Math.abs(X)))}function S6(X,J){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(P0(J)/3)))*3-P0(Math.abs(X)))}function _6(X,J){return X=Math.abs(X),J=Math.abs(J)-X,Math.max(0,P0(J)-P0(X))+1}var r0=new Date,s0=new Date;function S(X,J,K,G){function Q(A){return X(A=arguments.length===0?new Date:new Date(+A)),A}if(Q.floor=(A)=>{return X(A=new Date(+A)),A},Q.ceil=(A)=>{return X(A=new Date(A-1)),J(A,1),X(A),A},Q.round=(A)=>{let B=Q(A),E=Q.ceil(A);return A-B<E-A?B:E},Q.offset=(A,B)=>{return J(A=new Date(+A),B==null?1:Math.floor(B)),A},Q.range=(A,B,E)=>{let V=[];if(A=Q.ceil(A),E=E==null?1:Math.floor(E),!(A<B)||!(E>0))return V;let Z;do V.push(Z=new Date(+A)),J(A,E),X(A);while(Z<A&&A<B);return V},Q.filter=(A)=>{return S((B)=>{if(B>=B)while(X(B),!A(B))B.setTime(B-1)},(B,E)=>{if(B>=B)if(E<0)while(++E<=0)while(J(B,-1),!A(B));else while(--E>=0)while(J(B,1),!A(B));})},K)Q.count=(A,B)=>{return r0.setTime(+A),s0.setTime(+B),X(r0),X(s0),Math.floor(K(r0,s0))},Q.every=(A)=>{return A=Math.floor(A),!isFinite(A)||!(A>0)?null:!(A>1)?Q:Q.filter(G?(B)=>G(B)%A===0:(B)=>Q.count(0,B)%A===0)};return Q}var f0=S(()=>{},(X,J)=>{X.setTime(+X+J)},(X,J)=>{return J-X});f0.every=(X)=>{if(X=Math.floor(X),!isFinite(X)||!(X>0))return null;if(!(X>1))return f0;return S((J)=>{J.setTime(Math.floor(J/X)*X)},(J,K)=>{J.setTime(+J+K*X)},(J,K)=>{return(K-J)/X})};var $J=f0.range,a=1000,n=a*60,e=n*60,X0=e*24,t0=X0*7,b6=X0*30,i0=X0*365,K0=S((X)=>{X.setTime(X-X.getMilliseconds())},(X,J)=>{X.setTime(+X+J*a)},(X,J)=>{return(J-X)/a},(X)=>{return X.getUTCSeconds()}),OJ=K0.range,v0=S((X)=>{X.setTime(X-X.getMilliseconds()-X.getSeconds()*a)},(X,J)=>{X.setTime(+X+J*n)},(X,J)=>{return(J-X)/n},(X)=>{return X.getMinutes()}),YJ=v0.range,a0=S((X)=>{X.setUTCSeconds(0,0)},(X,J)=>{X.setTime(+X+J*n)},(X,J)=>{return(J-X)/n},(X)=>{return X.getUTCMinutes()}),qJ=a0.range,m0=S((X)=>{X.setTime(X-X.getMilliseconds()-X.getSeconds()*a-X.getMinutes()*n)},(X,J)=>{X.setTime(+X+J*e)},(X,J)=>{return(J-X)/e},(X)=>{return X.getHours()}),FJ=m0.range,e0=S((X)=>{X.setUTCMinutes(0,0,0)},(X,J)=>{X.setTime(+X+J*e)},(X,J)=>{return(J-X)/e},(X)=>{return X.getUTCHours()}),LJ=e0.range,Z0=S((X)=>X.setHours(0,0,0,0),(X,J)=>X.setDate(X.getDate()+J),(X,J)=>(J-X-(J.getTimezoneOffset()-X.getTimezoneOffset())*n)/X0,(X)=>X.getDate()-1),WJ=Z0.range,R0=S((X)=>{X.setUTCHours(0,0,0,0)},(X,J)=>{X.setUTCDate(X.getUTCDate()+J)},(X,J)=>{return(J-X)/X0},(X)=>{return X.getUTCDate()-1}),RJ=R0.range,k6=S((X)=>{X.setUTCHours(0,0,0,0)},(X,J)=>{X.setUTCDate(X.getUTCDate()+J)},(X,J)=>{return(J-X)/X0},(X)=>{return Math.floor(X/X0)}),DJ=k6.range;function E0(X){return S((J)=>{J.setDate(J.getDate()-(J.getDay()+7-X)%7),J.setHours(0,0,0,0)},(J,K)=>{J.setDate(J.getDate()+K*7)},(J,K)=>{return(K-J-(K.getTimezoneOffset()-J.getTimezoneOffset())*n)/t0})}var $0=E0(0),D0=E0(1),gX=E0(2),yX=E0(3),V0=E0(4),xX=E0(5),fX=E0(6),jJ=$0.range,MJ=D0.range,TJ=gX.range,IJ=yX.range,wJ=V0.range,SJ=xX.range,_J=fX.range;function C0(X){return S((J)=>{J.setUTCDate(J.getUTCDate()-(J.getUTCDay()+7-X)%7),J.setUTCHours(0,0,0,0)},(J,K)=>{J.setUTCDate(J.getUTCDate()+K*7)},(J,K)=>{return(K-J)/t0})}var j0=C0(0),M0=C0(1),vX=C0(2),mX=C0(3),H0=C0(4),pX=C0(5),cX=C0(6),bJ=j0.range,kJ=M0.range,hJ=vX.range,gJ=mX.range,yJ=H0.range,xJ=pX.range,fJ=cX.range,p0=S((X)=>{X.setDate(1),X.setHours(0,0,0,0)},(X,J)=>{X.setMonth(X.getMonth()+J)},(X,J)=>{return J.getMonth()-X.getMonth()+(J.getFullYear()-X.getFullYear())*12},(X)=>{return X.getMonth()}),vJ=p0.range,X6=S((X)=>{X.setUTCDate(1),X.setUTCHours(0,0,0,0)},(X,J)=>{X.setUTCMonth(X.getUTCMonth()+J)},(X,J)=>{return J.getUTCMonth()-X.getUTCMonth()+(J.getUTCFullYear()-X.getUTCFullYear())*12},(X)=>{return X.getUTCMonth()}),mJ=X6.range,s=S((X)=>{X.setMonth(0,1),X.setHours(0,0,0,0)},(X,J)=>{X.setFullYear(X.getFullYear()+J)},(X,J)=>{return J.getFullYear()-X.getFullYear()},(X)=>{return X.getFullYear()});s.every=(X)=>{return!isFinite(X=Math.floor(X))||!(X>0)?null:S((J)=>{J.setFullYear(Math.floor(J.getFullYear()/X)*X),J.setMonth(0,1),J.setHours(0,0,0,0)},(J,K)=>{J.setFullYear(J.getFullYear()+K*X)})};var pJ=s.range,i=S((X)=>{X.setUTCMonth(0,1),X.setUTCHours(0,0,0,0)},(X,J)=>{X.setUTCFullYear(X.getUTCFullYear()+J)},(X,J)=>{return J.getUTCFullYear()-X.getUTCFullYear()},(X)=>{return X.getUTCFullYear()});i.every=(X)=>{return!isFinite(X=Math.floor(X))||!(X>0)?null:S((J)=>{J.setUTCFullYear(Math.floor(J.getUTCFullYear()/X)*X),J.setUTCMonth(0,1),J.setUTCHours(0,0,0,0)},(J,K)=>{J.setUTCFullYear(J.getUTCFullYear()+K*X)})};var cJ=i.range;function h6(X,J,K,G,Q,A){let B=[[K0,1,a],[K0,5,5*a],[K0,15,15*a],[K0,30,30*a],[A,1,n],[A,5,5*n],[A,15,15*n],[A,30,30*n],[Q,1,e],[Q,3,3*e],[Q,6,6*e],[Q,12,12*e],[G,1,X0],[G,2,2*X0],[K,1,t0],[J,1,b6],[J,3,3*b6],[X,1,i0]];function E(Z,N,U){let H=N<Z;if(H)[Z,N]=[N,Z];let $=U&&typeof U.range==="function"?U:V(Z,N,U),_=$?$.range(Z,+N+1):[];return H?_.reverse():_}function V(Z,N,U){let H=Math.abs(N-Z)/U,$=h0(([,,w])=>w).right(B,H);if($===B.length)return X.every(F0(Z/i0,N/i0,U));if($===0)return f0.every(Math.max(F0(Z,N,U),1));let[_,I]=B[H/B[$-1][2]<B[$][2]/H?$-1:$];return _.every(I)}return[E,V]}var[uX,dX]=h6(i,X6,j0,k6,e0,a0),[g6,y6]=h6(s,p0,$0,Z0,m0,v0);function J6(X){if(0<=X.y&&X.y<100){var J=new Date(-1,X.m,X.d,X.H,X.M,X.S,X.L);return J.setFullYear(X.y),J}return new Date(X.y,X.m,X.d,X.H,X.M,X.S,X.L)}function K6(X){if(0<=X.y&&X.y<100){var J=new Date(Date.UTC(-1,X.m,X.d,X.H,X.M,X.S,X.L));return J.setUTCFullYear(X.y),J}return new Date(Date.UTC(X.y,X.m,X.d,X.H,X.M,X.S,X.L))}function T0(X,J,K){return{y:X,m:J,d:K,H:0,M:0,S:0,L:0}}function oX(X){var{dateTime:J,date:K,time:G,periods:Q,days:A,shortDays:B,months:E,shortMonths:V}=X,Z=I0(Q),N=w0(Q),U=I0(A),H=w0(A),$=I0(B),_=w0(B),I=I0(E),w=w0(E),y=I0(V),x=w0(V),R={a:c,A:l,b:T,B:M,c:null,d:c6,e:c6,f:z7,g:D7,G:M7,H:H7,I:N7,j:U7,L:n6,m:P7,M:$7,p:J0,q:t,Q:o6,s:l6,S:O7,u:Y7,U:q7,V:F7,w:L7,W:W7,x:null,X:null,y:R7,Y:j7,Z:T7,"%":d6},D={a:G0,A:A0,b:Q0,B:N0,c:null,d:u6,e:u6,f:_7,g:p7,G:u7,H:I7,I:w7,j:S7,L:s6,m:b7,M:k7,p:_0,q:CX,Q:o6,s:l6,S:h7,u:g7,U:y7,V:x7,w:f7,W:v7,x:null,X:null,y:m7,Y:c7,Z:d7,"%":d6},f={a:p,A:o,b:O,B:b,c:k,d:m6,e:m6,f:Z7,g:v6,G:f6,H:p6,I:p6,j:G7,L:B7,m:K7,M:A7,p:r,q:J7,Q:V7,s:C7,S:Q7,u:iX,U:tX,V:aX,w:sX,W:eX,x:W,X:h,y:v6,Y:f6,Z:X7,"%":E7};R.x=z(K,R),R.X=z(G,R),R.c=z(J,R),D.x=z(K,D),D.X=z(G,D),D.c=z(J,D);function z(P,Y){return function(F){var C=[],m=-1,j=0,u=P.length,d,B0,N6;if(!(F instanceof Date))F=new Date(+F);while(++m<u)if(P.charCodeAt(m)===37){if(C.push(P.slice(j,m)),(B0=x6[d=P.charAt(++m)])!=null)d=P.charAt(++m);else B0=d==="e"?" ":"0";if(N6=Y[d])d=N6(F,B0);C.push(d),j=m+1}return C.push(P.slice(j,m)),C.join("")}}function q(P,Y){return function(F){var C=T0(1900,void 0,1),m=v(C,P,F+="",0),j,u;if(m!=F.length)return null;if("Q"in C)return new Date(C.Q);if("s"in C)return new Date(C.s*1000+("L"in C?C.L:0));if(Y&&!("Z"in C))C.Z=0;if("p"in C)C.H=C.H%12+C.p*12;if(C.m===void 0)C.m="q"in C?C.q:0;if("V"in C){if(C.V<1||C.V>53)return null;if(!("w"in C))C.w=1;if("Z"in C)j=K6(T0(C.y,0,1)),u=j.getUTCDay(),j=u>4||u===0?M0.ceil(j):M0(j),j=R0.offset(j,(C.V-1)*7),C.y=j.getUTCFullYear(),C.m=j.getUTCMonth(),C.d=j.getUTCDate()+(C.w+6)%7;else j=J6(T0(C.y,0,1)),u=j.getDay(),j=u>4||u===0?D0.ceil(j):D0(j),j=Z0.offset(j,(C.V-1)*7),C.y=j.getFullYear(),C.m=j.getMonth(),C.d=j.getDate()+(C.w+6)%7}else if("W"in C||"U"in C){if(!("w"in C))C.w="u"in C?C.u%7:("W"in C)?1:0;u="Z"in C?K6(T0(C.y,0,1)).getUTCDay():J6(T0(C.y,0,1)).getDay(),C.m=0,C.d="W"in C?(C.w+6)%7+C.W*7-(u+5)%7:C.w+C.U*7-(u+6)%7}if("Z"in C)return C.H+=C.Z/100|0,C.M+=C.Z%100,K6(C);return J6(C)}}function v(P,Y,F,C){var m=0,j=Y.length,u=F.length,d,B0;while(m<j){if(C>=u)return-1;if(d=Y.charCodeAt(m++),d===37){if(d=Y.charAt(m++),B0=f[d in x6?Y.charAt(m++):d],!B0||(C=B0(P,F,C))<0)return-1}else if(d!=F.charCodeAt(C++))return-1}return C}function r(P,Y,F){var C=Z.exec(Y.slice(F));return C?(P.p=N.get(C[0].toLowerCase()),F+C[0].length):-1}function p(P,Y,F){var C=$.exec(Y.slice(F));return C?(P.w=_.get(C[0].toLowerCase()),F+C[0].length):-1}function o(P,Y,F){var C=U.exec(Y.slice(F));return C?(P.w=H.get(C[0].toLowerCase()),F+C[0].length):-1}function O(P,Y,F){var C=y.exec(Y.slice(F));return C?(P.m=x.get(C[0].toLowerCase()),F+C[0].length):-1}function b(P,Y,F){var C=I.exec(Y.slice(F));return C?(P.m=w.get(C[0].toLowerCase()),F+C[0].length):-1}function k(P,Y,F){return v(P,J,Y,F)}function W(P,Y,F){return v(P,K,Y,F)}function h(P,Y,F){return v(P,G,Y,F)}function c(P){return B[P.getDay()]}function l(P){return A[P.getDay()]}function T(P){return V[P.getMonth()]}function M(P){return E[P.getMonth()]}function J0(P){return Q[+(P.getHours()>=12)]}function t(P){return 1+~~(P.getMonth()/3)}function G0(P){return B[P.getUTCDay()]}function A0(P){return A[P.getUTCDay()]}function Q0(P){return V[P.getUTCMonth()]}function N0(P){return E[P.getUTCMonth()]}function _0(P){return Q[+(P.getUTCHours()>=12)]}function CX(P){return 1+~~(P.getUTCMonth()/3)}return{format:function(P){var Y=z(P+="",R);return Y.toString=function(){return P},Y},parse:function(P){var Y=q(P+="",!1);return Y.toString=function(){return P},Y},utcFormat:function(P){var Y=z(P+="",D);return Y.toString=function(){return P},Y},utcParse:function(P){var Y=q(P+="",!0);return Y.toString=function(){return P},Y}}}var x6={"-":"",_:" ","0":"0"},g=/^\s*\d+/,lX=/^%/,nX=/[\\^$*+?|[\]().{}]/g;function L(X,J,K){var G=X<0?"-":"",Q=(G?-X:X)+"",A=Q.length;return G+(A<K?Array(K-A+1).join(J)+Q:Q)}function rX(X){return X.replace(nX,"\\$&")}function I0(X){return new RegExp("^(?:"+X.map(rX).join("|")+")","i")}function w0(X){return new Map(X.map((J,K)=>[J.toLowerCase(),K]))}function sX(X,J,K){var G=g.exec(J.slice(K,K+1));return G?(X.w=+G[0],K+G[0].length):-1}function iX(X,J,K){var G=g.exec(J.slice(K,K+1));return G?(X.u=+G[0],K+G[0].length):-1}function tX(X,J,K){var G=g.exec(J.slice(K,K+2));return G?(X.U=+G[0],K+G[0].length):-1}function aX(X,J,K){var G=g.exec(J.slice(K,K+2));return G?(X.V=+G[0],K+G[0].length):-1}function eX(X,J,K){var G=g.exec(J.slice(K,K+2));return G?(X.W=+G[0],K+G[0].length):-1}function f6(X,J,K){var G=g.exec(J.slice(K,K+4));return G?(X.y=+G[0],K+G[0].length):-1}function v6(X,J,K){var G=g.exec(J.slice(K,K+2));return G?(X.y=+G[0]+(+G[0]>68?1900:2000),K+G[0].length):-1}function X7(X,J,K){var G=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(J.slice(K,K+6));return G?(X.Z=G[1]?0:-(G[2]+(G[3]||"00")),K+G[0].length):-1}function J7(X,J,K){var G=g.exec(J.slice(K,K+1));return G?(X.q=G[0]*3-3,K+G[0].length):-1}function K7(X,J,K){var G=g.exec(J.slice(K,K+2));return G?(X.m=G[0]-1,K+G[0].length):-1}function m6(X,J,K){var G=g.exec(J.slice(K,K+2));return G?(X.d=+G[0],K+G[0].length):-1}function G7(X,J,K){var G=g.exec(J.slice(K,K+3));return G?(X.m=0,X.d=+G[0],K+G[0].length):-1}function p6(X,J,K){var G=g.exec(J.slice(K,K+2));return G?(X.H=+G[0],K+G[0].length):-1}function A7(X,J,K){var G=g.exec(J.slice(K,K+2));return G?(X.M=+G[0],K+G[0].length):-1}function Q7(X,J,K){var G=g.exec(J.slice(K,K+2));return G?(X.S=+G[0],K+G[0].length):-1}function B7(X,J,K){var G=g.exec(J.slice(K,K+3));return G?(X.L=+G[0],K+G[0].length):-1}function Z7(X,J,K){var G=g.exec(J.slice(K,K+6));return G?(X.L=Math.floor(G[0]/1000),K+G[0].length):-1}function E7(X,J,K){var G=lX.exec(J.slice(K,K+1));return G?K+G[0].length:-1}function V7(X,J,K){var G=g.exec(J.slice(K));return G?(X.Q=+G[0],K+G[0].length):-1}function C7(X,J,K){var G=g.exec(J.slice(K));return G?(X.s=+G[0],K+G[0].length):-1}function c6(X,J){return L(X.getDate(),J,2)}function H7(X,J){return L(X.getHours(),J,2)}function N7(X,J){return L(X.getHours()%12||12,J,2)}function U7(X,J){return L(1+Z0.count(s(X),X),J,3)}function n6(X,J){return L(X.getMilliseconds(),J,3)}function z7(X,J){return n6(X,J)+"000"}function P7(X,J){return L(X.getMonth()+1,J,2)}function $7(X,J){return L(X.getMinutes(),J,2)}function O7(X,J){return L(X.getSeconds(),J,2)}function Y7(X){var J=X.getDay();return J===0?7:J}function q7(X,J){return L($0.count(s(X)-1,X),J,2)}function r6(X){var J=X.getDay();return J>=4||J===0?V0(X):V0.ceil(X)}function F7(X,J){return X=r6(X),L(V0.count(s(X),X)+(s(X).getDay()===4),J,2)}function L7(X){return X.getDay()}function W7(X,J){return L(D0.count(s(X)-1,X),J,2)}function R7(X,J){return L(X.getFullYear()%100,J,2)}function D7(X,J){return X=r6(X),L(X.getFullYear()%100,J,2)}function j7(X,J){return L(X.getFullYear()%1e4,J,4)}function M7(X,J){var K=X.getDay();return X=K>=4||K===0?V0(X):V0.ceil(X),L(X.getFullYear()%1e4,J,4)}function T7(X){var J=X.getTimezoneOffset();return(J>0?"-":(J*=-1,"+"))+L(J/60|0,"0",2)+L(J%60,"0",2)}function u6(X,J){return L(X.getUTCDate(),J,2)}function I7(X,J){return L(X.getUTCHours(),J,2)}function w7(X,J){return L(X.getUTCHours()%12||12,J,2)}function S7(X,J){return L(1+R0.count(i(X),X),J,3)}function s6(X,J){return L(X.getUTCMilliseconds(),J,3)}function _7(X,J){return s6(X,J)+"000"}function b7(X,J){return L(X.getUTCMonth()+1,J,2)}function k7(X,J){return L(X.getUTCMinutes(),J,2)}function h7(X,J){return L(X.getUTCSeconds(),J,2)}function g7(X){var J=X.getUTCDay();return J===0?7:J}function y7(X,J){return L(j0.count(i(X)-1,X),J,2)}function i6(X){var J=X.getUTCDay();return J>=4||J===0?H0(X):H0.ceil(X)}function x7(X,J){return X=i6(X),L(H0.count(i(X),X)+(i(X).getUTCDay()===4),J,2)}function f7(X){return X.getUTCDay()}function v7(X,J){return L(M0.count(i(X)-1,X),J,2)}function m7(X,J){return L(X.getUTCFullYear()%100,J,2)}function p7(X,J){return X=i6(X),L(X.getUTCFullYear()%100,J,2)}function c7(X,J){return L(X.getUTCFullYear()%1e4,J,4)}function u7(X,J){var K=X.getUTCDay();return X=K>=4||K===0?H0(X):H0.ceil(X),L(X.getUTCFullYear()%1e4,J,4)}function d7(){return"+0000"}function d6(){return"%"}function o6(X){return+X}function l6(X){return Math.floor(+X/1000)}var O0,S0,o7,G6,t6;l7({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function l7(X){return O0=oX(X),S0=O0.format,o7=O0.parse,G6=O0.utcFormat,t6=O0.utcParse,O0}var a6="%Y-%m-%dT%H:%M:%S.%LZ";function n7(X){return X.toISOString()}var oJ=Date.prototype.toISOString?n7:G6(a6);function r7(X){var J=new Date(X);return isNaN(J)?null:J}var lJ=+new Date("2000-01-01T00:00:00.000Z")?r7:t6(a6);function GX(X,J){switch(arguments.length){case 0:break;case 1:this.range(X);break;default:this.range(J).domain(X);break}return this}var AK=Symbol("implicit");function s7(X){return function(){return X}}function i7(X){return+X}var e6=[0,1];function Y0(X){return X}function A6(X,J){return(J-=X=+X)?function(K){return(K-X)/J}:s7(isNaN(J)?NaN:0.5)}function t7(X,J){var K;if(X>J)K=X,X=J,J=K;return function(G){return Math.max(X,Math.min(J,G))}}function a7(X,J,K){var G=X[0],Q=X[1],A=J[0],B=J[1];if(Q<G)G=A6(Q,G),A=K(B,A);else G=A6(G,Q),A=K(A,B);return function(E){return A(G(E))}}function e7(X,J,K){var G=Math.min(X.length,J.length)-1,Q=Array(G),A=Array(G),B=-1;if(X[G]<X[0])X=X.slice().reverse(),J=J.slice().reverse();while(++B<G)Q[B]=A6(X[B],X[B+1]),A[B]=K(J[B],J[B+1]);return function(E){var V=z6(X,E,1,G)-1;return A[V](Q[V](E))}}function AX(X,J){return J.domain(X.domain()).range(X.range()).interpolate(X.interpolate()).clamp(X.clamp()).unknown(X.unknown())}function XJ(){var X=e6,J=e6,K=JX,G,Q,A,B=Y0,E,V,Z;function N(){var H=Math.min(X.length,J.length);if(B!==Y0)B=t7(X[0],X[H-1]);return E=H>2?e7:a7,V=Z=null,U}function U(H){return H==null||isNaN(H=+H)?A:(V||(V=E(X.map(G),J,K)))(G(B(H)))}return U.invert=function(H){return B(Q((Z||(Z=E(J,X.map(G),XX)))(H)))},U.domain=function(H){return arguments.length?(X=Array.from(H,i7),N()):X.slice()},U.range=function(H){return arguments.length?(J=Array.from(H),N()):J.slice()},U.rangeRound=function(H){return J=Array.from(H),K=KX,N()},U.clamp=function(H){return arguments.length?(B=H?!0:Y0,N()):B!==Y0},U.interpolate=function(H){return arguments.length?(K=H,N()):K},U.unknown=function(H){return arguments.length?(A=H,U):A},function(H,$){return G=H,Q=$,N()}}function QX(){return XJ()(Y0,Y0)}function JJ(X,J,K,G){var Q=F0(X,J,K),A;switch(G=W0(G==null?",f":G),G.type){case"s":{var B=Math.max(Math.abs(X),Math.abs(J));if(G.precision==null&&!isNaN(A=S6(Q,B)))G.precision=A;return n0(G,B)}case"":case"e":case"g":case"p":case"r":{if(G.precision==null&&!isNaN(A=_6(Q,Math.max(Math.abs(X),Math.abs(J)))))G.precision=A-(G.type==="e");break}case"f":case"%":{if(G.precision==null&&!isNaN(A=w6(Q)))G.precision=A-(G.type==="%")*2;break}}return l0(G)}function KJ(X){var J=X.domain;return X.ticks=function(K){var G=J();return O6(G[0],G[G.length-1],K==null?10:K)},X.tickFormat=function(K,G){var Q=J();return JJ(Q[0],Q[Q.length-1],K==null?10:K,G)},X.nice=function(K){if(K==null)K=10;var G=J(),Q=0,A=G.length-1,B=G[Q],E=G[A],V,Z,N=10;if(E<B)Z=B,B=E,E=Z,Z=Q,Q=A,A=Z;while(N-- >0){if(Z=k0(B,E,K),Z===V)return G[Q]=B,G[A]=E,J(G);else if(Z>0)B=Math.floor(B/Z)*Z,E=Math.ceil(E/Z)*Z;else if(Z<0)B=Math.ceil(B*Z)/Z,E=Math.floor(E*Z)/Z;else break;V=Z}return X},X}function Q6(){var X=QX();return X.copy=function(){return AX(X,Q6())},GX.apply(X,arguments),KJ(X)}function GJ(X,J){X=X.slice();var K=0,G=X.length-1,Q=X[K],A=X[G],B;if(A<Q)B=K,K=G,G=B,B=Q,Q=A,A=B;return X[K]=J.floor(Q),X[G]=J.ceil(A),X}function AJ(X){return new Date(X)}function QJ(X){return X instanceof Date?+X:Math.round(X)}function BX(X,J,K,G,Q,A,B,E,V,Z){var N=QX(),U=N.invert,H=N.domain,$=Z(".%L"),_=Z(":%S"),I=Z("%I:%M"),w=Z("%I %p"),y=Z("%a %d"),x=Z("%b %d"),R=Z("%B"),D=Z("%Y");function f(z){return(V(z)<z?$:E(z)<z?_:B(z)<z?I:A(z)<z?w:G(z)<z?Q(z)<z?y:x:K(z)<z?R:D)(z)}return N.invert=function(z){return new Date(Math.round(U(z)))},N.domain=function(z){return arguments.length?H(Array.from(z,QJ)):H().map(AJ)},N.ticks=function(z){var q=H();return X(q[0],q[q.length-1],z==null?10:z)},N.tickFormat=function(z,q){return q==null?f:Z(q)},N.nice=function(z){var q=H();if(!z||typeof z.range!=="function")z=J(q[0],q[q.length-1],z==null?10:z);return z?H(GJ(q,z)):N},N.copy=function(){return AX(N,BX(X,J,K,G,Q,A,B,E,V,Z))},N}function ZX(){return GX.apply(BX(g6,y6,s,p0,$0,Z0,m0,v0,K0,S0).domain([new Date(2000,0,1),new Date(2000,0,2)]),arguments)}var H6=86400000,B6=90*H6;function CK(X={}){return async function(K){K.innerHTML="";let{memories:G}=await EX.listMemories({limit:500}),Q=G.map((W)=>({...W,createdAt:new Date(W.createdAt)})),A=K.clientWidth||1200,B=600,E={top:40,right:40,bottom:60,left:120},V=A-E.left-E.right,Z=B-E.top-E.bottom,N=Z/5,H=V6(K).append("svg").attr("width",A).attr("height",B).append("g").attr("transform",`translate(${E.left},${E.top})`),$=Q.map((W)=>new Date(W.createdAt)),_=q6($)??new Date,I=Y6($)??new Date,w=ZX().domain([_,new Date(I.getTime()+B6)]).range([0,V]);H.append("g").attr("transform",`translate(0,${Z})`).call(W6(w).ticks(10).tickFormat(S0("%d %b"))).selectAll("text").style("fill","#a1a1aa").style("font-size","11px"),H.append("g").call(R6(Q6().domain([0,5]).range([0,Z])).ticks(5).tickFormat((W)=>C6[Number(W)]??"")).selectAll("text").style("fill","#a1a1aa").style("font-size","11px");for(let W=0;W<=5;W++)H.append("line").attr("class","river-lane").attr("stroke","#262b38").attr("x1",0).attr("x2",V).attr("y1",W*N).attr("y2",W*N);let y=H.append("line").attr("stroke","#8b5cf6").attr("stroke-width",2).attr("stroke-dasharray","6 4").attr("y1",0).attr("y2",Z),x=H.append("g"),R=document.createElement("div");R.className="river-tooltip",R.style.display="none",document.body.appendChild(R);let D=0;function f(W,h){let c=new Date(Date.now()+D),l=Z6(h,c),T=E6(h,c);R.replaceChildren();let M=document.createElement("div");M.style.marginBottom=".5rem",M.style.fontWeight="600",M.textContent=C6[l];let J0=document.createElement("div");J0.style.marginBottom=".5rem",J0.textContent=h.content.slice(0,100)+(h.content.length>100?"…":"");let t=document.createElement("div");t.style.color="var(--muted)",t.style.fontSize=".8rem";let G0=document.createElement("div");G0.textContent=`Strength: ${T}/100`;let A0=document.createElement("div");A0.textContent=`Recalls: ${h.recallCount}`;let Q0=document.createElement("div");if(Q0.textContent=`Encoded: ${new Date(h.createdAt).toLocaleDateString()}`,t.append(G0,A0,Q0),h.photographic){let N0=document.createElement("div");N0.style.color="#8b5cf6",N0.textContent="\uD83D\uDD12 Photographic",t.append(N0)}R.append(M,J0,t),R.style.display="block",R.style.left=`${W.pageX+10}px`,R.style.top=`${W.pageY-10}px`}function z(W=0){let h=new Date(Date.now()+W);y.attr("x1",w(h)).attr("x2",w(h));let c=x.selectAll(".river-memory").data(Q,(T)=>T.id);c.exit().remove();let l=c.enter().append("g").attr("class","river-memory").style("cursor","pointer").on("click",(T,M)=>X.onSelectMemory?.(M.id)).on("mouseover",(T,M)=>f(T,M)).on("mouseout",()=>{R.style.display="none"});l.append("rect").attr("rx",6).attr("ry",6),l.append("text").attr("font-size","9px").attr("fill","#e4e4e7").attr("text-anchor","middle").attr("dy","0.35em"),l.merge(c).each(function(T){let M=new Date(new Date(T.createdAt).getTime()+W),J0=Z6(T,M),t=E6(T,M),G0=w(new Date(T.createdAt)),A0=J0*N+N/2,Q0=Math.max(30,Math.min(80,T.content.length/3)),N0=20,_0=V6(this);_0.select("rect").attr("x",G0-Q0/2).attr("y",A0-10).attr("width",Q0).attr("height",20).attr("fill",VX[J0]).attr("opacity",Math.max(0.3,t/100)).attr("stroke",T.photographic?"#8b5cf6":"none").attr("stroke-width",T.photographic?2:0),_0.select("text").attr("x",G0).attr("y",A0).text(T.content.slice(0,12))})}z(0);let q=document.createElement("div");q.className="river-controls",q.innerHTML=`
|
|
2
|
+
<button type="button" data-role="play">▶ Play</button>
|
|
3
|
+
<input type="range" data-role="slider" min="0" max="${B6}" value="0" step="${3600000}">
|
|
4
|
+
<span data-role="label">Today</span>
|
|
5
|
+
<button type="button" data-role="reset">↺ Reset</button>`,K.appendChild(q);let v=q.querySelector('[data-role="slider"]'),r=q.querySelector('[data-role="label"]'),p=q.querySelector('[data-role="play"]'),o=q.querySelector('[data-role="reset"]'),O=null,b=(W)=>{D=W,v.value=String(W);let h=Math.floor(W/H6);r.textContent=h===0?"Today":`D+${h} days`,z(W)},k=()=>{if(O)clearInterval(O);O=null,p.textContent="▶ Play"};return v.addEventListener("input",()=>b(Number(v.value))),p.addEventListener("click",()=>{if(O){k();return}p.textContent="⏸ Pause",O=setInterval(()=>b(D>=B6?0:D+H6),200)}),o.addEventListener("click",()=>{k(),b(0)}),()=>{k(),R.remove(),K.innerHTML=""}}}export{CK as createMount};
|
|
@@ -3,10 +3,11 @@ import { mkdir, readFile, writeFile, rename, rm } from 'fs/promises';
|
|
|
3
3
|
import { randomUUID } from 'crypto';
|
|
4
4
|
import { dirname, join, resolve } from 'path';
|
|
5
5
|
import { homedir } from 'os';
|
|
6
|
+
import { isDeepStrictEqual } from 'util';
|
|
6
7
|
import { databasePath } from '../core/paths.js';
|
|
7
8
|
import { AdvisoryLock } from '../store/sqlite.js';
|
|
8
9
|
|
|
9
|
-
export type HumemoryMcpClient = 'kimi' | 'opencode';
|
|
10
|
+
export type HumemoryMcpClient = 'kimi' | 'opencode' | 'codex' | 'claude';
|
|
10
11
|
|
|
11
12
|
export interface McpClientSetupOptions {
|
|
12
13
|
clients: HumemoryMcpClient[];
|
|
@@ -15,6 +16,8 @@ export interface McpClientSetupOptions {
|
|
|
15
16
|
bunPath?: string;
|
|
16
17
|
kimiHome?: string;
|
|
17
18
|
openCodeConfig?: string;
|
|
19
|
+
codexHome?: string;
|
|
20
|
+
claudeConfig?: string;
|
|
18
21
|
dryRun?: boolean;
|
|
19
22
|
}
|
|
20
23
|
|
|
@@ -53,18 +56,29 @@ async function mergeFile(
|
|
|
53
56
|
path: string,
|
|
54
57
|
update: (current: Record<string, unknown>) => Record<string, unknown>,
|
|
55
58
|
dryRun: boolean,
|
|
59
|
+
): Promise<boolean> {
|
|
60
|
+
return mergeTextFile(path, (original) => {
|
|
61
|
+
const current = readJson(original, path);
|
|
62
|
+
const before = JSON.stringify(current);
|
|
63
|
+
const next = update(current);
|
|
64
|
+
return before === JSON.stringify(next) ? original : `${JSON.stringify(next, null, 2)}\n`;
|
|
65
|
+
}, dryRun);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async function mergeTextFile(
|
|
69
|
+
path: string,
|
|
70
|
+
update: (original: string | null) => string | null,
|
|
71
|
+
dryRun: boolean,
|
|
56
72
|
): Promise<boolean> {
|
|
57
73
|
const apply = async () => {
|
|
58
74
|
const original = await readOptional(path);
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
const changed = before !== JSON.stringify(next);
|
|
63
|
-
if (changed && !dryRun) {
|
|
75
|
+
const next = update(original);
|
|
76
|
+
const changed = original !== next;
|
|
77
|
+
if (changed && next !== null && !dryRun) {
|
|
64
78
|
await mkdir(dirname(path), { recursive: true });
|
|
65
79
|
const temporary = `${path}.${randomUUID()}.tmp`;
|
|
66
80
|
try {
|
|
67
|
-
await writeFile(temporary,
|
|
81
|
+
await writeFile(temporary, next, { mode: 0o600, flag: 'wx' });
|
|
68
82
|
if (original !== null) await writeFile(`${path}.${randomUUID()}.bak`, original, { mode: 0o600, flag: 'wx' });
|
|
69
83
|
if (await readOptional(path) !== original) throw new Error(`Configuration changed during setup: ${path}`);
|
|
70
84
|
await rename(temporary, path);
|
|
@@ -77,6 +91,53 @@ async function mergeFile(
|
|
|
77
91
|
return new AdvisoryLock(path + '.setup', 50).withLock(apply);
|
|
78
92
|
}
|
|
79
93
|
|
|
94
|
+
/** Encode only the server's values; the rest of the TOML stays byte-for-byte intact. */
|
|
95
|
+
function tomlValue(value: unknown): string {
|
|
96
|
+
if (typeof value === 'string') return JSON.stringify(value);
|
|
97
|
+
if (typeof value === 'boolean' || typeof value === 'number') return String(value);
|
|
98
|
+
if (value instanceof Date) return value.toISOString();
|
|
99
|
+
if (Array.isArray(value)) return `[${value.map(tomlValue).join(', ')}]`;
|
|
100
|
+
if (value && typeof value === 'object') {
|
|
101
|
+
return `{ ${Object.entries(value).map(([k, v]) => `${JSON.stringify(k)} = ${tomlValue(v)}`).join(', ')} }`;
|
|
102
|
+
}
|
|
103
|
+
throw new Error('Unsupported value in Codex humemory configuration');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function mergeCodexToml(original: string | null, path: string, server: Record<string, unknown>): string {
|
|
107
|
+
const raw = original ?? '';
|
|
108
|
+
let current: Record<string, any>;
|
|
109
|
+
try { current = Bun.TOML.parse(raw); }
|
|
110
|
+
catch { throw new Error(`Refusing to rewrite invalid TOML: ${path}`); }
|
|
111
|
+
const existing = current.mcp_servers?.humemory;
|
|
112
|
+
if (existing !== undefined && (!existing || typeof existing !== 'object' || Array.isArray(existing))) {
|
|
113
|
+
throw new Error(`Refusing to rewrite invalid Codex humemory table: ${path}`);
|
|
114
|
+
}
|
|
115
|
+
if (existing?.url !== undefined) throw new Error(`Refusing to replace a remote Codex humemory server: ${path}`);
|
|
116
|
+
const next = { ...existing, ...server, env: { ...existing?.env, ...server.env as object } };
|
|
117
|
+
if (isDeepStrictEqual(existing, next)) return raw;
|
|
118
|
+
|
|
119
|
+
// Recognise ordinary table headers, including quoted names. The semantic check
|
|
120
|
+
// below refuses inline/dotted definitions and apparent headers inside strings.
|
|
121
|
+
const key = `(?:mcp_servers|"mcp_servers"|'mcp_servers')\\s*\\.\\s*(?:humemory|"humemory"|'humemory')`;
|
|
122
|
+
const owned = new RegExp(`^\\s*\\[\\s*${key}(?:\\s*\\.[^\\]]+)?\\s*\\]\\s*(?:#.*)?$`);
|
|
123
|
+
let removing = false;
|
|
124
|
+
const kept = raw.split(/(?<=\n)/).filter((line) => {
|
|
125
|
+
if (/^\s*\[/.test(line)) removing = owned.test(line.trimEnd());
|
|
126
|
+
return !removing;
|
|
127
|
+
}).join('');
|
|
128
|
+
const eol = raw.includes('\r\n') ? '\r\n' : '\n';
|
|
129
|
+
const block = ['[mcp_servers.humemory]', ...Object.entries(next).map(([k, v]) => `${JSON.stringify(k)} = ${tomlValue(v)}`)].join(eol);
|
|
130
|
+
const result = `${kept}${kept && !kept.endsWith('\n') ? eol : ''}${eol}${block}${eol}`;
|
|
131
|
+
try {
|
|
132
|
+
const parsed = Bun.TOML.parse(result) as Record<string, any>;
|
|
133
|
+
const expected = { ...current, mcp_servers: { ...current.mcp_servers, humemory: next } };
|
|
134
|
+
if (!isDeepStrictEqual(parsed, expected)) throw new Error('unrelated settings changed');
|
|
135
|
+
} catch {
|
|
136
|
+
throw new Error(`Refusing to rewrite unsupported Codex TOML layout: ${path}`);
|
|
137
|
+
}
|
|
138
|
+
return result;
|
|
139
|
+
}
|
|
140
|
+
|
|
80
141
|
export async function setupHumemoryMcpClients(options: McpClientSetupOptions): Promise<McpClientSetupEntry[]> {
|
|
81
142
|
const projectRoot = resolve(options.projectRoot);
|
|
82
143
|
const serverPath = join(projectRoot, 'src', 'mcp', 'server.ts');
|
|
@@ -87,16 +148,29 @@ export async function setupHumemoryMcpClients(options: McpClientSetupOptions): P
|
|
|
87
148
|
const entries: McpClientSetupEntry[] = [];
|
|
88
149
|
|
|
89
150
|
for (const client of [...new Set(options.clients)]) {
|
|
90
|
-
if (client === '
|
|
91
|
-
const path = join(options.
|
|
151
|
+
if (client === 'codex') {
|
|
152
|
+
const path = join(options.codexHome ?? process.env.CODEX_HOME ?? join(homedir(), '.codex'), 'config.toml');
|
|
153
|
+
const changed = await mergeTextFile(path, (original) => mergeCodexToml(original, path, {
|
|
154
|
+
command: bunPath,
|
|
155
|
+
args: ['run', serverPath],
|
|
156
|
+
env: { HUMEMORY_AGENT: 'codex', HUMEMORY_DB: dbPath },
|
|
157
|
+
}), dryRun);
|
|
158
|
+
entries.push({ client, path, changed });
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
if (client === 'kimi' || client === 'claude') {
|
|
162
|
+
const path = client === 'claude'
|
|
163
|
+
? resolve(options.claudeConfig ?? join(homedir(), '.claude.json'))
|
|
164
|
+
: join(options.kimiHome ?? process.env.KIMI_CODE_HOME ?? join(homedir(), '.kimi-code'), 'mcp.json');
|
|
92
165
|
const changed = await mergeFile(path, (current) => ({
|
|
93
166
|
...current,
|
|
94
167
|
mcpServers: {
|
|
95
168
|
...((current.mcpServers as Record<string, unknown> | undefined) ?? {}),
|
|
96
169
|
humemory: {
|
|
170
|
+
...(client === 'claude' ? { type: 'stdio' } : {}),
|
|
97
171
|
command: bunPath,
|
|
98
172
|
args: ['run', serverPath],
|
|
99
|
-
env: { HUMEMORY_AGENT:
|
|
173
|
+
env: { HUMEMORY_AGENT: client, HUMEMORY_DB: dbPath },
|
|
100
174
|
},
|
|
101
175
|
},
|
|
102
176
|
}), dryRun);
|
|
@@ -10,6 +10,7 @@ import { Hono } from 'hono';
|
|
|
10
10
|
import type { SQLiteStore } from '../store/sqlite.js';
|
|
11
11
|
import {
|
|
12
12
|
SqliteCueResolver,
|
|
13
|
+
parseCron,
|
|
13
14
|
loopId,
|
|
14
15
|
isDangerousPattern,
|
|
15
16
|
MAX_PATTERN_LENGTH,
|
|
@@ -85,6 +86,9 @@ export function validateTriggerSpec(raw: unknown): TriggerSpec {
|
|
|
85
86
|
if (cron !== undefined && typeof cron !== 'string') {
|
|
86
87
|
throw new BadRequest('"cron" must be a string');
|
|
87
88
|
}
|
|
89
|
+
if (typeof cron === 'string' && !parseCron(cron)) {
|
|
90
|
+
throw new BadRequest('invalid cron expression: expected five fields (minute hour day month weekday), in UTC');
|
|
91
|
+
}
|
|
88
92
|
return { kind: 'time', ...(at ? { at: at as string } : {}), ...(cron ? { cron: cron as string } : {}) };
|
|
89
93
|
}
|
|
90
94
|
|
package/src/cli/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { Command } from 'commander';
|
|
2
|
+
import { Command, Option } from 'commander';
|
|
3
3
|
import { databasePath, queueDirectory } from '../core/paths.js';
|
|
4
4
|
import { SQLiteStore } from '../store/sqlite.js';
|
|
5
5
|
import { calculateDecayLevel } from '../core/decay.js';
|
|
@@ -53,9 +53,11 @@ program
|
|
|
53
53
|
.option('-d, --directory <dir>', 'Mental place (project)', process.cwd())
|
|
54
54
|
.option('-s, --session <id>', 'Contexte d\'encodage', 'default')
|
|
55
55
|
.option('-k, --keywords <tags>', 'Retrieval cues (comma-separated)', '')
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
.
|
|
56
|
+
// Commander 15 rejects multi-character short flags in the constructor.
|
|
57
|
+
// Keep the historical aliases through Option's public short property.
|
|
58
|
+
.addOption(Object.assign(new Option('--level1 <summary>', 'Summary for consolidation level 1'), { short: '-l1' }))
|
|
59
|
+
.addOption(Object.assign(new Option('--level2 <essential>', 'Gist for consolidation level 2'), { short: '-l2' }))
|
|
60
|
+
.addOption(Object.assign(new Option('--level3 <keywords>', 'Keywords for fast level 3 retrieval'), { short: '-l3' }))
|
|
59
61
|
.option('-t, --type <type>', 'Memory type (episodic/semantic/procedural)', 'semantic')
|
|
60
62
|
.option('--auto', 'Auto-generate levels 1-3 locally (an injected LLM may enhance them)')
|
|
61
63
|
.option('--photographic', 'Photographic mode — disable decay')
|
|
@@ -1128,20 +1130,24 @@ sources
|
|
|
1128
1130
|
|
|
1129
1131
|
sources
|
|
1130
1132
|
.command('setup')
|
|
1131
|
-
.description('Register humemory as a local MCP server in Kimi Code and OpenCode')
|
|
1133
|
+
.description('Register humemory as a local MCP server in Claude Code, Codex, Kimi Code and OpenCode')
|
|
1134
|
+
.option('--claude', 'Configure Claude Code only (user scope)')
|
|
1135
|
+
.option('--claude-config <path>', 'Override the Claude Code user config file (default ~/.claude.json)')
|
|
1136
|
+
.option('--codex', 'Configure Codex only (combine client flags to select several)')
|
|
1132
1137
|
.option('--kimi', 'Configure Kimi Code only')
|
|
1133
1138
|
.option('--opencode', 'Configure OpenCode only')
|
|
1134
1139
|
.option('--dry-run', 'Show which files would change, write nothing')
|
|
1135
1140
|
.action(async (options) => {
|
|
1136
1141
|
const { setupHumemoryMcpClients } = await import('../agent/mcp-client-setup.js');
|
|
1137
|
-
const clients = options.kimi || options.opencode
|
|
1138
|
-
? [...(options.kimi ? ['kimi'] as const : []), ...(options.opencode ? ['opencode'] as const : [])]
|
|
1139
|
-
: ['kimi', 'opencode'] as const;
|
|
1142
|
+
const clients = options.claude || options.codex || options.kimi || options.opencode
|
|
1143
|
+
? [...(options.claude ? ['claude'] as const : []), ...(options.codex ? ['codex'] as const : []), ...(options.kimi ? ['kimi'] as const : []), ...(options.opencode ? ['opencode'] as const : [])]
|
|
1144
|
+
: ['claude', 'codex', 'kimi', 'opencode'] as const;
|
|
1140
1145
|
const projectRoot = resolve(__dirname, '../..');
|
|
1141
1146
|
const result = await setupHumemoryMcpClients({
|
|
1142
1147
|
clients: [...clients],
|
|
1143
1148
|
projectRoot,
|
|
1144
1149
|
dbPath: DB_PATH,
|
|
1150
|
+
claudeConfig: options.claudeConfig,
|
|
1145
1151
|
dryRun: options.dryRun,
|
|
1146
1152
|
});
|
|
1147
1153
|
for (const entry of result) {
|
package/src/core/cue-arg.ts
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import type { TriggerSpec } from '../core/types.js';
|
|
16
|
+
import { parseCron } from './cues.js';
|
|
16
17
|
|
|
17
18
|
export class CueArgError extends Error {}
|
|
18
19
|
|
|
@@ -35,6 +36,7 @@ export function parseCueArg(raw: string): TriggerSpec {
|
|
|
35
36
|
|
|
36
37
|
case 'cron': {
|
|
37
38
|
if (!tail.trim()) throw new CueArgError('cron: expects an expression — e.g. "cron:0 9 * * 1"');
|
|
39
|
+
if (!parseCron(tail)) throw new CueArgError('invalid cron expression: expected five fields (minute hour day month weekday), in UTC');
|
|
38
40
|
return { kind: 'time', cron: tail.trim() };
|
|
39
41
|
}
|
|
40
42
|
|
package/src/core/cues.ts
CHANGED
|
@@ -56,6 +56,7 @@ function expandCronField(field: string, index: number): Set<number> | null {
|
|
|
56
56
|
const values = new Set<number>();
|
|
57
57
|
|
|
58
58
|
for (const part of field.split(',')) {
|
|
59
|
+
if (!/^(?:\*|[0-9]+(?:-[0-9]+)?)(?:\/[0-9]+)?$/.test(part)) return null;
|
|
59
60
|
const [rangePart, stepPart] = part.split('/');
|
|
60
61
|
const step = stepPart === undefined ? 1 : Number(stepPart);
|
|
61
62
|
if (!Number.isInteger(step) || step < 1) return null;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{h as J,i as b,j as A,k as B,l as N,m as P,n as U,o as j,s as x}from"./index-epqg22cp.js";import{t as T,u as R,v as V}from"./index-gbfwa9vq.js";import{D as $}from"./index-5kwkpwkp.js";function C(_={}){return async function(y){y.innerHTML="";let{memories:D}=await $.listMemories({limit:500}),F=y.clientWidth||1200,G=700,W=J(y).append("svg").attr("width",F).attr("height",G),K=document.createElement("div");K.className="galaxy-legend",K.innerHTML=`
|
|
2
|
-
<div style="font-weight:600;margin-bottom:.5rem;">Decay levels</div>
|
|
3
|
-
${R.map((f,q)=>`
|
|
4
|
-
<div class="galaxy-legend-item">
|
|
5
|
-
<div class="galaxy-legend-dot" style="background:${T[q]};"></div>
|
|
6
|
-
<span>L${q} — ${V(q)}</span>
|
|
7
|
-
</div>`).join("")}
|
|
8
|
-
<div style="margin-top:1rem;font-size:.8rem;color:var(--muted);">
|
|
9
|
-
Size = mnemonic strength<br>Position = mental place
|
|
10
|
-
</div>`,y.appendChild(K);let M=[...new Set(D.map((f)=>f.directory))],Q=Math.min(F,G)*0.3,X=2*Math.PI/Math.max(1,M.length),z={};M.forEach((f,q)=>{z[f]={x:F/2+Q*Math.cos(q*X),y:G/2+Q*Math.sin(q*X)}});let Y=D.map((f)=>({id:f.id,directory:f.directory,saillance:f.saillance,level:f.currentLevel,photographic:f.photographic,memory:f})),Z=D.filter((f)=>f.mergedIntoId&&D.some((q)=>q.id===f.mergedIntoId)).map((f)=>({source:f.id,target:f.mergedIntoId})),H=N(Y).force("link",B(Z).id((f)=>f.id).distance(50)).force("charge",P().strength(-30)).force("x",U((f)=>z[f.directory]?.x??F/2).strength(0.1)).force("y",j((f)=>z[f.directory]?.y??G/2).strength(0.1)).force("collision",A().radius((f)=>Math.max(5,f.saillance/10))),I=W.append("g");W.call(x().scaleExtent([0.3,5]).on("zoom",(f)=>{I.attr("transform",f.transform)}));let k=I.append("g").selectAll("line").data(Z).enter().append("line").attr("class","galaxy-link").attr("stroke","#3f3f4e").attr("stroke-opacity",0.3),w=I.append("g").selectAll("circle").data(Y).enter().append("circle").attr("class","galaxy-node").attr("r",(f)=>Math.max(4,f.saillance/8)).attr("fill",(f)=>T[f.level]).attr("opacity",(f)=>Math.max(0.4,f.saillance/100)).attr("stroke",(f)=>f.photographic?"#8b5cf6":"none").attr("stroke-width",(f)=>f.photographic?2:0).style("cursor","pointer").on("click",(f,q)=>_.onSelectMemory?.(q.id)).on("mouseover",(f,q)=>{J(f.target).transition().duration(200).attr("r",Math.max(6,q.saillance/6))}).on("mouseout",(f,q)=>{J(f.target).transition().duration(200).attr("r",Math.max(4,q.saillance/8))}).call(b().on("start",(f,q)=>{if(!f.active)H.alphaTarget(0.3).restart();q.fx=q.x,q.fy=q.y}).on("drag",(f,q)=>{q.fx=f.x,q.fy=f.y}).on("end",(f,q)=>{if(!f.active)H.alphaTarget(0);q.fx=null,q.fy=null}));return I.append("g").selectAll("text").data(M).enter().append("text").attr("x",(f)=>z[f].x).attr("y",(f)=>z[f].y-Q*0.15).attr("text-anchor","middle").attr("fill","#a1a1aa").attr("font-size","12px").attr("font-weight","600").text((f)=>f.split(/[\\/]/).pop()||f),H.on("tick",()=>{k.attr("x1",(f)=>f.source.x).attr("y1",(f)=>f.source.y).attr("x2",(f)=>f.target.x).attr("y2",(f)=>f.target.y),w.attr("cx",(f)=>f.x).attr("cy",(f)=>f.y)}),()=>{H.stop(),y.innerHTML=""}}}export{C as createMount};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function fn(r,t){let u;if(t===void 0){for(let f of r)if(f!=null&&(u<f||u===void 0&&f>=f))u=f}else{let f=-1;for(let o of r)if((o=t(o,++f,r))!=null&&(u<o||u===void 0&&o>=o))u=o}return u}function on(r,t){let u;if(t===void 0){for(let f of r)if(f!=null&&(u>f||u===void 0&&f>=f))u=f}else{let f=-1;for(let o of r)if((o=t(o,++f,r))!=null&&(u>o||u===void 0&&o>=o))u=o}return u}function Yr(r,t){return r==null||t==null?NaN:r<t?-1:r>t?1:r>=t?0:NaN}function Wu(r,t){return r==null||t==null?NaN:t<r?-1:t>r?1:t>=r?0:NaN}function Rr(r){let t,u,f;if(r.length!==2)t=Yr,u=(c,l)=>Yr(r(c),l),f=(c,l)=>r(c)-l;else t=r===Yr||r===Wu?r:Ei,u=r,f=r;function o(c,l,h=0,m=c.length){if(h<m){if(t(l,l)!==0)return m;do{let x=h+m>>>1;if(u(c[x],l)<0)h=x+1;else m=x}while(h<m)}return h}function n(c,l,h=0,m=c.length){if(h<m){if(t(l,l)!==0)return m;do{let x=h+m>>>1;if(u(c[x],l)<=0)h=x+1;else m=x}while(h<m)}return h}function i(c,l,h=0,m=c.length){let x=o(c,l,h,m-1);return x>h&&f(c[x-1],l)>-f(c[x],l)?x-1:x}return{left:o,center:i,right:n}}function Ei(){return 0}function Gu(r){return r===null?NaN:+r}var nn=Rr(Yr),cn=nn.right,gi=nn.left,yi=Rr(Gu).center,eu=cn;var ji=Math.sqrt(50),bi=Math.sqrt(10),vi=Math.sqrt(2);function kt(r,t,u){let f=(t-r)/Math.max(0,u),o=Math.floor(Math.log10(f)),n=f/Math.pow(10,o),i=n>=ji?10:n>=bi?5:n>=vi?2:1,c,l,h;if(o<0){if(h=Math.pow(10,-o)/i,c=Math.round(r*h),l=Math.round(t*h),c/h<r)++c;if(l/h>t)--l;h=-h}else{if(h=Math.pow(10,o)*i,c=Math.round(r/h),l=Math.round(t/h),c*h<r)++c;if(l*h>t)--l}if(l<c&&0.5<=u&&u<2)return kt(r,t,u*2);return[c,l,h]}function dt(r,t,u){if(t=+t,r=+r,u=+u,!(u>0))return[];if(r===t)return[r];let f=t<r,[o,n,i]=f?kt(t,r,u):kt(r,t,u);if(!(n>=o))return[];let c=n-o+1,l=Array(c);if(f)if(i<0)for(let h=0;h<c;++h)l[h]=(n-h)/-i;else for(let h=0;h<c;++h)l[h]=(n-h)*i;else if(i<0)for(let h=0;h<c;++h)l[h]=(o+h)/-i;else for(let h=0;h<c;++h)l[h]=(o+h)*i;return l}function St(r,t,u){return t=+t,r=+r,u=+u,kt(r,t,u)[2]}function tt(r,t,u){t=+t,r=+r,u=+u;let f=t<r,o=f?St(t,r,u):St(r,t,u);return(f?-1:1)*(o<0?1/-o:o)}function Yu(r){return r}var Ru=1,zu=2,qu=3,wt=4,hn=0.000001;function ki(r){return"translate("+r+",0)"}function di(r){return"translate(0,"+r+")"}function r0(r){return(t)=>+r(t)}function t0(r,t){if(t=Math.max(0,r.bandwidth()-t*2)/2,r.round())t=Math.round(t);return(u)=>+r(u)+t}function u0(){return!this.__axis}function ln(r,t){var u=[],f=null,o=null,n=6,i=6,c=3,l=typeof window<"u"&&window.devicePixelRatio>1?0:0.5,h=r===Ru||r===wt?-1:1,m=r===wt||r===zu?"x":"y",x=r===Ru||r===qu?ki:di;function s(p){var B=f==null?t.ticks?t.ticks.apply(t,u):t.domain():f,I=o==null?t.tickFormat?t.tickFormat.apply(t,u):Yu:o,S=Math.max(n,0)+c,_=t.range(),O=+_[0]+l,N=+_[_.length-1]+l,M=(t.bandwidth?t0:r0)(t.copy(),l),T=p.selection?p.selection():p,w=T.selectAll(".domain").data([null]),J=T.selectAll(".tick").data(B,t).order(),L=J.exit(),a=J.enter().append("g").attr("class","tick"),Z=J.select("line"),X=J.select("text");if(w=w.merge(w.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),J=J.merge(a),Z=Z.merge(a.append("line").attr("stroke","currentColor").attr(m+"2",h*n)),X=X.merge(a.append("text").attr("fill","currentColor").attr(m,h*S).attr("dy",r===Ru?"0em":r===qu?"0.71em":"0.32em")),p!==T)w=w.transition(p),J=J.transition(p),Z=Z.transition(p),X=X.transition(p),L=L.transition(p).attr("opacity",hn).attr("transform",function(Q){return isFinite(Q=M(Q))?x(Q+l):this.getAttribute("transform")}),a.attr("opacity",hn).attr("transform",function(Q){var e=this.parentNode.__axis;return x((e&&isFinite(e=e(Q))?e:M(Q))+l)});L.remove(),w.attr("d",r===wt||r===zu?i?"M"+h*i+","+O+"H"+l+"V"+N+"H"+h*i:"M"+l+","+O+"V"+N:i?"M"+O+","+h*i+"V"+l+"H"+N+"V"+h*i:"M"+O+","+l+"H"+N),J.attr("opacity",1).attr("transform",function(Q){return x(M(Q)+l)}),Z.attr(m+"2",h*n),X.attr(m,h*S).text(I),T.filter(u0).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",r===zu?"start":r===wt?"end":"middle"),T.each(function(){this.__axis=M})}return s.scale=function(p){return arguments.length?(t=p,s):t},s.ticks=function(){return u=Array.from(arguments),s},s.tickArguments=function(p){return arguments.length?(u=p==null?[]:Array.from(p),s):u.slice()},s.tickValues=function(p){return arguments.length?(f=p==null?null:Array.from(p),s):f&&f.slice()},s.tickFormat=function(p){return arguments.length?(o=p,s):o},s.tickSize=function(p){return arguments.length?(n=i=+p,s):n},s.tickSizeInner=function(p){return arguments.length?(n=+p,s):n},s.tickSizeOuter=function(p){return arguments.length?(i=+p,s):i},s.tickPadding=function(p){return arguments.length?(c=+p,s):c},s.offset=function(p){return arguments.length?(l=+p,s):l},s}function f0(r){return ln(qu,r)}function o0(r){return ln(wt,r)}function n0(){}function Ur(r){return r==null?n0:function(){return this.querySelector(r)}}function Eu(r){if(typeof r!=="function")r=Ur(r);for(var t=this._groups,u=t.length,f=Array(u),o=0;o<u;++o)for(var n=t[o],i=n.length,c=f[o]=Array(i),l,h,m=0;m<i;++m)if((l=n[m])&&(h=r.call(l,l.__data__,m,n))){if("__data__"in l)h.__data__=l.__data__;c[m]=h}return new E(f,this._parents)}function gu(r){return r==null?[]:Array.isArray(r)?r:Array.from(r)}function i0(){return[]}function ut(r){return r==null?i0:function(){return this.querySelectorAll(r)}}function c0(r){return function(){return gu(r.apply(this,arguments))}}function yu(r){if(typeof r==="function")r=c0(r);else r=ut(r);for(var t=this._groups,u=t.length,f=[],o=[],n=0;n<u;++n)for(var i=t[n],c=i.length,l,h=0;h<c;++h)if(l=i[h])f.push(r.call(l,l.__data__,h,i)),o.push(l);return new E(f,o)}function ft(r){return function(){return this.matches(r)}}function ru(r){return function(t){return t.matches(r)}}var h0=Array.prototype.find;function l0(r){return function(){return h0.call(this.children,r)}}function m0(){return this.firstElementChild}function ju(r){return this.select(r==null?m0:l0(typeof r==="function"?r:ru(r)))}var s0=Array.prototype.filter;function p0(){return Array.from(this.children)}function x0(r){return function(){return s0.call(this.children,r)}}function bu(r){return this.selectAll(r==null?p0:x0(typeof r==="function"?r:ru(r)))}function vu(r){if(typeof r!=="function")r=ft(r);for(var t=this._groups,u=t.length,f=Array(u),o=0;o<u;++o)for(var n=t[o],i=n.length,c=f[o]=[],l,h=0;h<i;++h)if((l=n[h])&&r.call(l,l.__data__,h,n))c.push(l);return new E(f,this._parents)}function Ct(r){return Array(r.length)}function ku(){return new E(this._enter||this._groups.map(Ct),this._parents)}function Ft(r,t){this.ownerDocument=r.ownerDocument,this.namespaceURI=r.namespaceURI,this._next=null,this._parent=r,this.__data__=t}Ft.prototype={constructor:Ft,appendChild:function(r){return this._parent.insertBefore(r,this._next)},insertBefore:function(r,t){return this._parent.insertBefore(r,t)},querySelector:function(r){return this._parent.querySelector(r)},querySelectorAll:function(r){return this._parent.querySelectorAll(r)}};function du(r){return function(){return r}}function M0(r,t,u,f,o,n){var i=0,c,l=t.length,h=n.length;for(;i<h;++i)if(c=t[i])c.__data__=n[i],f[i]=c;else u[i]=new Ft(r,n[i]);for(;i<l;++i)if(c=t[i])o[i]=c}function A0(r,t,u,f,o,n,i){var c,l,h=new Map,m=t.length,x=n.length,s=Array(m),p;for(c=0;c<m;++c)if(l=t[c])if(s[c]=p=i.call(l,l.__data__,c,t)+"",h.has(p))o[c]=l;else h.set(p,l);for(c=0;c<x;++c)if(p=i.call(r,n[c],c,n)+"",l=h.get(p))f[c]=l,l.__data__=n[c],h.delete(p);else u[c]=new Ft(r,n[c]);for(c=0;c<m;++c)if((l=t[c])&&h.get(s[c])===l)o[c]=l}function _0(r){return r.__data__}function rf(r,t){if(!arguments.length)return Array.from(this,_0);var u=t?A0:M0,f=this._parents,o=this._groups;if(typeof r!=="function")r=du(r);for(var n=o.length,i=Array(n),c=Array(n),l=Array(n),h=0;h<n;++h){var m=f[h],x=o[h],s=x.length,p=I0(r.call(m,m&&m.__data__,h,f)),B=p.length,I=c[h]=Array(B),S=i[h]=Array(B),_=l[h]=Array(s);u(m,x,I,S,_,p,t);for(var O=0,N=0,M,T;O<B;++O)if(M=I[O]){if(O>=N)N=O+1;while(!(T=S[N])&&++N<B);M._next=T||null}}return i=new E(i,f),i._enter=c,i._exit=l,i}function I0(r){return typeof r==="object"&&"length"in r?r:Array.from(r)}function tf(){return new E(this._exit||this._groups.map(Ct),this._parents)}function uf(r,t,u){var f=this.enter(),o=this,n=this.exit();if(typeof r==="function"){if(f=r(f),f)f=f.selection()}else f=f.append(r+"");if(t!=null){if(o=t(o),o)o=o.selection()}if(u==null)n.remove();else u(n);return f&&o?f.merge(o).order():o}function ff(r){var t=r.selection?r.selection():r;for(var u=this._groups,f=t._groups,o=u.length,n=f.length,i=Math.min(o,n),c=Array(o),l=0;l<i;++l)for(var h=u[l],m=f[l],x=h.length,s=c[l]=Array(x),p,B=0;B<x;++B)if(p=h[B]||m[B])s[B]=p;for(;l<o;++l)c[l]=u[l];return new E(c,this._parents)}function of(){for(var r=this._groups,t=-1,u=r.length;++t<u;)for(var f=r[t],o=f.length-1,n=f[o],i;--o>=0;)if(i=f[o]){if(n&&i.compareDocumentPosition(n)^4)n.parentNode.insertBefore(i,n);n=i}return this}function nf(r){if(!r)r=S0;function t(x,s){return x&&s?r(x.__data__,s.__data__):!x-!s}for(var u=this._groups,f=u.length,o=Array(f),n=0;n<f;++n){for(var i=u[n],c=i.length,l=o[n]=Array(c),h,m=0;m<c;++m)if(h=i[m])l[m]=h;l.sort(t)}return new E(o,this._parents).order()}function S0(r,t){return r<t?-1:r>t?1:r>=t?0:NaN}function cf(){var r=arguments[0];return arguments[0]=this,r.apply(null,arguments),this}function hf(){return Array.from(this)}function lf(){for(var r=this._groups,t=0,u=r.length;t<u;++t)for(var f=r[t],o=0,n=f.length;o<n;++o){var i=f[o];if(i)return i}return null}function mf(){let r=0;for(let t of this)++r;return r}function sf(){return!this.node()}function pf(r){for(var t=this._groups,u=0,f=t.length;u<f;++u)for(var o=t[u],n=0,i=o.length,c;n<i;++n)if(c=o[n])r.call(c,c.__data__,n,o);return this}var tu="http://www.w3.org/1999/xhtml",xf={svg:"http://www.w3.org/2000/svg",xhtml:tu,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Br(r){var t=r+="",u=t.indexOf(":");if(u>=0&&(t=r.slice(0,u))!=="xmlns")r=r.slice(u+1);return xf.hasOwnProperty(t)?{space:xf[t],local:r}:r}function w0(r){return function(){this.removeAttribute(r)}}function C0(r){return function(){this.removeAttributeNS(r.space,r.local)}}function F0(r,t){return function(){this.setAttribute(r,t)}}function B0(r,t){return function(){this.setAttributeNS(r.space,r.local,t)}}function O0(r,t){return function(){var u=t.apply(this,arguments);if(u==null)this.removeAttribute(r);else this.setAttribute(r,u)}}function N0(r,t){return function(){var u=t.apply(this,arguments);if(u==null)this.removeAttributeNS(r.space,r.local);else this.setAttributeNS(r.space,r.local,u)}}function Mf(r,t){var u=Br(r);if(arguments.length<2){var f=this.node();return u.local?f.getAttributeNS(u.space,u.local):f.getAttribute(u)}return this.each((t==null?u.local?C0:w0:typeof t==="function"?u.local?N0:O0:u.local?B0:F0)(u,t))}function Bt(r){return r.ownerDocument&&r.ownerDocument.defaultView||r.document&&r||r.defaultView}function T0(r){return function(){this.style.removeProperty(r)}}function V0(r,t,u){return function(){this.style.setProperty(r,t,u)}}function J0(r,t,u){return function(){var f=t.apply(this,arguments);if(f==null)this.style.removeProperty(r);else this.style.setProperty(r,f,u)}}function Af(r,t,u){return arguments.length>1?this.each((t==null?T0:typeof t==="function"?J0:V0)(r,t,u==null?"":u)):Zr(this.node(),r)}function Zr(r,t){return r.style.getPropertyValue(t)||Bt(r).getComputedStyle(r,null).getPropertyValue(t)}function P0(r){return function(){delete this[r]}}function D0(r,t){return function(){this[r]=t}}function Q0(r,t){return function(){var u=t.apply(this,arguments);if(u==null)delete this[r];else this[r]=u}}function _f(r,t){return arguments.length>1?this.each((t==null?P0:typeof t==="function"?Q0:D0)(r,t)):this.node()[r]}function mn(r){return r.trim().split(/^|\s+/)}function If(r){return r.classList||new sn(r)}function sn(r){this._node=r,this._names=mn(r.getAttribute("class")||"")}sn.prototype={add:function(r){var t=this._names.indexOf(r);if(t<0)this._names.push(r),this._node.setAttribute("class",this._names.join(" "))},remove:function(r){var t=this._names.indexOf(r);if(t>=0)this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" "))},contains:function(r){return this._names.indexOf(r)>=0}};function pn(r,t){var u=If(r),f=-1,o=t.length;while(++f<o)u.add(t[f])}function xn(r,t){var u=If(r),f=-1,o=t.length;while(++f<o)u.remove(t[f])}function $0(r){return function(){pn(this,r)}}function H0(r){return function(){xn(this,r)}}function L0(r,t){return function(){(t.apply(this,arguments)?pn:xn)(this,r)}}function Sf(r,t){var u=mn(r+"");if(arguments.length<2){var f=If(this.node()),o=-1,n=u.length;while(++o<n)if(!f.contains(u[o]))return!1;return!0}return this.each((typeof t==="function"?L0:t?$0:H0)(u,t))}function U0(){this.textContent=""}function Z0(r){return function(){this.textContent=r}}function K0(r){return function(){var t=r.apply(this,arguments);this.textContent=t==null?"":t}}function wf(r){return arguments.length?this.each(r==null?U0:(typeof r==="function"?K0:Z0)(r)):this.node().textContent}function a0(){this.innerHTML=""}function X0(r){return function(){this.innerHTML=r}}function W0(r){return function(){var t=r.apply(this,arguments);this.innerHTML=t==null?"":t}}function Cf(r){return arguments.length?this.each(r==null?a0:(typeof r==="function"?W0:X0)(r)):this.node().innerHTML}function G0(){if(this.nextSibling)this.parentNode.appendChild(this)}function Ff(){return this.each(G0)}function e0(){if(this.previousSibling)this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Bf(){return this.each(e0)}function Y0(r){return function(){var t=this.ownerDocument,u=this.namespaceURI;return u===tu&&t.documentElement.namespaceURI===tu?t.createElement(r):t.createElementNS(u,r)}}function R0(r){return function(){return this.ownerDocument.createElementNS(r.space,r.local)}}function Ot(r){var t=Br(r);return(t.local?R0:Y0)(t)}function Of(r){var t=typeof r==="function"?r:Ot(r);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function z0(){return null}function Nf(r,t){var u=typeof r==="function"?r:Ot(r),f=t==null?z0:typeof t==="function"?t:Ur(t);return this.select(function(){return this.insertBefore(u.apply(this,arguments),f.apply(this,arguments)||null)})}function q0(){var r=this.parentNode;if(r)r.removeChild(this)}function Tf(){return this.each(q0)}function E0(){var r=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(r,this.nextSibling):r}function g0(){var r=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(r,this.nextSibling):r}function Vf(r){return this.select(r?g0:E0)}function Jf(r){return arguments.length?this.property("__data__",r):this.node().__data__}function y0(r){return function(t){r.call(this,t,this.__data__)}}function j0(r){return r.trim().split(/^|\s+/).map(function(t){var u="",f=t.indexOf(".");if(f>=0)u=t.slice(f+1),t=t.slice(0,f);return{type:t,name:u}})}function b0(r){return function(){var t=this.__on;if(!t)return;for(var u=0,f=-1,o=t.length,n;u<o;++u)if(n=t[u],(!r.type||n.type===r.type)&&n.name===r.name)this.removeEventListener(n.type,n.listener,n.options);else t[++f]=n;if(++f)t.length=f;else delete this.__on}}function v0(r,t,u){return function(){var f=this.__on,o,n=y0(t);if(f){for(var i=0,c=f.length;i<c;++i)if((o=f[i]).type===r.type&&o.name===r.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=n,o.options=u),o.value=t;return}}if(this.addEventListener(r.type,n,u),o={type:r.type,name:r.name,value:t,listener:n,options:u},!f)this.__on=[o];else f.push(o)}}function Pf(r,t,u){var f=j0(r+""),o,n=f.length,i;if(arguments.length<2){var c=this.node().__on;if(c){for(var l=0,h=c.length,m;l<h;++l)for(o=0,m=c[l];o<n;++o)if((i=f[o]).type===m.type&&i.name===m.name)return m.value}return}c=t?v0:b0;for(o=0;o<n;++o)this.each(c(f[o],t,u));return this}function Mn(r,t,u){var f=Bt(r),o=f.CustomEvent;if(typeof o==="function")o=new o(t,u);else if(o=f.document.createEvent("Event"),u)o.initEvent(t,u.bubbles,u.cancelable),o.detail=u.detail;else o.initEvent(t,!1,!1);r.dispatchEvent(o)}function k0(r,t){return function(){return Mn(this,r,t)}}function d0(r,t){return function(){return Mn(this,r,t.apply(this,arguments))}}function Df(r,t){return this.each((typeof t==="function"?d0:k0)(r,t))}function*Qf(){for(var r=this._groups,t=0,u=r.length;t<u;++t)for(var f=r[t],o=0,n=f.length,i;o<n;++o)if(i=f[o])yield i}var $f=[null];function E(r,t){this._groups=r,this._parents=t}function An(){return new E([[document.documentElement]],$f)}function rc(){return this}E.prototype=An.prototype={constructor:E,select:Eu,selectAll:yu,selectChild:ju,selectChildren:bu,filter:vu,data:rf,enter:ku,exit:tf,join:uf,merge:ff,selection:rc,order:of,sort:nf,call:cf,nodes:hf,node:lf,size:mf,empty:sf,each:pf,attr:Mf,style:Af,property:_f,classed:Sf,text:wf,html:Cf,raise:Ff,lower:Bf,append:Of,insert:Nf,remove:Tf,clone:Vf,datum:Jf,on:Pf,dispatch:Df,[Symbol.iterator]:Qf};var Vr=An;function or(r){return typeof r==="string"?new E([[document.querySelector(r)]],[document.documentElement]):new E([[r]],$f)}function Hf(r){let t;while(t=r.sourceEvent)r=t;return r}function mr(r,t){if(r=Hf(r),t===void 0)t=r.currentTarget;if(t){var u=t.ownerSVGElement||t;if(u.createSVGPoint){var f=u.createSVGPoint();return f.x=r.clientX,f.y=r.clientY,f=f.matrixTransform(t.getScreenCTM().inverse()),[f.x,f.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[r.clientX-o.left-t.clientLeft,r.clientY-o.top-t.clientTop]}}return[r.pageX,r.pageY]}var tc={value:()=>{}};function In(){for(var r=0,t=arguments.length,u={},f;r<t;++r){if(!(f=arguments[r]+"")||f in u||/[\s.]/.test(f))throw Error("illegal type: "+f);u[f]=[]}return new uu(u)}function uu(r){this._=r}function uc(r,t){return r.trim().split(/^|\s+/).map(function(u){var f="",o=u.indexOf(".");if(o>=0)f=u.slice(o+1),u=u.slice(0,o);if(u&&!t.hasOwnProperty(u))throw Error("unknown type: "+u);return{type:u,name:f}})}uu.prototype=In.prototype={constructor:uu,on:function(r,t){var u=this._,f=uc(r+"",u),o,n=-1,i=f.length;if(arguments.length<2){while(++n<i)if((o=(r=f[n]).type)&&(o=fc(u[o],r.name)))return o;return}if(t!=null&&typeof t!=="function")throw Error("invalid callback: "+t);while(++n<i)if(o=(r=f[n]).type)u[o]=_n(u[o],r.name,t);else if(t==null)for(o in u)u[o]=_n(u[o],r.name,null);return this},copy:function(){var r={},t=this._;for(var u in t)r[u]=t[u].slice();return new uu(r)},call:function(r,t){if((o=arguments.length-2)>0)for(var u=Array(o),f=0,o,n;f<o;++f)u[f]=arguments[f+2];if(!this._.hasOwnProperty(r))throw Error("unknown type: "+r);for(n=this._[r],f=0,o=n.length;f<o;++f)n[f].value.apply(t,u)},apply:function(r,t,u){if(!this._.hasOwnProperty(r))throw Error("unknown type: "+r);for(var f=this._[r],o=0,n=f.length;o<n;++o)f[o].value.apply(t,u)}};function fc(r,t){for(var u=0,f=r.length,o;u<f;++u)if((o=r[u]).name===t)return o.value}function _n(r,t,u){for(var f=0,o=r.length;f<o;++f)if(r[f].name===t){r[f]=tc,r=r.slice(0,f).concat(r.slice(f+1));break}if(u!=null)r.push({name:t,value:u});return r}var Jr=In;var Sn={passive:!1},zr={capture:!0,passive:!1};function fu(r){r.stopImmediatePropagation()}function Pr(r){r.preventDefault(),r.stopImmediatePropagation()}function ot(r){var t=r.document.documentElement,u=or(r).on("dragstart.drag",Pr,zr);if("onselectstart"in t)u.on("selectstart.drag",Pr,zr);else t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none"}function Nt(r,t){var u=r.document.documentElement,f=or(r).on("dragstart.drag",null);if(t)f.on("click.drag",Pr,zr),setTimeout(function(){f.on("click.drag",null)},0);if("onselectstart"in u)f.on("selectstart.drag",null);else u.style.MozUserSelect=u.__noselect,delete u.__noselect}var Tt=(r)=>()=>r;function Vt(r,{sourceEvent:t,subject:u,target:f,identifier:o,active:n,x:i,y:c,dx:l,dy:h,dispatch:m}){Object.defineProperties(this,{type:{value:r,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:u,enumerable:!0,configurable:!0},target:{value:f,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:n,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:m}})}Vt.prototype.on=function(){var r=this._.on.apply(this._,arguments);return r===this._?this:r};function oc(r){return!r.ctrlKey&&!r.button}function nc(){return this.parentNode}function ic(r,t){return t==null?{x:r.x,y:r.y}:t}function cc(){return navigator.maxTouchPoints||"ontouchstart"in this}function wn(){var r=oc,t=nc,u=ic,f=cc,o={},n=Jr("start","drag","end"),i=0,c,l,h,m,x=0;function s(M){M.on("mousedown.drag",p).filter(f).on("touchstart.drag",S).on("touchmove.drag",_,Sn).on("touchend.drag touchcancel.drag",O).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(M,T){if(m||!r.call(this,M,T))return;var w=N(this,t.call(this,M,T),M,T,"mouse");if(!w)return;or(M.view).on("mousemove.drag",B,zr).on("mouseup.drag",I,zr),ot(M.view),fu(M),h=!1,c=M.clientX,l=M.clientY,w("start",M)}function B(M){if(Pr(M),!h){var T=M.clientX-c,w=M.clientY-l;h=T*T+w*w>x}o.mouse("drag",M)}function I(M){or(M.view).on("mousemove.drag mouseup.drag",null),Nt(M.view,h),Pr(M),o.mouse("end",M)}function S(M,T){if(!r.call(this,M,T))return;var w=M.changedTouches,J=t.call(this,M,T),L=w.length,a,Z;for(a=0;a<L;++a)if(Z=N(this,J,M,T,w[a].identifier,w[a]))fu(M),Z("start",M,w[a])}function _(M){var T=M.changedTouches,w=T.length,J,L;for(J=0;J<w;++J)if(L=o[T[J].identifier])Pr(M),L("drag",M,T[J])}function O(M){var T=M.changedTouches,w=T.length,J,L;if(m)clearTimeout(m);m=setTimeout(function(){m=null},500);for(J=0;J<w;++J)if(L=o[T[J].identifier])fu(M),L("end",M,T[J])}function N(M,T,w,J,L,a){var Z=n.copy(),X=mr(a||w,T),Q,e,A;if((A=u.call(M,new Vt("beforestart",{sourceEvent:w,target:s,identifier:L,active:i,x:X[0],y:X[1],dx:0,dy:0,dispatch:Z}),J))==null)return;return Q=A.x-X[0]||0,e=A.y-X[1]||0,function V(C,D,H){var U=X,$;switch(C){case"start":o[L]=V,$=i++;break;case"end":delete o[L],--i;case"drag":X=mr(H||D,T),$=i;break}Z.call(C,M,new Vt(C,{sourceEvent:D,subject:A,target:s,identifier:L,active:$,x:X[0]+Q,y:X[1]+e,dx:X[0]-U[0],dy:X[1]-U[1],dispatch:Z}),J)}}return s.filter=function(M){return arguments.length?(r=typeof M==="function"?M:Tt(!!M),s):r},s.container=function(M){return arguments.length?(t=typeof M==="function"?M:Tt(M),s):t},s.subject=function(M){return arguments.length?(u=typeof M==="function"?M:Tt(M),s):u},s.touchable=function(M){return arguments.length?(f=typeof M==="function"?M:Tt(!!M),s):f},s.on=function(){var M=n.on.apply(n,arguments);return M===n?s:M},s.clickDistance=function(M){return arguments.length?(x=(M=+M)*M,s):Math.sqrt(x)},s}function Lf(r){let t=+this._x.call(null,r),u=+this._y.call(null,r);return Cn(this.cover(t,u),t,u,r)}function Cn(r,t,u,f){if(isNaN(t)||isNaN(u))return r;var o,n=r._root,i={data:f},c=r._x0,l=r._y0,h=r._x1,m=r._y1,x,s,p,B,I,S,_,O;if(!n)return r._root=i,r;while(n.length){if(I=t>=(x=(c+h)/2))c=x;else h=x;if(S=u>=(s=(l+m)/2))l=s;else m=s;if(o=n,!(n=n[_=S<<1|I]))return o[_]=i,r}if(p=+r._x.call(null,n.data),B=+r._y.call(null,n.data),t===p&&u===B)return i.next=n,o?o[_]=i:r._root=i,r;do{if(o=o?o[_]=[,,,,]:r._root=[,,,,],I=t>=(x=(c+h)/2))c=x;else h=x;if(S=u>=(s=(l+m)/2))l=s;else m=s}while((_=S<<1|I)===(O=(B>=s)<<1|p>=x));return o[O]=n,o[_]=i,r}function Fn(r){var t,u,f=r.length,o,n,i=Array(f),c=Array(f),l=1/0,h=1/0,m=-1/0,x=-1/0;for(u=0;u<f;++u){if(isNaN(o=+this._x.call(null,t=r[u]))||isNaN(n=+this._y.call(null,t)))continue;if(i[u]=o,c[u]=n,o<l)l=o;if(o>m)m=o;if(n<h)h=n;if(n>x)x=n}if(l>m||h>x)return this;this.cover(l,h).cover(m,x);for(u=0;u<f;++u)Cn(this,i[u],c[u],r[u]);return this}function Uf(r,t){if(isNaN(r=+r)||isNaN(t=+t))return this;var u=this._x0,f=this._y0,o=this._x1,n=this._y1;if(isNaN(u))o=(u=Math.floor(r))+1,n=(f=Math.floor(t))+1;else{var i=o-u||1,c=this._root,l,h;while(u>r||r>=o||f>t||t>=n)switch(h=(t<f)<<1|r<u,l=[,,,,],l[h]=c,c=l,i*=2,h){case 0:o=u+i,n=f+i;break;case 1:u=o-i,n=f+i;break;case 2:o=u+i,f=n-i;break;case 3:u=o-i,f=n-i;break}if(this._root&&this._root.length)this._root=c}return this._x0=u,this._y0=f,this._x1=o,this._y1=n,this}function Zf(){var r=[];return this.visit(function(t){if(!t.length)do r.push(t.data);while(t=t.next)}),r}function Kf(r){return arguments.length?this.cover(+r[0][0],+r[0][1]).cover(+r[1][0],+r[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function j(r,t,u,f,o){this.node=r,this.x0=t,this.y0=u,this.x1=f,this.y1=o}function af(r,t,u){var f,o=this._x0,n=this._y0,i,c,l,h,m=this._x1,x=this._y1,s=[],p=this._root,B,I;if(p)s.push(new j(p,o,n,m,x));if(u==null)u=1/0;else o=r-u,n=t-u,m=r+u,x=t+u,u*=u;while(B=s.pop()){if(!(p=B.node)||(i=B.x0)>m||(c=B.y0)>x||(l=B.x1)<o||(h=B.y1)<n)continue;if(p.length){var S=(i+l)/2,_=(c+h)/2;if(s.push(new j(p[3],S,_,l,h),new j(p[2],i,_,S,h),new j(p[1],S,c,l,_),new j(p[0],i,c,S,_)),I=(t>=_)<<1|r>=S)B=s[s.length-1],s[s.length-1]=s[s.length-1-I],s[s.length-1-I]=B}else{var O=r-+this._x.call(null,p.data),N=t-+this._y.call(null,p.data),M=O*O+N*N;if(M<u){var T=Math.sqrt(u=M);o=r-T,n=t-T,m=r+T,x=t+T,f=p.data}}}return f}function Xf(r){if(isNaN(m=+this._x.call(null,r))||isNaN(x=+this._y.call(null,r)))return this;var t,u=this._root,f,o,n,i=this._x0,c=this._y0,l=this._x1,h=this._y1,m,x,s,p,B,I,S,_;if(!u)return this;if(u.length)while(!0){if(B=m>=(s=(i+l)/2))i=s;else l=s;if(I=x>=(p=(c+h)/2))c=p;else h=p;if(t=u,!(u=u[S=I<<1|B]))return this;if(!u.length)break;if(t[S+1&3]||t[S+2&3]||t[S+3&3])f=t,_=S}while(u.data!==r)if(o=u,!(u=u.next))return this;if(n=u.next)delete u.next;if(o)return n?o.next=n:delete o.next,this;if(!t)return this._root=n,this;if(n?t[S]=n:delete t[S],(u=t[0]||t[1]||t[2]||t[3])&&u===(t[3]||t[2]||t[1]||t[0])&&!u.length)if(f)f[_]=u;else this._root=u;return this}function Bn(r){for(var t=0,u=r.length;t<u;++t)this.remove(r[t]);return this}function Wf(){return this._root}function Gf(){var r=0;return this.visit(function(t){if(!t.length)do++r;while(t=t.next)}),r}function ef(r){var t=[],u,f=this._root,o,n,i,c,l;if(f)t.push(new j(f,this._x0,this._y0,this._x1,this._y1));while(u=t.pop())if(!r(f=u.node,n=u.x0,i=u.y0,c=u.x1,l=u.y1)&&f.length){var h=(n+c)/2,m=(i+l)/2;if(o=f[3])t.push(new j(o,h,m,c,l));if(o=f[2])t.push(new j(o,n,m,h,l));if(o=f[1])t.push(new j(o,h,i,c,m));if(o=f[0])t.push(new j(o,n,i,h,m))}return this}function Yf(r){var t=[],u=[],f;if(this._root)t.push(new j(this._root,this._x0,this._y0,this._x1,this._y1));while(f=t.pop()){var o=f.node;if(o.length){var n,i=f.x0,c=f.y0,l=f.x1,h=f.y1,m=(i+l)/2,x=(c+h)/2;if(n=o[0])t.push(new j(n,i,c,m,x));if(n=o[1])t.push(new j(n,m,c,l,x));if(n=o[2])t.push(new j(n,i,x,m,h));if(n=o[3])t.push(new j(n,m,x,l,h))}u.push(f)}while(f=u.pop())r(f.node,f.x0,f.y0,f.x1,f.y1);return this}function On(r){return r[0]}function Rf(r){return arguments.length?(this._x=r,this):this._x}function Nn(r){return r[1]}function zf(r){return arguments.length?(this._y=r,this):this._y}function qr(r,t,u){var f=new qf(t==null?On:t,u==null?Nn:u,NaN,NaN,NaN,NaN);return r==null?f:f.addAll(r)}function qf(r,t,u,f,o,n){this._x=r,this._y=t,this._x0=u,this._y0=f,this._x1=o,this._y1=n,this._root=void 0}function Tn(r){var t={data:r.data},u=t;while(r=r.next)u=u.next={data:r.data};return t}var tr=qr.prototype=qf.prototype;tr.copy=function(){var r=new qf(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,u,f;if(!t)return r;if(!t.length)return r._root=Tn(t),r;u=[{source:t,target:r._root=[,,,,]}];while(t=u.pop())for(var o=0;o<4;++o)if(f=t.source[o])if(f.length)u.push({source:f,target:t.target[o]=[,,,,]});else t.target[o]=Tn(f);return r};tr.add=Lf;tr.addAll=Fn;tr.cover=Uf;tr.data=Zf;tr.extent=Kf;tr.find=af;tr.remove=Xf;tr.removeAll=Bn;tr.root=Wf;tr.size=Gf;tr.visit=ef;tr.visitAfter=Yf;tr.x=Rf;tr.y=zf;function g(r){return function(){return r}}function xr(r){return(r()-0.5)*0.000001}function hc(r){return r.x+r.vx}function lc(r){return r.y+r.vy}function Vn(r){var t,u,f,o=1,n=1;if(typeof r!=="function")r=g(r==null?1:+r);function i(){var h,m=t.length,x,s,p,B,I,S;for(var _=0;_<n;++_){x=qr(t,hc,lc).visitAfter(c);for(h=0;h<m;++h)s=t[h],I=u[s.index],S=I*I,p=s.x+s.vx,B=s.y+s.vy,x.visit(O)}function O(N,M,T,w,J){var{data:L,r:a}=N,Z=I+a;if(L){if(L.index>s.index){var X=p-L.x-L.vx,Q=B-L.y-L.vy,e=X*X+Q*Q;if(e<Z*Z){if(X===0)X=xr(f),e+=X*X;if(Q===0)Q=xr(f),e+=Q*Q;e=(Z-(e=Math.sqrt(e)))/e*o,s.vx+=(X*=e)*(Z=(a*=a)/(S+a)),s.vy+=(Q*=e)*Z,L.vx-=X*(Z=1-Z),L.vy-=Q*Z}}return}return M>p+Z||w<p-Z||T>B+Z||J<B-Z}}function c(h){if(h.data)return h.r=u[h.data.index];for(var m=h.r=0;m<4;++m)if(h[m]&&h[m].r>h.r)h.r=h[m].r}function l(){if(!t)return;var h,m=t.length,x;u=Array(m);for(h=0;h<m;++h)x=t[h],u[x.index]=+r(x,h,t)}return i.initialize=function(h,m){t=h,f=m,l()},i.iterations=function(h){return arguments.length?(n=+h,i):n},i.strength=function(h){return arguments.length?(o=+h,i):o},i.radius=function(h){return arguments.length?(r=typeof h==="function"?h:g(+h),l(),i):r},i}function mc(r){return r.index}function Jn(r,t){var u=r.get(t);if(!u)throw Error("node not found: "+t);return u}function Pn(r){var t=mc,u=x,f,o=g(30),n,i,c,l,h,m=1;if(r==null)r=[];function x(S){return 1/Math.min(c[S.source.index],c[S.target.index])}function s(S){for(var _=0,O=r.length;_<m;++_)for(var N=0,M,T,w,J,L,a,Z;N<O;++N)M=r[N],T=M.source,w=M.target,J=w.x+w.vx-T.x-T.vx||xr(h),L=w.y+w.vy-T.y-T.vy||xr(h),a=Math.sqrt(J*J+L*L),a=(a-n[N])/a*S*f[N],J*=a,L*=a,w.vx-=J*(Z=l[N]),w.vy-=L*Z,T.vx+=J*(Z=1-Z),T.vy+=L*Z}function p(){if(!i)return;var S,_=i.length,O=r.length,N=new Map(i.map((T,w)=>[t(T,w,i),T])),M;for(S=0,c=Array(_);S<O;++S){if(M=r[S],M.index=S,typeof M.source!=="object")M.source=Jn(N,M.source);if(typeof M.target!=="object")M.target=Jn(N,M.target);c[M.source.index]=(c[M.source.index]||0)+1,c[M.target.index]=(c[M.target.index]||0)+1}for(S=0,l=Array(O);S<O;++S)M=r[S],l[S]=c[M.source.index]/(c[M.source.index]+c[M.target.index]);f=Array(O),B(),n=Array(O),I()}function B(){if(!i)return;for(var S=0,_=r.length;S<_;++S)f[S]=+u(r[S],S,r)}function I(){if(!i)return;for(var S=0,_=r.length;S<_;++S)n[S]=+o(r[S],S,r)}return s.initialize=function(S,_){i=S,h=_,p()},s.links=function(S){return arguments.length?(r=S,p(),s):r},s.id=function(S){return arguments.length?(t=S,s):t},s.iterations=function(S){return arguments.length?(m=+S,s):m},s.strength=function(S){return arguments.length?(u=typeof S==="function"?S:g(+S),B(),s):u},s.distance=function(S){return arguments.length?(o=typeof S==="function"?S:g(+S),I(),s):o},s}var nt=0,Pt=0,Jt=0,Qn=1000,ou,Dt,nu=0,Er=0,iu=0,Qt=typeof performance==="object"&&performance.now?performance:Date,$n=typeof window==="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(r){setTimeout(r,17)};function Ht(){return Er||($n(sc),Er=Qt.now()+iu)}function sc(){Er=0}function $t(){this._call=this._time=this._next=null}$t.prototype=it.prototype={constructor:$t,restart:function(r,t,u){if(typeof r!=="function")throw TypeError("callback is not a function");if(u=(u==null?Ht():+u)+(t==null?0:+t),!this._next&&Dt!==this){if(Dt)Dt._next=this;else ou=this;Dt=this}this._call=r,this._time=u,Ef()},stop:function(){if(this._call)this._call=null,this._time=1/0,Ef()}};function it(r,t,u){var f=new $t;return f.restart(r,t,u),f}function Hn(){Ht(),++nt;var r=ou,t;while(r){if((t=Er-r._time)>=0)r._call.call(void 0,t);r=r._next}--nt}function Dn(){Er=(nu=Qt.now())+iu,nt=Pt=0;try{Hn()}finally{nt=0,xc(),Er=0}}function pc(){var r=Qt.now(),t=r-nu;if(t>Qn)iu-=t,nu=r}function xc(){var r,t=ou,u,f=1/0;while(t)if(t._call){if(f>t._time)f=t._time;r=t,t=t._next}else u=t._next,t._next=null,t=r?r._next=u:ou=u;Dt=r,Ef(f)}function Ef(r){if(nt)return;if(Pt)Pt=clearTimeout(Pt);var t=r-Er;if(t>24){if(r<1/0)Pt=setTimeout(Dn,r-Qt.now()-iu);if(Jt)Jt=clearInterval(Jt)}else{if(!Jt)nu=Qt.now(),Jt=setInterval(pc,Qn);nt=1,$n(Dn)}}function Lt(r,t,u){var f=new $t;return t=t==null?0:+t,f.restart((o)=>{f.stop(),r(o+t)},t,u),f}function gf(){let r=1;return()=>(r=(1664525*r+1013904223)%4294967296)/4294967296}function Ln(r){return r.x}function Un(r){return r.y}var Mc=10,Ac=Math.PI*(3-Math.sqrt(5));function Zn(r){var t,u=1,f=0.001,o=1-Math.pow(f,0.0033333333333333335),n=0,i=0.6,c=new Map,l=it(x),h=Jr("tick","end"),m=gf();if(r==null)r=[];function x(){if(s(),h.call("tick",t),u<f)l.stop(),h.call("end",t)}function s(I){var S,_=r.length,O;if(I===void 0)I=1;for(var N=0;N<I;++N){u+=(n-u)*o,c.forEach(function(M){M(u)});for(S=0;S<_;++S){if(O=r[S],O.fx==null)O.x+=O.vx*=i;else O.x=O.fx,O.vx=0;if(O.fy==null)O.y+=O.vy*=i;else O.y=O.fy,O.vy=0}}return t}function p(){for(var I=0,S=r.length,_;I<S;++I){if(_=r[I],_.index=I,_.fx!=null)_.x=_.fx;if(_.fy!=null)_.y=_.fy;if(isNaN(_.x)||isNaN(_.y)){var O=Mc*Math.sqrt(0.5+I),N=I*Ac;_.x=O*Math.cos(N),_.y=O*Math.sin(N)}if(isNaN(_.vx)||isNaN(_.vy))_.vx=_.vy=0}}function B(I){if(I.initialize)I.initialize(r,m);return I}return p(),t={tick:s,restart:function(){return l.restart(x),t},stop:function(){return l.stop(),t},nodes:function(I){return arguments.length?(r=I,p(),c.forEach(B),t):r},alpha:function(I){return arguments.length?(u=+I,t):u},alphaMin:function(I){return arguments.length?(f=+I,t):f},alphaDecay:function(I){return arguments.length?(o=+I,t):+o},alphaTarget:function(I){return arguments.length?(n=+I,t):n},velocityDecay:function(I){return arguments.length?(i=1-I,t):1-i},randomSource:function(I){return arguments.length?(m=I,c.forEach(B),t):m},force:function(I,S){return arguments.length>1?(S==null?c.delete(I):c.set(I,B(S)),t):c.get(I)},find:function(I,S,_){var O=0,N=r.length,M,T,w,J,L;if(_==null)_=1/0;else _*=_;for(O=0;O<N;++O)if(J=r[O],M=I-J.x,T=S-J.y,w=M*M+T*T,w<_)L=J,_=w;return L},on:function(I,S){return arguments.length>1?(h.on(I,S),t):h.on(I)}}}function Kn(){var r,t,u,f,o=g(-30),n,i=1,c=1/0,l=0.81;function h(p){var B,I=r.length,S=qr(r,Ln,Un).visitAfter(x);for(f=p,B=0;B<I;++B)t=r[B],S.visit(s)}function m(){if(!r)return;var p,B=r.length,I;n=Array(B);for(p=0;p<B;++p)I=r[p],n[I.index]=+o(I,p,r)}function x(p){var B=0,I,S,_=0,O,N,M;if(p.length){for(O=N=M=0;M<4;++M)if((I=p[M])&&(S=Math.abs(I.value)))B+=I.value,_+=S,O+=S*I.x,N+=S*I.y;p.x=O/_,p.y=N/_}else{I=p,I.x=I.data.x,I.y=I.data.y;do B+=n[I.data.index];while(I=I.next)}p.value=B}function s(p,B,I,S){if(!p.value)return!0;var _=p.x-t.x,O=p.y-t.y,N=S-B,M=_*_+O*O;if(N*N/l<M){if(M<c){if(_===0)_=xr(u),M+=_*_;if(O===0)O=xr(u),M+=O*O;if(M<i)M=Math.sqrt(i*M);t.vx+=_*p.value*f/M,t.vy+=O*p.value*f/M}return!0}else if(p.length||M>=c)return;if(p.data!==t||p.next){if(_===0)_=xr(u),M+=_*_;if(O===0)O=xr(u),M+=O*O;if(M<i)M=Math.sqrt(i*M)}do if(p.data!==t)N=n[p.data.index]*f/M,t.vx+=_*N,t.vy+=O*N;while(p=p.next)}return h.initialize=function(p,B){r=p,u=B,m()},h.strength=function(p){return arguments.length?(o=typeof p==="function"?p:g(+p),m(),h):o},h.distanceMin=function(p){return arguments.length?(i=p*p,h):Math.sqrt(i)},h.distanceMax=function(p){return arguments.length?(c=p*p,h):Math.sqrt(c)},h.theta=function(p){return arguments.length?(l=p*p,h):Math.sqrt(l)},h}function an(r){var t=g(0.1),u,f,o;if(typeof r!=="function")r=g(r==null?0:+r);function n(c){for(var l=0,h=u.length,m;l<h;++l)m=u[l],m.vx+=(o[l]-m.x)*f[l]*c}function i(){if(!u)return;var c,l=u.length;f=Array(l),o=Array(l);for(c=0;c<l;++c)f[c]=isNaN(o[c]=+r(u[c],c,u))?0:+t(u[c],c,u)}return n.initialize=function(c){u=c,i()},n.strength=function(c){return arguments.length?(t=typeof c==="function"?c:g(+c),i(),n):t},n.x=function(c){return arguments.length?(r=typeof c==="function"?c:g(+c),i(),n):r},n}function Xn(r){var t=g(0.1),u,f,o;if(typeof r!=="function")r=g(r==null?0:+r);function n(c){for(var l=0,h=u.length,m;l<h;++l)m=u[l],m.vy+=(o[l]-m.y)*f[l]*c}function i(){if(!u)return;var c,l=u.length;f=Array(l),o=Array(l);for(c=0;c<l;++c)f[c]=isNaN(o[c]=+r(u[c],c,u))?0:+t(u[c],c,u)}return n.initialize=function(c){u=c,i()},n.strength=function(c){return arguments.length?(t=typeof c==="function"?c:g(+c),i(),n):t},n.y=function(c){return arguments.length?(r=typeof c==="function"?c:g(+c),i(),n):r},n}function Ut(r,t,u){r.prototype=t.prototype=u,u.constructor=r}function yf(r,t){var u=Object.create(r.prototype);for(var f in t)u[f]=t[f];return u}function at(){}var Zt=0.7,lu=1/Zt,ct="\\s*([+-]?\\d+)\\s*",Kt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Or="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",_c=/^#([0-9a-f]{3,8})$/,Ic=new RegExp(`^rgb\\(${ct},${ct},${ct}\\)$`),Sc=new RegExp(`^rgb\\(${Or},${Or},${Or}\\)$`),wc=new RegExp(`^rgba\\(${ct},${ct},${ct},${Kt}\\)$`),Cc=new RegExp(`^rgba\\(${Or},${Or},${Or},${Kt}\\)$`),Fc=new RegExp(`^hsl\\(${Kt},${Or},${Or}\\)$`),Bc=new RegExp(`^hsla\\(${Kt},${Or},${Or},${Kt}\\)$`),Wn={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};Ut(at,Sr,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:Gn,formatHex:Gn,formatHex8:Oc,formatHsl:Nc,formatRgb:en,toString:en});function Gn(){return this.rgb().formatHex()}function Oc(){return this.rgb().formatHex8()}function Nc(){return gn(this).formatHsl()}function en(){return this.rgb().formatRgb()}function Sr(r){var t,u;return r=(r+"").trim().toLowerCase(),(t=_c.exec(r))?(u=t[1].length,t=parseInt(t[1],16),u===6?Yn(t):u===3?new nr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):u===8?cu(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):u===4?cu(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Ic.exec(r))?new nr(t[1],t[2],t[3],1):(t=Sc.exec(r))?new nr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=wc.exec(r))?cu(t[1],t[2],t[3],t[4]):(t=Cc.exec(r))?cu(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Fc.exec(r))?qn(t[1],t[2]/100,t[3]/100,1):(t=Bc.exec(r))?qn(t[1],t[2]/100,t[3]/100,t[4]):Wn.hasOwnProperty(r)?Yn(Wn[r]):r==="transparent"?new nr(NaN,NaN,NaN,0):null}function Yn(r){return new nr(r>>16&255,r>>8&255,r&255,1)}function cu(r,t,u,f){if(f<=0)r=t=u=NaN;return new nr(r,t,u,f)}function Tc(r){if(!(r instanceof at))r=Sr(r);if(!r)return new nr;return r=r.rgb(),new nr(r.r,r.g,r.b,r.opacity)}function ht(r,t,u,f){return arguments.length===1?Tc(r):new nr(r,t,u,f==null?1:f)}function nr(r,t,u,f){this.r=+r,this.g=+t,this.b=+u,this.opacity=+f}Ut(nr,ht,yf(at,{brighter(r){return r=r==null?lu:Math.pow(lu,r),new nr(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?Zt:Math.pow(Zt,r),new nr(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new nr(yr(this.r),yr(this.g),yr(this.b),mu(this.opacity))},displayable(){return-0.5<=this.r&&this.r<255.5&&(-0.5<=this.g&&this.g<255.5)&&(-0.5<=this.b&&this.b<255.5)&&(0<=this.opacity&&this.opacity<=1)},hex:Rn,formatHex:Rn,formatHex8:Vc,formatRgb:zn,toString:zn}));function Rn(){return`#${gr(this.r)}${gr(this.g)}${gr(this.b)}`}function Vc(){return`#${gr(this.r)}${gr(this.g)}${gr(this.b)}${gr((isNaN(this.opacity)?1:this.opacity)*255)}`}function zn(){let r=mu(this.opacity);return`${r===1?"rgb(":"rgba("}${yr(this.r)}, ${yr(this.g)}, ${yr(this.b)}${r===1?")":`, ${r})`}`}function mu(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function yr(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function gr(r){return r=yr(r),(r<16?"0":"")+r.toString(16)}function qn(r,t,u,f){if(f<=0)r=t=u=NaN;else if(u<=0||u>=1)r=t=NaN;else if(t<=0)r=NaN;return new Ir(r,t,u,f)}function gn(r){if(r instanceof Ir)return new Ir(r.h,r.s,r.l,r.opacity);if(!(r instanceof at))r=Sr(r);if(!r)return new Ir;if(r instanceof Ir)return r;r=r.rgb();var t=r.r/255,u=r.g/255,f=r.b/255,o=Math.min(t,u,f),n=Math.max(t,u,f),i=NaN,c=n-o,l=(n+o)/2;if(c){if(t===n)i=(u-f)/c+(u<f)*6;else if(u===n)i=(f-t)/c+2;else i=(t-u)/c+4;c/=l<0.5?n+o:2-n-o,i*=60}else c=l>0&&l<1?0:i;return new Ir(i,c,l,r.opacity)}function yn(r,t,u,f){return arguments.length===1?gn(r):new Ir(r,t,u,f==null?1:f)}function Ir(r,t,u,f){this.h=+r,this.s=+t,this.l=+u,this.opacity=+f}Ut(Ir,yn,yf(at,{brighter(r){return r=r==null?lu:Math.pow(lu,r),new Ir(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?Zt:Math.pow(Zt,r),new Ir(this.h,this.s,this.l*r,this.opacity)},rgb(){var r=this.h%360+(this.h<0)*360,t=isNaN(r)||isNaN(this.s)?0:this.s,u=this.l,f=u+(u<0.5?u:1-u)*t,o=2*u-f;return new nr(jf(r>=240?r-240:r+120,o,f),jf(r,o,f),jf(r<120?r+240:r-120,o,f),this.opacity)},clamp(){return new Ir(En(this.h),hu(this.s),hu(this.l),mu(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&(0<=this.l&&this.l<=1)&&(0<=this.opacity&&this.opacity<=1)},formatHsl(){let r=mu(this.opacity);return`${r===1?"hsl(":"hsla("}${En(this.h)}, ${hu(this.s)*100}%, ${hu(this.l)*100}%${r===1?")":`, ${r})`}`}}));function En(r){return r=(r||0)%360,r<0?r+360:r}function hu(r){return Math.max(0,Math.min(1,r||0))}function jf(r,t,u){return(r<60?t+(u-t)*r/60:r<180?u:r<240?t+(u-t)*(240-r)/60:t)*255}function bf(r,t,u,f,o){var n=r*r,i=n*r;return((1-3*r+3*n-i)*t+(4-6*n+3*i)*u+(1+3*r+3*n-3*i)*f+i*o)/6}function vf(r){var t=r.length-1;return function(u){var f=u<=0?u=0:u>=1?(u=1,t-1):Math.floor(u*t),o=r[f],n=r[f+1],i=f>0?r[f-1]:2*o-n,c=f<t-1?r[f+2]:2*n-o;return bf((u-f/t)*t,i,o,n,c)}}function kf(r){var t=r.length;return function(u){var f=Math.floor(((u%=1)<0?++u:u)*t),o=r[(f+t-1)%t],n=r[f%t],i=r[(f+1)%t],c=r[(f+2)%t];return bf((u-f/t)*t,o,n,i,c)}}var Xt=(r)=>()=>r;function Jc(r,t){return function(u){return r+u*t}}function Pc(r,t,u){return r=Math.pow(r,u),t=Math.pow(t,u)-r,u=1/u,function(f){return Math.pow(r+f*t,u)}}function jn(r){return(r=+r)===1?su:function(t,u){return u-t?Pc(t,u,r):Xt(isNaN(t)?u:t)}}function su(r,t){var u=t-r;return u?Jc(r,u):Xt(isNaN(r)?t:r)}var jr=function r(t){var u=jn(t);function f(o,n){var i=u((o=ht(o)).r,(n=ht(n)).r),c=u(o.g,n.g),l=u(o.b,n.b),h=su(o.opacity,n.opacity);return function(m){return o.r=i(m),o.g=c(m),o.b=l(m),o.opacity=h(m),o+""}}return f.gamma=r,f}(1);function bn(r){return function(t){var u=t.length,f=Array(u),o=Array(u),n=Array(u),i,c;for(i=0;i<u;++i)c=ht(t[i]),f[i]=c.r||0,o[i]=c.g||0,n[i]=c.b||0;return f=r(f),o=r(o),n=r(n),c.opacity=1,function(l){return c.r=f(l),c.g=o(l),c.b=n(l),c+""}}}var Dc=bn(vf),Qc=bn(kf);function df(r,t){if(!t)t=[];var u=r?Math.min(t.length,r.length):0,f=t.slice(),o;return function(n){for(o=0;o<u;++o)f[o]=r[o]*(1-n)+t[o]*n;return f}}function vn(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function kn(r,t){var u=t?t.length:0,f=r?Math.min(u,r.length):0,o=Array(f),n=Array(u),i;for(i=0;i<f;++i)o[i]=Kr(r[i],t[i]);for(;i<u;++i)n[i]=t[i];return function(c){for(i=0;i<f;++i)n[i]=o[i](c);return n}}function ro(r,t){var u=new Date;return r=+r,t=+t,function(f){return u.setTime(r*(1-f)+t*f),u}}function v(r,t){return r=+r,t=+t,function(u){return r*(1-u)+t*u}}function to(r,t){var u={},f={},o;if(r===null||typeof r!=="object")r={};if(t===null||typeof t!=="object")t={};for(o in t)if(o in r)u[o]=Kr(r[o],t[o]);else f[o]=t[o];return function(n){for(o in u)f[o]=u[o](n);return f}}var fo=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,uo=new RegExp(fo.source,"g");function $c(r){return function(){return r}}function Hc(r){return function(t){return r(t)+""}}function lt(r,t){var u=fo.lastIndex=uo.lastIndex=0,f,o,n,i=-1,c=[],l=[];r=r+"",t=t+"";while((f=fo.exec(r))&&(o=uo.exec(t))){if((n=o.index)>u)if(n=t.slice(u,n),c[i])c[i]+=n;else c[++i]=n;if((f=f[0])===(o=o[0]))if(c[i])c[i]+=o;else c[++i]=o;else c[++i]=null,l.push({i,x:v(f,o)});u=uo.lastIndex}if(u<t.length)if(n=t.slice(u),c[i])c[i]+=n;else c[++i]=n;return c.length<2?l[0]?Hc(l[0].x):$c(t):(t=l.length,function(h){for(var m=0,x;m<t;++m)c[(x=l[m]).i]=x.x(h);return c.join("")})}function Kr(r,t){var u=typeof t,f;return t==null||u==="boolean"?Xt(t):(u==="number"?v:u==="string"?(f=Sr(t))?(t=f,jr):lt:t instanceof Sr?jr:t instanceof Date?ro:vn(t)?df:Array.isArray(t)?kn:typeof t.valueOf!=="function"&&typeof t.toString!=="function"||isNaN(t)?to:v)(r,t)}function pu(r,t){return r=+r,t=+t,function(u){return Math.round(r*(1-u)+t*u)}}var dn=180/Math.PI,xu={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Mu(r,t,u,f,o,n){var i,c,l;if(i=Math.sqrt(r*r+t*t))r/=i,t/=i;if(l=r*u+t*f)u-=r*l,f-=t*l;if(c=Math.sqrt(u*u+f*f))u/=c,f/=c,l/=c;if(r*f<t*u)r=-r,t=-t,l=-l,i=-i;return{translateX:o,translateY:n,rotate:Math.atan2(t,r)*dn,skewX:Math.atan(l)*dn,scaleX:i,scaleY:c}}var Au;function ri(r){let t=new(typeof DOMMatrix==="function"?DOMMatrix:WebKitCSSMatrix)(r+"");return t.isIdentity?xu:Mu(t.a,t.b,t.c,t.d,t.e,t.f)}function ti(r){if(r==null)return xu;if(!Au)Au=document.createElementNS("http://www.w3.org/2000/svg","g");if(Au.setAttribute("transform",r),!(r=Au.transform.baseVal.consolidate()))return xu;return r=r.matrix,Mu(r.a,r.b,r.c,r.d,r.e,r.f)}function ui(r,t,u,f){function o(h){return h.length?h.pop()+" ":""}function n(h,m,x,s,p,B){if(h!==x||m!==s){var I=p.push("translate(",null,t,null,u);B.push({i:I-4,x:v(h,x)},{i:I-2,x:v(m,s)})}else if(x||s)p.push("translate("+x+t+s+u)}function i(h,m,x,s){if(h!==m){if(h-m>180)m+=360;else if(m-h>180)h+=360;s.push({i:x.push(o(x)+"rotate(",null,f)-2,x:v(h,m)})}else if(m)x.push(o(x)+"rotate("+m+f)}function c(h,m,x,s){if(h!==m)s.push({i:x.push(o(x)+"skewX(",null,f)-2,x:v(h,m)});else if(m)x.push(o(x)+"skewX("+m+f)}function l(h,m,x,s,p,B){if(h!==x||m!==s){var I=p.push(o(p)+"scale(",null,",",null,")");B.push({i:I-4,x:v(h,x)},{i:I-2,x:v(m,s)})}else if(x!==1||s!==1)p.push(o(p)+"scale("+x+","+s+")")}return function(h,m){var x=[],s=[];return h=r(h),m=r(m),n(h.translateX,h.translateY,m.translateX,m.translateY,x,s),i(h.rotate,m.rotate,x,s),c(h.skewX,m.skewX,x,s),l(h.scaleX,h.scaleY,m.scaleX,m.scaleY,x,s),h=m=null,function(p){var B=-1,I=s.length,S;while(++B<I)x[(S=s[B]).i]=S.x(p);return x.join("")}}}var oo=ui(ri,"px, ","px)","deg)"),no=ui(ti,", ",")",")");var Lc=0.000000000001;function fi(r){return((r=Math.exp(r))+1/r)/2}function Uc(r){return((r=Math.exp(r))-1/r)/2}function Zc(r){return((r=Math.exp(2*r))-1)/(r+1)}var io=function r(t,u,f){function o(n,i){var c=n[0],l=n[1],h=n[2],m=i[0],x=i[1],s=i[2],p=m-c,B=x-l,I=p*p+B*B,S,_;if(I<Lc)_=Math.log(s/h)/t,S=function(J){return[c+J*p,l+J*B,h*Math.exp(t*J*_)]};else{var O=Math.sqrt(I),N=(s*s-h*h+f*I)/(2*h*u*O),M=(s*s-h*h-f*I)/(2*s*u*O),T=Math.log(Math.sqrt(N*N+1)-N),w=Math.log(Math.sqrt(M*M+1)-M);_=(w-T)/t,S=function(J){var L=J*_,a=fi(T),Z=h/(u*O)*(a*Zc(t*L+T)-Uc(T));return[c+Z*p,l+Z*B,h*a/fi(t*L+T)]}}return S.duration=_*1000*t/Math.SQRT2,S}return o.rho=function(n){var i=Math.max(0.001,+n),c=i*i,l=c*c;return r(i,c,l)},o}(Math.SQRT2,2,4);function co(r){return function(){return r}}function ho(r){return+r}var oi=[0,1];function mt(r){return r}function lo(r,t){return(t-=r=+r)?function(u){return(u-r)/t}:co(isNaN(t)?NaN:0.5)}function Kc(r,t){var u;if(r>t)u=r,r=t,t=u;return function(f){return Math.max(r,Math.min(t,f))}}function ac(r,t,u){var f=r[0],o=r[1],n=t[0],i=t[1];if(o<f)f=lo(o,f),n=u(i,n);else f=lo(f,o),n=u(n,i);return function(c){return n(f(c))}}function Xc(r,t,u){var f=Math.min(r.length,t.length)-1,o=Array(f),n=Array(f),i=-1;if(r[f]<r[0])r=r.slice().reverse(),t=t.slice().reverse();while(++i<f)o[i]=lo(r[i],r[i+1]),n[i]=u(t[i],t[i+1]);return function(c){var l=eu(r,c,1,f)-1;return n[l](o[l](c))}}function _u(r,t){return t.domain(r.domain()).range(r.range()).interpolate(r.interpolate()).clamp(r.clamp()).unknown(r.unknown())}function Wc(){var r=oi,t=oi,u=Kr,f,o,n,i=mt,c,l,h;function m(){var s=Math.min(r.length,t.length);if(i!==mt)i=Kc(r[0],r[s-1]);return c=s>2?Xc:ac,l=h=null,x}function x(s){return s==null||isNaN(s=+s)?n:(l||(l=c(r.map(f),t,u)))(f(i(s)))}return x.invert=function(s){return i(o((h||(h=c(t,r.map(f),v)))(s)))},x.domain=function(s){return arguments.length?(r=Array.from(s,ho),m()):r.slice()},x.range=function(s){return arguments.length?(t=Array.from(s),m()):t.slice()},x.rangeRound=function(s){return t=Array.from(s),u=pu,m()},x.clamp=function(s){return arguments.length?(i=s?!0:mt,m()):i!==mt},x.interpolate=function(s){return arguments.length?(u=s,m()):u},x.unknown=function(s){return arguments.length?(n=s,x):n},function(s,p){return f=s,o=p,m()}}function Wt(){return Wc()(mt,mt)}function Iu(r,t){switch(arguments.length){case 0:break;case 1:this.range(r);break;default:this.range(t).domain(r);break}return this}function mo(r){return Math.abs(r=Math.round(r))>=1000000000000000000000?r.toLocaleString("en").replace(/,/g,""):r.toString(10)}function br(r,t){if(!isFinite(r)||r===0)return null;var u=(r=t?r.toExponential(t-1):r.toExponential()).indexOf("e"),f=r.slice(0,u);return[f.length>1?f[0]+f.slice(2):f,+r.slice(u+1)]}function wr(r){return r=br(Math.abs(r)),r?r[1]:NaN}function so(r,t){return function(u,f){var o=u.length,n=[],i=0,c=r[0],l=0;while(o>0&&c>0){if(l+c+1>f)c=Math.max(1,f-l);if(n.push(u.substring(o-=c,o+c)),(l+=c+1)>f)break;c=r[i=(i+1)%r.length]}return n.reverse().join(t)}}function po(r){return function(t){return t.replace(/[0-9]/g,function(u){return r[+u]})}}var Gc=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ar(r){if(!(t=Gc.exec(r)))throw Error("invalid format: "+r);var t;return new Su({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}ar.prototype=Su.prototype;function Su(r){this.fill=r.fill===void 0?" ":r.fill+"",this.align=r.align===void 0?">":r.align+"",this.sign=r.sign===void 0?"-":r.sign+"",this.symbol=r.symbol===void 0?"":r.symbol+"",this.zero=!!r.zero,this.width=r.width===void 0?void 0:+r.width,this.comma=!!r.comma,this.precision=r.precision===void 0?void 0:+r.precision,this.trim=!!r.trim,this.type=r.type===void 0?"":r.type+""}Su.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function xo(r){r:for(var t=r.length,u=1,f=-1,o;u<t;++u)switch(r[u]){case".":f=o=u;break;case"0":if(f===0)f=u;o=u;break;default:if(!+r[u])break r;if(f>0)f=0;break}return f>0?r.slice(0,f)+r.slice(o+1):r}var Gt;function Mo(r,t){var u=br(r,t);if(!u)return Gt=void 0,r.toPrecision(t);var f=u[0],o=u[1],n=o-(Gt=Math.max(-8,Math.min(8,Math.floor(o/3)))*3)+1,i=f.length;return n===i?f:n>i?f+Array(n-i+1).join("0"):n>0?f.slice(0,n)+"."+f.slice(n):"0."+Array(1-n).join("0")+br(r,Math.max(0,t+n-1))[0]}function wu(r,t){var u=br(r,t);if(!u)return r+"";var f=u[0],o=u[1];return o<0?"0."+Array(-o).join("0")+f:f.length>o+1?f.slice(0,o+1)+"."+f.slice(o+1):f+Array(o-f.length+2).join("0")}var Ao={"%":(r,t)=>(r*100).toFixed(t),b:(r)=>Math.round(r).toString(2),c:(r)=>r+"",d:mo,e:(r,t)=>r.toExponential(t),f:(r,t)=>r.toFixed(t),g:(r,t)=>r.toPrecision(t),o:(r)=>Math.round(r).toString(8),p:(r,t)=>wu(r*100,t),r:wu,s:Mo,X:(r)=>Math.round(r).toString(16).toUpperCase(),x:(r)=>Math.round(r).toString(16)};function Cu(r){return r}var ni=Array.prototype.map,ii=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function _o(r){var t=r.grouping===void 0||r.thousands===void 0?Cu:so(ni.call(r.grouping,Number),r.thousands+""),u=r.currency===void 0?"":r.currency[0]+"",f=r.currency===void 0?"":r.currency[1]+"",o=r.decimal===void 0?".":r.decimal+"",n=r.numerals===void 0?Cu:po(ni.call(r.numerals,String)),i=r.percent===void 0?"%":r.percent+"",c=r.minus===void 0?"−":r.minus+"",l=r.nan===void 0?"NaN":r.nan+"";function h(x,s){x=ar(x);var{fill:p,align:B,sign:I,symbol:S,zero:_,width:O,comma:N,precision:M,trim:T,type:w}=x;if(w==="n")N=!0,w="g";else if(!Ao[w])M===void 0&&(M=12),T=!0,w="g";if(_||p==="0"&&B==="=")_=!0,p="0",B="=";var J=(s&&s.prefix!==void 0?s.prefix:"")+(S==="$"?u:S==="#"&&/[boxX]/.test(w)?"0"+w.toLowerCase():""),L=(S==="$"?f:/[%p]/.test(w)?i:"")+(s&&s.suffix!==void 0?s.suffix:""),a=Ao[w],Z=/[defgprs%]/.test(w);M=M===void 0?6:/[gprs]/.test(w)?Math.max(1,Math.min(21,M)):Math.max(0,Math.min(20,M));function X(Q){var e=J,A=L,V,C,D;if(w==="c")A=a(Q)+A,Q="";else{Q=+Q;var H=Q<0||1/Q<0;if(Q=isNaN(Q)?l:a(Math.abs(Q),M),T)Q=xo(Q);if(H&&+Q===0&&I!=="+")H=!1;if(e=(H?I==="("?I:c:I==="-"||I==="("?"":I)+e,A=(w==="s"&&!isNaN(Q)&&Gt!==void 0?ii[8+Gt/3]:"")+A+(H&&I==="("?")":""),Z){V=-1,C=Q.length;while(++V<C)if(D=Q.charCodeAt(V),48>D||D>57){A=(D===46?o+Q.slice(V+1):Q.slice(V))+A,Q=Q.slice(0,V);break}}}if(N&&!_)Q=t(Q,1/0);var U=e.length+Q.length+A.length,$=U<O?Array(O-U+1).join(p):"";if(N&&_)Q=t($+Q,$.length?O-A.length:1/0),$="";switch(B){case"<":Q=e+Q+A+$;break;case"=":Q=e+$+Q+A;break;case"^":Q=$.slice(0,U=$.length>>1)+e+Q+A+$.slice(U);break;default:Q=$+e+Q+A;break}return n(Q)}return X.toString=function(){return x+""},X}function m(x,s){var p=Math.max(-8,Math.min(8,Math.floor(wr(s)/3)))*3,B=Math.pow(10,-p),I=h((x=ar(x),x.type="f",x),{suffix:ii[8+p/3]});return function(S){return I(B*S)}}return{format:h,formatPrefix:m}}var Fu,Bu,Ou;Io({thousands:",",grouping:[3],currency:["$",""]});function Io(r){return Fu=_o(r),Bu=Fu.format,Ou=Fu.formatPrefix,Fu}function Nu(r){return Math.max(0,-wr(Math.abs(r)))}function Tu(r,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(wr(t)/3)))*3-wr(Math.abs(r)))}function Vu(r,t){return r=Math.abs(r),t=Math.abs(t)-r,Math.max(0,wr(t)-wr(r))+1}function So(r,t,u,f){var o=tt(r,t,u),n;switch(f=ar(f==null?",f":f),f.type){case"s":{var i=Math.max(Math.abs(r),Math.abs(t));if(f.precision==null&&!isNaN(n=Tu(o,i)))f.precision=n;return Ou(f,i)}case"":case"e":case"g":case"p":case"r":{if(f.precision==null&&!isNaN(n=Vu(o,Math.max(Math.abs(r),Math.abs(t)))))f.precision=n-(f.type==="e");break}case"f":case"%":{if(f.precision==null&&!isNaN(n=Nu(o)))f.precision=n-(f.type==="%")*2;break}}return Bu(f)}function ec(r){var t=r.domain;return r.ticks=function(u){var f=t();return dt(f[0],f[f.length-1],u==null?10:u)},r.tickFormat=function(u,f){var o=t();return So(o[0],o[o.length-1],u==null?10:u,f)},r.nice=function(u){if(u==null)u=10;var f=t(),o=0,n=f.length-1,i=f[o],c=f[n],l,h,m=10;if(c<i)h=i,i=c,c=h,h=o,o=n,n=h;while(m-- >0){if(h=St(i,c,u),h===l)return f[o]=i,f[n]=c,t(f);else if(h>0)i=Math.floor(i/h)*h,c=Math.ceil(c/h)*h;else if(h<0)i=Math.ceil(i*h)/h,c=Math.floor(c*h)/h;else break;l=h}return r},r}function wo(){var r=Wt();return r.copy=function(){return _u(r,wo())},Iu.apply(r,arguments),ec(r)}var Co=new Date,Fo=new Date;function R(r,t,u,f){function o(n){return r(n=arguments.length===0?new Date:new Date(+n)),n}if(o.floor=(n)=>{return r(n=new Date(+n)),n},o.ceil=(n)=>{return r(n=new Date(n-1)),t(n,1),r(n),n},o.round=(n)=>{let i=o(n),c=o.ceil(n);return n-i<c-n?i:c},o.offset=(n,i)=>{return t(n=new Date(+n),i==null?1:Math.floor(i)),n},o.range=(n,i,c)=>{let l=[];if(n=o.ceil(n),c=c==null?1:Math.floor(c),!(n<i)||!(c>0))return l;let h;do l.push(h=new Date(+n)),t(n,c),r(n);while(h<n&&n<i);return l},o.filter=(n)=>{return R((i)=>{if(i>=i)while(r(i),!n(i))i.setTime(i-1)},(i,c)=>{if(i>=i)if(c<0)while(++c<=0)while(t(i,-1),!n(i));else while(--c>=0)while(t(i,1),!n(i));})},u)o.count=(n,i)=>{return Co.setTime(+n),Fo.setTime(+i),r(Co),r(Fo),Math.floor(u(Co,Fo))},o.every=(n)=>{return n=Math.floor(n),!isFinite(n)||!(n>0)?null:!(n>1)?o:o.filter(f?(i)=>f(i)%n===0:(i)=>o.count(0,i)%n===0)};return o}var et=R(()=>{},(r,t)=>{r.setTime(+r+t)},(r,t)=>{return t-r});et.every=(r)=>{if(r=Math.floor(r),!isFinite(r)||!(r>0))return null;if(!(r>1))return et;return R((t)=>{t.setTime(Math.floor(t/r)*r)},(t,u)=>{t.setTime(+t+u*r)},(t,u)=>{return(u-t)/r})};var C_=et.range;var Mr=1000,rr=60000,Nr=3600000,Xr=86400000,Yt=604800000,Bo=2592000000,Ju=31536000000;var Tr=R((r)=>{r.setTime(r-r.getMilliseconds())},(r,t)=>{r.setTime(+r+t*Mr)},(r,t)=>{return(t-r)/Mr},(r)=>{return r.getUTCSeconds()}),ci=Tr.range;var st=R((r)=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*Mr)},(r,t)=>{r.setTime(+r+t*rr)},(r,t)=>{return(t-r)/rr},(r)=>{return r.getMinutes()}),Yc=st.range,Pu=R((r)=>{r.setUTCSeconds(0,0)},(r,t)=>{r.setTime(+r+t*rr)},(r,t)=>{return(t-r)/rr},(r)=>{return r.getUTCMinutes()}),Rc=Pu.range;var pt=R((r)=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*Mr-r.getMinutes()*rr)},(r,t)=>{r.setTime(+r+t*Nr)},(r,t)=>{return(t-r)/Nr},(r)=>{return r.getHours()}),zc=pt.range,Du=R((r)=>{r.setUTCMinutes(0,0,0)},(r,t)=>{r.setTime(+r+t*Nr)},(r,t)=>{return(t-r)/Nr},(r)=>{return r.getUTCHours()}),qc=Du.range;var Dr=R((r)=>r.setHours(0,0,0,0),(r,t)=>r.setDate(r.getDate()+t),(r,t)=>(t-r-(t.getTimezoneOffset()-r.getTimezoneOffset())*rr)/Xr,(r)=>r.getDate()-1),Ec=Dr.range,Rt=R((r)=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>{return(t-r)/Xr},(r)=>{return r.getUTCDate()-1}),gc=Rt.range,Qu=R((r)=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>{return(t-r)/Xr},(r)=>{return Math.floor(r/Xr)}),yc=Qu.range;function vr(r){return R((t)=>{t.setDate(t.getDate()-(t.getDay()+7-r)%7),t.setHours(0,0,0,0)},(t,u)=>{t.setDate(t.getDate()+u*7)},(t,u)=>{return(u-t-(u.getTimezoneOffset()-t.getTimezoneOffset())*rr)/Yt})}var Qr=vr(0),xt=vr(1),hi=vr(2),li=vr(3),Wr=vr(4),mi=vr(5),si=vr(6),pi=Qr.range,jc=xt.range,bc=hi.range,vc=li.range,kc=Wr.range,dc=mi.range,rh=si.range;function kr(r){return R((t)=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-r)%7),t.setUTCHours(0,0,0,0)},(t,u)=>{t.setUTCDate(t.getUTCDate()+u*7)},(t,u)=>{return(u-t)/Yt})}var dr=kr(0),Mt=kr(1),xi=kr(2),Mi=kr(3),Gr=kr(4),Ai=kr(5),_i=kr(6),Ii=dr.range,th=Mt.range,uh=xi.range,fh=Mi.range,oh=Gr.range,nh=Ai.range,ih=_i.range;var At=R((r)=>{r.setDate(1),r.setHours(0,0,0,0)},(r,t)=>{r.setMonth(r.getMonth()+t)},(r,t)=>{return t.getMonth()-r.getMonth()+(t.getFullYear()-r.getFullYear())*12},(r)=>{return r.getMonth()}),ch=At.range,$u=R((r)=>{r.setUTCDate(1),r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCMonth(r.getUTCMonth()+t)},(r,t)=>{return t.getUTCMonth()-r.getUTCMonth()+(t.getUTCFullYear()-r.getUTCFullYear())*12},(r)=>{return r.getUTCMonth()}),hh=$u.range;var sr=R((r)=>{r.setMonth(0,1),r.setHours(0,0,0,0)},(r,t)=>{r.setFullYear(r.getFullYear()+t)},(r,t)=>{return t.getFullYear()-r.getFullYear()},(r)=>{return r.getFullYear()});sr.every=(r)=>{return!isFinite(r=Math.floor(r))||!(r>0)?null:R((t)=>{t.setFullYear(Math.floor(t.getFullYear()/r)*r),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,u)=>{t.setFullYear(t.getFullYear()+u*r)})};var lh=sr.range,Cr=R((r)=>{r.setUTCMonth(0,1),r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCFullYear(r.getUTCFullYear()+t)},(r,t)=>{return t.getUTCFullYear()-r.getUTCFullYear()},(r)=>{return r.getUTCFullYear()});Cr.every=(r)=>{return!isFinite(r=Math.floor(r))||!(r>0)?null:R((t)=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/r)*r),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,u)=>{t.setUTCFullYear(t.getUTCFullYear()+u*r)})};var mh=Cr.range;function Si(r,t,u,f,o,n){let i=[[Tr,1,Mr],[Tr,5,5*Mr],[Tr,15,15*Mr],[Tr,30,30*Mr],[n,1,rr],[n,5,5*rr],[n,15,15*rr],[n,30,30*rr],[o,1,Nr],[o,3,3*Nr],[o,6,6*Nr],[o,12,12*Nr],[f,1,Xr],[f,2,2*Xr],[u,1,Yt],[t,1,Bo],[t,3,3*Bo],[r,1,Ju]];function c(h,m,x){let s=m<h;if(s)[h,m]=[m,h];let p=x&&typeof x.range==="function"?x:l(h,m,x),B=p?p.range(h,+m+1):[];return s?B.reverse():B}function l(h,m,x){let s=Math.abs(m-h)/x,p=Rr(([,,S])=>S).right(i,s);if(p===i.length)return r.every(tt(h/Ju,m/Ju,x));if(p===0)return et.every(Math.max(tt(h,m,x),1));let[B,I]=i[s/i[p-1][2]<i[p][2]/s?p-1:p];return B.every(I)}return[c,l]}var[sh,ph]=Si(Cr,$u,dr,Qu,Du,Pu),[Oo,No]=Si(sr,At,Qr,Dr,pt,st);function To(r){if(0<=r.y&&r.y<100){var t=new Date(-1,r.m,r.d,r.H,r.M,r.S,r.L);return t.setFullYear(r.y),t}return new Date(r.y,r.m,r.d,r.H,r.M,r.S,r.L)}function Vo(r){if(0<=r.y&&r.y<100){var t=new Date(Date.UTC(-1,r.m,r.d,r.H,r.M,r.S,r.L));return t.setUTCFullYear(r.y),t}return new Date(Date.UTC(r.y,r.m,r.d,r.H,r.M,r.S,r.L))}function zt(r,t,u){return{y:r,m:t,d:u,H:0,M:0,S:0,L:0}}function Jo(r){var{dateTime:t,date:u,time:f,periods:o,days:n,shortDays:i,months:c,shortMonths:l}=r,h=qt(o),m=Et(o),x=qt(n),s=Et(n),p=qt(i),B=Et(i),I=qt(c),S=Et(c),_=qt(l),O=Et(l),N={a:D,A:H,b:U,B:$,c:null,d:Ni,e:Ni,f:Zh,g:qh,G:gh,H:Hh,I:Lh,j:Uh,L:Di,m:Kh,M:ah,p:Y,q,Q:Ji,s:Pi,S:Xh,u:Wh,U:Gh,V:eh,w:Yh,W:Rh,x:null,X:null,y:zh,Y:Eh,Z:yh,"%":Vi},M={a:pr,A:y,b:ir,B:Ar,c:null,d:Ti,e:Ti,f:kh,g:hl,G:ml,H:jh,I:bh,j:vh,L:$i,m:dh,M:rl,p:cr,q:_r,Q:Ji,s:Pi,S:tl,u:ul,U:fl,V:ol,w:nl,W:il,x:null,X:null,y:cl,Y:ll,Z:sl,"%":Vi},T={a:Z,A:X,b:Q,B:e,c:A,d:Bi,e:Bi,f:Ph,g:Fi,G:Ci,H:Oi,I:Oi,j:Nh,L:Jh,m:Oh,M:Th,p:a,q:Bh,Q:Qh,s:$h,S:Vh,u:Ih,U:Sh,V:wh,w:_h,W:Ch,x:V,X:C,y:Fi,Y:Ci,Z:Fh,"%":Dh};N.x=w(u,N),N.X=w(f,N),N.c=w(t,N),M.x=w(u,M),M.X=w(f,M),M.c=w(t,M);function w(P,K){return function(W){var F=[],fr=-1,z=0,hr=P.length,lr,er,un;if(!(W instanceof Date))W=new Date(+W);while(++fr<hr)if(P.charCodeAt(fr)===37){if(F.push(P.slice(z,fr)),(er=wi[lr=P.charAt(++fr)])!=null)lr=P.charAt(++fr);else er=lr==="e"?" ":"0";if(un=K[lr])lr=un(W,er);F.push(lr),z=fr+1}return F.push(P.slice(z,fr)),F.join("")}}function J(P,K){return function(W){var F=zt(1900,void 0,1),fr=L(F,P,W+="",0),z,hr;if(fr!=W.length)return null;if("Q"in F)return new Date(F.Q);if("s"in F)return new Date(F.s*1000+("L"in F?F.L:0));if(K&&!("Z"in F))F.Z=0;if("p"in F)F.H=F.H%12+F.p*12;if(F.m===void 0)F.m="q"in F?F.q:0;if("V"in F){if(F.V<1||F.V>53)return null;if(!("w"in F))F.w=1;if("Z"in F)z=Vo(zt(F.y,0,1)),hr=z.getUTCDay(),z=hr>4||hr===0?Mt.ceil(z):Mt(z),z=Rt.offset(z,(F.V-1)*7),F.y=z.getUTCFullYear(),F.m=z.getUTCMonth(),F.d=z.getUTCDate()+(F.w+6)%7;else z=To(zt(F.y,0,1)),hr=z.getDay(),z=hr>4||hr===0?xt.ceil(z):xt(z),z=Dr.offset(z,(F.V-1)*7),F.y=z.getFullYear(),F.m=z.getMonth(),F.d=z.getDate()+(F.w+6)%7}else if("W"in F||"U"in F){if(!("w"in F))F.w="u"in F?F.u%7:("W"in F)?1:0;hr="Z"in F?Vo(zt(F.y,0,1)).getUTCDay():To(zt(F.y,0,1)).getDay(),F.m=0,F.d="W"in F?(F.w+6)%7+F.W*7-(hr+5)%7:F.w+F.U*7-(hr+6)%7}if("Z"in F)return F.H+=F.Z/100|0,F.M+=F.Z%100,Vo(F);return To(F)}}function L(P,K,W,F){var fr=0,z=K.length,hr=W.length,lr,er;while(fr<z){if(F>=hr)return-1;if(lr=K.charCodeAt(fr++),lr===37){if(lr=K.charAt(fr++),er=T[lr in wi?K.charAt(fr++):lr],!er||(F=er(P,W,F))<0)return-1}else if(lr!=W.charCodeAt(F++))return-1}return F}function a(P,K,W){var F=h.exec(K.slice(W));return F?(P.p=m.get(F[0].toLowerCase()),W+F[0].length):-1}function Z(P,K,W){var F=p.exec(K.slice(W));return F?(P.w=B.get(F[0].toLowerCase()),W+F[0].length):-1}function X(P,K,W){var F=x.exec(K.slice(W));return F?(P.w=s.get(F[0].toLowerCase()),W+F[0].length):-1}function Q(P,K,W){var F=_.exec(K.slice(W));return F?(P.m=O.get(F[0].toLowerCase()),W+F[0].length):-1}function e(P,K,W){var F=I.exec(K.slice(W));return F?(P.m=S.get(F[0].toLowerCase()),W+F[0].length):-1}function A(P,K,W){return L(P,t,K,W)}function V(P,K,W){return L(P,u,K,W)}function C(P,K,W){return L(P,f,K,W)}function D(P){return i[P.getDay()]}function H(P){return n[P.getDay()]}function U(P){return l[P.getMonth()]}function $(P){return c[P.getMonth()]}function Y(P){return o[+(P.getHours()>=12)]}function q(P){return 1+~~(P.getMonth()/3)}function pr(P){return i[P.getUTCDay()]}function y(P){return n[P.getUTCDay()]}function ir(P){return l[P.getUTCMonth()]}function Ar(P){return c[P.getUTCMonth()]}function cr(P){return o[+(P.getUTCHours()>=12)]}function _r(P){return 1+~~(P.getUTCMonth()/3)}return{format:function(P){var K=w(P+="",N);return K.toString=function(){return P},K},parse:function(P){var K=J(P+="",!1);return K.toString=function(){return P},K},utcFormat:function(P){var K=w(P+="",M);return K.toString=function(){return P},K},utcParse:function(P){var K=J(P+="",!0);return K.toString=function(){return P},K}}}var wi={"-":"",_:" ","0":"0"},k=/^\s*\d+/,xh=/^%/,Mh=/[\\^$*+?|[\]().{}]/g;function G(r,t,u){var f=r<0?"-":"",o=(f?-r:r)+"",n=o.length;return f+(n<u?Array(u-n+1).join(t)+o:o)}function Ah(r){return r.replace(Mh,"\\$&")}function qt(r){return new RegExp("^(?:"+r.map(Ah).join("|")+")","i")}function Et(r){return new Map(r.map((t,u)=>[t.toLowerCase(),u]))}function _h(r,t,u){var f=k.exec(t.slice(u,u+1));return f?(r.w=+f[0],u+f[0].length):-1}function Ih(r,t,u){var f=k.exec(t.slice(u,u+1));return f?(r.u=+f[0],u+f[0].length):-1}function Sh(r,t,u){var f=k.exec(t.slice(u,u+2));return f?(r.U=+f[0],u+f[0].length):-1}function wh(r,t,u){var f=k.exec(t.slice(u,u+2));return f?(r.V=+f[0],u+f[0].length):-1}function Ch(r,t,u){var f=k.exec(t.slice(u,u+2));return f?(r.W=+f[0],u+f[0].length):-1}function Ci(r,t,u){var f=k.exec(t.slice(u,u+4));return f?(r.y=+f[0],u+f[0].length):-1}function Fi(r,t,u){var f=k.exec(t.slice(u,u+2));return f?(r.y=+f[0]+(+f[0]>68?1900:2000),u+f[0].length):-1}function Fh(r,t,u){var f=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(u,u+6));return f?(r.Z=f[1]?0:-(f[2]+(f[3]||"00")),u+f[0].length):-1}function Bh(r,t,u){var f=k.exec(t.slice(u,u+1));return f?(r.q=f[0]*3-3,u+f[0].length):-1}function Oh(r,t,u){var f=k.exec(t.slice(u,u+2));return f?(r.m=f[0]-1,u+f[0].length):-1}function Bi(r,t,u){var f=k.exec(t.slice(u,u+2));return f?(r.d=+f[0],u+f[0].length):-1}function Nh(r,t,u){var f=k.exec(t.slice(u,u+3));return f?(r.m=0,r.d=+f[0],u+f[0].length):-1}function Oi(r,t,u){var f=k.exec(t.slice(u,u+2));return f?(r.H=+f[0],u+f[0].length):-1}function Th(r,t,u){var f=k.exec(t.slice(u,u+2));return f?(r.M=+f[0],u+f[0].length):-1}function Vh(r,t,u){var f=k.exec(t.slice(u,u+2));return f?(r.S=+f[0],u+f[0].length):-1}function Jh(r,t,u){var f=k.exec(t.slice(u,u+3));return f?(r.L=+f[0],u+f[0].length):-1}function Ph(r,t,u){var f=k.exec(t.slice(u,u+6));return f?(r.L=Math.floor(f[0]/1000),u+f[0].length):-1}function Dh(r,t,u){var f=xh.exec(t.slice(u,u+1));return f?u+f[0].length:-1}function Qh(r,t,u){var f=k.exec(t.slice(u));return f?(r.Q=+f[0],u+f[0].length):-1}function $h(r,t,u){var f=k.exec(t.slice(u));return f?(r.s=+f[0],u+f[0].length):-1}function Ni(r,t){return G(r.getDate(),t,2)}function Hh(r,t){return G(r.getHours(),t,2)}function Lh(r,t){return G(r.getHours()%12||12,t,2)}function Uh(r,t){return G(1+Dr.count(sr(r),r),t,3)}function Di(r,t){return G(r.getMilliseconds(),t,3)}function Zh(r,t){return Di(r,t)+"000"}function Kh(r,t){return G(r.getMonth()+1,t,2)}function ah(r,t){return G(r.getMinutes(),t,2)}function Xh(r,t){return G(r.getSeconds(),t,2)}function Wh(r){var t=r.getDay();return t===0?7:t}function Gh(r,t){return G(Qr.count(sr(r)-1,r),t,2)}function Qi(r){var t=r.getDay();return t>=4||t===0?Wr(r):Wr.ceil(r)}function eh(r,t){return r=Qi(r),G(Wr.count(sr(r),r)+(sr(r).getDay()===4),t,2)}function Yh(r){return r.getDay()}function Rh(r,t){return G(xt.count(sr(r)-1,r),t,2)}function zh(r,t){return G(r.getFullYear()%100,t,2)}function qh(r,t){return r=Qi(r),G(r.getFullYear()%100,t,2)}function Eh(r,t){return G(r.getFullYear()%1e4,t,4)}function gh(r,t){var u=r.getDay();return r=u>=4||u===0?Wr(r):Wr.ceil(r),G(r.getFullYear()%1e4,t,4)}function yh(r){var t=r.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+G(t/60|0,"0",2)+G(t%60,"0",2)}function Ti(r,t){return G(r.getUTCDate(),t,2)}function jh(r,t){return G(r.getUTCHours(),t,2)}function bh(r,t){return G(r.getUTCHours()%12||12,t,2)}function vh(r,t){return G(1+Rt.count(Cr(r),r),t,3)}function $i(r,t){return G(r.getUTCMilliseconds(),t,3)}function kh(r,t){return $i(r,t)+"000"}function dh(r,t){return G(r.getUTCMonth()+1,t,2)}function rl(r,t){return G(r.getUTCMinutes(),t,2)}function tl(r,t){return G(r.getUTCSeconds(),t,2)}function ul(r){var t=r.getUTCDay();return t===0?7:t}function fl(r,t){return G(dr.count(Cr(r)-1,r),t,2)}function Hi(r){var t=r.getUTCDay();return t>=4||t===0?Gr(r):Gr.ceil(r)}function ol(r,t){return r=Hi(r),G(Gr.count(Cr(r),r)+(Cr(r).getUTCDay()===4),t,2)}function nl(r){return r.getUTCDay()}function il(r,t){return G(Mt.count(Cr(r)-1,r),t,2)}function cl(r,t){return G(r.getUTCFullYear()%100,t,2)}function hl(r,t){return r=Hi(r),G(r.getUTCFullYear()%100,t,2)}function ll(r,t){return G(r.getUTCFullYear()%1e4,t,4)}function ml(r,t){var u=r.getUTCDay();return r=u>=4||u===0?Gr(r):Gr.ceil(r),G(r.getUTCFullYear()%1e4,t,4)}function sl(){return"+0000"}function Vi(){return"%"}function Ji(r){return+r}function Pi(r){return Math.floor(+r/1000)}var _t,Hu,Li,Ui,Zi;Po({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Po(r){return _t=Jo(r),Hu=_t.format,Li=_t.parse,Ui=_t.utcFormat,Zi=_t.utcParse,_t}function Do(r,t){r=r.slice();var u=0,f=r.length-1,o=r[u],n=r[f],i;if(n<o)i=u,u=f,f=i,i=o,o=n,n=i;return r[u]=t.floor(o),r[f]=t.ceil(n),r}function pl(r){return new Date(r)}function xl(r){return r instanceof Date?+r:+new Date(+r)}function Ki(r,t,u,f,o,n,i,c,l,h){var m=Wt(),x=m.invert,s=m.domain,p=h(".%L"),B=h(":%S"),I=h("%I:%M"),S=h("%I %p"),_=h("%a %d"),O=h("%b %d"),N=h("%B"),M=h("%Y");function T(w){return(l(w)<w?p:c(w)<w?B:i(w)<w?I:n(w)<w?S:f(w)<w?o(w)<w?_:O:u(w)<w?N:M)(w)}return m.invert=function(w){return new Date(x(w))},m.domain=function(w){return arguments.length?s(Array.from(w,xl)):s().map(pl)},m.ticks=function(w){var J=s();return r(J[0],J[J.length-1],w==null?10:w)},m.tickFormat=function(w,J){return J==null?T:h(J)},m.nice=function(w){var J=s();if(!w||typeof w.range!=="function")w=t(J[0],J[J.length-1],w==null?10:w);return w?s(Do(J,w)):m},m.copy=function(){return _u(m,Ki(r,t,u,f,o,n,i,c,l,h))},m}function ai(){return Iu.apply(Ki(Oo,No,sr,At,Qr,Dr,pt,st,Tr,Hu).domain([new Date(2000,0,1),new Date(2000,0,2)]),arguments)}var Ml=Jr("start","end","cancel","interrupt"),Al=[],Gi=0,Xi=1,Uu=2,Lu=3,Wi=4,Zu=5,gt=6;function $r(r,t,u,f,o,n){var i=r.__transition;if(!i)r.__transition={};else if(u in i)return;_l(r,u,{name:t,index:f,group:o,on:Ml,tween:Al,time:n.time,delay:n.delay,duration:n.duration,ease:n.ease,timer:null,state:Gi})}function yt(r,t){var u=b(r,t);if(u.state>Gi)throw Error("too late; already scheduled");return u}function d(r,t){var u=b(r,t);if(u.state>Lu)throw Error("too late; already running");return u}function b(r,t){var u=r.__transition;if(!u||!(u=u[t]))throw Error("transition not found");return u}function _l(r,t,u){var f=r.__transition,o;f[t]=u,u.timer=it(n,0,u.time);function n(h){if(u.state=Xi,u.timer.restart(i,u.delay,u.time),u.delay<=h)i(h-u.delay)}function i(h){var m,x,s,p;if(u.state!==Xi)return l();for(m in f){if(p=f[m],p.name!==u.name)continue;if(p.state===Lu)return Lt(i);if(p.state===Wi)p.state=gt,p.timer.stop(),p.on.call("interrupt",r,r.__data__,p.index,p.group),delete f[m];else if(+m<t)p.state=gt,p.timer.stop(),p.on.call("cancel",r,r.__data__,p.index,p.group),delete f[m]}if(Lt(function(){if(u.state===Lu)u.state=Wi,u.timer.restart(c,u.delay,u.time),c(h)}),u.state=Uu,u.on.call("start",r,r.__data__,u.index,u.group),u.state!==Uu)return;u.state=Lu,o=Array(s=u.tween.length);for(m=0,x=-1;m<s;++m)if(p=u.tween[m].value.call(r,r.__data__,u.index,u.group))o[++x]=p;o.length=x+1}function c(h){var m=h<u.duration?u.ease.call(null,h/u.duration):(u.timer.restart(l),u.state=Zu,1),x=-1,s=o.length;while(++x<s)o[x].call(r,m);if(u.state===Zu)u.on.call("end",r,r.__data__,u.index,u.group),l()}function l(){u.state=gt,u.timer.stop(),delete f[t];for(var h in f)return;delete r.__transition}}function Hr(r,t){var u=r.__transition,f,o,n=!0,i;if(!u)return;t=t==null?null:t+"";for(i in u){if((f=u[i]).name!==t){n=!1;continue}o=f.state>Uu&&f.state<Zu,f.state=gt,f.timer.stop(),f.on.call(o?"interrupt":"cancel",r,r.__data__,f.index,f.group),delete u[i]}if(n)delete r.__transition}function Qo(r){return this.each(function(){Hr(this,r)})}function Il(r,t){var u,f;return function(){var o=d(this,r),n=o.tween;if(n!==u){f=u=n;for(var i=0,c=f.length;i<c;++i)if(f[i].name===t){f=f.slice(),f.splice(i,1);break}}o.tween=f}}function Sl(r,t,u){var f,o;if(typeof u!=="function")throw Error();return function(){var n=d(this,r),i=n.tween;if(i!==f){o=(f=i).slice();for(var c={name:t,value:u},l=0,h=o.length;l<h;++l)if(o[l].name===t){o[l]=c;break}if(l===h)o.push(c)}n.tween=o}}function $o(r,t){var u=this._id;if(r+="",arguments.length<2){var f=b(this.node(),u).tween;for(var o=0,n=f.length,i;o<n;++o)if((i=f[o]).name===r)return i.value;return null}return this.each((t==null?Il:Sl)(u,r,t))}function It(r,t,u){var f=r._id;return r.each(function(){var o=d(this,f);(o.value||(o.value={}))[t]=u.apply(this,arguments)}),function(o){return b(o,f).value[t]}}function jt(r,t){var u;return(typeof t==="number"?v:t instanceof Sr?jr:(u=Sr(t))?(t=u,jr):lt)(r,t)}function wl(r){return function(){this.removeAttribute(r)}}function Cl(r){return function(){this.removeAttributeNS(r.space,r.local)}}function Fl(r,t,u){var f,o=u+"",n;return function(){var i=this.getAttribute(r);return i===o?null:i===f?n:n=t(f=i,u)}}function Bl(r,t,u){var f,o=u+"",n;return function(){var i=this.getAttributeNS(r.space,r.local);return i===o?null:i===f?n:n=t(f=i,u)}}function Ol(r,t,u){var f,o,n;return function(){var i,c=u(this),l;if(c==null)return void this.removeAttribute(r);return i=this.getAttribute(r),l=c+"",i===l?null:i===f&&l===o?n:(o=l,n=t(f=i,c))}}function Nl(r,t,u){var f,o,n;return function(){var i,c=u(this),l;if(c==null)return void this.removeAttributeNS(r.space,r.local);return i=this.getAttributeNS(r.space,r.local),l=c+"",i===l?null:i===f&&l===o?n:(o=l,n=t(f=i,c))}}function Ho(r,t){var u=Br(r),f=u==="transform"?no:jt;return this.attrTween(r,typeof t==="function"?(u.local?Nl:Ol)(u,f,It(this,"attr."+r,t)):t==null?(u.local?Cl:wl)(u):(u.local?Bl:Fl)(u,f,t))}function Tl(r,t){return function(u){this.setAttribute(r,t.call(this,u))}}function Vl(r,t){return function(u){this.setAttributeNS(r.space,r.local,t.call(this,u))}}function Jl(r,t){var u,f;function o(){var n=t.apply(this,arguments);if(n!==f)u=(f=n)&&Vl(r,n);return u}return o._value=t,o}function Pl(r,t){var u,f;function o(){var n=t.apply(this,arguments);if(n!==f)u=(f=n)&&Tl(r,n);return u}return o._value=t,o}function Lo(r,t){var u="attr."+r;if(arguments.length<2)return(u=this.tween(u))&&u._value;if(t==null)return this.tween(u,null);if(typeof t!=="function")throw Error();var f=Br(r);return this.tween(u,(f.local?Jl:Pl)(f,t))}function Dl(r,t){return function(){yt(this,r).delay=+t.apply(this,arguments)}}function Ql(r,t){return t=+t,function(){yt(this,r).delay=t}}function Uo(r){var t=this._id;return arguments.length?this.each((typeof r==="function"?Dl:Ql)(t,r)):b(this.node(),t).delay}function $l(r,t){return function(){d(this,r).duration=+t.apply(this,arguments)}}function Hl(r,t){return t=+t,function(){d(this,r).duration=t}}function Zo(r){var t=this._id;return arguments.length?this.each((typeof r==="function"?$l:Hl)(t,r)):b(this.node(),t).duration}function Ll(r,t){if(typeof t!=="function")throw Error();return function(){d(this,r).ease=t}}function Ko(r){var t=this._id;return arguments.length?this.each(Ll(t,r)):b(this.node(),t).ease}function Ul(r,t){return function(){var u=t.apply(this,arguments);if(typeof u!=="function")throw Error();d(this,r).ease=u}}function ao(r){if(typeof r!=="function")throw Error();return this.each(Ul(this._id,r))}function Xo(r){if(typeof r!=="function")r=ft(r);for(var t=this._groups,u=t.length,f=Array(u),o=0;o<u;++o)for(var n=t[o],i=n.length,c=f[o]=[],l,h=0;h<i;++h)if((l=n[h])&&r.call(l,l.__data__,h,n))c.push(l);return new ur(f,this._parents,this._name,this._id)}function Wo(r){if(r._id!==this._id)throw Error();for(var t=this._groups,u=r._groups,f=t.length,o=u.length,n=Math.min(f,o),i=Array(f),c=0;c<n;++c)for(var l=t[c],h=u[c],m=l.length,x=i[c]=Array(m),s,p=0;p<m;++p)if(s=l[p]||h[p])x[p]=s;for(;c<f;++c)i[c]=t[c];return new ur(i,this._parents,this._name,this._id)}function Zl(r){return(r+"").trim().split(/^|\s+/).every(function(t){var u=t.indexOf(".");if(u>=0)t=t.slice(0,u);return!t||t==="start"})}function Kl(r,t,u){var f,o,n=Zl(t)?yt:d;return function(){var i=n(this,r),c=i.on;if(c!==f)(o=(f=c).copy()).on(t,u);i.on=o}}function Go(r,t){var u=this._id;return arguments.length<2?b(this.node(),u).on.on(r):this.each(Kl(u,r,t))}function al(r){return function(){var t=this.parentNode;for(var u in this.__transition)if(+u!==r)return;if(t)t.removeChild(this)}}function eo(){return this.on("end.remove",al(this._id))}function Yo(r){var t=this._name,u=this._id;if(typeof r!=="function")r=Ur(r);for(var f=this._groups,o=f.length,n=Array(o),i=0;i<o;++i)for(var c=f[i],l=c.length,h=n[i]=Array(l),m,x,s=0;s<l;++s)if((m=c[s])&&(x=r.call(m,m.__data__,s,c))){if("__data__"in m)x.__data__=m.__data__;h[s]=x,$r(h[s],t,u,s,h,b(m,u))}return new ur(n,this._parents,t,u)}function Ro(r){var t=this._name,u=this._id;if(typeof r!=="function")r=ut(r);for(var f=this._groups,o=f.length,n=[],i=[],c=0;c<o;++c)for(var l=f[c],h=l.length,m,x=0;x<h;++x)if(m=l[x]){for(var s=r.call(m,m.__data__,x,l),p,B=b(m,u),I=0,S=s.length;I<S;++I)if(p=s[I])$r(p,t,u,I,s,B);n.push(s),i.push(m)}return new ur(n,i,t,u)}var Xl=Vr.prototype.constructor;function zo(){return new Xl(this._groups,this._parents)}function Wl(r,t){var u,f,o;return function(){var n=Zr(this,r),i=(this.style.removeProperty(r),Zr(this,r));return n===i?null:n===u&&i===f?o:o=t(u=n,f=i)}}function ei(r){return function(){this.style.removeProperty(r)}}function Gl(r,t,u){var f,o=u+"",n;return function(){var i=Zr(this,r);return i===o?null:i===f?n:n=t(f=i,u)}}function el(r,t,u){var f,o,n;return function(){var i=Zr(this,r),c=u(this),l=c+"";if(c==null)l=c=(this.style.removeProperty(r),Zr(this,r));return i===l?null:i===f&&l===o?n:(o=l,n=t(f=i,c))}}function Yl(r,t){var u,f,o,n="style."+t,i="end."+n,c;return function(){var l=d(this,r),h=l.on,m=l.value[n]==null?c||(c=ei(t)):void 0;if(h!==u||o!==m)(f=(u=h).copy()).on(i,o=m);l.on=f}}function qo(r,t,u){var f=(r+="")==="transform"?oo:jt;return t==null?this.styleTween(r,Wl(r,f)).on("end.style."+r,ei(r)):typeof t==="function"?this.styleTween(r,el(r,f,It(this,"style."+r,t))).each(Yl(this._id,r)):this.styleTween(r,Gl(r,f,t),u).on("end.style."+r,null)}function Rl(r,t,u){return function(f){this.style.setProperty(r,t.call(this,f),u)}}function zl(r,t,u){var f,o;function n(){var i=t.apply(this,arguments);if(i!==o)f=(o=i)&&Rl(r,i,u);return f}return n._value=t,n}function Eo(r,t,u){var f="style."+(r+="");if(arguments.length<2)return(f=this.tween(f))&&f._value;if(t==null)return this.tween(f,null);if(typeof t!=="function")throw Error();return this.tween(f,zl(r,t,u==null?"":u))}function ql(r){return function(){this.textContent=r}}function El(r){return function(){var t=r(this);this.textContent=t==null?"":t}}function go(r){return this.tween("text",typeof r==="function"?El(It(this,"text",r)):ql(r==null?"":r+""))}function gl(r){return function(t){this.textContent=r.call(this,t)}}function yl(r){var t,u;function f(){var o=r.apply(this,arguments);if(o!==u)t=(u=o)&&gl(o);return t}return f._value=r,f}function yo(r){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(r==null)return this.tween(t,null);if(typeof r!=="function")throw Error();return this.tween(t,yl(r))}function jo(){var r=this._name,t=this._id,u=Ku();for(var f=this._groups,o=f.length,n=0;n<o;++n)for(var i=f[n],c=i.length,l,h=0;h<c;++h)if(l=i[h]){var m=b(l,t);$r(l,r,u,h,i,{time:m.time+m.delay+m.duration,delay:0,duration:m.duration,ease:m.ease})}return new ur(f,this._parents,r,u)}function bo(){var r,t,u=this,f=u._id,o=u.size();return new Promise(function(n,i){var c={value:i},l={value:function(){if(--o===0)n()}};if(u.each(function(){var h=d(this,f),m=h.on;if(m!==r)t=(r=m).copy(),t._.cancel.push(c),t._.interrupt.push(c),t._.end.push(l);h.on=t}),o===0)n()})}var jl=0;function ur(r,t,u,f){this._groups=r,this._parents=t,this._name=u,this._id=f}function Yi(r){return Vr().transition(r)}function Ku(){return++jl}var Lr=Vr.prototype;ur.prototype=Yi.prototype={constructor:ur,select:Yo,selectAll:Ro,selectChild:Lr.selectChild,selectChildren:Lr.selectChildren,filter:Xo,merge:Wo,selection:zo,transition:jo,call:Lr.call,nodes:Lr.nodes,node:Lr.node,size:Lr.size,empty:Lr.empty,each:Lr.each,on:Go,attr:Ho,attrTween:Lo,style:qo,styleTween:Eo,text:go,textTween:yo,remove:eo,tween:$o,delay:Uo,duration:Zo,ease:Ko,easeVarying:ao,end:bo,[Symbol.iterator]:Lr[Symbol.iterator]};function au(r){return((r*=2)<=1?r*r*r:(r-=2)*r*r+2)/2}var bl={time:null,delay:0,duration:250,ease:au};function vl(r,t){var u;while(!(u=r.__transition)||!(u=u[t]))if(!(r=r.parentNode))throw Error(`transition ${t} not found`);return u}function vo(r){var t,u;if(r instanceof ur)t=r._id,r=r._name;else t=Ku(),(u=bl).time=Ht(),r=r==null?null:r+"";for(var f=this._groups,o=f.length,n=0;n<o;++n)for(var i=f[n],c=i.length,l,h=0;h<c;++h)if(l=i[h])$r(l,r,t,h,i,u||vl(l,t));return new ur(f,this._parents,r,t)}Vr.prototype.interrupt=Qo;Vr.prototype.transition=vo;var bt=(r)=>()=>r;function ko(r,{sourceEvent:t,target:u,transform:f,dispatch:o}){Object.defineProperties(this,{type:{value:r,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:u,enumerable:!0,configurable:!0},transform:{value:f,enumerable:!0,configurable:!0},_:{value:o}})}function Fr(r,t,u){this.k=r,this.x=t,this.y=u}Fr.prototype={constructor:Fr,scale:function(r){return r===1?this:new Fr(this.k*r,this.x,this.y)},translate:function(r,t){return r===0&t===0?this:new Fr(this.k,this.x+this.k*r,this.y+this.k*t)},apply:function(r){return[r[0]*this.k+this.x,r[1]*this.k+this.y]},applyX:function(r){return r*this.k+this.x},applyY:function(r){return r*this.k+this.y},invert:function(r){return[(r[0]-this.x)/this.k,(r[1]-this.y)/this.k]},invertX:function(r){return(r-this.x)/this.k},invertY:function(r){return(r-this.y)/this.k},rescaleX:function(r){return r.copy().domain(r.range().map(this.invertX,this).map(r.invert,r))},rescaleY:function(r){return r.copy().domain(r.range().map(this.invertY,this).map(r.invert,r))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var vt=new Fr(1,0,0);rn.prototype=Fr.prototype;function rn(r){while(!r.__zoom)if(!(r=r.parentNode))return vt;return r.__zoom}function Xu(r){r.stopImmediatePropagation()}function rt(r){r.preventDefault(),r.stopImmediatePropagation()}function kl(r){return(!r.ctrlKey||r.type==="wheel")&&!r.button}function dl(){var r=this;if(r instanceof SVGElement){if(r=r.ownerSVGElement||r,r.hasAttribute("viewBox"))return r=r.viewBox.baseVal,[[r.x,r.y],[r.x+r.width,r.y+r.height]];return[[0,0],[r.width.baseVal.value,r.height.baseVal.value]]}return[[0,0],[r.clientWidth,r.clientHeight]]}function Ri(){return this.__zoom||vt}function rm(r){return-r.deltaY*(r.deltaMode===1?0.05:r.deltaMode?1:0.002)*(r.ctrlKey?10:1)}function tm(){return navigator.maxTouchPoints||"ontouchstart"in this}function um(r,t,u){var f=r.invertX(t[0][0])-u[0][0],o=r.invertX(t[1][0])-u[1][0],n=r.invertY(t[0][1])-u[0][1],i=r.invertY(t[1][1])-u[1][1];return r.translate(o>f?(f+o)/2:Math.min(0,f)||Math.max(0,o),i>n?(n+i)/2:Math.min(0,n)||Math.max(0,i))}function zi(){var r=kl,t=dl,u=um,f=rm,o=tm,n=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],c=250,l=io,h=Jr("start","zoom","end"),m,x,s,p=500,B=150,I=0,S=10;function _(A){A.property("__zoom",Ri).on("wheel.zoom",L,{passive:!1}).on("mousedown.zoom",a).on("dblclick.zoom",Z).filter(o).on("touchstart.zoom",X).on("touchmove.zoom",Q).on("touchend.zoom touchcancel.zoom",e).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(A,V,C,D){var H=A.selection?A.selection():A;if(H.property("__zoom",Ri),A!==H)T(A,V,C,D);else H.interrupt().each(function(){w(this,arguments).event(D).start().zoom(null,typeof V==="function"?V.apply(this,arguments):V).end()})},_.scaleBy=function(A,V,C,D){_.scaleTo(A,function(){var H=this.__zoom.k,U=typeof V==="function"?V.apply(this,arguments):V;return H*U},C,D)},_.scaleTo=function(A,V,C,D){_.transform(A,function(){var H=t.apply(this,arguments),U=this.__zoom,$=C==null?M(H):typeof C==="function"?C.apply(this,arguments):C,Y=U.invert($),q=typeof V==="function"?V.apply(this,arguments):V;return u(N(O(U,q),$,Y),H,i)},C,D)},_.translateBy=function(A,V,C,D){_.transform(A,function(){return u(this.__zoom.translate(typeof V==="function"?V.apply(this,arguments):V,typeof C==="function"?C.apply(this,arguments):C),t.apply(this,arguments),i)},null,D)},_.translateTo=function(A,V,C,D,H){_.transform(A,function(){var U=t.apply(this,arguments),$=this.__zoom,Y=D==null?M(U):typeof D==="function"?D.apply(this,arguments):D;return u(vt.translate(Y[0],Y[1]).scale($.k).translate(typeof V==="function"?-V.apply(this,arguments):-V,typeof C==="function"?-C.apply(this,arguments):-C),U,i)},D,H)};function O(A,V){return V=Math.max(n[0],Math.min(n[1],V)),V===A.k?A:new Fr(V,A.x,A.y)}function N(A,V,C){var D=V[0]-C[0]*A.k,H=V[1]-C[1]*A.k;return D===A.x&&H===A.y?A:new Fr(A.k,D,H)}function M(A){return[(+A[0][0]+ +A[1][0])/2,(+A[0][1]+ +A[1][1])/2]}function T(A,V,C,D){A.on("start.zoom",function(){w(this,arguments).event(D).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(D).end()}).tween("zoom",function(){var H=this,U=arguments,$=w(H,U).event(D),Y=t.apply(H,U),q=C==null?M(Y):typeof C==="function"?C.apply(H,U):C,pr=Math.max(Y[1][0]-Y[0][0],Y[1][1]-Y[0][1]),y=H.__zoom,ir=typeof V==="function"?V.apply(H,U):V,Ar=l(y.invert(q).concat(pr/y.k),ir.invert(q).concat(pr/ir.k));return function(cr){if(cr===1)cr=ir;else{var _r=Ar(cr),P=pr/_r[2];cr=new Fr(P,q[0]-_r[0]*P,q[1]-_r[1]*P)}$.zoom(null,cr)}})}function w(A,V,C){return!C&&A.__zooming||new J(A,V)}function J(A,V){this.that=A,this.args=V,this.active=0,this.sourceEvent=null,this.extent=t.apply(A,V),this.taps=0}J.prototype={event:function(A){if(A)this.sourceEvent=A;return this},start:function(){if(++this.active===1)this.that.__zooming=this,this.emit("start");return this},zoom:function(A,V){if(this.mouse&&A!=="mouse")this.mouse[1]=V.invert(this.mouse[0]);if(this.touch0&&A!=="touch")this.touch0[1]=V.invert(this.touch0[0]);if(this.touch1&&A!=="touch")this.touch1[1]=V.invert(this.touch1[0]);return this.that.__zoom=V,this.emit("zoom"),this},end:function(){if(--this.active===0)delete this.that.__zooming,this.emit("end");return this},emit:function(A){var V=or(this.that).datum();h.call(A,this.that,new ko(A,{sourceEvent:this.sourceEvent,target:_,type:A,transform:this.that.__zoom,dispatch:h}),V)}};function L(A,...V){if(!r.apply(this,arguments))return;var C=w(this,V).event(A),D=this.__zoom,H=Math.max(n[0],Math.min(n[1],D.k*Math.pow(2,f.apply(this,arguments)))),U=mr(A);if(C.wheel){if(C.mouse[0][0]!==U[0]||C.mouse[0][1]!==U[1])C.mouse[1]=D.invert(C.mouse[0]=U);clearTimeout(C.wheel)}else if(D.k===H)return;else C.mouse=[U,D.invert(U)],Hr(this),C.start();rt(A),C.wheel=setTimeout($,B),C.zoom("mouse",u(N(O(D,H),C.mouse[0],C.mouse[1]),C.extent,i));function $(){C.wheel=null,C.end()}}function a(A,...V){if(s||!r.apply(this,arguments))return;var C=A.currentTarget,D=w(this,V,!0).event(A),H=or(A.view).on("mousemove.zoom",q,!0).on("mouseup.zoom",pr,!0),U=mr(A,C),$=A.clientX,Y=A.clientY;ot(A.view),Xu(A),D.mouse=[U,this.__zoom.invert(U)],Hr(this),D.start();function q(y){if(rt(y),!D.moved){var ir=y.clientX-$,Ar=y.clientY-Y;D.moved=ir*ir+Ar*Ar>I}D.event(y).zoom("mouse",u(N(D.that.__zoom,D.mouse[0]=mr(y,C),D.mouse[1]),D.extent,i))}function pr(y){H.on("mousemove.zoom mouseup.zoom",null),Nt(y.view,D.moved),rt(y),D.event(y).end()}}function Z(A,...V){if(!r.apply(this,arguments))return;var C=this.__zoom,D=mr(A.changedTouches?A.changedTouches[0]:A,this),H=C.invert(D),U=C.k*(A.shiftKey?0.5:2),$=u(N(O(C,U),D,H),t.apply(this,V),i);if(rt(A),c>0)or(this).transition().duration(c).call(T,$,D,A);else or(this).call(_.transform,$,D,A)}function X(A,...V){if(!r.apply(this,arguments))return;var C=A.touches,D=C.length,H=w(this,V,A.changedTouches.length===D).event(A),U,$,Y,q;Xu(A);for($=0;$<D;++$)if(Y=C[$],q=mr(Y,this),q=[q,this.__zoom.invert(q),Y.identifier],!H.touch0)H.touch0=q,U=!0,H.taps=1+!!m;else if(!H.touch1&&H.touch0[2]!==q[2])H.touch1=q,H.taps=0;if(m)m=clearTimeout(m);if(U){if(H.taps<2)x=q[0],m=setTimeout(function(){m=null},p);Hr(this),H.start()}}function Q(A,...V){if(!this.__zooming)return;var C=w(this,V).event(A),D=A.changedTouches,H=D.length,U,$,Y,q;rt(A);for(U=0;U<H;++U)if($=D[U],Y=mr($,this),C.touch0&&C.touch0[2]===$.identifier)C.touch0[0]=Y;else if(C.touch1&&C.touch1[2]===$.identifier)C.touch1[0]=Y;if($=C.that.__zoom,C.touch1){var pr=C.touch0[0],y=C.touch0[1],ir=C.touch1[0],Ar=C.touch1[1],cr=(cr=ir[0]-pr[0])*cr+(cr=ir[1]-pr[1])*cr,_r=(_r=Ar[0]-y[0])*_r+(_r=Ar[1]-y[1])*_r;$=O($,Math.sqrt(cr/_r)),Y=[(pr[0]+ir[0])/2,(pr[1]+ir[1])/2],q=[(y[0]+Ar[0])/2,(y[1]+Ar[1])/2]}else if(C.touch0)Y=C.touch0[0],q=C.touch0[1];else return;C.zoom("touch",u(N($,Y,q),C.extent,i))}function e(A,...V){if(!this.__zooming)return;var C=w(this,V).event(A),D=A.changedTouches,H=D.length,U,$;if(Xu(A),s)clearTimeout(s);s=setTimeout(function(){s=null},p);for(U=0;U<H;++U)if($=D[U],C.touch0&&C.touch0[2]===$.identifier)delete C.touch0;else if(C.touch1&&C.touch1[2]===$.identifier)delete C.touch1;if(C.touch1&&!C.touch0)C.touch0=C.touch1,delete C.touch1;if(C.touch0)C.touch0[1]=this.__zoom.invert(C.touch0[0]);else if(C.end(),C.taps===2){if($=mr($,this),Math.hypot(x[0]-$[0],x[1]-$[1])<S){var Y=or(this).on("dblclick.zoom");if(Y)Y.apply(this,arguments)}}}return _.wheelDelta=function(A){return arguments.length?(f=typeof A==="function"?A:bt(+A),_):f},_.filter=function(A){return arguments.length?(r=typeof A==="function"?A:bt(!!A),_):r},_.touchable=function(A){return arguments.length?(o=typeof A==="function"?A:bt(!!A),_):o},_.extent=function(A){return arguments.length?(t=typeof A==="function"?A:bt([[+A[0][0],+A[0][1]],[+A[1][0],+A[1][1]]]),_):t},_.scaleExtent=function(A){return arguments.length?(n[0]=+A[0],n[1]=+A[1],_):[n[0],n[1]]},_.translateExtent=function(A){return arguments.length?(i[0][0]=+A[0][0],i[1][0]=+A[1][0],i[0][1]=+A[0][1],i[1][1]=+A[1][1],_):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},_.constrain=function(A){return arguments.length?(u=A,_):u},_.duration=function(A){return arguments.length?(c=+A,_):c},_.interpolate=function(A){return arguments.length?(l=A,_):l},_.on=function(){var A=h.on.apply(h,arguments);return A===h?_:A},_.clickDistance=function(A){return arguments.length?(I=(A=+A)*A,_):Math.sqrt(I)},_.tapDistance=function(A){return arguments.length?(S=+A,_):S},_}function qi(r){return[+r[0],+r[1]]}function fm(r){return[qi(r[0]),qi(r[1])]}var Yw={name:"x",handles:["w","e"].map(tn),input:function(r,t){return r==null?null:[[+r[0],t[0][1]],[+r[1],t[1][1]]]},output:function(r){return r&&[r[0][0],r[1][0]]}},Rw={name:"y",handles:["n","s"].map(tn),input:function(r,t){return r==null?null:[[t[0][0],+r[0]],[t[1][0],+r[1]]]},output:function(r){return r&&[r[0][1],r[1][1]]}},zw={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(tn),input:function(r){return r==null?null:fm(r)},output:function(r){return r}};function tn(r){return{type:r}}export{fn as d,on as e,f0 as f,o0 as g,or as h,wn as i,Vn as j,Pn as k,Zn as l,Kn as m,an as n,Xn as o,wo as p,Hu as q,ai as r,zi as s};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{a as D,b as E}from"./index-pbd5t4dj.js";import{d as p,e as m,f as h,g as s,h as _,p as d,q as r,r as c}from"./index-epqg22cp.js";import{t as o,u as y}from"./index-gbfwa9vq.js";import{D as L}from"./index-5kwkpwkp.js";var H=86400000,M=90*H;function kq(n={}){return async function(C){C.innerHTML="";let{memories:l}=await L.listMemories({limit:500}),x=l.map((q)=>({...q,createdAt:new Date(q.createdAt)})),O=C.clientWidth||1200,S=600,X={top:40,right:40,bottom:60,left:120},u=O-X.left-X.right,V=S-X.top-X.bottom,Y=V/5,G=_(C).append("svg").attr("width",O).attr("height",S).append("g").attr("transform",`translate(${X.left},${X.top})`),g=x.map((q)=>new Date(q.createdAt)),i=m(g)??new Date,a=p(g)??new Date,Z=c().domain([i,new Date(a.getTime()+M)]).range([0,u]);G.append("g").attr("transform",`translate(0,${V})`).call(h(Z).ticks(10).tickFormat(r("%d %b"))).selectAll("text").style("fill","#a1a1aa").style("font-size","11px"),G.append("g").call(s(d().domain([0,5]).range([0,V])).ticks(5).tickFormat((q)=>y[Number(q)]??"")).selectAll("text").style("fill","#a1a1aa").style("font-size","11px");for(let q=0;q<=5;q++)G.append("line").attr("class","river-lane").attr("stroke","#262b38").attr("x1",0).attr("x2",u).attr("y1",q*Y).attr("y2",q*Y);let t=G.append("line").attr("stroke","#8b5cf6").attr("stroke-width",2).attr("stroke-dasharray","6 4").attr("y1",0).attr("y2",V),e=G.append("g"),K=document.createElement("div");K.className="river-tooltip",K.style.display="none",document.body.appendChild(K);let R=0;function qq(q,F){let $=new Date(Date.now()+R),T=D(F,$),z=E(F,$);K.replaceChildren();let J=document.createElement("div");J.style.marginBottom=".5rem",J.style.fontWeight="600",J.textContent=y[T];let k=document.createElement("div");k.style.marginBottom=".5rem",k.textContent=F.content.slice(0,100)+(F.content.length>100?"…":"");let U=document.createElement("div");U.style.color="var(--muted)",U.style.fontSize=".8rem";let b=document.createElement("div");b.textContent=`Strength: ${z}/100`;let j=document.createElement("div");j.textContent=`Recalls: ${F.recallCount}`;let I=document.createElement("div");if(I.textContent=`Encoded: ${new Date(F.createdAt).toLocaleDateString()}`,U.append(b,j,I),F.photographic){let W=document.createElement("div");W.style.color="#8b5cf6",W.textContent="\uD83D\uDD12 Photographic",U.append(W)}K.append(J,k,U),K.style.display="block",K.style.left=`${q.pageX+10}px`,K.style.top=`${q.pageY-10}px`}function v(q=0){let F=new Date(Date.now()+q);t.attr("x1",Z(F)).attr("x2",Z(F));let $=e.selectAll(".river-memory").data(x,(z)=>z.id);$.exit().remove();let T=$.enter().append("g").attr("class","river-memory").style("cursor","pointer").on("click",(z,J)=>n.onSelectMemory?.(J.id)).on("mouseover",(z,J)=>qq(z,J)).on("mouseout",()=>{K.style.display="none"});T.append("rect").attr("rx",6).attr("ry",6),T.append("text").attr("font-size","9px").attr("fill","#e4e4e7").attr("text-anchor","middle").attr("dy","0.35em"),T.merge($).each(function(z){let J=new Date(new Date(z.createdAt).getTime()+q),k=D(z,J),U=E(z,J),b=Z(new Date(z.createdAt)),j=k*Y+Y/2,I=Math.max(30,Math.min(80,z.content.length/3)),W=20,f=_(this);f.select("rect").attr("x",b-I/2).attr("y",j-10).attr("width",I).attr("height",20).attr("fill",o[k]).attr("opacity",Math.max(0.3,U/100)).attr("stroke",z.photographic?"#8b5cf6":"none").attr("stroke-width",z.photographic?2:0),f.select("text").attr("x",b).attr("y",j).text(z.content.slice(0,12))})}v(0);let Q=document.createElement("div");Q.className="river-controls",Q.innerHTML=`
|
|
2
|
-
<button type="button" data-role="play">▶ Play</button>
|
|
3
|
-
<input type="range" data-role="slider" min="0" max="${M}" value="0" step="${3600000}">
|
|
4
|
-
<span data-role="label">Today</span>
|
|
5
|
-
<button type="button" data-role="reset">↺ Reset</button>`,C.appendChild(Q);let A=Q.querySelector('[data-role="slider"]'),zq=Q.querySelector('[data-role="label"]'),N=Q.querySelector('[data-role="play"]'),Fq=Q.querySelector('[data-role="reset"]'),P=null,w=(q)=>{R=q,A.value=String(q);let F=Math.floor(q/H);zq.textContent=F===0?"Today":`D+${F} days`,v(q)},B=()=>{if(P)clearInterval(P);P=null,N.textContent="▶ Play"};return A.addEventListener("input",()=>w(Number(A.value))),N.addEventListener("click",()=>{if(P){B();return}N.textContent="⏸ Pause",P=setInterval(()=>w(R>=M?0:R+H),200)}),Fq.addEventListener("click",()=>{B(),w(0)}),()=>{B(),K.remove(),C.innerHTML=""}}}export{kq as createMount};
|