efficient-shell 8.25.0 → 8.30.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 (103) hide show
  1. package/README.md +17 -1
  2. package/dist/{Browser-RJEKM63G.js → Browser-5DL5WHEM.js} +13 -13
  3. package/dist/{Calculator-OFKUHJMM.js → Calculator-WW7WTG43.js} +22 -22
  4. package/dist/{CurrencyConverter-LUDRYE35.js → CurrencyConverter-XBC732QI.js} +5 -5
  5. package/dist/{Documents-JBPK256V.js → Documents-7MFHD73Z.js} +4 -4
  6. package/dist/{Files-CWO6JJRY.js → Files-4DKRC3S2.js} +87 -87
  7. package/dist/{Notepad-P32DNQV3.js → Notepad-BCK4LMG2.js} +9 -9
  8. package/dist/{PomodoroTimer-773FYTGF.js → PomodoroTimer-KH4PYCYQ.js} +68 -68
  9. package/dist/{Preview-C56RWJL7.js → Preview-FP6XMPQR.js} +22 -22
  10. package/dist/{Spreadsheet-F3UZ7I6T.js → Spreadsheet-FSDGQCKT.js} +13 -13
  11. package/dist/{Stock-US3UN5TD.js → Stock-M4EEWA57.js} +3 -3
  12. package/dist/{Weather-TOY4CXLT.js → Weather-WLAS7FBY.js} +15 -15
  13. package/dist/{WorldClock-6JV67SYH.js → WorldClock-WRD7DV2S.js} +6 -6
  14. package/dist/ai/index.d.ts +38 -3
  15. package/dist/ai/index.js +37 -36
  16. package/dist/ai.css +1 -1
  17. package/dist/apps/index.d.ts +6 -2
  18. package/dist/apps/index.js +1 -1
  19. package/dist/bin/media-host-check.js +1 -1
  20. package/dist/bin/ui-check.js +1 -1
  21. package/dist/charts/BoxPlotChart.js +1 -1
  22. package/dist/charts/CandlestickChart.js +1 -1
  23. package/dist/charts/CartesianPlot.js +1 -1
  24. package/dist/charts/ChordChart.js +1 -1
  25. package/dist/charts/ColumnChart.js +1 -1
  26. package/dist/charts/HeatmapChart.js +1 -1
  27. package/dist/charts/HistogramChart.js +1 -1
  28. package/dist/charts/RadarChart.js +1 -1
  29. package/dist/charts/RangeChart.js +1 -1
  30. package/dist/charts/SankeyChart.js +1 -1
  31. package/dist/charts/ScatterChart.js +1 -1
  32. package/dist/charts/SpecChart.js +1 -1
  33. package/dist/charts/SunburstChart.js +1 -1
  34. package/dist/charts/TimeSeriesChart.js +1 -1
  35. package/dist/charts/TreemapChart.js +1 -1
  36. package/dist/charts/WaterfallChart.js +1 -1
  37. package/dist/chunk-24AL3CDS.js +1 -0
  38. package/dist/{chunk-VV37BGSY.js → chunk-2OLSY4GE.js} +12 -12
  39. package/dist/{chunk-PPFMXLEX.js → chunk-2RBWQVDC.js} +8 -8
  40. package/dist/{chunk-IFLIGOSU.js → chunk-3H74IBFS.js} +2 -2
  41. package/dist/{chunk-H33Z4ZIY.js → chunk-3WC6ITJ3.js} +6 -6
  42. package/dist/{chunk-7IMJJT2K.js → chunk-3ZRZWOFZ.js} +1 -1
  43. package/dist/{chunk-K4BEWZBI.js → chunk-6CNFVUT6.js} +1 -1
  44. package/dist/{chunk-IFDW5QW6.js → chunk-BIYL7CEI.js} +2 -2
  45. package/dist/chunk-CUZQVBPC.js +1 -0
  46. package/dist/chunk-DPDA3AJL.js +1 -0
  47. package/dist/{chunk-IYZO6ADE.js → chunk-E6ZXYTTQ.js} +1 -1
  48. package/dist/{chunk-37CCKGHU.js → chunk-EYX6KLCZ.js} +1 -1
  49. package/dist/{chunk-ZNCU3UIW.js → chunk-FRPNTDP4.js} +4 -4
  50. package/dist/{chunk-ATX4N3L4.js → chunk-I62MCTYI.js} +4 -4
  51. package/dist/{chunk-FOLZVO2Z.js → chunk-KWMMIOHD.js} +1 -1
  52. package/dist/{chunk-JUGPTBMS.js → chunk-LBLV64XG.js} +1 -1
  53. package/dist/{chunk-WSPO4N72.js → chunk-OSA24YH6.js} +14 -14
  54. package/dist/{chunk-I4VD5D43.js → chunk-RSO67DWS.js} +4 -4
  55. package/dist/chunk-S6OB6HJB.js +1 -0
  56. package/dist/{chunk-BKZGI76S.js → chunk-TFMC2WAS.js} +1 -1
  57. package/dist/chunk-V3UIAX5G.js +21 -0
  58. package/dist/{chunk-QR6V44P5.js → chunk-VEO34YZK.js} +1 -1
  59. package/dist/{chunk-ETF7LAYZ.js → chunk-W5M6P4DZ.js} +5 -5
  60. package/dist/{chunk-WISGY2OI.js → chunk-WPTG7ZC5.js} +20 -20
  61. package/dist/chunk-WZNGOA4Z.js +1 -0
  62. package/dist/{chunk-2C6IG7LG.js → chunk-Z2YGQBLZ.js} +1 -1
  63. package/dist/chunk-Z37R2OCE.js +10 -0
  64. package/dist/{chunk-ZNXBKFV7.js → chunk-ZOSIPTXM.js} +5 -5
  65. package/dist/format/index.d.ts +3 -0
  66. package/dist/format/index.js +1 -1
  67. package/dist/forms/BorderInput.js +1 -1
  68. package/dist/forms/ColorPicker.js +1 -1
  69. package/dist/forms/color.d.ts +35 -1
  70. package/dist/forms/color.js +1 -1
  71. package/dist/hooks/useTheme.js +1 -1
  72. package/dist/icons/efficient-glyphs.js +1 -1
  73. package/dist/icons/efficient-looks.js +1 -1
  74. package/dist/icons/efficient.js +1 -1
  75. package/dist/icons/looks/map.js +1 -1
  76. package/dist/icons/sets.js +1 -1
  77. package/dist/index.d.ts +4 -2
  78. package/dist/index.js +140 -140
  79. package/dist/map-site.css +43 -0
  80. package/dist/shell/EditableGrid.js +1 -1
  81. package/dist/shell/HelpCenter.js +1 -1
  82. package/dist/shell/Markdown.d.ts +26 -2
  83. package/dist/shell/Markdown.js +1 -1
  84. package/dist/shell/TopNav.d.ts +3 -1
  85. package/dist/shell/TopNav.js +1 -1
  86. package/dist/telemetry/index.js +1 -1
  87. package/dist/templates/DashboardTemplate.js +1 -1
  88. package/dist/ui/index.d.ts +4 -2
  89. package/dist/ui/index.js +1 -1
  90. package/dist/utils/escapeHtml.d.ts +14 -0
  91. package/dist/utils/escapeHtml.js +1 -0
  92. package/dist/utils/slugify.d.ts +16 -0
  93. package/dist/utils/slugify.js +1 -0
  94. package/dist/version.js +1 -1
  95. package/package.json +1 -1
  96. package/dist/chunk-4DAN4Q6P.js +0 -21
  97. package/dist/chunk-4LXH6DCN.js +0 -1
  98. package/dist/chunk-BF7NTCLU.js +0 -1
  99. package/dist/chunk-H245LLX4.js +0 -1
  100. package/dist/chunk-KBGC53FI.js +0 -1
  101. package/dist/chunk-Q2YDR6GF.js +0 -7
  102. /package/dist/{chunk-A5ALFLWZ.js → chunk-2HDDCXTW.js} +0 -0
  103. /package/dist/{chunk-BR22X7E5.js → chunk-G6DKCCWH.js} +0 -0
