efficient-shell 13.7.0 → 13.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +4 -2
  2. package/dist/{Browser-RDE3RBBK.js → Browser-ATL2PGT2.js} +12 -12
  3. package/dist/Files-RHEICXXW.js +141 -0
  4. package/dist/{Notepad-CFK5MJDE.js → Notepad-QL5GJZNS.js} +9 -9
  5. package/dist/PomodoroTimer-2MFWO3KK.js +91 -0
  6. package/dist/{Preview-CBYMPKY2.js → Preview-PP3XS7E7.js} +18 -18
  7. package/dist/Weather-377NKPA5.js +60 -0
  8. package/dist/WorldClock-M6AMXQY2.js +32 -0
  9. package/dist/ai/index.js +30 -30
  10. package/dist/apps/index.js +1 -1
  11. package/dist/bin/browser-check.js +1 -1
  12. package/dist/bin/media-host-check.js +1 -1
  13. package/dist/bin/ui-check.js +1 -1
  14. package/dist/charts/SpecChart.js +1 -1
  15. package/dist/{chunk-GXVWI3U5.js → chunk-5CFERCYW.js} +1 -1
  16. package/dist/{chunk-UD2C3PJE.js → chunk-AEOCSYKL.js} +1 -1
  17. package/dist/chunk-AJMQ5SHI.js +1 -0
  18. package/dist/{chunk-PDIGCTZD.js → chunk-BKZOTBDP.js} +19 -19
  19. package/dist/{chunk-ZJZHUPUH.js → chunk-F3G7S5HO.js} +23 -23
  20. package/dist/{chunk-4C7YUXDI.js → chunk-H7CIK74N.js} +10 -10
  21. package/dist/chunk-HYHZEQMG.js +1 -0
  22. package/dist/{chunk-RI5QSLX3.js → chunk-IOZSLFGR.js} +1 -1
  23. package/dist/{chunk-H22D2PYM.js → chunk-LOFFHXZ4.js} +9 -9
  24. package/dist/chunk-NHKT5IH6.js +1 -0
  25. package/dist/chunk-OAKXWYZD.js +2 -0
  26. package/dist/{chunk-S6UJKSF3.js → chunk-OJI4ROSD.js} +1 -1
  27. package/dist/{chunk-AOZZ2LEL.js → chunk-RK6X56ZC.js} +1 -1
  28. package/dist/{chunk-3MIIXPV6.js → chunk-SC3AQXJY.js} +8 -8
  29. package/dist/chunk-YJGA4LPG.js +2 -0
  30. package/dist/{chunk-ENCZRE3H.js → chunk-Z62HFEFS.js} +7 -7
  31. package/dist/{chunk-77HMTXDR.js → chunk-ZJ34FNRC.js} +1 -1
  32. package/dist/data/Gantt.js +1 -1
  33. package/dist/format/index.d.ts +1 -1
  34. package/dist/format/index.js +1 -1
  35. package/dist/forms/Calendar.js +1 -1
  36. package/dist/forms/DatePicker.js +1 -1
  37. package/dist/forms/DateRangePicker.js +1 -1
  38. package/dist/index.d.ts +1 -1
  39. package/dist/index.js +665 -665
  40. package/dist/shell/MilestoneTimeline.js +1 -1
  41. package/dist/shell/ProductionTimeline.js +1 -1
  42. package/dist/shell/TimeAgo.js +1 -1
  43. package/dist/shell/TimelineTrack.js +1 -1
  44. package/dist/shell/timelineDates.js +1 -1
  45. package/dist/telemetry/index.js +1 -1
  46. package/dist/ui/index.d.ts +1 -1
  47. package/dist/ui/index.js +1 -1
  48. package/dist/utils/date.d.ts +44 -5
  49. package/dist/utils/date.js +1 -1
  50. package/dist/utils/format.js +1 -1
  51. package/dist/version.js +1 -1
  52. package/package.json +1 -1
  53. package/dist/Files-SPICA5IO.js +0 -141
  54. package/dist/PomodoroTimer-57XARJRF.js +0 -91
  55. package/dist/Weather-Y4TMYOQB.js +0 -60
  56. package/dist/WorldClock-FY3UCIAW.js +0 -32
  57. package/dist/chunk-COHFFGFE.js +0 -2
  58. package/dist/chunk-FBDZGO3V.js +0 -1
  59. package/dist/chunk-I3MSKHJD.js +0 -2
  60. package/dist/chunk-XNGQHEGB.js +0 -1
  61. package/dist/chunk-ZPJTLNKU.js +0 -1
