strata-react 2.1.13 → 2.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -9,8 +9,9 @@ import { n as useSharedCursor, r as geo, t as CursorScope } from "./cursor-Cwyvg
9
9
  import { a as fieldErrorsOf, i as errorPayload, n as describeActionError, o as readErrorBody, r as describeHttpError, t as HttpError } from "./errors-CmuwcWlb.js";
10
10
  import { a as PaletteChoice, c as paletteScript, d as usePalette, f as useSystemColorScheme, i as PALETTE_STORAGE_KEY, l as palettes, n as ColorSchemeChoice, o as ThemeProvider, p as Density, r as DEFAULT_PALETTE, s as colorSchemeScript, t as COLOR_SCHEME_STORAGE_KEY, u as useColorScheme } from "./theme-kCizTI4-.js";
11
11
  import * as React from "react";
12
+ import { useRef, useState } from "react";
12
13
  import { Autocomplete, Button as Button$1, Cell, Checkbox as Checkbox$1, Collection, Column, Dialog as Dialog$1, DialogTrigger, Disclosure as Disclosure$1, DisclosurePanel, DropIndicator, DropZone, FileTrigger, GridLayout, GridList, GridListItem, Header, Heading, Input as Input$1, Keyboard, Link, ListBox, ListBoxItem, ListLayout, ListStateContext, Menu as Menu$1, MenuItem, MenuSection, MenuTrigger, Modal, ModalOverlay, Popover as Popover$1, RouterProvider, Row, SearchField, Select, SelectValue, Separator, Slider as Slider$1, SliderThumb, SliderTrack, SubmenuTrigger, Switch as Switch$1, Tab, TabList, TabPanel, Table, TableBody, TableHeader, TableLayout, Tabs as Tabs$1, Text, ToggleButton, ToggleButtonGroup, Tree as Tree$1, TreeItem, TreeItemContent, Virtualizer, useDragAndDrop, useFilter } from "react-aria-components";
13
- import { ArrowDown, ArrowUp, ArrowUpDown, ArrowUpRight, Ban, Brush, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronsUp, CircleAlert, CircleCheck, CircleDashed, Clock, CloudOff, Columns2, Ellipsis, Eraser, Eye, EyeOff, FastForward, FileQuestion, Flag, Folder, FolderOpen, FolderX, GripVertical, Hand, Highlighter, ImageOff, Info, KeyRound, LayoutGrid, List, Loader, LoaderCircle, Lock, Maximize, Maximize2, Minimize, Minus, MousePointer2, Paintbrush, PanelBottomClose, PanelBottomOpen, PanelLeftClose, PanelLeftOpen, PanelRightClose, PanelRightOpen, PanelTopClose, PanelTopOpen, Pause, PenLine, Pencil, Play, Redo2, Rewind, RotateCcw, RotateCw, Scan, Search, Send, SkipBack, SkipForward, SlidersHorizontal, Square, StepBack, StepForward, Trash2, TriangleAlert, Undo2, Upload, Volume2, VolumeX, X, ZoomIn, ZoomOut } from "lucide-react";
14
+ import { ArrowDown, ArrowUp, ArrowUpDown, ArrowUpRight, Ban, Brush, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronsUp, CircleAlert, CircleCheck, CircleDashed, Clock as Clock$1, CloudOff, Columns2, Ellipsis, Eraser, Eye, EyeOff, FastForward, FileQuestion, Flag, Folder, FolderOpen, FolderX, GripVertical, Hand, Highlighter, ImageOff, Info, KeyRound, LayoutGrid, List, Loader, LoaderCircle, Lock, Maximize, Maximize2, Minimize, Minus, MousePointer2, Paintbrush, PanelBottomClose, PanelBottomOpen, PanelLeftClose, PanelLeftOpen, PanelRightClose, PanelRightOpen, PanelTopClose, PanelTopOpen, Pause, PenLine, Pencil, Play, Redo2, Rewind, RotateCcw, RotateCw, Scan, Search, Send, SkipBack, SkipForward, SlidersHorizontal, Square, StepBack, StepForward, Trash2, TriangleAlert, Undo2, Upload, Volume2, VolumeX, X, ZoomIn, ZoomOut } from "lucide-react";
14
15
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
15
16
  import { Link as Link$1, NavLink, useHref, useNavigate, useSearchParams } from "react-router";
16
17
  import { hashKey, useInfiniteQuery, useQuery, useQueryClient } from "@tanstack/react-query";
@@ -2368,7 +2369,7 @@ const LOOKS$2 = {
2368
2369
  },
2369
2370
  blocked: {
2370
2371
  tone: "neutral",
2371
- icon: Clock
2372
+ icon: Clock$1
2372
2373
  }
2373
2374
  };
