pixelagent 0.1.16 → 0.1.18

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,6 +1,6 @@
1
1
  import { jsxs as d, Fragment as K, jsx as n } from "react/jsx-runtime";
2
- import { useState as S, useEffect as H, useRef as Y, useMemo as xe, useLayoutEffect as Kt, useCallback as E, useId as jt } from "react";
3
- import { getElementDisplayLabel as Xe, captureTextSnapshot as tt, captureInlineStyles as nt, restoreInlineStyles as we, restoreTextSnapshot as ke, getPreviewTargets as $e, clearTailwindStatePreview as Ce, applyTailwindStatePreview as ze, setEditableTextPreview as rt, getRelevantComputedStyles as Me, getEditableTextInfo as fe, readReactSource as Ge, detectStylingSystem as kt, countElementInstances as Ct, getScopeSelector as Mt, getCssSelector as At, copyToClipboard as St, getWindowSelectionText as Lt, getNearestReactComponentName as qt, getDomPath as Jt, resolveElementFromEntry as Et, getAnnotationSessionDisplay as Zt, loadAnnotationSession as Qt, saveAnnotationSession as en, DEFAULT_PIXEL_AGENT_UI_SETTINGS as tn, readHostThemeFromDocument as it, resolvePixelAgentChrome as nn, applyHostThemeToDocument as rn, pixelAgentRootAttributes as an, getElementsInArea as on, formatAllAnnotations as sn, formatAnnotation as ln } from "@pixelagent/shared";
2
+ import { useState as A, useEffect as H, useRef as X, useMemo as ke, useLayoutEffect as Kt, useCallback as E, useId as jt } from "react";
3
+ import { getElementDisplayLabel as Xe, captureTextSnapshot as tt, captureInlineStyles as nt, restoreInlineStyles as Ne, restoreTextSnapshot as Me, getPreviewTargets as Te, clearTailwindStatePreview as Ae, applyTailwindStatePreview as ze, setEditableTextPreview as rt, getRelevantComputedStyles as Se, getEditableTextInfo as fe, readReactSource as Ge, detectStylingSystem as kt, countElementInstances as Ct, getScopeSelector as Mt, getCssSelector as At, copyToClipboard as St, getWindowSelectionText as Lt, getNearestReactComponentName as qt, getDomPath as Jt, resolveElementFromEntry as Et, getAnnotationSessionDisplay as Zt, loadAnnotationSession as Qt, saveAnnotationSession as en, DEFAULT_PIXEL_AGENT_UI_SETTINGS as tn, readHostThemeFromDocument as it, resolvePixelAgentChrome as nn, applyHostThemeToDocument as rn, pixelAgentRootAttributes as an, getElementsInArea as on, formatAllAnnotations as sn, formatAnnotation as ln } from "@pixelagent/shared";
4
4
  export * from "@pixelagent/shared";
5
5
  import { createPortal as Ke } from "react-dom";
