@aiquants/period-slider 0.7.0 → 0.9.0
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/README.md +137 -25
- package/dist/MonthSelector.d.ts.map +1 -1
- package/dist/PeriodSlider.d.ts +144 -16
- package/dist/PeriodSlider.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1743 -1431
- package/dist/styles/period-slider.css +1 -1
- package/dist/styles/period-slider.standalone.css +1 -1
- package/dist/usePeriodSlider.d.ts +96 -10
- package/dist/usePeriodSlider.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/DateSelector.tsx +1 -1
- package/src/MonthSelector.tsx +4 -1
- package/src/PeriodSlider.tsx +751 -218
- package/src/index.ts +14 -3
- package/src/styles/period-slider.css +25 -0
- package/src/usePeriodSlider.ts +510 -45
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PeriodSlider.d.ts","sourceRoot":"","sources":["../src/PeriodSlider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PeriodSlider.d.ts","sourceRoot":"","sources":["../src/PeriodSlider.tsx"],"names":[],"mappings":"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"}
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react/jsx-runtime"),Re=require("date-fns"),o=require("react"),Fn={"blue-rose":{macro:"#0284c7",macroLight:"#38bdf8",micro:"#e11d48",microLight:"#fb7185",accent:"#0284c7"},"indigo-amber":{macro:"#4f46e5",macroLight:"#818cf8",micro:"#d97706",microLight:"#fbbf24",accent:"#4f46e5"},"teal-emerald":{macro:"#0d9488",macroLight:"#2dd4bf",micro:"#059669",microLight:"#34d399",accent:"#0d9488"},"violet-fuchsia":{macro:"#7c3aed",macroLight:"#a78bfa",micro:"#c026d3",microLight:"#e879f9",accent:"#7c3aed"},"slate-sky":{macro:"#475569",macroLight:"#94a3b8",micro:"#0284c7",microLight:"#38bdf8",accent:"#475569"},monochrome:{macro:"#52525b",macroLight:"#a1a1aa",micro:"#18181b",microLight:"#71717a",accent:"#27272a"}},st=e=>e instanceof Date&&!Number.isNaN(e.getTime()),we=e=>e instanceof Date?Number.isNaN(e.getTime())?"Invalid Date":e.toISOString():String(e),Ke=(e,t)=>{if(!st(t))throw new RangeError(`normalizeDateByUnit: d must be a valid Date (received: ${we(t)})`);const r=new Date(t.getTime());return e==="year"?(r.setMonth(0,1),r.setHours(0,0,0,0)):(e==="month"&&r.setDate(1),r.setHours(0,0,0,0)),r},G=(e,t)=>{const r=Ke(e,t),n=r.getFullYear(),a=r.getMonth()+1,s=r.getDate();if(e==="year")return n;if(e==="month")return n*12+(a-1);const l=new Date(0);return l.setUTCFullYear(n,a-1,s),l.setUTCHours(0,0,0,0),Math.floor(l.getTime()/(1440*60*1e3))},se=(e,t)=>{const r=new Date(0);if(r.setHours(0,0,0,0),e==="year")return r.setFullYear(t,0,1),r;if(e==="month"){const a=Math.floor(t/12),s=t-a*12;return r.setFullYear(a,s,1),r}const n=new Date(t*24*60*60*1e3);return r.setFullYear(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()),r},He=(e,t,r)=>{if(!st(t))throw new RangeError(`addUnit: d must be a valid Date (received: ${we(t)})`);return e==="year"?Re.addYears(t,r):e==="month"?Re.addMonths(t,r):Re.addDays(t,r)},lt=(e,t,r)=>{if(!st(r))throw new RangeError(`getMacroWindowEndDate: d must be a valid Date (received: ${we(r)})`);if(e===t)return Ke(t,r);const n=r.getFullYear(),a=r.getMonth();if(e==="year"){if(t==="month")return new Date(n,11,1);if(t==="day")return new Date(n,11,31)}return e==="month"&&t==="day"?new Date(n,a+1,0):Ke(t,r)},ka={year:{year:"numeric"},month:{year:"numeric",month:"2-digit"},day:{year:"numeric",month:"2-digit",day:"2-digit"}},kn=new Map,Pa=(e,t)=>{const r=`${e}\0${t}`,n=kn.get(r);if(n!==void 0)return n;const a=new Intl.DateTimeFormat(t,ka[e]);return kn.set(r,a),a},Ca=(e,t)=>{const r=String(t.getFullYear()).padStart(4,"0");if(e==="year")return r;const n=String(t.getMonth()+1).padStart(2,"0");if(e==="month")return`${r}-${n}`;const a=String(t.getDate()).padStart(2,"0");return`${r}-${n}-${a}`},Ie=(e,t,r,n)=>st(t)?r?r(t):n===void 0?Ca(e,t):Pa(e,n).format(t):"",Dt=(e,t,r,n)=>Ie(e,t,r,n),ye=(e,t,r)=>{if(!e||e.length===0||e.length===1)return 0;const n=G(r,t);let a=0,s=e.length-1;if(n<=G(r,e[a]))return 0;if(n>=G(r,e[s]))return s;for(;a<=s;){const b=a+s>>1,f=G(r,e[b]);if(f===n)return b;f<n?a=b+1:s=b-1}const l=Math.abs(G(r,e[a])-n),u=Math.abs(G(r,e[s])-n);return l<u?a:s},Bt=(e,t,r,n)=>{if(!Array.isArray(e)||e.length===0)return[];const a=G(t,r),s=G(t,n),l=new Map;for(const u of e){const b=Ke(t,u),f=G(t,b);f<a||f>s||l.has(f)||l.set(f,b)}if(l.size===0)throw new RangeError(`getSortedAllowedDates: every allowedDates entry falls outside [minDate, maxDate] (minDate: ${we(r)}, maxDate: ${we(n)}, entries: ${e.length})`);return Array.from(l.keys()).sort((u,b)=>u-b).map(u=>l.get(u))},Tr=(e,t,r,n)=>{const a=e.length-1;if(a<=0)return 0;const s=ye(e,n,t);if(r==="time"){const l=e[0].getTime(),u=e[a].getTime()-l;return u<=0?0:Math.max(0,Math.min(1,(e[s].getTime()-l)/u))}return s/a},Sr=(e,t,r,n)=>{const a=e.length-1;if(a<=0)return 0;const s=Math.max(0,Math.min(1,n));if(r==="time"){const l=e[0].getTime(),u=e[a].getTime()-l;return u<=0?0:ye(e,new Date(l+s*u),t)}return Math.max(0,Math.min(a,Math.round(s*a)))},qr=(e,t,r,n,a,s,l)=>{let u=r,b=n;return l?(u=t,b=t):e==="low"?t>n?(u=n,b=t):u=t:t<r?(b=r,u=t):b=t,[Math.max(a,Math.min(s,u)),Math.max(a,Math.min(s,b))]},Vn=(e,t,r,n,a)=>a?"low":e==="low"?t>n?"high":"low":t<r?"low":"high",Un=({posDiffPct:e,startLowVal:t,startHighVal:r,rangeMin:n,rangeMax:a,isDiscrete:s,sortedAllowedDates:l,snapMode:u,unit:b})=>{if(s){const H=l.length-1;if(H<=0)return[0,0];const te=Math.max(0,Math.min(H,Math.round(t))),T=Math.max(te,Math.min(H,Math.round(r)));if(u==="time"){const Y=l[0].getTime(),B=l[H].getTime(),C=l[te].getTime(),F=l[T].getTime()-C;let O=C+e*(B-Y),x=O+F;O<Y&&(O=Y,x=Y+F),x>B&&(x=B,O=B-F);const P=ye(l,new Date(O),b),v=ye(l,new Date(x),b);return[P,Math.max(P,v)]}const re=Math.round(e*H);let j=te+re,J=T+re;return j<0&&(J+=-j,j=0),J>H&&(j-=J-H,J=H),[Math.max(0,Math.min(H,j)),Math.max(0,Math.min(H,J))]}const f=H=>Math.max(n,Math.min(a,H)),D=a-n;if(D<=0)return[f(t),f(r)];const y=Math.round(e*D);let d=t+y,L=r+y;return d<n&&(L+=n-d,d=n),L>a&&(d-=L-a,L=a),[f(d),f(L)]},Bn=(e,t,r,n,a,s,l,u)=>{let b=0,f=!1,D=!1;switch(e){case"ArrowRight":case"ArrowUp":b=u;break;case"ArrowLeft":case"ArrowDown":b=-u;break;case"PageUp":b=u*5;break;case"PageDown":b=-u*5;break;case"Home":f=!0;break;case"End":D=!0;break;default:return null}if(l){let L=r;return f?L=a:D?L=s:L=Math.max(a,Math.min(s,r+b)),[L,L]}let y=r,d=n;return t==="low"?f?y=a:D?y=n:y=Math.max(a,Math.min(n,r+b)):f?d=r:D?d=s:d=Math.max(r,Math.min(s,n+b)),[y,d]},zn=8,_n=2,Xn=16,Na=12,Ya=90,Zr=(e,t)=>{const r=t?.estimatedHeightPx??Xn,a=zn+(t?.anchorGapY??_n)+r/2,s=e==="top"?-a:a;return{lowAngleDeg:0,highAngleDeg:0,lowOffsetX:0,highOffsetX:0,lowOffsetY:s,highOffsetY:s,isSlanted:!1,proximity:0}},Qr=(e,t,r,n="top",a)=>{const s=a?.estimatedWidthPx,l=a?.estimatedHeightPx??Xn,u=a?.paddingPx??Na,b=a?.maxAngleDeg??Ya,f=zn+(a?.anchorGapY??_n),D=Zr(n,a);if(!(Number.isFinite(r)&&r>0)||s===void 0||!Number.isFinite(s)||s<=0)return D;const y=Math.max(0,t-e)/100*r,d=s+u;if(y>=d)return D;const L=Math.max(0,Math.min(1,(d-y)/d)),te=L*L*L*(L*(L*6-15)+10)*b,T=n==="top"?-te:te,re=te*Math.PI/180,j=s/2*Math.abs(Math.sin(re))+l/2*Math.abs(Math.cos(re)),J=f+j,Y=n==="top"?-J:+J,B=s*Math.abs(Math.cos(re))+l*Math.abs(Math.sin(re)),C=Math.max(0,(B+u-y)/2);return{lowAngleDeg:T,highAngleDeg:T,lowOffsetX:-C,highOffsetX:C,lowOffsetY:Y,highOffsetY:Y,isSlanted:L>.001,proximity:L}},qn=e=>({...e,lowOffsetX:0,highOffsetX:0});function Kn(e,t,r,n,a,s,l="macro-top",u=.05,b=!0){const f=l==="macro-top"||l==="macro-left",D=t<=0;if(f&&D||!(f||D)){const L=Math.abs(e-r),H=Math.abs(e-n);return L<=u&&L<=H?"macro-low":H<=u&&H<L?"macro-high":b&&e>=r&&e<=n?"macro-connect":L<H?"macro-low":"macro-high"}const y=Math.abs(e-a),d=Math.abs(e-s);return y<=u&&y<=d?"micro-low":d<=u&&d<y?"micro-high":b&&e>=a&&e<=s?"micro-connect":y<d?"micro-low":"micro-high"}function Wn(e,t,r,n,a){if(e==="macro-connect"){const l=t-r,u=a-n,b=Math.max(0,Math.min(1-u,n+l)),f=b+u;return[b,f,"macro-connect"]}if(e==="macro-low"){const l=Math.max(0,Math.min(1,t));return l>a?[a,l,"macro-high"]:[l,a,"macro-low"]}const s=Math.max(0,Math.min(1,t));return s<n?[s,n,"macro-low"]:[n,s,"macro-high"]}function Gn(e,t,r,n,a){if(e==="micro-connect"){const l=t-r,u=a-n,b=Math.max(0,Math.min(1-u,n+l)),f=b+u;return[b,f,"micro-connect"]}if(e==="micro-low"){const l=Math.max(0,Math.min(1,t));return l>a?[a,l,"micro-high"]:[l,a,"micro-low"]}const s=Math.max(0,Math.min(1,t));return s<n?[s,n,"micro-low"]:[n,s,"micro-high"]}const rr=o.memo(({type:e,isTop:t=!0,isVertical:r=!1,isLeft:n=!0})=>{let a,s;r?(a=n?"M 7.375 0.625 A 7.375 7.375 0 0 0 7.375 15.375 Z":"M 0.625 0.625 A 7.375 7.375 0 0 1 0.625 15.375 Z",s=`period-slider-knob period-slider-knob-svg is-vertical ${n?"is-semicircle-left":"is-semicircle-right"}`):(a=t?"M 0.625 7.375 A 7.375 7.375 0 0 1 15.375 7.375 Z":"M 0.625 0.625 A 7.375 7.375 0 0 0 15.375 0.625 Z",s=`period-slider-knob period-slider-knob-svg ${t?"is-semicircle-top":"is-semicircle-bottom"}`);const l=e==="macro"?"period-slider-knob-path-macro":"period-slider-knob-path-micro";return g.jsx("svg",{className:s,width:r?"8":"16",height:r?"16":"8",viewBox:r?"0 0 8 16":"0 0 16 8",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:g.jsx("path",{d:a,className:l,shapeRendering:"geometricPrecision",strokeWidth:"1.25"})})});rr.displayName="VernierKnobSvg";const Aa=(e,t)=>{if(!st(e))throw new RangeError(`PeriodSlider: minDate is required and must be a valid Date (received: ${we(e)})`);if(!st(t))throw new RangeError(`PeriodSlider: maxDate is required and must be a valid Date (received: ${we(t)})`);if(t.getTime()<=e.getTime())throw new RangeError(`PeriodSlider: maxDate must be strictly later than minDate (minDate: ${we(e)}, maxDate: ${we(t)})`)},kr=(e,t)=>{if(!Array.isArray(t)||t.length!==2)throw new RangeError(`PeriodSlider: ${e} is required and must be a [start, end] Date tuple (received: ${we(t)})`);const[r,n]=t;if(!st(r))throw new RangeError(`PeriodSlider: ${e}[0] must be a valid Date (received: ${we(r)})`);if(!st(n))throw new RangeError(`PeriodSlider: ${e}[1] must be a valid Date (received: ${we(n)})`);if(n.getTime()<r.getTime())throw new RangeError(`PeriodSlider: ${e} must not be inverted (start: ${we(r)}, end: ${we(n)})`)},Ea=(e,t)=>{if(!st(t))throw new RangeError(`PeriodSlider: ${e} must be a valid Date (received: ${we(t)})`)},Ur=(e,t,r,n)=>{if(t.getTime()<r.getTime()||t.getTime()>n.getTime())throw new RangeError(`PeriodSlider: ${e} must lie within [minDate, maxDate] (received: ${we(t)}, minDate: ${we(r)}, maxDate: ${we(n)})`)},Ia=(e,t,r)=>{if(e.mode==="range"){for(const n of["range","defaultRange"]){const a=e[n];a!==void 0&&(kr(n,a),Ur(`${n}[0]`,a[0],t,r),Ur(`${n}[1]`,a[1],t,r))}return}if(e.mode==="point")for(const n of["value","defaultValue"]){const a=e[n];a!==void 0&&(Ea(n,a),Ur(n,a,t,r))}},Ha=(e,t,r)=>{if(kr("macroRange",e),t!==void 0)return kr("microRange",t),t;if(r!==void 0)return kr("defaultMicroRange",r),r;throw new RangeError("PeriodSlider: vernier mode requires a micro selection; supply microRange (controlled) or defaultMicroRange (uncontrolled)")},Lr=(e,t,r,n,a,s,l,u)=>{const b=ye(e,n,t),f=ye(e,a,t);return l?b:u?f:Math.max(b,Math.min(f,ye(e,r,t)+s))},Br=e=>{e.timerId!==null&&clearTimeout(e.timerId),e.timerId=null,e.emit=null},ja=(e,t)=>{try{Intl.DateTimeFormat.supportedLocalesOf([t])}catch{throw new RangeError(`PeriodSlider: ${e} must be a valid BCP 47 language tag (received: ${JSON.stringify(t)})`)}},Vt=()=>{const[e,t]=o.useState(null),r=o.useRef(null),n=o.useCallback(a=>{if(r.current?.disconnect(),r.current=null,a===null){t(null);return}if(typeof ResizeObserver>"u")return;const s=new ResizeObserver(l=>{for(const u of l){const b=u.borderBoxSize?.[0];b!==void 0&&t(f=>f!==null&&Math.abs(f.widthPx-b.inlineSize)<.5&&Math.abs(f.heightPx-b.blockSize)<.5?f:{widthPx:b.inlineSize,heightPx:b.blockSize})}});s.observe(a),r.current=s},[]);return o.useEffect(()=>()=>{r.current?.disconnect(),r.current=null},[]),[n,e]},zr=(e,t)=>{if(!(e===null||t===null))return{estimatedWidthPx:Math.max(e.widthPx,t.widthPx),estimatedHeightPx:Math.max(e.heightPx,t.heightPx)}},Pn=(e,t,r)=>({"--ps-tooltip-tx":`calc(-50% + ${e}px)`,"--ps-tooltip-ty":`${t}px`,"--ps-tooltip-rot":`${r}deg`}),Cn=(e,t,r,n,a,s,l)=>{const u=Zr(n,a);if(!l)return{slant:u,lowStyle:void 0,highStyle:void 0};const b=Qr(e*100,t*100,r,n,a),f=s?qn(b):b;return{slant:f,lowStyle:Pn(f.lowOffsetX,f.lowOffsetY-u.lowOffsetY,f.lowAngleDeg),highStyle:Pn(f.highOffsetX,f.highOffsetY-u.highOffsetY,f.highAngleDeg)}},Oa={horizontal:{decrease:"◀",increase:"▶"},vertical:{decrease:"▼",increase:"▲"}},Fa={horizontal:{decrease:"period-slider-stepper-prev",increase:"period-slider-stepper-next"},vertical:{decrease:"period-slider-stepper-prev period-slider-stepper-down",increase:"period-slider-stepper-next period-slider-stepper-up"}},Va=e=>{const{unit:t,minDate:r,maxDate:n,allowedDates:a,snapMode:s="index",disabled:l=!1,className:u="",showStepper:b=!0,tooltipStyle:f="always",labelPosition:D="top",autoSlantLabels:y=!0,isVertical:d=!1,hideConnectBar:L=!1,showTicks:H=!1,colorScheme:te="blue-rose",locale:T,decreaseAriaLabel:re="Decrease",increaseAriaLabel:j="Increase"}=e;Aa(r,n),Ia(e,r,n),T!==void 0&&ja("locale",T);const J=e.mode==="vernier"?Ha(e.macroRange,e.microRange,e.defaultMicroRange):null,Y=Fn[te],B=o.useId(),C=o.useRef(e);C.current=e;const F=r.getTime(),O=n.getTime(),x=o.useMemo(()=>Bt(a,t,r,n),[a,t,F,O]),P=x.length>0,{rangeMin:v,rangeMax:N}=o.useMemo(()=>P?{rangeMin:0,rangeMax:x.length-1}:{rangeMin:G(t,r),rangeMax:G(t,n)},[P,x,t,F,O]),R=e.mode==="point",ce=o.useCallback(i=>{if(P){const c=Math.max(0,Math.min(x.length-1,Math.round(i)));return x[c]}return se(t,Math.round(i))},[P,x,t]),ne=o.useCallback(i=>{if(i===void 0)return v;const c=Ke(t,i);return P?ye(x,c,t):G(t,c)},[P,x,t,v]),[Q,ae]=o.useState(()=>J),oe=e.mode!=="vernier"?null:e.microRange!==void 0?e.microRange:Q,de=e.mode==="range"?e.range?.[0]??e.defaultRange?.[0]:e.mode==="vernier"?oe?.[0]:void 0,K=e.mode==="range"?e.range?.[1]??e.defaultRange?.[1]:e.mode==="vernier"?oe?.[1]:void 0,W=e.mode==="point"?e.value??e.defaultValue:void 0,Te=e.mode==="point"?W?.getTime():de?.getTime(),Mt=e.mode==="range"?K?.getTime():Te,[Oe,$e]=o.useMemo(()=>{if(e.mode==="point"){const m=ne(W);return[m,m]}const i=ne(de),c=ne(K);return[Math.min(i,c),Math.max(i,c)]},[e.mode,Te,Mt,ne,W,de,K]),be=e.mode==="point"?e.value!==void 0:e.mode==="range"?e.range!==void 0:e.microRange!==void 0,[I,z]=o.useState(()=>[Oe,$e]),[ee,ge]=o.useState(null),[ue,We]=o.useState(null),Ge=o.useRef(null);Ge.current=ue;const[St,me]=o.useState("high"),[Me,Be]=o.useState(null),[xt,_]=o.useState(null),V=ee?ee[0]:be?Oe:I[0],ie=ee?ee[1]:be?$e:I[1],rt=o.useRef([V,ie]);rt.current=[V,ie];const Z=e.mode==="vernier",Je=e.mode==="vernier"?e.vernierOrientation??(d?"macro-left":"macro-top"):"macro-top",p=Je==="macro-top"||Je==="macro-left",or=e.mode==="vernier"?e.showVernierProjection??!0:!1,ir=e.mode==="vernier"?e.showVernierTicks??!0:!1,Lt=e.mode==="vernier"?e.showHairline??!0:!1,A=Z?e.macroUnit??t:t,M=Z?e.microUnit??t:t,Pr=Z?e.macroIsDiscrete??!1:P,Rt=Z?e.microIsDiscrete??!1:P,lr=Z?e.macroAllowedDates??a:a,Cr=Z?e.microAllowedDates??a:a,h=Z?e.formatMacroLabel??e.formatLabel:e.formatLabel,k=Z?e.formatMicroLabel??e.formatLabel:e.formatLabel,Pe=e.mode==="vernier"?e.macroRange[0].getTime():void 0,$t=e.mode==="vernier"?e.macroRange[1].getTime():void 0,vt=de?.getTime(),nt=K?.getTime(),[Ce,sr]=o.useState(null),ct=o.useRef(null);ct.current=Ce;const[Se,zt]=o.useState("micro-high"),je=o.useMemo(()=>G(A,r),[F,A]),kt=o.useMemo(()=>{const i=G(A,n);if(Z&&i<=je)throw new RangeError(`PeriodSlider: macroUnit "${A}" cannot distinguish minDate from maxDate (minDate: ${we(r)}, maxDate: ${we(n)})`);return i},[Z,F,O,je,A]),pe=o.useMemo(()=>Z?Bt(lr,A,r,n):[],[Z,lr,A,F,O]),Ne=o.useMemo(()=>e.mode!=="vernier"?je:G(A,e.macroRange[0]),[e.mode,Pe,je,A]),Ye=o.useMemo(()=>e.mode!=="vernier"?kt:G(A,e.macroRange[1]),[e.mode,$t,kt,A]),cr=o.useMemo(()=>se(A,Ne),[A,Ne]),ur=o.useMemo(()=>se(A,Ye),[A,Ye]),Le=o.useMemo(()=>e.mode!=="vernier"?G(M,r):Math.max(G(M,e.macroRange[0]),G(M,r)),[e.mode,Pe,M,F]),ze=o.useMemo(()=>e.mode!=="vernier"?G(M,n):Math.min(G(M,lt(A,M,e.macroRange[1])),G(M,n)),[e.mode,$t,A,M,O]),le=o.useMemo(()=>Z?Bt(Cr,M,r,n).filter(c=>{const m=G(M,c);return m>=Le&&m<=ze}):[],[Z,Cr,M,F,O,Le,ze]),Pt=Pr&&pe.length>0,Ze=Rt&&le.length>0,xe=o.useMemo(()=>oe===null?Le:G(M,oe[0]),[vt,Le,M,oe]),ve=o.useMemo(()=>oe===null?ze:G(M,oe[1]),[nt,ze,M,oe]),ut=o.useMemo(()=>se(M,xe),[M,xe]),dt=o.useMemo(()=>se(M,ve),[M,ve]),_t=Math.max(1,kt-je),De=Pt?Tr(pe,A,s,cr):Math.max(0,Math.min(1,(Ne-je)/_t)),Ae=Math.max(De,Pt?Tr(pe,A,s,ur):Math.min(1,(Ye-je)/_t)),Xt=Math.max(1,ze-Le),Fe=Ze?Tr(le,M,s,ut):Math.max(0,Math.min(1,(xe-Le)/Xt)),at=Math.max(Fe,Ze?Tr(le,M,s,dt):Math.min(1,(ve-Le)/Xt)),Nr=o.useRef({timerId:null,emit:null}),Yr=o.useRef({timerId:null,emit:null}),Ar=o.useRef({timerId:null,emit:null});o.useEffect(()=>{const i=[Nr,Yr,Ar];return()=>{for(const c of i)Br(c.current)}},[]);const Ct=o.useCallback((i,c,m)=>{Br(i);const{debounceMs:w}=C.current;if(m||!w||w<=0){c();return}i.emit=c,i.timerId=setTimeout(()=>{i.timerId=null,i.emit=null,c()},w)},[]),Er=o.useCallback(i=>{const c=i.emit;Br(i),c?.()},[]),Nt=o.useCallback(i=>new Date(Math.min(Math.max(i.getTime(),F),O)),[F,O]),Qe=o.useCallback((i,c,m=!1)=>{const[w,$]=rt.current;if((C.current.mode==="point"?i===w:i===w&&c===$)&&Nr.current.timerId===null)return;const X=ce(i),E=ce(c),q=()=>{const S=C.current;S.mode==="point"?S.onChangePoint?.(X):S.mode==="range"&&S.onChangeRange?.(X,E)};Ct(Nr.current,q,m)},[ce,Ct]),Yt=o.useCallback((i,c,m=!1)=>{if(C.current.mode!=="vernier")return;const w=Nt(i),$=Nt(c);Ct(Yr.current,()=>{const U=C.current;U.mode==="vernier"&&U.onChangeMacroRange?.(w,$)},m)},[Nt,Ct]),_e=o.useCallback((i,c,m=!1)=>{const w=C.current;if(w.mode!=="vernier")return;const $=Nt(i),U=Nt(c);w.microRange===void 0&&ae([$,U]),Ct(Ar.current,()=>{const X=C.current;X.mode==="vernier"&&X.onChangeMicroRange?.($,U)},m)},[Nt,Ct]),dr=o.useCallback(i=>{if(P&&s==="time"&&x.length>1){const w=Math.max(0,Math.min(x.length-1,Math.round(i))),$=x[0].getTime(),X=x[x.length-1].getTime()-$;if(X<=0)return 0;const E=x[w].getTime();return Math.max(0,Math.min(100,(E-$)/X*100))}const c=N-v;if(c<=0)return 0;const m=(i-v)/c*100;return Math.max(0,Math.min(100,m))},[P,s,x,v,N]),mr=o.useCallback(i=>{const c=Math.max(0,Math.min(100,i));if(P){if(s==="time"&&x.length>1){const $=x[0].getTime(),X=x[x.length-1].getTime()-$,E=$+c/100*X;return ye(x,new Date(E),t)}const w=Math.round(c/100*(x.length-1));return Math.max(0,Math.min(x.length-1,w))}const m=v+c/100*(N-v);return Math.round(m)},[P,s,x,v,N,t]),ot=o.useRef(null),[At,rn]=o.useState(0),[ra,qt]=Vt(),[na,nn]=Vt(),[aa,an]=Vt(),[oa,on]=Vt(),[ia,ln]=Vt(),[la,sn]=Vt();o.useEffect(()=>{const i=ot.current;if(!i)return;const c=()=>{const m=i.getBoundingClientRect(),w=d?m.height:m.width;w>0&&rn($=>Math.abs($-w)<.5?$:w)};if(c(),typeof ResizeObserver<"u"){const m=new ResizeObserver(w=>{for(const $ of w){const U=d?$.contentRect.height:$.contentRect.width;U>0&&rn(X=>Math.abs(X-U)<.5?X:U)}});return m.observe(i),()=>m.disconnect()}return window.addEventListener("resize",c),()=>window.removeEventListener("resize",c)},[d]);const pt=o.useCallback((i,c,m)=>{const w=d?m.height:m.width;if(!(Number.isFinite(w)&&w>0))return null;const $=d?m.bottom-c:i-m.left;return Number.isFinite($)?Math.max(0,Math.min(1,$/w)):null},[d]),cn=o.useCallback((i,c)=>{const m=ot.current;if(!m)return null;const w=pt(i,c,m.getBoundingClientRect());return w===null?null:w*100},[pt]),fr=o.useRef(null),Ir=o.useRef(null),et=o.useRef(null),Hr=o.useRef(null),Kt=o.useRef(null),un=o.useCallback(i=>{if(l)return;if(Z){const S=Ir.current;if(!S||i.pointerId!==0&&i.pointerId!==S.pointerId||!ot.current)return;const fe=pt(i.clientX,i.clientY,ot.current.getBoundingClientRect());if(fe===null)return;if(S.handle==="macro-low"||S.handle==="macro-high"||S.handle==="macro-connect"){const[Xe,ft,ke]=Wn(S.handle,fe,S.startPointerRatio,S.startMacroLowRatio,S.startMacroHighRatio);ke!==ct.current&&(ct.current=ke,sr(ke),zt(ke));let he,qe;if(Pt){const ht=Sr(pe,A,s,Xe),bt=Math.max(ht,Sr(pe,A,s,ft));he=pe[ht],qe=pe[bt]}else{const ht=Math.round(je+Xe*_t),bt=Math.round(je+ft*_t);he=se(A,ht),qe=se(A,bt)}const Jt=`${he.getTime()}_${qe.getTime()}`;Jt!==Hr.current&&(Hr.current=Jt,Yt(he,qe));let it,gt;if(S.handle==="macro-connect"){const ht=Ke(M,he),bt=lt(A,M,qe);let jt,Ot;if(A==="year"){const wt=he.getFullYear()-S.startMacroLowDate.getFullYear();jt=He("year",S.initialMicroLowDate,wt),Ot=He("year",S.initialMicroHighDate,wt)}else if(A==="month"){const wt=(he.getFullYear()-S.startMacroLowDate.getFullYear())*12+(he.getMonth()-S.startMacroLowDate.getMonth());jt=He("month",S.initialMicroLowDate,wt),Ot=He("month",S.initialMicroHighDate,wt)}else{const wt=Math.round((he.getTime()-S.startMacroLowDate.getTime())/864e5);jt=He("day",S.initialMicroLowDate,wt),Ot=He("day",S.initialMicroHighDate,wt)}const Ft=ht.getTime(),Zt=bt.getTime(),$n=S.initialMicroHighDate.getTime()-S.initialMicroLowDate.getTime();let Qt=jt.getTime(),er=Ot.getTime();Qt<Ft&&(Qt=Ft,er=Math.min(Zt,Qt+$n)),er>Zt&&(er=Zt,Qt=Math.max(Ft,er-$n)),it=Ke(M,new Date(Qt)),gt=Ke(M,new Date(er))}else{const ht=he.getTime(),bt=lt(A,M,qe).getTime(),jt=S.initialMicroLowDate.getTime(),Ot=S.initialMicroHighDate.getTime(),Ft=Math.max(ht,Math.min(bt,jt)),Zt=Math.max(Ft,Math.min(bt,Ot));it=Ke(M,new Date(Ft)),gt=Ke(M,new Date(Zt))}const Rn=`${it.getTime()}_${gt.getTime()}`;Rn!==Kt.current&&(Kt.current=Rn,_e(it,gt))}else if(S.handle==="micro-low"||S.handle==="micro-high"||S.handle==="micro-connect"){const[Xe,ft,ke]=Gn(S.handle,fe,S.startPointerRatio,S.startMicroLowRatio,S.startMicroHighRatio);ke!==ct.current&&(ct.current=ke,sr(ke),zt(ke));let he,qe;if(Ze){const it=Sr(le,M,s,Xe),gt=Math.max(it,Sr(le,M,s,ft));he=le[it],qe=le[gt]}else{const it=Math.round(Le+Xe*Xt),gt=Math.round(Le+ft*Xt);he=se(M,it),qe=se(M,gt)}const Jt=`${he.getTime()}_${qe.getTime()}`;Jt!==Kt.current&&(Kt.current=Jt,_e(he,qe))}return}const c=fr.current;if(!c||i.pointerId!==0&&i.pointerId!==c.pointerId||!ot.current)return;const m=ot.current.getBoundingClientRect(),w=d?i.clientY:i.clientX,$=d?m.height:m.width;if(!(Number.isFinite($)&&$>0))return;if(c.handle==="connect"){const S=d?(c.startPointerPos-w)/$:(w-c.startPointerPos)/$,fe=Un({posDiffPct:S,startLowVal:c.startLowVal,startHighVal:c.startHighVal,rangeMin:v,rangeMax:N,isDiscrete:P,sortedAllowedDates:x,snapMode:s,unit:t});if(et.current&&et.current[0]===fe[0]&&et.current[1]===fe[1])return;et.current=fe,ge(fe),Qe(fe[0],fe[1],!1);return}const U=pt(i.clientX,i.clientY,m);if(U===null)return;const X=mr(U*100),[E,q]=qr(c.handle,X,c.startLowVal,c.startHighVal,v,N,R);if((!et.current||et.current[0]!==E||et.current[1]!==q)&&(et.current=[E,q],ge([E,q]),Qe(E,q,!1)),!R&&(c.handle==="low"||c.handle==="high")){const S=Vn(c.handle,X,c.startLowVal,c.startHighVal,R);Ge.current!==S&&(Ge.current=S,We(S),me(S))}},[l,Z,d,A,M,Pt,Ze,pe,le,je,_t,Le,Xt,v,N,P,x,s,t,pt,mr,Qe,Yt,_e,R]),dn=o.useCallback(i=>{if(Z){Hr.current=null,Kt.current=null,Ir.current=null,ct.current=null,sr(null),Er(Yr.current),Er(Ar.current);return}const c=fr.current;if(!c||i.pointerId!==0&&i.pointerId!==c.pointerId)return;const m=et.current??ee;m&&(Qe(m[0],m[1],!0),z(m)),et.current=null,ge(null),fr.current=null,Ge.current=null,We(null)},[Z,ee,Qe,Er]),mn=o.useRef(un);mn.current=un;const fn=o.useRef(dn);fn.current=dn;const gn=ue!==null||Ce!==null;o.useEffect(()=>{if(!gn)return;const i=m=>mn.current(m),c=m=>fn.current(m);return window.addEventListener("pointermove",i),window.addEventListener("pointerup",c),window.addEventListener("pointercancel",c),()=>{window.removeEventListener("pointermove",i),window.removeEventListener("pointerup",c),window.removeEventListener("pointercancel",c)}},[gn]);const jr=o.useCallback((i,c,m)=>{fr.current={pointerId:i,handle:c,startPointerPos:m,startLowVal:V,startHighVal:ie},Ge.current=c,We(c),c!=="connect"&&me(c)},[V,ie]),hn=o.useCallback((i,c,m)=>{const w=C.current;w.mode==="vernier"&&(Ir.current={pointerId:i,handle:c,startPointerRatio:m,startMacroLowRatio:De,startMacroHighRatio:Ae,startMicroLowRatio:Fe,startMicroHighRatio:at,startMacroLowEnc:Ne,startMacroHighEnc:Ye,startMicroLowEnc:xe,startMicroHighEnc:ve,startMacroLowDate:w.macroRange[0],startMacroHighDate:w.macroRange[1],initialMicroLowDate:ut,initialMicroHighDate:dt},ct.current=c,sr(c),zt(c))},[De,Ae,Fe,at,Ne,Ye,xe,ve,ut,dt]),bn=i=>c=>{if(l)return;c.stopPropagation(),c.preventDefault(),me(i);const m=d?c.clientY:c.clientX;jr(c.pointerId,i,m)},wn=i=>()=>{l||Ge.current!==null||me(i)},gr=i=>()=>{l||ct.current!==null||zt(i)},Et=i=>c=>{if(l)return;c.stopPropagation(),c.preventDefault();const m=ot.current;if(!m)return;const w=pt(c.clientX,c.clientY,m.getBoundingClientRect());w!==null&&hn(c.pointerId,i,w)},sa=i=>{if(l||L)return;i.stopPropagation(),i.preventDefault();const c=d?i.clientY:i.clientX;jr(i.pointerId,"connect",c)},ca=i=>{if(l)return;if(Z){const E=ot.current;if(!E)return;const q=E.getBoundingClientRect(),S=pt(i.clientX,i.clientY,q);if(S===null)return;const fe=d?i.clientX-(q.left+q.width/2):i.clientY-(q.top+q.height/2),Xe=Kn(S,fe,De,Ae,Fe,at,Je,void 0,!L);hn(i.pointerId,Xe,S);return}const c=cn(i.clientX,i.clientY);if(c===null)return;const m=mr(c);let w="low";if(!R){const E=Math.abs(m-V),q=Math.abs(m-ie);E<q?w="low":q<E?w="high":w=m>ie?"high":"low"}me(w);const[$,U]=qr(w,m,V,ie,v,N,R);ge([$,U]),Qe($,U,!0);const X=d?i.clientY:i.clientX;jr(i.pointerId,w,X)},ua=i=>{if(l||ue!==null)return;const c=cn(i.clientX,i.clientY);if(c===null)return;const m=mr(c);Be(m),_(dr(m))},da=()=>{Be(null),_(null)},Mn=i=>c=>{if(l)return;me(i);const m=Bn(c.key,i,V,ie,v,N,R,1);m&&(c.preventDefault(),be||z(m),Qe(m[0],m[1],!0))},hr=(i,c)=>{const m=Math.max(G(M,i),G(M,r)),w=Math.min(G(M,lt(A,M,c)),G(M,n)),$=Math.max(m,Math.min(w,xe)),U=Math.max($,Math.min(w,ve));$===xe&&U===ve||_e(se(M,$),se(M,U),!0)},br=i=>c=>{if(l||!Z||e.mode!=="vernier")return;zt(i);let m=0,w=!1,$=!1;switch(c.key){case"ArrowRight":case"ArrowUp":m=1;break;case"ArrowLeft":case"ArrowDown":m=-1;break;case"PageUp":m=5;break;case"PageDown":m=-5;break;case"Home":w=!0;break;case"End":$=!0;break;default:return}if(c.preventDefault(),i==="macro-low"){const U=se(A,Ne),X=se(A,Ye);if(Pt){const S=Lr(pe,A,U,pe[0],X,m,w,$);if(S===ye(pe,U,A))return;const fe=pe[S];Yt(fe,X,!0),hr(fe,X);return}let E;if(w?E=je:$?E=Ye:E=Math.max(je,Math.min(Ye,Ne+m)),E===Ne)return;const q=se(A,E);Yt(q,X,!0),hr(q,X)}else if(i==="macro-high"){const U=se(A,Ne),X=se(A,Ye);if(Pt){const S=Lr(pe,A,X,U,pe[pe.length-1],m,w,$);if(S===ye(pe,X,A))return;const fe=pe[S];Yt(U,fe,!0),hr(U,fe);return}let E;if(w?E=Ne:$?E=kt:E=Math.max(Ne,Math.min(kt,Ye+m)),E===Ye)return;const q=se(A,E);Yt(U,q,!0),hr(U,q)}else if(i==="micro-low"){const U=se(M,xe),X=se(M,ve);if(Ze){const q=Lr(le,M,U,le[0],X,m,w,$);if(q===ye(le,U,M))return;_e(le[q],X,!0);return}let E;if(w?E=Le:$?E=ve:E=Math.max(Le,Math.min(ve,xe+m)),E===xe)return;_e(se(M,E),X,!0)}else if(i==="micro-high"){const U=se(M,xe),X=se(M,ve);if(Ze){const q=Lr(le,M,X,U,le[le.length-1],m,w,$);if(q===ye(le,X,M))return;_e(U,le[q],!0);return}let E;if(w?E=xe:$?E=ze:E=Math.max(xe,Math.min(ze,ve+m)),E===ve)return;_e(U,se(M,E),!0)}},ma=o.useCallback(i=>{const c=C.current;if(!c.disabled)if(c.mode==="point"){const m=Math.max(v,Math.min(N,V+i));be||z([m,m]),Qe(m,m,!0)}else if(c.mode==="vernier"){if(Ze){const S=le.length-1,fe=ye(le,ut,M),Xe=ye(le,dt,M),ft=Xe-fe;let ke=fe+i,he=Xe+i;i<0&&ke<0?(ke=0,he=Math.min(S,ft)):i>0&&he>S&&(he=S,ke=Math.max(0,S-ft)),(ke!==fe||he!==Xe)&&_e(le[ke],le[he],!0);return}const m=xe,w=ve,$=Le,U=ze,X=w-m;let E=m+i,q=w+i;i<0&&E<$?(E=$,q=Math.min(U,E+X)):i>0&&q>U&&(q=U,E=Math.max($,q-X)),(E!==m||q!==w)&&_e(se(M,E),se(M,q),!0)}else{const m=ie-V;let w=V+i,$=ie+i;i<0&&w<v?(w=v,$=Math.min(N,w+m)):i>0&&$>N&&($=N,w=Math.max(v,$-m)),w<=$&&(be||z([w,$]),Qe(w,$,!0))}},[V,ie,v,N,be,Qe,_e,xe,ve,Le,ze,M,Ze,le,ut,dt]),It=dr(V),Ht=dr(ie),Or=ce(V),Fr=ce(ie),Vr=o.useMemo(()=>R?qt===null?void 0:{estimatedWidthPx:qt.widthPx,estimatedHeightPx:qt.heightPx}:zr(qt,nn),[R,qt,nn]),wr=!R&&V===ie,Ee=o.useMemo(()=>{if(R||!y||d)return Zr(D,Vr);const i=Qr(It,Ht,At,D,Vr);return wr?qn(i):i},[R,wr,y,d,It,Ht,At,D,Vr]),Wt=ue==="low"||ue!=="high"&&St==="low",Gt=!R&&(ue==="high"||ue!=="low"&&St==="high"),Mr=Ne===Ye,xr=xe===ve,fa=Mr&&Se!=="macro-low",ga=Mr&&Se==="macro-low",ha=xr&&Se!=="micro-low",ba=xr&&Se==="micro-low",xn=p?"top":"bottom",vn=p?"bottom":"top",pn=o.useMemo(()=>zr(an,on),[an,on]),Dn=o.useMemo(()=>zr(ln,sn),[ln,sn]),vr=y&&!d,pr=o.useMemo(()=>Cn(De,Ae,At,xn,pn,Mr,vr),[De,Ae,At,xn,pn,Mr,vr]),Dr=o.useMemo(()=>Cn(Fe,at,At,vn,Dn,xr,vr),[Fe,at,At,vn,Dn,xr,vr]),wa=o.useMemo(()=>d?{"--ps-tooltip-origin":"100% 50%","--ps-tooltip-tx":"0px","--ps-tooltip-ty":"-50%","--ps-tooltip-rot":"0deg"}:{"--ps-tooltip-origin":"50% 50%","--ps-tooltip-tx":`calc(-50% + ${Ee.lowOffsetX}px)`,"--ps-tooltip-ty":`calc(-50% + ${Ee.lowOffsetY}px)`,"--ps-tooltip-rot":`${Ee.lowAngleDeg}deg`},[d,Ee.lowOffsetX,Ee.lowOffsetY,Ee.lowAngleDeg]),Ma=o.useMemo(()=>d?{"--ps-tooltip-origin":"100% 50%","--ps-tooltip-tx":"0px","--ps-tooltip-ty":"-50%","--ps-tooltip-rot":"0deg"}:{"--ps-tooltip-origin":"50% 50%","--ps-tooltip-tx":`calc(-50% + ${Ee.highOffsetX}px)`,"--ps-tooltip-ty":`calc(-50% + ${Ee.highOffsetY}px)`,"--ps-tooltip-rot":`${Ee.highAngleDeg}deg`},[d,Ee.highOffsetX,Ee.highOffsetY,Ee.highAngleDeg]),yr=Math.min(It,Ht),yn=Math.max(It,Ht),xa=d?{bottom:`${yr}%`,height:`${yn-yr}%`,top:"auto",left:"0",right:"0"}:{left:`${yr}%`,width:`${yn-yr}%`,top:"0",bottom:"0"},va=Math.max(.01,Ae-De),Tn=Math.max(.06,Math.min(.25,.28*Math.sqrt(va))),pa=d?{bottom:`${It}%`,left:"50%",transform:"translate(-50%, 50%)",zIndex:Wt?40:30}:{left:`${It}%`,top:"50%",transform:"translate(-50%, -50%)",zIndex:Wt?40:30},Da=d?{bottom:`${Ht}%`,left:"50%",transform:"translate(-50%, 50%)",zIndex:Gt?40:30}:{left:`${Ht}%`,top:"50%",transform:"translate(-50%, -50%)",zIndex:Gt?40:30},ya=d?{bottom:`${xt}%`,left:"50%",transform:"translate(-50%, 50%)"}:{left:`${xt}%`,top:"50%",transform:"translate(-50%, -50%)"},Sn=Me!==null?ce(Me):null,Ta=f!=="hover"&&Me!==null&&(Me===V||!R&&Me===ie),Sa=Ze?G(M,le[0]):Le,La=Ze?G(M,le[le.length-1]):ze,Ra=l||(Z?xe<=Sa:R?V<=v:V<=v&&ie<=v),$a=l||(Z?ve>=La:(R||V>=N)&&ie>=N),mt=l?"cursor-not-allowed opacity-50":"cursor-pointer",Ln=i=>{const c=d?"vertical":"horizontal",m=i==="decrease",w=Fa[c][i];return g.jsx("button",{type:"button",className:`period-slider-stepper-btn relative after:absolute after:inset-[-11px] after:content-[''] ${w} flex h-6 w-6 shrink-0 items-center justify-center rounded-md border border-slate-300 bg-white font-bold text-[10px] text-slate-700 leading-none shadow-2xs transition-all hover:bg-slate-100 hover:text-indigo-600 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 active:scale-95 disabled:cursor-not-allowed disabled:opacity-30 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700 ${mt}`,onClick:()=>ma(m?-1:1),disabled:m?Ra:$a,"aria-label":m?re:j,children:Oa[c][i]})};return g.jsxs("div",{style:e.style,className:`period-slider flex select-none items-center gap-2 ${d?"flex-col":"flex-row"} ${u}`,"data-disabled":l?"true":void 0,"data-unit":t,"data-mode":e.mode,"data-orientation":d?"vertical":"horizontal","data-label-position":D,"data-color-scheme":te,children:[b&&Ln(d?"increase":"decrease"),g.jsx("div",{ref:ot,"data-testid":"period-slider-track","data-orientation":d?"vertical":"horizontal","data-vernier-orientation":Z?Je:void 0,className:`period-slider-track relative flex-1 touch-none rounded-full bg-slate-200 dark:bg-slate-700 ${d?"h-48 w-2":"h-2 w-full"} ${mt}`,onPointerDown:ca,onPointerMove:ua,onPointerLeave:da,children:Z?g.jsxs(g.Fragment,{children:[or&&(d?g.jsxs("svg",{className:"period-slider-vernier-projection is-vertical",role:"presentation","aria-hidden":"true",width:"32",height:"100%",viewBox:"0 0 32 100",preserveAspectRatio:"none",children:[g.jsx("defs",{children:g.jsxs("linearGradient",{id:B,x1:"0",y1:"0",x2:"1",y2:"0",children:[g.jsx("stop",{offset:"0%",stopColor:p?Y.macro:Y.micro,stopOpacity:"0.28"}),g.jsx("stop",{offset:"100%",stopColor:p?Y.micro:Y.macro,stopOpacity:Tn})]})}),g.jsx("polygon",{points:p?`12,${(1-Ae)*100} 12,${(1-De)*100} 20,100 20,0`:`12,0 12,100 20,${(1-De)*100} 20,${(1-Ae)*100}`,fill:`url(#${B})`})]}):g.jsxs("svg",{className:"period-slider-vernier-projection",role:"presentation","aria-hidden":"true",width:"100%",height:"32",viewBox:"0 0 100 32",preserveAspectRatio:"none",children:[g.jsx("defs",{children:g.jsxs("linearGradient",{id:B,x1:"0",y1:"0",x2:"0",y2:"1",children:[g.jsx("stop",{offset:"0%",stopColor:p?Y.macro:Y.micro,stopOpacity:"0.28"}),g.jsx("stop",{offset:"100%",stopColor:p?Y.micro:Y.macro,stopOpacity:Tn})]})}),g.jsx("polygon",{points:p?`${De*100},12 ${Ae*100},12 100,20 0,20`:`0,12 100,12 ${Ae*100},20 ${De*100},20`,fill:`url(#${B})`})]})),!L&&g.jsxs(g.Fragment,{children:[g.jsx("div",{"data-testid":"period-slider-connect-macro",className:"period-slider-connect-macro",style:d?{bottom:`calc(${De*100}% - 8px)`,height:`calc(${Math.max(0,(Ae-De)*100)}% + 16px)`}:{left:`calc(${De*100}% - 8px)`,width:`calc(${Math.max(0,(Ae-De)*100)}% + 16px)`},onPointerDown:Et("macro-connect")}),g.jsx("div",{"data-testid":"period-slider-connect-micro",className:"period-slider-connect-micro",style:d?{bottom:`calc(${Fe*100}% - 8px)`,height:`calc(${Math.max(0,(at-Fe)*100)}% + 16px)`}:{left:`calc(${Fe*100}% - 8px)`,width:`calc(${Math.max(0,(at-Fe)*100)}% + 16px)`},onPointerDown:Et("micro-connect")})]}),ir&&g.jsxs("div",{className:"period-slider-vernier-ticks pointer-events-none absolute inset-0",children:[[.2,.4,.6,.8].map(i=>g.jsx("div",{"data-testid":"period-slider-tick","data-tick-scale":"macro",className:"period-slider-tick period-slider-tick-macro",style:d?{bottom:`${i*100}%`}:{left:`${i*100}%`}},`macro-tick-${i}`)),[.1,.2,.3,.4,.5,.6,.7,.8,.9].map(i=>g.jsx("div",{"data-testid":"period-slider-tick","data-tick-scale":"micro",className:"period-slider-tick period-slider-tick-micro",style:d?{bottom:`${i*100}%`}:{left:`${i*100}%`}},`micro-tick-${i}`))]}),g.jsxs("div",{tabIndex:l?-1:0,role:"slider","aria-label":e.macroLowerAriaLabel??"Macro range start","aria-disabled":l?"true":void 0,"aria-valuemin":je,"aria-valuemax":Ye,"aria-valuenow":Ne,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(cr,A):Dt(A,cr,h,T),"aria-orientation":d?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${d?"is-vertical":""} group absolute touch-none ${d?p?"after:absolute after:-inset-y-3 after:right-0 after:-left-4":"after:absolute after:-inset-y-3 after:-right-4 after:left-0":p?"after:absolute after:-inset-x-3 after:-top-4 after:bottom-0":"after:absolute after:-inset-x-3 after:top-0 after:-bottom-4"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${mt}`,style:d?{bottom:`${De*100}%`,left:p?0:"auto",right:p?"auto":0,transform:p?"translate(-100%, 50%)":"translate(100%, 50%)",zIndex:Ce==="macro-low"||Se==="macro-low"?30:15}:{left:`${De*100}%`,top:p?0:"auto",bottom:p?"auto":0,transform:p?"translate(-50%, -100%)":"translate(-50%, 100%)",zIndex:Ce==="macro-low"||Se==="macro-low"?30:15},onPointerDown:Et("macro-low"),onKeyDown:br("macro-low"),onFocus:gr("macro-low"),"data-active":Ce==="macro-low"?"true":void 0,"data-front":Se==="macro-low"?"true":void 0,"data-vernier-pos":d?p?"left":"right":p?"top":"bottom","data-handle-type":"macro-low",children:[g.jsx(rr,{type:"macro",isTop:p,isVertical:d,isLeft:p}),Lt&&g.jsx("div",{className:"period-slider-hairline"}),f!=="hover"&&g.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${f==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":f,"data-duplicate":fa?"true":void 0,"data-slanted":pr.slant.isSlanted?"true":void 0,ref:aa,style:pr.lowStyle,children:Ie(A,cr,h,T)})]}),g.jsxs("div",{tabIndex:l?-1:0,role:"slider","aria-label":e.macroUpperAriaLabel??"Macro range end","aria-disabled":l?"true":void 0,"aria-valuemin":Ne,"aria-valuemax":kt,"aria-valuenow":Ye,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(ur,A):Dt(A,ur,h,T),"aria-orientation":d?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${d?"is-vertical":""} group absolute touch-none ${d?p?"after:absolute after:-inset-y-3 after:right-0 after:-left-4":"after:absolute after:-inset-y-3 after:-right-4 after:left-0":p?"after:absolute after:-inset-x-3 after:-top-4 after:bottom-0":"after:absolute after:-inset-x-3 after:top-0 after:-bottom-4"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${mt}`,style:d?{bottom:`${Ae*100}%`,left:p?0:"auto",right:p?"auto":0,transform:p?"translate(-100%, 50%)":"translate(100%, 50%)",zIndex:Ce==="macro-high"||Se==="macro-high"?30:15}:{left:`${Ae*100}%`,top:p?0:"auto",bottom:p?"auto":0,transform:p?"translate(-50%, -100%)":"translate(-50%, 100%)",zIndex:Ce==="macro-high"||Se==="macro-high"?30:15},onPointerDown:Et("macro-high"),onKeyDown:br("macro-high"),onFocus:gr("macro-high"),"data-active":Ce==="macro-high"?"true":void 0,"data-front":Se==="macro-high"?"true":void 0,"data-vernier-pos":d?p?"left":"right":p?"top":"bottom","data-handle-type":"macro-high",children:[g.jsx(rr,{type:"macro",isTop:p,isVertical:d,isLeft:p}),Lt&&g.jsx("div",{className:"period-slider-hairline"}),f!=="hover"&&g.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${f==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":f,"data-duplicate":ga?"true":void 0,"data-slanted":pr.slant.isSlanted?"true":void 0,ref:oa,style:pr.highStyle,children:Ie(A,ur,h,T)})]}),g.jsxs("div",{tabIndex:l?-1:0,role:"slider","aria-label":e.lowerAriaLabel??"Micro range start","aria-disabled":l?"true":void 0,"aria-valuemin":Le,"aria-valuemax":ve,"aria-valuenow":xe,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(ut,M):Dt(M,ut,k,T),"aria-orientation":d?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${d?"is-vertical":""} group absolute touch-none ${d?p?"after:absolute after:-inset-y-3 after:-right-4 after:left-0":"after:absolute after:-inset-y-3 after:right-0 after:-left-4":p?"after:absolute after:-inset-x-3 after:top-0 after:-bottom-4":"after:absolute after:-inset-x-3 after:-top-4 after:bottom-0"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${mt}`,style:d?{bottom:`${Fe*100}%`,left:p?"auto":0,right:p?0:"auto",transform:p?"translate(100%, 50%)":"translate(-100%, 50%)",zIndex:Ce==="micro-low"||Se==="micro-low"?30:20}:{left:`${Fe*100}%`,top:p?"auto":0,bottom:p?0:"auto",transform:p?"translate(-50%, 100%)":"translate(-50%, -100%)",zIndex:Ce==="micro-low"||Se==="micro-low"?30:20},onPointerDown:Et("micro-low"),onKeyDown:br("micro-low"),onFocus:gr("micro-low"),"data-active":Ce==="micro-low"?"true":void 0,"data-front":Se==="micro-low"?"true":void 0,"data-vernier-pos":d?p?"right":"left":p?"bottom":"top","data-handle-type":"micro-low",children:[g.jsx(rr,{type:"micro",isTop:!p,isVertical:d,isLeft:!p}),Lt&&g.jsx("div",{className:"period-slider-hairline"}),f!=="hover"&&g.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${f==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":f,"data-duplicate":ha?"true":void 0,"data-slanted":Dr.slant.isSlanted?"true":void 0,ref:ia,style:Dr.lowStyle,children:Ie(M,ut,k,T)})]}),g.jsxs("div",{tabIndex:l?-1:0,role:"slider","aria-label":e.upperAriaLabel??"Micro range end","aria-disabled":l?"true":void 0,"aria-valuemin":xe,"aria-valuemax":ze,"aria-valuenow":ve,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(dt,M):Dt(M,dt,k,T),"aria-orientation":d?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${d?"is-vertical":""} group absolute touch-none ${d?p?"after:absolute after:-inset-y-3 after:-right-4 after:left-0":"after:absolute after:-inset-y-3 after:right-0 after:-left-4":p?"after:absolute after:-inset-x-3 after:top-0 after:-bottom-4":"after:absolute after:-inset-x-3 after:-top-4 after:bottom-0"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${mt}`,style:d?{bottom:`${at*100}%`,left:p?"auto":0,right:p?0:"auto",transform:p?"translate(100%, 50%)":"translate(-100%, 50%)",zIndex:Ce==="micro-high"||Se==="micro-high"?30:20}:{left:`${at*100}%`,top:p?"auto":0,bottom:p?0:"auto",transform:p?"translate(-50%, 100%)":"translate(-50%, -100%)",zIndex:Ce==="micro-high"||Se==="micro-high"?30:20},onPointerDown:Et("micro-high"),onKeyDown:br("micro-high"),onFocus:gr("micro-high"),"data-active":Ce==="micro-high"?"true":void 0,"data-front":Se==="micro-high"?"true":void 0,"data-vernier-pos":d?p?"right":"left":p?"bottom":"top","data-handle-type":"micro-high",children:[g.jsx(rr,{type:"micro",isTop:!p,isVertical:d,isLeft:!p}),Lt&&g.jsx("div",{className:"period-slider-hairline"}),f!=="hover"&&g.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${f==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":f,"data-duplicate":ba?"true":void 0,"data-slanted":Dr.slant.isSlanted?"true":void 0,ref:la,style:Dr.highStyle,children:Ie(M,dt,k,T)})]})]}):g.jsxs(g.Fragment,{children:[!L&&g.jsx("div",{"data-testid":"period-slider-connect",className:"period-slider-connect absolute rounded-full",style:xa,onPointerDown:sa}),H&&P&&x.length>1&&g.jsx("div",{className:"period-slider-ticks pointer-events-none absolute inset-0",children:x.map((i,c)=>{const m=G(t,i),w=dr(c),$=d?{bottom:`${w}%`,left:"50%",transform:"translate(-50%, 50%)"}:{left:`${w}%`,top:"50%",transform:"translate(-50%, -50%)"};return g.jsx("div",{"data-testid":"period-slider-tick",className:"period-slider-tick absolute h-1.5 w-1.5 rounded-full bg-slate-400/60 dark:bg-slate-500/60",style:$},`tick-${m}`)})}),!l&&Me!==null&&xt!==null&&ue===null&&Sn&&g.jsxs("div",{"data-testid":"period-slider-hover-guide",className:"period-slider-hover-guide pointer-events-none absolute h-2 w-2",style:ya,children:[g.jsx("div",{"data-testid":"period-slider-hover-dot",className:"period-slider-hover-dot h-full w-full rounded-full border border-white/80 bg-[var(--aqps-accent-light)] shadow-[0_0_6px_var(--aqps-accent-glow)] dark:border-slate-800"}),g.jsx("div",{"data-testid":"period-slider-hover-tooltip","data-duplicate":Ta?"true":void 0,className:`period-slider-hover-tooltip ${D==="bottom"&&!d?"period-slider-hover-tooltip-bottom":""} rounded bg-slate-800/90 px-2 py-0.5 font-medium text-white text-xs shadow-lg backdrop-blur-xs dark:bg-slate-900/90`,children:Ie(t,Sn,e.formatLabel,T)})]}),g.jsxs("div",{tabIndex:l?-1:0,role:"slider","aria-label":R?e.pointAriaLabel??"Selected date":e.lowerAriaLabel??"Range start","aria-disabled":l?"true":void 0,"aria-valuemin":v,"aria-valuemax":R?N:ie,"aria-valuenow":V,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(Or,t):Dt(t,Or,e.formatLabel,T),"aria-orientation":d?"vertical":"horizontal",className:`period-slider-handle group absolute h-4 w-4 touch-none after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:outline-none ${mt}`,style:pa,onPointerDown:bn("low"),onKeyDown:Mn("low"),onFocus:wn("low"),"data-active":ue==="low"?"true":void 0,"data-front":Wt?"true":void 0,children:[g.jsx("div",{"data-testid":"period-slider-knob",className:`period-slider-knob h-full w-full rounded-full border-2 border-white bg-[var(--aqps-accent-color)] group-focus-visible:ring-2 group-focus-visible:ring-blue-600 group-focus-visible:ring-offset-2 dark:border-slate-800 dark:bg-[var(--aqps-accent-light)] ${ue==="low"?"":"shadow-md"}`}),f!=="hover"&&g.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${f==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":f,"data-label-position":D,"data-slanted":Ee.isSlanted?"true":void 0,"data-front":Wt?"true":void 0,"data-duplicate":wr&&!Wt?"true":void 0,ref:ra,style:wa,children:Ie(t,Or,e.formatLabel,T)})]}),!R&&g.jsxs("div",{tabIndex:l?-1:0,role:"slider","aria-label":e.upperAriaLabel??"Range end","aria-disabled":l?"true":void 0,"aria-valuemin":V,"aria-valuemax":N,"aria-valuenow":ie,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(Fr,t):Dt(t,Fr,e.formatLabel,T),"aria-orientation":d?"vertical":"horizontal",className:`period-slider-handle group absolute h-4 w-4 touch-none after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:outline-none ${mt}`,style:Da,onPointerDown:bn("high"),onKeyDown:Mn("high"),onFocus:wn("high"),"data-active":ue==="high"?"true":void 0,"data-front":Gt?"true":void 0,children:[g.jsx("div",{"data-testid":"period-slider-knob",className:`period-slider-knob h-full w-full rounded-full border-2 border-white bg-[var(--aqps-accent-color)] group-focus-visible:ring-2 group-focus-visible:ring-blue-600 group-focus-visible:ring-offset-2 dark:border-slate-800 dark:bg-[var(--aqps-accent-light)] ${ue==="high"?"":"shadow-md"}`}),f!=="hover"&&g.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${f==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":f,"data-label-position":D,"data-slanted":Ee.isSlanted?"true":void 0,"data-front":Gt?"true":void 0,"data-duplicate":wr&&!Gt?"true":void 0,ref:na,style:Ma,children:Ie(t,Fr,e.formatLabel,T)})]})]})}),b&&Ln(d?"decrease":"increase")]})},_r=(e,t)=>{if(e===t)return!0;if(!(e&&t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r].getTime()!==t[r].getTime())return!1;return!0},Jn=(e,t)=>{if(e===t)return!0;if(!(e&&t))return!1;const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const a of r)if(e[a]!==t[a])return!1;return!0},Ua=(e,t)=>e===t?!0:e.mode!==t.mode||e.unit!==t.unit||e.minDate.getTime()!==t.minDate.getTime()||e.maxDate.getTime()!==t.maxDate.getTime()||e.labelPosition!==t.labelPosition||e.autoSlantLabels!==t.autoSlantLabels||e.isVertical!==t.isVertical||e.hideConnectBar!==t.hideConnectBar||e.showTicks!==t.showTicks||e.disabled!==t.disabled||e.showStepper!==t.showStepper||e.debounceMs!==t.debounceMs||e.tooltipStyle!==t.tooltipStyle||e.colorScheme!==t.colorScheme||e.className!==t.className||!Jn(e.style,t.style)||e.snapMode!==t.snapMode||e.formatLabel!==t.formatLabel||e.locale!==t.locale||e.lowerAriaLabel!==t.lowerAriaLabel||e.upperAriaLabel!==t.upperAriaLabel||e.pointAriaLabel!==t.pointAriaLabel||e.macroLowerAriaLabel!==t.macroLowerAriaLabel||e.macroUpperAriaLabel!==t.macroUpperAriaLabel||e.decreaseAriaLabel!==t.decreaseAriaLabel||e.increaseAriaLabel!==t.increaseAriaLabel||e.formatAriaValueText!==t.formatAriaValueText||!_r(e.allowedDates,t.allowedDates)?!1:e.mode==="point"&&t.mode==="point"?!((e.value?.getTime()??null)!==(t.value?.getTime()??null)||(e.defaultValue?.getTime()??null)!==(t.defaultValue?.getTime()??null)||e.onChangePoint!==t.onChangePoint):e.mode==="range"&&t.mode==="range"?!((e.range?.[0]?.getTime()??null)!==(t.range?.[0]?.getTime()??null)||(e.range?.[1]?.getTime()??null)!==(t.range?.[1]?.getTime()??null)||(e.defaultRange?.[0]?.getTime()??null)!==(t.defaultRange?.[0]?.getTime()??null)||(e.defaultRange?.[1]?.getTime()??null)!==(t.defaultRange?.[1]?.getTime()??null)||e.onChangeRange!==t.onChangeRange):e.mode==="vernier"&&t.mode==="vernier"?!((e.microRange?.[0]?.getTime()??null)!==(t.microRange?.[0]?.getTime()??null)||(e.microRange?.[1]?.getTime()??null)!==(t.microRange?.[1]?.getTime()??null)||(e.defaultMicroRange?.[0]?.getTime()??null)!==(t.defaultMicroRange?.[0]?.getTime()??null)||(e.defaultMicroRange?.[1]?.getTime()??null)!==(t.defaultMicroRange?.[1]?.getTime()??null)||e.macroRange[0].getTime()!==t.macroRange[0].getTime()||e.macroRange[1].getTime()!==t.macroRange[1].getTime()||e.vernierOrientation!==t.vernierOrientation||e.showVernierProjection!==t.showVernierProjection||e.showVernierTicks!==t.showVernierTicks||e.showHairline!==t.showHairline||e.macroUnit!==t.macroUnit||e.microUnit!==t.microUnit||e.macroIsDiscrete!==t.macroIsDiscrete||e.microIsDiscrete!==t.microIsDiscrete||e.formatMacroLabel!==t.formatMacroLabel||e.formatMicroLabel!==t.formatMicroLabel||e.onChangeMicroRange!==t.onChangeMicroRange||e.onChangeMacroRange!==t.onChangeMacroRange||!_r(e.macroAllowedDates,t.macroAllowedDates)||!_r(e.microAllowedDates,t.microAllowedDates)):!1,Zn=o.memo(Va,Ua);Zn.displayName="PeriodSlider";const tt=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t},nr=(e,t)=>{if(Number.isNaN(t.getTime()))throw new RangeError(`DateSelector: "${e}" must be a valid Date (received ${String(t)})`)},Ba=e=>{if(e!==void 0)try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{throw new RangeError(`DateSelector: "locale" must be a valid BCP 47 language tag (received ${JSON.stringify(e)})`)}},Tt=(e,t,r)=>{const n=new Date(e,t-1,r);return n.setFullYear(e),n.setHours(0,0,0,0),n},Nn=e=>Tt(e,1,1),za=e=>Tt(e,12,31),_a={year:{year:"numeric"},month:{month:"2-digit"},day:{day:"2-digit"}},Xa={year:4,month:2,day:2},qa={year:e=>e.getFullYear(),month:e=>e.getMonth()+1,day:e=>e.getDate()},Yn=new Map,Ka=(e,t)=>{const r=`${e}\0${t}`,n=Yn.get(r);if(n!==void 0)return n;const a=new Intl.DateTimeFormat(t,_a[e]);return Yn.set(r,a),a},Xr=(e,t,r)=>r===void 0?String(qa[e](t)).padStart(Xa[e],"0"):Ka(e,r).format(t),Wa=(e,t,r)=>{const n=t?.getTime()??null,a=r?.getTime()??null,s=new Map;return e.forEach((l,u)=>{nr(`allowedDates[${u}]`,l);const b=tt(l),f=b.getTime();n!==null&&f<n||a!==null&&f>a||s.has(f)||s.set(f,b)}),Array.from(s.keys()).sort((l,u)=>l-u).map(l=>s.get(l))},Ga=(e,t)=>{const r=[];let n=tt(e);const a=tt(t).getTime();for(;n.getTime()<=a;)r.push(n),n=Re.addDays(n,1);return r},An=(e,t)=>{const r=[];for(let n=e.length-1;n>=0;n--)r.push({label:Ie("day",e[n],void 0,t),value:Re.format(e[n],"yyyy-MM-dd")});return r},Ja=e=>{const{value:t,initialDate:r,onChange:n,children:a,minYear:s,maxYear:l,minDate:u,maxDate:b,allowedDates:f,variant:D="date",className:y="",style:d,disabled:L=!1,prevDateAriaLabel:H="Previous day",nextDateAriaLabel:te="Next day",selectAriaLabel:T="Date",yearAriaLabel:re="Year",monthAriaLabel:j="Month",dayAriaLabel:J="Day",locale:Y,formatYearOption:B,formatMonthOption:C,formatDayOption:F}=e;if(Ba(Y),t!==void 0&&nr("value",t),r!==void 0&&nr("initialDate",r),u!==void 0&&nr("minDate",u),b!==void 0&&nr("maxDate",b),s!==void 0&&!Number.isInteger(s))throw new RangeError(`DateSelector: "minYear" must be an integer year (received ${String(s)})`);if(l!==void 0&&!Number.isInteger(l))throw new RangeError(`DateSelector: "maxYear" must be an integer year (received ${String(l)})`);if(D==="split-dropdown"&&f!==void 0)throw new RangeError('DateSelector: variant="split-dropdown" cannot honour "allowedDates"; use variant="dropdown" or variant="date" for a discrete date set');const O=t??r;if(O===void 0)throw new RangeError("DateSelector: either `value` (controlled) or `initialDate` (uncontrolled) is required; the selected date is never inferred from the wall clock.");const[x,P]=o.useState(()=>tt(O)),v=t!==void 0,N=t?.getTime(),R=o.useMemo(()=>t!==void 0?tt(t):x,[N,x]),ce=u?.getTime(),ne=b?.getTime(),Q=o.useMemo(()=>{const h=u?tt(u):null,k=s!==void 0?Nn(s):null;return h===null?k:k===null||h.getTime()>=k.getTime()?h:k},[ce,s]),ae=o.useMemo(()=>{const h=b?tt(b):null,k=l!==void 0?za(l):null;return h===null?k:k===null||h.getTime()<=k.getTime()?h:k},[ne,l]),oe=Q?.getTime()??null,de=ae?.getTime()??null;if(Q!==null&&ae!==null&&Q.getTime()>ae.getTime())throw new RangeError(`DateSelector: the resolved range is empty (min ${Re.format(Q,"yyyy-MM-dd")} is after max ${Re.format(ae,"yyyy-MM-dd")})`);if(D!=="date"&&f===void 0&&(Q===null||ae===null))throw new RangeError(`DateSelector: variant="${D}" needs a bounded range; supply minDate/minYear and maxDate/maxYear${D==="dropdown"?' or supply "allowedDates"':""}`);const K=f===void 0?null:f.map(h=>h.getTime()).join(","),W=o.useMemo(()=>f===void 0?null:Wa(f,Q,ae),[K,oe,de]),Te=h=>{const k=h.getTime();return W!==null?W.some(Pe=>Pe.getTime()===k):!(oe!==null&&k<oe||de!==null&&k>de)},Mt=O.getTime();o.useEffect(()=>{v||P(tt(O))},[v,Mt]);const Oe=h=>{if(L)return;const k=tt(h);Te(k)&&(v||P(k),n?.(k))},$e=R.getTime(),be=Te(R),I=o.useMemo(()=>{if(W!==null){for(let k=W.length-1;k>=0;k--)if(W[k].getTime()<$e)return W[k];return null}const h=Re.addDays(new Date($e),-1);return Te(h)?h:null},[W,$e,oe,de]),z=o.useMemo(()=>{if(W!==null){for(const k of W)if(k.getTime()>$e)return k;return null}const h=Re.addDays(new Date($e),1);return Te(h)?h:null},[W,$e,oe,de]),ee=L||I===null,ge=L||z===null,ue=()=>{I!==null&&Oe(I)},We=()=>{z!==null&&Oe(z)},Ge=h=>{if(h.target.value){const k=Re.parseISO(h.target.value);Number.isNaN(k.getTime())||Oe(k)}},St=h=>{if(h.target.value){const k=Re.parseISO(h.target.value);Number.isNaN(k.getTime())||Oe(k)}},me=R.getFullYear(),Me=R.getMonth()+1,Be=R.getDate(),xt=o.useMemo(()=>D!=="dropdown"?[]:W!==null?An(W,Y):Q===null||ae===null?[]:An(Ga(Q,ae),Y),[D,W,oe,de,Y]),_=o.useMemo(()=>{if(D!=="split-dropdown"||Q===null||ae===null)return[];const h=[];for(let k=ae.getFullYear();k>=Q.getFullYear();k--)h.push(k);return h},[D,oe,de]),V=o.useMemo(()=>{if(D!=="split-dropdown"||Q===null||ae===null)return[];const h=Q,k=ae,Pe=me===h.getFullYear()?h.getMonth()+1:1,$t=me===k.getFullYear()?k.getMonth()+1:12,vt=[];for(let nt=Pe;nt<=$t;nt++)vt.push(nt);return vt},[D,oe,de,me]),ie=o.useMemo(()=>{if(D!=="split-dropdown"||Q===null||ae===null)return[];const h=Q,k=ae,Pe=me===h.getFullYear()&&Me===h.getMonth()+1?h.getDate():1,$t=me===k.getFullYear()&&Me===k.getMonth()+1?k.getDate():Re.getDaysInMonth(new Date($e)),vt=[];for(let nt=Pe;nt<=$t;nt++)vt.push(nt);return vt},[D,oe,de,$e,me,Me]),rt=(h,k,Pe)=>Pe>Re.getDaysInMonth(Tt(h,k,1))?!1:Te(Tt(h,k,Pe)),Z=(h,k,Pe)=>{rt(h,k,Pe)&&Oe(Tt(h,k,Pe))},Je=h=>B?B(h):Xr("year",Nn(h),Y),p=h=>C?C(h):Xr("month",Tt(me,h,1),Y),or=h=>F?F(h):Xr("day",Tt(me,Me,h),Y),ir=Re.format(R,"yyyy-MM-dd"),Lt=Ie("day",R,void 0,Y),A=Q?Re.format(Q,"yyyy-MM-dd"):void 0,M=ae?Re.format(ae,"yyyy-MM-dd"):void 0,Pr=be?ir:"",Rt="text-center font-mono text-gray-500 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-400",lr=D==="split-dropdown"?"w-auto":"w-38";return g.jsxs("div",{className:`inline-flex items-center ${lr} ${y}`,style:d,"data-variant":D,"data-out-of-range":be?void 0:"true",children:[g.jsx("button",{type:"button","aria-label":H,disabled:ee,className:"relative my-auto inline-flex h-5 w-4 cursor-pointer items-center justify-center rounded p-0 after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:opacity-40",onClick:ue,children:g.jsx("span",{className:"h-0 w-0 border-y-[6px] border-y-transparent border-r-[6px] border-r-slate-500 border-solid hover:border-r-slate-700 dark:border-r-slate-400 dark:hover:border-r-slate-200"})}),D==="dropdown"?g.jsxs("select",{"aria-label":T,disabled:L,className:"mx-1 my-auto w-28 appearance-none rounded-md border border-gray-300 bg-gray-100 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums [text-align-last:center] [text-align:center] focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500",value:Pr,onChange:St,children:[be?null:g.jsx("option",{value:"",disabled:!0,className:Rt,children:Lt}),xt.map(h=>g.jsx("option",{value:h.value,className:"text-center font-mono text-gray-900 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-100",children:h.label},h.value))]}):D==="split-dropdown"?g.jsxs("div",{className:"mx-1 my-auto inline-flex items-center gap-1",children:[g.jsxs("select",{"aria-label":re,disabled:L,className:"rounded-md border border-gray-300 bg-gray-50 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100",value:be?me:"",onChange:h=>Z(Number(h.target.value),Me,Be),children:[be?null:g.jsx("option",{value:"",disabled:!0,className:Rt,children:Je(me)}),_.map(h=>g.jsx("option",{value:h,disabled:!rt(h,Me,Be),className:"dark:bg-slate-700 dark:text-slate-100",children:Je(h)},h))]}),g.jsxs("select",{"aria-label":j,disabled:L,className:"rounded-md border border-gray-300 bg-gray-50 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100",value:be?Me:"",onChange:h=>Z(me,Number(h.target.value),Be),children:[be?null:g.jsx("option",{value:"",disabled:!0,className:Rt,children:p(Me)}),V.map(h=>g.jsx("option",{value:h,disabled:!rt(me,h,Be),className:"dark:bg-slate-700 dark:text-slate-100",children:p(h)},h))]}),g.jsxs("select",{"aria-label":J,disabled:L,className:"rounded-md border border-gray-300 bg-gray-50 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100",value:be?Be:"",onChange:h=>Z(me,Me,Number(h.target.value)),children:[be?null:g.jsx("option",{value:"",disabled:!0,className:Rt,children:or(Be)}),ie.map(h=>g.jsx("option",{value:h,className:"dark:bg-slate-700 dark:text-slate-100",children:or(h)},h))]})]}):g.jsx("input",{"aria-label":T,disabled:L,className:"mx-1 my-auto w-28 rounded-md border border-gray-300 bg-gray-50 px-1 py-0.5 text-gray-900 text-xs focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500 dark:placeholder:text-gray-400",value:ir,min:A,max:M,onChange:Ge,type:"date"}),g.jsx("button",{type:"button","aria-label":te,disabled:ge,className:"relative my-auto inline-flex h-5 w-4 cursor-pointer items-center justify-center rounded p-0 after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:opacity-40",onClick:We,children:g.jsx("span",{className:"h-0 w-0 border-y-[6px] border-y-transparent border-l-[6px] border-l-slate-500 border-solid hover:border-l-slate-700 dark:border-l-slate-400 dark:hover:border-l-slate-200"})}),a]})},Ut=e=>e===void 0?null:tt(e).getTime(),Qn=o.memo(Ja,(e,t)=>!(Ut(e.value??e.initialDate)!==Ut(t.value??t.initialDate)||Ut(e.minDate)!==Ut(t.minDate)||Ut(e.maxDate)!==Ut(t.maxDate)||e.variant!==t.variant||e.disabled!==t.disabled||e.className!==t.className||e.style!==t.style||e.minYear!==t.minYear||e.maxYear!==t.maxYear||e.onChange!==t.onChange||e.allowedDates!==t.allowedDates||e.children!==t.children||e.prevDateAriaLabel!==t.prevDateAriaLabel||e.nextDateAriaLabel!==t.nextDateAriaLabel||e.selectAriaLabel!==t.selectAriaLabel||e.yearAriaLabel!==t.yearAriaLabel||e.monthAriaLabel!==t.monthAriaLabel||e.dayAriaLabel!==t.dayAriaLabel||e.locale!==t.locale||e.formatYearOption!==t.formatYearOption||e.formatMonthOption!==t.formatMonthOption||e.formatDayOption!==t.formatDayOption));Qn.displayName="DateSelector";function Ve(e,t){const r=e+Math.floor(t/12),n=(t%12+12)%12,a=new Date(r,n,1);return a.setFullYear(r),a}function yt(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}`}function tr(e,t){if(e!==void 0&&(!(e instanceof Date)||Number.isNaN(e.getTime())))throw new RangeError(`MonthSelector: \`${t}\` must be a valid Date, received ${String(e)}.`)}function En(e,t){if(e!==void 0&&!Number.isInteger(e))throw new RangeError(`MonthSelector: \`${t}\` must be an integer year, received ${String(e)}.`)}function Za(e){if(e!==void 0)try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{throw new RangeError(`MonthSelector: \`locale\` must be a valid BCP 47 language tag, received ${JSON.stringify(e)}.`)}}function Qa(e,t){const r=e===void 0?null:Ve(e,0),n=t===void 0?null:Ve(t.getFullYear(),t.getMonth());return r!==null&&n!==null?r>=n?r:n:r!==null?r:n}function eo(e,t){const r=e===void 0?null:Ve(e,11),n=t===void 0?null:Ve(t.getFullYear(),t.getMonth());return r!==null&&n!==null?r<=n?r:n:r!==null?r:n}function to(e,t,r){const n=new Map;for(const a of e){const s=Ve(a.getFullYear(),a.getMonth());t!==null&&s<t||r!==null&&s>r||n.has(s.getTime())||n.set(s.getTime(),s)}return Array.from(n.values()).sort((a,s)=>a.getTime()-s.getTime())}function ro(e,t){const r=e.getFullYear()*12+e.getMonth(),n=t.getFullYear()*12+t.getMonth(),a=[];for(let s=r;s<=n;s++)a.push(Ve(Math.floor(s/12),s%12));return a}function In(e,t){const r=[];for(let n=e.length-1;n>=0;n--)r.push({label:Ie("month",e[n],void 0,t),value:yt(e[n])});return r}const no=e=>{const{value:t,initialDate:r,onChange:n,children:a,variant:s="date",minYear:l,maxYear:u,minDate:b,maxDate:f,allowedMonths:D,isWarning:y=!1,className:d="",style:L,disabled:H=!1,prevMonthAriaLabel:te="Previous month",nextMonthAriaLabel:T="Next month",selectAriaLabel:re="Month",locale:j}=e;Za(j),tr(t,"value"),tr(r,"initialDate"),tr(b,"minDate"),tr(f,"maxDate"),En(l,"minYear"),En(u,"maxYear"),D?.forEach((_,V)=>{tr(_,`allowedMonths[${V}]`)});const J=t??r;if(J===void 0)throw new RangeError("MonthSelector: either `value` (controlled) or `initialDate` (uncontrolled) is required; the selected month is never inferred from the wall clock.");const[Y,B]=o.useState(()=>Ve(J.getFullYear(),J.getMonth())),C=t!==void 0,F=o.useMemo(()=>t!==void 0?Ve(t.getFullYear(),t.getMonth()):Y,[t?.getTime(),Y]),O=b?.getTime(),x=f?.getTime(),P=o.useMemo(()=>Qa(l,b),[l,O]),v=o.useMemo(()=>eo(u,f),[u,x]),N=P?.getTime()??null,R=v?.getTime()??null;if(P!==null&&v!==null&&P>v)throw new RangeError(`MonthSelector: the resolved lower bound ${yt(P)} is after the resolved upper bound ${yt(v)}.`);if(s==="dropdown"&&D===void 0&&(P===null||v===null))throw new RangeError('MonthSelector: variant="dropdown" requires a lower bound (`minYear` or `minDate`) and an upper bound (`maxYear` or `maxDate`), or `allowedMonths`; the option window is never invented.');const ce=D===void 0?null:D.map(_=>_.getTime()).join(","),ne=o.useMemo(()=>D===void 0?null:to(D,P,v),[ce,N,R]),Q=_=>{const V=_.getTime();return ne!==null?ne.some(ie=>ie.getTime()===V):!(N!==null&&V<N||R!==null&&V>R)},ae=J.getTime();o.useEffect(()=>{if(C)return;const _=Ve(J.getFullYear(),J.getMonth());B(V=>V.getTime()===_.getTime()?V:_)},[C,ae]);const oe=_=>{if(H)return;if(!Q(_))throw new RangeError(`MonthSelector: refusing to emit ${yt(_)}, which lies outside the selectable months.`);C||B(_);const V=_.getFullYear()*100+(_.getMonth()+1);n?.(_,V)},de=F.getTime(),K=Q(F),W=o.useMemo(()=>{if(ne!==null){for(let V=ne.length-1;V>=0;V--)if(ne[V].getTime()<de)return ne[V];return null}const _=Ve(F.getFullYear(),F.getMonth()-1);return Q(_)?_:null},[ne,de,N,R]),Te=o.useMemo(()=>{if(ne!==null){for(const V of ne)if(V.getTime()>de)return V;return null}const _=Ve(F.getFullYear(),F.getMonth()+1);return Q(_)?_:null},[ne,de,N,R]),Mt=H||W===null,Oe=H||Te===null,$e=()=>{W!==null&&oe(W)},be=()=>{Te!==null&&oe(Te)},I=_=>{if(!_)return;const[V,ie]=_.split("-"),rt=Number(V),Z=Number(ie)-1;if(!(Number.isInteger(rt)&&Number.isInteger(Z)))return;const Je=Ve(rt,Z);Q(Je)&&oe(Je)},z=_=>{I(_.target.value)},ee=_=>{I(_.target.value)},ge=yt(F),ue=Ie("month",F,void 0,j),We=P?yt(P):void 0,Ge=v?yt(v):void 0,St=o.useMemo(()=>s!=="dropdown"?[]:ne!==null?In(ne,j):P===null||v===null?[]:In(ro(P,v),j),[s,ne,N,R,j]),me=K?ge:"",Me=y?"border-amber-300 bg-amber-50 text-amber-900 focus:border-amber-500 focus:ring-amber-500 dark:border-amber-900/50 dark:bg-amber-950/20 dark:text-amber-200":"border-gray-300 bg-gray-100 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500",Be=`mx-1 my-auto w-28 rounded-md border py-0.5 px-1 text-xs dark:placeholder:text-gray-400 disabled:opacity-50 ${Me}`,xt=`mx-1 my-auto w-28 appearance-none rounded-md border px-1 py-0.5 text-center font-mono text-xs tabular-nums [text-align-last:center] [text-align:center] disabled:opacity-50 ${Me}`;return g.jsxs("div",{className:`inline-flex w-38 items-center ${d}`,style:L,"data-out-of-range":K?void 0:"true",children:[g.jsx("button",{type:"button","aria-label":te,disabled:Mt,className:"relative my-auto inline-flex h-5 w-4 cursor-pointer items-center justify-center rounded p-0 after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:opacity-40",onClick:$e,children:g.jsx("span",{className:"h-0 w-0 border-y-[6px] border-y-transparent border-r-[6px] border-r-slate-500 border-solid hover:border-r-slate-700 dark:border-r-slate-400 dark:hover:border-r-slate-200"})}),s==="dropdown"?g.jsxs("select",{"aria-label":re,disabled:H,className:xt,value:me,onChange:ee,children:[K?null:g.jsx("option",{value:"",disabled:!0,className:"text-center font-mono text-gray-500 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-400",children:ue}),St.map(_=>g.jsx("option",{value:_.value,className:"text-center font-mono text-gray-900 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-100",children:_.label},_.value))]}):g.jsx("input",{"aria-label":re,disabled:H,className:Be,value:ge,min:We,max:Ge,onChange:z,type:"month"}),g.jsx("button",{type:"button","aria-label":T,disabled:Oe,className:"relative my-auto inline-flex h-5 w-4 cursor-pointer items-center justify-center rounded p-0 after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:opacity-40",onClick:be,children:g.jsx("span",{className:"h-0 w-0 border-y-[6px] border-y-transparent border-l-[6px] border-l-slate-500 border-solid hover:border-l-slate-700 dark:border-l-slate-400 dark:hover:border-l-slate-200"})}),a]})},ea=o.memo(no,(e,t)=>{const r=e.value??e.initialDate,n=t.value??t.initialDate,a=r?r.getFullYear()*12+r.getMonth():null,s=n?n.getFullYear()*12+n.getMonth():null;if(a!==s||e.variant!==t.variant||e.disabled!==t.disabled||e.className!==t.className||e.style!==t.style||e.isWarning!==t.isWarning||e.minYear!==t.minYear||e.maxYear!==t.maxYear)return!1;const l=e.minDate?e.minDate.getFullYear()*12+e.minDate.getMonth():null,u=t.minDate?t.minDate.getFullYear()*12+t.minDate.getMonth():null;if(l!==u)return!1;const b=e.maxDate?e.maxDate.getFullYear()*12+e.maxDate.getMonth():null,f=t.maxDate?t.maxDate.getFullYear()*12+t.maxDate.getMonth():null;return!(b!==f||e.allowedMonths!==t.allowedMonths||e.onChange!==t.onChange||e.children!==t.children||e.prevMonthAriaLabel!==t.prevMonthAriaLabel||e.nextMonthAriaLabel!==t.nextMonthAriaLabel||e.selectAriaLabel!==t.selectAriaLabel||e.locale!==t.locale)});ea.displayName="MonthSelector";function ar(e,t,r){if(!(r instanceof Date)||Number.isNaN(r.getTime()))throw new RangeError(`${e}: ${t} is required and must be a valid Date (received: ${String(r)})`)}function en(e,t,r){if(ar(e,"minDate",t),ar(e,"maxDate",r),r.getTime()<=t.getTime())throw new RangeError(`${e}: maxDate must be strictly later than minDate (minDate: ${t.toISOString()}, maxDate: ${r.toISOString()})`)}function Kr(e,t,r){if(!Array.isArray(r)||r.length!==2)throw new RangeError(`${e}: ${t} is required and must be a [lower, upper] Date tuple (received: ${String(r)})`);if(ar(e,`${t}[0]`,r[0]),ar(e,`${t}[1]`,r[1]),r[0].getTime()>r[1].getTime())throw new RangeError(`${e}: ${t} upper must not be earlier than lower (lower: ${r[0].toISOString()}, upper: ${r[1].toISOString()})`)}function Wr(e,t,r,n,a,s){if(r.getTime()<n.getTime()||r.getTime()>a.getTime())throw new RangeError(`${e}: ${t} must lie within ${s} (value: ${r.toISOString()}, lower: ${n.toISOString()}, upper: ${a.toISOString()})`)}function Gr(e,t,r,n,a,s){Wr(e,`${t}[0]`,r[0],n,a,s),Wr(e,`${t}[1]`,r[1],n,a,s)}function Ue(e,t,r){return e<t?t:e>r?r:e}function Rr(e,t,r,n){const a=lt(t,r,n[1]);return[Ue(e[0],n[0],a),Ue(e[1],n[0],a)]}function Jr(e,t,r,n){const a=ye(e,r,t)+n;return e[Math.max(0,Math.min(e.length-1,a))]}function tn(e){const t=o.useRef(e),r=t.current,n=e,a=Object.keys(r),s=Object.keys(n);return a.length===s.length&&s.every(u=>Object.is(r[u],n[u]))||(t.current=e),t.current}function ao(e){const{unit:t,minDate:r,maxDate:n,initialRange:a,onChangeRange:s,...l}=e;en("usePeriodSliderRange",r,n),Kr("usePeriodSliderRange","initialRange",a),Gr("usePeriodSliderRange","initialRange",a,r,n,"[minDate, maxDate]");const u=tn(l),b=o.useRef(a),[f,D]=o.useState(a);let y=f;const d=[Ue(f[0],r,n),Ue(f[1],r,n)];(d[0]!==f[0]||d[1]!==f[1])&&(y=d,D(d));const L=o.useRef(y);L.current=y;const H=o.useRef({minDate:r,maxDate:n,allowedDates:u.allowedDates});H.current={minDate:r,maxDate:n,allowedDates:u.allowedDates};const te=o.useRef(s);te.current=s;const T=o.useCallback(x=>{const{minDate:P,maxDate:v}=H.current,N=Ue(x[0],P,v),R=Ue(x[1],P,v),ce=L.current;N.getTime()===ce[0].getTime()&&R.getTime()===ce[1].getTime()||(L.current=[N,R],D([N,R]),te.current?.(N,R))},[]),re=o.useCallback(x=>{const P=L.current,v=x.getTime()>P[1].getTime()?x:P[1];T([x,v])},[T]),j=o.useCallback(x=>{const P=L.current,v=x.getTime()<P[0].getTime()?x:P[0];T([v,x])},[T]),J=o.useCallback((x,P)=>{T([x,P])},[T]),Y=o.useCallback(x=>{const{minDate:P,maxDate:v,allowedDates:N}=H.current,R=L.current,ce=Bt(N,t,P,v);if(ce.length>0){T([Jr(ce,t,R[0],x),Jr(ce,t,R[1],x)]);return}T([He(t,R[0],x),He(t,R[1],x)])},[t,T]),B=o.useCallback(()=>{T(b.current)},[T]),C=o.useMemo(()=>({value:y[0],onChange:re,minDate:r,maxDate:y[1],unit:t}),[y[0],y[1],re,r,t]),F=o.useMemo(()=>({value:y[1],onChange:j,minDate:y[0],maxDate:n,unit:t}),[y[0],y[1],j,n,t]),O=o.useMemo(()=>({...u,mode:"range",unit:t,range:y,minDate:r,maxDate:n,onChangeRange:J}),[u,t,y,r,n,J]);return{range:y,lowerDate:y[0],upperDate:y[1],setRange:D,setLowerDate:re,setUpperDate:j,shiftRange:Y,resetRange:B,startSelectorProps:C,endSelectorProps:F,sliderProps:O}}function oo(e){const{unit:t,minDate:r,maxDate:n,initialValue:a,onChangePoint:s,...l}=e;en("usePeriodSliderPoint",r,n),ar("usePeriodSliderPoint","initialValue",a),Wr("usePeriodSliderPoint","initialValue",a,r,n,"[minDate, maxDate]");const u=tn(l),b=o.useRef(a),[f,D]=o.useState(a);let y=f;const d=Ue(f,r,n);d!==f&&(y=d,D(d));const L=o.useRef(y);L.current=y;const H=o.useRef({minDate:r,maxDate:n,allowedDates:u.allowedDates});H.current={minDate:r,maxDate:n,allowedDates:u.allowedDates};const te=o.useRef(s);te.current=s;const T=o.useCallback(B=>{const{minDate:C,maxDate:F}=H.current,O=Ue(B,C,F);O.getTime()!==L.current.getTime()&&(L.current=O,D(O),te.current?.(O))},[]),re=o.useCallback(B=>{const{minDate:C,maxDate:F,allowedDates:O}=H.current,x=Bt(O,t,C,F);if(x.length>0){T(Jr(x,t,L.current,B));return}T(He(t,L.current,B))},[t,T]),j=o.useCallback(()=>{T(b.current)},[T]),J=o.useMemo(()=>({value:y,onChange:T,minDate:r,maxDate:n,unit:t}),[y,T,r,n,t]),Y=o.useMemo(()=>({...u,mode:"point",unit:t,value:y,minDate:r,maxDate:n,onChangePoint:T}),[u,t,y,r,n,T]);return{value:y,setValue:D,shiftValue:re,resetValue:j,selectorProps:J,sliderProps:Y}}function io(e){const{unit:t,minDate:r,maxDate:n,initialMacroRange:a,initialMicroRange:s,macroUnit:l=t,microUnit:u=t,onChangeMacroRange:b,onChangeMicroRange:f,...D}=e;en("useVernierSlider",r,n),Kr("useVernierSlider","initialMacroRange",a),Kr("useVernierSlider","initialMicroRange",s),Gr("useVernierSlider","initialMacroRange",a,r,n,"[minDate, maxDate]"),Gr("useVernierSlider","initialMicroRange",s,a[0],lt(l,u,a[1]),"the initial macro window");const y=tn(D),d=o.useRef(a),L=o.useRef(s),[H,te]=o.useState(a),[T,re]=o.useState(s);let j=H;const J=[Ue(H[0],r,n),Ue(H[1],r,n)];(J[0]!==H[0]||J[1]!==H[1])&&(j=J,te(J));let Y=T;const B=Rr(T,l,u,j);(B[0]!==T[0]||B[1]!==T[1])&&(Y=B,re(B));const C=o.useRef(j);C.current=j;const F=o.useRef(Y);F.current=Y;const O=o.useRef({minDate:r,maxDate:n});O.current={minDate:r,maxDate:n};const x=o.useRef(b);x.current=b;const P=o.useRef(f);P.current=f;const v=o.useCallback((I,z)=>{const ee=C.current,ge=F.current;(I[0].getTime()!==ee[0].getTime()||I[1].getTime()!==ee[1].getTime())&&(C.current=I,te(I),x.current?.(I[0],I[1])),(z[0].getTime()!==ge[0].getTime()||z[1].getTime()!==ge[1].getTime())&&(F.current=z,re(z),P.current?.(z[0],z[1]))},[]),N=o.useCallback((I,z)=>{const{minDate:ee,maxDate:ge}=O.current,ue=[Ue(I,ee,ge),Ue(z,ee,ge)];v(ue,Rr(F.current,l,u,ue))},[l,u,v]),R=o.useCallback((I,z)=>{v(C.current,Rr([I,z],l,u,C.current))},[l,u,v]),ce=o.useCallback(I=>{const z=C.current[1],ee=I>z?I:z;N(I,ee)},[N]),ne=o.useCallback(I=>{const z=C.current[0],ee=I<z?I:z;N(ee,I)},[N]),Q=o.useCallback(I=>{const z=F.current[1],ee=I>z?I:z;R(I,ee)},[R]),ae=o.useCallback(I=>{const z=F.current[0],ee=I<z?I:z;R(ee,I)},[R]),oe=o.useCallback(I=>{const{minDate:z,maxDate:ee}=O.current,ge=C.current,ue=He(l,ge[0],I),We=He(l,ge[1],I);ue<z||We>ee||N(ue,We)},[l,N]),de=o.useCallback(I=>{const z=C.current,ee=F.current,ge=He(u,ee[0],I),ue=He(u,ee[1],I);ge<z[0]||ue>lt(l,u,z[1])||R(ge,ue)},[l,u,R]),K=o.useCallback(()=>{const I=d.current;v(I,Rr(L.current,l,u,I))},[l,u,v]),W=o.useMemo(()=>lt(l,u,j[1]),[l,u,j[1]]),Te=o.useMemo(()=>({value:j[0],onChange:ce,minDate:r,maxDate:j[1],unit:l}),[j,ce,r,l]),Mt=o.useMemo(()=>({value:j[1],onChange:ne,minDate:j[0],maxDate:n,unit:l}),[j,ne,n,l]),Oe=o.useMemo(()=>({value:Y[0],onChange:Q,minDate:j[0],maxDate:Y[1],unit:u}),[Y,Q,j,u]),$e=o.useMemo(()=>({value:Y[1],onChange:ae,minDate:Y[0],maxDate:W,unit:u}),[Y,ae,W,u]),be=o.useMemo(()=>({...y,mode:"vernier",unit:t,macroUnit:l,microUnit:u,minDate:r,maxDate:n,macroRange:j,microRange:Y,onChangeMacroRange:N,onChangeMicroRange:R}),[y,t,l,u,r,n,j,Y,N,R]);return{macroRange:j,setMacroRange:te,microRange:Y,setMicroRange:re,setMacroLowerDate:ce,setMacroUpperDate:ne,setMicroLowerDate:Q,setMicroUpperDate:ae,shiftMacroRange:oe,shiftMicroRange:de,resetVernier:K,macroStartSelectorProps:Te,macroEndSelectorProps:Mt,microStartSelectorProps:Oe,microEndSelectorProps:$e,sliderProps:be}}function Hn(e){const t=new Date(e,0,1);return t.setFullYear(e),t}function $r(e,t){if(e!==void 0&&(!(e instanceof Date)||Number.isNaN(e.getTime())))throw new RangeError(`YearSelector: \`${t}\` must be a valid Date, received ${String(e)}.`)}function jn(e,t){if(e!==void 0&&!Number.isInteger(e))throw new RangeError(`YearSelector: \`${t}\` must be an integer year, received ${String(e)}.`)}function lo(e){if(e!==void 0)try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{throw new RangeError(`YearSelector: \`locale\` must be a valid BCP 47 language tag, received ${JSON.stringify(e)}.`)}}function On(e,t,r){const n=e===void 0?null:e,a=t===void 0?null:t.getFullYear();return n!==null&&a!==null?r(n,a):n!==null?n:a}const so=e=>{const{value:t,initialDate:r,onChange:n,children:a,minYear:s,maxYear:l,minDate:u,maxDate:b,className:f="",style:D,disabled:y=!1,prevYearAriaLabel:d="Previous year",nextYearAriaLabel:L="Next year",selectAriaLabel:H="Year",locale:te}=e;$r(t,"value"),$r(r,"initialDate"),$r(u,"minDate"),$r(b,"maxDate"),jn(s,"minYear"),jn(l,"maxYear"),lo(te);const T=t??r;if(T===void 0)throw new RangeError("YearSelector: either `value` (controlled) or `initialDate` (uncontrolled) is required; the selected year is never inferred from the wall clock.");const[re,j]=o.useState(()=>T.getFullYear()),J=u?.getTime(),Y=b?.getTime(),B=o.useMemo(()=>On(s,u,Math.max),[s,J]),C=o.useMemo(()=>On(l,b,Math.min),[l,Y]);if(B===null||C===null)throw new RangeError("YearSelector: a lower bound (`minYear` or `minDate`) and an upper bound (`maxYear` or `maxDate`) are both required; the year option list is never invented.");if(B>C)throw new RangeError(`YearSelector: the resolved lower bound ${B} is after the resolved upper bound ${C}.`);const F=t!==void 0,O=t!==void 0?t.getFullYear():re,x=O<B||O>C,P=T.getTime();o.useEffect(()=>{F||j(T.getFullYear())},[F,P]);const v=K=>K>=B&&K<=C,N=K=>{if(!y){if(!v(K))throw new RangeError(`YearSelector: refusing to emit ${K}, which lies outside the declared bounds ${B}-${C}.`);F||j(K),n?.(Hn(K),K)}},R=v(O-1)?O-1:null,ce=v(O+1)?O+1:null,ne=y||R===null,Q=y||ce===null,ae=()=>{R!==null&&N(R)},oe=()=>{ce!==null&&N(ce)},de=o.useMemo(()=>{const K=[];for(let W=C;W>=B;W--)K.push(W);return x&&(K.push(O),K.sort((W,Te)=>Te-W)),K},[B,C,x,O]);return g.jsxs("div",{className:`inline-flex w-32 items-center ${f}`,style:D,children:[g.jsx("button",{type:"button","aria-label":d,disabled:ne,className:"relative my-auto inline-flex h-5 w-4 cursor-pointer items-center justify-center rounded p-0 after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:opacity-40",onClick:ae,children:g.jsx("span",{className:"h-0 w-0 border-y-[6px] border-y-transparent border-r-[6px] border-r-slate-500 border-solid hover:border-r-slate-700 dark:border-r-slate-400 dark:hover:border-r-slate-200"})}),g.jsx("select",{"aria-label":H,disabled:y,className:"mx-1 my-auto w-18 appearance-none rounded-md border border-gray-300 bg-gray-100 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums [text-align-last:center] [text-align:center] focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500",value:O,onChange:K=>{if(!K.target.value)return;const W=Number(K.target.value);Number.isInteger(W)&&N(W)},children:de.map(K=>g.jsx("option",{value:K,className:"text-center font-mono text-gray-900 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-100",children:Ie("year",Hn(K),void 0,te)},K))}),g.jsx("button",{type:"button","aria-label":L,disabled:Q,className:"relative my-auto inline-flex h-5 w-4 cursor-pointer items-center justify-center rounded p-0 after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:opacity-40",onClick:oe,children:g.jsx("span",{className:"h-0 w-0 border-y-[6px] border-y-transparent border-l-[6px] border-l-slate-500 border-solid hover:border-l-slate-700 dark:border-l-slate-400 dark:hover:border-l-slate-200"})}),a]})},ta=o.memo(so,(e,t)=>{const r=e.value??e.initialDate,n=t.value??t.initialDate,a=r?r.getFullYear():null,s=n?n.getFullYear():null;return!(a!==s||e.disabled!==t.disabled||e.className!==t.className||e.style!==t.style||e.minYear!==t.minYear||e.maxYear!==t.maxYear||e.minDate?.getFullYear()!==t.minDate?.getFullYear()||e.maxDate?.getFullYear()!==t.maxDate?.getFullYear()||e.onChange!==t.onChange||e.children!==t.children||e.prevYearAriaLabel!==t.prevYearAriaLabel||e.nextYearAriaLabel!==t.nextYearAriaLabel||e.selectAriaLabel!==t.selectAriaLabel||e.locale!==t.locale)});ta.displayName="YearSelector";exports.COLOR_SCHEME_PALETTES=Fn;exports.DateSelector=Qn;exports.MonthSelector=ea;exports.PeriodSlider=Zn;exports.YearSelector=ta;exports.addUnit=He;exports.areStylesEqual=Jn;exports.calculateConnectDragValues=Un;exports.calculateHandleDragValues=qr;exports.calculateKeyboardActionValues=Bn;exports.calculateLabelSlant=Qr;exports.calculateVernierMacroDrag=Wn;exports.calculateVernierMicroDrag=Gn;exports.decode=se;exports.encode=G;exports.findNearestDateIndex=ye;exports.formatLabel=Ie;exports.formatScreenReaderLabel=Dt;exports.getActiveDragHandle=Vn;exports.getMacroWindowEndDate=lt;exports.getSortedAllowedDates=Bt;exports.normalizeDateByUnit=Ke;exports.resolveVernierTargetHandle=Kn;exports.usePeriodSliderPoint=oo;exports.usePeriodSliderRange=ao;exports.useVernierSlider=io;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react/jsx-runtime"),Ye=require("date-fns"),o=require("react"),uo={"blue-rose":{macro:"#0284c7",macroLight:"#38bdf8",micro:"#e11d48",microLight:"#fb7185",accent:"#0284c7"},"indigo-amber":{macro:"#4f46e5",macroLight:"#818cf8",micro:"#d97706",microLight:"#fbbf24",accent:"#4f46e5"},"teal-emerald":{macro:"#0d9488",macroLight:"#2dd4bf",micro:"#059669",microLight:"#34d399",accent:"#0d9488"},"violet-fuchsia":{macro:"#7c3aed",macroLight:"#a78bfa",micro:"#c026d3",microLight:"#e879f9",accent:"#7c3aed"},"slate-sky":{macro:"#475569",macroLight:"#94a3b8",micro:"#0284c7",microLight:"#38bdf8",accent:"#475569"},monochrome:{macro:"#52525b",macroLight:"#a1a1aa",micro:"#18181b",microLight:"#71717a",accent:"#27272a"}},ot=e=>e instanceof Date&&!Number.isNaN(e.getTime()),xe=e=>e instanceof Date?Number.isNaN(e.getTime())?"Invalid Date":e.toISOString():String(e),Ke=(e,t)=>{if(!ot(t))throw new RangeError(`normalizeDateByUnit: d must be a valid Date (received: ${xe(t)})`);const r=new Date(t.getTime());return e==="year"?(r.setMonth(0,1),r.setHours(0,0,0,0)):(e==="month"&&r.setDate(1),r.setHours(0,0,0,0)),r},de=(e,t)=>{const r=Ke(e,t),n=r.getFullYear(),a=r.getMonth()+1,c=r.getDate();if(e==="year")return n;if(e==="month")return n*12+(a-1);const l=new Date(0);return l.setUTCFullYear(n,a-1,c),l.setUTCHours(0,0,0,0),Math.floor(l.getTime()/(1440*60*1e3))},ae=(e,t)=>{const r=new Date(0);if(r.setHours(0,0,0,0),e==="year")return r.setFullYear(t,0,1),r;if(e==="month"){const a=Math.floor(t/12),c=t-a*12;return r.setFullYear(a,c,1),r}const n=new Date(t*24*60*60*1e3);return r.setFullYear(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()),r},Ee=(e,t,r)=>{if(!ot(t))throw new RangeError(`addUnit: d must be a valid Date (received: ${xe(t)})`);return e==="year"?Ye.addYears(t,r):e==="month"?Ye.addMonths(t,r):Ye.addDays(t,r)},mo=(e,t,r)=>{if(!ot(r))throw new RangeError(`getMacroWindowStartDate: d must be a valid Date (received: ${xe(r)})`);return Ke(t,Ke(e,r))},fo=(e,t,r)=>{if(!ot(r))throw new RangeError(`getMacroWindowEndDate: d must be a valid Date (received: ${xe(r)})`);if(e===t)return Ke(t,r);const n=r.getFullYear(),a=r.getMonth();if(e==="year"){if(t==="month")return new Date(n,11,1);if(t==="day")return new Date(n,11,31)}return e==="month"&&t==="day"?new Date(n,a+1,0):Ke(t,r)},Jn=(e,t,r)=>e<t?t:e>r?r:e,ht=(e,t,r,n,a)=>{if(Dr("macroRange",r,"resolveMacroWindow"),!ot(n))throw new RangeError(`resolveMacroWindow: minDate must be a valid Date (received: ${xe(n)})`);if(!ot(a))throw new RangeError(`resolveMacroWindow: maxDate must be a valid Date (received: ${xe(a)})`);if(a.getTime()<n.getTime())throw new RangeError(`resolveMacroWindow: maxDate must not precede minDate (minDate: ${xe(n)}, maxDate: ${xe(a)})`);return[Ke(t,Jn(mo(e,t,r[0]),n,a)),Ke(t,Jn(fo(e,t,r[1]),n,a))]},sa={year:{year:"numeric"},month:{year:"numeric",month:"2-digit"},day:{year:"numeric",month:"2-digit",day:"2-digit"}},Qn=new Map,ca=(e,t)=>{const r=`${e}\0${t}`,n=Qn.get(r);if(n!==void 0)return n;const a=new Intl.DateTimeFormat(t,sa[e]);return Qn.set(r,a),a},ua=(e,t)=>{const r=String(t.getFullYear()).padStart(4,"0");if(e==="year")return r;const n=String(t.getMonth()+1).padStart(2,"0");if(e==="month")return`${r}-${n}`;const a=String(t.getDate()).padStart(2,"0");return`${r}-${n}-${a}`},qe=(e,t,r,n)=>ot(t)?r?r(t):n===void 0?ua(e,t):ca(e,n).format(t):"",Yt=(e,t,r,n)=>qe(e,t,r,n),be=(e,t,r)=>{if(!e||e.length===0||e.length===1)return 0;const n=de(r,t);let a=0,c=e.length-1;if(n<=de(r,e[a]))return 0;if(n>=de(r,e[c]))return c;for(;a<=c;){const w=a+c>>1,f=de(r,e[w]);if(f===n)return w;f<n?a=w+1:c=w-1}const l=Math.abs(de(r,e[a])-n),u=Math.abs(de(r,e[c])-n);return l<u?a:c},vt=(e,t,r,n)=>{if(!Array.isArray(e)||e.length===0)return[];const a=de(t,r),c=de(t,n),l=new Map;for(const u of e){const w=Ke(t,u),f=de(t,w);f<a||f>c||l.has(f)||l.set(f,w)}if(l.size===0)throw new RangeError(`getSortedAllowedDates: every allowedDates entry falls outside [minDate, maxDate] (minDate: ${xe(r)}, maxDate: ${xe(n)}, entries: ${e.length})`);return Array.from(l.keys()).sort((u,w)=>u-w).map(u=>l.get(u))},Er=(e,t,r,n)=>{const a=e.length-1;if(a<=0)return 0;const c=be(e,n,t);if(r==="time"){const l=e[0].getTime(),u=e[a].getTime()-l;return u<=0?0:Math.max(0,Math.min(1,(e[c].getTime()-l)/u))}return c/a},Nr=(e,t,r,n)=>{const a=e.length-1;if(a<=0)return 0;const c=Math.max(0,Math.min(1,n));if(r==="time"){const l=e[0].getTime(),u=e[a].getTime()-l;return u<=0?0:be(e,new Date(l+c*u),t)}return Math.max(0,Math.min(a,Math.round(c*a)))},hn=(e,t,r,n,a,c,l)=>{let u=r,w=n;return l?(u=t,w=t):e==="low"?t>n?(u=n,w=t):u=t:t<r?(w=r,u=t):w=t,[Math.max(a,Math.min(c,u)),Math.max(a,Math.min(c,w))]},go=(e,t,r,n,a)=>a?"low":e==="low"?t>n?"high":"low":t<r?"low":"high",ho=({posDiffPct:e,startLowVal:t,startHighVal:r,rangeMin:n,rangeMax:a,isDiscrete:c,sortedAllowedDates:l,snapMode:u,unit:w})=>{if(c){const ee=l.length-1;if(ee<=0)return[0,0];const ne=Math.max(0,Math.min(ee,Math.round(t))),C=Math.max(ne,Math.min(ee,Math.round(r)));if(u==="time"){const V=l[0].getTime(),W=l[ee].getTime(),te=l[ne].getTime(),q=l[C].getTime()-te;let F=te+e*(W-V),p=F+q;F<V&&(F=V,p=V+q),p>W&&(p=W,F=W-q);const D=be(l,new Date(F),w),y=be(l,new Date(p),w);return[D,Math.max(D,y)]}const ce=Math.round(e*ee);let oe=ne+ce,$=C+ce;return oe<0&&($+=-oe,oe=0),$>ee&&(oe-=$-ee,$=ee),[Math.max(0,Math.min(ee,oe)),Math.max(0,Math.min(ee,$))]}const f=ee=>Math.max(n,Math.min(a,ee)),T=a-n;if(T<=0)return[f(t),f(r)];const L=Math.round(e*T);let s=t+L,k=r+L;return s<n&&(k+=n-s,s=n),k>a&&(s-=k-a,k=a),[f(s),f(k)]},bo=(e,t,r,n,a,c,l,u)=>{let w=0,f=!1,T=!1;switch(e){case"ArrowRight":case"ArrowUp":w=u;break;case"ArrowLeft":case"ArrowDown":w=-u;break;case"PageUp":w=u*5;break;case"PageDown":w=-u*5;break;case"Home":f=!0;break;case"End":T=!0;break;default:return null}if(l){let k=r;return f?k=a:T?k=c:k=Math.max(a,Math.min(c,r+w)),[k,k]}let L=r,s=n;return t==="low"?f?L=a:T?L=n:L=Math.max(a,Math.min(n,r+w)):f?s=r:T?s=c:s=Math.max(r,Math.min(c,n+w)),[L,s]},wo=8,Mo=2,xo=16,da=12,ma=90,wn=(e,t)=>{const r=t?.estimatedHeightPx??xo,a=wo+(t?.anchorGapY??Mo)+r/2,c=e==="top"?-a:a;return{lowAngleDeg:0,highAngleDeg:0,lowOffsetX:0,highOffsetX:0,lowOffsetY:c,highOffsetY:c,isSlanted:!1,proximity:0}},Mn=(e,t,r,n="top",a)=>{const c=a?.estimatedWidthPx,l=a?.estimatedHeightPx??xo,u=a?.paddingPx??da,w=a?.maxAngleDeg??ma,f=wo+(a?.anchorGapY??Mo),T=wn(n,a);if(!(Number.isFinite(r)&&r>0)||c===void 0||!Number.isFinite(c)||c<=0)return T;const L=Math.max(0,t-e)/100*r,s=c+u;if(L>=s)return T;const k=Math.max(0,Math.min(1,(s-L)/s)),ne=k*k*k*(k*(k*6-15)+10)*w,C=n==="top"?-ne:ne,ce=ne*Math.PI/180,oe=c/2*Math.abs(Math.sin(ce))+l/2*Math.abs(Math.cos(ce)),$=f+oe,V=n==="top"?-$:+$,W=c*Math.abs(Math.cos(ce))+l*Math.abs(Math.sin(ce)),te=Math.max(0,(W+u-L)/2);return{lowAngleDeg:C,highAngleDeg:C,lowOffsetX:-te,highOffsetX:te,lowOffsetY:V,highOffsetY:V,isSlanted:k>.001,proximity:k}},Do=e=>({...e,lowOffsetX:0,highOffsetX:0}),xn=(e,t)=>{const r=t==="macro-top"||t==="macro-left",n=e<=0;return r&&n||!(r||n)?"macro":"micro"},vo=(e,t,r)=>{const n=Math.abs(e)>Math.abs(t)?e:t;return!Number.isFinite(n)||n===0?0:(r?n<0:n>0)?1:-1};function po(e,t,r,n,a,c,l="macro-top",u=.05,w=!0,f="range"){if(xn(t,l)==="macro"){const s=Math.abs(e-r),k=Math.abs(e-n);return s<=u&&s<=k?"macro-low":k<=u&&k<s?"macro-high":w&&e>=r&&e<=n?"macro-connect":s<k?"macro-low":"macro-high"}if(f==="point")return"micro-point";const T=Math.abs(e-a),L=Math.abs(e-c);return T<=u&&T<=L?"micro-low":L<=u&&L<T?"micro-high":w&&e>=a&&e<=c?"micro-connect":T<L?"micro-low":"micro-high"}function yo(e,t,r,n,a){if(e==="macro-connect"){const l=t-r,u=a-n,w=Math.max(0,Math.min(1-u,n+l)),f=w+u;return[w,f,"macro-connect"]}if(e==="macro-low"){const l=Math.max(0,Math.min(1,t));return l>a?[a,l,"macro-high"]:[l,a,"macro-low"]}const c=Math.max(0,Math.min(1,t));return c<n?[c,n,"macro-low"]:[n,c,"macro-high"]}function Ro(e,t,r,n,a){if(e==="micro-point"){const l=Math.max(0,Math.min(1,t));return[l,l,"micro-point"]}if(e==="micro-connect"){const l=t-r,u=a-n,w=Math.max(0,Math.min(1-u,n+l)),f=w+u;return[w,f,"micro-connect"]}if(e==="micro-low"){const l=Math.max(0,Math.min(1,t));return l>a?[a,l,"micro-high"]:[l,a,"micro-low"]}const c=Math.max(0,Math.min(1,t));return c<n?[c,n,"micro-low"]:[n,c,"micro-high"]}const Mr=o.memo(({type:e,isTop:t=!0,isVertical:r=!1,isLeft:n=!0})=>{let a,c;r?(a=n?"M 7.375 0.625 A 7.375 7.375 0 0 0 7.375 15.375 Z":"M 0.625 0.625 A 7.375 7.375 0 0 1 0.625 15.375 Z",c=`period-slider-knob period-slider-knob-svg is-vertical ${n?"is-semicircle-left":"is-semicircle-right"}`):(a=t?"M 0.625 7.375 A 7.375 7.375 0 0 1 15.375 7.375 Z":"M 0.625 0.625 A 7.375 7.375 0 0 0 15.375 0.625 Z",c=`period-slider-knob period-slider-knob-svg ${t?"is-semicircle-top":"is-semicircle-bottom"}`);const l=e==="macro"?"period-slider-knob-path-macro":"period-slider-knob-path-micro";return h.jsx("svg",{className:c,width:r?"8":"16",height:r?"16":"8",viewBox:r?"0 0 8 16":"0 0 16 8",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:h.jsx("path",{d:a,className:l,shapeRendering:"geometricPrecision",strokeWidth:"1.25"})})});Mr.displayName="VernierKnobSvg";const fa=(e,t)=>{if(!ot(e))throw new RangeError(`PeriodSlider: minDate is required and must be a valid Date (received: ${xe(e)})`);if(!ot(t))throw new RangeError(`PeriodSlider: maxDate is required and must be a valid Date (received: ${xe(t)})`);if(t.getTime()<=e.getTime())throw new RangeError(`PeriodSlider: maxDate must be strictly later than minDate (minDate: ${xe(e)}, maxDate: ${xe(t)})`)},Dr=(e,t,r="PeriodSlider")=>{if(!Array.isArray(t)||t.length!==2)throw new RangeError(`${r}: ${e} is required and must be a [start, end] Date tuple (received: ${xe(t)})`);const[n,a]=t;if(!ot(n))throw new RangeError(`${r}: ${e}[0] must be a valid Date (received: ${xe(n)})`);if(!ot(a))throw new RangeError(`${r}: ${e}[1] must be a valid Date (received: ${xe(a)})`);if(a.getTime()<n.getTime())throw new RangeError(`${r}: ${e} must not be inverted (start: ${xe(n)}, end: ${xe(a)})`)},bn=(e,t)=>{if(!ot(t))throw new RangeError(`PeriodSlider: ${e} must be a valid Date (received: ${xe(t)})`)},Dt=(e,t,r,n)=>{if(t.getTime()<r.getTime()||t.getTime()>n.getTime())throw new RangeError(`PeriodSlider: ${e} must lie within [minDate, maxDate] (received: ${xe(t)}, minDate: ${xe(r)}, maxDate: ${xe(n)})`)},ga=(e,t,r)=>{if(e.mode==="range"){for(const n of["range","defaultRange"]){const a=e[n];a!==void 0&&(Dr(n,a),Dt(`${n}[0]`,a[0],t,r),Dt(`${n}[1]`,a[1],t,r))}return}if(e.mode==="point")for(const n of["value","defaultValue"]){const a=e[n];a!==void 0&&(bn(n,a),Dt(n,a,t,r))}},ha=(e,t,r)=>{Dr("macroRange",e.macroRange);const n=e.microRange!==void 0||e.defaultMicroRange!==void 0||e.onChangeMicroRange!==void 0,a=e.microValue!==void 0||e.defaultMicroValue!==void 0||e.onChangeMicroPoint!==void 0;if(n&&a)throw new RangeError("PeriodSlider: vernier mode takes either a micro range (microRange / defaultMicroRange / onChangeMicroRange) or a micro point (microValue / defaultMicroValue / onChangeMicroPoint), never both");if(a){if(e.microValue!==void 0)return bn("microValue",e.microValue),Dt("microValue",e.microValue,t,r),{shape:"point",selection:[e.microValue,e.microValue]};if(e.defaultMicroValue!==void 0)return bn("defaultMicroValue",e.defaultMicroValue),Dt("defaultMicroValue",e.defaultMicroValue,t,r),{shape:"point",selection:[e.defaultMicroValue,e.defaultMicroValue]};throw new RangeError("PeriodSlider: vernier point mode requires a micro selection; supply microValue (controlled) or defaultMicroValue (uncontrolled)")}if(e.microRange!==void 0)return Dr("microRange",e.microRange),Dt("microRange[0]",e.microRange[0],t,r),Dt("microRange[1]",e.microRange[1],t,r),{shape:"range",selection:e.microRange};if(e.defaultMicroRange!==void 0)return Dr("defaultMicroRange",e.defaultMicroRange),Dt("defaultMicroRange[0]",e.defaultMicroRange[0],t,r),Dt("defaultMicroRange[1]",e.defaultMicroRange[1],t,r),{shape:"range",selection:e.defaultMicroRange};throw n?new RangeError("PeriodSlider: vernier range mode requires a micro selection; supply microRange (controlled) or defaultMicroRange (uncontrolled)"):new RangeError("PeriodSlider: vernier mode requires a micro selection; supply microRange / defaultMicroRange for a period, or microValue / defaultMicroValue for a point")},br=(e,t,r,n,a,c,l,u)=>{const w=be(e,n,t),f=be(e,a,t);return l?w:u?f:Math.max(w,Math.min(f,be(e,r,t)+c))},dn=e=>{e.timerId!==null&&clearTimeout(e.timerId),e.timerId=null,e.emit=null},ba=(e,t)=>{try{Intl.DateTimeFormat.supportedLocalesOf([t])}catch{throw new RangeError(`PeriodSlider: ${e} must be a valid BCP 47 language tag (received: ${JSON.stringify(t)})`)}},er=()=>{const[e,t]=o.useState(null),r=o.useRef(null),n=o.useCallback(a=>{if(r.current?.disconnect(),r.current=null,a===null){t(null);return}if(typeof ResizeObserver>"u")return;const c=new ResizeObserver(l=>{for(const u of l){const w=u.borderBoxSize?.[0];w!==void 0&&t(f=>f!==null&&Math.abs(f.widthPx-w.inlineSize)<.5&&Math.abs(f.heightPx-w.blockSize)<.5?f:{widthPx:w.inlineSize,heightPx:w.blockSize})}});c.observe(a),r.current=c},[]);return o.useEffect(()=>()=>{r.current?.disconnect(),r.current=null},[]),[n,e]},mn=(e,t)=>{if(!(e===null||t===null))return{estimatedWidthPx:Math.max(e.widthPx,t.widthPx),estimatedHeightPx:Math.max(e.heightPx,t.heightPx)}},eo=(e,t,r)=>({"--ps-tooltip-tx":`calc(-50% + ${e}px)`,"--ps-tooltip-ty":`${t}px`,"--ps-tooltip-rot":`${r}deg`}),to=(e,t,r,n,a,c,l)=>{const u=wn(n,a);if(!l)return{slant:u,lowStyle:void 0,highStyle:void 0};const w=Mn(e*100,t*100,r,n,a),f=c?Do(w):w;return{slant:f,lowStyle:eo(f.lowOffsetX,f.lowOffsetY-u.lowOffsetY,f.lowAngleDeg),highStyle:eo(f.highOffsetX,f.highOffsetY-u.highOffsetY,f.highAngleDeg)}},wa={horizontal:{decrease:"◀",increase:"▶"},vertical:{decrease:"▼",increase:"▲"}},Ma={horizontal:{decrease:"period-slider-stepper-prev",increase:"period-slider-stepper-next"},vertical:{decrease:"period-slider-stepper-prev period-slider-stepper-down",increase:"period-slider-stepper-next period-slider-stepper-up"}},xa=e=>{const{unit:t,minDate:r,maxDate:n,allowedDates:a,snapMode:c="index",disabled:l=!1,className:u="",showStepper:w=!0,tooltipStyle:f="always",labelPosition:T="top",autoSlantLabels:L=!0,isVertical:s=!1,hideConnectBar:k=!1,showTicks:ee=!1,colorScheme:ne="blue-rose",locale:C,decreaseAriaLabel:ce="Decrease",increaseAriaLabel:oe="Increase"}=e;fa(r,n),ga(e,r,n),C!==void 0&&ba("locale",C);const $=e.mode==="vernier"?ha(e,r,n):null,V=$!==null&&$.shape==="point",W=uo[ne],te=o.useId(),q=o.useRef(e);q.current=e;const F=r.getTime(),p=n.getTime(),D=o.useMemo(()=>vt(a,t,r,n),[a,t,F,p]),y=D.length>0,{rangeMin:E,rangeMax:P}=o.useMemo(()=>y?{rangeMin:0,rangeMax:D.length-1}:{rangeMin:de(t,r),rangeMax:de(t,n)},[y,D,t,F,p]),G=e.mode==="point",me=o.useCallback(i=>{if(y){const d=Math.max(0,Math.min(D.length-1,Math.round(i)));return D[d]}return ae(t,Math.round(i))},[y,D,t]),B=o.useCallback(i=>{if(i===void 0)return E;const d=Ke(t,i);return y?be(D,d,t):de(t,d)},[y,D,t,E]),[Z,se]=o.useState(()=>$===null?null:$.selection);let _=Z??($===null?null:$.selection);if(V&&_!==null&&_[0].getTime()!==_[1].getTime()){const i=[_[0],_[0]];_=i,se(i)}const z=e.mode==="vernier"?e.microValue?.getTime():void 0,re=o.useMemo(()=>e.mode!=="vernier"||e.microValue===void 0?null:[e.microValue,e.microValue],[e.mode,z]),ie=e.mode!=="vernier"?null:V?re??_:e.microRange!==void 0?e.microRange:_,We=e.mode==="range"?e.range?.[0]??e.defaultRange?.[0]:e.mode==="vernier"?ie?.[0]:void 0,Se=e.mode==="range"?e.range?.[1]??e.defaultRange?.[1]:e.mode==="vernier"?ie?.[1]:void 0,Le=e.mode==="point"?e.value??e.defaultValue:void 0,ye=e.mode==="point"?Le?.getTime():We?.getTime(),Ge=e.mode==="range"?Se?.getTime():ye,[Ze,at]=o.useMemo(()=>{if(e.mode==="point"){const m=B(Le);return[m,m]}const i=B(We),d=B(Se);return[Math.min(i,d),Math.max(i,d)]},[e.mode,ye,Ge,B,Le,We,Se]),Ve=e.mode==="point"?e.value!==void 0:e.mode==="range"?e.range!==void 0:V?e.microValue!==void 0:e.microRange!==void 0,[st,X]=o.useState(()=>[Ze,at]),[Q,ge]=o.useState(null),[b,S]=o.useState(null),j=o.useRef(null);j.current=b;const[Me,A]=o.useState("high"),[K,Ce]=o.useState(null),[Ne,He]=o.useState(null),fe=Q?Q[0]:Ve?Ze:st[0],we=Q?Q[1]:Ve?at:st[1],or=o.useRef([fe,we]);or.current=[fe,we];const he=e.mode==="vernier",kt=e.mode==="vernier"?e.vernierOrientation??(s?"macro-left":"macro-top"):"macro-top",I=kt==="macro-top"||kt==="macro-left",zr=e.mode==="vernier"?e.showVernierProjection??!0:!1,_r=e.mode==="vernier"?e.showVernierTicks??!0:!1,bt=e.mode==="vernier"?e.showHairline??!0:!1,O=he?e.macroUnit??t:t,x=he?e.microUnit??t:t,M=he?e.macroIsDiscrete??!1:y,Y=he?e.microIsDiscrete??!1:y,Be=he?e.macroAllowedDates??a:a,jt=he?e.microAllowedDates??a:a,ct=he?e.formatMacroLabel??e.formatLabel:e.formatLabel,Qe=he?e.formatMicroLabel??e.formatLabel:e.formatLabel,Po=e.mode==="vernier"?e.macroRange[0].getTime():void 0,ko=e.mode==="vernier"?e.macroRange[1].getTime():void 0,Ao=We?.getTime(),Io=Se?.getTime(),[ze,vr]=o.useState(null),pt=o.useRef(null);pt.current=ze;const[ar,Ot]=o.useState(()=>V?"micro-point":"micro-high");let ke=ar;const Xr=V?ar==="micro-low"||ar==="micro-high"||ar==="micro-connect"?"micro-point":null:ar==="micro-point"?"micro-high":null;Xr!==null&&(ke=Xr,Ot(Xr));const Re=o.useMemo(()=>de(O,r),[F,O]),et=o.useMemo(()=>{const i=de(O,n);if(he&&i<=Re)throw new RangeError(`PeriodSlider: macroUnit "${O}" cannot distinguish minDate from maxDate (minDate: ${xe(r)}, maxDate: ${xe(n)})`);return i},[he,F,p,Re,O]),ve=o.useMemo(()=>he?vt(Be,O,r,n):[],[he,Be,O,F,p]),je=o.useMemo(()=>e.mode!=="vernier"?Re:Math.max(Re,Math.min(et,de(O,e.macroRange[0]))),[e.mode,Po,Re,et,O]),Oe=o.useMemo(()=>e.mode!=="vernier"?et:Math.max(Re,Math.min(et,de(O,e.macroRange[1]))),[e.mode,ko,Re,et,O]),wt=o.useMemo(()=>ae(O,je),[O,je]),At=o.useMemo(()=>ae(O,Oe),[O,Oe]),pr=o.useMemo(()=>e.mode!=="vernier"?[r,n]:ht(O,x,[wt,At],r,n),[e.mode,wt,At,O,x,F,p]),De=o.useMemo(()=>de(x,pr[0]),[x,pr]),Te=o.useMemo(()=>de(x,pr[1]),[x,pr]),qr=o.useMemo(()=>he?vt(jt,x,r,n):[],[he,jt,x,F,p]),Kr=(i,d)=>qr.filter(m=>{const g=de(x,m);return g>=i&&g<=d}),le=o.useMemo(()=>Kr(De,Te),[qr,x,De,Te]),It=M&&ve.length>0,tt=Y&&le.length>0,yt=(i,d,m,g)=>d.length>0?de(x,d[be(d,i,x)]):Math.max(m,Math.min(g,de(x,i))),Ft=tt?le:[],$e=o.useMemo(()=>ie===null?De:yt(ie[0],Ft,De,Te),[Ao,De,Te,x,ie,Ft]),Fe=o.useMemo(()=>ie===null?Te:yt(ie[1],Ft,De,Te),[Io,De,Te,x,ie,Ft]),Rt=o.useMemo(()=>ae(x,$e),[x,$e]),Tt=o.useMemo(()=>ae(x,Fe),[x,Fe]),ir=Math.max(1,et-Re),Ae=It?Er(ve,O,c,wt):Math.max(0,Math.min(1,(je-Re)/ir)),_e=Math.max(Ae,It?Er(ve,O,c,At):Math.min(1,(Oe-Re)/ir)),lr=Math.max(1,Te-De),rt=tt?Er(le,x,c,Rt):Math.max(0,Math.min(1,($e-De)/lr)),Mt=Math.max(rt,tt?Er(le,x,c,Tt):Math.min(1,(Fe-De)/lr)),Gr=o.useRef({timerId:null,emit:null}),Zr=o.useRef({timerId:null,emit:null}),Jr=o.useRef({timerId:null,emit:null});o.useEffect(()=>{const i=[Gr,Zr,Jr];return()=>{for(const d of i)dn(d.current)}},[]);const Ut=o.useCallback((i,d,m)=>{dn(i);const{debounceMs:g}=q.current;if(m||!g||g<=0){d();return}i.emit=d,i.timerId=setTimeout(()=>{i.timerId=null,i.emit=null,d()},g)},[]),Qr=o.useCallback(i=>{const d=i.emit;dn(i),d?.()},[]),Wt=o.useCallback(i=>new Date(Math.min(Math.max(i.getTime(),F),p)),[F,p]),ut=o.useCallback((i,d,m=!1)=>{const[g,R]=or.current;if((q.current.mode==="point"?i===g:i===g&&d===R)&&Gr.current.timerId===null)return;const H=me(i),N=me(d),J=()=>{const v=q.current;v.mode==="point"?v.onChangePoint?.(H):v.mode==="range"&&v.onChangeRange?.(H,N)};Ut(Gr.current,J,m)},[me,Ut]),St=o.useCallback((i,d,m=!1)=>{if(q.current.mode!=="vernier")return;const g=Wt(i),R=Wt(d);Ut(Zr.current,()=>{const U=q.current;U.mode==="vernier"&&U.onChangeMacroRange?.(g,R)},m)},[Wt,Ut]),Je=o.useCallback((i,d,m=!1)=>{const g=q.current;if(g.mode!=="vernier")return;const R=Wt(i),U=Wt(d);(V?g.microValue===void 0:g.microRange===void 0)&&se([R,U]),Ut(Jr.current,()=>{const H=q.current;if(H.mode==="vernier"){if(V){H.onChangeMicroPoint?.(R);return}H.onChangeMicroRange?.(R,U)}},m)},[Wt,Ut,V]),Dn=o.useCallback((i,d=!1)=>{Je(i,i,d)},[Je]),yr=o.useCallback(i=>{if(y&&c==="time"&&D.length>1){const g=Math.max(0,Math.min(D.length-1,Math.round(i))),R=D[0].getTime(),H=D[D.length-1].getTime()-R;if(H<=0)return 0;const N=D[g].getTime();return Math.max(0,Math.min(100,(N-R)/H*100))}const d=P-E;if(d<=0)return 0;const m=(i-E)/d*100;return Math.max(0,Math.min(100,m))},[y,c,D,E,P]),Rr=o.useCallback(i=>{const d=Math.max(0,Math.min(100,i));if(y){if(c==="time"&&D.length>1){const R=D[0].getTime(),H=D[D.length-1].getTime()-R,N=R+d/100*H;return be(D,new Date(N),t)}const g=Math.round(d/100*(D.length-1));return Math.max(0,Math.min(D.length-1,g))}const m=E+d/100*(P-E);return Math.round(m)},[y,c,D,E,P,t]),it=o.useRef(null),[Bt,vn]=o.useState(0),[Eo,sr]=er(),[No,pn]=er(),[Yo,yn]=er(),[Vo,Rn]=er(),[Ho,Tn]=er(),[jo,Sn]=er();o.useEffect(()=>{const i=it.current;if(!i)return;const d=()=>{const m=i.getBoundingClientRect(),g=s?m.height:m.width;g>0&&vn(R=>Math.abs(R-g)<.5?R:g)};if(d(),typeof ResizeObserver<"u"){const m=new ResizeObserver(g=>{for(const R of g){const U=s?R.contentRect.height:R.contentRect.width;U>0&&vn(H=>Math.abs(H-U)<.5?H:U)}});return m.observe(i),()=>m.disconnect()}return window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)},[s]);const Et=o.useCallback((i,d,m)=>{const g=s?m.height:m.width;if(!(Number.isFinite(g)&&g>0))return null;const R=s?m.bottom-d:i-m.left;return Number.isFinite(R)?Math.max(0,Math.min(1,R/g)):null},[s]),Ln=o.useCallback((i,d)=>{const m=it.current;if(!m)return null;const g=Et(i,d,m.getBoundingClientRect());return g===null?null:g*100},[Et]),Tr=o.useRef(null),en=o.useRef(null),dt=o.useRef(null),tn=o.useRef(null),cr=o.useRef(null),Cn=o.useCallback(i=>{if(l)return;if(he){const v=en.current;if(!v||i.pointerId!==0&&i.pointerId!==v.pointerId||!it.current)return;const ue=Et(i.clientX,i.clientY,it.current.getBoundingClientRect());if(ue===null)return;if(v.handle==="macro-low"||v.handle==="macro-high"||v.handle==="macro-connect"){const[Ie,lt,Pe]=yo(v.handle,ue,v.startPointerRatio,v.startMacroLowRatio,v.startMacroHighRatio);Pe!==pt.current&&(pt.current=Pe,vr(Pe),Ot(Pe));let pe,ft;if(It){const Ct=Nr(ve,O,c,Ie),$t=Math.max(Ct,Nr(ve,O,c,lt));pe=ve[Ct],ft=ve[$t]}else{const Ct=Math.round(Re+Ie*ir),$t=Math.round(Re+lt*ir);pe=ae(O,Ct),ft=ae(O,$t)}const mr=`${pe.getTime()}_${ft.getTime()}`;mr!==tn.current&&(tn.current=mr,St(pe,ft));const[xt,Nt]=ht(O,x,[pe,ft],r,n),cn=de(x,xt),un=de(x,Nt),qn=Y?Kr(cn,un):[];let Kt,Gt;if(v.handle==="macro-connect"){const Ct=xt,$t=Nt;let Zt,Jt;if(O==="year"){const Pt=pe.getFullYear()-v.startMacroLowDate.getFullYear();Zt=Ee("year",v.initialMicroLowDate,Pt),Jt=Ee("year",v.initialMicroHighDate,Pt)}else if(O==="month"){const Pt=(pe.getFullYear()-v.startMacroLowDate.getFullYear())*12+(pe.getMonth()-v.startMacroLowDate.getMonth());Zt=Ee("month",v.initialMicroLowDate,Pt),Jt=Ee("month",v.initialMicroHighDate,Pt)}else{const Pt=Math.round((pe.getTime()-v.startMacroLowDate.getTime())/864e5);Zt=Ee("day",v.initialMicroLowDate,Pt),Jt=Ee("day",v.initialMicroHighDate,Pt)}const Qt=Ct.getTime(),fr=$t.getTime(),Zn=v.initialMicroHighDate.getTime()-v.initialMicroLowDate.getTime();let gr=Zt.getTime(),hr=Jt.getTime();gr<Qt&&(gr=Qt,hr=Math.min(fr,gr+Zn)),hr>fr&&(hr=fr,gr=Math.max(Qt,hr-Zn)),Kt=Ke(x,new Date(gr)),Gt=Ke(x,new Date(hr))}else{const Ct=xt.getTime(),$t=Nt.getTime(),Zt=v.initialMicroLowDate.getTime(),Jt=v.initialMicroHighDate.getTime(),Qt=Math.max(Ct,Math.min($t,Zt)),fr=Math.max(Qt,Math.min($t,Jt));Kt=Ke(x,new Date(Qt)),Gt=Ke(x,new Date(fr))}const Kn=yt(Kt,qn,cn,un),la=Math.max(Kn,yt(Gt,qn,cn,un));Kt=ae(x,Kn),Gt=ae(x,la);const Gn=`${Kt.getTime()}_${Gt.getTime()}`;Gn!==cr.current&&(cr.current=Gn,Je(Kt,Gt))}else if(v.handle==="micro-low"||v.handle==="micro-high"||v.handle==="micro-connect"||v.handle==="micro-point"){const[Ie,lt,Pe]=Ro(v.handle,ue,v.startPointerRatio,v.startMicroLowRatio,v.startMicroHighRatio);Pe!==pt.current&&(pt.current=Pe,vr(Pe),Ot(Pe));let pe,ft;if(tt){const xt=Nr(le,x,c,Ie),Nt=Math.max(xt,Nr(le,x,c,lt));pe=le[xt],ft=le[Nt]}else{const xt=yt(ae(x,Math.round(De+Ie*lr)),Ft,De,Te),Nt=Math.max(xt,yt(ae(x,Math.round(De+lt*lr)),Ft,De,Te));pe=ae(x,xt),ft=ae(x,Nt)}const mr=`${pe.getTime()}_${ft.getTime()}`;mr!==cr.current&&(cr.current=mr,Je(pe,ft))}return}const d=Tr.current;if(!d||i.pointerId!==0&&i.pointerId!==d.pointerId||!it.current)return;const m=it.current.getBoundingClientRect(),g=s?i.clientY:i.clientX,R=s?m.height:m.width;if(!(Number.isFinite(R)&&R>0))return;if(d.handle==="connect"){const v=s?(d.startPointerPos-g)/R:(g-d.startPointerPos)/R,ue=ho({posDiffPct:v,startLowVal:d.startLowVal,startHighVal:d.startHighVal,rangeMin:E,rangeMax:P,isDiscrete:y,sortedAllowedDates:D,snapMode:c,unit:t});if(dt.current&&dt.current[0]===ue[0]&&dt.current[1]===ue[1])return;dt.current=ue,ge(ue),ut(ue[0],ue[1],!1);return}const U=Et(i.clientX,i.clientY,m);if(U===null)return;const H=Rr(U*100),[N,J]=hn(d.handle,H,d.startLowVal,d.startHighVal,E,P,G);if((!dt.current||dt.current[0]!==N||dt.current[1]!==J)&&(dt.current=[N,J],ge([N,J]),ut(N,J,!1)),!G&&(d.handle==="low"||d.handle==="high")){const v=go(d.handle,H,d.startLowVal,d.startHighVal,G);j.current!==v&&(j.current=v,S(v),A(v))}},[l,he,s,O,x,It,tt,Y,F,p,ve,le,qr,Re,ir,De,lr,E,P,y,D,c,t,Et,Rr,ut,St,Je,G]),$n=o.useCallback(i=>{if(he){tn.current=null,cr.current=null,en.current=null,pt.current=null,vr(null),Qr(Zr.current),Qr(Jr.current);return}const d=Tr.current;if(!d||i.pointerId!==0&&i.pointerId!==d.pointerId)return;const m=dt.current??Q;m&&(ut(m[0],m[1],!0),X(m)),dt.current=null,ge(null),Tr.current=null,j.current=null,S(null)},[he,Q,ut,Qr]),Pn=o.useRef(Cn);Pn.current=Cn;const kn=o.useRef($n);kn.current=$n;const An=b!==null||ze!==null;o.useEffect(()=>{if(!An)return;const i=m=>Pn.current(m),d=m=>kn.current(m);return window.addEventListener("pointermove",i),window.addEventListener("pointerup",d),window.addEventListener("pointercancel",d),()=>{window.removeEventListener("pointermove",i),window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",d)}},[An]);const rn=o.useCallback((i,d,m)=>{Tr.current={pointerId:i,handle:d,startPointerPos:m,startLowVal:fe,startHighVal:we},j.current=d,S(d),d!=="connect"&&A(d)},[fe,we]),In=o.useCallback((i,d,m)=>{q.current.mode==="vernier"&&(en.current={pointerId:i,handle:d,startPointerRatio:m,startMacroLowRatio:Ae,startMacroHighRatio:_e,startMicroLowRatio:rt,startMicroHighRatio:Mt,startMacroLowDate:wt,initialMicroLowDate:Rt,initialMicroHighDate:Tt},pt.current=d,vr(d),Ot(d))},[Ae,_e,rt,Mt,wt,Rt,Tt]),En=i=>d=>{if(l)return;d.stopPropagation(),d.preventDefault(),A(i);const m=s?d.clientY:d.clientX;rn(d.pointerId,i,m)},Nn=i=>()=>{l||j.current!==null||A(i)},Sr=i=>()=>{l||pt.current!==null||Ot(i)},zt=i=>d=>{if(l)return;d.stopPropagation(),d.preventDefault();const m=it.current;if(!m)return;const g=Et(d.clientX,d.clientY,m.getBoundingClientRect());g!==null&&In(d.pointerId,i,g)},Oo=i=>{if(l||k)return;i.stopPropagation(),i.preventDefault();const d=s?i.clientY:i.clientX;rn(i.pointerId,"connect",d)},Fo=i=>{if(l)return;if(he){const N=it.current;if(!N)return;const J=N.getBoundingClientRect(),v=Et(i.clientX,i.clientY,J);if(v===null)return;const ue=s?i.clientX-(J.left+J.width/2):i.clientY-(J.top+J.height/2),Ie=po(v,ue,Ae,_e,rt,Mt,kt,void 0,!k,V?"point":"range");In(i.pointerId,Ie,v);return}const d=Ln(i.clientX,i.clientY);if(d===null)return;const m=Rr(d);let g="low";if(!G){const N=Math.abs(m-fe),J=Math.abs(m-we);N<J?g="low":J<N?g="high":g=m>we?"high":"low"}A(g);const[R,U]=hn(g,m,fe,we,E,P,G);ge([R,U]),ut(R,U,!0);const H=s?i.clientY:i.clientX;rn(i.pointerId,g,H)},Uo=i=>{if(l||b!==null)return;const d=Ln(i.clientX,i.clientY);if(d===null)return;const m=Rr(d);Ce(m),He(yr(m))},Wo=()=>{Ce(null),He(null)},Yn=i=>d=>{if(l)return;A(i);const m=bo(d.key,i,fe,we,E,P,G,1);m&&(d.preventDefault(),Ve||X(m),ut(m[0],m[1],!0))},_t=(i,d)=>{if(ie===null)return;const[m,g]=ht(O,x,[i,d],r,n),R=de(x,m),U=de(x,g),H=Y?Kr(R,U):[],N=de(x,ie[0]),J=de(x,ie[1]),v=yt(ie[0],H,R,U),ue=Math.max(v,yt(ie[1],H,R,U));v===N&&ue===J||Je(ae(x,v),ae(x,ue),!0)},Lr=i=>d=>{if(l||!he||e.mode!=="vernier")return;Ot(i);let m=0,g=!1,R=!1;switch(d.key){case"ArrowRight":case"ArrowUp":m=1;break;case"ArrowLeft":case"ArrowDown":m=-1;break;case"PageUp":m=5;break;case"PageDown":m=-5;break;case"Home":g=!0;break;case"End":R=!0;break;default:return}if(d.preventDefault(),i==="macro-low"){const U=ae(O,je),H=ae(O,Oe);if(It){const v=br(ve,O,U,ve[0],H,m,g,R);if(v===be(ve,U,O))return;const ue=ve[v];St(ue,H,!0),_t(ue,H);return}let N;if(g?N=Re:R?N=Oe:N=Math.max(Re,Math.min(Oe,je+m)),N===je)return;const J=ae(O,N);St(J,H,!0),_t(J,H)}else if(i==="macro-high"){const U=ae(O,je),H=ae(O,Oe);if(It){const v=br(ve,O,H,U,ve[ve.length-1],m,g,R);if(v===be(ve,H,O))return;const ue=ve[v];St(U,ue,!0),_t(U,ue);return}let N;if(g?N=je:R?N=et:N=Math.max(je,Math.min(et,Oe+m)),N===Oe)return;const J=ae(O,N);St(U,J,!0),_t(U,J)}else if(i==="micro-low"){const U=ae(x,$e),H=ae(x,Fe);if(tt){const J=br(le,x,U,le[0],H,m,g,R);if(J===be(le,U,x))return;Je(le[J],H,!0);return}let N;if(g?N=De:R?N=Fe:N=Math.max(De,Math.min(Fe,$e+m)),N===$e)return;Je(ae(x,N),H,!0)}else if(i==="micro-high"){const U=ae(x,$e),H=ae(x,Fe);if(tt){const J=br(le,x,H,U,le[le.length-1],m,g,R);if(J===be(le,H,x))return;Je(U,le[J],!0);return}let N;if(g?N=$e:R?N=Te:N=Math.max($e,Math.min(Te,Fe+m)),N===Fe)return;Je(U,ae(x,N),!0)}else if(i==="micro-point"){const U=ae(x,$e);if(tt){const N=br(le,x,U,le[0],le[le.length-1],m,g,R);if(N===be(le,U,x))return;Dn(le[N],!0);return}let H;if(g?H=De:R?H=Te:H=Math.max(De,Math.min(Te,$e+m)),H===$e)return;Dn(ae(x,H),!0)}},Bo=i=>{if(e.mode!=="vernier")return;if(It){const H=ve.length-1,N=be(ve,wt,O),J=be(ve,At,O),v=J-N;let ue=N+i,Ie=J+i;if(i<0&&ue<0?(ue=0,Ie=Math.min(H,v)):i>0&&Ie>H&&(Ie=H,ue=Math.max(0,H-v)),ue===N&&Ie===J)return;const lt=ve[ue],Pe=ve[Ie];St(lt,Pe,!0),_t(lt,Pe);return}const d=Oe-je;let m=je+i,g=Oe+i;if(i<0&&m<Re?(m=Re,g=Math.min(et,m+d)):i>0&&g>et&&(g=et,m=Math.max(Re,g-d)),m===je&&g===Oe)return;const R=ae(O,m),U=ae(O,g);St(R,U,!0),_t(R,U)},nn=o.useCallback(i=>{const d=q.current;if(!d.disabled)if(d.mode==="point"){const m=Math.max(E,Math.min(P,fe+i));Ve||X([m,m]),ut(m,m,!0)}else if(d.mode==="vernier"){if(tt){const v=le.length-1,ue=be(le,Rt,x),Ie=be(le,Tt,x),lt=Ie-ue;let Pe=ue+i,pe=Ie+i;i<0&&Pe<0?(Pe=0,pe=Math.min(v,lt)):i>0&&pe>v&&(pe=v,Pe=Math.max(0,v-lt)),(Pe!==ue||pe!==Ie)&&Je(le[Pe],le[pe],!0);return}const m=$e,g=Fe,R=De,U=Te,H=g-m;let N=m+i,J=g+i;i<0&&N<R?(N=R,J=Math.min(U,N+H)):i>0&&J>U&&(J=U,N=Math.max(R,J-H)),(N!==m||J!==g)&&Je(ae(x,N),ae(x,J),!0)}else{const m=we-fe;let g=fe+i,R=we+i;i<0&&g<E?(g=E,R=Math.min(P,g+m)):i>0&&R>P&&(R=P,g=Math.max(E,R-m)),g<=R&&(Ve||X([g,R]),ut(g,R,!0))}},[fe,we,E,P,Ve,ut,Je,$e,Fe,De,Te,x,tt,le,Rt,Tt]),Vn=i=>{if(l||!i.shiftKey)return;const d=vo(i.deltaX,i.deltaY,s);if(d===0)return;if(i.preventDefault(),!he){nn(d);return}const m=it.current;if(!m)return;const g=m.getBoundingClientRect(),R=s?i.clientX-(g.left+g.width/2):i.clientY-(g.top+g.height/2);if(xn(R,kt)==="macro"){Bo(d);return}nn(d)},Hn=o.useRef(Vn);Hn.current=Vn,o.useEffect(()=>{const i=it.current;if(!i)return;const d=m=>Hn.current(m);return i.addEventListener("wheel",d,{passive:!1}),()=>i.removeEventListener("wheel",d)},[]);const Xt=yr(fe),qt=yr(we),on=me(fe),an=me(we),ln=o.useMemo(()=>G?sr===null?void 0:{estimatedWidthPx:sr.widthPx,estimatedHeightPx:sr.heightPx}:mn(sr,pn),[G,sr,pn]),Cr=!G&&fe===we,Xe=o.useMemo(()=>{if(G||!L||s)return wn(T,ln);const i=Mn(Xt,qt,Bt,T,ln);return Cr?Do(i):i},[G,Cr,L,s,Xt,qt,Bt,T,ln]),ur=b==="low"||b!=="high"&&Me==="low",dr=!G&&(b==="high"||b!=="low"&&Me==="high"),$r=je===Oe,Pr=!V&&$e===Fe,zo=$r&&ke!=="macro-low",_o=$r&&ke==="macro-low",Xo=Pr&&ke!=="micro-low",qo=Pr&&ke==="micro-low",jn=I?"top":"bottom",On=I?"bottom":"top",Fn=o.useMemo(()=>mn(yn,Rn),[yn,Rn]),Un=o.useMemo(()=>mn(Tn,Sn),[Tn,Sn]),sn=L&&!s,kr=o.useMemo(()=>to(Ae,_e,Bt,jn,Fn,$r,sn),[Ae,_e,Bt,jn,Fn,$r,sn]),Wn=sn&&!V,Ar=o.useMemo(()=>to(rt,Mt,Bt,On,Un,Pr,Wn),[rt,Mt,Bt,On,Un,Pr,Wn]),Ko=o.useMemo(()=>s?{"--ps-tooltip-origin":"100% 50%","--ps-tooltip-tx":"0px","--ps-tooltip-ty":"-50%","--ps-tooltip-rot":"0deg"}:{"--ps-tooltip-origin":"50% 50%","--ps-tooltip-tx":`calc(-50% + ${Xe.lowOffsetX}px)`,"--ps-tooltip-ty":`calc(-50% + ${Xe.lowOffsetY}px)`,"--ps-tooltip-rot":`${Xe.lowAngleDeg}deg`},[s,Xe.lowOffsetX,Xe.lowOffsetY,Xe.lowAngleDeg]),Go=o.useMemo(()=>s?{"--ps-tooltip-origin":"100% 50%","--ps-tooltip-tx":"0px","--ps-tooltip-ty":"-50%","--ps-tooltip-rot":"0deg"}:{"--ps-tooltip-origin":"50% 50%","--ps-tooltip-tx":`calc(-50% + ${Xe.highOffsetX}px)`,"--ps-tooltip-ty":`calc(-50% + ${Xe.highOffsetY}px)`,"--ps-tooltip-rot":`${Xe.highAngleDeg}deg`},[s,Xe.highOffsetX,Xe.highOffsetY,Xe.highAngleDeg]),Ir=Math.min(Xt,qt),Bn=Math.max(Xt,qt),Zo=s?{bottom:`${Ir}%`,height:`${Bn-Ir}%`,top:"auto",left:"0",right:"0"}:{left:`${Ir}%`,width:`${Bn-Ir}%`,top:"0",bottom:"0"},Jo=Math.max(.01,_e-Ae),zn=Math.max(.06,Math.min(.25,.28*Math.sqrt(Jo))),Qo=s?{bottom:`${Xt}%`,left:"50%",transform:"translate(-50%, 50%)",zIndex:ur?40:30}:{left:`${Xt}%`,top:"50%",transform:"translate(-50%, -50%)",zIndex:ur?40:30},ea=s?{bottom:`${qt}%`,left:"50%",transform:"translate(-50%, 50%)",zIndex:dr?40:30}:{left:`${qt}%`,top:"50%",transform:"translate(-50%, -50%)",zIndex:dr?40:30},ta=s?{bottom:`${Ne}%`,left:"50%",transform:"translate(-50%, 50%)"}:{left:`${Ne}%`,top:"50%",transform:"translate(-50%, -50%)"},_n=K!==null?me(K):null,ra=f!=="hover"&&K!==null&&(K===fe||!G&&K===we),na=tt?de(x,le[0]):De,oa=tt?de(x,le[le.length-1]):Te,aa=l||(he?$e<=na:G?fe<=E:fe<=E&&we<=E),ia=l||(he?Fe>=oa:(G||fe>=P)&&we>=P),mt=V?"micro-point":"micro-low",Lt=l?"cursor-not-allowed opacity-50":"cursor-pointer",Xn=i=>{const d=s?"vertical":"horizontal",m=i==="decrease",g=Ma[d][i];return h.jsx("button",{type:"button",className:`period-slider-stepper-btn relative after:absolute after:inset-[-11px] after:content-[''] ${g} flex h-6 w-6 shrink-0 items-center justify-center rounded-md border border-slate-300 bg-white font-bold text-[10px] text-slate-700 leading-none shadow-2xs transition-all hover:bg-slate-100 hover:text-indigo-600 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 active:scale-95 disabled:cursor-not-allowed disabled:opacity-30 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700 ${Lt}`,onClick:()=>nn(m?-1:1),disabled:m?aa:ia,"aria-label":m?ce:oe,children:wa[d][i]})};return h.jsxs("div",{style:e.style,className:`period-slider flex select-none items-center gap-2 ${s?"flex-col":"flex-row"} ${u}`,"data-disabled":l?"true":void 0,"data-unit":t,"data-mode":e.mode,"data-orientation":s?"vertical":"horizontal","data-label-position":T,"data-color-scheme":ne,children:[w&&Xn(s?"increase":"decrease"),h.jsx("div",{ref:it,"data-testid":"period-slider-track","data-orientation":s?"vertical":"horizontal","data-vernier-orientation":he?kt:void 0,className:`period-slider-track relative flex-1 touch-none rounded-full bg-slate-200 dark:bg-slate-700 ${s?"h-48 w-2":"h-2 w-full"} ${Lt}`,onPointerDown:Fo,onPointerMove:Uo,onPointerLeave:Wo,children:he?h.jsxs(h.Fragment,{children:[zr&&(s?h.jsxs("svg",{className:"period-slider-vernier-projection is-vertical",role:"presentation","aria-hidden":"true",width:"32",height:"100%",viewBox:"0 0 32 100",preserveAspectRatio:"none",children:[h.jsx("defs",{children:h.jsxs("linearGradient",{id:te,x1:"0",y1:"0",x2:"1",y2:"0",children:[h.jsx("stop",{offset:"0%",stopColor:I?W.macro:W.micro,stopOpacity:"0.28"}),h.jsx("stop",{offset:"100%",stopColor:I?W.micro:W.macro,stopOpacity:zn})]})}),h.jsx("polygon",{points:I?`12,${(1-_e)*100} 12,${(1-Ae)*100} 20,100 20,0`:`12,0 12,100 20,${(1-Ae)*100} 20,${(1-_e)*100}`,fill:`url(#${te})`})]}):h.jsxs("svg",{className:"period-slider-vernier-projection",role:"presentation","aria-hidden":"true",width:"100%",height:"32",viewBox:"0 0 100 32",preserveAspectRatio:"none",children:[h.jsx("defs",{children:h.jsxs("linearGradient",{id:te,x1:"0",y1:"0",x2:"0",y2:"1",children:[h.jsx("stop",{offset:"0%",stopColor:I?W.macro:W.micro,stopOpacity:"0.28"}),h.jsx("stop",{offset:"100%",stopColor:I?W.micro:W.macro,stopOpacity:zn})]})}),h.jsx("polygon",{points:I?`${Ae*100},12 ${_e*100},12 100,20 0,20`:`0,12 100,12 ${_e*100},20 ${Ae*100},20`,fill:`url(#${te})`})]})),!k&&h.jsxs(h.Fragment,{children:[h.jsx("div",{"data-testid":"period-slider-connect-macro",className:"period-slider-connect-macro",style:s?{bottom:`calc(${Ae*100}% - 8px)`,height:`calc(${Math.max(0,(_e-Ae)*100)}% + 16px)`}:{left:`calc(${Ae*100}% - 8px)`,width:`calc(${Math.max(0,(_e-Ae)*100)}% + 16px)`},onPointerDown:zt("macro-connect")}),!V&&h.jsx("div",{"data-testid":"period-slider-connect-micro",className:"period-slider-connect-micro",style:s?{bottom:`calc(${rt*100}% - 8px)`,height:`calc(${Math.max(0,(Mt-rt)*100)}% + 16px)`}:{left:`calc(${rt*100}% - 8px)`,width:`calc(${Math.max(0,(Mt-rt)*100)}% + 16px)`},onPointerDown:zt("micro-connect")})]}),_r&&h.jsxs("div",{className:"period-slider-vernier-ticks pointer-events-none absolute inset-0",children:[[.2,.4,.6,.8].map(i=>h.jsx("div",{"data-testid":"period-slider-tick","data-tick-scale":"macro",className:"period-slider-tick period-slider-tick-macro",style:s?{bottom:`${i*100}%`}:{left:`${i*100}%`}},`macro-tick-${i}`)),[.1,.2,.3,.4,.5,.6,.7,.8,.9].map(i=>h.jsx("div",{"data-testid":"period-slider-tick","data-tick-scale":"micro",className:"period-slider-tick period-slider-tick-micro",style:s?{bottom:`${i*100}%`}:{left:`${i*100}%`}},`micro-tick-${i}`))]}),h.jsxs("div",{tabIndex:l?-1:0,role:"slider","aria-label":e.macroLowerAriaLabel??"Macro range start","aria-disabled":l?"true":void 0,"aria-valuemin":Re,"aria-valuemax":Oe,"aria-valuenow":je,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(wt,O):Yt(O,wt,ct,C),"aria-orientation":s?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${s?"is-vertical":""} group absolute touch-none ${s?I?"after:absolute after:-inset-y-3 after:right-0 after:-left-4":"after:absolute after:-inset-y-3 after:-right-4 after:left-0":I?"after:absolute after:-inset-x-3 after:-top-4 after:bottom-0":"after:absolute after:-inset-x-3 after:top-0 after:-bottom-4"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${Lt}`,style:s?{bottom:`${Ae*100}%`,left:I?0:"auto",right:I?"auto":0,transform:I?"translate(-100%, 50%)":"translate(100%, 50%)",zIndex:ze==="macro-low"||ke==="macro-low"?30:15}:{left:`${Ae*100}%`,top:I?0:"auto",bottom:I?"auto":0,transform:I?"translate(-50%, -100%)":"translate(-50%, 100%)",zIndex:ze==="macro-low"||ke==="macro-low"?30:15},onPointerDown:zt("macro-low"),onKeyDown:Lr("macro-low"),onFocus:Sr("macro-low"),"data-active":ze==="macro-low"?"true":void 0,"data-front":ke==="macro-low"?"true":void 0,"data-vernier-pos":s?I?"left":"right":I?"top":"bottom","data-handle-type":"macro-low",children:[h.jsx(Mr,{type:"macro",isTop:I,isVertical:s,isLeft:I}),bt&&h.jsx("div",{className:"period-slider-hairline"}),f!=="hover"&&h.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${f==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":f,"data-duplicate":zo?"true":void 0,"data-slanted":kr.slant.isSlanted?"true":void 0,ref:Yo,style:kr.lowStyle,children:qe(O,wt,ct,C)})]}),h.jsxs("div",{tabIndex:l?-1:0,role:"slider","aria-label":e.macroUpperAriaLabel??"Macro range end","aria-disabled":l?"true":void 0,"aria-valuemin":je,"aria-valuemax":et,"aria-valuenow":Oe,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(At,O):Yt(O,At,ct,C),"aria-orientation":s?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${s?"is-vertical":""} group absolute touch-none ${s?I?"after:absolute after:-inset-y-3 after:right-0 after:-left-4":"after:absolute after:-inset-y-3 after:-right-4 after:left-0":I?"after:absolute after:-inset-x-3 after:-top-4 after:bottom-0":"after:absolute after:-inset-x-3 after:top-0 after:-bottom-4"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${Lt}`,style:s?{bottom:`${_e*100}%`,left:I?0:"auto",right:I?"auto":0,transform:I?"translate(-100%, 50%)":"translate(100%, 50%)",zIndex:ze==="macro-high"||ke==="macro-high"?30:15}:{left:`${_e*100}%`,top:I?0:"auto",bottom:I?"auto":0,transform:I?"translate(-50%, -100%)":"translate(-50%, 100%)",zIndex:ze==="macro-high"||ke==="macro-high"?30:15},onPointerDown:zt("macro-high"),onKeyDown:Lr("macro-high"),onFocus:Sr("macro-high"),"data-active":ze==="macro-high"?"true":void 0,"data-front":ke==="macro-high"?"true":void 0,"data-vernier-pos":s?I?"left":"right":I?"top":"bottom","data-handle-type":"macro-high",children:[h.jsx(Mr,{type:"macro",isTop:I,isVertical:s,isLeft:I}),bt&&h.jsx("div",{className:"period-slider-hairline"}),f!=="hover"&&h.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${f==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":f,"data-duplicate":_o?"true":void 0,"data-slanted":kr.slant.isSlanted?"true":void 0,ref:Vo,style:kr.highStyle,children:qe(O,At,ct,C)})]}),h.jsxs("div",{tabIndex:l?-1:0,role:"slider","aria-label":V?e.pointAriaLabel??"Micro selected date":e.lowerAriaLabel??"Micro range start","aria-disabled":l?"true":void 0,"aria-valuemin":De,"aria-valuemax":V?Te:Fe,"aria-valuenow":$e,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(Rt,x):Yt(x,Rt,Qe,C),"aria-orientation":s?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${s?"is-vertical":""} group absolute touch-none ${s?I?"after:absolute after:-inset-y-3 after:-right-4 after:left-0":"after:absolute after:-inset-y-3 after:right-0 after:-left-4":I?"after:absolute after:-inset-x-3 after:top-0 after:-bottom-4":"after:absolute after:-inset-x-3 after:-top-4 after:bottom-0"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${Lt}`,style:s?{bottom:`${rt*100}%`,left:I?"auto":0,right:I?0:"auto",transform:I?"translate(100%, 50%)":"translate(-100%, 50%)",zIndex:ze===mt||ke===mt?30:20}:{left:`${rt*100}%`,top:I?"auto":0,bottom:I?0:"auto",transform:I?"translate(-50%, 100%)":"translate(-50%, -100%)",zIndex:ze===mt||ke===mt?30:20},onPointerDown:zt(mt),onKeyDown:Lr(mt),onFocus:Sr(mt),"data-active":ze===mt?"true":void 0,"data-front":ke===mt?"true":void 0,"data-vernier-pos":s?I?"right":"left":I?"bottom":"top","data-handle-type":mt,children:[h.jsx(Mr,{type:"micro",isTop:!I,isVertical:s,isLeft:!I}),bt&&h.jsx("div",{className:"period-slider-hairline"}),f!=="hover"&&h.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${f==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":f,"data-duplicate":Xo?"true":void 0,"data-slanted":Ar.slant.isSlanted?"true":void 0,ref:Ho,style:Ar.lowStyle,children:qe(x,Rt,Qe,C)})]}),!V&&h.jsxs("div",{tabIndex:l?-1:0,role:"slider","aria-label":e.upperAriaLabel??"Micro range end","aria-disabled":l?"true":void 0,"aria-valuemin":$e,"aria-valuemax":Te,"aria-valuenow":Fe,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(Tt,x):Yt(x,Tt,Qe,C),"aria-orientation":s?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${s?"is-vertical":""} group absolute touch-none ${s?I?"after:absolute after:-inset-y-3 after:-right-4 after:left-0":"after:absolute after:-inset-y-3 after:right-0 after:-left-4":I?"after:absolute after:-inset-x-3 after:top-0 after:-bottom-4":"after:absolute after:-inset-x-3 after:-top-4 after:bottom-0"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${Lt}`,style:s?{bottom:`${Mt*100}%`,left:I?"auto":0,right:I?0:"auto",transform:I?"translate(100%, 50%)":"translate(-100%, 50%)",zIndex:ze==="micro-high"||ke==="micro-high"?30:20}:{left:`${Mt*100}%`,top:I?"auto":0,bottom:I?0:"auto",transform:I?"translate(-50%, 100%)":"translate(-50%, -100%)",zIndex:ze==="micro-high"||ke==="micro-high"?30:20},onPointerDown:zt("micro-high"),onKeyDown:Lr("micro-high"),onFocus:Sr("micro-high"),"data-active":ze==="micro-high"?"true":void 0,"data-front":ke==="micro-high"?"true":void 0,"data-vernier-pos":s?I?"right":"left":I?"bottom":"top","data-handle-type":"micro-high",children:[h.jsx(Mr,{type:"micro",isTop:!I,isVertical:s,isLeft:!I}),bt&&h.jsx("div",{className:"period-slider-hairline"}),f!=="hover"&&h.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${f==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":f,"data-duplicate":qo?"true":void 0,"data-slanted":Ar.slant.isSlanted?"true":void 0,ref:jo,style:Ar.highStyle,children:qe(x,Tt,Qe,C)})]})]}):h.jsxs(h.Fragment,{children:[!k&&h.jsx("div",{"data-testid":"period-slider-connect",className:"period-slider-connect absolute rounded-full",style:Zo,onPointerDown:Oo}),ee&&y&&D.length>1&&h.jsx("div",{className:"period-slider-ticks pointer-events-none absolute inset-0",children:D.map((i,d)=>{const m=de(t,i),g=yr(d),R=s?{bottom:`${g}%`,left:"50%",transform:"translate(-50%, 50%)"}:{left:`${g}%`,top:"50%",transform:"translate(-50%, -50%)"};return h.jsx("div",{"data-testid":"period-slider-tick",className:"period-slider-tick absolute h-1.5 w-1.5 rounded-full bg-slate-400/60 dark:bg-slate-500/60",style:R},`tick-${m}`)})}),!l&&K!==null&&Ne!==null&&b===null&&_n&&h.jsxs("div",{"data-testid":"period-slider-hover-guide",className:"period-slider-hover-guide pointer-events-none absolute h-2 w-2",style:ta,children:[h.jsx("div",{"data-testid":"period-slider-hover-dot",className:"period-slider-hover-dot h-full w-full rounded-full border border-white/80 bg-[var(--aqps-accent-light)] shadow-[0_0_6px_var(--aqps-accent-glow)] dark:border-slate-800"}),h.jsx("div",{"data-testid":"period-slider-hover-tooltip","data-duplicate":ra?"true":void 0,className:`period-slider-hover-tooltip ${T==="bottom"&&!s?"period-slider-hover-tooltip-bottom":""} rounded bg-slate-800/90 px-2 py-0.5 font-medium text-white text-xs shadow-lg backdrop-blur-xs dark:bg-slate-900/90`,children:qe(t,_n,e.formatLabel,C)})]}),h.jsxs("div",{tabIndex:l?-1:0,role:"slider","aria-label":G?e.pointAriaLabel??"Selected date":e.lowerAriaLabel??"Range start","aria-disabled":l?"true":void 0,"aria-valuemin":E,"aria-valuemax":G?P:we,"aria-valuenow":fe,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(on,t):Yt(t,on,e.formatLabel,C),"aria-orientation":s?"vertical":"horizontal",className:`period-slider-handle group absolute h-4 w-4 touch-none after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:outline-none ${Lt}`,style:Qo,onPointerDown:En("low"),onKeyDown:Yn("low"),onFocus:Nn("low"),"data-active":b==="low"?"true":void 0,"data-front":ur?"true":void 0,children:[h.jsx("div",{"data-testid":"period-slider-knob",className:`period-slider-knob h-full w-full rounded-full border-2 border-white bg-[var(--aqps-accent-color)] group-focus-visible:ring-2 group-focus-visible:ring-blue-600 group-focus-visible:ring-offset-2 dark:border-slate-800 dark:bg-[var(--aqps-accent-light)] ${b==="low"?"":"shadow-md"}`}),f!=="hover"&&h.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${f==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":f,"data-label-position":T,"data-slanted":Xe.isSlanted?"true":void 0,"data-front":ur?"true":void 0,"data-duplicate":Cr&&!ur?"true":void 0,ref:Eo,style:Ko,children:qe(t,on,e.formatLabel,C)})]}),!G&&h.jsxs("div",{tabIndex:l?-1:0,role:"slider","aria-label":e.upperAriaLabel??"Range end","aria-disabled":l?"true":void 0,"aria-valuemin":fe,"aria-valuemax":P,"aria-valuenow":we,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(an,t):Yt(t,an,e.formatLabel,C),"aria-orientation":s?"vertical":"horizontal",className:`period-slider-handle group absolute h-4 w-4 touch-none after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:outline-none ${Lt}`,style:ea,onPointerDown:En("high"),onKeyDown:Yn("high"),onFocus:Nn("high"),"data-active":b==="high"?"true":void 0,"data-front":dr?"true":void 0,children:[h.jsx("div",{"data-testid":"period-slider-knob",className:`period-slider-knob h-full w-full rounded-full border-2 border-white bg-[var(--aqps-accent-color)] group-focus-visible:ring-2 group-focus-visible:ring-blue-600 group-focus-visible:ring-offset-2 dark:border-slate-800 dark:bg-[var(--aqps-accent-light)] ${b==="high"?"":"shadow-md"}`}),f!=="hover"&&h.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${f==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":f,"data-label-position":T,"data-slanted":Xe.isSlanted?"true":void 0,"data-front":dr?"true":void 0,"data-duplicate":Cr&&!dr?"true":void 0,ref:No,style:Go,children:qe(t,an,e.formatLabel,C)})]})]})}),w&&Xn(s?"decrease":"increase")]})},fn=(e,t)=>{if(e===t)return!0;if(!(e&&t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r].getTime()!==t[r].getTime())return!1;return!0},To=(e,t)=>{if(e===t)return!0;if(!(e&&t))return!1;const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const a of r)if(e[a]!==t[a])return!1;return!0},Da=(e,t)=>e===t?!0:e.mode!==t.mode||e.unit!==t.unit||e.minDate.getTime()!==t.minDate.getTime()||e.maxDate.getTime()!==t.maxDate.getTime()||e.labelPosition!==t.labelPosition||e.autoSlantLabels!==t.autoSlantLabels||e.isVertical!==t.isVertical||e.hideConnectBar!==t.hideConnectBar||e.showTicks!==t.showTicks||e.disabled!==t.disabled||e.showStepper!==t.showStepper||e.debounceMs!==t.debounceMs||e.tooltipStyle!==t.tooltipStyle||e.colorScheme!==t.colorScheme||e.className!==t.className||!To(e.style,t.style)||e.snapMode!==t.snapMode||e.formatLabel!==t.formatLabel||e.locale!==t.locale||e.lowerAriaLabel!==t.lowerAriaLabel||e.upperAriaLabel!==t.upperAriaLabel||e.pointAriaLabel!==t.pointAriaLabel||e.macroLowerAriaLabel!==t.macroLowerAriaLabel||e.macroUpperAriaLabel!==t.macroUpperAriaLabel||e.decreaseAriaLabel!==t.decreaseAriaLabel||e.increaseAriaLabel!==t.increaseAriaLabel||e.formatAriaValueText!==t.formatAriaValueText||!fn(e.allowedDates,t.allowedDates)?!1:e.mode==="point"&&t.mode==="point"?!((e.value?.getTime()??null)!==(t.value?.getTime()??null)||(e.defaultValue?.getTime()??null)!==(t.defaultValue?.getTime()??null)||e.onChangePoint!==t.onChangePoint):e.mode==="range"&&t.mode==="range"?!((e.range?.[0]?.getTime()??null)!==(t.range?.[0]?.getTime()??null)||(e.range?.[1]?.getTime()??null)!==(t.range?.[1]?.getTime()??null)||(e.defaultRange?.[0]?.getTime()??null)!==(t.defaultRange?.[0]?.getTime()??null)||(e.defaultRange?.[1]?.getTime()??null)!==(t.defaultRange?.[1]?.getTime()??null)||e.onChangeRange!==t.onChangeRange):e.mode==="vernier"&&t.mode==="vernier"?!((e.microRange?.[0]?.getTime()??null)!==(t.microRange?.[0]?.getTime()??null)||(e.microRange?.[1]?.getTime()??null)!==(t.microRange?.[1]?.getTime()??null)||(e.defaultMicroRange?.[0]?.getTime()??null)!==(t.defaultMicroRange?.[0]?.getTime()??null)||(e.defaultMicroRange?.[1]?.getTime()??null)!==(t.defaultMicroRange?.[1]?.getTime()??null)||(e.microValue?.getTime()??null)!==(t.microValue?.getTime()??null)||(e.defaultMicroValue?.getTime()??null)!==(t.defaultMicroValue?.getTime()??null)||e.macroRange[0].getTime()!==t.macroRange[0].getTime()||e.macroRange[1].getTime()!==t.macroRange[1].getTime()||e.vernierOrientation!==t.vernierOrientation||e.showVernierProjection!==t.showVernierProjection||e.showVernierTicks!==t.showVernierTicks||e.showHairline!==t.showHairline||e.macroUnit!==t.macroUnit||e.microUnit!==t.microUnit||e.macroIsDiscrete!==t.macroIsDiscrete||e.microIsDiscrete!==t.microIsDiscrete||e.formatMacroLabel!==t.formatMacroLabel||e.formatMicroLabel!==t.formatMicroLabel||e.onChangeMicroRange!==t.onChangeMicroRange||e.onChangeMicroPoint!==t.onChangeMicroPoint||e.onChangeMacroRange!==t.onChangeMacroRange||!fn(e.macroAllowedDates,t.macroAllowedDates)||!fn(e.microAllowedDates,t.microAllowedDates)):!1,So=o.memo(xa,Da);So.displayName="PeriodSlider";const gt=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t},xr=(e,t)=>{if(Number.isNaN(t.getTime()))throw new RangeError(`DateSelector: "${e}" must be a valid Date (received ${String(t)})`)},va=e=>{if(e!==void 0)try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{throw new RangeError(`DateSelector: "locale" must be a valid BCP 47 language tag (received ${JSON.stringify(e)})`)}},Ht=(e,t,r)=>{const n=new Date(e,t-1,r);return n.setFullYear(e),n.setHours(0,0,0,0),n},ro=e=>Ht(e,1,1),pa=e=>Ht(e,12,31),ya={year:{year:"numeric"},month:{month:"2-digit"},day:{day:"2-digit"}},Ra={year:4,month:2,day:2},Ta={year:e=>e.getFullYear(),month:e=>e.getMonth()+1,day:e=>e.getDate()},no=new Map,Sa=(e,t)=>{const r=`${e}\0${t}`,n=no.get(r);if(n!==void 0)return n;const a=new Intl.DateTimeFormat(t,ya[e]);return no.set(r,a),a},gn=(e,t,r)=>r===void 0?String(Ta[e](t)).padStart(Ra[e],"0"):Sa(e,r).format(t),La=(e,t,r)=>{const n=t?.getTime()??null,a=r?.getTime()??null,c=new Map;return e.forEach((l,u)=>{xr(`allowedDates[${u}]`,l);const w=gt(l),f=w.getTime();n!==null&&f<n||a!==null&&f>a||c.has(f)||c.set(f,w)}),Array.from(c.keys()).sort((l,u)=>l-u).map(l=>c.get(l))},Ca=(e,t)=>{const r=[];let n=gt(e);const a=gt(t).getTime();for(;n.getTime()<=a;)r.push(n),n=Ye.addDays(n,1);return r},oo=(e,t)=>{const r=[];for(let n=e.length-1;n>=0;n--)r.push({label:qe("day",e[n],void 0,t),value:Ye.format(e[n],"yyyy-MM-dd")});return r},$a=e=>{const{value:t,initialDate:r,onChange:n,children:a,minYear:c,maxYear:l,minDate:u,maxDate:w,allowedDates:f,variant:T="date",className:L="",style:s,disabled:k=!1,prevDateAriaLabel:ee="Previous day",nextDateAriaLabel:ne="Next day",selectAriaLabel:C="Date",yearAriaLabel:ce="Year",monthAriaLabel:oe="Month",dayAriaLabel:$="Day",locale:V,formatYearOption:W,formatMonthOption:te,formatDayOption:q}=e;if(va(V),t!==void 0&&xr("value",t),r!==void 0&&xr("initialDate",r),u!==void 0&&xr("minDate",u),w!==void 0&&xr("maxDate",w),c!==void 0&&!Number.isInteger(c))throw new RangeError(`DateSelector: "minYear" must be an integer year (received ${String(c)})`);if(l!==void 0&&!Number.isInteger(l))throw new RangeError(`DateSelector: "maxYear" must be an integer year (received ${String(l)})`);if(T==="split-dropdown"&&f!==void 0)throw new RangeError('DateSelector: variant="split-dropdown" cannot honour "allowedDates"; use variant="dropdown" or variant="date" for a discrete date set');const F=t??r;if(F===void 0)throw new RangeError("DateSelector: either `value` (controlled) or `initialDate` (uncontrolled) is required; the selected date is never inferred from the wall clock.");const[p,D]=o.useState(()=>gt(F)),y=t!==void 0,E=t?.getTime(),P=o.useMemo(()=>t!==void 0?gt(t):p,[E,p]),G=u?.getTime(),me=w?.getTime(),B=o.useMemo(()=>{const M=u?gt(u):null,Y=c!==void 0?ro(c):null;return M===null?Y:Y===null||M.getTime()>=Y.getTime()?M:Y},[G,c]),Z=o.useMemo(()=>{const M=w?gt(w):null,Y=l!==void 0?pa(l):null;return M===null?Y:Y===null||M.getTime()<=Y.getTime()?M:Y},[me,l]),se=B?.getTime()??null,_=Z?.getTime()??null;if(B!==null&&Z!==null&&B.getTime()>Z.getTime())throw new RangeError(`DateSelector: the resolved range is empty (min ${Ye.format(B,"yyyy-MM-dd")} is after max ${Ye.format(Z,"yyyy-MM-dd")})`);if(T!=="date"&&f===void 0&&(B===null||Z===null))throw new RangeError(`DateSelector: variant="${T}" needs a bounded range; supply minDate/minYear and maxDate/maxYear${T==="dropdown"?' or supply "allowedDates"':""}`);const z=f===void 0?null:f.map(M=>M.getTime()).join(","),re=o.useMemo(()=>f===void 0?null:La(f,B,Z),[z,se,_]),ie=M=>{const Y=M.getTime();return re!==null?re.some(Be=>Be.getTime()===Y):!(se!==null&&Y<se||_!==null&&Y>_)},We=F.getTime();o.useEffect(()=>{y||D(gt(F))},[y,We]);const Se=M=>{if(k)return;const Y=gt(M);ie(Y)&&(y||D(Y),n?.(Y))},Le=P.getTime(),ye=ie(P),Ge=o.useMemo(()=>{if(re!==null){for(let Y=re.length-1;Y>=0;Y--)if(re[Y].getTime()<Le)return re[Y];return null}const M=Ye.addDays(new Date(Le),-1);return ie(M)?M:null},[re,Le,se,_]),Ze=o.useMemo(()=>{if(re!==null){for(const Y of re)if(Y.getTime()>Le)return Y;return null}const M=Ye.addDays(new Date(Le),1);return ie(M)?M:null},[re,Le,se,_]),at=k||Ge===null,Ve=k||Ze===null,st=()=>{Ge!==null&&Se(Ge)},X=()=>{Ze!==null&&Se(Ze)},Q=M=>{if(M.target.value){const Y=Ye.parseISO(M.target.value);Number.isNaN(Y.getTime())||Se(Y)}},ge=M=>{if(M.target.value){const Y=Ye.parseISO(M.target.value);Number.isNaN(Y.getTime())||Se(Y)}},b=P.getFullYear(),S=P.getMonth()+1,j=P.getDate(),Me=o.useMemo(()=>T!=="dropdown"?[]:re!==null?oo(re,V):B===null||Z===null?[]:oo(Ca(B,Z),V),[T,re,se,_,V]),A=o.useMemo(()=>{if(T!=="split-dropdown"||B===null||Z===null)return[];const M=[];for(let Y=Z.getFullYear();Y>=B.getFullYear();Y--)M.push(Y);return M},[T,se,_]),K=o.useMemo(()=>{if(T!=="split-dropdown"||B===null||Z===null)return[];const M=B,Y=Z,Be=b===M.getFullYear()?M.getMonth()+1:1,jt=b===Y.getFullYear()?Y.getMonth()+1:12,ct=[];for(let Qe=Be;Qe<=jt;Qe++)ct.push(Qe);return ct},[T,se,_,b]),Ce=o.useMemo(()=>{if(T!=="split-dropdown"||B===null||Z===null)return[];const M=B,Y=Z,Be=b===M.getFullYear()&&S===M.getMonth()+1?M.getDate():1,jt=b===Y.getFullYear()&&S===Y.getMonth()+1?Y.getDate():Ye.getDaysInMonth(new Date(Le)),ct=[];for(let Qe=Be;Qe<=jt;Qe++)ct.push(Qe);return ct},[T,se,_,Le,b,S]),Ne=(M,Y,Be)=>Be>Ye.getDaysInMonth(Ht(M,Y,1))?!1:ie(Ht(M,Y,Be)),He=(M,Y,Be)=>{Ne(M,Y,Be)&&Se(Ht(M,Y,Be))},fe=M=>W?W(M):gn("year",ro(M),V),we=M=>te?te(M):gn("month",Ht(b,M,1),V),or=M=>q?q(M):gn("day",Ht(b,S,M),V),he=Ye.format(P,"yyyy-MM-dd"),kt=qe("day",P,void 0,V),I=B?Ye.format(B,"yyyy-MM-dd"):void 0,zr=Z?Ye.format(Z,"yyyy-MM-dd"):void 0,_r=ye?he:"",bt="text-center font-mono text-gray-500 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-400",O=T==="split-dropdown"?"w-auto":"w-38";return h.jsxs("div",{className:`inline-flex items-center ${O} ${L}`,style:s,"data-variant":T,"data-out-of-range":ye?void 0:"true",children:[h.jsx("button",{type:"button","aria-label":ee,disabled:at,className:"relative my-auto inline-flex h-5 w-4 cursor-pointer items-center justify-center rounded p-0 after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:opacity-40",onClick:st,children:h.jsx("span",{className:"h-0 w-0 border-y-[6px] border-y-transparent border-r-[6px] border-r-slate-500 border-solid hover:border-r-slate-700 dark:border-r-slate-400 dark:hover:border-r-slate-200"})}),T==="dropdown"?h.jsxs("select",{"aria-label":C,disabled:k,className:"mx-1 my-auto w-28 appearance-none rounded-md border border-gray-300 bg-gray-100 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums [text-align-last:center] [text-align:center] focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500",value:_r,onChange:ge,children:[ye?null:h.jsx("option",{value:"",disabled:!0,className:bt,children:kt}),Me.map(M=>h.jsx("option",{value:M.value,className:"text-center font-mono text-gray-900 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-100",children:M.label},M.value))]}):T==="split-dropdown"?h.jsxs("div",{className:"mx-1 my-auto inline-flex items-center gap-1",children:[h.jsxs("select",{"aria-label":ce,disabled:k,className:"rounded-md border border-gray-300 bg-gray-50 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100",value:ye?b:"",onChange:M=>He(Number(M.target.value),S,j),children:[ye?null:h.jsx("option",{value:"",disabled:!0,className:bt,children:fe(b)}),A.map(M=>h.jsx("option",{value:M,disabled:!Ne(M,S,j),className:"dark:bg-slate-700 dark:text-slate-100",children:fe(M)},M))]}),h.jsxs("select",{"aria-label":oe,disabled:k,className:"rounded-md border border-gray-300 bg-gray-50 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100",value:ye?S:"",onChange:M=>He(b,Number(M.target.value),j),children:[ye?null:h.jsx("option",{value:"",disabled:!0,className:bt,children:we(S)}),K.map(M=>h.jsx("option",{value:M,disabled:!Ne(b,M,j),className:"dark:bg-slate-700 dark:text-slate-100",children:we(M)},M))]}),h.jsxs("select",{"aria-label":$,disabled:k,className:"rounded-md border border-gray-300 bg-gray-50 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100",value:ye?j:"",onChange:M=>He(b,S,Number(M.target.value)),children:[ye?null:h.jsx("option",{value:"",disabled:!0,className:bt,children:or(j)}),Ce.map(M=>h.jsx("option",{value:M,className:"dark:bg-slate-700 dark:text-slate-100",children:or(M)},M))]})]}):h.jsx("input",{"aria-label":C,disabled:k,className:"period-slider-native-date-field mx-1 my-auto w-28 rounded-md border border-gray-300 bg-gray-100 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500 dark:placeholder:text-gray-400",value:he,min:I,max:zr,onChange:Q,type:"date"}),h.jsx("button",{type:"button","aria-label":ne,disabled:Ve,className:"relative my-auto inline-flex h-5 w-4 cursor-pointer items-center justify-center rounded p-0 after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:opacity-40",onClick:X,children:h.jsx("span",{className:"h-0 w-0 border-y-[6px] border-y-transparent border-l-[6px] border-l-slate-500 border-solid hover:border-l-slate-700 dark:border-l-slate-400 dark:hover:border-l-slate-200"})}),a]})},tr=e=>e===void 0?null:gt(e).getTime(),Lo=o.memo($a,(e,t)=>!(tr(e.value??e.initialDate)!==tr(t.value??t.initialDate)||tr(e.minDate)!==tr(t.minDate)||tr(e.maxDate)!==tr(t.maxDate)||e.variant!==t.variant||e.disabled!==t.disabled||e.className!==t.className||e.style!==t.style||e.minYear!==t.minYear||e.maxYear!==t.maxYear||e.onChange!==t.onChange||e.allowedDates!==t.allowedDates||e.children!==t.children||e.prevDateAriaLabel!==t.prevDateAriaLabel||e.nextDateAriaLabel!==t.nextDateAriaLabel||e.selectAriaLabel!==t.selectAriaLabel||e.yearAriaLabel!==t.yearAriaLabel||e.monthAriaLabel!==t.monthAriaLabel||e.dayAriaLabel!==t.dayAriaLabel||e.locale!==t.locale||e.formatYearOption!==t.formatYearOption||e.formatMonthOption!==t.formatMonthOption||e.formatDayOption!==t.formatDayOption));Lo.displayName="DateSelector";function nt(e,t){const r=e+Math.floor(t/12),n=(t%12+12)%12,a=new Date(r,n,1);return a.setFullYear(r),a}function Vt(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}`}function wr(e,t){if(e!==void 0&&(!(e instanceof Date)||Number.isNaN(e.getTime())))throw new RangeError(`MonthSelector: \`${t}\` must be a valid Date, received ${String(e)}.`)}function ao(e,t){if(e!==void 0&&!Number.isInteger(e))throw new RangeError(`MonthSelector: \`${t}\` must be an integer year, received ${String(e)}.`)}function Pa(e){if(e!==void 0)try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{throw new RangeError(`MonthSelector: \`locale\` must be a valid BCP 47 language tag, received ${JSON.stringify(e)}.`)}}function ka(e,t){const r=e===void 0?null:nt(e,0),n=t===void 0?null:nt(t.getFullYear(),t.getMonth());return r!==null&&n!==null?r>=n?r:n:r!==null?r:n}function Aa(e,t){const r=e===void 0?null:nt(e,11),n=t===void 0?null:nt(t.getFullYear(),t.getMonth());return r!==null&&n!==null?r<=n?r:n:r!==null?r:n}function Ia(e,t,r){const n=new Map;for(const a of e){const c=nt(a.getFullYear(),a.getMonth());t!==null&&c<t||r!==null&&c>r||n.has(c.getTime())||n.set(c.getTime(),c)}return Array.from(n.values()).sort((a,c)=>a.getTime()-c.getTime())}function Ea(e,t){const r=e.getFullYear()*12+e.getMonth(),n=t.getFullYear()*12+t.getMonth(),a=[];for(let c=r;c<=n;c++)a.push(nt(Math.floor(c/12),c%12));return a}function io(e,t){const r=[];for(let n=e.length-1;n>=0;n--)r.push({label:qe("month",e[n],void 0,t),value:Vt(e[n])});return r}const Na=e=>{const{value:t,initialDate:r,onChange:n,children:a,variant:c="date",minYear:l,maxYear:u,minDate:w,maxDate:f,allowedMonths:T,isWarning:L=!1,className:s="",style:k,disabled:ee=!1,prevMonthAriaLabel:ne="Previous month",nextMonthAriaLabel:C="Next month",selectAriaLabel:ce="Month",locale:oe}=e;Pa(oe),wr(t,"value"),wr(r,"initialDate"),wr(w,"minDate"),wr(f,"maxDate"),ao(l,"minYear"),ao(u,"maxYear"),T?.forEach((A,K)=>{wr(A,`allowedMonths[${K}]`)});const $=t??r;if($===void 0)throw new RangeError("MonthSelector: either `value` (controlled) or `initialDate` (uncontrolled) is required; the selected month is never inferred from the wall clock.");const[V,W]=o.useState(()=>nt($.getFullYear(),$.getMonth())),te=t!==void 0,q=o.useMemo(()=>t!==void 0?nt(t.getFullYear(),t.getMonth()):V,[t?.getTime(),V]),F=w?.getTime(),p=f?.getTime(),D=o.useMemo(()=>ka(l,w),[l,F]),y=o.useMemo(()=>Aa(u,f),[u,p]),E=D?.getTime()??null,P=y?.getTime()??null;if(D!==null&&y!==null&&D>y)throw new RangeError(`MonthSelector: the resolved lower bound ${Vt(D)} is after the resolved upper bound ${Vt(y)}.`);if(c==="dropdown"&&T===void 0&&(D===null||y===null))throw new RangeError('MonthSelector: variant="dropdown" requires a lower bound (`minYear` or `minDate`) and an upper bound (`maxYear` or `maxDate`), or `allowedMonths`; the option window is never invented.');const G=T===void 0?null:T.map(A=>A.getTime()).join(","),me=o.useMemo(()=>T===void 0?null:Ia(T,D,y),[G,E,P]),B=A=>{const K=A.getTime();return me!==null?me.some(Ce=>Ce.getTime()===K):!(E!==null&&K<E||P!==null&&K>P)},Z=$.getTime();o.useEffect(()=>{if(te)return;const A=nt($.getFullYear(),$.getMonth());W(K=>K.getTime()===A.getTime()?K:A)},[te,Z]);const se=A=>{if(ee)return;if(!B(A))throw new RangeError(`MonthSelector: refusing to emit ${Vt(A)}, which lies outside the selectable months.`);te||W(A);const K=A.getFullYear()*100+(A.getMonth()+1);n?.(A,K)},_=q.getTime(),z=B(q),re=o.useMemo(()=>{if(me!==null){for(let K=me.length-1;K>=0;K--)if(me[K].getTime()<_)return me[K];return null}const A=nt(q.getFullYear(),q.getMonth()-1);return B(A)?A:null},[me,_,E,P]),ie=o.useMemo(()=>{if(me!==null){for(const K of me)if(K.getTime()>_)return K;return null}const A=nt(q.getFullYear(),q.getMonth()+1);return B(A)?A:null},[me,_,E,P]),We=ee||re===null,Se=ee||ie===null,Le=()=>{re!==null&&se(re)},ye=()=>{ie!==null&&se(ie)},Ge=A=>{if(!A)return;const[K,Ce]=A.split("-"),Ne=Number(K),He=Number(Ce)-1;if(!(Number.isInteger(Ne)&&Number.isInteger(He)))return;const fe=nt(Ne,He);B(fe)&&se(fe)},Ze=A=>{Ge(A.target.value)},at=A=>{Ge(A.target.value)},Ve=Vt(q),st=qe("month",q,void 0,oe),X=D?Vt(D):void 0,Q=y?Vt(y):void 0,ge=o.useMemo(()=>c!=="dropdown"?[]:me!==null?io(me,oe):D===null||y===null?[]:io(Ea(D,y),oe),[c,me,E,P,oe]),b=z?Ve:"",S=L?"border-amber-300 bg-amber-50 text-amber-900 focus:border-amber-500 focus:ring-amber-500 dark:border-amber-900/50 dark:bg-amber-950/20 dark:text-amber-200":"border-gray-300 bg-gray-100 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500",j=`period-slider-native-date-field mx-1 my-auto w-28 rounded-md border py-0.5 px-1 text-center font-mono text-xs tabular-nums dark:placeholder:text-gray-400 disabled:opacity-50 ${S}`,Me=`mx-1 my-auto w-28 appearance-none rounded-md border px-1 py-0.5 text-center font-mono text-xs tabular-nums [text-align-last:center] [text-align:center] disabled:opacity-50 ${S}`;return h.jsxs("div",{className:`inline-flex w-38 items-center ${s}`,style:k,"data-out-of-range":z?void 0:"true",children:[h.jsx("button",{type:"button","aria-label":ne,disabled:We,className:"relative my-auto inline-flex h-5 w-4 cursor-pointer items-center justify-center rounded p-0 after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:opacity-40",onClick:Le,children:h.jsx("span",{className:"h-0 w-0 border-y-[6px] border-y-transparent border-r-[6px] border-r-slate-500 border-solid hover:border-r-slate-700 dark:border-r-slate-400 dark:hover:border-r-slate-200"})}),c==="dropdown"?h.jsxs("select",{"aria-label":ce,disabled:ee,className:Me,value:b,onChange:at,children:[z?null:h.jsx("option",{value:"",disabled:!0,className:"text-center font-mono text-gray-500 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-400",children:st}),ge.map(A=>h.jsx("option",{value:A.value,className:"text-center font-mono text-gray-900 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-100",children:A.label},A.value))]}):h.jsx("input",{"aria-label":ce,disabled:ee,className:j,value:Ve,min:X,max:Q,onChange:Ze,type:"month"}),h.jsx("button",{type:"button","aria-label":C,disabled:Se,className:"relative my-auto inline-flex h-5 w-4 cursor-pointer items-center justify-center rounded p-0 after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:opacity-40",onClick:ye,children:h.jsx("span",{className:"h-0 w-0 border-y-[6px] border-y-transparent border-l-[6px] border-l-slate-500 border-solid hover:border-l-slate-700 dark:border-l-slate-400 dark:hover:border-l-slate-200"})}),a]})},Co=o.memo(Na,(e,t)=>{const r=e.value??e.initialDate,n=t.value??t.initialDate,a=r?r.getFullYear()*12+r.getMonth():null,c=n?n.getFullYear()*12+n.getMonth():null;if(a!==c||e.variant!==t.variant||e.disabled!==t.disabled||e.className!==t.className||e.style!==t.style||e.isWarning!==t.isWarning||e.minYear!==t.minYear||e.maxYear!==t.maxYear)return!1;const l=e.minDate?e.minDate.getFullYear()*12+e.minDate.getMonth():null,u=t.minDate?t.minDate.getFullYear()*12+t.minDate.getMonth():null;if(l!==u)return!1;const w=e.maxDate?e.maxDate.getFullYear()*12+e.maxDate.getMonth():null,f=t.maxDate?t.maxDate.getFullYear()*12+t.maxDate.getMonth():null;return!(w!==f||e.allowedMonths!==t.allowedMonths||e.onChange!==t.onChange||e.children!==t.children||e.prevMonthAriaLabel!==t.prevMonthAriaLabel||e.nextMonthAriaLabel!==t.nextMonthAriaLabel||e.selectAriaLabel!==t.selectAriaLabel||e.locale!==t.locale)});Co.displayName="MonthSelector";function nr(e,t,r){if(!(r instanceof Date)||Number.isNaN(r.getTime()))throw new RangeError(`${e}: ${t} is required and must be a valid Date (received: ${String(r)})`)}function Wr(e,t,r){if(nr(e,"minDate",t),nr(e,"maxDate",r),r.getTime()<=t.getTime())throw new RangeError(`${e}: maxDate must be strictly later than minDate (minDate: ${t.toISOString()}, maxDate: ${r.toISOString()})`)}function Hr(e,t,r){if(!Array.isArray(r)||r.length!==2)throw new RangeError(`${e}: ${t} is required and must be a [lower, upper] Date tuple (received: ${String(r)})`);if(nr(e,`${t}[0]`,r[0]),nr(e,`${t}[1]`,r[1]),r[0].getTime()>r[1].getTime())throw new RangeError(`${e}: ${t} upper must not be earlier than lower (lower: ${r[0].toISOString()}, upper: ${r[1].toISOString()})`)}function jr(e,t,r,n,a,c){if(r.getTime()<n.getTime()||r.getTime()>a.getTime())throw new RangeError(`${e}: ${t} must lie within ${c} (value: ${r.toISOString()}, lower: ${n.toISOString()}, upper: ${a.toISOString()})`)}function Or(e,t,r,n,a,c){jr(e,`${t}[0]`,r[0],n,a,c),jr(e,`${t}[1]`,r[1],n,a,c)}function Ue(e,t,r){return e<t?t:e>r?r:e}function Fr(e,t,r,n,a,c){if(r!==!0)return[];const l=e[0].getTime(),u=e[1].getTime();return vt(n,t,a,c).filter(w=>w.getTime()>=l&&w.getTime()<=u)}function rr(e,t,r,n){if(n.length===0)return Ue(e,r[0],r[1]);const a=n[be(n,e,t)];return a.getTime()===e.getTime()?e:a}function Yr(e,t,r,n){const a=rr(e[0],t,r,n),c=rr(e[1],t,r,n);return[a,c<a?a:c]}function Ur(e,t,r,n){const a=be(e,r,t)+n;return e[Math.max(0,Math.min(e.length-1,a))]}function Br(e){const t=o.useRef(e),r=t.current,n=e,a=Object.keys(r),c=Object.keys(n);return a.length===c.length&&c.every(u=>Object.is(r[u],n[u]))||(t.current=e),t.current}function Ya(e){const{unit:t,minDate:r,maxDate:n,initialRange:a,onChangeRange:c,...l}=e;Wr("usePeriodSliderRange",r,n),Hr("usePeriodSliderRange","initialRange",a),Or("usePeriodSliderRange","initialRange",a,r,n,"[minDate, maxDate]");const u=Br(l),w=o.useRef(a),[f,T]=o.useState(a);let L=f;const s=[Ue(f[0],r,n),Ue(f[1],r,n)];(s[0]!==f[0]||s[1]!==f[1])&&(L=s,T(s));const k=o.useRef(L);k.current=L;const ee=o.useRef({minDate:r,maxDate:n,allowedDates:u.allowedDates});ee.current={minDate:r,maxDate:n,allowedDates:u.allowedDates};const ne=o.useRef(c);ne.current=c;const C=o.useCallback(p=>{const{minDate:D,maxDate:y}=ee.current,E=Ue(p[0],D,y),P=Ue(p[1],D,y),G=k.current;E.getTime()===G[0].getTime()&&P.getTime()===G[1].getTime()||(k.current=[E,P],T([E,P]),ne.current?.(E,P))},[]),ce=o.useCallback(p=>{const D=k.current,y=p.getTime()>D[1].getTime()?p:D[1];C([p,y])},[C]),oe=o.useCallback(p=>{const D=k.current,y=p.getTime()<D[0].getTime()?p:D[0];C([y,p])},[C]),$=o.useCallback((p,D)=>{C([p,D])},[C]),V=o.useCallback(p=>{const{minDate:D,maxDate:y,allowedDates:E}=ee.current,P=k.current,G=vt(E,t,D,y);if(G.length>0){C([Ur(G,t,P[0],p),Ur(G,t,P[1],p)]);return}C([Ee(t,P[0],p),Ee(t,P[1],p)])},[t,C]),W=o.useCallback(()=>{C(w.current)},[C]),te=o.useMemo(()=>({value:L[0],onChange:ce,minDate:r,maxDate:L[1],unit:t}),[L[0],L[1],ce,r,t]),q=o.useMemo(()=>({value:L[1],onChange:oe,minDate:L[0],maxDate:n,unit:t}),[L[0],L[1],oe,n,t]),F=o.useMemo(()=>({...u,mode:"range",unit:t,range:L,minDate:r,maxDate:n,onChangeRange:$}),[u,t,L,r,n,$]);return{range:L,lowerDate:L[0],upperDate:L[1],setRange:T,setLowerDate:ce,setUpperDate:oe,shiftRange:V,resetRange:W,startSelectorProps:te,endSelectorProps:q,sliderProps:F}}function Va(e){const{unit:t,minDate:r,maxDate:n,initialValue:a,onChangePoint:c,...l}=e;Wr("usePeriodSliderPoint",r,n),nr("usePeriodSliderPoint","initialValue",a),jr("usePeriodSliderPoint","initialValue",a,r,n,"[minDate, maxDate]");const u=Br(l),w=o.useRef(a),[f,T]=o.useState(a);let L=f;const s=Ue(f,r,n);s!==f&&(L=s,T(s));const k=o.useRef(L);k.current=L;const ee=o.useRef({minDate:r,maxDate:n,allowedDates:u.allowedDates});ee.current={minDate:r,maxDate:n,allowedDates:u.allowedDates};const ne=o.useRef(c);ne.current=c;const C=o.useCallback(W=>{const{minDate:te,maxDate:q}=ee.current,F=Ue(W,te,q);F.getTime()!==k.current.getTime()&&(k.current=F,T(F),ne.current?.(F))},[]),ce=o.useCallback(W=>{const{minDate:te,maxDate:q,allowedDates:F}=ee.current,p=vt(F,t,te,q);if(p.length>0){C(Ur(p,t,k.current,W));return}C(Ee(t,k.current,W))},[t,C]),oe=o.useCallback(()=>{C(w.current)},[C]),$=o.useMemo(()=>({value:L,onChange:C,minDate:r,maxDate:n,unit:t}),[L,C,r,n,t]),V=o.useMemo(()=>({...u,mode:"point",unit:t,value:L,minDate:r,maxDate:n,onChangePoint:C}),[u,t,L,r,n,C]);return{value:L,setValue:T,shiftValue:ce,resetValue:oe,selectorProps:$,sliderProps:V}}function Ha(e){const{unit:t,minDate:r,maxDate:n,initialMacroRange:a,initialMicroRange:c,macroUnit:l=t,microUnit:u=t,onChangeMacroRange:w,onChangeMicroRange:f,...T}=e;Wr("useVernierSliderRange",r,n),Hr("useVernierSliderRange","initialMacroRange",a),Hr("useVernierSliderRange","initialMicroRange",c),Or("useVernierSliderRange","initialMacroRange",a,r,n,"[minDate, maxDate]");const L=ht(l,u,a,r,n);Or("useVernierSliderRange","initialMicroRange",c,L[0],L[1],"the initial macro window");const s=Br(T),k=o.useRef(a),ee=o.useRef(c),[ne,C]=o.useState(a),[ce,oe]=o.useState(c);let $=ne;const V=[Ue(ne[0],r,n),Ue(ne[1],r,n)];(V[0]!==ne[0]||V[1]!==ne[1])&&($=V,C(V));const W=o.useMemo(()=>ht(l,u,$,r,n),[l,u,$,r,n]),te=o.useMemo(()=>Fr(W,u,s.microIsDiscrete,s.microAllowedDates??s.allowedDates,r,n),[W,u,s.microIsDiscrete,s.microAllowedDates,s.allowedDates,r,n]),q=o.useMemo(()=>s.macroIsDiscrete===!0?vt(s.macroAllowedDates??s.allowedDates,l,r,n):[],[s.macroIsDiscrete,s.macroAllowedDates,s.allowedDates,l,r,n]),F=o.useRef(q);F.current=q;let p=ce;const D=Yr(ce,u,W,te);(D[0]!==ce[0]||D[1]!==ce[1])&&(p=D,oe(D));const y=o.useRef($);y.current=$;const E=o.useRef(p);E.current=p;const P=o.useRef({minDate:r,maxDate:n,macroIsDiscrete:s.macroIsDiscrete,macroAllowedDates:s.macroAllowedDates,microIsDiscrete:s.microIsDiscrete,microAllowedDates:s.microAllowedDates,allowedDates:s.allowedDates});P.current={minDate:r,maxDate:n,macroIsDiscrete:s.macroIsDiscrete,macroAllowedDates:s.macroAllowedDates,microIsDiscrete:s.microIsDiscrete,microAllowedDates:s.microAllowedDates,allowedDates:s.allowedDates};const G=o.useRef(w);G.current=w;const me=o.useRef(f);me.current=f;const B=o.useCallback(b=>{const{minDate:S,maxDate:j}=P.current;return ht(l,u,b,S,j)},[l,u]),Z=o.useCallback(b=>{const{microIsDiscrete:S,microAllowedDates:j,allowedDates:Me,minDate:A,maxDate:K}=P.current;return Fr(b,u,S,j??Me,A,K)},[u]),se=o.useCallback((b,S)=>{const j=y.current,Me=E.current;(b[0].getTime()!==j[0].getTime()||b[1].getTime()!==j[1].getTime())&&(y.current=b,C(b),G.current?.(b[0],b[1])),(S[0].getTime()!==Me[0].getTime()||S[1].getTime()!==Me[1].getTime())&&(E.current=S,oe(S),me.current?.(S[0],S[1]))},[]),_=o.useCallback((b,S)=>{const{minDate:j,maxDate:Me}=P.current,A=[Ue(b,j,Me),Ue(S,j,Me)],K=B(A);se(A,Yr(E.current,u,K,Z(K)))},[u,B,Z,se]),z=o.useCallback((b,S)=>{const j=B(y.current);se(y.current,Yr([b,S],u,j,Z(j)))},[u,B,Z,se]),re=o.useCallback(b=>{const S=y.current[1],j=b>S?b:S;_(b,j)},[_]),ie=o.useCallback(b=>{const S=y.current[0],j=b<S?b:S;_(j,b)},[_]),We=o.useCallback(b=>{const S=E.current[1],j=b>S?b:S;z(b,j)},[z]),Se=o.useCallback(b=>{const S=E.current[0],j=b<S?b:S;z(j,b)},[z]),Le=o.useCallback(b=>{const{minDate:S,maxDate:j}=P.current,Me=y.current,A=F.current;if(A.length>0){const Ne=be(A,Me[0],l)+b,He=be(A,Me[1],l)+b;if(Ne<0||He>A.length-1)return;_(A[Ne],A[He]);return}const K=Ee(l,Me[0],b),Ce=Ee(l,Me[1],b);K<S||Ce>j||_(K,Ce)},[l,_]),ye=o.useCallback(b=>{const S=y.current,j=E.current,Me=B(S),[A,K]=Me,Ce=Z(Me);if(Ce.length>0){const fe=be(Ce,j[0],u)+b,we=be(Ce,j[1],u)+b;if(fe<0||we>Ce.length-1)return;z(Ce[fe],Ce[we]);return}const Ne=Ee(u,j[0],b),He=Ee(u,j[1],b);Ne<A||He>K||z(Ne,He)},[u,B,Z,z]),Ge=o.useCallback(()=>{const b=k.current,S=B(b);se(b,Yr(ee.current,u,S,Z(S)))},[u,B,Z,se]),[Ze,at]=W,Ve=o.useMemo(()=>({value:$[0],onChange:re,minDate:r,maxDate:$[1],unit:l}),[$,re,r,l]),st=o.useMemo(()=>({value:$[1],onChange:ie,minDate:$[0],maxDate:n,unit:l}),[$,ie,n,l]),X=o.useMemo(()=>({value:p[0],onChange:We,minDate:Ze,maxDate:p[1],unit:u}),[p,We,Ze,u]),Q=o.useMemo(()=>({value:p[1],onChange:Se,minDate:p[0],maxDate:at,unit:u}),[p,Se,at,u]),ge=o.useMemo(()=>({...s,mode:"vernier",unit:t,macroUnit:l,microUnit:u,minDate:r,maxDate:n,macroRange:$,microRange:p,onChangeMacroRange:_,onChangeMicroRange:z}),[s,t,l,u,r,n,$,p,_,z]);return{macroRange:$,setMacroRange:C,microRange:p,setMicroRange:oe,setMacroLowerDate:re,setMacroUpperDate:ie,setMicroLowerDate:We,setMicroUpperDate:Se,shiftMacroRange:Le,shiftMicroRange:ye,resetVernier:Ge,macroStartSelectorProps:Ve,macroEndSelectorProps:st,microStartSelectorProps:X,microEndSelectorProps:Q,sliderProps:ge}}function ja(e){const{unit:t,minDate:r,maxDate:n,initialMacroRange:a,initialMicroValue:c,macroUnit:l=t,microUnit:u=t,onChangeMacroRange:w,onChangeMicroPoint:f,...T}=e;Wr("useVernierSliderPoint",r,n),Hr("useVernierSliderPoint","initialMacroRange",a),nr("useVernierSliderPoint","initialMicroValue",c),Or("useVernierSliderPoint","initialMacroRange",a,r,n,"[minDate, maxDate]");const L=ht(l,u,a,r,n);jr("useVernierSliderPoint","initialMicroValue",c,L[0],L[1],"the initial macro window");const s=Br(T),k=o.useRef(a),ee=o.useRef(c),[ne,C]=o.useState(a),[ce,oe]=o.useState(c);let $=ne;const V=[Ue(ne[0],r,n),Ue(ne[1],r,n)];(V[0]!==ne[0]||V[1]!==ne[1])&&($=V,C(V));const W=o.useMemo(()=>ht(l,u,$,r,n),[l,u,$,r,n]),te=o.useMemo(()=>Fr(W,u,s.microIsDiscrete,s.microAllowedDates??s.allowedDates,r,n),[W,u,s.microIsDiscrete,s.microAllowedDates,s.allowedDates,r,n]),q=o.useMemo(()=>s.macroIsDiscrete===!0?vt(s.macroAllowedDates??s.allowedDates,l,r,n):[],[s.macroIsDiscrete,s.macroAllowedDates,s.allowedDates,l,r,n]),F=o.useRef(q);F.current=q;let p=ce;const D=rr(ce,u,W,te);D!==ce&&(p=D,oe(D));const y=o.useRef($);y.current=$;const E=o.useRef(p);E.current=p;const P=o.useRef({minDate:r,maxDate:n,macroIsDiscrete:s.macroIsDiscrete,macroAllowedDates:s.macroAllowedDates,microIsDiscrete:s.microIsDiscrete,microAllowedDates:s.microAllowedDates,allowedDates:s.allowedDates});P.current={minDate:r,maxDate:n,macroIsDiscrete:s.macroIsDiscrete,macroAllowedDates:s.macroAllowedDates,microIsDiscrete:s.microIsDiscrete,microAllowedDates:s.microAllowedDates,allowedDates:s.allowedDates};const G=o.useRef(w);G.current=w;const me=o.useRef(f);me.current=f;const B=o.useCallback(X=>{const{minDate:Q,maxDate:ge}=P.current;return ht(l,u,X,Q,ge)},[l,u]),Z=o.useCallback(X=>{const{microIsDiscrete:Q,microAllowedDates:ge,allowedDates:b,minDate:S,maxDate:j}=P.current;return Fr(X,u,Q,ge??b,S,j)},[u]),se=o.useCallback((X,Q)=>{const ge=y.current,b=E.current;(X[0].getTime()!==ge[0].getTime()||X[1].getTime()!==ge[1].getTime())&&(y.current=X,C(X),G.current?.(X[0],X[1])),Q.getTime()!==b.getTime()&&(E.current=Q,oe(Q),me.current?.(Q))},[]),_=o.useCallback((X,Q)=>{const{minDate:ge,maxDate:b}=P.current,S=[Ue(X,ge,b),Ue(Q,ge,b)],j=B(S);se(S,rr(E.current,u,j,Z(j)))},[u,B,Z,se]),z=o.useCallback(X=>{const Q=B(y.current);se(y.current,rr(X,u,Q,Z(Q)))},[u,B,Z,se]),re=o.useCallback(X=>{const Q=y.current[1],ge=X>Q?X:Q;_(X,ge)},[_]),ie=o.useCallback(X=>{const Q=y.current[0],ge=X<Q?X:Q;_(ge,X)},[_]),We=o.useCallback(X=>{const{minDate:Q,maxDate:ge}=P.current,b=y.current,S=F.current;if(S.length>0){const A=be(S,b[0],l)+X,K=be(S,b[1],l)+X;if(A<0||K>S.length-1)return;_(S[A],S[K]);return}const j=Ee(l,b[0],X),Me=Ee(l,b[1],X);j<Q||Me>ge||_(j,Me)},[l,_]),Se=o.useCallback(X=>{const Q=y.current,ge=B(Q),b=Z(ge);if(b.length>0){z(Ur(b,u,E.current,X));return}z(Ee(u,E.current,X))},[u,B,Z,z]),Le=o.useCallback(()=>{const X=k.current,Q=B(X);se(X,rr(ee.current,u,Q,Z(Q)))},[u,B,Z,se]),[ye,Ge]=W,Ze=o.useMemo(()=>({value:$[0],onChange:re,minDate:r,maxDate:$[1],unit:l}),[$,re,r,l]),at=o.useMemo(()=>({value:$[1],onChange:ie,minDate:$[0],maxDate:n,unit:l}),[$,ie,n,l]),Ve=o.useMemo(()=>({value:p,onChange:z,minDate:ye,maxDate:Ge,unit:u}),[p,z,ye,Ge,u]),st=o.useMemo(()=>({...s,mode:"vernier",unit:t,macroUnit:l,microUnit:u,minDate:r,maxDate:n,macroRange:$,microValue:p,onChangeMacroRange:_,onChangeMicroPoint:z}),[s,t,l,u,r,n,$,p,_,z]);return{macroRange:$,setMacroRange:C,microValue:p,setMicroValue:oe,setMacroLowerDate:re,setMacroUpperDate:ie,setMicroDate:z,shiftMacroRange:We,shiftMicroValue:Se,resetVernier:Le,macroStartSelectorProps:Ze,macroEndSelectorProps:at,microSelectorProps:Ve,sliderProps:st}}function lo(e){const t=new Date(e,0,1);return t.setFullYear(e),t}function Vr(e,t){if(e!==void 0&&(!(e instanceof Date)||Number.isNaN(e.getTime())))throw new RangeError(`YearSelector: \`${t}\` must be a valid Date, received ${String(e)}.`)}function so(e,t){if(e!==void 0&&!Number.isInteger(e))throw new RangeError(`YearSelector: \`${t}\` must be an integer year, received ${String(e)}.`)}function Oa(e){if(e!==void 0)try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{throw new RangeError(`YearSelector: \`locale\` must be a valid BCP 47 language tag, received ${JSON.stringify(e)}.`)}}function co(e,t,r){const n=e===void 0?null:e,a=t===void 0?null:t.getFullYear();return n!==null&&a!==null?r(n,a):n!==null?n:a}const Fa=e=>{const{value:t,initialDate:r,onChange:n,children:a,minYear:c,maxYear:l,minDate:u,maxDate:w,className:f="",style:T,disabled:L=!1,prevYearAriaLabel:s="Previous year",nextYearAriaLabel:k="Next year",selectAriaLabel:ee="Year",locale:ne}=e;Vr(t,"value"),Vr(r,"initialDate"),Vr(u,"minDate"),Vr(w,"maxDate"),so(c,"minYear"),so(l,"maxYear"),Oa(ne);const C=t??r;if(C===void 0)throw new RangeError("YearSelector: either `value` (controlled) or `initialDate` (uncontrolled) is required; the selected year is never inferred from the wall clock.");const[ce,oe]=o.useState(()=>C.getFullYear()),$=u?.getTime(),V=w?.getTime(),W=o.useMemo(()=>co(c,u,Math.max),[c,$]),te=o.useMemo(()=>co(l,w,Math.min),[l,V]);if(W===null||te===null)throw new RangeError("YearSelector: a lower bound (`minYear` or `minDate`) and an upper bound (`maxYear` or `maxDate`) are both required; the year option list is never invented.");if(W>te)throw new RangeError(`YearSelector: the resolved lower bound ${W} is after the resolved upper bound ${te}.`);const q=t!==void 0,F=t!==void 0?t.getFullYear():ce,p=F<W||F>te,D=C.getTime();o.useEffect(()=>{q||oe(C.getFullYear())},[q,D]);const y=z=>z>=W&&z<=te,E=z=>{if(!L){if(!y(z))throw new RangeError(`YearSelector: refusing to emit ${z}, which lies outside the declared bounds ${W}-${te}.`);q||oe(z),n?.(lo(z),z)}},P=y(F-1)?F-1:null,G=y(F+1)?F+1:null,me=L||P===null,B=L||G===null,Z=()=>{P!==null&&E(P)},se=()=>{G!==null&&E(G)},_=o.useMemo(()=>{const z=[];for(let re=te;re>=W;re--)z.push(re);return p&&(z.push(F),z.sort((re,ie)=>ie-re)),z},[W,te,p,F]);return h.jsxs("div",{className:`inline-flex w-32 items-center ${f}`,style:T,children:[h.jsx("button",{type:"button","aria-label":s,disabled:me,className:"relative my-auto inline-flex h-5 w-4 cursor-pointer items-center justify-center rounded p-0 after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:opacity-40",onClick:Z,children:h.jsx("span",{className:"h-0 w-0 border-y-[6px] border-y-transparent border-r-[6px] border-r-slate-500 border-solid hover:border-r-slate-700 dark:border-r-slate-400 dark:hover:border-r-slate-200"})}),h.jsx("select",{"aria-label":ee,disabled:L,className:"mx-1 my-auto w-18 appearance-none rounded-md border border-gray-300 bg-gray-100 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums [text-align-last:center] [text-align:center] focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500",value:F,onChange:z=>{if(!z.target.value)return;const re=Number(z.target.value);Number.isInteger(re)&&E(re)},children:_.map(z=>h.jsx("option",{value:z,className:"text-center font-mono text-gray-900 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-100",children:qe("year",lo(z),void 0,ne)},z))}),h.jsx("button",{type:"button","aria-label":k,disabled:B,className:"relative my-auto inline-flex h-5 w-4 cursor-pointer items-center justify-center rounded p-0 after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:opacity-40",onClick:se,children:h.jsx("span",{className:"h-0 w-0 border-y-[6px] border-y-transparent border-l-[6px] border-l-slate-500 border-solid hover:border-l-slate-700 dark:border-l-slate-400 dark:hover:border-l-slate-200"})}),a]})},$o=o.memo(Fa,(e,t)=>{const r=e.value??e.initialDate,n=t.value??t.initialDate,a=r?r.getFullYear():null,c=n?n.getFullYear():null;return!(a!==c||e.disabled!==t.disabled||e.className!==t.className||e.style!==t.style||e.minYear!==t.minYear||e.maxYear!==t.maxYear||e.minDate?.getFullYear()!==t.minDate?.getFullYear()||e.maxDate?.getFullYear()!==t.maxDate?.getFullYear()||e.onChange!==t.onChange||e.children!==t.children||e.prevYearAriaLabel!==t.prevYearAriaLabel||e.nextYearAriaLabel!==t.nextYearAriaLabel||e.selectAriaLabel!==t.selectAriaLabel||e.locale!==t.locale)});$o.displayName="YearSelector";exports.COLOR_SCHEME_PALETTES=uo;exports.DateSelector=Lo;exports.MonthSelector=Co;exports.PeriodSlider=So;exports.YearSelector=$o;exports.addUnit=Ee;exports.areStylesEqual=To;exports.calculateConnectDragValues=ho;exports.calculateHandleDragValues=hn;exports.calculateKeyboardActionValues=bo;exports.calculateLabelSlant=Mn;exports.calculateVernierMacroDrag=yo;exports.calculateVernierMicroDrag=Ro;exports.decode=ae;exports.encode=de;exports.findNearestDateIndex=be;exports.formatLabel=qe;exports.formatScreenReaderLabel=Yt;exports.getActiveDragHandle=go;exports.getMacroWindowEndDate=fo;exports.getMacroWindowStartDate=mo;exports.getSortedAllowedDates=vt;exports.normalizeDateByUnit=Ke;exports.resolveMacroWindow=ht;exports.resolveVernierRailZone=xn;exports.resolveVernierTargetHandle=po;exports.resolveWheelStep=vo;exports.usePeriodSliderPoint=Va;exports.usePeriodSliderRange=Ya;exports.useVernierSliderPoint=ja;exports.useVernierSliderRange=Ha;
|
package/dist/index.d.cts
CHANGED
|
@@ -19,10 +19,10 @@ export type { DateSelectorProps } from './DateSelector.js';
|
|
|
19
19
|
export { DateSelector } from './DateSelector.js';
|
|
20
20
|
export type { MonthSelectorProps } from './MonthSelector.js';
|
|
21
21
|
export { MonthSelector } from './MonthSelector.js';
|
|
22
|
-
export type { AccessibleSliderLabels, BasePeriodSliderProps, ColorSchemePalette, ConnectDragValueOptions, LabelSlantConfig, LabelSlantResult, PeriodSliderColorScheme, PeriodSliderLabelPosition, PeriodSliderPointProps, PeriodSliderProps, PeriodSliderRangeProps, PeriodSliderSnapMode, PeriodSliderUnit, PeriodSliderVernierProps, VernierHandle, } from './PeriodSlider.js';
|
|
23
|
-
export { addUnit, areStylesEqual, COLOR_SCHEME_PALETTES, calculateConnectDragValues, calculateHandleDragValues, calculateKeyboardActionValues, calculateLabelSlant, calculateVernierMacroDrag, calculateVernierMicroDrag, decode, encode, findNearestDateIndex, formatLabel, formatScreenReaderLabel, getActiveDragHandle, getMacroWindowEndDate, getSortedAllowedDates, normalizeDateByUnit, PeriodSlider, resolveVernierTargetHandle, } from './PeriodSlider.js';
|
|
24
|
-
export type { SelectorProps, UsePeriodSliderPointOptions, UsePeriodSliderPointReturn, UsePeriodSliderRangeOptions, UsePeriodSliderRangeReturn,
|
|
25
|
-
export { usePeriodSliderPoint, usePeriodSliderRange,
|
|
22
|
+
export type { AccessibleSliderLabels, BasePeriodSliderProps, BasePeriodSliderVernierProps, ColorSchemePalette, ConnectDragValueOptions, LabelSlantConfig, LabelSlantResult, PeriodSliderColorScheme, PeriodSliderLabelPosition, PeriodSliderPointProps, PeriodSliderProps, PeriodSliderRangeProps, PeriodSliderSnapMode, PeriodSliderUnit, PeriodSliderVernierPointProps, PeriodSliderVernierProps, PeriodSliderVernierRangeProps, VernierHandle, VernierMicroShape, } from './PeriodSlider.js';
|
|
23
|
+
export { addUnit, areStylesEqual, COLOR_SCHEME_PALETTES, calculateConnectDragValues, calculateHandleDragValues, calculateKeyboardActionValues, calculateLabelSlant, calculateVernierMacroDrag, calculateVernierMicroDrag, decode, encode, findNearestDateIndex, formatLabel, formatScreenReaderLabel, getActiveDragHandle, getMacroWindowEndDate, getMacroWindowStartDate, getSortedAllowedDates, normalizeDateByUnit, PeriodSlider, resolveMacroWindow, resolveVernierRailZone, resolveVernierTargetHandle, resolveWheelStep, } from './PeriodSlider.js';
|
|
24
|
+
export type { SelectorProps, UsePeriodSliderPointOptions, UsePeriodSliderPointReturn, UsePeriodSliderRangeOptions, UsePeriodSliderRangeReturn, UseVernierSliderPointOptions, UseVernierSliderPointReturn, UseVernierSliderRangeOptions, UseVernierSliderRangeReturn, } from './usePeriodSlider.js';
|
|
25
|
+
export { usePeriodSliderPoint, usePeriodSliderRange, useVernierSliderPoint, useVernierSliderRange, } from './usePeriodSlider.js';
|
|
26
26
|
export type { YearSelectorProps } from './YearSelector.js';
|
|
27
27
|
export { YearSelector } from './YearSelector.js';
|
|
28
28
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -19,10 +19,10 @@ export type { DateSelectorProps } from './DateSelector.js';
|
|
|
19
19
|
export { DateSelector } from './DateSelector.js';
|
|
20
20
|
export type { MonthSelectorProps } from './MonthSelector.js';
|
|
21
21
|
export { MonthSelector } from './MonthSelector.js';
|
|
22
|
-
export type { AccessibleSliderLabels, BasePeriodSliderProps, ColorSchemePalette, ConnectDragValueOptions, LabelSlantConfig, LabelSlantResult, PeriodSliderColorScheme, PeriodSliderLabelPosition, PeriodSliderPointProps, PeriodSliderProps, PeriodSliderRangeProps, PeriodSliderSnapMode, PeriodSliderUnit, PeriodSliderVernierProps, VernierHandle, } from './PeriodSlider.js';
|
|
23
|
-
export { addUnit, areStylesEqual, COLOR_SCHEME_PALETTES, calculateConnectDragValues, calculateHandleDragValues, calculateKeyboardActionValues, calculateLabelSlant, calculateVernierMacroDrag, calculateVernierMicroDrag, decode, encode, findNearestDateIndex, formatLabel, formatScreenReaderLabel, getActiveDragHandle, getMacroWindowEndDate, getSortedAllowedDates, normalizeDateByUnit, PeriodSlider, resolveVernierTargetHandle, } from './PeriodSlider.js';
|
|
24
|
-
export type { SelectorProps, UsePeriodSliderPointOptions, UsePeriodSliderPointReturn, UsePeriodSliderRangeOptions, UsePeriodSliderRangeReturn,
|
|
25
|
-
export { usePeriodSliderPoint, usePeriodSliderRange,
|
|
22
|
+
export type { AccessibleSliderLabels, BasePeriodSliderProps, BasePeriodSliderVernierProps, ColorSchemePalette, ConnectDragValueOptions, LabelSlantConfig, LabelSlantResult, PeriodSliderColorScheme, PeriodSliderLabelPosition, PeriodSliderPointProps, PeriodSliderProps, PeriodSliderRangeProps, PeriodSliderSnapMode, PeriodSliderUnit, PeriodSliderVernierPointProps, PeriodSliderVernierProps, PeriodSliderVernierRangeProps, VernierHandle, VernierMicroShape, } from './PeriodSlider.js';
|
|
23
|
+
export { addUnit, areStylesEqual, COLOR_SCHEME_PALETTES, calculateConnectDragValues, calculateHandleDragValues, calculateKeyboardActionValues, calculateLabelSlant, calculateVernierMacroDrag, calculateVernierMicroDrag, decode, encode, findNearestDateIndex, formatLabel, formatScreenReaderLabel, getActiveDragHandle, getMacroWindowEndDate, getMacroWindowStartDate, getSortedAllowedDates, normalizeDateByUnit, PeriodSlider, resolveMacroWindow, resolveVernierRailZone, resolveVernierTargetHandle, resolveWheelStep, } from './PeriodSlider.js';
|
|
24
|
+
export type { SelectorProps, UsePeriodSliderPointOptions, UsePeriodSliderPointReturn, UsePeriodSliderRangeOptions, UsePeriodSliderRangeReturn, UseVernierSliderPointOptions, UseVernierSliderPointReturn, UseVernierSliderRangeOptions, UseVernierSliderRangeReturn, } from './usePeriodSlider.js';
|
|
25
|
+
export { usePeriodSliderPoint, usePeriodSliderRange, useVernierSliderPoint, useVernierSliderRange, } from './usePeriodSlider.js';
|
|
26
26
|
export type { YearSelectorProps } from './YearSelector.js';
|
|
27
27
|
export { YearSelector } from './YearSelector.js';
|
|
28
28
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,YAAY,EACR,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,yBAAyB,EACzB,sBAAsB,EACtB,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,EAChB,wBAAwB,EACxB,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,YAAY,EACR,sBAAsB,EACtB,qBAAqB,EACrB,4BAA4B,EAC5B,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,yBAAyB,EACzB,sBAAsB,EACtB,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,EAChB,6BAA6B,EAC7B,wBAAwB,EACxB,6BAA6B,EAC7B,aAAa,EACb,iBAAiB,GACpB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACH,OAAO,EACP,cAAc,EACd,qBAAqB,EACrB,0BAA0B,EAC1B,yBAAyB,EACzB,6BAA6B,EAC7B,mBAAmB,EACnB,yBAAyB,EACzB,yBAAyB,EACzB,MAAM,EACN,MAAM,EACN,oBAAoB,EACpB,WAAW,EACX,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,EAC1B,gBAAgB,GACnB,MAAM,gBAAgB,CAAA;AAIvB,YAAY,EACR,aAAa,EACb,2BAA2B,EAC3B,0BAA0B,EAC1B,2BAA2B,EAC3B,0BAA0B,EAC1B,4BAA4B,EAC5B,2BAA2B,EAC3B,4BAA4B,EAC5B,2BAA2B,GAC9B,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACH,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,GACxB,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA"}
|