@@ -1,16 +1,16 @@
1
- import{parseHexColor as e,hexToHsv as r,hsvToHex as a,hexReadout as n,HUE_GRADIENT as o,HEX_MAX_LENGTH as t,svFromPoint as l,hueFromPoint as i}from"./chunk-H245LLX4.js";import{Popover as s}from"./chunk-RNBM5JZI.js";import{InputNumber_default as c}from"./chunk-4SQNLU2Q.js";import{InSettingRowContext as u}from"./chunk-E4Z5OXBI.js";import{inputClasses as d}from"./chunk-JFSYWEHD.js";import{Tooltip as h}from"./chunk-22S6LG6D.js";import{useShellStrings as g}from"./chunk-E6UCGCOC.js";import{forwardRef as p,useState as b,useRef as m,useEffect as f,useId as v}from"react";import{jsx as w,jsxs as x}from"react/jsx-runtime";var y={sm:"h-6 w-6",md:"h-8 w-8",lg:"h-10 w-10"},k={backgroundImage:"conic-gradient(var(--line-strong) 25%, var(--surface) 0 50%, var(--line-strong) 0 75%, var(--surface) 0)",backgroundSize:"8px 8px"};function C(e){return null==e||Number.isNaN(e)?100:Math.round(Math.min(100,Math.max(0,e)))}function N(e,r){if(!e)return k;const a=C(r);if(a>=100)return{background:e};const n=`color-mix(in srgb, ${e} ${a}%, transparent)`;return{backgroundImage:`linear-gradient(${n}, ${n}), ${k.backgroundImage}`,backgroundSize:`auto, ${k.backgroundSize}`}}function $({size:e="md",selected:r=!1,className:a=""}={}){return["relative inline-flex shrink-0 overflow-hidden rounded-md p-0 transition-shadow","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]","disabled:cursor-not-allowed disabled:opacity-60",r?"border-2 border-blue-500":"border border-gray-300 hover:shadow-sm",y[e],a].filter(Boolean).join(" ")}var z=p(function({color:e,size:r="md",selected:a,className:n,type:o="button",...t},l){/* @__PURE__ */
2
- return w("button",{ref:l,type:o,"aria-pressed":a,className:$({size:r,selected:a,className:n}),...t,children:/* @__PURE__ */w("span",{"aria-hidden":"true",className:"absolute inset-0",style:N(e)})})}),D=(e,r,a)=>Math.min(a,Math.max(r,e)),I=e=>"string"==typeof e?{value:e}:e;function M(e,r,a){const n=a?.1:.01,o={ArrowLeft:[-n,0],ArrowRight:[n,0],ArrowDown:[0,-n],ArrowUp:[0,n]}[r];return o?{...e,s:D(e.s+o[0],0,1),v:D(e.v+o[1],0,1)}:null}function P(e,r,a){const n=a?10:1;switch(r){case"ArrowLeft":case"ArrowDown":return D(e-n,0,359);case"ArrowRight":case"ArrowUp":return D(e+n,0,359);case"PageDown":return D(e-10,0,359);case"PageUp":return D(e+10,0,359);case"Home":return 0;case"End":return 359;default:return null}}var A={boxShadow:"0 0 0 2px white, 0 0 0 3px color-mix(in srgb, black 35%, transparent)"};function j(e,r,a){const n=a?10:1;switch(r){case"ArrowLeft":case"ArrowDown":return D(e-n,0,100);case"ArrowRight":case"ArrowUp":return D(e+n,0,100);case"PageDown":return D(e-10,0,100);case"PageUp":return D(e+10,0,100);case"Home":return 0;case"End":return 100;default:return null}}function S({value:t,onChange:s,label:c,presets:d,clearable:p=!1,fallback:v,dragWrites:y="live",disabled:$=!1,opacity:D,onOpacityChange:S,onClose:L,id:K,className:T=""}){const E=g().color,O=C(D),R=e=>{const r=C(e);$||r===O||S?.(r)},H=e=>{const r=e.currentTarget.getBoundingClientRect();return r.width>0?(e.clientX-r.left)/r.width*100:O},X=e(v??""),[W,q]=b(()=>r(t||X||"")),F=m(t);f(()=>{t!==F.current&&(F.current=t,t?q(r(t)):X&&q(r(X)))},[t]);const G=e=>{$||e===t||(F.current=e,s(e))},J=a=>{const n=e(a);n&&(q(r(n)),G(n))},Q=e=>{q(e),G(a(e))},[Y,Z]=b(!1),V=m(W);V.current=W;const _=e=>({onPointerDown:r=>{if($||0!==r.button)return;r.currentTarget.setPointerCapture?.(r.pointerId),r.currentTarget.focus({preventScroll:!0});const a=e(r,V.current);"end"===y?(Z(!0),q(a)):Q(a)},onPointerMove:r=>{if($||!(1&r.buttons))return;const a=e(r,V.current);"end"===y?q(a):Q(a)},onPointerUp:r=>{"end"===y&&Y&&(Z(!1),Q(e(r,V.current)))}}),ee=_((e,r)=>({...r,...l(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect())})),re=_((e,r)=>({...r,h:i(e.clientX,e.currentTarget.getBoundingClientRect())})),ae=Y?a(W):t,ne=e=>`${Math.round(100*e)}%`,oe=(d??[]).map(I),te=e(t),le=ae||X||"";
1
+ import{Popover as e}from"./chunk-RNBM5JZI.js";import{InputNumber_default as r}from"./chunk-4SQNLU2Q.js";import{InSettingRowContext as a}from"./chunk-E4Z5OXBI.js";import{parseHexColor as n,hexToHsv as o,hsvToHex as t,hexReadout as l,HUE_GRADIENT as i,HEX_MAX_LENGTH as s,svFromPoint as c,hueFromPoint as u}from"./chunk-S6OB6HJB.js";import{inputClasses as d}from"./chunk-JFSYWEHD.js";import{Tooltip as h}from"./chunk-22S6LG6D.js";import{useShellStrings as g}from"./chunk-E6UCGCOC.js";import{forwardRef as p,useState as b,useRef as m,useEffect as f,useId as v}from"react";import{jsx as w,jsxs as x}from"react/jsx-runtime";var y={sm:"h-6 w-6",md:"h-8 w-8",lg:"h-10 w-10"},k={backgroundImage:"conic-gradient(var(--line-strong) 25%, var(--surface) 0 50%, var(--line-strong) 0 75%, var(--surface) 0)",backgroundSize:"8px 8px"};function C(e){return null==e||Number.isNaN(e)?100:Math.round(Math.min(100,Math.max(0,e)))}function N(e,r){if(!e)return k;const a=C(r);if(a>=100)return{background:e};const n=`color-mix(in srgb, ${e} ${a}%, transparent)`;return{backgroundImage:`linear-gradient(${n}, ${n}), ${k.backgroundImage}`,backgroundSize:`auto, ${k.backgroundSize}`}}function $({size:e="md",selected:r=!1,className:a=""}={}){return["relative inline-flex shrink-0 overflow-hidden rounded-md p-0 transition-shadow","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]","disabled:cursor-not-allowed disabled:opacity-60",r?"border-2 border-blue-500":"border border-gray-300 hover:shadow-sm",y[e],a].filter(Boolean).join(" ")}var z=p(function({color:e,size:r="md",selected:a,className:n,type:o="button",...t},l){/* @__PURE__ */
2
+ return w("button",{ref:l,type:o,"aria-pressed":a,className:$({size:r,selected:a,className:n}),...t,children:/* @__PURE__ */w("span",{"aria-hidden":"true",className:"absolute inset-0",style:N(e)})})}),D=(e,r,a)=>Math.min(a,Math.max(r,e)),I=e=>"string"==typeof e?{value:e}:e;function M(e,r,a){const n=a?.1:.01,o={ArrowLeft:[-n,0],ArrowRight:[n,0],ArrowDown:[0,-n],ArrowUp:[0,n]}[r];return o?{...e,s:D(e.s+o[0],0,1),v:D(e.v+o[1],0,1)}:null}function P(e,r,a){const n=a?10:1;switch(r){case"ArrowLeft":case"ArrowDown":return D(e-n,0,359);case"ArrowRight":case"ArrowUp":return D(e+n,0,359);case"PageDown":return D(e-10,0,359);case"PageUp":return D(e+10,0,359);case"Home":return 0;case"End":return 359;default:return null}}var A={boxShadow:"0 0 0 2px white, 0 0 0 3px color-mix(in srgb, black 35%, transparent)"};function S(e,r,a){const n=a?10:1;switch(r){case"ArrowLeft":case"ArrowDown":return D(e-n,0,100);case"ArrowRight":case"ArrowUp":return D(e+n,0,100);case"PageDown":return D(e-10,0,100);case"PageUp":return D(e+10,0,100);case"Home":return 0;case"End":return 100;default:return null}}function j({value:e,onChange:r,label:s,presets:d,clearable:p=!1,fallback:v,dragWrites:y="live",disabled:$=!1,opacity:D,onOpacityChange:j,onClose:B,id:K,className:O=""}){const E=g().color,L=C(D),R=e=>{const r=C(e);$||r===L||j?.(r)},H=e=>{const r=e.currentTarget.getBoundingClientRect();return r.width>0?(e.clientX-r.left)/r.width*100:L},W=n(v??""),[X,q]=b(()=>o(e||W||"")),J=m(e);f(()=>{e!==J.current&&(J.current=e,e?q(o(e)):W&&q(o(W)))},[e]);const F=a=>{$||a===e||(J.current=a,r(a))},G=e=>{const r=n(e);r&&(q(o(r)),F(r))},Q=e=>{q(e),F(t(e))},[Y,Z]=b(!1),V=m(X);V.current=X;const _=e=>({onPointerDown:r=>{if($||0!==r.button)return;r.currentTarget.setPointerCapture?.(r.pointerId),r.currentTarget.focus({preventScroll:!0});const a=e(r,V.current);"end"===y?(Z(!0),q(a)):Q(a)},onPointerMove:r=>{if($||!(1&r.buttons))return;const a=e(r,V.current);"end"===y?q(a):Q(a)},onPointerUp:r=>{"end"===y&&Y&&(Z(!1),Q(e(r,V.current)))}}),ee=_((e,r)=>({...r,...c(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect())})),re=_((e,r)=>({...r,h:u(e.clientX,e.currentTarget.getBoundingClientRect())})),ae=Y?t(X):e,ne=e=>`${Math.round(100*e)}%`,oe=(d??[]).map(I),te=n(e),le=ae||W||"";
3
3
  /* @__PURE__ */
4
- return w(u.Provider,{value:!1,children:/* @__PURE__ */x("div",{id:K,className:`flex w-56 flex-col gap-3 ${$?"opacity-60":""} ${T}`.trim(),onKeyDown:e=>{"Escape"===e.key&&L&&(e.preventDefault(),e.stopPropagation(),L())},children:[(oe.length>0||p)&&/* @__PURE__ */x("div",{role:"group","aria-label":E.presets,className:"flex flex-wrap gap-2",children:[p&&/* @__PURE__ */w(h,{content:E.clear,children:/* @__PURE__ */w(z,{color:"",size:"sm","aria-label":E.clear,selected:""===t,disabled:$,onClick:()=>{$||""===t||(F.current="",s(""))}})}),oe.map(r=>{const a=e(r.value),o=r.label?`${r.label} · ${n(a??r.value)}`:n(a??r.value);/* @__PURE__ */
5
- return w(h,{content:o,children:/* @__PURE__ */w(z,{color:a??r.value,size:"sm","aria-label":o,selected:null!==a&&a===te,disabled:$,onClick:()=>J(r.value)})},`${r.label??""}:${r.value}`)})]}),
6
- /* @__PURE__ */w("div",{role:"slider",tabIndex:$?-1:0,"aria-label":E.square,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(100*W.v),"aria-valuetext":E.squareValue(Math.round(100*W.s),Math.round(100*W.v)),"aria-disabled":$||void 0,"data-color-square":"",onKeyDown:e=>{if($)return;const r=M(W,e.key,e.shiftKey);r&&(e.preventDefault(),Q(r))},...ee,className:"relative h-36 w-full cursor-crosshair touch-none rounded-md rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",style:{backgroundColor:a({h:W.h,s:1,v:1}),backgroundImage:"linear-gradient(to top, black, transparent), linear-gradient(to right, white, transparent)"},children:/* @__PURE__ */w("span",{"aria-hidden":"true",className:"pointer-events-none absolute h-3 w-3 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{left:ne(W.s),top:ne(1-W.v),...A}})}),
7
- /* @__PURE__ */w("div",{role:"slider",tabIndex:$?-1:0,"aria-label":E.hue,"aria-valuemin":0,"aria-valuemax":359,"aria-valuenow":Math.round(W.h),"aria-orientation":"horizontal","aria-disabled":$||void 0,"data-color-hue":"",onKeyDown:e=>{if($)return;const r=P(W.h,e.key,e.shiftKey);null!==r&&(e.preventDefault(),Q({...W,h:r}))},...re,className:"relative h-3 w-full cursor-pointer touch-none rounded-full rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",style:{backgroundImage:o},children:/* @__PURE__ */w("span",{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 h-3.5 w-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{left:W.h/360*100+"%",background:a({h:W.h,s:1,v:1}),...A}})}),S&&/* @__PURE__ */w("div",{role:"slider",tabIndex:$?-1:0,"aria-label":E.opacity(c),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":O,"aria-valuetext":`${O}%`,"aria-orientation":"horizontal","aria-disabled":$||void 0,"data-color-opacity":"",onKeyDown:e=>{if($)return;const r=j(O,e.key,e.shiftKey);null!==r&&(e.preventDefault(),R(r))},onPointerDown:e=>{$||0!==e.button||(e.currentTarget.setPointerCapture?.(e.pointerId),e.currentTarget.focus({preventScroll:!0}),R(H(e)))},onPointerMove:e=>{!$&&1&e.buttons&&R(H(e))},className:"relative h-3 w-full cursor-pointer touch-none rounded-full rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",style:{backgroundImage:`linear-gradient(to right, transparent, ${le||"black"}), ${k.backgroundImage}`,backgroundSize:`auto, ${k.backgroundSize}`},children:/* @__PURE__ */w("span",{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 h-3.5 w-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{left:`${O}%`,...N(le||"black",O),...A}})}),
4
+ return w(a.Provider,{value:!1,children:/* @__PURE__ */x("div",{id:K,className:`flex w-56 flex-col gap-3 ${$?"opacity-60":""} ${O}`.trim(),onKeyDown:e=>{"Escape"===e.key&&B&&(e.preventDefault(),e.stopPropagation(),B())},children:[(oe.length>0||p)&&/* @__PURE__ */x("div",{role:"group","aria-label":E.presets,className:"flex flex-wrap gap-2",children:[p&&/* @__PURE__ */w(h,{content:E.clear,children:/* @__PURE__ */w(z,{color:"",size:"sm","aria-label":E.clear,selected:""===e,disabled:$,onClick:()=>{$||""===e||(J.current="",r(""))}})}),oe.map(e=>{const r=n(e.value),a=e.label?`${e.label} · ${l(r??e.value)}`:l(r??e.value);/* @__PURE__ */
5
+ return w(h,{content:a,children:/* @__PURE__ */w(z,{color:r??e.value,size:"sm","aria-label":a,selected:null!==r&&r===te,disabled:$,onClick:()=>G(e.value)})},`${e.label??""}:${e.value}`)})]}),
6
+ /* @__PURE__ */w("div",{role:"slider",tabIndex:$?-1:0,"aria-label":E.square,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(100*X.v),"aria-valuetext":E.squareValue(Math.round(100*X.s),Math.round(100*X.v)),"aria-disabled":$||void 0,"data-color-square":"",onKeyDown:e=>{if($)return;const r=M(X,e.key,e.shiftKey);r&&(e.preventDefault(),Q(r))},...ee,className:"relative h-36 w-full cursor-crosshair touch-none rounded-md rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",style:{backgroundColor:t({h:X.h,s:1,v:1}),backgroundImage:"linear-gradient(to top, black, transparent), linear-gradient(to right, white, transparent)"},children:/* @__PURE__ */w("span",{"aria-hidden":"true",className:"pointer-events-none absolute h-3 w-3 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{left:ne(X.s),top:ne(1-X.v),...A}})}),
7
+ /* @__PURE__ */w("div",{role:"slider",tabIndex:$?-1:0,"aria-label":E.hue,"aria-valuemin":0,"aria-valuemax":359,"aria-valuenow":Math.round(X.h),"aria-orientation":"horizontal","aria-disabled":$||void 0,"data-color-hue":"",onKeyDown:e=>{if($)return;const r=P(X.h,e.key,e.shiftKey);null!==r&&(e.preventDefault(),Q({...X,h:r}))},...re,className:"relative h-3 w-full cursor-pointer touch-none rounded-full rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",style:{backgroundImage:i},children:/* @__PURE__ */w("span",{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 h-3.5 w-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{left:X.h/360*100+"%",background:t({h:X.h,s:1,v:1}),...A}})}),j&&/* @__PURE__ */w("div",{role:"slider",tabIndex:$?-1:0,"aria-label":E.opacity(s),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":L,"aria-valuetext":`${L}%`,"aria-orientation":"horizontal","aria-disabled":$||void 0,"data-color-opacity":"",onKeyDown:e=>{if($)return;const r=S(L,e.key,e.shiftKey);null!==r&&(e.preventDefault(),R(r))},onPointerDown:e=>{$||0!==e.button||(e.currentTarget.setPointerCapture?.(e.pointerId),e.currentTarget.focus({preventScroll:!0}),R(H(e)))},onPointerMove:e=>{!$&&1&e.buttons&&R(H(e))},className:"relative h-3 w-full cursor-pointer touch-none rounded-full rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",style:{backgroundImage:`linear-gradient(to right, transparent, ${le||"black"}), ${k.backgroundImage}`,backgroundSize:`auto, ${k.backgroundSize}`},children:/* @__PURE__ */w("span",{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 h-3.5 w-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{left:`${L}%`,...N(le||"black",L),...A}})}),
8
8
  /* @__PURE__ */x("div",{className:"flex items-center gap-2",children:[
9
- /* @__PURE__ */w("span",{"aria-hidden":"true",className:"relative h-8 w-8 shrink-0 overflow-hidden rounded-md border border-gray-300",style:N(le,S?O:null)}),
10
- /* @__PURE__ */w(U,{value:ae,placeholder:!t&&X?n(X):void 0,onChange:J,label:E.hex(c),disabled:$}),S&&/* @__PURE__ */w(B,{value:O,onChange:R,label:E.opacity(c),disabled:$})]})]})})}var L={sm:"w-[calc(7ch+1rem+4px)] min-w-[calc(7ch+1rem+4px)]",md:"w-[calc(7ch+1.5rem+4px)] min-w-[calc(7ch+1.5rem+4px)]",lg:"w-[calc(7ch+2rem+4px)] min-w-[calc(7ch+2rem+4px)]"},K={sm:"h-6",md:"h-8",lg:"h-10"},T=["block w-[calc(7ch+0.5rem+4px)] min-w-[calc(7ch+0.5rem+4px)] flex-none rounded-(--radius-control)","border border-transparent bg-transparent px-1 text-2xs font-mono uppercase","text-gray-800 placeholder:text-gray-400 hover:border-gray-300","focus:border-blue-400 focus:bg-(--surface) rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring)]","disabled:cursor-not-allowed disabled:opacity-60"].join(" ");function U({value:r,onChange:a,label:o,placeholder:l,disabled:i,id:s,size:c="md",look:u="box",className:h=""}){const[g,p]=b(null),m="text"===u?`${T} ${K[c]} ${h}`.trim():d({size:c,className:`${L[c]} flex-1 font-mono uppercase ${h}`.trim()}).replace(/(^| )w-full( |$)/," ");/* @__PURE__ */
11
- return w("input",{id:s,type:"text",value:g??(r?n(r):""),"aria-label":o,placeholder:l,maxLength:t,spellCheck:!1,autoComplete:"off",disabled:i,onChange:n=>{p(n.target.value);const o=e(n.target.value);null!==o&&o!==r&&a(o)},onFocus:e=>e.currentTarget.select(),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),p(null))},onBlur:()=>p(null),"data-hex-look":u,className:m})}function B({value:e,onChange:r,label:a,disabled:n,size:o="md"}){/* @__PURE__ */
12
- return w("div",{"data-color-opacity-box":"",className:"w-20 shrink-0",children:/* @__PURE__ */w(c,{value:e,onChange:e=>{null!==e&&r(e)},min:0,max:100,precision:0,suffix:"%",size:o,"aria-label":a,disabled:n})})}function E({value:r,onChange:a,label:o,presets:t,clearable:l,fallback:i,dragWrites:c,disabled:u,id:d,showHexInput:h=!1,opacity:p,onOpacityChange:b,size:m="md",align:f="start",open:y,onOpenChange:k,className:z=""}){const D=g().color,I=C(p),M=v(),P=e(i??""),A=r||P||"",j=r?n(r):P?n(P):D.none;
9
+ /* @__PURE__ */w("span",{"aria-hidden":"true",className:"relative h-8 w-8 shrink-0 overflow-hidden rounded-md border border-gray-300",style:N(le,j?L:null)}),
10
+ /* @__PURE__ */w(T,{value:ae,placeholder:!e&&W?l(W):void 0,onChange:G,label:E.hex(s),disabled:$}),j&&/* @__PURE__ */w(U,{value:L,onChange:R,label:E.opacity(s),disabled:$})]})]})})}var B={sm:"w-[calc(7ch+1rem+4px)] min-w-[calc(7ch+1rem+4px)]",md:"w-[calc(7ch+1.5rem+4px)] min-w-[calc(7ch+1.5rem+4px)]",lg:"w-[calc(7ch+2rem+4px)] min-w-[calc(7ch+2rem+4px)]"},K={sm:"h-6",md:"h-8",lg:"h-10"},O=["block w-[calc(7ch+0.5rem+4px)] min-w-[calc(7ch+0.5rem+4px)] flex-none rounded-(--radius-control)","border border-transparent bg-transparent px-1 text-2xs font-mono uppercase","text-gray-800 placeholder:text-gray-400 hover:border-gray-300","focus:border-blue-400 focus:bg-(--surface) rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring)]","disabled:cursor-not-allowed disabled:opacity-60"].join(" ");function T({value:e,onChange:r,label:a,placeholder:o,disabled:t,id:i,size:c="md",look:u="box",className:h=""}){const[g,p]=b(null),m="text"===u?`${O} ${K[c]} ${h}`.trim():d({size:c,className:`${B[c]} flex-1 font-mono uppercase ${h}`.trim()}).replace(/(^| )w-full( |$)/," ");/* @__PURE__ */
11
+ return w("input",{id:i,type:"text",value:g??(e?l(e):""),"aria-label":a,placeholder:o,maxLength:s,spellCheck:!1,autoComplete:"off",disabled:t,onChange:a=>{p(a.target.value);const o=n(a.target.value);null!==o&&o!==e&&r(o)},onFocus:e=>e.currentTarget.select(),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),p(null))},onBlur:()=>p(null),"data-hex-look":u,className:m})}function U({value:e,onChange:a,label:n,disabled:o,size:t="md"}){/* @__PURE__ */
12
+ return w("div",{"data-color-opacity-box":"",className:"w-20 shrink-0",children:/* @__PURE__ */w(r,{value:e,onChange:e=>{null!==e&&a(e)},min:0,max:100,precision:0,suffix:"%",size:t,"aria-label":n,disabled:o})})}function E({value:r,onChange:a,label:o,presets:t,clearable:i,fallback:s,dragWrites:c,disabled:u,id:d,showHexInput:h=!1,opacity:p,onOpacityChange:b,size:m="md",align:f="start",open:y,onOpenChange:k,className:z=""}){const D=g().color,I=C(p),M=v(),P=n(s??""),A=r||P||"",S=r?l(r):P?l(P):D.none;
13
13
  /* @__PURE__ */
14
14
  return x("div",{className:`inline-flex items-center ${b?"flex-wrap justify-end gap-1":h?"gap-1":"gap-2"} ${z}`.trim(),children:[
15
- /* @__PURE__ */w(s,{id:d,trigger:/* @__PURE__ */w("span",{"aria-hidden":"true",className:"absolute inset-0",style:N(A,b?I:null)}),triggerLabel:D.swatch(o,j),triggerClassName:$({size:m}),"aria-label":D.panel(o),align:f,open:y,onOpenChange:k,disabled:u,children:/* @__PURE__ */w(S,{id:M,value:r,onChange:a,label:o,presets:t,clearable:l,fallback:i,dragWrites:c,disabled:u,opacity:p,onOpacityChange:b})}),h&&
16
- /* @__PURE__ */w(U,{value:r,placeholder:!r&&P?n(P):void 0,onChange:e=>{u||e===r||a(e)},label:D.hex(o),disabled:u,size:m,look:"text"}),b&&/* @__PURE__ */w(B,{value:I,onChange:e=>{u||e===I||b(e)},label:D.opacity(o),disabled:u,size:m})]})}export{E as ColorPicker,S as ColorPickerPanel,z as ColorSwatch,U as HexInput,k as NO_COLOR_FILL,C as clampOpacity,N as colorFill,$ as colorSwatchClasses,P as stepHue,j as stepOpacity,M as stepSquare};
15
+ /* @__PURE__ */w(e,{id:d,trigger:/* @__PURE__ */w("span",{"aria-hidden":"true",className:"absolute inset-0",style:N(A,b?I:null)}),triggerLabel:D.swatch(o,S),triggerClassName:$({size:m}),"aria-label":D.panel(o),align:f,open:y,onOpenChange:k,disabled:u,children:/* @__PURE__ */w(j,{id:M,value:r,onChange:a,label:o,presets:t,clearable:i,fallback:s,dragWrites:c,disabled:u,opacity:p,onOpacityChange:b})}),h&&
16
+ /* @__PURE__ */w(T,{value:r,placeholder:!r&&P?l(P):void 0,onChange:e=>{u||e===r||a(e)},label:D.hex(o),disabled:u,size:m,look:"text"}),b&&/* @__PURE__ */w(U,{value:I,onChange:e=>{u||e===I||b(e)},label:D.opacity(o),disabled:u,size:m})]})}export{E as ColorPicker,j as ColorPickerPanel,z as ColorSwatch,T as HexInput,k as NO_COLOR_FILL,C as clampOpacity,N as colorFill,$ as colorSwatchClasses,P as stepHue,S as stepOpacity,M as stepSquare};
@@ -1,19 +1,19 @@
1
- import{escapeHtml as e}from"./chunk-BR22X7E5.js";import{TH_ONE_LINE as t}from"./chunk-6KO5VTL7.js";import{useBrowserLayoutEffect as n}from"./chunk-D65T4H6J.js";import{useShellStrings as r}from"./chunk-E6UCGCOC.js";import{useRef as o,useState as l,useEffect as c,useCallback as a,useMemo as s}from"react";import{createPortal as i}from"react-dom";import{jsxs as u,jsx as h,Fragment as d}from"react/jsx-runtime";function w(e,t){const n=e[e.length-1];return n&&!n.some(e=>e.trim())?e:[...e,Array(t).fill("")]}function g({text:t,...n}){const r=s(()=>({__html:e(t)}),[t]);/* @__PURE__ */
2
- return h("div",{...n,dangerouslySetInnerHTML:r})}function m({columns:e,data:m,onChange:p,onColumnsChange:f,fixedRows:y=!1,minRows:b=15,maxHeight:v="260px",cellStyles:x,onFocusChange:M,onSelectionChange:D}){const k=o(null),C=r().grid,[E,L]=l(null);c(()=>{M?.(E)},[E,M]);const[$,S]=l({}),z=o(null),[N,A]=l({}),O=o(null),[T,K]=l(null),[R,P]=l(null),[F,I]=l(null),[X,j]=l(null),[H,Y]=l(null),q=o(null);n(()=>{const e=q.current;if(!e||e.row!==H?.row||e.col!==H?.col)return;q.current=null;const t=k.current?.querySelector(`[data-row="${e.row}"][data-col="${e.col}"]`);if(!t)return;t.focus();const n=document.createRange();n.selectNodeContents(t),n.collapse(!1);const r=window.getSelection();r?.removeAllRanges(),r?.addRange(n)},[H]);const[B,W]=l(null),[U,V]=l(null);c(()=>{D?.(B&&U?{anchor:B,end:U}:null)},[B,U,D]);const _=o(!1),[G,J]=l(null),Q=o(!1),Z=o({a:null,e:null});Z.current={a:B,e:U};const ee=B&&U&&(B.row!==U.row||B.col!==U.col),te=[...m];if(!y)for(;te.length<b;)te.push(Array(e.length).fill(""));const ne=a((t,n,r)=>{const o=te.map(e=>[...e]);for(;o.length<=t;)o.push(Array(e.length).fill(""));for(;o[t].length<e.length;)o[t].push("");o[t][n]=r,p(o)},[te,e.length,p]),re=a((e,t,n)=>{if(0!==e.button)return;const r=document.activeElement;if(r?.dataset?.row&&r?.dataset?.col){const e=parseInt(r.dataset.row),t=parseInt(r.dataset.col),n=r.textContent||"";if(n!==(te[e]?.[t]||"")){const r=te.map(e=>[...e]);r[e]&&(r[e][t]=n,p(r))}}_.current=!0,e.shiftKey&&B||W({row:t,col:n}),V({row:t,col:n})},[te,p,B]),oe=a((e,t)=>{_.current&&V({row:e,col:t})},[]);c(()=>{const e=()=>{_.current=!1};return window.addEventListener("mouseup",e),()=>window.removeEventListener("mouseup",e)},[]),c(()=>{const e=e=>{if(!e.ctrlKey&&!e.metaKey||"c"!==e.key)return;if(!B||!U)return;const t=window.getSelection();if(t&&t.toString().length>0&&!ee)return;const n=Math.min(B.row,U.row),r=Math.max(B.row,U.row),o=Math.min(B.col,U.col),l=Math.max(B.col,U.col),c=[];for(let e=n;e<=r;e++){const t=[];for(let n=o;n<=l;n++)t.push(te[e]?.[n]||"");c.push(t.join("\t"))}const a=c.join("\n");a&&(e.preventDefault(),navigator.clipboard.writeText(a))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[B,U,te,ee]),c(()=>{const t=t=>{if(!E)return;const n=document.activeElement;if(n?.isContentEditable)return;if(!k.current?.contains(n))return;const r=t.clipboardData?.getData("text/plain");if(!r)return;t.preventDefault();const o=r.split("\n").filter(e=>e).map(e=>e.split("\t")),l=te.map(e=>[...e]);for(let t=0;t<o.length;t++){const n=E.row+t;for(;l.length<=n;)l.push(Array(e.length).fill(""));for(;l[n].length<e.length;)l[n].push("");for(let r=0;r<o[t].length;r++){const c=E.col+r;if(c>=e.length)break;e[c].readOnly||(l[n][c]=o[t][r].trim())}}p(y?l:w(l,e.length)),W({row:E.row,col:E.col}),V({row:Math.min(E.row+o.length-1,l.length-1),col:Math.min(E.col+(o[0]?.length||1)-1,e.length-1)})};return window.addEventListener("paste",t),()=>window.removeEventListener("paste",t)},[E,te,e,p,y]);const le=a((t,n,r)=>{const o=t.clipboardData.getData("text/plain");if(!o)return;const l=o.split("\n").map(e=>e.split("\t"));if(l.length<=1&&l[0]?.length<=1)return;t.preventDefault();const c=te.map(e=>[...e]);for(let t=0;t<l.length;t++){const o=n+t;for(;c.length<=o;)c.push(Array(e.length).fill(""));for(;c[o].length<e.length;)c[o].push("");for(let n=0;n<l[t].length;n++){const a=r+n;if(a>=e.length)break;e[a].readOnly||(c[o][a]=l[t][n].trim())}}p(y?c:w(c,e.length))},[te,e,p,y]),ce=a((t,n,r)=>{let o=n,l=r;if("Tab"===t.key)t.preventDefault(),l=t.shiftKey?r-1:r+1,l>=e.length&&(l=0,o=n+1),l<0&&(l=e.length-1,o=n-1);else if("Enter"===t.key)t.preventDefault(),o=t.shiftKey?n-1:n+1;else if("ArrowDown"===t.key)t.preventDefault(),o=n+1;else if("ArrowUp"===t.key)t.preventDefault(),o=n-1;else if("ArrowLeft"===t.key)t.preventDefault(),l=r-1;else{if("ArrowRight"!==t.key){if("Delete"===t.key||"Backspace"===t.key){const o=t.target;if(o.isContentEditable)return void(o.textContent&&window.getSelection()?.toString()===o.textContent&&(t.preventDefault(),ne(n,r,"")));if(t.preventDefault(),B&&U){const t=Math.min(B.row,U.row),n=Math.max(B.row,U.row),r=Math.min(B.col,U.col),o=Math.max(B.col,U.col),l=te.map(e=>[...e]);for(let c=t;c<=n;c++)for(let t=r;t<=o;t++)l[c]&&!e[t]?.readOnly&&(l[c][t]="");p(l)}else ne(n,r,"");return}return}t.preventDefault(),l=r+1}for(;l>=0&&l<e.length&&e[l].readOnly;)l+="Tab"===t.key&&t.shiftKey?-1:1;if(o>=0&&o<te.length&&l>=0&&l<e.length){const e=k.current?.querySelector(`[data-row="${o}"][data-col="${l}"]`);e&&(e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",inline:"nearest"}),L({row:o,col:l}),Y(null),W({row:o,col:l}),V({row:o,col:l}))}},[e,te,te.length,ne,B,U,p]),ae=a(t=>{if(!y&&t>=te.length-2){const t=te.map(e=>[...e]);for(let n=0;n<5;n++)t.push(Array(e.length).fill(""));p(t)}},[y,te,e.length,p]),[se,ie]=l(null);c(()=>{if(!se)return;const e=()=>ie(null);return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e)},[se]);const ue=a(t=>{const n=te.map(e=>[...e]);n.splice(t,0,Array(e.length).fill("")),p(n)},[te,e.length,p]),he=a(e=>{if(te.length<=1)return;const t=te.filter((t,n)=>n!==e);p(t)},[te,p]),de=a(e=>{const t=te.map(t=>{const n=[...t];return n.splice(e,0,""),n});p(t)},[te,p]),we=a(t=>{if(e.length<=1)return;const n=te.map(e=>{const n=[...e];return n.splice(t,1),n});p(n)},[te,e.length,p]),ge=a((e,t)=>{e.preventDefault(),y||ie({x:e.clientX,y:e.clientY,items:[{label:C.insertRowAbove,onClick:()=>{ue(t),ie(null)}},{label:C.insertRowBelow,onClick:()=>{ue(t+1),ie(null)}},{label:C.deleteRow(t+1),onClick:()=>{he(t),ie(null)}}]})},[y,ue,he,C]),me=a((t,n)=>{t.preventDefault(),y||ie({x:t.clientX,y:t.clientY,items:[{label:C.insertColumnLeft,onClick:()=>{de(n),ie(null)}},{label:C.insertColumnRight,onClick:()=>{de(n+1),ie(null)}},{label:C.deleteColumn(String(e[n]?.title||n+1)),onClick:()=>{we(n),ie(null)}}]})},[y,e,de,we,C]),pe=t=>$[t]??e[t]?.width??150;c(()=>{const t=e=>{if(!z.current)return;const t=e.clientX-z.current.startX,n=Math.max(40,z.current.startW+t);S(e=>({...e,[z.current.col]:n}))},n=()=>{if(z.current&&f){const t=e.map((e,t)=>({...e,width:$[t]??e.width}));t[z.current.col]={...t[z.current.col],width:$[z.current.col]??e[z.current.col].width},f(t)}z.current=null,document.body.style.cursor=""};return window.addEventListener("mousemove",t),window.addEventListener("mouseup",n),()=>{window.removeEventListener("mousemove",t),window.removeEventListener("mouseup",n)}},[e,$,f]);const fe=e=>N[e]??28;c(()=>{const e=e=>{if(!O.current)return;const t=e.clientY-O.current.startY,n=Math.max(20,O.current.startH+t);A(e=>({...e,[O.current.row]:n}))},t=()=>{O.current=null,document.body.style.cursor=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[]);const ye=a(t=>{const n=document.createElement("canvas").getContext("2d");if(!n)return;n.font="12px ui-monospace, SFMono-Regular, Menlo, monospace";let r=0;for(const e of te){const o=String(e[t]??"").replace(/<[^>]*>/g,""),l=n.measureText(o).width;l>r&&(r=l)}const o=n.measureText(e[t]?.title??"").width;o>r&&(r=o);const l=Math.max(40,Math.ceil(r+24));if(S(e=>({...e,[t]:l})),f){const n=e.map((e,n)=>({...e,width:n===t?l:$[n]??e.width}));f(n)}},[te,e,$,f]),be=a(e=>{A(t=>{const n={...t};return delete n[e],n})},[]),ve=a(t=>{const{a:n,e:r}=Z.current;if(!n||!r)return;const o=Math.min(n.row,r.row),l=Math.max(n.row,r.row),c=Math.min(n.col,r.col),a=Math.max(n.col,r.col);let s=o,i=l,u=c,h=a;t.row>l?i=t.row:t.row<o&&(s=t.row),t.col>a?h=t.col:t.col<c&&(u=t.col);const d=l-o+1,w=a-c+1,g=te.map(e=>[...e]);for(;g.length<=i;)g.push(Array(e.length).fill(""));for(const e of g)for(;e.length<=h;)e.push("");function m(e){const t=e.map(e=>parseFloat(e));if(t.length<2||t.some(e=>Number.isNaN(e)))return null;const n=t[1]-t[0];for(let e=2;e<t.length;e++)if(Math.abs(t[e]-t[e-1]-n)>1e-9)return null;return{step:n}}for(let e=s;e<=i;e++)for(let t=u;t<=h;t++){if(e>=o&&e<=l&&t>=c&&t<=a)continue;let n;if(1===w&&u===c&&h===a){const r=m(Array.from({length:d},(e,n)=>g[o+n]?.[t]??""));if(r){const c=parseFloat(g[l]?.[t]??"0"),a=parseFloat(g[o]?.[t]??"0"),s=e>l?e-l:-(o-e);n=String((e>l?c:a)+r.step*s)}else{const r=((e-o)%d+d)%d;n=g[o+r]?.[t]??""}}else if(1===d&&s===o&&i===l){const r=m(Array.from({length:w},(t,n)=>g[e]?.[c+n]??""));if(r){const o=parseFloat(g[e]?.[a]??"0"),l=parseFloat(g[e]?.[c]??"0"),s=t>a?t-a:-(c-t);n=String((t>a?o:l)+r.step*s)}else{const r=((t-c)%w+w)%w;n=g[e]?.[c+r]??""}}else{const r=((e-o)%d+d)%d,l=((t-c)%w+w)%w;n=g[o+r]?.[c+l]??""}g[e][t]=n}p(g),W({row:s,col:u}),V({row:i,col:h})},[te,e.length,p]);c(()=>{const e=e=>{if(!Q.current)return;const t=document.elementFromPoint(e.clientX,e.clientY),n=t?.closest?.("[data-row][data-col]");if(!n)return;const r=parseInt(n.dataset.row),o=parseInt(n.dataset.col);J({row:r,col:o})},t=()=>{Q.current&&G&&ve(G),Q.current=!1,J(null),document.body.style.cursor=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[G,ve]);const xe=e=>{e.preventDefault(),e.stopPropagation(),Q.current=!0,document.body.style.cursor="crosshair"},Me=o(null),[De,ke]=l(0),[Ce,Ee]=l(800);c(()=>{const e=Me.current;if(!e)return;const t=()=>Ee(e.clientHeight||800);t();const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);const Le=te.length>100,$e=Le?Math.max(0,Math.floor(De/28)-20):0,Se=Le?Math.min(te.length,Math.ceil((De+Ce)/28)+20):te.length,ze=s(()=>te.slice($e,Se),[te,$e,Se]),Ne=28*$e,Ae=28*(te.length-Se),Oe="px-2 h-8 text-left text-xs font-medium text-gray-500 uppercase bg-gray-100 border-b border-r border-gray-200 select-none";/* @__PURE__ */
1
+ import{escapeHtml as e}from"./chunk-G6DKCCWH.js";import{TH_ONE_LINE as t}from"./chunk-6KO5VTL7.js";import{useBrowserLayoutEffect as n}from"./chunk-D65T4H6J.js";import{useShellStrings as r}from"./chunk-E6UCGCOC.js";import{useRef as o,useState as l,useEffect as c,useCallback as a,useMemo as s}from"react";import{createPortal as i}from"react-dom";import{jsxs as u,jsx as h,Fragment as d}from"react/jsx-runtime";function w(e,t){const n=e[e.length-1];return n&&!n.some(e=>e.trim())?e:[...e,Array(t).fill("")]}function g({text:t,...n}){const r=s(()=>({__html:e(t)}),[t]);/* @__PURE__ */
2
+ return h("div",{...n,dangerouslySetInnerHTML:r})}function m({columns:e,data:m,onChange:p,onColumnsChange:f,fixedRows:y=!1,minRows:b=15,maxHeight:v="260px",cellStyles:x,onFocusChange:M,onSelectionChange:D}){const k=o(null),C=r().grid,[E,L]=l(null);c(()=>{M?.(E)},[E,M]);const[$,S]=l({}),z=o(null),[N,A]=l({}),O=o(null),[T,K]=l(null),[R,P]=l(null),[F,H]=l(null),[I,j]=l(null),[X,Y]=l(null),W=o(null);n(()=>{const e=W.current;if(!e||e.row!==X?.row||e.col!==X?.col)return;W.current=null;const t=k.current?.querySelector(`[data-row="${e.row}"][data-col="${e.col}"]`);if(!t)return;t.focus();const n=document.createRange();n.selectNodeContents(t),n.collapse(!1);const r=window.getSelection();r?.removeAllRanges(),r?.addRange(n)},[X]);const[q,B]=l(null),[G,U]=l(null);c(()=>{D?.(q&&G?{anchor:q,end:G}:null)},[q,G,D]);const V=o(!1),[_,J]=l(null),Q=o(!1),Z=o({a:null,e:null});Z.current={a:q,e:G};const ee=q&&G&&(q.row!==G.row||q.col!==G.col),te=[...m];if(!y)for(;te.length<b;)te.push(Array(e.length).fill(""));const ne=a((t,n,r)=>{const o=te.map(e=>[...e]);for(;o.length<=t;)o.push(Array(e.length).fill(""));for(;o[t].length<e.length;)o[t].push("");o[t][n]=r,p(o)},[te,e.length,p]),re=a((e,t,n)=>{if(0!==e.button)return;const r=document.activeElement;if(r?.dataset?.row&&r?.dataset?.col){const e=parseInt(r.dataset.row),t=parseInt(r.dataset.col),n=r.textContent||"";if(n!==(te[e]?.[t]||"")){const r=te.map(e=>[...e]);r[e]&&(r[e][t]=n,p(r))}}V.current=!0,e.shiftKey&&q||B({row:t,col:n}),U({row:t,col:n})},[te,p,q]),oe=a((e,t)=>{V.current&&U({row:e,col:t})},[]);c(()=>{const e=()=>{V.current=!1};return window.addEventListener("mouseup",e),()=>window.removeEventListener("mouseup",e)},[]),c(()=>{const e=e=>{if(!e.ctrlKey&&!e.metaKey||"c"!==e.key)return;if(!q||!G)return;const t=window.getSelection();if(t&&t.toString().length>0&&!ee)return;const n=Math.min(q.row,G.row),r=Math.max(q.row,G.row),o=Math.min(q.col,G.col),l=Math.max(q.col,G.col),c=[];for(let e=n;e<=r;e++){const t=[];for(let n=o;n<=l;n++)t.push(te[e]?.[n]||"");c.push(t.join("\t"))}const a=c.join("\n");a&&(e.preventDefault(),navigator.clipboard.writeText(a))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[q,G,te,ee]),c(()=>{const t=t=>{if(!E)return;const n=document.activeElement;if(n?.isContentEditable)return;if(!k.current?.contains(n))return;const r=t.clipboardData?.getData("text/plain");if(!r)return;t.preventDefault();const o=r.split("\n").filter(e=>e).map(e=>e.split("\t")),l=te.map(e=>[...e]);for(let t=0;t<o.length;t++){const n=E.row+t;for(;l.length<=n;)l.push(Array(e.length).fill(""));for(;l[n].length<e.length;)l[n].push("");for(let r=0;r<o[t].length;r++){const c=E.col+r;if(c>=e.length)break;e[c].readOnly||(l[n][c]=o[t][r].trim())}}p(y?l:w(l,e.length)),B({row:E.row,col:E.col}),U({row:Math.min(E.row+o.length-1,l.length-1),col:Math.min(E.col+(o[0]?.length||1)-1,e.length-1)})};return window.addEventListener("paste",t),()=>window.removeEventListener("paste",t)},[E,te,e,p,y]);const le=a((t,n,r)=>{const o=t.clipboardData.getData("text/plain");if(!o)return;const l=o.split("\n").map(e=>e.split("\t"));if(l.length<=1&&l[0]?.length<=1)return;t.preventDefault();const c=te.map(e=>[...e]);for(let t=0;t<l.length;t++){const o=n+t;for(;c.length<=o;)c.push(Array(e.length).fill(""));for(;c[o].length<e.length;)c[o].push("");for(let n=0;n<l[t].length;n++){const a=r+n;if(a>=e.length)break;e[a].readOnly||(c[o][a]=l[t][n].trim())}}p(y?c:w(c,e.length))},[te,e,p,y]),ce=a((t,n,r)=>{let o=n,l=r;if("Tab"===t.key)t.preventDefault(),l=t.shiftKey?r-1:r+1,l>=e.length&&(l=0,o=n+1),l<0&&(l=e.length-1,o=n-1);else if("Enter"===t.key)t.preventDefault(),o=t.shiftKey?n-1:n+1;else if("ArrowDown"===t.key)t.preventDefault(),o=n+1;else if("ArrowUp"===t.key)t.preventDefault(),o=n-1;else if("ArrowLeft"===t.key)t.preventDefault(),l=r-1;else{if("ArrowRight"!==t.key){if("Delete"===t.key||"Backspace"===t.key){const o=t.target;if(o.isContentEditable)return void(o.textContent&&window.getSelection()?.toString()===o.textContent&&(t.preventDefault(),ne(n,r,"")));if(t.preventDefault(),q&&G){const t=Math.min(q.row,G.row),n=Math.max(q.row,G.row),r=Math.min(q.col,G.col),o=Math.max(q.col,G.col),l=te.map(e=>[...e]);for(let c=t;c<=n;c++)for(let t=r;t<=o;t++)l[c]&&!e[t]?.readOnly&&(l[c][t]="");p(l)}else ne(n,r,"");return}return}t.preventDefault(),l=r+1}for(;l>=0&&l<e.length&&e[l].readOnly;)l+="Tab"===t.key&&t.shiftKey?-1:1;if(o>=0&&o<te.length&&l>=0&&l<e.length){const e=k.current?.querySelector(`[data-row="${o}"][data-col="${l}"]`);e&&(e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",inline:"nearest"}),L({row:o,col:l}),Y(null),B({row:o,col:l}),U({row:o,col:l}))}},[e,te,te.length,ne,q,G,p]),ae=a(t=>{if(!y&&t>=te.length-2){const t=te.map(e=>[...e]);for(let n=0;n<5;n++)t.push(Array(e.length).fill(""));p(t)}},[y,te,e.length,p]),[se,ie]=l(null);c(()=>{if(!se)return;const e=()=>ie(null);return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e)},[se]);const ue=a(t=>{const n=te.map(e=>[...e]);n.splice(t,0,Array(e.length).fill("")),p(n)},[te,e.length,p]),he=a(e=>{if(te.length<=1)return;const t=te.filter((t,n)=>n!==e);p(t)},[te,p]),de=a(e=>{const t=te.map(t=>{const n=[...t];return n.splice(e,0,""),n});p(t)},[te,p]),we=a(t=>{if(e.length<=1)return;const n=te.map(e=>{const n=[...e];return n.splice(t,1),n});p(n)},[te,e.length,p]),ge=a((e,t)=>{e.preventDefault(),y||ie({x:e.clientX,y:e.clientY,items:[{label:C.insertRowAbove,onClick:()=>{ue(t),ie(null)}},{label:C.insertRowBelow,onClick:()=>{ue(t+1),ie(null)}},{label:C.deleteRow(t+1),onClick:()=>{he(t),ie(null)}}]})},[y,ue,he,C]),me=a((t,n)=>{t.preventDefault(),y||ie({x:t.clientX,y:t.clientY,items:[{label:C.insertColumnLeft,onClick:()=>{de(n),ie(null)}},{label:C.insertColumnRight,onClick:()=>{de(n+1),ie(null)}},{label:C.deleteColumn(String(e[n]?.title||n+1)),onClick:()=>{we(n),ie(null)}}]})},[y,e,de,we,C]),pe=t=>$[t]??e[t]?.width??150;c(()=>{const t=e=>{if(!z.current)return;const t=e.clientX-z.current.startX,n=Math.max(40,z.current.startW+t);S(e=>({...e,[z.current.col]:n}))},n=()=>{if(z.current&&f){const t=e.map((e,t)=>({...e,width:$[t]??e.width}));t[z.current.col]={...t[z.current.col],width:$[z.current.col]??e[z.current.col].width},f(t)}z.current=null,document.body.style.cursor=""};return window.addEventListener("mousemove",t),window.addEventListener("mouseup",n),()=>{window.removeEventListener("mousemove",t),window.removeEventListener("mouseup",n)}},[e,$,f]);const fe=e=>N[e]??28;c(()=>{const e=e=>{if(!O.current)return;const t=e.clientY-O.current.startY,n=Math.max(20,O.current.startH+t);A(e=>({...e,[O.current.row]:n}))},t=()=>{O.current=null,document.body.style.cursor=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[]);const ye=a(t=>{const n=document.createElement("canvas").getContext("2d");if(!n)return;n.font="12px ui-monospace, SFMono-Regular, Menlo, monospace";let r=0;for(const e of te){const o=String(e[t]??"").replace(/<[^>]*>/g,""),l=n.measureText(o).width;l>r&&(r=l)}const o=n.measureText(e[t]?.title??"").width;o>r&&(r=o);const l=Math.max(40,Math.ceil(r+24));if(S(e=>({...e,[t]:l})),f){const n=e.map((e,n)=>({...e,width:n===t?l:$[n]??e.width}));f(n)}},[te,e,$,f]),be=a(e=>{A(t=>{const n={...t};return delete n[e],n})},[]),ve=a(t=>{const{a:n,e:r}=Z.current;if(!n||!r)return;const o=Math.min(n.row,r.row),l=Math.max(n.row,r.row),c=Math.min(n.col,r.col),a=Math.max(n.col,r.col);let s=o,i=l,u=c,h=a;t.row>l?i=t.row:t.row<o&&(s=t.row),t.col>a?h=t.col:t.col<c&&(u=t.col);const d=l-o+1,w=a-c+1,g=te.map(e=>[...e]);for(;g.length<=i;)g.push(Array(e.length).fill(""));for(const e of g)for(;e.length<=h;)e.push("");function m(e){const t=e.map(e=>parseFloat(e));if(t.length<2||t.some(e=>Number.isNaN(e)))return null;const n=t[1]-t[0];for(let e=2;e<t.length;e++)if(Math.abs(t[e]-t[e-1]-n)>1e-9)return null;return{step:n}}for(let e=s;e<=i;e++)for(let t=u;t<=h;t++){if(e>=o&&e<=l&&t>=c&&t<=a)continue;let n;if(1===w&&u===c&&h===a){const r=m(Array.from({length:d},(e,n)=>g[o+n]?.[t]??""));if(r){const c=parseFloat(g[l]?.[t]??"0"),a=parseFloat(g[o]?.[t]??"0"),s=e>l?e-l:-(o-e);n=String((e>l?c:a)+r.step*s)}else{const r=((e-o)%d+d)%d;n=g[o+r]?.[t]??""}}else if(1===d&&s===o&&i===l){const r=m(Array.from({length:w},(t,n)=>g[e]?.[c+n]??""));if(r){const o=parseFloat(g[e]?.[a]??"0"),l=parseFloat(g[e]?.[c]??"0"),s=t>a?t-a:-(c-t);n=String((t>a?o:l)+r.step*s)}else{const r=((t-c)%w+w)%w;n=g[e]?.[c+r]??""}}else{const r=((e-o)%d+d)%d,l=((t-c)%w+w)%w;n=g[o+r]?.[c+l]??""}g[e][t]=n}p(g),B({row:s,col:u}),U({row:i,col:h})},[te,e.length,p]);c(()=>{const e=e=>{if(!Q.current)return;const t=document.elementFromPoint(e.clientX,e.clientY),n=t?.closest?.("[data-row][data-col]");if(!n)return;const r=parseInt(n.dataset.row),o=parseInt(n.dataset.col);J({row:r,col:o})},t=()=>{Q.current&&_&&ve(_),Q.current=!1,J(null),document.body.style.cursor=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[_,ve]);const xe=e=>{e.preventDefault(),e.stopPropagation(),Q.current=!0,document.body.style.cursor="crosshair"},Me=o(null),[De,ke]=l(0),[Ce,Ee]=l(800);c(()=>{const e=Me.current;if(!e)return;const t=()=>Ee(e.clientHeight||800);t();const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);const Le=te.length>100,$e=Le?Math.max(0,Math.floor(De/28)-20):0,Se=Le?Math.min(te.length,Math.ceil((De+Ce)/28)+20):te.length,ze=s(()=>te.slice($e,Se),[te,$e,Se]),Ne=28*$e,Ae=28*(te.length-Se),Oe="px-2 h-8 text-left text-xs font-medium text-gray-500 uppercase bg-gray-100 border-b border-r border-gray-200 select-none";/* @__PURE__ */
3
3
  return u("div",{ref:Me,className:"border border-gray-300 rounded overflow-scroll grid-scroll",style:{maxHeight:v,height:v},onScroll:e=>ke(e.target.scrollTop),children:[
4
4
  /* @__PURE__ */u("table",{ref:k,className:"border-collapse select-none",style:{tableLayout:"fixed",minWidth:36+e.reduce((t,n)=>t+pe(e.indexOf(n)),0)},children:[
5
5
  /* @__PURE__ */u("colgroup",{children:[
6
6
  /* @__PURE__ */h("col",{style:{width:36}}),e.map((e,t)=>/* @__PURE__ */h("col",{style:{width:pe(t)}},e.key))]}),
7
7
  /* @__PURE__ */h("thead",{className:"sticky top-0 z-10",children:/* @__PURE__ */u("tr",{children:[
8
- /* @__PURE__ */h("th",{className:`${t} ${Oe} text-center w-9 cursor-pointer hover:bg-gray-200`,onClick:()=>{W({row:0,col:0}),V({row:te.length-1,col:e.length-1})},title:C.selectAll,children:"#"}),e.map((n,r)=>{const o=B&&U&&Math.min(B.col,U.col)<=r&&r<=Math.max(B.col,U.col)&&0===Math.min(B.row,U.row)&&Math.max(B.row,U.row)===te.length-1;/* @__PURE__ */
9
- return u("th",{className:`${t} ${Oe} cursor-pointer hover:bg-gray-200 relative${o?" !bg-blue-200":""}${X===r?" !bg-blue-100":""}`,style:{width:pe(r)},draggable:!0,onDragStart:()=>(e=>I(e))(r),onDragOver:e=>((e,t)=>{e.preventDefault(),j(t)})(e,r),onDrop:()=>(t=>{if(null===F||F===t)return I(null),void j(null);const n=te.map(e=>{const n=[...e],[r]=n.splice(F,1);return n.splice(t,0,r),n});if(p(n),f){const n=[...e],[r]=n.splice(F,1);n.splice(t,0,r),f(n)}I(null),j(null)})(r),onDragEnd:()=>{I(null),j(null)},onClick:e=>{e.shiftKey&&B||W({row:0,col:r}),V({row:te.length-1,col:r})},onContextMenu:e=>me(e,r),children:[n.title,
8
+ /* @__PURE__ */h("th",{className:`${t} ${Oe} text-center w-9 cursor-pointer hover:bg-gray-200`,onClick:()=>{B({row:0,col:0}),U({row:te.length-1,col:e.length-1})},title:C.selectAll,children:"#"}),e.map((n,r)=>{const o=q&&G&&Math.min(q.col,G.col)<=r&&r<=Math.max(q.col,G.col)&&0===Math.min(q.row,G.row)&&Math.max(q.row,G.row)===te.length-1;/* @__PURE__ */
9
+ return u("th",{className:`${t} ${Oe} cursor-pointer hover:bg-gray-200 relative${o?" !bg-blue-200":""}${I===r?" !bg-blue-100":""}`,style:{width:pe(r)},draggable:!0,onDragStart:()=>(e=>H(e))(r),onDragOver:e=>((e,t)=>{e.preventDefault(),j(t)})(e,r),onDrop:()=>(t=>{if(null===F||F===t)return H(null),void j(null);const n=te.map(e=>{const n=[...e],[r]=n.splice(F,1);return n.splice(t,0,r),n});if(p(n),f){const n=[...e],[r]=n.splice(F,1);n.splice(t,0,r),f(n)}H(null),j(null)})(r),onDragEnd:()=>{H(null),j(null)},onClick:e=>{e.shiftKey&&q||B({row:0,col:r}),U({row:te.length-1,col:r})},onContextMenu:e=>me(e,r),children:[n.title,
10
10
  /* @__PURE__ */h("div",{className:"absolute -right-1 top-0 bottom-0 w-2 cursor-col-resize z-20",onMouseDown:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),z.current={col:t,startX:e.clientX,startW:pe(t)},document.body.style.cursor="col-resize"})(e,r),onDoubleClick:e=>{e.stopPropagation(),ye(r)},title:C.resize})]},n.key)})]})}),
11
- /* @__PURE__ */u("tbody",{children:[Ne>0&&/* @__PURE__ */h("tr",{style:{height:Ne}}),ze.map((t,n)=>{const r=$e+n,o=B&&U&&Math.min(B.row,U.row)<=r&&r<=Math.max(B.row,U.row)&&0===Math.min(B.col,U.col)&&Math.max(B.col,U.col)===e.length-1;/* @__PURE__ */
11
+ /* @__PURE__ */u("tbody",{children:[Ne>0&&/* @__PURE__ */h("tr",{style:{height:Ne}}),ze.map((t,n)=>{const r=$e+n,o=q&&G&&Math.min(q.row,G.row)<=r&&r<=Math.max(q.row,G.row)&&0===Math.min(q.col,G.col)&&Math.max(q.col,G.col)===e.length-1;/* @__PURE__ */
12
12
  return u("tr",{style:{height:fe(r)},children:[
13
- /* @__PURE__ */u("td",{className:`relative px-1 py-1 text-center text-2xs text-gray-400 border-b border-r border-gray-200 bg-gray-50 select-none cursor-pointer hover:bg-gray-200${o?" !bg-blue-200 !text-gray-700":""}${R===r?" !bg-blue-100":""}`,draggable:!0,onDragStart:()=>(e=>K(e))(r),onDragOver:e=>((e,t)=>{e.preventDefault(),P(t)})(e,r),onDrop:()=>(e=>{if(null===T||T===e)return K(null),void P(null);const t=te.map(e=>[...e]),[n]=t.splice(T,1);t.splice(e,0,n),p(t),K(null),P(null)})(r),onDragEnd:()=>{K(null),P(null)},onClick:t=>{t.shiftKey&&B||W({row:r,col:0}),V({row:r,col:e.length-1})},onContextMenu:e=>ge(e,r),children:[r+1,
14
- /* @__PURE__ */h("div",{className:"absolute -bottom-1 left-0 right-0 h-2 cursor-row-resize z-20",onMouseDown:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),O.current={row:t,startY:e.clientY,startH:fe(t)},document.body.style.cursor="row-resize"})(e,r),onDoubleClick:e=>{e.stopPropagation(),be(r)},title:C.resize})]}),e.map((e,n)=>{const o=B&&U&&function(e,t,n,r){const o=Math.min(e.row,t.row),l=Math.max(e.row,t.row),c=Math.min(e.col,t.col),a=Math.max(e.col,t.col);return n>=o&&n<=l&&r>=c&&r<=a}(B,U,r,n),l=H?.row===r&&H?.col===n&&!e.readOnly,c=E?.row===r&&E?.col===n,a=x?.[`${r}:${n}`],s=B&&U?Math.max(B.row,U.row):-1,i=B&&U?Math.max(B.col,U.col):-1,d=B&&U&&r===s&&n===i,w=Q.current&&G&&B&&U&&(()=>{const e=Math.min(B.row,U.row),t=Math.max(B.row,U.row),o=Math.min(B.col,U.col),l=Math.max(B.col,U.col);let c=e,a=t,s=o,i=l;return G.row>t?a=G.row:G.row<e&&(c=G.row),G.col>l?i=G.col:G.col<o&&(s=G.col),r>=c&&r<=a&&n>=s&&n<=i&&!(r>=e&&r<=t&&n>=o&&n<=l)})(),m="sm"===a?.fontSize?"text-2xs":"lg"===a?.fontSize?"text-sm":"xl"===a?.fontSize?"text-base":"text-xs",p=`${a?.bold?" font-bold":""}${a?.italic?" italic":""}${a?.underline?" underline":""}`;/* @__PURE__ */
13
+ /* @__PURE__ */u("td",{className:`relative px-1 py-1 text-center text-2xs text-gray-400 border-b border-r border-gray-200 bg-gray-50 select-none cursor-pointer hover:bg-gray-200${o?" !bg-blue-200 !text-gray-700":""}${R===r?" !bg-blue-100":""}`,draggable:!0,onDragStart:()=>(e=>K(e))(r),onDragOver:e=>((e,t)=>{e.preventDefault(),P(t)})(e,r),onDrop:()=>(e=>{if(null===T||T===e)return K(null),void P(null);const t=te.map(e=>[...e]),[n]=t.splice(T,1);t.splice(e,0,n),p(t),K(null),P(null)})(r),onDragEnd:()=>{K(null),P(null)},onClick:t=>{t.shiftKey&&q||B({row:r,col:0}),U({row:r,col:e.length-1})},onContextMenu:e=>ge(e,r),children:[r+1,
14
+ /* @__PURE__ */h("div",{className:"absolute -bottom-1 left-0 right-0 h-2 cursor-row-resize z-20",onMouseDown:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),O.current={row:t,startY:e.clientY,startH:fe(t)},document.body.style.cursor="row-resize"})(e,r),onDoubleClick:e=>{e.stopPropagation(),be(r)},title:C.resize})]}),e.map((e,n)=>{const o=q&&G&&function(e,t,n,r){const o=Math.min(e.row,t.row),l=Math.max(e.row,t.row),c=Math.min(e.col,t.col),a=Math.max(e.col,t.col);return n>=o&&n<=l&&r>=c&&r<=a}(q,G,r,n),l=X?.row===r&&X?.col===n&&!e.readOnly,c=E?.row===r&&E?.col===n,a=x?.[`${r}:${n}`],s=q&&G?Math.max(q.row,G.row):-1,i=q&&G?Math.max(q.col,G.col):-1,d=q&&G&&r===s&&n===i,w=Q.current&&_&&q&&G&&(()=>{const e=Math.min(q.row,G.row),t=Math.max(q.row,G.row),o=Math.min(q.col,G.col),l=Math.max(q.col,G.col);let c=e,a=t,s=o,i=l;return _.row>t?a=_.row:_.row<e&&(c=_.row),_.col>l?i=_.col:_.col<o&&(s=_.col),r>=c&&r<=a&&n>=s&&n<=i&&!(r>=e&&r<=t&&n>=o&&n<=l)})(),m="sm"===a?.fontSize?"text-2xs":"lg"===a?.fontSize?"text-sm":"xl"===a?.fontSize?"text-base":"text-xs",p=`${a?.bold?" font-bold":""}${a?.italic?" italic":""}${a?.underline?" underline":""}`;/* @__PURE__ */
15
15
  return u("td",{className:`relative px-0 py-0 border-b border-r border-gray-200 text-sm${e.readOnly?" bg-gray-50 text-gray-500 cursor-default":" cursor-cell"}${o?" !bg-blue-100":""}${c&&!o?" ring-2 ring-inset ring-blue-400":""}${w?" !bg-blue-50 ring-1 ring-inset ring-blue-300":""}`,onMouseDown:e=>{if(e.target===e.currentTarget){re(e,r,n);const t=e.currentTarget.querySelector("[data-row][data-col]");t?.focus()}},onMouseEnter:()=>oe(r,n),onClick:e=>{if(e.target===e.currentTarget){const t=e.currentTarget.querySelector("[data-row][data-col]");t?.focus()}},onDoubleClick:t=>{t.target!==t.currentTarget||e.readOnly||Y({row:r,col:n})},children:[
16
- /* @__PURE__ */h(g,{contentEditable:l,suppressContentEditableWarning:!0,tabIndex:0,"data-row":r,"data-col":n,className:`w-full h-full px-2 py-1 rosh-focus-ring whitespace-nowrap overflow-hidden ${"right"===e.align?"text-right":"center"===e.align?"text-center":""} ${e.readOnly?"cursor-default":"cursor-cell"} font-mono ${m}${p}`,onMouseDown:e=>re(e,r,n),onMouseEnter:()=>oe(r,n),onDoubleClick:()=>{e.readOnly||Y({row:r,col:n})},onFocus:()=>{L({row:r,col:n}),_.current||(W({row:r,col:n}),V({row:r,col:n}))},onBlur:e=>{const o=e.currentTarget.textContent||"";o!==(t[n]||"")&&ne(r,n,o),Y(null)},onInput:()=>ae(r),onPaste:e=>le(e,r,n),onKeyDown:t=>{if(!(l||e.readOnly||1!==t.key.length||t.ctrlKey||t.metaKey||t.altKey))return t.preventDefault(),ne(r,n,t.key),q.current={row:r,col:n},void Y({row:r,col:n});ce(t,r,n)},text:t[n]||""}),d&&/* @__PURE__ */h("div",{onMouseDown:xe,title:C.fill,className:"absolute -bottom-[3px] -right-[3px] w-[7px] h-[7px] bg-blue-500 border border-white cursor-crosshair z-30 hover:bg-blue-600"})]},n)})]},r)}),Ae>0&&/* @__PURE__ */h("tr",{style:{height:Ae}})]})]}),se&&i(
16
+ /* @__PURE__ */h(g,{contentEditable:l,suppressContentEditableWarning:!0,tabIndex:0,"data-row":r,"data-col":n,className:`w-full h-full px-2 py-1 rosh-focus-ring whitespace-nowrap overflow-hidden ${"right"===e.align?"text-right":"center"===e.align?"text-center":""} ${e.readOnly?"cursor-default":"cursor-cell"} font-mono ${m}${p}`,onMouseDown:e=>re(e,r,n),onMouseEnter:()=>oe(r,n),onDoubleClick:()=>{e.readOnly||Y({row:r,col:n})},onFocus:()=>{L({row:r,col:n}),V.current||(B({row:r,col:n}),U({row:r,col:n}))},onBlur:e=>{const o=e.currentTarget.textContent||"";o!==(t[n]||"")&&ne(r,n,o),Y(null)},onInput:()=>ae(r),onPaste:e=>le(e,r,n),onKeyDown:t=>{if(!(l||e.readOnly||1!==t.key.length||t.ctrlKey||t.metaKey||t.altKey))return t.preventDefault(),ne(r,n,t.key),W.current={row:r,col:n},void Y({row:r,col:n});ce(t,r,n)},text:t[n]||""}),d&&/* @__PURE__ */h("div",{onMouseDown:xe,title:C.fill,className:"absolute -bottom-[3px] -right-[3px] w-[7px] h-[7px] bg-blue-500 border border-white cursor-crosshair z-30 hover:bg-blue-600"})]},n)})]},r)}),Ae>0&&/* @__PURE__ */h("tr",{style:{height:Ae}})]})]}),se&&i(
17
17
  /* @__PURE__ */u(d,{children:[
18
18
  /* @__PURE__ */h("div",{className:"fixed inset-0 z-(--z-popup)",onPointerDown:()=>ie(null)}),
19
19
  /* @__PURE__ */h("div",{className:"fixed z-(--z-popup) bg-white rounded-lg shadow-lg border border-gray-200 py-1 min-w-[160px]",style:{left:se.x,top:se.y},children:se.items.map((e,t)=>/* @__PURE__ */h("button",{onPointerDown:t=>{t.stopPropagation(),e.onClick()},className:"w-full text-left px-3 min-h-(--row-height-menu) py-2 leading-5 text-sm text-gray-700 hover:bg-gray-100",children:e.label},t))})]}),document.body)]})}export{m as EditableGrid,w as withSpareRow};
@@ -1,4 +1,4 @@
1
- import{Segmented as e}from"./chunk-N6DTTOB6.js";import{ColorPicker as t}from"./chunk-VV37BGSY.js";import{InputNumber_default as l}from"./chunk-4SQNLU2Q.js";import{Icon as r}from"./chunk-KIBL6M3T.js";import{jsxs as a,Fragment as o,jsx as s}from"react/jsx-runtime";var i=["solid","dashed","dotted"],n=["top","right","bottom","left"];function d(e){const t=e??{},l="number"==typeof t.width?t.width:0;return Object.fromEntries(n.map(e=>[e,"number"==typeof t[e]?t[e]:l]))}function m(e,t){const l=e??{},r=d(t),a=n.some(e=>"number"==typeof l[e]),o=n.map(e=>"number"==typeof l[e]?l[e]:"number"==typeof l.width?l.width:a?0:r[e]);return!o.every(e=>e===o[0])}var c="h-3.5 w-3.5",h={all:/* @__PURE__ */s(r,{name:"border-all","aria-hidden":"true",className:c}),top:/* @__PURE__ */s(r,{name:"border-top","aria-hidden":"true",className:c}),right:/* @__PURE__ */s(r,{name:"border-right","aria-hidden":"true",className:c}),bottom:/* @__PURE__ */s(r,{name:"border-bottom","aria-hidden":"true",className:c}),left:/* @__PURE__ */s(r,{name:"border-left","aria-hidden":"true",className:c})},p={solid:/* @__PURE__ */s(r,{name:"line-solid","aria-hidden":"true",className:c}),dashed:/* @__PURE__ */s(r,{name:"line-dashed","aria-hidden":"true",className:c}),dotted:/* @__PURE__ */s(r,{name:"line-dotted","aria-hidden":"true",className:c})};function u({label:r,value:d,onChange:m,each:c,placeholder:u,presets:f,words:b,widths:w=!0,styles:y=!0,min:g=0,max:N=20,step:v=1,readOnly:x}){const S=e=>"number"==typeof d[e]?d[e]:null,j=(e,t)=>{const l={...d};if("number"==typeof d.width)for(const e of n)null===S(e)&&(l[e]=d.width);l[e]=t,delete l.width,m(l)},k=(e,t,r,a,o,i)=>/* @__PURE__ */s("div",{"data-side":e,className:"all"===e?"col-span-2 min-w-0":"min-w-0",children:/* @__PURE__ */s(l,{value:a,onChange:i,min:g,max:N,step:v,precision:0,steppers:"compact",readOnly:x,placeholder:o,prefix:r,suffix:b.unit,"aria-label":t})}),C=n.map(S),O="number"==typeof d.width?d.width:C.every(e=>null!==e&&e===C[0])?C[0]:null,B=null===O&&C.some(e=>null!==e),T=n.every(e=>u.sides[e]===u.sides.top)?String(u.sides.top):"–",z=e=>S(e)??("number"==typeof d.width?d.width:null),I=d.style??u.style;/* @__PURE__ */
2
- return a("div",{role:"group","aria-label":r,"data-border":c?"each":"all",className:"grid w-full min-w-0 grid-cols-2 gap-2",children:[w?c?/* @__PURE__ */a(o,{children:[k("left",b.sides.left,h.left,z("left"),String(u.sides.left),e=>j("left",e)),k("top",b.sides.top,h.top,z("top"),String(u.sides.top),e=>j("top",e)),k("right",b.sides.right,h.right,z("right"),String(u.sides.right),e=>j("right",e)),k("bottom",b.sides.bottom,h.bottom,z("bottom"),String(u.sides.bottom),e=>j("bottom",e))]}):k("all",b.width,h.all,O,B?"–":T,e=>{const t={...d,width:e};for(const e of n)delete t[e];m(t)}):null,y&&/* @__PURE__ */s("div",{"data-border-style":"",className:"col-span-2 min-w-0",children:/* @__PURE__ */s(e,{block:!0,size:"sm",label:b.style,value:I,onChange:e=>{x||m({...d,style:e})},options:i.map(e=>({value:e,label:/* @__PURE__ */a(o,{children:[p[e],
1
+ import{Segmented as e}from"./chunk-N6DTTOB6.js";import{ColorPicker as t}from"./chunk-2OLSY4GE.js";import{InputNumber_default as l}from"./chunk-4SQNLU2Q.js";import{Icon as r}from"./chunk-KIBL6M3T.js";import{jsxs as a,Fragment as o,jsx as s}from"react/jsx-runtime";var i=["solid","dashed","dotted"],n=["top","right","bottom","left"];function d(e){const t=e??{},l="number"==typeof t.width?t.width:0;return Object.fromEntries(n.map(e=>[e,"number"==typeof t[e]?t[e]:l]))}function m(e,t){const l=e??{},r=d(t),a=n.some(e=>"number"==typeof l[e]),o=n.map(e=>"number"==typeof l[e]?l[e]:"number"==typeof l.width?l.width:a?0:r[e]);return!o.every(e=>e===o[0])}var c="h-3.5 w-3.5",h={all:/* @__PURE__ */s(r,{name:"border-all","aria-hidden":"true",className:c}),top:/* @__PURE__ */s(r,{name:"border-top","aria-hidden":"true",className:c}),right:/* @__PURE__ */s(r,{name:"border-right","aria-hidden":"true",className:c}),bottom:/* @__PURE__ */s(r,{name:"border-bottom","aria-hidden":"true",className:c}),left:/* @__PURE__ */s(r,{name:"border-left","aria-hidden":"true",className:c})},p={solid:/* @__PURE__ */s(r,{name:"line-solid","aria-hidden":"true",className:c}),dashed:/* @__PURE__ */s(r,{name:"line-dashed","aria-hidden":"true",className:c}),dotted:/* @__PURE__ */s(r,{name:"line-dotted","aria-hidden":"true",className:c})};function u({label:r,value:d,onChange:m,each:c,placeholder:u,presets:f,words:b,widths:w=!0,styles:y=!0,min:g=0,max:N=20,step:v=1,readOnly:x}){const S=e=>"number"==typeof d[e]?d[e]:null,j=(e,t)=>{const l={...d};if("number"==typeof d.width)for(const e of n)null===S(e)&&(l[e]=d.width);l[e]=t,delete l.width,m(l)},k=(e,t,r,a,o,i)=>/* @__PURE__ */s("div",{"data-side":e,className:"all"===e?"col-span-2 min-w-0":"min-w-0",children:/* @__PURE__ */s(l,{value:a,onChange:i,min:g,max:N,step:v,precision:0,steppers:"compact",readOnly:x,placeholder:o,prefix:r,suffix:b.unit,"aria-label":t})}),O=n.map(S),C="number"==typeof d.width?d.width:O.every(e=>null!==e&&e===O[0])?O[0]:null,L=null===C&&O.some(e=>null!==e),T=n.every(e=>u.sides[e]===u.sides.top)?String(u.sides.top):"–",z=e=>S(e)??("number"==typeof d.width?d.width:null),B=d.style??u.style;/* @__PURE__ */
2
+ return a("div",{role:"group","aria-label":r,"data-border":c?"each":"all",className:"grid w-full min-w-0 grid-cols-2 gap-2",children:[w?c?/* @__PURE__ */a(o,{children:[k("left",b.sides.left,h.left,z("left"),String(u.sides.left),e=>j("left",e)),k("top",b.sides.top,h.top,z("top"),String(u.sides.top),e=>j("top",e)),k("right",b.sides.right,h.right,z("right"),String(u.sides.right),e=>j("right",e)),k("bottom",b.sides.bottom,h.bottom,z("bottom"),String(u.sides.bottom),e=>j("bottom",e))]}):k("all",b.width,h.all,C,L?"–":T,e=>{const t={...d,width:e};for(const e of n)delete t[e];m(t)}):null,y&&/* @__PURE__ */s("div",{"data-border-style":"",className:"col-span-2 min-w-0",children:/* @__PURE__ */s(e,{block:!0,size:"sm",label:b.style,value:B,onChange:e=>{x||m({...d,style:e})},options:i.map(e=>({value:e,label:/* @__PURE__ */a(o,{children:[p[e],
3
3
  /* @__PURE__ */s("span",{className:"sr-only",children:b.styles[e]})]}),title:b.styles[e]}))})}),
4
4
  /* @__PURE__ */s("div",{"data-border-color":"",className:"col-span-2 flex min-w-0 items-center",children:/* @__PURE__ */s(t,{value:d.color??"",onChange:e=>{x||m({...d,color:e})},label:b.color,presets:f,fallback:u.color,showHexInput:!0,size:"sm",disabled:x})})]})}export{i as BORDER_LINE_STYLES,u as BorderInput,d as borderSides,m as borderStartEach};
@@ -1,11 +1,11 @@
1
- import{ChartTooltip as e}from"./chunk-P5BOTIJU.js";import{usePlotWidth as t}from"./chunk-MAFUXCPZ.js";import{resolveSeriesColor as l,CHART_INK as r}from"./chunk-TZFACUMR.js";import{registerModalEscapeInterceptor as n}from"./chunk-TWVUQUUD.js";import{useShellStrings as i,useShellLocale as a}from"./chunk-E6UCGCOC.js";import{formatPlain as o}from"./chunk-C3QOHMR6.js";import{useRef as h,useId as c,useState as s,useEffect as m}from"react";import{jsx as f,jsxs as u}from"react/jsx-runtime";function x({rows:x,columns:d,cells:p,height:M,width:g,color:y,max:v,formatValue:$,label:b,className:k,emptyLabel:w,cellGap:A=2,cellRadius:C=2}){const N=i().charts,U=a(),j=$??(e=>o(e,U)),z=b??N.intensity,D=w??N.noActivity,F=h(null),R=t(F),S=g??R,B=c(),[E,G]=s(null);if(m(()=>{if(null!==E)return n(e=>"Escape"===e.key&&(G(null),!0))},[E]),0===x.length||0===d.length)/* @__PURE__ */
2
- return f("div",{className:k,ref:F,children:/* @__PURE__ */f("p",{className:"py-8 text-center text-sm text-gray-500",children:D})});const L=y??l(0),O=v??Math.max(1,...p.flat().filter(Number.isFinite)),T=96,V=26*x.length,I=M??V+26+26,P=Math.max(2,(Math.max(97,S)-T)/d.length),Q=e=>{const t=O>0?Math.max(0,Math.min(1,e/O)):0;return`color-mix(in oklab, ${L} ${(8+92*t).toFixed(1)}%, ${r.surface})`};/* @__PURE__ */
1
+ import{ChartTooltip as e}from"./chunk-P5BOTIJU.js";import{usePlotWidth as t}from"./chunk-MAFUXCPZ.js";import{registerModalEscapeInterceptor as l}from"./chunk-TWVUQUUD.js";import{resolveSeriesColor as r,CHART_INK as n}from"./chunk-TZFACUMR.js";import{useShellStrings as i,useShellLocale as a}from"./chunk-E6UCGCOC.js";import{formatPlain as o}from"./chunk-C3QOHMR6.js";import{useRef as h,useId as c,useState as s,useEffect as m}from"react";import{jsx as f,jsxs as u}from"react/jsx-runtime";function x({rows:x,columns:d,cells:p,height:M,width:g,color:y,max:v,formatValue:$,label:b,className:k,emptyLabel:w,cellGap:A=2,cellRadius:C=2}){const N=i().charts,U=a(),j=$??(e=>o(e,U)),z=b??N.intensity,D=w??N.noActivity,F=h(null),R=t(F),S=g??R,B=c(),[E,G]=s(null);if(m(()=>{if(null!==E)return l(e=>"Escape"===e.key&&(G(null),!0))},[E]),0===x.length||0===d.length)/* @__PURE__ */
2
+ return f("div",{className:k,ref:F,children:/* @__PURE__ */f("p",{className:"py-8 text-center text-sm text-gray-500",children:D})});const L=y??r(0),O=v??Math.max(1,...p.flat().filter(Number.isFinite)),T=96,V=26*x.length,I=M??V+26+26,P=Math.max(2,(Math.max(97,S)-T)/d.length),Q=e=>{const t=O>0?Math.max(0,Math.min(1,e/O)):0;return`color-mix(in oklab, ${L} ${(8+92*t).toFixed(1)}%, ${n.surface})`};/* @__PURE__ */
3
3
  return u("div",{className:`relative ${k??""}`,ref:F,children:[
4
4
  /* @__PURE__ */u("svg",{width:"100%",height:I,viewBox:`0 0 ${S} ${I}`,role:"img","aria-label":N.heatmap(z,x.length,d.length),tabIndex:0,className:"rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-deep)]",onMouseLeave:()=>G(null),onBlur:()=>G(null),onKeyDown:e=>{const t="ArrowDown"===e.key?1:"ArrowUp"===e.key?-1:0,l="ArrowRight"===e.key?1:"ArrowLeft"===e.key?-1:0;0===t&&0===l||(e.preventDefault(),G(e=>({r:Math.min(x.length-1,Math.max(0,(e?.r??0)+t)),c:Math.min(d.length-1,Math.max(0,(e?.c??0)+l))})))},children:[
5
5
  /* @__PURE__ */f("defs",{children:/* @__PURE__ */u("linearGradient",{id:B,x1:"0",x2:"1",children:[
6
6
  /* @__PURE__ */f("stop",{offset:"0",stopColor:Q(0)}),
7
- /* @__PURE__ */f("stop",{offset:"1",stopColor:Q(O)})]})}),x.map((e,t)=>/* @__PURE__ */f("text",{x:86,y:26*t+13+4,textAnchor:"end",fontSize:11,fill:r.label,children:e},`r${t}`)),x.map((e,t)=>d.map((l,r)=>{const n=p[t]?.[r]??0,i=E&&(E.r!==t||E.c!==r);/* @__PURE__ */
8
- return f("rect",{x:T+r*P+A/2,y:26*t+A/2,width:Math.max(1,P-A),height:26-A,rx:C,fill:Q(n),opacity:i?.55:1,onMouseEnter:()=>G({r:t,c:r}),children:/* @__PURE__ */f("title",{children:`${e} · ${l}: ${j(n)}`})},`${t}-${r}`)})),d.map((e,t)=>t%Math.max(1,Math.ceil(d.length/Math.max(1,Math.floor((S-T)/56))))===0?/* @__PURE__ */f("text",{x:T+t*P+P/2,y:V+15,textAnchor:"middle",fontSize:11,fill:r.label,children:e},`c${t}`):null),
7
+ /* @__PURE__ */f("stop",{offset:"1",stopColor:Q(O)})]})}),x.map((e,t)=>/* @__PURE__ */f("text",{x:86,y:26*t+13+4,textAnchor:"end",fontSize:11,fill:n.label,children:e},`r${t}`)),x.map((e,t)=>d.map((l,r)=>{const n=p[t]?.[r]??0,i=E&&(E.r!==t||E.c!==r);/* @__PURE__ */
8
+ return f("rect",{x:T+r*P+A/2,y:26*t+A/2,width:Math.max(1,P-A),height:26-A,rx:C,fill:Q(n),opacity:i?.55:1,onMouseEnter:()=>G({r:t,c:r}),children:/* @__PURE__ */f("title",{children:`${e} · ${l}: ${j(n)}`})},`${t}-${r}`)})),d.map((e,t)=>t%Math.max(1,Math.ceil(d.length/Math.max(1,Math.floor((S-T)/56))))===0?/* @__PURE__ */f("text",{x:T+t*P+P/2,y:V+15,textAnchor:"middle",fontSize:11,fill:n.label,children:e},`c${t}`):null),
9
9
  /* @__PURE__ */f("rect",{x:T,y:V+26,width:Math.min(180,Math.max(40,S-T)),height:8,rx:4,fill:`url(#${B})`}),
10
- /* @__PURE__ */f("text",{x:T,y:V+48,fontSize:11,fill:r.label,children:"0"}),
11
- /* @__PURE__ */f("text",{x:T+Math.min(180,Math.max(40,S-T)),y:V+48,textAnchor:"end",fontSize:11,fill:r.label,style:{fontVariantNumeric:"tabular-nums"},children:j(O)})]}),E&&/* @__PURE__ */f("div",{className:"pointer-events-none absolute top-1 right-1 z-10",children:/* @__PURE__ */f(e,{title:`${x[E.r]} · ${d[E.c]}`,rows:[{key:"v",label:z,color:L,value:null==p[E.r]?.[E.c]?void 0:j(p[E.r][E.c])}]})})]})}export{x as HeatmapChart};
10
+ /* @__PURE__ */f("text",{x:T,y:V+48,fontSize:11,fill:n.label,children:"0"}),
11
+ /* @__PURE__ */f("text",{x:T+Math.min(180,Math.max(40,S-T)),y:V+48,textAnchor:"end",fontSize:11,fill:n.label,style:{fontVariantNumeric:"tabular-nums"},children:j(O)})]}),E&&/* @__PURE__ */f("div",{className:"pointer-events-none absolute top-1 right-1 z-10",children:/* @__PURE__ */f(e,{title:`${x[E.r]} · ${d[E.c]}`,rows:[{key:"v",label:z,color:L,value:null==p[E.r]?.[E.c]?void 0:j(p[E.r][E.c])}]})})]})}export{x as HeatmapChart};
@@ -1,4 +1,4 @@
1
- import{useWindowMenuItem as e,Modal as t}from"./chunk-WISGY2OI.js";import{navIcons as r}from"./chunk-CY5N5OA3.js";import{VERSION as s}from"./chunk-BF7NTCLU.js";import{Icon as o}from"./chunk-KIBL6M3T.js";import{DEFAULT_SHELL_STRINGS as n,useShellStrings as i,splitAround as a}from"./chunk-E6UCGCOC.js";import{useState as m,useCallback as c,isValidElement as l,cloneElement as d}from"react";import{jsx as p,jsxs as h}from"react/jsx-runtime";var u=n.aboutApp,f={spreadsheet:{name:"Spreadsheets",version:"1.1.3",route:"/spreadsheet",description:u.spreadsheet},notepad:{name:"Notepad",version:"1.0.2",route:"/notepad",description:u.notepad},documents:{name:"Documents",version:"1.1.1",route:"/documents",description:u.documents},preview:{name:"Preview",version:"1.4.3",route:"/preview",description:u.preview},files:{name:"Files",version:"1.1.3",route:"/files",description:u.files},browser:{name:"Browser",version:"1.0.2",route:"/browser",description:u.browser}},x=/* @__PURE__ */p(o,{name:"info",className:"h-4 w-4",strokeWidth:1.5}),v=/* @__PURE__ */p(o,{name:"window",className:"h-9 w-9",strokeWidth:1.5});function w({app:o}){const n=f[o],[u,w]=m(!1),N=c(()=>w(!0),[]),g=i().aboutApp,b=g.title(n.name);if(e(b,N,x),!u)return null;const y=r[n.route],k=l(y)?d(y,{className:"h-9 w-9"}):v,[j,C]=a(g.partOf);/* @__PURE__ */
1
+ import{useWindowMenuItem as e,Modal as t}from"./chunk-WPTG7ZC5.js";import{navIcons as r}from"./chunk-CY5N5OA3.js";import{VERSION as s}from"./chunk-DPDA3AJL.js";import{Icon as o}from"./chunk-KIBL6M3T.js";import{DEFAULT_SHELL_STRINGS as n,useShellStrings as i,splitAround as a}from"./chunk-E6UCGCOC.js";import{useState as m,useCallback as c,isValidElement as l,cloneElement as d}from"react";import{jsx as p,jsxs as h}from"react/jsx-runtime";var u=n.aboutApp,f={spreadsheet:{name:"Spreadsheets",version:"1.2.0",route:"/spreadsheet",description:u.spreadsheet},notepad:{name:"Notepad",version:"1.0.2",route:"/notepad",description:u.notepad},documents:{name:"Documents",version:"1.1.1",route:"/documents",description:u.documents},preview:{name:"Preview",version:"1.4.3",route:"/preview",description:u.preview},files:{name:"Files",version:"1.1.3",route:"/files",description:u.files},browser:{name:"Browser",version:"1.0.2",route:"/browser",description:u.browser}},x=/* @__PURE__ */p(o,{name:"info",className:"h-4 w-4",strokeWidth:1.5}),v=/* @__PURE__ */p(o,{name:"window",className:"h-9 w-9",strokeWidth:1.5});function w({app:o}){const n=f[o],[u,w]=m(!1),N=c(()=>w(!0),[]),g=i().aboutApp,b=g.title(n.name);if(e(b,N,x),!u)return null;const y=r[n.route],k=l(y)?d(y,{className:"h-9 w-9"}):v,[j,C]=a(g.partOf);/* @__PURE__ */
2
2
  return p(t,{open:!0,onClose:()=>w(!1),title:b,size:"sm",compact:!0,bodyScroll:!1,autoHeight:!0,dimensions:[320,320],children:/* @__PURE__ */h("div",{className:"flex flex-col items-center text-center px-5 pt-5 pb-4",children:[
3
3
  /* @__PURE__ */p("div",{className:"flex h-16 w-16 items-center justify-center rounded-2xl bg-gray-100 text-gray-600 shrink-0",children:k}),
4
4
  /* @__PURE__ */p("h2",{className:"mt-3 text-lg font-bold text-gray-900",children:n.name}),
@@ -1 +1 @@
1
- import{client_default as a}from"./chunk-WISGY2OI.js";var t=()=>a.get("/auth/numbering-configs/").then(a=>a.data?.results??a.data??[]),e="uploaded:wallpaper";function r(a,t){return"string"!=typeof a||!a||"none"===a||a.startsWith("#")?"":a===e?t||"":a}var l=()=>a.get("/auth/me/wallpaper/").then(a=>a.data),n=(t,e)=>{const r=new FormData;r.append("wallpaper",t);const l=e?{onUploadProgress:a=>e(a.total?Math.round(a.loaded/a.total*100):null)}:void 0;return a.post("/auth/me/wallpaper/",r,l).then(a=>a.data)},p=()=>a.delete("/auth/me/wallpaper/").then(a=>a.data);function o(a){const t=a?.response?.status,e=a?.response?.data,r=Array.isArray(e?.wallpaper)?e.wallpaper[0]:void 0;return r||(413===t?"That picture is too large to use as a wallpaper.":415===t?"That file is not a picture this can use as a wallpaper.":"The wallpaper could not be saved. Please try again.")}export{e as WALLPAPER_PREF_TOKEN,p as deleteWallpaper,t as getNumberingConfigs,l as getWallpaper,n as uploadWallpaper,r as wallpaperSrc,o as wallpaperUploadError};
1
+ import{client_default as a}from"./chunk-WPTG7ZC5.js";var t=()=>a.get("/auth/numbering-configs/").then(a=>a.data?.results??a.data??[]),e="uploaded:wallpaper";function r(a,t){return"string"!=typeof a||!a||"none"===a||a.startsWith("#")?"":a===e?t||"":a}var l=()=>a.get("/auth/me/wallpaper/").then(a=>a.data),n=(t,e)=>{const r=new FormData;r.append("wallpaper",t);const l=e?{onUploadProgress:a=>e(a.total?Math.round(a.loaded/a.total*100):null)}:void 0;return a.post("/auth/me/wallpaper/",r,l).then(a=>a.data)},p=()=>a.delete("/auth/me/wallpaper/").then(a=>a.data);function o(a){const t=a?.response?.status,e=a?.response?.data,r=Array.isArray(e?.wallpaper)?e.wallpaper[0]:void 0;return r||(413===t?"That picture is too large to use as a wallpaper.":415===t?"That file is not a picture this can use as a wallpaper.":"The wallpaper could not be saved. Please try again.")}export{e as WALLPAPER_PREF_TOKEN,p as deleteWallpaper,t as getNumberingConfigs,l as getWallpaper,n as uploadWallpaper,r as wallpaperSrc,o as wallpaperUploadError};
@@ -1,2 +1,2 @@
1
- import{ChartTooltip as t}from"./chunk-P5BOTIJU.js";import{CartesianPlot as o}from"./chunk-I4VD5D43.js";import{binValues as r}from"./chunk-2JWPNR2U.js";import{resolveSeriesColor as a}from"./chunk-TZFACUMR.js";import{useShellStrings as e,useShellLocale as i}from"./chunk-E6UCGCOC.js";import{formatPlain as m,formatFixed as n}from"./chunk-C3QOHMR6.js";import{jsx as l}from"react/jsx-runtime";function c({values:c,bins:s=10,precomputed:h,height:u=220,width:p,color:b,tone:f,formatBound:d,formatCount:x,yAxisLabel:g,label:k,className:y,emptyLabel:j}){const C=e().charts,v=i(),w=d??(t=>Number.isInteger(t)?m(t,v):n(t,1,v)),A=x??(t=>m(t,v)),L=g??C.countAxis,M=k??C.distribution,N=h??r(c??[],s),O=a(0,b,f),U=N.map(t=>w(t.from)),I=N.map(t=>t.count);/* @__PURE__ */
2
- return l(o,{labels:U,values:I,height:u,width:p,bandPadding:0,xTickAnchor:"start",formatValue:A,yAxisLabel:L,className:y,emptyLabel:j,ariaLabel:C.histogram(M,N.length,(c??[]).length),tooltip:o=>/* @__PURE__ */l(t,{title:`${w(N[o].from)} – ${w(N[o].to)}`,rows:[{key:"count",label:C.observations,color:O,value:A(N[o].count)}]}),children:({x:t,y:o,bottom:r,active:a})=>/* @__PURE__ */l("g",{children:N.map((e,i)=>/* @__PURE__ */l("rect",{x:t(i)+.5,y:o(e.count),width:Math.max(1,t.bandwidth-1),height:Math.max(0,r-o(e.count)),fill:O,fillOpacity:null===a||a===i?.85:.42},i))})})}export{c as HistogramChart};
1
+ import{ChartTooltip as t}from"./chunk-P5BOTIJU.js";import{CartesianPlot as o}from"./chunk-RSO67DWS.js";import{binValues as r}from"./chunk-2JWPNR2U.js";import{resolveSeriesColor as a}from"./chunk-TZFACUMR.js";import{useShellStrings as e,useShellLocale as i}from"./chunk-E6UCGCOC.js";import{formatPlain as m,formatFixed as n}from"./chunk-C3QOHMR6.js";import{jsx as l}from"react/jsx-runtime";function c({values:c,bins:s=10,precomputed:h,height:u=220,width:p,color:b,tone:f,formatBound:d,formatCount:x,yAxisLabel:g,label:k,className:y,emptyLabel:j}){const C=e().charts,v=i(),w=d??(t=>Number.isInteger(t)?m(t,v):n(t,1,v)),A=x??(t=>m(t,v)),L=g??C.countAxis,O=k??C.distribution,M=h??r(c??[],s),N=a(0,b,f),R=M.map(t=>w(t.from)),U=M.map(t=>t.count);/* @__PURE__ */
2
+ return l(o,{labels:R,values:U,height:u,width:p,bandPadding:0,xTickAnchor:"start",formatValue:A,yAxisLabel:L,className:y,emptyLabel:j,ariaLabel:C.histogram(O,M.length,(c??[]).length),tooltip:o=>/* @__PURE__ */l(t,{title:`${w(M[o].from)} – ${w(M[o].to)}`,rows:[{key:"count",label:C.observations,color:N,value:A(M[o].count)}]}),children:({x:t,y:o,bottom:r,active:a})=>/* @__PURE__ */l("g",{children:M.map((e,i)=>/* @__PURE__ */l("rect",{x:t(i)+.5,y:o(e.count),width:Math.max(1,t.bandwidth-1),height:Math.max(0,r-o(e.count)),fill:N,fillOpacity:null===a||a===i?.85:.42},i))})})}export{c as HistogramChart};
@@ -0,0 +1 @@
1
+ import{loadIconSet as t,iconSetFor as e}from"./chunk-VQCKMT5F.js";import{hexToRgb as n}from"./chunk-S6OB6HJB.js";import{useShellPrefs as o}from"./chunk-KC3EX26K.js";import{setIconSet as c}from"./chunk-J75ZT2JQ.js";import{useSyncExternalStore as r,useEffect as s}from"react";function u(){return"undefined"!=typeof window&&"function"==typeof window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null}function m(t){const e=u();return e?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):()=>{}}function a(){return u()?.matches??!1}function l(){return!1}function i(t){const e=parseInt(t.slice(1,3),16)/255,n=parseInt(t.slice(3,5),16)/255,o=parseInt(t.slice(5,7),16)/255,c=Math.max(e,n,o),r=Math.min(e,n,o);let s=0,u=0;const m=(c+r)/2;if(c!==r){const t=c-r;u=m>.5?t/(2-c-r):t/(c+r),s=c===e?((n-o)/t+(n<o?6:0))/6:c===n?((o-e)/t+2)/6:((e-n)/t+4)/6}return[360*s,100*u,100*m]}function d(t,e,n){n/=100;const o=(e/=100)*Math.min(n,1-n),c=e=>{const c=(e+t/30)%12;return n-o*Math.max(Math.min(c-3,9-c,1),-1)},r=t=>Math.round(255*t).toString(16).padStart(2,"0");return`#${r(c(0))}${r(c(8))}${r(c(4))}`}function h(t){const e=t||"system";return"system"===e?a()?"dark":"light":e}function f(t){const e=document.documentElement;if(t&&/^#[0-9a-fA-F]{6}$/.test(t)){const[n,o,c]=i(t);e.setAttribute("data-custom-accent","true"),e.style.setProperty("--accent-600",t),e.style.setProperty("--accent-700",d(n,o,Math.max(c-10,5))),e.style.setProperty("--accent-500",d(n,o,Math.min(c+10,95))),e.style.setProperty("--accent-400",d(n,o,Math.min(c+20,95))),e.style.setProperty("--accent-300",d(n,Math.min(o+10,100),Math.min(c+30,92))),e.style.setProperty("--accent-200",d(n,Math.min(o+15,100),Math.min(c+38,94))),e.style.setProperty("--accent-100",d(n,Math.min(o+20,100),Math.min(c+42,96))),e.style.setProperty("--accent-50",d(n,Math.min(o+20,100),Math.min(c+46,98)))}else e.removeAttribute("data-custom-accent"),["--accent-600","--accent-700","--accent-500","--accent-400","--accent-300","--accent-200","--accent-100","--accent-50"].forEach(t=>e.style.removeProperty(t))}function y(t,e,o,c,r){const s=document.documentElement;if(t){const t=(t,e)=>{const o=n(e);o?s.style.setProperty(t,`${o.r} ${o.g} ${o.b}`):s.style.removeProperty(t)};if(e&&s.style.setProperty("--custom-bg-color",e),o&&(t("--window-header-rgb",o),t("--window-footer-rgb",o)),c&&t("--window-content-rgb",c),r){s.style.setProperty("--custom-button-color",r);const[t,e,n]=i(r);s.style.setProperty("--custom-button-hover",d(t,e,Math.max(n-10,5)))}}else["--custom-bg-color","--custom-button-color","--custom-button-hover"].forEach(t=>s.style.removeProperty(t))}var p=["square","soft","round"];function _(t){return"square"===t||"round"===t?t:"soft"}var b={pink:"round",grey:"square"};function M(t,e,n){return n?"square"===e||"round"===e?e:"soft":b[t]??"soft"}function g(t){const e=_(t);"soft"===e?document.documentElement.removeAttribute("data-corners"):document.documentElement.setAttribute("data-corners",e)}function v(e){const n="string"==typeof e&&e?e:null;c(n),n&&t(n),n?document.documentElement.setAttribute("data-icon-set",n):document.documentElement.removeAttribute("data-icon-set")}function w(t){const n=!!t.accent_color;"corners"in t&&g(M(h(t.theme),t.corners,n)),"icon_set"in t&&v(e(h(t.theme),t.icon_set,n)),document.documentElement.setAttribute("data-theme",h(t.theme)),f(t.accent_color??null),y(t.accent_color??null,t.custom_bg_color??null,t.custom_title_color??null,t.custom_window_color??null,t.custom_button_color??null)}function E(){const{prefs:t}=o(),n=r(m,a,l),c=t.theme||"system",u=t.accent_color||null,i=t.custom_bg_color||null,d=t.custom_title_color||null,h=t.custom_window_color||null,p=t.custom_button_color||null,_=t.corners,b="string"==typeof t.icon_set&&t.icon_set?t.icon_set:null,w="system"===c?n?"dark":"light":c,E=M(w,_,!!u);s(()=>(document.documentElement.setAttribute("data-theme",w),()=>document.documentElement.removeAttribute("data-theme")),[w]),s(()=>(g(E),()=>document.documentElement.removeAttribute("data-corners")),[E]);const P=e(w,b,!!u);return s(()=>(v(P),()=>v(null)),[P]),s(()=>{f(u)},[u]),s(()=>{y(u,i,d,h,p)},[u,i,d,h,p]),{theme:c,resolved:w,corners:E,iconSet:b}}export{p as CORNERS,b as CORNERS_FOR_THEME,g as applyCorners,v as applyIconSet,w as applyThemePrefs,M as cornersFor,_ as resolveCorners,h as resolveTheme,E as useTheme};
@@ -0,0 +1 @@
1
+ var r="8.30.0",a=r;export{a as APP_VERSION,r as VERSION};
@@ -1,4 +1,4 @@
1
- import{Modal as e}from"./chunk-WISGY2OI.js";import{keepsNativeMenu as a}from"./chunk-5QFPTDQF.js";import{jsx as i,jsxs as n}from"react/jsx-runtime";var t={activeOpacity:70,inactiveOpacity:50,activeBlur:0,inactiveBlur:0};function r(e){try{const a=JSON.parse(localStorage.getItem(e)||"");return null!=a.blur&&null==a.activeBlur&&(a.activeBlur=a.blur,a.inactiveBlur=a.blur,delete a.blur),{...t,...a}}catch{return t}}function l({open:t,onClose:r,title:l,appearance:c,onAppearanceChange:s,onSave:d,children:o}){if(!t)return null;const u="w-full h-1.5 rounded-full appearance-none bg-gray-200 cursor-pointer accent-blue-500",p="flex items-center justify-between text-xs text-gray-500";/* @__PURE__ */
1
+ import{Modal as e}from"./chunk-WPTG7ZC5.js";import{keepsNativeMenu as a}from"./chunk-5QFPTDQF.js";import{jsx as i,jsxs as n}from"react/jsx-runtime";var t={activeOpacity:70,inactiveOpacity:50,activeBlur:0,inactiveBlur:0};function r(e){try{const a=JSON.parse(localStorage.getItem(e)||"");return null!=a.blur&&null==a.activeBlur&&(a.activeBlur=a.blur,a.inactiveBlur=a.blur,delete a.blur),{...t,...a}}catch{return t}}function l({open:t,onClose:r,title:l,appearance:c,onAppearanceChange:s,onSave:d,children:o}){if(!t)return null;const u="w-full h-1.5 rounded-full appearance-none bg-gray-200 cursor-pointer accent-blue-500",p="flex items-center justify-between text-xs text-gray-500";/* @__PURE__ */
2
2
  return i("div",{onPointerDown:e=>e.stopPropagation(),onContextMenu:e=>{e.stopPropagation(),a(e.target)||e.preventDefault()},children:/* @__PURE__ */i(e,{open:t,onClose:r,title:l,size:"sm",children:/* @__PURE__ */n("div",{className:"space-y-4",children:[o,
3
3
  /* @__PURE__ */n("div",{children:[
4
4
  /* @__PURE__ */i("h3",{className:"text-sm font-semibold text-gray-700 mb-3",children:"Appearance"}),
@@ -1,4 +1,4 @@
1
- import{ChartTooltip as e}from"./chunk-P5BOTIJU.js";import{CartesianPlot as t}from"./chunk-I4VD5D43.js";import{resolveSeriesColor as i,CHART_INK as l}from"./chunk-TZFACUMR.js";import{useShellStrings as r,useShellLocale as a}from"./chunk-E6UCGCOC.js";import{formatPlain as o}from"./chunk-C3QOHMR6.js";import{jsx as m,jsxs as n}from"react/jsx-runtime";function s({boxes:s,height:c=240,width:h,color:u,tone:x,formatValue:d,yAxisLabel:y,label:k,className:b,emptyLabel:f}){const p=r().charts,q=a(),g=d??(e=>o(e,q)),v=k??p.distribution,W=i(0,u,x),j=s.flatMap(e=>[e.min,e.max,...e.outliers??[]]).filter(Number.isFinite);/* @__PURE__ */
1
+ import{ChartTooltip as e}from"./chunk-P5BOTIJU.js";import{CartesianPlot as t}from"./chunk-RSO67DWS.js";import{resolveSeriesColor as i,CHART_INK as l}from"./chunk-TZFACUMR.js";import{useShellStrings as r,useShellLocale as a}from"./chunk-E6UCGCOC.js";import{formatPlain as o}from"./chunk-C3QOHMR6.js";import{jsx as m,jsxs as n}from"react/jsx-runtime";function s({boxes:s,height:c=240,width:h,color:u,tone:x,formatValue:d,yAxisLabel:y,label:k,className:b,emptyLabel:f}){const p=r().charts,q=a(),g=d??(e=>o(e,q)),v=k??p.distribution,W=i(0,u,x),j=s.flatMap(e=>[e.min,e.max,...e.outliers??[]]).filter(Number.isFinite);/* @__PURE__ */
2
2
  return m(t,{labels:s.map(e=>e.label),values:j,height:c,width:h,bandPadding:.5,formatValue:g,yAxisLabel:y,className:b,emptyLabel:f,ariaLabel:p.fiveNumber(v,s.length),tooltip:t=>{const i=s[t];/* @__PURE__ */
3
3
  return m(e,{title:i.label,rows:[{key:"max",label:p.maximum,color:W,value:g(i.max)},{key:"q3",label:p.q3,color:W,value:g(i.q3)},{key:"median",label:p.median,color:W,value:g(i.median)},{key:"q1",label:p.q1,color:W,value:g(i.q1)},{key:"min",label:p.minimum,color:W,value:g(i.min)}],emphasisKey:"median",footnote:i.outliers?.length?p.outliers(i.outliers.length):void 0})},children:({x:e,y:t,active:i})=>/* @__PURE__ */m("g",{children:s.map((r,a)=>{const o=e.center(a),s=Math.max(6,e.bandwidth);/* @__PURE__ */
4
4
  return n("g",{opacity:null!==i&&i!==a?.45:1,children:[
@@ -1,8 +1,8 @@
1
- import{ChartTooltip as e}from"./chunk-P5BOTIJU.js";import{axisGutter as t,radiusScale as i,niceMax as l,logScale as r,linearScale as o}from"./chunk-2JWPNR2U.js";import{usePlotWidth as n}from"./chunk-MAFUXCPZ.js";import{CHART_INK as a,resolveSeriesColorWithin as s}from"./chunk-TZFACUMR.js";import{registerModalEscapeInterceptor as c}from"./chunk-TWVUQUUD.js";import{useShellStrings as m,useShellLocale as h}from"./chunk-E6UCGCOC.js";import{formatPlain as f}from"./chunk-C3QOHMR6.js";import{useRef as u,useId as p,useState as d,useEffect as x}from"react";import{jsx as y,jsxs as g}from"react/jsx-runtime";var b=3;function k({series:b,height:k=260,width:v,xLabel:M,yLabel:A,formatX:z,formatY:$,xDomain:j,yDomain:w,xScale:N="linear",yScale:R="linear",radiusRange:U=[4,22],className:C,emptyLabel:S}){const D=m().charts,L=h(),O=z??(e=>f(e,L)),P=$??(e=>f(e,L)),E=S??D.noObservations,W=u(null),B=n(W),I=v??B,T=p(),[V,F]=d(null);x(()=>{if(null!==V)return c(e=>"Escape"===e.key&&(F(null),!0))},[V]);const J=(e,t)=>!t||e>=Math.min(t[0],t[1])&&e<=Math.max(t[0],t[1]),Q=b.map((e,t)=>({...e,slot:t})).filter(e=>e.points.length>0),X=j||w?Q.map(e=>({...e,points:e.points.filter(e=>J(e.x,j)&&J(e.y,w))})).filter(e=>e.points.length>0):Q,Z=Q.reduce((e,t)=>e+t.points.length,0)-X.reduce((e,t)=>e+t.points.length,0);if(0===X.length)/* @__PURE__ */
1
+ import{ChartTooltip as e}from"./chunk-P5BOTIJU.js";import{axisGutter as t,radiusScale as i,niceMax as l,logScale as r,linearScale as o}from"./chunk-2JWPNR2U.js";import{usePlotWidth as n}from"./chunk-MAFUXCPZ.js";import{registerModalEscapeInterceptor as a}from"./chunk-TWVUQUUD.js";import{CHART_INK as s,resolveSeriesColorWithin as c}from"./chunk-TZFACUMR.js";import{useShellStrings as m,useShellLocale as h}from"./chunk-E6UCGCOC.js";import{formatPlain as f}from"./chunk-C3QOHMR6.js";import{useRef as u,useId as p,useState as d,useEffect as x}from"react";import{jsx as y,jsxs as g}from"react/jsx-runtime";var b=3;function k({series:b,height:k=260,width:v,xLabel:M,yLabel:A,formatX:z,formatY:$,xDomain:j,yDomain:w,xScale:N="linear",yScale:R="linear",radiusRange:U=[4,22],className:C,emptyLabel:S}){const D=m().charts,L=h(),O=z??(e=>f(e,L)),P=$??(e=>f(e,L)),E=S??D.noObservations,W=u(null),B=n(W),I=v??B,T=p(),[V,F]=d(null);x(()=>{if(null!==V)return a(e=>"Escape"===e.key&&(F(null),!0))},[V]);const J=(e,t)=>!t||e>=Math.min(t[0],t[1])&&e<=Math.max(t[0],t[1]),Q=b.map((e,t)=>({...e,slot:t})).filter(e=>e.points.length>0),X=j||w?Q.map(e=>({...e,points:e.points.filter(e=>J(e.x,j)&&J(e.y,w))})).filter(e=>e.points.length>0):Q,Z=Q.reduce((e,t)=>e+t.points.length,0)-X.reduce((e,t)=>e+t.points.length,0);if(0===X.length)/* @__PURE__ */
2
2
  return y("div",{className:C,ref:W,children:/* @__PURE__ */y("p",{className:"flex items-center justify-center text-sm text-gray-500",style:{height:k},children:E})});const G=X.flatMap(e=>e.points),H=G.some(e=>null!=e.size),K=14,Y=20,q=34,_=52,ee=(e,t,i,n)=>{const a=e.filter(e=>e>0),s="log"===i?a.length>0?Math.min(...a):0:Math.min(0,...e),c=t??[s,l(Math.max(...e))];return"log"===i?r(c,n):o(c,n)},te=ee(G.map(e=>e.y),w,R,{from:k-q,to:K}),ie=t(te.ticks(5).map(P),_),le=Math.max(ie+1,I-Y),re=ee(G.map(e=>e.x),j,N,{from:ie,to:le}),oe=i([0,Math.max(...G.map(e=>e.size??1))],{from:U[0],to:U[1]}),ne=V?X[V.s]:void 0,ae=V&&ne?ne.points[V.i]:void 0,se=X.flatMap((e,t)=>e.points.map((e,i)=>({s:t,i:i})));/* @__PURE__ */
3
3
  return g("div",{className:`relative ${C??""}`,ref:W,children:[
4
4
  /* @__PURE__ */g("svg",{width:"100%",height:k,viewBox:`0 0 ${I} ${k}`,role:"img","aria-label":D.scatter(X.map(e=>e.label),A??D.yAxis,M??D.xAxis)+(Z>0?`. ${D.outsideRange(Z)}`:""),tabIndex:0,className:"rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-deep)]",onMouseLeave:()=>F(null),onBlur:()=>F(null),onKeyDown:e=>{if("ArrowRight"!==e.key&&"ArrowLeft"!==e.key)return;e.preventDefault();const t="ArrowRight"===e.key?1:-1,i=V?se.findIndex(e=>e.s===V.s&&e.i===V.i):0;F(se[Math.min(se.length-1,Math.max(0,i+t))])},children:[
5
5
  /* @__PURE__ */y("defs",{children:/* @__PURE__ */y("clipPath",{id:T,children:/* @__PURE__ */y("rect",{x:ie-U[1],y:K-U[1],width:le-ie+2*U[1],height:k-q-K+2*U[1]})})}),te.ticks(5).map(e=>/* @__PURE__ */g("g",{children:[
6
- /* @__PURE__ */y("line",{x1:ie,y1:te(e),x2:le,y2:te(e),stroke:a.grid,strokeWidth:1,shapeRendering:"crispEdges"}),
7
- /* @__PURE__ */y("text",{x:ie-8,y:te(e)+4,textAnchor:"end",fontSize:11,fill:a.label,style:{fontVariantNumeric:"tabular-nums"},children:P(e)})]},`y${e}`)),re.ticks(5).map(e=>/* @__PURE__ */y("text",{x:re(e),y:k-12,textAnchor:"middle",fontSize:11,fill:a.label,style:{fontVariantNumeric:"tabular-nums"},children:O(e)},`x${e}`)),M&&/* @__PURE__ */y("text",{x:(ie+le)/2,y:k-.5,textAnchor:"middle",fontSize:11,fill:a.label,children:M}),A&&/* @__PURE__ */y("text",{x:12,y:k/2,transform:`rotate(-90 12 ${k/2})`,textAnchor:"middle",fontSize:11,fill:a.label,children:A}),
8
- /* @__PURE__ */y("g",{clipPath:`url(#${T})`,children:X.map((e,t)=>{const i=s(e.slot,3,e.color,e.tone);return e.points.map((l,r)=>/* @__PURE__ */y("circle",{cx:re(l.x),cy:te(l.y),r:H?oe(l.size??0):U[0]+1,fill:i,fillOpacity:V&&V.s!==t?.25:.62,stroke:a.surface,strokeWidth:2,onMouseEnter:()=>F({s:t,i:r})},`${e.key}-${r}`))})})]}),V&&ne&&ae&&/* @__PURE__ */y("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */y(e,{title:ae.label??ne.label,rows:[{key:"x",label:M??D.xAxis,color:s(ne.slot,3,ne.color,ne.tone),value:O(ae.x)},{key:"y",label:A??D.yAxis,color:s(ne.slot,3,ne.color,ne.tone),value:P(ae.y)},...null!=ae.size?[{key:"size",label:D.size,color:a.muted,value:f(ae.size,L)}]:[]],footnote:ae.label?ne.label:void 0})})]})}export{b as SCATTER_SERIES_CAP,k as ScatterChart};
6
+ /* @__PURE__ */y("line",{x1:ie,y1:te(e),x2:le,y2:te(e),stroke:s.grid,strokeWidth:1,shapeRendering:"crispEdges"}),
7
+ /* @__PURE__ */y("text",{x:ie-8,y:te(e)+4,textAnchor:"end",fontSize:11,fill:s.label,style:{fontVariantNumeric:"tabular-nums"},children:P(e)})]},`y${e}`)),re.ticks(5).map(e=>/* @__PURE__ */y("text",{x:re(e),y:k-12,textAnchor:"middle",fontSize:11,fill:s.label,style:{fontVariantNumeric:"tabular-nums"},children:O(e)},`x${e}`)),M&&/* @__PURE__ */y("text",{x:(ie+le)/2,y:k-.5,textAnchor:"middle",fontSize:11,fill:s.label,children:M}),A&&/* @__PURE__ */y("text",{x:12,y:k/2,transform:`rotate(-90 12 ${k/2})`,textAnchor:"middle",fontSize:11,fill:s.label,children:A}),
8
+ /* @__PURE__ */y("g",{clipPath:`url(#${T})`,children:X.map((e,t)=>{const i=c(e.slot,3,e.color,e.tone);return e.points.map((l,r)=>/* @__PURE__ */y("circle",{cx:re(l.x),cy:te(l.y),r:H?oe(l.size??0):U[0]+1,fill:i,fillOpacity:V&&V.s!==t?.25:.62,stroke:s.surface,strokeWidth:2,onMouseEnter:()=>F({s:t,i:r})},`${e.key}-${r}`))})})]}),V&&ne&&ae&&/* @__PURE__ */y("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */y(e,{title:ae.label??ne.label,rows:[{key:"x",label:M??D.xAxis,color:c(ne.slot,3,ne.color,ne.tone),value:O(ae.x)},{key:"y",label:A??D.yAxis,color:c(ne.slot,3,ne.color,ne.tone),value:P(ae.y)},...null!=ae.size?[{key:"size",label:D.size,color:s.muted,value:f(ae.size,L)}]:[]],footnote:ae.label?ne.label:void 0})})]})}export{b as SCATTER_SERIES_CAP,k as ScatterChart};
@@ -1,14 +1,14 @@
1
- import{Markdown as e}from"./chunk-4DAN4Q6P.js";import{PLACEHOLDER_INK as t}from"./chunk-JFSYWEHD.js";import{Icon as r}from"./chunk-KIBL6M3T.js";import{LoadingSpinner as l}from"./chunk-Q5MD3VY6.js";import{useShellStrings as a}from"./chunk-E6UCGCOC.js";import{useState as s,useMemo as n}from"react";import{jsxs as o,jsx as i,Fragment as c}from"react/jsx-runtime";var d=({open:e})=>/* @__PURE__ */i(r,{name:"chevron-right",look:"mini",className:"h-3.5 w-3.5 shrink-0 transition-transform "+(e?"rotate-90":""),"aria-hidden":"true"});function h({docs:h,loading:m=!1,categoryOrder:p,canEdit:u=!1,onNew:g,onEdit:x,renderBody:y,emptyMessage:f}){const b=a(),[v,N]=s(""),[w,k]=s(null),[C,j]=s({}),M=v.trim().toLowerCase(),L=n(()=>{const e=/* @__PURE__ */new Map;for(const t of h){let r=e.get(t.category);r||(r={key:t.category,label:t.category_label||t.category,docs:[]},e.set(t.category,r)),r.docs.push(t)}if(!p?.length)return[...e.values()];const t=new Map(p.map((e,t)=>[e,t]));return[...e.values()].sort((e,r)=>(t.get(e.key)??1/0)-(t.get(r.key)??1/0))},[h,p]),_=e=>!M||e.title.toLowerCase().includes(M)||e.body.toLowerCase().includes(M)||e.category_label.toLowerCase().includes(M),E=n(()=>L.map(e=>({...e,docs:e.docs.filter(_)})).filter(e=>e.docs.length>0),[L,M]),A=n(()=>E.flatMap(e=>e.docs),[E]),B=(w?A.find(e=>e.slug===w):void 0)??A[0]??null,D=e=>!!M||(C[e]??e===B?.category);/* @__PURE__ */
1
+ import{Markdown as e}from"./chunk-V3UIAX5G.js";import{PLACEHOLDER_INK as t}from"./chunk-JFSYWEHD.js";import{Icon as r}from"./chunk-KIBL6M3T.js";import{LoadingSpinner as l}from"./chunk-Q5MD3VY6.js";import{useShellStrings as a}from"./chunk-E6UCGCOC.js";import{useState as s,useMemo as n}from"react";import{jsxs as o,jsx as i,Fragment as c}from"react/jsx-runtime";var d=({open:e})=>/* @__PURE__ */i(r,{name:"chevron-right",look:"mini",className:"h-3.5 w-3.5 shrink-0 transition-transform "+(e?"rotate-90":""),"aria-hidden":"true"});function h({docs:h,loading:m=!1,categoryOrder:p,canEdit:u=!1,onNew:g,onEdit:x,renderBody:y,emptyMessage:f}){const b=a(),[v,w]=s(""),[N,k]=s(null),[C,j]=s({}),M=v.trim().toLowerCase(),L=n(()=>{const e=/* @__PURE__ */new Map;for(const t of h){let r=e.get(t.category);r||(r={key:t.category,label:t.category_label||t.category,docs:[]},e.set(t.category,r)),r.docs.push(t)}if(!p?.length)return[...e.values()];const t=new Map(p.map((e,t)=>[e,t]));return[...e.values()].sort((e,r)=>(t.get(e.key)??1/0)-(t.get(r.key)??1/0))},[h,p]),_=e=>!M||e.title.toLowerCase().includes(M)||e.body.toLowerCase().includes(M)||e.category_label.toLowerCase().includes(M),E=n(()=>L.map(e=>({...e,docs:e.docs.filter(_)})).filter(e=>e.docs.length>0),[L,M]),A=n(()=>E.flatMap(e=>e.docs),[E]),B=(N?A.find(e=>e.slug===N):void 0)??A[0]??null,z=e=>!!M||(C[e]??e===B?.category);/* @__PURE__ */
2
2
  return o("div",{className:"flex h-full gap-4 px-4 py-3 min-h-0",children:[
3
3
  /* @__PURE__ */o("aside",{className:"w-64 shrink-0 flex flex-col bg-white rounded-lg shadow overflow-hidden",children:[
4
4
  /* @__PURE__ */o("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[
5
5
  /* @__PURE__ */i("h2",{className:"text-sm font-semibold text-gray-900",children:b.help.title}),u&&g&&/* @__PURE__ */i("button",{type:"button",onClick:g,className:"text-xs text-blue-600 hover:underline",children:b.help.newArticle})]}),
6
6
  /* @__PURE__ */i("div",{className:"px-3 py-2 border-b border-gray-100 shrink-0",children:/* @__PURE__ */o("div",{className:"relative",children:[
7
7
  /* @__PURE__ */i(r,{name:"search",look:"mini",className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 ${t}`,"aria-hidden":"true"}),
8
- /* @__PURE__ */i("input",{type:"text",value:v,onChange:e=>N(e.target.value),placeholder:b.help.searchPlaceholder,className:"w-full rounded-md border border-gray-300 bg-white h-8 pl-8 pr-2 text-sm shadow-sm focus:border-blue-500 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-accent)]"})]})}),
9
- /* @__PURE__ */i("div",{className:"flex-1 overflow-y-auto py-1",children:m?/* @__PURE__ */i(l,{size:"sm",padding:"py-6",label:b.help.loading}):0===E.length?/* @__PURE__ */i("p",{className:"px-3 py-6 text-center text-xs text-gray-500",children:M?b.help.noResults:f??b.help.empty}):E.map(e=>{const t=D(e.key);/* @__PURE__ */
8
+ /* @__PURE__ */i("input",{type:"text",value:v,onChange:e=>w(e.target.value),placeholder:b.help.searchPlaceholder,className:"w-full rounded-md border border-gray-300 bg-white h-8 pl-8 pr-2 text-sm shadow-sm focus:border-blue-500 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-accent)]"})]})}),
9
+ /* @__PURE__ */i("div",{className:"flex-1 overflow-y-auto py-1",children:m?/* @__PURE__ */i(l,{size:"sm",padding:"py-6",label:b.help.loading}):0===E.length?/* @__PURE__ */i("p",{className:"px-3 py-6 text-center text-xs text-gray-500",children:M?b.help.noResults:f??b.help.empty}):E.map(e=>{const t=z(e.key);/* @__PURE__ */
10
10
  return o("div",{className:"py-0.5",children:[
11
- /* @__PURE__ */o("button",{type:"button",onClick:()=>{return t=e.key,j(e=>({...e,[t]:!D(t)}));var t},className:"w-full flex items-center gap-2 h-8 px-3 text-left text-3xs font-semibold uppercase tracking-wide text-gray-400 hover:text-gray-600",children:[
11
+ /* @__PURE__ */o("button",{type:"button",onClick:()=>{return t=e.key,j(e=>({...e,[t]:!z(t)}));var t},className:"w-full flex items-center gap-2 h-8 px-3 text-left text-3xs font-semibold uppercase tracking-wide text-gray-400 hover:text-gray-600",children:[
12
12
  /* @__PURE__ */i(d,{open:t}),
13
13
  /* @__PURE__ */i("span",{className:"truncate",children:e.label})]}),t&&e.docs.map(e=>{const t=B?.slug===e.slug;/* @__PURE__ */
14
14
  return o("button",{type:"button",onClick:()=>k(e.slug),className:"w-full text-left pl-8 pr-3 min-h-(--row-height-menu) py-2 text-sm flex items-center gap-2 transition-colors "+(t?"bg-blue-50 text-blue-700 font-medium":"text-gray-700 hover:bg-gray-50"),children:[
@@ -1,4 +1,4 @@
1
- import{StatCard as e,Card as a}from"./chunk-VU6VPKM3.js";import{Avatar as t}from"./chunk-MMFJBWJC.js";import{Sparkline as r}from"./chunk-CKCDGSTC.js";import{PieChart as s}from"./chunk-NID6MGGC.js";import{ColumnChart as l}from"./chunk-ETF7LAYZ.js";import{StatusBadgeProvider as i,StatusBadge as d}from"./chunk-D323R2FT.js";import{Button_default as c}from"./chunk-4IU5BSVE.js";import{TH_ONE_LINE as n}from"./chunk-6KO5VTL7.js";import{jsx as o,jsxs as m}from"react/jsx-runtime";var u={paid:"success",shipped:"active",processing:"queued",refunded:"neutral",overdue:"danger"},h=[12,18,14,22,19,27,24,31,28,35,30,38],p=["J","F","M","A","M","J","J","A","S","O","N","D"],g=[{key:"direct",label:"Direct",value:45},{key:"search",label:"Search",value:30},{key:"social",label:"Social",value:15},{key:"email",label:"Email",value:10}],x=[{id:"#3201",customer:"Alice Nguyen",total:"$1,204",status:"paid"},{id:"#3202",customer:"Marco Reyes",total:"$642",status:"shipped"},{id:"#3203",customer:"Priya Patel",total:"$2,980",status:"processing"},{id:"#3204",customer:"Tom Becker",total:"$318",status:"overdue"},{id:"#3205",customer:"Sara Lind",total:"$540",status:"refunded"}];function v(){/* @__PURE__ */
1
+ import{StatCard as e,Card as a}from"./chunk-VU6VPKM3.js";import{Avatar as t}from"./chunk-MMFJBWJC.js";import{Sparkline as r}from"./chunk-CKCDGSTC.js";import{PieChart as s}from"./chunk-NID6MGGC.js";import{ColumnChart as l}from"./chunk-W5M6P4DZ.js";import{StatusBadgeProvider as i,StatusBadge as d}from"./chunk-D323R2FT.js";import{Button_default as c}from"./chunk-4IU5BSVE.js";import{TH_ONE_LINE as n}from"./chunk-6KO5VTL7.js";import{jsx as o,jsxs as m}from"react/jsx-runtime";var u={paid:"success",shipped:"active",processing:"queued",refunded:"neutral",overdue:"danger"},h=[12,18,14,22,19,27,24,31,28,35,30,38],p=["J","F","M","A","M","J","J","A","S","O","N","D"],g=[{key:"direct",label:"Direct",value:45},{key:"search",label:"Search",value:30},{key:"social",label:"Social",value:15},{key:"email",label:"Email",value:10}],x=[{id:"#3201",customer:"Alice Nguyen",total:"$1,204",status:"paid"},{id:"#3202",customer:"Marco Reyes",total:"$642",status:"shipped"},{id:"#3203",customer:"Priya Patel",total:"$2,980",status:"processing"},{id:"#3204",customer:"Tom Becker",total:"$318",status:"overdue"},{id:"#3205",customer:"Sara Lind",total:"$540",status:"refunded"}];function v(){/* @__PURE__ */
2
2
  return o(i,{groups:u,children:/* @__PURE__ */o("div",{className:"h-full overflow-auto bg-gray-50 p-6",children:/* @__PURE__ */m("div",{className:"mx-auto max-w-6xl space-y-6",children:[
3
3
  /* @__PURE__ */m("div",{className:"flex items-center justify-between gap-4",children:[
4
4
  /* @__PURE__ */m("div",{children:[
@@ -1,4 +1,4 @@
1
- import{ChartTooltip as e}from"./chunk-P5BOTIJU.js";import{CartesianPlot as l}from"./chunk-I4VD5D43.js";import{STATUS_VARS as o}from"./chunk-TZFACUMR.js";import{useShellStrings as t,useShellLocale as a}from"./chunk-E6UCGCOC.js";import{formatPlain as i,formatFixed as r}from"./chunk-C3QOHMR6.js";import{jsx as c,jsxs as n,Fragment as s}from"react/jsx-runtime";function h({candles:h,variant:m="candle",height:p=260,width:d,formatValue:u,yAxisLabel:b,label:y,className:x,emptyLabel:k}){const g=t().charts,f=a(),w=u??(e=>Number.isInteger(e)?i(e,f):r(e,2,f)),M=y??g.price,v=h.flatMap(e=>[e.low,e.high]).filter(Number.isFinite),j=Math.min(...v),C=Math.max(...v),L=.08*(C-j)||1;/* @__PURE__ */
1
+ import{ChartTooltip as e}from"./chunk-P5BOTIJU.js";import{CartesianPlot as l}from"./chunk-RSO67DWS.js";import{STATUS_VARS as o}from"./chunk-TZFACUMR.js";import{useShellStrings as t,useShellLocale as a}from"./chunk-E6UCGCOC.js";import{formatPlain as i,formatFixed as r}from"./chunk-C3QOHMR6.js";import{jsx as c,jsxs as n,Fragment as s}from"react/jsx-runtime";function h({candles:h,variant:m="candle",height:p=260,width:d,formatValue:u,yAxisLabel:b,label:y,className:x,emptyLabel:k}){const g=t().charts,f=a(),w=u??(e=>Number.isInteger(e)?i(e,f):r(e,2,f)),M=y??g.price,v=h.flatMap(e=>[e.low,e.high]).filter(Number.isFinite),j=Math.min(...v),C=Math.max(...v),L=.08*(C-j)||1;/* @__PURE__ */
2
2
  return c(l,{labels:h.map(e=>e.label),values:v,height:p,width:d,min:j-L,max:C+L,bandPadding:.42,formatValue:w,yAxisLabel:b,className:x,emptyLabel:k,ariaLabel:g.ohlc(M,h.length),tooltip:l=>{const t=h[l],a=t.close>=t.open,i=a?o.good:o.critical;/* @__PURE__ */
3
3
  return c(e,{title:t.label,rows:[{key:"open",label:g.open,color:i,value:w(t.open)},{key:"high",label:g.high,color:i,value:w(t.high)},{key:"low",label:g.low,color:i,value:w(t.low)},{key:"close",label:g.close,color:i,value:w(t.close)}],emphasisKey:"close",footnote:a?g.closedAbove:g.closedBelow})},children:({x:e,y:l,active:t})=>/* @__PURE__ */c("g",{children:h.map((a,i)=>{const r=a.close>=a.open,h=r?o.good:o.critical,p=e.center(i),d=Math.max(3,e.bandwidth),u=null!==t&&t!==i,b=l(Math.max(a.open,a.close)),y=Math.max(1,Math.abs(l(a.close)-l(a.open)));/* @__PURE__ */
4
4
  return n("g",{opacity:u?.45:1,children:[
@@ -1,19 +1,19 @@
1
- import{ChartBrush as t}from"./chunk-EYKUKN32.js";import{ChartDot as e}from"./chunk-CK2YOGUS.js";import{stepPath as a,curvePath as r,areaBetween as l,areaFrom as n}from"./chunk-VFC6QUEN.js";import{ChartDefs as i,MOTION as o,stagger as s,fillFor as c,dashFor as h,maskId as m}from"./chunk-465RRWBY.js";import{ChartSkeleton as d}from"./chunk-Y4MI6NRI.js";import{useHighlight as u,highlightOpacity as f}from"./chunk-CNYAHYE6.js";import{ChartTooltip as p}from"./chunk-P5BOTIJU.js";import{tooltipBesideBand as g}from"./chunk-MG7A3R75.js";import{pairedAxes as k,niceAxis as y,niceMax as x,linearScale as v,axisGutter as b,bandScale as M,ladderScale as N}from"./chunk-2JWPNR2U.js";import{usePlotWidth as j}from"./chunk-MAFUXCPZ.js";import{resolveSeriesColor as $,CHART_INK as w,STATUS_VARS as A}from"./chunk-TZFACUMR.js";import{registerModalEscapeInterceptor as R}from"./chunk-TWVUQUUD.js";import{useShellStrings as V,useShellLocale as C}from"./chunk-E6UCGCOC.js";import{formatPercent as L,formatPlain as U}from"./chunk-C3QOHMR6.js";import{useRef as W,useState as z,useId as E,useEffect as I}from"react";import{jsx as S,jsxs as D}from"react/jsx-runtime";var O=12,Y=16,B=26,F=52,P=t=>"number"==typeof t&&Number.isFinite(t);function T({series:T,labels:K,height:G=200,stacked:Q=!1,stackMode:H="value",levels:J,curve:Z="linear",tension:X=0,max:q,yTickCount:_=4,formatValue:tt,formatTooltipValue:et,tooltipLabels:at,yAxisLabel:rt,referenceLines:lt,labelEndpoints:nt=!1,dots:it,dotVariant:ot="border",pulse:st=!1,brush:ct=!1,range:ht,onRangeChange:mt,loading:dt=!1,animate:ut=!0,reveal:ft="left-to-right",fillVariant:pt="gradient",gridStyle:gt="solid",width:kt,className:yt,emptyLabel:xt}){const vt=V().charts,bt=C(),Mt=tt??(t=>U(t,bt)),Nt=et??Mt,jt=xt??vt.noData,$t=W(null),wt=j($t),At=kt??wt,[Rt,Vt]=z(null),[Ct,Lt]=z(null),{highlighted:Ut}=u(),Wt=E();if(I(()=>{if(null!==Rt)return R(t=>"Escape"===t.key&&(Vt(null),!0))},[Rt]),dt)/* @__PURE__ */
2
- return S("div",{className:yt,ref:$t,children:/* @__PURE__ */S(d,{height:G,width:kt??wt})});const zt=K,Et=ht??Ct??[0,Math.max(0,zt.length-1)],[It,St]=Et,Dt=t=>ct?t.slice(It,St+1):t,Ot=T.map((t,e)=>({...t,slot:e})).filter(t=>t.data.some(P)).map(t=>({...t,data:Dt(t.data)}));if(K=Dt(zt),0===Ot.length||0===K.length)/* @__PURE__ */
3
- return S("div",{className:yt,ref:$t,children:/* @__PURE__ */S("p",{className:"flex items-center justify-center text-sm text-gray-500",style:{height:G},children:jt})});const Yt=K.map((t,e)=>Ot.reduce((t,a)=>t+(P(a.data[e])?a.data[e]:0),0)),Bt=(t,e)=>Yt[e]>0?t/Yt[e]:null,Ft=[];if(Q){let t=K.map(()=>0);for(const e of Ot)t=t.map((t,a)=>t+(P(e.data[a])?e.data[a]:0)),Ft.push("percent"===H?t.map((t,e)=>Bt(t,e)):[...t])}const Pt=!!J&&J.length>0,Tt=t=>"right"===t.axis,Kt=!Q&&!Pt&&void 0===q&&Ot.some(Tt)&&Ot.some(t=>!Tt(t)),Gt=Kt?Ot.filter(t=>!Tt(t)):Ot,Qt=Kt?Ot.filter(Tt).flatMap(t=>t.data.filter(P)):[],Ht=Q?(Ft.at(-1)??[]).filter(P):Gt.flatMap(t=>t.data.filter(P)),Jt=Kt?k([Math.min(0,...Ht),Math.max(0,...Ht)],[Math.min(0,...Qt),Math.max(0,...Qt)],{intervals:_+1,integerLeft:Ht.every(Number.isInteger),integerRight:Qt.every(Number.isInteger)}):null,Zt=Jt?Jt.left:Q&&"percent"===H||Pt||void 0!==q?null:y(Q?0:Math.min(0,...Ht),Math.max(0,...Ht),{intervals:_+1,integer:Ht.every(Number.isInteger)}),Xt=Zt?Zt.lo:0,qt=Q&&"percent"===H?1:Zt?Zt.hi:q??x(Math.max(...Ht,0)),_t=Q&&"percent"===H?t=>L(Math.round(100*t),0,bt):Mt,te=Pt?J:Zt?Zt.ticks:v([Xt,qt],{from:0,to:1}).ticks(_+1),ee=b(te.map(_t),F),ae=Jt?b(Jt.right.ticks.map(Mt),Y):Y,re={left:ee,right:Math.max(ee+1,At-ae),top:O,bottom:G-B},le=M(K.length,{from:re.left,to:re.right}),ne=Pt?N(J,{from:re.bottom,to:re.top}):null,ie=v([Xt,qt],{from:re.bottom,to:re.top}),oe=ie(Math.max(Xt,0)),se=t=>ne?ne(t):ie(t),ce=Jt?v([Jt.right.lo,Jt.right.hi],{from:re.bottom,to:re.top}):null,he=t=>ce&&Tt(t)?ce:se,me=ne?ne.levels.map(t=>({value:t,y:ne(t)})):te.map(t=>({value:t,y:ie(t)})),de=t=>e=>{e.preventDefault(),Vt(e=>{const a=(e??0)+t;return Math.min(K.length-1,Math.max(0,a))})},ue=Math.max(1,Math.ceil(K.length/Math.max(1,Math.floor(At/96))));/* @__PURE__ */
1
+ import{ChartDot as t}from"./chunk-CK2YOGUS.js";import{stepPath as e,curvePath as a,areaBetween as r,areaFrom as l}from"./chunk-VFC6QUEN.js";import{ChartDefs as n,MOTION as i,stagger as o,fillFor as s,dashFor as c,maskId as h}from"./chunk-465RRWBY.js";import{ChartSkeleton as m}from"./chunk-Y4MI6NRI.js";import{useHighlight as d,highlightOpacity as u}from"./chunk-CNYAHYE6.js";import{ChartTooltip as f}from"./chunk-P5BOTIJU.js";import{tooltipBesideBand as p}from"./chunk-MG7A3R75.js";import{pairedAxes as g,niceAxis as k,niceMax as y,linearScale as x,axisGutter as v,bandScale as b,ladderScale as M}from"./chunk-2JWPNR2U.js";import{usePlotWidth as N}from"./chunk-MAFUXCPZ.js";import{registerModalEscapeInterceptor as j}from"./chunk-TWVUQUUD.js";import{ChartBrush as $}from"./chunk-EYKUKN32.js";import{resolveSeriesColor as w,CHART_INK as A,STATUS_VARS as R}from"./chunk-TZFACUMR.js";import{useShellStrings as V,useShellLocale as C}from"./chunk-E6UCGCOC.js";import{formatPercent as L,formatPlain as U}from"./chunk-C3QOHMR6.js";import{useRef as W,useState as z,useId as E,useEffect as I}from"react";import{jsx as S,jsxs as D}from"react/jsx-runtime";var O=12,Y=16,B=26,F=52,P=t=>"number"==typeof t&&Number.isFinite(t);function T({series:T,labels:K,height:G=200,stacked:Q=!1,stackMode:H="value",levels:J,curve:Z="linear",tension:X=0,max:q,yTickCount:_=4,formatValue:tt,formatTooltipValue:et,tooltipLabels:at,yAxisLabel:rt,referenceLines:lt,labelEndpoints:nt=!1,dots:it,dotVariant:ot="border",pulse:st=!1,brush:ct=!1,range:ht,onRangeChange:mt,loading:dt=!1,animate:ut=!0,reveal:ft="left-to-right",fillVariant:pt="gradient",gridStyle:gt="solid",width:kt,className:yt,emptyLabel:xt}){const vt=V().charts,bt=C(),Mt=tt??(t=>U(t,bt)),Nt=et??Mt,jt=xt??vt.noData,$t=W(null),wt=N($t),At=kt??wt,[Rt,Vt]=z(null),[Ct,Lt]=z(null),{highlighted:Ut}=d(),Wt=E();if(I(()=>{if(null!==Rt)return j(t=>"Escape"===t.key&&(Vt(null),!0))},[Rt]),dt)/* @__PURE__ */
2
+ return S("div",{className:yt,ref:$t,children:/* @__PURE__ */S(m,{height:G,width:kt??wt})});const zt=K,Et=ht??Ct??[0,Math.max(0,zt.length-1)],[It,St]=Et,Dt=t=>ct?t.slice(It,St+1):t,Ot=T.map((t,e)=>({...t,slot:e})).filter(t=>t.data.some(P)).map(t=>({...t,data:Dt(t.data)}));if(K=Dt(zt),0===Ot.length||0===K.length)/* @__PURE__ */
3
+ return S("div",{className:yt,ref:$t,children:/* @__PURE__ */S("p",{className:"flex items-center justify-center text-sm text-gray-500",style:{height:G},children:jt})});const Yt=K.map((t,e)=>Ot.reduce((t,a)=>t+(P(a.data[e])?a.data[e]:0),0)),Bt=(t,e)=>Yt[e]>0?t/Yt[e]:null,Ft=[];if(Q){let t=K.map(()=>0);for(const e of Ot)t=t.map((t,a)=>t+(P(e.data[a])?e.data[a]:0)),Ft.push("percent"===H?t.map((t,e)=>Bt(t,e)):[...t])}const Pt=!!J&&J.length>0,Tt=t=>"right"===t.axis,Kt=!Q&&!Pt&&void 0===q&&Ot.some(Tt)&&Ot.some(t=>!Tt(t)),Gt=Kt?Ot.filter(t=>!Tt(t)):Ot,Qt=Kt?Ot.filter(Tt).flatMap(t=>t.data.filter(P)):[],Ht=Q?(Ft.at(-1)??[]).filter(P):Gt.flatMap(t=>t.data.filter(P)),Jt=Kt?g([Math.min(0,...Ht),Math.max(0,...Ht)],[Math.min(0,...Qt),Math.max(0,...Qt)],{intervals:_+1,integerLeft:Ht.every(Number.isInteger),integerRight:Qt.every(Number.isInteger)}):null,Zt=Jt?Jt.left:Q&&"percent"===H||Pt||void 0!==q?null:k(Q?0:Math.min(0,...Ht),Math.max(0,...Ht),{intervals:_+1,integer:Ht.every(Number.isInteger)}),Xt=Zt?Zt.lo:0,qt=Q&&"percent"===H?1:Zt?Zt.hi:q??y(Math.max(...Ht,0)),_t=Q&&"percent"===H?t=>L(Math.round(100*t),0,bt):Mt,te=Pt?J:Zt?Zt.ticks:x([Xt,qt],{from:0,to:1}).ticks(_+1),ee=v(te.map(_t),F),ae=Jt?v(Jt.right.ticks.map(Mt),Y):Y,re={left:ee,right:Math.max(ee+1,At-ae),top:O,bottom:G-B},le=b(K.length,{from:re.left,to:re.right}),ne=Pt?M(J,{from:re.bottom,to:re.top}):null,ie=x([Xt,qt],{from:re.bottom,to:re.top}),oe=ie(Math.max(Xt,0)),se=t=>ne?ne(t):ie(t),ce=Jt?x([Jt.right.lo,Jt.right.hi],{from:re.bottom,to:re.top}):null,he=t=>ce&&Tt(t)?ce:se,me=ne?ne.levels.map(t=>({value:t,y:ne(t)})):te.map(t=>({value:t,y:ie(t)})),de=t=>e=>{e.preventDefault(),Vt(e=>{const a=(e??0)+t;return Math.min(K.length-1,Math.max(0,a))})},ue=Math.max(1,Math.ceil(K.length/Math.max(1,Math.floor(At/96))));/* @__PURE__ */
4
4
  return D("div",{className:`relative ${yt??""}`,ref:$t,children:[
5
5
  /* @__PURE__ */D("svg",{width:"100%",height:G,viewBox:`0 0 ${At} ${G}`,role:"img","aria-label":vt.overIntervals(Ot.map(t=>t.label),K.length),tabIndex:0,className:"rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-deep)]",onMouseLeave:()=>Vt(null),onBlur:()=>Vt(null),onKeyDown:t=>{"ArrowRight"===t.key&&de(1)(t),"ArrowLeft"===t.key&&de(-1)(t)},children:[
6
6
  /* @__PURE__ */S("defs",{children:/* @__PURE__ */S("clipPath",{id:Wt,children:/* @__PURE__ */S("rect",{x:re.left,y:re.top,width:re.right-re.left,height:re.bottom-re.top})})}),
7
- /* @__PURE__ */S(i,{id:Wt,fills:Ot.map((t,e)=>({color:$(t.slot,t.color,t.tone),variant:t.fillVariant??pt})),fadeFrom:Q?.42:.3,reveal:!!ut&&ft}),me.map(t=>/* @__PURE__ */S("line",{x1:re.left,y1:t.y,x2:re.right,y2:t.y,stroke:w.grid,strokeWidth:1,shapeRendering:"crispEdges",strokeDasharray:"dashed"===gt?"3 3":void 0},`grid-${t.value}`)),
8
- /* @__PURE__ */S("line",{x1:re.left,y1:oe,x2:re.right,y2:oe,stroke:w.axis,strokeWidth:1,shapeRendering:"crispEdges"}),me.map(t=>/* @__PURE__ */S("text",{x:re.left-8,y:t.y+4,textAnchor:"end","data-axis-tick":"true",fontSize:11,fill:w.label,style:{fontVariantNumeric:"tabular-nums"},children:_t(t.value)},`ytick-${t.value}`)),Jt&&me.map((t,e)=>/* @__PURE__ */S("text",{x:re.right+8,y:t.y+4,textAnchor:"start","data-axis-tick":"true",fontSize:11,fill:w.label,style:{fontVariantNumeric:"tabular-nums"},children:Mt(Jt.right.ticks[e])},`ytick-r-${t.value}`)),rt&&/* @__PURE__ */S("text",{x:12,y:(re.top+re.bottom)/2,transform:`rotate(-90 12 ${(re.top+re.bottom)/2})`,textAnchor:"middle",fontSize:11,fill:w.label,children:rt}),
9
- /* @__PURE__ */S("g",{clipPath:`url(#${Wt})`,mask:ut&&ft?`url(#${m(Wt)})`:void 0,children:Ot.map((t,e)=>{const i=$(t.slot,t.color,t.tone),m=t.mode??(Q?"area":"line"),d=f(t.key,Ut);if("step"===m){const e=K.map((e,a)=>({start:le(a),end:le.end(a),value:t.data[a]})).filter(t=>P(t.value)).map(e=>({start:e.start,end:e.end,y:he(t)(e.value)}));/* @__PURE__ */
10
- return S("path",{d:a(e),fill:"none",stroke:i,strokeWidth:2.5,strokeLinecap:"butt",strokeLinejoin:"miter",opacity:d??void 0,className:"rosh-viz-mark"},t.key)}const u=K.map((a,r)=>{const l=Q?Ft[e]?.[r]:t.data[r];return P(l)?[le.center(r),he(t)(l)]:null}).filter(t=>null!==t);if(0===u.length)return null;if("column"===m){const a=Math.max(1,.62*le.bandwidth),r="solid"===t.fillVariant,l=he(t);/* @__PURE__ */
11
- return S("g",{opacity:d??void 0,className:"rosh-viz-mark",children:K.map((n,c)=>{const h=Q?Ft[e]?.[c]:t.data[c];if(!P(h))return null;const m=l(h);/* @__PURE__ */
12
- return S("rect",{x:le.center(c)-a/2,y:Math.min(m,oe),width:a,height:Math.abs(oe-m),rx:2,fill:i,fillOpacity:r?1:.35,className:ut?o.rise:void 0,style:ut?s(c,26):void 0},c)})},t.key)}const p=r(u,Z,X),g=Q&&e>0?K.map((t,a)=>[le.center(a),se(Ft[e-1]?.[a]??0)-2]):null,k=g?l(p,g):n(p,u,oe);/* @__PURE__ */
7
+ /* @__PURE__ */S(n,{id:Wt,fills:Ot.map((t,e)=>({color:w(t.slot,t.color,t.tone),variant:t.fillVariant??pt})),fadeFrom:Q?.42:.3,reveal:!!ut&&ft}),me.map(t=>/* @__PURE__ */S("line",{x1:re.left,y1:t.y,x2:re.right,y2:t.y,stroke:A.grid,strokeWidth:1,shapeRendering:"crispEdges",strokeDasharray:"dashed"===gt?"3 3":void 0},`grid-${t.value}`)),
8
+ /* @__PURE__ */S("line",{x1:re.left,y1:oe,x2:re.right,y2:oe,stroke:A.axis,strokeWidth:1,shapeRendering:"crispEdges"}),me.map(t=>/* @__PURE__ */S("text",{x:re.left-8,y:t.y+4,textAnchor:"end","data-axis-tick":"true",fontSize:11,fill:A.label,style:{fontVariantNumeric:"tabular-nums"},children:_t(t.value)},`ytick-${t.value}`)),Jt&&me.map((t,e)=>/* @__PURE__ */S("text",{x:re.right+8,y:t.y+4,textAnchor:"start","data-axis-tick":"true",fontSize:11,fill:A.label,style:{fontVariantNumeric:"tabular-nums"},children:Mt(Jt.right.ticks[e])},`ytick-r-${t.value}`)),rt&&/* @__PURE__ */S("text",{x:12,y:(re.top+re.bottom)/2,transform:`rotate(-90 12 ${(re.top+re.bottom)/2})`,textAnchor:"middle",fontSize:11,fill:A.label,children:rt}),
9
+ /* @__PURE__ */S("g",{clipPath:`url(#${Wt})`,mask:ut&&ft?`url(#${h(Wt)})`:void 0,children:Ot.map((t,n)=>{const h=w(t.slot,t.color,t.tone),m=t.mode??(Q?"area":"line"),d=u(t.key,Ut);if("step"===m){const a=K.map((e,a)=>({start:le(a),end:le.end(a),value:t.data[a]})).filter(t=>P(t.value)).map(e=>({start:e.start,end:e.end,y:he(t)(e.value)}));/* @__PURE__ */
10
+ return S("path",{d:e(a),fill:"none",stroke:h,strokeWidth:2.5,strokeLinecap:"butt",strokeLinejoin:"miter",opacity:d??void 0,className:"rosh-viz-mark"},t.key)}const f=K.map((e,a)=>{const r=Q?Ft[n]?.[a]:t.data[a];return P(r)?[le.center(a),he(t)(r)]:null}).filter(t=>null!==t);if(0===f.length)return null;if("column"===m){const e=Math.max(1,.62*le.bandwidth),a="solid"===t.fillVariant,r=he(t);/* @__PURE__ */
11
+ return S("g",{opacity:d??void 0,className:"rosh-viz-mark",children:K.map((l,s)=>{const c=Q?Ft[n]?.[s]:t.data[s];if(!P(c))return null;const m=r(c);/* @__PURE__ */
12
+ return S("rect",{x:le.center(s)-e/2,y:Math.min(m,oe),width:e,height:Math.abs(oe-m),rx:2,fill:h,fillOpacity:a?1:.35,className:ut?i.rise:void 0,style:ut?o(s,26):void 0},s)})},t.key)}const p=a(f,Z,X),g=Q&&n>0?K.map((t,e)=>[le.center(e),se(Ft[n-1]?.[e]??0)-2]):null,k=g?r(p,g):l(p,f,oe);/* @__PURE__ */
13
13
  return D("g",{opacity:d??void 0,className:"rosh-viz-mark",children:[("area"===m||Q)&&
14
- /* @__PURE__ */S("path",{d:k,fill:c(Wt,e,t.fillVariant??pt,i),stroke:"none"}),
15
- /* @__PURE__ */S("path",{d:p,fill:"none",stroke:i,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",strokeDasharray:h(t.stroke??(t.forecast?"animated-dashed":"solid")),className:ut&&("animated-dashed"===t.stroke||t.forecast&&!t.stroke)?o.march:void 0})]},t.key)})}),lt?.map((t,e)=>{const a=t.color??A[t.tone??"critical"],r=se(t.value);/* @__PURE__ */
14
+ /* @__PURE__ */S("path",{d:k,fill:s(Wt,n,t.fillVariant??pt,h),stroke:"none"}),
15
+ /* @__PURE__ */S("path",{d:p,fill:"none",stroke:h,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",strokeDasharray:c(t.stroke??(t.forecast?"animated-dashed":"solid")),className:ut&&("animated-dashed"===t.stroke||t.forecast&&!t.stroke)?i.march:void 0})]},t.key)})}),lt?.map((t,e)=>{const a=t.color??R[t.tone??"critical"],r=se(t.value);/* @__PURE__ */
16
16
  return D("g",{children:[
17
- /* @__PURE__ */S("line",{x1:re.left,y1:r,x2:re.right,y2:r,stroke:a,strokeWidth:1,strokeDasharray:"5 4"}),t.label&&/* @__PURE__ */S("text",{x:re.right-4,y:r-5,textAnchor:"end",fontSize:11,fontWeight:600,fill:a,children:t.label})]},`rule-${e}`)}),"none"!==(it??(nt?"last":"none"))&&Ot.map((t,a)=>{if("column"===t.mode)return null;const r=it??(nt?"last":"none"),l=$(t.slot,t.color,t.tone),n=[...t.data].map(P).lastIndexOf(!0),i="all"===r?K.map((t,e)=>e).filter(e=>P(Q?Ft[a]?.[e]:t.data[e])):n>=0?[n]:[];/* @__PURE__ */
18
- return D("g",{children:[i.map(r=>{const i=Q?Ft[a]?.[r]:t.data[r];return P(i)?/* @__PURE__ */S(e,{cx:le.center(r),cy:he(t)(i),color:l,variant:ot,pulse:st&&r===n,title:`${K[r]}: ${t.label} ${Mt(i)}`},r):null}),nt&&n>=0&&P(Q?Ft[a]?.[n]:t.data[n])&&/* @__PURE__ */S("text",{x:le.center(n)-10,y:he(t)(Q?Ft[a]?.[n]:t.data[n])-9,textAnchor:"end",fontSize:12,fontWeight:600,fill:w.label,style:{fontVariantNumeric:"tabular-nums"},children:Mt(Q?Ft[a]?.[n]:t.data[n])})]},`dots-${t.key}`)}),K.map((t,e)=>e%ue===0?/* @__PURE__ */S("text",{x:le.center(e),y:G-8,textAnchor:"middle",fontSize:11,fill:w.label,style:{fontVariantNumeric:"tabular-nums"},children:t},`xtick-${e}`):null),null!==Rt&&/* @__PURE__ */S("line",{x1:le.center(Rt),y1:re.top,x2:le.center(Rt),y2:re.bottom,stroke:w.axis,strokeWidth:1}),K.map((t,e)=>/* @__PURE__ */S("rect",{x:le(e),y:re.top,width:Math.max(1,le.bandwidth),height:re.bottom-re.top,fill:"transparent",onMouseEnter:()=>Vt(e)},`hit-${e}`))]}),ct&&zt.length>2&&/* @__PURE__ */S(t,{className:"mt-1",labels:zt,width:At,data:T[0]?.data??[],range:Et,onRangeChange:t=>{mt?mt(t):Lt(t)}}),null!==Rt&&
19
- /* @__PURE__ */S("div",{className:"pointer-events-none absolute top-2 z-10",style:g(le.center(Rt),le.bandwidth,At),children:/* @__PURE__ */S(p,{title:at?.[Rt]??K[Rt],rows:Ot.map((t,e)=>({key:t.key,label:t.label,color:$(t.slot,t.color,t.tone),value:P(t.data[Rt])?Q&&"percent"===H?`${L(100*(Bt(t.data[Rt],Rt)??0),1,bt)} · ${Nt(t.data[Rt])}`:Nt(t.data[Rt]):void 0})),footnote:Q&&"percent"===H?vt.inBucket(Nt(Yt[Rt])):void 0})})]})}export{T as TimeSeriesChart};
17
+ /* @__PURE__ */S("line",{x1:re.left,y1:r,x2:re.right,y2:r,stroke:a,strokeWidth:1,strokeDasharray:"5 4"}),t.label&&/* @__PURE__ */S("text",{x:re.right-4,y:r-5,textAnchor:"end",fontSize:11,fontWeight:600,fill:a,children:t.label})]},`rule-${e}`)}),"none"!==(it??(nt?"last":"none"))&&Ot.map((e,a)=>{if("column"===e.mode)return null;const r=it??(nt?"last":"none"),l=w(e.slot,e.color,e.tone),n=[...e.data].map(P).lastIndexOf(!0),i="all"===r?K.map((t,e)=>e).filter(t=>P(Q?Ft[a]?.[t]:e.data[t])):n>=0?[n]:[];/* @__PURE__ */
18
+ return D("g",{children:[i.map(r=>{const i=Q?Ft[a]?.[r]:e.data[r];return P(i)?/* @__PURE__ */S(t,{cx:le.center(r),cy:he(e)(i),color:l,variant:ot,pulse:st&&r===n,title:`${K[r]}: ${e.label} ${Mt(i)}`},r):null}),nt&&n>=0&&P(Q?Ft[a]?.[n]:e.data[n])&&/* @__PURE__ */S("text",{x:le.center(n)-10,y:he(e)(Q?Ft[a]?.[n]:e.data[n])-9,textAnchor:"end",fontSize:12,fontWeight:600,fill:A.label,style:{fontVariantNumeric:"tabular-nums"},children:Mt(Q?Ft[a]?.[n]:e.data[n])})]},`dots-${e.key}`)}),K.map((t,e)=>e%ue===0?/* @__PURE__ */S("text",{x:le.center(e),y:G-8,textAnchor:"middle",fontSize:11,fill:A.label,style:{fontVariantNumeric:"tabular-nums"},children:t},`xtick-${e}`):null),null!==Rt&&/* @__PURE__ */S("line",{x1:le.center(Rt),y1:re.top,x2:le.center(Rt),y2:re.bottom,stroke:A.axis,strokeWidth:1}),K.map((t,e)=>/* @__PURE__ */S("rect",{x:le(e),y:re.top,width:Math.max(1,le.bandwidth),height:re.bottom-re.top,fill:"transparent",onMouseEnter:()=>Vt(e)},`hit-${e}`))]}),ct&&zt.length>2&&/* @__PURE__ */S($,{className:"mt-1",labels:zt,width:At,data:T[0]?.data??[],range:Et,onRangeChange:t=>{mt?mt(t):Lt(t)}}),null!==Rt&&
19
+ /* @__PURE__ */S("div",{className:"pointer-events-none absolute top-2 z-10",style:p(le.center(Rt),le.bandwidth,At),children:/* @__PURE__ */S(f,{title:at?.[Rt]??K[Rt],rows:Ot.map((t,e)=>({key:t.key,label:t.label,color:w(t.slot,t.color,t.tone),value:P(t.data[Rt])?Q&&"percent"===H?`${L(100*(Bt(t.data[Rt],Rt)??0),1,bt)} · ${Nt(t.data[Rt])}`:Nt(t.data[Rt]):void 0})),footnote:Q&&"percent"===H?vt.inBucket(Nt(Yt[Rt])):void 0})})]})}export{T as TimeSeriesChart};
@@ -1,8 +1,8 @@
1
- import{tooltipBesideBand as t}from"./chunk-MG7A3R75.js";import{niceAxis as e,niceMax as i,linearScale as r,axisGutter as n,bandScale as l}from"./chunk-2JWPNR2U.js";import{usePlotWidth as o}from"./chunk-MAFUXCPZ.js";import{CHART_INK as a}from"./chunk-TZFACUMR.js";import{registerModalEscapeInterceptor as h}from"./chunk-TWVUQUUD.js";import{useShellStrings as s,useShellLocale as c}from"./chunk-E6UCGCOC.js";import{formatPlain as m}from"./chunk-C3QOHMR6.js";import{useRef as d,useState as u,useId as f,useEffect as x}from"react";import{jsx as g,jsxs as p}from"react/jsx-runtime";function y({labels:y,values:v,height:b=220,width:k,bandPadding:M=.24,min:w,max:N,yTickCount:A=4,formatValue:$,yAxisLabel:j,xTickAnchor:C="center",children:R,overlay:E,tooltip:U,onSelect:z,ariaLabel:D,className:L,emptyLabel:P}){const F=s().charts,I=c(),S=$??(t=>m(t,I)),T=P??F.noData,V=d(null),W=o(V),B=k??W,[G,O]=u(null),Q=f();if(x(()=>{if(null!==G)return h(t=>"Escape"===t.key&&(O(null),!0))},[G]),0===y.length||!v.some(Number.isFinite))/* @__PURE__ */
1
+ import{tooltipBesideBand as t}from"./chunk-MG7A3R75.js";import{niceAxis as e,niceMax as i,linearScale as r,axisGutter as n,bandScale as l}from"./chunk-2JWPNR2U.js";import{usePlotWidth as o}from"./chunk-MAFUXCPZ.js";import{registerModalEscapeInterceptor as a}from"./chunk-TWVUQUUD.js";import{CHART_INK as h}from"./chunk-TZFACUMR.js";import{useShellStrings as s,useShellLocale as c}from"./chunk-E6UCGCOC.js";import{formatPlain as m}from"./chunk-C3QOHMR6.js";import{useRef as d,useState as u,useId as f,useEffect as x}from"react";import{jsx as g,jsxs as p}from"react/jsx-runtime";function y({labels:y,values:v,height:b=220,width:k,bandPadding:M=.24,min:w,max:N,yTickCount:A=4,formatValue:$,yAxisLabel:j,xTickAnchor:C="center",children:R,overlay:E,tooltip:U,onSelect:z,ariaLabel:D,className:L,emptyLabel:P}){const F=s().charts,I=c(),S=$??(t=>m(t,I)),T=P??F.noData,V=d(null),W=o(V),B=k??W,[G,O]=u(null),Q=f();if(x(()=>{if(null!==G)return a(t=>"Escape"===t.key&&(O(null),!0))},[G]),0===y.length||!v.some(Number.isFinite))/* @__PURE__ */
2
2
  return g("div",{className:L,ref:V,children:/* @__PURE__ */g("p",{className:"flex items-center justify-center text-sm text-gray-500",style:{height:b},children:T})});const Z=v.filter(Number.isFinite),H=Z.every(Number.isInteger),J=void 0===w&&void 0===N?e(Math.min(0,...Z),Math.max(0,...Z),{intervals:A+1,integer:H}):null,K=void 0!==w&&void 0===N?e(w,Math.max(w,...Z),{intervals:A+1,integer:H,zero:!1}):null,X=J?J.lo:w??Math.min(0,...Z),q=J?J.hi:K?K.hi:N??i(Math.max(...Z,0)),Y=J?J.ticks:K?[X,...K.ticks.filter(t=>t>X)]:r([X,q],{from:0,to:1}).ticks(A+1),_={top:12,right:16,bottom:26,left:n(Y.map(S),48)+(j?10:0)},tt=_.left,et=Math.max(tt+1,B-_.right),it=_.top,rt=b-_.bottom,nt=r([X,q],{from:rt,to:it}),lt=l(y.length,{from:tt,to:et},M),ot=(et-tt)/Math.max(1,y.length),at=ot>=48,ht=at?1:Math.max(1,Math.ceil(y.length/Math.max(1,Math.floor(B/84)))),st=Math.max(2,Math.floor((ot-6)/6.6)),ct=t=>at&&t.length>st?`${t.slice(0,st-1).trimEnd()}…`:t;/* @__PURE__ */
3
3
  return p("div",{className:`relative ${L??""}`,ref:V,children:[
4
4
  /* @__PURE__ */p("svg",{width:"100%",height:b,viewBox:`0 0 ${B} ${b}`,role:"img","aria-label":D,tabIndex:0,className:"rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-deep)]",onMouseLeave:()=>O(null),onBlur:()=>O(null),onKeyDown:t=>{if(z&&null!==G&&("Enter"===t.key||" "===t.key))return t.preventDefault(),void z(G);if("ArrowRight"!==t.key&&"ArrowLeft"!==t.key)return;t.preventDefault();const e="ArrowRight"===t.key?1:-1;O(t=>Math.min(y.length-1,Math.max(0,(t??0)+e)))},children:[
5
- /* @__PURE__ */g("defs",{children:/* @__PURE__ */g("clipPath",{id:Q,children:/* @__PURE__ */g("rect",{x:tt,y:it,width:et-tt,height:rt-it})})}),Y.map(t=>/* @__PURE__ */g("line",{x1:tt,y1:nt(t),x2:et,y2:nt(t),stroke:a.grid,strokeWidth:1,shapeRendering:"crispEdges"},`g${t}`)),
6
- /* @__PURE__ */g("line",{x1:tt,y1:nt(Math.max(X,0)),x2:et,y2:nt(Math.max(X,0)),stroke:a.axis,strokeWidth:1,shapeRendering:"crispEdges"}),Y.map(t=>/* @__PURE__ */g("text",{x:tt-8,y:nt(t)+4,textAnchor:"end",fontSize:11,fill:a.label,style:{fontVariantNumeric:"tabular-nums"},children:S(t)},`t${t}`)),j&&/* @__PURE__ */g("text",{x:14,y:(it+rt)/2,transform:`rotate(-90 14 ${(it+rt)/2})`,textAnchor:"middle",fontSize:11,fill:a.label,children:j}),
7
- /* @__PURE__ */g("g",{clipPath:`url(#${Q})`,children:R({x:lt,y:nt,left:tt,right:et,top:it,bottom:rt,width:B,height:b,clipId:Q,active:G})}),E?.({x:lt,y:nt,left:tt,right:et,top:it,bottom:rt,width:B,height:b,clipId:Q,active:G}),y.map((t,e)=>e%ht===0?/* @__PURE__ */g("text",{x:"start"===C?lt(e):lt.center(e),y:b-8,textAnchor:"middle",fontSize:11,fill:a.label,style:{fontVariantNumeric:"tabular-nums"},children:ct(t)},`x${e}`):null),y.map((t,e)=>/* @__PURE__ */g("rect",{x:lt.center(e)-(et-tt)/y.length/2,y:it,width:(et-tt)/y.length,height:rt-it,fill:"transparent",onMouseEnter:()=>O(e),onClick:z?()=>z(e):void 0,style:z?{cursor:"pointer"}:void 0},`h${e}`))]}),U&&null!==G&&
5
+ /* @__PURE__ */g("defs",{children:/* @__PURE__ */g("clipPath",{id:Q,children:/* @__PURE__ */g("rect",{x:tt,y:it,width:et-tt,height:rt-it})})}),Y.map(t=>/* @__PURE__ */g("line",{x1:tt,y1:nt(t),x2:et,y2:nt(t),stroke:h.grid,strokeWidth:1,shapeRendering:"crispEdges"},`g${t}`)),
6
+ /* @__PURE__ */g("line",{x1:tt,y1:nt(Math.max(X,0)),x2:et,y2:nt(Math.max(X,0)),stroke:h.axis,strokeWidth:1,shapeRendering:"crispEdges"}),Y.map(t=>/* @__PURE__ */g("text",{x:tt-8,y:nt(t)+4,textAnchor:"end",fontSize:11,fill:h.label,style:{fontVariantNumeric:"tabular-nums"},children:S(t)},`t${t}`)),j&&/* @__PURE__ */g("text",{x:14,y:(it+rt)/2,transform:`rotate(-90 14 ${(it+rt)/2})`,textAnchor:"middle",fontSize:11,fill:h.label,children:j}),
7
+ /* @__PURE__ */g("g",{clipPath:`url(#${Q})`,children:R({x:lt,y:nt,left:tt,right:et,top:it,bottom:rt,width:B,height:b,clipId:Q,active:G})}),E?.({x:lt,y:nt,left:tt,right:et,top:it,bottom:rt,width:B,height:b,clipId:Q,active:G}),y.map((t,e)=>e%ht===0?/* @__PURE__ */g("text",{x:"start"===C?lt(e):lt.center(e),y:b-8,textAnchor:"middle",fontSize:11,fill:h.label,style:{fontVariantNumeric:"tabular-nums"},children:ct(t)},`x${e}`):null),y.map((t,e)=>/* @__PURE__ */g("rect",{x:lt.center(e)-(et-tt)/y.length/2,y:it,width:(et-tt)/y.length,height:rt-it,fill:"transparent",onMouseEnter:()=>O(e),onClick:z?()=>z(e):void 0,style:z?{cursor:"pointer"}:void 0},`h${e}`))]}),U&&null!==G&&
8
8
  /* @__PURE__ */g("div",{className:"pointer-events-none absolute top-2 z-10",style:t(lt.center(G),lt.bandwidth,B),children:U(G)})]})}export{y as CartesianPlot};
@@ -0,0 +1 @@
1
+ var t=/^(?:[0-9a-f]{3}|[0-9a-f]{6})$/i,n=7;function r(n){const r=n.trim().replace(/^#/,"");if(!t.test(r))return null;return`#${(3===r.length?[...r].map(t=>t+t).join(""):r).toLowerCase()}`}var e=t=>t.toUpperCase(),i=(t,n,r)=>Math.min(r,Math.max(n,t));function o(t){const n=r(t);if(!n)return{h:0,s:0,v:0};const e=parseInt(n.slice(1,3),16)/255,i=parseInt(n.slice(3,5),16)/255,o=parseInt(n.slice(5,7),16)/255,s=Math.max(e,i,o),u=s-Math.min(e,i,o);let a=0;return 0!==u&&(a=s===e?(i-o)/u%6*60:s===i?60*((o-e)/u+2):60*((e-i)/u+4)),{h:(a+360)%360,s:0===s?0:u/s,v:s}}function s({h:t,s:n,v:r}){const e=(t%360+360)%360,o=i(n,0,1),s=i(r,0,1),u=s*o,a=u*(1-Math.abs(e/60%2-1)),c=s-u,[l,f,h]=e<60?[u,a,0]:e<120?[a,u,0]:e<180?[0,u,a]:e<240?[0,a,u]:e<300?[a,0,u]:[u,0,a],p=t=>Math.round(255*(t+c)).toString(16).padStart(2,"0");return`#${p(l)}${p(f)}${p(h)}`}function u(t,n,r){return{s:r.width>0?i((t-r.left)/r.width,0,1):0,v:r.height>0?1-i((n-r.top)/r.height,0,1):0}}function a(t,n){return n.width>0?Math.min(359,360*i((t-n.left)/n.width,0,1)):0}var c=`linear-gradient(to right, ${[0,60,120,180,240,300,360].map(t=>s({h:t%360,s:1,v:1})).join(", ")})`,l=/^#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i;function f(t){const n=t.trim();if(!l.test(n))return null;let r=n.slice(1);3===r.length&&(r=[...r].map(t=>t+t).join(""));const e=parseInt(r.slice(0,6),16);return{r:e>>16&255,g:e>>8&255,b:255&e}}function h(t){const n="string"==typeof t?f(t):t;if(!n)return null;const r=t=>{const n=t/255;return n<=.04045?n/12.92:((n+.055)/1.055)**2.4};return.2126*r(n.r)+.7152*r(n.g)+.0722*r(n.b)}function p(t,n){const r=h(t),e=h(n);if(null===r||null===e)return null;const[i,o]=r>=e?[r,e]:[e,r];return(i+.05)/(o+.05)}function g(t,n=[s({h:0,s:0,v:0}),s({h:0,s:0,v:1})]){let r=n[0],e=-1;for(const i of n){const o=p(t,i);if(null===o)return n[0];o>e&&(e=o,r=i)}return r}export{n as HEX_MAX_LENGTH,c as HUE_GRADIENT,p as contrastRatio,e as hexReadout,o as hexToHsv,f as hexToRgb,s as hsvToHex,a as hueFromPoint,r as parseHexColor,g as readableInk,h as relativeLuminance,u as svFromPoint};
@@ -1,4 +1,4 @@
1
- import{formatMoney as e}from"./chunk-X2S2XDZI.js";import{EMPTY_VALUE as r}from"./chunk-36BRD5J3.js";import{TimeSeriesChart as t}from"./chunk-WSPO4N72.js";import{ChartFrame as a}from"./chunk-BRHIRE4D.js";import{ColumnChart as l}from"./chunk-ETF7LAYZ.js";import{TH_ONE_LINE as s}from"./chunk-6KO5VTL7.js";import{jsxs as o,jsx as i}from"react/jsx-runtime";function n({spec:n,height:c=200,width:m,animate:d=!0,className:h}){const u=function(r){if(r.currency)return t=>e(t,r.currency);const t=r.unit?` ${r.unit}`:"";return e=>`${e.toLocaleString("en-US",{maximumFractionDigits:2})}${t}`}(n),p=n.currency?r=>e(r,n.currency,{whole:!0}):u,b=n.series.map((e,r)=>({key:`s${r}`,label:e.name,data:e.values})),y=n.title??n.series.map(e=>e.name).join(", "),f=/* @__PURE__ */o("table",{className:"w-full border-collapse text-sm",children:[
1
+ import{formatMoney as e}from"./chunk-X2S2XDZI.js";import{EMPTY_VALUE as r}from"./chunk-36BRD5J3.js";import{TimeSeriesChart as t}from"./chunk-OSA24YH6.js";import{ChartFrame as a}from"./chunk-BRHIRE4D.js";import{ColumnChart as l}from"./chunk-W5M6P4DZ.js";import{TH_ONE_LINE as s}from"./chunk-6KO5VTL7.js";import{jsxs as o,jsx as i}from"react/jsx-runtime";function n({spec:n,height:c=200,width:m,animate:d=!0,className:h}){const u=function(r){if(r.currency)return t=>e(t,r.currency);const t=r.unit?` ${r.unit}`:"";return e=>`${e.toLocaleString("en-US",{maximumFractionDigits:2})}${t}`}(n),p=n.currency?r=>e(r,n.currency,{whole:!0}):u,b=n.series.map((e,r)=>({key:`s${r}`,label:e.name,data:e.values})),y=n.title??n.series.map(e=>e.name).join(", "),f=/* @__PURE__ */o("table",{className:"w-full border-collapse text-sm",children:[
2
2
  /* @__PURE__ */i("thead",{children:/* @__PURE__ */o("tr",{children:[
3
3
  /* @__PURE__ */i("td",{className:"border-b border-gray-200"}),n.series.map((e,r)=>/* @__PURE__ */i("th",{scope:"col",className:`${s} border-b border-gray-200 px-2 py-1 text-right font-semibold text-gray-700`,children:e.name},r))]})}),
4
4
  /* @__PURE__ */i("tbody",{children:n.x.map((e,t)=>/* @__PURE__ */o("tr",{children:[