jenosize-ui 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/README.md +183 -63
  2. package/THIRD-PARTY-NOTICES.md +15 -0
  3. package/dist/GradientPicker-CQm3GT7F.d.ts +144 -0
  4. package/dist/{PaymentInput-Dn5WVQVy.d.ts → PaymentInput-Cz5jFB3p.d.ts} +1 -1
  5. package/dist/{Select-Dt5ARIH8.d.ts → Select-CXOAMlk7.d.ts} +15 -1
  6. package/dist/{TagInput-BaBeve6L.d.ts → TagInput-CzIrONr-.d.ts} +1 -1
  7. package/dist/area-chart.d.ts +2 -2
  8. package/dist/area-chart.js +7 -6
  9. package/dist/at-least-one-BZ2dsck-.d.ts +18 -0
  10. package/dist/avatar.d.ts +1 -1
  11. package/dist/avatar.js +12 -11
  12. package/dist/badge.d.ts +1 -1
  13. package/dist/badge.js +6 -6
  14. package/dist/bar-chart.d.ts +2 -2
  15. package/dist/bar-chart.js +7 -6
  16. package/dist/breadcrumb.d.ts +1 -1
  17. package/dist/breadcrumb.js +4 -4
  18. package/dist/button.d.ts +1 -1
  19. package/dist/button.js +11 -10
  20. package/dist/calendar.d.ts +1 -1
  21. package/dist/calendar.js +16 -15
  22. package/dist/callout.d.ts +4 -2
  23. package/dist/callout.js +12 -11
  24. package/dist/card.d.ts +59 -3
  25. package/dist/card.js +4 -4
  26. package/dist/carousel.d.ts +169 -0
  27. package/dist/carousel.js +9 -0
  28. package/dist/catalog.json +11180 -0
  29. package/dist/checkbox.js +8 -7
  30. package/dist/{chunk-MVG5MABV.js → chunk-26XQU3TC.js} +8 -8
  31. package/dist/{chunk-X2X7Q7NW.js → chunk-2R3QWWOT.js} +3 -3
  32. package/dist/{chunk-AIARANKE.js → chunk-3JQKVC2K.js} +4 -4
  33. package/dist/chunk-3P3QZPHV.js +109 -0
  34. package/dist/{chunk-GLKFFA7N.js → chunk-44AWXIQK.js} +5 -5
  35. package/dist/{chunk-FWRHBMWT.js → chunk-4Y32RIC7.js} +5 -19
  36. package/dist/{chunk-5XPMY2LF.js → chunk-5ECTNYKU.js} +5 -5
  37. package/dist/{chunk-6B6BWTXC.js → chunk-5GBA6X6A.js} +5 -5
  38. package/dist/{chunk-UGKELBNC.js → chunk-5SGF47TZ.js} +9 -9
  39. package/dist/{chunk-POQTE7JI.js → chunk-5XSR757T.js} +7 -7
  40. package/dist/{chunk-GZMDZF2V.js → chunk-6FGLABYH.js} +3 -3
  41. package/dist/{chunk-MCQG4H6T.js → chunk-6T3QAO5K.js} +12 -4
  42. package/dist/{chunk-SKRR3ZMP.js → chunk-737A4YNC.js} +3 -3
  43. package/dist/{chunk-AFYXSZGW.js → chunk-7LSUUEAF.js} +7 -5
  44. package/dist/{chunk-7VLYQR4D.js → chunk-7OFGPDYJ.js} +3 -3
  45. package/dist/{chunk-54SIZR63.js → chunk-7UCKFULR.js} +7 -7
  46. package/dist/{chunk-LQURV7HQ.js → chunk-7ZA3QZRP.js} +4 -4
  47. package/dist/{chunk-X2VMIBK5.js → chunk-A4YPUS6C.js} +4 -4
  48. package/dist/{chunk-5ZEUTSCV.js → chunk-B4OVIE2X.js} +6 -6
  49. package/dist/{chunk-P6CON2R2.js → chunk-BH32X25C.js} +3 -3
  50. package/dist/{chunk-667ZHY3T.js → chunk-BJHLW25G.js} +85 -538
  51. package/dist/{chunk-ULGCGKOE.js → chunk-BKBINQJZ.js} +4 -4
  52. package/dist/{chunk-CFFWYXDW.js → chunk-BXQFBFT7.js} +5 -5
  53. package/dist/{chunk-I6WMNXC7.js → chunk-CQGMOPLG.js} +6 -6
  54. package/dist/{chunk-FNQJJO63.js → chunk-CUONE6LA.js} +4 -4
  55. package/dist/{chunk-FFMTYQXE.js → chunk-CVCS5G3E.js} +43 -21
  56. package/dist/{chunk-33TOK7ES.js → chunk-DCKVNHV5.js} +5 -5
  57. package/dist/{chunk-A323V6AI.js → chunk-DYRGHXT5.js} +3 -3
  58. package/dist/{chunk-T4ZFZTY6.js → chunk-EHML2DLR.js} +4 -4
  59. package/dist/{chunk-N3RVMBPX.js → chunk-EJKQGUUM.js} +4 -4
  60. package/dist/{chunk-E2YZ7IMT.js → chunk-ESDSTS5N.js} +6 -6
  61. package/dist/{chunk-LCG34A5T.js → chunk-EVINS473.js} +5 -3
  62. package/dist/chunk-EXRVOGJ5.js +325 -0
  63. package/dist/{chunk-YHBI52P2.js → chunk-GDW6NFYN.js} +3 -3
  64. package/dist/chunk-GOCO45FF.js +619 -0
  65. package/dist/{chunk-7ZM7SNCZ.js → chunk-GPHGPY6T.js} +3 -3
  66. package/dist/{chunk-PO2TYK3C.js → chunk-GWYDOZGQ.js} +3 -3
  67. package/dist/{chunk-LO22VQL5.js → chunk-HNNNJP3A.js} +4 -4
  68. package/dist/{chunk-ZZSNTCCL.js → chunk-IESEBPYA.js} +4 -4
  69. package/dist/{chunk-3H444OJA.js → chunk-JZ4HGFWK.js} +3 -3
  70. package/dist/chunk-KBQJIVUB.js +33 -0
  71. package/dist/{chunk-CKMWBVRR.js → chunk-KCM4KEZ2.js} +4 -4
  72. package/dist/{chunk-3QXLIZIX.js → chunk-KNGJ3CSB.js} +3 -3
  73. package/dist/{chunk-FH7Z7SGQ.js → chunk-KNW3IUWX.js} +12 -11
  74. package/dist/{chunk-KZP6B6B3.js → chunk-KTWTYK5U.js} +16 -5
  75. package/dist/{chunk-LYXPJERB.js → chunk-L7Z6XGBU.js} +5 -5
  76. package/dist/{chunk-ZHAT2XZ4.js → chunk-LLUWBQK6.js} +10 -10
  77. package/dist/{chunk-QHH6AUR3.js → chunk-MDKVYC6R.js} +7 -7
  78. package/dist/{chunk-22M75A3N.js → chunk-MS6DY4CE.js} +14 -11
  79. package/dist/{chunk-LLPWQDF7.js → chunk-MTOTPAYZ.js} +3 -3
  80. package/dist/{chunk-AZ7DKRBY.js → chunk-MVF7FA4D.js} +5 -5
  81. package/dist/{chunk-AIGYMTCU.js → chunk-MVUNB43J.js} +3 -3
  82. package/dist/{chunk-ZMFY7WAY.js → chunk-O24HHIQG.js} +41 -39
  83. package/dist/{chunk-NKG4N6HA.js → chunk-O5EHNNPS.js} +4 -4
  84. package/dist/{chunk-5DP7W5HX.js → chunk-OIPFTJS6.js} +3 -3
  85. package/dist/{chunk-U4WSJAYK.js → chunk-OXNIEIOY.js} +20 -20
  86. package/dist/chunk-P2BGR77C.js +344 -0
  87. package/dist/{chunk-CGHYXWTT.js → chunk-PFAFTLN3.js} +4 -4
  88. package/dist/{chunk-4RBIWI2Q.js → chunk-Q2KR7PSX.js} +3 -3
  89. package/dist/{chunk-7GUPNTAH.js → chunk-QSOLK2I2.js} +7 -7
  90. package/dist/chunk-QTWRR7IS.js +1129 -0
  91. package/dist/{chunk-OLLD2BZN.js → chunk-QZHAL4BL.js} +3 -3
  92. package/dist/{chunk-OACWA4TC.js → chunk-R25NHHYT.js} +6 -6
  93. package/dist/{chunk-QDKETK7D.js → chunk-S55JKMG7.js} +5 -5
  94. package/dist/{chunk-S5TEWPWW.js → chunk-S5LLA36K.js} +10 -10
  95. package/dist/{chunk-QDYE5LVT.js → chunk-SF3HCW4G.js} +45 -4
  96. package/dist/{chunk-KHGW72BM.js → chunk-SGMVB7HD.js} +3 -3
  97. package/dist/{chunk-FKVPAEJ6.js → chunk-SKJC2KYD.js} +4 -3
  98. package/dist/chunk-SKPKL47Y.js +5671 -0
  99. package/dist/{chunk-6MMBQVRO.js → chunk-TCTTZHUS.js} +9 -9
  100. package/dist/chunk-U5X3MLM5.js +67 -0
  101. package/dist/chunk-UHSGD4CD.js +364 -0
  102. package/dist/chunk-UJ4WEQHR.js +525 -0
  103. package/dist/{chunk-6H4LNWQ7.js → chunk-VDFWWWLL.js} +9 -4
  104. package/dist/{chunk-5KSD4WKN.js → chunk-VIKV25VP.js} +5 -5
  105. package/dist/chunk-WJB5GWAZ.js +20 -0
  106. package/dist/{chunk-HHYEAFCL.js → chunk-XAQQ4LYL.js} +11 -11
  107. package/dist/{chunk-4VGEJG4M.js → chunk-XCFFM2C7.js} +9 -9
  108. package/dist/chunk-XKTD3X6Z.js +183 -0
  109. package/dist/{chunk-GQRSABRN.js → chunk-XWXXKEG6.js} +4 -4
  110. package/dist/chunk-YGFTNICV.js +110 -0
  111. package/dist/{chunk-T5574MXM.js → chunk-YGJL7QS7.js} +8 -8
  112. package/dist/{chunk-SB3DG572.js → chunk-YKPTUANT.js} +6 -6
  113. package/dist/{chunk-YQYVGWIC.js → chunk-YQAYAJ2T.js} +33 -11
  114. package/dist/chunk-YXYZW6WU.js +998 -0
  115. package/dist/{chunk-IQNVSQRK.js → chunk-Z6NSOC6T.js} +5 -5
  116. package/dist/{chunk-BBKE4W3B.js → chunk-ZAWGG4H2.js} +7 -7
  117. package/dist/{chunk-BFVJHH7S.js → chunk-ZF362B2X.js} +5 -5
  118. package/dist/{chunk-RJTVCA62.js → chunk-ZJIY642R.js} +3 -3
  119. package/dist/color-input.d.ts +93 -0
  120. package/dist/color-input.js +35 -0
  121. package/dist/color-picker.d.ts +268 -0
  122. package/dist/color-picker.js +28 -0
  123. package/dist/color-value-DYzChVOW.d.ts +129 -0
  124. package/dist/combobox.d.ts +1 -1
  125. package/dist/combobox.js +13 -12
  126. package/dist/date-calendar.d.ts +49 -0
  127. package/dist/date-calendar.js +12 -0
  128. package/dist/date-input.d.ts +1 -1
  129. package/dist/date-input.js +11 -10
  130. package/dist/date-picker.d.ts +15 -131
  131. package/dist/date-picker.js +26 -22
  132. package/dist/date-types-DrDdF6WJ.d.ts +100 -0
  133. package/dist/dialog.d.ts +1 -1
  134. package/dist/dialog.js +10 -10
  135. package/dist/drawer.d.ts +1 -1
  136. package/dist/drawer.js +9 -9
  137. package/dist/dropdown-menu.d.ts +1 -1
  138. package/dist/dropdown-menu.js +6 -6
  139. package/dist/dropzone.d.ts +3 -3
  140. package/dist/dropzone.js +17 -16
  141. package/dist/form.d.ts +15 -5
  142. package/dist/form.js +75 -36
  143. package/dist/header-navigation.d.ts +2 -2
  144. package/dist/header-navigation.js +21 -20
  145. package/dist/helper.d.ts +1 -1
  146. package/dist/index.d.ts +25 -11
  147. package/dist/index.js +92 -79
  148. package/dist/indicator.js +4 -4
  149. package/dist/inline-banner.d.ts +68 -0
  150. package/dist/inline-banner.js +20 -0
  151. package/dist/input.d.ts +1 -1
  152. package/dist/input.js +10 -9
  153. package/dist/kanban-board.d.ts +2 -2
  154. package/dist/kanban-board.js +16 -15
  155. package/dist/labels-C992bt7G.d.ts +1160 -0
  156. package/dist/line-chart.d.ts +2 -2
  157. package/dist/line-chart.js +7 -6
  158. package/dist/mcp.js +231 -0
  159. package/dist/number-input.d.ts +1 -1
  160. package/dist/number-input.js +10 -9
  161. package/dist/pagination.d.ts +1 -1
  162. package/dist/pagination.js +14 -13
  163. package/dist/{card-D56VxyAe.d.ts → panel-CUGm_Mxy.d.ts} +9 -57
  164. package/dist/payment-input.d.ts +3 -3
  165. package/dist/payment-input.js +10 -9
  166. package/dist/picker-draft-BPV3MUPY.d.ts +9 -0
  167. package/dist/pie-chart.d.ts +2 -2
  168. package/dist/pie-chart.js +7 -6
  169. package/dist/popover.d.ts +65 -4
  170. package/dist/popover.js +9 -9
  171. package/dist/progress-steps.js +4 -4
  172. package/dist/progress.js +3 -3
  173. package/dist/provider.d.ts +1 -1
  174. package/dist/provider.js +3 -3
  175. package/dist/qr-code.d.ts +227 -0
  176. package/dist/qr-code.js +19 -0
  177. package/dist/radar-chart.d.ts +2 -2
  178. package/dist/radar-chart.js +7 -6
  179. package/dist/radial-chart.d.ts +2 -2
  180. package/dist/radial-chart.js +7 -6
  181. package/dist/radio.js +8 -7
  182. package/dist/rich-text-editor.d.ts +624 -0
  183. package/dist/rich-text-editor.js +51 -0
  184. package/dist/rich-text-highlight.d.ts +11 -0
  185. package/dist/rich-text-highlight.js +65 -0
  186. package/dist/rich-text-sanitize.d.ts +17 -0
  187. package/dist/rich-text-sanitize.js +176 -0
  188. package/dist/scroll-area.js +2 -2
  189. package/dist/select.d.ts +2 -2
  190. package/dist/select.js +17 -16
  191. package/dist/separator.js +2 -2
  192. package/dist/shared-CGf2D8ZX.d.ts +20 -0
  193. package/dist/sidebar-navigation.d.ts +76 -27
  194. package/dist/sidebar-navigation.js +16 -15
  195. package/dist/sidebar-state.d.ts +76 -0
  196. package/dist/sidebar-state.js +27 -0
  197. package/dist/skeleton.js +2 -2
  198. package/dist/slider.d.ts +321 -0
  199. package/dist/slider.js +13 -0
  200. package/dist/styles.css +1 -1
  201. package/dist/switch.d.ts +1 -1
  202. package/dist/switch.js +2 -2
  203. package/dist/table.d.ts +3 -19
  204. package/dist/table.js +34 -33
  205. package/dist/tabs.js +2 -2
  206. package/dist/tag-input.d.ts +3 -3
  207. package/dist/tag-input.js +13 -12
  208. package/dist/tag.d.ts +1 -1
  209. package/dist/tag.js +4 -4
  210. package/dist/textarea.js +8 -7
  211. package/dist/theme.css +965 -0
  212. package/dist/theme.js +12 -11
  213. package/dist/toast.d.ts +1 -1
  214. package/dist/toast.js +12 -11
  215. package/dist/tooltip.js +4 -3
  216. package/dist/tree.d.ts +1 -1
  217. package/dist/tree.js +6 -6
  218. package/dist/{types-DR9rAEy1.d.ts → types-DYFl0CEB.d.ts} +1 -1
  219. package/dist/{use-uploads-KaPqDklo.d.ts → use-uploads-2E7n0PWT.d.ts} +1 -1
  220. package/dist/verification-code-input.js +10 -9
  221. package/package.json +92 -8
  222. package/dist/chunk-BLIZ3CL3.js +0 -49
  223. package/dist/labels-DPrh0se9.d.ts +0 -627
  224. package/dist/panel-El4oI68p.d.ts +0 -9
  225. package/dist/shared-BYXJPnsN.d.ts +0 -11
