@aiquants/period-slider 0.23.0 → 0.25.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/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react/jsx-runtime"),jc=require("date-fns"),s=require("react"),mr=require("@aiquants/virtualscroll"),Fc=require("react-dom"),ai="an object that cannot be converted to a string",Uc=3,De=e=>{try{return e instanceof Date&&!Number.isNaN(Date.prototype.getTime.call(e))}catch{return!1}},At=e=>{try{return Array.isArray(e)}catch{return!1}},zc=e=>e===void 0||At(e);function sn(e,t,r){if(!zc(r))throw new RangeError(`${e}: ${t} must be an array of Dates (received: ${y(r)})`)}const y=e=>{if(typeof e=="string")return JSON.stringify(e);if(De(e))return Date.prototype.toISOString.call(e);if(At(e))return Bc(e);try{return String(e)}catch{return ai}},Bc=e=>{let t;try{t=e.length}catch{return ai}const r=Math.min(t,Uc),n=[];for(let a=0;a<r;a++)n.push(Wc(e,a));const o=t-r;return`[${n.join(", ")}${o>0?`, ... ${o} more`:""}]`},Wc=(e,t)=>{try{if(!(t in e))return"empty";const r=e[t];return At(r)?`Array(${r.length})`:y(r)}catch{return ai}},Pt=(e,t)=>De(e)?t(e):Number.NaN,gt=(e,t)=>e===void 0?null:Pt(e,t),vs=120,$a="data-drag-snap",Ta="--ps-drag-snap-duration",Pn={flat:["--ps-drag-low","--ps-drag-high"],macro:["--ps-drag-macro-low","--ps-drag-macro-high"],micro:["--ps-drag-micro-low","--ps-drag-micro-high"]},ll=["low","high"],cl=["tx","ty","rot","leader-length","leader-angle"],Ho={flat:{low:"--ps-drag-label-low",high:"--ps-drag-label-high"},macro:{low:"--ps-drag-macro-label-low",high:"--ps-drag-macro-label-high"},micro:{low:"--ps-drag-micro-label-low",high:"--ps-drag-micro-label-high"}},ii=(e,t)=>`${e}-${t}`,Ln=(e,t,r)=>`var(${ii(e,t)}, ${r})`,Gc=(e,t,r)=>{const n=Ho[t];for(const o of ll)for(const a of cl)e.style.setProperty(ii(n[o],a),r[o][a])},ul=e=>Math.max(0,Math.min(1,e)),$o=(e,t,r,n)=>{const o=ul(t);if(e==="point")return[o,o];const a=e==="low"?n:r;return[Math.min(o,a),Math.max(o,a)]},si=(e,t,r)=>{const n=r-t,o=Math.max(0,Math.min(1-n,t+e));return[o,o+n]},jo=(e,t,r,n)=>{const o=ul(t);return e==="low"?o>n?"high":"low":o<r?"low":"high"},Ca=(e,t,r,n)=>{if(r){const i=(1-e)*100,l=(1-t)*100;return n?`M 12 ${l} L 12 ${i} L 20 100 L 20 0 Z`:`M 12 0 L 12 100 L 20 ${i} L 20 ${l} Z`}const o=e*100,a=t*100;return n?`M ${o} 12 L ${a} 12 L 100 20 L 0 20 Z`:`M 0 12 L 100 12 L ${a} 20 L ${o} 20 Z`},sr=(e,t)=>`var(${e}, ${t}%)`,Kc=(e,t,r,n)=>{const[o,a]=Pn[t];e.style.setProperty(o,`${r*100}%`),e.style.setProperty(a,`${n*100}%`)},qc=e=>{for(const[t,r]of Object.values(Pn))e.style.removeProperty(t),e.style.removeProperty(r);for(const t of Object.values(Ho))for(const r of ll)for(const n of cl)e.style.removeProperty(ii(t[r],n))},Xc=["transform","translate","scale","rotate","perspective","filter","backdrop-filter"],Zc=["transform","translate","scale","rotate","perspective","filter"],Qc=["paint","layout","strict","content"],Jc=["paint","strict","content"],eu=new Set(["hidden","clip","auto","scroll","overlay"]),tu=(e,t)=>{const r=e.getPropertyValue("position");if(t==="absolute"&&r!==""&&r!=="static"||Xc.some(a=>!["","none"].includes(e.getPropertyValue(a)))||!["","normal"].includes(e.getPropertyValue("container-type")))return!0;const n=e.getPropertyValue("will-change");if(Zc.some(a=>n.includes(a)))return!0;const o=e.getPropertyValue("contain");return Qc.some(a=>o.includes(a))},ru=e=>{const t=e.getPropertyValue("display");if(t==="contents"||t==="inline")return!1;if(eu.has(e.getPropertyValue("overflow-y")))return!0;const r=e.getPropertyValue("contain");return Jc.some(n=>r.includes(n))},Ss=e=>{if(e.assignedSlot!==null)return e.assignedSlot;if(e.parentElement!==null)return e.parentElement;const t=e.parentNode;return t!==null&&t.nodeType===11&&"host"in t?t.host:null},nu=e=>{const t=e.ownerDocument,r=t.defaultView;if(r===null)return[];const n=[];let o=r.getComputedStyle(e).getPropertyValue("position");for(let a=Ss(e);a!==null&&a!==t.documentElement&&a!==t.body;a=Ss(a)){const i=r.getComputedStyle(a);(o==="absolute"||o==="fixed")&&!tu(i,o)||(ru(i)&&n.push(a),o=i.getPropertyValue("position"))}return n},ou=e=>{const t=e.getBoundingClientRect(),r="offsetHeight"in e&&typeof e.offsetHeight=="number"?e.offsetHeight:0,n=r>0?t.height/r:1,o=t.top+e.clientTop*n;return{top:o,bottom:o+e.clientHeight*n}},au=(e,t,r)=>{const n=e.getBoundingClientRect(),o=e.ownerDocument.documentElement.clientHeight;if(!(n.height>0&&o>0))return null;const a=n.top+n.height/2;let i=0,l=o;for(const u of nu(e)){const d=ou(u);i=Math.max(i,d.top),l=Math.min(l,d.bottom)}return t?.isConnected&&(i=Math.max(i,t.getBoundingClientRect().bottom)),r?.isConnected&&(l=Math.min(l,r.getBoundingClientRect().top)),{topPx:Math.max(0,a-i),bottomPx:Math.max(0,l-a)}},iu=(e,t,r,n)=>{const o=e.ownerDocument.defaultView;if(o===null)return null;const a=e.getBoundingClientRect(),i=t.getBoundingClientRect();if(!(a.height>0&&i.height>0))return null;const l=a.top+a.height/2,u=Number.parseFloat(o.getComputedStyle(r).getPropertyValue(n==="top"?"bottom":"top"));if(!Number.isFinite(u))return null;const d=n==="top"?i.bottom-u:i.top+u;return{anchorPx:Math.abs(d-l),knobCentrePx:Math.abs(i.top+i.height/2-l)}},dl=["rangeStart","rangeEnd","selectedDate","macroRangeStart","macroRangeEnd","microRangeStart","microRangeEnd","microSelectedDate","decrease","increase","previousYear","nextYear","yearSelect","previousMonth","nextMonth","monthSelect","previousDay","nextDay","dateSelect","splitYear","splitMonth","splitDay"],Fo=[...mr.VIRTUAL_SCROLL_LABEL_KEYS,...dl],Ua=Object.freeze({en:Object.freeze({rangeStart:"Range start",rangeEnd:"Range end",selectedDate:"Selected date",macroRangeStart:"Macro range start",macroRangeEnd:"Macro range end",microRangeStart:"Micro range start",microRangeEnd:"Micro range end",microSelectedDate:"Micro selected date",decrease:"Decrease",increase:"Increase",previousYear:"Previous year",nextYear:"Next year",yearSelect:"Year",previousMonth:"Previous month",nextMonth:"Next month",monthSelect:"Month",previousDay:"Previous day",nextDay:"Next day",dateSelect:"Date",splitYear:"Year",splitMonth:"Month",splitDay:"Day"}),ja:Object.freeze({rangeStart:"期間の開始",rangeEnd:"期間の終了",selectedDate:"選択日",macroRangeStart:"広域期間の開始",macroRangeEnd:"広域期間の終了",microRangeStart:"詳細期間の開始",microRangeEnd:"詳細期間の終了",microSelectedDate:"詳細の選択日",decrease:"前へ",increase:"次へ",previousYear:"前年",nextYear:"翌年",yearSelect:"年",previousMonth:"前月",nextMonth:"翌月",monthSelect:"年月",previousDay:"前日",nextDay:"翌日",dateSelect:"日付",splitYear:"年",splitMonth:"月",splitDay:"日"})}),ml=Object.freeze({en:Object.freeze({...mr.VIRTUAL_SCROLL_LABEL_CATALOGS.en,...Ua.en}),ja:Object.freeze({...mr.VIRTUAL_SCROLL_LABEL_CATALOGS.ja,...Ua.ja})}),xs=e=>typeof e=="string"?JSON.stringify(e):e===null?"null":typeof e,su=e=>Fo.includes(e),lu=(e,t)=>{const r={};let n=!1;for(const o of mr.VIRTUAL_SCROLL_LABEL_KEYS){const a=t.has(o)?e[o]:void 0;a!==void 0&&(r[o]=a,n=!0)}return n?r:void 0},cu=e=>{try{return mr.resolveVirtualScrollLocale(e)}catch(t){throw t instanceof RangeError?new RangeError(`[period-slider] locale is the UI language, not a BCP 47 tag (date formatting reads formatLocale): ${t.message}`,{cause:t}):t}},fl=(e,t)=>{const r=cu(e);if(t===void 0)return ml[r];if(t===null||typeof t!="object")throw new RangeError(`[period-slider] labels must be an object; got ${xs(t)}`);const n=Object.getPrototypeOf(t);if(n!==Object.prototype&&n!==null)throw new RangeError(`[period-slider] labels must be a plain object (prototype Object.prototype or null); got ${Array.isArray(t)?"an array":"an object with a non-plain prototype"}`);const o=new Set(Object.keys(t));for(const l of o)if(!su(l))throw new RangeError(`[period-slider] labels.${l} is not a known label key; expected one of ${Fo.join(", ")}`);const i={...mr.resolveVirtualScrollLabels(r,lu(t,o)),...Ua[r]};for(const l of dl){const u=o.has(l)?t[l]:void 0;if(u!==void 0){if(typeof u!="string"||u.trim()==="")throw new RangeError(`[period-slider] labels.${l} must be a non-blank string; got ${xs(u)}`);i[l]=u}}return Object.freeze(i)},uu=e=>{const t={};for(const r of mr.VIRTUAL_SCROLL_LABEL_KEYS)t[r]=e[r];return Object.freeze(t)},du=(e,t)=>e===t||Fo.every(r=>e[r]===t[r]),Uo=(e,t)=>{if(e===t)return!0;if(e===void 0||t===void 0||e===null||t===null||typeof e!="object"||typeof t!="object")return!1;const r=new Set(Object.keys(e)),n=Object.keys(t);if(r.size!==n.length)return!1;const o=e,a=t;return n.every(i=>r.has(i)&&Object.is(o[i],a[i]))},Ia=(e,t)=>e!==null&&t!==null&&"nodeType"in t&&e.contains(t),Rs=new Set(["hidden","clip","scroll","auto","overlay"]),Ms=["paint","strict","content"],mu=["layout","paint","strict","content"],fu=["transform","perspective","filter"],vn=e=>e!==void 0&&e!==""&&e!=="none",hu=e=>e!==void 0&&e!==""&&e!=="normal",lo=e=>{const t=Number.parseFloat(e??"");return Number.isFinite(t)?t:0},gu=e=>e.position==="fixed"?"fixed":e.position==="absolute"?"absolute":null,pu=(e,t)=>t==="absolute"&&vn(e.position)&&e.position!=="static"||vn(e.transform)||vn(e.perspective)||vn(e.filter)||vn(e.backdropFilter)||hu(e.containerType)||mu.some(r=>e.contain.includes(r))?!0:fu.some(r=>e.willChange.includes(r)),bu=(e,t,r,n,o,a)=>{const i=t.ownerDocument.defaultView;if(i===null)return!1;const l=e.getBoundingClientRect();if(l.width===0||l.height===0)return!1;const u=n?0:r,d=n?r:0;if(o<l.left-u||o>=l.right+u||a<l.top-d||a>=l.bottom+d)return!1;const m=i.getComputedStyle(t);if(m.visibility!=="visible")return!1;let x=null;for(let L=t;L!==null;L=L.parentElement){const T=L===t?m:i.getComputedStyle(L);if(x!==null&&!pu(T,x))continue;const b=Rs.has(T.overflowX)||Ms.some(w=>T.contain.includes(w)),g=Rs.has(T.overflowY)||Ms.some(w=>T.contain.includes(w));if(b||g){const w=L.getBoundingClientRect();if(b&&(o<w.left+lo(T.borderLeftWidth)||o>=w.right-lo(T.borderRightWidth))||g&&(a<w.top+lo(T.borderTopWidth)||a>=w.bottom-lo(T.borderBottomWidth)))return!1}x=gu(T)}return!0},ka=new Map,wu=(e,t)=>{if(!(t.shiftKey&&t.cancelable))return;for(const o of e)if(o.ownsHit(t.target)){o.step(t);return}let r=null,n=Number.POSITIVE_INFINITY;for(const o of e){const a=o.distanceToRailPx(t.clientX,t.clientY);a===null||a>=n||(r=o,n=a)}r?.step(t)},vu=(e,t)=>{let r=ka.get(e);if(r===void 0){const a=new Set,i=l=>wu(a,l);r={participants:a,listener:i},ka.set(e,r),e.addEventListener("wheel",i,{passive:!1,capture:!0})}const{participants:n,listener:o}=r;return n.add(t),()=>{n.delete(t),!(n.size>0)&&(ka.delete(e),e.removeEventListener("wheel",o,{capture:!0}))}},Tn="gap-[11px]",Su={single:1,double:2},yn=6,Er=yn*2,co=(e,t)=>{const r=Su[e],n=(r-1)*yn+yn*4/3,o=Er/2,a=Array.from({length:r},(l,u)=>{const d=u*yn,m=d+yn;return{left:`${d},${o} ${m},0 ${m},${Er}`,right:`${n-d},${o} ${n-m},0 ${n-m},${Er}`,up:`${o},${d} 0,${m} ${Er},${m}`,down:`${o},${n-d} 0,${n-m} ${Er},${n-m}`}[t]}),i=t==="up"||t==="down";return{widthPx:i?Er:n,heightPx:i?n:Er,triangles:a}},Ds=e=>({left:co(e,"left"),right:co(e,"right"),up:co(e,"up"),down:co(e,"down")}),xu={single:Ds("single"),double:Ds("double")},li=(e,t)=>{if(t===void 0)return"single";if(t==="single"||t==="double")return t;throw new RangeError(`${e}: stepGlyph must be "single" or "double" (received: ${y(t)})`)},Aa=e=>{e.preventDefault(),e.stopPropagation()},Ru={onMouseDownCapture:Aa,onMouseUpCapture:Aa,onClickCapture:Aa},Mu="period-slider-step",Du=`${Mu} relative inline-flex size-[22px] shrink-0 items-center justify-center rounded-md after:absolute after:content-['']`,yu="transition-colors motion-reduce:transition-none not-aria-disabled:cursor-pointer aria-disabled:cursor-not-allowed focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 dark:focus-visible:ring-blue-400 forced-colors:not-aria-disabled:hover:text-[Highlight] forced-colors:aria-disabled:text-[GrayText]",Eu={control:"text-slate-500 not-aria-disabled:hover:bg-slate-500/15 not-aria-disabled:hover:text-slate-900 not-aria-disabled:active:bg-slate-500/25 aria-disabled:text-slate-500/40 dark:text-slate-400 dark:not-aria-disabled:hover:text-slate-50 dark:aria-disabled:text-slate-400/40",rail:"border border-slate-300 bg-white text-slate-700 shadow-2xs not-aria-disabled:hover:border-slate-400 not-aria-disabled:hover:bg-slate-100 not-aria-disabled:hover:text-slate-900 not-aria-disabled:active:bg-slate-200 aria-disabled:border-slate-300/40 aria-disabled:bg-white/40 aria-disabled:text-slate-700/40 aria-disabled:shadow-none dark:border-slate-700 dark:bg-slate-800 dark:text-slate-200 dark:not-aria-disabled:hover:border-slate-500 dark:not-aria-disabled:hover:bg-slate-700 dark:not-aria-disabled:hover:text-white dark:not-aria-disabled:active:bg-slate-600 dark:aria-disabled:border-slate-700/40 dark:aria-disabled:bg-slate-800/40 dark:aria-disabled:text-slate-200/40"},uo="after:inset-[calc((100%-var(--ps-target-size))/2)]",ys={horizontal:"px-[19px]",vertical:"py-[19px]"},Pu={control:{left:uo,right:uo,up:uo,down:uo},rail:{left:"after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:left-[calc(100%-var(--ps-target-size)+4px)] after:-right-[4px]",right:"after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-left-[4px] after:right-[calc(100%-var(--ps-target-size)+4px)]",up:"after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-[calc(100%-var(--ps-target-size)+4px)] after:-bottom-[4px]",down:"after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-[4px] after:bottom-[calc(100%-var(--ps-target-size)+4px)]"}},Tr=({direction:e,glyph:t,neighbour:r,disabled:n,canStep:o,onStep:a,ariaLabel:i,className:l,ref:u})=>{const{widthPx:d,heightPx:m,triangles:x}=xu[t][e],L=n||!o;return C.jsx("button",{ref:u,type:"button","aria-label":i,disabled:n,"aria-disabled":L?!0:void 0,...L?Ru:null,onClick:L?void 0:a,className:`${l===void 0?"":`${l} `}${Du} ${yu} ${Eu[r]} ${Pu[r][e]}`,children:C.jsx("svg",{"aria-hidden":"true",focusable:"false","data-arrow":e,"data-glyph":t,width:d,height:m,viewBox:`0 0 ${d} ${m}`,fill:"currentColor",className:"pointer-events-none block shrink-0",children:x.map(T=>C.jsx("polygon",{points:T},T))})})},zo=(e,t)=>{const r=s.useMemo(()=>fl(e,t),[e,t]),n=s.useRef(r);return du(n.current,r)||(n.current=r),n.current},dt=(e,t,r)=>{if(!Number.isInteger(r))throw new RangeError(`${e}: ${t} must be a finite integer (received: ${y(r)})`)},hr=(e,t)=>{if(t.kind==="range"){if(t.min!==null&&dt(e,"values.min",t.min),t.max!==null&&dt(e,"values.max",t.max),t.min!==null&&t.max!==null&&t.max<t.min)throw new RangeError(`${e}: values.max must not precede values.min (min: ${t.min}, max: ${t.max})`);return}dt(e,"values.loIndex",t.loIndex),dt(e,"values.hiIndex",t.hiIndex)},jn=e=>e.kind==="candidates"&&e.hiIndex<e.loIndex,Bo=(e,t)=>{let r=e.loIndex,n=e.hiIndex+1;for(;r<n;){const o=r+n>>1;e.ascending[o]<t?r=o+1:n=o}return r},Cn=(e,t)=>(hr("drawnValuesEdge",e),e.kind==="range"?t===-1?e.min:e.max:jn(e)?null:e.ascending[t===-1?e.loIndex:e.hiIndex]),In=(e,t)=>{if(hr("drawnValuesHas",e),dt("drawnValuesHas","value",t),e.kind==="range")return(e.min===null||t>=e.min)&&(e.max===null||t<=e.max);if(jn(e))return!1;const r=Bo(e,t);return r<=e.hiIndex&&e.ascending[r]===t},kn=(e,t)=>{if(hr("drawnValuesNearest",e),dt("drawnValuesNearest","value",t),e.kind==="range")return e.min!==null&&t<e.min?e.min:e.max!==null&&t>e.max?e.max:t;if(jn(e))return null;const r=Bo(e,t);if(r>e.hiIndex)return e.ascending[e.hiIndex];if(e.ascending[r]===t||r===e.loIndex)return e.ascending[r];const n=e.ascending[r-1],o=e.ascending[r];return t-n<=o-t?n:o},Zt=(e,t,r)=>{if(hr("drawnValuesNeighbour",e),dt("drawnValuesNeighbour","value",t),e.kind==="range"){if(r===-1){const i=e.max===null?t-1:Math.min(t-1,e.max);return e.min!==null&&i<e.min?null:i}const a=e.min===null?t+1:Math.max(t+1,e.min);return e.max!==null&&a>e.max?null:a}if(jn(e))return null;const n=Bo(e,t);if(r===-1){const a=n-1;return a<e.loIndex?null:e.ascending[a]}const o=n<=e.hiIndex&&e.ascending[n]===t?n+1:n;return o>e.hiIndex?null:e.ascending[o]},So=(e,t,r)=>{if(hr("clampPairIntoDrawnValues",e),dt("clampPairIntoDrawnValues","low",t),dt("clampPairIntoDrawnValues","high",r),r<t)throw new RangeError(`clampPairIntoDrawnValues: high must not precede low (low: ${t}, high: ${r})`);const n=kn(e,t),o=kn(e,r);return n===null||o===null?null:[n,Math.max(n,o)]},Lu=(e,t,r)=>{if(hr("carryPairIntoDrawnValues",e),dt("carryPairIntoDrawnValues","low",t),dt("carryPairIntoDrawnValues","high",r),r<t)throw new RangeError(`carryPairIntoDrawnValues: high must not precede low (low: ${t}, high: ${r})`);if(jn(e))return null;const n=Cn(e,-1),o=Cn(e,1),a=r-t;return o!==null&&r>o?So(e,o-a,o):n!==null&&t<n?So(e,n,n+a):So(e,t,r)},xo=(e,t,r)=>(hr("drawnValuesAtOrBeyond",e),dt("drawnValuesAtOrBeyond","target",t),Zt(e,t-r,r)),ln=(e,t,r)=>{if(t!==null&&dt("drawnValuesWithin","min",t),r!==null&&dt("drawnValuesWithin","max",r),t!==null&&r!==null&&r<t)throw new RangeError(`drawnValuesWithin: max must not precede min (min: ${t}, max: ${r})`);const n={ascending:e,loIndex:0,hiIndex:e.length-1};let o=e.length;if(r!==null){let a=0;for(;a<o;){const i=a+o>>1;e[i]<=r?a=i+1:o=i}}return{kind:"candidates",ascending:e,loIndex:t===null?0:Bo(n,t),hiIndex:o-1}},Ro=e=>(hr("drawnValuesStepGeometry",e),{stepEnd:(t,r)=>Zt(e,t,r),edge:t=>Cn(e,t)}),za=(e,t,r,n,o)=>{if(dt("stepPair","low",t),dt("stepPair","high",r),r<t)throw new RangeError(`stepPair: high must not precede low (low: ${t}, high: ${r})`);if(n!==-1&&n!==1)throw new RangeError(`stepPair: direction must be -1 or 1 (received: ${y(n)})`);switch(o.motion){case"shift":{if(o.edge!=="disable"&&o.edge!=="clamp")throw new RangeError(`stepPair: rule.edge must be "disable" or "clamp" (received: ${y(o.edge)})`);const a=n===1?r:t,i=n===1?t:r,l=e.stepEnd(i,n);if(l===null)return null;let u=e.stepEnd(a,n);if(u===null){const d=e.edge(n);if(o.edge==="disable"||d===null||(n===1?a>d:a<d))return null;u=d}return n===1?[l,u]:[u,l]}case"start":{const a=e.stepEnd(t,n);return a===null?null:[a,Math.max(r,a)]}case"end":{const a=e.stepEnd(r,n);return a===null?null:[Math.min(t,a),a]}case"single":{if(o.shows!=="start"&&o.shows!=="end")throw new RangeError(`stepPair: rule.shows must be "start" or "end" (received: ${y(o.shows)})`);const a=e.stepEnd(o.shows==="start"?t:r,n);return a===null?null:[a,a]}default:throw new RangeError(`stepPair: rule.motion must be one of "shift", "start", "end", "single" (received: ${y(o.motion)})`)}},hl={"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"}},gl=e=>typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=11,Nt=(e,t)=>{if(!gl(t))throw new RangeError(`${e}: yearStartMonth must be an integer between 0 and 11 (received: ${y(t)})`)},gr=(e,t)=>t===void 0?0:(Nt(e,t),t),Le=(e,t,r)=>{if(r!=="year"&&r!=="month"&&r!=="day")throw new RangeError(`${e}: ${t} must be one of "year", "month", "day" (received: ${y(r)})`)},Qt=(e,t,r,n)=>r===void 0?n:(Le(e,t,r),r),$u=[31,28,31,30,31,30,31,31,30,31,30,31],pl=719468,Mo=146097,Ba=(e,t)=>t!==1?$u[t]:e%4===0&&(e%100!==0||e%400===0)?29:28,ci=(e,t,r,n)=>{const o=e*12+t+n,a=Math.floor(o/12),i=o-a*12;return[a,i,Math.min(r,Ba(a,i))]},An=(e,t,r)=>{const n=t<2?e-1:e,o=Math.floor(n/400),a=n-o*400,i=t<2?t+10:t-2,l=Math.floor((153*i+2)/5)+r-1,u=a*365+Math.floor(a/4)-Math.floor(a/100)+l;return o*Mo+u-pl},Es=e=>{const t=e+pl,r=Math.floor(t/Mo),n=t-r*Mo,o=Math.floor((n-Math.floor(n/1460)+Math.floor(n/36524)-Math.floor(n/(Mo-1)))/365),a=n-(o*365+Math.floor(o/4)-Math.floor(o/100)),i=Math.floor((5*a+2)/153),l=i<10?i+2:i-10;return[r*400+o+(l<2?1:0),l,a-Math.floor((153*i+2)/5)+1]},Wo=(e,t,r)=>e-(t<r?1:0),Rt=(e,t,r=0)=>{if(Le("normalizeDateByUnit","unit",e),!De(t))throw new RangeError(`normalizeDateByUnit: d must be a valid Date (received: ${y(t)})`);Nt("normalizeDateByUnit",r);const n=new Date(t.getTime());return e==="year"?(n.setFullYear(Wo(n.getFullYear(),n.getMonth(),r),r,1),n.setHours(0,0,0,0)):(e==="month"&&n.setDate(1),n.setHours(0,0,0,0)),n},U=(e,t,r=0)=>{Le("encode","unit",e),Nt("encode",r);const n=Rt(e,t,r),o=n.getFullYear(),a=n.getMonth();return e==="year"?o:e==="month"?o*12+a:An(o,a,n.getDate())},se=(e,t,r=0)=>{Le("decode","unit",e),Nt("decode",r);const n=new Date(0);if(n.setHours(0,0,0,0),e==="year")return n.setFullYear(t,r,1),n;if(e==="month"){const a=Math.floor(t/12),i=t-a*12;return n.setFullYear(a,i,1),n}const o=new Date(t*24*60*60*1e3);return n.setFullYear(o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate()),n},Fn=e=>`; ${e} instead of a sentinel for "no bound"`,bl=Fn("minDate is required, so pass the earliest date to offer"),Ke=(e,t,r,n,o,a)=>{const i=Un(r,n,o);if(i===null)throw new RangeError(`${e}: ${t} must fall in a ${n} that starts inside the Date range (received: ${y(r)})${a}`);return i},Un=(e,t,r)=>{const n=U(t,e,r);return Number.isInteger(n)?n:null},wl=(e,t,r)=>{if(Le("addUnit","unit",e),!De(t))throw new RangeError(`addUnit: d must be a valid Date (received: ${y(t)})`);if(!Number.isInteger(r))throw new RangeError(`addUnit: amount must be an integer number of units (received: ${y(r)})`);const n=new Date(t.getTime());return r===0?n:e==="year"||e==="month"?(n.setFullYear(...ci(n.getFullYear(),n.getMonth(),n.getDate(),e==="year"?r*12:r)),n):(n.setDate(n.getDate()+r),n)},Ps=(e,t,r,n,o)=>{const a=Math.floor(t/12),[i,l,u]=e==="year"?[t,o,1]:e==="month"?[a,t-a*12,1]:Es(t),[d,m,x]=r==="year"||r==="month"?ci(i,l,u,r==="year"?n*12:n):Es(An(i,l,u)+n);return e==="year"?Wo(d,m,o):e==="month"?d*12+m:An(d,m,x)},vl=(e,t,r,n=0)=>{if(Le("getMacroWindowStartDate","macroUnit",e),Le("getMacroWindowStartDate","microUnit",t),!De(r))throw new RangeError(`getMacroWindowStartDate: d must be a valid Date (received: ${y(r)})`);return Nt("getMacroWindowStartDate",n),Ke("getMacroWindowStartDate","d",r,e,n,""),Ke("getMacroWindowStartDate","d",r,t,n,""),Rt(t,Rt(e,r,n),n)},Sl=(e,t,r,n=0)=>{if(Le("getMacroWindowEndDate","macroUnit",e),Le("getMacroWindowEndDate","microUnit",t),!De(r))throw new RangeError(`getMacroWindowEndDate: d must be a valid Date (received: ${y(r)})`);Nt("getMacroWindowEndDate",n);let o;const a=new Date(r.getTime());if(e==="year"&&t!=="year"){const[l,u]=ci(Wo(a.getFullYear(),a.getMonth(),n),n,1,11);o=t==="month"?l*12+u:An(l,u,Ba(l,u))}else if(e==="month"&&t==="day")o=An(a.getFullYear(),a.getMonth(),Ba(a.getFullYear(),a.getMonth()));else return Ke("getMacroWindowEndDate","d",r,t,n,""),Rt(t,r,n);const i=se(t,o,n);if(!De(i))throw new RangeError(`getMacroWindowEndDate: d must fall in a ${e} whose last ${t} starts inside the Date range (received: ${y(r)})`);return i},Ls=(e,t,r)=>e<t?t:e>r?r:e,$t=(e,t,r,n,o,a=0)=>{if(Le("resolveMacroWindow","macroUnit",e),Le("resolveMacroWindow","microUnit",t),Nt("resolveMacroWindow",a),Co("macroRange",r,!0,"resolveMacroWindow"),!De(n))throw new RangeError(`resolveMacroWindow: minDate must be a valid Date (received: ${y(n)})`);if(!De(o))throw new RangeError(`resolveMacroWindow: maxDate must be a valid Date (received: ${y(o)})`);if(o.getTime()<n.getTime())throw new RangeError(`resolveMacroWindow: maxDate must not precede minDate (minDate: ${y(n)}, maxDate: ${y(o)})`);Ke("resolveMacroWindow","maxDate",o,t,a,""),Ke("resolveMacroWindow","macroRange[0]",r[0],e,a,""),Ke("resolveMacroWindow","macroRange[0]",r[0],t,a,"");const i=U(e,r[1],a)<U(e,o,a)?Ls(Sl(e,t,r[1],a),n,o):o;return[Rt(t,Ls(vl(e,t,r[0],a),n,o),a),Rt(t,i,a)]},xl=(e,t)=>{if(!De(e))throw new RangeError(`resolveQuarter: d must be a valid Date (received: ${y(e)})`);Nt("resolveQuarter",t);const r=Rt("year",e,t).getFullYear(),n=new Date(e.getTime()),o=((n.getMonth()-t)%12+12)%12,a=Math.floor(o/3)+1;return n.setFullYear(r,t+3*(a-1),1),n.setHours(0,0,0,0),{year:r,quarter:a,startDate:n}},Tu={year:{year:"numeric"},month:{year:"numeric",month:"2-digit"},day:{year:"numeric",month:"2-digit",day:"2-digit"}},$s=new Map,Cu=(e,t)=>{const r=`${e}\0${t}`,n=$s.get(r);if(n!==void 0)return n;const o=new Intl.DateTimeFormat(t,Tu[e]);return $s.set(r,o),o},Iu=4,ku=6,Go=e=>e>=0?String(e).padStart(Iu,"0"):`-${String(-e).padStart(ku,"0")}`,Au=(e,t)=>{const r=new Date(t.getTime()),n=Go(r.getFullYear());if(e==="year")return n;const o=String(r.getMonth()+1).padStart(2,"0");if(e==="month")return`${n}-${o}`;const a=String(r.getDate()).padStart(2,"0");return`${n}-${o}-${a}`},it=(e,t,r,n)=>(Le("formatLabel","unit",e),De(t)?r?r(t,e,"period"):n===void 0?Au(e,t):Cu(e,n).format(t):""),Pr=(e,t,r,n)=>(Le("formatScreenReaderLabel","unit",e),it(e,t,r,n)),Nu=(e,t)=>{if(!De(e))return"";Nt("formatQuarterLabel",t);const{quarter:r}=xl(e,t);return`${it("year",Rt("year",e,t))}-Q${r}`},Me=(e,t,r,n=0)=>{if(Le("findNearestDateIndex","unit",r),Nt("findNearestDateIndex",n),!e||e.length===0||e.length===1)return 0;if(!De(t))throw new RangeError(`findNearestDateIndex: target must be a valid Date (received: ${y(t)})`);const o=Ke("findNearestDateIndex","target",t,r,n,"");let a=0,i=e.length-1;if(o<=U(r,e[a],n))return 0;if(o>=U(r,e[i],n))return i;for(;a<=i;){const d=a+i>>1,m=U(r,e[d],n);if(m===o)return d;m<o?a=d+1:i=d-1}const l=Math.abs(U(r,e[a],n)-o),u=Math.abs(U(r,e[i],n)-o);return l<u?a:i},Vu=(e,t,r,n,o=0)=>(Le("getSortedAllowedDates","unit",t),fr("getSortedAllowedDates",Ko(e),t,r,n,o).dates),Ko=e=>({list:e,path:"allowedDates",inheritedBy:null}),fr=(e,t,r,n,o,a)=>{Nt(e,a);const{list:i,path:l}=t,u=t.inheritedBy===null?"":` (inherited by the ${t.inheritedBy} row)`;if(sn(e,`${l}${u}`,i),i===void 0||i.length===0)return{keys:[],dates:[]};for(const[T,b]of[["minDate",n],["maxDate",o]])if(!De(b))throw new RangeError(`${e}: ${T} must be a valid Date (received: ${y(b)})`);const d=Ke(e,"minDate",n,r,a,""),m=Ke(e,"maxDate",o,r,a,""),x=new Map;for(let T=0;T<i.length;T++){const b=i[T];if(!De(b))throw new RangeError(`${e}: ${l}[${T}]${u} must be a valid Date (received: ${y(b)})`);const g=Ke(e,`${l}[${T}]${u}`,b,r,a,"");g<d||g>m||x.has(g)||x.set(g,Rt(r,b,a))}if(x.size===0)throw new RangeError(`${e}: every ${l} entry${u} falls outside [minDate, maxDate] (minDate: ${y(n)}, maxDate: ${y(o)}, entries: ${i.length})`);const L=Array.from(x.keys()).sort((T,b)=>T-b);return{keys:L,dates:L.map(T=>x.get(T))}},ui=(e,t,r,n,o,a)=>{const{keys:i,dates:l}=fr(e,t,r,n,o,a);return l.length===0?null:{...ln(i,null,null),dates:l}},Nn=(e,t)=>e===null?[]:e.dates.slice(t.loIndex,t.hiIndex+1),mo=(e,t,r,n,o)=>{const a=e.length-1;if(a<=0)return 0;const i=Me(e,n,t,o);if(r==="time"){const l=e[0].getTime(),u=e[a].getTime()-l;return u<=0?0:Math.max(0,Math.min(1,(e[i].getTime()-l)/u))}return i/a},fo=(e,t,r,n,o)=>{const a=e.length-1;if(a<=0)return 0;const i=Math.max(0,Math.min(1,n));if(r==="time"){const l=e[0].getTime(),u=e[a].getTime()-l;return u<=0?0:Me(e,new Date(l+i*u),t,o)}return Math.max(0,Math.min(a,Math.round(i*a)))},Wa=(e,t,r,n,o,a,i)=>{let l=r,u=n;return i?(l=t,u=t):e==="low"?t>n?(l=n,u=t):l=t:t<r?(u=r,l=t):u=t,[Math.max(o,Math.min(a,l)),Math.max(o,Math.min(a,u))]},Rl=({posDiffPct:e,startLowVal:t,startHighVal:r,rangeMin:n,rangeMax:o,isDiscrete:a,sortedAllowedDates:i,snapMode:l,unit:u,yearStartMonth:d=0})=>{if(Le("calculateConnectDragValues","unit",u),a){const g=i.length-1;if(g<=0)return[0,0];const w=Math.max(0,Math.min(g,Math.round(t))),h=Math.max(w,Math.min(g,Math.round(r)));if(l==="time"){const f=i[0].getTime(),ue=i[g].getTime(),K=i[w].getTime(),re=i[h].getTime()-K;let ee=K+e*(ue-f),B=ee+re;ee<f&&(ee=f,B=f+re),B>ue&&(B=ue,ee=ue-re);const ne=Me(i,new Date(ee),u,d),A=Me(i,new Date(B),u,d);return[ne,Math.max(ne,A)]}const D=Math.round(e*g);let M=w+D,v=h+D;return M<0&&(v+=-M,M=0),v>g&&(M-=v-g,v=g),[Math.max(0,Math.min(g,M)),Math.max(0,Math.min(g,v))]}const m=g=>Math.max(n,Math.min(o,g)),x=o-n;if(x<=0)return[m(t),m(r)];const L=Math.round(e*x);let T=t+L,b=r+L;return T<n&&(b+=n-T,T=n),b>o&&(T-=b-o,b=o),[m(T),m(b)]},Ml=(e,t,r,n,o,a,i,l)=>{let u=0,d=!1,m=!1;switch(e){case"ArrowRight":case"ArrowUp":u=l;break;case"ArrowLeft":case"ArrowDown":u=-l;break;case"PageUp":u=l*5;break;case"PageDown":u=-l*5;break;case"Home":d=!0;break;case"End":m=!0;break;default:return null}if(i){let T=r;return d?T=o:m?T=a:T=Math.max(o,Math.min(a,r+u)),[T,T]}let x=r,L=n;return t==="low"?d?x=o:m?x=n:x=Math.max(o,Math.min(n,r+u)):d?L=r:m?L=a:L=Math.max(r,Math.min(a,n+u)),[x,L]},Dl=8,yl=2,El=16,Ou=12,_u=90,di=1.15,qo=(e,t,r)=>{const n=r*Math.PI/180,o=Math.abs(Math.sin(n)),a=Math.abs(Math.cos(n));return{alongPx:(e*a+t*o)/2,acrossPx:(e*o+t*a)/2}},To=e=>Dl+(e?.anchorGapY??yl),Xo=(e,t)=>{const r=t?.estimatedHeightPx??El,o=To(t)+r/2,a=e==="top"?-o:o;return{lowAngleDeg:0,highAngleDeg:0,lowOffsetX:0,highOffsetX:0,lowOffsetY:a,highOffsetY:a,isSlanted:!1,isFlipped:!1,proximity:0}},Yu=e=>{for(const t of["topPx","bottomPx"]){const r=e[t];if(typeof r!="number"||Number.isNaN(r)||r<0)throw new RangeError(`calculateLabelSlant: config.room.${t} must be a number of pixels, zero or more (Infinity for unbounded) (received: ${y(r)})`)}},Hu=(e,t,r)=>{if(r<=t/2)return 0;const n=Math.min(1,2*r/Math.hypot(e,t));return(Math.asin(n)-Math.atan2(t,e))*180/Math.PI},ju=(e,t,r,n,o,a,i,l)=>{if(i===void 0)return{side:t,angleDeg:e};const u=t==="top"?"bottom":"top",d=b=>b==="top"?i.topPx:i.bottomPx,m=b=>b===t?o:a,x=b=>m(b)+(1+l)*qo(r,n,e).acrossPx;if(x(t)<=d(t))return{side:t,angleDeg:e};if(x(u)<=d(u))return{side:u,angleDeg:e};const L=d(u)-m(u)>d(t)-m(t)?u:t,T=(d(L)-m(L))/(1+l);return{side:L,angleDeg:Math.min(e,Hu(r,n,T))}},Pl=(e,t,r,n="top",o)=>{const a=o?.estimatedWidthPx,i=o?.estimatedHeightPx??El,l=o?.paddingPx??Ou,u=o?.maxAngleDeg??_u,d=o?.room,m=o?.drawnScale??1;if(d!==void 0&&Yu(d),typeof m!="number"||!Number.isFinite(m)||m<=0)throw new RangeError(`calculateLabelSlant: config.drawnScale must be a positive finite number (received: ${y(m)})`);const x=To(o),L=o?.flipClearancePx??x;if(typeof L!="number"||!Number.isFinite(L)||L<0)throw new RangeError(`calculateLabelSlant: config.flipClearancePx must be a finite number of pixels, zero or more (received: ${y(L)})`);const T=Xo(n,o);if(!(Number.isFinite(r)&&r>0)||a===void 0||!Number.isFinite(a)||a<=0)return T;const b=Math.max(0,t-e)/100*r,g=a+l;if(b>=g)return T;const w=Math.max(0,Math.min(1,(g-b)/g)),h=w*w*w*(w*(w*6-15)+10),D=ju(h*u,n,a,i,x,L,d,m),M=D.angleDeg===0?0:D.side==="top"?-D.angleDeg:D.angleDeg,v=qo(a,i,D.angleDeg),f=(D.side===n?x:L)+v.acrossPx,ue=D.side==="top"?-f:+f,K=2*v.alongPx,re=Math.max(0,(K+l-b)/2);return{lowAngleDeg:M,highAngleDeg:M,lowOffsetX:-re,highOffsetX:re,lowOffsetY:ue,highOffsetY:ue,isSlanted:w>.001,isFlipped:D.side!==n,proximity:w}},Fu=e=>({...e,lowOffsetX:0,highOffsetX:0}),mi=(e,t,r,n)=>{if(r.isMerged&&r.keepMergedLabelUpright)return Xo(r.labelPosition,n);const o=Pl(e,t,r.trackLengthPx,r.labelPosition,n);return r.isMerged?Fu(o):o},Ht=(e,t)=>(e==="macro"?t.macroIsDiscrete:t.microIsDiscrete)===!0,Lt=(e,t)=>{const r=e==="macro"?t.macroAllowedDates:t.microAllowedDates;return r!==void 0?{list:r,path:e==="macro"?"macroAllowedDates":"microAllowedDates",inheritedBy:null}:{list:t.allowedDates,path:"allowedDates",inheritedBy:e}},Do=(e,t,r,n)=>e==="pan"?Lu(t,r,Math.max(r,n)):So(t,r,Math.max(r,n)),fi=(e,t)=>{const r=t==="macro-top"||t==="macro-left",n=e<0;return r&&n||!(r||n)?"macro":"micro"},Ll=(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 $l(e,t,r,n,o,a,i="macro-top",l=.05,u=!0,d="range"){if(fi(t,i)==="macro"){const L=Math.abs(e-r),T=Math.abs(e-n);return L<=l&&L<=T?"macro-low":T<=l&&T<L?"macro-high":u&&e>=r&&e<=n?"macro-connect":L<T?"macro-low":"macro-high"}if(d==="point")return"micro-point";const m=Math.abs(e-o),x=Math.abs(e-a);return m<=l&&m<=x?"micro-low":x<=l&&x<m?"micro-high":u&&e>=o&&e<=a?"micro-connect":m<x?"micro-low":"micro-high"}function Tl(e,t,r,n,o){if(e==="macro-connect"){const[d,m]=si(t-r,n,o);return[d,m,"macro-connect"]}const a=e==="macro-low"?"low":"high",[i,l]=$o(a,t,n,o),u=jo(a,t,n,o);return[i,l,u==="low"?"macro-low":"macro-high"]}function Cl(e,t,r,n,o){if(e==="micro-point"){const[d]=$o("point",t,n,o);return[d,d,"micro-point"]}if(e==="micro-connect"){const[d,m]=si(t-r,n,o);return[d,m,"micro-connect"]}const a=e==="micro-low"?"low":"high",[i,l]=$o(a,t,n,o),u=jo(a,t,n,o);return[i,l,u==="low"?"micro-low":"micro-high"]}const En=s.memo(({type:e,isTop:t=!0,isVertical:r=!1,isLeft:n=!0})=>{let o,a;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",a=`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",a=`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 C.jsx("svg",{className:a,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:C.jsx("path",{d:o,className:i,shapeRendering:"geometricPrecision",strokeWidth:"1.25"})})});En.displayName="VernierKnobSvg";const Uu=(e,t,r,n)=>{if(!De(e))throw new RangeError(`PeriodSlider: minDate is required and must be a valid Date (received: ${y(e)})`);if(!De(t))throw new RangeError(`PeriodSlider: maxDate is required and must be a valid Date (received: ${y(t)})`);if(t.getTime()<=e.getTime())throw new RangeError(`PeriodSlider: maxDate must be strictly later than minDate (minDate: ${y(e)}, maxDate: ${y(t)})`);for(const o of r)Ke("PeriodSlider","minDate",e,o,n,bl)},Co=(e,t,r,n="PeriodSlider")=>{if(!At(t)||t.length!==2){const i=r?"is required and must":"must";throw new RangeError(`${n}: ${e} ${i} be a [start, end] Date tuple (received: ${y(t)})`)}const[o,a]=t;if(!De(o))throw new RangeError(`${n}: ${e}[0] must be a valid Date (received: ${y(o)})`);if(!De(a))throw new RangeError(`${n}: ${e}[1] must be a valid Date (received: ${y(a)})`);if(a.getTime()<o.getTime())throw new RangeError(`${n}: ${e} must not be inverted (start: ${y(o)}, end: ${y(a)})`)},Il=(e,t)=>{if(!De(t))throw new RangeError(`PeriodSlider: ${e} must be a valid Date (received: ${y(t)})`)},Qr=(e,t,r,n,o,a)=>{const i=Ke("PeriodSlider",e,t,r,a,"");if(i<U(r,n,a)||i>U(r,o,a))throw new RangeError(`PeriodSlider: ${e} must lie within [minDate, maxDate] (received: ${y(t)}, minDate: ${y(n)}, maxDate: ${y(o)})`)},zu=(e,t,r)=>{const n=e.yearStartMonth??0;if(e.mode==="range"){for(const o of["range","defaultRange"]){const a=e[o];a!==void 0&&(Co(o,a,!1),Qr(`${o}[0]`,a[0],e.unit,t,r,n),Qr(`${o}[1]`,a[1],e.unit,t,r,n))}return}if(e.mode==="point")for(const o of["value","defaultValue"]){const a=e[o];a!==void 0&&(Il(o,a),Qr(o,a,e.unit,t,r,n))}},Bu=(e,t,r)=>{const n=e.yearStartMonth??0;Co("macroRange",e.macroRange,!0),Ke("PeriodSlider","macroRange[0]",e.macroRange[0],Qt("PeriodSlider","macroUnit",e.macroUnit,e.unit),n,"");const o=Qt("PeriodSlider","microUnit",e.microUnit,e.unit),a=e.microRange!==void 0||e.defaultMicroRange!==void 0||e.onChangeMicroRange!==void 0,i=e.microValue!==void 0||e.defaultMicroValue!==void 0||e.onChangeMicroPoint!==void 0;if(a&&i)throw new RangeError("PeriodSlider: vernier mode takes either a micro range (microRange / defaultMicroRange / onChangeMicroRange) or a micro point (microValue / defaultMicroValue / onChangeMicroPoint), never both");if(i){for(const d of["microValue","defaultMicroValue"]){const m=e[d];m!==void 0&&(Il(d,m),Qr(d,m,o,t,r,n))}const u=e.microValue!==void 0?e.microValue:e.defaultMicroValue;if(u===void 0)throw new RangeError("PeriodSlider: vernier point mode requires a micro selection; supply microValue (controlled) or defaultMicroValue (uncontrolled)");return{shape:"point",selection:[u,u]}}for(const u of["microRange","defaultMicroRange"]){const d=e[u];d!==void 0&&(Co(u,d,!1),Qr(`${u}[0]`,d[0],o,t,r,n),Qr(`${u}[1]`,d[1],o,t,r,n))}const l=e.microRange!==void 0?e.microRange:e.defaultMicroRange;if(l!==void 0)return{shape:"range",selection:l};throw a?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")},Sn=(e,t,r,n,o,a,i,l,u)=>{const d=Me(e,n,t,u),m=Me(e,o,t,u);return i?d:l?m:Math.max(d,Math.min(m,Me(e,r,t,u)+a))},Na=e=>{e.timerId!==null&&clearTimeout(e.timerId),e.timerId=null,e.emit=null};function Wu(e,t){return t&&e[0].getTime()!==e[1].getTime()?[e[0],e[0]]:e}function Gu(e,t){return t?e==="micro-low"||e==="micro-high"||e==="micro-connect"?"micro-point":e:e==="micro-point"?"micro-high":e}const Ts=()=>{const[e,t]=s.useState(null),r=s.useRef(null),n=s.useCallback((a,i)=>{const l=r.current;if(l!==null&&l[0].getTime()===a.getTime()&&l[1].getTime()===i.getTime())return;const u=[a,i];r.current=u,t(u)},[]),o=s.useCallback(()=>{r.current!==null&&(r.current=null,t(null))},[]);return{shown:e,show:n,release:o}},Zo=(e,t,r)=>{try{Intl.DateTimeFormat.supportedLocalesOf([r])}catch{throw new RangeError(`${e}: ${t} must be a valid BCP 47 language tag (received: ${y(r)})`)}},Ku=e=>{if(typeof e!="object"||e===null)return!1;try{return e.nodeType===1&&typeof e.getBoundingClientRect=="function"}catch{return!1}},Cs=(e,t)=>{if(t==null)return null;if(Ku(t))return t;let r=!1;try{r=typeof t=="object"&&"current"in t}catch{r=!1}throw new RangeError(`PeriodSlider: ${e} must be an Element or null (received: ${y(t)})${r?"; pass the element itself (ref.current), not the ref object":""}`)},Xr=()=>{const[e,t]=s.useState(null),r=s.useRef(null),n=s.useCallback(o=>{if(r.current?.disconnect(),r.current=null,o===null){t(null);return}if(typeof ResizeObserver>"u")return;const a=new ResizeObserver(i=>{for(const l of i){const u=l.borderBoxSize?.[0];u!==void 0&&t(d=>d!==null&&Math.abs(d.widthPx-u.inlineSize)<.5&&Math.abs(d.heightPx-u.blockSize)<.5?d:{widthPx:u.inlineSize,heightPx:u.blockSize})}});a.observe(o),r.current=a},[]);return s.useEffect(()=>()=>{r.current?.disconnect(),r.current=null},[]),[n,e]},Is=(e,t)=>{const r=e.querySelector(`[data-handle-type^="${t}-"]`);if(r===null)return null;const n=r.querySelector("[data-tooltip-style]"),o=r.getAttribute("data-vernier-pos");return n===null||o!=="top"&&o!=="bottom"?null:iu(e,r,n,o)},qu=(e,t,r)=>{const n=au(e,t,r);return n===null?null:{room:n,macro:Is(e,"macro"),micro:Is(e,"micro")}},Xu=.5,Io=(e,t)=>e===t||Math.abs(e-t)<Xu,ks=(e,t)=>e===null||t===null?e===t:Io(e.anchorPx,t.anchorPx)&&Io(e.knobCentrePx,t.knobCentrePx),Zu=(e,t)=>e===null||t===null?e===t:Io(e.room.topPx,t.room.topPx)&&Io(e.room.bottomPx,t.room.bottomPx)&&ks(e.macro,t.macro)&&ks(e.micro,t.micro),Qu=(e,t)=>yo(Eo(e,t)),yo=e=>e===null?void 0:{estimatedWidthPx:e.widthPx,estimatedHeightPx:e.heightPx},Eo=(e,t)=>e===null||t===null?null:{widthPx:Math.max(e.widthPx,t.widthPx),heightPx:Math.max(e.heightPx,t.heightPx)},Ju=e=>{const t=new Map;let r=0;for(const a of e){const{side:i,box:l}=a;if(l===null)continue;let u;if(a.reach==="inline-size")u=l.widthPx,r=Math.max(r,l.heightPx/2);else{const m=qo(l.widthPx,l.heightPx,a.angleDeg);u=a.centreFromAnchorPx+m.acrossPx,r=Math.max(r,m.alongPx+Math.abs(a.alongPushPx))}const d=t.get(i);t.set(i,d===void 0?u:Math.max(d,u))}if(t.size===0)return;const n={};for(const[a,i]of t)n[`--ps-label-reach-${a}`]=`${Math.ceil(i)}px`;const o=Math.ceil(r);return n["--ps-label-reach-main"]=`${o}px`,{style:n,mainPx:o}},Ga=(e,t,r)=>({"leader-length":`${r?Math.hypot(e,t):0}px`,"leader-angle":`${Math.atan2(t,e)*180/Math.PI}deg`}),As=(e,t,r,n)=>({tx:`calc(-50% + ${e}px)`,ty:`${t}px`,rot:`${r}deg`,...n}),Ns=(e,t,r,n)=>({tx:`calc(-50% + ${e}px)`,ty:`calc(-50% + ${t}px)`,rot:`${r}deg`,...Ga(e,t,n)}),ko=(e,t)=>({"--ps-tooltip-tx":Ln(e,"tx",t.tx),"--ps-tooltip-ty":Ln(e,"ty",t.ty),"--ps-tooltip-rot":Ln(e,"rot",t.rot)}),Ao=(e,t)=>({"--ps-label-leader-length":Ln(e,"leader-length",t["leader-length"]),"--ps-label-leader-angle":Ln(e,"leader-angle",t["leader-angle"])}),Va=(e,t,r,n)=>{const o=ed(n),a=o===null?n.config:o.config,i=Xo(n.labelPosition,a);if(!n.isSlantable)return{slant:i,lowStyle:void 0,highStyle:void 0,lowLeaderStyle:void 0,highLeaderStyle:void 0,centreFromAnchorPx:Math.abs(i.lowOffsetY)-To(a),placements:null};const l=mi(t*100,r*100,n,a),u=Ho[e],d=o!==null&&l.isFlipped?o.oppositeAnchorPx:To(a),m=n.anchor===null?0:(n.labelPosition==="top"?-1:1)*n.anchor.knobCentrePx,x={low:As(l.lowOffsetX,l.lowOffsetY-i.lowOffsetY,l.lowAngleDeg,Ga(l.lowOffsetX,l.lowOffsetY-m,l.isFlipped)),high:As(l.highOffsetX,l.highOffsetY-i.highOffsetY,l.highAngleDeg,Ga(l.highOffsetX,l.highOffsetY-m,l.isFlipped))};return{slant:l,lowStyle:ko(u.low,x.low),highStyle:ko(u.high,x.high),lowLeaderStyle:Ao(u.low,x.low),highLeaderStyle:Ao(u.high,x.high),centreFromAnchorPx:Math.abs(l.lowOffsetY)-d,placements:x}},ed=e=>e.config===void 0||e.anchor===null||e.opposite===null||e.room===void 0?null:{config:{...e.config,anchorGapY:e.anchor.anchorPx-Dl,flipClearancePx:e.opposite.anchorPx+e.opposite.reachPx+yl,room:e.room,drawnScale:di},oppositeAnchorPx:e.opposite.anchorPx},Vs=(e,t,r,n)=>{if(r.anchor===null||n===null)return null;const o=r.isSlantable?mi(e*100,t*100,r,r.config).lowAngleDeg:0;return{anchorPx:r.anchor.anchorPx,reachPx:(1+di)*qo(n.widthPx,n.heightPx,o).acrossPx}},Os={"--ps-tooltip-origin":"100% 50%","--ps-tooltip-tx":"0px","--ps-tooltip-ty":"-50%","--ps-tooltip-rot":"0deg"},_s=(e,t,r)=>{const n=Xo(r.labelPosition,r.config);if(r.isVertical)return{slant:n,lowStyle:Os,highStyle:Os,lowLeaderStyle:void 0,highLeaderStyle:void 0,placements:null};const o=r.autoSlantLabels&&!r.isPointMode;let a=n;if(o){const u=r.config===void 0||r.room===void 0?r.config:{...r.config,room:r.room,drawnScale:di};a=mi(e,t,r,u)}const i=Ho.flat,l={low:Ns(a.lowOffsetX,a.lowOffsetY,a.lowAngleDeg,a.isFlipped),high:Ns(a.highOffsetX,a.highOffsetY,a.highAngleDeg,a.isFlipped)};return{slant:a,lowStyle:{"--ps-tooltip-origin":"50% 50%",...ko(i.low,l.low)},highStyle:{"--ps-tooltip-origin":"50% 50%",...ko(i.high,l.high)},lowLeaderStyle:o?Ao(i.low,l.low):void 0,highLeaderStyle:o?Ao(i.high,l.high):void 0,placements:o?l:null}},td={horizontal:{decrease:"left",increase:"right"},vertical:{decrease:"down",increase:"up"}},rd={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"}},Ys={horizontal:"px-[calc(var(--ps-target-size)/2)]",vertical:"py-[calc(var(--ps-target-size)/2)]"},nd={horizontal:{withSteppers:`grid-cols-[auto_minmax(0,1fr)_auto] ${Tn} ${ys.horizontal}`,railOnly:`grid-cols-[minmax(0,1fr)] ${Ys.horizontal}`},vertical:{withSteppers:`grid-rows-[auto_minmax(0,1fr)_auto] ${Tn} ${ys.vertical}`,railOnly:`grid-rows-[minmax(0,1fr)] ${Ys.vertical}`}},Hs={horizontal:{leading:"col-start-1 row-start-1",rail:"col-start-2 row-start-1",railOnly:"col-start-1 row-start-1",trailing:"col-start-3 row-start-1"},vertical:{leading:"col-start-1 row-start-1",rail:"col-start-1 row-start-2",railOnly:"col-start-1 row-start-1",trailing:"col-start-1 row-start-3"}},js=(e,t)=>{e.setPointerCapture(t)},od=e=>{const{unit:t,minDate:r,maxDate:n,allowedDates:o,snapMode:a="index",disabled:i=!1,className:l="",showStepper:u=!0,tooltipStyle:d="always",labelPosition:m="top",autoSlantLabels:x=!0,keepMergedLabelUpright:L=!1,showLabelLeaderLines:T=!1,isVertical:b=!1,hideConnectBar:g=!1,showTicks:w=!1,colorScheme:h="blue-rose",formatLocale:D}=e;Le("PeriodSlider","unit",t);const M=e.mode==="vernier"?Qt("PeriodSlider","macroUnit",e.macroUnit,t):t,v=e.mode==="vernier"?Qt("PeriodSlider","microUnit",e.microUnit,t):t,f=gr("PeriodSlider",e.yearStartMonth);Uu(r,n,e.mode==="vernier"?[M,v,t]:[t],f),zu(e,r,n),D!==void 0&&Zo("PeriodSlider","formatLocale",D);const ue=Cs("labelCeiling",e.labelCeiling),K=Cs("labelFloor",e.labelFloor),re=e.mode==="vernier"?Bu(e,r,n):null,ee=re!==null&&re.shape==="point",B=zo(e.locale,e.labels),ne=hl[h],A=s.useId(),q=s.useRef(e),j=r.getTime(),k=n.getTime(),$=e.mode==="vernier",H=s.useMemo(()=>$?[]:fr("PeriodSlider",Ko(o),t,r,n,f).dates,[$,o,t,j,k,f]),Y=H.length>0,{rangeMin:N,rangeMax:F}=s.useMemo(()=>Y?{rangeMin:0,rangeMax:H.length-1}:{rangeMin:U(t,r,f),rangeMax:U(t,n,f)},[Y,H,t,j,k,f]),G=e.mode==="point",he=s.useCallback(c=>{if(Y){const p=Math.max(0,Math.min(H.length-1,Math.round(c)));return H[p]}return se(t,Math.round(c),f)},[Y,H,t,f]),te=s.useCallback(c=>{if(c===void 0)return N;const p=Rt(t,c,f);return Y?Me(H,p,t,f):U(t,p,f)},[Y,H,t,N,f]),[le,Se]=s.useState(()=>re===null?null:re.selection),ae=le??(re===null?null:re.selection),ie=ae===null?null:Wu(ae,ee);s.useLayoutEffect(()=>{ie!==ae&&Se(c=>c===le?ie:c)});const pe=e.mode==="vernier"?e.microValue?.getTime():void 0,je=s.useMemo(()=>e.mode!=="vernier"||e.microValue===void 0?null:[e.microValue,e.microValue],[e.mode,pe]),ft=Ts(),ge=Ts(),V=e.mode!=="vernier"?null:ee?je??ie:e.microRange!==void 0?e.microRange:ie,X=V===null?null:ge.shown??V,de=e.mode==="range"?e.range?.[0]??e.defaultRange?.[0]:e.mode==="vernier"?X?.[0]:void 0,Oe=e.mode==="range"?e.range?.[1]??e.defaultRange?.[1]:e.mode==="vernier"?X?.[1]:void 0,we=e.mode==="point"?e.value??e.defaultValue:void 0,tt=e.mode==="point"?we?.getTime():de?.getTime(),qe=e.mode==="range"?Oe?.getTime():tt,[Fe,st]=s.useMemo(()=>{if(e.mode==="point"){const S=te(we);return[S,S]}const c=te(de),p=te(Oe);return[Math.min(c,p),Math.max(c,p)]},[e.mode,tt,qe,te,we,de,Oe]),oe=e.mode==="point"?e.value!==void 0:e.mode==="range"?e.range!==void 0:ee?e.microValue!==void 0:e.microRange!==void 0,[pt,Xe]=s.useState(()=>$?null:[Fe,st]),ht=pt??[Fe,st],[Ae,We]=s.useState(null),[ye,bt]=s.useState(null),rt=s.useRef(null),[zt,I]=s.useState("high"),[J,Ue]=s.useState(null),[lt,Ge]=s.useState(null),Re=Ae?Ae[0]:oe?Fe:ht[0],$e=Ae?Ae[1]:oe?st:ht[1],Ir=s.useRef([Re,$e]),_=e.mode==="vernier"?e.vernierOrientation??(b?"macro-left":"macro-top"):"macro-top",P=_==="macro-top"||_==="macro-left",xe=e.mode==="vernier"?e.showVernierProjection??!0:!1,_e=e.mode==="vernier"?e.showVernierTicks??!0:!1,E=e.mode==="vernier"?e.showHairline??!0:!1,z=$?Ht("macro",e):Y,ce=$?Ht("micro",e):Y,Ne=$?Lt("macro",e).list:o,Te=$?Lt("micro",e).list:o,Ve=$?e.formatMacroLabel??e.formatLabel:e.formatLabel,Ye=$?e.formatMicroLabel??e.formatLabel:e.formatLabel,Tt=de?.getTime(),Jt=Oe?.getTime(),[nt,pr]=s.useState(null),er=s.useRef(null),[ra,kr]=s.useState(()=>ee?"micro-point":"micro-high"),Ze=Gu(ra,ee);s.useLayoutEffect(()=>{Ze!==ra&&kr(c=>c===ra?Ze:c)});const wt=s.useMemo(()=>U(M,r,f),[j,M,f]),Vt=s.useMemo(()=>U(M,n,f),[k,M,f]),Bn=s.useMemo(()=>$&&ce?ui("PeriodSlider",Lt("micro",e),v,r,n,f):null,[$,ce,Te,v,j,k,f]),Ce=s.useMemo(()=>$&&z?fr("PeriodSlider",Lt("macro",e),M,r,n,f).dates:[],[$,z,Ne,M,j,k,f]),vi=c=>[Math.max(wt,Math.min(Vt,U(M,c[0],f))),Math.max(wt,Math.min(Vt,U(M,c[1],f)))],[Si,xi]=e.mode!=="vernier"?[wt,Vt]:vi(e.macroRange),[Qe,ct]=ft.shown===null?[Si,xi]:vi(ft.shown),br=s.useMemo(()=>se(M,Qe,f),[M,Qe,f]),wr=s.useMemo(()=>se(M,ct,f),[M,ct,f]),Wn=s.useMemo(()=>e.mode!=="vernier"?[r,n]:$t(M,v,[br,wr],r,n,f),[e.mode,br,wr,M,v,j,k,f]),He=s.useMemo(()=>U(v,Wn[0],f),[v,Wn,f]),ot=s.useMemo(()=>U(v,Wn[1],f),[v,Wn,f]),na=(c,p)=>Bn===null?[]:Nn(Bn,ln(Bn.ascending,c,p)),be=s.useMemo(()=>na(He,ot),[Bn,He,ot]),tr=z&&Ce.length>0,Ct=ce&&be.length>0,Ri=tr?U(M,Ce[0],f):wt,Mi=tr?U(M,Ce[Ce.length-1],f):Vt,Di=Ct?U(v,be[0],f):He,oa=Ct?U(v,be[be.length-1],f):ot,ql=Math.min(Ri,Qe),Xl=Math.max(Mi,ct),rr=(c,p,S,R)=>p.length>0?U(v,p[Me(p,c,v,f)],f):Math.max(S,Math.min(R,U(v,c,f))),Ar=Ct?be:[],ze=s.useMemo(()=>X===null?He:rr(X[0],Ar,He,ot),[Tt,He,ot,v,X,Ar]),at=s.useMemo(()=>X===null?ot:rr(X[1],Ar,He,ot),[Jt,He,ot,v,X,Ar]),Nr=s.useMemo(()=>se(v,ze,f),[v,ze,f]),Vr=s.useMemo(()=>se(v,at,f),[v,at,f]),yi=!$||V===null?null:{macroUnit:M,macroLowEnc:Si,macroHighEnc:xi,microUnit:v,microLowEnc:U(v,V[0],f),microHighEnc:U(v,V[1],f)},aa=s.useRef(yi),ia=Math.max(1,Vt-wt),Mt=tr?mo(Ce,M,a,br,f):Math.max(0,Math.min(1,(Qe-wt)/ia)),It=Math.max(Mt,tr?mo(Ce,M,a,wr,f):Math.min(1,(ct-wt)/ia)),Ei=c=>Math.max(Ri,Math.min(Mi,Math.round(wt+c*ia))),Gn=Math.max(1,ot-He),vr=Ct?mo(be,v,a,Nr,f):Math.max(0,Math.min(1,(ze-He)/Gn)),Or=Math.max(vr,Ct?mo(be,v,a,Vr,f):Math.min(1,(at-He)/Gn)),sa=s.useRef({timerId:null,emit:null}),Kn=s.useRef({timerId:null,emit:null}),qn=s.useRef({timerId:null,emit:null});s.useEffect(()=>{const c=[sa,Kn,qn];return()=>{for(const p of c)Na(p.current)}},[]);const _r=s.useCallback((c,p,S)=>{Na(c);const{debounceMs:R}=q.current;if(S||!R||R<=0){p();return}c.emit=p,c.timerId=setTimeout(()=>{c.timerId=null,c.emit=null,p()},R)},[]),Pi=s.useCallback(c=>{const p=c.emit;Na(c),p?.()},[]),Yr=s.useCallback(c=>new Date(Math.min(Math.max(c.getTime(),j),k)),[j,k]),nr=s.useCallback((c,p,S=!1)=>{const[R,O]=Ir.current;if((q.current.mode==="point"?c===R:c===R&&p===O)&&sa.current.timerId===null)return;const Z=he(c),Q=he(p),fe=()=>{const ve=q.current;ve.mode==="point"?ve.onChangePoint?.(Z):ve.mode==="range"&&ve.onChangeRange?.(Z,Q)};_r(sa.current,fe,S)},[he,_r]),Sr=s.useCallback((c,p,S=!1)=>{const R=aa.current;if(q.current.mode!=="vernier"||R===null)return;const O=Yr(c),W=Yr(p);U(R.macroUnit,O,f)===R.macroLowEnc&&U(R.macroUnit,W,f)===R.macroHighEnc&&Kn.current.timerId===null||_r(Kn.current,()=>{const Z=q.current;Z.mode==="vernier"&&Z.onChangeMacroRange?.(O,W)},S)},[Yr,_r,f]),Dt=s.useCallback((c,p,S=!1)=>{const R=q.current,O=aa.current;if(R.mode!=="vernier"||O===null)return;const W=Yr(c),Z=Yr(p);U(O.microUnit,W,f)===O.microLowEnc&&U(O.microUnit,Z,f)===O.microHighEnc&&qn.current.timerId===null||((ee?R.microValue===void 0:R.microRange===void 0)&&Se([W,Z]),_r(qn.current,()=>{const Q=q.current;if(Q.mode==="vernier"){if(ee){Q.onChangeMicroPoint?.(W);return}Q.onChangeMicroRange?.(W,Z)}},S))},[Yr,_r,ee,f]),Li=s.useCallback((c,p=!1)=>{Dt(c,c,p)},[Dt]),xr=s.useCallback(c=>{if(Y&&a==="time"&&H.length>1){const R=Math.max(0,Math.min(H.length-1,Math.round(c))),O=H[0].getTime(),Z=H[H.length-1].getTime()-O;if(Z<=0)return 0;const Q=H[R].getTime();return Math.max(0,Math.min(100,(Q-O)/Z*100))}const p=F-N;if(p<=0)return 0;const S=(c-N)/p*100;return Math.max(0,Math.min(100,S))},[Y,a,H,N,F]),la=s.useCallback(c=>{const p=Math.max(0,Math.min(100,c));if(Y){if(a==="time"&&H.length>1){const O=H[0].getTime(),Z=H[H.length-1].getTime()-O,Q=O+p/100*Z;return Me(H,new Date(Q),t,f)}const R=Math.round(p/100*(H.length-1));return Math.max(0,Math.min(H.length-1,R))}const S=N+p/100*(F-N);return Math.round(S)},[Y,a,H,N,F,t,f]),cn=s.useRef(null),$i=s.useRef(null),Ti=s.useRef(0),ut=s.useRef(null),ca=s.useRef(null),Ci=s.useRef(null),Ii=s.useRef(null),[ua,ki]=s.useState(0),[Zl,Xn]=Xr(),[Ql,Ai]=Xr(),[Jl,ec]=Xr(),[tc,rc]=Xr(),[nc,Ni]=Xr(),[oc,ac]=Xr(),[ic,sc]=s.useState(null),da=!b&&d!=="hover",Hr=da?ic:null,lc=G?yo(Xn):Qu(Xn,Ai),ma=!G&&Re===$e,fa=Qe===ct,ha=!ee&&ze===at,cc=P?"top":"bottom",uc=P?"bottom":"top",Vi=x&&!b,dc=Vi&&!ee,ga=Hr===null?void 0:Hr.room,pa={isPointMode:G,isVertical:b,autoSlantLabels:x,isMerged:ma,keepMergedLabelUpright:L,trackLengthPx:ua,labelPosition:m,config:lc,room:ga},ba=Eo(ec,rc),wa=ee?Ni:Eo(Ni,ac),Oi={trackLengthPx:ua,labelPosition:cc,config:yo(ba),isMerged:fa,keepMergedLabelUpright:L,isSlantable:Vi,room:ga,anchor:Hr===null?null:Hr.macro},_i={trackLengthPx:ua,labelPosition:uc,config:yo(wa),isMerged:ha,keepMergedLabelUpright:L,isSlantable:dc,room:ga,anchor:Hr===null?null:Hr.micro},va={...Oi,opposite:Vs(vr,Or,_i,wa)},Sa={..._i,opposite:Vs(Mt,It,Oi,ba)};s.useEffect(()=>{const c=ut.current;if(!c)return;const p=()=>{const R=c.getBoundingClientRect(),O=b?R.height:R.width;O>0&&ki(W=>Math.abs(W-O)<.5?W:O)};if(p(),typeof ResizeObserver<"u"){const R=new ResizeObserver(O=>{for(const W of O){const Z=b?W.contentRect.height:W.contentRect.width;Z>0&&ki(Q=>Math.abs(Q-Z)<.5?Q:Z)}});return R.observe(c),()=>R.disconnect()}const S=c.ownerDocument.defaultView;if(S)return S.addEventListener("resize",p),()=>S.removeEventListener("resize",p)},[b]);const jr=s.useCallback((c,p,S)=>{const R=b?S.height:S.width;if(!(Number.isFinite(R)&&R>0))return null;const O=b?S.bottom-p:c-S.left;return Number.isFinite(O)?Math.max(0,Math.min(1,O/R)):null},[b]),Yi=s.useCallback((c,p)=>{const S=ut.current;if(!S)return null;const R=jr(c,p,S.getBoundingClientRect());return R===null?null:R*100},[jr]),un=s.useRef(null),Bt=s.useRef(null),Zn=s.useRef({macroLowRatio:Mt,macroHighRatio:It,isVertical:b,isMacroFirstRail:P}),Hi=s.useRef({flat:pa,macro:va,micro:Sa}),ji=s.useRef({ceiling:ue,floor:K,isMeasured:da});s.useLayoutEffect(()=>{Zn.current={macroLowRatio:Mt,macroHighRatio:It,isVertical:b,isMacroFirstRail:P},Hi.current={flat:pa,macro:va,micro:Sa},ji.current={ceiling:ue,floor:K,isMeasured:da},q.current=e,Ir.current=[Re,$e],aa.current=yi,rt.current=ye,er.current=nt});const Fi=(c,p)=>{const S=Zn.current;ca.current?.setAttribute("d",Ca(c,p,S.isVertical,S.isMacroFirstRail))},mc=(c,p,S)=>{const R=Hi.current;return c==="flat"?_s(p*100,S*100,R.flat).placements:Va(c,p,S,c==="macro"?R.macro:R.micro).placements},dn=s.useCallback(()=>{const c=ut.current,p=ji.current;if(c===null||!p.isMeasured)return;const S=qu(c,p.ceiling,p.floor);sc(R=>Zu(R,S)?R:S)},[]),mn=(c,p,S)=>{const R=ut.current;if(!R)return;un.current={rail:c,lowRatio:p,highRatio:S},Kc(R,c,p,S);const O=mc(c,p,S);O!==null&&Gc(R,c,O),c==="macro"&&Fi(p,S)},Rr=s.useCallback(()=>{Bt.current!==null&&(clearTimeout(Bt.current),Bt.current=null);const c=ut.current;c&&(c.removeAttribute($a),c.style.removeProperty(Ta))},[]),Ui=()=>{const c=ut.current;if(un.current===null||!c){un.current=null;return}un.current=null,Bt.current!==null&&clearTimeout(Bt.current),c.style.setProperty(Ta,`${vs}ms`),c.setAttribute($a,"true"),qc(c),Fi(Zn.current.macroLowRatio,Zn.current.macroHighRatio),Bt.current=setTimeout(()=>{Bt.current=null,c.removeAttribute($a),c.style.removeProperty(Ta)},vs)};s.useLayoutEffect(()=>{const c=un.current;c!==null&&mn(c.rail,c.lowRatio,c.highRatio)}),s.useEffect(()=>()=>{Bt.current!==null&&clearTimeout(Bt.current)},[]);const Fr=s.useRef(null),Ur=s.useRef(null),Ot=s.useRef(null),xa=s.useRef(null),fn=s.useRef(null),or=s.useCallback(()=>Fr.current!==null||Ur.current!==null,[]),zi=c=>{if(i)return;if($){const me=Ur.current;if(!me||c.pointerId!==me.pointerId||!ut.current)return;const kt=jr(c.clientX,c.clientY,ut.current.getBoundingClientRect());if(kt===null)return;if(me.handle==="macro-low"||me.handle==="macro-high"||me.handle==="macro-connect"){const[Je,Be,Wt]=Tl(me.handle,kt,me.startPointerRatio,me.startMacroLowRatio,me.startMacroHighRatio);mn("macro",Je,Be),Wt!==er.current&&(er.current=Wt,pr(Wt),kr(Wt));let Yt,xt,Gt;if(tr){const Kt=fo(Ce,M,a,Je,f),wn=Math.max(Kt,fo(Ce,M,a,Be,f));xt=Ce[Kt],Gt=Ce[wn],Yt=U(M,xt,f)}else Yt=Ei(Je),xt=se(M,Yt,f),Gt=se(M,Ei(Be),f);ft.show(xt,Gt);const ir=`${xt.getTime()}_${Gt.getTime()}`;ir!==xa.current&&(xa.current=ir,Sr(xt,Gt));const[bn,Yc]=$t(M,v,[xt,Gt],r,n,f),io=U(v,bn,f),so=U(v,Yc,f),gs=ce?na(io,so):[],ps={kind:"range",min:io,max:so};let Dr,yr;if(me.handle==="macro-connect"){const Kt=Yt-me.startMacroLowEnc,wn=Do("pan",ps,Ps(v,me.initialMicroLowEnc,M,Kt,f),Ps(v,me.initialMicroHighEnc,M,Kt,f));if(wn===null)return;Dr=se(v,wn[0],f),yr=se(v,wn[1],f)}else{const Kt=Do("resize",ps,me.initialMicroLowEnc,me.initialMicroHighEnc);if(Kt===null)return;Dr=se(v,Kt[0],f),yr=se(v,Kt[1],f)}const bs=rr(Dr,gs,io,so),Hc=Math.max(bs,rr(yr,gs,io,so));Dr=se(v,bs,f),yr=se(v,Hc,f),ge.show(Dr,yr);const ws=`${Dr.getTime()}_${yr.getTime()}`;ws!==fn.current&&(fn.current=ws,Dt(Dr,yr))}else if(me.handle==="micro-low"||me.handle==="micro-high"||me.handle==="micro-connect"||me.handle==="micro-point"){const[Je,Be,Wt]=Cl(me.handle,kt,me.startPointerRatio,me.startMicroLowRatio,me.startMicroHighRatio);mn("micro",Je,Be),Wt!==er.current&&(er.current=Wt,pr(Wt),kr(Wt));let Yt,xt;if(Ct){const ir=fo(be,v,a,Je,f),bn=Math.max(ir,fo(be,v,a,Be,f));Yt=be[ir],xt=be[bn]}else{const ir=rr(se(v,Math.round(He+Je*Gn),f),Ar,He,ot),bn=Math.max(ir,rr(se(v,Math.round(He+Be*Gn),f),Ar,He,ot));Yt=se(v,ir,f),xt=se(v,bn,f)}ge.show(Yt,xt);const Gt=`${Yt.getTime()}_${xt.getTime()}`;Gt!==fn.current&&(fn.current=Gt,Dt(Yt,xt))}return}const p=Fr.current;if(!p||c.pointerId!==p.pointerId||!ut.current)return;const S=ut.current.getBoundingClientRect(),R=b?c.clientY:c.clientX,O=b?S.height:S.width;if(!(Number.isFinite(O)&&O>0))return;if(p.handle==="connect"){const me=b?(p.startPointerPos-R)/O:(R-p.startPointerPos)/O,[kt,Je]=si(me,p.startLowRatio,p.startHighRatio);mn("flat",kt,Je);const Be=Rl({posDiffPct:me,startLowVal:p.startLowVal,startHighVal:p.startHighVal,rangeMin:N,rangeMax:F,isDiscrete:Y,sortedAllowedDates:H,snapMode:a,unit:t,yearStartMonth:f});if(Ot.current&&Ot.current[0]===Be[0]&&Ot.current[1]===Be[1])return;Ot.current=Be,We(Be),nr(Be[0],Be[1],!1);return}const W=jr(c.clientX,c.clientY,S);if(W===null)return;const[Z,Q]=$o(G?"point":p.handle,W,p.startLowRatio,p.startHighRatio);mn("flat",Z,Q);const fe=la(W*100),[ve,Ie]=Wa(p.handle,fe,p.startLowVal,p.startHighVal,N,F,G);if((!Ot.current||Ot.current[0]!==ve||Ot.current[1]!==Ie)&&(Ot.current=[ve,Ie],We([ve,Ie]),nr(ve,Ie,!1)),!G&&(p.handle==="low"||p.handle==="high")){const me=jo(p.handle,W,p.startLowRatio,p.startHighRatio);rt.current!==me&&(rt.current=me,bt(me),I(me))}},Bi=()=>{Ui(),xa.current=null,fn.current=null,Ur.current=null,er.current=null,pr(null),ft.release(),ge.release(),Pi(Kn.current),Pi(qn.current)},Wi=()=>{Ui();const c=Ot.current??Ae;c&&(nr(c[0],c[1],!0),Xe(c)),Ot.current=null,We(null),Fr.current=null,rt.current=null,bt(null)},Gi=c=>{if($){const S=Ur.current;if(!S||c.pointerId!==S.pointerId)return;Bi();return}const p=Fr.current;!p||c.pointerId!==p.pointerId||Wi()},Ki=()=>{Ur.current!==null&&Bi(),Fr.current!==null&&Wi()},Ra=s.useRef(zi),qi=s.useRef(Gi),Xi=s.useRef(Ki);s.useLayoutEffect(()=>{Ra.current=zi,qi.current=Gi,Xi.current=Ki});const Zi=s.useRef($);s.useEffect(()=>{Zi.current!==$&&(Zi.current=$,Xi.current())},[$]);const Ma=ye!==null||nt!==null;s.useEffect(()=>{if(!Ma)return;const c=cn.current?.ownerDocument.defaultView;if(!c)return;const p=R=>Ra.current(R),S=R=>qi.current(R);return c.addEventListener("pointermove",p),c.addEventListener("pointerup",S),c.addEventListener("pointercancel",S),c.addEventListener("lostpointercapture",S),()=>{c.removeEventListener("pointermove",p),c.removeEventListener("pointerup",S),c.removeEventListener("pointercancel",S),c.removeEventListener("lostpointercapture",S)}},[Ma]);const Da=s.useCallback((c,p,S,R)=>{Rr(),js(c,p),dn(),Fr.current={pointerId:p,handle:S,startPointerPos:R,startLowVal:Re,startHighVal:$e,startLowRatio:xr(Re)/100,startHighRatio:xr($e)/100},rt.current=S,bt(S),S!=="connect"&&I(S)},[Re,$e,xr]),Qi=s.useCallback((c,p,S,R)=>{q.current.mode==="vernier"&&(Rr(),js(c,p),dn(),Ur.current={pointerId:p,handle:S,startPointerRatio:R,startMacroLowRatio:Mt,startMacroHighRatio:It,startMicroLowRatio:vr,startMicroHighRatio:Or,startMacroLowEnc:Qe,initialMicroLowEnc:ze,initialMicroHighEnc:at},er.current=S,pr(S),kr(S))},[Mt,It,vr,Or,Qe,ze,at]),Ji=c=>p=>{if(i||or())return;p.stopPropagation(),p.preventDefault(),I(c);const S=b?p.clientY:p.clientX;Da(p.currentTarget,p.pointerId,c,S)},es=c=>()=>{i||rt.current!==null||I(c)},Qn=c=>()=>{i||er.current!==null||kr(c)},zr=c=>p=>{if(i||or())return;p.stopPropagation(),p.preventDefault();const S=ut.current;if(!S)return;const R=jr(p.clientX,p.clientY,S.getBoundingClientRect());R!==null&&Qi(p.currentTarget,p.pointerId,c,R)},fc=c=>{if(i||g||or())return;c.stopPropagation(),c.preventDefault();const p=b?c.clientY:c.clientX;Da(c.currentTarget,c.pointerId,"connect",p)},hc=c=>{if(i||or())return;if($){const Q=ut.current;if(!Q)return;const fe=Q.getBoundingClientRect(),ve=jr(c.clientX,c.clientY,fe);if(ve===null)return;const Ie=b?c.clientX-(fe.left+fe.width/2):c.clientY-(fe.top+fe.height/2),me=$l(ve,Ie,Mt,It,vr,Or,_,void 0,!g,ee?"point":"range");Qi(c.currentTarget,c.pointerId,me,ve),Ra.current(c.nativeEvent);return}const p=Yi(c.clientX,c.clientY);if(p===null)return;const S=la(p);let R="low";if(!G){const Q=Math.abs(S-Re),fe=Math.abs(S-$e);Q<fe?R="low":fe<Q?R="high":R=S>$e?"high":"low"}I(R);const[O,W]=Wa(R,S,Re,$e,N,F,G);We([O,W]),nr(O,W,!0);const Z=b?c.clientY:c.clientX;Da(c.currentTarget,c.pointerId,R,Z)},gc=c=>{if(i||$||ye!==null)return;const p=Yi(c.clientX,c.clientY);if(p===null)return;const S=la(p);Ue(S),Ge(xr(S))},pc=()=>{Ue(null),Ge(null)},ts=c=>p=>{if(i||or())return;I(c);const S=Ml(p.key,c,Re,$e,N,F,G,1);S&&(p.preventDefault(),Rr(),oe||Xe(S),nr(S[0],S[1],!0))},Br=(c,p,S)=>{if(V===null)return;const[R,O]=$t(M,v,[c,p],r,n,f),W=U(v,R,f),Z=U(v,O,f),Q=ce?na(W,Z):[],fe=Do(S,{kind:"range",min:W,max:Z},U(v,V[0],f),U(v,V[1],f));if(fe===null)return;const ve=rr(se(v,fe[0],f),Q,W,Z),Ie=Math.max(ve,rr(se(v,fe[1],f),Q,W,Z));Dt(se(v,ve,f),se(v,Ie,f),!0)},Jn=c=>p=>{if(i||!$||e.mode!=="vernier"||or())return;kr(c);let S=0,R=!1,O=!1;switch(p.key){case"ArrowRight":case"ArrowUp":S=1;break;case"ArrowLeft":case"ArrowDown":S=-1;break;case"PageUp":S=5;break;case"PageDown":S=-5;break;case"Home":R=!0;break;case"End":O=!0;break;default:return}if(p.preventDefault(),Rr(),c==="macro-low"){const W=se(M,Qe,f),Z=se(M,ct,f);if(tr){const ve=Sn(Ce,M,W,Ce[0],Z,S,R,O,f);if(ve===Me(Ce,W,M,f))return;const Ie=Ce[ve];Sr(Ie,Z,!0),Br(Ie,Z,"resize");return}let Q;if(R?Q=wt:O?Q=ct:Q=Math.max(wt,Math.min(ct,Qe+S)),Q===Qe)return;const fe=se(M,Q,f);Sr(fe,Z,!0),Br(fe,Z,"resize")}else if(c==="macro-high"){const W=se(M,Qe,f),Z=se(M,ct,f);if(tr){const ve=Sn(Ce,M,Z,W,Ce[Ce.length-1],S,R,O,f);if(ve===Me(Ce,Z,M,f))return;const Ie=Ce[ve];Sr(W,Ie,!0),Br(W,Ie,"resize");return}let Q;if(R?Q=Qe:O?Q=Vt:Q=Math.max(Qe,Math.min(Vt,ct+S)),Q===ct)return;const fe=se(M,Q,f);Sr(W,fe,!0),Br(W,fe,"resize")}else if(c==="micro-low"){const W=se(v,ze,f),Z=se(v,at,f);if(Ct){const fe=Sn(be,v,W,be[0],Z,S,R,O,f);if(fe===Me(be,W,v,f))return;Dt(be[fe],Z,!0);return}let Q;if(R?Q=He:O?Q=at:Q=Math.max(He,Math.min(at,ze+S)),Q===ze)return;Dt(se(v,Q,f),Z,!0)}else if(c==="micro-high"){const W=se(v,ze,f),Z=se(v,at,f);if(Ct){const fe=Sn(be,v,Z,W,be[be.length-1],S,R,O,f);if(fe===Me(be,Z,v,f))return;Dt(W,be[fe],!0);return}let Q;if(R?Q=ze:O?Q=ot:Q=Math.max(ze,Math.min(ot,at+S)),Q===at)return;Dt(W,se(v,Q,f),!0)}else if(c==="micro-point"){const W=se(v,ze,f);if(Ct){const Q=Sn(be,v,W,be[0],be[be.length-1],S,R,O,f);if(Q===Me(be,W,v,f))return;Li(be[Q],!0);return}let Z;if(R?Z=He:O?Z=ot:Z=Math.max(He,Math.min(ot,ze+S)),Z===ze)return;Li(se(v,Z,f),!0)}},bc=c=>{if(e.mode!=="vernier")return;if(Rr(),tr){const Z=Ce.length-1,Q=Me(Ce,br,M,f),fe=Me(Ce,wr,M,f),ve=fe-Q;let Ie=Q+c,me=fe+c;if(c<0&&Ie<0?(Ie=0,me=Math.min(Z,ve)):c>0&&me>Z&&(me=Z,Ie=Math.max(0,Z-ve)),Ie===Q&&me===fe)return;const kt=Ce[Ie],Je=Ce[me];Sr(kt,Je,!0),Br(kt,Je,"pan");return}const p=ct-Qe;let S=Qe+c,R=ct+c;if(c<0&&S<wt?(S=wt,R=Math.min(Vt,S+p)):c>0&&R>Vt&&(R=Vt,S=Math.max(wt,R-p)),S===Qe&&R===ct)return;const O=se(M,S,f),W=se(M,R,f);Sr(O,W,!0),Br(O,W,"pan")},ya=s.useCallback(c=>{const p=q.current;if(!(p.disabled||or()))if(Rr(),p.mode==="point"){const S=Math.max(N,Math.min(F,Re+c));oe||Xe([S,S]),nr(S,S,!0)}else if(p.mode==="vernier"){if(Ct){const ve=be.length-1,Ie=Me(be,Nr,v,f),me=Me(be,Vr,v,f),kt=me-Ie;let Je=Ie+c,Be=me+c;c<0&&Je<0?(Je=0,Be=Math.min(ve,kt)):c>0&&Be>ve&&(Be=ve,Je=Math.max(0,ve-kt)),(Je!==Ie||Be!==me)&&Dt(be[Je],be[Be],!0);return}const S=ze,R=at,O=He,W=ot,Z=R-S;let Q=S+c,fe=R+c;c<0&&Q<O?(Q=O,fe=Math.min(W,Q+Z)):c>0&&fe>W&&(fe=W,Q=Math.max(O,fe-Z)),(Q!==S||fe!==R)&&Dt(se(v,Q,f),se(v,fe,f),!0)}else{const S=$e-Re;let R=Re+c,O=$e+c;c<0&&R<N?(R=N,O=Math.min(F,R+S)):c>0&&O>F&&(O=F,R=Math.max(N,O-S)),R<=O&&(oe||Xe([R,O]),nr(R,O,!0))}},[Re,$e,N,F,oe,nr,Dt,ze,at,He,ot,v,Ct,be,Nr,Vr,Rr,f]),rs=c=>!i&&Ia(cn.current,c),ns=(c,p)=>{const S=$i.current,R=ut.current,O=cn.current;if(i||S===null||R===null||O===null||!bu(S,O,Ti.current,b,c,p))return null;const W=R.getBoundingClientRect();return Math.abs(b?c-(W.left+W.width/2):p-(W.top+W.height/2))},os=c=>{if(i||or())return;const p=Ll(c.deltaX,c.deltaY,b);if(p===0)return;c.preventDefault();const S=c.target,R=Ia(Ci.current,S)||Ia(Ii.current,S);if(!$||R){ya(p);return}const O=ut.current;if(!O)return;const W=O.getBoundingClientRect(),Z=b?c.clientX-(W.left+W.width/2):c.clientY-(W.top+W.height/2);if(fi(Z,_)==="macro"){bc(p);return}ya(p)},eo=s.useRef({ownsWheelHit:rs,distanceToRailPx:ns,stepFromRangeAreaWheel:os});s.useLayoutEffect(()=>{eo.current={ownsWheelHit:rs,distanceToRailPx:ns,stepFromRangeAreaWheel:os}});const hn=s.useRef(null);s.useEffect(()=>{const c=cn.current?.ownerDocument.defaultView??null,p=hn.current;if(p!==null&&p.view===c)return;if(p?.unregister(),c===null){hn.current=null;return}const S=vu(c,{ownsHit:R=>eo.current.ownsWheelHit(R),distanceToRailPx:(R,O)=>eo.current.distanceToRailPx(R,O),step:R=>eo.current.stepFromRangeAreaWheel(R)});hn.current={view:c,unregister:S}}),s.useEffect(()=>()=>{hn.current?.unregister(),hn.current=null},[]);const to=xr(Re),ro=xr($e),Ea=he(Re),Pa=he($e),Wr=_s(to,ro,pa),ar=Wr.slant,gn=ye==="low"||ye!=="high"&&zt==="low",pn=!G&&(ye==="high"||ye!=="low"&&zt==="high"),wc=fa&&Ze!=="macro-low",vc=fa&&Ze==="macro-low",Sc=ha&&Ze!=="micro-low",xc=ha&&Ze==="micro-low",vt=Va("macro",Mt,It,va),St=Va("micro",vr,Or,Sa),as=Wr.slant.isSlanted||vt.slant.isSlanted||St.slant.isSlanted;s.useLayoutEffect(()=>{as&&dn()});const is=as||Ma;s.useEffect(()=>{if(!is)return;const c=ut.current,p=c===null?null:c.ownerDocument.defaultView;if(c===null||p===null)return;const S=c.ownerDocument;let R=null;const O=()=>{R===null&&(R=p.requestAnimationFrame(()=>{R=null,dn()}))};S.addEventListener("scroll",O,{capture:!0,passive:!0}),p.addEventListener("resize",O);const W=typeof ResizeObserver>"u"?null:new ResizeObserver(O);for(const Z of[ue,K])Z!==null&&W?.observe(Z);return()=>{S.removeEventListener("scroll",O,{capture:!0}),p.removeEventListener("resize",O),W?.disconnect(),R!==null&&p.cancelAnimationFrame(R)}},[is,ue,K,dn]);const Rc=Math.min(to,ro),Mc=Math.max(to,ro),[ss,ls]=Pn.flat,[Dc,yc]=Pn.macro,[Ec,Pc]=Pn.micro,cs=sr(ss,to),us=sr(ls,ro),La=sr(ss,Rc),ds=`calc(${sr(ls,Mc)} - ${La})`,Gr=sr(Dc,Mt*100),no=sr(yc,It*100),Kr=sr(Ec,vr*100),oo=sr(Pc,Or*100),Lc=b?{bottom:La,height:ds,top:"auto",left:"0",right:"0"}:{left:La,width:ds,top:"0",bottom:"0"},$c=Math.max(.01,It-Mt),ms=Math.max(.06,Math.min(.25,.28*Math.sqrt($c))),Tc=b?{bottom:cs,left:"50%",transform:"translate(-50%, 50%)",zIndex:gn?40:30}:{left:cs,top:"50%",transform:"translate(-50%, -50%)",zIndex:gn?40:30},Cc=b?{bottom:us,left:"50%",transform:"translate(-50%, 50%)",zIndex:pn?40:30}:{left:us,top:"50%",transform:"translate(-50%, -50%)",zIndex:pn?40:30},Ic=b?{bottom:`${lt}%`,left:"50%",transform:"translate(-50%, 50%)"}:{left:`${lt}%`,top:"50%",transform:"translate(-50%, -50%)"},fs=J!==null?he(J):null,kc=d!=="hover"&&J!==null&&(J===Re||!G&&J===$e),Ac=$?ze>Di:Re>N,Nc=$?at<oa:$e<F,Vc=P!==vt.slant.isFlipped?"before":"after",Oc=P===St.slant.isFlipped?"before":"after",ao=Ju($?[{side:Vc,box:ba,...b?{reach:"inline-size"}:{reach:"rotated",angleDeg:vt.slant.lowAngleDeg,centreFromAnchorPx:vt.centreFromAnchorPx,alongPushPx:vt.slant.lowOffsetX}},{side:Oc,box:wa,...b?{reach:"inline-size"}:{reach:"rotated",angleDeg:St.slant.lowAngleDeg,centreFromAnchorPx:St.centreFromAnchorPx,alongPushPx:St.slant.lowOffsetX}}]:[{side:b||m==="top"!==ar.isFlipped?"before":"after",box:G?Xn:Eo(Xn,Ai),...b?{reach:"inline-size"}:{reach:"rotated",angleDeg:ar.lowAngleDeg,centreFromAnchorPx:Math.abs(ar.lowOffsetY),alongPushPx:ar.lowOffsetX}}]),_c=ao===void 0?e.style:{...e.style,...ao.style};s.useLayoutEffect(()=>{Ti.current=ao===void 0?0:ao.mainPx});const _t=ee?"micro-point":"micro-low",Mr=i?"cursor-not-allowed opacity-50":"cursor-pointer",qr=c=>d==="hover"||!T||c===void 0?null:C.jsx("span",{"data-label-leader":"true","aria-hidden":"true",className:"period-slider-label-leader",style:c}),hs=c=>{const p=b?"vertical":"horizontal",S=c==="decrease",R=b?!S:S;return C.jsx(Tr,{ref:S?Ci:Ii,neighbour:"rail",direction:td[p][c],glyph:"single",disabled:i,canStep:S?Ac:Nc,onStep:()=>ya(S?-1:1),ariaLabel:S?B.decrease:B.increase,className:`period-slider-stepper-btn ${rd[p][c]} ${Hs[p][R?"leading":"trailing"]}`})};return C.jsxs("div",{ref:cn,style:_c,className:`period-slider grid select-none place-items-center ${nd[b?"vertical":"horizontal"][u?"withSteppers":"railOnly"]} ${l}`,"data-disabled":i?"true":void 0,"data-unit":t,"data-mode":e.mode,"data-orientation":b?"vertical":"horizontal","data-label-position":m,"data-color-scheme":h,children:[C.jsx("div",{ref:$i,"data-range-area":"true","aria-hidden":"true",className:"period-slider-range-area"}),u&&hs(b?"increase":"decrease"),C.jsx("div",{ref:ut,"data-testid":"period-slider-track","data-orientation":b?"vertical":"horizontal","data-vernier-orientation":$?_:void 0,className:`period-slider-track relative touch-none rounded-full ${Hs[b?"vertical":"horizontal"][u?"rail":"railOnly"]} ${Mr}`,onPointerDown:hc,onPointerMove:gc,onPointerLeave:pc,children:$?C.jsxs(C.Fragment,{children:[xe&&(b?C.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:[C.jsx("defs",{children:C.jsxs("linearGradient",{id:A,x1:"0",y1:"0",x2:"1",y2:"0",children:[C.jsx("stop",{offset:"0%",stopColor:P?ne.macro:ne.micro,stopOpacity:"0.28"}),C.jsx("stop",{offset:"100%",stopColor:P?ne.micro:ne.macro,stopOpacity:ms})]})}),C.jsx("path",{ref:ca,"data-testid":"period-slider-vernier-projection",d:Ca(Mt,It,b,P),fill:`url(#${A})`})]}):C.jsxs("svg",{className:"period-slider-vernier-projection",role:"presentation","aria-hidden":"true",width:"100%",height:"32",viewBox:"0 0 100 32",preserveAspectRatio:"none",children:[C.jsx("defs",{children:C.jsxs("linearGradient",{id:A,x1:"0",y1:"0",x2:"0",y2:"1",children:[C.jsx("stop",{offset:"0%",stopColor:P?ne.macro:ne.micro,stopOpacity:"0.28"}),C.jsx("stop",{offset:"100%",stopColor:P?ne.micro:ne.macro,stopOpacity:ms})]})}),C.jsx("path",{ref:ca,"data-testid":"period-slider-vernier-projection",d:Ca(Mt,It,b,P),fill:`url(#${A})`})]})),!g&&C.jsxs(C.Fragment,{children:[C.jsx("div",{"data-testid":"period-slider-connect-macro",className:"period-slider-connect-macro",style:b?{bottom:`calc(${Gr} - 8px)`,height:`calc(${no} - ${Gr} + 16px)`}:{left:`calc(${Gr} - 8px)`,width:`calc(${no} - ${Gr} + 16px)`},onPointerDown:zr("macro-connect")}),!ee&&C.jsx("div",{"data-testid":"period-slider-connect-micro",className:"period-slider-connect-micro",style:b?{bottom:`calc(${Kr} - 8px)`,height:`calc(${oo} - ${Kr} + 16px)`}:{left:`calc(${Kr} - 8px)`,width:`calc(${oo} - ${Kr} + 16px)`},onPointerDown:zr("micro-connect")})]}),_e&&C.jsxs("div",{className:"period-slider-vernier-ticks pointer-events-none absolute inset-0",children:[[.2,.4,.6,.8].map(c=>C.jsx("div",{"data-testid":"period-slider-tick","data-tick-scale":"macro",className:"period-slider-tick period-slider-tick-macro",style:b?{bottom:`${c*100}%`}:{left:`${c*100}%`}},`macro-tick-${c}`)),[.1,.2,.3,.4,.5,.6,.7,.8,.9].map(c=>C.jsx("div",{"data-testid":"period-slider-tick","data-tick-scale":"micro",className:"period-slider-tick period-slider-tick-micro",style:b?{bottom:`${c*100}%`}:{left:`${c*100}%`}},`micro-tick-${c}`))]}),C.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":B.macroRangeStart,"aria-disabled":i?"true":void 0,"aria-valuemin":ql,"aria-valuemax":ct,"aria-valuenow":Qe,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(br,M,"period"):Pr(M,br,Ve,D),"aria-orientation":b?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${b?"is-vertical":""} group absolute touch-none ${b?P?"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:right-0 after:-left-4":"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-right-4 after:left-0":P?"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-4 after:bottom-0":"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-0 after:-bottom-4"} after:content-[''] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-400 ${Mr}`,style:b?{bottom:Gr,left:P?0:"auto",right:P?"auto":0,transform:P?"translate(-100%, 50%)":"translate(100%, 50%)",zIndex:nt==="macro-low"||Ze==="macro-low"?30:15}:{left:Gr,top:P?0:"auto",bottom:P?"auto":0,transform:P?"translate(-50%, -100%)":"translate(-50%, 100%)",zIndex:nt==="macro-low"||Ze==="macro-low"?30:15},onPointerDown:zr("macro-low"),onKeyDown:Jn("macro-low"),onFocus:Qn("macro-low"),"data-active":nt==="macro-low"?"true":void 0,"data-front":Ze==="macro-low"?"true":void 0,"data-vernier-pos":b?P?"left":"right":P?"top":"bottom","data-handle-type":"macro-low",children:[C.jsx(En,{type:"macro",isTop:P,isVertical:b,isLeft:P}),E&&C.jsx("div",{"data-testid":"period-slider-hairline",className:"period-slider-hairline"}),d!=="hover"&&C.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${d==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":d,"data-duplicate":wc?"true":void 0,"data-slanted":vt.slant.isSlanted?"true":void 0,"data-flipped":vt.slant.isFlipped?"true":void 0,ref:Jl,style:vt.lowStyle,children:it(M,br,Ve,D)}),qr(vt.lowLeaderStyle)]}),C.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":B.macroRangeEnd,"aria-disabled":i?"true":void 0,"aria-valuemin":Qe,"aria-valuemax":Xl,"aria-valuenow":ct,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(wr,M,"period"):Pr(M,wr,Ve,D),"aria-orientation":b?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${b?"is-vertical":""} group absolute touch-none ${b?P?"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:right-0 after:-left-4":"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-right-4 after:left-0":P?"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-4 after:bottom-0":"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-0 after:-bottom-4"} after:content-[''] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-400 ${Mr}`,style:b?{bottom:no,left:P?0:"auto",right:P?"auto":0,transform:P?"translate(-100%, 50%)":"translate(100%, 50%)",zIndex:nt==="macro-high"||Ze==="macro-high"?30:15}:{left:no,top:P?0:"auto",bottom:P?"auto":0,transform:P?"translate(-50%, -100%)":"translate(-50%, 100%)",zIndex:nt==="macro-high"||Ze==="macro-high"?30:15},onPointerDown:zr("macro-high"),onKeyDown:Jn("macro-high"),onFocus:Qn("macro-high"),"data-active":nt==="macro-high"?"true":void 0,"data-front":Ze==="macro-high"?"true":void 0,"data-vernier-pos":b?P?"left":"right":P?"top":"bottom","data-handle-type":"macro-high",children:[C.jsx(En,{type:"macro",isTop:P,isVertical:b,isLeft:P}),E&&C.jsx("div",{"data-testid":"period-slider-hairline",className:"period-slider-hairline"}),d!=="hover"&&C.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${d==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":d,"data-duplicate":vc?"true":void 0,"data-slanted":vt.slant.isSlanted?"true":void 0,"data-flipped":vt.slant.isFlipped?"true":void 0,ref:tc,style:vt.highStyle,children:it(M,wr,Ve,D)}),qr(vt.highLeaderStyle)]}),C.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":ee?B.microSelectedDate:B.microRangeStart,"aria-disabled":i?"true":void 0,"aria-valuemin":Di,"aria-valuemax":ee?oa:at,"aria-valuenow":ze,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(Nr,v,"period"):Pr(v,Nr,Ye,D),"aria-orientation":b?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${b?"is-vertical":""} group absolute touch-none ${b?P?"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-right-4 after:left-0":"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:right-0 after:-left-4":P?"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-0 after:-bottom-4":"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-4 after:bottom-0"} after:content-[''] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-400 ${Mr}`,style:b?{bottom:Kr,left:P?"auto":0,right:P?0:"auto",transform:P?"translate(100%, 50%)":"translate(-100%, 50%)",zIndex:nt===_t||Ze===_t?30:20}:{left:Kr,top:P?"auto":0,bottom:P?0:"auto",transform:P?"translate(-50%, 100%)":"translate(-50%, -100%)",zIndex:nt===_t||Ze===_t?30:20},onPointerDown:zr(_t),onKeyDown:Jn(_t),onFocus:Qn(_t),"data-active":nt===_t?"true":void 0,"data-front":Ze===_t?"true":void 0,"data-vernier-pos":b?P?"right":"left":P?"bottom":"top","data-handle-type":_t,children:[C.jsx(En,{type:"micro",isTop:!P,isVertical:b,isLeft:!P}),E&&C.jsx("div",{"data-testid":"period-slider-hairline",className:"period-slider-hairline"}),d!=="hover"&&C.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${d==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":d,"data-duplicate":Sc?"true":void 0,"data-slanted":St.slant.isSlanted?"true":void 0,"data-flipped":St.slant.isFlipped?"true":void 0,ref:nc,style:St.lowStyle,children:it(v,Nr,Ye,D)}),qr(St.lowLeaderStyle)]}),!ee&&C.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":B.microRangeEnd,"aria-disabled":i?"true":void 0,"aria-valuemin":ze,"aria-valuemax":oa,"aria-valuenow":at,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(Vr,v,"period"):Pr(v,Vr,Ye,D),"aria-orientation":b?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${b?"is-vertical":""} group absolute touch-none ${b?P?"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-right-4 after:left-0":"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:right-0 after:-left-4":P?"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-0 after:-bottom-4":"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-4 after:bottom-0"} after:content-[''] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-400 ${Mr}`,style:b?{bottom:oo,left:P?"auto":0,right:P?0:"auto",transform:P?"translate(100%, 50%)":"translate(-100%, 50%)",zIndex:nt==="micro-high"||Ze==="micro-high"?30:20}:{left:oo,top:P?"auto":0,bottom:P?0:"auto",transform:P?"translate(-50%, 100%)":"translate(-50%, -100%)",zIndex:nt==="micro-high"||Ze==="micro-high"?30:20},onPointerDown:zr("micro-high"),onKeyDown:Jn("micro-high"),onFocus:Qn("micro-high"),"data-active":nt==="micro-high"?"true":void 0,"data-front":Ze==="micro-high"?"true":void 0,"data-vernier-pos":b?P?"right":"left":P?"bottom":"top","data-handle-type":"micro-high",children:[C.jsx(En,{type:"micro",isTop:!P,isVertical:b,isLeft:!P}),E&&C.jsx("div",{"data-testid":"period-slider-hairline",className:"period-slider-hairline"}),d!=="hover"&&C.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${d==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":d,"data-duplicate":xc?"true":void 0,"data-slanted":St.slant.isSlanted?"true":void 0,"data-flipped":St.slant.isFlipped?"true":void 0,ref:oc,style:St.highStyle,children:it(v,Vr,Ye,D)}),qr(St.highLeaderStyle)]})]}):C.jsxs(C.Fragment,{children:[!g&&C.jsx("div",{"data-testid":"period-slider-connect",className:"period-slider-connect absolute rounded-full",style:Lc,onPointerDown:fc}),w&&Y&&H.length>1&&C.jsx("div",{className:"period-slider-ticks pointer-events-none absolute inset-0",children:H.map((c,p)=>{const S=U(t,c,f),R=xr(p),O=b?{bottom:`${R}%`,left:"50%",transform:"translate(-50%, 50%)"}:{left:`${R}%`,top:"50%",transform:"translate(-50%, -50%)"};return C.jsx("div",{"data-testid":"period-slider-tick",className:"period-slider-tick absolute h-1.5 w-1.5 rounded-full",style:O},`tick-${S}`)})}),!i&&J!==null&&lt!==null&&ye===null&&fs&&C.jsxs("div",{"data-testid":"period-slider-hover-guide",className:"period-slider-hover-guide pointer-events-none absolute h-2 w-2",style:Ic,children:[C.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"}),C.jsx("div",{"data-testid":"period-slider-hover-tooltip","data-duplicate":kc?"true":void 0,className:`period-slider-hover-tooltip ${m==="bottom"&&!b?"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:it(t,fs,e.formatLabel,D)})]}),C.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":G?B.selectedDate:B.rangeStart,"aria-disabled":i?"true":void 0,"aria-valuemin":N,"aria-valuemax":G?F:$e,"aria-valuenow":Re,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(Ea,t,"period"):Pr(t,Ea,e.formatLabel,D),"aria-orientation":b?"vertical":"horizontal",className:`period-slider-handle group absolute h-4 w-4 touch-none after:absolute after:inset-[calc((100%-var(--ps-target-size))/2)] after:content-[''] focus-visible:outline-hidden ${Mr}`,style:Tc,onPointerDown:Ji("low"),onKeyDown:ts("low"),onFocus:es("low"),"data-active":ye==="low"?"true":void 0,"data-front":gn?"true":void 0,children:[C.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)] dark:group-focus-visible:ring-blue-400 ${ye==="low"?"":"shadow-md"}`}),d!=="hover"&&C.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${d==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":d,"data-label-position":m,"data-slanted":ar.isSlanted?"true":void 0,"data-flipped":ar.isFlipped?"true":void 0,"data-front":gn?"true":void 0,"data-duplicate":ma&&!gn?"true":void 0,ref:Zl,style:Wr.lowStyle,children:it(t,Ea,e.formatLabel,D)}),qr(Wr.lowLeaderStyle)]}),!G&&C.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":B.rangeEnd,"aria-disabled":i?"true":void 0,"aria-valuemin":Re,"aria-valuemax":F,"aria-valuenow":$e,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(Pa,t,"period"):Pr(t,Pa,e.formatLabel,D),"aria-orientation":b?"vertical":"horizontal",className:`period-slider-handle group absolute h-4 w-4 touch-none after:absolute after:inset-[calc((100%-var(--ps-target-size))/2)] after:content-[''] focus-visible:outline-hidden ${Mr}`,style:Cc,onPointerDown:Ji("high"),onKeyDown:ts("high"),onFocus:es("high"),"data-active":ye==="high"?"true":void 0,"data-front":pn?"true":void 0,children:[C.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)] dark:group-focus-visible:ring-blue-400 ${ye==="high"?"":"shadow-md"}`}),d!=="hover"&&C.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${d==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":d,"data-label-position":m,"data-slanted":ar.isSlanted?"true":void 0,"data-flipped":ar.isFlipped?"true":void 0,"data-front":pn?"true":void 0,"data-duplicate":ma&&!pn?"true":void 0,ref:Ql,style:Wr.highStyle,children:it(t,Pa,e.formatLabel,D)}),qr(Wr.highLeaderStyle)]})]})}),u&&hs(b?"decrease":"increase")]})},et=e=>e.getTime(),kl=(e,t)=>!(At(e)&&At(t))||e.length!==2||t.length!==2?!1:Pt(e[0],et)===Pt(t[0],et)&&Pt(e[1],et)===Pt(t[1],et),ho=(e,t)=>e===void 0||t===void 0?e===t:kl(e,t),Oa=(e,t)=>{if(e===t)return!0;if(!(At(e)&&At(t))||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(Pt(e[r],et)!==Pt(t[r],et))return!1;return!0},Al=(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},ad=(e,t)=>e===t?!0:e.mode!==t.mode||e.unit!==t.unit||e.yearStartMonth!==t.yearStartMonth||Pt(e.minDate,et)!==Pt(t.minDate,et)||Pt(e.maxDate,et)!==Pt(t.maxDate,et)||e.labelPosition!==t.labelPosition||e.autoSlantLabels!==t.autoSlantLabels||e.keepMergedLabelUpright!==t.keepMergedLabelUpright||e.labelCeiling!==t.labelCeiling||e.labelFloor!==t.labelFloor||e.showLabelLeaderLines!==t.showLabelLeaderLines||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||!Al(e.style,t.style)||e.snapMode!==t.snapMode||e.formatLabel!==t.formatLabel||e.formatLocale!==t.formatLocale||e.locale!==t.locale||!Uo(e.labels,t.labels)||e.formatAriaValueText!==t.formatAriaValueText||!Oa(e.allowedDates,t.allowedDates)?!1:e.mode==="point"&&t.mode==="point"?!(gt(e.value,et)!==gt(t.value,et)||gt(e.defaultValue,et)!==gt(t.defaultValue,et)||e.onChangePoint!==t.onChangePoint):e.mode==="range"&&t.mode==="range"?!(!ho(e.range,t.range)||!ho(e.defaultRange,t.defaultRange)||e.onChangeRange!==t.onChangeRange):e.mode==="vernier"&&t.mode==="vernier"?!(!ho(e.microRange,t.microRange)||!ho(e.defaultMicroRange,t.defaultMicroRange)||gt(e.microValue,et)!==gt(t.microValue,et)||gt(e.defaultMicroValue,et)!==gt(t.defaultMicroValue,et)||!kl(e.macroRange,t.macroRange)||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||!Oa(e.macroAllowedDates,t.macroAllowedDates)||!Oa(e.microAllowedDates,t.microAllowedDates)):!1,Nl=s.memo(od,ad);Nl.displayName="PeriodSlider";const Fs=2,Pe=-1,yt=e=>U("day",e),Vn=e=>se("day",e),xn=e=>`${Go(e.getFullYear())}-${String(e.getMonth()+1).padStart(Fs,"0")}-${String(e.getDate()).padStart(Fs,"0")}`,id=(e,t,r,n)=>{const o=yt(e),a=yt(t),i=a>=o?a-o+1:0,l=d=>Vn(a-d),u={kind:"range",min:o,max:a};return{count:i,dateAt:l,labelAt:d=>it("day",l(d),n,r),indexOf:d=>{const m=yt(d);return m<o||m>a?Pe:a-m},nearestIndexOf:d=>{if(i===0)return Pe;const m=kn(u,yt(d));return m===null?Pe:a-m}}},sd=(e,t,r,n,o,a)=>{const i=n>=r?n-r+1:0,l=x=>e[n-x],u={kind:"candidates",ascending:t,loIndex:r,hiIndex:n},d=x=>{const L=x.getTime();let T=r,b=n;for(;T<=b;){const g=T+b>>1,w=e[g].getTime();if(w===L)return n-g;w<L?T=g+1:b=g-1}return Pe},m=x=>x===null?Pe:d(Vn(x));return{count:i,dateAt:l,labelAt:x=>it("day",l(x),a,o),indexOf:d,nearestIndexOf:x=>m(kn(u,yt(x)))}},ld={count:0,dateAt:e=>{throw new RangeError(`DateSelector: the option domain is empty (requested index ${y(e)})`)},labelAt:e=>{throw new RangeError(`DateSelector: the option domain is empty (requested index ${y(e)})`)},indexOf:()=>Pe,nearestIndexOf:()=>Pe},cd=(e,t,r)=>{const n=l=>{let u=0,d=e.length;for(;u<d;){const m=u+d>>1;e[m].getTime()<l?u=m+1:d=m}return u},o=l=>{let u=0,d=e.length;for(;u<d;){const m=u+d>>1;e[m].getTime()<=l?u=m+1:d=m}return u},a=t===null?0:n(t.getTime()),i=(r===null?e.length:o(r.getTime()))-1;return{loIndex:a,hiIndex:i}},ud=(e,t)=>{const r=new Map;for(let n=0;n<e.length;n++){const o=e[n];t(n,o);const a=new Date(o);a.setHours(0,0,0,0);const i=a.getTime();r.has(i)||r.set(i,a)}return Array.from(r.keys()).sort((n,o)=>n-o).map(n=>r.get(n))},dd={year:{year:"numeric"},month:{month:"2-digit"},day:{day:"2-digit"}},md={month:2,day:2},Us={year:e=>e.getFullYear(),month:e=>e.getMonth()+1,day:e=>e.getDate()},zs=new Map,fd=(e,t)=>{const r=`${e}\0${t}`,n=zs.get(r);if(n!==void 0)return n;const o=new Intl.DateTimeFormat(t,dd[e]);return zs.set(r,o),o},hd=(e,t,r)=>{if(r!==void 0)return fd(e,r).format(t);const n=new Date(t.getTime());return e==="year"?Go(Us.year(n)):String(Us[e](n)).padStart(md[e],"0")},Vl=(e,t,r,n)=>{if(Le("formatOptionText","unit",t),r!=="period"&&r!=="part")throw new RangeError(`formatOptionText: scope must be "period" or "part" (received: ${y(r)})`);return De(e)?r==="part"?hd(t,e,n):it(t,e,void 0,n):""},gd=12,Qo=(e,t,r)=>{const n=Un(e,t,r);return n===null?Number.NaN:n*gd+r},hi=(e,t,r)=>{const n=o=>o.value!==void 0?o.value:o.initialDate;return gt(n(e),r)!==gt(n(t),r)||t.value!==void 0&&Number.isNaN(gt(t.initialDate,r))||gt(e.minDate,r)!==gt(t.minDate,r)?!1:gt(e.maxDate,r)===gt(t.maxDate,r)};class Ol{held;writeCount=0;constructor(t){this.held=t}get current(){return this.held}set current(t){this.held=t,this.writeCount+=1}get writes(){return this.writeCount}commit(t,r){this.writeCount===r&&(this.held=t)}}function _l(e,t){const[r]=s.useState(()=>t(e)),n=r.writes;return s.useInsertionEffect(()=>{r.commit(e,n)}),r}function mt(e){return _l(e,t=>new Ol(t))}const pd={motion:["motion","edge"],vernierRange:["motion","edge","window"],vernierPoint:["window"]},bd=["shift","start","end","single"],wd=["disable","clamp"],vd=["follow","keep"],Bs={day:{day:1},month:{month:1,year:12},year:{year:1}},Ws=new WeakMap,Ka=(e,t,r)=>{if(typeof r!="object"||r===null)throw new RangeError(`${e}: ${t} must be an object (received: ${y(r)})`)},Gs=(e,t,r,n)=>{for(const[o,a]of Object.entries(r))if(!(a===void 0||n.includes(o)))throw new RangeError(`${e}: ${t}.${o} is not read here; the accepted keys are ${n.map(i=>`"${i}"`).join(", ")} (received: ${y(a)})`)},Cr=(e,t,r,n)=>{Ka(e,t,r),Gs(e,t,r,["previous","next"]);for(const o of["previous","next"]){const a=`${t}.${o}`,i=r[o];Ka(e,a,i),Gs(e,a,i,pd[n]);const{motion:l,edge:u,window:d}=i;if(n!=="vernierPoint"&&(typeof l!="string"||!bd.includes(l)))throw new RangeError(`${e}: ${a}.motion must be one of "shift", "start", "end", "single" (received: ${y(l)})`);if(u!==void 0){if(l!=="shift")throw new RangeError(`${e}: ${a}.edge applies to motion "shift" only; a motion that moves one value either can move or cannot (received: edge ${y(u)} with motion ${y(l)})`);if(typeof u!="string"||!wd.includes(u))throw new RangeError(`${e}: ${a}.edge must be "disable" or "clamp" (received: ${y(u)})`)}if(d!==void 0&&(typeof d!="string"||!vd.includes(d)))throw new RangeError(`${e}: ${a}.window must be "follow" or "keep" (received: ${y(d)})`)}},gi=(e,t,r)=>{if(typeof t!="object"||t===null)throw new RangeError(`${e}: stepper must be an object (received: ${y(t)})`);const{onStep:n,canStepPrevious:o,canStepNext:a}=t;if(typeof n!="function")throw new RangeError(`${e}: stepper.onStep must be a function (received: ${y(n)})`);if(typeof o!="boolean")throw new RangeError(`${e}: stepper.canStepPrevious must be a boolean (received: ${y(o)})`);if(typeof a!="boolean")throw new RangeError(`${e}: stepper.canStepNext must be a boolean (received: ${y(a)})`);if(!r)throw new RangeError(`${e}: stepper requires the controlled value; the owner that takes the ◀▶ over moves the value itself, so an uncontrolled initialDate would never change`)},qt=(e,t,r,n,o)=>{if(!De(r))throw new RangeError(`${e}: ${t} must be a valid Date (received: ${y(r)})`);return Ke(e,t,r,n,o,"")},Yl=(e,t,r,n,o)=>{const a=`${n}:${o}`,i=Ws.get(r),l=i?.get(a);if(l!==void 0)return l;const u=[];for(let m=0;m<r.length;m++)u.push(qt(e,`${t}[${m}]`,r[m],n,o));const d=Array.from(new Set(u)).sort((m,x)=>m-x);return i===void 0?Ws.set(r,new Map([[a,d]])):i.set(a,d),d},Sd=(e,t)=>t===1?Ro(e):{stepEnd:(r,n)=>xo(e,r+t*n,n),edge:r=>Cn(e,r)},qa=(e,t)=>e.motion==="shift"?{motion:"shift",edge:e.edge==="clamp"?"clamp":"disable"}:e.motion==="single"?{motion:"single",shows:t}:{motion:e.motion},Xa=(e,t,r,n,o,a)=>{if(a){const u=e[0]===t[0]?r[0]:e[0]===t[1]?r[1]:se(n,e[0],o);return Number.isNaN(u.getTime())?null:[u,u]}const i=e[0]===t[0]?r[0]:se(n,e[0],o),l=e[1]===t[1]?r[1]:se(n,e[1],o);return Number.isNaN(i.getTime())||Number.isNaN(l.getTime())?null:[i,l.getTime()<i.getTime()?i:l]},Za=e=>{const t="resolveSelectorSteps";Ka(t,"options",e);const{selection:r,shows:n,unit:o,minDate:a,maxDate:i,allowedDates:l,rules:u}=e;Le(t,"unit",o);const d=Qt(t,"stepUnit",e.stepUnit,o),m=Bs[o][d];if(m===void 0){const M=Object.keys(Bs[o]).map(v=>`"${v}"`).join(" or ");throw new RangeError(`${t}: stepUnit must be ${M} for a ${o} selection, the steps that move every ${o} by a whole number of ${o}s (received: ${y(d)})`)}const x=gr(t,e.yearStartMonth);if(n!=="start"&&n!=="end")throw new RangeError(`${t}: shows must be "start" or "end" (received: ${y(n)})`);if(!At(r)||r.length!==2)throw new RangeError(`${t}: selection must be a [start, end] tuple of Dates (received: ${y(r)})`);Cr(t,"rules",u,"motion");const L=qt(t,"selection[0]",r[0],o,x),T=qt(t,"selection[1]",r[1],o,x);if(T<L)throw new RangeError(`${t}: selection must not be inverted at ${o} resolution (start: ${y(r[0])}, end: ${y(r[1])})`);const b=a===void 0?null:qt(t,"minDate",a,o,x),g=i===void 0?null:qt(t,"maxDate",i,o,x);if(b!==null&&g!==null&&g<b)throw new RangeError(`${t}: maxDate must not precede minDate at ${o} resolution (minDate: ${y(a)}, maxDate: ${y(i)})`);sn(t,"allowedDates",l);const w=l===void 0?{kind:"range",min:b,max:g}:ln(Yl(t,"allowedDates",l,o,x),b,g),h=Sd(w,m),D=(M,v)=>{const f=za(h,L,T,M,qa(v,n));return f===null?null:Xa(f,[L,T],r,o,x,v.motion==="single")};return{previous:D(-1,u.previous),next:D(1,u.next)}},jt=(e,t)=>{const r=mt({targets:e,onStepTo:t}),n=s.useCallback(i=>{const{targets:l,onStepTo:u}=r.current,d=l[i];d!==null&&u(d,i)},[]),o=e.previous!==null,a=e.next!==null;return s.useMemo(()=>({onStep:n,canStepPrevious:o,canStepNext:a}),[n,o,a])};function xd(e,t,r,n){return e.source===t?e:t===null?{source:t,held:e.held}:{source:t,held:n(r)}}function pi(e,t,r,n){const o=t?null:r(e),[a,i]=s.useState(()=>({source:o,held:n(e)})),l=s.useCallback(d=>i(m=>({source:m.source,held:d})),[]),u=xd(a,o,e,n);return s.useLayoutEffect(()=>{u!==a&&i(d=>d===a?u:d)}),[u.held,l]}const Po=44,Ks=7,go=8,Rd=2,Hl=10,Md=1e3,Qa=8,_a=6,Ya=4,Ha=12,Rn=(e,t)=>{const r=new Date(e,t-1,1);return r.setFullYear(e),yt(r)},Dd=(e,t)=>{if(e.length<Ya||t.count===0)return Pe;const r=Number(e.slice(0,Ya));if(!Number.isInteger(r))return Pe;const n=e.length>=_a,o=n?Number(e.slice(Ya,_a)):Ha;if(o<1||o>Ha)return Pe;const a=e.length>=Qa,i=a?Number(e.slice(_a,Qa)):0,l=Rn(r,o),u=(o===Ha?Rn(r+1,1):Rn(r,o+1))-1,d=a?l+i-1:n?l:Rn(r,1),m=a?d:n?u:Rn(r+1,1)-1;if(a&&(i<1||d>u))return Pe;for(let x=m;x>=d;x--){const L=t.indexOf(Vn(x));if(L!==Pe)return L}return Pe},yd=e=>e.closest(".dark")===null?"light":"dark",Ed=(e,t,r,n)=>{const o=r-e.bottom-go,a=e.top-go,i=o>=t||o>=a,u=Math.max(Po,Math.min(t,i?o:a)),d=i?e.bottom:e.top-u,m=e.width+Hl,x=Math.max(go,Math.min(e.left,n-m-go));return{top:d,left:x,width:m,height:u}},Pd=(e,t)=>e<t?e:t>0?t-1:Pe,jl=({domain:e,selectedIndex:t,openAnchorIndex:r,displayLabel:n,machineValue:o,disabled:a,ariaLabel:i,locale:l,labels:u,onCommitIndex:d,controlClassName:m})=>{const x=s.useId(),L=s.useMemo(()=>uu(u),[u]),T=`period-slider-date-listbox-${x}`,b=s.useCallback(V=>`period-slider-date-option-${x}-${V}`,[x]),[g,w]=s.useState(!1),[h,D]=s.useState(Pe),[M,v]=s.useState(null),[f,ue]=s.useState(null),K=s.useRef(null),re=s.useRef(null),ee=s.useRef(null),B=s.useRef({buffer:"",at:0}),ne=e.count,A=Pd(h,ne),q=mt(A);s.useLayoutEffect(()=>{A!==h&&D(V=>V===h?A:V)});const j=Math.min(ne,Ks)*Po,k=Math.max(1,Math.min(ne,Ks)),$=s.useCallback(()=>{const V=K.current;if(V===null)return;const X=V.getBoundingClientRect();v(Ed(X,j,window.innerHeight,window.innerWidth))},[j]),H=mt(g),Y=s.useCallback(()=>{w(!1),D(Pe),B.current={buffer:"",at:0},H.current=!1},[H]);s.useLayoutEffect(()=>()=>{H.current&&Y()},[H,Y]);const N=s.useCallback(V=>{a||ne===0||(D(V),w(!0),H.current=!0)},[a,ne,H]);s.useLayoutEffect(()=>{if(!g){v(null),ue(null);return}const V=K.current;return V!==null&&ue(yd(V)),$(),window.addEventListener("scroll",$,!0),window.addEventListener("resize",$),()=>{window.removeEventListener("scroll",$,!0),window.removeEventListener("resize",$)}},[g,$]),s.useEffect(()=>{if(!g)return;const V=X=>{const de=X.target;de!==null&&re.current?.contains(de)!==!0&&K.current?.contains(de)!==!0&&Y()};return document.addEventListener("pointerdown",V,!0),()=>document.removeEventListener("pointerdown",V,!0)},[g,Y]),s.useEffect(()=>{g&&(a||ne===0)&&Y()},[g,a,ne,Y]),s.useEffect(()=>{if(!g)return;const V=q.current;V!==Pe&&ee.current?.scrollToIndex(V,{align:"center"})},[ne,g,q]);const F=V=>{if(ne===0)return;const X=Math.max(0,Math.min(V,ne-1));D(X),ee.current?.scrollToIndex(X,{align:"center"})},G=V=>{V<0||V>=ne||(d(V),Y(),K.current?.focus())},he=mt(G),te=V=>{if(a||K.current===null)return;const X=A!==Pe?A:t!==Pe?t:r;switch(V.key){case"ArrowDown":if(V.preventDefault(),!g){N(X);return}F(X+1);return;case"ArrowUp":if(V.preventDefault(),!g){N(X);return}F(X-1);return;case"Home":if(!g)return;V.preventDefault(),F(0);return;case"End":if(!g)return;V.preventDefault(),F(ne-1);return;case"PageDown":if(!g)return;V.preventDefault(),F(X+k);return;case"PageUp":if(!g)return;V.preventDefault(),F(X-k);return;case"Enter":if(V.preventDefault(),!g){N(X);return}G(A!==Pe?A:X);return;case"Escape":if(!g)return;V.preventDefault(),Y();return;case"Tab":g&&Y();return}if(V.key.length!==1)return;const de=V.key>="0"&&V.key<="9",Oe=V.key==="-"||V.key==="/"||V.key===".";if(!(de||Oe))return;V.preventDefault();const we=Date.now(),tt=we-B.current.at>Md?"":B.current.buffer,qe=de?`${tt}${V.key}`.slice(0,Qa):tt;B.current={buffer:qe,at:we};const Fe=Dd(qe,e);if(Fe!==Pe){if(!g){N(Fe);return}F(Fe)}},le=s.useCallback(V=>V,[]),Se=s.useCallback(()=>Po,[]),ae=A===Pe?null:b(A),ie=s.useCallback(()=>{const V=K.current;if(V===null||ae===null)throw new Error("VirtualDateDropdown: the active row attached without its combobox control or an active option id, so aria-activedescendant has nothing to name it on");return V.setAttribute("aria-activedescendant",ae),()=>{V.getAttribute("aria-activedescendant")===ae&&V.removeAttribute("aria-activedescendant")}},[ae]),pe=s.useCallback(V=>{const X=V===t,de=V===A;return C.jsx("div",{id:b(V),role:"option","aria-selected":X,"aria-posinset":V+1,"aria-setsize":e.count,"data-testid":"period-slider-date-option","data-active":de?"true":void 0,ref:de?ie:void 0,className:"period-slider-date-option",style:{height:Po},onClick:()=>he.current(V),children:e.labelAt(V)})},[e,t,A,b,he,ie]),je=s.useCallback(V=>(re.current=V,V.style.removeProperty("display"),()=>{re.current=null,V.style.setProperty("display","none","important")}),[]),ft=g&&M!==null&&f!==null&&ne>0,ge=ft?C.jsx("div",{ref:je,className:"period-slider-date-popup","data-testid":"period-slider-date-popup","data-color-mode":f,style:{top:M.top,left:M.left,width:M.width,height:M.height},onMouseDown:V=>{V.preventDefault()},children:C.jsx(mr.VirtualScroll,{ref:ee,itemCount:ne,getItem:le,getItemHeight:Se,viewportSize:M.height-Rd,initialScrollIndex:A!==Pe?A:void 0,className:"h-full w-full",testId:"period-slider-date-listbox-pane",locale:l,labels:L,contentProps:{id:T,role:"listbox","aria-label":i},scrollBarOptions:{width:Hl,enableArrowButtons:!1,enableThumbDrag:!0,enableTrackClick:!0,tapScrollCircleOptions:{enabled:!1}},behaviorOptions:{enableKeyboardNavigation:!1,overscrollBehavior:"contain"},children:pe})}):null;return C.jsxs(C.Fragment,{children:[C.jsx("input",{ref:K,type:"text",role:"combobox",readOnly:!0,"aria-label":i,"aria-expanded":g,"aria-controls":ft?T:void 0,"aria-haspopup":"listbox","aria-autocomplete":"none",disabled:a,value:n,className:m,"data-testid":"period-slider-date-combobox","data-value":o,onKeyDown:te,onMouseDown:V=>{a||K.current===null||(V.preventDefault(),K.current?.focus(),g?Y():N(t!==Pe?t:r))},onBlur:()=>{g&&Y()}}),ge===null?null:Fc.createPortal(ge,document.body)]})};jl.displayName="VirtualDateDropdown";const Mn=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t},Ld=Fn("leave the bound out where the variant allows it, or declare the days to offer with minYear / maxYear or allowedDates"),$d=Fn('variant="split-dropdown" requires both bounds, so declare the years to offer with minYear / maxYear'),Td=31,Dn=(e,t,r)=>{if(!De(t))throw new RangeError(`DateSelector: ${e} must be a valid Date (received: ${y(t)})`);Ke("DateSelector",e,t,"day",0,r)},lr=(e,t,r)=>{const n=new Date(0);return n.setHours(0,0,0,0),n.setFullYear(e,t-1,r),n},po=e=>lr(e,1,1),qs=e=>lr(e,12,31),Fl=(e,t,r)=>e.getFullYear()===t&&e.getMonth()+1===r,Xs=(e,t,r,n)=>Fl(e,t,r)&&e.getDate()===n,bi=e=>Un(e,"year",0)!==null,wi=e=>Qo(e,"day",0),Cd=e=>bi(e)?wi(e):Number.NaN,bo=(e,t,r)=>{if(!bi(t))throw new RangeError(`DateSelector: ${e} must fall in a year that starts inside the Date range, because variant="split-dropdown" draws its year (received: ${y(t)})${r}`)},Zs=(e,t,r,n,o)=>{const a=[];for(let i=e;i<=t;i++){const l=r(i);if(Number.isNaN(l.getTime()))break;n(l,i)&&a.push({value:i,label:o(l)})}return a},Id=e=>{const{value:t,initialDate:r,onChange:n,stepper:o,stepGlyph:a,children:i,minYear:l,maxYear:u,minDate:d,maxDate:m,allowedDates:x,variant:L="date",className:T="",style:b,disabled:g=!1,locale:w,labels:h,formatLocale:D,formatOption:M}=e;D!==void 0&&Zo("DateSelector","formatLocale",D);const v=L==="split-dropdown"?$d:Ld;if(t!==void 0&&Dn("value",t,""),r!==void 0&&Dn("initialDate",r,""),d!==void 0&&Dn("minDate",d,v),m!==void 0&&Dn("maxDate",m,v),L==="split-dropdown"&&(t!==void 0&&bo("value",t,""),r!==void 0&&bo("initialDate",r,""),d!==void 0&&bo("minDate",d,v),m!==void 0&&bo("maxDate",m,v)),l!==void 0&&!Number.isInteger(l))throw new RangeError(`DateSelector: minYear must be an integer year (received: ${y(l)})`);if(u!==void 0&&!Number.isInteger(u))throw new RangeError(`DateSelector: maxYear must be an integer year (received: ${y(u)})`);if(l!==void 0&&Number.isNaN(po(l).getTime()))throw new RangeError(`DateSelector: minYear must name a year whose first day starts inside the Date range (received: ${y(l)})`);if(u!==void 0&&Number.isNaN(qs(u).getTime()))throw new RangeError(`DateSelector: maxYear must name a year whose last day starts inside the Date range (received: ${y(u)})`);if(L==="split-dropdown"&&x!==void 0)throw new RangeError('DateSelector: variant="split-dropdown" cannot honour allowedDates; use variant="dropdown" or variant="date" for a discrete date set');sn("DateSelector","allowedDates",x);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");o!==void 0&&gi("DateSelector",o,t!==void 0);const ue=li("DateSelector",a),K=zo(w,h),re=t!==void 0,[ee,B]=pi(f,re,wi,Mn),ne=t?.getTime(),A=s.useMemo(()=>t!==void 0?Mn(t):ee,[ne,ee]);if(L==="split-dropdown"&&!re&&!bi(A))throw new RangeError(`DateSelector: variant="split-dropdown" cannot draw the uncontrolled selection held from an earlier render (holding ${y(A)}), because that selection's year starts outside the Date range; control the date with value to decide what the split dropdown holds`);const q=d?.getTime(),j=m?.getTime(),k=s.useMemo(()=>{const I=d?Mn(d):null,J=l!==void 0?po(l):null;return I===null?J:J===null||I.getTime()>=J.getTime()?I:J},[q,l]),$=s.useMemo(()=>{const I=m?Mn(m):null,J=u!==void 0?qs(u):null;return I===null?J:J===null||I.getTime()<=J.getTime()?I:J},[j,u]),H=k?.getTime()??null,Y=$?.getTime()??null;if(k!==null&&$!==null&&k.getTime()>$.getTime())throw new RangeError(`DateSelector: the resolved upper bound must not precede the resolved lower bound (lower: ${xn(k)}, upper: ${xn($)})`);if(L!=="date"&&x===void 0&&(k===null||$===null))throw new RangeError(`DateSelector: variant=${y(L)} requires a lower bound (minYear or minDate) and an upper bound (maxYear or maxDate)${L==="dropdown"?", or allowedDates":""}; the option list is never invented`);const N=s.useMemo(()=>x===void 0?null:x.map(I=>Pt(I,J=>J.getTime())).join(","),[x]),F=s.useMemo(()=>{if(x===void 0)return null;const I=ud(x,(J,Ue)=>Dn(`allowedDates[${J}]`,Ue,""));return{ascending:I,ascendingSerials:I.map(yt)}},[N]),G=s.useMemo(()=>F===null?null:{...F,...cd(F.ascending,k,$)},[F,H,Y]),he=s.useMemo(()=>G!==null?sd(G.ascending,G.ascendingSerials,G.loIndex,G.hiIndex,D,M):k===null||$===null?ld:id(k,$,D,M),[G,H,Y,D,M]),te=s.useMemo(()=>G!==null?{kind:"candidates",ascending:G.ascendingSerials,loIndex:G.loIndex,hiIndex:G.hiIndex}:{kind:"range",min:k===null?null:yt(k),max:$===null?null:yt($)},[G,H,Y]),le=I=>!Number.isNaN(I.getTime())&&In(te,yt(I)),Se=I=>{if(g)return;const J=Mn(I);le(J)&&(re||B(J),n?.(J))},ae=A.getTime(),ie=le(A),pe=s.useMemo(()=>{const I=Zt(te,yt(A),-1);if(I===null)return null;const J=Vn(I);return Number.isNaN(J.getTime())?null:J},[te,ae]),je=s.useMemo(()=>{const I=Zt(te,yt(A),1);if(I===null)return null;const J=Vn(I);return Number.isNaN(J.getTime())?null:J},[te,ae]),ft=()=>{if(o!==void 0){o.onStep("previous");return}pe!==null&&Se(pe)},ge=()=>{if(o!==void 0){o.onStep("next");return}je!==null&&Se(je)},V=I=>{if(I.target.value){const J=jc.parseISO(I.target.value);Number.isNaN(J.getTime())||Se(J)}},X=A.getFullYear(),de=A.getMonth()+1,Oe=A.getDate(),we=s.useCallback((I,J)=>M?M(J,I,"part"):Vl(J,I,"part",D),[M,D]),tt=s.useMemo(()=>{if(L!=="split-dropdown"||k===null||$===null)return[];const I=[];for(let J=$.getFullYear();J>=k.getFullYear();J--)I.push({value:J,label:we("year",po(J))});return I},[L,H,Y,we]),qe=s.useMemo(()=>{if(L!=="split-dropdown"||k===null||$===null)return[];const I=k,J=$,Ue=X===I.getFullYear()?I.getMonth()+1:1,lt=X===J.getFullYear()?J.getMonth()+1:12;return Zs(Ue,lt,Ge=>lr(X,Ge,1),(Ge,Re)=>Fl(Ge,X,Re),Ge=>we("month",Ge))},[L,H,Y,X,we]),Fe=s.useMemo(()=>{if(L!=="split-dropdown"||k===null||$===null)return[];const I=k,J=$,Ue=X===I.getFullYear()&&de===I.getMonth()+1?I.getDate():1,lt=X===J.getFullYear()&&de===J.getMonth()+1?J.getDate():Td;return Zs(Ue,lt,Ge=>lr(X,de,Ge),(Ge,Re)=>Xs(Ge,X,de,Re),Ge=>we("day",Ge))},[L,H,Y,X,de,we]),st=(I,J,Ue)=>{const lt=lr(I,J,Ue);return Xs(lt,I,J,Ue)&&le(lt)},oe=(I,J,Ue)=>{st(I,J,Ue)&&Se(lr(I,J,Ue))},pt=tt.some(I=>I.value===X),Xe=qe.some(I=>I.value===de),ht=Fe.some(I=>I.value===Oe),Ae=xn(A),We=L==="dropdown"?it("day",A,M,D):"",ye=k?xn(k):void 0,bt=$?xn($):void 0,rt="text-center font-mono text-gray-500 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-400";return C.jsxs("div",{className:`inline-flex items-center ${Tn} ${T}`,style:b,"data-variant":L,"data-out-of-range":ie?void 0:"true",children:[C.jsx(Tr,{neighbour:"control",direction:"left",glyph:ue,disabled:g,canStep:o===void 0?pe!==null:o.canStepPrevious,onStep:ft,ariaLabel:K.previousDay}),L==="dropdown"?C.jsx(jl,{domain:he,selectedIndex:ie?he.indexOf(A):Pe,openAnchorIndex:he.nearestIndexOf(A),displayLabel:We,machineValue:Ae,disabled:g,ariaLabel:K.dateSelect,locale:w,labels:K,onCommitIndex:I=>Se(he.dateAt(I)),controlClassName:"period-slider-date-combobox-field 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"}):L==="split-dropdown"?C.jsxs("div",{className:"inline-flex items-center gap-1",children:[C.jsxs("select",{"aria-label":K.splitYear,disabled:g,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:pt?X:"",onChange:I=>oe(Number(I.target.value),de,Oe),children:[pt?null:C.jsx("option",{value:"",disabled:!0,className:rt,children:we("year",po(X))}),tt.map(I=>C.jsx("option",{value:I.value,disabled:!st(I.value,de,Oe),className:"dark:bg-slate-700 dark:text-slate-100",children:I.label},I.value))]}),C.jsxs("select",{"aria-label":K.splitMonth,disabled:g,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:Xe?de:"",onChange:I=>oe(X,Number(I.target.value),Oe),children:[Xe?null:C.jsx("option",{value:"",disabled:!0,className:rt,children:we("month",lr(X,de,1))}),qe.map(I=>C.jsx("option",{value:I.value,disabled:!st(X,I.value,Oe),className:"dark:bg-slate-700 dark:text-slate-100",children:I.label},I.value))]}),C.jsxs("select",{"aria-label":K.splitDay,disabled:g,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:ht?Oe:"",onChange:I=>oe(X,de,Number(I.target.value)),children:[ht?null:C.jsx("option",{value:"",disabled:!0,className:rt,children:we("day",lr(X,de,Oe))}),Fe.map(I=>C.jsx("option",{value:I.value,disabled:!st(X,de,I.value),className:"dark:bg-slate-700 dark:text-slate-100",children:I.label},I.value))]})]}):C.jsx("input",{"aria-label":K.dateSelect,disabled:g,className:"period-slider-native-date-field 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:Ae,min:ye,max:bt,onChange:V,type:"date"}),C.jsx(Tr,{neighbour:"control",direction:"right",glyph:ue,disabled:g,canStep:o===void 0?je!==null:o.canStepNext,onStep:ge,ariaLabel:K.nextDay}),i]})},kd=(e,t)=>!(!hi(e,t,t.variant==="split-dropdown"?Cd:wi)||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.stepper===void 0!=(t.stepper===void 0)||e.value===void 0!=(t.value===void 0)||e.stepper?.onStep!==t.stepper?.onStep||e.stepper?.canStepPrevious!==t.stepper?.canStepPrevious||e.stepper?.canStepNext!==t.stepper?.canStepNext||e.stepGlyph!==t.stepGlyph||e.allowedDates!==t.allowedDates||e.children!==t.children||e.locale!==t.locale||!Uo(e.labels,t.labels)||e.formatLocale!==t.formatLocale||e.formatOption!==t.formatOption),Ul=s.memo(Id,kd);Ul.displayName="DateSelector";function zn(e,t){const r=e+Math.floor(t/12),n=(t%12+12)%12,o=new Date(0);return o.setHours(0,0,0,0),o.setFullYear(r,n,1),o}function On(e){const t=Un(e,"month",0);return se("month",t===null?Number.NaN:t,0)}const zl=e=>Qo(e,"month",0);function Lr(e){return`${Go(e.getFullYear())}-${String(e.getMonth()+1).padStart(2,"0")}`}const Qs=Fn("leave the bound out where the variant allows it, or declare the months to offer with minYear / maxYear or allowedMonths");function wo(e,t,r){e!==void 0&&Bl(e,t,r)}function Bl(e,t,r){if(!De(e))throw new RangeError(`MonthSelector: ${t} must be a valid Date (received: ${y(e)})`);Ke("MonthSelector",t,e,"month",0,r)}function Js(e,t,r){if(e!==void 0){if(!Number.isInteger(e))throw new RangeError(`MonthSelector: ${t} must be an integer year (received: ${y(e)})`);if(Number.isNaN(zn(e,r).getTime()))throw new RangeError(`MonthSelector: ${t} must name a year whose ${r===0?"January":"December"} starts inside the Date range (received: ${y(e)})`)}}function Ad(e,t){const r=e===void 0?null:zn(e,0),n=t===void 0?null:On(t);return r!==null&&n!==null?r>=n?r:n:r!==null?r:n}function Nd(e,t){const r=e===void 0?null:zn(e,11),n=t===void 0?null:On(t);return r!==null&&n!==null?r<=n?r:n:r!==null?r:n}function cr(e){return e.getFullYear()*12+e.getMonth()}function Ja(e){return zn(Math.floor(e/12),(e%12+12)%12)}function el(e){return Number.isNaN(e.getTime())?null:e}function Vd(e,t,r){const n=new Map;for(const o of e){const a=On(o);t!==null&&a<t||r!==null&&a>r||n.has(a.getTime())||n.set(a.getTime(),a)}return Array.from(n.values()).sort((o,a)=>o.getTime()-a.getTime())}function Od(e,t){const r=[];for(let n=cr(e);n<=cr(t);n++)r.push(Ja(n));return r}function tl(e,t,r){const n=[];for(let o=e.length-1;o>=0;o--)n.push({label:it("month",e[o],r,t),value:Lr(e[o])});return n}const _d=e=>{const{value:t,initialDate:r,onChange:n,stepper:o,stepGlyph:a,children:i,variant:l="date",minYear:u,maxYear:d,minDate:m,maxDate:x,allowedMonths:L,isWarning:T=!1,className:b="",style:g,disabled:w=!1,locale:h,labels:D,formatLocale:M,formatOption:v}=e;if(M!==void 0&&Zo("MonthSelector","formatLocale",M),wo(t,"value",""),wo(r,"initialDate",""),wo(m,"minDate",Qs),wo(x,"maxDate",Qs),Js(u,"minYear",0),Js(d,"maxYear",11),sn("MonthSelector","allowedMonths",L),L!==void 0)for(let oe=0;oe<L.length;oe++)Bl(L[oe],`allowedMonths[${oe}]`,"");const f=t??r;if(f===void 0)throw new RangeError("MonthSelector: either value (controlled) or initialDate (uncontrolled) is required; the selected month is never inferred from the wall clock");o!==void 0&&gi("MonthSelector",o,t!==void 0);const ue=li("MonthSelector",a),K=zo(h,D),re=t!==void 0,[ee,B]=pi(f,re,zl,On),ne=s.useMemo(()=>t!==void 0?On(t):ee,[t?.getTime(),ee]),A=m?.getTime(),q=x?.getTime(),j=s.useMemo(()=>Ad(u,m),[u,A]),k=s.useMemo(()=>Nd(d,x),[d,q]),$=j?.getTime()??null,H=k?.getTime()??null;if(j!==null&&k!==null&&j>k)throw new RangeError(`MonthSelector: the resolved upper bound must not precede the resolved lower bound (lower: ${Lr(j)}, upper: ${Lr(k)})`);if(l==="dropdown"&&L===void 0&&(j===null||k===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 list is never invented');const Y=L===void 0?null:L.map(oe=>oe.getTime()).join(","),N=s.useMemo(()=>L===void 0?null:Vd(L,j,k),[Y,$,H]),F=s.useMemo(()=>{if(N!==null){const oe=N.map(cr);return{kind:"candidates",ascending:oe,loIndex:0,hiIndex:oe.length-1}}return{kind:"range",min:j===null?null:cr(j),max:k===null?null:cr(k)}},[N,$,H]),G=oe=>!Number.isNaN(oe.getTime())&&In(F,cr(oe)),he=oe=>{if(w)return;if(!G(oe))throw new RangeError(`MonthSelector: refusing to emit ${Lr(oe)}, which lies outside the selectable months`);re||B(oe);const pt=oe.getFullYear()*100+(oe.getMonth()+1);n?.(oe,pt)},te=ne.getTime(),le=G(ne),Se=s.useMemo(()=>{const oe=Zt(F,cr(ne),-1);return oe===null?null:el(Ja(oe))},[F,te]),ae=s.useMemo(()=>{const oe=Zt(F,cr(ne),1);return oe===null?null:el(Ja(oe))},[F,te]),ie=()=>{if(o!==void 0){o.onStep("previous");return}Se!==null&&he(Se)},pe=()=>{if(o!==void 0){o.onStep("next");return}ae!==null&&he(ae)},je=oe=>{if(!oe)return;const pt=oe.lastIndexOf("-");if(pt<=0)return;const Xe=oe.slice(0,pt),ht=oe.slice(pt+1),Ae=Number(Xe),We=Number(ht)-1;if(!(Number.isInteger(Ae)&&Number.isInteger(We)))return;const ye=zn(Ae,We);G(ye)&&he(ye)},ft=oe=>{je(oe.target.value)},ge=oe=>{je(oe.target.value)},V=Lr(ne),X=l==="dropdown"&&!le?it("month",ne,v,M):"",de=j?Lr(j):void 0,Oe=k?Lr(k):void 0,we=s.useMemo(()=>l!=="dropdown"?[]:N!==null?tl(N,M,v):j===null||k===null?[]:tl(Od(j,k),M,v),[l,N,$,H,M,v]),tt=le?V:"",qe=T?"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",Fe=`period-slider-native-date-field 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 ${qe}`,st=`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 ${qe}`;return C.jsxs("div",{className:`inline-flex items-center ${Tn} ${b}`,style:g,"data-out-of-range":le?void 0:"true",children:[C.jsx(Tr,{neighbour:"control",direction:"left",glyph:ue,disabled:w,canStep:o===void 0?Se!==null:o.canStepPrevious,onStep:ie,ariaLabel:K.previousMonth}),l==="dropdown"?C.jsxs("select",{"aria-label":K.monthSelect,disabled:w,className:st,value:tt,onChange:ge,children:[le?null:C.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:X}),we.map(oe=>C.jsx("option",{value:oe.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:oe.label},oe.value))]}):C.jsx("input",{"aria-label":K.monthSelect,disabled:w,className:Fe,value:V,min:de,max:Oe,onChange:ft,type:"month"}),C.jsx(Tr,{neighbour:"control",direction:"right",glyph:ue,disabled:w,canStep:o===void 0?ae!==null:o.canStepNext,onStep:pe,ariaLabel:K.nextMonth}),i]})},Yd=(e,t)=>!(!hi(e,t,zl)||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||e.allowedMonths!==t.allowedMonths||e.onChange!==t.onChange||e.stepper===void 0!=(t.stepper===void 0)||e.value===void 0!=(t.value===void 0)||e.stepper?.onStep!==t.stepper?.onStep||e.stepper?.canStepPrevious!==t.stepper?.canStepPrevious||e.stepper?.canStepNext!==t.stepper?.canStepNext||e.stepGlyph!==t.stepGlyph||e.children!==t.children||e.locale!==t.locale||!Uo(e.labels,t.labels)||e.formatLocale!==t.formatLocale||e.formatOption!==t.formatOption),Wl=s.memo(_d,Yd);Wl.displayName="MonthSelector";const ei=Symbol("nothing handed");let ja=0;class Hd{constructor(t,r,n,o){this.states=t,this.base=r,this.superseded=n,this.setMark=o}states;base;superseded;setMark;drafts=new Map;handed=new Map;cells=new Set;notes=[];closed=!1;marked=!1;committed=!1;record(){this.marked||(this.marked=!0,this.setMark(this))}leadsTo(t){return t.every((r,n)=>r===(this.handed.has(n)?this.handed.get(n):this.states[n]))}read(t,r){return this.drafts.has(t)?this.drafts.get(t):r}write(t,r){this.drafts.set(t,r),this.cells.add(t),this.record()}hand(t,r){this.handed.set(t.slot,r),this.cells.add(t),this.record()}note(t){this.notes.push(t),this.record()}hasHanded(t){return this.handed.has(t)}lastHanded(t){return this.handed.get(t)}close(){this.closed=!0}}class jd{constructor(t,r,n){this.owner=t,this.setMark=n,this.slotWrites=r.map(()=>0),this.records=r.map(()=>ei),this.latest=this.open(r)}owner;setMark;latest;active=null;slotWrites;records;outbox=[];duringRender=t=>{if(typeof t!="function")throw new TypeError(`${this.owner}: duringRender(action) must be a function (received: ${y(t)})`);const r=this.latest;if(r.closed)throw new Error(`${this.owner}: duringRender(action) must be called during the host's render, after the hook call (call the returned functions directly from event handlers and effects)`);const n=this.active;this.active=r,ja+=1;try{t()}finally{ja-=1,this.active=n}};get pass(){if(this.active===null&&ja>0)throw new Error(`${this.owner}: a returned function was called during another hook's duringRender(action); call it inside this hook's own duringRender(action)`);return this.active}inFlight(t){return!this.latest.committed&&this.latest.hasHanded(t)}handedTo(t){return this.records[t]}recordHanded(t,r){this.records[t]=r}begin(t,r){const n=this.latest;return!n.committed&&r===n&&n.leadsTo(t)?(n.closed&&(n.closed=!1,this.closeAtEndOfRun(n)),n):(n.close(),this.latest=this.open(t),this.latest)}open(t){const r=t.map((o,a)=>this.records[a]!==ei&&this.records[a]!==o),n=new Hd(t,[...this.slotWrites],r,this.setMark);return this.closeAtEndOfRun(n),n}closeAtEndOfRun(t){queueMicrotask(()=>t.close())}applies(t,r){return!t.superseded[r]&&t.base[r]===this.slotWrites[r]}commit(t,r){t.close(),t.committed=!0;for(const n of t.cells)this.applies(t,n.slot)&&n.adopt(t,r);for(const n of t.notes)this.applies(t,n.slot)&&this.outbox.push(n.send);this.outbox.length>0&&queueMicrotask(()=>this.deliver())}deliver(){for(let t=this.outbox.shift();t!==void 0;t=this.outbox.shift())t()}wrote(t){this.deliver(),this.slotWrites[t]+=1}notify(t,r){const n=this.pass;if(n!==null){n.note({slot:t,send:r});return}this.deliver(),r()}}class Fd extends Ol{constructor(t,r,n){super(t),this.scope=r,this.slot=n}scope;slot;adopted=null;get current(){const t=this.scope.pass;return t===null?super.current:t.read(this,super.current)}set current(t){const r=this.scope.pass;if(r!==null){r.write(this,t);return}this.scope.wrote(this.slot),super.current=t}hand(t){const r=this.scope.pass;if(r!==null){r.hand(this,t);return}this.adopted=null,this.scope.wrote(this.slot),this.scope.recordHanded(this.slot,t)}get holdsHanded(){const t=this.scope.pass;return t===null?this.scope.handedTo(this.slot)===super.current&&!this.scope.inFlight(this.slot):(t.hasHanded(this.slot)?t.lastHanded(this.slot):this.scope.handedTo(this.slot))===t.read(this,super.current)}forgetHanded(t){this.scope.wrote(this.slot),this.scope.handedTo(this.slot)===t&&this.scope.recordHanded(this.slot,ei)}adopt(t,r){const n=r[this.slot];if(!t.hasHanded(this.slot)||n!==t.lastHanded(this.slot))return;this.scope.recordHanded(this.slot,n);const o=t.states[this.slot];n!==o&&(this.adopted={opening:o,handed:n})}recordAdopted(t){const r=this.adopted;r!==null&&(this.adopted=null,t(n=>n===r.opening?r.handed:n))}}class Ud{constructor(t,r,n){this.scope=r,this.slot=n,this.held=t}scope;slot;held;get current(){const t=this.scope.pass;return t===null?this.held:t.read(this,this.held)}set current(t){const r=this.scope.pass;if(r!==null){r.write(this,t);return}this.scope.wrote(this.slot),this.held=t}adopt(t){this.held=t.read(this,this.held)}}const zd=(e,t)=>t;function Jo(e,t){const[r,n]=s.useReducer(zd,null),[o]=s.useState(()=>new jd(e,t,n)),a=o.begin(t,r);return s.useInsertionEffect(()=>{o.commit(a,t)}),s.useLayoutEffect(()=>{o.deliver()}),o}function Jr(e,t,r,n){const o=_l(r,a=>new Fd(a,e,t));return s.useLayoutEffect(()=>{o.recordAdopted(n)}),o}function en(e,t,r){const[n]=s.useState(()=>new Ud(r,e,t));return n}function ke(e,t,r){return e<t?t:e>r?r:e}const Bd=ln([],null,null);function _n(e,t,r,n){return r===null?Bd:ti(r,U(t,e[0],n),U(t,e[1],n))}function $r(e,t,r,n,o){const a=U(t,e,o),i=ri(n)?null:kn(n,a);return i===null?a<U(t,r[0],o)?r[0]:a>U(t,r[1],o)?r[1]:e:i===a?e:se(t,i,o)}function Zr(e,t,r,n,o,a){const i=U(t,e[0],o),l=U(t,e[1],o),u=Do(a,{kind:"range",min:U(t,r[0],o),max:U(t,r[1],o)},i,l);if(u===null)return e;const d=$r(u[0]===i?e[0]:se(t,u[0],o),t,r,n,o),m=$r(u[1]===l?e[1]:se(t,u[1],o),t,r,n,o);return[d,m<d?d:m]}const rl=(e,t,r,n,o,a,i)=>{if(sn(e,t,r),r===void 0||r.length===0)return null;const l=ln(Yl(e,t,r,n,i),U(n,o,i),U(n,a,i));if(l.hiIndex<l.loIndex)throw new RangeError(`${e}: every ${t} entry falls outside [minDate, maxDate] (minDate: ${y(o)}, maxDate: ${y(a)}, entries: ${r.length})`);return l},ti=(e,t,r)=>{const n=ln(e.ascending,t,r);return{kind:"candidates",ascending:e.ascending,loIndex:Math.max(e.loIndex,n.loIndex),hiIndex:Math.min(e.hiIndex,n.hiIndex)}},ri=e=>e.hiIndex<e.loIndex,Wd=e=>({stepEnd:(t,r)=>{let n=null;for(const o of e){const a=Zt(o,t,r);a!==null&&(n===null||(r===1?a<n:a>n))&&(n=a)}return n},edge:t=>{let r=null;for(const n of e){const o=Cn(n,t);o!==null&&(r===null||(t===1?o>r:o<r))&&(r=o)}return r}}),Et=(e,t)=>e[0].getTime()===t[0].getTime()&&e[1].getTime()===t[1].getTime(),nl=(e,t,r,n,o)=>{if(!At(r)||r.length!==2)throw new RangeError(`${e}: ${t} must be a [start, end] tuple of Dates (received: ${y(r)})`);const a=qt(e,`${t}[0]`,r[0],n,o),i=qt(e,`${t}[1]`,r[1],n,o);if(i<a)throw new RangeError(`${e}: ${t} must not be inverted at ${n} resolution (start: ${y(r[0])}, end: ${y(r[1])})`);return[a,i]},ur=e=>{const t="resolveVernierSelectorSteps";if(typeof e!="object"||e===null)throw new RangeError(`${t}: options must be an object (received: ${y(e)})`);const{row:r,shows:n,macroUnit:o,microUnit:a,minDate:i,maxDate:l,macroRange:u,microSelection:d}=e;if(r!=="macro"&&r!=="micro")throw new RangeError(`${t}: row must be "macro" or "micro" (received: ${y(r)})`);if(n!=="start"&&n!=="end")throw new RangeError(`${t}: shows must be "start" or "end" (received: ${y(n)})`);Le(t,"macroUnit",o),Le(t,"microUnit",a);const m=gr(t,e.yearStartMonth);for(const[A,q]of[["minDate",i],["maxDate",l]])if(!De(q))throw new RangeError(`${t}: ${A} must be a valid Date (received: ${y(q)})`);if(l.getTime()<=i.getTime())throw new RangeError(`${t}: maxDate must be strictly later than minDate (minDate: ${y(i)}, maxDate: ${y(l)})`);qt(t,"minDate",i,o,m),qt(t,"minDate",i,a,m),Cr(t,"rules",e.rules,r==="macro"?"motion":"vernierRange");const x=nl(t,"macroRange",u,o,m);if(u[1].getTime()<u[0].getTime())throw new RangeError(`${t}: macroRange must not be inverted (start: ${y(u[0])}, end: ${y(u[1])})`);const L=nl(t,"microSelection",d,a,m),T=rl(t,"macroAllowedDates",e.macroAllowedDates,o,i,l,m),b=rl(t,"microAllowedDates",e.microAllowedDates,a,i,l,m),g=[u[0],u[1]],w=[d[0],d[1]],h=A=>{const q=$t(o,a,[A[0],A[1]],i,l,m);return[U(a,q[0],m),U(a,q[1],m)]},D=(A,q)=>{if(b!==null){const j=ti(b,A,q);if(!ri(j))return j}return{kind:"range",min:A,max:q}},M=(A,q)=>{const j=Et(A,g)?g:A;return j===g&&Et(q,w)?null:{macroRange:j,microSelection:q}};if(e.row==="macro"){const A=T??{kind:"range",min:U(o,i,m),max:U(o,l,m)},q=Ro(A),j=($,H)=>{const Y=$t(o,a,$,i,l,m);return Zr(w,a,Y,_n(Y,a,b,m),m,H)},k=($,H)=>{const Y=za(q,x[0],x[1],$,qa(H,n));if(Y===null)return null;const N=Xa(Y,x,g,o,m,H.motion==="single");if(N===null)return null;const F=[ke(N[0],i,l),ke(N[1],i,l)],G=Math.sign(Y[0]-x[0])===$&&Math.sign(Y[1]-x[1])===$;return M(F,j(F,G?"pan":"resize"))};return{previous:k(-1,e.rules.previous),next:k(1,e.rules.next)}}const v=h(g);let f=[U(a,i,m),U(a,l,m)];if(T!==null){const A=h([se(o,T.ascending[T.loIndex],m),se(o,T.ascending[T.hiIndex],m)]);f=[Math.min(A[0],v[0]),Math.max(A[1],v[1])]}const ue=b===null?null:ti(b,f[0],f[1]);let K=Ro({kind:"range",min:f[0],max:f[1]});if(ue!==null&&!ri(ue)){const A=D(v[0],v[1]);K=A.kind==="candidates"?Ro(ue):Wd([ue,A])}const re=A=>{if(T===null)return[ke(Rt(o,A[0],m),i,l),ke(Rt(o,A[1],m),i,l)];const q=xo(T,U(o,A[0],m),-1),j=xo(T,U(o,A[1],m),1);return q===null||j===null?null:[ke(se(o,q,m),i,l),ke(se(o,j,m),i,l)]},ee=(A,q,j)=>{const[k,$]=h(A),H=D(k,$),Y=G=>{const he=U(a,G,m);if(In(H,he))return G;const te=xo(H,he,j);return te===null?null:se(a,te,m)},N=Y(q[0]),F=Y(q[1]);return N===null||F===null?null:[N,F.getTime()<N.getTime()?N:F]},B=(A,q)=>A>=v[0]&&q<=v[1],ne=(A,q)=>{const j=za(K,L[0],L[1],A,qa(q,n));if(j===null)return null;const k=Xa(j,L,w,a,m,q.motion==="single");if(k===null)return null;const $=q.window!=="follow",H=$&&B(j[0],j[1])?g:re(k);if(H===null)return null;const Y=ee(H,k,A);if(Y===null)return null;const N=$&&B(U(a,Y[0],m),U(a,Y[1],m))?g:re(Y);return N===null?null:M(N,Y)};return{previous:ne(-1,e.rules.previous),next:ne(1,e.rules.next)}};function ni(e,t,r){if(!De(r))throw new RangeError(`${e}: ${t} is required and must be a valid Date (received: ${y(r)})`)}function Ee(e,t,r,n,o){ni(e,t,r),Ke(e,t,r,n,o,"")}function ea(e,t,r,n,o){if(ni(e,"minDate",t),ni(e,"maxDate",r),r.getTime()<=t.getTime())throw new RangeError(`${e}: maxDate must be strictly later than minDate (minDate: ${y(t)}, maxDate: ${y(r)})`);for(const a of n)Ke(e,"minDate",t,a,o,bl)}function dr(e,t,r,n,o){if(!At(r)||r.length!==2)throw new RangeError(`${e}: ${t} is required and must be a [lower, upper] Date tuple (received: ${y(r)})`);if(Ee(e,`${t}[0]`,r[0],n,o),Ee(e,`${t}[1]`,r[1],n,o),r[0].getTime()>r[1].getTime())throw new RangeError(`${e}: ${t} upper must not be earlier than lower (lower: ${y(r[0])}, upper: ${y(r[1])})`)}function No(e,t,r,n,o,a,i,l){const u=U(r,n,l);if(u<U(r,o,l)||u>U(r,a,l))throw new RangeError(`${e}: ${t} must lie within ${i} (value: ${y(n)}, lower: ${y(o)}, upper: ${y(a)})`)}function Vo(e,t,r,n,o,a,i,l){No(e,`${t}[0]`,r,n[0],o,a,i,l),No(e,`${t}[1]`,r,n[1],o,a,i,l)}function Oo(e,t,r,n){if(n.getTime()<r.getTime())throw new RangeError(`${e}: ${t}(upper) must not be earlier than lower (lower: ${y(r)}, upper: ${y(n)})`)}function tn(e,t,r){if(!Number.isInteger(r))throw new RangeError(`${e}: ${t}(delta) must be an integer number of units (received: ${y(r)})`)}function Ft(e,t,r,n,o,a){const i=wl(e,t,r);return De(i)&&Un(i,e,a)!==null?{date:i,pastDateRange:!1}:{date:r>0?o:n,pastDateRange:!0}}function _o(e,t,r,n,o){const a=Me(e,r,t,o)+n;return e[Math.max(0,Math.min(e.length-1,a))]}function $n(e,t,r,n,o,a){const i=ke(e,r,n);if(o.length===0)return i;const l=o[Me(o,i,t,a)];return U(t,l,a)===U(t,i,a)?i:ke(l,r,n)}function Fa(e,t,r,n,o,a){const i=$n(e[0],t,r,n,o,a),l=$n(e[1],t,r,n,o,a);return[i,l<i?i:l]}function Yn(e,t){return t[0]===e[0]&&t[1]===e[1]?e:t}const Gd={year:"allowedYears",month:"allowedMonths",day:"allowedDates"};function Ut(e,t){return t.length===0?{}:{[Gd[e]]:t}}function ta(e){const t=s.useRef(e),r=t.current,n=e,o=Object.keys(r),a=Object.keys(n);return o.length===a.length&&a.every(l=>Object.is(r[l],n[l]))||(t.current=e),t.current}const Xt={previous:null,next:null},Kd=["motion","edge","window"];function Hn(e){const t=s.useRef(e),r=t.current;return r===e||r!==void 0&&e!==void 0&&["previous","next"].every(o=>Kd.every(a=>r[o][a]===e[o][a]))||(t.current=e),t.current}const Lo=(e,t)=>e.getTime()===t.getTime();function rn(e,t,r,n){if(!r(e.current,t))e.current=t;else if(e.holdsHanded)return;e.hand(e.current),n(e.current)}function nn(e,t,r){e.current=t,e.hand(t),r(t)}function qd(e,t){return typeof t=="function"?t(e):t}function on(e){return s.useReducer(qd,void 0,e)}function an(e,t,r,n){r===t||e.current!==r||(e.forgetHanded(t),n(o=>o===t?r:o))}function Xd(e){const{unit:t,minDate:r,maxDate:n,initialRange:o,onChangeRange:a,yearStartMonth:i,formatOption:l,selectorStep:u,...d}=e;Le("usePeriodSliderRange","unit",t);const m=gr("usePeriodSliderRange",i);ea("usePeriodSliderRange",r,n,[t],m),dr("usePeriodSliderRange","initialRange",o,t,m),u!==void 0&&Cr("usePeriodSliderRange","selectorStep",u,"motion");const x=ta(d),L=r.getTime(),T=n.getTime(),b=s.useMemo(()=>fr("usePeriodSliderRange",Ko(x.allowedDates),t,r,n,m).dates,[x.allowedDates,t,L,T,m]),g=s.useRef(o),[w,h]=on(()=>(Vo("usePeriodSliderRange","initialRange",t,o,r,n,"[minDate, maxDate]",m),Yn(o,Fa(o,t,r,n,b,m)))),D=Jo("usePeriodSliderRange",[w]);dr("usePeriodSliderRange","range",w,t,m);const M=Yn(w,Fa(w,t,r,n,b,m)),v=Jr(D,0,M,h);s.useLayoutEffect(()=>{an(v,w,M,h)});const f=en(D,0,o),ue=mt({minDate:r,maxDate:n,candidates:b}),K=mt(a),re=s.useCallback(te=>{const{minDate:le,maxDate:Se,candidates:ae}=ue.current,ie=Fa(te,t,le,Se,ae,m);rn(v,ie,Et,h);const pe=f.current;ie[0].getTime()===pe[0].getTime()&&ie[1].getTime()===pe[1].getTime()||(f.current=ie,D.notify(0,()=>K.current?.(ie[0],ie[1])))},[t,m]),ee=s.useCallback(te=>{const le=typeof te=="function"?te(v.current):te;f.current=le,nn(v,le,h)},[]),B=s.useCallback(te=>{Ee("usePeriodSliderRange","setLowerDate(date)",te,t,m);const le=v.current,Se=te.getTime()>le[1].getTime()?te:le[1];re([te,Se])},[re,t,m]),ne=s.useCallback(te=>{Ee("usePeriodSliderRange","setUpperDate(date)",te,t,m);const le=v.current,Se=te.getTime()<le[0].getTime()?te:le[0];re([Se,te])},[re,t,m]),A=s.useCallback((te,le)=>{Ee("usePeriodSliderRange","sliderProps.onChangeRange(lower)",te,t,m),Ee("usePeriodSliderRange","sliderProps.onChangeRange(upper)",le,t,m),Oo("usePeriodSliderRange","sliderProps.onChangeRange",te,le),re([te,le])},[re,t,m]),q=s.useCallback(te=>{tn("usePeriodSliderRange","shiftRange",te);const{minDate:le,maxDate:Se,candidates:ae}=ue.current,ie=v.current;if(ae.length>0){re([_o(ae,t,ie[0],te,m),_o(ae,t,ie[1],te,m)]);return}re([Ft(t,ie[0],te,le,Se,m).date,Ft(t,ie[1],te,le,Se,m).date])},[t,re,m]),j=s.useCallback(()=>{re(g.current)},[re]),k=Hn(u),$=k!==void 0,H=s.useMemo(()=>{if(k===void 0)return{start:Xt,end:Xt};const te=b.length>0?x.allowedDates:void 0,le={selection:M,unit:t,yearStartMonth:m,minDate:r,maxDate:n,allowedDates:te,rules:k};return{start:Za({...le,shows:"start"}),end:Za({...le,shows:"end"})}},[k,M,t,m,L,T,b,x.allowedDates]),Y=jt(H.start,re),N=jt(H.end,re),F=s.useMemo(()=>({value:M[0],onChange:B,minDate:r,maxDate:M[1],unit:t,yearStartMonth:m,...Ut(t,b),formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:l,...$?{stepper:Y}:{}}),[M[0],M[1],B,r,t,m,b,e.formatLocale,e.locale,e.labels,l,$,Y]),G=s.useMemo(()=>({value:M[1],onChange:ne,minDate:M[0],maxDate:n,unit:t,yearStartMonth:m,...Ut(t,b),formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:l,...$?{stepper:N}:{}}),[M[0],M[1],ne,n,t,m,b,e.formatLocale,e.locale,e.labels,l,$,N]),he=s.useMemo(()=>({...x,mode:"range",unit:t,yearStartMonth:m,range:M,minDate:r,maxDate:n,onChangeRange:A}),[x,t,M,r,n,A,m]);return{range:M,lowerDate:M[0],upperDate:M[1],setRange:ee,setLowerDate:B,setUpperDate:ne,shiftRange:q,resetRange:j,startSelectorProps:F,endSelectorProps:G,sliderProps:he,duringRender:D.duringRender}}function Zd(e){const{unit:t,minDate:r,maxDate:n,initialValue:o,onChangePoint:a,yearStartMonth:i,formatOption:l,...u}=e;Le("usePeriodSliderPoint","unit",t);const d=gr("usePeriodSliderPoint",i);ea("usePeriodSliderPoint",r,n,[t],d),Ee("usePeriodSliderPoint","initialValue",o,t,d);const m=ta(u),x=r.getTime(),L=n.getTime(),T=s.useMemo(()=>fr("usePeriodSliderPoint",Ko(m.allowedDates),t,r,n,d).dates,[m.allowedDates,t,x,L,d]),b=s.useRef(o),[g,w]=on(()=>(No("usePeriodSliderPoint","initialValue",t,o,r,n,"[minDate, maxDate]",d),$n(o,t,r,n,T,d))),h=Jo("usePeriodSliderPoint",[g]);Ee("usePeriodSliderPoint","value",g,t,d);const D=$n(g,t,r,n,T,d),M=Jr(h,0,D,w);s.useLayoutEffect(()=>{an(M,g,D,w)});const v=en(h,0,o),f=mt({minDate:r,maxDate:n,candidates:T}),ue=mt(a),K=s.useCallback(k=>{const{minDate:$,maxDate:H,candidates:Y}=f.current,N=$n(k,t,$,H,Y,d);rn(M,N,Lo,w),N.getTime()!==v.current.getTime()&&(v.current=N,h.notify(0,()=>ue.current?.(N)))},[t,d]),re=s.useCallback(k=>{const $=typeof k=="function"?k(M.current):k;v.current=$,nn(M,$,w)},[]),ee=s.useCallback(k=>{Ee("usePeriodSliderPoint","selectorProps.onChange(date)",k,t,d),K(k)},[K,t,d]),B=s.useCallback(k=>{Ee("usePeriodSliderPoint","sliderProps.onChangePoint(value)",k,t,d),K(k)},[K,t,d]),ne=s.useCallback(k=>{tn("usePeriodSliderPoint","shiftValue",k);const{minDate:$,maxDate:H,candidates:Y}=f.current;if(Y.length>0){K(_o(Y,t,M.current,k,d));return}K(Ft(t,M.current,k,$,H,d).date)},[t,K,d]),A=s.useCallback(()=>{K(b.current)},[K]),q=s.useMemo(()=>({value:D,onChange:ee,minDate:r,maxDate:n,unit:t,yearStartMonth:d,...Ut(t,T),formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:l}),[D,ee,r,n,t,d,T,e.formatLocale,e.locale,e.labels,l]),j=s.useMemo(()=>({...m,mode:"point",unit:t,yearStartMonth:d,value:D,minDate:r,maxDate:n,onChangePoint:B}),[m,t,D,r,n,B,d]);return{value:D,setValue:re,shiftValue:ne,resetValue:A,selectorProps:q,sliderProps:j,duringRender:h.duringRender}}function Qd(e){const{unit:t,minDate:r,maxDate:n,initialMacroRange:o,initialMicroRange:a,macroUnit:i,microUnit:l,onChangeMacroRange:u,onChangeMicroRange:d,yearStartMonth:m,formatOption:x,macroSelectorStep:L,microSelectorStep:T,...b}=e;Le("useVernierSliderRange","unit",t);const g=Qt("useVernierSliderRange","macroUnit",i,t),w=Qt("useVernierSliderRange","microUnit",l,t),h=gr("useVernierSliderRange",m);ea("useVernierSliderRange",r,n,[g,w,t],h),dr("useVernierSliderRange","initialMacroRange",o,g,h),dr("useVernierSliderRange","initialMicroRange",a,w,h),L!==void 0&&Cr("useVernierSliderRange","macroSelectorStep",L,"motion"),T!==void 0&&Cr("useVernierSliderRange","microSelectorStep",T,"vernierRange");const D=ta(b),M=s.useRef(o),v=s.useRef(a),[f,ue]=on(()=>(Vo("useVernierSliderRange","initialMacroRange",g,o,r,n,"[minDate, maxDate]",h),o)),[K,re]=on(()=>{const E=$t(g,w,o,r,n,h);return Vo("useVernierSliderRange","initialMicroRange",w,a,E[0],E[1],"the initial macro window",h),a}),ee=Jo("useVernierSliderRange",[f,K]);dr("useVernierSliderRange","macroRange",f,g,h);const B=Yn(f,[ke(f[0],r,n),ke(f[1],r,n)]),ne=r.getTime(),A=n.getTime(),q=s.useMemo(()=>$t(g,w,B,r,n,h),[g,w,B,ne,A,h]),j=s.useMemo(()=>Ht("micro",D)?ui("useVernierSliderRange",Lt("micro",D),w,r,n,h):null,[D.microIsDiscrete,D.microAllowedDates,D.allowedDates,w,ne,A,h]),k=s.useMemo(()=>Ht("macro",D)?fr("useVernierSliderRange",Lt("macro",D),g,r,n,h).dates:[],[D.macroIsDiscrete,D.macroAllowedDates,D.allowedDates,g,ne,A,h]),$=mt(k),H=s.useMemo(()=>_n(q,w,j,h),[q,w,j,h]),Y=s.useMemo(()=>Nn(j,H),[j,H]);dr("useVernierSliderRange","microRange",K,w,h);const N=Yn(K,Zr(K,w,q,H,h,"resize")),F=Jr(ee,0,B,ue),G=Jr(ee,1,N,re);s.useLayoutEffect(()=>{an(F,f,B,ue),an(G,K,N,re)});const he=en(ee,1,a),te=en(ee,0,o),le=mt({minDate:r,maxDate:n}),Se=mt(u),ae=mt(d),ie=s.useCallback(E=>{const{minDate:z,maxDate:ce}=le.current;return $t(g,w,E,z,ce,h)},[g,w,h]),pe=s.useCallback(E=>_n(E,w,j,h),[w,j,h]),je=s.useCallback(E=>{rn(F,E,Et,ue);const z=te.current;E[0].getTime()===z[0].getTime()&&E[1].getTime()===z[1].getTime()||(te.current=E,ee.notify(0,()=>Se.current?.(E[0],E[1])))},[]),ft=s.useCallback(E=>{const z=typeof E=="function"?E(F.current):E;te.current=z,nn(F,z,ue)},[]),ge=s.useCallback((E,z,ce)=>{const Ne=ce==="micro"&&Et(F.current,E)&&Et(te.current,E),Te=ce==="macro"&&Et(G.current,z)&&Et(he.current,z);if(Ne||je(E),Te)return;rn(G,z,Et,re);const Ve=he.current;(z[0].getTime()!==Ve[0].getTime()||z[1].getTime()!==Ve[1].getTime())&&(he.current=z,ee.notify(1,()=>ae.current?.(z[0],z[1])))},[je]),V=s.useCallback(E=>{const z=typeof E=="function"?E(G.current):E;he.current=z,nn(G,z,re)},[]),X=s.useCallback((E,z,ce)=>{const{minDate:Ne,maxDate:Te}=le.current,Ve=[ke(E,Ne,Te),ke(z,Ne,Te)],Ye=ie(Ve);ge(Ve,Zr(G.current,w,Ye,pe(Ye),h,ce),"macro")},[w,ie,pe,ge,h]),de=s.useCallback((E,z)=>X(E,z,"resize"),[X]),Oe=s.useCallback((E,z)=>{Ee("useVernierSliderRange","sliderProps.onChangeMacroRange(lower)",E,g,h),Ee("useVernierSliderRange","sliderProps.onChangeMacroRange(upper)",z,g,h),Oo("useVernierSliderRange","sliderProps.onChangeMacroRange",E,z);const{minDate:ce,maxDate:Ne}=le.current,Te=[ke(E,ce,Ne),ke(z,ce,Ne)],Ve=G.current,Ye=ie(Te),Tt=Zr(Ve,w,Ye,pe(Ye),h,"resize");if(Tt[0].getTime()!==Ve[0].getTime()||Tt[1].getTime()!==Ve[1].getTime()){je(Te);return}ge(Te,Ve,"macro")},[g,w,ie,pe,je,ge,h]),we=s.useCallback((E,z)=>{const ce=ie(F.current);ge(F.current,Zr([E,z],w,ce,pe(ce),h,"resize"),"micro")},[w,ie,pe,ge,h]),tt=s.useCallback((E,z)=>{Ee("useVernierSliderRange","sliderProps.onChangeMicroRange(lower)",E,w,h),Ee("useVernierSliderRange","sliderProps.onChangeMicroRange(upper)",z,w,h),Oo("useVernierSliderRange","sliderProps.onChangeMicroRange",E,z),we(E,z)},[we,w,h]),qe=s.useCallback(E=>{Ee("useVernierSliderRange","setMacroLowerDate(date)",E,g,h);const z=F.current[1],ce=E>z?E:z;de(E,ce)},[de,g,h]),Fe=s.useCallback(E=>{Ee("useVernierSliderRange","setMacroUpperDate(date)",E,g,h);const z=F.current[0],ce=E<z?E:z;de(ce,E)},[de,g,h]),st=s.useCallback(E=>{Ee("useVernierSliderRange","setMicroLowerDate(date)",E,w,h);const z=G.current[1],ce=E>z?E:z;we(E,ce)},[we,w,h]),oe=s.useCallback(E=>{Ee("useVernierSliderRange","setMicroUpperDate(date)",E,w,h);const z=G.current[0],ce=E<z?E:z;we(ce,E)},[we,w,h]),pt=s.useCallback(E=>{tn("useVernierSliderRange","shiftMacroRange",E);const{minDate:z,maxDate:ce}=le.current,Ne=F.current,Te=$.current;if(Te.length>0){const Tt=Me(Te,Ne[0],g,h)+E,Jt=Me(Te,Ne[1],g,h)+E;if(Tt<0||Jt>Te.length-1)return;X(Te[Tt],Te[Jt],"pan");return}const Ve=Ft(g,Ne[0],E,z,ce,h),Ye=Ft(g,Ne[1],E,z,ce,h);Ve.pastDateRange||Ye.pastDateRange||Ve.date<z||Ye.date>ce||X(Ve.date,Ye.date,"pan")},[g,X,h]),Xe=s.useCallback(E=>{tn("useVernierSliderRange","shiftMicroRange",E);const z=F.current,ce=G.current,Ne=ie(z),[Te,Ve]=Ne,Ye=Nn(j,pe(Ne));if(Ye.length>0){const nt=Me(Ye,ce[0],w,h)+E,pr=Me(Ye,ce[1],w,h)+E;if(nt<0||pr>Ye.length-1)return;we(Ye[nt],Ye[pr]);return}const Tt=Ft(w,ce[0],E,Te,Ve,h),Jt=Ft(w,ce[1],E,Te,Ve,h);Tt.pastDateRange||Jt.pastDateRange||U(w,Tt.date,h)<U(w,Te,h)||U(w,Jt.date,h)>U(w,Ve,h)||we(Tt.date,Jt.date)},[w,j,ie,pe,we,h]),ht=s.useCallback(()=>{const{minDate:E,maxDate:z}=le.current,ce=[ke(M.current[0],E,z),ke(M.current[1],E,z)],Ne=ie(ce);ge(ce,Zr(v.current,w,Ne,pe(Ne),h,"resize"),"both")},[w,ie,pe,ge,h]),Ae=Hn(L),We=Hn(T),ye=Ae!==void 0,bt=We!==void 0,rt=s.useMemo(()=>{const E={macroUnit:g,microUnit:w,yearStartMonth:h,minDate:r,maxDate:n,macroRange:B,microSelection:N,macroAllowedDates:Ht("macro",D)?Lt("macro",D).list:void 0,microAllowedDates:Ht("micro",D)?Lt("micro",D).list:void 0};return{macroStart:Ae===void 0?Xt:ur({...E,row:"macro",shows:"start",rules:Ae}),macroEnd:Ae===void 0?Xt:ur({...E,row:"macro",shows:"end",rules:Ae}),microStart:We===void 0?Xt:ur({...E,row:"micro",shows:"start",rules:We}),microEnd:We===void 0?Xt:ur({...E,row:"micro",shows:"end",rules:We})}},[Ae,We,g,w,h,ne,A,B,N,D.macroIsDiscrete,D.macroAllowedDates,D.microIsDiscrete,D.microAllowedDates,D.allowedDates]),zt=s.useCallback(E=>ge(E.macroRange,E.microSelection,"macro"),[ge]),I=s.useCallback(E=>ge(E.macroRange,E.microSelection,"micro"),[ge]),J=jt(rt.macroStart,zt),Ue=jt(rt.macroEnd,zt),lt=jt(rt.microStart,I),Ge=jt(rt.microEnd,I),[Re,$e]=q,Ir=s.useMemo(()=>({value:B[0],onChange:qe,minDate:r,maxDate:B[1],unit:g,yearStartMonth:h,...Ut(g,k),formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:x,...ye?{stepper:J}:{}}),[B,qe,r,g,h,k,e.formatLocale,e.locale,e.labels,x,ye,J]),_=s.useMemo(()=>({value:B[1],onChange:Fe,minDate:B[0],maxDate:n,unit:g,yearStartMonth:h,...Ut(g,k),formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:x,...ye?{stepper:Ue}:{}}),[B,Fe,n,g,h,k,e.formatLocale,e.locale,e.labels,x,ye,Ue]),P=s.useMemo(()=>({value:N[0],onChange:st,minDate:Re,maxDate:N[1],unit:w,yearStartMonth:h,...Ut(w,Y),formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:x,...bt?{stepper:lt}:{}}),[N,st,Re,w,h,Y,e.formatLocale,e.locale,e.labels,x,bt,lt]),xe=s.useMemo(()=>({value:N[1],onChange:oe,minDate:N[0],maxDate:$e,unit:w,yearStartMonth:h,...Ut(w,Y),formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:x,...bt?{stepper:Ge}:{}}),[N,oe,$e,w,h,Y,e.formatLocale,e.locale,e.labels,x,bt,Ge]),_e=s.useMemo(()=>({...D,mode:"vernier",unit:t,yearStartMonth:h,macroUnit:g,microUnit:w,minDate:r,maxDate:n,macroRange:B,microRange:N,onChangeMacroRange:Oe,onChangeMicroRange:tt}),[D,t,g,w,r,n,B,N,Oe,tt,h]);return{macroRange:B,setMacroRange:ft,microRange:N,setMicroRange:V,setMacroLowerDate:qe,setMacroUpperDate:Fe,setMicroLowerDate:st,setMicroUpperDate:oe,shiftMacroRange:pt,shiftMicroRange:Xe,resetVernier:ht,macroStartSelectorProps:Ir,macroEndSelectorProps:_,microStartSelectorProps:P,microEndSelectorProps:xe,sliderProps:_e,duringRender:ee.duringRender}}function Jd(e){const{unit:t,minDate:r,maxDate:n,initialMacroRange:o,initialMicroValue:a,macroUnit:i,microUnit:l,onChangeMacroRange:u,onChangeMicroPoint:d,yearStartMonth:m,formatOption:x,macroSelectorStep:L,microSelectorStep:T,...b}=e;Le("useVernierSliderPoint","unit",t);const g=Qt("useVernierSliderPoint","macroUnit",i,t),w=Qt("useVernierSliderPoint","microUnit",l,t),h=gr("useVernierSliderPoint",m);ea("useVernierSliderPoint",r,n,[g,w,t],h),dr("useVernierSliderPoint","initialMacroRange",o,g,h),Ee("useVernierSliderPoint","initialMicroValue",a,w,h),L!==void 0&&Cr("useVernierSliderPoint","macroSelectorStep",L,"motion"),T!==void 0&&Cr("useVernierSliderPoint","microSelectorStep",T,"vernierPoint");const D=ta(b),M=s.useRef(o),v=s.useRef(a),[f,ue]=on(()=>(Vo("useVernierSliderPoint","initialMacroRange",g,o,r,n,"[minDate, maxDate]",h),o)),[K,re]=on(()=>{const _=$t(g,w,o,r,n,h);return No("useVernierSliderPoint","initialMicroValue",w,a,_[0],_[1],"the initial macro window",h),a}),ee=Jo("useVernierSliderPoint",[f,K]);dr("useVernierSliderPoint","macroRange",f,g,h);const B=Yn(f,[ke(f[0],r,n),ke(f[1],r,n)]),ne=r.getTime(),A=n.getTime(),q=s.useMemo(()=>$t(g,w,B,r,n,h),[g,w,B,ne,A,h]),j=s.useMemo(()=>Ht("micro",D)?ui("useVernierSliderPoint",Lt("micro",D),w,r,n,h):null,[D.microIsDiscrete,D.microAllowedDates,D.allowedDates,w,ne,A,h]),k=s.useMemo(()=>Ht("macro",D)?fr("useVernierSliderPoint",Lt("macro",D),g,r,n,h).dates:[],[D.macroIsDiscrete,D.macroAllowedDates,D.allowedDates,g,ne,A,h]),$=mt(k),H=s.useMemo(()=>_n(q,w,j,h),[q,w,j,h]),Y=s.useMemo(()=>Nn(j,H),[j,H]);Ee("useVernierSliderPoint","microValue",K,w,h);const N=$r(K,w,q,H,h),F=Jr(ee,0,B,ue),G=Jr(ee,1,N,re);s.useLayoutEffect(()=>{an(F,f,B,ue),an(G,K,N,re)});const he=en(ee,1,a),te=en(ee,0,o),le=mt({minDate:r,maxDate:n}),Se=mt(u),ae=mt(d),ie=s.useCallback(_=>{const{minDate:P,maxDate:xe}=le.current;return $t(g,w,_,P,xe,h)},[g,w,h]),pe=s.useCallback(_=>_n(_,w,j,h),[w,j,h]),je=s.useCallback(_=>{rn(F,_,Et,ue);const P=te.current;_[0].getTime()===P[0].getTime()&&_[1].getTime()===P[1].getTime()||(te.current=_,ee.notify(0,()=>Se.current?.(_[0],_[1])))},[]),ft=s.useCallback(_=>{const P=typeof _=="function"?_(F.current):_;te.current=P,nn(F,P,ue)},[]),ge=s.useCallback((_,P,xe)=>{const _e=xe==="micro"&&Et(F.current,_)&&Et(te.current,_),E=xe==="macro"&&Lo(G.current,P)&&Lo(he.current,P);_e||je(_),!E&&(rn(G,P,Lo,re),P.getTime()!==he.current.getTime()&&(he.current=P,ee.notify(1,()=>ae.current?.(P))))},[je]),V=s.useCallback(_=>{const P=typeof _=="function"?_(G.current):_;he.current=P,nn(G,P,re)},[]),X=s.useCallback((_,P)=>{const{minDate:xe,maxDate:_e}=le.current,E=[ke(_,xe,_e),ke(P,xe,_e)],z=ie(E);ge(E,$r(G.current,w,z,pe(z),h),"macro")},[w,ie,pe,ge,h]),de=s.useCallback(_=>{const P=ie(F.current);ge(F.current,$r(_,w,P,pe(P),h),"micro")},[w,ie,pe,ge,h]),Oe=s.useCallback((_,P)=>{Ee("useVernierSliderPoint","sliderProps.onChangeMacroRange(lower)",_,g,h),Ee("useVernierSliderPoint","sliderProps.onChangeMacroRange(upper)",P,g,h),Oo("useVernierSliderPoint","sliderProps.onChangeMacroRange",_,P);const{minDate:xe,maxDate:_e}=le.current,E=[ke(_,xe,_e),ke(P,xe,_e)],z=G.current,ce=ie(E);if($r(z,w,ce,pe(ce),h).getTime()!==z.getTime()){je(E);return}ge(E,z,"macro")},[g,w,ie,pe,je,ge,h]),we=s.useCallback(_=>{Ee("useVernierSliderPoint","sliderProps.onChangeMicroPoint(value)",_,w,h),de(_)},[de,w,h]),tt=s.useCallback(_=>{Ee("useVernierSliderPoint","setMacroLowerDate(date)",_,g,h);const P=F.current[1],xe=_>P?_:P;X(_,xe)},[X,g,h]),qe=s.useCallback(_=>{Ee("useVernierSliderPoint","setMacroUpperDate(date)",_,g,h);const P=F.current[0],xe=_<P?_:P;X(xe,_)},[X,g,h]),Fe=s.useCallback(_=>{Ee("useVernierSliderPoint","setMicroDate(date)",_,w,h),de(_)},[de,w,h]),st=s.useCallback(_=>{tn("useVernierSliderPoint","shiftMacroRange",_);const{minDate:P,maxDate:xe}=le.current,_e=F.current,E=$.current;if(E.length>0){const Ne=Me(E,_e[0],g,h)+_,Te=Me(E,_e[1],g,h)+_;if(Ne<0||Te>E.length-1)return;X(E[Ne],E[Te]);return}const z=Ft(g,_e[0],_,P,xe,h),ce=Ft(g,_e[1],_,P,xe,h);z.pastDateRange||ce.pastDateRange||z.date<P||ce.date>xe||X(z.date,ce.date)},[g,X,h]),oe=s.useCallback(_=>{tn("useVernierSliderPoint","shiftMicroValue",_);const P=F.current,xe=ie(P),_e=Nn(j,pe(xe));if(_e.length>0){de(_o(_e,w,G.current,_,h));return}de(Ft(w,G.current,_,xe[0],xe[1],h).date)},[w,j,ie,pe,de,h]),pt=s.useCallback(()=>{const{minDate:_,maxDate:P}=le.current,xe=[ke(M.current[0],_,P),ke(M.current[1],_,P)],_e=ie(xe);ge(xe,$r(v.current,w,_e,pe(_e),h),"both")},[w,ie,pe,ge,h]),Xe=Hn(L),ht=Hn(T),Ae=Xe!==void 0,We=ht!==void 0,ye=s.useMemo(()=>{const _={macroUnit:g,microUnit:w,yearStartMonth:h,minDate:r,maxDate:n,macroRange:B,microSelection:[N,N],macroAllowedDates:Ht("macro",D)?Lt("macro",D).list:void 0,microAllowedDates:Ht("micro",D)?Lt("micro",D).list:void 0};return{macroStart:Xe===void 0?Xt:ur({..._,row:"macro",shows:"start",rules:Xe}),macroEnd:Xe===void 0?Xt:ur({..._,row:"macro",shows:"end",rules:Xe}),micro:ht===void 0?Xt:ur({..._,row:"micro",shows:"end",rules:{previous:{motion:"shift",window:ht.previous.window},next:{motion:"shift",window:ht.next.window}}})}},[Xe,ht,g,w,h,ne,A,B,N,D.macroIsDiscrete,D.macroAllowedDates,D.microIsDiscrete,D.microAllowedDates,D.allowedDates]),bt=s.useCallback(_=>ge(_.macroRange,_.microSelection[0],"macro"),[ge]),rt=s.useCallback(_=>ge(_.macroRange,_.microSelection[0],"micro"),[ge]),zt=jt(ye.macroStart,bt),I=jt(ye.macroEnd,bt),J=jt(ye.micro,rt),[Ue,lt]=q,Ge=s.useMemo(()=>({value:B[0],onChange:tt,minDate:r,maxDate:B[1],unit:g,yearStartMonth:h,...Ut(g,k),formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:x,...Ae?{stepper:zt}:{}}),[B,tt,r,g,h,k,e.formatLocale,e.locale,e.labels,x,Ae,zt]),Re=s.useMemo(()=>({value:B[1],onChange:qe,minDate:B[0],maxDate:n,unit:g,yearStartMonth:h,...Ut(g,k),formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:x,...Ae?{stepper:I}:{}}),[B,qe,n,g,h,k,e.formatLocale,e.locale,e.labels,x,Ae,I]),$e=s.useMemo(()=>({value:N,onChange:Fe,minDate:Ue,maxDate:lt,unit:w,yearStartMonth:h,...Ut(w,Y),formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:x,...We?{stepper:J}:{}}),[N,Fe,Ue,lt,w,h,Y,e.formatLocale,e.locale,e.labels,x,We,J]),Ir=s.useMemo(()=>({...D,mode:"vernier",unit:t,yearStartMonth:h,macroUnit:g,microUnit:w,minDate:r,maxDate:n,macroRange:B,microValue:N,onChangeMacroRange:Oe,onChangeMicroPoint:we}),[D,t,g,w,r,n,B,N,Oe,we,h]);return{macroRange:B,setMacroRange:ft,microValue:N,setMicroValue:V,setMacroLowerDate:tt,setMacroUpperDate:qe,setMicroDate:Fe,shiftMacroRange:st,shiftMicroValue:oe,resetVernier:pt,macroStartSelectorProps:Ge,macroEndSelectorProps:Re,microSelectorProps:$e,sliderProps:Ir,duringRender:ee.duringRender}}function oi(e,t){const r=new Date(0);return r.setHours(0,0,0,0),r.setFullYear(e,t,1),r}function Yo(e,t){const r=new Date(e.getTime());return Wo(r.getFullYear(),r.getMonth(),t)}function ol(e){return e===void 0?0:gl(e)?e:Number.NaN}const al=Fn("declare the years to offer with minYear / maxYear or allowedYears");function vo(e,t,r,n){e!==void 0&&Gl(e,t,r,n)}function Gl(e,t,r,n){if(!De(e))throw new RangeError(`YearSelector: ${t} must be a valid Date (received: ${y(e)})`);Ke("YearSelector",t,e,"year",r,n)}function il(e,t,r){if(e!==void 0){if(!Number.isInteger(e))throw new RangeError(`YearSelector: ${t} must be an integer year (received: ${y(e)})`);if(Number.isNaN(oi(e,r).getTime()))throw new RangeError(`YearSelector: ${t} must name a year that starts inside the Date range (received: ${y(e)}); under yearStartMonth ${r} that year starts on month ${r+1}, day 1`)}}function sl(e,t,r,n){const o=e===void 0?null:e,a=t===void 0?null:Yo(t,n);return o!==null&&a!==null?r(o,a):o!==null?o:a}function em(e,t,r,n){const o=new Set;for(const a of e){const i=Yo(a,n);t!==null&&i<t||r!==null&&i>r||o.add(i)}return Array.from(o).sort((a,i)=>a-i)}function tm(e,t,r,n){return e!==void 0?{kind:"discrete",ascending:em(e,t,r,n)}:t===null||r===null?null:{kind:"bounded",minYear:t,maxYear:r}}function rm(e,t){const r=[];for(let n=t;n>=e;n--)r.push(n);return r}const nm=e=>{const{value:t,initialDate:r,onChange:n,stepper:o,stepGlyph:a,children:i,minYear:l,maxYear:u,minDate:d,maxDate:m,allowedYears:x,className:L="",style:T,disabled:b=!1,locale:g,labels:w,formatLocale:h,formatOption:D,yearStartMonth:M}=e,v=gr("YearSelector",M);if(vo(t,"value",v,""),vo(r,"initialDate",v,""),vo(d,"minDate",v,al),vo(m,"maxDate",v,al),il(l,"minYear",v),il(u,"maxYear",v),sn("YearSelector","allowedYears",x),x!==void 0)for(let ae=0;ae<x.length;ae++)Gl(x[ae],`allowedYears[${ae}]`,v,"");h!==void 0&&Zo("YearSelector","formatLocale",h);const f=t??r;if(f===void 0)throw new RangeError("YearSelector: either value (controlled) or initialDate (uncontrolled) is required; the selected year is never inferred from the wall clock");o!==void 0&&gi("YearSelector",o,t!==void 0);const ue=li("YearSelector",a),K=zo(g,w),re=t!==void 0,[ee,B]=pi(f,re,ae=>Qo(ae,"year",v),ae=>Yo(ae,v)),ne=d?.getTime(),A=m?.getTime(),q=s.useMemo(()=>sl(l,d,Math.max,v),[l,ne,v]),j=s.useMemo(()=>sl(u,m,Math.min,v),[u,A,v]);if(q!==null&&j!==null&&q>j)throw new RangeError(`YearSelector: the resolved upper bound must not precede the resolved lower bound (lower: ${q}, upper: ${j})`);const k=x===void 0?null:x.map(ae=>ae.getTime()).join(","),$=s.useMemo(()=>tm(x,q,j,v),[k,q,j,v]);if($===null)throw new RangeError("YearSelector: a lower bound (minYear or minDate) and an upper bound (maxYear or maxDate), or allowedYears, are required; the option list is never invented");const H=s.useMemo(()=>$.kind==="discrete"?{kind:"candidates",ascending:$.ascending,loIndex:0,hiIndex:$.ascending.length-1}:{kind:"range",min:$.minYear,max:$.maxYear},[$]),Y=t!==void 0?Yo(t,v):ee,N=!In(H,Y),F=ae=>{if(!b){if(!In(H,ae))throw new RangeError(`YearSelector: refusing to emit ${ae}, which lies outside the selectable years`);re||B(ae),n?.(oi(ae,v),ae)}},G=Zt(H,Y,-1),he=Zt(H,Y,1),te=()=>{if(o!==void 0){o.onStep("previous");return}G!==null&&F(G)},le=()=>{if(o!==void 0){o.onStep("next");return}he!==null&&F(he)},Se=s.useMemo(()=>{const ae=$.kind==="discrete"?[...$.ascending].reverse():rm($.minYear,$.maxYear);return N&&(ae.push(Y),ae.sort((ie,pe)=>pe-ie)),ae.map(ie=>({value:ie,label:it("year",oi(ie,v),D,h)}))},[$,N,Y,v,h,D]);return C.jsxs("div",{className:`inline-flex items-center ${Tn} ${L}`,style:T,"data-out-of-range":N?"true":void 0,children:[C.jsx(Tr,{neighbour:"control",direction:"left",glyph:ue,disabled:b,canStep:o===void 0?G!==null:o.canStepPrevious,onStep:te,ariaLabel:K.previousYear}),C.jsx("select",{"aria-label":K.yearSelect,disabled:b,className:"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:Y,onChange:ae=>{if(!ae.target.value)return;const ie=Number(ae.target.value);Number.isInteger(ie)&&F(ie)},children:Se.map(ae=>C.jsx("option",{value:ae.value,disabled:N&&ae.value===Y,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:ae.label},ae.value))}),C.jsx(Tr,{neighbour:"control",direction:"right",glyph:ue,disabled:b,canStep:o===void 0?he!==null:o.canStepNext,onStep:le,ariaLabel:K.nextYear}),i]})},om=(e,t)=>{const r=ol(t.yearStartMonth);return!(ol(e.yearStartMonth)!==r||!hi(e,t,n=>Qo(n,"year",r))||e.disabled!==t.disabled||e.className!==t.className||e.style!==t.style||e.minYear!==t.minYear||e.maxYear!==t.maxYear||e.allowedYears!==t.allowedYears||e.onChange!==t.onChange||e.stepper===void 0!=(t.stepper===void 0)||e.value===void 0!=(t.value===void 0)||e.stepper?.onStep!==t.stepper?.onStep||e.stepper?.canStepPrevious!==t.stepper?.canStepPrevious||e.stepper?.canStepNext!==t.stepper?.canStepNext||e.stepGlyph!==t.stepGlyph||e.children!==t.children||e.locale!==t.locale||!Uo(e.labels,t.labels)||e.formatLocale!==t.formatLocale||e.formatOption!==t.formatOption)},Kl=s.memo(nm,om);Kl.displayName="YearSelector";exports.COLOR_SCHEME_PALETTES=hl;exports.DateSelector=Ul;exports.MonthSelector=Wl;exports.PERIOD_SLIDER_LABEL_CATALOGS=ml;exports.PERIOD_SLIDER_LABEL_KEYS=Fo;exports.PeriodSlider=Nl;exports.YearSelector=Kl;exports.addUnit=wl;exports.areStylesEqual=Al;exports.calculateConnectDragValues=Rl;exports.calculateHandleDragValues=Wa;exports.calculateKeyboardActionValues=Ml;exports.calculateLabelSlant=Pl;exports.calculateVernierMacroDrag=Tl;exports.calculateVernierMicroDrag=Cl;exports.decode=se;exports.encode=U;exports.findNearestDateIndex=Me;exports.formatLabel=it;exports.formatOptionText=Vl;exports.formatQuarterLabel=Nu;exports.formatScreenReaderLabel=Pr;exports.getMacroWindowEndDate=Sl;exports.getMacroWindowStartDate=vl;exports.getSortedAllowedDates=Vu;exports.normalizeDateByUnit=Rt;exports.resolveDraggedEdge=jo;exports.resolveMacroWindow=$t;exports.resolvePeriodSliderLabels=fl;exports.resolveQuarter=xl;exports.resolveSelectorSteps=Za;exports.resolveVernierRailZone=fi;exports.resolveVernierSelectorSteps=ur;exports.resolveVernierTargetHandle=$l;exports.resolveWheelStep=Ll;exports.usePeriodSliderPoint=Zd;exports.usePeriodSliderRange=Xd;exports.useSelectorStepper=jt;exports.useVernierSliderPoint=Jd;exports.useVernierSliderRange=Qd;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),Jc=require("date-fns"),s=require("react"),gr=require("@aiquants/virtualscroll"),eu=require("react-dom"),mi="an object that cannot be converted to a string",tu=3,ye=e=>{try{return e instanceof Date&&!Number.isNaN(Date.prototype.getTime.call(e))}catch{return!1}},Ot=e=>{try{return Array.isArray(e)}catch{return!1}},ru=e=>e===void 0||Ot(e);function an(e,t,r){if(!ru(r))throw new RangeError(`${e}: ${t} must be an array of Dates (received: ${R(r)})`)}const R=e=>{if(typeof e=="string")return JSON.stringify(e);if(ye(e))return Date.prototype.toISOString.call(e);if(Ot(e))return nu(e);try{return String(e)}catch{return mi}},nu=e=>{let t;try{t=e.length}catch{return mi}const r=Math.min(t,tu),n=[];for(let a=0;a<r;a++)n.push(ou(e,a));const o=t-r;return`[${n.join(", ")}${o>0?`, ... ${o} more`:""}]`},ou=(e,t)=>{try{if(!(t in e))return"empty";const r=e[t];return Ot(r)?`Array(${r.length})`:R(r)}catch{return mi}},$t=(e,t)=>ye(e)?t(e):Number.NaN,ft=(e,t)=>e===void 0?null:$t(e,t),$s=120,ka="data-drag-snap",Na="--ps-drag-snap-duration",En={flat:["--ps-drag-low","--ps-drag-high"],macro:["--ps-drag-macro-low","--ps-drag-macro-high"],micro:["--ps-drag-micro-low","--ps-drag-micro-high"]},bl=["low","high"],wl=["tx","ty","rot","leader-length","leader-angle"],Go={flat:{low:"--ps-drag-label-low",high:"--ps-drag-label-high"},macro:{low:"--ps-drag-macro-label-low",high:"--ps-drag-macro-label-high"},micro:{low:"--ps-drag-micro-label-low",high:"--ps-drag-micro-label-high"}},hi=(e,t)=>`${e}-${t}`,Pn=(e,t,r)=>`var(${hi(e,t)}, ${r})`,au=(e,t,r)=>{const n=Go[t];for(const o of bl)for(const a of wl)e.style.setProperty(hi(n[o],a),r[o][a])},vl=["pair-visibility","visibility","tx"],gi={flat:"--ps-drag-fold",macro:"--ps-drag-macro-fold",micro:"--ps-drag-micro-fold"},pi=(e,t)=>`${e}-${t}`,Oa=(e,t,r)=>`var(${pi(e,t)}, ${r})`,iu=(e,t,r)=>{const n=gi[t];for(const o of vl)e.style.setProperty(pi(n,o),r[o])},Sl=e=>Math.max(0,Math.min(1,e)),No=(e,t,r,n)=>{const o=Sl(t);if(e==="point")return[o,o];const a=e==="low"?n:r;return[Math.min(o,a),Math.max(o,a)]},bi=(e,t,r)=>{const n=r-t,o=Math.max(0,Math.min(1-n,t+e));return[o,o+n]},Ko=(e,t,r,n)=>{const o=Sl(t);return e==="low"?o>n?"high":"low":o<r?"low":"high"},Va=(e,t,r,n)=>{if(r){const i=(1-e)*100,l=(1-t)*100;return n?`M 12 ${l} L 12 ${i} L 20 100 L 20 0 Z`:`M 12 0 L 12 100 L 20 ${i} L 20 ${l} Z`}const o=e*100,a=t*100;return n?`M ${o} 12 L ${a} 12 L 100 20 L 0 20 Z`:`M 0 12 L 100 12 L ${a} 20 L ${o} 20 Z`},ur=(e,t)=>`var(${e}, ${t}%)`,su=(e,t,r,n)=>{const[o,a]=En[t];e.style.setProperty(o,`${r*100}%`),e.style.setProperty(a,`${n*100}%`)},lu=e=>{for(const[t,r]of Object.values(En))e.style.removeProperty(t),e.style.removeProperty(r);for(const t of Object.values(Go))for(const r of bl)for(const n of wl)e.style.removeProperty(hi(t[r],n));for(const t of Object.values(gi))for(const r of vl)e.style.removeProperty(pi(t,r))},cu=["transform","translate","scale","rotate","perspective","filter","backdrop-filter"],uu=["transform","translate","scale","rotate","perspective","filter"],du=["paint","layout","strict","content"],fu=["paint","strict","content"],mu=new Set(["hidden","clip","auto","scroll","overlay"]),hu=(e,t)=>{const r=e.getPropertyValue("position");if(t==="absolute"&&r!==""&&r!=="static"||cu.some(a=>!["","none"].includes(e.getPropertyValue(a)))||!["","normal"].includes(e.getPropertyValue("container-type")))return!0;const n=e.getPropertyValue("will-change");if(uu.some(a=>n.includes(a)))return!0;const o=e.getPropertyValue("contain");return du.some(a=>o.includes(a))},gu=e=>{const t=e.getPropertyValue("display");if(t==="contents"||t==="inline")return!1;if(mu.has(e.getPropertyValue("overflow-y")))return!0;const r=e.getPropertyValue("contain");return fu.some(n=>r.includes(n))},Ts=e=>{if(e.assignedSlot!==null)return e.assignedSlot;if(e.parentElement!==null)return e.parentElement;const t=e.parentNode;return t!==null&&t.nodeType===11&&"host"in t?t.host:null},pu=e=>{const t=e.ownerDocument,r=t.defaultView;if(r===null)return[];const n=[];let o=r.getComputedStyle(e).getPropertyValue("position");for(let a=Ts(e);a!==null&&a!==t.documentElement&&a!==t.body;a=Ts(a)){const i=r.getComputedStyle(a);(o==="absolute"||o==="fixed")&&!hu(i,o)||(gu(i)&&n.push(a),o=i.getPropertyValue("position"))}return n},bu=e=>{const t=e.getBoundingClientRect(),r="offsetHeight"in e&&typeof e.offsetHeight=="number"?e.offsetHeight:0,n=r>0?t.height/r:1,o=t.top+e.clientTop*n;return{top:o,bottom:o+e.clientHeight*n}},wu=(e,t,r)=>{const n=e.getBoundingClientRect(),o=e.ownerDocument.documentElement.clientHeight;if(!(n.height>0&&o>0))return null;const a=n.top+n.height/2;let i=0,l=o;for(const u of pu(e)){const f=bu(u);i=Math.max(i,f.top),l=Math.min(l,f.bottom)}return t?.isConnected&&(i=Math.max(i,t.getBoundingClientRect().bottom)),r?.isConnected&&(l=Math.min(l,r.getBoundingClientRect().top)),{topPx:Math.max(0,a-i),bottomPx:Math.max(0,l-a)}},vu=(e,t,r,n)=>{const o=e.ownerDocument.defaultView;if(o===null)return null;const a=e.getBoundingClientRect(),i=t.getBoundingClientRect();if(!(a.height>0&&i.height>0))return null;const l=a.top+a.height/2,u=Number.parseFloat(o.getComputedStyle(r).getPropertyValue(n==="top"?"bottom":"top"));if(!Number.isFinite(u))return null;const f=n==="top"?i.bottom-u:i.top+u;return{anchorPx:Math.abs(f-l),knobCentrePx:Math.abs(i.top+i.height/2-l)}},xl=["rangeStart","rangeEnd","selectedDate","macroRangeStart","macroRangeEnd","microRangeStart","microRangeEnd","microSelectedDate","decrease","increase","previousYear","nextYear","yearSelect","previousMonth","nextMonth","monthSelect","previousDay","nextDay","dateSelect","splitYear","splitMonth","splitDay"],qo=[...gr.VIRTUAL_SCROLL_LABEL_KEYS,...xl],Za=Object.freeze({en:Object.freeze({rangeStart:"Range start",rangeEnd:"Range end",selectedDate:"Selected date",macroRangeStart:"Macro range start",macroRangeEnd:"Macro range end",microRangeStart:"Micro range start",microRangeEnd:"Micro range end",microSelectedDate:"Micro selected date",decrease:"Decrease",increase:"Increase",previousYear:"Previous year",nextYear:"Next year",yearSelect:"Year",previousMonth:"Previous month",nextMonth:"Next month",monthSelect:"Month",previousDay:"Previous day",nextDay:"Next day",dateSelect:"Date",splitYear:"Year",splitMonth:"Month",splitDay:"Day"}),ja:Object.freeze({rangeStart:"期間の開始",rangeEnd:"期間の終了",selectedDate:"選択日",macroRangeStart:"広域期間の開始",macroRangeEnd:"広域期間の終了",microRangeStart:"詳細期間の開始",microRangeEnd:"詳細期間の終了",microSelectedDate:"詳細の選択日",decrease:"前へ",increase:"次へ",previousYear:"前年",nextYear:"翌年",yearSelect:"年",previousMonth:"前月",nextMonth:"翌月",monthSelect:"年月",previousDay:"前日",nextDay:"翌日",dateSelect:"日付",splitYear:"年",splitMonth:"月",splitDay:"日"})}),Rl=Object.freeze({en:Object.freeze({...gr.VIRTUAL_SCROLL_LABEL_CATALOGS.en,...Za.en}),ja:Object.freeze({...gr.VIRTUAL_SCROLL_LABEL_CATALOGS.ja,...Za.ja})}),Cs=e=>typeof e=="string"?JSON.stringify(e):e===null?"null":typeof e,Su=e=>qo.includes(e),xu=(e,t)=>{const r={};let n=!1;for(const o of gr.VIRTUAL_SCROLL_LABEL_KEYS){const a=t.has(o)?e[o]:void 0;a!==void 0&&(r[o]=a,n=!0)}return n?r:void 0},Ru=e=>{try{return gr.resolveVirtualScrollLocale(e)}catch(t){throw t instanceof RangeError?new RangeError(`[period-slider] locale is the UI language, not a BCP 47 tag (date formatting reads formatLocale): ${t.message}`,{cause:t}):t}},Ml=(e,t)=>{const r=Ru(e);if(t===void 0)return Rl[r];if(t===null||typeof t!="object")throw new RangeError(`[period-slider] labels must be an object; got ${Cs(t)}`);const n=Object.getPrototypeOf(t);if(n!==Object.prototype&&n!==null)throw new RangeError(`[period-slider] labels must be a plain object (prototype Object.prototype or null); got ${Array.isArray(t)?"an array":"an object with a non-plain prototype"}`);const o=new Set(Object.keys(t));for(const l of o)if(!Su(l))throw new RangeError(`[period-slider] labels.${l} is not a known label key; expected one of ${qo.join(", ")}`);const i={...gr.resolveVirtualScrollLabels(r,xu(t,o)),...Za[r]};for(const l of xl){const u=o.has(l)?t[l]:void 0;if(u!==void 0){if(typeof u!="string"||u.trim()==="")throw new RangeError(`[period-slider] labels.${l} must be a non-blank string; got ${Cs(u)}`);i[l]=u}}return Object.freeze(i)},Mu=e=>{const t={};for(const r of gr.VIRTUAL_SCROLL_LABEL_KEYS)t[r]=e[r];return Object.freeze(t)},Du=(e,t)=>e===t||qo.every(r=>e[r]===t[r]),Xo=(e,t)=>{if(e===t)return!0;if(e===void 0||t===void 0||e===null||t===null||typeof e!="object"||typeof t!="object")return!1;const r=new Set(Object.keys(e)),n=Object.keys(t);if(r.size!==n.length)return!1;const o=e,a=t;return n.every(i=>r.has(i)&&Object.is(o[i],a[i]))},_a=(e,t)=>e!==null&&t!==null&&"nodeType"in t&&e.contains(t),Is=new Set(["hidden","clip","scroll","auto","overlay"]),As=["paint","strict","content"],yu=["layout","paint","strict","content"],Eu=["transform","perspective","filter"],wn=e=>e!==void 0&&e!==""&&e!=="none",Pu=e=>e!==void 0&&e!==""&&e!=="normal",go=e=>{const t=Number.parseFloat(e??"");return Number.isFinite(t)?t:0},Lu=e=>e.position==="fixed"?"fixed":e.position==="absolute"?"absolute":null,$u=(e,t)=>t==="absolute"&&wn(e.position)&&e.position!=="static"||wn(e.transform)||wn(e.perspective)||wn(e.filter)||wn(e.backdropFilter)||Pu(e.containerType)||yu.some(r=>e.contain.includes(r))?!0:Eu.some(r=>e.willChange.includes(r)),Tu=(e,t,r,n,o,a)=>{const i=t.ownerDocument.defaultView;if(i===null)return!1;const l=e.getBoundingClientRect();if(l.width===0||l.height===0)return!1;const u=n?0:r,f=n?r:0;if(o<l.left-u||o>=l.right+u||a<l.top-f||a>=l.bottom+f)return!1;const m=i.getComputedStyle(t);if(m.visibility!=="visible")return!1;let S=null;for(let D=t;D!==null;D=D.parentElement){const E=D===t?m:i.getComputedStyle(D);if(S!==null&&!$u(E,S))continue;const j=Is.has(E.overflowX)||As.some(d=>E.contain.includes(d)),p=Is.has(E.overflowY)||As.some(d=>E.contain.includes(d));if(j||p){const d=D.getBoundingClientRect();if(j&&(o<d.left+go(E.borderLeftWidth)||o>=d.right-go(E.borderRightWidth))||p&&(a<d.top+go(E.borderTopWidth)||a>=d.bottom-go(E.borderBottomWidth)))return!1}S=Lu(E)}return!0},Ya=new Map,Cu=(e,t)=>{if(!(t.shiftKey&&t.cancelable))return;for(const o of e)if(o.ownsHit(t.target)){o.step(t);return}let r=null,n=Number.POSITIVE_INFINITY;for(const o of e){const a=o.distanceToRailPx(t.clientX,t.clientY);a===null||a>=n||(r=o,n=a)}r?.step(t)},Iu=(e,t)=>{let r=Ya.get(e);if(r===void 0){const a=new Set,i=l=>Cu(a,l);r={participants:a,listener:i},Ya.set(e,r),e.addEventListener("wheel",i,{passive:!1,capture:!0})}const{participants:n,listener:o}=r;return n.add(t),()=>{n.delete(t),!(n.size>0)&&(Ya.delete(e),e.removeEventListener("wheel",o,{capture:!0}))}},Tn="gap-[11px]",Au={single:1,double:2},Dn=6,$r=Dn*2,po=(e,t)=>{const r=Au[e],n=(r-1)*Dn+Dn*4/3,o=$r/2,a=Array.from({length:r},(l,u)=>{const f=u*Dn,m=f+Dn;return{left:`${f},${o} ${m},0 ${m},${$r}`,right:`${n-f},${o} ${n-m},0 ${n-m},${$r}`,up:`${o},${f} 0,${m} ${$r},${m}`,down:`${o},${n-f} 0,${n-m} ${$r},${n-m}`}[t]}),i=t==="up"||t==="down";return{widthPx:i?$r:n,heightPx:i?n:$r,triangles:a}},ks=e=>({left:po(e,"left"),right:po(e,"right"),up:po(e,"up"),down:po(e,"down")}),ku={single:ks("single"),double:ks("double")},wi=(e,t)=>{if(t===void 0)return"single";if(t==="single"||t==="double")return t;throw new RangeError(`${e}: stepGlyph must be "single" or "double" (received: ${R(t)})`)},Ha=e=>{e.preventDefault(),e.stopPropagation()},Nu={onMouseDownCapture:Ha,onMouseUpCapture:Ha,onClickCapture:Ha},Ou="period-slider-step",Vu=`${Ou} relative inline-flex size-[22px] shrink-0 items-center justify-center rounded-md after:absolute after:content-['']`,_u="transition-colors motion-reduce:transition-none not-aria-disabled:cursor-pointer aria-disabled:cursor-not-allowed focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 dark:focus-visible:ring-blue-400 forced-colors:not-aria-disabled:hover:text-[Highlight] forced-colors:aria-disabled:text-[GrayText]",Yu={control:"text-slate-500 not-aria-disabled:hover:bg-slate-500/15 not-aria-disabled:hover:text-slate-900 not-aria-disabled:active:bg-slate-500/25 aria-disabled:text-slate-500/40 dark:text-slate-400 dark:not-aria-disabled:hover:text-slate-50 dark:aria-disabled:text-slate-400/40",rail:"border border-slate-300 bg-white text-slate-700 shadow-2xs not-aria-disabled:hover:border-slate-400 not-aria-disabled:hover:bg-slate-100 not-aria-disabled:hover:text-slate-900 not-aria-disabled:active:bg-slate-200 aria-disabled:border-slate-300/40 aria-disabled:bg-white/40 aria-disabled:text-slate-700/40 aria-disabled:shadow-none dark:border-slate-700 dark:bg-slate-800 dark:text-slate-200 dark:not-aria-disabled:hover:border-slate-500 dark:not-aria-disabled:hover:bg-slate-700 dark:not-aria-disabled:hover:text-white dark:not-aria-disabled:active:bg-slate-600 dark:aria-disabled:border-slate-700/40 dark:aria-disabled:bg-slate-800/40 dark:aria-disabled:text-slate-200/40"},bo="after:inset-[calc((100%-var(--ps-target-size))/2)]",Ns={horizontal:"px-[19px]",vertical:"py-[19px]"},Hu={control:{left:bo,right:bo,up:bo,down:bo},rail:{left:"after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:left-[calc(100%-var(--ps-target-size)+4px)] after:-right-[4px]",right:"after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-left-[4px] after:right-[calc(100%-var(--ps-target-size)+4px)]",up:"after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-[calc(100%-var(--ps-target-size)+4px)] after:-bottom-[4px]",down:"after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-[4px] after:bottom-[calc(100%-var(--ps-target-size)+4px)]"}},Ar=({direction:e,glyph:t,neighbour:r,disabled:n,canStep:o,onStep:a,ariaLabel:i,className:l,ref:u})=>{const{widthPx:f,heightPx:m,triangles:S}=ku[t][e],D=n||!o;return P.jsx("button",{ref:u,type:"button","aria-label":i,disabled:n,"aria-disabled":D?!0:void 0,...D?Nu:null,onClick:D?void 0:a,className:`${l===void 0?"":`${l} `}${Vu} ${_u} ${Yu[r]} ${Hu[r][e]}`,children:P.jsx("svg",{"aria-hidden":"true",focusable:"false","data-arrow":e,"data-glyph":t,width:f,height:m,viewBox:`0 0 ${f} ${m}`,fill:"currentColor",className:"pointer-events-none block shrink-0",children:S.map(E=>P.jsx("polygon",{points:E},E))})})},Zo=(e,t)=>{const r=s.useMemo(()=>Ml(e,t),[e,t]),n=s.useRef(r);return Du(n.current,r)||(n.current=r),n.current},ut=(e,t,r)=>{if(!Number.isInteger(r))throw new RangeError(`${e}: ${t} must be a finite integer (received: ${R(r)})`)},br=(e,t)=>{if(t.kind==="range"){if(t.min!==null&&ut(e,"values.min",t.min),t.max!==null&&ut(e,"values.max",t.max),t.min!==null&&t.max!==null&&t.max<t.min)throw new RangeError(`${e}: values.max must not precede values.min (min: ${t.min}, max: ${t.max})`);return}ut(e,"values.loIndex",t.loIndex),ut(e,"values.hiIndex",t.hiIndex)},Fn=e=>e.kind==="candidates"&&e.hiIndex<e.loIndex,Qo=(e,t)=>{let r=e.loIndex,n=e.hiIndex+1;for(;r<n;){const o=r+n>>1;e.ascending[o]<t?r=o+1:n=o}return r},Cn=(e,t)=>(br("drawnValuesEdge",e),e.kind==="range"?t===-1?e.min:e.max:Fn(e)?null:e.ascending[t===-1?e.loIndex:e.hiIndex]),In=(e,t)=>{if(br("drawnValuesHas",e),ut("drawnValuesHas","value",t),e.kind==="range")return(e.min===null||t>=e.min)&&(e.max===null||t<=e.max);if(Fn(e))return!1;const r=Qo(e,t);return r<=e.hiIndex&&e.ascending[r]===t},An=(e,t)=>{if(br("drawnValuesNearest",e),ut("drawnValuesNearest","value",t),e.kind==="range")return e.min!==null&&t<e.min?e.min:e.max!==null&&t>e.max?e.max:t;if(Fn(e))return null;const r=Qo(e,t);if(r>e.hiIndex)return e.ascending[e.hiIndex];if(e.ascending[r]===t||r===e.loIndex)return e.ascending[r];const n=e.ascending[r-1],o=e.ascending[r];return t-n<=o-t?n:o},Qt=(e,t,r)=>{if(br("drawnValuesNeighbour",e),ut("drawnValuesNeighbour","value",t),e.kind==="range"){if(r===-1){const i=e.max===null?t-1:Math.min(t-1,e.max);return e.min!==null&&i<e.min?null:i}const a=e.min===null?t+1:Math.max(t+1,e.min);return e.max!==null&&a>e.max?null:a}if(Fn(e))return null;const n=Qo(e,t);if(r===-1){const a=n-1;return a<e.loIndex?null:e.ascending[a]}const o=n<=e.hiIndex&&e.ascending[n]===t?n+1:n;return o>e.hiIndex?null:e.ascending[o]},Eo=(e,t,r)=>{if(br("clampPairIntoDrawnValues",e),ut("clampPairIntoDrawnValues","low",t),ut("clampPairIntoDrawnValues","high",r),r<t)throw new RangeError(`clampPairIntoDrawnValues: high must not precede low (low: ${t}, high: ${r})`);const n=An(e,t),o=An(e,r);return n===null||o===null?null:[n,Math.max(n,o)]},ju=(e,t,r)=>{if(br("carryPairIntoDrawnValues",e),ut("carryPairIntoDrawnValues","low",t),ut("carryPairIntoDrawnValues","high",r),r<t)throw new RangeError(`carryPairIntoDrawnValues: high must not precede low (low: ${t}, high: ${r})`);if(Fn(e))return null;const n=Cn(e,-1),o=Cn(e,1),a=r-t;return o!==null&&r>o?Eo(e,o-a,o):n!==null&&t<n?Eo(e,n,n+a):Eo(e,t,r)},Po=(e,t,r)=>(br("drawnValuesAtOrBeyond",e),ut("drawnValuesAtOrBeyond","target",t),Qt(e,t-r,r)),sn=(e,t,r)=>{if(t!==null&&ut("drawnValuesWithin","min",t),r!==null&&ut("drawnValuesWithin","max",r),t!==null&&r!==null&&r<t)throw new RangeError(`drawnValuesWithin: max must not precede min (min: ${t}, max: ${r})`);const n={ascending:e,loIndex:0,hiIndex:e.length-1};let o=e.length;if(r!==null){let a=0;for(;a<o;){const i=a+o>>1;e[i]<=r?a=i+1:o=i}}return{kind:"candidates",ascending:e,loIndex:t===null?0:Qo(n,t),hiIndex:o-1}},Lo=e=>(br("drawnValuesStepGeometry",e),{stepEnd:(t,r)=>Qt(e,t,r),edge:t=>Cn(e,t)}),Qa=(e,t,r,n,o)=>{if(ut("stepPair","low",t),ut("stepPair","high",r),r<t)throw new RangeError(`stepPair: high must not precede low (low: ${t}, high: ${r})`);if(n!==-1&&n!==1)throw new RangeError(`stepPair: direction must be -1 or 1 (received: ${R(n)})`);switch(o.motion){case"shift":{if(o.edge!=="disable"&&o.edge!=="clamp")throw new RangeError(`stepPair: rule.edge must be "disable" or "clamp" (received: ${R(o.edge)})`);const a=n===1?r:t,i=n===1?t:r,l=e.stepEnd(i,n);if(l===null)return null;let u=e.stepEnd(a,n);if(u===null){const f=e.edge(n);if(o.edge==="disable"||f===null||(n===1?a>f:a<f))return null;u=f}return n===1?[l,u]:[u,l]}case"start":{const a=e.stepEnd(t,n);return a===null?null:[a,Math.max(r,a)]}case"end":{const a=e.stepEnd(r,n);return a===null?null:[Math.min(t,a),a]}case"single":{if(o.shows!=="start"&&o.shows!=="end")throw new RangeError(`stepPair: rule.shows must be "start" or "end" (received: ${R(o.shows)})`);const a=e.stepEnd(o.shows==="start"?t:r,n);return a===null?null:[a,a]}default:throw new RangeError(`stepPair: rule.motion must be one of "shift", "start", "end", "single" (received: ${R(o.motion)})`)}},Dl={"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"}},yl=e=>typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=11,Vt=(e,t)=>{if(!yl(t))throw new RangeError(`${e}: yearStartMonth must be an integer between 0 and 11 (received: ${R(t)})`)},wr=(e,t)=>t===void 0?0:(Vt(e,t),t),Te=(e,t,r)=>{if(r!=="year"&&r!=="month"&&r!=="day")throw new RangeError(`${e}: ${t} must be one of "year", "month", "day" (received: ${R(r)})`)},Jt=(e,t,r,n)=>r===void 0?n:(Te(e,t,r),r),Fu=[31,28,31,30,31,30,31,31,30,31,30,31],El=719468,$o=146097,Ja=(e,t)=>t!==1?Fu[t]:e%4===0&&(e%100!==0||e%400===0)?29:28,vi=(e,t,r,n)=>{const o=e*12+t+n,a=Math.floor(o/12),i=o-a*12;return[a,i,Math.min(r,Ja(a,i))]},kn=(e,t,r)=>{const n=t<2?e-1:e,o=Math.floor(n/400),a=n-o*400,i=t<2?t+10:t-2,l=Math.floor((153*i+2)/5)+r-1,u=a*365+Math.floor(a/4)-Math.floor(a/100)+l;return o*$o+u-El},Os=e=>{const t=e+El,r=Math.floor(t/$o),n=t-r*$o,o=Math.floor((n-Math.floor(n/1460)+Math.floor(n/36524)-Math.floor(n/($o-1)))/365),a=n-(o*365+Math.floor(o/4)-Math.floor(o/100)),i=Math.floor((5*a+2)/153),l=i<10?i+2:i-10;return[r*400+o+(l<2?1:0),l,a-Math.floor((153*i+2)/5)+1]},Jo=(e,t,r)=>e-(t<r?1:0),Rt=(e,t,r=0)=>{if(Te("normalizeDateByUnit","unit",e),!ye(t))throw new RangeError(`normalizeDateByUnit: d must be a valid Date (received: ${R(t)})`);Vt("normalizeDateByUnit",r);const n=new Date(t.getTime());return e==="year"?(n.setFullYear(Jo(n.getFullYear(),n.getMonth(),r),r,1),n.setHours(0,0,0,0)):(e==="month"&&n.setDate(1),n.setHours(0,0,0,0)),n},F=(e,t,r=0)=>{Te("encode","unit",e),Vt("encode",r);const n=Rt(e,t,r),o=n.getFullYear(),a=n.getMonth();return e==="year"?o:e==="month"?o*12+a:kn(o,a,n.getDate())},ne=(e,t,r=0)=>{Te("decode","unit",e),Vt("decode",r);const n=new Date(0);if(n.setHours(0,0,0,0),e==="year")return n.setFullYear(t,r,1),n;if(e==="month"){const a=Math.floor(t/12),i=t-a*12;return n.setFullYear(a,i,1),n}const o=new Date(t*24*60*60*1e3);return n.setFullYear(o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate()),n},Un=e=>`; ${e} instead of a sentinel for "no bound"`,Pl=Un("minDate is required, so pass the earliest date to offer"),Ze=(e,t,r,n,o,a)=>{const i=zn(r,n,o);if(i===null)throw new RangeError(`${e}: ${t} must fall in a ${n} that starts inside the Date range (received: ${R(r)})${a}`);return i},zn=(e,t,r)=>{const n=F(t,e,r);return Number.isInteger(n)?n:null},Ll=(e,t,r)=>{if(Te("addUnit","unit",e),!ye(t))throw new RangeError(`addUnit: d must be a valid Date (received: ${R(t)})`);if(!Number.isInteger(r))throw new RangeError(`addUnit: amount must be an integer number of units (received: ${R(r)})`);const n=new Date(t.getTime());return r===0?n:e==="year"||e==="month"?(n.setFullYear(...vi(n.getFullYear(),n.getMonth(),n.getDate(),e==="year"?r*12:r)),n):(n.setDate(n.getDate()+r),n)},Vs=(e,t,r,n,o)=>{const a=Math.floor(t/12),[i,l,u]=e==="year"?[t,o,1]:e==="month"?[a,t-a*12,1]:Os(t),[f,m,S]=r==="year"||r==="month"?vi(i,l,u,r==="year"?n*12:n):Os(kn(i,l,u)+n);return e==="year"?Jo(f,m,o):e==="month"?f*12+m:kn(f,m,S)},$l=(e,t,r,n=0)=>{if(Te("getMacroWindowStartDate","macroUnit",e),Te("getMacroWindowStartDate","microUnit",t),!ye(r))throw new RangeError(`getMacroWindowStartDate: d must be a valid Date (received: ${R(r)})`);return Vt("getMacroWindowStartDate",n),Ze("getMacroWindowStartDate","d",r,e,n,""),Ze("getMacroWindowStartDate","d",r,t,n,""),Rt(t,Rt(e,r,n),n)},Tl=(e,t,r,n=0)=>{if(Te("getMacroWindowEndDate","macroUnit",e),Te("getMacroWindowEndDate","microUnit",t),!ye(r))throw new RangeError(`getMacroWindowEndDate: d must be a valid Date (received: ${R(r)})`);Vt("getMacroWindowEndDate",n);let o;const a=new Date(r.getTime());if(e==="year"&&t!=="year"){const[l,u]=vi(Jo(a.getFullYear(),a.getMonth(),n),n,1,11);o=t==="month"?l*12+u:kn(l,u,Ja(l,u))}else if(e==="month"&&t==="day")o=kn(a.getFullYear(),a.getMonth(),Ja(a.getFullYear(),a.getMonth()));else return Ze("getMacroWindowEndDate","d",r,t,n,""),Rt(t,r,n);const i=ne(t,o,n);if(!ye(i))throw new RangeError(`getMacroWindowEndDate: d must fall in a ${e} whose last ${t} starts inside the Date range (received: ${R(r)})`);return i},_s=(e,t,r)=>e<t?t:e>r?r:e,Ct=(e,t,r,n,o,a=0)=>{if(Te("resolveMacroWindow","macroUnit",e),Te("resolveMacroWindow","microUnit",t),Vt("resolveMacroWindow",a),Vo("macroRange",r,!0,"resolveMacroWindow"),!ye(n))throw new RangeError(`resolveMacroWindow: minDate must be a valid Date (received: ${R(n)})`);if(!ye(o))throw new RangeError(`resolveMacroWindow: maxDate must be a valid Date (received: ${R(o)})`);if(o.getTime()<n.getTime())throw new RangeError(`resolveMacroWindow: maxDate must not precede minDate (minDate: ${R(n)}, maxDate: ${R(o)})`);Ze("resolveMacroWindow","maxDate",o,t,a,""),Ze("resolveMacroWindow","macroRange[0]",r[0],e,a,""),Ze("resolveMacroWindow","macroRange[0]",r[0],t,a,"");const i=F(e,r[1],a)<F(e,o,a)?_s(Tl(e,t,r[1],a),n,o):o;return[Rt(t,_s($l(e,t,r[0],a),n,o),a),Rt(t,i,a)]},Cl=(e,t)=>{if(!ye(e))throw new RangeError(`resolveQuarter: d must be a valid Date (received: ${R(e)})`);Vt("resolveQuarter",t);const r=Rt("year",e,t).getFullYear(),n=new Date(e.getTime()),o=((n.getMonth()-t)%12+12)%12,a=Math.floor(o/3)+1;return n.setFullYear(r,t+3*(a-1),1),n.setHours(0,0,0,0),{year:r,quarter:a,startDate:n}},Uu={year:{year:"numeric"},month:{year:"numeric",month:"2-digit"},day:{year:"numeric",month:"2-digit",day:"2-digit"}},Ys=new Map,zu=(e,t)=>{const r=`${e}\0${t}`,n=Ys.get(r);if(n!==void 0)return n;const o=new Intl.DateTimeFormat(t,Uu[e]);return Ys.set(r,o),o},Bu=4,Wu=6,ea=e=>e>=0?String(e).padStart(Bu,"0"):`-${String(-e).padStart(Wu,"0")}`,Gu=(e,t)=>{const r=new Date(t.getTime()),n=ea(r.getFullYear());if(e==="year")return n;const o=String(r.getMonth()+1).padStart(2,"0");if(e==="month")return`${n}-${o}`;const a=String(r.getDate()).padStart(2,"0");return`${n}-${o}-${a}`},_e=(e,t,r,n)=>(Te("formatLabel","unit",e),ye(t)?r?r(t,e,"period"):n===void 0?Gu(e,t):zu(e,n).format(t):""),Tr=(e,t,r,n)=>(Te("formatScreenReaderLabel","unit",e),_e(e,t,r,n)),Ku=(e,t)=>{if(!ye(e))return"";Vt("formatQuarterLabel",t);const{quarter:r}=Cl(e,t);return`${_e("year",Rt("year",e,t))}-Q${r}`},De=(e,t,r,n=0)=>{if(Te("findNearestDateIndex","unit",r),Vt("findNearestDateIndex",n),!e||e.length===0||e.length===1)return 0;if(!ye(t))throw new RangeError(`findNearestDateIndex: target must be a valid Date (received: ${R(t)})`);const o=Ze("findNearestDateIndex","target",t,r,n,"");let a=0,i=e.length-1;if(o<=F(r,e[a],n))return 0;if(o>=F(r,e[i],n))return i;for(;a<=i;){const f=a+i>>1,m=F(r,e[f],n);if(m===o)return f;m<o?a=f+1:i=f-1}const l=Math.abs(F(r,e[a],n)-o),u=Math.abs(F(r,e[i],n)-o);return l<u?a:i},qu=(e,t,r,n,o=0)=>(Te("getSortedAllowedDates","unit",t),pr("getSortedAllowedDates",ta(e),t,r,n,o).dates),ta=e=>({list:e,path:"allowedDates",inheritedBy:null}),pr=(e,t,r,n,o,a)=>{Vt(e,a);const{list:i,path:l}=t,u=t.inheritedBy===null?"":` (inherited by the ${t.inheritedBy} row)`;if(an(e,`${l}${u}`,i),i===void 0||i.length===0)return{keys:[],dates:[]};for(const[E,j]of[["minDate",n],["maxDate",o]])if(!ye(j))throw new RangeError(`${e}: ${E} must be a valid Date (received: ${R(j)})`);const f=Ze(e,"minDate",n,r,a,""),m=Ze(e,"maxDate",o,r,a,""),S=new Map;for(let E=0;E<i.length;E++){const j=i[E];if(!ye(j))throw new RangeError(`${e}: ${l}[${E}]${u} must be a valid Date (received: ${R(j)})`);const p=Ze(e,`${l}[${E}]${u}`,j,r,a,"");p<f||p>m||S.has(p)||S.set(p,Rt(r,j,a))}if(S.size===0)throw new RangeError(`${e}: every ${l} entry${u} falls outside [minDate, maxDate] (minDate: ${R(n)}, maxDate: ${R(o)}, entries: ${i.length})`);const D=Array.from(S.keys()).sort((E,j)=>E-j);return{keys:D,dates:D.map(E=>S.get(E))}},Si=(e,t,r,n,o,a)=>{const{keys:i,dates:l}=pr(e,t,r,n,o,a);return l.length===0?null:{...sn(i,null,null),dates:l}},Nn=(e,t)=>e===null?[]:e.dates.slice(t.loIndex,t.hiIndex+1),wo=(e,t,r,n,o)=>{const a=e.length-1;if(a<=0)return 0;const i=De(e,n,t,o);if(r==="time"){const l=e[0].getTime(),u=e[a].getTime()-l;return u<=0?0:Math.max(0,Math.min(1,(e[i].getTime()-l)/u))}return i/a},vo=(e,t,r,n,o)=>{const a=e.length-1;if(a<=0)return 0;const i=Math.max(0,Math.min(1,n));if(r==="time"){const l=e[0].getTime(),u=e[a].getTime()-l;return u<=0?0:De(e,new Date(l+i*u),t,o)}return Math.max(0,Math.min(a,Math.round(i*a)))},ei=(e,t,r,n,o,a,i)=>{let l=r,u=n;return i?(l=t,u=t):e==="low"?t>n?(l=n,u=t):l=t:t<r?(u=r,l=t):u=t,[Math.max(o,Math.min(a,l)),Math.max(o,Math.min(a,u))]},Il=({posDiffPct:e,startLowVal:t,startHighVal:r,rangeMin:n,rangeMax:o,isDiscrete:a,sortedAllowedDates:i,snapMode:l,unit:u,yearStartMonth:f=0})=>{if(Te("calculateConnectDragValues","unit",u),a){const p=i.length-1;if(p<=0)return[0,0];const d=Math.max(0,Math.min(p,Math.round(t))),g=Math.max(d,Math.min(p,Math.round(r)));if(l==="time"){const y=i[0].getTime(),x=i[p].getTime(),h=i[d].getTime(),oe=i[g].getTime()-h;let ce=h+e*(x-y),X=ce+oe;ce<y&&(ce=y,X=y+oe),X>x&&(X=x,ce=x-oe);const q=De(i,new Date(ce),u,f),I=De(i,new Date(X),u,f);return[q,Math.max(q,I)]}const N=Math.round(e*p);let _=d+N,$=g+N;return _<0&&($+=-_,_=0),$>p&&(_-=$-p,$=p),[Math.max(0,Math.min(p,_)),Math.max(0,Math.min(p,$))]}const m=p=>Math.max(n,Math.min(o,p)),S=o-n;if(S<=0)return[m(t),m(r)];const D=Math.round(e*S);let E=t+D,j=r+D;return E<n&&(j+=n-E,E=n),j>o&&(E-=j-o,j=o),[m(E),m(j)]},Al=(e,t,r,n,o,a,i,l)=>{let u=0,f=!1,m=!1;switch(e){case"ArrowRight":case"ArrowUp":u=l;break;case"ArrowLeft":case"ArrowDown":u=-l;break;case"PageUp":u=l*5;break;case"PageDown":u=-l*5;break;case"Home":f=!0;break;case"End":m=!0;break;default:return null}if(i){let E=r;return f?E=o:m?E=a:E=Math.max(o,Math.min(a,r+u)),[E,E]}let S=r,D=n;return t==="low"?f?S=o:m?S=n:S=Math.max(o,Math.min(n,r+u)):f?D=r:m?D=a:D=Math.max(r,Math.min(a,n+u)),[S,D]},kl=8,Nl=2,Ol=16,Xu=12,Zu=90,ra=(e,t,r)=>{const n=r*Math.PI/180,o=Math.abs(Math.sin(n)),a=Math.abs(Math.cos(n));return{alongPx:(e*a+t*o)/2,acrossPx:(e*o+t*a)/2}},Oo=e=>kl+(e?.anchorGapY??Nl),On=(e,t)=>{const r=t?.estimatedHeightPx??Ol,o=Oo(t)+r/2,a=e==="top"?-o:o;return{lowAngleDeg:0,highAngleDeg:0,lowOffsetX:0,highOffsetX:0,lowOffsetY:a,highOffsetY:a,isSlanted:!1,isFlipped:!1,proximity:0}},Qu=e=>{for(const t of["topPx","bottomPx"]){const r=e[t];if(typeof r!="number"||Number.isNaN(r)||r<0)throw new RangeError(`calculateLabelSlant: config.room.${t} must be a number of pixels, zero or more (Infinity for unbounded) (received: ${R(r)})`)}},Ju=(e,t,r)=>{if(r<=t/2)return 0;const n=Math.min(1,2*r/Math.hypot(e,t));return(Math.asin(n)-Math.atan2(t,e))*180/Math.PI},ed=(e,t,r,n,o,a,i,l)=>{if(i===void 0)return{side:t,angleDeg:e};const u=t==="top"?"bottom":"top",f=j=>j==="top"?i.topPx:i.bottomPx,m=j=>j===t?o:a,S=j=>m(j)+(1+l)*ra(r,n,e).acrossPx;if(S(t)<=f(t))return{side:t,angleDeg:e};if(S(u)<=f(u))return{side:u,angleDeg:e};const D=f(u)-m(u)>f(t)-m(t)?u:t,E=(f(D)-m(D))/(1+l);return{side:D,angleDeg:Math.min(e,Ju(r,n,E))}},Vl=(e,t,r,n)=>{if(!(Number.isFinite(r)&&r>0))return null;const o=n?.estimatedWidthPx;if(o===void 0||!Number.isFinite(o)||o<=0)return null;const a=n?.paddingPx??Xu;return{pixelDistance:Math.max(0,t-e)/100*r,threshold:o+a,labelWidthPx:o,paddingPx:a}},_l=(e,t,r,n="top",o)=>{const a=o?.estimatedHeightPx??Ol,i=o?.maxAngleDeg??Zu,l=o?.room,u=o?.drawnScale??1;if(l!==void 0&&Qu(l),typeof u!="number"||!Number.isFinite(u)||u<=0)throw new RangeError(`calculateLabelSlant: config.drawnScale must be a positive finite number (received: ${R(u)})`);const f=Oo(o),m=o?.flipClearancePx??f;if(typeof m!="number"||!Number.isFinite(m)||m<0)throw new RangeError(`calculateLabelSlant: config.flipClearancePx must be a finite number of pixels, zero or more (received: ${R(m)})`);const S=On(n,o),D=Vl(e,t,r,o);if(D===null)return S;const{pixelDistance:E,threshold:j,labelWidthPx:p,paddingPx:d}=D;if(E>=j)return S;const g=Math.max(0,Math.min(1,(j-E)/j)),N=g*g*g*(g*(g*6-15)+10),_=ed(N*i,n,p,a,f,m,l,u),$=_.angleDeg===0?0:_.side==="top"?-_.angleDeg:_.angleDeg,y=ra(p,a,_.angleDeg),x=(_.side===n?f:m)+y.acrossPx,h=_.side==="top"?-x:+x,oe=2*y.alongPx,ce=Math.max(0,(oe+d-E)/2);return{lowAngleDeg:$,highAngleDeg:$,lowOffsetX:-ce,highOffsetX:ce,lowOffsetY:h,highOffsetY:h,isSlanted:g>.001,isFlipped:_.side!==n,proximity:g}},td=e=>({...e,lowOffsetX:0,highOffsetX:0}),xi=(e,t,r,n)=>{if(!r.foldClosePairLabels||r.isMerged)return!1;const o=Vl(e,t,r.trackLengthPx,n);return o!==null&&o.pixelDistance<o.threshold},Ri=(e,t,r,n)=>{if(r.isMerged&&r.keepMergedLabelUpright||xi(e,t,r,n))return On(r.labelPosition,n);const o=_l(e,t,r.trackLengthPx,r.labelPosition,n);return r.isMerged?td(o):o},Ft=(e,t)=>(e==="macro"?t.macroIsDiscrete:t.microIsDiscrete)===!0,Tt=(e,t)=>{const r=e==="macro"?t.macroAllowedDates:t.microAllowedDates;return r!==void 0?{list:r,path:e==="macro"?"macroAllowedDates":"microAllowedDates",inheritedBy:null}:{list:t.allowedDates,path:"allowedDates",inheritedBy:e}},To=(e,t,r,n)=>e==="pan"?ju(t,r,Math.max(r,n)):Eo(t,r,Math.max(r,n)),Mi=(e,t)=>{const r=t==="macro-top"||t==="macro-left",n=e<0;return r&&n||!(r||n)?"macro":"micro"},Yl=(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 Hl(e,t,r,n,o,a,i="macro-top",l=.05,u=!0,f="range"){if(Mi(t,i)==="macro"){const D=Math.abs(e-r),E=Math.abs(e-n);return D<=l&&D<=E?"macro-low":E<=l&&E<D?"macro-high":u&&e>=r&&e<=n?"macro-connect":D<E?"macro-low":"macro-high"}if(f==="point")return"micro-point";const m=Math.abs(e-o),S=Math.abs(e-a);return m<=l&&m<=S?"micro-low":S<=l&&S<m?"micro-high":u&&e>=o&&e<=a?"micro-connect":m<S?"micro-low":"micro-high"}function jl(e,t,r,n,o){if(e==="macro-connect"){const[f,m]=bi(t-r,n,o);return[f,m,"macro-connect"]}const a=e==="macro-low"?"low":"high",[i,l]=No(a,t,n,o),u=Ko(a,t,n,o);return[i,l,u==="low"?"macro-low":"macro-high"]}function Fl(e,t,r,n,o){if(e==="micro-point"){const[f]=No("point",t,n,o);return[f,f,"micro-point"]}if(e==="micro-connect"){const[f,m]=bi(t-r,n,o);return[f,m,"micro-connect"]}const a=e==="micro-low"?"low":"high",[i,l]=No(a,t,n,o),u=Ko(a,t,n,o);return[i,l,u==="low"?"micro-low":"micro-high"]}const yn=s.memo(({type:e,isTop:t=!0,isVertical:r=!1,isLeft:n=!0})=>{let o,a;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",a=`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",a=`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 P.jsx("svg",{className:a,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:P.jsx("path",{d:o,className:i,shapeRendering:"geometricPrecision",strokeWidth:"1.25"})})});yn.displayName="VernierKnobSvg";const rd=(e,t,r,n)=>{if(!ye(e))throw new RangeError(`PeriodSlider: minDate is required and must be a valid Date (received: ${R(e)})`);if(!ye(t))throw new RangeError(`PeriodSlider: maxDate is required and must be a valid Date (received: ${R(t)})`);if(t.getTime()<=e.getTime())throw new RangeError(`PeriodSlider: maxDate must be strictly later than minDate (minDate: ${R(e)}, maxDate: ${R(t)})`);for(const o of r)Ze("PeriodSlider","minDate",e,o,n,Pl)},Vo=(e,t,r,n="PeriodSlider")=>{if(!Ot(t)||t.length!==2){const i=r?"is required and must":"must";throw new RangeError(`${n}: ${e} ${i} be a [start, end] Date tuple (received: ${R(t)})`)}const[o,a]=t;if(!ye(o))throw new RangeError(`${n}: ${e}[0] must be a valid Date (received: ${R(o)})`);if(!ye(a))throw new RangeError(`${n}: ${e}[1] must be a valid Date (received: ${R(a)})`);if(a.getTime()<o.getTime())throw new RangeError(`${n}: ${e} must not be inverted (start: ${R(o)}, end: ${R(a)})`)},Ul=(e,t)=>{if(!ye(t))throw new RangeError(`PeriodSlider: ${e} must be a valid Date (received: ${R(t)})`)},Zr=(e,t,r,n,o,a)=>{const i=Ze("PeriodSlider",e,t,r,a,"");if(i<F(r,n,a)||i>F(r,o,a))throw new RangeError(`PeriodSlider: ${e} must lie within [minDate, maxDate] (received: ${R(t)}, minDate: ${R(n)}, maxDate: ${R(o)})`)},nd=(e,t,r)=>{const n=e.yearStartMonth??0;if(e.mode==="range"){for(const o of["range","defaultRange"]){const a=e[o];a!==void 0&&(Vo(o,a,!1),Zr(`${o}[0]`,a[0],e.unit,t,r,n),Zr(`${o}[1]`,a[1],e.unit,t,r,n))}return}if(e.mode==="point")for(const o of["value","defaultValue"]){const a=e[o];a!==void 0&&(Ul(o,a),Zr(o,a,e.unit,t,r,n))}},od=(e,t,r)=>{const n=e.yearStartMonth??0;Vo("macroRange",e.macroRange,!0),Ze("PeriodSlider","macroRange[0]",e.macroRange[0],Jt("PeriodSlider","macroUnit",e.macroUnit,e.unit),n,"");const o=Jt("PeriodSlider","microUnit",e.microUnit,e.unit),a=e.microRange!==void 0||e.defaultMicroRange!==void 0||e.onChangeMicroRange!==void 0,i=e.microValue!==void 0||e.defaultMicroValue!==void 0||e.onChangeMicroPoint!==void 0;if(a&&i)throw new RangeError("PeriodSlider: vernier mode takes either a micro range (microRange / defaultMicroRange / onChangeMicroRange) or a micro point (microValue / defaultMicroValue / onChangeMicroPoint), never both");if(i){for(const f of["microValue","defaultMicroValue"]){const m=e[f];m!==void 0&&(Ul(f,m),Zr(f,m,o,t,r,n))}const u=e.microValue!==void 0?e.microValue:e.defaultMicroValue;if(u===void 0)throw new RangeError("PeriodSlider: vernier point mode requires a micro selection; supply microValue (controlled) or defaultMicroValue (uncontrolled)");return{shape:"point",selection:[u,u]}}for(const u of["microRange","defaultMicroRange"]){const f=e[u];f!==void 0&&(Vo(u,f,!1),Zr(`${u}[0]`,f[0],o,t,r,n),Zr(`${u}[1]`,f[1],o,t,r,n))}const l=e.microRange!==void 0?e.microRange:e.defaultMicroRange;if(l!==void 0)return{shape:"range",selection:l};throw a?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")},vn=(e,t,r,n,o,a,i,l,u)=>{const f=De(e,n,t,u),m=De(e,o,t,u);return i?f:l?m:Math.max(f,Math.min(m,De(e,r,t,u)+a))},ja=e=>{e.timerId!==null&&clearTimeout(e.timerId),e.timerId=null,e.emit=null};function ad(e,t){return t&&e[0].getTime()!==e[1].getTime()?[e[0],e[0]]:e}function id(e,t){return t?e==="micro-low"||e==="micro-high"||e==="micro-connect"?"micro-point":e:e==="micro-point"?"micro-high":e}const Hs=()=>{const[e,t]=s.useState(null),r=s.useRef(null),n=s.useCallback((a,i)=>{const l=r.current;if(l!==null&&l[0].getTime()===a.getTime()&&l[1].getTime()===i.getTime())return;const u=[a,i];r.current=u,t(u)},[]),o=s.useCallback(()=>{r.current!==null&&(r.current=null,t(null))},[]);return{shown:e,show:n,release:o}},na=(e,t,r)=>{try{Intl.DateTimeFormat.supportedLocalesOf([r])}catch{throw new RangeError(`${e}: ${t} must be a valid BCP 47 language tag (received: ${R(r)})`)}},sd=e=>{if(typeof e!="object"||e===null)return!1;try{return e.nodeType===1&&typeof e.getBoundingClientRect=="function"}catch{return!1}},js=(e,t)=>{if(t==null)return null;if(sd(t))return t;let r=!1;try{r=typeof t=="object"&&"current"in t}catch{r=!1}throw new RangeError(`PeriodSlider: ${e} must be an Element or null (received: ${R(t)})${r?"; pass the element itself (ref.current), not the ref object":""}`)},qr=()=>{const[e,t]=s.useState(null),r=s.useRef(null),n=s.useCallback(o=>{if(r.current?.disconnect(),r.current=null,o===null){t(null);return}if(typeof ResizeObserver>"u")return;const a=new ResizeObserver(i=>{for(const l of i){const u=l.borderBoxSize?.[0];u!==void 0&&t(f=>f!==null&&Math.abs(f.widthPx-u.inlineSize)<.5&&Math.abs(f.heightPx-u.blockSize)<.5?f:{widthPx:u.inlineSize,heightPx:u.blockSize})}});a.observe(o),r.current=a},[]);return s.useEffect(()=>()=>{r.current?.disconnect(),r.current=null},[]),[n,e]},Fs=(e,t)=>{const r=e.querySelector(`[data-handle-type^="${t}-"]`);if(r===null)return null;const n=r.querySelector("[data-tooltip-style]"),o=r.getAttribute("data-vernier-pos");return n===null||o!=="top"&&o!=="bottom"?null:vu(e,r,n,o)},ld=(e,t,r)=>{const n=wu(e,t,r);return n===null?null:{room:n,macro:Fs(e,"macro"),micro:Fs(e,"micro")}},cd=.5,_o=(e,t)=>e===t||Math.abs(e-t)<cd,Us=(e,t)=>e===null||t===null?e===t:_o(e.anchorPx,t.anchorPx)&&_o(e.knobCentrePx,t.knobCentrePx),ud=(e,t)=>e===null||t===null?e===t:_o(e.room.topPx,t.room.topPx)&&_o(e.room.bottomPx,t.room.bottomPx)&&Us(e.macro,t.macro)&&Us(e.micro,t.micro),dd=(e,t)=>Co(Io(e,t)),Co=e=>e===null?void 0:{estimatedWidthPx:e.widthPx,estimatedHeightPx:e.heightPx},Io=(e,t)=>e===null||t===null?null:{widthPx:Math.max(e.widthPx,t.widthPx),heightPx:Math.max(e.heightPx,t.heightPx)},fd=e=>{const t=new Map;let r=0;for(const a of e){const{side:i,box:l}=a;if(l===null)continue;let u;if(a.reach==="inline-size")u=l.widthPx,r=Math.max(r,l.heightPx/2);else{const m=ra(l.widthPx,l.heightPx,a.angleDeg);u=a.centreFromAnchorPx+m.acrossPx,r=Math.max(r,m.alongPx+Math.abs(a.alongPushPx))}const f=t.get(i);t.set(i,f===void 0?u:Math.max(f,u))}if(t.size===0)return;const n={};for(const[a,i]of t)n[`--ps-label-reach-${a}`]=`${Math.ceil(i)}px`;const o=Math.ceil(r);return n["--ps-label-reach-main"]=`${o}px`,{style:n,mainPx:o}},ti=(e,t,r)=>({"leader-length":`${r?Math.hypot(e,t):0}px`,"leader-angle":`${Math.atan2(t,e)*180/Math.PI}deg`}),zs=(e,t,r,n)=>({tx:`calc(-50% + ${e}px)`,ty:`${t}px`,rot:`${r}deg`,...n}),Fa=(e,t,r,n)=>({tx:`calc(-50% + ${e}px)`,ty:`calc(-50% + ${t}px)`,rot:`${r}deg`,...ti(e,t,n)}),Yo=(e,t)=>({"--ps-tooltip-tx":Pn(e,"tx",t.tx),"--ps-tooltip-ty":Pn(e,"ty",t.ty),"--ps-tooltip-rot":Pn(e,"rot",t.rot)}),Ho=(e,t)=>({"--ps-label-leader-length":Pn(e,"leader-length",t["leader-length"]),"--ps-label-leader-angle":Pn(e,"leader-angle",t["leader-angle"])}),zl=(e,t,r,n,o)=>{const a=gi[e],i={"pair-visibility":t?"hidden":"visible",visibility:t?"visible":"hidden",tx:`calc(-50% + ${r}px)`};return{pairStyle:{visibility:Oa(a,"pair-visibility",i["pair-visibility"])},foldStyle:{...o,"--ps-tooltip-tx":Oa(a,"tx",i.tx),"--ps-tooltip-ty":n,"--ps-tooltip-rot":"0deg",visibility:Oa(a,"visibility",i.visibility)},placement:i}},Ua=(e,t,r,n)=>{const o=md(n),a=o===null?n.config:o.config,i=On(n.labelPosition,a);if(!n.isSlantable)return{slant:i,lowStyle:void 0,highStyle:void 0,lowLeaderStyle:void 0,highLeaderStyle:void 0,centreFromAnchorPx:Math.abs(i.lowOffsetY)-Oo(a),placements:null,fold:null};const l=Ri(t*100,r*100,n,a),u=Go[e],f=o!==null&&l.isFlipped?o.oppositeAnchorPx:Oo(a),m=n.anchor===null?0:(n.labelPosition==="top"?-1:1)*n.anchor.knobCentrePx,S={low:zs(l.lowOffsetX,l.lowOffsetY-i.lowOffsetY,l.lowAngleDeg,ti(l.lowOffsetX,l.lowOffsetY-m,l.isFlipped)),high:zs(l.highOffsetX,l.highOffsetY-i.highOffsetY,l.highAngleDeg,ti(l.highOffsetX,l.highOffsetY-m,l.isFlipped))},D=n.foldClosePairLabels?zl(e,xi(t*100,r*100,n,a),(r-t)*n.trackLengthPx/2,"0px",{}):null;return{slant:l,lowStyle:{...Yo(u.low,S.low),...D===null?void 0:D.pairStyle},highStyle:{...Yo(u.high,S.high),...D===null?void 0:D.pairStyle},lowLeaderStyle:Ho(u.low,S.low),highLeaderStyle:Ho(u.high,S.high),centreFromAnchorPx:Math.abs(l.lowOffsetY)-f,placements:S,fold:D}},md=e=>e.config===void 0||e.anchor===null||e.opposite===null||e.room===void 0?null:{config:{...e.config,anchorGapY:e.anchor.anchorPx-kl,flipClearancePx:e.opposite.anchorPx+e.opposite.reachPx+Nl,room:e.room},oppositeAnchorPx:e.opposite.anchorPx},Bs=(e,t,r,n)=>{if(r.anchor===null||n===null)return null;const o=r.isSlantable?Ri(e*100,t*100,r,r.config).lowAngleDeg:0;return{anchorPx:r.anchor.anchorPx,reachPx:2*ra(n.widthPx,n.heightPx,o).acrossPx}},za={"--ps-tooltip-origin":"50% 50%"},Ws={"--ps-tooltip-origin":"100% 50%","--ps-tooltip-tx":"0px","--ps-tooltip-ty":"-50%","--ps-tooltip-rot":"0deg"},Gs=(e,t,r)=>{const n=On(r.labelPosition,r.config);if(r.isVertical)return{slant:n,lowStyle:Ws,highStyle:Ws,lowLeaderStyle:void 0,highLeaderStyle:void 0,placements:null,fold:null};const o=r.autoSlantLabels&&!r.isPointMode;let a=n;if(o){const f=r.config===void 0||r.room===void 0?r.config:{...r.config,room:r.room};a=Ri(e,t,r,f)}const i=Go.flat,l={low:Fa(a.lowOffsetX,a.lowOffsetY,a.lowAngleDeg,a.isFlipped),high:Fa(a.highOffsetX,a.highOffsetY,a.highAngleDeg,a.isFlipped)},u=o&&r.foldClosePairLabels?zl("flat",xi(e,t,r,r.config),(t-e)/100*r.trackLengthPx/2,Fa(0,n.lowOffsetY,0,!1).ty,za):null;return{slant:a,lowStyle:{...za,...Yo(i.low,l.low),...u===null?void 0:u.pairStyle},highStyle:{...za,...Yo(i.high,l.high),...u===null?void 0:u.pairStyle},lowLeaderStyle:o?Ho(i.low,l.low):void 0,highLeaderStyle:o?Ho(i.high,l.high):void 0,placements:o?l:null,fold:u}},hd={horizontal:{decrease:"left",increase:"right"},vertical:{decrease:"down",increase:"up"}},gd={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"}},Ks={horizontal:"px-[calc(var(--ps-target-size)/2)]",vertical:"py-[calc(var(--ps-target-size)/2)]"},pd={horizontal:{withSteppers:`grid-cols-[auto_minmax(0,1fr)_auto] ${Tn} ${Ns.horizontal}`,railOnly:`grid-cols-[minmax(0,1fr)] ${Ks.horizontal}`},vertical:{withSteppers:`grid-rows-[auto_minmax(0,1fr)_auto] ${Tn} ${Ns.vertical}`,railOnly:`grid-rows-[minmax(0,1fr)] ${Ks.vertical}`}},qs={horizontal:{leading:"col-start-1 row-start-1",rail:"col-start-2 row-start-1",railOnly:"col-start-1 row-start-1",trailing:"col-start-3 row-start-1"},vertical:{leading:"col-start-1 row-start-1",rail:"col-start-1 row-start-2",railOnly:"col-start-1 row-start-1",trailing:"col-start-1 row-start-3"}},Xs=(e,t)=>{e.setPointerCapture(t)},bd=e=>{const{unit:t,minDate:r,maxDate:n,allowedDates:o,snapMode:a="index",disabled:i=!1,className:l="",showStepper:u=!0,tooltipStyle:f="always",labelPosition:m="top",autoSlantLabels:S=!0,keepMergedLabelUpright:D=!1,foldClosePairLabels:E=!1,foldedPairLabelSeparator:j="〜",showLabelLeaderLines:p=!1,isVertical:d=!1,hideConnectBar:g=!1,showTicks:N=!1,colorScheme:_="blue-rose",formatLocale:$}=e;if(Te("PeriodSlider","unit",t),typeof j!="string")throw new RangeError(`PeriodSlider: foldedPairLabelSeparator must be a string (received: ${R(j)})`);const y=e.mode==="vernier"?Jt("PeriodSlider","macroUnit",e.macroUnit,t):t,x=e.mode==="vernier"?Jt("PeriodSlider","microUnit",e.microUnit,t):t,h=wr("PeriodSlider",e.yearStartMonth);rd(r,n,e.mode==="vernier"?[y,x,t]:[t],h),nd(e,r,n),$!==void 0&&na("PeriodSlider","formatLocale",$);const oe=js("labelCeiling",e.labelCeiling),ce=js("labelFloor",e.labelFloor),X=e.mode==="vernier"?od(e,r,n):null,q=X!==null&&X.shape==="point",I=Zo(e.locale,e.labels),Q=Dl[_],W=s.useId(),A=s.useRef(e),Y=r.getTime(),te=n.getTime(),T=e.mode==="vernier",C=s.useMemo(()=>T?[]:pr("PeriodSlider",ta(o),t,r,n,h).dates,[T,o,t,Y,te,h]),U=C.length>0,{rangeMin:z,rangeMax:ue}=s.useMemo(()=>U?{rangeMin:0,rangeMax:C.length-1}:{rangeMin:F(t,r,h),rangeMax:F(t,n,h)},[U,C,t,Y,te,h]),B=e.mode==="point",ie=s.useCallback(c=>{if(U){const b=Math.max(0,Math.min(C.length-1,Math.round(c)));return C[b]}return ne(t,Math.round(c),h)},[U,C,t,h]),xe=s.useCallback(c=>{if(c===void 0)return z;const b=Rt(t,c,h);return U?De(C,b,t,h):F(t,b,h)},[U,C,t,z,h]),[ae,se]=s.useState(()=>X===null?null:X.selection),pe=ae??(X===null?null:X.selection),Ne=pe===null?null:ad(pe,q);s.useLayoutEffect(()=>{Ne!==pe&&se(c=>c===ae?Ne:c)});const Mt=e.mode==="vernier"?e.microValue?.getTime():void 0,be=s.useMemo(()=>e.mode!=="vernier"||e.microValue===void 0?null:[e.microValue,e.microValue],[e.mode,Mt]),H=Hs(),ee=Hs(),de=e.mode!=="vernier"?null:q?be??Ne:e.microRange!==void 0?e.microRange:Ne,Ee=de===null?null:ee.shown??de,ve=e.mode==="range"?e.range?.[0]??e.defaultRange?.[0]:e.mode==="vernier"?Ee?.[0]:void 0,Ge=e.mode==="range"?e.range?.[1]??e.defaultRange?.[1]:e.mode==="vernier"?Ee?.[1]:void 0,je=e.mode==="point"?e.value??e.defaultValue:void 0,Ke=e.mode==="point"?je?.getTime():ve?.getTime(),mt=e.mode==="range"?Ge?.getTime():Ke,[le,it]=s.useMemo(()=>{if(e.mode==="point"){const w=xe(je);return[w,w]}const c=xe(ve),b=xe(Ge);return[Math.min(c,b),Math.max(c,b)]},[e.mode,Ke,mt,xe,je,ve,Ge]),Fe=e.mode==="point"?e.value!==void 0:e.mode==="range"?e.range!==void 0:q?e.microValue!==void 0:e.microRange!==void 0,[ht,Ye]=s.useState(()=>T?null:[le,it]),nt=ht??[le,it],[qe,gt]=s.useState(null),[Oe,It]=s.useState(null),k=s.useRef(null),[re,Ce]=s.useState("high"),[Xe,Ue]=s.useState(null),[Dt,er]=s.useState(null),Ve=qe?qe[0]:Fe?le:nt[0],L=qe?qe[1]:Fe?it:nt[1],fe=s.useRef([Ve,L]),we=e.mode==="vernier"?e.vernierOrientation??(d?"macro-left":"macro-top"):"macro-top",V=we==="macro-top"||we==="macro-left",M=e.mode==="vernier"?e.showVernierProjection??!0:!1,K=e.mode==="vernier"?e.showVernierTicks??!0:!1,me=e.mode==="vernier"?e.showHairline??!0:!1,Le=T?Ft("macro",e):U,Me=T?Ft("micro",e):U,ze=T?Tt("macro",e).list:o,Qe=T?Tt("micro",e).list:o,st=T?e.formatMacroLabel??e.formatLabel:e.formatLabel,vt=T?e.formatMicroLabel??e.formatLabel:e.formatLabel,Wn=ve?.getTime(),Gn=Ge?.getTime(),[pt,Kn]=s.useState(null),tr=s.useRef(null),[la,Nr]=s.useState(()=>q?"micro-point":"micro-high"),Je=id(la,q);s.useLayoutEffect(()=>{Je!==la&&Nr(c=>c===la?Je:c)});const St=s.useMemo(()=>F(y,r,h),[Y,y,h]),_t=s.useMemo(()=>F(y,n,h),[te,y,h]),qn=s.useMemo(()=>T&&Me?Si("PeriodSlider",Tt("micro",e),x,r,n,h):null,[T,Me,Qe,x,Y,te,h]),Ie=s.useMemo(()=>T&&Le?pr("PeriodSlider",Tt("macro",e),y,r,n,h).dates:[],[T,Le,ze,y,Y,te,h]),$i=c=>[Math.max(St,Math.min(_t,F(y,c[0],h))),Math.max(St,Math.min(_t,F(y,c[1],h)))],[Ti,Ci]=e.mode!=="vernier"?[St,_t]:$i(e.macroRange),[et,lt]=H.shown===null?[Ti,Ci]:$i(H.shown),rr=s.useMemo(()=>ne(y,et,h),[y,et,h]),nr=s.useMemo(()=>ne(y,lt,h),[y,lt,h]),Xn=s.useMemo(()=>e.mode!=="vernier"?[r,n]:Ct(y,x,[rr,nr],r,n,h),[e.mode,rr,nr,y,x,Y,te,h]),He=s.useMemo(()=>F(x,Xn[0],h),[x,Xn,h]),ot=s.useMemo(()=>F(x,Xn[1],h),[x,Xn,h]),ca=(c,b)=>qn===null?[]:Nn(qn,sn(qn.ascending,c,b)),Se=s.useMemo(()=>ca(He,ot),[qn,He,ot]),or=Le&&Ie.length>0,At=Me&&Se.length>0,Ii=or?F(y,Ie[0],h):St,Ai=or?F(y,Ie[Ie.length-1],h):_t,ki=At?F(x,Se[0],h):He,ua=At?F(x,Se[Se.length-1],h):ot,sc=Math.min(Ii,et),lc=Math.max(Ai,lt),ar=(c,b,w,v)=>b.length>0?F(x,b[De(b,c,x,h)],h):Math.max(w,Math.min(v,F(x,c,h))),Or=At?Se:[],Be=s.useMemo(()=>Ee===null?He:ar(Ee[0],Or,He,ot),[Wn,He,ot,x,Ee,Or]),at=s.useMemo(()=>Ee===null?ot:ar(Ee[1],Or,He,ot),[Gn,He,ot,x,Ee,Or]),vr=s.useMemo(()=>ne(x,Be,h),[x,Be,h]),Sr=s.useMemo(()=>ne(x,at,h),[x,at,h]),Ni=!T||de===null?null:{macroUnit:y,macroLowEnc:Ti,macroHighEnc:Ci,microUnit:x,microLowEnc:F(x,de[0],h),microHighEnc:F(x,de[1],h)},da=s.useRef(Ni),fa=Math.max(1,_t-St),yt=or?wo(Ie,y,a,rr,h):Math.max(0,Math.min(1,(et-St)/fa)),kt=Math.max(yt,or?wo(Ie,y,a,nr,h):Math.min(1,(lt-St)/fa)),Oi=c=>Math.max(Ii,Math.min(Ai,Math.round(St+c*fa))),Zn=Math.max(1,ot-He),xr=At?wo(Se,x,a,vr,h):Math.max(0,Math.min(1,(Be-He)/Zn)),Vr=Math.max(xr,At?wo(Se,x,a,Sr,h):Math.min(1,(at-He)/Zn)),ma=s.useRef({timerId:null,emit:null}),Qn=s.useRef({timerId:null,emit:null}),Jn=s.useRef({timerId:null,emit:null});s.useEffect(()=>{const c=[ma,Qn,Jn];return()=>{for(const b of c)ja(b.current)}},[]);const _r=s.useCallback((c,b,w)=>{ja(c);const{debounceMs:v}=A.current;if(w||!v||v<=0){b();return}c.emit=b,c.timerId=setTimeout(()=>{c.timerId=null,c.emit=null,b()},v)},[]),Vi=s.useCallback(c=>{const b=c.emit;ja(c),b?.()},[]),Yr=s.useCallback(c=>new Date(Math.min(Math.max(c.getTime(),Y),te)),[Y,te]),ir=s.useCallback((c,b,w=!1)=>{const[v,O]=fe.current;if((A.current.mode==="point"?c===v:c===v&&b===O)&&ma.current.timerId===null)return;const Z=ie(c),J=ie(b),ge=()=>{const Re=A.current;Re.mode==="point"?Re.onChangePoint?.(Z):Re.mode==="range"&&Re.onChangeRange?.(Z,J)};_r(ma.current,ge,w)},[ie,_r]),Rr=s.useCallback((c,b,w=!1)=>{const v=da.current;if(A.current.mode!=="vernier"||v===null)return;const O=Yr(c),G=Yr(b);F(v.macroUnit,O,h)===v.macroLowEnc&&F(v.macroUnit,G,h)===v.macroHighEnc&&Qn.current.timerId===null||_r(Qn.current,()=>{const Z=A.current;Z.mode==="vernier"&&Z.onChangeMacroRange?.(O,G)},w)},[Yr,_r,h]),Et=s.useCallback((c,b,w=!1)=>{const v=A.current,O=da.current;if(v.mode!=="vernier"||O===null)return;const G=Yr(c),Z=Yr(b);F(O.microUnit,G,h)===O.microLowEnc&&F(O.microUnit,Z,h)===O.microHighEnc&&Jn.current.timerId===null||((q?v.microValue===void 0:v.microRange===void 0)&&se([G,Z]),_r(Jn.current,()=>{const J=A.current;if(J.mode==="vernier"){if(q){J.onChangeMicroPoint?.(G);return}J.onChangeMicroRange?.(G,Z)}},w))},[Yr,_r,q,h]),_i=s.useCallback((c,b=!1)=>{Et(c,c,b)},[Et]),Mr=s.useCallback(c=>{if(U&&a==="time"&&C.length>1){const v=Math.max(0,Math.min(C.length-1,Math.round(c))),O=C[0].getTime(),Z=C[C.length-1].getTime()-O;if(Z<=0)return 0;const J=C[v].getTime();return Math.max(0,Math.min(100,(J-O)/Z*100))}const b=ue-z;if(b<=0)return 0;const w=(c-z)/b*100;return Math.max(0,Math.min(100,w))},[U,a,C,z,ue]),ha=s.useCallback(c=>{const b=Math.max(0,Math.min(100,c));if(U){if(a==="time"&&C.length>1){const O=C[0].getTime(),Z=C[C.length-1].getTime()-O,J=O+b/100*Z;return De(C,new Date(J),t,h)}const v=Math.round(b/100*(C.length-1));return Math.max(0,Math.min(C.length-1,v))}const w=z+b/100*(ue-z);return Math.round(w)},[U,a,C,z,ue,t,h]),ln=s.useRef(null),Yi=s.useRef(null),Hi=s.useRef(0),ct=s.useRef(null),ga=s.useRef(null),ji=s.useRef(null),Fi=s.useRef(null),[pa,Ui]=s.useState(0),[cc,eo]=qr(),[uc,zi]=qr(),[dc,fc]=qr(),[mc,hc]=qr(),[gc,Bi]=qr(),[pc,bc]=qr(),[wc,vc]=s.useState(null),ba=!d&&f!=="hover",Hr=ba?wc:null,Sc=B?Co(eo):dd(eo,zi),wa=!B&&Ve===L,va=et===lt,Sa=!q&&Be===at,xc=V?"top":"bottom",Rc=V?"bottom":"top",Wi=S&&!d,Mc=Wi&&!q,xa=Hr===null?void 0:Hr.room,Ra={isPointMode:B,isVertical:d,autoSlantLabels:S,isMerged:wa,keepMergedLabelUpright:D,foldClosePairLabels:E,trackLengthPx:pa,labelPosition:m,config:Sc,room:xa},Ma=Io(fc,hc),Da=q?Bi:Io(Bi,bc),Gi={trackLengthPx:pa,labelPosition:xc,config:Co(Ma),isMerged:va,keepMergedLabelUpright:D,foldClosePairLabels:E,isSlantable:Wi,room:xa,anchor:Hr===null?null:Hr.macro},Ki={trackLengthPx:pa,labelPosition:Rc,config:Co(Da),isMerged:Sa,keepMergedLabelUpright:D,foldClosePairLabels:E,isSlantable:Mc,room:xa,anchor:Hr===null?null:Hr.micro},ya={...Gi,opposite:Bs(xr,Vr,Ki,Da)},Ea={...Ki,opposite:Bs(yt,kt,Gi,Ma)};s.useEffect(()=>{const c=ct.current;if(!c)return;const b=()=>{const v=c.getBoundingClientRect(),O=d?v.height:v.width;O>0&&Ui(G=>Math.abs(G-O)<.5?G:O)};if(b(),typeof ResizeObserver<"u"){const v=new ResizeObserver(O=>{for(const G of O){const Z=d?G.contentRect.height:G.contentRect.width;Z>0&&Ui(J=>Math.abs(J-Z)<.5?J:Z)}});return v.observe(c),()=>v.disconnect()}const w=c.ownerDocument.defaultView;if(w)return w.addEventListener("resize",b),()=>w.removeEventListener("resize",b)},[d]);const jr=s.useCallback((c,b,w)=>{const v=d?w.height:w.width;if(!(Number.isFinite(v)&&v>0))return null;const O=d?w.bottom-b:c-w.left;return Number.isFinite(O)?Math.max(0,Math.min(1,O/v)):null},[d]),qi=s.useCallback((c,b)=>{const w=ct.current;if(!w)return null;const v=jr(c,b,w.getBoundingClientRect());return v===null?null:v*100},[jr]),cn=s.useRef(null),Wt=s.useRef(null),to=s.useRef({macroLowRatio:yt,macroHighRatio:kt,isVertical:d,isMacroFirstRail:V}),Xi=s.useRef({flat:Ra,macro:ya,micro:Ea}),Zi=s.useRef({ceiling:oe,floor:ce,isMeasured:ba});s.useLayoutEffect(()=>{to.current={macroLowRatio:yt,macroHighRatio:kt,isVertical:d,isMacroFirstRail:V},Xi.current={flat:Ra,macro:ya,micro:Ea},Zi.current={ceiling:oe,floor:ce,isMeasured:ba},A.current=e,fe.current=[Ve,L],da.current=Ni,k.current=Oe,tr.current=pt});const Qi=(c,b)=>{const w=to.current;ga.current?.setAttribute("d",Va(c,b,w.isVertical,w.isMacroFirstRail))},Dc=(c,b,w)=>{const v=Xi.current,O=c==="flat"?Gs(b*100,w*100,v.flat):Ua(c,b,w,c==="macro"?v.macro:v.micro);return{labels:O.placements,fold:O.fold===null?null:O.fold.placement}},un=s.useCallback(()=>{const c=ct.current,b=Zi.current;if(c===null||!b.isMeasured)return;const w=ld(c,b.ceiling,b.floor);vc(v=>ud(v,w)?v:w)},[]),dn=(c,b,w)=>{const v=ct.current;if(!v)return;cn.current={rail:c,lowRatio:b,highRatio:w},su(v,c,b,w);const O=Dc(c,b,w);O.labels!==null&&au(v,c,O.labels),O.fold!==null&&iu(v,c,O.fold),c==="macro"&&Qi(b,w)},Dr=s.useCallback(()=>{Wt.current!==null&&(clearTimeout(Wt.current),Wt.current=null);const c=ct.current;c&&(c.removeAttribute(ka),c.style.removeProperty(Na))},[]),Ji=()=>{const c=ct.current;if(cn.current===null||!c){cn.current=null;return}cn.current=null,Wt.current!==null&&clearTimeout(Wt.current),c.style.setProperty(Na,`${$s}ms`),c.setAttribute(ka,"true"),lu(c),Qi(to.current.macroLowRatio,to.current.macroHighRatio),Wt.current=setTimeout(()=>{Wt.current=null,c.removeAttribute(ka),c.style.removeProperty(Na)},$s)};s.useLayoutEffect(()=>{const c=cn.current;c!==null&&dn(c.rail,c.lowRatio,c.highRatio)}),s.useEffect(()=>()=>{Wt.current!==null&&clearTimeout(Wt.current)},[]);const Fr=s.useRef(null),Ur=s.useRef(null),Yt=s.useRef(null),Pa=s.useRef(null),fn=s.useRef(null),sr=s.useCallback(()=>Fr.current!==null||Ur.current!==null,[]),es=c=>{if(i)return;if(T){const he=Ur.current;if(!he||c.pointerId!==he.pointerId||!ct.current)return;const Nt=jr(c.clientX,c.clientY,ct.current.getBoundingClientRect());if(Nt===null)return;if(he.handle==="macro-low"||he.handle==="macro-high"||he.handle==="macro-connect"){const[tt,We,Gt]=jl(he.handle,Nt,he.startPointerRatio,he.startMacroLowRatio,he.startMacroHighRatio);dn("macro",tt,We),Gt!==tr.current&&(tr.current=Gt,Kn(Gt),Nr(Gt));let jt,xt,Kt;if(or){const qt=vo(Ie,y,a,tt,h),bn=Math.max(qt,vo(Ie,y,a,We,h));xt=Ie[qt],Kt=Ie[bn],jt=F(y,xt,h)}else jt=Oi(tt),xt=ne(y,jt,h),Kt=ne(y,Oi(We),h);H.show(xt,Kt);const cr=`${xt.getTime()}_${Kt.getTime()}`;cr!==Pa.current&&(Pa.current=cr,Rr(xt,Kt));const[pn,Zc]=Ct(y,x,[xt,Kt],r,n,h),mo=F(x,pn,h),ho=F(x,Zc,h),ys=Me?ca(mo,ho):[],Es={kind:"range",min:mo,max:ho};let Pr,Lr;if(he.handle==="macro-connect"){const qt=jt-he.startMacroLowEnc,bn=To("pan",Es,Vs(x,he.initialMicroLowEnc,y,qt,h),Vs(x,he.initialMicroHighEnc,y,qt,h));if(bn===null)return;Pr=ne(x,bn[0],h),Lr=ne(x,bn[1],h)}else{const qt=To("resize",Es,he.initialMicroLowEnc,he.initialMicroHighEnc);if(qt===null)return;Pr=ne(x,qt[0],h),Lr=ne(x,qt[1],h)}const Ps=ar(Pr,ys,mo,ho),Qc=Math.max(Ps,ar(Lr,ys,mo,ho));Pr=ne(x,Ps,h),Lr=ne(x,Qc,h),ee.show(Pr,Lr);const Ls=`${Pr.getTime()}_${Lr.getTime()}`;Ls!==fn.current&&(fn.current=Ls,Et(Pr,Lr))}else if(he.handle==="micro-low"||he.handle==="micro-high"||he.handle==="micro-connect"||he.handle==="micro-point"){const[tt,We,Gt]=Fl(he.handle,Nt,he.startPointerRatio,he.startMicroLowRatio,he.startMicroHighRatio);dn("micro",tt,We),Gt!==tr.current&&(tr.current=Gt,Kn(Gt),Nr(Gt));let jt,xt;if(At){const cr=vo(Se,x,a,tt,h),pn=Math.max(cr,vo(Se,x,a,We,h));jt=Se[cr],xt=Se[pn]}else{const cr=ar(ne(x,Math.round(He+tt*Zn),h),Or,He,ot),pn=Math.max(cr,ar(ne(x,Math.round(He+We*Zn),h),Or,He,ot));jt=ne(x,cr,h),xt=ne(x,pn,h)}ee.show(jt,xt);const Kt=`${jt.getTime()}_${xt.getTime()}`;Kt!==fn.current&&(fn.current=Kt,Et(jt,xt))}return}const b=Fr.current;if(!b||c.pointerId!==b.pointerId||!ct.current)return;const w=ct.current.getBoundingClientRect(),v=d?c.clientY:c.clientX,O=d?w.height:w.width;if(!(Number.isFinite(O)&&O>0))return;if(b.handle==="connect"){const he=d?(b.startPointerPos-v)/O:(v-b.startPointerPos)/O,[Nt,tt]=bi(he,b.startLowRatio,b.startHighRatio);dn("flat",Nt,tt);const We=Il({posDiffPct:he,startLowVal:b.startLowVal,startHighVal:b.startHighVal,rangeMin:z,rangeMax:ue,isDiscrete:U,sortedAllowedDates:C,snapMode:a,unit:t,yearStartMonth:h});if(Yt.current&&Yt.current[0]===We[0]&&Yt.current[1]===We[1])return;Yt.current=We,gt(We),ir(We[0],We[1],!1);return}const G=jr(c.clientX,c.clientY,w);if(G===null)return;const[Z,J]=No(B?"point":b.handle,G,b.startLowRatio,b.startHighRatio);dn("flat",Z,J);const ge=ha(G*100),[Re,Ae]=ei(b.handle,ge,b.startLowVal,b.startHighVal,z,ue,B);if((!Yt.current||Yt.current[0]!==Re||Yt.current[1]!==Ae)&&(Yt.current=[Re,Ae],gt([Re,Ae]),ir(Re,Ae,!1)),!B&&(b.handle==="low"||b.handle==="high")){const he=Ko(b.handle,G,b.startLowRatio,b.startHighRatio);k.current!==he&&(k.current=he,It(he),Ce(he))}},ts=()=>{Ji(),Pa.current=null,fn.current=null,Ur.current=null,tr.current=null,Kn(null),H.release(),ee.release(),Vi(Qn.current),Vi(Jn.current)},rs=()=>{Ji();const c=Yt.current??qe;c&&(ir(c[0],c[1],!0),Ye(c)),Yt.current=null,gt(null),Fr.current=null,k.current=null,It(null)},ns=c=>{if(T){const w=Ur.current;if(!w||c.pointerId!==w.pointerId)return;ts();return}const b=Fr.current;!b||c.pointerId!==b.pointerId||rs()},os=()=>{Ur.current!==null&&ts(),Fr.current!==null&&rs()},La=s.useRef(es),as=s.useRef(ns),is=s.useRef(os);s.useLayoutEffect(()=>{La.current=es,as.current=ns,is.current=os});const ss=s.useRef(T);s.useEffect(()=>{ss.current!==T&&(ss.current=T,is.current())},[T]);const $a=Oe!==null||pt!==null;s.useEffect(()=>{if(!$a)return;const c=ln.current?.ownerDocument.defaultView;if(!c)return;const b=v=>La.current(v),w=v=>as.current(v);return c.addEventListener("pointermove",b),c.addEventListener("pointerup",w),c.addEventListener("pointercancel",w),c.addEventListener("lostpointercapture",w),()=>{c.removeEventListener("pointermove",b),c.removeEventListener("pointerup",w),c.removeEventListener("pointercancel",w),c.removeEventListener("lostpointercapture",w)}},[$a]);const Ta=s.useCallback((c,b,w,v)=>{Dr(),Xs(c,b),Ue(null),er(null),un(),Fr.current={pointerId:b,handle:w,startPointerPos:v,startLowVal:Ve,startHighVal:L,startLowRatio:Mr(Ve)/100,startHighRatio:Mr(L)/100},k.current=w,It(w),w!=="connect"&&Ce(w)},[Ve,L,Mr]),ls=s.useCallback((c,b,w,v)=>{A.current.mode==="vernier"&&(Dr(),Xs(c,b),un(),Ur.current={pointerId:b,handle:w,startPointerRatio:v,startMacroLowRatio:yt,startMacroHighRatio:kt,startMicroLowRatio:xr,startMicroHighRatio:Vr,startMacroLowEnc:et,initialMicroLowEnc:Be,initialMicroHighEnc:at},tr.current=w,Kn(w),Nr(w))},[yt,kt,xr,Vr,et,Be,at]),cs=c=>b=>{if(i||sr())return;b.stopPropagation(),b.preventDefault(),Ce(c);const w=d?b.clientY:b.clientX;Ta(b.currentTarget,b.pointerId,c,w)},us=c=>()=>{i||k.current!==null||Ce(c)},ro=c=>()=>{i||tr.current!==null||Nr(c)},zr=c=>b=>{if(i||sr())return;b.stopPropagation(),b.preventDefault();const w=ct.current;if(!w)return;const v=jr(b.clientX,b.clientY,w.getBoundingClientRect());v!==null&&ls(b.currentTarget,b.pointerId,c,v)},yc=c=>{if(i||g||sr())return;c.stopPropagation(),c.preventDefault();const b=d?c.clientY:c.clientX;Ta(c.currentTarget,c.pointerId,"connect",b)},Ec=c=>{if(i||sr())return;if(T){const J=ct.current;if(!J)return;const ge=J.getBoundingClientRect(),Re=jr(c.clientX,c.clientY,ge);if(Re===null)return;const Ae=d?c.clientX-(ge.left+ge.width/2):c.clientY-(ge.top+ge.height/2),he=Hl(Re,Ae,yt,kt,xr,Vr,we,void 0,!g,q?"point":"range");ls(c.currentTarget,c.pointerId,he,Re),La.current(c.nativeEvent);return}const b=qi(c.clientX,c.clientY);if(b===null)return;const w=ha(b);let v="low";if(!B){const J=Math.abs(w-Ve),ge=Math.abs(w-L);J<ge?v="low":ge<J?v="high":v=w>L?"high":"low"}Ce(v);const[O,G]=ei(v,w,Ve,L,z,ue,B);gt([O,G]),ir(O,G,!0);const Z=d?c.clientY:c.clientX;Ta(c.currentTarget,c.pointerId,v,Z)},Pc=c=>{if(i||T||Oe!==null)return;const b=qi(c.clientX,c.clientY);if(b===null)return;const w=ha(b);Ue(w),er(Mr(w))},Lc=()=>{Ue(null),er(null)},ds=c=>b=>{if(i||sr())return;Ce(c);const w=Al(b.key,c,Ve,L,z,ue,B,1);w&&(b.preventDefault(),Dr(),Fe||Ye(w),ir(w[0],w[1],!0))},Br=(c,b,w)=>{if(de===null)return;const[v,O]=Ct(y,x,[c,b],r,n,h),G=F(x,v,h),Z=F(x,O,h),J=Me?ca(G,Z):[],ge=To(w,{kind:"range",min:G,max:Z},F(x,de[0],h),F(x,de[1],h));if(ge===null)return;const Re=ar(ne(x,ge[0],h),J,G,Z),Ae=Math.max(Re,ar(ne(x,ge[1],h),J,G,Z));Et(ne(x,Re,h),ne(x,Ae,h),!0)},no=c=>b=>{if(i||!T||e.mode!=="vernier"||sr())return;Nr(c);let w=0,v=!1,O=!1;switch(b.key){case"ArrowRight":case"ArrowUp":w=1;break;case"ArrowLeft":case"ArrowDown":w=-1;break;case"PageUp":w=5;break;case"PageDown":w=-5;break;case"Home":v=!0;break;case"End":O=!0;break;default:return}if(b.preventDefault(),Dr(),c==="macro-low"){const G=ne(y,et,h),Z=ne(y,lt,h);if(or){const Re=vn(Ie,y,G,Ie[0],Z,w,v,O,h);if(Re===De(Ie,G,y,h))return;const Ae=Ie[Re];Rr(Ae,Z,!0),Br(Ae,Z,"resize");return}let J;if(v?J=St:O?J=lt:J=Math.max(St,Math.min(lt,et+w)),J===et)return;const ge=ne(y,J,h);Rr(ge,Z,!0),Br(ge,Z,"resize")}else if(c==="macro-high"){const G=ne(y,et,h),Z=ne(y,lt,h);if(or){const Re=vn(Ie,y,Z,G,Ie[Ie.length-1],w,v,O,h);if(Re===De(Ie,Z,y,h))return;const Ae=Ie[Re];Rr(G,Ae,!0),Br(G,Ae,"resize");return}let J;if(v?J=et:O?J=_t:J=Math.max(et,Math.min(_t,lt+w)),J===lt)return;const ge=ne(y,J,h);Rr(G,ge,!0),Br(G,ge,"resize")}else if(c==="micro-low"){const G=ne(x,Be,h),Z=ne(x,at,h);if(At){const ge=vn(Se,x,G,Se[0],Z,w,v,O,h);if(ge===De(Se,G,x,h))return;Et(Se[ge],Z,!0);return}let J;if(v?J=He:O?J=at:J=Math.max(He,Math.min(at,Be+w)),J===Be)return;Et(ne(x,J,h),Z,!0)}else if(c==="micro-high"){const G=ne(x,Be,h),Z=ne(x,at,h);if(At){const ge=vn(Se,x,Z,G,Se[Se.length-1],w,v,O,h);if(ge===De(Se,Z,x,h))return;Et(G,Se[ge],!0);return}let J;if(v?J=Be:O?J=ot:J=Math.max(Be,Math.min(ot,at+w)),J===at)return;Et(G,ne(x,J,h),!0)}else if(c==="micro-point"){const G=ne(x,Be,h);if(At){const J=vn(Se,x,G,Se[0],Se[Se.length-1],w,v,O,h);if(J===De(Se,G,x,h))return;_i(Se[J],!0);return}let Z;if(v?Z=He:O?Z=ot:Z=Math.max(He,Math.min(ot,Be+w)),Z===Be)return;_i(ne(x,Z,h),!0)}},$c=c=>{if(e.mode!=="vernier")return;if(Dr(),or){const Z=Ie.length-1,J=De(Ie,rr,y,h),ge=De(Ie,nr,y,h),Re=ge-J;let Ae=J+c,he=ge+c;if(c<0&&Ae<0?(Ae=0,he=Math.min(Z,Re)):c>0&&he>Z&&(he=Z,Ae=Math.max(0,Z-Re)),Ae===J&&he===ge)return;const Nt=Ie[Ae],tt=Ie[he];Rr(Nt,tt,!0),Br(Nt,tt,"pan");return}const b=lt-et;let w=et+c,v=lt+c;if(c<0&&w<St?(w=St,v=Math.min(_t,w+b)):c>0&&v>_t&&(v=_t,w=Math.max(St,v-b)),w===et&&v===lt)return;const O=ne(y,w,h),G=ne(y,v,h);Rr(O,G,!0),Br(O,G,"pan")},Ca=s.useCallback(c=>{const b=A.current;if(!(b.disabled||sr()))if(Dr(),b.mode==="point"){const w=Math.max(z,Math.min(ue,Ve+c));Fe||Ye([w,w]),ir(w,w,!0)}else if(b.mode==="vernier"){if(At){const Re=Se.length-1,Ae=De(Se,vr,x,h),he=De(Se,Sr,x,h),Nt=he-Ae;let tt=Ae+c,We=he+c;c<0&&tt<0?(tt=0,We=Math.min(Re,Nt)):c>0&&We>Re&&(We=Re,tt=Math.max(0,Re-Nt)),(tt!==Ae||We!==he)&&Et(Se[tt],Se[We],!0);return}const w=Be,v=at,O=He,G=ot,Z=v-w;let J=w+c,ge=v+c;c<0&&J<O?(J=O,ge=Math.min(G,J+Z)):c>0&&ge>G&&(ge=G,J=Math.max(O,ge-Z)),(J!==w||ge!==v)&&Et(ne(x,J,h),ne(x,ge,h),!0)}else{const w=L-Ve;let v=Ve+c,O=L+c;c<0&&v<z?(v=z,O=Math.min(ue,v+w)):c>0&&O>ue&&(O=ue,v=Math.max(z,O-w)),v<=O&&(Fe||Ye([v,O]),ir(v,O,!0))}},[Ve,L,z,ue,Fe,ir,Et,Be,at,He,ot,x,At,Se,vr,Sr,Dr,h]),fs=c=>!i&&_a(ln.current,c),ms=(c,b)=>{const w=Yi.current,v=ct.current,O=ln.current;if(i||w===null||v===null||O===null||!Tu(w,O,Hi.current,d,c,b))return null;const G=v.getBoundingClientRect();return Math.abs(d?c-(G.left+G.width/2):b-(G.top+G.height/2))},hs=c=>{if(i||sr())return;const b=Yl(c.deltaX,c.deltaY,d);if(b===0)return;c.preventDefault();const w=c.target,v=_a(ji.current,w)||_a(Fi.current,w);if(!T||v){Ca(b);return}const O=ct.current;if(!O)return;const G=O.getBoundingClientRect(),Z=d?c.clientX-(G.left+G.width/2):c.clientY-(G.top+G.height/2);if(Mi(Z,we)==="macro"){$c(b);return}Ca(b)},oo=s.useRef({ownsWheelHit:fs,distanceToRailPx:ms,stepFromRangeAreaWheel:hs});s.useLayoutEffect(()=>{oo.current={ownsWheelHit:fs,distanceToRailPx:ms,stepFromRangeAreaWheel:hs}});const mn=s.useRef(null);s.useEffect(()=>{const c=ln.current?.ownerDocument.defaultView??null,b=mn.current;if(b!==null&&b.view===c)return;if(b?.unregister(),c===null){mn.current=null;return}const w=Iu(c,{ownsHit:v=>oo.current.ownsWheelHit(v),distanceToRailPx:(v,O)=>oo.current.distanceToRailPx(v,O),step:v=>oo.current.stepFromRangeAreaWheel(v)});mn.current={view:c,unregister:w}}),s.useEffect(()=>()=>{mn.current?.unregister(),mn.current=null},[]);const ao=Mr(Ve),io=Mr(L),so=ie(Ve),lo=ie(L),yr=Gs(ao,io,Ra),lr=yr.slant,hn=Oe==="low"||Oe!=="high"&&re==="low",gn=!B&&(Oe==="high"||Oe!=="low"&&re==="high"),Tc=va&&Je!=="macro-low",Cc=va&&Je==="macro-low",Ic=Sa&&Je!=="micro-low",Ac=Sa&&Je==="micro-low",bt=Ua("macro",yt,kt,ya),wt=Ua("micro",xr,Vr,Ea),gs=yr.slant.isSlanted||bt.slant.isSlanted||wt.slant.isSlanted;s.useLayoutEffect(()=>{gs&&un()});const ps=gs||$a;s.useEffect(()=>{if(!ps)return;const c=ct.current,b=c===null?null:c.ownerDocument.defaultView;if(c===null||b===null)return;const w=c.ownerDocument;let v=null;const O=()=>{v===null&&(v=b.requestAnimationFrame(()=>{v=null,un()}))};w.addEventListener("scroll",O,{capture:!0,passive:!0}),b.addEventListener("resize",O);const G=typeof ResizeObserver>"u"?null:new ResizeObserver(O);for(const Z of[oe,ce])Z!==null&&G?.observe(Z);return()=>{w.removeEventListener("scroll",O,{capture:!0}),b.removeEventListener("resize",O),G?.disconnect(),v!==null&&b.cancelAnimationFrame(v)}},[ps,oe,ce,un]);const kc=Math.min(ao,io),Nc=Math.max(ao,io),[bs,ws]=En.flat,[Oc,Vc]=En.macro,[_c,Yc]=En.micro,vs=ur(bs,ao),Ss=ur(ws,io),Ia=ur(bs,kc),xs=`calc(${ur(ws,Nc)} - ${Ia})`,Wr=ur(Oc,yt*100),co=ur(Vc,kt*100),Gr=ur(_c,xr*100),uo=ur(Yc,Vr*100),Hc=d?{bottom:Ia,height:xs,top:"auto",left:"0",right:"0"}:{left:Ia,width:xs,top:"0",bottom:"0"},jc=Math.max(.01,kt-yt),Rs=Math.max(.06,Math.min(.25,.28*Math.sqrt(jc))),Fc=d?{bottom:vs,left:"50%",transform:"translate(-50%, 50%)",zIndex:hn?40:30}:{left:vs,top:"50%",transform:"translate(-50%, -50%)",zIndex:hn?40:30},Uc=d?{bottom:Ss,left:"50%",transform:"translate(-50%, 50%)",zIndex:gn?40:30}:{left:Ss,top:"50%",transform:"translate(-50%, -50%)",zIndex:gn?40:30},zc=d?{bottom:`${Dt}%`,left:"50%",transform:"translate(-50%, 50%)"}:{left:`${Dt}%`,top:"50%",transform:"translate(-50%, -50%)"},Ms=Xe!==null?ie(Xe):null,Bc=f!=="hover"&&Xe!==null&&(Xe===Ve||!B&&Xe===L),Wc=T?Be>ki:Ve>z,Gc=T?at<ua:L<ue,Kc=V!==bt.slant.isFlipped?"before":"after",qc=V===wt.slant.isFlipped?"before":"after",fo=fd(T?[{side:Kc,box:Ma,...d?{reach:"inline-size"}:{reach:"rotated",angleDeg:bt.slant.lowAngleDeg,centreFromAnchorPx:bt.centreFromAnchorPx,alongPushPx:bt.slant.lowOffsetX}},{side:qc,box:Da,...d?{reach:"inline-size"}:{reach:"rotated",angleDeg:wt.slant.lowAngleDeg,centreFromAnchorPx:wt.centreFromAnchorPx,alongPushPx:wt.slant.lowOffsetX}}]:[{side:d||m==="top"!==lr.isFlipped?"before":"after",box:B?eo:Io(eo,zi),...d?{reach:"inline-size"}:{reach:"rotated",angleDeg:lr.lowAngleDeg,centreFromAnchorPx:Math.abs(lr.lowOffsetY),alongPushPx:lr.lowOffsetX}}]),Xc=fo===void 0?e.style:{...e.style,...fo.style};s.useLayoutEffect(()=>{Hi.current=fo===void 0?0:fo.mainPx});const Ht=q?"micro-point":"micro-low",Er=i?"cursor-not-allowed opacity-50":"cursor-pointer",Kr=c=>f==="hover"||!p||c===void 0?null:P.jsx("span",{"data-label-leader":"true","aria-hidden":"true",className:"period-slider-label-leader",style:c}),Aa=(c,b,w,v)=>f==="hover"||c===null?null:P.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":v,"data-folded":"true",style:c.foldStyle,children:`${b}${j}${w}`}),Ds=c=>{const b=d?"vertical":"horizontal",w=c==="decrease",v=d?!w:w;return P.jsx(Ar,{ref:w?ji:Fi,neighbour:"rail",direction:hd[b][c],glyph:"single",disabled:i,canStep:w?Wc:Gc,onStep:()=>Ca(w?-1:1),ariaLabel:w?I.decrease:I.increase,className:`period-slider-stepper-btn ${gd[b][c]} ${qs[b][v?"leading":"trailing"]}`})};return P.jsxs("div",{ref:ln,style:Xc,className:`period-slider grid select-none place-items-center ${pd[d?"vertical":"horizontal"][u?"withSteppers":"railOnly"]} ${l}`,"data-disabled":i?"true":void 0,"data-unit":t,"data-mode":e.mode,"data-orientation":d?"vertical":"horizontal","data-label-position":m,"data-color-scheme":_,children:[P.jsx("div",{ref:Yi,"data-range-area":"true","aria-hidden":"true",className:"period-slider-range-area"}),u&&Ds(d?"increase":"decrease"),P.jsx("div",{ref:ct,"data-testid":"period-slider-track","data-orientation":d?"vertical":"horizontal","data-vernier-orientation":T?we:void 0,className:`period-slider-track relative touch-none rounded-full ${qs[d?"vertical":"horizontal"][u?"rail":"railOnly"]} ${Er}`,onPointerDown:Ec,onPointerMove:Pc,onPointerLeave:Lc,children:T?P.jsxs(P.Fragment,{children:[M&&(d?P.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:[P.jsx("defs",{children:P.jsxs("linearGradient",{id:W,x1:"0",y1:"0",x2:"1",y2:"0",children:[P.jsx("stop",{offset:"0%",stopColor:V?Q.macro:Q.micro,stopOpacity:"0.28"}),P.jsx("stop",{offset:"100%",stopColor:V?Q.micro:Q.macro,stopOpacity:Rs})]})}),P.jsx("path",{ref:ga,"data-testid":"period-slider-vernier-projection",d:Va(yt,kt,d,V),fill:`url(#${W})`})]}):P.jsxs("svg",{className:"period-slider-vernier-projection",role:"presentation","aria-hidden":"true",width:"100%",height:"32",viewBox:"0 0 100 32",preserveAspectRatio:"none",children:[P.jsx("defs",{children:P.jsxs("linearGradient",{id:W,x1:"0",y1:"0",x2:"0",y2:"1",children:[P.jsx("stop",{offset:"0%",stopColor:V?Q.macro:Q.micro,stopOpacity:"0.28"}),P.jsx("stop",{offset:"100%",stopColor:V?Q.micro:Q.macro,stopOpacity:Rs})]})}),P.jsx("path",{ref:ga,"data-testid":"period-slider-vernier-projection",d:Va(yt,kt,d,V),fill:`url(#${W})`})]})),!g&&P.jsxs(P.Fragment,{children:[P.jsx("div",{"data-testid":"period-slider-connect-macro",className:"period-slider-connect-macro",style:d?{bottom:`calc(${Wr} - 8px)`,height:`calc(${co} - ${Wr} + 16px)`}:{left:`calc(${Wr} - 8px)`,width:`calc(${co} - ${Wr} + 16px)`},onPointerDown:zr("macro-connect")}),!q&&P.jsx("div",{"data-testid":"period-slider-connect-micro",className:"period-slider-connect-micro",style:d?{bottom:`calc(${Gr} - 8px)`,height:`calc(${uo} - ${Gr} + 16px)`}:{left:`calc(${Gr} - 8px)`,width:`calc(${uo} - ${Gr} + 16px)`},onPointerDown:zr("micro-connect")})]}),K&&P.jsxs("div",{className:"period-slider-vernier-ticks pointer-events-none absolute inset-0",children:[[.2,.4,.6,.8].map(c=>P.jsx("div",{"data-testid":"period-slider-tick","data-tick-scale":"macro",className:"period-slider-tick period-slider-tick-macro",style:d?{bottom:`${c*100}%`}:{left:`${c*100}%`}},`macro-tick-${c}`)),[.1,.2,.3,.4,.5,.6,.7,.8,.9].map(c=>P.jsx("div",{"data-testid":"period-slider-tick","data-tick-scale":"micro",className:"period-slider-tick period-slider-tick-micro",style:d?{bottom:`${c*100}%`}:{left:`${c*100}%`}},`micro-tick-${c}`))]}),P.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":I.macroRangeStart,"aria-disabled":i?"true":void 0,"aria-valuemin":sc,"aria-valuemax":lt,"aria-valuenow":et,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(rr,y,"period"):Tr(y,rr,st,$),"aria-orientation":d?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${d?"is-vertical":""} group absolute touch-none ${d?V?"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:right-0 after:-left-4":"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-right-4 after:left-0":V?"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-4 after:bottom-0":"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-0 after:-bottom-4"} after:content-[''] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-400 ${Er}`,style:d?{bottom:Wr,left:V?0:"auto",right:V?"auto":0,transform:V?"translate(-100%, 50%)":"translate(100%, 50%)",zIndex:pt==="macro-low"||Je==="macro-low"?30:15}:{left:Wr,top:V?0:"auto",bottom:V?"auto":0,transform:V?"translate(-50%, -100%)":"translate(-50%, 100%)",zIndex:pt==="macro-low"||Je==="macro-low"?30:15},onPointerDown:zr("macro-low"),onKeyDown:no("macro-low"),onFocus:ro("macro-low"),"data-active":pt==="macro-low"?"true":void 0,"data-front":Je==="macro-low"?"true":void 0,"data-vernier-pos":d?V?"left":"right":V?"top":"bottom","data-handle-type":"macro-low",children:[P.jsx(yn,{type:"macro",isTop:V,isVertical:d,isLeft:V}),me&&P.jsx("div",{"data-testid":"period-slider-hairline",className:"period-slider-hairline"}),f!=="hover"&&P.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":Tc?"true":void 0,"data-slanted":bt.slant.isSlanted?"true":void 0,"data-flipped":bt.slant.isFlipped?"true":void 0,ref:dc,style:bt.lowStyle,children:_e(y,rr,st,$)}),Kr(bt.lowLeaderStyle),Aa(bt.fold,_e(y,rr,st,$),_e(y,nr,st,$),void 0)]}),P.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":I.macroRangeEnd,"aria-disabled":i?"true":void 0,"aria-valuemin":et,"aria-valuemax":lc,"aria-valuenow":lt,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(nr,y,"period"):Tr(y,nr,st,$),"aria-orientation":d?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${d?"is-vertical":""} group absolute touch-none ${d?V?"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:right-0 after:-left-4":"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-right-4 after:left-0":V?"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-4 after:bottom-0":"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-0 after:-bottom-4"} after:content-[''] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-400 ${Er}`,style:d?{bottom:co,left:V?0:"auto",right:V?"auto":0,transform:V?"translate(-100%, 50%)":"translate(100%, 50%)",zIndex:pt==="macro-high"||Je==="macro-high"?30:15}:{left:co,top:V?0:"auto",bottom:V?"auto":0,transform:V?"translate(-50%, -100%)":"translate(-50%, 100%)",zIndex:pt==="macro-high"||Je==="macro-high"?30:15},onPointerDown:zr("macro-high"),onKeyDown:no("macro-high"),onFocus:ro("macro-high"),"data-active":pt==="macro-high"?"true":void 0,"data-front":Je==="macro-high"?"true":void 0,"data-vernier-pos":d?V?"left":"right":V?"top":"bottom","data-handle-type":"macro-high",children:[P.jsx(yn,{type:"macro",isTop:V,isVertical:d,isLeft:V}),me&&P.jsx("div",{"data-testid":"period-slider-hairline",className:"period-slider-hairline"}),f!=="hover"&&P.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":Cc?"true":void 0,"data-slanted":bt.slant.isSlanted?"true":void 0,"data-flipped":bt.slant.isFlipped?"true":void 0,ref:mc,style:bt.highStyle,children:_e(y,nr,st,$)}),Kr(bt.highLeaderStyle)]}),P.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":q?I.microSelectedDate:I.microRangeStart,"aria-disabled":i?"true":void 0,"aria-valuemin":ki,"aria-valuemax":q?ua:at,"aria-valuenow":Be,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(vr,x,"period"):Tr(x,vr,vt,$),"aria-orientation":d?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${d?"is-vertical":""} group absolute touch-none ${d?V?"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-right-4 after:left-0":"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:right-0 after:-left-4":V?"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-0 after:-bottom-4":"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-4 after:bottom-0"} after:content-[''] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-400 ${Er}`,style:d?{bottom:Gr,left:V?"auto":0,right:V?0:"auto",transform:V?"translate(100%, 50%)":"translate(-100%, 50%)",zIndex:pt===Ht||Je===Ht?30:20}:{left:Gr,top:V?"auto":0,bottom:V?0:"auto",transform:V?"translate(-50%, 100%)":"translate(-50%, -100%)",zIndex:pt===Ht||Je===Ht?30:20},onPointerDown:zr(Ht),onKeyDown:no(Ht),onFocus:ro(Ht),"data-active":pt===Ht?"true":void 0,"data-front":Je===Ht?"true":void 0,"data-vernier-pos":d?V?"right":"left":V?"bottom":"top","data-handle-type":Ht,children:[P.jsx(yn,{type:"micro",isTop:!V,isVertical:d,isLeft:!V}),me&&P.jsx("div",{"data-testid":"period-slider-hairline",className:"period-slider-hairline"}),f!=="hover"&&P.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":Ic?"true":void 0,"data-slanted":wt.slant.isSlanted?"true":void 0,"data-flipped":wt.slant.isFlipped?"true":void 0,ref:gc,style:wt.lowStyle,children:_e(x,vr,vt,$)}),Kr(wt.lowLeaderStyle),Aa(wt.fold,_e(x,vr,vt,$),_e(x,Sr,vt,$),void 0)]}),!q&&P.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":I.microRangeEnd,"aria-disabled":i?"true":void 0,"aria-valuemin":Be,"aria-valuemax":ua,"aria-valuenow":at,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(Sr,x,"period"):Tr(x,Sr,vt,$),"aria-orientation":d?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${d?"is-vertical":""} group absolute touch-none ${d?V?"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-right-4 after:left-0":"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:right-0 after:-left-4":V?"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-0 after:-bottom-4":"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-4 after:bottom-0"} after:content-[''] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-400 ${Er}`,style:d?{bottom:uo,left:V?"auto":0,right:V?0:"auto",transform:V?"translate(100%, 50%)":"translate(-100%, 50%)",zIndex:pt==="micro-high"||Je==="micro-high"?30:20}:{left:uo,top:V?"auto":0,bottom:V?0:"auto",transform:V?"translate(-50%, 100%)":"translate(-50%, -100%)",zIndex:pt==="micro-high"||Je==="micro-high"?30:20},onPointerDown:zr("micro-high"),onKeyDown:no("micro-high"),onFocus:ro("micro-high"),"data-active":pt==="micro-high"?"true":void 0,"data-front":Je==="micro-high"?"true":void 0,"data-vernier-pos":d?V?"right":"left":V?"bottom":"top","data-handle-type":"micro-high",children:[P.jsx(yn,{type:"micro",isTop:!V,isVertical:d,isLeft:!V}),me&&P.jsx("div",{"data-testid":"period-slider-hairline",className:"period-slider-hairline"}),f!=="hover"&&P.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":Ac?"true":void 0,"data-slanted":wt.slant.isSlanted?"true":void 0,"data-flipped":wt.slant.isFlipped?"true":void 0,ref:pc,style:wt.highStyle,children:_e(x,Sr,vt,$)}),Kr(wt.highLeaderStyle)]})]}):P.jsxs(P.Fragment,{children:[!g&&P.jsx("div",{"data-testid":"period-slider-connect",className:"period-slider-connect absolute rounded-full",style:Hc,onPointerDown:yc}),N&&U&&C.length>1&&P.jsx("div",{className:"period-slider-ticks pointer-events-none absolute inset-0",children:C.map((c,b)=>{const w=F(t,c,h),v=Mr(b),O=d?{bottom:`${v}%`,left:"50%",transform:"translate(-50%, 50%)"}:{left:`${v}%`,top:"50%",transform:"translate(-50%, -50%)"};return P.jsx("div",{"data-testid":"period-slider-tick",className:"period-slider-tick absolute h-1.5 w-1.5 rounded-full",style:O},`tick-${w}`)})}),!i&&Xe!==null&&Dt!==null&&Oe===null&&Ms&&P.jsxs("div",{"data-testid":"period-slider-hover-guide",className:"period-slider-hover-guide pointer-events-none absolute h-2 w-2",style:zc,children:[P.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"}),P.jsx("div",{"data-testid":"period-slider-hover-tooltip","data-duplicate":Bc?"true":void 0,className:`period-slider-hover-tooltip ${m==="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:_e(t,Ms,e.formatLabel,$)})]}),P.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":B?I.selectedDate:I.rangeStart,"aria-disabled":i?"true":void 0,"aria-valuemin":z,"aria-valuemax":B?ue:L,"aria-valuenow":Ve,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(so,t,"period"):Tr(t,so,e.formatLabel,$),"aria-orientation":d?"vertical":"horizontal",className:`period-slider-handle group absolute h-4 w-4 touch-none after:absolute after:inset-[calc((100%-var(--ps-target-size))/2)] after:content-[''] focus-visible:outline-hidden ${Er}`,style:Fc,onPointerDown:cs("low"),onKeyDown:ds("low"),onFocus:us("low"),"data-active":Oe==="low"?"true":void 0,"data-front":hn?"true":void 0,children:[P.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)] dark:group-focus-visible:ring-blue-400 ${Oe==="low"?"":"shadow-md"}`}),f!=="hover"&&P.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":m,"data-slanted":lr.isSlanted?"true":void 0,"data-flipped":lr.isFlipped?"true":void 0,"data-front":hn?"true":void 0,"data-duplicate":wa&&!hn?"true":void 0,ref:cc,style:yr.lowStyle,children:_e(t,so,e.formatLabel,$)}),Kr(yr.lowLeaderStyle),Aa(yr.fold,_e(t,so,e.formatLabel,$),_e(t,lo,e.formatLabel,$),m)]}),!B&&P.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":I.rangeEnd,"aria-disabled":i?"true":void 0,"aria-valuemin":Ve,"aria-valuemax":ue,"aria-valuenow":L,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(lo,t,"period"):Tr(t,lo,e.formatLabel,$),"aria-orientation":d?"vertical":"horizontal",className:`period-slider-handle group absolute h-4 w-4 touch-none after:absolute after:inset-[calc((100%-var(--ps-target-size))/2)] after:content-[''] focus-visible:outline-hidden ${Er}`,style:Uc,onPointerDown:cs("high"),onKeyDown:ds("high"),onFocus:us("high"),"data-active":Oe==="high"?"true":void 0,"data-front":gn?"true":void 0,children:[P.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)] dark:group-focus-visible:ring-blue-400 ${Oe==="high"?"":"shadow-md"}`}),f!=="hover"&&P.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":m,"data-slanted":lr.isSlanted?"true":void 0,"data-flipped":lr.isFlipped?"true":void 0,"data-front":gn?"true":void 0,"data-duplicate":wa&&!gn?"true":void 0,ref:uc,style:yr.highStyle,children:_e(t,lo,e.formatLabel,$)}),Kr(yr.highLeaderStyle)]})]})}),u&&Ds(d?"decrease":"increase")]})},rt=e=>e.getTime(),Bl=(e,t)=>!(Ot(e)&&Ot(t))||e.length!==2||t.length!==2?!1:$t(e[0],rt)===$t(t[0],rt)&&$t(e[1],rt)===$t(t[1],rt),So=(e,t)=>e===void 0||t===void 0?e===t:Bl(e,t),Ba=(e,t)=>{if(e===t)return!0;if(!(Ot(e)&&Ot(t))||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if($t(e[r],rt)!==$t(t[r],rt))return!1;return!0},Wl=(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},wd=(e,t)=>e===t?!0:e.mode!==t.mode||e.unit!==t.unit||e.yearStartMonth!==t.yearStartMonth||$t(e.minDate,rt)!==$t(t.minDate,rt)||$t(e.maxDate,rt)!==$t(t.maxDate,rt)||e.labelPosition!==t.labelPosition||e.autoSlantLabels!==t.autoSlantLabels||e.keepMergedLabelUpright!==t.keepMergedLabelUpright||e.foldClosePairLabels!==t.foldClosePairLabels||e.foldedPairLabelSeparator!==t.foldedPairLabelSeparator||e.labelCeiling!==t.labelCeiling||e.labelFloor!==t.labelFloor||e.showLabelLeaderLines!==t.showLabelLeaderLines||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||!Wl(e.style,t.style)||e.snapMode!==t.snapMode||e.formatLabel!==t.formatLabel||e.formatLocale!==t.formatLocale||e.locale!==t.locale||!Xo(e.labels,t.labels)||e.formatAriaValueText!==t.formatAriaValueText||!Ba(e.allowedDates,t.allowedDates)?!1:e.mode==="point"&&t.mode==="point"?!(ft(e.value,rt)!==ft(t.value,rt)||ft(e.defaultValue,rt)!==ft(t.defaultValue,rt)||e.onChangePoint!==t.onChangePoint):e.mode==="range"&&t.mode==="range"?!(!So(e.range,t.range)||!So(e.defaultRange,t.defaultRange)||e.onChangeRange!==t.onChangeRange):e.mode==="vernier"&&t.mode==="vernier"?!(!So(e.microRange,t.microRange)||!So(e.defaultMicroRange,t.defaultMicroRange)||ft(e.microValue,rt)!==ft(t.microValue,rt)||ft(e.defaultMicroValue,rt)!==ft(t.defaultMicroValue,rt)||!Bl(e.macroRange,t.macroRange)||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||!Ba(e.macroAllowedDates,t.macroAllowedDates)||!Ba(e.microAllowedDates,t.microAllowedDates)):!1,Gl=s.memo(bd,wd);Gl.displayName="PeriodSlider";const Zs=2,$e=-1,Pt=e=>F("day",e),Vn=e=>ne("day",e),Sn=e=>`${ea(e.getFullYear())}-${String(e.getMonth()+1).padStart(Zs,"0")}-${String(e.getDate()).padStart(Zs,"0")}`,vd=(e,t,r,n)=>{const o=Pt(e),a=Pt(t),i=a>=o?a-o+1:0,l=f=>Vn(a-f),u={kind:"range",min:o,max:a};return{count:i,dateAt:l,labelAt:f=>_e("day",l(f),n,r),indexOf:f=>{const m=Pt(f);return m<o||m>a?$e:a-m},nearestIndexOf:f=>{if(i===0)return $e;const m=An(u,Pt(f));return m===null?$e:a-m}}},Sd=(e,t,r,n,o,a)=>{const i=n>=r?n-r+1:0,l=S=>e[n-S],u={kind:"candidates",ascending:t,loIndex:r,hiIndex:n},f=S=>{const D=S.getTime();let E=r,j=n;for(;E<=j;){const p=E+j>>1,d=e[p].getTime();if(d===D)return n-p;d<D?E=p+1:j=p-1}return $e},m=S=>S===null?$e:f(Vn(S));return{count:i,dateAt:l,labelAt:S=>_e("day",l(S),a,o),indexOf:f,nearestIndexOf:S=>m(An(u,Pt(S)))}},xd={count:0,dateAt:e=>{throw new RangeError(`DateSelector: the option domain is empty (requested index ${R(e)})`)},labelAt:e=>{throw new RangeError(`DateSelector: the option domain is empty (requested index ${R(e)})`)},indexOf:()=>$e,nearestIndexOf:()=>$e},Rd=(e,t,r)=>{const n=l=>{let u=0,f=e.length;for(;u<f;){const m=u+f>>1;e[m].getTime()<l?u=m+1:f=m}return u},o=l=>{let u=0,f=e.length;for(;u<f;){const m=u+f>>1;e[m].getTime()<=l?u=m+1:f=m}return u},a=t===null?0:n(t.getTime()),i=(r===null?e.length:o(r.getTime()))-1;return{loIndex:a,hiIndex:i}},Md=(e,t)=>{const r=new Map;for(let n=0;n<e.length;n++){const o=e[n];t(n,o);const a=new Date(o);a.setHours(0,0,0,0);const i=a.getTime();r.has(i)||r.set(i,a)}return Array.from(r.keys()).sort((n,o)=>n-o).map(n=>r.get(n))},Dd={year:{year:"numeric"},month:{month:"2-digit"},day:{day:"2-digit"}},yd={month:2,day:2},Qs={year:e=>e.getFullYear(),month:e=>e.getMonth()+1,day:e=>e.getDate()},Js=new Map,Ed=(e,t)=>{const r=`${e}\0${t}`,n=Js.get(r);if(n!==void 0)return n;const o=new Intl.DateTimeFormat(t,Dd[e]);return Js.set(r,o),o},Pd=(e,t,r)=>{if(r!==void 0)return Ed(e,r).format(t);const n=new Date(t.getTime());return e==="year"?ea(Qs.year(n)):String(Qs[e](n)).padStart(yd[e],"0")},Kl=(e,t,r,n)=>{if(Te("formatOptionText","unit",t),r!=="period"&&r!=="part")throw new RangeError(`formatOptionText: scope must be "period" or "part" (received: ${R(r)})`);return ye(e)?r==="part"?Pd(t,e,n):_e(t,e,void 0,n):""},Ln="period-slider-selector-field",Ld=`${Ln} period-slider-selector-field-year`,jo=`${Ln} period-slider-selector-field-date`,$d=12,oa=(e,t,r)=>{const n=zn(e,t,r);return n===null?Number.NaN:n*$d+r},Di=(e,t,r)=>{const n=o=>o.value!==void 0?o.value:o.initialDate;return ft(n(e),r)!==ft(n(t),r)||t.value!==void 0&&Number.isNaN(ft(t.initialDate,r))||ft(e.minDate,r)!==ft(t.minDate,r)?!1:ft(e.maxDate,r)===ft(t.maxDate,r)};class ql{held;writeCount=0;constructor(t){this.held=t}get current(){return this.held}set current(t){this.held=t,this.writeCount+=1}get writes(){return this.writeCount}commit(t,r){this.writeCount===r&&(this.held=t)}}function Xl(e,t){const[r]=s.useState(()=>t(e)),n=r.writes;return s.useInsertionEffect(()=>{r.commit(e,n)}),r}function dt(e){return Xl(e,t=>new ql(t))}const Td={motion:["motion","edge"],vernierRange:["motion","edge","window"],vernierPoint:["window"]},Cd=["shift","start","end","single"],Id=["disable","clamp"],Ad=["follow","keep"],el={day:{day:1},month:{month:1,year:12},year:{year:1}},tl=new WeakMap,ri=(e,t,r)=>{if(typeof r!="object"||r===null)throw new RangeError(`${e}: ${t} must be an object (received: ${R(r)})`)},rl=(e,t,r,n)=>{for(const[o,a]of Object.entries(r))if(!(a===void 0||n.includes(o)))throw new RangeError(`${e}: ${t}.${o} is not read here; the accepted keys are ${n.map(i=>`"${i}"`).join(", ")} (received: ${R(a)})`)},kr=(e,t,r,n)=>{ri(e,t,r),rl(e,t,r,["previous","next"]);for(const o of["previous","next"]){const a=`${t}.${o}`,i=r[o];ri(e,a,i),rl(e,a,i,Td[n]);const{motion:l,edge:u,window:f}=i;if(n!=="vernierPoint"&&(typeof l!="string"||!Cd.includes(l)))throw new RangeError(`${e}: ${a}.motion must be one of "shift", "start", "end", "single" (received: ${R(l)})`);if(u!==void 0){if(l!=="shift")throw new RangeError(`${e}: ${a}.edge applies to motion "shift" only; a motion that moves one value either can move or cannot (received: edge ${R(u)} with motion ${R(l)})`);if(typeof u!="string"||!Id.includes(u))throw new RangeError(`${e}: ${a}.edge must be "disable" or "clamp" (received: ${R(u)})`)}if(f!==void 0&&(typeof f!="string"||!Ad.includes(f)))throw new RangeError(`${e}: ${a}.window must be "follow" or "keep" (received: ${R(f)})`)}},yi=(e,t,r)=>{if(typeof t!="object"||t===null)throw new RangeError(`${e}: stepper must be an object (received: ${R(t)})`);const{onStep:n,canStepPrevious:o,canStepNext:a}=t;if(typeof n!="function")throw new RangeError(`${e}: stepper.onStep must be a function (received: ${R(n)})`);if(typeof o!="boolean")throw new RangeError(`${e}: stepper.canStepPrevious must be a boolean (received: ${R(o)})`);if(typeof a!="boolean")throw new RangeError(`${e}: stepper.canStepNext must be a boolean (received: ${R(a)})`);if(!r)throw new RangeError(`${e}: stepper requires the controlled value; the owner that takes the ◀▶ over moves the value itself, so an uncontrolled initialDate would never change`)},Xt=(e,t,r,n,o)=>{if(!ye(r))throw new RangeError(`${e}: ${t} must be a valid Date (received: ${R(r)})`);return Ze(e,t,r,n,o,"")},Zl=(e,t,r,n,o)=>{const a=`${n}:${o}`,i=tl.get(r),l=i?.get(a);if(l!==void 0)return l;const u=[];for(let m=0;m<r.length;m++)u.push(Xt(e,`${t}[${m}]`,r[m],n,o));const f=Array.from(new Set(u)).sort((m,S)=>m-S);return i===void 0?tl.set(r,new Map([[a,f]])):i.set(a,f),f},kd=(e,t)=>t===1?Lo(e):{stepEnd:(r,n)=>Po(e,r+t*n,n),edge:r=>Cn(e,r)},ni=(e,t)=>e.motion==="shift"?{motion:"shift",edge:e.edge==="clamp"?"clamp":"disable"}:e.motion==="single"?{motion:"single",shows:t}:{motion:e.motion},oi=(e,t,r,n,o,a)=>{if(a){const u=e[0]===t[0]?r[0]:e[0]===t[1]?r[1]:ne(n,e[0],o);return Number.isNaN(u.getTime())?null:[u,u]}const i=e[0]===t[0]?r[0]:ne(n,e[0],o),l=e[1]===t[1]?r[1]:ne(n,e[1],o);return Number.isNaN(i.getTime())||Number.isNaN(l.getTime())?null:[i,l.getTime()<i.getTime()?i:l]},ai=e=>{const t="resolveSelectorSteps";ri(t,"options",e);const{selection:r,shows:n,unit:o,minDate:a,maxDate:i,allowedDates:l,rules:u}=e;Te(t,"unit",o);const f=Jt(t,"stepUnit",e.stepUnit,o),m=el[o][f];if(m===void 0){const _=Object.keys(el[o]).map($=>`"${$}"`).join(" or ");throw new RangeError(`${t}: stepUnit must be ${_} for a ${o} selection, the steps that move every ${o} by a whole number of ${o}s (received: ${R(f)})`)}const S=wr(t,e.yearStartMonth);if(n!=="start"&&n!=="end")throw new RangeError(`${t}: shows must be "start" or "end" (received: ${R(n)})`);if(!Ot(r)||r.length!==2)throw new RangeError(`${t}: selection must be a [start, end] tuple of Dates (received: ${R(r)})`);kr(t,"rules",u,"motion");const D=Xt(t,"selection[0]",r[0],o,S),E=Xt(t,"selection[1]",r[1],o,S);if(E<D)throw new RangeError(`${t}: selection must not be inverted at ${o} resolution (start: ${R(r[0])}, end: ${R(r[1])})`);const j=a===void 0?null:Xt(t,"minDate",a,o,S),p=i===void 0?null:Xt(t,"maxDate",i,o,S);if(j!==null&&p!==null&&p<j)throw new RangeError(`${t}: maxDate must not precede minDate at ${o} resolution (minDate: ${R(a)}, maxDate: ${R(i)})`);an(t,"allowedDates",l);const d=l===void 0?{kind:"range",min:j,max:p}:sn(Zl(t,"allowedDates",l,o,S),j,p),g=kd(d,m),N=(_,$)=>{const y=Qa(g,D,E,_,ni($,n));return y===null?null:oi(y,[D,E],r,o,S,$.motion==="single")};return{previous:N(-1,u.previous),next:N(1,u.next)}},Ut=(e,t)=>{const r=dt({targets:e,onStepTo:t}),n=s.useCallback(i=>{const{targets:l,onStepTo:u}=r.current,f=l[i];f!==null&&u(f,i)},[]),o=e.previous!==null,a=e.next!==null;return s.useMemo(()=>({onStep:n,canStepPrevious:o,canStepNext:a}),[n,o,a])};function Nd(e,t,r,n){return e.source===t?e:t===null?{source:t,held:e.held}:{source:t,held:n(r)}}function Ei(e,t,r,n){const o=t?null:r(e),[a,i]=s.useState(()=>({source:o,held:n(e)})),l=s.useCallback(f=>i(m=>({source:m.source,held:f})),[]),u=Nd(a,o,e,n);return s.useLayoutEffect(()=>{u!==a&&i(f=>f===a?u:f)}),[u.held,l]}const Ao=44,nl=7,xo=8,Od=2,Ql=10,Vd=1e3,ii=8,Wa=6,Ga=4,Ka=12,xn=(e,t)=>{const r=new Date(e,t-1,1);return r.setFullYear(e),Pt(r)},_d=(e,t)=>{if(e.length<Ga||t.count===0)return $e;const r=Number(e.slice(0,Ga));if(!Number.isInteger(r))return $e;const n=e.length>=Wa,o=n?Number(e.slice(Ga,Wa)):Ka;if(o<1||o>Ka)return $e;const a=e.length>=ii,i=a?Number(e.slice(Wa,ii)):0,l=xn(r,o),u=(o===Ka?xn(r+1,1):xn(r,o+1))-1,f=a?l+i-1:n?l:xn(r,1),m=a?f:n?u:xn(r+1,1)-1;if(a&&(i<1||f>u))return $e;for(let S=m;S>=f;S--){const D=t.indexOf(Vn(S));if(D!==$e)return D}return $e},Yd=e=>e.closest(".dark")===null?"light":"dark",Hd=(e,t,r,n)=>{const o=r-e.bottom-xo,a=e.top-xo,i=o>=t||o>=a,u=Math.max(Ao,Math.min(t,i?o:a)),f=i?e.bottom:e.top-u,m=e.width+Ql,S=Math.max(xo,Math.min(e.left,n-m-xo));return{top:f,left:S,width:m,height:u}},jd=(e,t)=>e<t?e:t>0?t-1:$e,Jl=({domain:e,selectedIndex:t,openAnchorIndex:r,displayLabel:n,machineValue:o,disabled:a,ariaLabel:i,locale:l,labels:u,onCommitIndex:f,controlClassName:m})=>{const S=s.useId(),D=s.useMemo(()=>Mu(u),[u]),E=`period-slider-date-listbox-${S}`,j=s.useCallback(H=>`period-slider-date-option-${S}-${H}`,[S]),[p,d]=s.useState(!1),[g,N]=s.useState($e),[_,$]=s.useState(null),[y,x]=s.useState(null),h=s.useRef(null),oe=s.useRef(null),ce=s.useRef(null),X=s.useRef({buffer:"",at:0}),q=e.count,I=jd(g,q),Q=dt(I);s.useLayoutEffect(()=>{I!==g&&N(H=>H===g?I:H)});const W=Math.min(q,nl)*Ao,A=Math.max(1,Math.min(q,nl)),Y=s.useCallback(()=>{const H=h.current;if(H===null)return;const ee=H.getBoundingClientRect();$(Hd(ee,W,window.innerHeight,window.innerWidth))},[W]),te=dt(p),T=s.useCallback(()=>{d(!1),N($e),X.current={buffer:"",at:0},te.current=!1},[te]);s.useLayoutEffect(()=>()=>{te.current&&T()},[te,T]);const C=s.useCallback(H=>{a||q===0||(N(H),d(!0),te.current=!0)},[a,q,te]);s.useLayoutEffect(()=>{if(!p){$(null),x(null);return}const H=h.current;return H!==null&&x(Yd(H)),Y(),window.addEventListener("scroll",Y,!0),window.addEventListener("resize",Y),()=>{window.removeEventListener("scroll",Y,!0),window.removeEventListener("resize",Y)}},[p,Y]),s.useEffect(()=>{if(!p)return;const H=ee=>{const de=ee.target;de!==null&&oe.current?.contains(de)!==!0&&h.current?.contains(de)!==!0&&T()};return document.addEventListener("pointerdown",H,!0),()=>document.removeEventListener("pointerdown",H,!0)},[p,T]),s.useEffect(()=>{p&&(a||q===0)&&T()},[p,a,q,T]),s.useEffect(()=>{if(!p)return;const H=Q.current;H!==$e&&ce.current?.scrollToIndex(H,{align:"center"})},[q,p,Q]);const U=H=>{if(q===0)return;const ee=Math.max(0,Math.min(H,q-1));N(ee),ce.current?.scrollToIndex(ee,{align:"center"})},z=H=>{H<0||H>=q||(f(H),T(),h.current?.focus())},ue=dt(z),B=H=>{if(a||h.current===null)return;const ee=I!==$e?I:t!==$e?t:r;switch(H.key){case"ArrowDown":if(H.preventDefault(),!p){C(ee);return}U(ee+1);return;case"ArrowUp":if(H.preventDefault(),!p){C(ee);return}U(ee-1);return;case"Home":if(!p)return;H.preventDefault(),U(0);return;case"End":if(!p)return;H.preventDefault(),U(q-1);return;case"PageDown":if(!p)return;H.preventDefault(),U(ee+A);return;case"PageUp":if(!p)return;H.preventDefault(),U(ee-A);return;case"Enter":if(H.preventDefault(),!p){C(ee);return}z(I!==$e?I:ee);return;case"Escape":if(!p)return;H.preventDefault(),T();return;case"Tab":p&&T();return}if(H.key.length!==1)return;const de=H.key>="0"&&H.key<="9",Ee=H.key==="-"||H.key==="/"||H.key===".";if(!(de||Ee))return;H.preventDefault();const ve=Date.now(),Ge=ve-X.current.at>Vd?"":X.current.buffer,je=de?`${Ge}${H.key}`.slice(0,ii):Ge;X.current={buffer:je,at:ve};const Ke=_d(je,e);if(Ke!==$e){if(!p){C(Ke);return}U(Ke)}},ie=s.useCallback(H=>H,[]),xe=s.useCallback(()=>Ao,[]),ae=I===$e?null:j(I),se=s.useCallback(()=>{const H=h.current;if(H===null||ae===null)throw new Error("VirtualDateDropdown: the active row attached without its combobox control or an active option id, so aria-activedescendant has nothing to name it on");return H.setAttribute("aria-activedescendant",ae),()=>{H.getAttribute("aria-activedescendant")===ae&&H.removeAttribute("aria-activedescendant")}},[ae]),pe=s.useCallback(H=>{const ee=H===t,de=H===I;return P.jsx("div",{id:j(H),role:"option","aria-selected":ee,"aria-posinset":H+1,"aria-setsize":e.count,"data-testid":"period-slider-date-option","data-active":de?"true":void 0,ref:de?se:void 0,className:"period-slider-date-option",style:{height:Ao},onClick:()=>ue.current(H),children:e.labelAt(H)})},[e,t,I,j,ue,se]),Ne=s.useCallback(H=>(oe.current=H,H.style.removeProperty("display"),()=>{oe.current=null,H.style.setProperty("display","none","important")}),[]),Mt=p&&_!==null&&y!==null&&q>0,be=Mt?P.jsx("div",{ref:Ne,className:"period-slider-date-popup","data-testid":"period-slider-date-popup","data-color-mode":y,style:{top:_.top,left:_.left,width:_.width,height:_.height},onMouseDown:H=>{H.preventDefault()},children:P.jsx(gr.VirtualScroll,{ref:ce,itemCount:q,getItem:ie,getItemHeight:xe,viewportSize:_.height-Od,initialScrollIndex:I!==$e?I:void 0,className:"h-full w-full",testId:"period-slider-date-listbox-pane",locale:l,labels:D,contentProps:{id:E,role:"listbox","aria-label":i},scrollBarOptions:{width:Ql,enableArrowButtons:!1,enableThumbDrag:!0,enableTrackClick:!0,tapScrollCircleOptions:{enabled:!1}},behaviorOptions:{enableKeyboardNavigation:!1,overscrollBehavior:"contain"},children:pe})}):null;return P.jsxs(P.Fragment,{children:[P.jsx("input",{ref:h,type:"text",role:"combobox",readOnly:!0,"aria-label":i,"aria-expanded":p,"aria-controls":Mt?E:void 0,"aria-haspopup":"listbox","aria-autocomplete":"none",disabled:a,value:n,className:m,"data-testid":"period-slider-date-combobox","data-value":o,onKeyDown:B,onMouseDown:H=>{a||h.current===null||(H.preventDefault(),h.current?.focus(),p?T():C(t!==$e?t:r))},onBlur:()=>{p&&T()}}),be===null?null:eu.createPortal(be,document.body)]})};Jl.displayName="VirtualDateDropdown";const Rn=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t},Fd=Un("leave the bound out where the variant allows it, or declare the days to offer with minYear / maxYear or allowedDates"),Ud=Un('variant="split-dropdown" requires both bounds, so declare the years to offer with minYear / maxYear'),zd=31,Mn=(e,t,r)=>{if(!ye(t))throw new RangeError(`DateSelector: ${e} must be a valid Date (received: ${R(t)})`);Ze("DateSelector",e,t,"day",0,r)},dr=(e,t,r)=>{const n=new Date(0);return n.setHours(0,0,0,0),n.setFullYear(e,t-1,r),n},Ro=e=>dr(e,1,1),ol=e=>dr(e,12,31),ec=(e,t,r)=>e.getFullYear()===t&&e.getMonth()+1===r,al=(e,t,r,n)=>ec(e,t,r)&&e.getDate()===n,Pi=e=>zn(e,"year",0)!==null,Li=e=>oa(e,"day",0),Bd=e=>Pi(e)?Li(e):Number.NaN,Mo=(e,t,r)=>{if(!Pi(t))throw new RangeError(`DateSelector: ${e} must fall in a year that starts inside the Date range, because variant="split-dropdown" draws its year (received: ${R(t)})${r}`)},il=(e,t,r,n,o)=>{const a=[];for(let i=e;i<=t;i++){const l=r(i);if(Number.isNaN(l.getTime()))break;n(l,i)&&a.push({value:i,label:o(l)})}return a},Wd=e=>{const{value:t,initialDate:r,onChange:n,stepper:o,stepGlyph:a,children:i,minYear:l,maxYear:u,minDate:f,maxDate:m,allowedDates:S,variant:D="date",className:E="",style:j,disabled:p=!1,locale:d,labels:g,formatLocale:N,formatOption:_}=e;N!==void 0&&na("DateSelector","formatLocale",N);const $=D==="split-dropdown"?Ud:Fd;if(t!==void 0&&Mn("value",t,""),r!==void 0&&Mn("initialDate",r,""),f!==void 0&&Mn("minDate",f,$),m!==void 0&&Mn("maxDate",m,$),D==="split-dropdown"&&(t!==void 0&&Mo("value",t,""),r!==void 0&&Mo("initialDate",r,""),f!==void 0&&Mo("minDate",f,$),m!==void 0&&Mo("maxDate",m,$)),l!==void 0&&!Number.isInteger(l))throw new RangeError(`DateSelector: minYear must be an integer year (received: ${R(l)})`);if(u!==void 0&&!Number.isInteger(u))throw new RangeError(`DateSelector: maxYear must be an integer year (received: ${R(u)})`);if(l!==void 0&&Number.isNaN(Ro(l).getTime()))throw new RangeError(`DateSelector: minYear must name a year whose first day starts inside the Date range (received: ${R(l)})`);if(u!==void 0&&Number.isNaN(ol(u).getTime()))throw new RangeError(`DateSelector: maxYear must name a year whose last day starts inside the Date range (received: ${R(u)})`);if(D==="split-dropdown"&&S!==void 0)throw new RangeError('DateSelector: variant="split-dropdown" cannot honour allowedDates; use variant="dropdown" or variant="date" for a discrete date set');an("DateSelector","allowedDates",S);const y=t??r;if(y===void 0)throw new RangeError("DateSelector: either value (controlled) or initialDate (uncontrolled) is required; the selected date is never inferred from the wall clock");o!==void 0&&yi("DateSelector",o,t!==void 0);const x=wi("DateSelector",a),h=Zo(d,g),oe=t!==void 0,[ce,X]=Ei(y,oe,Li,Rn),q=t?.getTime(),I=s.useMemo(()=>t!==void 0?Rn(t):ce,[q,ce]);if(D==="split-dropdown"&&!oe&&!Pi(I))throw new RangeError(`DateSelector: variant="split-dropdown" cannot draw the uncontrolled selection held from an earlier render (holding ${R(I)}), because that selection's year starts outside the Date range; control the date with value to decide what the split dropdown holds`);const Q=f?.getTime(),W=m?.getTime(),A=s.useMemo(()=>{const k=f?Rn(f):null,re=l!==void 0?Ro(l):null;return k===null?re:re===null||k.getTime()>=re.getTime()?k:re},[Q,l]),Y=s.useMemo(()=>{const k=m?Rn(m):null,re=u!==void 0?ol(u):null;return k===null?re:re===null||k.getTime()<=re.getTime()?k:re},[W,u]),te=A?.getTime()??null,T=Y?.getTime()??null;if(A!==null&&Y!==null&&A.getTime()>Y.getTime())throw new RangeError(`DateSelector: the resolved upper bound must not precede the resolved lower bound (lower: ${Sn(A)}, upper: ${Sn(Y)})`);if(D!=="date"&&S===void 0&&(A===null||Y===null))throw new RangeError(`DateSelector: variant=${R(D)} requires a lower bound (minYear or minDate) and an upper bound (maxYear or maxDate)${D==="dropdown"?", or allowedDates":""}; the option list is never invented`);const C=s.useMemo(()=>S===void 0?null:S.map(k=>$t(k,re=>re.getTime())).join(","),[S]),U=s.useMemo(()=>{if(S===void 0)return null;const k=Md(S,(re,Ce)=>Mn(`allowedDates[${re}]`,Ce,""));return{ascending:k,ascendingSerials:k.map(Pt)}},[C]),z=s.useMemo(()=>U===null?null:{...U,...Rd(U.ascending,A,Y)},[U,te,T]),ue=s.useMemo(()=>z!==null?Sd(z.ascending,z.ascendingSerials,z.loIndex,z.hiIndex,N,_):A===null||Y===null?xd:vd(A,Y,N,_),[z,te,T,N,_]),B=s.useMemo(()=>z!==null?{kind:"candidates",ascending:z.ascendingSerials,loIndex:z.loIndex,hiIndex:z.hiIndex}:{kind:"range",min:A===null?null:Pt(A),max:Y===null?null:Pt(Y)},[z,te,T]),ie=k=>!Number.isNaN(k.getTime())&&In(B,Pt(k)),xe=k=>{if(p)return;const re=Rn(k);ie(re)&&(oe||X(re),n?.(re))},ae=I.getTime(),se=ie(I),pe=s.useMemo(()=>{const k=Qt(B,Pt(I),-1);if(k===null)return null;const re=Vn(k);return Number.isNaN(re.getTime())?null:re},[B,ae]),Ne=s.useMemo(()=>{const k=Qt(B,Pt(I),1);if(k===null)return null;const re=Vn(k);return Number.isNaN(re.getTime())?null:re},[B,ae]),Mt=()=>{if(o!==void 0){o.onStep("previous");return}pe!==null&&xe(pe)},be=()=>{if(o!==void 0){o.onStep("next");return}Ne!==null&&xe(Ne)},H=k=>{if(k.target.value){const re=Jc.parseISO(k.target.value);Number.isNaN(re.getTime())||xe(re)}},ee=I.getFullYear(),de=I.getMonth()+1,Ee=I.getDate(),ve=s.useCallback((k,re)=>_?_(re,k,"part"):Kl(re,k,"part",N),[_,N]),Ge=s.useMemo(()=>{if(D!=="split-dropdown"||A===null||Y===null)return[];const k=[];for(let re=Y.getFullYear();re>=A.getFullYear();re--)k.push({value:re,label:ve("year",Ro(re))});return k},[D,te,T,ve]),je=s.useMemo(()=>{if(D!=="split-dropdown"||A===null||Y===null)return[];const k=A,re=Y,Ce=ee===k.getFullYear()?k.getMonth()+1:1,Xe=ee===re.getFullYear()?re.getMonth()+1:12;return il(Ce,Xe,Ue=>dr(ee,Ue,1),(Ue,Dt)=>ec(Ue,ee,Dt),Ue=>ve("month",Ue))},[D,te,T,ee,ve]),Ke=s.useMemo(()=>{if(D!=="split-dropdown"||A===null||Y===null)return[];const k=A,re=Y,Ce=ee===k.getFullYear()&&de===k.getMonth()+1?k.getDate():1,Xe=ee===re.getFullYear()&&de===re.getMonth()+1?re.getDate():zd;return il(Ce,Xe,Ue=>dr(ee,de,Ue),(Ue,Dt)=>al(Ue,ee,de,Dt),Ue=>ve("day",Ue))},[D,te,T,ee,de,ve]),mt=(k,re,Ce)=>{const Xe=dr(k,re,Ce);return al(Xe,k,re,Ce)&&ie(Xe)},le=(k,re,Ce)=>{mt(k,re,Ce)&&xe(dr(k,re,Ce))},it=Ge.some(k=>k.value===ee),Fe=je.some(k=>k.value===de),ht=Ke.some(k=>k.value===Ee),Ye=Sn(I),nt=D==="dropdown"?_e("day",I,_,N):"",qe=A?Sn(A):void 0,gt=Y?Sn(Y):void 0,Oe="text-center font-mono text-gray-500 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-400",It=`period-slider-date-combobox-field ${jo} appearance-none rounded-md border border-gray-300 bg-gray-100 px-1 py-0.5 text-center font-mono text-gray-900 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`;return P.jsxs("div",{className:`inline-flex items-center ${Tn} ${E}`,style:j,"data-variant":D,"data-out-of-range":se?void 0:"true",children:[P.jsx(Ar,{neighbour:"control",direction:"left",glyph:x,disabled:p,canStep:o===void 0?pe!==null:o.canStepPrevious,onStep:Mt,ariaLabel:h.previousDay}),D==="dropdown"?P.jsx(Jl,{domain:ue,selectedIndex:se?ue.indexOf(I):$e,openAnchorIndex:ue.nearestIndexOf(I),displayLabel:nt,machineValue:Ye,disabled:p,ariaLabel:h.dateSelect,locale:d,labels:h,onCommitIndex:k=>xe(ue.dateAt(k)),controlClassName:It}):D==="split-dropdown"?P.jsxs("div",{className:"inline-flex items-center gap-1",children:[P.jsxs("select",{"aria-label":h.splitYear,disabled:p,className:`${Ln} rounded-md border border-gray-300 bg-gray-50 px-1 py-0.5 text-center font-mono text-gray-900 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:it?ee:"",onChange:k=>le(Number(k.target.value),de,Ee),children:[it?null:P.jsx("option",{value:"",disabled:!0,className:Oe,children:ve("year",Ro(ee))}),Ge.map(k=>P.jsx("option",{value:k.value,disabled:!mt(k.value,de,Ee),className:"dark:bg-slate-700 dark:text-slate-100",children:k.label},k.value))]}),P.jsxs("select",{"aria-label":h.splitMonth,disabled:p,className:`${Ln} rounded-md border border-gray-300 bg-gray-50 px-1 py-0.5 text-center font-mono text-gray-900 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:Fe?de:"",onChange:k=>le(ee,Number(k.target.value),Ee),children:[Fe?null:P.jsx("option",{value:"",disabled:!0,className:Oe,children:ve("month",dr(ee,de,1))}),je.map(k=>P.jsx("option",{value:k.value,disabled:!mt(ee,k.value,Ee),className:"dark:bg-slate-700 dark:text-slate-100",children:k.label},k.value))]}),P.jsxs("select",{"aria-label":h.splitDay,disabled:p,className:`${Ln} rounded-md border border-gray-300 bg-gray-50 px-1 py-0.5 text-center font-mono text-gray-900 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:ht?Ee:"",onChange:k=>le(ee,de,Number(k.target.value)),children:[ht?null:P.jsx("option",{value:"",disabled:!0,className:Oe,children:ve("day",dr(ee,de,Ee))}),Ke.map(k=>P.jsx("option",{value:k.value,disabled:!mt(ee,de,k.value),className:"dark:bg-slate-700 dark:text-slate-100",children:k.label},k.value))]})]}):P.jsx("input",{"aria-label":h.dateSelect,disabled:p,className:`period-slider-native-date-field ${jo} rounded-md border border-gray-300 bg-gray-100 px-1 py-0.5 text-center font-mono text-gray-900 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:Ye,min:qe,max:gt,onChange:H,type:"date"}),P.jsx(Ar,{neighbour:"control",direction:"right",glyph:x,disabled:p,canStep:o===void 0?Ne!==null:o.canStepNext,onStep:be,ariaLabel:h.nextDay}),i]})},Gd=(e,t)=>!(!Di(e,t,t.variant==="split-dropdown"?Bd:Li)||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.stepper===void 0!=(t.stepper===void 0)||e.value===void 0!=(t.value===void 0)||e.stepper?.onStep!==t.stepper?.onStep||e.stepper?.canStepPrevious!==t.stepper?.canStepPrevious||e.stepper?.canStepNext!==t.stepper?.canStepNext||e.stepGlyph!==t.stepGlyph||e.allowedDates!==t.allowedDates||e.children!==t.children||e.locale!==t.locale||!Xo(e.labels,t.labels)||e.formatLocale!==t.formatLocale||e.formatOption!==t.formatOption),tc=s.memo(Wd,Gd);tc.displayName="DateSelector";function Bn(e,t){const r=e+Math.floor(t/12),n=(t%12+12)%12,o=new Date(0);return o.setHours(0,0,0,0),o.setFullYear(r,n,1),o}function _n(e){const t=zn(e,"month",0);return ne("month",t===null?Number.NaN:t,0)}const rc=e=>oa(e,"month",0);function Cr(e){return`${ea(e.getFullYear())}-${String(e.getMonth()+1).padStart(2,"0")}`}const sl=Un("leave the bound out where the variant allows it, or declare the months to offer with minYear / maxYear or allowedMonths");function Do(e,t,r){e!==void 0&&nc(e,t,r)}function nc(e,t,r){if(!ye(e))throw new RangeError(`MonthSelector: ${t} must be a valid Date (received: ${R(e)})`);Ze("MonthSelector",t,e,"month",0,r)}function ll(e,t,r){if(e!==void 0){if(!Number.isInteger(e))throw new RangeError(`MonthSelector: ${t} must be an integer year (received: ${R(e)})`);if(Number.isNaN(Bn(e,r).getTime()))throw new RangeError(`MonthSelector: ${t} must name a year whose ${r===0?"January":"December"} starts inside the Date range (received: ${R(e)})`)}}function Kd(e,t){const r=e===void 0?null:Bn(e,0),n=t===void 0?null:_n(t);return r!==null&&n!==null?r>=n?r:n:r!==null?r:n}function qd(e,t){const r=e===void 0?null:Bn(e,11),n=t===void 0?null:_n(t);return r!==null&&n!==null?r<=n?r:n:r!==null?r:n}function fr(e){return e.getFullYear()*12+e.getMonth()}function si(e){return Bn(Math.floor(e/12),(e%12+12)%12)}function cl(e){return Number.isNaN(e.getTime())?null:e}function Xd(e,t,r){const n=new Map;for(const o of e){const a=_n(o);t!==null&&a<t||r!==null&&a>r||n.has(a.getTime())||n.set(a.getTime(),a)}return Array.from(n.values()).sort((o,a)=>o.getTime()-a.getTime())}function Zd(e,t){const r=[];for(let n=fr(e);n<=fr(t);n++)r.push(si(n));return r}function ul(e,t,r){const n=[];for(let o=e.length-1;o>=0;o--)n.push({label:_e("month",e[o],r,t),value:Cr(e[o])});return n}const Qd=e=>{const{value:t,initialDate:r,onChange:n,stepper:o,stepGlyph:a,children:i,variant:l="date",minYear:u,maxYear:f,minDate:m,maxDate:S,allowedMonths:D,isWarning:E=!1,className:j="",style:p,disabled:d=!1,locale:g,labels:N,formatLocale:_,formatOption:$}=e;if(_!==void 0&&na("MonthSelector","formatLocale",_),Do(t,"value",""),Do(r,"initialDate",""),Do(m,"minDate",sl),Do(S,"maxDate",sl),ll(u,"minYear",0),ll(f,"maxYear",11),an("MonthSelector","allowedMonths",D),D!==void 0)for(let le=0;le<D.length;le++)nc(D[le],`allowedMonths[${le}]`,"");const y=t??r;if(y===void 0)throw new RangeError("MonthSelector: either value (controlled) or initialDate (uncontrolled) is required; the selected month is never inferred from the wall clock");o!==void 0&&yi("MonthSelector",o,t!==void 0);const x=wi("MonthSelector",a),h=Zo(g,N),oe=t!==void 0,[ce,X]=Ei(y,oe,rc,_n),q=s.useMemo(()=>t!==void 0?_n(t):ce,[t?.getTime(),ce]),I=m?.getTime(),Q=S?.getTime(),W=s.useMemo(()=>Kd(u,m),[u,I]),A=s.useMemo(()=>qd(f,S),[f,Q]),Y=W?.getTime()??null,te=A?.getTime()??null;if(W!==null&&A!==null&&W>A)throw new RangeError(`MonthSelector: the resolved upper bound must not precede the resolved lower bound (lower: ${Cr(W)}, upper: ${Cr(A)})`);if(l==="dropdown"&&D===void 0&&(W===null||A===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 list is never invented');const T=D===void 0?null:D.map(le=>le.getTime()).join(","),C=s.useMemo(()=>D===void 0?null:Xd(D,W,A),[T,Y,te]),U=s.useMemo(()=>{if(C!==null){const le=C.map(fr);return{kind:"candidates",ascending:le,loIndex:0,hiIndex:le.length-1}}return{kind:"range",min:W===null?null:fr(W),max:A===null?null:fr(A)}},[C,Y,te]),z=le=>!Number.isNaN(le.getTime())&&In(U,fr(le)),ue=le=>{if(d)return;if(!z(le))throw new RangeError(`MonthSelector: refusing to emit ${Cr(le)}, which lies outside the selectable months`);oe||X(le);const it=le.getFullYear()*100+(le.getMonth()+1);n?.(le,it)},B=q.getTime(),ie=z(q),xe=s.useMemo(()=>{const le=Qt(U,fr(q),-1);return le===null?null:cl(si(le))},[U,B]),ae=s.useMemo(()=>{const le=Qt(U,fr(q),1);return le===null?null:cl(si(le))},[U,B]),se=()=>{if(o!==void 0){o.onStep("previous");return}xe!==null&&ue(xe)},pe=()=>{if(o!==void 0){o.onStep("next");return}ae!==null&&ue(ae)},Ne=le=>{if(!le)return;const it=le.lastIndexOf("-");if(it<=0)return;const Fe=le.slice(0,it),ht=le.slice(it+1),Ye=Number(Fe),nt=Number(ht)-1;if(!(Number.isInteger(Ye)&&Number.isInteger(nt)))return;const qe=Bn(Ye,nt);z(qe)&&ue(qe)},Mt=le=>{Ne(le.target.value)},be=le=>{Ne(le.target.value)},H=Cr(q),ee=l==="dropdown"&&!ie?_e("month",q,$,_):"",de=W?Cr(W):void 0,Ee=A?Cr(A):void 0,ve=s.useMemo(()=>l!=="dropdown"?[]:C!==null?ul(C,_,$):W===null||A===null?[]:ul(Zd(W,A),_,$),[l,C,Y,te,_,$]),Ge=ie?H:"",je=E?"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",Ke=`period-slider-native-date-field ${jo} rounded-md border py-0.5 px-1 text-center font-mono tabular-nums dark:placeholder:text-gray-400 disabled:opacity-50 ${je}`,mt=`${jo} appearance-none rounded-md border px-1 py-0.5 text-center font-mono tabular-nums [text-align-last:center] [text-align:center] disabled:opacity-50 ${je}`;return P.jsxs("div",{className:`inline-flex items-center ${Tn} ${j}`,style:p,"data-out-of-range":ie?void 0:"true",children:[P.jsx(Ar,{neighbour:"control",direction:"left",glyph:x,disabled:d,canStep:o===void 0?xe!==null:o.canStepPrevious,onStep:se,ariaLabel:h.previousMonth}),l==="dropdown"?P.jsxs("select",{"aria-label":h.monthSelect,disabled:d,className:mt,value:Ge,onChange:be,children:[ie?null:P.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:ee}),ve.map(le=>P.jsx("option",{value:le.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:le.label},le.value))]}):P.jsx("input",{"aria-label":h.monthSelect,disabled:d,className:Ke,value:H,min:de,max:Ee,onChange:Mt,type:"month"}),P.jsx(Ar,{neighbour:"control",direction:"right",glyph:x,disabled:d,canStep:o===void 0?ae!==null:o.canStepNext,onStep:pe,ariaLabel:h.nextMonth}),i]})},Jd=(e,t)=>!(!Di(e,t,rc)||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||e.allowedMonths!==t.allowedMonths||e.onChange!==t.onChange||e.stepper===void 0!=(t.stepper===void 0)||e.value===void 0!=(t.value===void 0)||e.stepper?.onStep!==t.stepper?.onStep||e.stepper?.canStepPrevious!==t.stepper?.canStepPrevious||e.stepper?.canStepNext!==t.stepper?.canStepNext||e.stepGlyph!==t.stepGlyph||e.children!==t.children||e.locale!==t.locale||!Xo(e.labels,t.labels)||e.formatLocale!==t.formatLocale||e.formatOption!==t.formatOption),oc=s.memo(Qd,Jd);oc.displayName="MonthSelector";const li=Symbol("nothing handed");let qa=0;class ef{constructor(t,r,n,o){this.states=t,this.base=r,this.superseded=n,this.setMark=o}states;base;superseded;setMark;drafts=new Map;handed=new Map;cells=new Set;notes=[];closed=!1;marked=!1;committed=!1;record(){this.marked||(this.marked=!0,this.setMark(this))}leadsTo(t){return t.every((r,n)=>r===(this.handed.has(n)?this.handed.get(n):this.states[n]))}read(t,r){return this.drafts.has(t)?this.drafts.get(t):r}write(t,r){this.drafts.set(t,r),this.cells.add(t),this.record()}hand(t,r){this.handed.set(t.slot,r),this.cells.add(t),this.record()}note(t){this.notes.push(t),this.record()}hasHanded(t){return this.handed.has(t)}lastHanded(t){return this.handed.get(t)}close(){this.closed=!0}}class tf{constructor(t,r,n){this.owner=t,this.setMark=n,this.slotWrites=r.map(()=>0),this.records=r.map(()=>li),this.latest=this.open(r)}owner;setMark;latest;active=null;slotWrites;records;outbox=[];duringRender=t=>{if(typeof t!="function")throw new TypeError(`${this.owner}: duringRender(action) must be a function (received: ${R(t)})`);const r=this.latest;if(r.closed)throw new Error(`${this.owner}: duringRender(action) must be called during the host's render, after the hook call (call the returned functions directly from event handlers and effects)`);const n=this.active;this.active=r,qa+=1;try{t()}finally{qa-=1,this.active=n}};get pass(){if(this.active===null&&qa>0)throw new Error(`${this.owner}: a returned function was called during another hook's duringRender(action); call it inside this hook's own duringRender(action)`);return this.active}inFlight(t){return!this.latest.committed&&this.latest.hasHanded(t)}handedTo(t){return this.records[t]}recordHanded(t,r){this.records[t]=r}begin(t,r){const n=this.latest;return!n.committed&&r===n&&n.leadsTo(t)?(n.closed&&(n.closed=!1,this.closeAtEndOfRun(n)),n):(n.close(),this.latest=this.open(t),this.latest)}open(t){const r=t.map((o,a)=>this.records[a]!==li&&this.records[a]!==o),n=new ef(t,[...this.slotWrites],r,this.setMark);return this.closeAtEndOfRun(n),n}closeAtEndOfRun(t){queueMicrotask(()=>t.close())}applies(t,r){return!t.superseded[r]&&t.base[r]===this.slotWrites[r]}commit(t,r){t.close(),t.committed=!0;for(const n of t.cells)this.applies(t,n.slot)&&n.adopt(t,r);for(const n of t.notes)this.applies(t,n.slot)&&this.outbox.push(n.send);this.outbox.length>0&&queueMicrotask(()=>this.deliver())}deliver(){for(let t=this.outbox.shift();t!==void 0;t=this.outbox.shift())t()}wrote(t){this.deliver(),this.slotWrites[t]+=1}notify(t,r){const n=this.pass;if(n!==null){n.note({slot:t,send:r});return}this.deliver(),r()}}class rf extends ql{constructor(t,r,n){super(t),this.scope=r,this.slot=n}scope;slot;adopted=null;get current(){const t=this.scope.pass;return t===null?super.current:t.read(this,super.current)}set current(t){const r=this.scope.pass;if(r!==null){r.write(this,t);return}this.scope.wrote(this.slot),super.current=t}hand(t){const r=this.scope.pass;if(r!==null){r.hand(this,t);return}this.adopted=null,this.scope.wrote(this.slot),this.scope.recordHanded(this.slot,t)}get holdsHanded(){const t=this.scope.pass;return t===null?this.scope.handedTo(this.slot)===super.current&&!this.scope.inFlight(this.slot):(t.hasHanded(this.slot)?t.lastHanded(this.slot):this.scope.handedTo(this.slot))===t.read(this,super.current)}forgetHanded(t){this.scope.wrote(this.slot),this.scope.handedTo(this.slot)===t&&this.scope.recordHanded(this.slot,li)}adopt(t,r){const n=r[this.slot];if(!t.hasHanded(this.slot)||n!==t.lastHanded(this.slot))return;this.scope.recordHanded(this.slot,n);const o=t.states[this.slot];n!==o&&(this.adopted={opening:o,handed:n})}recordAdopted(t){const r=this.adopted;r!==null&&(this.adopted=null,t(n=>n===r.opening?r.handed:n))}}class nf{constructor(t,r,n){this.scope=r,this.slot=n,this.held=t}scope;slot;held;get current(){const t=this.scope.pass;return t===null?this.held:t.read(this,this.held)}set current(t){const r=this.scope.pass;if(r!==null){r.write(this,t);return}this.scope.wrote(this.slot),this.held=t}adopt(t){this.held=t.read(this,this.held)}}const of=(e,t)=>t;function aa(e,t){const[r,n]=s.useReducer(of,null),[o]=s.useState(()=>new tf(e,t,n)),a=o.begin(t,r);return s.useInsertionEffect(()=>{o.commit(a,t)}),s.useLayoutEffect(()=>{o.deliver()}),o}function Qr(e,t,r,n){const o=Xl(r,a=>new rf(a,e,t));return s.useLayoutEffect(()=>{o.recordAdopted(n)}),o}function Jr(e,t,r){const[n]=s.useState(()=>new nf(r,e,t));return n}function ke(e,t,r){return e<t?t:e>r?r:e}const af=sn([],null,null);function Yn(e,t,r,n){return r===null?af:ci(r,F(t,e[0],n),F(t,e[1],n))}function Ir(e,t,r,n,o){const a=F(t,e,o),i=ui(n)?null:An(n,a);return i===null?a<F(t,r[0],o)?r[0]:a>F(t,r[1],o)?r[1]:e:i===a?e:ne(t,i,o)}function Xr(e,t,r,n,o,a){const i=F(t,e[0],o),l=F(t,e[1],o),u=To(a,{kind:"range",min:F(t,r[0],o),max:F(t,r[1],o)},i,l);if(u===null)return e;const f=Ir(u[0]===i?e[0]:ne(t,u[0],o),t,r,n,o),m=Ir(u[1]===l?e[1]:ne(t,u[1],o),t,r,n,o);return[f,m<f?f:m]}const dl=(e,t,r,n,o,a,i)=>{if(an(e,t,r),r===void 0||r.length===0)return null;const l=sn(Zl(e,t,r,n,i),F(n,o,i),F(n,a,i));if(l.hiIndex<l.loIndex)throw new RangeError(`${e}: every ${t} entry falls outside [minDate, maxDate] (minDate: ${R(o)}, maxDate: ${R(a)}, entries: ${r.length})`);return l},ci=(e,t,r)=>{const n=sn(e.ascending,t,r);return{kind:"candidates",ascending:e.ascending,loIndex:Math.max(e.loIndex,n.loIndex),hiIndex:Math.min(e.hiIndex,n.hiIndex)}},ui=e=>e.hiIndex<e.loIndex,sf=e=>({stepEnd:(t,r)=>{let n=null;for(const o of e){const a=Qt(o,t,r);a!==null&&(n===null||(r===1?a<n:a>n))&&(n=a)}return n},edge:t=>{let r=null;for(const n of e){const o=Cn(n,t);o!==null&&(r===null||(t===1?o>r:o<r))&&(r=o)}return r}}),Lt=(e,t)=>e[0].getTime()===t[0].getTime()&&e[1].getTime()===t[1].getTime(),fl=(e,t,r,n,o)=>{if(!Ot(r)||r.length!==2)throw new RangeError(`${e}: ${t} must be a [start, end] tuple of Dates (received: ${R(r)})`);const a=Xt(e,`${t}[0]`,r[0],n,o),i=Xt(e,`${t}[1]`,r[1],n,o);if(i<a)throw new RangeError(`${e}: ${t} must not be inverted at ${n} resolution (start: ${R(r[0])}, end: ${R(r[1])})`);return[a,i]},mr=e=>{const t="resolveVernierSelectorSteps";if(typeof e!="object"||e===null)throw new RangeError(`${t}: options must be an object (received: ${R(e)})`);const{row:r,shows:n,macroUnit:o,microUnit:a,minDate:i,maxDate:l,macroRange:u,microSelection:f}=e;if(r!=="macro"&&r!=="micro")throw new RangeError(`${t}: row must be "macro" or "micro" (received: ${R(r)})`);if(n!=="start"&&n!=="end")throw new RangeError(`${t}: shows must be "start" or "end" (received: ${R(n)})`);Te(t,"macroUnit",o),Te(t,"microUnit",a);const m=wr(t,e.yearStartMonth);for(const[I,Q]of[["minDate",i],["maxDate",l]])if(!ye(Q))throw new RangeError(`${t}: ${I} must be a valid Date (received: ${R(Q)})`);if(l.getTime()<=i.getTime())throw new RangeError(`${t}: maxDate must be strictly later than minDate (minDate: ${R(i)}, maxDate: ${R(l)})`);Xt(t,"minDate",i,o,m),Xt(t,"minDate",i,a,m),kr(t,"rules",e.rules,r==="macro"?"motion":"vernierRange");const S=fl(t,"macroRange",u,o,m);if(u[1].getTime()<u[0].getTime())throw new RangeError(`${t}: macroRange must not be inverted (start: ${R(u[0])}, end: ${R(u[1])})`);const D=fl(t,"microSelection",f,a,m),E=dl(t,"macroAllowedDates",e.macroAllowedDates,o,i,l,m),j=dl(t,"microAllowedDates",e.microAllowedDates,a,i,l,m),p=[u[0],u[1]],d=[f[0],f[1]],g=I=>{const Q=Ct(o,a,[I[0],I[1]],i,l,m);return[F(a,Q[0],m),F(a,Q[1],m)]},N=(I,Q)=>{if(j!==null){const W=ci(j,I,Q);if(!ui(W))return W}return{kind:"range",min:I,max:Q}},_=(I,Q)=>{const W=Lt(I,p)?p:I;return W===p&&Lt(Q,d)?null:{macroRange:W,microSelection:Q}};if(e.row==="macro"){const I=E??{kind:"range",min:F(o,i,m),max:F(o,l,m)},Q=Lo(I),W=(Y,te)=>{const T=Ct(o,a,Y,i,l,m);return Xr(d,a,T,Yn(T,a,j,m),m,te)},A=(Y,te)=>{const T=Qa(Q,S[0],S[1],Y,ni(te,n));if(T===null)return null;const C=oi(T,S,p,o,m,te.motion==="single");if(C===null)return null;const U=[ke(C[0],i,l),ke(C[1],i,l)],z=Math.sign(T[0]-S[0])===Y&&Math.sign(T[1]-S[1])===Y;return _(U,W(U,z?"pan":"resize"))};return{previous:A(-1,e.rules.previous),next:A(1,e.rules.next)}}const $=g(p);let y=[F(a,i,m),F(a,l,m)];if(E!==null){const I=g([ne(o,E.ascending[E.loIndex],m),ne(o,E.ascending[E.hiIndex],m)]);y=[Math.min(I[0],$[0]),Math.max(I[1],$[1])]}const x=j===null?null:ci(j,y[0],y[1]);let h=Lo({kind:"range",min:y[0],max:y[1]});if(x!==null&&!ui(x)){const I=N($[0],$[1]);h=I.kind==="candidates"?Lo(x):sf([x,I])}const oe=I=>{if(E===null)return[ke(Rt(o,I[0],m),i,l),ke(Rt(o,I[1],m),i,l)];const Q=Po(E,F(o,I[0],m),-1),W=Po(E,F(o,I[1],m),1);return Q===null||W===null?null:[ke(ne(o,Q,m),i,l),ke(ne(o,W,m),i,l)]},ce=(I,Q,W)=>{const[A,Y]=g(I),te=N(A,Y),T=z=>{const ue=F(a,z,m);if(In(te,ue))return z;const B=Po(te,ue,W);return B===null?null:ne(a,B,m)},C=T(Q[0]),U=T(Q[1]);return C===null||U===null?null:[C,U.getTime()<C.getTime()?C:U]},X=(I,Q)=>I>=$[0]&&Q<=$[1],q=(I,Q)=>{const W=Qa(h,D[0],D[1],I,ni(Q,n));if(W===null)return null;const A=oi(W,D,d,a,m,Q.motion==="single");if(A===null)return null;const Y=Q.window!=="follow",te=Y&&X(W[0],W[1])?p:oe(A);if(te===null)return null;const T=ce(te,A,I);if(T===null)return null;const C=Y&&X(F(a,T[0],m),F(a,T[1],m))?p:oe(T);return C===null?null:_(C,T)};return{previous:q(-1,e.rules.previous),next:q(1,e.rules.next)}};function di(e,t,r){if(!ye(r))throw new RangeError(`${e}: ${t} is required and must be a valid Date (received: ${R(r)})`)}function Pe(e,t,r,n,o){di(e,t,r),Ze(e,t,r,n,o,"")}function ia(e,t,r,n,o){if(di(e,"minDate",t),di(e,"maxDate",r),r.getTime()<=t.getTime())throw new RangeError(`${e}: maxDate must be strictly later than minDate (minDate: ${R(t)}, maxDate: ${R(r)})`);for(const a of n)Ze(e,"minDate",t,a,o,Pl)}function hr(e,t,r,n,o){if(!Ot(r)||r.length!==2)throw new RangeError(`${e}: ${t} is required and must be a [lower, upper] Date tuple (received: ${R(r)})`);if(Pe(e,`${t}[0]`,r[0],n,o),Pe(e,`${t}[1]`,r[1],n,o),r[0].getTime()>r[1].getTime())throw new RangeError(`${e}: ${t} upper must not be earlier than lower (lower: ${R(r[0])}, upper: ${R(r[1])})`)}function Fo(e,t,r,n,o,a,i,l){const u=F(r,n,l);if(u<F(r,o,l)||u>F(r,a,l))throw new RangeError(`${e}: ${t} must lie within ${i} (value: ${R(n)}, lower: ${R(o)}, upper: ${R(a)})`)}function Uo(e,t,r,n,o,a,i,l){Fo(e,`${t}[0]`,r,n[0],o,a,i,l),Fo(e,`${t}[1]`,r,n[1],o,a,i,l)}function zo(e,t,r,n){if(n.getTime()<r.getTime())throw new RangeError(`${e}: ${t}(upper) must not be earlier than lower (lower: ${R(r)}, upper: ${R(n)})`)}function en(e,t,r){if(!Number.isInteger(r))throw new RangeError(`${e}: ${t}(delta) must be an integer number of units (received: ${R(r)})`)}function zt(e,t,r,n,o,a){const i=Ll(e,t,r);return ye(i)&&zn(i,e,a)!==null?{date:i,pastDateRange:!1}:{date:r>0?o:n,pastDateRange:!0}}function Bo(e,t,r,n,o){const a=De(e,r,t,o)+n;return e[Math.max(0,Math.min(e.length-1,a))]}function $n(e,t,r,n,o,a){const i=ke(e,r,n);if(o.length===0)return i;const l=o[De(o,i,t,a)];return F(t,l,a)===F(t,i,a)?i:ke(l,r,n)}function Xa(e,t,r,n,o,a){const i=$n(e[0],t,r,n,o,a),l=$n(e[1],t,r,n,o,a);return[i,l<i?i:l]}function Hn(e,t){return t[0]===e[0]&&t[1]===e[1]?e:t}const lf={year:"allowedYears",month:"allowedMonths",day:"allowedDates"};function Bt(e,t){return t.length===0?{}:{[lf[e]]:t}}function sa(e){const t=s.useRef(e),r=t.current,n=e,o=Object.keys(r),a=Object.keys(n);return o.length===a.length&&a.every(l=>Object.is(r[l],n[l]))||(t.current=e),t.current}const Zt={previous:null,next:null},cf=["motion","edge","window"];function jn(e){const t=s.useRef(e),r=t.current;return r===e||r!==void 0&&e!==void 0&&["previous","next"].every(o=>cf.every(a=>r[o][a]===e[o][a]))||(t.current=e),t.current}const ko=(e,t)=>e.getTime()===t.getTime();function tn(e,t,r,n){if(!r(e.current,t))e.current=t;else if(e.holdsHanded)return;e.hand(e.current),n(e.current)}function rn(e,t,r){e.current=t,e.hand(t),r(t)}function uf(e,t){return typeof t=="function"?t(e):t}function nn(e){return s.useReducer(uf,void 0,e)}function on(e,t,r,n){r===t||e.current!==r||(e.forgetHanded(t),n(o=>o===t?r:o))}function df(e){const{unit:t,minDate:r,maxDate:n,initialRange:o,onChangeRange:a,yearStartMonth:i,formatOption:l,selectorStep:u,...f}=e;Te("usePeriodSliderRange","unit",t);const m=wr("usePeriodSliderRange",i);ia("usePeriodSliderRange",r,n,[t],m),hr("usePeriodSliderRange","initialRange",o,t,m),u!==void 0&&kr("usePeriodSliderRange","selectorStep",u,"motion");const S=sa(f),D=r.getTime(),E=n.getTime(),j=s.useMemo(()=>pr("usePeriodSliderRange",ta(S.allowedDates),t,r,n,m).dates,[S.allowedDates,t,D,E,m]),p=s.useRef(o),[d,g]=nn(()=>(Uo("usePeriodSliderRange","initialRange",t,o,r,n,"[minDate, maxDate]",m),Hn(o,Xa(o,t,r,n,j,m)))),N=aa("usePeriodSliderRange",[d]);hr("usePeriodSliderRange","range",d,t,m);const _=Hn(d,Xa(d,t,r,n,j,m)),$=Qr(N,0,_,g);s.useLayoutEffect(()=>{on($,d,_,g)});const y=Jr(N,0,o),x=dt({minDate:r,maxDate:n,candidates:j}),h=dt(a),oe=s.useCallback(B=>{const{minDate:ie,maxDate:xe,candidates:ae}=x.current,se=Xa(B,t,ie,xe,ae,m);tn($,se,Lt,g);const pe=y.current;se[0].getTime()===pe[0].getTime()&&se[1].getTime()===pe[1].getTime()||(y.current=se,N.notify(0,()=>h.current?.(se[0],se[1])))},[t,m]),ce=s.useCallback(B=>{const ie=typeof B=="function"?B($.current):B;y.current=ie,rn($,ie,g)},[]),X=s.useCallback(B=>{Pe("usePeriodSliderRange","setLowerDate(date)",B,t,m);const ie=$.current,xe=B.getTime()>ie[1].getTime()?B:ie[1];oe([B,xe])},[oe,t,m]),q=s.useCallback(B=>{Pe("usePeriodSliderRange","setUpperDate(date)",B,t,m);const ie=$.current,xe=B.getTime()<ie[0].getTime()?B:ie[0];oe([xe,B])},[oe,t,m]),I=s.useCallback((B,ie)=>{Pe("usePeriodSliderRange","sliderProps.onChangeRange(lower)",B,t,m),Pe("usePeriodSliderRange","sliderProps.onChangeRange(upper)",ie,t,m),zo("usePeriodSliderRange","sliderProps.onChangeRange",B,ie),oe([B,ie])},[oe,t,m]),Q=s.useCallback(B=>{en("usePeriodSliderRange","shiftRange",B);const{minDate:ie,maxDate:xe,candidates:ae}=x.current,se=$.current;if(ae.length>0){oe([Bo(ae,t,se[0],B,m),Bo(ae,t,se[1],B,m)]);return}oe([zt(t,se[0],B,ie,xe,m).date,zt(t,se[1],B,ie,xe,m).date])},[t,oe,m]),W=s.useCallback(()=>{oe(p.current)},[oe]),A=jn(u),Y=A!==void 0,te=s.useMemo(()=>{if(A===void 0)return{start:Zt,end:Zt};const B=j.length>0?S.allowedDates:void 0,ie={selection:_,unit:t,yearStartMonth:m,minDate:r,maxDate:n,allowedDates:B,rules:A};return{start:ai({...ie,shows:"start"}),end:ai({...ie,shows:"end"})}},[A,_,t,m,D,E,j,S.allowedDates]),T=Ut(te.start,oe),C=Ut(te.end,oe),U=s.useMemo(()=>({value:_[0],onChange:X,minDate:r,maxDate:_[1],unit:t,yearStartMonth:m,...Bt(t,j),formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:l,...Y?{stepper:T}:{}}),[_[0],_[1],X,r,t,m,j,e.formatLocale,e.locale,e.labels,l,Y,T]),z=s.useMemo(()=>({value:_[1],onChange:q,minDate:_[0],maxDate:n,unit:t,yearStartMonth:m,...Bt(t,j),formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:l,...Y?{stepper:C}:{}}),[_[0],_[1],q,n,t,m,j,e.formatLocale,e.locale,e.labels,l,Y,C]),ue=s.useMemo(()=>({...S,mode:"range",unit:t,yearStartMonth:m,range:_,minDate:r,maxDate:n,onChangeRange:I}),[S,t,_,r,n,I,m]);return{range:_,lowerDate:_[0],upperDate:_[1],setRange:ce,setLowerDate:X,setUpperDate:q,shiftRange:Q,resetRange:W,startSelectorProps:U,endSelectorProps:z,sliderProps:ue,duringRender:N.duringRender}}function ff(e){const{unit:t,minDate:r,maxDate:n,initialValue:o,onChangePoint:a,yearStartMonth:i,formatOption:l,...u}=e;Te("usePeriodSliderPoint","unit",t);const f=wr("usePeriodSliderPoint",i);ia("usePeriodSliderPoint",r,n,[t],f),Pe("usePeriodSliderPoint","initialValue",o,t,f);const m=sa(u),S=r.getTime(),D=n.getTime(),E=s.useMemo(()=>pr("usePeriodSliderPoint",ta(m.allowedDates),t,r,n,f).dates,[m.allowedDates,t,S,D,f]),j=s.useRef(o),[p,d]=nn(()=>(Fo("usePeriodSliderPoint","initialValue",t,o,r,n,"[minDate, maxDate]",f),$n(o,t,r,n,E,f))),g=aa("usePeriodSliderPoint",[p]);Pe("usePeriodSliderPoint","value",p,t,f);const N=$n(p,t,r,n,E,f),_=Qr(g,0,N,d);s.useLayoutEffect(()=>{on(_,p,N,d)});const $=Jr(g,0,o),y=dt({minDate:r,maxDate:n,candidates:E}),x=dt(a),h=s.useCallback(A=>{const{minDate:Y,maxDate:te,candidates:T}=y.current,C=$n(A,t,Y,te,T,f);tn(_,C,ko,d),C.getTime()!==$.current.getTime()&&($.current=C,g.notify(0,()=>x.current?.(C)))},[t,f]),oe=s.useCallback(A=>{const Y=typeof A=="function"?A(_.current):A;$.current=Y,rn(_,Y,d)},[]),ce=s.useCallback(A=>{Pe("usePeriodSliderPoint","selectorProps.onChange(date)",A,t,f),h(A)},[h,t,f]),X=s.useCallback(A=>{Pe("usePeriodSliderPoint","sliderProps.onChangePoint(value)",A,t,f),h(A)},[h,t,f]),q=s.useCallback(A=>{en("usePeriodSliderPoint","shiftValue",A);const{minDate:Y,maxDate:te,candidates:T}=y.current;if(T.length>0){h(Bo(T,t,_.current,A,f));return}h(zt(t,_.current,A,Y,te,f).date)},[t,h,f]),I=s.useCallback(()=>{h(j.current)},[h]),Q=s.useMemo(()=>({value:N,onChange:ce,minDate:r,maxDate:n,unit:t,yearStartMonth:f,...Bt(t,E),formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:l}),[N,ce,r,n,t,f,E,e.formatLocale,e.locale,e.labels,l]),W=s.useMemo(()=>({...m,mode:"point",unit:t,yearStartMonth:f,value:N,minDate:r,maxDate:n,onChangePoint:X}),[m,t,N,r,n,X,f]);return{value:N,setValue:oe,shiftValue:q,resetValue:I,selectorProps:Q,sliderProps:W,duringRender:g.duringRender}}function mf(e){const{unit:t,minDate:r,maxDate:n,initialMacroRange:o,initialMicroRange:a,macroUnit:i,microUnit:l,onChangeMacroRange:u,onChangeMicroRange:f,yearStartMonth:m,formatOption:S,macroSelectorStep:D,microSelectorStep:E,...j}=e;Te("useVernierSliderRange","unit",t);const p=Jt("useVernierSliderRange","macroUnit",i,t),d=Jt("useVernierSliderRange","microUnit",l,t),g=wr("useVernierSliderRange",m);ia("useVernierSliderRange",r,n,[p,d,t],g),hr("useVernierSliderRange","initialMacroRange",o,p,g),hr("useVernierSliderRange","initialMicroRange",a,d,g),D!==void 0&&kr("useVernierSliderRange","macroSelectorStep",D,"motion"),E!==void 0&&kr("useVernierSliderRange","microSelectorStep",E,"vernierRange");const N=sa(j),_=s.useRef(o),$=s.useRef(a),[y,x]=nn(()=>(Uo("useVernierSliderRange","initialMacroRange",p,o,r,n,"[minDate, maxDate]",g),o)),[h,oe]=nn(()=>{const M=Ct(p,d,o,r,n,g);return Uo("useVernierSliderRange","initialMicroRange",d,a,M[0],M[1],"the initial macro window",g),a}),ce=aa("useVernierSliderRange",[y,h]);hr("useVernierSliderRange","macroRange",y,p,g);const X=Hn(y,[ke(y[0],r,n),ke(y[1],r,n)]),q=r.getTime(),I=n.getTime(),Q=s.useMemo(()=>Ct(p,d,X,r,n,g),[p,d,X,q,I,g]),W=s.useMemo(()=>Ft("micro",N)?Si("useVernierSliderRange",Tt("micro",N),d,r,n,g):null,[N.microIsDiscrete,N.microAllowedDates,N.allowedDates,d,q,I,g]),A=s.useMemo(()=>Ft("macro",N)?pr("useVernierSliderRange",Tt("macro",N),p,r,n,g).dates:[],[N.macroIsDiscrete,N.macroAllowedDates,N.allowedDates,p,q,I,g]),Y=dt(A),te=s.useMemo(()=>Yn(Q,d,W,g),[Q,d,W,g]),T=s.useMemo(()=>Nn(W,te),[W,te]);hr("useVernierSliderRange","microRange",h,d,g);const C=Hn(h,Xr(h,d,Q,te,g,"resize")),U=Qr(ce,0,X,x),z=Qr(ce,1,C,oe);s.useLayoutEffect(()=>{on(U,y,X,x),on(z,h,C,oe)});const ue=Jr(ce,1,a),B=Jr(ce,0,o),ie=dt({minDate:r,maxDate:n}),xe=dt(u),ae=dt(f),se=s.useCallback(M=>{const{minDate:K,maxDate:me}=ie.current;return Ct(p,d,M,K,me,g)},[p,d,g]),pe=s.useCallback(M=>Yn(M,d,W,g),[d,W,g]),Ne=s.useCallback(M=>{tn(U,M,Lt,x);const K=B.current;M[0].getTime()===K[0].getTime()&&M[1].getTime()===K[1].getTime()||(B.current=M,ce.notify(0,()=>xe.current?.(M[0],M[1])))},[]),Mt=s.useCallback(M=>{const K=typeof M=="function"?M(U.current):M;B.current=K,rn(U,K,x)},[]),be=s.useCallback((M,K,me)=>{const Le=me==="micro"&&Lt(U.current,M)&&Lt(B.current,M),Me=me==="macro"&&Lt(z.current,K)&&Lt(ue.current,K);if(Le||Ne(M),Me)return;tn(z,K,Lt,oe);const ze=ue.current;(K[0].getTime()!==ze[0].getTime()||K[1].getTime()!==ze[1].getTime())&&(ue.current=K,ce.notify(1,()=>ae.current?.(K[0],K[1])))},[Ne]),H=s.useCallback(M=>{const K=typeof M=="function"?M(z.current):M;ue.current=K,rn(z,K,oe)},[]),ee=s.useCallback((M,K,me)=>{const{minDate:Le,maxDate:Me}=ie.current,ze=[ke(M,Le,Me),ke(K,Le,Me)],Qe=se(ze);be(ze,Xr(z.current,d,Qe,pe(Qe),g,me),"macro")},[d,se,pe,be,g]),de=s.useCallback((M,K)=>ee(M,K,"resize"),[ee]),Ee=s.useCallback((M,K)=>{Pe("useVernierSliderRange","sliderProps.onChangeMacroRange(lower)",M,p,g),Pe("useVernierSliderRange","sliderProps.onChangeMacroRange(upper)",K,p,g),zo("useVernierSliderRange","sliderProps.onChangeMacroRange",M,K);const{minDate:me,maxDate:Le}=ie.current,Me=[ke(M,me,Le),ke(K,me,Le)],ze=z.current,Qe=se(Me),st=Xr(ze,d,Qe,pe(Qe),g,"resize");if(st[0].getTime()!==ze[0].getTime()||st[1].getTime()!==ze[1].getTime()){Ne(Me);return}be(Me,ze,"macro")},[p,d,se,pe,Ne,be,g]),ve=s.useCallback((M,K)=>{const me=se(U.current);be(U.current,Xr([M,K],d,me,pe(me),g,"resize"),"micro")},[d,se,pe,be,g]),Ge=s.useCallback((M,K)=>{Pe("useVernierSliderRange","sliderProps.onChangeMicroRange(lower)",M,d,g),Pe("useVernierSliderRange","sliderProps.onChangeMicroRange(upper)",K,d,g),zo("useVernierSliderRange","sliderProps.onChangeMicroRange",M,K),ve(M,K)},[ve,d,g]),je=s.useCallback(M=>{Pe("useVernierSliderRange","setMacroLowerDate(date)",M,p,g);const K=U.current[1],me=M>K?M:K;de(M,me)},[de,p,g]),Ke=s.useCallback(M=>{Pe("useVernierSliderRange","setMacroUpperDate(date)",M,p,g);const K=U.current[0],me=M<K?M:K;de(me,M)},[de,p,g]),mt=s.useCallback(M=>{Pe("useVernierSliderRange","setMicroLowerDate(date)",M,d,g);const K=z.current[1],me=M>K?M:K;ve(M,me)},[ve,d,g]),le=s.useCallback(M=>{Pe("useVernierSliderRange","setMicroUpperDate(date)",M,d,g);const K=z.current[0],me=M<K?M:K;ve(me,M)},[ve,d,g]),it=s.useCallback(M=>{en("useVernierSliderRange","shiftMacroRange",M);const{minDate:K,maxDate:me}=ie.current,Le=U.current,Me=Y.current;if(Me.length>0){const st=De(Me,Le[0],p,g)+M,vt=De(Me,Le[1],p,g)+M;if(st<0||vt>Me.length-1)return;ee(Me[st],Me[vt],"pan");return}const ze=zt(p,Le[0],M,K,me,g),Qe=zt(p,Le[1],M,K,me,g);ze.pastDateRange||Qe.pastDateRange||ze.date<K||Qe.date>me||ee(ze.date,Qe.date,"pan")},[p,ee,g]),Fe=s.useCallback(M=>{en("useVernierSliderRange","shiftMicroRange",M);const K=U.current,me=z.current,Le=se(K),[Me,ze]=Le,Qe=Nn(W,pe(Le));if(Qe.length>0){const Wn=De(Qe,me[0],d,g)+M,Gn=De(Qe,me[1],d,g)+M;if(Wn<0||Gn>Qe.length-1)return;ve(Qe[Wn],Qe[Gn]);return}const st=zt(d,me[0],M,Me,ze,g),vt=zt(d,me[1],M,Me,ze,g);st.pastDateRange||vt.pastDateRange||F(d,st.date,g)<F(d,Me,g)||F(d,vt.date,g)>F(d,ze,g)||ve(st.date,vt.date)},[d,W,se,pe,ve,g]),ht=s.useCallback(()=>{const{minDate:M,maxDate:K}=ie.current,me=[ke(_.current[0],M,K),ke(_.current[1],M,K)],Le=se(me);be(me,Xr($.current,d,Le,pe(Le),g,"resize"),"both")},[d,se,pe,be,g]),Ye=jn(D),nt=jn(E),qe=Ye!==void 0,gt=nt!==void 0,Oe=s.useMemo(()=>{const M={macroUnit:p,microUnit:d,yearStartMonth:g,minDate:r,maxDate:n,macroRange:X,microSelection:C,macroAllowedDates:Ft("macro",N)?Tt("macro",N).list:void 0,microAllowedDates:Ft("micro",N)?Tt("micro",N).list:void 0};return{macroStart:Ye===void 0?Zt:mr({...M,row:"macro",shows:"start",rules:Ye}),macroEnd:Ye===void 0?Zt:mr({...M,row:"macro",shows:"end",rules:Ye}),microStart:nt===void 0?Zt:mr({...M,row:"micro",shows:"start",rules:nt}),microEnd:nt===void 0?Zt:mr({...M,row:"micro",shows:"end",rules:nt})}},[Ye,nt,p,d,g,q,I,X,C,N.macroIsDiscrete,N.macroAllowedDates,N.microIsDiscrete,N.microAllowedDates,N.allowedDates]),It=s.useCallback(M=>be(M.macroRange,M.microSelection,"macro"),[be]),k=s.useCallback(M=>be(M.macroRange,M.microSelection,"micro"),[be]),re=Ut(Oe.macroStart,It),Ce=Ut(Oe.macroEnd,It),Xe=Ut(Oe.microStart,k),Ue=Ut(Oe.microEnd,k),[Dt,er]=Q,Ve=s.useMemo(()=>({value:X[0],onChange:je,minDate:r,maxDate:X[1],unit:p,yearStartMonth:g,...Bt(p,A),formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:S,...qe?{stepper:re}:{}}),[X,je,r,p,g,A,e.formatLocale,e.locale,e.labels,S,qe,re]),L=s.useMemo(()=>({value:X[1],onChange:Ke,minDate:X[0],maxDate:n,unit:p,yearStartMonth:g,...Bt(p,A),formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:S,...qe?{stepper:Ce}:{}}),[X,Ke,n,p,g,A,e.formatLocale,e.locale,e.labels,S,qe,Ce]),fe=s.useMemo(()=>({value:C[0],onChange:mt,minDate:Dt,maxDate:C[1],unit:d,yearStartMonth:g,...Bt(d,T),formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:S,...gt?{stepper:Xe}:{}}),[C,mt,Dt,d,g,T,e.formatLocale,e.locale,e.labels,S,gt,Xe]),we=s.useMemo(()=>({value:C[1],onChange:le,minDate:C[0],maxDate:er,unit:d,yearStartMonth:g,...Bt(d,T),formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:S,...gt?{stepper:Ue}:{}}),[C,le,er,d,g,T,e.formatLocale,e.locale,e.labels,S,gt,Ue]),V=s.useMemo(()=>({...N,mode:"vernier",unit:t,yearStartMonth:g,macroUnit:p,microUnit:d,minDate:r,maxDate:n,macroRange:X,microRange:C,onChangeMacroRange:Ee,onChangeMicroRange:Ge}),[N,t,p,d,r,n,X,C,Ee,Ge,g]);return{macroRange:X,setMacroRange:Mt,microRange:C,setMicroRange:H,setMacroLowerDate:je,setMacroUpperDate:Ke,setMicroLowerDate:mt,setMicroUpperDate:le,shiftMacroRange:it,shiftMicroRange:Fe,resetVernier:ht,macroStartSelectorProps:Ve,macroEndSelectorProps:L,microStartSelectorProps:fe,microEndSelectorProps:we,sliderProps:V,duringRender:ce.duringRender}}function hf(e){const{unit:t,minDate:r,maxDate:n,initialMacroRange:o,initialMicroValue:a,macroUnit:i,microUnit:l,onChangeMacroRange:u,onChangeMicroPoint:f,yearStartMonth:m,formatOption:S,macroSelectorStep:D,microSelectorStep:E,...j}=e;Te("useVernierSliderPoint","unit",t);const p=Jt("useVernierSliderPoint","macroUnit",i,t),d=Jt("useVernierSliderPoint","microUnit",l,t),g=wr("useVernierSliderPoint",m);ia("useVernierSliderPoint",r,n,[p,d,t],g),hr("useVernierSliderPoint","initialMacroRange",o,p,g),Pe("useVernierSliderPoint","initialMicroValue",a,d,g),D!==void 0&&kr("useVernierSliderPoint","macroSelectorStep",D,"motion"),E!==void 0&&kr("useVernierSliderPoint","microSelectorStep",E,"vernierPoint");const N=sa(j),_=s.useRef(o),$=s.useRef(a),[y,x]=nn(()=>(Uo("useVernierSliderPoint","initialMacroRange",p,o,r,n,"[minDate, maxDate]",g),o)),[h,oe]=nn(()=>{const L=Ct(p,d,o,r,n,g);return Fo("useVernierSliderPoint","initialMicroValue",d,a,L[0],L[1],"the initial macro window",g),a}),ce=aa("useVernierSliderPoint",[y,h]);hr("useVernierSliderPoint","macroRange",y,p,g);const X=Hn(y,[ke(y[0],r,n),ke(y[1],r,n)]),q=r.getTime(),I=n.getTime(),Q=s.useMemo(()=>Ct(p,d,X,r,n,g),[p,d,X,q,I,g]),W=s.useMemo(()=>Ft("micro",N)?Si("useVernierSliderPoint",Tt("micro",N),d,r,n,g):null,[N.microIsDiscrete,N.microAllowedDates,N.allowedDates,d,q,I,g]),A=s.useMemo(()=>Ft("macro",N)?pr("useVernierSliderPoint",Tt("macro",N),p,r,n,g).dates:[],[N.macroIsDiscrete,N.macroAllowedDates,N.allowedDates,p,q,I,g]),Y=dt(A),te=s.useMemo(()=>Yn(Q,d,W,g),[Q,d,W,g]),T=s.useMemo(()=>Nn(W,te),[W,te]);Pe("useVernierSliderPoint","microValue",h,d,g);const C=Ir(h,d,Q,te,g),U=Qr(ce,0,X,x),z=Qr(ce,1,C,oe);s.useLayoutEffect(()=>{on(U,y,X,x),on(z,h,C,oe)});const ue=Jr(ce,1,a),B=Jr(ce,0,o),ie=dt({minDate:r,maxDate:n}),xe=dt(u),ae=dt(f),se=s.useCallback(L=>{const{minDate:fe,maxDate:we}=ie.current;return Ct(p,d,L,fe,we,g)},[p,d,g]),pe=s.useCallback(L=>Yn(L,d,W,g),[d,W,g]),Ne=s.useCallback(L=>{tn(U,L,Lt,x);const fe=B.current;L[0].getTime()===fe[0].getTime()&&L[1].getTime()===fe[1].getTime()||(B.current=L,ce.notify(0,()=>xe.current?.(L[0],L[1])))},[]),Mt=s.useCallback(L=>{const fe=typeof L=="function"?L(U.current):L;B.current=fe,rn(U,fe,x)},[]),be=s.useCallback((L,fe,we)=>{const V=we==="micro"&&Lt(U.current,L)&&Lt(B.current,L),M=we==="macro"&&ko(z.current,fe)&&ko(ue.current,fe);V||Ne(L),!M&&(tn(z,fe,ko,oe),fe.getTime()!==ue.current.getTime()&&(ue.current=fe,ce.notify(1,()=>ae.current?.(fe))))},[Ne]),H=s.useCallback(L=>{const fe=typeof L=="function"?L(z.current):L;ue.current=fe,rn(z,fe,oe)},[]),ee=s.useCallback((L,fe)=>{const{minDate:we,maxDate:V}=ie.current,M=[ke(L,we,V),ke(fe,we,V)],K=se(M);be(M,Ir(z.current,d,K,pe(K),g),"macro")},[d,se,pe,be,g]),de=s.useCallback(L=>{const fe=se(U.current);be(U.current,Ir(L,d,fe,pe(fe),g),"micro")},[d,se,pe,be,g]),Ee=s.useCallback((L,fe)=>{Pe("useVernierSliderPoint","sliderProps.onChangeMacroRange(lower)",L,p,g),Pe("useVernierSliderPoint","sliderProps.onChangeMacroRange(upper)",fe,p,g),zo("useVernierSliderPoint","sliderProps.onChangeMacroRange",L,fe);const{minDate:we,maxDate:V}=ie.current,M=[ke(L,we,V),ke(fe,we,V)],K=z.current,me=se(M);if(Ir(K,d,me,pe(me),g).getTime()!==K.getTime()){Ne(M);return}be(M,K,"macro")},[p,d,se,pe,Ne,be,g]),ve=s.useCallback(L=>{Pe("useVernierSliderPoint","sliderProps.onChangeMicroPoint(value)",L,d,g),de(L)},[de,d,g]),Ge=s.useCallback(L=>{Pe("useVernierSliderPoint","setMacroLowerDate(date)",L,p,g);const fe=U.current[1],we=L>fe?L:fe;ee(L,we)},[ee,p,g]),je=s.useCallback(L=>{Pe("useVernierSliderPoint","setMacroUpperDate(date)",L,p,g);const fe=U.current[0],we=L<fe?L:fe;ee(we,L)},[ee,p,g]),Ke=s.useCallback(L=>{Pe("useVernierSliderPoint","setMicroDate(date)",L,d,g),de(L)},[de,d,g]),mt=s.useCallback(L=>{en("useVernierSliderPoint","shiftMacroRange",L);const{minDate:fe,maxDate:we}=ie.current,V=U.current,M=Y.current;if(M.length>0){const Le=De(M,V[0],p,g)+L,Me=De(M,V[1],p,g)+L;if(Le<0||Me>M.length-1)return;ee(M[Le],M[Me]);return}const K=zt(p,V[0],L,fe,we,g),me=zt(p,V[1],L,fe,we,g);K.pastDateRange||me.pastDateRange||K.date<fe||me.date>we||ee(K.date,me.date)},[p,ee,g]),le=s.useCallback(L=>{en("useVernierSliderPoint","shiftMicroValue",L);const fe=U.current,we=se(fe),V=Nn(W,pe(we));if(V.length>0){de(Bo(V,d,z.current,L,g));return}de(zt(d,z.current,L,we[0],we[1],g).date)},[d,W,se,pe,de,g]),it=s.useCallback(()=>{const{minDate:L,maxDate:fe}=ie.current,we=[ke(_.current[0],L,fe),ke(_.current[1],L,fe)],V=se(we);be(we,Ir($.current,d,V,pe(V),g),"both")},[d,se,pe,be,g]),Fe=jn(D),ht=jn(E),Ye=Fe!==void 0,nt=ht!==void 0,qe=s.useMemo(()=>{const L={macroUnit:p,microUnit:d,yearStartMonth:g,minDate:r,maxDate:n,macroRange:X,microSelection:[C,C],macroAllowedDates:Ft("macro",N)?Tt("macro",N).list:void 0,microAllowedDates:Ft("micro",N)?Tt("micro",N).list:void 0};return{macroStart:Fe===void 0?Zt:mr({...L,row:"macro",shows:"start",rules:Fe}),macroEnd:Fe===void 0?Zt:mr({...L,row:"macro",shows:"end",rules:Fe}),micro:ht===void 0?Zt:mr({...L,row:"micro",shows:"end",rules:{previous:{motion:"shift",window:ht.previous.window},next:{motion:"shift",window:ht.next.window}}})}},[Fe,ht,p,d,g,q,I,X,C,N.macroIsDiscrete,N.macroAllowedDates,N.microIsDiscrete,N.microAllowedDates,N.allowedDates]),gt=s.useCallback(L=>be(L.macroRange,L.microSelection[0],"macro"),[be]),Oe=s.useCallback(L=>be(L.macroRange,L.microSelection[0],"micro"),[be]),It=Ut(qe.macroStart,gt),k=Ut(qe.macroEnd,gt),re=Ut(qe.micro,Oe),[Ce,Xe]=Q,Ue=s.useMemo(()=>({value:X[0],onChange:Ge,minDate:r,maxDate:X[1],unit:p,yearStartMonth:g,...Bt(p,A),formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:S,...Ye?{stepper:It}:{}}),[X,Ge,r,p,g,A,e.formatLocale,e.locale,e.labels,S,Ye,It]),Dt=s.useMemo(()=>({value:X[1],onChange:je,minDate:X[0],maxDate:n,unit:p,yearStartMonth:g,...Bt(p,A),formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:S,...Ye?{stepper:k}:{}}),[X,je,n,p,g,A,e.formatLocale,e.locale,e.labels,S,Ye,k]),er=s.useMemo(()=>({value:C,onChange:Ke,minDate:Ce,maxDate:Xe,unit:d,yearStartMonth:g,...Bt(d,T),formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:S,...nt?{stepper:re}:{}}),[C,Ke,Ce,Xe,d,g,T,e.formatLocale,e.locale,e.labels,S,nt,re]),Ve=s.useMemo(()=>({...N,mode:"vernier",unit:t,yearStartMonth:g,macroUnit:p,microUnit:d,minDate:r,maxDate:n,macroRange:X,microValue:C,onChangeMacroRange:Ee,onChangeMicroPoint:ve}),[N,t,p,d,r,n,X,C,Ee,ve,g]);return{macroRange:X,setMacroRange:Mt,microValue:C,setMicroValue:H,setMacroLowerDate:Ge,setMacroUpperDate:je,setMicroDate:Ke,shiftMacroRange:mt,shiftMicroValue:le,resetVernier:it,macroStartSelectorProps:Ue,macroEndSelectorProps:Dt,microSelectorProps:er,sliderProps:Ve,duringRender:ce.duringRender}}function fi(e,t){const r=new Date(0);return r.setHours(0,0,0,0),r.setFullYear(e,t,1),r}function Wo(e,t){const r=new Date(e.getTime());return Jo(r.getFullYear(),r.getMonth(),t)}function ml(e){return e===void 0?0:yl(e)?e:Number.NaN}const hl=Un("declare the years to offer with minYear / maxYear or allowedYears");function yo(e,t,r,n){e!==void 0&&ac(e,t,r,n)}function ac(e,t,r,n){if(!ye(e))throw new RangeError(`YearSelector: ${t} must be a valid Date (received: ${R(e)})`);Ze("YearSelector",t,e,"year",r,n)}function gl(e,t,r){if(e!==void 0){if(!Number.isInteger(e))throw new RangeError(`YearSelector: ${t} must be an integer year (received: ${R(e)})`);if(Number.isNaN(fi(e,r).getTime()))throw new RangeError(`YearSelector: ${t} must name a year that starts inside the Date range (received: ${R(e)}); under yearStartMonth ${r} that year starts on month ${r+1}, day 1`)}}function pl(e,t,r,n){const o=e===void 0?null:e,a=t===void 0?null:Wo(t,n);return o!==null&&a!==null?r(o,a):o!==null?o:a}function gf(e,t,r,n){const o=new Set;for(const a of e){const i=Wo(a,n);t!==null&&i<t||r!==null&&i>r||o.add(i)}return Array.from(o).sort((a,i)=>a-i)}function pf(e,t,r,n){return e!==void 0?{kind:"discrete",ascending:gf(e,t,r,n)}:t===null||r===null?null:{kind:"bounded",minYear:t,maxYear:r}}function bf(e,t){const r=[];for(let n=t;n>=e;n--)r.push(n);return r}const wf=e=>{const{value:t,initialDate:r,onChange:n,stepper:o,stepGlyph:a,children:i,minYear:l,maxYear:u,minDate:f,maxDate:m,allowedYears:S,className:D="",style:E,disabled:j=!1,locale:p,labels:d,formatLocale:g,formatOption:N,yearStartMonth:_}=e,$=wr("YearSelector",_);if(yo(t,"value",$,""),yo(r,"initialDate",$,""),yo(f,"minDate",$,hl),yo(m,"maxDate",$,hl),gl(l,"minYear",$),gl(u,"maxYear",$),an("YearSelector","allowedYears",S),S!==void 0)for(let ae=0;ae<S.length;ae++)ac(S[ae],`allowedYears[${ae}]`,$,"");g!==void 0&&na("YearSelector","formatLocale",g);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");o!==void 0&&yi("YearSelector",o,t!==void 0);const x=wi("YearSelector",a),h=Zo(p,d),oe=t!==void 0,[ce,X]=Ei(y,oe,ae=>oa(ae,"year",$),ae=>Wo(ae,$)),q=f?.getTime(),I=m?.getTime(),Q=s.useMemo(()=>pl(l,f,Math.max,$),[l,q,$]),W=s.useMemo(()=>pl(u,m,Math.min,$),[u,I,$]);if(Q!==null&&W!==null&&Q>W)throw new RangeError(`YearSelector: the resolved upper bound must not precede the resolved lower bound (lower: ${Q}, upper: ${W})`);const A=S===void 0?null:S.map(ae=>ae.getTime()).join(","),Y=s.useMemo(()=>pf(S,Q,W,$),[A,Q,W,$]);if(Y===null)throw new RangeError("YearSelector: a lower bound (minYear or minDate) and an upper bound (maxYear or maxDate), or allowedYears, are required; the option list is never invented");const te=s.useMemo(()=>Y.kind==="discrete"?{kind:"candidates",ascending:Y.ascending,loIndex:0,hiIndex:Y.ascending.length-1}:{kind:"range",min:Y.minYear,max:Y.maxYear},[Y]),T=t!==void 0?Wo(t,$):ce,C=!In(te,T),U=ae=>{if(!j){if(!In(te,ae))throw new RangeError(`YearSelector: refusing to emit ${ae}, which lies outside the selectable years`);oe||X(ae),n?.(fi(ae,$),ae)}},z=Qt(te,T,-1),ue=Qt(te,T,1),B=()=>{if(o!==void 0){o.onStep("previous");return}z!==null&&U(z)},ie=()=>{if(o!==void 0){o.onStep("next");return}ue!==null&&U(ue)},xe=s.useMemo(()=>{const ae=Y.kind==="discrete"?[...Y.ascending].reverse():bf(Y.minYear,Y.maxYear);return C&&(ae.push(T),ae.sort((se,pe)=>pe-se)),ae.map(se=>({value:se,label:_e("year",fi(se,$),N,g)}))},[Y,C,T,$,g,N]);return P.jsxs("div",{className:`inline-flex items-center ${Tn} ${D}`,style:E,"data-out-of-range":C?"true":void 0,children:[P.jsx(Ar,{neighbour:"control",direction:"left",glyph:x,disabled:j,canStep:o===void 0?z!==null:o.canStepPrevious,onStep:B,ariaLabel:h.previousYear}),P.jsx("select",{"aria-label":h.yearSelect,disabled:j,className:`${Ld} appearance-none rounded-md border border-gray-300 bg-gray-100 px-1 py-0.5 text-center font-mono text-gray-900 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:T,onChange:ae=>{if(!ae.target.value)return;const se=Number(ae.target.value);Number.isInteger(se)&&U(se)},children:xe.map(ae=>P.jsx("option",{value:ae.value,disabled:C&&ae.value===T,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:ae.label},ae.value))}),P.jsx(Ar,{neighbour:"control",direction:"right",glyph:x,disabled:j,canStep:o===void 0?ue!==null:o.canStepNext,onStep:ie,ariaLabel:h.nextYear}),i]})},vf=(e,t)=>{const r=ml(t.yearStartMonth);return!(ml(e.yearStartMonth)!==r||!Di(e,t,n=>oa(n,"year",r))||e.disabled!==t.disabled||e.className!==t.className||e.style!==t.style||e.minYear!==t.minYear||e.maxYear!==t.maxYear||e.allowedYears!==t.allowedYears||e.onChange!==t.onChange||e.stepper===void 0!=(t.stepper===void 0)||e.value===void 0!=(t.value===void 0)||e.stepper?.onStep!==t.stepper?.onStep||e.stepper?.canStepPrevious!==t.stepper?.canStepPrevious||e.stepper?.canStepNext!==t.stepper?.canStepNext||e.stepGlyph!==t.stepGlyph||e.children!==t.children||e.locale!==t.locale||!Xo(e.labels,t.labels)||e.formatLocale!==t.formatLocale||e.formatOption!==t.formatOption)},ic=s.memo(wf,vf);ic.displayName="YearSelector";exports.COLOR_SCHEME_PALETTES=Dl;exports.DateSelector=tc;exports.MonthSelector=oc;exports.PERIOD_SLIDER_LABEL_CATALOGS=Rl;exports.PERIOD_SLIDER_LABEL_KEYS=qo;exports.PeriodSlider=Gl;exports.YearSelector=ic;exports.addUnit=Ll;exports.areStylesEqual=Wl;exports.calculateConnectDragValues=Il;exports.calculateHandleDragValues=ei;exports.calculateKeyboardActionValues=Al;exports.calculateLabelSlant=_l;exports.calculateVernierMacroDrag=jl;exports.calculateVernierMicroDrag=Fl;exports.decode=ne;exports.encode=F;exports.findNearestDateIndex=De;exports.formatLabel=_e;exports.formatOptionText=Kl;exports.formatQuarterLabel=Ku;exports.formatScreenReaderLabel=Tr;exports.getMacroWindowEndDate=Tl;exports.getMacroWindowStartDate=$l;exports.getSortedAllowedDates=qu;exports.normalizeDateByUnit=Rt;exports.resolveDraggedEdge=Ko;exports.resolveMacroWindow=Ct;exports.resolvePeriodSliderLabels=Ml;exports.resolveQuarter=Cl;exports.resolveSelectorSteps=ai;exports.resolveVernierRailZone=Mi;exports.resolveVernierSelectorSteps=mr;exports.resolveVernierTargetHandle=Hl;exports.resolveWheelStep=Yl;exports.usePeriodSliderPoint=ff;exports.usePeriodSliderRange=df;exports.useSelectorStepper=Ut;exports.useVernierSliderPoint=hf;exports.useVernierSliderRange=mf;