2374
2375
  function wordOf(stage, words) {
@@ -2500,7 +2501,7 @@ function summariseWorkflow(stages, { running = false } = {}) {
2500
2501
  const SUMMARY_LOOKS = {
2501
2502
  running: {
2502
2503
  tone: "info",
2503
- icon: Clock,
2504
+ icon: Clock$1,
2504
2505
  word: (w) => w.running
2505
2506
  },
2506
2507
  failed: {
@@ -3306,7 +3307,7 @@ function TableSkeleton({ rows = 4, columns = 5 }) {
3306
3307
  const LOOKS$1 = {
3307
3308
  queued: {
3308
3309
  tone: "neutral",
3309
- icon: Clock,
3310
+ icon: Clock$1,
3310
3311
  word: "Queued"
3311
3312
  },
3312
3313
  running: {
@@ -4434,20 +4435,20 @@ function useKeyOwner(enabled, playing = false) {
4434
4435
  }
4435
4436
 
4436
4437
  // src/components/media-group.tsx
4437
- const groups = /* @__PURE__ */ new Map();
4438
+ const groups$1 = /* @__PURE__ */ new Map();
4438
4439
  /** Adds an element, or a `useTimeline` clock, to a named group until the returned function is called; whenever one plays, the others pause. */
4439
4440
  function joinMediaGroup(name, el) {
4440
- let members = groups.get(name);
4441
- if (!members) groups.set(name, members = /* @__PURE__ */ new Set());
4441
+ let members = groups$1.get(name);
4442
+ if (!members) groups$1.set(name, members = /* @__PURE__ */ new Set());
4442
4443
  members.add(el);
4443
4444
  const onPlay = () => {
4444
- for (const other of groups.get(name) ?? []) if (other !== el && !other.paused) other.pause();
4445
+ for (const other of groups$1.get(name) ?? []) if (other !== el && !other.paused) other.pause();
4445
4446
  };
4446
4447
  el.addEventListener("play", onPlay);
4447
4448
  return () => {
4448
4449
  el.removeEventListener("play", onPlay);
4449
4450
  members.delete(el);
4450
- if (members.size === 0 && groups.get(name) === members) groups.delete(name);
4451
+ if (members.size === 0 && groups$1.get(name) === members) groups$1.delete(name);
4451
4452
  };
4452
4453
  }
4453
4454
  const GroupContext = React.createContext(null);
@@ -23637,6 +23638,106 @@ function FolderPicker({ label, useFolders: useListing, value, onChange, onChoose
23637
23638
  }
23638
23639
 
23639
23640
  // src/components/clock-face.tsx
23641
+ /** Every analogue face, in the order a gallery shows them. */
23642
+ const CLOCK_FACE_STYLES = [
23643
+ "teaching",
23644
+ "railway",
23645
+ "classic",
23646
+ "bauhaus",
23647
+ "aviator",
23648
+ "modern",
23649
+ "minimal"
23650
+ ];
23651
+ const PRESETS = {
23652
+ teaching: {
23653
+ numerals: "arabic",
23654
+ numbers: "all",
23655
+ marks: "minutes",
23656
+ hands: "teaching",
23657
+ minuteNumbers: false,
23658
+ rim: "plain",
23659
+ numeralSize: 20,
23660
+ numeralWeight: "font-semibold",
23661
+ pip: false
23662
+ },
23663
+ railway: {
23664
+ numerals: "none",
23665
+ numbers: "all",
23666
+ marks: "bars",
23667
+ hands: "railway",
23668
+ minuteNumbers: false,
23669
+ rim: "bold",
23670
+ numeralSize: 20,
23671
+ numeralWeight: "font-semibold",
23672
+ pip: false
23673
+ },
23674
+ classic: {
23675
+ numerals: "roman",
23676
+ numbers: "all",
23677
+ marks: "track",
23678
+ hands: "breguet",
23679
+ minuteNumbers: false,
23680
+ rim: "double",
23681
+ numeralSize: 15,
23682
+ numeralWeight: "font-normal",
23683
+ pip: false
23684
+ },
23685
+ bauhaus: {
23686
+ numerals: "arabic",
23687
+ numbers: "all",
23688
+ marks: "minutes",
23689
+ hands: "stick",
23690
+ minuteNumbers: false,
23691
+ rim: "thin",
23692
+ numeralSize: 13,
23693
+ numeralWeight: "font-normal",
23694
+ pip: false
23695
+ },
23696
+ aviator: {
23697
+ numerals: "arabic",
23698
+ numbers: "all",
23699
+ marks: "minutes",
23700
+ hands: "sword",
23701
+ minuteNumbers: true,
23702
+ rim: "bold",
23703
+ numeralSize: 21,
23704
+ numeralWeight: "font-bold",
23705
+ pip: true
23706
+ },
23707
+ modern: {
23708
+ numerals: "none",
23709
+ numbers: "all",
23710
+ marks: "dots",
23711
+ hands: "baton",
23712
+ minuteNumbers: false,
23713
+ rim: "none",
23714
+ numeralSize: 20,
23715
+ numeralWeight: "font-semibold",
23716
+ pip: false
23717
+ },
23718
+ minimal: {
23719
+ numerals: "none",
23720
+ numbers: "all",
23721
+ marks: "none",
23722
+ hands: "stick",
23723
+ minuteNumbers: false,
23724
+ rim: "thin",
23725
+ numeralSize: 20,
23726
+ numeralWeight: "font-semibold",
23727
+ pip: false
23728
+ }
23729
+ };
23730
+ /** The parts a face is drawn from, once a preset and the props that override it are put together. */
23731
+ function clockParts(face = "teaching", over = {}) {
23732
+ const p = PRESETS[face];
23733
+ return {
23734
+ numerals: over.numerals ?? p.numerals,
23735
+ numbers: over.numbers ?? p.numbers,
23736
+ marks: over.marks ?? p.marks,
23737
+ hands: over.hands ?? p.hands,
23738
+ minuteNumbers: over.minuteNumbers ?? p.minuteNumbers
23739
+ };
23740
+ }
23640
23741
  const WORDS = [
23641
23742
  "twelve",
23642
23743
  "one",
@@ -23685,111 +23786,961 @@ function minuteWord(n) {
23685
23786
  if (n <= 20) return NUMBER_WORDS[n] ?? String(n);
23686
23787
  return `twenty-${NUMBER_WORDS[n - 20]}`;
23687
23788
  }
23789
+ /** The part of the day a 24-hour time falls in, as `clockWords` says it with `dayPart`. */
23790
+ function dayPart(hours) {
23791
+ const h = (Math.floor(hours) % 24 + 24) % 24;
23792
+ if (h >= 5 && h < 12) return "morning";
23793
+ if (h >= 12 && h < 18) return "afternoon";
23794
+ if (h >= 18 && h < 22) return "evening";
23795
+ return "night";
23796
+ }
23688
23797
  /**
23689
23798
  * A time as it is said in UK English on a 12-hour clock: "three o'clock", "half past three", "quarter to four",
23690
23799
  * "twenty-five past three", "seven minutes to four". The words a clock round speaks and a `ClockFace` is named by.
23800
+ * With `dayPart`, the hours are read as 0 to 23: "half past three in the afternoon", "twelve o'clock midnight".
23691
23801
  */
23692
- function clockWords(hours, minutes) {
23802
+ function clockWords(hours, minutes, options = {}) {
23693
23803
  const m = (Math.round(minutes) % 60 + 60) % 60;
23694
23804
  const hour = (n) => WORDS[(n % 12 + 12) % 12];
23695
- if (m === 0) return `${hour(hours)} o’clock`;
23696
- if (m === 30) return `half past ${hour(hours)}`;
23697
- const past = m < 30;
23698
- const n = past ? m : 60 - m;
23699
- const amount = n === 15 ? "quarter" : MINUTE_WORDS[n] ?? `${minuteWord(n)} minute${n === 1 ? "" : "s"}`;
23700
- return past ? `${amount} past ${hour(hours)}` : `${amount} to ${hour(hours + 1)}`;
23805
+ let said;
23806
+ if (m === 0) said = `${hour(hours)} o’clock`;
23807
+ else if (m === 30) said = `half past ${hour(hours)}`;
23808
+ else {
23809
+ const past = m < 30;
23810
+ const n = past ? m : 60 - m;
23811
+ const amount = n === 15 ? "quarter" : MINUTE_WORDS[n] ?? `${minuteWord(n)} minute${n === 1 ? "" : "s"}`;
23812
+ said = past ? `${amount} past ${hour(hours)}` : `${amount} to ${hour(hours + 1)}`;
23813
+ }
23814
+ if (!options.dayPart) return said;
23815
+ const h = (Math.floor(hours) % 24 + 24) % 24;
23816
+ if (m === 0 && h === 12) return `${said} midday`;
23817
+ if (m === 0 && h === 0) return `${said} midnight`;
23818
+ const part = dayPart(h);
23819
+ return part === "night" ? `${said} at night` : `${said} in the ${part}`;
23820
+ }
23821
+ const ROMAN = [
23822
+ "XII",
23823
+ "I",
23824
+ "II",
23825
+ "III",
23826
+ "IIII",
23827
+ "V",
23828
+ "VI",
23829
+ "VII",
23830
+ "VIII",
23831
+ "IX",
23832
+ "X",
23833
+ "XI"
23834
+ ];
23835
+ /** A clock dial's Roman numeral for an hour, 1 to 12 (IIII at four, as dials write it, not IV). */
23836
+ function romanHour(n) {
23837
+ return ROMAN[(n % 12 + 12) % 12];
23701
23838
  }
23702
23839
  const C = 100;
23703
23840
  /** A point `r` from the centre at `deg` clockwise from 12. */
23704
23841
  function at(deg, r) {
23705
23842
  const a = (deg - 90) * Math.PI / 180;
23706
23843
  return {
23707
- x: C + r * Math.cos(a),
23708
- y: C + r * Math.sin(a)
23844
+ x: 100 + r * Math.cos(a),
23845
+ y: 100 + r * Math.sin(a)
23709
23846
  };
23710
23847
  }
23711
- /** An analogue clock showing one time, its hands telling hours from minutes by length, width and colour. */
23712
- function ClockFace({ hours, minutes, label, numbers = "all", minuteMarks = true, className }) {
23848
+ /** The angles the hands point at, clockwise from 12: the hour hand between the numbers as the minutes pass. */
23849
+ function handAngles(hours, minutes, seconds = 0) {
23713
23850
  const m = (minutes % 60 + 60) % 60;
23714
- const hourAngle = (hours % 12 + 12) % 12 * 30 + m / 2;
23715
- const minuteAngle = m * 6;
23716
- const shown = (n) => numbers === "all" || numbers === "quarters" && n % 3 === 0;
23717
- const marks = Array.from({ length: minuteMarks ? 60 : 12 }, (_, i) => minuteMarks ? i : i * 5);
23718
- const hand = (deg, length) => {
23719
- const tip = at(deg, length);
23720
- const tail = at(deg + 180, 10);
23721
- return {
23722
- x1: tail.x,
23723
- y1: tail.y,
23724
- x2: tip.x,
23725
- y2: tip.y
23726
- };
23727
- };
23728
- return /* @__PURE__ */ jsxs("svg", {
23729
- viewBox: "0 0 200 200",
23730
- role: "img",
23731
- "aria-label": label ?? clockWords(hours, minutes),
23732
- className: cn("block aspect-square w-48", className),
23851
+ const s = (seconds % 60 + 60) % 60;
23852
+ return {
23853
+ hour: (hours % 12 + 12) % 12 * 30 + m / 2,
23854
+ minute: m * 6,
23855
+ second: s * 6
23856
+ };
23857
+ }
23858
+ /** Points along a hand drawn pointing at 12, `from` below the centre to `to` above it, as an SVG polygon. */
23859
+ const poly = (pts) => pts.map(([x, y]) => `${100 + x},${100 - y}`).join(" ");
23860
+ /** One hand drawn pointing at 12 (the group around it turns it): its shape by style, ink by role. */
23861
+ function handShape(style, which) {
23862
+ const hour = which === "hour";
23863
+ switch (style) {
23864
+ case "teaching": return /* @__PURE__ */ jsx("line", {
23865
+ x1: 100,
23866
+ y1: 110,
23867
+ x2: 100,
23868
+ y2: 100 - (hour ? 38 : 58),
23869
+ strokeWidth: hour ? 9 : 5,
23870
+ strokeLinecap: "round",
23871
+ className: hour ? "stroke-foreground" : "stroke-primary"
23872
+ });
23873
+ case "railway": {
23874
+ const [tail, tip, base, end] = hour ? [
23875
+ 20,
23876
+ 54,
23877
+ 6,
23878
+ 4.5
23879
+ ] : [
23880
+ 22,
23881
+ 84,
23882
+ 4.5,
23883
+ 3.25
23884
+ ];
23885
+ return /* @__PURE__ */ jsx("polygon", {
23886
+ points: poly([
23887
+ [-base, -tail],
23888
+ [base, -tail],
23889
+ [end, tip],
23890
+ [-end, tip]
23891
+ ]),
23892
+ className: "fill-foreground"
23893
+ });
23894
+ }
23895
+ case "breguet": {
23896
+ const [len, ring] = hour ? [46, 30] : [74, 52];
23897
+ return /* @__PURE__ */ jsxs("g", {
23898
+ className: "stroke-foreground",
23899
+ children: [
23900
+ /* @__PURE__ */ jsx("line", {
23901
+ x1: 100,
23902
+ y1: 114,
23903
+ x2: 100,
23904
+ y2: 100 - ring + 5,
23905
+ strokeWidth: 2.5,
23906
+ strokeLinecap: "round"
23907
+ }),
23908
+ /* @__PURE__ */ jsx("circle", {
23909
+ cx: 100,
23910
+ cy: 100 - ring,
23911
+ r: 5,
23912
+ strokeWidth: 2.2,
23913
+ className: "fill-card"
23914
+ }),
23915
+ /* @__PURE__ */ jsx("line", {
23916
+ x1: 100,
23917
+ y1: 100 - ring - 5,
23918
+ x2: 100,
23919
+ y2: 100 - len,
23920
+ strokeWidth: hour ? 2.5 : 1.8,
23921
+ strokeLinecap: "round"
23922
+ })
23923
+ ]
23924
+ });
23925
+ }
23926
+ case "sword": {
23927
+ const [len, w] = hour ? [46, 6] : [74, 4.5];
23928
+ return /* @__PURE__ */ jsx("polygon", {
23929
+ points: poly([
23930
+ [0, -12],
23931
+ [w, len * .3],
23932
+ [0, len],
23933
+ [-w, len * .3]
23934
+ ]),
23935
+ className: "fill-foreground"
23936
+ });
23937
+ }
23938
+ case "baton": return /* @__PURE__ */ jsx("line", {
23939
+ x1: 100,
23940
+ y1: 108,
23941
+ x2: 100,
23942
+ y2: 100 - (hour ? 48 : 74),
23943
+ strokeWidth: hour ? 8 : 6,
23944
+ strokeLinecap: "round",
23945
+ className: "stroke-foreground"
23946
+ });
23947
+ case "stick": return /* @__PURE__ */ jsx("line", {
23948
+ x1: 100,
23949
+ y1: 112,
23950
+ x2: 100,
23951
+ y2: 100 - (hour ? 50 : 80),
23952
+ strokeWidth: hour ? 4.5 : 3,
23953
+ strokeLinecap: "butt",
23954
+ className: "stroke-foreground"
23955
+ });
23956
+ }
23957
+ }
23958
+ /** The second hand: the railway clock's red disc, a fine accent line on any other face. */
23959
+ function secondShape(style) {
23960
+ if (style === "railway") return /* @__PURE__ */ jsxs("g", {
23961
+ className: "fill-danger stroke-danger",
23733
23962
  children: [
23963
+ /* @__PURE__ */ jsx("line", {
23964
+ x1: 100,
23965
+ y1: 126,
23966
+ x2: 100,
23967
+ y2: 42,
23968
+ strokeWidth: 2.5
23969
+ }),
23734
23970
  /* @__PURE__ */ jsx("circle", {
23735
- cx: C,
23736
- cy: C,
23737
- r: 94,
23738
- strokeWidth: 6,
23739
- className: "fill-card stroke-border"
23971
+ cx: 100,
23972
+ cy: 42,
23973
+ r: 9.5
23740
23974
  }),
23741
- marks.map((i) => {
23975
+ /* @__PURE__ */ jsx("circle", {
23976
+ cx: 100,
23977
+ cy: 100,
23978
+ r: 3.5
23979
+ })
23980
+ ]
23981
+ });
23982
+ return /* @__PURE__ */ jsxs("g", {
23983
+ className: "fill-accent stroke-accent",
23984
+ children: [/* @__PURE__ */ jsx("line", {
23985
+ x1: 100,
23986
+ y1: 118,
23987
+ x2: 100,
23988
+ y2: 16,
23989
+ strokeWidth: 1.4
23990
+ }), /* @__PURE__ */ jsx("circle", {
23991
+ cx: 100,
23992
+ cy: 100,
23993
+ r: 3
23994
+ })]
23995
+ });
23996
+ }
23997
+ /** A hand of a `ClockFace` or `SetClock`, turned to its angle: what `data-hand` and `data-angle` mark for tests. */
23998
+ function ClockHand({ which, style, angle }) {
23999
+ return /* @__PURE__ */ jsx("g", {
24000
+ "data-hand": which,
24001
+ "data-angle": angle,
24002
+ transform: `rotate(${angle} ${100} ${100})`,
24003
+ children: which === "second" ? secondShape(style) : handShape(style, which)
24004
+ });
24005
+ }
24006
+ /** The hub over the hands' ends: a cap in the hands' own ink. */
24007
+ function ClockHub({ hands }) {
24008
+ if (hands === "railway") return /* @__PURE__ */ jsx("circle", {
24009
+ cx: 100,
24010
+ cy: 100,
24011
+ r: 4,
24012
+ className: "fill-foreground"
24013
+ });
24014
+ if (hands === "breguet") return /* @__PURE__ */ jsx("circle", {
24015
+ cx: 100,
24016
+ cy: 100,
24017
+ r: 4,
24018
+ strokeWidth: 1.5,
24019
+ className: "fill-card stroke-foreground"
24020
+ });
24021
+ if (hands === "stick" || hands === "sword") return /* @__PURE__ */ jsx("circle", {
24022
+ cx: 100,
24023
+ cy: 100,
24024
+ r: 4.5,
24025
+ className: "fill-foreground"
24026
+ });
24027
+ return /* @__PURE__ */ jsx("circle", {
24028
+ cx: 100,
24029
+ cy: 100,
24030
+ r: 7,
24031
+ className: "fill-foreground"
24032
+ });
24033
+ }
24034
+ /** The rim and the face it holds. */
24035
+ function Rim({ rim }) {
24036
+ switch (rim) {
24037
+ case "plain": return /* @__PURE__ */ jsx("circle", {
24038
+ cx: 100,
24039
+ cy: 100,
24040
+ r: 94,
24041
+ strokeWidth: 6,
24042
+ className: "fill-card stroke-border"
24043
+ });
24044
+ case "bold": return /* @__PURE__ */ jsx("circle", {
24045
+ cx: 100,
24046
+ cy: 100,
24047
+ r: 94,
24048
+ strokeWidth: 6,
24049
+ className: "fill-card stroke-foreground"
24050
+ });
24051
+ case "double": return /* @__PURE__ */ jsxs("g", {
24052
+ className: "stroke-foreground",
24053
+ children: [/* @__PURE__ */ jsx("circle", {
24054
+ cx: 100,
24055
+ cy: 100,
24056
+ r: 95,
24057
+ strokeWidth: 2.5,
24058
+ className: "fill-card"
24059
+ }), /* @__PURE__ */ jsx("circle", {
24060
+ cx: 100,
24061
+ cy: 100,
24062
+ r: 91,
24063
+ strokeWidth: .8,
24064
+ fill: "none"
24065
+ })]
24066
+ });
24067
+ case "thin": return /* @__PURE__ */ jsx("circle", {
24068
+ cx: 100,
24069
+ cy: 100,
24070
+ r: 95,
24071
+ strokeWidth: 1.5,
24072
+ className: "fill-card stroke-foreground"
24073
+ });
24074
+ case "none": return /* @__PURE__ */ jsx("circle", {
24075
+ cx: 100,
24076
+ cy: 100,
24077
+ r: 96,
24078
+ className: "fill-muted"
24079
+ });
24080
+ }
24081
+ }
24082
+ /** The marks round the rim, each tagged `data-mark` with what it marks. */
24083
+ function Marks({ marks }) {
24084
+ if (marks === "none") return null;
24085
+ if (marks === "dots") return /* @__PURE__ */ jsx("g", {
24086
+ className: "fill-foreground",
24087
+ children: Array.from({ length: 12 }, (_, i) => {
24088
+ const p = at(i * 30, 84);
24089
+ return /* @__PURE__ */ jsx("circle", {
24090
+ "data-mark": "hour",
24091
+ cx: p.x,
24092
+ cy: p.y,
24093
+ r: i % 3 === 0 ? 5 : 3.2
24094
+ }, i);
24095
+ })
24096
+ });
24097
+ if (marks === "bars") return /* @__PURE__ */ jsx("g", {
24098
+ className: "fill-foreground",
24099
+ children: Array.from({ length: 60 }, (_, i) => {
24100
+ const hourMark = i % 5 === 0;
24101
+ const [w, from, to] = hourMark ? [
24102
+ 7,
24103
+ 62,
24104
+ 89
24105
+ ] : [
24106
+ 2.6,
24107
+ 81,
24108
+ 89
24109
+ ];
24110
+ return /* @__PURE__ */ jsx("rect", {
24111
+ "data-mark": hourMark ? "hour" : "minute",
24112
+ x: 100 - w / 2,
24113
+ y: 100 - to,
24114
+ width: w,
24115
+ height: to - from,
24116
+ transform: `rotate(${i * 6} ${100} ${100})`
24117
+ }, i);
24118
+ })
24119
+ });
24120
+ if (marks === "track") return /* @__PURE__ */ jsxs("g", {
24121
+ className: "stroke-foreground",
24122
+ children: [
24123
+ /* @__PURE__ */ jsx("circle", {
24124
+ cx: 100,
24125
+ cy: 100,
24126
+ r: 87,
24127
+ strokeWidth: .8,
24128
+ fill: "none"
24129
+ }),
24130
+ /* @__PURE__ */ jsx("circle", {
24131
+ cx: 100,
24132
+ cy: 100,
24133
+ r: 80,
24134
+ strokeWidth: .8,
24135
+ fill: "none"
24136
+ }),
24137
+ Array.from({ length: 60 }, (_, i) => {
23742
24138
  const hourMark = i % 5 === 0;
23743
- const outer = at(i * 6, 89);
23744
- const inner = at(i * 6, hourMark ? 82 : 86);
24139
+ const outer = at(i * 6, 87);
24140
+ const inner = at(i * 6, 80);
23745
24141
  return /* @__PURE__ */ jsx("line", {
23746
24142
  "data-mark": hourMark ? "hour" : "minute",
23747
24143
  x1: outer.x,
23748
24144
  y1: outer.y,
23749
24145
  x2: inner.x,
23750
24146
  y2: inner.y,
23751
- strokeWidth: hourMark ? 3.5 : 1.5,
23752
- strokeLinecap: "round",
23753
- className: hourMark ? "stroke-foreground" : "stroke-muted-foreground"
24147
+ strokeWidth: hourMark ? 2.6 : .8
23754
24148
  }, i);
24149
+ })
24150
+ ]
24151
+ });
24152
+ const every = marks === "minutes";
24153
+ return /* @__PURE__ */ jsx("g", { children: Array.from({ length: every ? 60 : 12 }, (_, k) => every ? k : k * 5).map((i) => {
24154
+ const hourMark = i % 5 === 0;
24155
+ const outer = at(i * 6, 89);
24156
+ const inner = at(i * 6, hourMark ? 82 : 86);
24157
+ return /* @__PURE__ */ jsx("line", {
24158
+ "data-mark": hourMark ? "hour" : "minute",
24159
+ x1: outer.x,
24160
+ y1: outer.y,
24161
+ x2: inner.x,
24162
+ y2: inner.y,
24163
+ strokeWidth: hourMark ? 3.5 : 1.5,
24164
+ strokeLinecap: "round",
24165
+ className: hourMark ? "stroke-foreground" : "stroke-muted-foreground"
24166
+ }, i);
24167
+ }) });
24168
+ }
24169
+ /** The face without its hands: rim, marks, numerals, minute numbers. Shared with `SetClock`. */
24170
+ function ClockDial({ face = "teaching", parts }) {
24171
+ const preset = PRESETS[face];
24172
+ const shown = (n) => parts.numerals !== "none" && (parts.numbers === "all" || parts.numbers === "quarters" && n % 3 === 0) && !(preset.pip && n === 12);
24173
+ const radius = parts.marks === "track" ? 66 : parts.marks === "bars" ? 50 : 70;
24174
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
24175
+ /* @__PURE__ */ jsx(Rim, { rim: preset.rim }),
24176
+ /* @__PURE__ */ jsx(Marks, { marks: parts.marks }),
24177
+ preset.pip && parts.numerals !== "none" && /* @__PURE__ */ jsx("polygon", {
24178
+ "data-mark": "pip",
24179
+ points: `93,21 107,21 ${100},34`,
24180
+ className: "fill-foreground"
24181
+ }),
24182
+ Array.from({ length: 12 }, (_, i) => i + 1).filter(shown).map((n) => {
24183
+ const p = at(n * 30, radius);
24184
+ return /* @__PURE__ */ jsx("text", {
24185
+ x: p.x,
24186
+ y: p.y,
24187
+ textAnchor: "middle",
24188
+ dominantBaseline: "central",
24189
+ fontSize: parts.numerals === "roman" ? Math.min(preset.numeralSize, 15) : preset.numeralSize,
24190
+ className: cn("fill-foreground tabular-nums", preset.numeralWeight),
24191
+ children: parts.numerals === "roman" ? romanHour(n) : n
24192
+ }, n);
24193
+ }),
24194
+ parts.minuteNumbers && Array.from({ length: 12 }, (_, i) => i * 5).map((m) => {
24195
+ const p = at(m * 6, 108);
24196
+ return /* @__PURE__ */ jsx("text", {
24197
+ "data-minute-number": m,
24198
+ x: p.x,
24199
+ y: p.y,
24200
+ textAnchor: "middle",
24201
+ dominantBaseline: "central",
24202
+ fontSize: 12,
24203
+ className: "fill-muted-foreground tabular-nums",
24204
+ children: String(m).padStart(2, "0")
24205
+ }, `m${m}`);
24206
+ })
24207
+ ] });
24208
+ }
24209
+ /** The SVG box: wider when minute numbers are written outside the rim, so nothing inside shrinks. */
24210
+ const clockViewBox = (minuteNumbers) => minuteNumbers ? "-22 -22 244 244" : "0 0 200 200";
24211
+ /** An analogue clock showing one time, in a face people know (a classroom clock by default, its hands told apart). */
24212
+ function ClockFace({ hours, minutes, seconds, label, face = "teaching", numbers, numerals, marks, hands, minuteNumbers, minuteMarks, className }) {
24213
+ const preset = PRESETS[face];
24214
+ const parts = clockParts(face, {
24215
+ numbers,
24216
+ numerals,
24217
+ hands,
24218
+ minuteNumbers,
24219
+ marks: marks ?? (minuteMarks === false && preset.marks === "minutes" ? "hours" : void 0)
24220
+ });
24221
+ const angle = handAngles(hours, minutes, seconds);
24222
+ return /* @__PURE__ */ jsxs("svg", {
24223
+ viewBox: clockViewBox(parts.minuteNumbers),
24224
+ role: "img",
24225
+ "aria-label": label ?? clockWords(hours, minutes),
24226
+ "data-face": face,
24227
+ className: cn("block aspect-square w-48", className),
24228
+ children: [
24229
+ /* @__PURE__ */ jsx(ClockDial, {
24230
+ face,
24231
+ parts
23755
24232
  }),
23756
- Array.from({ length: 12 }, (_, i) => i + 1).filter(shown).map((n) => {
23757
- const p = at(n * 30, 70);
23758
- return /* @__PURE__ */ jsx("text", {
23759
- x: p.x,
23760
- y: p.y,
23761
- textAnchor: "middle",
23762
- dominantBaseline: "central",
23763
- fontSize: 20,
23764
- className: "fill-foreground font-semibold tabular-nums",
23765
- children: n
23766
- }, n);
24233
+ /* @__PURE__ */ jsx(ClockHand, {
24234
+ which: "hour",
24235
+ style: parts.hands,
24236
+ angle: angle.hour
23767
24237
  }),
23768
- /* @__PURE__ */ jsx("line", {
23769
- "data-hand": "hour",
23770
- "data-angle": hourAngle,
23771
- ...hand(hourAngle, 38),
23772
- strokeWidth: 9,
23773
- strokeLinecap: "round",
23774
- className: "stroke-foreground"
24238
+ /* @__PURE__ */ jsx(ClockHand, {
24239
+ which: "minute",
24240
+ style: parts.hands,
24241
+ angle: angle.minute
23775
24242
  }),
23776
- /* @__PURE__ */ jsx("line", {
23777
- "data-hand": "minute",
23778
- "data-angle": minuteAngle,
23779
- ...hand(minuteAngle, 58),
23780
- strokeWidth: 5,
23781
- strokeLinecap: "round",
23782
- className: "stroke-primary"
24243
+ seconds !== void 0 && /* @__PURE__ */ jsx(ClockHand, {
24244
+ which: "second",
24245
+ style: parts.hands,
24246
+ angle: angle.second
23783
24247
  }),
23784
- /* @__PURE__ */ jsx("circle", {
23785
- cx: C,
23786
- cy: C,
23787
- r: 7,
23788
- className: "fill-foreground"
23789
- })
24248
+ /* @__PURE__ */ jsx(ClockHub, { hands: parts.hands })
23790
24249
  ]
23791
24250
  });
23792
24251
  }
23793
24252
 
23794
- export { ActiveList, Alert, AlertDialog, AppShell, AsyncButton, BRUSHES, BookViewer, BoxList, BoxOverlay, BoxedPicture, Breadcrumb, BulkBar, Button, ButtonLink, ByteView, COLOR_SCHEME_STORAGE_KEY, Checkbox, ChoiceGrid, ChoiceGridSkeleton, ChoiceGroup, ClipsProvider, ClockFace, ColorField, ColorSchemeChoice, CommandLegend, CommandMenu, Compare, CompareAudio, CompareGrid, CompareText, CompareVideo, CompareVideoGrid, Composer, CompositionBar, Concealed, Console, ContextMenu, Conversation, CursorScope, DEFAULT_PALETTE, DEFAULT_TOLERANCE, DataTable, DataView$1 as DataView, Density, Dialog, Disclosure, Done, DragSource, DrawingLayer, DrawingToolbar, EditListPlayer, EmptyState, EventLog, FIT, Field, FileButton, FileDropOverlay, FileDropZone, FileOutcomes, FilmStrip, FolderPicker, FullscreenFrame, Glimpse, HttpError, INK_COLOURS, IconButton, InfiniteList, Input, InputLevel, Inspector, InspectorSection, JobStatus, JobsTable, KeysLegend, LEVEL_FLOOR_DB, Lightbox, LineChart, LineChartGroup, LinkCard, LinkCardList, ListeningLevel, LoadError, LoadMore, MAX_SCALE, MAX_SIDE, MIN_SCALE, MISSING, Mark, MarkSummary, MarkableText, MediaContents, MediaGroup, MediaPlayer, MediaStage, Menu, Meter, Metric, MetricStrip, MicrophoneContext, MicrophoneError, MissingFile, NBSP, NativeSelect, NumberField, OutboxStatus, PALETTE_STORAGE_KEY, PageHeader, PairJudge, PairVote, PaletteChoice, Pane, PauseButton, PixelImage, PlaceBoard, PlayWindowButton, PlayerNotice, Popover, PropertyList, PropertyRow, RangeSlider, RateChoice, ReadAlong, RegionEditor, RichText, RowAction, SPEECH_RATES, STRATA_DRAG_TYPE, SaveStatus, SayAgain, SayPicture, ScheduleTable, SecretField, SeekBar, SelectableGrid, SelectableGridSkeleton, SequenceTimeline, ShortcutEditor, SideNav, Skeleton, Slider, SortableList, SpanActions, SpanStrip, Split, StageGuides, StaleNotice, Status, StrataQueryProvider, StrataToastRegion, Switch, SystemPanel, TableSkeleton, Tabs, TakeLevel, TextLink, Textarea, ThemeProvider, Thumbnail, ThumbnailSkeleton, TileGrid, TileGridSkeleton, TimeReadout, Timeline, TimelinePlayer, TimelineZoomControls, Toggle, ToggleGroup, Toolbar, ToolbarSeparator, Tooltip, TranscriptView, Transport, Tree, UndoBar, ViewOptions, ViewportFrame, VirtualList, VolumeControl, Waveform, WorkflowSteps, WorkflowSummary, Workspace, WorkspaceBar, actualPixelsScale, ancestorsOf, apiPage, appBase, applyOp, boxViewport, browserMicrophone, buttonVariants, canFullscreen, canPlayClips, canSay, canSpeak, checkKey, clampToRoom, clampViewport, clipsQueryKey, clockWords, cn, colorSchemeScript, commandShortcut, continues, countMarks, createApi, createFormat, createOutbox, createQueryClient, createReserve, createSegmenter, createTypedApi, crossedThreshold, currentItem, currentOf, curvePoints, describeActionError, describeHttpError, describeRegion, describeWorkflowSummary, detectPlatform, diffWords, differences, diskThresholds, drawRect, drawingToSvg, ease, editTimeOf, editTimes, emptyDrawing, encodeWav, errorPayload, explainMicrophoneError, feedbackMarker, fetchJson, fieldErrorsOf, filterMarkup, findPage, fitPoints, fitRect, followAim, format, formatChord, frameAt, gainToVolume, geo, gridPoints, gutterOf, hitsStroke, inkMatch, inputLevelThresholds, invertOp, isDoubtful, isRefusal, isReservedChord, isSpeaking, isTaskRunning, isTypingTarget, isWorkflowRunning, jobProgressText, joinMediaGroup, joinRects, joinSamples, keyName, labelOf, lerpRect, locateInEdit, logScale, loudnessOf, marksFor, matchEntities, matchGains, matchesAccept, matchesChord, measureLoudness, mediaStatRows, moveGutter, movePoints, moveRect, newStrokeId, nextBreak, noOverlap, normaliseAngle, pageName, paletteScript, palettes, parentOf, parseChord, parseInline, parseRichText, parseSort, peakDb, peakGain, peaksFromAudio, phraseAt, phraseDoubtful, phraseOfWordId, pickEvenly, pickVoice, pixelZoom, plainText, pointsBox, rangeBetween, readErrorBody, readPixels, readingOrder, regionShares, regionStyle, replay, resample, resamplePeaks, rescaleDrawing, resizeRect, rgbaToBlob, rmsDb, safeHref, sayPosition, serialiseSort, settleCut, simplifyPoints, skipAction, smoothPath, snapToGrid, sortRows, speak, speechLevel, splitRect, staleOf, stepId, stepOnGrid, stopSpeaking, strokeAt, strokeBox, strokeShape, summariseWorkflow, textOf, tickLabel, tickStep, ticksBetween, toDate, toLoad, toPeakPair, toast, toastTimeout, transportShortcuts, turnRect, turnedSize, typeSteps, useActiveItem, useAsyncAction, useAttachedSource, useAutoRecorder, useAutoSave, useBookUrl, useBoxes, useChoices, useClientWork, useClips, useColorScheme, useCommands, useCountdown, useDifference, useDrawing, useEditList, useExpanded, useFileIntake, useHistory, useHistoryState, useHotkeys, useInView, useInfiniteLoad, useInkMatch, useJob, useJobAction, useLeaveGuard, useLightboxUrl, useLoad, useMediaElement, useMediaSpans, useMediaStats, useMicrophone, useObjectUrl, useOutbox, useOutboxStarted, usePalette, usePlayerWarnings, usePoll, useReadAloud, useRebindableShortcuts, useRecorder, useReserve, useRevealed, useSayOnShow, useSearchParam, useSelection, useSettledStatus, useSharedCursor, useSpeaking, useSpeech, useSystemColorScheme, useSystemInfo, useTimeline, useTimelineZoom, useUndoable, useViewOptions, useViewPointers, useViewport, useWheelZoom, useWorkflowRun, useWorkspaceState, valueAt, viewOf, viewsOf, widthsOf, withBase, wordAt, wordId, zoomAt, zoomToBox };
24253
+ // src/components/digital-clock.tsx
24254
+ /** Every digital face, in the order a gallery shows them. */
24255
+ const DIGITAL_CLOCK_STYLES = [
24256
+ "segments",
24257
+ "flip",
24258
+ "plain"
24259
+ ];
24260
+ const two = (n) => String(n).padStart(2, "0");
24261
+ /** The hour a clock shows: 1 to 12 on a 12-hour clock (0 is 12), 0 to 23 on a 24-hour one. */
24262
+ function shownHour(hours, hour12) {
24263
+ const h = (Math.floor(hours) % 24 + 24) % 24;
24264
+ return hour12 ? h % 12 || 12 : h;
24265
+ }
24266
+ /**
24267
+ * A time as a digital clock writes it: "3:45" on a 12-hour clock, "15:45" or "03:45" on a 24-hour one, "3:45 pm"
24268
+ * with `period`, "3:45:09" with `seconds`. Hours are 0 to 23, so 15 is "3:45 pm" and 0 is "12:00 am".
24269
+ */
24270
+ function digitalTime(hours, minutes, options = {}) {
24271
+ const { hour12 = true, period = false, seconds } = options;
24272
+ const h = shownHour(hours, hour12);
24273
+ const m = (Math.floor(minutes) % 60 + 60) % 60;
24274
+ const time = `${hour12 ? h : two(h)}:${two(m)}${seconds === void 0 ? "" : `:${two((seconds % 60 + 60) % 60)}`}`;
24275
+ if (!hour12 || !period) return time;
24276
+ return `${time} ${(Math.floor(hours) % 24 + 24) % 24 < 12 ? "am" : "pm"}`;
24277
+ }
24278
+ const DIGITS = {
24279
+ "0": "abcdef",
24280
+ "1": "bc",
24281
+ "2": "abged",
24282
+ "3": "abgcd",
24283
+ "4": "fgbc",
24284
+ "5": "afgcd",
24285
+ "6": "afgedc",
24286
+ "7": "abc",
24287
+ "8": "abcdefg",
24288
+ "9": "abcdfg"
24289
+ };
24290
+ const W = 40;
24291
+ const H = 72;
24292
+ const T = 8;
24293
+ /** A segment's hexagon: horizontal at height y from x0 to x1, or vertical at x from y0 to y1. */
24294
+ function segment(id) {
24295
+ const g = 1.5;
24296
+ const horizontal = (y) => {
24297
+ const x0 = 5.5;
24298
+ const x1 = W - T / 2 - g;
24299
+ return `${x0},${y} 9.5,${y - T / 2} ${x1 - T / 2},${y - T / 2} ${x1},${y} ${x1 - T / 2},${y + T / 2} 9.5,${y + T / 2}`;
24300
+ };
24301
+ const vertical = (x, y0, y1) => {
24302
+ const a = y0 + g;
24303
+ const b = y1 - g;
24304
+ return `${x},${a} ${x + T / 2},${a + T / 2} ${x + T / 2},${b - T / 2} ${x},${b} ${x - T / 2},${b - T / 2} ${x - T / 2},${a + T / 2}`;
24305
+ };
24306
+ const mid = H / 2;
24307
+ switch (id) {
24308
+ case "a": return horizontal(T / 2);
24309
+ case "g": return horizontal(mid);
24310
+ case "d": return horizontal(H - T / 2);
24311
+ case "f": return vertical(T / 2, T / 2, mid);
24312
+ case "b": return vertical(W - T / 2, T / 2, mid);
24313
+ case "e": return vertical(T / 2, mid, H - T / 2);
24314
+ default: return vertical(W - T / 2, mid, H - T / 2);
24315
+ }
24316
+ }
24317
+ /** One seven-segment digit at x: every segment drawn, the lit ones in ink and the rest faint, as on a real display. */
24318
+ function SegmentDigit({ digit, x }) {
24319
+ const lit = DIGITS[digit] ?? "";
24320
+ return /* @__PURE__ */ jsx("g", {
24321
+ "data-digit": digit,
24322
+ transform: `translate(${x} 0)`,
24323
+ children: [..."abcdefg"].map((s) => /* @__PURE__ */ jsx("polygon", {
24324
+ points: segment(s),
24325
+ "data-lit": lit.includes(s) || void 0,
24326
+ className: lit.includes(s) ? "fill-foreground" : "fill-muted"
24327
+ }, s))
24328
+ });
24329
+ }
24330
+ const Colon = ({ x, h, r }) => /* @__PURE__ */ jsxs("g", {
24331
+ className: "fill-foreground",
24332
+ children: [/* @__PURE__ */ jsx("circle", {
24333
+ cx: x,
24334
+ cy: h * .3,
24335
+ r
24336
+ }), /* @__PURE__ */ jsx("circle", {
24337
+ cx: x,
24338
+ cy: h * .7,
24339
+ r
24340
+ })]
24341
+ });
24342
+ /** The groups a clock writes, hours first: ["3", "45"] or ["15", "45", "09"]. */
24343
+ function groups(hours, minutes, hour12, seconds) {
24344
+ const h = shownHour(hours, hour12);
24345
+ const out = [hour12 ? String(h) : two(h), two((Math.floor(minutes) % 60 + 60) % 60)];
24346
+ if (seconds !== void 0) out.push(two((seconds % 60 + 60) % 60));
24347
+ return out;
24348
+ }
24349
+ /** A digital clock showing one time: seven segments, flip tiles or plain figures. */
24350
+ function DigitalClock({ hours, minutes, seconds, hour12 = true, period = false, label, face = "segments", className }) {
24351
+ const parts = groups(hours, minutes, hour12, seconds);
24352
+ const pm = (Math.floor(hours) % 24 + 24) % 24 >= 12 ? "pm" : "am";
24353
+ const showPeriod = hour12 && period;
24354
+ const name = label ?? digitalTime(hours, minutes, {
24355
+ hour12,
24356
+ period,
24357
+ seconds
24358
+ });
24359
+ let body;
24360
+ let width;
24361
+ let height;
24362
+ if (face === "segments") {
24363
+ const pad = 12;
24364
+ const step = 50;
24365
+ const colonW = 24;
24366
+ const items = [];
24367
+ let x = pad;
24368
+ parts.forEach((group, gi) => {
24369
+ if (gi > 0) {
24370
+ items.push(/* @__PURE__ */ jsx(Colon, {
24371
+ x: x + colonW / 2 - 5,
24372
+ h: H,
24373
+ r: 5
24374
+ }, `c${gi}`));
24375
+ x += colonW;
24376
+ }
24377
+ [...group.padStart(2, " ")].forEach((ch, ci) => {
24378
+ if (ch !== " ") items.push(/* @__PURE__ */ jsx(SegmentDigit, {
24379
+ digit: ch,
24380
+ x
24381
+ }, `${gi}-${ci}`));
24382
+ x += step;
24383
+ });
24384
+ });
24385
+ const periodW = showPeriod ? 44 : 0;
24386
+ if (showPeriod) items.push(/* @__PURE__ */ jsx("text", {
24387
+ x: x + 4,
24388
+ y: 18,
24389
+ fontSize: 18,
24390
+ className: "fill-foreground font-semibold uppercase",
24391
+ children: pm
24392
+ }, "p"));
24393
+ width = x + periodW + pad - 10;
24394
+ height = 96;
24395
+ body = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("rect", {
24396
+ x: 1,
24397
+ y: 1,
24398
+ width: width - 2,
24399
+ height: height - 2,
24400
+ rx: 12,
24401
+ strokeWidth: 2,
24402
+ className: "fill-card stroke-border"
24403
+ }), /* @__PURE__ */ jsx("g", {
24404
+ transform: `translate(0 ${pad}) skewX(-5)`,
24405
+ children: items
24406
+ })] });
24407
+ } else if (face === "flip") {
24408
+ const tileW = 100;
24409
+ const tileH = 104;
24410
+ width = parts.length * tileW + (parts.length - 1) * 10;
24411
+ height = tileH;
24412
+ body = parts.map((group, gi) => {
24413
+ const x = gi * 110;
24414
+ return /* @__PURE__ */ jsxs("g", {
24415
+ "data-tile": group,
24416
+ children: [
24417
+ /* @__PURE__ */ jsx("rect", {
24418
+ x,
24419
+ y: 0,
24420
+ width: tileW,
24421
+ height: tileH,
24422
+ rx: 12,
24423
+ className: "fill-foreground"
24424
+ }),
24425
+ /* @__PURE__ */ jsx("text", {
24426
+ x: x + tileW / 2,
24427
+ y: 54,
24428
+ textAnchor: "middle",
24429
+ dominantBaseline: "central",
24430
+ fontSize: 70,
24431
+ className: "fill-background font-semibold tabular-nums",
24432
+ children: group
24433
+ }),
24434
+ /* @__PURE__ */ jsx("line", {
24435
+ x1: x,
24436
+ y1: tileH / 2,
24437
+ x2: x + tileW,
24438
+ y2: tileH / 2,
24439
+ strokeWidth: 3,
24440
+ className: "stroke-card"
24441
+ }),
24442
+ gi === 0 && showPeriod && /* @__PURE__ */ jsx("text", {
24443
+ x: x + 9,
24444
+ y: 94,
24445
+ fontSize: 13,
24446
+ className: "fill-background font-semibold uppercase",
24447
+ children: pm
24448
+ })
24449
+ ]
24450
+ }, gi);
24451
+ });
24452
+ } else {
24453
+ const chars = parts.join(":");
24454
+ const items = [];
24455
+ let x = 0;
24456
+ for (const [i, ch] of [...chars].entries()) {
24457
+ const w = ch === ":" ? 20 : 40;
24458
+ items.push(/* @__PURE__ */ jsx("text", {
24459
+ x: x + w / 2,
24460
+ y: 44,
24461
+ textAnchor: "middle",
24462
+ dominantBaseline: "central",
24463
+ fontSize: 72,
24464
+ className: "fill-foreground font-semibold tabular-nums",
24465
+ children: ch
24466
+ }, i));
24467
+ x += w;
24468
+ }
24469
+ if (showPeriod) {
24470
+ items.push(/* @__PURE__ */ jsx("text", {
24471
+ x: x + 8,
24472
+ y: 68,
24473
+ fontSize: 26,
24474
+ className: "fill-muted-foreground font-semibold",
24475
+ children: pm
24476
+ }, "p"));
24477
+ x += 48;
24478
+ }
24479
+ width = x;
24480
+ height = 88;
24481
+ body = items;
24482
+ }
24483
+ return /* @__PURE__ */ jsx("svg", {
24484
+ viewBox: `0 0 ${width} ${height}`,
24485
+ role: "img",
24486
+ "aria-label": name,
24487
+ "data-face": face,
24488
+ className: cn("block w-56", className),
24489
+ children: body
24490
+ });
24491
+ }
24492
+
24493
+ // src/components/clock.tsx
24494
+ /** Every face `Clock` draws: the analogue faces, then the digital ones. */
24495
+ const CLOCK_STYLES = [...CLOCK_FACE_STYLES, ...DIGITAL_CLOCK_STYLES];
24496
+ /** Whether a face is digital. */
24497
+ const isDigitalStyle = (face) => DIGITAL_CLOCK_STYLES.includes(face);
24498
+ /** One time on a clock, analogue or digital, in a face people know: `face` picks which. */
24499
+ function Clock({ face = "teaching", hour12, period, ...props }) {
24500
+ if (isDigitalStyle(face)) return /* @__PURE__ */ jsx(DigitalClock, {
24501
+ hours: props.hours,
24502
+ minutes: props.minutes,
24503
+ seconds: props.seconds,
24504
+ label: props.label,
24505
+ className: props.className,
24506
+ face,
24507
+ hour12,
24508
+ period
24509
+ });
24510
+ return /* @__PURE__ */ jsx(ClockFace, {
24511
+ ...props,
24512
+ face
24513
+ });
24514
+ }
24515
+
24516
+ // src/components/set-clock.tsx
24517
+ const wrap12 = (h) => ((Math.round(h) - 1) % 12 + 12) % 12 + 1;
24518
+ const wrap60 = (m) => (Math.round(m) % 60 + 60) % 60;
24519
+ /** How far apart two angles are, the short way round. */
24520
+ const apart = (a, b) => {
24521
+ const d = Math.abs(((a - b) % 360 + 360) % 360);
24522
+ return Math.min(d, 360 - d);
24523
+ };
24524
+ /** The time with the minute hand moved to `minutes`, the hour carried when the hand passes 12 and `geared`. */
24525
+ function moveMinuteHand(time, minutes, geared = true) {
24526
+ const m = wrap60(minutes);
24527
+ let h = time.hours;
24528
+ if (geared && time.minutes >= 45 && m < 15) h += 1;
24529
+ if (geared && time.minutes < 15 && m >= 45) h -= 1;
24530
+ return {
24531
+ hours: wrap12(h),
24532
+ minutes: m
24533
+ };
24534
+ }
24535
+ /** The time with the minute hand stepped `by` minutes (a key press): through 12 into the next hour when `geared`. */
24536
+ function stepMinuteHand(time, by, geared = true) {
24537
+ if (!geared) return {
24538
+ hours: wrap12(time.hours),
24539
+ minutes: wrap60(time.minutes + by)
24540
+ };
24541
+ const total = time.hours * 60 + time.minutes + by;
24542
+ return {
24543
+ hours: wrap12(Math.floor(total / 60)),
24544
+ minutes: wrap60(total)
24545
+ };
24546
+ }
24547
+ /** The hour whose hand, at these minutes, points nearest `angle` (degrees clockwise from 12). */
24548
+ function hourAt(angle, minutes) {
24549
+ return wrap12(Math.round((angle - minutes / 2) / 30));
24550
+ }
24551
+ /** The minutes the minute hand shows at `angle`, snapped to `step`. */
24552
+ function minutesAt(angle, step = 5) {
24553
+ return wrap60(Math.round(angle / 6 / step) * step);
24554
+ }
24555
+ /** One hand as a slider: focus, keys and the ring that shows keyboard focus at its tip. */
24556
+ function HandSlider({ which, label, time, tip, isDisabled, onStep, onPage, handRef, children }) {
24557
+ const { focusProps, isFocusVisible } = useFocusRing();
24558
+ const { moveProps } = useMove({ onMove: (e) => {
24559
+ if (isDisabled || e.pointerType !== "keyboard") return;
24560
+ onStep(e.deltaX > 0 || e.deltaY < 0 ? 1 : -1);
24561
+ } });
24562
+ const onKeyDown = (e) => {
24563
+ if (isDisabled) return;
24564
+ if (e.key === "PageUp" || e.key === "PageDown") {
24565
+ e.preventDefault();
24566
+ onPage(e.key === "PageUp" ? 1 : -1);
24567
+ }
24568
+ };
24569
+ return /* @__PURE__ */ jsxs("g", {
24570
+ ref: handRef,
24571
+ role: "slider",
24572
+ tabIndex: isDisabled ? -1 : 0,
24573
+ "aria-label": label,
24574
+ "aria-disabled": isDisabled || void 0,
24575
+ "aria-orientation": "horizontal",
24576
+ "aria-valuemin": which === "hour" ? 1 : 0,
24577
+ "aria-valuemax": which === "hour" ? 12 : 59,
24578
+ "aria-valuenow": which === "hour" ? time.hours : time.minutes,
24579
+ "aria-valuetext": clockWords(time.hours, time.minutes),
24580
+ className: "outline-none",
24581
+ ...mergeProps(focusProps, isDisabled ? {} : moveProps, { onKeyDown }),
24582
+ children: [children, isFocusVisible && /* @__PURE__ */ jsx("circle", {
24583
+ cx: tip.x,
24584
+ cy: tip.y,
24585
+ r: 11,
24586
+ strokeWidth: 3,
24587
+ fill: "none",
24588
+ className: "stroke-ring"
24589
+ })]
24590
+ });
24591
+ }
24592
+ /** A clock whose hands are dragged, pressed or keyed to a time, geared as a real clock's are. */
24593
+ function SetClock({ value, onChange, step = 5, geared = true, face = "teaching", label = "Set the clock", handLabels = {
24594
+ hour: "Hour hand",
24595
+ minute: "Minute hand"
24596
+ }, isDisabled = false, className, ...over }) {
24597
+ const parts = clockParts(face, over);
24598
+ const time = {
24599
+ hours: wrap12(value.hours),
24600
+ minutes: wrap60(value.minutes)
24601
+ };
24602
+ const angle = handAngles(time.hours, time.minutes);
24603
+ const svgRef = useRef(null);
24604
+ const hourRef = useRef(null);
24605
+ const minuteRef = useRef(null);
24606
+ const [held, setHeld] = useState(null);
24607
+ const live = useRef(time);
24608
+ live.current = time;
24609
+ const point = (e) => {
24610
+ const svg = svgRef.current;
24611
+ if (!svg) return null;
24612
+ const box = svg.getBoundingClientRect();
24613
+ const [x0, , size] = clockViewBox(parts.minuteNumbers).split(" ").map(Number);
24614
+ const scale = size / (box.width || 1);
24615
+ const x = x0 + (e.clientX - box.left) * scale - 100;
24616
+ const y = x0 + (e.clientY - box.top) * scale - 100;
24617
+ return {
24618
+ angle: (Math.atan2(x, -y) * 180 / Math.PI + 360) % 360,
24619
+ radius: Math.hypot(x, y)
24620
+ };
24621
+ };
24622
+ const set = (next) => {
24623
+ if (next.hours !== live.current.hours || next.minutes !== live.current.minutes) {
24624
+ live.current = next;
24625
+ onChange(next);
24626
+ }
24627
+ };
24628
+ const drag = useRef(null);
24629
+ const moveHand = (which, to) => {
24630
+ const now = live.current;
24631
+ if (which === "hour") {
24632
+ set({
24633
+ hours: hourAt(to, now.minutes),
24634
+ minutes: now.minutes
24635
+ });
24636
+ return;
24637
+ }
24638
+ const was = drag.current;
24639
+ if (!was) {
24640
+ const next = moveMinuteHand(now, minutesAt(to, step), geared);
24641
+ const off = ((to / 6 - next.minutes) % 60 + 90) % 60 - 30;
24642
+ drag.current = {
24643
+ angle: to,
24644
+ total: next.hours * 60 + next.minutes + off
24645
+ };
24646
+ set(next);
24647
+ return;
24648
+ }
24649
+ const turned = ((to - was.angle) % 360 + 540) % 360 - 180;
24650
+ const total = was.total + turned / 6;
24651
+ drag.current = {
24652
+ angle: to,
24653
+ total
24654
+ };
24655
+ const snapped = Math.round(total / step) * step;
24656
+ set({
24657
+ hours: geared ? wrap12(Math.floor(snapped / 60)) : now.hours,
24658
+ minutes: wrap60(snapped)
24659
+ });
24660
+ };
24661
+ const onPointerDown = (e) => {
24662
+ if (isDisabled || e.pointerType === "mouse" && e.button !== 0) return;
24663
+ const p = point(e);
24664
+ if (!p) return;
24665
+ const which = apart(p.angle, angle.hour) - (p.radius < 50 ? 25 : 0) < apart(p.angle, angle.minute) ? "hour" : "minute";
24666
+ e.preventDefault();
24667
+ e.currentTarget.setPointerCapture?.(e.pointerId);
24668
+ drag.current = null;
24669
+ setHeld(which);
24670
+ (which === "hour" ? hourRef : minuteRef).current?.focus({ preventScroll: true });
24671
+ moveHand(which, p.angle);
24672
+ };
24673
+ const onPointerMove = (e) => {
24674
+ if (!held) return;
24675
+ const p = point(e);
24676
+ if (p) moveHand(held, p.angle);
24677
+ };
24678
+ const release = () => {
24679
+ drag.current = null;
24680
+ setHeld(null);
24681
+ };
24682
+ const tip = (which) => at(which === "hour" ? angle.hour : angle.minute, which === "hour" ? 40 : 64);
24683
+ return /* @__PURE__ */ jsx("div", {
24684
+ role: "group",
24685
+ "aria-label": label,
24686
+ "aria-disabled": isDisabled || void 0,
24687
+ className: cn("w-48", className),
24688
+ children: /* @__PURE__ */ jsxs("svg", {
24689
+ ref: svgRef,
24690
+ viewBox: clockViewBox(parts.minuteNumbers),
24691
+ "data-face": face,
24692
+ "data-held": held ?? void 0,
24693
+ className: cn("block aspect-square w-full touch-none select-none", isDisabled ? "" : "cursor-pointer"),
24694
+ onPointerDown,
24695
+ onPointerMove,
24696
+ onPointerUp: release,
24697
+ onPointerCancel: release,
24698
+ children: [
24699
+ /* @__PURE__ */ jsx(ClockDial, {
24700
+ face,
24701
+ parts
24702
+ }),
24703
+ /* @__PURE__ */ jsx(HandSlider, {
24704
+ which: "hour",
24705
+ label: handLabels.hour,
24706
+ time,
24707
+ tip: tip("hour"),
24708
+ isDisabled,
24709
+ handRef: hourRef,
24710
+ onStep: (d) => set({
24711
+ hours: wrap12(time.hours + d),
24712
+ minutes: time.minutes
24713
+ }),
24714
+ onPage: (d) => set({
24715
+ hours: wrap12(time.hours + 3 * d),
24716
+ minutes: time.minutes
24717
+ }),
24718
+ children: /* @__PURE__ */ jsx(ClockHand, {
24719
+ which: "hour",
24720
+ style: parts.hands,
24721
+ angle: angle.hour
24722
+ })
24723
+ }),
24724
+ /* @__PURE__ */ jsx(HandSlider, {
24725
+ which: "minute",
24726
+ label: handLabels.minute,
24727
+ time,
24728
+ tip: tip("minute"),
24729
+ isDisabled,
24730
+ handRef: minuteRef,
24731
+ onStep: (d) => set(stepMinuteHand(time, d * step, geared)),
24732
+ onPage: (d) => set(stepMinuteHand(time, d * 15, geared)),
24733
+ children: /* @__PURE__ */ jsx(ClockHand, {
24734
+ which: "minute",
24735
+ style: parts.hands,
24736
+ angle: angle.minute
24737
+ })
24738
+ }),
24739
+ /* @__PURE__ */ jsx(ClockHub, { hands: parts.hands })
24740
+ ]
24741
+ })
24742
+ });
24743
+ }
24744
+
24745
+ export { ActiveList, Alert, AlertDialog, AppShell, AsyncButton, BRUSHES, BookViewer, BoxList, BoxOverlay, BoxedPicture, Breadcrumb, BulkBar, Button, ButtonLink, ByteView, CLOCK_FACE_STYLES, CLOCK_STYLES, COLOR_SCHEME_STORAGE_KEY, Checkbox, ChoiceGrid, ChoiceGridSkeleton, ChoiceGroup, ClipsProvider, Clock, ClockFace, ColorField, ColorSchemeChoice, CommandLegend, CommandMenu, Compare, CompareAudio, CompareGrid, CompareText, CompareVideo, CompareVideoGrid, Composer, CompositionBar, Concealed, Console, ContextMenu, Conversation, CursorScope, DEFAULT_PALETTE, DEFAULT_TOLERANCE, DIGITAL_CLOCK_STYLES, DataTable, DataView$1 as DataView, Density, Dialog, DigitalClock, Disclosure, Done, DragSource, DrawingLayer, DrawingToolbar, EditListPlayer, EmptyState, EventLog, FIT, Field, FileButton, FileDropOverlay, FileDropZone, FileOutcomes, FilmStrip, FolderPicker, FullscreenFrame, Glimpse, HttpError, INK_COLOURS, IconButton, InfiniteList, Input, InputLevel, Inspector, InspectorSection, JobStatus, JobsTable, KeysLegend, LEVEL_FLOOR_DB, Lightbox, LineChart, LineChartGroup, LinkCard, LinkCardList, ListeningLevel, LoadError, LoadMore, MAX_SCALE, MAX_SIDE, MIN_SCALE, MISSING, Mark, MarkSummary, MarkableText, MediaContents, MediaGroup, MediaPlayer, MediaStage, Menu, Meter, Metric, MetricStrip, MicrophoneContext, MicrophoneError, MissingFile, NBSP, NativeSelect, NumberField, OutboxStatus, PALETTE_STORAGE_KEY, PageHeader, PairJudge, PairVote, PaletteChoice, Pane, PauseButton, PixelImage, PlaceBoard, PlayWindowButton, PlayerNotice, Popover, PropertyList, PropertyRow, RangeSlider, RateChoice, ReadAlong, RegionEditor, RichText, RowAction, SPEECH_RATES, STRATA_DRAG_TYPE, SaveStatus, SayAgain, SayPicture, ScheduleTable, SecretField, SeekBar, SelectableGrid, SelectableGridSkeleton, SequenceTimeline, SetClock, ShortcutEditor, SideNav, Skeleton, Slider, SortableList, SpanActions, SpanStrip, Split, StageGuides, StaleNotice, Status, StrataQueryProvider, StrataToastRegion, Switch, SystemPanel, TableSkeleton, Tabs, TakeLevel, TextLink, Textarea, ThemeProvider, Thumbnail, ThumbnailSkeleton, TileGrid, TileGridSkeleton, TimeReadout, Timeline, TimelinePlayer, TimelineZoomControls, Toggle, ToggleGroup, Toolbar, ToolbarSeparator, Tooltip, TranscriptView, Transport, Tree, UndoBar, ViewOptions, ViewportFrame, VirtualList, VolumeControl, Waveform, WorkflowSteps, WorkflowSummary, Workspace, WorkspaceBar, actualPixelsScale, ancestorsOf, apiPage, appBase, applyOp, boxViewport, browserMicrophone, buttonVariants, canFullscreen, canPlayClips, canSay, canSpeak, checkKey, clampToRoom, clampViewport, clipsQueryKey, clockParts, clockWords, cn, colorSchemeScript, commandShortcut, continues, countMarks, createApi, createFormat, createOutbox, createQueryClient, createReserve, createSegmenter, createTypedApi, crossedThreshold, currentItem, currentOf, curvePoints, dayPart, describeActionError, describeHttpError, describeRegion, describeWorkflowSummary, detectPlatform, diffWords, differences, digitalTime, diskThresholds, drawRect, drawingToSvg, ease, editTimeOf, editTimes, emptyDrawing, encodeWav, errorPayload, explainMicrophoneError, feedbackMarker, fetchJson, fieldErrorsOf, filterMarkup, findPage, fitPoints, fitRect, followAim, format, formatChord, frameAt, gainToVolume, geo, gridPoints, gutterOf, hitsStroke, hourAt, inkMatch, inputLevelThresholds, invertOp, isDigitalStyle, isDoubtful, isRefusal, isReservedChord, isSpeaking, isTaskRunning, isTypingTarget, isWorkflowRunning, jobProgressText, joinMediaGroup, joinRects, joinSamples, keyName, labelOf, lerpRect, locateInEdit, logScale, loudnessOf, marksFor, matchEntities, matchGains, matchesAccept, matchesChord, measureLoudness, mediaStatRows, minutesAt, moveGutter, moveMinuteHand, movePoints, moveRect, newStrokeId, nextBreak, noOverlap, normaliseAngle, pageName, paletteScript, palettes, parentOf, parseChord, parseInline, parseRichText, parseSort, peakDb, peakGain, peaksFromAudio, phraseAt, phraseDoubtful, phraseOfWordId, pickEvenly, pickVoice, pixelZoom, plainText, pointsBox, rangeBetween, readErrorBody, readPixels, readingOrder, regionShares, regionStyle, replay, resample, resamplePeaks, rescaleDrawing, resizeRect, rgbaToBlob, rmsDb, romanHour, safeHref, sayPosition, serialiseSort, settleCut, simplifyPoints, skipAction, smoothPath, snapToGrid, sortRows, speak, speechLevel, splitRect, staleOf, stepId, stepMinuteHand, stepOnGrid, stopSpeaking, strokeAt, strokeBox, strokeShape, summariseWorkflow, textOf, tickLabel, tickStep, ticksBetween, toDate, toLoad, toPeakPair, toast, toastTimeout, transportShortcuts, turnRect, turnedSize, typeSteps, useActiveItem, useAsyncAction, useAttachedSource, useAutoRecorder, useAutoSave, useBookUrl, useBoxes, useChoices, useClientWork, useClips, useColorScheme, useCommands, useCountdown, useDifference, useDrawing, useEditList, useExpanded, useFileIntake, useHistory, useHistoryState, useHotkeys, useInView, useInfiniteLoad, useInkMatch, useJob, useJobAction, useLeaveGuard, useLightboxUrl, useLoad, useMediaElement, useMediaSpans, useMediaStats, useMicrophone, useObjectUrl, useOutbox, useOutboxStarted, usePalette, usePlayerWarnings, usePoll, useReadAloud, useRebindableShortcuts, useRecorder, useReserve, useRevealed, useSayOnShow, useSearchParam, useSelection, useSettledStatus, useSharedCursor, useSpeaking, useSpeech, useSystemColorScheme, useSystemInfo, useTimeline, useTimelineZoom, useUndoable, useViewOptions, useViewPointers, useViewport, useWheelZoom, useWorkflowRun, useWorkspaceState, valueAt, viewOf, viewsOf, widthsOf, withBase, wordAt, wordId, zoomAt, zoomToBox };
23795
24746
  //# sourceMappingURL=index.js.map