@@ -0,0 +1,1129 @@
1
+ import { parseColor, toHex, sameColor, sortStops, toCss, sampleStops, reverseStops, BLACK, rgbaToHsva, hsvaToRgba, formatColor, COLOR_FORMATS, hueColor, convertKind, clampAlpha } from './chunk-UHSGD4CD.js';
2
+ import { Tabs } from './chunk-MVUNB43J.js';
3
+ import { ruleEdge } from './chunk-EVINS473.js';
4
+ import { NativeSelect } from './chunk-CQGMOPLG.js';
5
+ import { Button } from './chunk-R25NHHYT.js';
6
+ import { controlBoxClasses } from './chunk-A4YPUS6C.js';
7
+ import { ArrowLeftRightIcon, PlusIcon, XIcon, PipetteIcon } from './chunk-YGFTNICV.js';
8
+ import { cn } from './chunk-ZSNJ6UA3.js';
9
+ import { useLabels } from './chunk-ZJIY642R.js';
10
+ import { devWarn, warnRange, warnHostPadded } from './chunk-SF3HCW4G.js';
11
+ import { token } from './chunk-3ZEEGXYF.js';
12
+ import * as React5 from 'react';
13
+ import { jsx, jsxs } from 'react/jsx-runtime';
14
+
15
+ // src/components/color-picker/labels.ts
16
+ var COLOR_PICKER_LABELS = {
17
+ /** The saturation plane, and the two tracks. */
18
+ area: "Saturation and brightness",
19
+ hue: "Hue",
20
+ alpha: "Alpha",
21
+ /** A track that edits opacity as its OWN subject rather than as a colour's channel. */
22
+ opacity: "Opacity",
23
+ /** The Solid / Gradient strip. A single mode renders no strip, so these appear together. */
24
+ mode: "Color type",
25
+ solid: "Solid",
26
+ gradient: "Gradient",
27
+ /** The value row. */
28
+ format: "Color format",
29
+ value: "Color value",
30
+ alphaPercent: "Opacity percentage",
31
+ eyedropper: "Pick a color from the screen",
32
+ /** `<ColorInput>` — the bar, and the staged footer under `commit="confirm"`. */
33
+ placeholder: "Select color",
34
+ openPicker: "Select color",
35
+ required: "required",
36
+ cancel: "Cancel",
37
+ apply: "Apply",
38
+ /** The gradient body: the direction area, the type row, and the stop list. */
39
+ direction: "Gradient direction and stops",
40
+ gradientType: "Gradient type",
41
+ typeLinear: "Linear",
42
+ typeRadial: "Radial",
43
+ typeAngular: "Angular",
44
+ typeDiamond: "Diamond",
45
+ reverse: "Reverse gradient",
46
+ stops: "Stops",
47
+ stopRail: "Gradient stops",
48
+ addStop: "Add",
49
+ stopOffset: "Stop position",
50
+ /** Each endpoint handle and each rail thumb names the stop it moves. */
51
+ stopAt: (c) => `Gradient stop at ${c.percent}`,
52
+ removeStop: (c) => `Remove the stop at ${c.percent}`,
53
+ /** The swatch grid and its header. */
54
+ saved: "Saved",
55
+ add: "Add",
56
+ swatches: "Color swatches",
57
+ emptyPalette: "No colors to choose from",
58
+ /* The saved-GRADIENT grid, on the gradient tab. It reuses `saved` and `add` — the two sections are
59
+ * one idea in two places and never appear together — but the listbox, the empty line and the two
60
+ * names below are its own: "No colors to choose from" is false in front of a row of ramps, and a
61
+ * ctx called `color` carrying `linear-gradient(…)` would be a lie the translator has to work around. */
62
+ gradientSwatches: "Gradient swatches",
63
+ emptyGradients: "No gradients to choose from",
64
+ /* Holes ⇒ a `Label<Ctx>` function, never a `{token}` grammar: a grammar cannot express a plural,
65
+ * and `Intl` belongs to the app. */
66
+ areaValue: (c) => `Saturation ${c.saturation}, brightness ${c.brightness}`,
67
+ hueValue: (c) => `${c.degrees} degrees`,
68
+ alphaValue: (c) => `${c.percent} opacity`,
69
+ swatch: (c) => `Color ${c.color}`,
70
+ addSwatch: (c) => `Save ${c.color}`,
71
+ gradientSwatch: (c) => `Gradient ${c.gradient}`,
72
+ addGradientSwatch: (c) => `Save ${c.gradient}`
73
+ };
74
+ function normalizeSwatch(input) {
75
+ const color = typeof input === "string" ? input : input.color;
76
+ const label = typeof input === "string" ? void 0 : input.label;
77
+ const direct = parseColor(color, { quiet: true });
78
+ return { color, label, literal: direct === null ? null : toHex(direct) };
79
+ }
80
+ function swatchMeta(swatch) {
81
+ const token2 = swatch.literal === null ? swatch.color : void 0;
82
+ if (token2 === void 0 && swatch.label === void 0) return void 0;
83
+ return { ...token2 !== void 0 && { token: token2 }, ...swatch.label !== void 0 && { label: swatch.label } };
84
+ }
85
+ function normalizeGradientSwatch(input) {
86
+ const named = "gradient" in input;
87
+ const gradient = named ? input.gradient : input;
88
+ const stops = sortStops(gradient.stops);
89
+ return {
90
+ gradient: { ...gradient, stops },
91
+ label: named ? input.label : void 0,
92
+ // Quiet: a `var()` is not a mistake, and this runs on every stop of every swatch of every render.
93
+ literals: stops.map((s) => {
94
+ const direct = parseColor(s.color, { quiet: true });
95
+ return direct === null ? null : toHex(direct);
96
+ })
97
+ };
98
+ }
99
+ function gradientSwatchColors(swatches) {
100
+ return swatches.flatMap((s) => s.gradient.stops.map((stop) => stop.color));
101
+ }
102
+ function resolveGradientSwatch(swatch, resolve) {
103
+ const stops = [];
104
+ for (const [i, stop] of swatch.gradient.stops.entries()) {
105
+ const hex = swatch.literals[i] ?? resolve(stop.color);
106
+ if (hex === null) return null;
107
+ stops.push({ color: hex, offset: stop.offset });
108
+ }
109
+ return { ...swatch.gradient, stops };
110
+ }
111
+ function gradientSwatchMeta(swatch) {
112
+ return swatch.label === void 0 ? void 0 : { label: swatch.label };
113
+ }
114
+ function sameGradient(a, b) {
115
+ return toCss({ ...a, stops: sortStops(a.stops) }) === toCss({ ...b, stops: sortStops(b.stops) });
116
+ }
117
+ function emitPick(emit, value, meta) {
118
+ if (emit === void 0) return;
119
+ if (meta === void 0) emit(value);
120
+ else emit(value, meta);
121
+ }
122
+ var SENTINEL_A = "rgb(1, 2, 3)";
123
+ var SENTINEL_B = "rgb(4, 5, 6)";
124
+ function probeComputed(host, css) {
125
+ const inner = document.createElement("span");
126
+ inner.style.color = css;
127
+ if (inner.style.color === "") return null;
128
+ const outer = document.createElement("span");
129
+ outer.setAttribute("aria-hidden", "true");
130
+ outer.style.cssText = "position:absolute;width:0;height:0;overflow:hidden;visibility:hidden";
131
+ outer.append(inner);
132
+ host.append(outer);
133
+ try {
134
+ outer.style.color = SENTINEL_A;
135
+ const a = globalThis.getComputedStyle(inner).color;
136
+ outer.style.color = SENTINEL_B;
137
+ const b = globalThis.getComputedStyle(inner).color;
138
+ return a === b && a !== "" ? a : null;
139
+ } finally {
140
+ outer.remove();
141
+ }
142
+ }
143
+ var readback;
144
+ function canvasReadback(css) {
145
+ if (readback === void 0) readback = document.createElement("canvas").getContext("2d", { willReadFrequently: true });
146
+ const ctx = readback;
147
+ if (ctx === null) return null;
148
+ ctx.fillStyle = SENTINEL_A;
149
+ ctx.fillStyle = css;
150
+ const first = ctx.fillStyle;
151
+ ctx.fillStyle = SENTINEL_B;
152
+ ctx.fillStyle = css;
153
+ if (ctx.fillStyle !== first) return null;
154
+ const over = (background) => {
155
+ ctx.globalCompositeOperation = "source-over";
156
+ ctx.clearRect(0, 0, 1, 1);
157
+ ctx.fillStyle = background;
158
+ ctx.fillRect(0, 0, 1, 1);
159
+ ctx.fillStyle = css;
160
+ ctx.fillRect(0, 0, 1, 1);
161
+ const d = ctx.getImageData(0, 0, 1, 1).data;
162
+ const [r, g, b] = [d[0], d[1], d[2]];
163
+ return r === void 0 || g === void 0 || b === void 0 ? null : [r, g, b];
164
+ };
165
+ const black = over("#000000");
166
+ const white = over("#ffffff");
167
+ if (black === null || white === null) return null;
168
+ const a = 1 - (white[0] - black[0]) / 255;
169
+ if (a <= 0) return { r: 0, g: 0, b: 0, a: 0 };
170
+ const channel = (i) => Math.min(255, Math.round(black[i] / a));
171
+ return { r: channel(0), g: channel(1), b: channel(2), a: clampAlpha(a) };
172
+ }
173
+ function resolveCssColor(host, css) {
174
+ const direct = parseColor(css, { quiet: true });
175
+ if (direct !== null) return toHex(direct);
176
+ const computed = probeComputed(host, css);
177
+ if (computed === null) return null;
178
+ const parsed = parseColor(computed, { quiet: true }) ?? canvasReadback(computed);
179
+ return parsed === null ? null : toHex(parsed);
180
+ }
181
+ var EMPTY = /* @__PURE__ */ new Map();
182
+ function useResolvedColors(colors, host) {
183
+ const [cache, setCache] = React5.useState(EMPTY);
184
+ React5.useEffect(() => {
185
+ const el = host.current;
186
+ if (el === null) return;
187
+ const missing = colors.filter((c) => parseColor(c, { quiet: true }) === null && !cache.has(c));
188
+ if (missing.length === 0) return;
189
+ const next = new Map(cache);
190
+ for (const c of missing) {
191
+ const hex = resolveCssColor(el, c);
192
+ if (hex === null) {
193
+ devWarn(
194
+ `A color swatch of "${c}" could not be resolved to a color, so it cannot be picked. A \`var()\` swatch needs the custom property to be declared on the picker or an ancestor of it; anything else must be a color the browser itself accepts. For a HOUSE color use \`token("brand-600")\` rather than a hand-written \`var(--color-\u2026)\` \u2014 that argument is a checked union, so a name that does not exist is a type error instead of a swatch that silently does nothing.`
195
+ );
196
+ }
197
+ next.set(c, hex);
198
+ }
199
+ setCache(next);
200
+ }, [colors, cache, host]);
201
+ React5.useEffect(() => {
202
+ if (typeof MutationObserver === "undefined") return;
203
+ const observer = new MutationObserver(() => setCache(EMPTY));
204
+ observer.observe(document.documentElement, { attributes: true, attributeFilter: ["class", "data-theme"] });
205
+ return () => observer.disconnect();
206
+ }, []);
207
+ const lookup = React5.useCallback(
208
+ (color) => {
209
+ const direct = parseColor(color, { quiet: true });
210
+ if (direct !== null) return toHex(direct);
211
+ return cache.get(color) ?? null;
212
+ },
213
+ [cache]
214
+ );
215
+ const resolveNow = React5.useCallback(
216
+ (color) => {
217
+ const known = lookup(color);
218
+ if (known !== null) return known;
219
+ const el = host.current;
220
+ return el === null ? null : resolveCssColor(el, color);
221
+ },
222
+ [host, lookup]
223
+ );
224
+ return { lookup, resolveNow };
225
+ }
226
+ var THUMB = cn(
227
+ "absolute size-5 rounded-full border-[3px] border-fg-white shadow-md",
228
+ "-translate-x-1/2 -translate-y-1/2 cursor-grab outline-none data-dragging:cursor-grabbing",
229
+ "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring"
230
+ );
231
+ var TRACK = "relative h-3 w-full cursor-pointer rounded-full ring-[0.5px] ring-inset ring-on-color";
232
+ var AREA = "relative aspect-square w-full shrink-0 rounded-lg ring-[0.5px] ring-inset ring-on-color";
233
+ var HUE_PAINT = "linear-gradient(to right,#f00,#ff0,#0f0,#0ff,#00f,#f0f,#f00)";
234
+ var CHECKERBOARD = "repeating-conic-gradient(#ccc 0%,#ccc 25%,#fff 0%,#fff 50%) 50% center / 8px 8px";
235
+ function areaPaint(h) {
236
+ return `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent), ${hueColor(h)}`;
237
+ }
238
+ function alphaPaint(rgba) {
239
+ const opaque = toHex({ ...rgba, a: 1 });
240
+ return `linear-gradient(to right, ${toHex({ ...rgba, a: 0 })}, ${opaque}), ${CHECKERBOARD}`;
241
+ }
242
+ function swatchPaint(color) {
243
+ if (color.includes("gradient(")) return `${color}, ${CHECKERBOARD}`;
244
+ return `linear-gradient(${color}, ${color}), ${CHECKERBOARD}`;
245
+ }
246
+ var SWATCH_OUTER = "shrink-0 cursor-pointer rounded-full outline-none disabled:cursor-not-allowed";
247
+ var SWATCH_INNER = "block size-full rounded-full ring-1 ring-inset ring-on-color";
248
+ var SWATCH_SELECTED = "outline-solid outline-2 outline-offset-2 outline-(--swatch-color)";
249
+ var SWATCH_SIZE = { sm: "size-4", md: "size-5" };
250
+ var CHIP_BOX = {
251
+ color: SWATCH_SIZE,
252
+ ramp: { sm: "h-4 w-8", md: "h-5 w-10" }
253
+ };
254
+ var CHIP_RADIUS = { color: "rounded-full", ramp: "rounded-md" };
255
+ function SwatchChip({
256
+ shape,
257
+ size,
258
+ paint,
259
+ outline,
260
+ label,
261
+ title,
262
+ selected,
263
+ onSelect,
264
+ itemProps
265
+ }) {
266
+ return /* @__PURE__ */ jsx(
267
+ "button",
268
+ {
269
+ type: "button",
270
+ role: "option",
271
+ "aria-selected": selected,
272
+ "aria-label": label,
273
+ title,
274
+ className: cn(SWATCH_OUTER, CHIP_BOX[shape][size], CHIP_RADIUS[shape], selected && SWATCH_SELECTED),
275
+ style: { "--swatch-color": outline },
276
+ onClick: onSelect,
277
+ ...itemProps,
278
+ children: /* @__PURE__ */ jsx("span", { className: cn(SWATCH_INNER, CHIP_RADIUS[shape]), style: { background: paint } })
279
+ }
280
+ );
281
+ }
282
+ function useRovingIndex(count, columns) {
283
+ const [active, setActive] = React5.useState(0);
284
+ const items = React5.useRef([]);
285
+ const current = Math.min(active, Math.max(0, count - 1));
286
+ const move = (to) => {
287
+ const next = Math.min(Math.max(to, 0), count - 1);
288
+ setActive(next);
289
+ items.current[next]?.focus();
290
+ };
291
+ const itemProps = (index) => ({
292
+ tabIndex: index === current ? 0 : -1,
293
+ ref: (el) => {
294
+ items.current[index] = el;
295
+ },
296
+ onFocus: () => setActive(index),
297
+ onKeyDown: (e) => {
298
+ const step = e.key === "ArrowRight" ? 1 : e.key === "ArrowLeft" ? -1 : columns !== null && e.key === "ArrowDown" ? columns : columns !== null && e.key === "ArrowUp" ? -columns : null;
299
+ if (step !== null) {
300
+ e.preventDefault();
301
+ move(index + step);
302
+ return;
303
+ }
304
+ if (e.key === "Home" || e.key === "End") {
305
+ e.preventDefault();
306
+ move(e.key === "Home" ? 0 : count - 1);
307
+ }
308
+ }
309
+ });
310
+ return { itemProps };
311
+ }
312
+ function SwatchDot({ color, size = "sm", className }) {
313
+ return /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: cn(SWATCH_INNER, "shrink-0", SWATCH_SIZE[size], className), style: { background: swatchPaint(color) } });
314
+ }
315
+ function SwatchRow({
316
+ swatches,
317
+ resolve,
318
+ value,
319
+ size = "md",
320
+ listLabel,
321
+ optionLabel,
322
+ onSelect,
323
+ className
324
+ }) {
325
+ const { itemProps } = useRovingIndex(swatches.length, null);
326
+ return /* @__PURE__ */ jsx("div", { role: "listbox", "aria-label": listLabel, className: cn("flex flex-wrap gap-2", className), children: swatches.map((swatch, index) => {
327
+ const hex = swatch.literal ?? resolve(swatch.color);
328
+ const selected = hex !== null && sameColor(hex, value);
329
+ return /* @__PURE__ */ jsx(
330
+ SwatchChip,
331
+ {
332
+ shape: "color",
333
+ size,
334
+ paint: swatchPaint(swatch.color),
335
+ outline: swatch.color,
336
+ label: swatch.label ?? optionLabel(swatch.literal === null ? hex ?? swatch.color : swatch.color),
337
+ title: swatch.label,
338
+ selected,
339
+ onSelect: () => onSelect(swatch),
340
+ itemProps: itemProps(index)
341
+ },
342
+ `${swatch.color}-${index}`
343
+ );
344
+ }) });
345
+ }
346
+ function GradientSwatchRow({
347
+ swatches,
348
+ resolve,
349
+ value,
350
+ size = "md",
351
+ listLabel,
352
+ optionLabel,
353
+ onSelect,
354
+ className
355
+ }) {
356
+ const { itemProps } = useRovingIndex(swatches.length, null);
357
+ return /* @__PURE__ */ jsx("div", { role: "listbox", "aria-label": listLabel, className: cn("flex flex-wrap gap-2", className), children: swatches.map((swatch, index) => {
358
+ const resolved = resolveGradientSwatch(swatch, resolve);
359
+ const selected = resolved !== null && value !== null && sameGradient(resolved, value);
360
+ const paint = toCss(swatch.gradient);
361
+ return /* @__PURE__ */ jsx(
362
+ SwatchChip,
363
+ {
364
+ shape: "ramp",
365
+ size,
366
+ paint: swatchPaint(paint),
367
+ outline: resolved === null ? swatch.gradient.stops[0]?.color ?? "currentcolor" : sampleStops(resolved.stops, 0.5),
368
+ label: swatch.label ?? optionLabel(toCss(resolved ?? swatch.gradient)),
369
+ title: swatch.label,
370
+ selected,
371
+ onSelect: () => onSelect(swatch),
372
+ itemProps: itemProps(index)
373
+ },
374
+ `${paint}-${index}`
375
+ );
376
+ }) });
377
+ }
378
+ var TRACK_GESTURE = "touch-none select-none";
379
+ var clamp01 = (n) => n < 0 ? 0 : Math.min(n, 1);
380
+ function useTrackDrag(cfg) {
381
+ const [dragging, setDragging] = React5.useState(false);
382
+ const cfgRef = React5.useRef(cfg);
383
+ cfgRef.current = cfg;
384
+ const gesture = React5.useRef(null);
385
+ React5.useEffect(() => () => gesture.current?.end("cancel"), []);
386
+ const onPointerDown = React5.useCallback((e) => {
387
+ if (cfgRef.current.disabled === true || e.button !== 0 || gesture.current !== null) return;
388
+ const el = e.currentTarget;
389
+ const rect = el.getBoundingClientRect();
390
+ if (rect.width === 0 || rect.height === 0) return;
391
+ e.preventDefault();
392
+ el.setPointerCapture(e.pointerId);
393
+ const { pointerId } = e;
394
+ const emit = (clientX, clientY, phase) => {
395
+ const r = el.getBoundingClientRect();
396
+ if (r.width === 0 || r.height === 0) return;
397
+ cfgRef.current.onDrag({ x: clamp01((clientX - r.left) / r.width), y: clamp01((clientY - r.top) / r.height) }, phase);
398
+ };
399
+ const onMove = (ev) => {
400
+ if (ev.pointerId === pointerId) emit(ev.clientX, ev.clientY, "move");
401
+ };
402
+ const onUp = (ev) => {
403
+ if (ev.pointerId === pointerId) end("end");
404
+ };
405
+ const onLost = (ev) => {
406
+ if (ev.pointerId === pointerId) end("cancel");
407
+ };
408
+ const onKey = (ev) => {
409
+ if (ev.key !== "Escape") return;
410
+ ev.stopPropagation();
411
+ ev.preventDefault();
412
+ end("cancel");
413
+ };
414
+ const end = (reason) => {
415
+ if (gesture.current === null) return;
416
+ gesture.current = null;
417
+ el.removeEventListener("pointermove", onMove);
418
+ el.removeEventListener("pointerup", onUp);
419
+ el.removeEventListener("pointercancel", onLost);
420
+ el.removeEventListener("lostpointercapture", onLost);
421
+ document.removeEventListener("keydown", onKey, true);
422
+ if (el.hasPointerCapture(pointerId)) el.releasePointerCapture(pointerId);
423
+ setDragging(false);
424
+ if (reason === "end") cfgRef.current.onEnd?.();
425
+ else cfgRef.current.onCancel?.();
426
+ };
427
+ gesture.current = { end };
428
+ el.addEventListener("pointermove", onMove);
429
+ el.addEventListener("pointerup", onUp);
430
+ el.addEventListener("pointercancel", onLost);
431
+ el.addEventListener("lostpointercapture", onLost);
432
+ document.addEventListener("keydown", onKey, { capture: true });
433
+ setDragging(true);
434
+ emit(e.clientX, e.clientY, "start");
435
+ }, []);
436
+ return { trackProps: { onPointerDown, className: TRACK_GESTURE }, dragging };
437
+ }
438
+ function trackKeyStep(key, opts) {
439
+ const { axis, step, largeStep } = opts;
440
+ switch (key) {
441
+ case "ArrowLeft": {
442
+ return { dx: -step, dy: 0 };
443
+ }
444
+ case "ArrowRight": {
445
+ return { dx: step, dy: 0 };
446
+ }
447
+ // On a 1-D track ↑/↓ are a second spelling of →/←, which is what every slider does. On the area
448
+ // they move the OTHER axis, and up means up — `y` grows downward, so the sign flips here rather
449
+ // than at two call sites.
450
+ case "ArrowUp": {
451
+ return axis === "x" ? { dx: step, dy: 0 } : { dx: 0, dy: -step };
452
+ }
453
+ case "ArrowDown": {
454
+ return axis === "x" ? { dx: -step, dy: 0 } : { dx: 0, dy: step };
455
+ }
456
+ case "PageUp": {
457
+ return axis === "x" ? { dx: largeStep, dy: 0 } : { dx: 0, dy: -largeStep };
458
+ }
459
+ case "PageDown": {
460
+ return axis === "x" ? { dx: -largeStep, dy: 0 } : { dx: 0, dy: largeStep };
461
+ }
462
+ case "Home": {
463
+ return { absolute: "min" };
464
+ }
465
+ case "End": {
466
+ return { absolute: "max" };
467
+ }
468
+ default: {
469
+ return null;
470
+ }
471
+ }
472
+ }
473
+ var FORMAT_TEXT = {
474
+ hex: "Hex",
475
+ rgb: "RGB",
476
+ css: "CSS",
477
+ hsl: "HSL",
478
+ hsb: "HSB"
479
+ };
480
+ var segment = (side) => cn(
481
+ controlBoxClasses({ size: "sm" }),
482
+ "flex h-9 items-center gap-2 px-2.5 focus-within:z-10",
483
+ side === "left" ? "min-w-0 flex-1 rounded-l-lg rounded-r-none" : "-ml-px w-14 shrink-0 rounded-l-none rounded-r-lg"
484
+ );
485
+ var BARE_INPUT = "w-full min-w-0 bg-transparent text-sm text-primary outline-hidden placeholder:text-placeholder";
486
+ function ValueRow({ text, onCommit, format, onFormatChange, formats, color, alpha, onAlphaChange, t }) {
487
+ const options = React5.useMemo(() => formats.map((f) => ({ value: f, label: FORMAT_TEXT[f] })), [formats]);
488
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
489
+ formats.length > 1 ? /* @__PURE__ */ jsx(
490
+ NativeSelect,
491
+ {
492
+ size: "sm",
493
+ fullWidth: false,
494
+ className: "w-20 shrink-0",
495
+ "aria-label": t.format,
496
+ options,
497
+ value: format,
498
+ onChange: (e) => onFormatChange(e.target.value)
499
+ }
500
+ ) : (
501
+ // One option is not a choice — the same derived affordance the mode strip follows.
502
+ /* @__PURE__ */ jsx("span", { className: "w-20 shrink-0 truncate text-sm font-medium text-primary", children: FORMAT_TEXT[format] })
503
+ ),
504
+ /* @__PURE__ */ jsx(ValuePair, { t, text, onCommit, color, alpha, onAlphaChange, className: "flex-1" })
505
+ ] });
506
+ }
507
+ function ValuePair({ text, onCommit, color, alpha, onAlphaChange, t, className }) {
508
+ const [buffer, setBuffer] = React5.useState(null);
509
+ const [bad, setBad] = React5.useState(false);
510
+ const shown = buffer ?? text;
511
+ const [alphaBuffer, setAlphaBuffer] = React5.useState(null);
512
+ const alphaShown = alphaBuffer ?? (alpha === null ? "" : String(Math.round(alpha * 100)));
513
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex min-w-0 shadow-xs", className), children: [
514
+ /* @__PURE__ */ jsxs("div", { className: cn(segment("left"), bad && "outline-error_subtle"), children: [
515
+ /* @__PURE__ */ jsx(SwatchDot, { color }),
516
+ /* @__PURE__ */ jsx(
517
+ "input",
518
+ {
519
+ "aria-label": t.value,
520
+ "aria-invalid": bad || void 0,
521
+ className: BARE_INPUT,
522
+ value: shown,
523
+ spellCheck: false,
524
+ autoComplete: "off",
525
+ onChange: (e) => {
526
+ setBuffer(e.target.value);
527
+ setBad(!onCommit(e.target.value));
528
+ },
529
+ onBlur: () => {
530
+ setBuffer(null);
531
+ setBad(false);
532
+ }
533
+ }
534
+ )
535
+ ] }),
536
+ alpha === null ? null : /* @__PURE__ */ jsx("div", { className: segment("right"), children: /* @__PURE__ */ jsx(
537
+ "input",
538
+ {
539
+ "aria-label": t.alphaPercent,
540
+ inputMode: "numeric",
541
+ className: cn(BARE_INPUT, "tabular-nums"),
542
+ value: alphaShown,
543
+ spellCheck: false,
544
+ autoComplete: "off",
545
+ onChange: (e) => {
546
+ const raw = e.target.value.replaceAll("%", "").trim();
547
+ setAlphaBuffer(raw);
548
+ const n = Number(raw);
549
+ if (raw !== "" && Number.isFinite(n)) onAlphaChange(Math.min(100, Math.max(0, n)) / 100);
550
+ },
551
+ onBlur: () => setAlphaBuffer(null)
552
+ }
553
+ ) })
554
+ ] });
555
+ }
556
+ var TYPES = ["linear", "radial", "angular", "diamond"];
557
+ var TYPE_LABEL = {
558
+ linear: "typeLinear",
559
+ radial: "typeRadial",
560
+ angular: "typeAngular",
561
+ diamond: "typeDiamond"
562
+ };
563
+ var MIN_STOPS = 2;
564
+ var clamp012 = (n) => n < 0 ? 0 : Math.min(n, 1);
565
+ var pct = (n) => `${Math.round(n * 100)}%`;
566
+ function endpoints(angle) {
567
+ const rad = angle * Math.PI / 180;
568
+ const dx = Math.sin(rad) * 50;
569
+ const dy = Math.cos(rad) * 50;
570
+ return { start: [50 - dx, 50 + dy], end: [50 + dx, 50 - dy] };
571
+ }
572
+ function angleAt(x, y) {
573
+ const deg = Math.atan2(x - 0.5, 0.5 - y) * 180 / Math.PI;
574
+ return (Math.round(deg) + 360) % 360;
575
+ }
576
+ function GradientPicker({ value, onValueChange, alpha = true, swatches, onAddSwatch, addingSwatch = false, labels, className }) {
577
+ const t = useLabels("colorPicker", COLOR_PICKER_LABELS, labels);
578
+ const root = React5.useRef(null);
579
+ const stops = React5.useMemo(() => sortStops(value.stops), [value.stops]);
580
+ React5.useEffect(() => {
581
+ warnRange("GradientPicker", "angle", Number.isFinite(value.angle) ? 0 : NaN, 0, 360);
582
+ }, [value.angle]);
583
+ React5.useEffect(() => {
584
+ if (value.stops.length < MIN_STOPS) {
585
+ devWarn(
586
+ `<GradientPicker> was given ${value.stops.length} stop(s); a gradient needs at least ${MIN_STOPS}. The rail renders what it was handed, but the ramp has no direction until a second stop exists.`
587
+ );
588
+ }
589
+ }, [value.stops.length]);
590
+ const emit = (next) => onValueChange({ ...value, ...next });
591
+ const setStops = (next) => emit({ stops: sortStops(next) });
592
+ const current = React5.useMemo(() => ({ ...value, stops }), [value, stops]);
593
+ const currentCss = toCss(current);
594
+ const savedItems = React5.useMemo(() => (swatches ?? []).map((s) => normalizeGradientSwatch(s)), [swatches]);
595
+ const { lookup, resolveNow } = useResolvedColors(
596
+ React5.useMemo(() => gradientSwatchColors(savedItems), [savedItems]),
597
+ root
598
+ );
599
+ const replaceStop = (index, patch) => setStops(stops.map((s, i) => i === index ? { ...s, ...patch } : s));
600
+ const dragEnd = React5.useRef("end");
601
+ const area = useTrackDrag({
602
+ onDrag: (pt) => {
603
+ const a = angleAt(pt.x, pt.y);
604
+ emit({ angle: dragEnd.current === "end" ? a : (a + 180) % 360 });
605
+ }
606
+ });
607
+ const { start, end } = endpoints(value.angle);
608
+ const onEndpointKey = (e) => {
609
+ const move = trackKeyStep(e.key, { axis: "x", step: 1 / 360, largeStep: 15 / 360 });
610
+ if (move === null) return;
611
+ e.preventDefault();
612
+ if ("absolute" in move) emit({ angle: move.absolute === "min" ? 0 : 180 });
613
+ else emit({ angle: (value.angle + move.dx * 360 + 360) % 360 });
614
+ };
615
+ const handle = (which, at, offset) => /* @__PURE__ */ jsx(
616
+ "div",
617
+ {
618
+ role: "slider",
619
+ tabIndex: 0,
620
+ "aria-label": t.stopAt({ percent: pct(offset) }),
621
+ "aria-valuemin": 0,
622
+ "aria-valuemax": 360,
623
+ "aria-valuenow": Math.round(which === "end" ? value.angle : (value.angle + 180) % 360),
624
+ "aria-valuetext": t.hueValue({ degrees: String(Math.round(value.angle)) }),
625
+ onKeyDown: onEndpointKey,
626
+ onPointerDown: () => {
627
+ dragEnd.current = which;
628
+ },
629
+ className: cn(THUMB, "z-10"),
630
+ style: {
631
+ left: `${at[0]}%`,
632
+ top: `${at[1]}%`,
633
+ background: sampleStops(stops, offset)
634
+ }
635
+ },
636
+ which
637
+ );
638
+ const railTarget = React5.useRef(null);
639
+ const rail = useTrackDrag({
640
+ onDrag: (pt, phase) => {
641
+ if (phase === "start" && railTarget.current === null) {
642
+ const added = { color: sampleStops(stops, pt.x), offset: clamp012(pt.x) };
643
+ const next = sortStops([...stops, added]);
644
+ railTarget.current = next.indexOf(added);
645
+ setStops(next);
646
+ return;
647
+ }
648
+ const i = railTarget.current;
649
+ if (i === null) return;
650
+ const moved = stops.map((s, k) => k === i ? { ...s, offset: clamp012(pt.x) } : s);
651
+ const sorted = sortStops(moved);
652
+ railTarget.current = sorted.indexOf(moved[i]);
653
+ setStops(sorted);
654
+ },
655
+ onEnd: () => {
656
+ railTarget.current = null;
657
+ },
658
+ onCancel: () => {
659
+ railTarget.current = null;
660
+ }
661
+ });
662
+ const onRailKey = (index) => (e) => {
663
+ const stop = stops[index];
664
+ if (stop === void 0) return;
665
+ if ((e.key === "Delete" || e.key === "Backspace") && stops.length > MIN_STOPS) {
666
+ e.preventDefault();
667
+ setStops(stops.filter((_, i) => i !== index));
668
+ return;
669
+ }
670
+ const move = trackKeyStep(e.key, { axis: "x", step: 0.01, largeStep: 0.1 });
671
+ if (move === null) return;
672
+ e.preventDefault();
673
+ const next = "absolute" in move ? move.absolute === "min" ? 0 : 1 : clamp012(stop.offset + move.dx);
674
+ setStops(stops.map((s, i) => i === index ? { ...s, offset: next } : s));
675
+ };
676
+ const setStopColor = (index, text) => {
677
+ const rgba = parseColor(text, { quiet: true });
678
+ if (rgba === null) return false;
679
+ replaceStop(index, { color: toHex(alpha ? rgba : { ...rgba, a: 1 }) });
680
+ return true;
681
+ };
682
+ const addStop = () => {
683
+ let at = 0.5;
684
+ let widest = -1;
685
+ for (let i = 0; i < stops.length - 1; i++) {
686
+ const gap = stops[i + 1].offset - stops[i].offset;
687
+ if (gap > widest) {
688
+ widest = gap;
689
+ at = stops[i].offset + gap / 2;
690
+ }
691
+ }
692
+ setStops([...stops, { color: sampleStops(stops, at), offset: at }]);
693
+ };
694
+ const railPaint = `linear-gradient(90deg, ${stops.map((s) => `${s.color} ${pct(s.offset)}`).join(", ")})`;
695
+ return /* @__PURE__ */ jsxs("div", { ref: root, className: cn("flex flex-col gap-3 p-4", className), children: [
696
+ /* @__PURE__ */ jsxs("div", { ...area.trackProps, role: "group", "aria-label": t.direction, className: cn(AREA, area.trackProps.className, "bg-transparent"), children: [
697
+ /* @__PURE__ */ jsx("div", { className: "absolute inset-0 overflow-hidden rounded-lg ring-[0.5px] ring-on-color ring-inset", style: { background: toCss(value) } }),
698
+ /* @__PURE__ */ jsx("svg", { className: "pointer-events-none absolute inset-0 size-full overflow-visible", "aria-hidden": true, children: /* @__PURE__ */ jsx(
699
+ "line",
700
+ {
701
+ x1: `${start[0]}%`,
702
+ y1: `${start[1]}%`,
703
+ x2: `${end[0]}%`,
704
+ y2: `${end[1]}%`,
705
+ stroke: token("fg-on-color"),
706
+ strokeWidth: 2,
707
+ strokeDasharray: "3 5",
708
+ strokeLinecap: "round"
709
+ }
710
+ ) }),
711
+ handle("start", start, 0),
712
+ handle("end", end, 1)
713
+ ] }),
714
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3", children: [
715
+ /* @__PURE__ */ jsx(
716
+ NativeSelect,
717
+ {
718
+ size: "sm",
719
+ fullWidth: false,
720
+ className: "w-32",
721
+ "aria-label": t.gradientType,
722
+ options: TYPES.map((type) => ({ value: type, label: t[TYPE_LABEL[type]] })),
723
+ value: value.type,
724
+ onChange: (e) => emit({ type: e.target.value })
725
+ }
726
+ ),
727
+ /* @__PURE__ */ jsx(
728
+ Button,
729
+ {
730
+ variant: "tertiary",
731
+ color: "neutral",
732
+ size: "sm",
733
+ iconOnly: true,
734
+ leading: /* @__PURE__ */ jsx(ArrowLeftRightIcon, {}),
735
+ "aria-label": t.reverse,
736
+ onClick: () => setStops(reverseStops(stops))
737
+ }
738
+ )
739
+ ] }),
740
+ /* @__PURE__ */ jsx("div", { ...rail.trackProps, role: "group", "aria-label": t.stopRail, className: cn(TRACK, rail.trackProps.className), style: { background: railPaint }, children: stops.map((stop, index) => /* @__PURE__ */ jsx(
741
+ "div",
742
+ {
743
+ role: "slider",
744
+ tabIndex: 0,
745
+ "aria-label": t.stopAt({ percent: pct(stop.offset) }),
746
+ "aria-orientation": "horizontal",
747
+ "aria-valuemin": 0,
748
+ "aria-valuemax": 100,
749
+ "aria-valuenow": Math.round(stop.offset * 100),
750
+ "aria-valuetext": pct(stop.offset),
751
+ onPointerDown: () => {
752
+ railTarget.current = index;
753
+ },
754
+ onKeyDown: onRailKey(index),
755
+ className: cn(THUMB, "top-1/2"),
756
+ style: { left: pct(stop.offset), background: stop.color }
757
+ },
758
+ `${stop.offset}-${index}`
759
+ )) }),
760
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
761
+ /* @__PURE__ */ jsx("p", { className: "flex-1 text-sm font-semibold text-secondary", children: t.stops }),
762
+ /* @__PURE__ */ jsx(Button, { variant: "link", color: "neutral", size: "sm", leading: /* @__PURE__ */ jsx(PlusIcon, {}), onClick: addStop, children: t.addStop })
763
+ ] }),
764
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3", children: stops.map((stop, index) => {
765
+ const rgba = parseColor(stop.color, { quiet: true }) ?? BLACK;
766
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
767
+ /* @__PURE__ */ jsx(OffsetInput, { t, offset: stop.offset, onCommit: (next) => replaceStop(index, { offset: next }) }),
768
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-1", children: [
769
+ /* @__PURE__ */ jsx(
770
+ ValuePair,
771
+ {
772
+ t,
773
+ className: "flex-1",
774
+ text: toHex({ ...rgba, a: 1 }),
775
+ onCommit: (text) => setStopColor(index, text),
776
+ color: stop.color,
777
+ alpha: alpha ? rgba.a : null,
778
+ onAlphaChange: (a) => replaceStop(index, { color: toHex({ ...rgba, a }) })
779
+ }
780
+ ),
781
+ stops.length > MIN_STOPS ? /* @__PURE__ */ jsx(
782
+ Button,
783
+ {
784
+ variant: "tertiary",
785
+ color: "neutral",
786
+ size: "sm",
787
+ iconOnly: true,
788
+ leading: /* @__PURE__ */ jsx(XIcon, {}),
789
+ "aria-label": t.removeStop({ percent: pct(stop.offset) }),
790
+ onClick: () => setStops(stops.filter((_, i) => i !== index))
791
+ }
792
+ ) : null
793
+ ] })
794
+ ] }, `row-${stop.offset}-${index}`);
795
+ }) }),
796
+ swatches === void 0 ? null : /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
797
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
798
+ /* @__PURE__ */ jsx("p", { className: "flex-1 text-sm font-semibold text-secondary", children: t.saved }),
799
+ onAddSwatch === void 0 ? null : /* @__PURE__ */ jsx(
800
+ Button,
801
+ {
802
+ variant: "link",
803
+ color: "neutral",
804
+ size: "sm",
805
+ leading: /* @__PURE__ */ jsx(PlusIcon, {}),
806
+ loading: addingSwatch,
807
+ showTextWhileLoading: true,
808
+ "aria-label": t.addGradientSwatch({ gradient: currentCss }),
809
+ onClick: () => onAddSwatch(current),
810
+ children: t.add
811
+ }
812
+ )
813
+ ] }),
814
+ swatches.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-sm text-tertiary", children: t.emptyGradients }) : /* @__PURE__ */ jsx(
815
+ GradientSwatchRow,
816
+ {
817
+ swatches: savedItems,
818
+ resolve: lookup,
819
+ value: current,
820
+ listLabel: t.gradientSwatches,
821
+ optionLabel: (gradient) => t.gradientSwatch({ gradient }),
822
+ onSelect: (swatch) => {
823
+ const picked = resolveGradientSwatch(swatch, resolveNow);
824
+ if (picked !== null) emitPick(onValueChange, picked, gradientSwatchMeta(swatch));
825
+ }
826
+ }
827
+ )
828
+ ] })
829
+ ] });
830
+ }
831
+ function OffsetInput({ offset, onCommit, t }) {
832
+ const [buffer, setBuffer] = React5.useState(null);
833
+ const shown = buffer ?? String(Math.round(offset * 100));
834
+ return /* @__PURE__ */ jsx("div", { className: cn(controlBoxClasses({ size: "sm" }), "flex h-9 w-14 shrink-0 items-center px-2.5"), children: /* @__PURE__ */ jsx(
835
+ "input",
836
+ {
837
+ "aria-label": t.stopOffset,
838
+ inputMode: "numeric",
839
+ className: "w-full min-w-0 bg-transparent text-sm text-primary tabular-nums outline-hidden",
840
+ value: shown,
841
+ spellCheck: false,
842
+ autoComplete: "off",
843
+ onChange: (e) => {
844
+ const raw = e.target.value.replaceAll("%", "").trim();
845
+ setBuffer(raw);
846
+ const n = Number(raw);
847
+ if (raw !== "" && Number.isFinite(n)) onCommit(clamp012(n / 100));
848
+ },
849
+ onBlur: () => setBuffer(null)
850
+ }
851
+ ) });
852
+ }
853
+ GradientPicker.displayName = "GradientPicker";
854
+ function sameRgba(a, b) {
855
+ return a.r === b.r && a.g === b.g && a.b === b.b && Math.round(a.a * 255) === Math.round(b.a * 255);
856
+ }
857
+ function useColorState(opts) {
858
+ const { color, format, alpha, onColorChange } = opts;
859
+ const [hsva, setHsva] = React5.useState(() => rgbaToHsva(parseColor(color) ?? BLACK));
860
+ const [seenColor, setSeenColor] = React5.useState(color);
861
+ if (color !== seenColor) {
862
+ setSeenColor(color);
863
+ const incoming = parseColor(color);
864
+ if (incoming !== null && !sameRgba(incoming, hsvaToRgba(hsva))) setHsva(rgbaToHsva(incoming, hsva));
865
+ }
866
+ const emit = React5.useCallback(
867
+ (next, meta) => {
868
+ setHsva(next);
869
+ onColorChange(formatColor(hsvaToRgba(next), format), meta);
870
+ },
871
+ [format, onColorChange]
872
+ );
873
+ const setChannels = React5.useCallback((patch) => emit({ ...hsva, ...patch, ...!alpha && { a: 1 } }), [alpha, emit, hsva]);
874
+ const setText = React5.useCallback(
875
+ (text, meta) => {
876
+ const rgba = parseColor(text);
877
+ if (rgba === null) return false;
878
+ emit(rgbaToHsva(alpha ? rgba : { ...rgba, a: 1 }, hsva), meta);
879
+ return true;
880
+ },
881
+ [alpha, emit, hsva]
882
+ );
883
+ const lastFormat = React5.useRef(format);
884
+ React5.useEffect(() => {
885
+ if (lastFormat.current === format) return;
886
+ lastFormat.current = format;
887
+ onColorChange(formatColor(hsvaToRgba(hsva), format));
888
+ }, [format]);
889
+ return { hsva, setChannels, setText, text: formatColor(hsvaToRgba(hsva), format) };
890
+ }
891
+ var MODE_LABEL = { solid: "solid", gradient: "gradient" };
892
+ var pct2 = (n) => `${Math.round(n * 100)}%`;
893
+ function ColorPicker({
894
+ value,
895
+ onValueChange,
896
+ formats = COLOR_FORMATS,
897
+ alpha = true,
898
+ modes = ["solid", "gradient"],
899
+ eyedropper = true,
900
+ swatches,
901
+ onAddSwatch,
902
+ addingSwatch = false,
903
+ gradientSwatches,
904
+ onAddGradientSwatch,
905
+ addingGradientSwatch = false,
906
+ labels,
907
+ className
908
+ }) {
909
+ const t = useLabels("colorPicker", COLOR_PICKER_LABELS, labels);
910
+ const root = React5.useRef(null);
911
+ const [pick, setFormat] = React5.useState(null);
912
+ const format = pick !== null && formats.includes(pick) ? pick : formats[0] ?? "hex";
913
+ React5.useEffect(() => warnHostPadded("ColorPicker", root.current), []);
914
+ const orphanGradient = value.kind === "gradient" && !modes.includes("gradient");
915
+ React5.useEffect(() => {
916
+ if (orphanGradient) {
917
+ devWarn(
918
+ '<ColorPicker> was given a gradient value but `modes` does not include "gradient", so there is no tab to edit it in. Showing its first stop as a solid. Add `modes={["solid", "gradient"]}`.'
919
+ );
920
+ }
921
+ }, [orphanGradient]);
922
+ const solidColor = value.kind === "solid" ? value.color : value.stops[0]?.color ?? "#000000";
923
+ const items = React5.useMemo(() => (swatches ?? []).map((s) => normalizeSwatch(s)), [swatches]);
924
+ const { lookup, resolveNow } = useResolvedColors(
925
+ React5.useMemo(() => items.map((s) => s.color), [items]),
926
+ root
927
+ );
928
+ const state = useColorState({
929
+ color: solidColor,
930
+ format,
931
+ alpha,
932
+ // `meta` is threaded, never invented: only `setText` carries one, so a drag, a typed edit and the
933
+ // format effect all emit exactly what they emitted before — ONE argument, via `emitPick`.
934
+ onColorChange: (next, meta) => emitPick(onValueChange, { kind: "solid", color: next }, meta)
935
+ });
936
+ const { hsva, setChannels } = state;
937
+ const rgba = hsvaToRgba(hsva);
938
+ const css = toHex(rgba);
939
+ const stash = React5.useRef({});
940
+ const selectMode = (next) => {
941
+ if (next === value.kind) return;
942
+ stash.current[value.kind] = value;
943
+ onValueChange(stash.current[next] ?? convertKind(value, next));
944
+ };
945
+ const area = useTrackDrag({
946
+ onDrag: (pt) => setChannels({ s: pt.x, v: 1 - pt.y })
947
+ });
948
+ const onAreaKey = (e) => {
949
+ const move = trackKeyStep(e.key, { axis: "xy", step: 0.01, largeStep: 0.1 });
950
+ if (move === null) return;
951
+ e.preventDefault();
952
+ if ("absolute" in move) setChannels(move.absolute === "min" ? { s: 0, v: 0 } : { s: 1, v: 1 });
953
+ else setChannels({ s: clamp013(hsva.s + move.dx), v: clamp013(hsva.v - move.dy) });
954
+ };
955
+ const hue = useTrackDrag({ onDrag: (pt) => setChannels({ h: pt.x * 360 }) });
956
+ const opacity = useTrackDrag({ onDrag: (pt) => setChannels({ a: Math.round(pt.x * 100) / 100 }) });
957
+ const onTrackKey = (channel) => (e) => {
958
+ const span = channel === "h" ? 360 : 1;
959
+ const move = trackKeyStep(e.key, { axis: "x", step: 1 / (channel === "h" ? 360 : 100), largeStep: 0.1 });
960
+ if (move === null) return;
961
+ e.preventDefault();
962
+ const current = (channel === "h" ? hsva.h / 360 : hsva.a) + ("absolute" in move ? 0 : move.dx);
963
+ const next = "absolute" in move ? move.absolute === "min" ? 0 : 1 : clamp013(current);
964
+ setChannels(channel === "h" ? { h: next * span } : { a: Math.round(next * 100) / 100 });
965
+ };
966
+ const [canSample, setCanSample] = React5.useState(false);
967
+ React5.useEffect(() => setCanSample(typeof window !== "undefined" && globalThis.EyeDropper !== void 0), []);
968
+ const sample = () => {
969
+ const Ctor = globalThis.EyeDropper;
970
+ if (Ctor === void 0) return;
971
+ void new Ctor().open().then((result) => state.setText(result.sRGBHex)).catch(() => {
972
+ });
973
+ };
974
+ return /* @__PURE__ */ jsxs("div", { ref: root, className: cn("flex flex-col", className), children: [
975
+ modes.length > 1 ? /* @__PURE__ */ jsx("div", { className: cn("px-4 pt-4 pb-3", ruleEdge("line", "bottom")), children: /* @__PURE__ */ jsx(
976
+ Tabs,
977
+ {
978
+ items: modes.map((m) => ({ value: m, label: t[MODE_LABEL[m]] })),
979
+ value: value.kind,
980
+ onValueChange: selectMode,
981
+ variant: "pill",
982
+ size: "sm",
983
+ fitted: true,
984
+ className: "w-full",
985
+ "aria-label": t.mode
986
+ }
987
+ ) }) : null,
988
+ value.kind === "gradient" && modes.includes("gradient") ? (
989
+ /* `onValueChange` goes down UNWRAPPED, which is what carries a gradient pick's `meta` out with
990
+ no second channel: the gradient body's emission signature is this one narrowed to its own
991
+ half of the union. */
992
+ /* @__PURE__ */ jsx(
993
+ GradientPicker,
994
+ {
995
+ value,
996
+ onValueChange,
997
+ alpha,
998
+ swatches: gradientSwatches,
999
+ onAddSwatch: onAddGradientSwatch,
1000
+ addingSwatch: addingGradientSwatch,
1001
+ labels
1002
+ }
1003
+ )
1004
+ ) : /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 p-4", children: [
1005
+ /* @__PURE__ */ jsx("div", { ...area.trackProps, role: "group", "aria-label": t.area, className: cn(AREA, area.trackProps.className), style: { background: areaPaint(hsva.h) }, children: /* @__PURE__ */ jsx(
1006
+ "div",
1007
+ {
1008
+ role: "slider",
1009
+ tabIndex: 0,
1010
+ "aria-label": t.area,
1011
+ "aria-valuemin": 0,
1012
+ "aria-valuemax": 100,
1013
+ "aria-valuenow": Math.round(hsva.s * 100),
1014
+ "aria-valuetext": t.areaValue({ saturation: pct2(hsva.s), brightness: pct2(hsva.v) }),
1015
+ "data-dragging": area.dragging || void 0,
1016
+ onKeyDown: onAreaKey,
1017
+ className: THUMB,
1018
+ style: {
1019
+ left: `${hsva.s * 100}%`,
1020
+ top: `${(1 - hsva.v) * 100}%`,
1021
+ backgroundColor: toHex({ ...rgba, a: 1 })
1022
+ }
1023
+ }
1024
+ ) }),
1025
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
1026
+ eyedropper && canSample ? /* @__PURE__ */ jsx(Button, { variant: "secondary", size: "sm", iconOnly: true, leading: /* @__PURE__ */ jsx(PipetteIcon, {}), "aria-label": t.eyedropper, onClick: sample }) : null,
1027
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col gap-3", children: [
1028
+ /* @__PURE__ */ jsx("div", { ...hue.trackProps, role: "group", "aria-label": t.hue, className: cn(TRACK, hue.trackProps.className), style: { background: HUE_PAINT }, children: /* @__PURE__ */ jsx(
1029
+ "div",
1030
+ {
1031
+ role: "slider",
1032
+ tabIndex: 0,
1033
+ "aria-label": t.hue,
1034
+ "aria-orientation": "horizontal",
1035
+ "aria-valuemin": 0,
1036
+ "aria-valuemax": 360,
1037
+ "aria-valuenow": Math.round(hsva.h),
1038
+ "aria-valuetext": t.hueValue({ degrees: String(Math.round(hsva.h)) }),
1039
+ "data-dragging": hue.dragging || void 0,
1040
+ onKeyDown: onTrackKey("h"),
1041
+ className: cn(THUMB, "top-1/2"),
1042
+ style: { left: `${hsva.h / 360 * 100}%`, backgroundColor: hueColor(hsva.h) }
1043
+ }
1044
+ ) }),
1045
+ alpha ? /* @__PURE__ */ jsx(
1046
+ "div",
1047
+ {
1048
+ ...opacity.trackProps,
1049
+ role: "group",
1050
+ "aria-label": t.alpha,
1051
+ className: cn(TRACK, opacity.trackProps.className),
1052
+ style: { background: alphaPaint(rgba) },
1053
+ children: /* @__PURE__ */ jsx(
1054
+ "div",
1055
+ {
1056
+ role: "slider",
1057
+ tabIndex: 0,
1058
+ "aria-label": t.alpha,
1059
+ "aria-orientation": "horizontal",
1060
+ "aria-valuemin": 0,
1061
+ "aria-valuemax": 100,
1062
+ "aria-valuenow": Math.round(hsva.a * 100),
1063
+ "aria-valuetext": t.alphaValue({ percent: pct2(hsva.a) }),
1064
+ "data-dragging": opacity.dragging || void 0,
1065
+ onKeyDown: onTrackKey("a"),
1066
+ className: cn(THUMB, "top-1/2"),
1067
+ style: { left: `${hsva.a * 100}%`, background: swatchPaint(css) }
1068
+ }
1069
+ )
1070
+ }
1071
+ ) : null
1072
+ ] })
1073
+ ] }),
1074
+ /* @__PURE__ */ jsx(
1075
+ ValueRow,
1076
+ {
1077
+ t,
1078
+ text: state.text,
1079
+ onCommit: state.setText,
1080
+ format,
1081
+ onFormatChange: setFormat,
1082
+ formats,
1083
+ color: css,
1084
+ alpha: alpha ? hsva.a : null,
1085
+ onAlphaChange: (a) => setChannels({ a })
1086
+ }
1087
+ ),
1088
+ swatches === void 0 ? null : /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
1089
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
1090
+ /* @__PURE__ */ jsx("p", { className: "flex-1 text-sm font-semibold text-secondary", children: t.saved }),
1091
+ onAddSwatch === void 0 ? null : /* @__PURE__ */ jsx(
1092
+ Button,
1093
+ {
1094
+ variant: "link",
1095
+ color: "neutral",
1096
+ size: "sm",
1097
+ leading: /* @__PURE__ */ jsx(PlusIcon, {}),
1098
+ loading: addingSwatch,
1099
+ showTextWhileLoading: true,
1100
+ "aria-label": t.addSwatch({ color: css }),
1101
+ onClick: () => onAddSwatch(css),
1102
+ children: t.add
1103
+ }
1104
+ )
1105
+ ] }),
1106
+ swatches.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-sm text-tertiary", children: t.emptyPalette }) : /* @__PURE__ */ jsx(
1107
+ SwatchRow,
1108
+ {
1109
+ swatches: items,
1110
+ resolve: lookup,
1111
+ value: css,
1112
+ listLabel: t.swatches,
1113
+ optionLabel: (color) => t.swatch({ color }),
1114
+ onSelect: (swatch) => {
1115
+ const hex = swatch.literal ?? resolveNow(swatch.color);
1116
+ if (hex !== null) state.setText(hex, swatchMeta(swatch));
1117
+ }
1118
+ }
1119
+ )
1120
+ ] })
1121
+ ] })
1122
+ ] });
1123
+ }
1124
+ var clamp013 = (n) => n < 0 ? 0 : Math.min(n, 1);
1125
+ ColorPicker.displayName = "ColorPicker";
1126
+
1127
+ export { COLOR_PICKER_LABELS, ColorPicker, GradientPicker, HUE_PAINT, MIN_STOPS, SWATCH_INNER, SWATCH_SELECTED, SwatchChip, SwatchDot, SwatchRow, THUMB, TRACK, ValueRow, alphaPaint, emitPick, normalizeSwatch, resolveCssColor, swatchMeta, swatchPaint, trackKeyStep, useColorState, useResolvedColors, useRovingIndex, useTrackDrag };
1128
+ //# sourceMappingURL=chunk-QTWRR7IS.js.map
1129
+ //# sourceMappingURL=chunk-QTWRR7IS.js.map