6
6
  function $t({
@@ -9,7 +9,7 @@ function $t({
9
9
  multiSelected: i = [],
10
10
  primarySelected: r = null
11
11
  }) {
12
- const [a, s] = S([]), o = r ?? t;
12
+ const [a, s] = A([]), o = r ?? t;
13
13
  if (H(() => {
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);
@@ -80,24 +80,24 @@ function dn(e, t, i, r = It) {
80
80
  const u = c.getContext("2d");
81
81
  if (!u) return null;
82
82
  const l = u.createImageData(s, o), f = l.data, p = Math.min(0.5, i / Math.min(e, t)), v = 0.3, m = 0.2, g = Math.max(0.4, p + 0.1);
83
- let b = 0;
84
- const L = new Float32Array(s * o * 2);
85
- let N = 0;
86
- for (let k = 0; k < o; k++)
83
+ let y = 0;
84
+ const S = new Float32Array(s * o * 2);
85
+ let w = 0;
86
+ for (let N = 0; N < o; N++)
87
87
  for (let $ = 0; $ < s; $++) {
88
- const P = $ / s - 0.5, R = k / o - 0.5, x = un(P, R, v, m, g), I = at(0.8, 0, x - 0.15), C = at(0, 1, I), h = (P * C + 0.5) * s - $, O = (R * C + 0.5) * o - k;
89
- Math.abs(h) > b && (b = Math.abs(h)), Math.abs(O) > b && (b = Math.abs(O)), L[N++] = h, L[N++] = O;
88
+ const _ = $ / s - 0.5, R = N / o - 0.5, x = un(_, R, v, m, g), I = at(0.8, 0, x - 0.15), L = at(0, 1, I), h = (_ * L + 0.5) * s - $, F = (R * L + 0.5) * o - 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
90
  }
91
- if (b === 0) return null;
92
- b *= 0.4 * r;
93
- let w = 0;
94
- for (let k = 0; k < f.length; k += 4) {
95
- const $ = L[w++] / b + 0.5, P = L[w++] / b + 0.5;
96
- f[k] = $ * 255, f[k + 1] = P * 255, f[k + 2] = 0, f[k + 3] = 255;
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 $ = S[k++] / y + 0.5, _ = S[k++] / y + 0.5;
96
+ f[N] = $ * 255, f[N + 1] = _ * 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 / a,
101
101
  width: s,
102
102
  height: o
103
103
  };
@@ -137,23 +137,23 @@ function Tt({
137
137
  style: s,
138
138
  children: o
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" ? cn : It, l = X(null), f = ke(() => `pa-lg-${++fn}`, []), [p, v] = A(null);
141
141
  Kt(() => {
142
142
  const g = l.current;
143
143
  if (!g) return;
144
- let b = 0;
145
- const L = () => {
146
- cancelAnimationFrame(b), b = requestAnimationFrame(() => {
147
- const w = g.getBoundingClientRect(), k = Math.round(w.width), $ = Math.round(w.height);
148
- if (k < 8 || $ < 8) return;
149
- const P = e === "capsule" ? $ / 2 : Math.min(c, k / 2, $ / 2), R = dn(k, $, P, u);
144
+ let y = 0;
145
+ const S = () => {
146
+ cancelAnimationFrame(y), y = requestAnimationFrame(() => {
147
+ const k = g.getBoundingClientRect(), N = Math.round(k.width), $ = Math.round(k.height);
148
+ if (N < 8 || $ < 8) return;
149
+ const _ = e === "capsule" ? $ / 2 : Math.min(c, N / 2, $ / 2), R = dn(N, $, _, u);
150
150
  R && v(R);
151
151
  });
152
152
  };
153
- L();
154
- const N = new ResizeObserver(L);
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(
@@ -251,7 +251,7 @@ function V({
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 = "",
@@ -273,7 +273,7 @@ function Rt({
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 = E(() => {
276
+ const [i, r] = A(e), [a, s] = A(!1), o = X(null), c = X(null), u = E(() => {
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,24 +305,24 @@ 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 L = g.getBoundingClientRect();
311
- b = { x: L.left, y: L.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
313
  o.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 = E((m) => {
323
323
  if (!o.current || o.current.pointerId !== m.pointerId) return;
324
- const g = c.current, b = (g == null ? void 0 : g.offsetWidth) ?? 320, L = (g == null ? void 0 : g.offsetHeight) ?? 48, N = m.clientX - o.current.startX, w = m.clientY - o.current.startY, k = Math.max(8, Math.min(window.innerWidth - b - 8, o.current.originX + N)), $ = Math.max(8, Math.min(window.innerHeight - L - 8, o.current.originY + w));
325
- r({ x: k, y: $ });
324
+ const g = c.current, y = (g == null ? void 0 : g.offsetWidth) ?? 320, S = (g == null ? void 0 : g.offsetHeight) ?? 48, w = m.clientX - o.current.startX, k = m.clientY - o.current.startY, N = Math.max(8, Math.min(window.innerWidth - y - 8, o.current.originX + w)), $ = Math.max(8, Math.min(window.innerHeight - S - 8, o.current.originY + k));
325
+ r({ x: N, y: $ });
326
326
  }, []), p = E((m) => {
327
327
  if (!(!o.current || o.current.pointerId !== m.pointerId)) {
328
328
  o.current = null, s(!1);
@@ -482,56 +482,56 @@ function Nn() {
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), L = e.toLowerCase().includes("color") ? e : `${e} color`;
485
+ const [r, a] = A(!1), [s, o] = A(() => ot(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 = bn(Pt(m)), y = je(t) ? t : vn(m), S = e.toLowerCase().includes("color") ? e : `${e} color`;
486
486
  H(() => {
487
487
  o(ot(t));
488
488
  }, [t]);
489
- const N = E(
489
+ const w = E(
490
490
  (x) => {
491
491
  o(x), i(wn(x));
492
492
  },
493
493
  [i]
494
- ), w = E(
494
+ ), k = E(
495
495
  (x) => {
496
- N(Dt(x));
496
+ w(Dt(x));
497
497
  },
498
- [N]
499
- ), k = E(() => {
498
+ [w]
499
+ ), N = E(() => {
500
500
  const x = c.current;
501
501
  if (!x) return;
502
- const I = x.getBoundingClientRect(), C = 260;
502
+ const I = x.getBoundingClientRect(), L = 260;
503
503
  let h = I.left;
504
- h + C > window.innerWidth - 12 && (h = window.innerWidth - C - 12), h = Math.max(12, h);
505
- let O = I.bottom + 8;
504
+ h + L > window.innerWidth - 12 && (h = window.innerWidth - L - 12), h = Math.max(12, h);
505
+ let F = I.bottom + 8;
506
506
  const U = 320;
507
- O + U > window.innerHeight - 12 && (O = Math.max(12, I.top - U - 8)), v({ top: O, left: h, width: C });
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
  H(() => {
510
510
  if (!r) return;
511
- k();
512
- const x = (C) => {
513
- var O, U;
514
- const h = C.target;
515
- (O = c.current) != null && O.contains(h) || (U = u.current) != null && U.contains(h) || a(!1);
516
- }, I = (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) || a(!1);
516
+ }, I = (L) => {
517
+ L.key === "Escape" && a(!1);
518
518
  };
519
- return window.addEventListener("mousedown", x, !0), window.addEventListener("keydown", I), window.addEventListener("resize", k), window.addEventListener("scroll", k, !0), () => {
520
- window.removeEventListener("mousedown", x, !0), window.removeEventListener("keydown", I), window.removeEventListener("resize", k), window.removeEventListener("scroll", k, !0);
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]);
522
+ }, [r, N]);
523
523
  const $ = (x, I) => {
524
524
  var U;
525
- const C = (U = l.current) == null ? void 0 : U.getBoundingClientRect();
526
- if (!C) return;
527
- const { x: h, y: O } = xn(x, I, C);
528
- N({ ...s, s: h, v: 100 - O });
529
- }, P = (x) => {
525
+ const L = (U = l.current) == null ? void 0 : U.getBoundingClientRect();
526
+ if (!L) return;
527
+ const { x: h, y: F } = xn(x, I, L);
528
+ w({ ...s, s: h, v: 100 - F });
529
+ }, _ = (x) => {
530
530
  x.preventDefault(), $(x.clientX, x.clientY);
531
- const I = (h) => $(h.clientX, h.clientY), C = () => {
532
- window.removeEventListener("mousemove", I), window.removeEventListener("mouseup", C);
531
+ const I = (h) => $(h.clientX, h.clientY), L = () => {
532
+ window.removeEventListener("mousemove", I), window.removeEventListener("mouseup", L);
533
533
  };
534
- window.addEventListener("mousemove", I), 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",
@@ -545,7 +545,7 @@ function _e({ label: e, value: t, onChange: i }) {
545
545
  ref: u,
546
546
  id: f,
547
547
  role: "dialog",
548
- "aria-label": L,
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: L })
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: _,
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(yn(x.target.value, m))
612
612
  }
613
613
  )
614
614
  ] }),
@@ -623,8 +623,8 @@ function _e({ label: e, value: t, onChange: i }) {
623
623
  max: 255,
624
624
  value: m[x],
625
625
  onChange: (I) => {
626
- const C = kn(parseInt(I.target.value, 10));
627
- w({ ...m, [x]: C });
626
+ const L = kn(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(), a((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
  {
@@ -673,7 +673,7 @@ function kn(e) {
673
673
  return Number.isFinite(e) ? Math.min(255, Math.max(0, e)) : 0;
674
674
  }
675
675
  function ue({ title: e, children: t, defaultOpen: i = !0, badge: r }) {
676
- const [a, s] = S(i);
676
+ const [a, s] = A(i);
677
677
  return /* @__PURE__ */ d("section", { className: `pa-edit-section ${a ? "pa-edit-section--open" : ""}`, children: [
678
678
  /* @__PURE__ */ d(
679
679
  "button",
@@ -705,8 +705,8 @@ 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
+ ], Re = "";
709
+ function Le(e) {
710
710
  var i;
711
711
  return (((i = e.split(",")[0]) == null ? void 0 : i.trim()) ?? "").replace(/^["']|["']$/g, "");
712
712
  }
@@ -714,28 +714,28 @@ function Cn(e) {
714
714
  const t = e.trim();
715
715
  if (!t)
716
716
  return {
717
- selectValue: Ie,
717
+ selectValue: Re,
718
718
  options: pe
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 = pe.find(
721
+ (s) => s.value === t || Le(s.value).toLowerCase() === i
722
722
  );
723
723
  if (r)
724
724
  return { selectValue: r.value, options: pe };
725
725
  const a = pe.find((s) => {
726
- const o = Ae(s.value).toLowerCase();
726
+ const o = Le(s.value).toLowerCase();
727
727
  return t.toLowerCase().includes(o) || o.includes(i);
728
728
  });
729
729
  return a ? { selectValue: a.value, options: pe } : {
730
730
  selectValue: t,
731
731
  options: [
732
732
  ...pe,
733
- { value: t, label: Ae(t) || "Custom" }
733
+ { value: t, label: Le(t) || "Custom" }
734
734
  ]
735
735
  };
736
736
  }
737
737
  function Mn({ value: e, onChange: t }) {
738
- const { selectValue: i, options: r } = xe(
738
+ const { selectValue: i, options: r } = ke(
739
739
  () => Cn(e),
740
740
  [e]
741
741
  );
@@ -745,13 +745,13 @@ function Mn({ value: e, onChange: t }) {
745
745
  "select",
746
746
  {
747
747
  className: "pa-select pa-font-family-select",
748
- value: i || Ie,
748
+ value: i || Re,
749
749
  onChange: (a) => {
750
750
  const s = a.target.value;
751
- s && s !== Ie && t(s);
751
+ s && s !== Re && t(s);
752
752
  },
753
753
  children: [
754
- /* @__PURE__ */ n("option", { value: Ie, disabled: !0, children: "Select font style" }),
754
+ /* @__PURE__ */ n("option", { value: Re, disabled: !0, children: "Select font style" }),
755
755
  r.map((a) => /* @__PURE__ */ n("option", { value: a.value, children: a.label }, a.value))
756
756
  ]
757
757
  }
@@ -928,7 +928,7 @@ function Pn() {
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 Ee({ 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 },
@@ -949,7 +949,7 @@ function Dn() {
949
949
  ] });
950
950
  }
951
951
  function he({ icon: e, display: t, ariaLabel: i, mixed: r, onCommit: a }) {
952
- const [s, o] = S(t);
952
+ const [s, o] = A(t);
953
953
  return H(() => {
954
954
  o(t);
955
955
  }, [t]), /* @__PURE__ */ d("label", { className: `pa-spacing-cell ${r ? "pa-spacing-cell--mixed" : ""}`, children: [
@@ -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 = In(t), [a, s] = A(!1), o = (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: [
@@ -990,7 +990,7 @@ function ut({ label: e, value: t, onChange: i }) {
990
990
  /* @__PURE__ */ n(
991
991
  he,
992
992
  {
993
- icon: /* @__PURE__ */ n(Se, { side: "left" }),
993
+ icon: /* @__PURE__ */ n(Ee, { side: "left" }),
994
994
  display: le(r.left),
995
995
  ariaLabel: `${e} left`,
996
996
  onCommit: (l) => o({ left: ce(l) })
@@ -999,7 +999,7 @@ function ut({ label: e, value: t, onChange: i }) {
999
999
  /* @__PURE__ */ n(
1000
1000
  he,
1001
1001
  {
1002
- icon: /* @__PURE__ */ n(Se, { side: "top" }),
1002
+ icon: /* @__PURE__ */ n(Ee, { side: "top" }),
1003
1003
  display: le(r.top),
1004
1004
  ariaLabel: `${e} top`,
1005
1005
  onCommit: (l) => o({ top: ce(l) })
@@ -1008,7 +1008,7 @@ function ut({ label: e, value: t, onChange: i }) {
1008
1008
  /* @__PURE__ */ n(
1009
1009
  he,
1010
1010
  {
1011
- icon: /* @__PURE__ */ n(Se, { side: "right" }),
1011
+ icon: /* @__PURE__ */ n(Ee, { side: "right" }),
1012
1012
  display: le(r.right),
1013
1013
  ariaLabel: `${e} right`,
1014
1014
  onCommit: (l) => o({ right: ce(l) })
@@ -1017,7 +1017,7 @@ function ut({ label: e, value: t, onChange: i }) {
1017
1017
  /* @__PURE__ */ n(
1018
1018
  he,
1019
1019
  {
1020
- icon: /* @__PURE__ */ n(Se, { side: "bottom" }),
1020
+ icon: /* @__PURE__ */ n(Ee, { side: "bottom" }),
1021
1021
  display: le(r.bottom),
1022
1022
  ariaLabel: `${e} bottom`,
1023
1023
  onCommit: (l) => o({ bottom: ce(l) })
@@ -1208,10 +1208,10 @@ function Gn({
1208
1208
  scopeHint: f,
1209
1209
  stateHint: p
1210
1210
  }) {
1211
- var I, C;
1212
- const v = e["font-weight"] ?? "", m = e["font-style"] ?? "normal", g = e["text-decoration"] ?? "none", b = Yn(e["text-align"] ?? "left"), L = ((I = e.display) == null ? void 0 : I.trim()) ?? "", N = !!L, w = Xn.has(L), k = [...mt];
1213
- L && !mt.includes(L) && k.push(L);
1214
- const $ = ((C = e.gap) == null ? void 0 : C.trim()) ?? "", P = $ === "normal" || $ === "" ? "0px" : $, R = e["border-style"] ?? "none", x = [...ft];
1211
+ var I, L;
1212
+ const v = e["font-weight"] ?? "", m = e["font-style"] ?? "normal", g = e["text-decoration"] ?? "none", y = Yn(e["text-align"] ?? "left"), S = ((I = e.display) == null ? void 0 : I.trim()) ?? "", w = !!S, k = Xn.has(S), N = [...mt];
1213
+ S && !mt.includes(S) && N.push(S);
1214
+ const $ = ((L = e.gap) == null ? void 0 : L.trim()) ?? "", _ = $ === "normal" || $ === "" ? "0px" : $, 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
1216
  /* @__PURE__ */ d(ue, { title: "Targeting", defaultOpen: !0, children: [
1217
1217
  /* @__PURE__ */ d("div", { className: "pa-edit-field-grid pa-edit-field-grid--2", children: [
@@ -1327,7 +1327,7 @@ function Gn({
1327
1327
  On,
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
  {
@@ -1426,25 +1426,25 @@ 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: L,
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(
1441
+ k && /* @__PURE__ */ n(
1442
1442
  ie,
1443
1443
  {
1444
1444
  compact: !0,
1445
1445
  property: "gap",
1446
1446
  label: "Gap",
1447
- value: P,
1447
+ value: _,
1448
1448
  onChange: (h) => t("gap", h)
1449
1449
  }
1450
1450
  )
@@ -1536,136 +1536,145 @@ const Kn = 50, gt = [
1536
1536
  "opacity"
1537
1537
  ];
1538
1538
  function jn(e, t, i) {
1539
- var ee;
1540
- const r = Y([]), a = Y(/* @__PURE__ */ new Set()), s = Y([]), o = Y(null), c = Y([]), [u, l] = S({}), [f, p] = S({}), [v, m] = S("none"), [g, b] = S(""), [L, N] = S(""), [w, k] = S(() => /* @__PURE__ */ new Map()), [$, P] = S(!1), R = E(() => {
1541
- const M = Array.from(a.current);
1539
+ var oe;
1540
+ const r = X([]), a = X(/* @__PURE__ */ new Set()), s = X([]), o = 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, $] = A(() => /* @__PURE__ */ new Map()), [_, R] = A(!1), x = E(() => {
1543
+ const C = Array.from(a.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 = E(() => {
1547
- c.current.push(R()), c.current.length > Kn && c.current.shift(), P(c.current.length > 0);
1548
- }, [R]), I = E(
1549
- (M) => {
1550
- var T;
1548
+ }, [e, m]), I = E(() => {
1549
+ c.current.push(x()), c.current.length > Kn && c.current.shift(), R(c.current.length > 0);
1550
+ }, [x]), L = E(
1551
+ (C) => {
1552
+ var Y;
1551
1553
  if (!e) return;
1552
- const F = Array.from(a.current);
1553
- we(s.current.filter((_) => F.includes(_.element))), o.current && ke(o.current);
1554
- const D = $e(e, t);
1555
- r.current = D, a.current = new Set(D), Ce(F), ze(D, i);
1556
- const z = e ? ((T = w.get(e)) == null ? void 0 : T.get(i)) ?? [] : [];
1557
- if (M && z.length > 0)
1558
- for (const _ of z)
1559
- if (_.property === "textContent" || _.property === "value")
1560
- for (const X of D)
1561
- rt(X, _.property, _.newValue);
1554
+ const P = Array.from(a.current);
1555
+ Ne(s.current.filter((T) => P.includes(T.element))), o.current && Me(o.current);
1556
+ const O = Te(e, t);
1557
+ r.current = O, a.current = new Set(O), Ae(P), ze(O, i);
1558
+ const D = e ? ((Y = N.get(e)) == null ? void 0 : Y.get(i)) ?? [] : [];
1559
+ if (C && D.length > 0)
1560
+ for (const T of D)
1561
+ if (T.property === "textContent" || T.property === "value")
1562
+ for (const z of O)
1563
+ rt(z, T.property, T.newValue);
1562
1564
  else
1563
- for (const X of D)
1564
- X.style.setProperty(_.property, _.newValue);
1565
+ for (const z of O)
1566
+ z.style.setProperty(T.property, T.newValue);
1565
1567
  },
1566
- [e, t, i, w]
1568
+ [e, t, i, N]
1567
1569
  );
1568
1570
  H(() => {
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 = [], a.current = /* @__PURE__ */ new Set(), s.current = [], o.current = null, c.current = [], f({}), v({}), g("none"), S(""), k(""), $(/* @__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 F = Me(e);
1576
- l(F), p(F);
1577
- const D = fe(e);
1578
- return m(D.kind), b(D.value), N(D.value), o.current = D.kind !== "none" ? tt(e, D.kind) : null, ze(M, i), () => Ce(M);
1575
+ const C = Te(e, t);
1576
+ r.current = C, a.current = new Set(C), s.current = nt(C, [...gt]), c.current = [], R(!1);
1577
+ const P = Se(e);
1578
+ f(P), v(P);
1579
+ const O = fe(e);
1580
+ return g(O.kind), S(O.value), k(O.value), o.current = O.kind !== "none" ? tt(e, O.kind) : null, ze(C, i), () => Ae(C);
1579
1581
  }, [e]), H(() => {
1580
- e && I(!0);
1582
+ e && L(!0);
1581
1583
  }, [t]), H(() => {
1582
- var D;
1584
+ var Y;
1583
1585
  if (!e) return;
1584
- const M = $e(e, t);
1585
- r.current = M, we(
1586
- s.current.filter((z) => M.includes(z.element))
1586
+ const C = Te(e, t);
1587
+ r.current = C, Ne(
1588
+ s.current.filter((T) => C.includes(T.element))
1587
1589
  );
1588
- const F = ((D = w.get(e)) == null ? void 0 : D.get(i)) ?? [];
1589
- for (const z of F)
1590
- if (!(z.property === "textContent" || z.property === "value"))
1591
- for (const T of M)
1592
- T.style.setProperty(z.property, z.newValue);
1593
- Ce(Array.from(a.current)), ze(M, i), a.current = new Set(M);
1590
+ const P = ((Y = N.get(e)) == null ? void 0 : Y.get(i)) ?? [];
1591
+ for (const T of P)
1592
+ if (!(T.property === "textContent" || T.property === "value"))
1593
+ for (const z of C)
1594
+ z.style.setProperty(T.property, T.newValue);
1595
+ const O = u.current;
1596
+ if (O !== null && O.element === e && O.state !== i) {
1597
+ const T = { ...p };
1598
+ for (const z of P)
1599
+ z.property === "textContent" || z.property === "value" || (T[z.property] = z.newValue);
1600
+ f(T);
1601
+ }
1602
+ u.current = { element: e, state: i }, Ae(Array.from(a.current)), ze(C, i), a.current = new Set(C);
1594
1603
  }, [i, e, t]);
1595
- const C = E(
1596
- (M, F, D) => {
1597
- e && k((z) => {
1598
- const T = new Map(z), _ = new Map(T.get(e) ?? /* @__PURE__ */ new Map()), q = (_.get(i) ?? []).filter((Re) => Re.property !== M);
1599
- return D === F ? q.length === 0 ? _.delete(i) : _.set(i, q) : _.set(i, [...q, { property: M, oldValue: F, newValue: D }]), _.size === 0 ? T.delete(e) : T.set(e, _), T;
1604
+ const h = E(
1605
+ (C, P, O) => {
1606
+ e && $((D) => {
1607
+ const Y = new Map(D), T = new Map(Y.get(e) ?? /* @__PURE__ */ new Map()), ve = (T.get(i) ?? []).filter((be) => be.property !== C);
1608
+ return O === P ? ve.length === 0 ? T.delete(i) : T.set(i, ve) : T.set(i, [...ve, { property: C, oldValue: P, newValue: O }]), T.size === 0 ? Y.delete(e) : Y.set(e, T), Y;
1600
1609
  });
1601
1610
  },
1602
1611
  [e, i]
1603
- ), h = E(
1604
- (M, F) => {
1612
+ ), F = E(
1613
+ (C, P) => {
1605
1614
  if (!e) return;
1606
- const D = { [M]: F };
1607
- M === "border-width" && (u["border-style"] ?? "none") === "none" && Sn(F) && (D["border-style"] = "solid"), x(), l((z) => ({ ...z, ...D }));
1608
- for (const [z, T] of Object.entries(D)) {
1609
- const _ = f[z] ?? "";
1610
- for (const X of r.current)
1611
- X.style.setProperty(z, T), a.current.add(X);
1612
- C(z, _, T);
1615
+ const O = { [C]: P };
1616
+ C === "border-width" && (l["border-style"] ?? "none") === "none" && Sn(P) && (O["border-style"] = "solid"), I(), f((D) => ({ ...D, ...O }));
1617
+ for (const [D, Y] of Object.entries(O)) {
1618
+ const T = p[D] ?? "";
1619
+ for (const z of r.current)
1620
+ z.style.setProperty(D, Y), a.current.add(z);
1621
+ h(D, T, Y);
1613
1622
  }
1614
1623
  },
1615
- [e, f, u, x, C]
1616
- ), O = E(
1617
- (M) => {
1618
- if (!(!e || v === "none")) {
1619
- x(), b(M);
1620
- for (const F of r.current)
1621
- rt(F, v, M), a.current.add(F);
1622
- C(v, L, M);
1624
+ [e, p, l, I, h]
1625
+ ), U = E(
1626
+ (C) => {
1627
+ if (!(!e || m === "none")) {
1628
+ I(), S(C);
1629
+ for (const P of r.current)
1630
+ rt(P, m, C), a.current.add(P);
1631
+ h(m, w, C);
1623
1632
  }
1624
1633
  },
1625
- [e, v, L, x, C]
1626
- ), U = E(() => {
1627
- const M = c.current.pop();
1628
- if (M && (we(M.inline), M.text && ke(M.text), P(c.current.length > 0), e)) {
1629
- l(Me(e));
1630
- const F = fe(e);
1631
- F.kind !== "none" && b(F.value);
1634
+ [e, m, w, I, h]
1635
+ ), ge = E(() => {
1636
+ const C = c.current.pop();
1637
+ if (C && (Ne(C.inline), C.text && Me(C.text), R(c.current.length > 0), e)) {
1638
+ f(Se(e));
1639
+ const P = fe(e);
1640
+ P.kind !== "none" && S(P.value);
1632
1641
  }
1633
- }, [e]), ge = E(() => {
1634
- if (we(s.current), o.current && ke(o.current), c.current = [], P(!1), k(/* @__PURE__ */ new Map()), e) {
1635
- l(Me(e));
1636
- const M = fe(e);
1637
- b(M.value);
1642
+ }, [e]), Z = E(() => {
1643
+ if (Ne(s.current), o.current && Me(o.current), c.current = [], R(!1), $(/* @__PURE__ */ new Map()), e) {
1644
+ f(Se(e));
1645
+ const C = fe(e);
1646
+ S(C.value);
1638
1647
  }
1639
- }, [e]), j = E(() => {
1640
- we(s.current), o.current && ke(o.current);
1641
- }, []), oe = E(() => {
1642
- if (j(), Ce(Array.from(a.current)), c.current = [], P(!1), k(/* @__PURE__ */ new Map()), e) {
1643
- l(Me(e));
1644
- const M = fe(e);
1645
- M.kind !== "none" && b(M.value);
1648
+ }, [e]), te = E(() => {
1649
+ Ne(s.current), o.current && Me(o.current);
1650
+ }, []), re = E(() => {
1651
+ if (te(), Ae(Array.from(a.current)), c.current = [], R(!1), $(/* @__PURE__ */ new Map()), e) {
1652
+ f(Se(e));
1653
+ const C = fe(e);
1654
+ C.kind !== "none" && S(C.value);
1646
1655
  }
1647
- }, [j, e]), re = e ? ((ee = w.get(e)) == null ? void 0 : ee.get(i)) ?? [] : [];
1648
- let W = 0;
1649
- for (const M of w.values())
1650
- for (const F of M.values()) W += F.length;
1651
- const G = E(() => {
1652
- k(/* @__PURE__ */ new Map());
1656
+ }, [te, e]), W = e ? ((oe = N.get(e)) == null ? void 0 : oe.get(i)) ?? [] : [];
1657
+ let G = 0;
1658
+ for (const C of N.values())
1659
+ for (const P of C.values()) G += P.length;
1660
+ const ne = E(() => {
1661
+ $(/* @__PURE__ */ new Map());
1653
1662
  }, []);
1654
1663
  return {
1655
- values: u,
1656
- textKind: v,
1657
- textValue: g,
1658
- pendingChanges: re,
1659
- pendingByElement: w,
1660
- totalPendingCount: W,
1661
- clearAllPending: G,
1662
- canUndo: $,
1663
- updateProperty: h,
1664
- updateText: O,
1665
- undo: U,
1666
- reset: ge,
1667
- clearPreviews: oe,
1668
- revertPreviews: j
1664
+ values: l,
1665
+ textKind: m,
1666
+ textValue: y,
1667
+ pendingChanges: W,
1668
+ pendingByElement: N,
1669
+ totalPendingCount: G,
1670
+ clearAllPending: ne,
1671
+ canUndo: _,
1672
+ updateProperty: F,
1673
+ updateText: U,
1674
+ undo: ge,
1675
+ reset: Z,
1676
+ clearPreviews: re,
1677
+ revertPreviews: te
1669
1678
  };
1670
1679
  }
1671
1680
  function qn({
@@ -1686,63 +1695,63 @@ function qn({
1686
1695
  values: v,
1687
1696
  textKind: m,
1688
1697
  textValue: g,
1689
- pendingChanges: b,
1690
- pendingByElement: L,
1691
- totalPendingCount: N,
1692
- clearAllPending: w,
1693
- canUndo: k,
1698
+ pendingChanges: y,
1699
+ pendingByElement: S,
1700
+ totalPendingCount: w,
1701
+ clearAllPending: k,
1702
+ canUndo: N,
1694
1703
  updateProperty: $,
1695
- updateText: P,
1704
+ updateText: _,
1696
1705
  undo: R,
1697
1706
  reset: x,
1698
1707
  clearPreviews: I,
1699
- revertPreviews: C
1700
- } = jn(e, a, o), { elementRef: h, isDragging: O, style: U, dragHandleProps: ge } = Rt({
1701
- computeDefaultPosition: (T) => ({
1702
- x: window.innerWidth - T.width - 16,
1708
+ revertPreviews: L
1709
+ } = jn(e, a, o), { elementRef: h, isDragging: F, style: U, dragHandleProps: ge } = Rt({
1710
+ computeDefaultPosition: (D) => ({
1711
+ x: window.innerWidth - D.width - 16,
1703
1712
  y: 16
1704
1713
  })
1705
1714
  });
1706
- H(() => (p == null || p({ clearPreviews: I, revertPreviews: C }), () => p == null ? void 0 : p(null)), [p, I, C]);
1707
- const j = E(
1708
- (T) => {
1709
- if (f(T.target)) return;
1710
- const X = document.elementsFromPoint(T.clientX, T.clientY).find(
1711
- (q) => q instanceof Element && !q.closest(
1715
+ H(() => (p == null || p({ clearPreviews: I, revertPreviews: L }), () => p == null ? void 0 : p(null)), [p, I, L]);
1716
+ const Z = E(
1717
+ (D) => {
1718
+ if (f(D.target)) return;
1719
+ const T = document.elementsFromPoint(D.clientX, D.clientY).find(
1720
+ (z) => z instanceof Element && !z.closest(
1712
1721
  "[data-pixelagent-root],[data-pixelagent-toolbar-portal],[data-pixelagent-picker-portal]"
1713
1722
  )
1714
1723
  );
1715
- r(X ?? null);
1724
+ r(T ?? null);
1716
1725
  },
1717
1726
  [f, r]
1718
- ), oe = E(
1719
- (T) => {
1720
- if (f(T.target)) return;
1721
- T.preventDefault(), T.stopPropagation();
1722
- const X = document.elementsFromPoint(T.clientX, T.clientY).find(
1723
- (q) => q instanceof Element && !q.closest(
1727
+ ), te = E(
1728
+ (D) => {
1729
+ if (f(D.target)) return;
1730
+ D.preventDefault(), D.stopPropagation();
1731
+ const T = document.elementsFromPoint(D.clientX, D.clientY).find(
1732
+ (z) => z instanceof Element && !z.closest(
1724
1733
  "[data-pixelagent-root],[data-pixelagent-toolbar-portal],[data-pixelagent-picker-portal]"
1725
1734
  )
1726
1735
  );
1727
- i(X ?? null);
1736
+ i(T ?? null);
1728
1737
  },
1729
1738
  [f, i]
1730
1739
  );
1731
- H(() => (document.addEventListener("mousemove", j, !0), document.addEventListener("click", oe, !0), () => {
1732
- document.removeEventListener("mousemove", j, !0), document.removeEventListener("click", oe, !0);
1733
- }), [j, oe]);
1740
+ H(() => (document.addEventListener("mousemove", Z, !0), document.addEventListener("click", te, !0), () => {
1741
+ document.removeEventListener("mousemove", Z, !0), document.removeEventListener("click", te, !0);
1742
+ }), [Z, te]);
1734
1743
  const re = async () => {
1735
- if (N === 0) return;
1736
- const T = await u(L);
1737
- T.applied && (w(), T.skipRevert || C());
1738
- }, W = e ? Ge(e) : null, G = e ? kt(e) : null, ee = e ? Ct(e) : 0, M = e ? Mt(e, "all-instances") : "", F = o !== "normal" && G === "tailwind" ? "Tailwind variant preview: matching hover:/focus:/… classes are applied without the prefix." : o !== "normal" ? "State preview uses focus/disabled simulation where possible." : null, D = ee > 1 ? a === "all-instances" ? `Preview & Apply on ${ee} elements (${M}).` : `This instance only — ${ee - 1} other on page.` : a === "all-instances" ? "Only one match — scope has no effect." : null, z = xe(() => !e || a !== "all-instances" ? [] : $e(e, "all-instances"), [e, a]);
1744
+ if (w === 0) return;
1745
+ const D = await u(S);
1746
+ D.applied && (k(), D.skipRevert || L());
1747
+ }, W = e ? Ge(e) : null, G = e ? kt(e) : null, ne = e ? Ct(e) : 0, oe = e ? Mt(e, "all-instances") : "", C = 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, P = ne > 1 ? a === "all-instances" ? `Preview & Apply on ${ne} elements (${oe}).` : `This instance only — ${ne - 1} other on page.` : a === "all-instances" ? "Only one match — scope has no effect." : null, O = ke(() => !e || a !== "all-instances" ? [] : Te(e, "all-instances"), [e, a]);
1739
1748
  return /* @__PURE__ */ d(K, { children: [
1740
1749
  /* @__PURE__ */ n(
1741
1750
  $t,
1742
1751
  {
1743
1752
  element: a === "all-instances" ? null : t,
1744
1753
  selected: e,
1745
- multiSelected: z,
1754
+ multiSelected: O,
1746
1755
  primarySelected: e
1747
1756
  }
1748
1757
  ),
@@ -1750,9 +1759,9 @@ function qn({
1750
1759
  "div",
1751
1760
  {
1752
1761
  ref: h,
1753
- className: `pa-edit-panel-float ${O ? "pa-edit-panel-float--dragging" : ""}`,
1762
+ className: `pa-edit-panel-float ${F ? "pa-edit-panel-float--dragging" : ""}`,
1754
1763
  style: U,
1755
- children: /* @__PURE__ */ n(Te, { variant: "sheet", side: "right", className: "pa-edit-panel-glass", children: /* @__PURE__ */ d("div", { className: "pa-edit-panel-inner", children: [
1764
+ children: /* @__PURE__ */ n(Pe, { variant: "sheet", side: "right", className: "pa-edit-panel-glass", children: /* @__PURE__ */ d("div", { className: "pa-edit-panel-inner", children: [
1756
1765
  /* @__PURE__ */ d("div", { className: "pa-edit-panel-header", children: [
1757
1766
  /* @__PURE__ */ n(
1758
1767
  "button",
@@ -1781,7 +1790,7 @@ function qn({
1781
1790
  {
1782
1791
  className: "pa-edit-meta-label",
1783
1792
  title: `This instance: ${At(e)}
1784
- All instances: ${M}`,
1793
+ All instances: ${oe}`,
1785
1794
  children: Xe(e)
1786
1795
  }
1787
1796
  ),
@@ -1801,19 +1810,19 @@ All instances: ${M}`,
1801
1810
  onPropertyChange: $,
1802
1811
  textKind: m,
1803
1812
  textValue: g,
1804
- onTextChange: P,
1813
+ onTextChange: _,
1805
1814
  targetScope: a,
1806
1815
  onTargetScopeChange: s,
1807
1816
  elementState: o,
1808
1817
  onElementStateChange: c,
1809
- instanceCount: ee,
1810
- scopeHint: D,
1811
- stateHint: F
1818
+ instanceCount: ne,
1819
+ scopeHint: P,
1820
+ stateHint: C
1812
1821
  }
1813
1822
  ) }),
1814
1823
  /* @__PURE__ */ d("div", { className: "pa-edit-panel-sticky", children: [
1815
1824
  /* @__PURE__ */ d("div", { className: "pa-edit-actions", children: [
1816
- /* @__PURE__ */ n(V, { variant: "regular", onClick: R, disabled: !k, children: /* @__PURE__ */ d("span", { className: "pa-glass-btn-inner", children: [
1825
+ /* @__PURE__ */ n(V, { variant: "regular", onClick: R, disabled: !N, children: /* @__PURE__ */ d("span", { className: "pa-glass-btn-inner", children: [
1817
1826
  /* @__PURE__ */ n(mn, { className: "pa-glass-btn-icon" }),
1818
1827
  /* @__PURE__ */ n("span", { children: "Undo" })
1819
1828
  ] }) }),
@@ -1822,7 +1831,7 @@ All instances: ${M}`,
1822
1831
  {
1823
1832
  variant: "regular",
1824
1833
  onClick: x,
1825
- disabled: b.length === 0,
1834
+ disabled: y.length === 0,
1826
1835
  children: /* @__PURE__ */ d("span", { className: "pa-glass-btn-inner", children: [
1827
1836
  /* @__PURE__ */ n(gn, { className: "pa-glass-btn-icon" }),
1828
1837
  /* @__PURE__ */ n("span", { children: "Reset" })
@@ -1835,7 +1844,7 @@ All instances: ${M}`,
1835
1844
  "span",
1836
1845
  {
1837
1846
  className: l ? /fail/i.test(l) ? "pa-change-count pa-change-count--error" : "pa-change-count pa-change-count--success" : "pa-change-count",
1838
- children: l ?? `${N} pending change${N !== 1 ? "s" : ""}`
1847
+ children: l ?? `${w} pending change${w !== 1 ? "s" : ""}`
1839
1848
  }
1840
1849
  ),
1841
1850
  /* @__PURE__ */ n(
@@ -1843,7 +1852,7 @@ All instances: ${M}`,
1843
1852
  {
1844
1853
  variant: "glass-primary",
1845
1854
  onClick: re,
1846
- disabled: N === 0,
1855
+ disabled: w === 0,
1847
1856
  title: W != null && W.sourceFile ? void 0 : "No source file — Apply copies selector + changes to clipboard",
1848
1857
  children: "Apply"
1849
1858
  }
@@ -1879,7 +1888,7 @@ async function Jn(e, t = {}) {
1879
1888
  return await St(JSON.stringify(e, null, 2)), { mode: "clipboard" };
1880
1889
  }
1881
1890
  function Zn(e) {
1882
- const [t, i] = S(null);
1891
+ const [t, i] = A(null);
1883
1892
  return H(() => {
1884
1893
  if (!e) {
1885
1894
  i(null);
@@ -1893,7 +1902,7 @@ function Zn(e) {
1893
1902
  };
1894
1903
  }, [e]), t;
1895
1904
  }
1896
- const ae = 8, Q = 8, Qn = 12, er = 300, tr = 280;
1905
+ const ae = 8, J = 8, Qn = 12, er = 300, tr = 280;
1897
1906
  function He(e, t, i, r) {
1898
1907
  return {
1899
1908
  top: e,
@@ -1930,7 +1939,7 @@ function Ve(e, t) {
1930
1939
  window.innerWidth - t - ae
1931
1940
  );
1932
1941
  }
1933
- function Le(e, t) {
1942
+ function $e(e, t) {
1934
1943
  return Math.min(
1935
1944
  Math.max(ae, e),
1936
1945
  window.innerHeight - t - ae
@@ -1944,19 +1953,19 @@ function ar(e, t) {
1944
1953
  }
1945
1954
  function or(e, t = er, i = tr) {
1946
1955
  const r = rr(), s = e.top > window.innerHeight * 0.45 ? [
1947
- { placement: "above", top: e.top - i - Q, left: e.left },
1948
- { placement: "below", top: e.bottom + Q, left: e.left },
1949
- { placement: "right", top: e.top, left: e.right + Q },
1950
- { placement: "left", top: e.top, left: e.left - t - Q }
1956
+ { placement: "above", top: e.top - i - J, left: e.left },
1957
+ { placement: "below", top: e.bottom + J, left: e.left },
1958
+ { placement: "right", top: e.top, left: e.right + J },
1959
+ { placement: "left", top: e.top, left: e.left - t - J }
1951
1960
  ] : [
1952
- { placement: "below", top: e.bottom + Q, left: e.left },
1953
- { placement: "above", top: e.top - i - Q, left: e.left },
1954
- { placement: "right", top: e.top, left: e.right + Q },
1955
- { placement: "left", top: e.top, left: e.left - t - Q }
1961
+ { placement: "below", top: e.bottom + J, left: e.left },
1962
+ { placement: "above", top: e.top - i - J, left: e.left },
1963
+ { placement: "right", top: e.top, left: e.right + J },
1964
+ { placement: "left", top: e.top, left: e.left - t - J }
1956
1965
  ];
1957
1966
  for (const { top: u, left: l } of s) {
1958
1967
  const f = He(
1959
- Le(u, i),
1968
+ $e(u, i),
1960
1969
  Ve(l, t),
1961
1970
  t,
1962
1971
  i
@@ -1964,11 +1973,11 @@ function or(e, t = er, i = tr) {
1964
1973
  if (ar(f, r))
1965
1974
  return { top: f.top, left: f.left };
1966
1975
  }
1967
- let o = Le(e.top - i - Q, i), c = Ve(e.left, t);
1976
+ let o = $e(e.top - i - J, i), c = Ve(e.left, t);
1968
1977
  if (r) {
1969
1978
  let u = He(o, c, t, i);
1970
- Ye(u, r) && (o = Le(r.top - i - Q, i), u = He(o, c, t, i)), Ye(u, r) && (o = Le(e.bottom + Q, i), c = Ve(
1971
- Math.min(e.left, r.left - t - Q),
1979
+ Ye(u, r) && (o = $e(r.top - i - J, i), u = He(o, c, t, i)), Ye(u, r) && (o = $e(e.bottom + J, i), c = Ve(
1980
+ Math.min(e.left, r.left - t - J),
1972
1981
  t
1973
1982
  ));
1974
1983
  }
@@ -1980,24 +1989,24 @@ function sr({
1980
1989
  onSubmit: i,
1981
1990
  onCancel: r
1982
1991
  }) {
1983
- const [a, s] = S(""), o = Y(null), c = Y(null), u = e[0] ?? null, l = t ? new DOMRect(t.x, t.y, t.width, t.height) : null, f = Zn(u), p = l ?? f, v = Lt(), m = u ? fe(u) : { kind: "none", value: "" }, g = m.kind !== "none" ? m.value : void 0;
1992
+ const [a, s] = A(""), o = X(null), c = X(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;
1984
1993
  if (H(() => {
1985
- var w;
1986
- (w = o.current) == null || w.focus();
1994
+ var k;
1995
+ (k = o.current) == null || k.focus();
1987
1996
  }, [e]), H(() => {
1988
- const w = (k) => {
1989
- k.key === "Escape" && r();
1997
+ const k = (N) => {
1998
+ N.key === "Escape" && r();
1990
1999
  };
1991
- return document.addEventListener("keydown", w), () => document.removeEventListener("keydown", w);
2000
+ return document.addEventListener("keydown", k), () => document.removeEventListener("keydown", k);
1992
2001
  }, [r]), !p) return null;
1993
- const b = or(p), L = e.length > 1 ? `${e.length} selected` : u ? Xe(u) : "Area selection", N = (w) => {
1994
- a.trim() && i(a, w);
2002
+ const y = or(p), S = e.length > 1 ? `${e.length} selected` : u ? Xe(u) : "Area selection", w = (k) => {
2003
+ a.trim() && i(a, k);
1995
2004
  };
1996
2005
  return /* @__PURE__ */ n(
1997
- Te,
2006
+ Pe,
1998
2007
  {
1999
2008
  variant: "popover",
2000
- style: { top: b.top, left: b.left },
2009
+ style: { top: y.top, left: y.left },
2001
2010
  children: /* @__PURE__ */ d(
2002
2011
  "div",
2003
2012
  {
@@ -2007,7 +2016,7 @@ function sr({
2007
2016
  "aria-label": "Add annotation",
2008
2017
  className: "pa-popover-body",
2009
2018
  children: [
2010
- /* @__PURE__ */ n("div", { className: "pa-popover-header", children: /* @__PURE__ */ n("span", { className: "pa-popover-selector", children: L }) }),
2019
+ /* @__PURE__ */ n("div", { className: "pa-popover-header", children: /* @__PURE__ */ n("span", { className: "pa-popover-selector", children: S }) }),
2011
2020
  (v || g) && /* @__PURE__ */ d("div", { className: "pa-popover-context", children: [
2012
2021
  v && /* @__PURE__ */ d("p", { className: "pa-popover-context-line", children: [
2013
2022
  /* @__PURE__ */ n("span", { className: "pa-popover-context-label", children: "Selected" }),
@@ -2026,11 +2035,11 @@ function sr({
2026
2035
  ref: o,
2027
2036
  className: "pa-textarea",
2028
2037
  value: a,
2029
- onChange: (w) => s(w.target.value),
2038
+ onChange: (k) => s(k.target.value),
2030
2039
  placeholder: "Describe the change...",
2031
2040
  rows: 3,
2032
- onKeyDown: (w) => {
2033
- w.key === "Enter" && (w.metaKey || w.ctrlKey) && (w.preventDefault(), N(w.shiftKey)), w.key === "Escape" && r();
2041
+ onKeyDown: (k) => {
2042
+ k.key === "Enter" && (k.metaKey || k.ctrlKey) && (k.preventDefault(), w(k.shiftKey)), k.key === "Escape" && r();
2034
2043
  }
2035
2044
  }
2036
2045
  )
@@ -2042,7 +2051,7 @@ function sr({
2042
2051
  V,
2043
2052
  {
2044
2053
  variant: "ghost",
2045
- onClick: () => N(!0),
2054
+ onClick: () => w(!0),
2046
2055
  disabled: !a.trim(),
2047
2056
  children: "Add & next"
2048
2057
  }
@@ -2051,7 +2060,7 @@ function sr({
2051
2060
  V,
2052
2061
  {
2053
2062
  variant: "glass-primary",
2054
- onClick: () => N(!1),
2063
+ onClick: () => w(!1),
2055
2064
  disabled: !a.trim(),
2056
2065
  children: "Add"
2057
2066
  }
@@ -2142,7 +2151,7 @@ function ur(e) {
2142
2151
  }
2143
2152
  const pr = 20;
2144
2153
  function hr({ annotations: e }) {
2145
- const [t, i] = S([]);
2154
+ const [t, i] = A([]);
2146
2155
  return H(() => {
2147
2156
  if (e.length === 0) {
2148
2157
  i([]);
@@ -2188,7 +2197,7 @@ function hr({ annotations: e }) {
2188
2197
  )) });
2189
2198
  }
2190
2199
  const Ze = "[data-pixelagent-root],[data-pixelagent-toolbar-portal],[data-pixelagent-picker-portal]";
2191
- function Ee(e) {
2200
+ function Ie(e) {
2192
2201
  return e instanceof Element ? !!e.closest(Ze) : !1;
2193
2202
  }
2194
2203
  function vt(e, t) {
@@ -2227,20 +2236,20 @@ function fr({
2227
2236
  copiedEntryId: l,
2228
2237
  copyAllFrom: f
2229
2238
  }) {
2230
- const [p, v] = S(null), [m, g] = S("");
2239
+ const [p, v] = A(null), [m, g] = A("");
2231
2240
  H(() => {
2232
- const N = (w) => {
2233
- w.key === "Escape" && (t ? r() : i());
2241
+ const w = (k) => {
2242
+ k.key === "Escape" && (t ? r() : i());
2234
2243
  };
2235
- return document.addEventListener("keydown", N), () => document.removeEventListener("keydown", N);
2244
+ return document.addEventListener("keydown", w), () => document.removeEventListener("keydown", w);
2236
2245
  }, [t, r, i]);
2237
- const b = (N) => {
2238
- v(N.id), g(N.note);
2239
- }, L = (N) => {
2240
- m.trim() && (c(N, { note: m.trim() }), v(null));
2246
+ const y = (w) => {
2247
+ v(w.id), g(w.note);
2248
+ }, S = (w) => {
2249
+ m.trim() && (c(w, { note: m.trim() }), v(null));
2241
2250
  };
2242
2251
  return /* @__PURE__ */ d(
2243
- Te,
2252
+ Pe,
2244
2253
  {
2245
2254
  variant: "sheet",
2246
2255
  side: "right",
@@ -2289,9 +2298,9 @@ function fr({
2289
2298
  ] }),
2290
2299
  !t && /* @__PURE__ */ d("ul", { className: "pa-session-list", children: [
2291
2300
  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." }),
2292
- e.map((N) => {
2293
- const w = Zt(N);
2294
- return /* @__PURE__ */ n("li", { className: "pa-session-item", children: p === N.id ? /* @__PURE__ */ d("div", { className: "pa-session-edit", children: [
2301
+ e.map((w) => {
2302
+ const k = Zt(w);
2303
+ return /* @__PURE__ */ n("li", { className: "pa-session-item", children: p === w.id ? /* @__PURE__ */ d("div", { className: "pa-session-edit", children: [
2295
2304
  /* @__PURE__ */ d("label", { className: "pa-label", children: [
2296
2305
  "Note",
2297
2306
  /* @__PURE__ */ n(
@@ -2299,7 +2308,7 @@ function fr({
2299
2308
  {
2300
2309
  className: "pa-textarea",
2301
2310
  value: m,
2302
- onChange: (k) => g(k.target.value),
2311
+ onChange: (N) => g(N.target.value),
2303
2312
  rows: 3
2304
2313
  }
2305
2314
  )
@@ -2310,7 +2319,7 @@ function fr({
2310
2319
  V,
2311
2320
  {
2312
2321
  variant: "glass-primary",
2313
- onClick: () => L(N.id),
2322
+ onClick: () => S(w.id),
2314
2323
  disabled: !m.trim(),
2315
2324
  children: "Save"
2316
2325
  }
@@ -2318,12 +2327,12 @@ function fr({
2318
2327
  ] })
2319
2328
  ] }) : /* @__PURE__ */ d(K, { children: [
2320
2329
  /* @__PURE__ */ d("div", { className: "pa-session-content", children: [
2321
- /* @__PURE__ */ n("span", { className: "pa-session-target", children: w.target }),
2322
- /* @__PURE__ */ n("p", { className: "pa-session-note", children: w.note }),
2323
- w.meta && /* @__PURE__ */ n("p", { className: "pa-session-meta-line", children: w.meta })
2330
+ /* @__PURE__ */ n("span", { className: "pa-session-target", children: k.target }),
2331
+ /* @__PURE__ */ n("p", { className: "pa-session-note", children: k.note }),
2332
+ k.meta && /* @__PURE__ */ n("p", { className: "pa-session-meta-line", children: k.meta })
2324
2333
  ] }),
2325
2334
  /* @__PURE__ */ d("div", { className: "pa-session-item-actions", children: [
2326
- u === "Copied!" && l === N.id ? /* @__PURE__ */ n(
2335
+ u === "Copied!" && l === w.id ? /* @__PURE__ */ n(
2327
2336
  "span",
2328
2337
  {
2329
2338
  className: "pa-status pa-copy-feedback-slot pa-copy-feedback-slot--item",
@@ -2336,7 +2345,7 @@ function fr({
2336
2345
  {
2337
2346
  variant: "glass-primary",
2338
2347
  className: "pa-glass-btn--sm",
2339
- onClick: () => s(N.id),
2348
+ onClick: () => s(w.id),
2340
2349
  "aria-label": "Copy annotation",
2341
2350
  children: "Copy"
2342
2351
  }
@@ -2346,7 +2355,7 @@ function fr({
2346
2355
  {
2347
2356
  variant: "ghost",
2348
2357
  className: "pa-glass-btn--sm",
2349
- onClick: () => b(N),
2358
+ onClick: () => y(w),
2350
2359
  "aria-label": "Edit annotation note",
2351
2360
  children: "✎"
2352
2361
  }
@@ -2356,13 +2365,13 @@ function fr({
2356
2365
  {
2357
2366
  variant: "ghost",
2358
2367
  className: "pa-glass-btn--sm",
2359
- onClick: () => o(N.id),
2368
+ onClick: () => o(w.id),
2360
2369
  "aria-label": "Remove annotation",
2361
2370
  children: "✕"
2362
2371
  }
2363
2372
  )
2364
2373
  ] })
2365
- ] }) }, N.id);
2374
+ ] }) }, w.id);
2366
2375
  })
2367
2376
  ] })
2368
2377
  ]
@@ -2422,7 +2431,7 @@ function br({
2422
2431
  chrome: r,
2423
2432
  onToggleHostTheme: a
2424
2433
  }) {
2425
- const s = Y(null);
2434
+ const s = X(null);
2426
2435
  return H(() => {
2427
2436
  if (!e) return;
2428
2437
  const o = (u) => {
@@ -2435,7 +2444,7 @@ function br({
2435
2444
  return window.addEventListener("keydown", o), window.addEventListener("mousedown", c), () => {
2436
2445
  window.removeEventListener("keydown", o), window.removeEventListener("mousedown", c);
2437
2446
  };
2438
- }, [e, t]), e ? /* @__PURE__ */ n("div", { ref: s, className: "pa-settings-menu", role: "dialog", "aria-label": "PixelAgent settings", children: /* @__PURE__ */ n(Te, { variant: "popover", className: "pa-settings-menu-panel", children: /* @__PURE__ */ d("div", { className: "pa-settings-menu-inner", children: [
2447
+ }, [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: [
2439
2448
  /* @__PURE__ */ d("header", { className: "pa-settings-menu-header", children: [
2440
2449
  /* @__PURE__ */ n("h4", { className: "pa-settings-menu-title", children: "Settings" }),
2441
2450
  /* @__PURE__ */ n("p", { className: "pa-settings-menu-subtitle", children: "Appearance and chrome" })
@@ -2526,17 +2535,17 @@ function Cr({
2526
2535
  copyStatus: v,
2527
2536
  copyAllFrom: m,
2528
2537
  onActivateAnnotate: g,
2529
- onActivateEdit: b,
2530
- onDeactivate: L,
2531
- onCopyAll: N,
2532
- onCaptureModeChange: w,
2533
- onConfirmMultiSelect: k
2538
+ onActivateEdit: y,
2539
+ onDeactivate: S,
2540
+ onCopyAll: w,
2541
+ onCaptureModeChange: k,
2542
+ onConfirmMultiSelect: N
2534
2543
  }) {
2535
- const { elementRef: $, isDragging: P, style: R, dragHandleProps: x } = Rt(), I = /* @__PURE__ */ d(
2544
+ const { elementRef: $, isDragging: _, style: R, dragHandleProps: x } = Rt(), I = /* @__PURE__ */ d(
2536
2545
  "div",
2537
2546
  {
2538
2547
  ref: $,
2539
- className: `pa-toolbar-float ${P ? "pa-toolbar-float--dragging" : ""}`,
2548
+ className: `pa-toolbar-float ${_ ? "pa-toolbar-float--dragging" : ""}`,
2540
2549
  style: R,
2541
2550
  role: "toolbar",
2542
2551
  "aria-label": "PixelAgent",
@@ -2573,16 +2582,16 @@ function Cr({
2573
2582
  {
2574
2583
  className: "pa-select pa-toolbar-capture-select",
2575
2584
  value: l,
2576
- onChange: (C) => w(C.target.value),
2585
+ onChange: (L) => k(L.target.value),
2577
2586
  "aria-label": "Capture mode",
2578
- children: Nr.map((C) => /* @__PURE__ */ n("option", { value: C, children: kr[C] }, C))
2587
+ children: Nr.map((L) => /* @__PURE__ */ n("option", { value: L, children: kr[L] }, L))
2579
2588
  }
2580
2589
  ),
2581
2590
  p > 0 && /* @__PURE__ */ n(
2582
2591
  V,
2583
2592
  {
2584
2593
  variant: "glass-primary",
2585
- onClick: k,
2594
+ onClick: N,
2586
2595
  "aria-label": "Annotate selected elements",
2587
2596
  children: p
2588
2597
  }
@@ -2596,7 +2605,7 @@ function Cr({
2596
2605
  V,
2597
2606
  {
2598
2607
  variant: "glass-primary",
2599
- onClick: N,
2608
+ onClick: w,
2600
2609
  disabled: f === 0,
2601
2610
  "aria-label": f > 0 ? `Copy all annotations (${f})` : "Copy all annotations",
2602
2611
  children: f > 0 ? `Copy (${f})` : "Copy"
@@ -2611,7 +2620,7 @@ function Cr({
2611
2620
  {
2612
2621
  variant: "icon",
2613
2622
  className: "pa-toolbar-close",
2614
- onClick: L,
2623
+ onClick: S,
2615
2624
  "aria-label": "Close",
2616
2625
  children: /* @__PURE__ */ n(
2617
2626
  "svg",
@@ -2636,7 +2645,7 @@ function Cr({
2636
2645
  )
2637
2646
  ] }) : /* @__PURE__ */ d("div", { className: "pa-toolbar-segment", children: [
2638
2647
  /* @__PURE__ */ n(V, { onClick: g, children: "Annotate" }),
2639
- /* @__PURE__ */ n(V, { onClick: b, children: "Edit" })
2648
+ /* @__PURE__ */ n(V, { onClick: y, children: "Edit" })
2640
2649
  ] }),
2641
2650
  !c && /* @__PURE__ */ d(K, { children: [
2642
2651
  /* @__PURE__ */ n("span", { className: "pa-toolbar-divider", "aria-hidden": "true" }),
@@ -2673,7 +2682,7 @@ function Cr({
2673
2682
  );
2674
2683
  }
2675
2684
  function Mr() {
2676
- const e = Y(Qt()), [t, i] = S(
2685
+ const e = X(Qt()), [t, i] = A(
2677
2686
  () => {
2678
2687
  var s;
2679
2688
  return ((s = e.current) == null ? void 0 : s.annotations) ?? [];
@@ -2701,17 +2710,17 @@ function Ar({
2701
2710
  hostTheme: t,
2702
2711
  onHostThemeChange: i
2703
2712
  }) {
2704
- const r = xe(
2713
+ const r = ke(
2705
2714
  () => ({ ...tn, ...e }),
2706
2715
  [e]
2707
- ), [a, s] = S(
2716
+ ), [a, s] = A(
2708
2717
  () => t ?? it(r) ?? "dark"
2709
- ), [o, c] = S(!1), u = t ?? a;
2718
+ ), [o, c] = A(!1), u = t ?? a;
2710
2719
  H(() => {
2711
2720
  if (t !== void 0) return;
2712
2721
  const v = () => {
2713
- const b = it(r);
2714
- b && s(b);
2722
+ const y = it(r);
2723
+ y && s(y);
2715
2724
  };
2716
2725
  v();
2717
2726
  const m = r.hostThemeAttribute, g = new MutationObserver(v);
@@ -2720,7 +2729,7 @@ function Ar({
2720
2729
  attributeFilter: [m]
2721
2730
  }), () => g.disconnect();
2722
2731
  }, [t, r]);
2723
- const l = xe(
2732
+ const l = ke(
2724
2733
  () => nn(r, u),
2725
2734
  [r, u]
2726
2735
  ), f = E(() => {
@@ -2800,174 +2809,174 @@ function $r({
2800
2809
  onApply: a,
2801
2810
  runtimeStateStyles: s
2802
2811
  } = {}) {
2803
- const o = Ar({ ui: e, hostTheme: t, onHostThemeChange: i }), [c, u] = S(null);
2812
+ const o = Ar({ ui: e, hostTheme: t, onHostThemeChange: i }), [c, u] = A(null);
2804
2813
  H(() => {
2805
2814
  if (r || a) return;
2806
- let y = !1;
2807
- return fetch(yt, { method: "GET" }).then((A) => {
2808
- !y && A.status === 405 && u(yt);
2815
+ let b = !1;
2816
+ return fetch(yt, { method: "GET" }).then((M) => {
2817
+ !b && M.status === 405 && u(yt);
2809
2818
  }).catch(() => {
2810
2819
  }), () => {
2811
- y = !0;
2820
+ b = !0;
2812
2821
  };
2813
2822
  }, [r, a]);
2814
- const [l, f] = S(!1), [p, v] = S("idle"), [m, g] = S("element"), {
2815
- annotations: b,
2816
- setAnnotations: L,
2817
- updateAnnotation: N,
2818
- removeAnnotation: w
2819
- } = Mr(), [k, $] = S(null), [P, R] = S(null), [x, I] = S([]), [C, h] = S(null), [O, U] = S(null), [ge, j] = S(!1), [oe, re] = S(!1), W = l && p === "annotate" && b.length > 0 && !ge, [G, ee] = S("this-instance"), [M, F] = S("normal"), [D, z] = S(null), [T, _] = S(null), [X, q] = S(null), Re = Y(null), Pe = Y(null), de = E(
2820
- (y, A) => {
2821
- Pe.current && clearTimeout(Pe.current), z(y), _((A == null ? void 0 : A.entryId) ?? null), q((A == null ? void 0 : A.copyAllFrom) ?? null), Pe.current = setTimeout(() => {
2822
- z(null), _(null), q(null);
2823
+ const [l, f] = A(!1), [p, v] = A("idle"), [m, g] = A("element"), {
2824
+ annotations: y,
2825
+ setAnnotations: S,
2826
+ updateAnnotation: w,
2827
+ removeAnnotation: k
2828
+ } = Mr(), [N, $] = A(null), [_, R] = A(null), [x, I] = A([]), [L, h] = A(null), [F, U] = A(null), [ge, Z] = A(!1), [te, re] = A(!1), W = l && p === "annotate" && y.length > 0 && !ge, [G, ne] = A("this-instance"), [oe, C] = A("normal"), [P, O] = A(null), [D, Y] = A(null), [T, z] = A(null), ve = X(null), be = X(null), de = E(
2829
+ (b, M) => {
2830
+ be.current && clearTimeout(be.current), O(b), Y((M == null ? void 0 : M.entryId) ?? null), z((M == null ? void 0 : M.copyAllFrom) ?? null), be.current = setTimeout(() => {
2831
+ O(null), Y(null), z(null);
2823
2832
  }, 2500);
2824
2833
  },
2825
2834
  []
2826
- ), Ne = E(
2827
- async (y, A, J) => {
2828
- if (y)
2835
+ ), Ce = E(
2836
+ async (b, M, j) => {
2837
+ if (b)
2829
2838
  try {
2830
- await St(y), de(A, J);
2839
+ await St(b), de(M, j);
2831
2840
  } catch {
2832
- de("Copy failed — check clipboard permissions", J);
2841
+ de("Copy failed — check clipboard permissions", j);
2833
2842
  }
2834
2843
  },
2835
2844
  [de]
2836
- ), ve = E(
2837
- (y, A) => {
2838
- y.length === 0 && !A || (h({ elements: y, areaBbox: A }), R(y[0] ?? null));
2845
+ ), ye = E(
2846
+ (b, M) => {
2847
+ b.length === 0 && !M || (h({ elements: b, areaBbox: M }), R(b[0] ?? null));
2839
2848
  },
2840
2849
  []
2841
2850
  ), De = E(
2842
- (y) => {
2843
- if (!(!l || p !== "annotate" || Ee(y.target))) {
2844
- if (O) {
2851
+ (b) => {
2852
+ if (!(!l || p !== "annotate" || Ie(b.target))) {
2853
+ if (F) {
2845
2854
  U(
2846
- (A) => A && { ...A, currentX: y.clientX, currentY: y.clientY }
2855
+ (M) => M && { ...M, currentX: b.clientX, currentY: b.clientY }
2847
2856
  );
2848
2857
  return;
2849
2858
  }
2850
- m !== "area" && $(vt(y.clientX, y.clientY));
2859
+ m !== "area" && $(vt(b.clientX, b.clientY));
2851
2860
  }
2852
2861
  },
2853
- [l, p, O, m]
2862
+ [l, p, F, m]
2854
2863
  ), Oe = E(
2855
- (y) => {
2856
- !l || p !== "annotate" || Ee(y.target) || m !== "area" || y.button !== 0 || (y.preventDefault(), y.stopPropagation(), U({
2857
- startX: y.clientX,
2858
- startY: y.clientY,
2859
- currentX: y.clientX,
2860
- currentY: y.clientY
2864
+ (b) => {
2865
+ !l || p !== "annotate" || Ie(b.target) || m !== "area" || b.button !== 0 || (b.preventDefault(), b.stopPropagation(), U({
2866
+ startX: b.clientX,
2867
+ startY: b.clientY,
2868
+ currentX: b.clientX,
2869
+ currentY: b.clientY
2861
2870
  }), h(null));
2862
2871
  },
2863
2872
  [l, p, m]
2864
2873
  ), Fe = E(() => {
2865
- if (!O) return;
2866
- const y = Nt(O);
2867
- if (U(null), y.width < 8 || y.height < 8) return;
2868
- const A = on(y, Ze);
2869
- ve(A, y);
2870
- }, [O, ve]), Be = E(
2871
- (y) => {
2872
- if (!l || p !== "annotate" || Ee(y.target) || m === "area") return;
2873
- y.preventDefault(), y.stopPropagation();
2874
- const A = vt(y.clientX, y.clientY);
2875
- if (!A) return;
2876
- if (y.shiftKey || m === "multi") {
2877
- I((te) => te.includes(A) ? te.filter((B) => B !== A) : [...te, A]), R(A);
2874
+ if (!F) return;
2875
+ const b = Nt(F);
2876
+ if (U(null), b.width < 8 || b.height < 8) return;
2877
+ const M = on(b, Ze);
2878
+ ye(M, b);
2879
+ }, [F, ye]), Be = E(
2880
+ (b) => {
2881
+ if (!l || p !== "annotate" || Ie(b.target) || m === "area") return;
2882
+ b.preventDefault(), b.stopPropagation();
2883
+ const M = vt(b.clientX, b.clientY);
2884
+ if (!M) return;
2885
+ if (b.shiftKey || m === "multi") {
2886
+ I((Q) => Q.includes(M) ? Q.filter((B) => B !== M) : [...Q, M]), R(M);
2878
2887
  return;
2879
2888
  }
2880
- const J = x.length > 0 ? x : [A];
2881
- ve(J.includes(A) ? J : [A]);
2889
+ const j = x.length > 0 ? x : [M];
2890
+ ye(j.includes(M) ? j : [M]);
2882
2891
  },
2883
- [l, p, m, x, ve]
2892
+ [l, p, m, x, ye]
2884
2893
  );
2885
2894
  H(() => {
2886
- !P || G !== "all-instances" || Ct(P) <= 1 && ee("this-instance");
2887
- }, [P, G]), H(() => {
2895
+ !_ || G !== "all-instances" || Ct(_) <= 1 && ne("this-instance");
2896
+ }, [_, G]), H(() => {
2888
2897
  if (l)
2889
2898
  return document.addEventListener("mousemove", De, !0), document.addEventListener("mousedown", Oe, !0), document.addEventListener("mouseup", Fe, !0), document.addEventListener("click", Be, !0), () => {
2890
2899
  document.removeEventListener("mousemove", De, !0), document.removeEventListener("mousedown", Oe, !0), document.removeEventListener("mouseup", Fe, !0), document.removeEventListener("click", Be, !0);
2891
2900
  };
2892
2901
  }, [l, De, Oe, Fe, Be]);
2893
2902
  const Vt = E(
2894
- (y, A) => {
2895
- if (!C || !y.trim()) return;
2896
- const { elements: J, areaBbox: te } = C;
2897
- if (J.length === 0 && !te) return;
2898
- const be = cr({
2899
- elements: J,
2900
- note: y,
2901
- areaBbox: te
2903
+ (b, M) => {
2904
+ if (!L || !b.trim()) return;
2905
+ const { elements: j, areaBbox: Q } = L;
2906
+ if (j.length === 0 && !Q) return;
2907
+ const we = cr({
2908
+ elements: j,
2909
+ note: b,
2910
+ areaBbox: Q
2902
2911
  });
2903
- L((B) => [...B, be]), j(!1), re(!1), A ? (h(null), R(null)) : (h(null), R(null), I([]));
2912
+ S((B) => [...B, we]), Z(!1), re(!1), M ? (h(null), R(null)) : (h(null), R(null), I([]));
2904
2913
  },
2905
- [C, L]
2914
+ [L, S]
2906
2915
  ), Wt = E(() => {
2907
2916
  h(null), R(null);
2908
2917
  }, []), Qe = E(
2909
- async (y) => {
2910
- const A = sn(b);
2911
- await Ne(A, "Copied all!", { copyAllFrom: y });
2918
+ async (b) => {
2919
+ const M = sn(y);
2920
+ await Ce(M, "Copied all!", { copyAllFrom: b });
2912
2921
  },
2913
- [b, Ne]
2922
+ [y, Ce]
2914
2923
  ), Ut = E(
2915
- async (y) => {
2916
- const A = b.find((J) => J.id === y);
2917
- A && await Ne(ln(A), "Copied!", { entryId: y });
2924
+ async (b) => {
2925
+ const M = y.find((j) => j.id === b);
2926
+ M && await Ce(ln(M), "Copied!", { entryId: b });
2918
2927
  },
2919
- [b, Ne]
2928
+ [y, Ce]
2920
2929
  ), Yt = E(
2921
- async (y) => {
2922
- const A = [];
2923
- for (const [B, Z] of y)
2924
- for (const [se, ne] of Z)
2925
- ne.length > 0 && A.push([B, se, ne]);
2926
- if (A.length === 0) return { applied: !1 };
2930
+ async (b) => {
2931
+ const M = [];
2932
+ for (const [B, q] of b)
2933
+ for (const [se, ee] of q)
2934
+ ee.length > 0 && M.push([B, se, ee]);
2935
+ if (M.length === 0) return { applied: !1 };
2927
2936
  if (s) {
2928
- for (const [B, Z, se] of A) {
2929
- if (Z === "normal") continue;
2930
- const ne = Sr(B);
2931
- for (const ye of se)
2932
- B.style.removeProperty(ye.property), Er(ne, Z, ye.property, ye.newValue);
2937
+ for (const [B, q, se] of M) {
2938
+ if (q === "normal") continue;
2939
+ const ee = Sr(B);
2940
+ for (const xe of se)
2941
+ B.style.removeProperty(xe.property), Er(ee, q, xe.property, xe.newValue);
2933
2942
  }
2934
- for (const [B, Z, se] of A)
2935
- if (Z === "normal")
2936
- for (const ne of se)
2937
- B.style.setProperty(ne.property, ne.newValue);
2943
+ for (const [B, q, se] of M)
2944
+ if (q === "normal")
2945
+ for (const ee of se)
2946
+ B.style.setProperty(ee.property, ee.newValue);
2938
2947
  return de("Change applied"), { applied: !0, skipRevert: !0 };
2939
2948
  }
2940
- const J = r ?? c ?? void 0, te = [];
2941
- for (const [B, Z, se] of A) {
2942
- const ne = Ge(B), ye = {
2949
+ const j = r ?? c ?? void 0, Q = [];
2950
+ for (const [B, q, se] of M) {
2951
+ const ee = Ge(B), xe = {
2943
2952
  schemaVersion: 1,
2944
2953
  elementSelector: Mt(B, G),
2945
- sourceFile: ne.sourceFile,
2946
- lineNumber: ne.lineNumber,
2954
+ sourceFile: ee.sourceFile,
2955
+ lineNumber: ee.lineNumber,
2947
2956
  targetScope: G,
2948
- state: Z,
2957
+ state: q,
2949
2958
  stylingSystem: kt(B),
2950
2959
  changes: se
2951
2960
  };
2952
- te.push(await Jn(ye, { applyEndpoint: J, onApply: a }));
2961
+ Q.push(await Jn(xe, { applyEndpoint: j, onApply: a }));
2953
2962
  }
2954
- const be = te.every(
2963
+ const we = Q.every(
2955
2964
  (B) => B.mode === "mcp" && B.result.success && B.result.linesChanged.length > 0
2956
2965
  );
2957
- return de(be ? "Change applied" : "Apply failed"), te.forEach((B, Z) => {
2958
- B.mode === "error" ? console.error(`[pixelagent] Apply #${Z} failed:`, B.message) : B.mode === "clipboard" ? console.warn(`[pixelagent] Apply #${Z} fell back to clipboard`) : B.mode === "mcp" && !B.result.success && console.warn(`[pixelagent] Apply #${Z} reported no changes:`, B.result);
2959
- }), { applied: be };
2966
+ return de(we ? "Change applied" : "Apply failed"), Q.forEach((B, q) => {
2967
+ B.mode === "error" ? console.error(`[pixelagent] Apply #${q} failed:`, B.message) : B.mode === "clipboard" ? console.warn(`[pixelagent] Apply #${q} fell back to clipboard`) : B.mode === "mcp" && !B.result.success && console.warn(`[pixelagent] Apply #${q} reported no changes:`, B.result);
2968
+ }), { applied: we };
2960
2969
  },
2961
2970
  [G, r, c, a, s, de]
2962
- ), et = (y) => {
2963
- o.setSettingsOpen(!1), f(!0), v(y), R(null), $(null), h(null), I([]), U(null), y === "annotate" && j(!1);
2971
+ ), et = (b) => {
2972
+ o.setSettingsOpen(!1), f(!0), v(b), R(null), $(null), h(null), I([]), U(null), b === "annotate" && Z(!1);
2964
2973
  }, Xt = () => {
2965
- f(!1), v("idle"), R(null), $(null), h(null), I([]), U(null), j(!1), re(!1);
2966
- }, Gt = O ? Nt(O) : null;
2974
+ f(!1), v("idle"), R(null), $(null), h(null), I([]), U(null), Z(!1), re(!1);
2975
+ }, Gt = F ? Nt(F) : null;
2967
2976
  return /* @__PURE__ */ d(
2968
2977
  "div",
2969
2978
  {
2970
- ref: Re,
2979
+ ref: ve,
2971
2980
  className: "pa-root",
2972
2981
  "data-pixelagent-root": !0,
2973
2982
  ...o.rootAttributes,
@@ -2985,17 +2994,17 @@ function $r({
2985
2994
  active: l,
2986
2995
  mode: p,
2987
2996
  captureMode: m,
2988
- annotationCount: b.length,
2997
+ annotationCount: y.length,
2989
2998
  multiSelectCount: x.length,
2990
- copyStatus: D,
2991
- copyAllFrom: X,
2999
+ copyStatus: P,
3000
+ copyAllFrom: T,
2992
3001
  onActivateAnnotate: () => et("annotate"),
2993
3002
  onActivateEdit: () => et("edit"),
2994
3003
  onDeactivate: Xt,
2995
3004
  onCopyAll: () => Qe("toolbar"),
2996
3005
  onCaptureModeChange: g,
2997
3006
  onConfirmMultiSelect: () => {
2998
- x.length > 0 && ve(x);
3007
+ x.length > 0 && ye(x);
2999
3008
  }
3000
3009
  }
3001
3010
  ),
@@ -3003,19 +3012,19 @@ function $r({
3003
3012
  /* @__PURE__ */ n(
3004
3013
  $t,
3005
3014
  {
3006
- element: k,
3007
- selected: P,
3015
+ element: N,
3016
+ selected: _,
3008
3017
  multiSelected: x
3009
3018
  }
3010
3019
  ),
3011
- /* @__PURE__ */ n(hr, { annotations: b }),
3012
- /* @__PURE__ */ n(lr, { area: Gt, isDragging: !!O })
3020
+ /* @__PURE__ */ n(hr, { annotations: y }),
3021
+ /* @__PURE__ */ n(lr, { area: Gt, isDragging: !!F })
3013
3022
  ] }),
3014
- l && p === "annotate" && C && /* @__PURE__ */ n(
3023
+ l && p === "annotate" && L && /* @__PURE__ */ n(
3015
3024
  sr,
3016
3025
  {
3017
- elements: C.elements,
3018
- areaBbox: C.areaBbox,
3026
+ elements: L.elements,
3027
+ areaBbox: L.areaBbox,
3019
3028
  onSubmit: Vt,
3020
3029
  onCancel: Wt
3021
3030
  }
@@ -3023,35 +3032,35 @@ function $r({
3023
3032
  l && p === "edit" && /* @__PURE__ */ n(
3024
3033
  qn,
3025
3034
  {
3026
- selectedElement: P,
3027
- hoveredElement: k,
3035
+ selectedElement: _,
3036
+ hoveredElement: N,
3028
3037
  onSelectElement: R,
3029
3038
  onHoverElement: $,
3030
3039
  targetScope: G,
3031
- onTargetScopeChange: ee,
3032
- elementState: M,
3033
- onElementStateChange: F,
3040
+ onTargetScopeChange: ne,
3041
+ elementState: oe,
3042
+ onElementStateChange: C,
3034
3043
  onApply: Yt,
3035
- applyStatus: p === "edit" ? D : null,
3036
- isToolbarTarget: Ee
3044
+ applyStatus: p === "edit" ? P : null,
3045
+ isToolbarTarget: Ie
3037
3046
  }
3038
3047
  ),
3039
3048
  W && /* @__PURE__ */ n(
3040
3049
  fr,
3041
3050
  {
3042
- annotations: b,
3043
- collapsed: oe,
3044
- onToggleCollapsed: () => re((y) => !y),
3051
+ annotations: y,
3052
+ collapsed: te,
3053
+ onToggleCollapsed: () => re((b) => !b),
3045
3054
  onClose: () => {
3046
- j(!0), re(!1);
3055
+ Z(!0), re(!1);
3047
3056
  },
3048
3057
  onCopyAll: () => Qe("session"),
3049
3058
  onCopyOne: Ut,
3050
- onRemove: w,
3051
- onUpdate: N,
3052
- copyStatus: D,
3053
- copiedEntryId: T,
3054
- copyAllFrom: X
3059
+ onRemove: k,
3060
+ onUpdate: w,
3061
+ copyStatus: P,
3062
+ copiedEntryId: D,
3063
+ copyAllFrom: T
3055
3064
  }
3056
3065
  )
3057
3066
  ]