pixelagent 0.1.14 → 0.1.16

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.
@@ -1,54 +1,54 @@
1
- import { jsxs as d, Fragment as G, jsx as n } from "react/jsx-runtime";
2
- import { useState as A, useEffect as H, useRef as W, useMemo as we, useLayoutEffect as Wt, useCallback as L, useId as Yt } from "react";
3
- import { getElementDisplayLabel as Ue, captureTextSnapshot as Ze, captureInlineStyles as Qe, restoreInlineStyles as ye, restoreTextSnapshot as Ne, getPreviewTargets as Ee, clearTailwindStatePreview as ke, applyTailwindStatePreview as Fe, setEditableTextPreview as et, getRelevantComputedStyles as Ce, getEditableTextInfo as ue, readReactSource as We, detectStylingSystem as bt, countElementInstances as yt, getScopeSelector as wt, getCssSelector as xt, copyToClipboard as Nt, getWindowSelectionText as kt, getNearestReactComponentName as Xt, getDomPath as Gt, resolveElementFromEntry as Ct, getAnnotationSessionDisplay as Kt, loadAnnotationSession as jt, saveAnnotationSession as qt, DEFAULT_PIXEL_AGENT_UI_SETTINGS as Jt, readHostThemeFromDocument as tt, resolvePixelAgentChrome as Zt, applyHostThemeToDocument as Qt, pixelAgentRootAttributes as en, getElementsInArea as tn, formatAllAnnotations as nn, formatAnnotation as rn } from "@pixelagent/shared";
1
+ import { jsxs as d, Fragment as K, jsx as n } from "react/jsx-runtime";
2
+ import { useState as S, useEffect as H, useRef as Y, useMemo as xe, useLayoutEffect as Kt, useCallback as E, useId as jt } from "react";
3
+ import { getElementDisplayLabel as Xe, captureTextSnapshot as tt, captureInlineStyles as nt, restoreInlineStyles as we, restoreTextSnapshot as ke, getPreviewTargets as $e, clearTailwindStatePreview as Ce, applyTailwindStatePreview as ze, setEditableTextPreview as rt, getRelevantComputedStyles as Me, getEditableTextInfo as fe, readReactSource as Ge, detectStylingSystem as kt, countElementInstances as Ct, getScopeSelector as Mt, getCssSelector as At, copyToClipboard as St, getWindowSelectionText as Lt, getNearestReactComponentName as qt, getDomPath as Jt, resolveElementFromEntry as Et, getAnnotationSessionDisplay as Zt, loadAnnotationSession as Qt, saveAnnotationSession as en, DEFAULT_PIXEL_AGENT_UI_SETTINGS as tn, readHostThemeFromDocument as it, resolvePixelAgentChrome as nn, applyHostThemeToDocument as rn, pixelAgentRootAttributes as an, getElementsInArea as on, formatAllAnnotations as sn, formatAnnotation as ln } from "@pixelagent/shared";
4
4
  export * from "@pixelagent/shared";