@@ -1,23 +1,23 @@
1
- import{Calendar as e}from"./chunk-H22D2PYM.js";import{gridColumnCount as t}from"./chunk-VNNVG4NR.js";import{END_ACTIONS_PAD as r,InputEndActionSlot as n,InputEndActionButton as a}from"./chunk-PT4GMPUB.js";import{FILTER_ON as o,FILTER_ON_INK as i,FILTER_OFF as l}from"./chunk-AYZY3YNC.js";import{userToday as s,calendarNames as c}from"./chunk-ZPJTLNKU.js";import{toDateKey as d,fromDateKey as m,toMonthKey as u}from"./chunk-JRQMX4PK.js";import{pad2 as h}from"./chunk-LF27WIN2.js";import{Icon as p}from"./chunk-ISVODSRP.js";import{onOverlayOpen as f}from"./chunk-PGN5ME7B.js";import{Z_LAYERS as g}from"./chunk-62LW225J.js";import{useDropdownPosition as b}from"./chunk-GLUJS42B.js";import{useBrowserLayoutEffect as x}from"./chunk-D65T4H6J.js";import{buttonClasses as v}from"./chunk-UQYNPYF4.js";import{glassStyle as y}from"./chunk-5FYDNH4Y.js";import{useShellStrings as w,useShellLocale as N}from"./chunk-DEJIH3ZQ.js";import{useState as k,useRef as C,useId as M,useEffect as D}from"react";import{createPortal as j}from"react-dom";import{jsxs as W,Fragment as $,jsx as Y}from"react/jsx-runtime";var F=["last2Weeks","lastMonth","last3Months","last6Months","last12Months"],S=d;function H(e,t){const r=t.getFullYear(),n=t.getMonth(),a=new Date(r,n,t.getDate()),o=new Date(r,n,0),i=e=>new Date(r,n-e,1);switch(e){case"last2Weeks":return{from:d(new Date(r,n,t.getDate()-14)),to:d(a)};case"lastMonth":return{from:d(i(1)),to:d(o)};case"last3Months":return{from:d(i(3)),to:d(o)};case"last6Months":return{from:d(i(6)),to:d(o)};case"last12Months":return{from:d(i(12)),to:d(o)}}}function O(e,t,r){const n=u(e);return t&&n<t.slice(0,7)?t.slice(0,7):r&&n>r.slice(0,7)?r.slice(0,7):n}function P(e){const t=m(e);return t?`${h(t.getDate())}/${h(t.getMonth()+1)}/${t.getFullYear()}`:e}var L=/* @__PURE__ */new Map;function R({from:d,to:u,onChange:h,formatDisplay:S,clearable:R,required:T=!1,name:J,id:U,"aria-labelledby":B,"aria-label":E,weekStartsOn:G,placeholder:I,fullWidth:V=!1,min:Z,max:q,disabled:A=!1,allowOpenEnd:Q=!1}){const K=w().dateRange,z=N(),X=S??(z?function(e){let t=L.get(e);t||(t=new Intl.DateTimeFormat(e,{year:"numeric",month:"2-digit",day:"2-digit",timeZone:"UTC",calendar:"gregory"}),L.set(e,t));const r=t;return e=>{const t=m(e);return t?r.format(new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()))):e}}(z):P),_=I??K.placeholder,ee=R??!T,[te,re]=k(!1),[ne,ae]=k(d),[oe,ie]=k(u),[le,se]=k(null),[ce,de]=k("from"),me=C(null),ue=C(null),he=C(null),pe=M(),fe=M(),ge=M(),[be,xe]=k(!1),ve=b(me,te,{preferredMaxWidth:520,preferredMaxHeight:be?720:560,popupRef:he}),ye=C(null),we=C(null),[Ne,ke]=k(!0);x(()=>{const e=we.current;if(!te||!be||!e)return;const r=t(getComputedStyle(e).gridTemplateColumns)||1,n=parseFloat(getComputedStyle(e).columnGap)||0,a=(e.clientWidth-n*(r-1))/r,o=Math.max(...Array.from(e.querySelectorAll("[data-preset-measure]"),e=>e.offsetWidth))+24+2<=a+.5;o!==Ne&&ke(o)});const Ce=C(null);x(()=>{const e=he.current;if(!te||!ve||!e)return;const t=getComputedStyle(e),r=ve.maxWidth-(e.offsetWidth-e.clientWidth)-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight);if(be)null!==Ce.current&&Ce.current<=r&&xe(!1);else{const e=ye.current?.offsetWidth??0;if(0===e)return;Ce.current=e,e>r+.5&&xe(!0)}});const[Me,De]=k(!1);x(()=>{const e=!!U&&(ue.current?.labels?.length??0)>0;e!==Me&&De(e)});const je=!!E||!!B||Me,We=m(s())??/* @__PURE__ */new Date(0),[$e,Ye]=k(()=>d?d.slice(0,7):O(We,Z,q)),Fe=F.filter(e=>((e,t,r)=>(!t||e.from>=t)&&(!r||e.to<=r))(H(e,We),Z,q)),Se=e=>e?X(e):"";D(()=>{if(!te)return;const e=e=>{const t=e.target;me.current?.contains(t)||he.current?.contains(t)||re(!1)};document.addEventListener("mousedown",e);const t=f(()=>re(!1));return()=>{document.removeEventListener("mousedown",e),t()}},[te]),D(()=>{A&&re(!1)},[A]);const He=()=>{h("",""),re(!1)},Oe=ee&&!A&&Boolean(d||u),Pe=d&&u?`${Se(d)} — ${Se(u)}`:d?K.fromOnly(Se(d)):u?K.toOnly(Se(u)):"",Le=c(z),Re=e=>{const t=m(e);return t?Le.longDate(t.getFullYear(),t.getMonth(),t.getDate()):e},Te=d&&u?K.range(Re(d),Re(u)):d?K.fromOnly(Re(d)):u?K.toOnly(Re(u)):_,Je=e=>be?"h-8 w-full min-w-0 truncate rounded-(--radius-control) border px-3 text-sm transition-colors "+(le===e?"border-blue-300 bg-accent-tint text-blue-700 font-medium":"border-line text-ink hover:bg-row-hover"):"h-8 text-left px-3 text-sm rounded-(--radius-control) transition-colors "+(le===e?"bg-accent-tint text-blue-700 font-medium":"text-ink hover:bg-row-hover"),Ue=/* @__PURE__ */W($,{children:[Fe.map(e=>/* @__PURE__ */Y("button",{type:"button",onClick:()=>(e=>{if("Custom"===e)return;const t=H(e,We);ae(t.from),ie(t.to),se(e),Ye(t.from.slice(0,7))})(e),className:Je(e),"aria-label":be?K[e]:void 0,children:be?Ne?K[e]:K[`${e}Short`]:K[e]},e)),
2
- /* @__PURE__ */Y("button",{type:"button",onClick:()=>se("Custom"),className:Je("Custom"),children:K.custom})]}),Be=(e,t)=>Q?/* @__PURE__ */Y("button",{type:"button","data-range-end":e,"aria-pressed":ce===e,onClick:()=>de(e),className:"flex items-center gap-2 whitespace-nowrap rounded rosh-focus-ring",children:t}):/* @__PURE__ */Y("div",{className:"flex items-center gap-2 whitespace-nowrap",children:t}),Ee=e=>Q&&ce===e?" ring-1 ring-blue-400":"",Ge=
3
- /* @__PURE__ */Y(e,{mode:"range",min:Z,max:q,value:ne||null,endValue:oe||null,month:$e,onMonthChange:Ye,onSelect:e=>{se("Custom"),Q?"from"===ce?(oe&&e>oe?(ae(oe),ie(e)):ae(e),de("to")):ne&&e<ne?(ie(ne),ae(e)):ie(e):!ne||ne&&oe?(ae(e),ie("")):e<ne?(ie(ne),ae(e)):ie(e)},weekStartsOn:G,"aria-label":K.dialog});/* @__PURE__ */
1
+ import{Calendar as e}from"./chunk-LOFFHXZ4.js";import{gridColumnCount as t}from"./chunk-VNNVG4NR.js";import{END_ACTIONS_PAD as r,InputEndActionSlot as n,InputEndActionButton as a}from"./chunk-PT4GMPUB.js";import{FILTER_ON as o,FILTER_ON_INK as i,FILTER_OFF as l}from"./chunk-AYZY3YNC.js";import{userToday as s,calendarNames as c}from"./chunk-NHKT5IH6.js";import{toDateKey as d,fromDateKey as m,toMonthKey as u}from"./chunk-JRQMX4PK.js";import{pad2 as h}from"./chunk-LF27WIN2.js";import{Icon as p}from"./chunk-ISVODSRP.js";import{onOverlayOpen as f}from"./chunk-PGN5ME7B.js";import{Z_LAYERS as g}from"./chunk-62LW225J.js";import{useDropdownPosition as b}from"./chunk-GLUJS42B.js";import{useBrowserLayoutEffect as x}from"./chunk-D65T4H6J.js";import{buttonClasses as v}from"./chunk-UQYNPYF4.js";import{glassStyle as y}from"./chunk-5FYDNH4Y.js";import{useShellStrings as w,useShellLocale as N}from"./chunk-DEJIH3ZQ.js";import{useState as k,useRef as C,useId as M,useEffect as j}from"react";import{createPortal as D}from"react-dom";import{jsxs as W,Fragment as $,jsx as F}from"react/jsx-runtime";var Y=["last2Weeks","lastMonth","last3Months","last6Months","last12Months"],S=d;function H(e,t){const r=t.getFullYear(),n=t.getMonth(),a=new Date(r,n,t.getDate()),o=new Date(r,n,0),i=e=>new Date(r,n-e,1);switch(e){case"last2Weeks":return{from:d(new Date(r,n,t.getDate()-14)),to:d(a)};case"lastMonth":return{from:d(i(1)),to:d(o)};case"last3Months":return{from:d(i(3)),to:d(o)};case"last6Months":return{from:d(i(6)),to:d(o)};case"last12Months":return{from:d(i(12)),to:d(o)}}}function O(e,t,r){const n=u(e);return t&&n<t.slice(0,7)?t.slice(0,7):r&&n>r.slice(0,7)?r.slice(0,7):n}function L(e){const t=m(e);return t?`${h(t.getDate())}/${h(t.getMonth()+1)}/${t.getFullYear()}`:e}var R=/* @__PURE__ */new Map;function T({from:d,to:u,onChange:h,formatDisplay:S,clearable:T,required:I=!1,name:P,id:B,"aria-labelledby":E,"aria-label":G,weekStartsOn:J,placeholder:U,fullWidth:V=!1,min:Z,max:q,disabled:A=!1,allowOpenEnd:Q=!1}){const K=w().dateRange,X=N(),z=S??(X?function(e){let t=R.get(e);t||(t=new Intl.DateTimeFormat(e,{year:"numeric",month:"2-digit",day:"2-digit",timeZone:"UTC",calendar:"gregory"}),R.set(e,t));const r=t;return e=>{const t=m(e);return t?r.format(new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()))):e}}(X):L),_=U??K.placeholder,ee=T??!I,[te,re]=k(!1),[ne,ae]=k(d),[oe,ie]=k(u),[le,se]=k(null),[ce,de]=k("from"),me=C(null),ue=C(null),he=C(null),pe=M(),fe=M(),ge=M(),[be,xe]=k(!1),ve=b(me,te,{preferredMaxWidth:520,preferredMaxHeight:be?720:560,popupRef:he}),ye=C(null),we=C(null),[Ne,ke]=k(!0);x(()=>{const e=we.current;if(!te||!be||!e)return;const r=t(getComputedStyle(e).gridTemplateColumns)||1,n=parseFloat(getComputedStyle(e).columnGap)||0,a=(e.clientWidth-n*(r-1))/r,o=Math.max(...Array.from(e.querySelectorAll("[data-preset-measure]"),e=>e.offsetWidth))+24+2<=a+.5;o!==Ne&&ke(o)});const Ce=C(null);x(()=>{const e=he.current;if(!te||!ve||!e)return;const t=getComputedStyle(e),r=ve.maxWidth-(e.offsetWidth-e.clientWidth)-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight);if(be)null!==Ce.current&&Ce.current<=r&&xe(!1);else{const e=ye.current?.offsetWidth??0;if(0===e)return;Ce.current=e,e>r+.5&&xe(!0)}});const[Me,je]=k(!1);x(()=>{const e=!!B&&(ue.current?.labels?.length??0)>0;e!==Me&&je(e)});const De=!!G||!!E||Me,We=m(s())??/* @__PURE__ */new Date(0),[$e,Fe]=k(()=>d?d.slice(0,7):O(We,Z,q)),Ye=Y.filter(e=>((e,t,r)=>(!t||e.from>=t)&&(!r||e.to<=r))(H(e,We),Z,q)),Se=e=>e?z(e):"";j(()=>{if(!te)return;const e=e=>{const t=e.target;me.current?.contains(t)||he.current?.contains(t)||re(!1)};document.addEventListener("mousedown",e);const t=f(()=>re(!1));return()=>{document.removeEventListener("mousedown",e),t()}},[te]),j(()=>{A&&re(!1)},[A]);const He=()=>{h("",""),re(!1)},Oe=ee&&!A&&Boolean(d||u),Le=d&&u?`${Se(d)} — ${Se(u)}`:d?K.fromOnly(Se(d)):u?K.toOnly(Se(u)):"",Re=c(X),Te=e=>{const t=m(e);return t?Re.longDate(t.getFullYear(),t.getMonth(),t.getDate()):e},Ie=d&&u?K.range(Te(d),Te(u)):d?K.fromOnly(Te(d)):u?K.toOnly(Te(u)):_,Pe=e=>be?"h-8 w-full min-w-0 truncate rounded-(--radius-control) border px-3 text-sm transition-colors "+(le===e?"border-blue-300 bg-accent-tint text-blue-700 font-medium":"border-line text-ink hover:bg-row-hover"):"h-8 text-left px-3 text-sm rounded-(--radius-control) transition-colors "+(le===e?"bg-accent-tint text-blue-700 font-medium":"text-ink hover:bg-row-hover"),Be=/* @__PURE__ */W($,{children:[Ye.map(e=>/* @__PURE__ */F("button",{type:"button",onClick:()=>(e=>{if("Custom"===e)return;const t=H(e,We);ae(t.from),ie(t.to),se(e),Fe(t.from.slice(0,7))})(e),className:Pe(e),"aria-label":be?K[e]:void 0,children:be?Ne?K[e]:K[`${e}Short`]:K[e]},e)),
2
+ /* @__PURE__ */F("button",{type:"button",onClick:()=>se("Custom"),className:Pe("Custom"),children:K.custom})]}),Ee=(e,t)=>Q?/* @__PURE__ */F("button",{type:"button","data-range-end":e,"aria-pressed":ce===e,onClick:()=>de(e),className:"flex items-center gap-2 whitespace-nowrap rounded rosh-focus-ring",children:t}):/* @__PURE__ */F("div",{className:"flex items-center gap-2 whitespace-nowrap",children:t}),Ge=e=>Q&&ce===e?" ring-1 ring-blue-400":"",Je=
3
+ /* @__PURE__ */F(e,{mode:"range",min:Z,max:q,value:ne||null,endValue:oe||null,month:$e,onMonthChange:Fe,onSelect:e=>{se("Custom"),Q?"from"===ce?(oe&&e>oe?(ae(oe),ie(e)):ae(e),de("to")):ne&&e<ne?(ie(ne),ae(e)):ie(e):!ne||ne&&oe?(ae(e),ie("")):e<ne?(ie(ne),ae(e)):ie(e)},weekStartsOn:J,"aria-label":K.dialog});/* @__PURE__ */
4
4
  return W("div",{className:"relative"+(V?" w-full":""),ref:me,children:[
5
5
  /* @__PURE__ */W("div",{className:`relative ${V?"flex w-full":"inline-flex"} h-8 items-center gap-2 border rounded-lg px-3 ${Oe?r[1]:""} text-sm focus-within:border-blue-500 has-focus-visible:ring-1 has-focus-visible:ring-[color:var(--rosh-focus-ring-deep)] ${d||u?`${o} ${i}`:l}${A?" cursor-not-allowed opacity-60":""}`,children:[
6
- /* @__PURE__ */W("button",{ref:ue,type:"button",onClick:()=>{A||(ae(d),ie(u),se(null),de(d&&!u?"to":"from"),Ye(d?d.slice(0,7):O(We,Z,q)),re(!0))},"aria-haspopup":"dialog","aria-expanded":te,id:U,disabled:A||void 0,"aria-label":E,"aria-labelledby":B,"aria-describedby":[je?fe:void 0,T?ge:void 0].filter(Boolean).join(" ")||void 0,"aria-controls":te?pe:void 0,className:"inline-flex items-center gap-2 rosh-focus-ring"+(V?" min-w-0 flex-1 justify-start":""),children:[
7
- /* @__PURE__ */Y(p,{name:"date",className:"w-4 h-4 shrink-0",strokeWidth:"2","aria-hidden":"true"}),
8
- /* @__PURE__ */Y("span",{className:"truncate",children:Pe||_})]}),Oe&&/* @__PURE__ */Y(n,{children:/* @__PURE__ */Y(a,{action:{label:K.clearRange,icon:/* @__PURE__ */Y(p,{name:"close"}),onClick:He}})})]}),je&&/* @__PURE__ */Y("span",{id:fe,className:"sr-only",children:Te}),T&&/* @__PURE__ */Y("span",{id:ge,className:"sr-only",children:K.required}),J&&/* @__PURE__ */W($,{children:[
9
- /* @__PURE__ */Y("input",{type:"hidden",name:J.from,value:d,disabled:A||void 0}),
10
- /* @__PURE__ */Y("input",{type:"hidden",name:J.to,value:u,disabled:A||void 0})]}),te&&j(
6
+ /* @__PURE__ */W("button",{ref:ue,type:"button",onClick:()=>{A||(ae(d),ie(u),se(null),de(d&&!u?"to":"from"),Fe(d?d.slice(0,7):O(We,Z,q)),re(!0))},"aria-haspopup":"dialog","aria-expanded":te,id:B,disabled:A||void 0,"aria-label":G,"aria-labelledby":E,"aria-describedby":[De?fe:void 0,I?ge:void 0].filter(Boolean).join(" ")||void 0,"aria-controls":te?pe:void 0,className:"inline-flex items-center gap-2 rosh-focus-ring"+(V?" min-w-0 flex-1 justify-start":""),children:[
7
+ /* @__PURE__ */F(p,{name:"date",className:"w-4 h-4 shrink-0",strokeWidth:"2","aria-hidden":"true"}),
8
+ /* @__PURE__ */F("span",{className:"truncate",children:Le||_})]}),Oe&&/* @__PURE__ */F(n,{children:/* @__PURE__ */F(a,{action:{label:K.clearRange,icon:/* @__PURE__ */F(p,{name:"close"}),onClick:He}})})]}),De&&/* @__PURE__ */F("span",{id:fe,className:"sr-only",children:Ie}),I&&/* @__PURE__ */F("span",{id:ge,className:"sr-only",children:K.required}),P&&/* @__PURE__ */W($,{children:[
9
+ /* @__PURE__ */F("input",{type:"hidden",name:P.from,value:d,disabled:A||void 0}),
10
+ /* @__PURE__ */F("input",{type:"hidden",name:P.to,value:u,disabled:A||void 0})]}),te&&D(
11
11
  /* @__PURE__ */W("div",{ref:he,id:pe,role:"dialog","aria-label":K.dialog,"data-layout":be?"stacked":"side",className:"fixed rounded-(--radius-popup) p-4",style:{zIndex:g.popup,left:ve?.left,right:ve?.right,top:ve?.top,bottom:ve?.bottom,width:be&&ve?ve.maxWidth:"max-content",maxWidth:ve?.maxWidth,maxHeight:ve?.maxHeight,overflowY:"auto",visibility:ve?void 0:"hidden",...y()},children:[
12
- /* @__PURE__ */W("div",{className:be?"mb-3 flex flex-wrap items-center gap-x-4 gap-y-2":"flex items-center gap-3 mb-3",children:[Be("from",/* @__PURE__ */W($,{children:[
13
- /* @__PURE__ */Y("span",{className:"text-xs font-medium text-gray-500",children:K.from}),
14
- /* @__PURE__ */Y("span",{className:`text-sm px-2 py-1 rounded border min-w-[90px] ${ne?"border-blue-300 bg-accent-tint text-blue-700":"border-line bg-surface-sunken text-ink-faintest"}${Ee("from")}`,children:ne?Se(ne):K.start})]})),!be&&/* @__PURE__ */Y("span",{className:"text-gray-300",children:"—"}),Be("to",/* @__PURE__ */W($,{children:[
15
- /* @__PURE__ */Y("span",{className:"text-xs font-medium text-gray-500",children:K.to}),
16
- /* @__PURE__ */Y("span",{className:`text-sm px-2 py-1 rounded border min-w-[90px] ${oe?"border-blue-300 bg-accent-tint text-blue-700":"border-line bg-surface-sunken text-ink-faintest"}${Ee("to")}`,children:oe?Se(oe):K.end})]}))]}),be?/* @__PURE__ */W($,{children:[Fe.length>0&&/* @__PURE__ */W("div",{className:"mb-3 @container",children:[!Ne&&/* @__PURE__ */Y("p",{"aria-hidden":"true",className:"mb-1 text-xs font-medium text-ink-faint",children:K.lastHeading}),
17
- /* @__PURE__ */W("div",{ref:we,className:"relative grid grid-cols-2 gap-2 @min-[320px]:grid-cols-3",children:[Ue,Fe.map(e=>/* @__PURE__ */Y("span",{"data-preset-measure":"","aria-hidden":"true",className:"invisible absolute left-0 top-0 whitespace-nowrap text-sm",children:K[e]},e))]})]}),
18
- /* @__PURE__ */Y("div",{className:"w-full",children:Ge})]}):
12
+ /* @__PURE__ */W("div",{className:be?"mb-3 flex flex-wrap items-center gap-x-4 gap-y-2":"flex items-center gap-3 mb-3",children:[Ee("from",/* @__PURE__ */W($,{children:[
13
+ /* @__PURE__ */F("span",{className:"text-xs font-medium text-gray-500",children:K.from}),
14
+ /* @__PURE__ */F("span",{className:`text-sm px-2 py-1 rounded border min-w-[90px] ${ne?"border-blue-300 bg-accent-tint text-blue-700":"border-line bg-surface-sunken text-ink-faintest"}${Ge("from")}`,children:ne?Se(ne):K.start})]})),!be&&/* @__PURE__ */F("span",{className:"text-gray-300",children:"—"}),Ee("to",/* @__PURE__ */W($,{children:[
15
+ /* @__PURE__ */F("span",{className:"text-xs font-medium text-gray-500",children:K.to}),
16
+ /* @__PURE__ */F("span",{className:`text-sm px-2 py-1 rounded border min-w-[90px] ${oe?"border-blue-300 bg-accent-tint text-blue-700":"border-line bg-surface-sunken text-ink-faintest"}${Ge("to")}`,children:oe?Se(oe):K.end})]}))]}),be?/* @__PURE__ */W($,{children:[Ye.length>0&&/* @__PURE__ */W("div",{className:"mb-3 @container",children:[!Ne&&/* @__PURE__ */F("p",{"aria-hidden":"true",className:"mb-1 text-xs font-medium text-ink-faint",children:K.lastHeading}),
17
+ /* @__PURE__ */W("div",{ref:we,className:"relative grid grid-cols-2 gap-2 @min-[320px]:grid-cols-3",children:[Be,Ye.map(e=>/* @__PURE__ */F("span",{"data-preset-measure":"","aria-hidden":"true",className:"invisible absolute left-0 top-0 whitespace-nowrap text-sm",children:K[e]},e))]})]}),
18
+ /* @__PURE__ */F("div",{className:"w-full",children:Je})]}):
19
19
  /* @__PURE__ */W("div",{ref:ye,className:"flex w-max gap-4",children:[
20
- /* @__PURE__ */Y("div",{className:"w-64",children:Ge}),Fe.length>0&&/* @__PURE__ */Y("div",{className:"border-l border-gray-200 pl-4 flex flex-col gap-1 min-w-[130px]",children:Ue})]}),
21
- /* @__PURE__ */W("div",{className:"flex flex-wrap justify-end gap-2 mt-4 pt-3 border-t border-gray-200",children:[ee&&/* @__PURE__ */Y("button",{type:"button",onClick:He,className:v({variant:"ghost"}),children:K.clear}),
22
- /* @__PURE__ */Y("button",{type:"button",onClick:()=>re(!1),className:v({variant:"secondary"}),children:K.cancel}),
23
- /* @__PURE__ */Y("button",{type:"button",onClick:()=>{h(ne,oe),re(!1)},disabled:Q?!ne&&!oe:!ne||!oe,className:v({variant:"primary"}),children:K.apply})]})]}),document.body)]})}export{R as DateRangePicker,H as presetRange,S as toISODate};
20
+ /* @__PURE__ */F("div",{className:"w-64",children:Je}),Ye.length>0&&/* @__PURE__ */F("div",{className:"border-l border-gray-200 pl-4 flex flex-col gap-1 min-w-[130px]",children:Be})]}),
21
+ /* @__PURE__ */W("div",{className:"flex flex-wrap justify-end gap-2 mt-4 pt-3 border-t border-gray-200",children:[ee&&/* @__PURE__ */F("button",{type:"button",onClick:He,className:v({variant:"ghost"}),children:K.clear}),
22
+ /* @__PURE__ */F("button",{type:"button",onClick:()=>re(!1),className:v({variant:"secondary"}),children:K.cancel}),
23
+ /* @__PURE__ */F("button",{type:"button",onClick:()=>{h(ne,oe),re(!1)},disabled:Q?!ne&&!oe:!ne||!oe,className:v({variant:"primary"}),children:K.apply})]})]}),document.body)]})}export{T as DateRangePicker,H as presetRange,S as toISODate};
@@ -1,4 +1,4 @@
1
- import{fmtSliderDate as e}from"./chunk-GXVWI3U5.js";import{calendarNames as t}from"./chunk-ZPJTLNKU.js";import{DAY_MS as r}from"./chunk-JRQMX4PK.js";import{stagger as n}from"./chunk-465RRWBY.js";import{popupBounds as l}from"./chunk-GLUJS42B.js";import{useBrowserValueOnce as a,useBrowserLayoutEffect as s}from"./chunk-D65T4H6J.js";import{registerModalEscapeInterceptor as i}from"./chunk-TWVUQUUD.js";import{useShellStrings as o,useShellLocale as c}from"./chunk-DEJIH3ZQ.js";import{useRef as u,useState as m,useId as d,useEffect as h,useCallback as p}from"react";import{jsx as x,jsxs as f,Fragment as y}from"react/jsx-runtime";var k={receipt:/* @__PURE__ */f(y,{children:[
1
+ import{fmtSliderDate as e}from"./chunk-5CFERCYW.js";import{calendarNames as t}from"./chunk-NHKT5IH6.js";import{DAY_MS as r}from"./chunk-JRQMX4PK.js";import{stagger as n}from"./chunk-465RRWBY.js";import{popupBounds as l}from"./chunk-GLUJS42B.js";import{useBrowserValueOnce as a,useBrowserLayoutEffect as s}from"./chunk-D65T4H6J.js";import{registerModalEscapeInterceptor as i}from"./chunk-TWVUQUUD.js";import{useShellStrings as o,useShellLocale as c}from"./chunk-DEJIH3ZQ.js";import{useRef as u,useState as m,useId as d,useEffect as h,useCallback as p}from"react";import{jsx as x,jsxs as f,Fragment as y}from"react/jsx-runtime";var k={receipt:/* @__PURE__ */f(y,{children:[
2
2
  /* @__PURE__ */x("path",{d:"M3.4 1.9h5.2v7.2l-1.3-.9-1.3.9-1.3-.9-1.3.9z",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"}),
3
3
  /* @__PURE__ */x("path",{d:"M4.9 4.4h2.2M4.9 6.1h2.2",stroke:"currentColor",strokeWidth:"1.1",strokeLinecap:"round"})]}),check:/* @__PURE__ */x("path",{d:"M2.6 6.3 4.9 8.6 9.4 3.6",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round"}),doc:/* @__PURE__ */f(y,{children:[
4
4
  /* @__PURE__ */x("path",{d:"M3.5 1.9h3.4l2 2v6.2H3.5z",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"}),
@@ -13,7 +13,7 @@ return x("svg",{viewBox:"0 0 12 12","aria-hidden":"true",children:k[e]})}functio
13
13
  return f("svg",{viewBox:"0 0 16 16","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round",children:[
14
14
  /* @__PURE__ */x("path",{d:"M4.2 2.2v11.6"}),
15
15
  /* @__PURE__ */x("path",{d:"M4.2 3.1h7.4l-1.6 2.5 1.6 2.6H4.2z"})]})}function v(){/* @__PURE__ */
16
- return x("svg",{viewBox:"0 0 16 16","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",children:/* @__PURE__ */x("path",{d:"M2.8 11.6V8.2M6.6 11.6V5.4M10.4 11.6V7M14.2 11.6V3.6"})})}var b=1e-6;function $(e,t,r={}){const n=Number.isFinite(t)&&t>0?t:0,l=Array.from(new Set(e.filter(e=>Number.isFinite(e)))).sort((e,t)=>e-t);if(n<=0||l.length<2){const e=l[0]??0;return{anchorsMs:l,xs:l.map(()=>0),gaps:[],xByMs:()=>0,msByPx:()=>e,inCut:()=>!1}}const a=l[l.length-1]-l[0],s=r.maxTimeShare??.3,i=Math.min(r.breakPx??48,n),o=r.minGapPx??48,c=[],u=[],m=[];for(let e=0;e+1<l.length;e++){const t=l[e+1]-l[e];c.push(t),u.push(a>0?t/a*n:0),m.push(a>0&&t/a>s)}const d=m.filter(Boolean).length,h=Math.max(0,n-d*i);let p=0,x=0;for(let e=0;e<c.length;e++)m[e]||(p+=c[e],x+=1);const f=c.map((e,t)=>m[t]?i:0===x?0:p>0?h*e/p:h/x),y=function(e,t,r){const n=e.slice();let l=0;for(let e=0;e<n.length;e++)t[e]||n[e]>=r-b||(l+=r-n[e],n[e]=r);if(l<=b)return n;let a=0;for(let e=0;e<n.length;e++)!t[e]&&n[e]>r+b&&(a+=n[e]-r);if(a<=b)return n;const s=Math.min(l,a);for(let e=0;e<n.length;e++)t[e]||n[e]<=r+b||(n[e]-=s*(n[e]-r)/a);return n}(f,m,o),k=y.reduce((e,t,r)=>m[r]?e:e+t,0),g=y.map((e,t)=>m[t]?e:k>0?e*h/k:e),M=[0];for(let e=0;e<g.length;e++)M.push(M[e]+g[e]);M[M.length-1]=n;const v=M.slice(0,-1).map((e,t)=>({fromMs:l[t],toMs:l[t+1],gapMs:c[t],fromPx:e,toPx:M[t+1],wantPx:u[t],clampedPx:f[t],px:M[t+1]-e,compressed:m[t]}));return{anchorsMs:l,xs:M,gaps:v,xByMs:e=>{if(!Number.isFinite(e)||e<=l[0])return 0;if(e>=l[l.length-1])return n;for(let t=0;t+1<l.length;t++){if(e>l[t+1])continue;const r=l[t+1]-l[t],n=r>0?(e-l[t])/r:0;return M[t]+n*(M[t+1]-M[t])}return n},msByPx:e=>{const t=Math.min(Math.max(Number.isFinite(e)?e:0,0),n);for(let e=0;e+1<l.length;e++){if(t>M[e+1]&&e+2<l.length)continue;const r=M[e+1]-M[e],n=r>0?(t-M[e])/r:0;return l[e]+n*(l[e+1]-l[e])}return l[l.length-1]},inCut:e=>v.some(t=>t.compressed&&e>t.fromMs&&e<t.toMs)}}function w(e,t,r){return Math.max(0,Math.min(e-t/2,Math.max(0,r-t)))}var P="mixed";function N(e,t){return 5.6*Math.max(e.length,t.length)+8}var C=(e,t,r)=>Math.min(Math.max(e,t),r),T=e=>-(Math.cos(Math.PI*e)-1)/2;function B(e,t){if(!(t>0))return{px:e.fromPx,ms:e.fromMs};if(t>=1||e.durationMs<=0)return{px:e.toPx,ms:e.toMs};const r=e.fromPx+(e.toPx-e.fromPx)*T(t);return{px:r,ms:e.msByPx(r)}}var L={lanes:{tag:0,laneA:17,laneH:30,rail:52,ruler:64,laneB:86,height:120},active:{tag:0,laneA:17,laneH:30,rail:38,ruler:50,laneB:74,height:108},none:{tag:0,laneA:16,laneH:14,rail:34,ruler:46,laneB:46,height:72}};function D(){try{return"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var K=e=>5.6*e.length,A={default:{},dfm:{glyph:"doc",token:"var(--tl-dfm)"},shipment:{diamond:!0,glyph:"truck",token:"var(--tl-shipment)"},testing:{glyph:"flask",token:"var(--tl-testing)"},completion:{glyph:"check",token:"var(--tl-completion)"},inspection:{glyph:"flask",token:"var(--tl-inspection)"},invoice:{glyph:"receipt",token:"var(--tl-invoice)"},report:{}},j={doc:"dfm",flask:"testing",check:"completion",truck:"shipment",receipt:"invoice"};function F(e,t,r){if("none"!==e.glyph)return e.glyph?e.glyph:A[t].glyph??(r?"flag":void 0)}function R(e,t,r=!1){const n=A[e],l=["rosh-tl-node","rosh-tl-mark",`is-${t}`];n.diamond&&l.push("is-diamond"),r&&l.push("is-provisional");const a="current"===t?"var(--tl-accent)":n.token??"var(--tl-accent)",s="dot"===t||r?{borderColor:a,color:a}:{backgroundColor:a,color:"var(--tl-on-kind)"};return{className:l.join(" "),style:s}}function U(e){const t=(e=>"string"==typeof e?e:"")(e.detail);return`${e.label} · ${e.dateText}${t?` · ${t}`:""}`}function H(e,t){const[r,n]=m(0);return s(()=>{const r=t?e.current:null;if(!r)return;const l=()=>{const e=r.getBoundingClientRect().width;e>0&&n(e)};if(l(),"undefined"==typeof ResizeObserver)return;const a=new ResizeObserver(l);return a.observe(r),()=>{a.disconnect()}},[e,t]),r}function I(e,t,r){const n=/* @__PURE__ */new Map;for(const e of t)Number.isFinite(e.x)&&n.set(e.x,Math.max(n.get(e.x)??0,e.widthPx));const l=[...n.keys()].sort((e,t)=>e-t);if(r<=0||l.length<2)return e;const a=Math.max(0,l[0]),s=Math.min(r,l[l.length-1]),i=s-a,o=[];for(let e=0;e+1<l.length;e++){const t=(n.get(l[e])??0)/2+(n.get(l[e+1])??0)/2+8;o.push(Math.max(28,t,l[e+1]-l[e]))}const c=o.reduce((e,t)=>e+t,0),u=Math.min(Math.max(c,i),.8*r);if(u<=i+.5)return e;const m=a,d=r-s,h=m+d,p=Math.max(0,r-u),x=h>0?p*m/h:0,f=x,y=x+u,k=o.map(e=>c>0?e*u/c:0),g=e=>{if(e<=a)return m>0?e*x/m:f;if(e>=s)return d>0?y+(e-s)*(r-y)/d:y;let t=f;for(let r=0;r+1<l.length;r++){if(e>l[r+1]){t+=k[r];continue}const n=l[r+1]-l[r];return t+(n>0?(e-l[r])/n*k[r]:0)}return y};return{anchorsMs:e.anchorsMs,xs:e.xs.map(g),gaps:e.gaps.map(e=>({...e,fromPx:g(e.fromPx),toPx:g(e.toPx),px:g(e.toPx)-g(e.fromPx)})),xByMs:t=>g(e.xByMs(t)),msByPx:t=>e.msByPx((e=>{if(e<=f)return x>0?e*m/x:a;if(e>=y)return r-y>0?s+(e-y)*d/(r-y):s;let t=f;for(let r=0;r+1<l.length;r++){if(!(e>t+k[r]))return l[r]+(k[r]>0?(e-t)/k[r]*(l[r+1]-l[r]):0);t+=k[r]}return s})(t)),inCut:e.inCut}}function O(e){if(!e||0===e.length)return null;const t=e.filter(e=>Number.isFinite(e)).sort((e,t)=>e-t);return t.length>0?t:null}function W({marks:e,innerRef:t}){/* @__PURE__ */
16
+ return x("svg",{viewBox:"0 0 16 16","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",children:/* @__PURE__ */x("path",{d:"M2.8 11.6V8.2M6.6 11.6V5.4M10.4 11.6V7M14.2 11.6V3.6"})})}var b=1e-6;function $(e,t,r={}){const n=Number.isFinite(t)&&t>0?t:0,l=Array.from(new Set(e.filter(e=>Number.isFinite(e)))).sort((e,t)=>e-t);if(n<=0||l.length<2){const e=l[0]??0;return{anchorsMs:l,xs:l.map(()=>0),gaps:[],xByMs:()=>0,msByPx:()=>e,inCut:()=>!1}}const a=l[l.length-1]-l[0],s=r.maxTimeShare??.3,i=Math.min(r.breakPx??48,n),o=r.minGapPx??48,c=[],u=[],m=[];for(let e=0;e+1<l.length;e++){const t=l[e+1]-l[e];c.push(t),u.push(a>0?t/a*n:0),m.push(a>0&&t/a>s)}const d=m.filter(Boolean).length,h=Math.max(0,n-d*i);let p=0,x=0;for(let e=0;e<c.length;e++)m[e]||(p+=c[e],x+=1);const f=c.map((e,t)=>m[t]?i:0===x?0:p>0?h*e/p:h/x),y=function(e,t,r){const n=e.slice();let l=0;for(let e=0;e<n.length;e++)t[e]||n[e]>=r-b||(l+=r-n[e],n[e]=r);if(l<=b)return n;let a=0;for(let e=0;e<n.length;e++)!t[e]&&n[e]>r+b&&(a+=n[e]-r);if(a<=b)return n;const s=Math.min(l,a);for(let e=0;e<n.length;e++)t[e]||n[e]<=r+b||(n[e]-=s*(n[e]-r)/a);return n}(f,m,o),k=y.reduce((e,t,r)=>m[r]?e:e+t,0),g=y.map((e,t)=>m[t]?e:k>0?e*h/k:e),M=[0];for(let e=0;e<g.length;e++)M.push(M[e]+g[e]);M[M.length-1]=n;const v=M.slice(0,-1).map((e,t)=>({fromMs:l[t],toMs:l[t+1],gapMs:c[t],fromPx:e,toPx:M[t+1],wantPx:u[t],clampedPx:f[t],px:M[t+1]-e,compressed:m[t]}));return{anchorsMs:l,xs:M,gaps:v,xByMs:e=>{if(!Number.isFinite(e)||e<=l[0])return 0;if(e>=l[l.length-1])return n;for(let t=0;t+1<l.length;t++){if(e>l[t+1])continue;const r=l[t+1]-l[t],n=r>0?(e-l[t])/r:0;return M[t]+n*(M[t+1]-M[t])}return n},msByPx:e=>{const t=Math.min(Math.max(Number.isFinite(e)?e:0,0),n);for(let e=0;e+1<l.length;e++){if(t>M[e+1]&&e+2<l.length)continue;const r=M[e+1]-M[e],n=r>0?(t-M[e])/r:0;return l[e]+n*(l[e+1]-l[e])}return l[l.length-1]},inCut:e=>v.some(t=>t.compressed&&e>t.fromMs&&e<t.toMs)}}function w(e,t,r){return Math.max(0,Math.min(e-t/2,Math.max(0,r-t)))}var P="mixed";function N(e,t){return 5.6*Math.max(e.length,t.length)+8}var C=(e,t,r)=>Math.min(Math.max(e,t),r),T=e=>-(Math.cos(Math.PI*e)-1)/2;function B(e,t){if(!(t>0))return{px:e.fromPx,ms:e.fromMs};if(t>=1||e.durationMs<=0)return{px:e.toPx,ms:e.toMs};const r=e.fromPx+(e.toPx-e.fromPx)*T(t);return{px:r,ms:e.msByPx(r)}}var L={lanes:{tag:0,laneA:17,laneH:30,rail:52,ruler:64,laneB:86,height:120},active:{tag:0,laneA:17,laneH:30,rail:38,ruler:50,laneB:74,height:108},none:{tag:0,laneA:16,laneH:14,rail:34,ruler:46,laneB:46,height:72}};function D(){try{return"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var K=e=>5.6*e.length,A={default:{},dfm:{glyph:"doc",token:"var(--tl-dfm)"},shipment:{diamond:!0,glyph:"truck",token:"var(--tl-shipment)"},testing:{glyph:"flask",token:"var(--tl-testing)"},completion:{glyph:"check",token:"var(--tl-completion)"},inspection:{glyph:"flask",token:"var(--tl-inspection)"},invoice:{glyph:"receipt",token:"var(--tl-invoice)"},report:{}},F={doc:"dfm",flask:"testing",check:"completion",truck:"shipment",receipt:"invoice"};function R(e,t,r){if("none"!==e.glyph)return e.glyph?e.glyph:A[t].glyph??(r?"flag":void 0)}function j(e,t,r=!1){const n=A[e],l=["rosh-tl-node","rosh-tl-mark",`is-${t}`];n.diamond&&l.push("is-diamond"),r&&l.push("is-provisional");const a="current"===t?"var(--tl-accent)":n.token??"var(--tl-accent)",s="dot"===t||r?{borderColor:a,color:a}:{backgroundColor:a,color:"var(--tl-on-kind)"};return{className:l.join(" "),style:s}}function H(e){const t=(e=>"string"==typeof e?e:"")(e.detail);return`${e.label} · ${e.dateText}${t?` · ${t}`:""}`}function U(e,t){const[r,n]=m(0);return s(()=>{const r=t?e.current:null;if(!r)return;const l=()=>{const e=r.getBoundingClientRect().width;e>0&&n(e)};if(l(),"undefined"==typeof ResizeObserver)return;const a=new ResizeObserver(l);return a.observe(r),()=>{a.disconnect()}},[e,t]),r}function I(e,t,r){const n=/* @__PURE__ */new Map;for(const e of t)Number.isFinite(e.x)&&n.set(e.x,Math.max(n.get(e.x)??0,e.widthPx));const l=[...n.keys()].sort((e,t)=>e-t);if(r<=0||l.length<2)return e;const a=Math.max(0,l[0]),s=Math.min(r,l[l.length-1]),i=s-a,o=[];for(let e=0;e+1<l.length;e++){const t=(n.get(l[e])??0)/2+(n.get(l[e+1])??0)/2+8;o.push(Math.max(28,t,l[e+1]-l[e]))}const c=o.reduce((e,t)=>e+t,0),u=Math.min(Math.max(c,i),.8*r);if(u<=i+.5)return e;const m=a,d=r-s,h=m+d,p=Math.max(0,r-u),x=h>0?p*m/h:0,f=x,y=x+u,k=o.map(e=>c>0?e*u/c:0),g=e=>{if(e<=a)return m>0?e*x/m:f;if(e>=s)return d>0?y+(e-s)*(r-y)/d:y;let t=f;for(let r=0;r+1<l.length;r++){if(e>l[r+1]){t+=k[r];continue}const n=l[r+1]-l[r];return t+(n>0?(e-l[r])/n*k[r]:0)}return y};return{anchorsMs:e.anchorsMs,xs:e.xs.map(g),gaps:e.gaps.map(e=>({...e,fromPx:g(e.fromPx),toPx:g(e.toPx),px:g(e.toPx)-g(e.fromPx)})),xByMs:t=>g(e.xByMs(t)),msByPx:t=>e.msByPx((e=>{if(e<=f)return x>0?e*m/x:a;if(e>=y)return r-y>0?s+(e-y)*d/(r-y):s;let t=f;for(let r=0;r+1<l.length;r++){if(!(e>t+k[r]))return l[r]+(k[r]>0?(e-t)/k[r]*(l[r+1]-l[r]):0);t+=k[r]}return s})(t)),inCut:e.inCut}}function O(e){if(!e||0===e.length)return null;const t=e.filter(e=>Number.isFinite(e)).sort((e,t)=>e-t);return t.length>0?t:null}function W({marks:e,innerRef:t}){/* @__PURE__ */
17
17
  return x("div",{ref:t,"aria-hidden":"true",className:"rosh-tl-measure",children:e.map(e=>/* @__PURE__ */f("div",{"data-lane-key":e.key,className:"rosh-tl-measure-box",children:[
18
18
  /* @__PURE__ */x("span",{className:"rosh-tl-name",children:e.label}),
19
19
  /* @__PURE__ */x("span",{className:"rosh-tl-date",children:e.dateText})]},e.key))})}function z({startMs:e,endMs:n,axis:l,geo:a,reveal:s}){const i=o().timeline,u=t(c()),m=a.ruler,d=[],h=[],p=l.gaps.filter(e=>e.compressed),y=new Date(e);y.setUTCDate(y.getUTCDate()+(8-y.getUTCDay())%7);for(let e=y.getTime();e<n;e+=7*r){if(l.inCut(e))continue;const t=l.xByMs(e);l.xByMs(e+7*r)-t<14||d.push(
@@ -26,14 +26,14 @@ return f("span",{"data-timeline-part":"break",className:"rosh-tl-rulercut"+(s?"
26
26
  /* @__PURE__ */f("span",{className:"rosh-tl-cutglyph",children:[
27
27
  /* @__PURE__ */x("i",{}),
28
28
  /* @__PURE__ */x("i",{})]}),
29
- /* @__PURE__ */x("span",{children:i.days(t)})]},`cut-${e.fromMs}`)})]})}function S({pending:e,reveal:t}){const r=o().timeline,[n,l]=m(!1),a=n?e:e.slice(0,2),s=e.length-a.length;/* @__PURE__ */
29
+ /* @__PURE__ */x("span",{children:i.days(t)})]},`cut-${e.fromMs}`)})]})}function E({pending:e,reveal:t}){const r=o().timeline,[n,l]=m(!1),a=n?e:e.slice(0,2),s=e.length-a.length;/* @__PURE__ */
30
30
  return f("div",{className:"rosh-tl-pending","data-timeline-part":"pending",children:[
31
31
  /* @__PURE__ */x("p",{className:"rosh-tl-pending-head",children:r.notReached}),
32
32
  /* @__PURE__ */x("ol",{className:"rosh-tl-ghosts","aria-label":r.notReached,children:a.map((e,n)=>/* @__PURE__ */f("li",{className:t?"rosh-tl-fade":void 0,style:t?{animationDelay:440+60*n+"ms"}:void 0,children:[
33
33
  /* @__PURE__ */x("span",{"aria-hidden":"true",className:"rosh-tl-node is-ghost"+(e.kind&&A[e.kind].diamond?" is-diamond":"")}),
34
- /* @__PURE__ */f("span",{children:[0===n&&/* @__PURE__ */x("b",{children:`${r.next} · `}),e.label]})]},e.key))}),s>0&&/* @__PURE__ */x("button",{type:"button",className:"rosh-tl-more text-gray-500",onClick:()=>l(!0),children:r.more(s)})]})}function E({marks:e,pending:t,currentKey:l,todayMs:a,reveal:s,ariaLabel:i,step:c,nodeProps:u,onKeyDown:m}){const d=o().timeline,h=e.findIndex(e=>e.key===l),p=e.length>0&&null!==a?Math.round((a-e[e.length-1].ms)/r):0;/* @__PURE__ */
34
+ /* @__PURE__ */f("span",{children:[0===n&&/* @__PURE__ */x("b",{children:`${r.next} · `}),e.label]})]},e.key))}),s>0&&/* @__PURE__ */x("button",{type:"button",className:"rosh-tl-more text-gray-500",onClick:()=>l(!0),children:r.more(s)})]})}function S({marks:e,pending:t,currentKey:l,todayMs:a,reveal:s,ariaLabel:i,step:c,nodeProps:u,onKeyDown:m}){const d=o().timeline,h=e.findIndex(e=>e.key===l),p=e.length>0&&null!==a?Math.round((a-e[e.length-1].ms)/r):0;/* @__PURE__ */
35
35
  return f("div",{"data-timeline-part":"vertical",children:[
36
- /* @__PURE__ */x("ol",{className:"rosh-tl-v","aria-label":i,onKeyDown:m,children:e.map((e,t)=>{const r=R(e.kind,e.role),a=h>=0&&t<h,{glyph:i}=e;/* @__PURE__ */
36
+ /* @__PURE__ */x("ol",{className:"rosh-tl-v","aria-label":i,onKeyDown:m,children:e.map((e,t)=>{const r=j(e.kind,e.role),a=h>=0&&t<h,{glyph:i}=e;/* @__PURE__ */
37
37
  return f("li",{className:s?"rosh-tl-fade":void 0,style:s?n(t,c):void 0,...e.key===l?{"aria-current":"step"}:{},children:[
38
38
  /* @__PURE__ */x("i",{"aria-hidden":"true",className:`rosh-tl-vline text-blue-600${a?" is-on":" is-dash"}${a&&s?" rosh-tl-drawy":""}`}),
39
39
  /* @__PURE__ */f("button",{...u(e),className:`${r.className}${s?" rosh-tl-pop":""}`,style:{...r.style,...s?n(t,c):{}},children:[i&&/* @__PURE__ */x(g,{name:i}),"current"===e.role&&/* @__PURE__ */x("span",{"aria-hidden":"true",className:"rosh-tl-pulse bg-blue-600"+(s?" is-on":"")})]}),
@@ -41,7 +41,7 @@ return f("li",{className:s?"rosh-tl-fade":void 0,style:s?n(t,c):void 0,...e.key=
41
41
  /* @__PURE__ */x("span",{className:"rosh-tl-name",children:e.label}),
42
42
  /* @__PURE__ */x("span",{className:"rosh-tl-date",children:e.dateText})]})]},e.key)})}),p>0&&/* @__PURE__ */f("p",{className:"rosh-tl-vgap","aria-hidden":"true",children:[
43
43
  /* @__PURE__ */x("i",{className:"rosh-tl-vline is-dash"}),
44
- /* @__PURE__ */x("span",{children:d.daysToToday(p)})]}),t.length>0&&/* @__PURE__ */x(S,{pending:t,reveal:s})]})}function X({axis:e,geo:t,fillTo:r,restTo:n=null,reveal:l,trackPx:a,tweened:s=!1}){/* @__PURE__ */
44
+ /* @__PURE__ */x("span",{children:d.daysToToday(p)})]}),t.length>0&&/* @__PURE__ */x(E,{pending:t,reveal:s})]})}function X({axis:e,geo:t,fillTo:r,restTo:n=null,reveal:l,trackPx:a,tweened:s=!1}){/* @__PURE__ */
45
45
  return f("div",{"aria-hidden":"true",children:[
46
46
  /* @__PURE__ */x("div",{className:"rosh-tl-rail bg-gray-200",style:{top:`${t.rail}px`,height:"6px",width:`${a}px`}}),null!==n&&/* @__PURE__ */x("div",{"data-timeline-part":"rest",className:"rosh-tl-fill bg-accent-fill opacity-30",style:{top:`${t.rail}px`,height:"6px",width:`${Math.max(0,Math.min(e.xByMs(n),a))}px`}}),null!==r&&/* @__PURE__ */x("div",{"data-timeline-part":"fill",className:`rosh-tl-fill bg-blue-600${s?" is-tweened":""}${l?" rosh-tl-draw":""}`,style:{top:`${t.rail}px`,height:"6px",width:`${Math.max(0,Math.min(e.xByMs(r),a))}px`}}),e.gaps.filter(e=>e.compressed).map(e=>/* @__PURE__ */f("div",{className:"rosh-tl-cut",style:{left:(e.fromPx+e.toPx)/2+"px",top:`${t.rail}px`,height:"6px"},children:[
47
47
  /* @__PURE__ */x("i",{}),
@@ -50,10 +50,10 @@ return f("div",{"aria-hidden":"true","data-timeline-part":"start",children:[
50
50
  /* @__PURE__ */x("i",{className:`rosh-tl-start${n?" is-around":""}${i}`,style:{left:"0px",top:`${e.rail+3}px`,...o}}),null!=t&&!1!==t&&/* @__PURE__ */x("span",{className:`rosh-tl-edge${i}`,"data-timeline-part":"start-caption",style:{left:"0px",top:`${s}px`,...o},children:t}),null!=r&&!1!==r&&/* @__PURE__ */x("span",{className:`rosh-tl-edge is-end${i}`,"data-timeline-part":"end-caption",style:{left:`${a}px`,top:`${s}px`,...o},children:r})]})}function J({x:e,geo:t,trackPx:r,label:n,reveal:l}){const a=o().timeline;/* @__PURE__ */
51
51
  return f("div",{"aria-hidden":"true","data-timeline-part":"today",children:[
52
52
  /* @__PURE__ */x("div",{className:"rosh-tl-todayline"+(l?" rosh-tl-fade":""),style:{left:`${e}px`,top:`${t.laneA}px`,height:t.ruler+20-t.laneA+"px",...l?{animationDelay:"420ms"}:{}}}),
53
- /* @__PURE__ */x("span",{className:"rosh-tl-todaytag"+(l?" rosh-tl-fade":""),title:a.todayTitle(n),style:{left:`${w(e,48,r)}px`,top:`${t.tag}px`,...l?{animationDelay:"420ms"}:{}},children:a.today})]})}function G({nodes:e,geo:t,reveal:r}){const n=e.map(e=>{const t=e.members.map(e=>e.caption).filter(e=>!!e);return 0===t.length?null:{x:e.x,first:t[0],last:t[t.length-1]}}).filter(e=>null!==e).sort((e,t)=>e.x-t.x),l=[];let a=null;const s=()=>{a&&(l.push({x:(a.from+a.to)/2,text:a.first===a.last?a.first:`${a.first}–${a.last}`}),a=null)};for(const e of n){const t=e.first===e.last?e.first:`${e.first}–${e.last}`,r=K(t)/2;a&&e.x-r<a.right+6?(a.to=e.x,a.last=e.last,a.right=e.x+r):(s(),a={from:e.x,to:e.x,first:e.first,last:e.last,right:e.x+r})}return s(),/* @__PURE__ */x("div",{"aria-hidden":"true","data-timeline-part":"captions",children:l.map(e=>/* @__PURE__ */x("span",{className:"rosh-tl-caption"+(r?" rosh-tl-fade":""),style:{left:`${e.x}px`,top:`${t.laneA}px`,...r?{animationDelay:"360ms"}:{}},children:e.text},`${e.x}-${e.text}`))})}function Z({phase:e,geo:t,xOf:r}){const n=r(e.minMs),l=Math.max(r(e.maxMs)-n,4);/* @__PURE__ */
53
+ /* @__PURE__ */x("span",{className:"rosh-tl-todaytag"+(l?" rosh-tl-fade":""),title:a.todayTitle(n),style:{left:`${w(e,48,r)}px`,top:`${t.tag}px`,...l?{animationDelay:"420ms"}:{}},children:a.today})]})}function Y({nodes:e,geo:t,reveal:r}){const n=e.map(e=>{const t=e.members.map(e=>e.caption).filter(e=>!!e);return 0===t.length?null:{x:e.x,first:t[0],last:t[t.length-1]}}).filter(e=>null!==e).sort((e,t)=>e.x-t.x),l=[];let a=null;const s=()=>{a&&(l.push({x:(a.from+a.to)/2,text:a.first===a.last?a.first:`${a.first}–${a.last}`}),a=null)};for(const e of n){const t=e.first===e.last?e.first:`${e.first}–${e.last}`,r=K(t)/2;a&&e.x-r<a.right+6?(a.to=e.x,a.last=e.last,a.right=e.x+r):(s(),a={from:e.x,to:e.x,first:e.first,last:e.last,right:e.x+r})}return s(),/* @__PURE__ */x("div",{"aria-hidden":"true","data-timeline-part":"captions",children:l.map(e=>/* @__PURE__ */x("span",{className:"rosh-tl-caption"+(r?" rosh-tl-fade":""),style:{left:`${e.x}px`,top:`${t.laneA}px`,...r?{animationDelay:"360ms"}:{}},children:e.text},`${e.x}-${e.text}`))})}function _({phase:e,geo:t,xOf:r}){const n=r(e.minMs),l=Math.max(r(e.maxMs)-n,4);/* @__PURE__ */
54
54
  return f("div",{"aria-hidden":"true","data-timeline-part":"phase",children:[
55
55
  /* @__PURE__ */x("div",{className:"rosh-tl-phase border-gray-300",style:{left:`${n}px`,width:`${l}px`,top:t.laneB+t.laneH-4+"px"}}),
56
- /* @__PURE__ */f("span",{className:"rosh-tl-phase-label text-gray-500",style:{left:`${n+l/2}px`,top:`${t.laneB+t.laneH+5}px`},children:[e.label," · parallel"]})]})}function _({nodes:e,trackPx:t,geo:r,activeKey:n,hoveredKey:l,currentKey:a}){const s=o().timeline,i=(e,t)=>null!==t&&(e.key===t||e.members.some(e=>e.key===t)),c=e.find(e=>e.key===l)??e.find(e=>i(e,n))??null;if(!c)return null;const u=c.mark,m=u?u.label:`×${c.members.length}`,d=u?u.dateText:function(e){const t=e[0].dateText,r=e[e.length-1].dateText;return t===r?t:`${t} – ${r}`}(c.members),h=u?u.widthPx:N(m,d),p=u?.onOpen;/* @__PURE__ */
56
+ /* @__PURE__ */f("span",{className:"rosh-tl-phase-label text-gray-500",style:{left:`${n+l/2}px`,top:`${t.laneB+t.laneH+5}px`},children:[e.label," · parallel"]})]})}function G({nodes:e,trackPx:t,geo:r,activeKey:n,hoveredKey:l,currentKey:a}){const s=o().timeline,i=(e,t)=>null!==t&&(e.key===t||e.members.some(e=>e.key===t)),c=e.find(e=>e.key===l)??e.find(e=>i(e,n))??null;if(!c)return null;const u=c.mark,m=u?u.label:`×${c.members.length}`,d=u?u.dateText:function(e){const t=e[0].dateText,r=e[e.length-1].dateText;return t===r?t:`${t} – ${r}`}(c.members),h=u?u.widthPx:N(m,d),p=u?.onOpen;/* @__PURE__ */
57
57
  return f("div",{"data-timeline-part":"label",className:`rosh-tl-label${c.key===l?" is-hot":""}${i(c,a)?" is-current":""}`,style:{left:`${w(c.x,h,t)}px`,top:`${r.laneB}px`,width:`${h}px`,height:`${r.laneH}px`},children:[p?/* @__PURE__ */x("button",{type:"button",className:"rosh-tl-name rosh-tl-open","data-timeline-part":"open","aria-label":s.open(m),onClick:p,children:m}):/* @__PURE__ */x("span",{className:"rosh-tl-name","aria-hidden":"true",children:m}),
58
58
  /* @__PURE__ */x("span",{className:"rosh-tl-date","aria-hidden":"true",children:d})]})}function Q({groups:e,trackPx:t,geo:n,startMs:l,endMs:a,currentKey:s,hoveredKey:i,reveal:o,step:c,zoomedKey:u,popId:m,aimBubble:d,openCluster:h,setOpenCluster:p,previewCluster:k,setPreviewCluster:g,setZoomKey:M,startCaptionPx:v}){const b=[];e.forEach((e,t)=>{if("cluster"===e.type){const n=`cluster-${e.members[0].key}`,l=(r=e.members,`${(r[0]?.label??"").replace(/\s*v?\d+$/i,"").trim()||(r[0]?.label??"")} ×${r.length}`);if(b.push({key:n,group:e,text:l,x:e.members.reduce((e,t)=>e+t.baseX,0)/e.members.length,index:t,lane:-1,left:0,widthPx:Math.ceil(K(l))+28}),n===u)for(const r of e.members)b.push({key:r.key,group:{type:"item",mark:r},text:r.label,x:r.x,index:t,lane:-1,left:0,widthPx:r.widthPx});return}var r;b.push({key:e.mark.key,group:e,text:e.mark.label,x:e.mark.x,index:t,lane:-1,left:0,widthPx:e.mark.widthPx})}),b.sort((e,t)=>e.x-t.x);const $=function(e,t,r,n,l={}){const a=t>0?t:0,s=n>0?n:1,i=l.gapPx??6,o=Math.max(1,l.laneCount??4),c=e.map((e,t)=>({item:e,index:t})).sort((e,t)=>(e.item.priority??0)-(t.item.priority??0)||e.item.ms-t.item.ms||e.index-t.index),u=Array.from({length:o},()=>[]),m=/* @__PURE__ */new Map;for(const{item:e}of c){const t=Math.max(0,e.widthPx);if(a<=0||t>a){m.set(e.key,-1);continue}const n=e.xPx??(e.ms-r)/s*a,l=Math.min(Math.max(n-t/2,0),a-t),c=l+t;let d=-1;for(let e=0;e<o;e++)if(u[e].every(e=>l>e.right+i||c+i<e.left)){u[e].push({left:l,right:c}),d=e;break}m.set(e.key,d)}return e.map(e=>({key:e.key,lane:m.get(e.key)??-1}))}([...v>0?[{key:"__rosh-tl-start__",ms:l,xPx:0,widthPx:v,priority:-2}]:[],...b.map(e=>({key:e.key,ms:"cluster"===e.group.type?e.group.members[0].ms:e.group.mark.ms,xPx:e.x,widthPx:e.widthPx,priority:"cluster"===e.group.type?-1:0}))],t,l,Math.max(a-l,r),{laneCount:2}),P=new Map($.map(e=>[e.key,e.lane]));for(const e of b)e.lane=P.get(e.key)??-1,e.left=w(e.x,e.widthPx,t);const N=b.find(e=>e.key===(h??k)),C=e=>0===e?n.laneA:n.laneB,T=e=>0===e?n.rail-4:n.rail+6+3;/* @__PURE__ */
59
59
  return f(y,{children:[b.map(e=>{const t=Math.max(0,e.lane),r=Math.round(e.index*c+60);if("cluster"===e.group.type){const l=h===e.key,a=e.group.members.map(e=>e.x),s=()=>{g(null),l||M(null)};/* @__PURE__ */
@@ -70,24 +70,24 @@ return f("div",{children:[
70
70
  /* @__PURE__ */x("p",{className:"rosh-tl-popover-head",children:N.text}),
71
71
  /* @__PURE__ */x("ol",{children:N.group.members.map(e=>/* @__PURE__ */f("li",{children:[
72
72
  /* @__PURE__ */x("span",{children:e.label}),
73
- /* @__PURE__ */x("span",{className:"rosh-tl-date",children:e.dateText})]},e.key))})]})]})}function Y({thumb:t,value:n,snap:l,axis:a,geo:s,startMs:i,endMs:m,trackPx:d,layerRef:h,glide:p,onScrub:k,nodes:g,onProgress:M}){const v=o().timeline,b=c(),$=u(!1),P=p?p.px:a.xByMs(n),N=p?p.ms:n,T=O(t.stops),B=T?T.indexOf(n):-1,L=e=>{const t=h.current?.getBoundingClientRect();return t?a.msByPx(e-t.left):n},D=e=>{const r=l(e);r!==n&&t.onChange(r)},K=e=>{k?.(),$.current=!0,e.currentTarget.setPointerCapture?.(e.pointerId),t.onDragStart?.()},A=e=>{$.current&&($.current=!1,e.currentTarget.releasePointerCapture?.(e.pointerId),M(null),t.onDragEnd?.())},j=u(!1),F=()=>{j.current&&(j.current=!1,t.onPreview?.(null))},R=e=>{if(!$.current)return;const t=L(e.clientX);D(t),M(function(e,t){if(!Number.isFinite(t))return null;const r=e.filter(e=>Number.isFinite(e.ms)).slice().sort((e,t)=>e.ms-t.ms);for(let e=0;e+1<r.length;e++){const n=r[e],l=r[e+1];if(t<n.ms||t>l.ms)continue;const a=l.ms-n.ms;return{fromKey:n.key,toKey:l.key,t:a>0?C((t-n.ms)/a,0,1):1,ms:t}}return null}(g,t))},U=t.valueText?t.valueText(N):e(N,b),H=Math.max(1,Math.round((m-i)/r));/* @__PURE__ */
73
+ /* @__PURE__ */x("span",{className:"rosh-tl-date",children:e.dateText})]},e.key))})]})]})}function Z({thumb:t,value:n,snap:l,axis:a,geo:s,startMs:i,endMs:m,trackPx:d,layerRef:h,glide:p,onScrub:k,nodes:g,onProgress:M}){const v=o().timeline,b=c(),$=u(!1),P=p?p.px:a.xByMs(n),N=p?p.ms:n,T=O(t.stops),B=T?T.indexOf(n):-1,L=e=>{const t=h.current?.getBoundingClientRect();return t?a.msByPx(e-t.left):n},D=e=>{const r=l(e);r!==n&&t.onChange(r)},K=e=>{k?.(),$.current=!0,e.currentTarget.setPointerCapture?.(e.pointerId),t.onDragStart?.()},A=e=>{$.current&&($.current=!1,e.currentTarget.releasePointerCapture?.(e.pointerId),M(null),t.onDragEnd?.())},F=u(!1),R=()=>{F.current&&(F.current=!1,t.onPreview?.(null))},j=e=>{if(!$.current)return;const t=L(e.clientX);D(t),M(function(e,t){if(!Number.isFinite(t))return null;const r=e.filter(e=>Number.isFinite(e.ms)).slice().sort((e,t)=>e.ms-t.ms);for(let e=0;e+1<r.length;e++){const n=r[e],l=r[e+1];if(t<n.ms||t>l.ms)continue;const a=l.ms-n.ms;return{fromKey:n.key,toKey:l.key,t:a>0?C((t-n.ms)/a,0,1):1,ms:t}}return null}(g,t))},H=t.valueText?t.valueText(N):e(N,b),U=Math.max(1,Math.round((m-i)/r));/* @__PURE__ */
74
74
  return f(y,{children:[
75
- /* @__PURE__ */x("div",{className:"rosh-tl-hit","aria-hidden":"true","data-timeline-part":"hit",style:{top:s.rail-9+"px",height:"24px"},onPointerDown:e=>{F(),K(e),D(L(e.clientX))},onPointerMove:e=>{$.current?R(e):(e=>{t.onPreview&&!p&&"mouse"===e.pointerType&&0===e.buttons&&(j.current=!0,t.onPreview(l(L(e.clientX))))})(e)},onPointerLeave:F,onPointerUp:A,onPointerCancel:A}),
75
+ /* @__PURE__ */x("div",{className:"rosh-tl-hit","aria-hidden":"true","data-timeline-part":"hit",style:{top:s.rail-9+"px",height:"24px"},onPointerDown:e=>{R(),K(e),D(L(e.clientX))},onPointerMove:e=>{$.current?j(e):(e=>{t.onPreview&&!p&&"mouse"===e.pointerType&&0===e.buttons&&(F.current=!0,t.onPreview(l(L(e.clientX))))})(e)},onPointerLeave:R,onPointerUp:A,onPointerCancel:A}),
76
76
  /* @__PURE__ */x("div",{className:"rosh-tl-chip","data-timeline-part":"chip",style:{left:`${w(P,88,d)+44}px`,top:`${s.tag}px`},children:t.chip?t.chip(N):e(N,b)}),
77
- /* @__PURE__ */x("div",{role:"slider",tabIndex:0,className:"rosh-tl-thumb text-blue-600","data-timeline-part":"thumb","aria-label":t.ariaLabel??v.scrub,"aria-valuemin":0,"aria-valuemax":T&&T.length>0?T.length-1:H,"aria-valuenow":T&&T.length>0?Math.max(0,B):Math.round((n-i)/r),"aria-valuetext":U,style:{left:`${P}px`,top:`${s.rail+3}px`},onPointerDown:K,onPointerMove:R,onPointerUp:A,onPointerCancel:A,onKeyDown:e=>{const t=(e=>{const{key:t}=e;if(T&&T.length>0){const e=B<0?0:B;return"ArrowRight"===t||"ArrowUp"===t?T[Math.min(e+1,T.length-1)]:"ArrowLeft"===t||"ArrowDown"===t?T[Math.max(e-1,0)]:"Home"===t?T[0]:"End"===t?T[T.length-1]:null}const l=(e.shiftKey?7:1)*r;return"ArrowRight"===t||"ArrowUp"===t?n+l:"ArrowLeft"===t||"ArrowDown"===t?n-l:"Home"===t?i:"End"===t?m:null})(e);null!==t&&(e.preventDefault(),k?.(),D(t))}})]})}function q(e,t,r){return(t?e.height:e.ruler+26)+(r?22:0)}function ee({startMs:t,endMs:k,axis:M="linear",items:v,markers:b=[],pending:w=[],fillToMs:ee,todayMs:te,labels:re="lanes",activeKey:ne=null,onActivate:le,thumb:ae,playback:se,edgeCaptions:ie,phases:oe=[],currentKey:ce,zoomRange:ue=null,motion:me=!0,ariaLabel:de,highlightKeys:he=null,onHoverChange:pe,endMark:xe=null}){const fe="none"===re,ye=a(Date.now,null),ke=a(D,!1),ge=te??ye,Me=u(null),ve=o().timeline,be=c(),$e=t=>e(t,be),we=u(null),Pe=u(null),Ne=u(null),Ce=u(/* @__PURE__ */new Map),Te=u(void 0),Be=u(void 0),Le=u(null),[De,Ke]=m({}),[Ae,je]=m(null),[Fe,Re]=m(null),[Ue,He]=m(null),[Ie,Oe]=m(null),[We,ze]=m(null),[Se,Ee]=m(null),Xe=d(),Ve=d(),Je=H(Me,!0),Ge=Je>0?Je-(w.length>0&&!fe?176:0):0,Ze=Ge>0&&Ge-20<320,_e=H(we,!Ze),Qe=_e>0?_e:600,Ye=L[re],qe=fe&&w.length>0,et=qe?Math.max(0,Qe-36):Qe,tt=e=>e>=t-r&&e<=k+r,rt=v.filter(e=>Number.isFinite(e.ms)&&tt(e.ms)).slice().sort((e,t)=>e.ms-t.ms),nt="spread"===M?b.map(e=>new Date(e.date).getTime()).filter(e=>Number.isFinite(e)):[],lt=$([t,...[...rt.map(e=>e.ms),...nt].filter(e=>e>t&&e<k),k],et,"compressed"===(at=M)?{}:"spread"===at?{maxTimeShare:1/0}:{maxTimeShare:1/0,minGapPx:0});var at;const st=lt.xByMs,it=rt.filter(e=>!e.provisional),ot=ce??(it.length>0?it[it.length-1].key:null),ct=rt.map((e,t)=>{const r=e.date??$e(e.ms),n=(e.priority??0)>0||"report"===e.kind,l=function(e){const t=e.kind??"default";return"default"===t&&e.glyph&&"none"!==e.glyph?j[e.glyph]??t:t}(e);return{key:e.key,ms:e.ms,x:st(e.ms),baseX:st(e.ms),kind:l,label:e.label,dateText:r,detail:e.detail,preview:e.preview,glyph:F(e,l,0===t&&"default"===l),role:e.key===ot?"current":n?"dot":"key",widthPx:fe?Math.max(16,K(e.caption??"")+6):De[e.key]||N(e.label,r),collapsible:n,onClick:e.onClick,onOpen:e.onOpen,isItem:!0,caption:e.caption,provisional:!!e.provisional,isCap:!1}}),ut=b.map(e=>({marker:e,ms:new Date(e.date).getTime()})).filter(({ms:e})=>Number.isFinite(e)&&tt(e)).map(({marker:e,ms:t})=>{const r=`marker-${e.id}`,n=$e(t);return{key:r,ms:t,x:st(t),baseX:st(t),kind:e.kind,label:e.label,dateText:n,detail:e.detail,preview:e.preview,glyph:e.glyph??A[e.kind].glyph,role:"key",widthPx:De[r]||N(e.label,n),collapsible:!1,onClick:e.onClick?()=>e.onClick?.(e):void 0,onOpen:e.onOpen?()=>e.onOpen?.(e):void 0,isItem:!1,provisional:!1,isCap:!1}}),mt=qe?(()=>{const e=w[w.length-1],t=w.slice(0,-1).map(e=>e.label);return[{key:e.key,ms:k+r,x:Qe,baseX:Qe,kind:e.kind??"default",label:e.label,dateText:ve.notReached,detail:t.length>0?ve.alsoToCome(t):void 0,glyph:void 0,role:"key",widthPx:16,collapsible:!1,isItem:!1,provisional:!1,isCap:!0}]})():[],dt=fe&&xe&&!qe?[{key:xe.key,ms:k,x:et,baseX:et,kind:"default",label:xe.label,dateText:xe.dateText??$e(k),detail:xe.detail,glyph:void 0,role:"key",widthPx:16,collapsible:!1,isItem:!1,provisional:!1,isCap:!0}]:[],ht=[...ct,...ut,...mt,...dt].sort((e,t)=>e.x-t.x||e.ms-t.ms),pt=ie?.start??ve.start($e(t)),xt=null==pt||!1===pt?0:"string"==typeof pt?Math.ceil(K(pt)):96,ft="lanes"===re?function(e,t={}){const r=t.minPitchPx??40,n=[];let l=0;for(;l<e.length;){const t=e[l];if(!t.collapsible){n.push({type:"item",mark:t}),l+=1;continue}let a=l+1;for(;a<e.length&&e[a].collapsible&&e[a].kind===t.kind;)a+=1;const s=e.slice(l,a),i=s.length>1&&s.every((e,t)=>{if(0===t)return!0;const n=s[t-1],l=Math.max(r,Math.max(e.widthPx,n.widthPx)+8);return e.x-n.x<l});if(s.length>=3||i)n.push({type:"cluster",kind:t.kind,members:s});else for(const e of s)n.push({type:"item",mark:e});l=a}return n}(ht):[],yt=function(e,t=16){const r=[];let n=0;for(;n<e.length;){let l=n+1;for(;l<e.length&&e[l].x-e[l-1].x<t;)l+=1;if(l-n===1)r.push({type:"item",mark:e[n]});else{const t=e.slice(n,l),a=new Set(t.map(e=>e.kind));r.push({type:"cluster",kind:1===a.size?t[0].kind:P,members:t})}n=l}return r}(ht),kt=e=>"cluster"===e.type?`fold-${e.members[0].key}`:e.mark.key,gt=/* @__PURE__ */new Map;for(const e of yt)if("cluster"===e.type)for(const t of e.members)gt.set(t.key,kt(e));const Mt=Ue??Ie??We,vt=ft.find(e=>"cluster"===e.type&&(e=>"cluster"===e.type?`cluster-${e.members[0].key}`:e.mark.key)(e)===Mt)??yt.find(e=>"cluster"===e.type&&kt(e)===Mt),bt=e=>({x:e.baseX,widthPx:e.widthPx}),$t=vt&&"cluster"===vt.type?vt.members.map(bt):ue?ht.filter(e=>e.ms>=ue[0]&&e.ms<=ue[1]).map(bt):[],wt=$t.length>1?I(lt,$t,et):lt,Pt=wt!==lt;if(Pt)for(const e of ht)e.isCap||(e.x=wt.xByMs(e.ms));const Nt=ht.some(e=>e.x<14),Ct=Pt&&vt?Mt:null,Tt=e=>({key:e.key,mark:e,members:[e],x:e.x,kind:e.kind,openable:!1}),Bt=Ze?ht.map(Tt):yt.flatMap(e=>{if("item"===e.type)return[Tt(e.mark)];const t=kt(e);if(t===Ct&&(r=e.members).every((e,t)=>0===t||e.x-r[t-1].x>=16))return e.members.map(Tt);var r;const n=e.members.map(e=>e.x);return[{key:t,mark:null,members:e.members,x:n.reduce((e,t)=>e+t,0)/n.length,kind:e.kind,openable:new Set(e.members.map(e=>e.ms)).size>1}]}),Lt=/* @__PURE__ */new Map;for(const e of Bt)for(const t of e.members)Lt.set(t.key,e.key);const Dt=yt.find(e=>"cluster"===e.type&&kt(e)===Ct),Kt=Dt&&"cluster"===Dt.type?{from:Math.min(...Dt.members.map(e=>e.x))-16,to:Math.max(...Dt.members.map(e=>e.x))+16}:null,At=u(Ct),[jt,Ft]=m(!1);h(()=>{if(At.current===Ct)return;At.current=Ct,Ft(!0);const e=setTimeout(()=>Ft(!1),240);return()=>clearTimeout(e)},[Ct]);const Rt=ht.map(e=>`${e.key} ${e.label} ${e.dateText}`).join("|");s(()=>{const e=Pe.current;if(!e)return;const t={};for(const r of Array.from(e.children)){const e=r.dataset.laneKey,n=r.getBoundingClientRect().width;e&&n>0&&(t[e]=n)}Ke(e=>function(e,t){const r=Object.keys(e);return r.length===Object.keys(t).length&&r.every(r=>Math.abs((e[r]??0)-(t[r]??0))<.5)}(e,t)?e:t)},[Rt]);const Ut=`${re}|${M}|${ht.map(e=>`${e.key}@${e.ms}`).join("|")}`,[Ht,It]=m(Ut),Ot=me&&Ht===Ut;h(()=>{Ht!==Ut&&It(Ut)},[Ht,Ut]);const Wt=Math.min(28,340/Math.max(1,ht.length-1)),zt=O(ae?.stops),St=e=>{const r=Math.min(Math.max(e,t),k);if(!zt)return r;let n=zt[0];for(const e of zt)Math.abs(e-r)<Math.abs(n-r)&&(n=e);return n},Et=ae?St(ae.valueMs):null,Xt=se&&ae?ct.filter(e=>!zt||zt.includes(e.ms)).map(e=>({key:e.key,ms:e.ms})):[],Vt=function(e,t,r={}){const n=Number.isFinite(r.speed)&&(r.speed??0)>0?r.speed:1,l=Math.max(0,r.dwellMs??700)/n,a=t.filter(e=>Number.isFinite(e.ms)).slice().sort((e,t)=>e.ms-t.ms),s=[];for(let t=0;t+1<a.length;t++){const i=a[t],o=a[t+1],c=e.xByMs(i.ms),u=e.xByMs(o.ms),m=Math.max(0,u-c),d=m<=.5||r.reducedMotion?0:C(350*m/100,450,1400)/n;s.push({fromKey:i.key,toKey:o.key,fromMs:i.ms,toMs:o.ms,fromPx:c,toPx:u,lengthPx:m,durationMs:d,dwellMs:l,msByPx:e.msByPx})}return s}(wt,Xt,{speed:se?.speed,reducedMotion:ke}),[Jt,Gt]=m(null),Zt=u(null),_t=u({segments:Vt,value:Et,playback:se});h(()=>{_t.current={segments:Vt,value:Et,playback:se}});const Qt=u(null),Yt=p(e=>{null===e&&null===Qt.current||(Qt.current=e,_t.current.playback?.onProgress?.(e))},[]),qt=p(()=>{Zt.current=null,Gt(null),Yt(null),_t.current.playback?.onStop?.()},[Yt]),er=!!se?.playing&&!!ae;h(()=>{if(!er)return;const e=_t.current,t=null===e.value?-1:e.segments.findIndex(t=>t.fromMs===e.value);if(t<0)return void qt();Zt.current&&Zt.current.index===t||(Zt.current={index:t,phase:"rest",t:0,restLeftMs:e.segments[t].dwellMs,sinceMs:null});let r,n=0;const l=e=>Gt(t=>t&&t.px===e.px&&t.ms===e.ms?t:e),a=()=>{clearTimeout(r);const e=Zt.current;"rest"===e?.phase&&(r=setTimeout(s,Math.max(0,e.restLeftMs)))},s=()=>{const e=Zt.current;if("rest"!==e?.phase)return;const t=_t.current.segments[e.index];t?(Zt.current={index:e.index,phase:"glide",t:0,restLeftMs:0,sinceMs:null},l(B(t,0))):qt()},i=e=>{const t=_t.current,r=Zt.current;if(!r)return;const s=function(e,t,r){const n=e[t.index];if(!n)return{cursor:null,at:null,arrived:null,progress:null};const l=null===t.sinceMs?0:Math.max(0,r-t.sinceMs);if("rest"===t.phase){const e=t.restLeftMs-l;return e>0?{cursor:{...t,restLeftMs:e,sinceMs:r},at:B(n,0),arrived:null,progress:null}:{cursor:{index:t.index,phase:"glide",t:0,restLeftMs:0,sinceMs:r},at:B(n,0),arrived:null,progress:null}}const a=n.durationMs>0?Math.min(1,t.t+l/n.durationMs):1,s=B(n,a);if(a<1)return{cursor:{...t,t:a,sinceMs:r},at:s,arrived:null,progress:{fromKey:n.fromKey,toKey:n.toKey,t:T(a),ms:s.ms}};const i=e[t.index+1];return{cursor:i?{index:t.index+1,phase:"rest",t:0,restLeftMs:i.dwellMs,sinceMs:r}:null,at:s,arrived:{key:n.toKey,ms:n.toMs},progress:null}}(t.segments,r,e);Zt.current=s.cursor,s.at&&l(s.at),Yt(s.progress),s.arrived&&t.playback?.onArrive(s.arrived.key,s.arrived.ms),s.cursor?(s.cursor.phase===r.phase&&s.cursor.index===r.index||a(),n=requestAnimationFrame(i)):qt()};return a(),n=requestAnimationFrame(i),()=>{cancelAnimationFrame(n),clearTimeout(r),Zt.current&&(Zt.current.sinceMs=null,Yt(null))}},[er,qt,Yt]);const tr=ct.filter(e=>!e.provisional),rr=ae?Jt?Jt.ms:Et:void 0!==ee?ee:tr.length>0?null===ge?tr[tr.length-1].ms:Math.min(tr[tr.length-1].ms,ge):null,nr=new Set(he??[]),lr=ht.filter(e=>nr.has(e.key)).map(e=>e.x),ar=lr.length>0?{from:Math.min(...lr),to:Math.max(...lr)}:null,sr=p(()=>{clearTimeout(Te.current),clearTimeout(Be.current),je(null),Re(null),He(null),Oe(null),ze(null)},[]);h(()=>()=>{clearTimeout(Te.current),clearTimeout(Be.current)},[]),h(()=>{const e=Le.current;e&&(Le.current=null,Ce.current.get(e)?.focus())});const ir=null!==Fe||null!==Ue||null!==Ie||null!==We;h(()=>{if(ir)return i(e=>"Escape"===e.key&&(sr(),!0))},[ir,sr]);const or=p((e,t)=>{if(!e)return;const r=e.offsetWidth/2;let n=r>0?Math.max(r,Math.min(t,Qe-r)):t;const a=e.parentElement;if(r>0&&a){const t=l(e),s=a.getBoundingClientRect().left,i=t.left+8+r-s,o=t.right-8-r-s;i<=o&&(n=Math.max(i,Math.min(n,o)))}e.style.left=`${n}px`,e.style.setProperty("--rosh-tl-arrow",`${r+(t-n)}px`)},[Qe]),cr=Bt.find(e=>e.key===Fe)??null,ur=cr?cr.x:0;s(()=>{or(Ne.current,ur)},[or,Fe,ur]);const mr=Et??void 0,dr=u(null);h(()=>{if(void 0===mr)return;const e=wt.xByMs(mr),t=dr.current;if(dr.current=e,null===t||e<=t)return;const r=[];for(const n of ht){if(n.x<=t||n.x>e)continue;const l=Ce.current.get(Lt.get(n.key)??n.key);l&&(l.classList.add("is-hit"),r.push(setTimeout(()=>l.classList.remove("is-hit"),460)))}return()=>{for(const e of r)clearTimeout(e)}},[mr]);const hr=Bt.map(e=>e.key),pr=ot?Lt.get(ot)??null:null,xr=Se&&hr.includes(Se)?Se:pr&&hr.includes(pr)?pr:hr[0],fr=e=>{const t=hr.indexOf(e.target.dataset?.timelineKey??"");if(t<0)return;const r="ArrowRight"===e.key||"ArrowDown"===e.key?t+1:"ArrowLeft"===e.key||"ArrowUp"===e.key?t-1:"Home"===e.key?0:"End"===e.key?hr.length-1:-1;r<0||r>hr.length-1||(e.preventDefault(),Ee(hr[r]),Ce.current.get(hr[r])?.focus())},yr=()=>clearTimeout(Be.current),kr=e=>{yr(),ze(e)},gr=()=>{clearTimeout(Be.current),Be.current=setTimeout(()=>ze(null),260)},Mr=e=>{Ct&&gt.get(e)===Ct?yr():(yr(),ze(null))},vr=e=>{clearTimeout(Te.current),je(e),Re(e),pe?.((e=>{const t=Bt.find(t=>t.key===e);return t?.members[0]?.key??e})(e))},br=e=>{je(t=>t===e?null:t),clearTimeout(Te.current),Te.current=setTimeout(()=>Re(t=>t===e?null:t),160),pe?.(null)},$r=e=>({type:"button","data-timeline-node":e.isCap?"cap":e.isItem?"item":"marker","data-timeline-key":e.key,"aria-label":U(e),"aria-describedby":Fe===e.key?Xe:void 0,tabIndex:e.key===xr?0:-1,ref:t=>{t?Ce.current.set(e.key,t):Ce.current.delete(e.key)},onMouseEnter:()=>{Mr(e.key),vr(e.key)},onMouseLeave:()=>{gr(),br(e.key)},onFocus:()=>{Mr(e.key),vr(e.key),Ee(e.key)},onBlur:()=>{gr(),br(e.key)},onPointerDown:e=>e.stopPropagation(),onClick:t=>{t.stopPropagation(),e.onClick?.(),e.isItem&&le?.(e.key)}}),wr=e=>{return{type:"button","data-timeline-node":"fold","data-timeline-key":e.key,"data-timeline-count":String(e.members.length),"aria-label":(t=e.members,r=ve,r.events(t.length,t.map(U))),"aria-describedby":Fe===e.key?Xe:void 0,tabIndex:e.key===xr?0:-1,ref:t=>{t?Ce.current.set(e.key,t):Ce.current.delete(e.key)},onMouseEnter:()=>{e.openable?kr(e.key):vr(e.key)},onMouseLeave:()=>{gr(),br(e.key)},onFocus:()=>{yr(),vr(e.key),Ee(e.key)},onBlur:()=>{gr(),br(e.key)},onPointerDown:e=>e.stopPropagation(),onClick:t=>{if(t.stopPropagation(),!e.openable)return void vr(e.key);kr(e.key);const r=e.members[0];Ee(r.key),Le.current=r.key}};var t,r},Pr="lanes"!==re||ht.length>1;if(Ze)/* @__PURE__ */
78
- return x("div",{ref:Me,children:/* @__PURE__ */x(E,{marks:ht.filter(e=>!e.isCap),pending:w,currentKey:ot,todayMs:ge,reveal:Ot,ariaLabel:de,step:Wt,nodeProps:$r,onKeyDown:fr})});const Nr=(e,t)=>null==e||!1===e?null:/* @__PURE__ */x("span",{"aria-hidden":"true",className:"rosh-tl-flank"+(t?" is-end":""),"data-timeline-part":t?"end-caption":"start-caption",style:{paddingTop:Ye.rail-3+"px"},children:e});/* @__PURE__ */
77
+ /* @__PURE__ */x("div",{role:"slider",tabIndex:0,className:"rosh-tl-thumb text-blue-600","data-timeline-part":"thumb","aria-label":t.ariaLabel??v.scrub,"aria-valuemin":0,"aria-valuemax":T&&T.length>0?T.length-1:U,"aria-valuenow":T&&T.length>0?Math.max(0,B):Math.round((n-i)/r),"aria-valuetext":H,style:{left:`${P}px`,top:`${s.rail+3}px`},onPointerDown:K,onPointerMove:j,onPointerUp:A,onPointerCancel:A,onKeyDown:e=>{const t=(e=>{const{key:t}=e;if(T&&T.length>0){const e=B<0?0:B;return"ArrowRight"===t||"ArrowUp"===t?T[Math.min(e+1,T.length-1)]:"ArrowLeft"===t||"ArrowDown"===t?T[Math.max(e-1,0)]:"Home"===t?T[0]:"End"===t?T[T.length-1]:null}const l=(e.shiftKey?7:1)*r;return"ArrowRight"===t||"ArrowUp"===t?n+l:"ArrowLeft"===t||"ArrowDown"===t?n-l:"Home"===t?i:"End"===t?m:null})(e);null!==t&&(e.preventDefault(),k?.(),D(t))}})]})}function q(e,t,r){return(t?e.height:e.ruler+26)+(r?22:0)}function ee({startMs:t,endMs:k,axis:M="linear",items:v,markers:b=[],pending:w=[],fillToMs:ee,todayMs:te,labels:re="lanes",activeKey:ne=null,onActivate:le,thumb:ae,playback:se,edgeCaptions:ie,phases:oe=[],currentKey:ce,zoomRange:ue=null,motion:me=!0,ariaLabel:de,highlightKeys:he=null,onHoverChange:pe,endMark:xe=null}){const fe="none"===re,ye=a(Date.now,null),ke=a(D,!1),ge=te??ye,Me=u(null),ve=o().timeline,be=c(),$e=t=>e(t,be),we=u(null),Pe=u(null),Ne=u(null),Ce=u(/* @__PURE__ */new Map),Te=u(void 0),Be=u(void 0),Le=u(null),[De,Ke]=m({}),[Ae,Fe]=m(null),[Re,je]=m(null),[He,Ue]=m(null),[Ie,Oe]=m(null),[We,ze]=m(null),[Ee,Se]=m(null),Xe=d(),Ve=d(),Je=U(Me,!0),Ye=Je>0?Je-(w.length>0&&!fe?176:0):0,_e=Ye>0&&Ye-20<320,Ge=U(we,!_e),Qe=Ge>0?Ge:600,Ze=L[re],qe=fe&&w.length>0,et=qe?Math.max(0,Qe-36):Qe,tt=e=>e>=t-r&&e<=k+r,rt=v.filter(e=>Number.isFinite(e.ms)&&tt(e.ms)).slice().sort((e,t)=>e.ms-t.ms),nt="spread"===M?b.map(e=>new Date(e.date).getTime()).filter(e=>Number.isFinite(e)):[],lt=$([t,...[...rt.map(e=>e.ms),...nt].filter(e=>e>t&&e<k),k],et,"compressed"===(at=M)?{}:"spread"===at?{maxTimeShare:1/0}:{maxTimeShare:1/0,minGapPx:0});var at;const st=lt.xByMs,it=rt.filter(e=>!e.provisional),ot=ce??(it.length>0?it[it.length-1].key:null),ct=rt.map((e,t)=>{const r=e.date??$e(e.ms),n=(e.priority??0)>0||"report"===e.kind,l=function(e){const t=e.kind??"default";return"default"===t&&e.glyph&&"none"!==e.glyph?F[e.glyph]??t:t}(e);return{key:e.key,ms:e.ms,x:st(e.ms),baseX:st(e.ms),kind:l,label:e.label,dateText:r,detail:e.detail,preview:e.preview,glyph:R(e,l,0===t&&"default"===l),role:e.key===ot?"current":n?"dot":"key",widthPx:fe?Math.max(16,K(e.caption??"")+6):De[e.key]||N(e.label,r),collapsible:n,onClick:e.onClick,onOpen:e.onOpen,isItem:!0,caption:e.caption,provisional:!!e.provisional,isCap:!1}}),ut=b.map(e=>({marker:e,ms:new Date(e.date).getTime()})).filter(({ms:e})=>Number.isFinite(e)&&tt(e)).map(({marker:e,ms:t})=>{const r=`marker-${e.id}`,n=$e(t);return{key:r,ms:t,x:st(t),baseX:st(t),kind:e.kind,label:e.label,dateText:n,detail:e.detail,preview:e.preview,glyph:e.glyph??A[e.kind].glyph,role:"key",widthPx:De[r]||N(e.label,n),collapsible:!1,onClick:e.onClick?()=>e.onClick?.(e):void 0,onOpen:e.onOpen?()=>e.onOpen?.(e):void 0,isItem:!1,provisional:!1,isCap:!1}}),mt=qe?(()=>{const e=w[w.length-1],t=w.slice(0,-1).map(e=>e.label);return[{key:e.key,ms:k+r,x:Qe,baseX:Qe,kind:e.kind??"default",label:e.label,dateText:ve.notReached,detail:t.length>0?ve.alsoToCome(t):void 0,glyph:void 0,role:"key",widthPx:16,collapsible:!1,isItem:!1,provisional:!1,isCap:!0}]})():[],dt=fe&&xe&&!qe?[{key:xe.key,ms:k,x:et,baseX:et,kind:"default",label:xe.label,dateText:xe.dateText??$e(k),detail:xe.detail,glyph:void 0,role:"key",widthPx:16,collapsible:!1,isItem:!1,provisional:!1,isCap:!0}]:[],ht=[...ct,...ut,...mt,...dt].sort((e,t)=>e.x-t.x||e.ms-t.ms),pt=ie?.start??ve.start($e(t)),xt=null==pt||!1===pt?0:"string"==typeof pt?Math.ceil(K(pt)):96,ft="lanes"===re?function(e,t={}){const r=t.minPitchPx??40,n=[];let l=0;for(;l<e.length;){const t=e[l];if(!t.collapsible){n.push({type:"item",mark:t}),l+=1;continue}let a=l+1;for(;a<e.length&&e[a].collapsible&&e[a].kind===t.kind;)a+=1;const s=e.slice(l,a),i=s.length>1&&s.every((e,t)=>{if(0===t)return!0;const n=s[t-1],l=Math.max(r,Math.max(e.widthPx,n.widthPx)+8);return e.x-n.x<l});if(s.length>=3||i)n.push({type:"cluster",kind:t.kind,members:s});else for(const e of s)n.push({type:"item",mark:e});l=a}return n}(ht):[],yt=function(e,t=16){const r=[];let n=0;for(;n<e.length;){let l=n+1;for(;l<e.length&&e[l].x-e[l-1].x<t;)l+=1;if(l-n===1)r.push({type:"item",mark:e[n]});else{const t=e.slice(n,l),a=new Set(t.map(e=>e.kind));r.push({type:"cluster",kind:1===a.size?t[0].kind:P,members:t})}n=l}return r}(ht),kt=e=>"cluster"===e.type?`fold-${e.members[0].key}`:e.mark.key,gt=/* @__PURE__ */new Map;for(const e of yt)if("cluster"===e.type)for(const t of e.members)gt.set(t.key,kt(e));const Mt=He??Ie??We,vt=ft.find(e=>"cluster"===e.type&&(e=>"cluster"===e.type?`cluster-${e.members[0].key}`:e.mark.key)(e)===Mt)??yt.find(e=>"cluster"===e.type&&kt(e)===Mt),bt=e=>({x:e.baseX,widthPx:e.widthPx}),$t=vt&&"cluster"===vt.type?vt.members.map(bt):ue?ht.filter(e=>e.ms>=ue[0]&&e.ms<=ue[1]).map(bt):[],wt=$t.length>1?I(lt,$t,et):lt,Pt=wt!==lt;if(Pt)for(const e of ht)e.isCap||(e.x=wt.xByMs(e.ms));const Nt=ht.some(e=>e.x<14),Ct=Pt&&vt?Mt:null,Tt=e=>({key:e.key,mark:e,members:[e],x:e.x,kind:e.kind,openable:!1}),Bt=_e?ht.map(Tt):yt.flatMap(e=>{if("item"===e.type)return[Tt(e.mark)];const t=kt(e);if(t===Ct&&(r=e.members).every((e,t)=>0===t||e.x-r[t-1].x>=16))return e.members.map(Tt);var r;const n=e.members.map(e=>e.x);return[{key:t,mark:null,members:e.members,x:n.reduce((e,t)=>e+t,0)/n.length,kind:e.kind,openable:new Set(e.members.map(e=>e.ms)).size>1}]}),Lt=/* @__PURE__ */new Map;for(const e of Bt)for(const t of e.members)Lt.set(t.key,e.key);const Dt=yt.find(e=>"cluster"===e.type&&kt(e)===Ct),Kt=Dt&&"cluster"===Dt.type?{from:Math.min(...Dt.members.map(e=>e.x))-16,to:Math.max(...Dt.members.map(e=>e.x))+16}:null,At=u(Ct),[Ft,Rt]=m(!1);h(()=>{if(At.current===Ct)return;At.current=Ct,Rt(!0);const e=setTimeout(()=>Rt(!1),240);return()=>clearTimeout(e)},[Ct]);const jt=ht.map(e=>`${e.key} ${e.label} ${e.dateText}`).join("|");s(()=>{const e=Pe.current;if(!e)return;const t={};for(const r of Array.from(e.children)){const e=r.dataset.laneKey,n=r.getBoundingClientRect().width;e&&n>0&&(t[e]=n)}Ke(e=>function(e,t){const r=Object.keys(e);return r.length===Object.keys(t).length&&r.every(r=>Math.abs((e[r]??0)-(t[r]??0))<.5)}(e,t)?e:t)},[jt]);const Ht=`${re}|${M}|${ht.map(e=>`${e.key}@${e.ms}`).join("|")}`,[Ut,It]=m(Ht),Ot=me&&Ut===Ht;h(()=>{Ut!==Ht&&It(Ht)},[Ut,Ht]);const Wt=Math.min(28,340/Math.max(1,ht.length-1)),zt=O(ae?.stops),Et=e=>{const r=Math.min(Math.max(e,t),k);if(!zt)return r;let n=zt[0];for(const e of zt)Math.abs(e-r)<Math.abs(n-r)&&(n=e);return n},St=ae?Et(ae.valueMs):null,Xt=se&&ae?ct.filter(e=>!zt||zt.includes(e.ms)).map(e=>({key:e.key,ms:e.ms})):[],Vt=function(e,t,r={}){const n=Number.isFinite(r.speed)&&(r.speed??0)>0?r.speed:1,l=Math.max(0,r.dwellMs??700)/n,a=t.filter(e=>Number.isFinite(e.ms)).slice().sort((e,t)=>e.ms-t.ms),s=[];for(let t=0;t+1<a.length;t++){const i=a[t],o=a[t+1],c=e.xByMs(i.ms),u=e.xByMs(o.ms),m=Math.max(0,u-c),d=m<=.5||r.reducedMotion?0:C(350*m/100,450,1400)/n;s.push({fromKey:i.key,toKey:o.key,fromMs:i.ms,toMs:o.ms,fromPx:c,toPx:u,lengthPx:m,durationMs:d,dwellMs:l,msByPx:e.msByPx})}return s}(wt,Xt,{speed:se?.speed,reducedMotion:ke}),[Jt,Yt]=m(null),_t=u(null),Gt=u({segments:Vt,value:St,playback:se});h(()=>{Gt.current={segments:Vt,value:St,playback:se}});const Qt=u(null),Zt=p(e=>{null===e&&null===Qt.current||(Qt.current=e,Gt.current.playback?.onProgress?.(e))},[]),qt=p(()=>{_t.current=null,Yt(null),Zt(null),Gt.current.playback?.onStop?.()},[Zt]),er=!!se?.playing&&!!ae;h(()=>{if(!er)return;const e=Gt.current,t=null===e.value?-1:e.segments.findIndex(t=>t.fromMs===e.value);if(t<0)return void qt();_t.current&&_t.current.index===t||(_t.current={index:t,phase:"rest",t:0,restLeftMs:e.segments[t].dwellMs,sinceMs:null});let r,n=0;const l=e=>Yt(t=>t&&t.px===e.px&&t.ms===e.ms?t:e),a=()=>{clearTimeout(r);const e=_t.current;"rest"===e?.phase&&(r=setTimeout(s,Math.max(0,e.restLeftMs)))},s=()=>{const e=_t.current;if("rest"!==e?.phase)return;const t=Gt.current.segments[e.index];t?(_t.current={index:e.index,phase:"glide",t:0,restLeftMs:0,sinceMs:null},l(B(t,0))):qt()},i=e=>{const t=Gt.current,r=_t.current;if(!r)return;const s=function(e,t,r){const n=e[t.index];if(!n)return{cursor:null,at:null,arrived:null,progress:null};const l=null===t.sinceMs?0:Math.max(0,r-t.sinceMs);if("rest"===t.phase){const e=t.restLeftMs-l;return e>0?{cursor:{...t,restLeftMs:e,sinceMs:r},at:B(n,0),arrived:null,progress:null}:{cursor:{index:t.index,phase:"glide",t:0,restLeftMs:0,sinceMs:r},at:B(n,0),arrived:null,progress:null}}const a=n.durationMs>0?Math.min(1,t.t+l/n.durationMs):1,s=B(n,a);if(a<1)return{cursor:{...t,t:a,sinceMs:r},at:s,arrived:null,progress:{fromKey:n.fromKey,toKey:n.toKey,t:T(a),ms:s.ms}};const i=e[t.index+1];return{cursor:i?{index:t.index+1,phase:"rest",t:0,restLeftMs:i.dwellMs,sinceMs:r}:null,at:s,arrived:{key:n.toKey,ms:n.toMs},progress:null}}(t.segments,r,e);_t.current=s.cursor,s.at&&l(s.at),Zt(s.progress),s.arrived&&t.playback?.onArrive(s.arrived.key,s.arrived.ms),s.cursor?(s.cursor.phase===r.phase&&s.cursor.index===r.index||a(),n=requestAnimationFrame(i)):qt()};return a(),n=requestAnimationFrame(i),()=>{cancelAnimationFrame(n),clearTimeout(r),_t.current&&(_t.current.sinceMs=null,Zt(null))}},[er,qt,Zt]);const tr=ct.filter(e=>!e.provisional),rr=ae?Jt?Jt.ms:St:void 0!==ee?ee:tr.length>0?null===ge?tr[tr.length-1].ms:Math.min(tr[tr.length-1].ms,ge):null,nr=new Set(he??[]),lr=ht.filter(e=>nr.has(e.key)).map(e=>e.x),ar=lr.length>0?{from:Math.min(...lr),to:Math.max(...lr)}:null,sr=p(()=>{clearTimeout(Te.current),clearTimeout(Be.current),Fe(null),je(null),Ue(null),Oe(null),ze(null)},[]);h(()=>()=>{clearTimeout(Te.current),clearTimeout(Be.current)},[]),h(()=>{const e=Le.current;e&&(Le.current=null,Ce.current.get(e)?.focus())});const ir=null!==Re||null!==He||null!==Ie||null!==We;h(()=>{if(ir)return i(e=>"Escape"===e.key&&(sr(),!0))},[ir,sr]);const or=p((e,t)=>{if(!e)return;const r=e.offsetWidth/2;let n=r>0?Math.max(r,Math.min(t,Qe-r)):t;const a=e.parentElement;if(r>0&&a){const t=l(e),s=a.getBoundingClientRect().left,i=t.left+8+r-s,o=t.right-8-r-s;i<=o&&(n=Math.max(i,Math.min(n,o)))}e.style.left=`${n}px`,e.style.setProperty("--rosh-tl-arrow",`${r+(t-n)}px`)},[Qe]),cr=Bt.find(e=>e.key===Re)??null,ur=cr?cr.x:0;s(()=>{or(Ne.current,ur)},[or,Re,ur]);const mr=St??void 0,dr=u(null);h(()=>{if(void 0===mr)return;const e=wt.xByMs(mr),t=dr.current;if(dr.current=e,null===t||e<=t)return;const r=[];for(const n of ht){if(n.x<=t||n.x>e)continue;const l=Ce.current.get(Lt.get(n.key)??n.key);l&&(l.classList.add("is-hit"),r.push(setTimeout(()=>l.classList.remove("is-hit"),460)))}return()=>{for(const e of r)clearTimeout(e)}},[mr]);const hr=Bt.map(e=>e.key),pr=ot?Lt.get(ot)??null:null,xr=Ee&&hr.includes(Ee)?Ee:pr&&hr.includes(pr)?pr:hr[0],fr=e=>{const t=hr.indexOf(e.target.dataset?.timelineKey??"");if(t<0)return;const r="ArrowRight"===e.key||"ArrowDown"===e.key?t+1:"ArrowLeft"===e.key||"ArrowUp"===e.key?t-1:"Home"===e.key?0:"End"===e.key?hr.length-1:-1;r<0||r>hr.length-1||(e.preventDefault(),Se(hr[r]),Ce.current.get(hr[r])?.focus())},yr=()=>clearTimeout(Be.current),kr=e=>{yr(),ze(e)},gr=()=>{clearTimeout(Be.current),Be.current=setTimeout(()=>ze(null),260)},Mr=e=>{Ct&&gt.get(e)===Ct?yr():(yr(),ze(null))},vr=e=>{clearTimeout(Te.current),Fe(e),je(e),pe?.((e=>{const t=Bt.find(t=>t.key===e);return t?.members[0]?.key??e})(e))},br=e=>{Fe(t=>t===e?null:t),clearTimeout(Te.current),Te.current=setTimeout(()=>je(t=>t===e?null:t),160),pe?.(null)},$r=e=>({type:"button","data-timeline-node":e.isCap?"cap":e.isItem?"item":"marker","data-timeline-key":e.key,"aria-label":H(e),"aria-describedby":Re===e.key?Xe:void 0,tabIndex:e.key===xr?0:-1,ref:t=>{t?Ce.current.set(e.key,t):Ce.current.delete(e.key)},onMouseEnter:()=>{Mr(e.key),vr(e.key)},onMouseLeave:()=>{gr(),br(e.key)},onFocus:()=>{Mr(e.key),vr(e.key),Se(e.key)},onBlur:()=>{gr(),br(e.key)},onPointerDown:e=>e.stopPropagation(),onClick:t=>{t.stopPropagation(),e.onClick?.(),e.isItem&&le?.(e.key)}}),wr=e=>{return{type:"button","data-timeline-node":"fold","data-timeline-key":e.key,"data-timeline-count":String(e.members.length),"aria-label":(t=e.members,r=ve,r.events(t.length,t.map(H))),"aria-describedby":Re===e.key?Xe:void 0,tabIndex:e.key===xr?0:-1,ref:t=>{t?Ce.current.set(e.key,t):Ce.current.delete(e.key)},onMouseEnter:()=>{e.openable?kr(e.key):vr(e.key)},onMouseLeave:()=>{gr(),br(e.key)},onFocus:()=>{yr(),vr(e.key),Se(e.key)},onBlur:()=>{gr(),br(e.key)},onPointerDown:e=>e.stopPropagation(),onClick:t=>{if(t.stopPropagation(),!e.openable)return void vr(e.key);kr(e.key);const r=e.members[0];Se(r.key),Le.current=r.key}};var t,r},Pr="lanes"!==re||ht.length>1;if(_e)/* @__PURE__ */
78
+ return x("div",{ref:Me,children:/* @__PURE__ */x(S,{marks:ht.filter(e=>!e.isCap),pending:w,currentKey:ot,todayMs:ge,reveal:Ot,ariaLabel:de,step:Wt,nodeProps:$r,onKeyDown:fr})});const Nr=(e,t)=>null==e||!1===e?null:/* @__PURE__ */x("span",{"aria-hidden":"true",className:"rosh-tl-flank"+(t?" is-end":""),"data-timeline-part":t?"end-caption":"start-caption",style:{paddingTop:Ze.rail-3+"px"},children:e});/* @__PURE__ */
79
79
  return f("div",{ref:Me,className:"rosh-tl-body"+(w.length>0&&!fe?"":" is-solo"),children:[
80
80
  /* @__PURE__ */f("div",{className:"flex items-stretch gap-3",children:[fe&&Nr(pt,!1),
81
- /* @__PURE__ */x("div",{className:"rosh-tl-stage",style:{height:`${q(Ye,Pr,oe.length>0&&!fe)}px`},children:/* @__PURE__ */f("div",{ref:we,className:`rosh-tl-layer${jt?" is-zooming":""}${Jt?" is-gliding":""}`,onMouseMove:e=>{if(!Kt)return;const t=we.current?.getBoundingClientRect();if(!t)return;const r=e.clientX-t.left;r>=Kt.from&&r<=Kt.to?yr():gr()},onMouseLeave:gr,children:[!fe&&/* @__PURE__ */x(W,{marks:ht,innerRef:Pe}),
82
- /* @__PURE__ */x(X,{axis:wt,geo:Ye,fillTo:rr,reveal:Ot,trackPx:et,restTo:ae&&!Jt&&null!=ae.restMs&&ae.restMs!==Et?Math.min(Math.max(ae.restMs,t),k):null,tweened:!!ae&&(null==ae.restMs||ae.restMs===Et)}),qe&&
83
- /* @__PURE__ */x("i",{"aria-hidden":"true",className:"rosh-tl-tail","data-timeline-part":"tail",style:{left:`${et}px`,width:Qe-et+"px",top:Ye.rail+3-1+"px"}}),ar&&/* @__PURE__ */x("div",{"aria-hidden":"true",className:"rosh-tl-band","data-timeline-part":"highlight",style:{left:ar.from-10+"px",width:ar.to-ar.from+20+"px",top:Ye.rail-7+"px",height:"20px"}}),
84
- /* @__PURE__ */x(z,{startMs:t,endMs:k,axis:wt,geo:Ye,reveal:Ot}),
85
- /* @__PURE__ */x(V,{geo:Ye,caption:fe?null:pt,endCaption:fe?null:ie?.end,around:Nt,reveal:Ot,trackPx:Qe}),fe&&/* @__PURE__ */x(G,{nodes:Bt,geo:Ye,reveal:Ot}),null!==ge&&ge>t&&ge<=k+r&&/* @__PURE__ */x(J,{x:wt.xByMs(Math.min(ge,k)),geo:Ye,trackPx:Qe,label:$e(ge),reveal:Ot}),!fe&&oe.map(e=>/* @__PURE__ */x(Z,{phase:e,geo:Ye,xOf:wt.xByMs},e.key)),
86
- /* @__PURE__ */x("ol",{className:"rosh-tl-nodes","aria-label":de,onKeyDown:fr,children:Bt.map((e,t)=>{const r=t=>null!==t&&e.members.some(e=>e.key===t),l=`${Ye.rail+3}px`,a=Ot?n(t,Wt):{},s=(e=>!!ar&&e.x>=ar.from-.5&&e.x<=ar.to+.5)(e)?" is-lit":"";if(e.mark?.isCap)/* @__PURE__ */
87
- return x("li",{children:/* @__PURE__ */x("button",{...$r(e.mark),className:`rosh-tl-node rosh-tl-mark is-cap${s}${Ot?" rosh-tl-pop":""}`,style:{left:`${e.x}px`,top:l,...a}})},e.key);if(!e.mark){const t=e.kind===P,n=R(t?"default":e.kind,"key"),i=t?void 0:A[e.kind]?.glyph;/* @__PURE__ */
81
+ /* @__PURE__ */x("div",{className:"rosh-tl-stage",style:{height:`${q(Ze,Pr,oe.length>0&&!fe)}px`},children:/* @__PURE__ */f("div",{ref:we,className:`rosh-tl-layer${Ft?" is-zooming":""}${Jt?" is-gliding":""}`,onMouseMove:e=>{if(!Kt)return;const t=we.current?.getBoundingClientRect();if(!t)return;const r=e.clientX-t.left;r>=Kt.from&&r<=Kt.to?yr():gr()},onMouseLeave:gr,children:[!fe&&/* @__PURE__ */x(W,{marks:ht,innerRef:Pe}),
82
+ /* @__PURE__ */x(X,{axis:wt,geo:Ze,fillTo:rr,reveal:Ot,trackPx:et,restTo:ae&&!Jt&&null!=ae.restMs&&ae.restMs!==St?Math.min(Math.max(ae.restMs,t),k):null,tweened:!!ae&&(null==ae.restMs||ae.restMs===St)}),qe&&
83
+ /* @__PURE__ */x("i",{"aria-hidden":"true",className:"rosh-tl-tail","data-timeline-part":"tail",style:{left:`${et}px`,width:Qe-et+"px",top:Ze.rail+3-1+"px"}}),ar&&/* @__PURE__ */x("div",{"aria-hidden":"true",className:"rosh-tl-band","data-timeline-part":"highlight",style:{left:ar.from-10+"px",width:ar.to-ar.from+20+"px",top:Ze.rail-7+"px",height:"20px"}}),
84
+ /* @__PURE__ */x(z,{startMs:t,endMs:k,axis:wt,geo:Ze,reveal:Ot}),
85
+ /* @__PURE__ */x(V,{geo:Ze,caption:fe?null:pt,endCaption:fe?null:ie?.end,around:Nt,reveal:Ot,trackPx:Qe}),fe&&/* @__PURE__ */x(Y,{nodes:Bt,geo:Ze,reveal:Ot}),null!==ge&&ge>t&&ge<=k+r&&/* @__PURE__ */x(J,{x:wt.xByMs(Math.min(ge,k)),geo:Ze,trackPx:Qe,label:$e(ge),reveal:Ot}),!fe&&oe.map(e=>/* @__PURE__ */x(_,{phase:e,geo:Ze,xOf:wt.xByMs},e.key)),
86
+ /* @__PURE__ */x("ol",{className:"rosh-tl-nodes","aria-label":de,onKeyDown:fr,children:Bt.map((e,t)=>{const r=t=>null!==t&&e.members.some(e=>e.key===t),l=`${Ze.rail+3}px`,a=Ot?n(t,Wt):{},s=(e=>!!ar&&e.x>=ar.from-.5&&e.x<=ar.to+.5)(e)?" is-lit":"";if(e.mark?.isCap)/* @__PURE__ */
87
+ return x("li",{children:/* @__PURE__ */x("button",{...$r(e.mark),className:`rosh-tl-node rosh-tl-mark is-cap${s}${Ot?" rosh-tl-pop":""}`,style:{left:`${e.x}px`,top:l,...a}})},e.key);if(!e.mark){const t=e.kind===P,n=j(t?"default":e.kind,"key"),i=t?void 0:A[e.kind]?.glyph;/* @__PURE__ */
88
88
  return f("li",{...r(ot)?{"aria-current":"step"}:{},children:[
89
- /* @__PURE__ */f("button",{...wr(e),className:`${n.className} is-fold${t?" is-mixed":""}${r(ne)?" is-active":""}${s}${Ot?" rosh-tl-pop":""}`,style:{...n.style,left:`${e.x}px`,top:l,...a},children:[i&&/* @__PURE__ */x(g,{name:i}),t&&/* @__PURE__ */f("span",{"aria-hidden":"true",className:"rosh-tl-foldnum",children:["×",e.members.length]})]}),!t&&/* @__PURE__ */f("i",{"aria-hidden":"true",className:"rosh-tl-count"+(Ot?" rosh-tl-fade":""),style:{left:`${e.x}px`,top:l},children:["×",e.members.length]})]},e.key)}const i=e.mark,o=R(i.kind,i.role,i.provisional),{glyph:c}=i;/* @__PURE__ */
90
- return x("li",{...i.key===ot?{"aria-current":"step"}:{},children:/* @__PURE__ */f("button",{...$r(i),className:`${o.className}${i.key===ne?" is-active":""}${s}${Ot?" rosh-tl-pop":""}`,style:{...o.style,left:`${i.x}px`,top:l,...a},children:[c&&/* @__PURE__ */x(g,{name:c}),"current"===i.role&&/* @__PURE__ */x("span",{"aria-hidden":"true",className:"rosh-tl-pulse bg-blue-600"+(Ot?" is-on":"")})]})},i.key)})}),"lanes"===re?/* @__PURE__ */x(Q,{groups:ft,trackPx:Qe,geo:Ye,startMs:t,endMs:k,currentKey:ot,hoveredKey:Ae,reveal:Ot,step:Wt,zoomedKey:Ct,popId:Ve,aimBubble:or,startCaptionPx:xt,openCluster:Ue,setOpenCluster:He,previewCluster:Ie,setPreviewCluster:Oe,setZoomKey:ze}):"active"===re?/* @__PURE__ */x(_,{nodes:Bt,trackPx:Qe,geo:Ye,activeKey:ne,hoveredKey:Ae,currentKey:ot}):null,cr&&/* @__PURE__ */x("div",{ref:Ne,id:Xe,role:"tooltip",className:"rosh-tl-bubble"+(cr.members.some(e=>e.preview)?" is-preview":""),"data-timeline-part":"tooltip",style:{top:`${Ye.rail+6+6}px`},onMouseEnter:()=>{yr(),vr(cr.key)},onMouseLeave:()=>{gr(),br(cr.key)},onFocus:()=>{yr(),vr(cr.key)},onBlur:()=>{gr(),br(cr.key)},children:cr.mark?/* @__PURE__ */f(y,{children:[
89
+ /* @__PURE__ */f("button",{...wr(e),className:`${n.className} is-fold${t?" is-mixed":""}${r(ne)?" is-active":""}${s}${Ot?" rosh-tl-pop":""}`,style:{...n.style,left:`${e.x}px`,top:l,...a},children:[i&&/* @__PURE__ */x(g,{name:i}),t&&/* @__PURE__ */f("span",{"aria-hidden":"true",className:"rosh-tl-foldnum",children:["×",e.members.length]})]}),!t&&/* @__PURE__ */f("i",{"aria-hidden":"true",className:"rosh-tl-count"+(Ot?" rosh-tl-fade":""),style:{left:`${e.x}px`,top:l},children:["×",e.members.length]})]},e.key)}const i=e.mark,o=j(i.kind,i.role,i.provisional),{glyph:c}=i;/* @__PURE__ */
90
+ return x("li",{...i.key===ot?{"aria-current":"step"}:{},children:/* @__PURE__ */f("button",{...$r(i),className:`${o.className}${i.key===ne?" is-active":""}${s}${Ot?" rosh-tl-pop":""}`,style:{...o.style,left:`${i.x}px`,top:l,...a},children:[c&&/* @__PURE__ */x(g,{name:c}),"current"===i.role&&/* @__PURE__ */x("span",{"aria-hidden":"true",className:"rosh-tl-pulse bg-blue-600"+(Ot?" is-on":"")})]})},i.key)})}),"lanes"===re?/* @__PURE__ */x(Q,{groups:ft,trackPx:Qe,geo:Ze,startMs:t,endMs:k,currentKey:ot,hoveredKey:Ae,reveal:Ot,step:Wt,zoomedKey:Ct,popId:Ve,aimBubble:or,startCaptionPx:xt,openCluster:He,setOpenCluster:Ue,previewCluster:Ie,setPreviewCluster:Oe,setZoomKey:ze}):"active"===re?/* @__PURE__ */x(G,{nodes:Bt,trackPx:Qe,geo:Ze,activeKey:ne,hoveredKey:Ae,currentKey:ot}):null,cr&&/* @__PURE__ */x("div",{ref:Ne,id:Xe,role:"tooltip",className:"rosh-tl-bubble"+(cr.members.some(e=>e.preview)?" is-preview":""),"data-timeline-part":"tooltip",style:{top:`${Ze.rail+6+6}px`},onMouseEnter:()=>{yr(),vr(cr.key)},onMouseLeave:()=>{gr(),br(cr.key)},onFocus:()=>{yr(),vr(cr.key)},onBlur:()=>{gr(),br(cr.key)},children:cr.mark?/* @__PURE__ */f(y,{children:[
91
91
  /* @__PURE__ */x("span",{className:"rosh-tl-name",children:cr.mark.label}),
92
92
  /* @__PURE__ */x("span",{className:"rosh-tl-date",children:cr.mark.dateText}),cr.mark.preview?/* @__PURE__ */x("div",{className:"rosh-tl-preview","data-timeline-part":"preview",children:cr.mark.preview}):cr.mark.detail&&/* @__PURE__ */x("span",{className:"rosh-tl-detail",children:cr.mark.detail}),(cr.mark.onOpen??cr.mark.onClick)&&/* @__PURE__ */x("button",{type:"button",className:"rosh-tl-bubble-open text-blue-600","data-timeline-part":"bubble-open",onClick:()=>(cr.mark?.onOpen??cr.mark?.onClick)?.(),children:ve.openButton})]}):
93
93
  /* @__PURE__ */f("div",{className:"rosh-tl-fold-list","data-timeline-part":"fold-members",children:[
@@ -95,5 +95,5 @@ return x("li",{...i.key===ot?{"aria-current":"step"}:{},children:/* @__PURE__ */
95
95
  /* @__PURE__ */x("ol",{children:cr.members.map(e=>/* @__PURE__ */f("li",{children:[
96
96
  /* @__PURE__ */f("p",{className:"rosh-tl-foldrow",children:[
97
97
  /* @__PURE__ */x("span",{children:e.label}),
98
- /* @__PURE__ */x("span",{className:"rosh-tl-date",children:e.dateText})]}),e.preview?/* @__PURE__ */x("div",{className:"rosh-tl-preview","data-timeline-part":"preview",children:e.preview}):e.detail&&/* @__PURE__ */x("span",{className:"rosh-tl-detail",children:e.detail})]},e.key))})]})}),ae&&null!==Et&&
99
- /* @__PURE__ */x(Y,{thumb:ae,value:Et,snap:St,axis:wt,geo:Ye,startMs:t,endMs:k,trackPx:Qe,layerRef:we,glide:Jt,onScrub:se?qt:void 0,nodes:Xt,onProgress:Yt})]})}),fe&&Nr(ie?.end,!0)]}),w.length>0&&!fe&&/* @__PURE__ */x(S,{pending:w,reveal:Ot})]})}export{g as TimelineGlyph,M as TimelineMilestoneIcon,v as TimelineProgressIcon,ee as TimelineTrack};
98
+ /* @__PURE__ */x("span",{className:"rosh-tl-date",children:e.dateText})]}),e.preview?/* @__PURE__ */x("div",{className:"rosh-tl-preview","data-timeline-part":"preview",children:e.preview}):e.detail&&/* @__PURE__ */x("span",{className:"rosh-tl-detail",children:e.detail})]},e.key))})]})}),ae&&null!==St&&
99
+ /* @__PURE__ */x(Z,{thumb:ae,value:St,snap:Et,axis:wt,geo:Ze,startMs:t,endMs:k,trackPx:Qe,layerRef:we,glide:Jt,onScrub:se?qt:void 0,nodes:Xt,onProgress:Zt})]})}),fe&&Nr(ie?.end,!0)]}),w.length>0&&!fe&&/* @__PURE__ */x(E,{pending:w,reveal:Ot})]})}export{g as TimelineGlyph,M as TimelineMilestoneIcon,v as TimelineProgressIcon,ee as TimelineTrack};
@@ -1,15 +1,15 @@
1
- import{TimelineCard as e}from"./chunk-S4Z657L6.js";import{TimelineGlyph as t,TimelineProgressIcon as r,TimelineTrack as n}from"./chunk-ZJZHUPUH.js";import{toDayMs as a,fmtSliderDate as i}from"./chunk-GXVWI3U5.js";import{DAY_MS as o}from"./chunk-JRQMX4PK.js";import{Icon as s}from"./chunk-ISVODSRP.js";import{useBrowserValueOnce as l}from"./chunk-D65T4H6J.js";import{useShellStrings as c,useShellLocale as d,splitAround as p}from"./chunk-DEJIH3ZQ.js";import{useState as u,useEffect as m,useRef as g}from"react";import{jsxs as h,jsx as b,Fragment as y}from"react/jsx-runtime";var k=/* @__PURE__ */new Set(["finished","partial_shipped","shipped","completed","cancelled"]),f=[{key:"casting",label:"Casting",weight:.2},{key:"cnc",label:"CNC",weight:.2},{key:"painting",label:"Painting",weight:.5},{key:"packing",label:"Packing",weight:.1},{key:"finished_goods",label:"FG",weight:0},{key:"stock_qty",label:"Stock",weight:0}];function _(e){if(e.order_qty<=0)return 0;let t=0;for(const r of f)if(r.weight>0){t+=Math.min((e[r.key]||0)/e.order_qty,1)*r.weight}return 100*t}function v(e){const t=e?.items??[];return 0===t.length?0:t.reduce((e,t)=>e+_(t),0)/t.length}function M(e){const{reports:t,poProductionStartDate:r,poEstCompletionDate:n,poStatus:i,poNumber:s="",currentReportId:d,currentReportDate:p,msPerDayOfPlayback:h=500,markers:b=[]}=e,[y,f]=u(null),[_,v]=u(null),M=c().production;m(()=>{p?f(new Date(p).getTime()):t.length>0&&f(new Date(t[0].date).getTime())},[d]);const[w,P]=u(!1),N=g(null),S=()=>{null!=N.current&&(cancelAnimationFrame(N.current),N.current=null),P(!1)};m(()=>()=>S(),[]),m(()=>{S()},[d]);const x=t.map(e=>a(e.date)).filter(e=>null!=e),D=l(Date.now,null)??Math.max(0,...x,...b.map(e=>a(e.date)??0),a(r??null)??0,a(n??null)??0),R=x.length?Math.min(...x):D,C=x.length?Math.max(...x):D,q=a(r??null)??R,O=a(n??null)??0,I=k.has((i||"").toLowerCase()),j=b.reduce((e,t)=>{const r=a(t.date);return null!=r&&r>e?r:e},0),T=(()=>{const e=[O,C,j,q+o];return I||e.push(D),Math.max(...e)})(),$=Math.max(1,Math.round((T-q)/o)),A=a(p??null)??C??q,L=e=>Math.min(Math.max(e,q),T),F=L(y??A),H=null!=_?L(_):F,J=t.find(e=>{const t=a(e.date);return null!=t&&t<=H})??null;let Z=null;for(let e=t.length-1;e>=0;e--){const r=a(t[e].date);if(null!=r&&r>H){Z=t[e];break}}const U=(()=>{if(J||!Z||0===t.length)return null;const e=(t[t.length-1].items??[]).map((e,t)=>({id:`zero-${e.part_number}-${t}`,part_number:e.part_number,description:e.description??"",order_qty:Number(e.order_qty||0),casting:0,cnc:0,painting:0,packing:0,finished_goods:0,stock_qty:0}));return{id:`zero-${s}`,progress_number:M.start,date:r||new Date(q).toISOString().slice(0,10),items:e,est_completion_date:n??null,created_by_name:"",notes:""}})(),z=J??U,E=J?a(J.date):U?q:null,G=Z?a(Z.date):null,K=!!(z&&Z&&null!=E&&null!=G&&H>E&&H<G),Q=a(n??null),V=!!(J&&!Z&&null!=E&&null!=Q&&Q>E&&H>E);let X,B;if(K&&null!=E&&null!=G){const e=(H-E)/Math.max(G-E,1),t=(t,r)=>Math.round(t+(r-t)*e),r={};for(const e of z?.items??[])r[e.part_number]=e;const n={};for(const e of Z?.items??[])n[e.part_number]=e;const i=Array.from(/* @__PURE__ */new Set([...Object.keys(r),...Object.keys(n)])).map((e,a)=>{const i=r[e]??{},o=n[e]??{},s=e=>Number(e)||0;return{id:`interp-${e}-${a}`,part_number:e,description:i.description??o.description??"",order_qty:s(i.order_qty??o.order_qty??0),casting:t(s(i.casting),s(o.casting)),cnc:t(s(i.cnc),s(o.cnc)),painting:t(s(i.painting),s(o.painting)),packing:t(s(i.packing),s(o.packing)),finished_goods:t(s(i.finished_goods),s(o.finished_goods)),stock_qty:t(s(i.stock_qty),s(o.stock_qty))}}),o=a(z?.est_completion_date),s=a(Z?.est_completion_date);let l;l=null!=o&&null!=s?new Date(Math.round(o+(s-o)*e)).toISOString().slice(0,10):z?.est_completion_date||Z?.est_completion_date||null,X={id:`interp-${H}`,progress_number:M.estimated,date:new Date(H).toISOString().slice(0,10),created_by_name:"",est_completion_date:l,items:i,notes:""},B=z}else if(V&&J&&null!=E&&null!=Q){const e=Math.min(1,(H-E)/Math.max(Q-E,1)),t=e=>Number(e)||0,r=(J.items??[]).map((r,n)=>{const a=t(r.order_qty),i=r=>{const n=t(r);return n>=a?n:Math.round(n+(a-n)*e)};return{id:`proj-${r.part_number}-${n}`,part_number:r.part_number,description:r.description??"",order_qty:a,casting:i(r.casting),cnc:i(r.cnc),painting:i(r.painting),packing:i(r.packing),finished_goods:i(r.finished_goods),stock_qty:i(r.stock_qty)}});X={id:`proj-${H}`,progress_number:M.estimated,date:new Date(H).toISOString().slice(0,10),created_by_name:"",est_completion_date:n??J.est_completion_date??null,items:r,notes:""},B=J}else if(X=z??t[t.length-1]??null,X){const e=t.findIndex(e=>e.id===X.id);B=e>=0&&e<t.length-1?t[e+1]:null}else B=null;const W={};for(const e of B?.items??[])W[e.part_number]=e;const Y=!(!d||X?.id===d),ee=d?Math.min(a(p??null)??T,T):T,te=d?t.find(e=>e.id===d)?.progress_number:void 0;return{startMs:q,endMs:T,totalLeadDays:$,scrubMs:H,setScrubMs:e=>{S(),v(null),f(e)},committedScrubMs:F,setPreviewMs:e=>{w||v(e)},previewing:null!=_,resetToCurrent:()=>{S(),p&&f(new Date(p).getTime())},scrubbedAway:Y,beforeAnchor:z,nextAfter:Z,displayed:X,prevReport:B,prevByPN:W,isInterpolated:K,isProjected:V,playing:w,startPlay:()=>{if(w)return void S();if(ee<=q)return void f(ee);P(!0),f(q);let e=performance.now(),t=q;const r=n=>{const a=n-e;if(e=n,t+=a/h*o,t>=ee)return f(ee),N.current=null,void P(!1);f(t),N.current=requestAnimationFrame(r)};N.current=requestAnimationFrame(r)},stopPlay:S,reports:t,markers:b,poNumber:s,currentReportId:d,currentReportProgressNumber:te,estCompletionMs:a(n??null)}}function w({startMs:e,endMs:t,reports:r,markers:a,valueMs:s,activeId:l,onChange:p,onPickReport:u,onOpenReport:m,onOpenMarker:g,onDragStart:h,renderReportPreview:y,reportLabel:k,playback:f,edgeCaptions:_,bare:v=!1,endMark:M=null,onPreview:w,restMs:P}){const N=c().production,S=d(),x=r.map(e=>({report:e,ms:new Date(e.date).getTime()})).filter(({ms:e})=>Number.isFinite(e)).sort((e,t)=>e.ms-t.ms),D=x.map(({report:e,ms:t})=>({key:e.id,ms:t,kind:"report",label:k(e),preview:e.preview??y?.(e),onOpen:m?()=>m(e.id):void 0})),R=new Map(x.map(({report:e,ms:t})=>[e.id,t])),C=e=>Math.round(e/o)*o,q=g?a.map(e=>({...e,onOpen:g})):a;/* @__PURE__ */
2
- return b("div",{className:"select-none",children:/* @__PURE__ */b(n,{axis:v?"spread":"linear",labels:v?"none":"active",endMark:v?M:null,items:D,markers:q,startMs:e,endMs:t,activeKey:l,onActivate:e=>{const t=R.get(e);null!=t&&p(t),u(e)},playback:f,edgeCaptions:_,thumb:{valueMs:s,onChange:e=>p(C(e)),onDragStart:h,onPreview:w?e=>w(null==e?null:C(e)):void 0,restMs:P,ariaLabel:N.scrub,valueText:e=>{const t=(e=>x.find(t=>t.ms===e)?.report)(e);return t?`${k(t)} · ${i(e,S)}`:i(e,S)}},ariaLabel:N.label(i(e,S),i(t,S))})})}function P({snapshot:n,onPickReport:o,onOpenReport:l,onOpenMarker:m,renderReportPreview:k,onScrubProgress:f,heading:_,edgeCaptions:M,reportLabel:P=e=>e.progress_number,resetLabel:N,variant:S="card",onPlayStart:x}){const{reports:D,markers:R,poNumber:C,startMs:q,endMs:O,totalLeadDays:I,scrubMs:j,setScrubMs:T,committedScrubMs:$,setPreviewMs:A,previewing:L,displayed:F,scrubbedAway:H,resetToCurrent:J,currentReportId:Z,currentReportProgressNumber:U,estCompletionMs:z,isInterpolated:E,isProjected:G}=n,K=!(!E&&!G),Q=function(e,t,r){const[n,a]=u(!1),i=g(!1);return{playing:n,toggle:()=>{n?a(!1):0!==e.length&&(r?.(),i.current||(i.current=!0,t(e[0])),a(!0))},stop:()=>{i.current=!1,a(!1)}}}(D.map(e=>a(e.date)).filter(e=>null!=e).sort((e,t)=>e-t),T,x),V=c().production,X=d(),B=_??V.heading,W=e=>i(e,X);if(0===D.length&&0===R.length)return null;const Y=R.filter(e=>"shipment"===e.kind),ee=R.filter(e=>"inspection"===e.kind),te=R.filter(e=>"invoice"===e.kind),re=(F?.items??[]).reduce((e,t)=>e+(Number(t.stock_qty)||0),0),ne=F?v(F):0,ae=D.find(e=>e.id===Z),ie=ae?P(ae):U,oe=
3
- /* @__PURE__ */h("button",{type:"button",onClick:Q.toggle,"aria-pressed":Q.playing,title:Q.playing?V.pause:V.playTitle,className:"rosh-tl-play text-gray-700 border-gray-300 hover:text-blue-600 hover:border-blue-600",children:[Q.playing?/* @__PURE__ */b(s,{name:"pause","aria-hidden":"true"}):/* @__PURE__ */b(s,{name:"play","aria-hidden":"true"}),
4
- /* @__PURE__ */b("span",{children:Q.playing?V.pause:V.play})]}),se=H&&(N??ie)?/* @__PURE__ */b("button",{type:"button",onClick:()=>{Q.stop(),J()},className:"text-xs text-blue-600 underline-offset-4 hover:underline font-medium",children:N??V.backTo(String(ie))}):null,[le,ce]=p(V.showing),de=e=>/* @__PURE__ */b("p",{className:"rosh-tl-status text-gray-800",children:F?/* @__PURE__ */h(y,{children:[e&&le,
5
- /* @__PURE__ */b("b",{className:"font-medium",children:K?V.estimated:P(F)}),e&&ce,
6
- /* @__PURE__ */h("span",{className:"text-gray-500",children:[" · ",W(new Date(F.date).getTime())," · ",V.overall(Math.round(ne))," · ",V.inStock(re)]})]}):/* @__PURE__ */b("span",{className:"text-gray-500",children:V.noReport})});if("rail"===S){const e=null!=z&&z>=O&&O>q,t=e?{key:"__estimate__",label:V.estimatedCompletion,dateText:W(z)}:null;/* @__PURE__ */
1
+ import{TimelineCard as e}from"./chunk-S4Z657L6.js";import{TimelineGlyph as t,TimelineProgressIcon as r,TimelineTrack as n}from"./chunk-F3G7S5HO.js";import{toDayMs as a,fmtSliderDate as i}from"./chunk-5CFERCYW.js";import{DAY_MS as o}from"./chunk-JRQMX4PK.js";import{Icon as s}from"./chunk-ISVODSRP.js";import{useBrowserValueOnce as l}from"./chunk-D65T4H6J.js";import{useShellStrings as c,useShellLocale as d,splitAround as p}from"./chunk-DEJIH3ZQ.js";import{useState as u,useEffect as m,useRef as g}from"react";import{jsxs as h,jsx as b,Fragment as y}from"react/jsx-runtime";var k=/* @__PURE__ */new Set(["finished","partial_shipped","shipped","completed","cancelled"]),f=[{key:"casting",label:"Casting",weight:.2},{key:"cnc",label:"CNC",weight:.2},{key:"painting",label:"Painting",weight:.5},{key:"packing",label:"Packing",weight:.1},{key:"finished_goods",label:"FG",weight:0},{key:"stock_qty",label:"Stock",weight:0}];function _(e){if(e.order_qty<=0)return 0;let t=0;for(const r of f)if(r.weight>0){t+=Math.min((e[r.key]||0)/e.order_qty,1)*r.weight}return 100*t}function v(e){const t=e?.items??[];return 0===t.length?0:t.reduce((e,t)=>e+_(t),0)/t.length}function M(e){const{reports:t,poProductionStartDate:r,poEstCompletionDate:n,poStatus:i,poNumber:s="",currentReportId:d,currentReportDate:p,msPerDayOfPlayback:h=500,markers:b=[]}=e,[y,f]=u(null),[_,v]=u(null),M=c().production;m(()=>{p?f(new Date(p).getTime()):t.length>0&&f(new Date(t[0].date).getTime())},[d]);const[w,P]=u(!1),N=g(null),S=()=>{null!=N.current&&(cancelAnimationFrame(N.current),N.current=null),P(!1)};m(()=>()=>S(),[]),m(()=>{S()},[d]);const x=t.map(e=>a(e.date)).filter(e=>null!=e),D=l(Date.now,null)??Math.max(0,...x,...b.map(e=>a(e.date)??0),a(r??null)??0,a(n??null)??0),C=x.length?Math.min(...x):D,R=x.length?Math.max(...x):D,q=a(r??null)??C,O=a(n??null)??0,j=k.has((i||"").toLowerCase()),I=b.reduce((e,t)=>{const r=a(t.date);return null!=r&&r>e?r:e},0),T=(()=>{const e=[O,R,I,q+o];return j||e.push(D),Math.max(...e)})(),$=Math.max(1,Math.round((T-q)/o)),A=a(p??null)??R??q,L=e=>Math.min(Math.max(e,q),T),F=L(y??A),E=null!=_?L(_):F,H=t.find(e=>{const t=a(e.date);return null!=t&&t<=E})??null;let J=null;for(let e=t.length-1;e>=0;e--){const r=a(t[e].date);if(null!=r&&r>E){J=t[e];break}}const z=(()=>{if(H||!J||0===t.length)return null;const e=(t[t.length-1].items??[]).map((e,t)=>({id:`zero-${e.part_number}-${t}`,part_number:e.part_number,description:e.description??"",order_qty:Number(e.order_qty||0),casting:0,cnc:0,painting:0,packing:0,finished_goods:0,stock_qty:0}));return{id:`zero-${s}`,progress_number:M.start,date:r||new Date(q).toISOString().slice(0,10),items:e,est_completion_date:n??null,created_by_name:"",notes:""}})(),G=H??z,K=H?a(H.date):z?q:null,Q=J?a(J.date):null,Z=!!(G&&J&&null!=K&&null!=Q&&E>K&&E<Q),B=a(n??null),V=!!(H&&!J&&null!=K&&null!=B&&B>K&&E>K);let W,X;if(Z&&null!=K&&null!=Q){const e=(E-K)/Math.max(Q-K,1),t=(t,r)=>Math.round(t+(r-t)*e),r={};for(const e of G?.items??[])r[e.part_number]=e;const n={};for(const e of J?.items??[])n[e.part_number]=e;const i=Array.from(/* @__PURE__ */new Set([...Object.keys(r),...Object.keys(n)])).map((e,a)=>{const i=r[e]??{},o=n[e]??{},s=e=>Number(e)||0;return{id:`interp-${e}-${a}`,part_number:e,description:i.description??o.description??"",order_qty:s(i.order_qty??o.order_qty??0),casting:t(s(i.casting),s(o.casting)),cnc:t(s(i.cnc),s(o.cnc)),painting:t(s(i.painting),s(o.painting)),packing:t(s(i.packing),s(o.packing)),finished_goods:t(s(i.finished_goods),s(o.finished_goods)),stock_qty:t(s(i.stock_qty),s(o.stock_qty))}}),o=a(G?.est_completion_date),s=a(J?.est_completion_date);let l;l=null!=o&&null!=s?new Date(Math.round(o+(s-o)*e)).toISOString().slice(0,10):G?.est_completion_date||J?.est_completion_date||null,W={id:`interp-${E}`,progress_number:M.estimated,date:new Date(E).toISOString().slice(0,10),created_by_name:"",est_completion_date:l,items:i,notes:""},X=G}else if(V&&H&&null!=K&&null!=B){const e=Math.min(1,(E-K)/Math.max(B-K,1)),t=e=>Number(e)||0,r=(H.items??[]).map((r,n)=>{const a=t(r.order_qty),i=r=>{const n=t(r);return n>=a?n:Math.round(n+(a-n)*e)};return{id:`proj-${r.part_number}-${n}`,part_number:r.part_number,description:r.description??"",order_qty:a,casting:i(r.casting),cnc:i(r.cnc),painting:i(r.painting),packing:i(r.packing),finished_goods:i(r.finished_goods),stock_qty:i(r.stock_qty)}});W={id:`proj-${E}`,progress_number:M.estimated,date:new Date(E).toISOString().slice(0,10),created_by_name:"",est_completion_date:n??H.est_completion_date??null,items:r,notes:""},X=H}else if(W=G??t[t.length-1]??null,W){const e=t.findIndex(e=>e.id===W.id);X=e>=0&&e<t.length-1?t[e+1]:null}else X=null;const Y={};for(const e of X?.items??[])Y[e.part_number]=e;const U=!(!d||W?.id===d),ee=d?Math.min(a(p??null)??T,T):T,te=d?t.find(e=>e.id===d)?.progress_number:void 0;return{startMs:q,endMs:T,totalLeadDays:$,scrubMs:E,setScrubMs:e=>{S(),v(null),f(e)},committedScrubMs:F,setPreviewMs:e=>{w||v(e)},previewing:null!=_,resetToCurrent:()=>{S(),p&&f(new Date(p).getTime())},scrubbedAway:U,beforeAnchor:G,nextAfter:J,displayed:W,prevReport:X,prevByPN:Y,isInterpolated:Z,isProjected:V,playing:w,startPlay:()=>{if(w)return void S();if(ee<=q)return void f(ee);P(!0),f(q);let e=performance.now(),t=q;const r=n=>{const a=n-e;if(e=n,t+=a/h*o,t>=ee)return f(ee),N.current=null,void P(!1);f(t),N.current=requestAnimationFrame(r)};N.current=requestAnimationFrame(r)},stopPlay:S,reports:t,markers:b,poNumber:s,currentReportId:d,currentReportProgressNumber:te,estCompletionMs:a(n??null)}}function w({startMs:e,endMs:t,reports:r,markers:a,valueMs:s,activeId:l,onChange:p,onPickReport:u,onOpenReport:m,onOpenMarker:g,onDragStart:h,renderReportPreview:y,reportLabel:k,playback:f,edgeCaptions:_,bare:v=!1,endMark:M=null,onPreview:w,restMs:P}){const N=c().production,S=d(),x=r.map(e=>({report:e,ms:new Date(e.date).getTime()})).filter(({ms:e})=>Number.isFinite(e)).sort((e,t)=>e.ms-t.ms),D=x.map(({report:e,ms:t})=>({key:e.id,ms:t,kind:"report",label:k(e),preview:e.preview??y?.(e),onOpen:m?()=>m(e.id):void 0})),C=new Map(x.map(({report:e,ms:t})=>[e.id,t])),R=e=>Math.round(e/o)*o,q=g?a.map(e=>({...e,onOpen:g})):a;/* @__PURE__ */
2
+ return b("div",{className:"select-none",children:/* @__PURE__ */b(n,{axis:v?"spread":"linear",labels:v?"none":"active",endMark:v?M:null,items:D,markers:q,startMs:e,endMs:t,activeKey:l,onActivate:e=>{const t=C.get(e);null!=t&&p(t),u(e)},playback:f,edgeCaptions:_,thumb:{valueMs:s,onChange:e=>p(R(e)),onDragStart:h,onPreview:w?e=>w(null==e?null:R(e)):void 0,restMs:P,ariaLabel:N.scrub,valueText:e=>{const t=(e=>x.find(t=>t.ms===e)?.report)(e);return t?`${k(t)} · ${i(e,S)}`:i(e,S)}},ariaLabel:N.label(i(e,S),i(t,S))})})}function P({snapshot:n,onPickReport:o,onOpenReport:l,onOpenMarker:m,renderReportPreview:k,onScrubProgress:f,heading:_,edgeCaptions:M,reportLabel:P=e=>e.progress_number,resetLabel:N,variant:S="card",onPlayStart:x}){const{reports:D,markers:C,poNumber:R,startMs:q,endMs:O,totalLeadDays:j,scrubMs:I,setScrubMs:T,committedScrubMs:$,setPreviewMs:A,previewing:L,displayed:F,scrubbedAway:E,resetToCurrent:H,currentReportId:J,currentReportProgressNumber:z,estCompletionMs:G,isInterpolated:K,isProjected:Q}=n,Z=!(!K&&!Q),B=function(e,t,r){const[n,a]=u(!1),i=g(!1);return{playing:n,toggle:()=>{n?a(!1):0!==e.length&&(r?.(),i.current||(i.current=!0,t(e[0])),a(!0))},stop:()=>{i.current=!1,a(!1)}}}(D.map(e=>a(e.date)).filter(e=>null!=e).sort((e,t)=>e-t),T,x),V=c().production,W=d(),X=_??V.heading,Y=e=>i(e,W);if(0===D.length&&0===C.length)return null;const U=C.filter(e=>"shipment"===e.kind),ee=C.filter(e=>"inspection"===e.kind),te=C.filter(e=>"invoice"===e.kind),re=(F?.items??[]).reduce((e,t)=>e+(Number(t.stock_qty)||0),0),ne=F?v(F):0,ae=D.find(e=>e.id===J),ie=ae?P(ae):z,oe=
3
+ /* @__PURE__ */h("button",{type:"button",onClick:B.toggle,"aria-pressed":B.playing,title:B.playing?V.pause:V.playTitle,className:"rosh-tl-play text-gray-700 border-gray-300 hover:text-blue-600 hover:border-blue-600",children:[B.playing?/* @__PURE__ */b(s,{name:"pause","aria-hidden":"true"}):/* @__PURE__ */b(s,{name:"play","aria-hidden":"true"}),
4
+ /* @__PURE__ */b("span",{children:B.playing?V.pause:V.play})]}),se=E&&(N??ie)?/* @__PURE__ */b("button",{type:"button",onClick:()=>{B.stop(),H()},className:"text-xs text-blue-600 underline-offset-4 hover:underline font-medium",children:N??V.backTo(String(ie))}):null,[le,ce]=p(V.showing),de=e=>/* @__PURE__ */b("p",{className:"rosh-tl-status text-gray-800",children:F?/* @__PURE__ */h(y,{children:[e&&le,
5
+ /* @__PURE__ */b("b",{className:"font-medium",children:Z?V.estimated:P(F)}),e&&ce,
6
+ /* @__PURE__ */h("span",{className:"text-gray-500",children:[" · ",Y(new Date(F.date).getTime())," · ",V.overall(Math.round(ne))," · ",V.inStock(re)]})]}):/* @__PURE__ */b("span",{className:"text-gray-500",children:V.noReport})});if("rail"===S){const e=null!=G&&G>=O&&O>q,t=e?{key:"__estimate__",label:V.estimatedCompletion,dateText:Y(G)}:null;/* @__PURE__ */
7
7
  return h("div",{className:"shrink-0","data-timeline-variant":"rail",children:[
8
- /* @__PURE__ */b(w,{bare:!0,endMark:t,startMs:q,endMs:O,reports:D,markers:R,valueMs:j,activeId:F?.id??"",onChange:T,onPreview:A,restMs:L?$:void 0,onPickReport:o,onOpenReport:l,onOpenMarker:m,renderReportPreview:k,reportLabel:P,edgeCaptions:{start:M?.start??V.start,end:M?.end??(e?V.estDone:void 0)},onDragStart:Q.stop,playback:{playing:Q.playing,onArrive:(e,t)=>T(t),onProgress:f,onStop:Q.stop}}),
8
+ /* @__PURE__ */b(w,{bare:!0,endMark:t,startMs:q,endMs:O,reports:D,markers:C,valueMs:I,activeId:F?.id??"",onChange:T,onPreview:A,restMs:L?$:void 0,onPickReport:o,onOpenReport:l,onOpenMarker:m,renderReportPreview:k,reportLabel:P,edgeCaptions:{start:M?.start??V.start,end:M?.end??(e?V.estDone:void 0)},onDragStart:B.stop,playback:{playing:B.playing,onArrive:(e,t)=>T(t),onProgress:f,onStop:B.stop}}),
9
9
  /* @__PURE__ */h("div",{className:"rosh-tl-railrow","data-timeline-part":"rail-row",children:[oe,se,de(!1)]})]})}/* @__PURE__ */
10
- return b("div",{className:"shrink-0",children:/* @__PURE__ */b(e,{icon:/* @__PURE__ */b(r,{}),heading:B,subject:C,meta:[`${W(q)} → ${W(O)}`,V.leadTime(I)],actions:/* @__PURE__ */h(y,{children:[se,oe]}),footer:/* @__PURE__ */h(y,{children:[de(!0),
10
+ return b("div",{className:"shrink-0",children:/* @__PURE__ */b(e,{icon:/* @__PURE__ */b(r,{}),heading:X,subject:R,meta:[`${Y(q)} → ${Y(O)}`,V.leadTime(j)],actions:/* @__PURE__ */h(y,{children:[se,oe]}),footer:/* @__PURE__ */h(y,{children:[de(!0),
11
11
  /* @__PURE__ */h("div",{className:"rosh-tl-legend",children:[D.length>0&&/* @__PURE__ */h("span",{className:"border-gray-200 text-gray-500",children:[
12
- /* @__PURE__ */b("i",{"aria-hidden":"true",className:"rosh-tl-glyph is-ring border-blue-600"}),V.report]}),Y.length>0&&/* @__PURE__ */h("span",{className:"border-gray-200 text-gray-500",children:[
12
+ /* @__PURE__ */b("i",{"aria-hidden":"true",className:"rosh-tl-glyph is-ring border-blue-600"}),V.report]}),U.length>0&&/* @__PURE__ */h("span",{className:"border-gray-200 text-gray-500",children:[
13
13
  /* @__PURE__ */b("i",{"aria-hidden":"true",className:"rosh-tl-glyph is-diamond",style:{background:"var(--tl-shipment)",color:"var(--tl-on-kind)"},children:/* @__PURE__ */b(t,{name:"truck"})}),V.shipment]}),ee.length>0&&/* @__PURE__ */h("span",{className:"border-gray-200 text-gray-500",children:[
14
14
  /* @__PURE__ */b("i",{"aria-hidden":"true",className:"rosh-tl-glyph is-disc",style:{background:"var(--tl-inspection)",color:"var(--tl-on-kind)"},children:/* @__PURE__ */b(t,{name:"flask"})}),V.inspection]}),te.length>0&&/* @__PURE__ */h("span",{className:"border-gray-200 text-gray-500",children:[
15
- /* @__PURE__ */b("i",{"aria-hidden":"true",className:"rosh-tl-glyph is-disc",style:{background:"var(--tl-invoice)",color:"var(--tl-on-kind)"},children:/* @__PURE__ */b(t,{name:"receipt"})}),V.invoice]})]})]}),children:/* @__PURE__ */b(w,{startMs:q,endMs:O,reports:D,markers:R,valueMs:j,activeId:F?.id??"",onChange:T,onPreview:A,restMs:L?$:void 0,onPickReport:o,onOpenReport:l,onOpenMarker:m,renderReportPreview:k,reportLabel:P,edgeCaptions:M,onDragStart:Q.stop,playback:{playing:Q.playing,onArrive:(e,t)=>T(t),onProgress:f,onStop:Q.stop}})})})}export{k as POST_PRODUCTION_STATUSES,P as ProductionTimeline,f as STAGES,_ as calcOverall,v as calcReportOverall,M as useProductionTimeline};
15
+ /* @__PURE__ */b("i",{"aria-hidden":"true",className:"rosh-tl-glyph is-disc",style:{background:"var(--tl-invoice)",color:"var(--tl-on-kind)"},children:/* @__PURE__ */b(t,{name:"receipt"})}),V.invoice]})]})]}),children:/* @__PURE__ */b(w,{startMs:q,endMs:O,reports:D,markers:C,valueMs:I,activeId:F?.id??"",onChange:T,onPreview:A,restMs:L?$:void 0,onPickReport:o,onOpenReport:l,onOpenMarker:m,renderReportPreview:k,reportLabel:P,edgeCaptions:M,onDragStart:B.stop,playback:{playing:B.playing,onArrive:(e,t)=>T(t),onProgress:f,onStop:B.stop}})})})}export{k as POST_PRODUCTION_STATUSES,P as ProductionTimeline,f as STAGES,_ as calcOverall,v as calcReportOverall,M as useProductionTimeline};
@@ -0,0 +1 @@
1
+ import{knownZone as o,formatTime as t}from"./chunk-NHKT5IH6.js";function r(r,a,e=!1){if(!r||!o(r))return{time:"",ampm:""};const n=e?{hour:"2-digit",minute:"2-digit",hourCycle:"h23"}:{hour:"numeric",minute:"2-digit",hour12:!0},i=t(a.toISOString(),{timeZone:r,locale:"en-US",clock:n});if(e)return{time:i,ampm:""};const[l,m=""]=i.split(/\s+/);return{time:l,ampm:m.toUpperCase()}}var a={0:["Clear Sky","☀️","🌙","from-sky-400 to-blue-500","from-indigo-900 to-slate-950"],1:["Mainly Clear","🌤️","🌙","from-sky-400 to-blue-500","from-indigo-900 to-slate-950"],2:["Partly Cloudy","⛅","☁️","from-sky-400 to-blue-400","from-indigo-800 to-slate-900"],3:["Overcast","☁️","☁️","from-gray-400 to-gray-500","from-gray-700 to-slate-900"],45:["Foggy","🌫️","🌫️","from-gray-400 to-gray-500","from-gray-700 to-slate-800"],48:["Foggy","🌫️","🌫️","from-gray-400 to-gray-500","from-gray-700 to-slate-800"],51:["Light Drizzle","🌦️","🌧️","from-gray-400 to-blue-500","from-gray-700 to-indigo-900"],53:["Drizzle","🌧️","🌧️","from-gray-500 to-blue-600","from-gray-700 to-indigo-900"],55:["Heavy Drizzle","🌧️","🌧️","from-gray-500 to-blue-600","from-gray-700 to-indigo-900"],61:["Light Rain","🌦️","🌧️","from-gray-400 to-blue-500","from-gray-700 to-indigo-900"],63:["Rain","🌧️","🌧️","from-gray-500 to-blue-600","from-gray-700 to-indigo-900"],65:["Heavy Rain","🌧️","🌧️","from-gray-600 to-blue-700","from-gray-700 to-indigo-950"],71:["Light Snow","🌨️","🌨️","from-blue-200 to-blue-400","from-blue-800 to-slate-900"],73:["Snow","❄️","❄️","from-blue-300 to-blue-500","from-blue-800 to-slate-900"],75:["Heavy Snow","❄️","❄️","from-blue-400 to-blue-600","from-blue-800 to-slate-900"],80:["Rain Showers","🌧️","🌧️","from-gray-500 to-blue-600","from-gray-700 to-indigo-900"],82:["Heavy Showers","🌧️","🌧️","from-gray-600 to-blue-700","from-gray-700 to-indigo-950"],95:["Thunderstorm","⛈️","⛈️","from-gray-700 to-indigo-800","from-gray-800 to-indigo-950"],96:["Thunderstorm","⛈️","⛈️","from-gray-700 to-indigo-800","from-gray-800 to-indigo-950"],99:["Thunderstorm","⛈️","⛈️","from-gray-700 to-indigo-900","from-gray-800 to-indigo-950"]},e=(o,t=!0)=>{const r=a[o]||["Unknown","❓","❓","from-gray-400 to-gray-500","from-gray-700 to-slate-800"];return[r[0],t?r[1]:r[2],t?r[3]:r[4]]},n={Sydney:{lat:-33.8688,lon:151.2093,tz:"Australia/Sydney"},Melbourne:{lat:-37.8136,lon:144.9631,tz:"Australia/Melbourne"},Auckland:{lat:-36.8485,lon:174.7633,tz:"Pacific/Auckland"},Tokyo:{lat:35.6762,lon:139.6503,tz:"Asia/Tokyo"},Shanghai:{lat:31.2304,lon:121.4737,tz:"Asia/Shanghai"},"Hong Kong":{lat:22.3193,lon:114.1694,tz:"Asia/Hong_Kong"},Singapore:{lat:1.3521,lon:103.8198,tz:"Asia/Singapore"},Bangkok:{lat:13.7563,lon:100.5018,tz:"Asia/Bangkok"},Mumbai:{lat:19.076,lon:72.8777,tz:"Asia/Kolkata"},Dubai:{lat:25.2048,lon:55.2708,tz:"Asia/Dubai"},Berlin:{lat:52.52,lon:13.405,tz:"Europe/Berlin"},Paris:{lat:48.8566,lon:2.3522,tz:"Europe/Paris"},London:{lat:51.5074,lon:-.1278,tz:"Europe/London"},"New York":{lat:40.7128,lon:-74.006,tz:"America/New_York"},Miami:{lat:25.7617,lon:-80.1918,tz:"America/New_York"},Toronto:{lat:43.6532,lon:-79.3832,tz:"America/Toronto"},Chicago:{lat:41.8781,lon:-87.6298,tz:"America/Chicago"},"Los Angeles":{lat:34.0522,lon:-118.2437,tz:"America/Los_Angeles"}},i="weather_local_cache";function l(){try{return JSON.parse(localStorage.getItem(i)||"{}")}catch{return{}}}async function m(o,t=!1){const r=n[o];if(!r)return null;if(!t){const t=l()[o];if(t&&Date.now()-t.ts<18e5)return t.data}try{const t=await fetch(`https://api.open-meteo.com/v1/forecast?latitude=${r.lat}&longitude=${r.lon}&current=temperature_2m,weather_code,is_day&daily=temperature_2m_max,temperature_2m_min&forecast_days=1&timezone=auto`),a=await t.json(),e={city:o,temp:Math.round(a.current.temperature_2m),code:a.current.weather_code,high:Math.round(a.daily.temperature_2m_max[0]),low:Math.round(a.daily.temperature_2m_min[0]),isDay:1===a.current.is_day,timezone:a.timezone||""},n=l();return n[o]={data:e,ts:Date.now()},function(o){try{localStorage.setItem(i,JSON.stringify(o))}catch{}}(n),e}catch{return null}}var g=o=>Math.round(9*o/5+32);export{n as AVAILABLE_CITIES,r as cityClock,m as fetchCityWeather,e as getCondition,g as toFahrenheit};
@@ -1,2 +1,2 @@
1
- import{EmptyValue as r}from"./chunk-HNQPF5QZ.js";import{toInstant as e,timeAgo as t}from"./chunk-S6UJKSF3.js";import{formatDateTime as o}from"./chunk-ZPJTLNKU.js";import{useShellLocale as c}from"./chunk-DEJIH3ZQ.js";import{jsx as i}from"react/jsx-runtime";function m({value:m,precise:n,locale:s,className:l}){const a=c(),p=e(m);if(!p)/* @__PURE__ */return i(r,{});const u="string"==typeof m?m:p.toISOString();/* @__PURE__ */
1
+ import{EmptyValue as r}from"./chunk-HNQPF5QZ.js";import{toInstant as e,timeAgo as t}from"./chunk-OJI4ROSD.js";import{formatDateTime as o}from"./chunk-NHKT5IH6.js";import{useShellLocale as c}from"./chunk-DEJIH3ZQ.js";import{jsx as i}from"react/jsx-runtime";function m({value:m,precise:n,locale:s,className:l}){const a=c(),p=e(m);if(!p)/* @__PURE__ */return i(r,{});const u="string"==typeof m?m:p.toISOString();/* @__PURE__ */
2
2
  return i("time",{dateTime:u,title:o(u,{locale:s??a}),className:l,children:t(p,{precise:n,locale:s??a})})}export{m as TimeAgo};
@@ -1,14 +1,14 @@
1
- import{calendarNames as e,firstDayOfWeek as r,userToday as t}from"./chunk-ZPJTLNKU.js";import{fromDateKey as a,toMonthKey as n,toDateKey as o,fromMonthKey as l,addMonths as i}from"./chunk-JRQMX4PK.js";import{Icon as s}from"./chunk-ISVODSRP.js";import{useBrowserValue as c}from"./chunk-D65T4H6J.js";import{useShellStrings as u,useShellLocale as g}from"./chunk-DEJIH3ZQ.js";import{useMemo as d,useState as h,useRef as m,useEffect as f}from"react";import{jsxs as b,jsx as y,Fragment as v}from"react/jsx-runtime";var p="grid grid-cols-[repeat(7,minmax(0,40px))] sm:grid-cols-[repeat(7,minmax(0,32px))] justify-center gap-1";var x=()=>t();var w=(e,r)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+r);function N({value:t,endValue:N,mode:k="single",onSelect:D,min:M,max:Y,month:F,defaultMonth:j,onMonthChange:A,weekStartsOn:C,quickJump:S=!0,markedDates:P,readOnly:J=!1,"aria-label":K,className:q=""}){const E=d(()=>new Set(P??[]),[P]),H=a(t),I=c(x,null),O=a(I),R=u().calendar,U=g(),$=e(U),L=c(()=>r(U),0),Q=C??L,T=()=>{if(!O)return null;const e=n(O);return M&&e<M.slice(0,7)?M.slice(0,7):Y&&e>Y.slice(0,7)?Y.slice(0,7):e},[V,W]=h(()=>j||(H?n(H):T())),Z=F??V??T(),B=null===Z?null:function(e,r){return l(e)??r}(Z,O),[X,z]=h(()=>t??I),G=m(null),_=m(!1),[ee,re]=h("days"),te=d(()=>B?function(e,r){const t=new Date(e.getFullYear(),e.getMonth(),1),a=(t.getDay()-r+7)%7,n=new Date(t.getFullYear(),t.getMonth(),1-a);return Array.from({length:42},(e,r)=>new Date(n.getFullYear(),n.getMonth(),n.getDate()+r))}(B,Q):[],[Z,Q]),ae=e=>!!M&&e<M||!!Y&&e>Y,ne=X??I,oe=te.some(e=>o(e)===ne),le=B?te.find(e=>e.getMonth()===B.getMonth())??te[0]:null,ie=oe&&ne?ne:le?o(le):"";if(f(()=>{_.current&&(_.current=!1,G.current?.querySelector('[data-active="true"]')?.focus())},[ie,Z]),!B)/* @__PURE__ */
1
+ import{calendarNames as e,firstDayOfWeek as r,userToday as t}from"./chunk-NHKT5IH6.js";import{fromDateKey as a,toMonthKey as n,toDateKey as o,fromMonthKey as l,addMonths as i}from"./chunk-JRQMX4PK.js";import{Icon as s}from"./chunk-ISVODSRP.js";import{useBrowserValue as c}from"./chunk-D65T4H6J.js";import{useShellStrings as u,useShellLocale as g}from"./chunk-DEJIH3ZQ.js";import{useMemo as d,useState as h,useRef as m,useEffect as f}from"react";import{jsxs as b,jsx as y,Fragment as v}from"react/jsx-runtime";var p="grid grid-cols-[repeat(7,minmax(0,40px))] sm:grid-cols-[repeat(7,minmax(0,32px))] justify-center gap-1";var x=()=>t();var w=(e,r)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+r);function N({value:t,endValue:N,mode:k="single",onSelect:D,min:M,max:Y,month:F,defaultMonth:j,onMonthChange:A,weekStartsOn:C,quickJump:S=!0,markedDates:P,readOnly:H=!1,"aria-label":K,className:q=""}){const I=d(()=>new Set(P??[]),[P]),J=a(t),E=c(x,null),O=a(E),R=u().calendar,$=g(),Q=e($),T=c(()=>r($),0),U=C??T,V=()=>{if(!O)return null;const e=n(O);return M&&e<M.slice(0,7)?M.slice(0,7):Y&&e>Y.slice(0,7)?Y.slice(0,7):e},[W,B]=h(()=>j||(J?n(J):V())),L=F??W??V(),X=null===L?null:function(e,r){return l(e)??r}(L,O),[Z,z]=h(()=>t??E),G=m(null),_=m(!1),[ee,re]=h("days"),te=d(()=>X?function(e,r){const t=new Date(e.getFullYear(),e.getMonth(),1),a=(t.getDay()-r+7)%7,n=new Date(t.getFullYear(),t.getMonth(),1-a);return Array.from({length:42},(e,r)=>new Date(n.getFullYear(),n.getMonth(),n.getDate()+r))}(X,U):[],[L,U]),ae=e=>!!M&&e<M||!!Y&&e>Y,ne=Z??E,oe=te.some(e=>o(e)===ne),le=X?te.find(e=>e.getMonth()===X.getMonth())??te[0]:null,ie=oe&&ne?ne:le?o(le):"";if(f(()=>{_.current&&(_.current=!1,G.current?.querySelector('[data-active="true"]')?.focus())},[ie,L]),!X)/* @__PURE__ */
2
2
  return b("div",{className:q,"aria-hidden":"true","data-calendar-pending":"",children:[
3
3
  /* @__PURE__ */y("div",{className:"mb-2 h-6"}),
4
- /* @__PURE__ */y("div",{className:"space-y-1",children:Array.from({length:7},(e,r)=>/* @__PURE__ */y("div",0===r?{className:"py-1 text-xs",children:" "}:{className:p,children:/* @__PURE__ */y("span",{className:"aspect-square"})},r))})]});const se=e=>"years"===ee?new Date(B.getFullYear()+12*e,B.getMonth(),1):"months"===ee?new Date(B.getFullYear()+e,B.getMonth(),1):i(B,e),ce=e=>{const r=n(e);void 0===F&&W(r),A?.(r)},ue=K??$.monthYear(B.getFullYear(),B.getMonth());/* @__PURE__ */
4
+ /* @__PURE__ */y("div",{className:"space-y-1",children:Array.from({length:7},(e,r)=>/* @__PURE__ */y("div",0===r?{className:"py-1 text-xs",children:" "}:{className:p,children:/* @__PURE__ */y("span",{className:"aspect-square"})},r))})]});const se=e=>"years"===ee?new Date(X.getFullYear()+12*e,X.getMonth(),1):"months"===ee?new Date(X.getFullYear()+e,X.getMonth(),1):i(X,e),ce=e=>{const r=n(e);void 0===F&&B(r),A?.(r)},ue=K??Q.monthYear(X.getFullYear(),X.getMonth());/* @__PURE__ */
5
5
  return b("div",{className:q,children:[
6
6
  /* @__PURE__ */b("div",{className:"mb-2 flex items-center justify-between px-1",children:[
7
7
  /* @__PURE__ */y("button",{type:"button","aria-label":"years"===ee?R.previousYears:"months"===ee?R.previousYear:R.previousMonth,onClick:()=>ce(se(-1)),className:"rounded-full p-1 text-gray-600 hover:bg-gray-100 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:/* @__PURE__ */y(s,{name:"chevron-left",className:"h-4 w-4",strokeWidth:"2","aria-hidden":"true"})}),
8
- /* @__PURE__ */y("div",{"aria-live":"polite",className:"flex items-center gap-1 text-sm font-semibold text-gray-800",children:S?/* @__PURE__ */b(v,{children:["years"!==ee&&/* @__PURE__ */y("button",{type:"button","aria-label":R.chooseMonth($.months[B.getMonth()]),onClick:()=>re(e=>"months"===e?"days":"months"),className:"rounded-md px-2 py-0.5 transition-colors hover:bg-gray-100 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:$.months[B.getMonth()]}),
9
- /* @__PURE__ */y("button",{type:"button","aria-label":R.chooseYear(B.getFullYear()),onClick:()=>re(e=>"years"===e?"days":"years"),className:"rounded-md px-2 py-0.5 transition-colors hover:bg-gray-100 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:B.getFullYear()})]}):/* @__PURE__ */y("span",{children:$.monthYear(B.getFullYear(),B.getMonth())})}),
10
- /* @__PURE__ */y("button",{type:"button","aria-label":"years"===ee?R.nextYears:"months"===ee?R.nextYear:R.nextMonth,onClick:()=>ce(se(1)),className:"rounded-full p-1 text-gray-600 hover:bg-gray-100 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:/* @__PURE__ */y(s,{name:"chevron-right",className:"h-4 w-4",strokeWidth:"2","aria-hidden":"true"})})]}),"months"===ee&&/* @__PURE__ */y("div",{role:"group","aria-label":R.monthPanel,className:"grid grid-cols-3 gap-1 text-center text-sm",children:$.monthsShort.map((e,r)=>/* @__PURE__ */y("button",{type:"button","aria-pressed":r===B.getMonth(),onClick:()=>{ce(new Date(B.getFullYear(),r,1)),re("days")},className:["rounded-md py-4 transition-colors rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",r===B.getMonth()?"bg-blue-600 font-semibold text-white":O&&r===O.getMonth()&&B.getFullYear()===O.getFullYear()?"font-medium text-blue-600 hover:bg-gray-100":"text-gray-700 hover:bg-gray-100"].join(" "),children:e},e))}),"years"===ee&&/* @__PURE__ */y("div",{role:"group","aria-label":R.yearPanel,className:"grid grid-cols-3 gap-1 text-center text-sm",children:Array.from({length:12},(e,r)=>{return t=B.getFullYear(),12*Math.floor(t/12)+r;var t}).map(e=>/* @__PURE__ */y("button",{type:"button","aria-pressed":e===B.getFullYear(),onClick:()=>{ce(new Date(e,B.getMonth(),1)),re("months")},className:["rounded-md py-4 transition-colors rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",e===B.getFullYear()?"bg-blue-600 font-semibold text-white":e===O?.getFullYear()?"font-medium text-blue-600 hover:bg-gray-100":"text-gray-700 hover:bg-gray-100"].join(" "),children:e},e))}),
11
- /* @__PURE__ */b("div",{ref:G,role:"grid","aria-label":ue,className:"space-y-1","aria-readonly":J||void 0,onKeyDown:e=>{const r=a(ie)??O??B,t={ArrowLeft:()=>w(r,-1),ArrowRight:()=>w(r,1),ArrowUp:()=>w(r,-7),ArrowDown:()=>w(r,7),Home:()=>w(r,-(r.getDay()-Q+7)%7),End:()=>w(r,6-(r.getDay()-Q+7)%7),PageUp:()=>i(r,e.shiftKey?-12:-1),PageDown:()=>i(r,e.shiftKey?12:1)};if(t[e.key])return e.preventDefault(),l=t[e.key](),_.current=!0,z(o(l)),void(n(l)!==Z&&ce(l));var l;"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),J||ae(ie)||D(ie))},hidden:"days"!==ee,children:[
12
- /* @__PURE__ */y("div",{role:"row",className:`${p} text-center text-xs font-medium text-ink-faint`,children:Array.from({length:7},(e,r)=>(r+Q)%7).map(e=>
13
- /* @__PURE__ */y("div",{role:"columnheader","aria-label":$.weekdays[e],className:"py-1",children:/* @__PURE__ */y("abbr",{title:$.weekdays[e],className:"no-underline",children:$.weekdaysShort[e]})},e))}),Array.from({length:6},(e,r)=>/* @__PURE__ */y("div",{role:"row",className:`${p} text-center text-sm`,children:te.slice(7*r,7*r+7).map(e=>{const r=o(e),a=e.getMonth()!==B.getMonth(),n=r===t||"range"===k&&r===N,l=(e=>!("range"!==k||!t||!N)&&e>t&&e<N)(r),i=ae(r),s=$.longDate(e.getFullYear(),e.getMonth(),e.getDate()),c=e=>["relative w-full aspect-square rounded-md transition-colors",e?"rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]":"",i?"cursor-not-allowed text-gray-300":n?"bg-accent-fill font-semibold text-on-accent":l?"bg-accent-tint-strong text-blue-800":a?"text-ink-faint"+(e?" hover:bg-gray-100":""):"text-ink"+(e?" hover:bg-gray-100":""),r!==I||n?"":"font-semibold text-blue-600"].filter(Boolean).join(" "),u=E.has(r)&&/* @__PURE__ */y("span",{"data-marked":"","aria-hidden":"true",className:"absolute bottom-1 left-1/2 h-1 w-1 -translate-x-1/2 rounded-full "+(n?"bg-surface":a?"bg-gray-400":"bg-blue-500")});/* @__PURE__ */
14
- return y("div",{role:"gridcell","aria-selected":n,"aria-label":J?s:void 0,children:J?/* @__PURE__ */b("span",{"aria-hidden":"true",className:`grid place-items-center ${c(!1)}`,children:[e.getDate(),u]}):/* @__PURE__ */b("button",{type:"button","data-active":r===ie,tabIndex:r===ie?0:-1,disabled:i,"aria-label":s,"aria-current":r===I?"date":void 0,onClick:()=>{z(r),D(r)},className:c(!0),children:[e.getDate(),u]})},r)})},r))]})]})}export{N as Calendar};
8
+ /* @__PURE__ */y("div",{"aria-live":"polite",className:"flex items-center gap-1 text-sm font-semibold text-gray-800",children:S?/* @__PURE__ */b(v,{children:["years"!==ee&&/* @__PURE__ */y("button",{type:"button","aria-label":R.chooseMonth(Q.months[X.getMonth()]),onClick:()=>re(e=>"months"===e?"days":"months"),className:"rounded-md px-2 py-0.5 transition-colors hover:bg-gray-100 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:Q.months[X.getMonth()]}),
9
+ /* @__PURE__ */y("button",{type:"button","aria-label":R.chooseYear(X.getFullYear()),onClick:()=>re(e=>"years"===e?"days":"years"),className:"rounded-md px-2 py-0.5 transition-colors hover:bg-gray-100 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:X.getFullYear()})]}):/* @__PURE__ */y("span",{children:Q.monthYear(X.getFullYear(),X.getMonth())})}),
10
+ /* @__PURE__ */y("button",{type:"button","aria-label":"years"===ee?R.nextYears:"months"===ee?R.nextYear:R.nextMonth,onClick:()=>ce(se(1)),className:"rounded-full p-1 text-gray-600 hover:bg-gray-100 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:/* @__PURE__ */y(s,{name:"chevron-right",className:"h-4 w-4",strokeWidth:"2","aria-hidden":"true"})})]}),"months"===ee&&/* @__PURE__ */y("div",{role:"group","aria-label":R.monthPanel,className:"grid grid-cols-3 gap-1 text-center text-sm",children:Q.monthsShort.map((e,r)=>/* @__PURE__ */y("button",{type:"button","aria-pressed":r===X.getMonth(),onClick:()=>{ce(new Date(X.getFullYear(),r,1)),re("days")},className:["rounded-md py-4 transition-colors rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",r===X.getMonth()?"bg-blue-600 font-semibold text-white":O&&r===O.getMonth()&&X.getFullYear()===O.getFullYear()?"font-medium text-blue-600 hover:bg-gray-100":"text-gray-700 hover:bg-gray-100"].join(" "),children:e},e))}),"years"===ee&&/* @__PURE__ */y("div",{role:"group","aria-label":R.yearPanel,className:"grid grid-cols-3 gap-1 text-center text-sm",children:Array.from({length:12},(e,r)=>{return t=X.getFullYear(),12*Math.floor(t/12)+r;var t}).map(e=>/* @__PURE__ */y("button",{type:"button","aria-pressed":e===X.getFullYear(),onClick:()=>{ce(new Date(e,X.getMonth(),1)),re("months")},className:["rounded-md py-4 transition-colors rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",e===X.getFullYear()?"bg-blue-600 font-semibold text-white":e===O?.getFullYear()?"font-medium text-blue-600 hover:bg-gray-100":"text-gray-700 hover:bg-gray-100"].join(" "),children:e},e))}),
11
+ /* @__PURE__ */b("div",{ref:G,role:"grid","aria-label":ue,className:"space-y-1","aria-readonly":H||void 0,onKeyDown:e=>{const r=a(ie)??O??X,t={ArrowLeft:()=>w(r,-1),ArrowRight:()=>w(r,1),ArrowUp:()=>w(r,-7),ArrowDown:()=>w(r,7),Home:()=>w(r,-(r.getDay()-U+7)%7),End:()=>w(r,6-(r.getDay()-U+7)%7),PageUp:()=>i(r,e.shiftKey?-12:-1),PageDown:()=>i(r,e.shiftKey?12:1)};if(t[e.key])return e.preventDefault(),l=t[e.key](),_.current=!0,z(o(l)),void(n(l)!==L&&ce(l));var l;"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),H||ae(ie)||D(ie))},hidden:"days"!==ee,children:[
12
+ /* @__PURE__ */y("div",{role:"row",className:`${p} text-center text-xs font-medium text-ink-faint`,children:Array.from({length:7},(e,r)=>(r+U)%7).map(e=>
13
+ /* @__PURE__ */y("div",{role:"columnheader","aria-label":Q.weekdays[e],className:"py-1",children:/* @__PURE__ */y("abbr",{title:Q.weekdays[e],className:"no-underline",children:Q.weekdaysShort[e]})},e))}),Array.from({length:6},(e,r)=>/* @__PURE__ */y("div",{role:"row",className:`${p} text-center text-sm`,children:te.slice(7*r,7*r+7).map(e=>{const r=o(e),a=e.getMonth()!==X.getMonth(),n=r===t||"range"===k&&r===N,l=(e=>!("range"!==k||!t||!N)&&e>t&&e<N)(r),i=ae(r),s=Q.longDate(e.getFullYear(),e.getMonth(),e.getDate()),c=e=>["relative w-full aspect-square rounded-md transition-colors",e?"rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]":"",i?"cursor-not-allowed text-gray-300":n?"bg-accent-fill font-semibold text-on-accent":l?"bg-accent-tint-strong text-blue-800":a?"text-ink-faint"+(e?" hover:bg-gray-100":""):"text-ink"+(e?" hover:bg-gray-100":""),r!==E||n?"":"font-semibold text-blue-600"].filter(Boolean).join(" "),u=I.has(r)&&/* @__PURE__ */y("span",{"data-marked":"","aria-hidden":"true",className:"absolute bottom-1 left-1/2 h-1 w-1 -translate-x-1/2 rounded-full "+(n?"bg-surface":a?"bg-gray-400":"bg-blue-500")});/* @__PURE__ */
14
+ return y("div",{role:"gridcell","aria-selected":n,"aria-label":H?s:void 0,children:H?/* @__PURE__ */b("span",{"aria-hidden":"true",className:`grid place-items-center ${c(!1)}`,children:[e.getDate(),u]}):/* @__PURE__ */b("button",{type:"button","data-active":r===ie,tabIndex:r===ie?0:-1,disabled:i,"aria-label":s,"aria-current":r===E?"date":void 0,onClick:()=>{z(r),D(r)},className:c(!0),children:[e.getDate(),u]})},r)})},r))]})]})}export{N as Calendar};
@@ -0,0 +1 @@
1
+ import{EMPTY_VALUE as e}from"./chunk-36BRD5J3.js";import{fromDateKey as t,DAY_MS as n}from"./chunk-JRQMX4PK.js";import{pad2 as r}from"./chunk-LF27WIN2.js";var o=[{key:"DD/MM/YYYY",example:"24/04/2026"},{key:"MM/DD/YYYY",example:"04/24/2026"},{key:"YYYY-MM-DD",example:"2026-04-24"},{key:"DD-MM-YYYY",example:"24-04-2026"},{key:"MM-DD-YYYY",example:"04-24-2026"},{key:"DD.MM.YYYY",example:"24.04.2026"},{key:"YYYY.MM.DD",example:"2026.04.24"},{key:"YYYY/MM/DD",example:"2026/04/24"},{key:"DD/MM/YY",example:"24/04/26"},{key:"MM/DD/YY",example:"04/24/26"},{key:"DD/MMM/YYYY",example:"24/Apr/2026"},{key:"DD/MMM/YY",example:"24/Apr/26"},{key:"DD MMM YYYY",example:"24 Apr 2026"},{key:"MMM DD, YYYY",example:"Apr 24, 2026"},{key:"DD MMMM YYYY",example:"24 April 2026"},{key:"MMMM DD, YYYY",example:"April 24, 2026"}],a=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],u=["January","February","March","April","May","June","July","August","September","October","November","December"];function i(e){return a[parseInt(e,10)-1]??e}function m(e){return u[parseInt(e,10)-1]??e}function c(){if("undefined"==typeof window)return"DD/MM/YYYY";try{return localStorage.getItem("user_date_format")||"DD/MM/YYYY"}catch{return"DD/MM/YYYY"}}function l(e){localStorage.setItem("user_date_format",e)}var Y="user_timezone",s="auto";function M(){if("undefined"!=typeof window)try{const e=localStorage.getItem(Y);return e&&e!==s?e:void 0}catch{return}}function f(e){e&&e!==s?localStorage.setItem(Y,e):localStorage.removeItem(Y)}function D(e){e&&localStorage.setItem(Y,e)}var y={dateStyle:"medium"},$=/* @__PURE__ */new Map;function d(e,t){const n=`${e}|${JSON.stringify(t)}`;let r=$.get(n);return r||(r=new Intl.DateTimeFormat(e,{...t,timeZone:"UTC",calendar:"gregory"}),$.set(n,r)),r}var h=/* @__PURE__ */new Map;function p(e){const t=e??"";let n=h.get(t);if(void 0===n){try{n=new Intl.DateTimeFormat("en-GB",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23",calendar:"gregory",timeZone:e})}catch{n=null}h.set(t,n)}return n}function g(e){return!!e&&null!==p(e)}function k(){const e=M();return e&&g(e)?e:"undefined"!=typeof window&&p(void 0)?.resolvedOptions().timeZone||void 0}function w(e,t){const n=p(t).formatToParts(e),r=e=>n.find(t=>t.type===e)?.value??"";return{y:r("year"),m:r("month"),d:r("day"),hh:r("hour"),mm:r("minute")}}var S=/^(\d{4})-(\d{1,2})-(\d{1,2})$/;function N(e,t){if(!e)return null;const n=S.exec(e);if(n){const[e,t,o]=n.slice(1).map(Number);return t<1||t>12||o<1||o>31?null:{y:String(e),m:r(t),d:r(o)}}const o=new Date(e);return Number.isNaN(o.getTime())?null:w(o,t)}function v(t,n){const r=t&&S.test(t)?void 0:b(n?.timeZone);if(null===r)return e;const o=N(t,r);return o?n?.locale?d(n.locale,n.style??y).format(new Date(Date.UTC(Number(o.y),Number(o.m)-1,Number(o.d)))):function(e,t,n){switch(c()){case"MM/DD/YYYY":return`${t}/${n}/${e}`;case"YYYY-MM-DD":return`${e}-${t}-${n}`;case"DD-MM-YYYY":return`${n}-${t}-${e}`;case"MM-DD-YYYY":return`${t}-${n}-${e}`;case"DD.MM.YYYY":return`${n}.${t}.${e}`;case"YYYY.MM.DD":return`${e}.${t}.${n}`;case"YYYY/MM/DD":return`${e}/${t}/${n}`;case"DD/MM/YY":return`${n}/${t}/${e.slice(-2)}`;case"MM/DD/YY":return`${t}/${n}/${e.slice(-2)}`;case"DD/MMM/YYYY":return`${n}/${i(t)}/${e}`;case"DD/MMM/YY":return`${n}/${i(t)}/${e.slice(-2)}`;case"DD MMM YYYY":return`${n} ${i(t)} ${e}`;case"MMM DD, YYYY":return`${i(t)} ${n}, ${e}`;case"DD MMMM YYYY":return`${n} ${m(t)} ${e}`;case"MMMM DD, YYYY":return`${m(t)} ${n}, ${e}`;default:return`${n}/${t}/${e}`}}(o.y,o.m,o.d):e}function b(e){return e?g(e)?e:null:"undefined"==typeof window?null:k()}function I(e,n){if(!e)return null;if(t(e))return e;if(S.test(e))return null;const r=b(n);if(null===r)return null;const o=N(e,r);return o?`${o.y}-${o.m}-${o.d}`:null}function T(e=/* @__PURE__ */new Date,t){return Number.isNaN(e.getTime())?null:I(e.toISOString(),t)}function x(e,t){const n=w(new Date(e),t);return Date.UTC(Number(n.y),Number(n.m)-1,Number(n.d),Number(n.hh),Number(n.mm))-6e4*Math.floor(e/6e4)}var Z=(e,t)=>Number.isInteger(e)&&e>=0&&e<=t;function A(e,r){const o=t(e),a=r?.hour??12,u=r?.minute??0;if(!o||!Z(a,23)||!Z(u,59))return null;const i=Date.UTC(o.getFullYear(),o.getMonth(),o.getDate(),a,u),m=b(r?.timeZone);if(null===m)return null;const c=i-x(i-n,m),l=i-x(i+n,m),Y=e=>e+x(e,m)===i,s=Y(c)?c:Y(l)?l:I(new Date(c).toISOString(),m)===e?c:l;return new Date(s).toISOString()}var J=["dateStyle","era","year","month","day","weekday"];function F(t,n){if(!t||S.test(t))return e;const r=new Date(t);if(Number.isNaN(r.getTime()))return e;const o=b(n?.timeZone);if(null===o)return e;if(n?.clock){const e=U(n.locale,n.clock,o)??U(void 0,n.clock,o);if(e)return e.format(r)}if(n?.locale)return function(e,t,n){const r={hour:"numeric",minute:"2-digit",timeZone:n};try{return e.toLocaleTimeString(t,r)}catch{return e.toLocaleTimeString(void 0,r)}}(r,n.locale,o);const{hh:a,mm:u}=w(r,o);return function(e,t){const n=Number(e);return`${n%12||12}:${t} ${n<12?"am":"pm"}`}(a,u)}function O(t,n){const r=F(t,n);if(r===e)return e;if(n?.clock&&J.some(e=>e in n.clock))return r;const o=n?.zoneName;if(!o)return`${v(t,n)}, ${r}`;const a=b(n?.timeZone)??void 0,u=new Date(t),i=n?.style;if(n?.locale&&i&&!i.dateStyle&&!i.timeStyle){const e=U(n.locale,{...i,...n.clock??{hour:"numeric",minute:"2-digit"},timeZoneName:o},a);if(e)return e.format(u)}return`${v(t,n)}, ${r} ${function(e,t,n,r){const o=U(r,{timeZoneName:n},t)??U(void 0,{timeZoneName:n},t);return o.formatToParts(e).find(e=>"timeZoneName"===e.type)?.value??""}(u,a,o,n?.locale)}`}var C=/* @__PURE__ */new Map;function U(e,t,n){const r=`${e??""}|${n??""}|${JSON.stringify(t)}`;let o=C.get(r);if(void 0===o){try{o=new Intl.DateTimeFormat(e,{...t,timeZone:n})}catch{o=null}C.set(r,o)}return o}var W={months:u,monthsShort:a,weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Su","Mo","Tu","We","Th","Fr","Sa"],monthYear:(e,t)=>`${u[t]} ${e}`,shortMonthYear:(e,t)=>`${a[t]} ${e}`,longDate:(e,t,n)=>`${n} ${u[t]} ${e}`},_=/* @__PURE__ */new Map;function L(e){if(!e)return W;const t=_.get(e);if(t)return t;const n=t=>d(e,t),r=(e,t,n=1)=>new Date(Date.UTC(e,t,n)),o=n({month:"long"}),a=n({month:"short"}),u=n({weekday:"long"}),i=n({weekday:"short"}),m=n({month:"long",year:"numeric"}),c=n({month:"short",year:"numeric"}),l=n({day:"numeric",month:"long",year:"numeric"}),Y=Array.from({length:12},(e,t)=>t),s=Array.from({length:7},(e,t)=>t),M={months:Y.map(e=>o.format(r(2e3,e))),monthsShort:Y.map(e=>a.format(r(2e3,e))),weekdays:s.map(e=>u.format(r(2e3,0,2+e))),weekdaysShort:s.map(e=>i.format(r(2e3,0,2+e))),monthYear:(e,t)=>m.format(r(e,t)),shortMonthYear:(e,t)=>c.format(r(e,t)),longDate:(e,t,n)=>l.format(r(e,t,n))};return _.set(e,M),M}var j=/* @__PURE__ */new Map;function P(e){if(!e)return 0;let t=j.get(e);if(void 0===t){t=0;try{const n=new Intl.Locale(e),r="function"==typeof n.getWeekInfo?n.getWeekInfo():n.weekInfo;1===r?.firstDay&&(t=1)}catch{}j.set(e,t)}return t}export{o as DATE_FORMAT_OPTIONS,s as TZ_AUTO,L as calendarNames,I as dayKeyInZone,P as firstDayOfWeek,v as formatDate,O as formatDateTime,F as formatTime,c as getUserDateFormat,M as getUserTimezone,A as instantOnDayKey,g as knownZone,l as setUserDateFormat,f as setUserTimezone,D as syncTimezoneFromProfile,T as userToday,k as userZone};
@@ -0,0 +1,2 @@
1
+ import{userToday as t}from"./chunk-NHKT5IH6.js";import{useShellPrefs as e}from"./chunk-KC3EX26K.js";import{toast_default as n}from"./chunk-TMSSR5UH.js";import{useSyncExternalStore as o,useCallback as a,useMemo as r}from"react";var i=[{id:"bell",label:"Bell",description:"Soft bell with one harmonic"},{id:"chime",label:"Chime",description:"Two-note ascending chime"},{id:"bowl",label:"Singing Bowl",description:"Long-decay meditation tone"},{id:"wind-chimes",label:"Wind Chimes",description:"Four soft tones in succession"},{id:"off",label:"Off (silent)",description:"No sound — only desktop notification"}],c=[{id:"none",label:"None"},{id:"tick-fast",label:"Ticking Fast"},{id:"tick-slow",label:"Ticking Slow"},{id:"rain",label:"Rain"},{id:"fireplace",label:"Fireplace"},{id:"white",label:"White Noise"},{id:"pink",label:"Pink Noise"},{id:"brown",label:"Brown Noise"}];function l(e=/* @__PURE__ */new Date){return t(e)??""}function s(t=/* @__PURE__ */new Date){return`pomodoro-day-${l(t)}`}var u={focus:1500,short:300,long:900},d="bell",f=100,m=1,h="none",g=50,p={autoStartBreaks:!1,autoStartPomodoros:!1,longBreakInterval:4},k={running:!1,remaining:u.focus,mode:"focus",total:u.focus,streak:0,count:"undefined"!=typeof localStorage?function(t=/* @__PURE__ */new Date){const e=l(t);if(!e)return 0;try{const n=localStorage.getItem(s(t)),o=null===n?localStorage.getItem(`pomodoro-${e}`):null;return parseInt(n??o??"0",10)||0}catch{return 0}}():0},w=null,M=/* @__PURE__ */new Set,S=t=>{k={...k,...t},M.forEach(t=>t())};function b(){return k}function y(t){return M.add(t),()=>{M.delete(t)}}function v(t){u=t,k.running||k.remaining!==k.total||S({remaining:t[k.mode],total:t[k.mode]})}function T(t){d=t}function A(t,e){f=Math.max(0,Math.min(100,Math.round(t))),m=Math.max(1,Math.min(5,Math.round(e)))}function I(t){p={autoStartBreaks:!!t.autoStartBreaks,autoStartPomodoros:!!t.autoStartPomodoros,longBreakInterval:Math.max(1,Math.min(20,Math.round(t.longBreakInterval||4)))}}function x(t,e){h=t,g=Math.max(0,Math.min(100,Math.round(e))),k.running&&"focus"===k.mode?(G(),F()):"none"!==t&&0!==g||G()}function B(){k.running||(S({running:!0}),w=setInterval(P,1e3),"focus"===k.mode&&F())}function C(){(k.running||null!==w)&&(null!==w&&(clearInterval(w),w=null),S({running:!1}),G())}function N(t){C(),S({mode:t,remaining:u[t],total:u[t]})}function P(){k.remaining<=1?function(){null!==w&&(clearInterval(w),w=null);G(),D(d,{volume:f,repeat:m});const t="focus"===k.mode?"Pomodoro complete — time for a break! 🍅":"Break's over — back to work!";if("undefined"!=typeof Notification&&"granted"===Notification.permission)try{new Notification(t)}catch{}try{n.info(t)}catch{}if("focus"===k.mode){const t=k.streak+1,e=k.count+1;(t=>{try{l()&&localStorage.setItem(s(),String(t))}catch{}})(e);const n=t%p.longBreakInterval===0?"long":"short";S({running:!1,streak:t,count:e,mode:n,remaining:u[n],total:u[n]}),p.autoStartBreaks&&setTimeout(()=>B(),50)}else S({running:!1,mode:"focus",remaining:u.focus,total:u.focus}),p.autoStartPomodoros&&setTimeout(()=>B(),50)}():S({remaining:k.remaining-1})}function D(t=d,e={}){if("off"===t)return;const n=Math.max(0,Math.min(100,e.volume??100))/100;if(0===n)return;const o=Math.max(1,Math.min(5,e.repeat??1));for(let e=0;e<o;e++)setTimeout(()=>_(t,n),2500*e)}function _(t,e){try{const n=window.AudioContext||window.webkitAudioContext;if(!n)return;const o=new n,a=(t,n,a,r=.22,i="sine")=>{const c=o.createOscillator(),l=o.createGain();c.connect(l),l.connect(o.destination),c.type=i,c.frequency.value=t;const s=o.currentTime+n;l.gain.setValueAtTime(0,s),l.gain.linearRampToValueAtTime(r*e,s+.03),l.gain.exponentialRampToValueAtTime(1e-4,s+a),c.start(s),c.stop(s+a)};let r=2;"bell"===t?(a(880,0,1.8),a(1320,0,1.4,.1),r=2):"chime"===t?(a(659.25,0,.7),a(880,.2,1.3),r=2):"bowl"===t?(a(440,0,3.4,.22),a(660,0,3,.08),a(880,.05,2.8,.05),r=4):"wind-chimes"===t&&(a(1175,0,1.1,.16),a(880,.15,1.3,.16),a(1318,.3,1.5,.16),a(1047,.5,1.7,.13),r=3),setTimeout(()=>{try{o.close()}catch{}},1e3*r+500)}catch{}}var R=null,O={none:0,white:.3,pink:.3,brown:.3,"tick-fast":.6,"tick-slow":.6,rain:.4,fireplace:.5};function j(t,e){if("none"===e)return null;const n=t.sampleRate,o="white"===e||"pink"===e||"brown"===e?2:4,a=n*o,r=t.createBuffer(1,a,n),i=r.getChannelData(0);if("white"===e)for(let t=0;t<a;t++)i[t]=.5*(2*Math.random()-1);else if("pink"===e){let t=0,e=0,n=0,o=0,r=0,c=0,l=0;for(let s=0;s<a;s++){const a=2*Math.random()-1;t=.99886*t+.0555179*a,e=.99332*e+.0750759*a,n=.969*n+.153852*a,o=.8665*o+.3104856*a,r=.55*r+.5329522*a,c=-.7616*c-.016898*a,i[s]=.11*(t+e+n+o+r+c+l+.5362*a)*.55,l=.115926*a}}else if("brown"===e){let t=0;for(let e=0;e<a;e++){t=(t+.02*(2*Math.random()-1))/1.02,i[e]=3.5*t*.5}}else if("tick-fast"===e||"tick-slow"===e){const t="tick-fast"===e?.5:1,r=Math.floor(.045*n);for(let e=0;e<o;e+=t){const t=Math.floor(e*n);for(let e=0;e<r&&t+e<a;e++){const o=Math.exp(-e/n*180),a=2*Math.random()-1,r=Math.sin(2*Math.PI*1100*(e/n));i[t+e]+=(.7*a+.25*r)*o*.55}}}else if("rain"===e){let t=0;for(let e=0;e<a;e++){const o=2*Math.random()-1,a=o-.93*t;t=o;const r=.7+.3*Math.sin(e/n*2*Math.PI*.25);i[e]=a*r*.4}}else if("fireplace"===e){let t=0;for(let e=0;e<a;e++){t=(t+.02*(2*Math.random()-1))/1.02,i[e]=1.6*t}let e=.4*Math.random()*n;for(;e<a;){const t=Math.floor((.012+.05*Math.random())*n),o=.35+.45*Math.random(),r=Math.floor(e);for(let e=0;e<t&&r+e<a;e++){const t=Math.exp(-e/n*90);i[r+e]+=(2*Math.random()-1)*t*o}e+=(.08+.62*Math.random())*n}}return r}function F(){if(!R&&"none"!==h&&0!==g)try{const t=window.AudioContext||window.webkitAudioContext;if(!t)return;const e=new t,n=j(e,h);if(!n){try{e.close()}catch{}return}const o=e.createBufferSource();o.buffer=n,o.loop=!0;const a=e.createGain();a.gain.value=g/100*O[h],o.connect(a).connect(e.destination),o.start(),R={ctx:e,src:o,gain:a}}catch{}}function G(){if(R){try{R.src.stop()}catch{}try{R.ctx.close()}catch{}R=null}}function H(t,e){if("none"!==t&&0!==e)try{const n=window.AudioContext||window.webkitAudioContext;if(!n)return;const o=new n,a=j(o,t);if(!a){try{o.close()}catch{}return}const r=o.createBufferSource();r.buffer=a,r.loop=!0;const i=o.createGain();i.gain.value=e/100*O[t],r.connect(i).connect(o.destination),r.start(),setTimeout(()=>{try{r.stop()}catch{}try{o.close()}catch{}},3e3)}catch{}}var K="pomodoro_tasks",V="pomodoro_tasks_migrated";function E(){return Math.random().toString(36).slice(2,11)}function W(){/* @__PURE__ */
2
+ return(new Date).toISOString()}var $=null,q=[],J=!1,L=null,U=/* @__PURE__ */new Set;function X(){for(const t of U)t()}function z(t){q=t,X()}function Q(){const t=$;return t?L=t.list().then(e=>{$===t&&(q=e,J=!0,X())}).catch(()=>{$===t&&(J=!0,X())}).finally(()=>{L=null}):(q=[],J=!0,X(),Promise.resolve())}function Y(t){$=t,q=[],J=!1,t?Q():X()}function Z(t){return U.add(t),!$||J||L||Q(),()=>{U.delete(t)}}function tt(){return q}function et(){const t=function(){const{prefs:t,save:n}=e(),o=r(()=>{const e=t.todo_tasks;return Array.isArray(e)?e:[]},[t.todo_tasks]),i=a(t=>{n({todo_tasks:t})},[n]),c=a(t=>{const e=E(),n=W(),a={done:!1,...t,name:t.name.trim(),id:e,createdAt:n,updatedAt:n};return i([...o,a]),e},[o,i]),l=a((t,e)=>{i(o.map(n=>n.id===t?{...n,...e,id:n.id,updatedAt:W()}:n))},[o,i]),s=a(t=>{i(o.filter(e=>e.id!==t))},[o,i]),u=a(t=>{const e=o.find(e=>e.id===t);e&&l(t,{done:!e.done})},[o,l]);return{tasks:o,addTask:c,updateTask:l,removeTask:s,toggleDone:u,setAllTasks:i}}(),n=o(Z,tt,tt),i=a(e=>{const n=$;if(!n)return t.addTask(e);const o="tmp-"+E(),a=W(),r={done:!1,...e,name:e.name.trim(),id:o,createdAt:a,updatedAt:a};return z([...q,r]),n.create({...e,name:e.name.trim()}).then(t=>z(q.map(e=>e.id===o?{...r,...t}:e))).catch(()=>z(q.filter(t=>t.id!==o))),o},[t]),c=a((e,n)=>{const o=$;if(!o)return t.updateTask(e,n);z(q.map(t=>t.id===e?{...t,...n,id:e,updatedAt:W()}:t)),o.update(e,n).catch(()=>{Q()})},[t]),l=a(e=>{const n=$;if(!n)return t.removeTask(e);const o=q;z(q.filter(t=>t.id!==e)),n.remove(e).catch(()=>z(o))},[t]),s=a(e=>{if(!$)return t.toggleDone(e);const n=q.find(t=>t.id===e);n&&c(e,{done:!n.done})},[t,c]),u=a(e=>{$||t.setAllTasks(e)},[t]);return null===$?t:{tasks:n,addTask:i,updateTask:c,removeTask:l,toggleDone:s,setAllTasks:u}}function nt(t,e){try{if(localStorage.getItem(V))return;const n=localStorage.getItem(K);if(!n)return void localStorage.setItem(V,"1");const o=JSON.parse(n);if(!Array.isArray(o)||0===o.length)return localStorage.removeItem(K),void localStorage.setItem(V,"1");const a=W(),r=o.filter(t=>"string"==typeof t?.name).map(t=>({id:t.id||E(),name:String(t.name),done:!!t.done,estimated:"number"==typeof t.estimated?t.estimated:void 0,completed:"number"==typeof t.completed?t.completed:void 0,createdAt:a,updatedAt:a})),i=new Set(t.map(t=>t.id));e([...r.filter(t=>!i.has(t.id)),...t]),localStorage.removeItem(K),localStorage.setItem(V,"1")}catch{try{localStorage.setItem(V,"1")}catch{}}}export{i as ALARM_OPTIONS,c as FOCUS_SOUND_OPTIONS,b as getPomoSnapshot,nt as migratePomodoroTasksOnce,D as playAlarm,C as pomoPause,B as pomoStart,N as pomoSwitchMode,l as pomodoroToday,H as previewFocusSound,T as setPomoAlarm,A as setPomoAlarmConfig,I as setPomoBehaviour,v as setPomoDurations,x as setPomoFocusSound,Y as setShellTodoProvider,y as subscribePomo,et as useTodoTasks};