@weasel-js/ui 1.0.0 → 1.0.2

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 (119) hide show
  1. package/dist/chunks/ActionsBar-9aR5N3lU.js +41 -0
  2. package/dist/chunks/ActionsBar-9aR5N3lU.js.map +1 -0
  3. package/dist/chunks/{Callout-CxxrEcSb.js → Callout-CFqG5xho.js} +1 -1
  4. package/dist/chunks/{Callout-CxxrEcSb.js.map → Callout-CFqG5xho.js.map} +1 -1
  5. package/dist/chunks/{Checkbox-Cf6YHVWV.js → Checkbox-KQ5L8APP.js} +1 -1
  6. package/dist/chunks/{Checkbox-Cf6YHVWV.js.map → Checkbox-KQ5L8APP.js.map} +1 -1
  7. package/dist/chunks/{ColorField-sGLnThpB.js → ColorField-ykpiD3XU.js} +1 -1
  8. package/dist/chunks/{ColorField-sGLnThpB.js.map → ColorField-ykpiD3XU.js.map} +1 -1
  9. package/dist/chunks/{ComboBox-EnV1IytN.js → ComboBox-DpxsFVBy.js} +2 -2
  10. package/dist/chunks/{ComboBox-EnV1IytN.js.map → ComboBox-DpxsFVBy.js.map} +1 -1
  11. package/dist/chunks/{CurveEditor-DAb2EMyR.js → CurveEditor-fRctbmoV.js} +1 -1
  12. package/dist/chunks/{CurveEditor-DAb2EMyR.js.map → CurveEditor-fRctbmoV.js.map} +1 -1
  13. package/dist/chunks/{Dialog-CQymDCAl.js → Dialog-3FCd_gYi.js} +1 -1
  14. package/dist/chunks/{Dialog-CQymDCAl.js.map → Dialog-3FCd_gYi.js.map} +1 -1
  15. package/dist/chunks/{Field-BHSu2F3E.js → Field-VQwmrIna.js} +1 -1
  16. package/dist/chunks/{Field-BHSu2F3E.js.map → Field-VQwmrIna.js.map} +1 -1
  17. package/dist/chunks/{GradientEditor-Co9aGyRe.js → GradientEditor-BL5kg7a_.js} +3 -3
  18. package/dist/chunks/{GradientEditor-Co9aGyRe.js.map → GradientEditor-BL5kg7a_.js.map} +1 -1
  19. package/dist/chunks/{Input-qk44ESKC.js → Input-DpkwYtUY.js} +2 -2
  20. package/dist/chunks/{Input-qk44ESKC.js.map → Input-DpkwYtUY.js.map} +1 -1
  21. package/dist/chunks/{NumberField-CYhQeWoM.js → NumberField-BbzI0GtU.js} +2 -2
  22. package/dist/chunks/{NumberField-CYhQeWoM.js.map → NumberField-BbzI0GtU.js.map} +1 -1
  23. package/dist/chunks/OptionsBar-CHvH4n4u.js +45 -0
  24. package/dist/chunks/OptionsBar-CHvH4n4u.js.map +1 -0
  25. package/dist/chunks/{PointPlotter-EkbCBK9j.js → PointPlotter-R8hguJPq.js} +2 -2
  26. package/dist/chunks/{PointPlotter-EkbCBK9j.js.map → PointPlotter-R8hguJPq.js.map} +1 -1
  27. package/dist/chunks/{Powerline-Bg9M5oBK.js → Powerline-Dd9Ukhcl.js} +1 -1
  28. package/dist/chunks/{Powerline-Bg9M5oBK.js.map → Powerline-Dd9Ukhcl.js.map} +1 -1
  29. package/dist/chunks/{Prefs-DZjXp2Ln.js → Prefs-lgI4x4jF.js} +10 -10
  30. package/dist/chunks/{Prefs-DZjXp2Ln.js.map → Prefs-lgI4x4jF.js.map} +1 -1
  31. package/dist/chunks/{RadioGroup-rL2i3afr.js → RadioGroup-CIpHr3g6.js} +2 -2
  32. package/dist/chunks/{RadioGroup-rL2i3afr.js.map → RadioGroup-CIpHr3g6.js.map} +1 -1
  33. package/dist/chunks/{RangeSlider-DPldYd4O.js → RangeSlider-CaDogGTj.js} +1 -1
  34. package/dist/chunks/{RangeSlider-DPldYd4O.js.map → RangeSlider-CaDogGTj.js.map} +1 -1
  35. package/dist/chunks/{ResizeHandle-DR8X229y.js → ResizeHandle-CCQ2y87y.js} +1 -1
  36. package/dist/chunks/{ResizeHandle-DR8X229y.js.map → ResizeHandle-CCQ2y87y.js.map} +1 -1
  37. package/dist/chunks/{Select-vSeAbspK.js → Select-BE3Y1NrH.js} +2 -2
  38. package/dist/chunks/{Select-vSeAbspK.js.map → Select-BE3Y1NrH.js.map} +1 -1
  39. package/dist/chunks/{SelectionPanel-1mmALQba.js → SelectionPanel-Zaw8tYQH.js} +6 -6
  40. package/dist/chunks/{SelectionPanel-1mmALQba.js.map → SelectionPanel-Zaw8tYQH.js.map} +1 -1
  41. package/dist/chunks/{Sidebar-CigrFvpL.js → Sidebar-DP_nyJze.js} +1 -1
  42. package/dist/chunks/{Sidebar-CigrFvpL.js.map → Sidebar-DP_nyJze.js.map} +1 -1
  43. package/dist/chunks/{SidebarPanel-C0w16BrF.js → SidebarPanel-BpD0ptyg.js} +1 -1
  44. package/dist/chunks/{SidebarPanel-C0w16BrF.js.map → SidebarPanel-BpD0ptyg.js.map} +1 -1
  45. package/dist/chunks/{StatusBar-lt_Ok6WK.js → StatusBar-DBO0E0Yd.js} +1 -1
  46. package/dist/chunks/{StatusBar-lt_Ok6WK.js.map → StatusBar-DBO0E0Yd.js.map} +1 -1
  47. package/dist/chunks/{Switch-BYj762hm.js → Switch-JyVSSAzC.js} +1 -1
  48. package/dist/chunks/{Switch-BYj762hm.js.map → Switch-JyVSSAzC.js.map} +1 -1
  49. package/dist/chunks/{Tabs-DOW5jtnq.js → Tabs-Df0sDomx.js} +1 -1
  50. package/dist/chunks/{Tabs-DOW5jtnq.js.map → Tabs-Df0sDomx.js.map} +1 -1
  51. package/dist/chunks/{Toast-DLM2AsTz.js → Toast-DFw4IrD_.js} +1 -1
  52. package/dist/chunks/{Toast-DLM2AsTz.js.map → Toast-DFw4IrD_.js.map} +1 -1
  53. package/dist/chunks/ToggleBar-BP1zFcvg.js +74 -0
  54. package/dist/chunks/ToggleBar-BP1zFcvg.js.map +1 -0
  55. package/dist/chunks/{ToolButton-5L1sAlJC.js → ToolButton-DpT-mukU.js} +6 -5
  56. package/dist/chunks/ToolButton-DpT-mukU.js.map +1 -0
  57. package/dist/chunks/{ToolGroup-BAthcF5H.js → ToolGroup-BTIwd4U4.js} +1 -1
  58. package/dist/chunks/{ToolGroup-BAthcF5H.js.map → ToolGroup-BTIwd4U4.js.map} +1 -1
  59. package/dist/chunks/{ToolOptionsBar-D4xmXa_a.js → ToolOptionsBar-JvmY7iNe.js} +1 -1
  60. package/dist/chunks/{ToolOptionsBar-D4xmXa_a.js.map → ToolOptionsBar-JvmY7iNe.js.map} +1 -1
  61. package/dist/chunks/{ToolPalette-BDkvV3pJ.js → ToolPalette-DPn0owno.js} +27 -47
  62. package/dist/chunks/ToolPalette-DPn0owno.js.map +1 -0
  63. package/dist/chunks/segmentedControl.module-DCyuDbj1.js +11 -0
  64. package/dist/chunks/segmentedControl.module-DCyuDbj1.js.map +1 -0
  65. package/dist/chunks/useRovingTabIndex-DBZtq4IH.js +65 -0
  66. package/dist/chunks/useRovingTabIndex-DBZtq4IH.js.map +1 -0
  67. package/dist/components/ActionsBar/ActionsBar.d.ts.map +1 -1
  68. package/dist/components/ActionsBar/index.js +1 -1
  69. package/dist/components/Callout/index.js +1 -1
  70. package/dist/components/Checkbox/index.js +1 -1
  71. package/dist/components/ColorField/index.js +1 -1
  72. package/dist/components/ComboBox/index.js +1 -1
  73. package/dist/components/CurveEditor/index.js +1 -1
  74. package/dist/components/Dialog/index.js +1 -1
  75. package/dist/components/Field/index.js +1 -1
  76. package/dist/components/GradientEditor/index.js +1 -1
  77. package/dist/components/Input/index.js +1 -1
  78. package/dist/components/NumberField/index.js +1 -1
  79. package/dist/components/OptionsBar/OptionsBar.d.ts.map +1 -1
  80. package/dist/components/OptionsBar/index.js +1 -1
  81. package/dist/components/PointPlotter/index.js +1 -1
  82. package/dist/components/Powerline/index.js +1 -1
  83. package/dist/components/Prefs/index.js +1 -1
  84. package/dist/components/RadioGroup/index.js +1 -1
  85. package/dist/components/RangeSlider/index.js +1 -1
  86. package/dist/components/ResizeHandle/index.js +1 -1
  87. package/dist/components/Select/index.js +1 -1
  88. package/dist/components/SelectionPanel/index.js +1 -1
  89. package/dist/components/Sidebar/index.js +1 -1
  90. package/dist/components/SidebarPanel/index.js +1 -1
  91. package/dist/components/StatusBar/index.js +1 -1
  92. package/dist/components/Switch/index.js +1 -1
  93. package/dist/components/Tabs/index.js +1 -1
  94. package/dist/components/Toast/index.js +1 -1
  95. package/dist/components/ToggleBar/ToggleBar.d.ts.map +1 -1
  96. package/dist/components/ToggleBar/index.js +1 -1
  97. package/dist/components/ToolButton/ToolButton.d.ts +4 -1
  98. package/dist/components/ToolButton/ToolButton.d.ts.map +1 -1
  99. package/dist/components/ToolButton/index.js +1 -1
  100. package/dist/components/ToolGroup/index.js +1 -1
  101. package/dist/components/ToolOptionsBar/index.js +1 -1
  102. package/dist/components/ToolPalette/ToolPalette.d.ts.map +1 -1
  103. package/dist/components/ToolPalette/index.js +1 -1
  104. package/dist/index.d.ts +2 -0
  105. package/dist/index.d.ts.map +1 -1
  106. package/dist/index.js +38 -37
  107. package/dist/index.js.map +1 -1
  108. package/dist/style.css +1 -1
  109. package/dist/useRovingTabIndex.d.ts +52 -0
  110. package/dist/useRovingTabIndex.d.ts.map +1 -0
  111. package/package.json +2 -2
  112. package/dist/chunks/ActionsBar-CzU6Of3B.js +0 -94
  113. package/dist/chunks/ActionsBar-CzU6Of3B.js.map +0 -1
  114. package/dist/chunks/OptionsBar-CHOP_CiW.js +0 -98
  115. package/dist/chunks/OptionsBar-CHOP_CiW.js.map +0 -1
  116. package/dist/chunks/ToggleBar-Defj6Asn.js +0 -129
  117. package/dist/chunks/ToggleBar-Defj6Asn.js.map +0 -1
  118. package/dist/chunks/ToolButton-5L1sAlJC.js.map +0 -1
  119. package/dist/chunks/ToolPalette-BDkvV3pJ.js.map +0 -1