5
- import { createPortal as Ye } from "react-dom";
6
- function Mt({
5
+ import { createPortal as Ke } from "react-dom";
6
+ function $t({
7
7
  element: e,
8
8
  selected: t,
9
9
  multiSelected: i = [],
10
10
  primarySelected: r = null
11
11
  }) {
12
- const [a, o] = A([]), s = r ?? t;
12
+ const [a, s] = S([]), o = r ?? t;
13
13
  if (H(() => {
14
- const l = /* @__PURE__ */ new Map(), p = i.length > 0;
15
- e && !t && !p && l.set(e, !1), t && l.set(t, !0);
16
- for (const g of i)
17
- l.set(g, !0);
14
+ const l = /* @__PURE__ */ new Map(), f = i.length > 0;
15
+ e && !t && !f && l.set(e, !1), t && l.set(t, !0);
16
+ for (const m of i)
17
+ l.set(m, !0);
18
18
  if (l.size === 0) {
19
- o([]);
19
+ s([]);
20
20
  return;
21
21
  }
22
- const f = () => {
23
- o(
24
- Array.from(l.entries()).map(([g, m]) => ({
25
- rect: g.getBoundingClientRect(),
26
- label: Ue(g),
27
- isSelected: m,
28
- isPrimary: s !== null && g === s
22
+ const p = () => {
23
+ s(
24
+ Array.from(l.entries()).map(([m, g]) => ({
25
+ rect: m.getBoundingClientRect(),
26
+ label: Xe(m),
27
+ isSelected: g,
28
+ isPrimary: o !== null && m === o
29
29
  }))
30
30
  );
31
31
  };
32
- f();
33
- const v = Array.from(l.keys()).map((g) => {
34
- const m = new ResizeObserver(f);
35
- return m.observe(g), m;
32
+ p();
33
+ const v = Array.from(l.keys()).map((m) => {
34
+ const g = new ResizeObserver(p);
35
+ return g.observe(m), g;
36
36
  });
37
- return window.addEventListener("scroll", f, !0), window.addEventListener("resize", f), () => {
38
- for (const g of v) g.disconnect();
39
- window.removeEventListener("scroll", f, !0), window.removeEventListener("resize", f);
37
+ return window.addEventListener("scroll", p, !0), window.addEventListener("resize", p), () => {
38
+ for (const m of v) m.disconnect();
39
+ window.removeEventListener("scroll", p, !0), window.removeEventListener("resize", p);
40
40
  };
41
- }, [e, t, i, s]), a.length === 0) return null;
42
- const u = a.find((l) => l.isPrimary) ?? a.find((l) => l.isSelected) ?? a[0], c = a.filter((l) => l.isSelected).length;
43
- return /* @__PURE__ */ d(G, { children: [
44
- a.map((l, p) => /* @__PURE__ */ n(
41
+ }, [e, t, i, o]), a.length === 0) return null;
42
+ const c = a.find((l) => l.isPrimary) ?? a.find((l) => l.isSelected) ?? a[0], u = a.filter((l) => l.isSelected).length;
43
+ return /* @__PURE__ */ d(K, { children: [
44
+ a.map((l, f) => /* @__PURE__ */ n(
45
45
  "div",
46
46
  {
47
47
  className: [
48
48
  "pa-highlight",
49
49
  l.isSelected ? "pa-highlight-selected" : "",
50
50
  l.isPrimary ? "pa-highlight-primary" : "",
51
- l.isSelected && !l.isPrimary && c > 1 ? "pa-highlight-scope" : ""
51
+ l.isSelected && !l.isPrimary && u > 1 ? "pa-highlight-scope" : ""
52
52
  ].filter(Boolean).join(" "),
53
53
  style: {
54
54
  top: l.rect.top,
@@ -57,106 +57,106 @@ function Mt({
57
57
  height: l.rect.height
58
58
  }
59
59
  },
60
- `${l.label}-${p}`
60
+ `${l.label}-${f}`
61
61
  )),
62
62
  /* @__PURE__ */ n(
63
63
  "div",
64
64
  {
65
65
  className: "pa-tooltip",
66
66
  style: {
67
- top: Math.max(0, u.rect.top - 28),
68
- left: u.rect.left
67
+ top: Math.max(0, c.rect.top - 28),
68
+ left: c.rect.left
69
69
  },
70
- children: c > 1 ? `${c} instances · ${u.label}` : u.label
70
+ children: u > 1 ? `${u} instances · ${c.label}` : c.label
71
71
  }
72
72
  )
73
73
  ] });
74
74
  }
75
- const At = 0.35, an = 0.48;
76
- function on(e, t, i, r = At) {
75
+ const It = 0.35, cn = 0.48;
76
+ function dn(e, t, i, r = It) {
77
77
  if (e < 8 || t < 8) return null;
78
- const a = 1, o = Math.max(1, Math.round(e * a)), s = Math.max(1, Math.round(t * a)), u = document.createElement("canvas");
79
- u.width = o, u.height = s;
80
- const c = u.getContext("2d");
81
- if (!c) return null;
82
- const l = c.createImageData(o, s), p = l.data, f = Math.min(0.5, i / Math.min(e, t)), v = 0.3, g = 0.2, m = Math.max(0.4, f + 0.1);
83
- let y = 0;
84
- const E = new Float32Array(o * s * 2);
85
- let x = 0;
86
- for (let N = 0; N < s; N++)
87
- for (let T = 0; T < o; T++) {
88
- const P = T / o - 0.5, $ = N / s - 0.5, k = sn(P, $, v, g, m), I = nt(0.8, 0, k - 0.15), C = nt(0, 1, I), h = (P * C + 0.5) * o - T, B = ($ * C + 0.5) * s - N;
89
- Math.abs(h) > y && (y = Math.abs(h)), Math.abs(B) > y && (y = Math.abs(B)), E[x++] = h, E[x++] = B;
78
+ const a = 1, s = Math.max(1, Math.round(e * a)), o = Math.max(1, Math.round(t * a)), c = document.createElement("canvas");
79
+ c.width = s, c.height = o;
80
+ const u = c.getContext("2d");
81
+ if (!u) return null;
82
+ const l = u.createImageData(s, o), f = l.data, p = Math.min(0.5, i / Math.min(e, t)), v = 0.3, m = 0.2, g = Math.max(0.4, p + 0.1);
83
+ let b = 0;
84
+ const L = new Float32Array(s * o * 2);
85
+ let N = 0;
86
+ for (let k = 0; k < o; k++)
87
+ for (let $ = 0; $ < s; $++) {
88
+ const P = $ / s - 0.5, R = k / o - 0.5, x = un(P, R, v, m, g), I = at(0.8, 0, x - 0.15), C = at(0, 1, I), h = (P * C + 0.5) * s - $, O = (R * C + 0.5) * o - k;
89
+ Math.abs(h) > b && (b = Math.abs(h)), Math.abs(O) > b && (b = Math.abs(O)), L[N++] = h, L[N++] = O;
90
90
  }
91
- if (y === 0) return null;
92
- y *= 0.4 * r;
91
+ if (b === 0) return null;
92
+ b *= 0.4 * r;
93
93
  let w = 0;
94
- for (let N = 0; N < p.length; N += 4) {
95
- const T = E[w++] / y + 0.5, P = E[w++] / y + 0.5;
96
- p[N] = T * 255, p[N + 1] = P * 255, p[N + 2] = 0, p[N + 3] = 255;
94
+ for (let k = 0; k < f.length; k += 4) {
95
+ const $ = L[w++] / b + 0.5, P = L[w++] / b + 0.5;
96
+ f[k] = $ * 255, f[k + 1] = P * 255, f[k + 2] = 0, f[k + 3] = 255;
97
97
  }
98
- return c.putImageData(l, 0, 0), {
99
- href: u.toDataURL("image/png"),
100
- scale: y / a,
101
- width: o,
102
- height: s
98
+ return u.putImageData(l, 0, 0), {
99
+ href: c.toDataURL("image/png"),
100
+ scale: b / a,
101
+ width: s,
102
+ height: o
103
103
  };
104
104
  }
105
- function sn(e, t, i, r, a) {
106
- const o = Math.abs(e) - i + a, s = Math.abs(t) - r + a;
107
- return Math.min(Math.max(o, s), 0) + Math.hypot(Math.max(o, 0), Math.max(s, 0)) - a;
105
+ function un(e, t, i, r, a) {
106
+ const s = Math.abs(e) - i + a, o = Math.abs(t) - r + a;
107
+ return Math.min(Math.max(s, o), 0) + Math.hypot(Math.max(s, 0), Math.max(o, 0)) - a;
108
108
  }
109
- function nt(e, t, i) {
109
+ function at(e, t, i) {
110
110
  const r = Math.max(0, Math.min(1, (i - e) / (t - e)));
111
111
  return r * r * (3 - 2 * r);
112
112
  }
113
- function _e() {
113
+ function Ue() {
114
114
  if (typeof navigator > "u") return !1;
115
115
  const e = navigator.userAgent;
116
116
  return !(/AppleWebKit/i.test(e) && !/Chrome|Chromium|Edg|OPR|CriOS|FxiOS/i.test(e) || /Firefox/i.test(e));
117
117
  }
118
- const ln = {
118
+ const pn = {
119
119
  default: "blur(4px) saturate(130%)",
120
120
  /** Toolbar — slightly stronger frost + refraction chain. */
121
121
  enhanced: "blur(6px) saturate(138%)"
122
122
  };
123
- function cn(e, t = "default") {
124
- const i = ln[t], a = e !== null && _e() ? `${i} url(#${e})` : i;
123
+ function hn(e, t = "default") {
124
+ const i = pn[t], a = e !== null && Ue() ? `${i} url(#${e})` : i;
125
125
  return {
126
126
  backdropFilter: a,
127
127
  WebkitBackdropFilter: a
128
128
  };
129
129
  }
130
- let dn = 0;
131
- function St({
130
+ let fn = 0;
131
+ function Tt({
132
132
  shape: e = "rect",
133
133
  cornerRadius: t,
134
134
  tint: i = "neutral",
135
135
  intensity: r = "default",
136
136
  className: a = "",
137
- style: o,
138
- children: s
137
+ style: s,
138
+ children: o
139
139
  }) {
140
- const u = t ?? (e === "capsule" ? 9999 : 20), c = r === "enhanced" ? an : At, l = W(null), p = we(() => `pa-lg-${++dn}`, []), [f, v] = A(null);
141
- Wt(() => {
142
- const m = l.current;
143
- if (!m) return;
144
- let y = 0;
145
- const E = () => {
146
- cancelAnimationFrame(y), y = requestAnimationFrame(() => {
147
- const w = m.getBoundingClientRect(), N = Math.round(w.width), T = Math.round(w.height);
148
- if (N < 8 || T < 8) return;
149
- const P = e === "capsule" ? T / 2 : Math.min(u, N / 2, T / 2), $ = on(N, T, P, c);
150
- $ && v($);
140
+ const c = t ?? (e === "capsule" ? 9999 : 20), u = r === "enhanced" ? cn : It, l = Y(null), f = xe(() => `pa-lg-${++fn}`, []), [p, v] = S(null);
141
+ Kt(() => {
142
+ const g = l.current;
143
+ if (!g) return;
144
+ let b = 0;
145
+ const L = () => {
146
+ cancelAnimationFrame(b), b = requestAnimationFrame(() => {
147
+ const w = g.getBoundingClientRect(), k = Math.round(w.width), $ = Math.round(w.height);
148
+ if (k < 8 || $ < 8) return;
149
+ const P = e === "capsule" ? $ / 2 : Math.min(c, k / 2, $ / 2), R = dn(k, $, P, u);
150
+ R && v(R);
151
151
  });
152
152
  };
153
- E();
154
- const x = new ResizeObserver(E);
155
- return x.observe(m), () => {
156
- cancelAnimationFrame(y), x.disconnect();
153
+ L();
154
+ const N = new ResizeObserver(L);
155
+ return N.observe(g), () => {
156
+ cancelAnimationFrame(b), N.disconnect();
157
157
  };
158
- }, [e, u, c]);
159
- const g = f && _e() && typeof document < "u" ? Ye(
158
+ }, [e, c, u]);
159
+ const m = p && Ue() && typeof document < "u" ? Ke(
160
160
  /* @__PURE__ */ n(
161
161
  "svg",
162
162
  {
@@ -175,21 +175,21 @@ function St({
175
175
  children: /* @__PURE__ */ n("defs", { children: /* @__PURE__ */ d(
176
176
  "filter",
177
177
  {
178
- id: p,
178
+ id: f,
179
179
  filterUnits: "userSpaceOnUse",
180
180
  colorInterpolationFilters: "sRGB",
181
181
  x: "0",
182
182
  y: "0",
183
- width: f.width,
184
- height: f.height,
183
+ width: p.width,
184
+ height: p.height,
185
185
  children: [
186
186
  /* @__PURE__ */ n(
187
187
  "feImage",
188
188
  {
189
- href: f.href,
190
- xlinkHref: f.href,
191
- width: f.width,
192
- height: f.height,
189
+ href: p.href,
190
+ xlinkHref: p.href,
191
+ width: p.width,
192
+ height: p.height,
193
193
  preserveAspectRatio: "none",
194
194
  result: "map"
195
195
  }
@@ -199,7 +199,7 @@ function St({
199
199
  {
200
200
  in: "SourceGraphic",
201
201
  in2: "map",
202
- scale: f.scale,
202
+ scale: p.scale,
203
203
  xChannelSelector: "R",
204
204
  yChannelSelector: "G"
205
205
  }
@@ -211,25 +211,25 @@ function St({
211
211
  ),
212
212
  document.body
213
213
  ) : null;
214
- return /* @__PURE__ */ d(G, { children: [
215
- g,
214
+ return /* @__PURE__ */ d(K, { children: [
215
+ m,
216
216
  /* @__PURE__ */ d(
217
217
  "div",
218
218
  {
219
219
  ref: l,
220
220
  className: `pa-glass-surface pa-glass-surface--${e} pa-glass-surface--${i} ${a}`.trim(),
221
221
  style: {
222
- borderRadius: e === "capsule" ? "999px" : `${u}px`,
223
- ...cn(
224
- f && _e() ? p : null,
222
+ borderRadius: e === "capsule" ? "999px" : `${c}px`,
223
+ ...hn(
224
+ p && Ue() ? f : null,
225
225
  r
226
226
  ),
227
- ...o
227
+ ...s
228
228
  },
229
229
  children: [
230
230
  /* @__PURE__ */ n("div", { className: "pa-glass-surface-bg", "aria-hidden": "true" }),
231
231
  /* @__PURE__ */ n("div", { className: "pa-glass-surface-shine", "aria-hidden": "true" }),
232
- /* @__PURE__ */ n("div", { className: "pa-glass-surface-content", children: s })
232
+ /* @__PURE__ */ n("div", { className: "pa-glass-surface-content", children: o })
233
233
  ]
234
234
  }
235
235
  )
@@ -259,7 +259,7 @@ function Te({
259
259
  children: a
260
260
  }) {
261
261
  return /* @__PURE__ */ n(
262
- St,
262
+ Tt,
263
263
  {
264
264
  shape: "rect",
265
265
  cornerRadius: e === "popover" ? 16 : 20,
@@ -269,65 +269,65 @@ function Te({
269
269
  }
270
270
  );
271
271
  }
272
- function Lt({
272
+ function Rt({
273
273
  defaultPosition: e = null,
274
274
  computeDefaultPosition: t
275
275
  } = {}) {
276
- const [i, r] = A(e), [a, o] = A(!1), s = W(null), u = W(null), c = L(() => {
276
+ const [i, r] = S(e), [a, s] = S(!1), o = Y(null), c = Y(null), u = E(() => {
277
277
  if (i !== null) return;
278
- const g = u.current;
279
- if (!g) return;
280
- const m = g.getBoundingClientRect();
278
+ const m = c.current;
279
+ if (!m) return;
280
+ const g = m.getBoundingClientRect();
281
281
  r(
282
- t ? t(m) : {
283
- x: (window.innerWidth - m.width) / 2,
284
- y: window.innerHeight - m.height - 24
282
+ t ? t(g) : {
283
+ x: (window.innerWidth - g.width) / 2,
284
+ y: window.innerHeight - g.height - 24
285
285
  }
286
286
  );
287
287
  }, [i, t]);
288
288
  H(() => {
289
- c();
290
- }, [c]), H(() => {
291
- const g = () => {
292
- r((m) => {
293
- if (!m || !u.current) return m;
294
- const y = u.current.getBoundingClientRect();
289
+ u();
290
+ }, [u]), H(() => {
291
+ const m = () => {
292
+ r((g) => {
293
+ if (!g || !c.current) return g;
294
+ const b = c.current.getBoundingClientRect();
295
295
  return {
296
- x: Math.min(m.x, window.innerWidth - y.width),
297
- y: Math.min(m.y, window.innerHeight - y.height)
296
+ x: Math.min(g.x, window.innerWidth - b.width),
297
+ y: Math.min(g.y, window.innerHeight - b.height)
298
298
  };
299
299
  });
300
300
  };
301
- return window.addEventListener("resize", g), () => window.removeEventListener("resize", g);
301
+ return window.addEventListener("resize", m), () => window.removeEventListener("resize", m);
302
302
  }, []);
303
- const l = L(
304
- (g) => {
305
- if (g.button !== 0) return;
306
- const m = u.current;
307
- if (!m) return;
308
- let y = i;
309
- if (!y) {
310
- const E = m.getBoundingClientRect();
311
- y = { x: E.left, y: E.top }, r(y);
303
+ const l = E(
304
+ (m) => {
305
+ if (m.button !== 0) return;
306
+ const g = c.current;
307
+ if (!g) return;
308
+ let b = i;
309
+ if (!b) {
310
+ const L = g.getBoundingClientRect();
311
+ b = { x: L.left, y: L.top }, r(b);
312
312
  }
313
- s.current = {
314
- pointerId: g.pointerId,
315
- startX: g.clientX,
316
- startY: g.clientY,
317
- originX: y.x,
318
- originY: y.y
319
- }, o(!0), g.currentTarget.setPointerCapture(g.pointerId), g.preventDefault();
313
+ o.current = {
314
+ pointerId: m.pointerId,
315
+ startX: m.clientX,
316
+ startY: m.clientY,
317
+ originX: b.x,
318
+ originY: b.y
319
+ }, s(!0), m.currentTarget.setPointerCapture(m.pointerId), m.preventDefault();
320
320
  },
321
321
  [i]
322
- ), p = L((g) => {
323
- if (!s.current || s.current.pointerId !== g.pointerId) return;
324
- const m = u.current, y = (m == null ? void 0 : m.offsetWidth) ?? 320, E = (m == null ? void 0 : m.offsetHeight) ?? 48, x = g.clientX - s.current.startX, w = g.clientY - s.current.startY, N = Math.max(8, Math.min(window.innerWidth - y - 8, s.current.originX + x)), T = Math.max(8, Math.min(window.innerHeight - E - 8, s.current.originY + w));
325
- r({ x: N, y: T });
326
- }, []), f = L((g) => {
327
- if (!(!s.current || s.current.pointerId !== g.pointerId)) {
328
- s.current = null, o(!1);
322
+ ), f = E((m) => {
323
+ if (!o.current || o.current.pointerId !== m.pointerId) return;
324
+ const g = c.current, b = (g == null ? void 0 : g.offsetWidth) ?? 320, L = (g == null ? void 0 : g.offsetHeight) ?? 48, N = m.clientX - o.current.startX, w = m.clientY - o.current.startY, k = Math.max(8, Math.min(window.innerWidth - b - 8, o.current.originX + N)), $ = Math.max(8, Math.min(window.innerHeight - L - 8, o.current.originY + w));
325
+ r({ x: k, y: $ });
326
+ }, []), p = E((m) => {
327
+ if (!(!o.current || o.current.pointerId !== m.pointerId)) {
328
+ o.current = null, s(!1);
329
329
  try {
330
- g.currentTarget.releasePointerCapture(g.pointerId);
330
+ m.currentTarget.releasePointerCapture(m.pointerId);
331
331
  } catch {
332
332
  }
333
333
  }
@@ -340,19 +340,19 @@ function Lt({
340
340
  bottom: "auto"
341
341
  } : void 0;
342
342
  return {
343
- elementRef: u,
343
+ elementRef: c,
344
344
  position: i,
345
345
  isDragging: a,
346
346
  style: v,
347
347
  dragHandleProps: {
348
348
  onPointerDown: l,
349
- onPointerMove: p,
350
- onPointerUp: f,
351
- onPointerCancel: f
349
+ onPointerMove: f,
350
+ onPointerUp: p,
351
+ onPointerCancel: p
352
352
  }
353
353
  };
354
354
  }
355
- function un({ className: e }) {
355
+ function mn({ className: e }) {
356
356
  return /* @__PURE__ */ d("svg", { className: e, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: [
357
357
  /* @__PURE__ */ n(
358
358
  "path",
@@ -378,7 +378,7 @@ function un({ className: e }) {
378
378
  )
379
379
  ] });
380
380
  }
381
- function pn({ className: e }) {
381
+ function gn({ className: e }) {
382
382
  return /* @__PURE__ */ d("svg", { className: e, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: [
383
383
  /* @__PURE__ */ n(
384
384
  "path",
@@ -404,8 +404,8 @@ function pn({ className: e }) {
404
404
  )
405
405
  ] });
406
406
  }
407
- const pe = (e, t, i) => Math.min(i, Math.max(t, e));
408
- function Xe(e) {
407
+ const me = (e, t, i) => Math.min(i, Math.max(t, e));
408
+ function je(e) {
409
409
  const t = e.trim();
410
410
  if (!t) return null;
411
411
  const i = t.match(/^#([0-9a-f]{6})$/i);
@@ -417,161 +417,161 @@ function Xe(e) {
417
417
  };
418
418
  const r = t.match(/^#([0-9a-f]{3})$/i);
419
419
  if (r) {
420
- const [o, s, u] = r[1].split("");
420
+ const [s, o, c] = r[1].split("");
421
421
  return {
422
- r: parseInt(o + o, 16),
423
- g: parseInt(s + s, 16),
424
- b: parseInt(u + u, 16)
422
+ r: parseInt(s + s, 16),
423
+ g: parseInt(o + o, 16),
424
+ b: parseInt(c + c, 16)
425
425
  };
426
426
  }
427
427
  const a = t.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);
428
428
  return a ? {
429
- r: pe(parseInt(a[1], 10), 0, 255),
430
- g: pe(parseInt(a[2], 10), 0, 255),
431
- b: pe(parseInt(a[3], 10), 0, 255)
429
+ r: me(parseInt(a[1], 10), 0, 255),
430
+ g: me(parseInt(a[2], 10), 0, 255),
431
+ b: me(parseInt(a[3], 10), 0, 255)
432
432
  } : null;
433
433
  }
434
- function Et(e) {
435
- const t = (i) => pe(Math.round(i), 0, 255).toString(16).padStart(2, "0");
434
+ function Pt(e) {
435
+ const t = (i) => me(Math.round(i), 0, 255).toString(16).padStart(2, "0");
436
436
  return `#${t(e.r)}${t(e.g)}${t(e.b)}`;
437
437
  }
438
- function hn(e) {
438
+ function vn(e) {
439
439
  return `rgb(${e.r}, ${e.g}, ${e.b})`;
440
440
  }
441
- function It({ r: e, g: t, b: i }) {
442
- const r = e / 255, a = t / 255, o = i / 255, s = Math.max(r, a, o), u = Math.min(r, a, o), c = s - u;
441
+ function Dt({ r: e, g: t, b: i }) {
442
+ const r = e / 255, a = t / 255, s = i / 255, o = Math.max(r, a, s), c = Math.min(r, a, s), u = o - c;
443
443
  let l = 0;
444
- c !== 0 && (s === r ? l = (a - o) / c % 6 : s === a ? l = (o - r) / c + 2 : l = (r - a) / c + 4, l *= 60, l < 0 && (l += 360));
445
- const p = s === 0 ? 0 : c / s * 100, f = s * 100;
446
- return { h: l, s: p, v: f };
447
- }
448
- function Tt({ h: e, s: t, v: i }) {
449
- const r = pe(t, 0, 100) / 100, a = pe(i, 0, 100) / 100, o = a * r, s = o * (1 - Math.abs(e / 60 % 2 - 1)), u = a - o;
450
- let c = 0, l = 0, p = 0;
451
- const f = (e % 360 + 360) % 360;
452
- return f < 60 ? (c = o, l = s) : f < 120 ? (c = s, l = o) : f < 180 ? (l = o, p = s) : f < 240 ? (l = s, p = o) : f < 300 ? (c = s, p = o) : (c = o, p = s), {
453
- r: Math.round((c + u) * 255),
454
- g: Math.round((l + u) * 255),
455
- b: Math.round((p + u) * 255)
444
+ u !== 0 && (o === r ? l = (a - s) / u % 6 : o === a ? l = (s - r) / u + 2 : l = (r - a) / u + 4, l *= 60, l < 0 && (l += 360));
445
+ const f = o === 0 ? 0 : u / o * 100, p = o * 100;
446
+ return { h: l, s: f, v: p };
447
+ }
448
+ function Ot({ h: e, s: t, v: i }) {
449
+ const r = me(t, 0, 100) / 100, a = me(i, 0, 100) / 100, s = a * r, o = s * (1 - Math.abs(e / 60 % 2 - 1)), c = a - s;
450
+ let u = 0, l = 0, f = 0;
451
+ const p = (e % 360 + 360) % 360;
452
+ return p < 60 ? (u = s, l = o) : p < 120 ? (u = o, l = s) : p < 180 ? (l = s, f = o) : p < 240 ? (l = o, f = s) : p < 300 ? (u = o, f = s) : (u = s, f = o), {
453
+ r: Math.round((u + c) * 255),
454
+ g: Math.round((l + c) * 255),
455
+ b: Math.round((f + c) * 255)
456
456
  };
457
457
  }
458
- function rt(e) {
459
- const t = Xe(e);
460
- return t ? It(t) : { h: 0, s: 0, v: 45 };
458
+ function ot(e) {
459
+ const t = je(e);
460
+ return t ? Dt(t) : { h: 0, s: 0, v: 45 };
461
461
  }
462
- function fn(e) {
462
+ function bn(e) {
463
463
  return e.replace(/^#/, "").toUpperCase().slice(0, 6);
464
464
  }
465
- function mn(e, t) {
465
+ function yn(e, t) {
466
466
  const i = e.replace(/[^0-9a-f]/gi, "").slice(0, 6);
467
- return i.length < 6 ? t : Xe(`#${i}`) ?? t;
467
+ return i.length < 6 ? t : je(`#${i}`) ?? t;
468
468
  }
469
- function gn(e) {
470
- return Et(Tt(e));
469
+ function wn(e) {
470
+ return Pt(Ot(e));
471
471
  }
472
- function vn(e, t, i) {
473
- const r = it((e - i.left) / i.width), a = it((t - i.top) / i.height);
472
+ function xn(e, t, i) {
473
+ const r = st((e - i.left) / i.width), a = st((t - i.top) / i.height);
474
474
  return { x: r * 100, y: a * 100 };
475
475
  }
476
- function it(e) {
476
+ function st(e) {
477
477
  return Math.min(1, Math.max(0, e));
478
478
  }
479
- function bn() {
479
+ function Nn() {
480
480
  if (typeof document > "u") return {};
481
481
  const e = document.querySelector("[data-pixelagent-root]") ?? document.querySelector("[data-pixelagent-toolbar-portal]"), t = e == null ? void 0 : e.getAttribute("data-pa-chrome");
482
482
  return t ? { "data-pa-chrome": t } : {};
483
483
  }
484
- function Be({ label: e, value: t, onChange: i }) {
485
- const [r, a] = A(!1), [o, s] = A(() => rt(t)), u = W(null), c = W(null), l = W(null), p = Yt(), [f, v] = A({ top: 0, left: 0, width: 260 }), g = Tt(o), m = fn(Et(g)), y = Xe(t) ? t : hn(g), E = e.toLowerCase().includes("color") ? e : `${e} color`;
484
+ function _e({ label: e, value: t, onChange: i }) {
485
+ const [r, a] = S(!1), [s, o] = S(() => ot(t)), c = Y(null), u = Y(null), l = Y(null), f = jt(), [p, v] = S({ top: 0, left: 0, width: 260 }), m = Ot(s), g = bn(Pt(m)), b = je(t) ? t : vn(m), L = e.toLowerCase().includes("color") ? e : `${e} color`;
486
486
  H(() => {
487
- s(rt(t));
487
+ o(ot(t));
488
488
  }, [t]);
489
- const x = L(
490
- (k) => {
491
- s(k), i(gn(k));
489
+ const N = E(
490
+ (x) => {
491
+ o(x), i(wn(x));
492
492
  },
493
493
  [i]
494
- ), w = L(
495
- (k) => {
496
- x(It(k));
494
+ ), w = E(
495
+ (x) => {
496
+ N(Dt(x));
497
497
  },
498
- [x]
499
- ), N = L(() => {
500
- const k = u.current;
501
- if (!k) return;
502
- const I = k.getBoundingClientRect(), C = 260;
498
+ [N]
499
+ ), k = E(() => {
500
+ const x = c.current;
501
+ if (!x) return;
502
+ const I = x.getBoundingClientRect(), C = 260;
503
503
  let h = I.left;
504
504
  h + C > window.innerWidth - 12 && (h = window.innerWidth - C - 12), h = Math.max(12, h);
505
- let B = I.bottom + 8;
506
- const Y = 320;
507
- B + Y > window.innerHeight - 12 && (B = Math.max(12, I.top - Y - 8)), v({ top: B, left: h, width: C });
505
+ let O = I.bottom + 8;
506
+ const U = 320;
507
+ O + U > window.innerHeight - 12 && (O = Math.max(12, I.top - U - 8)), v({ top: O, left: h, width: C });
508
508
  }, []);
509
509
  H(() => {
510
510
  if (!r) return;
511
- N();
512
- const k = (C) => {
513
- var B, Y;
511
+ k();
512
+ const x = (C) => {
513
+ var O, U;
514
514
  const h = C.target;
515
- (B = u.current) != null && B.contains(h) || (Y = c.current) != null && Y.contains(h) || a(!1);
515
+ (O = c.current) != null && O.contains(h) || (U = u.current) != null && U.contains(h) || a(!1);
516
516
  }, I = (C) => {
517
517
  C.key === "Escape" && a(!1);
518
518
  };
519
- return window.addEventListener("mousedown", k, !0), window.addEventListener("keydown", I), window.addEventListener("resize", N), window.addEventListener("scroll", N, !0), () => {
520
- window.removeEventListener("mousedown", k, !0), window.removeEventListener("keydown", I), window.removeEventListener("resize", N), window.removeEventListener("scroll", N, !0);
519
+ return window.addEventListener("mousedown", x, !0), window.addEventListener("keydown", I), window.addEventListener("resize", k), window.addEventListener("scroll", k, !0), () => {
520
+ window.removeEventListener("mousedown", x, !0), window.removeEventListener("keydown", I), window.removeEventListener("resize", k), window.removeEventListener("scroll", k, !0);
521
521
  };
522
- }, [r, N]);
523
- const T = (k, I) => {
524
- var Y;
525
- const C = (Y = l.current) == null ? void 0 : Y.getBoundingClientRect();
522
+ }, [r, k]);
523
+ const $ = (x, I) => {
524
+ var U;
525
+ const C = (U = l.current) == null ? void 0 : U.getBoundingClientRect();
526
526
  if (!C) return;
527
- const { x: h, y: B } = vn(k, I, C);
528
- x({ ...o, s: h, v: 100 - B });
529
- }, P = (k) => {
530
- k.preventDefault(), T(k.clientX, k.clientY);
531
- const I = (h) => T(h.clientX, h.clientY), C = () => {
527
+ const { x: h, y: O } = xn(x, I, C);
528
+ N({ ...s, s: h, v: 100 - O });
529
+ }, P = (x) => {
530
+ x.preventDefault(), $(x.clientX, x.clientY);
531
+ const I = (h) => $(h.clientX, h.clientY), C = () => {
532
532
  window.removeEventListener("mousemove", I), window.removeEventListener("mouseup", C);
533
533
  };
534
534
  window.addEventListener("mousemove", I), window.addEventListener("mouseup", C);
535
- }, $ = r ? Ye(
535
+ }, R = r ? Ke(
536
536
  /* @__PURE__ */ n(
537
537
  "div",
538
538
  {
539
539
  className: "pa-root pa-root--toolbar-portal pa-color-picker-portal",
540
540
  "data-pixelagent-picker-portal": !0,
541
- ...bn(),
541
+ ...Nn(),
542
542
  children: /* @__PURE__ */ d(
543
543
  "div",
544
544
  {
545
- ref: c,
546
- id: p,
545
+ ref: u,
546
+ id: f,
547
547
  role: "dialog",
548
- "aria-label": E,
548
+ "aria-label": L,
549
549
  className: "pa-color-picker",
550
- style: { top: f.top, left: f.left, width: f.width },
550
+ style: { top: p.top, left: p.left, width: p.width },
551
551
  children: [
552
552
  /* @__PURE__ */ d("header", { className: "pa-color-picker-header", children: [
553
553
  /* @__PURE__ */ n(
554
554
  "span",
555
555
  {
556
556
  className: "pa-color-picker-preview",
557
- style: { backgroundColor: y },
557
+ style: { backgroundColor: b },
558
558
  "aria-hidden": "true"
559
559
  }
560
560
  ),
561
- /* @__PURE__ */ n("span", { className: "pa-color-picker-header-label", children: E })
561
+ /* @__PURE__ */ n("span", { className: "pa-color-picker-header-label", children: L })
562
562
  ] }),
563
563
  /* @__PURE__ */ n(
564
564
  "div",
565
565
  {
566
566
  ref: l,
567
567
  className: "pa-color-picker-sb",
568
- style: { "--pa-picker-h": String(Math.round(o.h)) },
568
+ style: { "--pa-picker-h": String(Math.round(s.h)) },
569
569
  onMouseDown: P,
570
570
  children: /* @__PURE__ */ n(
571
571
  "span",
572
572
  {
573
573
  className: "pa-color-picker-sb-thumb",
574
- style: { left: `${o.s}%`, top: `${100 - o.v}%` },
574
+ style: { left: `${s.s}%`, top: `${100 - s.v}%` },
575
575
  "aria-hidden": "true"
576
576
  }
577
577
  )
@@ -585,16 +585,16 @@ function Be({ label: e, value: t, onChange: i }) {
585
585
  className: "pa-color-picker-hue-input",
586
586
  min: 0,
587
587
  max: 360,
588
- value: Math.round(o.h),
588
+ value: Math.round(s.h),
589
589
  "aria-label": "Hue",
590
- onChange: (k) => x({ ...o, h: parseFloat(k.target.value) })
590
+ onChange: (x) => N({ ...s, h: parseFloat(x.target.value) })
591
591
  }
592
592
  ),
593
593
  /* @__PURE__ */ n(
594
594
  "span",
595
595
  {
596
596
  className: "pa-color-picker-hue-thumb",
597
- style: { left: `${o.h / 360 * 100}%` },
597
+ style: { left: `${s.h / 360 * 100}%` },
598
598
  "aria-hidden": "true"
599
599
  }
600
600
  )
@@ -606,14 +606,14 @@ function Be({ label: e, value: t, onChange: i }) {
606
606
  {
607
607
  className: "pa-input pa-color-picker-input",
608
608
  type: "text",
609
- value: m,
609
+ value: g,
610
610
  spellCheck: !1,
611
- onChange: (k) => w(mn(k.target.value, g))
611
+ onChange: (x) => w(yn(x.target.value, m))
612
612
  }
613
613
  )
614
614
  ] }),
615
- /* @__PURE__ */ n("div", { className: "pa-color-picker-rgb", children: ["r", "g", "b"].map((k) => /* @__PURE__ */ d("label", { className: "pa-color-picker-field pa-color-picker-field--rgb", children: [
616
- /* @__PURE__ */ n("span", { className: "pa-color-picker-field-label", children: k.toUpperCase() }),
615
+ /* @__PURE__ */ n("div", { className: "pa-color-picker-rgb", children: ["r", "g", "b"].map((x) => /* @__PURE__ */ d("label", { className: "pa-color-picker-field pa-color-picker-field--rgb", children: [
616
+ /* @__PURE__ */ n("span", { className: "pa-color-picker-field-label", children: x.toUpperCase() }),
617
617
  /* @__PURE__ */ n(
618
618
  "input",
619
619
  {
@@ -621,14 +621,14 @@ function Be({ label: e, value: t, onChange: i }) {
621
621
  type: "number",
622
622
  min: 0,
623
623
  max: 255,
624
- value: g[k],
624
+ value: m[x],
625
625
  onChange: (I) => {
626
- const C = yn(parseInt(I.target.value, 10));
627
- w({ ...g, [k]: C });
626
+ const C = kn(parseInt(I.target.value, 10));
627
+ w({ ...m, [x]: C });
628
628
  }
629
629
  }
630
630
  )
631
- ] }, k)) })
631
+ ] }, x)) })
632
632
  ]
633
633
  }
634
634
  )
@@ -641,17 +641,17 @@ function Be({ label: e, value: t, onChange: i }) {
641
641
  /* @__PURE__ */ d(
642
642
  "button",
643
643
  {
644
- ref: u,
644
+ ref: c,
645
645
  type: "button",
646
646
  className: "pa-color-field-trigger",
647
647
  "aria-expanded": r,
648
648
  "aria-haspopup": "dialog",
649
- "aria-controls": r ? p : void 0,
649
+ "aria-controls": r ? f : void 0,
650
650
  onClick: () => {
651
- r || N(), a((k) => !k);
651
+ r || k(), a((x) => !x);
652
652
  },
653
653
  children: [
654
- /* @__PURE__ */ n("span", { className: "pa-color-field-swatch", style: { backgroundColor: y }, "aria-hidden": "true" }),
654
+ /* @__PURE__ */ n("span", { className: "pa-color-field-swatch", style: { backgroundColor: b }, "aria-hidden": "true" }),
655
655
  /* @__PURE__ */ n(
656
656
  "input",
657
657
  {
@@ -666,14 +666,14 @@ function Be({ label: e, value: t, onChange: i }) {
666
666
  ]
667
667
  }
668
668
  ),
669
- $
669
+ R
670
670
  ] });
671
671
  }
672
- function yn(e) {
672
+ function kn(e) {
673
673
  return Number.isFinite(e) ? Math.min(255, Math.max(0, e)) : 0;
674
674
  }
675
- function le({ title: e, children: t, defaultOpen: i = !0, badge: r }) {
676
- const [a, o] = A(i);
675
+ function ue({ title: e, children: t, defaultOpen: i = !0, badge: r }) {
676
+ const [a, s] = S(i);
677
677
  return /* @__PURE__ */ d("section", { className: `pa-edit-section ${a ? "pa-edit-section--open" : ""}`, children: [
678
678
  /* @__PURE__ */ d(
679
679
  "button",
@@ -681,7 +681,7 @@ function le({ title: e, children: t, defaultOpen: i = !0, badge: r }) {
681
681
  type: "button",
682
682
  className: "pa-edit-section-header",
683
683
  "aria-expanded": a,
684
- onClick: () => o((s) => !s),
684
+ onClick: () => s((o) => !o),
685
685
  children: [
686
686
  /* @__PURE__ */ n("span", { className: "pa-edit-section-title", children: e }),
687
687
  r ? /* @__PURE__ */ n("span", { className: "pa-edit-section-badge", children: r }) : null,
@@ -692,7 +692,7 @@ function le({ title: e, children: t, defaultOpen: i = !0, badge: r }) {
692
692
  a ? /* @__PURE__ */ n("div", { className: "pa-edit-section-body", children: t }) : null
693
693
  ] });
694
694
  }
695
- const ce = [
695
+ const pe = [
696
696
  { value: "Inter, system-ui, sans-serif", label: "Inter" },
697
697
  { value: "system-ui, sans-serif", label: "System UI" },
698
698
  {
@@ -706,37 +706,37 @@ const ce = [
706
706
  { value: '"JetBrains Mono", ui-monospace, monospace', label: "JetBrains Mono" },
707
707
  { value: "ui-monospace, monospace", label: "Monospace" }
708
708
  ], Ie = "";
709
- function Me(e) {
709
+ function Ae(e) {
710
710
  var i;
711
711
  return (((i = e.split(",")[0]) == null ? void 0 : i.trim()) ?? "").replace(/^["']|["']$/g, "");
712
712
  }
713
- function wn(e) {
713
+ function Cn(e) {
714
714
  const t = e.trim();
715
715
  if (!t)
716
716
  return {
717
717
  selectValue: Ie,
718
- options: ce
718
+ options: pe
719
719
  };
720
- const i = Me(t).toLowerCase(), r = ce.find(
721
- (o) => o.value === t || Me(o.value).toLowerCase() === i
720
+ const i = Ae(t).toLowerCase(), r = pe.find(
721
+ (s) => s.value === t || Ae(s.value).toLowerCase() === i
722
722
  );
723
723
  if (r)
724
- return { selectValue: r.value, options: ce };
725
- const a = ce.find((o) => {
726
- const s = Me(o.value).toLowerCase();
727
- return t.toLowerCase().includes(s) || s.includes(i);
724
+ return { selectValue: r.value, options: pe };
725
+ const a = pe.find((s) => {
726
+ const o = Ae(s.value).toLowerCase();
727
+ return t.toLowerCase().includes(o) || o.includes(i);
728
728
  });
729
- return a ? { selectValue: a.value, options: ce } : {
729
+ return a ? { selectValue: a.value, options: pe } : {
730
730
  selectValue: t,
731
731
  options: [
732
- ...ce,
733
- { value: t, label: Me(t) || "Custom" }
732
+ ...pe,
733
+ { value: t, label: Ae(t) || "Custom" }
734
734
  ]
735
735
  };
736
736
  }
737
- function xn({ value: e, onChange: t }) {
738
- const { selectValue: i, options: r } = we(
739
- () => wn(e),
737
+ function Mn({ value: e, onChange: t }) {
738
+ const { selectValue: i, options: r } = xe(
739
+ () => Cn(e),
740
740
  [e]
741
741
  );
742
742
  return /* @__PURE__ */ d("label", { className: "pa-edit-stack-field", children: [
@@ -747,8 +747,8 @@ function xn({ value: e, onChange: t }) {
747
747
  className: "pa-select pa-font-family-select",
748
748
  value: i || Ie,
749
749
  onChange: (a) => {
750
- const o = a.target.value;
751
- o && o !== Ie && t(o);
750
+ const s = a.target.value;
751
+ s && s !== Ie && t(s);
752
752
  },
753
753
  children: [
754
754
  /* @__PURE__ */ n("option", { value: Ie, disabled: !0, children: "Select font style" }),
@@ -758,11 +758,11 @@ function xn({ value: e, onChange: t }) {
758
758
  )
759
759
  ] });
760
760
  }
761
- function Ge(e) {
761
+ function qe(e) {
762
762
  const t = e.trim().match(/^(-?\d+(?:\.\d+)?)px$/i);
763
763
  return t ? parseFloat(t[1]) : null;
764
764
  }
765
- function Nn(e) {
765
+ function An(e) {
766
766
  const t = e.trim();
767
767
  if (!t) return null;
768
768
  if (t.endsWith("%")) {
@@ -772,21 +772,21 @@ function Nn(e) {
772
772
  const i = parseFloat(t);
773
773
  return Number.isFinite(i) && i >= 0 && i <= 1 ? i : null;
774
774
  }
775
- function kn(e) {
776
- const t = Pt(e);
775
+ function Sn(e) {
776
+ const t = Ft(e);
777
777
  if (t !== null) return t > 0;
778
- const i = Ge(e);
778
+ const i = qe(e);
779
779
  return i !== null && i > 0;
780
780
  }
781
- function Pt(e) {
781
+ function Ft(e) {
782
782
  const t = e.trim().split(/\s+/).filter(Boolean);
783
783
  if (t.length === 0) return null;
784
- const i = t.map((a) => Ge(a));
784
+ const i = t.map((a) => qe(a));
785
785
  if (i.some((a) => a === null)) return null;
786
786
  const r = i[0];
787
787
  return i.every((a) => a === r) ? r : null;
788
788
  }
789
- const Cn = {
789
+ const Ln = {
790
790
  padding: { kind: "uniform-px", min: 0, max: 80, step: 1 },
791
791
  margin: { kind: "uniform-px", min: 0, max: 80, step: 1 },
792
792
  width: { kind: "text" },
@@ -800,19 +800,19 @@ const Cn = {
800
800
  "border-radius": { kind: "px", min: 0, max: 48, step: 1 },
801
801
  opacity: { kind: "opacity", min: 0, max: 1, step: 0.01 }
802
802
  };
803
- function Mn(e, t, i) {
803
+ function En(e, t, i) {
804
804
  switch (i.kind) {
805
805
  case "opacity":
806
- return Nn(t);
806
+ return An(t);
807
807
  case "px":
808
- return Ge(t);
808
+ return qe(t);
809
809
  case "uniform-px":
810
- return Pt(t);
810
+ return Ft(t);
811
811
  default:
812
812
  return null;
813
813
  }
814
814
  }
815
- function An(e, t, i) {
815
+ function $n(e, t, i) {
816
816
  switch (i.kind) {
817
817
  case "opacity":
818
818
  return String(Math.round(t * 100) / 100);
@@ -823,16 +823,16 @@ function An(e, t, i) {
823
823
  return String(t);
824
824
  }
825
825
  }
826
- function re({
826
+ function ie({
827
827
  property: e,
828
828
  label: t,
829
829
  value: i,
830
830
  onChange: r,
831
831
  compact: a = !1
832
832
  }) {
833
- const o = Cn[e] ?? { kind: "text" }, s = Mn(e, i, o), u = o.kind !== "text" && s !== null, c = a ? "pa-prop-row pa-prop-row--compact" : "pa-prop-row", l = a ? "pa-edit-field-label" : "pa-prop-label";
834
- if (!u)
835
- return /* @__PURE__ */ d("label", { className: c, children: [
833
+ const s = Ln[e] ?? { kind: "text" }, o = En(e, i, s), c = s.kind !== "text" && o !== null, u = a ? "pa-prop-row pa-prop-row--compact" : "pa-prop-row", l = a ? "pa-edit-field-label" : "pa-prop-label";
834
+ if (!c)
835
+ return /* @__PURE__ */ d("label", { className: u, children: [
836
836
  /* @__PURE__ */ n("span", { className: l, children: t }),
837
837
  /* @__PURE__ */ n(
838
838
  "input",
@@ -840,14 +840,14 @@ function re({
840
840
  className: "pa-input",
841
841
  type: "text",
842
842
  value: i,
843
- onChange: (m) => r(m.target.value)
843
+ onChange: (g) => r(g.target.value)
844
844
  }
845
845
  )
846
846
  ] });
847
- const p = o.min ?? 0, f = o.max ?? 100, v = o.step ?? 1, g = (m) => {
848
- r(An(e, m, o));
847
+ const f = s.min ?? 0, p = s.max ?? 100, v = s.step ?? 1, m = (g) => {
848
+ r($n(e, g, s));
849
849
  };
850
- return /* @__PURE__ */ d("label", { className: `${c} pa-prop-row--slider`, children: [
850
+ return /* @__PURE__ */ d("label", { className: `${u} pa-prop-row--slider`, children: [
851
851
  /* @__PURE__ */ n("span", { className: l, children: t }),
852
852
  /* @__PURE__ */ d("div", { className: "pa-prop-slider-wrap", children: [
853
853
  /* @__PURE__ */ n(
@@ -855,12 +855,12 @@ function re({
855
855
  {
856
856
  type: "range",
857
857
  className: "pa-slider",
858
- min: p,
859
- max: f,
858
+ min: f,
859
+ max: p,
860
860
  step: v,
861
- value: s,
861
+ value: o,
862
862
  "aria-valuetext": i,
863
- onChange: (m) => g(parseFloat(m.target.value))
863
+ onChange: (g) => m(parseFloat(g.target.value))
864
864
  }
865
865
  ),
866
866
  /* @__PURE__ */ n(
@@ -869,14 +869,14 @@ function re({
869
869
  className: "pa-input pa-prop-slider-value",
870
870
  type: "text",
871
871
  value: i,
872
- onChange: (m) => r(m.target.value),
872
+ onChange: (g) => r(g.target.value),
873
873
  "aria-label": `${t} value`
874
874
  }
875
875
  )
876
876
  ] })
877
877
  ] });
878
878
  }
879
- function Sn(e) {
879
+ function In(e) {
880
880
  const t = e.trim().split(/\s+/).filter(Boolean), i = t[0] ?? "0px";
881
881
  if (t.length <= 1) return { top: i, right: i, bottom: i, left: i };
882
882
  const r = t[1];
@@ -884,63 +884,63 @@ function Sn(e) {
884
884
  const a = t[2];
885
885
  return t.length === 3 ? { top: i, right: r, bottom: a, left: r } : { top: i, right: r, bottom: a, left: t[3] };
886
886
  }
887
- function Ln({ top: e, right: t, bottom: i, left: r }) {
887
+ function Tn({ top: e, right: t, bottom: i, left: r }) {
888
888
  return e === t && t === i && i === r ? e : e === i && t === r ? `${e} ${t}` : t === r ? `${e} ${t} ${i}` : `${e} ${t} ${i} ${r}`;
889
889
  }
890
- function oe(e) {
890
+ function le(e) {
891
891
  const t = e.trim().match(/^(-?\d+(?:\.\d+)?)px$/i);
892
892
  return t ? t[1] : e;
893
893
  }
894
- function se(e) {
894
+ function ce(e) {
895
895
  const t = e.trim();
896
896
  return t === "" ? "0px" : /^-?\d+(?:\.\d+)?$/.test(t) ? `${t}px` : t;
897
897
  }
898
- function at(e, t) {
899
- return e === t ? oe(e) : `${oe(e)}, ${oe(t)}`;
898
+ function lt(e, t) {
899
+ return e === t ? le(e) : `${le(e)}, ${le(t)}`;
900
900
  }
901
- function ot(e, t) {
901
+ function ct(e, t) {
902
902
  const i = e.split(",").map((r) => r.trim()).filter(Boolean);
903
903
  if (i.length === 0) return [t, t];
904
904
  if (i.length === 1) {
905
- const r = se(i[0]);
905
+ const r = ce(i[0]);
906
906
  return [r, r];
907
907
  }
908
- return [se(i[0]), se(i[1])];
908
+ return [ce(i[0]), ce(i[1])];
909
909
  }
910
- const st = 12, Ke = {
911
- width: st,
912
- height: st,
910
+ const dt = 12, Je = {
911
+ width: dt,
912
+ height: dt,
913
913
  viewBox: "0 0 12 12",
914
914
  fill: "none",
915
915
  "aria-hidden": !0
916
916
  };
917
- function En() {
918
- return /* @__PURE__ */ d("svg", { ...Ke, children: [
917
+ function Rn() {
918
+ return /* @__PURE__ */ d("svg", { ...Je, children: [
919
919
  /* @__PURE__ */ n("rect", { x: "1.5", y: "1.5", width: "9", height: "9", stroke: "currentColor", strokeOpacity: "0.35" }),
920
920
  /* @__PURE__ */ n("line", { x1: "1.5", y1: "1.5", x2: "1.5", y2: "10.5", stroke: "currentColor", strokeWidth: "1.5" }),
921
921
  /* @__PURE__ */ n("line", { x1: "10.5", y1: "1.5", x2: "10.5", y2: "10.5", stroke: "currentColor", strokeWidth: "1.5" })
922
922
  ] });
923
923
  }
924
- function In() {
925
- return /* @__PURE__ */ d("svg", { ...Ke, children: [
924
+ function Pn() {
925
+ return /* @__PURE__ */ d("svg", { ...Je, children: [
926
926
  /* @__PURE__ */ n("rect", { x: "1.5", y: "1.5", width: "9", height: "9", stroke: "currentColor", strokeOpacity: "0.35" }),
927
927
  /* @__PURE__ */ n("line", { x1: "1.5", y1: "1.5", x2: "10.5", y2: "1.5", stroke: "currentColor", strokeWidth: "1.5" }),
928
928
  /* @__PURE__ */ n("line", { x1: "1.5", y1: "10.5", x2: "10.5", y2: "10.5", stroke: "currentColor", strokeWidth: "1.5" })
929
929
  ] });
930
930
  }
931
- function Ae({ side: e }) {
931
+ function Se({ side: e }) {
932
932
  const t = {
933
933
  top: { x1: 1.5, y1: 1.5, x2: 10.5, y2: 1.5 },
934
934
  right: { x1: 10.5, y1: 1.5, x2: 10.5, y2: 10.5 },
935
935
  bottom: { x1: 1.5, y1: 10.5, x2: 10.5, y2: 10.5 },
936
936
  left: { x1: 1.5, y1: 1.5, x2: 1.5, y2: 10.5 }
937
937
  }[e];
938
- return /* @__PURE__ */ d("svg", { ...Ke, children: [
938
+ return /* @__PURE__ */ d("svg", { ...Je, children: [
939
939
  /* @__PURE__ */ n("rect", { x: "1.5", y: "1.5", width: "9", height: "9", stroke: "currentColor", strokeOpacity: "0.35" }),
940
940
  /* @__PURE__ */ n("line", { ...t, stroke: "currentColor", strokeWidth: "1.5" })
941
941
  ] });
942
942
  }
943
- function Tn() {
943
+ function Dn() {
944
944
  return /* @__PURE__ */ d("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: [
945
945
  /* @__PURE__ */ n("rect", { x: "2", y: "2", width: "4", height: "4", stroke: "currentColor", strokeWidth: "1.2" }),
946
946
  /* @__PURE__ */ n("rect", { x: "8", y: "2", width: "4", height: "4", stroke: "currentColor", strokeWidth: "1.2" }),
@@ -948,10 +948,10 @@ function Tn() {
948
948
  /* @__PURE__ */ n("rect", { x: "8", y: "8", width: "4", height: "4", stroke: "currentColor", strokeWidth: "1.2" })
949
949
  ] });
950
950
  }
951
- function de({ icon: e, display: t, ariaLabel: i, mixed: r, onCommit: a }) {
952
- const [o, s] = A(t);
951
+ function he({ icon: e, display: t, ariaLabel: i, mixed: r, onCommit: a }) {
952
+ const [s, o] = S(t);
953
953
  return H(() => {
954
- s(t);
954
+ o(t);
955
955
  }, [t]), /* @__PURE__ */ d("label", { className: `pa-spacing-cell ${r ? "pa-spacing-cell--mixed" : ""}`, children: [
956
956
  /* @__PURE__ */ n("span", { className: "pa-spacing-cell-icon", children: e }),
957
957
  /* @__PURE__ */ n(
@@ -959,11 +959,11 @@ function de({ icon: e, display: t, ariaLabel: i, mixed: r, onCommit: a }) {
959
959
  {
960
960
  className: "pa-input pa-spacing-cell-input",
961
961
  type: "text",
962
- value: o,
963
- onChange: (u) => s(u.target.value),
964
- onBlur: () => a(o),
965
- onKeyDown: (u) => {
966
- u.key === "Enter" && u.target.blur(), u.key === "Escape" && (s(t), u.target.blur());
962
+ value: s,
963
+ onChange: (c) => o(c.target.value),
964
+ onBlur: () => a(s),
965
+ onKeyDown: (c) => {
966
+ c.key === "Enter" && c.target.blur(), c.key === "Escape" && (o(t), c.target.blur());
967
967
  },
968
968
  "aria-label": i,
969
969
  spellCheck: !1
@@ -971,10 +971,10 @@ function de({ icon: e, display: t, ariaLabel: i, mixed: r, onCommit: a }) {
971
971
  )
972
972
  ] });
973
973
  }
974
- function lt({ label: e, value: t, onChange: i }) {
975
- const r = Sn(t), [a, o] = A(!1), s = (l) => {
976
- i(Ln({ ...r, ...l }));
977
- }, u = r.left !== r.right, c = r.top !== r.bottom;
974
+ function ut({ label: e, value: t, onChange: i }) {
975
+ const r = In(t), [a, s] = S(!1), o = (l) => {
976
+ i(Tn({ ...r, ...l }));
977
+ }, c = r.left !== r.right, u = r.top !== r.bottom;
978
978
  return /* @__PURE__ */ d("div", { className: "pa-prop-row pa-prop-row--compact pa-spacing-row", children: [
979
979
  /* @__PURE__ */ n("span", { className: "pa-edit-field-label", children: e }),
980
980
  /* @__PURE__ */ d(
@@ -988,66 +988,66 @@ function lt({ label: e, value: t, onChange: i }) {
988
988
  // Col 2 (vertical pair) → T on top, B on bottom
989
989
  /* @__PURE__ */ d("div", { className: "pa-spacing-grid", children: [
990
990
  /* @__PURE__ */ n(
991
- de,
991
+ he,
992
992
  {
993
- icon: /* @__PURE__ */ n(Ae, { side: "left" }),
994
- display: oe(r.left),
993
+ icon: /* @__PURE__ */ n(Se, { side: "left" }),
994
+ display: le(r.left),
995
995
  ariaLabel: `${e} left`,
996
- onCommit: (l) => s({ left: se(l) })
996
+ onCommit: (l) => o({ left: ce(l) })
997
997
  }
998
998
  ),
999
999
  /* @__PURE__ */ n(
1000
- de,
1000
+ he,
1001
1001
  {
1002
- icon: /* @__PURE__ */ n(Ae, { side: "top" }),
1003
- display: oe(r.top),
1002
+ icon: /* @__PURE__ */ n(Se, { side: "top" }),
1003
+ display: le(r.top),
1004
1004
  ariaLabel: `${e} top`,
1005
- onCommit: (l) => s({ top: se(l) })
1005
+ onCommit: (l) => o({ top: ce(l) })
1006
1006
  }
1007
1007
  ),
1008
1008
  /* @__PURE__ */ n(
1009
- de,
1009
+ he,
1010
1010
  {
1011
- icon: /* @__PURE__ */ n(Ae, { side: "right" }),
1012
- display: oe(r.right),
1011
+ icon: /* @__PURE__ */ n(Se, { side: "right" }),
1012
+ display: le(r.right),
1013
1013
  ariaLabel: `${e} right`,
1014
- onCommit: (l) => s({ right: se(l) })
1014
+ onCommit: (l) => o({ right: ce(l) })
1015
1015
  }
1016
1016
  ),
1017
1017
  /* @__PURE__ */ n(
1018
- de,
1018
+ he,
1019
1019
  {
1020
- icon: /* @__PURE__ */ n(Ae, { side: "bottom" }),
1021
- display: oe(r.bottom),
1020
+ icon: /* @__PURE__ */ n(Se, { side: "bottom" }),
1021
+ display: le(r.bottom),
1022
1022
  ariaLabel: `${e} bottom`,
1023
- onCommit: (l) => s({ bottom: se(l) })
1023
+ onCommit: (l) => o({ bottom: ce(l) })
1024
1024
  }
1025
1025
  )
1026
1026
  ] })
1027
1027
  ) : /* @__PURE__ */ d("div", { className: "pa-spacing-pair", children: [
1028
1028
  /* @__PURE__ */ n(
1029
- de,
1029
+ he,
1030
1030
  {
1031
- icon: /* @__PURE__ */ n(En, {}),
1032
- display: at(r.left, r.right),
1033
- mixed: u,
1031
+ icon: /* @__PURE__ */ n(Rn, {}),
1032
+ display: lt(r.left, r.right),
1033
+ mixed: c,
1034
1034
  ariaLabel: `${e} horizontal`,
1035
1035
  onCommit: (l) => {
1036
- const [p, f] = ot(l, r.left);
1037
- s({ left: p, right: f });
1036
+ const [f, p] = ct(l, r.left);
1037
+ o({ left: f, right: p });
1038
1038
  }
1039
1039
  }
1040
1040
  ),
1041
1041
  /* @__PURE__ */ n(
1042
- de,
1042
+ he,
1043
1043
  {
1044
- icon: /* @__PURE__ */ n(In, {}),
1045
- display: at(r.top, r.bottom),
1046
- mixed: c,
1044
+ icon: /* @__PURE__ */ n(Pn, {}),
1045
+ display: lt(r.top, r.bottom),
1046
+ mixed: u,
1047
1047
  ariaLabel: `${e} vertical`,
1048
1048
  onCommit: (l) => {
1049
- const [p, f] = ot(l, r.top);
1050
- s({ top: p, bottom: f });
1049
+ const [f, p] = ct(l, r.top);
1050
+ o({ top: f, bottom: p });
1051
1051
  }
1052
1052
  }
1053
1053
  )
@@ -1057,11 +1057,11 @@ function lt({ label: e, value: t, onChange: i }) {
1057
1057
  {
1058
1058
  type: "button",
1059
1059
  className: `pa-spacing-toggle ${a ? "pa-spacing-toggle--on" : ""}`,
1060
- onClick: () => o((l) => !l),
1060
+ onClick: () => s((l) => !l),
1061
1061
  "aria-pressed": a,
1062
1062
  "aria-label": a ? "Collapse to pair view" : "Expand to per-side view",
1063
1063
  title: a ? "Collapse to pair view" : "Expand to per-side view",
1064
- children: /* @__PURE__ */ n(Tn, {})
1064
+ children: /* @__PURE__ */ n(Dn, {})
1065
1065
  }
1066
1066
  )
1067
1067
  ]
@@ -1069,7 +1069,7 @@ function lt({ label: e, value: t, onChange: i }) {
1069
1069
  )
1070
1070
  ] });
1071
1071
  }
1072
- function Pn({
1072
+ function On({
1073
1073
  options: e,
1074
1074
  value: t,
1075
1075
  ariaLabel: i,
@@ -1089,7 +1089,7 @@ function Pn({
1089
1089
  a.value
1090
1090
  )) });
1091
1091
  }
1092
- function Rn({
1092
+ function Fn({
1093
1093
  options: e,
1094
1094
  ariaLabel: t,
1095
1095
  onToggle: i
@@ -1108,7 +1108,7 @@ function Rn({
1108
1108
  r.id
1109
1109
  )) });
1110
1110
  }
1111
- function $n({ className: e }) {
1111
+ function Bn({ className: e }) {
1112
1112
  return /* @__PURE__ */ n("svg", { className: e, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ n(
1113
1113
  "path",
1114
1114
  {
@@ -1117,7 +1117,7 @@ function $n({ className: e }) {
1117
1117
  }
1118
1118
  ) });
1119
1119
  }
1120
- function Dn({ className: e }) {
1120
+ function zn({ className: e }) {
1121
1121
  return /* @__PURE__ */ n("svg", { className: e, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ n(
1122
1122
  "path",
1123
1123
  {
@@ -1126,7 +1126,7 @@ function Dn({ className: e }) {
1126
1126
  }
1127
1127
  ) });
1128
1128
  }
1129
- function On({ className: e }) {
1129
+ function _n({ className: e }) {
1130
1130
  return /* @__PURE__ */ n("svg", { className: e, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ n(
1131
1131
  "path",
1132
1132
  {
@@ -1135,10 +1135,10 @@ function On({ className: e }) {
1135
1135
  }
1136
1136
  ) });
1137
1137
  }
1138
- function Fn({ className: e }) {
1138
+ function Hn({ className: e }) {
1139
1139
  return /* @__PURE__ */ n("svg", { className: e, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ n("path", { fill: "currentColor", d: "M2 3h12v1.5H2V3zm0 3.5h12v1.5H2V6.5zm0 3.5h12v1.5H2V10zm0 3.5h12v1.5H2V13.5z" }) });
1140
1140
  }
1141
- function Bn({ className: e }) {
1141
+ function Vn({ className: e }) {
1142
1142
  return /* @__PURE__ */ n("svg", { className: e, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ n(
1143
1143
  "path",
1144
1144
  {
@@ -1147,33 +1147,33 @@ function Bn({ className: e }) {
1147
1147
  }
1148
1148
  ) });
1149
1149
  }
1150
- function Rt(e) {
1150
+ function Bt(e) {
1151
1151
  const t = parseInt(e.trim(), 10);
1152
1152
  return Number.isFinite(t) ? t >= 600 : e.trim() === "bold" || e.trim() === "bolder";
1153
1153
  }
1154
- function zn(e) {
1155
- return Rt(e) ? "400" : "700";
1154
+ function Wn(e) {
1155
+ return Bt(e) ? "400" : "700";
1156
1156
  }
1157
- function $t(e) {
1157
+ function zt(e) {
1158
1158
  return e.trim() === "italic" || e.trim() === "oblique";
1159
1159
  }
1160
- function Hn(e) {
1161
- return $t(e) ? "normal" : "italic";
1160
+ function Un(e) {
1161
+ return zt(e) ? "normal" : "italic";
1162
1162
  }
1163
- function ct(e, t) {
1163
+ function pt(e, t) {
1164
1164
  return e.split(/\s+/).includes(t);
1165
1165
  }
1166
- function dt(e, t) {
1166
+ function ht(e, t) {
1167
1167
  const i = new Set(
1168
1168
  e.trim().split(/\s+/).filter((r) => r && r !== "none")
1169
1169
  );
1170
1170
  return i.has(t) ? i.delete(t) : i.add(t), i.size === 0 ? "none" : Array.from(i).join(" ");
1171
1171
  }
1172
- function _n(e) {
1172
+ function Yn(e) {
1173
1173
  const t = e.trim();
1174
1174
  return t === "center" || t === "right" || t === "justify" ? t : "left";
1175
1175
  }
1176
- const ut = [
1176
+ const ft = [
1177
1177
  "none",
1178
1178
  "solid",
1179
1179
  "dashed",
@@ -1183,7 +1183,7 @@ const ut = [
1183
1183
  "ridge",
1184
1184
  "inset",
1185
1185
  "outset"
1186
- ], pt = [
1186
+ ], mt = [
1187
1187
  "block",
1188
1188
  "inline",
1189
1189
  "inline-block",
@@ -1193,27 +1193,27 @@ const ut = [
1193
1193
  "inline-grid",
1194
1194
  "none",
1195
1195
  "contents"
1196
- ], Vn = /* @__PURE__ */ new Set(["flex", "inline-flex", "grid", "inline-grid"]);
1197
- function Un({
1196
+ ], Xn = /* @__PURE__ */ new Set(["flex", "inline-flex", "grid", "inline-grid"]);
1197
+ function Gn({
1198
1198
  values: e,
1199
1199
  onPropertyChange: t,
1200
1200
  textKind: i,
1201
1201
  textValue: r,
1202
1202
  onTextChange: a,
1203
- targetScope: o,
1204
- onTargetScopeChange: s,
1205
- elementState: u,
1206
- onElementStateChange: c,
1203
+ targetScope: s,
1204
+ onTargetScopeChange: o,
1205
+ elementState: c,
1206
+ onElementStateChange: u,
1207
1207
  instanceCount: l,
1208
- scopeHint: p,
1209
- stateHint: f
1208
+ scopeHint: f,
1209
+ stateHint: p
1210
1210
  }) {
1211
1211
  var I, C;
1212
- const v = e["font-weight"] ?? "", g = e["font-style"] ?? "normal", m = e["text-decoration"] ?? "none", y = _n(e["text-align"] ?? "left"), E = ((I = e.display) == null ? void 0 : I.trim()) ?? "", x = !!E, w = Vn.has(E), N = [...pt];
1213
- E && !pt.includes(E) && N.push(E);
1214
- const T = ((C = e.gap) == null ? void 0 : C.trim()) ?? "", P = T === "normal" || T === "" ? "0px" : T, $ = e["border-style"] ?? "none", k = [...ut];
1215
- return $ && !ut.includes($) && k.push($), /* @__PURE__ */ d("div", { className: "pa-edit-sections", children: [
1216
- /* @__PURE__ */ d(le, { title: "Targeting", defaultOpen: !0, children: [
1212
+ const v = e["font-weight"] ?? "", m = e["font-style"] ?? "normal", g = e["text-decoration"] ?? "none", b = Yn(e["text-align"] ?? "left"), L = ((I = e.display) == null ? void 0 : I.trim()) ?? "", N = !!L, w = Xn.has(L), k = [...mt];
1213
+ L && !mt.includes(L) && k.push(L);
1214
+ const $ = ((C = e.gap) == null ? void 0 : C.trim()) ?? "", P = $ === "normal" || $ === "" ? "0px" : $, R = e["border-style"] ?? "none", x = [...ft];
1215
+ return R && !ft.includes(R) && x.push(R), /* @__PURE__ */ d("div", { className: "pa-edit-sections", children: [
1216
+ /* @__PURE__ */ d(ue, { title: "Targeting", defaultOpen: !0, children: [
1217
1217
  /* @__PURE__ */ d("div", { className: "pa-edit-field-grid pa-edit-field-grid--2", children: [
1218
1218
  /* @__PURE__ */ d("label", { className: "pa-edit-mini-field", children: [
1219
1219
  /* @__PURE__ */ n("span", { className: "pa-edit-field-label", children: "Scope" }),
@@ -1221,8 +1221,8 @@ function Un({
1221
1221
  "select",
1222
1222
  {
1223
1223
  className: "pa-select",
1224
- value: o,
1225
- onChange: (h) => s(h.target.value),
1224
+ value: s,
1225
+ onChange: (h) => o(h.target.value),
1226
1226
  children: [
1227
1227
  /* @__PURE__ */ n("option", { value: "this-instance", children: "This instance" }),
1228
1228
  /* @__PURE__ */ d("option", { value: "all-instances", disabled: l <= 1, children: [
@@ -1240,8 +1240,8 @@ function Un({
1240
1240
  "select",
1241
1241
  {
1242
1242
  className: "pa-select",
1243
- value: u,
1244
- onChange: (h) => c(h.target.value),
1243
+ value: c,
1244
+ onChange: (h) => u(h.target.value),
1245
1245
  children: [
1246
1246
  /* @__PURE__ */ n("option", { value: "normal", children: "Normal" }),
1247
1247
  /* @__PURE__ */ n("option", { value: "hover", children: "Hover" }),
@@ -1253,10 +1253,10 @@ function Un({
1253
1253
  )
1254
1254
  ] })
1255
1255
  ] }),
1256
- p ? /* @__PURE__ */ n("p", { className: "pa-edit-inline-hint", children: p }) : null,
1257
- f ? /* @__PURE__ */ n("p", { className: "pa-edit-inline-hint", children: f }) : null
1256
+ f ? /* @__PURE__ */ n("p", { className: "pa-edit-inline-hint", children: f }) : null,
1257
+ p ? /* @__PURE__ */ n("p", { className: "pa-edit-inline-hint", children: p }) : null
1258
1258
  ] }),
1259
- i !== "none" && /* @__PURE__ */ n(le, { title: "Content", defaultOpen: !0, children: /* @__PURE__ */ d("label", { className: "pa-edit-stack-field", children: [
1259
+ i !== "none" && /* @__PURE__ */ n(ue, { title: "Content", defaultOpen: !0, children: /* @__PURE__ */ d("label", { className: "pa-edit-stack-field", children: [
1260
1260
  /* @__PURE__ */ n("span", { className: "pa-edit-field-label", children: "Text" }),
1261
1261
  /* @__PURE__ */ n(
1262
1262
  "textarea",
@@ -1269,9 +1269,9 @@ function Un({
1269
1269
  }
1270
1270
  )
1271
1271
  ] }) }),
1272
- /* @__PURE__ */ d(le, { title: "Typography", defaultOpen: !0, children: [
1272
+ /* @__PURE__ */ d(ue, { title: "Typography", defaultOpen: !0, children: [
1273
1273
  /* @__PURE__ */ n(
1274
- xn,
1274
+ Mn,
1275
1275
  {
1276
1276
  value: e["font-family"] ?? "",
1277
1277
  onChange: (h) => t("font-family", h)
@@ -1280,42 +1280,42 @@ function Un({
1280
1280
  /* @__PURE__ */ d("div", { className: "pa-edit-field-block", children: [
1281
1281
  /* @__PURE__ */ n("span", { className: "pa-edit-field-label", children: "Style" }),
1282
1282
  /* @__PURE__ */ n(
1283
- Rn,
1283
+ Fn,
1284
1284
  {
1285
1285
  ariaLabel: "Text style",
1286
1286
  options: [
1287
1287
  {
1288
1288
  id: "bold",
1289
1289
  title: "Bold",
1290
- pressed: Rt(v),
1290
+ pressed: Bt(v),
1291
1291
  content: /* @__PURE__ */ n("span", { className: "pa-segmented-type pa-segmented-type--bold", children: "B" })
1292
1292
  },
1293
1293
  {
1294
1294
  id: "italic",
1295
1295
  title: "Italic",
1296
- pressed: $t(g),
1296
+ pressed: zt(m),
1297
1297
  content: /* @__PURE__ */ n("span", { className: "pa-segmented-type pa-segmented-type--italic", children: "I" })
1298
1298
  },
1299
1299
  {
1300
1300
  id: "underline",
1301
1301
  title: "Underline",
1302
- pressed: ct(m, "underline"),
1302
+ pressed: pt(g, "underline"),
1303
1303
  content: /* @__PURE__ */ n("span", { className: "pa-segmented-type pa-segmented-type--underline", children: "U" })
1304
1304
  },
1305
1305
  {
1306
1306
  id: "strikethrough",
1307
1307
  title: "Strikethrough",
1308
- pressed: ct(m, "line-through"),
1309
- content: /* @__PURE__ */ n(Bn, { className: "pa-segmented-icon" })
1308
+ pressed: pt(g, "line-through"),
1309
+ content: /* @__PURE__ */ n(Vn, { className: "pa-segmented-icon" })
1310
1310
  }
1311
1311
  ],
1312
1312
  onToggle: (h) => {
1313
- h === "bold" ? t("font-weight", zn(v)) : h === "italic" ? t("font-style", Hn(g)) : h === "underline" ? t(
1313
+ h === "bold" ? t("font-weight", Wn(v)) : h === "italic" ? t("font-style", Un(m)) : h === "underline" ? t(
1314
1314
  "text-decoration",
1315
- dt(m, "underline")
1315
+ ht(g, "underline")
1316
1316
  ) : h === "strikethrough" && t(
1317
1317
  "text-decoration",
1318
- dt(m, "line-through")
1318
+ ht(g, "line-through")
1319
1319
  );
1320
1320
  }
1321
1321
  }
@@ -1324,31 +1324,31 @@ function Un({
1324
1324
  /* @__PURE__ */ d("div", { className: "pa-edit-field-block", children: [
1325
1325
  /* @__PURE__ */ n("span", { className: "pa-edit-field-label", children: "Align" }),
1326
1326
  /* @__PURE__ */ n(
1327
- Pn,
1327
+ On,
1328
1328
  {
1329
1329
  ariaLabel: "Text align",
1330
- value: y,
1330
+ value: b,
1331
1331
  onChange: (h) => t("text-align", h),
1332
1332
  options: [
1333
1333
  {
1334
1334
  value: "left",
1335
1335
  title: "Align left",
1336
- content: /* @__PURE__ */ n($n, { className: "pa-segmented-icon" })
1336
+ content: /* @__PURE__ */ n(Bn, { className: "pa-segmented-icon" })
1337
1337
  },
1338
1338
  {
1339
1339
  value: "center",
1340
1340
  title: "Align center",
1341
- content: /* @__PURE__ */ n(Dn, { className: "pa-segmented-icon" })
1341
+ content: /* @__PURE__ */ n(zn, { className: "pa-segmented-icon" })
1342
1342
  },
1343
1343
  {
1344
1344
  value: "right",
1345
1345
  title: "Align right",
1346
- content: /* @__PURE__ */ n(On, { className: "pa-segmented-icon" })
1346
+ content: /* @__PURE__ */ n(_n, { className: "pa-segmented-icon" })
1347
1347
  },
1348
1348
  {
1349
1349
  value: "justify",
1350
1350
  title: "Justify",
1351
- content: /* @__PURE__ */ n(Fn, { className: "pa-segmented-icon" })
1351
+ content: /* @__PURE__ */ n(Hn, { className: "pa-segmented-icon" })
1352
1352
  }
1353
1353
  ]
1354
1354
  }
@@ -1356,7 +1356,7 @@ function Un({
1356
1356
  ] }),
1357
1357
  /* @__PURE__ */ d("div", { className: "pa-edit-field-grid pa-edit-field-grid--2 pa-edit-size-row", children: [
1358
1358
  /* @__PURE__ */ n(
1359
- re,
1359
+ ie,
1360
1360
  {
1361
1361
  compact: !0,
1362
1362
  property: "font-size",
@@ -1366,7 +1366,7 @@ function Un({
1366
1366
  }
1367
1367
  ),
1368
1368
  /* @__PURE__ */ n(
1369
- re,
1369
+ ie,
1370
1370
  {
1371
1371
  compact: !0,
1372
1372
  property: "line-height",
@@ -1377,7 +1377,7 @@ function Un({
1377
1377
  )
1378
1378
  ] }),
1379
1379
  /* @__PURE__ */ n(
1380
- Be,
1380
+ _e,
1381
1381
  {
1382
1382
  label: "Color",
1383
1383
  value: e.color ?? "",
@@ -1385,10 +1385,10 @@ function Un({
1385
1385
  }
1386
1386
  )
1387
1387
  ] }),
1388
- /* @__PURE__ */ d(le, { title: "Layout", defaultOpen: !0, children: [
1388
+ /* @__PURE__ */ d(ue, { title: "Layout", defaultOpen: !0, children: [
1389
1389
  /* @__PURE__ */ d("div", { className: "pa-edit-split-fields", children: [
1390
1390
  /* @__PURE__ */ n(
1391
- re,
1391
+ ie,
1392
1392
  {
1393
1393
  compact: !0,
1394
1394
  property: "width",
@@ -1398,7 +1398,7 @@ function Un({
1398
1398
  }
1399
1399
  ),
1400
1400
  /* @__PURE__ */ n(
1401
- re,
1401
+ ie,
1402
1402
  {
1403
1403
  compact: !0,
1404
1404
  property: "height",
@@ -1409,7 +1409,7 @@ function Un({
1409
1409
  )
1410
1410
  ] }),
1411
1411
  /* @__PURE__ */ n(
1412
- lt,
1412
+ ut,
1413
1413
  {
1414
1414
  property: "padding",
1415
1415
  label: "Padding",
@@ -1418,7 +1418,7 @@ function Un({
1418
1418
  }
1419
1419
  ),
1420
1420
  /* @__PURE__ */ n(
1421
- lt,
1421
+ ut,
1422
1422
  {
1423
1423
  property: "margin",
1424
1424
  label: "Margin",
@@ -1426,20 +1426,20 @@ function Un({
1426
1426
  onChange: (h) => t("margin", h)
1427
1427
  }
1428
1428
  ),
1429
- x && /* @__PURE__ */ d("label", { className: "pa-prop-row pa-prop-row--compact", children: [
1429
+ N && /* @__PURE__ */ d("label", { className: "pa-prop-row pa-prop-row--compact", children: [
1430
1430
  /* @__PURE__ */ n("span", { className: "pa-edit-field-label", children: "Display" }),
1431
1431
  /* @__PURE__ */ n(
1432
1432
  "select",
1433
1433
  {
1434
1434
  className: "pa-select",
1435
- value: E,
1435
+ value: L,
1436
1436
  onChange: (h) => t("display", h.target.value),
1437
- children: N.map((h) => /* @__PURE__ */ n("option", { value: h, children: h }, h))
1437
+ children: k.map((h) => /* @__PURE__ */ n("option", { value: h, children: h }, h))
1438
1438
  }
1439
1439
  )
1440
1440
  ] }),
1441
1441
  w && /* @__PURE__ */ n(
1442
- re,
1442
+ ie,
1443
1443
  {
1444
1444
  compact: !0,
1445
1445
  property: "gap",
@@ -1449,9 +1449,9 @@ function Un({
1449
1449
  }
1450
1450
  )
1451
1451
  ] }),
1452
- /* @__PURE__ */ d(le, { title: "Fill", children: [
1452
+ /* @__PURE__ */ d(ue, { title: "Fill", children: [
1453
1453
  /* @__PURE__ */ n(
1454
- Be,
1454
+ _e,
1455
1455
  {
1456
1456
  label: "Background",
1457
1457
  value: e["background-color"] ?? "",
@@ -1459,7 +1459,7 @@ function Un({
1459
1459
  }
1460
1460
  ),
1461
1461
  /* @__PURE__ */ n(
1462
- re,
1462
+ ie,
1463
1463
  {
1464
1464
  compact: !0,
1465
1465
  property: "opacity",
@@ -1469,9 +1469,9 @@ function Un({
1469
1469
  }
1470
1470
  )
1471
1471
  ] }),
1472
- /* @__PURE__ */ d(le, { title: "Border", defaultOpen: !0, children: [
1472
+ /* @__PURE__ */ d(ue, { title: "Border", defaultOpen: !0, children: [
1473
1473
  /* @__PURE__ */ n(
1474
- Be,
1474
+ _e,
1475
1475
  {
1476
1476
  label: "Border color",
1477
1477
  value: e["border-color"] ?? "",
@@ -1484,14 +1484,14 @@ function Un({
1484
1484
  "select",
1485
1485
  {
1486
1486
  className: "pa-select",
1487
- value: $,
1487
+ value: R,
1488
1488
  onChange: (h) => t("border-style", h.target.value),
1489
- children: k.map((h) => /* @__PURE__ */ n("option", { value: h, children: h }, h))
1489
+ children: x.map((h) => /* @__PURE__ */ n("option", { value: h, children: h }, h))
1490
1490
  }
1491
1491
  )
1492
1492
  ] }),
1493
1493
  /* @__PURE__ */ n(
1494
- re,
1494
+ ie,
1495
1495
  {
1496
1496
  compact: !0,
1497
1497
  property: "border-width",
@@ -1501,7 +1501,7 @@ function Un({
1501
1501
  }
1502
1502
  ),
1503
1503
  /* @__PURE__ */ n(
1504
- re,
1504
+ ie,
1505
1505
  {
1506
1506
  compact: !0,
1507
1507
  property: "border-radius",
@@ -1513,7 +1513,7 @@ function Un({
1513
1513
  ] })
1514
1514
  ] });
1515
1515
  }
1516
- const Wn = 50, ht = [
1516
+ const Kn = 50, gt = [
1517
1517
  "font-family",
1518
1518
  "font-size",
1519
1519
  "font-weight",
@@ -1535,212 +1535,214 @@ const Wn = 50, ht = [
1535
1535
  "border-radius",
1536
1536
  "opacity"
1537
1537
  ];
1538
- function Yn(e, t, i) {
1539
- var te;
1540
- const r = W([]), a = W(/* @__PURE__ */ new Set()), o = W([]), s = W(null), u = W([]), [c, l] = A({}), [p, f] = A({}), [v, g] = A("none"), [m, y] = A(""), [E, x] = A(""), [w, N] = A(() => /* @__PURE__ */ new Map()), [T, P] = A(!1), $ = L(() => {
1538
+ function jn(e, t, i) {
1539
+ var ee;
1540
+ const r = Y([]), a = Y(/* @__PURE__ */ new Set()), s = Y([]), o = Y(null), c = Y([]), [u, l] = S({}), [f, p] = S({}), [v, m] = S("none"), [g, b] = S(""), [L, N] = S(""), [w, k] = S(() => /* @__PURE__ */ new Map()), [$, P] = S(!1), R = E(() => {
1541
1541
  const M = Array.from(a.current);
1542
1542
  return {
1543
- inline: Qe(M, [...ht]),
1544
- text: e && v !== "none" ? Ze(e, v) : null
1543
+ inline: nt(M, [...gt]),
1544
+ text: e && v !== "none" ? tt(e, v) : null
1545
1545
  };
1546
- }, [e, v]), k = L(() => {
1547
- u.current.push($()), u.current.length > Wn && u.current.shift(), P(u.current.length > 0);
1548
- }, [$]), I = L(
1546
+ }, [e, v]), x = E(() => {
1547
+ c.current.push(R()), c.current.length > Kn && c.current.shift(), P(c.current.length > 0);
1548
+ }, [R]), I = E(
1549
1549
  (M) => {
1550
- var R;
1550
+ var T;
1551
1551
  if (!e) return;
1552
- const D = Array.from(a.current);
1553
- ye(o.current.filter((z) => D.includes(z.element))), s.current && Ne(s.current);
1554
- const O = Ee(e, t);
1555
- r.current = O, a.current = new Set(O), ke(D), Fe(O, i);
1556
- const _ = e ? ((R = w.get(e)) == null ? void 0 : R.get(i)) ?? [] : [];
1557
- if (M && _.length > 0)
1558
- for (const z of _)
1559
- if (z.property === "textContent" || z.property === "value")
1560
- for (const X of O)
1561
- et(X, z.property, z.newValue);
1552
+ const F = Array.from(a.current);
1553
+ we(s.current.filter((_) => F.includes(_.element))), o.current && ke(o.current);
1554
+ const D = $e(e, t);
1555
+ r.current = D, a.current = new Set(D), Ce(F), ze(D, i);
1556
+ const z = e ? ((T = w.get(e)) == null ? void 0 : T.get(i)) ?? [] : [];
1557
+ if (M && z.length > 0)
1558
+ for (const _ of z)
1559
+ if (_.property === "textContent" || _.property === "value")
1560
+ for (const X of D)
1561
+ rt(X, _.property, _.newValue);
1562
1562
  else
1563
- for (const X of O)
1564
- X.style.setProperty(z.property, z.newValue);
1563
+ for (const X of D)
1564
+ X.style.setProperty(_.property, _.newValue);
1565
1565
  },
1566
1566
  [e, t, i, w]
1567
1567
  );
1568
1568
  H(() => {
1569
1569
  if (!e) {
1570
- r.current = [], a.current = /* @__PURE__ */ new Set(), o.current = [], s.current = null, u.current = [], l({}), f({}), g("none"), y(""), x(""), N(/* @__PURE__ */ new Map()), P(!1);
1570
+ r.current = [], a.current = /* @__PURE__ */ new Set(), s.current = [], o.current = null, c.current = [], l({}), p({}), m("none"), b(""), N(""), k(/* @__PURE__ */ new Map()), P(!1);
1571
1571
  return;
1572
1572
  }
1573
- const M = Ee(e, t);
1574
- r.current = M, a.current = new Set(M), o.current = Qe(M, [...ht]), u.current = [], P(!1);
1575
- const D = Ce(e);
1576
- l(D), f(D);
1577
- const O = ue(e);
1578
- return g(O.kind), y(O.value), x(O.value), s.current = O.kind !== "none" ? Ze(e, O.kind) : null, Fe(M, i), () => ke(M);
1573
+ const M = $e(e, t);
1574
+ r.current = M, a.current = new Set(M), s.current = nt(M, [...gt]), c.current = [], P(!1);
1575
+ const F = Me(e);
1576
+ l(F), p(F);
1577
+ const D = fe(e);
1578
+ return m(D.kind), b(D.value), N(D.value), o.current = D.kind !== "none" ? tt(e, D.kind) : null, ze(M, i), () => Ce(M);
1579
1579
  }, [e]), H(() => {
1580
1580
  e && I(!0);
1581
1581
  }, [t]), H(() => {
1582
- var O;
1582
+ var D;
1583
1583
  if (!e) return;
1584
- const M = Ee(e, t);
1585
- r.current = M, ye(
1586
- o.current.filter((_) => M.includes(_.element))
1584
+ const M = $e(e, t);
1585
+ r.current = M, we(
1586
+ s.current.filter((z) => M.includes(z.element))
1587
1587
  );
1588
- const D = ((O = w.get(e)) == null ? void 0 : O.get(i)) ?? [];
1589
- for (const _ of D)
1590
- if (!(_.property === "textContent" || _.property === "value"))
1591
- for (const R of M)
1592
- R.style.setProperty(_.property, _.newValue);
1593
- ke(Array.from(a.current)), Fe(M, i), a.current = new Set(M);
1588
+ const F = ((D = w.get(e)) == null ? void 0 : D.get(i)) ?? [];
1589
+ for (const z of F)
1590
+ if (!(z.property === "textContent" || z.property === "value"))
1591
+ for (const T of M)
1592
+ T.style.setProperty(z.property, z.newValue);
1593
+ Ce(Array.from(a.current)), ze(M, i), a.current = new Set(M);
1594
1594
  }, [i, e, t]);
1595
- const C = L(
1596
- (M, D, O) => {
1597
- e && N((_) => {
1598
- const R = new Map(_), z = new Map(R.get(e) ?? /* @__PURE__ */ new Map()), q = (z.get(i) ?? []).filter((fe) => fe.property !== M);
1599
- return O === D ? q.length === 0 ? z.delete(i) : z.set(i, q) : z.set(i, [...q, { property: M, oldValue: D, newValue: O }]), z.size === 0 ? R.delete(e) : R.set(e, z), R;
1595
+ const C = E(
1596
+ (M, F, D) => {
1597
+ e && k((z) => {
1598
+ const T = new Map(z), _ = new Map(T.get(e) ?? /* @__PURE__ */ new Map()), q = (_.get(i) ?? []).filter((Re) => Re.property !== M);
1599
+ return D === F ? q.length === 0 ? _.delete(i) : _.set(i, q) : _.set(i, [...q, { property: M, oldValue: F, newValue: D }]), _.size === 0 ? T.delete(e) : T.set(e, _), T;
1600
1600
  });
1601
1601
  },
1602
1602
  [e, i]
1603
- ), h = L(
1604
- (M, D) => {
1603
+ ), h = E(
1604
+ (M, F) => {
1605
1605
  if (!e) return;
1606
- const O = { [M]: D };
1607
- M === "border-width" && (c["border-style"] ?? "none") === "none" && kn(D) && (O["border-style"] = "solid"), k(), l((_) => ({ ..._, ...O }));
1608
- for (const [_, R] of Object.entries(O)) {
1609
- const z = p[_] ?? "";
1606
+ const D = { [M]: F };
1607
+ M === "border-width" && (u["border-style"] ?? "none") === "none" && Sn(F) && (D["border-style"] = "solid"), x(), l((z) => ({ ...z, ...D }));
1608
+ for (const [z, T] of Object.entries(D)) {
1609
+ const _ = f[z] ?? "";
1610
1610
  for (const X of r.current)
1611
- X.style.setProperty(_, R), a.current.add(X);
1612
- C(_, z, R);
1611
+ X.style.setProperty(z, T), a.current.add(X);
1612
+ C(z, _, T);
1613
1613
  }
1614
1614
  },
1615
- [e, p, c, k, C]
1616
- ), B = L(
1615
+ [e, f, u, x, C]
1616
+ ), O = E(
1617
1617
  (M) => {
1618
1618
  if (!(!e || v === "none")) {
1619
- k(), y(M);
1620
- for (const D of r.current)
1621
- et(D, v, M), a.current.add(D);
1622
- C(v, E, M);
1619
+ x(), b(M);
1620
+ for (const F of r.current)
1621
+ rt(F, v, M), a.current.add(F);
1622
+ C(v, L, M);
1623
1623
  }
1624
1624
  },
1625
- [e, v, E, k, C]
1626
- ), Y = L(() => {
1627
- const M = u.current.pop();
1628
- if (M && (ye(M.inline), M.text && Ne(M.text), P(u.current.length > 0), e)) {
1629
- l(Ce(e));
1630
- const D = ue(e);
1631
- D.kind !== "none" && y(D.value);
1625
+ [e, v, L, x, C]
1626
+ ), U = E(() => {
1627
+ const M = c.current.pop();
1628
+ if (M && (we(M.inline), M.text && ke(M.text), P(c.current.length > 0), e)) {
1629
+ l(Me(e));
1630
+ const F = fe(e);
1631
+ F.kind !== "none" && b(F.value);
1632
1632
  }
1633
- }, [e]), ne = L(() => {
1634
- if (ye(o.current), s.current && Ne(s.current), u.current = [], P(!1), N(/* @__PURE__ */ new Map()), e) {
1635
- l(Ce(e));
1636
- const M = ue(e);
1637
- y(M.value);
1633
+ }, [e]), ge = E(() => {
1634
+ if (we(s.current), o.current && ke(o.current), c.current = [], P(!1), k(/* @__PURE__ */ new Map()), e) {
1635
+ l(Me(e));
1636
+ const M = fe(e);
1637
+ b(M.value);
1638
1638
  }
1639
- }, [e]), Q = L(() => {
1640
- ye(o.current), s.current && Ne(s.current);
1641
- }, []), J = L(() => {
1642
- if (Q(), ke(Array.from(a.current)), u.current = [], P(!1), N(/* @__PURE__ */ new Map()), e) {
1643
- l(Ce(e));
1644
- const M = ue(e);
1645
- M.kind !== "none" && y(M.value);
1639
+ }, [e]), j = E(() => {
1640
+ we(s.current), o.current && ke(o.current);
1641
+ }, []), oe = E(() => {
1642
+ if (j(), Ce(Array.from(a.current)), c.current = [], P(!1), k(/* @__PURE__ */ new Map()), e) {
1643
+ l(Me(e));
1644
+ const M = fe(e);
1645
+ M.kind !== "none" && b(M.value);
1646
1646
  }
1647
- }, [Q, e]), he = e ? ((te = w.get(e)) == null ? void 0 : te.get(i)) ?? [] : [];
1648
- let F = 0;
1647
+ }, [j, e]), re = e ? ((ee = w.get(e)) == null ? void 0 : ee.get(i)) ?? [] : [];
1648
+ let W = 0;
1649
1649
  for (const M of w.values())
1650
- for (const D of M.values()) F += D.length;
1651
- const ee = L(() => {
1652
- N(/* @__PURE__ */ new Map());
1650
+ for (const F of M.values()) W += F.length;
1651
+ const G = E(() => {
1652
+ k(/* @__PURE__ */ new Map());
1653
1653
  }, []);
1654
1654
  return {
1655
- values: c,
1655
+ values: u,
1656
1656
  textKind: v,
1657
- textValue: m,
1658
- pendingChanges: he,
1657
+ textValue: g,
1658
+ pendingChanges: re,
1659
1659
  pendingByElement: w,
1660
- totalPendingCount: F,
1661
- clearAllPending: ee,
1662
- canUndo: T,
1660
+ totalPendingCount: W,
1661
+ clearAllPending: G,
1662
+ canUndo: $,
1663
1663
  updateProperty: h,
1664
- updateText: B,
1665
- undo: Y,
1666
- reset: ne,
1667
- clearPreviews: J,
1668
- revertPreviews: Q
1664
+ updateText: O,
1665
+ undo: U,
1666
+ reset: ge,
1667
+ clearPreviews: oe,
1668
+ revertPreviews: j
1669
1669
  };
1670
1670
  }
1671
- function Xn({
1671
+ function qn({
1672
1672
  selectedElement: e,
1673
1673
  hoveredElement: t,
1674
1674
  onSelectElement: i,
1675
1675
  onHoverElement: r,
1676
1676
  targetScope: a,
1677
- onTargetScopeChange: o,
1678
- elementState: s,
1679
- onElementStateChange: u,
1680
- onApply: c,
1677
+ onTargetScopeChange: s,
1678
+ elementState: o,
1679
+ onElementStateChange: c,
1680
+ onApply: u,
1681
1681
  applyStatus: l,
1682
- isToolbarTarget: p,
1683
- onPreviewApi: f
1682
+ isToolbarTarget: f,
1683
+ onPreviewApi: p
1684
1684
  }) {
1685
1685
  const {
1686
1686
  values: v,
1687
- textKind: g,
1688
- textValue: m,
1689
- pendingChanges: y,
1690
- pendingByElement: E,
1691
- totalPendingCount: x,
1687
+ textKind: m,
1688
+ textValue: g,
1689
+ pendingChanges: b,
1690
+ pendingByElement: L,
1691
+ totalPendingCount: N,
1692
1692
  clearAllPending: w,
1693
- canUndo: N,
1694
- updateProperty: T,
1693
+ canUndo: k,
1694
+ updateProperty: $,
1695
1695
  updateText: P,
1696
- undo: $,
1697
- reset: k,
1696
+ undo: R,
1697
+ reset: x,
1698
1698
  clearPreviews: I,
1699
1699
  revertPreviews: C
1700
- } = Yn(e, a, s), { elementRef: h, isDragging: B, style: Y, dragHandleProps: ne } = Lt({
1701
- computeDefaultPosition: (R) => ({
1702
- x: window.innerWidth - R.width - 16,
1700
+ } = jn(e, a, o), { elementRef: h, isDragging: O, style: U, dragHandleProps: ge } = Rt({
1701
+ computeDefaultPosition: (T) => ({
1702
+ x: window.innerWidth - T.width - 16,
1703
1703
  y: 16
1704
1704
  })
1705
1705
  });
1706
- H(() => (f == null || f({ clearPreviews: I, revertPreviews: C }), () => f == null ? void 0 : f(null)), [f, I, C]);
1707
- const Q = L(
1708
- (R) => {
1709
- if (p(R.target)) return;
1710
- const X = document.elementsFromPoint(R.clientX, R.clientY).find(
1706
+ H(() => (p == null || p({ clearPreviews: I, revertPreviews: C }), () => p == null ? void 0 : p(null)), [p, I, C]);
1707
+ const j = E(
1708
+ (T) => {
1709
+ if (f(T.target)) return;
1710
+ const X = document.elementsFromPoint(T.clientX, T.clientY).find(
1711
1711
  (q) => q instanceof Element && !q.closest(
1712
1712
  "[data-pixelagent-root],[data-pixelagent-toolbar-portal],[data-pixelagent-picker-portal]"
1713
1713
  )
1714
1714
  );
1715
1715
  r(X ?? null);
1716
1716
  },
1717
- [p, r]
1718
- ), J = L(
1719
- (R) => {
1720
- if (p(R.target)) return;
1721
- R.preventDefault(), R.stopPropagation();
1722
- const X = document.elementsFromPoint(R.clientX, R.clientY).find(
1717
+ [f, r]
1718
+ ), oe = E(
1719
+ (T) => {
1720
+ if (f(T.target)) return;
1721
+ T.preventDefault(), T.stopPropagation();
1722
+ const X = document.elementsFromPoint(T.clientX, T.clientY).find(
1723
1723
  (q) => q instanceof Element && !q.closest(
1724
1724
  "[data-pixelagent-root],[data-pixelagent-toolbar-portal],[data-pixelagent-picker-portal]"
1725
1725
  )
1726
1726
  );
1727
1727
  i(X ?? null);
1728
1728
  },
1729
- [p, i]
1729
+ [f, i]
1730
1730
  );
1731
- H(() => (document.addEventListener("mousemove", Q, !0), document.addEventListener("click", J, !0), () => {
1732
- document.removeEventListener("mousemove", Q, !0), document.removeEventListener("click", J, !0);
1733
- }), [Q, J]);
1734
- const he = async () => {
1735
- x === 0 || !await c(E) || (w(), C());
1736
- }, F = e ? We(e) : null, ee = e ? bt(e) : null, te = e ? yt(e) : 0, M = e ? wt(e, "all-instances") : "", D = s !== "normal" && ee === "tailwind" ? "Tailwind variant preview: matching hover:/focus:/… classes are applied without the prefix." : s !== "normal" ? "State preview uses focus/disabled simulation where possible." : null, O = te > 1 ? a === "all-instances" ? `Preview & Apply on ${te} elements (${M}).` : `This instance only — ${te - 1} other on page.` : a === "all-instances" ? "Only one match — scope has no effect." : null, _ = we(() => !e || a !== "all-instances" ? [] : Ee(e, "all-instances"), [e, a]);
1737
- return /* @__PURE__ */ d(G, { children: [
1731
+ H(() => (document.addEventListener("mousemove", j, !0), document.addEventListener("click", oe, !0), () => {
1732
+ document.removeEventListener("mousemove", j, !0), document.removeEventListener("click", oe, !0);
1733
+ }), [j, oe]);
1734
+ const re = async () => {
1735
+ if (N === 0) return;
1736
+ const T = await u(L);
1737
+ T.applied && (w(), T.skipRevert || C());
1738
+ }, W = e ? Ge(e) : null, G = e ? kt(e) : null, ee = e ? Ct(e) : 0, M = e ? Mt(e, "all-instances") : "", F = o !== "normal" && G === "tailwind" ? "Tailwind variant preview: matching hover:/focus:/… classes are applied without the prefix." : o !== "normal" ? "State preview uses focus/disabled simulation where possible." : null, D = ee > 1 ? a === "all-instances" ? `Preview & Apply on ${ee} elements (${M}).` : `This instance only — ${ee - 1} other on page.` : a === "all-instances" ? "Only one match — scope has no effect." : null, z = xe(() => !e || a !== "all-instances" ? [] : $e(e, "all-instances"), [e, a]);
1739
+ return /* @__PURE__ */ d(K, { children: [
1738
1740
  /* @__PURE__ */ n(
1739
- Mt,
1741
+ $t,
1740
1742
  {
1741
1743
  element: a === "all-instances" ? null : t,
1742
1744
  selected: e,
1743
- multiSelected: _,
1745
+ multiSelected: z,
1744
1746
  primarySelected: e
1745
1747
  }
1746
1748
  ),
@@ -1748,8 +1750,8 @@ function Xn({
1748
1750
  "div",
1749
1751
  {
1750
1752
  ref: h,
1751
- className: `pa-edit-panel-float ${B ? "pa-edit-panel-float--dragging" : ""}`,
1752
- style: Y,
1753
+ className: `pa-edit-panel-float ${O ? "pa-edit-panel-float--dragging" : ""}`,
1754
+ style: U,
1753
1755
  children: /* @__PURE__ */ n(Te, { variant: "sheet", side: "right", className: "pa-edit-panel-glass", children: /* @__PURE__ */ d("div", { className: "pa-edit-panel-inner", children: [
1754
1756
  /* @__PURE__ */ d("div", { className: "pa-edit-panel-header", children: [
1755
1757
  /* @__PURE__ */ n(
@@ -1759,7 +1761,7 @@ function Xn({
1759
1761
  className: "pa-edit-panel-drag",
1760
1762
  "aria-label": "Drag edit panel",
1761
1763
  title: "Drag to move",
1762
- ...ne,
1764
+ ...ge,
1763
1765
  children: /* @__PURE__ */ d("span", { className: "pa-edit-panel-grip", "aria-hidden": "true", children: [
1764
1766
  /* @__PURE__ */ n("span", {}),
1765
1767
  /* @__PURE__ */ n("span", {}),
@@ -1772,57 +1774,57 @@ function Xn({
1772
1774
  ),
1773
1775
  /* @__PURE__ */ n("h3", { className: "pa-edit-title", children: "Edit" })
1774
1776
  ] }),
1775
- e ? /* @__PURE__ */ d(G, { children: [
1777
+ e ? /* @__PURE__ */ d(K, { children: [
1776
1778
  /* @__PURE__ */ d("div", { className: "pa-edit-meta", children: [
1777
1779
  /* @__PURE__ */ n(
1778
1780
  "code",
1779
1781
  {
1780
1782
  className: "pa-edit-meta-label",
1781
- title: `This instance: ${xt(e)}
1783
+ title: `This instance: ${At(e)}
1782
1784
  All instances: ${M}`,
1783
- children: Ue(e)
1785
+ children: Xe(e)
1784
1786
  }
1785
1787
  ),
1786
- ((F == null ? void 0 : F.sourceFile) || ee) && /* @__PURE__ */ d("span", { className: "pa-edit-source", children: [
1787
- (F == null ? void 0 : F.sourceFile) && /* @__PURE__ */ d(G, { children: [
1788
- F.sourceFile,
1789
- F.lineNumber ? `:${F.lineNumber}` : ""
1788
+ ((W == null ? void 0 : W.sourceFile) || G) && /* @__PURE__ */ d("span", { className: "pa-edit-source", children: [
1789
+ (W == null ? void 0 : W.sourceFile) && /* @__PURE__ */ d(K, { children: [
1790
+ W.sourceFile,
1791
+ W.lineNumber ? `:${W.lineNumber}` : ""
1790
1792
  ] }),
1791
- F != null && F.sourceFile && ee ? " · " : "",
1792
- ee ?? ""
1793
+ W != null && W.sourceFile && G ? " · " : "",
1794
+ G ?? ""
1793
1795
  ] })
1794
1796
  ] }),
1795
1797
  /* @__PURE__ */ n("div", { className: "pa-edit-panel-scroll", children: /* @__PURE__ */ n(
1796
- Un,
1798
+ Gn,
1797
1799
  {
1798
1800
  values: v,
1799
- onPropertyChange: T,
1800
- textKind: g,
1801
- textValue: m,
1801
+ onPropertyChange: $,
1802
+ textKind: m,
1803
+ textValue: g,
1802
1804
  onTextChange: P,
1803
1805
  targetScope: a,
1804
- onTargetScopeChange: o,
1805
- elementState: s,
1806
- onElementStateChange: u,
1807
- instanceCount: te,
1808
- scopeHint: O,
1809
- stateHint: D
1806
+ onTargetScopeChange: s,
1807
+ elementState: o,
1808
+ onElementStateChange: c,
1809
+ instanceCount: ee,
1810
+ scopeHint: D,
1811
+ stateHint: F
1810
1812
  }
1811
1813
  ) }),
1812
1814
  /* @__PURE__ */ d("div", { className: "pa-edit-panel-sticky", children: [
1813
1815
  /* @__PURE__ */ d("div", { className: "pa-edit-actions", children: [
1814
- /* @__PURE__ */ n(V, { variant: "regular", onClick: $, disabled: !N, children: /* @__PURE__ */ d("span", { className: "pa-glass-btn-inner", children: [
1815
- /* @__PURE__ */ n(un, { className: "pa-glass-btn-icon" }),
1816
+ /* @__PURE__ */ n(V, { variant: "regular", onClick: R, disabled: !k, children: /* @__PURE__ */ d("span", { className: "pa-glass-btn-inner", children: [
1817
+ /* @__PURE__ */ n(mn, { className: "pa-glass-btn-icon" }),
1816
1818
  /* @__PURE__ */ n("span", { children: "Undo" })
1817
1819
  ] }) }),
1818
1820
  /* @__PURE__ */ n(
1819
1821
  V,
1820
1822
  {
1821
1823
  variant: "regular",
1822
- onClick: k,
1823
- disabled: y.length === 0,
1824
+ onClick: x,
1825
+ disabled: b.length === 0,
1824
1826
  children: /* @__PURE__ */ d("span", { className: "pa-glass-btn-inner", children: [
1825
- /* @__PURE__ */ n(pn, { className: "pa-glass-btn-icon" }),
1827
+ /* @__PURE__ */ n(gn, { className: "pa-glass-btn-icon" }),
1826
1828
  /* @__PURE__ */ n("span", { children: "Reset" })
1827
1829
  ] })
1828
1830
  }
@@ -1833,16 +1835,16 @@ All instances: ${M}`,
1833
1835
  "span",
1834
1836
  {
1835
1837
  className: l ? /fail/i.test(l) ? "pa-change-count pa-change-count--error" : "pa-change-count pa-change-count--success" : "pa-change-count",
1836
- children: l ?? `${x} pending change${x !== 1 ? "s" : ""}`
1838
+ children: l ?? `${N} pending change${N !== 1 ? "s" : ""}`
1837
1839
  }
1838
1840
  ),
1839
1841
  /* @__PURE__ */ n(
1840
1842
  V,
1841
1843
  {
1842
1844
  variant: "glass-primary",
1843
- onClick: he,
1844
- disabled: x === 0,
1845
- title: F != null && F.sourceFile ? void 0 : "No source file — Apply copies selector + changes to clipboard",
1845
+ onClick: re,
1846
+ disabled: N === 0,
1847
+ title: W != null && W.sourceFile ? void 0 : "No source file — Apply copies selector + changes to clipboard",
1846
1848
  children: "Apply"
1847
1849
  }
1848
1850
  )
@@ -1854,7 +1856,7 @@ All instances: ${M}`,
1854
1856
  )
1855
1857
  ] });
1856
1858
  }
1857
- async function Gn(e, t = {}) {
1859
+ async function Jn(e, t = {}) {
1858
1860
  if (t.onApply)
1859
1861
  try {
1860
1862
  const r = await t.onApply(e);
@@ -1874,10 +1876,10 @@ async function Gn(e, t = {}) {
1874
1876
  } catch (r) {
1875
1877
  return { mode: "error", message: r instanceof Error ? r.message : String(r) };
1876
1878
  }
1877
- return await Nt(JSON.stringify(e, null, 2)), { mode: "clipboard" };
1879
+ return await St(JSON.stringify(e, null, 2)), { mode: "clipboard" };
1878
1880
  }
1879
- function Kn(e) {
1880
- const [t, i] = A(null);
1881
+ function Zn(e) {
1882
+ const [t, i] = S(null);
1881
1883
  return H(() => {
1882
1884
  if (!e) {
1883
1885
  i(null);
@@ -1891,8 +1893,8 @@ function Kn(e) {
1891
1893
  };
1892
1894
  }, [e]), t;
1893
1895
  }
1894
- const ie = 8, j = 8, jn = 12, qn = 300, Jn = 280;
1895
- function ze(e, t, i, r) {
1896
+ const ae = 8, Q = 8, Qn = 12, er = 300, tr = 280;
1897
+ function He(e, t, i, r) {
1896
1898
  return {
1897
1899
  top: e,
1898
1900
  left: t,
@@ -1902,10 +1904,10 @@ function ze(e, t, i, r) {
1902
1904
  height: r
1903
1905
  };
1904
1906
  }
1905
- function Ve(e, t) {
1907
+ function Ye(e, t) {
1906
1908
  return e.left < t.right && e.right > t.left && e.top < t.bottom && e.bottom > t.top;
1907
1909
  }
1908
- function Zn(e, t) {
1910
+ function nr(e, t) {
1909
1911
  return {
1910
1912
  top: e.top - t,
1911
1913
  left: e.left - t,
@@ -1915,105 +1917,105 @@ function Zn(e, t) {
1915
1917
  height: e.height + t * 2
1916
1918
  };
1917
1919
  }
1918
- function Qn() {
1920
+ function rr() {
1919
1921
  if (typeof document > "u") return null;
1920
1922
  const e = document.querySelector(
1921
1923
  "[data-pixelagent-toolbar-portal] .pa-toolbar-float"
1922
1924
  );
1923
- return e ? Zn(e.getBoundingClientRect(), jn) : null;
1925
+ return e ? nr(e.getBoundingClientRect(), Qn) : null;
1924
1926
  }
1925
- function He(e, t) {
1927
+ function Ve(e, t) {
1926
1928
  return Math.min(
1927
- Math.max(ie, e),
1928
- window.innerWidth - t - ie
1929
+ Math.max(ae, e),
1930
+ window.innerWidth - t - ae
1929
1931
  );
1930
1932
  }
1931
- function Se(e, t) {
1933
+ function Le(e, t) {
1932
1934
  return Math.min(
1933
- Math.max(ie, e),
1934
- window.innerHeight - t - ie
1935
+ Math.max(ae, e),
1936
+ window.innerHeight - t - ae
1935
1937
  );
1936
1938
  }
1937
- function er(e) {
1938
- return e.top >= ie && e.left >= ie && e.right <= window.innerWidth - ie && e.bottom <= window.innerHeight - ie;
1939
+ function ir(e) {
1940
+ return e.top >= ae && e.left >= ae && e.right <= window.innerWidth - ae && e.bottom <= window.innerHeight - ae;
1939
1941
  }
1940
- function tr(e, t) {
1941
- return t && Ve(e, t) ? !1 : er(e);
1942
+ function ar(e, t) {
1943
+ return t && Ye(e, t) ? !1 : ir(e);
1942
1944
  }
1943
- function nr(e, t = qn, i = Jn) {
1944
- const r = Qn(), o = e.top > window.innerHeight * 0.45 ? [
1945
- { placement: "above", top: e.top - i - j, left: e.left },
1946
- { placement: "below", top: e.bottom + j, left: e.left },
1947
- { placement: "right", top: e.top, left: e.right + j },
1948
- { placement: "left", top: e.top, left: e.left - t - j }
1945
+ function or(e, t = er, i = tr) {
1946
+ const r = rr(), s = e.top > window.innerHeight * 0.45 ? [
1947
+ { placement: "above", top: e.top - i - Q, left: e.left },
1948
+ { placement: "below", top: e.bottom + Q, left: e.left },
1949
+ { placement: "right", top: e.top, left: e.right + Q },
1950
+ { placement: "left", top: e.top, left: e.left - t - Q }
1949
1951
  ] : [
1950
- { placement: "below", top: e.bottom + j, left: e.left },
1951
- { placement: "above", top: e.top - i - j, left: e.left },
1952
- { placement: "right", top: e.top, left: e.right + j },
1953
- { placement: "left", top: e.top, left: e.left - t - j }
1952
+ { placement: "below", top: e.bottom + Q, left: e.left },
1953
+ { placement: "above", top: e.top - i - Q, left: e.left },
1954
+ { placement: "right", top: e.top, left: e.right + Q },
1955
+ { placement: "left", top: e.top, left: e.left - t - Q }
1954
1956
  ];
1955
- for (const { top: c, left: l } of o) {
1956
- const p = ze(
1957
- Se(c, i),
1958
- He(l, t),
1957
+ for (const { top: u, left: l } of s) {
1958
+ const f = He(
1959
+ Le(u, i),
1960
+ Ve(l, t),
1959
1961
  t,
1960
1962
  i
1961
1963
  );
1962
- if (tr(p, r))
1963
- return { top: p.top, left: p.left };
1964
+ if (ar(f, r))
1965
+ return { top: f.top, left: f.left };
1964
1966
  }
1965
- let s = Se(e.top - i - j, i), u = He(e.left, t);
1967
+ let o = Le(e.top - i - Q, i), c = Ve(e.left, t);
1966
1968
  if (r) {
1967
- let c = ze(s, u, t, i);
1968
- Ve(c, r) && (s = Se(r.top - i - j, i), c = ze(s, u, t, i)), Ve(c, r) && (s = Se(e.bottom + j, i), u = He(
1969
- Math.min(e.left, r.left - t - j),
1969
+ let u = He(o, c, t, i);
1970
+ Ye(u, r) && (o = Le(r.top - i - Q, i), u = He(o, c, t, i)), Ye(u, r) && (o = Le(e.bottom + Q, i), c = Ve(
1971
+ Math.min(e.left, r.left - t - Q),
1970
1972
  t
1971
1973
  ));
1972
1974
  }
1973
- return { top: s, left: u };
1975
+ return { top: o, left: c };
1974
1976
  }
1975
- function rr({
1977
+ function sr({
1976
1978
  elements: e,
1977
1979
  areaBbox: t,
1978
1980
  onSubmit: i,
1979
1981
  onCancel: r
1980
1982
  }) {
1981
- const [a, o] = A(""), s = W(null), u = W(null), c = e[0] ?? null, l = t ? new DOMRect(t.x, t.y, t.width, t.height) : null, p = Kn(c), f = l ?? p, v = kt(), g = c ? ue(c) : { kind: "none", value: "" }, m = g.kind !== "none" ? g.value : void 0;
1983
+ const [a, s] = S(""), o = Y(null), c = Y(null), u = e[0] ?? null, l = t ? new DOMRect(t.x, t.y, t.width, t.height) : null, f = Zn(u), p = l ?? f, v = Lt(), m = u ? fe(u) : { kind: "none", value: "" }, g = m.kind !== "none" ? m.value : void 0;
1982
1984
  if (H(() => {
1983
1985
  var w;
1984
- (w = s.current) == null || w.focus();
1986
+ (w = o.current) == null || w.focus();
1985
1987
  }, [e]), H(() => {
1986
- const w = (N) => {
1987
- N.key === "Escape" && r();
1988
+ const w = (k) => {
1989
+ k.key === "Escape" && r();
1988
1990
  };
1989
1991
  return document.addEventListener("keydown", w), () => document.removeEventListener("keydown", w);
1990
- }, [r]), !f) return null;
1991
- const y = nr(f), E = e.length > 1 ? `${e.length} selected` : c ? Ue(c) : "Area selection", x = (w) => {
1992
+ }, [r]), !p) return null;
1993
+ const b = or(p), L = e.length > 1 ? `${e.length} selected` : u ? Xe(u) : "Area selection", N = (w) => {
1992
1994
  a.trim() && i(a, w);
1993
1995
  };
1994
1996
  return /* @__PURE__ */ n(
1995
1997
  Te,
1996
1998
  {
1997
1999
  variant: "popover",
1998
- style: { top: y.top, left: y.left },
2000
+ style: { top: b.top, left: b.left },
1999
2001
  children: /* @__PURE__ */ d(
2000
2002
  "div",
2001
2003
  {
2002
- ref: u,
2004
+ ref: c,
2003
2005
  role: "dialog",
2004
2006
  "aria-modal": "true",
2005
2007
  "aria-label": "Add annotation",
2006
2008
  className: "pa-popover-body",
2007
2009
  children: [
2008
- /* @__PURE__ */ n("div", { className: "pa-popover-header", children: /* @__PURE__ */ n("span", { className: "pa-popover-selector", children: E }) }),
2009
- (v || m) && /* @__PURE__ */ d("div", { className: "pa-popover-context", children: [
2010
+ /* @__PURE__ */ n("div", { className: "pa-popover-header", children: /* @__PURE__ */ n("span", { className: "pa-popover-selector", children: L }) }),
2011
+ (v || g) && /* @__PURE__ */ d("div", { className: "pa-popover-context", children: [
2010
2012
  v && /* @__PURE__ */ d("p", { className: "pa-popover-context-line", children: [
2011
2013
  /* @__PURE__ */ n("span", { className: "pa-popover-context-label", children: "Selected" }),
2012
2014
  v
2013
2015
  ] }),
2014
- m && m !== v && /* @__PURE__ */ d("p", { className: "pa-popover-context-line", children: [
2016
+ g && g !== v && /* @__PURE__ */ d("p", { className: "pa-popover-context-line", children: [
2015
2017
  /* @__PURE__ */ n("span", { className: "pa-popover-context-label", children: "Element" }),
2016
- m
2018
+ g
2017
2019
  ] })
2018
2020
  ] }),
2019
2021
  /* @__PURE__ */ d("label", { className: "pa-label", children: [
@@ -2021,14 +2023,14 @@ function rr({
2021
2023
  /* @__PURE__ */ n(
2022
2024
  "textarea",
2023
2025
  {
2024
- ref: s,
2026
+ ref: o,
2025
2027
  className: "pa-textarea",
2026
2028
  value: a,
2027
- onChange: (w) => o(w.target.value),
2029
+ onChange: (w) => s(w.target.value),
2028
2030
  placeholder: "Describe the change...",
2029
2031
  rows: 3,
2030
2032
  onKeyDown: (w) => {
2031
- w.key === "Enter" && (w.metaKey || w.ctrlKey) && (w.preventDefault(), x(w.shiftKey)), w.key === "Escape" && r();
2033
+ w.key === "Enter" && (w.metaKey || w.ctrlKey) && (w.preventDefault(), N(w.shiftKey)), w.key === "Escape" && r();
2032
2034
  }
2033
2035
  }
2034
2036
  )
@@ -2040,7 +2042,7 @@ function rr({
2040
2042
  V,
2041
2043
  {
2042
2044
  variant: "ghost",
2043
- onClick: () => x(!0),
2045
+ onClick: () => N(!0),
2044
2046
  disabled: !a.trim(),
2045
2047
  children: "Add & next"
2046
2048
  }
@@ -2049,7 +2051,7 @@ function rr({
2049
2051
  V,
2050
2052
  {
2051
2053
  variant: "glass-primary",
2052
- onClick: () => x(!1),
2054
+ onClick: () => N(!1),
2053
2055
  disabled: !a.trim(),
2054
2056
  children: "Add"
2055
2057
  }
@@ -2061,7 +2063,7 @@ function rr({
2061
2063
  }
2062
2064
  );
2063
2065
  }
2064
- function ir({ area: e, isDragging: t }) {
2066
+ function lr({ area: e, isDragging: t }) {
2065
2067
  return !e || e.width < 2 || e.height < 2 ? null : /* @__PURE__ */ n(
2066
2068
  "div",
2067
2069
  {
@@ -2076,7 +2078,7 @@ function ir({ area: e, isDragging: t }) {
2076
2078
  }
2077
2079
  );
2078
2080
  }
2079
- function ar(e) {
2081
+ function cr(e) {
2080
2082
  const { elements: t, note: i, areaBbox: r } = e, a = t[0];
2081
2083
  if (!a && r)
2082
2084
  return {
@@ -2095,39 +2097,39 @@ function ar(e) {
2095
2097
  };
2096
2098
  if (!a)
2097
2099
  throw new Error("buildAnnotationEntry requires at least one element or areaBbox");
2098
- const o = a.getBoundingClientRect(), s = We(a), u = kt(), c = ue(a), l = c.kind !== "none" ? c.value : void 0, p = t.map((f) => xt(f));
2100
+ const s = a.getBoundingClientRect(), o = Ge(a), c = Lt(), u = fe(a), l = u.kind !== "none" ? u.value : void 0, f = t.map((p) => At(p));
2099
2101
  return {
2100
2102
  id: crypto.randomUUID(),
2101
- selector: p[0],
2102
- selectors: p.length > 1 ? p : void 0,
2103
+ selector: f[0],
2104
+ selectors: f.length > 1 ? f : void 0,
2103
2105
  note: i.trim(),
2104
- position: { x: Math.round(o.x), y: Math.round(o.y) },
2106
+ position: { x: Math.round(s.x), y: Math.round(s.y) },
2105
2107
  bbox: {
2106
- x: Math.round(o.x),
2107
- y: Math.round(o.y),
2108
- width: Math.round(o.width),
2109
- height: Math.round(o.height)
2108
+ x: Math.round(s.x),
2109
+ y: Math.round(s.y),
2110
+ width: Math.round(s.width),
2111
+ height: Math.round(s.height)
2110
2112
  },
2111
2113
  areaBbox: r,
2112
- domPath: Gt(a),
2113
- selectedText: u,
2114
+ domPath: Jt(a),
2115
+ selectedText: c,
2114
2116
  elementText: l,
2115
- sourceFile: s.sourceFile,
2116
- lineNumber: s.lineNumber,
2117
- componentName: Xt(a) ?? s.componentName,
2117
+ sourceFile: o.sourceFile,
2118
+ lineNumber: o.lineNumber,
2119
+ componentName: qt(a) ?? o.componentName,
2118
2120
  createdAt: Date.now()
2119
2121
  };
2120
2122
  }
2121
- function or(e) {
2122
- const t = Ct(e);
2123
+ function dr(e) {
2124
+ const t = Et(e);
2123
2125
  if (t) return t.getBoundingClientRect();
2124
2126
  if (e.bbox) {
2125
- const { x: i, y: r, width: a, height: o } = e.bbox;
2126
- return new DOMRect(i, r, a, o);
2127
+ const { x: i, y: r, width: a, height: s } = e.bbox;
2128
+ return new DOMRect(i, r, a, s);
2127
2129
  }
2128
2130
  if (e.areaBbox) {
2129
- const { x: i, y: r, width: a, height: o } = e.areaBbox;
2130
- return new DOMRect(i, r, a, o);
2131
+ const { x: i, y: r, width: a, height: s } = e.areaBbox;
2132
+ return new DOMRect(i, r, a, s);
2131
2133
  }
2132
2134
  if (e.position) {
2133
2135
  const { x: i, y: r } = e.position;
@@ -2135,46 +2137,46 @@ function or(e) {
2135
2137
  }
2136
2138
  return null;
2137
2139
  }
2138
- function sr(e) {
2140
+ function ur(e) {
2139
2141
  return `${Math.round(e.top)}:${Math.round(e.left)}:${Math.round(e.width)}:${Math.round(e.height)}`;
2140
2142
  }
2141
- const lr = 20;
2142
- function cr({ annotations: e }) {
2143
- const [t, i] = A([]);
2143
+ const pr = 20;
2144
+ function hr({ annotations: e }) {
2145
+ const [t, i] = S([]);
2144
2146
  return H(() => {
2145
2147
  if (e.length === 0) {
2146
2148
  i([]);
2147
2149
  return;
2148
2150
  }
2149
2151
  const r = /* @__PURE__ */ new Map(), a = () => {
2150
- const u = [];
2151
- e.forEach((c, l) => {
2152
- const p = or(c);
2153
- if (!p) return;
2154
- const f = sr(p), v = r.get(f) ?? 0;
2155
- r.set(f, v + 1), u.push({
2156
- id: c.id,
2152
+ const c = [];
2153
+ e.forEach((u, l) => {
2154
+ const f = dr(u);
2155
+ if (!f) return;
2156
+ const p = ur(f), v = r.get(p) ?? 0;
2157
+ r.set(p, v + 1), c.push({
2158
+ id: u.id,
2157
2159
  index: l + 1,
2158
- top: p.top - 6 - v * lr,
2159
- left: p.right - 6
2160
+ top: f.top - 6 - v * pr,
2161
+ left: f.right - 6
2160
2162
  });
2161
- }), i(u);
2163
+ }), i(c);
2162
2164
  };
2163
2165
  a();
2164
- const o = /* @__PURE__ */ new Set();
2165
- for (const u of e) {
2166
- const c = Ct(u);
2167
- c && o.add(c);
2166
+ const s = /* @__PURE__ */ new Set();
2167
+ for (const c of e) {
2168
+ const u = Et(c);
2169
+ u && s.add(u);
2168
2170
  }
2169
- const s = Array.from(o).map((u) => {
2170
- const c = new ResizeObserver(a);
2171
- return c.observe(u), c;
2171
+ const o = Array.from(s).map((c) => {
2172
+ const u = new ResizeObserver(a);
2173
+ return u.observe(c), u;
2172
2174
  });
2173
2175
  return window.addEventListener("scroll", a, !0), window.addEventListener("resize", a), () => {
2174
- for (const u of s) u.disconnect();
2176
+ for (const c of o) c.disconnect();
2175
2177
  window.removeEventListener("scroll", a, !0), window.removeEventListener("resize", a);
2176
2178
  };
2177
- }, [e]), t.length === 0 ? null : /* @__PURE__ */ n(G, { children: t.map((r) => /* @__PURE__ */ n(
2179
+ }, [e]), t.length === 0 ? null : /* @__PURE__ */ n(K, { children: t.map((r) => /* @__PURE__ */ n(
2178
2180
  "span",
2179
2181
  {
2180
2182
  className: "pa-annotation-badge",
@@ -2185,24 +2187,24 @@ function cr({ annotations: e }) {
2185
2187
  r.id
2186
2188
  )) });
2187
2189
  }
2188
- const je = "[data-pixelagent-root],[data-pixelagent-toolbar-portal],[data-pixelagent-picker-portal]";
2189
- function Le(e) {
2190
- return e instanceof Element ? !!e.closest(je) : !1;
2190
+ const Ze = "[data-pixelagent-root],[data-pixelagent-toolbar-portal],[data-pixelagent-picker-portal]";
2191
+ function Ee(e) {
2192
+ return e instanceof Element ? !!e.closest(Ze) : !1;
2191
2193
  }
2192
- function ft(e, t) {
2194
+ function vt(e, t) {
2193
2195
  return document.elementsFromPoint(e, t).find(
2194
- (r) => r instanceof Element && !r.closest(je)
2196
+ (r) => r instanceof Element && !r.closest(Ze)
2195
2197
  ) ?? null;
2196
2198
  }
2197
- function Dt(e) {
2199
+ function _t(e) {
2198
2200
  return e ? e === "Copied all!" || e.startsWith("Copy failed") : !1;
2199
2201
  }
2200
- function Ot({
2202
+ function Ht({
2201
2203
  feedback: e,
2202
2204
  slotClassName: t,
2203
2205
  children: i
2204
2206
  }) {
2205
- return e && Dt(e) ? /* @__PURE__ */ n(
2207
+ return e && _t(e) ? /* @__PURE__ */ n(
2206
2208
  "span",
2207
2209
  {
2208
2210
  className: `pa-status pa-copy-feedback-slot ${t}`,
@@ -2210,32 +2212,32 @@ function Ot({
2210
2212
  "aria-live": "polite",
2211
2213
  children: e
2212
2214
  }
2213
- ) : /* @__PURE__ */ n(G, { children: i });
2215
+ ) : /* @__PURE__ */ n(K, { children: i });
2214
2216
  }
2215
- function dr({
2217
+ function fr({
2216
2218
  annotations: e,
2217
2219
  collapsed: t,
2218
2220
  onToggleCollapsed: i,
2219
2221
  onClose: r,
2220
2222
  onCopyAll: a,
2221
- onCopyOne: o,
2222
- onRemove: s,
2223
- onUpdate: u,
2224
- copyStatus: c,
2223
+ onCopyOne: s,
2224
+ onRemove: o,
2225
+ onUpdate: c,
2226
+ copyStatus: u,
2225
2227
  copiedEntryId: l,
2226
- copyAllFrom: p
2228
+ copyAllFrom: f
2227
2229
  }) {
2228
- const [f, v] = A(null), [g, m] = A("");
2230
+ const [p, v] = S(null), [m, g] = S("");
2229
2231
  H(() => {
2230
- const x = (w) => {
2232
+ const N = (w) => {
2231
2233
  w.key === "Escape" && (t ? r() : i());
2232
2234
  };
2233
- return document.addEventListener("keydown", x), () => document.removeEventListener("keydown", x);
2235
+ return document.addEventListener("keydown", N), () => document.removeEventListener("keydown", N);
2234
2236
  }, [t, r, i]);
2235
- const y = (x) => {
2236
- v(x.id), m(x.note);
2237
- }, E = (x) => {
2238
- g.trim() && (u(x, { note: g.trim() }), v(null));
2237
+ const b = (N) => {
2238
+ v(N.id), g(N.note);
2239
+ }, L = (N) => {
2240
+ m.trim() && (c(N, { note: m.trim() }), v(null));
2239
2241
  };
2240
2242
  return /* @__PURE__ */ d(
2241
2243
  Te,
@@ -2266,9 +2268,9 @@ function dr({
2266
2268
  !t && /* @__PURE__ */ n("p", { className: "pa-session-subtitle", children: "Persists until tab close" }),
2267
2269
  /* @__PURE__ */ d("div", { className: "pa-session-actions", children: [
2268
2270
  /* @__PURE__ */ n(
2269
- Ot,
2271
+ Ht,
2270
2272
  {
2271
- feedback: p === "session" ? c : null,
2273
+ feedback: f === "session" ? u : null,
2272
2274
  slotClassName: "pa-copy-feedback-slot--session",
2273
2275
  children: /* @__PURE__ */ n(
2274
2276
  V,
@@ -2287,17 +2289,17 @@ function dr({
2287
2289
  ] }),
2288
2290
  !t && /* @__PURE__ */ d("ul", { className: "pa-session-list", children: [
2289
2291
  e.length === 0 && /* @__PURE__ */ n("li", { className: "pa-session-empty", children: "No annotations yet. Click an element, drag an area, or Shift+click for multi-select." }),
2290
- e.map((x) => {
2291
- const w = Kt(x);
2292
- return /* @__PURE__ */ n("li", { className: "pa-session-item", children: f === x.id ? /* @__PURE__ */ d("div", { className: "pa-session-edit", children: [
2292
+ e.map((N) => {
2293
+ const w = Zt(N);
2294
+ return /* @__PURE__ */ n("li", { className: "pa-session-item", children: p === N.id ? /* @__PURE__ */ d("div", { className: "pa-session-edit", children: [
2293
2295
  /* @__PURE__ */ d("label", { className: "pa-label", children: [
2294
2296
  "Note",
2295
2297
  /* @__PURE__ */ n(
2296
2298
  "textarea",
2297
2299
  {
2298
2300
  className: "pa-textarea",
2299
- value: g,
2300
- onChange: (N) => m(N.target.value),
2301
+ value: m,
2302
+ onChange: (k) => g(k.target.value),
2301
2303
  rows: 3
2302
2304
  }
2303
2305
  )
@@ -2308,20 +2310,20 @@ function dr({
2308
2310
  V,
2309
2311
  {
2310
2312
  variant: "glass-primary",
2311
- onClick: () => E(x.id),
2312
- disabled: !g.trim(),
2313
+ onClick: () => L(N.id),
2314
+ disabled: !m.trim(),
2313
2315
  children: "Save"
2314
2316
  }
2315
2317
  )
2316
2318
  ] })
2317
- ] }) : /* @__PURE__ */ d(G, { children: [
2319
+ ] }) : /* @__PURE__ */ d(K, { children: [
2318
2320
  /* @__PURE__ */ d("div", { className: "pa-session-content", children: [
2319
2321
  /* @__PURE__ */ n("span", { className: "pa-session-target", children: w.target }),
2320
2322
  /* @__PURE__ */ n("p", { className: "pa-session-note", children: w.note }),
2321
2323
  w.meta && /* @__PURE__ */ n("p", { className: "pa-session-meta-line", children: w.meta })
2322
2324
  ] }),
2323
2325
  /* @__PURE__ */ d("div", { className: "pa-session-item-actions", children: [
2324
- c === "Copied!" && l === x.id ? /* @__PURE__ */ n(
2326
+ u === "Copied!" && l === N.id ? /* @__PURE__ */ n(
2325
2327
  "span",
2326
2328
  {
2327
2329
  className: "pa-status pa-copy-feedback-slot pa-copy-feedback-slot--item",
@@ -2334,7 +2336,7 @@ function dr({
2334
2336
  {
2335
2337
  variant: "glass-primary",
2336
2338
  className: "pa-glass-btn--sm",
2337
- onClick: () => o(x.id),
2339
+ onClick: () => s(N.id),
2338
2340
  "aria-label": "Copy annotation",
2339
2341
  children: "Copy"
2340
2342
  }
@@ -2344,7 +2346,7 @@ function dr({
2344
2346
  {
2345
2347
  variant: "ghost",
2346
2348
  className: "pa-glass-btn--sm",
2347
- onClick: () => y(x),
2349
+ onClick: () => b(N),
2348
2350
  "aria-label": "Edit annotation note",
2349
2351
  children: "✎"
2350
2352
  }
@@ -2354,20 +2356,20 @@ function dr({
2354
2356
  {
2355
2357
  variant: "ghost",
2356
2358
  className: "pa-glass-btn--sm",
2357
- onClick: () => s(x.id),
2359
+ onClick: () => o(N.id),
2358
2360
  "aria-label": "Remove annotation",
2359
2361
  children: "✕"
2360
2362
  }
2361
2363
  )
2362
2364
  ] })
2363
- ] }) }, x.id);
2365
+ ] }) }, N.id);
2364
2366
  })
2365
2367
  ] })
2366
2368
  ]
2367
2369
  }
2368
2370
  );
2369
2371
  }
2370
- function ur() {
2372
+ function mr() {
2371
2373
  return /* @__PURE__ */ d("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
2372
2374
  /* @__PURE__ */ n(
2373
2375
  "path",
@@ -2388,7 +2390,7 @@ function ur() {
2388
2390
  )
2389
2391
  ] });
2390
2392
  }
2391
- function pr() {
2393
+ function gr() {
2392
2394
  return /* @__PURE__ */ d("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
2393
2395
  /* @__PURE__ */ n("circle", { cx: "8", cy: "8", r: "2.75", stroke: "currentColor", strokeWidth: "1.25" }),
2394
2396
  /* @__PURE__ */ n(
@@ -2402,7 +2404,7 @@ function pr() {
2402
2404
  )
2403
2405
  ] });
2404
2406
  }
2405
- function hr() {
2407
+ function vr() {
2406
2408
  return /* @__PURE__ */ n("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ n(
2407
2409
  "path",
2408
2410
  {
@@ -2413,27 +2415,27 @@ function hr() {
2413
2415
  }
2414
2416
  ) });
2415
2417
  }
2416
- function fr({
2418
+ function br({
2417
2419
  open: e,
2418
2420
  onClose: t,
2419
2421
  hostTheme: i,
2420
2422
  chrome: r,
2421
2423
  onToggleHostTheme: a
2422
2424
  }) {
2423
- const o = W(null);
2425
+ const s = Y(null);
2424
2426
  return H(() => {
2425
2427
  if (!e) return;
2426
- const s = (c) => {
2427
- c.key === "Escape" && t();
2428
- }, u = (c) => {
2429
- var p, f;
2430
- const l = c.target;
2431
- (p = o.current) != null && p.contains(l) || (f = l.closest) != null && f.call(l, "[data-pa-settings-trigger]") || t();
2428
+ const o = (u) => {
2429
+ u.key === "Escape" && t();
2430
+ }, c = (u) => {
2431
+ var f, p;
2432
+ const l = u.target;
2433
+ (f = s.current) != null && f.contains(l) || (p = l.closest) != null && p.call(l, "[data-pa-settings-trigger]") || t();
2432
2434
  };
2433
- return window.addEventListener("keydown", s), window.addEventListener("mousedown", u), () => {
2434
- window.removeEventListener("keydown", s), window.removeEventListener("mousedown", u);
2435
+ return window.addEventListener("keydown", o), window.addEventListener("mousedown", c), () => {
2436
+ window.removeEventListener("keydown", o), window.removeEventListener("mousedown", c);
2435
2437
  };
2436
- }, [e, t]), e ? /* @__PURE__ */ n("div", { ref: o, className: "pa-settings-menu", role: "dialog", "aria-label": "PixelAgent settings", children: /* @__PURE__ */ n(Te, { variant: "popover", className: "pa-settings-menu-panel", children: /* @__PURE__ */ d("div", { className: "pa-settings-menu-inner", children: [
2438
+ }, [e, t]), e ? /* @__PURE__ */ n("div", { ref: s, className: "pa-settings-menu", role: "dialog", "aria-label": "PixelAgent settings", children: /* @__PURE__ */ n(Te, { variant: "popover", className: "pa-settings-menu-panel", children: /* @__PURE__ */ d("div", { className: "pa-settings-menu-inner", children: [
2437
2439
  /* @__PURE__ */ d("header", { className: "pa-settings-menu-header", children: [
2438
2440
  /* @__PURE__ */ n("h4", { className: "pa-settings-menu-title", children: "Settings" }),
2439
2441
  /* @__PURE__ */ n("p", { className: "pa-settings-menu-subtitle", children: "Appearance and chrome" })
@@ -2449,7 +2451,7 @@ function fr({
2449
2451
  onClick: a,
2450
2452
  "aria-label": i === "dark" ? "Switch host to light theme" : "Switch host to dark theme",
2451
2453
  title: i === "dark" ? "Light theme" : "Dark theme",
2452
- children: i === "dark" ? /* @__PURE__ */ n(pr, {}) : /* @__PURE__ */ n(hr, {})
2454
+ children: i === "dark" ? /* @__PURE__ */ n(gr, {}) : /* @__PURE__ */ n(vr, {})
2453
2455
  }
2454
2456
  )
2455
2457
  ] })
@@ -2464,29 +2466,29 @@ function fr({
2464
2466
  ] })
2465
2467
  ] }) }) }) : null;
2466
2468
  }
2467
- const mt = "0 0 24 24";
2468
- function mr() {
2469
- return /* @__PURE__ */ d(G, { children: [
2469
+ const bt = "0 0 24 24";
2470
+ function yr() {
2471
+ return /* @__PURE__ */ d(K, { children: [
2470
2472
  /* @__PURE__ */ n("rect", { x: "3", y: "14", width: "4", height: "4", fill: "currentColor" }),
2471
2473
  /* @__PURE__ */ n("path", { fill: "currentColor", d: "M7 5h12v12L7 5z" })
2472
2474
  ] });
2473
2475
  }
2474
- const gr = "M4.5 2.5L4.5 17.25L9.1 12.9L11.35 19.15L13.55 17.95L11.05 11.85L16.85 11.85L4.5 2.5Z";
2475
- function vr({ size: e = 22, variant: t = "cursor" }) {
2476
+ const wr = "M4.5 2.5L4.5 17.25L9.1 12.9L11.35 19.15L13.55 17.95L11.05 11.85L16.85 11.85L4.5 2.5Z";
2477
+ function xr({ size: e = 22, variant: t = "cursor" }) {
2476
2478
  return t === "pointer" ? /* @__PURE__ */ n(
2477
2479
  "svg",
2478
2480
  {
2479
2481
  className: "pa-brand-cursor pa-brand-cursor--pointer",
2480
2482
  width: e,
2481
2483
  height: e,
2482
- viewBox: mt,
2484
+ viewBox: bt,
2483
2485
  xmlns: "http://www.w3.org/2000/svg",
2484
2486
  "aria-hidden": "true",
2485
2487
  children: /* @__PURE__ */ n(
2486
2488
  "path",
2487
2489
  {
2488
2490
  fill: "currentColor",
2489
- d: gr
2491
+ d: wr
2490
2492
  }
2491
2493
  )
2492
2494
  }
@@ -2496,60 +2498,60 @@ function vr({ size: e = 22, variant: t = "cursor" }) {
2496
2498
  className: "pa-brand-cursor pa-brand-cursor--minimal",
2497
2499
  width: e,
2498
2500
  height: e,
2499
- viewBox: mt,
2501
+ viewBox: bt,
2500
2502
  xmlns: "http://www.w3.org/2000/svg",
2501
2503
  "aria-hidden": "true",
2502
- children: /* @__PURE__ */ n(mr, {})
2504
+ children: /* @__PURE__ */ n(yr, {})
2503
2505
  }
2504
2506
  );
2505
2507
  }
2506
- const br = ["element", "area", "multi"], yr = {
2508
+ const Nr = ["element", "area", "multi"], kr = {
2507
2509
  element: "Click",
2508
2510
  area: "Area",
2509
2511
  multi: "Multi"
2510
2512
  };
2511
- function wr({
2513
+ function Cr({
2512
2514
  rootAttributes: e,
2513
2515
  hostTheme: t,
2514
2516
  chrome: i,
2515
2517
  settingsOpen: r,
2516
2518
  onToggleSettings: a,
2517
- onCloseSettings: o,
2518
- onToggleHostTheme: s,
2519
- active: u,
2520
- mode: c,
2519
+ onCloseSettings: s,
2520
+ onToggleHostTheme: o,
2521
+ active: c,
2522
+ mode: u,
2521
2523
  captureMode: l,
2522
- annotationCount: p,
2523
- multiSelectCount: f,
2524
+ annotationCount: f,
2525
+ multiSelectCount: p,
2524
2526
  copyStatus: v,
2525
- copyAllFrom: g,
2526
- onActivateAnnotate: m,
2527
- onActivateEdit: y,
2528
- onDeactivate: E,
2529
- onCopyAll: x,
2527
+ copyAllFrom: m,
2528
+ onActivateAnnotate: g,
2529
+ onActivateEdit: b,
2530
+ onDeactivate: L,
2531
+ onCopyAll: N,
2530
2532
  onCaptureModeChange: w,
2531
- onConfirmMultiSelect: N
2533
+ onConfirmMultiSelect: k
2532
2534
  }) {
2533
- const { elementRef: T, isDragging: P, style: $, dragHandleProps: k } = Lt(), I = /* @__PURE__ */ d(
2535
+ const { elementRef: $, isDragging: P, style: R, dragHandleProps: x } = Rt(), I = /* @__PURE__ */ d(
2534
2536
  "div",
2535
2537
  {
2536
- ref: T,
2538
+ ref: $,
2537
2539
  className: `pa-toolbar-float ${P ? "pa-toolbar-float--dragging" : ""}`,
2538
- style: $,
2540
+ style: R,
2539
2541
  role: "toolbar",
2540
2542
  "aria-label": "PixelAgent",
2541
2543
  children: [
2542
- !u && /* @__PURE__ */ n(
2543
- fr,
2544
+ !c && /* @__PURE__ */ n(
2545
+ br,
2544
2546
  {
2545
2547
  open: r,
2546
- onClose: o,
2548
+ onClose: s,
2547
2549
  hostTheme: t,
2548
2550
  chrome: i,
2549
- onToggleHostTheme: s
2551
+ onToggleHostTheme: o
2550
2552
  }
2551
2553
  ),
2552
- /* @__PURE__ */ n(St, { shape: "capsule", className: "pa-toolbar-glass", intensity: "enhanced", children: /* @__PURE__ */ d("div", { className: "pa-toolbar-inner", children: [
2554
+ /* @__PURE__ */ n(Tt, { shape: "capsule", className: "pa-toolbar-glass", intensity: "enhanced", children: /* @__PURE__ */ d("div", { className: "pa-toolbar-inner", children: [
2553
2555
  /* @__PURE__ */ n(
2554
2556
  "button",
2555
2557
  {
@@ -2557,15 +2559,15 @@ function wr({
2557
2559
  className: "pa-toolbar-drag",
2558
2560
  "aria-label": "Drag PixelAgent toolbar",
2559
2561
  title: "Drag to move",
2560
- ...k,
2561
- children: /* @__PURE__ */ n(vr, { size: 22 })
2562
+ ...x,
2563
+ children: /* @__PURE__ */ n(xr, { size: 22 })
2562
2564
  }
2563
2565
  ),
2564
2566
  /* @__PURE__ */ n("span", { className: "pa-toolbar-divider", "aria-hidden": "true" }),
2565
- u ? /* @__PURE__ */ d(G, { children: [
2567
+ c ? /* @__PURE__ */ d(K, { children: [
2566
2568
  /* @__PURE__ */ d("div", { className: "pa-toolbar-segment", children: [
2567
- /* @__PURE__ */ n("span", { className: "pa-mode-badge", children: c }),
2568
- c === "annotate" && /* @__PURE__ */ d(G, { children: [
2569
+ /* @__PURE__ */ n("span", { className: "pa-mode-badge", children: u }),
2570
+ u === "annotate" && /* @__PURE__ */ d(K, { children: [
2569
2571
  /* @__PURE__ */ n(
2570
2572
  "select",
2571
2573
  {
@@ -2573,31 +2575,31 @@ function wr({
2573
2575
  value: l,
2574
2576
  onChange: (C) => w(C.target.value),
2575
2577
  "aria-label": "Capture mode",
2576
- children: br.map((C) => /* @__PURE__ */ n("option", { value: C, children: yr[C] }, C))
2578
+ children: Nr.map((C) => /* @__PURE__ */ n("option", { value: C, children: kr[C] }, C))
2577
2579
  }
2578
2580
  ),
2579
- f > 0 && /* @__PURE__ */ n(
2581
+ p > 0 && /* @__PURE__ */ n(
2580
2582
  V,
2581
2583
  {
2582
2584
  variant: "glass-primary",
2583
- onClick: N,
2585
+ onClick: k,
2584
2586
  "aria-label": "Annotate selected elements",
2585
- children: f
2587
+ children: p
2586
2588
  }
2587
2589
  ),
2588
2590
  /* @__PURE__ */ n(
2589
- Ot,
2591
+ Ht,
2590
2592
  {
2591
- feedback: g === "toolbar" ? v : null,
2593
+ feedback: m === "toolbar" ? v : null,
2592
2594
  slotClassName: "pa-copy-feedback-slot--toolbar",
2593
2595
  children: /* @__PURE__ */ n(
2594
2596
  V,
2595
2597
  {
2596
2598
  variant: "glass-primary",
2597
- onClick: x,
2598
- disabled: p === 0,
2599
- "aria-label": p > 0 ? `Copy all annotations (${p})` : "Copy all annotations",
2600
- children: p > 0 ? `Copy (${p})` : "Copy"
2599
+ onClick: N,
2600
+ disabled: f === 0,
2601
+ "aria-label": f > 0 ? `Copy all annotations (${f})` : "Copy all annotations",
2602
+ children: f > 0 ? `Copy (${f})` : "Copy"
2601
2603
  }
2602
2604
  )
2603
2605
  }
@@ -2609,7 +2611,7 @@ function wr({
2609
2611
  {
2610
2612
  variant: "icon",
2611
2613
  className: "pa-toolbar-close",
2612
- onClick: E,
2614
+ onClick: L,
2613
2615
  "aria-label": "Close",
2614
2616
  children: /* @__PURE__ */ n(
2615
2617
  "svg",
@@ -2633,10 +2635,10 @@ function wr({
2633
2635
  }
2634
2636
  )
2635
2637
  ] }) : /* @__PURE__ */ d("div", { className: "pa-toolbar-segment", children: [
2636
- /* @__PURE__ */ n(V, { onClick: m, children: "Annotate" }),
2637
- /* @__PURE__ */ n(V, { onClick: y, children: "Edit" })
2638
+ /* @__PURE__ */ n(V, { onClick: g, children: "Annotate" }),
2639
+ /* @__PURE__ */ n(V, { onClick: b, children: "Edit" })
2638
2640
  ] }),
2639
- !u && /* @__PURE__ */ d(G, { children: [
2641
+ !c && /* @__PURE__ */ d(K, { children: [
2640
2642
  /* @__PURE__ */ n("span", { className: "pa-toolbar-divider", "aria-hidden": "true" }),
2641
2643
  /* @__PURE__ */ n(
2642
2644
  V,
@@ -2648,16 +2650,16 @@ function wr({
2648
2650
  "aria-label": "PixelAgent settings",
2649
2651
  "aria-expanded": r,
2650
2652
  title: "Settings",
2651
- children: /* @__PURE__ */ n(ur, {})
2653
+ children: /* @__PURE__ */ n(mr, {})
2652
2654
  }
2653
2655
  )
2654
2656
  ] }),
2655
- v && !Dt(v) && v !== "Copied!" && /* @__PURE__ */ n("span", { className: "pa-status pa-toolbar-status", role: "status", children: v })
2657
+ v && !_t(v) && v !== "Copied!" && /* @__PURE__ */ n("span", { className: "pa-status pa-toolbar-status", role: "status", children: v })
2656
2658
  ] }) })
2657
2659
  ]
2658
2660
  }
2659
2661
  );
2660
- return typeof document > "u" ? I : Ye(
2662
+ return typeof document > "u" ? I : Ke(
2661
2663
  /* @__PURE__ */ n(
2662
2664
  "div",
2663
2665
  {
@@ -2670,22 +2672,22 @@ function wr({
2670
2672
  document.body
2671
2673
  );
2672
2674
  }
2673
- function xr() {
2674
- const e = W(jt()), [t, i] = A(
2675
+ function Mr() {
2676
+ const e = Y(Qt()), [t, i] = S(
2675
2677
  () => {
2676
- var o;
2677
- return ((o = e.current) == null ? void 0 : o.annotations) ?? [];
2678
+ var s;
2679
+ return ((s = e.current) == null ? void 0 : s.annotations) ?? [];
2678
2680
  }
2679
2681
  );
2680
2682
  H(() => {
2681
- qt({ annotations: t });
2683
+ en({ annotations: t });
2682
2684
  }, [t]);
2683
- const r = L((o, s) => {
2685
+ const r = E((s, o) => {
2684
2686
  i(
2685
- (u) => u.map((c) => c.id === o ? { ...c, ...s } : c)
2687
+ (c) => c.map((u) => u.id === s ? { ...u, ...o } : u)
2686
2688
  );
2687
- }, []), a = L((o) => {
2688
- i((s) => s.filter((u) => u.id !== o));
2689
+ }, []), a = E((s) => {
2690
+ i((o) => o.filter((c) => c.id !== s));
2689
2691
  }, []);
2690
2692
  return {
2691
2693
  annotations: t,
@@ -2694,227 +2696,284 @@ function xr() {
2694
2696
  removeAnnotation: a
2695
2697
  };
2696
2698
  }
2697
- function Nr({
2699
+ function Ar({
2698
2700
  ui: e,
2699
2701
  hostTheme: t,
2700
2702
  onHostThemeChange: i
2701
2703
  }) {
2702
- const r = we(
2703
- () => ({ ...Jt, ...e }),
2704
+ const r = xe(
2705
+ () => ({ ...tn, ...e }),
2704
2706
  [e]
2705
- ), [a, o] = A(
2706
- () => t ?? tt(r) ?? "dark"
2707
- ), [s, u] = A(!1), c = t ?? a;
2707
+ ), [a, s] = S(
2708
+ () => t ?? it(r) ?? "dark"
2709
+ ), [o, c] = S(!1), u = t ?? a;
2708
2710
  H(() => {
2709
2711
  if (t !== void 0) return;
2710
2712
  const v = () => {
2711
- const y = tt(r);
2712
- y && o(y);
2713
+ const b = it(r);
2714
+ b && s(b);
2713
2715
  };
2714
2716
  v();
2715
- const g = r.hostThemeAttribute, m = new MutationObserver(v);
2716
- return m.observe(document.documentElement, {
2717
+ const m = r.hostThemeAttribute, g = new MutationObserver(v);
2718
+ return g.observe(document.documentElement, {
2717
2719
  attributes: !0,
2718
- attributeFilter: [g]
2719
- }), () => m.disconnect();
2720
+ attributeFilter: [m]
2721
+ }), () => g.disconnect();
2720
2722
  }, [t, r]);
2721
- const l = we(
2722
- () => Zt(r, c),
2723
- [r, c]
2724
- ), p = L(() => {
2725
- const v = c === "dark" ? "light" : "dark";
2723
+ const l = xe(
2724
+ () => nn(r, u),
2725
+ [r, u]
2726
+ ), f = E(() => {
2727
+ const v = u === "dark" ? "light" : "dark";
2726
2728
  if (i) {
2727
2729
  i(v);
2728
2730
  return;
2729
2731
  }
2730
- o(v), Qt(v, r);
2731
- }, [c, i, r]), f = L(() => {
2732
- u((v) => !v);
2732
+ s(v), rn(v, r);
2733
+ }, [u, i, r]), p = E(() => {
2734
+ c((v) => !v);
2733
2735
  }, []);
2734
2736
  return {
2735
2737
  chrome: l,
2736
- rootAttributes: en(l),
2737
- hostTheme: c,
2738
- toggleHostTheme: p,
2739
- settingsOpen: s,
2740
- setSettingsOpen: u,
2741
- toggleSettings: f,
2738
+ rootAttributes: an(l),
2739
+ hostTheme: u,
2740
+ toggleHostTheme: f,
2741
+ settingsOpen: o,
2742
+ setSettingsOpen: c,
2743
+ toggleSettings: p,
2742
2744
  uiSettings: r
2743
2745
  };
2744
2746
  }
2745
- const gt = "/__pixelagent/apply";
2746
- function vt(e) {
2747
+ const yt = "/__pixelagent/apply", wt = "pixelagent-runtime-styles";
2748
+ let xt = 0;
2749
+ const We = /* @__PURE__ */ new WeakMap();
2750
+ function Sr(e) {
2751
+ let t = We.get(e);
2752
+ if (t) return t;
2753
+ for (const i of Array.from(e.classList))
2754
+ if (i.startsWith("pa-runtime-"))
2755
+ return We.set(e, i), i;
2756
+ return xt += 1, t = `pa-runtime-${xt}`, We.set(e, t), e.classList.add(t), t;
2757
+ }
2758
+ function Lr() {
2759
+ let e = document.getElementById(wt);
2760
+ return e || (e = document.createElement("style"), e.id = wt, document.head.appendChild(e)), e;
2761
+ }
2762
+ function Er(e, t, i, r) {
2763
+ const a = Lr(), s = e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), o = new RegExp(
2764
+ `(\\.${s}:${t}\\s*\\{)([\\s\\S]*?)(\\})`,
2765
+ "m"
2766
+ ), c = `${i}: ${r} !important`;
2767
+ let u = a.textContent ?? "";
2768
+ const l = u.match(o);
2769
+ if (l) {
2770
+ const f = l[2], p = new RegExp(`(\\s*${i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\s*:\\s*)[^;]+;?`);
2771
+ let v;
2772
+ if (p.test(f))
2773
+ v = f.replace(p, `$1${r} !important;`);
2774
+ else {
2775
+ const m = f.replace(/\s+$/, ""), g = m.endsWith(";") || m === "" ? "" : ";";
2776
+ v = `${m}${g}
2777
+ ${c};
2778
+ `;
2779
+ }
2780
+ u = u.replace(o, `$1${v}$3`);
2781
+ } else
2782
+ u && !u.endsWith(`
2783
+ `) && (u += `
2784
+ `), u += `
2785
+ .${e}:${t} {
2786
+ ${c};
2787
+ }
2788
+ `;
2789
+ a.textContent = u;
2790
+ }
2791
+ function Nt(e) {
2747
2792
  const t = Math.min(e.startX, e.currentX), i = Math.min(e.startY, e.currentY), r = Math.abs(e.currentX - e.startX), a = Math.abs(e.currentY - e.startY);
2748
2793
  return { x: t, y: i, width: r, height: a };
2749
2794
  }
2750
- function kr({
2795
+ function $r({
2751
2796
  ui: e,
2752
2797
  hostTheme: t,
2753
2798
  onHostThemeChange: i,
2754
2799
  applyEndpoint: r,
2755
- onApply: a
2800
+ onApply: a,
2801
+ runtimeStateStyles: s
2756
2802
  } = {}) {
2757
- const o = Nr({ ui: e, hostTheme: t, onHostThemeChange: i }), [s, u] = A(null);
2803
+ const o = Ar({ ui: e, hostTheme: t, onHostThemeChange: i }), [c, u] = S(null);
2758
2804
  H(() => {
2759
2805
  if (r || a) return;
2760
- let b = !1;
2761
- return fetch(gt, { method: "GET" }).then((S) => {
2762
- !b && S.status === 405 && u(gt);
2806
+ let y = !1;
2807
+ return fetch(yt, { method: "GET" }).then((A) => {
2808
+ !y && A.status === 405 && u(yt);
2763
2809
  }).catch(() => {
2764
2810
  }), () => {
2765
- b = !0;
2811
+ y = !0;
2766
2812
  };
2767
2813
  }, [r, a]);
2768
- const [c, l] = A(!1), [p, f] = A("idle"), [v, g] = A("element"), {
2769
- annotations: m,
2770
- setAnnotations: y,
2771
- updateAnnotation: E,
2772
- removeAnnotation: x
2773
- } = xr(), [w, N] = A(null), [T, P] = A(null), [$, k] = A([]), [I, C] = A(null), [h, B] = A(null), [Y, ne] = A(!1), [Q, J] = A(!1), he = c && p === "annotate" && m.length > 0 && !Y, [F, ee] = A("this-instance"), [te, M] = A("normal"), [D, O] = A(null), [_, R] = A(null), [z, X] = A(null), q = W(null), fe = W(null), me = L(
2774
- (b, S) => {
2775
- fe.current && clearTimeout(fe.current), O(b), R((S == null ? void 0 : S.entryId) ?? null), X((S == null ? void 0 : S.copyAllFrom) ?? null), fe.current = setTimeout(() => {
2776
- O(null), R(null), X(null);
2814
+ const [l, f] = S(!1), [p, v] = S("idle"), [m, g] = S("element"), {
2815
+ annotations: b,
2816
+ setAnnotations: L,
2817
+ updateAnnotation: N,
2818
+ removeAnnotation: w
2819
+ } = Mr(), [k, $] = S(null), [P, R] = S(null), [x, I] = S([]), [C, h] = S(null), [O, U] = S(null), [ge, j] = S(!1), [oe, re] = S(!1), W = l && p === "annotate" && b.length > 0 && !ge, [G, ee] = S("this-instance"), [M, F] = S("normal"), [D, z] = S(null), [T, _] = S(null), [X, q] = S(null), Re = Y(null), Pe = Y(null), de = E(
2820
+ (y, A) => {
2821
+ Pe.current && clearTimeout(Pe.current), z(y), _((A == null ? void 0 : A.entryId) ?? null), q((A == null ? void 0 : A.copyAllFrom) ?? null), Pe.current = setTimeout(() => {
2822
+ z(null), _(null), q(null);
2777
2823
  }, 2500);
2778
2824
  },
2779
2825
  []
2780
- ), xe = L(
2781
- async (b, S, K) => {
2782
- if (b)
2826
+ ), Ne = E(
2827
+ async (y, A, J) => {
2828
+ if (y)
2783
2829
  try {
2784
- await Nt(b), me(S, K);
2830
+ await St(y), de(A, J);
2785
2831
  } catch {
2786
- me("Copy failed — check clipboard permissions", K);
2832
+ de("Copy failed — check clipboard permissions", J);
2787
2833
  }
2788
2834
  },
2789
- [me]
2790
- ), ge = L(
2791
- (b, S) => {
2792
- b.length === 0 && !S || (C({ elements: b, areaBbox: S }), P(b[0] ?? null));
2835
+ [de]
2836
+ ), ve = E(
2837
+ (y, A) => {
2838
+ y.length === 0 && !A || (h({ elements: y, areaBbox: A }), R(y[0] ?? null));
2793
2839
  },
2794
2840
  []
2795
- ), Pe = L(
2796
- (b) => {
2797
- if (!(!c || p !== "annotate" || Le(b.target))) {
2798
- if (h) {
2799
- B(
2800
- (S) => S && { ...S, currentX: b.clientX, currentY: b.clientY }
2841
+ ), De = E(
2842
+ (y) => {
2843
+ if (!(!l || p !== "annotate" || Ee(y.target))) {
2844
+ if (O) {
2845
+ U(
2846
+ (A) => A && { ...A, currentX: y.clientX, currentY: y.clientY }
2801
2847
  );
2802
2848
  return;
2803
2849
  }
2804
- v !== "area" && N(ft(b.clientX, b.clientY));
2850
+ m !== "area" && $(vt(y.clientX, y.clientY));
2805
2851
  }
2806
2852
  },
2807
- [c, p, h, v]
2808
- ), Re = L(
2809
- (b) => {
2810
- !c || p !== "annotate" || Le(b.target) || v !== "area" || b.button !== 0 || (b.preventDefault(), b.stopPropagation(), B({
2811
- startX: b.clientX,
2812
- startY: b.clientY,
2813
- currentX: b.clientX,
2814
- currentY: b.clientY
2815
- }), C(null));
2853
+ [l, p, O, m]
2854
+ ), Oe = E(
2855
+ (y) => {
2856
+ !l || p !== "annotate" || Ee(y.target) || m !== "area" || y.button !== 0 || (y.preventDefault(), y.stopPropagation(), U({
2857
+ startX: y.clientX,
2858
+ startY: y.clientY,
2859
+ currentX: y.clientX,
2860
+ currentY: y.clientY
2861
+ }), h(null));
2816
2862
  },
2817
- [c, p, v]
2818
- ), $e = L(() => {
2819
- if (!h) return;
2820
- const b = vt(h);
2821
- if (B(null), b.width < 8 || b.height < 8) return;
2822
- const S = tn(b, je);
2823
- ge(S, b);
2824
- }, [h, ge]), De = L(
2825
- (b) => {
2826
- if (!c || p !== "annotate" || Le(b.target) || v === "area") return;
2827
- b.preventDefault(), b.stopPropagation();
2828
- const S = ft(b.clientX, b.clientY);
2829
- if (!S) return;
2830
- if (b.shiftKey || v === "multi") {
2831
- k((Z) => Z.includes(S) ? Z.filter((U) => U !== S) : [...Z, S]), P(S);
2863
+ [l, p, m]
2864
+ ), Fe = E(() => {
2865
+ if (!O) return;
2866
+ const y = Nt(O);
2867
+ if (U(null), y.width < 8 || y.height < 8) return;
2868
+ const A = on(y, Ze);
2869
+ ve(A, y);
2870
+ }, [O, ve]), Be = E(
2871
+ (y) => {
2872
+ if (!l || p !== "annotate" || Ee(y.target) || m === "area") return;
2873
+ y.preventDefault(), y.stopPropagation();
2874
+ const A = vt(y.clientX, y.clientY);
2875
+ if (!A) return;
2876
+ if (y.shiftKey || m === "multi") {
2877
+ I((te) => te.includes(A) ? te.filter((B) => B !== A) : [...te, A]), R(A);
2832
2878
  return;
2833
2879
  }
2834
- const K = $.length > 0 ? $ : [S];
2835
- ge(K.includes(S) ? K : [S]);
2880
+ const J = x.length > 0 ? x : [A];
2881
+ ve(J.includes(A) ? J : [A]);
2836
2882
  },
2837
- [c, p, v, $, ge]
2883
+ [l, p, m, x, ve]
2838
2884
  );
2839
2885
  H(() => {
2840
- !T || F !== "all-instances" || yt(T) <= 1 && ee("this-instance");
2841
- }, [T, F]), H(() => {
2842
- if (c)
2843
- return document.addEventListener("mousemove", Pe, !0), document.addEventListener("mousedown", Re, !0), document.addEventListener("mouseup", $e, !0), document.addEventListener("click", De, !0), () => {
2844
- document.removeEventListener("mousemove", Pe, !0), document.removeEventListener("mousedown", Re, !0), document.removeEventListener("mouseup", $e, !0), document.removeEventListener("click", De, !0);
2886
+ !P || G !== "all-instances" || Ct(P) <= 1 && ee("this-instance");
2887
+ }, [P, G]), H(() => {
2888
+ if (l)
2889
+ return document.addEventListener("mousemove", De, !0), document.addEventListener("mousedown", Oe, !0), document.addEventListener("mouseup", Fe, !0), document.addEventListener("click", Be, !0), () => {
2890
+ document.removeEventListener("mousemove", De, !0), document.removeEventListener("mousedown", Oe, !0), document.removeEventListener("mouseup", Fe, !0), document.removeEventListener("click", Be, !0);
2845
2891
  };
2846
- }, [c, Pe, Re, $e, De]);
2847
- const Ft = L(
2848
- (b, S) => {
2849
- if (!I || !b.trim()) return;
2850
- const { elements: K, areaBbox: Z } = I;
2851
- if (K.length === 0 && !Z) return;
2852
- const ve = ar({
2853
- elements: K,
2854
- note: b,
2855
- areaBbox: Z
2892
+ }, [l, De, Oe, Fe, Be]);
2893
+ const Vt = E(
2894
+ (y, A) => {
2895
+ if (!C || !y.trim()) return;
2896
+ const { elements: J, areaBbox: te } = C;
2897
+ if (J.length === 0 && !te) return;
2898
+ const be = cr({
2899
+ elements: J,
2900
+ note: y,
2901
+ areaBbox: te
2856
2902
  });
2857
- y((U) => [...U, ve]), ne(!1), J(!1), S ? (C(null), P(null)) : (C(null), P(null), k([]));
2903
+ L((B) => [...B, be]), j(!1), re(!1), A ? (h(null), R(null)) : (h(null), R(null), I([]));
2858
2904
  },
2859
- [I, y]
2860
- ), Bt = L(() => {
2861
- C(null), P(null);
2862
- }, []), qe = L(
2863
- async (b) => {
2864
- const S = nn(m);
2865
- await xe(S, "Copied all!", { copyAllFrom: b });
2905
+ [C, L]
2906
+ ), Wt = E(() => {
2907
+ h(null), R(null);
2908
+ }, []), Qe = E(
2909
+ async (y) => {
2910
+ const A = sn(b);
2911
+ await Ne(A, "Copied all!", { copyAllFrom: y });
2866
2912
  },
2867
- [m, xe]
2868
- ), zt = L(
2869
- async (b) => {
2870
- const S = m.find((K) => K.id === b);
2871
- S && await xe(rn(S), "Copied!", { entryId: b });
2913
+ [b, Ne]
2914
+ ), Ut = E(
2915
+ async (y) => {
2916
+ const A = b.find((J) => J.id === y);
2917
+ A && await Ne(ln(A), "Copied!", { entryId: y });
2872
2918
  },
2873
- [m, xe]
2874
- ), Ht = L(
2875
- async (b) => {
2876
- const S = [];
2877
- for (const [U, ae] of b)
2878
- for (const [Oe, be] of ae)
2879
- be.length > 0 && S.push([U, Oe, be]);
2880
- if (S.length === 0) return !1;
2881
- const K = r ?? s ?? void 0, Z = [];
2882
- for (const [U, ae, Oe] of S) {
2883
- const be = We(U), Ut = {
2919
+ [b, Ne]
2920
+ ), Yt = E(
2921
+ async (y) => {
2922
+ const A = [];
2923
+ for (const [B, Z] of y)
2924
+ for (const [se, ne] of Z)
2925
+ ne.length > 0 && A.push([B, se, ne]);
2926
+ if (A.length === 0) return { applied: !1 };
2927
+ if (s) {
2928
+ for (const [B, Z, se] of A) {
2929
+ if (Z === "normal") continue;
2930
+ const ne = Sr(B);
2931
+ for (const ye of se)
2932
+ B.style.removeProperty(ye.property), Er(ne, Z, ye.property, ye.newValue);
2933
+ }
2934
+ for (const [B, Z, se] of A)
2935
+ if (Z === "normal")
2936
+ for (const ne of se)
2937
+ B.style.setProperty(ne.property, ne.newValue);
2938
+ return de("Change applied"), { applied: !0, skipRevert: !0 };
2939
+ }
2940
+ const J = r ?? c ?? void 0, te = [];
2941
+ for (const [B, Z, se] of A) {
2942
+ const ne = Ge(B), ye = {
2884
2943
  schemaVersion: 1,
2885
- elementSelector: wt(U, F),
2886
- sourceFile: be.sourceFile,
2887
- lineNumber: be.lineNumber,
2888
- targetScope: F,
2889
- state: ae,
2890
- stylingSystem: bt(U),
2891
- changes: Oe
2944
+ elementSelector: Mt(B, G),
2945
+ sourceFile: ne.sourceFile,
2946
+ lineNumber: ne.lineNumber,
2947
+ targetScope: G,
2948
+ state: Z,
2949
+ stylingSystem: kt(B),
2950
+ changes: se
2892
2951
  };
2893
- Z.push(await Gn(Ut, { applyEndpoint: K, onApply: a }));
2952
+ te.push(await Jn(ye, { applyEndpoint: J, onApply: a }));
2894
2953
  }
2895
- const ve = Z.every(
2896
- (U) => U.mode === "mcp" && U.result.success && U.result.linesChanged.length > 0
2954
+ const be = te.every(
2955
+ (B) => B.mode === "mcp" && B.result.success && B.result.linesChanged.length > 0
2897
2956
  );
2898
- return me(ve ? "Change applied" : "Apply failed"), Z.forEach((U, ae) => {
2899
- U.mode === "error" ? console.error(`[pixelagent] Apply #${ae} failed:`, U.message) : U.mode === "clipboard" ? console.warn(`[pixelagent] Apply #${ae} fell back to clipboard`) : U.mode === "mcp" && !U.result.success && console.warn(`[pixelagent] Apply #${ae} reported no changes:`, U.result);
2900
- }), ve;
2957
+ return de(be ? "Change applied" : "Apply failed"), te.forEach((B, Z) => {
2958
+ B.mode === "error" ? console.error(`[pixelagent] Apply #${Z} failed:`, B.message) : B.mode === "clipboard" ? console.warn(`[pixelagent] Apply #${Z} fell back to clipboard`) : B.mode === "mcp" && !B.result.success && console.warn(`[pixelagent] Apply #${Z} reported no changes:`, B.result);
2959
+ }), { applied: be };
2901
2960
  },
2902
- [F, r, s, a, me]
2903
- ), Je = (b) => {
2904
- o.setSettingsOpen(!1), l(!0), f(b), P(null), N(null), C(null), k([]), B(null), b === "annotate" && ne(!1);
2905
- }, _t = () => {
2906
- l(!1), f("idle"), P(null), N(null), C(null), k([]), B(null), ne(!1), J(!1);
2907
- }, Vt = h ? vt(h) : null;
2961
+ [G, r, c, a, s, de]
2962
+ ), et = (y) => {
2963
+ o.setSettingsOpen(!1), f(!0), v(y), R(null), $(null), h(null), I([]), U(null), y === "annotate" && j(!1);
2964
+ }, Xt = () => {
2965
+ f(!1), v("idle"), R(null), $(null), h(null), I([]), U(null), j(!1), re(!1);
2966
+ }, Gt = O ? Nt(O) : null;
2908
2967
  return /* @__PURE__ */ d(
2909
2968
  "div",
2910
2969
  {
2911
- ref: q,
2970
+ ref: Re,
2912
2971
  className: "pa-root",
2913
2972
  "data-pixelagent-root": !0,
2914
2973
  ...o.rootAttributes,
2915
2974
  children: [
2916
2975
  /* @__PURE__ */ n(
2917
- wr,
2976
+ Cr,
2918
2977
  {
2919
2978
  rootAttributes: o.rootAttributes,
2920
2979
  hostTheme: o.hostTheme,
@@ -2923,91 +2982,91 @@ function kr({
2923
2982
  onToggleSettings: o.toggleSettings,
2924
2983
  onCloseSettings: () => o.setSettingsOpen(!1),
2925
2984
  onToggleHostTheme: o.toggleHostTheme,
2926
- active: c,
2985
+ active: l,
2927
2986
  mode: p,
2928
- captureMode: v,
2929
- annotationCount: m.length,
2930
- multiSelectCount: $.length,
2987
+ captureMode: m,
2988
+ annotationCount: b.length,
2989
+ multiSelectCount: x.length,
2931
2990
  copyStatus: D,
2932
- copyAllFrom: z,
2933
- onActivateAnnotate: () => Je("annotate"),
2934
- onActivateEdit: () => Je("edit"),
2935
- onDeactivate: _t,
2936
- onCopyAll: () => qe("toolbar"),
2991
+ copyAllFrom: X,
2992
+ onActivateAnnotate: () => et("annotate"),
2993
+ onActivateEdit: () => et("edit"),
2994
+ onDeactivate: Xt,
2995
+ onCopyAll: () => Qe("toolbar"),
2937
2996
  onCaptureModeChange: g,
2938
2997
  onConfirmMultiSelect: () => {
2939
- $.length > 0 && ge($);
2998
+ x.length > 0 && ve(x);
2940
2999
  }
2941
3000
  }
2942
3001
  ),
2943
- c && p === "annotate" && /* @__PURE__ */ d(G, { children: [
3002
+ l && p === "annotate" && /* @__PURE__ */ d(K, { children: [
2944
3003
  /* @__PURE__ */ n(
2945
- Mt,
3004
+ $t,
2946
3005
  {
2947
- element: w,
2948
- selected: T,
2949
- multiSelected: $
3006
+ element: k,
3007
+ selected: P,
3008
+ multiSelected: x
2950
3009
  }
2951
3010
  ),
2952
- /* @__PURE__ */ n(cr, { annotations: m }),
2953
- /* @__PURE__ */ n(ir, { area: Vt, isDragging: !!h })
3011
+ /* @__PURE__ */ n(hr, { annotations: b }),
3012
+ /* @__PURE__ */ n(lr, { area: Gt, isDragging: !!O })
2954
3013
  ] }),
2955
- c && p === "annotate" && I && /* @__PURE__ */ n(
2956
- rr,
3014
+ l && p === "annotate" && C && /* @__PURE__ */ n(
3015
+ sr,
2957
3016
  {
2958
- elements: I.elements,
2959
- areaBbox: I.areaBbox,
2960
- onSubmit: Ft,
2961
- onCancel: Bt
3017
+ elements: C.elements,
3018
+ areaBbox: C.areaBbox,
3019
+ onSubmit: Vt,
3020
+ onCancel: Wt
2962
3021
  }
2963
3022
  ),
2964
- c && p === "edit" && /* @__PURE__ */ n(
2965
- Xn,
3023
+ l && p === "edit" && /* @__PURE__ */ n(
3024
+ qn,
2966
3025
  {
2967
- selectedElement: T,
2968
- hoveredElement: w,
2969
- onSelectElement: P,
2970
- onHoverElement: N,
2971
- targetScope: F,
3026
+ selectedElement: P,
3027
+ hoveredElement: k,
3028
+ onSelectElement: R,
3029
+ onHoverElement: $,
3030
+ targetScope: G,
2972
3031
  onTargetScopeChange: ee,
2973
- elementState: te,
2974
- onElementStateChange: M,
2975
- onApply: Ht,
3032
+ elementState: M,
3033
+ onElementStateChange: F,
3034
+ onApply: Yt,
2976
3035
  applyStatus: p === "edit" ? D : null,
2977
- isToolbarTarget: Le
3036
+ isToolbarTarget: Ee
2978
3037
  }
2979
3038
  ),
2980
- he && /* @__PURE__ */ n(
2981
- dr,
3039
+ W && /* @__PURE__ */ n(
3040
+ fr,
2982
3041
  {
2983
- annotations: m,
2984
- collapsed: Q,
2985
- onToggleCollapsed: () => J((b) => !b),
3042
+ annotations: b,
3043
+ collapsed: oe,
3044
+ onToggleCollapsed: () => re((y) => !y),
2986
3045
  onClose: () => {
2987
- ne(!0), J(!1);
3046
+ j(!0), re(!1);
2988
3047
  },
2989
- onCopyAll: () => qe("session"),
2990
- onCopyOne: zt,
2991
- onRemove: x,
2992
- onUpdate: E,
3048
+ onCopyAll: () => Qe("session"),
3049
+ onCopyOne: Ut,
3050
+ onRemove: w,
3051
+ onUpdate: N,
2993
3052
  copyStatus: D,
2994
- copiedEntryId: _,
2995
- copyAllFrom: z
3053
+ copiedEntryId: T,
3054
+ copyAllFrom: X
2996
3055
  }
2997
3056
  )
2998
3057
  ]
2999
3058
  }
3000
3059
  );
3001
3060
  }
3002
- function Cr() {
3061
+ function Ir() {
3003
3062
  return typeof process < "u" && process.env.NODE_ENV !== "production";
3004
3063
  }
3005
- function Er() {
3006
- return Cr() ? /* @__PURE__ */ n(kr, {}) : null;
3064
+ function Or() {
3065
+ return Ir() ? /* @__PURE__ */ n($r, {}) : null;
3007
3066
  }
3008
3067
  export {
3009
- kr as PixelAgent,
3010
- Er as PixelAgentDev,
3011
- Cr as isDevEnvironment
3068
+ $r as PixelAgent,
3069
+ Or as PixelAgentDev,
3070
+ Ir as isDevEnvironment
3012
3071
  };
3013
3072
  //# sourceMappingURL=pixelagent.js.map