pixelagent 0.1.16 → 0.1.17

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,5 +1,5 @@
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";
2
+ import { useState as S, useEffect as _, useRef as Y, useMemo as xe, useLayoutEffect as Kt, useCallback as $, useId as jt } from "react";
3
3
  import { getElementDisplayLabel as Xe, captureTextSnapshot as tt, captureInlineStyles as nt, restoreInlineStyles as we, restoreTextSnapshot as ke, getPreviewTargets as $e, clearTailwindStatePreview as Ce, applyTailwindStatePreview as ze, setEditableTextPreview as rt, getRelevantComputedStyles as Me, getEditableTextInfo as fe, readReactSource as Ge, detectStylingSystem as kt, countElementInstances as Ct, getScopeSelector as Mt, getCssSelector as At, copyToClipboard as St, getWindowSelectionText as Lt, getNearestReactComponentName as qt, getDomPath as Jt, resolveElementFromEntry as Et, getAnnotationSessionDisplay as Zt, loadAnnotationSession as Qt, saveAnnotationSession as en, DEFAULT_PIXEL_AGENT_UI_SETTINGS as tn, readHostThemeFromDocument as it, resolvePixelAgentChrome as nn, applyHostThemeToDocument as rn, pixelAgentRootAttributes as an, getElementsInArea as on, formatAllAnnotations as sn, formatAnnotation as ln } from "@pixelagent/shared";
4
4
  export * from "@pixelagent/shared";
5
5
  import { createPortal as Ke } from "react-dom";
@@ -10,7 +10,7 @@ function $t({
10
10
  primarySelected: r = null
11
11
  }) {
12
12
  const [a, s] = S([]), o = r ?? t;
13
- if (H(() => {
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);
16
16
  for (const m of i)
@@ -81,19 +81,19 @@ function dn(e, t, i, r = It) {
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
83
  let b = 0;
84
- const L = new Float32Array(s * o * 2);
84
+ const E = new Float32Array(s * o * 2);
85
85
  let N = 0;
86
86
  for (let k = 0; k < o; k++)
87
- for (let $ = 0; $ < s; $++) {
88
- const P = $ / s - 0.5, R = k / o - 0.5, x = un(P, R, v, m, g), I = at(0.8, 0, x - 0.15), C = at(0, 1, I), h = (P * C + 0.5) * s - $, O = (R * C + 0.5) * o - k;
89
- Math.abs(h) > b && (b = Math.abs(h)), Math.abs(O) > b && (b = Math.abs(O)), L[N++] = h, L[N++] = O;
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
90
  }
91
91
  if (b === 0) return null;
92
92
  b *= 0.4 * r;
93
93
  let w = 0;
94
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;
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;
97
97
  }
98
98
  return u.putImageData(l, 0, 0), {
99
99
  href: c.toDataURL("image/png"),
@@ -142,16 +142,16 @@ function Tt({
142
142
  const g = l.current;
143
143
  if (!g) return;
144
144
  let b = 0;
145
- const L = () => {
145
+ const E = () => {
146
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);
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);
150
150
  R && v(R);
151
151
  });
152
152
  };
153
- L();
154
- const N = new ResizeObserver(L);
153
+ E();
154
+ const N = new ResizeObserver(E);
155
155
  return N.observe(g), () => {
156
156
  cancelAnimationFrame(b), N.disconnect();
157
157
  };
@@ -235,7 +235,7 @@ function Tt({
235
235
  )
236
236
  ] });
237
237
  }
