import{array as Mt,error as x,hasOwnProperty as Tt,extend as Ut,span as yt,peek as ht,toSet as Yt,constant as Ct,zero as S,one as St}from"/-/vega-util@v1.17.2-LUfkDhormMyfWqy3Ts6U/dist=es2020,mode=imports,min/optimized/vega-util.js";import{timeDay as N,timeWeek as _,utcDay as W,utcWeek as B,timeYear as pt,timeMonth as K,timeHour as wt,timeMinute as Ft,timeSecond as It,timeMillisecond as kt,utcYear as vt,utcMonth as X,utcHour as Et,utcMinute as Ht,utcSecond as Ot,utcMillisecond as bt}from"/-/d3-time@v3.1.0-hkusO1LcNQpH1ccXwop7/dist=es2020,mode=imports,min/optimized/d3-time.js";import{bisector as Nt,tickStep as J}from"/-/d3-array@v3.2.4-G4hy00bPnjF6FrSYpT32/dist=es2020,mode=imports,min/optimized/d3-array.js";const a="year",D="quarter",f="month",s="week",g="date",l="day",U="dayofyear",M="hours",T="minutes",y="seconds",h="milliseconds",V=[a,D,f,s,g,l,U,M,T,y,h],j=V.reduce((t,e,n)=>(t[e]=1+n,t),{});function Z(t){const e=Mt(t).slice(),n={};e.length||x("Missing time unit."),e.forEach(o=>{Tt(j,o)?n[o]=1:x(`Invalid time unit: ${o}.`)});const r=(n[s]||n[l]?1:0)+(n[D]||n[f]||n[g]?1:0)+(n[U]?1:0);return r>1&&x(`Incompatible time units: ${t}`),e.sort((o,c)=>j[o]-j[c]),e}const Wt={[a]:"%Y ",[D]:"Q%q ",[f]:"%b ",[g]:"%d ",[s]:"W%U ",[l]:"%a ",[U]:"%j ",[M]:"%H:00",[T]:"00:%M",[y]:":%S",[h]:".%L",[`${a}-${f}`]:"%Y-%m ",[`${a}-${f}-${g}`]:"%Y-%m-%d ",[`${M}-${T}`]:"%H:%M"};function $t(t,e){const n=Ut({},Wt,e),r=Z(t),o=r.length;let c="",i=0,u,d;for(i=0;ii;--u)if(d=r.slice(i,u).join("-"),n[d]!=null){c+=n[d],i=u;break}return c.trim()}const Y=new Date;function q(t){return Y.setFullYear(t),Y.setMonth(0),Y.setDate(1),Y.setHours(0,0,0,0),Y}function xt(t){return tt(new Date(t))}function jt(t){return A(new Date(t))}function tt(t){return N.count(q(t.getFullYear())-1,t)}function A(t){return _.count(q(t.getFullYear())-1,t)}function R(t){return q(t).getDay()}function qt(t,e,n,r,o,c,i){if(0<=t&&t<100){const u=new Date(-1,e,n,r,o,c,i);return u.setFullYear(t),u}return new Date(t,e,n,r,o,c,i)}function At(t){return et(new Date(t))}function Rt(t){return z(new Date(t))}function et(t){const e=Date.UTC(t.getUTCFullYear(),0,1);return W.count(e-1,t)}function z(t){const e=Date.UTC(t.getUTCFullYear(),0,1);return B.count(e-1,t)}function L(t){return Y.setTime(Date.UTC(t,0,1)),Y.getUTCDay()}function zt(t,e,n,r,o,c,i){if(0<=t&&t<100){const u=new Date(Date.UTC(-1,e,n,r,o,c,i));return u.setUTCFullYear(n.y),u}return new Date(Date.UTC(t,e,n,r,o,c,i))}function nt(t,e,n,r,o){const c=e||1,i=ht(t),u=(H,O,b)=>(b=b||H,Lt(n[b],r[b],H===i&&c,O)),d=new Date,m=Yt(t),at=m[a]?u(a):Ct(2012),lt=m[f]?u(f):m[D]?u(D):S,ft=m[s]&&m[l]?u(l,1,s+l):m[s]?u(s,1):m[l]?u(l,1):m[g]?u(g,1):m[U]?u(U,1):St,mt=m[M]?u(M):S,dt=m[T]?u(T):S,Dt=m[y]?u(y):S,gt=m[h]?u(h):S;return function(H){d.setTime(+H);const O=at(d);return o(O,lt(d),ft(d,O),mt(d),dt(d),Dt(d),gt(d))}}function Lt(t,e,n,r){const o=n<=1?t:r?(c,i)=>r+n*Math.floor((t(c,i)-r)/n):(c,i)=>n*Math.floor(t(c,i)/n);return e?(c,i)=>e(o(c,i),i):o}function C(t,e,n){return e+t*7-(n+6)%7}const Gt={[a]:t=>t.getFullYear(),[D]:t=>Math.floor(t.getMonth()/3),[f]:t=>t.getMonth(),[g]:t=>t.getDate(),[M]:t=>t.getHours(),[T]:t=>t.getMinutes(),[y]:t=>t.getSeconds(),[h]:t=>t.getMilliseconds(),[U]:t=>tt(t),[s]:t=>A(t),[s+l]:(t,e)=>C(A(t),t.getDay(),R(e)),[l]:(t,e)=>C(1,t.getDay(),R(e))},Qt={[D]:t=>3*t,[s]:(t,e)=>C(t,0,R(e))};function Pt(t,e){return nt(t,e||1,Gt,Qt,qt)}const _t={[a]:t=>t.getUTCFullYear(),[D]:t=>Math.floor(t.getUTCMonth()/3),[f]:t=>t.getUTCMonth(),[g]:t=>t.getUTCDate(),[M]:t=>t.getUTCHours(),[T]:t=>t.getUTCMinutes(),[y]:t=>t.getUTCSeconds(),[h]:t=>t.getUTCMilliseconds(),[U]:t=>et(t),[s]:t=>z(t),[l]:(t,e)=>C(1,t.getUTCDay(),L(e)),[s+l]:(t,e)=>C(z(t),t.getUTCDay(),L(e))},Bt={[D]:t=>3*t,[s]:(t,e)=>C(t,0,L(e))};function Kt(t,e){return nt(t,e||1,_t,Bt,zt)}const Xt={[a]:pt,[D]:K.every(3),[f]:K,[s]:_,[g]:N,[l]:N,[U]:N,[M]:wt,[T]:Ft,[y]:It,[h]:kt},Jt={[a]:vt,[D]:X.every(3),[f]:X,[s]:B,[g]:W,[l]:W,[U]:W,[M]:Et,[T]:Ht,[y]:Ot,[h]:bt};function G(t){return Xt[t]}function Q(t){return Jt[t]}function ot(t,e,n){return t?t.offset(e,n):void 0}function Vt(t,e,n){return ot(G(t),e,n)}function Zt(t,e,n){return ot(Q(t),e,n)}function rt(t,e,n,r){return t?t.range(e,n,r):void 0}function te(t,e,n,r){return rt(G(t),e,n,r)}function ee(t,e,n,r){return rt(Q(t),e,n,r)}const p=1e3,w=p*60,F=w*60,$=F*24,ne=$*7,ut=$*30,P=$*365,it=[a,f,g,M,T,y,h],I=it.slice(0,-1),k=I.slice(0,-1),v=k.slice(0,-1),oe=v.slice(0,-1),re=[a,s],ct=[a,f],st=[a],E=[[I,1,p],[I,5,5*p],[I,15,15*p],[I,30,30*p],[k,1,w],[k,5,5*w],[k,15,15*w],[k,30,30*w],[v,1,F],[v,3,3*F],[v,6,6*F],[v,12,12*F],[oe,1,$],[re,1,ne],[ct,1,ut],[ct,3,3*ut],[st,1,P]];function ue(t){const e=t.extent,n=t.maxbins||40,r=Math.abs(yt(e))/n;let o=Nt(u=>u[2]).right(E,r),c,i;return o===E.length?(c=st,i=J(e[0]/P,e[1]/P,n)):o?(o=E[r/E[o-1][2]