@@ -1,129 +0,0 @@
1
- import { useRef as e } from "react";
2
- import { jsx as t } from "react/jsx-runtime";
3
- var n = {
4
- root: "_root_1pyfg_6",
5
- segment: "_segment_1pyfg_28",
6
- segmentSelected: "_segmentSelected_1pyfg_75",
7
- segmentMixed: "_segmentMixed_1pyfg_134",
8
- variant_minimal: "_variant_minimal_1pyfg_144",
9
- size_sm: "_size_sm_1pyfg_153"
10
- };
11
- //#endregion
12
- //#region src/components/ToggleBar/ToggleBar.tsx
13
- function r(e) {
14
- for (let t = 0; t < e.length; t++) if (!e[t].disabled) return t;
15
- return -1;
16
- }
17
- function i(e) {
18
- for (let t = e.length - 1; t >= 0; t--) if (!e[t].disabled) return t;
19
- return -1;
20
- }
21
- function a(e, t) {
22
- let n = e.length;
23
- for (let r = 1; r <= n; r++) {
24
- let i = (t + r + n) % n;
25
- if (!e[i].disabled) return i;
26
- }
27
- return t;
28
- }
29
- function o(e, t) {
30
- let n = e.length;
31
- for (let r = 1; r <= n; r++) {
32
- let i = (t - r + n) % n;
33
- if (!e[i].disabled) return i;
34
- }
35
- return t;
36
- }
37
- function s(s) {
38
- let { items: c, ariaLabel: l, className: u, height: d, size: f, variant: p } = s, m = s.mode ?? "single", h = e(null), g = (e) => m === "multiple" ? s.value.includes(e) : s.value === e, _ = (e) => {
39
- if (m !== "multiple") return !1;
40
- let t = s.mixedValues;
41
- return t !== void 0 && t.includes(e) && !g(e);
42
- }, v = -1;
43
- if (m === "single") {
44
- let e = c.findIndex((e) => e.value === s.value);
45
- v = e >= 0 && !c[e].disabled ? e : r(c);
46
- } else v = r(c);
47
- let y = (e) => () => {
48
- let t = c[e];
49
- if (!t.disabled) if (m === "multiple") {
50
- let e = s.value, n = e.includes(t.value) ? e.filter((e) => e !== t.value) : [...e, t.value];
51
- s.onChange(n);
52
- } else {
53
- if (s.value === t.value) {
54
- s.allowDeselect && s.onChange(null);
55
- return;
56
- }
57
- s.onChange(t.value);
58
- }
59
- }, b = (e) => {
60
- let t = h.current;
61
- t && t.querySelectorAll(`.${n.segment}`)[e]?.focus();
62
- }, x = (e) => (t) => {
63
- let n = -1;
64
- switch (t.key) {
65
- case "ArrowLeft":
66
- case "ArrowUp":
67
- n = o(c, e);
68
- break;
69
- case "ArrowRight":
70
- case "ArrowDown":
71
- n = a(c, e);
72
- break;
73
- case "Home":
74
- n = r(c);
75
- break;
76
- case "End":
77
- n = i(c);
78
- break;
79
- case " ":
80
- case "Enter":
81
- m === "multiple" && (t.preventDefault(), y(e)());
82
- return;
83
- default: return;
84
- }
85
- if (!(n < 0 || n === e)) {
86
- if (t.preventDefault(), m === "single") {
87
- let e = c[n];
88
- s.onChange(e.value);
89
- }
90
- b(n);
91
- }
92
- }, S = d === void 0 ? void 0 : { "--wzl-tb-height": `${d}px` };
93
- return /* @__PURE__ */ t("div", {
94
- ref: h,
95
- className: [
96
- n.root,
97
- f && n[`size_${f}`],
98
- p && n[`variant_${p}`],
99
- u
100
- ].filter(Boolean).join(" "),
101
- role: m === "multiple" ? "group" : "radiogroup",
102
- "aria-label": l,
103
- style: S,
104
- children: c.map((e, r) => {
105
- let i = g(e.value), a = _(e.value), o = [
106
- n.segment,
107
- i && n.segmentSelected,
108
- a && n.segmentMixed
109
- ].filter(Boolean).join(" ");
110
- return /* @__PURE__ */ t("button", {
111
- type: "button",
112
- role: m === "multiple" ? void 0 : "radio",
113
- "aria-checked": m === "multiple" ? void 0 : i,
114
- "aria-pressed": m === "multiple" ? a ? "mixed" : i : void 0,
115
- "aria-label": e.ariaLabel,
116
- disabled: e.disabled,
117
- tabIndex: r === v ? 0 : -1,
118
- className: o,
119
- onClick: y(r),
120
- onKeyDown: x(r),
121
- children: e.label
122
- }, e.value);
123
- })
124
- });
125
- }
126
- //#endregion
127
- export { s as t };
128
-
129
- //# sourceMappingURL=ToggleBar-Defj6Asn.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ToggleBar-Defj6Asn.js","names":[],"sources":["../../src/components/ToggleBar/ToggleBar.module.css","../../src/components/ToggleBar/ToggleBar.tsx"],"sourcesContent":["/* Aqua-glass segmented control. The track is a pill-shaped well; the\n selected segment becomes a tinted glass cylinder that reads as the same\n \"lozenge\" family as the standalone Button. Visual params come from the\n `--btn-*` custom properties (see Button.module.css) so the Button Lab\n can tune both surfaces with one set of sliders. */\n.root {\n display: inline-flex;\n height: var(--wzl-tb-height, 28px);\n padding: 2px;\n background: linear-gradient(\n 180deg,\n rgba(0, 0, 0, 0.18) 0%,\n rgba(0, 0, 0, 0.05) 100%\n );\n border-radius: 999px;\n /* Clip segments to the track outline so interior corners read crisp and\n the selected segment's glass treatment doesn't paint over the rounded\n outer pixels. */\n overflow: hidden;\n box-shadow:\n inset 0 1px 2px rgba(0, 0, 0, 0.4),\n 0 1px 0 rgba(255, 255, 255, 0.06);\n user-select: none;\n -webkit-user-select: none;\n touch-action: none;\n}\n\n.segment {\n position: relative;\n flex: 1 1 0;\n min-width: 0;\n padding: 0 12px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n background: transparent;\n border: none;\n margin: 0;\n font-family: var(--wzl-font-ui);\n font-weight: 300;\n font-size: var(--btn-fontsize, 14px);\n line-height: 1;\n color: var(--wzl-fg-muted);\n cursor: pointer;\n /* Only round the outer corners of the bar — middle segments stay square\n so the seams between them don't render as facing parentheses. */\n border-radius: 0;\n isolation: isolate;\n overflow: hidden;\n transition: color var(--wzl-motion-fast);\n}\n\n.segment:first-child {\n border-radius: 999px 0 0 999px;\n}\n\n.segment:last-child {\n border-radius: 0 999px 999px 0;\n}\n\n.segment:only-child {\n border-radius: 999px;\n}\n\n.segment:focus-visible {\n outline: 2px solid var(--wzl-accent);\n outline-offset: -2px;\n}\n\n.segment:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.segment:hover:not(:disabled):not(.segmentSelected) {\n color: var(--wzl-fg);\n}\n\n/* Selected segment — full Aqua glass cylinder. Mirrors Button.variant_primary. */\n.segmentSelected {\n background: linear-gradient(\n 180deg,\n color-mix(in srgb, var(--wzl-accent) var(--btn-top-alpha, 45%), transparent) 0%,\n color-mix(in srgb, var(--wzl-accent) var(--btn-upper-alpha, 70%), transparent) calc(var(--btn-equator, 52%) - var(--btn-equator-spread, 12%)),\n color-mix(in srgb, var(--wzl-accent) var(--btn-equator-tint, 95%), white) var(--btn-equator, 52%),\n var(--wzl-accent) calc(var(--btn-equator, 52%) + var(--btn-equator-spread, 12%) * 1.6),\n color-mix(in srgb, var(--wzl-accent) var(--btn-base-tint, 70%), black) 100%\n );\n backdrop-filter: blur(var(--btn-blur, 6px)) saturate(var(--btn-saturate, 1.3));\n -webkit-backdrop-filter: blur(var(--btn-blur, 6px)) saturate(var(--btn-saturate, 1.3));\n color: var(--wzl-fg-on-accent);\n text-shadow:\n 0 1px 0 rgba(0, 0, 0, var(--btn-text-shadow, 0.35)),\n var(--btn-text-inset-x, 0px) var(--btn-text-inset-y, 1px) 0 rgba(0, 0, 0, var(--btn-text-inset, 0.55)),\n 0 0 6px rgba(0, 0, 0, calc(var(--btn-text-shadow, 0.35) * 0.5));\n box-shadow:\n inset 0 1px 0 rgba(255, 255, 255, var(--btn-inset-hi, 0.42)),\n inset 0 -1px 2px rgba(0, 0, 0, var(--btn-inset-lo, 0.3)),\n 0 0 0 1px rgba(0, 0, 0, var(--btn-rim, 0.22)),\n 0 1px 2px rgba(0, 0, 0, var(--btn-drop-near, 0.3)),\n 0 2px 4px rgba(0, 0, 0, calc(var(--btn-drop-far, 0.18) * 0.8));\n}\n\n/* Specular gloss on the selected segment. Top corners inherit the\n segment's radius so they hug the upper edge cleanly; bottom corners\n are flattened so the gloss ends in a straight line at the equator\n instead of two little curves that read as `)(` brackets. */\n.segmentSelected::before {\n content: '';\n position: absolute;\n inset: 1px 1px var(--btn-gloss-bottom, 50%) 1px;\n border-radius: inherit;\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n background: linear-gradient(\n 180deg,\n rgba(255, 255, 255, var(--btn-gloss-top, 0.42)) 0%,\n rgba(255, 255, 255, var(--btn-gloss-mid, 0.12)) 60%,\n rgba(255, 255, 255, 0) 100%\n );\n pointer-events: none;\n z-index: 1;\n}\n\n.segmentSelected > * {\n position: relative;\n z-index: 2;\n}\n\n/* Mixed segment (`aria-pressed=\"mixed\"`) — the sources disagree. Reads as a\n deliberate third state rather than a dimmed \"on\": a flat accent wash with\n none of the selected segment's gloss/cylinder treatment, so it can't be\n mistaken for the glass lozenge at a glance. */\n.segmentMixed {\n background: color-mix(in srgb, var(--wzl-accent) 22%, transparent);\n color: var(--wzl-fg);\n box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--wzl-accent) 45%, transparent);\n}\n\n.segmentMixed:hover:not(:disabled) {\n background: color-mix(in srgb, var(--wzl-accent) 32%, transparent);\n}\n\n.variant_minimal .segmentMixed {\n background: color-mix(in srgb, var(--wzl-accent) 18%, transparent);\n box-shadow: none;\n color: var(--wzl-fg);\n}\n\n/* Small variant — ~60% of the default height, with proportionally reduced\n padding and font. Sized for dense surfaces (lab control panels, inline\n filters, etc.). */\n.size_sm {\n height: 17px;\n padding: 1px;\n}\n\n.size_sm .segment {\n padding: 0 8px;\n font-size: 11px;\n}\n\n/* Minimal variant — strips the pill track, glass selected state, inset\n shadows, and outer padding. Used in dense diagnostic surfaces (dispatch\n trace, lab inspectors) where the bar must read as plain text controls. */\n.variant_minimal {\n height: auto;\n padding: 0;\n background: none;\n border: 1px solid var(--wzl-border, rgba(255, 255, 255, 0.18));\n border-radius: 3px;\n box-shadow: none;\n gap: 0;\n}\n\n.variant_minimal .segment {\n padding: 0 6px;\n font-size: 11px;\n font-weight: 400;\n line-height: 1.4;\n border-radius: 0;\n color: var(--wzl-fg-muted);\n transition: none;\n}\n\n/* Dividers between segments make the mutual-exclusion grouping visible\n without a heavy track. Only the inner edges get a rule — the outer\n border on `.variant_minimal` handles the perimeter. */\n.variant_minimal .segment + .segment {\n border-left: 1px solid var(--wzl-border, rgba(255, 255, 255, 0.18));\n}\n\n.variant_minimal .segment:first-child,\n.variant_minimal .segment:last-child,\n.variant_minimal .segment:only-child {\n border-radius: 0;\n}\n\n.variant_minimal .segment:hover:not(:disabled):not(.segmentSelected) {\n color: var(--wzl-fg);\n background: rgba(255, 255, 255, 0.06);\n}\n\n.variant_minimal .segmentSelected {\n background: none;\n backdrop-filter: none;\n -webkit-backdrop-filter: none;\n color: var(--wzl-accent-fg, var(--wzl-accent));\n text-shadow: none;\n box-shadow: none;\n font-weight: 500;\n}\n\n.variant_minimal .segmentSelected::before {\n content: none;\n}\n","import { useRef, type CSSProperties, type KeyboardEvent as ReactKeyboardEvent, type ReactElement, type ReactNode } from 'react';\nimport s from './ToggleBar.module.css';\n\nexport type ToggleBarItem<V extends string | number = string> = {\n value: V;\n label?: ReactNode;\n ariaLabel?: string;\n disabled?: boolean;\n};\n\nexport type ToggleBarSize = 'sm' | 'md';\nexport type ToggleBarVariant = 'default' | 'minimal';\n\ntype CommonProps = {\n ariaLabel?: string;\n className?: string;\n height?: number;\n /** Size variant. `sm` is ~60% of the default height with reduced padding\n * and font size — sized for dense surfaces like lab control panels. */\n size?: ToggleBarSize;\n /** Visual variant. `minimal` strips the pill track and glass treatment;\n * selection becomes a flat accent. For dense diagnostic surfaces. */\n variant?: ToggleBarVariant;\n};\n\nexport type ToggleBarProps<V extends string | number = string> =\n | (CommonProps & {\n mode?: 'single';\n items: readonly ToggleBarItem<V>[];\n value: V | null;\n onChange: (next: V | null) => void;\n allowDeselect?: boolean;\n })\n | (CommonProps & {\n mode: 'multiple';\n items: readonly ToggleBarItem<V>[];\n value: readonly V[];\n /**\n * Values that are neither on nor off — the sources this bar\n * aggregates disagree (a text range that is bold in part of it, a\n * multi-selection whose nodes differ). Rendered `aria-pressed=\"mixed\"`,\n * the ARIA tri-state a toggle button actually has, rather than\n * `SelectionPanel`'s reduced-opacity-plus-`title` workaround for\n * `Switch`, which has no indeterminate state to render.\n *\n * `value` wins where the two lists overlap, so a caller that can't\n * cheaply keep them disjoint doesn't get an ambiguous segment.\n *\n * Clicking a mixed segment turns it fully **on**, matching the\n * everywhere-else convention (and `toggleFlagInRange`'s rule for a\n * partially-styled text range) that a mixed toggle resolves toward\n * the affirmative rather than clearing.\n */\n mixedValues?: readonly V[];\n onChange: (next: V[]) => void;\n });\n\nfunction firstEnabledIndex(items: readonly ToggleBarItem<string | number>[]): number {\n for (let i = 0; i < items.length; i++) if (!items[i].disabled) return i;\n return -1;\n}\n\nfunction lastEnabledIndex(items: readonly ToggleBarItem<string | number>[]): number {\n for (let i = items.length - 1; i >= 0; i--) if (!items[i].disabled) return i;\n return -1;\n}\n\nfunction nextEnabledIndex(items: readonly ToggleBarItem<string | number>[], from: number): number {\n const n = items.length;\n for (let k = 1; k <= n; k++) {\n const i = (from + k + n) % n;\n if (!items[i].disabled) return i;\n }\n return from;\n}\n\nfunction prevEnabledIndex(items: readonly ToggleBarItem<string | number>[], from: number): number {\n const n = items.length;\n for (let k = 1; k <= n; k++) {\n const i = (from - k + n) % n;\n if (!items[i].disabled) return i;\n }\n return from;\n}\n\nexport function ToggleBar<V extends string | number = string>(props: ToggleBarProps<V>): ReactElement {\n const { items, ariaLabel, className, height, size, variant } = props;\n const mode = props.mode ?? 'single';\n const rootRef = useRef<HTMLDivElement | null>(null);\n\n const isSelected = (value: V): boolean => {\n if (mode === 'multiple') return (props.value as readonly V[]).includes(value);\n return (props.value as V | null) === value;\n };\n\n /** Mixed only in multiple mode, and only where `value` doesn't already\n * claim the segment. Single mode has nothing to be mixed about — its\n * aggregate is one value or none. */\n const isMixed = (value: V): boolean => {\n if (mode !== 'multiple') return false;\n const mixed = (props as { mixedValues?: readonly V[] }).mixedValues;\n return mixed !== undefined && mixed.includes(value) && !isSelected(value);\n };\n\n let tabStopIndex = -1;\n if (mode === 'single') {\n const sel = items.findIndex(it => it.value === (props.value as V | null));\n tabStopIndex = sel >= 0 && !items[sel].disabled ? sel : firstEnabledIndex(items);\n } else {\n tabStopIndex = firstEnabledIndex(items);\n }\n\n const handleClick = (index: number) => () => {\n const item = items[index];\n if (item.disabled) return;\n if (mode === 'multiple') {\n const current = props.value as readonly V[];\n const next = current.includes(item.value)\n ? current.filter(v => v !== item.value)\n : [...current, item.value];\n (props.onChange as (n: V[]) => void)(next);\n } else {\n const current = props.value as V | null;\n if (current === item.value) {\n if ((props as { allowDeselect?: boolean }).allowDeselect) {\n (props.onChange as (n: V | null) => void)(null);\n }\n return;\n }\n (props.onChange as (n: V | null) => void)(item.value);\n }\n };\n\n const focusSegment = (index: number) => {\n const root = rootRef.current;\n if (!root) return;\n const buttons = root.querySelectorAll<HTMLButtonElement>(`.${s.segment}`);\n buttons[index]?.focus();\n };\n\n const handleKeyDown = (index: number) => (e: ReactKeyboardEvent<HTMLButtonElement>) => {\n let nextIndex = -1;\n switch (e.key) {\n case 'ArrowLeft':\n case 'ArrowUp':\n nextIndex = prevEnabledIndex(items, index);\n break;\n case 'ArrowRight':\n case 'ArrowDown':\n nextIndex = nextEnabledIndex(items, index);\n break;\n case 'Home':\n nextIndex = firstEnabledIndex(items);\n break;\n case 'End':\n nextIndex = lastEnabledIndex(items);\n break;\n case ' ':\n case 'Enter':\n if (mode === 'multiple') {\n e.preventDefault();\n handleClick(index)();\n }\n return;\n default:\n return;\n }\n if (nextIndex < 0 || nextIndex === index) return;\n e.preventDefault();\n if (mode === 'single') {\n const item = items[nextIndex];\n (props.onChange as (n: V | null) => void)(item.value);\n }\n focusSegment(nextIndex);\n };\n\n const style: CSSProperties | undefined = height !== undefined\n ? ({ ['--wzl-tb-height' as string]: `${height}px` } as CSSProperties)\n : undefined;\n\n const rootCls = [\n s.root,\n size && s[`size_${size}`],\n variant && s[`variant_${variant}`],\n className,\n ].filter(Boolean).join(' ');\n\n return (\n <div\n ref={rootRef}\n className={rootCls}\n role={mode === 'multiple' ? 'group' : 'radiogroup'}\n aria-label={ariaLabel}\n style={style}\n >\n {items.map((item, i) => {\n const selected = isSelected(item.value);\n const mixed = isMixed(item.value);\n const cls = [s.segment, selected && s.segmentSelected, mixed && s.segmentMixed]\n .filter(Boolean)\n .join(' ');\n return (\n <button\n key={item.value}\n type=\"button\"\n role={mode === 'multiple' ? undefined : 'radio'}\n aria-checked={mode === 'multiple' ? undefined : selected}\n aria-pressed={mode === 'multiple' ? (mixed ? 'mixed' : selected) : undefined}\n aria-label={item.ariaLabel}\n disabled={item.disabled}\n tabIndex={i === tabStopIndex ? 0 : -1}\n className={cls}\n onClick={handleClick(i)}\n onKeyDown={handleK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;GAClB,KAAW,EAAE,WAAW;GACxB;GACD,CAAC,OAAO,QAAQ,CAAC,KAAK,IAKR;EACX,MAAM,MAAS,aAAa,UAAU;EACtC,cAAY;EACL;YAEN,EAAM,KAAK,GAAM,MAAM;GACtB,IAAM,IAAW,EAAW,EAAK,MAAM,EACjC,IAAQ,EAAQ,EAAK,MAAM,EAC3B,IAAM;IAAC,EAAE;IAAS,KAAY,EAAE;IAAiB,KAAS,EAAE;IAAa,CAC5E,OAAO,QAAQ,CACf,KAAK,IAAI;AACZ,UACE,kBAAC,UAAD;IAEE,MAAK;IACL,MAAM,MAAS,aAAa,KAAA,IAAY;IACxC,gBAAc,MAAS,aAAa,KAAA,IAAY;IAChD,gBAAc,MAAS,aAAc,IAAQ,UAAU,IAAY,KAAA;IACnE,cAAY,EAAK;IACjB,UAAU,EAAK;IACf,UAAU,MAAM,IAAe,IAAI;IACnC,WAAW;IACX,SAAS,EAAY,EAAE;IACvB,WAAW,EAAc,EAAE;cAE1B,EAAK;IACC,EAbF,EAAK,MAaH;IAEX;EACE,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ToolButton-5L1sAlJC.js","names":[],"sources":["../../src/components/ToolButton/ToolButton.module.css","../../src/components/ToolButton/ToolButton.tsx"],"sourcesContent":[".button {\n display: inline-flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 2px;\n min-width: 44px;\n padding: 6px 4px;\n background: transparent;\n border: 1px solid transparent;\n border-radius: 3px;\n color: var(--wzl-fg);\n cursor: default;\n font-family: inherit;\n font-size: 10px;\n line-height: 1.1;\n}\n.button:hover:not([disabled]) {\n background: var(--wzl-surface-hover);\n color: var(--wzl-fg);\n}\n.button:focus-visible {\n outline: 2px solid var(--wzl-accent);\n outline-offset: -2px;\n}\n.button.active {\n background: var(--wzl-surface-pressed);\n border-color: var(--wzl-accent);\n color: var(--wzl-fg);\n}\n.button[disabled] {\n opacity: 0.4;\n}\n\n.icon { display: block; }\n.icon > svg { display: block; }\n.label { font-size: 10px; }\n.shortcut {\n color: var(--wzl-fg-muted);\n font-family: ui-monospace, SFMono-Regular, Menlo, monospace;\n font-size: 9px;\n}\n","import type { ReactNode } from 'react';\nimport { Focusable } from 'react-aria-components';\nimport { Tooltip, TooltipTrigger } from '../Tooltip';\nimport s from './ToolButton.module.css';\n\nexport interface ToolButtonProps {\n /** Icon node (typically an SVG component). */\n icon: ReactNode;\n /** Human-readable label shown under the icon. */\n label: string;\n /** Optional shortcut hint (e.g. \"V\" or \"⌘Z\"). */\n shortcut?: string;\n /** Selected/active state — toggles the active visual treatment. */\n active?: boolean;\n /** Disabled state — passes through to the underlying button. */\n disabled?: boolean;\n /**\n * When true, sets `aria-disabled=\"true\"` on the button without using the\n * native `disabled` attribute. This keeps the button focusable and reachable\n * by keyboard (roving-tabindex still applies) while marking it as ineligible\n * to screen readers. The caller is responsible for making `onClick` a no-op.\n */\n ariaDisabled?: boolean;\n /**\n * Whether this button is the currently tabbable member of its toolbar.\n * Toolbars use roving tabindex: exactly one button has `tabIndex=0` at\n * a time; the rest are `-1`. Caller manages which.\n */\n tabbable?: boolean;\n /** Click handler. */\n onClick(): void;\n /**\n * Tooltip content. Defaults to `label` (plus `shortcut` if provided).\n */\n title?: string;\n /** Additional class for the root button. */\n className?: string;\n}\n\n/**\n * Generic icon-+-label toolbar button — building block for `ToolPalette`\n * and similar surfaces. Headless about layout direction (parent group\n * supplies flex direction via `ToolGroup`). Theme via `--wzl-*` tokens.\n */\nexport function ToolButton(props: ToolButtonProps) {\n const { icon, label, shortcut, active, disabled, ariaDisabled, tabbable, onClick, title, className } = props;\n const resolvedTitle = title ?? (shortcut ? `${label} (${shortcut})` : label);\n const cls = [s.button, active && s.active, className].filter(Boolean).join(' ');\n return (\n <TooltipTrigger isDisabled={disabled}>\n <Focusable isDisabled={disabled}>\n <button\n type=\"button\"\n tabIndex={tabbable ? 0 : -1}\n className={cls}\n aria-current={active ? 'true' : undefined}\n aria-disabled={ariaDisabled ? 'true' : undefined}\n disabled={disabled}\n onClick={onClick}\n >\n <span className={s.icon} aria-hidden=\"true\">{icon}</span>\n <span className={s.label}>{label}</span>\n {shortcut && <span className={s.shortcut}>{shortcut}</span>}\n </button>\n </Focusable>\n <Tooltip>{resolvedTitle}</Tooltip>\n </TooltipTrigger>\n );\n}\n"],"mappings":";;;;;;;;;;;;AC4CA,SAAgB,EAAW,GAAwB;CACjD,IAAM,EAAE,SAAM,UAAO,aAAU,WAAQ,aAAU,iBAAc,aAAU,YAAS,UAAO,iBAAc,GACjG,IAAgB,MAAU,IAAW,GAAG,EAAM,IAAI,EAAS,KAAK,IAChE,IAAM;EAAC,EAAE;EAAQ,KAAU,EAAE;EAAQ;EAAU,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI;AAC/E,QACE,kBAAC,GAAD;EAAgB,YAAY;YAA5B,CACE,kBAAC,GAAD;GAAW,YAAY;aACrB,kBAAC,UAAD;IACE,MAAK;IACL,UAAU,IAAW,IAAI;IACzB,WAAW;IACX,gBAAc,IAAS,SAAS,KAAA;IAChC,iBAAe,IAAe,SAAS,KAAA;IAC7B;IACD;cAPX;KASE,kBAAC,QAAD;MAAM,WAAW,EAAE;MAAM,eAAY;gBAAQ;MAAY,CAAA;KACzD,kBAAC,QAAD;MAAM,WAAW,EAAE;gBAAQ;MAAa,CAAA;KACvC,KAAY,kBAAC,QAAD;MAAM,WAAW,EAAE;gBAAW;MAAgB,CAAA;KACpD;;GACC,CAAA,EACZ,kBAAC,GAAD,EAAA,UAAU,GAAwB,CAAA,CACnB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ToolPalette-BDkvV3pJ.js","names":[],"sources":["../../src/components/ToolPalette/ToolPalette.module.css","../../src/components/ToolPalette/formatShortcut.ts","../../src/components/ToolPalette/ToolPalette.tsx"],"sourcesContent":[".palette {\n display: flex;\n flex-direction: column;\n gap: 4px;\n background: var(--wzl-surface);\n border: 1px solid var(--wzl-border);\n border-radius: 4px;\n padding: 4px;\n user-select: none;\n}\n.palette.horizontal {\n flex-direction: row;\n}\n\n/* Applied to ineligible tool buttons in the active mode. */\n.ineligibleBtn {\n opacity: 0.35;\n cursor: not-allowed;\n}\n\n.separator {\n background: var(--wzl-border);\n}\n.palette:not(.horizontal) .separator {\n height: 1px;\n margin: 2px 0;\n}\n.palette.horizontal .separator {\n width: 1px;\n margin: 0 2px;\n}\n","import { keyGlyph } from '../Keycaps/keyGlyph';\n\nexport interface ShortcutInput {\n key: string | readonly string[];\n mod?: boolean;\n alt?: boolean;\n shift?: boolean | 'optional';\n}\n\n/** Format a shortcut as an array of display chips, one per key — modifier\n * icons (⌘, ↑, ⌥) followed by the key glyph. UIs that want a boxed\n * per-key look render each chip in its own element. `shift: 'optional'` is\n * treated as falsy. */\nexport function formatShortcutParts(b: ShortcutInput | undefined): readonly string[] | undefined {\n if (!b) return undefined;\n const rawKey = Array.isArray(b.key) ? b.key[0] : (b.key as string);\n const parts: string[] = [];\n if (b.mod) parts.push('⌘');\n if (b.shift === true) parts.push('⇧');\n if (b.alt) parts.push('⌥');\n parts.push(keyGlyph(rawKey));\n return parts;\n}\n\n/** Format a shortcut as a single display string. Order: mod, shift, alt,\n * key. Returns `undefined` for `undefined` input so callers can `??` a\n * fallback. When `key` is an array, the first element is used. `shift: 'optional'`\n * is treated as falsy. */\nexport function formatShortcut(b: ShortcutInput | undefined): string | undefined {\n const parts = formatShortcutParts(b);\n return parts ? parts.join('') : undefined;\n}\n","import { Fragment, useRef, type ReactNode } from 'react';\nimport { UnknownIcon } from '@weasel-js/core';\nimport type { AnyTool, ToolsApi } from '@weasel-js/core';\nimport { eligibleContribution, type ModeRegistry } from '@weasel-js/modes';\nimport { ToolButton } from '../ToolButton';\nimport { ToolGroup } from '../ToolGroup';\nimport s from './ToolPalette.module.css';\nimport { formatShortcut, type ShortcutInput } from './formatShortcut';\n\nconst DEFAULT_GROUP_ORDER = ['select', 'shape', 'draw', 'type', 'view'] as const;\nconst MISC = 'misc';\n\nfunction partitionByGroup(list: AnyTool[]): Map<string, AnyTool[]> {\n const groups = new Map<string, AnyTool[]>();\n for (const tool of list) {\n const g = tool.presentation?.group ?? MISC;\n const bucket = groups.get(g) ?? [];\n bucket.push(tool);\n groups.set(g, bucket);\n }\n return groups;\n}\n\nfunction orderedGroupKeys(\n groups: Map<string, AnyTool[]>,\n groupOrder: readonly string[],\n): string[] {\n const seen = new Set(groups.keys());\n const ordered: string[] = [];\n for (const known of groupOrder) {\n if (seen.has(known)) {\n ordered.push(known);\n seen.delete(known);\n }\n }\n // Unknown groups in insertion order (Map preserves it), misc last.\n for (const key of groups.keys()) {\n if (seen.has(key) && key !== MISC) {\n ordered.push(key);\n seen.delete(key);\n }\n }\n if (seen.has(MISC)) ordered.push(MISC);\n return ordered;\n}\n\nfunction resolveIcon(tool: AnyTool): ReactNode {\n const rawIcon = tool.presentation?.icon;\n if (rawIcon == null) return <UnknownIcon />;\n if (typeof rawIcon === 'function') return rawIcon(undefined);\n return rawIcon;\n}\n\nexport interface ToolPaletteProps {\n tools: ToolsApi;\n orientation?: 'vertical' | 'horizontal';\n className?: string;\n /** Derive the keyboard shortcut for a tool button from the action registry.\n * Called with the tool's id; return `undefined` to suppress a chip. When\n * omitted, falls back to `tool.keybinding` (legacy path). */\n lookupShortcut?: (toolId: string) => ShortcutInput | undefined;\n /**\n * Optional mode registry. When provided, tools whose `capabilities` do not\n * match the current mode are rendered greyed-out, aria-disabled, and their\n * onClick is suppressed. When omitted, all tools are treated as eligible\n * (preserves existing behaviour in consumers that haven't wired a registry).\n */\n modeRegistry?: ModeRegistry;\n /**\n * Presentation-group display order. Groups not listed keep their registry\n * insertion order after the listed ones; `misc` always renders last.\n * Defaults to `['select', 'shape', 'draw', 'type', 'view']`.\n */\n groupOrder?: readonly string[];\n}\n\nexport function ToolPalette(props: ToolPaletteProps) {\n const {\n tools, orientation = 'vertical', className, lookupShortcut, modeRegistry,\n groupOrder = DEFAULT_GROUP_ORDER,\n } = props;\n const list = Object.values(tools.registry);\n const groups = partitionByGroup(list);\n const groupKeys = orderedGroupKeys(groups, groupOrder);\n const cls = [s.palette, orientation === 'horizontal' && s.horizontal, className]\n .filter(Boolean).join(' ');\n\n const orderedIds = groupKeys.flatMap((k) => groups.get(k)!.map((t) => t.id));\n const tabbableId = tools.active && orderedIds.includes(tools.active)\n ? tools.active\n : orderedIds[0];\n const rootRef = useRef<HTMLDivElement | null>(null);\n\n function onKeyDown(e: React.KeyboardEvent<HTMLDivElement>) {\n const target = e.target as HTMLElement;\n if (target.tagName !== 'BUTTON') return;\n const root = rootRef.current;\n if (!root) return;\n const buttons = Array.from(root.querySelectorAll<HTMLButtonElement>('button'));\n const i = buttons.indexOf(target as HTMLButtonElement);\n if (i < 0) return;\n\n let next = -1;\n switch (e.key) {\n case 'ArrowDown':\n case 'ArrowRight':\n next = (i + 1) % buttons.length;\n break;\n case 'ArrowUp':\n case 'ArrowLeft':\n next = (i - 1 + buttons.length) % buttons.length;\n break;\n case 'Home':\n next = 0;\n break;\n case 'End':\n next = buttons.length - 1;\n break;\n }\n if (next >= 0) {\n e.preventDefault();\n buttons[next].focus();\n }\n }\n\n return (\n <div\n ref={rootRef}\n className={cls}\n role=\"toolbar\"\n aria-label=\"Tools\"\n onKeyDown={onKeyDown}\n >\n {groupKeys.map((key, i) => (\n <Fragment key={key}>\n {i > 0 && (\n <div\n className={s.separator}\n role=\"separator\"\n aria-orientation={orientation === 'horizontal' ? 'vertical' : 'horizontal'}\n />\n )}\n <ToolGroup orientation={orientation} groupKey={key}>\n {groups.get(key)!.map((tool) => {\n const label = tool.presentation?.label ?? tool.id;\n const shortcut = tool.presentation?.shortcut\n ?? formatShortcut(lookupShortcut ? lookupShortcut(tool.id) : tool.keybinding);\n const enabled = modeRegistry ? eligibleContribution(modeRegistry, tool) : true;\n const modeName = modeRegistry ? modeRegistry.current().id : undefined;\n const resolvedTitle = !enabled && modeName\n ? `${label}${shortcut ? ` (${shortcut})` : ''} — disabled in ${modeName} mode`\n : undefined;\n return (\n <ToolButton\n key={tool.id}\n icon={resolveIcon(tool)}\n label={label}\n shortcut={shortcut}\n active={tools.active === tool.id}\n tabbable={tool.id === tabbableId}\n ariaDisabled={!enabled}\n className={!enabled ? s.ineligibleBtn : undefined}\n title={resolvedTitle}\n onClick={enabled ? () => tools.setActive(tool.id) : () => {}}\n />\n );\n })}\n </ToolGroup>\n </Fragment>\n ))}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;ACaA,SAAgB,EAAoB,GAA6D;AAC/F,KAAI,CAAC,EAAG;CACR,IAAM,IAAS,MAAM,QAAQ,EAAE,IAAI,GAAG,EAAE,IAAI,KAAM,EAAE,KAC9C,IAAkB,EAAE;AAK1B,QAJI,EAAE,OAAK,EAAM,KAAK,IAAI,EACtB,EAAE,UAAU,MAAM,EAAM,KAAK,IAAI,EACjC,EAAE,OAAK,EAAM,KAAK,IAAI,EAC1B,EAAM,KAAK,EAAS,EAAO,CAAC,EACrB;;AAOT,SAAgB,EAAe,GAAkD;CAC/E,IAAM,IAAQ,EAAoB,EAAE;AACpC,QAAO,IAAQ,EAAM,KAAK,GAAG,GAAG,KAAA;;;;ACrBlC,IAAM,IAAsB;CAAC;CAAU;CAAS;CAAQ;CAAQ;CAAO,EACjE,IAAO;AAEb,SAAS,EAAiB,GAAyC;CACjE,IAAM,oBAAS,IAAI,KAAwB;AAC3C,MAAK,IAAM,KAAQ,GAAM;EACvB,IAAM,IAAI,EAAK,cAAc,SAAS,GAChC,IAAS,EAAO,IAAI,EAAE,IAAI,EAAE;AAElC,EADA,EAAO,KAAK,EAAK,EACjB,EAAO,IAAI,GAAG,EAAO;;AAEvB,QAAO;;AAGT,SAAS,EACP,GACA,GACU;CACV,IAAM,IAAO,IAAI,IAAI,EAAO,MAAM,CAAC,EAC7B,IAAoB,EAAE;AAC5B,MAAK,IAAM,KAAS,EAClB,CAAI,EAAK,IAAI,EAAM,KACjB,EAAQ,KAAK,EAAM,EACnB,EAAK,OAAO,EAAM;AAItB,MAAK,IAAM,KAAO,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