efficient-shell 13.7.0 → 13.10.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 (73) hide show
  1. package/README.md +4 -2
  2. package/dist/{Browser-RDE3RBBK.js → Browser-RQMICFVJ.js} +14 -14
  3. package/dist/Files-MJBEQENM.js +141 -0
  4. package/dist/{Notepad-CFK5MJDE.js → Notepad-KE3Q7TEM.js} +8 -8
  5. package/dist/PomodoroTimer-2MFWO3KK.js +91 -0
  6. package/dist/{Preview-CBYMPKY2.js → Preview-J54KUTIR.js} +13 -13
  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.d.ts +7 -2
  11. package/dist/apps/index.js +1 -1
  12. package/dist/bin/browser-check.js +1 -1
  13. package/dist/bin/media-host-check.js +1 -1
  14. package/dist/bin/ui-check.js +1 -1
  15. package/dist/charts/SpecChart.js +1 -1
  16. package/dist/{chunk-GXVWI3U5.js → chunk-5CFERCYW.js} +1 -1
  17. package/dist/chunk-7APOZZ72.js +1 -0
  18. package/dist/{chunk-PDIGCTZD.js → chunk-BKZOTBDP.js} +19 -19
  19. package/dist/{chunk-4EFIUJ7X.js → chunk-CUNYWXUT.js} +1 -1
  20. package/dist/{chunk-ZJZHUPUH.js → chunk-F3G7S5HO.js} +23 -23
  21. package/dist/{chunk-4C7YUXDI.js → chunk-H7CIK74N.js} +10 -10
  22. package/dist/{chunk-AOZZ2LEL.js → chunk-HQSJSPQB.js} +1 -1
  23. package/dist/chunk-HYHZEQMG.js +1 -0
  24. package/dist/{chunk-RI5QSLX3.js → chunk-IOZSLFGR.js} +1 -1
  25. package/dist/chunk-KGRJSTPM.js +13 -0
  26. package/dist/{chunk-H22D2PYM.js → chunk-LOFFHXZ4.js} +9 -9
  27. package/dist/chunk-NHKT5IH6.js +1 -0
  28. package/dist/{chunk-E6PDAYBR.js → chunk-O5UD3ZWM.js} +4 -4
  29. package/dist/chunk-OAKXWYZD.js +2 -0
  30. package/dist/{chunk-S6UJKSF3.js → chunk-OJI4ROSD.js} +1 -1
  31. package/dist/{chunk-767USLF5.js → chunk-R3R6ZJNW.js} +6 -6
  32. package/dist/{chunk-3MIIXPV6.js → chunk-SC3AQXJY.js} +8 -8
  33. package/dist/{chunk-UD2C3PJE.js → chunk-VKRJVHYA.js} +1 -1
  34. package/dist/chunk-YJGA4LPG.js +2 -0
  35. package/dist/{chunk-ENCZRE3H.js → chunk-Z62HFEFS.js} +7 -7
  36. package/dist/{chunk-SQ4ZFG2B.js → chunk-ZAL72BPF.js} +1 -1
  37. package/dist/{chunk-77HMTXDR.js → chunk-ZJ34FNRC.js} +1 -1
  38. package/dist/data/Gantt.js +1 -1
  39. package/dist/format/index.d.ts +1 -1
  40. package/dist/format/index.js +1 -1
  41. package/dist/forms/BrandAssetEditor.js +1 -1
  42. package/dist/forms/Calendar.js +1 -1
  43. package/dist/forms/DatePicker.js +1 -1
  44. package/dist/forms/DateRangePicker.js +1 -1
  45. package/dist/forms/MediaLibrary.js +1 -1
  46. package/dist/icons/index.js +1 -1
  47. package/dist/index.d.ts +1 -1
  48. package/dist/index.js +665 -665
  49. package/dist/shell/LanguageSelect.js +1 -1
  50. package/dist/shell/MilestoneTimeline.js +1 -1
  51. package/dist/shell/ProductionTimeline.js +1 -1
  52. package/dist/shell/SettingRow.js +1 -1
  53. package/dist/shell/TimeAgo.js +1 -1
  54. package/dist/shell/TimelineTrack.js +1 -1
  55. package/dist/shell/timelineDates.js +1 -1
  56. package/dist/telemetry/index.js +1 -1
  57. package/dist/ui/index.d.ts +1 -1
  58. package/dist/ui/index.js +1 -1
  59. package/dist/utils/date.d.ts +44 -5
  60. package/dist/utils/date.js +1 -1
  61. package/dist/utils/format.js +1 -1
  62. package/dist/version.js +1 -1
  63. package/package.json +1 -1
  64. package/dist/Files-SPICA5IO.js +0 -141
  65. package/dist/PomodoroTimer-57XARJRF.js +0 -91
  66. package/dist/Weather-Y4TMYOQB.js +0 -60
  67. package/dist/WorldClock-FY3UCIAW.js +0 -32
  68. package/dist/chunk-COHFFGFE.js +0 -2
  69. package/dist/chunk-FBDZGO3V.js +0 -1
  70. package/dist/chunk-I3MSKHJD.js +0 -2
  71. package/dist/chunk-WBAWJIVM.js +0 -13
  72. package/dist/chunk-XNGQHEGB.js +0 -1
  73. package/dist/chunk-ZPJTLNKU.js +0 -1