238
- function V({
238
+ function H({
239
239
  variant: e = "regular",
240
240
  className: t = "",
241
241
  children: 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] = S(e), [a, s] = S(!1), o = Y(null), c = Y(null), u = $(() => {
277
277
  if (i !== null) return;
278
278
  const m = c.current;
279
279
  if (!m) return;
@@ -285,9 +285,9 @@ function Rt({
285
285
  }
286
286
  );
287
287
  }, [i, t]);
288
- H(() => {
288
+ _(() => {
289
289
  u();
290
- }, [u]), H(() => {
290
+ }, [u]), _(() => {
291
291
  const m = () => {
292
292
  r((g) => {
293
293
  if (!g || !c.current) return g;
@@ -300,15 +300,15 @@ function Rt({
300
300
  };
301
301
  return window.addEventListener("resize", m), () => window.removeEventListener("resize", m);
302
302
  }, []);
303
- const l = E(
303
+ const l = $(
304
304
  (m) => {
305
305
  if (m.button !== 0) return;
306
306
  const g = c.current;
307
307
  if (!g) return;
308
308
  let b = i;
309
309
  if (!b) {
310
- const L = g.getBoundingClientRect();
311
- b = { x: L.left, y: L.top }, r(b);
310
+ const E = g.getBoundingClientRect();
311
+ b = { x: E.left, y: E.top }, r(b);
312
312
  }
313
313
  o.current = {
314
314
  pointerId: m.pointerId,
@@ -319,11 +319,11 @@ function Rt({
319
319
  }, s(!0), m.currentTarget.setPointerCapture(m.pointerId), m.preventDefault();
320
320
  },
321
321
  [i]
322
- ), f = E((m) => {
322
+ ), f = $((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: $ });
326
- }, []), p = E((m) => {
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 });
326
+ }, []), p = $((m) => {
327
327
  if (!(!o.current || o.current.pointerId !== m.pointerId)) {
328
328
  o.current = null, s(!1);
329
329
  try {
@@ -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`;
486
- H(() => {
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`;
486
+ _(() => {
487
487
  o(ot(t));
488
488
  }, [t]);
489
- const N = E(
489
+ const N = $(
490
490
  (x) => {
491
491
  o(x), i(wn(x));
492
492
  },
493
493
  [i]
494
- ), w = E(
494
+ ), w = $(
495
495
  (x) => {
496
496
  N(Dt(x));
497
497
  },
498
498
  [N]
499
- ), k = E(() => {
499
+ ), k = $(() => {
500
500
  const x = c.current;
501
501
  if (!x) return;
502
- const I = x.getBoundingClientRect(), C = 260;
503
- let h = I.left;
502
+ const T = x.getBoundingClientRect(), C = 260;
503
+ let h = T.left;
504
504
  h + C > window.innerWidth - 12 && (h = window.innerWidth - C - 12), h = Math.max(12, h);
505
- let O = I.bottom + 8;
506
- const U = 320;
507
- O + U > window.innerHeight - 12 && (O = Math.max(12, I.top - U - 8)), v({ top: O, left: h, width: C });
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 });
508
508
  }, []);
509
- H(() => {
509
+ _(() => {
510
510
  if (!r) return;
511
511
  k();
512
512
  const x = (C) => {
513
- var O, U;
513
+ var F, W;
514
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) => {
515
+ (F = c.current) != null && F.contains(h) || (W = u.current) != null && W.contains(h) || a(!1);
516
+ }, T = (C) => {
517
517
  C.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", 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);
521
521
  };
522
522
  }, [r, k]);
523
- const $ = (x, I) => {
524
- var U;
525
- const C = (U = l.current) == null ? void 0 : U.getBoundingClientRect();
523
+ const I = (x, T) => {
524
+ var W;
525
+ const C = (W = l.current) == null ? void 0 : W.getBoundingClientRect();
526
526
  if (!C) return;
527
- const { x: h, y: O } = xn(x, I, C);
528
- N({ ...s, s: h, v: 100 - O });
527
+ const { x: h, y: F } = xn(x, T, C);
528
+ N({ ...s, s: h, v: 100 - F });
529
529
  }, P = (x) => {
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);
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);
533
533
  };
534
- window.addEventListener("mousemove", I), window.addEventListener("mouseup", C);
534
+ window.addEventListener("mousemove", T), window.addEventListener("mouseup", C);
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": E,
549
549
  className: "pa-color-picker",
550
550
  style: { top: p.top, left: p.left, width: p.width },
551
551
  children: [
@@ -558,7 +558,7 @@ function _e({ label: e, value: t, onChange: i }) {
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: E })
562
562
  ] }),
563
563
  /* @__PURE__ */ n(
564
564
  "div",
@@ -622,8 +622,8 @@ function _e({ label: e, value: t, onChange: i }) {
622
622
  min: 0,
623
623
  max: 255,
624
624
  value: m[x],
625
- onChange: (I) => {
626
- const C = kn(parseInt(I.target.value, 10));
625
+ onChange: (T) => {
626
+ const C = kn(parseInt(T.target.value, 10));
627
627
  w({ ...m, [x]: C });
628
628
  }
629
629
  }
@@ -950,7 +950,7 @@ function Dn() {
950
950
  }
951
951
  function he({ icon: e, display: t, ariaLabel: i, mixed: r, onCommit: a }) {
952
952
  const [s, o] = S(t);
953
- return H(() => {
953
+ return _(() => {
954
954
  o(t);
955
955
  }, [t]), /* @__PURE__ */ d("label", { className: `pa-spacing-cell ${r ? "pa-spacing-cell--mixed" : ""}`, children: [
956
956
  /* @__PURE__ */ n("span", { className: "pa-spacing-cell-icon", children: e }),
@@ -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 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];
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: [
@@ -1432,7 +1432,7 @@ function Gn({
1432
1432
  "select",
1433
1433
  {
1434
1434
  className: "pa-select",
1435
- value: L,
1435
+ value: E,
1436
1436
  onChange: (h) => t("display", h.target.value),
1437
1437
  children: k.map((h) => /* @__PURE__ */ n("option", { value: h, children: h }, h))
1438
1438
  }
@@ -1537,118 +1537,121 @@ const Kn = 50, gt = [
1537
1537
  ];
1538
1538
  function jn(e, t, i) {
1539
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(() => {
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
1541
  const M = Array.from(a.current);
1542
1542
  return {
1543
1543
  inline: nt(M, [...gt]),
1544
1544
  text: e && v !== "none" ? tt(e, v) : null
1545
1545
  };
1546
- }, [e, v]), x = E(() => {
1546
+ }, [e, v]), x = $(() => {
1547
1547
  c.current.push(R()), c.current.length > Kn && c.current.shift(), P(c.current.length > 0);
1548
- }, [R]), I = E(
1548
+ }, [R]), T = $(
1549
1549
  (M) => {
1550
- var T;
1550
+ var L;
1551
1551
  if (!e) return;
1552
- const F = Array.from(a.current);
1553
- we(s.current.filter((_) => F.includes(_.element))), o.current && ke(o.current);
1552
+ const O = Array.from(a.current);
1553
+ we(s.current.filter((z) => O.includes(z.element))), o.current && ke(o.current);
1554
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")
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
1560
  for (const X of D)
1561
- rt(X, _.property, _.newValue);
1561
+ rt(X, z.property, z.newValue);
1562
1562
  else
1563
1563
  for (const X of D)
1564
- X.style.setProperty(_.property, _.newValue);
1564
+ X.style.setProperty(z.property, z.newValue);
1565
1565
  },
1566
1566
  [e, t, i, w]
1567
1567
  );
1568
- H(() => {
1568
+ _(() => {
1569
1569
  if (!e) {
1570
1570
  r.current = [], a.current = /* @__PURE__ */ new Set(), s.current = [], o.current = null, c.current = [], l({}), p({}), m("none"), b(""), N(""), k(/* @__PURE__ */ new Map()), P(!1);
1571
1571
  return;
1572
1572
  }
1573
1573
  const M = $e(e, t);
1574
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);
1575
+ const O = Me(e);
1576
+ l(O), p(O);
1577
1577
  const D = fe(e);
1578
1578
  return m(D.kind), b(D.value), N(D.value), o.current = D.kind !== "none" ? tt(e, D.kind) : null, ze(M, i), () => Ce(M);
1579
- }, [e]), H(() => {
1580
- e && I(!0);
1581
- }, [t]), H(() => {
1582
- var D;
1579
+ }, [e]), _(() => {
1580
+ e && T(!0);
1581
+ }, [t]), _(() => {
1582
+ var U;
1583
1583
  if (!e) return;
1584
1584
  const M = $e(e, t);
1585
1585
  r.current = M, we(
1586
- s.current.filter((z) => M.includes(z.element))
1586
+ s.current.filter((L) => M.includes(L.element))
1587
1587
  );
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);
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);
1594
1597
  }, [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;
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;
1600
1603
  });
1601
1604
  },
1602
1605
  [e, i]
1603
- ), h = E(
1604
- (M, F) => {
1606
+ ), h = $(
1607
+ (M, O) => {
1605
1608
  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] ?? "";
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] ?? "";
1610
1613
  for (const X of r.current)
1611
- X.style.setProperty(z, T), a.current.add(X);
1612
- C(z, _, T);
1614
+ X.style.setProperty(U, L), a.current.add(X);
1615
+ C(U, z, L);
1613
1616
  }
1614
1617
  },
1615
1618
  [e, f, u, x, C]
1616
- ), O = E(
1619
+ ), F = $(
1617
1620
  (M) => {
1618
1621
  if (!(!e || v === "none")) {
1619
1622
  x(), b(M);
1620
- for (const F of r.current)
1621
- rt(F, v, M), a.current.add(F);
1622
- C(v, L, M);
1623
+ for (const O of r.current)
1624
+ rt(O, v, M), a.current.add(O);
1625
+ C(v, E, M);
1623
1626
  }
1624
1627
  },
1625
- [e, v, L, x, C]
1626
- ), U = E(() => {
1628
+ [e, v, E, x, C]
1629
+ ), W = $(() => {
1627
1630
  const M = c.current.pop();
1628
1631
  if (M && (we(M.inline), M.text && ke(M.text), P(c.current.length > 0), e)) {
1629
1632
  l(Me(e));
1630
- const F = fe(e);
1631
- F.kind !== "none" && b(F.value);
1633
+ const O = fe(e);
1634
+ O.kind !== "none" && b(O.value);
1632
1635
  }
1633
- }, [e]), ge = E(() => {
1636
+ }, [e]), ge = $(() => {
1634
1637
  if (we(s.current), o.current && ke(o.current), c.current = [], P(!1), k(/* @__PURE__ */ new Map()), e) {
1635
1638
  l(Me(e));
1636
1639
  const M = fe(e);
1637
1640
  b(M.value);
1638
1641
  }
1639
- }, [e]), j = E(() => {
1642
+ }, [e]), j = $(() => {
1640
1643
  we(s.current), o.current && ke(o.current);
1641
- }, []), oe = E(() => {
1644
+ }, []), oe = $(() => {
1642
1645
  if (j(), Ce(Array.from(a.current)), c.current = [], P(!1), k(/* @__PURE__ */ new Map()), e) {
1643
1646
  l(Me(e));
1644
1647
  const M = fe(e);
1645
1648
  M.kind !== "none" && b(M.value);
1646
1649
  }
1647
1650
  }, [j, e]), re = e ? ((ee = w.get(e)) == null ? void 0 : ee.get(i)) ?? [] : [];
1648
- let W = 0;
1651
+ let V = 0;
1649
1652
  for (const M of w.values())
1650
- for (const F of M.values()) W += F.length;
1651
- const G = E(() => {
1653
+ for (const O of M.values()) V += O.length;
1654
+ const G = $(() => {
1652
1655
  k(/* @__PURE__ */ new Map());
1653
1656
  }, []);
1654
1657
  return {
@@ -1657,12 +1660,12 @@ function jn(e, t, i) {
1657
1660
  textValue: g,
1658
1661
  pendingChanges: re,
1659
1662
  pendingByElement: w,
1660
- totalPendingCount: W,
1663
+ totalPendingCount: V,
1661
1664
  clearAllPending: G,
1662
- canUndo: $,
1665
+ canUndo: I,
1663
1666
  updateProperty: h,
1664
- updateText: O,
1665
- undo: U,
1667
+ updateText: F,
1668
+ undo: W,
1666
1669
  reset: ge,
1667
1670
  clearPreviews: oe,
1668
1671
  revertPreviews: j
@@ -1687,27 +1690,27 @@ function qn({
1687
1690
  textKind: m,
1688
1691
  textValue: g,
1689
1692
  pendingChanges: b,
1690
- pendingByElement: L,
1693
+ pendingByElement: E,
1691
1694
  totalPendingCount: N,
1692
1695
  clearAllPending: w,
1693
1696
  canUndo: k,
1694
- updateProperty: $,
1697
+ updateProperty: I,
1695
1698
  updateText: P,
1696
1699
  undo: R,
1697
1700
  reset: x,
1698
- clearPreviews: I,
1701
+ clearPreviews: T,
1699
1702
  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,
1703
+ } = jn(e, a, o), { elementRef: h, isDragging: F, style: W, dragHandleProps: ge } = Rt({
1704
+ computeDefaultPosition: (L) => ({
1705
+ x: window.innerWidth - L.width - 16,
1703
1706
  y: 16
1704
1707
  })
1705
1708
  });
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(
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(
1711
1714
  (q) => q instanceof Element && !q.closest(
1712
1715
  "[data-pixelagent-root],[data-pixelagent-toolbar-portal],[data-pixelagent-picker-portal]"
1713
1716
  )
@@ -1715,11 +1718,11 @@ function qn({
1715
1718
  r(X ?? null);
1716
1719
  },
1717
1720
  [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(
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(
1723
1726
  (q) => q instanceof Element && !q.closest(
1724
1727
  "[data-pixelagent-root],[data-pixelagent-toolbar-portal],[data-pixelagent-picker-portal]"
1725
1728
  )
@@ -1728,21 +1731,21 @@ function qn({
1728
1731
  },
1729
1732
  [f, i]
1730
1733
  );
1731
- H(() => (document.addEventListener("mousemove", j, !0), document.addEventListener("click", oe, !0), () => {
1734
+ _(() => (document.addEventListener("mousemove", j, !0), document.addEventListener("click", oe, !0), () => {
1732
1735
  document.removeEventListener("mousemove", j, !0), document.removeEventListener("click", oe, !0);
1733
1736
  }), [j, oe]);
1734
1737
  const re = async () => {
1735
1738
  if (N === 0) return;
1736
- const T = await u(L);
1737
- T.applied && (w(), T.skipRevert || C());
1738
- }, W = e ? Ge(e) : null, G = e ? kt(e) : null, ee = e ? Ct(e) : 0, M = e ? Mt(e, "all-instances") : "", F = o !== "normal" && G === "tailwind" ? "Tailwind variant preview: matching hover:/focus:/… classes are applied without the prefix." : o !== "normal" ? "State preview uses focus/disabled simulation where possible." : null, D = ee > 1 ? a === "all-instances" ? `Preview & Apply on ${ee} elements (${M}).` : `This instance only — ${ee - 1} other on page.` : a === "all-instances" ? "Only one match — scope has no effect." : null, z = xe(() => !e || a !== "all-instances" ? [] : $e(e, "all-instances"), [e, a]);
1739
+ 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]);
1739
1742
  return /* @__PURE__ */ d(K, { children: [
1740
1743
  /* @__PURE__ */ n(
1741
1744
  $t,
1742
1745
  {
1743
1746
  element: a === "all-instances" ? null : t,
1744
1747
  selected: e,
1745
- multiSelected: z,
1748
+ multiSelected: U,
1746
1749
  primarySelected: e
1747
1750
  }
1748
1751
  ),
@@ -1750,8 +1753,8 @@ function qn({
1750
1753
  "div",
1751
1754
  {
1752
1755
  ref: h,
1753
- className: `pa-edit-panel-float ${O ? "pa-edit-panel-float--dragging" : ""}`,
1754
- style: U,
1756
+ className: `pa-edit-panel-float ${F ? "pa-edit-panel-float--dragging" : ""}`,
1757
+ style: W,
1755
1758
  children: /* @__PURE__ */ n(Te, { variant: "sheet", side: "right", className: "pa-edit-panel-glass", children: /* @__PURE__ */ d("div", { className: "pa-edit-panel-inner", children: [
1756
1759
  /* @__PURE__ */ d("div", { className: "pa-edit-panel-header", children: [
1757
1760
  /* @__PURE__ */ n(
@@ -1785,12 +1788,12 @@ All instances: ${M}`,
1785
1788
  children: Xe(e)
1786
1789
  }
1787
1790
  ),
1788
- ((W == null ? void 0 : W.sourceFile) || G) && /* @__PURE__ */ d("span", { className: "pa-edit-source", children: [
1789
- (W == null ? void 0 : W.sourceFile) && /* @__PURE__ */ d(K, { children: [
1790
- W.sourceFile,
1791
- W.lineNumber ? `:${W.lineNumber}` : ""
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}` : ""
1792
1795
  ] }),
1793
- W != null && W.sourceFile && G ? " · " : "",
1796
+ V != null && V.sourceFile && G ? " · " : "",
1794
1797
  G ?? ""
1795
1798
  ] })
1796
1799
  ] }),
@@ -1798,7 +1801,7 @@ All instances: ${M}`,
1798
1801
  Gn,
1799
1802
  {
1800
1803
  values: v,
1801
- onPropertyChange: $,
1804
+ onPropertyChange: I,
1802
1805
  textKind: m,
1803
1806
  textValue: g,
1804
1807
  onTextChange: P,
@@ -1808,17 +1811,17 @@ All instances: ${M}`,
1808
1811
  onElementStateChange: c,
1809
1812
  instanceCount: ee,
1810
1813
  scopeHint: D,
1811
- stateHint: F
1814
+ stateHint: O
1812
1815
  }
1813
1816
  ) }),
1814
1817
  /* @__PURE__ */ d("div", { className: "pa-edit-panel-sticky", children: [
1815
1818
  /* @__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: [
1819
+ /* @__PURE__ */ n(H, { variant: "regular", onClick: R, disabled: !k, children: /* @__PURE__ */ d("span", { className: "pa-glass-btn-inner", children: [
1817
1820
  /* @__PURE__ */ n(mn, { className: "pa-glass-btn-icon" }),
1818
1821
  /* @__PURE__ */ n("span", { children: "Undo" })
1819
1822
  ] }) }),
1820
1823
  /* @__PURE__ */ n(
1821
- V,
1824
+ H,
1822
1825
  {
1823
1826
  variant: "regular",
1824
1827
  onClick: x,
@@ -1839,12 +1842,12 @@ All instances: ${M}`,
1839
1842
  }
1840
1843
  ),
1841
1844
  /* @__PURE__ */ n(
1842
- V,
1845
+ H,
1843
1846
  {
1844
1847
  variant: "glass-primary",
1845
1848
  onClick: re,
1846
1849
  disabled: N === 0,
1847
- title: W != null && W.sourceFile ? void 0 : "No source file — Apply copies selector + changes to clipboard",
1850
+ title: V != null && V.sourceFile ? void 0 : "No source file — Apply copies selector + changes to clipboard",
1848
1851
  children: "Apply"
1849
1852
  }
1850
1853
  )
@@ -1880,7 +1883,7 @@ async function Jn(e, t = {}) {
1880
1883
  }
1881
1884
  function Zn(e) {
1882
1885
  const [t, i] = S(null);
1883
- return H(() => {
1886
+ return _(() => {
1884
1887
  if (!e) {
1885
1888
  i(null);
1886
1889
  return;
@@ -1981,16 +1984,16 @@ function sr({
1981
1984
  onCancel: r
1982
1985
  }) {
1983
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;
1984
- if (H(() => {
1987
+ if (_(() => {
1985
1988
  var w;
1986
1989
  (w = o.current) == null || w.focus();
1987
- }, [e]), H(() => {
1990
+ }, [e]), _(() => {
1988
1991
  const w = (k) => {
1989
1992
  k.key === "Escape" && r();
1990
1993
  };
1991
1994
  return document.addEventListener("keydown", w), () => document.removeEventListener("keydown", w);
1992
1995
  }, [r]), !p) return null;
1993
- const b = or(p), L = e.length > 1 ? `${e.length} selected` : u ? Xe(u) : "Area selection", N = (w) => {
1996
+ const b = or(p), E = e.length > 1 ? `${e.length} selected` : u ? Xe(u) : "Area selection", N = (w) => {
1994
1997
  a.trim() && i(a, w);
1995
1998
  };
1996
1999
  return /* @__PURE__ */ n(
@@ -2007,7 +2010,7 @@ function sr({
2007
2010
  "aria-label": "Add annotation",
2008
2011
  className: "pa-popover-body",
2009
2012
  children: [
2010
- /* @__PURE__ */ n("div", { className: "pa-popover-header", children: /* @__PURE__ */ n("span", { className: "pa-popover-selector", children: L }) }),
2013
+ /* @__PURE__ */ n("div", { className: "pa-popover-header", children: /* @__PURE__ */ n("span", { className: "pa-popover-selector", children: E }) }),
2011
2014
  (v || g) && /* @__PURE__ */ d("div", { className: "pa-popover-context", children: [
2012
2015
  v && /* @__PURE__ */ d("p", { className: "pa-popover-context-line", children: [
2013
2016
  /* @__PURE__ */ n("span", { className: "pa-popover-context-label", children: "Selected" }),
@@ -2037,9 +2040,9 @@ function sr({
2037
2040
  ] }),
2038
2041
  /* @__PURE__ */ n("p", { className: "pa-popover-hint", children: "⌘↵ Add · ⇧⌘↵ Add & next · Esc Cancel" }),
2039
2042
  /* @__PURE__ */ d("div", { className: "pa-popover-actions", children: [
2040
- /* @__PURE__ */ n(V, { variant: "ghost", onClick: r, children: "Cancel" }),
2043
+ /* @__PURE__ */ n(H, { variant: "ghost", onClick: r, children: "Cancel" }),
2041
2044
  /* @__PURE__ */ n(
2042
- V,
2045
+ H,
2043
2046
  {
2044
2047
  variant: "ghost",
2045
2048
  onClick: () => N(!0),
@@ -2048,7 +2051,7 @@ function sr({
2048
2051
  }
2049
2052
  ),
2050
2053
  /* @__PURE__ */ n(
2051
- V,
2054
+ H,
2052
2055
  {
2053
2056
  variant: "glass-primary",
2054
2057
  onClick: () => N(!1),
@@ -2143,7 +2146,7 @@ function ur(e) {
2143
2146
  const pr = 20;
2144
2147
  function hr({ annotations: e }) {
2145
2148
  const [t, i] = S([]);
2146
- return H(() => {
2149
+ return _(() => {
2147
2150
  if (e.length === 0) {
2148
2151
  i([]);
2149
2152
  return;
@@ -2228,7 +2231,7 @@ function fr({
2228
2231
  copyAllFrom: f
2229
2232
  }) {
2230
2233
  const [p, v] = S(null), [m, g] = S("");
2231
- H(() => {
2234
+ _(() => {
2232
2235
  const N = (w) => {
2233
2236
  w.key === "Escape" && (t ? r() : i());
2234
2237
  };
@@ -2236,7 +2239,7 @@ function fr({
2236
2239
  }, [t, r, i]);
2237
2240
  const b = (N) => {
2238
2241
  v(N.id), g(N.note);
2239
- }, L = (N) => {
2242
+ }, E = (N) => {
2240
2243
  m.trim() && (c(N, { note: m.trim() }), v(null));
2241
2244
  };
2242
2245
  return /* @__PURE__ */ d(
@@ -2249,7 +2252,7 @@ function fr({
2249
2252
  /* @__PURE__ */ d("div", { className: "pa-session-header", children: [
2250
2253
  /* @__PURE__ */ d("div", { className: "pa-session-header-main", children: [
2251
2254
  /* @__PURE__ */ n(
2252
- V,
2255
+ H,
2253
2256
  {
2254
2257
  variant: "ghost",
2255
2258
  className: "pa-glass-btn--sm pa-session-collapse-btn",
@@ -2273,7 +2276,7 @@ function fr({
2273
2276
  feedback: f === "session" ? u : null,
2274
2277
  slotClassName: "pa-copy-feedback-slot--session",
2275
2278
  children: /* @__PURE__ */ n(
2276
- V,
2279
+ H,
2277
2280
  {
2278
2281
  variant: "glass-primary",
2279
2282
  className: "pa-glass-btn--sm",
@@ -2284,7 +2287,7 @@ function fr({
2284
2287
  )
2285
2288
  }
2286
2289
  ),
2287
- /* @__PURE__ */ n(V, { variant: "ghost", onClick: r, "aria-label": "Close session panel", children: "✕" })
2290
+ /* @__PURE__ */ n(H, { variant: "ghost", onClick: r, "aria-label": "Close session panel", children: "✕" })
2288
2291
  ] })
2289
2292
  ] }),
2290
2293
  !t && /* @__PURE__ */ d("ul", { className: "pa-session-list", children: [
@@ -2305,12 +2308,12 @@ function fr({
2305
2308
  )
2306
2309
  ] }),
2307
2310
  /* @__PURE__ */ d("div", { className: "pa-session-item-actions", children: [
2308
- /* @__PURE__ */ n(V, { variant: "ghost", onClick: () => v(null), children: "Cancel" }),
2311
+ /* @__PURE__ */ n(H, { variant: "ghost", onClick: () => v(null), children: "Cancel" }),
2309
2312
  /* @__PURE__ */ n(
2310
- V,
2313
+ H,
2311
2314
  {
2312
2315
  variant: "glass-primary",
2313
- onClick: () => L(N.id),
2316
+ onClick: () => E(N.id),
2314
2317
  disabled: !m.trim(),
2315
2318
  children: "Save"
2316
2319
  }
@@ -2332,7 +2335,7 @@ function fr({
2332
2335
  children: "Copied!"
2333
2336
  }
2334
2337
  ) : /* @__PURE__ */ n(
2335
- V,
2338
+ H,
2336
2339
  {
2337
2340
  variant: "glass-primary",
2338
2341
  className: "pa-glass-btn--sm",
@@ -2342,7 +2345,7 @@ function fr({
2342
2345
  }
2343
2346
  ),
2344
2347
  /* @__PURE__ */ n(
2345
- V,
2348
+ H,
2346
2349
  {
2347
2350
  variant: "ghost",
2348
2351
  className: "pa-glass-btn--sm",
@@ -2352,7 +2355,7 @@ function fr({
2352
2355
  }
2353
2356
  ),
2354
2357
  /* @__PURE__ */ n(
2355
- V,
2358
+ H,
2356
2359
  {
2357
2360
  variant: "ghost",
2358
2361
  className: "pa-glass-btn--sm",
@@ -2423,7 +2426,7 @@ function br({
2423
2426
  onToggleHostTheme: a
2424
2427
  }) {
2425
2428
  const s = Y(null);
2426
- return H(() => {
2429
+ return _(() => {
2427
2430
  if (!e) return;
2428
2431
  const o = (u) => {
2429
2432
  u.key === "Escape" && t();
@@ -2445,7 +2448,7 @@ function br({
2445
2448
  /* @__PURE__ */ d("div", { className: "pa-settings-row", children: [
2446
2449
  /* @__PURE__ */ n("span", { className: "pa-settings-row-value", children: i === "dark" ? "Dark canvas" : "Light canvas" }),
2447
2450
  /* @__PURE__ */ n(
2448
- V,
2451
+ H,
2449
2452
  {
2450
2453
  variant: "icon",
2451
2454
  onClick: a,
@@ -2527,15 +2530,15 @@ function Cr({
2527
2530
  copyAllFrom: m,
2528
2531
  onActivateAnnotate: g,
2529
2532
  onActivateEdit: b,
2530
- onDeactivate: L,
2533
+ onDeactivate: E,
2531
2534
  onCopyAll: N,
2532
2535
  onCaptureModeChange: w,
2533
2536
  onConfirmMultiSelect: k
2534
2537
  }) {
2535
- const { elementRef: $, isDragging: P, style: R, dragHandleProps: x } = Rt(), I = /* @__PURE__ */ d(
2538
+ const { elementRef: I, isDragging: P, style: R, dragHandleProps: x } = Rt(), T = /* @__PURE__ */ d(
2536
2539
  "div",
2537
2540
  {
2538
- ref: $,
2541
+ ref: I,
2539
2542
  className: `pa-toolbar-float ${P ? "pa-toolbar-float--dragging" : ""}`,
2540
2543
  style: R,
2541
2544
  role: "toolbar",
@@ -2579,7 +2582,7 @@ function Cr({
2579
2582
  }
2580
2583
  ),
2581
2584
  p > 0 && /* @__PURE__ */ n(
2582
- V,
2585
+ H,
2583
2586
  {
2584
2587
  variant: "glass-primary",
2585
2588
  onClick: k,
@@ -2593,7 +2596,7 @@ function Cr({
2593
2596
  feedback: m === "toolbar" ? v : null,
2594
2597
  slotClassName: "pa-copy-feedback-slot--toolbar",
2595
2598
  children: /* @__PURE__ */ n(
2596
- V,
2599
+ H,
2597
2600
  {
2598
2601
  variant: "glass-primary",
2599
2602
  onClick: N,
@@ -2607,11 +2610,11 @@ function Cr({
2607
2610
  ] })
2608
2611
  ] }),
2609
2612
  /* @__PURE__ */ n(
2610
- V,
2613
+ H,
2611
2614
  {
2612
2615
  variant: "icon",
2613
2616
  className: "pa-toolbar-close",
2614
- onClick: L,
2617
+ onClick: E,
2615
2618
  "aria-label": "Close",
2616
2619
  children: /* @__PURE__ */ n(
2617
2620
  "svg",
@@ -2635,13 +2638,13 @@ function Cr({
2635
2638
  }
2636
2639
  )
2637
2640
  ] }) : /* @__PURE__ */ d("div", { className: "pa-toolbar-segment", children: [
2638
- /* @__PURE__ */ n(V, { onClick: g, children: "Annotate" }),
2639
- /* @__PURE__ */ n(V, { onClick: b, children: "Edit" })
2641
+ /* @__PURE__ */ n(H, { onClick: g, children: "Annotate" }),
2642
+ /* @__PURE__ */ n(H, { onClick: b, children: "Edit" })
2640
2643
  ] }),
2641
2644
  !c && /* @__PURE__ */ d(K, { children: [
2642
2645
  /* @__PURE__ */ n("span", { className: "pa-toolbar-divider", "aria-hidden": "true" }),
2643
2646
  /* @__PURE__ */ n(
2644
- V,
2647
+ H,
2645
2648
  {
2646
2649
  variant: "icon",
2647
2650
  className: "pa-toolbar-settings",
@@ -2659,14 +2662,14 @@ function Cr({
2659
2662
  ]
2660
2663
  }
2661
2664
  );
2662
- return typeof document > "u" ? I : Ke(
2665
+ return typeof document > "u" ? T : Ke(
2663
2666
  /* @__PURE__ */ n(
2664
2667
  "div",
2665
2668
  {
2666
2669
  className: "pa-root pa-root--toolbar-portal",
2667
2670
  "data-pixelagent-toolbar-portal": !0,
2668
2671
  ...e,
2669
- children: I
2672
+ children: T
2670
2673
  }
2671
2674
  ),
2672
2675
  document.body
@@ -2679,14 +2682,14 @@ function Mr() {
2679
2682
  return ((s = e.current) == null ? void 0 : s.annotations) ?? [];
2680
2683
  }
2681
2684
  );
2682
- H(() => {
2685
+ _(() => {
2683
2686
  en({ annotations: t });
2684
2687
  }, [t]);
2685
- const r = E((s, o) => {
2688
+ const r = $((s, o) => {
2686
2689
  i(
2687
2690
  (c) => c.map((u) => u.id === s ? { ...u, ...o } : u)
2688
2691
  );
2689
- }, []), a = E((s) => {
2692
+ }, []), a = $((s) => {
2690
2693
  i((o) => o.filter((c) => c.id !== s));
2691
2694
  }, []);
2692
2695
  return {
@@ -2707,7 +2710,7 @@ function Ar({
2707
2710
  ), [a, s] = S(
2708
2711
  () => t ?? it(r) ?? "dark"
2709
2712
  ), [o, c] = S(!1), u = t ?? a;
2710
- H(() => {
2713
+ _(() => {
2711
2714
  if (t !== void 0) return;
2712
2715
  const v = () => {
2713
2716
  const b = it(r);
@@ -2723,14 +2726,14 @@ function Ar({
2723
2726
  const l = xe(
2724
2727
  () => nn(r, u),
2725
2728
  [r, u]
2726
- ), f = E(() => {
2729
+ ), f = $(() => {
2727
2730
  const v = u === "dark" ? "light" : "dark";
2728
2731
  if (i) {
2729
2732
  i(v);
2730
2733
  return;
2731
2734
  }
2732
2735
  s(v), rn(v, r);
2733
- }, [u, i, r]), p = E(() => {
2736
+ }, [u, i, r]), p = $(() => {
2734
2737
  c((v) => !v);
2735
2738
  }, []);
2736
2739
  return {
@@ -2801,7 +2804,7 @@ function $r({
2801
2804
  runtimeStateStyles: s
2802
2805
  } = {}) {
2803
2806
  const o = Ar({ ui: e, hostTheme: t, onHostThemeChange: i }), [c, u] = S(null);
2804
- H(() => {
2807
+ _(() => {
2805
2808
  if (r || a) return;
2806
2809
  let y = !1;
2807
2810
  return fetch(yt, { method: "GET" }).then((A) => {
@@ -2813,17 +2816,17 @@ function $r({
2813
2816
  }, [r, a]);
2814
2817
  const [l, f] = S(!1), [p, v] = S("idle"), [m, g] = S("element"), {
2815
2818
  annotations: b,
2816
- setAnnotations: L,
2819
+ setAnnotations: E,
2817
2820
  updateAnnotation: N,
2818
2821
  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(
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 = $(
2820
2823
  (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);
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);
2823
2826
  }, 2500);
2824
2827
  },
2825
2828
  []
2826
- ), Ne = E(
2829
+ ), Ne = $(
2827
2830
  async (y, A, J) => {
2828
2831
  if (y)
2829
2832
  try {
@@ -2833,27 +2836,27 @@ function $r({
2833
2836
  }
2834
2837
  },
2835
2838
  [de]
2836
- ), ve = E(
2839
+ ), ve = $(
2837
2840
  (y, A) => {
2838
2841
  y.length === 0 && !A || (h({ elements: y, areaBbox: A }), R(y[0] ?? null));
2839
2842
  },
2840
2843
  []
2841
- ), De = E(
2844
+ ), De = $(
2842
2845
  (y) => {
2843
2846
  if (!(!l || p !== "annotate" || Ee(y.target))) {
2844
- if (O) {
2845
- U(
2847
+ if (F) {
2848
+ W(
2846
2849
  (A) => A && { ...A, currentX: y.clientX, currentY: y.clientY }
2847
2850
  );
2848
2851
  return;
2849
2852
  }
2850
- m !== "area" && $(vt(y.clientX, y.clientY));
2853
+ m !== "area" && I(vt(y.clientX, y.clientY));
2851
2854
  }
2852
2855
  },
2853
- [l, p, O, m]
2854
- ), Oe = E(
2856
+ [l, p, F, m]
2857
+ ), Oe = $(
2855
2858
  (y) => {
2856
- !l || p !== "annotate" || Ee(y.target) || m !== "area" || y.button !== 0 || (y.preventDefault(), y.stopPropagation(), U({
2859
+ !l || p !== "annotate" || Ee(y.target) || m !== "area" || y.button !== 0 || (y.preventDefault(), y.stopPropagation(), W({
2857
2860
  startX: y.clientX,
2858
2861
  startY: y.clientY,
2859
2862
  currentX: y.clientX,
@@ -2861,20 +2864,20 @@ function $r({
2861
2864
  }), h(null));
2862
2865
  },
2863
2866
  [l, p, m]
2864
- ), Fe = E(() => {
2865
- if (!O) return;
2866
- const y = Nt(O);
2867
- if (U(null), y.width < 8 || y.height < 8) return;
2867
+ ), Fe = $(() => {
2868
+ if (!F) return;
2869
+ const y = Nt(F);
2870
+ if (W(null), y.width < 8 || y.height < 8) return;
2868
2871
  const A = on(y, Ze);
2869
2872
  ve(A, y);
2870
- }, [O, ve]), Be = E(
2873
+ }, [F, ve]), Be = $(
2871
2874
  (y) => {
2872
2875
  if (!l || p !== "annotate" || Ee(y.target) || m === "area") return;
2873
2876
  y.preventDefault(), y.stopPropagation();
2874
2877
  const A = vt(y.clientX, y.clientY);
2875
2878
  if (!A) return;
2876
2879
  if (y.shiftKey || m === "multi") {
2877
- I((te) => te.includes(A) ? te.filter((B) => B !== A) : [...te, A]), R(A);
2880
+ T((te) => te.includes(A) ? te.filter((B) => B !== A) : [...te, A]), R(A);
2878
2881
  return;
2879
2882
  }
2880
2883
  const J = x.length > 0 ? x : [A];
@@ -2882,15 +2885,15 @@ function $r({
2882
2885
  },
2883
2886
  [l, p, m, x, ve]
2884
2887
  );
2885
- H(() => {
2888
+ _(() => {
2886
2889
  !P || G !== "all-instances" || Ct(P) <= 1 && ee("this-instance");
2887
- }, [P, G]), H(() => {
2890
+ }, [P, G]), _(() => {
2888
2891
  if (l)
2889
2892
  return document.addEventListener("mousemove", De, !0), document.addEventListener("mousedown", Oe, !0), document.addEventListener("mouseup", Fe, !0), document.addEventListener("click", Be, !0), () => {
2890
2893
  document.removeEventListener("mousemove", De, !0), document.removeEventListener("mousedown", Oe, !0), document.removeEventListener("mouseup", Fe, !0), document.removeEventListener("click", Be, !0);
2891
2894
  };
2892
2895
  }, [l, De, Oe, Fe, Be]);
2893
- const Vt = E(
2896
+ const Vt = $(
2894
2897
  (y, A) => {
2895
2898
  if (!C || !y.trim()) return;
2896
2899
  const { elements: J, areaBbox: te } = C;
@@ -2900,24 +2903,24 @@ function $r({
2900
2903
  note: y,
2901
2904
  areaBbox: te
2902
2905
  });
2903
- L((B) => [...B, be]), j(!1), re(!1), A ? (h(null), R(null)) : (h(null), R(null), I([]));
2906
+ E((B) => [...B, be]), j(!1), re(!1), A ? (h(null), R(null)) : (h(null), R(null), T([]));
2904
2907
  },
2905
- [C, L]
2906
- ), Wt = E(() => {
2908
+ [C, E]
2909
+ ), Wt = $(() => {
2907
2910
  h(null), R(null);
2908
- }, []), Qe = E(
2911
+ }, []), Qe = $(
2909
2912
  async (y) => {
2910
2913
  const A = sn(b);
2911
2914
  await Ne(A, "Copied all!", { copyAllFrom: y });
2912
2915
  },
2913
2916
  [b, Ne]
2914
- ), Ut = E(
2917
+ ), Ut = $(
2915
2918
  async (y) => {
2916
2919
  const A = b.find((J) => J.id === y);
2917
2920
  A && await Ne(ln(A), "Copied!", { entryId: y });
2918
2921
  },
2919
2922
  [b, Ne]
2920
- ), Yt = E(
2923
+ ), Yt = $(
2921
2924
  async (y) => {
2922
2925
  const A = [];
2923
2926
  for (const [B, Z] of y)
@@ -2960,10 +2963,10 @@ function $r({
2960
2963
  },
2961
2964
  [G, r, c, a, s, de]
2962
2965
  ), et = (y) => {
2963
- o.setSettingsOpen(!1), f(!0), v(y), R(null), $(null), h(null), I([]), U(null), y === "annotate" && j(!1);
2966
+ o.setSettingsOpen(!1), f(!0), v(y), R(null), I(null), h(null), T([]), W(null), y === "annotate" && j(!1);
2964
2967
  }, Xt = () => {
2965
- f(!1), v("idle"), R(null), $(null), h(null), I([]), U(null), j(!1), re(!1);
2966
- }, Gt = O ? Nt(O) : null;
2968
+ f(!1), v("idle"), R(null), I(null), h(null), T([]), W(null), j(!1), re(!1);
2969
+ }, Gt = F ? Nt(F) : null;
2967
2970
  return /* @__PURE__ */ d(
2968
2971
  "div",
2969
2972
  {
@@ -3009,7 +3012,7 @@ function $r({
3009
3012
  }
3010
3013
  ),
3011
3014
  /* @__PURE__ */ n(hr, { annotations: b }),
3012
- /* @__PURE__ */ n(lr, { area: Gt, isDragging: !!O })
3015
+ /* @__PURE__ */ n(lr, { area: Gt, isDragging: !!F })
3013
3016
  ] }),
3014
3017
  l && p === "annotate" && C && /* @__PURE__ */ n(
3015
3018
  sr,
@@ -3026,17 +3029,17 @@ function $r({
3026
3029
  selectedElement: P,
3027
3030
  hoveredElement: k,
3028
3031
  onSelectElement: R,
3029
- onHoverElement: $,
3032
+ onHoverElement: I,
3030
3033
  targetScope: G,
3031
3034
  onTargetScopeChange: ee,
3032
3035
  elementState: M,
3033
- onElementStateChange: F,
3036
+ onElementStateChange: O,
3034
3037
  onApply: Yt,
3035
3038
  applyStatus: p === "edit" ? D : null,
3036
3039
  isToolbarTarget: Ee
3037
3040
  }
3038
3041
  ),
3039
- W && /* @__PURE__ */ n(
3042
+ V && /* @__PURE__ */ n(
3040
3043
  fr,
3041
3044
  {
3042
3045
  annotations: b,
@@ -3050,7 +3053,7 @@ function $r({
3050
3053
  onRemove: w,
3051
3054
  onUpdate: N,
3052
3055
  copyStatus: D,
3053
- copiedEntryId: T,
3056
+ copiedEntryId: L,
3054
3057
  copyAllFrom: X
3055
3058
  }
3056
3059
  )