pixelagent 0.1.17 → 0.1.19

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