@aiquants/period-slider 0.8.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 +18 -11
- package/dist/MonthSelector.d.ts.map +1 -1
- package/dist/PeriodSlider.d.ts +78 -0
- package/dist/PeriodSlider.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1751 -1617
- package/dist/styles/period-slider.css +1 -1
- package/dist/styles/period-slider.standalone.css +1 -1
- package/dist/usePeriodSlider.d.ts +13 -11
- package/dist/usePeriodSlider.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/DateSelector.tsx +1 -1
- package/src/MonthSelector.tsx +4 -1
- package/src/PeriodSlider.tsx +376 -70
- package/src/index.ts +7 -3
- package/src/styles/period-slider.css +25 -0
- package/src/usePeriodSlider.ts +218 -78
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react/jsx-runtime"),Ne=require("date-fns"),a=require("react"),Wn={"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"}},gt=e=>e instanceof Date&&!Number.isNaN(e.getTime()),De=e=>e instanceof Date?Number.isNaN(e.getTime())?"Invalid Date":e.toISOString():String(e),tt=(e,t)=>{if(!gt(t))throw new RangeError(`normalizeDateByUnit: d must be a valid Date (received: ${De(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},ee=(e,t)=>{const r=tt(e,t),n=r.getFullYear(),o=r.getMonth()+1,s=r.getDate();if(e==="year")return n;if(e==="month")return n*12+(o-1);const i=new Date(0);return i.setUTCFullYear(n,o-1,s),i.setUTCHours(0,0,0,0),Math.floor(i.getTime()/(1440*60*1e3))},de=(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 o=Math.floor(t/12),s=t-o*12;return r.setFullYear(o,s,1),r}const n=new Date(t*24*60*60*1e3);return r.setFullYear(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()),r},ke=(e,t,r)=>{if(!gt(t))throw new RangeError(`addUnit: d must be a valid Date (received: ${De(t)})`);return e==="year"?Ne.addYears(t,r):e==="month"?Ne.addMonths(t,r):Ne.addDays(t,r)},qe=(e,t,r)=>{if(!gt(r))throw new RangeError(`getMacroWindowEndDate: d must be a valid Date (received: ${De(r)})`);if(e===t)return tt(t,r);const n=r.getFullYear(),o=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,o+1,0):tt(t,r)},Oa={year:{year:"numeric"},month:{year:"numeric",month:"2-digit"},day:{year:"numeric",month:"2-digit",day:"2-digit"}},Hn=new Map,Fa=(e,t)=>{const r=`${e}\0${t}`,n=Hn.get(r);if(n!==void 0)return n;const o=new Intl.DateTimeFormat(t,Oa[e]);return Hn.set(r,o),o},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 o=String(t.getDate()).padStart(2,"0");return`${r}-${n}-${o}`},Ue=(e,t,r,n)=>gt(t)?r?r(t):n===void 0?Ua(e,t):Fa(e,n).format(t):"",St=(e,t,r,n)=>Ue(e,t,r,n),Te=(e,t,r)=>{if(!e||e.length===0||e.length===1)return 0;const n=ee(r,t);let o=0,s=e.length-1;if(n<=ee(r,e[o]))return 0;if(n>=ee(r,e[s]))return s;for(;o<=s;){const h=o+s>>1,f=ee(r,e[h]);if(f===n)return h;f<n?o=h+1:s=h-1}const i=Math.abs(ee(r,e[o])-n),c=Math.abs(ee(r,e[s])-n);return i<c?o:s},$t=(e,t,r,n)=>{if(!Array.isArray(e)||e.length===0)return[];const o=ee(t,r),s=ee(t,n),i=new Map;for(const c of e){const h=tt(t,c),f=ee(t,h);f<o||f>s||i.has(f)||i.set(f,h)}if(i.size===0)throw new RangeError(`getSortedAllowedDates: every allowedDates entry falls outside [minDate, maxDate] (minDate: ${De(r)}, maxDate: ${De(n)}, entries: ${e.length})`);return Array.from(i.keys()).sort((c,h)=>c-h).map(c=>i.get(c))},Sr=(e,t,r,n)=>{const o=e.length-1;if(o<=0)return 0;const s=Te(e,n,t);if(r==="time"){const i=e[0].getTime(),c=e[o].getTime()-i;return c<=0?0:Math.max(0,Math.min(1,(e[s].getTime()-i)/c))}return s/o},Lr=(e,t,r,n)=>{const o=e.length-1;if(o<=0)return 0;const s=Math.max(0,Math.min(1,n));if(r==="time"){const i=e[0].getTime(),c=e[o].getTime()-i;return c<=0?0:Te(e,new Date(i+s*c),t)}return Math.max(0,Math.min(o,Math.round(s*o)))},nn=(e,t,r,n,o,s,i)=>{let c=r,h=n;return i?(c=t,h=t):e==="low"?t>n?(c=n,h=t):c=t:t<r?(h=r,c=t):h=t,[Math.max(o,Math.min(s,c)),Math.max(o,Math.min(s,h))]},Gn=(e,t,r,n,o)=>o?"low":e==="low"?t>n?"high":"low":t<r?"low":"high",Jn=({posDiffPct:e,startLowVal:t,startHighVal:r,rangeMin:n,rangeMax:o,isDiscrete:s,sortedAllowedDates:i,snapMode:c,unit:h})=>{if(s){const E=i.length-1;if(E<=0)return[0,0];const W=Math.max(0,Math.min(E,Math.round(t))),y=Math.max(W,Math.min(E,Math.round(r)));if(c==="time"){const p=i[0].getTime(),F=i[E].getTime(),Y=i[W].getTime(),A=i[y].getTime()-Y;let V=Y+e*(F-p),j=V+A;V<p&&(V=p,j=p+A),j>F&&(j=F,V=F-A);const D=Te(i,new Date(V),h),$=Te(i,new Date(j),h);return[D,Math.max(D,$)]}const oe=Math.round(e*E);let R=W+oe,X=y+oe;return R<0&&(X+=-R,R=0),X>E&&(R-=X-E,X=E),[Math.max(0,Math.min(E,R)),Math.max(0,Math.min(E,X))]}const f=E=>Math.max(n,Math.min(o,E)),T=o-n;if(T<=0)return[f(t),f(r)];const v=Math.round(e*T);let d=t+v,P=r+v;return d<n&&(P+=n-d,d=n),P>o&&(d-=P-o,P=o),[f(d),f(P)]},Zn=(e,t,r,n,o,s,i,c)=>{let h=0,f=!1,T=!1;switch(e){case"ArrowRight":case"ArrowUp":h=c;break;case"ArrowLeft":case"ArrowDown":h=-c;break;case"PageUp":h=c*5;break;case"PageDown":h=-c*5;break;case"Home":f=!0;break;case"End":T=!0;break;default:return null}if(i){let P=r;return f?P=o:T?P=s:P=Math.max(o,Math.min(s,r+h)),[P,P]}let v=r,d=n;return t==="low"?f?v=o:T?v=n:v=Math.max(o,Math.min(n,r+h)):f?d=r:T?d=s:d=Math.max(r,Math.min(s,n+h)),[v,d]},Qn=8,ea=2,ta=16,Ba=12,za=90,on=(e,t)=>{const r=t?.estimatedHeightPx??ta,o=Qn+(t?.anchorGapY??ea)+r/2,s=e==="top"?-o:o;return{lowAngleDeg:0,highAngleDeg:0,lowOffsetX:0,highOffsetX:0,lowOffsetY:s,highOffsetY:s,isSlanted:!1,proximity:0}},ln=(e,t,r,n="top",o)=>{const s=o?.estimatedWidthPx,i=o?.estimatedHeightPx??ta,c=o?.paddingPx??Ba,h=o?.maxAngleDeg??za,f=Qn+(o?.anchorGapY??ea),T=on(n,o);if(!(Number.isFinite(r)&&r>0)||s===void 0||!Number.isFinite(s)||s<=0)return T;const v=Math.max(0,t-e)/100*r,d=s+c;if(v>=d)return T;const P=Math.max(0,Math.min(1,(d-v)/d)),W=P*P*P*(P*(P*6-15)+10)*h,y=n==="top"?-W:W,oe=W*Math.PI/180,R=s/2*Math.abs(Math.sin(oe))+i/2*Math.abs(Math.cos(oe)),X=f+R,p=n==="top"?-X:+X,F=s*Math.abs(Math.cos(oe))+i*Math.abs(Math.sin(oe)),Y=Math.max(0,(F+c-v)/2);return{lowAngleDeg:y,highAngleDeg:y,lowOffsetX:-Y,highOffsetX:Y,lowOffsetY:p,highOffsetY:p,isSlanted:P>.001,proximity:P}},ra=e=>({...e,lowOffsetX:0,highOffsetX:0});function na(e,t,r,n,o,s,i="macro-top",c=.05,h=!0,f="range"){const T=i==="macro-top"||i==="macro-left",v=t<=0;if(T&&v||!(T||v)){const E=Math.abs(e-r),W=Math.abs(e-n);return E<=c&&E<=W?"macro-low":W<=c&&W<E?"macro-high":h&&e>=r&&e<=n?"macro-connect":E<W?"macro-low":"macro-high"}if(f==="point")return"micro-point";const d=Math.abs(e-o),P=Math.abs(e-s);return d<=c&&d<=P?"micro-low":P<=c&&P<d?"micro-high":h&&e>=o&&e<=s?"micro-connect":d<P?"micro-low":"micro-high"}function aa(e,t,r,n,o){if(e==="macro-connect"){const i=t-r,c=o-n,h=Math.max(0,Math.min(1-c,n+i)),f=h+c;return[h,f,"macro-connect"]}if(e==="macro-low"){const i=Math.max(0,Math.min(1,t));return i>o?[o,i,"macro-high"]:[i,o,"macro-low"]}const s=Math.max(0,Math.min(1,t));return s<n?[s,n,"macro-low"]:[n,s,"macro-high"]}function oa(e,t,r,n,o){if(e==="micro-point"){const i=Math.max(0,Math.min(1,t));return[i,i,"micro-point"]}if(e==="micro-connect"){const i=t-r,c=o-n,h=Math.max(0,Math.min(1-c,n+i)),f=h+c;return[h,f,"micro-connect"]}if(e==="micro-low"){const i=Math.max(0,Math.min(1,t));return i>o?[o,i,"micro-high"]:[i,o,"micro-low"]}const s=Math.max(0,Math.min(1,t));return s<n?[s,n,"micro-low"]:[n,s,"micro-high"]}const cr=a.memo(({type:e,isTop:t=!0,isVertical:r=!1,isLeft:n=!0})=>{let o,s;r?(o=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"}`):(o=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 i=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:o,className:i,shapeRendering:"geometricPrecision",strokeWidth:"1.25"})})});cr.displayName="VernierKnobSvg";const _a=(e,t)=>{if(!gt(e))throw new RangeError(`PeriodSlider: minDate is required and must be a valid Date (received: ${De(e)})`);if(!gt(t))throw new RangeError(`PeriodSlider: maxDate is required and must be a valid Date (received: ${De(t)})`);if(t.getTime()<=e.getTime())throw new RangeError(`PeriodSlider: maxDate must be strictly later than minDate (minDate: ${De(e)}, maxDate: ${De(t)})`)},Cr=(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: ${De(t)})`);const[r,n]=t;if(!gt(r))throw new RangeError(`PeriodSlider: ${e}[0] must be a valid Date (received: ${De(r)})`);if(!gt(n))throw new RangeError(`PeriodSlider: ${e}[1] must be a valid Date (received: ${De(n)})`);if(n.getTime()<r.getTime())throw new RangeError(`PeriodSlider: ${e} must not be inverted (start: ${De(r)}, end: ${De(n)})`)},an=(e,t)=>{if(!gt(t))throw new RangeError(`PeriodSlider: ${e} must be a valid Date (received: ${De(t)})`)},Zr=(e,t,r,n)=>{if(t.getTime()<r.getTime()||t.getTime()>n.getTime())throw new RangeError(`PeriodSlider: ${e} must lie within [minDate, maxDate] (received: ${De(t)}, minDate: ${De(r)}, maxDate: ${De(n)})`)},qa=(e,t,r)=>{if(e.mode==="range"){for(const n of["range","defaultRange"]){const o=e[n];o!==void 0&&(Cr(n,o),Zr(`${n}[0]`,o[0],t,r),Zr(`${n}[1]`,o[1],t,r))}return}if(e.mode==="point")for(const n of["value","defaultValue"]){const o=e[n];o!==void 0&&(an(n,o),Zr(n,o,t,r))}},Xa=e=>{Cr("macroRange",e.macroRange);const t=e.microRange!==void 0||e.defaultMicroRange!==void 0||e.onChangeMicroRange!==void 0,r=e.microValue!==void 0||e.defaultMicroValue!==void 0||e.onChangeMicroPoint!==void 0;if(t&&r)throw new RangeError("PeriodSlider: vernier mode takes either a micro range (microRange / defaultMicroRange / onChangeMicroRange) or a micro point (microValue / defaultMicroValue / onChangeMicroPoint), never both");if(r){if(e.microValue!==void 0)return an("microValue",e.microValue),{shape:"point",selection:[e.microValue,e.microValue]};if(e.defaultMicroValue!==void 0)return an("defaultMicroValue",e.defaultMicroValue),{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 Cr("microRange",e.microRange),{shape:"range",selection:e.microRange};if(e.defaultMicroRange!==void 0)return Cr("defaultMicroRange",e.defaultMicroRange),{shape:"range",selection:e.defaultMicroRange};throw t?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")},lr=(e,t,r,n,o,s,i,c)=>{const h=Te(e,n,t),f=Te(e,o,t);return i?h:c?f:Math.max(h,Math.min(f,Te(e,r,t)+s))},Qr=e=>{e.timerId!==null&&clearTimeout(e.timerId),e.timerId=null,e.emit=null},Ka=(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)})`)}},qt=()=>{const[e,t]=a.useState(null),r=a.useRef(null),n=a.useCallback(o=>{if(r.current?.disconnect(),r.current=null,o===null){t(null);return}if(typeof ResizeObserver>"u")return;const s=new ResizeObserver(i=>{for(const c of i){const h=c.borderBoxSize?.[0];h!==void 0&&t(f=>f!==null&&Math.abs(f.widthPx-h.inlineSize)<.5&&Math.abs(f.heightPx-h.blockSize)<.5?f:{widthPx:h.inlineSize,heightPx:h.blockSize})}});s.observe(o),r.current=s},[]);return a.useEffect(()=>()=>{r.current?.disconnect(),r.current=null},[]),[n,e]},en=(e,t)=>{if(!(e===null||t===null))return{estimatedWidthPx:Math.max(e.widthPx,t.widthPx),estimatedHeightPx:Math.max(e.heightPx,t.heightPx)}},jn=(e,t,r)=>({"--ps-tooltip-tx":`calc(-50% + ${e}px)`,"--ps-tooltip-ty":`${t}px`,"--ps-tooltip-rot":`${r}deg`}),On=(e,t,r,n,o,s,i)=>{const c=on(n,o);if(!i)return{slant:c,lowStyle:void 0,highStyle:void 0};const h=ln(e*100,t*100,r,n,o),f=s?ra(h):h;return{slant:f,lowStyle:jn(f.lowOffsetX,f.lowOffsetY-c.lowOffsetY,f.lowAngleDeg),highStyle:jn(f.highOffsetX,f.highOffsetY-c.highOffsetY,f.highAngleDeg)}},Wa={horizontal:{decrease:"◀",increase:"▶"},vertical:{decrease:"▼",increase:"▲"}},Ga={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"}},Ja=e=>{const{unit:t,minDate:r,maxDate:n,allowedDates:o,snapMode:s="index",disabled:i=!1,className:c="",showStepper:h=!0,tooltipStyle:f="always",labelPosition:T="top",autoSlantLabels:v=!0,isVertical:d=!1,hideConnectBar:P=!1,showTicks:E=!1,colorScheme:W="blue-rose",locale:y,decreaseAriaLabel:oe="Decrease",increaseAriaLabel:R="Increase"}=e;_a(r,n),qa(e,r,n),y!==void 0&&Ka("locale",y);const X=e.mode==="vernier"?Xa(e):null,p=X!==null&&X.shape==="point",F=Wn[W],Y=a.useId(),A=a.useRef(e);A.current=e;const V=r.getTime(),j=n.getTime(),D=a.useMemo(()=>$t(o,t,r,n),[o,t,V,j]),$=D.length>0,{rangeMin:S,rangeMax:x}=a.useMemo(()=>$?{rangeMin:0,rangeMax:D.length-1}:{rangeMin:ee(t,r),rangeMax:ee(t,n)},[$,D,t,V,j]),_=e.mode==="point",te=a.useCallback(l=>{if($){const u=Math.max(0,Math.min(D.length-1,Math.round(l)));return D[u]}return de(t,Math.round(l))},[$,D,t]),G=a.useCallback(l=>{if(l===void 0)return S;const u=tt(t,l);return $?Te(D,u,t):ee(t,u)},[$,D,t,S]),[ue,Me]=a.useState(()=>X===null?null:X.selection);let ie=ue??(X===null?null:X.selection);if(p&&ie!==null&&ie[0].getTime()!==ie[1].getTime()){const l=[ie[0],ie[0]];ie=l,Me(l)}const re=e.mode==="vernier"?e.microValue?.getTime():void 0,Q=a.useMemo(()=>e.mode!=="vernier"||e.microValue===void 0?null:[e.microValue,e.microValue],[e.mode,re]),he=e.mode!=="vernier"?null:p?Q??ie:e.microRange!==void 0?e.microRange:ie,Xe=e.mode==="range"?e.range?.[0]??e.defaultRange?.[0]:e.mode==="vernier"?he?.[0]:void 0,q=e.mode==="range"?e.range?.[1]??e.defaultRange?.[1]:e.mode==="vernier"?he?.[1]:void 0,J=e.mode==="point"?e.value??e.defaultValue:void 0,le=e.mode==="point"?J?.getTime():Xe?.getTime(),N=e.mode==="range"?q?.getTime():le,[U,se]=a.useMemo(()=>{if(e.mode==="point"){const m=G(J);return[m,m]}const l=G(Xe),u=G(q);return[Math.min(l,u),Math.max(l,u)]},[e.mode,le,N,G,J,Xe,q]),ge=e.mode==="point"?e.value!==void 0:e.mode==="range"?e.range!==void 0:p?e.microValue!==void 0:e.microRange!==void 0,[Se,Be]=a.useState(()=>[U,se]),[Ke,rt]=a.useState(null),[ae,pe]=a.useState(null),Ye=a.useRef(null);Ye.current=ae;const[kt,K]=a.useState("high"),[ce,ht]=a.useState(null),[nt,ct]=a.useState(null),fe=Ke?Ke[0]:ge?U:Se[0],be=Ke?Ke[1]:ge?se:Se[1],Wt=a.useRef([fe,be]);Wt.current=[fe,be];const me=e.mode==="vernier",Ct=e.mode==="vernier"?e.vernierOrientation??(d?"macro-left":"macro-top"):"macro-top",C=Ct==="macro-top"||Ct==="macro-left",Hr=e.mode==="vernier"?e.showVernierProjection??!0:!1,jr=e.mode==="vernier"?e.showVernierTicks??!0:!1,ut=e.mode==="vernier"?e.showHairline??!0:!1,O=me?e.macroUnit??t:t,w=me?e.microUnit??t:t,b=me?e.macroIsDiscrete??!1:$,I=me?e.microIsDiscrete??!1:$,Ee=me?e.macroAllowedDates??o:o,Nt=me?e.microAllowedDates??o:o,at=me?e.formatMacroLabel??e.formatLabel:e.formatLabel,We=me?e.formatMicroLabel??e.formatLabel:e.formatLabel,sn=e.mode==="vernier"?e.macroRange[0].getTime():void 0,cn=e.mode==="vernier"?e.macroRange[1].getTime():void 0,da=Xe?.getTime(),ma=q?.getTime(),[Ve,dr]=a.useState(null),bt=a.useRef(null);bt.current=Ve;const[Gt,Yt]=a.useState(()=>p?"micro-point":"micro-high");let Le=Gt;const Or=p?Gt==="micro-low"||Gt==="micro-high"||Gt==="micro-connect"?"micro-point":null:Gt==="micro-point"?"micro-high":null;Or!==null&&(Le=Or,Yt(Or));const ze=a.useMemo(()=>ee(O,r),[V,O]),At=a.useMemo(()=>{const l=ee(O,n);if(me&&l<=ze)throw new RangeError(`PeriodSlider: macroUnit "${O}" cannot distinguish minDate from maxDate (minDate: ${De(r)}, maxDate: ${De(n)})`);return l},[me,V,j,ze,O]),Pe=a.useMemo(()=>me?$t(Ee,O,r,n):[],[me,Ee,O,V,j]),Ie=a.useMemo(()=>e.mode!=="vernier"?ze:ee(O,e.macroRange[0]),[e.mode,sn,ze,O]),He=a.useMemo(()=>e.mode!=="vernier"?At:ee(O,e.macroRange[1]),[e.mode,cn,At,O]),mr=a.useMemo(()=>de(O,Ie),[O,Ie]),fr=a.useMemo(()=>de(O,He),[O,He]),Re=a.useMemo(()=>e.mode!=="vernier"?ee(w,r):Math.max(ee(w,e.macroRange[0]),ee(w,r)),[e.mode,sn,w,V]),je=a.useMemo(()=>e.mode!=="vernier"?ee(w,n):Math.min(ee(w,qe(O,w,e.macroRange[1])),ee(w,n)),[e.mode,cn,O,w,j]),ne=a.useMemo(()=>me?$t(Nt,w,r,n).filter(u=>{const m=ee(w,u);return m>=Re&&m<=je}):[],[me,Nt,w,V,j,Re,je]),Et=b&&Pe.length>0,Ze=I&&ne.length>0,we=a.useMemo(()=>he===null?Re:ee(w,he[0]),[da,Re,w,he]),ye=a.useMemo(()=>he===null?je:ee(w,he[1]),[ma,je,w,he]),Mt=a.useMemo(()=>de(w,we),[w,we]),wt=a.useMemo(()=>de(w,ye),[w,ye]),Jt=Math.max(1,At-ze),$e=Et?Sr(Pe,O,s,mr):Math.max(0,Math.min(1,(Ie-ze)/Jt)),Oe=Math.max($e,Et?Sr(Pe,O,s,fr):Math.min(1,(He-ze)/Jt)),Zt=Math.max(1,je-Re),Ge=Ze?Sr(ne,w,s,Mt):Math.max(0,Math.min(1,(we-Re)/Zt)),dt=Math.max(Ge,Ze?Sr(ne,w,s,wt):Math.min(1,(ye-Re)/Zt)),Fr=a.useRef({timerId:null,emit:null}),Ur=a.useRef({timerId:null,emit:null}),Br=a.useRef({timerId:null,emit:null});a.useEffect(()=>{const l=[Fr,Ur,Br];return()=>{for(const u of l)Qr(u.current)}},[]);const Vt=a.useCallback((l,u,m)=>{Qr(l);const{debounceMs:M}=A.current;if(m||!M||M<=0){u();return}l.emit=u,l.timerId=setTimeout(()=>{l.timerId=null,l.emit=null,u()},M)},[]),zr=a.useCallback(l=>{const u=l.emit;Qr(l),u?.()},[]),It=a.useCallback(l=>new Date(Math.min(Math.max(l.getTime(),V),j)),[V,j]),ot=a.useCallback((l,u,m=!1)=>{const[M,L]=Wt.current;if((A.current.mode==="point"?l===M:l===M&&u===L)&&Fr.current.timerId===null)return;const z=te(l),H=te(u),Z=()=>{const k=A.current;k.mode==="point"?k.onChangePoint?.(z):k.mode==="range"&&k.onChangeRange?.(z,H)};Vt(Fr.current,Z,m)},[te,Vt]),Ht=a.useCallback((l,u,m=!1)=>{if(A.current.mode!=="vernier")return;const M=It(l),L=It(u);Vt(Ur.current,()=>{const B=A.current;B.mode==="vernier"&&B.onChangeMacroRange?.(M,L)},m)},[It,Vt]),_e=a.useCallback((l,u,m=!1)=>{const M=A.current;if(M.mode!=="vernier")return;const L=It(l),B=It(u);(p?M.microValue===void 0:M.microRange===void 0)&&Me([L,B]),Vt(Br.current,()=>{const z=A.current;if(z.mode==="vernier"){if(p){z.onChangeMicroPoint?.(L);return}z.onChangeMicroRange?.(L,B)}},m)},[It,Vt,p]),un=a.useCallback((l,u=!1)=>{_e(l,l,u)},[_e]),gr=a.useCallback(l=>{if($&&s==="time"&&D.length>1){const M=Math.max(0,Math.min(D.length-1,Math.round(l))),L=D[0].getTime(),z=D[D.length-1].getTime()-L;if(z<=0)return 0;const H=D[M].getTime();return Math.max(0,Math.min(100,(H-L)/z*100))}const u=x-S;if(u<=0)return 0;const m=(l-S)/u*100;return Math.max(0,Math.min(100,m))},[$,s,D,S,x]),hr=a.useCallback(l=>{const u=Math.max(0,Math.min(100,l));if($){if(s==="time"&&D.length>1){const L=D[0].getTime(),z=D[D.length-1].getTime()-L,H=L+u/100*z;return Te(D,new Date(H),t)}const M=Math.round(u/100*(D.length-1));return Math.max(0,Math.min(D.length-1,M))}const m=S+u/100*(x-S);return Math.round(m)},[$,s,D,S,x,t]),mt=a.useRef(null),[jt,dn]=a.useState(0),[fa,Qt]=qt(),[ga,mn]=qt(),[ha,fn]=qt(),[ba,gn]=qt(),[Ma,hn]=qt(),[wa,bn]=qt();a.useEffect(()=>{const l=mt.current;if(!l)return;const u=()=>{const m=l.getBoundingClientRect(),M=d?m.height:m.width;M>0&&dn(L=>Math.abs(L-M)<.5?L:M)};if(u(),typeof ResizeObserver<"u"){const m=new ResizeObserver(M=>{for(const L of M){const B=d?L.contentRect.height:L.contentRect.width;B>0&&dn(z=>Math.abs(z-B)<.5?z:B)}});return m.observe(l),()=>m.disconnect()}return window.addEventListener("resize",u),()=>window.removeEventListener("resize",u)},[d]);const Tt=a.useCallback((l,u,m)=>{const M=d?m.height:m.width;if(!(Number.isFinite(M)&&M>0))return null;const L=d?m.bottom-u:l-m.left;return Number.isFinite(L)?Math.max(0,Math.min(1,L/M)):null},[d]),Mn=a.useCallback((l,u)=>{const m=mt.current;if(!m)return null;const M=Tt(l,u,m.getBoundingClientRect());return M===null?null:M*100},[Tt]),br=a.useRef(null),_r=a.useRef(null),it=a.useRef(null),qr=a.useRef(null),er=a.useRef(null),wn=a.useCallback(l=>{if(i)return;if(me){const k=_r.current;if(!k||l.pointerId!==0&&l.pointerId!==k.pointerId||!mt.current)return;const xe=Tt(l.clientX,l.clientY,mt.current.getBoundingClientRect());if(xe===null)return;if(k.handle==="macro-low"||k.handle==="macro-high"||k.handle==="macro-connect"){const[Qe,vt,Ae]=aa(k.handle,xe,k.startPointerRatio,k.startMacroLowRatio,k.startMacroHighRatio);Ae!==bt.current&&(bt.current=Ae,dr(Ae),Yt(Ae));let ve,et;if(Et){const pt=Lr(Pe,O,s,Qe),yt=Math.max(pt,Lr(Pe,O,s,vt));ve=Pe[pt],et=Pe[yt]}else{const pt=Math.round(ze+Qe*Jt),yt=Math.round(ze+vt*Jt);ve=de(O,pt),et=de(O,yt)}const nr=`${ve.getTime()}_${et.getTime()}`;nr!==qr.current&&(qr.current=nr,Ht(ve,et));let ft,Dt;if(k.handle==="macro-connect"){const pt=tt(w,ve),yt=qe(O,w,et);let Bt,zt;if(O==="year"){const Rt=ve.getFullYear()-k.startMacroLowDate.getFullYear();Bt=ke("year",k.initialMicroLowDate,Rt),zt=ke("year",k.initialMicroHighDate,Rt)}else if(O==="month"){const Rt=(ve.getFullYear()-k.startMacroLowDate.getFullYear())*12+(ve.getMonth()-k.startMacroLowDate.getMonth());Bt=ke("month",k.initialMicroLowDate,Rt),zt=ke("month",k.initialMicroHighDate,Rt)}else{const Rt=Math.round((ve.getTime()-k.startMacroLowDate.getTime())/864e5);Bt=ke("day",k.initialMicroLowDate,Rt),zt=ke("day",k.initialMicroHighDate,Rt)}const _t=pt.getTime(),ar=yt.getTime(),In=k.initialMicroHighDate.getTime()-k.initialMicroLowDate.getTime();let or=Bt.getTime(),ir=zt.getTime();or<_t&&(or=_t,ir=Math.min(ar,or+In)),ir>ar&&(ir=ar,or=Math.max(_t,ir-In)),ft=tt(w,new Date(or)),Dt=tt(w,new Date(ir))}else{const pt=ve.getTime(),yt=qe(O,w,et).getTime(),Bt=k.initialMicroLowDate.getTime(),zt=k.initialMicroHighDate.getTime(),_t=Math.max(pt,Math.min(yt,Bt)),ar=Math.max(_t,Math.min(yt,zt));ft=tt(w,new Date(_t)),Dt=tt(w,new Date(ar))}const Vn=`${ft.getTime()}_${Dt.getTime()}`;Vn!==er.current&&(er.current=Vn,_e(ft,Dt))}else if(k.handle==="micro-low"||k.handle==="micro-high"||k.handle==="micro-connect"||k.handle==="micro-point"){const[Qe,vt,Ae]=oa(k.handle,xe,k.startPointerRatio,k.startMicroLowRatio,k.startMicroHighRatio);Ae!==bt.current&&(bt.current=Ae,dr(Ae),Yt(Ae));let ve,et;if(Ze){const ft=Lr(ne,w,s,Qe),Dt=Math.max(ft,Lr(ne,w,s,vt));ve=ne[ft],et=ne[Dt]}else{const ft=Math.round(Re+Qe*Zt),Dt=Math.round(Re+vt*Zt);ve=de(w,ft),et=de(w,Dt)}const nr=`${ve.getTime()}_${et.getTime()}`;nr!==er.current&&(er.current=nr,_e(ve,et))}return}const u=br.current;if(!u||l.pointerId!==0&&l.pointerId!==u.pointerId||!mt.current)return;const m=mt.current.getBoundingClientRect(),M=d?l.clientY:l.clientX,L=d?m.height:m.width;if(!(Number.isFinite(L)&&L>0))return;if(u.handle==="connect"){const k=d?(u.startPointerPos-M)/L:(M-u.startPointerPos)/L,xe=Jn({posDiffPct:k,startLowVal:u.startLowVal,startHighVal:u.startHighVal,rangeMin:S,rangeMax:x,isDiscrete:$,sortedAllowedDates:D,snapMode:s,unit:t});if(it.current&&it.current[0]===xe[0]&&it.current[1]===xe[1])return;it.current=xe,rt(xe),ot(xe[0],xe[1],!1);return}const B=Tt(l.clientX,l.clientY,m);if(B===null)return;const z=hr(B*100),[H,Z]=nn(u.handle,z,u.startLowVal,u.startHighVal,S,x,_);if((!it.current||it.current[0]!==H||it.current[1]!==Z)&&(it.current=[H,Z],rt([H,Z]),ot(H,Z,!1)),!_&&(u.handle==="low"||u.handle==="high")){const k=Gn(u.handle,z,u.startLowVal,u.startHighVal,_);Ye.current!==k&&(Ye.current=k,pe(k),K(k))}},[i,me,d,O,w,Et,Ze,Pe,ne,ze,Jt,Re,Zt,S,x,$,D,s,t,Tt,hr,ot,Ht,_e,_]),xn=a.useCallback(l=>{if(me){qr.current=null,er.current=null,_r.current=null,bt.current=null,dr(null),zr(Ur.current),zr(Br.current);return}const u=br.current;if(!u||l.pointerId!==0&&l.pointerId!==u.pointerId)return;const m=it.current??Ke;m&&(ot(m[0],m[1],!0),Be(m)),it.current=null,rt(null),br.current=null,Ye.current=null,pe(null)},[me,Ke,ot,zr]),vn=a.useRef(wn);vn.current=wn;const Dn=a.useRef(xn);Dn.current=xn;const pn=ae!==null||Ve!==null;a.useEffect(()=>{if(!pn)return;const l=m=>vn.current(m),u=m=>Dn.current(m);return window.addEventListener("pointermove",l),window.addEventListener("pointerup",u),window.addEventListener("pointercancel",u),()=>{window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",u),window.removeEventListener("pointercancel",u)}},[pn]);const Xr=a.useCallback((l,u,m)=>{br.current={pointerId:l,handle:u,startPointerPos:m,startLowVal:fe,startHighVal:be},Ye.current=u,pe(u),u!=="connect"&&K(u)},[fe,be]),yn=a.useCallback((l,u,m)=>{const M=A.current;M.mode==="vernier"&&(_r.current={pointerId:l,handle:u,startPointerRatio:m,startMacroLowRatio:$e,startMacroHighRatio:Oe,startMicroLowRatio:Ge,startMicroHighRatio:dt,startMacroLowEnc:Ie,startMacroHighEnc:He,startMicroLowEnc:we,startMicroHighEnc:ye,startMacroLowDate:M.macroRange[0],startMacroHighDate:M.macroRange[1],initialMicroLowDate:Mt,initialMicroHighDate:wt},bt.current=u,dr(u),Yt(u))},[$e,Oe,Ge,dt,Ie,He,we,ye,Mt,wt]),Rn=l=>u=>{if(i)return;u.stopPropagation(),u.preventDefault(),K(l);const m=d?u.clientY:u.clientX;Xr(u.pointerId,l,m)},Tn=l=>()=>{i||Ye.current!==null||K(l)},Mr=l=>()=>{i||bt.current!==null||Yt(l)},Ot=l=>u=>{if(i)return;u.stopPropagation(),u.preventDefault();const m=mt.current;if(!m)return;const M=Tt(u.clientX,u.clientY,m.getBoundingClientRect());M!==null&&yn(u.pointerId,l,M)},xa=l=>{if(i||P)return;l.stopPropagation(),l.preventDefault();const u=d?l.clientY:l.clientX;Xr(l.pointerId,"connect",u)},va=l=>{if(i)return;if(me){const H=mt.current;if(!H)return;const Z=H.getBoundingClientRect(),k=Tt(l.clientX,l.clientY,Z);if(k===null)return;const xe=d?l.clientX-(Z.left+Z.width/2):l.clientY-(Z.top+Z.height/2),Qe=na(k,xe,$e,Oe,Ge,dt,Ct,void 0,!P,p?"point":"range");yn(l.pointerId,Qe,k);return}const u=Mn(l.clientX,l.clientY);if(u===null)return;const m=hr(u);let M="low";if(!_){const H=Math.abs(m-fe),Z=Math.abs(m-be);H<Z?M="low":Z<H?M="high":M=m>be?"high":"low"}K(M);const[L,B]=nn(M,m,fe,be,S,x,_);rt([L,B]),ot(L,B,!0);const z=d?l.clientY:l.clientX;Xr(l.pointerId,M,z)},Da=l=>{if(i||ae!==null)return;const u=Mn(l.clientX,l.clientY);if(u===null)return;const m=hr(u);ht(m),ct(gr(m))},pa=()=>{ht(null),ct(null)},Sn=l=>u=>{if(i)return;K(l);const m=Zn(u.key,l,fe,be,S,x,_,1);m&&(u.preventDefault(),ge||Be(m),ot(m[0],m[1],!0))},wr=(l,u)=>{const m=Math.max(ee(w,l),ee(w,r)),M=Math.min(ee(w,qe(O,w,u)),ee(w,n)),L=Math.max(m,Math.min(M,we)),B=Math.max(L,Math.min(M,ye));L===we&&B===ye||_e(de(w,L),de(w,B),!0)},xr=l=>u=>{if(i||!me||e.mode!=="vernier")return;Yt(l);let m=0,M=!1,L=!1;switch(u.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":M=!0;break;case"End":L=!0;break;default:return}if(u.preventDefault(),l==="macro-low"){const B=de(O,Ie),z=de(O,He);if(Et){const k=lr(Pe,O,B,Pe[0],z,m,M,L);if(k===Te(Pe,B,O))return;const xe=Pe[k];Ht(xe,z,!0),wr(xe,z);return}let H;if(M?H=ze:L?H=He:H=Math.max(ze,Math.min(He,Ie+m)),H===Ie)return;const Z=de(O,H);Ht(Z,z,!0),wr(Z,z)}else if(l==="macro-high"){const B=de(O,Ie),z=de(O,He);if(Et){const k=lr(Pe,O,z,B,Pe[Pe.length-1],m,M,L);if(k===Te(Pe,z,O))return;const xe=Pe[k];Ht(B,xe,!0),wr(B,xe);return}let H;if(M?H=Ie:L?H=At:H=Math.max(Ie,Math.min(At,He+m)),H===He)return;const Z=de(O,H);Ht(B,Z,!0),wr(B,Z)}else if(l==="micro-low"){const B=de(w,we),z=de(w,ye);if(Ze){const Z=lr(ne,w,B,ne[0],z,m,M,L);if(Z===Te(ne,B,w))return;_e(ne[Z],z,!0);return}let H;if(M?H=Re:L?H=ye:H=Math.max(Re,Math.min(ye,we+m)),H===we)return;_e(de(w,H),z,!0)}else if(l==="micro-high"){const B=de(w,we),z=de(w,ye);if(Ze){const Z=lr(ne,w,z,B,ne[ne.length-1],m,M,L);if(Z===Te(ne,z,w))return;_e(B,ne[Z],!0);return}let H;if(M?H=we:L?H=je:H=Math.max(we,Math.min(je,ye+m)),H===ye)return;_e(B,de(w,H),!0)}else if(l==="micro-point"){const B=de(w,we);if(Ze){const H=lr(ne,w,B,ne[0],ne[ne.length-1],m,M,L);if(H===Te(ne,B,w))return;un(ne[H],!0);return}let z;if(M?z=Re:L?z=je:z=Math.max(Re,Math.min(je,we+m)),z===we)return;un(de(w,z),!0)}},ya=a.useCallback(l=>{const u=A.current;if(!u.disabled)if(u.mode==="point"){const m=Math.max(S,Math.min(x,fe+l));ge||Be([m,m]),ot(m,m,!0)}else if(u.mode==="vernier"){if(Ze){const k=ne.length-1,xe=Te(ne,Mt,w),Qe=Te(ne,wt,w),vt=Qe-xe;let Ae=xe+l,ve=Qe+l;l<0&&Ae<0?(Ae=0,ve=Math.min(k,vt)):l>0&&ve>k&&(ve=k,Ae=Math.max(0,k-vt)),(Ae!==xe||ve!==Qe)&&_e(ne[Ae],ne[ve],!0);return}const m=we,M=ye,L=Re,B=je,z=M-m;let H=m+l,Z=M+l;l<0&&H<L?(H=L,Z=Math.min(B,H+z)):l>0&&Z>B&&(Z=B,H=Math.max(L,Z-z)),(H!==m||Z!==M)&&_e(de(w,H),de(w,Z),!0)}else{const m=be-fe;let M=fe+l,L=be+l;l<0&&M<S?(M=S,L=Math.min(x,M+m)):l>0&&L>x&&(L=x,M=Math.max(S,L-m)),M<=L&&(ge||Be([M,L]),ot(M,L,!0))}},[fe,be,S,x,ge,ot,_e,we,ye,Re,je,w,Ze,ne,Mt,wt]),Ft=gr(fe),Ut=gr(be),Kr=te(fe),Wr=te(be),Gr=a.useMemo(()=>_?Qt===null?void 0:{estimatedWidthPx:Qt.widthPx,estimatedHeightPx:Qt.heightPx}:en(Qt,mn),[_,Qt,mn]),vr=!_&&fe===be,Fe=a.useMemo(()=>{if(_||!v||d)return on(T,Gr);const l=ln(Ft,Ut,jt,T,Gr);return vr?ra(l):l},[_,vr,v,d,Ft,Ut,jt,T,Gr]),tr=ae==="low"||ae!=="high"&&kt==="low",rr=!_&&(ae==="high"||ae!=="low"&&kt==="high"),Dr=Ie===He,pr=!p&&we===ye,Ra=Dr&&Le!=="macro-low",Ta=Dr&&Le==="macro-low",Sa=pr&&Le!=="micro-low",La=pr&&Le==="micro-low",Ln=C?"top":"bottom",Pn=C?"bottom":"top",$n=a.useMemo(()=>en(fn,gn),[fn,gn]),kn=a.useMemo(()=>en(hn,bn),[hn,bn]),Jr=v&&!d,yr=a.useMemo(()=>On($e,Oe,jt,Ln,$n,Dr,Jr),[$e,Oe,jt,Ln,$n,Dr,Jr]),Cn=Jr&&!p,Rr=a.useMemo(()=>On(Ge,dt,jt,Pn,kn,pr,Cn),[Ge,dt,jt,Pn,kn,pr,Cn]),Pa=a.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% + ${Fe.lowOffsetX}px)`,"--ps-tooltip-ty":`calc(-50% + ${Fe.lowOffsetY}px)`,"--ps-tooltip-rot":`${Fe.lowAngleDeg}deg`},[d,Fe.lowOffsetX,Fe.lowOffsetY,Fe.lowAngleDeg]),$a=a.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% + ${Fe.highOffsetX}px)`,"--ps-tooltip-ty":`calc(-50% + ${Fe.highOffsetY}px)`,"--ps-tooltip-rot":`${Fe.highAngleDeg}deg`},[d,Fe.highOffsetX,Fe.highOffsetY,Fe.highAngleDeg]),Tr=Math.min(Ft,Ut),Nn=Math.max(Ft,Ut),ka=d?{bottom:`${Tr}%`,height:`${Nn-Tr}%`,top:"auto",left:"0",right:"0"}:{left:`${Tr}%`,width:`${Nn-Tr}%`,top:"0",bottom:"0"},Ca=Math.max(.01,Oe-$e),Yn=Math.max(.06,Math.min(.25,.28*Math.sqrt(Ca))),Na=d?{bottom:`${Ft}%`,left:"50%",transform:"translate(-50%, 50%)",zIndex:tr?40:30}:{left:`${Ft}%`,top:"50%",transform:"translate(-50%, -50%)",zIndex:tr?40:30},Ya=d?{bottom:`${Ut}%`,left:"50%",transform:"translate(-50%, 50%)",zIndex:rr?40:30}:{left:`${Ut}%`,top:"50%",transform:"translate(-50%, -50%)",zIndex:rr?40:30},Aa=d?{bottom:`${nt}%`,left:"50%",transform:"translate(-50%, 50%)"}:{left:`${nt}%`,top:"50%",transform:"translate(-50%, -50%)"},An=ce!==null?te(ce):null,Ea=f!=="hover"&&ce!==null&&(ce===fe||!_&&ce===be),Va=Ze?ee(w,ne[0]):Re,Ia=Ze?ee(w,ne[ne.length-1]):je,Ha=i||(me?we<=Va:_?fe<=S:fe<=S&&be<=S),ja=i||(me?ye>=Ia:(_||fe>=x)&&be>=x),lt=p?"micro-point":"micro-low",xt=i?"cursor-not-allowed opacity-50":"cursor-pointer",En=l=>{const u=d?"vertical":"horizontal",m=l==="decrease",M=Ga[u][l];return g.jsx("button",{type:"button",className:`period-slider-stepper-btn relative after:absolute after:inset-[-11px] after:content-[''] ${M} 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 ${xt}`,onClick:()=>ya(m?-1:1),disabled:m?Ha:ja,"aria-label":m?oe:R,children:Wa[u][l]})};return g.jsxs("div",{style:e.style,className:`period-slider flex select-none items-center gap-2 ${d?"flex-col":"flex-row"} ${c}`,"data-disabled":i?"true":void 0,"data-unit":t,"data-mode":e.mode,"data-orientation":d?"vertical":"horizontal","data-label-position":T,"data-color-scheme":W,children:[h&&En(d?"increase":"decrease"),g.jsx("div",{ref:mt,"data-testid":"period-slider-track","data-orientation":d?"vertical":"horizontal","data-vernier-orientation":me?Ct: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"} ${xt}`,onPointerDown:va,onPointerMove:Da,onPointerLeave:pa,children:me?g.jsxs(g.Fragment,{children:[Hr&&(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:Y,x1:"0",y1:"0",x2:"1",y2:"0",children:[g.jsx("stop",{offset:"0%",stopColor:C?F.macro:F.micro,stopOpacity:"0.28"}),g.jsx("stop",{offset:"100%",stopColor:C?F.micro:F.macro,stopOpacity:Yn})]})}),g.jsx("polygon",{points:C?`12,${(1-Oe)*100} 12,${(1-$e)*100} 20,100 20,0`:`12,0 12,100 20,${(1-$e)*100} 20,${(1-Oe)*100}`,fill:`url(#${Y})`})]}):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:Y,x1:"0",y1:"0",x2:"0",y2:"1",children:[g.jsx("stop",{offset:"0%",stopColor:C?F.macro:F.micro,stopOpacity:"0.28"}),g.jsx("stop",{offset:"100%",stopColor:C?F.micro:F.macro,stopOpacity:Yn})]})}),g.jsx("polygon",{points:C?`${$e*100},12 ${Oe*100},12 100,20 0,20`:`0,12 100,12 ${Oe*100},20 ${$e*100},20`,fill:`url(#${Y})`})]})),!P&&g.jsxs(g.Fragment,{children:[g.jsx("div",{"data-testid":"period-slider-connect-macro",className:"period-slider-connect-macro",style:d?{bottom:`calc(${$e*100}% - 8px)`,height:`calc(${Math.max(0,(Oe-$e)*100)}% + 16px)`}:{left:`calc(${$e*100}% - 8px)`,width:`calc(${Math.max(0,(Oe-$e)*100)}% + 16px)`},onPointerDown:Ot("macro-connect")}),!p&&g.jsx("div",{"data-testid":"period-slider-connect-micro",className:"period-slider-connect-micro",style:d?{bottom:`calc(${Ge*100}% - 8px)`,height:`calc(${Math.max(0,(dt-Ge)*100)}% + 16px)`}:{left:`calc(${Ge*100}% - 8px)`,width:`calc(${Math.max(0,(dt-Ge)*100)}% + 16px)`},onPointerDown:Ot("micro-connect")})]}),jr&&g.jsxs("div",{className:"period-slider-vernier-ticks pointer-events-none absolute inset-0",children:[[.2,.4,.6,.8].map(l=>g.jsx("div",{"data-testid":"period-slider-tick","data-tick-scale":"macro",className:"period-slider-tick period-slider-tick-macro",style:d?{bottom:`${l*100}%`}:{left:`${l*100}%`}},`macro-tick-${l}`)),[.1,.2,.3,.4,.5,.6,.7,.8,.9].map(l=>g.jsx("div",{"data-testid":"period-slider-tick","data-tick-scale":"micro",className:"period-slider-tick period-slider-tick-micro",style:d?{bottom:`${l*100}%`}:{left:`${l*100}%`}},`micro-tick-${l}`))]}),g.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":e.macroLowerAriaLabel??"Macro range start","aria-disabled":i?"true":void 0,"aria-valuemin":ze,"aria-valuemax":He,"aria-valuenow":Ie,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(mr,O):St(O,mr,at,y),"aria-orientation":d?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${d?"is-vertical":""} group absolute touch-none ${d?C?"after:absolute after:-inset-y-3 after:right-0 after:-left-4":"after:absolute after:-inset-y-3 after:-right-4 after:left-0":C?"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 ${xt}`,style:d?{bottom:`${$e*100}%`,left:C?0:"auto",right:C?"auto":0,transform:C?"translate(-100%, 50%)":"translate(100%, 50%)",zIndex:Ve==="macro-low"||Le==="macro-low"?30:15}:{left:`${$e*100}%`,top:C?0:"auto",bottom:C?"auto":0,transform:C?"translate(-50%, -100%)":"translate(-50%, 100%)",zIndex:Ve==="macro-low"||Le==="macro-low"?30:15},onPointerDown:Ot("macro-low"),onKeyDown:xr("macro-low"),onFocus:Mr("macro-low"),"data-active":Ve==="macro-low"?"true":void 0,"data-front":Le==="macro-low"?"true":void 0,"data-vernier-pos":d?C?"left":"right":C?"top":"bottom","data-handle-type":"macro-low",children:[g.jsx(cr,{type:"macro",isTop:C,isVertical:d,isLeft:C}),ut&&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":Ra?"true":void 0,"data-slanted":yr.slant.isSlanted?"true":void 0,ref:ha,style:yr.lowStyle,children:Ue(O,mr,at,y)})]}),g.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":e.macroUpperAriaLabel??"Macro range end","aria-disabled":i?"true":void 0,"aria-valuemin":Ie,"aria-valuemax":At,"aria-valuenow":He,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(fr,O):St(O,fr,at,y),"aria-orientation":d?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${d?"is-vertical":""} group absolute touch-none ${d?C?"after:absolute after:-inset-y-3 after:right-0 after:-left-4":"after:absolute after:-inset-y-3 after:-right-4 after:left-0":C?"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 ${xt}`,style:d?{bottom:`${Oe*100}%`,left:C?0:"auto",right:C?"auto":0,transform:C?"translate(-100%, 50%)":"translate(100%, 50%)",zIndex:Ve==="macro-high"||Le==="macro-high"?30:15}:{left:`${Oe*100}%`,top:C?0:"auto",bottom:C?"auto":0,transform:C?"translate(-50%, -100%)":"translate(-50%, 100%)",zIndex:Ve==="macro-high"||Le==="macro-high"?30:15},onPointerDown:Ot("macro-high"),onKeyDown:xr("macro-high"),onFocus:Mr("macro-high"),"data-active":Ve==="macro-high"?"true":void 0,"data-front":Le==="macro-high"?"true":void 0,"data-vernier-pos":d?C?"left":"right":C?"top":"bottom","data-handle-type":"macro-high",children:[g.jsx(cr,{type:"macro",isTop:C,isVertical:d,isLeft:C}),ut&&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":Ta?"true":void 0,"data-slanted":yr.slant.isSlanted?"true":void 0,ref:ba,style:yr.highStyle,children:Ue(O,fr,at,y)})]}),g.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":p?e.pointAriaLabel??"Micro selected date":e.lowerAriaLabel??"Micro range start","aria-disabled":i?"true":void 0,"aria-valuemin":Re,"aria-valuemax":p?je:ye,"aria-valuenow":we,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(Mt,w):St(w,Mt,We,y),"aria-orientation":d?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${d?"is-vertical":""} group absolute touch-none ${d?C?"after:absolute after:-inset-y-3 after:-right-4 after:left-0":"after:absolute after:-inset-y-3 after:right-0 after:-left-4":C?"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 ${xt}`,style:d?{bottom:`${Ge*100}%`,left:C?"auto":0,right:C?0:"auto",transform:C?"translate(100%, 50%)":"translate(-100%, 50%)",zIndex:Ve===lt||Le===lt?30:20}:{left:`${Ge*100}%`,top:C?"auto":0,bottom:C?0:"auto",transform:C?"translate(-50%, 100%)":"translate(-50%, -100%)",zIndex:Ve===lt||Le===lt?30:20},onPointerDown:Ot(lt),onKeyDown:xr(lt),onFocus:Mr(lt),"data-active":Ve===lt?"true":void 0,"data-front":Le===lt?"true":void 0,"data-vernier-pos":d?C?"right":"left":C?"bottom":"top","data-handle-type":lt,children:[g.jsx(cr,{type:"micro",isTop:!C,isVertical:d,isLeft:!C}),ut&&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":Sa?"true":void 0,"data-slanted":Rr.slant.isSlanted?"true":void 0,ref:Ma,style:Rr.lowStyle,children:Ue(w,Mt,We,y)})]}),!p&&g.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":e.upperAriaLabel??"Micro range end","aria-disabled":i?"true":void 0,"aria-valuemin":we,"aria-valuemax":je,"aria-valuenow":ye,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(wt,w):St(w,wt,We,y),"aria-orientation":d?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${d?"is-vertical":""} group absolute touch-none ${d?C?"after:absolute after:-inset-y-3 after:-right-4 after:left-0":"after:absolute after:-inset-y-3 after:right-0 after:-left-4":C?"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 ${xt}`,style:d?{bottom:`${dt*100}%`,left:C?"auto":0,right:C?0:"auto",transform:C?"translate(100%, 50%)":"translate(-100%, 50%)",zIndex:Ve==="micro-high"||Le==="micro-high"?30:20}:{left:`${dt*100}%`,top:C?"auto":0,bottom:C?0:"auto",transform:C?"translate(-50%, 100%)":"translate(-50%, -100%)",zIndex:Ve==="micro-high"||Le==="micro-high"?30:20},onPointerDown:Ot("micro-high"),onKeyDown:xr("micro-high"),onFocus:Mr("micro-high"),"data-active":Ve==="micro-high"?"true":void 0,"data-front":Le==="micro-high"?"true":void 0,"data-vernier-pos":d?C?"right":"left":C?"bottom":"top","data-handle-type":"micro-high",children:[g.jsx(cr,{type:"micro",isTop:!C,isVertical:d,isLeft:!C}),ut&&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":La?"true":void 0,"data-slanted":Rr.slant.isSlanted?"true":void 0,ref:wa,style:Rr.highStyle,children:Ue(w,wt,We,y)})]})]}):g.jsxs(g.Fragment,{children:[!P&&g.jsx("div",{"data-testid":"period-slider-connect",className:"period-slider-connect absolute rounded-full",style:ka,onPointerDown:xa}),E&&$&&D.length>1&&g.jsx("div",{className:"period-slider-ticks pointer-events-none absolute inset-0",children:D.map((l,u)=>{const m=ee(t,l),M=gr(u),L=d?{bottom:`${M}%`,left:"50%",transform:"translate(-50%, 50%)"}:{left:`${M}%`,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:L},`tick-${m}`)})}),!i&&ce!==null&&nt!==null&&ae===null&&An&&g.jsxs("div",{"data-testid":"period-slider-hover-guide",className:"period-slider-hover-guide pointer-events-none absolute h-2 w-2",style:Aa,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":Ea?"true":void 0,className:`period-slider-hover-tooltip ${T==="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:Ue(t,An,e.formatLabel,y)})]}),g.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":_?e.pointAriaLabel??"Selected date":e.lowerAriaLabel??"Range start","aria-disabled":i?"true":void 0,"aria-valuemin":S,"aria-valuemax":_?x:be,"aria-valuenow":fe,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(Kr,t):St(t,Kr,e.formatLabel,y),"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 ${xt}`,style:Na,onPointerDown:Rn("low"),onKeyDown:Sn("low"),onFocus:Tn("low"),"data-active":ae==="low"?"true":void 0,"data-front":tr?"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)] ${ae==="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":T,"data-slanted":Fe.isSlanted?"true":void 0,"data-front":tr?"true":void 0,"data-duplicate":vr&&!tr?"true":void 0,ref:fa,style:Pa,children:Ue(t,Kr,e.formatLabel,y)})]}),!_&&g.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":e.upperAriaLabel??"Range end","aria-disabled":i?"true":void 0,"aria-valuemin":fe,"aria-valuemax":x,"aria-valuenow":be,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(Wr,t):St(t,Wr,e.formatLabel,y),"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 ${xt}`,style:Ya,onPointerDown:Rn("high"),onKeyDown:Sn("high"),onFocus:Tn("high"),"data-active":ae==="high"?"true":void 0,"data-front":rr?"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)] ${ae==="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":T,"data-slanted":Fe.isSlanted?"true":void 0,"data-front":rr?"true":void 0,"data-duplicate":vr&&!rr?"true":void 0,ref:ga,style:$a,children:Ue(t,Wr,e.formatLabel,y)})]})]})}),h&&En(d?"decrease":"increase")]})},tn=(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},ia=(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 o of r)if(e[o]!==t[o])return!1;return!0},Za=(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||!ia(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||!tn(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||!tn(e.macroAllowedDates,t.macroAllowedDates)||!tn(e.microAllowedDates,t.microAllowedDates)):!1,la=a.memo(Ja,Za);la.displayName="PeriodSlider";const st=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t},ur=(e,t)=>{if(Number.isNaN(t.getTime()))throw new RangeError(`DateSelector: "${e}" must be a valid Date (received ${String(t)})`)},Qa=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)})`)}},Pt=(e,t,r)=>{const n=new Date(e,t-1,r);return n.setFullYear(e),n.setHours(0,0,0,0),n},Fn=e=>Pt(e,1,1),eo=e=>Pt(e,12,31),to={year:{year:"numeric"},month:{month:"2-digit"},day:{day:"2-digit"}},ro={year:4,month:2,day:2},no={year:e=>e.getFullYear(),month:e=>e.getMonth()+1,day:e=>e.getDate()},Un=new Map,ao=(e,t)=>{const r=`${e}\0${t}`,n=Un.get(r);if(n!==void 0)return n;const o=new Intl.DateTimeFormat(t,to[e]);return Un.set(r,o),o},rn=(e,t,r)=>r===void 0?String(no[e](t)).padStart(ro[e],"0"):ao(e,r).format(t),oo=(e,t,r)=>{const n=t?.getTime()??null,o=r?.getTime()??null,s=new Map;return e.forEach((i,c)=>{ur(`allowedDates[${c}]`,i);const h=st(i),f=h.getTime();n!==null&&f<n||o!==null&&f>o||s.has(f)||s.set(f,h)}),Array.from(s.keys()).sort((i,c)=>i-c).map(i=>s.get(i))},io=(e,t)=>{const r=[];let n=st(e);const o=st(t).getTime();for(;n.getTime()<=o;)r.push(n),n=Ne.addDays(n,1);return r},Bn=(e,t)=>{const r=[];for(let n=e.length-1;n>=0;n--)r.push({label:Ue("day",e[n],void 0,t),value:Ne.format(e[n],"yyyy-MM-dd")});return r},lo=e=>{const{value:t,initialDate:r,onChange:n,children:o,minYear:s,maxYear:i,minDate:c,maxDate:h,allowedDates:f,variant:T="date",className:v="",style:d,disabled:P=!1,prevDateAriaLabel:E="Previous day",nextDateAriaLabel:W="Next day",selectAriaLabel:y="Date",yearAriaLabel:oe="Year",monthAriaLabel:R="Month",dayAriaLabel:X="Day",locale:p,formatYearOption:F,formatMonthOption:Y,formatDayOption:A}=e;if(Qa(p),t!==void 0&&ur("value",t),r!==void 0&&ur("initialDate",r),c!==void 0&&ur("minDate",c),h!==void 0&&ur("maxDate",h),s!==void 0&&!Number.isInteger(s))throw new RangeError(`DateSelector: "minYear" must be an integer year (received ${String(s)})`);if(i!==void 0&&!Number.isInteger(i))throw new RangeError(`DateSelector: "maxYear" must be an integer year (received ${String(i)})`);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 V=t??r;if(V===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[j,D]=a.useState(()=>st(V)),$=t!==void 0,S=t?.getTime(),x=a.useMemo(()=>t!==void 0?st(t):j,[S,j]),_=c?.getTime(),te=h?.getTime(),G=a.useMemo(()=>{const b=c?st(c):null,I=s!==void 0?Fn(s):null;return b===null?I:I===null||b.getTime()>=I.getTime()?b:I},[_,s]),ue=a.useMemo(()=>{const b=h?st(h):null,I=i!==void 0?eo(i):null;return b===null?I:I===null||b.getTime()<=I.getTime()?b:I},[te,i]),Me=G?.getTime()??null,ie=ue?.getTime()??null;if(G!==null&&ue!==null&&G.getTime()>ue.getTime())throw new RangeError(`DateSelector: the resolved range is empty (min ${Ne.format(G,"yyyy-MM-dd")} is after max ${Ne.format(ue,"yyyy-MM-dd")})`);if(T!=="date"&&f===void 0&&(G===null||ue===null))throw new RangeError(`DateSelector: variant="${T}" needs a bounded range; supply minDate/minYear and maxDate/maxYear${T==="dropdown"?' or supply "allowedDates"':""}`);const re=f===void 0?null:f.map(b=>b.getTime()).join(","),Q=a.useMemo(()=>f===void 0?null:oo(f,G,ue),[re,Me,ie]),he=b=>{const I=b.getTime();return Q!==null?Q.some(Ee=>Ee.getTime()===I):!(Me!==null&&I<Me||ie!==null&&I>ie)},Xe=V.getTime();a.useEffect(()=>{$||D(st(V))},[$,Xe]);const q=b=>{if(P)return;const I=st(b);he(I)&&($||D(I),n?.(I))},J=x.getTime(),le=he(x),N=a.useMemo(()=>{if(Q!==null){for(let I=Q.length-1;I>=0;I--)if(Q[I].getTime()<J)return Q[I];return null}const b=Ne.addDays(new Date(J),-1);return he(b)?b:null},[Q,J,Me,ie]),U=a.useMemo(()=>{if(Q!==null){for(const I of Q)if(I.getTime()>J)return I;return null}const b=Ne.addDays(new Date(J),1);return he(b)?b:null},[Q,J,Me,ie]),se=P||N===null,ge=P||U===null,Se=()=>{N!==null&&q(N)},Be=()=>{U!==null&&q(U)},Ke=b=>{if(b.target.value){const I=Ne.parseISO(b.target.value);Number.isNaN(I.getTime())||q(I)}},rt=b=>{if(b.target.value){const I=Ne.parseISO(b.target.value);Number.isNaN(I.getTime())||q(I)}},ae=x.getFullYear(),pe=x.getMonth()+1,Ye=x.getDate(),kt=a.useMemo(()=>T!=="dropdown"?[]:Q!==null?Bn(Q,p):G===null||ue===null?[]:Bn(io(G,ue),p),[T,Q,Me,ie,p]),K=a.useMemo(()=>{if(T!=="split-dropdown"||G===null||ue===null)return[];const b=[];for(let I=ue.getFullYear();I>=G.getFullYear();I--)b.push(I);return b},[T,Me,ie]),ce=a.useMemo(()=>{if(T!=="split-dropdown"||G===null||ue===null)return[];const b=G,I=ue,Ee=ae===b.getFullYear()?b.getMonth()+1:1,Nt=ae===I.getFullYear()?I.getMonth()+1:12,at=[];for(let We=Ee;We<=Nt;We++)at.push(We);return at},[T,Me,ie,ae]),ht=a.useMemo(()=>{if(T!=="split-dropdown"||G===null||ue===null)return[];const b=G,I=ue,Ee=ae===b.getFullYear()&&pe===b.getMonth()+1?b.getDate():1,Nt=ae===I.getFullYear()&&pe===I.getMonth()+1?I.getDate():Ne.getDaysInMonth(new Date(J)),at=[];for(let We=Ee;We<=Nt;We++)at.push(We);return at},[T,Me,ie,J,ae,pe]),nt=(b,I,Ee)=>Ee>Ne.getDaysInMonth(Pt(b,I,1))?!1:he(Pt(b,I,Ee)),ct=(b,I,Ee)=>{nt(b,I,Ee)&&q(Pt(b,I,Ee))},fe=b=>F?F(b):rn("year",Fn(b),p),be=b=>Y?Y(b):rn("month",Pt(ae,b,1),p),Wt=b=>A?A(b):rn("day",Pt(ae,pe,b),p),me=Ne.format(x,"yyyy-MM-dd"),Ct=Ue("day",x,void 0,p),C=G?Ne.format(G,"yyyy-MM-dd"):void 0,Hr=ue?Ne.format(ue,"yyyy-MM-dd"):void 0,jr=le?me:"",ut="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 g.jsxs("div",{className:`inline-flex items-center ${O} ${v}`,style:d,"data-variant":T,"data-out-of-range":le?void 0:"true",children:[g.jsx("button",{type:"button","aria-label":E,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:Se,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"})}),T==="dropdown"?g.jsxs("select",{"aria-label":y,disabled:P,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:jr,onChange:rt,children:[le?null:g.jsx("option",{value:"",disabled:!0,className:ut,children:Ct}),kt.map(b=>g.jsx("option",{value:b.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:b.label},b.value))]}):T==="split-dropdown"?g.jsxs("div",{className:"mx-1 my-auto inline-flex items-center gap-1",children:[g.jsxs("select",{"aria-label":oe,disabled:P,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:le?ae:"",onChange:b=>ct(Number(b.target.value),pe,Ye),children:[le?null:g.jsx("option",{value:"",disabled:!0,className:ut,children:fe(ae)}),K.map(b=>g.jsx("option",{value:b,disabled:!nt(b,pe,Ye),className:"dark:bg-slate-700 dark:text-slate-100",children:fe(b)},b))]}),g.jsxs("select",{"aria-label":R,disabled:P,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:le?pe:"",onChange:b=>ct(ae,Number(b.target.value),Ye),children:[le?null:g.jsx("option",{value:"",disabled:!0,className:ut,children:be(pe)}),ce.map(b=>g.jsx("option",{value:b,disabled:!nt(ae,b,Ye),className:"dark:bg-slate-700 dark:text-slate-100",children:be(b)},b))]}),g.jsxs("select",{"aria-label":X,disabled:P,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:le?Ye:"",onChange:b=>ct(ae,pe,Number(b.target.value)),children:[le?null:g.jsx("option",{value:"",disabled:!0,className:ut,children:Wt(Ye)}),ht.map(b=>g.jsx("option",{value:b,className:"dark:bg-slate-700 dark:text-slate-100",children:Wt(b)},b))]})]}):g.jsx("input",{"aria-label":y,disabled:P,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:me,min:C,max:Hr,onChange:Ke,type:"date"}),g.jsx("button",{type:"button","aria-label":W,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: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"})}),o]})},Xt=e=>e===void 0?null:st(e).getTime(),sa=a.memo(lo,(e,t)=>!(Xt(e.value??e.initialDate)!==Xt(t.value??t.initialDate)||Xt(e.minDate)!==Xt(t.minDate)||Xt(e.maxDate)!==Xt(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));sa.displayName="DateSelector";function Je(e,t){const r=e+Math.floor(t/12),n=(t%12+12)%12,o=new Date(r,n,1);return o.setFullYear(r),o}function Lt(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}`}function sr(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 zn(e,t){if(e!==void 0&&!Number.isInteger(e))throw new RangeError(`MonthSelector: \`${t}\` must be an integer year, received ${String(e)}.`)}function so(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 co(e,t){const r=e===void 0?null:Je(e,0),n=t===void 0?null:Je(t.getFullYear(),t.getMonth());return r!==null&&n!==null?r>=n?r:n:r!==null?r:n}function uo(e,t){const r=e===void 0?null:Je(e,11),n=t===void 0?null:Je(t.getFullYear(),t.getMonth());return r!==null&&n!==null?r<=n?r:n:r!==null?r:n}function mo(e,t,r){const n=new Map;for(const o of e){const s=Je(o.getFullYear(),o.getMonth());t!==null&&s<t||r!==null&&s>r||n.has(s.getTime())||n.set(s.getTime(),s)}return Array.from(n.values()).sort((o,s)=>o.getTime()-s.getTime())}function fo(e,t){const r=e.getFullYear()*12+e.getMonth(),n=t.getFullYear()*12+t.getMonth(),o=[];for(let s=r;s<=n;s++)o.push(Je(Math.floor(s/12),s%12));return o}function _n(e,t){const r=[];for(let n=e.length-1;n>=0;n--)r.push({label:Ue("month",e[n],void 0,t),value:Lt(e[n])});return r}const go=e=>{const{value:t,initialDate:r,onChange:n,children:o,variant:s="date",minYear:i,maxYear:c,minDate:h,maxDate:f,allowedMonths:T,isWarning:v=!1,className:d="",style:P,disabled:E=!1,prevMonthAriaLabel:W="Previous month",nextMonthAriaLabel:y="Next month",selectAriaLabel:oe="Month",locale:R}=e;so(R),sr(t,"value"),sr(r,"initialDate"),sr(h,"minDate"),sr(f,"maxDate"),zn(i,"minYear"),zn(c,"maxYear"),T?.forEach((K,ce)=>{sr(K,`allowedMonths[${ce}]`)});const X=t??r;if(X===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[p,F]=a.useState(()=>Je(X.getFullYear(),X.getMonth())),Y=t!==void 0,A=a.useMemo(()=>t!==void 0?Je(t.getFullYear(),t.getMonth()):p,[t?.getTime(),p]),V=h?.getTime(),j=f?.getTime(),D=a.useMemo(()=>co(i,h),[i,V]),$=a.useMemo(()=>uo(c,f),[c,j]),S=D?.getTime()??null,x=$?.getTime()??null;if(D!==null&&$!==null&&D>$)throw new RangeError(`MonthSelector: the resolved lower bound ${Lt(D)} is after the resolved upper bound ${Lt($)}.`);if(s==="dropdown"&&T===void 0&&(D===null||$===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 _=T===void 0?null:T.map(K=>K.getTime()).join(","),te=a.useMemo(()=>T===void 0?null:mo(T,D,$),[_,S,x]),G=K=>{const ce=K.getTime();return te!==null?te.some(ht=>ht.getTime()===ce):!(S!==null&&ce<S||x!==null&&ce>x)},ue=X.getTime();a.useEffect(()=>{if(Y)return;const K=Je(X.getFullYear(),X.getMonth());F(ce=>ce.getTime()===K.getTime()?ce:K)},[Y,ue]);const Me=K=>{if(E)return;if(!G(K))throw new RangeError(`MonthSelector: refusing to emit ${Lt(K)}, which lies outside the selectable months.`);Y||F(K);const ce=K.getFullYear()*100+(K.getMonth()+1);n?.(K,ce)},ie=A.getTime(),re=G(A),Q=a.useMemo(()=>{if(te!==null){for(let ce=te.length-1;ce>=0;ce--)if(te[ce].getTime()<ie)return te[ce];return null}const K=Je(A.getFullYear(),A.getMonth()-1);return G(K)?K:null},[te,ie,S,x]),he=a.useMemo(()=>{if(te!==null){for(const ce of te)if(ce.getTime()>ie)return ce;return null}const K=Je(A.getFullYear(),A.getMonth()+1);return G(K)?K:null},[te,ie,S,x]),Xe=E||Q===null,q=E||he===null,J=()=>{Q!==null&&Me(Q)},le=()=>{he!==null&&Me(he)},N=K=>{if(!K)return;const[ce,ht]=K.split("-"),nt=Number(ce),ct=Number(ht)-1;if(!(Number.isInteger(nt)&&Number.isInteger(ct)))return;const fe=Je(nt,ct);G(fe)&&Me(fe)},U=K=>{N(K.target.value)},se=K=>{N(K.target.value)},ge=Lt(A),Se=Ue("month",A,void 0,R),Be=D?Lt(D):void 0,Ke=$?Lt($):void 0,rt=a.useMemo(()=>s!=="dropdown"?[]:te!==null?_n(te,R):D===null||$===null?[]:_n(fo(D,$),R),[s,te,S,x,R]),ae=re?ge:"",pe=v?"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",Ye=`mx-1 my-auto w-28 rounded-md border py-0.5 px-1 text-xs dark:placeholder:text-gray-400 disabled:opacity-50 ${pe}`,kt=`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 ${pe}`;return g.jsxs("div",{className:`inline-flex w-38 items-center ${d}`,style:P,"data-out-of-range":re?void 0:"true",children:[g.jsx("button",{type:"button","aria-label":W,disabled:Xe,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:J,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":oe,disabled:E,className:kt,value:ae,onChange:se,children:[re?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:Se}),rt.map(K=>g.jsx("option",{value:K.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:K.label},K.value))]}):g.jsx("input",{"aria-label":oe,disabled:E,className:Ye,value:ge,min:Be,max:Ke,onChange:U,type:"month"}),g.jsx("button",{type:"button","aria-label":y,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:le,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"})}),o]})},ca=a.memo(go,(e,t)=>{const r=e.value??e.initialDate,n=t.value??t.initialDate,o=r?r.getFullYear()*12+r.getMonth():null,s=n?n.getFullYear()*12+n.getMonth():null;if(o!==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 i=e.minDate?e.minDate.getFullYear()*12+e.minDate.getMonth():null,c=t.minDate?t.minDate.getFullYear()*12+t.minDate.getMonth():null;if(i!==c)return!1;const h=e.maxDate?e.maxDate.getFullYear()*12+e.maxDate.getMonth():null,f=t.maxDate?t.maxDate.getFullYear()*12+t.maxDate.getMonth():null;return!(h!==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)});ca.displayName="MonthSelector";function Kt(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 Vr(e,t,r){if(Kt(e,"minDate",t),Kt(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 Nr(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(Kt(e,`${t}[0]`,r[0]),Kt(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 Yr(e,t,r,n,o,s){if(r.getTime()<n.getTime()||r.getTime()>o.getTime())throw new RangeError(`${e}: ${t} must lie within ${s} (value: ${r.toISOString()}, lower: ${n.toISOString()}, upper: ${o.toISOString()})`)}function Ar(e,t,r,n,o,s){Yr(e,`${t}[0]`,r[0],n,o,s),Yr(e,`${t}[1]`,r[1],n,o,s)}function Ce(e,t,r){return e<t?t:e>r?r:e}function Pr(e,t,r,n){const o=qe(t,r,n[1]);return[Ce(e[0],n[0],o),Ce(e[1],n[0],o)]}function $r(e,t,r,n){return Ce(e,n[0],qe(t,r,n[1]))}function Er(e,t,r,n){const o=Te(e,r,t)+n;return e[Math.max(0,Math.min(e.length-1,o))]}function Ir(e){const t=a.useRef(e),r=t.current,n=e,o=Object.keys(r),s=Object.keys(n);return o.length===s.length&&s.every(c=>Object.is(r[c],n[c]))||(t.current=e),t.current}function ho(e){const{unit:t,minDate:r,maxDate:n,initialRange:o,onChangeRange:s,...i}=e;Vr("usePeriodSliderRange",r,n),Nr("usePeriodSliderRange","initialRange",o),Ar("usePeriodSliderRange","initialRange",o,r,n,"[minDate, maxDate]");const c=Ir(i),h=a.useRef(o),[f,T]=a.useState(o);let v=f;const d=[Ce(f[0],r,n),Ce(f[1],r,n)];(d[0]!==f[0]||d[1]!==f[1])&&(v=d,T(d));const P=a.useRef(v);P.current=v;const E=a.useRef({minDate:r,maxDate:n,allowedDates:c.allowedDates});E.current={minDate:r,maxDate:n,allowedDates:c.allowedDates};const W=a.useRef(s);W.current=s;const y=a.useCallback(j=>{const{minDate:D,maxDate:$}=E.current,S=Ce(j[0],D,$),x=Ce(j[1],D,$),_=P.current;S.getTime()===_[0].getTime()&&x.getTime()===_[1].getTime()||(P.current=[S,x],T([S,x]),W.current?.(S,x))},[]),oe=a.useCallback(j=>{const D=P.current,$=j.getTime()>D[1].getTime()?j:D[1];y([j,$])},[y]),R=a.useCallback(j=>{const D=P.current,$=j.getTime()<D[0].getTime()?j:D[0];y([$,j])},[y]),X=a.useCallback((j,D)=>{y([j,D])},[y]),p=a.useCallback(j=>{const{minDate:D,maxDate:$,allowedDates:S}=E.current,x=P.current,_=$t(S,t,D,$);if(_.length>0){y([Er(_,t,x[0],j),Er(_,t,x[1],j)]);return}y([ke(t,x[0],j),ke(t,x[1],j)])},[t,y]),F=a.useCallback(()=>{y(h.current)},[y]),Y=a.useMemo(()=>({value:v[0],onChange:oe,minDate:r,maxDate:v[1],unit:t}),[v[0],v[1],oe,r,t]),A=a.useMemo(()=>({value:v[1],onChange:R,minDate:v[0],maxDate:n,unit:t}),[v[0],v[1],R,n,t]),V=a.useMemo(()=>({...c,mode:"range",unit:t,range:v,minDate:r,maxDate:n,onChangeRange:X}),[c,t,v,r,n,X]);return{range:v,lowerDate:v[0],upperDate:v[1],setRange:T,setLowerDate:oe,setUpperDate:R,shiftRange:p,resetRange:F,startSelectorProps:Y,endSelectorProps:A,sliderProps:V}}function bo(e){const{unit:t,minDate:r,maxDate:n,initialValue:o,onChangePoint:s,...i}=e;Vr("usePeriodSliderPoint",r,n),Kt("usePeriodSliderPoint","initialValue",o),Yr("usePeriodSliderPoint","initialValue",o,r,n,"[minDate, maxDate]");const c=Ir(i),h=a.useRef(o),[f,T]=a.useState(o);let v=f;const d=Ce(f,r,n);d!==f&&(v=d,T(d));const P=a.useRef(v);P.current=v;const E=a.useRef({minDate:r,maxDate:n,allowedDates:c.allowedDates});E.current={minDate:r,maxDate:n,allowedDates:c.allowedDates};const W=a.useRef(s);W.current=s;const y=a.useCallback(F=>{const{minDate:Y,maxDate:A}=E.current,V=Ce(F,Y,A);V.getTime()!==P.current.getTime()&&(P.current=V,T(V),W.current?.(V))},[]),oe=a.useCallback(F=>{const{minDate:Y,maxDate:A,allowedDates:V}=E.current,j=$t(V,t,Y,A);if(j.length>0){y(Er(j,t,P.current,F));return}y(ke(t,P.current,F))},[t,y]),R=a.useCallback(()=>{y(h.current)},[y]),X=a.useMemo(()=>({value:v,onChange:y,minDate:r,maxDate:n,unit:t}),[v,y,r,n,t]),p=a.useMemo(()=>({...c,mode:"point",unit:t,value:v,minDate:r,maxDate:n,onChangePoint:y}),[c,t,v,r,n,y]);return{value:v,setValue:T,shiftValue:oe,resetValue:R,selectorProps:X,sliderProps:p}}function Mo(e){const{unit:t,minDate:r,maxDate:n,initialMacroRange:o,initialMicroRange:s,macroUnit:i=t,microUnit:c=t,onChangeMacroRange:h,onChangeMicroRange:f,...T}=e;Vr("useVernierSlider",r,n),Nr("useVernierSlider","initialMacroRange",o),Nr("useVernierSlider","initialMicroRange",s),Ar("useVernierSlider","initialMacroRange",o,r,n,"[minDate, maxDate]"),Ar("useVernierSlider","initialMicroRange",s,o[0],qe(i,c,o[1]),"the initial macro window");const v=Ir(T),d=a.useRef(o),P=a.useRef(s),[E,W]=a.useState(o),[y,oe]=a.useState(s);let R=E;const X=[Ce(E[0],r,n),Ce(E[1],r,n)];(X[0]!==E[0]||X[1]!==E[1])&&(R=X,W(X));let p=y;const F=Pr(y,i,c,R);(F[0]!==y[0]||F[1]!==y[1])&&(p=F,oe(F));const Y=a.useRef(R);Y.current=R;const A=a.useRef(p);A.current=p;const V=a.useRef({minDate:r,maxDate:n});V.current={minDate:r,maxDate:n};const j=a.useRef(h);j.current=h;const D=a.useRef(f);D.current=f;const $=a.useCallback((N,U)=>{const se=Y.current,ge=A.current;(N[0].getTime()!==se[0].getTime()||N[1].getTime()!==se[1].getTime())&&(Y.current=N,W(N),j.current?.(N[0],N[1])),(U[0].getTime()!==ge[0].getTime()||U[1].getTime()!==ge[1].getTime())&&(A.current=U,oe(U),D.current?.(U[0],U[1]))},[]),S=a.useCallback((N,U)=>{const{minDate:se,maxDate:ge}=V.current,Se=[Ce(N,se,ge),Ce(U,se,ge)];$(Se,Pr(A.current,i,c,Se))},[i,c,$]),x=a.useCallback((N,U)=>{$(Y.current,Pr([N,U],i,c,Y.current))},[i,c,$]),_=a.useCallback(N=>{const U=Y.current[1],se=N>U?N:U;S(N,se)},[S]),te=a.useCallback(N=>{const U=Y.current[0],se=N<U?N:U;S(se,N)},[S]),G=a.useCallback(N=>{const U=A.current[1],se=N>U?N:U;x(N,se)},[x]),ue=a.useCallback(N=>{const U=A.current[0],se=N<U?N:U;x(se,N)},[x]),Me=a.useCallback(N=>{const{minDate:U,maxDate:se}=V.current,ge=Y.current,Se=ke(i,ge[0],N),Be=ke(i,ge[1],N);Se<U||Be>se||S(Se,Be)},[i,S]),ie=a.useCallback(N=>{const U=Y.current,se=A.current,ge=ke(c,se[0],N),Se=ke(c,se[1],N);ge<U[0]||Se>qe(i,c,U[1])||x(ge,Se)},[i,c,x]),re=a.useCallback(()=>{const N=d.current;$(N,Pr(P.current,i,c,N))},[i,c,$]),Q=a.useMemo(()=>qe(i,c,R[1]),[i,c,R[1]]),he=a.useMemo(()=>({value:R[0],onChange:_,minDate:r,maxDate:R[1],unit:i}),[R,_,r,i]),Xe=a.useMemo(()=>({value:R[1],onChange:te,minDate:R[0],maxDate:n,unit:i}),[R,te,n,i]),q=a.useMemo(()=>({value:p[0],onChange:G,minDate:R[0],maxDate:p[1],unit:c}),[p,G,R,c]),J=a.useMemo(()=>({value:p[1],onChange:ue,minDate:p[0],maxDate:Q,unit:c}),[p,ue,Q,c]),le=a.useMemo(()=>({...v,mode:"vernier",unit:t,macroUnit:i,microUnit:c,minDate:r,maxDate:n,macroRange:R,microRange:p,onChangeMacroRange:S,onChangeMicroRange:x}),[v,t,i,c,r,n,R,p,S,x]);return{macroRange:R,setMacroRange:W,microRange:p,setMicroRange:oe,setMacroLowerDate:_,setMacroUpperDate:te,setMicroLowerDate:G,setMicroUpperDate:ue,shiftMacroRange:Me,shiftMicroRange:ie,resetVernier:re,macroStartSelectorProps:he,macroEndSelectorProps:Xe,microStartSelectorProps:q,microEndSelectorProps:J,sliderProps:le}}function wo(e){const{unit:t,minDate:r,maxDate:n,initialMacroRange:o,initialMicroValue:s,macroUnit:i=t,microUnit:c=t,onChangeMacroRange:h,onChangeMicroPoint:f,...T}=e;Vr("useVernierSliderPoint",r,n),Nr("useVernierSliderPoint","initialMacroRange",o),Kt("useVernierSliderPoint","initialMicroValue",s),Ar("useVernierSliderPoint","initialMacroRange",o,r,n,"[minDate, maxDate]"),Yr("useVernierSliderPoint","initialMicroValue",s,o[0],qe(i,c,o[1]),"the initial macro window");const v=Ir(T),d=a.useRef(o),P=a.useRef(s),[E,W]=a.useState(o),[y,oe]=a.useState(s);let R=E;const X=[Ce(E[0],r,n),Ce(E[1],r,n)];(X[0]!==E[0]||X[1]!==E[1])&&(R=X,W(X));let p=y;const F=$r(y,i,c,R);F!==y&&(p=F,oe(F));const Y=a.useRef(R);Y.current=R;const A=a.useRef(p);A.current=p;const V=a.useRef({minDate:r,maxDate:n,microIsDiscrete:v.microIsDiscrete,microAllowedDates:v.microAllowedDates,allowedDates:v.allowedDates});V.current={minDate:r,maxDate:n,microIsDiscrete:v.microIsDiscrete,microAllowedDates:v.microAllowedDates,allowedDates:v.allowedDates};const j=a.useRef(h);j.current=h;const D=a.useRef(f);D.current=f;const $=a.useCallback((q,J)=>{const le=Y.current,N=A.current;(q[0].getTime()!==le[0].getTime()||q[1].getTime()!==le[1].getTime())&&(Y.current=q,W(q),j.current?.(q[0],q[1])),J.getTime()!==N.getTime()&&(A.current=J,oe(J),D.current?.(J))},[]),S=a.useCallback((q,J)=>{const{minDate:le,maxDate:N}=V.current,U=[Ce(q,le,N),Ce(J,le,N)];$(U,$r(A.current,i,c,U))},[i,c,$]),x=a.useCallback(q=>{$(Y.current,$r(q,i,c,Y.current))},[i,c,$]),_=a.useCallback(q=>{const J=Y.current[1],le=q>J?q:J;S(q,le)},[S]),te=a.useCallback(q=>{const J=Y.current[0],le=q<J?q:J;S(le,q)},[S]),G=a.useCallback(q=>{const{minDate:J,maxDate:le}=V.current,N=Y.current,U=ke(i,N[0],q),se=ke(i,N[1],q);U<J||se>le||S(U,se)},[i,S]),ue=a.useCallback(q=>{const J=Y.current,le=qe(i,c,J[1]),{microIsDiscrete:N,microAllowedDates:U,allowedDates:se,minDate:ge,maxDate:Se}=V.current,Be=N===!0?$t(U??se,c,ge,Se):[],Ke=J[0].getTime(),rt=le.getTime(),ae=Be.filter(pe=>pe.getTime()>=Ke&&pe.getTime()<=rt);if(ae.length>0){x(Er(ae,c,A.current,q));return}x(ke(c,A.current,q))},[i,c,x]),Me=a.useCallback(()=>{const q=d.current;$(q,$r(P.current,i,c,q))},[i,c,$]),ie=a.useMemo(()=>qe(i,c,R[1]),[i,c,R[1]]),re=a.useMemo(()=>({value:R[0],onChange:_,minDate:r,maxDate:R[1],unit:i}),[R,_,r,i]),Q=a.useMemo(()=>({value:R[1],onChange:te,minDate:R[0],maxDate:n,unit:i}),[R,te,n,i]),he=a.useMemo(()=>({value:p,onChange:x,minDate:R[0],maxDate:ie,unit:c}),[p,x,R,ie,c]),Xe=a.useMemo(()=>({...v,mode:"vernier",unit:t,macroUnit:i,microUnit:c,minDate:r,maxDate:n,macroRange:R,microValue:p,onChangeMacroRange:S,onChangeMicroPoint:x}),[v,t,i,c,r,n,R,p,S,x]);return{macroRange:R,setMacroRange:W,microValue:p,setMicroValue:oe,setMacroLowerDate:_,setMacroUpperDate:te,setMicroDate:x,shiftMacroRange:G,shiftMicroValue:ue,resetVernier:Me,macroStartSelectorProps:re,macroEndSelectorProps:Q,microSelectorProps:he,sliderProps:Xe}}function qn(e){const t=new Date(e,0,1);return t.setFullYear(e),t}function kr(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 Xn(e,t){if(e!==void 0&&!Number.isInteger(e))throw new RangeError(`YearSelector: \`${t}\` must be an integer year, received ${String(e)}.`)}function xo(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 Kn(e,t,r){const n=e===void 0?null:e,o=t===void 0?null:t.getFullYear();return n!==null&&o!==null?r(n,o):n!==null?n:o}const vo=e=>{const{value:t,initialDate:r,onChange:n,children:o,minYear:s,maxYear:i,minDate:c,maxDate:h,className:f="",style:T,disabled:v=!1,prevYearAriaLabel:d="Previous year",nextYearAriaLabel:P="Next year",selectAriaLabel:E="Year",locale:W}=e;kr(t,"value"),kr(r,"initialDate"),kr(c,"minDate"),kr(h,"maxDate"),Xn(s,"minYear"),Xn(i,"maxYear"),xo(W);const y=t??r;if(y===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[oe,R]=a.useState(()=>y.getFullYear()),X=c?.getTime(),p=h?.getTime(),F=a.useMemo(()=>Kn(s,c,Math.max),[s,X]),Y=a.useMemo(()=>Kn(i,h,Math.min),[i,p]);if(F===null||Y===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(F>Y)throw new RangeError(`YearSelector: the resolved lower bound ${F} is after the resolved upper bound ${Y}.`);const A=t!==void 0,V=t!==void 0?t.getFullYear():oe,j=V<F||V>Y,D=y.getTime();a.useEffect(()=>{A||R(y.getFullYear())},[A,D]);const $=re=>re>=F&&re<=Y,S=re=>{if(!v){if(!$(re))throw new RangeError(`YearSelector: refusing to emit ${re}, which lies outside the declared bounds ${F}-${Y}.`);A||R(re),n?.(qn(re),re)}},x=$(V-1)?V-1:null,_=$(V+1)?V+1:null,te=v||x===null,G=v||_===null,ue=()=>{x!==null&&S(x)},Me=()=>{_!==null&&S(_)},ie=a.useMemo(()=>{const re=[];for(let Q=Y;Q>=F;Q--)re.push(Q);return j&&(re.push(V),re.sort((Q,he)=>he-Q)),re},[F,Y,j,V]);return g.jsxs("div",{className:`inline-flex w-32 items-center ${f}`,style:T,children:[g.jsx("button",{type:"button","aria-label":d,disabled:te,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"})}),g.jsx("select",{"aria-label":E,disabled:v,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:V,onChange:re=>{if(!re.target.value)return;const Q=Number(re.target.value);Number.isInteger(Q)&&S(Q)},children:ie.map(re=>g.jsx("option",{value:re,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:Ue("year",qn(re),void 0,W)},re))}),g.jsx("button",{type:"button","aria-label":P,disabled:G,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:Me,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"})}),o]})},ua=a.memo(vo,(e,t)=>{const r=e.value??e.initialDate,n=t.value??t.initialDate,o=r?r.getFullYear():null,s=n?n.getFullYear():null;return!(o!==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)});ua.displayName="YearSelector";exports.COLOR_SCHEME_PALETTES=Wn;exports.DateSelector=sa;exports.MonthSelector=ca;exports.PeriodSlider=la;exports.YearSelector=ua;exports.addUnit=ke;exports.areStylesEqual=ia;exports.calculateConnectDragValues=Jn;exports.calculateHandleDragValues=nn;exports.calculateKeyboardActionValues=Zn;exports.calculateLabelSlant=ln;exports.calculateVernierMacroDrag=aa;exports.calculateVernierMicroDrag=oa;exports.decode=de;exports.encode=ee;exports.findNearestDateIndex=Te;exports.formatLabel=Ue;exports.formatScreenReaderLabel=St;exports.getActiveDragHandle=Gn;exports.getMacroWindowEndDate=qe;exports.getSortedAllowedDates=$t;exports.normalizeDateByUnit=tt;exports.resolveVernierTargetHandle=na;exports.usePeriodSliderPoint=bo;exports.usePeriodSliderRange=ho;exports.useVernierSlider=Mo;exports.useVernierSliderPoint=wo;
|
|
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
|
@@ -20,9 +20,9 @@ export { DateSelector } from './DateSelector.js';
|
|
|
20
20
|
export type { MonthSelectorProps } from './MonthSelector.js';
|
|
21
21
|
export { MonthSelector } from './MonthSelector.js';
|
|
22
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, getSortedAllowedDates, normalizeDateByUnit, PeriodSlider, resolveVernierTargetHandle, } from './PeriodSlider.js';
|
|
24
|
-
export type { SelectorProps, UsePeriodSliderPointOptions, UsePeriodSliderPointReturn, UsePeriodSliderRangeOptions, UsePeriodSliderRangeReturn,
|
|
25
|
-
export { usePeriodSliderPoint, usePeriodSliderRange,
|
|
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
|
@@ -20,9 +20,9 @@ export { DateSelector } from './DateSelector.js';
|
|
|
20
20
|
export type { MonthSelectorProps } from './MonthSelector.js';
|
|
21
21
|
export { MonthSelector } from './MonthSelector.js';
|
|
22
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, getSortedAllowedDates, normalizeDateByUnit, PeriodSlider, resolveVernierTargetHandle, } from './PeriodSlider.js';
|
|
24
|
-
export type { SelectorProps, UsePeriodSliderPointOptions, UsePeriodSliderPointReturn, UsePeriodSliderRangeOptions, UsePeriodSliderRangeReturn,
|
|
25
|
-
export { usePeriodSliderPoint, usePeriodSliderRange,
|
|
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,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,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACZ,0BAA0B,
|
|
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"}
|