tweakit 0.4.2 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +163 -0
- package/README.md +56 -0
- package/THIRD-PARTY-NOTICES.md +1 -0
- package/dist/tweaks/{bezier-EH6GR3RN.js → bezier-EIWM4A6M.js} +1 -1
- package/dist/tweaks/chunk-JWHF6V72.js +1 -0
- package/dist/tweaks/chunk-NB4K6RS2.js +1 -0
- package/dist/tweaks/chunk-QPSYEOZS.js +1 -0
- package/dist/tweaks/clip-7QEIBTKZ.js +1 -0
- package/dist/tweaks/colour-DJHDXBXF.js +1 -0
- package/dist/tweaks/core.js +1 -1
- package/dist/tweaks/{fold-FNCV4C7P.js → fold-UQORAAPG.js} +1 -1
- package/dist/tweaks/{gradient-RKPRTDSQ.js → gradient-IXD2AINY.js} +1 -1
- package/dist/tweaks/{heavy-LD64N5S4.js → heavy-KPG2LKVX.js} +1 -1
- package/dist/tweaks/image-E7OAWFFK.js +1 -0
- package/dist/tweaks/interval-LPI5MWBB.js +1 -0
- package/dist/tweaks/markup-ZSBV67SW.js +1 -0
- package/dist/tweaks/{monitor-EAU6GD6P.js → monitor-PEBMH5MH.js} +1 -1
- package/dist/tweaks/{motion-FUAKWKPW.js → motion-QSDSYDKR.js} +1 -1
- package/dist/tweaks/{plot-AMSWXKO7.js → plot-SFD5OPF6.js} +1 -1
- package/dist/tweaks/point-PK3CZSBO.js +1 -0
- package/dist/tweaks/{shadow-54LEQGQ6.js → shadow-SKTAWRUK.js} +1 -1
- package/dist/tweaks/sides-RVC5PQY3.js +1 -0
- package/dist/tweaks/{spring-YHAPWWTF.js → spring-QIVBIUPF.js} +1 -1
- package/dist/tweaks/{tabs-C45GWZYF.js → tabs-LB5KTQXF.js} +1 -1
- package/dist/tweaks.css +1 -1
- package/dist/tweaks.js +3 -3
- package/dist/types/tweaks/panel.d.ts +20 -1
- package/dist/types/tweaks/schema.d.ts +79 -0
- package/dist/types/tweaks/types.d.ts +25 -8
- package/package.json +3 -2
- package/dist/tweaks/chunk-3GZFWFKC.js +0 -1
- package/dist/tweaks/chunk-5G6TFQOD.js +0 -1
- package/dist/tweaks/chunk-GDMWOXFU.js +0 -1
- package/dist/tweaks/colour-G6UZ5HIL.js +0 -1
- package/dist/tweaks/image-TFIUSCCY.js +0 -1
- package/dist/tweaks/interval-VFQ2O75Q.js +0 -1
- package/dist/tweaks/point-UF7RGMGJ.js +0 -1
- package/dist/tweaks/sides-WJF2NEGM.js +0 -1
package/AGENTS.md
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# Tweakit for coding agents
|
|
2
|
+
|
|
3
|
+
Tweakit is a dependency-free, code-split, real-time parameter panel for the browser. Hand `tweaks(name, schema)` a plain object and it builds a live control for each value: sliders, toggles, lists, a wide-gamut color picker, gradient, shadow, motion and curve editors, folders and tabs. This file ships inside the npm package, so `node_modules/tweakit/AGENTS.md` always matches the installed version; prefer it over anything you remember about tweakit. The same guide, stamped with its version, is at https://ryankiley.github.io/tweakit/AGENTS.md, and the docs as Markdown start at https://ryankiley.github.io/tweakit/llms.txt.
|
|
4
|
+
|
|
5
|
+
- Package `tweakit` on npm. Source: https://github.com/ryankiley/tweakit. Docs: https://ryankiley.github.io/tweakit/
|
|
6
|
+
- Every option is documented in `node_modules/tweakit/dist/types/tweaks/types.d.ts`.
|
|
7
|
+
|
|
8
|
+
## Workflow
|
|
9
|
+
|
|
10
|
+
1. Look at the project first: its bundler or lack of one, its package manager, and the component the person wants to tune.
|
|
11
|
+
2. Install, then import one build and the stylesheet (below).
|
|
12
|
+
3. Build one panel from values the component already has. Start from their current values with sensible ranges; four to eight controls is plenty.
|
|
13
|
+
4. Bind the live values to the component's styles or animation in `panel.on()`, and apply `panel.params` once after `panel.ready`.
|
|
14
|
+
5. Append `panel.el` somewhere visible. Gate the panel behind a development flag; tweakit has no production switch of its own.
|
|
15
|
+
6. Run the project's build or checks and confirm the panel renders with the expected keys on `panel.params`.
|
|
16
|
+
7. When the person pastes values copied from the panel, change the schema's defaults in source (see "Copy and paste"). Leave the panel in place unless asked to remove it.
|
|
17
|
+
|
|
18
|
+
## Install and import
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
npm install tweakit
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
import { tweaks } from "tweakit"; // single-file build: every control inlined, synchronous
|
|
26
|
+
import { tweaks } from "tweakit/core"; // code-split build: heavy controls load on first use
|
|
27
|
+
import "tweakit/css"; // the stylesheet, needed by either build
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Without a bundler, copy `dist/tweaks.js` and `dist/tweaks.css` out of the package; the script is an ES module, so load it with `<script type="module">`. Both builds share one API. On the code-split build a panel whose schema needs a lazy control (color, gradient, shadow, motion, point and others) fills in when `panel.ready` resolves; the single-file build resolves it at once.
|
|
31
|
+
|
|
32
|
+
## A first panel
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
import { tweaks } from "tweakit";
|
|
36
|
+
import "tweakit/css";
|
|
37
|
+
|
|
38
|
+
const panel = tweaks("Card", {
|
|
39
|
+
radius: [18, 0, 60, 1], // [value, min, max, step] → slider
|
|
40
|
+
visible: true, // → checkbox
|
|
41
|
+
blend: ["normal", "multiply"], // → list
|
|
42
|
+
tint: "#7C5CFF", // → wide-gamut color picker
|
|
43
|
+
});
|
|
44
|
+
document.body.append(panel.el);
|
|
45
|
+
|
|
46
|
+
const apply = (p) => {
|
|
47
|
+
card.style.borderRadius = `${p.radius}px`;
|
|
48
|
+
card.style.background = p.tint;
|
|
49
|
+
card.style.mixBlendMode = p.blend;
|
|
50
|
+
card.style.opacity = p.visible ? 1 : 0.1;
|
|
51
|
+
};
|
|
52
|
+
panel.on(apply);
|
|
53
|
+
panel.ready.then(() => apply(panel.params));
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Shorthands: what a value's shape builds
|
|
57
|
+
|
|
58
|
+
| You write | Control | `params` value |
|
|
59
|
+
| --- | --- | --- |
|
|
60
|
+
| `24` | slider; range 0 to 1 for a value up to 1, else 0 to 3 times the value; a negative value mirrors that below 0 | number |
|
|
61
|
+
| `[1.2, 0, 3, 0.1]` | slider with min, max, step; `[v]`, `[v, min]` and `[v, min, max]` fill in the rest; up to four numbers are always this tuple, never a list | number |
|
|
62
|
+
| `[[20, 80], 0, 100]` | interval, two handles | `[lo, hi]` |
|
|
63
|
+
| `true` | checkbox | boolean |
|
|
64
|
+
| `"Hello"` | text input | string |
|
|
65
|
+
| `"#7C5CFF"` | color picker, for hex or a color function (`oklch(…)`, `rgb(…)`, `hsl(…)`, `color(…)`); a named color such as `"red"` or `"transparent"` builds a text input, so write it as hex | color string |
|
|
66
|
+
| `["a", "b"]` | list (dropdown); an option may be `{ value, label }`; numeric choices need `{ type: "list", options }` | string |
|
|
67
|
+
| `{ options: ["a", "b"], value: "b" }` | list with a chosen default | string |
|
|
68
|
+
| `{ action: fn }` | button | none |
|
|
69
|
+
| `{ x: 0, y: 10 }` | folder of controls | nested object |
|
|
70
|
+
| `{ type: "…", … }` | that control, verbatim (next table) | per control |
|
|
71
|
+
|
|
72
|
+
A missing step is 0.01 for a range up to 1, 0.1 up to 10, 1 up to 100, else 10. Keys become labels, title-cased; `label` overrides on a `{ type }` form and on `{ action }`, not on the `{ options, value }` shorthand. `_last` is reserved and cannot be a key.
|
|
73
|
+
|
|
74
|
+
## Every control, as `{ type, … }`, and what it returns
|
|
75
|
+
|
|
76
|
+
Every `{ type }` form also takes `label`, `hint` (a tooltip), `render: (get) => boolean` (show by another value, `get("key")`), `disabled: boolean | (get) => boolean`, and `persist: false`. In a plain folder object those names are children, not options. Nested values read as `params.folder.key`.
|
|
77
|
+
|
|
78
|
+
| `type` | Options | `params` value |
|
|
79
|
+
| --- | --- | --- |
|
|
80
|
+
| `slider` | `value, min, max, step, unit, soft, format, parse` | number |
|
|
81
|
+
| `number` | `value, min, max, step, unit, soft` | number |
|
|
82
|
+
| `interval` | `value: [lo, hi], min, max, step` | `[lo, hi]` |
|
|
83
|
+
| `sides` | `value` (one number, a CSS-order array, or `"8px 16px"`), `unit, step, min, max, corners`; the four floor at 0 unless `min` says otherwise | `{ top, right, bottom, left, css }`; `css` is ready for `padding`, `margin` or `border-radius` |
|
|
84
|
+
| `point` | `components: [{ key, label, value, min, max, step }], pad, invertY` | an object keyed by component, such as `{ x, y }` |
|
|
85
|
+
| `checkbox` | `value` | boolean |
|
|
86
|
+
| `text` | `value, rows, placeholder` | string |
|
|
87
|
+
| `list` | `options, value` | string |
|
|
88
|
+
| `segmented` | `options, value, cols` | string |
|
|
89
|
+
| `radiogrid` | `options, value, cols` | string |
|
|
90
|
+
| `color` | `value` | color string in the picker's notation: `oklch(60% 0.23 286)` by default, whatever you wrote; `#rrggbb` once the user picks hex |
|
|
91
|
+
| `gradient` | `stops: [[color, position], …]` | `{ stops: [{ color, pos }], interpolation, easing }`, which goes back in whole as `value`; `gradientCss(value, angle)` makes the CSS |
|
|
92
|
+
| `shadow` | `x, y, blur, spread, color, inset`, or `value` as a `box-shadow` string | `{ x, y, blur, spread, color, inset, css }`; `css` is ready for `box-shadow` |
|
|
93
|
+
| `image` | `value`; `options` (URLs or `{ value, label }`) makes a gallery, with `cols, maxSize, upload` | the chosen URL, the upload's data URL, or `""` |
|
|
94
|
+
| `motion` | `mode: "easing"` with `curve` and `duration` (ms), or `mode: "spring"` with `stiffness, damping, mass` or `visualDuration, bounce` | `{ mode, …, duration, easing }`; `easing` is a `cubic-bezier(…)` or sampled `linear(…)` string for a CSS transition; a spring's `duration` is its settle time |
|
|
95
|
+
| `spring` | `mode: "time"` or `"physics"`, `visualDuration, bounce, stiffness, damping, mass` | `{ stiffness, damping, mass }`, plus the time pair when tuned by feel |
|
|
96
|
+
| `cubicbezier` | `value: [x1, y1, x2, y2]` | `[x1, y1, x2, y2]` |
|
|
97
|
+
| `plot` | `expr` or `fn`, `xMin, xMax, yMin, yMax, samples, editable` | the expression string, `""` when drawn from `fn` |
|
|
98
|
+
| `monitor` | `get: () => number` (or a string), or `value`, `graph, view, min, max, interval, rows, decimals` | none; it watches |
|
|
99
|
+
| `fpsgraph` | none | none; a frame-rate graph |
|
|
100
|
+
| `button` | `action, label` | none |
|
|
101
|
+
| `buttongroup` | `buttons: { Label: fn }` or `[{ label, action }]` | none |
|
|
102
|
+
| `separator` | none | none |
|
|
103
|
+
| `tabs` | `pages: { Title: schema }`, keyed by the tab's title | nested under each title's slug, lower-case with other characters as `-`: `pages: { Layout: { gap } }` reads as `params.tabs.layout.gap` |
|
|
104
|
+
|
|
105
|
+
## The panel
|
|
106
|
+
|
|
107
|
+
`tweaks(name, schema, options?)` returns synchronously.
|
|
108
|
+
|
|
109
|
+
- `panel.el`: append it. `panel.params`: live values, nested like the schema, updated in place; `params._last` is the last changed key, the bare leaf (`blur`, not `shadow.blur`).
|
|
110
|
+
- `panel.on((params, changedKey) => …)`: fires on every change; returns an unsubscribe function. `changedKey` is that same leaf, so read nested values off `params` rather than switching on the key.
|
|
111
|
+
- `panel.ready`: resolves once lazy controls have built.
|
|
112
|
+
- `panel.set("folder.key", value)` and `panel.setMany({ "folder.key": v, other: w })`: write from code; dotted paths reach nested controls; `{ silent: true }` skips your listeners.
|
|
113
|
+
- `panel.changes()`: the values that differ from their defaults, keyed by dotted path. `panel.reset()` restores the defaults.
|
|
114
|
+
- `panel.toJSON()` and `panel.fromJSON(state)`: every value, nested, plus folder and tab UI state, JSON-safe; `JSON.stringify(panel)` uses it.
|
|
115
|
+
- `panel.setTheme(theme)`, `panel.setName(name)`; `panel.undo()` and `panel.redo()` with `undo: true`; `savePreset`, `loadPreset`, `deletePreset` and `presets()` with `persist`.
|
|
116
|
+
- `panel.destroy()`: removes it and releases every listener.
|
|
117
|
+
|
|
118
|
+
Options, the third argument: `theme` (token overrides), `persist` (a localStorage key, or `true` to key by name; turns presets on), `presets: false`, `filter: true` (a search field; needs the toolbar), `floating: true` or `{ x, y, corner }`, `draggable: false` to pin, `toolbar: false`, `undo: true`, `onReset`, `onEditStart` and `onEditEnd`.
|
|
119
|
+
|
|
120
|
+
Every panel drags by its header and lifts into a floating layer on the first drag; `floating` starts it there, inset from a corner. Its placement is plain `.tw-panel` CSS, so a class of yours loaded after `tweakit/css` overrides it.
|
|
121
|
+
|
|
122
|
+
## Copy and paste: how tuned values come back to you
|
|
123
|
+
|
|
124
|
+
The panel's toolbar copy button puts JSON on the clipboard. A click copies the full values snapshot, nested like the schema. Shift-click copies only what changed, as a flat map keyed by dotted path, the shape `setMany()` takes:
|
|
125
|
+
|
|
126
|
+
```json
|
|
127
|
+
{ "radius": 22, "shadow.blur": 28, "tint": "oklch(72% 0.14 290)" }
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Tweakit never writes to source files. The person pastes that JSON to you; then:
|
|
131
|
+
|
|
132
|
+
1. Find the `tweaks(name, …)` call whose schema holds those keys. The panel's title is its name.
|
|
133
|
+
2. For each key, change the default in the schema: the first element of a slider tuple, the bare value, or `value:` in a `{ type }` form. A key like `shadow.blur` is `blur` inside the `shadow` folder. A control whose value is an object (shadow, sides, gradient, motion, spring, point) comes back whole under its own key: copy its fields onto the `{ type }` form and drop the derived ones (`css`, `easing`, a spring's `duration`).
|
|
134
|
+
3. Leave the panel code in place and run the build.
|
|
135
|
+
|
|
136
|
+
## Markup instead of a schema
|
|
137
|
+
|
|
138
|
+
The core module also upgrades `[data-tw]` elements in place: `<div data-tw="slider" data-label="Blur" data-value="12" data-min="0" data-max="40"></div>`, inside a `.tw-panel` shell for the header and toolbar or bare anywhere in your layout, a control's options as `data-*` attributes. Each host dispatches a bubbling `tw:change` event with `{ key, value }`; `enhance(root)` binds hosts added later. Details: https://ryankiley.github.io/tweakit/markup.md
|
|
139
|
+
|
|
140
|
+
## One control without a panel
|
|
141
|
+
|
|
142
|
+
`mountControl(host, value, { key, label, onChange })` builds one control from any single-control schema value (not a folder or tabs) into your element and returns `{ el, set, get, destroy, ready }`. `createColorPicker({ value, mode, onChange })` is the color editor alone, for a swatch of your own. `gradientCss(value, angle?)` and `gradientStops(value)` turn a gradient value into CSS.
|
|
143
|
+
|
|
144
|
+
## Theming
|
|
145
|
+
|
|
146
|
+
The panel is dark by default and follows the system scheme; `data-tw-scheme="light"` or `"dark"` on any ancestor pins it. `theme` takes friendly keys (`accent`, `base`, `surface`, `border`, `text`, `radius`, `density`, `width`, `font` and more) or raw `--tw-*` tokens. Details: https://ryankiley.github.io/tweakit/theming.md
|
|
147
|
+
|
|
148
|
+
## What tweakit does not do
|
|
149
|
+
|
|
150
|
+
- It never edits source files, and it persists only to localStorage when `persist` is set. Values leave through the clipboard, `panel.changes()` or `panel.toJSON()`.
|
|
151
|
+
- It has no production switch. Gate the panel in your code, for example behind `import.meta.env.DEV`.
|
|
152
|
+
- It is not a framework component. In React, Vue, Svelte or Solid, create the panel once in a mount effect, append `panel.el` to a ref, update state in `panel.on()`, and call `panel.destroy()` on unmount.
|
|
153
|
+
- `params` is a plain object updated in place. Subscribe with `on()`; do not poll it.
|
|
154
|
+
|
|
155
|
+
## Example requests
|
|
156
|
+
|
|
157
|
+
- "Add a tweakit panel to this card so I can tune its shadow, corner radius and background color live. Keep the shadow's fields in a folder. Bind the values to the card's styles."
|
|
158
|
+
- "This hover animation uses a spring. Add a tweakit panel with a motion control for the spring and a slider for the hover scale, and drive the animation from the panel's values."
|
|
159
|
+
- "These values were copied from a tweakit panel. Apply them as the new defaults in the schema in source, and leave the panel in place."
|
|
160
|
+
|
|
161
|
+
## Checks
|
|
162
|
+
|
|
163
|
+
The build passes. The stylesheet is imported once. After `panel.ready`, `panel.params` has the keys the schema declares, and moving a control changes the component.
|
package/README.md
CHANGED
|
@@ -35,6 +35,62 @@ Everything else is on the **[docs site](https://ryankiley.github.io/tweakit/)**:
|
|
|
35
35
|
control live, the panel API, theming, markup-driven panels, and the two builds (the
|
|
36
36
|
single-file build vs the code-split entry).
|
|
37
37
|
|
|
38
|
+
## Coding agents
|
|
39
|
+
|
|
40
|
+
Read `node_modules/tweakit/AGENTS.md` before writing tweakit code. It is the guide for
|
|
41
|
+
agents (every control and the value it returns, the panel API, how copied values come back),
|
|
42
|
+
version-matched to the installed package, and also at
|
|
43
|
+
[ryankiley.github.io/tweakit/AGENTS.md](https://ryankiley.github.io/tweakit/AGENTS.md).
|
|
44
|
+
To keep it in reach, add to your project's `AGENTS.md` or `CLAUDE.md`:
|
|
45
|
+
|
|
46
|
+
```md
|
|
47
|
+
This project uses tweakit. Explore the code first, then read node_modules/tweakit/AGENTS.md
|
|
48
|
+
before writing tweakit code; prefer it over what you remember. Values tuned in a panel arrive
|
|
49
|
+
as JSON from its copy button; apply them to the schema defaults in source, not to the panel.
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Or hand your agent the whole job:
|
|
53
|
+
|
|
54
|
+
```text
|
|
55
|
+
Install tweakit in this repo. Read https://ryankiley.github.io/tweakit/AGENTS.md first.
|
|
56
|
+
Install it with this project's package manager, import "tweakit/css", and add one panel with
|
|
57
|
+
a few controls to an existing component so I can tune it live. Bind the values to its styles.
|
|
58
|
+
Verify the build.
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Floating panel
|
|
62
|
+
|
|
63
|
+
Every panel drags by its header and lifts into a fixed layer on the first drag. Pass `floating`
|
|
64
|
+
to start it there, and `draggable: false` to pin it:
|
|
65
|
+
|
|
66
|
+
```js
|
|
67
|
+
tweaks("Settings", schema, { floating: { x: 16, y: 16, corner: "top-right" }, draggable: false });
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
- `floating: true` sits 16px in from the top-left. `{ x, y, corner }` sets the insets in px
|
|
71
|
+
from the edges of `corner`: `"top-left"` (the default), `"top-right"`, `"bottom-left"` or
|
|
72
|
+
`"bottom-right"`. The panel keeps that corner as the window resizes, and a drag moves it from there.
|
|
73
|
+
A bottom-anchored panel keeps its bottom edge when it collapses, so its header drops.
|
|
74
|
+
- A draggable panel with `persist` remembers where it was dropped. A pinned one always sits at
|
|
75
|
+
its `floating` placement.
|
|
76
|
+
- The height caps at the window, with a gap at the far edge equal to `y` while the panel sits
|
|
77
|
+
at its placement (8px once dragged). In a window too short for both, a pinned panel's inset and
|
|
78
|
+
gap shrink together. Past the cap the whole panel scrolls, header included, with its scrollbar hidden.
|
|
79
|
+
|
|
80
|
+
The placement lives in CSS at plain `.tw-panel` specificity, so a class of your own, loaded
|
|
81
|
+
after `tweakit/css`, overrides any part of it without `!important`. If your bundler might load
|
|
82
|
+
it first, write the selector as `.tw-panel.my-panel`:
|
|
83
|
+
|
|
84
|
+
```css
|
|
85
|
+
.my-panel {
|
|
86
|
+
--tw-float-gap: 1.5rem; /* the far-edge gap the height cap leaves, in any length */
|
|
87
|
+
max-height: 60vh; /* or replace the cap outright */
|
|
88
|
+
top: 72px; right: 16px; left: auto; /* the inset, on a pinned panel */
|
|
89
|
+
z-index: 2; /* 99990 by default; a drag raises it while it lasts */
|
|
90
|
+
box-shadow: none; /* var(--tw-shadow-panel-lifted) by default */
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
38
94
|
## Develop
|
|
39
95
|
|
|
40
96
|
```
|
package/THIRD-PARTY-NOTICES.md
CHANGED
|
@@ -20,6 +20,7 @@ reproduced below.
|
|
|
20
20
|
| `ICON_PRESETS` | Hugeicons `layer` | MIT |
|
|
21
21
|
| `ICON_RESET` | Hugeicons `undo` | MIT |
|
|
22
22
|
| `ICON_GRIP` | original to this project | — |
|
|
23
|
+
| `ICON_UPLOAD` | original to this project | — |
|
|
23
24
|
|
|
24
25
|
- Hugeicons — <https://hugeicons.com> — © 2025 Hugeicons (MIT), from the
|
|
25
26
|
`@hugeicons/core-free-icons` package
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as f,e as J,j as Q}from"./chunk-
|
|
1
|
+
import{a as f,e as J,j as Q}from"./chunk-QPSYEOZS.js";import{_ as q,g as A,u as M,v as N,w as I,y as K,z as U}from"./chunk-JWHF6V72.js";function ee(v,$){let R=[.25,.1,.25,1],b=-.25,w=1.25,H=w-b,o=8,Y=e=>e.map((n,i)=>A(n,i%2?b:0,i%2?w:1)),t=Array.isArray(v.value)&&v.value.length===4?v.value.map(Number):R.slice();t.some(e=>!Number.isFinite(e))&&(t=R.slice()),t=Y(t);let Z=t.slice(),E=M("div","tw-bezier");v.label&&E.append(I("div","tw-bezier-label",v.label));let d=M("div","tw-bezier-graph"),k=f("svg","tw-bezier-svg");k.setAttribute("preserveAspectRatio","none");let G=f("line","tw-bezier-guide"),P=f("line","tw-bezier-guide"),X=f("line","tw-bezier-diag"),j=f("line","tw-bezier-ctl"),O=f("line","tw-bezier-ctl"),S=f("path","tw-bezier-curve");k.append(G,P,X,j,O,S);let g=N("tw-bezier-handle");g.setAttribute("aria-label","Control point 1");let x=N("tw-bezier-handle");x.setAttribute("aria-label","Control point 2"),d.append(k,g,x);let W=M("div","tw-fields tw-bezier-fields");E.append(d,W);let h=0,C=0,F=e=>o+e*(h-2*o),D=e=>C-o-(e-b)/H*(C-2*o),z=(e,n,i,m,a)=>{e.setAttribute("x1",n),e.setAttribute("y1",i),e.setAttribute("x2",m),e.setAttribute("y2",a)},y=()=>{if(g.setAttribute("aria-label",`Control point 1, x ${t[0]}, y ${t[1]}`),x.setAttribute("aria-label",`Control point 2, x ${t[2]}, y ${t[3]}`),h=d.offsetWidth,C=d.offsetHeight,h<2)return;k.setAttribute("viewBox",`0 0 ${h} ${C}`);let[e,n,i,m]=t,a=F(0),c=D(0),r=F(1),l=D(1),u=F(e),p=D(n),s=F(i),B=D(m);z(G,o,c,h-o,c),z(P,o,l,h-o,l),z(X,a,c,r,l),z(j,a,c,u,p),z(O,r,l,s,B),S.setAttribute("d",`M${a},${c} C${u},${p} ${s},${B} ${r},${l}`),g.style.left=u+"px",g.style.top=p+"px",x.style.left=s+"px",x.style.top=B+"px"},T=[{label:"X1",i:0,lo:0,hi:1},{label:"Y1",i:1,lo:b,hi:w},{label:"X2",i:2,lo:0,hi:1},{label:"Y2",i:3,lo:b,hi:w}],_=T.map(e=>{let n=Q({label:e.label,value:t[e.i],step:.01,min:e.lo,max:e.hi},i=>{t[e.i]=i,y(),$(t.slice())});return W.append(n.el),n}),L=()=>_.forEach((e,n)=>e.set(t[T[n].i])),V=(e,n)=>{let i=null,m=0,a=0,c=1;J(e,{onDown:r=>{r.preventDefault(),i=d.getBoundingClientRect(),m=d.offsetWidth||i.width,a=d.offsetHeight||i.height,c=i.width/m,e.classList.add("is-dragging"),e.focus({focusVisible:!1})},onMove:r=>{let l=(r.clientX-i.left)/c,u=(r.clientY-i.top)/c,p=A((l-o)/(m-2*o),0,1),s=A(b+(a-o-u)/(a-2*o)*H,b,w);t[n*2]=+p.toFixed(2),t[n*2+1]=+s.toFixed(2),y(),L(),$(t.slice())},onEnd:()=>{i=null,e.classList.remove("is-dragging")}}),e.addEventListener("keydown",r=>{if(r.key==="Escape")return e.blur();if(r.key==="Home"){r.preventDefault(),t=Z.slice(),y(),L(),$(t.slice());return}let l=r.key==="ArrowRight"?1:r.key==="ArrowLeft"?-1:0,u=r.key==="ArrowUp"?1:r.key==="ArrowDown"?-1:0;if(!l&&!u)return;r.preventDefault();let p=r.shiftKey?.1:.01,s=n*2;l&&(t[s]=+A(t[s]+l*p,0,1).toFixed(2)),u&&(t[s+1]=+A(t[s+1]+u*p,b,w).toFixed(2)),y(),L(),$(t.slice())})};return V(g,0),V(x,1),K(y),U(E,[[window,"resize"],[window,"tw-reflow"]],y),{el:E,set:e=>{if(Array.isArray(e)&&e.length===4){let n=e.map(Number);if(n.some(i=>!Number.isFinite(i)))return;t=Y(n),y(),L()}},get:()=>t.slice()}}q("cubicbezier",ee);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var R=Object.assign(Object.create(null),{ease:[.25,.1,.25,1],"ease-in":[.42,0,1,1],"ease-out":[0,0,.58,1],"ease-in-out":[.42,0,.58,1]}),T=e=>Math.min(1,Math.max(0,e)),A=15;function P(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();if(R[t])return R[t];let n=/^cubic-bezier\(([^()]*)\)$/.exec(t);if(!n)return null;let r=n[1].split(",").map(o=>o.trim()?Number(o):NaN);return r.length!==4||!r.every(Number.isFinite)?null:[T(r[0]),r[1],T(r[2]),r[3]]}var pe=e=>P(e)?e.trim().toLowerCase():"linear";function O(e){let t=[];for(let n=0;n<=A;n++){let r=n/A,o=1-r,s=3*o*o*r,i=3*o*r*r,a=r*r*r;t.push([s*e[0]+i*e[2]+a,T(s*e[1]+i*e[3]+a)])}return t}function ge(e,t){if(t=T(t),!e)return t;let n=O(e);for(let r=1;r<n.length;r++)if(t<=n[r][0]){let[o,s]=n[r-1],[i,a]=n[r];return i>o?s+(a-s)*(t-o)/(i-o):a}return 1}var x=e=>+(e*100).toFixed(2);function B(e){let t=[...e.stops].sort((a,c)=>a.pos-c.pos),n=a=>`${a.color} ${x(a.pos)}%`,r=P(e.easing);if(!r||t.length<2)return t.map(n).join(", ");let o=O(r),s=e.interpolation||"oklch",i=[n(t[0])];for(let a=1;a<t.length;a++){let c=t[a-1],m=t[a],u=m.pos-c.pos;if(u>1e-6)for(let d=1;d<A;d++){let[f,g]=o[d];i.push(`color-mix(in ${s}, ${c.color}, ${m.color} ${x(g)}%) ${x(c.pos+u*f)}%`)}i.push(n(m))}return i.join(", ")}function z(e,t="to right"){return`linear-gradient(in ${e.interpolation||"oklch"} ${typeof t=="number"?`${t}deg`:t}, ${B(e)})`}var D=e=>e.replace(/([a-z])(?=[A-Z])|([A-Z\d])(?=[A-Z][a-z])/g,"$1$2 ").replace(/^./,t=>t.toUpperCase()).trim(),I=(e,t,n)=>Math.min(n,Math.max(t,e)),Ee=e=>!!e&&typeof e=="object",ve=e=>typeof e=="string"&&(/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e.trim())||/^(oklch|oklab|rgba?|hsla?|hwb|lab|lch|color)\(/i.test(e.trim())),F=20,K=e=>{let t=String(e),n=/e-(\d+)$/i.exec(t);if(n)return Math.min(F,Number(n[1])+(t.split("e")[0].split(".")[1]||"").length);let r=t.indexOf(".");return r===-1?0:Math.min(F,t.length-r-1)},G=(e,t,n)=>{if(!(n>0))return e;let r=K(n),o=Number((+t).toFixed(r)),s=Math.round((e-o)/n);return Number.isFinite(s)?Number((o+s*n).toFixed(r)):e},ye=(e,t,n,r=e)=>{let o=a=>G(a,r,n),s=Number.isFinite(e)?o(e):-1/0,i=Number.isFinite(t)?o(t):1/0;return s<e&&(s=o(s+n)),i>t&&(i=o(i-n)),s>i?[e,e]:[s,i]},U=(e,t)=>{let n=t-e;return n<=1?.01:n<=10?.1:n<=100?1:10},Le=(e,t,n,r=0,o=null)=>{let s=+e,i=+t,a=+n;if(Number.isFinite(s)||(s=r),Number.isFinite(i)||(i=o??s+100),i<s){let c=s;s=i,i=c}return(!(a>0)||a>i-s)&&(a=U(s,i)),{min:s,max:i,step:a}},Me=(e,t,n,r,o,s=null)=>{let i=e.shiftKey?10:1;switch(e.key){case"ArrowRight":case"ArrowUp":return t+n*i;case"ArrowLeft":case"ArrowDown":return t-n*i;case"PageUp":return s!=null?t+s:null;case"PageDown":return s!=null?t-s:null;case"Home":return r;case"End":return o}return null},Te=(e,t,n,r,o=0)=>{let s=e.offsetLeft,i=s+e.offsetWidth,a=t.offsetLeft,c=a+t.offsetWidth;return n<i&&n+r>s||n<c+o&&n+r>a-o},xe=e=>e>=0?[0,e<=1?1:e*3||100]:[e>=-1?-1:e*3,0],q=e=>e==null?void 0:typeof e=="object"?e.value:e,W=e=>{try{return JSON.stringify(e)}catch{return String(e)}},X=e=>e==null?"":typeof e=="string"?D(e):typeof e=="object"?e.label??(e.value!==void 0?String(e.value):W(e)):String(e),v=(e,t,n)=>{let r=document.createElement(e);return t&&(r.className=t),n!=null&&(r.innerHTML=n),(e=="input"||e=="textarea")&&(r.setAttribute("autocomplete","off"),r.setAttribute("data-1p-ignore",""),r.setAttribute("data-lpignore","true")),r},Ae=(e,t)=>{let n=v("button",e,t);return n.type="button",n},Z=(e,t,n)=>{let r=v(e,t);return r.textContent=n,e==="button"&&(r.type="button"),r},Y=e=>["pointerdown","pointermove","pointerup","click"].forEach(t=>e.addEventListener(t,n=>n.stopPropagation())),J=e=>{requestAnimationFrame(e),document.fonts&&document.fonts.ready&&document.fonts.ready.then(e)},Q=(e,t,n)=>{let r=e.isConnected;r||requestAnimationFrame(()=>{e.isConnected&&(r=!0)});let o=i=>{if(!e.isConnected){(r||e.closest("[data-tw-destroyed]"))&&s();return}r=!0,n(i)},s=()=>t.forEach(([i,a])=>i.removeEventListener(a,o));return t.forEach(([i,a])=>i.addEventListener(a,o)),s},ke=()=>requestAnimationFrame(()=>window.dispatchEvent(new Event("tw-reflow"))),Ce=(e,t)=>{e.addEventListener("pointerenter",()=>{e.classList.add("is-hover"),t&&t()}),e.addEventListener("pointerleave",()=>e.classList.remove("is-hover"))},y=!1;typeof document<"u"&&(document.addEventListener("pointerdown",()=>{y=!0},!0),document.addEventListener("keydown",()=>{y=!1},!0));var He=e=>{e.addEventListener("focus",()=>e.classList.toggle("tw-focus-quiet",y)),e.addEventListener("blur",()=>e.classList.remove("tw-focus-quiet"))},ee=(e,t,{width:n,fallbackH:r=300,gap:o=6,align:s="start",prefer:i="below"}={})=>{let a=e.getBoundingClientRect();n==="match"&&(t.style.width=a.width+"px");let c=n==="match"?a.width:t.offsetWidth||n||0,m=s==="end"?a.right-c:s==="center"?a.left+a.width/2-c/2:a.left;t.style.left=Math.max(8,Math.min(m,window.innerWidth-c-8))+"px";let u=t.offsetHeight||r,d=window.innerHeight-a.bottom,f=a.top,g=u+12,L=d>=g,E=f>=g,M=(i==="above"?E||!L&&f>=d:!L&&(E||f>d))?a.top-u-o:a.bottom+o;t.style.top=I(M,o,window.innerHeight-u-o)+"px"},te=Object.assign(Object.create(null),{accent:"--tw-accent",onAccent:"--tw-on-accent",base:"--tw-base",dropdownBg:"--tw-dropdown-bg",surface:"--tw-surface",surfaceHover:"--tw-surface-hover",surfaceActive:"--tw-surface-active",border:"--tw-border",borderHover:"--tw-border-hover",selection:"--tw-selection",title:"--tw-text-root",section:"--tw-text-section",text:"--tw-text-primary",label:"--tw-text-label",textMuted:"--tw-text-secondary",textFaint:"--tw-text-tertiary",focus:"--tw-text-focus",success:"--tw-success",danger:"--tw-danger",shadow:"--tw-shadow-dropdown",shadowPanel:"--tw-shadow-panel",shadowPanelLifted:"--tw-shadow-panel-lifted",font:"--tw-font-sans",fontMono:"--tw-font-mono",radius:"--tw-radius",density:"--tw-row-height",width:"--tw-width"}),ne=new Set(["radius","density","width"]),k=e=>(e/=255,e<=.03928?e/12.92:((e+.055)/1.055)**2.4),re=e=>{e=String(e).trim();let t=/^#([0-9a-f]{3})$/i.exec(e);if(t)return t[1].split("").map(n=>parseInt(n+n,16));if(t=/^#([0-9a-f]{6})$/i.exec(e),t)return[0,2,4].map(n=>parseInt(t[1].slice(n,n+2),16));if(t=/^rgba?\(([^)]+)\)/i.exec(e),t){let n=t[1].split(/[\s,/]+/).filter(Boolean).map(parseFloat);return[n[0],n[1],n[2]]}return null},oe=e=>{let t=re(e);if(!t||t.some(r=>!Number.isFinite(r)))return"#ffffff";let n=.2126*k(t[0])+.7152*k(t[1])+.0722*k(t[2]);return 1.05/(n+.05)>=(n+.05)/.0571?"#ffffff":"#161616"},Se=e=>{if(!e||typeof e!="object")return null;let t={};for(let[n,r]of Object.entries(e)){if(n.startsWith("--")){t[n]=String(r);continue}let o=te[n];o&&(t[o]=ne.has(n)&&typeof r=="number"?`${r}px`:String(r))}return t["--tw-accent"]&&!t["--tw-on-accent"]&&(t["--tw-on-accent"]=oe(t["--tw-accent"])),Object.keys(t).length?t:null},se=(e,t)=>{if(e){if(e._twAppliedVars)for(let n of e._twAppliedVars)e.style.removeProperty(n);if(e._twAppliedVars=t?Object.keys(t):null,t)for(let n in t)e.style.setProperty(n,t[n])}},ie=(e,t)=>{let n=t?.closest('[data-tw-scheme="light"]')?"light":t?.closest('[data-tw-scheme="dark"]')?"dark":null;n?e.setAttribute("data-tw-scheme",n):e.removeAttribute("data-tw-scheme")},N=(e,t)=>{se(e,t?.closest(".tw-panel")?._twTheme),ie(e,t)},p=null,C=null,Re=e=>{p&&(!e||e.contains(C))&&p()};function Pe(e,t,n,r={}){let o=!1,s=null;n.classList.add("tw-portal"),n.inert=!0,n.addEventListener("pointerdown",l=>t.closest(".tw-panel")?._twEditPointer?.(l),!0),Y(n);let i=0,a=0,c=()=>{ee(t,n,{width:r.width,fallbackH:r.fallbackH,gap:r.gap,align:r.align});let l=t.getBoundingClientRect();i=parseFloat(n.style.left)-l.left,a=parseFloat(n.style.top)-l.top},m=()=>{if(o){if(!e.isConnected)return b();c(),r.onReflow&&r.onReflow()}},u=()=>{if(!o)return;if(!e.isConnected)return b();let l=t.getBoundingClientRect(),w=t.closest(".tw-panel")?.getBoundingClientRect();if(!(l.width||l.height)||l.bottom<0||l.top>window.innerHeight||l.right<0||l.left>window.innerWidth||w?.height&&(l.bottom<w.top||l.top>w.bottom))return b();n.style.left=l.left+i+"px",n.style.top=l.top+a+"px"},d=l=>{!e.contains(l.target)&&!n.contains(l.target)&&b()},f=l=>{l.key==="Escape"&&o&&(b(),t.focus())},g=l=>{if(!o)return;let w=l.relatedTarget;(w?e.contains(w)||n.contains(w):y)||(b(),w&&!t.closest(".tw-panel")?.contains(w)&&setTimeout(()=>{!o&&document.activeElement===w&&t.focus()},0))};e.addEventListener("focusout",g),n.addEventListener("focusout",g);let L=()=>n.querySelector('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [href], [tabindex]:not([tabindex="-1"])'),E=()=>N(n,e),S=l=>{l.every(w=>w.target===n)||E()},M=()=>{p&&p!==b&&p(),p=b,C=t,o=!0,e.classList.add("is-open"),t.setAttribute("aria-expanded","true"),n.inert=!1,document.body.appendChild(n),N(n,e),window.addEventListener("tw-retheme",E),typeof MutationObserver=="function"&&(s=new MutationObserver(S),s.observe(document.documentElement,{subtree:!0,attributes:!0,attributeFilter:["data-tw-scheme"]})),c(),requestAnimationFrame(()=>{if(o&&(n.classList.add("is-open"),r.onOpen&&r.onOpen(),c(),!n.contains(document.activeElement))){let l=r.initialFocus&&r.initialFocus()||L();l&&l.focus({focusVisible:!y})}}),requestAnimationFrame(function l(){if(o){if(!e.isConnected)return b();requestAnimationFrame(l)}}),setTimeout(()=>{o&&document.addEventListener("pointerdown",d,!0)},0),document.addEventListener("keydown",f),window.addEventListener("scroll",u,!0),window.addEventListener("resize",m)},b=()=>{p===b&&(p=null,C=null),n.contains(document.activeElement)&&t.focus(),o=!1,e.classList.remove("is-open"),n.classList.remove("is-open"),n.inert=!0,t.setAttribute("aria-expanded","false"),document.removeEventListener("pointerdown",d,!0),document.removeEventListener("keydown",f),window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",m),window.removeEventListener("tw-retheme",E),s&&(s.disconnect(),s=null),setTimeout(()=>{o||n.remove()},200)};return t.addEventListener("click",()=>{t.disabled||(o?b():M())}),{open:M,close:b,isOpen:()=>o,reflow:m}}var Oe=(e,t)=>{if(e=e.toLowerCase(),e.includes(t))return!0;if(t.length<3)return!1;let n=t.length,r=e.length,o=new Array(r+1).fill(0);for(let s=1;s<=n;s++){let i=[s];for(let a=1;a<=r;a++)i[a]=Math.min(o[a]+1,i[a-1]+1,o[a-1]+(t[s-1]===e[a-1]?0:1));o=i}return Math.min(...o)<=(t.length<6?1:2)},ae=typeof matchMedia=="function"?matchMedia("(prefers-reduced-motion: reduce)"):{matches:!1},H="cubic-bezier(0.22, 1, 0.36, 1)",Be="cubic-bezier(0.34, 1.2, 0.64, 1)",le=(e,t)=>{ae.matches||typeof e.animate!="function"||(e.style.transformOrigin=t>0?"left center":"right center",e.animate([{transform:"scaleX(1)"},{transform:"scaleX(1.18)"},{transform:"scaleX(1)"}],{duration:300,easing:H}))},ue=(e,t,n)=>{let r=e.querySelector('[data-active="true"]');if(!r)return;let o=r.offsetLeft,s=r.offsetWidth,i=parseFloat(t.style.left);t.style.left=o+"px",t.style.width=s+"px",n&&Number.isFinite(i)&&i!==o&&le(t,o>i?1:-1)},ce=32,de=200,fe=8,Fe=(e,t,n)=>{let r=n<t.left?n-t.left:n>t.right?n-t.right:0,o=Math.sign(r)*fe*Math.sqrt(Math.min(Math.max(0,Math.abs(r)-ce)/de,1));e.style.width=o?`calc(100% + ${Math.abs(o)}px)`:"",e.style.transform=o<0?`translateX(${o}px)`:""},Ne=e=>{e.style.transition=`width 0.35s ${H}, transform 0.35s ${H}`,e.style.width="",e.style.transform="",setTimeout(()=>{e.style.transition=""},360)},$e=(e,t)=>{e.classList.toggle("is-disabled",t);for(let n of e.children)n.classList.contains("tw-portal")||(n.inert=t)},_e=(e,t,n,r)=>{e.classList.toggle("is-collapsed",r),t.setAttribute("aria-expanded",String(!r)),n.inert=r},_=(e,t)=>{let n=e.findIndex(r=>r.dataset.value===String(t));return n<0&&e.length?0:n},me=(e,t)=>{let n=_(e,t);e.forEach((r,o)=>{let s=r.dataset.value===String(t);r.dataset.active=String(s),r.setAttribute("aria-checked",String(s)),r.tabIndex=o===n?0:-1})},be=(e,t,n)=>{let r=Z("button",e,X(t));return r.setAttribute("role","radio"),r._twVal=q(t),r.dataset.value=r._twVal,r.addEventListener("click",()=>n(r._twVal)),r},we=(e,t,n,r=0)=>{switch(e){case"ArrowRight":return(t+1)%n;case"ArrowLeft":return(t-1+n)%n;case"ArrowDown":return r<0?-1:r?t+r<n?t+r:t:(t+1)%n;case"ArrowUp":return r<0?-1:r?t-r>=0?t-r:t:(t-1+n)%n;case"Home":return 0;case"End":return n-1}return-1};function Ve(e,t,n,r){let o=v("div","tw-seg");o.setAttribute("role","radiogroup"),r&&o.setAttribute("aria-label",r);let s=v("div","tw-seg-pill");o.append(s);let i=e.map(u=>{let d=be("tw-seg-btn",u,f=>m(f));return o.append(d),d}),a=u=>ue(o,s,u),c=()=>{me(i,t),a(!0)},m=(u,d=!0)=>{u!=null&&!i.some(f=>f._twVal===u)||(t=u,c(),d&&n(u))};return o.addEventListener("keydown",u=>{let d=_(i,t);if(d<0)return;let f=we(u.key,d,i.length);f<0||(u.preventDefault(),m(i[f]._twVal),i[f].focus())}),c(),J(()=>{a(),o.classList.add("is-ready")}),Q(o,[[window,"tw-reflow"]],()=>a()),{el:o,set:u=>m(u,!1),get:()=>t}}var je=(e,t="",n=2,r=24)=>`<svg${t?` class="${t}"`:""} viewBox="0 0 ${r} ${r}" fill="none" stroke="currentColor" stroke-width="${n}" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${e}</svg>`,ze=(e,t)=>({el:e,set:()=>{},get:()=>{},destroy:t}),V={},De=(e,t)=>{V[e]=t},Ie=e=>V[e],j=null,Ke=e=>{j=e},Ge=()=>j,h=null,$=0,Ue=e=>{h||(h=v("div","tw-sr"),h.setAttribute("role","status")),h.isConnected||document.body.appendChild(h),h.textContent="",clearTimeout($),$=setTimeout(()=>{h.textContent=e},100)};export{P as a,pe as b,ge as c,B as d,z as e,D as f,I as g,Ee as h,ve as i,K as j,G as k,ye as l,U as m,Le as n,Me as o,Te as p,xe as q,q as r,W as s,X as t,v as u,Ae as v,Z as w,Y as x,J as y,Q as z,ke as A,Ce as B,He as C,ee as D,Se as E,se as F,ie as G,N as H,Re as I,Pe as J,Oe as K,ae as L,H as M,Be as N,ue as O,Fe as P,Ne as Q,$e as R,_e as S,_ as T,me as U,be as V,we as W,Ve as X,je as Y,ze as Z,De as _,Ie as $,Ke as aa,Ge as ba,Ue as ca};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as ht,f as oe,g as ae,i as pt,j as bt}from"./chunk-QPSYEOZS.js";import{C as lt,J as it,_ as Ve,ca as ut,g as m,o as Te,u as v,w as ct}from"./chunk-JWHF6V72.js";var ln=180/Math.PI,Ne=Math.PI/180,T=(e,t)=>[e[0][0]*t[0]+e[0][1]*t[1]+e[0][2]*t[2],e[1][0]*t[0]+e[1][1]*t[1]+e[1][2]*t[2],e[2][0]*t[0]+e[2][1]*t[1]+e[2][2]*t[2]],un=(e,t)=>{let n=[[0,0,0],[0,0,0],[0,0,0]];for(let o=0;o<3;o++)for(let r=0;r<3;r++)n[o][r]=e[o][0]*t[0][r]+e[o][1]*t[1][r]+e[o][2]*t[2][r];return n},x=e=>Number.isFinite(e)?e:0,hn=(e,t,n)=>Math.min(n,Math.max(t,e)),se=e=>{let t=Math.abs(e);return t<=.04045?e/12.92:Math.sign(e)*((t+.055)/1.055)**2.4},U=e=>{let t=Math.abs(e);return t<=.0031308?e*12.92:Math.sign(e)*(1.055*t**(1/2.4)-.055)},ie=1.09929682680944,vt=.018053968510807,pn=e=>{let t=Math.abs(e);return t<vt*4.5?e/4.5:Math.sign(e)*((t+ie-1)/ie)**(1/.45)},yt=e=>{let t=Math.abs(e);return t<vt?e*4.5:Math.sign(e)*(ie*t**.45-(ie-1))},$t=1/512,bn=e=>{let t=Math.abs(e);return t<=$t*16?e/16:Math.sign(e)*t**1.8},mn=e=>{let t=Math.abs(e);return t>=$t?Math.sign(e)*t**(1/1.8):16*e},Oe=[[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],ce=[[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]],dn=[[.4865709486482162,.26566769316909306,.19821728523436247],[.2289745640697488,.6917385218365064,.079286914093745],[0,.04511338185890264,1.043944368900976]],Et=[[2.493496911941425,-.9313836179191239,-.40271078445071684],[-.8294889695615747,1.7626640603183463,.023624685841943577],[.03584583024378447,-.07617238926804182,.9568845240076872]],fn=[[.6369580483012914,.14461690358620832,.16888097516417205],[.2627002120112671,.6779980715188708,.05930171646986196],[0,.028072693049087428,1.060985057710791]],_t=[[1.7166511879712674,-.35567078377639233,-.25336628137365974],[-.6666843518324892,1.6164812366349395,.01576854581391113],[.017639857445310783,-.042770613257808524,.9421031212354738]],gn=[[.7977604896723027,.13518583717574031,.0313493495815248],[.2880711282292934,.7118432178101014,8565396060525902e-20],[0,0,.8251046025104601]],xn=[[1.3457989731028281,-.25558010007997534,-.05110628506753401],[-.5446224939028347,1.5082327413132781,.02053603239147973],[0,0,1.2119675456389454]],St=[[1.0479298208405488,.022946793341019088,-.05019222954313557],[.029627815688159344,.990434484573249,-.01707382502938514],[-.009243058152591178,.015055144896577895,.7518742899580008]],At=[[.9554734527042182,-.023098536874261423,.0632593086610217],[-.028369706963208136,1.0099954580058226,.021041398966943008],[.012314001688319899,-.020507696433477912,1.3303659366080753]],Mn=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],Lt=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],kn=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],Tt=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],le=216/24389,q=24389/27,z=[.3457/.3585,1,(1-.3457-.3585)/.3585],Y=(e,t,n)=>T(n,[t(e[0]),t(e[1]),t(e[2])]),Z=(e,t,n)=>{let o=T(n,e);return[t(o[0]),t(o[1]),t(o[2])]},mt=e=>{let t=T(Tt,e);return T(Lt,[t[0]**3,t[1]**3,t[2]**3])},dt=e=>{let t=T(Mn,e);return T(kn,[Math.cbrt(t[0]),Math.cbrt(t[1]),Math.cbrt(t[2])])};function ft(e){let[t,n,o]=e,r=(t+16)/116,a=n/500+r,s=r-o/200,i=a**3>le?a**3:(116*a-16)/q,h=t>q*le?r**3:t/q,p=s**3>le?s**3:(116*s-16)/q;return T(At,[i*z[0],h*z[1],p*z[2]])}function gt(e){let t=T(St,e),n=s=>s>le?Math.cbrt(s):(q*s+16)/116,o=n(t[0]/z[0]),r=n(t[1]/z[1]),a=n(t[2]/z[2]);return[116*r-16,500*(o-r),200*(r-a)]}var ue=e=>{let t=Math.hypot(e[1],e[2]),n=Math.atan2(e[2],e[1])*ln;return n<0&&(n+=360),[e[0],t,n]},he=e=>[e[0],e[1]*Math.cos(e[2]*Ne),e[1]*Math.sin(e[2]*Ne)];function Vt(e){let t=((Number.isNaN(e[0])?0:e[0])%360+360)%360,n=e[1]/100,o=e[2]/100,r=a=>{let s=(a+t/30)%12,i=n*Math.min(o,1-o);return o-i*Math.max(-1,Math.min(s-3,9-s,1))};return[r(0),r(8),r(4)]}function Ot(e){let t=Math.max(...e),n=Math.min(...e),o=t-n;if(o<1e-9)return NaN;let r;return t===e[0]?r=(e[1]-e[2])/o+(e[1]<e[2]?6:0):t===e[1]?r=(e[2]-e[0])/o+2:r=(e[0]-e[1])/o+4,r*60}function wn(e){let t=Math.max(...e),n=Math.min(...e),o=(n+t)/2,r=Ot(e),a=t===n||o===0||o===1?0:(t-o)/Math.min(o,1-o);return a<0&&(r+=180,a=-a),r>=360&&(r-=360),[r,a*100,o*100]}function Cn(e){let t=e[1]/100,n=e[2]/100;if(t+n>=1){let a=t/(t+n);return[a,a,a]}let o=Vt([e[0],100,50]),r=1-t-n;return[o[0]*r+t,o[1]*r+t,o[2]*r+t]}var vn=e=>[Ot(e),Math.min(...e)*100,(1-Math.max(...e))*100];function yn(e,t){switch(t){case"srgb":return Y(e,se,Oe);case"p3":return Y(e,se,dn);case"rec2020":return Y(e,pn,fn);case"prophoto-rgb":return T(At,Y(e,bn,gn));case"oklab":return mt(e);case"oklch":return mt(he(e));case"lab":return ft(e);case"lch":return ft(he(e));case"hsl":return Y(Vt(e),se,Oe);case"hwb":return Y(Cn(e),se,Oe)}}function $n(e,t){switch(t){case"srgb":return Z(e,U,ce);case"p3":return Z(e,U,Et);case"rec2020":return Z(e,yt,_t);case"prophoto-rgb":return Z(T(St,e),mn,xn);case"oklab":return dt(e);case"oklch":return ue(dt(e));case"lab":return gt(e);case"lch":return ue(gt(e));case"hsl":return wn(Z(e,U,ce));case"hwb":return vn(Z(e,U,ce))}}function k(e,t,n){return t===n?[e[0],e[1],e[2]]:t==="oklch"&&n==="oklab"?he(e):t==="oklab"&&n==="oklch"?ue(e):t==="lch"&&n==="lab"?he(e):t==="lab"&&n==="lch"?ue(e):$n(yn(e,t),n)}var pe=75e-6,Rt=e=>e.every(t=>t>=-pe&&t<=1+pe),Fe=(e,t)=>Rt(k(e,"oklch",t)),Re=e=>e.map(t=>Math.min(1,Math.max(0,t))),xt=(e,t)=>Math.hypot(e[0]-t[0],e[1]-t[1],e[2]-t[2]);function be(e,t){if(Fe(e,t))return k(e,"oklch",t);let n=e[0];if(n>=1)return[1,1,1];if(n<=0)return[0,0,0];if(!Number.isFinite(e[1]))return Re(k([n,0,x(e[2])],"oklch",t));let o=.02,r=1e-4,a=[e[0],e[1],e[2]],s=0,i=e[1],h=!0,p=Re(k(a,"oklch",t));if(xt(k(p,t,"oklab"),k(e,"oklch","oklab"))<o)return p;for(;i-s>r;){let u=(s+i)/2;a[1]=u;let b=k(a,"oklch",t);if(h&&Rt(b)){s=u;continue}p=Re(b);let d=xt(k(p,t,"oklab"),k(a,"oklch","oklab"));if(d<o){if(o-d<r)return p;h=!1,s=u}else i=u}return p}var Nt=(e,t)=>{let n=e*Ne,o=Math.cos(n),r=Math.sin(n),a=Tt.map(i=>o*i[1]+r*i[2]),s=un(t==="p3"?Et:t==="rec2020"?_t:ce,Lt);return{d:a,F:s,gam:t==="rec2020"?yt:U}};function me(e,t){let{d:[n,o,r],F:a,gam:s}=Nt(e,t),i=-pe,h=1+pe;return(p,u)=>{let b=p+u*n,d=p+u*o,E=p+u*r,f=b**3,w=d**3,y=E**3,C=s(a[0][0]*f+a[0][1]*w+a[0][2]*y);if(C<i||C>h)return!1;let A=s(a[1][0]*f+a[1][1]*w+a[1][2]*y);if(A<i||A>h)return!1;let P=s(a[2][0]*f+a[2][1]*w+a[2][2]*y);return P>=i&&P<=h}}function Ft(e,t){let{d:[n,o,r],F:a,gam:s}=Nt(e,t);return(i,h,p)=>{let u=i+h*n,b=i+h*o,d=i+h*r,E=u**3,f=b**3,w=d**3;p[0]=s(a[0][0]*E+a[0][1]*f+a[0][2]*w),p[1]=s(a[1][0]*E+a[1][1]*f+a[1][2]*w),p[2]=s(a[2][0]*E+a[2][1]*f+a[2][2]*w)}}function de(e,t,n=.5){if(!e(t,0))return 0;let o=0;for(let r=0;r<16;r++){let a=(o+n)/2;e(t,a)?o=a:n=a}return o}var G=e=>Math.round(Math.min(1,Math.max(0,e))*255).toString(16).padStart(2,"0"),En=e=>`#${G(e[0])}${G(e[1])}${G(e[2])}`,fe=(e,t,n)=>En(be([e,t,n],"srgb"));function Ht(e){let t=String(e).replace("#","").trim();if(t.length===3&&(t=t.split("").map(o=>o+o).join("")),t.length<6)return[.7,.1,280];let n=[parseInt(t.slice(0,2),16)/255,parseInt(t.slice(2,4),16)/255,parseInt(t.slice(4,6),16)/255];return k(n,"srgb","oklch").map(x)}var ge=["hex","srgb","css","hsl","hwb","oklch","oklab","lch","lab","p3","rec2020"],It={hex:"HEX",srgb:"RGB",css:"CSS",hsl:"HSL",hwb:"HWB",oklch:"OKLCH",oklab:"OKLab",lch:"LCH",lab:"Lab",p3:"P3",rec2020:"Rec2020"},Dt=["srgb","css","hsl","hwb","hex"],He=e=>!Dt.includes(e),Gt=e=>e==="hex"||e==="css"?"srgb":e,_n=Object.assign(Object.create(null),{hex:"srgb",srgb:"srgb",css:"srgb",hsl:"hsl",hwb:"hwb",oklch:"oklch",oklab:"oklab",lch:"lch",lab:"lab",p3:"display-p3",rec2020:"rec2020"}),Pn=e=>_n[e]||"oklch",Sn=Object.assign(Object.create(null),{srgb:"srgb",hsl:"hsl",hwb:"hwb",oklch:"oklch",oklab:"oklab",lch:"lch",lab:"lab","display-p3":"p3",rec2020:"rec2020"}),Xn=e=>Sn[e]||"oklch",xe=.5,Bt=(e,t,n)=>Object.freeze(["R","G","B"].map(o=>Object.freeze({k:o,min:0,max:e,step:t,scale:n}))),Mt=Bt(255,1,255),kt=Bt(1,.01,1),J={oklch:[{k:"L",min:0,max:100,step:1,scale:100},{k:"C",min:0,max:xe,step:.01,scale:1},{k:"H",min:0,max:360,step:1,scale:1}],oklab:[{k:"L",min:0,max:100,step:1,scale:100},{k:"a",min:-.4,max:.4,step:.01,scale:1},{k:"b",min:-.4,max:.4,step:.01,scale:1}],lch:[{k:"L",min:0,max:100,step:1,scale:1},{k:"C",min:0,max:150,step:1,scale:1},{k:"H",min:0,max:360,step:1,scale:1}],lab:[{k:"L",min:0,max:100,step:1,scale:1},{k:"a",min:-125,max:125,step:1,scale:1},{k:"b",min:-125,max:125,step:1,scale:1}],srgb:Mt,css:Mt,hsl:[{k:"H",min:0,max:360,step:1,scale:1},{k:"S",min:0,max:100,step:1,scale:1},{k:"L",min:0,max:100,step:1,scale:1}],hwb:[{k:"H",min:0,max:360,step:1,scale:1},{k:"W",min:0,max:100,step:1,scale:1},{k:"B",min:0,max:100,step:1,scale:1}],p3:kt,rec2020:kt},wt=e=>e>=1?0:e>=.1?1:e>=.01?2:3,Pt=(e,t,n)=>t==="oklch"?[e[0],e[1],e[2]]:Dt.includes(n)?t==="srgb"?be(e,"srgb"):k(be(e,"srgb"),"srgb",t):k(e,"oklch",t);function Me(e,t){let n=Pt(e,Gt(t),t);return J[t].map((o,r)=>{let a=x(n[r])*o.scale;return hn(Math.abs(a)<.5*o.step?0:a,o.min,o.max)})}function Xt(e,t,n,o){let r=Gt(t),a=Pt(e,r,t).map(x);a[n]=o/J[t][n].scale;let s=k(a,r,"oklch");return[x(s[0]),x(s[1]),x(s[2])]}function jt(e,t){if(!He(t))return"sRGB";let n=be(e,"srgb");return Math.max(...n)<.03||Math.min(...n)>.97||Fe(e,"srgb")?"sRGB":Fe(e,"p3")?"P3":"wide"}function Ie(e,t){if(t==="hex")return fe(e[0],e[1],e[2]);let n=J[t],o=Me(e,t),r=a=>{let s=o[a].toFixed(wt(n[a].step));return n[a].k==="H"&&+s==360?0 .toFixed(wt(n[a].step)):s};return t==="css"?`${r(0)}, ${r(1)}, ${r(2)}`:t==="oklch"||t==="oklab"||t==="lch"||t==="lab"?`${r(0)}% ${r(1)} ${r(2)}`:t==="hsl"||t==="hwb"?`${r(0)} ${r(1)}% ${r(2)}%`:`${r(0)} ${r(1)} ${r(2)}`}var Ct=(e,t)=>t==="hex"?e:t==="srgb"?`rgb(${e})`:t==="css"?`rgba(${e}, 1)`:t==="hsl"?`hsl(${e})`:t==="hwb"?`hwb(${e})`:t==="p3"?`color(display-p3 ${e})`:t==="rec2020"?`color(rec2020 ${e})`:`${t}(${e})`;function Kt(e,t,n){let o=x(n);if(t==="hex")return fe(e[0],e[1],e[2])+(o<.999?G(o):"");let r=Ie(e,t);if(o>=.999)return Ct(r,t);let a=+o.toFixed(3);return t==="css"?`rgba(${r}, ${a})`:Ct(`${r} / ${a}`,t)}var Yt=(()=>{try{return document.createElement("canvas").getContext("2d",{colorSpace:"display-p3"})?.getContextAttributes?.().colorSpace==="display-p3"}catch{return!1}})(),De=Yt?{colorSpace:"display-p3"}:{},An=Yt?"p3":"srgb",ke=(e,t)=>{let n=e.length-1,o=Math.max(0,Math.min(n,t*n)),r=Math.floor(o),a=o-r;return e[r]*(1-a)+e[Math.min(r+1,n)]*a},Ln=(e,t)=>{let n=me(e,t),o=new Float64Array(128);for(let r=0;r<128;r++)o[r]=de(n,r/127);return o},Tn="var(--tw-checker)",Vn=Object.assign(Object.create(null),{srgb:"srgb","display-p3":"p3",rec2020:"rec2020","prophoto-rgb":"prophoto-rgb"}),je=/^(rgba?|hsla?|hwb)\([ \t\n\r\f]*([^)]*?)[ \t\n\r\f]*\)$/i,Ke=/^(oklch|oklab|lch|lab|color)\([ \t\n\r\f]*([^)]*?)[ \t\n\r\f]*\)$/i,On=/^(srgb|srgb-linear|display-p3|a98-rgb|prophoto-rgb|rec2020|xyz|xyz-d50|xyz-d65)$/i,Ce=/^#?([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,Ge,Zt=()=>Ge===void 0?Ge=document.createElement("canvas").getContext("2d"):Ge,Rn=/^(#[0-9a-f]{3,8}|[a-z][a-z-]*(?:\([\w\s.,%+\-\/]*\))?)$/i;function zn(e){if(e=String(e??"").trim(),!Rn.test(e))return!1;if(Ce.test(e))return!0;if(Ke.test(e))return Hn(e);if(je.test(e))return Wt(e)!==null;let t=Zt();return t?["#000","#fff"].some(n=>{t.fillStyle=n;let o=t.fillStyle;return t.fillStyle=e,t.fillStyle!==o}):!0}var Ye="[+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:e[+-]?\\d+)?",Nn=new RegExp("^"+Ye+"$","i"),Fn=new RegExp("^"+Ye+"%$","i"),zt=new RegExp("^("+Ye+")(deg|grad|rad|turn)$","i"),Ze=/[ \t\n\r\f]+/,ze=/^none$/i,Be=e=>e.replace(/^[ \t\n\r\f]+|[ \t\n\r\f]+$/g,""),Pe=e=>!!e&&!Ze.test(e),B=e=>ze.test(e)?"none":Nn.test(e)?"num":Fn.test(e)?"pct":zt.test(e)?"angle":null,Xe=e=>{let t=zt.exec(e);if(!t)return x(parseFloat(e));let n=parseFloat(t[1]),o=t[2].toLowerCase();return x(o==="turn"?n*360:o==="grad"?n*.9:o==="rad"?n*180/Math.PI:n)};function Wt(e){let t=je.exec(e);if(!t)return null;let n=t[1].toLowerCase().replace(/a$/,""),o=t[2],r,a,s;if(o.includes(",")){if(n==="hwb")return null;let u=o.split(",").map(Be);if(u.length<3||u.length>4||!u.every(Pe)||(r=u.slice(0,3),a=u[3],s=r.map(B),n==="rgb"?!(s.every(b=>b==="num")||s.every(b=>b==="pct")):!((s[0]==="num"||s[0]==="angle")&&s[1]==="pct"&&s[2]==="pct"))||a!==void 0&&B(a)!=="num"&&B(a)!=="pct")return null}else{let u=o.split("/");if(u.length>2||(r=u[0].split(Ze).filter(Boolean),r.length!==3))return null;if(u.length===2){a=Be(u[1]);let b=Pe(a)?B(a):null;if(!b||b==="angle")return null}if(s=r.map(B),n==="rgb"?!s.every(b=>b&&b!=="angle"):!(s[0]&&s[0]!=="pct"&&s[1]&&s[1]!=="angle"&&s[2]&&s[2]!=="angle"))return null}let i=(u,b)=>ze.test(u)?0:/%$/.test(u)?parseFloat(u)/100*b:parseFloat(u),h=a===void 0?1:m(i(a,1),0,1);return[n==="rgb"?k([m(i(r[0],255)/255,0,1),m(i(r[1],255)/255,0,1),m(i(r[2],255)/255,0,1)],"srgb","oklch"):k([s[0]==="none"?0:Xe(r[0]),m(i(r[1],100),0,100),m(i(r[2],100),0,100)],n,"oklch"),h]}var Hn=e=>{let t=Ke.exec(e);if(!t)return!1;let n=t[1].toLowerCase(),o=t[2].split("/");if(o.length>2)return!1;let r=o[0].split(Ze).filter(Boolean);if(n==="color"&&!On.test(r.shift()||"")||r.length!==3)return!1;let a=n==="lch"||n==="oklch";if(!r.every((s,i)=>{let h=B(s);return h&&(a&&i===2?h!=="pct":h!=="angle")}))return!1;if(o.length===2){let s=Be(o[1]),i=Pe(s)?B(s):null;if(!i||i==="angle")return!1}return!0};function we(e){if(e=String(e??"").trim(),Ce.test(e)){let i=e.replace("#",""),h=1;i.length===4?(h=parseInt(i[3]+i[3],16)/255,i=i.slice(0,3)):i.length===8&&(h=parseInt(i.slice(6,8),16)/255,i=i.slice(0,6));let[p,u,b]=Ht("#"+i);return[p,u,b,h]}let t=Ke.exec(e);if(t){let i=t[1].toLowerCase(),[h,p]=t[2].split("/").map(y=>y.trim()),u=h.split(/\s+/).filter(Boolean),b=i;if(i==="color"&&(b=Vn[(u[0]||"").toLowerCase()],u=u.slice(1),!b))return[.7,.1,280,1];let d=(y,C=1)=>!y||ze.test(y)?0:x(parseFloat(y))*(/%$/.test(y)?C:1),E=p?m(d(p,.01),0,1):1,f=i==="lab"?[m(d(u[0]),0,100),d(u[1],1.25),d(u[2],1.25)]:i==="lch"?[m(d(u[0]),0,100),Math.max(0,d(u[1],1.5)),Xe(u[2]||"0")]:i==="color"?[d(u[0],.01),d(u[1],.01),d(u[2],.01)]:i==="oklab"?[m(d(u[0],.01),0,1),d(u[1],.004),d(u[2],.004)]:[m(d(u[0],.01),0,1),Math.max(0,d(u[1],.004)),Xe(u[2]||"0")],w=b==="oklch"?f:k(f,b,"oklch");return[x(w[0]),m(x(w[1]),0,xe),(x(w[2])%360+360)%360,E]}if(je.test(e)){let i=Wt(e);if(!i)return[0,0,0,1];let[h,p]=i;return[x(h[0]),m(x(h[1]),0,xe),(x(h[2])%360+360)%360,p]}let n=Zt();if(!n)return[0,0,0,1];n.fillStyle="#000",n.fillStyle=e;let o=n.fillStyle;if(Ce.test(o))return we(o);let r=o.match(/^rgba?\(([^)]*)\)/i),a=((r?r[1]:"").match(/-?[\d.]+(?:e[+-]?\d+)?/gi)||[0,0,0]).map(Number),s=k([a[0]/255,a[1]/255,a[2]/255],"srgb","oklch");return[x(s[0]),x(s[1]),x(s[2]),a[3]!=null?m(x(a[3]),0,1):1]}function Ut(e,t){let[n,o,r,a]=we(e.value||"#7c5cff"),s=ge.includes(e.mode)?e.mode:"oklch",i=NaN,h=null,p=[],u=NaN,b="",d=()=>Kt([n,o,r],s,a),E=v("div","tw-color-body"),f=v("div","tw-wg-area"),w=document.createElement("canvas");w.className="tw-wg-canvas";let y=v("div","tw-wg-thumb");f.append(w,y);let C=v("div","tw-wg-hue"),A=document.createElement("canvas");A.className="tw-wg-hue-canvas";let P=v("div","tw-wg-hue-thumb");C.append(A,P);let _=v("div","tw-wg-alpha"),We=v("div","tw-wg-alpha-grad"),ve=v("div","tw-wg-hue-thumb");_.append(We,ve),w.setAttribute("aria-hidden","true"),A.setAttribute("aria-hidden","true"),f.tabIndex=0,f.setAttribute("role","group"),f.setAttribute("aria-label","Colour plane: chroma across, lightness up"),C.tabIndex=0,C.setAttribute("role","slider"),C.setAttribute("aria-label","Hue"),C.setAttribute("aria-valuemin","0"),C.setAttribute("aria-valuemax","360"),_.tabIndex=0,_.setAttribute("role","slider"),_.setAttribute("aria-label","Alpha"),_.setAttribute("aria-valuemin","0"),_.setAttribute("aria-valuemax","1");let Ue=v("div","tw-color-mode-row"),R=v("select","tw-color-mode");R.setAttribute("aria-label","Color mode"),ge.forEach(c=>{let l=document.createElement("option");l.value=c,l.textContent=It[c],R.append(l)}),R.value=s;let qe=v("span","tw-color-gamut");Ue.append(R,qe);let N=v("div","tw-color-channels");E.append(f,C,_,Ue,N);let $=w.getContext("2d",De),Je=A.getContext("2d"),X=document.createElement("canvas"),qt=X.getContext("2d",De),ye=null,$e=()=>{let c=f.getBoundingClientRect(),l=Math.round(c.width),g=Math.round(c.height);if(l<2)return;let M=window.devicePixelRatio||1,S=He(s)?"p3":"srgb",F=Ln(r,S);h=F;let O=Math.round(l*M),ee=Math.round(g*M),H=Math.max(1,Math.round(O/4)),j=Math.max(1,Math.round(ee/4));(X.width!==H||X.height!==j)&&(X.width=H,X.height=j,ye=new ImageData(H,j,De));let te=ye.data,on=j>1?1/(j-1):0,an=H>1?1/(H-1):0,sn=Ft(r,An),ne=[0,0,0];for(let I=0;I<j;I++){let re=1-I*on,Se=ke(F,re);for(let D=0;D<H;D++){sn(re,D*an*Se,ne);let K=(I*H+D)*4;te[K]=Math.round(m(ne[0],0,1)*255),te[K+1]=Math.round(m(ne[1],0,1)*255),te[K+2]=Math.round(m(ne[2],0,1)*255),te[K+3]=255}}if(qt.putImageData(ye,0,0),w.width=O,w.height=ee,$.imageSmoothingEnabled=!0,$.drawImage(X,0,0,O,ee),S!=="srgb"){let I=(re,Se,D,K)=>{let cn=me(r,re),Ae=[];for(let L=0;L<=100;L++){let W=L/100,Le=ke(F,W);if(Le<=0)continue;let st=de(cn,W,Le);st<=0||Ae.push([Math.min(st/Le*O,O-D*M/2),(1-W)*ee])}Ae.length<2||($.save(),$.strokeStyle=Se,$.lineWidth=D*M,$.lineJoin=$.lineCap="round",$.setLineDash(K.map(L=>L*M)),$.beginPath(),Ae.forEach((L,W)=>W?$.lineTo(L[0],L[1]):$.moveTo(L[0],L[1])),$.stroke(),$.restore())};I("srgb","rgba(255,255,255,0.7)",1.5,[]),I("p3","rgba(255,255,255,0.4)",1,[3,3])}i=r},Qe=.7,et=c=>{let l=k([Qe,de(me(c,"srgb"),Qe),c],"oklch","srgb");return`rgb(${m(l[0]*255,0,255)|0},${m(l[1]*255,0,255)|0},${m(l[2]*255,0,255)|0})`},tt=0,Jt=()=>{let c=C.getBoundingClientRect(),l=Math.max(1,Math.round(c.width)),g=Math.max(1,Math.round(c.height));if(!(l<2)&&!(l===tt&&A.width===l)){tt=l,A.width=l,A.height=g;for(let M=0;M<l;M++)Je.fillStyle=et(M/(l-1)*360),Je.fillRect(M,0,1,g)}},Ee=()=>{let c=h?ke(h,n):.4,l=S=>`${m(S,0,1)*100}%`,g=(S,F)=>{let O=m(S,0,1);return`calc(${O*100}% + ${(.5-O)*F}px)`};y.style.left=l(c>0?o/c:0),y.style.top=l(1-n),P.style.left=g(r/360,16),ve.style.left=g(a,16),_.setAttribute("aria-valuenow",String(+a.toFixed(2)));let M=Math.round(r);C.setAttribute("aria-valuenow",String(M)),C.setAttribute("aria-valuetext",`${M}\xB0`),f.setAttribute("aria-description",`lightness ${Math.round(n*100)}%, chroma ${+o.toFixed(3)}`),We.style.background=`linear-gradient(to right, oklch(${n} ${o} ${r} / 0), oklch(${n} ${o} ${r}))`,y.style.background=`oklch(${n} ${o} ${r})`,ve.style.background=`linear-gradient(oklch(${n} ${o} ${r} / ${a}), oklch(${n} ${o} ${r} / ${a})), var(--tw-dropdown-bg)`,r!==u&&(b=et(r),u=r),P.style.background=b},Q=()=>{if(qe.textContent=jt([n,o,r],s),s==="hex"){let c=N.querySelector(".tw-color-chan-input");c&&document.activeElement!==c&&(c.value=fe(n,o,r)+(a<.999?G(a):""))}else{let c=Me([n,o,r],s);p.forEach((l,g)=>{l.el.contains(document.activeElement)||l.set(c[g])})}},Qt=()=>{Jt(),$e(),Ee()},en=()=>t(d()),nt=c=>{c&&r!==i&&$e(),Ee(),Q()},V=c=>{nt(c),en()},rt=()=>{if(N.replaceChildren(),p=[],s==="hex"){N.classList.add("tw-color-channels--hex");let c=v("div","tw-color-chan"),l=v("input","tw-color-chan-input");l.type="text",l.spellcheck=!1,l.setAttribute("aria-label","Hex color"),lt(l),ht(l),l.addEventListener("change",()=>{let g=l.value.trim();Ce.test(g)&&([n,o,r,a]=we(g),V(!0))}),l.addEventListener("blur",Q),l.addEventListener("keydown",g=>{g.key==="Enter"&&l.blur()}),c.append(ct("span","tw-color-chan-label","HEX"),l),N.append(c)}else{N.classList.remove("tw-color-channels--hex");let c=Me([n,o,r],s);J[s].forEach((l,g)=>{let M=bt({label:l.k,value:c[g],min:l.min,max:l.max,step:l.step},S=>{[n,o,r]=Xt([n,o,r],s,g,m(S,l.min,l.max)),V(!0)});M.el.addEventListener("focusout",Q),p.push(M),N.append(M.el)})}Q()},_e=c=>h?ke(h,c):.4,tn=c=>ae(c,f);oe(f,c=>{let[l,g]=tn(c);n=1-g,o=l*_e(n),V(!1)});let ot=0;f.addEventListener("keydown",c=>{if(c.key==="Home"||c.key==="End"){c.preventDefault();return}let l=c.shiftKey?10:1,g=c.key==="ArrowRight"?l:c.key==="ArrowLeft"?-l:0,M=c.key==="ArrowUp"?l:c.key==="ArrowDown"?-l:c.key==="PageUp"?10:c.key==="PageDown"?-10:0;if(!g&&!M)return;c.preventDefault();let S=_e(n),F=m((S>0?o/S:0)+g*.01,0,1);n=m(n+M*.01,0,1),o=F*_e(n),V(!1),clearTimeout(ot),ot=setTimeout(()=>{f.isConnected&&ut(f.getAttribute("aria-description")||"")},250)});let nn=c=>ae(c,C)[0]*360;oe(C,c=>{r=nn(c),V(!0)}),C.addEventListener("keydown",c=>{let l=Te(c,r,1,0,360);l!=null&&(c.preventDefault(),r=m(l,0,360),V(!0))});let rn=c=>ae(c,_)[0];oe(_,c=>{a=rn(c),V(!1)}),_.addEventListener("keydown",c=>{let l=Te(c,a,.01,0,1);l!=null&&(c.preventDefault(),a=m(l,0,1),V(!1))});let at=c=>{s=c,R.value=c,rt(),$e(),Ee()};return R.addEventListener("change",()=>{at(R.value),e.onMode&&e.onMode()}),rt(),{el:E,set:c=>{let l=document.activeElement;l&&E.contains(l)&&l.matches("input")&&l.blur(),[n,o,r,a]=we(c),nt(!0)},get:()=>d(),mode:()=>s,setMode:c=>{c!==s&&ge.includes(c)&&at(c)},reflow:Qt,swatchCss:()=>`linear-gradient(oklch(${n} ${o} ${r} / ${a}), oklch(${n} ${o} ${r} / ${a})), ${Tn}`,valueText:()=>Ie([n,o,r],s)+(a<.999?s==="hex"?G(a):` / ${+a.toFixed(2)}`:"")}}function In(e,t){let{root:n,trigger:o,right:r}=pt("tw-color",e.label??"Colour"),a=v("span","tw-trigger-chip tw-color-swatch"),s=v("span","tw-trigger-value");r.append(a,s);let i=v("div","tw-color-pop"),h=()=>{a.style.background=p.swatchCss(),s.textContent=p.valueText()},p=Ut({value:e.value,onMode:()=>h()},u=>{h(),t(u)});return i.append(p.el),n.append(i),it(n,o,i,{width:240,fallbackH:340,gap:6,onOpen:p.reflow,onReflow:p.reflow}),h(),{el:n,set:u=>{u!=null&&(p.set(u),h())},get:()=>p.get()}}var Wn=(e,t,n,o)=>o<.999?`oklch(${+e.toFixed(4)} ${+t.toFixed(4)} ${+n.toFixed(2)} / ${+o.toFixed(3)})`:`oklch(${+e.toFixed(4)} ${+t.toFixed(4)} ${+n.toFixed(2)})`;Ve("color",In);Ve("colorpicker",Ut);export{Pn as a,Xn as b,Tn as c,zn as d,we as e,Ut as f,Wn as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{C as T,H as S,Y as $,_ as I,g as E,j as L,k as N,l as F,u as g,v as C,w as M}from"./chunk-JWHF6V72.js";var H="http://www.w3.org/2000/svg",R=(t,n)=>{let e=document.createElementNS(H,t);return n&&e.setAttribute("class",n),e},k=(t,n)=>getComputedStyle(t).getPropertyValue(n).trim(),V=t=>{let n=getComputedStyle(t),e=o=>n.getPropertyValue(o).trim();return e("--tw-accent")||e("--tw-text-primary")||"#fff"},B=t=>{let n=!1;t.addEventListener("pointerdown",e=>{n=e.button===0&&document.activeElement!==t}),t.addEventListener("focus",()=>t.select()),t.addEventListener("mouseup",e=>{n&&(n=!1,e.button===0&&document.activeElement===t&&t.selectionStart===0&&t.selectionEnd===t.value.length&&e.preventDefault())})};function P(t,{onDown:n,onMove:e,onEnd:o}={}){let r=null,s=i=>{r===null||i.pointerId!==r||(r=null,o&&o(i))};t.addEventListener("pointerdown",i=>{if(!(i.button!==0||r!==null)){r=i.pointerId;try{t.setPointerCapture(i.pointerId)}catch{}n&&n(i)}}),t.addEventListener("pointermove",i=>{if(i.pointerId===r){if(i.buttons===0)return s(i);e&&e(i)}}),t.addEventListener("pointerup",s),t.addEventListener("pointercancel",s),t.addEventListener("lostpointercapture",s)}var O=(t,n)=>P(t,{onDown:e=>{t.classList.add("is-grabbing"),n(e)},onMove:n,onEnd:()=>t.classList.remove("is-grabbing")}),j=(t,n)=>{let e=n.getBoundingClientRect();return[E((t.clientX-e.left)/e.width,0,1),E((t.clientY-e.top)/e.height,0,1)]},z=(t,n,e=1/0)=>{let o=t.getBoundingClientRect(),r=Math.min(window.devicePixelRatio||1,e);return t.width=o.width*r,t.height=o.height*r,n.setTransform(r,0,0,r,0,0),[o.width,o.height]},U=(t,n)=>{let e=g("div",t),o=C("tw-trigger");o.setAttribute("aria-expanded","false");let r=g("span","tw-trigger-right");return o.append(M("span","tw-trigger-label",n),r),e.append(o),{root:e,trigger:o,right:r}},D=$('<path d="M6 4v8M10 4v8"/>',"",2,16);function G(){let t=null,n=0,e=0,o=0;return{show(r,s,i,m){t=g("div","tw-grab-guide tw-portal"),t.innerHTML='<span class="tw-grab-line"></span><span class="tw-grab-dot"></span><span class="tw-grab-arrow"></span><span class="tw-grab-bubble"></span>',n=s,e=r,o=i??r,t.children[1].style.cssText=`left:${r}px;top:${n}px`,S(t,m),document.body.appendChild(t)},move(r,s){t&&(t.children[0].style.cssText=`left:${Math.min(e,r)}px;top:${n}px;width:${Math.abs(r-e)}px`,t.children[2].style.cssText=`left:${r}px;top:${n}px;transform:translate(-50%,-50%) scaleX(${r>=e?1:-1})`,t.children[3].style.cssText=`left:${o}px;top:${n-16}px`,t.children[3].textContent=s)},hide(){t&&(t.remove(),t=null)}}}function X(t,n,e,o,r,s){let i=0,m=0,p=1,d=G();P(t,{onDown:u=>{u.preventDefault(),i=u.clientX,m=o(),p=1,t.classList.add("is-dragging");let a=n.getBoundingClientRect();d.show(u.clientX,a.top+a.height/2,a.left+a.width/2,n),d.move(u.clientX,s())},onMove:u=>{let a=u.shiftKey?10:u.altKey?.1:1;a!==p&&(p=a,i=u.clientX,m=o()),r(m+(u.clientX-i)*e*a),d.move(u.clientX,s())},onEnd:()=>{t.classList.remove("is-dragging"),d.hide()}})}function q(t,n){let e=Number.isFinite(+t.step)&&+t.step>0?+t.step:1,o=l=>l==null?NaN:+l,r=o(t.min),s=o(t.max);if(Number.isFinite(r)&&Number.isFinite(s)&&s<r){let l=r;r=s,s=l}let i=Number.isFinite(r)?r:0,m=L(e),[p,d]=F(Number.isFinite(r)?r:-1/0,Number.isFinite(s)?s:1/0,e,i),u=l=>{let h=N(l,i,e);return t.soft?h:E(h,p,d)},a=u(Number.isFinite(+t.value)?+t.value:0),f=g("div",t.row?"tw-row":"tw-field"),b=g("div","tw-num-wrap"),v=g("span","tw-num-grab",D);v.setAttribute("aria-hidden","true"),v.title="Drag to adjust";let c=g("input","tw-num");c.type="text",c.inputMode="decimal",c.setAttribute("aria-label",t.unit?`${t.label} (${t.unit})`:t.label),c.value=a.toFixed(m),T(c),b.append(v,c),t.unit&&b.append(M("span","tw-num-unit",t.unit)),f.append(M("span",t.row?"tw-row-label":"tw-field-label",t.label),b);let w=(l,h=!0)=>{l=+l,Number.isFinite(l)&&(a=u(l),c.value=a.toFixed(m),h&&n&&n(a))},x=()=>Number(c.value.replace(t.unit||"","").trim()||NaN);return c.addEventListener("change",()=>{let l=x();Number.isFinite(l)&&u(l)!==a?w(l):c.value=a.toFixed(m)}),c.addEventListener("keydown",l=>{if(l.key==="Enter")return c.blur();let h=l.key==="ArrowUp"?1:l.key==="ArrowDown"?-1:0;if(!h)return;l.preventDefault();let y=x();w((Number.isFinite(y)?y:a)+h*e*(l.shiftKey?10:1))}),X(v,b,e,()=>a,w,()=>c.value),{el:f,set:l=>w(l,!1),get:()=>a}}I("number",(t,n)=>q({...t,row:!0},n));var A=(t,n,e)=>{let o=Math.sqrt(t/e),r=n/(2*Math.sqrt(t*e));return Math.min(2.2,9/Math.max(r*o,.5))};function Y(t,n,e,o=64,r=A(t,n,e)){let s=Math.sqrt(t/e),i=n/(2*Math.sqrt(t*e)),m=[];for(let p=0;p<o;p++){let d=p/(o-1)*r,u;if(i<1-1e-4){let a=s*Math.sqrt(1-i*i);u=1-Math.exp(-i*s*d)*(Math.cos(a*d)+i*s/a*Math.sin(a*d))}else if(i<=1+1e-4)u=1-Math.exp(-s*d)*(1+s*d);else{let a=Math.sqrt(i*i-1),f=s*(i+a),b=s*(i-a);u=1-(f*Math.exp(-b*d)-b*Math.exp(-f*d))/(f-b)}m.push(u)}return m}export{R as a,k as b,V as c,B as d,P as e,O as f,j as g,z as h,U as i,q as j,A as k,Y as l};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as i,i as y,r as c}from"./chunk-JWHF6V72.js";var g=new Set(["__proto__","constructor","prototype"]),h=(e,n)=>n.reduce((r,t)=>i(r)&&Object.prototype.hasOwnProperty.call(r,t)?r[t]:void 0,e),S=e=>{let n={};for(let r of Object.keys(e)){let t=r.split(".");if(t.some(s=>g.has(s)))continue;let o=n;for(let s of t.slice(0,-1))o=i(o[s])?o[s]:o[s]={};o[t[t.length-1]]=e[r]}return n},d=e=>y(e)&&(typeof CSS>"u"||!CSS.supports||CSS.supports("color",e)),f=(e,n,r)=>Array.isArray(e)?Array.isArray(n)&&(e.every(t=>!i(t))?n.length===e.length&&n.every((t,o)=>f(e[o],t,r)):n.length>=2&&n.length<=64&&n.every(t=>f(e[0],t,r))):i(e)?i(n)&&!Array.isArray(n)&&Object.keys(e).every(t=>f(e[t],n[t],r)):typeof n==typeof e&&(typeof n!="number"||Number.isFinite(n))&&(!r||!y(e)||d(n)),m=(e,n)=>n!=null&&!e.el?.closest(".is-disabled")&&f(e.get(),n,e.m.type==="color"||e.m.type==="gradient")&&(!e.m.options||e.m.options.some(r=>JSON.stringify(c(r))===JSON.stringify(n))),k=(e,n,r=[])=>e.map(t=>[t,h(n,t.path.slice(r.length))]).filter(([t,o])=>m(t,o)),w=(e,n)=>{let r={};for(let[t,o]of n){let s=r;for(let a of t.path.slice(0,-1))s=s[a]||(s[a]={});s[t.path[t.path.length-1]]=o}e.fromJSON({values:r})};function A(e,n,r){let t=JSON.parse(r),o;if(n.kind==="row"){let s=n.entry,a=i(t)&&!Array.isArray(t)&&Object.keys(t).length===1&&Object.prototype.hasOwnProperty.call(t,s.key)?t[s.key]:t;o=m(s,a)?[[s,a]]:[]}else{if(!i(t)||Array.isArray(t))return!1;let s=e.entries.filter(a=>a.path.length>n.path.length&&n.path.every((p,l)=>a.path[l]===p));o=[];for(let a of[t,S(t)])for(let p of[h(a,n.path),a]){let l=i(p)?k(s,p,n.path):[];l.length>o.length&&(o=l)}}return o.length?(w(e,o),o.length):!1}var u=new WeakMap;function O(e,n,r,t){if(!r.alive())return;let o=!1;if(e!==null)try{o=n(e)}catch{}if(r.announce(o?`${o} value${o===1?"":"s"} pasted`:e===null?"Couldn't read the clipboard":"Nothing to paste"),t){let s=o?"is-pasted":"is-refused";t.classList.remove("is-pasted","is-refused"),t.classList.add(s),clearTimeout(u.get(t)),u.set(t,setTimeout(()=>t.classList.remove(s),450))}return!!o}export{O as pasteInto,A as pasteScope,k as pick};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as a,d as b,e as c,f as d,g as e}from"./chunk-NB4K6RS2.js";import"./chunk-QPSYEOZS.js";import"./chunk-JWHF6V72.js";export{a as CHECKER,d as createPickerBody,b as isColor,e as oklchStr,c as parseColor};
|