@@ -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};
@@ -1,4 +1,4 @@
1
- import{useWindowMenuItem as e,Modal as t}from"./chunk-H4LUHKUJ.js";import{navIcons as r}from"./chunk-4LXCCZDM.js";import{VERSION as n}from"./chunk-XNGQHEGB.js";import{Icon as s}from"./chunk-ISVODSRP.js";import{DEFAULT_SHELL_STRINGS as i,useShellStrings as o,splitAround as a}from"./chunk-DEJIH3ZQ.js";import{useState as l,useCallback as m,isValidElement as c,cloneElement as p}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";var h=i.aboutApp,x={notepad:{name:"Notepad",version:"1.1.0",route:"/notepad",description:h.notepad},preview:{name:"Preview",version:"1.5.0",route:"/preview",description:h.preview},files:{name:"Files",version:"2.0.0",route:"/files",description:h.files},browser:{name:"Browser",version:"1.0.3",route:"/browser",description:h.browser}},u=/* @__PURE__ */d(s,{name:"info",className:"h-4 w-4",strokeWidth:1.5}),w=/* @__PURE__ */d(s,{name:"window",className:"h-9 w-9",strokeWidth:1.5});function v({app:s}){const i=x[s],[h,v]=l(!1),N=m(()=>v(!0),[]),b=o().aboutApp,k=b.title(i.name);if(e(k,N,u),!h)return null;const g=r[i.route],y=c(g)?p(g,{className:"h-9 w-9"}):w,[j,H]=a(b.partOf);/* @__PURE__ */
1
+ import{useWindowMenuItem as e,Modal as t}from"./chunk-H4LUHKUJ.js";import{navIcons as r}from"./chunk-4LXCCZDM.js";import{VERSION as n}from"./chunk-7APOZZ72.js";import{Icon as s}from"./chunk-ISVODSRP.js";import{DEFAULT_SHELL_STRINGS as i,useShellStrings as o,splitAround as a}from"./chunk-DEJIH3ZQ.js";import{useState as l,useCallback as m,isValidElement as c,cloneElement as p}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";var h=i.aboutApp,x={notepad:{name:"Notepad",version:"1.1.0",route:"/notepad",description:h.notepad},preview:{name:"Preview",version:"1.5.0",route:"/preview",description:h.preview},files:{name:"Files",version:"2.0.1",route:"/files",description:h.files},browser:{name:"Browser",version:"1.0.3",route:"/browser",description:h.browser}},u=/* @__PURE__ */d(s,{name:"info",className:"h-4 w-4",strokeWidth:1.5}),w=/* @__PURE__ */d(s,{name:"window",className:"h-9 w-9",strokeWidth:1.5});function v({app:s}){const i=x[s],[h,v]=l(!1),N=m(()=>v(!0),[]),b=o().aboutApp,k=b.title(i.name);if(e(k,N,u),!h)return null;const g=r[i.route],y=c(g)?p(g,{className:"h-9 w-9"}):w,[j,H]=a(b.partOf);/* @__PURE__ */
2
2
  return d(t,{open:!0,onClose:()=>v(!1),title:k,size:"sm",compact:!0,bodyScroll:!1,autoHeight:!0,dimensions:[320,320],children:/* @__PURE__ */f("div",{className:"flex flex-col items-center text-center px-5 pt-5 pb-4",children:[
3
3
  /* @__PURE__ */d("div",{className:"flex h-16 w-16 items-center justify-center rounded-2xl bg-gray-100 text-gray-600 shrink-0",children:y}),
4
4
  /* @__PURE__ */d("h2",{className:"mt-3 text-lg font-bold text-gray-900",children:i.name}),
@@ -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};
@@ -0,0 +1,13 @@
1
+ import{navIcons as e}from"./chunk-4LXCCZDM.js";import{Icon as t}from"./chunk-ISVODSRP.js";import{isValidElement as n,cloneElement as r}from"react";import{jsx as o,jsxs as i}from"react/jsx-runtime";var a="react-os-shell:spreadsheet-preview-update",s=null,l=0;function d(e){const t=++l,n={token:t,data:e};return s=n,{update(e){s===n&&(n.data=e),"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent(a,{detail:{token:t,data:e}}))}}}function c(){return s}function p(e){s===e&&(s=null)}var u={owner:"Owner",editor:"Editor",commenter:"Commenter",viewer:"Viewer"},f=e=>"owner"===e||"editor"===e,h={document:".docx",spreadsheet:".sheet",deck:".slides"},w=class extends Error{limit;used;attempted;constructor(e,t,n){super("Not enough space"),this.name="FilesQuotaError",this.limit=e,this.used=t,this.attempted=n}};function m(e,t){return e&&"/"!==e?e.replace(/\/$/,"")+"/"+t:"/"+t}async function y(e,t){const n=await e.json().catch(()=>({}));return new Error(n.error||`${t} failed (${e.status})`)}function g(e){const t=()=>(e??(("undefined"!=typeof window?window.__REACT_OS_SHELL_FILE_SERVER__:void 0)||"http://localhost:4000").replace(/\/$/,"")).replace(/\/$/,""),n=(e,n={})=>fetch(`${t()}${e}`,{...n,credentials:"include"}),r=e=>({method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return{async quota(){const e=await n("/api/quota");if(!e.ok)throw await y(e,"Quota");const t=await e.json();return{used:t.used,limit:t.limit}},async list(e){const t=e??"/",r=await n(`/api/files?path=${encodeURIComponent(t)}`);if(!r.ok)throw await y(r,"Listing");const o=await r.json(),i=o.path||t,a=i.split("/").filter(Boolean);return{folder:{id:"/"===i?null:i,name:a[a.length-1]??"",role:"owner",path:[{id:null,name:""},...a.map((e,t)=>({id:"/"+a.slice(0,t+1).join("/"),name:e}))]},entries:(o.entries||[]).map(e=>({id:m(i,e.name),name:e.name,kind:e.kind,size:e.size,modifiedAt:e.modifiedAt}))}},async upload(e,t){const r=new FormData;r.append("file",t);const o=await n(`/api/upload?path=${encodeURIComponent(e??"/")}`,{method:"POST",body:r});if(413===o.status){const e=await o.json().catch(()=>({}));throw new w(e.limit||0,e.used||0,e.attempted||t.size)}if(!o.ok)throw await y(o,"Upload")},async createFolder(e,t){const o=await n("/api/folder",r({path:m(e,t)}));if(!o.ok)throw await y(o,"Create folder")},async rename(e,t){const o=e.replace(/\/[^/]*$/,"")||"/",i=await n("/api/rename",r({from:e,to:m(o,t)}));if(!i.ok)throw await y(i,"Rename")},async remove(e){const t=await n(`/api/files?path=${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok)throw await y(t,"Delete")},async read(e){const t=await n(`/api/file?path=${encodeURIComponent(e)}`);if(!t.ok)throw await y(t,"Download");return t.blob()},async trash(){const e=await n("/api/trash");if(!e.ok)throw await y(e,"Listing trash");return(await e.json()).entries||[]},async restore(e){const t=await n("/api/trash/restore",r({id:e}));if(!t.ok)throw await y(t,"Restore")},async purge(e){const t=await n(`/api/trash/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok)throw await y(t,"Delete")},async emptyTrash(){const e=await n("/api/trash",{method:"DELETE"});if(!e.ok)throw await y(e,"Empty trash")}}}var x=null;function b(e){x=e}function v(){return x??g()}function _(){return null!==x}var k=["from-blue-500 to-blue-700","from-indigo-500 to-purple-600","from-purple-500 to-pink-600","from-pink-500 to-rose-600","from-red-500 to-rose-600","from-orange-500 to-red-600","from-amber-500 to-orange-600","from-yellow-500 to-amber-500","from-lime-500 to-green-600","from-green-500 to-emerald-600","from-emerald-500 to-teal-600","from-teal-500 to-cyan-600","from-cyan-500 to-sky-600","from-sky-500 to-blue-600","from-violet-500 to-fuchsia-600"];function E(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n);return k[Math.abs(t)%k.length]}var C={order:"text-blue-600",purchase_order:"text-purple-600",invoice:"text-green-600",client:"text-indigo-600",manufacturer:"text-orange-600",shipment:"text-teal-600",part_number:"text-gray-600",project:"text-pink-600",mould:"text-red-600",design:"text-cyan-600",brand:"text-amber-600",price_sheet:"text-emerald-600",folder:"text-yellow-600",page:"text-blue-500"},N={order:"SO",purchase_order:"PO",invoice:"INV",client:"CLI",manufacturer:"MFR",shipment:"DN",part_number:"PN",project:"PRJ",mould:"MLD",design:"DSN",brand:"BRD",price_sheet:"PS",vendor_invoice:"VI",vendor_payment:"VP",warranty_claim:"WC",qc_report:"QC",vendor_shipment:"GRN",bank_account:"BA",wheel_finish:"WF",weight_log:"WL",production_progress:"PP",vendor_price_sheet:"VPS",proposal:"PR",folder:"FLD"},j={pdf:"PDF",dxf:"DXF","3d":"STP",image:"IMG",csv:"CSV"},T={pdf:"text-red-600",dxf:"text-blue-600","3d":"text-purple-600",image:"text-emerald-600",csv:"text-green-600"};function I({className:e}){/* @__PURE__ */
2
+ return o(t,{name:"folder",look:"solid",className:e})}function S(t,n){return n&&e[n]||(t?e[t]:void 0)}var L=/* @__PURE__ */o("svg",{className:"h-7 w-7",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */o("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6A2.25 2.25 0 016 3.75h2.25A2.25 2.25 0 0110.5 6v2.25a2.25 2.25 0 01-2.25 2.25H6a2.25 2.25 0 01-2.25-2.25V6z"})});function $({entityType:e,isSelected:t,entityId:a,label:s,fileKind:l}){const d="preview-file"===e&&l,c=d?T[l]:null,p=d?j[l]:null;if("folder"===e)/* @__PURE__ */
3
+ return o("div",{className:"w-12 h-12 flex items-center justify-center "+(t?"rounded-lg bg-blue-400/30 ring-2 ring-blue-500":""),children:/* @__PURE__ */o(I,{className:"h-12 w-12 text-amber-500 drop-shadow-[0_2px_3px_rgba(0,0,0,0.3)]"})});if("page"===e){const e=S(a,s),i=E(a||s||"page");/* @__PURE__ */
4
+ return o("div",{className:"w-12 h-12 flex items-center justify-center "+(t?"rounded-lg bg-blue-400/30 ring-2 ring-blue-500":""),children:/* @__PURE__ */o("span",{className:`h-11 w-11 rounded-xl bg-gradient-to-br ${i} flex items-center justify-center text-white border border-white/30 drop-shadow-[0_2px_3px_rgba(0,0,0,0.3)]`,children:e&&n(e)?r(e,{className:"h-7 w-7 text-white"}):L})})}/* @__PURE__ */
5
+ return i("div",{className:"w-12 h-12 relative flex items-center justify-center "+(t?"rounded-lg bg-blue-400/30 ring-2 ring-blue-500":""),children:[
6
+ /* @__PURE__ */i("svg",{className:`w-10 h-12 drop-shadow-[0_2px_3px_rgba(0,0,0,0.3)] ${c??C[e]??"text-gray-500"}`,viewBox:"0 0 40 48",fill:"none",children:[
7
+ /* @__PURE__ */o("path",{d:"M4 0h22l10 10v34a4 4 0 01-4 4H4a4 4 0 01-4-4V4a4 4 0 014-4z",fill:"white",fillOpacity:"0.92"}),
8
+ /* @__PURE__ */o("path",{d:"M26 0l10 10H30a4 4 0 01-4-4V0z",fill:"currentColor",fillOpacity:"0.2"}),
9
+ /* @__PURE__ */o("path",{d:"M4 0h22l10 10v34a4 4 0 01-4 4H4a4 4 0 01-4-4V4a4 4 0 014-4z",stroke:"currentColor",strokeWidth:"1.5",strokeOpacity:"0.5"})]}),
10
+ /* @__PURE__ */o("span",{className:`absolute inset-0 flex items-center justify-center text-3xs font-bold pt-2 ${c??C[e]??"text-gray-600"}`,children:p??N[e]??e.slice(0,3).toUpperCase()})]})}function R({item:e}){if("folder"===e.entityType)/* @__PURE__ */
11
+ return o(I,{className:"h-4 w-4 shrink-0 text-amber-500"});if("page"===e.entityType){const t=S(e.entityId,e.label);/* @__PURE__ */
12
+ return o("span",{className:`h-4 w-4 rounded bg-gradient-to-br ${E(e.entityId||e.label||"page")} flex items-center justify-center text-white shrink-0`,children:t&&n(t)?r(t,{className:"h-3 w-3 text-white"}):/* @__PURE__ */o("span",{className:"h-1.5 w-1.5 rounded-[2px] border border-white/80"})})}const i=("preview-file"===e.entityType&&e.fileKind?T[e.fileKind]:C[e.entityType])??"text-gray-400";/* @__PURE__ */
13
+ return o(t,{name:"page",className:`h-4 w-4 shrink-0 ${i}`,strokeWidth:1.5})}function D(e){return"preview-file"===e.entityType&&e.fileKind?j[e.fileKind]:"page"===e.entityType?"App":"folder"===e.entityType?"Folder":N[e.entityType]??e.entityType.slice(0,3).toUpperCase()}var P=null,V=/* @__PURE__ */new Set;function O(e){P=e,V.forEach(e=>e())}function F(e){return V.add(e),()=>{V.delete(e)}}function A(){return P}var M="__REACT_OS_SHELL_FILES_VIEW__",U="react-os-shell:files-show-trash",z="react-os-shell:files-open-desktop-folder";function W(){"undefined"!=typeof window&&(window[M]="trash",window.dispatchEvent(new CustomEvent(U)))}function H(e){"undefined"!=typeof window&&(window[M]={view:"desktop-folder",folderId:e},window.dispatchEvent(new CustomEvent(z,{detail:{folderId:e}})))}function B(){if("undefined"==typeof window)return null;const e=window[M];return"trash"===e?"trash":e&&"object"==typeof e&&"desktop-folder"===e.view&&"string"==typeof e.folderId?e:null}function K(){const e=B();return"undefined"!=typeof window&&(window[M]=null),e}export{R as DesktopItemMiniIcon,h as FILES_OFFICE_EXTENSIONS,z as FILES_OPEN_DESKTOP_FOLDER_EVENT,u as FILES_ROLE_LABELS,U as FILES_SHOW_TRASH_EVENT,$ as FileIconTile,w as FilesQuotaError,I as FolderGlyph,a as SPREADSHEET_PREVIEW_UPDATE_EVENT,p as claimSpreadsheetPreviewStage,K as consumeFilesViewRequest,g as createFileServerStore,D as desktopItemTypeLabel,f as filesRoleWrites,A as getDesktopFoldersSnapshot,v as getFilesStore,_ as hasHostFilesStore,B as peekFilesViewRequest,c as peekSpreadsheetPreviewStage,O as publishDesktopFolders,H as requestFilesDesktopFolderView,W as requestFilesTrashView,b as setFilesStore,d as setSpreadsheetPreview,F as subscribeDesktopFolders};
@@ -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};
@@ -1,9 +1,9 @@
1
- import{CountBadge as e}from"./chunk-F3MO56N4.js";import{SettingRowNameContext as i,SettingAutoContext as n}from"./chunk-2NMW66P5.js";import{isShown as a}from"./chunk-HCP7WOAL.js";import{useShellStrings as t}from"./chunk-DEJIH3ZQ.js";import{isValidElement as l}from"react";import{jsx as s,jsxs as r,Fragment as d}from"react/jsx-runtime";var c={pad:"p-4",gap:"gap-4",text:"text-sm",bodyTop:"mt-4",bodyPad:"pt-3"},m=e=>Array.isArray(e)?e.some(m):l(e);function o({label:l,icon:o,action:h,value:u,readout:f,changed:p=!1,description:x,children:N,controlId:v,labelId:g,unknownText:b="—",quiet:y=!1,size:k="default",viewState:w,divider:$=!0,showWhen:j,values:P,context:A,className:F=""}){const I=t();if(!a(j,P,A))return null;const T="auto"===w?/* @__PURE__ */s("span",{"data-setting-auto":"","aria-hidden":"true",className:"shrink-0 rounded-sm border border-line px-1 text-2xs font-normal leading-4 text-ink-faint",children:I.settingView.auto}):"edited"===w?/* @__PURE__ */r("span",{"data-setting-edited":"",className:"inline-flex shrink-0 items-center",children:[
1
+ import{CountBadge as e}from"./chunk-F3MO56N4.js";import{isShown as i}from"./chunk-HCP7WOAL.js";import{SettingRowNameContext as n,SettingAutoContext as a}from"./chunk-2NMW66P5.js";import{useShellStrings as t}from"./chunk-DEJIH3ZQ.js";import{isValidElement as l}from"react";import{jsx as s,jsxs as r,Fragment as d}from"react/jsx-runtime";var c={pad:"p-4",gap:"gap-4",text:"text-sm",bodyTop:"mt-4",bodyPad:"pt-3"},m=e=>Array.isArray(e)?e.some(m):l(e);function o({label:l,icon:o,action:h,value:u,readout:f,changed:p=!1,description:x,children:N,controlId:v,labelId:g,unknownText:b="—",quiet:y=!1,size:k="default",viewState:w,divider:$=!0,showWhen:j,values:P,context:A,className:F=""}){const I=t();if(!i(j,P,A))return null;const T="auto"===w?/* @__PURE__ */s("span",{"data-setting-auto":"","aria-hidden":"true",className:"shrink-0 rounded-sm border border-line px-1 text-2xs font-normal leading-4 text-ink-faint",children:I.settingView.auto}):"edited"===w?/* @__PURE__ */r("span",{"data-setting-edited":"",className:"inline-flex shrink-0 items-center",children:[
2
2
  /* @__PURE__ */s("span",{"aria-hidden":"true",className:"inline-flex",children:/* @__PURE__ */s(e,{dot:!0,tone:"accent"})}),
3
- /* @__PURE__ */s("span",{className:"sr-only",children:I.settingView.edited})]}):null,W=null!=f&&!1!==f;if("compact"===k){const e=m(u),a=m(h);if(!e&&!a)return null;const t=g,c=["es-field"];e||c.push("is-inline"),p&&c.push("is-changed"),F&&c.push(F);const b=/* @__PURE__ */r(d,{children:[null!=o&&/* @__PURE__ */s("span",{className:"es-field-icon","aria-hidden":"true",children:o}),
4
- /* @__PURE__ */s("span",{className:"es-field-label",id:t,children:l}),T]}),y=e=>/* @__PURE__ */s(i.Provider,{value:t,children:/* @__PURE__ */s(n.Provider,{value:"auto"===w,children:e})});/* @__PURE__ */
3
+ /* @__PURE__ */s("span",{className:"sr-only",children:I.settingView.edited})]}):null,W=null!=f&&!1!==f;if("compact"===k){const e=m(u),i=m(h);if(!e&&!i)return null;const t=g,c=["es-field"];e||c.push("is-inline"),p&&c.push("is-changed"),F&&c.push(F);const b=/* @__PURE__ */r(d,{children:[null!=o&&/* @__PURE__ */s("span",{className:"es-field-icon","aria-hidden":"true",children:o}),
4
+ /* @__PURE__ */s("span",{className:"es-field-label",id:t,children:l}),T]}),y=e=>/* @__PURE__ */s(n.Provider,{value:t,children:/* @__PURE__ */s(a.Provider,{value:"auto"===w,children:e})});/* @__PURE__ */
5
5
  return r("div",{className:c.join(" "),children:[
6
- /* @__PURE__ */r("div",{className:"es-field-head",children:[v?/* @__PURE__ */s("label",{className:"es-field-name",htmlFor:v,children:b}):/* @__PURE__ */s("span",{className:"es-field-name",children:b}),W&&/* @__PURE__ */s("span",{className:"es-field-value",children:f}),a&&y(h)]}),e&&/* @__PURE__ */s("div",{className:"es-field-ctl",children:y(u)}),x?/* @__PURE__ */s("p",{className:"es-field-hint",children:x}):null,N]})}const H=c,M=void 0!==u||void 0===N&&null==h,O=null==u||""===u,V=y?"text-gray-500":"text-gray-800",q=O?"text-gray-400":y?"text-gray-500":"text-gray-900",z=`${H.text} font-medium ${V}`,B=v?/* @__PURE__ */s("label",{htmlFor:v,id:g,className:z,children:l}):/* @__PURE__ */s("span",{id:g,className:z,children:l}),C=/* @__PURE__ */s(i.Provider,{value:g,children:/* @__PURE__ */s(n.Provider,{value:"auto"===w,children:O?b:u})}),D=[$?"border-t border-line-subtle first:border-t-0":"",H.pad,F].filter(Boolean).join(" "),E=null!=N&&!1!==N&&/* @__PURE__ */s("div",{className:`${H.bodyTop} border-t border-line-subtle ${H.bodyPad}`,children:N});/* @__PURE__ */
6
+ /* @__PURE__ */r("div",{className:"es-field-head",children:[v?/* @__PURE__ */s("label",{className:"es-field-name",htmlFor:v,children:b}):/* @__PURE__ */s("span",{className:"es-field-name",children:b}),W&&/* @__PURE__ */s("span",{className:"es-field-value",children:f}),i&&y(h)]}),e&&/* @__PURE__ */s("div",{className:"es-field-ctl",children:y(u)}),x?/* @__PURE__ */s("p",{className:"es-field-hint",children:x}):null,N]})}const H=c,M=void 0!==u||void 0===N&&null==h,O=null==u||""===u,V=y?"text-gray-500":"text-gray-800",q=O?"text-gray-400":y?"text-gray-500":"text-gray-900",z=`${H.text} font-medium ${V}`,B=v?/* @__PURE__ */s("label",{htmlFor:v,id:g,className:z,children:l}):/* @__PURE__ */s("span",{id:g,className:z,children:l}),C=/* @__PURE__ */s(n.Provider,{value:g,children:/* @__PURE__ */s(a.Provider,{value:"auto"===w,children:O?b:u})}),D=[$?"border-t border-line-subtle first:border-t-0":"",H.pad,F].filter(Boolean).join(" "),E=null!=N&&!1!==N&&/* @__PURE__ */s("div",{className:`${H.bodyTop} border-t border-line-subtle ${H.bodyPad}`,children:N});/* @__PURE__ */
7
7
  return r("div",W?{className:D,children:[
8
8
  /* @__PURE__ */r("div",{"data-setting-line":"",className:"flex flex-wrap items-center justify-between gap-x-2 gap-y-2",children:[
9
9
  /* @__PURE__ */s("div",{className:"flex-1 basis-0",children:/* @__PURE__ */r("div",{className:`flex min-w-0 items-center gap-2 ${V}`,children:[null!=o&&/* @__PURE__ */s("span",{"aria-hidden":"true",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:o}),B,T]})}),
@@ -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};